Mozilla Ubiquity

Mozilla announced a new labs project, Ubiquity, last week. It's intended to be a keyboard driven interface to advanced functionality in the web browser, similar to Gnome Do, which I've been using a lot recently, and the Mac application Quicksilver.

I decided to have a quick play by re-implementing part of my Use the new microformats API in your Firefox 3.0 Extensions tip as a Ubiquity command. Following the tutorial I was able to directly transplant the code, replacing only content.document with CmdUtils.getDocumentInsecure():

CmdUtils.CreateCommand({
  name: "grab-hcard",
  homepage: "http://www.boogdesign.com/",
  author: { name: "Rob Crowther", email: "robertc@boogdesign.com"},
  license: "MPL",

  execute: function() {
    Components.utils.import("resource://gre/modules/Microformats.js");
    var uFcount = Microformats.count('hCard', CmdUtils.getDocumentInsecure(), {recurseExternalFrames: true});
    if (uFcount > 0) {
        var uFlist = Microformats.get('hCard', CmdUtils.getDocumentInsecure(), {recurseExternalFrames: true});
        displayMessage(uFlist[0].url[0]);
    } else {
        displayMessage('None found');
    }
  }
})

Download grab-hcard.js Note: This command does not work in the current version of Ubiquity, a 'is not a function' error, not worked out what the problem is yet.