ctucx.git: webmusic-nginx

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

commit fd0af3fa27d02f0b6084188864491a7aa41850db
parent b246cd3ff4d02e8e26fe2b9c12f95fa54336cc9b
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sun, 7 Mar 2021 15:22:50 +0100

webmusic.js: renamed gstate to playerState
1 file changed, 4 insertions(+), 4 deletions(-)
M
webmusic.js
|
8
++++----
diff --git a/webmusic.js b/webmusic.js
@@ -1,7 +1,7 @@
 let audioPlayer  = new Audio();
+let playerState  = "idle";
 let continuous   = true;
 let repeat       = false;
-let gstate       = "idle";
 let total        = 0;
 let index        = 0;
 

@@ -9,7 +9,7 @@ const handleKeyEvent = (event) => {
 	switch (event.key) {
 		case " ":
 		case "p":
-			if (gstate == "idle" && total !== 0) {
+			if (playerState == "idle" && total !== 0) {
 				if (document.getElementById(index).classList.contains('dir')) {
 					return nextTrack();
 				}

@@ -83,14 +83,14 @@ const initState = () => {
 }
 
 const setPlayerState = (state) => {
-	gstate = state;
+	playerState = state;
 
 	console.log("now in state: " + state);
 	updatePlayerState();
 }
 
 const updatePlayerState = () => {
-	let statestr = "[" + gstate;
+	let statestr = "[" + playerState;
 
 	if (!audioPlayer.paused) {
 		statestr += " " + formatTime(audioPlayer.currentTime) + "/" + formatTime(audioPlayer.duration);