From 674ff60b0925b0311596f8c1ffc023481498d2e3 Mon Sep 17 00:00:00 2001 From: jcorporation Date: Mon, 6 Aug 2018 19:33:52 +0100 Subject: [PATCH] Feat: clear playback card if songpos = -1 --- htdocs/index.html | 2 +- htdocs/js/mpd.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/htdocs/index.html b/htdocs/index.html index e0b5088..ea9f31d 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -75,7 +75,7 @@
Playback
-
+

diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index c315dd9..c8e1c86 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -904,6 +904,14 @@ function parseState(obj) { for (var i = 0; i < outputsLen; i++) { toggleBtn('btnoutput' + obj.data.outputs[i].id, obj.data.outputs[i].state); } + + //clear playback card if not playing + if (obj.data.songpos == '-1') { + domCache.currentTrack.innerText = 'Not playing'; + document.getElementById('currentAlbum').innerText = ''; + document.getElementById('currentArtist').innerText = ''; + document.getElementById('currentCover').style.backgroundImage = ''; + } last_state = obj; } @@ -1841,7 +1849,7 @@ function songChange(obj) { var htmlNotification = ''; var pageTitle = 'myMPD: '; - document.getElementById('album-cover').style.backgroundImage = 'url("' + obj.data.cover + '")'; + document.getElementById('currentCover').style.backgroundImage = 'url("' + obj.data.cover + '")'; if (typeof obj.data.artist != 'undefined' && obj.data.artist.length > 0 && obj.data.artist != '-') { textNotification += obj.data.artist;