Skip to content

Instantly share code, notes, and snippets.

@erodozer
Created February 11, 2014 22:53
Show Gist options
  • Save erodozer/8946003 to your computer and use it in GitHub Desktop.
Save erodozer/8946003 to your computer and use it in GitHub Desktop.
Make reading the news more fun! http://xkcd.com/1288/
// ==UserScript==
// @name XKCD Subtitutions
// @namespace xkcd
// @description Make reading the new more fun! http://xkcd.com/1288/
// @include http://news.yahoo.com/*
// @include http://news.google.com/*
// @include http://*.cnn.com/*
// @include http://*.nbc.com/*
// @include http://arstechnica.com/*
// @version 1
// @grant none
// ==/UserScript==
var subtitutions = {
"witnesses" : "these dudes I know",
"allegedly" : "kinda probably",
"new study" : "tumblr post",
"rebuild" : "avenge",
"space" : "spaaace",
"google glass" : "virtual boy",
"smartphone" : "pokedex",
"electric" : "atomic",
"senator" : "elf-lord",
"car" : "cat",
"election" : "eating contest",
"congressional leaders" : "river spirits",
"homeland security" : "Homestar Runner",
"could not be reached for comment" : "is guilty and everyone knows it"
};
//perform replacement operation within the page
var body = document.body;
var html = body.innerHTML;
for (var sub in subtitutions){
var rep = subtitutions[sub];
var reg = new RegExp(sub, "gi");
html = html.replace(reg, rep);
}
body.innerHTML = html;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment