Add new key-commands: alias space with p, seeking with arrowkeys left/right, jumping between tracks with arrowkey up/down

This commit is contained in:
Leah 2021-03-05 21:02:29 +01:00
parent 6731aebfaa
commit f9c08f2948
1 changed files with 22 additions and 2 deletions

View File

@ -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);
}
};