forked from extern/the-glorious-startpage
add keybinding
This commit is contained in:
parent
fdd1f0296f
commit
af07931c2a
@ -234,5 +234,6 @@
|
||||
<script src="js/centered-box.js"></script>
|
||||
<script src="js/mobile-swipe-event.js"></script>
|
||||
<script src="js/mobile-swipe-callback.js"></script>
|
||||
<script src="js/keybindings.js"></script>
|
||||
</body>
|
||||
</html>
|
31
js/keybindings.js
Normal file
31
js/keybindings.js
Normal file
@ -0,0 +1,31 @@
|
||||
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];
|
||||
}
|
||||
);
|
@ -265,7 +265,7 @@ const toggleWeatherScreen = () => {
|
||||
} else if (dashboard.classList.contains('showRightDashboard')) {
|
||||
console.log('dashboard is open, closing...');
|
||||
hideDashboard();
|
||||
return;
|
||||
// return;
|
||||
}
|
||||
|
||||
// Toggle center box
|
||||
|
@ -226,7 +226,6 @@ const toggleWebMenu = () => {
|
||||
} else if (dashboard.classList.contains('showRightDashboard')) {
|
||||
console.log('dashboard is open, closing...');
|
||||
hideDashboard();
|
||||
return;
|
||||
}
|
||||
|
||||
// Toggle center box
|
||||
|
Loading…
Reference in New Issue
Block a user