summaryrefslogtreecommitdiff
path: root/searx/static/plugins/js/infinite_scroll.js
diff options
context:
space:
mode:
authorDavid A Roberts <d@vidr.cc>2016-08-11 12:21:28 +1000
committerDavid A Roberts <d@vidr.cc>2016-08-11 19:16:42 +1000
commit678b9e994a4e74fe287f3bc2515ee0e323c1bf69 (patch)
treed9cf285612556347e668b464f1042a4b78d1cd12 /searx/static/plugins/js/infinite_scroll.js
parent975bd5beb5d98dc56664eb7a4085e90a566cf63d (diff)
downloadsearxng-678b9e994a4e74fe287f3bc2515ee0e323c1bf69.tar.gz
searxng-678b9e994a4e74fe287f3bc2515ee0e323c1bf69.zip
[enh] infinite scroll
resolves #649
Diffstat (limited to 'searx/static/plugins/js/infinite_scroll.js')
-rw-r--r--searx/static/plugins/js/infinite_scroll.js18
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'));
+ });
+ }
+ }
+ });
+});