mooUrl Ubiquity Command

Brincando com a API do Ubiquity, acabei fazendo este comando para utilizar o moourl de forma similar ao tinyurl.

Vamos então ao código:

/*
* mooUrl command for Firefox Ubiquity extension.
* date: 03/04/2009
* author: Renato Aquino <renato.aquino@gmail.com>
* add with <link rel="commands" href="mooUrl.js"/> to your page
*/
CmdUtils.CreateCommand({
name: "moourl",
takes: {"url to shorten": noun_type_url},
icon: "http://moourl.com/favicon.ico",
description: "Replaces the selected URL with a <a href=\"http://moourl.com\">MooUrl</a>",
author: {name: "Renato Aquino", email: "renato.aquino@gmail.com"},
license: "GPL",
baseUrl: "http://moourl.com/create/?source=",
preview: function( pblock, urlToShorten ){
pblock.innerHTML = "Replaces the selected URL with ",
jQuery.get( this.baseUrl + urlToShorten.text, function( moo ) {
if(moo != "Error")
pblock.innerHTML += jQuery("#milked_url",moo).text();
});
},
execute: function( urlToShorten ) {
//escaping urlToShorten will not create the right moourl
jQuery.get( this.baseUrl + urlToShorten.text, function( moo ) {
if(moo != "Error")
CmdUtils.setSelection( jQuery("#milked_url",moo).text() );
});
}
});

Comentários

Postagens mais visitadas deste blog

CFTV com Zoneminder e Linux

Take the blue pill.

O problema C10K