mirror of
https://github.com/SuperBFG7/ympd
synced 2024-12-23 01:20:27 +00:00
Merge pull request #19 from andreevskya/DisplayCurrentTrackInPageTitle
[Issue 128] Current track in page title
This commit is contained in:
commit
68cbe37a84
@ -621,7 +621,7 @@ function webSocketConnect() {
|
|||||||
socket.send('MPD_API_GET_QUEUE,'+pagination);
|
socket.send('MPD_API_GET_QUEUE,'+pagination);
|
||||||
break;
|
break;
|
||||||
case 'song_change':
|
case 'song_change':
|
||||||
|
updatePageTitle(obj.data);
|
||||||
$('#album').text("");
|
$('#album').text("");
|
||||||
$('#artist').text("");
|
$('#artist').text("");
|
||||||
|
|
||||||
@ -646,7 +646,6 @@ function webSocketConnect() {
|
|||||||
message:{html: notification},
|
message:{html: notification},
|
||||||
type: "info",
|
type: "info",
|
||||||
}).show();
|
}).show();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'mpdhost':
|
case 'mpdhost':
|
||||||
$('#mpdhost').val(obj.data.host);
|
$('#mpdhost').val(obj.data.host);
|
||||||
@ -763,6 +762,20 @@ var updatePlayIcon = function(state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var updatePageTitle = function(songInfo) {
|
||||||
|
if(!songInfo || (!songInfo.artist && !songInfo.title)) {
|
||||||
|
document.title = 'ympd';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(songInfo.artist) {
|
||||||
|
if(songInfo.title) {
|
||||||
|
document.title = songInfo.artist + ' - ' + songInfo.title;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
document.title = songInfo.title;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function updateDB() {
|
function updateDB() {
|
||||||
socket.send('MPD_API_UPDATE_DB');
|
socket.send('MPD_API_UPDATE_DB');
|
||||||
$('.top-right').notify({
|
$('.top-right').notify({
|
||||||
|
Loading…
Reference in New Issue
Block a user