From 2e9d477ee660e3e10275db6426dd46599be9cb68 Mon Sep 17 00:00:00 2001 From: eb041592 <35889760+eb041592@users.noreply.github.com> Date: Sun, 4 Feb 2018 00:30:45 +0100 Subject: [PATCH] Hide output button(s) if there is only one configured output --- htdocs/js/mpd.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) 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;