1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-12-27 03:10:26 +00:00

Fix buttons shuffle and clear in queue card

This commit is contained in:
jcorporation 2018-07-03 22:57:31 +01:00
parent 54b10bdaf3
commit 4d42ac927b
2 changed files with 10 additions and 2 deletions

View File

@ -122,10 +122,10 @@
</div> </div>
</div> </div>
<div id="queue-actions" class="btn-group mr-2"> <div id="queue-actions" class="btn-group mr-2">
<button type="button" class="btn btn-secondary" onclick="socket.send('MPD_API_SEND_SHUFFLE');" title="Shuffle queue"> <button type="button" class="btn btn-secondary" onclick="shuffleQueue();" title="Shuffle queue">
<span class="material-icons">shuffle</span> <span class="material-icons">shuffle</span>
</button> </button>
<button type="button" class="btn btn-secondary" onclick="socket.send('MPD_API_RM_ALL');" title="Clear queue"> <button type="button" class="btn btn-secondary" onclick="clearQueue();" title="Clear queue">
<span class="material-icons">clear_all</span> <span class="material-icons">clear_all</span>
</button> </button>
<button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#savequeue" title="Save queue"> <button type="button" class="btn btn-secondary" data-toggle="modal" data-target="#savequeue" title="Save queue">

View File

@ -954,6 +954,14 @@ function updatePlayIcon(obj) {
} }
} }
function shuffleQueue() {
sendAPI({"cmd":"MPD_API_SEND_SHUFFLE"});
}
function clearQueue() {
sendAPI({"cmd":"MPD_API_RM_ALL"});
}
function sendAPI(request, callback) { function sendAPI(request, callback) {
$.ajax({url: "/api", contentType:"application/json", method: "POST", data: JSON.stringify(request), success: callback }); $.ajax({url: "/api", contentType:"application/json", method: "POST", data: JSON.stringify(request), success: callback });
} }