-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalyrian.user.js
212 lines (192 loc) · 6.53 KB
/
valyrian.user.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
// Valyrian Facebook v 9000
// Compiled by Rhaegar Littauer | @LearnValyrian
// Translated by @LearnValyrian
// No (c) on anything, whatsoever.
// https://github.com/RichardLitt/keypuk-ninavi
//
// Based on:
// Secwepemc Facebook!
// version 0.1 BETA!
// 2010-08-25
// Copyright (c) 2010, Neskie Manuel
// Released under the GPL license
// http://www.gnu.org/copyleft/gpl.html
//
// --------------------------------------------------------------------
//
// This is a Greasemonkey user script. To install it, you need
// Greasemonkey 0.3 or later: http://greasemonkey.mozdev.org/
// Then restart Firefox and revisit this script.
// Under Tools, there will be a new menu item to "Install User Script".
// Accept the default configuration and install.
//
// To uninstall, go to Tools/Manage User Scripts,
// select "Dothraki Facebook", and click Uninstall.
//
// To install on Chrome, just drag it into a window. It'll work.
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name Valyrian Facebook
// @namespace https://github.com/RichardLitt/keypuk-ninavi
// @description script to change the Facebook
// @include http://www.facebook.com/*
// @include https://www.facebook.com/*
// ==/UserScript==
// Array of words to change.
// Section: Unsorted
var es = new Array();
es["English (US)"] = "Valyrian";
es["English (UK)"] = "Valyrian";
es["Like"] = "Valar morghulis";
es["Comment"] = "Valar dohaeris";
es["Unlike"] = "Valar dohaeris";
es["dragonfire"] = "dracarys";
es["Brother"] = "Valonqar";
es["wise"] = "maegi";
//Basic Tag altering.
function translate_tag(tag) {
var fbelem = document.getElementsByTagName(tag);
for (var i = 0; i < fbelem.length; i++) {
var thisElem = fbelem[i];
if (thisElem.textContent in es) {
thisElem.textContent = es[thisElem.textContent];
}
}
}
//Basic Tag altering.
function translate_class(classname) {
var fbelem = document.getElementsByClassName(classname);
for (var i = 0; i < fbelem.length; i++) {
var thisElem = fbelem[i];
if (thisElem.textContent in es) {
thisElem.textContent = es[thisElem.textContent];
}
}
}
function loadSecwepemc() {
translate_tag('a');
translate_tag('th');
translate_tag('td');
translate_tag('span');
translate_tag('h3');
translate_tag('dt');
translate_class('ego_social_context');
var fbelem = document.getElementsByTagName('input');
for (var i = 0; i < fbelem.length; i++) {
var thisElem = fbelem[i];
if (thisElem.getAttribute('placeholder') in es) {
thisElem.setAttribute('placeholder',es[thisElem.getAttribute('placeholder')]);
}
if (thisElem.getAttribute('value') in es) {
thisElem.setAttribute('value',es[thisElem.getAttribute('value')]);
}
}
var fbelem = document.getElementsByTagName('textarea');
for (var i = 0; i < fbelem.length; i++) {
var thisElem = fbelem[i];
if (thisElem.getAttribute('placeholder') in es) {
thisElem.setAttribute('placeholder',es[thisElem.getAttribute('placeholder')]);
}
if (thisElem.getAttribute('title') in es) {
thisElem.setAttribute('title',es[thisElem.getAttribute('title')]);
}
if (thisElem.textContent in es) {
thisElem.textContent = es[thisElem.textContent];
}
}
// var fbelem = document.getElementsByClassName('UIImageBlock_Content UIImageBlock_ICON_Content');
// for (var i = 0; i < fbelem.length; i++) {
// var thisElem = fbelem[i];
// //finds if one person likes this.
// if (thisElem.textContent.match('likes this.')){
// icon = thisElem.childNodes[0]
// link = thisElem.childNodes[1]
// link.textContent = link.textContent.replace('likes this.', 'r xwexwistes.');
// thisElem.textContent = '';
// thisElem.appendChild(icon);
// thisElem.appendChild(link);
// }
// if (thisElem.textContent.match('like this.')){
// icon = thisElem.childNodes[0]
// link = thisElem.childNodes[1]
// link.textContent = link.textContent.replace('like this.', 'r xwexwistep.');
// thisElem.textContent = '';
// thisElem.appendChild(icon);
// thisElem.appendChild(link);
// }
// }
var fbelem = document.getElementsByTagName('h2');
for (var i = 0; i < fbelem.length; i++) {
var thisElem = fbelem[i];
if (thisElem.textContent in es) {
icon = thisElem.childNodes[0]
thisElem.textContent = es[thisElem.textContent];
thisElem.appendChild(icon);
}
}
}
loadSecwepemc();
function changedNode(e) {
translate_tag('a');
translate_tag('th');
translate_tag('td');
translate_tag('span');
translate_tag('h3');
translate_tag('dt');
translate_class('ego_social_context');
var fbelem = e.target.getElementsByTagName('input');
for (var i = 0; i < fbelem.length; i++) {
var thisElem = fbelem[i];
if (thisElem.getAttribute('placeholder') in es) {
thisElem.setAttribute('placeholder',es[thisElem.getAttribute('placeholder')]);
}
if (thisElem.getAttribute('value') in es) {
thisElem.setAttribute('value',es[thisElem.getAttribute('value')]);
}
}
var fbelem = e.target.getElementsByTagName('textarea');
for (var i = 0; i < fbelem.length; i++) {
var thisElem = fbelem[i];
if (thisElem.getAttribute('placeholder') in es) {
thisElem.setAttribute('placeholder',es[thisElem.getAttribute('placeholder')]);
}
if (thisElem.getAttribute('title') in es) {
thisElem.setAttribute('title',es[thisElem.getAttribute('title')]);
}
if (thisElem.textContent in es) {
thisElem.textContent = es[thisElem.textContent];
}
}
// var fbelem = e.target.getElementsByClassName('UIImageBlock_Content UIImageBlock_ICON_Content');
// for (var i = 0; i < fbelem.length; i++) {
// var thisElem = fbelem[i];
// //finds if one person likes this.
// if (thisElem.textContent.match('likes this.')){
// icon = thisElem.childNodes[0]
// link = thisElem.childNodes[1]
// link.textContent = link.textContent.replace('likes this.', 'r xwexwistes.');
// thisElem.textContent = '';
// thisElem.appendChild(icon);
// thisElem.appendChild(link);
// }
// if (thisElem.textContent.match('like this.')){
// cnodes = thisElem.childNodes;
// for (var j = 0; j < cnodes.length; j++){
// cnode = cnodes[j];
// thisElem.appendChild(cnode);
// }
// }
// }
var fbelem = e.target.getElementsByTagName('h2');
for (var i = 0; i < fbelem.length; i++) {
var thisElem = fbelem[i];
if (thisElem.textContent in es) {
icon = thisElem.childNodes[0]
thisElem.textContent = es[thisElem.textContent];
thisElem.appendChild(icon);
}
}
}
document.addEventListener('DOMNodeInserted', changedNode, false);