You can use the Share button on your command editor to post your command to GitHub which makes it easy for others to install the command without having to copy/paste the code themselves.
Cheers, Abi 2009/1/23 sreenivas k <[email protected]> > > Here is a command which shortens the selected URL using the bit.ly API > > Goto the ubiquity command editor in the browser and paste the > following code.. > > > CmdUtils.CreateCommand({ > name: "bit.ly", > icon: "http://bit.ly/static/images/blowfish_logo_small.png", > homepage: "http://bit.ly/", > author: { name: "sreenivas kanthamneni", email: > "[email protected]"}, > license: "GPL", > description: "Uses the bit.ly api to shorten the url", > help: "bit.ly ", > takes: {"url to shorten": noun_type_url}, > shortUrl: "", > preview: function( pblock, input ) { > pblock.innerHTML = "Replaces the selected URL with a bit.ly."; > this._getBitlyUrl( pblock, input, "preview" ); > }, > execute: function( input ) { > this._getBitlyUrl( "", input, "execute" ); > }, > _getBitlyUrl: function( pblock, longurl, call ) { > var bitlyUrl = "http://api.bit.ly/shorten?version=2.0.1&longUrl=" + > jQuery.trim(longurl.text) + > > "&login=sreenivas&apiKey=R_3e18bdec1fae36b6a516cba5cfbff39f&format=json&callback=?"; > jQuery.getJSON(bitlyUrl, > function(data){ > if(data) { > pblock.innerHTML = "Replaces selected URL with " > for (var r in data.results) { > result = data.results[r]; > result['longUrl'] = r; > break; > } > if( call == "preview" ) { > pblock.innerHTML += result['shortUrl']; > } > if( call == "execute" ) { > CmdUtils.setSelection(result['shortUrl']); > } > } > }); > }, > }); > > > > And we are ready ... > > whenever you need to shorten an URL invoke Ubiquity type bit.ly (url > to shorten) .. > > (or) > > select the URL -> right click on it -> click on Ubiquity -> click on > bit.ly > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ubiquity-firefox" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/ubiquity-firefox?hl=en -~----------~----~----~----~------~----~------~--~---
