aboutsummaryrefslogtreecommitdiffstats
path: root/vimiumFrontend.js
diff options
context:
space:
mode:
authorR.T. Lechow2011-01-04 19:02:53 -0500
committerR.T. Lechow2011-01-04 19:57:29 -0500
commit5f944bc99c7cb25412d4f7a51b946b27a14ca77d (patch)
treefff356a668877a2b2fe6b0473af2711a0f26a590 /vimiumFrontend.js
parentfdc320339e8cbdf978fe2259f247eec2e182a65f (diff)
downloadvimium-5f944bc99c7cb25412d4f7a51b946b27a14ca77d.tar.bz2
Commands for following 'previous' and 'next' links.
Diffstat (limited to 'vimiumFrontend.js')
-rw-r--r--vimiumFrontend.js26
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));