Microformats API in Firefox 3

3 views
Skip to first unread message

Martin McEvoy

unread,
Sep 1, 2008, 2:56:32 PM9/1/08
to ubiquity...@googlegroups.com
Hello All

Is anyone working on building the Microformats API[1] into Ubiquity?
It would be very cool if someone was Microformats would work very well
in the map command, it could detect geo[2] locations in users pages,
and email-to could work on hcards[3].

[1] http://developer.mozilla.org/en/Using_microformats
[2] http://microformats.org/wiki/geo
[3] http://microformats.org/wiki/hcard

Best Wishes

Martin McEvoy

Pfefferle

unread,
Sep 6, 2008, 4:33:51 PM9/6/08
to ubiquity-firefox
It is possible... Here is some example code:

Components.utils.import("resource://gre/modules/Microformats.js");

CmdUtils.CreateCommand({
name: "count-hcards",
execute: function() {
var doc = Application.activeWindow.activeTab.document;
var uFcount = Microformats.count('hCard', doc);
displayMessage( uFcount );
}
})

Guy Fraser

unread,
Sep 6, 2008, 7:25:54 PM9/6/08
to ubiquity...@googlegroups.com
I'd love to see a load of nouns based on uF's - that would make
accessing uF's in verbs trivially easy...

Blair McBride

unread,
Sep 8, 2008, 8:40:45 AM9/8/08
to ubiquity...@googlegroups.com
I agree - its an easy way for Ubiquity to get extra contextual information.

There's already some code in Ubiquity dealing with Microformats, but I'm
not even sure if its loaded anywhere. See
http://hg.toolness.com/ubiquity-firefox/file/tip/ubiquity/chrome/content/microformat_cmds.js

- Blair

Martin McEvoy

unread,
Sep 8, 2008, 9:17:58 AM9/8/08
to ubiquity...@googlegroups.com
Hmm this is interesting ;-)

Try this:

Components.utils.import("resource://gre/modules/Microformats.js");
CmdUtils.CreateCommand({

name: "hcard-test",


execute: function() {
var doc = Application.activeWindow.activeTab.document;

var hCards = Microformats.get('hCard', doc);
hCards.forEach(function(hcard) {
displayMessage([
'Name: '+hcard.fn,
].join('n'));
});
}
})


More to come ....


Martin McEvoy
>
>
> >
>

Martin McEvoy

unread,
Sep 8, 2008, 2:15:03 PM9/8/08
to ubiquity...@googlegroups.com
Hello All

There Is A Page on the Microformats Wiki for anyone Interested in adding
The Microformats-API to ubiquity (and also a few Microformats specific
commands)

http://microformats.org/wiki/ubiquity

Best Wishes

Martin McEvoy

Reply all
Reply to author
Forward
0 new messages