mirror of
https://github.com/SuperBFG7/ympd
synced 2024-12-26 19:10:25 +00:00
Update play icons in main toolbar on state changes
This commit is contained in:
parent
5567e29feb
commit
2a2263c519
@ -35,7 +35,7 @@ button {
|
||||
}
|
||||
|
||||
#counter {
|
||||
font-size: 24px;
|
||||
font-size: 22px;
|
||||
margin-top: -2px;
|
||||
margin-left: 10px;
|
||||
min-width: 50px;
|
||||
@ -46,23 +46,10 @@ button {
|
||||
}
|
||||
|
||||
.card {
|
||||
min-height:300px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
min-height:350px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 576px) {
|
||||
/* .tbllength, .tblnum, .tblalbum {
|
||||
visibility:collapse;
|
||||
}
|
||||
.tbltitle, .tblartist {
|
||||
min-width:calc(50% - 15px);
|
||||
}
|
||||
*/
|
||||
.header-logo {
|
||||
display:none !important;
|
||||
}
|
||||
|
@ -38,13 +38,13 @@
|
||||
</div>
|
||||
<div class="btn-toolbar col-auto" role="toolbar">
|
||||
<div class="btn-group mr-2" role="group">
|
||||
<button type="button" class="btn btn-secondary" onclick="socket.send('MPD_API_SET_PREV');">
|
||||
<button id="btnPrev" type="button" class="btn btn-secondary" onclick="socket.send('MPD_API_SET_PREV');">
|
||||
<span class="material-icons">skip_previous</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary" onclick="clickPlay();">
|
||||
<span id="play-icon" class="material-icons">pause</span>
|
||||
<button id="btnPlay" type="button" class="btn btn-secondary" onclick="clickPlay();">
|
||||
<span class="material-icons">pause</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary" onclick="socket.send('MPD_API_SET_NEXT');">
|
||||
<button id="btnNext" type="button" class="btn btn-secondary" onclick="socket.send('MPD_API_SET_NEXT');">
|
||||
<span class="material-icons">skip_next</span>
|
||||
</button>
|
||||
</div>
|
||||
|
@ -487,13 +487,11 @@ function webSocketConnect() {
|
||||
}
|
||||
setPagination(obj.totalEntities);
|
||||
|
||||
if (current_app == 'search')
|
||||
if (nrItems == 0) {
|
||||
$('#'+current_app+'List > tbody').append(
|
||||
"<tr><td><span class=\"material-icons\">error_outline</span></td>" +
|
||||
"<td colspan=\"3\">No results, please refine your search!</td>" +
|
||||
"<td></td><td></td></tr>"
|
||||
);
|
||||
if (nrItems == 0) {
|
||||
$('#'+current_app+'List > tbody').append(
|
||||
'<tr><td><span class="material-icons">error_outline</span></td>' +
|
||||
'<td colspan="3">No results</td>' +
|
||||
'<td></td><td></td></tr>');
|
||||
}
|
||||
|
||||
function appendClickableIcon(appendTo, onClickAction, glyphicon) {
|
||||
@ -555,7 +553,7 @@ function webSocketConnect() {
|
||||
|
||||
break;
|
||||
case 'state':
|
||||
updatePlayIcon(obj.data.state);
|
||||
updatePlayIcon(obj);
|
||||
updateVolumeIcon(obj.data.volume);
|
||||
|
||||
if(JSON.stringify(obj) === JSON.stringify(last_state))
|
||||
@ -798,19 +796,36 @@ function updateVolumeIcon(volume) {
|
||||
}
|
||||
}
|
||||
|
||||
function updatePlayIcon(state) {
|
||||
$("#play-icon").text('play_arrow');
|
||||
function updatePlayIcon(obj) {
|
||||
|
||||
if(state == 1) { // stop
|
||||
$("#play-icon").text('play_arrow');
|
||||
if(obj.data.state == 1) { // stop
|
||||
$('#btnPlay > span').text('play_arrow');
|
||||
playstate = 'stop';
|
||||
} else if(state == 2) { // play
|
||||
$("#play-icon").text('pause');
|
||||
} else if(obj.data.state == 2) { // play
|
||||
$('#btnPlay > span').text('pause');
|
||||
playstate = 'play';
|
||||
} else { // pause
|
||||
$("#play-icon").text('play_arrow');
|
||||
$('#btnPlay > span').text('play_arrow');
|
||||
playstate = 'pause';
|
||||
}
|
||||
|
||||
if (obj.data.nextsongpos == -1) {
|
||||
$('#btnNext').addClass('disabled').attr('disabled','disabled');
|
||||
} else {
|
||||
$('#btnNext').removeClass('disabled').removeAttr('disabled');
|
||||
}
|
||||
|
||||
if (obj.data.songpos <= 0) {
|
||||
$('#btnPrev').addClass('disabled').attr('disabled','disabled');
|
||||
} else {
|
||||
$('#btnPrev').removeClass('disabled').removeAttr('disabled');
|
||||
}
|
||||
|
||||
if (obj.data.queue_length == 0) {
|
||||
$('#btnPlay').addClass('disabled').attr('disabled','disabled');
|
||||
} else {
|
||||
$('#btnPlay').removeClass('disabled').removeAttr('disabled');
|
||||
}
|
||||
}
|
||||
|
||||
function updateDB() {
|
||||
@ -1191,6 +1206,7 @@ $(document).keydown(function(e){
|
||||
});
|
||||
|
||||
function setFilterLetter(filter) {
|
||||
pagination = 0;
|
||||
app.setLocation('#/browse/filesystem/'+pagination+'/'+filter+'/'+browsepath);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user