ctucx.git: webmusic-nginx

nginx xslt-based index files optimized for music, inspired by https://git.ztn.sh/zotan/webmusic

commit 0a9512e9f7df1a60b376fc8620ce1d2ba444ef58
parent deb0a1e49f3319bd672851100b7ffee9b0871e0c
Author: ctucx <c@ctu.cx>
Date: Sun, 7 Mar 2021 01:13:22 +0100

webmusic.js: skip folders
1 file changed, 12 insertions(+), 0 deletions(-)
M
webmusic.js
|
12
++++++++++++
diff --git 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)
 	}