1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-12-27 03:10:26 +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" id="cardPlayback">
<div class="card-header">Playback</div> <div class="card-header">Playback</div>
<div class="card-body"> <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> <h1 id="currentTrack" data-href="{'cmd': 'songClick', 'options': []}"></h1>
<h3 id="currentArtist" data-href="{'cmd': 'artistClick', 'options': []}"></h3> <h3 id="currentArtist" data-href="{'cmd': 'artistClick', 'options': []}"></h3>
<h4 id="currentAlbum"></h4> <h4 id="currentAlbum"></h4>

View File

@ -905,6 +905,14 @@ function parseState(obj) {
toggleBtn('btnoutput' + obj.data.outputs[i].id, obj.data.outputs[i].state); 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; last_state = obj;
} }
@ -1841,7 +1849,7 @@ function songChange(obj) {
var htmlNotification = ''; var htmlNotification = '';
var pageTitle = 'myMPD: '; 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 != '-') { if (typeof obj.data.artist != 'undefined' && obj.data.artist.length > 0 && obj.data.artist != '-') {
textNotification += obj.data.artist; textNotification += obj.data.artist;