mirror of
https://github.com/radio95-rnt/RadioPlayer.git
synced 2026-07-29 15:29:14 +02:00
fix weird ass bug
This commit is contained in:
+8
-12
@@ -328,32 +328,31 @@ function applySubdir(payload) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Playlist Selection ──────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
function selectPlaylistItem(i, el) {
|
function selectPlaylistItem(i, el) {
|
||||||
|
const path = el.dataset.path;
|
||||||
if (el.classList.contains("selected")) {
|
if (el.classList.contains("selected")) {
|
||||||
el.classList.remove("selected");
|
el.classList.remove("selected");
|
||||||
selectedPlaylistIndex = null;
|
selectedPlaylistPath = null;
|
||||||
updateControls();
|
updateControls();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
clearListSelections("playlist-ul", "dirs-box", "subdir-box");
|
clearListSelections("playlist-ul", "dirs-box", "subdir-box");
|
||||||
el.classList.add("selected");
|
el.classList.add("selected");
|
||||||
|
selectedPlaylistPath = path;
|
||||||
selectedPlaylistIndex = i;
|
selectedPlaylistIndex = i;
|
||||||
updateControls();
|
updateControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Queue Actions ───────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
function addSelectedFileToQueue(top) {
|
function addSelectedFileToQueue(top) {
|
||||||
let fullPath = null;
|
let fullPath = null;
|
||||||
|
|
||||||
if (selectedPlaylistIndex != null) {
|
if (selectedPlaylistPath != null) {
|
||||||
const selected = playlist[selectedPlaylistIndex];
|
const selected = playlist.find(t => t.path === selectedPlaylistPath);
|
||||||
|
if (!selected) return false;
|
||||||
const path = (selected.official ? "" : "!") + selected.path;
|
const path = (selected.official ? "" : "!") + selected.path;
|
||||||
wsSend({ action: "add_to_toplay", songs: [path], top });
|
wsSend({ action: "add_to_toplay", songs: [path], top });
|
||||||
// Only clear playlist selection — keep dir/subdir selections intact
|
|
||||||
clearListSelections("playlist-ul");
|
clearListSelections("playlist-ul");
|
||||||
|
selectedPlaylistPath = null;
|
||||||
selectedPlaylistIndex = null;
|
selectedPlaylistIndex = null;
|
||||||
updateControls();
|
updateControls();
|
||||||
return true;
|
return true;
|
||||||
@@ -362,8 +361,7 @@ function addSelectedFileToQueue(top) {
|
|||||||
if (selectedSubFile && selectedDir) {
|
if (selectedSubFile && selectedDir) {
|
||||||
fullPath = subBasePath.replace(/\/$/, "") + "/" + selectedSubFile;
|
fullPath = subBasePath.replace(/\/$/, "") + "/" + selectedSubFile;
|
||||||
} else {
|
} else {
|
||||||
const selectedFileEl = Array.from(document.getElementById("dirs-box").children)
|
const selectedFileEl = Array.from(document.getElementById("dirs-box").children).find(el => el.classList.contains("selected") && el.dataset.type === "file");
|
||||||
.find(el => el.classList.contains("selected") && el.dataset.type === "file");
|
|
||||||
if (selectedFileEl) {
|
if (selectedFileEl) {
|
||||||
fullPath = basePath.replace(/\/$/, "") + "/" + selectedFileEl.textContent;
|
fullPath = basePath.replace(/\/$/, "") + "/" + selectedFileEl.textContent;
|
||||||
}
|
}
|
||||||
@@ -378,8 +376,6 @@ function addSelectedFileToQueue(top) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ─── Controls ────────────────────────────────────────────────────────────────
|
|
||||||
|
|
||||||
function updateControls() {
|
function updateControls() {
|
||||||
document.getElementById("clear-btn").disabled = queue.length === 0;
|
document.getElementById("clear-btn").disabled = queue.length === 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user