diff options
Diffstat (limited to 'searx/static/plugins/js/infinite_scroll.js')
-rw-r--r-- | searx/static/plugins/js/infinite_scroll.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/searx/static/plugins/js/infinite_scroll.js b/searx/static/plugins/js/infinite_scroll.js new file mode 100644 index 000000000..213f74b15 --- /dev/null +++ b/searx/static/plugins/js/infinite_scroll.js @@ -0,0 +1,18 @@ +$(document).ready(function() { + var win = $(window); + win.scroll(function() { + if ($(document).height() - win.height() == win.scrollTop()) { + var formData = $('#pagination form:last').serialize(); + if (formData) { + $('#pagination').html('<div class="loading-spinner"></div>'); + $.post('/', formData, function (data) { + var body = $(data); + $('#pagination').remove(); + $('#main_results').append('<hr/>'); + $('#main_results').append(body.find('.result')); + $('#main_results').append(body.find('#pagination')); + }); + } + } + }); +}); |