Ubiquity is the shit!

Posted by phillip Sat, 28 Mar 2009 18:46:00 GMT

Ubiquity is a Mozilla Labs add-on for Firefox. It’s a new way of interacting with the browser and web content. Imagine Quicksilver, but for everything that can be reached from the browser. Common examples are controllign the browser, translating text on a web page in-place, looking up an Google maps address in-place, you imagine. It let’s you throw out half of the other add-ons. Oh, and on the Mac, it integrates with Growl.

And it’s super-easy to extend with JavaScript!

Example – using is.gd to shorten URLs

I hacked this together using the pretty good documentation. The code takes the text selection (an URL) and shortens it via is.gd.

CmdUtils.CreateCommand({

  name: "is-gd",

  description: "Replaces the selected URL with a short URL generated with is.gd.",

  author: { name: "Phillip Oertel" },

  takes: {"url to shorten": noun_arb_text},

  execute: function(urlToShorten) {
    var baseUrl = "http://is.gd/api.php";
    var params  = {longurl: urlToShorten.text};
    jQuery.get( baseUrl, params, function( shortUrl ) {
      CmdUtils.setSelection( shortUrl );
    });
  }

});

I embedded the above script into this page—if you installed the Ubiquity add-on, Firefox will notify you. Install the script, then select an URL anywhere on the page or in the location bar, press Alt-Space and type “is-gd”. The selected text will be replaced with a shortended URL. Neat!

They really have easy administration and extension in mind—go to chrome://ubiquity/content/cmdlist.html to get an in-browser interface to Ubiquity. You can directly write the scripts in there. Oh, and did I mention it already ships with jquery ?

Posted in , , |