commit d19f51b7282f2fba6490098fb52c50abaa86c8e1
parent 02b4e3496e252ee853e80954c827485ba5cf4177
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sat, 13 Mar 2021 22:56:04 +0100
parent 02b4e3496e252ee853e80954c827485ba5cf4177
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sat, 13 Mar 2021 22:56:04 +0100
album.js: fix for stupid chrome
1 file changed, 18 insertions(+), 17 deletions(-)
diff --git a/src/assets/albums.js b/src/assets/albums.js @@ -25,26 +25,27 @@ const resizeHandler = () => { }); }; -const keyHandler = (event) => { +resizeHandler(); + +document.addEventListener('keyup', () => { if (event.ctrlKey === true || event.altKey === true) return; - switch (event.key) { - case "Escape": - document.getElementById("back").click(); - break; - - case " ": - event.preventDefault(); - event.stopPropagation(); - - const element = document.getElementById("toggle"); - element.checked = !element.checked; - - break; + if (event.key == "Escape") { + window.stop() + document.getElementById('back').click(); }; -}; +}); + +document.addEventListener('keydown', () => { + if (event.ctrlKey === true || event.altKey === true) return; + if (event.key == " ") { + event.preventDefault(); + event.stopPropagation(); + + const element = document.getElementById("toggle"); + element.checked = !element.checked; + }; +}); -resizeHandler() -document.addEventListener('keydown', keyHandler); document.addEventListener('DOMContentLoaded', () => { const photosElement = document.getElementById("photos") photosElement.classList.remove('flex');