mirror of
https://github.com/searxng/searxng
synced 2024-01-01 18:24:07 +00:00
Merge pull request #1615 from Nachtalb/ne/fix-infinite_scroll-with-vim_bindings
Fix not jumping to results loaded by infinite scroll
This commit is contained in:
commit
5a0a66e9bc
@ -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) {
|
function highlightResult(which) {
|
||||||
return function() {
|
return function() {
|
||||||
var current = $('.result[data-vim-selected]');
|
var current = $('.result[data-vim-selected]');
|
||||||
@ -157,13 +165,13 @@ $(document).ready(function() {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'down':
|
case 'down':
|
||||||
next = current.next('.result');
|
next = nextResult(current, 'next');
|
||||||
if (next.length === 0) {
|
if (next.length === 0) {
|
||||||
next = $('.result:first');
|
next = $('.result:first');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'up':
|
case 'up':
|
||||||
next = current.prev('.result');
|
next = nextResult(current, 'prev');
|
||||||
if (next.length === 0) {
|
if (next.length === 0) {
|
||||||
next = $('.result:last');
|
next = $('.result:last');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user