Ubiquity is an extension for the Firefox web browser and one of the most interesting projects so far to have come out of the Mozilla Labs. It does for Firefox what Quicksilver does for Mac OS X, though in a more limited way at the moment.
Essentially, it provides a framework for building lightweight extensions to Firefox, and seems to be intended to make mixing content from different sites a simple matter. There are plenty of examples available on the web of what it’s capable of (See here for a quick run down of the built in commands), and they’re also asking for user submitted commands.
Perfect though the Ubiquity extension is for commited command line lovers like myself, the question I have to ask is “Would my Mother use it?”, and to be honest I think the answer is “No.” Don’t get me wrong, I love it. I’ve written commands for it, and I use it daily. For developers and people who like to meddle it’s brilliant, but is it going to bring instant mash-ups to web users as a whole? Personally, I can’t see it. For that it needs, (shudder) a point and click interface. Add that (With an option to keep the command line. Please!) and away we go. Imagine – Right click on the page. Click the “Map this address” button and away we go **.
If you’re interested in writing commands for Ubiquity, the tutorial I linked to above is a good place to start. Sadly, the documentation appears to be a bit thin on the ground at present so the best way to learn is to look at commands other people have written. In that spirit, this is my command for listing all the links in a page that match a certain pattern. Feel free to take it and extend it – but please publish your changes. The success of projects like Ubiquity depends on people scratching their own itch and then publishing the results.
CmdUtils.CreateCommand({
name: "getlinks",
author: { name: "Kevin Pease"},
description: "Gets links out of a page for the given pattern",
takes: {"pattern": noun_arb_text},
preview: function(pblock, directObject) {
searchText = jQuery.trim(directObject.text);
if(searchText.length < 1) {
pblock.innerHTML =
"Gets links with the supplied pattern from the page";
return;
}
var previewTemplate = "${links}";
var previewData = {links: this._getLinks(directObject)};
pblock.innerHTML =
CmdUtils.renderTemplate(previewTemplate, previewData);
},
_getLinks: function(directObject) {
var doc = Application.activeWindow.activeTab.document;
var pattern = "a[href*='" + directObject.text + "']";
var strBuffer = 'Links matching ' + pattern + '
';
jQuery(doc.body).find(pattern).each(function(event){
if(strBuffer.indexOf(this.href) == -1)
{
strBuffer = strBuffer + this.href + '
';
}
});
return strBuffer;
}
});
** UPDATE: I’ve just stumbled across this very feature. Was it always in Ubiquity? I’d never noticed it before…
Sounds interesting, the ability to easily code your own commands is cool. You could write one to translate the young text speak littering you tube!
Quicksilver for OS X – is like this yeah – I will go a hunting for it. Do you know if you can code your own commands for that too.