From: eb041592 <35889760+eb041592@users.noreply.github.com> Date: Sat, 3 Feb 2018 23:30:45 +0000 (+0100) Subject: Hide output button(s) if there is only one configured output X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=2e9d477ee660e3e10275db6426dd46599be9cb68;p=ympd.git Hide output button(s) if there is only one configured output --- diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index 5c8a8d1..ba7dfff 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -496,10 +496,14 @@ function webSocketConnect() { break; case "outputnames": $('#btn-outputs-block button').remove(); - $.each(obj.data, function(id, name){ - var btn = $(''); - btn.appendTo($('#btn-outputs-block')); - }); + if (obj.data.length > 1) { + $.each(obj.data, function(id, name){ + var btn = $(''); + btn.appendTo($('#btn-outputs-block')); + }); + } else { + $('#btn-outputs-block').removeClass('btn-group-vertical'); + } /* remove cache, since the buttons have been recreated */ last_outputs = ''; break;