0
1
mirror of https://github.com/radio95-rnt/RadioPlayer.git synced 2026-02-26 21:53:54 +01:00

top bottom

This commit is contained in:
2025-12-27 22:12:38 +01:00
parent 8d376cd0fa
commit 6c4bc2c10d

View File

@@ -118,7 +118,8 @@
</div> </div>
</div> </div>
<div style="margin-top:8px"> <div style="margin-top:8px">
<button id="add-to-queue-btn" class="btn primary" style="width:100%">Add Selected File to Queue</button> <button id="add-to-queue-btn" class="btn primary" style="width:50%">Add Selected File to the bottom of the Queue</button>
<button id="add-to-queue2-btn" class="btn primary" style="width:50%">Add Selected File to the top of the Queue</button>
</div> </div>
</div> </div>
</div> </div>
@@ -419,7 +420,7 @@
document.getElementById("clear-btn").addEventListener("click", () => {ws.send(JSON.stringify({action:"clear_toplay"}))}); document.getElementById("clear-btn").addEventListener("click", () => {ws.send(JSON.stringify({action:"clear_toplay"}))});
function addSelectedFileToQueue() { function addSelectedFileToQueue(top) {
let fullPath = null; let fullPath = null;
if(selectedPlaylistIndex != null) { if(selectedPlaylistIndex != null) {
@@ -451,13 +452,14 @@
} }
if (fullPath && ws && ws.readyState === WebSocket.OPEN) { if (fullPath && ws && ws.readyState === WebSocket.OPEN) {
ws.send(JSON.stringify({ action:"add_to_toplay", songs:[fullPath] })); ws.send(JSON.stringify({ action:"add_to_toplay", songs:[fullPath], on_top: top}));
return true; return true;
} }
return false; return false;
} }
document.getElementById("add-to-queue-btn").addEventListener("click", addSelectedFileToQueue); document.getElementById("add-to-queue-btn").addEventListener("click", addSelectedFileToQueue, false);
document.getElementById("add-to-queue2-btn").addEventListener("click", addSelectedFileToQueue, true);
function updateControls() { function updateControls() {
document.getElementById("clear-btn").disabled = document.getElementById("clear-btn").disabled =
@@ -468,7 +470,7 @@
if (e.target.tagName === "INPUT") return; if (e.target.tagName === "INPUT") return;
if (e.key === "Enter") { if (e.key === "Enter") {
const added = addSelectedFileToQueue(); const added = addSelectedFileToQueue(false);
if (added) e.preventDefault(); if (added) e.preventDefault();
} }
if (e.key === "s") ws.send(JSON.stringify({action:"skip"})); if (e.key === "s") ws.send(JSON.stringify({action:"skip"}));