1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-12-26 11:00:27 +00:00

Feat: clear playback card if songpos = -1

This commit is contained in:
jcorporation 2018-08-06 19:33:52 +01:00
parent dfe7e31a1e
commit 674ff60b09
2 changed files with 10 additions and 2 deletions

View File

@ -75,7 +75,7 @@
<div class="card" id="cardPlayback">
<div class="card-header">Playback</div>
<div class="card-body">
<div class="album-cover" id="album-cover"></div>
<div class="album-cover" id="currentCover"></div>
<h1 id="currentTrack" data-href="{'cmd': 'songClick', 'options': []}"></h1>
<h3 id="currentArtist" data-href="{'cmd': 'artistClick', 'options': []}"></h3>
<h4 id="currentAlbum"></h4>

View File

@ -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;