ctucx.git: webmusic-nginx

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

commit b246cd3ff4d02e8e26fe2b9c12f95fa54336cc9b
parent 45ca1f6338945691e7eda94873a2e546f374321d
Author: Leah (ctucx) <leah@ctu.cx>
Date: Sun, 7 Mar 2021 15:16:55 +0100

webmusic.js: renamed setState to setPlayerState and updateState to updatePlayerState
1 file changed, 10 insertions(+), 10 deletions(-)
M
webmusic.js
|
20
++++++++++----------
diff --git a/webmusic.js b/webmusic.js
@@ -78,18 +78,18 @@ const initState = () => {
 	});
 
 	total = id;
-	updateState();
+	updatePlayerState();
 	updateButtonState();
 }
 
-const setState = (state) => {
+const setPlayerState = (state) => {
 	gstate = state;
 
 	console.log("now in state: " + state);
-	updateState();
+	updatePlayerState();
 }
 
-const updateState = () => {
+const updatePlayerState = () => {
 	let statestr = "[" + gstate;
 
 	if (!audioPlayer.paused) {

@@ -130,7 +130,7 @@ const playSong = (id) => {
 	audioPlayer.pause()
 	audioPlayer.src = element.href;
 
-	setState("loading");
+	setPlayerState("loading");
 	audioPlayer.load();
 
 	audioPlayer.loop = repeat;

@@ -142,24 +142,24 @@ const playSong = (id) => {
 	});
 
 	audioPlayer.addEventListener("play", function () {
-		setState("playing");
+		setPlayerState("playing");
 	});
 
 	audioPlayer.addEventListener("pause", function () {
-		setState("paused");
+		setPlayerState("paused");
 	});
 
 	audioPlayer.addEventListener("error", function () {
-		setState("error loading track");
+		setPlayerState("error loading track");
 	});
 
 	audioPlayer.addEventListener("ended", function () {
-		setState("idle");
+		setPlayerState("idle");
 		nextTrack();
 	});
 
 	audioPlayer.addEventListener("timeupdate", function () {
-		updateState();
+		updatePlayerState();
 	});
 }