Change add methods

This commit is contained in:
Sebastien 2018-09-18 10:02:16 +03:00
parent 2a6ff7e0bd
commit 09a733ca47
2 changed files with 31 additions and 21 deletions

View File

@ -27,6 +27,7 @@ $(document).ready(function() {
btn_add = $('#add_btn'); btn_add = $('#add_btn');
switchAutoFlow = $("#autoflow"); switchAutoFlow = $("#autoflow");
$('.tooltipped').tooltip();
setInterval("getCurentMusic()", 1000); setInterval("getCurentMusic()", 1000);
$('#modalAdd').modal(); $('#modalAdd').modal();
@ -398,12 +399,10 @@ function listeners() {
$('#input_link').on("input", function () { $('#input_link').on("input", function () {
if($('#input_link').val() == ""){ if($('#input_link').val() == ""){
disableBtn($('#btn_add_bottom')); disableBtn($('#btn_add'));
disableBtn($('#btn_add_top'));
} }
else{ else{
enableBtn($('#btn_add_bottom')); enableBtn($('#btn_add'));
enableBtn($('#btn_add_top'));
} }
}); });
@ -420,24 +419,13 @@ function listeners() {
sendCommand(command); sendCommand(command);
}); });
$('#btn_add_top').click(function () { $('#btn_add').click(function () {
console.log(!$('#bottom').is(':checked'));
var command = { var command = {
command: "ADD", command: "ADD",
url: $('#input_link').val(), url: $('#input_link').val(),
playlistLimit: $('#limit_range').val(), playlistLimit: $('#limit_range').val(),
onHead: true onHead: !$('#bottom').is(':checked')
};
$('#input_link').val('');
sendCommand(command);
});
$('#btn_add_bottom').click(function () {
var command = {
command: "ADD",
url: $('#input_link').val(),
playlistLimit: $('#limit_range').val(),
onHead: false
}; };
$('#input_link').val(''); $('#input_link').val('');
sendCommand(command); sendCommand(command);

View File

@ -88,7 +88,7 @@
<a class="waves-effect waves-light btn modal-trigger green darken-4" id="add_btn" href="#modalAdd"><i class="material-icons">add_circle_outline</i></a> <a class="waves-effect waves-light btn modal-trigger green darken-4" id="add_btn" href="#modalAdd"><i class="material-icons">add_circle_outline</i></a>
<!-- Modal Structure --> <!-- Modal Structure -->
<div id="modalAdd" class="modal disabled"> <div id="modalAdd" class="modal modal ">
<div class="modal-content" style="padding-bottom: 0px"> <div class="modal-content" style="padding-bottom: 0px">
<div class="row" style="margin-bottom: 0px"> <div class="row" style="margin-bottom: 0px">
<h3 class="col l12 m12 s12"> Add Music</h3> <h3 class="col l12 m12 s12"> Add Music</h3>
@ -105,18 +105,40 @@
Playlist Limit Playlist Limit
</div> </div>
</div> </div>
<div class="row" style="margin-bottom: 0px"> <div class="row" style="margin-bottom: 0px">
<p class="range-field"> <p class="range-field">
<input type="range" id="limit_range" min="1" max="300" step="1" value="30" /> <input type="range" id="limit_range" min="1" max="300" step="1" value="30" />
</p> </p>
</div> </div>
<div class="row" style="margin-bottom: 0px">
<div class="col l12 m12 s12 center">
Add on
</div>
</div>
<div class="row">
<div class="col l4 offset-l4 m4 offset-m4 s4 offset-s4 left-align ">
<p>
<label>
<input name="group1" type="radio" checked="checked" id="bottom"/>
<span>Bottom</span>
</label>
</p>
<p>
<label>
<input name="group1" type="radio" />
<span>Top</span>
</label>
</p>
</div>
</div>
</form> </form>
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat">Cancel</a> <a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat">Cancel</a>
<a href="#!" id="btn_add_top" class="modal-action modal-close waves-effect waves-green btn-flat disabled">Add On Top</a>
<a href="#!" id="btn_add_bottom" class="modal-action modal-close waves-effect waves-green btn-flat disabled">Add On Bottom</a> <a href="#!" id="btn_add" class="modal-action modal-close waves-effect waves-green btn-flat disabled">Add</a>
</div> </div>
</div> </div>
</div> </div>