Last active
December 15, 2015 23:39
-
-
Save mundoblogger/5341879 to your computer and use it in GitHub Desktop.
Adds Shorturl on blogger
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
<script type="text/javascript" charset="utf-8" src="http://bit.ly/javascript-api.js?version=latest&login=bitlyUsername&apiKey=bitlyAPI Key"></script> | |
<script type="text/javascript" charset="utf-8"> | |
BitlyClient.addPageLoadEvent(function(){ | |
BitlyCB.myShortenCallback = function(data) { | |
// this is how to get a result of shortening a single url | |
var result; | |
for (var r in data.results) { | |
result = data.results[r]; | |
result['longUrl'] = r; | |
break; | |
} | |
document.getElementById("shorturl").innerHTML = "Link: <input type='text' value='" + result['shortUrl'] + "' name='bitlyurl'/>"; | |
} | |
BitlyClient.shorten(document.location, 'BitlyCB.myShortenCallback'); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment