Created
April 27, 2009 11:53
-
-
Save erickedji/102450 to your computer and use it in GitHub Desktop.
Shorten a URL with bit.ly (uses bit.ly's google spreadsheet API key)
This file contains hidden or 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
| /* | |
| * Shorten a URL with bit.ly (uses bit.ly's google spreadsheet API key) | |
| * | |
| * Eric KEDJI <eric.kedji@gmail.com> | |
| */ | |
| CmdUtils.CreateCommand({ | |
| name: "bitly", | |
| homepage: "http://erickedji.wordpress.com/", | |
| author: {name: "Eric", email: "eric.kedji@gmail.com"}, | |
| license: "GPL", | |
| description: "Shorten the selected URL using bit.ly", | |
| help: "Invoke it on a chunk of text", | |
| takes: {"input": /.*/}, | |
| preview: function(pblock, input) { | |
| pblock.innerHTML = "Shorten the selected URL."; | |
| }, | |
| execute: function(input, mod) { | |
| var url = input.text; | |
| jQuery.get('http://api.bit.ly/shorten?version=2.0.1&login=bitlyspreadsheets&apiKey=R_ec5820b9a63b11ef0adfda8f98810713&format=text&longUrl=' + encodeURIComponent(url), | |
| {}, function (reply) { CmdUtils.setSelection(reply); } ); | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment