commit 299f2c26a867bdb5c05fdf107570dfa776531d7e
parent 900a52153d88038f465c85c9b106af341a6cc096
Author: Leah (ctucx) <leah@ctu.cx>
Date: Fri, 5 Mar 2021 21:02:29 +0100
parent 900a52153d88038f465c85c9b106af341a6cc096
Author: Leah (ctucx) <leah@ctu.cx>
Date: Fri, 5 Mar 2021 21:02:29 +0100
Add new key-commands: alias space with p, seeking with arrowkeys left/right, jumping between tracks with arrowkey up/down
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/webmusic.js b/webmusic.js @@ -21,8 +21,12 @@ window.onload = function () { }; window.onkeyup = function (event) { - if (event.key === "p") { - togglePlayback(); + if (event.key === " " || event.key === "p") { + if (gstate !== "idle") { + togglePlayback(); + } else { + playSong(queue[0]) + } } else if (event.key === "r") { toggleRepeat(); @@ -30,6 +34,22 @@ window.onkeyup = function (event) { else if (event.key === "c") { toggleContinue(); } + else if (event.key === "ArrowUp") { + previousTrack(); + } + else if (event.key === "ArrowDown") { + nextTrack(); + } + else if (event.key === "ArrowLeft") { + if (sound.seek() < 10) { + sound.seek(0); + } else { + sound.seek(sound.seek()-10); + } + } + else if (event.key === "ArrowRight") { + sound.seek(sound.seek()+10); + } };