1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

lazy load scripts

This commit is contained in:
Luke Pulverenti 2015-05-16 15:09:02 -04:00
parent 1f0760df09
commit 89e0515a15
31 changed files with 366 additions and 328 deletions

View file

@ -153,7 +153,7 @@
}
}
$(document).on('pageinit', "#musicAlbumsPage", function () {
$(document).on('pageinitdepends', "#musicAlbumsPage", function () {
var page = this;
@ -248,7 +248,7 @@
reloadItems(page);
});
}).on('pagebeforeshow', "#musicAlbumsPage", function () {
}).on('pageshown', "#musicAlbumsPage", function () {
query.ParentId = LibraryMenu.getTopParentId();
@ -274,27 +274,7 @@
}
});
}).on('pageshow', "#musicAlbumsPage", function () {
updateFilterControls(this);
var updateScheduled = false;
function onscreen() {
var viewportBottom = $(window).scrollTop() + $(window).height();
return ($(document).height() - viewportBottom) < 100;
}
$(window).on('scroll', function () {
console.log('load');
if (!updateScheduled) {
setTimeout(function () {
if (onscreen()) {
console.log('load');
}
updateScheduled = false;
}, 500);
updateScheduled = true;
}
});
});
})(jQuery, document);