diff options
author | Markus Heiser <markus.heiser@darmarIT.de> | 2019-12-24 17:34:33 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-24 17:34:33 +0100 |
commit | 5a0a66e9bc34af2b6404231efc7cf02f389bdfcb (patch) | |
tree | 51f1a35121155010411aa5970ef06aff80adf741 | |
parent | a395fb4a8d030d5b8fde496d2ae722bc034d3e32 (diff) | |
parent | 38dad2e8e3b100711afe3ae942aaed5111841cd6 (diff) | |
download | searxng-5a0a66e9bc34af2b6404231efc7cf02f389bdfcb.tar.gz searxng-5a0a66e9bc34af2b6404231efc7cf02f389bdfcb.zip |
Merge pull request #1615 from Nachtalb/ne/fix-infinite_scroll-with-vim_bindings
Fix not jumping to results loaded by infinite scroll
-rw-r--r-- | searx/static/plugins/js/vim_hotkeys.js | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/searx/static/plugins/js/vim_hotkeys.js b/searx/static/plugins/js/vim_hotkeys.js index 13bd070e0..b0f265cb5 100644 --- a/searx/static/plugins/js/vim_hotkeys.js +++ b/searx/static/plugins/js/vim_hotkeys.js @@ -125,6 +125,14 @@ $(document).ready(function() { } }); + function nextResult(current, direction) { + var next = current[direction](); + while (!next.is('.result') && next.length !== 0) { + next = next[direction](); + } + return next + } + function highlightResult(which) { return function() { var current = $('.result[data-vim-selected]'); @@ -157,13 +165,13 @@ $(document).ready(function() { } break; case 'down': - next = current.next('.result'); + next = nextResult(current, 'next'); if (next.length === 0) { next = $('.result:first'); } break; case 'up': - next = current.prev('.result'); + next = nextResult(current, 'prev'); if (next.length === 0) { next = $('.result:last'); } |