fix no favorites screen

This commit is contained in:
Jonas Heinrich 2017-08-11 18:06:01 +02:00
parent 6a447f0148
commit fba5aa6c8b
2 changed files with 38 additions and 24 deletions

View File

@ -85,6 +85,29 @@ $(function(){
}; };
}); });
/* Playbutton click */
$('#playbutton').click(function() {
var music = document.getElementById('player');
if (music.paused && $("#player").attr("src") != "") {
music.play();
} else {
music.pause();
}
});
/* Click on menus */
$('a.nav-icon-files').click(function() {
switch_menu(0);
});
$('a.nav-icon-recent').click(function() {
switch_menu(1);
});
$('a.nav-icon-favorites').click(function() {
switch_menu(2);
});
/* ============== /* ==============
// ACTIONS // // ACTIONS //
/===============*/ /===============*/
@ -165,7 +188,7 @@ $(function(){
$.each(data, function(i, station) { $.each(data, function(i, station) {
var isstarred = "" var isstarred = ""
for (var fav_station in fav_stations) { for (var fav_station in fav_stations) {
if (fav_stations[fav_station]["stationid"] == station['id']) { if (fav_stations[fav_station]["stationid"] == station['id']) {
isstarred = "starred"; isstarred = "starred";
@ -201,7 +224,12 @@ $(function(){
for (var station in data) { for (var station in data) {
stations.push(data[station]["stationid"]); stations.push(data[station]["stationid"]);
}; };
query_stations(stations); if (stations.length == 0) {
$('#filestable').hide();
$('#emptycontent').removeClass('hidden');
} else {
query_stations(stations);
};
}); });
}; };
@ -268,19 +296,7 @@ $(function(){
break; break;
} }
}, 500); }, 500);
} };
$('a.nav-icon-files').click(function() {
switch_menu(0);
});
$('a.nav-icon-recent').click(function() {
switch_menu(1);
});
$('a.nav-icon-favorites').click(function() {
switch_menu(2);
});
function mySearch(query){ function mySearch(query){
if (query != "") { if (query != "") {
@ -299,15 +315,6 @@ $(function(){
} }
}); });
$('#playbutton').click(function() {
var music = document.getElementById('player');
if (music.paused && $("#player").attr("src") != "") {
music.play();
} else {
music.pause();
}
});
$('#volumeslider').slider({ $('#volumeslider').slider({
orientation: "horizontal", orientation: "horizontal",
value: player.volume, value: player.volume,

View File

@ -33,6 +33,13 @@
<div id="app-content"> <div id="app-content">
<div id="app-content-files" class="viewcontainer"> <div id="app-content-files" class="viewcontainer">
<!-- <div class="mask transparent icon-loading"></div> --> <!-- <div class="mask transparent icon-loading"></div> -->
<div id="emptycontent" class="hidden">
<div class="icon-starred"></div>
<h2><?php p($l->t('No favorites yet')); ?></h2>
<p><?php p($l->t('Stations you mark as favorite will show up here')); ?></p>
</div>
<table id="filestable" data-preview-x="32" data-preview-y="32"> <table id="filestable" data-preview-x="32" data-preview-y="32">
<thead> <thead>
<tr> <tr>