diff options
author | anekos | 2008-07-30 10:41:35 +0000 |
---|---|---|
committer | anekos | 2008-07-30 10:41:35 +0000 |
commit | 49fe9112c6b738b737d245f9b88668d26192c293 (patch) | |
tree | 3cc4fd4b5e1413e9db7c14082a48cb479b3df61f /auto_detect_link.js | |
parent | eb94a9a991615871df424208f43e4a74d9a5c191 (diff) | |
download | vimperator-plugins-49fe9112c6b738b737d245f9b88668d26192c293.tar.bz2 |
succ するときに、URIの後ろの方の数字/文字を優先するように修正
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@16883 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'auto_detect_link.js')
-rw-r--r-- | auto_detect_link.js | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/auto_detect_link.js b/auto_detect_link.js index 79ef7d8..c6156a0 100644 --- a/auto_detect_link.js +++ b/auto_detect_link.js @@ -2,7 +2,7 @@ // @name Auto Detect Link // @description-ja (次|前)っぽいページへのリンクを探してジャンプ // @license Creative Commons 2.1 (Attribution + Share Alike) -// @version 1.0 +// @version 1.0.1 // ==/VimperatorPlugin== // // Usage: @@ -194,30 +194,33 @@ return []; let [_, dir, file] = urim, result = []; // succ number - let (dm, succs, file = file, left = '') { + let (dm, succs, file = file, left = '', temp = []) { while (file && (dm = file.match(/\d+/))) { let [rcontext, lcontext, lmatch] = [RegExp.rightContext, RegExp.leftContext, RegExp.lastMatch]; left += lcontext; succs = succNumber(lmatch, next); for each (let succ in succs) { - result.push(dir + left + succ + rcontext); + temp.push(dir + left + succ + rcontext); } left += lmatch; file = rcontext; } + result = result.concat(temp.reverse()); } + liberator.log(result); // succ string - let (dm, succs, file = file, left = '') { + let (dm, succs, file = file, left = '', temp = []) { while (file && (dm = file.match(/(^|[^a-zA-Z])([a-zA-Z])([^a-zA-Z]|$)/))) { let [rcontext, lcontext] = [RegExp.rightContext, RegExp.leftContext]; left += lcontext + dm[1]; succs = succString(dm[2], next); for each (let succ in succs) { - result.push(dir + left + succ + dm[3] + rcontext); + temp.push(dir + left + succ + dm[3] + rcontext); } left += dm[1]; file = dm[3] + rcontext; } + result = result.concat(temp.reverse()); } return result; } @@ -265,12 +268,19 @@ // Anchor for each (let it in content.document.links) { if (linkFilter(it)) - result.push({frame: content, uri: it.href, text: it.textContent, element: it}); + result.push({ + type: 'link', + frame: content, + uri: it.href, + text: it.textContent, + element: it + }); } // Form for each (let input in content.document.getElementsByTagName('input')) { (function (input) { result.push({ + type: 'input', frame: content, uri: input.form && input.form.action, text: input.value, @@ -328,7 +338,7 @@ let succs = succURI(uri, next); if (setting.useSuccPattern) { for each (succ in succs) { - let link = find(links, function (link) (link.uri.indexOf(succ) >= 0)); + let link = find(links, function (link) (link.uri && (link.uri.indexOf(succ) >= 0))); if (link) return link; } |