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