2020-03-23 12:05:19 +00:00
|
|
|
function hasScrollbar() {
|
|
|
|
var root = document.compatMode=='BackCompat'? document.body : document.documentElement;
|
|
|
|
return root.scrollHeight>root.clientHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
function loadNextPage() {
|
|
|
|
var formData = $('#pagination form:last').serialize();
|
|
|
|
if (formData) {
|
|
|
|
$('#pagination').html('<div class="loading-spinner"></div>');
|
|
|
|
$.ajax({
|
|
|
|
type: "POST",
|
|
|
|
url: './',
|
|
|
|
data: formData,
|
|
|
|
dataType: 'html',
|
|
|
|
success: function(data) {
|
|
|
|
var body = $(data);
|
|
|
|
$('#pagination').remove();
|
|
|
|
$('#main_results').append('<hr/>');
|
|
|
|
$('#main_results').append(body.find('.result'));
|
|
|
|
$('#main_results').append(body.find('#pagination'));
|
|
|
|
if(!hasScrollbar()) {
|
|
|
|
loadNextPage();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-11 02:21:28 +00:00
|
|
|
$(document).ready(function() {
|
|
|
|
var win = $(window);
|
2020-03-23 12:05:19 +00:00
|
|
|
if(!hasScrollbar()) {
|
|
|
|
loadNextPage();
|
|
|
|
}
|
2016-08-11 02:21:28 +00:00
|
|
|
win.scroll(function() {
|
2020-03-23 12:05:19 +00:00
|
|
|
$("#pagination button").css("visibility", "hidden");
|
2019-06-04 16:22:02 +00:00
|
|
|
if ($(document).height() - win.height() - win.scrollTop() < 150) {
|
2020-03-23 12:05:19 +00:00
|
|
|
loadNextPage();
|
2016-08-11 02:21:28 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|