Created
June 3, 2010 11:08
-
-
Save littlefolk/423749 to your computer and use it in GitHub Desktop.
vimperator plugin: urlcanonicalize
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// :urlcanonicalize, :urlnormalize --- URL正規化 {{{ | |
// @http://pathtraq.com/developer/#help_normalize_url | |
// @http://d.hatena.ne.jp/janus_wel/20080924/1222244725 | |
commands.addUserCommand( | |
['url[canonicalize]', 'url[normalize]'], 'URL Canonicalization', | |
function (arg) { | |
if (arg.bang) | |
{ | |
let req = new libly.Request("http://api.pathtraq.com/normalize_url2?url=" + buffer.URL); | |
req.addEventListener("onSuccess", function (res) liberator.open(libly.$U.evalJson(res.responseText))); | |
req.get(); | |
} | |
else | |
if (~buffer.URL.indexOf("&")) liberator.open(buffer.URL.split("&")[0]); | |
}, | |
{ | |
bang: true | |
}, | |
true | |
); | |
// }}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment