Random and largely pointless GreaseMonkey script

I was archiving old email, and found this gem in my old email. It deserves an explanation:

// ==UserScript==
// @name           Replace Old Fonts
// @namespace      http://dailyrepublicannews.com/
// @description    Workaround for Classic Mac fonts which are needed by legacy apps such as Quark 4.11
// @include        *
// @exclude        http://www.reddit.com/*
// ==/UserScript==

var arElements = document.getElementsByTagName('*');
for (var i = arElements.length - 1; i >= 0; i--) {
    var elm = arElements[i];
    var style = getComputedStyle(elm, '');
    elm.style.fontFamily = style.fontFamily.replace(/myriad/i, 'sans-serif');
    elm.style.fontFamily = style.fontFamily.replace(/helvetica/i, 'sans-serif');
    elm.style.fontFamily = style.fontFamily.replace(/times/i, 'serif');
    elm.style.fontFamily = style.fontFamily.replace(/courier/i, 'monospace');

I used to work at a small-town newspaper. I try to not talk about it too much; it was often a fun job, but like most places these days, you can’t say much about your job. So…yeah. I don’t think I’m risking a lawsuit by posting this, especially since it’s no longer relevant.

Back when I wrote this, we were mostly running OS X 10.4. This was the last release of Mac Classic Mode, we were running a variety of apps that required Classic Mode, and font text encodings changed between 1999 and 2010. :->

We were also using several websites which required more modern features, and the last Tiger release of Firefox was dog slow on older hardware. Thankfully, TenFourFox, an OS X 10.4-optimized build of Firefox 4.0, came onto the scene and saved us from having to find a newer Mac (or, God forbid, a Windows machine) to download stuff.

Unfortunately, TenFourFox didn’t implement all the ugly hacks that Firefox 3 had used to display text correctly, so fonts that weren’t UTF-8 friendly didn’t display right.

One fix would have been to figure out what ugly hacks Firefox 3 was using, and implement them…yeah…no. Or, I could replace the CSS references to certain fonts, and replace them with generic choices. IIRC I had Sans-Serif, Serif, and Monospace typefaces set to DejaVu alternatives to the basic core fonts.

It was ugly, but it worked.

Shane Simmons

Some guy from Southern Illinois