I did some fine-tuning. If you’re reading this in a browser rather than a feedreader, there’s a little picture in the margin that changes every so often; clicking on it teleports you into the archives. It should work better now and even tells you where it’ll take you. If I broke anything, do please let me know. It’s simultaneously brutally-minimalist and slightly-AJAXy, some geeks might be amused at the details.
The way it used to work was brutal, involving running an ed
script over an .htaccess
file (not kidding, blush).
Not only was this kludgy but sometimes, if you clicked the picture after being
parked on the page for a while, it’d send you to the wrong place.
Plus there was zero indication for the user of where they’d be going.
I wanted the picture link to be stable and simple, with no redirect voodoo, and I wanted an image title and mouse-over. It’s not a big deal but it’s been rattling around the back of my head for a year or more, this afternoon I had an idea and now it’s better.
Now of course, there are lots of easy ways to automate this kind of thing, but they all involve run-time databases and templates and other kinds of things that break under pressure and we hates them, my precioussssss, yes we does. The ongoing run-time is entirely based, and will remain entirely based, on fetching static data out of the filesystem. I accept that I may be be a little unreasonable on this subject, but there you go. The *n*x filesystem is generally-under-appreciated and under-used, and I can take this puppy quite a bit further without stepping outside its confines.
So, there’s a batch job that runs every now and then and switches in a new
thumbnail and writes a little XML file with a label and URL for it.
Then there’s a little onLoad
script that uses an
XMLHttpRequest
to fetch the XML and does some DOM walking and
patching, and there you have it.
Hmm, I seem to remember telling the world that inventing XML tags is
bad and so is serving it as application/xml
, and here I am doing
both those things. Seems to work great. Hmm.
Here’s the funny bit; I tested it in Safari and Firefox and got it working and pushed the “ship” button, then realized I’d forgotten to test in Win/IE. Furthermore, there’s no such box in my office. Oops. Double oops. Fortunately Eve Maler was online and had a Windows box nearby, with a rarely-used IE on it, and it turned out to be OK. Anyhow, do please try the mouse-over and if it upsets your browser, do let me know.