2020-03-23 13:05:19 +01: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",
|
2019-07-30 06:25:05 +02:00
|
|
|
url: $('#search_form').prop('action'),
|
2020-03-23 13:05:19 +01:00
|
|
|
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 04:21:28 +02:00
|
|
|
$(document).ready(function() {
|
|
|
|
var win = $(window);
|
2020-03-23 13:05:19 +01:00
|
|
|
if(!hasScrollbar()) {
|
|
|
|
loadNextPage();
|
|
|
|
}
|
2016-08-11 04:21:28 +02:00
|
|
|
win.scroll(function() {
|
2020-03-23 13:05:19 +01:00
|
|
|
$("#pagination button").css("visibility", "hidden");
|
2019-06-04 18:22:02 +02:00
|
|
|
if ($(document).height() - win.height() - win.scrollTop() < 150) {
|
2020-03-23 13:05:19 +01:00
|
|
|
loadNextPage();
|
2016-08-11 04:21:28 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|