diff options
Diffstat (limited to 'assets/js/shortcuts.js')
-rw-r--r-- | assets/js/shortcuts.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/assets/js/shortcuts.js b/assets/js/shortcuts.js index 2fa48ca..6ed3c67 100644 --- a/assets/js/shortcuts.js +++ b/assets/js/shortcuts.js @@ -1,24 +1,27 @@ document.onkeydown = (e) => { - - if ((e.metaKey || e.ctrlKey) && e.key === ".") { + if ((e.metaKey || e.ctrlKey) && e.code === "Comma") { + if (window.parent.currentSong === null) return; e.preventDefault(); window.parent.stop(); return false; } - if ((e.metaKey || e.ctrlKey) && e.key === "ArrowRight") { + if ((e.metaKey || e.ctrlKey) && e.code === "ArrowRight") { + if (window.parent.currentSong === null) return; e.preventDefault(); window.parent.next(); return false; } - if ((e.metaKey || e.ctrlKey) && e.key === "ArrowLeft") { + if ((e.metaKey || e.ctrlKey) && e.code === "ArrowLeft") { + if (window.parent.currentSong === null) return; e.preventDefault(); window.parent.previous(); return false; } - if (e.key === " " && e.target.tagName !== "INPUT") { + if (e.code === "Space" && e.target.tagName !== "INPUT") { + if (window.parent.currentSong === null) return; e.preventDefault(); window.parent.playPause(); return false; |