mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-12-08 20:48:48 +00:00
Improved performance on server on frontpage a bit
This commit is contained in:
@@ -34,12 +34,21 @@ var Frontpage = {
|
||||
|
||||
var num = 0;
|
||||
var pinned;
|
||||
if(lists[0].pinned == 1){
|
||||
pinned = lists.shift();
|
||||
|
||||
for(var i = 0; i < lists.length; i++) {
|
||||
if(!lists[i].hasOwnProperty("viewers")){
|
||||
lists[i].viewers = 0;
|
||||
}
|
||||
if(!lists[i].hasOwnProperty("pinned")){
|
||||
lists[i].pinned = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if(popular) {
|
||||
lists = lists.sort(Helper.predicate({
|
||||
name: 'pinned',
|
||||
reverse: true
|
||||
}, {
|
||||
name: 'viewers',
|
||||
reverse: true
|
||||
}, {
|
||||
@@ -51,6 +60,9 @@ var Frontpage = {
|
||||
}));
|
||||
} else {
|
||||
lists = lists.sort(Helper.predicate({
|
||||
name: 'pinned',
|
||||
reverse: true
|
||||
}, {
|
||||
name: 'viewers',
|
||||
reverse: true
|
||||
}, {
|
||||
@@ -77,7 +89,7 @@ var Frontpage = {
|
||||
for(var x in lists)
|
||||
{
|
||||
|
||||
var chan = lists[x].channel;
|
||||
var chan = lists[x]._id;
|
||||
if(num<12 || !popular)
|
||||
{
|
||||
var id = lists[x].id;
|
||||
@@ -90,8 +102,6 @@ var Frontpage = {
|
||||
|
||||
var song_count = lists[x].count;
|
||||
|
||||
//$("#channels").append(channel_list);
|
||||
|
||||
var card = pre_card.clone();
|
||||
if(lists[x].pinned == 1)
|
||||
{
|
||||
@@ -110,7 +120,7 @@ var Frontpage = {
|
||||
card.find(".chan-bg").attr("style", img);
|
||||
card.find(".chan-link").attr("href", chan + "/");
|
||||
|
||||
if(description != "" && !Helper.mobilecheck()){
|
||||
if(description != "" && description != undefined && !Helper.mobilecheck()){
|
||||
card.find(".card-title").text(chan);
|
||||
card.find(".description_text").text(description);
|
||||
description = "";
|
||||
|
||||
@@ -102,7 +102,6 @@ var Helper = {
|
||||
|
||||
hslToRgb: function(h, s, l) {
|
||||
var r, g, b;
|
||||
console.log(h, s, l);
|
||||
|
||||
if (s == 0) {
|
||||
r = g = b = l; // achromatic
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var VERSION = 2;
|
||||
var VERSION = 3;
|
||||
var chan = window.chan === undefined ? $("#chan").html() : window.chan;
|
||||
var w_p = true;
|
||||
var hasadmin = 0;
|
||||
@@ -126,7 +126,7 @@ $.ajaxPrefilter(function( options, original_Options, jqXHR ) {
|
||||
});
|
||||
|
||||
$().ready(function(){
|
||||
if(!localStorage.getItem("VERSION") || parseInt(localStorage.getItem("VERSION")) != 2) {
|
||||
if(!localStorage.getItem("VERSION") || parseInt(localStorage.getItem("VERSION")) != VERSION) {
|
||||
localStorage.setItem("VERSION", VERSION);
|
||||
}
|
||||
if(!fromFront && window.location.pathname != "/") init();
|
||||
|
||||
Reference in New Issue
Block a user