XKCD Substitution

XKCD 1288

In a NewsBlur comment on this XKCD strip, someone suggested there should be a Chrome extension to make it so. That’s a bit beyond my Friday morning procrastination, but a bookmarklet isn’t.

Drag this link to the bookmarks bar: XKCD Sub

Then click it whenever you want to update whatever page you’re on with the suggested substitutions. This page should be as good a testbed to confirm it’s working as any, since these are all of the substitutions the bookmarklet applies. Don’t click it on the page, though, since it’ll apply the substitutions to the bookmarklet’s javascript and then it won’t do much of anything.

Witness – this dude I know
witness – This dude I know
Witnesses – These dudes I know
witnesses – these dudes I know
Allegedly – kinda probably
allegedly – kinda probably
New study – Tumblr post
new study – Tumblr post
Rebuild – Avenge
rebuild – avenge
Space – Spaaace
space – spaaace
google glass – Virtual Boy
Google Glass – Virtual Boy
Smartphone – Pokédex
smartphone – Pokédex
Electric – Atomic
electric – atomic
Senator – Elf-Lord
senator – Elf-Lord
Car – Cat
car – cat
Election – Eating contest
election – eating contest
Congressional leader – River spirit
congressional leader – river spirit
Homeland Security – Homestar Runner
homeland security – Homestar Runner
Could not be reached for comment – Is guilty and everyone knows it
could not be reached for comment – is guilty and everyone knows it

Nothing fancy here, just brute string/replace.

javascript: function xkcd_subsitute() {
var d=document,b=d.body;
if(!b) { throw(0); }

var oldText=new Array(‘Witness’,’witness’,’Witnesses’,’witnesses’,’Allegedly’,’allegedly’,’New study’,’new study’,’Rebuild’,’rebuild’,’Space’,’space’,’google glass’,’Google Glass’,’Smartphone’,’smartphone’,’Electric’,’electric’,’Senator’,’senator’,’Car’,’car’,’Election’,’election’,’Congressional leader’,’congressional leader’,’Homeland Security’,’homeland security’,’Could not be reached for comment’,’could not be reached for comment’);
var newText=new Array(‘this dude I know’,’This dude I know’,’These dudes I know’,’these dudes I know’,’Kinda probably’,’kinda probably’,’Tumblr post’,’Tumblr post’,’Avenge’,’avenge’,’Spaaace’,’spaaace’,’Virtual Boy’,’Virtual Boy’,’Pokédex’,’Pokédex’,’Atomic’,’atomic’,’Elf-Lord’,’Elf-Lord’,’Cat’,’cat’,’Eating contest’,’eating contest’,’River spirit’,’river spirit’,’Homestar Runner’,’Homestar Runner’,’Is guilty and everyone knows it’,’is guilty and everyone knows it’);

for(var i=0;i<oldText.length;i++) {
var re = new RegExp(‘\\b’+oldText[i],’g’);
}catch (e) {}

And, three hours later, someone else’s written a Chrome extension.