more modern js, more keyboard-controls #5

Merged
zotan merged 30 commits from ctucx/webmusic:master into master 2021-03-21 18:04:15 +01:00
Showing only changes of commit 4db20d159a - Show all commits

View file

@ -24,6 +24,10 @@ window.onkeyup = function (event) {
case " ":
case "p":
if (gstate == "idle" && total !== 0) {
if (document.getElementById(index).classList.contains('dir')) {
return nextTrack();
}
playSong(index)
} else {
togglePlayback();
@ -187,6 +191,10 @@ function updateState() {
function previousTrack() {
if (index-- === 0) index = total-1;
if (document.getElementById(index).classList.contains('dir')) {
return previousTrack();
}
if (continuelist) {
playSong(index)
}
@ -195,6 +203,10 @@ function previousTrack() {
function nextTrack() {
if (++index === total) index = 0;
if (document.getElementById(index).classList.contains('dir')) {
return nextTrack();
}
if (continuelist) {
playSong(index)
}