Skip to content

Commit

Permalink
Hide output button(s) if there is only one configured output
Browse files Browse the repository at this point in the history
  • Loading branch information
embhd committed Feb 3, 2018
1 parent 1b0484a commit 2e9d477
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions htdocs/js/mpd.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,14 @@ function webSocketConnect() {
break;
case "outputnames":
$('#btn-outputs-block button').remove();
$.each(obj.data, function(id, name){
var btn = $('<button id="btnoutput'+id+'" class="btn btn-default" onclick="toggleoutput(this, '+id+')"><span class="glyphicon glyphicon-volume-up"></span> '+name+'</button>');
btn.appendTo($('#btn-outputs-block'));
});
if (obj.data.length > 1) {
$.each(obj.data, function(id, name){
var btn = $('<button id="btnoutput'+id+'" class="btn btn-default" onclick="toggleoutput(this, '+id+')"><span class="glyphicon glyphicon-volume-up"></span> '+name+'</button>');
btn.appendTo($('#btn-outputs-block'));
});
} else {
$('#btn-outputs-block').removeClass('btn-group-vertical');
}
/* remove cache, since the buttons have been recreated */
last_outputs = '';
break;
Expand Down

0 comments on commit 2e9d477

Please sign in to comment.