diff --git a/modules/web.html b/modules/web.html index 263c1a3..201a4fa 100644 --- a/modules/web.html +++ b/modules/web.html @@ -78,7 +78,6 @@
- @@ -418,23 +417,21 @@ else console.error("WebSocket not connected."); }); - document.getElementById("readd-btn").addEventListener("click", () => { - if(selectedPlaylistIndex == null){ - alert("Select a playlist item to re-add."); - return; - } - const selected = playlist[selectedPlaylistIndex]; - if(!selected) { alert("Invalid selection"); return; } - const path = (selected.official ? "" : "!") + selected.path; - ws.send(JSON.stringify({action:"add_to_toplay", songs: [path]})) - Array.from(document.getElementById("playlist-ul").children).forEach(c => c.classList.remove("selected")); - selectedPlaylistIndex = null; - }); document.getElementById("clear-btn").addEventListener("click", () => {ws.send(JSON.stringify({action:"clear_toplay"}))}); function addSelectedFileToQueue() { let fullPath = null; + if(selectedPlaylistIndex != null) { + const selected = playlist[selectedPlaylistIndex]; + if(!selected) { alert("Invalid selection"); return; } + const path = (selected.official ? "" : "!") + selected.path; + ws.send(JSON.stringify({action:"add_to_toplay", songs: [path]})) + Array.from(document.getElementById("playlist-ul").children).forEach(c => c.classList.remove("selected")); + selectedPlaylistIndex = null; + return; + } + // Priority 1: selected subdirectory file if (selectedSubFile && selectedDir) { fullPath = subbasePath.replace(/\/$/, '') + '/' + selectedSubFile; @@ -463,9 +460,6 @@ document.getElementById("add-to-queue-btn").addEventListener("click", addSelectedFileToQueue); function updateControls() { - document.getElementById("readd-btn").disabled = - selectedPlaylistIndex === null; - document.getElementById("clear-btn").disabled = Queue.length === 0; }