disable button when send command on music page

This commit is contained in:
Sebastien 2018-11-29 14:08:21 +02:00
parent e44bbdbab7
commit b01f8721da
2 changed files with 15 additions and 13 deletions

View File

@ -245,6 +245,7 @@ function getPlayList() {
modal_loading.close();
loadingFlag = false;
}
$(".ctl-btn").removeClass("disabled");
}).fail(function (data) {
@ -343,12 +344,13 @@ function updateControl(data) {
updateModal(data);
}
function sendCommand(command, stopRefresh) {
if(stopRefresh){
clearInterval(interval);
function sendCommand(command, modal) {
clearInterval(interval);
if(modal){
modal_loading.open();
}
$(".ctl-btn").addClass("disabled");
$.ajax({
type: "POST",
@ -358,8 +360,8 @@ function sendCommand(command, stopRefresh) {
data: JSON.stringify(command),
success: function (data) {
loadingFlag = true;
if(stopRefresh)
interval = setInterval("getCurentMusic()", 1000);
interval = setInterval("getCurentMusic()", 1000);
if(command.command === "ADD"){
M.toast({
html: " <i class=\"material-icons\" style='margin-right: 10px'>check_circle</i> Video added to playlist!",
@ -368,6 +370,7 @@ function sendCommand(command, stopRefresh) {
});
}
}
}).fail(function (data) {
@ -385,6 +388,7 @@ function sendCommand(command, stopRefresh) {
displayLength: 99999999
});
}
$(".ctl-btn").removeClass("disabled");
});
}

View File

@ -73,17 +73,17 @@
</div>
<div class="row center">
<div class="col l2 offset-l3 m4 s4 center">
<a class="btn-large red darken-4 z-depth-3 waves-effect waves-light" id="btn_stop">
<a class="btn-large red darken-4 z-depth-3 waves-effect waves-light ctl-btn" id="btn_stop">
<i class="material-icons medium">stop</i>
</a>
</div>
<div class="col l2 m4 s4 center">
<a class="btn-large green darken-4 z-depth-3 waves-effect waves-light" id="btn_play">
<a class="btn-large green darken-4 z-depth-3 waves-effect waves-light ctl-btn" id="btn_play">
<i class="material-icons medium">play_arrow</i>
</a>
</div>
<div class="col l2 m4 s4 center">
<a class="btn-large light-blue darken-4 z-depth-3 waves-effect waves-light" id="btn_next">
<a class="btn-large light-blue darken-4 z-depth-3 waves-effect waves-light ctl-btn" id="btn_next">
<i class="material-icons">skip_next</i>
</a>
</div>
@ -100,7 +100,7 @@
</div>
<div class="row center">
<div class="col offset-l5 l2 m4 offset-m4 s4 offset-s4 center">
<a class="btn-large red accent-4 z-depth-3 waves-effect waves-light" id="btn_disconnect">
<a class="btn-large red accent-4 z-depth-3 waves-effect waves-light ctl-btn" id="btn_disconnect">
<i class="material-icons">call_end</i>
</a>
</div>
@ -115,7 +115,7 @@
<div class="row center valign-wrapper" style="margin: 0px">
<div class="col l3 m5 s5 center blue-grey-text text-darken-3"><h5><b>Playlist</b></h5></div>
<div class="col l3 m2 s2 center" style="padding-right: 0px; padding-left: 0px">
<a class="waves-effect waves-light btn modal-trigger red darken-4" id="flush_btn"><i class="material-icons">delete_sweep</i></a>
<a class="waves-effect waves-light btn modal-trigger red darken-4 ctl-btn" id="flush_btn"><i class="material-icons">delete_sweep</i></a>
</div>
<div class="col l3 m2 s2 center" style="padding-right: 0px; padding-left: 0px">
<!-- Modal Trigger -->
@ -127,7 +127,7 @@
<div class="row switch blue-grey-text text-darken-3" style="margin-bottom: 0px">
AutoFlow
</div>
<div class="row switch tooltipped" data-position="bottom" data-delay="50" data-tooltip="Experimental!">
<div class="row switch tooltipped ctl-btn" data-position="bottom" data-delay="50" data-tooltip="Experimental!">
<label>
<input type="checkbox" id="autoflow"/>
<span class="lever"></span>
@ -243,8 +243,6 @@
</div>
<!-- Playlist template-->
<li id="playlist_template" style="visibility: hidden">
<div class="collapsible-header"><i class="material-icons">drag_handle</i>@title</div>