the-glorious-startpage/js/keybindings.js

31 lines
644 B
JavaScript
Raw Normal View History

2020-06-04 09:09:22 +02:00
let keysPressed = {};
document.addEventListener(
'keydown',
(event) => {
event.preventDefault();
keysPressed[event.key] = true;
// Open dashboard
if (keysPressed['Alt'] && event.key === 's') {
toggleDashboard();
return;
} else if (keysPressed['Alt'] && event.key === 'e') {
toggleWebMenu();
return;
} else if (keysPressed['Alt'] && event.key === 'x') {
toggleWeatherScreen();
return;
}
}
);
document.addEventListener(
'keyup',
(event) => {
delete keysPressed[event.key];
}
);