summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah (ctucx) <leah@ctu.cx>2021-03-08 13:35:03 +0100
committerLeah (ctucx) <leah@ctu.cx>2021-03-08 13:35:03 +0100
commit34e37fe4ecedefa254d1029ecc2f62718f3bee43 (patch)
treefea4323f297bc363106a33bb0401fe5ffc8a7f2f
parent04e1b588142f2beaa97e031625241480aab23e18 (diff)
webmusic.js: hide selector when track selected
-rw-r--r--webmusic.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/webmusic.js b/webmusic.js
index 3e15933..eeea892 100644
--- a/webmusic.js
+++ b/webmusic.js
@@ -161,7 +161,6 @@ const updateButtonState = () => {
}
}
-
const playSong = (id) => {
const element = document.getElementById(id);
@@ -172,16 +171,19 @@ const playSong = (id) => {
document.getElementsByClassName('playing')[0].classList.remove('playing');
}
- playingItem = element.id;
+ if (document.getElementsByClassName('selected').length > 0) {
+ document.getElementsByClassName('selected')[0].classList.remove('selected');
+ }
audioPlayer.pause()
+ playingItem = element.id;
+ element.classList.add('playing');
+
audioPlayer.src = element.href;
setPlayerState('loading');
audioPlayer.load();
-
- element.classList.add('playing');
}
const togglePlayback = () => {