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