commit 34e37fe4ecedefa254d1029ecc2f62718f3bee43
parent 04e1b588142f2beaa97e031625241480aab23e18
Author: Leah (ctucx) <leah@ctu.cx>
Date: Mon, 8 Mar 2021 13:35:03 +0100
parent 04e1b588142f2beaa97e031625241480aab23e18
Author: Leah (ctucx) <leah@ctu.cx>
Date: Mon, 8 Mar 2021 13:35:03 +0100
webmusic.js: hide selector when track selected
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git 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 = () => {