diff options
Diffstat (limited to 'searx/static/plugins/js/infinite_scroll.js')
-rw-r--r-- | searx/static/plugins/js/infinite_scroll.js | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/searx/static/plugins/js/infinite_scroll.js b/searx/static/plugins/js/infinite_scroll.js deleted file mode 100644 index cd8096571..000000000 --- a/searx/static/plugins/js/infinite_scroll.js +++ /dev/null @@ -1,40 +0,0 @@ -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: $('#search_form').prop('action'), - 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(); - } - } - }); - } -} - -$(document).ready(function() { - var win = $(window); - if(!hasScrollbar()) { - loadNextPage(); - } - win.scroll(function() { - $("#pagination button").css("visibility", "hidden"); - if ($(document).height() - win.height() - win.scrollTop() < 150) { - loadNextPage(); - } - }); -}); |