Adding handlers to Operator

Over at you’ll see the announcement of a microformats extension I created called Operator. I figured the release of this extension was a good reason for me to start blogging again, since people have questions and comments about the extension. So that’s what I’ll be doing here.

So far, the response has been great. Here are some posts from LouderVoice blog, microformatique, wizardishungry/blog,, pixelsebi’s repository (in German), and Not So Relevant.

So far I think the one thing that everyone has missed about Operator is that it is extensible out of the box. Here’s an example.

I got this question on the newsgroup:

Will a newer version have a built in mechanism that
will allow me to extend it without it being built
into the operator extension?

For example, I want to add an additional service
such as to show me questions and answers
on a certain tag.

In Yedda's case (and others with similar URL structure)
it simply means the ability to add a parameterized URL
handler so I can define something like:{tags}

as the handler where {tags} will be replaced by the
values of the various rel-tags on the page.

And here’s my answer:

Operator already supports this functionality. Check
out the file handler-example.js in the directory where
the extension is called. For yedda, here is what it
would look like:

Microformats.tag.handlers['yedda'] = {
description: "Find questions on Yedda",

action: function(doc, item) {
tag = Microformats.tag.create(doc,item);
url = "" + tag.tag;
Save this to a file called "yedda.js" and place it
in a directory called "microformats" in your profile
directory and you have yedda support.

So as you can see, Operator was designed to be extensible out of the box.

I’ll go into more detail about the architecture of Operator with my next post. The main thing to remember is that it is NOT a microformats toolbar! It is a microformats architecture that is currently using a toolbar as the UI. I have kept the microformats part separate from the toolbar part.

Please note: I reserve the right to delete comments that are offensive or off-topic.

Leave a Reply

Your email address will not be published. Required fields are marked *

5 thoughts on “Adding handlers to Operator

  1. Thanks for this example and the Operator, Mike! The extensibility is one of the best features.

    This example worked for me with no hiccups, the only thing you may want to add to the instructions is “… and then restart your browser”

    Is there a place where I can check the JS API of the Microformats class.

    Thanks again, amazing work!

  2. Of course, with this kind of feature, a clearinghouse for extending Operator is needed, like is for Greasemonkey. Have you talked with the people about providing it? That seems like a logical place.