loading….

This commit is contained in:
Wouter van Wijk 2013-02-11 00:10:54 +01:00
parent fd1f326108
commit df64ded11c
4 changed files with 27 additions and 23 deletions

View File

@ -175,19 +175,19 @@
<div data-role="footer" data-id="foo1" data-position="fixed">
<div data-role="navbar">
<ul>
<li>
<li id="navplaylists">
<a href="#playlists" onclick="switchContent('playlists' ); return false;"><img src="images/icons/list_nested_24x21.png" />
<div class="nav-collapse menutext nobreak hidden-phone">
Playlists
</div></a>
</li>
<li>
<li id="navcurrent">
<a href="#current" onclick="switchContent('current' ); return false;"><img src="images/icons/list_24x21.png" />
<div class="nav-collapse nobreak menutext hidden-phone">
Queue
</div></a>
</li>
<li>
<li id="navsearch">
<a href="#search" onclick="switchContent('search' ); return false;" ><img src="images/icons/magnifying_glass_24x24.png" />
<div class="nav-collapse nobreak menutext hidden-phone">
Search

View File

@ -131,10 +131,9 @@ function showAlbumPopup() {
function showLoading(on) {
if (on) {
$.mobile.loading('show', {
text : 'Loading',
text : 'Loading data from the server. Please wait...',
textVisible : true,
theme : 'z',
html : "Loading data from the server. Please wait..."
theme : 'a'
});
} else {
$.mobile.loading('hide');
@ -144,10 +143,9 @@ function showLoading(on) {
function showOffline(on) {
if (on) {
$.mobile.loading('show', {
text : 'Offline',
text : 'Offline - Trying to reach the server. Please wait...',
textVisible : true,
theme : 'z',
html : "Trying to reach the server. Please wait..."
theme : 'a'
});
} else {
$.mobile.loading('hide');
@ -257,11 +255,14 @@ $(document).bind("pageinit", function() {
var uri = hash[1];
switch(divid) {
case 'current':
$('#navcurrent').addClass("ui-btn-active ui-state-persist");
break;
case 'playlists':
$('#navplaylists').addClass("ui-btn-active ui-state-persist");
break;
case 'search':
$("div.searchpane input").focus();
$('#navsearch').addClass("ui-btn-active ui-state-persist");
$("#searchinput").focus();
if (customTracklists['allresultscache'] == '') {
initSearch($('#searchinput').val());
}

View File

@ -17,10 +17,7 @@ function initSearch() {
var value = $('#searchinput').val();
if ((value.length < 100) && (value.length > 0)) {
$('#artistresultloader').show();
$('#allresultloader').show();
$('#albumresultloader').show();
showLoading(true);
$('#artistresulttable').empty();
$('#albumresulttable').empty();
$('#trackresulttable').empty();
@ -79,8 +76,8 @@ function processSearchResults(resultArr) {
$('#expandsearch').show();
playlisttotable(results.tracks, SEARCH_TRACK_TABLE, 'trackresultscache');
$('#allresultloader').hide();
showLoading(false);
// $('#allresultloader').hide();
}
function toggleSearch() {
@ -107,7 +104,8 @@ function showTracklist(uri) {
********************************************************/
$(PLAYLIST_TABLE).empty();
$('#playlisttablediv').show();
$('#playlistloader').show();
// $('#playlistloader').show();
showLoading(true);
var pl = getPlaylistFromUri(uri);
// console.log (pl);
@ -127,7 +125,8 @@ function showArtist(nwuri) {
//fill from cache
var pl = getTracksFromUri(nwuri);
$('#h_artistname').html('');
$('#artistsloader').show();
showLoading(true);
// $('#artistsloader').show();
mopidy.library.lookup(nwuri).then(processArtistResults, console.error);
switchContent('artists', nwuri);
return false;
@ -146,7 +145,8 @@ function showAlbum(uri) {
} else {
$('#h_albumname').html('');
$('#h_albumartist').html('');
$('#albumsloader').show();
showLoading(true);
// $('#albumsloader').show();
mopidy.library.lookup(uri).then(processAlbumResults, console.error);
}
//show

View File

@ -74,7 +74,7 @@ function processGetPlaylists(resultArr) {
$('#playlistslist').empty();
$('#playlistslist').html(tmp);
$('#playlistslist').listview('refresh');
$('#playlistsloader').hide();
// $('#playlistsloader').hide();
showLoading(false);
}
@ -86,7 +86,8 @@ function processGetTracklist(resultArr) {
var newplaylisturi = resultArr.uri;
playlists[newplaylisturi] = resultArr;
playlisttotable(playlists[newplaylisturi].tracks, PLAYLIST_TABLE, newplaylisturi);
$('#playlistloader').hide();
// $('#playlistloader').hide();
showLoading(false);
scrollToTracklist();
}
@ -129,7 +130,8 @@ function processArtistResults(resultArr) {
}
}
$('#h_artistname').html(getArtist(resultArr));
$('#artistsloader').hide();
// $('#artistsloader').hide();
showLoading(false);
}
@ -141,5 +143,6 @@ function processAlbumResults(resultArr) {
albumtrackstotable(resultArr, ALBUM_TABLE, resultArr.uri);
$('#h_albumname').html(getAlbum(resultArr));
$('#h_albumartist').html(getArtist(resultArr));
$('#albumsloader').hide();
showLoading(false);
// $('#albumsloader').hide();
}