Skip to content

Instantly share code, notes, and snippets.

@harlley
Created February 6, 2009 19:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harlley/59549 to your computer and use it in GitHub Desktop.
Save harlley/59549 to your computer and use it in GitHub Desktop.
Replaces the selected URL with a Migre.me URL
//teste
CmdUtils.CreateCommand({
name: "migre",
homepage: "http://webtoo.com.br",
author: { name: "Harlley", email: "harlley@gmail.com"},
license: "GPL",
description: "Replaces the selected URL with a Migre.me URL",
takes: {"url to shorten": noun_arb_text},
preview: "Replaces the selected URL with a Migre.me URL",
execute: function( urlToShorten ) {
var baseUrl = "http://migre.me/api.xml";
var params = {url: urlToShorten.text};
jQuery.get( baseUrl, params, function( tinyUrl ) {
jQuery("item", tinyUrl ).each(function(){
migre = jQuery("migre", this).text();
CmdUtils.setSelection( migre );
});
})
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment