toggle official and remove are index addressed

This commit is contained in:
2026-05-23 17:17:44 +02:00
parent 9044a31cc0
commit f205dd41f9
3 changed files with 34 additions and 9 deletions
+8 -2
View File
@@ -227,9 +227,10 @@ function renderPlaylist() {
function renderQueue() {
const ul = document.getElementById("queue-ul");
ul.innerHTML = "";
var i = 0;
queue.forEach(path => {
const li = document.createElement("li");
li.dataset.line = path;
li.dataset.idx = i++;
var c = path.replace(basePath, "");
if(c.startsWith("!")) c = "(unofficial) " + c.slice(2)
@@ -241,9 +242,14 @@ function renderQueue() {
}
li.addEventListener("click", () => {
wsSend({ action: "remove_toplay", songs: [li.dataset.line] });
wsSend({ action: "remove_toplay", indexes: [li.dataset.idx] });
renderAll();
});
li.addEventListener("contextmenu", e => {
e.preventDefault();
wsSend({ action: "toggle_official_toplay", indexes: [li.dataset.idx] });
renderAll();
})
ul.appendChild(li);
});
updateControls();