diff options
author | drry | 2008-10-07 18:08:56 +0000 |
---|---|---|
committer | drry | 2008-10-07 18:08:56 +0000 |
commit | ae8d24535565ed2aedd26ae162fde17351327b70 (patch) | |
tree | 12c3f211bd7369bed0ec7d8fdc3f9be472c29acc /lo.js | |
parent | 0df6df4c9984d1183c8cc9d91ec7f03a53c95cb6 (diff) | |
download | vimperator-plugins-ae8d24535565ed2aedd26ae162fde17351327b70.tar.bz2 |
* `isHttpLink()` の判定をプロトコルの接頭辞に限定しました。
* ほか。
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@20941 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'lo.js')
-rw-r--r-- | lo.js | 21 |
1 files changed, 10 insertions, 11 deletions
@@ -29,13 +29,12 @@ // let g:fopen_default_interval="<INTERVAL_SEC>" - -(function () { try{ +(function () { try { let migemo = window.XMigemoCore; function isHttpLink (link) { - return link.href && ~link.href.indexOf('http'); + return link.href && link.href.indexOf('http') == 0; } function lmatch (re, link) { @@ -50,9 +49,9 @@ function filteredLinks (word) { if (word.match(/^\s*$/)) - return []; + return []; let re = makeRegExp(word); - return [it for each (it in content.document.links) if (lmatch(re, it))]; + return [it for each (it in content.document.links) if (lmatch(re, it))]; } function charToWhere (str, fail) { @@ -117,7 +116,7 @@ } - let ( + let ( lolinks = [], looptions = [ [['-where', '-w'], liberator.commands.OPTION_STRING, null, WHERE_COMPLETIONS] ] ) { @@ -128,15 +127,15 @@ function (opts, bang) { let where = charToWhere(opts['-where'], bang ? NEW_TAB : CURRENT_TAB); let arg = opts.arguments[0]; - let m = arg.match(/^(\d+),/); - if (m) - liberator.buffer.followLink(lolinks[parseInt(m[1], 10)], where); + let m = arg.match(/^\d+(?=,)/); + if (m) + liberator.buffer.followLink(lolinks[parseInt(m[0], 10)], where); }, { options: looptions, bang: true, completer: function (word) { - if (!word || word.match(/\d+,|\s/)) + if (!word || word.match(/\s|\d+,/)) return []; lolinks = filteredLinks(word); return [0, [[i + ',' + lolinks[i].href, lolinks[i].textContent] for (i in lolinks || [])]]; @@ -146,6 +145,6 @@ } -}catch(e){log(e);}})(); +} catch (e) { log(e); }})(); // vim:sw=2 ts=2 et: |