forked from michalkow/xkcd-substitutions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsubstitutions.js
27 lines (24 loc) · 1.26 KB
/
substitutions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function xkcdSubstitutions(){
var words = [
{find: new RegExp('\\bwitnesses\\b', 'gi'), replace: 'these dudes I know'},
{find: new RegExp('\\ballegedly\\b', 'gi'), replace: 'kinda probably'},
{find: new RegExp('\\bnew study\\b', 'gi'), replace: 'tumblr post'},
{find: new RegExp('\\brebuild\\b', 'gi'), replace: 'avenge'},
{find: new RegExp('\\bspace\\b', 'gi'), replace: 'spaaace'},
{find: new RegExp('\\bgoogle glass\\b', 'gi'), replace: 'virtual boy'},
{find: new RegExp('\\bsmartphone\\b', 'gi'), replace: 'Pokédex'},
{find: new RegExp('\\belectric\\b', 'gi'), replace: 'atomic'},
{find: new RegExp('\\bsenator\\b', 'gi'), replace: 'elf-lord'},
{find: new RegExp('\\bcar\\b', 'gi'), replace: 'cat'},
{find: new RegExp('\\belection\\b', 'gi'), replace: 'eating contest'},
{find: new RegExp('\\bcongressional leaders\\b', 'gi'), replace: 'river spirits'},
{find: new RegExp('\\bhomeland security\\b', 'gi'), replace: 'homestar runner'},
{find: new RegExp('\\bcould not be reached for comment\\b', 'gi'), replace: 'is guilty and everyone knows it'},
];
var html = document.body.innerHTML;
for (var i = 0; i < words.length; i++) {
html = html.replace(words[i].find, words[i].replace);
};
return html;
}
document.body.innerHTML=xkcdSubstitutions();