mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Limiting number of lists in inputfield to only those with more than 5 songs, and accessed within the last 7 days
This commit is contained in:
@@ -98,10 +98,18 @@ var Frontpage = {
|
||||
|
||||
//$("#channels").append(card);
|
||||
}
|
||||
output+="<option value='"+chan+"'> ";
|
||||
num++;
|
||||
//if(num>19)break;
|
||||
}
|
||||
lists.sort(Frontpage.sortFunction_active);
|
||||
//num = 0;
|
||||
for(var x in lists){
|
||||
if(lists[x].count > 5 && Math.floor((new Date).getTime()/1000) - lists[x].accessed < 604800){
|
||||
var chan = lists[x].channel;
|
||||
output+="<option value='"+chan+"'> ";
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById("preloader").style.display = "none";
|
||||
document.getElementById("searches").innerHTML = output;
|
||||
document.getElementById("searches_mobile").innerHTML = output;
|
||||
@@ -124,6 +132,20 @@ var Frontpage = {
|
||||
return 0;
|
||||
},
|
||||
|
||||
sortFunction_active: function(a, b){
|
||||
var o1 = a.accessed;
|
||||
var o2 = b.accessed;
|
||||
|
||||
var p1 = a.count;
|
||||
var p2 = b.count;
|
||||
|
||||
if (o1 < o2) return 1;
|
||||
if (o1 > o2) return -1;
|
||||
if (p1 < p2) return 1;
|
||||
if (p1 > p2) return -1;
|
||||
return 0;
|
||||
},
|
||||
|
||||
getCookie: function(cname) {
|
||||
var name = cname + "=";
|
||||
var ca = document.cookie.split(';');
|
||||
|
||||
Reference in New Issue
Block a user