From 4d9b27c994e41b262ccdd3c1ee1ba90f81fcbd4d Mon Sep 17 00:00:00 2001
From: eb041592 <35889760+eb041592@users.noreply.github.com>
Date: Sat, 7 Apr 2018 11:14:12 +0200
Subject: [PATCH] Fix display of output buttons
---
htdocs/js/mpd.js | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js
index ce2fd8e25..6e886ece6 100644
--- a/htdocs/js/mpd.js
+++ b/htdocs/js/mpd.js
@@ -493,14 +493,15 @@ function webSocketConnect() {
break;
case 'outputnames':
$('#btn-outputs-block button').remove();
- if (obj.data.length > 1) {
- $.each(obj.data, function(id, name){
- var btn = $('');
- btn.appendTo($('#btn-outputs-block'));
- });
- } else {
- $('#btn-outputs-block').addClass('hide');
- }
+ var ttl_output = 0;
+ $.each(obj.data, function(id, name){
+ var btn = $('');
+ btn.appendTo($('#btn-outputs-block'));
+ ttl_output++;
+ });
+ if (ttl_output == 1) { $('#btn-outputs-block').addClass('hide'); }
/* remove cache, since the buttons have been recreated */
last_outputs = '';
break;