diff options
Diffstat (limited to 'vimiumFrontend.js')
| -rw-r--r-- | vimiumFrontend.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/vimiumFrontend.js b/vimiumFrontend.js index eb3de996..0ee3f762 100644 --- a/vimiumFrontend.js +++ b/vimiumFrontend.js @@ -550,6 +550,32 @@ function performBackwardsFind() { findModeQueryHasResults = window.find(findModeQuery, false, true, true, false, true, false); } +function findAndFollowLink(linkStrings) { + linkStrings.forEach(function(findModeQuery) { + findModeQueryHasResults = window.find(findModeQuery, false, true, true, false, true, false); + if (findModeQueryHasResults) { + var node = window.getSelection().anchorNode; + while (node.nodeName != 'BODY') { + if (node.nodeName == 'A') { + window.location = node.href; + return; + } + node = node.parentNode; + } + } + }); +} + +function goPrevious() { + previousStrings = ["\bprev\b","\bprevious\b","\u00AB","<<","<"]; + findAndFollowLink(previousStrings); +} + +function goNext() { + nextStrings = ["\bnext\b","\u00BB",">>","\bmore\b",">"]; + findAndFollowLink(nextStrings); +} + function showFindModeHUDForQuery() { if (findModeQueryHasResults || findModeQuery.length == 0) HUD.show("/" + insertSpaces(findModeQuery)); |
