diff options
author | anekos | 2008-11-19 19:24:12 +0000 |
---|---|---|
committer | anekos | 2008-11-19 19:24:12 +0000 |
commit | 6da78d8950dfafc740d8fa66272ef516f4441341 (patch) | |
tree | 2fb02bb0c498e0953b3c715762023123d08b7d3e | |
parent | 4391f22bf3c812fa2d290dbaecfacba83ea54cb6 (diff) | |
download | vimperator-plugins-6da78d8950dfafc740d8fa66272ef516f4441341.tar.bz2 |
rel="next|prev" に対応
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@24378 d0d07461-0603-4401-acd4-de1884942a52
-rw-r--r-- | auto_detect_link.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/auto_detect_link.js b/auto_detect_link.js index 3236929..d273a3b 100644 --- a/auto_detect_link.js +++ b/auto_detect_link.js @@ -147,9 +147,11 @@ // functions //////////////////////////////////////////////////////////////// + // 空白を function removeSpace (str) str.replace(/^\s+|\s+$/g, '').replace(/\s+/g, ' '); + // Array#find function find (ary, f) { var func = (typeof f == 'function') ? f : function (v) v == f; @@ -287,6 +289,7 @@ type: 'link', frame: content, uri: it.href, + rel: it.rel, text: it.textContent, element: it }); @@ -387,6 +390,14 @@ let uri = window.content.location.href; let links = getAllLinks(window.content); + // rel="prev|next" + if (1) { + let relValue = next ? /next/ : /prev/; + let link = find(links, function (link) ((typeof link.rel == 'string') && link.rel.match(relValue))); + if (link) + return link; + } + // keywords if (1) { let link; @@ -450,6 +461,7 @@ //////////////////////////////////////////////////////////////// if (gv().nextMappings.length) { + mappings.remove([modes.NORMAL], gv().nextMappings); mappings.addUserMap( [modes.NORMAL], gv().nextMappings, @@ -460,6 +472,7 @@ if (gv().backMappings.length) { + mappings.remove([modes.NORMAL], gv().backMappings); mappings.addUserMap( [modes.NORMAL], gv().backMappings, |