diff options
author | drry | 2008-10-04 14:28:22 +0000 |
---|---|---|
committer | drry | 2008-10-04 14:28:22 +0000 |
commit | bb0c83da4ce719b363f9db6c2db0ab892e176bc4 (patch) | |
tree | d5ca5a5372c888e6c60a25d4bedefa55e64f93b4 /incuri.js | |
parent | 2ca6931857620ee894f002573af4dc7231b4a61b (diff) | |
download | vimperator-plugins-bb0c83da4ce719b363f9db6c2db0ab892e176bc4.tar.bz2 |
* 既定ポートを修正しました。
* 数字の引数を追加しました。 e.g. `:incuri 2`
git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@20723 d0d07461-0603-4401-acd4-de1884942a52
Diffstat (limited to 'incuri.js')
-rw-r--r-- | incuri.js | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -4,7 +4,7 @@ * @description increment the number in the URI * @description-ja URIに含まれる数字をインクリメント * @author hogelog - * @version 0.02 + * @version 0.03 * ==/VimperatorPlugin== * * COMMANDS: @@ -37,11 +37,15 @@ var l = window.content.location; var part = l[p]; if(p == "port" && part == "") { - part = "80"; + part = ({ + "ftp:" : "21", "http:" : "80", "https:" : "443" + })[l.protocol] || part; } if(numreg.test(part)) { + arg = arg.arguments[0]; let num = RegExp.$2; - let nextnum = numstr(f(parseInt(num)), num.length); + let quantity = !arg || isNaN(arg) ? 1 : parseInt(arg); + let nextnum = numstr(f(parseInt(num), quantity), num.length); let newpart = RegExp.$1 + nextnum + RegExp.$3; if(p == "href") { window.content.location.href = newpart; @@ -75,7 +79,8 @@ liberator.commands .add([prefix.toLowerCase() + "c" + suffix], prefix + "crement the number in the " + name + ".", - makeinc(function(x) x + dir, prop)); + makeinc(function(x, q) x + dir * q, prop), + { argCount : "?" }); }); }); })(); |