-
Notifications
You must be signed in to change notification settings - Fork 0
/
content.js
56 lines (39 loc) · 1.58 KB
/
content.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
var elements = document.getElementsByTagName('*');
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
for (var j = 0; j < element.childNodes.length; j++) {
var node = element.childNodes[j];
if (node.nodeType === 3) {
var text = node.nodeValue;
var replacedText = text.replace(/Mount Hood|Mount Adams|Mount St. Helens|Mount McKinley|Mount Rainier|Mount Everest/gi, function(w){
switch(w){
case 'Mount Hood':
return 'Wy\'east';
case 'Mount Adams':
return 'Pahto';
case 'Mount St. Helens':
return 'Loowit';
case 'Mount McKinley':
return 'Denali';
case 'Mount Rainier':
return 'Tahoma';
case 'Mount Everest':
return 'Chomolungma';
case 'Mount Baker':
return 'Kulshan';
case 'Mount Shasta':
return 'Uytaahkoo';
case 'Devil\'s Tower':
return 'Bear\'s House';
case 'Harney Peak':
return 'Hinhan Kaga';
case 'Mount Washington':
return 'Agiocochook';
}
});
if (replacedText !== text) {
element.replaceChild(document.createTextNode(replacedText), node);
}
}
}
}