From 4db20d159ab8b8d6d055405a933ca159a5bb5088 Mon Sep 17 00:00:00 2001 From: ctucx Date: Sun, 7 Mar 2021 01:13:22 +0100 Subject: [PATCH] webmusic.js: skip folders --- webmusic.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/webmusic.js b/webmusic.js index 74ca6cb..e4f2c6c 100644 --- a/webmusic.js +++ b/webmusic.js @@ -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) }