/admin/plugins: Fix infinite scroll for larger screens

This commit is contained in:
Marcel Klehr 2013-03-26 19:32:15 +01:00
parent 2393dcd652
commit 4edb3b7ab3
1 changed files with 11 additions and 7 deletions

View File

@ -75,6 +75,16 @@ $(document).ready(function () {
})
}
// Infinite scroll
$(window).scroll(checkInfiniteScroll)
function checkInfiniteScroll() {
if(search.end) return;// don't keep requesting if there are no more results
try{
var top = $('.search-results .results > tr:last').offset().top
if($(window).scrollTop()+$(window).height() > top) search(search.searchTerm)
}catch(e){}
}
function updateHandlers() {
// Search
$("#search-query").unbind('keyup').keyup(function () {
@ -102,13 +112,6 @@ $(document).ready(function () {
})
});
// Infinite scroll
$(window).unbind('scroll').scroll(function() {
if(search.end) return;// don't keep requesting if there are no more results
var top = $('.search-results .results > tr:last').offset().top
if($(window).scrollTop()+$(window).height() > top) search(search.searchTerm)
})
// Sort
$('.sort.up').unbind('click').click(function() {
search.sortBy = $(this).text().toLowerCase();
@ -154,6 +157,7 @@ $(document).ready(function () {
$(".search-results .nothing-found").show()
}
$('#search-progress').hide()
checkInfiniteScroll()
});
socket.on('results:installed', function (data) {