Page title
This commit is contained in:
@ -310,4 +310,32 @@ export let sortItems = function (array, property, reverse = false){
|
||||
**/
|
||||
export let isNumeric = function (data) {
|
||||
return !isNaN(parseFloat(data)) && isFinite(data)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set window title
|
||||
* @param track
|
||||
**/
|
||||
export let setWindowTitle = function (track = false, play_state = false){
|
||||
|
||||
var title = 'No track playing'
|
||||
|
||||
if (track) {
|
||||
var icon = '\u25A0 '
|
||||
var artistString = ''
|
||||
|
||||
if (track.artists) {
|
||||
for( var i = 0; i < track.artists.length; i++) {
|
||||
if (artistString != '') artistString += ', '
|
||||
artistString += track.artists[i].name
|
||||
}
|
||||
}
|
||||
|
||||
if (play_state && play_state == 'playing') icon = '\u25B6 '
|
||||
|
||||
title = icon +' '+ track.name +' - '+ artistString
|
||||
}
|
||||
|
||||
document.title = title
|
||||
}
|
||||
@ -23,7 +23,6 @@ const UIMiddleware = (function(){
|
||||
3000
|
||||
)
|
||||
|
||||
// we don't want to stop things happening as usual
|
||||
next(action)
|
||||
break
|
||||
|
||||
@ -31,7 +30,17 @@ const UIMiddleware = (function(){
|
||||
|
||||
store.dispatch(uiActions.createNotification('Added '+action.tracks_uris.length+' tracks to playlist'))
|
||||
|
||||
// we don't want to stop things happening as usual
|
||||
next(action)
|
||||
break
|
||||
|
||||
|
||||
case 'MOPIDY_STATE':
|
||||
helpers.setWindowTitle(store.getState().ui.current_track, action.data)
|
||||
next(action)
|
||||
break
|
||||
|
||||
case 'MOPIDY_CURRENTTLTRACK':
|
||||
if( action.data && action.data.track ) helpers.setWindowTitle(action.data.track, store.getState().mopidy.play_state)
|
||||
next(action)
|
||||
break
|
||||
|
||||
|
||||
@ -76,6 +76,7 @@ main {
|
||||
padding: 20px;
|
||||
background: $faint_grey;
|
||||
white-space: pre-wrap;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -54,4 +54,10 @@
|
||||
section {
|
||||
padding: 40px;
|
||||
}
|
||||
|
||||
@include responsive( $bp_medium ){
|
||||
section {
|
||||
padding: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user