Add Gravatar Everywhere

Last update on Jul 25, 2008

This script searches through the page looking for <a href="mailto:"/> links and adds a 16x16 gravatar.com image. Works great for Bugzilla. :-)




You could comment on this script if you were logged in.

7 comments Feed-icon

1 point
login to vote
docwhat script's author
Posted Jul 25, 2008

Everytime I click "install this script" it blows away all the exceptions I add to the script. Is there a way to update a script without blowing away the exceptions? Other than cut-and-paste, I mean.

1 point
login to vote
docwhat script's author
Posted Jul 25, 2008

Good catch nazgullien and jdub! I have fixed the source. :-)

1 point
login to vote
jdub user
Posted Jul 24, 2008

@nazgullien: Change line 293 to read:

var email = el.href.replace(/^mailto:/, '').replace(/\?.*$/, ''),

@docwhat: Please consider the above for inclusion in future versions of this script. :-)

1 point
login to vote
nazgullien user
Posted Jun 27, 2008

Hi !

Nice idea !
There is a problem when mailto: links contain

?subject=[...]
parameters, the md5sum computing includes
?subject=[...]
and is erroenous.

example found :

<a href="mailto:contact@site.com?subject=Contact">

Bye !

1 point
login to vote
docwhat script's author
Posted Jun 25, 2008

esquifit:

I didn't realize that GM had a storage mechanism. I was caching in-page, but not across pages. Nifty! Thanks for telling me.

I'm not sure storing images is worth it. :-/ I'll think about.

This was actually written as a proof of concept for an "add gravatars" Bugzilla extension. I realized this could work pretty much anywhere and so I made a few tiny changes and submitted it here.

Ciao!

1 point
login to vote
esquifit scriptwright
Posted Jun 24, 2008

Nice idea. I have a couple of suggestions:
1) Cache the mail addresses in order to avoid calculating the md5 multiple times(and making repeated requests to gravavtar.com, although Firefox should handle this already)
2) Cache the images themselves as base64-encoded strings via GM_set/getValue. The current date can also be cached so you can force a new request to gravatars.com in case the cached image is older than, say, one month.

Incidentally this would be highly reusable code. Consider making a library (for caching serialized objects up to a given amount of time) now that GM supports it natively.

1 point
login to vote
docwhat script's author
Posted Jun 24, 2008

I didn't add any include sites, since you will probably want to decide when you want it turned on.

Works great for Bugzilla.

You could comment on this script if you were logged in.