added offline and datagetting modal warnings. nice!
This commit is contained in:
parent
dd5433b91c
commit
561f0cf77e
31
index.html
31
index.html
@ -35,7 +35,32 @@
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="offlinemodal" class="modal hide fade">
|
||||
<div class="modal-header">
|
||||
<h3>Offline</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>
|
||||
<img src="img/loader.gif" id="offlinemodalloader" class="loader" />
|
||||
Cannot connect to the server... <br/>Please wait.
|
||||
<br/><br/>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="loadingmodal" class="modal hide fade">
|
||||
<div class="modal-header">
|
||||
<h3>Loading data...</h3>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<p>
|
||||
<img src="img/loader.gif" id="loadingmodalloader" class="loader" />
|
||||
Getting data from the server... <br/>Please wait.
|
||||
<br/><br/>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="navbar-inner">
|
||||
<div class="container-fluid">
|
||||
@ -143,7 +168,7 @@
|
||||
|
||||
<div class="span11 content" id="albumspane">
|
||||
<div class="row-fluid">
|
||||
<div class="span4">
|
||||
<div>
|
||||
<h4>Album</h4>
|
||||
<h3 id="h_albumname"></h3>
|
||||
<h5 id="h_albumartist"></h5>
|
||||
@ -168,7 +193,7 @@
|
||||
|
||||
<div class="span11 content" id="artistspane">
|
||||
<div class="row-fluid">
|
||||
<div class="span4">
|
||||
<div>
|
||||
<h4>Artist</h4>
|
||||
<h3 id="h_artistname"></h3>
|
||||
<p>
|
||||
|
||||
@ -43,13 +43,10 @@ SEARCH_ALBUM_TABLE = '#albumresulttable';
|
||||
SEARCH_ARTIST_TABLE = '#artistresulttable';
|
||||
SEARCH_TRACK_TABLE = '#trackresulttable';
|
||||
|
||||
WEB_SOCKET_SWF_LOCATION = "/static/WebSocketMain.swf";
|
||||
WEB_SOCKET_DEBUG = true;
|
||||
|
||||
//process updated playlist to gui
|
||||
//A hack to find the name of the first artist of a playlist. this is not yet returned by mopidy
|
||||
//does not work wel with multiple artists of course
|
||||
function getArtist(pl) {
|
||||
for (var i = 0; i < pl.length; i++) {
|
||||
var child = '<tr class="resultrow"><td><a href="#" class="name" id="' + pl[i]["uri"] + '">' + pl[i]["name"] + "</a></td><td>";
|
||||
for (var j = 0; j < pl[i]["artists"].length; j++) {
|
||||
if (pl[i]["artists"][j]["name"] != '') {
|
||||
return pl[i]["artists"][j]["name"];
|
||||
@ -58,7 +55,7 @@ function getArtist(pl) {
|
||||
};
|
||||
}
|
||||
|
||||
//process updated playlist to gui
|
||||
//A hack to find the first album of a playlist. this is not yet returned by mopidy
|
||||
function getAlbum(pl) {
|
||||
for (var i = 0; i < pl.length; i++) {
|
||||
if(pl[i]["album"]["name"] != '') {
|
||||
|
||||
@ -314,6 +314,8 @@ function updateStatusOfAll() {
|
||||
|
||||
function initSocketevents() {
|
||||
mopidy.on("state:online", function () {
|
||||
$("#offlinemodal").modal('hide');
|
||||
$("#loadingmodal").modal('show');
|
||||
getCurrentPlaylist();
|
||||
updateStatusOfAll();
|
||||
getPlaylists();
|
||||
@ -322,6 +324,7 @@ function initSocketevents() {
|
||||
|
||||
mopidy.on("state:offline", function () {
|
||||
resetSong();
|
||||
$("#offlinemodal").modal('show');
|
||||
});
|
||||
|
||||
mopidy.on("event:trackPlaybackStarted", function (data) {
|
||||
@ -452,6 +455,7 @@ $(document).ready(function() {
|
||||
case 'playlists':
|
||||
break;
|
||||
case 'search':
|
||||
$("div.searchpane input").focus();
|
||||
if (customTracklists['allresultscache'] == '') { initSearch( $('#searchinput').val() ); }
|
||||
break;
|
||||
case 'artists':
|
||||
|
||||
2
js/ws.js
2
js/ws.js
@ -83,6 +83,7 @@ function handleGetplaylists(resultArr) {
|
||||
$('#playlistslist').empty();
|
||||
$('#playlistslist').html(tmp);
|
||||
$('#playlistsloader').hide();
|
||||
$("#loadingmodal").modal('hide');
|
||||
}
|
||||
|
||||
//process results of a returned playlist
|
||||
@ -166,6 +167,7 @@ function handleAlbumResults(resultArr) {
|
||||
customTracklists[resultArr["uri"]] = resultArr;
|
||||
playlisttotable(resultArr, ALBUM_TABLE, resultArr["uri"]);
|
||||
$('#h_albumname').html(getAlbum(resultArr));
|
||||
//$('#h_albumartist').html('<a href="#" onclick="return showartist(this.id, uri)" id="' + resultArr["uri"] + '">' + getArtist(resultArr) + '</a>');
|
||||
$('#h_albumartist').html(getArtist(resultArr));
|
||||
$('#albumsloader').hide();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user