[uf-discuss] Mozilla Jetpack API and representative hCard add-on
Sarven Capadisli
info at csarven.ca
Wed Jun 3 09:54:31 PDT 2009
Hi all,
Using the Mozilla Jetpack API [0], I created a simple add-on that looks
for a representative hCard on the current Mozilla/Firefox tab and offers
a link to download it as a vCard [1]. If you want to test it out, you
need to first install the Jetpack API, the Jetpack script, and head over
to a page with a representative hCard [2].
The way it works right now is that the script gets a hold of
'.vcard .uri.url[rel=me]' href value (If that's not accurate, please let
me know), and pass that onto Toby Inkster's representative hCard to
vCard transformer [3]. The transformer actually grabs the representative
hCard of the input URI, which makes it a little redundant operation,
since we could simply pass on the current tab URI to the transformer.
Still with me?
What I'd really like to do is pass on only the representative hCard to
the transformer which outputs the vCard. I realize this is a grey area
between what the document can offer and what the parser can do with that
document, but, I know the latter is less of a concern.
So, I think there are some options which could make this fun extension a
bit better, but, I'd love to hear other possibilities.
* Passing the hCard object as a data: URI to the hCard to vCard
transformer using Brian Suda's X2V [4] (suggested by Tantek Çelik). This
however hits the HTTP GET length limit. Are there are any transformers
that can do this via HTTP POST?
* We can also output a copy of the representative hCard to a temporary
file on a server, then point the parser at the temporary file. Could use
a pastebin even (suggested by Toby Inkster). A little inconvenient, but,
possible.
* Probably the simplest solution that I can think of is to insert an @id
on the vCard node (if there isn't one already) on the fly with the
Jetpack script and send over the URI with a fragment identifier to the
transformer. The problem is that the '.vcard .uri.url[rel=me]' href
value might not be the same as the current URI + fragment identifier.
However, if I'm not mistaken '.vcard .uri.url[rel=me]' href value points
to the current URI as a representative hCard, so, it may be okay. Do you
see any issues with that?
All feedback more than welcome.
-Sarven
[0] https://jetpack.mozillalabs.com/
[1] http://csarven.ca/labs/jetpack/representative-hcard.php
[2] http://identi.ca/csarven
http://tantek.com
http://brigitteschuster.com
http://www.more.ca/my_more/user/JennGruden
[3] http://srv.buzzword.org.uk/representative-hcard-to-vcard.cgi?uri=
[4] http://suda.co.uk/projects/microformats/hcard/get-contact.php?uri=
More information about the microformats-discuss
mailing list