0
1
mirror of https://github.com/radio95-rnt/RadioPlayer.git synced 2026-02-26 13:52:00 +01:00
This commit is contained in:
2025-12-27 22:54:53 +01:00
parent 7c9bd167ef
commit b29ae118c7

View File

@@ -487,15 +487,14 @@
function addSelectedFileToQueue(top) {
let fullPath = null;
let success = false;
if (selectedPlaylistIndex != null) {
const selected = playlist[selectedPlaylistIndex];
const path = (selected.official ? "" : "!") + selected.path;
ws.send(JSON.stringify({action:"add_to_toplay", songs: [path], top: top}))
Array.from(document.getElementById("playlist-ul").children).forEach(c => c.classList.remove("selected"));
selectedPlaylistIndex = null;
return true;
}
if (selectedSubFile && selectedDir) {
ws.send(JSON.stringify({ action: "add_to_toplay", songs: [path], top: top }));
success = true;
} else if (selectedSubFile && selectedDir) {
fullPath = subbasePath.replace(/\/$/, '') + '/' + selectedSubFile;
} else {
const dirEls = document.getElementById("dirs-box").children;
@@ -504,11 +503,19 @@
fullPath = basePath.replace(/\/$/, '') + '/' + selectedItem.textContent;
}
}
if (fullPath) {
ws.send(JSON.stringify({ action: "add_to_toplay", songs: [fullPath], top: top }));
return true;
success = true;
}
return false;
Array.from(document.getElementById("playlist-ul").children).forEach(c => c.classList.remove("selected"));
Array.from(document.getElementById("dirs-box").children).forEach(c => c.classList.remove("selected"));
selectedPlaylistIndex = null;
selectedSubFile = null;
return success;
}
document.getElementById("add-to-queue-btn").addEventListener("click", () => addSelectedFileToQueue(false));
document.getElementById("add-to-queue2-btn").addEventListener("click", () => addSelectedFileToQueue(true));