forked from neskie/secwepemc-facebook
-
Notifications
You must be signed in to change notification settings - Fork 11
/
secwepemctsin-fb.js
218 lines (201 loc) · 6.91 KB
/
secwepemctsin-fb.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
211
212
213
214
215
216
217
218
// 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 "Secwepemctsin Facebook", and click Uninstall.
//
// --------------------------------------------------------------------
//
// ==UserScript==
// @name Secwepemctsin Facebook
// @namespace http://neskiemanuel.ath.cx/projects/greasemonkey/
// @description script to change the Facebook
// @include http://www.facebook.com/*
// ==/UserScript==
//Array of words to change.
var es = new Array();
es["Home"] = "Tsitcw";
es["No"] = "Tá7a";
es["Yes"] = "Mé7e";
es["Maybe"] = "Héqe";
es["News Feed"] = "Lexeyem";
es["Friends"] = "Kweselkten";
es["Like"] = "Xwexwisten";
es["Books"] = "Speqpeqwél̓tcw";
es["Female"] = "Núxwenxw";
es["Male"] = "Sqélemcw";
es["Say hello."] = "Say weytk.";
es["Say hi."] = "Say weytk.";
es["on Friday."] = "ne Stselkstésq̓t.";
es["on Saturday."] = "ne Stekmekstesq̓t.";
es["Tomorrow"] = "Pexwéyt";
es["Today"] = "Pyin Te Sitqt";
es["Yesterday"] = "Le pexwéyt";
es["What are you planning?"] = "Me7 Stém̓i ke7 tsuwet?";
es["Where?"] = "T̓hé7e?";
es["Mobile Phone"] = "K̓woyí7se T̓e Xqweltálkweten";
es["Phone"] = "Xqweltálkweten";
es["Children:"] = "Stsmelt:";
es["Birthday:"] = "Me7 Le7es Ke Sitqt:";
es["See All"] = "Wikts r Xwexweyt";
es["Who's invited?"] = "Swéti7?";
es["What's on your mind?"] = "Stém̓i ke7 petínesme?";
es["October"] = "Pesllwélsten";
es["This Month"] = "Yi7éne r megce";
//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);