// INFO //
var INFO =
Mitsugu Oyama
anekos
MIT
You can get short URL by goo.gl by this plugin.
-
'goo.gl'
:googl Long URL
You can get short URL by goo.gl by this plugin.
;
(function(){
let short_url=function(long_url){
let req=new XMLHttpRequest();
req.addEventListener("load",function(){
let response=JSON.parse(req.responseText);
liberator.echo(response.short_url);
util.copyToClipboard(response.short_url,true);
},false);
req.addEventListener("error",function(){
liberator.echo("Responce errror status from goo.gl. Status Code:" + req.status);
},false);
req.open("POST", "http://goo.gl/api/shorten?url="+encodeURIComponent(long_url));
req.setRequestHeader("X-Auth-Google-Url-Shortener","true");
req.send();
};
commands.addUserCommand(
["googl"],
"Get short URL from Google",
function(args){
let long_url;
if(args.length==0){
long_url=buffer.URL;
}else if(args.length==1){
long_url=args.literalArg;
}else{
liberator.echoerr('argument error');
return;
}
short_url(long_url);
}, {
literal: 0
}, true);
})();
nchronization'>aboutsummaryrefslogtreecommitdiffstats
|
blob: c6a068a73e206d1caba4dc5893957c05aad40d1f (
plain)