the-glorious-startpage/js/keybindings.js
2020-06-04 15:09:22 +08:00

31 lines
644 B
JavaScript

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];
}
);