The Pug Automatic

"Helgon.net avatars in user listings" rewritten

Written October 8, 2006. Tagged Greasemonkey, JavaScript, Firefox.

I rewrote my Helgon.net avatars in user listings userscript entirely.

To the uncaring end-user, the difference is probably just increased speed (due to decreased traffic) and possibly decreased fragility (due to better code). Oh, and also that it works – I believe some Helgon.net changes made the previous version occasionally freeze Firefox of late.

Under the hood, things are a lot more maintainable and a lot less embarrassing.

Cached data is now stored as a serialized hash in a single GM_get/setValue slot, rather than in one slot each. This might improve Firefox's load time.

Previously, only valid avatars were stored, and the script didn't learn not to re-attempt to find avatars for users who had none, or who had default (uninteresting) avatars. The rewritten script will cache a timestamp in place of an URL for those dull souls, and will only re-attempt to find an avatar for them after some time has passed (by default, six hours).

This obviously reduces traffic quite a bit, which means increased speed and a happier Helgon.net crew (who, by the way, allegedly have an un-enforceable blanket ban on "scripts", which seems to also include client-side CSS modifications – read and weep, if you have a session).

A final major change is that instead of making a HTTP HEAD request for each cached avatar upon retrieval to check that it hasn't been removed or replaced, re-retrieval is now triggered by the error event on the avatar image object.