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

View File

@ -73,17 +73,17 @@
</div> </div>
<div class="row center"> <div class="row center">
<div class="col l2 offset-l3 m4 s4 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> <i class="material-icons medium">stop</i>
</a> </a>
</div> </div>
<div class="col l2 m4 s4 center"> <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> <i class="material-icons medium">play_arrow</i>
</a> </a>
</div> </div>
<div class="col l2 m4 s4 center"> <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> <i class="material-icons">skip_next</i>
</a> </a>
</div> </div>
@ -100,7 +100,7 @@
</div> </div>
<div class="row center"> <div class="row center">
<div class="col offset-l5 l2 m4 offset-m4 s4 offset-s4 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> <i class="material-icons">call_end</i>
</a> </a>
</div> </div>
@ -115,7 +115,7 @@
<div class="row center valign-wrapper" style="margin: 0px"> <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 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"> <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>
<div class="col l3 m2 s2 center" style="padding-right: 0px; padding-left: 0px"> <div class="col l3 m2 s2 center" style="padding-right: 0px; padding-left: 0px">
<!-- Modal Trigger --> <!-- Modal Trigger -->
@ -127,7 +127,7 @@
<div class="row switch blue-grey-text text-darken-3" style="margin-bottom: 0px"> <div class="row switch blue-grey-text text-darken-3" style="margin-bottom: 0px">
AutoFlow AutoFlow
</div> </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> <label>
<input type="checkbox" id="autoflow"/> <input type="checkbox" id="autoflow"/>
<span class="lever"></span> <span class="lever"></span>
@ -243,8 +243,6 @@
</div> </div>
<!-- Playlist template--> <!-- Playlist template-->
<li id="playlist_template" style="visibility: hidden"> <li id="playlist_template" style="visibility: hidden">
<div class="collapsible-header"><i class="material-icons">drag_handle</i>@title</div> <div class="collapsible-header"><i class="material-icons">drag_handle</i>@title</div>