Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
document.body.appendChild(function(){
sc = document.createElement("script");
var code = function(){
window.bitly_load=function(res){prompt("",res.data.url);}
}
src = "("+code.toString()+")();"
sc.type="text/javascript";
sc.text=src
return sc;
}()
);
bi = new URL("https://api-ssl.bitly.com/v3/shorten?");
var params = ["login=USERNAME", "domain=j.mp", "apiKey=API_KEY","callback=bitly_load", "longUrl=" + encodeURIComponent(location.href)];
bi.search = "?" + params.join("&");
document.body.appendChild(function(){
sc = document.createElement("script");
sc.type="text/javascript";
sc.src = bi.toString()
return sc;
}()
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment