]> git.rmz.io Git - dotfiles.git/blob - dwb/greasemonkey/ponyhoof.user.js
add rules and autostart for "dwb -r social"
[dotfiles.git] / dwb / greasemonkey / ponyhoof.user.js
1 // ==UserScript==
2 // @name Ponyhoof
3 // @namespace http://www.facebook.com/ponyhoof
4 // @run-at document-start
5 // @version 1.651
6 // @installURL https://hoof.little.my/files/ponyhoof.user.js
7 // @updateURL https://hoof.little.my/files/ponyhoof.meta.js
8 // @icon https://hoof.little.my/files/app32.png
9 // @icon64 https://hoof.little.my/files/icon64.png
10 // @description Ponify Facebook and make it 20% cooler!
11 // @author The Ponyhoof Team <pony@little.my> http://ponyhoof.little.my
12 // @developer Ng Yik Phang
13 // @contributor James
14 // @contributor http://ponyhoof.little.my/credits
15 // @homepage http://ponyhoof.little.my
16 // @supportURL https://www.facebook.com/Ponyhoof
17 // @contributionURL http://ponyhoof.little.my/donate
18 // @include http://*.facebook.com/*
19 // @include https://*.facebook.com/*
20 // @include http://*.little.my/*
21 // @include https://*.little.my/*
22 // @match http://*.facebook.com/*
23 // @match https://*.facebook.com/*
24 // @match http://*.little.my/*
25 // @match https://*.little.my/*
26 // @exclude http://*.facebook.com/ai.php*
27 // @exclude http://*.facebook.com/l.php*
28 // @exclude http://*.facebook.com/ajax/*
29 // @exclude http://*.channel.facebook.com/*
30 // @exclude http://static.*.facebook.com/*
31 // @exclude http://graph.facebook.com/*
32 // @exclude http://0.facebook.com/*
33 // @exclude https://*.facebook.com/ai.php*
34 // @exclude https://*.facebook.com/l.php*
35 // @exclude https://*.facebook.com/ajax/*
36 // @exclude https://*.channel.facebook.com/*
37 // @exclude https://s-static.*.facebook.com/*
38 // @exclude https://graph.facebook.com/*
39 // @exclude https://0.facebook.com/*
40 // @exclude https://paste.little.my/*
41 // ==/UserScript==
42
43 /*******************************************************************************
44 * Please visit http://jointheherd.lttle.my for the official install!
45 *******************************************************************************/
46
47
48 (function() {
49 if (typeof WScript !== 'undefined' && typeof window === 'undefined') {
50 WScript.echo("Ponyhoof is not run by double-clicking a file in Windows.\n\nPlease visit http://jointheherd.little.my for proper installation.");
51 WScript.quit(1);
52 }
53
54 if (window.location.hostname.indexOf('facebook.com') == -1 && window.location.hostname.indexOf('little.my') == -1) {
55 return;
56 }
57
58 /**
59 * Hoof Framework
60 *
61 * @author ngyikp (http://www.facebook.com/ngyikp)
62 */
63 var d = document, w = window;
64 var ELEMENT_NODE = 1;
65 var TEXT_NODE = 3;
66
67 var SIG = '[Hoof Framework]';
68 var FRIENDLYNAME = 'Hoof Framework';
69 var CANLOG = true;
70
71 var userSettings = {};
72
73 var USERAGENT = w.navigator.userAgent.toLowerCase();
74 var ISOPERABLINK = /OPR\//.test(w.navigator.userAgent);
75 var ISOPERA = !ISOPERABLINK && (typeof opera != 'undefined' || /opera/i.test(USERAGENT));
76 var ISCHROME = !ISOPERABLINK && (typeof chrome != 'undefined' || /chrome/i.test(USERAGENT));
77 var ISFIREFOX = /firefox/i.test(USERAGENT);
78 var ISSAFARI = !ISOPERABLINK && !ISCHROME && /safari/i.test(USERAGENT);
79 var ISMOBILE = /iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(USERAGENT);
80
81 // R.I.P. unsafeWindow in Chrome 27+ http://crbug.com/222652
82 if (typeof unsafeWindow == 'undefined') {
83 var USW = w;
84 } else {
85 var USW = unsafeWindow;
86 }
87
88 function log(msg) {
89 if (CANLOG) {
90 if (typeof console !== 'undefined' && console.log) {
91 console.log(SIG + ' ' + msg);
92 }
93 }
94 }
95
96 function dir(msg) {
97 if (CANLOG) {
98 if (typeof console !== 'undefined' && console.dir) {
99 console.dir(SIG + ' ' + msg);
100 }
101 }
102 }
103
104 function debug(msg) {
105 if (CANLOG) {
106 if (typeof console !== 'undefined') {
107 if (console.debug) {
108 console.debug(SIG + ' ' + msg);
109 } else if (console.log) {
110 console.log(SIG + ' ' + msg);
111 }
112 }
113 }
114 }
115
116 function info(msg) {
117 if (CANLOG) {
118 if (typeof console !== 'undefined') {
119 if (console.info) {
120 console.info(SIG + ' ' + msg);
121 } else if (console.log) {
122 console.log(SIG + ' ' + msg);
123 }
124 }
125 }
126 }
127
128 function warn(msg) {
129 if (CANLOG) {
130 if (typeof console !== 'undefined') {
131 if (console.warn) {
132 console.warn(SIG + ' ' + msg);
133 } else if (console.log) {
134 console.log(SIG + ' ' + msg);
135 }
136 }
137 }
138 }
139
140 function error(msg) {
141 if (CANLOG) {
142 if (typeof console !== 'undefined') {
143 if (console.error) {
144 console.error(SIG + ' ' + msg);
145 } else if (console.log) {
146 console.log(SIG + ' ' + msg);
147 }
148 }
149 }
150 }
151
152 function trace() {
153 if (CANLOG) {
154 if (typeof console !== 'undefined' && console.trace) {
155 console.trace();
156 }
157 }
158 }
159
160 function $(id) {
161 return d.getElementById(id);
162 }
163
164 function randNum(min, max) {
165 return min + Math.floor(Math.random() * (max - min + 1));
166 }
167
168 function hasClass(ele, c) {
169 if (!ele) {
170 return false;
171 }
172 if (ele.classList) {
173 return ele.classList.contains(c);
174 }
175
176 var regex = new RegExp("(^|\\s)"+c+"(\\s|$)");
177 if (ele.className) { // element node
178 return (ele.className && regex.test(ele.className));
179 } else { // string
180 return (ele && regex.test(ele));
181 }
182 }
183
184 function addClass(ele, c) {
185 if (ele.classList) {
186 ele.classList.add(c);
187 } else if (!hasClass(ele, c)) {
188 ele.className += ' '+c;
189 }
190 }
191
192 function removeClass(ele, c) {
193 if (ele.classList) {
194 ele.classList.remove(c);
195 } else {
196 ele.className = ele.className.replace(new RegExp('(^|\\s)'+c+'(?:\\s|$)','g'),'$1').replace(/\s+/g,' ').replace(/^\s*|\s*$/g,'');
197 }
198 }
199
200 function toggleClass(ele, c) {
201 if (hasClass(ele, c)) {
202 removeClass(ele, c);
203 } else {
204 ele.className += ' ' + c;
205 }
206 }
207
208 function clickLink(el) {
209 if (!el) {
210 return false;
211 }
212
213 var evt = d.createEvent('MouseEvents');
214 evt.initMouseEvent('click', true, true, USW, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
215 el.dispatchEvent(evt);
216 return true;
217 }
218
219 function cookie(n) {
220 try {
221 return unescape(d.cookie.match('(^|;)?'+n+'=([^;]*)(;|$)')[2]);
222 } catch (e) {
223 return null;
224 }
225 }
226
227 function injectManualStyle(css, id) {
228 if ($('ponyhoof_style_'+id)) {
229 return $('ponyhoof_style_'+id);
230 }
231
232 var n = d.createElement('style');
233 n.type = 'text/css';
234 if (id) {
235 n.id = 'ponyhoof_style_'+id;
236 }
237 n.textContent = '/* '+SIG+' */'+css;
238
239 if (d.head) {
240 d.head.appendChild(n);
241 } else if (d.body) {
242 d.body.appendChild(n);
243 } else {
244 d.documentElement.appendChild(n);
245 }
246
247 return n;
248 }
249
250 function fadeOut(ele, callback) {
251 addClass(ele, 'ponyhoof_fadeout');
252
253 w.setTimeout(function() {
254 ele.style.display = 'none';
255
256 if (callback) {
257 callback(ele);
258 }
259 }, 250);
260 }
261
262 function getFbDomain() {
263 if (w.location.hostname == 'beta.facebook.com') {
264 return w.location.hostname;
265 }
266 return 'www.facebook.com';
267 }
268
269 function onPageReady(callback) {
270 var _loop = function() {
271 if (/loaded|complete/.test(d.readyState)) {
272 callback();
273 } else {
274 w.setTimeout(_loop, 100);
275 }
276 };
277 _loop();
278 }
279
280 var loopClassName = function(name, func) {
281 var l = d.getElementsByClassName(name);
282 if (l) {
283 for (var i = 0, len = l.length; i < len; i++) {
284 func(l[i]);
285 }
286 }
287 };
288
289 function $$(parent, query, func) {
290 if (!parent) {
291 return;
292 }
293 var l = parent.querySelectorAll(query);
294 if (l.length) {
295 for (var i = 0, len = l.length; i < len; i++) {
296 func(l[i]);
297 }
298 }
299 }
300
301 // Hacky code adapted from http://www.javascripter.net/faq/browsern.htm
302 function getBrowserVersion() {
303 var ua = w.navigator.userAgent;
304 var fullVersion = ''+parseFloat(w.navigator.appVersion);
305 var majorVersion = parseInt(w.navigator.appVersion, 10);
306 var nameOffset, offset, ix;
307
308 if (ua.indexOf('Opera') != -1) {
309 // In Opera, the true version is after 'Opera' or after 'Version'
310 offset = ua.indexOf('Opera');
311 fullVersion = ua.substring(offset + 6);
312
313 if (ua.indexOf('Version') != -1) {
314 offset = ua.indexOf('Version');
315 fullVersion = ua.substring(offset + 8);
316 }
317 } else if (ua.indexOf('OPR/') != -1) {
318 offset = ua.indexOf('OPR/');
319 fullVersion = ua.substring(offset + 4);
320 } else if (ua.indexOf('MSIE') != -1) {
321 // In MSIE, the true version is after 'MSIE' in userAgent
322 offset = ua.indexOf('MSIE');
323 fullVersion = ua.substring(offset + 5);
324 } else if (ua.indexOf('Chrome') != -1) {
325 // In Chrome, the true version is after 'Chrome'
326 offset = ua.indexOf('Chrome');
327 fullVersion = ua.substring(offset + 7);
328 } else if (ua.indexOf('Safari') != -1) {
329 // In Safari, the true version is after 'Safari' or after 'Version'
330 offset = ua.indexOf('Safari');
331 fullVersion = ua.substring(offset + 7);
332
333 if (ua.indexOf('Version') != -1) {
334 offset = ua.indexOf('Version');
335 fullVersion = ua.substring(offset + 8);
336 }
337 } else if (ua.indexOf('Firefox') != -1) {
338 // In Firefox, the true version is after 'Firefox'
339 offset = ua.indexOf('Firefox');
340 fullVersion = ua.substring(offset + 8);
341 } else {
342 throw "Unsupported browser";
343 }
344
345 if ((ix = fullVersion.indexOf(';')) != -1) {
346 fullVersion = fullVersion.substring(0, ix);
347 }
348 if ((ix = fullVersion.indexOf(' ')) != -1) {
349 fullVersion = fullVersion.substring(0, ix);
350 }
351
352 majorVersion = parseInt(''+fullVersion,10);
353 if (isNaN(majorVersion)) {
354 fullVersion = ''+parseFloat(w.navigator.appVersion);
355 majorVersion = parseInt(w.navigator.appVersion,10);
356 }
357
358 return {
359 major: majorVersion
360 ,full: fullVersion
361 };
362 }
363
364 // http://wiki.greasespot.net/Content_Script_Injection
365 var contentEval = function(source, arg) {
366 var arg = arg || {};
367 if (typeof source === 'function') {
368 source = '(' + source + ')(' + JSON.stringify(arg) + ');'
369 }
370
371 var script = d.createElement('script');
372 script.textContent = source;
373 d.documentElement.appendChild(script);
374 d.documentElement.removeChild(script);
375 };
376
377 var supportsRange = function() {
378 var i = d.createElement('input');
379 i.setAttribute('type', 'range');
380 return i.type !== 'text';
381 };
382
383 var supportsCssTransition = function() {
384 var s = d.createElement('div').style;
385 return ('transition' in s || 'WebkitTransition' in s || 'MozTransition' in s || 'msTransition' in s || 'OTransition' in s);
386 };
387
388 // Menu
389 var MENUS = {};
390 var Menu = function(id, p) {
391 var k = this;
392
393 k.id = id;
394 MENUS['ponyhoof_menu_'+k.id] = k;
395 k.menu = null; // outer wrap
396 k.selectorMenu = null; // .uiMenu.uiSelectorMenu
397 k.menuInner = null; // .uiMenuInner
398 k.content = null; // .uiScrollableAreaContent
399 k.button = null;
400 k.wrap = null; // ponyhoof_menu_wrap, used to separate button and menu
401
402 k.menuSearch = null; // .ponyhoof_menu_search
403 k.menuSearchInput = null;
404 k.menuSearchNoResults = null;
405 k.focusStealer = null;
406
407 k.hasScrollableArea = false;
408 k.scrollableAreaDiv = null; // .uiScrollableArea
409 k.scrollableArea = null; // FB ScrollableArea class
410
411 k.p = p;
412 k.afterClose = function() {};
413
414 k.canSearch = true;
415 k.alwaysOverflow = false;
416 k.rightFaced = false;
417 k.buttonTextClipped = 0;
418
419 k.createButton = function(startText) {
420 if (!startText) {
421 startText = '';
422 }
423
424 var buttonText = d.createElement('span');
425 buttonText.className = 'uiButtonText';
426 buttonText.innerHTML = startText;
427
428 k.button = d.createElement('a');
429 k.button.href = '#';
430 k.button.className = 'uiButton ponyhoof_button_menu';
431 k.button.setAttribute('role', 'button');
432 k.button.setAttribute('aria-haspopup', 'true');
433 if (k.buttonTextClipped) {
434 k.button.className += ' ponyhoof_button_clipped';
435 buttonText.style.maxWidth = k.buttonTextClipped+'px';
436 }
437 k.button.appendChild(buttonText);
438
439 k.wrap = d.createElement('div');
440 k.wrap.className = 'ponyhoof_menu_wrap';
441 if (k.rightFaced) {
442 k.wrap.className += ' uiSelectorRight';
443 }
444 k.wrap.appendChild(k.button);
445 k.p.appendChild(k.wrap);
446
447 return k.button;
448 }
449
450 k.createMenu = function() {
451 if ($('ponyhoof_menu_'+k.id)) {
452 k.menu = $('ponyhoof_menu_'+k.id);
453 k.menuInner = k.menu.getElementsByClassName('uiMenuInner')[0];
454 return k.menu;
455 }
456
457 k.injectStyle();
458
459 k.menu = d.createElement('div');
460 k.menu.className = 'ponyhoof_menu uiSelectorMenuWrapper';
461 k.menu.id = 'ponyhoof_menu_'+k.id;
462 k.menu.setAttribute('role', 'menu');
463 //k.menu.style.display = 'none';
464 k.menu.addEventListener('click', function(e) {
465 e.stopPropagation();
466 return false;
467 }, false);
468 k.wrap.appendChild(k.menu);
469
470 k.selectorMenu = d.createElement('div');
471 k.selectorMenu.className = 'uiMenu uiSelectorMenu';
472 k.menu.appendChild(k.selectorMenu);
473
474 k.menuInner = d.createElement('div');
475 k.menuInner.className = 'uiMenuInner';
476 k.selectorMenu.appendChild(k.menuInner);
477
478 k.content = d.createElement('div');
479 k.content.className = 'uiScrollableAreaContent';
480 k.menuInner.appendChild(k.content);
481
482 if (k.canSearch) {
483 k.menuSearch = d.createElement('div');
484 k.menuSearch.className = 'ponyhoof_menu_search';
485 k.content.appendChild(k.menuSearch);
486
487 k.menuSearchInput = d.createElement('input');
488 k.menuSearchInput.type = 'text';
489 k.menuSearchInput.className = 'inputtext';
490 k.menuSearchInput.placeholder = "Search";
491 k.menuSearch.appendChild(k.menuSearchInput);
492
493 k.menuSearchNoResults = d.createElement('div');
494 k.menuSearchNoResults.className = 'ponyhoof_menu_search_noResults';
495 k.menuSearchNoResults.textContent = "No results";
496 k.menuSearch.appendChild(k.menuSearchNoResults);
497
498 k.menuSearchInput.addEventListener('keydown', k.searchEscapeKey, false);
499 k.menuSearchInput.addEventListener('input', k.performSearch, false);
500
501 k.focusStealer = d.createElement('input');
502 k.focusStealer.type = 'text';
503 k.focusStealer.setAttribute('aria-hidden', 'true');
504 k.focusStealer.style.position = 'absolute';
505 k.focusStealer.style.top = '-9999px';
506 k.focusStealer.style.left = '-9999px';
507 k.focusStealer.addEventListener('focus', k.focusStealerFocused, false);
508 k.selectorMenu.appendChild(k.focusStealer);
509 }
510
511 return k.menu;
512 };
513
514 k.attachButton = function() {
515 k.button.addEventListener('click', function(e) {
516 k.toggle();
517 e.stopPropagation();
518 e.preventDefault();
519 }, false);
520 };
521
522 k.changeButtonText = function(text) {
523 k.button.getElementsByClassName('uiButtonText')[0].innerHTML = text;
524 k.button.setAttribute('data-ponyhoof-button-orig', text);
525 k.button.setAttribute('data-ponyhoof-button-text', text);
526
527 if (k.buttonTextClipped) {
528 k.button.title = text;
529 }
530 };
531
532 k.createSeperator = function() {
533 var sep = d.createElement('div');
534 sep.className = 'uiMenuSeparator';
535 k.content.appendChild(sep);
536 };
537
538 k.createMenuItem = function(param) {
539 var menuItem = new MenuItem(k);
540 menuItem._create(param);
541
542 k.content.appendChild(menuItem.menuItem);
543
544 return menuItem;
545 };
546
547 k.injectStyle = function() {
548 var css = '';
549 css += 'html .ponyhoof_dialog .ponyhoof_button_menu, .ponyhoof_menuitem_checked {background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAADdCAYAAABNAoDAAAADbElEQVR42u3Xv06aARTG4XN93oYm7eDgakw7OXsD3oBpByevBhRKVVSooIDrKR9TGxOhSRM5n8+T/MKf8C1neUMkAFBeLF5eUpIk1S4W80VKkqTaxXw+T0mSVLuYzeYpSZJqF7PnWUqSpNrF0/NTSpKk2sX0aZqSJKl2MZ0u30iSpHdtZ+90bW89H5PJJCVJ0vu3e3iWRycXr2q+X/dsPD7+SkmStB19/vr9rzFvPm/yXIzH45QkSdvTwfH5asyb102fifFo+UaSJG1VqzH/h9/HaPSQkiSpdvFwf5+SJKl2cXd3l5IkqXYxHA5TkiTVLm5vb1OSJNUurm9uUpIk1S6ur3+mJEmqXQwGg5QkSbWLH/1+SpKk2kW/30tJklS76F31UpIk1S6uLi9TkiTVLrrdbkqSpNpFp9NJSZJUO4MuSZJBlyRJBl2SJBl0SZJk0CVJMuiSJMmgS5Ikgy5Jkgy6JEkGXZIkGXRJkmTQJUmSQZckyaBLkiSDLkmSDLokSTLokiQZdEmSZNAlSZJBlyRJBl2SpPYPOgAAAAAAAAAAAAAAAAAAAAAAAAD/WW7AlQCg+Ki7DgAUH3VXAYDio+4aAFB81F0BAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD4cHb2TnNdrgQABewenuXRycWrmu9dBwAK+fTl2+TPMW8+uwoAFHRwfL4a8+bVNQCg+Ki7AgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAW29/fz9dAQCKj7lBB4AWjLlBB4BC423MAaAl/8aNOQC0YNCNOQC0aNRdAwCKj7orAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwBq55AoAUHzMDToAtGDMDToAFBpvYw4ALfk3bswBoAWDbswBoEWj7hoAUHzUXQEAAAAAAN7yG6s7d/s7eB9vAAAAAElFTkSuQmCC") !important;background-repeat:no-repeat;-webkit-background-size:500px 221px;-moz-background-size:500px 221px;background-size:500px 221px;}';
550
551 css += 'html .ponyhoof_dialog .ponyhoof_button_menu {background-position:right 0;padding-right:23px;}';
552 css += 'html .ponyhoof_button_menu:active {background-position:right -98px;}';
553 css += 'html .openToggler .ponyhoof_button_menu {background-color:#6D84B4;background-position:right -49px;border-color:#3B5998;border-bottom-color:#6D84B4;-moz-box-shadow:none;box-shadow:none;}';
554 css += 'html .openToggler .ponyhoof_button_menu .uiButtonText {color:#fff;}';
555
556 css += '.ponyhoof_menu_label {padding:7px 4px 0 0;}';
557 css += '.ponyhoof_menu_label, .ponyhoof_menu_withlabel .ponyhoof_menu_wrap {display:inline-block;}';
558 css += '.ponyhoof_menu_withlabel {margin-bottom:8px;}';
559 css += '.ponyhoof_menu_withlabel + .ponyhoof_menu_withlabel {margin-top:-8px;}';
560 css += '.ponyhoof_menu_withlabel .ponyhoof_button_menu {margin-top:-3px;}';
561 css += '.ponyhoof_menu_labelbreak .ponyhoof_menu_label {display:block;padding-bottom:7px;}';
562
563 css += '.ponyhoof_menu_wrap {position:relative;}';
564 css += 'html .ponyhoof_menu {z-index:1999;display:none;min-width:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;}';
565 css += '.ponyhoof_menu_wrap.openToggler .ponyhoof_menu {display:block;}';
566 css += '.ponyhoof_menu_wrap + .uiButton {margin:4px 0 0 4px;}';
567 css += '.ponyhoof_menu .uiMenu {background:#fff;border:1px solid #777;border-bottom:2px solid #293E6A;color:#000;position:absolute;overflow:auto;overflow-x:hidden;text-align:left;}';
568 css += '.ponyhoof_menu .uiMenu.overflow {resize:vertical;height:200px;min-height:200px;}';
569 css += '.ponyhoof_menu_wrap.uiSelectorRight .uiMenu {left:auto;right:0;}';
570 css += '.ponyhoof_menu .ponyhoof_menu_search {padding:0 3px;margin-bottom:4px;}';
571 css += '.ponyhoof_menu .ponyhoof_menu_search input {width:100%;resize:none;}';
572 css += '.ponyhoof_menu .ponyhoof_menu_search_noResults {display:none;color:#999;text-align:center;margin-top:7px;width:100px;}';
573 css += '.ponyhoof_menuitem {border:solid #fff;border-width:1px 0;color:#111;display:block;font-weight:normal;line-height:16px;padding:1px 22px;text-decoration:none;outline:none;-webkit-user-drag:none;resize:none;}';
574 css += '.ponyhoof_menu .ponyhoof_menuitem {color:#111;}';
575 css += '.ponyhoof_menuitem:hover, .ponyhoof_menuitem:active, .ponyhoof_menuitem:focus {background-color:#6d84b4;border-color:#3b5998;color:#fff;text-decoration:none;}';
576 css += '.ponyhoof_menuitem_checked {background-position:0 -146px;font-weight:bold;}';
577 css += '.ponyhoof_menuitem_checked:hover, .ponyhoof_menuitem_checked:active, .ponyhoof_menuitem_checked:focus {background-position:0 -206px;}';
578 css += '.ponyhoof_menuitem_span {white-space:nowrap;text-overflow:ellipsis;display:inline-block;overflow:hidden;padding-right:16px;max-width:400px;vertical-align:top;}';
579
580 css += '.ponyhoof_button_clipped .uiButtonText {text-overflow:ellipsis;overflow:hidden;}';
581
582 injectManualStyle(css, 'menu');
583 };
584
585 k.open = function() {
586 k.closeAllMenus();
587
588 addClass(k.wrap, 'openToggler');
589
590 if (!hasClass(k.menuInner.parentNode, 'overflow') && (k.menuInner.parentNode.offsetHeight >= 224 || k.alwaysOverflow)) {
591 addClass(k.menuInner.parentNode, 'overflow');
592 }
593
594 if (k.canSearch && !ISMOBILE) {
595 var scrollTop = k.selectorMenu.scrollTop;
596 k.menuSearchInput.focus();
597 k.menuSearchInput.select();
598
599 k.selectorMenu.scrollTop = scrollTop;
600 }
601
602 d.body.addEventListener('keydown', k.documentEscapeKey, false);
603 d.body.addEventListener('click', k.documentClick, false);
604 };
605
606 k.close = function() {
607 if (hasClass(k.wrap, 'openToggler')) {
608 removeClass(k.wrap, 'openToggler');
609 d.body.removeEventListener('keydown', k.documentEscapeKey, false);
610 d.body.removeEventListener('click', k.documentClick, false);
611
612 k.afterClose();
613 }
614 };
615
616 k.closeAllMenus = function() {
617 for (var menu in MENUS) {
618 if (MENUS.hasOwnProperty(menu)) {
619 MENUS[menu].close();
620 }
621 }
622 };
623
624 k.toggle = function() {
625 if (hasClass(k.wrap, 'openToggler')) {
626 k.close();
627 } else {
628 k.open();
629 }
630 };
631
632 k.changeChecked = function(menuItem) {
633 var already = k.menu.getElementsByClassName('ponyhoof_menuitem_checked');
634 if (already.length) {
635 removeClass(already[0], 'ponyhoof_menuitem_checked');
636 }
637 addClass(menuItem.menuItem, 'ponyhoof_menuitem_checked');
638 };
639
640 k.performSearch = function() {
641 var val = k.menuSearchInput.value;
642 var regex = new RegExp(val, 'i');
643
644 var count = 0;
645 $$(k.menu, '.ponyhoof_menuitem', function(menuitem) {
646 if (val == '') {
647 menuitem.style.display = '';
648 return;
649 }
650
651 if (!hasClass(menuitem, 'unsearchable')) {
652 menuitem.style.display = 'none';
653
654 var compare = menuitem.textContent;
655 if (menuitem.getAttribute('data-ponyhoof-menu-searchAlternate')) {
656 compare = menuitem.getAttribute('data-ponyhoof-menu-searchAlternate');
657 }
658
659 if (regex.test(compare)) {
660 menuitem.style.display = 'block';
661 count += 1;
662 }
663 } else {
664 menuitem.style.display = 'none';
665 }
666 });
667
668 $$(k.menu, '.ponyhoof_menu_search_noResults', function(ele) {
669 if (val) {
670 if (!count) {
671 ele.style.display = 'block';
672 } else {
673 ele.style.display = 'none';
674 }
675 } else {
676 ele.style.display = 'none';
677 }
678 });
679
680 $$(k.menu, '.uiMenuSeparator', function(menuitem) {
681 if (val == '') {
682 menuitem.style.display = '';
683 return;
684 }
685
686 menuitem.style.display = 'none';
687 });
688
689 if (k.hasScrollableArea) {
690 k.scrollableArea.poke();
691 }
692 };
693
694 k.searchEscapeKey = function(e) {
695 if (e.which == 27) {
696 if (k.menuSearchInput.value != '') {
697 k.menuSearchInput.value = '';
698 k.performSearch();
699 } else {
700 k.close();
701 if (k.button) {
702 k.button.focus();
703 }
704 }
705 e.stopPropagation();
706 e.cancelBubble = true;
707 }
708 };
709
710 k.documentEscapeKey = function(e) {
711 if (e.which == 27 && hasClass(k.wrap, 'openToggler')) { // esc
712 k.close();
713 e.stopPropagation();
714 e.cancelBubble = true;
715
716 if (k.button) {
717 k.button.focus();
718 }
719 }
720 };
721
722 k.documentClick = function(e) {
723 k.close();
724 e.stopPropagation();
725 e.preventDefault();
726 };
727
728 k.focusStealerFocused = function(e) {
729 if (k.canSearch) {
730 k.menuSearchInput.focus();
731 }
732 };
733 };
734
735 var MenuItem = function(menu) {
736 var k = this;
737
738 k.menuItem = null;
739 k.menu = menu;
740 k.onclick = null;
741
742 k._create = function(param) {
743 k.menuItem = d.createElement('a');
744 k.menuItem.href = '#';
745 k.menuItem.className = 'ponyhoof_menuitem';
746 k.menuItem.setAttribute('role', 'menuitem');
747
748 if (param.check) {
749 k.menuItem.className += ' ponyhoof_menuitem_checked';
750 }
751
752 if (param.data) {
753 k.menuItem.setAttribute('data-ponyhoof-menu-data', param.data);
754 }
755
756 if (param.title) {
757 k.menuItem.setAttribute('aria-label', param.title);
758 k.menuItem.setAttribute('data-hover', 'tooltip');
759 }
760
761 if (param.unsearchable) {
762 k.menuItem.className += ' unsearchable';
763 }
764
765 if (param.searchAlternate) {
766 k.menuItem.setAttribute('data-ponyhoof-menu-searchAlternate', param.searchAlternate);
767 }
768
769 if (param.extraClass) {
770 k.menuItem.className += param.extraClass;
771 }
772
773 k.menuItem.innerHTML = '<span class="ponyhoof_menuitem_span">'+param.html+'</span>';
774
775 if (param.onclick) {
776 k.onclick = param.onclick;
777 }
778 k.menuItem.addEventListener('click', function(e) {
779 e.stopPropagation();
780 if (k.onclick) {
781 k.onclick(k, k.menu);
782 }
783
784 return false;
785 }, false);
786 k.menuItem.addEventListener('dragstart', function() {
787 return false;
788 }, false);
789
790 return k.menuItem;
791 };
792
793 k.getText = function() {
794 return k.menuItem.getElementsByClassName('ponyhoof_menuitem_span')[0].innerHTML;
795 };
796 };
797
798 // Dialog
799 var DIALOGS = {};
800 var DIALOGCOUNT = 400;
801 var Dialog = function(id) {
802 var k = this;
803
804 k.dialog = null;
805 k.generic_dialogDiv = null;
806 k.popup_dialogDiv = null;
807 k.id = id;
808 k.visible = false;
809
810 k.alwaysModal = false;
811 k.noTitle = false;
812 k.noBottom = false;
813
814 k.canCardspace = true;
815 k.cardSpaceTimer = null;
816 k.cardspaced = false;
817
818 k.onclose = function() {};
819 k.onclosefinish = function() {};
820 k.canCloseByEscapeKey = true;
821
822 k.skeleton = '';
823
824 k.create = function() {
825 //if (DIALOGS[k.id]) {
826 // log("Attempting to recreate dialog ID \""+k.id+"\"");
827 // return DIALOGS[k.id].dialog;
828 //}
829
830 //DIALOGS[k.id] = k;
831
832 log("Creating "+k.id+" dialog...");
833
834 k.injectStyle();
835
836 DIALOGCOUNT += 1;
837 k.skeleton = '<!-- '+SIG+' Dialog -->';
838 k.skeleton += '<div class="generic_dialog pop_dialog" role="dialog" style="z-index:'+(DIALOGCOUNT)+';">';
839 k.skeleton += ' <div class="generic_dialog_popup">';
840 k.skeleton += ' <div class="popup">';
841 k.skeleton += ' <div class="wrap">';
842 k.skeleton += ' <h3 title="This dialog is sent from '+FRIENDLYNAME+'"></h3>';
843 k.skeleton += ' <div class="body">';
844 k.skeleton += ' <div class="content clearfix"></div>';
845 k.skeleton += ' <div class="bottom"></div>';
846 k.skeleton += ' </div>'; // body
847 k.skeleton += ' </div>'; // wrap
848 k.skeleton += ' </div>'; // popup
849 k.skeleton += ' </div>'; // generic_dialog_popup
850 k.skeleton += '</div>';
851
852 INTERNALUPDATE = true;
853
854 k.dialog = d.createElement('div');
855 k.dialog.className = 'ponyhoof_dialog';
856 k.dialog.id = 'ponyhoof_dialog_'+k.id;
857 k.dialog.innerHTML = k.skeleton;
858 d.body.appendChild(k.dialog);
859
860 INTERNALUPDATE = false;
861
862 k.generic_dialogDiv = k.dialog.getElementsByClassName('pop_dialog')[0];
863 k.popup_dialogDiv = k.dialog.getElementsByClassName('popup')[0];
864
865 if (k.alwaysModal) {
866 addClass(k.generic_dialogDiv, 'generic_dialog_modal');
867 }
868 if (k.noTitle) {
869 addClass(k.dialog.getElementsByTagName('h3')[0], 'hidden_elem');
870 }
871 if (k.noBottom) {
872 addClass(k.dialog.getElementsByClassName('bottom')[0], 'hidden_elem');
873 }
874
875 k.show();
876
877 return k.dialog;
878 };
879
880 k.injectStyle = function() {
881 var cx = '._6nw';
882 if (d.getElementsByClassName('-cx-PUBLIC-hasLitestand__body').length) {
883 cx = '.-cx-PUBLIC-hasLitestand__body';
884 }
885
886 var css = '';
887 css += '.ponyhoof_message .wrap {margin-top:3px;background:transparent !important;display:block;}';
888 css += '.ponyhoof_message .uiButton.rfloat {margin-left:10px;}';
889
890 css += '.ponyhoof_dialog, .ponyhoof_dialog .body {font-size:11px;}';
891 css += cx+' .ponyhoof_dialog, '+cx+' .ponyhoof_dialog .body {font-size:12px;}';
892 css += '.ponyhoof_dialog iframe {-webkit-user-select:none;-moz-user-select:none;user-select:none;}';
893 css += '.ponyhoof_dialog textarea, .ponyhoof_dialog input[type="text"] {cursor:text;-moz-box-sizing:border-box;box-sizing:border-box;}';
894 css += '.ponyhoof_dialog .generic_dialog_modal, .ponyhoof_dialog .generic_dialog_fixed_overflow {background-color:rgba(0,0,0,.4) !important;}';
895 css += '.ponyhoof_dialog .generic_dialog {z-index:250;}';
896 css += '.ponyhoof_dialog .generic_dialog_popup {margin-top:80px;}';
897 css += '.ponyhoof_dialog .popup {width:465px;margin:0 auto;cursor:default;-moz-box-shadow:0 2px 26px rgba(0, 0, 0, .3), 0 0 0 1px rgba(0, 0, 0, .1);box-shadow:0 2px 26px rgba(0, 0, 0, .3), 0 0 0 1px rgba(0, 0, 0, .1);}';
898 css += cx+' .ponyhoof_dialog .popup {font-family:"Helvetica Neue", Helvetica, Arial, "lucida grande",tahoma,verdana,arial,sans-serif;}';
899 css += '.ponyhoof_dialog .wrap {background:#fff;color:#000;}';
900 css += '.ponyhoof_dialog h3 {background-color:#6D84B4;border:1px solid #3B5998;border-bottom:0;color:#fff;font-size:14px !important;font-weight:bold !important;padding:5px 5px 5px 10px;cursor:help;min-height:17px;font-family:\'lucida grande\',tahoma,verdana,arial,sans-serif !important;line-height:1.28 !important;}';
901 css += cx+' .ponyhoof_dialog h3 {background:#f5f6f7;border:0;border-bottom:1px solid #e5e5e5;-moz-border-radius:3px 3px 0 0;border-radius:3px 3px 0 0;color:#4e5665;line-height:19px !important;padding:10px 12px;text-shadow:0 1px 0 #fff;font-family:\'Helvetica Neue\', Helvetica, Arial, \'lucida grande\',tahoma,verdana,arial,sans-serif !important;}';
902 css += '.ponyhoof_dialog h3:before {background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABDUlEQVQ4y43TzytEURQH8BnDyGKKZIGlHwtTrKZQNmJPWMxO2VopKdkoCzul7PwBkpK17NlYkGz8G7LzsXBe3cbz3tz69s65536/nfe951ZQ6cAkWjn7ucjb3MdjxFWMJLVlrJYJTGAp4l4coBH5A95C+F+BFH14QTPyRawUdVDHcJLX/K52tx70YxuXmMZ6CNxFfQEzZR7UcRvEr/h+4hnv3QhkuPF3bRT9whZOMRB5u4P8gdkwNlfgPA5WMZYQv5N4raiDKcxjEFc4w2EQX3GCC4yXeTCE0eRW4CipX2Ov20GqhPM7yWRmHRUKzOEePTgOgzOBXWyWCTTxFIRWCHb9GrMRbsSN1AK5Z38AQdAu/IfZJw8AAAAASUVORK5CYII=");background-repeat: no-repeat;display:inline-block;float:right;content:" ";width:16px;height:16px;opacity:.713;}';
903 css += cx+' .ponyhoof_dialog h3:before {display:none;}';
904 css += '.ponyhoof_dialog .body {border:1px solid #555;border-top-width:0;}';
905 css += '.ponyhoof_dialog h3.hidden_elem + .body {border-top-width:1px;}';
906 css += cx+' .ponyhoof_dialog .body {border:0;}';
907 css += '.ponyhoof_dialog .content {padding:10px;}';
908 css += '.ponyhoof_dialog .bottom {background:#F2F2F2;border-top:1px solid #ccc;padding:8px 10px 8px 10px;text-align:right;}';
909 css += cx+' .ponyhoof_dialog .bottom {-moz-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;}';
910 css += '.ponyhoof_dialog .bottom .lfloat {line-height:17px;margin-top:4px;}';
911
912 css += '.ponyhoof_dialog_header {background:#F2F2F2;border:solid #E2E2E2;border-width:1px 0;padding:4px 10px 5px;color:#333;font-size:11px;margin:0 -10px 8px;display:block;font-weight:bold;}';
913 css += '.ponyhoof_tabs {padding:4px 10px 0;background:#F2F2F2;border-bottom:1px solid #ccc;margin:-10px -10px 10px;}';
914 css += '.ponyhoof_tabs a {margin:3px 10px 0 0;padding:5px 8px;float:left;}';
915 css += '.ponyhoof_tabs a.active {color:#333;padding:4px 7px 5px;background:#fff;border:1px solid #ccc;border-bottom:1px solid #fff;margin-bottom:-1px;text-decoration:none;}';
916 css += '.ponyhoof_tabs_section {display:none;}';
917
918 if (ISMOBILE) {
919 css += '#ponyhoof_welcome_scenery {background-image:none !important;}';
920 css += '.ponyhoof_dialog .generic_dialog {position:absolute;}';
921 css += '.ponyhoof_menu .uiMenu.overflow {resize:none !important;height:auto !important;}';
922 }
923
924 injectManualStyle(css, 'dialog');
925 };
926
927 k.show = function() {
928 removeClass(k.dialog, 'ponyhoof_fadeout');
929 removeClass(k.generic_dialogDiv, 'ponyhoof_fadeout');
930
931 k.visible = true;
932 k.dialog.style.display = 'block';
933 k.generic_dialogDiv.style.display = 'block';
934
935 if (ISMOBILE) {
936 k.canCardspace = false;
937 }
938
939 if (k.canCardspace) {
940 w.addEventListener('resize', k.onBodyResize, false);
941 k.cardSpaceTick();
942 }
943
944 if (k.canCloseByEscapeKey) {
945 d.body.addEventListener('keydown', k.documentEscapeKey, false);
946 }
947 };
948
949 k.close = function(callback) {
950 k.onclose();
951
952 if (!userSettings.disable_animation) {
953 fadeOut(k.dialog, function() {
954 if (callback) {
955 callback();
956 }
957 k.onclosefinish();
958 });
959 if (callback) {
960 log("Legacy dialog close code found [Dialog.close()]");
961 }
962
963 if (ISOPERA) {
964 fadeOut(k.generic_dialogDiv);
965 }
966 } else {
967 k.dialog.style.display = 'none';
968 if (callback) {
969 callback();
970 }
971 k.onclosefinish();
972 }
973
974 k._close();
975 };
976
977 k.hide = function() {
978 k.onclose();
979
980 k.dialog.style.display = 'none';
981
982 k._close();
983 };
984
985 k._close = function() {
986 k.visible = false;
987
988 w.removeEventListener('resize', k.onBodyResize, false);
989 w.clearTimeout(k.cardSpaceTimer);
990
991 if (k.cardspaced) {
992 removeClass(d.documentElement, 'generic_dialog_overflow_mode');
993 if (!k.alwaysModal) {
994 removeClass(k.generic_dialogDiv, 'generic_dialog_modal');
995 }
996 }
997 removeClass(k.generic_dialogDiv, 'generic_dialog_fixed_overflow');
998 k.cardspaced = false;
999
1000 d.body.removeEventListener('keydown', k.documentEscapeKey, false);
1001 };
1002
1003 k.changeTitle = function(c) {
1004 INTERNALUPDATE = true;
1005 var title = k.dialog.getElementsByTagName('h3');
1006 if (title.length) {
1007 title = title[0];
1008 title.innerHTML = c;
1009 }
1010 INTERNALUPDATE = false;
1011 };
1012
1013 k.changeContent = function(c) {
1014 INTERNALUPDATE = true;
1015 var content = k.dialog.getElementsByClassName('content');
1016 if (content.length) {
1017 content = content[0];
1018 content.innerHTML = c;
1019 }
1020 INTERNALUPDATE = false;
1021 };
1022
1023 k.changeBottom = function(c) {
1024 INTERNALUPDATE = true;
1025 var bottom = k.dialog.getElementsByClassName('bottom');
1026 if (bottom.length) {
1027 bottom = bottom[0];
1028 bottom.innerHTML = c;
1029 }
1030 INTERNALUPDATE = false;
1031 };
1032
1033 k.addCloseButton = function(callback) {
1034 var text = "Close";
1035 if (CURRENTLANG && CURRENTLANG.close) {
1036 text = CURRENTLANG.close;
1037 }
1038
1039 var close = '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm" role="button"><span class="uiButtonText">'+text+'</span></a>';
1040 k.changeBottom(close);
1041
1042 k.dialog.querySelector('.bottom .uiButton').addEventListener('click', function(e) {
1043 k.close(function() {
1044 if (callback) {
1045 log("Legacy dialog close code found [Dialog.addCloseButton()]");
1046 callback();
1047 }
1048 });
1049 e.preventDefault();
1050 }, false);
1051 };
1052
1053 k.onBodyResize = function() {
1054 if (k.canCardspace) {
1055 var dialogHeight = k.popup_dialogDiv.clientHeight + 80 + 40;
1056 var windowHeight = w.innerHeight;
1057
1058 if (dialogHeight > windowHeight) {
1059 if (!k.cardspaced) {
1060 addClass(d.documentElement, 'generic_dialog_overflow_mode');
1061 if (!k.alwaysModal) {
1062 addClass(k.generic_dialogDiv, 'generic_dialog_modal');
1063 }
1064 addClass(k.generic_dialogDiv, 'generic_dialog_fixed_overflow');
1065
1066 k.cardspaced = true;
1067 }
1068 } else {
1069 if (k.cardspaced) {
1070 removeClass(d.documentElement, 'generic_dialog_overflow_mode');
1071 if (!k.alwaysModal) {
1072 removeClass(k.generic_dialogDiv, 'generic_dialog_modal');
1073 }
1074 removeClass(k.generic_dialogDiv, 'generic_dialog_fixed_overflow');
1075
1076 k.cardspaced = false;
1077 }
1078 }
1079 }
1080 };
1081
1082 k.cardSpaceTick = function() {
1083 if (k.canCardspace && k.visible) {
1084 k.onBodyResize();
1085 k.cardSpaceTimer = w.setTimeout(k.cardSpaceTick, 500);
1086 } else {
1087 w.clearTimeout(k.cardSpaceTimer);
1088 }
1089 };
1090
1091 k.documentEscapeKey = function(e) {
1092 if (k.canCloseByEscapeKey) {
1093 if (e.which == 27 && k.visible) { // esc
1094 k.close();
1095 e.stopPropagation();
1096 e.cancelBubble = true;
1097 }
1098 }
1099 };
1100
1101 if (DIALOGS[k.id]) {
1102 log("Attempting to recreate dialog ID \""+k.id+"\"");
1103 return DIALOGS[k.id];
1104 }
1105 DIALOGS[k.id] = k;
1106 };
1107
1108 function createSimpleDialog(id, title, message) {
1109 if (DIALOGS[id]) {
1110 DIALOGS[id].changeTitle(title);
1111 DIALOGS[id].changeContent(message);
1112 DIALOGS[id].show();
1113 return DIALOGS[id];
1114 }
1115
1116 var di = new Dialog(id);
1117 di.create();
1118 di.changeTitle(title);
1119 di.changeContent(message);
1120 di.addCloseButton();
1121
1122 return di;
1123 };
1124
1125 function injectSystemStyle() {
1126 var css = '';
1127 css += '.ponyhoof_show_if_injected {display:none;}';
1128 css += '.ponyhoof_hide_if_injected {display:block;}';
1129 css += '.ponyhoof_hide_if_injected.inline {display:inline;}';
1130 css += 'html.ponyhoof_injected .ponyhoof_show_if_injected {display:block;}';
1131 css += 'html.ponyhoof_injected .ponyhoof_hide_if_injected {display:none;}';
1132 css += '.ponyhoof_show_if_loaded {display:none;}';
1133 css += '.ponyhoof_updater_latest, .ponyhoof_updater_newVersion, .ponyhoof_updater_error {display:none;}';
1134
1135 css += '.ponyhoof_fadeout {opacity:0;-webkit-transition:opacity .25s linear;-moz-transition:opacity .25s linear;-o-transition:opacity .25s linear;transition:opacity .25s linear;}';
1136 css += '.ponyhoof_message {padding:10px;color:#000;font-weight:bold;overflow:hidden;}';
1137
1138 css += '.ponyhoof_loading {background:url("//fbstatic-a.akamaihd.net/rsrc.php/v2/y4/x/GsNJNwuI-UM.gif") no-repeat;display:inline-block;width:16px;height:11px;margin:6px 0 0 6px;}';
1139 css += '.ponyhoof_loading.ponyhoof_show_if_injected {display:none;}';
1140 css += 'html.ponyhoof_injected .ponyhoof_loading_pony {display:inline-block;}';
1141
1142 css += '.uiHelpLink {background:url("data:image/gif;base64,R0lGODlhDAALAJEAANvb26enp////wAAACH5BAEAAAIALAAAAAAMAAsAAAIblI8WkbcswAtAwWVzwoIbSWliBzWjR5abagoFADs=") no-repeat 0 center;display:inline-block;height:9px;width:12px;}';
1143
1144 css += '.uiInputLabel + .uiInputLabel {margin-top:3px;}';
1145 css += '.uiInputLabelCheckbox {float:left;margin:0;padding:0;}';
1146 css += '.uiInputLabel label {color:#333;display:block;font-weight:normal;margin-left:17px;vertical-align:baseline;}';
1147 css += '.webkit.mac .uiInputLabel label {margin-left:16px;}';
1148 css += '.webkit.mac .uiInputLabelCheckbox {margin-top:2px;}';
1149
1150 injectManualStyle(css, 'system');
1151 }
1152
1153 // http://www.html5rocks.com/en/tutorials/pagevisibility/intro/
1154 var _hiddenPropCached = '';
1155 var getHiddenProp = function() {
1156 if (_hiddenPropCached) {
1157 return _hiddenPropCached;
1158 }
1159
1160 var prefixes = ['webkit', 'moz', 'ms', 'o'];
1161
1162 if ('hidden' in document) {
1163 _hiddenPropCached = 'hidden';
1164 return _hiddenPropCached;
1165 }
1166
1167 for (var i = 0, len = prefixes.length; i < len; i++){
1168 if ((prefixes[i] + 'Hidden') in document) {
1169 _hiddenPropCached = prefixes[i] + 'Hidden';
1170 return _hiddenPropCached;
1171 }
1172 }
1173
1174 return null;
1175 };
1176 var isPageHidden = function() {
1177 var prop = getHiddenProp();
1178 if (!prop) {
1179 return false;
1180 }
1181
1182 return document[prop];
1183 };
1184 // http://www.myersdaily.org/joseph/javascript/md5.js
1185 function md5cycle(f,c){var b=f[0],a=f[1],d=f[2],e=f[3],b=ff(b,a,d,e,c[0],7,-680876936),e=ff(e,b,a,d,c[1],12,-389564586),d=ff(d,e,b,a,c[2],17,606105819),a=ff(a,d,e,b,c[3],22,-1044525330),b=ff(b,a,d,e,c[4],7,-176418897),e=ff(e,b,a,d,c[5],12,1200080426),d=ff(d,e,b,a,c[6],17,-1473231341),a=ff(a,d,e,b,c[7],22,-45705983),b=ff(b,a,d,e,c[8],7,1770035416),e=ff(e,b,a,d,c[9],12,-1958414417),d=ff(d,e,b,a,c[10],17,-42063),a=ff(a,d,e,b,c[11],22,-1990404162),b=ff(b,a,d,e,c[12],7,1804603682),e=ff(e,b,a,d,c[13],12,-40341101),d=ff(d,e,b,a,c[14],17,-1502002290),a=ff(a,d,e,b,c[15],22,1236535329),b=gg(b,a,d,e,c[1],5,-165796510),e=gg(e,b,a,d,c[6],9,-1069501632),d=gg(d,e,b,a,c[11],14,643717713),a=gg(a,d,e,b,c[0],20,-373897302),b=gg(b,a,d,e,c[5],5,-701558691),e=gg(e,b,a,d,c[10],9,38016083),d=gg(d,e,b,a,c[15],14,-660478335),a=gg(a,d,e,b,c[4],20,-405537848),b=gg(b,a,d,e,c[9],5,568446438),e=gg(e,b,a,d,c[14],9,-1019803690),d=gg(d,e,b,a,c[3],14,-187363961),a=gg(a,d,e,b,c[8],20,1163531501),b=gg(b,a,d,e,c[13],5,-1444681467),e=gg(e,b,a,d,c[2],9,-51403784),d=gg(d,e,b,a,c[7],14,1735328473),a=gg(a,d,e,b,c[12],20,-1926607734),b=hh(b,a,d,e,c[5],4,-378558),e=hh(e,b,a,d,c[8],11,-2022574463),d=hh(d,e,b,a,c[11],16,1839030562),a=hh(a,d,e,b,c[14],23,-35309556),b=hh(b,a,d,e,c[1],4,-1530992060),e=hh(e,b,a,d,c[4],11,1272893353),d=hh(d,e,b,a,c[7],16,-155497632),a=hh(a,d,e,b,c[10],23,-1094730640),b=hh(b,a,d,e,c[13],4,681279174),e=hh(e,b,a,d,c[0],11,-358537222),d=hh(d,e,b,a,c[3],16,-722521979),a=hh(a,d,e,b,c[6],23,76029189),b=hh(b,a,d,e,c[9],4,-640364487),e=hh(e,b,a,d,c[12],11,-421815835),d=hh(d,e,b,a,c[15],16,530742520),a=hh(a,d,e,b,c[2],23,-995338651),b=ii(b,a,d,e,c[0],6,-198630844),e=ii(e,b,a,d,c[7],10,1126891415),d=ii(d,e,b,a,c[14],15,-1416354905),a=ii(a,d,e,b,c[5],21,-57434055),b=ii(b,a,d,e,c[12],6,1700485571),e=ii(e,b,a,d,c[3],10,-1894986606),d=ii(d,e,b,a,c[10],15,-1051523),a=ii(a,d,e,b,c[1],21,-2054922799),b=ii(b,a,d,e,c[8],6,1873313359),e=ii(e,b,a,d,c[15],10,-30611744),d=ii(d,e,b,a,c[6],15,-1560198380),a=ii(a,d,e,b,c[13],21,1309151649),b=ii(b,a,d,e,c[4],6,-145523070),e=ii(e,b,a,d,c[11],10,-1120210379),d=ii(d,e,b,a,c[2],15,718787259),a=ii(a,d,e,b,c[9],21,-343485551);f[0]=add32(b,f[0]);f[1]=add32(a,f[1]);f[2]=add32(d,f[2]);f[3]=add32(e,f[3])}function cmn(f,c,b,a,d,e){c=add32(add32(c,f),add32(a,e));return add32(c<<d|c>>>32-d,b)}function ff(f,c,b,a,d,e,g){return cmn(c&b|~c&a,f,c,d,e,g)}function gg(f,c,b,a,d,e,g){return cmn(c&a|b&~a,f,c,d,e,g)}function hh(f,c,b,a,d,e,g){return cmn(c^b^a,f,c,d,e,g)}function ii(f,c,b,a,d,e,g){return cmn(b^(c|~a),f,c,d,e,g)}function md51(f){var txt="";var c=f.length,b=[1732584193,-271733879,-1732584194,271733878],a;for(a=64;a<=f.length;a+=64)md5cycle(b,md5blk(f.substring(a-64,a)));f=f.substring(a-64);var d=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(a=0;a<f.length;a++)d[a>>2]|=f.charCodeAt(a)<<(a%4<<3);d[a>>2]|=128<<(a%4<<3);if(55<a){md5cycle(b,d);for(a=0;16>a;a++)d[a]=0}d[14]=8*c;md5cycle(b,d);return b}function md5blk(f){var c=[],b;for(b=0;64>b;b+=4)c[b>>2]=f.charCodeAt(b)+(f.charCodeAt(b+1)<<8)+(f.charCodeAt(b+2)<<16)+(f.charCodeAt(b+3)<<24);return c}var hex_chr="0123456789abcdef".split("");function rhex(f){for(var c="",b=0;4>b;b++)c+=hex_chr[f>>8*b+4&15]+hex_chr[f>>8*b&15];return c}function hex(f){for(var c=0;c<f.length;c++)f[c]=rhex(f[c]);return f.join("")}function md5(f){return hex(md51(f))}function add32(f,c){return f+c&4294967295}"5d41402abc4b2a76b9719d911017c592"!=md5("hello")&&(add32=function(f,c){var b=(f&65535)+(c&65535);return(f>>16)+(c>>16)+(b>>16)<<16|b&65535});
1186 var VERSION = 1.651;
1187 var FRIENDLYNAME = 'P'+'onyh'+'oof';
1188 var SIG = '['+FRIENDLYNAME+' v'+VERSION+']';
1189 var DISTRIBUTION = 'userjs';
1190
1191 var runMe = true;
1192 var STORAGEMETHOD = 'none';
1193 var INTERNALUPDATE = false;
1194 var USINGMUTATION = false;
1195
1196 var CURRENTPONY = null;
1197 var REALPONY = CURRENTPONY;
1198 var BRONYNAME = '';
1199 var USERID = 0;
1200 var UILANG = 'en_US';
1201 var CURRENTLANG = {};
1202 var ISUSINGPAGE = false;
1203 var ISUSINGBUSINESS = false;
1204 var ONPLUGINPAGE = false;
1205
1206 var SETTINGSPREFIX = '';
1207 var globalSettings = {};
1208 var GLOBALDEFAULTSETTINGS = {
1209 'allowLoginScreen':true,
1210 'runForNewUsers':true,
1211 'globalSettingsMigrated':false, 'lastUserId':0, 'lastVersion':''
1212 };
1213
1214 var PONIES = [{"code":"trixie","name":"Trixie","users":["trixie"],"menu_title":"The Great and Powerful Trixie demands your attention!","color":["6e98b4","3a7196"],"icon16":"trixie\/icon16_2.png","soundNotif":"trixie\/notif","loadingText":"Performing magic..."},{"code":"twilight","name":"Twilight Sparkle","users":["twilight","spark","tw\u0131l\u0131ght","twilite","twi light","\u0162wilight"],"search":"twilight sparkle|twilightsparkle|princess twilight","menu_title":"To switch to Princess Twilight, go to Misc > Appearance","color":["9f6eb4","7a3a96"],"mane6":true,"loadingText":"Studying friendship..."},{"code":"dash","name":"Rainbow Dash","users":["rainbow","dash"],"search":"rainbow dash|rainbowdash|dashie","color":["6e9db4","3a7796"],"soundNotif":"dash\/notif","mane6":true,"loadingText":"Loading... in ten seconds flat!","successText":"Aww yeah!"},{"code":"pinkie","name":"Pinkie Pie","users":["pink"],"search":"pinkie pie|pinkiepie|pinkamena diane pie","color":["b46e8a","963a5f"],"soundNotif":"pinkie\/notif2","mane6":true,"loadingText":"Come on everypony!"},{"code":"applej","name":"Applejack","users":["apple j","applej"],"search":"applejack|apple jack","color":["b4976e","96703a"],"soundNotif":"applej\/notif2","mane6":true,"loadingText":"Hold on there sugarcube!","successText":"Yeehaw!"},{"code":"flutter","name":"Fluttershy","users":["flutter","flut ter"],"search":"fluttershy|flutter shy","color":["b4ae6e","968e3a"],"soundNotif":"flutter\/notif2","mane6":true,"loadingText":"Screaming...","successText":"Yay!"},{"code":"rarity","name":"Rarity","users":["rarity"],"color":["9b6eb4","763a96"],"soundNotif":"rarity\/notif","mane6":true,"loadingText":"Whining...","seperator":true},{"code":"applebloom","name":"Apple Bloom","users":["appleb","apple b"],"search":"apple bloom|applebloom|cmc|cutie mark crusaders","color":["b46e8d","963a63"],"soundNotif":"applebloom\/notif","loadingText":"Getting her cutie mark...","nocutie":true},{"code":"aloe","name":"Aloe","users":["aloe"],"search":"aloe|spa pony|spa ponies","color":["b46e91","963a68"]},{"code":"babsseed","name":"Babs Seed","users":["babs","seed"],"search":"babs seed|babsseed|cmc|cutie mark crusaders","color":["b4976e","96703a"],"nocutie":true},{"code":"berry","name":"Berry Punch","users":["berry"],"color":["a56eb4","823a96"]},{"code":"bigmac","name":"Big Macintosh","users":["bigmac","big mac"],"search":"bigmacintosh|big macintosh|big mcintosh|bigmcintosh","color":["b46e75","963a43"],"soundNotif":"bigmac\/notif","loadingText":"Saying eeyup..."},{"code":"bonbon","name":"Bon Bon","users":["bon bon","bonbon","bon-bon"],"search":"bon bon|bonbon","color":["6e89b4","3a5d96"]},{"code":"braeburn","name":"Braeburn","users":["braeburn","breaburn"],"search":"braeburn|breaburn","color":["b4a86e","96873a"],"icon16":"braeburn\/icon16_2.png"},{"code":"cadance","name":"Cadance","users":["cadance","cadence"],"search":"cadance|cadence|princess cadance|princess cadence","color":["b46e96","963a6e"]},{"code":"carrot","name":"Carrot Top","users":["golden","carrot"],"search":"carrot top|carrottop|golden harvest","menu_title":"Also known as Golden Harvest","color":["b2b46e","93963a"]},{"code":"celestia","name":"Celestia","users":["celestia","trollestia","molestia"],"search":"celestia|princess celestia","color":["b46e98","963a71"],"loadingText":"Raising the sun..."},{"code":"cheerilee","name":"Cheerilee","users":["cheerilee"],"color":["b46e96","963a6e"]},{"code":"colgate","name":"Colgate","users":["colgate","minuette"],"search":"colgate|minuette|minette","menu_title":"Also known as Minuette","color":["6e99b4","3a7396"],"soundNotif":"colgate\/notif","loadingText":"Brushing..."},{"code":"cloudchaser","name":"Cloudchaser","users":["cloudch","cloud ch"],"search":"cloudchaser|cloud chaser|stormwalker|storm walker","menu_title":"Also known as Stormwalker","color":["856eb4","593a96"]},{"code":"daring","name":"Daring Do","users":["daring"],"search":"daring do|daringdo","color":["b4a76e","96853a"]},{"code":"derpy","name":"Derpy Hooves","users":["derpy"],"color":["b4b46e","96963a"],"fbIndex_swf":"derpy\/fbIndex.swf","soundNotif":"derpy\/notif","icon16":"derpy\/icon16_2.png","loadingText":"Wondering what went wrong..."},{"code":"diamondtiara","name":"Diamond Tiara","users":["tiara"],"search":"diamond tiara|diamondtiara","color":["926eb4","6a3a96"],"stack":"villian"},{"code":"discord","name":"Discord","users":["discord"],"color":["b46f6e","963c3a"],"stack":"villian","loadingText":"CHOCOLATE RAIN","nocutie":true},{"code":"whooves","name":"Doctor Whooves","users":["whooves","time turn"],"search":"doctor whooves|doctor hooves|time turner","menu_title":"Also known as Time Turner","color":["b4a06e","967c3a"]},{"code":"fleur","name":"Fleur De Lis","users":["fleur","fluer"],"search":"fleur de lis|fluer de lis|fleur dis lee|fluer dis lee","color":["b46eb4","963a96"]},{"code":"flimflam","name":"Flim and Flam","users":["flim","flam"],"color":["b0b46e","91963a"],"loadingText":"Giving opportunities..."},{"code":"flitter","name":"Flitter","users":["Flitter"],"color":["846eb4","573a96"]},{"code":"gilda","name":"Gilda","users":["gilda"],"color":["b49a6e","96743a"],"stack":"villian","nocutie":true},{"code":"ironwill","name":"Iron Will","users":["iron will","ironwill"],"search":"ironwill|iron will","color":["6e84b4","3a5796"],"stack":"villian","nocutie":true},{"code":"sombra","name":"King Sombra","users":["sombra"],"color":["6eb46e","3a963a"],"stack":"villian","nocutie":true},{"code":"lightningdust","name":"Lightning Dust","users":["lightning"],"color":["6eb4ad","3a968d"]},{"code":"lotus","name":"Lotus","users":["lotus"],"search":"lotus|spa pony|spa ponies","color":["6ea0b4","3a7c96"]},{"code":"luna","name":"Luna","users":["luna"],"search":"luna|princess luna|nightmare moon|nightmaremoon","color":["6e7eb4","3a5096"],"soundNotif":"luna\/notif","loadingText":"Doubling the fun...","successText":"Huzzah!"},{"code":"lyra","name":"Lyra","users":["lyra"],"search":"lyra heartstrings","color":["6eb49d","3a9677"]},{"code":"nightmaremoon","name":"Nightmare Moon","users":["nightmare"],"search":"nightmare moon|nightmaremoon|luna|princess luna","color":["6e7fb4","3a5196"],"stack":"villian"},{"code":"nurseredheart","name":"Nurse Redheart","users":["nurse","redheart"],"color":["b46e76","963a45"]},{"code":"octavia","name":"Octavia","users":["octavia"],"color":["b4a76e","96853a"]},{"code":"pinkamena","name":"Pinkamena","users":["pinkamena"],"search":"pinkamena diane pie","color":["b46e8c","963a62"],"stack":"villian"},{"code":"chrysalis","name":"Queen Chrysalis","users":["chrysalis"],"search":"queen chrysalis|changeling","color":["6ea2b4","3a7f96"],"stack":"chrysalis","loadingText":"Feeding...","nocutie":true},{"code":"roidrage","name":"Roid Rage","users":["snowflake","roid","rage"],"search":"snowflake|roidrage|roid rage","menu_title":"Also known as Snowflake","color":["b4ae6e","968e3a"],"soundNotif":"_sound\/roidrage_yeah","successText":"YEAH!"},{"code":"rose","name":"Rose","users":["rose"],"search":"roseluck","menu_title":"Also known as Roseluck","color":["b46e8c","963a62"]},{"code":"scootaloo","name":"Scootaloo","users":["scootaloo"],"search":"scootaloo|cmc|cutie mark crusaders|chicken","color":["b4996e","96733a"],"loadingText":"Getting her cutie mark...","nocutie":true},{"code":"shiningarmor","name":"Shining Armor","users":["shining armor"],"search":"shining armor|shiningarmor","color":["6e7bb4","3a4b96"]},{"code":"silverspoon","name":"Silver Spoon","users":["spoon"],"search":"silver spoon|silverspoon","color":["6e97b4","3a7096"],"stack":"villian"},{"code":"soarin","name":"Soarin'","users":["soarin"],"search":"soarin'|wonderbolts","color":["6e9db4","3a7796"]},{"code":"spike","name":"Spike","users":["spike"],"color":["a26eb4","7f3a96"],"nocutie":true},{"code":"spitfire","name":"Spitfire","users":["spitfire"],"search":"spitfire|wonderbolts","color":["b4ae6e","968e3a"],"icon16":"spitfire\/icon16_2.png"},{"code":"sweetieb","name":"Sweetie Belle","users":["sweetieb","sweetie b"],"search":"sweetiebelle|sweetie belle|cmc|cutie mark crusaders","color":["a06eb4","7c3a96"],"soundNotif":"sweetieb\/notif","loadingText":"Getting her cutie mark...","nocutie":true},{"code":"vinyl","name":"Vinyl Scratch","users":["vinyl","vinyx","dj p"],"search":"vinyl scratch|dj pon3|dj-pon3|dj pon 3|dj pon-3","menu_title":"Also known as DJ Pon-3","color":["6ea9b4","3a8896"],"soundNotif":"vinyl\/notif","loadingText":"Wubbing..."},{"code":"zecora","name":"Zecora","users":["zecora"],"color":["b4af6e","96903a"]},{"code":"blank","name":"(Blank)","color":["b46e6e","963a3a"],"hidden":true,"nocutie":true},{"code":"bloomberg","name":"Bloomberg","color":["9fb46e","7a963a"],"hidden":true,"nocutie":true},{"code":"mono","name":"Mono","color":["b46e6e","963a3a"],"stack":"mono","hidden":true},{"code":"taugeh","name":"Taugeh","color":["b4b46e","96963a"],"hidden":true,"nocutie":true}];
1215 var LANG = {"af_ZA":{"sniff_comment_tooltip_like":"Hou van hierdie opmerking","sniff_comment_tooltip_unlike":"Hou nie meer van hierdie opmerking nie"},"ar_AR":{"sniff_comment_tooltip_like":"\u0627\u0644\u0625\u0639\u062c\u0627\u0628 \u0628\u0627\u0644\u062a\u0639\u0644\u064a\u0642","sniff_comment_tooltip_unlike":"\u0625\u0644\u063a\u0627\u0621 \u0625\u0639\u062c\u0627\u0628\u064a \u0628\u0647\u0630\u0627 \u0627\u0644\u062a\u0639\u0644\u064a\u0642"},"az_AZ":{"sniff_comment_tooltip_like":"Bu r\u0259yi b\u0259y\u0259n","sniff_comment_tooltip_unlike":"Bu \u015f\u0259rhi b\u0259y\u0259nm\u0259"},"be_BY":{"sniff_comment_tooltip_like":"\u041f\u0430\u0434\u0430\u0431\u0430\u0435\u0446\u0446\u0430","sniff_comment_tooltip_unlike":"\u041c\u043d\u0435 \u0431\u043e\u043b\u044c\u0448 \u043d\u0435 \u043f\u0430\u0434\u0430\u0431\u0430\u0435\u0446\u0446\u0430 \u0433\u044d\u0442\u044b \u043a\u0430\u043c\u044d\u043d\u0442\u0430\u0440"},"bg_BG":{"sniff_comment_tooltip_like":"\u0425\u0430\u0440\u0435\u0441\u0432\u0430\u043c \u0442\u043e\u0437\u0438 \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440","sniff_comment_tooltip_unlike":"\u0412\u0435\u0447\u0435 \u043d\u0435 \u0445\u0430\u0440\u0435\u0441\u0432\u0430\u043c"},"bn_IN":{"sniff_comment_tooltip_like":"\u09ae\u09a8\u09cd\u09a4\u09ac\u09cd\u09af\u099f\u09bf \u09ad\u09be\u09b2\u09cb \u09b2\u09c7\u0997\u09c7\u099b\u09c7","sniff_comment_tooltip_unlike":"\u09ad\u09be\u09b2\u09cb \u09b2\u09be\u0997\u09c7\u09a8\u09bf"},"bs_BA":{"sniff_comment_tooltip_like":"Svi\u0111a mi se ovaj komentar","sniff_comment_tooltip_unlike":"Ne svi\u0111a mi se komentar"},"ca_ES":{"sniff_comment_tooltip_like":"M'agrada aquest comentari","sniff_comment_tooltip_unlike":"Ja no m'agrada aquest comentari."},"cs_CZ":{"sniff_comment_tooltip_like":"Tento koment\u00e1\u0159 se mi l\u00edb\u00ed.","sniff_comment_tooltip_unlike":"Koment\u00e1\u0159 se mi u\u017e nel\u00edb\u00ed","close":"Zav\u0159\u00edt"},"cy_GB":{"sniff_comment_tooltip_like":"Hoffi'r sylw hwn","sniff_comment_tooltip_unlike":"Peidio hoffi'r sylw hwn"},"da_DK":{"fb_composer_lessons":"Hvilke lektioner i venskab har du l\u00e6rt idag?","sniff_comment_tooltip_like":"Tilkendegiv, at du synes godt om denne kommentar","sniff_comment_tooltip_unlike":"Synes ikke godt om denne kommentar l\u00e6ngere","close":"Luk"},"de_DE":{"fb_composer_lessons":"Welche Lektionen \u00fcber Freundschaft hast Du heute gelernt?","sniff_comment_tooltip_like":"Dieser Kommentar gef\u00e4llt mir","sniff_comment_tooltip_unlike":"Dieser Kommentar gef\u00e4llt mir nicht mehr","close":"Schlie\u00dfen"},"el_GR":{"sniff_comment_tooltip_like":"\u039c\u03bf\u03c5 \u03b1\u03c1\u03ad\u03c3\u03b5\u03b9 \u03b1\u03c5\u03c4\u03cc \u03c4\u03bf \u03c3\u03c7\u03cc\u03bb\u03b9\u03bf","sniff_comment_tooltip_unlike":"\"\u0394\u03b5\u03bd \u03bc\u03bf\u03c5 \u03b1\u03c1\u03ad\u03c3\u03b5\u03b9!\" \u03b1\u03c5\u03c4\u03cc \u03c4\u03bf \u03c3\u03c7\u03cc\u03bb\u03b9\u03bf"},"en_PI":{"sniff_comment_tooltip_like":"This comment be pleasin","sniff_comment_tooltip_unlike":"Care not fer such trifles"},"en_US":{"fb_composer_lessons":"What lessons in friendship have you learned today?","fb_comment_box":"Write a friendship letter...","fb_search_box":"Search for ponies, places and things","fb_search_boxAlt":"Type to search for ponies, places and things","fb_composer_coolstory":"Write a cool story...","fb_composer_ponies":"Ponies!","fb_composer_ponies_caps":"PONIES!!!","fb_share_tooltip":"Remember! You gotta share... You gotta care...","sniff_comment_tooltip_like":"Like this comment","sniff_comment_tooltip_unlike":"Unlike this comment","sniff_fb_search_boxAlt":"Type to search","close":"Close","reloadNow":"Reload now","notNow":"Not now","invertSelection":"Invert selection","finish":"Finish","done":"Eeyup","options_title":"Ponyhoof Options","options_tabs_main":"General","options_tabs_background":"Background","options_tabs_sounds":"Sounds","options_tabs_extras":"Misc","options_tabs_advanced":"Debug","options_tabs_about":"About","settings_disable_runForNewUsers_explain":"If you enable this, Ponyhoof will not automatically run for other Facebook accounts that did not activate Ponyhoof yet. They can still open Ponyhoof Options to re-enable Ponyhoof if they wish to.","settings_extras_login_bg":"Use alternate background","settings_sounds":"Play sounds (e.g. notifications and dialogs)","settings_sounds_noNotification":"Play sounds (e.g. dialogs)","settings_extras_runForNewUsers_explain":"If you disable this, Ponyhoof will not automatically run for other Facebook accounts that did not activate Ponyhoof yet. They can still open Ponyhoof Options to re-enable Ponyhoof if they wish to.","settings_main_visitPage":"Visit the Ponyhoof page for news or contact us","settings_main_visitPageBusiness":"Visit the Ponyhoof page for news","settings_sounds_unavailable":"Notification sounds are not available on your browser. Please update your browser if possible.","updater_title":"Update Ponyhoof","costume_tooltip":"Limited to certain characters only"},"eo_EO":{"sniff_comment_tooltip_like":"\u015cati \u0109i tiun komenton","sniff_comment_tooltip_unlike":"Ne plu \u015dati \u0109i tiun komenton"},"es_ES":{"sniff_comment_tooltip_like":"Me gusta este comentario","sniff_comment_tooltip_unlike":"Ya no me gusta este comentario","close":"Cerrar"},"es_LA":{"fb_composer_lessons":"\u00bfQue has aprendido hoy sobre la amistad?","fb_comment_box":"Escribe un reporte de amistad...","sniff_comment_tooltip_like":"Me gusta este comentario","sniff_comment_tooltip_unlike":"Ya no me gusta este comentario","close":"Cerrar"},"et_EE":{"sniff_comment_tooltip_like":"Meeldib see kommentaar","sniff_comment_tooltip_unlike":"Ei meeldi enam"},"eu_ES":{"sniff_comment_tooltip_like":"Iruzkin hau atsegin dut","sniff_comment_tooltip_unlike":"Iruzkin hau desatsegin"},"fa_IR":{"sniff_comment_tooltip_like":"\u0627\u06cc\u0646 \u062f\u06cc\u062f\u06af\u0627\u0647 \u0631\u0627 \u0645\u06cc\u200c\u067e\u0633\u0646\u062f\u0645","sniff_comment_tooltip_unlike":"\u0627\u06cc\u0646 \u062f\u06cc\u062f\u06af\u0627\u0647 \u0631\u0627 \u0646\u067e\u0633\u0646\u062f\u06cc\u062f\u0645"},"fb_LT":{"fb_composer_lessons":"W|-|47 \u00a33550|\\|5 !|\\| |=|2!3|\\||)5|-|!|* |-|4\\\/3 '\/0|_| \u00a334|2|\\|3|) 70|)4'\/?","fb_comment_box":"W|2!73 4 |=|2!3|\\||)5|-|!|* \u00a33773|2...","fb_search_box":"S34|2(|-| |=0|2 |*0|\\|!35, |*\u00a34(35 4|\\||) 7|-|!|\\|95","fb_search_boxAlt":"T'\/|*3 70 534|2(|-| |=0|2 |*0|\\|!35, |*\u00a34(35 4|\\||) 7|-|!|\\|95","fb_composer_coolstory":"W|2!73 4 (00\u00a3 570|2'\/...","fb_composer_ponies":"P0|\\|!35!","fb_composer_ponies_caps":"PONIES!!!","fb_share_tooltip":"R3|\\\/|3|\\\/|83|2! Y0|_| 90774 5|-|4|23... Y0|_| 90774 (4|23...","close":"Alt+F4","reloadNow":"R3\u00a304|) |\\|0vv","notNow":"N07 |\\|0vv","invertSelection":"I|\\|\\\/3|27 53\u00a33(7!0|\\|","finish":"F!|\\|!5|-|","done":"E3'\/|_||*","options_title":"P0|\\|'\/|-|00|= O|*7!0|\\|5","options_tabs_main":"G3|\\|3|24\u00a3","options_tabs_background":"B4(k9|20|_||\\||)","options_tabs_sounds":"S0|_||\\||)5","options_tabs_extras":"M!5(","options_tabs_advanced":"D38|_|9","options_tabs_about":"A80|_|7","settings_disable_runForNewUsers_explain":"I|= '\/0|_| 3|\\|48\u00a33 7|-|!5, P0|\\|'\/|-|00|= vv!\u00a3\u00a3 |\\|07 4|_|70|\\\/|47!(4\u00a3\u00a3'\/ |2|_||\\| |=0|2 07|-|3|2 F4(3800k 4((0|_||\\|75 7|-|47 |)!|) |\\|07 4(7!\\\/473 P0|\\|'\/|-|00|= '\/37. T|-|3'\/ (4|\\| 57!\u00a3\u00a3 0|*3|\\| P0|\\|'\/|-|00|= O|*7!0|\\|5 70 |23-3|\\|48\u00a33 P0|\\|'\/|-|00|= !|= 7|-|3'\/ vv!5|-| 70.","settings_extras_login_bg":"U53 4\u00a373|2|\\|473 84(k9|20|_||\\||)","settings_sounds":"P\u00a34'\/ 50|_||\\||)5 (3.9. |\\|07!|=!(47!0|\\|5 4|\\||) |)!4\u00a3095)","settings_sounds_noNotification":"P\u00a34'\/ 50|_||\\||)5 (3.9. |)!4\u00a3095)","settings_extras_runForNewUsers_explain":"I|= '\/0|_| |)!548\u00a33 7|-|!5, P0|\\|'\/|-|00|= vv!\u00a3\u00a3 |\\|07 4|_|70|\\\/|47!(4\u00a3\u00a3'\/ |2|_||\\| |=0|2 07|-|3|2 F4(3800k 4((0|_||\\|75 7|-|47 |)!|) |\\|07 4(7!\\\/473 P0|\\|'\/|-|00|= '\/37. T|-|3'\/ (4|\\| 57!\u00a3\u00a3 0|*3|\\| P0|\\|'\/|-|00|= O|*7!0|\\|5 70 |23-3|\\|48\u00a33 P0|\\|'\/|-|00|= !|= 7|-|3'\/ vv!5|-| 70.","settings_main_visitPage":"V!5!7 7|-|3 P0|\\|'\/|-|00|= |*493 |=0|2 |\\|3vv5 0|2 (0|\\|74(7 |_|5","settings_main_visitPageBusiness":"V!5!7 7|-|3 P0|\\|'\/|-|00|= |*493 |=0|2 |\\|3vv5","settings_sounds_unavailable":"N07!|=!(47!0|\\| 50|_||\\||)5 4|23 |\\|07 4\\\/4!\u00a348\u00a33 0|\\| '\/0|_||2 8|20vv53|2. P\u00a33453 |_||*|)473 '\/0|_||2 8|20vv53|2 !|= |*055!8\u00a33.","updater_title":"U|*|)473 P0|\\|'\/|-|00|=","costume_tooltip":"L!|\\\/|!73|) 70 (3|274!|\\| (|-|4|24(73|25 0|\\|\u00a3'\/","sniff_comment_tooltip_like":"<3"},"fi_FI":{"fb_composer_lessons":"Mit\u00e4 oppeja yst\u00e4vyydest\u00e4 olet oppinut t\u00e4n\u00e4\u00e4n?","sniff_comment_tooltip_like":"Tykk\u00e4\u00e4 t\u00e4st\u00e4 kommentista","sniff_comment_tooltip_unlike":"En tykk\u00e4\u00e4k\u00e4\u00e4n","close":"Sulje"},"fo_FO":{"sniff_comment_tooltip_like":"M\u00e6r d\u00e1mar vi\u00f0merkingina"},"fr_CA":{"fb_composer_lessons":"Quelles le\u00e7ons sur l'amiti\u00e9 avez-vous appris aujourd'hui ?","sniff_comment_tooltip_like":"J\u2019aime ce commentaire","sniff_comment_tooltip_unlike":"Je n\u2019aime plus ce commentaire","close":"Fermer"},"fr_FR":{"fb_composer_lessons":"Quelles le\u00e7ons sur l'amiti\u00e9 avez-vous appris aujourd'hui ?","sniff_comment_tooltip_like":"J\u2019aime ce commentaire","sniff_comment_tooltip_unlike":"Je n\u2019aime plus ce commentaire","close":"Fermer"},"fy_NL":{"sniff_comment_tooltip_like":"Leuke reaksje","sniff_comment_tooltip_unlike":"Ik mei net mear oer dit berjocht"},"ga_IE":{"fb_composer_lessons":"cad ceachtanna i cairdeas ad'fhoghlaim t\u00fa inniu?","sniff_comment_tooltip_like":"L\u00e9irigh gur maith leat an tr\u00e1cht seo","sniff_comment_tooltip_unlike":"N\u00ed maith liom an tr\u00e1cht seo","close":"D\u00fan"},"gl_ES":{"sniff_comment_tooltip_like":"G\u00fastame este comentario","sniff_comment_tooltip_unlike":"Xa non me gusta"},"he_IL":{"fb_composer_lessons":"\u05d0\u05d9\u05dc\u05d5 \u05dc\u05e7\u05d7\u05d9\u05dd \u05d1\u05d9\u05d3\u05d9\u05d3\u05d5\u05ea \u05dc\u05de\u05d3\u05ea \u05d4\u05d9\u05d5\u05dd?","sniff_comment_tooltip_like":"\u05d0\u05d5\u05d4\u05d1 \u05d0\u05ea \u05d4\u05ea\u05d2\u05d5\u05d1\u05d4","sniff_comment_tooltip_unlike":"\u05dc\u05d0 \u05d0\u05d4\u05d1\/\u05d4 \u05d0\u05ea \u05ea\u05d2\u05d5\u05d1\u05d4 \u05d6\u05d5","close":"\u05e1\u05d2\u05d5\u05e8"},"hi_IN":{"sniff_comment_tooltip_like":"\u091f\u093f\u092a\u094d\u092a\u0923\u0940 \u092a\u0938\u0902\u0926 \u0915\u0930\u0947\u0902","sniff_comment_tooltip_unlike":"\u0907\u0938 \u091f\u093f\u092a\u094d\u092a\u0923\u0940 \u0915\u094b \u0928\u093e\u092a\u0938\u0902\u0926 \u0915\u0930\u0947\u0902"},"hr_HR":{"sniff_comment_tooltip_like":"Svi\u0111a mi se ovaj komentar","sniff_comment_tooltip_unlike":"Ne svi\u0111a mi se"},"hu_HU":{"fb_composer_lessons":"Mit tanult\u00e1l ma a bar\u00e1ts\u00e1gr\u00f3l?","sniff_comment_tooltip_like":"Tetszik a bejegyz\u00e9s.","sniff_comment_tooltip_unlike":"M\u00e9gsem tetszik","close":"Bez\u00e1r\u00e1s"},"hy_AM":{"sniff_comment_tooltip_like":"\u0540\u0561\u057e\u0561\u0576\u0565\u056c \u0561\u0575\u057d \u0574\u0565\u056f\u0576\u0561\u0562\u0561\u0576\u0578\u0582\u0569\u0575\u0578\u0582\u0576\u0568","sniff_comment_tooltip_unlike":"\u0549\u0570\u0561\u057e\u0561\u0576\u0565\u056c \u0561\u0575\u057d \u0574\u0565\u056f\u0576\u0561\u0562\u0561\u0576\u0578\u0582\u0569\u0575\u0578\u0582\u0576\u0568"},"id_ID":{"fb_composer_lessons":"Apa pelajaran yang kalian dapat tentang persahabatan hari ini?","sniff_comment_tooltip_like":"Suka komentar ini","sniff_comment_tooltip_unlike":"Tidak suka komentar ini","close":"Tutup"},"is_IS":{"sniff_comment_tooltip_like":"L\u00edkar vi\u00f0 \u00feessi umm\u00e6li","sniff_comment_tooltip_unlike":"L\u00edka ekki vi\u00f0 \u00feessi umm\u00e6li"},"it_IT":{"fb_composer_lessons":"Che cosa hai imparato oggi sull'amicizia?","sniff_comment_tooltip_like":"Di' che ti piace questo commento","sniff_comment_tooltip_unlike":"Di' che non ti piace pi\u00f9 questo commento","close":"Chiudi"},"ja_JP":{"fb_composer_lessons":"\u4eca\u65e5\u306f\u53cb\u60c5\u306b\u3069\u306e\u3088\u3046\u306a\u6559\u8a13\u3092\u5b66\u3073\u307e\u3057\u305f\u304b\uff1f","sniff_comment_tooltip_like":"\u3053\u306e\u30b3\u30e1\u30f3\u30c8\u306f\u3044\u3044\u306d\uff01","sniff_comment_tooltip_unlike":"\u3044\u3044\u306d\uff01\u3092\u53d6\u308a\u6d88\u3059","close":"\u9589\u3058\u308b"},"ka_GE":{"sniff_comment_tooltip_like":"\u10db\u10dd\u10d8\u10ec\u10dd\u10dc\u10d4 \u10d4\u10e1 \u10d9\u10dd\u10db\u10d4\u10dc\u10e2\u10d0\u10e0\u10d8","sniff_comment_tooltip_unlike":"\u10d0\u10e6\u10d0\u10e0 \u10db\u10dd\u10db\u10ec\u10dd\u10dc\u10e1 \u10d4\u10e1 \u10d9\u10dd\u10db\u10d4\u10dc\u10e2\u10d0\u10e0\u10d8"},"km_KH":{"sniff_comment_tooltip_like":"\u1785\u17bc\u179b\u1785\u17b7\u178f\u17d2\u178f \u179c\u17b7\u1785\u17b6\u179a \u1793\u17c1\u17c7","sniff_comment_tooltip_unlike":"\u179b\u17c2\u1784\u1785\u17bc\u179b\u1785\u17b7\u178f\u17d2\u178f\u1798\u178f\u17b7\u1793\u17c1\u17c7"},"ko_KR":{"fb_composer_lessons":"\uc6b0\uc815\uc5d0 \uad00\ud574\uc11c \uc624\ub298 \ubb34\uc5c7\uc744 \ubc30\uc6e0\ub098\uc694?","sniff_comment_tooltip_like":"\uc88b\uc544\uc694","sniff_comment_tooltip_unlike":"\uc88b\uc544\uc694 \ucde8\uc18c","close":"\ub2eb\uae30"},"ku_TR":{"sniff_comment_tooltip_like":"V\u00ea \u015f\u00eerovey\u00ea biecib\u00eene","sniff_comment_tooltip_unlike":"V\u00ea \u015firovey\u00ea neecib\u00eene"},"la_VA":[],"lt_LT":{"fb_composer_lessons":"Kokias \u017einias apie draugyst\u0119 i\u0161mokote \u0161iandien?","sniff_comment_tooltip_like":"Patinka \u0161is komentaras","sniff_comment_tooltip_unlike":"Nepatinka \u0161is komentaras","close":"U\u017edaryti"},"lv_LV":{"sniff_comment_tooltip_unlike":"Koment\u0101rs vairs nepat\u012bk"},"mk_MK":{"fb_composer_lessons":"\u041a\u043e\u0438 \u043b\u0435\u043a\u0446\u0438\u0438 \u0437\u0430 \u043f\u0440\u0438\u0458\u0430\u0442\u0435\u043b\u0441\u0442\u0432\u043e\u0442\u043e \u0434\u043e\u0437\u043d\u0430\u0432\u0442\u0435 \u0434\u0435\u043d\u0435\u0441?","sniff_comment_tooltip_like":"\u041c\u0438 \u0441\u0435 \u0434\u043e\u043f\u0430\u0453\u0430 \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440\u043e\u0432","sniff_comment_tooltip_unlike":"\u041d\u0435 \u043c\u0438 \u0441\u0435 \u0434\u043e\u043f\u0430\u0453\u0430","close":"\u0417\u0430\u0442\u0432\u043e\u0440\u0438"},"ml_IN":{"sniff_comment_tooltip_like":"\u0d08 \u0d05\u0d2d\u0d3f\u0d2a\u0d4d\u0d30\u0d3e\u0d2f\u0d02 \u0d07\u0d37\u0d4d\u0d1f\u0d2e\u0d3e\u0d2f\u0d3f"},"ms_MY":{"fb_composer_lessons":"Apakah pelajaran tentang persahabatan yang telah anda pelajari hari ini?","fb_comment_box":"Tuliskan surat persahabatan...","fb_composer_ponies":"Kuda!","fb_composer_ponies_caps":"KUDA!!!","sniff_comment_tooltip_like":"Suka komen ini","sniff_comment_tooltip_unlike":"Tidak suka komen ini","close":"Tutup","options_title":"Opsyen Ponyhoof"},"nb_NO":{"sniff_comment_tooltip_like":"Lik denne kommentaren"},"ne_NP":[],"nl_NL":{"fb_composer_lessons":"Wat heb je vandaag geleerd over vriendschap?","sniff_comment_tooltip_like":"Leuke reactie","sniff_comment_tooltip_unlike":"Reactie niet meer leuk","close":"Sluiten"},"pa_IN":{"sniff_comment_tooltip_like":"\u0a07\u0a39 \u0a1f\u0a3f\u0a71\u0a2a\u0a23\u0a40 \u0a2a\u0a38\u0a70\u0a26 \u0a15\u0a30\u0a4b","sniff_comment_tooltip_unlike":"\u0a07\u0a39 \u0a1f\u0a3f\u0a71\u0a2a\u0a23\u0a40 \u0a28\u0a3e\u0a2a\u0a38\u0a70\u0a26 \u0a15\u0a30\u0a4b|"},"pl_PL":{"fb_composer_lessons":"Czego si\u0119 dzisiaj nauczy\u0142e\u015b o przyja\u017ani?","sniff_comment_tooltip_like":"Polub komentarz","sniff_comment_tooltip_unlike":"Nie lubi\u0119 tego komentarza","close":"Zamknij"},"ps_AF":[],"pt_BR":{"fb_composer_lessons":"Quais li\u00e7\u00f5es sobre amizade voc\u00ea aprendeu hoje?","sniff_comment_tooltip_like":"Curtir este coment\u00e1rio","sniff_comment_tooltip_unlike":"Curtir (desfazer) este coment\u00e1rio","close":"Fechar"},"pt_PT":{"fb_composer_lessons":"Que li\u00e7\u00f5es de amizade voc\u00ea aprendeu hoje?","sniff_comment_tooltip_like":"Gosto deste coment\u00e1rio","sniff_comment_tooltip_unlike":"N\u00e3o gosto deste coment\u00e1rio","close":"Fechar"},"ro_RO":{"fb_composer_lessons":"Ce lec\u0163ii despre prietenie ai \u00eenv\u0103\u0163at ast\u0103zi?","sniff_comment_tooltip_like":"\u00cemi place acest comentariu","sniff_comment_tooltip_unlike":"Nu-mi mai place acest comentariu","close":"\u00cenchide"},"ru_RU":{"fb_composer_lessons":"\u041a\u0430\u043a\u0438\u0435 \u0443\u0440\u043e\u043a\u0438 \u0434\u0440\u0443\u0436\u0431\u044b \u0432\u044b \u0432\u044b\u0443\u0447\u0438\u043b\u0438 \u0441\u0435\u0433\u043e\u0434\u043d\u044f?","sniff_comment_tooltip_like":"\u041c\u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439","sniff_comment_tooltip_unlike":"\u041d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f","close":"\u0417\u0430\u043a\u0440\u044b\u0442\u044c"},"sk_SK":{"fb_composer_lessons":"Ak\u00e9 lekcie priate\u013estva si sa nau\u010dil dnes?","sniff_comment_tooltip_like":"P\u00e1\u010di sa mi tento koment\u00e1r","sniff_comment_tooltip_unlike":"Tento koment\u00e1r sa mi u\u017e nep\u00e1\u010di","close":"Zavrie\u0165"},"sl_SI":{"fb_composer_lessons":"Kaj si se o prijateljstvu nau\u010dil\/-a danes?","sniff_comment_tooltip_like":"V\u0161e\u010d mi je","sniff_comment_tooltip_unlike":"Ta komentar mi ni v\u0161e\u010d","close":"Zapri"},"sq_AL":{"sniff_comment_tooltip_like":"P\u00eblqeje k\u00ebt\u00eb koment","sniff_comment_tooltip_unlike":"Mos p\u00eblqe k\u00ebt\u00eb koment"},"sr_RS":{"sniff_comment_tooltip_like":"\u0421\u0432\u0438\u0452\u0430 \u043c\u0438 \u0441\u0435 \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440.","sniff_comment_tooltip_unlike":"\u041d\u0435 \u0441\u0432\u0438\u0452\u0430 \u043c\u0438 \u0441\u0435 \u043e\u0432\u0430\u0458 \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440","close":"\u0417\u0430\u0442\u0432\u043e\u0440\u0438"},"sv_SE":{"fb_composer_lessons":"Vilka l\u00e4rdomar i v\u00e4nskap har du l\u00e4rt dig idag?","sniff_comment_tooltip_like":"Gilla den h\u00e4r kommentaren","sniff_comment_tooltip_unlike":"Sluta gilla den h\u00e4r kommentaren","close":"St\u00e4ng"},"sw_KE":[],"ta_IN":{"sniff_comment_tooltip_like":"\u0b87\u0b95\u0bcd\u0b95\u0bb0\u0bc1\u0ba4\u0bcd\u0ba4\u0bbf\u0ba9\u0bc8 \u0bb5\u0bbf\u0bb0\u0bc1\u0bae\u0bcd\u0baa\u0bc1\u0b95\u0bbf\u0bb1\u0bc7\u0ba9\u0bcd","sniff_comment_tooltip_unlike":"\u0b87\u0b95\u0bcd\u0b95\u0bb0\u0bc1\u0ba4\u0bcd\u0ba4\u0bbf\u0ba9\u0bc8 \u0bb5\u0bbf\u0bb0\u0bc1\u0bae\u0bcd\u0baa\u0bb5\u0bbf\u0bb2\u0bcd\u0bb2\u0bc8","close":"\u0e1b\u0e34\u0e14"},"te_IN":{"sniff_comment_tooltip_unlike":"\u0c35\u0c4d\u0c2f\u0c3e\u0c16\u0c4d\u0c2f \u0c28\u0c1a\u0c4d\u0c1a\u0c32\u0c47\u0c26\u0c41"},"th_TH":{"sniff_comment_tooltip_like":"\u0e16\u0e39\u0e01\u0e43\u0e08\u0e04\u0e27\u0e32\u0e21\u0e04\u0e34\u0e14\u0e40\u0e2b\u0e47\u0e19\u0e19\u0e35\u0e49","sniff_comment_tooltip_unlike":"\u0e40\u0e25\u0e34\u0e01\u0e16\u0e39\u0e01\u0e43\u0e08\u0e04\u0e27\u0e32\u0e21\u0e04\u0e34\u0e14\u0e40\u0e2b\u0e47\u0e19\u0e19\u0e35\u0e49"},"tl_PH":{"fb_composer_lessons":"Anong mga aralin sa pagkakaibigan ang natutunan mo ngayon?","sniff_comment_tooltip_like":"Gustuhin ang komentong ito","sniff_comment_tooltip_unlike":"Ayawan ang komentong ito","close":"Isara"},"tr_TR":{"fb_composer_lessons":"Bug\u00fcn arkada\u015fl\u0131kla ilgili neler \u00f6\u011frendin?","sniff_comment_tooltip_like":"Bu yorumu be\u011fen","sniff_comment_tooltip_unlike":"Bu yorumu be\u011fenmekten vazge\u00e7","close":"Kapat"},"uk_UA":{"fb_composer_lessons":"\u042f\u043a\u0456 \u0443\u0440\u043e\u043a\u0438 \u0432 \u0434\u0440\u0443\u0436\u0431\u0456 \u0432\u0438 \u0434\u0456\u0437\u043d\u0430\u043b\u0438\u0441\u044f \u0441\u044c\u043e\u0433\u043e\u0434\u043d\u0456?","sniff_comment_tooltip_like":"\u0412\u043f\u043e\u0434\u043e\u0431\u0430\u0442\u0438 \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440","sniff_comment_tooltip_unlike":"\u041d\u0435 \u043f\u043e\u0434\u043e\u0431\u0430\u0454\u0442\u044c\u0441\u044f \u043a\u043e\u043c\u0435\u043d\u0442\u0430\u0440","close":"\u0417\u0430\u043a\u0440\u0438\u0442\u0438"},"vi_VN":{"sniff_comment_tooltip_like":"Th\u00edch b\u00ecnh lu\u1eadn n\u00e0y","sniff_comment_tooltip_unlike":"B\u1ecf th\u00edch b\u00ecnh lu\u1eadn n\u00e0y n\u1eefa"},"zh_CN":{"sniff_comment_tooltip_like":"\u559c\u6b22\u6b64\u8bc4\u8bba","sniff_comment_tooltip_unlike":"\u4e0d\u559c\u6b22\u6b64\u8bc4\u8bba","close":"\u5173\u95ed"},"zh_HK":{"sniff_comment_tooltip_like":"\u5c0d\u9019\u5247\u7559\u8a00\u8b9a\u597d","sniff_comment_tooltip_unlike":"\u53d6\u6d88\u8b9a\u597d"},"zh_TW":{"fb_composer_lessons":"\u4f60\u4eca\u5929\u5f9e\u53cb\u60c5\u88e1\u9762\u5b78\u5230\u4e86\u4ec0\u9ebc\uff1f","sniff_comment_tooltip_like":"\u8aaa\u9019\u5247\u7559\u8a00\u8b9a","sniff_comment_tooltip_unlike":"\u6536\u56de\u8b9a","close":"\u95dc\u9589"}};
1216 var SOUNDS = {"AUTO":{"name":"(Auto-select)","seperator":true},"_sound\/defaultNotification":{"name":"Casting magic","title":"This will also be used for characters that do not have their own notification sound"},"trixie\/notif":{"name":"Trixie - Watch in awe!"},"dash\/notif":{"name":"Rainbow Dash - Aww yeah!"},"pinkie\/notif2":{"name":"Pinkie Pie - *rimshot*"},"applej\/notif":{"name":"Applejack - Yeehaw!"},"flutter\/notif2":{"name":"Fluttershy - Yay!"},"rarity\/notif":{"name":"Rarity - This is whining!"},"applebloom\/notif":{"name":"Apple Bloom - That'll be four bits"},"bigmac\/notif":{"name":"Big Macintosh - Eeyup"},"colgate\/notif":{"name":"Colgate - Why you don't brush your teeth"},"derpy\/notif":{"name":"Derpy Hooves - I brought you a letter!"},"luna\/notif":{"name":"Luna - Huzzah!"},"_sound\/roidrage_yeah":{"name":"Roid Rage\/Snowflake - YEAH!"},"sweetieb\/notif":{"name":"Sweetie Belle - Oh come on!"},"vinyl\/notif":{"name":"Vinyl Scratch - Yeah!","seperator":true},"twilight\/notif":{"name":"Twilight Sparkle - It's not over yet!"},"_sound\/grin2":{"name":"Fluttershy - *squee*"},"_sound\/dash_dundundun":{"name":"Rainbow Dash - DUN DUN DUN"},"_sound\/dash_egghead":{"name":"Rainbow Dash - I'm an egghead"},"_sound\/pinkie_boring":{"name":"Pinkie Pie - Booooring!"},"_sound\/pinkie_gasp":{"name":"Pinkie Pie - *gasp*"},"_sound\/pinkie_partycannon":{"name":"Pinkie Pie - Party cannon"},"_sound\/pinkie_pinkiepiestyle":{"name":"Pinkie Pie - Pinkie Pie style!"},"_sound\/flutter_woohoo":{"name":"Fluttershy - Woo hoo"},"_sound\/rarity_dumbrock":{"name":"Rarity - Dumb rock!"},"_sound\/rarity_itison":{"name":"Rarity - Oh. It. Is. On!"},"_sound\/rarity_wahaha":{"name":"Rarity - Wahaha!"},"_sound\/octavia_nevermess":{"name":"Octavia - Never mess with Octavia"},"_sound\/vinyl_awyeah":{"name":"Vinyl Scratch - Aw yeah!"},"_sound\/vinyl_mybasscannon":{"name":"Vinyl Scratch - My bass cannon!"},"_sound\/vinyl_wubwubwub":{"name":"Vinyl Scratch - Wubwubwub"},"_sound\/vinyl_wubedubdub":{"name":"Vinyl Scratch - Wubedubdub"},"_sound\/vinyl_yougotwubs":{"name":"Vinyl Scratch - You got wubs"}};
1217 var SOUNDS_CHAT = {"_sound\/grin2":{"name":"Fluttershy - *squee*"},"_sound\/chat_boing":{"name":"Boing"}};
1218 var HTMLCLASS_SETTINGS = ['login_bg', 'show_messages_other', 'disable_animation', 'pinkieproof', 'disable_emoticons'];
1219 var DEFAULTSETTINGS = {
1220 'theme':CURRENTPONY,
1221 'login_bg':false, 'customBg':null, //'allowLoginScreen':true,
1222 'sounds':false, 'soundsFile':'AUTO', 'soundsNotifTypeBlacklist':'', 'soundsVolume':1, 'chatSound':true, 'chatSoundFile':'_sound/grin2',
1223 'show_messages_other':true, 'pinkieproof':false, 'forceEnglish':false, 'disable_emoticons':false, 'randomPonies':'', 'costume': '', //'commentBrohoofed':true,
1224 'disable_animation':false, 'disableDomNodeInserted':false, //'disableCommentBrohoofed':false,
1225 'customcss':'', 'debug_dominserted_console':false, 'debug_slow_load':false, 'debug_disablelog':false, 'debug_noMutationObserver':false, 'debug_mutationDebug':false, 'debug_exposed':false, 'debug_betaFacebookLinks':false //,'debug_mutationObserver':false,
1226 //'lastVersion':''
1227
1228 //'survivedTheNight', 'chatSound1401', 'randomSettingMigrated'
1229 };
1230 var STACKS_LANG = [{"stack":"pony","people":"ponies","person":"pony","friend":"pal","friends":"pals","friend_logic":"pal","friends_logic":"pals","like":"brohoof","likes":"brohoofs","unlike":"unbrohoof","like_past":"brohoof","likes_past":"brohoofs","liked":"brohoof'd","liked_button":"brohoof'd","liking":"brohoofing"},{"stack":"chrysalis","people":"changelings","person":"changeling","friend":"prey","friends":"prey","friend_logic":"changeling","friends_logic":"changelings","like":"feed","likes":"feeds","unlike":"unfeed","like_past":"fed on","likes_past":"fed on","liked":"fed on","liked_button":"fed","liking":"feeding"},{"stack":"villian","people":"ponies","person":"pony","friend":"pal","friends":"pals","friend_logic":"pal","friends_logic":"pals","like":"brohoof","likes":"brohoofs","unlike":"unbrohoof","like_past":"brohoof","likes_past":"brohoofs","liked":"brohoof'd","liked_button":"brohoof'd","liking":"brohoofing"}];
1231 var CURRENTSTACK = STACKS_LANG[0];
1232 var COSTUMESX = {"winterwrapup":{"name":"Winter Wrap Up","characters":["twilight","dash","pinkie","applej","flutter","rarity","derpy"]},"nightmarenight":{"name":"Nightmare Night","characters":["twilight","dash","pinkie","applej","flutter","applebloom","bigmac","derpy","luna","scootaloo","spike","sweetieb","zecora"]},"hearthwarming":{"name":"Hearth's Warming","characters":["twilight","dash","pinkie","applej","flutter","rarity"]},"season3premiere":{"name":"Season 3 Premiere","characters":["twilight","rarity"]},"crystal":{"name":"Crystal Pony","characters":["twilight","dash","pinkie","applej","flutter","rarity","cadance"]},"wedding":{"name":"Canterlot Wedding","characters":["sweetieb"]},"coronation":{"name":"Princess Coronation Dresses","characters":["dash","pinkie","applej","flutter","rarity","cadance"]},"princess":{"name":"Princess Twilight Sparkle","characters":["twilight"]}};
1233 var SOUNDS_NOTIFTYPE = {
1234 poke: {name:"Nuzzles", type:"poke"}
1235 ,like: {name:"Brohoofs", type:"like"}
1236 ,group_activity: {name:"New posts in herds and tags about you", type:"group_activity"}
1237 ,group_r2j: {name:"Herd join requests", type:"group_r2j"}
1238 ,group_added_to_group: {name:"Herd invites from friends", type:"group_added_to_group"}
1239 ,plan_reminder: {name:"Adventure reminders", type:"plan_reminder"}
1240 ,follow_profile: {name:"New followers", type:"follow_profile"}
1241 //,photo_made_profile_pic: {name:"Made your pony pic his/her profile picture", type:"photo_made_profile_pic"}
1242 ,answers_answered: {name:"New answers on the Facebook Help Center", type:"answers_answered"}
1243
1244 ,app_invite: {name:"Game/app requests", type:"app_invite"}
1245 ,close_friend_activity: {name:"Posts from Close Friends", type:"close_friend_activity"}
1246 ,notify_me: {name:"Page posts that you subscribed to", type:"notify_me"}
1247
1248 //,fbpage_presence: {name:"Facebook nagging you to post to your page", type:"fbpage_presence"}
1249 ,fbpage_fan_invite: {name:"Page invites from friends", type:"fbpage_fan_invite"}
1250 ,page_new_likes: {name:"New page brohoofs", type:"page_new_likes"}
1251 //,fbpage_new_message: {name:"New private messages on your page", type:"fbpage_new_message"}
1252 };
1253
1254 var THEMEURL = w.location.protocol + '//hoof.little.my/files/';
1255 var THEMECSS = THEMEURL+'';
1256 var THEMECSS_EXT = '.css?userscript_version='+VERSION;
1257 var UPDATEURL = w.location.protocol + '//hoof.little.my/files/update_check.js?' + (+new Date());
1258
1259 var PONYHOOF_PAGE = '197956210325433';
1260 var PONYHOOF_URL = '//'+getFbDomain()+'/Ponyhoof';
1261 var PONYHOOF_README = '//hoof.little.my/files/_welcome/readme.htm?version='+VERSION+'&distribution='+DISTRIBUTION;
1262
1263 var _ext_messageId = 0;
1264 var _ext_messageCallback = {};
1265
1266 // Chrome
1267 var chrome_sendMessage = function(message, callback) {
1268 try {
1269 if (chrome.extension.sendMessage) {
1270 chrome.extension.sendMessage(message, callback);
1271 } else {
1272 chrome.extension.sendRequest(message, callback);
1273 }
1274 } catch (e) {
1275 if (e.toString().indexOf('Error: Error connecting to extension ') === 0) {
1276 extUpdatedError(e.toString());
1277 }
1278 throw e;
1279 }
1280 };
1281
1282 var chrome_storageFallback = false;
1283 var chrome_getValue = function(name, callback) {
1284 if (chrome.storage && !chrome_storageFallback) {
1285 if (chrome_isExtUpdated()) {
1286 extUpdatedError("[chrome_getValue("+name+")]");
1287 callback(null);
1288 return;
1289 }
1290
1291 chrome.storage.local.get(name, function(item) {
1292 if (chrome.runtime && chrome.runtime.lastError) {
1293 // Fallback to old storage method
1294 chrome_storageFallback = true;
1295 chrome_getValue(name, callback);
1296 return;
1297 }
1298
1299 if (Object.keys(item).length === 0) {
1300 callback(null);
1301 return;
1302 }
1303 callback(item[name]);
1304 });
1305 return;
1306 }
1307
1308 try {
1309 chrome_sendMessage({'command':'getValue', 'name':name}, function(response) {
1310 if (response && typeof response.val != 'undefined') {
1311 callback(response.val);
1312 } else {
1313 callback(null);
1314 }
1315 });
1316 } catch (e) {
1317 dir(e);
1318 getValueError(e);
1319 callback(null);
1320 }
1321 };
1322
1323 var chrome_setValue = function(name, val) {
1324 if (chrome.storage && !chrome_storageFallback) {
1325 if (chrome_isExtUpdated()) {
1326 extUpdatedError("[chrome_setValue("+name+")]");
1327 return;
1328 }
1329
1330 var toSet = {};
1331 toSet[name] = val;
1332 chrome.storage.local.set(toSet, function() {
1333 if (chrome.runtime && chrome.runtime.lastError) {
1334 saveValueError(chrome.runtime.lastError);
1335 return;
1336 }
1337 });
1338 return;
1339 }
1340
1341 chrome_sendMessage({'command':'setValue', 'name':name, 'val':val}, function() {});
1342 };
1343
1344 var chrome_clearStorage = function() {
1345 if (chrome.storage) {
1346 chrome.storage.local.clear();
1347 }
1348 chrome_sendMessage({'command':'clearStorage'}, function() {});
1349 };
1350
1351 var chrome_ajax = function(details) {
1352 chrome_sendMessage({'command': 'ajax', 'details': details}, function(response) {
1353 if (response.val == 'success') {
1354 if (details.onload) {
1355 details.onload(response.request);
1356 }
1357 } else {
1358 if (details.onerror) {
1359 details.onerror(response.request);
1360 }
1361 }
1362 });
1363 };
1364
1365 var chrome_isExtUpdated = function() {
1366 return (typeof chrome.i18n === 'undefined' || typeof chrome.i18n.getMessage('@@extension_id') === 'undefined');
1367 };
1368
1369 if (ISOPERA) {
1370 if (opera.extension) {
1371 opera.extension.onmessage = function(message) {
1372 if (message.data) {
1373 var response = message.data;
1374 var callback = _ext_messageCallback[response.messageid];
1375 if (callback) {
1376 callback(response.val);
1377 }
1378 }
1379 }
1380 }
1381
1382 var opera_getValue = function(name, callback) {
1383 _ext_messageCallback[_ext_messageId] = callback;
1384 opera.extension.postMessage({'command':'getValue', 'messageid':_ext_messageId, 'name':name});
1385 _ext_messageId += 1;
1386 };
1387
1388 var opera_setValue = function(name, val) {
1389 opera.extension.postMessage({'command':'setValue', 'name':name, 'val':val});
1390 };
1391
1392 var opera_clearStorage = function() {
1393 opera.extension.postMessage({'command':'clearStorage'});
1394 };
1395
1396 var opera_ajax = function(details) {
1397 _ext_messageCallback[_ext_messageId] = function(response) {
1398 if (response.val == 'success') {
1399 if (details.onload) {
1400 details.onload(response.request);
1401 }
1402 } else {
1403 if (details.onerror) {
1404 details.onerror(response.request);
1405 }
1406 }
1407 };
1408 var detailsX = {
1409 'method': details.method
1410 ,'url': details.url
1411 ,'headers': details.headers
1412 ,'data': details.data
1413 };
1414 opera.extension.postMessage({'command':'ajax', 'messageid':_ext_messageId, 'details':detailsX});
1415 _ext_messageId += 1;
1416 };
1417 }
1418
1419 if (ISSAFARI) {
1420 if (typeof safari != 'undefined') {
1421 safari.self.addEventListener('message', function(message) {
1422 var data = message.message;
1423 if (data) {
1424 var response = data;
1425 var callback = _ext_messageCallback[message.name];
1426 if (callback) {
1427 callback(response.val);
1428 }
1429 }
1430 });
1431 }
1432
1433 var safari_getValue = function(name, callback) {
1434 _ext_messageId = md5(Math.random().toString()); // safari, you don't know what's message passing/callbacks, do you?
1435 _ext_messageCallback[_ext_messageId] = callback;
1436 safari.self.tab.dispatchMessage('getValue', {'messageid':_ext_messageId, 'name':name});
1437 //_ext_messageId += 1;
1438 };
1439
1440 var safari_setValue = function(name, val) {
1441 safari.self.tab.dispatchMessage('setValue', {'name':name, 'val':val});
1442 };
1443
1444 var safari_clearStorage = function() {
1445 safari.self.tab.dispatchMessage('clearStorage', {});
1446 };
1447
1448 var safari_ajax = function(details) {
1449 _ext_messageId = md5(Math.random().toString());
1450 _ext_messageCallback[_ext_messageId] = function(response) {
1451 if (response.val == 'success') {
1452 if (details.onload) {
1453 details.onload(response.request);
1454 }
1455 } else {
1456 if (details.onerror) {
1457 details.onerror(response.request);
1458 }
1459 }
1460 };
1461 var detailsX = {
1462 'method': details.method
1463 ,'url': details.url
1464 ,'headers': details.headers
1465 ,'data': details.data
1466 };
1467 safari.self.tab.dispatchMessage('ajax', {'messageid':_ext_messageId, 'details':detailsX});
1468 //_ext_messageId += 1;
1469 };
1470 }
1471
1472 if (typeof self != 'undefined' && typeof self.on != 'undefined') {
1473 self.on('message', function(message) {
1474 var data = message;
1475 if (data) {
1476 var response = data;
1477 var callback = _ext_messageCallback[message.messageid];
1478 if (callback) {
1479 callback(response.val);
1480 }
1481 }
1482 });
1483
1484 var xpi_getValue = function(name, callback) {
1485 _ext_messageCallback[_ext_messageId] = callback;
1486 self.postMessage({'command':'getValue', 'messageid':_ext_messageId, 'name':name});
1487 _ext_messageId += 1;
1488 };
1489
1490 var xpi_setValue = function(name, val) {
1491 self.postMessage({'command':'setValue', 'name':name, 'val':val});
1492 };
1493
1494 var xpi_clearStorage = function() {
1495 self.postMessage({'command':'clearStorage'});
1496 };
1497
1498 var xpi_ajax = function(details) {
1499 _ext_messageCallback[_ext_messageId] = function(response) {
1500 if (response.val == 'success') {
1501 if (details.onload) {
1502 details.onload(response.request);
1503 }
1504 } else {
1505 if (details.onerror) {
1506 details.onerror(response.request);
1507 }
1508 }
1509 };
1510 var detailsX = {
1511 'method': details.method
1512 ,'url': details.url
1513 ,'headers': details.headers
1514 ,'data': details.data
1515 };
1516 self.postMessage({'command':'ajax', 'messageid':_ext_messageId, 'details':detailsX});
1517 _ext_messageId += 1;
1518 };
1519
1520 var xpi_sendMessage = function(message, callback) {
1521 _ext_messageCallback[_ext_messageId] = callback;
1522 message.messageid = _ext_messageId;
1523 self.postMessage(message);
1524 _ext_messageId += 1;
1525 };
1526 }
1527
1528 if (typeof w.external != 'undefined' && typeof w.external.mxGetRuntime != 'undefined') {
1529 var maxthonRuntime = w.external.mxGetRuntime();
1530 maxthonRuntime.listen('messageContentScript', function(message) {
1531 var data = message;
1532 if (data) {
1533 var response = data;
1534 var callback = _ext_messageCallback[message.messageid];
1535 if (callback) {
1536 callback(response.val);
1537 }
1538 }
1539 });
1540
1541 var mxaddon_getValue = function(name, callback) {
1542 try {
1543 callback(maxthonRuntime.storage.getConfig(name));
1544 } catch (e) {
1545 if (e.message && e.message === 'No LocalStorage Service Extension! (206)') {
1546 extUpdatedError(e.message);
1547 }
1548 throw e;
1549 }
1550 };
1551
1552 var mxaddon_setValue = function(name, val) {
1553 try {
1554 maxthonRuntime.storage.setConfig(name, val);
1555 } catch (e) {
1556 if (e.message && e.message === 'No LocalStorage Service Extension! (206)') {
1557 extUpdatedError(e.message);
1558 }
1559 throw e;
1560 }
1561 };
1562
1563 var mxaddon_clearStorage = function() {
1564 // Maxthon does not have a clear storage function
1565 };
1566
1567 var mxaddon_ajax = function(details) {
1568 _ext_messageCallback[_ext_messageId] = function(response) {
1569 if (response.val == 'success') {
1570 if (details.onload) {
1571 details.onload(response.request);
1572 }
1573 } else {
1574 if (details.onerror) {
1575 details.onerror(response.request);
1576 }
1577 }
1578 };
1579 var detailsX = {
1580 'method': details.method
1581 ,'url': details.url
1582 ,'headers': details.headers
1583 ,'data': details.data
1584 };
1585 try {
1586 maxthonRuntime.post('messageBackground', {'command':'ajax', 'messageid':_ext_messageId, 'details':detailsX});
1587 } catch (e) {
1588 if (e.message && e.message === 'No Platform_Message Service Extension! (355)') {
1589 extUpdatedError(e.message);
1590 }
1591 throw e;
1592 }
1593 _ext_messageId += 1;
1594 };
1595 }
1596
1597 function ajax(obj) {
1598 switch (STORAGEMETHOD) {
1599 case 'greasemonkey':
1600 return GM_xmlhttpRequest(obj);
1601
1602 case 'chrome':
1603 return chrome_ajax(obj);
1604
1605 case 'opera':
1606 return opera_ajax(obj);
1607
1608 case 'safari':
1609 return safari_ajax(obj);
1610
1611 case 'xpi':
1612 return xpi_ajax(obj);
1613
1614 case 'mxaddon':
1615 return mxaddon_ajax(obj);
1616
1617 default:
1618 break;
1619 }
1620
1621 throw {
1622 responseXML:''
1623 ,responseText:''
1624 ,readyState:4
1625 ,responseHeaders:''
1626 ,status:-100
1627 ,statusText:'No GM_xmlhttpRequest support'
1628 };
1629 }
1630
1631 function isPonyhoofPage(id) {
1632 if (id == PONYHOOF_PAGE) {
1633 return true;
1634 }
1635 return false;
1636 }
1637
1638 function capitaliseFirstLetter(string) {
1639 return string.charAt(0).toUpperCase() + string.slice(1);
1640 }
1641
1642 // Settings
1643 for (var i in HTMLCLASS_SETTINGS) {
1644 if (!DEFAULTSETTINGS[HTMLCLASS_SETTINGS[i]]) {
1645 DEFAULTSETTINGS[HTMLCLASS_SETTINGS[i]] = false;
1646 }
1647 }
1648 //DEFAULTSETTINGS.show_messages_other = true;
1649 if (ISMOBILE) {
1650 DEFAULTSETTINGS.disable_animation = true;
1651 }
1652
1653 function getValueError(extra) {
1654 if (chrome_isExtUpdatedError(extra)) {
1655 extUpdatedError(extra);
1656 } else {
1657 createSimpleDialog('localStorageError_getValue', "Ponyhoof derp'd", "Whoops, Ponyhoof can't load your settings. Please try again later.<br><br>If you keep seeing this error, please update to the latest version of Ponyhoof if available and <a href=\""+w.location.protocol+PONYHOOF_URL+"\" data-hovercard=\"/ajax/hovercard/page.php?id="+PONYHOOF_PAGE+"\">visit and post to the Ponyhoof page for help</a>.<br><br><code>"+extra+"</code>");
1658 }
1659
1660 trace();
1661 }
1662
1663 function saveValueError(extra) {
1664 var desc = "Whoops, Ponyhoof can't save your settings. Please try again later.";
1665 if (ISFIREFOX && STORAGEMETHOD === 'greasemonkey' && userSettings.customBg) {
1666 desc += "<br><br>This may be caused by a large custom background that you have set. Please try removing it.";
1667 }
1668 desc += "<br><br>If you keep seeing this error, please update to the latest version of Ponyhoof if available and <a href=\""+w.location.protocol+PONYHOOF_URL+"\" data-hovercard=\"/ajax/hovercard/page.php?id="+PONYHOOF_PAGE+"\">visit and post to the Ponyhoof page for help</a>.<br><br><code>"+extra+"</code>";
1669 createSimpleDialog('localStorageError_saveValue', "Ponyhoof derp'd", desc);
1670
1671 trace();
1672 }
1673
1674 function ponyhoofError(extra) {
1675 createSimpleDialog('ponyhoofError', "Ponyhoof derp'd", "Whoops, Ponyhoof encountered an internal error. Please try again later.<br><br>If you keep seeing this error, please update to the latest version of Ponyhoof if available and <a href=\""+w.location.protocol+PONYHOOF_URL+"\" data-hovercard=\"/ajax/hovercard/page.php?id="+PONYHOOF_PAGE+"\">visit and post to the Ponyhoof page for help</a>.<br><br><code>"+extra+"</code>");
1676
1677 trace();
1678 }
1679
1680 var chrome_isExtUpdatedError = function(message) {
1681 var a = 'ModuleSystem has been deleted';
1682 var b = 'TypeError: Cannot read property \'sendMessage\' of undefined';
1683 return (message === a || message === b);
1684 };
1685
1686 var extUpdatedError = function(extra) {
1687 createSimpleDialog('localStorageError_extUpdatedError', "Ponyhoof derp'd", "Ponyhoof has been updated/disabled recently. Please reload the page in order for Ponyhoof to work properly.<br><br><code>"+extra+"</code>");
1688 };
1689
1690 function getValue(name, callback) {
1691 switch (STORAGEMETHOD) {
1692 case 'greasemonkey':
1693 callback(GM_getValue(name));
1694 break;
1695
1696 case 'chrome':
1697 chrome_getValue(name, callback);
1698 break;
1699
1700 case 'opera':
1701 opera_getValue(name, callback);
1702 break;
1703
1704 case 'safari':
1705 safari_getValue(name, callback);
1706 break;
1707
1708 case 'xpi':
1709 xpi_getValue(name, callback);
1710 break;
1711
1712 case 'mxaddon':
1713 mxaddon_getValue(name, callback);
1714 break;
1715
1716 case 'localstorage':
1717 default:
1718 name = 'ponyhoof_'+name;
1719 callback(w.localStorage.getItem(name));
1720 break;
1721 }
1722 }
1723
1724 function saveValue(name, v) {
1725 switch (STORAGEMETHOD) {
1726 case 'greasemonkey':
1727 GM_setValue(name, v);
1728 break;
1729
1730 case 'chrome':
1731 chrome_setValue(name, v);
1732 break;
1733
1734 case 'opera':
1735 opera_setValue(name, v);
1736 break;
1737
1738 case 'safari':
1739 safari_setValue(name, v);
1740 break;
1741
1742 case 'xpi':
1743 xpi_setValue(name, v);
1744 break;
1745
1746 case 'mxaddon':
1747 mxaddon_setValue(name, v);
1748 break;
1749
1750 case 'localstorage':
1751 default:
1752 name = 'ponyhoof_'+name;
1753 w.localStorage.setItem(name, v);
1754 break;
1755 }
1756 }
1757
1758 function loadSettings(callback, opts) {
1759 // opts => prefix, defaultsettings
1760 var opts = opts || {prefix:null};
1761 var settingsKey = 'settings';
1762 if (opts.prefix != null) {
1763 settingsKey = opts.prefix+settingsKey;
1764 } else {
1765 settingsKey = SETTINGSPREFIX+settingsKey;
1766 }
1767 if (!opts.defaultSettings) {
1768 opts.defaultSettings = DEFAULTSETTINGS;
1769 }
1770
1771 try {
1772 getValue(settingsKey, function(s) {
1773 if (s) {
1774 s = JSON.parse(s);
1775 if (!s) {
1776 s = {};
1777 }
1778 } else {
1779 s = {};
1780 }
1781 for (var i in opts.defaultSettings) {
1782 if (!s.hasOwnProperty(i)) {
1783 s[i] = opts.defaultSettings[i];
1784 }
1785 }
1786 callback(s);
1787 });
1788 } catch (e) {
1789 dir(e);
1790
1791 var extra = '';
1792 if (e.message) {
1793 extra = e.message;
1794 } else {
1795 extra = e.toString();
1796 }
1797 try {
1798 getValueError(extra);
1799 } catch (e) {
1800 onPageReady(function() {
1801 if (d.body) {
1802 getValueError(extra);
1803 }
1804 });
1805 }
1806 callback();
1807 return false;
1808 }
1809 }
1810
1811 function saveSettings(opts) {
1812 // opts => prefix, settings
1813 var opts = opts || {prefix:null, settings:userSettings};
1814 var settingsKey = 'settings';
1815 if (opts.prefix != null) {
1816 settingsKey = opts.prefix+settingsKey;
1817 } else {
1818 settingsKey = SETTINGSPREFIX+settingsKey;
1819 }
1820 var settings = userSettings;
1821 if (opts.settings) {
1822 settings = opts.settings;
1823 }
1824
1825 try {
1826 saveValue(settingsKey, JSON.stringify(settings));
1827 return true;
1828 } catch (e) {
1829 dir(e);
1830
1831 var extra = '';
1832 if (e.message) {
1833 if (e.message == 'ModuleSystem has been deleted' || e.message == 'TypeError: Cannot read property \'sendMessage\' of undefined') {
1834 extUpdatedError(e.message);
1835 callback();
1836 return;
1837 }
1838
1839 extra = e.message;
1840 } else {
1841 extra = e.toString();
1842 }
1843 saveValueError(extra);
1844 return false;
1845 }
1846 }
1847
1848 var saveGlobalSettings = function() {
1849 saveSettings({prefix:'global_', settings:globalSettings});
1850 };
1851
1852 function statTrack(stat) {
1853 var i = d.createElement('iframe');
1854 i.style.position = 'absolute';
1855 i.style.top = '-9999px';
1856 i.style.left = '-9999px';
1857 i.setAttribute('aria-hidden', 'true');
1858 i.src = '//hoof.little.my/files/_htm/stat_'+stat+'.htm?version='+VERSION;
1859 d.body.appendChild(i);
1860 }
1861
1862 var canPlayFlash = function() {
1863 return !!w.navigator.mimeTypes['application/x-shockwave-flash'];
1864 };
1865
1866 // Pony selector
1867 var PonySelector = function(p, param) {
1868 var k = this;
1869
1870 if (param) {
1871 k.param = param;
1872 } else {
1873 k.param = {};
1874 }
1875 k.p = p;
1876 k.wrap = null;
1877 k.button = null;
1878
1879 k.oldPony = CURRENTPONY;
1880 k.customClick = function() {};
1881 k.customCheckCondition = false;
1882 k.overrideClickAction = false;
1883 k.saveTheme = true;
1884
1885 k.menu = null;
1886 k.createSelector = function() {
1887 if (k.menu) {
1888 return k.menu;
1889 }
1890
1891 k.injectStyle();
1892
1893 var currentPonyData = convertCodeToData(CURRENTPONY);
1894 var name = "(Nopony)";
1895 if (currentPonyData) {
1896 name = currentPonyData.name;
1897 } else if (CURRENTPONY == 'RANDOM') {
1898 name = "(Random)";
1899 }
1900
1901 var iu = INTERNALUPDATE;
1902 INTERNALUPDATE = true;
1903
1904 k.menu = new Menu('ponies_'+p.id, k.p/*, {checkable:true}*/);
1905 k.button = k.menu.createButton(name);
1906 k.menu.alwaysOverflow = true;
1907 k.menu.createMenu();
1908 k.menu.attachButton();
1909
1910 if (k.allowRandom) {
1911 var check = false;
1912 if (CURRENTPONY == 'RANDOM') {
1913 check = true;
1914 }
1915
1916 k.menu.createMenuItem({
1917 html: "(Random)"
1918 ,title: "To choose which characters to randomize, go to the Misc tab"
1919 ,check: check
1920 ,unsearchable: true
1921 ,onclick: function(menuItem, menuClass) {
1922 CURRENTPONY = 'RANDOM';
1923
1924 changeThemeSmart('RANDOM');
1925 if (k.saveTheme) {
1926 userSettings.theme = 'RANDOM';
1927 saveSettings();
1928 }
1929
1930 menuClass.changeButtonText("(Random)");
1931 menuClass.changeChecked(menuItem);
1932 menuClass.close();
1933
1934 if (k.customClick) {
1935 k.customClick(menuItem, menuClass);
1936 }
1937 }
1938 });
1939 }
1940
1941 if (k.allowRandom) {
1942 k.menu.createSeperator();
1943 }
1944
1945 if (k.param.feature && k.param.feature != -1) {
1946 k._createItem(PONIES[k.param.feature], true);
1947 k.menu.createSeperator();
1948 }
1949
1950 for (var i = 0, len = PONIES.length; i < len; i += 1) {
1951 if (k.param.feature && k.param.feature != -1 && PONIES[k.param.feature].code == PONIES[i].code) {
1952 if (PONIES[i].seperator) {
1953 k.menu.createSeperator();
1954 }
1955 continue;
1956 }
1957
1958 var check = false;
1959 if (k.customCheckCondition) {
1960 if (k.customCheckCondition(PONIES[i].code)) {
1961 check = true;
1962 }
1963 } else {
1964 if (PONIES[i].code == CURRENTPONY) {
1965 check = true;
1966 }
1967 }
1968
1969 k._createItem(PONIES[i], check);
1970
1971 if (PONIES[i].seperator) {
1972 k.menu.createSeperator();
1973 }
1974 }
1975
1976 var img = d.createElement('span');
1977 img.className = 'ponyhoof_loading ponyhoof_show_if_injected ponyhoof_loading_pony';
1978 k.menu.wrap.appendChild(img);
1979
1980 INTERNALUPDATE = iu;
1981 };
1982
1983 k._createItem = function(ponyData, check) {
1984 var unsearchable = false;
1985 if (ponyData.hidden) {
1986 unsearchable = true;
1987 }
1988 var menuItem = k.menu.createMenuItem({
1989 html: ponyData.name
1990 ,title: ponyData.menu_title
1991 ,data: ponyData.code
1992 ,check: check
1993 ,unsearchable: unsearchable
1994 ,searchAlternate: ponyData.search
1995 ,onclick: function(menuItem, menuClass) {
1996 if (!k.overrideClickAction) {
1997 var code = ponyData.code;
1998 CURRENTPONY = code;
1999
2000 changeThemeSmart(code);
2001 if (k.saveTheme) {
2002 userSettings.theme = code;
2003 saveSettings();
2004 }
2005
2006 menuClass.changeButtonText(ponyData.name);
2007 menuClass.changeChecked(menuItem);
2008 menuClass.close();
2009 }
2010
2011 if (k.customClick) {
2012 k.customClick(menuItem, menuClass);
2013 }
2014 }
2015 });
2016 if (ponyData.hidden) {
2017 addClass(menuItem.menuItem, 'ponyhoof_pony_hidden');
2018 }
2019 };
2020
2021 k.injectStyle = function() {
2022 var css = '';
2023 css += 'html .ponyhoof_pony_hidden {display:none;}';
2024 for (var i = 0, len = PONIES.length; i < len; i += 1) {
2025 if (PONIES[i].color) {
2026 css += 'html .ponyhoof_menuitem[data-ponyhoof-menu-data="'+PONIES[i].code+'"]:hover, html .ponyhoof_menuitem[data-ponyhoof-menu-data="'+PONIES[i].code+'"]:active, html .ponyhoof_menuitem[data-ponyhoof-menu-data="'+PONIES[i].code+'"]:focus {background-color:#'+PONIES[i].color[0]+' !important;border-top-color:#'+PONIES[i].color[1]+' !important;border-bottom-color:#'+PONIES[i].color[1]+' !important;}';
2027 }
2028 }
2029
2030 injectManualStyle(css, 'ponySelector');
2031 };
2032 };
2033
2034 // Sounds
2035 var _soundCache = {};
2036 var PonySound = function(id) {
2037 var k = this;
2038 k.id = id;
2039
2040 k.sound = d.createElement('audio');
2041
2042 // Don't loop sounds for 3 seconds
2043 k.wait = 3;
2044 k.respectSettings = true;
2045 k.respectVolumeSetting = true;
2046
2047 k._time = 0;
2048
2049 k.source = '';
2050 k.changeSource = function(source) {
2051 k.source = source;
2052 };
2053
2054 k.changeSourceSmart = function(source) {
2055 if (k.canPlayMp3()) {
2056 source = source.replace(/\.EXT/, '.mp3');
2057 } else if (k.canPlayOgg()) {
2058 source = source.replace(/\.EXT/, '.ogg');
2059 } else {
2060 throw new Error("No supported audio formats");
2061 }
2062
2063 k.changeSource(source);
2064 };
2065
2066 k.play = function() {
2067 if (k.respectSettings) {
2068 if (!userSettings.sounds) {
2069 return;
2070 }
2071 }
2072
2073 if (k.wait == 0) {
2074 k.continuePlaying();
2075 return;
2076 }
2077
2078 // Make sure we aren't playing it on another page already
2079 k._time = Math.floor(Date.now() / 1000);
2080
2081 //try {
2082 getValue(SETTINGSPREFIX+'soundCache', function(s) {
2083 if (typeof s != 'undefined') {
2084 try {
2085 _soundCache = JSON.parse(s);
2086 } catch (e) {
2087 _soundCache = {};
2088 }
2089
2090 if (_soundCache == null) {
2091 _soundCache = {};
2092 }
2093
2094 if (_soundCache[k.id]) {
2095 if (_soundCache[k.id]+k.wait <= k._time) {
2096 } else {
2097 return;
2098 }
2099 }
2100 }
2101
2102 k.continuePlaying();
2103 });
2104 //} catch (e) {
2105 // k.continuePlaying();
2106 //}
2107 };
2108
2109 k.continuePlaying = function() {
2110 if (k.wait) {
2111 _soundCache[k.id] = k._time;
2112 saveValue(SETTINGSPREFIX+'soundCache', JSON.stringify(_soundCache));
2113 }
2114
2115 if (k.respectVolumeSetting) {
2116 k.sound.volume = userSettings.soundsVolume;
2117 }
2118 k.sound.src = k.source;
2119 k.sound.play();
2120 };
2121
2122 // http://html5doctor.com/native-audio-in-the-browser/
2123 k.audioTagSupported = function() {
2124 return !!(k.sound.canPlayType);
2125 };
2126
2127 k.canPlayMp3 = function() {
2128 return !!k.sound.canPlayType && '' != k.sound.canPlayType('audio/mpeg');
2129 };
2130
2131 k.canPlayOgg = function() {
2132 return !!k.sound.canPlayType && '' != k.sound.canPlayType('audio/ogg; codecs="vorbis"');
2133 };
2134 };
2135
2136 var ponySounds = {};
2137 function initPonySound(id, source) {
2138 var source = source || '';
2139
2140 if (ponySounds[id]) {
2141 if (source) {
2142 ponySounds[id].changeSourceSmart(source);
2143 }
2144
2145 return ponySounds[id];
2146 }
2147
2148 var sound = new PonySound(id);
2149
2150 if (!sound.audioTagSupported()) {
2151 throw new Error('No <audio> tag support');
2152 }
2153
2154 if (source) {
2155 sound.changeSourceSmart(source);
2156 }
2157
2158 ponySounds[id] = sound;
2159
2160 return sound;
2161 }
2162
2163 // Updater
2164 var Updater = function() {
2165 var k = this;
2166
2167 k.classChecking = 'ponyhoof_updater_checking';
2168 k.classLatest = 'ponyhoof_updater_latest';
2169 k.classError = 'ponyhoof_updater_error';
2170 k.classNewVersion = 'ponyhoof_updater_newVersion';
2171 k.classVersionNum = 'ponyhoof_updater_versionNum';
2172 k.classUpdateButton = 'ponyhoof_updater_updateNow';
2173
2174 k.update_url = UPDATEURL;
2175
2176 k.update_json = {};
2177
2178 k.checkForUpdates = function() {
2179 loopClassName(k.classUpdateButton, function(ele) {
2180 if (ISSAFARI && STORAGEMETHOD != 'safari') {
2181 // NinjaKit is bugged and only listens to install script requests on page load, no DOMNodeInserted, so we plan to open a new window
2182 ele.target = '_blank';
2183 }
2184
2185 ele.addEventListener('click', k._updateNowButton, false);
2186 });
2187
2188 log("Checking for updates...");
2189 try {
2190 ajax({
2191 method: 'GET'
2192 ,url: k.update_url
2193 ,onload: function(response) {
2194 if (response.status != 200) {
2195 k._onError(response);
2196 return;
2197 }
2198
2199 try {
2200 var json = JSON.parse(response.responseText);
2201 } catch (e) {
2202 k._onError(response);
2203 return;
2204 }
2205
2206 if (json.version > VERSION) {
2207 k._newVersion(json);
2208 } else {
2209 k._noNewVersion();
2210 }
2211 }
2212 ,onerror: function(response) {
2213 k._onError(response);
2214 }
2215 });
2216 } catch (e) {
2217 k._onError(e);
2218 }
2219 };
2220
2221 k._noNewVersion = function() {
2222 // Hide checking for updates
2223 loopClassName(k.classChecking, function(ele) {
2224 ele.style.display = 'none';
2225 });
2226
2227 // Show yay
2228 loopClassName(k.classLatest, function(ele) {
2229 ele.style.display = 'block';
2230 });
2231 };
2232 k._newVersion = function(json) {
2233 k.update_json = json;
2234
2235 // Hide checking for updates
2236 loopClassName(k.classChecking, function(ele) {
2237 ele.style.display = 'none';
2238 });
2239
2240 // Show version number
2241 loopClassName(k.classVersionNum, function(ele) {
2242 ele.textContent = json.version;
2243 });
2244 // Show that we have a new version
2245 loopClassName(k.classNewVersion, function(ele) {
2246 ele.style.display = 'block';
2247 });
2248 // Change the update now button to point to the new link
2249 loopClassName(k.classUpdateButton, function(ele) {
2250 if (ISSAFARI && STORAGEMETHOD != 'safari') {
2251 ele.href = json.safari;
2252 return;
2253 }
2254
2255 switch (STORAGEMETHOD) {
2256 // v1.501
2257 case 'chrome':
2258 ele.href = json.chrome_url;
2259 break;
2260
2261 case 'opera':
2262 ele.href = json.opera_url;
2263 break;
2264
2265 // v1.521
2266 case 'safari':
2267 ele.href = json.safariextz;
2268 break;
2269
2270 // v1.611
2271 case 'xpi':
2272 ele.href = json.xpi;
2273 break;
2274
2275 case 'mxaddon':
2276 // Handled by function
2277 break;
2278
2279 default:
2280 ele.href = json.update_url;
2281 break;
2282 }
2283 });
2284 };
2285 k._onError = function(response) {
2286 // Hide checking for updates
2287 loopClassName(k.classChecking, function(ele) {
2288 ele.style.display = 'none';
2289 });
2290
2291 // Show derp
2292 loopClassName(k.classError, function(ele) {
2293 ele.style.display = 'block';
2294 });
2295
2296 error("Error checking for updates.");
2297 dir(response);
2298 };
2299
2300 k.updateDialog = null;
2301 k._updateNowButton = function() {
2302 statTrack('updateNowButton');
2303
2304 switch (STORAGEMETHOD) {
2305 case 'chrome':
2306 k._cws();
2307 return false;
2308
2309 case 'opera':
2310 k._opera();
2311 return false;
2312
2313 case 'safari':
2314 k.safariInstruction();
2315 return false;
2316
2317 case 'xpi':
2318 k._xpi();
2319 return;
2320
2321 case 'mxaddon':
2322 k.mxaddon();
2323 return;
2324
2325 default:
2326 break;
2327 }
2328
2329 if (DIALOGS.updater_dialog) {
2330 k.updateDialog.show();
2331 return;
2332 }
2333
2334 var c = "The update will load after you reload Facebook.";
2335 if (ISCHROME) { // still localstorage
2336 c = "Click Continue on the bottom of this window and click Add to finish updating. The update will load after you reload Facebook.";
2337 } else if (ISSAFARI) { // still ninjakit
2338 c = "Follow the instructions in the new window and reload Facebook when you are done.";
2339 } else if (ISOPERA) { // still localstorage
2340 c = "Follow the instructions in the new window and reload Facebook when you are done.";
2341 } else if (STORAGEMETHOD == 'greasemonkey') {
2342 c = "Click <strong>Install</strong> when you see this dialog. The update will load after you reload Facebook.<br><br><"+"img src='"+THEMEURL+"_welcome/guide/firefox/install.png' alt='' width='552' height='110' class='ponyhoof_image_shadow'>";
2343 injectManualStyle('#ponyhoof_dialog_updater_dialog .generic_dialog_popup, #ponyhoof_dialog_updater_dialog .popup {width:600px;}', 'updater_dialog');
2344 }
2345
2346 var bottom = '';
2347 bottom += '<div class="lfloat"><a href="#" class="retry hidden_elem">Retry</a></div>';
2348 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm reloadNow" role="button"><span class="uiButtonText">'+CURRENTLANG.reloadNow+'</span></a>';
2349 bottom += '<a href="#" class="uiButton uiButtonLarge notNow" role="button"><span class="uiButtonText">'+CURRENTLANG.notNow+'</span></a>';
2350
2351 k.updateDialog = new Dialog('updater_dialog');
2352 k.updateDialog.alwaysModal = true;
2353 k.updateDialog.create();
2354 k.updateDialog.changeTitle(CURRENTLANG['updater_title']);
2355 k.updateDialog.changeContent(c);
2356 k.updateDialog.changeBottom(bottom);
2357
2358 if (!ISCHROME && STORAGEMETHOD == 'greasemonkey') {
2359 var retry = k.updateDialog.dialog.getElementsByClassName('retry');
2360 if (retry.length) {
2361 retry = retry[0];
2362 retry.href = k.update_json.update_url;
2363 removeClass(retry, 'hidden_elem');
2364 }
2365 }
2366 k._initReloadButtons(k.updateDialog);
2367
2368 return false;
2369 };
2370
2371 k.cwsDialog = null;
2372 k.cwsWaitDialog = null;
2373 k.cwsOneClickSuccess = false;
2374 k._cws = function() {
2375 if (k.cwsWaitDialog) {
2376 k._cws_showDialog();
2377 return;
2378 }
2379
2380 var ok = true;
2381 loopClassName(k.classUpdateButton, function(ele) {
2382 if (hasClass(ele, 'uiButtonDisabled')) {
2383 ok = false;
2384 } else {
2385 addClass(ele, 'uiButtonDisabled');
2386 }
2387 });
2388 if (!ok) {
2389 return;
2390 }
2391
2392 var c = "Updating... <span class='ponyhoof_loading'></span>";
2393 k.cwsWaitDialog = new Dialog('update_cwsWait');
2394 k.cwsWaitDialog.alwaysModal = true;
2395 k.cwsWaitDialog.noBottom = true;
2396 k.cwsWaitDialog.canCloseByEscapeKey = false;
2397 k.cwsWaitDialog.create();
2398 k.cwsWaitDialog.changeTitle(CURRENTLANG['updater_title']);
2399 k.cwsWaitDialog.changeContent(c);
2400
2401 chrome_sendMessage({'command':'checkForUpdates'}, function(status, details) {
2402 if (status == 'update_available') {
2403 var c = "Downloading update... <span class='ponyhoof_loading'></span>";
2404 k.cwsWaitDialog.changeContent(c);
2405 chrome_sendMessage({'command':'onUpdateAvailable'}, function(status) {
2406 if (status == 'updated') {
2407 k.cwsOneClickSuccess = true;
2408
2409 var successText = '';
2410 var ponyData = convertCodeToData(REALPONY);
2411 if (ponyData.successText) {
2412 successText = ponyData.successText;
2413 } else {
2414 successText = "Yay!";
2415 }
2416 var c = successText+" Update complete, reloading... <span class='ponyhoof_loading'></span>";
2417 k.cwsWaitDialog.changeContent(c);
2418
2419 if (!k.cwsDialog) {
2420 chrome_sendMessage({'command':'reloadNow'}, function() {});
2421 w.setTimeout(function() {
2422 w.location.reload();
2423 }, 1000);
2424 }
2425 } else {
2426 k._cws_fallback();
2427 }
2428 });
2429 } else {
2430 k._cws_fallback();
2431 }
2432 });
2433
2434 w.setTimeout(k._cws_fallback, 8000);
2435 };
2436
2437 k._cws_fallback = function() {
2438 if (k.cwsOneClickSuccess) {
2439 return;
2440 }
2441 k.cwsOneClickSuccess = true;
2442
2443 k.cwsWaitDialog.close();
2444 loopClassName(k.classUpdateButton, function(ele) {
2445 removeClass(ele, 'uiButtonDisabled');
2446 });
2447 k._cws_showDialog();
2448 };
2449
2450 k._cws_showDialog = function() {
2451 if (k.cwsDialog) {
2452 k.cwsDialog.show();
2453 return;
2454 }
2455
2456 var header = '';
2457 if (DISTRIBUTION == 'cws') {
2458 if (!ISOPERABLINK) {
2459 header = "Ponyhoof automatically updates from the Chrome Web Store.";
2460 } else {
2461 header = "Ponyhoof automatically updates on Opera.";
2462 }
2463 } else {
2464 header = "Ponyhoof automatically updates on Google Chrome.";
2465 }
2466
2467 var newversion = k.update_json.version;
2468 var c = "<strong>"+header+"</strong><br><br>To update now, go to <a href='#' class='ponyhoof_updater_cws_openExtensions'><strong>about:extensions</strong></a> in the address bar, enable <strong>Developer mode</strong> at the top-right and click <strong>Update extensions now</strong>.";
2469 if (newversion) {
2470 c += "<br><br>Verify that the version changes from "+VERSION+" to "+parseFloat(newversion)+" and reload Facebook.";
2471 }
2472 c += "<br><br><"+"img src='"+THEMEURL+"_welcome/chrome_forceupdate.png' alt='' width='177' height='108' class='ponyhoof_image_shadow'>";
2473
2474 var bottom = '';
2475 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm ponyhoof_updater_cws_openExtensions" role="button"><span class="uiButtonText">Open Extensions</span></a>';
2476 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm reloadNow" role="button"><span class="uiButtonText">'+CURRENTLANG.reloadNow+'</span></a>';
2477 bottom += '<a href="#" class="uiButton uiButtonLarge notNow" role="button"><span class="uiButtonText">'+CURRENTLANG.notNow+'</span></a>';
2478
2479 k.cwsDialog = new Dialog('update_cws');
2480 k.cwsDialog.alwaysModal = true;
2481 k.cwsDialog.create();
2482 k.cwsDialog.changeTitle(CURRENTLANG['updater_title']);
2483 k.cwsDialog.changeContent(c);
2484 k.cwsDialog.changeBottom(bottom);
2485
2486 $$(k.cwsDialog.dialog, '.ponyhoof_updater_cws_openExtensions', function(button) {
2487 button.addEventListener('click', function(e) {
2488 e.preventDefault();
2489 if (!hasClass(this, 'uiButtonDisabled')) {
2490 chrome_sendMessage({'command':'openExtensions'}, function() {});
2491 }
2492 });
2493 });
2494
2495 k._initReloadButtons(k.cwsDialog);
2496 };
2497
2498 k.operaDialog = null;
2499 k._opera = function() {
2500 if ($('ponyhoof_dialog_update_opera')) {
2501 k.operaDialog.show();
2502 return;
2503 }
2504
2505 var version = getBrowserVersion();
2506
2507 var c = '';
2508 if (parseFloat(version.full) >= 12.10) {
2509 c += "<div class='ponyhoof_message uiBoxYellow'>If Opera blocks the update, then <a href='http://jointheherd.little.my' target='_top'>please visit the installer at http://jointheherd.little.my</a> for instructions.</div><br>";
2510 } else {
2511 c += "New versions of Opera will block extensions that aren't from the official Opera Add-ons Gallery. Therefore, please set up Opera to trust our website for future updates.<br><br>";
2512 //c += "If you can't update anymore, then <a href='http://jointheherd.little.my' target='_top'>please visit the installer at http://jointheherd.little.my</a> for instructions.<br><br>";
2513 c += "If you get this security prompt, check <strong>Always allow installation from this location</strong> and click <strong>OK</strong>.<br><br><"+"img src='"+THEMEURL+"_welcome/installv2/install_opera_1.png' alt='' width='385' height='170' class='ponyhoof_image_shadow'><br><br>";
2514 }
2515 c += "Click <strong>Install</strong> when you see this dialog. The update will load after you reload Facebook.<br><br><"+"img src='"+THEMEURL+"_welcome/installv2/install_opera_2.png' alt='' width='316' height='201' class='ponyhoof_image_shadow'>";
2516
2517 var bottom = '';
2518 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm reloadNow" role="button"><span class="uiButtonText">'+CURRENTLANG.reloadNow+'</span></a>';
2519 bottom += '<a href="#" class="uiButton uiButtonLarge notNow" role="button"><span class="uiButtonText">'+CURRENTLANG.notNow+'</span></a>';
2520
2521 k.operaDialog = new Dialog('update_opera');
2522 k.operaDialog.alwaysModal = true;
2523 k.operaDialog.create();
2524 k.operaDialog.changeTitle(CURRENTLANG.updater_title);
2525 k.operaDialog.changeContent(c);
2526 k.operaDialog.changeBottom(bottom);
2527
2528 k._initReloadButtons(k.operaDialog);
2529 };
2530
2531 k.safariDialog = null;
2532 k.safariInstruction = function() {
2533 if (k.safariDialog) {
2534 k.safariDialog.show();
2535 return;
2536 }
2537
2538 injectManualStyle('#ponyhoof_dialog_update_safari .generic_dialog_popup, #ponyhoof_dialog_update_safari .popup {width:600px;}', 'update_safari');
2539
2540 var c = '';
2541 if (w.navigator.userAgent.indexOf('Mac OS X') != -1) {
2542 c += "On the top-right of the Safari window, click on the Downloads button and then double-click <strong>ponyhoof.safariextz</strong><br><br><"+"img src='"+THEMEURL+"_welcome/guide/safari_mac/install_1.png' alt='' width='276' height='201' class='ponyhoof_image_shadow noshadow'><br><br>";
2543 c += "Click <strong>Install</strong>. The update will load after you reload Facebook.<br><br><"+"img src='"+THEMEURL+"_welcome/guide/safari_mac/install_2.png' alt='' width='518' height='285' class='ponyhoof_image_shadow'>";
2544 } else {
2545 c += "When you see this download dialog, click <strong>Open</strong>.<br><br><"+"img src='"+THEMEURL+"_welcome/guide/safari5/install_1.png' alt='' width='500' height='222' class='ponyhoof_image_shadow'><br><br>";
2546 c += "Click <strong>Install</strong>. The update will load after you reload Facebook.<br><br><"+"img src='"+THEMEURL+"_welcome/guide/safari5/install_2.png' alt='' width='524' height='226' class='ponyhoof_image_shadow'>";
2547 }
2548
2549 var bottom = '';
2550 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm reloadNow" role="button"><span class="uiButtonText">'+CURRENTLANG.reloadNow+'</span></a>';
2551 bottom += '<a href="#" class="uiButton uiButtonLarge notNow" role="button"><span class="uiButtonText">'+CURRENTLANG.notNow+'</span></a>';
2552
2553 k.safariDialog = new Dialog('update_safari');
2554 k.safariDialog.alwaysModal = true;
2555 k.safariDialog.create();
2556 k.safariDialog.changeTitle(CURRENTLANG.updater_title);
2557 k.safariDialog.changeContent(c);
2558 k.safariDialog.changeBottom(bottom);
2559
2560 k._initReloadButtons(k.safariDialog);
2561 };
2562
2563 k.xpiDialog = null;
2564 k.xpiWaitDialog = null;
2565 k.xpiOneClickSuccess = false;
2566 k._xpi = function() {
2567 if (k.xpiWaitDialog) {
2568 k._xpi_showDialog();
2569 return;
2570 }
2571
2572 var c = "Updating... <span class='ponyhoof_loading'></span>";
2573 k.xpiWaitDialog = new Dialog('update_xpiWait');
2574 k.xpiWaitDialog.alwaysModal = true;
2575 k.xpiWaitDialog.noBottom = true;
2576 k.xpiWaitDialog.canCloseByEscapeKey = false;
2577 k.xpiWaitDialog.create();
2578 k.xpiWaitDialog.changeTitle(CURRENTLANG['updater_title']);
2579 k.xpiWaitDialog.changeContent(c);
2580
2581 xpi_sendMessage({'command':'checkForUpdates'}, function(val) {
2582 if (val != 'update_available') {
2583 k._xpi_fallback();
2584 return;
2585 }
2586
2587 xpi_sendMessage({'command':'onUpdateAvailable'}, function(val) {
2588 if (!val.status) {
2589 return;
2590 }
2591 var c = '';
2592 switch (val.status) {
2593 case 'onDownloadStarted':
2594 c = "Downloading update...";
2595 break;
2596
2597 case 'onDownloadEnded':
2598 c = "Preparing to install...";
2599 break;
2600
2601 case 'onInstallStarted':
2602 c = "Installing update...";
2603
2604 w.setTimeout(function() {
2605 k.xpiOneClickSuccess = true;
2606
2607 if (!k.xpiDialog) {
2608 var successText = '';
2609 var ponyData = convertCodeToData(REALPONY);
2610 if (ponyData.successText) {
2611 successText = ponyData.successText;
2612 } else {
2613 successText = "Yay!";
2614 }
2615 c = successText+" Update complete, reloading...";
2616 k.xpiWaitDialog.changeContent(c);
2617
2618 w.location.reload();
2619 }
2620 }, 100);
2621 break;
2622
2623 case 'onDownloadFailed':
2624 case 'onInstallFailed':
2625 k._xpi_fallback();
2626 break;
2627
2628 default:
2629 break;
2630 }
2631 if (c) {
2632 c += " <span class='ponyhoof_loading'></span>";
2633 k.xpiWaitDialog.changeContent(c);
2634 }
2635 });
2636 });
2637
2638 w.setTimeout(k._xpi_fallback, 10000);
2639 };
2640
2641 k._xpi_fallback = function() {
2642 if (k.xpiOneClickSuccess) {
2643 return;
2644 }
2645 k.xpiOneClickSuccess = true;
2646
2647 k.xpiWaitDialog.close();
2648 k._xpi_showDialog();
2649 };
2650
2651 k._xpi_showDialog = function() {
2652 var c = '';
2653 c += "Firefox may prompt a security warning at the top-left, click <strong>Allow</strong>.<br><br><"+"img src='"+THEMEURL+"_welcome/guide/firefox/xpi_1_facebook.png' alt='' width='409' height='144' class='ponyhoof_image_shadow'><br>";
2654 c += "When you see the Software Installation dialog, click <strong>Install Now</strong>. The update will load after you reload Facebook, you do not need to restart Firefox.<br><br><"+"img src='"+THEMEURL+"_welcome/guide/firefox/xpi_2.png' alt='' width='400' height='412' class='ponyhoof_image_shadow'>";
2655
2656 var bottom = '';
2657 bottom += '<div class="lfloat hidden_elem"><a href="#" class="retry">Retry</a></div>';
2658 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm reloadNow" role="button"><span class="uiButtonText">'+CURRENTLANG['reloadNow']+'</span></a>';
2659 bottom += '<a href="#" class="uiButton uiButtonLarge notNow" role="button"><span class="uiButtonText">'+CURRENTLANG['notNow']+'</span></a>';
2660
2661 k.xpiDialog = new Dialog('update_xpi');
2662 k.xpiDialog.alwaysModal = true;
2663 k.xpiDialog.create();
2664 k.xpiDialog.changeTitle(CURRENTLANG['updater_title']);
2665 k.xpiDialog.changeContent(c);
2666 k.xpiDialog.changeBottom(bottom);
2667
2668 if (k.update_json.xpi) {
2669 var retry = k.xpiDialog.dialog.getElementsByClassName('retry');
2670 if (retry.length) {
2671 retry = retry[0];
2672 retry.href = k.update_json.xpi;
2673 removeClass(retry.parentNode, 'hidden_elem');
2674 }
2675 k._initReloadButtons(k.xpiDialog);
2676
2677 try {
2678 USW.InstallTrigger.install({
2679 "Ponyhoof": {
2680 URL: k.update_json.xpi
2681 ,IconURL: 'https://hoof.little.my/files/app32.png'
2682 }
2683 });
2684 } catch (e) {
2685 dir(e);
2686 }
2687 }
2688 };
2689
2690 k.mxaddonDialog = null;
2691 k.mxaddon = function() {
2692 if (k.mxaddonDialog) {
2693 k.mxaddonDialog.show();
2694 return;
2695 }
2696
2697 injectManualStyle('#ponyhoof_dialog_update_mxaddon .generic_dialog_popup, #ponyhoof_dialog_update_mxaddon .popup {width:500px;}', 'update_mxaddon');
2698
2699 var c = "Click <strong>Update</strong> when you see this dialog. The update will load after you reload Facebook.<br><br><"+"img src='"+THEMEURL+"_welcome/guide/maxthon/update.png' alt='' width='446' height='419' class='ponyhoof_image_shadow'>";
2700
2701 var bottom = '';
2702 bottom += '<div class="lfloat"><a href="#" class="retry hidden_elem">Retry</a></div>';
2703 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm reloadNow" role="button"><span class="uiButtonText">'+CURRENTLANG['reloadNow']+'</span></a>';
2704 bottom += '<a href="#" class="uiButton uiButtonLarge notNow" role="button"><span class="uiButtonText">'+CURRENTLANG['notNow']+'</span></a>';
2705
2706 k.mxaddonDialog = new Dialog('update_mxaddon');
2707 k.mxaddonDialog.alwaysModal = true;
2708 k.mxaddonDialog.create();
2709 k.mxaddonDialog.changeTitle(CURRENTLANG['updater_title']);
2710 k.mxaddonDialog.changeContent(c);
2711 k.mxaddonDialog.changeBottom(bottom);
2712
2713 var retry = k.mxaddonDialog.dialog.getElementsByClassName('retry');
2714 if (retry.length) {
2715 retry = retry[0];
2716 retry.addEventListener('click', function(e) {
2717 e.preventDefault();
2718 k._mxaddonInstallNow();
2719 }, false);
2720 removeClass(retry, 'hidden_elem');
2721 }
2722 k._initReloadButtons(k.mxaddonDialog);
2723
2724 k._mxaddonInstallNow();
2725 };
2726
2727 k._mxaddonInstallNow = function() {
2728 try {
2729 w.external.mxCall('InstallApp', k.update_json.mxaddon);
2730 } catch (e) {
2731 dir(e);
2732 }
2733 };
2734
2735 k._initReloadButtons = function(dialog) {
2736 $$(dialog.dialog, '.reloadNow', function(ele) {
2737 ele.addEventListener('click', function() {
2738 if (!hasClass(this, 'uiButtonDisabled')) {
2739 dialog.canCloseByEscapeKey = false;
2740 $$(dialog.dialog, '.uiButton', function(ele) {
2741 addClass(ele, 'uiButtonDisabled');
2742 });
2743 w.location.reload();
2744 }
2745 return false;
2746 });
2747 });
2748
2749 $$(dialog.dialog, '.notNow', function(ele) {
2750 ele.addEventListener('click', function() {
2751 if (!hasClass(this, 'uiButtonDisabled')) {
2752 dialog.close();
2753 }
2754 return false;
2755 });
2756 });
2757 };
2758 };
2759
2760 var BrowserPoniesHoof = function() {
2761 var k = this;
2762
2763 k.dialog = null;
2764 k.errorDialog = null;
2765 k.url = 'https://hoof.little.my/_browserponies/';
2766 k.initLoaded = false;
2767 k.ponies = [];
2768 k.ponySelected = 'RANDOM';
2769 k.doneCallback = function() {};
2770
2771 k.selectPoniesMenu = null;
2772 k.selectPoniesButton = null;
2773
2774 k.run = function() {
2775 if (!k.initLoaded) {
2776 k._init(k.run);
2777 return;
2778 }
2779
2780 k.spawnPony(k.ponySelected);
2781
2782 if (k.doneCallback) {
2783 k.doneCallback();
2784 }
2785 };
2786
2787 k._init = function(callback) {
2788 k._getAjax(k.url+'BrowserPoniesBaseConfig.json?userscript_version='+VERSION, function(response) {
2789 try {
2790 var tempPonies = JSON.parse(response.responseText);
2791 } catch (e) {
2792 if (k.errorCallback) {
2793 k.errorCallback(response);
2794 }
2795 return;
2796 }
2797 contentEval("var BrowserPoniesBaseConfig = "+response.responseText);
2798
2799 for (var i = 0, len = tempPonies.ponies.length; i < len; i += 1) {
2800 var pony = tempPonies.ponies[i].ini.split(/\r?\n/);
2801 for (var j = 0, jLen = pony.length; j < jLen; j += 1) {
2802 var temp = pony[j].split(',');
2803 if (temp && temp[0].toLowerCase() == 'name') {
2804 k.ponies.push(temp[1].replace(/\"/g, ''));
2805 break;
2806 }
2807 }
2808 }
2809
2810 k._getAjax(k.url+'browserponies.js?userscript_version='+VERSION, function(response) {
2811 contentEval(response.responseText);
2812 k.initLoaded = true;
2813
2814 contentEval(function(arg) {
2815 try {
2816 (function(cfg) {
2817 if (typeof(window.BrowserPoniesConfig) === "undefined") {
2818 window.BrowserPoniesConfig = {};
2819 }
2820 window.BrowserPonies.setBaseUrl(cfg.baseurl);
2821 if (!window.BrowserPoniesBaseConfig.loaded) {
2822 window.BrowserPonies.loadConfig(window.BrowserPoniesBaseConfig);
2823 window.BrowserPoniesBaseConfig.loaded = true;
2824 }
2825 window.BrowserPonies.loadConfig(cfg);
2826 })({"baseurl":arg.baseurl,"fadeDuration":500,"volume":1,"fps":25,"speed":3,"audioEnabled":false,"showFps":false,"showLoadProgress":true,"speakProbability":0.1});
2827 } catch (e) {
2828 if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
2829 console.log("Unable to hook to BrowserPonies");
2830 console.dir(e);
2831 }
2832 }
2833 }, {"CANLOG":CANLOG, "baseurl":k.url});
2834
2835 callback();
2836 });
2837 });
2838 }
2839
2840 k._getAjax = function(url, callback) {
2841 try {
2842 ajax({
2843 method: 'GET'
2844 ,url: url
2845 ,onload: function(response) {
2846 if (response.status != 200) {
2847 if (k.errorCallback) {
2848 k.errorCallback(response);
2849 }
2850 return;
2851 }
2852
2853 callback(response);
2854 }
2855 ,onerror: function(response) {
2856 if (k.errorCallback) {
2857 k.errorCallback(response);
2858 }
2859 }
2860 });
2861 } catch (e) {
2862 if (k.errorCallback) {
2863 k.errorCallback(e);
2864 }
2865 }
2866 };
2867
2868 k.createDialog = function() {
2869 if ($('ponyhoof_dialog_browserponies')) {
2870 k.dialog.show();
2871 return;
2872 }
2873
2874 k.injectStyle();
2875
2876 var c = '';
2877 c += '<div id="ponyhoof_bp_select"></div><br>';
2878 c += '<a href="#" class="uiButton uiButtonConfirm" role="button" id="ponyhoof_bp_more"><span class="uiButtonText">MORE PONY!</span></a><br><br>';
2879 c += '<a href="#" class="uiButton" role="button" id="ponyhoof_bp_close"><span class="uiButtonText">Hide this</span></a><br><br>';
2880 c += '<a href="#" class="uiButton" role="button" id="ponyhoof_bp_remove"><span class="uiButtonText">Reset</span></a>';
2881
2882 k.dialog = new Dialog('browserponies');
2883 k.dialog.canCloseByEscapeKey = false;
2884 k.dialog.canCardspace = false;
2885 k.dialog.noTitle = true;
2886 k.dialog.noBottom = true;
2887 k.dialog.create();
2888 k.dialog.changeContent(c);
2889
2890 $('ponyhoof_bp_more').addEventListener('click', k.morePonies, false);
2891 $('ponyhoof_bp_close').addEventListener('click', k.closeDialog, false);
2892 $('ponyhoof_bp_remove').addEventListener('click', k.clearAll, false);
2893
2894 k.selectPoniesMenu = new Menu('browserponies_select', $('ponyhoof_bp_select'));
2895 k.selectPoniesMenu.rightFaced = true;
2896 k.selectPoniesMenu.buttonTextClipped = 59;
2897 k.selectPoniesButton = k.selectPoniesMenu.createButton("(Random)");
2898 k.selectPoniesMenu.createMenu();
2899 k.selectPoniesMenu.attachButton();
2900
2901 k.selectPoniesMenu.createMenuItem({
2902 html: "(Random)"
2903 ,check: true
2904 ,unsearchable: true
2905 ,onclick: function(menuItem, menuClass) {
2906 k._select_spawn(menuItem, menuClass, 'RANDOM');
2907 }
2908 });
2909 for (var code in k.ponies) {
2910 if (k.ponies.hasOwnProperty(code)) {
2911 k._select_item(code);
2912 }
2913 }
2914
2915 k.dialog.show();
2916 };
2917
2918 k._select_item = function(code) {
2919 var pony = k.ponies[code];
2920 k.selectPoniesMenu.createMenuItem({
2921 html: pony
2922 ,onclick: function(menuItem, menuClass) {
2923 k._select_spawn(menuItem, menuClass, pony);
2924 }
2925 });
2926 };
2927
2928 k._select_spawn = function(menuItem, menuClass, pony) {
2929 menuClass.changeChecked(menuItem);
2930 menuClass.close();
2931
2932 if (pony == 'RANDOM') {
2933 menuClass.changeButtonText("(Random)");
2934 } else {
2935 menuClass.changeButtonText(pony);
2936 }
2937
2938 k.ponySelected = pony;
2939 k.spawnPony(pony);
2940 };
2941
2942 k.spawnPony = function(pony) {
2943 contentEval(function(arg) {
2944 try {
2945 if (arg.pony == 'RANDOM') {
2946 window.BrowserPonies.spawnRandom();
2947 } else {
2948 window.BrowserPonies.spawn(arg.pony);
2949 }
2950 if (!window.BrowserPonies.running()) {
2951 window.BrowserPonies.start();
2952 }
2953 } catch (e) {
2954 if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
2955 console.log("Unable to hook to BrowserPonies");
2956 console.dir(e);
2957 }
2958 }
2959 }, {"CANLOG":CANLOG, "pony":pony});
2960 };
2961
2962 k.createErrorDialog = function(response) {
2963 createSimpleDialog('browserponies_error', "Browser Ponies derp'd", "Whoops, there was a problem loading Browser Ponies. Please try again later.<br><br>If you keep seeing this error, please update to the latest version of Ponyhoof if available and <a href=\""+w.location.protocol+PONYHOOF_URL+"\" data-hovercard=\"/ajax/hovercard/page.php?id="+PONYHOOF_PAGE+"\">visit and post to the Ponyhoof page for help</a>.");
2964 }
2965
2966 k.injectStyle = function() {
2967 var css = '';
2968 css += '#ponyhoof_dialog_browserponies .generic_dialog {z-index:100000000 !important;}';
2969 css += '#ponyhoof_dialog_browserponies .generic_dialog_popup {width:'+(88+8+8+8+10+10)+'px;margin:'+(38+8)+'px 8px 0 auto;}';
2970 css += 'body.hasSmurfbar #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-top:'+(42+8)+'px;}';
2971 css += 'body.hasVoiceBar #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-top:'+(56+8)+'px;}';
2972 css += 'body.hasSmurfbar.hasVoiceBar #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-top:'+(70+8)+'px;}';
2973 css += 'body.hasViewasChromeBar #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-top:'+(76+8)+'px;}';
2974 css += 'body.hasSmurfbar.hasViewasChromeBar #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-top:'+(80+8)+'px;}';
2975 css += '.sidebarMode #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-right:213px;}';
2976 css += '._4g5r #ponyhoof_dialog_browserponies .generic_dialog_popup, .-cx-PUBLIC-hasLitestandBookmarksSidebar__root #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-right:8px;}';
2977 css += '#ponyhoof_dialog_browserponies .popup {width:'+(88+8+8+8)+'px;margin:0;opacity:.6;-webkit-transition:opacity .3s linear;-moz-transition:opacity .3s linear;-o-transition:opacity .3s linear;transition:opacity .3s linear;}';
2978 css += '#ponyhoof_dialog_browserponies .popup:hover {opacity:1;}';
2979 css += '#ponyhoof_dialog_browserponies .content {background:#F2F2F2;text-align:center;}';
2980 css += '#ponyhoof_dialog_browserponies .uiButton {text-align:left;}';
2981 css += '#browser-ponies img {-webkit-user-select:none;-moz-user-select:none;user-select:none;}';
2982 injectManualStyle(css, 'browserponies');
2983 };
2984
2985 k.copyrightDialog = function() {
2986 createSimpleDialog('browserponies_copyright', "Browser Ponies", "<a href='http://panzi.github.io/Browser-Ponies/' target='_blank'>Browser Ponies</a> is created by Mathias Panzenb&ouml;ck, licensed under the <a href='http://opensource.org/licenses/mit-license.html' target='_blank'>MIT License</a>. Based on Desktop Ponies written by <a href='mailto:random.anonymous.pony@gmail.com'>random.anonymous.pony@gmail.com</a>");
2987 };
2988
2989 k.morePonies = function(e) {
2990 k.spawnPony(k.ponySelected);
2991 if (e) {
2992 e.preventDefault();
2993 }
2994 };
2995
2996 k.closeDialog = function(e) {
2997 k.dialog.close();
2998 if (e) {
2999 e.preventDefault();
3000 }
3001 };
3002
3003 k.clearAll = function(e) {
3004 //k.closeDialog();
3005 contentEval(function(arg) {
3006 try {
3007 window.BrowserPonies.unspawnAll();
3008 window.BrowserPonies.stop();
3009 } catch (e) {
3010 if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
3011 console.log("Unable to hook to BrowserPonies");
3012 console.dir(e);
3013 }
3014 }
3015 }, {"CANLOG":CANLOG});
3016 if (e) {
3017 e.preventDefault();
3018 }
3019 };
3020 };
3021
3022 // Options
3023 var Options = function() {
3024 var k = this;
3025
3026 k.dialog = null;
3027 k.saveButton = null;
3028
3029 k.needToSaveLabel = false;
3030 k.needToRefresh = false;
3031 k.canSaveSettings = true;
3032
3033 k._stack = CURRENTSTACK;
3034
3035 k.created = false;
3036 k.create = function() {
3037 // Did we create our Options interface already?
3038 if ($('ponyhoof_dialog_options')) {
3039 k._refreshDialog();
3040 return false;
3041 }
3042
3043 k.injectStyle();
3044
3045 if (!runMe) {
3046 var extra = '';
3047 if (ISCHROME) {
3048 extra = '<br><br><a href="http://jointheherd.little.my" target="_top">Please update to the latest version of Ponyhoof here.</a>';
3049 }
3050
3051 k.dialog = new Dialog('options_force_run');
3052 k.dialog.create();
3053 k.dialog.changeTitle("Ponyhoof does not run on "+w.location.hostname);
3054 k.dialog.changeContent("Unfortunately, your browser stores settings seperately for each domain ("+w.location.protocol+"//www.facebook.com is different from "+w.location.protocol+"//"+w.location.hostname+")"+extra);
3055 k.dialog.addCloseButton();
3056 return;
3057 }
3058
3059 var c = '';
3060 c += '<div class="ponyhoof_tabs clearfix">';
3061 c += '<a href="#" class="active" data-ponyhoof-tab="main">'+CURRENTLANG.options_tabs_main+'</a>';
3062 c += '<a href="#" class="ponyhoof_show_if_injected" data-ponyhoof-tab="background">'+CURRENTLANG.options_tabs_background+'</a>';
3063 c += '<a href="#" class="ponyhoof_show_if_injected" data-ponyhoof-tab="sounds">'+CURRENTLANG.options_tabs_sounds+'</a>';
3064 c += '<a href="#" data-ponyhoof-tab="extras">'+CURRENTLANG.options_tabs_extras+'</a>';
3065 c += '<a href="#" data-ponyhoof-tab="advanced">'+CURRENTLANG.options_tabs_advanced+'</a>';
3066 c += '<a href="#" data-ponyhoof-tab="about">'+CURRENTLANG.options_tabs_about+'</a>';
3067 c += '</div>';
3068
3069 c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_main" style="display:block;">';
3070 //c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_main">';
3071 c += '<div class="clearfix">';
3072 c += renderBrowserConfigWarning();
3073
3074 c += '<a href="#" ajaxify="/ajax/sharer/?s=18&amp;p[]='+PONYHOOF_PAGE+'" rel="dialog" class="uiButton uiButtonSpecial rfloat ponyhoof_noShareIsCare" role="button" data-hover="tooltip" data-tooltip-alignh="right" aria-label="'+CURRENTLANG['fb_share_tooltip']+'"><span class="uiButtonText">Share with your pals!</span></a>';
3075
3076 var visitPageText = CURRENTLANG.settings_main_visitPage;
3077 if (ISUSINGBUSINESS) {
3078 visitPageText = CURRENTLANG.settings_main_visitPageBusiness;
3079 }
3080
3081 c += '<div class="ponyhoof_show_if_injected">Select your favorite character:</div>';
3082 c += '<div class="ponyhoof_hide_if_injected">Select your favorite character to re-enable Ponyhoof:</div>';
3083 c += '<div id="ponyhoof_options_pony"></div>';
3084 c += '<div id="ponyhoof_options_likebox_div" class="notPage notBusiness"><iframe src="about:blank" id="ponyhoof_options_likebox" scrolling="no" frameborder="0" allowTransparency="true" class="ponyhoof_options_framerefresh"></iframe></div>';
3085 c += '<a href="'+w.location.protocol+PONYHOOF_URL+'" class="ponyhoof_options_linkclick ponyhoof_options_fatlink" data-hovercard="/ajax/hovercard/page.php?id='+PONYHOOF_PAGE+'">'+visitPageText+'</a>';
3086 c += '<a href="#" class="ponyhoof_options_fatlink" id="ponyhoof_browserponies" data-hover="tooltip" aria-label="Run Desktop Ponies on this page for MOAR ponies!!">Run Browser Ponies<span class="ponyhoof_loading"></span></a>';
3087 c += '<div class="ponyhoof_show_if_injected"><a href="#" class="ponyhoof_options_fatlink" id="ponyhoof_options_disable">Disable Ponyhoof</a></div>';
3088
3089 c += '<div class="ponyhoof_message uiBoxYellow ponyhoof_updater_newVersion">';
3090 c += '<a href="#" class="uiButton uiButtonSpecial rfloat ponyhoof_updater_updateNow" role="button"><span class="uiButtonText">Update now</span></a>';
3091 c += '<span class="wrap">An update (v<span class="ponyhoof_updater_versionNum"></span>) for Ponyhoof is available.</span>';
3092 c += '</div>';
3093 c += '<div class="ponyhoof_message uiBoxRed ponyhoof_updater_error">Ponyhoof cannot check for updates at this moment. <a href="'+w.location.protocol+PONYHOOF_URL+'" class="ponyhoof_options_linkclick">Please visit the Ponyhoof page for the latest news.</a></div>';
3094 c += '</div>';
3095 c += '</div>';
3096
3097 c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_background">';
3098 c += '<div class="ponyhoof_show_if_injected">';
3099 c += 'Use as background:';
3100 c += '<ul class="ponyhoof_options_fatradio clearfix">';
3101 c += '<li id="ponyhoof_options_background_cutie" data-ponyhoof-background="cutie"><a href="#"><span>Cutie mark</span><div class="wrap"><i></i></div></a></li>';
3102 c += '<li id="ponyhoof_options_background_loginbg" data-ponyhoof-background="loginbg"><a href="#"><span>Background</span><div class="wrap"><i></i></div></a></li>';
3103 c += '<li id="ponyhoof_options_background_custom" data-ponyhoof-background="custom"><a href="#"><span>Custom</span><div class="wrap"><i></i></div></a></li>';
3104 c += '</ul>';
3105
3106 c += '<div class="ponyhoof_message uiBoxRed hidden_elem" id="ponyhoof_options_background_error"></div>';
3107 c += '<div id="ponyhoof_options_background_drop">';
3108 c += '<div id="ponyhoof_options_background_drop_notdrop">Drag and drop an image here to customize your background. <a href="#" class="uiHelpLink" data-hover="tooltip" data-tooltip-alignh="center" aria-label=""></a><br><br>Or browse for an image: <input type="file" id="ponyhoof_options_background_select" accept="image/*"></div>';
3109 c += '<div id="ponyhoof_options_background_drop_dropping">Drop here</div>';
3110 c += '</div>';
3111 c += '</div>';
3112 c += '</div>';
3113
3114 c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_sounds">';
3115 c += '<div class="ponyhoof_show_if_injected">';
3116 c += '<div class="ponyhoof_message uiBoxRed hidden_elem unavailable">'+CURRENTLANG.settings_sounds_unavailable+'</div>';
3117
3118 var soundsText = CURRENTLANG.settings_sounds;
3119 if (ISUSINGPAGE || ISUSINGBUSINESS) {
3120 soundsText = CURRENTLANG.settings_sounds_noNotification;
3121 }
3122
3123 c += '<div class="available">';
3124 c += '<div class="ponyhoof_message uiBoxYellow notPage">Sounds are experimental, they might derp from time to time.</div>';
3125 c += '<div class="ponyhoof_message uiBoxRed usingPage">Notification sounds are not available when you are using Facebook as your page.</div><br>';
3126 c += k.generateCheckbox('sounds', soundsText, {customFunc:k.soundsClicked});
3127 c += '<div class="notPage notBusiness"><br>';
3128 c += '<div id="ponyhoof_options_soundsSettingsWrap">';
3129 c += '<div id="ponyhoof_options_soundsSetting" class="ponyhoof_menu_withlabel"><span class="ponyhoof_menu_label">Notification sound: </span></div>';
3130 c += '<div id="ponyhoof_options_soundsNotifType" class="ponyhoof_menu_withlabel ponyhoof_menu_labelbreak"><span class="ponyhoof_menu_label">Don\'t play sounds for these types of notifications:</span></div>';
3131 c += '<span class="ponyhoof_menu_label">Volume: </span><input type="range" id="ponyhoof_options_soundsVolume" min="1" max="100"> <a href="#" class="uiButton" role="button" id="ponyhoof_options_soundsVolumePreview"><span class="uiButtonText">Preview</span></a><span class="ponyhoof_menu_label" id="ponyhoof_options_soundsVolumeValue"></span>';
3132 c += '</div>';
3133 c += '</div>';
3134
3135 c += '<div class="notPage notBusiness"><br>';
3136 c += '<span class="ponyhoof_dialog_header">Chat</span>';
3137 c += '<div class="ponyhoof_message uiBoxYellow notPage hidden_elem" id="ponyhoof_options_soundsChatSoundWarning">';
3138 c += '<a href="#" class="uiButton uiButtonConfirm rfloat" role="button"><span class="uiButtonText">Enable now</span></a>';
3139 c += '<span class="wrap">The chat sound option built into Facebook needs to be enabled.</span>';
3140 c += '</div>';
3141 c += '<div class="ponyhoof_message uiBoxYellow notPage hidden_elem" id="ponyhoof_options_soundsMessengerForWindowsWarning">Please turn off Facebook Messenger for Windows for chat sounds to work properly.</div>';
3142 c += k.generateCheckbox('chatSound', "Change chat sound", {customFunc:k.chatSound});
3143 c += '<div id="ponyhoof_options_soundsChatWrap">';
3144 c += '<div id="ponyhoof_options_soundsChatSetting" class="ponyhoof_menu_withlabel"><span class="ponyhoof_menu_label">Chat sound: </span></div>';
3145 c += '</div>';
3146 c += '</div>';
3147 c += '</div>'; // .available
3148 c += '</div>';
3149 c += '<div class="ponyhoof_hide_if_injected ponyhoof_message uiBoxRed">';
3150 c += 'You must enable Ponyhoof to use Ponyhoof sounds.';
3151 c += '</div>';
3152 c += '</div>';
3153
3154 c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_extras">';
3155 c += '<div class="ponyhoof_show_if_injected">';
3156 c += k.generateCheckbox('show_messages_other', "Always show Other messages", {tip:"Facebook sends messages that aren't from your friends or mutual friends to the Other messages section. Ponyhoof can expand the Messages section to always show the Other section so you won't miss a message.<br><br><"+"img src='"+THEMEURL+"_help/other_messages.png' alt='' width='190' height='142' class='ponyhoof_image_shadow'>", 'extraClass':'notBusiness'});
3157 c += k.generateCheckbox('pinkieproof', "Strengthen the fourth wall", {title:"Prevents Pinkie Pie from breaking the fourth wall for non-villains"});
3158 c += '</div>';
3159 c += k.generateCheckbox('forceEnglish', "Always use Ponyhoof in English", {title:"Ponyhoof tries to use your Facebook language, but you can force Ponyhoof to always use English", refresh:true});
3160 c += '<div class="ponyhoof_show_if_injected">';
3161 c += k.generateCheckbox('disable_emoticons', "Disable emoticon ponification");
3162 c += '<div id="ponyhoof_options_randomPonies" class="ponyhoof_menu_withlabel"><span class="ponyhoof_menu_label">Characters to randomize: </span></div>';
3163 c += '<div id="ponyhoof_options_costume" class="ponyhoof_menu_withlabel"><span class="ponyhoof_menu_label">Appearance: </span></div>';
3164 c += '</div>';
3165 c += '<div class="ponyhoof_hide_if_injected"><br></div>';
3166
3167 c += '<span class="ponyhoof_dialog_header">Multi-user</span>';
3168 c += k.generateCheckbox('allowLoginScreen', "Run Ponyhoof on the Facebook login screen", {global:true, customFunc:k.allowLoginScreenClicked});
3169 c += k.generateCheckbox('runForNewUsers', "Run Ponyhoof for new users", {title:CURRENTLANG['settings_extras_runForNewUsers_explain'], global:true});
3170 c += '<br>';
3171
3172 c += '<div class="ponyhoof_show_if_injected">';
3173 c += '<span class="ponyhoof_dialog_header">Performance</span>';
3174 c += k.generateCheckbox('disable_animation', "Disable all animations");
3175 c += k.generateCheckbox('disableDomNodeInserted', "Disable HTML detection", {title:"Disables Ponyhoof from ponifying certain stuff that is not possible to do with styling alone such as notifications and dialogs (Some features require this to be enabled)", customFunc:k.disableDomNodeInsertedClicked});
3176 c += '<br>';
3177 c += '</div>';
3178
3179 c += '<a href="#" class="ponyhoof_options_fatlink" id="ponyhoof_options_resetSettings" data-hover="tooltip" aria-label="Reset your Ponyhoof settings and show the welcome screen">Reset settings</a>';
3180 c += '<a href="http://ponyhoof.little.my/faq" class="ponyhoof_options_fatlink" target="_blank" data-hover="tooltip" aria-label="View frequently asked questions, such as how to uninstall or update">View the Ponyhoof FAQ</a>';
3181 c += '</div>';
3182
3183 c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_advanced">';
3184 c += '<div class="ponyhoof_message uiBoxYellow">These features are unsupported and used for debugging. This should be used by advanced users only.</div><br>';
3185 c += '<span class="ponyhoof_show_if_loaded inline">Style version <span class="ponyhoof_VERSION_CSS"></span><br><br></span>';
3186
3187 c += '<textarea id="ponyhoof_options_technical" READONLY spellcheck="false"></textarea><br><br>';
3188
3189 if (STORAGEMETHOD == 'localstorage') {
3190 c += '<span class="ponyhoof_dialog_header">localStorage dump</span>';
3191 c += '<textarea id="ponyhoof_options_dump" READONLY spellcheck="false"></textarea><br><br>';
3192 }
3193
3194 c += '<div class="ponyhoof_show_if_injected">';
3195 c += '<span class="ponyhoof_dialog_header">Custom CSS</span>';
3196 c += '<textarea id="ponyhoof_options_customcss" placeholder="Enter any custom CSS to load after Ponyhoof is loaded." title="Enter any custom CSS to load after Ponyhoof is loaded." spellcheck="false"></textarea><br>';
3197 c += '<a href="#" class="uiButton" role="button" id="ponyhoof_options_customcss_preview"><span class="uiButtonText">Preview</span></a><br><br>';
3198 c += '</div>';
3199
3200 c += '<span class="ponyhoof_dialog_header">Settings</span>';
3201 c += '<textarea id="ponyhoof_options_debug_settings" spellcheck="false"></textarea>';
3202 c += '<a href="#" class="uiButton" role="button" id="ponyhoof_options_debug_settings_export"><span class="uiButtonText">Export settings</span></a> <a href="#" class="uiButton" role="button" id="ponyhoof_options_debug_settings_saveall"><span class="uiButtonText">Import settings</span></a><br><br>';
3203
3204 c += '<span class="ponyhoof_dialog_header">Other</span>';
3205 c += '<div class="ponyhoof_hide_if_injected ponyhoof_message uiBoxYellow">';
3206 c += 'You must enable Ponyhoof to use custom CSS or dump debug data.';
3207 c += '</div>';
3208
3209 c += k.generateCheckbox('debug_exposed', "Always show Debug tab");
3210 c += k.generateCheckbox('debug_slow_load', "Disable fast load");
3211 c += '<div class="ponyhoof_show_if_injected">';
3212 c += k.generateCheckbox('debug_dominserted_console', "Dump DOMNodeInserted data to console");
3213 c += k.generateCheckbox('debug_disablelog', "Disable console logging", {customFunc:k.debug_disablelog});
3214 c += k.generateCheckbox('debug_noMutationObserver', "Use legacy HTML detection (slower)", {refresh:true});
3215 c += k.generateCheckbox('debug_mutationDebug', "Dump mutation debug info to console");
3216 c += k.generateCheckbox('debug_betaFacebookLinks', "Rewrite links on beta.facebook.com", {refresh:true});
3217 c += '<a href="#" id="ponyhoof_options_tempRemove" class="ponyhoof_options_fatlink">Remove style</a>';
3218 c += '</div>';
3219 c += '<a href="#" id="ponyhoof_options_sendSource" class="ponyhoof_options_fatlink">Send page source</a>';
3220 if (STORAGEMETHOD != 'mxaddon') {
3221 c += '<a href="#" class="ponyhoof_options_fatlink" id="ponyhoof_options_clearLocalStorage" data-hover="tooltip">Reset all settings (including global)</a>';
3222 }
3223 c += '</div>';
3224
3225 c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_about">';
3226 c += '<div class="clearfix">';
3227 c += '<div class="top">';
3228 c += '<div class="rfloat"><a href="'+w.location.protocol+PONYHOOF_URL+'" class="ponyhoof_options_linkclick" data-hovercard="/ajax/hovercard/page.php?id='+PONYHOOF_PAGE+'" id="ponyhoof_options_devpic" data-hovercard-instant="1"><'+'img src="'+THEMEURL+'icon100.png" alt="" width="50" height="50"></a>';
3229 c += '</div>';
3230 c += '<strong>Ponyhoof v'+VERSION+'</strong><br>';
3231 c += 'By <a href="'+w.location.protocol+'//'+getFbDomain()+'/ngyikp" class="ponyhoof_options_linkclick" data-hovercard="/ajax/hovercard/user.php?id=100000971648506">Ng Yik Phang</a> and <a href="http://ponyhoof.little.my/credits" class="ponyhoof_options_linkclick" data-hover="tooltip" aria-label="View all the ponies, artists and contributors that made Ponyhoof come to life">many contributors</a>';
3232 c += '</div>';
3233 c += '<a href="'+w.location.protocol+PONYHOOF_URL+'" class="ponyhoof_options_linkclick ponyhoof_options_fatlink notBusiness" data-hovercard="/ajax/hovercard/page.php?id='+PONYHOOF_PAGE+'">Send feedback and suggestions on our page</a>';
3234 if (ISCHROME || (STORAGEMETHOD == 'chrome' && !ISOPERABLINK)) {
3235 c += '<a href="http://ponyhoof.little.my/cwsreview" target="_blank" class="ponyhoof_options_fatlink">Rate us 5 stars and write a review on the Chrome Web Store</a>';
3236 }
3237 c += '<iframe src="about:blank" id="ponyhoof_options_twitter" allowtransparency="true" frameborder="0" scrolling="no"></iframe>';
3238 if (ISCHROME || STORAGEMETHOD == 'chrome') {
3239 c += '<div id="ponyhoof_options_plusone"><div class="g-plusone" data-size="medium" data-annotation="inline" data-width="443" data-href="https://chrome.google.com/webstore/detail/efjjgphedlaihnlgaibiaihhmhaejjdd"></div></div>';
3240 }
3241
3242 c += '<div class="ponyhoof_options_aboutsection"><div class="inner">';
3243 c += '<strong>If you love Ponyhoof, then please help us a hoof and contribute to support development! Thanks!</strong><br><br>';
3244 c += '<div id="ponyhoof_donate" class="clearfix">';
3245 c += '<div class="inner"><form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank" id="ponyhoof_options_donatepaypal"><input type="hidden" name="cmd" value="_xclick"><input type="hidden" name="business" value="paypal@little.my"><input type="hidden" name="currency_code" value="USD"><input type="hidden" name="item_name" value="Support Ponyhoof"><a href="#" id="ponyhoof_options_donatepaypal_link">Contribute with PayPal</a></form></div>';
3246 c += '<div class="inner"><iframe src="about:blank" id="ponyhoof_donate_flattr_iframe" allowtransparency="true" frameborder="0" scrolling="no"></iframe></div>'; //<a href="//flattr.com/thing/641591/Ponyhoof" target="_blank" id="ponyhoof_donate_flattr">Flattr this!</a>
3247 c += '</div>';
3248 c += '</div></div>';
3249
3250 c += '<div class="ponyhoof_options_aboutsection"><div class="inner">The Ponyhoof extension for Facebook is not affiliated or endorsed by Facebook and/or Hasbro in any way. MY LITTLE PONY, FRIENDSHIP IS MAGIC and all related characters are trademarks of Hasbro. &copy; '+(new Date().getFullYear())+' Hasbro. All Rights Reserved.</div></div>';
3251 c += '</div>';
3252 c += '</div>';
3253
3254 var successText = '';
3255 var ponyData = convertCodeToData(REALPONY);
3256 if (ponyData.successText) {
3257 successText = ponyData.successText+' ';
3258 }
3259 var bottom = '';
3260 bottom += '<div class="lfloat"><span class="ponyhoof_updater_checking">Checking for updates...</span><span class="ponyhoof_updater_latest">'+successText+'Ponyhoof is up-to-date.</span></div>';
3261 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm" role="button" id="ponyhoof_options_save"><span class="uiButtonText">'+CURRENTLANG.close+'</span></a>';
3262
3263 k.dialog = new Dialog('options');
3264 k.dialog.create();
3265 k.dialog.changeTitle(CURRENTLANG.options_title);
3266 k.dialog.changeContent(c);
3267 k.dialog.changeBottom(bottom);
3268 k.dialog.onclose = k.dialogOnClose;
3269 k.dialog.onclosefinish = k.dialogOnCloseFinish;
3270 k.created = true;
3271
3272 // After
3273 k.dialog.dialog.className += ' ponyhoof_dialog_localstorageWarningEmbedded';
3274
3275 k.saveButton = $('ponyhoof_options_save');
3276 k.saveButton.addEventListener('click', k.saveButtonClick, false);
3277
3278 k.dialog.dialog.getElementsByClassName('ponyhoof_noShareIsCare')[0].addEventListener('click', function() {
3279 k.dialog.close();
3280 }, false);
3281
3282 var l = k.dialog.dialog.getElementsByClassName('ponyhoof_options_linkclick');
3283 for (var i = 0, len = l.length; i < len; i += 1) {
3284 l[i].addEventListener('click', function() {
3285 k.dialog.close();
3286 }, false);
3287 }
3288
3289 // Updater
3290 w.setTimeout(function() {
3291 var update = new Updater();
3292 update.checkForUpdates();
3293 }, 500);
3294
3295 k.checkboxInit();
3296 k.tabsInit();
3297
3298 // @todo make k.mainInit non-dependant
3299 k.mainInit();
3300
3301 k._refreshDialog();
3302
3303 if (userSettings.debug_exposed) {
3304 addClass(k.dialog.dialog, 'ponyhoof_options_debugExposed');
3305 }
3306 };
3307
3308 k._refreshDialog = function() {
3309 k.ki();
3310 k.disableDomNodeInserted();
3311
3312 if (k.debugLoaded) {
3313 $('ponyhoof_options_technical').textContent = k.techInfo();
3314 //$('ponyhoof_options_linkedcss').textContent = k.linkedCss();
3315 }
3316 };
3317
3318 k.debugLoaded = false;
3319 k.techInfo = function() {
3320 var cxPrivate = false;
3321 if (d.getElementsByClassName('-cx-PRIVATE-fbLayout__root').length) {
3322 cxPrivate = true;
3323 }
3324
3325 var tech = SIG + " " + new Date().toString() + "\n";
3326 tech += "USERID: " + USERID + "\n";
3327 tech += "CURRENTPONY: " + CURRENTPONY + "\n";
3328 tech += "REALPONY: " + REALPONY + "\n";
3329 tech += "CURRENTSTACK: " + CURRENTSTACK.stack + "\n";
3330 tech += "STORAGEMETHOD: " + STORAGEMETHOD + "\n";
3331 tech += "DISTRIBUTION: " + DISTRIBUTION + "\n";
3332 if (STORAGEMETHOD == 'localstorage') {
3333 tech += "localStorage.length: " + w.localStorage.length + "\n";
3334 }
3335 tech += "\n";
3336 tech += "navigator.userAgent: " + w.navigator.userAgent + "\n";
3337 tech += "document.documentElement.className: " + d.documentElement.className + "\n";
3338 tech += "document.body.className: " + d.body.className + "\n";
3339 tech += "Has cx-PRIVATE: " + cxPrivate + "\n";
3340 tech += "window.location.href: " + w.location.href + "\n";
3341 tech += "\n";
3342 tech += k.linkedCss();
3343 tech += "\n";
3344 tech += k.linkedScript();
3345 tech += "\n";
3346 tech += k.linkedIframe();
3347 tech += "\n";
3348
3349 var ext = [];
3350 var conflict = [];
3351 if ($('bfb_options_button')) {
3352 ext.push("Social Fixer");
3353 }
3354 if (d.getElementsByClassName('rg3fbpz-tooltip').length) {
3355 ext.push("Photo Zoom for Facebook");
3356 }
3357 if ($('fbpoptslink')) {
3358 ext.push("FB Purity");
3359 }
3360 if ($('fbfPopupContainer')) {
3361 ext.push("FFixer");
3362 }
3363 if ($('unfriend_finder')) {
3364 ext.push("Unfriend Finder");
3365 }
3366 if ($('window-resizer-tooltip')) {
3367 ext.push("Window Resizer");
3368 }
3369 if ($('hzImg')) {
3370 ext.push("Hover Zoom");
3371 }
3372 if ($('myGlobalPonies')) {
3373 ext.push("My Global Ponies");
3374 }
3375 if ($('memeticonStyle')) {
3376 ext.push("Memeticon (ads)");
3377 }
3378 if ($('socialplus')) {
3379 ext.push("SocialPlus! (ads)");
3380 }
3381 if (d.querySelector('script[src^="chrome-extension://igdhbblpcellaljokkpfhcjlagemhgjl"]')) {
3382 ext.push("Iminent (ads)");
3383 }
3384 if ($('_fbm-emoticons-wrapper')) {
3385 ext.push("myemoticons.com");
3386 }
3387 if (d.querySelector('script[src^="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl"]')) {
3388 ext.push("Skype plugin");
3389 }
3390 if (d.querySelector('script[src^="chrome-extension://jmfkcklnlgedgbglfkkgedjfmejoahla"]')) {
3391 ext.push("AVG Safe Search");
3392 }
3393 if ($('DAPPlugin')) {
3394 ext.push("Download Accelerator Plus");
3395 }
3396
3397 if ($('bfb_theme')) {
3398 conflict.push("Social Fixer theme");
3399 }
3400 if ($('mycssstyle')) {
3401 conflict.push("SocialPlus! theme");
3402 }
3403 if ($('ColourChanger')) {
3404 conflict.push("Facebook Colour Changer");
3405 }
3406 if (hasClass(d.documentElement, 'myFacebook')) {
3407 conflict.push("Color My Facebook");
3408 }
3409 if (w.navigator.userAgent.match(/Mozilla\/4\.0 \(compatible\; MSIE 7\.0\; Windows/)) {
3410 conflict.push("IE 7 user-agent spoofing");
3411 }
3412 tech += "Installed extensions: ";
3413 if (ext.length) {
3414 for (var i = 0, len = ext.length; i < len; i += 1) {
3415 tech += ext[i];
3416 if (ext.length-1 != i) {
3417 tech += ', ';
3418 }
3419 }
3420 } else {
3421 tech += "None detected";
3422 }
3423 tech += "\n";
3424
3425 tech += "Conflicts: ";
3426 if (conflict.length) {
3427 for (var i = 0, len = conflict.length; i < len; i += 1) {
3428 tech += conflict[i];
3429 if (conflict.length-1 != i) {
3430 tech += ', ';
3431 }
3432 }
3433 } else {
3434 tech += "None detected";
3435 }
3436 tech += "\n";
3437
3438 return tech;
3439 };
3440
3441 k.linkedCss = function() {
3442 var css = d.getElementsByTagName('link');
3443 var t = '';
3444 for (var i = 0, len = css.length; i < len; i += 1) {
3445 if (css[i].rel == 'stylesheet') {
3446 t += css[i].href + "\n";
3447 }
3448 }
3449
3450 return t;
3451 };
3452
3453 k.linkedScript = function() {
3454 var script = d.getElementsByTagName('script');
3455 var t = '';
3456 for (var i = 0, len = script.length; i < len; i += 1) {
3457 if (script[i].src) {
3458 t += script[i].src + "\n";
3459 }
3460 }
3461
3462 return t;
3463 };
3464
3465 k.linkedIframe = function() {
3466 var iframe = d.getElementsByTagName('iframe');
3467 var t = '';
3468 for (var i = 0, len = iframe.length; i < len; i += 1) {
3469 if (iframe[i].src && iframe[i].src.indexOf('://'+getFbDomain()+'/ai.php') == -1) {
3470 t += iframe[i].src + "\n";
3471 }
3472 }
3473
3474 return t;
3475 };
3476
3477 k.debugInfo = function() {
3478 if (k.debugLoaded) {
3479 return;
3480 }
3481 k.debugLoaded = true;
3482
3483 // Custom CSS
3484 var customcss = $('ponyhoof_options_customcss');
3485 if (userSettings.customcss) {
3486 customcss.value = userSettings.customcss;
3487 }
3488 customcss.addEventListener('input', function() {
3489 if (!k.needsToRefresh) {
3490 k.needsToRefresh = true;
3491 k.updateCloseButton();
3492 }
3493 }, false);
3494 $('ponyhoof_options_customcss_preview').addEventListener('click', function() {
3495 if (!$('ponyhoof_style_customcss')) {
3496 injectManualStyle('', 'customcss');
3497 }
3498
3499 $('ponyhoof_style_customcss').textContent = '/* '+SIG+' */'+customcss.value;
3500 }, false);
3501
3502 // Technical info
3503 var techFirstHover = false;
3504 $('ponyhoof_options_technical').addEventListener('click', function() {
3505 if (!techFirstHover) {
3506 techFirstHover = true;
3507 this.focus();
3508 this.select();
3509 }
3510 }, false);
3511
3512 if (STORAGEMETHOD == 'localstorage') {
3513 var dump = '';
3514 for (var i in localStorage) {
3515 dump += i+": "+localStorage[i]+"\n";
3516 }
3517 $('ponyhoof_options_dump').value = dump;
3518 }
3519
3520 // Settings
3521 var settingsTextarea = $('ponyhoof_options_debug_settings');
3522
3523 $('ponyhoof_options_debug_settings_export').addEventListener('click', function() {
3524 settingsTextarea.value = JSON.stringify(userSettings);
3525 }, false);
3526
3527 $('ponyhoof_options_debug_settings_saveall').addEventListener('click', function(e) {
3528 e.preventDefault();
3529 try {
3530 var s = JSON.parse(settingsTextarea.value);
3531 } catch (e) {
3532 createSimpleDialog('debug_settingsKey_error', "Derp'd", "Invalid JSON<br><br><code>\n\n"+e.toString()+"</code>");
3533 return false;
3534 }
3535
3536 if (confirm(SIG+" Are you sure you want to overwrite your settings? Facebook will be reloaded immediately after saving.")) {
3537 userSettings = s;
3538 saveSettings();
3539 w.location.reload();
3540 }
3541 }, false);
3542
3543 // Other
3544 $('ponyhoof_options_tempRemove').addEventListener('click', k._debugRemoveStyle, false);
3545 k._debugNoMutationObserver();
3546
3547 $('ponyhoof_options_sendSource').addEventListener('click', function() {
3548 if (confirm(SIG+" Are you sure you want to send the page source for debugging? Only the Ponyhoof developers can view the page. Please send the page source only when necessary.\n\nNote that it will take some time to upload, don't close the browser window until it is finished.")) {
3549 k.dialog.hide();
3550
3551 var temp = $('ponyhoof_options_technical').value;
3552 $('ponyhoof_options_technical').value = '';
3553 if ($('ponyhoof_sourceSend_input')) {
3554 $('ponyhoof_sourceSend_input').value = '';
3555 var sourceSend = $('ponyhoof_sourceSend_input').parentNode;
3556 }
3557
3558 var settings = {};
3559 for (var x in userSettings) {
3560 settings[x] = userSettings[x];
3561 }
3562 settings['customBg'] = null;
3563
3564 var t = d.documentElement.innerHTML.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
3565 t = '<!DOCTYPE html><html class="'+d.documentElement.className+'" id="'+d.documentElement.id+'"><!-- '+k.techInfo()+"\n\n"+JSON.stringify(settings)+' -->'+t+'</html>';
3566
3567 if ($('ponyhoof_sourceSend_input')) {
3568 $('ponyhoof_sourceSend_input').value = t;
3569 } else {
3570 var sourceSendTxt = d.createElement('input');
3571 sourceSendTxt.type = 'hidden';
3572 sourceSendTxt.id = 'ponyhoof_sourceSend_input';
3573 sourceSendTxt.name = 'post';
3574 sourceSendTxt.value = t;
3575
3576 var sourceSend = d.createElement('form');
3577 sourceSend.method = 'POST';
3578 sourceSend.action = 'https://paste.little.my/post/';
3579 sourceSend.target = '_blank';
3580 sourceSend.appendChild(sourceSendTxt);
3581 d.body.appendChild(sourceSend);
3582 }
3583
3584 sourceSend.submit();
3585
3586 $('ponyhoof_options_technical').value = temp;
3587 }
3588 return false;
3589 }, false);
3590
3591 $('ponyhoof_options_technical').textContent = k.techInfo();
3592 //$('ponyhoof_options_linkedcss').textContent = k.linkedCss();
3593 };
3594
3595 k._debugRemoveStyle = function(e) {
3596 changeThemeSmart('NONE');
3597
3598 d.removeEventListener('DOMNodeInserted', DOMNodeInserted, true);
3599 if (mutationObserverMain) {
3600 mutationObserverMain.disconnect();
3601 }
3602
3603 k.dialog.close();
3604 e.preventDefault();
3605 };
3606
3607 k._debugNoMutationObserver = function() {
3608 var mutationObserver = w.WebKitMutationObserver || w.MutationObserver || false;
3609 if (!mutationObserver) {
3610 var option = $('ponyhoof_options_debug_noMutationObserver');
3611 option.disabled = true;
3612 option.checked = true;
3613
3614 var label = $('ponyhoof_options_label_debug_noMutationObserver');
3615 addClass(label, 'ponyhoof_options_unavailable');
3616 label.setAttribute('data-hover', 'tooltip');
3617 label.setAttribute('aria-label', "The new HTML detection method is not supported on your browser. Please update your browser if possible.");
3618 }
3619 };
3620
3621 k.mainInitLoaded = false;
3622 k.mainInit = function() {
3623 if (k.mainInitLoaded) {
3624 return;
3625 }
3626
3627 // Pony selector
3628 var ponySelector = new PonySelector($('ponyhoof_options_pony'), {});
3629 ponySelector.allowRandom = true;
3630 ponySelector.customClick = function(menuItem, menuClass) {
3631 if (ponySelector.oldPony == 'NONE' || CURRENTPONY == 'NONE') {
3632 if (ponySelector.oldPony == 'NONE' && CURRENTPONY != 'NONE') {
3633 extraInjection();
3634 runDOMNodeInserted();
3635 }
3636 }
3637 if (ponySelector.oldPony != 'NONE' && CURRENTPONY == 'NONE') {
3638 k.needsToRefresh = true;
3639 }
3640 if (k._stack != CURRENTSTACK) {
3641 k.needsToRefresh = true;
3642 }
3643 k.needToSaveLabel = true;
3644 k.updateCloseButton();
3645
3646 var f = k.dialog.dialog.getElementsByClassName('ponyhoof_options_framerefresh');
3647 for (var i = 0, len = f.length; i < len; i += 1) {
3648 (function() {
3649 var iframe = f[i];
3650 fadeOut(iframe, function() {
3651 w.setTimeout(function() {
3652 iframe.style.display = '';
3653 removeClass(iframe, 'ponyhoof_fadeout');
3654
3655 iframe.src = iframe.src.replace(/\href\=/, '&href=');
3656 }, 250);
3657 });
3658 })();
3659 }
3660 };
3661 ponySelector.createSelector();
3662
3663 if (!ISUSINGPAGE && !ISUSINGBUSINESS) {
3664 w.setTimeout(function() {
3665 $('ponyhoof_options_likebox').src = '//'+getFbDomain()+'/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2Fprofile.php%3Fid%3D'+PONYHOOF_PAGE+'&send=false&layout=standard&show_faces=true&action=like&colorscheme=light&ponyhoof_runme';
3666 }, 500);
3667 }
3668
3669 // Disable Ponyhoof
3670 $('ponyhoof_options_disable').addEventListener('click', k.disablePonyhoof, false);
3671
3672 // Browser Ponies
3673 $('ponyhoof_browserponies').addEventListener('click', k.runBrowserPonies, false);
3674
3675 k.mainInitLoaded = true;
3676 };
3677
3678 k.extrasInitLoaded = false;
3679 k.extrasInit = function() {
3680 if (k.extrasInitLoaded) {
3681 return;
3682 }
3683
3684 var litestand = false;
3685 if (d.getElementsByClassName('_4g5r').length || d.getElementsByClassName('-cx-PUBLIC-hasLitestandBookmarksSidebar__root').length) {
3686 litestand = true;
3687 }
3688 if (litestand) {
3689 var option = $('ponyhoof_options_show_messages_other');
3690 option.disabled = true;
3691 option.checked = false;
3692
3693 var label = $('ponyhoof_options_label_show_messages_other');
3694 addClass(label, 'ponyhoof_options_unavailable');
3695 label.setAttribute('data-hover', 'tooltip');
3696 label.setAttribute('aria-label', "This option is not available on the new Facebook news feed");
3697 }
3698
3699 k.randomInit();
3700 k.costumesInit();
3701
3702 // Disable animations
3703 if (!supportsCssTransition()) {
3704 var option = $('ponyhoof_options_disable_animation');
3705 option.disabled = true;
3706 option.checked = true;
3707
3708 var label = $('ponyhoof_options_label_disable_animation');
3709 addClass(label, 'ponyhoof_options_unavailable');
3710 label.setAttribute('data-hover', 'tooltip');
3711 label.setAttribute('aria-label', "Animations are not supported on your browser. Please update your browser if possible.");
3712 }
3713
3714 // Reset settings
3715 $('ponyhoof_options_resetSettings').addEventListener('click', k.resetSettings, false);
3716
3717 var clearLocalStorage = $('ponyhoof_options_clearLocalStorage');
3718 if (clearLocalStorage) {
3719 clearLocalStorage.addEventListener('click', k.clearStorage, false);
3720 }
3721
3722 k.extrasInitLoaded = true;
3723 };
3724
3725 k.extrasCostumeMenu = null;
3726 k.extrasCostumeButton = null;
3727 k.extrasCostumeMenuItemNormal = null;
3728 k.extrasCostumeMenuItems = {};
3729 k.costumesInit = function() {
3730 var desc = "(Normal)";
3731 var check = true;
3732 if (userSettings.costume && doesCharacterHaveCostume(REALPONY, userSettings.costume)) {
3733 desc = COSTUMESX[userSettings.costume].name;
3734 check = false;
3735 }
3736
3737 k.extrasCostumeMenu = new Menu('costume', $('ponyhoof_options_costume'));
3738 k.extrasCostumeButton = k.extrasCostumeMenu.createButton(desc);
3739 k.extrasCostumeButton.setAttribute('data-hover', 'tooltip');
3740 k.extrasCostumeButton.setAttribute('aria-label', CURRENTLANG.costume_tooltip);
3741 k.extrasCostumeMenu.canSearch = false;
3742 k.extrasCostumeMenu.createMenu();
3743 k.extrasCostumeMenu.attachButton();
3744 k.extrasCostumeMenuItemNormal = k.extrasCostumeMenu.createMenuItem({
3745 html: "(Normal)"
3746 ,data: ''
3747 ,check: check
3748 ,onclick: function(menuItem, menuClass) {
3749 k._costumesInit_save(menuItem, menuClass, '');
3750 }
3751 });
3752
3753 for (var code in COSTUMESX) {
3754 if (COSTUMESX.hasOwnProperty(code)) {
3755 k._costumesInit_item(code);
3756 }
3757 }
3758
3759 changeThemeFuncQueue.push(function() {
3760 if (doesCharacterHaveCostume(REALPONY, userSettings.costume)) {
3761 k.extrasCostumeMenu.changeButtonText(COSTUMESX[userSettings.costume].name);
3762 k.extrasCostumeMenu.changeChecked(k.extrasCostumeMenuItems[userSettings.costume]);
3763 } else {
3764 k.extrasCostumeMenu.changeButtonText("(Normal)");
3765 k.extrasCostumeMenu.changeChecked(k.extrasCostumeMenuItemNormal);
3766 }
3767
3768 for (var code in COSTUMESX) {
3769 if (COSTUMESX.hasOwnProperty(code)) {
3770 if (doesCharacterHaveCostume(REALPONY, code)) {
3771 removeClass(k.extrasCostumeMenuItems[code].menuItem, 'hidden_elem');
3772 } else {
3773 addClass(k.extrasCostumeMenuItems[code].menuItem, 'hidden_elem');
3774 }
3775 }
3776 }
3777 });
3778 };
3779
3780 k._costumesInit_item = function(code) {
3781 var check = false;
3782 var extraClass = '';
3783 if (doesCharacterHaveCostume(REALPONY, code)) {
3784 if (userSettings.costume == code) {
3785 check = true;
3786 }
3787 } else {
3788 extraClass += ' hidden_elem';
3789 }
3790
3791 k.extrasCostumeMenuItems[code] = k.extrasCostumeMenu.createMenuItem({
3792 html: COSTUMESX[code].name
3793 ,data: code
3794 ,check: check
3795 ,extraClass: extraClass
3796 ,onclick: function(menuItem, menuClass) {
3797 k._costumesInit_save(menuItem, menuClass, code);
3798 }
3799 });
3800 };
3801
3802 k._costumesInit_save = function(menuItem, menuClass, code) {
3803 if (!COSTUMESX[code] && code != '') {
3804 return;
3805 }
3806
3807 changeCostume(code);
3808 userSettings.costume = code;
3809 saveSettings();
3810
3811 if (COSTUMESX[code]) {
3812 menuClass.changeButtonText(COSTUMESX[code].name);
3813 } else {
3814 menuClass.changeButtonText("(Normal)");
3815 }
3816 menuClass.changeChecked(menuItem);
3817 menuClass.close();
3818
3819 k.needToSaveLabel = true;
3820 k.updateCloseButton();
3821 };
3822
3823 k.resetSettings = function(e) {
3824 e.preventDefault();
3825
3826 userSettings = {};
3827 saveSettings();
3828
3829 saveValue(SETTINGSPREFIX+'soundCache', JSON.stringify(null));
3830
3831 k.canSaveSettings = false;
3832 k.dialog.close();
3833 w.location.reload();
3834 };
3835
3836 k.clearStorage = function(e) {
3837 e.preventDefault();
3838
3839 k.canSaveSettings = false;
3840
3841 if (typeof GM_listValues != 'undefined') {
3842 try {
3843 var keys = GM_listValues();
3844 for (var i = 0, len = keys.length; i < len; i += 1) {
3845 GM_deleteValue(keys[i]);
3846 }
3847 } catch (e) {
3848 alert(e.toString());
3849 }
3850 }
3851
3852 switch (STORAGEMETHOD) {
3853 case 'localstorage':
3854 if (confirm(SIG+" localStorage must be cleared in order to reset settings. Doing this may cause other extensions to lose their settings.")) {
3855 try {
3856 w.localStorage.clear();
3857 } catch (e) {
3858 alert("Can't clear localStorage :(\n\n"+e.toString());
3859 }
3860 } else {
3861 return;
3862 }
3863 break;
3864
3865 case 'chrome':
3866 chrome_clearStorage();
3867 break;
3868
3869 case 'opera':
3870 opera_clearStorage();
3871 break;
3872
3873 case 'safari':
3874 safari_clearStorage();
3875 break;
3876
3877 case 'xpi':
3878 xpi_clearStorage();
3879 break;
3880
3881 case 'mxaddon':
3882 // Maxthon does not have a clear storage function
3883 break;
3884
3885 default:
3886 break;
3887 }
3888
3889 k.dialog.close();
3890 w.location.reload();
3891 };
3892
3893 k.donateLoaded = false;
3894 k.loadDonate = function() {
3895 if (k.donateLoaded) {
3896 return;
3897 }
3898
3899 statTrack('aboutclicked');
3900
3901 $('ponyhoof_options_twitter').src = 'https://platform.twitter.com/widgets/follow_button.html?screen_name=ponyhoof&show_screen_name=true&show_count=true';
3902 if (ISCHROME || STORAGEMETHOD == 'chrome') {
3903 (function() {
3904 var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
3905 po.src = 'https://apis.google.com/js/plusone.js';
3906 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
3907 })();
3908 }
3909
3910 $('ponyhoof_options_donatepaypal_link').addEventListener('click', function() {
3911 $('ponyhoof_options_donatepaypal').submit();
3912 statTrack('paypalClicked');
3913 return false;
3914 }, false);
3915
3916 $('ponyhoof_donate_flattr_iframe').src = THEMEURL+'_welcome/flattrStandalone.htm';
3917
3918 k.donateLoaded = true;
3919 };
3920
3921 k.randomInit = function() {
3922 var current = [];
3923 if (userSettings.randomPonies) {
3924 current = userSettings.randomPonies.split('|');
3925 }
3926
3927 var outerwrap = $('ponyhoof_options_randomPonies');
3928 var ponySelector = new PonySelector(outerwrap, {});
3929 ponySelector.overrideClickAction = true;
3930 ponySelector.customCheckCondition = function(code) {
3931 if (current.indexOf(code) != -1) {
3932 return true;
3933 }
3934
3935 return false;
3936 };
3937 ponySelector.customClick = function(menuItem, menuClass) {
3938 var code = menuItem.menuItem.getAttribute('data-ponyhoof-menu-data');
3939
3940 if (!hasClass(menuItem.menuItem, 'ponyhoof_menuitem_checked')) {
3941 menuItem.menuItem.className += ' ponyhoof_menuitem_checked';
3942
3943 current.push(code);
3944 } else {
3945 removeClass(menuItem.menuItem, 'ponyhoof_menuitem_checked');
3946
3947 current.splice(current.indexOf(code), 1);
3948 }
3949 userSettings.randomPonies = current.join('|');
3950 saveSettings();
3951
3952 k._randomUpdateButtonText(current, menuClass);
3953 k.needToSaveLabel = true;
3954 k.updateCloseButton();
3955 };
3956 ponySelector.createSelector();
3957 k._randomUpdateButtonText(current, ponySelector.menu);
3958
3959 var mass = d.createElement('a');
3960 mass.href = '#';
3961 mass.className = 'uiButton';
3962 mass.setAttribute('role', 'button');
3963 mass.id = 'ponyhoof_options_randomPonies_mass';
3964 mass.innerHTML = '<span class="uiButtonText">'+CURRENTLANG.invertSelection+'</span>';
3965 mass.addEventListener('click', function(e) {
3966 var newCurrent = [];
3967 for (var i = 0, len = PONIES.length; i < len; i += 1) {
3968 var menuitem = ponySelector.menu.menu.querySelector('.ponyhoof_menuitem[data-ponyhoof-menu-data="'+PONIES[i].code+'"]');
3969 if (PONIES[i].hidden) {
3970 if (menuitem) {
3971 removeClass(menuitem, 'ponyhoof_menuitem_checked');
3972 }
3973 continue;
3974 }
3975 if (current.indexOf(PONIES[i].code) == -1) {
3976 newCurrent.push(PONIES[i].code);
3977
3978 if (menuitem) {
3979 addClass(menuitem, 'ponyhoof_menuitem_checked');
3980 }
3981 } else {
3982 if (menuitem) {
3983 removeClass(menuitem, 'ponyhoof_menuitem_checked');
3984 }
3985 }
3986 }
3987 current = newCurrent;
3988 userSettings.randomPonies = current.join('|');
3989 saveSettings();
3990
3991 k._randomUpdateButtonText(current, ponySelector.menu);
3992 k.needToSaveLabel = true;
3993 k.updateCloseButton();
3994 w.setTimeout(function() {
3995 ponySelector.menu.open();
3996 }, 1);
3997
3998 return false;
3999 }, false);
4000 outerwrap.appendChild(mass);
4001 };
4002
4003 k._randomUpdateButtonText = function(current, menuClass) {
4004 var buttonText = "("+current.length+" characters)";
4005 if (current.length == 0) {
4006 buttonText = "(All characters)";
4007 } else if (current.length == 1) {
4008 var data = convertCodeToData(current[0]);
4009 buttonText = data.name;
4010 }
4011 menuClass.changeButtonText(buttonText);
4012 };
4013
4014 k.soundsMenu = null;
4015 k.soundsButton = null;
4016 k.soundsInitLoaded = false;
4017 k.soundsNotifTypeMenu = null;
4018 k.soundsNotifTypeButton = null;
4019 k.soundsSettingsWrap = null;
4020
4021 k.soundsChatSoundWarning = null;
4022 k.soundsChatLoaded = false;
4023 k.soundsChatWrap = null;
4024 k.soundsChatMenu = null;
4025 k.soundsChatButton = null;
4026 k.soundsInit = function() {
4027 if (k.soundsInitLoaded) {
4028 return;
4029 }
4030
4031 try {
4032 if (typeof w.Audio === 'undefined') {
4033 throw 1;
4034 }
4035 initPonySound('soundsTest');
4036 } catch (e) {
4037 $$(k.dialog.dialog, '.unavailable', function(ele) {
4038 removeClass(ele, 'hidden_elem');
4039 });
4040 $$(k.dialog.dialog, '.available', function(ele) {
4041 addClass(ele, 'hidden_elem');
4042 });
4043 k.soundsInitLoaded = true;
4044 return;
4045 }
4046
4047 var desc = "(Auto-select)";
4048 if (SOUNDS[userSettings.soundsFile] && SOUNDS[userSettings.soundsFile].name) {
4049 desc = SOUNDS[userSettings.soundsFile].name;
4050 }
4051
4052 k.soundsMenu = new Menu('sounds', $('ponyhoof_options_soundsSetting'));
4053 k.soundsButton = k.soundsMenu.createButton(desc);
4054 k.soundsMenu.createMenu();
4055 k.soundsMenu.attachButton();
4056
4057 for (var code in SOUNDS) {
4058 if (SOUNDS.hasOwnProperty(code)) {
4059 k._soundsMenu_item(code);
4060
4061 if (SOUNDS[code].seperator) {
4062 k.soundsMenu.createSeperator();
4063 }
4064 }
4065 }
4066
4067 k._soundsNotifTypeInit();
4068
4069 var volumeInput = $('ponyhoof_options_soundsVolume');
4070 var volumePreview = $('ponyhoof_options_soundsVolumePreview');
4071 var volumeValue = $('ponyhoof_options_soundsVolumeValue');
4072 var volumeTimeout = null;
4073
4074 volumeInput.value = userSettings.soundsVolume * 100;
4075 if (supportsRange()) {
4076 volumePreview.style.display = 'none';
4077 volumeValue.style.display = 'inline';
4078 volumeValue.innerText = volumeInput.value+"%";
4079 volumeInput.addEventListener('change', function() {
4080 volumeValue.innerText = volumeInput.value+"%";
4081
4082 w.clearTimeout(volumeTimeout);
4083 volumeTimeout = w.setTimeout(function() {
4084 var volume = volumeInput.value / 100;
4085 userSettings.soundsVolume = Math.max(0, Math.min(volume, 1));
4086 saveSettings();
4087
4088 k._soundsPreview(userSettings.soundsFile);
4089 }, 300);
4090 }, false);
4091 } else {
4092 volumeInput.type = 'number';
4093 volumeInput.className = 'inputtext';
4094 volumeInput.setAttribute('data-hover', 'tooltip');
4095 volumeInput.setAttribute('aria-label', "Enter a number between 1-100");
4096 volumePreview.addEventListener('click', function(e) {
4097 var volume = volumeInput.value / 100;
4098 userSettings.soundsVolume = Math.max(0, Math.min(volume, 1));
4099 saveSettings();
4100
4101 k._soundsPreview(userSettings.soundsFile);
4102 e.preventDefault();
4103 }, false);
4104 }
4105
4106 k.soundsChanged();
4107
4108 // Detect chat sound enabled setting
4109 k.soundsChatSoundWarning = $('ponyhoof_options_soundsChatSoundWarning');
4110 k.soundsChatWrap = $('ponyhoof_options_soundsChatWrap');
4111 try {
4112 if (typeof USW.requireLazy == 'function') {
4113 USW.requireLazy(['ChatOptions', 'Arbiter'], function(ChatOptions, Arbiter) {
4114 if (userSettings.chatSound) {
4115 k._soundsChatSoundWarn(ChatOptions.getSetting('sound'));
4116 } else {
4117 addClass(k.soundsChatSoundWarning, 'hidden_elem');
4118 }
4119
4120 Arbiter.subscribe('chat/option-changed', function(e, option) {
4121 if (!userSettings.chatSound) {
4122 return;
4123 }
4124 if (option.name == 'sound') {
4125 k._soundsChatSoundWarn(option.value);
4126 }
4127 });
4128 });
4129 }
4130 } catch (e) {
4131 error("Unable to hook to ChatOptions and Arbiter");
4132 dir(e);
4133 }
4134
4135 // Detect Facebook Messenger for Windows
4136 if (w.navigator.plugins) {
4137 w.navigator.plugins.refresh(false);
4138
4139 for (var i = 0, len = w.navigator.plugins.length; i < len; i += 1) {
4140 var plugin = w.navigator.plugins[i];
4141 if (plugin[0] && plugin[0].type === 'application/x-facebook-desktop-1') {
4142 removeClass($('ponyhoof_options_soundsMessengerForWindowsWarning'), 'hidden_elem');
4143 break;
4144 }
4145 }
4146 }
4147
4148 k._soundsChatLoad();
4149 k._soundsChatInit();
4150
4151 var button = k.soundsChatSoundWarning.getElementsByClassName('uiButton');
4152 button[0].addEventListener('click', function() {
4153 k._soundsTurnOnFbSound();
4154 }, false);
4155
4156 k.soundsInitLoaded = true;
4157 };
4158
4159 // Create a menu item for notification sounds
4160 // Used only on k.soundsInit()
4161 k._soundsMenu_item = function(code) {
4162 var check = false;
4163 if (userSettings.soundsFile == code) {
4164 check = true;
4165 }
4166
4167 k.soundsMenu.createMenuItem({
4168 html: SOUNDS[code].name
4169 ,title: SOUNDS[code].title
4170 ,data: code
4171 ,check: check
4172 ,onclick: function(menuItem, menuClass) {
4173 if (!SOUNDS[code] || !SOUNDS[code].name) {
4174 return;
4175 }
4176
4177 //$('ponyhoof_options_sounds').checked = true;
4178 //userSettings.sounds = true;
4179 userSettings.soundsFile = code;
4180 saveSettings();
4181
4182 k._soundsPreview(code);
4183
4184 menuClass.changeButtonText(menuItem.getText());
4185 menuClass.changeChecked(menuItem);
4186
4187 k.needToSaveLabel = true;
4188 k.updateCloseButton();
4189 }
4190 });
4191 };
4192
4193 // Warn people that Facebook's own chat sound needs to be enabled
4194 // Used 2 times on k.soundsInit()
4195 k._soundsChatSoundWarn = function(isFbSoundEnabled) {
4196 if (isFbSoundEnabled) {
4197 addClass(k.soundsChatSoundWarning, 'hidden_elem');
4198 $('ponyhoof_options_chatSound').disabled = false;
4199 if (userSettings.chatSound) {
4200 $('ponyhoof_options_chatSound').checked = true;
4201 }
4202 } else {
4203 removeClass(k.soundsChatSoundWarning, 'hidden_elem');
4204 $('ponyhoof_options_chatSound').disabled = true;
4205 $('ponyhoof_options_chatSound').checked = false;
4206 }
4207 };
4208
4209 // Turn on Facebook chat sounds
4210 // Used on k.soundsInit() and k.chatSound()
4211 k._soundsTurnOnFbSound = function() {
4212 try {
4213 if (typeof USW.requireLazy == 'function') {
4214 USW.requireLazy(['ChatOptions', 'ChatSidebarDropdown'], function(ChatOptions, ChatSidebarDropdown) {
4215 ChatOptions.setSetting('sound', 1);
4216 ChatSidebarDropdown.prototype.changeSetting('sound', 1);
4217 });
4218 }
4219 } catch (e) {
4220 error("Unable to hook to ChatOptions and ChatSidebarDropdown");
4221 dir(e);
4222 }
4223 };
4224
4225 k._soundsNotifTypeCurrent = [];
4226 // Initialize the notification sound blacklist and its HTML template
4227 // Used only on k.soundsInit()
4228 k._soundsNotifTypeInit = function() {
4229 if (userSettings.soundsNotifTypeBlacklist) {
4230 var current = userSettings.soundsNotifTypeBlacklist.split('|');
4231
4232 for (var code in SOUNDS_NOTIFTYPE) {
4233 if (current.indexOf(code) != -1) {
4234 k._soundsNotifTypeCurrent.push(code);
4235 }
4236 }
4237 }
4238
4239 k.soundsNotifTypeMenu = new Menu('soundsNotifType', $('ponyhoof_options_soundsNotifType'));
4240 k.soundsNotifTypeButton = k.soundsNotifTypeMenu.createButton('');
4241 k.soundsNotifTypeMenu.canSearch = false;
4242 k.soundsNotifTypeMenu.createMenu();
4243 k.soundsNotifTypeMenu.attachButton();
4244
4245 for (var code in SOUNDS_NOTIFTYPE) {
4246 if (SOUNDS_NOTIFTYPE.hasOwnProperty(code)) {
4247 k._soundsNotifTypeInit_item(code);
4248 }
4249 }
4250 k._soundsNotifTypeUpdateButtonText(k._soundsNotifTypeCurrent, k.soundsNotifTypeMenu);
4251 };
4252
4253 // Create a menu item for notification sound blacklist
4254 // Used only on k._soundsNotifTypeInit()
4255 k._soundsNotifTypeInit_item = function(code) {
4256 var check = false;
4257 if (k._soundsNotifTypeCurrent.indexOf(code) != -1) {
4258 check = true;
4259 }
4260
4261 k.soundsNotifTypeMenu.createMenuItem({
4262 html: SOUNDS_NOTIFTYPE[code].name
4263 ,data: code
4264 ,check: check
4265 ,onclick: function(menuItem, menuClass) {
4266 if (!SOUNDS_NOTIFTYPE[code] || !SOUNDS_NOTIFTYPE[code].name) {
4267 return;
4268 }
4269
4270 if (!hasClass(menuItem.menuItem, 'ponyhoof_menuitem_checked')) {
4271 menuItem.menuItem.className += ' ponyhoof_menuitem_checked';
4272
4273 k._soundsNotifTypeCurrent.push(code);
4274 } else {
4275 removeClass(menuItem.menuItem, 'ponyhoof_menuitem_checked');
4276
4277 k._soundsNotifTypeCurrent.splice(k._soundsNotifTypeCurrent.indexOf(code), 1);
4278 }
4279 userSettings.soundsNotifTypeBlacklist = k._soundsNotifTypeCurrent.join('|');
4280 saveSettings();
4281
4282 k._soundsNotifTypeUpdateButtonText(k._soundsNotifTypeCurrent, menuClass);
4283 k.needToSaveLabel = true;
4284 k.updateCloseButton();
4285 }
4286 });
4287 };
4288
4289 // Update the notification sound blacklist button text, perhaps after changes
4290 // Used on k._soundsNotifTypeInit() and k._soundsNotifType_item()
4291 k._soundsNotifTypeUpdateButtonText = function(current, menuClass) {
4292 var buttonText = "("+current.length+" types)";
4293 if (current.length == 0) {
4294 buttonText = "(None)";
4295 } else if (current.length == 1) {
4296 buttonText = SOUNDS_NOTIFTYPE[current[0]].name;
4297 }
4298 menuClass.changeButtonText(buttonText);
4299 };
4300
4301 // Hide/show the extra sound options if the main sound option id disabled/enabled
4302 // Used on k.soundsInit(), the sound option is changed, or DOMNodeInserted is disabled
4303 k.soundsChanged = function() {
4304 k.soundsSettingsWrap = k.soundsSettingsWrap || $('ponyhoof_options_soundsSettingsWrap');
4305 if (userSettings.sounds && !userSettings.disableDomNodeInserted) {
4306 removeClass(k.soundsSettingsWrap, 'hidden_elem');
4307 } else {
4308 addClass(k.soundsSettingsWrap, 'hidden_elem');
4309 }
4310 };
4311
4312 // Calls the main function k.soundsChanged(), and also performs extra cleanup duties, e.g. if the user disable sounds, we need to update the Close button to "Save and Reload"
4313 // Used when the sound option is changed
4314 k.soundsClicked = function() {
4315 k.soundsChanged();
4316
4317 if (userSettings.sounds) {
4318 turnOffFbNotificationSound();
4319 } else {
4320 // We already nuked Facebook's sounds, so we need to reload
4321 k.needsToRefresh = true;
4322 k.updateCloseButton();
4323 }
4324 };
4325
4326 // The wording of this function is a bit confusing
4327 // Hide/show the extra chat sound options if the chat sound option is disabled/enabled
4328 // Used on k.soundsInit() and k.chatSound()
4329 k._soundsChatInit = function() {
4330 if (userSettings.chatSound) {
4331 removeClass(k.soundsChatWrap, 'hidden_elem');
4332 } else {
4333 addClass(k.soundsChatSoundWarning, 'hidden_elem');
4334 addClass(k.soundsChatWrap, 'hidden_elem');
4335 }
4336 };
4337
4338 // Initialize the chat sounds options and its HTML template
4339 // Used only on k.soundsInit()
4340 k._soundsChatLoad = function() {
4341 if (k.soundsChatLoaded) {
4342 return;
4343 }
4344
4345 var desc = "(Select a chat sound)";
4346 if (SOUNDS_CHAT[userSettings.chatSoundFile] && SOUNDS_CHAT[userSettings.chatSoundFile].name) {
4347 desc = SOUNDS_CHAT[userSettings.chatSoundFile].name;
4348 }
4349 k.soundsChatMenu = new Menu('sounds_chat', $('ponyhoof_options_soundsChatSetting'));
4350 k.soundsChatButton = k.soundsChatMenu.createButton(desc);
4351 k.soundsChatMenu.canSearch = false;
4352 k.soundsChatMenu.createMenu();
4353 k.soundsChatMenu.attachButton();
4354 for (var code in SOUNDS_CHAT) {
4355 if (SOUNDS_CHAT.hasOwnProperty(code)) {
4356 k._soundsChatLoad_item(code);
4357 }
4358 }
4359 k.soundsChatLoaded = true;
4360 };
4361
4362 // Create a menu item for chat sound options
4363 // Used only on k._soundsChatLoad()
4364 k._soundsChatLoad_item = function(code) {
4365 var check = false;
4366 if (userSettings.chatSoundFile == code) {
4367 check = true;
4368 }
4369
4370 k.soundsChatMenu.createMenuItem({
4371 html: SOUNDS_CHAT[code].name
4372 ,title: SOUNDS_CHAT[code].title
4373 ,data: code
4374 ,check: check
4375 ,onclick: function(menuItem, menuClass) {
4376 if (!SOUNDS_CHAT[code] || !SOUNDS_CHAT[code].name) {
4377 return;
4378 }
4379
4380 userSettings.chatSoundFile = code;
4381 saveSettings();
4382
4383 k._soundsPreview(code);
4384 changeChatSound(code);
4385
4386 menuClass.changeButtonText(menuItem.getText());
4387 menuClass.changeChecked(menuItem);
4388
4389 k.needToSaveLabel = true;
4390 k.updateCloseButton();
4391 }
4392 });
4393 };
4394
4395 // When the user enables chat sounds, we will turn it on immediately, while if the user chooses to turn it off, we would change the Close button to "Save and Reload"
4396 // Also calls k._soundsChatInit()
4397 // Used when the chat sound option is changed
4398 k.chatSound = function() {
4399 if (userSettings.chatSound) {
4400 // Enable Facebook's chat sound automatically
4401 k._soundsTurnOnFbSound();
4402 if (SOUNDS_CHAT[userSettings.chatSoundFile] && SOUNDS_CHAT[userSettings.chatSoundFile].name) {
4403 changeChatSound(userSettings.chatSoundFile);
4404 }
4405 } else {
4406 // Chat sounds are already ponified, we need to reload to clear it
4407 k.needsToRefresh = true;
4408 k.updateCloseButton();
4409 }
4410 k._soundsChatInit();
4411 };
4412
4413 // Run a sound preview
4414 k._soundsPreview = function(code) {
4415 var sound = code;
4416 if (code == 'AUTO') {
4417 sound = '_sound/defaultNotification';
4418
4419 var data = convertCodeToData(REALPONY);
4420 if (data.soundNotif) {
4421 sound = data.soundNotif;
4422 }
4423 }
4424 try {
4425 var ps = initPonySound('soundsTest', THEMEURL+sound+'.EXT');
4426 ps.respectSettings = false;
4427 ps.wait = 0;
4428 ps.play();
4429 } catch (e) {}
4430 };
4431
4432 k.bgError = null;
4433 k.bgTab = null;
4434 k.bgDrop = null;
4435 k.bgClearCustomBg = false;
4436 k.bgInitLoaded = false;
4437 k.bgSizeLimit = 1024 * 1024;
4438 k.bgSizeLimitDescription = '1 MB';
4439 k.bgInit = function() {
4440 if (k.bgInitLoaded) {
4441 return;
4442 }
4443
4444 k.bgError = $('ponyhoof_options_background_error');
4445 k.bgTab = $('ponyhoof_options_tabs_background');
4446 k.bgDrop = $('ponyhoof_options_background_drop');
4447
4448 // Firefox 23 started enforcing a 1MB limit per preference
4449 // http://hg.mozilla.org/mozilla-central/rev/2e46cabb6a11
4450 if (ISFIREFOX && STORAGEMETHOD == 'greasemonkey') {
4451 k.bgSizeLimit = 1024 * 512;
4452 k.bgSizeLimitDescription = '512 KB';
4453 }
4454
4455 if (userSettings.customBg) {
4456 addClass(k.bgTab, 'hasCustom');
4457 addClass($('ponyhoof_options_background_custom'), 'active');
4458 } else if (userSettings.login_bg) {
4459 addClass($('ponyhoof_options_background_loginbg'), 'active');
4460 } else {
4461 addClass($('ponyhoof_options_background_cutie'), 'active');
4462 }
4463
4464 $$(k.bgTab, '.ponyhoof_options_fatradio a', function(ele) {
4465 ele.addEventListener('click', function() {
4466 $$(k.bgTab, '.ponyhoof_options_fatradio a', function(ele2) {
4467 removeClass(ele2.parentNode, 'active');
4468 });
4469
4470 var parent = this.parentNode;
4471 var attr = parent.getAttribute('data-ponyhoof-background');
4472 if (attr == 'custom') {
4473 userSettings.login_bg = false;
4474 changeCustomBg(userSettings.customBg);
4475 k.bgClearCustomBg = false;
4476 } else if (attr == 'loginbg') {
4477 userSettings.login_bg = true;
4478 changeCustomBg(null);
4479 addClass(d.documentElement, 'ponyhoof_settings_login_bg');
4480 k.bgClearCustomBg = true;
4481 } else {
4482 userSettings.login_bg = false;
4483 changeCustomBg(null);
4484 k.bgClearCustomBg = true;
4485 }
4486 addClass(parent, 'active');
4487 saveSettings();
4488
4489 k.needToSaveLabel = true;
4490 k.updateCloseButton();
4491
4492 return false;
4493 }, false);
4494 });
4495
4496 $('ponyhoof_options_background_select').addEventListener('change', function(e) {
4497 if (this.files && this.files[0]) {
4498 k.bgProcessFile(this.files[0]);
4499 }
4500 }, false);
4501
4502 var uiHelpLink = k.bgDrop.getElementsByClassName('uiHelpLink');
4503 if (uiHelpLink.length) {
4504 uiHelpLink[0].setAttribute('aria-label', 'Maximum file size is '+k.bgSizeLimitDescription+'.\n\nYour image resolution should be '+w.screen.width+'x'+w.screen.height+' to fill the entire screen. Your image will not be resized and will be placed on the middle of the page.');
4505 }
4506
4507 k.bgDropInit();
4508
4509 k.bgInitLoaded = true;
4510 };
4511
4512 k.bgDropInit = function() {
4513 if (typeof w.FileReader == 'undefined') {
4514 k.bgError.textContent = "Custom background images are not supported on your browser. Please update your browser if possible.";
4515 removeClass(k.bgError, 'hidden_elem');
4516 addClass(k.bgDrop, 'hidden_elem');
4517 return;
4518 }
4519
4520 k.bgDrop.addEventListener('drop', function(e) {
4521 e.stopPropagation();
4522 e.preventDefault();
4523
4524 removeClass(this, 'ponyhoof_dropping');
4525
4526 if (e.dataTransfer.files && e.dataTransfer.files[0]) {
4527 k.bgProcessFile(e.dataTransfer.files[0]);
4528 }
4529 }, false);
4530
4531 k.bgDrop.addEventListener('dragover', function(e) {
4532 e.stopPropagation();
4533 e.preventDefault();
4534
4535 e.dataTransfer.dropEffect = 'copy';
4536 }, false);
4537
4538 k.bgDrop.addEventListener('dragenter', function(e) {
4539 addClass(k.bgDrop, 'ponyhoof_dropping');
4540 }, false);
4541
4542
4543 k.bgDrop.addEventListener('dragend', function(e) {
4544 removeClass(k.bgDrop, 'ponyhoof_dropping')
4545 }, false);
4546 }
4547
4548 k.bgProcessFile = function(file) {
4549 if (!file.type.match(/image.*/)) {
4550 if (file.type) {
4551 k.bgError.textContent = "The file ("+file.name+") doesn't seem to be an image ("+file.type+").";
4552 } else {
4553 k.bgError.textContent = "The file ("+file.name+") doesn't seem to be an image.";
4554 }
4555 removeClass(k.bgError, 'hidden_elem');
4556 return;
4557 }
4558
4559 if (file.size > k.bgSizeLimit) {
4560 if (file.type && file.type != 'image/jpeg') {
4561 k.bgError.textContent = "Sorry, the file size of your image is too big (over "+k.bgSizeLimitDescription+") and may not save properly. Try saving your image as a JPEG or resize your image.";
4562 } else {
4563 k.bgError.textContent = "Sorry, the file size of your image is too big (over "+k.bgSizeLimitDescription+") and may not save properly. Try resizing your image.";
4564 }
4565 removeClass(k.bgError, 'hidden_elem');
4566 return;
4567 }
4568
4569 var reader = new w.FileReader();
4570 reader.onload = function(e) {
4571 addClass(k.bgError, 'hidden_elem');
4572 addClass(k.bgTab, 'hasCustom');
4573
4574 $$(k.bgTab, '.ponyhoof_options_fatradio a', function(ele2) {
4575 removeClass(ele2.parentNode, 'active');
4576 });
4577 addClass($('ponyhoof_options_background_custom'), 'active');
4578 k.bgClearCustomBg = false;
4579
4580 userSettings.login_bg = false;
4581 userSettings.customBg = e.target.result;
4582 saveSettings();
4583
4584 k.needToSaveLabel = true;
4585 k.updateCloseButton();
4586
4587 changeCustomBg(e.target.result);
4588 };
4589 reader.onerror = function(e) {
4590 k.bgError.textContent = "An error occurred reading the file. Please try again.";
4591 dir(e);
4592 removeClass(k.bgError, 'hidden_elem');
4593 };
4594 reader.readAsDataURL(file);
4595 };
4596
4597 k.disableDomNodeInserted = function() {
4598 k.soundsChanged(); // to set k.soundsSettingsWrap
4599
4600 var affectedOptions = ['sounds', 'debug_dominserted_console', 'debug_noMutationObserver', 'debug_mutationDebug', 'debug_betaFacebookLinks'];
4601 //'disableCommentBrohoofed','debug_mutationObserver'
4602 for (var i = 0, len = affectedOptions.length; i < len; i += 1) {
4603 var option = $('ponyhoof_options_'+affectedOptions[i]);
4604 var label = $('ponyhoof_options_label_'+affectedOptions[i]);
4605 if (userSettings.disableDomNodeInserted) {
4606 if (ranDOMNodeInserted) {
4607 k.needsToRefresh = true;
4608 k.updateCloseButton();
4609 }
4610
4611 option.disabled = true;
4612 option.checked = false;
4613
4614 addClass(label, 'ponyhoof_options_unavailable');
4615 label.setAttribute('data-hover', 'tooltip');
4616 label.setAttribute('aria-label', "This feature is not available because HTML detection is disabled, re-enable it at the Misc tab");
4617 } else {
4618 var option = $('ponyhoof_options_'+affectedOptions[i]);
4619 option.disabled = false;
4620 if (userSettings[affectedOptions[i]]) {
4621 option.checked = true;
4622 }
4623
4624 removeClass(label, 'ponyhoof_options_unavailable');
4625 label.removeAttribute('data-hover');
4626 label.removeAttribute('aria-label');
4627 label.removeAttribute('aria-owns');
4628 label.removeAttribute('aria-controls');
4629 label.removeAttribute('aria-haspopup');
4630 }
4631 }
4632 k._debugNoMutationObserver();
4633 };
4634
4635 k.disableDomNodeInsertedClicked = function() {
4636 if (!userSettings.disableDomNodeInserted) {
4637 runDOMNodeInserted();
4638 }
4639 k.disableDomNodeInserted();
4640 };
4641
4642 k.allowLoginScreenClicked = function() {
4643 if (globalSettings.allowLoginScreen) {
4644 globalSettings.lastUserId = USERID;
4645 } else {
4646 globalSettings.lastUserId = null;
4647 }
4648 saveGlobalSettings();
4649 };
4650
4651 k.debug_disablelog = function() {
4652 if ($('ponyhoof_options_debug_disablelog').checked) {
4653 CANLOG = false;
4654 } else {
4655 CANLOG = true;
4656 }
4657 };
4658
4659 k.disableDialog = null;
4660 k.disablePonyhoof = function() {
4661 if ($('ponyhoof_dialog_disable')) {
4662 $('ponyhoof_disable_allowLoginScreen').checked = !globalSettings.allowLoginScreen;
4663 $('ponyhoof_disable_runForNewUsers').checked = !globalSettings.runForNewUsers;
4664
4665 k.dialog.hide();
4666 k.disableDialog.show();
4667 $('ponyhoof_disable_ok').focus();
4668 return false;
4669 }
4670
4671 var c = '';
4672 c += "<strong>Are you sure you want to disable Ponyhoof for yourself?</strong><br><br>";
4673 c += "You can re-enable Ponyhoof for yourself at any time by going back to Ponyhoof Options and re-select a character.<br><br>";
4674 c += '<div class="uiInputLabel"><input type="checkbox" class="uiInputLabelCheckbox" id="ponyhoof_disable_allowLoginScreen"><label for="ponyhoof_disable_allowLoginScreen">Don\'t run Ponyhoof on the Facebook login screen</label></div>';
4675 c += '<div class="uiInputLabel" data-hover="tooltip" aria-label="'+CURRENTLANG['settings_disable_runForNewUsers_explain']+'"><input type="checkbox" class="uiInputLabelCheckbox" id="ponyhoof_disable_runForNewUsers"><label for="ponyhoof_disable_runForNewUsers">Don\'t run Ponyhoof for new users <a href="#" class="uiHelpLink"></a></label></div>';
4676
4677 var bottom = '';
4678 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm" role="button" id="ponyhoof_disable_ok"><span class="uiButtonText">Disable</span></a>';
4679 bottom += '<a href="#" class="uiButton uiButtonLarge" role="button" id="ponyhoof_disable_no"><span class="uiButtonText">Cancel</span></a>';
4680
4681 k.dialog.hide();
4682 k.disableDialog = new Dialog('disable');
4683 k.disableDialog.alwaysModal = true;
4684 k.disableDialog.create();
4685 k.disableDialog.changeTitle("Disable Ponyhoof");
4686 k.disableDialog.changeContent(c);
4687 k.disableDialog.changeBottom(bottom);
4688
4689 $('ponyhoof_disable_allowLoginScreen').checked = !globalSettings.allowLoginScreen;
4690 $('ponyhoof_disable_runForNewUsers').checked = !globalSettings.runForNewUsers;
4691
4692 k.disableDialog.show();
4693 k.disableDialog.onclose = function() {
4694 k.dialog.show();
4695 };
4696
4697 $('ponyhoof_disable_ok').focus();
4698 $('ponyhoof_disable_ok').addEventListener('click', function() {
4699 userSettings.theme = 'NONE';
4700 saveSettings();
4701
4702 globalSettings.allowLoginScreen = !$('ponyhoof_disable_allowLoginScreen').checked;
4703 globalSettings.runForNewUsers = !$('ponyhoof_disable_runForNewUsers').checked;
4704 saveGlobalSettings();
4705
4706 k.disableDialog.canCloseByEscapeKey = false;
4707 d.body.style.cursor = 'progress';
4708 $('ponyhoof_disable_allowLoginScreen').disabled = true;
4709 $('ponyhoof_disable_runForNewUsers').disabled = true;
4710 $('ponyhoof_disable_ok').className += ' uiButtonDisabled';
4711 $('ponyhoof_disable_no').className += ' uiButtonDisabled';
4712 w.location.reload();
4713
4714 return false;
4715 }, false);
4716
4717 $('ponyhoof_disable_no').addEventListener('click', function() {
4718 k.disableDialog.close();
4719 return false;
4720 }, false);
4721
4722 return false;
4723 };
4724
4725 k.browserPonies = null;
4726 k.runBrowserPonies = function() {
4727 var link = this;
4728 if (hasClass(link, 'ponyhoof_browserponies_loading')) {
4729 return false;
4730 }
4731
4732 var alreadyLoaded = !!k.browserPonies;
4733 addClass(link, 'ponyhoof_browserponies_loading');
4734
4735 if (!alreadyLoaded) {
4736 k.browserPonies = new BrowserPoniesHoof();
4737 }
4738 k.browserPonies.doneCallback = function() {
4739 k.dialog.close();
4740 removeClass(link, 'ponyhoof_browserponies_loading');
4741 if (!alreadyLoaded) {
4742 k.browserPonies.copyrightDialog();
4743 }
4744 k.browserPonies.createDialog();
4745 };
4746 k.browserPonies.errorCallback = function(error) {
4747 removeClass(link, 'ponyhoof_browserponies_loading');
4748 k.browserPonies.createErrorDialog(error);
4749 };
4750 k.browserPonies.run();
4751
4752 return false;
4753 }
4754
4755 k.checkboxStore = {};
4756 k.generateCheckbox = function(id, label, data) {
4757 data = data || {};
4758 var ex = '';
4759 var checkmark = '';
4760
4761 if ((!data.global && userSettings[id]) || (data.global && globalSettings[id])) {
4762 checkmark += ' CHECKED';
4763 }
4764 data.extraClass = data.extraClass || '';
4765 if (data.title) {
4766 label += ' <a href="#" class="uiHelpLink"></a>';
4767 ex += ' data-hover="tooltip" aria-label="'+data.title+'"';
4768 }
4769 if (data.tip) {
4770 label += ' <a href="#" class="uiHelpLink ponyhoof_tip_trigger"><div class="ponyhoof_tip_wrapper"><span class="ponyhoof_tip"><span class="ponyhoof_tip_body">'+data.tip+'</span><span class="ponyhoof_tip_arrow"></span></span></div></a>';
4771 }
4772
4773 k.checkboxStore[id] = data;
4774
4775 return '<div class="uiInputLabel '+data.extraClass+'"'+ex+' id="ponyhoof_options_label_'+id+'"><input type="checkbox" class="uiInputLabelCheckbox" id="ponyhoof_options_'+id+'" data-ponyhoof-checkmark="'+id+'" '+checkmark+'><label for="ponyhoof_options_'+id+'">'+label+'</label></div>';
4776 };
4777
4778 k.checkboxInit = function() {
4779 var extras = $('ponyhoof_dialog_options').querySelectorAll('input[type="checkbox"]');
4780 for (var i = 0, len = extras.length; i < len; i += 1) {
4781 var checkmark = extras[i].getAttribute('data-ponyhoof-checkmark');
4782 var data = {};
4783 if (k.checkboxStore[checkmark]) {
4784 data = k.checkboxStore[checkmark];
4785 }
4786 if (data.tooltipPosition) {
4787 extras[i].parentNode.setAttribute('data-tooltip-position', data.tooltipPosition);
4788 }
4789
4790 extras[i].addEventListener('click', function() {
4791 var checkmark = this.getAttribute('data-ponyhoof-checkmark');
4792 var data = {};
4793 if (k.checkboxStore[checkmark]) {
4794 data = k.checkboxStore[checkmark];
4795 }
4796
4797 if (!data.global) {
4798 userSettings[checkmark] = this.checked;
4799 saveSettings();
4800 } else {
4801 globalSettings[checkmark] = this.checked;
4802 saveGlobalSettings();
4803 }
4804
4805 if (this.checked) {
4806 addClass(d.documentElement, 'ponyhoof_settings_'+checkmark);
4807 } else {
4808 removeClass(d.documentElement, 'ponyhoof_settings_'+checkmark);
4809 }
4810 if (data.refresh) {
4811 k.needsToRefresh = true;
4812 }
4813 if (data.customFunc) {
4814 data.customFunc();
4815 }
4816
4817 k.needToSaveLabel = true;
4818 k.updateCloseButton();
4819 }, true);
4820 }
4821 };
4822
4823 k.tabsExposeDebug = 0;
4824 k.tabsInit = function() {
4825 var tabs = k.dialog.dialog.querySelectorAll('.ponyhoof_tabs a');
4826 for (var i = 0, len = tabs.length; i < len; i += 1) {
4827 tabs[i].addEventListener('click', function(e) {
4828 var tabName = this.getAttribute('data-ponyhoof-tab');
4829 if (tabName == 'extras') {
4830 if (!userSettings.debug_exposed && k.tabsExposeDebug < 5) {
4831 k.tabsExposeDebug += 1;
4832 if (k.tabsExposeDebug >= 5) {
4833 addClass(k.dialog.dialog, 'ponyhoof_options_debugExposed');
4834 k.switchTab('advanced');
4835 return;
4836 }
4837 }
4838 } else {
4839 k.tabsExposeDebug = 0;
4840 }
4841
4842 k.switchTab(tabName);
4843 e.preventDefault();
4844 }, false);
4845 }
4846 };
4847
4848 k.switchTab = function(tabName) {
4849 var tabActions = {
4850 'main': k.mainInit
4851 ,'background': k.bgInit
4852 ,'sounds': k.soundsInit
4853 ,'extras': k.extrasInit
4854 ,'advanced': k.debugInfo
4855 ,'about': k.loadDonate
4856 };
4857 removeClass(k.dialog.dialog.querySelector('.ponyhoof_tabs a.active'), 'active');
4858 addClass(k.dialog.dialog.querySelector('.ponyhoof_tabs a[data-ponyhoof-tab="'+tabName+'"]'), 'active');
4859
4860 try {
4861 if (tabActions[tabName]) {
4862 tabActions[tabName]();
4863 }
4864 } catch (e) {
4865 dir(e);
4866 ponyhoofError(e.toString());
4867 }
4868
4869 $$(k.dialog.dialog, '.ponyhoof_tabs_section', function(section) {
4870 section.style.display = 'none';
4871 });
4872 $('ponyhoof_options_tabs_'+tabName).style.display = 'block';
4873
4874 k.dialog.cardSpaceTick();
4875 };
4876
4877 k.saveButtonClick = function() {
4878 k.dialog.close();
4879 return false;
4880 };
4881
4882 k.dialogOnClose = function() {
4883 d.removeEventListener('keydown', k.kf, true);
4884
4885 if (k.debugLoaded) {
4886 if ($('ponyhoof_options_customcss').value == "Enter any custom CSS to load after Ponyhoof is loaded.") {
4887 userSettings.customcss = '';
4888 } else {
4889 userSettings.customcss = $('ponyhoof_options_customcss').value;
4890 }
4891 }
4892 if (k.canSaveSettings) {
4893 saveSettings();
4894 }
4895
4896 if (k.needsToRefresh) {
4897 w.location.reload();
4898 }
4899 };
4900
4901 k.dialogOnCloseFinish = function() {
4902 k.saveButton.getElementsByClassName('uiButtonText')[0].innerHTML = CURRENTLANG.close;
4903
4904 if (k.canSaveSettings) {
4905 if (k.bgClearCustomBg) {
4906 removeClass(k.bgTab, 'hasCustom');
4907 userSettings.customBg = null;
4908 saveSettings();
4909 }
4910 }
4911 };
4912
4913 k.updateCloseButton = function() {
4914 var button = k.saveButton.getElementsByClassName('uiButtonText')[0];
4915 var text = CURRENTLANG.close;
4916
4917 if (k.needToSaveLabel) {
4918 text = "Save & Close";
4919 }
4920
4921 if (k.needsToRefresh) {
4922 text = "Save & Reload";
4923 }
4924
4925 button.innerHTML = text;
4926 };
4927
4928 k.injectStyle = function() {
4929 var css = '';
4930 //css += '#ponyhoof_options_tabs_main .clearfix {margin-bottom:10px;}';
4931 css += '#ponyhoof_dialog_options .generic_dialog_popup, #ponyhoof_dialog_options .popup {width:480px;}';
4932 css += '#ponyhoof_options_likebox_div {height:80px;}';
4933 //css += 'html.ponyhoof_isusingpage #ponyhoof_options_likebox_div {display:none;}';
4934 css += '#ponyhoof_options_likebox {border:none;overflow:hidden;width:100%;height:80px;}';
4935 css += '#ponyhoof_options_pony {margin:8px 0 16px;}';
4936 css += '.ponyhoof_options_fatlink {display:block;margin-top:10px;}';
4937 css += '.ponyhoof_options_unavailable label {cursor:default;}';
4938 css += '#ponyhoof_dialog_options .usingPage, html.ponyhoof_isusingpage #ponyhoof_dialog_options .notPage {display:none;}';
4939 css += 'html.ponyhoof_isusingpage #ponyhoof_dialog_options .usingPage {display:block;}';
4940 css += 'html.ponyhoof_isusingbusiness #ponyhoof_dialog_options .notBusiness {display:none;}';
4941
4942 css += '#ponyhoof_dialog_options .uiHelpLink {margin-left:2px;}';
4943 css += '#ponyhoof_dialog_options textarea, #ponyhoof_options_tabs_advanced input[type="text"] {font-family:Consolas,"Andale Mono WT","Andale Mono","Lucida Console","Lucida Sans Typewriter","DejaVu Sans Mono","Bitstream Vera Sans Mono","Liberation Mono","Nimbus Mono L",Monaco,"Courier New",Courier,monospace;}';
4944 css += '#ponyhoof_dialog_options textarea {resize:vertical;width:100%;height:60px;min-height:60px;line-height:normal;}';
4945 css += '#ponyhoof_dialog_options .ponyhoof_tabs > a[data-ponyhoof-tab="advanced"] {display:none;}';
4946 css += '#ponyhoof_dialog_options.ponyhoof_options_debugExposed .ponyhoof_tabs > a[data-ponyhoof-tab="advanced"] {display:block;}';
4947
4948 // 214px
4949 css += '.ponyhoof_options_fatradio {margin:8px 0;}';
4950 css += '.ponyhoof_options_fatradio li {width:222px;float:left;margin-left:12px;}';
4951 css += '#ponyhoof_options_tabs_background.hasCustom .ponyhoof_options_fatradio li {width:144px;}';
4952 css += '.ponyhoof_options_fatradio li:first-child {margin:0;}';
4953 css += '.ponyhoof_options_fatradio a {border:1px solid rgba(0,0,0,.3);display:block;text-align:center;width:100%;text-decoration:none;-moz-border-radius:3px;border-radius:3px;-webkit-transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out;}';
4954 css += '.ponyhoof_options_fatradio a:hover {-moz-box-shadow:0 0 8px rgba(0,0,0,.3);box-shadow:0 0 8px rgba(0,0,0,.3);}';
4955 css += '.ponyhoof_options_fatradio a:active {background:#ECEFF5;-moz-box-shadow:0 0 8px rgba(0,0,0,.7);box-shadow:0 0 8px rgba(0,0,0,.7);}';
4956 css += '.ponyhoof_options_fatradio li.active a {background-color:#6D84B4;border-color:#3b5998;color:#fff;}';
4957 css += '.ponyhoof_options_fatradio span {padding:4px;display:block;}';
4958 css += '.ponyhoof_options_fatradio .wrap i {height:200px;width:100%;display:block;=webkit-transition:all .2s ease-in;-moz-transition:.2s ease-in;-o-transition:.2s ease-in;transition:.2s ease-in;}';
4959 css += '#ponyhoof_options_tabs_background.hasCustom .ponyhoof_options_fatradio .wrap i {height:144px;}';
4960 css += '#ponyhoof_options_background_cutie .wrap {padding:8px;}';
4961 css += '#ponyhoof_options_background_cutie .wrap i {width:206px;height:184px;}';
4962 css += '#ponyhoof_options_tabs_background.hasCustom #ponyhoof_options_background_cutie .wrap i {width:128px;height:128px;}';
4963 css += '#ponyhoof_options_background_custom {display:none;}';
4964 css += '#ponyhoof_options_tabs_background.hasCustom #ponyhoof_options_background_custom {display:block;}';
4965 css += '#ponyhoof_options_background_custom .wrap i {background:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAABiElEQVRIx82WMWrDQBBFhQtXJoWr4DP4AD6ACxGCEEj/CVwZFyFHCCkCOYJJkfMYFzmBi1SpjAvjwpUwKZwiDihiV7uOJJOBrVYzbzUz+2eD4AwDYmCXZdkxy7IjsAPioC0rworQWkElPQAHYCMpLO6VYT+r5I+kBfAiqeeCPZVOnxehLqCkWcl/aYVKmpqCATlwA8Q2IBBLurfsLSV1TfWZ2wLWXcDYBBwBeUvAoS2tYdNQSTNX44TA50VgJ2AX2DaQxq2xWQzASUWQtSSiKBpEUTSQBLCu+MOJU64qYO+S+oYD9oGVh/+3DPrATqdNqzTWM827wLcmYRheVZSh5xvn8kDflFaNobNSKikF9h4fr2o2zd7YBx7XIpV0fVrp2dfCALxrStaSJLl1waYNi3ZeHuLFwg9bmhQ5MDIBxy3Ow7lRtCW9WRw+fKQPOFiaZ2q9wMDSMGI6klKH7HVM8xR4djVOD3iVtJDEH15tIbABDpIeaz0hfYAF6/zPh7Aj3b9k0CpXFfYF15zYxmWum1cAAAAASUVORK5CYII=") no-repeat center center;}';
4966
4967 css += '#ponyhoof_options_background_error {margin-bottom:10px;}';
4968 css += '#ponyhoof_options_background_drop {background:#fff;border:2px dashed #75a3f5;padding:8px;position:relative;}'; //margin-bottom:8px;
4969 css += '#ponyhoof_options_background_drop_dropping {background:#fff;background:rgba(255,255,255,.95);border:2px dashed #75a3f5;color:#75a3f5;position:absolute;top:-2px;left:-2px;width:100%;height:100%;font-size:16px;line-height:64px;text-align:center;font-weight:bold;display:none;}';
4970 css += '#ponyhoof_options_background_drop.ponyhoof_dropping #ponyhoof_options_background_drop_dropping {display:block;}';
4971
4972 css += '#ponyhoof_options_tabs_main .ponyhoof_message {margin-top:10px;}';
4973 css += '#ponyhoof_browserponies .ponyhoof_loading {display:none;margin-top:0;vertical-align:text-bottom;}';
4974 css += '#ponyhoof_browserponies.ponyhoof_browserponies_loading .ponyhoof_loading {display:inline-block;}';
4975 css += '#ponyhoof_options_randomPonies .ponyhoof_loading {display:none !important;}';
4976 css += '#ponyhoof_options_randomPonies .ponyhoof_menuitem_checked {display:block;}';
4977 //css += '#ponyhoof_options_tabs_sounds .ponyhoof_message.unavailable {margin-bottom:10px;}';
4978 css += '#ponyhoof_options_soundsSettingsWrap {margin-top:-14px;}';
4979 css += '#ponyhoof_options_soundsVolume {vertical-align:middle;width:50px;}';
4980 css += '#ponyhoof_options_soundsVolume[type="range"] {cursor:pointer;width:200px;}';
4981 css += '#ponyhoof_options_soundsVolumePreview {vertical-align:middle;}';
4982 css += '#ponyhoof_options_soundsVolumeValue {display:none;padding-left:3px;}';
4983 css += '#ponyhoof_options_soundsChatSoundWarning, #ponyhoof_options_soundsMessengerForWindowsWarning {margin-bottom:10px;}';
4984 css += '#ponyhoof_options_tabs_extras .ponyhoof_show_if_injected + .uiInputLabel, #ponyhoof_options_tabs_extras .uiInputLabel + .ponyhoof_show_if_injected, #ponyhoof_options_tabs_advanced .uiInputLabel + .ponyhoof_show_if_injected {margin-top:3px;}';
4985 css += '#ponyhoof_options_tabs_advanced .ponyhoof_hide_if_injected.ponyhoof_message {margin-bottom:10px;}';
4986 css += '.ponyhoof_options_aboutsection {border-top:1px solid #ccc;margin:10px -10px 0;}';
4987 css += '.ponyhoof_options_aboutsection > .inner {border-top:1px solid #E9E9E9;padding:10px 10px 0;}';
4988 css += '#ponyhoof_options_devpic {display:block;}';
4989 css += '#ponyhoof_options_devpic img {width:50px !important;height:50px !important;}';
4990 css += '#ponyhoof_options_twitter {margin-top:10px;width:100%;height:20px;}';
4991 css += '#ponyhoof_options_plusone {margin-top:10px;height:23px;}';
4992
4993 css += '.ponyhoof_tip_wrapper {position:relative;z-index:10;}';
4994 css += '.ponyhoof_tip_trigger, .ponyhoof_tip_trigger:hover {text-decoration:none;}';
4995 css += '.ponyhoof_tip_trigger:hover .ponyhoof_tip {display:block;}';
4996 css += '.ponyhoof_options_unavailable .ponyhoof_tip_trigger {display:none !important;}';
4997 css += '.ponyhoof_tip {text-align:left;position:absolute;z-index:-1;display:none;top:11px;padding:4px 0 0;right:-7px;color:#000;font-weight:normal;}';
4998 css += '.ponyhoof_tip_body {line-height:15px;width:300px;white-space:normal;background:#fff;border:1px solid;border-color:#888 #999;display:block;left:0;padding:6px 8px;-moz-box-shadow:0 1px 0 rgba(0,0,0,.1);box-shadow:0 1px 0 rgba(0,0,0,.1);}';
4999 css += '.ponyhoof_tip_arrow {position:absolute;top:0;right:10px;border:solid transparent;border-width:0 3px 5px 4px;border-bottom-color:#888;}';
5000
5001 css += '#ponyhoof_donate {background:#EDEFF4;border:1px solid #D2DBEA;color:#9CADCF;font-family:Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;}';
5002 css += '#ponyhoof_donate .inner {background:#EDEFF4;display:block;font-size:16px;font-weight:bold;height:75px;line-height:75px;text-align:center;float:left;width:50%;}';
5003 css += '#ponyhoof_donate a {display:block;width:100%;color:#9CADCF;text-decoration:none;}';
5004 css += '#ponyhoof_options_donatepaypal {border-right:1px solid #D2DBEA;}';
5005 //css += '#ponyhoof_donate_flattr {background-image:url("//api.flattr.com/button/flattr-badge-large.png");background-position:center center;background-repeat:no-repeat;text-indent:-99999px;}';
5006 css += '#ponyhoof_donate_flattr_iframe {width:55px;height:62px;margin-top:6px;}';
5007 css += '#ponyhoof_donate a:hover {background-color:#DEDFE7;color:#3B5998;}';
5008
5009 injectManualStyle(css, 'options');
5010 };
5011
5012 k.show = function() {
5013 if (!k.created) {
5014 k.create();
5015 }
5016 k.dialog.show();
5017 };
5018
5019 k.kr = false;
5020 k.ks = [];
5021 k.kc = '\x33\x38\x2C\x33\x38\x2C\x34\x30\x2C\x34\x30\x2C\x33\x37\x2C\x33\x39\x2C\x33\x37\x2C\x33\x39\x2C\x36\x36\x2C\x36\x35';
5022 k.kf = function(e) {
5023 if (k.kr) {
5024 return;
5025 }
5026
5027 k.ks.push(e.which);
5028 if (k.ks.join(',').indexOf(k.kc) > -1) {
5029 k.kr = true;
5030 k.dialog.close();
5031
5032 var width = 720;
5033 var height = 405;
5034
5035 injectManualStyle('#ponyhoof_dialog_ky .generic_dialog_popup,#ponyhoof_dialog_ky .popup{width:740px;}#ponyhoof_dialog_ky .generic_dialog{z-index:250 !important;}#ponyhoof_kc_align{margin:8px auto 0;text-align:center;}', 'kx');
5036 var di = new Dialog('ky');
5037 di.alwaysModal = true;
5038 di.create();
5039 di.changeTitle("\x54\x48\x45\x20\x55\x4C\x54\x49\x4D\x41\x54\x45\x20\x42\x52\x4F\x4E\x59\x20\x43\x48\x41\x4C\x4C\x45\x4E\x47\x45");
5040 di.changeContent('<iframe src="//hoof.little.my/files/zR7V_bCyZe0.htm" width="100%" height="405" scrolling="auto" frameborder="0" allowTransparency="true"></iframe><div id="ponyhoof_kc_align"><a href="#" class="uiButton uiButtonSpecial ponyhoof_noShareIsCare" id="ponyhoof_kc_share" role="button" data-hover="tooltip" aria-label="\x53\x4F\x20\x4D\x55\x43\x48\x20\x50\x4F\x4E\x59" data-tooltip-alignh="center"><span class="uiButtonText">\x53\x48\x41\x52\x45\x20\x57\x49\x54\x48\x20\x59\x4F\x55\x52\x20\x50\x41\x4C\x53\x21</span></a></div>');
5041 di.addCloseButton();
5042 di.onclosefinish = function() {
5043 di.changeContent('');
5044 };
5045
5046 $('ponyhoof_kc_share').addEventListener('click', function() {
5047 var width = 657;
5048 var height = 412;
5049 w.open('//'+getFbDomain()+'/sharer/sharer.php?u=http://www.youtube.com/watch?v=zR7V_bCyZe0', 'ponyhoof_kc_sharer', 'left='+((screen.width-width)/2)+',top='+(((screen.height-height)/2)-50)+',width='+width+',height='+height);
5050 return false;
5051 }, false);
5052 }
5053 };
5054
5055 k.ki = function() {
5056 d.addEventListener('keydown', k.kf, true);
5057 };
5058 };
5059
5060 var optionsGlobal = null;
5061 function optionsOpen() {
5062 log("Opening options...");
5063
5064 if (!optionsGlobal) {
5065 optionsGlobal = new Options();
5066 }
5067 optionsGlobal.create();
5068 optionsGlobal.show();
5069
5070 $$($('ponyhoof_dialog_options'), '#ponyhoof_options_pony .ponyhoof_button_menu', function(button) {
5071 try {
5072 button.focus();
5073 } catch (e) {}
5074 });
5075 }
5076
5077 // Welcome
5078 var WelcomeUI = function(param) {
5079 var k = this;
5080
5081 if (param) {
5082 k.param = param;
5083 } else {
5084 k.param = {};
5085 }
5086 k.dialogFirst = null;
5087 k.dialogPinkie = null;
5088 k.dialogFinish = null;
5089
5090 k._stack = '';
5091
5092 k.start = function() {
5093 k.injectStyle();
5094 k.createScenery();
5095 addClass(d.documentElement, 'ponyhoof_welcome_html');
5096 statTrack('welcomeUI');
5097
5098 k.showWelcome();
5099 };
5100
5101 k.showWelcome = function() {
5102 if ($('ponyhoof_dialog_welcome')) {
5103 return;
5104 }
5105
5106 addClass(d.documentElement, 'ponyhoof_welcome_html_scenery_loaded');
5107
5108 var co = '';
5109 co += '<div class="ponyhoof_message uiBoxYellow ponyhoof_updater_newVersion">';
5110 co += '<a href="#" class="uiButton uiButtonSpecial rfloat ponyhoof_updater_updateNow" role="button"><span class="uiButtonText">Update now</span></a>';
5111 co += '<span class="wrap">An update (v<span class="ponyhoof_updater_versionNum"></span>) for Ponyhoof is available.</span>';
5112 co += '</div>';
5113
5114 co += renderBrowserConfigWarning();
5115
5116 if (STORAGEMETHOD == 'chrome' && chrome.extension.inIncognitoContext) {
5117 co += '<div class="ponyhoof_message uiBoxYellow">Please note that your Ponyhoof settings are saved and not cleared, even if you are using Chrome incognito mode. Please disable Ponyhoof from running in incognito mode if you do not want others to know that you logged on to this browser.</div><br>';
5118 }
5119
5120 co += '<strong>Select your favorite character to get started:</strong>';
5121 co += '<div id="ponyhoof_welcome_pony"></div>';
5122 co += '<div id="ponyhoof_welcome_afterClose">You can re-select your character in Ponyhoof Options at the Account menu.</div>';
5123
5124 var bottom = '';
5125 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm uiButtonDisabled" role="button" id="ponyhoof_welcome_next"><span class="uiButtonText">Next</span></a>';
5126
5127 DIALOGCOUNT += 5;
5128
5129 k.dialogFirst = new Dialog('welcome');
5130 k.dialogFirst.canCardspace = false;
5131 k.dialogFirst.canCloseByEscapeKey = false;
5132 k.dialogFirst.create();
5133 k.dialogFirst.generic_dialogDiv.className += ' generic_dialog_fixed_overflow';
5134 if (BRONYNAME) {
5135 k.dialogFirst.changeTitle("Welcome to Ponyhoof, "+BRONYNAME+"!");
5136 } else {
5137 k.dialogFirst.changeTitle("Welcome to Ponyhoof!");
5138 }
5139 k.dialogFirst.changeContent(co);
5140 k.dialogFirst.changeBottom(bottom);
5141
5142 k.dialogFirst.dialog.className += ' ponyhoof_dialog_localstorageWarningEmbedded';
5143
5144 DIALOGCOUNT += 4;
5145
5146 var menuClosed = false;
5147 var ponySelector = new PonySelector($('ponyhoof_welcome_pony'), k.param);
5148 ponySelector.saveTheme = false;
5149 ponySelector.createSelector();
5150 w.setTimeout(function() {
5151 ponySelector.menu.open();
5152 }, 1);
5153 ponySelector.menu.afterClose = function() {
5154 if (!menuClosed) {
5155 menuClosed = true;
5156 addClass($('ponyhoof_welcome_afterClose'), 'show');
5157
5158 addClass(d.documentElement, 'ponyhoof_welcome_showmedemo');
5159 if ($('navAccount')) {
5160 addClass($('navAccount'), 'openToggler');
5161 }
5162 //addClass($('ponyhoof_account_options'), 'active');
5163
5164 w.setTimeout(function() {
5165 removeClass($('ponyhoof_welcome_next'), 'uiButtonDisabled');
5166 }, 200);
5167 }
5168 };
5169
5170 w.setTimeout(function() {
5171 changeThemeSmart(CURRENTPONY);
5172 }, 10);
5173 k._stack = CURRENTSTACK;
5174
5175 w.setTimeout(function() {
5176 var update = new Updater();
5177 update.checkForUpdates();
5178 }, 500);
5179
5180 // Detect if the Facebook's chat sound setting is turned off
5181 // We need to do this here as it is async
5182 try {
5183 if (typeof USW.requireLazy == 'function') {
5184 USW.requireLazy(['ChatOptions'], function(ChatOptions) {
5185 if (!ChatOptions.getSetting('sound')) {
5186 userSettings.chatSound = false;
5187 }
5188 });
5189 }
5190 } catch (e) {
5191 error("Unable to hook to ChatOptions");
5192 dir(e);
5193 }
5194
5195 $('ponyhoof_welcome_next').addEventListener('click', function(e) {
5196 e.preventDefault();
5197 if (hasClass(this, 'uiButtonDisabled')) {
5198 return false;
5199 }
5200
5201 k.dialogFirst.close();
5202 fadeOut($('ponyhoof_welcome_scenery'));
5203
5204 w.setTimeout(function() {
5205 removeClass(d.documentElement, 'ponyhoof_welcome_showmedemo');
5206 removeClass($('navAccount'), 'openToggler');
5207 removeClass($('ponyhoof_account_options'), 'active');
5208 }, 100);
5209
5210 userSettings.theme = CURRENTPONY;
5211 userSettings.chatSound1401 = true;
5212 // Detect Social Fixer
5213 if ($('bfb_options_button')) {
5214 userSettings.show_messages_other = false;
5215 }
5216 saveSettings();
5217
5218 globalSettings.lastVersion = VERSION;
5219 if (globalSettings.allowLoginScreen) {
5220 globalSettings.lastUserId = USERID;
5221 }
5222 saveGlobalSettings();
5223
5224 if (CURRENTPONY == 'pinkie') {
5225 k.pinkieWelcome();
5226 } else {
5227 k.createFinalDialog();
5228 }
5229 }, false);
5230 };
5231
5232 k.pinkieWelcome = function() {
5233 removeClass(d.documentElement, 'ponyhoof_welcome_html_scenery_loaded');
5234
5235 var width = 720;
5236 var height = 405;
5237
5238 var bottom = '';
5239 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm" role="button" id="ponyhoof_welcome_pinkie_next"><span class="uiButtonText">Stop being silly, Pinkie</span></a>';
5240
5241 k.dialogPinkie = new Dialog('welcome_pinkie');
5242 k.dialogPinkie.alwaysModal = true;
5243 k.dialogPinkie.create();
5244 k.dialogPinkie.changeTitle("\x59\x4F\x55\x20\x43\x48\x4F\x4F\x53\x45\x20\x50\x49\x4E\x4B\x49\x45\x21\x3F\x21");
5245 k.dialogPinkie.changeContent('<iframe src="//hoof.little.my/files/aEPDsG6R4dY.htm" width="100%" height="405" scrolling="auto" frameborder="0" allowTransparency="true"></iframe>');
5246 k.dialogPinkie.changeBottom(bottom);
5247 k.dialogPinkie.onclose = function() {
5248 fadeOut($('ponyhoof_welcome_scenery'));
5249 k.createFinalDialog();
5250 };
5251 k.dialogPinkie.onclosefinish = function() {
5252 k.dialogPinkie.changeContent('');
5253 };
5254
5255 $('ponyhoof_welcome_pinkie_next').addEventListener('click', function(e) {
5256 k.dialogPinkie.close();
5257 e.preventDefault();
5258 }, false);
5259 };
5260
5261 k.createFinalDialog = function() {
5262 removeClass(d.documentElement, 'ponyhoof_welcome_html');
5263 removeClass(d.documentElement, 'ponyhoof_welcome_html_scenery_loaded');
5264
5265 var c = '';
5266
5267 var lang = getDefaultUiLang();
5268 if (lang != 'en_US' && lang != 'en_GB') {
5269 c += '<div class="ponyhoof_message uiBoxYellow"><'+'a href="//'+getFbDomain()+'/ajax/intl/language_dialog.php" rel="dialog" id="ponyhoof_welcome_final_changelanguage">For the best Ponyhoof experience, we recommend switching your Facebook language to English (US). Why? Because ponies!</a></div><br>';
5270 }
5271
5272 if (!ISUSINGBUSINESS) {
5273 c += '<span class="ponyhoof_brohoof_button">'+capitaliseFirstLetter(CURRENTSTACK['like'])+'</span> us to receive news and help for Ponyhoof!';
5274 c += '<iframe src="about:blank" id="ponyhoof_welcome_like" scrolling="no" frameborder="0" allowTransparency="true"></iframe>';
5275 c += 'Got somepony else that you want to suggest? Want to leave some feedback? <a href="'+w.location.protocol+PONYHOOF_URL+'" target="_top" id="ponyhoof_welcome_posttowall">Let us know at our page!</a>';
5276 } else {
5277 c += '<a href="'+w.location.protocol+PONYHOOF_URL+'" target="_top" id="ponyhoof_welcome_posttowall">Visit our Ponyhoof page for the latest news!</a>';
5278 }
5279
5280 var successText = '';
5281 var ponyData = convertCodeToData(REALPONY);
5282 if (ponyData.successText) {
5283 successText = ponyData.successText;
5284 } else {
5285 successText = "Yay!";
5286 }
5287
5288 k.dialogFinish = new Dialog('welcome_final');
5289 if (k._stack != CURRENTSTACK) {
5290 k.dialogFinish.alwaysModal = true;
5291 }
5292 k.dialogFinish.create();
5293 k.dialogFinish.changeTitle(successText);
5294 k.dialogFinish.changeContent(c);
5295 var buttonText = CURRENTLANG.done;
5296 if (k._stack != CURRENTSTACK) {
5297 buttonText = CURRENTLANG.finish;
5298 }
5299 k.dialogFinish.changeBottom('<a href="#" class="uiButton uiButtonLarge uiButtonConfirm" role="button" id="ponyhoof_welcomefinal_ok"><span class="uiButtonText">'+buttonText+'</span></a>');
5300 k.dialogFinish.onclose = function() {
5301 if (k._stack != CURRENTSTACK) {
5302 w.location.reload();
5303 }
5304 };
5305
5306 $('ponyhoof_welcomefinal_ok').addEventListener('click', k.dialogFinishOk, false);
5307 $('ponyhoof_welcomefinal_ok').focus();
5308
5309 if (!ISUSINGBUSINESS) {
5310 w.setTimeout(function() {
5311 $('ponyhoof_welcome_like').src = '//'+getFbDomain()+'/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fprofile.php%3Fid%3D'+PONYHOOF_PAGE+'&width=292&height=62&colorscheme=light&show_faces=false&stream=false&header=false&ponyhoof_runme';
5312 }, 1);
5313 }
5314
5315 $('ponyhoof_welcome_posttowall').addEventListener('click', function(e) {
5316 k.dialogFinish.onclose = function() {};
5317 k.dialogFinish.close();
5318 }, false);
5319 };
5320
5321 k.dialogFinishOk = function(e) {
5322 if (k._stack != CURRENTSTACK) {
5323 if (hasClass(this, 'uiButtonDisabled')) {
5324 return false;
5325 }
5326
5327 this.className += ' uiButtonDisabled';
5328 w.location.reload();
5329 } else {
5330 k.dialogFinish.close();
5331 }
5332 e.preventDefault();
5333 };
5334
5335 k.createScenery = function() {
5336 if ($('ponyhoof_welcome_scenery')) {
5337 $('ponyhoof_welcome_scenery').style.display = 'block';
5338 return;
5339 }
5340
5341 var n = d.createElement('div');
5342 n.id = 'ponyhoof_welcome_scenery';
5343 d.body.appendChild(n);
5344
5345 return n;
5346 };
5347
5348 k.injectStyle = function() {
5349 var css = '';
5350 css += 'html.ponyhoof_welcome_html {overflow:hidden;}';
5351 css += 'html.ponyhoof_welcome_html .fbPageBanner, html.ponyhoof_welcome_html .uiLayer[data-ownerid="userNavigationLabel"], html.ponyhoof_welcome_html ._50d1, html.ponyhoof_welcome_html .-cx-PUBLIC-notificationBeeper__list {display:none !important;}';
5352 css += 'html #ponyhoof_dialog_welcome .generic_dialog_fixed_overflow {background:transparent !important;}';
5353 css += '#ponyhoof_welcome_scenery {width:100%;height:100%;position:fixed;top:0;left:0;background-color:#fff;background-color:rgba(252,252,252,.9);background-repeat:no-repeat;background-position:center center;z-index:'+(DIALOGCOUNT-6)+';}';
5354
5355 //css += '#ponyhoof_dialog_welcome .generic_dialog {z-index:401 !important;}';
5356 css += '#ponyhoof_dialog_welcome .generic_dialog_popup, #ponyhoof_dialog_welcome .popup {width:475px !important;}';
5357 //css += '#ponyhoof_dialog_welcome .content {-webkit-transition:.3s linear;-webkit-transition-property:min-height, padding-top;-moz-transition:.3s linear;-moz-transition-property:min-height, padding-top;-o-transition:.3s linear;-o-transition-property:min-height, padding-top;transition:.3s linear;transition-property:min-height, padding-top;}';
5358 css += '#ponyhoof_dialog_welcome .ponyhoof_updater_newVersion {margin-bottom:10px;}';
5359
5360 css += '#ponyhoof_welcome_newVersion {display:none;margin:0 0 10px;}';
5361 css += '#ponyhoof_welcome_pony {margin:8px 0;}';
5362 css += '#ponyhoof_welcome_afterClose {visibility:hidden;opacity:0;}';
5363 css += '#ponyhoof_welcome_afterClose.show {visibility:visible;opacity:1;-webkit-transition:opacity .3s linear;-moz-transition:opacity .3s linear;-o-transition:opacity .3s linear;transition:opacity .3s linear;}';
5364
5365 css += 'html.ponyhoof_welcome_html_scenery_loaded #blueBar, html.ponyhoof_welcome_html_scenery_loaded #blueBar.fixed_elem {opacity:0;-webkit-transition:opacity .3s linear;-moz-transition:opacity .3s linear;-o-transition:opacity .3s linear;transition:opacity .3s linear;}';
5366 css += 'html.ponyhoof_welcome_showmedemo {cursor:not-allowed;}';
5367 css += 'html.ponyhoof_welcome_showmedemo .popup {cursor:default;}';
5368 css += 'html.ponyhoof_welcome_showmedemo #blueBar #pageHead {width:981px !important;padding-right:0 !important;}';
5369 css += 'html.sidebarMode.ponyhoof_welcome_showmedemo #pageHead, html.sidebarMode.ponyhoof_welcome_showmedemo .sidebarMode #globalContainer {left:0 !important;}';
5370 css += 'html.ponyhoof_welcome_showmedemo #blueBar, html.ponyhoof_welcome_showmedemo.tinyViewport #blueBar, html.ponyhoof_welcome_showmedemo #blueBar.fixed_elem, html.ponyhoof_welcome_showmedemo.tinyViewport #blueBar.fixed_elem {position:fixed !important;z-index:'+(DIALOGCOUNT-4)+';opacity:1;margin-left:0 !important;left:0 !important;right:0 !important;top:0 !important;}';
5371
5372 css += '#ponyhoof_dialog_welcome_pinkie .generic_dialog_popup, #ponyhoof_dialog_welcome_pinkie .popup {width:720px;}';
5373 css += '#ponyhoof_dialog_welcome_pinkie .content {line-height:0;padding:0;}';
5374
5375 css += '#ponyhoof_welcome_like {border:none;overflow:hidden;width:292px;height:62px;margin:8px 0;display:block;}';
5376
5377 injectManualStyle(css, 'welcome');
5378 };
5379 };
5380
5381 var renderBrowserConfigWarning = function() {
5382 var c = '';
5383 if (STORAGEMETHOD == 'localstorage') {
5384 c += '<div class="ponyhoof_message uiBoxRed">Ponyhoof is not supported on this browser configuration. Your settings will get cleared out from time to time, and some features such as update-checking and Browser Ponies will not work.</div><br>';
5385 } else if (ISMOBILE) {
5386 c += '<div class="ponyhoof_message uiBoxYellow">Mobile support for Ponyhoof is provided as a courtesy and is not officially supported.</div><br>';
5387 }
5388 return c;
5389 };
5390
5391 // Theme
5392 function getFaviconTag() {
5393 var l = d.getElementsByTagName('link');
5394 for (var i = 0, len = l.length; i < len; i += 1) {
5395 if (l[i].getAttribute('rel') == 'shortcut icon') {
5396 return l[i];
5397 }
5398 }
5399
5400 return false;
5401 }
5402
5403 function changeFavicon(character) {
5404 if (userSettings.noFavicon) {
5405 return;
5406 }
5407
5408 var favicon = getFaviconTag();
5409
5410 if (favicon) {
5411 var newIcon = favicon.cloneNode(true);
5412 } else {
5413 var newIcon = d.createElement('link');
5414 newIcon.rel = 'shortcut icon';
5415 }
5416
5417 if (character != 'NONE') {
5418 newIcon.type = 'image/png';
5419
5420 var data = convertCodeToData(character);
5421 if (data.icon16) {
5422 newIcon.href = THEMEURL+data.icon16;
5423 } else {
5424 newIcon.href = THEMEURL+character+'/icon16.png';
5425 }
5426 } else {
5427 newIcon.type = 'image/x-icon';
5428 newIcon.href = '//fbstatic-a.akamaihd.net/rsrc.php/y9/r/FXHC9IQ-JIj.ico';
5429 }
5430
5431 if (favicon) {
5432 favicon.parentNode.replaceChild(newIcon, favicon);
5433 } else {
5434 d.head.appendChild(newIcon);
5435 }
5436 }
5437
5438 function changeStack(character) {
5439 var pony = convertCodeToData(character);
5440 CURRENTSTACK = STACKS_LANG[0];
5441 if (pony.stack) {
5442 for (var i = 0, len = STACKS_LANG.length; i < len; i += 1) {
5443 if (STACKS_LANG[i].stack == pony.stack) {
5444 CURRENTSTACK = STACKS_LANG[i];
5445 break;
5446 }
5447 }
5448 }
5449
5450 if (UILANG == 'fb_LT') {
5451 if (CURRENTSTACK['people'] == 'ponies') {
5452 CURRENTSTACK['people'] = 'pwnies';
5453 }
5454 if (CURRENTSTACK['person'] == 'pony') {
5455 CURRENTSTACK['person'] = 'pwnie';
5456 }
5457 if (CURRENTSTACK['like'] == 'brohoof') {
5458 CURRENTSTACK['like'] = '/)';
5459 }
5460 if (CURRENTSTACK['likes'] == 'brohoofs') {
5461 CURRENTSTACK['likes'] = '/)';
5462 }
5463 //if (CURRENTSTACK['unlike'] == 'unbrohoof') {
5464 // CURRENTSTACK['unlike'] = '/)(\\';
5465 //}
5466 if (CURRENTSTACK['like_past'] == 'brohoof') {
5467 CURRENTSTACK['like_past'] = '/)';
5468 }
5469 if (CURRENTSTACK['likes_past'] == 'brohoofs') {
5470 CURRENTSTACK['likes_past'] = '/)';
5471 }
5472 if (CURRENTSTACK['liked'] == 'brohoof\'d') {
5473 CURRENTSTACK['liked'] = '/)';
5474 }
5475 if (CURRENTSTACK['liked_button'] == 'brohoof\'d') {
5476 CURRENTSTACK['liked_button'] = '/)';
5477 }
5478 if (CURRENTSTACK['liking'] == 'brohoofing') {
5479 CURRENTSTACK['liking'] = '/)';
5480 }
5481 }
5482 }
5483
5484 var changeThemeFuncQueue = [];
5485 function changeTheme(character) {
5486 addClass(d.documentElement, 'ponyhoof_injected');
5487
5488 REALPONY = character;
5489 d.documentElement.setAttribute('data-ponyhoof-character', character);
5490
5491 changeFavicon(character);
5492 changeStack(character);
5493 buildStackLang();
5494
5495 if (changeThemeFuncQueue) {
5496 for (var x in changeThemeFuncQueue) {
5497 if (changeThemeFuncQueue.hasOwnProperty(x) && changeThemeFuncQueue[x]) {
5498 changeThemeFuncQueue[x]();
5499 }
5500 }
5501 }
5502
5503 // Did we injected our theme already?
5504 if ($('ponyhoof_userscript_style')) {
5505 changeCostume(userSettings.costume);
5506 $('ponyhoof_userscript_style').href = THEMECSS+character+THEMECSS_EXT;
5507 return;
5508 }
5509
5510 addClass(d.documentElement, 'ponyhoof_initial');
5511 w.setTimeout(function() {
5512 removeClass(d.documentElement, 'ponyhoof_initial');
5513 }, 1000);
5514
5515 var n = d.createElement('link');
5516 n.href = THEMECSS+character+THEMECSS_EXT;
5517 n.type = 'text/css';
5518 n.rel = 'stylesheet';
5519 n.id = 'ponyhoof_userscript_style';
5520 d.head.appendChild(n);
5521
5522 changeCostume(userSettings.costume);
5523 }
5524
5525 function getRandomPony() {
5526 while (1) {
5527 var r = randNum(0, PONIES.length-1);
5528 if (!PONIES[r].hidden) {
5529 return PONIES[r].code;
5530 }
5531 }
5532 }
5533
5534 function getRandomMane6() {
5535 while (1) {
5536 var r = randNum(0, PONIES.length-1);
5537 if (PONIES[r].mane6) {
5538 return PONIES[r].code;
5539 }
5540 }
5541 }
5542
5543 function convertCodeToData(code) {
5544 for (var i = 0, len = PONIES.length; i < len; i += 1) {
5545 if (PONIES[i].code == code) {
5546 return PONIES[i];
5547 }
5548 }
5549
5550 return false;
5551 }
5552
5553 function changeThemeSmart(theme) {
5554 switch (theme) {
5555 case 'NONE':
5556 removeClass(d.documentElement, 'ponyhoof_injected');
5557 changeFavicon('NONE');
5558 changeCostume(null);
5559
5560 var style = $('ponyhoof_userscript_style');
5561 if (style) {
5562 style.parentNode.removeChild(style);
5563 }
5564 break;
5565
5566 case 'RANDOM':
5567 var current = [];
5568 if (userSettings.randomPonies) {
5569 current = userSettings.randomPonies.split('|');
5570 changeTheme(current[Math.floor(Math.random() * current.length)]);
5571 } else {
5572 changeTheme(getRandomPony());
5573 }
5574
5575 break;
5576
5577 default:
5578 if (theme == 'login' || convertCodeToData(theme)) {
5579 changeTheme(theme);
5580 } else {
5581 error("changeThemeSmart: "+theme+" is not a valid theme");
5582 userSettings.theme = null;
5583 CURRENTPONY = REALPONY = 'NONE';
5584 }
5585 break;
5586 }
5587 }
5588
5589 function changeCustomBg(base64) {
5590 if (!base64) {
5591 removeClass(d.documentElement, 'ponyhoof_settings_login_bg');
5592 removeClass(d.documentElement, 'ponyhoof_settings_customBg');
5593
5594 var style = $('ponyhoof_style_custombg');
5595 if (style) {
5596 style.parentNode.removeChild(style);
5597 }
5598 return;
5599 }
5600
5601 addClass(d.documentElement, 'ponyhoof_settings_login_bg');
5602 addClass(d.documentElement, 'ponyhoof_settings_customBg');
5603
5604 if (!$('ponyhoof_style_custombg')) {
5605 injectManualStyle('', 'custombg');
5606 }
5607 $('ponyhoof_style_custombg').textContent = '/* '+SIG+' */html,.fbIndex{background-position:center center !important;background-image:url("'+base64+'") !important;}';
5608 }
5609
5610 var changeCostume = function(costume) {
5611 // Make sure the costume exists
5612 if (!COSTUMESX[costume]) {
5613 removeCostume();
5614 return false;
5615 }
5616
5617 // Make sure the character has the costume
5618 if (!doesCharacterHaveCostume(REALPONY, costume)) {
5619 //removeCostume(); // leaving the costume alone wouldn't hurt...
5620 return false;
5621 }
5622
5623 d.documentElement.setAttribute('data-ponyhoof-costume', costume);
5624 };
5625
5626 var removeCostume = function() {
5627 d.documentElement.removeAttribute('data-ponyhoof-costume');
5628 };
5629
5630 var doesCharacterHaveCostume = function(character, costume) {
5631 return (COSTUMESX[costume] && COSTUMESX[costume].characters && COSTUMESX[costume].characters.indexOf(character) != -1);
5632 }
5633
5634 function getBronyName() {
5635 var name = d.querySelector('.headerTinymanName, #navTimeline > .navLink, .fbxWelcomeBoxName, ._521h ._4g5y, .-cx-PRIVATE-litestandSidebarBookmarks__profilewrapper .-cx-PRIVATE-litestandSidebarBookmarks__name');
5636 if (name) {
5637 BRONYNAME = name.textContent;
5638 }
5639
5640 return BRONYNAME;
5641 }
5642
5643 function getDefaultUiLang() {
5644 if (!d.body) {
5645 return false;
5646 }
5647 var classes = d.body.className.split(' ');
5648 for (var i = 0, len = classes.length; i < len; i += 1) {
5649 if (classes[i].indexOf('Locale_') == 0) {
5650 return classes[i].substring('Locale_'.length);
5651 }
5652 }
5653
5654 return false;
5655 }
5656
5657 // Screen saver
5658 var screenSaverTimer = null;
5659 var screenSaverActive = false;
5660 var screenSaverInactivity = function() {
5661 if (!screenSaverActive) {
5662 addClass(d.body, 'ponyhoof_screensaver');
5663 }
5664 screenSaverActive = true;
5665 };
5666 var screenSaverActivity = function() {
5667 if (screenSaverActive) {
5668 removeClass(d.body, 'ponyhoof_screensaver');
5669 }
5670 screenSaverActive = false;
5671
5672 w.clearTimeout(screenSaverTimer);
5673 screenSaverTimer = w.setTimeout(screenSaverInactivity, 30000);
5674 };
5675 var screenSaverActivate = function() {
5676 var mousemoveX = 0;
5677 var mousemoveY = 0;
5678
5679 d.addEventListener('click', screenSaverActivity, true);
5680 d.addEventListener('mousemove', function(e) {
5681 if (mousemoveX == e.clientX && mousemoveY == e.clientY) {
5682 return;
5683 }
5684 mousemoveX = e.clientX;
5685 mousemoveY = e.clientY;
5686
5687 screenSaverActivity();
5688 }, true);
5689 d.addEventListener('keydown', screenSaverActivity, true);
5690 d.addEventListener('contextmenu', screenSaverActivity, true);
5691 d.addEventListener('mousewheel', screenSaverActivity, true);
5692 d.addEventListener('touchstart', screenSaverActivity, true);
5693
5694 screenSaverActivity();
5695 };
5696
5697 // DOMNodeInserted
5698 var domReplaceText = function(ele, cn, deeper, regex, text) {
5699 var t = '';
5700 var id = ele.getAttribute('id');
5701 if ((cn == '' && deeper == '') || (cn && hasClass(ele, cn)) || (cn && id && id == nc)) {
5702 t = ele.innerHTML;
5703 t = t.replace(regex, text);
5704 if (ele.innerHTML != t) {
5705 ele.innerHTML = t;
5706 }
5707
5708 return;
5709 }
5710
5711 if (deeper) {
5712 var query = ele.querySelectorAll(deeper);
5713 if (query.length) {
5714 for (var i = 0, len = query.length; i < len; i += 1) {
5715 t = query[i].innerHTML;
5716 t = t.replace(regex, text);
5717 if (query[i].innerHTML != t) {
5718 query[i].innerHTML = t;
5719 }
5720 }
5721 }
5722 }
5723 };
5724
5725 var _fb_input_placeholderChanged = false;
5726 var domChangeTextbox = function(ele, cn, text) {
5727 var query = ele.querySelectorAll(cn);
5728 if (!query.length) {
5729 return;
5730 }
5731 if (!_fb_input_placeholderChanged) {
5732 contentEval(function(arg) {
5733 try {
5734 if (typeof window.requireLazy == 'function') {
5735 window.requireLazy(['Input'], function(Input) {
5736 var _setPlaceholder = Input.setPlaceholder;
5737 Input.setPlaceholder = function(textbox, t) {
5738 if (!textbox.getAttribute('data-ponyhoof-ponified-overridefb')) {
5739 if (textbox != document.activeElement) {
5740 _setPlaceholder(textbox, t);
5741 }
5742 textbox.setAttribute('data-ponyhoof-ponified-overridefb', 1);
5743 } else {
5744 // we already overridden, now FB wants to change the placeholder
5745 if (textbox.getAttribute('placeholder') == '' && t) {
5746 if (textbox.title) {
5747 // for composer
5748 _setPlaceholder(textbox, textbox.title);
5749 } else {
5750 // for typeahead (share dialog > private message)
5751 _setPlaceholder(textbox, t);
5752 }
5753 } else if (t == '') {
5754 // allow blanking placeholder (for typeahead)
5755 _setPlaceholder(textbox, t);
5756 }
5757 }
5758 };
5759 });
5760 }
5761 } catch (e) {
5762 if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
5763 console.log("Unable to override Input.setPlaceholder()");
5764 console.dir(e);
5765 }
5766 }
5767 }, {"CANLOG":CANLOG});
5768 _fb_input_placeholderChanged = true;
5769 }
5770
5771 var placeholders = [];
5772 for (var i = 0, len = query.length; i < len; i += 1) {
5773 var textbox = query[i];
5774 if (textbox.getAttribute('data-ponyhoof-ponified')) {
5775 continue;
5776 }
5777 textbox.setAttribute('data-ponyhoof-ponified', 1);
5778
5779 if (typeof text == 'function') {
5780 placeholders[i] = text(textbox);
5781 } else {
5782 placeholders[i] = text;
5783 }
5784
5785 textbox.title = placeholders[i];
5786 textbox.setAttribute('aria-label', placeholders[i]);
5787 textbox.setAttribute('placeholder', placeholders[i]);
5788
5789 if (hasClass(textbox, 'DOMControl_placeholder')) {
5790 textbox.value = placeholders[i];
5791 }
5792 }
5793
5794 /*try {
5795 if (typeof USW.requireLazy == 'function') {
5796 USW.requireLazy(['TextAreaControl'], function(TextAreaControl) {
5797 for (var i = 0; i < query.length; i++) {
5798 if (placeholders[i]) {
5799 //if (query[i] != d.activeElement) {
5800 TextAreaControl.getInstance(query[i]).setPlaceholderText(placeholders[i]);
5801 //}
5802 }
5803 }
5804 });
5805 } else {*/
5806 for (var i = 0, len = query.length; i < len; i += 1) {
5807 if (placeholders[i]) {
5808 var textbox = query[i];
5809 if (!textbox.getAttribute('data-ponyhoof-ponified-overridefb')) {
5810 textbox.setAttribute('aria-label', placeholders[i]);
5811 textbox.setAttribute('placeholder', placeholders[i]);
5812 textbox.setAttribute('data-ponyhoof-ponified-overridefb', 1);
5813 if (textbox == d.activeElement) {
5814 continue;
5815 }
5816 if (textbox.value == '' || hasClass(textbox, 'DOMControl_placeholder')) {
5817 if (placeholders[i]) {
5818 addClass(textbox, 'DOMControl_placeholder');
5819 } else {
5820 removeClass(textbox, 'DOMControl_placeholder');
5821 }
5822 textbox.value = placeholders[i] || '';
5823 }
5824 }
5825 }
5826 }
5827 /*}
5828 } catch (e) {
5829 error("Unable to hook to TextAreaControl");
5830 dir(e);
5831 }*/
5832 };
5833
5834 var domReplaceFunc = function(ele, cn, deeper, func) {
5835 if (!ele || (cn == '' && deeper == '')) {
5836 return;
5837 }
5838
5839 var id = ele.getAttribute('id');
5840 if ((cn && hasClass(ele, cn)) || (cn && id && id == cn)) {
5841 func(ele);
5842 return;
5843 }
5844
5845 if (deeper) {
5846 var query = ele.querySelectorAll(deeper);
5847 if (query.length) {
5848 for (var i = 0, len = query.length; i < len; i += 1) {
5849 func(query[i]);
5850 }
5851 }
5852 }
5853 };
5854
5855 var replaceText = function(arr, t) {
5856 var lowercase = t.toLowerCase();
5857 for (var i = 0, len = arr.length; i < len; i += 1) {
5858 if (arr[i][0] instanceof RegExp) {
5859 t = t.replace(arr[i][0], arr[i][1]);
5860 } else {
5861 if (arr[i][0].toLowerCase() == lowercase) {
5862 t = arr[i][1];
5863 }
5864 }
5865 }
5866
5867 return t;
5868 };
5869
5870 var loopChildText = function(ele, func) {
5871 if (!ele || !ele.childNodes) {
5872 return;
5873 }
5874 for (var i = 0, len = ele.childNodes.length; i < len; i += 1) {
5875 func(ele.childNodes[i]);
5876 }
5877 };
5878
5879 var buttonTitles = [];
5880 var dialogTitles = [];
5881 var tooltipTitles = [];
5882 var headerTitles = [];
5883 var menuTitles = [];
5884 var menuPrivacyOnlyTitles = [];
5885 var dialogDerpTitles = [];
5886 var headerInsightsTitles = [];
5887 var dialogDescriptionTitles = [];
5888 function buildStackLang() {
5889 var ponyData = convertCodeToData(REALPONY);
5890
5891 buttonTitles = [
5892 ["Done", "Eeyup"]
5893 ,["Okay", "Eeyup"]
5894 ,["Done Editing", "Eeyup"]
5895 ,["Save Changes", "Eeyup"]
5896 ,["OK", "Eeyup"]
5897
5898 ,[/everyone/i, "Everypony"] // for Everyone (Most Recent)
5899 ,["Everybody", "Everypony"]
5900 ,["Public", "Everypony"]
5901 ,["Anyone", "Anypony"]
5902 ,["Friends of Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
5903 ,["Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])]
5904 ,["Friends of Guests", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of Guests"]
5905 ,["Friends of Contributors", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of Contributors"]
5906 ,["Only Me", "Alone"]
5907 ,["Only me", "Alone"]
5908 ,["Only Me (+)", "Alone (+)"]
5909 ,["Only me (+)", "Alone (+)"]
5910 ,["No One", "Alone"]
5911 ,["Nobody", "Nopony"]
5912
5913 ,["Add Friend", "Add "+capitaliseFirstLetter(CURRENTSTACK['friend'])]
5914 ,["Friend Request Sent", "Friendship Request Sent"]
5915 ,["Respond to Friend Request", "Respond to Friendship Request"]
5916 ,["Like", capitaliseFirstLetter(CURRENTSTACK['like'])]
5917 ,["Liked", capitaliseFirstLetter(CURRENTSTACK['liked_button'])]
5918 ,["Unlike", capitaliseFirstLetter(CURRENTSTACK['unlike'])]
5919 ,["Like Page", capitaliseFirstLetter(CURRENTSTACK['like'])+" Page"]
5920 ,["Like This Page", capitaliseFirstLetter(CURRENTSTACK['like'])+" This Page"]
5921 ,["Suggest Friends", "Suggest "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
5922 ,["Suggest Friend", "Suggest "+capitaliseFirstLetter(CURRENTSTACK['friend'])]
5923 ,["All Friends", "All "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
5924 ,["All friends", "All "+CURRENTSTACK['friends']]
5925 ,["Poke", "Nuzzle"]
5926 ,["Request Deleted", "Request Nuked"]
5927
5928 ,["Likes", capitaliseFirstLetter(CURRENTSTACK['likes'])]
5929 ,["Friends' Posts", capitaliseFirstLetter(CURRENTSTACK['friends'])+"' Posts"]
5930
5931 ,["Photos", "Pony Pics"]
5932 ,["People", capitaliseFirstLetter(CURRENTSTACK['people'])]
5933 ,["Banned", "Banished to Moon"]
5934 ,["Blocked", "Banished to Moon"]
5935 ,["People who like this", capitaliseFirstLetter(CURRENTSTACK.people)+" that "+CURRENTSTACK.like_past+" this"]
5936 ,["Pages that like this", "Pages that "+CURRENTSTACK.like_past+" this"]
5937
5938 ,["Delete and Ban User", "Nuke and Banish to Moon"]
5939 ,["Remove from Friends", "Banish to Moon"]
5940 ,["Delete", "Nuke"]
5941 ,["Delete Photo", "Nuke Pony Pic"]
5942 ,["Delete Page", "Nuke Page"]
5943 ,["Delete All", "Nuke All"]
5944 ,["Delete Selected", "Nuke Selected"]
5945 ,["Delete Conversation", "Nuke Conversation"]
5946 ,["Delete Message", "Nuke Friendship Report"]
5947 ,["Delete Messages", "Nuke Friendship Reports"]
5948 ,["Delete Post", "Nuke Post"]
5949 ,["Remove", "Nuke"]
5950 ,["Delete Report", "Nuke This Whining"]
5951 ,["Report", "Whine"]
5952 ,["Report as Spam", "Whine as Spam"]
5953 ,["Clear Searches", "Nuke Searches"]
5954 ,["Report/Remove Tags", "Whine/Nuke Tags"]
5955 ,["Untag Photo", "Untag Pony Pic"]
5956 ,["Untag Photos", "Untag Pony Pics"]
5957 ,["Delete My Account", "Nuke My Account"]
5958 ,["Allowed on Timeline", "Allowed on Journal"]
5959 ,["Hidden from Timeline", "Hidden from Journal"]
5960 ,["Unban", "Unbanish"]
5961 ,["Delete Album", "Nuke Album"]
5962 ,["Cancel Report", "Cancel Whining"]
5963 ,["Unfriend", "Banish to Moon"]
5964 ,["Delete List", "Nuke List"]
5965
5966 ,["Messages", "Trough"]
5967 ,["New Message", "Write a Friendship Report"]
5968 ,["Other Messages", "Other Friendship Reports"]
5969
5970 ,["Share Photo", "Share Pony Pic"]
5971 ,["Share Application", "Share Magic"]
5972 ,["Share Note", "Share Scroll"]
5973 ,["Share Question", "Share Query"]
5974 ,["Share Event", "Share Adventure"]
5975 ,["Share Group", "Share Herd"]
5976 ,["Send Message", "Send Friendship Letter"]
5977 ,["Share Photos", "Share Pony Pics"]
5978 ,["Share This Note", "Share This Scroll"] // entstream
5979 ,["Share This Photo", "Share This Pony Pic"]
5980
5981 ,["Add Friends", "Add "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
5982 ,["Go to App", "Go to Magic"]
5983 ,["Back to Timeline", "Back to Journal"]
5984 ,["Add App", "Add Magic"]
5985 ,["Get More Likes", "Get More "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
5986 ,["Advertise Your App", "Advertise Your Magic"]
5987 ,["Leave App", "Leave Magic"]
5988 ,["Find another app", "Find another magic"]
5989 ,["Post on your timeline", "Post on your journal"]
5990 ,["App Center", "Magic Center"]
5991 ,["View App Center", "View Magic Center"]
5992
5993 ,["Events", "Adventures"]
5994 ,["Page Events", "Page Adventures"]
5995 ,["Suggested Events", "Suggested Adventures"]
5996 ,["Past Events", "Past Adventures"]
5997 ,["Declined Events", "Declined Adventures"]
5998 ,["Create Event", "Plan an Adventure"]
5999 ,["Save Event", "Save Adventure"]
6000 ,["Back to Event", "Back to Adventure"]
6001 ,["Invite Friends", "Invite "+capitaliseFirstLetter(CURRENTSTACK['friends_logic'])]
6002 ,["Page Event", "Page Adventures"]
6003 ,["Upcoming Events", "Upcoming Adventures"]
6004 ,["Group Events", "Herd Adventures"]
6005 ,["Change Event Photo", "Change Pony Pic for Adventure"]
6006 ,["Add Event Photo", "Add Pony Pic for Adventure"]
6007 ,["+ Create an Event", "+ Plan an Adventure"]
6008
6009 ,["Friend Activity", capitaliseFirstLetter(CURRENTSTACK['friend'])+" Activity"]
6010 ,["Activity Log", "Adventure Log"]
6011
6012 ,["Invite More Friends", "Invite More Pals"]
6013 ,["Find Friends", "Find Friendship"]
6014 ,["Pages I Like", "Pages I "+capitaliseFirstLetter(CURRENTSTACK['like_past'])]
6015 ,["Find My Friends", "Find Friendship"]
6016
6017 ,["Leave Group", "Leave Herd"]
6018 ,["Set Up Group Address", "Set Up Herd Address"]
6019 ,["Change Group Photo", "Change Herd Pony Pic"]
6020 ,["Notifications", "Sparks"]
6021 ,["Start Chat", "Start Whinny Chat"]
6022 ,["Create Group", "Create Herd"]
6023 ,["Add People", "Add "+capitaliseFirstLetter(CURRENTSTACK['people'])]
6024 ,["Groups", "Herds"]
6025 ,["Join Group", "Join the Herd"]
6026 ,["View group", "View herd"]
6027 ,["Create New Group", "Create New Herd"]
6028 ,["Set Up Group", "Set Up Herd"] // tour
6029
6030 ,["Move photo", "Move pony pic"]
6031 ,["Delete Photos", "Nuke Pony Pics"]
6032 ,["Keep Photos", "Keep Pony Pics"]
6033 ,["Save Photo", "Save Pony Pic"]
6034 ,["Tag Photos", "Tag Pony Pics"]
6035 ,["Add Photos", "Add Pony Pics"]
6036 ,["Upload Photos", "Upload Pony Pics"]
6037 ,["Tag Photo", "Tag Pony Pic"]
6038 ,["Add More Photos", "Add More Pony Pics"]
6039 ,["Post Photos", "Post Pony Pics"]
6040 ,["Add Photos to Map", "Add Pony Pics to Map"]
6041 ,["Add Photo", "Add Pony Pic"]
6042
6043 ,["On your own timeline", "On your own journal"]
6044 ,["On a friend's timeline", "On a "+CURRENTSTACK['friend']+"'s journal"]
6045 ,["In a group", "In a herd"]
6046 ,["In a private message", "In a private friendship report"]
6047
6048 ,["Timeline", "Journal"]
6049 ,["Notes", "Scrolls"]
6050 ,["Comments", "Friendship Letters"]
6051 ,["Posts and Apps", "Posts and Magic"]
6052 ,["Timeline Review", "Journal Review"]
6053 ,["Pokes", "Nuzzles"]
6054 ,["Add to Timeline", "Add to Journal"]
6055
6056 ,["Photo", "Pony Pic"]
6057 ,["Question", "Query"]
6058
6059 //,["Create List", "Create Directory"]
6060 ,["See All Friends", "See All "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
6061 //,["Manage List", "Manage Directory"]
6062 ,["Write a Note", "Write a Scroll"]
6063 ,["Add Note", "Add Scroll"]
6064 ,["Edit Featured Likes", "Edit Featured "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
6065 ,["Add Featured Likes", "Add Featured "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
6066 ,["Add profile picture", "Add journal pony pic"]
6067 ,["Edit Profile Picture", "Edit Journal Pony Pic"]
6068 //,["Create an Ad", "Buy a Cupcake"]
6069 //,["On This List", "On This Directory"]
6070 ,["Friend Requests", "Friendship Requests"]
6071 //,["Add Friends to List", "Add "+capitaliseFirstLetter(CURRENTSTACK['friends'])+" to Directory"]
6072 ,["Add Friends to List", "Add "+capitaliseFirstLetter(CURRENTSTACK['friends'])+" to List"]
6073
6074 ,["Pages I like", "Pages I "+capitaliseFirstLetter(CURRENTSTACK.like)]
6075 ,["My Friends", "My "+capitaliseFirstLetter(CURRENTSTACK.friends)]
6076 ,["Tell Friends", "Tell "+capitaliseFirstLetter(CURRENTSTACK.friends)]
6077
6078 ,["Add to Profile", "Add to Journal"]
6079 ,["Add Likes", "Add "+capitaliseFirstLetter(CURRENTSTACK.likes)]
6080 ,["Set as Profile Picture", "Set as Journal Pony Pic"]
6081 ,["View Activity Log", "View Adventure Log"]
6082 ,["Invite Your Friends", "Invite Your "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
6083 ,["Suggest Photo", "Suggest Pony Pic"]
6084 ,["All Apps", "All Magic"]
6085 ,["Link My Profile to Twitter", "Link My Journal to Twitter"]
6086 ,["Link profile to Twitter", "Link journal to Twitter"]
6087 ,["The app sends you a notification", "The magic sends you a spark"]
6088 ,["Upload a Photo", "Upload a Pony Pic"]
6089 ,["Take a Photo", "Take a Pony Pic"]
6090 ,["Take a Picture", "Take a Pony Pic"] // edit page
6091
6092 ,["Search All Friends", "Search All "+capitaliseFirstLetter(CURRENTSTACK.friends)] // invite friends
6093 ,["Top Comments", "Top Friendship Letters"] // comment resort
6094 ,["Go to Activity Log", "Go to Adventure Log"] // checkpoint
6095 ,["Upload Photo", "Upload Pony Pic"] // composer warning
6096 ,["Poke Back", "Nuzzle Back"] // newsfeed flyout
6097 ,["Friends to Invite", capitaliseFirstLetter(CURRENTSTACK['friends'])+" to Invite"] // app invite
6098 ,["Inbox", "Trough"] // page inbox
6099 ,["Save Profile Info", "Save Journal Info"] // welcome
6100
6101 // graph search
6102 ,["Likers", "Brohoofers"] // @todo likers
6103 ,["Liked by", CURRENTSTACK['liked']+" by"] // @todo likers
6104
6105 ,["Create New App", "Create New Magic"]
6106 ,["Submit App Detail Page", "Submit Magic Detail Page"]
6107 ,["Edit App", "Edit Magic"]
6108 ,["Promote App", "Promote Magic"]
6109 ,["Make Friends", "Make "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
6110 ,["Add to Other Apps", "Add to Other Magic"]
6111 ];
6112
6113 dialogTitles = [
6114 [/People who like /, capitaliseFirstLetter(CURRENTSTACK['people'])+" who "+CURRENTSTACK['like_past']+" "]
6115 ,[/People Who Like /, capitaliseFirstLetter(CURRENTSTACK['people'])+" Who "+capitaliseFirstLetter(CURRENTSTACK['like_past'])+" "]
6116 ,[/Friends who like /i, capitaliseFirstLetter(CURRENTSTACK['friends_logic'])+" who "+CURRENTSTACK['like_past']+" "]
6117 ,["People who voted for this option", capitaliseFirstLetter(CURRENTSTACK['people'])+" who voted for this option"]
6118 ,["People who are following this question", capitaliseFirstLetter(CURRENTSTACK['people'])+" who are following this question"]
6119 ,[/People Connected to /, capitaliseFirstLetter(CURRENTSTACK['people'])+" Connected to "]
6120 ,["People who saw this", capitaliseFirstLetter(CURRENTSTACK['people'])+" who saw this"]
6121 ,["Added Friends", "Added "+capitaliseFirstLetter(CURRENTSTACK.friends)]
6122 ,["People who can repro this", capitaliseFirstLetter(CURRENTSTACK['people'])+" who can repro this"]
6123 ,["Friends that like this", capitaliseFirstLetter(CURRENTSTACK['friends_logic'])+" that "+CURRENTSTACK['like_past']+" this"]
6124 ,["People", capitaliseFirstLetter(CURRENTSTACK['people'])] // gifts
6125 ,["Choose friends to help translate", "Choose "+CURRENTSTACK['friends']+" to help translate"]
6126
6127 ,["Share this Profile", "Share this Journal"]
6128 ,["Share This Photo", "Share This Pony Pic"]
6129 //,["Share this Album", ""]
6130 ,["Share this Note", "Share this Scroll"]
6131 ,["Share this Group", "Share this Herd"]
6132 ,["Share this Event", "Share this Adventure"]
6133 //,["Share this Ad", ""]
6134 ,["Share this Application", "Share this Magic"]
6135 //,["Share this Video", ""]
6136 //,["Share this Page", "Share this Landmark"]
6137 //,["Share this Page", "You gotta share!"]
6138 //,["Share this Job", ""]
6139 //,["Share this Status", "You gotta share!"]
6140 ,["Share this Question", "Share this Query"]
6141 //,["Share this Link", "You gotta share!"]
6142 ,["Share", "You gotta share!"]
6143 //,["Share this Help Content", ""]
6144 ,["Send This Photo", "Send This Pony Pic"]
6145 ,["Share Photo", "Share Pony Pic"]
6146
6147 ,["Timeline and Tagging", "Journal and Tagging"]
6148 ,["Timeline Review", "Journal Review"]
6149 //,["Friends Can Check You Into Places", capitaliseFirstLetter(CURRENTSTACK['friends_logic'])+" Can Check You Into Landmarks"]
6150 //,["Limit The Audience for Old Posts on Your Timeline", "Limit The Audience for Old Posts on Your Journal"]
6151 //,["How people bring your info to apps they use", "How "+CURRENTSTACK['people']+" bring your info to magic they use"]
6152 //,["Turn off Apps, Plugins and Websites", "Turn off Magic, Plugins and Websites"]
6153
6154 ,["Likes", capitaliseFirstLetter(CURRENTSTACK['likes'])]
6155 ,["Edit Featured Likes", "Edit Featured "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
6156 ,["Change Date", "Time Travel"]
6157 ,["Date Saved", "Time Traveled"]
6158
6159 ,["Delete", "Nuke"]
6160 ,["Delete Comment", "Nuke Friendship Letter"]
6161 ,["Delete Photo", "Nuke Pony Pic"]
6162 ,["Remove Picture?", "Nuke Pony Pic?"]
6163 ,["Delete Video?", "Nuke Video?"]
6164 ,["Delete Milestone", "Nuke Milestone"]
6165 ,["Delete Page?", "Nuke Page?"]
6166 ,["Delete this Message?", "Nuke this Friendship Report?"]
6167 ,["Delete This Entire Conversation?", "Nuke This Entire Conversation?"]
6168 ,["Delete These Messages?", "Nuke These Friendship Reports?"]
6169 ,["Delete Post", "Nuke Post"]
6170 ,["Delete Post?", "Nuke Post?"]
6171 ,["Delete Page Permanently?", "Nuke Page Permanently?"]
6172 ,["Unlike", capitaliseFirstLetter(CURRENTSTACK['unlike'])]
6173 ,["Remove Search", "Nuke Search"]
6174 //,["Clear Searches", "Nuke Searches"]
6175 ,["Untag Photo", "Untag Pony Pic"]
6176 ,["Untag Photos", "Untag Pony Pics"]
6177 ,["Permanently Delete Account", "Permanently Nuke Account"]
6178 ,["Remove", "Nuke"]
6179 ,["Delete and Ban Member", "Nuke and Banish to Moon"]
6180 ,["Delete Album", "Nuke Album"]
6181 ,["Are you sure you want to clear all your searches?", "Are you sure you want to nuke all your searches?"]
6182 ,["Remove Photo?", "Nuke Pony Pic?"]
6183 ,["Removed Group Photo", "Nuked Herd Pony Pic"]
6184 ,["Post Deleted", "Post Nuked"]
6185 ,["Remove Event", "Nuke Adventure"]
6186 ,["Delete Entry?", "Nuke Entry?"]
6187 ,["Delete Video", "Nuke Video"]
6188 ,["Delete Event", "Nuke Adventure"] // for group admin
6189 ,["Remove Profile Picture", "Nuke Journal Pony Pic"]
6190
6191 ,["Report and/or Block This Person", "Whine and/or Block This "+capitaliseFirstLetter(CURRENTSTACK['person'])] // 0
6192 ,["Report This Photo", "Whine About This Pony Pic"]
6193 ,["Report This Event", "Whine About This Adventure"]
6194 ,["Report Conversation", "Whine About Conversation"]
6195 ,["Report as Spam?", "Whine as Spam?"]
6196 ,["Invalid Report", "Invalid Whining"]
6197 ,["Report This Page", "Whine About This Page"]
6198 ,["Report This Doc Revision", "Whine About This Doc Revision"]
6199 ,["Confirm Report", "Confirm Whining"]
6200 ,["Report This Place", "Whine About This Place"] // 64
6201 ,["Thanks For This Report", "Thanks For Whining"]
6202 ,["Send Message", "Send Friendship Report"] // social report
6203 ,["Send Messages", "Send Friendship Reports"]
6204 ,["Why don't you like these photos?", "Why don't you like these pony pics?"]
6205 ,["Photos Untagged and Messages Sent", "Pony Pics Untagged and Friendship Reports Sent"]
6206 ,["Report This Post", "Whine About This Post"] // report lists as a page
6207 ,["Report This?", "Whine About This?"]
6208 ,["Report Recommendation", "Whine About Recommendation"] // 108
6209 ,["Why don't you like this photo?", "Why don't you like this pony pic?"]
6210 ,["Report Spam or Abuse", "Whine as Spam or Abuse"] // messages
6211 ,["Report Incorrect External Link", "Whine About Incorrect External Link"] // page vertex // 87
6212 ,["Post Reported", "Whined About Post"]
6213 ,[" Report a Problem ", "Whine About a Problem"]
6214 ,["Report a Problem", "Whine About a Problem"]
6215
6216 // report types: 5: links / 125: status / 70: group post / 86: og post
6217 ,["Is this post about you or a friend?", "Is this post about you or a "+CURRENTSTACK.friend+"?"]
6218 ,["Why are you reporting this Page?", "Why are you whining about this Page?"] // 23
6219 ,["Is this group about you or a friend?", "Is this herd about you or a "+CURRENTSTACK['friend']+"?"] // 1
6220 ,["Is this comment about you or a friend?", "Is this friendship letter about you or a "+CURRENTSTACK['friend']+"?"] // 71 / 74: page comment
6221 //,["Is this list about you or a friend?", "Is this directory about you a "+CURRENTSTACK.friend+"?"] // 92
6222 ,["Is this list about you or a friend?", "Is this list about you a "+CURRENTSTACK.friend+"?"] // 92
6223 ,["Is this photo about you or a friend?", "Is this pony pic about you or a "+CURRENTSTACK['friend']+"?"] // 2
6224 ,["Is this note about you or a friend?", "Is this scroll about you or a "+CURRENTSTACK['friend']+"?"] // 4
6225 ,["Is this video about you or a friend?", "Is this video about you or a "+CURRENTSTACK['friend']+"?"] // 13
6226 ,["Is this event about you or a friend?", "Is this adventure about you or a "+CURRENTSTACK['friend']+"?"] // 81
6227
6228 ,["How to Report Posts", "How to Whine About Posts"]
6229 ,["How to Report Posts on My Timeline", "How to Whine About Posts on My Journal"]
6230 ,["How to Report the Profile Picture", "How to Whine About the Journal Pony Pic"]
6231 ,["Why are you reporting this photo?", "Why are you whining about this pony pic?"]
6232 ,["How to Report the Cover", "How to Whine About the Cover"]
6233 ,["How to Report Messages", "How to Whine About Friendship Reports"]
6234 ,["How to Report a Page", "How to Whine About a Page"]
6235 ,["How to Report a Group", "How to Whine About a Herd"]
6236 ,["How to Report an Event", "How to Whine About an Adventure"]
6237 ,["How to Report Page Posts", "How to Whine About Page Posts"]
6238
6239 ,["New Message", "Write a Friendship Report"]
6240 ,["Forward Message", "Forward this Friendship Report"]
6241 ,["Delete This Message?", "Nuke This Friendship Report?"]
6242 ,["Message Not Sent", "Friendship Report Not Sent"]
6243 ,["Add People", "Add "+capitaliseFirstLetter(CURRENTSTACK['people'])]
6244 ,["Add Photos", "Add Pony Pics"]
6245 ,["People in this message", capitaliseFirstLetter(CURRENTSTACK['people'])+" in this friendship report"]
6246 ,["Message Sent", "Friendship Report Sent"]
6247 ,["Message Filtering Preferences", "Friendship Report Filtering Preferences"]
6248
6249 ,["Create New Group", "Create New Herd"]
6250 ,[/Create New Event/, "Plan an Adventure"]
6251 ,["Notification Settings", "Spark Settings"]
6252 ,["Create Group Email Address", "Create Herd Email Address"]
6253 ,["Set Up Group Web and Email Address", "Set Up Herd Web and Email Address"]
6254 ,["Mute Chat?", "Mute Whinny Chat?"]
6255 ,["Add Friends to Group", "Add "+capitaliseFirstLetter(CURRENTSTACK['friends_logic'])+" to the Herd"]
6256 ,["Add People to Group", "Add "+capitaliseFirstLetter(CURRENTSTACK['people'])+" to the Herd"]
6257 ,["Not a member of the group", "Not a member of the herd"]
6258 ,["Invite People to Group by Email", "Invite "+capitaliseFirstLetter(CURRENTSTACK.people)+" to Herd by Email"]
6259 ,["Remove Group Admin", "Remove Herd Admin"]
6260 ,["Add Group Admin", "Add Herd Admin"]
6261 ,["Group Admins", "Herd Admins"]
6262 ,["Change Group Privacy?", "Change Herd Privacy?"]
6263
6264 ,["Cancel Event?", "Cancel Adventure?"]
6265 ,["Change Event Photo", "Change Pony Pic for Adventure"]
6266 ,["Add Event Photo", "Add Adventure Pony Pic"]
6267 ,["Export Event", "Export Adventure"]
6268 ,["Edit Event Info", "Edit Adventure Info"]
6269 ,["Create Repeat Event", "Plan a Repeat Adventure"]
6270 ,["Event Invites", "Adventure Invites"]
6271
6272 ,["Hide all recent profile changes?", "Hide all recent journal changes?"]
6273 ,["Edit your profile story settings", "Edit your journal story settings"]
6274 ,["Edit your timeline recent activity settings", "Edit your journal recent activity settings"]
6275 ,["Hide all recent likes activity?", "Hide all recent "+CURRENTSTACK.likes+" activity?"]
6276 ,["Edit Privacy of Likes", "Edit Privacy of "+capitaliseFirstLetter(CURRENTSTACK.likes)]
6277
6278 ,["Edit News Feed Settings", "Edit Feed Bag Settings"]
6279 //,["Create New List", "Create New Directory"]
6280 ,["Invite Friends", "Invite "+capitaliseFirstLetter(CURRENTSTACK['friends_logic'])]
6281 ,["Advanced Chat Settings", "Advanced Whinny Chat Settings"]
6282 ,["Notifications Updated", "Sparks Updated"]
6283 ,["Move photo to another album?", "Move pony pic to another album?"]
6284 ,["Group Muted", "Herd Muted"]
6285 ,["Block App?", "Block Magic?"]
6286 //,["List Notification Settings", "Directory Spark Settings"]
6287 ,["List Notification Settings", "List Spark Settings"]
6288 ,["Like This Photo?", capitaliseFirstLetter(CURRENTSTACK['like'])+" This Pony Pic?"]
6289 ,["Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])]
6290 ,["All Friends", "All "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
6291 ,["Suggest Friend", "Suggest "+capitaliseFirstLetter(CURRENTSTACK.friend)]
6292 ,["Blocked People", "Blocked "+capitaliseFirstLetter(CURRENTSTACK.people)]
6293 ,["Block People", "Block "+capitaliseFirstLetter(CURRENTSTACK.people)]
6294 ,["Tag Friends", "Tag "+capitaliseFirstLetter(CURRENTSTACK.friends)]
6295 ,["Unable to edit Group", "Unable to edit Herd"]
6296 ,["Thanks for Inviting Your Friends", "Thanks for Inviting Your "+capitaliseFirstLetter(CURRENTSTACK.friends)]
6297 ,["Timeline Gift Preview", "Journal Gift Preview"]
6298 ,["Friend Request Setting", "Friendship Request Setting"]
6299 ,["Invalid Question", "Invalid Query"]
6300 //,["List Subscribers", "Directory Subscribers"]
6301 ,["People Who Shared This", capitaliseFirstLetter(CURRENTSTACK.people)+" Who Shared This"]
6302 //,["Edit List Settings", "Edit Directory Settings"]
6303 ,["Remove App", "Remove Magic"]
6304 ,["Turn Off Chat", "Turn Off Whinny Chat"]
6305 ,["Access Log", "Adventure Log"]
6306 ,["Post to Your Wall", "Post to Your Journal"]
6307 ,["About Adding Comments by Email", "About Adding Friendship Letters by Email"]
6308
6309 ,["Take a Profile Picture", "Take a Journal Pony Pic"]
6310 ,["Choosing Your Cover Photo", "Choosing Your Cover Pony Pic"]
6311 ,["Choose from Group Photos", "Choose from Herd Pony Pics"]
6312 ,["Group Albums", "Herd Albums"]
6313 ,["Choose From Your Photos", "Choose From Your Pony Pics"]
6314 ,["Choose from Photos", "Choose from Pony Pics"]
6315 ,["Choose Your Cover Photo", "Choose Your Cover Pony Pic"]
6316 ,["Choose from your synced photos", "Choose from your synced pony pics"]
6317 ,["Upload Your Profile Picture", "Upload Your Journal Pony Pic"] // welcome
6318
6319 ,["Create New App", "Create New Magic"]
6320 ,["Add Test Users to other Apps", "Add Test Users to other Magic"]
6321
6322 ,["Hidden in Groups", "Hidden in Herds"] // timeline
6323 ,["Add Friends as Contributors", "Add "+capitaliseFirstLetter(CURRENTSTACK['friends'])+" as Contributors"] // shared albums
6324 ];
6325 if (ponyData.successText) {
6326 dialogTitles.push(["Success", ponyData.successText]);
6327 dialogTitles.push(["Success!", ponyData.successText]);
6328 }
6329
6330 tooltipTitles = [
6331 [/everyone/gi, "Everypony"]
6332 //,[/\bpublic\b/g, "everypony"]
6333 ,[/\bPublic\b/g, "Everypony"]
6334 ,["People you're not friends with can follow you and see only your public posts.", capitaliseFirstLetter(CURRENTSTACK.people)+" you're not pals with can follow you and see only your public posts."]
6335 //,["These people subscribe to the lists you're featured on", "These "+capitaliseFirstLetter(CURRENTSTACK['people'])+" subscribe to the directories you're featured on"]
6336 ,["These people subscribe to the lists you're featured on", "These "+capitaliseFirstLetter(CURRENTSTACK['people'])+" subscribe to the lists you're featured on"]
6337 ,["Friends of anyone going to this event", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of anypony going to this adventure"]
6338 ,["Friends of guests going to this event can see and join it", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of guests going to this adventure can see and join it"]
6339 ,["Anyone can see and join this event", "Anypony can see and join this adventure"]
6340 ,["Your friends will see your comment in News Feed.", "Your "+CURRENTSTACK['friends']+" will see your friendship letter in Feed Bag."]
6341 ,[/\bfriends in group\b/, CURRENTSTACK['friends']+" in herd"]
6342 ,["Your post will only be promoted to the people who like your Page and their friends", "Your post will only be promoted to the "+CURRENTSTACK['people']+" who like your Page and their "+CURRENTSTACK['friends']]
6343 ,["Your post will be promoted to people based on the targeting you choose below.", "Your post will be promoted to "+CURRENTSTACK['people']+" based on the targeting you choose below."]
6344 ,["Friends and friends of anyone tagged", capitaliseFirstLetter(CURRENTSTACK['friends'])+" and "+CURRENTSTACK['friends']+" of anypony tagged"]
6345 ,[/\bfriends of friends\b/g, CURRENTSTACK['friends']+" of "+CURRENTSTACK['friends']]
6346 ,[/\bFriends of Friends\b/g, capitaliseFirstLetter(CURRENTSTACK['friends'])+" of "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
6347 ,[/\bfriends\b/g, CURRENTSTACK['friends']]
6348 ,[/\bFriends\b/g, capitaliseFirstLetter(CURRENTSTACK['friends'])]
6349 ,["Only Me", "Alone"]
6350 ,["Only me", "Alone"]
6351 ,["No One", "Alone"]
6352 ,["Only you", "Alone"]
6353 ,["Anyone tagged", "Anypony tagged"]
6354 //,[/cover photos are everypony/i, "Everypony can see your cover pony pics"]
6355 ,["Cover photos are public", "Everypony can see your cover pony pics"]
6356 ,[/any other information you made Everypony/i, "any other information that everypony can see"]
6357 ,["Anyone can see this Everypony comment", "Everypony can see this public friendship letter"]
6358 //,["Remember: all place ratings are Everypony.", "Remember: everypony can see all place ratings."]
6359 ,["Everypony can see posts on this Everypony page.", "Everypony can see posts on this public page."]
6360 ,["Name, profile picture, age range, gender, language, country and other public info", "Name, profile picture, age range, gender, language, country and other public info"]
6361 //,["Name, profile picture, age range, gender, language, country and other Everypony info", "Name, profile picture, age range, gender, language, country and other public info"]
6362 ,["This will hide you from Everypony attribution", "This will hide you from public attribution"]
6363 ,["Remember: all place ratings are public.", "Remember: everypony can see all place ratings."]
6364 ,["Shared with: Anyone who can see this page", "Shared with: Anypony who can see this page"]
6365 ,["Anyone can see the group, who's in it, and what members post.", "Anypony can see the herd, who's in it, and what members post."]
6366 ,["Anyone can see the group, who's in it and what members post.", "Anypony can see the herd, who's in it and what members post."] // English (UK)
6367 ,["Anyone can see the group and who's in it. Only members see posts.", "Anypony can see the herd and who's in it. Only members see posts."]
6368 ,["Only members see the group, who's in it, and what members post.", "Only members see the herd, who's in it, and what members post."]
6369 ,["Only members see the group, who's in it and what members post.", "Only members see the herd, who's in it and what members post."] // English (UK)
6370
6371 ,["Show comments", "Show friendship letters"]
6372 ,["Comment deleted", "Friendship letter nuked"]
6373 ,[/Comments/, "Friendship Letters"]
6374 ,[/Comment/, "Friendship Letter"]
6375
6376 ,["Remove", "Nuke"]
6377 ,["Edit or Delete", "Edit or Nuke"]
6378 ,["Edit or Remove", "Edit or Nuke"]
6379 ,["Delete Post", "Nuke Post"]
6380 ,["Remove or Report", "Nuke or Whine"]
6381 ,["Report", "Whine"]
6382 ,["Report/Mark as Spam", "Whine/Mark as Spam"]
6383 ,["Report as not relevant", "Whine as not relevant"]
6384 ,["Remove Invite", "Nuke Invite"]
6385 ,["Report/Remove Tag", "Whine/Nuke Tag"]
6386 ,["Delete", "Nuke"]
6387 ,["Delete and Ban", "Nuke and Banish"]
6388 ,["Report Place", "Whine About Place"]
6389
6390 ,["Shown on Timeline", "Shown on Journal"]
6391 ,["Allow on Timeline", "Allow on Journal"]
6392 ,["Highlighted on Timeline", "Highlighted on Journal"]
6393 ,["Allowed on Timeline", "Allowed on Journal"]
6394 ,["Hidden from Timeline", "Hidden from Journal"]
6395
6396 //,[/likes? this/g, "brohoof'd this"]
6397 ,["Sent from chat", "Sent from whinny chat"]
6398 ,["New Message", "Write a Friendship Report"]
6399
6400 //,[/\bpeople\b/gi, "ponies"]
6401 ,[/See who likes this/gi, "See who "+CURRENTSTACK['likes']+" this"]
6402 ,[/people like this\./gi, CURRENTSTACK['people']+" "+CURRENTSTACK['like_past']+" this."] // entstream
6403 ,[/like this\./gi, CURRENTSTACK['like_past']+" this."]
6404 ,[/likes this\./gi, CURRENTSTACK['likes_past']+" this."]
6405
6406 // top right pages
6407 ,["Status", "Take a Note"]
6408 ,["Photo / Video", "Add a Pic"]
6409 ,["Event, Milestone +", "Adventure, Milestone +"]
6410
6411 ,["Onsite Notifications", "Onsite Sparks"]
6412 ,["Create Event", "Plan an Adventure"]
6413 ,["Search messages in this conversation", "Search friendship reports in this conversation"]
6414 ,["Open photo viewer", "Open pony pic viewer"]
6415 ,["Choose a unique image for the cover of your timeline.", "Choose a unique pony pic for the cover of your journal."]
6416 ,["Remove from Dashboard", "Remove from Dashieboard"]
6417 ,["Choose a unique cover photo to express what your Page is about.", "Choose a unique cover pony pic to express what your Page is about."]
6418
6419 ,["Each photo has its own privacy setting", "Each pony pic has its own privacy setting"]
6420 ,["You can change the audience for each photo in this album", "You can change the audience for each pony pic in this album"]
6421
6422 ,["View Photo", "View Pony Pic"]
6423
6424 // litestand navigation when collapsed
6425 ,["News Feed", "Feed Bag"]
6426 ,["Messages", "Trough"]
6427 ,["Pokes", "Nuzzles"]
6428 ,["Manage Apps", "Manage Magic"]
6429 ,["Events", "Adventures"]
6430 ,["App Center", "Magic Center"]
6431 ,["Add Friend", "Add "+capitaliseFirstLetter(CURRENTSTACK['friend'])] // people you may know
6432
6433 // photo comments
6434 ,["Attach a Photo", "Attach a Pony Pic"]
6435 ,["Remove Photo", "Nuke Pony Pic"]
6436
6437 ,["Dismiss and go to most recent message", "Dismiss and go to most recent friendship letter"] // messages
6438 ,["To create an offer, your Page needs at least 100 likes.", "To create an offer, your Page needs at least 100 "+CURRENTSTACK['likes']+"."] // page composer
6439 ,["Verified profile", "Verified journal"] // verified
6440 ,["Tags help people find groups about certain topics.", "Tags help "+CURRENTSTACK['people']+" find herds about certain topics."] // verified
6441 ,["This post is more engaging than many of your other posts. You can boost it to get more likes and comments.", "This post is more engaging than many of your other posts. You can boost it to get more "+CURRENTSTACK['likes']+" and friendship letters."] // page admin pabel
6442
6443 // developers
6444 ,["Enable the newsfeed ticker", "Enable the feedbag ticker"]
6445 ,["Add selected users to other apps you own.", "Add selected users to other magic you own."]
6446 ,["Remove selected users from this app.", "Remove selected users from this magic."]
6447
6448 // insights
6449 ,["The total number of clicks on your posts, not including likes, comments, or shares, which are broken out above.", "The total number of clicks on your posts, not including "+CURRENTSTACK['likes']+", friendship letters, or shares, which are broken out above."]
6450 ,["The percentage of people who liked, commented, shared or clicked on your post after having seen it.", "The percentage of "+CURRENTSTACK['people']+" who "+CURRENTSTACK['liked']+", commented, shared or clicked on your post after having seen it."]
6451 ,["The unique number of people who liked, commented, shared or clicked on your posts", "The unique number of "+CURRENTSTACK['people']+" who "+CURRENTSTACK['liked']+", commented, shared or clicked on your posts"]
6452
6453 ,["The week when the most people were talking about this Page.", "The week when the most "+CURRENTSTACK['people']+" were talking about this Page."]
6454 ,["The city where most of the people talking about this Page are from.", "The city where most of the "+CURRENTSTACK['people']+" talking about this Page are from."]
6455 ,["The largest age group of the people talking about this Page.", "The largest age group of the "+CURRENTSTACK['people']+" talking about this Page."]
6456 ];
6457 if (ponyData.loadingText) {
6458 tooltipTitles.push(["Loading...", ponyData.loadingText]);
6459 }
6460
6461 headerTitles = [
6462 //["List Suggestions", "Directory Suggestions"]
6463 ["People You May Know", capitaliseFirstLetter(CURRENTSTACK.people)+" You May Know"]
6464 ,["Sponsored", "Cupcake Money"]
6465 ,["Pokes", "Nuzzles"]
6466 ,["People To Follow", capitaliseFirstLetter(CURRENTSTACK.people)+" To Follow"]
6467 ,["Poke Suggestions", "Nuzzle Suggestions"]
6468 ,["Suggested Groups", "Suggested Herds"]
6469 ,["Find More Friends", "Find Friendship"]
6470 ,["Rate Recently Used Apps", "Rate Recently Used Magic"]
6471 ,["Friends' Photos", "Pals' Pony Pics"]
6472 ,["Add a Location to Your Photos", "Add a Location to Your Pony Pics"]
6473 ,["Suggest Friends", "Suggest "+capitaliseFirstLetter(CURRENTSTACK.friends)]
6474 ,["Other Pages You Like", "Other Pages You "+capitaliseFirstLetter(CURRENTSTACK.like)]
6475 ,["Entertainment Pages You Might Like", "Entertainment Pages You Might "+capitaliseFirstLetter(CURRENTSTACK.like)]
6476 ,["Music Pages You Might Like", "Music Pages You Might "+capitaliseFirstLetter(CURRENTSTACK.like)]
6477 ,["Add Personal Contacts as Friends", "Add Personal Contacts as "+capitaliseFirstLetter(CURRENTSTACK.friends)]
6478 ,["Find Friends", "Find Friendship"]
6479 //,[/On This List/, "On This Directory"]
6480 //,["On this list", "On this directory"]
6481 //,["On This List", "On This Directory"]
6482 ,["Related Groups", "Related Herds"]
6483 ,["Entertainment Pages You May Like", "Entertainment Pages You May "+capitaliseFirstLetter(CURRENTSTACK['like'])]
6484
6485 ,["Notifications", "Sparks"]
6486 ,["New Likes", "New "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
6487 ,["Invite Friends", "Invite "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
6488 ,["Get More Likes", "Get More "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
6489 ,["Added Apps", "Added Magic"]
6490 ,["Apps You May Like", "Magic You May "+capitaliseFirstLetter(CURRENTSTACK.like)]
6491 ,["Your Apps", "Your Magic"]
6492 ,["People Talking About This", capitaliseFirstLetter(CURRENTSTACK.people)+" Blabbering About This"]
6493 ,["Total Likes", "Total "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
6494 ,["Games You May Like", "Games You May "+capitaliseFirstLetter(CURRENTSTACK.like)]
6495 ,["Add To News Feed", "Add To Feed Bag"]
6496
6497 ,["Messages", "Trough"]
6498 //,["Other Messages", "Other Friendship Reports"]
6499 //,["Unread Messages", "Unread Friendship Reports"]
6500 //,["Sent Messages", "Sent Friendship Reports"]
6501 //,["Archived Messages", "Archived Friendship Reports"]
6502 ,["Inbox", "Trough"]
6503
6504 ,["Groups", "Herds"]
6505 //,["Pages and Ads", "Landmarks and Ads"]
6506 ,["Apps", "Magic"]
6507 ,[/Friends who like /gi, capitaliseFirstLetter(CURRENTSTACK['friends_logic'])+" who "+CURRENTSTACK['like_past']+" "]
6508 ,["Favorites", capitaliseFirstLetter(CURRENTSTACK['likes'])]
6509 ,["Likes", capitaliseFirstLetter(CURRENTSTACK['likes'])]
6510 ,["Events", "Adventures"]
6511 ,["Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])]
6512 ,["Ads", "Cupcakes"]
6513 ,["Mutual Likes", "Mutual "+capitaliseFirstLetter(CURRENTSTACK.likes)]
6514 ,[/Mutual Friends/, "Mutual "+capitaliseFirstLetter(CURRENTSTACK.friends)]
6515
6516 ,["Notes", "Scrolls"]
6517 ,["My Notes", "My Scrolls"]
6518 ,["Notes About Me", "Scrolls About Me"]
6519 ,["Write a Note", "Write a Scroll"]
6520 ,["Edit Note", "Edit Scroll"]
6521
6522 ,["Timeline and Tagging", "Journal and Tagging"]
6523 ,["Ads, Apps and Websites", "Ads, Magic and Websites"]
6524 ,["Blocked People and Apps", "Banished "+capitaliseFirstLetter(CURRENTSTACK['people'])+" and Magic"]
6525 ,["Notifications Settings", "Sparks Settings"]
6526 ,["App Settings", "Magic Settings"]
6527 ,["Friend Requests", "Friendship Requests"]
6528 ,["People Who Shared This", capitaliseFirstLetter(CURRENTSTACK.people)+" Who Shared This"]
6529 ,["Your Notifications", "Your Sparks"]
6530 ,["Timeline and Tagging Settings", "Journal and Tagging Settings"]
6531 ,["Delete My Account", "Nuke My Account"]
6532
6533 ,["Posts in Groups", "Posts in Herds"]
6534 ,["People", capitaliseFirstLetter(CURRENTSTACK['people'])]
6535
6536 ,["Posts by Friends", "Posts by "+capitaliseFirstLetter(CURRENTSTACK.friends)]
6537 ,["Support Dashboard", "Support Dashieboard"]
6538 ,["Event Invitations", "Adventure Invitations"]
6539 ,["Who Is in These Photos?", "Who Is in These Pony Pics?"]
6540 ,["People who like this", capitaliseFirstLetter(CURRENTSTACK.people)+" that "+CURRENTSTACK.like_past+" this"]
6541 //,["List Subscribers", "Directory Subscribers"]
6542 ,["Upcoming Events", "Upcoming Adventures"]
6543 ,["Photos and Videos", "Pony Pics and Videos"]
6544 ,["People Who Are Going", capitaliseFirstLetter(CURRENTSTACK.people)+" Who Are Going"]
6545 ,["Would you like to opt out of this email notification?", "Would you like to opt out of this email spark?"]
6546 ,["Confirm Like", "Confirm "+capitaliseFirstLetter(CURRENTSTACK['like'])]
6547
6548 ,["Invite Friends You Email", "Invite "+capitaliseFirstLetter(CURRENTSTACK['friends'])+" You Email "]
6549 ,["Invite Your Friends", "Invite Your "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
6550
6551 ,["Account Groups", "Account Herds"]
6552 ,["Ads Email Notifications", "Ads Email Soarks"]
6553 ,["Ads Notifications on Facebook", "Ads Sparks on Facebook"]
6554
6555 ,["App Restrictions", "Magic Restrictions"]
6556 ,["App Info", "Magic Info"]
6557
6558 ,["Tagged Photos", "Tagged Pony Pics"]
6559
6560 ,["Add Groups", "Add Herds"] // /addgroup
6561 ,["Photos", "Pony Pics"] // /media/video/
6562 ,["Post to Your Wall", "Post to Your Stall"]
6563 ];
6564
6565 menuTitles = [
6566 ["Everyone", "Everypony"]
6567 ,["Everybody", "Everypony"]
6568 ,["Public", "Everypony"]
6569 ,["Anyone", "Anypony"]
6570 ,["Friends of Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
6571 ,["Friends except Acquaintances", capitaliseFirstLetter(CURRENTSTACK['friends'])+" except Acquaintances"]
6572 ,["Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])]
6573 ,["Friends ", capitaliseFirstLetter(CURRENTSTACK['friends'])]
6574 ,["Friends of Guests", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of Guests"]
6575 ,["Friends of Contributors", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of Contributors"]
6576 ,["Only Me", "Alone"]
6577 ,["Only me", "Alone"]
6578 ,["No One", "Alone"]
6579 ,["Nobody", "Nopony"]
6580 //,["See all lists...", "See entire directory..."]
6581
6582 ,["Mutual Friends", "Mutual "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
6583 ,["People You May Know", "Ponies You May Know"]
6584 ,["Poke...", "Nuzzle..."]
6585 ,["Poke", "Nuzzle"]
6586 ,["All Friends", "All "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
6587 ,["All friends", "All "+CURRENTSTACK['friends']]
6588
6589 ,["On your own timeline", "On your own journal"]
6590 ,["On a friend's timeline", "On a "+CURRENTSTACK['friend']+"'s journal"]
6591 ,["In a group", "In a herd"]
6592 ,["In a private Message", "In a private Friendship Report"]
6593
6594 ,["Friends' Posts", capitaliseFirstLetter(CURRENTSTACK['friends'])+"' Posts"]
6595 ,["Friend Activity", capitaliseFirstLetter(CURRENTSTACK['friend'])+" Activity"]
6596
6597 ,["Change Date...", "Time Travel..."]
6598 ,["Reposition Photo...", "Reposition Pony Pic..."]
6599 ,["Manage Notifications", "Manage Sparks"]
6600 ,["Use Activity Log", "Use Adventure Log"]
6601 ,["See Banned Users...", "See Ponies who were Banished to the Moon..."]
6602 ,["Invite Friends...", "Invite "+capitaliseFirstLetter(CURRENTSTACK['friends'])+"..."]
6603 ,["Like As Your Page...", capitaliseFirstLetter(CURRENTSTACK.like)+" As Your Page..."]
6604 ,["Add App to Page", "Add Magic to App"]
6605 ,["Change Primary Photo", "Change Primary Pony Pic"]
6606 ,["Change Date", "Time Travel"]
6607
6608 ,["People", capitaliseFirstLetter(CURRENTSTACK['people'])]
6609 //,["Pages", "Landmarks"]
6610 ,["Banned", "Banished to Moon"]
6611 ,["Blocked", "Banished to Moon"]
6612 ,["People who like this", capitaliseFirstLetter(CURRENTSTACK.people)+" who "+CURRENTSTACK.like_past+" this"]
6613 ,["Pages that like this", "Pages that "+CURRENTSTACK.like_past+" this"]
6614
6615 ,["Unlike", capitaliseFirstLetter(CURRENTSTACK['unlike'])]
6616 ,["Unlike...", capitaliseFirstLetter(CURRENTSTACK['unlike'])+"..."]
6617 ,["Show in News Feed", "Show in Feed Bag"]
6618 ,["Suggest Friends...", "Suggest "+capitaliseFirstLetter(CURRENTSTACK['friends'])+"..."]
6619 ,["Unfriend...", "Banish to Moon..."]
6620 ,["Unfriend", "Banish to Moon"]
6621 //,["New List...", "New Directory..."]
6622 ,["Get Notifications", "Get Sparks"]
6623 //,["Add to another list...", "Add to another directory..."]
6624
6625 ,["Create Event", "Plan an Adventure"]
6626 ,["Edit Group", "Edit Herd"]
6627 ,["Report Group", "Whine about Herd"]
6628 ,["Leave Group", "Leave Herd"]
6629 ,["Edit Group Settings", "Edit Herd Settings"]
6630 ,["Choose from Group Photos", "Choose from Herd Pony Pics"]
6631 ,["Upload a Photo", "Upload a Pony Pic"]
6632 ,["Remove from Group", "Banish to Moon"]
6633 ,["Share Group", "Share Herd"]
6634 ,["Create Group", "Create Herd"]
6635 ,["Change group settings", "Change herd settings"]
6636 ,["Add People to Group", "Add "+capitaliseFirstLetter(CURRENTSTACK['people'])+" to the Herd"]
6637 ,["Send Message", "Send Friendship Report"]
6638 ,["View Group", "View Herd"]
6639 ,["Add People", "Add "+capitaliseFirstLetter(CURRENTSTACK['people'])]
6640
6641 ,["Remove App", "Remove Magic"]
6642 ,["Uninstall App", "Uninstall Magic"]
6643 ,["Report App", "Whine about Magic"]
6644 ,["Block App", "Block Magic"]
6645 ,["Find More Apps", "Find More Magic"]
6646 ,["No more apps to add.", "No more magic to add."]
6647
6648 ,["Delete Post And Remove User", "Nuke Post And Banish to Moon"]
6649 ,["Delete Post And Ban User", "Nuke Post And Banish to Moon"]
6650 ,["Hide from Timeline", "Hide from Journal"]
6651 ,["Delete", "Nuke"]
6652 ,["Delete...", "Nuke..."]
6653 ,["Delete Photo", "Nuke Pony Pic..."]
6654 ,["Delete This Photo", "Nuke This Pony Pic"]
6655 ,["Delete Messages...", "Nuke Friendship Reports..."]
6656 ,["Delete Post", "Nuke Post"]
6657 ,["Delete Comment", "Nuke Friendship Letter..."]
6658 ,["Show on Timeline", "Show on Journal"]
6659 ,["Show on Profile", "Show on Journal"]
6660 ,["Shown on Timeline", "Shown on Journal"]
6661 ,["Allow on Timeline", "Allow on Journal"]
6662 ,["Highlighted on Timeline", "Highlighted on Journal"]
6663 ,["Allowed on Timeline", "Allowed on Journal"]
6664 ,["Hidden from Timeline", "Hidden from Journal"]
6665 ,["Remove", "Nuke"]
6666 ,["Delete Photo...", "Nuke Pony Pic..."]
6667 ,["Remove this photo", "Nuke this pony pic"]
6668 ,["Remove photo", "Nuke pony pic"]
6669 ,["Remove...", "Nuke..."]
6670 ,["Delete Conversation...", "Nuke Conversation..."]
6671 ,["Delete Album", "Nuke Album"]
6672 ,["Delete Comment...", "Nuke Friendship Letter..."]
6673 ,["Hide Comment...", "Hide Friendship Letter..."]
6674 ,["Hide Event", "Hide Adventure"]
6675 ,["Hide Comment", "Hide Friendship Letter"]
6676 ,["Delete Post...", "Nuke Post..."]
6677 ,["Delete Video", "Nuke Video"]
6678 ,["Delete Event", "Nuke Adventure"] // for group admin
6679
6680 ,["Report/Block...", "Whine/Block..."]
6681 ,["Report/Mark as Spam", "Whine/Mark as Spam"]
6682 ,["Report Page", "Whine about Page"]
6683 ,["Report Story or Spam", "Whine about Story or Spam"]
6684 ,["Report/Mark as Spam...", "Whine/Mark as Spam..."]
6685 ,["Report story...", "Whine about story..."]
6686 ,["Report as Spam or Abuse...", "Whine as Spam or Abuse..."]
6687 ,["Report Spam or Abuse...", "Whine as Spam or Abuse..."]
6688 ,["Report as Spam...", "Whine as Spam..."]
6689 ,["Report Conversation...", "Whine about Conversation..."]
6690 ,["Report This Photo", "Whine About This Pony Pic"]
6691 ,["Report/Remove Tag", "Whine/Nuke Tag"]
6692 ,["Mark as Spam", "Whine as Spam"]
6693 ,["Report/Remove Tag...", "Whine/Nuke Tag..."]
6694 ,["Report Content", "Whine about Content"]
6695 ,["Report Profile", "Whine about Journal"]
6696 ,["Report User", "Whine about This Pony"]
6697 ,["Report", "Whine"]
6698 ,["Report Place", "Whine about Place"]
6699 ,["Report App", "Whine about Magic"]
6700 //,["Report list", "Whine about directory"]
6701 ,["Report list", "Whine about list"]
6702 ,["Event at a place", "Adventure at a place"]
6703 ,["Report as Abuse", "Whine as Abuse"]
6704 ,["Report to Admin", "Whine to Admin"]
6705
6706 ,["Hide this recent activity story from Timeline", "Hide this recent activity story from Journal"]
6707 ,["Hide Similar Activity from Timeline...", "Hide Similar Activity from Journal..."]
6708 //,["Hide All Recent Lists from Timeline...", "Hide All Recent Directories from Journal..."]
6709 ,["Hide All Recent Lists from Timeline...", "Hide All Recent Lists from Journal..."]
6710 ,["Hide all Friend Highlights from Timeline", "Hide all "+capitaliseFirstLetter(CURRENTSTACK.friend)+" Highlights from Journal"]
6711 ,["Hide This Action from Profile...", "Hide This Action from Journal..."]
6712 ,["Hide All Recent profile changes from Profile...", "Hide All Recent journal changes from Journal..."]
6713 ,["Hide All Recent Pages from Timeline...", "Hide All Recent Pages from Journal..."]
6714 ,["See Photos Hidden From Timeline", "See Pony Pics Hidden From Journal"]
6715 ,["Hide Similar Activity from Timeline", "Hide Similar Activity from Journal"]
6716
6717 ,["Upcoming Events", "Upcoming Adventures"]
6718 ,["Suggested Events", "Suggested Adventures"]
6719 ,["Past Events", "Past Adventures"]
6720 ,["Past events", "Past adventures"]
6721 ,["Declined Events", "Declined Adventures"]
6722 ,["Export Events...", "Export Adventures..."]
6723 ,["Add Event Photo", "Add Adventure Pony Pic"]
6724 ,["Cancel Event", "Cancel Adventure"]
6725 ,["Export Event", "Export Adventure"]
6726 ,["Share Event", "Share Adventure"]
6727 ,["Turn Off Notifications", "Turn Off Sparks"]
6728 ,["Turn On Notifications", "Turn On Sparks"]
6729 ,["Promote Event", "Promote Adventure"]
6730 ,["Create Repeat Event", "Create Repeat Adventure"]
6731 ,["Message Guests", "Start Whinny Chat with Guests"]
6732 ,["Edit Event", "Edit Adventure"]
6733 ,["Publish Event on Timeline", "Publish Adventure on Journal"]
6734 ,["Leave Event", "Leave Adventure"]
6735
6736 ,["Add Friends to Chat...", "Add "+capitaliseFirstLetter(CURRENTSTACK.friends)+" to Whinny Chat..."]
6737 ,["Chat Sounds", "Whinny Chat Sounds"]
6738 ,["Add People...", "Add "+capitaliseFirstLetter(CURRENTSTACK['people'])+"..."]
6739 ,["Unread Messages", "Unread Friendship Reports"]
6740 ,["Archived Messages", "Archived Friendship Reports"]
6741 ,["Sent Messages", "Sent Friendship Reports"]
6742 ,["Forward Messages...", "Forward Friendship Reports..."]
6743 ,["Turn Off Chat", "Turn Off Whinny Chat"]
6744 ,["Open in Chat", "Open in Whinny Chat"]
6745 ,["Create Group...", "Create Herd..."]
6746 ,["Turn On Chat", "Turn On Whinny Chat"]
6747
6748 ,["Add/Remove Friends...", "Add/Remove "+capitaliseFirstLetter(CURRENTSTACK.friends)+"..."]
6749 ,["Comments and Likes", "Friendship Letters and Brohoofs"]
6750 //,["Archive List", "Archive Directory"]
6751 //,["On This List", "On This Directory"]
6752 //,["Restore List", "Restore Directory"]
6753
6754 //,["Rename List", "Rename Directory"]
6755 //,["Edit List", "Edit Directory"]
6756 ,["Notification Settings...", "Spark Settings..."]
6757 //,["Delete List", "Nuke Directory"]
6758 ,["Delete List", "Nuke List"]
6759
6760 ,["Likes", capitaliseFirstLetter(CURRENTSTACK['likes'])]
6761 ,["Photos", "Pony Pics"]
6762 ,["Comments", "Friendship Letters"]
6763 ,["Questions", "Queries"]
6764 ,["Events", "Adventures"]
6765 ,["Groups", "Herds"]
6766 ,["Timeline", "Journal"]
6767 ,["Notes", "Scrolls"]
6768 ,["Posts and Apps", "Posts and Magic"]
6769 ,["Recent Likes", "Recent "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
6770 ,["Recent Comments", "Recent Friendship Letters"]
6771 ,["Timeline Review", "Journal Review"]
6772 ,["Pokes", "Nuzzles"]
6773 ,["Activity Log...", "Adventure Log..."]
6774 ,["Activity Log", "Adventure Log"]
6775 ,["Timeline Settings", "Journal Settings"]
6776 ,["Likers", "Brohoofers"] // @todo likers
6777 ,["Open Groups", "Open Herds"]
6778 ,["Cancel Friend Request", "Cancel Friendship Request"] // activity log
6779
6780 ,["Choose from Photos...", "Choose from Pony Pics..."]
6781 ,["Upload Photo...", "Upload Pony Pic..."]
6782 ,["Take Photo...", "Take Pony Pic..."]
6783 ,["Choose from my Photos", "Choose from my Pony Pics"]
6784 ,["Reposition Photo", "Reposition Pony Pic"]
6785 ,["Add Synced Photo...", "Add Synced Pony Pic..."]
6786 ,["Add Synced Photo", "Add Synced Pony Pic"]
6787 ,["Change Primary Photo...", "Change Primary Pony Pic..."]
6788 ,["Choose from Photo Albums...", "Choose from Pony Pic Albums..."]
6789 ,["Suggest this photo...", "Suggest this pony pic..."]
6790
6791 ,["Photo", "Pony Pic"]
6792 ,["Question", "Query"]
6793
6794 ,["Pages I like", "Pages I "+capitaliseFirstLetter(CURRENTSTACK.like)]
6795 ,["My Friends", "My "+capitaliseFirstLetter(CURRENTSTACK.friends)]
6796 ,["All Notifications", "All Sparks"]
6797 ,["Search All Friends", "Search All "+capitaliseFirstLetter(CURRENTSTACK.friends)]
6798 ,["All Apps", "All Magic"]
6799
6800 ,["Page Likes", "Page "+capitaliseFirstLetter(CURRENTSTACK.likes)]
6801 ,["Mentions and Photo Tags", "Mentions and Pony Pic Tags"]
6802
6803 ,["Suggest photos", "Suggest pony pics"]
6804
6805 ,["Make Profile Picture", "Make Journal Pony Pic"]
6806 ,["Make Profile Picture for Page", "Make Journal Pony Pic for Page"]
6807 ,["Make Cover Photo", "Make Cover Pony Pic"]
6808
6809 ,["The app sends you a notification", "The magic sends you a spark"]
6810
6811 ,["Top Comments", "Top Friendship Letters"] // comment resort
6812 ,["See All Groups", "See All Herds"] // timeline
6813 ,["Friends to Invite", capitaliseFirstLetter(CURRENTSTACK['friends'])+" to Invite"] // app invite
6814 ,["Take a survey to improve News Feed", "Take a survey to improve Feed Bag"] // news feed
6815
6816 // insights
6817 ,["Post Clicks / Likes, Comments & Shares", "Post Clicks / "+capitaliseFirstLetter(CURRENTSTACK['likes'])+", Comments & Shares"]
6818 ,["Likes / Comments / Shares", capitaliseFirstLetter(CURRENTSTACK['likes'])+" / Comments / Shares"]
6819 ,["Post Hides, Hides of All Posts, Reports of Spam, Unlikes of Page", "Post Hides, Hides of All Posts, Whining of Spam, Unbrohoofs of Page"] // @todo
6820 ,["Likes, Comments & Shares", capitaliseFirstLetter(CURRENTSTACK['likes'])+", Comments & Shares"]
6821 ];
6822
6823 menuPrivacyOnlyTitles = [
6824 ["Everyone", "Everypony"]
6825 ,["Public", "Everypony"]
6826 ,["Anyone", "Anypony"]
6827 ,["Friends of Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
6828 ,["Friends except Acquaintances", capitaliseFirstLetter(CURRENTSTACK['friends'])+" except Acquaintances"]
6829 ,["Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])]
6830 ,["Friends ", capitaliseFirstLetter(CURRENTSTACK['friends'])]
6831 ,["Friends of Guests", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of Guests"]
6832 ,["Friends of Contributors", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of Contributors"]
6833 ,["Only Me", "Alone"]
6834 ,["Only me", "Alone"]
6835 //,["See all lists...", "See entire directory..."]
6836 ];
6837
6838 dialogDerpTitles = [
6839 "Insufficient send permissions"
6840 ,"Update Failed"
6841 ,"Failed to upload photo."
6842 ,"Hide Photo Failed"
6843 ,"Undo Mark Spam Failed"
6844 ,"Your Request Couldn't be Processed"
6845 ,"Sorry! The blocking system is overloaded"
6846 ,"Invalid Request"
6847 ,"Block! You are engaging in behavior that may be considered annoying or abusive by other users."
6848 ,"Already connected."
6849 ,"Cannot connect."
6850 ,"Database Down"
6851 ,"Failure to hide minifeed story."
6852 ,"Object cannot be liked"
6853 ,"Sorry, something went wrong"
6854 ,"Authentication Failure"
6855 ,"Unknown error"
6856 ,"Not Logged In"
6857 ,"No Permission to Add Comment or Trying to Comment on Deleted Post"
6858 ,"Could not determine coordinates of place"
6859 ,"Sorry, your account is temporarily unavailable."
6860 ,"Don't Have Permission"
6861 ,"Oops"
6862 ,"No Languages Provided ForUpdate"
6863 ,"Comment Does Not Exist"
6864 ,"Sorry, we got confused"
6865 ,"Database Write Failed"
6866 ,"Editing Bookmarks Failed"
6867 ,"Required Field Missing"
6868 ,"Could Not Load Story"
6869 ,"Invalid Name"
6870 ,"Cannot connect to yourself."
6871 ,"This content is no longer available"
6872 ,"Error" // poking someone who hasn't poked back yet
6873 ,"Please Try Again Later"
6874 ,"Submitting Documentation Feedback Failed"
6875 ,"Bad Request"
6876 ,"Internal Error"
6877 ,"Mark as Spam Failed"
6878 ,"Could not post to Wall"
6879 ,"No permissions"
6880 ,"Messages Unavailable"
6881 ,"Don't have Permission"
6882 ,"No file specified."
6883 ,"Storage Failure"
6884 ,"Invalid Date"
6885 ,"Vote submission failed."
6886 ,"Web Address is Invalid"
6887 ,"Oops!"
6888 ,"Invalid Recipients"
6889 ,"Add Fan Status Failed"
6890 ,"Adding Member Failed"
6891 ,"Post Has Been Removed"
6892 ,"Unable to edit Group"
6893 ,"Invalid Photo Selected"
6894 ,"Cannot backdate photo"
6895 ,"Invalid Search Query"
6896 ,"Unable to Add Friend"
6897 ,"Cannot Add Member"
6898 ,"Bad Image"
6899 ,"Missing Field"
6900 ,"Invalid Custom Privacy Setting"
6901 ,"Empty Friend List"
6902 ,"Unable to Add Attachment"
6903 ,"Unable to Change Date"
6904 ,"Invalid Whining"
6905 ,"Your Page Can't Be Promoted"
6906 ,"Cannot Send Gift"
6907 ,"An error occurred."
6908 ,"Image Resource Invalid"
6909 ,"Confirmation Required"
6910 ];
6911
6912 headerInsightsTitles = [
6913 ["People Who Like Your Page (Demographics and Location)", capitaliseFirstLetter(CURRENTSTACK.people)+" Who "+capitaliseFirstLetter(CURRENTSTACK.like)+" Your Page (Demographics and Location)"]
6914 ,["Where Your Likes Came From", "Where Your "+capitaliseFirstLetter(CURRENTSTACK.likes)+" Came From"]
6915 ,["How You Reached People (Reach and Frequency)", "How You Reached "+capitaliseFirstLetter(CURRENTSTACK.people)+" (Reach and Frequency)"]
6916 ,["How People Are Talking About Your Page", "How "+capitaliseFirstLetter(CURRENTSTACK.people)+" Are Talking About Your Page"]
6917 ];
6918
6919 dialogDescriptionTitles = [
6920 ["Are you sure you want to delete this?", "Are you sure you want to nuke this?"]
6921 ,["Are you sure you want to delete this video?", "Are you sure you want to nuke this video?"]
6922 ,["Are you sure you want to delete this photo?", "Are you sure you want to nuke this pony pic?"]
6923 ,["Are you sure you want to delete this comment?", "Are you sure you want to nuke this friendship letter?"]
6924 ,["Are you sure you want to delete this event?", "Are you sure you want to nuke this adventure?"]
6925 ,["Are you sure you want to delete this post?", "Are you sure you want to nuke this post?"]
6926 ,["Are you sure you want to remove this picture?", "Are you sure you want to nuke this pony pic?"]
6927 ,["The post or object that you were commenting has been removed by its owner and can no longer be commented on.", "The post or object that you were commenting has been nuked by its owner and can no longer be commented on."]
6928 ,["Are you sure you want to remove this event?", "Are you sure you want to nuke this adventure?"]
6929 ,["Are you sure you want to unlike this?", "Are you sure you want to "+CURRENTSTACK['unlike']+" this?"]
6930 ,["Are you sure you want to remove this profile picture?", "Are you sure you want to nuke this journal pony pic?"]
6931
6932 ,["Report this if it's not relevant to your search results.", "Whine about this if it's not relevant to your search results."]
6933
6934 ,["Uploading a photo will remove the link preview. Do you want to continue?", "Uploading a pony pic will remove the link preview. Do you want to continue?"]
6935 ,["This post has been reported to the group admin.", "This post has been whined to the group admin."]
6936 ];
6937 }
6938
6939 var DOMNodeInserted = function(dom) {
6940 domNodeHandlerMain.run(dom);
6941 };
6942
6943 var domNodeHandler = function() {
6944 var k = this;
6945 k.snowliftPinkieInjected = false;
6946
6947 k.run = function(dom) {
6948 if (INTERNALUPDATE) {
6949 return;
6950 }
6951
6952 if (k.shouldIgnore(dom)) {
6953 return;
6954 }
6955
6956 k.dumpConsole(dom);
6957
6958 // Start internal update
6959 var iu = INTERNALUPDATE;
6960 INTERNALUPDATE = true;
6961
6962 // Buttons
6963 if (dom.target.parentNode && dom.target.parentNode.parentNode) {
6964 var stop = true;
6965 var replacer = buttonTitles;
6966 if (hasClass(dom.target.parentNode, 'uiButtonText')) {
6967 var buttonText = dom.target.parentNode;
6968 var button = dom.target.parentNode.parentNode;
6969 stop = false;
6970
6971 if (button.parentNode && button.parentNode.parentNode && hasClass(button.parentNode.parentNode, 'audienceSelector')) {
6972 replacer = menuPrivacyOnlyTitles;
6973 }
6974 } else if (hasClass(dom.target.parentNode, '_42ft') || hasClass(dom.target.parentNode, '-cx-PRIVATE-abstractButton__root')) {
6975 // dropdown on close friends list dialog
6976 // <a class="-cx-PRIVATE-abstractButton__root -cx-PRIVATE-uiButton__root -cx-PRIVATE-uiPopoverButton__root autofocus -cx-PRIVATE-uiPopover__trigger" role="button" href="#" style="max-width: 200px;" aria-haspopup="true" aria-expanded="true" rel="toggle" id="u_i_b" aria-owns="u_i_9">On This List<i class="mls img sp_8noqk7 sx_706bf4"></i></a>
6977 var buttonText = dom.target;
6978 var button = dom.target.parentNode;
6979 stop = false;
6980 } else if (hasClass(dom.target.parentNode.parentNode, '_42ft') || hasClass(dom.target.parentNode.parentNode, '-cx-PRIVATE-abstractButton__root')) {
6981 // hasClass(buttonText, '_55pe') || hasClass(buttonText, '-cx-PUBLIC-abstractPopoverButton__label')
6982 // "share to" dropdown on sharer dialog
6983 // comment resort on entstream
6984 var buttonText = dom.target;
6985 var button = dom.target.parentNode.parentNode;
6986 stop = false;
6987 }
6988
6989 if (!stop) {
6990 if (buttonText.nodeType == 3) {
6991 var orig = buttonText.textContent;
6992 } else {
6993 var orig = buttonText.innerHTML;
6994 }
6995 var replaced = replaceText(replacer, orig);
6996 if (hasClass(button, 'uiButton') || hasClass(button, '_42ft') || hasClass(button, '-cx-PRIVATE-abstractButton__root')) {
6997 // button text that didn't get ponified needs to be considered, e.g. share dialog's "On your Page"
6998 if (button.getAttribute('data-hover') != 'tooltip') {
6999 if (orig != replaced) {
7000 // ponified text
7001 if (button.title == '') {
7002 // tooltip is blank, so it would be OK to set our own
7003 button.title = orig;
7004 } else {
7005 // tooltip is NOT blank, this means (1) FB added their own tooltip or (2) we already added our own tooltip
7006 if (button.title == button.getAttribute('data-ponyhoof-button-orig')) {
7007 button.title = orig;
7008 }
7009 }
7010 } else {
7011 button.title = '';
7012 }
7013 }
7014 button.setAttribute('data-ponyhoof-button-orig', orig);
7015 button.setAttribute('data-ponyhoof-button-text', replaced);
7016 }
7017 if (orig != replaced) {
7018 if (buttonText.nodeType == 3) {
7019 buttonText.textContent = replaced;
7020 } else {
7021 buttonText.innerHTML = replaced;
7022 }
7023 }
7024 }
7025 }
7026
7027 // Text nodes
7028 if (dom.target.nodeType == 3) {
7029 //k.textNodes(dom);
7030 // firefox in mutationObserver goes to here when it should be characterData
7031 k.mutateCharacterData(dom);
7032 INTERNALUPDATE = iu;
7033 return;
7034 }
7035
7036 injectOptionsLink();
7037
7038 k.snowliftPinkie(dom);
7039 k.notificationsFlyoutSettings(dom);
7040
7041 // .ufb-button-input => mutateAttributes
7042 domReplaceFunc(dom.target, '', '.uiButtonText, .uiButton input, ._42ft, .-cx-PRIVATE-abstractButton__root, ._42fu, .-cx-PRIVATE-uiButton__root, ._4jy0, .-cx-PRIVATE-xuiButton__root', function(ele) {
7043 // <a class="uiButton uiButtonConfirm uiButtonLarge" href="#" role="button"><span class="uiButtonText">Finish</span></a>
7044 // <label class="uiButton uiButtonConfirm"><input value="Okay" type="submit"></label>
7045
7046 // <button class="_42ft _42fu _11b selected _42g-" type="submit">Post</button>
7047 // <a class="_42ft _42fu" role="button" href="#"><i class="mrs img sp_8jfoef sx_d2d7c4"></i>Promote App</a>
7048 var button = ele;
7049 var replacer = buttonTitles;
7050 var tagName = ele.tagName.toUpperCase();
7051 if (tagName != 'A' && tagName != 'LABEL' && tagName != 'BUTTON') {
7052 button = ele.parentNode;
7053
7054 // new message
7055 var potentialLabel = button.querySelector('._6q-, .-cx-PUBLIC-mercuryComposer__button');
7056 if (potentialLabel) {
7057 ele = potentialLabel;
7058 }
7059 } else {
7060 var potentialLabel = button.querySelector('._55pe, .-cx-PUBLIC-abstractPopoverButton__label');
7061 if (potentialLabel) {
7062 ele = potentialLabel;
7063 } else {
7064 // Get More Likes button on page admin panel
7065 // <button value="1" class="_42ft _42fu selected _42g- _42gy" id="fanAcquisitionPanelPreviewBodyConfirmButton" type="submit"><span id="u_x_a">Get More Likes</span></button>
7066 }
7067 // Get More Likes (above)
7068 // comment resort on entstream
7069 if (ele.childNodes && ele.childNodes.length == 1 && ele.childNodes[0].tagName && ele.childNodes[0].tagName.toUpperCase() == 'SPAN') {
7070 ele = ele.childNodes[0];
7071 }
7072 }
7073 if (button &&
7074 (button.getAttribute('data-ponyhoof-button-orig') == null || (hasClass(button, '_for') || hasClass(button, '-cx-PRIVATE-fbVaultBadgedButton__button'))) && // vault buttons are crapped
7075 (hasClass(button, 'uiButton') || hasClass(button, '_42ft') || hasClass(button, '-cx-PRIVATE-abstractButton__root') /*|| hasClass(button, '_42fu') || hasClass(button, '-cx-PRIVATE-uiButton__root') || hasClass(button, '_4jy0') || hasClass(button, '-cx-PRIVATE-xuiButton__root')*/)
7076 ) {
7077 if (button.parentNode && button.parentNode.parentNode && hasClass(button.parentNode.parentNode, 'audienceSelector')) {
7078 replacer = menuPrivacyOnlyTitles;
7079 }
7080
7081 if (tagName == 'INPUT') {
7082 var orig = ele.value;
7083 button.setAttribute('data-ponyhoof-button-orig', orig);
7084 var replaced = replaceText(replacer, orig);
7085
7086 k.changeButtonText(ele, replaced);
7087 } else {
7088 var orig = '';
7089 var replaced = '';
7090 loopChildText(ele, function(child) {
7091 if (child.nodeType == 3) {
7092 orig += child.textContent;
7093 replaced += replaceText(replacer, child.textContent);
7094 if (child.textContent != replaced) {
7095 child.textContent = replaced;
7096 }
7097 }
7098 });
7099 button.setAttribute('data-ponyhoof-button-orig', orig);
7100 }
7101
7102 if (orig != replaced) {
7103 if (button.getAttribute('data-hover') != 'tooltip') {
7104 if (button.title == '') {
7105 button.title = orig;
7106 }
7107 }
7108 }
7109 button.setAttribute('data-ponyhoof-button-text', replaced);
7110
7111 // Top-right "Join Group" and "Notifications" link on groups requires some treatment to avoid long group names from being crapped
7112 var ajaxify = button.getAttribute('ajaxify');
7113 if ((ajaxify && ajaxify.indexOf('/ajax/groups/membership/r2j.php?ref=group_jump_header') == 0) || (button.parentNode && button.parentNode.parentNode && hasClass(button.parentNode.parentNode, 'groupNotificationsSelector'))) {
7114 var groupsJumpTitle = $('groupsJumpTitle');
7115 if (!groupsJumpTitle) {
7116 return;
7117 }
7118
7119 var groupsJumpBarTop = dom.target.getElementsByClassName('groupsJumpBarTop');
7120 if (!groupsJumpBarTop.length) {
7121 return;
7122 }
7123 groupsJumpBarTop = groupsJumpBarTop[0];
7124
7125 var rfloat = groupsJumpBarTop.getElementsByClassName('rfloat');
7126 if (!rfloat.length) {
7127 return;
7128 }
7129 rfloat = rfloat[0];
7130
7131 var groupsCleanLinks = groupsJumpBarTop.getElementsByClassName('groupsCleanLinks');
7132 if (!groupsCleanLinks.length) {
7133 return;
7134 }
7135 groupsCleanLinks = groupsCleanLinks[0];
7136
7137 groupsJumpTitle.style.maxWidth = (800 - ((groupsCleanLinks.offsetWidth || 0) + (rfloat.offsetWidth || 0) - (groupsJumpTitle.offsetWidth || 0)) - 10) + 'px';
7138 }
7139 }
7140
7141 });
7142
7143 k.ufiPagerLink(dom);
7144
7145 if (k.reactRoot(dom)) {
7146 INTERNALUPDATE = iu;
7147 return;
7148 }
7149
7150 k.postLike(dom);
7151
7152 if (k.ticker(dom)) {
7153 INTERNALUPDATE = iu;
7154 return;
7155 }
7156
7157 if (k.pagesVoiceBarText(dom.target)) {
7158 INTERNALUPDATE = iu;
7159 return;
7160 }
7161
7162 domReplaceFunc(dom.target, '', '.inCommonSectionList, #fbTimelineHeadline .name h2 > div, ._8yb, .-cx-PRIVATE-fbEntstreamAttachmentAvatar__secondarydetaillist, ._508a, .-cx-PRIVATE-pageLikeStory__fancountfooter, .permalinkHeaderInfo > .subscribeOrLikeSentence > .fwn, ._5j2m', k.textBrohoof);
7163
7164 domReplaceFunc(dom.target, '', '.uiUfiViewAll, .uiUfiViewPrevious, .uiUfiViewMore', function(ele) {
7165 var button = ele.querySelector('input[type="submit"]');
7166 var t = button.value;
7167 t = t.replace(/comments/g, "friendship letters");
7168 t = t.replace(/comment/g, "friendship letter");
7169 if (button.value != t) {
7170 button.value = t;
7171 }
7172 });
7173
7174 k.tooltip(dom.target);
7175
7176 domReplaceFunc(dom.target, 'egoProfileTemplate', '.egoProfileTemplate', function(ele) {
7177 if (ele.getAttribute('data-ponyhoof-ponified')) {
7178 return;
7179 }
7180 var div = ele.getElementsByTagName('div');
7181 if (div.length) {
7182 for (var i = 0, len = div.length; i < len; i += 1) {
7183 var t = div[i].innerHTML;
7184 t = k.textStandard(t);
7185 if (div[i].innerHTML != t) {
7186 div[i].innerHTML = t;
7187 }
7188 }
7189 }
7190
7191 var action = ele.getElementsByClassName('uiIconText');
7192 if (action.length) {
7193 action = action[0];
7194 ele.setAttribute('data-ponyhoof-iconText', action.textContent);
7195
7196 var t = action.innerHTML;
7197 t = t.replace(/Like/g, capitaliseFirstLetter(CURRENTSTACK.like));
7198 t = t.replace(/Join Group/g, "Join the Herd");
7199 t = t.replace(/Add Friend/g, "Add "+capitaliseFirstLetter(CURRENTSTACK.friend));
7200 t = t.replace(/\bConfirm Friend\b/g, "Confirm Friendship");
7201 action.innerHTML = t;
7202 }
7203
7204 ele.setAttribute('data-ponyhoof-ponified', 1);
7205 });
7206
7207 domReplaceFunc(dom.target, 'uiInterstitial', '.uiInterstitial', function(ele) {
7208 if (ele.getAttribute('data-ponyhoof-ponified')) {
7209 return;
7210 }
7211 ele.setAttribute('data-ponyhoof-ponified', 1);
7212
7213 var title = ele.getElementsByClassName('uiHeaderTitle');
7214 if (title.length) {
7215 title = title[0];
7216 } else {
7217 title = ele.querySelector('.fsxl.fwb');
7218 if (!title) {
7219 return;
7220 }
7221 }
7222 ele.setAttribute('data-ponyhoof-inters-title', title.textContent);
7223 });
7224
7225 domReplaceFunc(dom.target, 'uiLayer', '.uiLayer', function(ele) {
7226 if (ele.getAttribute('data-ponyhoof-dialog-title')) {
7227 return;
7228 }
7229
7230 var titlebar = ele.querySelector('.-cx-PUBLIC-uiDialog__title, ._t ._1yw, ._4-i0, .-cx-PRIVATE-xuiDialog__title, .overlayTitle, .fbCalendarOverlayHeader');
7231 if (titlebar) {
7232 var titletext = ele.querySelector('._52c9, .-cx-PRIVATE-xuiDialog__titletext');
7233 if (!titletext) {
7234 titletext = titlebar;
7235 }
7236
7237 var orig = '';
7238 var replaced = '';
7239 loopChildText(titletext, function(child) {
7240 if (child.nodeType == 3) {
7241 orig += child.textContent;
7242 replaced += replaceText(dialogTitles, child.textContent);
7243 if (child.textContent != replaced) {
7244 child.textContent = replaced;
7245 }
7246 }
7247 });
7248 addClass(titlebar, 'ponyhoof_fbdialog_title');
7249 if (orig != replaced) {
7250 titlebar.title = orig;
7251 }
7252
7253 addClass(ele, 'ponyhoof_fbdialog');
7254 ele.setAttribute('data-ponyhoof-dialog-title', replaced);
7255 ele.setAttribute('data-ponyhoof-dialog-orig', orig);
7256
7257 var body = ele.querySelector('._t ._13, .-cx-PRIVATE-uiDialog__body, ._4-i2, .-cx-PRIVATE-xuiDialog__body, .uiLayerPageContent > .pvm');
7258 if (body) {
7259 addClass(body, 'ponyhoof_fbdialog_body');
7260
7261 var stop = false;
7262 loopChildText(body, function(child) {
7263 if (stop) {
7264 return;
7265 }
7266 if (child.nodeType == TEXT_NODE) {
7267 var replaced = replaceText(dialogDescriptionTitles, child.textContent);
7268 if (child.textContent != replaced) {
7269 child.textContent = replaced;
7270 stop = true;
7271 }
7272 }
7273 });
7274
7275 k._dialog_insertReadme(body);
7276 }
7277
7278 if (hasClass(dom.target, 'uiLayer')) {
7279 // dom.target is intentional
7280 // Detect rare cases when HTML detection just got turned on, and there is a dialog at the back
7281 k._dialog_playSound(replaced, ele);
7282 }
7283 }
7284
7285 domChangeTextbox(ele, '.groupsMemberFlyoutWelcomeTextarea', function(textbox) {
7286 var orig = textbox.getAttribute('placeholder');
7287 var t = orig.replace(/\bgroup\b/, 'herd');
7288 if (t != orig) {
7289 return t;
7290 }
7291 return "Welcome him/her to the herd...";
7292 });
7293 domChangeTextbox(ele, '.fbEventMemberComment', function(textbox) {
7294 var orig = textbox.getAttribute('placeholder');
7295 var t = orig.replace(/\bevent\b/, 'adventure');
7296 if (t != orig) {
7297 return t;
7298 }
7299 return orig; // for pages "Write something to let her know you're going too."
7300 });
7301
7302 // Hovercard
7303 $$(ele, '._7lo > .fcg, .-cx-PRIVATE-hovercard__footer > .fcg', function(footer) {
7304 loopChildText(footer, k.textBrohoof);
7305 });
7306 });
7307
7308 domReplaceFunc(dom.target, '', 'a[href^="/ajax/sharer/"][rel="dialog"], a[ajaxify^="/ajax/sharer/"], a[href^="/ajax/sharer?"][rel="dialog"], a[href^="/ajax/photos/album/share_dialog.php"], a[ajaxify^="/ajax/video/actions/share/dialog/"]', function(ele) {
7309 if (CURRENTSTACK.stack == 'pony') {
7310 ele.setAttribute('data-hover', 'tooltip');
7311 ele.setAttribute('aria-label', CURRENTLANG.fb_share_tooltip);
7312 ele.setAttribute('title', '');
7313 }
7314 });
7315
7316 domReplaceFunc(dom.target, '', '.uiHeaderTitle, .legacyContextualDialogTitle, ._6dp, .-cx-PRIVATE-litestandRHC__titlename', function(ele) {
7317 var imgwrap = ele.querySelector('._8m, .-cx-PRIVATE-uiImageBlock__content, .adsCategoryTitleLink');
7318 if (imgwrap) {
7319 ele = imgwrap;
7320 };
7321
7322 loopChildText(ele, function(child) {
7323 if (!child.children || !child.children.length) {
7324 var t = replaceText(headerTitles, child.textContent);
7325 if (child.textContent != t) {
7326 child.textContent = t;
7327 }
7328 }
7329 });
7330 });
7331
7332 domReplaceFunc(dom.target, '', '.insights-header .header-title > .ufb-text-content', function(ele) {
7333 var t = replaceText(headerInsightsTitles, ele.textContent);
7334 if (ele.textContent != t) {
7335 ele.textContent = t;
7336 }
7337 });
7338
7339 if (k.fbDockChatBuddylistNub(dom.target)) {
7340 INTERNALUPDATE = iu;
7341 return;
7342 }
7343
7344 if (k.pokesDashboard(dom.target)) {
7345 INTERNALUPDATE = iu;
7346 return;
7347 }
7348
7349 k.commentBrohoofed(dom);
7350
7351 k.changeCommentBox(dom);
7352 k.changeComposer(dom);
7353
7354 k.notification(dom);
7355 k.menuItems(dom);
7356 k.fbRemindersStory(dom.target);
7357 if (k.flyoutLikeForm(dom.target)) {
7358 INTERNALUPDATE = iu;
7359 return;
7360 }
7361 k.pluginButton(dom.target);
7362 k.insightsCountry(dom);
7363 k.timelineMutualLikes(dom.target);
7364 k.videoStageContainer(dom.target);
7365 k.uiStreamShareLikePageBox(dom.target);
7366 k.fbTimelineUnit(dom.target);
7367
7368 domChangeTextbox(dom.target, '.MessagingComposerForm textarea, ._1rt ._1rv, .-cx-PRIVATE-webMessengerComposer__composertextarea, ._20y textarea, .-cx-PRIVATE-mercuryComposerDialog__root textarea, ._2oj, .-cx-PRIVATE-mercuryComposerDialog__textarea', "Dear Princess Celestia...");
7369 domChangeTextbox(dom.target, '.groupAddMemberTypeaheadBox .inputtext', "Add "+capitaliseFirstLetter(CURRENTSTACK.friends)+" to the Herd");
7370 //domChangeTextbox(dom.target, '.friendListAddTypeahead .inputtext', "Add "+CURRENTSTACK.friends+" to this directory");
7371 domChangeTextbox(dom.target, '.friendListAddTypeahead .inputtext', "Add "+CURRENTSTACK.friends+" to this list");
7372 domChangeTextbox(dom.target, '.groupsJumpHeaderSearch .inputtext', "Search this herd");
7373 domChangeTextbox(dom.target, '.MessagingSearchFilter .inputtext', "Search Friendship Reports");
7374 domChangeTextbox(dom.target, '#chatFriendsOnline .fbChatTypeahead .inputtext', "Pals on Whinny Chat");
7375
7376 //domChangeTextbox(dom.target, '.uiComposer textarea', "What lessons in friendship have you learned today?");
7377 //domChangeTextbox(dom.target, '.uiComposerMessageBox textarea', "Share your friendship stories...");
7378 //domChangeTextbox(dom.target, '.uiMetaComposerMessageBox textarea', "What lessons in friendship have you learned today?");
7379 domChangeTextbox(dom.target, '#q, ._585- ._586f, .-cx-PUBLIC-fbFacebar__root .-cx-PUBLIC-uiStructuredInput__text', function(searchbox) {
7380 if (CURRENTLANG.sniff_fb_search_boxAlt && searchbox.getAttribute('placeholder').indexOf(CURRENTLANG.sniff_fb_search_boxAlt) != -1) {
7381 return CURRENTLANG.fb_search_boxAlt;
7382 }
7383 return CURRENTLANG.fb_search_box;
7384 });
7385
7386 k.ponyhoofPageOptions(dom);
7387 if (userSettings.debug_betaFacebookLinks && w.location.hostname == 'beta.facebook.com') {
7388 k.debug_betaFacebookLinks(dom.target);
7389 }
7390
7391 INTERNALUPDATE = iu;
7392 };
7393
7394 k.photos_snowlift = null;
7395 k.snowliftPinkie = function(dom) {
7396 if (!k.snowliftPinkieInjected) {
7397 var id = dom.target.getAttribute('id');
7398 if ((id && id == 'photos_snowlift') || hasClass(dom.target, 'fbPhotoSnowlift')) {
7399 k.snowliftPinkieInjected = true;
7400 k.photos_snowlift = dom.target;
7401
7402 addClass(k.photos_snowlift, 'ponyhoof_snowlift_haspinkiediv');
7403 var n = d.createElement('div');
7404 n.id = 'ponyhoof_snowlift_pinkie';
7405 k.photos_snowlift.appendChild(n);
7406 }
7407 }
7408 };
7409
7410 k.notificationsFlyoutSettingsInjected = false;
7411 k.notificationsFlyoutSettings = function(dom) {
7412 if (ISUSINGPAGE) {
7413 k.notificationsFlyoutSettingsInjected = true;
7414 return;
7415 }
7416 if (!k.notificationsFlyoutSettingsInjected) {
7417 var jewel = $('fbNotificationsJewel');
7418 if (jewel) {
7419 var header = jewel.getElementsByClassName('uiHeaderTop');
7420 if (!header.length || !header[0].childNodes || !header[0].childNodes.length) {
7421 return;
7422 }
7423 header = header[0];
7424
7425 var settingsLink = d.createElement('a');
7426 settingsLink.href = '#';
7427 settingsLink.textContent = 'Ponyhoof Sounds';
7428
7429 var actions = jewel.getElementsByClassName('uiHeaderActions');
7430 if (actions.length) {
7431 actions = actions[0];
7432 var span = d.createElement('span');
7433 span.innerHTML = ' &middot; ';
7434
7435 actions.appendChild(span);
7436 actions.appendChild(settingsLink);
7437 } else {
7438 var rfloat = d.createElement('div');
7439 rfloat.className = 'rfloat';
7440 rfloat.appendChild(settingsLink);
7441 header.insertBefore(rfloat, header.childNodes[0]);
7442 }
7443
7444 settingsLink.addEventListener('click', function(e) {
7445 e.preventDefault();
7446
7447 if (!optionsGlobal) {
7448 optionsGlobal = new Options();
7449 }
7450 optionsGlobal.create();
7451 optionsGlobal.switchTab('sounds');
7452 optionsGlobal.show();
7453
7454 try {
7455 clickLink(jewel.getElementsByClassName('jewelButton')[0]);
7456 } catch (e) {}
7457 }, false);
7458
7459 k.notificationsFlyoutSettingsInjected = true;
7460 }
7461 }
7462 };
7463
7464 k.textNodes = function(dom) {
7465 try {
7466 if (!dom.target.parentNode || !dom.target.parentNode.parentNode || !hasClass(dom.target.parentNode.parentNode, 'dialog_title')) {
7467 return false;
7468 }
7469
7470 var title = dom.target.parentNode.parentNode;
7471 var orig = dom.target.textContent;
7472 var replaced = replaceText(dialogTitles, orig);
7473
7474 if (dom.target.textContent != replaced) {
7475 dom.target.textContent = replaced;
7476 }
7477 addClass(title, 'ponyhoof_fbdialog_title');
7478 if (orig != replaced) {
7479 title.title = orig;
7480 }
7481
7482 k.getParent(title, function(ele) {
7483 return hasClass(ele, 'generic_dialog');
7484 }, function(ele) {
7485 if (hasClass(ele, 'fbQuestionsPopup')) {
7486 return;
7487 }
7488
7489 addClass(ele, 'ponyhoof_fbdialog');
7490 ele.setAttribute('data-ponyhoof-dialog-title', replaced);
7491 ele.setAttribute('data-ponyhoof-dialog-orig', orig);
7492
7493 var body = ele.getElementsByClassName('dialog_body');
7494 if (body.length) {
7495 body = body[0];
7496 addClass(body, 'ponyhoof_fbdialog_body');
7497
7498 var confirmation_message = body.getElementsByClassName('confirmation_message');
7499 if (confirmation_message.length) {
7500 confirmation_message = confirmation_message[0];
7501
7502 var stop = false;
7503 loopChildText(confirmation_message, function(child) {
7504 if (stop) {
7505 return;
7506 }
7507 if (child.nodeType == TEXT_NODE) {
7508 var replaced = replaceText(dialogDescriptionTitles, child.textContent);
7509 if (child.textContent != replaced) {
7510 child.textContent = replaced;
7511 stop = true;
7512 }
7513 }
7514 });
7515 } else {
7516 var video_dialog_text = body.getElementsByClassName('video_dialog_text');
7517 if (video_dialog_text.length) {
7518 video_dialog_text = video_dialog_text[0];
7519 if (video_dialog_text.childNodes.length == 3) {
7520 var i = 0;
7521 var texts = ["Nuking a video is permanent.", "Once you nuke a video, you will not be able to get it back.", "Are you sure you want to nuke this video?"];
7522 loopChildText(video_dialog_text, function(child) {
7523 if (!texts[i]) {
7524 return;
7525 }
7526 child.textContent = texts[i];
7527 i += 1;
7528 });
7529 }
7530 }
7531 }
7532 }
7533
7534 k._dialog_playSound(replaced, ele);
7535 });
7536
7537 return true;
7538 } catch (e) {}
7539
7540 return false;
7541 };
7542
7543 k.ufiPagerLink = function(dom) {
7544 domReplaceFunc(dom.target, '', '.UFIPagerLink', function(ele) {
7545 var t = ele.innerHTML;
7546 t = t.replace(/ comments/, " friendship letters");
7547 t = t.replace(/ comment/, " friendship letter");
7548 if (ele.innerHTML != t) {
7549 ele.innerHTML = t;
7550 }
7551 });
7552 };
7553
7554 k.postLike = function(dom) {
7555 if (hasClass(dom.target, 'uiUfiLike') || hasClass(dom.target, 'UFILikeSentence')) {
7556 k._likePostBox(dom.target);
7557 } else {
7558 /*if (dom.target.parentNode) {
7559 if (hasClass(dom.target.parentNode, 'UFILikeSentence')) {
7560 k._likePostBox(dom.target);
7561 return;
7562 }
7563 }*/
7564 domReplaceFunc(dom.target, '', '.uiUfiLike, .UFILikeSentence', k._likePostBox);
7565 }
7566 };
7567
7568 k._likePostBox = function(ele) {
7569 //var inner = ele.querySelector('._42ef, .-cx-PRIVATE-uiFlexibleBlock__flexiblecontent, .lfloat > span, .-cx-PRIVATE-uiImageBlockDeprecated__content, .-cx-PRIVATE-uiImageBlock__content, ._8m, .-cx-PRIVATE-uiFlexibleBlock__flexibleContent');
7570 //if (inner) {
7571
7572 var inner = ele.getElementsByClassName('UFILikeSentenceText');
7573 if (inner.length) {
7574 inner = inner[0];
7575 var t = k.likeSentence(inner.innerHTML);
7576 if (inner.innerHTML != t) {
7577 inner.innerHTML = t;
7578 }
7579 }
7580
7581 var reorder = ele.getElementsByClassName('UFIOrderingModeSelectorDownCaret');
7582 if (reorder.length) {
7583 reorder = reorder[0];
7584 if (reorder.previousSibling) {
7585 k.UFIOrderingMode(reorder.previousSibling);
7586 }
7587 }
7588 };
7589
7590 k.likeSentence = function(t) {
7591 //t = t.replace(/likes? this\./g, "brohoof'd this.");
7592 t = t.replace(/like this\./g, CURRENTSTACK['like_past']+" this.");
7593 t = t.replace(/likes this\./g, CURRENTSTACK['likes_past']+" this.");
7594 t = t.replace(/\bpeople\b/g, CURRENTSTACK['people']);
7595 t = t.replace(/\bperson\b/g, CURRENTSTACK['person']); // http://fb.com/647294431950845
7596 //t = t.replace(/(^|\\W|_)people(^|\\W|_)/g, "ponies");
7597 /*if (CURRENTSTACK == 'pony') {
7598 t = t.replace(/\<3 7h\!5/g, '/) 7h!5');
7599 t = t.replace(/\<3 7h15/g, '/) 7h!5');
7600 }*/
7601
7602 return t;
7603 };
7604
7605 k._likeCount = function(ufiitem) {
7606 var likecount = ufiitem.getElementsByClassName('comment_like_button');
7607 if (likecount.length) {
7608 likecount = likecount[0];
7609 var t = likecount.innerHTML;
7610 //t = t.replace(/likes? this\./g, "brohoof'd this.");
7611 t = t.replace(/like this/g, CURRENTSTACK['like_past']+" this");
7612 t = t.replace(/likes this/g, CURRENTSTACK['likes_past']+" this");
7613 if (likecount.innerHTML != t) {
7614 likecount.innerHTML = t;
7615 }
7616 }
7617 };
7618
7619 k.UFIOrderingMode = function(ele) {
7620 var t = ele.textContent;
7621 t = t.replace(/Top Comments/, "Top Friendship Letters");
7622 if (ele.textContent != t) {
7623 ele.textContent = t;
7624 }
7625 };
7626
7627 k._likeDesc = '';
7628 k._unlikeDesc = '';
7629 k._likeConditions = '';
7630 k._likeIsLikeConditions = '';
7631 k.FB_TN_LIKELINK = '>';
7632 k.FB_TN_UNLIKELINK = '?';
7633 k.commentBrohoofed = function(dom) {
7634 var targets = '.UFICommentActions a, .UFILikeLink';
7635 if (!USINGMUTATION) {
7636 targets += ', .UFILikeThumb';
7637 }
7638 domReplaceFunc(dom.target, '', targets, k._commentLikeLink);
7639 };
7640
7641 k.commentLikeDescInit = function() {
7642 if (k._likeDesc == '') {
7643 var locale = getDefaultUiLang();
7644 if (LANG[locale] && LANG[locale].sniff_comment_tooltip_like) {
7645 k._likeDesc = LANG[locale].sniff_comment_tooltip_like;
7646 } else {
7647 k._likeDesc = LANG['en_US'].sniff_comment_tooltip_like;
7648 }
7649 if (LANG[locale] && LANG[locale].sniff_comment_tooltip_unlike) {
7650 k._unlikeDesc = LANG[locale].sniff_comment_tooltip_unlike;
7651 } else {
7652 k._unlikeDesc = LANG['en_US'].sniff_comment_tooltip_unlike;
7653 }
7654
7655 k._likeConditions = [
7656 k._likeDesc, k._unlikeDesc,
7657 capitaliseFirstLetter(CURRENTSTACK.like)+" this friendship letter", capitaliseFirstLetter(CURRENTSTACK.unlike)+" this friendship letter"
7658 ];
7659 k._likeIsLikeConditions = [
7660 k._likeDesc,
7661 capitaliseFirstLetter(CURRENTSTACK.like)+" this friendship letter"
7662 ];
7663 }
7664 };
7665
7666 k._commentLikeLink = function(ele) {
7667 k.commentLikeDescInit();
7668
7669 var pass = false;
7670 var likeThumb = false;
7671 if (k._likeConditions.indexOf(ele.title) == -1) {
7672 // extreme sniffing
7673 var trackingNode = k.getTrackingNode(ele);
7674 if (trackingNode == k.FB_TN_LIKELINK || trackingNode == k.FB_TN_UNLIKELINK) {
7675 pass = true;
7676 } else if (!USINGMUTATION && hasClass(ele, 'UFILikeThumb')) {
7677 likeThumb = true;
7678 pass = true;
7679 }
7680 } else {
7681 pass = true;
7682 }
7683 if (!pass) {
7684 return;
7685 }
7686
7687 if (!hasClass(ele, 'ponyhoof_brohoof_button')) {
7688 if (!USINGMUTATION) {
7689 ele.addEventListener('click', function() {
7690 var ele = this;
7691 k.delayIU(function() {
7692 if (likeThumb) {
7693 // UFILikeThumb disappears after a post is brohoof'd
7694 k._likeBrohoofMagic(ele, false);
7695 } else {
7696 k._commentLikeLink(ele);
7697 }
7698 });
7699 }, false);
7700 }
7701 addClass(ele, 'ponyhoof_brohoof_button');
7702 }
7703
7704 var isLike = false;
7705 if (k.getTrackingNode(ele) == k.FB_TN_LIKELINK || likeThumb || k._likeIsLikeConditions.indexOf(ele.title) != -1) {
7706 isLike = true;
7707 }
7708
7709 k._likeBrohoofMagic(ele, isLike);
7710 };
7711
7712 k._likeBrohoofMagic = function(ele, isLike) {
7713 var comment = k.getReactComment(ele);
7714 var title = '';
7715 if (isLike) {
7716 removeClass(ele, 'ponyhoof_brohoof_button_unbrohoof');
7717 title = capitaliseFirstLetter(CURRENTSTACK.like)+" this";
7718 } else {
7719 addClass(ele, 'ponyhoof_brohoof_button_unbrohoof');
7720 title = capitaliseFirstLetter(CURRENTSTACK.unlike)+" this";
7721 }
7722 if (comment) {
7723 title += " friendship letter";
7724 }
7725 ele.setAttribute('data-ponyhoof-title', ele.title);
7726 ele.title = title;
7727 ele.setAttribute('data-ponyhoof-title-modified', title);
7728
7729 if (comment) {
7730 k._markCommentLiked(comment, isLike);
7731
7732 // Fix an edge case with jump to comment
7733 if (hasClass(comment, 'highlightComment')) {
7734 w.setTimeout(function() {
7735 k._markCommentLiked(comment, isLike);
7736 }, 1);
7737 }
7738 } else {
7739 k.delayIU(function() {
7740 if (!ele.parentNode) {
7741 var ufi = k.getReactUfi(ele);
7742 if (!ufi) {
7743 return;
7744 }
7745 ele = ufi;
7746 }
7747
7748 k.getParent(ele, function(form) {
7749 return (form.tagName.toUpperCase() == 'FORM' && hasClass(form, 'commentable_item'));
7750 }, function(form) {
7751 if (!form) {
7752 return;
7753 }
7754 var ufi = form.getElementsByClassName('UFIList');
7755 if (!ufi.length) {
7756 return;
7757 }
7758 ufi = ufi[0];
7759 if (!ufi.parentNode) {
7760 return;
7761 }
7762
7763 if (isLike) {
7764 removeClass(ufi.parentNode, 'ponyhoof_brohoofed');
7765 } else {
7766 addClass(ufi.parentNode, 'ponyhoof_brohoofed');
7767 }
7768 });
7769 });
7770 }
7771 };
7772
7773 k._markCommentLiked = function(ufiitem, isLike) {
7774 var child = null;
7775 if (ufiitem.childNodes && ufiitem.childNodes.length && ufiitem.childNodes[0]) {
7776 child = ufiitem.childNodes[0];
7777 }
7778 if (isLike) {
7779 removeClass(ufiitem, 'ponyhoof_comment_liked');
7780 if (child) {
7781 removeClass(child, 'ponyhoof_comment_liked');
7782 }
7783 } else {
7784 addClass(ufiitem, 'ponyhoof_comment_liked');
7785 if (child) {
7786 addClass(child, 'ponyhoof_comment_liked');
7787 }
7788 }
7789 };
7790
7791 k.REACTROOTID = '.r['; // https://github.com/facebook/react/commit/8bc2abd367232eca66e4d38ff63b335c8cf23c45
7792 k.REACTATTRNAME = 'data-reactid'; // https://github.com/facebook/react/commit/67cf44e7c18e068e3f39462b7ac7149eee58d3e5
7793 k.getReactId = function(ufiitem) {
7794 var id = ufiitem.getAttribute(k.REACTATTRNAME);
7795 if (!id) {
7796 return false;
7797 }
7798 return id.substring(k.REACTROOTID.length, id.indexOf(']'));
7799 };
7800
7801 k.reactRoot = function(dom) {
7802 var id = dom.target.getAttribute(k.REACTATTRNAME);
7803 if (id || hasClass(dom.target, 'UFILikeIcon')) {
7804 // beeperNotificaton
7805 if (hasClass(dom.target, '_3sod') || hasClass(dom.target, '-cx-PRIVATE-notificationBeeperItem__beeperitem')) {
7806 var info = dom.target.querySelector('._3sol > span, .-cx-PRIVATE-notificationBeeperItem__imageblockcontent > span');
7807 if (!info) {
7808 return false;
7809 }
7810 k._beepNotification_change(dom.target, info, k._beepNotification_condition_react);
7811
7812 return true;
7813 }
7814
7815 // Notifications
7816 if (k._notification_react(dom.target)) {
7817 return true;
7818 }
7819 var notificationReact = false;
7820 domReplaceFunc(dom.target, '', '.'+k.notification_itemClass[0]+', .'+k.notification_itemClass[1], function(ele) {
7821 k._notification_react(ele);
7822 notificationReact = true;
7823 });
7824 if (notificationReact) {
7825 return true;
7826 }
7827
7828 // Comments
7829 if (hasClass(dom.target, 'UFIComment')) {
7830 k.commentBrohoofed({target: dom.target});
7831 } else if (hasClass(dom.target, 'UFIReplyList')) {
7832 k.changeCommentBox({target: dom.target});
7833 k.commentBrohoofed({target: dom.target}); // only 1 reply
7834 } else if (hasClass(dom.target, 'UFIAddComment')) {
7835 domChangeTextbox(dom.target, 'textarea', k._changeCommentBox_change);
7836 } else if (hasClass(dom.target, 'UFILikeSentence')) {
7837 k._likePostBox(dom.target);
7838 } else if (hasClass(dom.target, 'UFIImageBlockContent')) {
7839 //if (hasClass(dom.target, '_42ef') || hasClass(dom.target, '-cx-PRIVATE-uiFlexibleBlock__flexiblecontent')) {
7840 // on groups with seen, clicking a photo will open in the viewer, but the original post on the group messes up
7841 k._likePostBox(dom.target.parentNode);
7842 //} else {
7843 // marking a comment as spam in another section, and then unmark
7844 k.commentBrohoofed({target: dom.target});
7845 //}
7846 } else if (hasClass(dom.target, 'UFILikeLink') || (!USINGMUTATION && hasClass(dom.target, 'UFILikeThumb'))) {
7847 k._commentLikeLink(dom.target);
7848 } else if (dom.target.parentNode) {
7849
7850 if (hasClass(dom.target.parentNode, 'UFIComment')) {
7851 // marking a comment as spam, and then immediately undo
7852 k.commentBrohoofed({target: dom.target.parentNode});
7853 } else if (hasClass(dom.target.parentNode, 'UFILikeSentence')) {
7854 // groups with seen, from no likes to liked
7855 k._likePostBox(dom.target.parentNode);
7856 } else if (dom.target.parentNode.parentNode) {
7857
7858 //if (hasClass(dom.target.parentNode.parentNode, 'UFIImageBlockContent') || hasClass(dom.target.parentNode.parentNode, 'lfloat')) {
7859 if (hasClass(dom.target.parentNode.parentNode, 'UFILikeSentenceText')) {
7860 // John Amebijeigeba Laverdetberg brohoof this.
7861 // You and John Amebijeigeba Laverdetberg like this.
7862 var ufi = k.getReactUfi(dom.target);
7863 if (ufi) {
7864 k.postLike({target: ufi});
7865 }
7866 } else if (dom.target.parentNode.parentNode.parentNode) {
7867
7868 //if (hasClass(dom.target.parentNode.parentNode.parentNode, 'UFIImageBlockContent')) {
7869 if (hasClass(dom.target.parentNode.parentNode.parentNode, 'UFILikeSentenceText')) {
7870 var ufi = k.getReactUfi(dom.target);
7871 if (ufi) {
7872 k.postLike({target: ufi});
7873 }
7874 }
7875 }
7876 }
7877 }
7878 return true;
7879 }
7880
7881 return false;
7882 };
7883
7884 k.changeCommentBox = function(dom) {
7885 domChangeTextbox(dom.target, '.commentArea textarea, .UFIAddComment textarea', k._changeCommentBox_change);
7886 };
7887 k._changeCommentBox_change = function(textbox) {
7888 try {
7889 var form = textbox;
7890 while (form) {
7891 if (form.tagName.toUpperCase() == 'FORM' && form.getAttribute('action') == '/ajax/ufi/modify.php') {
7892 break;
7893 }
7894 form = form.parentNode;
7895 }
7896 if (form) {
7897 var feedback_params = JSON.parse(form.querySelector('input[name="feedback_params"]').value);
7898 switch (feedback_params.assoc_obj_id) {
7899 case '140792002656140':
7900 case '346855322017980':
7901 return LANG['ms_MY'].fb_comment_box;
7902
7903 case '146225765511748':
7904 return CURRENTLANG.fb_composer_coolstory;
7905
7906 default:
7907 break;
7908 }
7909 switch (feedback_params.target_profile_id) {
7910 case '496282487062916':
7911 return CURRENTLANG.fb_composer_coolstory;
7912
7913 default:
7914 break;
7915 }
7916 }
7917 } catch (e) {}
7918
7919 return CURRENTLANG.fb_comment_box;
7920 };
7921
7922 k.composerPonies = new RegExp(['pony', 'ponies', 'mlp', 'brony', 'bronies', 'pegasister', 'pega sister', 'pega-sister', 'twilight sparkle', 'rainbow dash', 'pinkie', 'applejack', 'fluttershy', 'rarity', 'celestia', 'derpy', 'equestria', 'canterlot', 'dashie', 'apple jack', 'flutter shy', 'princess luna', 'friendship is magic', 'kuda', 'pinkamena', 'bon bon', 'bonbon'].join('|'), 'i');
7923 k.composerExclude = new RegExp(['suck', 'shit', 'fuck', 'assho', 'crap', 'ponyfag', 'faggo', 'retard', 'dick'].join('|'), 'i');
7924 k.composerSpecialPages = {
7925 '140792002656140': {composer: LANG['ms_MY'].fb_composer_lessons, malay:true}
7926 ,'346855322017980': {composer: LANG['ms_MY'].fb_composer_lessons, malay:true}
7927 ,'366748370110998': {composer: LANG['ms_MY'].fb_composer_lessons, malay:true}
7928 ,'146225765511748': {composer: CURRENTLANG.fb_composer_coolstory}
7929 ,'496282487062916': {composer: CURRENTLANG.fb_composer_coolstory}
7930 };
7931 k.composerSelectors = '.uiComposer textarea.mentionsTextarea, .composerTypeahead textarea';
7932 k.composerButtonSelectors = '.uiComposerMessageBoxControls .submitBtn input, .uiComposerMessageBoxControls .submitBtn .uiButtonText, ._11b input, .-cx-PRIVATE-fbComposerMessageBox__button input, button._11b, button.-cx-PRIVATE-fbComposerMessageBox__button';
7933 k.changeComposer = function(dom) {
7934 var pageid = '';
7935
7936 // tagging people with "Who are you with?" and new feelings feature
7937 if (hasClass(dom.target, 'uiMentionsInput')) {
7938 // fix group composers, ugh
7939 if (dom.target.parentNode && dom.target.parentNode.parentNode && dom.target.parentNode.parentNode.parentNode) {
7940 // .uiMentionsInput -> #id -> .-cx-PUBLIC-fbComposerMessageBox__root -> form -> .-cx-PUBLIC-fbComposer__content
7941 k._changeComposer_fixGroup(dom.target.parentNode.parentNode.parentNode);
7942 }
7943
7944 contentEval(function(arg) {
7945 try {
7946 if (typeof window.requireLazy == 'function') {
7947 window.requireLazy(['MentionsInput'], function(MentionsInput) {
7948 var mentions = MentionsInput.getInstance(document.getElementById(arg.uiMentionsInput));
7949 mentions.setPlaceholder(mentions._input.title);
7950 });
7951 }
7952 } catch (e) {
7953 if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
7954 console.log("Unable to hook to MentionsInput");
7955 console.dir(e);
7956 }
7957 }
7958 }, {"CANLOG":CANLOG, "uiMentionsInput":dom.target.id});
7959 return;
7960 }
7961
7962 domChangeTextbox(dom.target, k.composerSelectors, function(composer) {
7963 var placeholderText = CURRENTLANG.fb_composer_lessons;
7964
7965 try {
7966 var form = composer;
7967 var inputContainer = null;
7968 while (form) {
7969 if (hasClass(form, 'uiComposer') || hasClass(form, '_119' /*'_118'*/) || hasClass(form, '-cx-PRIVATE-fbComposer__root')) {
7970 break;
7971 }
7972 if (hasClass(form, 'inputContainer')) {
7973 inputContainer = form;
7974 }
7975 form = form.parentNode;
7976 }
7977
7978 if (!form) {
7979 return placeholderText;
7980 }
7981
7982 pageid = form.querySelector('input[name="xhpc_targetid"]');
7983 if (!pageid) {
7984 pageid = '';
7985 return placeholderText;
7986 }
7987 pageid = pageid.value;
7988 form.setAttribute('data-ponyhoof-xhpc_targetid', pageid);
7989 if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].composer) {
7990 placeholderText = k.composerSpecialPages[pageid].composer;
7991 }
7992
7993 k._changeComposerAttachment(dom, pageid);
7994
7995 if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
7996 $$(form, k.composerButtonSelectors, function(submit) {
7997 k.changeButtonText(submit, "Kirim");
7998 });
7999 }
8000
8001 composer.addEventListener('input', function() {
8002 var malay = false;
8003 var lang = CURRENTLANG;
8004 if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
8005 malay = true;
8006 lang = LANG['ms_MY'];
8007 }
8008
8009 // we can't guarantee the button anymore, so we have to do this expensive JS :(
8010 // group composers are funky and teleport the textbox to a new <div> onclick
8011 $$(form, k.composerButtonSelectors, function(submit) {
8012 if (!k.composerExclude.test(composer.value) && k.composerPonies.test(composer.value)) {
8013 if (composer.value.toUpperCase() == composer.value) {
8014 k.changeButtonText(submit, lang.fb_composer_ponies_caps);
8015 } else {
8016 k.changeButtonText(submit, lang.fb_composer_ponies);
8017 }
8018 } else if (malay) {
8019 k.changeButtonText(submit, "Kirim");
8020 } else {
8021 var submitParent = submit;
8022 if (submit.tagName.toUpperCase() != 'BUTTON') {
8023 submitParent = submit.parentNode;
8024 }
8025 if (submitParent.getAttribute('data-ponyhoof-button-text')) {
8026 k.changeButtonText(submit, submitParent.getAttribute('data-ponyhoof-button-text'));
8027 }
8028 }
8029 });
8030 });
8031
8032 if (isPonyhoofPage(pageid)) {
8033 composer.addEventListener('focus', function() {
8034 if (inputContainer) {
8035 k._changeComposer_insertReadme(inputContainer.nextSibling);
8036 return;
8037 }
8038
8039 // pages have ComposerX and teleports the textbox here and there
8040 $$(form, '._2yg, .-cx-PUBLIC-fbComposerMessageBox__root', function(composer) {
8041 // exclude inactives
8042 if (!composer.parentNode || hasClass(composer.parentNode, 'hidden_elem')) {
8043 return;
8044 }
8045
8046 var temp = composer.getElementsByClassName('ponyhoof_page_readme');
8047 if (temp.length) {
8048 return;
8049 }
8050
8051 // status: before taggersPlaceholder
8052 // photos: after uploader
8053 // fallback: before bottom bar
8054 var insertBefore = composer.querySelector('._3-6, .-cx-PRIVATE-fbComposerBootloadStatus__taggersplaceholder');
8055 if (!insertBefore) {
8056 insertBefore = composer.querySelector('._93, .-cx-PRIVATE-fbComposerUploadMedia__root');
8057 if (insertBefore) {
8058 insertBefore = insertBefore.nextSibling;
8059 }
8060 }
8061 if (!insertBefore) {
8062 insertBefore = composer.querySelector('._1dsp, .-cx-PUBLIC-fbComposerMessageBox__bar');
8063 }
8064 // abort if no good insertion
8065 if (!insertBefore) {
8066 return;
8067 }
8068
8069 k._changeComposer_insertReadme(insertBefore);
8070 });
8071 }, true);
8072 return "Send feedback for Ponyhoof...";
8073 }
8074 if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].composer) {
8075 return k.composerSpecialPages[pageid].composer;
8076 }
8077 } catch (e) {}
8078
8079 return placeholderText;
8080 });
8081
8082 // moved outside for timelineStickyHeader
8083 if (!pageid) {
8084 k._changeComposerAttachment(dom, null);
8085 }
8086
8087 // fix group composers, ugh
8088 //k._changeComposer_fixGroup(dom.target);
8089 };
8090
8091 k._changeComposerAttachment = function(dom, pageid) {
8092 $$(dom.target, '._4_ li a, ._9lb, .-cx-PUBLIC-fbComposerAttachment__link, .uiComposerAttachment', function(attachment) {
8093 if (attachment.getAttribute('data-ponyhoof-ponified')) {
8094 return;
8095 }
8096
8097 var switchit = false;
8098 switch (attachment.getAttribute('data-endpoint')) {
8099 case '/ajax/composerx/attachment/status/':
8100 case '/ajax/composerx/attachment/group/post/':
8101 case '/ajax/composerx/attachment/wallpost/':
8102 case '/ajax/metacomposer/attachment/timeline/status.php':
8103 case '/ajax/metacomposer/attachment/timeline/backdated_status.php':
8104 case '/ajax/metacomposer/attachment/timeline/wallpost.php':
8105 switchit = "Take a Note";
8106 if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
8107 switchit = "Tulis Kiriman";
8108 }
8109 break;
8110
8111 case '/ajax/composerx/attachment/media/chooser/':
8112 case '/ajax/composerx/attachment/media/chooser':
8113 case '/ajax/composerx/attachment/media/upload/':
8114 case '/ajax/metacomposer/attachment/timeline/photo/photo.php':
8115 case '/ajax/metacomposer/attachment/timeline/photo/backdated_upload.php':
8116 case '/ajax/metacomposer/attachment/timeline/backdated_vault.php?max_select=1':
8117 switchit = "Add a Pic";
8118 if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
8119 switchit = "Tambah Gambar / Video";
8120 }
8121 break;
8122
8123 case '/ajax/composerx/attachment/question/':
8124 switchit = "Query";
8125 if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
8126 switchit = "Tanya Soalan";
8127 }
8128 break;
8129
8130 case '/ajax/composerx/attachment/group/file/':
8131 case '/ajax/composerx/attachment/group/filedropbox/':
8132 if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
8133 switchit = "Muat Naik Fail";
8134 }
8135 break;
8136
8137 default:
8138 break;
8139 }
8140 if (!switchit) {
8141 if (attachment.getAttribute('data-endpoint').indexOf('/ajax/composerx/attachment/pages/other') != -1 || attachment.getAttribute('data-endpoint').indexOf('/ajax/metacomposer/attachment/timeline/pages_other.php') != -1) {
8142 switchit = "Adventure, Milestone +";
8143 //if (attachment.id == 'offerEventAndOthersButton') {
8144 if (attachment.textContent.toLowerCase().indexOf('offer') != -1) {
8145 switchit = "Offer, Adventure +";
8146 }
8147 }
8148 }
8149
8150 if (switchit) {
8151 var done = false;
8152 var inner = attachment.querySelector('._2-s, .-cx-PUBLIC-fbTimelineComposerAttachment__label');
8153 if (!inner) {
8154 inner = attachment.querySelector('._51z7, .-cx-PUBLIC-fbComposerAttachment__linktext');
8155 if (!inner) {
8156 // page timelines use ".attachmentName" and are wacky, there are actually two copies of the <div> that show/hide
8157 $$(attachment, '.attachmentName', function(inner) {
8158 k._changeComposerAttachment_inner(inner, switchit);
8159 done = true;
8160 });
8161
8162 if (!done) {
8163 inner = attachment;
8164 }
8165 }
8166 }
8167
8168 if (!done) {
8169 k._changeComposerAttachment_inner(inner, switchit);
8170 }
8171 }
8172
8173 attachment.setAttribute('data-ponyhoof-ponified', 1);
8174 });
8175 };
8176
8177 k._changeComposerAttachment_inner = function(inner, switchit) {
8178 var stopit = false;
8179 loopChildText(inner, function(child) {
8180 if (stopit) {
8181 return;
8182 }
8183 if (child.nodeType == 3) {
8184 child.textContent = switchit;
8185 stopit = true;
8186 }
8187 });
8188 };
8189
8190 k._changeComposer_insertReadme = function(insertBefore) {
8191 var n = d.createElement('iframe');
8192 n.className = 'showOnceInteracted ponyhoof_page_readme _4- -cx-PRIVATE-fbComposer__showonceinteracted';
8193 n.scrolling = 'auto';
8194 n.frameborder = '0';
8195 n.allowtransparency = 'true';
8196 n.src = PONYHOOF_README;
8197 insertBefore.parentNode.insertBefore(n, insertBefore);
8198 };
8199
8200 k._changeComposer_fixGroup = function(target) {
8201 if (hasClass(target.parentNode, '_55d0') || hasClass(target.parentNode, '.-cx-PUBLIC-fbComposer__content')) {
8202 var pageid = target.querySelector('input[name="xhpc_targetid"]');
8203 if (!pageid) {
8204 return;
8205 }
8206 pageid = pageid.value;
8207
8208 // domChangeTextbox will not work as these <textarea>s already has "data-ponyhoof-ponified"
8209 var composer = target.querySelector(k.composerSelectors);
8210 if (!composer) {
8211 return;
8212 }
8213
8214 $$(target, k.composerButtonSelectors, function(submit) {
8215 var malay = false;
8216 var lang = CURRENTLANG;
8217 if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
8218 malay = true;
8219 lang = LANG['ms_MY'];
8220 }
8221
8222 if (!k.composerExclude.test(composer.value) && k.composerPonies.test(composer.value)) {
8223 if (composer.value.toUpperCase() == composer.value) {
8224 k.changeButtonText(submit, lang.fb_composer_ponies_caps);
8225 } else {
8226 k.changeButtonText(submit, lang.fb_composer_ponies);
8227 }
8228 } else if (malay) {
8229 k.changeButtonText(submit, "Kirim");
8230 }
8231 });
8232 }
8233 };
8234
8235 k.tooltip = function(target) {
8236 domReplaceFunc(target, '', '.tooltipContent', function(ele) {
8237 // <div class="tooltipContent"><div class="tooltipText"><span>Hide</span></div></div>
8238 // <div class="tooltipContent"><div>Ponyhoof brohoofs this.</div></div>
8239 // <div class="tooltipContent">xy</div>
8240 // <div class="tooltipContent"><div><div class="-cx-PRIVATE-HubbleTargetingImage__tooltipcontent" data-reactid=""><div data-reactid=""><b data-reactid="">Shared with:</b><br data-reactid=""><span data-reactid="">Public</span></div></div></div></div>
8241
8242 // <div class="uiContextualLayerPositioner uiLayer" style="width: 294px; left: 877px; top: 1299px;" data-ownerid="js_14"><div class="uiContextualLayer uiContextualLayerAboveLeft" style="bottom: 0px;"><div class="uiTooltipX"><div class="tooltipContent"><div class="tooltipText"><span>Excellent</span></div></div><i class="arrow"></i></div></div></div>
8243 var io = ele.getElementsByClassName('tooltipText');
8244 if (io.length) {
8245 var target = io[0];
8246 } else {
8247 var target = ele;
8248 }
8249 var potentialLabel = target.querySelector('._5bqd, .-cx-PRIVATE-HubbleInfoTip__content, ._5j1i');
8250 if (potentialLabel) {
8251 target = potentialLabel;
8252 }
8253 if (target.childNodes && target.childNodes.length && target.childNodes[0] && target.childNodes[0].tagName && target.childNodes[0].tagName.toUpperCase() == 'DIV') {
8254 target = target.childNodes[0];
8255 }
8256 if (target.childNodes && target.childNodes.length && target.childNodes[0] && target.childNodes[0].tagName && target.childNodes[0].tagName.toUpperCase() == 'SPAN') {
8257 target = target.childNodes[0];
8258 }
8259
8260 // Get the tooltip outer layer
8261 var layer = k._tooltipGetLayer(ele);
8262 if (!layer) {
8263 return;
8264 }
8265
8266 removeClass(layer, 'ponyhoof_tooltip_flip');
8267
8268 // Replace text
8269 var t = target.innerHTML;
8270 t = replaceText(tooltipTitles, t);
8271 if (target.innerHTML != t) {
8272 var oldWidth = target.offsetWidth;
8273 target.innerHTML = t;
8274
8275 // Get the inner layer inside the outer layer (get it...?)
8276 var layerInner = layer.getElementsByClassName('uiContextualLayer');
8277 if (!layerInner.length) {
8278 return;
8279 }
8280 layerInner = layerInner[0];
8281
8282 if (layerInner.className.match(/Center/)) {
8283 layer.style.width = 'auto'; // fix horizontal scrollbar
8284 var left = parseInt(layer.style.left);
8285 var newWidth = target.offsetWidth;
8286 layer.style.left = (left - Math.round((newWidth - oldWidth) / 2))+'px';
8287 } else if (layerInner.className.match(/Left/)) {
8288 // Fix "Remember: all place ratings are public." tooltips that are being ponified and causing a horizontal page scrollbar
8289 //
8290 // This is complicated, Facebook caches the ContextualLayer <div>s for tooltips
8291 // If we directly change the classNames like this:
8292 // layerInner.className = layerInner.className.replace(/Left/, 'Right');
8293 // This would cause future tooltips to display incorrectly
8294 // So what we done is add our own "ponyhoof_tooltip_flip" class which flips the tooltip left to right
8295
8296 var rect = ele.getBoundingClientRect();
8297 if (!rect) {
8298 return;
8299 }
8300 if (rect.right >= d.documentElement.clientWidth) {
8301 layer.style.width = 'auto'; // bogus anyway
8302 layer.style.left = (parseInt(layer.style.left) - rect.width + 18)+'px'; // 18 is the number of pixels to offset to position the arrow of the tooltip properly
8303 addClass(layer, 'ponyhoof_tooltip_flip');
8304 }
8305 }
8306 }
8307 });
8308 };
8309
8310 k._tooltipGetLayer = function(ele) {
8311 // <div class="uiContextualLayerPositioner uiLayer" id="js_4" style="width: 862px; left: 309px; top: 1914px;" data-ownerid=""><div class="uiContextualLayer uiContextualLayerAboveCenter" style="bottom: 0px;"><div class="uiTooltipX"><div class="tooltipContent"><div>Loading...</div></div><i class="arrow"></i></div></div></div>
8312 if (!ele.parentNode || !ele.parentNode.parentNode || !ele.parentNode.parentNode.parentNode) {
8313 return false;
8314 }
8315 var layer = ele.parentNode.parentNode.parentNode;
8316 if (!hasClass(layer, 'uiContextualLayerPositioner')) {
8317 return false;
8318 }
8319 return layer;
8320 };
8321
8322 k.fbDockChatBuddylistNub = function(target) {
8323 if (target.parentNode && target.parentNode.parentNode && target.parentNode.parentNode.getAttribute && target.parentNode.parentNode.getAttribute('id') == 'fbDockChatBuddylistNub' && hasClass(target, 'label')) {
8324 k._fbDockChatBuddylistNub_change(target);
8325 return true;
8326 }
8327 // first loading
8328 var nub = target.querySelector('#fbDockChatBuddylistNub .label');
8329 if (nub) {
8330 k._fbDockChatBuddylistNub_change(nub);
8331 }
8332 return false;
8333 };
8334
8335 k._fbDockChatBuddylistNub_change = function(target) {
8336 if (target.childNodes && target.childNodes.length && target.childNodes[0] && target.childNodes[0].nodeType == TEXT_NODE) {
8337 var replaced = target.childNodes[0].textContent.replace(/Chat/, "Whinny");
8338 if (target.childNodes[0].textContent != replaced) {
8339 addClass(target, 'ponyhoof_chatLabel_ponified');
8340 target.childNodes[0].textContent = replaced;
8341 }
8342 }
8343 };
8344
8345 k.pokesDashboard = function(target) {
8346 if (target.getAttribute && target.getAttribute('id') && target.getAttribute('id').indexOf('poke_') == 0) {
8347 k._pokesDashboard_item(target);
8348 return true;
8349 }
8350
8351 //$$(target, '.pokesDashboard > .objectListItem', k._pokesDashboard_item);
8352 $$(target, '.objectListItem[id^="poke_"]', k._pokesDashboard_item);
8353
8354 if (hasClass(target, 'highlight')) {
8355 var t = target.textContent;
8356 t = t.replace(/You poked /, 'You nuzzled ');
8357 if (target.textContent != t) {
8358 target.textContent = t;
8359 }
8360 return true;
8361 }
8362
8363 k._pokesDashboard_pokeLink(target);
8364
8365 return false;
8366 };
8367
8368 k._pokesDashboard_item = function(item) {
8369 //var header = item.getElementsByClassName('pokeHeader');
8370 //if (!header || !header.length) {
8371 // return;
8372 //}
8373 //header = header[0];
8374
8375 var header = item.querySelector('.uiProfileBlockContent > ._6a > ._6b > .fwb'); // .-cx-PRIVATE-uiInlineBlock__root > .-cx-PRIVATE-uiInlineBlock__middle
8376 if (!header) {
8377 return;
8378 }
8379
8380 var t = header.innerHTML;
8381 t = t.replace(/ poked you\./, ' nuzzled you.');
8382 if (header.innerHTML != t) {
8383 header.innerHTML = t;
8384 }
8385
8386 k._pokesDashboard_pokeLink(item);
8387 };
8388
8389 k._pokesDashboard_pokeLink = function(target) {
8390 $$(target, 'a[ajaxify^="/pokes/inline/"]', function(poke) {
8391 var text = "Nuzzle";
8392 /*if (poke.getAttribute('ajaxify').indexOf('pokeback=1') != -1) { // http://fb.com/406911932763192
8393 text = "Nuzzle Back";
8394 }*/
8395
8396 if (poke.childNodes && poke.childNodes.length && poke.childNodes[1]) {
8397 poke.childNodes[1].textContent = text;
8398 return;
8399 }
8400
8401 var stop = false;
8402 loopChildText(poke, function(child) {
8403 if (stop) {
8404 return;
8405 }
8406 if (child.nodeType == TEXT_NODE) {
8407 child.textContent = text;
8408 stop = true;
8409 }
8410 });
8411 });
8412 };
8413
8414 k.notification = function(dom) {
8415 domReplaceFunc(dom.target, 'notification', '.notification', function(ele) {
8416 k._notification_change(ele, '.info', k._notification_general_metadata);
8417 });
8418
8419 if (ONPLUGINPAGE) {
8420 $$(dom.target, '.notification-item', function(ele) {
8421 k._notification_change(ele, '.notification-text > .message', k._notification_messenger_metadata);
8422 });
8423 }
8424 };
8425
8426 k.notification_itemClass = ['_33c', '-cx-PRIVATE-fbNotificationJewelItem__item'];
8427 k.notification_textClass = ['_4l_v', '-cx-PRIVATE-fbNotificationJewelItem__text'];
8428 k.notification_metadataClass = ['_33f', '-cx-PRIVATE-fbNotificationJewelItem__metadata'];
8429 k._notification_react = function(ele) {
8430 for (var i = 0; i <= 1; i += 1) {
8431 if (hasClass(ele, k.notification_itemClass[i])) {
8432 k._notification_change(ele, '.'+k.notification_textClass[i]+' > span', k._notification_react_metadata);
8433 return true;
8434 }
8435 }
8436 return false;
8437 };
8438
8439 k._notification_general_metadata = function(node) {
8440 if (hasClass(node, 'metadata') || hasClass(node, 'blueName')) {
8441 return false;
8442 }
8443 return true;
8444 };
8445
8446 k._notification_messenger_metadata = function(node) {
8447 if (node.nodeType != TEXT_NODE) {
8448 return false;
8449 }
8450 return true;
8451 };
8452
8453 k._notification_react_metadata = function(node) {
8454 if (hasClass(node, 'fwb')) {
8455 return false;
8456 }
8457 if (hasClass(node, k.notification_metadataClass[0]) || hasClass(node, k.notification_metadataClass[1])) {
8458 return false;
8459 }
8460 return true;
8461 };
8462
8463 k._notification_change = function(ele, info, metadataFunc) {
8464 var info = ele.querySelector(info);
8465 if (!info) {
8466 return;
8467 }
8468 if (!info.childNodes || !info.childNodes.length) {
8469 return;
8470 }
8471
8472 for (var i = 0, len = info.childNodes.length; i < len; i += 1) {
8473 var node = info.childNodes[i];
8474 if (!metadataFunc(node)) {
8475 continue;
8476 }
8477
8478 var text = node.textContent;
8479 if (text.indexOf('"') != -1) {
8480 var finalText = k.textNotification(text.substring(0, text.indexOf('"')));
8481 finalText += text.substring(text.indexOf('"'), text.length);
8482 } else {
8483 var finalText = k.textNotification(text);
8484 }
8485
8486 if (node.textContent != finalText) {
8487 node.textContent = finalText;
8488 }
8489
8490 if (text.indexOf('"') != -1) {
8491 break;
8492 }
8493 }
8494 };
8495
8496 k.menuPrivacyOnlyAjaxify = [
8497 // when posting
8498 '%22value%22%3A%2280%22' // Everyone
8499 ,'%22value%22%3A%2250%22' // Friends of Friends
8500 ,'%22value%22%3A%2240%22' // Friends
8501 ,'%22value%22%3A%22127%22' // Friends except Acquaintances
8502 ,'%22value%22%3A%2210%22' // Only Me
8503
8504 // https://www.facebook.com/settings?tab=timeline&section=posting&view
8505 ,'%22value%22%3A40'
8506 ,'%22value%22%3A10'
8507 ];
8508 k._processMenuXOldWidthDiff = 0;
8509 k.menuItems = function(dom) {
8510 var processMenuX = false;
8511 var hasScrollableArea = false;
8512 k._processMenuXOldWidthDiff = 0;
8513 domReplaceFunc(dom.target, 'uiMenuItem', '.uiMenuItem, ._54ni, .-cx-PUBLIC-abstractMenuItem__root, .ufb-menu-item', function(ele) {
8514 if (hasClass(ele, 'ponyhoof_fbmenuitem')) {
8515 return;
8516 }
8517 addClass(ele, 'ponyhoof_fbmenuitem');
8518
8519 // pages on share dialog
8520 if (hasClass(ele, '_90z') || hasClass(ele, '-cx-PRIVATE-fbShareModePage__smalliconcontainer')) {
8521 return;
8522 }
8523
8524 // lists/groups on Invite Friends dialogs
8525 var listendpoint = ele.getAttribute('data-listendpoint');
8526 if (listendpoint && listendpoint != '/ajax/chooser/list/friends/all/' && listendpoint.indexOf('/ajax/chooser/list/friends/') == 0 && listendpoint.indexOf('/ajax/chooser/list/friends/suggest/?filter=all') == -1 && listendpoint.indexOf('/ajax/chooser/list/friends/app_all_friends/') == -1 && listendpoint.indexOf('/ajax/chooser/list/friends/app_non_user/') == -1) {
8527 return;
8528 }
8529
8530 var replacer = menuTitles;
8531 if (hasClass(ele, 'fbPrivacyAudienceSelectorOption')) {
8532 replacer = menuPrivacyOnlyTitles;
8533
8534 // ensure that only FB-provided options get changed
8535 var itemAnchor = ele.getElementsByClassName('itemAnchor');
8536 if (itemAnchor.length) {
8537 var ajaxify = itemAnchor[0].getAttribute('ajaxify');
8538 // Sometimes ajaxify is missing (legacy edit video)
8539 if (ajaxify) {
8540 var _menuPrivacyOnlyOk = false;
8541 for (var i = 0, len = k.menuPrivacyOnlyAjaxify.length; i < len; i += 1) {
8542 if (ajaxify.indexOf(k.menuPrivacyOnlyAjaxify[i]) != -1) {
8543 _menuPrivacyOnlyOk = true;
8544 break;
8545 }
8546 }
8547 if (!_menuPrivacyOnlyOk) {
8548 return;
8549 }
8550 }
8551 }
8552 }
8553
8554 var label = ele.querySelector('.itemLabel, ._54nh, .-cx-PUBLIC-abstractMenuItem__label, .ufb-menu-item-label');
8555 if (label) {
8556 //if (label.childNodes.length == 1) {
8557 // timeline post has 2
8558 var io = label.getElementsByTagName('span');
8559 if (io.length) {
8560 if (!hasClass(io[0], 'hidden_elem')) {
8561 label = io[0];
8562 }
8563 }
8564
8565 var orig = '';
8566 var replaced = '';
8567 var oldLabelWidth = 0;
8568 ele.setAttribute('data-ponyhoof-menuitem-orig', ele.textContent);
8569 loopChildText(label, function(child) {
8570 if (child.nodeType == 3) {
8571 var t = child.textContent;
8572 orig += t+' ';
8573 t = replaceText(replacer, t);
8574 if (child.textContent != t) {
8575 if (!hasScrollableArea && (ele.parentNode && ele.parentNode.parentNode && hasClass(ele.parentNode.parentNode, 'uiScrollableAreaContent'))) {
8576 hasScrollableArea = true;
8577 }
8578 if (hasScrollableArea) {
8579 label.style.display = 'inline-block';
8580 if (!oldLabelWidth) {
8581 oldLabelWidth = label.offsetWidth;
8582 }
8583 }
8584 child.textContent = t;
8585 }
8586 replaced += t+' ';
8587 }
8588 });
8589
8590 orig = orig.substr(0, orig.length-1);
8591 replaced = replaced.substr(0, replaced.length-1);
8592 ele.setAttribute('data-ponyhoof-menuitem-text', replaced);
8593 ele.setAttribute('data-label', replaced); // technically, this is only used for .uiMenuItem
8594
8595 if (orig != replaced) {
8596 if (hasClass(ele, '_54ni') || hasClass(ele, '-cx-PUBLIC-abstractMenuItem__root')) {
8597 if (hasScrollableArea && oldLabelWidth) {
8598 var newWidth = label.offsetWidth;
8599 if (newWidth > oldLabelWidth) {
8600 k._processMenuXOldWidthDiff = Math.max(newWidth - oldLabelWidth, 0);
8601 processMenuX = true;
8602 }
8603 } else {
8604 processMenuX = true;
8605 }
8606 }
8607 }
8608 if (hasScrollableArea) {
8609 label.style.display = '';
8610 }
8611 }
8612 });
8613
8614 if (processMenuX) {
8615 if (hasClass(dom.target, 'uiContextualLayerPositioner')) {
8616 k._menuItems_processMenuX(dom.target);
8617 return;
8618 }
8619
8620 k.getParent(dom.target, function(parent) {
8621 return hasClass(parent, 'uiContextualLayerPositioner');
8622 }, k._menuItems_processMenuX);
8623 }
8624 };
8625 k._menuItems_processMenuX = function(layer) {
8626 if (!layer) {
8627 return;
8628 }
8629
8630 var ownerid = layer.getAttribute('data-ownerid');
8631 if (!ownerid) {
8632 return;
8633 }
8634 ownerid = $(ownerid);
8635 if (!ownerid) {
8636 return;
8637 }
8638
8639 var menu = layer.querySelector('._54nq, .-cx-PUBLIC-abstractMenu__wrapper');
8640 if (!menu) {
8641 return;
8642 }
8643
8644 if (k._processMenuXOldWidthDiff) {
8645 var uiScrollableArea = layer.getElementsByClassName('uiScrollableArea');
8646 var uiScrollableAreaBody = layer.getElementsByClassName('uiScrollableAreaBody');
8647 if (uiScrollableArea && uiScrollableAreaBody) {
8648 uiScrollableArea = uiScrollableArea[0];
8649 uiScrollableAreaBody = uiScrollableAreaBody[0];
8650
8651 uiScrollableArea.style.width = (parseInt(uiScrollableArea.style.width)+k._processMenuXOldWidthDiff)+'px';
8652 uiScrollableAreaBody.style.width = (parseInt(uiScrollableAreaBody.style.width)+k._processMenuXOldWidthDiff)+'px';
8653 }
8654 }
8655
8656 var border = layer.querySelector('._54hx, .-cx-PUBLIC-abstractMenu__shortborder');
8657 if (!border) {
8658 return;
8659 }
8660 border.style.width = (Math.max((menu.offsetWidth - ownerid.offsetWidth), 0))+'px';
8661 };
8662
8663 k.fbRemindersStory = function(target) {
8664 $$(target, '.fbRemindersStory', function(item) {
8665 var inner = item.querySelector('._42ef > .fcg, .-cx-PRIVATE-uiFlexibleBlock__flexiblecontent > .fcg');
8666 if (!inner) {
8667 return;
8668 }
8669
8670 loopChildText(inner, function(child) {
8671 if (child.nodeType == TEXT_NODE) {
8672 var t = child.textContent;
8673 t = t.replace(/\bpoked you\b/, "nuzzled you");
8674 if (child.textContent != t) {
8675 child.textContent = t;
8676 }
8677 } else {
8678 if (hasClass(child, 'fbRemindersTitle')) {
8679 var t = child.innerHTML;
8680 t = t.replace(/([0-9]+?) events/, "$1 adventures")
8681 if (child.innerHTML != t) {
8682 child.innerHTML = t;
8683 }
8684 }
8685 }
8686 });
8687 });
8688 };
8689
8690 k.flyoutLikeForm = function(target) {
8691 var result = k._flyoutLikeForm(target, 'groupsMemberFlyoutLikeForm', 'unlike');
8692 if (!result) {
8693 result = k._flyoutLikeForm(target, 'fbEventMemberLike', 'liked');
8694 }
8695 return result;
8696 };
8697
8698 k._flyoutLikeForm = function(target, className, forminput) {
8699 domReplaceFunc(target, className, '.'+className, function(ele) {
8700 if (!ele.elements[forminput]) {
8701 return;
8702 }
8703
8704 var isLike = true;
8705 if (ele.elements[forminput].value == 1) {
8706 isLike = false;
8707 }
8708
8709 var submit = ele.querySelector('input[type="submit"]');
8710 if (!submit) {
8711 return;
8712 }
8713 if (isLike) {
8714 submit.value = capitaliseFirstLetter(CURRENTSTACK['like']);
8715 } else {
8716 submit.value = capitaliseFirstLetter(CURRENTSTACK['unlike']);
8717 }
8718 });
8719
8720 if (hasClass(target, className)) {
8721 return true;
8722 }
8723 return false;
8724 };
8725
8726 k.pluginButton = function(target) {
8727 if (!ONPLUGINPAGE) {
8728 return;
8729 }
8730
8731 var root = target.getElementsByClassName('pluginConnectButtonLayoutRoot');
8732 if (!root.length) {
8733 var root = target.getElementsByClassName('pluginSkinLight');
8734 if (!root.length) {
8735 return;
8736 }
8737 }
8738 root = root[0];
8739
8740 domReplaceFunc(root, '', '.pluginButton', function(ele) {
8741 var div = ele.getElementsByTagName('div');
8742 if (div.length) {
8743 ele = div[0];
8744 }
8745
8746 // <div class="pluginButton pluginButtonInline pluginConnectButtonDisconnected hidden_elem" title="Like"><div><button type="submit"><i class="pluginButtonIcon img sp_like sx_like_thumb"></i><span class="accessible_elem">Like</span></button><span aria-hidden="true">Like</span></div></div>
8747 var stop = false;
8748 loopChildText(ele, function(child) {
8749 if (stop) {
8750 return;
8751 }
8752 if (child.tagName.toUpperCase() == 'SPAN') {
8753 if (child.innerHTML == "Like") {
8754 child.innerHTML = capitaliseFirstLetter(CURRENTSTACK.like);
8755 stop = true;
8756 }
8757 }
8758 });
8759 });
8760
8761 domReplaceFunc(root, '', '.uiIconText', function(ele) {
8762 // <div style="padding-left: 19px;" class="uiIconText"><i class="img sp_like sx_like_fav" style="top: 0px;"></i><span id="u_0_1">You, <a href="https://www.facebook.com/XXX" target="_blank">XXX</a> and 102,502 others like this.</span><span class="hidden_elem" id="u_0_2"><a href="https://www.facebook.com/XXX" target="_blank">XXX</a> and 102,502 others like this.</span></div>
8763 loopChildText(ele, function(child) {
8764 loopChildText(child, function(inner) {
8765 if (inner.nodeType === TEXT_NODE) {
8766 var t = k.likeSentence(inner.textContent);
8767 t = t.replace(/\bfriends\b/g, CURRENTSTACK['friends_logic']); // Be the first of your friends.
8768 if (inner.textContent != t) {
8769 inner.textContent = t;
8770 }
8771 }
8772 });
8773 });
8774 });
8775
8776 // likebox
8777 $$(root, '._51mx > .pls > div > span', function(ele) {
8778 var t = k.likeSentence(ele.textContent);
8779 if (ele.textContent != t) {
8780 ele.textContent = t;
8781 }
8782 });
8783 };
8784
8785 k.ticker = function(dom) {
8786 domReplaceFunc(dom.target, 'fbFeedTickerStory', '.fbFeedTickerStory', function(ele) {
8787 var div = ele.getElementsByClassName('uiStreamMessage');
8788 if (div.length) {
8789 div = div[0];
8790
8791 // Ticker messages are really inconsistent
8792 // <span class="passiveName">Friend</span> brohoofs <span class="token">Page</span>'s <span class="token">photo</span>.
8793 // <span class="passiveName">Friend</span> added a new pony pic.
8794 // <span class="passiveName">Friend</span> brohoofs <span class="token">Page</span>'s <span class="token">video</span> Title. // http://fb.com/10200537039965966
8795 var continueTextNodes = true;
8796 for (var i = 0, len = div.childNodes.length; i < len; i += 1) {
8797 var node = div.childNodes[i];
8798 if (node.nodeType == TEXT_NODE) {
8799 if (!continueTextNodes) {
8800 continue;
8801 }
8802
8803 var t = node.textContent;
8804
8805 var boundary = '';
8806 var haltOnBoundary = false;
8807 if (t.indexOf('"') != -1) {
8808 boundary = '"';
8809 haltOnBoundary = true;
8810 } else if (t.indexOf('\'s') != -1) {
8811 boundary = '\'s';
8812 continueTextNodes = false;
8813 }
8814
8815 if (boundary) {
8816 var finalText = k.textNotification(t.substring(0, t.indexOf(boundary)));
8817 finalText += t.substring(t.indexOf(boundary), t.length);
8818 } else {
8819 var finalText = k.textNotification(t);
8820 }
8821 //t = t.replace(/\blikes\b/, " "+CURRENTSTACK['likes_past']);
8822 //t = t.replace(/\blike\b/, " "+CURRENTSTACK['like_past']);
8823 if (node.textContent != finalText) {
8824 node.textContent = finalText;
8825 }
8826
8827 if (boundary && haltOnBoundary) {
8828 break;
8829 }
8830 } else {
8831 // It's too risky changing legit page names, so we are doing this in isolated cases
8832 if (hasClass(node, 'token')) {
8833 var list = [
8834 ['photo', 'pony pic']
8835 ,['a photo', 'a pony pic']
8836 ,['wall', 'journal']
8837 ];
8838 var t = replaceText(list, node.textContent);
8839 if (node.textContent != t) {
8840 node.textContent = t;
8841 }
8842 }
8843 }
8844 }
8845 }
8846 });
8847 if (hasClass(dom.target, 'fbFeedTickerStory')) {
8848 return true;
8849 }
8850 return false;
8851 };
8852
8853 k.pagesVoiceBarText = function(target) {
8854 if (hasClass(target, 'pagesVoiceBarText')) {
8855 if (target.childNodes && target.childNodes.length && target.childNodes[0]) {
8856 var textNode = target.childNodes[0];
8857 if (textNode.nodeType == TEXT_NODE) {
8858 var t = textNode.textContent;
8859 t = t.replace(/\bliking\b/, CURRENTSTACK['liking']);
8860 if (textNode.textContent != t) {
8861 textNode.textContent = t;
8862 }
8863 }
8864 }
8865 return true;
8866 }
8867 return false;
8868 };
8869
8870 k.beepNotification = function(dom) {
8871 warn("domNodeHandler.beepNotification() is deprecated");
8872 return false;
8873 };
8874
8875 // XYZ commented on your Wall post: "I like it"
8876 k._beepNotification_condition_classic = function(node, gt) {
8877 // <div class="UIBeep_Title"><span class="blueName">XYZ</span> likes your comment: "12"</div>
8878 // <div class="UIBeep_Title"><span class="blueName">XYZ</span> brohoofs your friendship letter: "12"</div>
8879 if (node.nodeType == 3) {
8880 return true;
8881 }
8882 return false;
8883 };
8884 k._beepNotification_condition_react = function(node, gt) {
8885 // <span id=""><span class="fwb" id=""><span id="">XYZ</span></span><span id=""> also commented on a </span><span class="fwb" id=""><span id="">photo</span></span><span id=""> in </span><span class="fwb" id=""><span id="">GROUP NAME</span></span><span id="">: "What?"</span></span>
8886 // <span data-reactid=""><span class="fwb" data-reactid="">NAME</span><span data-reactid=""> commented on your pony pic in </span><span class="fwb" data-reactid="">GROUP NAME</span><span data-reactid="">: "COMMENT"</span></span>
8887
8888 // **XYZ** posted on **Ponyhoof**'s **timeline**: "XYZ"
8889 //if (hasClass(node, 'fwb')) {
8890 // return false;
8891 //}
8892 return true;
8893 };
8894
8895 k._beepNotification_change = function(ele, info, condition) {
8896 if (!info) {
8897 return;
8898 }
8899
8900 var gt = JSON.parse(ele.getAttribute('data-gt'));
8901 ele.setAttribute('data-ponyhoof-beeper-orig', info.textContent);
8902 for (var i = 0, len = info.childNodes.length; i < len; i += 1) {
8903 var node = info.childNodes[i];
8904 if (condition(node, gt)) {
8905 var text = '';
8906 if (node.nodeType == 3) {
8907 text = node.textContent;
8908 k._beepNotification_change_text(node, text);
8909 } else {
8910 // emoticons are smacked together, so we need to run another loop
8911 for (var j = 0, jLen = node.childNodes.length; j < jLen; j += 1) {
8912 var textNode = node.childNodes[j];
8913 text = textNode.textContent;
8914 k._beepNotification_change_text(textNode, text);
8915 }
8916 }
8917
8918 if (text.indexOf('"') != -1) {
8919 break;
8920 }
8921 }
8922 }
8923 ele.setAttribute('data-ponyhoof-beeper-message', info.textContent);
8924
8925 if (userSettings.sounds) {
8926 var file = '';
8927 if (SOUNDS[userSettings.soundsFile]) {
8928 file = userSettings.soundsFile;
8929 }
8930
8931 if (!file || file == 'AUTO') {
8932 file = '_sound/defaultNotification';
8933
8934 var data = convertCodeToData(REALPONY);
8935 if (data.soundNotif) {
8936 file = data.soundNotif;
8937 }
8938 }
8939
8940 if (userSettings.soundsNotifTypeBlacklist) {
8941 var current = userSettings.soundsNotifTypeBlacklist.split('|');
8942
8943 if (current.indexOf(gt.notif_type) != -1) {
8944 return;
8945 }
8946 }
8947
8948 try {
8949 var finalfile = THEMEURL+file+'.EXT';
8950 if (gt.notif_type == 'poke' && CURRENTSTACK.stack == 'pony') {
8951 finalfile = THEMEURL+'_sound/pokeSound.EXT';
8952 }
8953
8954 var ps = initPonySound('notif', finalfile);
8955 ps.wait = 15;
8956 ps.play();
8957 } catch (e) {}
8958 }
8959 };
8960
8961 k._beepNotification_change_text = function(node, text) {
8962 if (!text) {
8963 return;
8964 }
8965 if (text.indexOf('"') != -1) {
8966 var finalText = k.textNotification(text.substring(0, text.indexOf('"')));
8967 finalText += text.substring(text.indexOf('"'), text.length);
8968 } else {
8969 var finalText = k.textNotification(text);
8970 }
8971
8972 if (node.nodeType == TEXT_NODE) {
8973 if (node.textContent != finalText) {
8974 node.textContent = finalText;
8975 }
8976 } else {
8977 if (node.innerHTML != finalText) {
8978 node.innerHTML = finalText;
8979 }
8980 }
8981 };
8982
8983 k.insightsCountryData = [
8984 ["United States of America", "United States of Amareica"]
8985 ,["Malaysia", "Marelaysia"]
8986 ,["Mexico", "Mexicolt"]
8987 ,["New Zealand", "Neigh Zealand"]
8988 ,["Philippines", "Fillypines"]
8989 ,["Singapore", "Singapony"]
8990 ,["Singapore, Singapore", "Singapony"]
8991 ];
8992 k.insightsCountry = function(dom) {
8993 domReplaceFunc(dom.target, 'breakdown-list-table', '.breakdown-list-table', function(ele) {
8994 if (ele.getAttribute('data-ponyhoof-ponified')) {
8995 return;
8996 }
8997 ele.setAttribute('data-ponyhoof-ponified', 1);
8998 $$(ele, '.breakdown-key .ufb-text-content', function(country) {
8999 country.textContent = replaceText(k.insightsCountryData, country.textContent);
9000 });
9001 });
9002 };
9003
9004 k.timelineMutualLikes = function(target) {
9005 $$(target, '.fbStreamTimelineFavStory', function(root) {
9006 $$(root, '.fbStreamTimelineFavInfoContainer', function(ele) {
9007 var done = false;
9008 loopChildText(ele, function(child) {
9009 if (done) {
9010 return;
9011 }
9012 if (child.nodeType == TEXT_NODE) {
9013 var t = k.textStandard(child.textContent);
9014 if (child.textContent != t) {
9015 child.textContent = t;
9016 done = true;
9017 }
9018 }
9019 });
9020 });
9021
9022 $$(root, '.fbStreamTimelineFavFriendContainer > .friendText > .fwn', function(ele) {
9023 loopChildText(ele, function(child) {
9024 if (child.nodeType == ELEMENT_NODE) {
9025 if (!child.href || child.href.indexOf('/browse/users/') == -1) {
9026 return;
9027 }
9028 }
9029 var t = k.textStandard(child.textContent);
9030 if (child.textContent != t) {
9031 child.textContent = t;
9032 }
9033 });
9034 });
9035 });
9036 };
9037
9038 // http://fb.com/406714556116263
9039 // http://fb.com/411361928984859
9040 k.videoStageContainer = function(target) {
9041 if (hasClass(target, 'videoStageContainer')) {
9042 addClass(k.photos_snowlift, 'ponyhoof_snowlift_video');
9043 } else if (hasClass(target, 'spotlight')) {
9044 removeClass(k.photos_snowlift, 'ponyhoof_snowlift_video');
9045 }
9046 };
9047
9048 k.uiStreamShareLikePageBox = function(target) {
9049 $$(target, '.uiStreamShareLikePageBox .uiPageLikeButton.rfloat + div > .fcg', function(ele) {
9050 var t = ele.textContent;
9051 t = t.replace(/likes/g, CURRENTSTACK['likes']);
9052 t = t.replace(/like/g, CURRENTSTACK['like']);
9053 if (ele.textContent != t) {
9054 ele.textContent = t;
9055 }
9056 });
9057 };
9058
9059 k.fbTimelineUnit = function(target) {
9060 if (!hasClass(target, 'fbTimelineUnit')) {
9061 return;
9062 }
9063 if (target.childNodes && target.childNodes.length) {
9064 if (hasClass(target.childNodes[1], 'pageFriendSummaryContainer')) {
9065 var headerText = target.childNodes[1].getElementsByClassName('headerText');
9066 if (!headerText.length) {
9067 return;
9068 }
9069 headerText = headerText[0];
9070
9071 // Friend(s)
9072 $$(headerText, '.fwb > a', function(link) {
9073 var t = link.textContent;
9074 t = t.replace(/\bFriends\b/, capitaliseFirstLetter(CURRENTSTACK['friends']));
9075 t = t.replace(/\bFriend\b/, capitaliseFirstLetter(CURRENTSTACK['friend']));
9076 if (link.textContent != t) {
9077 link.textContent = t;
9078 }
9079 });
9080
9081 // Like(s) PAGENAME
9082 $$(headerText, '.fcg', function(fcg) {
9083 var split = fcg.textContent.split(' ');
9084 var t = split[0];
9085 t = t.replace(/\bLikes\b/, capitaliseFirstLetter(CURRENTSTACK['likes']));
9086 t = t.replace(/\bLike\b/, capitaliseFirstLetter(CURRENTSTACK['like']));
9087 if (split[0] != t) {
9088 split[0] = t;
9089 fcg.textContent = split.join(' ');
9090 }
9091 });
9092
9093 return;
9094 }
9095
9096 // Brohoofs section at pages
9097 var liked_pages_timeline_unit_list = $('liked_pages_timeline_unit_list');
9098 if (liked_pages_timeline_unit_list) {
9099 $$(liked_pages_timeline_unit_list, '._42ef .fcg', function(fcg) {
9100 loopChildText(fcg, function(child) {
9101 // <a href="/browse/friended_fans_of/?page_id=X" ajaxify="/ajax/browser/dialog/friended_fans_of/?page_id=X" rel="dialog" role="button">4 friends</a>
9102 // also like this.
9103 var t = child.textContent;
9104 t = k.textStandard(t);
9105 if (child.textContent != t) {
9106 child.textContent = t;
9107 }
9108 });
9109 });
9110 }
9111 }
9112 };
9113
9114 k._dialog_insertReadme = function(body) {
9115 var done = false;
9116 $$(body, '._22i .uiToken > input[type="hidden"]', function(input) { // @cx
9117 if (done) {
9118 return;
9119 }
9120 if (input.getAttribute('name') == 'undefined[]' && isPonyhoofPage(input.value)) { // undefined[] is intentional from FB, NOT A BUG
9121 addClass(body, 'ponyhoof_composer_hasReadme');
9122
9123 var n = d.createElement('iframe');
9124 n.className = 'ponyhoof_page_readme';
9125 n.scrolling = 'auto';
9126 n.frameborder = '0';
9127 n.allowtransparency = 'true';
9128 n.src = PONYHOOF_README;
9129 body.appendChild(n);
9130
9131 done = true;
9132 }
9133 });
9134 };
9135
9136 k._dialog_playSound = function(title, outer) {
9137 if (!title) {
9138 return;
9139 }
9140 var lowercase = title.toLowerCase();
9141 for (var i = 0, len = dialogDerpTitles.length; i < len; i += 1) {
9142 if (dialogDerpTitles[i].toLowerCase() == lowercase) {
9143 if (outer) {
9144 addClass(outer, 'ponyhoof_fbdialog_derp');
9145 }
9146
9147 if (CURRENTSTACK.stack == 'pony' && userSettings.sounds && !isPageHidden()) {
9148 var ps = initPonySound('ijustdontknowwhatwentwrong', THEMEURL+'_sound/ijustdontknowwhatwentwrong.EXT');
9149 ps.wait = 5;
9150 ps.play();
9151 break;
9152 }
9153 }
9154 }
9155 };
9156
9157 k.ponyhoofPageOptions = function(dom) {
9158 if (!$('pagelet_timeline_page_actions')) {
9159 return;
9160 }
9161 if ($('ponyhoof_footer_options')) {
9162 return;
9163 }
9164
9165 var selector = dom.target.querySelector('#pagelet_timeline_page_actions .fbTimelineActionSelector');
9166 if (!selector) {
9167 return;
9168 }
9169 var menu = selector.getElementsByClassName('uiMenuInner');
9170 if (!menu.length) {
9171 return;
9172 }
9173 menu = menu[0];
9174 var whatpage = menu.querySelector('#fbpage_share_action a');
9175 if (!whatpage) {
9176 return;
9177 }
9178 if (whatpage.getAttribute('href').indexOf('p[]='+PONYHOOF_PAGE) != -1) {
9179 var button = selector.getElementsByClassName('fbTimelineActionSelectorButton');
9180 if (!button.length) {
9181 return;
9182 }
9183 button = button[0];
9184
9185 var sep = d.createElement('li');
9186 sep.className = 'uiMenuSeparator';
9187
9188 var a = d.createElement('a');
9189 a.className = 'itemAnchor';
9190 a.setAttribute('role', 'menuitem');
9191 a.setAttribute('tabindex', '0');
9192 a.href = '#';
9193 a.id = "ponyhoof_footer_options";
9194 a.innerHTML = '<span class="itemLabel fsm">'+CURRENTLANG.options_title+'</span>';
9195 a.addEventListener('click', function(e) {
9196 optionsOpen();
9197
9198 try {
9199 clickLink(button);
9200 } catch (ex) {}
9201
9202 e.preventDefault();
9203 }, false);
9204
9205 var li = d.createElement('li');
9206 li.className = 'uiMenuItem ponyhoof_fbmenuitem';
9207 li.setAttribute('data-label', CURRENTLANG.options_title);
9208 li.setAttribute('data-ponyhoof-menuitem-orig', CURRENTLANG.options_title);
9209 li.setAttribute('data-ponyhoof-menuitem-text', CURRENTLANG.options_title);
9210 li.appendChild(a);
9211
9212 menu.insertBefore(sep, menu.firstChild);
9213 menu.insertBefore(li, sep);
9214 }
9215 };
9216
9217 k.debug_betaFacebookBaseRewrote = false;
9218 k.debug_betaFacebookLinks = function(target) {
9219 if (!k.debug_betaFacebookBaseRewrote) {
9220 contentEval(function(arg) {
9221 try {
9222 if (typeof window.requireLazy == 'function') {
9223 window.requireLazy(['Env'], function(Env) {
9224 Env.www_base = window.location.protocol+'//'+window.location.hostname+'/';
9225 });
9226 }
9227 } catch (e) {
9228 if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
9229 console.log("Unable to hook to Env");
9230 console.dir(e);
9231 }
9232 }
9233 }, {"CANLOG":CANLOG});
9234 k.debug_betaFacebookBaseRewrote = true;
9235 }
9236 var links = target.querySelectorAll('a[href^="http://www.facebook.com"], a[href^="https://www.facebook.com"]');
9237 for (var i = 0, len = links.length; i < len; i += 1) {
9238 var link = links[i];
9239 var href = link.href;
9240 href = href.replace(/http\:\/\/www.facebook.com\//, 'http://beta.facebook.com/');
9241 href = href.replace(/https\:\/\/www.facebook.com\//, 'https://beta.facebook.com/');
9242
9243 link.href = href;
9244 }
9245 };
9246
9247 // Mutation
9248 k.mutateCharacterData = function(mutation) {
9249 var parent = null;
9250 if (mutation.target && mutation.target.parentNode) {
9251 parent = mutation.target.parentNode;
9252 if (parent.tagName.toUpperCase() == 'ABBR') {
9253 return;
9254 }
9255 }
9256
9257 if (userSettings.debug_mutationDebug) {
9258 try {
9259 console.log('characterData:');
9260 if (!ISFIREFOX) {
9261 console.dir(mutation.target);
9262 }
9263 } catch (e) {}
9264 }
9265
9266 k.textNodes({target: mutation.target});
9267
9268 if (!parent) {
9269 return;
9270 }
9271 var id = parent.getAttribute(k.REACTATTRNAME);
9272 if (id) {
9273 if (parent.rel == 'dialog') {
9274 if (parent.getAttribute('ajaxify').indexOf('/ajax/browser/dialog/likes') == 0) {
9275 k.getParent(parent, function(likesentence) {
9276 return hasClass(likesentence, 'UFILikeSentence');
9277 }, function(likesentence) {
9278 if (likesentence) {
9279 k._likePostBox(likesentence);
9280 }
9281 });
9282 }
9283 } else if (hasClass(parent.parentNode, 'UFIPagerLink')) {
9284 k.ufiPagerLink({target: parent.parentNode.parentNode});
9285 } else if (hasClass(parent, 'ponyhoof_brohoof_button')) {
9286 k._commentLikeLink(parent);
9287 } else if (parent.nextSibling && hasClass(parent.nextSibling, 'UFIOrderingModeSelectorDownCaret')) {
9288 k.UFIOrderingMode(parent);
9289 } else {
9290 if (parent.parentNode && parent.parentNode.parentNode) {
9291 //if (hasClass(parent.parentNode.parentNode, 'UFIImageBlockContent') || (parent.parentNode.parentNode.parentNode && hasClass(parent.parentNode.parentNode.parentNode, 'UFIImageBlockContent'))) {
9292 if (hasClass(parent.parentNode.parentNode, 'UFILikeSentenceText') || (parent.parentNode.parentNode.parentNode && hasClass(parent.parentNode.parentNode.parentNode, 'UFILikeSentenceText'))) {
9293 // live commenting
9294 // You and John brohoof this.
9295 // You like this.
9296 var ufi = k.getReactUfi(parent);
9297 if (ufi) {
9298 k.postLike({target: ufi});
9299 }
9300 } else {
9301 if (hasClass(parent.parentNode.parentNode, k.notification_textClass[0]) || hasClass(parent.parentNode.parentNode, k.notification_textClass[1])) {
9302 // gosh, i dislike this...
9303 k.getParent(parent, function(notificationItem) {
9304 return hasClass(notificationItem, k.notification_itemClass[0]) || hasClass(notificationItem, k.notification_itemClass[1]);
9305 }, function(notificationItem) {
9306 if (!notificationItem) {
9307 return;
9308 }
9309
9310 var i = 0;
9311 if (hasClass(notificationItem, k.notification_itemClass[1])) {
9312 i = 1;
9313 }
9314
9315 k._notification_change(notificationItem, '.'+k.notification_textClass[i]+' > span', k._notification_react_metadata);
9316 });
9317 }
9318 }
9319 }
9320 }
9321 }
9322 };
9323
9324 k.mutateAttributes = function(mutation) {
9325 //if (mutation.attributeName.indexOf('data-ponyhoof-') == 0) {
9326 // return;
9327 //}
9328 var target = mutation.target;
9329 if (mutation.attributeName == 'title') {
9330 if (target.title == target.getAttribute('data-ponyhoof-title-modified')) {
9331 return;
9332 }
9333 }
9334 switch (mutation.attributeName) {
9335 case 'title':
9336 var id = target.getAttribute(k.REACTATTRNAME);
9337 if (id) {
9338 if (hasClass(target, 'UFILikeLink')) {
9339 if (target.title == '' && mutation.oldValue != '') { // thanks a lot Hover Zoom
9340 target.setAttribute('data-ponyhoof-title', mutation.oldValue);
9341 target.setAttribute('data-ponyhoof-title-modified', mutation.oldValue);
9342 } else {
9343 var orig = target.title;
9344 var t = orig;
9345 t = t.replace(/\bcomment\b/, "friendship letter");
9346 t = t.replace(/\bLike this \b/, capitaliseFirstLetter(CURRENTSTACK.like)+' this ');
9347 t = t.replace(/\bUnlike this \b/, capitaliseFirstLetter(CURRENTSTACK.unlike)+' this ');
9348 t = t.replace(/\bunlike this \b/, CURRENTSTACK.unlike+' this ');
9349 t = t.replace(/\bliking this \b/, CURRENTSTACK.liking+' this ');
9350
9351 if (target.title != t) {
9352 target.title = t;
9353 }
9354 target.setAttribute('data-ponyhoof-title', orig);
9355 target.setAttribute('data-ponyhoof-title-modified', t);
9356 }
9357 }
9358 }
9359 break;
9360
9361 /*case 'value':
9362 if (/*(target.parentNode && hasClass(target.parentNode, 'uiButton')) || * /hasClass(target, 'ufb-button-input')) {
9363 var button = target.parentNode;
9364 if (button) {
9365 var orig = target.value;
9366 var replaced = replaceText(buttonTitles, orig);
9367 if (/*hasClass(button, 'uiButton') || * /hasClass(button, 'ufb-button')) {
9368 if (button.getAttribute('data-hover') != 'tooltip') {
9369 if (orig != replaced) {
9370 if (button.title == '') {
9371 button.title = orig;
9372 } else {
9373 if (button.title == button.getAttribute('data-ponyhoof-button-orig')) {
9374 button.title = orig;
9375 }
9376 }
9377 } else {
9378 button.title = '';
9379 }
9380 }
9381 button.setAttribute('data-ponyhoof-button-orig', orig);
9382 button.setAttribute('data-ponyhoof-button-text', replaced);
9383 }
9384 if (orig != replaced) {
9385 target.value = replaced;
9386 }
9387 }
9388 }
9389 break;*/
9390
9391 default:
9392 break;
9393 }
9394 };
9395
9396 // Utilities
9397 k.getParent = function(ele, iffunc, func) {
9398 var outer = ele.parentNode;
9399 while (outer) {
9400 if (iffunc(outer)) {
9401 break;
9402 }
9403 outer = outer.parentNode;
9404 }
9405
9406 func(outer);
9407 };
9408
9409 k.changeButtonText = function(button, t) {
9410 if (button.tagName.toUpperCase() == 'INPUT') {
9411 button.value = t;
9412 } else {
9413 button.innerHTML = t;
9414 }
9415 };
9416
9417 // Delays and let Facebook finish changing the DOM
9418 // Note that this shouldn't be a problem when MutationObserver is used full-time
9419 k.delayIU = function(func, delay) {
9420 var delay = delay || 10;
9421
9422 if (USINGMUTATION) {
9423 func();
9424 return;
9425 }
9426
9427 w.setTimeout(function() {
9428 var iu = INTERNALUPDATE;
9429 INTERNALUPDATE = true;
9430 func();
9431 INTERNALUPDATE = iu;
9432 }, delay);
9433 };
9434
9435 k.getReactUfi = function(ele) {
9436 // .reactRoot[3].[1][0].0.[1].0.0.[2]
9437 var finalid = k.getReactId(ele);
9438
9439 var ufi = d.querySelector('div['+k.REACTATTRNAME+'=".r['+finalid+']"]');
9440 if (ufi && hasClass(ufi, 'UFIList')) {
9441 return ufi;
9442 }
9443
9444 // Rollback to old method
9445 k.getParent(ele, function(ufiitem) {
9446 return hasClass(ufiitem, 'UFIList');
9447 }, function(ufiitem) {
9448 ufi = ufiitem;
9449 });
9450 return ufi;
9451 };
9452
9453 k.getReactCommentComponent = function(ele) {
9454 // .reactRoot[3].[1][2][1]{comment105273202993369_7901}.0.[1].0.[1].0.[1].[2]
9455 // .reactRoot[1].:1:1:1:comment558202387555478_1973546.:0.:1.:0.:1.:0
9456 var id = ele.getAttribute(k.REACTATTRNAME);
9457 if (!id) {
9458 return false;
9459 }
9460 var open = id.indexOf('{comment');
9461 var close = '}';
9462 var closeCount = 1;
9463 if (open == -1) {
9464 open = id.indexOf(':comment');
9465 if (open == -1) {
9466 return false;
9467 }
9468 close = '.:';
9469 closeCount = 0;
9470 }
9471 var subEnd = id.substring(open, id.length).indexOf(close);
9472 var component = id.substring(0, open+subEnd+closeCount);
9473
9474 return component;
9475 };
9476
9477 k.getReactComment = function(ele) {
9478 var component = k.getReactCommentComponent(ele);
9479
9480 var comment = d.querySelector('div['+k.REACTATTRNAME+'="'+component+'"]');
9481 if (comment && hasClass(comment, 'UFIComment')) {
9482 return comment;
9483 }
9484
9485 // Rollback to old method
9486 k.getParent(ele, function(ufiitem) {
9487 return hasClass(ufiitem, 'UFIComment');
9488 }, function(ufiitem) {
9489 comment = ufiitem;
9490 });
9491 return comment;
9492 };
9493
9494 k.getTrackingNode = function(ele) {
9495 var trackingNode = ele.getAttribute('data-ft');
9496 if (trackingNode) {
9497 try {
9498 trackingNode = JSON.parse(trackingNode);
9499 return trackingNode.tn;
9500 } catch (e) {}
9501 }
9502 return false;
9503 };
9504
9505 // Ignore irrelevant tags and some classes
9506 k.shouldIgnore = function(dom) {
9507 if (dom.target.nodeType == 8) { // comments
9508 return true;
9509 }
9510
9511 if (dom.target.nodeType != 3) {
9512 var tn = dom.target.tagName.toUpperCase();
9513 if (tn == 'SCRIPT' || tn == 'STYLE' || tn == 'LINK' || tn == 'INPUT' || tn == 'BR' || tn == 'META') {
9514 return true;
9515 }
9516 }
9517
9518 if (dom.target.parentNode && /(DOMControl_shadow|highlighterContent|textMetrics)/.test(dom.target.parentNode.className)) {
9519 return true;
9520 }
9521
9522 return false;
9523 };
9524
9525 k.dumpConsole = function(dom) {
9526 if (!userSettings.debug_dominserted_console) {
9527 return;
9528 }
9529
9530 if (dom.target.nodeType == 8) { // comments
9531 return;
9532 }
9533
9534 if (dom.target.nodeType == 3) {
9535 if (dom.target.parentNode && dom.target.parentNode.tagName.toUpperCase() != 'ABBR') {
9536 if (typeof console !== 'undefined' && console.dir) {
9537 console.dir(dom.target);
9538 }
9539 }
9540 return;
9541 }
9542
9543 var id = dom.target.getAttribute('id');
9544 if (id && (id.indexOf('bfb_') == 0 || id.indexOf('sfx_') == 0)) {
9545 return;
9546 }
9547
9548 var className = dom.target.className;
9549 if (className.indexOf('bfb_') == 0 || className.indexOf('sfx_') == 0) {
9550 return;
9551 }
9552
9553 var tagName = dom.target.tagName.toUpperCase();
9554 if (tagName != 'BODY') {
9555 if (typeof console !== 'undefined' && console.log) {
9556 console.log(dom.target.outerHTML);
9557 }
9558 }
9559 };
9560
9561 k.textBrohoof = function(ele) {
9562 var t = '';
9563 if (ele.nodeType == TEXT_NODE) {
9564 t = ele.textContent;
9565 } else {
9566 t = ele.innerHTML;
9567 }
9568 t = t.replace(/\bpeople\b/g, " "+CURRENTSTACK['people']);
9569 t = t.replace(/\bperson\b/g, " "+CURRENTSTACK['person']);
9570 t = t.replace(/likes this/g, CURRENTSTACK['likes']+" this");
9571 t = t.replace(/like this/g, CURRENTSTACK['like']+" this");
9572 t = t.replace(/Likes/g, capitaliseFirstLetter(CURRENTSTACK['likes'])); // new news feed page likes
9573 t = t.replace(/likes/g, CURRENTSTACK['likes']);
9574 t = t.replace(/like/g, CURRENTSTACK['like']);
9575 t = t.replace(/talking about this/g, "blabbering about this");
9576 t = t.replace(/\bfriends\b/g, CURRENTSTACK['friends_logic']);
9577 t = t.replace(/\bfriend\b/g, CURRENTSTACK['friend_logic']);
9578 if (ele.nodeType == TEXT_NODE) {
9579 if (ele.textContent != t) {
9580 ele.textContent = t;
9581 }
9582 } else {
9583 if (ele.innerHTML != t) {
9584 ele.innerHTML = t;
9585 }
9586 }
9587 };
9588
9589 k.textStandard = function(t) {
9590 t = t.replace(/\bpeople\b/g, " "+CURRENTSTACK['people']);
9591 t = t.replace(/\bfriends\b/g, " "+CURRENTSTACK['friends_logic']);
9592 t = t.replace(/\bfriend\b/g, " "+CURRENTSTACK['friend_logic']);
9593 t = t.replace(/\blikes\b/g, " "+CURRENTSTACK['likes_past']);
9594 t = t.replace(/\blike\b/g, " "+CURRENTSTACK['like_past']);
9595 return t;
9596 };
9597
9598 k.textNotification = function(t) {
9599 t = t.replace(/\bpeople\b/g, " "+CURRENTSTACK['people']);
9600 t = t.replace(/\(friends\b/g, "("+CURRENTSTACK['friends_logic']);
9601 t = t.replace(/\bfriends\b/g, " "+CURRENTSTACK['friends_logic']);
9602 t = t.replace(/\binvited you to like\b/g, " invited you to "+CURRENTSTACK.like);
9603 t = t.replace(/\blikes\b/g, " "+CURRENTSTACK['likes_past']);
9604 t = t.replace(/\blike\b/g, " "+CURRENTSTACK['like_past']);
9605
9606 t = t.replace(/\bcomment\b/g, "friendship letter");
9607 t = t.replace(/\bphoto\b/g, "pony pic");
9608 t = t.replace(/\bphotos\b/g, "pony pics");
9609 t = t.replace(/\bgroup\b/g, "herd");
9610 t = t.replace(/\bevent\b/g, "adventure");
9611 t = t.replace(/\btimeline\b/g, "journal");
9612 t = t.replace(/\bTimeline Review\b/g, "Journal Review");
9613 t = t.replace(/\bTimeline\b/g, "Journal"); // English UK
9614 t = t.replace(/\bnew messages\b/, "new friendship reports");
9615 t = t.replace(/\bnew message\b/, "new friendship report");
9616 t = t.replace(/\bprofile picture\b/g, "journal pony pic");
9617 t = t.replace(/\bfriend request\b/g, "friendship request");
9618 t = t.replace(/\bpoked you/g, " nuzzled you");
9619 return t;
9620 };
9621 };
9622 var _optionsLinkInjected = false;
9623 var injectOptionsLink = function() {
9624 if (_optionsLinkInjected) {
9625 return;
9626 }
9627
9628 if ($('logout_form')) {
9629 _optionsLinkInjected = true;
9630
9631 var optionsLink = d.createElement('a');
9632 optionsLink.href = '#';
9633 optionsLink.id = 'ponyhoof_account_options';
9634 optionsLink.className = 'navSubmenu submenuNav'; // submenuNav is for developers.facebook.com
9635 optionsLink.innerHTML = CURRENTLANG.options_title+" <span class='ponyhoof_hide_if_injected inline'>(Disabled)</span>";
9636 optionsLink.addEventListener('click', function(e) {
9637 optionsOpen();
9638
9639 try {
9640 clickLink($('navAccountLink'));
9641 } catch (e) {}
9642 try {
9643 clickLink($('accountNavArrow'));
9644 } catch (e) {}
9645
9646 e.preventDefault();
9647 }, false);
9648
9649 var optionsLinkLi = d.createElement('li');
9650 optionsLinkLi.setAttribute('role', 'menuitem');
9651 optionsLinkLi.appendChild(optionsLink);
9652
9653 var logout = $('logout_form');
9654 logout.parentNode.parentNode.insertBefore(optionsLinkLi, logout.parentNode);
9655 } else {
9656 var pageNav = $('pageNav');
9657 if (!pageNav) {
9658 return;
9659 }
9660
9661 var isBusiness = pageNav.querySelector('.navLink[href*="logout.php?h="]');
9662 if (!isBusiness) {
9663 return;
9664 }
9665
9666 _optionsLinkInjected = true;
9667
9668 var optionsLink = d.createElement('a');
9669 optionsLink.href = '#';
9670 optionsLink.id = 'ponyhoof_account_options';
9671 optionsLink.className = 'navLink';
9672 optionsLink.innerHTML = CURRENTLANG.options_title+" <span class='ponyhoof_hide_if_injected inline'>(Disabled)</span>";
9673 optionsLink.addEventListener('click', function(e) {
9674 optionsOpen();
9675 e.preventDefault();
9676 }, false);
9677
9678 var optionsLinkLi = d.createElement('li');
9679 optionsLinkLi.className = 'navItem middleItem';
9680 optionsLinkLi.appendChild(optionsLink);
9681
9682 pageNav.insertBefore(optionsLinkLi, pageNav.childNodes[0]);
9683 }
9684 };
9685
9686 var domNodeHandlerMain = new domNodeHandler();
9687 var mutationObserverMain = null;
9688
9689 var ranDOMNodeInserted = false;
9690 var runDOMNodeInserted = function() {
9691 if (ranDOMNodeInserted) {
9692 return false;
9693 }
9694
9695 ranDOMNodeInserted = true;
9696
9697 onPageReady(function() {
9698 if (d.body) {
9699 DOMNodeInserted({target: d.body});
9700 }
9701 });
9702
9703 if (!userSettings.debug_noMutationObserver) {
9704 try {
9705 var mutationObserver = w.WebKitMutationObserver || w.MutationObserver || false;
9706 if (mutationObserver) {
9707 var observerOptions = {attributes:true, childList:true, characterData:true, subtree:true, attributeOldValue:true, attributeFilter:['title'/*, 'class', 'value'*/]};
9708 mutationObserverMain = new mutationObserver(function(mutations) {
9709 if (INTERNALUPDATE) {
9710 return;
9711 }
9712 mutationObserverMain.disconnect();
9713
9714 for (var i = 0, len = mutations.length; i < len; i += 1) {
9715 switch (mutations[i].type) {
9716 case 'characterData':
9717 var iu = INTERNALUPDATE;
9718 INTERNALUPDATE = true;
9719
9720 domNodeHandlerMain.mutateCharacterData(mutations[i]);
9721
9722 INTERNALUPDATE = iu;
9723 break;
9724
9725 case 'childList':
9726 for (var j = 0, jlen = mutations[i].addedNodes.length; j < jlen; j += 1) {
9727 if (userSettings.debug_mutationDebug) {
9728 if (mutations[i].addedNodes[j].parentNode && mutations[i].addedNodes[j].parentNode.tagName != 'ABBR') {
9729 try {
9730 console.log('childList:');
9731 if (!ISFIREFOX) {
9732 console.dir(mutations[i].addedNodes[j]);
9733 } else {
9734 if (typeof mutations[i].addedNodes[j].className == 'undefined') {
9735 console.dir(mutations[i].addedNodes[j]);
9736 } else {
9737 //console.log(' '+mutations[i].addedNodes[j].className);
9738 //console.log(' '+mutations[i].addedNodes[j].innerHTML);
9739 }
9740 }
9741 } catch (e) {}
9742 }
9743 }
9744 DOMNodeInserted({target: mutations[i].addedNodes[j]});
9745 }
9746 break;
9747
9748 case 'attributes':
9749 var iu = INTERNALUPDATE;
9750 INTERNALUPDATE = true;
9751
9752 domNodeHandlerMain.mutateAttributes(mutations[i]);
9753
9754 INTERNALUPDATE = iu;
9755 break;
9756
9757 default:
9758 break;
9759 }
9760 }
9761 if (userSettings.debug_mutationDebug) {
9762 console.log('=========================================');
9763 }
9764 mutationObserverMain.observe(d.documentElement, observerOptions);
9765 });
9766 mutationObserverMain.observe(d.documentElement, observerOptions);
9767 USINGMUTATION = true;
9768 }
9769 } catch (e) {
9770 warn("MutationObserver threw an exception, fallback to DOMNodeInserted");
9771 dir(e);
9772 }
9773 }
9774 if (!USINGMUTATION) {
9775 d.addEventListener('DOMNodeInserted', DOMNodeInserted, true);
9776 }
9777
9778 if (d.body) {
9779 DOMNodeInserted({target: d.body});
9780 }
9781 };
9782
9783 var turnOffFbNotificationSound = function() {
9784 contentEval(function(arg) {
9785 try {
9786 if (typeof window.requireLazy == 'function') {
9787 window.requireLazy(['NotificationSound'], function(NotificationSound) {
9788 NotificationSound.prototype.play = function() {};
9789 });
9790 }
9791 } catch (e) {
9792 if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
9793 console.log("Unable to hook to NotificationSound");
9794 console.dir(e);
9795 }
9796 }
9797 }, {"CANLOG":CANLOG});
9798 };
9799
9800 var changeChatSound = function(code) {
9801 onPageReady(function() {
9802 contentEval(function(arg) {
9803 try {
9804 if (typeof window.requireLazy == 'function') {
9805 window.requireLazy(['ChatConfig'], function(ChatConfig) {
9806 ChatConfig.set('sound.notif_ogg_url', arg.THEMEURL+arg.code+'.ogg');
9807 ChatConfig.set('sound.notif_mp3_url', arg.THEMEURL+arg.code+'.mp3');
9808 });
9809 }
9810 } catch (e) {
9811 if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
9812 console.log("Unable to hook to ChatConfig");
9813 console.dir(e);
9814 }
9815 }
9816 }, {"CANLOG":CANLOG, "THEMEURL":THEMEURL, 'code':code});
9817 });
9818 };
9819
9820 var ranExtraInjection = false;
9821 var extraInjection = function() {
9822 if (ranExtraInjection) {
9823 return false;
9824 }
9825 ranExtraInjection = true;
9826
9827 for (var x in HTMLCLASS_SETTINGS) {
9828 if (userSettings[HTMLCLASS_SETTINGS[x]]) {
9829 addClass(d.documentElement, 'ponyhoof_settings_'+HTMLCLASS_SETTINGS[x]);
9830 }
9831 }
9832
9833 var globalcss = '';
9834 globalcss += 'html.ponyhoof_settings_show_messages_other #navItem_app_217974574879787 > ul {display:block !important;}';
9835 globalcss += '.ponyhoof_page_readme {width:100%;height:300px;border:solid #B4BBCD;border-width:1px 0;-moz-box-sizing:border-box;box-sizing:border-box;}';
9836 globalcss += '#fbIndex_swf {position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;}';
9837 globalcss += '.ponyhoof_image_shadow {-moz-box-shadow:0 3px 8px rgba(0,0,0,.3);box-shadow:0 3px 8px rgba(0,0,0,.3);margin:0 auto;display:block;margin-bottom:3px;cursor:not-allowed;-webkit-user-drag:none;-moz-user-drag:none;user-drag:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;}';
9838 globalcss += '.ponyhoof_image_shadow.noshadow {-moz-box-shadow:none;box-shadow:none;}';
9839
9840 injectManualStyle(globalcss, 'global');
9841
9842 if (userSettings.customcss) {
9843 injectManualStyle(userSettings.customcss, 'customcss');
9844 }
9845
9846 INTERNALUPDATE = true;
9847 for (var i = 0; i < 10; i += 1) {
9848 var n = d.createElement('div');
9849 n.id = 'ponyhoof_extra_'+i;
9850 d.body.appendChild(n);
9851 }
9852
9853 var timeShift = function() {
9854 var now = new Date();
9855
9856 d.documentElement.setAttribute('data-ponyhoof-year', now.getFullYear());
9857 d.documentElement.setAttribute('data-ponyhoof-month', now.getMonth());
9858 d.documentElement.setAttribute('data-ponyhoof-date', now.getDate());
9859 d.documentElement.setAttribute('data-ponyhoof-hour', now.getHours());
9860 d.documentElement.setAttribute('data-ponyhoof-minute', now.getMinutes());
9861 };
9862 timeShift();
9863 w.setInterval(timeShift, 60*1000);
9864
9865 if (userSettings.chatSound) {
9866 if (!SOUNDS_CHAT[userSettings.chatSoundFile] || !SOUNDS_CHAT[userSettings.chatSoundFile].name) {
9867 userSettings.chatSoundFile = '_sound/grin2';
9868 }
9869 if (typeof w.Audio != 'undefined') {
9870 changeChatSound(userSettings.chatSoundFile);
9871 }
9872 }
9873
9874 if (userSettings.customBg) {
9875 changeCustomBg(userSettings.customBg);
9876 }
9877
9878 // Turn off Facebook's own notification sound
9879 if (userSettings.sounds) {
9880 turnOffFbNotificationSound();
9881 }
9882
9883 INTERNALUPDATE = false;
9884 };
9885
9886 var detectBrokenFbStyle = function() {
9887 var test = d.createElement('div');
9888 test.className = 'hidden_elem';
9889 d.documentElement.appendChild(test);
9890
9891 var style = w.getComputedStyle(test, null);
9892 if (style && style.display != 'none') {
9893 d.documentElement.removeChild(test);
9894
9895
9896 return true;
9897 }
9898 d.documentElement.removeChild(test);
9899 return false;
9900 };
9901
9902 // Wait for the current page to complete
9903 var scriptStarted = false;
9904 function startScript() {
9905 if (scriptStarted) {
9906 return;
9907 }
9908 scriptStarted = true;
9909
9910 // Don't run on exclusions
9911 if (w.location.hostname.indexOf('.facebook.com') == w.location.hostname.length-'.facebook.com'.length) {
9912 var excludes = ['/l.php', '/ai.php', '/ajax/'];
9913 for (var i = 0, len = excludes.length; i < len; i += 1) {
9914 if (w.location.pathname.indexOf(excludes[i]) == 0) {
9915 return;
9916 }
9917 }
9918 }
9919
9920 // Don't run on ajaxpipe
9921 if (w.location.search && w.location.search.indexOf('ajaxpipe=1') != -1) {
9922 return;
9923 }
9924
9925 // Don't run on Browser Ponies
9926 if (w.location.hostname == 'hoof.little.my') {
9927 var excludes = ['.gif', '.png'];
9928 for (var i = 0, len = excludes.length; i < len; i += 1) {
9929 if (w.location.pathname.indexOf(excludes[i]) != -1) {
9930 return;
9931 }
9932 }
9933 }
9934
9935 // Don't run on Open Graph Debugger
9936 if (w.location.hostname.indexOf('developers.') != -1 && w.location.hostname.indexOf('.facebook.com') != -1 && w.location.pathname == '/tools/debug/og/echo') {
9937 return;
9938 }
9939
9940 if (w.location.hostname == '0.facebook.com') {
9941 return;
9942 }
9943
9944 if (!d.head) {
9945 d.head = d.getElementsByTagName('head')[0];
9946 }
9947
9948 // Are we running in a special Ponyhoof page?
9949 if (d.documentElement.id == 'ponyhoof_page') {
9950 // Modify the <html> tag
9951 addClass(d.documentElement, 'ponyhoof_userscript');
9952 d.documentElement.setAttribute('data-ponyhoof-userscript-version', VERSION);
9953
9954 var changeVersion = function() {
9955 var v = d.getElementsByClassName('ponyhoof_VERSION');
9956 for (var i = 0, len = v.length; i < len; i += 1) {
9957 v[i].textContent = VERSION;
9958 }
9959 };
9960 changeVersion();
9961 onPageReady(changeVersion);
9962
9963 try {
9964 if (d.documentElement.getAttribute('data-ponyhoof-update-current') > VERSION) {
9965 addClass(d.documentElement, 'ponyhoof_update_outdated');
9966 } else {
9967 addClass(d.documentElement, 'ponyhoof_update_newest');
9968 }
9969 } catch (e) {}
9970 }
9971
9972 // Determine what storage method to use
9973 STORAGEMETHOD = 'none';
9974 try {
9975 if (typeof GM_getValue === 'function' && typeof GM_setValue === 'function') {
9976 // Chrome lies about GM_getValue support
9977 GM_setValue("ponyhoof_test", "ponies");
9978 if (GM_getValue("ponyhoof_test") === "ponies") {
9979 STORAGEMETHOD = 'greasemonkey';
9980 }
9981 }
9982 } catch (e) {}
9983
9984 if (STORAGEMETHOD == 'none') {
9985 try {
9986 if (typeof chrome != 'undefined' && chrome && chrome.extension && typeof GM_getValue == 'undefined') {
9987 STORAGEMETHOD = 'chrome';
9988 }
9989 } catch (e) {}
9990 }
9991
9992 if (STORAGEMETHOD == 'none') {
9993 try {
9994 if (typeof opera != 'undefined' && opera && opera.extension) {
9995 STORAGEMETHOD = 'opera';
9996 }
9997 } catch (e) {}
9998 }
9999
10000 if (STORAGEMETHOD == 'none') {
10001 try {
10002 if (typeof safari != 'undefined') {
10003 STORAGEMETHOD = 'safari';
10004 }
10005 } catch (e) {}
10006 }
10007
10008 if (STORAGEMETHOD == 'none') {
10009 if (DISTRIBUTION == 'xpi') {
10010 STORAGEMETHOD = 'xpi';
10011 }
10012 }
10013
10014 if (STORAGEMETHOD == 'none') {
10015 if (DISTRIBUTION == 'mxaddon') {
10016 STORAGEMETHOD = 'mxaddon';
10017 }
10018 }
10019
10020 if (STORAGEMETHOD == 'none') {
10021 STORAGEMETHOD = 'localstorage';
10022 }
10023
10024 if (d.documentElement.id == 'ponyhoof_page') {
10025 addClass(d.documentElement, 'ponyhoof_distribution_'+DISTRIBUTION);
10026 addClass(d.documentElement, 'ponyhoof_storagemethod_'+STORAGEMETHOD);
10027 return;
10028 }
10029
10030 // Inject the system style so we can do any error trapping
10031 injectSystemStyle();
10032
10033 // Grab the user
10034 USERID = cookie('c_user');
10035 if (!USERID) {
10036 USERID = 0;
10037 } else {
10038 SETTINGSPREFIX = USERID+'_';
10039 }
10040
10041 loadSettings(function(s) {
10042 userSettings = s;
10043
10044 loadSettings(function(s) {
10045 globalSettings = s;
10046
10047 if (userSettings.debug_slow_load) {
10048 onPageReady(settingsLoaded);
10049 return;
10050 }
10051 settingsLoaded();
10052 }, {prefix:'global_', defaultSettings:GLOBALDEFAULTSETTINGS});
10053 });
10054 };
10055
10056 // Check for legacy settings through message passing
10057 var migrateSettingsChromeDone = false;
10058 var migrateSettingsChrome = function(callback) {
10059 if (STORAGEMETHOD == 'chrome') {
10060 if (chrome.storage) {
10061 try {
10062 chrome_sendMessage({'command':'getValue', 'name':SETTINGSPREFIX+'settings'}, function(response) {
10063 if (response && typeof response.val != 'undefined') {
10064 var _settings = JSON.parse(response.val);
10065 if (_settings) {
10066 userSettings = _settings;
10067 saveSettings();
10068
10069 chrome_sendMessage({'command':'clearStorage'}, function() {});
10070 }
10071
10072 migrateSettingsChromeDone = true;
10073 callback();
10074 }
10075 });
10076 } catch (e) {
10077 error("Failed to read previous settings through message passing");
10078 dir(e);
10079 migrateSettingsChromeDone = true;
10080 callback();
10081 }
10082 return;
10083 }
10084 }
10085 migrateSettingsChromeDone = true;
10086 callback();
10087 };
10088
10089 // Check for previous settings from unprefixed settings
10090 var migrateSettingsUnprefixedDone = false;
10091 var migrateSettingsUnprefixed = function(callback) {
10092 loadSettings(function(s) {
10093 if (s.lastVersion) { // only existed in previous versions
10094 userSettings = s;
10095 saveSettings();
10096 saveValue('settings', JSON.stringify(null));
10097 }
10098
10099 migrateSettingsUnprefixedDone = true;
10100 callback();
10101 }, {prefix:''});
10102 };
10103
10104 var globalSettingsTryLastUserDone = false;
10105 var globalSettingsTryLastUser = function(callback) {
10106 if (!globalSettings.lastUserId) {
10107 globalSettingsTryLastUserDone = true;
10108 callback();
10109 return;
10110 }
10111
10112 SETTINGSPREFIX = globalSettings.lastUserId+'_';
10113 loadSettings(function(s) {
10114 if (s) {
10115 userSettings = s;
10116 }
10117
10118 globalSettingsTryLastUserDone = true;
10119 callback();
10120 });
10121 };
10122
10123 function settingsLoaded() {
10124 if (!userSettings.theme && !migrateSettingsChromeDone) {
10125 migrateSettingsChrome(settingsLoaded);
10126 return;
10127 }
10128
10129 // Migrate for multi-user
10130 if (!userSettings.theme && !migrateSettingsUnprefixedDone) {
10131 migrateSettingsUnprefixed(settingsLoaded);
10132 return;
10133 }
10134
10135 if (!globalSettings.globalSettingsMigrated) {
10136 if (!userSettings.lastVersion) {
10137 // New user
10138 statTrack('install');
10139 }
10140
10141 for (var i in GLOBALDEFAULTSETTINGS) {
10142 if (userSettings.hasOwnProperty(i)) {
10143 globalSettings[i] = userSettings[i];
10144 }
10145 }
10146 globalSettings.globalSettingsMigrated = true;
10147 saveGlobalSettings();
10148 }
10149
10150 if (!USERID && !globalSettingsTryLastUserDone) {
10151 // Try loading the last user
10152 globalSettingsTryLastUser(settingsLoaded);
10153 return;
10154 }
10155
10156 // If we haven't set up Ponyhoof, don't log
10157 if (!userSettings.theme || userSettings.debug_disablelog) {
10158 CANLOG = false;
10159 }
10160
10161 // Run ONLY on #facebook
10162 if (!(d.documentElement.id == 'facebook' && w.location.hostname.indexOf('.facebook.com') == w.location.hostname.length-'.facebook.com'.length) && d.documentElement.id != 'ponyhoof_page') {
10163 info("Ponyhoof does not run on "+w.location.href+" (html id is not #facebook)");
10164 return;
10165 }
10166
10167 // Did we already run our script?
10168 if (hasClass(d.documentElement, 'ponyhoof_userscript')) {
10169 info("Style already injected at "+w.location.href);
10170 return;
10171 }
10172
10173 // Don't run in frames
10174 var forceWhiteBackground = false;
10175 try {
10176 var href = w.location.href.toLowerCase();
10177
10178 if ((href.indexOf('/plugins/like.php') != -1 || href.indexOf('/plugins/likebox.php') != -1 || href.indexOf('/plugins/subscribe.php') != -1 || href.indexOf('/plugins/facepile.php') != -1) && (href.indexOf('login/plugin_roadblock.php') == -1 && (href.indexOf('#ponyhoof_runme') != -1 || href.indexOf('&ponyhoof_runme') != -1))) {
10179 // Allow like boxes for the Ponyhoof page (yeah, a bit cheating)
10180 } else if (hasClass(d.body, 'chrmxt')) {
10181 // Allow for Facebook Notifications for Chrome
10182 } else {
10183 // Allow for some frames
10184 var allowedFrames = ['/ads/manage/powereditor/funding', '/ads/manage/powereditor/convtrack', '/mobile/iframe_emails.php'];
10185 var allowedFramesOk = false;
10186 for (var i = 0, len = allowedFrames.length; i < len; i += 1) {
10187 if (w.location.pathname.indexOf(allowedFrames[i]) == 0) {
10188 allowedFramesOk = true;
10189 forceWhiteBackground = true;
10190 }
10191 }
10192
10193 if (!allowedFramesOk) {
10194 if (USW.self != USW.top) {
10195 throw 1;
10196 }
10197 }
10198 }
10199 } catch (e) {
10200 info("Framed");
10201 return;
10202 }
10203
10204 // Special instructions for browsers that needs localStorage
10205 runMe = true;
10206 if (STORAGEMETHOD == 'localstorage') {
10207 // Don't run on non-www :(
10208 if (userSettings.force_run) {
10209 log("Force running on "+w.location.href);
10210 } else {
10211 if (w.location.hostname != 'www.facebook.com') {
10212 info("w.location.hostname = "+w.location.hostname);
10213 runMe = false;
10214 }
10215 }
10216 }
10217
10218 if (!runMe) {
10219 info("Ponyhoof style is not injected on "+w.location.href);
10220 //return;
10221 }
10222
10223 CURRENTPONY = userSettings.theme;
10224
10225 if (!USERID && !globalSettings.allowLoginScreen) {
10226 info("Ponyhoof will not run when logged out because of a setting.");
10227 return;
10228 }
10229
10230 // Ban parasprites
10231 // If you would like to end up here, just simply show us that you have no clue about what Ponyhoof is really about and keep hitting "Send page source", don't be a moron please
10232 if (USERID && ['b002a2d15003dad6a1cf694bba258ea2', 'c2480aa0cd99186aac0430f6d24ff40c', '377533fc17cfd34fae337a4c9a5e4d49', 'a078ca1d2d6a98055fa448b8367a8190', 'b85f32cf81e4153975f1e1f55fecfe58', '40ab65332ad92345ab727aadcc623906', '0147135a7dc2d1b65ca0032c97f89c5b', '6c5b9bf8a304f1a3e0b085f974c53592', '4ab4094e54225dccadf42bee9ac212a9', '2887516d877df760641ed9247cc84b65', '06308ee7060101f04a18e41158408730', 'a95ef44112c18876a808b2d7781e63ba', '57b540dc72835f30d402f6abc566677c', '1f75490e12b25ee5839687e0ffe65502', '24363cd421635e8268983f6187def3c8', '3a420678fb395a9e71ad6b523e880a27', 'd7a9db4027cd407b281c84cc626a9f70', '23d69d7ecfeeb940deef6bc69c3aee00', 'ad3553f919b97dbbb19a69966666641e', '46077eeb2467c70ec9332b672d1d7bd1', 'bc8ef81105cfdc4c6b5ff349622dae8a', 'a21ad36f4c3fc35494626d1399cc4be1', '3a2135f78503521e570608c07c3e6386', '8dc11f39765f8fe83603502afcb630a9', 'ac966d33840736554984577a78d37d95', '11abc5dd16709ff201ec00781c39ac3c', '00e957ff53a5b34518087621165498f9', '025e1b15134402df1803de9421dc7819', '125c419ddbad08ee8c53b88801415887', 'ca94af2350690962e97e1ac1fb98fa06', '62e6c5f16e8ccc79c94aa452aa36f5d8', 'cf7e6ddb2fc7c7984d323a81dfca8dfb', 'df6495bacaeb347a931f7e676fc8ee0b', 'e5ffc53255c20275e2c7d8f0c2ca5201', '31161cecf1fd9804bb66fa4e373733c6', 'cb5f2107815d30a538b30d82df93a1ac', '3a420678fb395a9e71ad6b523e880a27', 'b002c047d235437b8b255173ce73744a'].indexOf(md5(USERID)) != -1) {
10233 if (globalSettings.allowLoginScreen) {
10234 globalSettings.allowLoginScreen = false;
10235 saveGlobalSettings();
10236 }
10237 return;
10238 }
10239
10240 // If we don't have an old setting...
10241 if (userSettings.theme == null) {
10242 // ... and not logged in, DON'T show the welcome screen
10243 if (!USERID) {
10244 // Special exception at home page, we want that cool login background
10245 if (!hasClass(d.body, 'fbIndex')) {
10246 info("Ponyhoof does not run for logged out users.");
10247 return;
10248 }
10249 }
10250
10251 // Don't run on dialogs
10252 if (w.location.pathname.indexOf('/dialog/') == 0) {
10253 info("Ponyhoof does not run when there is no theme selected and running on dialogs.");
10254 return;
10255 }
10256 }
10257
10258 // v1.581: Detect broken Facebook styles and abort if derped
10259 if (userSettings.theme && detectBrokenFbStyle()) {
10260 error("Broken Facebook style: hidden_elem is not expected");
10261 return;
10262 }
10263
10264 // Modify the <html> tag
10265 addClass(d.documentElement, 'ponyhoof_userscript');
10266 addClass(d.documentElement, 'ponyhoof_storagemethod_'+STORAGEMETHOD);
10267 addClass(d.documentElement, 'ponyhoof_distribution_'+DISTRIBUTION);
10268 d.documentElement.setAttribute('data-ponyhoof-userscript-version', VERSION);
10269
10270 // CANLOG previously could be disabled before
10271 if (!userSettings.debug_disablelog) {
10272 CANLOG = true;
10273 }
10274
10275 // Load the language for the options link
10276 CURRENTLANG = LANG['en_US'];
10277 if (!userSettings.forceEnglish) {
10278 UILANG = getDefaultUiLang();
10279 if (!UILANG) {
10280 UILANG = 'en_US';
10281 } else {
10282 for (var i in LANG[UILANG]) {
10283 CURRENTLANG[i] = LANG[UILANG][i];
10284 }
10285 }
10286 }
10287
10288 // Inject Ponyhoof Options in the Account dropdown even when DOMNodeInserted is disabled
10289 onPageReady(function() {
10290 injectOptionsLink();
10291 domNodeHandlerMain.ponyhoofPageOptions({target: d.body});
10292 });
10293
10294 if (!runMe) {
10295 return;
10296 }
10297
10298 var luckyGuess = -1;
10299 if (!CURRENTPONY && globalSettings.runForNewUsers) {
10300 // If we have a "special" name, load the peferred theme for that character if we're in one
10301 try {
10302 getBronyName();
10303 for (var i = 0, len = PONIES.length; i < len; i += 1) {
10304 if (PONIES[i].users) {
10305 var lowercase = BRONYNAME.toLowerCase();
10306 for (var j = 0, jlen = PONIES[i].users.length; j < jlen; j += 1) {
10307 if (lowercase.indexOf(PONIES[i].users[j]) != -1) {
10308 // We got a match!
10309 CURRENTPONY = PONIES[i].code;
10310 luckyGuess = i;
10311 }
10312 }
10313 }
10314 }
10315 } catch (e) {
10316 error("Failed to get brony name");
10317 }
10318 }
10319
10320 // If we still don't have one, then assume none
10321 if (!CURRENTPONY) {
10322 CURRENTPONY = 'NONE';
10323 }
10324
10325 if ($('jewelFansTitle')) {
10326 ISUSINGPAGE = true;
10327 addClass(d.documentElement, 'ponyhoof_isusingpage');
10328 }
10329
10330 if (d.querySelector('#pageLogo > a[href*="/business/dashboard/"]')) {
10331 ISUSINGBUSINESS = true;
10332 addClass(d.documentElement, 'ponyhoof_isusingbusiness');
10333 }
10334
10335 // v1.401: Turn on new chat sound by default
10336 if (!userSettings.chatSound1401 && !userSettings.chatSound) {
10337 userSettings.chatSound = true;
10338 userSettings.chatSound1401 = true;
10339 saveSettings();
10340 }
10341
10342 // v1.501: Migrate previous randomSetting
10343 if (userSettings.randomSetting && !userSettings.randomSettingMigrated) {
10344 if (userSettings.randomSetting == 'mane6') {
10345 userSettings.randomPonies = 'twilight|dash|pinkie|applej|flutter|rarity';
10346 }
10347 userSettings.randomSettingMigrated = true;
10348 saveSettings();
10349 }
10350
10351 // v1.571
10352 userSettings.soundsVolume = Math.max(0, Math.min(parseFloat(userSettings.soundsVolume), 1));
10353
10354 // v1.601
10355 if (globalSettings.lastVersion < 1.6) {
10356 if (userSettings.customcss || userSettings.debug_dominserted_console || userSettings.debug_slow_load || userSettings.debug_disablelog || userSettings.debug_noMutationObserver || userSettings.debug_mutationDebug) {
10357 userSettings.debug_exposed = true;
10358 saveSettings();
10359 }
10360 }
10361
10362 // v1.511: Track updates
10363 if (userSettings.theme && globalSettings.lastVersion < VERSION) {
10364 statTrack('updated');
10365 globalSettings.lastVersion = VERSION;
10366 saveGlobalSettings();
10367 }
10368
10369 if (forceWhiteBackground || hasClass(d.body, 'plugin') || hasClass(d.body, 'transparent_widget') || hasClass(d.body, '_1_vn')) {
10370 ONPLUGINPAGE = true;
10371 addClass(d.documentElement, 'ponyhoof_fbplugin');
10372 changeThemeSmart(CURRENTPONY);
10373 } else {
10374 // Are we on homepage?
10375 if (hasClass(d.body, 'fbIndex') && globalSettings.allowLoginScreen) {
10376 // Activate screen saver
10377 screenSaverActivate();
10378
10379 $$(d.body, '#blueBar .loggedout_menubar > .rfloat, ._50dz > .ptl[style*="#3B5998"] .rfloat > #login_form, ._50dz > div[style*="#3B5998"] td > div[style*="float"] #login_form', function() {
10380 addClass(d.documentElement, 'ponyhoof_fbIndex_topRightLogin');
10381 });
10382 }
10383
10384 // No theme?
10385 if (userSettings.theme == null) {
10386 // No theme AND logged out
10387 if (!USERID) {
10388 changeTheme('login');
10389 log("Homepage is default to login.");
10390 extraInjection();
10391 if (!userSettings.disableDomNodeInserted) {
10392 runDOMNodeInserted();
10393 }
10394 return;
10395 }
10396
10397 if (globalSettings.runForNewUsers) {
10398 if (luckyGuess == -1) {
10399 CURRENTPONY = getRandomMane6();
10400 }
10401
10402 var welcome = new WelcomeUI({feature: luckyGuess});
10403 welcome.start();
10404 }
10405 } else {
10406 if (hasClass(d.body, 'fbIndex')) {
10407 if (CURRENTPONY == 'RANDOM' && !userSettings.randomPonies) {
10408 log("On login page and theme is RANDOM, choosing 'login'");
10409 changeThemeSmart('login');
10410 } else {
10411 changeThemeSmart(CURRENTPONY);
10412 }
10413
10414 if (canPlayFlash()) {
10415 var dat = convertCodeToData(REALPONY);
10416 if (dat.fbIndex_swf && !userSettings.disable_animation) {
10417 addClass(d.documentElement, 'ponyhoof_fbIndex_hasswf');
10418
10419 var swf = d.createElement('div');
10420 swf.innerHTML = '<object type="application/x-shockwave-flash" id="fbIndex_swf" width="100%" height="100%" data="'+THEMEURL+dat.fbIndex_swf+'"><param name="movie" value="'+THEMEURL+dat.fbIndex_swf+'"><param name="wmode" value="opaque"><param name="menu" value="false"><param name="allowscriptaccess" value="never"></object>';
10421 d.body.appendChild(swf);
10422 }
10423 }
10424 } else {
10425 changeThemeSmart(CURRENTPONY);
10426 }
10427 }
10428 }
10429
10430 if (CURRENTPONY != 'NONE' && !userSettings.disableDomNodeInserted) {
10431 runDOMNodeInserted();
10432 }
10433
10434 if (CURRENTPONY != 'NONE') {
10435 extraInjection();
10436 }
10437
10438 // Record the last user to figure out what theme to load at login screen
10439 // This is low priority, if all else fails, we would just load the default Equestria 'login' anyway
10440 if (CURRENTPONY != 'NONE' && userSettings.theme != null) { // Make sure we have a pony set
10441 if (USERID && globalSettings.lastUserId != USERID && globalSettings.allowLoginScreen) {
10442 globalSettings.lastUserId = USERID;
10443 saveGlobalSettings();
10444 }
10445 }
10446 }
10447
10448 onPageReady(startScript);
10449 d.addEventListener('DOMContentLoaded', startScript, true);
10450
10451 var _loop = function() {
10452 if (d.body) {
10453 startScript();
10454 return;
10455 } else {
10456 w.setTimeout(_loop, 100);
10457 }
10458 };
10459 _loop();
10460 })();
10461
10462 /* ALL YOUR PONIES ARE BELONG TO US */
10463 /*eof*/