Show offline message until page refresh is completed.

This commit is contained in:
jcass 2017-02-19 19:42:40 +02:00
parent 3e678a3284
commit 9384e69dd4

View File

@ -366,13 +366,6 @@ function updateStatusOfAll () {
} }
function locationHashChanged () { function locationHashChanged () {
if (!mopidy) {
// Mopidy connection not yet established. User probably clicked 'Refresh' in their
// browser and the page is still loading. We can safely ignore this call as it will
// be invoked again later when the page has finished loading and $(document).ready()
// is triggered.
return false
}
var hash = document.location.hash.split('?') var hash = document.location.hash.split('?')
// remove # // remove #
var divid = hash[0].substr(1) var divid = hash[0].substr(1)
@ -404,12 +397,20 @@ function locationHashChanged () {
break break
case 'artists': case 'artists':
if (uri !== '') { if (uri !== '') {
library.showArtist(uri, mopidy) if (mopidy) {
library.showArtist(uri, mopidy)
} else {
showOffline(true) // Page refreshed - wait for mopidy object to be initialized.
}
} }
break break
case 'albums': case 'albums':
if (uri !== '') { if (uri !== '') {
library.showAlbum(uri, mopidy) if (mopidy) {
library.showAlbum(uri, mopidy)
} else {
showOffline(true) // Page refreshed - wait for mopidy object to be initialized.
}
} }
break break
default: // Default footer default: // Default footer