diff options
author | Alexandre Flament <alex@al-f.net> | 2022-01-23 11:37:57 +0100 |
---|---|---|
committer | Alexandre Flament <alex@al-f.net> | 2022-02-20 22:58:51 +0100 |
commit | 56e34947a6368e6154064c52fa23d21ecda7ab4c (patch) | |
tree | bad1463a0c3056896cfacb205039586b85a2c04d /searx/static/plugins | |
parent | 36aee70c247fe347c69abb17ec3bdc31781204c6 (diff) | |
download | searxng-56e34947a6368e6154064c52fa23d21ecda7ab4c.tar.gz searxng-56e34947a6368e6154064c52fa23d21ecda7ab4c.zip |
[mod] infinite_scroll as preference
* oscar theme: code from searx/plugins/infinite_scroll.py
* simple theme: new implementation
Co-authored-by: Markus Heiser <markus.heiser@darmarIT.de>
Diffstat (limited to 'searx/static/plugins')
-rw-r--r-- | searx/static/plugins/css/infinite_scroll.css | 19 | ||||
-rw-r--r-- | searx/static/plugins/js/infinite_scroll.js | 40 |
2 files changed, 0 insertions, 59 deletions
diff --git a/searx/static/plugins/css/infinite_scroll.css b/searx/static/plugins/css/infinite_scroll.css deleted file mode 100644 index 07b9f6de9..000000000 --- a/searx/static/plugins/css/infinite_scroll.css +++ /dev/null @@ -1,19 +0,0 @@ -@keyframes rotate-forever { - 0% { transform: rotate(0deg) } - 100% { transform: rotate(360deg) } -} -.loading-spinner { - animation-duration: 0.75s; - animation-iteration-count: infinite; - animation-name: rotate-forever; - animation-timing-function: linear; - height: 30px; - width: 30px; - border: 8px solid #666; - border-right-color: transparent; - border-radius: 50% !important; - margin: 0 auto; -} -#pagination button { - visibility: hidden; -} 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(); - } - }); -}); |