diff --git a/index.html b/index.html index ef41809..a9c01ff 100644 --- a/index.html +++ b/index.html @@ -234,5 +234,6 @@ + \ No newline at end of file diff --git a/js/keybindings.js b/js/keybindings.js new file mode 100644 index 0000000..d1e349e --- /dev/null +++ b/js/keybindings.js @@ -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]; + } +); \ No newline at end of file diff --git a/js/weather-screen.js b/js/weather-screen.js index 469e58a..95560bc 100644 --- a/js/weather-screen.js +++ b/js/weather-screen.js @@ -265,7 +265,7 @@ const toggleWeatherScreen = () => { } else if (dashboard.classList.contains('showRightDashboard')) { console.log('dashboard is open, closing...'); hideDashboard(); - return; + // return; } // Toggle center box diff --git a/js/web-menu.js b/js/web-menu.js index 20ff84a..d02f12c 100644 --- a/js/web-menu.js +++ b/js/web-menu.js @@ -226,7 +226,6 @@ const toggleWebMenu = () => { } else if (dashboard.classList.contains('showRightDashboard')) { console.log('dashboard is open, closing...'); hideDashboard(); - return; } // Toggle center box