]> git.rmz.io Git - dotfiles.git/blob - dwb/greasemonkey/ponyhoof.user.js
33808f5d56c8595790fc78b6b11a7536a30f03bc
[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.641
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 http://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 try {
214 var evt = d.createEvent('MouseEvents');
215 evt.initMouseEvent('click', true, true, w, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
216 el.dispatchEvent(evt);
217 return true;
218 } catch (e) {
219 return false;
220 }
221 }
222
223 function cookie(n) {
224 try {
225 return unescape(d.cookie.match('(^|;)?'+n+'=([^;]*)(;|$)')[2]);
226 } catch (e) {
227 return null;
228 }
229 }
230
231 function injectManualStyle(css, id) {
232 if ($('ponyhoof_style_'+id)) {
233 return $('ponyhoof_style_'+id);
234 }
235
236 var n = d.createElement('style');
237 n.type = 'text/css';
238 if (id) {
239 n.id = 'ponyhoof_style_'+id;
240 }
241 n.textContent = '/* '+SIG+' */'+css;
242
243 if (d.head) {
244 d.head.appendChild(n);
245 } else if (d.body) {
246 d.body.appendChild(n);
247 } else {
248 d.documentElement.appendChild(n);
249 }
250
251 return n;
252 }
253
254 function fadeOut(ele, callback) {
255 addClass(ele, 'ponyhoof_fadeout');
256
257 w.setTimeout(function() {
258 ele.style.display = 'none';
259
260 if (callback) {
261 callback(ele);
262 }
263 }, 250);
264 }
265
266 function getFbDomain() {
267 if (w.location.hostname == 'beta.facebook.com') {
268 return w.location.hostname;
269 }
270 return 'www.facebook.com';
271 }
272
273 function onPageReady(callback) {
274 var _loop = function() {
275 if (/loaded|complete/.test(d.readyState)) {
276 callback();
277 } else {
278 w.setTimeout(_loop, 100);
279 }
280 };
281 _loop();
282 }
283
284 var loopClassName = function(name, func) {
285 var l = d.getElementsByClassName(name);
286 if (l) {
287 for (var i = 0, len = l.length; i < len; i++) {
288 func(l[i]);
289 }
290 }
291 };
292
293 function $$(parent, query, func) {
294 if (!parent) {
295 return;
296 }
297 var l = parent.querySelectorAll(query);
298 if (l.length) {
299 for (var i = 0, len = l.length; i < len; i++) {
300 func(l[i]);
301 }
302 }
303 }
304
305 // Hacky code adapted from http://www.javascripter.net/faq/browsern.htm
306 function getBrowserVersion() {
307 var ua = w.navigator.userAgent;
308 var fullVersion = ''+parseFloat(w.navigator.appVersion);
309 var majorVersion = parseInt(w.navigator.appVersion, 10);
310 var nameOffset, offset, ix;
311
312 if (ua.indexOf('Opera') != -1) {
313 // In Opera, the true version is after 'Opera' or after 'Version'
314 offset = ua.indexOf('Opera');
315 fullVersion = ua.substring(offset + 6);
316
317 if (ua.indexOf('Version') != -1) {
318 offset = ua.indexOf('Version');
319 fullVersion = ua.substring(offset + 8);
320 }
321 } else if (ua.indexOf('OPR/') != -1) {
322 offset = ua.indexOf('OPR/');
323 fullVersion = ua.substring(offset + 4);
324 } else if (ua.indexOf('MSIE') != -1) {
325 // In MSIE, the true version is after 'MSIE' in userAgent
326 offset = ua.indexOf('MSIE');
327 fullVersion = ua.substring(offset + 5);
328 } else if (ua.indexOf('Chrome') != -1) {
329 // In Chrome, the true version is after 'Chrome'
330 offset = ua.indexOf('Chrome');
331 fullVersion = ua.substring(offset + 7);
332 } else if (ua.indexOf('Safari') != -1) {
333 // In Safari, the true version is after 'Safari' or after 'Version'
334 offset = ua.indexOf('Safari');
335 fullVersion = ua.substring(offset + 7);
336
337 if (ua.indexOf('Version') != -1) {
338 offset = ua.indexOf('Version');
339 fullVersion = ua.substring(offset + 8);
340 }
341 } else if (ua.indexOf('Firefox') != -1) {
342 // In Firefox, the true version is after 'Firefox'
343 offset = ua.indexOf('Firefox');
344 fullVersion = ua.substring(offset + 8);
345 } else {
346 throw "Unsupported browser";
347 }
348
349 if ((ix = fullVersion.indexOf(';')) != -1) {
350 fullVersion = fullVersion.substring(0, ix);
351 }
352 if ((ix = fullVersion.indexOf(' ')) != -1) {
353 fullVersion = fullVersion.substring(0, ix);
354 }
355
356 majorVersion = parseInt(''+fullVersion,10);
357 if (isNaN(majorVersion)) {
358 fullVersion = ''+parseFloat(w.navigator.appVersion);
359 majorVersion = parseInt(w.navigator.appVersion,10);
360 }
361
362 return {
363 major: majorVersion
364 ,full: fullVersion
365 };
366 }
367
368 // http://wiki.greasespot.net/Content_Script_Injection
369 var contentEval = function(source, arg) {
370 var arg = arg || {};
371 if (typeof source === 'function') {
372 source = '(' + source + ')(' + JSON.stringify(arg) + ');'
373 }
374
375 var script = d.createElement('script');
376 script.textContent = source;
377 d.documentElement.appendChild(script);
378 d.documentElement.removeChild(script);
379 };
380
381 var supportsRange = function() {
382 var i = d.createElement('input');
383 i.setAttribute('type', 'range');
384 return i.type !== 'text';
385 };
386
387 var supportsCssTransition = function() {
388 var s = d.createElement('div').style;
389 return ('transition' in s || 'WebkitTransition' in s || 'MozTransition' in s || 'msTransition' in s || 'OTransition' in s);
390 };
391
392 // Menu
393 var MENUS = {};
394 var Menu = function(id, p) {
395 var k = this;
396
397 k.id = id;
398 MENUS['ponyhoof_menu_'+k.id] = k;
399 k.menu = null; // outer wrap
400 k.selectorMenu = null; // .uiMenu.uiSelectorMenu
401 k.menuInner = null; // .uiMenuInner
402 k.content = null; // .uiScrollableAreaContent
403 k.button = null;
404 k.wrap = null; // ponyhoof_menu_wrap, used to separate button and menu
405
406 k.menuSearch = null; // .ponyhoof_menu_search
407 k.menuSearchInput = null;
408 k.menuSearchNoResults = null;
409 k.focusStealer = null;
410
411 k.hasScrollableArea = false;
412 k.scrollableAreaDiv = null; // .uiScrollableArea
413 k.scrollableArea = null; // FB ScrollableArea class
414
415 k.p = p;
416 k.afterClose = function() {};
417
418 k.canSearch = true;
419 k.alwaysOverflow = false;
420 k.rightFaced = false;
421 k.buttonTextClipped = 0;
422
423 k.createButton = function(startText) {
424 if (!startText) {
425 startText = '';
426 }
427
428 var buttonText = d.createElement('span');
429 buttonText.className = 'uiButtonText';
430 buttonText.innerHTML = startText;
431
432 k.button = d.createElement('a');
433 k.button.href = '#';
434 k.button.className = 'uiButton ponyhoof_button_menu';
435 k.button.setAttribute('role', 'button');
436 k.button.setAttribute('aria-haspopup', 'true');
437 if (k.buttonTextClipped) {
438 k.button.className += ' ponyhoof_button_clipped';
439 buttonText.style.maxWidth = k.buttonTextClipped+'px';
440 }
441 k.button.appendChild(buttonText);
442
443 k.wrap = d.createElement('div');
444 k.wrap.className = 'ponyhoof_menu_wrap';
445 if (k.rightFaced) {
446 k.wrap.className += ' uiSelectorRight';
447 }
448 k.wrap.appendChild(k.button);
449 k.p.appendChild(k.wrap);
450
451 return k.button;
452 }
453
454 k.createMenu = function() {
455 if ($('ponyhoof_menu_'+k.id)) {
456 k.menu = $('ponyhoof_menu_'+k.id);
457 k.menuInner = k.menu.getElementsByClassName('uiMenuInner')[0];
458 return k.menu;
459 }
460
461 k.injectStyle();
462
463 k.menu = d.createElement('div');
464 k.menu.className = 'ponyhoof_menu uiSelectorMenuWrapper';
465 k.menu.id = 'ponyhoof_menu_'+k.id;
466 k.menu.setAttribute('role', 'menu');
467 //k.menu.style.display = 'none';
468 k.menu.addEventListener('click', function(e) {
469 e.stopPropagation();
470 return false;
471 }, false);
472 k.wrap.appendChild(k.menu);
473
474 k.selectorMenu = d.createElement('div');
475 k.selectorMenu.className = 'uiMenu uiSelectorMenu';
476 k.menu.appendChild(k.selectorMenu);
477
478 k.menuInner = d.createElement('div');
479 k.menuInner.className = 'uiMenuInner';
480 k.selectorMenu.appendChild(k.menuInner);
481
482 k.content = d.createElement('div');
483 k.content.className = 'uiScrollableAreaContent';
484 k.menuInner.appendChild(k.content);
485
486 if (k.canSearch) {
487 k.menuSearch = d.createElement('div');
488 k.menuSearch.className = 'ponyhoof_menu_search';
489 k.content.appendChild(k.menuSearch);
490
491 k.menuSearchInput = d.createElement('input');
492 k.menuSearchInput.type = 'text';
493 k.menuSearchInput.className = 'inputtext';
494 k.menuSearchInput.placeholder = "Search";
495 k.menuSearch.appendChild(k.menuSearchInput);
496
497 k.menuSearchNoResults = d.createElement('div');
498 k.menuSearchNoResults.className = 'ponyhoof_menu_search_noResults';
499 k.menuSearchNoResults.textContent = "No results";
500 k.menuSearch.appendChild(k.menuSearchNoResults);
501
502 k.menuSearchInput.addEventListener('keydown', k.searchEscapeKey, false);
503 k.menuSearchInput.addEventListener('input', k.performSearch, false);
504
505 k.focusStealer = d.createElement('input');
506 k.focusStealer.type = 'text';
507 k.focusStealer.setAttribute('aria-hidden', 'true');
508 k.focusStealer.style.position = 'absolute';
509 k.focusStealer.style.top = '-9999px';
510 k.focusStealer.style.left = '-9999px';
511 k.focusStealer.addEventListener('focus', k.focusStealerFocused, false);
512 k.selectorMenu.appendChild(k.focusStealer);
513 }
514
515 return k.menu;
516 };
517
518 k.attachButton = function() {
519 k.button.addEventListener('click', function(e) {
520 k.toggle();
521 e.stopPropagation();
522 e.preventDefault();
523 }, false);
524 };
525
526 k.changeButtonText = function(text) {
527 k.button.getElementsByClassName('uiButtonText')[0].innerHTML = text;
528 k.button.setAttribute('data-ponyhoof-button-orig', text);
529 k.button.setAttribute('data-ponyhoof-button-text', text);
530
531 if (k.buttonTextClipped) {
532 k.button.title = text;
533 }
534 };
535
536 k.createSeperator = function() {
537 var sep = d.createElement('div');
538 sep.className = 'uiMenuSeparator';
539 k.content.appendChild(sep);
540 };
541
542 k.createMenuItem = function(param) {
543 var menuItem = new MenuItem(k);
544 menuItem._create(param);
545
546 k.content.appendChild(menuItem.menuItem);
547
548 return menuItem;
549 };
550
551 k.injectStyle = function() {
552 var css = '';
553 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;}';
554
555 css += 'html .ponyhoof_dialog .ponyhoof_button_menu {background-position:right 0;padding-right:23px;}';
556 css += 'html .ponyhoof_button_menu:active {background-position:right -98px;}';
557 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;}';
558 css += 'html .openToggler .ponyhoof_button_menu .uiButtonText {color:#fff;}';
559
560 css += '.ponyhoof_menu_label {padding:7px 4px 0 0;}';
561 css += '.ponyhoof_menu_label, .ponyhoof_menu_withlabel .ponyhoof_menu_wrap {display:inline-block;}';
562 css += '.ponyhoof_menu_withlabel {margin-bottom:8px;}';
563 css += '.ponyhoof_menu_withlabel + .ponyhoof_menu_withlabel {margin-top:-8px;}';
564 css += '.ponyhoof_menu_withlabel .ponyhoof_button_menu {margin-top:-3px;}';
565 css += '.ponyhoof_menu_labelbreak .ponyhoof_menu_label {display:block;padding-bottom:7px;}';
566
567 css += '.ponyhoof_menu_wrap {position:relative;}';
568 css += 'html .ponyhoof_menu {z-index:1999;display:none;min-width:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;}';
569 css += '.ponyhoof_menu_wrap.openToggler .ponyhoof_menu {display:block;}';
570 css += '.ponyhoof_menu_wrap + .uiButton {margin:4px 0 0 4px;}';
571 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;}';
572 css += '.ponyhoof_menu .uiMenu.overflow {resize:vertical;height:200px;min-height:200px;}';
573 css += '.ponyhoof_menu_wrap.uiSelectorRight .uiMenu {left:auto;right:0;}';
574 css += '.ponyhoof_menu .ponyhoof_menu_search {padding:0 3px;margin-bottom:4px;}';
575 css += '.ponyhoof_menu .ponyhoof_menu_search input {width:100%;resize:none;}';
576 css += '.ponyhoof_menu .ponyhoof_menu_search_noResults {display:none;color:#999;text-align:center;margin-top:7px;width:100px;}';
577 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;}';
578 css += '.ponyhoof_menu .ponyhoof_menuitem {color:#111;}';
579 css += '.ponyhoof_menuitem:hover, .ponyhoof_menuitem:active, .ponyhoof_menuitem:focus {background-color:#6d84b4;border-color:#3b5998;color:#fff;text-decoration:none;}';
580 css += '.ponyhoof_menuitem_checked {background-position:0 -146px;font-weight:bold;}';
581 css += '.ponyhoof_menuitem_checked:hover, .ponyhoof_menuitem_checked:active, .ponyhoof_menuitem_checked:focus {background-position:0 -206px;}';
582 css += '.ponyhoof_menuitem_span {white-space:nowrap;text-overflow:ellipsis;display:inline-block;overflow:hidden;padding-right:16px;max-width:400px;vertical-align:top;}';
583
584 css += '.ponyhoof_button_clipped .uiButtonText {text-overflow:ellipsis;overflow:hidden;}';
585
586 injectManualStyle(css, 'menu');
587 };
588
589 k.open = function() {
590 k.closeAllMenus();
591
592 addClass(k.wrap, 'openToggler');
593
594 if (!hasClass(k.menuInner.parentNode, 'overflow') && (k.menuInner.parentNode.offsetHeight >= 224 || k.alwaysOverflow)) {
595 addClass(k.menuInner.parentNode, 'overflow');
596 }
597
598 if (k.canSearch) {
599 var scrollTop = k.selectorMenu.scrollTop;
600 k.menuSearchInput.focus();
601 k.menuSearchInput.select();
602
603 k.selectorMenu.scrollTop = scrollTop;
604 }
605
606 d.body.addEventListener('keydown', k.documentEscapeKey, false);
607 d.body.addEventListener('click', k.documentClick, false);
608 };
609
610 k.close = function() {
611 if (hasClass(k.wrap, 'openToggler')) {
612 removeClass(k.wrap, 'openToggler');
613 d.body.removeEventListener('keydown', k.documentEscapeKey, false);
614 d.body.removeEventListener('click', k.documentClick, false);
615
616 k.afterClose();
617 }
618 };
619
620 k.closeAllMenus = function() {
621 for (var menu in MENUS) {
622 if (MENUS.hasOwnProperty(menu)) {
623 MENUS[menu].close();
624 }
625 }
626 };
627
628 k.toggle = function() {
629 if (hasClass(k.wrap, 'openToggler')) {
630 k.close();
631 } else {
632 k.open();
633 }
634 };
635
636 k.changeChecked = function(menuItem) {
637 var already = k.menu.getElementsByClassName('ponyhoof_menuitem_checked');
638 if (already.length) {
639 removeClass(already[0], 'ponyhoof_menuitem_checked');
640 }
641 addClass(menuItem.menuItem, 'ponyhoof_menuitem_checked');
642 };
643
644 k.performSearch = function() {
645 var val = k.menuSearchInput.value;
646 var regex = new RegExp(val, 'i');
647
648 var count = 0;
649 $$(k.menu, '.ponyhoof_menuitem', function(menuitem) {
650 if (val == '') {
651 menuitem.style.display = '';
652 return;
653 }
654
655 if (!hasClass(menuitem, 'unsearchable')) {
656 menuitem.style.display = 'none';
657
658 var compare = menuitem.textContent;
659 if (menuitem.getAttribute('data-ponyhoof-menu-searchAlternate')) {
660 compare = menuitem.getAttribute('data-ponyhoof-menu-searchAlternate');
661 }
662
663 if (regex.test(compare)) {
664 menuitem.style.display = 'block';
665 count += 1;
666 }
667 } else {
668 menuitem.style.display = 'none';
669 }
670 });
671
672 $$(k.menu, '.ponyhoof_menu_search_noResults', function(ele) {
673 if (val) {
674 if (!count) {
675 ele.style.display = 'block';
676 } else {
677 ele.style.display = 'none';
678 }
679 } else {
680 ele.style.display = 'none';
681 }
682 });
683
684 $$(k.menu, '.uiMenuSeparator', function(menuitem) {
685 if (val == '') {
686 menuitem.style.display = '';
687 return;
688 }
689
690 menuitem.style.display = 'none';
691 });
692
693 if (k.hasScrollableArea) {
694 k.scrollableArea.poke();
695 }
696 };
697
698 k.searchEscapeKey = function(e) {
699 if (e.which == 27) {
700 if (k.menuSearchInput.value != '') {
701 k.menuSearchInput.value = '';
702 k.performSearch();
703 } else {
704 k.close();
705 if (k.button) {
706 k.button.focus();
707 }
708 }
709 e.stopPropagation();
710 e.cancelBubble = true;
711 }
712 };
713
714 k.documentEscapeKey = function(e) {
715 if (e.which == 27 && hasClass(k.wrap, 'openToggler')) { // esc
716 k.close();
717 e.stopPropagation();
718 e.cancelBubble = true;
719
720 if (k.button) {
721 k.button.focus();
722 }
723 }
724 };
725
726 k.documentClick = function(e) {
727 k.close();
728 e.stopPropagation();
729 e.preventDefault();
730 };
731
732 k.focusStealerFocused = function(e) {
733 if (k.canSearch) {
734 k.menuSearchInput.focus();
735 }
736 };
737 };
738
739 var MenuItem = function(menu) {
740 var k = this;
741
742 k.menuItem = null;
743 k.menu = menu;
744 k.onclick = null;
745
746 k._create = function(param) {
747 k.menuItem = d.createElement('a');
748 k.menuItem.href = '#';
749 k.menuItem.className = 'ponyhoof_menuitem';
750 k.menuItem.setAttribute('role', 'menuitem');
751
752 if (param.check) {
753 k.menuItem.className += ' ponyhoof_menuitem_checked';
754 }
755
756 if (param.data) {
757 k.menuItem.setAttribute('data-ponyhoof-menu-data', param.data);
758 }
759
760 if (param.title) {
761 k.menuItem.setAttribute('aria-label', param.title);
762 k.menuItem.setAttribute('data-hover', 'tooltip');
763 }
764
765 if (param.unsearchable) {
766 k.menuItem.className += ' unsearchable';
767 }
768
769 if (param.searchAlternate) {
770 k.menuItem.setAttribute('data-ponyhoof-menu-searchAlternate', param.searchAlternate);
771 }
772
773 if (param.extraClass) {
774 k.menuItem.className += param.extraClass;
775 }
776
777 k.menuItem.innerHTML = '<span class="ponyhoof_menuitem_span">'+param.html+'</span>';
778
779 if (param.onclick) {
780 k.onclick = param.onclick;
781 }
782 k.menuItem.addEventListener('click', function(e) {
783 e.stopPropagation();
784 if (k.onclick) {
785 k.onclick(k, k.menu);
786 }
787
788 return false;
789 }, false);
790 k.menuItem.addEventListener('dragstart', function() {
791 return false;
792 }, false);
793
794 return k.menuItem;
795 };
796
797 k.getText = function() {
798 return k.menuItem.getElementsByClassName('ponyhoof_menuitem_span')[0].innerHTML;
799 };
800 };
801
802 // Dialog
803 var DIALOGS = {};
804 var DIALOGCOUNT = 400;
805 var Dialog = function(id) {
806 var k = this;
807
808 k.dialog = null;
809 k.generic_dialogDiv = null;
810 k.popup_dialogDiv = null;
811 k.id = id;
812 k.visible = false;
813
814 k.alwaysModal = false;
815 k.noTitle = false;
816 k.noBottom = false;
817
818 k.canCardspace = true;
819 k.cardSpaceTimer = null;
820 k.cardspaced = false;
821
822 k.onclose = function() {};
823 k.onclosefinish = function() {};
824 k.canCloseByEscapeKey = true;
825
826 k.skeleton = '';
827
828 k.create = function() {
829 //if (DIALOGS[k.id]) {
830 // log("Attempting to recreate dialog ID \""+k.id+"\"");
831 // return DIALOGS[k.id].dialog;
832 //}
833
834 //DIALOGS[k.id] = k;
835
836 log("Creating "+k.id+" dialog...");
837
838 k.injectStyle();
839
840 DIALOGCOUNT += 1;
841 k.skeleton = '<!-- '+SIG+' Dialog -->';
842 k.skeleton += '<div class="generic_dialog pop_dialog" role="dialog" style="z-index:'+(DIALOGCOUNT)+';">';
843 k.skeleton += ' <div class="generic_dialog_popup">';
844 k.skeleton += ' <div class="popup">';
845 k.skeleton += ' <div class="wrap">';
846 k.skeleton += ' <h3 title="This dialog is sent from '+FRIENDLYNAME+'"></h3>';
847 k.skeleton += ' <div class="body">';
848 k.skeleton += ' <div class="content clearfix"></div>';
849 k.skeleton += ' <div class="bottom"></div>';
850 k.skeleton += ' </div>'; // body
851 k.skeleton += ' </div>'; // wrap
852 k.skeleton += ' </div>'; // popup
853 k.skeleton += ' </div>'; // generic_dialog_popup
854 k.skeleton += '</div>';
855
856 INTERNALUPDATE = true;
857
858 k.dialog = d.createElement('div');
859 k.dialog.className = 'ponyhoof_dialog';
860 k.dialog.id = 'ponyhoof_dialog_'+k.id;
861 k.dialog.innerHTML = k.skeleton;
862 d.body.appendChild(k.dialog);
863
864 INTERNALUPDATE = false;
865
866 k.generic_dialogDiv = k.dialog.getElementsByClassName('pop_dialog')[0];
867 k.popup_dialogDiv = k.dialog.getElementsByClassName('popup')[0];
868
869 if (k.alwaysModal) {
870 addClass(k.generic_dialogDiv, 'generic_dialog_modal');
871 }
872 if (k.noTitle) {
873 addClass(k.dialog.getElementsByTagName('h3')[0], 'hidden_elem');
874 }
875 if (k.noBottom) {
876 addClass(k.dialog.getElementsByClassName('bottom')[0], 'hidden_elem');
877 }
878
879 k.show();
880
881 return k.dialog;
882 };
883
884 k.injectStyle = function() {
885 var cx = '._6nw';
886 if (d.getElementsByClassName('-cx-PUBLIC-hasLitestand__body').length) {
887 cx = '.-cx-PUBLIC-hasLitestand__body';
888 }
889
890 var css = '';
891 css += '.ponyhoof_message .wrap {margin-top:3px;background:transparent !important;display:block;}';
892 css += '.ponyhoof_message .uiButton.rfloat {margin-left:10px;}';
893
894 css += '.ponyhoof_dialog, .ponyhoof_dialog .body {font-size:11px;}';
895 css += cx+' .ponyhoof_dialog, '+cx+' .ponyhoof_dialog .body {font-size:12px;}';
896 css += '.ponyhoof_dialog iframe {-webkit-user-select:none;-moz-user-select:none;user-select:none;}';
897 css += '.ponyhoof_dialog textarea, .ponyhoof_dialog input[type="text"] {cursor:text;-moz-box-sizing:border-box;box-sizing:border-box;}';
898 css += '.ponyhoof_dialog .generic_dialog_modal, .ponyhoof_dialog .generic_dialog_fixed_overflow {background-color:rgba(0,0,0,.4) !important;}';
899 css += '.ponyhoof_dialog .generic_dialog {z-index:250;}';
900 css += '.ponyhoof_dialog .generic_dialog_popup {margin-top:80px;}';
901 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);}';
902 css += cx+' .ponyhoof_dialog .popup {font-family:"Helvetica Neue", Helvetica, Arial, "lucida grande",tahoma,verdana,arial,sans-serif;}';
903 css += '.ponyhoof_dialog .wrap {background:#fff;color:#000;}';
904 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;}';
905 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;}';
906 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;}';
907 css += cx+' .ponyhoof_dialog h3:before {display:none;}';
908 css += '.ponyhoof_dialog .body {border:1px solid #555;border-top-width:0;}';
909 css += '.ponyhoof_dialog h3.hidden_elem + .body {border-top-width:1px;}';
910 css += cx+' .ponyhoof_dialog .body {border:0;}';
911 css += '.ponyhoof_dialog .content {padding:10px;}';
912 css += '.ponyhoof_dialog .bottom {background:#F2F2F2;border-top:1px solid #ccc;padding:8px 10px 8px 10px;text-align:right;}';
913 css += cx+' .ponyhoof_dialog .bottom {-moz-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;}';
914 css += '.ponyhoof_dialog .bottom .lfloat {line-height:17px;margin-top:4px;}';
915
916 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;}';
917 css += '.ponyhoof_tabs {padding:4px 10px 0;background:#F2F2F2;border-bottom:1px solid #ccc;margin:-10px -10px 10px;}';
918 css += '.ponyhoof_tabs a {margin:3px 10px 0 0;padding:5px 8px;float:left;}';
919 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;}';
920 css += '.ponyhoof_tabs_section {display:none;}';
921
922 if (ISMOBILE) {
923 css += '#ponyhoof_welcome_scenery {background-image:none !important;}';
924 css += '.ponyhoof_dialog .generic_dialog {position:absolute;}';
925 css += '.ponyhoof_menu .uiMenu.overflow {resize:none !important;height:auto !important;}';
926 }
927
928 injectManualStyle(css, 'dialog');
929 };
930
931 k.show = function() {
932 removeClass(k.dialog, 'ponyhoof_fadeout');
933 removeClass(k.generic_dialogDiv, 'ponyhoof_fadeout');
934
935 k.visible = true;
936 k.dialog.style.display = 'block';
937 k.generic_dialogDiv.style.display = 'block';
938
939 if (ISMOBILE) {
940 k.canCardspace = false;
941 }
942
943 if (k.canCardspace) {
944 w.addEventListener('resize', k.onBodyResize, false);
945 k.cardSpaceTick();
946 }
947
948 if (k.canCloseByEscapeKey) {
949 d.body.addEventListener('keydown', k.documentEscapeKey, false);
950 }
951 };
952
953 k.close = function(callback) {
954 k.onclose();
955
956 if (!userSettings.disable_animation) {
957 fadeOut(k.dialog, function() {
958 if (callback) {
959 callback();
960 }
961 k.onclosefinish();
962 });
963 if (callback) {
964 log("Legacy dialog close code found");
965 }
966
967 if (ISOPERA) {
968 fadeOut(k.generic_dialogDiv);
969 }
970 } else {
971 k.dialog.style.display = 'none';
972 if (callback) {
973 callback();
974 }
975 k.onclosefinish();
976 }
977
978 k._close();
979 };
980
981 k.hide = function() {
982 k.onclose();
983
984 k.dialog.style.display = 'none';
985
986 k._close();
987 };
988
989 k._close = function() {
990 k.visible = false;
991
992 w.removeEventListener('resize', k.onBodyResize, false);
993 w.clearTimeout(k.cardSpaceTimer);
994
995 if (k.cardspaced) {
996 removeClass(d.documentElement, 'generic_dialog_overflow_mode');
997 if (!k.alwaysModal) {
998 removeClass(k.generic_dialogDiv, 'generic_dialog_modal');
999 }
1000 }
1001 removeClass(k.generic_dialogDiv, 'generic_dialog_fixed_overflow');
1002 k.cardspaced = false;
1003
1004 d.body.removeEventListener('keydown', k.documentEscapeKey, false);
1005 };
1006
1007 k.changeTitle = function(c) {
1008 INTERNALUPDATE = true;
1009 var title = k.dialog.getElementsByTagName('h3');
1010 if (title.length) {
1011 title = title[0];
1012 title.innerHTML = c;
1013 }
1014 INTERNALUPDATE = false;
1015 };
1016
1017 k.changeContent = function(c) {
1018 INTERNALUPDATE = true;
1019 var content = k.dialog.getElementsByClassName('content');
1020 if (content.length) {
1021 content = content[0];
1022 content.innerHTML = c;
1023 }
1024 INTERNALUPDATE = false;
1025 };
1026
1027 k.changeBottom = function(c) {
1028 INTERNALUPDATE = true;
1029 var bottom = k.dialog.getElementsByClassName('bottom');
1030 if (bottom.length) {
1031 bottom = bottom[0];
1032 bottom.innerHTML = c;
1033 }
1034 INTERNALUPDATE = false;
1035 };
1036
1037 k.addCloseButton = function(callback) {
1038 var text = "Close";
1039 if (CURRENTLANG && CURRENTLANG.close) {
1040 text = CURRENTLANG.close;
1041 }
1042
1043 var close = '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm" role="button"><span class="uiButtonText">'+text+'</span></a>';
1044 k.changeBottom(close);
1045
1046 k.dialog.querySelector('.bottom .uiButton').addEventListener('click', function(e) {
1047 k.close(function() {
1048 if (callback) {
1049 log("Legacy dialog close code found");
1050 callback();
1051 }
1052 });
1053 e.preventDefault();
1054 }, false);
1055 };
1056
1057 k.onBodyResize = function() {
1058 if (k.canCardspace) {
1059 var dialogHeight = k.popup_dialogDiv.clientHeight + 80 + 40;
1060 var windowHeight = w.innerHeight;
1061
1062 if (dialogHeight > windowHeight) {
1063 if (!k.cardspaced) {
1064 addClass(d.documentElement, 'generic_dialog_overflow_mode');
1065 if (!k.alwaysModal) {
1066 addClass(k.generic_dialogDiv, 'generic_dialog_modal');
1067 }
1068 addClass(k.generic_dialogDiv, 'generic_dialog_fixed_overflow');
1069
1070 k.cardspaced = true;
1071 }
1072 } else {
1073 if (k.cardspaced) {
1074 removeClass(d.documentElement, 'generic_dialog_overflow_mode');
1075 if (!k.alwaysModal) {
1076 removeClass(k.generic_dialogDiv, 'generic_dialog_modal');
1077 }
1078 removeClass(k.generic_dialogDiv, 'generic_dialog_fixed_overflow');
1079
1080 k.cardspaced = false;
1081 }
1082 }
1083 }
1084 };
1085
1086 k.cardSpaceTick = function() {
1087 if (k.canCardspace && k.visible) {
1088 k.onBodyResize();
1089 k.cardSpaceTimer = w.setTimeout(k.cardSpaceTick, 500);
1090 } else {
1091 w.clearTimeout(k.cardSpaceTimer);
1092 }
1093 };
1094
1095 k.documentEscapeKey = function(e) {
1096 if (k.canCloseByEscapeKey) {
1097 if (e.which == 27 && k.visible) { // esc
1098 k.close();
1099 e.stopPropagation();
1100 e.cancelBubble = true;
1101 }
1102 }
1103 };
1104
1105 if (DIALOGS[k.id]) {
1106 log("Attempting to recreate dialog ID \""+k.id+"\"");
1107 return DIALOGS[k.id];
1108 }
1109 DIALOGS[k.id] = k;
1110 };
1111
1112 function createSimpleDialog(id, title, message) {
1113 if (DIALOGS[id]) {
1114 DIALOGS[id].show();
1115 return DIALOGS[id];
1116 }
1117
1118 var di = new Dialog(id);
1119 di.create();
1120 di.changeTitle(title);
1121 di.changeContent(message);
1122 di.addCloseButton();
1123
1124 return di;
1125 };
1126
1127 function injectSystemStyle() {
1128 var css = '';
1129 css += '.ponyhoof_show_if_injected {display:none;}';
1130 css += '.ponyhoof_hide_if_injected {display:block;}';
1131 css += '.ponyhoof_hide_if_injected.inline {display:inline;}';
1132 css += 'html.ponyhoof_injected .ponyhoof_show_if_injected {display:block;}';
1133 css += 'html.ponyhoof_injected .ponyhoof_hide_if_injected {display:none;}';
1134 css += '.ponyhoof_show_if_loaded {display:none;}';
1135 css += '.ponyhoof_updater_latest, .ponyhoof_updater_newVersion, .ponyhoof_updater_error {display:none;}';
1136
1137 css += '.ponyhoof_fadeout {opacity:0;-webkit-transition:opacity .25s linear;-moz-transition:opacity .25s linear;-o-transition:opacity .25s linear;transition:opacity .25s linear;}';
1138 css += '.ponyhoof_message {padding:10px;color:#000;font-weight:bold;overflow:hidden;}';
1139
1140 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;}';
1141 css += '.ponyhoof_loading.ponyhoof_show_if_injected {display:none;}';
1142 css += 'html.ponyhoof_injected .ponyhoof_loading_pony {display:inline-block;}';
1143
1144 css += '.uiHelpLink {background:url("data:image/gif;base64,R0lGODlhDAALAJEAANvb26enp////wAAACH5BAEAAAIALAAAAAAMAAsAAAIblI8WkbcswAtAwWVzwoIbSWliBzWjR5abagoFADs=") no-repeat 0 center;display:inline-block;height:9px;width:12px;}';
1145
1146 css += '.uiInputLabel + .uiInputLabel {margin-top:3px;}';
1147 css += '.uiInputLabelCheckbox {float:left;margin:0;padding:0;}';
1148 css += '.uiInputLabel label {color:#333;display:block;font-weight:normal;margin-left:17px;vertical-align:baseline;}';
1149 css += '.webkit.mac .uiInputLabel label {margin-left:16px;}';
1150 css += '.webkit.mac .uiInputLabelCheckbox {margin-top:2px;}';
1151
1152 injectManualStyle(css, 'system');
1153 }
1154
1155 // http://www.html5rocks.com/en/tutorials/pagevisibility/intro/
1156 var _hiddenPropCached = '';
1157 var getHiddenProp = function() {
1158 if (_hiddenPropCached) {
1159 return _hiddenPropCached;
1160 }
1161
1162 var prefixes = ['webkit', 'moz', 'ms', 'o'];
1163
1164 if ('hidden' in document) {
1165 _hiddenPropCached = 'hidden';
1166 return _hiddenPropCached;
1167 }
1168
1169 for (var i = 0, len = prefixes.length; i < len; i++){
1170 if ((prefixes[i] + 'Hidden') in document) {
1171 _hiddenPropCached = prefixes[i] + 'Hidden';
1172 return _hiddenPropCached;
1173 }
1174 }
1175
1176 return null;
1177 };
1178 var isPageHidden = function() {
1179 var prop = getHiddenProp();
1180 if (!prop) {
1181 return false;
1182 }
1183
1184 return document[prop];
1185 };
1186 // http://www.myersdaily.org/joseph/javascript/md5.js
1187 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});
1188 var VERSION = 1.641;
1189 var FRIENDLYNAME = 'P'+'onyh'+'oof';
1190 var SIG = '['+FRIENDLYNAME+' v'+VERSION+']';
1191 var DISTRIBUTION = 'userjs';
1192
1193 var runMe = true;
1194 var STORAGEMETHOD = 'none';
1195 var INTERNALUPDATE = false;
1196 var USINGMUTATION = false;
1197
1198 var CURRENTPONY = null;
1199 var REALPONY = CURRENTPONY;
1200 var BRONYNAME = '';
1201 var USERID = 0;
1202 var UILANG = 'en_US';
1203 var CURRENTLANG = {};
1204 var ISUSINGPAGE = false;
1205 var ISUSINGBUSINESS = false;
1206 var ONPLUGINPAGE = false;
1207
1208 var SETTINGSPREFIX = '';
1209 var globalSettings = {};
1210 var GLOBALDEFAULTSETTINGS = {
1211 'allowLoginScreen':true,
1212 'runForNewUsers':true,
1213 'globalSettingsMigrated':false, 'lastUserId':0, 'lastVersion':''
1214 };
1215
1216 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","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}];
1217 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"}};
1218 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"}};
1219 var SOUNDS_CHAT = {"_sound\/grin2":{"name":"Fluttershy - *squee*"},"_sound\/chat_boing":{"name":"Boing"}};
1220 var HTMLCLASS_SETTINGS = ['login_bg', 'show_messages_other', 'disable_animation', 'pinkieproof', 'disable_emoticons'];
1221 var DEFAULTSETTINGS = {
1222 'theme':CURRENTPONY,
1223 'login_bg':false, 'customBg':null, //'allowLoginScreen':true,
1224 'sounds':false, 'soundsFile':'AUTO', 'soundsNotifTypeBlacklist':'', 'soundsVolume':1, 'chatSound':true, 'chatSoundFile':'_sound/grin2',
1225 'show_messages_other':true, 'pinkieproof':false, 'forceEnglish':false, 'disable_emoticons':false, 'randomPonies':'', 'costume': '', //'commentBrohoofed':true,
1226 'disable_animation':false, 'disableDomNodeInserted':false, //'disableCommentBrohoofed':false,
1227 '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,
1228 //'lastVersion':''
1229
1230 //'survivedTheNight', 'chatSound1401', 'randomSettingMigrated'
1231 };
1232 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":"changeling","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"}];
1233 var CURRENTSTACK = STACKS_LANG[0];
1234 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"]}};
1235 var SOUNDS_NOTIFTYPE = {
1236 poke: {name:"Nuzzles", type:"poke"}
1237 ,like: {name:"Brohoofs", type:"like"}
1238 ,group_activity: {name:"New posts in herds and tags about you", type:"group_activity"}
1239 ,group_r2j: {name:"Herd join requests", type:"group_r2j"}
1240 ,group_added_to_group: {name:"Herd invites from friends", type:"group_added_to_group"}
1241 ,plan_reminder: {name:"Adventure reminders", type:"plan_reminder"}
1242 ,follow_profile: {name:"New followers", type:"follow_profile"}
1243 //,photo_made_profile_pic: {name:"Made your pony pic his/her profile picture", type:"photo_made_profile_pic"}
1244 ,answers_answered: {name:"New answers on the Facebook Help Center", type:"answers_answered"}
1245
1246 ,app_invite: {name:"Game/app requests", type:"app_invite"}
1247 ,close_friend_activity: {name:"Posts from Close Friends", type:"close_friend_activity"}
1248 ,notify_me: {name:"Page posts that you subscribed to", type:"notify_me"}
1249
1250 //,fbpage_presence: {name:"Facebook nagging you to post to your page", type:"fbpage_presence"}
1251 ,fbpage_fan_invite: {name:"Page invites from friends", type:"fbpage_fan_invite"}
1252 ,page_new_likes: {name:"New page brohoofs", type:"page_new_likes"}
1253 //,fbpage_new_message: {name:"New private messages on your page", type:"fbpage_new_message"}
1254 };
1255
1256 var THEMEURL = w.location.protocol + '//hoof.little.my/files/';
1257 var THEMECSS = THEMEURL+'';
1258 var THEMECSS_EXT = '.css?userscript_version='+VERSION;
1259 var UPDATEURL = w.location.protocol + '//hoof.little.my/files/update_check.js?' + (+new Date());
1260
1261 var PONYHOOF_PAGE = '197956210325433';
1262 var PONYHOOF_URL = '//'+getFbDomain()+'/Ponyhoof';
1263 var PONYHOOF_README = '//hoof.little.my/files/_welcome/readme.htm?version='+VERSION+'&distribution='+DISTRIBUTION;
1264
1265 var _ext_messageId = 0;
1266 var _ext_messageCallback = {};
1267
1268 // Chrome
1269 var chrome_sendMessage = function(message, callback) {
1270 if (chrome.extension.sendMessage) {
1271 chrome.extension.sendMessage(message, callback);
1272 } else {
1273 chrome.extension.sendRequest(message, callback);
1274 }
1275 };
1276
1277 var chrome_storageFallback = false;
1278 var chrome_getValue = function(name, callback) {
1279 if (chrome.storage && !chrome_storageFallback) {
1280 chrome.storage.local.get(name, function(item) {
1281 if (chrome.runtime && chrome.runtime.lastError) {
1282 // Fallback to old storage method
1283 chrome_storageFallback = true;
1284 chrome_getValue(name, callback);
1285 return;
1286 }
1287
1288 if (Object.keys(item).length === 0) {
1289 callback(null);
1290 return;
1291 }
1292 callback(item[name]);
1293 });
1294 return;
1295 }
1296
1297 try {
1298 chrome_sendMessage({'command':'getValue', 'name':name}, function(response) {
1299 if (response && typeof response.val != 'undefined') {
1300 callback(response.val);
1301 } else {
1302 callback(null);
1303 }
1304 });
1305 } catch (e) {
1306 dir(e);
1307 getValueError(e);
1308 callback(null);
1309 }
1310 };
1311
1312 var chrome_setValue = function(name, val) {
1313 if (chrome.storage && !chrome_storageFallback) {
1314 var toSet = {};
1315 toSet[name] = val;
1316 chrome.storage.local.set(toSet, function() {
1317 if (chrome.runtime && chrome.runtime.lastError) {
1318 saveValueError(chrome.runtime.lastError);
1319 return;
1320 }
1321 });
1322 return;
1323 }
1324
1325 chrome_sendMessage({'command':'setValue', 'name':name, 'val':val}, function() {});
1326 };
1327
1328 var chrome_clearStorage = function() {
1329 if (chrome.storage) {
1330 chrome.storage.local.clear();
1331 }
1332 chrome_sendMessage({'command':'clearStorage'}, function() {});
1333 };
1334
1335 var chrome_ajax = function(details) {
1336 chrome_sendMessage({'command': 'ajax', 'details': details}, function(response) {
1337 if (response.val == 'success') {
1338 if (details.onload) {
1339 details.onload(response.request);
1340 }
1341 } else {
1342 if (details.onerror) {
1343 details.onerror(response.request);
1344 }
1345 }
1346 });
1347 };
1348
1349 if (ISOPERA) {
1350 if (opera.extension) {
1351 opera.extension.onmessage = function(message) {
1352 if (message.data) {
1353 var response = message.data;
1354 var callback = _ext_messageCallback[response.messageid];
1355 if (callback) {
1356 callback(response.val);
1357 }
1358 }
1359 }
1360 }
1361
1362 var opera_getValue = function(name, callback) {
1363 _ext_messageCallback[_ext_messageId] = callback;
1364 opera.extension.postMessage({'command':'getValue', 'messageid':_ext_messageId, 'name':name});
1365 _ext_messageId += 1;
1366 };
1367
1368 var opera_setValue = function(name, val) {
1369 opera.extension.postMessage({'command':'setValue', 'name':name, 'val':val});
1370 };
1371
1372 var opera_clearStorage = function() {
1373 opera.extension.postMessage({'command':'clearStorage'});
1374 };
1375
1376 var opera_ajax = function(details) {
1377 _ext_messageCallback[_ext_messageId] = function(response) {
1378 if (response.val == 'success') {
1379 if (details.onload) {
1380 details.onload(response.request);
1381 }
1382 } else {
1383 if (details.onerror) {
1384 details.onerror(response.request);
1385 }
1386 }
1387 };
1388 var detailsX = {
1389 'method': details.method
1390 ,'url': details.url
1391 ,'headers': details.headers
1392 ,'data': details.data
1393 };
1394 opera.extension.postMessage({'command':'ajax', 'messageid':_ext_messageId, 'details':detailsX});
1395 _ext_messageId += 1;
1396 };
1397 }
1398
1399 if (ISSAFARI) {
1400 if (typeof safari != 'undefined') {
1401 safari.self.addEventListener('message', function(message) {
1402 var data = message.message;
1403 if (data) {
1404 var response = data;
1405 var callback = _ext_messageCallback[message.name];
1406 if (callback) {
1407 callback(response.val);
1408 }
1409 }
1410 });
1411 }
1412
1413 var safari_getValue = function(name, callback) {
1414 _ext_messageId = md5(Math.random().toString()); // safari, you don't know what's message passing/callbacks, do you?
1415 _ext_messageCallback[_ext_messageId] = callback;
1416 safari.self.tab.dispatchMessage('getValue', {'messageid':_ext_messageId, 'name':name});
1417 //_ext_messageId += 1;
1418 };
1419
1420 var safari_setValue = function(name, val) {
1421 safari.self.tab.dispatchMessage('setValue', {'name':name, 'val':val});
1422 };
1423
1424 var safari_clearStorage = function() {
1425 safari.self.tab.dispatchMessage('clearStorage', {});
1426 };
1427
1428 var safari_ajax = function(details) {
1429 _ext_messageId = md5(Math.random().toString());
1430 _ext_messageCallback[_ext_messageId] = function(response) {
1431 if (response.val == 'success') {
1432 if (details.onload) {
1433 details.onload(response.request);
1434 }
1435 } else {
1436 if (details.onerror) {
1437 details.onerror(response.request);
1438 }
1439 }
1440 };
1441 var detailsX = {
1442 'method': details.method
1443 ,'url': details.url
1444 ,'headers': details.headers
1445 ,'data': details.data
1446 };
1447 safari.self.tab.dispatchMessage('ajax', {'messageid':_ext_messageId, 'details':detailsX});
1448 //_ext_messageId += 1;
1449 };
1450 }
1451
1452 if (ISFIREFOX && typeof self != 'undefined' && typeof self.on != 'undefined') {
1453 self.on('message', function(message) {
1454 var data = message;
1455 if (data) {
1456 var response = data;
1457 var callback = _ext_messageCallback[message.messageid];
1458 if (callback) {
1459 callback(response.val);
1460 }
1461 }
1462 });
1463 var xpi_getValue = function(name, callback) {
1464 _ext_messageCallback[_ext_messageId] = callback;
1465 self.postMessage({'command':'getValue', 'messageid':_ext_messageId, 'name':name});
1466 _ext_messageId += 1;
1467 };
1468
1469 var xpi_setValue = function(name, val) {
1470 self.postMessage({'command':'setValue', 'name':name, 'val':val});
1471 };
1472
1473 var xpi_clearStorage = function(name, val) {
1474 self.postMessage({'command':'clearStorage'});
1475 };
1476
1477 var xpi_ajax = function(details) {
1478 _ext_messageCallback[_ext_messageId] = function(response) {
1479 if (response.val == 'success') {
1480 if (details.onload) {
1481 details.onload(response.request);
1482 }
1483 } else {
1484 if (details.onerror) {
1485 details.onerror(response.request);
1486 }
1487 }
1488 };
1489 var detailsX = {
1490 'method': details.method
1491 ,'url': details.url
1492 ,'headers': details.headers
1493 ,'data': details.data
1494 };
1495 self.postMessage({'command':'ajax', 'messageid':_ext_messageId, 'details':detailsX});
1496 _ext_messageId += 1;
1497 };
1498 }
1499
1500 if (typeof w.external != 'undefined' && typeof w.external.mxGetRuntime != 'undefined') {
1501 var maxthonRuntime = w.external.mxGetRuntime();
1502
1503 maxthonRuntime.listen('messageContentScript', function(message) {
1504 var data = message;
1505 if (data) {
1506 var response = data;
1507 var callback = _ext_messageCallback[message.messageid];
1508 if (callback) {
1509 callback(response.val);
1510 }
1511 }
1512 });
1513
1514 var mxaddon_ajax = function(details) {
1515 _ext_messageCallback[_ext_messageId] = function(response) {
1516 if (response.val == 'success') {
1517 if (details.onload) {
1518 details.onload(response.request);
1519 }
1520 } else {
1521 if (details.onerror) {
1522 details.onerror(response.request);
1523 }
1524 }
1525 };
1526 var detailsX = {
1527 'method': details.method
1528 ,'url': details.url
1529 ,'headers': details.headers
1530 ,'data': details.data
1531 };
1532 maxthonRuntime.post('messageBackground', {'command':'ajax', 'messageid':_ext_messageId, 'details':detailsX});
1533 _ext_messageId += 1;
1534 };
1535 }
1536
1537 function ajax(obj) {
1538 switch (STORAGEMETHOD) {
1539 case 'greasemonkey':
1540 return GM_xmlhttpRequest(obj);
1541
1542 case 'chrome':
1543 return chrome_ajax(obj);
1544
1545 case 'opera':
1546 return opera_ajax(obj);
1547
1548 case 'safari':
1549 return safari_ajax(obj);
1550
1551 case 'xpi':
1552 return xpi_ajax(obj);
1553
1554 case 'mxaddon':
1555 return mxaddon_ajax(obj);
1556
1557 default:
1558 break;
1559 }
1560
1561 throw {
1562 responseXML:''
1563 ,responseText:''
1564 ,readyState:4
1565 ,responseHeaders:''
1566 ,status:-100
1567 ,statusText:'No GM_xmlhttpRequest support'
1568 };
1569 }
1570
1571 function isPonyhoofPage(id) {
1572 if (id == PONYHOOF_PAGE) {
1573 return true;
1574 }
1575 return false;
1576 }
1577
1578 function capitaliseFirstLetter(string) {
1579 return string.charAt(0).toUpperCase() + string.slice(1);
1580 }
1581
1582 // Settings
1583 for (var i in HTMLCLASS_SETTINGS) {
1584 if (!DEFAULTSETTINGS[HTMLCLASS_SETTINGS[i]]) {
1585 DEFAULTSETTINGS[HTMLCLASS_SETTINGS[i]] = false;
1586 }
1587 }
1588 //DEFAULTSETTINGS.show_messages_other = true;
1589 if (ISMOBILE) {
1590 DEFAULTSETTINGS.disable_animation = true;
1591 }
1592
1593 function getValueError(extra) {
1594 if (extra === 'ModuleSystem has been deleted' || extra === 'TypeError: Cannot read property \'sendMessage\' of undefined' || extra === '<code>ModuleSystem has been deleted</code>' || extra === '<code>TypeError: Cannot read property \'sendMessage\' of undefined</code>') {
1595 createSimpleDialog('localStorageError_getValueChromeExt', "Ponyhoof derp'd", "Whoops, Ponyhoof has been disabled/updated recently. Please reload the page in order for Ponyhoof to work properly.");
1596 } else {
1597 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>"+extra);
1598 }
1599
1600 trace();
1601 }
1602
1603 function saveValueError(extra) {
1604 var desc = "Whoops, Ponyhoof can't save 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>"+extra;
1605 createSimpleDialog('localStorageError_saveValue', "Ponyhoof derp'd", desc);
1606
1607 trace();
1608 }
1609
1610 function ponyhoofError(extra) {
1611 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>"+extra);
1612
1613 trace();
1614 }
1615
1616 function getValue(name, callback) {
1617 switch (STORAGEMETHOD) {
1618 case 'greasemonkey':
1619 callback(GM_getValue(name));
1620 break;
1621
1622 case 'chrome':
1623 chrome_getValue(name, callback);
1624 break;
1625
1626 case 'opera':
1627 opera_getValue(name, callback);
1628 break;
1629
1630 case 'safari':
1631 safari_getValue(name, callback);
1632 break;
1633
1634 case 'xpi':
1635 xpi_getValue(name, callback);
1636 break;
1637
1638 case 'mxaddon':
1639 callback(w.external.mxGetRuntime().storage.getConfig(name));
1640 break;
1641
1642 case 'localstorage':
1643 default:
1644 name = 'ponyhoof_'+name;
1645 callback(w.localStorage.getItem(name));
1646 break;
1647 }
1648 }
1649
1650 function saveValue(name, v) {
1651 switch (STORAGEMETHOD) {
1652 case 'greasemonkey':
1653 GM_setValue(name, v);
1654 break;
1655
1656 case 'chrome':
1657 chrome_setValue(name, v);
1658 break;
1659
1660 case 'opera':
1661 opera_setValue(name, v);
1662 break;
1663
1664 case 'safari':
1665 safari_setValue(name, v);
1666 break;
1667
1668 case 'xpi':
1669 xpi_setValue(name, v);
1670 break;
1671
1672 case 'mxaddon':
1673 w.external.mxGetRuntime().storage.setConfig(name, v);
1674 break;
1675
1676 case 'localstorage':
1677 default:
1678 name = 'ponyhoof_'+name;
1679 w.localStorage.setItem(name, v);
1680 break;
1681 }
1682 }
1683
1684 function loadSettings(callback, opts) {
1685 // opts => prefix, defaultsettings
1686 var opts = opts || {prefix:null};
1687 var settingsKey = 'settings';
1688 if (opts.prefix != null) {
1689 settingsKey = opts.prefix+settingsKey;
1690 } else {
1691 settingsKey = SETTINGSPREFIX+settingsKey;
1692 }
1693 if (!opts.defaultSettings) {
1694 opts.defaultSettings = DEFAULTSETTINGS;
1695 }
1696
1697 try {
1698 getValue(settingsKey, function(s) {
1699 if (s) {
1700 s = JSON.parse(s);
1701 if (!s) {
1702 s = {};
1703 }
1704 } else {
1705 s = {};
1706 }
1707 for (var i in opts.defaultSettings) {
1708 if (!s.hasOwnProperty(i)) {
1709 s[i] = opts.defaultSettings[i];
1710 }
1711 }
1712 callback(s);
1713 });
1714 } catch (e) {
1715 dir(e);
1716
1717 var extra = '';
1718 if (e.message) {
1719 extra = "<code>"+e.message+"</code>";
1720 } else {
1721 extra = "<code>"+e.toString()+"</code>";
1722 }
1723 try {
1724 getValueError(extra);
1725 } catch (e) {
1726 onPageReady(function() {
1727 if (d.body) {
1728 getValueError(extra);
1729 }
1730 });
1731 }
1732 callback();
1733 return false;
1734 }
1735 }
1736
1737 function saveSettings(opts) {
1738 // opts => prefix, settings
1739 var opts = opts || {prefix:null, settings:userSettings};
1740 var settingsKey = 'settings';
1741 if (opts.prefix != null) {
1742 settingsKey = opts.prefix+settingsKey;
1743 } else {
1744 settingsKey = SETTINGSPREFIX+settingsKey;
1745 }
1746 var settings = userSettings;
1747 if (opts.settings) {
1748 settings = opts.settings;
1749 }
1750
1751 try {
1752 saveValue(settingsKey, JSON.stringify(settings));
1753 return true;
1754 } catch (e) {
1755 dir(e);
1756
1757 var extra = '';
1758 if (e.message) {
1759 if (e.message == 'ModuleSystem has been deleted' || e.message == 'TypeError: Cannot read property \'sendMessage\' of undefined') {
1760 createSimpleDialog('localStorageError_setValueChromeExt', "Ponyhoof derp'd", "Ponyhoof has been disabled/updated recently. Please reload the page in order for Ponyhoof to work properly.");
1761 callback();
1762 return;
1763 }
1764
1765 extra = "<code>"+e.message+"</code>";
1766 } else {
1767 extra = "<code>"+e.toString()+"</code>";
1768 }
1769 saveValueError(extra);
1770 return false;
1771 }
1772 }
1773
1774 var saveGlobalSettings = function() {
1775 saveSettings({prefix:'global_', settings:globalSettings});
1776 };
1777
1778 function statTrack(stat) {
1779 var i = d.createElement('iframe');
1780 i.style.position = 'absolute';
1781 i.style.top = '-9999px';
1782 i.style.left = '-9999px';
1783 i.src = '//hoof.little.my/files/_htm/stat_'+stat+'.htm?version='+VERSION;
1784 d.body.appendChild(i);
1785 }
1786
1787 var canPlayFlash = function() {
1788 return !!w.navigator.mimeTypes['application/x-shockwave-flash'];
1789 };
1790
1791 // Pony selector
1792 var PonySelector = function(p, param) {
1793 var k = this;
1794
1795 if (param) {
1796 k.param = param;
1797 } else {
1798 k.param = {};
1799 }
1800 k.p = p;
1801 k.wrap = null;
1802 k.button = null;
1803
1804 k.oldPony = CURRENTPONY;
1805 k.customClick = function() {};
1806 k.customCheckCondition = false;
1807 k.overrideClickAction = false;
1808
1809 k.menu = null;
1810 k.createSelector = function() {
1811 if (k.menu) {
1812 return k.menu;
1813 }
1814
1815 k.injectStyle();
1816
1817 var currentPonyData = convertCodeToData(CURRENTPONY);
1818 var name = "(Nopony)";
1819 if (currentPonyData) {
1820 name = currentPonyData.name;
1821 } else if (CURRENTPONY == 'RANDOM') {
1822 name = "(Random)";
1823 }
1824
1825 var iu = INTERNALUPDATE;
1826 INTERNALUPDATE = true;
1827
1828 k.menu = new Menu('ponies_'+p.id, k.p/*, {checkable:true}*/);
1829 k.button = k.menu.createButton(name);
1830 k.menu.alwaysOverflow = true;
1831 k.menu.createMenu();
1832 k.menu.attachButton();
1833
1834 if (k.allowRandom) {
1835 var check = false;
1836 if (CURRENTPONY == 'RANDOM') {
1837 check = true;
1838 }
1839
1840 k.menu.createMenuItem({
1841 html: "(Random)"
1842 ,title: "To choose which characters to randomize, go to the Misc tab"
1843 ,check: check
1844 ,unsearchable: true
1845 ,onclick: function(menuItem, menuClass) {
1846 CURRENTPONY = 'RANDOM';
1847
1848 changeThemeSmart('RANDOM');
1849 userSettings.theme = 'RANDOM';
1850 saveSettings();
1851
1852 menuClass.changeButtonText("(Random)");
1853 menuClass.changeChecked(menuItem);
1854 menuClass.close();
1855
1856 if (k.customClick) {
1857 k.customClick(menuItem, menuClass);
1858 }
1859 }
1860 });
1861 }
1862
1863 if (k.allowRandom) {
1864 k.menu.createSeperator();
1865 }
1866
1867 if (k.param.feature && k.param.feature != -1) {
1868 k._createItem(PONIES[k.param.feature], true);
1869 k.menu.createSeperator();
1870 }
1871
1872 for (var i = 0, len = PONIES.length; i < len; i += 1) {
1873 if (k.param.feature && k.param.feature != -1 && PONIES[k.param.feature].code == PONIES[i].code) {
1874 if (PONIES[i].seperator) {
1875 k.menu.createSeperator();
1876 }
1877 continue;
1878 }
1879
1880 var check = false;
1881 if (k.customCheckCondition) {
1882 if (k.customCheckCondition(PONIES[i].code)) {
1883 check = true;
1884 }
1885 } else {
1886 if (PONIES[i].code == CURRENTPONY) {
1887 check = true;
1888 }
1889 }
1890
1891 k._createItem(PONIES[i], check);
1892
1893 if (PONIES[i].seperator) {
1894 k.menu.createSeperator();
1895 }
1896 }
1897
1898 var img = d.createElement('span');
1899 img.className = 'ponyhoof_loading ponyhoof_show_if_injected ponyhoof_loading_pony';
1900 k.menu.wrap.appendChild(img);
1901
1902 INTERNALUPDATE = iu;
1903 };
1904
1905 k._createItem = function(ponyData, check) {
1906 var unsearchable = false;
1907 if (ponyData.hidden) {
1908 unsearchable = true;
1909 }
1910 var menuItem = k.menu.createMenuItem({
1911 html: ponyData.name
1912 ,title: ponyData.menu_title
1913 ,data: ponyData.code
1914 ,check: check
1915 ,unsearchable: unsearchable
1916 ,searchAlternate: ponyData.search
1917 ,onclick: function(menuItem, menuClass) {
1918 if (!k.overrideClickAction) {
1919 var code = ponyData.code;
1920 CURRENTPONY = code;
1921
1922 changeThemeSmart(code);
1923 userSettings.theme = code;
1924 saveSettings();
1925
1926 menuClass.changeButtonText(ponyData.name);
1927 menuClass.changeChecked(menuItem);
1928 menuClass.close();
1929 }
1930
1931 if (k.customClick) {
1932 k.customClick(menuItem, menuClass);
1933 }
1934 }
1935 });
1936 if (ponyData.hidden) {
1937 addClass(menuItem.menuItem, 'ponyhoof_pony_hidden');
1938 }
1939 };
1940
1941 k.injectStyle = function() {
1942 var css = '';
1943 css += 'html .ponyhoof_pony_hidden {display:none;}';
1944 for (var i = 0, len = PONIES.length; i < len; i += 1) {
1945 if (PONIES[i].color) {
1946 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;}';
1947 }
1948 }
1949
1950 injectManualStyle(css, 'ponySelector');
1951 };
1952 };
1953
1954 // Sounds
1955 var _soundCache = {};
1956 var PonySound = function(id) {
1957 var k = this;
1958 k.id = id;
1959
1960 k.sound = d.createElement('audio');
1961
1962 // Don't loop sounds for 3 seconds
1963 k.wait = 3;
1964 k.respectSettings = true;
1965 k.respectVolumeSetting = true;
1966
1967 k._time = 0;
1968
1969 k.source = '';
1970 k.changeSource = function(source) {
1971 k.source = source;
1972 };
1973
1974 k.changeSourceSmart = function(source) {
1975 if (k.canPlayMp3()) {
1976 source = source.replace(/\.EXT/, '.mp3');
1977 } else if (k.canPlayOgg()) {
1978 source = source.replace(/\.EXT/, '.ogg');
1979 } else {
1980 throw new Error("No supported audio formats");
1981 }
1982
1983 k.changeSource(source);
1984 };
1985
1986 k.play = function() {
1987 if (k.respectSettings) {
1988 if (!userSettings.sounds) {
1989 return;
1990 }
1991 }
1992
1993 if (k.wait == 0) {
1994 k.continuePlaying();
1995 return;
1996 }
1997
1998 // Make sure we aren't playing it on another page already
1999 k._time = Math.floor(Date.now() / 1000);
2000
2001 //try {
2002 getValue(SETTINGSPREFIX+'soundCache', function(s) {
2003 if (typeof s != 'undefined') {
2004 try {
2005 _soundCache = JSON.parse(s);
2006 } catch (e) {
2007 _soundCache = {};
2008 }
2009
2010 if (_soundCache == null) {
2011 _soundCache = {};
2012 }
2013
2014 if (_soundCache[k.id]) {
2015 if (_soundCache[k.id]+k.wait <= k._time) {
2016 } else {
2017 return;
2018 }
2019 }
2020 }
2021
2022 k.continuePlaying();
2023 });
2024 //} catch (e) {
2025 // k.continuePlaying();
2026 //}
2027 };
2028
2029 k.continuePlaying = function() {
2030 if (k.wait) {
2031 _soundCache[k.id] = k._time;
2032 saveValue(SETTINGSPREFIX+'soundCache', JSON.stringify(_soundCache));
2033 }
2034
2035 if (k.respectVolumeSetting) {
2036 k.sound.volume = userSettings.soundsVolume;
2037 }
2038 k.sound.src = k.source;
2039 k.sound.play();
2040 };
2041
2042 // http://html5doctor.com/native-audio-in-the-browser/
2043 k.audioTagSupported = function() {
2044 return !!(k.sound.canPlayType);
2045 };
2046
2047 k.canPlayMp3 = function() {
2048 return !!k.sound.canPlayType && '' != k.sound.canPlayType('audio/mpeg');
2049 };
2050
2051 k.canPlayOgg = function() {
2052 return !!k.sound.canPlayType && '' != k.sound.canPlayType('audio/ogg; codecs="vorbis"');
2053 };
2054 };
2055
2056 var ponySounds = {};
2057 function initPonySound(id, source) {
2058 var source = source || '';
2059
2060 if (ponySounds[id]) {
2061 if (source) {
2062 ponySounds[id].changeSourceSmart(source);
2063 }
2064
2065 return ponySounds[id];
2066 }
2067
2068 var sound = new PonySound(id);
2069
2070 if (!sound.audioTagSupported()) {
2071 throw new Error('No <audio> tag support');
2072 }
2073
2074 if (source) {
2075 sound.changeSourceSmart(source);
2076 }
2077
2078 ponySounds[id] = sound;
2079
2080 return sound;
2081 }
2082
2083 // Updater
2084 var Updater = function() {
2085 var k = this;
2086
2087 k.classChecking = 'ponyhoof_updater_checking';
2088 k.classLatest = 'ponyhoof_updater_latest';
2089 k.classError = 'ponyhoof_updater_error';
2090 k.classNewVersion = 'ponyhoof_updater_newVersion';
2091 k.classVersionNum = 'ponyhoof_updater_versionNum';
2092 k.classUpdateButton = 'ponyhoof_updater_updateNow';
2093
2094 k.update_url = UPDATEURL;
2095
2096 k.update_json = {};
2097
2098 k.checkForUpdates = function() {
2099 loopClassName(k.classUpdateButton, function(ele) {
2100 if (ISSAFARI && STORAGEMETHOD != 'safari') {
2101 // NinjaKit is bugged and only listens to install script requests on page load, no DOMNodeInserted, so we plan to open a new window
2102 ele.target = '_blank';
2103 }
2104
2105 ele.addEventListener('click', k._updateNowButton, false);
2106 });
2107
2108 log("Checking for updates...");
2109 try {
2110 ajax({
2111 method: 'GET'
2112 ,url: k.update_url
2113 ,onload: function(response) {
2114 if (response.status != 200) {
2115 k._onError(response);
2116 return;
2117 }
2118
2119 try {
2120 var json = JSON.parse(response.responseText);
2121 } catch (e) {
2122 k._onError(response);
2123 return;
2124 }
2125
2126 if (json.version > VERSION) {
2127 k._newVersion(json);
2128 } else {
2129 k._noNewVersion();
2130 }
2131 }
2132 ,onerror: function(response) {
2133 k._onError(response);
2134 }
2135 });
2136 } catch (e) {
2137 k._onError(e);
2138 }
2139 };
2140
2141 k._noNewVersion = function() {
2142 // Hide checking for updates
2143 loopClassName(k.classChecking, function(ele) {
2144 ele.style.display = 'none';
2145 });
2146
2147 // Show yay
2148 loopClassName(k.classLatest, function(ele) {
2149 ele.style.display = 'block';
2150 });
2151 };
2152 k._newVersion = function(json) {
2153 k.update_json = json;
2154
2155 // Hide checking for updates
2156 loopClassName(k.classChecking, function(ele) {
2157 ele.style.display = 'none';
2158 });
2159
2160 // Show version number
2161 loopClassName(k.classVersionNum, function(ele) {
2162 ele.textContent = json.version;
2163 });
2164 // Show that we have a new version
2165 loopClassName(k.classNewVersion, function(ele) {
2166 ele.style.display = 'block';
2167 });
2168 // Change the update now button to point to the new link
2169 loopClassName(k.classUpdateButton, function(ele) {
2170 if (ISSAFARI && STORAGEMETHOD != 'safari') {
2171 ele.href = json.safari;
2172 return;
2173 }
2174
2175 switch (STORAGEMETHOD) {
2176 // v1.501
2177 case 'chrome':
2178 ele.href = json.chrome_url;
2179 break;
2180
2181 case 'opera':
2182 ele.href = json.opera_url;
2183 break;
2184
2185 // v1.521
2186 case 'safari':
2187 ele.href = json.safariextz;
2188 break;
2189
2190 // v1.611
2191 case 'xpi':
2192 // @todo
2193 break;
2194
2195 case 'mxaddon':
2196 // @todo
2197 break;
2198
2199 default:
2200 ele.href = json.update_url;
2201 break;
2202 }
2203 });
2204 };
2205 k._onError = function(response) {
2206 // Hide checking for updates
2207 loopClassName(k.classChecking, function(ele) {
2208 ele.style.display = 'none';
2209 });
2210
2211 // Show derp
2212 loopClassName(k.classError, function(ele) {
2213 ele.style.display = 'block';
2214 });
2215
2216 error("Error checking for updates.");
2217 dir(response);
2218 };
2219
2220 k.updateDialog = null;
2221 k._updateNowButton = function() {
2222 statTrack('updateNowButton');
2223
2224 switch (STORAGEMETHOD) {
2225 case 'chrome':
2226 k._cws();
2227 return false;
2228
2229 case 'opera':
2230 k._opera();
2231 return false;
2232
2233 case 'safari':
2234 k.safariInstruction();
2235 return false;
2236
2237 case 'xpi':
2238 k._xpi();
2239 return;
2240
2241 case 'mxaddon':
2242 // @todo
2243 return;
2244
2245 default:
2246 break;
2247 }
2248
2249 if (DIALOGS.updater_dialog) {
2250 k.updateDialog.show();
2251 return;
2252 }
2253
2254 var c = "The update will load after you reload Facebook.";
2255 if (ISCHROME) { // still localstorage
2256 c = "Click Continue on the bottom of this window and click Add to finish updating. The update will load after you reload Facebook.";
2257 } else if (ISSAFARI) { // still ninjakit
2258 c = "Follow the instructions in the new window and reload Facebook when you are done.";
2259 } else if (ISOPERA) { // still localstorage
2260 c = "Follow the instructions in the new window and reload Facebook when you are done.";
2261 } else if (STORAGEMETHOD == 'greasemonkey') {
2262 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'>";
2263 injectManualStyle('#ponyhoof_dialog_updater_dialog .generic_dialog_popup, #ponyhoof_dialog_updater_dialog .popup {width:600px;}', 'updater_dialog');
2264 }
2265
2266 var bottom = '';
2267 bottom += '<div class="lfloat"><a href="#" class="retry hidden_elem">Retry</a></div>';
2268 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm reloadNow" role="button"><span class="uiButtonText">'+CURRENTLANG.reloadNow+'</span></a>';
2269 bottom += '<a href="#" class="uiButton uiButtonLarge notNow" role="button"><span class="uiButtonText">'+CURRENTLANG.notNow+'</span></a>';
2270
2271 k.updateDialog = new Dialog('updater_dialog');
2272 k.updateDialog.alwaysModal = true;
2273 k.updateDialog.create();
2274 k.updateDialog.changeTitle(CURRENTLANG['updater_title']);
2275 k.updateDialog.changeContent(c);
2276 k.updateDialog.changeBottom(bottom);
2277
2278 if (!ISCHROME && STORAGEMETHOD == 'greasemonkey') {
2279 var retry = k.updateDialog.dialog.getElementsByClassName('retry');
2280 if (retry.length) {
2281 retry = retry[0];
2282 retry.href = k.update_json.update_url;
2283 removeClass(retry, 'hidden_elem');
2284 }
2285 }
2286 k._initReloadButtons(k.updateDialog);
2287
2288 return false;
2289 };
2290
2291 k.cwsDialog = null;
2292 k.cwsWaitDialog = null;
2293 k.cwsOneClickSuccess = false;
2294 k._cws = function() {
2295 if (k.cwsWaitDialog) {
2296 k._cws_showDialog();
2297 return;
2298 }
2299
2300 var ok = true;
2301 loopClassName(k.classUpdateButton, function(ele) {
2302 if (hasClass(ele, 'uiButtonDisabled')) {
2303 ok = false;
2304 } else {
2305 addClass(ele, 'uiButtonDisabled');
2306 }
2307 });
2308 if (!ok) {
2309 return;
2310 }
2311
2312 var c = "Updating... <span class='ponyhoof_loading'></span>";
2313 k.cwsWaitDialog = new Dialog('update_cwsWait');
2314 k.cwsWaitDialog.alwaysModal = true;
2315 k.cwsWaitDialog.noBottom = true;
2316 k.cwsWaitDialog.canCloseByEscapeKey = false;
2317 k.cwsWaitDialog.create();
2318 k.cwsWaitDialog.changeTitle(CURRENTLANG.updater_title);
2319 k.cwsWaitDialog.changeContent(c);
2320
2321 chrome_sendMessage({'command':'checkForUpdates'}, function(status, details) {
2322 if (status == 'update_available') {
2323 var c = "Downloading update... <span class='ponyhoof_loading'></span>";
2324 k.cwsWaitDialog.changeContent(c);
2325 chrome_sendMessage({'command':'onUpdateAvailable'}, function(status) {
2326 if (status == 'updated') {
2327 k.cwsOneClickSuccess = true;
2328
2329 var successText = '';
2330 var ponyData = convertCodeToData(REALPONY);
2331 if (ponyData.successText) {
2332 successText = ponyData.successText;
2333 } else {
2334 successText = "Yay!";
2335 }
2336 var c = successText+" Reloading... <span class='ponyhoof_loading'></span>";
2337 k.cwsWaitDialog.changeContent(c);
2338
2339 if (!k.cwsDialog) {
2340 chrome_sendMessage({'command':'reloadNow'}, function() {});
2341 w.setTimeout(function() {
2342 w.location.reload();
2343 }, 1000);
2344 }
2345 } else {
2346 k._cws_fallback();
2347 }
2348 });
2349 } else {
2350 k._cws_fallback();
2351 }
2352 });
2353
2354 w.setTimeout(k._cws_fallback, 8000);
2355 };
2356
2357 k._cws_fallback = function() {
2358 if (k.cwsOneClickSuccess) {
2359 return;
2360 }
2361 k.cwsOneClickSuccess = true;
2362
2363 k.cwsWaitDialog.close();
2364 loopClassName(k.classUpdateButton, function(ele) {
2365 removeClass(ele, 'uiButtonDisabled');
2366 });
2367 k._cws_showDialog();
2368 };
2369
2370 k._cws_showDialog = function() {
2371 if (k.cwsDialog) {
2372 k.cwsDialog.show();
2373 return;
2374 }
2375
2376 var header = '';
2377 if (DISTRIBUTION == 'cws') {
2378 if (!ISOPERABLINK) {
2379 header = "Ponyhoof automatically updates from the Chrome Web Store.";
2380 } else {
2381 header = "Ponyhoof automatically updates on Opera.";
2382 }
2383 } else {
2384 header = "Ponyhoof automatically updates on Google Chrome.";
2385 }
2386
2387 var newversion = k.update_json.version;
2388 var c = "<strong>"+header+"</strong><br><br>To update now, go to <strong>about:extensions</strong> in the address bar, enable <strong>Developer mode</strong> at the top-right and click <strong>Update extensions now</strong>.";
2389 if (newversion) {
2390 c += "<br><br>Verify that the version changes from "+VERSION+" to "+parseFloat(newversion)+" and reload Facebook.";
2391 }
2392 c += "<br><br><"+"img src='"+THEMEURL+"_welcome/chrome_forceupdate.png' alt='' width='177' height='108' class='ponyhoof_image_shadow'>";
2393
2394 var bottom = '';
2395 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm" role="button" id="ponyhoof_updater_cws_openExtensions"><span class="uiButtonText">Open Extensions</span></a>';
2396 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm reloadNow" role="button"><span class="uiButtonText">'+CURRENTLANG.reloadNow+'</span></a>';
2397 bottom += '<a href="#" class="uiButton uiButtonLarge notNow" role="button"><span class="uiButtonText">'+CURRENTLANG.notNow+'</span></a>';
2398
2399 k.cwsDialog = new Dialog('update_cws');
2400 k.cwsDialog.alwaysModal = true;
2401 k.cwsDialog.create();
2402 k.cwsDialog.changeTitle(CURRENTLANG['updater_title']);
2403 k.cwsDialog.changeContent(c);
2404 k.cwsDialog.changeBottom(bottom);
2405
2406 var openExtensionsButton = $('ponyhoof_updater_cws_openExtensions');
2407
2408 openExtensionsButton.addEventListener('click', function() {
2409 if (!hasClass(this, 'uiButtonDisabled')) {
2410 chrome_sendMessage({'command':'openExtensions'}, function() {});
2411 }
2412 return false;
2413 });
2414
2415 k._initReloadButtons(k.cwsDialog);
2416 };
2417
2418 k.operaDialog = null;
2419 k._opera = function() {
2420 if ($('ponyhoof_dialog_update_opera')) {
2421 k.operaDialog.show();
2422 return;
2423 }
2424
2425 var version = getBrowserVersion();
2426
2427 var c = '';
2428 if (parseFloat(version.full) >= 12.10) {
2429 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>";
2430 } else {
2431 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>";
2432 //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>";
2433 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>";
2434 }
2435 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'>";
2436
2437 var bottom = '';
2438 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm reloadNow" role="button"><span class="uiButtonText">'+CURRENTLANG.reloadNow+'</span></a>';
2439 bottom += '<a href="#" class="uiButton uiButtonLarge notNow" role="button"><span class="uiButtonText">'+CURRENTLANG.notNow+'</span></a>';
2440
2441 k.operaDialog = new Dialog('update_opera');
2442 k.operaDialog.alwaysModal = true;
2443 k.operaDialog.create();
2444 k.operaDialog.changeTitle(CURRENTLANG.updater_title);
2445 k.operaDialog.changeContent(c);
2446 k.operaDialog.changeBottom(bottom);
2447
2448 k._initReloadButtons(k.operaDialog);
2449 };
2450
2451 k.safariDialog = null;
2452 k.safariInstruction = function() {
2453 if (k.safariDialog) {
2454 k.safariDialog.show();
2455 return;
2456 }
2457
2458 injectManualStyle('#ponyhoof_dialog_update_safari .generic_dialog_popup, #ponyhoof_dialog_update_safari .popup {width:600px;}', 'update_safari');
2459
2460 var c = '';
2461 if (w.navigator.userAgent.indexOf('Mac OS X') != -1) {
2462 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>";
2463 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'>";
2464 } else {
2465 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>";
2466 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'>";
2467 }
2468
2469 var bottom = '';
2470 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm reloadNow" role="button"><span class="uiButtonText">'+CURRENTLANG.reloadNow+'</span></a>';
2471 bottom += '<a href="#" class="uiButton uiButtonLarge notNow" role="button"><span class="uiButtonText">'+CURRENTLANG.notNow+'</span></a>';
2472
2473 k.safariDialog = new Dialog('update_safari');
2474 k.safariDialog.alwaysModal = true;
2475 k.safariDialog.create();
2476 k.safariDialog.changeTitle(CURRENTLANG.updater_title);
2477 k.safariDialog.changeContent(c);
2478 k.safariDialog.changeBottom(bottom);
2479
2480 k._initReloadButtons(k.safariDialog);
2481 };
2482
2483 k.xpiDialog = null;
2484 k._xpi = function() {
2485 if (k.xpiDialog) {
2486 k.xpiDialog.show();
2487 return;
2488 }
2489
2490 var c = '';
2491 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>";
2492 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'>";
2493
2494 var bottom = '';
2495 bottom += '<div class="lfloat"><a href="#" class="retry">Retry</a></div>';
2496 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm reloadNow" role="button"><span class="uiButtonText">'+CURRENTLANG.reloadNow+'</span></a>';
2497 bottom += '<a href="#" class="uiButton uiButtonLarge notNow" role="button"><span class="uiButtonText">'+CURRENTLANG.notNow+'</span></a>';
2498
2499 k.xpiDialog = new Dialog('update_xpi');
2500 k.xpiDialog.alwaysModal = true;
2501 k.xpiDialog.create();
2502 k.xpiDialog.changeTitle(CURRENTLANG['updater_title']);
2503 k.xpiDialog.changeContent(c);
2504 k.xpiDialog.changeBottom(bottom);
2505
2506 var retry = k.xpiDialog.dialog.getElementsByClassName('retry');
2507 if (retry.length) {
2508 retry = retry[0];
2509 retry.href = k.update_json.xpi;
2510 }
2511 k._initReloadButtons(k.xpiDialog);
2512
2513 try {
2514 USW.InstallTrigger.install({
2515 "Ponyhoof": {
2516 URL: k.update_json.xpi
2517 ,IconURL: 'https://hoof.little.my/files/app32.png'
2518 }
2519 });
2520 } catch (e) {
2521 dir(e);
2522 }
2523 };
2524
2525 k._initReloadButtons = function(dialog) {
2526 $$(dialog.dialog, '.reloadNow', function(ele) {
2527 ele.addEventListener('click', function() {
2528 if (!hasClass(this, 'uiButtonDisabled')) {
2529 dialog.canCloseByEscapeKey = false;
2530 $$(dialog.dialog, '.uiButton', function(ele) {
2531 addClass(ele, 'uiButtonDisabled');
2532 });
2533 w.location.reload();
2534 }
2535 return false;
2536 });
2537 });
2538
2539 $$(dialog.dialog, '.notNow', function(ele) {
2540 ele.addEventListener('click', function() {
2541 if (!hasClass(this, 'uiButtonDisabled')) {
2542 dialog.close();
2543 }
2544 return false;
2545 });
2546 });
2547 };
2548 };
2549
2550 var BrowserPoniesHoof = function() {
2551 var k = this;
2552
2553 k.dialog = null;
2554 k.errorDialog = null;
2555 k.url = 'https://hoof.little.my/_browserponies/';
2556 k.initLoaded = false;
2557 k.ponies = [];
2558 k.ponySelected = 'RANDOM';
2559 k.doneCallback = function() {};
2560
2561 k.selectPoniesMenu = null;
2562 k.selectPoniesButton = null;
2563
2564 k.run = function() {
2565 if (!k.initLoaded) {
2566 k._init(k.run);
2567 return;
2568 }
2569
2570 k.spawnPony(k.ponySelected);
2571
2572 if (k.doneCallback) {
2573 k.doneCallback();
2574 }
2575 };
2576
2577 k._init = function(callback) {
2578 k._getAjax(k.url+'BrowserPoniesBaseConfig.json?userscript_version='+VERSION, function(response) {
2579 try {
2580 var tempPonies = JSON.parse(response.responseText);
2581 } catch (e) {
2582 if (k.errorCallback) {
2583 k.errorCallback(response);
2584 }
2585 return;
2586 }
2587 contentEval("var BrowserPoniesBaseConfig = "+response.responseText);
2588
2589 for (var i = 0, len = tempPonies.ponies.length; i < len; i += 1) {
2590 var pony = tempPonies.ponies[i].ini.split(/\r?\n/);
2591 for (var j = 0, jLen = pony.length; j < jLen; j += 1) {
2592 var temp = pony[j].split(',');
2593 if (temp && temp[0].toLowerCase() == 'name') {
2594 k.ponies.push(temp[1].replace(/\"/g, ''));
2595 break;
2596 }
2597 }
2598 }
2599
2600 k._getAjax(k.url+'browserponies.js?userscript_version='+VERSION, function(response) {
2601 contentEval(response.responseText);
2602 k.initLoaded = true;
2603
2604 contentEval(function(arg) {
2605 try {
2606 (function(cfg) {
2607 if (typeof(window.BrowserPoniesConfig) === "undefined") {
2608 window.BrowserPoniesConfig = {};
2609 }
2610 window.BrowserPonies.setBaseUrl(cfg.baseurl);
2611 if (!window.BrowserPoniesBaseConfig.loaded) {
2612 window.BrowserPonies.loadConfig(window.BrowserPoniesBaseConfig);
2613 window.BrowserPoniesBaseConfig.loaded = true;
2614 }
2615 window.BrowserPonies.loadConfig(cfg);
2616 })({"baseurl":arg.baseurl,"fadeDuration":500,"volume":1,"fps":25,"speed":3,"audioEnabled":false,"showFps":false,"showLoadProgress":true,"speakProbability":0.1});
2617 } catch (e) {
2618 if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
2619 console.log("Unable to hook to BrowserPonies");
2620 console.dir(e);
2621 }
2622 }
2623 }, {"CANLOG":CANLOG, "baseurl":k.url});
2624
2625 callback();
2626 });
2627 });
2628 }
2629
2630 k._getAjax = function(url, callback) {
2631 try {
2632 ajax({
2633 method: 'GET'
2634 ,url: url
2635 ,onload: function(response) {
2636 if (response.status != 200) {
2637 if (k.errorCallback) {
2638 k.errorCallback(response);
2639 }
2640 return;
2641 }
2642
2643 callback(response);
2644 }
2645 ,onerror: function(response) {
2646 if (k.errorCallback) {
2647 k.errorCallback(response);
2648 }
2649 }
2650 });
2651 } catch (e) {
2652 if (k.errorCallback) {
2653 k.errorCallback(e);
2654 }
2655 }
2656 };
2657
2658 k.createDialog = function() {
2659 if ($('ponyhoof_dialog_browserponies')) {
2660 k.dialog.show();
2661 return;
2662 }
2663
2664 k.injectStyle();
2665
2666 var c = '';
2667 c += '<div id="ponyhoof_bp_select"></div><br>';
2668 c += '<a href="#" class="uiButton uiButtonConfirm" role="button" id="ponyhoof_bp_more"><span class="uiButtonText">MORE PONY!</span></a><br><br>';
2669 c += '<a href="#" class="uiButton" role="button" id="ponyhoof_bp_close"><span class="uiButtonText">Hide this</span></a><br><br>';
2670 c += '<a href="#" class="uiButton" role="button" id="ponyhoof_bp_remove"><span class="uiButtonText">Reset</span></a>';
2671
2672 k.dialog = new Dialog('browserponies');
2673 k.dialog.canCloseByEscapeKey = false;
2674 k.dialog.canCardspace = false;
2675 k.dialog.noTitle = true;
2676 k.dialog.noBottom = true;
2677 k.dialog.create();
2678 k.dialog.changeContent(c);
2679
2680 $('ponyhoof_bp_more').addEventListener('click', k.morePonies, false);
2681 $('ponyhoof_bp_close').addEventListener('click', k.closeDialog, false);
2682 $('ponyhoof_bp_remove').addEventListener('click', k.clearAll, false);
2683
2684 k.selectPoniesMenu = new Menu('browserponies_select', $('ponyhoof_bp_select'));
2685 k.selectPoniesMenu.rightFaced = true;
2686 k.selectPoniesMenu.buttonTextClipped = 59;
2687 k.selectPoniesButton = k.selectPoniesMenu.createButton("(Random)");
2688 k.selectPoniesMenu.createMenu();
2689 k.selectPoniesMenu.attachButton();
2690
2691 k.selectPoniesMenu.createMenuItem({
2692 html: "(Random)"
2693 ,check: true
2694 ,unsearchable: true
2695 ,onclick: function(menuItem, menuClass) {
2696 k._select_spawn(menuItem, menuClass, 'RANDOM');
2697 }
2698 });
2699 for (var code in k.ponies) {
2700 if (k.ponies.hasOwnProperty(code)) {
2701 k._select_item(code);
2702 }
2703 }
2704
2705 k.dialog.show();
2706 };
2707
2708 k._select_item = function(code) {
2709 var pony = k.ponies[code];
2710 k.selectPoniesMenu.createMenuItem({
2711 html: pony
2712 ,onclick: function(menuItem, menuClass) {
2713 k._select_spawn(menuItem, menuClass, pony);
2714 }
2715 });
2716 };
2717
2718 k._select_spawn = function(menuItem, menuClass, pony) {
2719 menuClass.changeChecked(menuItem);
2720 menuClass.close();
2721
2722 if (pony == 'RANDOM') {
2723 menuClass.changeButtonText("(Random)");
2724 } else {
2725 menuClass.changeButtonText(pony);
2726 }
2727
2728 k.ponySelected = pony;
2729 k.spawnPony(pony);
2730 };
2731
2732 k.spawnPony = function(pony) {
2733 contentEval(function(arg) {
2734 try {
2735 if (arg.pony == 'RANDOM') {
2736 window.BrowserPonies.spawnRandom();
2737 } else {
2738 window.BrowserPonies.spawn(arg.pony);
2739 }
2740 if (!window.BrowserPonies.running()) {
2741 window.BrowserPonies.start();
2742 }
2743 } catch (e) {
2744 if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
2745 console.log("Unable to hook to BrowserPonies");
2746 console.dir(e);
2747 }
2748 }
2749 }, {"CANLOG":CANLOG, "pony":pony});
2750 };
2751
2752 k.createErrorDialog = function(response) {
2753 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>.");
2754 }
2755
2756 k.injectStyle = function() {
2757 var css = '';
2758 css += '#ponyhoof_dialog_browserponies .generic_dialog {z-index:100000000 !important;}';
2759 css += '#ponyhoof_dialog_browserponies .generic_dialog_popup {width:'+(88+8+8+8+10+10)+'px;margin:'+(38+8)+'px 8px 0 auto;}';
2760 css += 'body.hasSmurfbar #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-top:'+(42+8)+'px;}';
2761 css += 'body.hasVoiceBar #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-top:'+(56+8)+'px;}';
2762 css += 'body.hasSmurfbar.hasVoiceBar #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-top:'+(70+8)+'px;}';
2763 css += 'body.hasViewasChromeBar #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-top:'+(76+8)+'px;}';
2764 css += 'body.hasSmurfbar.hasViewasChromeBar #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-top:'+(80+8)+'px;}';
2765 css += '.sidebarMode #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-right:213px;}';
2766 css += '._4g5r #ponyhoof_dialog_browserponies .generic_dialog_popup, .-cx-PUBLIC-hasLitestandBookmarksSidebar__root #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-right:8px;}';
2767 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;}';
2768 css += '#ponyhoof_dialog_browserponies .popup:hover {opacity:1;}';
2769 css += '#ponyhoof_dialog_browserponies .content {background:#F2F2F2;text-align:center;}';
2770 css += '#ponyhoof_dialog_browserponies .uiButton {text-align:left;}';
2771 css += '#browser-ponies img {-webkit-user-select:none;-moz-user-select:none;user-select:none;}';
2772 injectManualStyle(css, 'browserponies');
2773 };
2774
2775 k.copyrightDialog = function() {
2776 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>");
2777 };
2778
2779 k.morePonies = function(e) {
2780 k.spawnPony(k.ponySelected);
2781 if (e) {
2782 e.preventDefault();
2783 }
2784 };
2785
2786 k.closeDialog = function(e) {
2787 k.dialog.close();
2788 if (e) {
2789 e.preventDefault();
2790 }
2791 };
2792
2793 k.clearAll = function(e) {
2794 //k.closeDialog();
2795 contentEval(function(arg) {
2796 try {
2797 window.BrowserPonies.unspawnAll();
2798 window.BrowserPonies.stop();
2799 } catch (e) {
2800 if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
2801 console.log("Unable to hook to BrowserPonies");
2802 console.dir(e);
2803 }
2804 }
2805 }, {"CANLOG":CANLOG});
2806 if (e) {
2807 e.preventDefault();
2808 }
2809 };
2810 };
2811
2812 // Options
2813 var Options = function() {
2814 var k = this;
2815
2816 k.dialog = null;
2817 k.saveButton = null;
2818
2819 k.needToSaveLabel = false;
2820 k.needToRefresh = false;
2821 k.canSaveSettings = true;
2822
2823 k._stack = CURRENTSTACK;
2824
2825 k.created = false;
2826 k.create = function() {
2827 // Did we create our Options interface already?
2828 if ($('ponyhoof_dialog_options')) {
2829 k._refreshDialog();
2830 return false;
2831 }
2832
2833 k.injectStyle();
2834
2835 if (!runMe) {
2836 var extra = '';
2837 if (ISCHROME) {
2838 extra = '<br><br><a href="http://jointheherd.little.my" target="_top">Please update to the latest version of Ponyhoof here.</a>';
2839 }
2840
2841 k.dialog = new Dialog('options_force_run');
2842 k.dialog.create();
2843 k.dialog.changeTitle("Ponyhoof does not run on "+w.location.hostname);
2844 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);
2845 k.dialog.addCloseButton();
2846 return;
2847 }
2848
2849 var c = '';
2850 c += '<div class="ponyhoof_tabs clearfix">';
2851 c += '<a href="#" class="active" data-ponyhoof-tab="main">'+CURRENTLANG.options_tabs_main+'</a>';
2852 c += '<a href="#" class="ponyhoof_show_if_injected" data-ponyhoof-tab="background">'+CURRENTLANG.options_tabs_background+'</a>';
2853 c += '<a href="#" class="ponyhoof_show_if_injected" data-ponyhoof-tab="sounds">'+CURRENTLANG.options_tabs_sounds+'</a>';
2854 c += '<a href="#" data-ponyhoof-tab="extras">'+CURRENTLANG.options_tabs_extras+'</a>';
2855 c += '<a href="#" data-ponyhoof-tab="advanced">'+CURRENTLANG.options_tabs_advanced+'</a>';
2856 c += '<a href="#" data-ponyhoof-tab="about">'+CURRENTLANG.options_tabs_about+'</a>';
2857 c += '</div>';
2858
2859 c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_main" style="display:block;">';
2860 //c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_main">';
2861 c += '<div class="clearfix">';
2862 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>';
2863
2864 var visitPageText = CURRENTLANG.settings_main_visitPage;
2865 if (ISUSINGBUSINESS) {
2866 visitPageText = CURRENTLANG.settings_main_visitPageBusiness;
2867 }
2868
2869 c += '<div class="ponyhoof_show_if_injected">Select your favorite character:</div>';
2870 c += '<div class="ponyhoof_hide_if_injected">Select your favorite character to re-enable Ponyhoof:</div>';
2871 c += '<div id="ponyhoof_options_pony"></div>';
2872 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>';
2873 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>';
2874 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>';
2875 c += '<div class="ponyhoof_show_if_injected"><a href="#" class="ponyhoof_options_fatlink" id="ponyhoof_options_disable">Disable Ponyhoof</a></div>';
2876
2877 c += '<div class="ponyhoof_message uiBoxYellow ponyhoof_updater_newVersion">';
2878 c += '<a href="#" class="uiButton uiButtonSpecial rfloat ponyhoof_updater_updateNow" role="button"><span class="uiButtonText">Update now</span></a>';
2879 c += '<span class="wrap">An update (v<span class="ponyhoof_updater_versionNum"></span>) for Ponyhoof is available.</span>';
2880 c += '</div>';
2881 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>';
2882 c += '</div>';
2883 c += '</div>';
2884
2885 c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_background">';
2886 c += '<div class="ponyhoof_show_if_injected">';
2887 c += 'Use as background:';
2888 c += '<ul class="ponyhoof_options_fatradio clearfix">';
2889 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>';
2890 c += '<li id="ponyhoof_options_background_loginbg" data-ponyhoof-background="loginbg"><a href="#"><span>Background</span><div class="wrap"><i></i></div></a></li>';
2891 c += '<li id="ponyhoof_options_background_custom" data-ponyhoof-background="custom"><a href="#"><span>Custom</span><div class="wrap"><i></i></div></a></li>';
2892 c += '</ul>';
2893
2894 c += '<div class="ponyhoof_message uiBoxRed hidden_elem" id="ponyhoof_options_background_error"></div>';
2895 c += '<div id="ponyhoof_options_background_drop">';
2896 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>';
2897 c += '<div id="ponyhoof_options_background_drop_dropping">Drop here</div>';
2898 c += '</div>';
2899 c += '</div>';
2900 c += '</div>';
2901
2902 c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_sounds">';
2903 c += '<div class="ponyhoof_show_if_injected">';
2904 c += '<div class="ponyhoof_message uiBoxRed hidden_elem unavailable">'+CURRENTLANG.settings_sounds_unavailable+'</div>';
2905
2906 var soundsText = CURRENTLANG.settings_sounds;
2907 if (ISUSINGPAGE || ISUSINGBUSINESS) {
2908 soundsText = CURRENTLANG.settings_sounds_noNotification;
2909 }
2910
2911 c += '<div class="available">';
2912 c += '<div class="ponyhoof_message uiBoxYellow notPage">Sounds are experimental, they might derp from time to time.</div>';
2913 c += '<div class="ponyhoof_message uiBoxRed usingPage">Notification sounds are not available when you are using Facebook as your page.</div><br>';
2914 c += k.generateCheckbox('sounds', soundsText, {customFunc:k.soundsClicked});
2915 c += '<div class="notPage notBusiness"><br>';
2916 c += '<div id="ponyhoof_options_soundsSettingsWrap">';
2917 c += '<div id="ponyhoof_options_soundsSetting" class="ponyhoof_menu_withlabel"><span class="ponyhoof_menu_label">Notification sound: </span></div>';
2918 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>';
2919 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>';
2920 c += '</div>';
2921 c += '</div>';
2922
2923 c += '<div class="notPage notBusiness"><br>';
2924 c += '<span class="ponyhoof_dialog_header">Chat</span>';
2925 c += '<div class="ponyhoof_message uiBoxYellow notPage hidden_elem" id="ponyhoof_options_soundsChatSoundWarning">';
2926 c += '<a href="#" class="uiButton uiButtonConfirm rfloat" role="button"><span class="uiButtonText">Enable now</span></a>';
2927 c += '<span class="wrap">The chat sound option built into Facebook needs to be enabled.</span>';
2928 c += '</div>';
2929 c += k.generateCheckbox('chatSound', "Change chat sound", {customFunc:k.chatSound});
2930 c += '<div id="ponyhoof_options_soundsChatWrap">';
2931 c += '<div id="ponyhoof_options_soundsChatSetting" class="ponyhoof_menu_withlabel"><span class="ponyhoof_menu_label">Chat sound: </span></div>';
2932 c += '</div>';
2933 c += '</div>';
2934 c += '</div>'; // .available
2935 c += '</div>';
2936 c += '<div class="ponyhoof_hide_if_injected ponyhoof_message uiBoxRed">';
2937 c += 'You must enable Ponyhoof to use Ponyhoof sounds.';
2938 c += '</div>';
2939 c += '</div>';
2940
2941 c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_extras">';
2942 c += '<div class="ponyhoof_show_if_injected">';
2943 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'});
2944 c += k.generateCheckbox('pinkieproof', "Strengthen the fourth wall", {title:"Prevents Pinkie Pie from breaking the fourth wall for non-villains"});
2945 c += '</div>';
2946 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});
2947 c += '<div class="ponyhoof_show_if_injected">';
2948 c += k.generateCheckbox('disable_emoticons', "Disable emoticon ponification");
2949 c += '<div id="ponyhoof_options_randomPonies" class="ponyhoof_menu_withlabel"><span class="ponyhoof_menu_label">Characters to randomize: </span></div>';
2950 c += '<div id="ponyhoof_options_costume" class="ponyhoof_menu_withlabel"><span class="ponyhoof_menu_label">Appearance: </span></div>';
2951 c += '</div>';
2952 c += '<div class="ponyhoof_hide_if_injected"><br></div>';
2953
2954 c += '<span class="ponyhoof_dialog_header">Multi-user</span>';
2955 c += k.generateCheckbox('allowLoginScreen', "Run Ponyhoof on the Facebook login screen", {global:true});
2956 c += k.generateCheckbox('runForNewUsers', "Run Ponyhoof for new users", {title:CURRENTLANG['settings_extras_runForNewUsers_explain'], global:true});
2957 c += '<br>';
2958
2959 c += '<div class="ponyhoof_show_if_injected">';
2960 c += '<span class="ponyhoof_dialog_header">Performance</span>';
2961 c += k.generateCheckbox('disable_animation', "Disable all animations");
2962 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});
2963 c += '<br>';
2964 c += '</div>';
2965
2966 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>';
2967 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>';
2968 c += '</div>';
2969
2970 c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_advanced">';
2971 c += '<div class="ponyhoof_message uiBoxYellow">These features are unsupported and used for debugging. This should be used by advanced users only.</div><br>';
2972 c += '<span class="ponyhoof_show_if_loaded inline">Style version <span class="ponyhoof_VERSION_CSS"></span><br><br></span>';
2973
2974 c += '<textarea id="ponyhoof_options_technical" READONLY spellcheck="false"></textarea><br><br>';
2975
2976 if (STORAGEMETHOD == 'localstorage') {
2977 c += '<span class="ponyhoof_dialog_header">localStorage dump</span>';
2978 c += '<textarea id="ponyhoof_options_dump" READONLY spellcheck="false"></textarea><br><br>';
2979 }
2980
2981 c += '<div class="ponyhoof_show_if_injected">';
2982 c += '<span class="ponyhoof_dialog_header">Custom CSS</span>';
2983 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>';
2984 c += '<a href="#" class="uiButton" role="button" id="ponyhoof_options_customcss_preview"><span class="uiButtonText">Preview</span></a><br><br>';
2985 c += '</div>';
2986
2987 c += '<span class="ponyhoof_dialog_header">Settings</span>';
2988 c += '<textarea id="ponyhoof_options_debug_settings" spellcheck="false"></textarea>';
2989 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>';
2990
2991 c += '<span class="ponyhoof_dialog_header">Other</span>';
2992 c += '<div class="ponyhoof_hide_if_injected ponyhoof_message uiBoxYellow">';
2993 c += 'You must enable Ponyhoof to use custom CSS or dump debug data.';
2994 c += '</div>';
2995
2996 c += k.generateCheckbox('debug_exposed', "Always show Debug tab");
2997 c += k.generateCheckbox('debug_slow_load', "Disable fast load");
2998 c += '<div class="ponyhoof_show_if_injected">';
2999 c += k.generateCheckbox('debug_dominserted_console', "Dump DOMNodeInserted data to console");
3000 c += k.generateCheckbox('debug_disablelog', "Disable console logging", {customFunc:k.debug_disablelog});
3001 c += k.generateCheckbox('debug_noMutationObserver', "Use legacy HTML detection (slower)", {refresh:true});
3002 c += k.generateCheckbox('debug_mutationDebug', "Dump mutation debug info to console");
3003 c += k.generateCheckbox('debug_betaFacebookLinks', "Rewrite links on beta.facebook.com", {refresh:true});
3004 c += '<a href="#" id="ponyhoof_options_tempRemove" class="ponyhoof_options_fatlink">Remove style</a>';
3005 c += '</div>';
3006 c += '<a href="#" id="ponyhoof_options_sendSource" class="ponyhoof_options_fatlink">Send page source</a>';
3007 c += '<a href="#" class="ponyhoof_options_fatlink" id="ponyhoof_options_clearLocalStorage" data-hover="tooltip">Reset all settings (including global)</a>';
3008 c += '</div>';
3009
3010 c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_about">';
3011 c += '<div class="clearfix">';
3012 c += '<div class="top">';
3013 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>';
3014 c += '</div>';
3015 c += '<strong>Ponyhoof v'+VERSION+'</strong><br>';
3016 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>';
3017 c += '</div>';
3018 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>';
3019 if (ISCHROME || (STORAGEMETHOD == 'chrome' && !ISOPERABLINK)) {
3020 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>';
3021 }
3022 c += '<iframe src="about:blank" id="ponyhoof_options_twitter" allowtransparency="true" frameborder="0" scrolling="no"></iframe>';
3023 if (ISCHROME || STORAGEMETHOD == 'chrome') {
3024 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>';
3025 }
3026
3027 c += '<div class="ponyhoof_options_aboutsection"><div class="inner">';
3028 c += '<strong>If you love Ponyhoof, then please help us a hoof and contribute to support development! Thanks!</strong><br><br>';
3029 c += '<div id="ponyhoof_donate" class="clearfix">';
3030 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>';
3031 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>
3032 c += '</div>';
3033 c += '</div></div>';
3034
3035 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>';
3036 c += '</div>';
3037 c += '</div>';
3038
3039 var successText = '';
3040 var ponyData = convertCodeToData(REALPONY);
3041 if (ponyData.successText) {
3042 successText = ponyData.successText+' ';
3043 }
3044 var bottom = '';
3045 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>';
3046 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm" role="button" id="ponyhoof_options_save"><span class="uiButtonText">'+CURRENTLANG.close+'</span></a>';
3047
3048 k.dialog = new Dialog('options');
3049 k.dialog.create();
3050 k.dialog.changeTitle(CURRENTLANG.options_title);
3051 k.dialog.changeContent(c);
3052 k.dialog.changeBottom(bottom);
3053 k.dialog.onclose = k.dialogOnClose;
3054 k.dialog.onclosefinish = k.dialogOnCloseFinish;
3055 k.created = true;
3056
3057 // After
3058 k.saveButton = $('ponyhoof_options_save');
3059 k.saveButton.addEventListener('click', k.saveButtonClick, false);
3060
3061 k.dialog.dialog.getElementsByClassName('ponyhoof_noShareIsCare')[0].addEventListener('click', function() {
3062 k.dialog.close();
3063 }, false);
3064
3065 var l = k.dialog.dialog.getElementsByClassName('ponyhoof_options_linkclick');
3066 for (var i = 0, len = l.length; i < len; i += 1) {
3067 l[i].addEventListener('click', function() {
3068 k.dialog.close();
3069 }, false);
3070 }
3071
3072 // Updater
3073 w.setTimeout(function() {
3074 var update = new Updater();
3075 update.checkForUpdates();
3076 }, 500);
3077
3078 k.checkboxInit();
3079 k.tabsInit();
3080
3081 // @todo make k.mainInit non-dependant
3082 k.mainInit();
3083
3084 k._refreshDialog();
3085
3086 if (userSettings.debug_exposed) {
3087 addClass(k.dialog.dialog, 'ponyhoof_options_debugExposed');
3088 }
3089 };
3090
3091 k._refreshDialog = function() {
3092 k.ki();
3093 k.disableDomNodeInserted();
3094
3095 if (k.debugLoaded) {
3096 $('ponyhoof_options_technical').textContent = k.techInfo();
3097 //$('ponyhoof_options_linkedcss').textContent = k.linkedCss();
3098 }
3099 };
3100
3101 k.debugLoaded = false;
3102 k.techInfo = function() {
3103 var cxPrivate = false;
3104 if (d.getElementsByClassName('-cx-PRIVATE-fbLayout__root').length) {
3105 cxPrivate = true;
3106 }
3107
3108 var tech = SIG + " " + new Date().toString() + "\n";
3109 tech += "USERID: " + USERID + "\n";
3110 tech += "CURRENTPONY: " + CURRENTPONY + "\n";
3111 tech += "REALPONY: " + REALPONY + "\n";
3112 tech += "CURRENTSTACK: " + CURRENTSTACK.stack + "\n";
3113 tech += "STORAGEMETHOD: " + STORAGEMETHOD + "\n";
3114 tech += "DISTRIBUTION: " + DISTRIBUTION + "\n";
3115 if (STORAGEMETHOD == 'localstorage') {
3116 tech += "localStorage.length: " + localStorage.length + "\n";
3117 }
3118 tech += "\n";
3119 tech += "navigator.userAgent: " + w.navigator.userAgent + "\n";
3120 tech += "document.documentElement.className: " + d.documentElement.className + "\n";
3121 tech += "document.body.className: " + d.body.className + "\n";
3122 tech += "Has cx-PRIVATE: " + cxPrivate + "\n";
3123 tech += "window.location.href: " + w.location.href + "\n";
3124 tech += "\n";
3125 tech += k.linkedCss();
3126 tech += "\n";
3127 tech += k.linkedScript();
3128 tech += "\n";
3129 tech += k.linkedIframe();
3130 tech += "\n";
3131
3132 var ext = [];
3133 var conflict = [];
3134 if ($('bfb_options_button')) {
3135 ext.push("Social Fixer");
3136 }
3137 if (d.getElementsByClassName('rg3fbpz-tooltip').length) {
3138 ext.push("Photo Zoom for Facebook");
3139 }
3140 if ($('fbpoptslink')) {
3141 ext.push("FB Purity");
3142 }
3143 if ($('fbfPopupContainer')) {
3144 ext.push("FFixer");
3145 }
3146 if ($('unfriend_finder')) {
3147 ext.push("Unfriend Finder");
3148 }
3149 if ($('window-resizer-tooltip')) {
3150 ext.push("Window Resizer");
3151 }
3152 if ($('hzImg')) {
3153 ext.push("Hover Zoom");
3154 }
3155 if ($('myGlobalPonies')) {
3156 ext.push("My Global Ponies");
3157 }
3158 if ($('memeticonStyle')) {
3159 ext.push("Memeticon (ads)");
3160 }
3161 if ($('socialplus')) {
3162 ext.push("SocialPlus! (ads)");
3163 }
3164 if (d.querySelector('script[src^="chrome-extension://igdhbblpcellaljokkpfhcjlagemhgjl"]')) {
3165 ext.push("Iminent (ads)");
3166 }
3167 if ($('_fbm-emoticons-wrapper')) {
3168 ext.push("myemoticons.com");
3169 }
3170 if (d.querySelector('script[src^="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl"]')) {
3171 ext.push("Skype plugin");
3172 }
3173 if (d.querySelector('script[src^="chrome-extension://jmfkcklnlgedgbglfkkgedjfmejoahla"]')) {
3174 ext.push("AVG Safe Search");
3175 }
3176 if ($('DAPPlugin')) {
3177 ext.push("Download Accelerator Plus");
3178 }
3179
3180 if ($('bfb_theme')) {
3181 conflict.push("Social Fixer theme");
3182 }
3183 if ($('mycssstyle')) {
3184 conflict.push("SocialPlus! theme");
3185 }
3186 if ($('ColourChanger')) {
3187 conflict.push("Facebook Colour Changer");
3188 }
3189 if (hasClass(d.documentElement, 'myFacebook')) {
3190 conflict.push("Color My Facebook");
3191 }
3192 if (w.navigator.userAgent.match(/Mozilla\/4\.0 \(compatible\; MSIE 7\.0\; Windows/)) {
3193 conflict.push("IE 7 user-agent spoofing");
3194 }
3195 tech += "Installed extensions: ";
3196 if (ext.length) {
3197 for (var i = 0, len = ext.length; i < len; i += 1) {
3198 tech += ext[i];
3199 if (ext.length-1 != i) {
3200 tech += ', ';
3201 }
3202 }
3203 } else {
3204 tech += "None detected";
3205 }
3206 tech += "\n";
3207
3208 tech += "Conflicts: ";
3209 if (conflict.length) {
3210 for (var i = 0, len = conflict.length; i < len; i += 1) {
3211 tech += conflict[i];
3212 if (conflict.length-1 != i) {
3213 tech += ', ';
3214 }
3215 }
3216 } else {
3217 tech += "None detected";
3218 }
3219 tech += "\n";
3220
3221 return tech;
3222 };
3223
3224 k.linkedCss = function() {
3225 var css = d.getElementsByTagName('link');
3226 var t = '';
3227 for (var i = 0, len = css.length; i < len; i += 1) {
3228 if (css[i].rel == 'stylesheet') {
3229 t += css[i].href + "\n";
3230 }
3231 }
3232
3233 return t;
3234 };
3235
3236 k.linkedScript = function() {
3237 var script = d.getElementsByTagName('script');
3238 var t = '';
3239 for (var i = 0, len = script.length; i < len; i += 1) {
3240 if (script[i].src) {
3241 t += script[i].src + "\n";
3242 }
3243 }
3244
3245 return t;
3246 };
3247
3248 k.linkedIframe = function() {
3249 var iframe = d.getElementsByTagName('iframe');
3250 var t = '';
3251 for (var i = 0, len = iframe.length; i < len; i += 1) {
3252 if (iframe[i].src && iframe[i].src.indexOf('://'+getFbDomain()+'/ai.php') == -1) {
3253 t += iframe[i].src + "\n";
3254 }
3255 }
3256
3257 return t;
3258 };
3259
3260 k.debugInfo = function() {
3261 if (k.debugLoaded) {
3262 return;
3263 }
3264 k.debugLoaded = true;
3265
3266 // Custom CSS
3267 var customcss = $('ponyhoof_options_customcss');
3268 if (userSettings.customcss) {
3269 customcss.value = userSettings.customcss;
3270 }
3271 customcss.addEventListener('input', function() {
3272 if (!k.needsToRefresh) {
3273 k.needsToRefresh = true;
3274 k.updateCloseButton();
3275 }
3276 }, false);
3277 $('ponyhoof_options_customcss_preview').addEventListener('click', function() {
3278 if (!$('ponyhoof_style_customcss')) {
3279 injectManualStyle('', 'customcss');
3280 }
3281
3282 $('ponyhoof_style_customcss').textContent = '/* '+SIG+' */'+customcss.value;
3283 }, false);
3284
3285 // Technical info
3286 var techFirstHover = false;
3287 $('ponyhoof_options_technical').addEventListener('click', function() {
3288 if (!techFirstHover) {
3289 techFirstHover = true;
3290 this.focus();
3291 this.select();
3292 }
3293 }, false);
3294
3295 if (STORAGEMETHOD == 'localstorage') {
3296 var dump = '';
3297 for (var i in localStorage) {
3298 dump += i+": "+localStorage[i]+"\n";
3299 }
3300 $('ponyhoof_options_dump').value = dump;
3301 }
3302
3303 // Settings
3304 var settingsTextarea = $('ponyhoof_options_debug_settings');
3305
3306 $('ponyhoof_options_debug_settings_export').addEventListener('click', function() {
3307 settingsTextarea.value = JSON.stringify(userSettings);
3308 }, false);
3309
3310 $('ponyhoof_options_debug_settings_saveall').addEventListener('click', function(e) {
3311 e.preventDefault();
3312 try {
3313 var s = JSON.parse(settingsTextarea.value);
3314 } catch (e) {
3315 createSimpleDialog('debug_settingsKey_error', "Derp'd", "Invalid JSON<br><br><code>\n\n"+e.toString()+"</code>");
3316 return false;
3317 }
3318
3319 if (confirm(SIG+" Are you sure you want to overwrite your settings? Facebook will be reloaded immediately after saving.")) {
3320 userSettings = s;
3321 saveSettings();
3322 w.location.reload();
3323 }
3324 }, false);
3325
3326 // Other
3327 $('ponyhoof_options_tempRemove').addEventListener('click', k._debugRemoveStyle, false);
3328 k._debugNoMutationObserver();
3329
3330 $('ponyhoof_options_sendSource').addEventListener('click', function() {
3331 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.")) {
3332 k.dialog.hide();
3333
3334 var temp = $('ponyhoof_options_technical').value;
3335 $('ponyhoof_options_technical').value = '';
3336 if ($('ponyhoof_sourceSend_input')) {
3337 $('ponyhoof_sourceSend_input').value = '';
3338 var sourceSend = $('ponyhoof_sourceSend_input').parentNode;
3339 }
3340
3341 var settings = {};
3342 for (var x in userSettings) {
3343 settings[x] = userSettings[x];
3344 }
3345 settings['customBg'] = null;
3346
3347 var t = d.documentElement.innerHTML.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
3348 t = '<!DOCTYPE html><html class="'+d.documentElement.className+'" id="'+d.documentElement.id+'"><!-- '+k.techInfo()+"\n\n"+JSON.stringify(settings)+' -->'+t+'</html>';
3349
3350 if ($('ponyhoof_sourceSend_input')) {
3351 $('ponyhoof_sourceSend_input').value = t;
3352 } else {
3353 var sourceSendTxt = d.createElement('input');
3354 sourceSendTxt.type = 'hidden';
3355 sourceSendTxt.id = 'ponyhoof_sourceSend_input';
3356 sourceSendTxt.name = 'post';
3357 sourceSendTxt.value = t;
3358
3359 var sourceSend = d.createElement('form');
3360 sourceSend.method = 'POST';
3361 sourceSend.action = 'https://paste.little.my/post/';
3362 sourceSend.target = '_blank';
3363 sourceSend.appendChild(sourceSendTxt);
3364 d.body.appendChild(sourceSend);
3365 }
3366
3367 sourceSend.submit();
3368
3369 $('ponyhoof_options_technical').value = temp;
3370 }
3371 return false;
3372 }, false);
3373
3374 $('ponyhoof_options_technical').textContent = k.techInfo();
3375 //$('ponyhoof_options_linkedcss').textContent = k.linkedCss();
3376 };
3377
3378 k._debugRemoveStyle = function(e) {
3379 changeThemeSmart('NONE');
3380
3381 d.removeEventListener('DOMNodeInserted', DOMNodeInserted, true);
3382 if (mutationObserverMain) {
3383 mutationObserverMain.disconnect();
3384 }
3385
3386 k.dialog.close();
3387 e.preventDefault();
3388 };
3389
3390 k._debugNoMutationObserver = function() {
3391 var mutationObserver = w.WebKitMutationObserver || w.MutationObserver || false;
3392 if (!mutationObserver) {
3393 var option = $('ponyhoof_options_debug_noMutationObserver');
3394 option.disabled = true;
3395 option.checked = true;
3396
3397 var label = $('ponyhoof_options_label_debug_noMutationObserver');
3398 addClass(label, 'ponyhoof_options_unavailable');
3399 label.setAttribute('data-hover', 'tooltip');
3400 label.setAttribute('aria-label', "The new HTML detection method is not supported on your browser. Please update your browser if possible.");
3401 }
3402 };
3403
3404 k.mainInitLoaded = false;
3405 k.mainInit = function() {
3406 if (k.mainInitLoaded) {
3407 return;
3408 }
3409
3410 // Pony selector
3411 var ponySelector = new PonySelector($('ponyhoof_options_pony'), {});
3412 ponySelector.allowRandom = true;
3413 ponySelector.customClick = function(menuItem, menuClass) {
3414 if (ponySelector.oldPony == 'NONE' || CURRENTPONY == 'NONE') {
3415 if (ponySelector.oldPony == 'NONE' && CURRENTPONY != 'NONE') {
3416 extraInjection();
3417 runDOMNodeInserted();
3418 }
3419 }
3420 if (ponySelector.oldPony != 'NONE' && CURRENTPONY == 'NONE') {
3421 k.needsToRefresh = true;
3422 }
3423 if (k._stack != CURRENTSTACK) {
3424 k.needsToRefresh = true;
3425 }
3426 k.needToSaveLabel = true;
3427 k.updateCloseButton();
3428
3429 var f = k.dialog.dialog.getElementsByClassName('ponyhoof_options_framerefresh');
3430 for (var i = 0, len = f.length; i < len; i += 1) {
3431 (function() {
3432 var iframe = f[i];
3433 fadeOut(iframe, function() {
3434 w.setTimeout(function() {
3435 iframe.style.display = '';
3436 removeClass(iframe, 'ponyhoof_fadeout');
3437
3438 iframe.src = iframe.src.replace(/\href\=/, '&href=');
3439 }, 250);
3440 });
3441 })();
3442 }
3443 };
3444 ponySelector.createSelector();
3445
3446 if (!ISUSINGPAGE && !ISUSINGBUSINESS) {
3447 w.setTimeout(function() {
3448 $('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';
3449 }, 500);
3450 }
3451
3452 // Disable Ponyhoof
3453 $('ponyhoof_options_disable').addEventListener('click', k.disablePonyhoof, false);
3454
3455 // Browser Ponies
3456 $('ponyhoof_browserponies').addEventListener('click', k.runBrowserPonies, false);
3457
3458 k.mainInitLoaded = true;
3459 };
3460
3461 k.extrasInitLoaded = false;
3462 k.extrasInit = function() {
3463 if (k.extrasInitLoaded) {
3464 return;
3465 }
3466
3467 var litestand = false;
3468 if (d.getElementsByClassName('_4g5r').length) {
3469 litestand = true;
3470 } else if (d.getElementsByClassName('-cx-PUBLIC-hasLitestandBookmarksSidebar__root').length) {
3471 litestand = true;
3472 }
3473 if (litestand) {
3474 var option = $('ponyhoof_options_show_messages_other');
3475 option.disabled = true;
3476 option.checked = false;
3477
3478 var label = $('ponyhoof_options_label_show_messages_other');
3479 addClass(label, 'ponyhoof_options_unavailable');
3480 label.setAttribute('data-hover', 'tooltip');
3481 label.setAttribute('aria-label', "This option is not available on the new Facebook news feed");
3482 }
3483
3484 k.randomInit();
3485 k.costumesInit();
3486
3487 // Disable animations
3488 if (!supportsCssTransition()) {
3489 var option = $('ponyhoof_options_disable_animation');
3490 option.disabled = true;
3491 option.checked = true;
3492
3493 var label = $('ponyhoof_options_label_disable_animation');
3494 addClass(label, 'ponyhoof_options_unavailable');
3495 label.setAttribute('data-hover', 'tooltip');
3496 label.setAttribute('aria-label', "Animations are not supported on your browser. Please update your browser if possible.");
3497 }
3498
3499 // Reset settings
3500 $('ponyhoof_options_resetSettings').addEventListener('click', k.resetSettings, false);
3501 $('ponyhoof_options_clearLocalStorage').addEventListener('click', k.clearStorage, false);
3502
3503 k.extrasInitLoaded = true;
3504 };
3505
3506 k.extrasCostumeMenu = null;
3507 k.extrasCostumeButton = null;
3508 k.extrasCostumeMenuItemNormal = null;
3509 k.extrasCostumeMenuItems = {};
3510 k.costumesInit = function() {
3511 var desc = "(Normal)";
3512 var check = true;
3513 if (userSettings.costume && doesCharacterHaveCostume(REALPONY, userSettings.costume)) {
3514 desc = COSTUMESX[userSettings.costume].name;
3515 check = false;
3516 }
3517
3518 k.extrasCostumeMenu = new Menu('costume', $('ponyhoof_options_costume'));
3519 k.extrasCostumeButton = k.extrasCostumeMenu.createButton(desc);
3520 k.extrasCostumeButton.setAttribute('data-hover', 'tooltip');
3521 k.extrasCostumeButton.setAttribute('aria-label', CURRENTLANG.costume_tooltip);
3522 k.extrasCostumeMenu.canSearch = false;
3523 k.extrasCostumeMenu.createMenu();
3524 k.extrasCostumeMenu.attachButton();
3525 k.extrasCostumeMenuItemNormal = k.extrasCostumeMenu.createMenuItem({
3526 html: "(Normal)"
3527 ,data: ''
3528 ,check: check
3529 ,onclick: function(menuItem, menuClass) {
3530 k._costumesInit_save(menuItem, menuClass, '');
3531 }
3532 });
3533
3534 for (var code in COSTUMESX) {
3535 if (COSTUMESX.hasOwnProperty(code)) {
3536 k._costumesInit_item(code);
3537 }
3538 }
3539
3540 changeThemeFuncQueue.push(function() {
3541 if (doesCharacterHaveCostume(REALPONY, userSettings.costume)) {
3542 k.extrasCostumeMenu.changeButtonText(COSTUMESX[userSettings.costume].name);
3543 k.extrasCostumeMenu.changeChecked(k.extrasCostumeMenuItems[userSettings.costume]);
3544 } else {
3545 k.extrasCostumeMenu.changeButtonText("(Normal)");
3546 k.extrasCostumeMenu.changeChecked(k.extrasCostumeMenuItemNormal);
3547 }
3548
3549 for (var code in COSTUMESX) {
3550 if (COSTUMESX.hasOwnProperty(code)) {
3551 if (doesCharacterHaveCostume(REALPONY, code)) {
3552 removeClass(k.extrasCostumeMenuItems[code].menuItem, 'hidden_elem');
3553 } else {
3554 addClass(k.extrasCostumeMenuItems[code].menuItem, 'hidden_elem');
3555 }
3556 }
3557 }
3558 });
3559 };
3560
3561 k._costumesInit_item = function(code) {
3562 var check = false;
3563 var extraClass = '';
3564 if (doesCharacterHaveCostume(REALPONY, code)) {
3565 if (userSettings.costume == code) {
3566 check = true;
3567 }
3568 } else {
3569 extraClass += ' hidden_elem';
3570 }
3571
3572 k.extrasCostumeMenuItems[code] = k.extrasCostumeMenu.createMenuItem({
3573 html: COSTUMESX[code].name
3574 ,data: code
3575 ,check: check
3576 ,extraClass: extraClass
3577 ,onclick: function(menuItem, menuClass) {
3578 k._costumesInit_save(menuItem, menuClass, code);
3579 }
3580 });
3581 };
3582
3583 k._costumesInit_save = function(menuItem, menuClass, code) {
3584 if (!COSTUMESX[code] && code != '') {
3585 return;
3586 }
3587
3588 changeCostume(code);
3589 userSettings.costume = code;
3590 saveSettings();
3591
3592 if (COSTUMESX[code]) {
3593 menuClass.changeButtonText(COSTUMESX[code].name);
3594 } else {
3595 menuClass.changeButtonText("(Normal)");
3596 }
3597 menuClass.changeChecked(menuItem);
3598 menuClass.close();
3599
3600 k.needToSaveLabel = true;
3601 k.updateCloseButton();
3602 };
3603
3604 k.resetSettings = function(e) {
3605 e.preventDefault();
3606
3607 userSettings = {};
3608 saveSettings();
3609
3610 saveValue(SETTINGSPREFIX+'soundCache', JSON.stringify(null));
3611
3612 k.canSaveSettings = false;
3613 k.dialog.close();
3614 w.location.reload();
3615 };
3616
3617 k.clearStorage = function(e) {
3618 k.canSaveSettings = false;
3619
3620 if (typeof GM_listValues != 'undefined') {
3621 try {
3622 var keys = GM_listValues();
3623 for (var i = 0, len = keys.length; i < len; i += 1) {
3624 GM_deleteValue(keys[i]);
3625 }
3626 } catch (e) {
3627 alert(e.toString());
3628 }
3629 }
3630
3631 switch (STORAGEMETHOD) {
3632 case 'localstorage':
3633 if (confirm(SIG+" localStorage must be cleared in order to reset settings. Doing this may cause other extensions to lose their settings.")) {
3634 try {
3635 localStorage.clear();
3636 } catch (e) {
3637 alert(e.toString());
3638 }
3639 } else {
3640 return false;
3641 }
3642 break;
3643
3644 case 'chrome':
3645 chrome_clearStorage();
3646 break;
3647
3648 case 'opera':
3649 opera_clearStorage();
3650 break;
3651
3652 case 'safari':
3653 safari_clearStorage();
3654 break;
3655
3656 case 'xpi':
3657 xpi_clearStorage();
3658 break;
3659
3660 case 'mxaddon':
3661 // @todo
3662 break;
3663
3664 default:
3665 break;
3666 }
3667
3668 k.dialog.close();
3669 e.preventDefault();
3670 w.location.reload();
3671 };
3672
3673 k.donateLoaded = false;
3674 k.loadDonate = function() {
3675 if (k.donateLoaded) {
3676 return;
3677 }
3678
3679 statTrack('aboutclicked');
3680
3681 $('ponyhoof_options_twitter').src = 'https://platform.twitter.com/widgets/follow_button.html?screen_name=ponyhoof&show_screen_name=true&show_count=true';
3682 if (ISCHROME || STORAGEMETHOD == 'chrome') {
3683 (function() {
3684 var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
3685 po.src = 'https://apis.google.com/js/plusone.js';
3686 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
3687 })();
3688 }
3689
3690 $('ponyhoof_options_donatepaypal_link').addEventListener('click', function() {
3691 $('ponyhoof_options_donatepaypal').submit();
3692 statTrack('paypalClicked');
3693 return false;
3694 }, false);
3695
3696 $('ponyhoof_donate_flattr_iframe').src = THEMEURL+'_welcome/flattrStandalone.htm';
3697
3698 k.donateLoaded = true;
3699 };
3700
3701 k.randomInit = function() {
3702 var current = [];
3703 if (userSettings.randomPonies) {
3704 current = userSettings.randomPonies.split('|');
3705 }
3706
3707 var outerwrap = $('ponyhoof_options_randomPonies');
3708 var ponySelector = new PonySelector(outerwrap, {});
3709 ponySelector.overrideClickAction = true;
3710 ponySelector.customCheckCondition = function(code) {
3711 if (current.indexOf(code) != -1) {
3712 return true;
3713 }
3714
3715 return false;
3716 };
3717 ponySelector.customClick = function(menuItem, menuClass) {
3718 var code = menuItem.menuItem.getAttribute('data-ponyhoof-menu-data');
3719
3720 if (!hasClass(menuItem.menuItem, 'ponyhoof_menuitem_checked')) {
3721 menuItem.menuItem.className += ' ponyhoof_menuitem_checked';
3722
3723 current.push(code);
3724 } else {
3725 removeClass(menuItem.menuItem, 'ponyhoof_menuitem_checked');
3726
3727 current.splice(current.indexOf(code), 1);
3728 }
3729 userSettings.randomPonies = current.join('|');
3730 saveSettings();
3731
3732 k._randomUpdateButtonText(current, menuClass);
3733 k.needToSaveLabel = true;
3734 k.updateCloseButton();
3735 };
3736 ponySelector.createSelector();
3737 k._randomUpdateButtonText(current, ponySelector.menu);
3738
3739 var mass = d.createElement('a');
3740 mass.href = '#';
3741 mass.className = 'uiButton';
3742 mass.setAttribute('role', 'button');
3743 mass.id = 'ponyhoof_options_randomPonies_mass';
3744 mass.innerHTML = '<span class="uiButtonText">'+CURRENTLANG.invertSelection+'</span>';
3745 mass.addEventListener('click', function(e) {
3746 var newCurrent = [];
3747 for (var i = 0, len = PONIES.length; i < len; i += 1) {
3748 var menuitem = ponySelector.menu.menu.querySelector('.ponyhoof_menuitem[data-ponyhoof-menu-data="'+PONIES[i].code+'"]');
3749 if (PONIES[i].hidden) {
3750 if (menuitem) {
3751 removeClass(menuitem, 'ponyhoof_menuitem_checked');
3752 }
3753 continue;
3754 }
3755 if (current.indexOf(PONIES[i].code) == -1) {
3756 newCurrent.push(PONIES[i].code);
3757
3758 if (menuitem) {
3759 addClass(menuitem, 'ponyhoof_menuitem_checked');
3760 }
3761 } else {
3762 if (menuitem) {
3763 removeClass(menuitem, 'ponyhoof_menuitem_checked');
3764 }
3765 }
3766 }
3767 current = newCurrent;
3768 userSettings.randomPonies = current.join('|');
3769 saveSettings();
3770
3771 k._randomUpdateButtonText(current, ponySelector.menu);
3772 k.needToSaveLabel = true;
3773 k.updateCloseButton();
3774 w.setTimeout(function() {
3775 ponySelector.menu.open();
3776 }, 1);
3777
3778 return false;
3779 }, false);
3780 outerwrap.appendChild(mass);
3781 };
3782
3783 k._randomUpdateButtonText = function(current, menuClass) {
3784 var buttonText = "("+current.length+" characters)";
3785 if (current.length == 0) {
3786 buttonText = "(All characters)";
3787 } else if (current.length == 1) {
3788 var data = convertCodeToData(current[0]);
3789 buttonText = data.name;
3790 }
3791 menuClass.changeButtonText(buttonText);
3792 };
3793
3794 k.soundsMenu = null;
3795 k.soundsButton = null;
3796 k.soundsInitLoaded = false;
3797 k.soundsNotifTypeMenu = null;
3798 k.soundsNotifTypeButton = null;
3799 k.soundsSettingsWrap = null;
3800
3801 k.soundsChatSoundWarning = null;
3802 k.soundsChatLoaded = false;
3803 k.soundsChatWrap = null;
3804 k.soundsChatMenu = null;
3805 k.soundsChatButton = null;
3806 k.soundsInit = function() {
3807 if (k.soundsInitLoaded) {
3808 return;
3809 }
3810
3811 try {
3812 if (typeof w.Audio === 'undefined') {
3813 throw 1;
3814 }
3815 initPonySound('soundsTest');
3816 } catch (e) {
3817 $$(k.dialog.dialog, '.unavailable', function(ele) {
3818 removeClass(ele, 'hidden_elem');
3819 });
3820 $$(k.dialog.dialog, '.available', function(ele) {
3821 addClass(ele, 'hidden_elem');
3822 });
3823 k.soundsInitLoaded = true;
3824 return;
3825 }
3826
3827 var desc = "(Auto-select)";
3828 if (SOUNDS[userSettings.soundsFile] && SOUNDS[userSettings.soundsFile].name) {
3829 desc = SOUNDS[userSettings.soundsFile].name;
3830 }
3831
3832 k.soundsMenu = new Menu('sounds', $('ponyhoof_options_soundsSetting'));
3833 k.soundsButton = k.soundsMenu.createButton(desc);
3834 k.soundsMenu.createMenu();
3835 k.soundsMenu.attachButton();
3836
3837 for (var code in SOUNDS) {
3838 if (SOUNDS.hasOwnProperty(code)) {
3839 k._soundsMenu_item(code);
3840
3841 if (SOUNDS[code].seperator) {
3842 k.soundsMenu.createSeperator();
3843 }
3844 }
3845 }
3846
3847 k._soundsNotifTypeInit();
3848
3849 var volumeInput = $('ponyhoof_options_soundsVolume');
3850 var volumePreview = $('ponyhoof_options_soundsVolumePreview');
3851 var volumeValue = $('ponyhoof_options_soundsVolumeValue');
3852 var volumeTimeout = null;
3853
3854 volumeInput.value = userSettings.soundsVolume * 100;
3855 if (supportsRange()) {
3856 volumePreview.style.display = 'none';
3857 volumeValue.style.display = 'inline';
3858 volumeValue.innerText = volumeInput.value+"%";
3859 volumeInput.addEventListener('change', function() {
3860 volumeValue.innerText = volumeInput.value+"%";
3861
3862 w.clearTimeout(volumeTimeout);
3863 volumeTimeout = w.setTimeout(function() {
3864 var volume = volumeInput.value / 100;
3865 userSettings.soundsVolume = Math.max(0, Math.min(volume, 1));
3866 saveSettings();
3867
3868 k._soundsPreview(userSettings.soundsFile);
3869 }, 300);
3870 }, false);
3871 } else {
3872 volumeInput.type = 'number';
3873 volumeInput.className = 'inputtext';
3874 volumeInput.setAttribute('data-hover', 'tooltip');
3875 volumeInput.setAttribute('aria-label', "Enter a number between 1-100");
3876 volumePreview.addEventListener('click', function(e) {
3877 var volume = volumeInput.value / 100;
3878 userSettings.soundsVolume = Math.max(0, Math.min(volume, 1));
3879 saveSettings();
3880
3881 k._soundsPreview(userSettings.soundsFile);
3882 e.preventDefault();
3883 }, false);
3884 }
3885
3886 k.soundsChanged();
3887
3888 // Detect chat sound enabled setting
3889 k.soundsChatSoundWarning = $('ponyhoof_options_soundsChatSoundWarning');
3890 k.soundsChatWrap = $('ponyhoof_options_soundsChatWrap');
3891 try {
3892 if (typeof USW.requireLazy == 'function') {
3893 USW.requireLazy(['ChatOptions', 'Arbiter'], function(ChatOptions, Arbiter) {
3894 if (userSettings.chatSound) {
3895 k._soundsChatSoundWarn(ChatOptions.getSetting('sound'));
3896 } else {
3897 addClass(k.soundsChatSoundWarning, 'hidden_elem');
3898 }
3899
3900 Arbiter.subscribe('chat/option-changed', function(e, option) {
3901 if (!userSettings.chatSound) {
3902 return;
3903 }
3904 if (option.name == 'sound') {
3905 k._soundsChatSoundWarn(option.value);
3906 }
3907 });
3908 });
3909 }
3910 } catch (e) {
3911 error("Unable to hook to ChatOptions and Arbiter");
3912 dir(e);
3913 }
3914 k._soundsChatLoad();
3915 k._soundsChatInit();
3916
3917 var button = k.soundsChatSoundWarning.getElementsByClassName('uiButton');
3918 button[0].addEventListener('click', function() {
3919 k._soundsTurnOnFbSound();
3920 }, false);
3921
3922 k.soundsInitLoaded = true;
3923 };
3924
3925 // Create a menu item for notification sounds
3926 // Used only on k.soundsInit()
3927 k._soundsMenu_item = function(code) {
3928 var check = false;
3929 if (userSettings.soundsFile == code) {
3930 check = true;
3931 }
3932
3933 k.soundsMenu.createMenuItem({
3934 html: SOUNDS[code].name
3935 ,title: SOUNDS[code].title
3936 ,data: code
3937 ,check: check
3938 ,onclick: function(menuItem, menuClass) {
3939 if (!SOUNDS[code] || !SOUNDS[code].name) {
3940 return;
3941 }
3942
3943 //$('ponyhoof_options_sounds').checked = true;
3944 //userSettings.sounds = true;
3945 userSettings.soundsFile = code;
3946 saveSettings();
3947
3948 k._soundsPreview(code);
3949
3950 menuClass.changeButtonText(menuItem.getText());
3951 menuClass.changeChecked(menuItem);
3952
3953 k.needToSaveLabel = true;
3954 k.updateCloseButton();
3955 }
3956 });
3957 };
3958
3959 // Warn people that Facebook's own chat sound needs to be enabled
3960 // Used 2 times on k.soundsInit()
3961 k._soundsChatSoundWarn = function(isFbSoundEnabled) {
3962 if (isFbSoundEnabled) {
3963 addClass(k.soundsChatSoundWarning, 'hidden_elem');
3964 $('ponyhoof_options_chatSound').disabled = false;
3965 if (userSettings.chatSound) {
3966 $('ponyhoof_options_chatSound').checked = true;
3967 }
3968 } else {
3969 removeClass(k.soundsChatSoundWarning, 'hidden_elem');
3970 $('ponyhoof_options_chatSound').disabled = true;
3971 $('ponyhoof_options_chatSound').checked = false;
3972 }
3973 };
3974
3975 // Turn on Facebook chat sounds
3976 // Used on k.soundsInit() and k.chatSound()
3977 k._soundsTurnOnFbSound = function() {
3978 try {
3979 if (typeof USW.requireLazy == 'function') {
3980 USW.requireLazy(['ChatOptions', 'ChatSidebarDropdown'], function(ChatOptions, ChatSidebarDropdown) {
3981 ChatOptions.setSetting('sound', 1);
3982 ChatSidebarDropdown.prototype.changeSetting('sound', 1);
3983 });
3984 }
3985 } catch (e) {
3986 error("Unable to hook to ChatOptions and ChatSidebarDropdown");
3987 dir(e);
3988 }
3989 };
3990
3991 k._soundsNotifTypeCurrent = [];
3992 // Initialize the notification sound blacklist and its HTML template
3993 // Used only on k.soundsInit()
3994 k._soundsNotifTypeInit = function() {
3995 if (userSettings.soundsNotifTypeBlacklist) {
3996 var current = userSettings.soundsNotifTypeBlacklist.split('|');
3997
3998 for (var code in SOUNDS_NOTIFTYPE) {
3999 if (current.indexOf(code) != -1) {
4000 k._soundsNotifTypeCurrent.push(code);
4001 }
4002 }
4003 }
4004
4005 k.soundsNotifTypeMenu = new Menu('soundsNotifType', $('ponyhoof_options_soundsNotifType'));
4006 k.soundsNotifTypeButton = k.soundsNotifTypeMenu.createButton('');
4007 k.soundsNotifTypeMenu.canSearch = false;
4008 k.soundsNotifTypeMenu.createMenu();
4009 k.soundsNotifTypeMenu.attachButton();
4010
4011 for (var code in SOUNDS_NOTIFTYPE) {
4012 if (SOUNDS_NOTIFTYPE.hasOwnProperty(code)) {
4013 k._soundsNotifTypeInit_item(code);
4014 }
4015 }
4016 k._soundsNotifTypeUpdateButtonText(k._soundsNotifTypeCurrent, k.soundsNotifTypeMenu);
4017 };
4018
4019 // Create a menu item for notification sound blacklist
4020 // Used only on k._soundsNotifTypeInit()
4021 k._soundsNotifTypeInit_item = function(code) {
4022 var check = false;
4023 if (k._soundsNotifTypeCurrent.indexOf(code) != -1) {
4024 check = true;
4025 }
4026
4027 k.soundsNotifTypeMenu.createMenuItem({
4028 html: SOUNDS_NOTIFTYPE[code].name
4029 ,data: code
4030 ,check: check
4031 ,onclick: function(menuItem, menuClass) {
4032 if (!SOUNDS_NOTIFTYPE[code] || !SOUNDS_NOTIFTYPE[code].name) {
4033 return;
4034 }
4035
4036 if (!hasClass(menuItem.menuItem, 'ponyhoof_menuitem_checked')) {
4037 menuItem.menuItem.className += ' ponyhoof_menuitem_checked';
4038
4039 k._soundsNotifTypeCurrent.push(code);
4040 } else {
4041 removeClass(menuItem.menuItem, 'ponyhoof_menuitem_checked');
4042
4043 k._soundsNotifTypeCurrent.splice(k._soundsNotifTypeCurrent.indexOf(code), 1);
4044 }
4045 userSettings.soundsNotifTypeBlacklist = k._soundsNotifTypeCurrent.join('|');
4046 saveSettings();
4047
4048 k._soundsNotifTypeUpdateButtonText(k._soundsNotifTypeCurrent, menuClass);
4049 k.needToSaveLabel = true;
4050 k.updateCloseButton();
4051 }
4052 });
4053 };
4054
4055 // Update the notification sound blacklist button text, perhaps after changes
4056 // Used on k._soundsNotifTypeInit() and k._soundsNotifType_item()
4057 k._soundsNotifTypeUpdateButtonText = function(current, menuClass) {
4058 var buttonText = "("+current.length+" types)";
4059 if (current.length == 0) {
4060 buttonText = "(None)";
4061 } else if (current.length == 1) {
4062 buttonText = SOUNDS_NOTIFTYPE[current[0]].name;
4063 }
4064 menuClass.changeButtonText(buttonText);
4065 };
4066
4067 // Hide/show the extra sound options if the main sound option id disabled/enabled
4068 // Used on k.soundsInit(), the sound option is changed, or DOMNodeInserted is disabled
4069 k.soundsChanged = function() {
4070 k.soundsSettingsWrap = k.soundsSettingsWrap || $('ponyhoof_options_soundsSettingsWrap');
4071 if (userSettings.sounds && !userSettings.disableDomNodeInserted) {
4072 removeClass(k.soundsSettingsWrap, 'hidden_elem');
4073 } else {
4074 addClass(k.soundsSettingsWrap, 'hidden_elem');
4075 }
4076 };
4077
4078 // 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"
4079 // Used when the sound option is changed
4080 k.soundsClicked = function() {
4081 k.soundsChanged();
4082
4083 if (userSettings.sounds) {
4084 turnOffFbNotificationSound();
4085 } else {
4086 // We already nuked Facebook's sounds, so we need to reload
4087 k.needsToRefresh = true;
4088 k.updateCloseButton();
4089 }
4090 };
4091
4092 // The wording of this function is a bit confusing
4093 // Hide/show the extra chat sound options if the chat sound option is disabled/enabled
4094 // Used on k.soundsInit() and k.chatSound()
4095 k._soundsChatInit = function() {
4096 if (userSettings.chatSound) {
4097 removeClass(k.soundsChatWrap, 'hidden_elem');
4098 } else {
4099 addClass(k.soundsChatSoundWarning, 'hidden_elem');
4100 addClass(k.soundsChatWrap, 'hidden_elem');
4101 }
4102 };
4103
4104 // Initialize the chat sounds options and its HTML template
4105 // Used only on k.soundsInit()
4106 k._soundsChatLoad = function() {
4107 if (k.soundsChatLoaded) {
4108 return;
4109 }
4110
4111 var desc = "(Select a chat sound)";
4112 if (SOUNDS_CHAT[userSettings.chatSoundFile] && SOUNDS_CHAT[userSettings.chatSoundFile].name) {
4113 desc = SOUNDS_CHAT[userSettings.chatSoundFile].name;
4114 }
4115 k.soundsChatMenu = new Menu('sounds_chat', $('ponyhoof_options_soundsChatSetting'));
4116 k.soundsChatButton = k.soundsChatMenu.createButton(desc);
4117 k.soundsChatMenu.canSearch = false;
4118 k.soundsChatMenu.createMenu();
4119 k.soundsChatMenu.attachButton();
4120 for (var code in SOUNDS_CHAT) {
4121 if (SOUNDS_CHAT.hasOwnProperty(code)) {
4122 k._soundsChatLoad_item(code);
4123 }
4124 }
4125 k.soundsChatLoaded = true;
4126 };
4127
4128 // Create a menu item for chat sound options
4129 // Used only on k._soundsChatLoad()
4130 k._soundsChatLoad_item = function(code) {
4131 var check = false;
4132 if (userSettings.chatSoundFile == code) {
4133 check = true;
4134 }
4135
4136 k.soundsChatMenu.createMenuItem({
4137 html: SOUNDS_CHAT[code].name
4138 ,title: SOUNDS_CHAT[code].title
4139 ,data: code
4140 ,check: check
4141 ,onclick: function(menuItem, menuClass) {
4142 if (!SOUNDS_CHAT[code] || !SOUNDS_CHAT[code].name) {
4143 return;
4144 }
4145
4146 userSettings.chatSoundFile = code;
4147 saveSettings();
4148
4149 k._soundsPreview(code);
4150 changeChatSound(code);
4151
4152 menuClass.changeButtonText(menuItem.getText());
4153 menuClass.changeChecked(menuItem);
4154
4155 k.needToSaveLabel = true;
4156 k.updateCloseButton();
4157 }
4158 });
4159 };
4160
4161 // 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"
4162 // Also calls k._soundsChatInit()
4163 // Used when the chat sound option is changed
4164 k.chatSound = function() {
4165 if (userSettings.chatSound) {
4166 // Enable Facebook's chat sound automatically
4167 k._soundsTurnOnFbSound();
4168 if (SOUNDS_CHAT[userSettings.chatSoundFile] && SOUNDS_CHAT[userSettings.chatSoundFile].name) {
4169 changeChatSound(userSettings.chatSoundFile);
4170 }
4171 } else {
4172 // Chat sounds are already ponified, we need to reload to clear it
4173 k.needsToRefresh = true;
4174 k.updateCloseButton();
4175 }
4176 k._soundsChatInit();
4177 };
4178
4179 // Run a sound preview
4180 k._soundsPreview = function(code) {
4181 var sound = code;
4182 if (code == 'AUTO') {
4183 sound = '_sound/defaultNotification';
4184
4185 var data = convertCodeToData(REALPONY);
4186 if (data.soundNotif) {
4187 sound = data.soundNotif;
4188 }
4189 }
4190 try {
4191 var ps = initPonySound('soundsTest', THEMEURL+sound+'.EXT');
4192 ps.respectSettings = false;
4193 ps.wait = 0;
4194 ps.play();
4195 } catch (e) {}
4196 };
4197
4198 k.bgError = null;
4199 k.bgTab = null;
4200 k.bgDrop = null;
4201 k.bgClearCustomBg = false;
4202 k.bgInitLoaded = false;
4203 k.bgSizeLimit = 1024 * 1024;
4204 k.bgSizeLimitDescription = '1 MB';
4205 k.bgInit = function() {
4206 if (k.bgInitLoaded) {
4207 return;
4208 }
4209
4210 k.bgError = $('ponyhoof_options_background_error');
4211 k.bgTab = $('ponyhoof_options_tabs_background');
4212 k.bgDrop = $('ponyhoof_options_background_drop');
4213
4214 // Firefox 23 started enforcing a 1MB limit per preference
4215 // http://hg.mozilla.org/mozilla-central/rev/2e46cabb6a11
4216 if (ISFIREFOX) {
4217 k.bgSizeLimit = 1024 * 512;
4218 k.bgSizeLimitDescription = '512 KB';
4219 }
4220
4221 if (userSettings.customBg) {
4222 addClass(k.bgTab, 'hasCustom');
4223 addClass($('ponyhoof_options_background_custom'), 'active');
4224 } else if (userSettings.login_bg) {
4225 addClass($('ponyhoof_options_background_loginbg'), 'active');
4226 } else {
4227 addClass($('ponyhoof_options_background_cutie'), 'active');
4228 }
4229
4230 $$(k.bgTab, '.ponyhoof_options_fatradio a', function(ele) {
4231 ele.addEventListener('click', function() {
4232 $$(k.bgTab, '.ponyhoof_options_fatradio a', function(ele2) {
4233 removeClass(ele2.parentNode, 'active');
4234 });
4235
4236 var parent = this.parentNode;
4237 var attr = parent.getAttribute('data-ponyhoof-background');
4238 if (attr == 'custom') {
4239 userSettings.login_bg = false;
4240 changeCustomBg(userSettings.customBg);
4241 k.bgClearCustomBg = false;
4242 } else if (attr == 'loginbg') {
4243 userSettings.login_bg = true;
4244 changeCustomBg(null);
4245 addClass(d.documentElement, 'ponyhoof_settings_login_bg');
4246 k.bgClearCustomBg = true;
4247 } else {
4248 userSettings.login_bg = false;
4249 changeCustomBg(null);
4250 k.bgClearCustomBg = true;
4251 }
4252 addClass(parent, 'active');
4253 saveSettings();
4254
4255 k.needToSaveLabel = true;
4256 k.updateCloseButton();
4257
4258 return false;
4259 }, false);
4260 });
4261
4262 $('ponyhoof_options_background_select').addEventListener('change', function(e) {
4263 if (this.files && this.files[0]) {
4264 k.bgProcessFile(this.files[0]);
4265 }
4266 }, false);
4267
4268 var uiHelpLink = k.bgDrop.getElementsByClassName('uiHelpLink');
4269 if (uiHelpLink.length) {
4270 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.');
4271 }
4272
4273 k.bgDropInit();
4274
4275 k.bgInitLoaded = true;
4276 };
4277
4278 k.bgDropInit = function() {
4279 if (typeof w.FileReader == 'undefined') {
4280 k.bgError.textContent = "Custom background images are not supported on your browser. Please update your browser if possible.";
4281 removeClass(k.bgError, 'hidden_elem');
4282 addClass(k.bgDrop, 'hidden_elem');
4283 return;
4284 }
4285
4286 k.bgDrop.addEventListener('drop', function(e) {
4287 e.stopPropagation();
4288 e.preventDefault();
4289
4290 removeClass(this, 'ponyhoof_dropping');
4291
4292 if (e.dataTransfer.files && e.dataTransfer.files[0]) {
4293 k.bgProcessFile(e.dataTransfer.files[0]);
4294 }
4295 }, false);
4296
4297 k.bgDrop.addEventListener('dragover', function(e) {
4298 e.stopPropagation();
4299 e.preventDefault();
4300
4301 e.dataTransfer.dropEffect = 'copy';
4302 }, false);
4303
4304 k.bgDrop.addEventListener('dragenter', function(e) {
4305 addClass(k.bgDrop, 'ponyhoof_dropping');
4306 }, false);
4307
4308
4309 k.bgDrop.addEventListener('dragend', function(e) {
4310 removeClass(k.bgDrop, 'ponyhoof_dropping')
4311 }, false);
4312 }
4313
4314 k.bgProcessFile = function(file) {
4315 if (!file.type.match(/image.*/)) {
4316 if (file.type) {
4317 k.bgError.textContent = "The file ("+file.name+") doesn't seem to be an image ("+file.type+").";
4318 } else {
4319 k.bgError.textContent = "The file ("+file.name+") doesn't seem to be an image.";
4320 }
4321 removeClass(k.bgError, 'hidden_elem');
4322 return;
4323 }
4324
4325 if (file.size > k.bgSizeLimit) {
4326 if (file.type && file.type != 'image/jpeg') {
4327 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.";
4328 } else {
4329 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.";
4330 }
4331 removeClass(k.bgError, 'hidden_elem');
4332 return;
4333 }
4334
4335 var reader = new w.FileReader();
4336 reader.onload = function(e) {
4337 addClass(k.bgError, 'hidden_elem');
4338 addClass(k.bgTab, 'hasCustom');
4339
4340 $$(k.bgTab, '.ponyhoof_options_fatradio a', function(ele2) {
4341 removeClass(ele2.parentNode, 'active');
4342 });
4343 addClass($('ponyhoof_options_background_custom'), 'active');
4344 k.bgClearCustomBg = false;
4345
4346 userSettings.login_bg = false;
4347 userSettings.customBg = e.target.result;
4348 saveSettings();
4349
4350 k.needToSaveLabel = true;
4351 k.updateCloseButton();
4352
4353 changeCustomBg(e.target.result);
4354 };
4355 reader.onerror = function(e) {
4356 k.bgError.textContent = "An error occurred reading the file. Please try again.";
4357 dir(e);
4358 removeClass(k.bgError, 'hidden_elem');
4359 };
4360 reader.readAsDataURL(file);
4361 };
4362
4363 k.disableDomNodeInserted = function() {
4364 k.soundsChanged(); // to set k.soundsSettingsWrap
4365
4366 var affectedOptions = ['sounds', 'debug_dominserted_console', 'debug_noMutationObserver', 'debug_mutationDebug', 'debug_betaFacebookLinks'];
4367 //'disableCommentBrohoofed','debug_mutationObserver'
4368 for (var i = 0, len = affectedOptions.length; i < len; i += 1) {
4369 var option = $('ponyhoof_options_'+affectedOptions[i]);
4370 var label = $('ponyhoof_options_label_'+affectedOptions[i]);
4371 if (userSettings.disableDomNodeInserted) {
4372 if (ranDOMNodeInserted) {
4373 k.needsToRefresh = true;
4374 k.updateCloseButton();
4375 }
4376
4377 option.disabled = true;
4378 option.checked = false;
4379
4380 addClass(label, 'ponyhoof_options_unavailable');
4381 label.setAttribute('data-hover', 'tooltip');
4382 label.setAttribute('aria-label', "This feature is not available because HTML detection is disabled, re-enable it at the Misc tab");
4383 } else {
4384 var option = $('ponyhoof_options_'+affectedOptions[i]);
4385 option.disabled = false;
4386 if (userSettings[affectedOptions[i]]) {
4387 option.checked = true;
4388 }
4389
4390 removeClass(label, 'ponyhoof_options_unavailable');
4391 label.removeAttribute('data-hover');
4392 label.removeAttribute('aria-label');
4393 label.removeAttribute('aria-owns');
4394 label.removeAttribute('aria-controls');
4395 label.removeAttribute('aria-haspopup');
4396 }
4397 }
4398 k._debugNoMutationObserver();
4399 };
4400
4401 k.disableDomNodeInsertedClicked = function() {
4402 if (!userSettings.disableDomNodeInserted) {
4403 runDOMNodeInserted();
4404 }
4405 k.disableDomNodeInserted();
4406 };
4407
4408 k.debug_disablelog = function() {
4409 if ($('ponyhoof_options_debug_disablelog').checked) {
4410 CANLOG = false;
4411 } else {
4412 CANLOG = true;
4413 }
4414 };
4415
4416 k.disableDialog = null;
4417 k.disablePonyhoof = function() {
4418 if ($('ponyhoof_dialog_disable')) {
4419 $('ponyhoof_disable_allowLoginScreen').checked = !globalSettings.allowLoginScreen;
4420 $('ponyhoof_disable_runForNewUsers').checked = !globalSettings.runForNewUsers;
4421
4422 k.dialog.hide();
4423 k.disableDialog.show();
4424 $('ponyhoof_disable_ok').focus();
4425 return false;
4426 }
4427
4428 var c = '';
4429 c += "<strong>Are you sure you want to disable Ponyhoof for yourself?</strong><br><br>";
4430 c += "You can re-enable Ponyhoof for yourself at any time by going back to Ponyhoof Options and re-select a character.<br><br>";
4431 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>';
4432 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>';
4433
4434 var bottom = '';
4435 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm" role="button" id="ponyhoof_disable_ok"><span class="uiButtonText">Disable</span></a>';
4436 bottom += '<a href="#" class="uiButton uiButtonLarge" role="button" id="ponyhoof_disable_no"><span class="uiButtonText">Cancel</span></a>';
4437
4438 k.dialog.hide();
4439 k.disableDialog = new Dialog('disable');
4440 k.disableDialog.alwaysModal = true;
4441 k.disableDialog.create();
4442 k.disableDialog.changeTitle("Disable Ponyhoof");
4443 k.disableDialog.changeContent(c);
4444 k.disableDialog.changeBottom(bottom);
4445
4446 $('ponyhoof_disable_allowLoginScreen').checked = !globalSettings.allowLoginScreen;
4447 $('ponyhoof_disable_runForNewUsers').checked = !globalSettings.runForNewUsers;
4448
4449 k.disableDialog.show();
4450 k.disableDialog.onclose = function() {
4451 k.dialog.show();
4452 };
4453
4454 $('ponyhoof_disable_ok').focus();
4455 $('ponyhoof_disable_ok').addEventListener('click', function() {
4456 userSettings.theme = 'NONE';
4457 saveSettings();
4458
4459 globalSettings.allowLoginScreen = !$('ponyhoof_disable_allowLoginScreen').checked;
4460 globalSettings.runForNewUsers = !$('ponyhoof_disable_runForNewUsers').checked;
4461 saveGlobalSettings();
4462
4463 k.disableDialog.canCloseByEscapeKey = false;
4464 d.body.style.cursor = 'progress';
4465 $('ponyhoof_disable_allowLoginScreen').disabled = true;
4466 $('ponyhoof_disable_runForNewUsers').disabled = true;
4467 $('ponyhoof_disable_ok').className += ' uiButtonDisabled';
4468 $('ponyhoof_disable_no').className += ' uiButtonDisabled';
4469 w.location.reload();
4470
4471 return false;
4472 }, false);
4473
4474 $('ponyhoof_disable_no').addEventListener('click', function() {
4475 k.disableDialog.close();
4476 return false;
4477 }, false);
4478
4479 return false;
4480 };
4481
4482 k.browserPonies = null;
4483 k.runBrowserPonies = function() {
4484 var link = this;
4485 if (hasClass(link, 'ponyhoof_browserponies_loading')) {
4486 return false;
4487 }
4488
4489 var alreadyLoaded = !!k.browserPonies;
4490 addClass(link, 'ponyhoof_browserponies_loading');
4491
4492 if (!alreadyLoaded) {
4493 k.browserPonies = new BrowserPoniesHoof();
4494 }
4495 k.browserPonies.doneCallback = function() {
4496 k.dialog.close();
4497 removeClass(link, 'ponyhoof_browserponies_loading');
4498 if (!alreadyLoaded) {
4499 k.browserPonies.copyrightDialog();
4500 }
4501 k.browserPonies.createDialog();
4502 };
4503 k.browserPonies.errorCallback = function(error) {
4504 removeClass(link, 'ponyhoof_browserponies_loading');
4505 k.browserPonies.createErrorDialog(error);
4506 };
4507 k.browserPonies.run();
4508
4509 return false;
4510 }
4511
4512 k.checkboxStore = {};
4513 k.generateCheckbox = function(id, label, data) {
4514 data = data || {};
4515 var ex = '';
4516 var checkmark = '';
4517
4518 if ((!data.global && userSettings[id]) || (data.global && globalSettings[id])) {
4519 checkmark += ' CHECKED';
4520 }
4521 data.extraClass = data.extraClass || '';
4522 if (data.title) {
4523 label += ' <a href="#" class="uiHelpLink"></a>';
4524 ex += ' data-hover="tooltip" aria-label="'+data.title+'"';
4525 }
4526 if (data.tip) {
4527 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>';
4528 }
4529
4530 k.checkboxStore[id] = data;
4531
4532 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>';
4533 };
4534
4535 k.checkboxInit = function() {
4536 var extras = $('ponyhoof_dialog_options').querySelectorAll('input[type="checkbox"]');
4537 for (var i = 0, len = extras.length; i < len; i += 1) {
4538 var checkmark = extras[i].getAttribute('data-ponyhoof-checkmark');
4539 var data = {};
4540 if (k.checkboxStore[checkmark]) {
4541 data = k.checkboxStore[checkmark];
4542 }
4543 if (data.tooltipPosition) {
4544 extras[i].parentNode.setAttribute('data-tooltip-position', data.tooltipPosition);
4545 }
4546
4547 extras[i].addEventListener('click', function() {
4548 var checkmark = this.getAttribute('data-ponyhoof-checkmark');
4549 var data = {};
4550 if (k.checkboxStore[checkmark]) {
4551 data = k.checkboxStore[checkmark];
4552 }
4553
4554 if (!data.global) {
4555 userSettings[checkmark] = this.checked;
4556 saveSettings();
4557 } else {
4558 globalSettings[checkmark] = this.checked;
4559 saveGlobalSettings();
4560 }
4561
4562 if (this.checked) {
4563 addClass(d.documentElement, 'ponyhoof_settings_'+checkmark);
4564 } else {
4565 removeClass(d.documentElement, 'ponyhoof_settings_'+checkmark);
4566 }
4567 if (data.refresh) {
4568 k.needsToRefresh = true;
4569 }
4570 if (data.customFunc) {
4571 data.customFunc();
4572 }
4573
4574 k.needToSaveLabel = true;
4575 k.updateCloseButton();
4576 }, true);
4577 }
4578 };
4579
4580 k.tabsExposeDebug = 0;
4581 k.tabsInit = function() {
4582 var tabs = k.dialog.dialog.querySelectorAll('.ponyhoof_tabs a');
4583 for (var i = 0, len = tabs.length; i < len; i += 1) {
4584 tabs[i].addEventListener('click', function(e) {
4585 var tabName = this.getAttribute('data-ponyhoof-tab');
4586 if (tabName == 'extras') {
4587 if (!userSettings.debug_exposed && k.tabsExposeDebug < 5) {
4588 k.tabsExposeDebug += 1;
4589 if (k.tabsExposeDebug >= 5) {
4590 addClass(k.dialog.dialog, 'ponyhoof_options_debugExposed');
4591 k.switchTab('advanced');
4592 return;
4593 }
4594 }
4595 } else {
4596 k.tabsExposeDebug = 0;
4597 }
4598
4599 k.switchTab(tabName);
4600 e.preventDefault();
4601 }, false);
4602 }
4603 };
4604
4605 k.switchTab = function(tabName) {
4606 var tabActions = {
4607 'main': k.mainInit
4608 ,'background': k.bgInit
4609 ,'sounds': k.soundsInit
4610 ,'extras': k.extrasInit
4611 ,'advanced': k.debugInfo
4612 ,'about': k.loadDonate
4613 };
4614 removeClass(k.dialog.dialog.querySelector('.ponyhoof_tabs a.active'), 'active');
4615 addClass(k.dialog.dialog.querySelector('.ponyhoof_tabs a[data-ponyhoof-tab="'+tabName+'"]'), 'active');
4616
4617 try {
4618 if (tabActions[tabName]) {
4619 tabActions[tabName]();
4620 }
4621 } catch (e) {
4622 dir(e);
4623 ponyhoofError(e.toString());
4624 }
4625
4626 $$(k.dialog.dialog, '.ponyhoof_tabs_section', function(section) {
4627 section.style.display = 'none';
4628 });
4629 $('ponyhoof_options_tabs_'+tabName).style.display = 'block';
4630
4631 k.dialog.cardSpaceTick();
4632 };
4633
4634 k.saveButtonClick = function() {
4635 k.dialog.close();
4636 return false;
4637 };
4638
4639 k.dialogOnClose = function() {
4640 d.removeEventListener('keydown', k.kf, true);
4641
4642 if (k.debugLoaded) {
4643 if ($('ponyhoof_options_customcss').value == "Enter any custom CSS to load after Ponyhoof is loaded.") {
4644 userSettings.customcss = '';
4645 } else {
4646 userSettings.customcss = $('ponyhoof_options_customcss').value;
4647 }
4648 }
4649 if (k.canSaveSettings) {
4650 saveSettings();
4651 }
4652
4653 if (k.needsToRefresh) {
4654 w.location.reload();
4655 }
4656 };
4657
4658 k.dialogOnCloseFinish = function() {
4659 k.saveButton.getElementsByClassName('uiButtonText')[0].innerHTML = CURRENTLANG.close;
4660
4661 if (k.canSaveSettings) {
4662 if (k.bgClearCustomBg) {
4663 removeClass(k.bgTab, 'hasCustom');
4664 userSettings.customBg = null;
4665 saveSettings();
4666 }
4667 }
4668 };
4669
4670 k.updateCloseButton = function() {
4671 var button = k.saveButton.getElementsByClassName('uiButtonText')[0];
4672 var text = CURRENTLANG.close;
4673
4674 if (k.needToSaveLabel) {
4675 text = "Save & Close";
4676 }
4677
4678 if (k.needsToRefresh) {
4679 text = "Save & Reload";
4680 }
4681
4682 button.innerHTML = text;
4683 };
4684
4685 k.injectStyle = function() {
4686 var css = '';
4687 //css += '#ponyhoof_options_tabs_main .clearfix {margin-bottom:10px;}';
4688 css += '#ponyhoof_dialog_options .generic_dialog_popup, #ponyhoof_dialog_options .popup {width:480px;}';
4689 css += '#ponyhoof_options_likebox_div {height:80px;}';
4690 //css += 'html.ponyhoof_isusingpage #ponyhoof_options_likebox_div {display:none;}';
4691 css += '#ponyhoof_options_likebox {border:none;overflow:hidden;width:100%;height:80px;}';
4692 css += '#ponyhoof_options_pony {margin:8px 0 16px;}';
4693 css += '.ponyhoof_options_fatlink {display:block;margin-top:10px;}';
4694 css += '.ponyhoof_options_unavailable label {cursor:default;}';
4695 css += '#ponyhoof_dialog_options .usingPage, html.ponyhoof_isusingpage #ponyhoof_dialog_options .notPage {display:none;}';
4696 css += 'html.ponyhoof_isusingpage #ponyhoof_dialog_options .usingPage {display:block;}';
4697 css += 'html.ponyhoof_isusingbusiness #ponyhoof_dialog_options .notBusiness {display:none;}';
4698
4699 css += '#ponyhoof_dialog_options .uiHelpLink {margin-left:2px;}';
4700 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;}';
4701 css += '#ponyhoof_dialog_options textarea {resize:vertical;width:100%;height:60px;min-height:60px;line-height:normal;}';
4702 css += '#ponyhoof_dialog_options .ponyhoof_tabs > a[data-ponyhoof-tab="advanced"] {display:none;}';
4703 css += '#ponyhoof_dialog_options.ponyhoof_options_debugExposed .ponyhoof_tabs > a[data-ponyhoof-tab="advanced"] {display:block;}';
4704
4705 // 214px
4706 css += '.ponyhoof_options_fatradio {margin:8px 0;}';
4707 css += '.ponyhoof_options_fatradio li {width:222px;float:left;margin-left:12px;}';
4708 css += '#ponyhoof_options_tabs_background.hasCustom .ponyhoof_options_fatradio li {width:144px;}';
4709 css += '.ponyhoof_options_fatradio li:first-child {margin:0;}';
4710 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;}';
4711 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);}';
4712 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);}';
4713 css += '.ponyhoof_options_fatradio li.active a {background-color:#6D84B4;border-color:#3b5998;color:#fff;}';
4714 css += '.ponyhoof_options_fatradio span {padding:4px;display:block;}';
4715 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;}';
4716 css += '#ponyhoof_options_tabs_background.hasCustom .ponyhoof_options_fatradio .wrap i {height:144px;}';
4717 css += '#ponyhoof_options_background_cutie .wrap {padding:8px;}';
4718 css += '#ponyhoof_options_background_cutie .wrap i {width:206px;height:184px;}';
4719 css += '#ponyhoof_options_tabs_background.hasCustom #ponyhoof_options_background_cutie .wrap i {width:128px;height:128px;}';
4720 css += '#ponyhoof_options_background_custom {display:none;}';
4721 css += '#ponyhoof_options_tabs_background.hasCustom #ponyhoof_options_background_custom {display:block;}';
4722 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;}';
4723
4724 css += '#ponyhoof_options_background_error {margin-bottom:10px;}';
4725 css += '#ponyhoof_options_background_drop {background:#fff;border:2px dashed #75a3f5;padding:8px;position:relative;}'; //margin-bottom:8px;
4726 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;}';
4727 css += '#ponyhoof_options_background_drop.ponyhoof_dropping #ponyhoof_options_background_drop_dropping {display:block;}';
4728
4729 css += '#ponyhoof_options_tabs_main .ponyhoof_message {margin-top:10px;}';
4730 css += '#ponyhoof_browserponies .ponyhoof_loading {display:none;margin-top:0;vertical-align:text-bottom;}';
4731 css += '#ponyhoof_browserponies.ponyhoof_browserponies_loading .ponyhoof_loading {display:inline-block;}';
4732 css += '#ponyhoof_options_randomPonies .ponyhoof_loading {display:none !important;}';
4733 css += '#ponyhoof_options_randomPonies .ponyhoof_menuitem_checked {display:block;}';
4734 //css += '#ponyhoof_options_tabs_sounds .ponyhoof_message.unavailable {margin-bottom:10px;}';
4735 css += '#ponyhoof_options_soundsSettingsWrap {margin-top:-14px;}';
4736 css += '#ponyhoof_options_soundsVolume {vertical-align:middle;width:50px;}';
4737 css += '#ponyhoof_options_soundsVolume[type="range"] {cursor:pointer;width:200px;}';
4738 css += '#ponyhoof_options_soundsVolumePreview {vertical-align:middle;}';
4739 css += '#ponyhoof_options_soundsVolumeValue {display:none;padding-left:3px;}';
4740 css += '#ponyhoof_options_soundsChatSoundWarning {margin-bottom:10px;}';
4741 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;}';
4742 css += '#ponyhoof_options_tabs_advanced .ponyhoof_hide_if_injected.ponyhoof_message {margin-bottom:10px;}';
4743 css += '.ponyhoof_options_aboutsection {border-top:1px solid #ccc;margin:10px -10px 0;}';
4744 css += '.ponyhoof_options_aboutsection > .inner {border-top:1px solid #E9E9E9;padding:10px 10px 0;}';
4745 css += '#ponyhoof_options_devpic {display:block;}';
4746 css += '#ponyhoof_options_devpic img {width:50px !important;height:50px !important;}';
4747 css += '#ponyhoof_options_twitter {margin-top:10px;width:100%;height:20px;}';
4748 css += '#ponyhoof_options_plusone {margin-top:10px;height:23px;}';
4749
4750 css += '.ponyhoof_tip_wrapper {position:relative;z-index:10;}';
4751 css += '.ponyhoof_tip_trigger, .ponyhoof_tip_trigger:hover {text-decoration:none;}';
4752 css += '.ponyhoof_tip_trigger:hover .ponyhoof_tip {display:block;}';
4753 css += '.ponyhoof_options_unavailable .ponyhoof_tip_trigger {display:none !important;}';
4754 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;}';
4755 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);}';
4756 css += '.ponyhoof_tip_arrow {position:absolute;top:0;right:10px;border:solid transparent;border-width:0 3px 5px 4px;border-bottom-color:#888;}';
4757
4758 css += '#ponyhoof_donate {background:#EDEFF4;border:1px solid #D2DBEA;color:#9CADCF;font-family:Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;}';
4759 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%;}';
4760 css += '#ponyhoof_donate a {display:block;width:100%;color:#9CADCF;text-decoration:none;}';
4761 css += '#ponyhoof_options_donatepaypal {border-right:1px solid #D2DBEA;}';
4762 //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;}';
4763 css += '#ponyhoof_donate_flattr_iframe {width:55px;height:62px;margin-top:6px;}';
4764 css += '#ponyhoof_donate a:hover {background-color:#DEDFE7;color:#3B5998;}';
4765
4766 injectManualStyle(css, 'options');
4767 };
4768
4769 k.show = function() {
4770 if (!k.created) {
4771 k.create();
4772 }
4773 k.dialog.show();
4774 };
4775
4776 k.kr = false;
4777 k.ks = [];
4778 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';
4779 k.kf = function(e) {
4780 if (k.kr) {
4781 return;
4782 }
4783
4784 k.ks.push(e.which);
4785 if (k.ks.join(',').indexOf(k.kc) > -1) {
4786 k.kr = true;
4787 k.dialog.close();
4788
4789 var width = 720;
4790 var height = 405;
4791
4792 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');
4793 var di = new Dialog('ky');
4794 di.alwaysModal = true;
4795 di.create();
4796 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");
4797 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>');
4798 di.addCloseButton();
4799 di.onclosefinish = function() {
4800 di.changeContent('');
4801 };
4802
4803 $('ponyhoof_kc_share').addEventListener('click', function() {
4804 var width = 657;
4805 var height = 412;
4806 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);
4807 return false;
4808 }, false);
4809 }
4810 };
4811
4812 k.ki = function() {
4813 d.addEventListener('keydown', k.kf, true);
4814 };
4815 };
4816
4817 var optionsGlobal = null;
4818 function optionsOpen() {
4819 log("Opening options...");
4820
4821 if (!optionsGlobal) {
4822 optionsGlobal = new Options();
4823 }
4824 optionsGlobal.create();
4825 optionsGlobal.show();
4826
4827 $$($('ponyhoof_dialog_options'), '#ponyhoof_options_pony .ponyhoof_button_menu', function(button) {
4828 try {
4829 button.focus();
4830 } catch (e) {}
4831 });
4832 }
4833
4834 // Welcome
4835 var WelcomeUI = function(param) {
4836 var k = this;
4837
4838 if (param) {
4839 k.param = param;
4840 } else {
4841 k.param = {};
4842 }
4843 k.dialogFirst = null;
4844 k.dialogPinkie = null;
4845 k.dialogFinish = null;
4846
4847 k._stack = '';
4848
4849 k.start = function() {
4850 k.injectStyle();
4851 k.createScenery();
4852 addClass(d.documentElement, 'ponyhoof_welcome_html');
4853 statTrack('welcomeUI');
4854
4855 k.showWelcome();
4856 };
4857
4858 k.showWelcome = function() {
4859 if ($('ponyhoof_dialog_welcome')) {
4860 return;
4861 }
4862
4863 addClass(d.documentElement, 'ponyhoof_welcome_html_scenery_loaded');
4864
4865 var co = '';
4866 co += '<div class="uiBoxYellow ponyhoof_message ponyhoof_updater_newVersion">';
4867 co += '<a href="#" class="uiButton uiButtonSpecial rfloat ponyhoof_updater_updateNow" role="button"><span class="uiButtonText">Update now</span></a>';
4868 co += '<span class="wrap">An update (v<span class="ponyhoof_updater_versionNum"></span>) for Ponyhoof is available.</span>';
4869 co += '</div>';
4870
4871 co += '<strong>Select your favorite character to get started:</strong>';
4872 co += '<div id="ponyhoof_welcome_pony"></div>';
4873 co += '<div id="ponyhoof_welcome_afterClose">You can re-select your character in Ponyhoof Options at the Account menu.</div>';
4874
4875 var bottom = '';
4876 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm uiButtonDisabled" role="button" id="ponyhoof_welcome_next"><span class="uiButtonText">Next</span></a>';
4877
4878 DIALOGCOUNT += 5;
4879
4880 k.dialogFirst = new Dialog('welcome');
4881 k.dialogFirst.canCardspace = false;
4882 k.dialogFirst.canCloseByEscapeKey = false;
4883 k.dialogFirst.create();
4884 k.dialogFirst.generic_dialogDiv.className += ' generic_dialog_fixed_overflow';
4885 if (BRONYNAME) {
4886 k.dialogFirst.changeTitle("Welcome to Ponyhoof, "+BRONYNAME+"!");
4887 } else {
4888 k.dialogFirst.changeTitle("Welcome to Ponyhoof!");
4889 }
4890 k.dialogFirst.changeContent(co);
4891 k.dialogFirst.changeBottom(bottom);
4892
4893 DIALOGCOUNT += 4;
4894
4895 var menuClosed = false;
4896 var ponySelector = new PonySelector($('ponyhoof_welcome_pony'), k.param);
4897 ponySelector.createSelector();
4898 w.setTimeout(function() {
4899 ponySelector.menu.open();
4900 }, 1);
4901 ponySelector.menu.afterClose = function() {
4902 if (!menuClosed) {
4903 menuClosed = true;
4904 addClass($('ponyhoof_welcome_afterClose'), 'show');
4905
4906 addClass(d.documentElement, 'ponyhoof_welcome_showmedemo');
4907 if ($('navAccount')) {
4908 addClass($('navAccount'), 'openToggler');
4909 }
4910 //addClass($('ponyhoof_account_options'), 'active');
4911
4912 w.setTimeout(function() {
4913 removeClass($('ponyhoof_welcome_next'), 'uiButtonDisabled');
4914 }, 200);
4915 }
4916 };
4917
4918 w.setTimeout(function() {
4919 changeThemeSmart(CURRENTPONY);
4920 }, 10);
4921 k._stack = CURRENTSTACK;
4922
4923 w.setTimeout(function() {
4924 var update = new Updater();
4925 update.checkForUpdates();
4926 }, 500);
4927
4928 // Detect if the Facebook's chat sound setting is turned off
4929 // We need to do this here as it is async
4930 try {
4931 if (typeof USW.requireLazy == 'function') {
4932 USW.requireLazy(['ChatOptions'], function(ChatOptions) {
4933 if (!ChatOptions.getSetting('sound')) {
4934 userSettings.chatSound = false;
4935 }
4936 });
4937 }
4938 } catch (e) {
4939 error("Unable to hook to ChatOptions");
4940 dir(e);
4941 }
4942
4943 $('ponyhoof_welcome_next').addEventListener('click', function(e) {
4944 if (hasClass(this, 'uiButtonDisabled')) {
4945 e.preventDefault();
4946 return false;
4947 }
4948
4949 k.dialogFirst.close();
4950 fadeOut($('ponyhoof_welcome_scenery'));
4951
4952 w.setTimeout(function() {
4953 removeClass(d.documentElement, 'ponyhoof_welcome_showmedemo');
4954 removeClass($('navAccount'), 'openToggler');
4955 removeClass($('ponyhoof_account_options'), 'active');
4956 }, 100);
4957
4958 userSettings.theme = CURRENTPONY;
4959 userSettings.chatSound1401 = true;
4960 // Detect Social Fixer
4961 if ($('bfb_options_button')) {
4962 userSettings.show_messages_other = false;
4963 }
4964 saveSettings();
4965
4966 globalSettings.lastVersion = VERSION;
4967 saveGlobalSettings();
4968
4969 if (CURRENTPONY == 'pinkie') {
4970 k.pinkieWelcome();
4971 } else {
4972 k.createFinalDialog();
4973 }
4974
4975 e.preventDefault();
4976 }, false);
4977 };
4978
4979 k.pinkieWelcome = function() {
4980 removeClass(d.documentElement, 'ponyhoof_welcome_html_scenery_loaded');
4981
4982 var width = 720;
4983 var height = 405;
4984
4985 var bottom = '';
4986 bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm" role="button" id="ponyhoof_welcome_pinkie_next"><span class="uiButtonText">Stop being silly, Pinkie</span></a>';
4987
4988 k.dialogPinkie = new Dialog('welcome_pinkie');
4989 k.dialogPinkie.alwaysModal = true;
4990 k.dialogPinkie.create();
4991 k.dialogPinkie.changeTitle("\x59\x4F\x55\x20\x43\x48\x4F\x4F\x53\x45\x20\x50\x49\x4E\x4B\x49\x45\x21\x3F\x21");
4992 k.dialogPinkie.changeContent('<iframe src="//hoof.little.my/files/aEPDsG6R4dY.htm" width="100%" height="405" scrolling="auto" frameborder="0" allowTransparency="true"></iframe>');
4993 k.dialogPinkie.changeBottom(bottom);
4994 k.dialogPinkie.onclose = function() {
4995 fadeOut($('ponyhoof_welcome_scenery'));
4996 k.createFinalDialog();
4997 };
4998 k.dialogPinkie.onclosefinish = function() {
4999 k.dialogPinkie.changeContent('');
5000 };
5001
5002 $('ponyhoof_welcome_pinkie_next').addEventListener('click', function(e) {
5003 k.dialogPinkie.close();
5004 e.preventDefault();
5005 }, false);
5006 };
5007
5008 k.createFinalDialog = function() {
5009 removeClass(d.documentElement, 'ponyhoof_welcome_html');
5010 removeClass(d.documentElement, 'ponyhoof_welcome_html_scenery_loaded');
5011
5012 var c = '';
5013
5014 var lang = getDefaultUiLang();
5015 if (lang != 'en_US' && lang != 'en_GB') {
5016 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>';
5017 }
5018
5019 if (!ISUSINGBUSINESS) {
5020 c += '<span class="ponyhoof_brohoof_button">'+capitaliseFirstLetter(CURRENTSTACK['like'])+'</span> us to receive news and help for Ponyhoof!';
5021 c += '<iframe src="about:blank" id="ponyhoof_welcome_like" scrolling="no" frameborder="0" allowTransparency="true"></iframe>';
5022 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>';
5023 } else {
5024 c += '<a href="'+w.location.protocol+PONYHOOF_URL+'" target="_top" id="ponyhoof_welcome_posttowall">Visit our Ponyhoof page for the latest news!</a>';
5025 }
5026
5027 var successText = '';
5028 var ponyData = convertCodeToData(REALPONY);
5029 if (ponyData.successText) {
5030 successText = ponyData.successText;
5031 } else {
5032 successText = "Yay!";
5033 }
5034
5035 k.dialogFinish = new Dialog('welcome_final');
5036 if (k._stack != CURRENTSTACK) {
5037 k.dialogFinish.alwaysModal = true;
5038 }
5039 k.dialogFinish.create();
5040 k.dialogFinish.changeTitle(successText);
5041 k.dialogFinish.changeContent(c);
5042 var buttonText = CURRENTLANG.done;
5043 if (k._stack != CURRENTSTACK) {
5044 buttonText = CURRENTLANG.finish;
5045 }
5046 k.dialogFinish.changeBottom('<a href="#" class="uiButton uiButtonLarge uiButtonConfirm" role="button" id="ponyhoof_welcomefinal_ok"><span class="uiButtonText">'+buttonText+'</span></a>');
5047 k.dialogFinish.onclose = function() {
5048 if (k._stack != CURRENTSTACK) {
5049 w.location.reload();
5050 }
5051 };
5052
5053 $('ponyhoof_welcomefinal_ok').addEventListener('click', k.dialogFinishOk, false);
5054 $('ponyhoof_welcomefinal_ok').focus();
5055
5056 if (!ISUSINGBUSINESS) {
5057 w.setTimeout(function() {
5058 $('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';
5059 }, 1);
5060 }
5061
5062 $('ponyhoof_welcome_posttowall').addEventListener('click', function(e) {
5063 k.dialogFinish.onclose = function() {};
5064 k.dialogFinish.close();
5065 }, false);
5066 };
5067
5068 k.dialogFinishOk = function(e) {
5069 if (k._stack != CURRENTSTACK) {
5070 if (hasClass(this, 'uiButtonDisabled')) {
5071 return false;
5072 }
5073
5074 this.className += ' uiButtonDisabled';
5075 w.location.reload();
5076 } else {
5077 k.dialogFinish.close();
5078 }
5079 e.preventDefault();
5080 };
5081
5082 k.createScenery = function() {
5083 if ($('ponyhoof_welcome_scenery')) {
5084 $('ponyhoof_welcome_scenery').style.display = 'block';
5085 return;
5086 }
5087
5088 var n = d.createElement('div');
5089 n.id = 'ponyhoof_welcome_scenery';
5090 d.body.appendChild(n);
5091
5092 return n;
5093 };
5094
5095 k.injectStyle = function() {
5096 var css = '';
5097 css += 'html.ponyhoof_welcome_html {overflow:hidden;}';
5098 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;}';
5099 css += 'html #ponyhoof_dialog_welcome .generic_dialog_fixed_overflow {background:transparent !important;}';
5100 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)+';}';
5101
5102 //css += '#ponyhoof_dialog_welcome .generic_dialog {z-index:401 !important;}';
5103 css += '#ponyhoof_dialog_welcome .generic_dialog_popup, #ponyhoof_dialog_welcome .popup {width:475px !important;}';
5104 //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;}';
5105 css += '#ponyhoof_dialog_welcome .ponyhoof_updater_newVersion {margin-bottom:10px;}';
5106
5107 css += '#ponyhoof_welcome_newVersion {display:none;margin:0 0 10px;}';
5108 css += '#ponyhoof_welcome_pony {margin:8px 0;}';
5109 css += '#ponyhoof_welcome_afterClose {visibility:hidden;opacity:0;}';
5110 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;}';
5111
5112 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;}';
5113 css += 'html.ponyhoof_welcome_showmedemo {cursor:not-allowed;}';
5114 css += 'html.ponyhoof_welcome_showmedemo .popup {cursor:default;}';
5115 css += 'html.ponyhoof_welcome_showmedemo #blueBar #pageHead {width:981px !important;padding-right:0 !important;}';
5116 css += 'html.sidebarMode.ponyhoof_welcome_showmedemo #pageHead, html.sidebarMode.ponyhoof_welcome_showmedemo .sidebarMode #globalContainer {left:0 !important;}';
5117 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;}';
5118
5119 css += '#ponyhoof_dialog_welcome_pinkie .generic_dialog_popup, #ponyhoof_dialog_welcome_pinkie .popup {width:720px;}';
5120 css += '#ponyhoof_dialog_welcome_pinkie .content {line-height:0;padding:0;}';
5121
5122 css += '#ponyhoof_welcome_like {border:none;overflow:hidden;width:292px;height:62px;margin:8px 0;display:block;}';
5123
5124 injectManualStyle(css, 'welcome');
5125 };
5126 };
5127
5128 // Theme
5129 function getFaviconTag() {
5130 var l = d.getElementsByTagName('link');
5131 for (var i = 0, len = l.length; i < len; i += 1) {
5132 if (l[i].getAttribute('rel') == 'shortcut icon') {
5133 return l[i];
5134 }
5135 }
5136
5137 return false;
5138 }
5139
5140 function changeFavicon(character) {
5141 if (userSettings.noFavicon) {
5142 return;
5143 }
5144
5145 var favicon = getFaviconTag();
5146
5147 if (favicon) {
5148 var newIcon = favicon.cloneNode(true);
5149 } else {
5150 var newIcon = d.createElement('link');
5151 newIcon.rel = 'shortcut icon';
5152 }
5153
5154 if (character != 'NONE') {
5155 newIcon.type = 'image/png';
5156
5157 var data = convertCodeToData(character);
5158 if (data.icon16) {
5159 newIcon.href = THEMEURL+data.icon16;
5160 } else {
5161 newIcon.href = THEMEURL+character+'/icon16.png';
5162 }
5163 } else {
5164 newIcon.type = 'image/x-icon';
5165 newIcon.href = '//fbstatic-a.akamaihd.net/rsrc.php/y9/r/FXHC9IQ-JIj.ico';
5166 }
5167
5168 if (favicon) {
5169 favicon.parentNode.replaceChild(newIcon, favicon);
5170 } else {
5171 d.head.appendChild(newIcon);
5172 }
5173 }
5174
5175 function changeStack(character) {
5176 var pony = convertCodeToData(character);
5177 CURRENTSTACK = STACKS_LANG[0];
5178 if (pony.stack) {
5179 for (var i = 0, len = STACKS_LANG.length; i < len; i += 1) {
5180 if (STACKS_LANG[i].stack == pony.stack) {
5181 CURRENTSTACK = STACKS_LANG[i];
5182 break;
5183 }
5184 }
5185 }
5186
5187 if (UILANG == 'fb_LT') {
5188 if (CURRENTSTACK['people'] == 'ponies') {
5189 CURRENTSTACK['people'] = 'pwnies';
5190 }
5191 if (CURRENTSTACK['person'] == 'pony') {
5192 CURRENTSTACK['person'] = 'pwnie';
5193 }
5194 if (CURRENTSTACK['like'] == 'brohoof') {
5195 CURRENTSTACK['like'] = '/)';
5196 }
5197 if (CURRENTSTACK['likes'] == 'brohoofs') {
5198 CURRENTSTACK['likes'] = '/)';
5199 }
5200 //if (CURRENTSTACK['unlike'] == 'unbrohoof') {
5201 // CURRENTSTACK['unlike'] = '/)(\\';
5202 //}
5203 if (CURRENTSTACK['like_past'] == 'brohoof') {
5204 CURRENTSTACK['like_past'] = '/)';
5205 }
5206 if (CURRENTSTACK['likes_past'] == 'brohoofs') {
5207 CURRENTSTACK['likes_past'] = '/)';
5208 }
5209 if (CURRENTSTACK['liked'] == 'brohoof\'d') {
5210 CURRENTSTACK['liked'] = '/)';
5211 }
5212 if (CURRENTSTACK['liked_button'] == 'brohoof\'d') {
5213 CURRENTSTACK['liked_button'] = '/)';
5214 }
5215 if (CURRENTSTACK['liking'] == 'brohoofing') {
5216 CURRENTSTACK['liking'] = '/)';
5217 }
5218 }
5219 }
5220
5221 var changeThemeFuncQueue = [];
5222 function changeTheme(character) {
5223 addClass(d.documentElement, 'ponyhoof_injected');
5224
5225 REALPONY = character;
5226 d.documentElement.setAttribute('data-ponyhoof-character', character);
5227
5228 changeFavicon(character);
5229 changeStack(character);
5230 buildStackLang();
5231
5232 if (changeThemeFuncQueue) {
5233 for (var x in changeThemeFuncQueue) {
5234 if (changeThemeFuncQueue.hasOwnProperty(x) && changeThemeFuncQueue[x]) {
5235 changeThemeFuncQueue[x]();
5236 }
5237 }
5238 }
5239
5240 // Did we injected our theme already?
5241 if ($('ponyhoof_userscript_style')) {
5242 changeCostume(userSettings.costume);
5243 $('ponyhoof_userscript_style').href = THEMECSS+character+THEMECSS_EXT;
5244 return;
5245 }
5246
5247 addClass(d.documentElement, 'ponyhoof_initial');
5248 w.setTimeout(function() {
5249 removeClass(d.documentElement, 'ponyhoof_initial');
5250 }, 1000);
5251
5252 var n = d.createElement('link');
5253 n.href = THEMECSS+character+THEMECSS_EXT;
5254 n.type = 'text/css';
5255 n.rel = 'stylesheet';
5256 n.id = 'ponyhoof_userscript_style';
5257 d.head.appendChild(n);
5258
5259 changeCostume(userSettings.costume);
5260 }
5261
5262 function getRandomPony() {
5263 while (1) {
5264 var r = randNum(0, PONIES.length-1);
5265 if (!PONIES[r].hidden) {
5266 return PONIES[r].code;
5267 }
5268 }
5269 }
5270
5271 function getRandomMane6() {
5272 while (1) {
5273 var r = randNum(0, PONIES.length-1);
5274 if (PONIES[r].mane6) {
5275 return PONIES[r].code;
5276 }
5277 }
5278 }
5279
5280 function convertCodeToData(code) {
5281 for (var i = 0, len = PONIES.length; i < len; i += 1) {
5282 if (PONIES[i].code == code) {
5283 return PONIES[i];
5284 }
5285 }
5286
5287 return false;
5288 }
5289
5290 function changeThemeSmart(theme) {
5291 switch (theme) {
5292 case 'NONE':
5293 removeClass(d.documentElement, 'ponyhoof_injected');
5294 changeFavicon('NONE');
5295 changeCostume(null);
5296
5297 var style = $('ponyhoof_userscript_style');
5298 if (style) {
5299 style.parentNode.removeChild(style);
5300 }
5301 break;
5302
5303 case 'RANDOM':
5304 var current = [];
5305 if (userSettings.randomPonies) {
5306 current = userSettings.randomPonies.split('|');
5307 changeTheme(current[Math.floor(Math.random() * current.length)]);
5308 } else {
5309 changeTheme(getRandomPony());
5310 }
5311
5312 break;
5313
5314 default:
5315 if (theme == 'login' || convertCodeToData(theme)) {
5316 changeTheme(theme);
5317 } else {
5318 error("changeThemeSmart: "+theme+" is not a valid theme");
5319 userSettings.theme = null;
5320 CURRENTPONY = REALPONY = 'NONE';
5321 }
5322 break;
5323 }
5324 }
5325
5326 function changeCustomBg(base64) {
5327 if (!base64) {
5328 removeClass(d.documentElement, 'ponyhoof_settings_login_bg');
5329 removeClass(d.documentElement, 'ponyhoof_settings_customBg');
5330
5331 var style = $('ponyhoof_style_custombg');
5332 if (style) {
5333 style.parentNode.removeChild(style);
5334 }
5335 return;
5336 }
5337
5338 addClass(d.documentElement, 'ponyhoof_settings_login_bg');
5339 addClass(d.documentElement, 'ponyhoof_settings_customBg');
5340
5341 if (!$('ponyhoof_style_custombg')) {
5342 injectManualStyle('', 'custombg');
5343 }
5344 $('ponyhoof_style_custombg').textContent = '/* '+SIG+' */html,.fbIndex{background-position:center center !important;background-image:url("'+base64+'") !important;}';
5345 }
5346
5347 var changeCostume = function(costume) {
5348 // Make sure the costume exists
5349 if (!COSTUMESX[costume]) {
5350 removeCostume();
5351 return false;
5352 }
5353
5354 // Make sure the character has the costume
5355 if (!doesCharacterHaveCostume(REALPONY, costume)) {
5356 //removeCostume(); // leaving the costume alone wouldn't hurt...
5357 return false;
5358 }
5359
5360 d.documentElement.setAttribute('data-ponyhoof-costume', costume);
5361 };
5362
5363 var removeCostume = function() {
5364 d.documentElement.removeAttribute('data-ponyhoof-costume');
5365 };
5366
5367 var doesCharacterHaveCostume = function(character, costume) {
5368 return (COSTUMESX[costume] && COSTUMESX[costume].characters && COSTUMESX[costume].characters.indexOf(character) != -1);
5369 }
5370
5371 function getBronyName() {
5372 var name = d.querySelector('.headerTinymanName, #navTimeline > .navLink, .fbxWelcomeBoxName, ._521h ._4g5y, .-cx-PRIVATE-litestandSidebarBookmarks__profilewrapper .-cx-PRIVATE-litestandSidebarBookmarks__name');
5373 if (name) {
5374 BRONYNAME = name.textContent;
5375 }
5376
5377 return BRONYNAME;
5378 }
5379
5380 function getDefaultUiLang() {
5381 if (!d.body) {
5382 return false;
5383 }
5384 var classes = d.body.className.split(' ');
5385 for (var i = 0, len = classes.length; i < len; i += 1) {
5386 if (classes[i].indexOf('Locale_') == 0) {
5387 return classes[i].substring('Locale_'.length);
5388 }
5389 }
5390
5391 return false;
5392 }
5393
5394 // Screen saver
5395 var screenSaverTimer = null;
5396 var screenSaverActive = false;
5397 var screenSaverInactivity = function() {
5398 if (!screenSaverActive) {
5399 addClass(d.body, 'ponyhoof_screensaver');
5400 }
5401 screenSaverActive = true;
5402 };
5403 var screenSaverActivity = function() {
5404 if (screenSaverActive) {
5405 removeClass(d.body, 'ponyhoof_screensaver');
5406 }
5407 screenSaverActive = false;
5408
5409 w.clearTimeout(screenSaverTimer);
5410 screenSaverTimer = w.setTimeout(screenSaverInactivity, 30000);
5411 };
5412 var screenSaverActivate = function() {
5413 var mousemoveX = 0;
5414 var mousemoveY = 0;
5415
5416 d.addEventListener('click', screenSaverActivity, true);
5417 d.addEventListener('mousemove', function(e) {
5418 if (mousemoveX == e.clientX && mousemoveY == e.clientY) {
5419 return;
5420 }
5421 mousemoveX = e.clientX;
5422 mousemoveY = e.clientY;
5423
5424 screenSaverActivity();
5425 }, true);
5426 d.addEventListener('keydown', screenSaverActivity, true);
5427 d.addEventListener('contextmenu', screenSaverActivity, true);
5428 d.addEventListener('mousewheel', screenSaverActivity, true);
5429 d.addEventListener('touchstart', screenSaverActivity, true);
5430
5431 screenSaverActivity();
5432 };
5433
5434 // DOMNodeInserted
5435 var domReplaceText = function(ele, cn, deeper, regex, text) {
5436 var t = '';
5437 var id = ele.getAttribute('id');
5438 if ((cn == '' && deeper == '') || (cn && hasClass(ele, cn)) || (cn && id && id == nc)) {
5439 t = ele.innerHTML;
5440 t = t.replace(regex, text);
5441 if (ele.innerHTML != t) {
5442 ele.innerHTML = t;
5443 }
5444
5445 return;
5446 }
5447
5448 if (deeper) {
5449 var query = ele.querySelectorAll(deeper);
5450 if (query.length) {
5451 for (var i = 0, len = query.length; i < len; i += 1) {
5452 t = query[i].innerHTML;
5453 t = t.replace(regex, text);
5454 if (query[i].innerHTML != t) {
5455 query[i].innerHTML = t;
5456 }
5457 }
5458 }
5459 }
5460 };
5461
5462 var _fb_input_placeholderChanged = false;
5463 var domChangeTextbox = function(ele, cn, text) {
5464 var query = ele.querySelectorAll(cn);
5465 if (!query.length) {
5466 return;
5467 }
5468 if (!_fb_input_placeholderChanged) {
5469 contentEval(function(arg) {
5470 try {
5471 if (typeof window.requireLazy == 'function') {
5472 window.requireLazy(['Input'], function(Input) {
5473 var _setPlaceholder = Input.setPlaceholder;
5474 Input.setPlaceholder = function(textbox, t) {
5475 if (!textbox.getAttribute('data-ponyhoof-ponified-overridefb')) {
5476 if (textbox != document.activeElement) {
5477 _setPlaceholder(textbox, t);
5478 }
5479 textbox.setAttribute('data-ponyhoof-ponified-overridefb', 1);
5480 } else {
5481 // we already overridden, now FB wants to change the placeholder
5482 if (textbox.getAttribute('placeholder') == '' && t) {
5483 if (textbox.title) {
5484 // for composer
5485 _setPlaceholder(textbox, textbox.title);
5486 } else {
5487 // for typeahead (share dialog > private message)
5488 _setPlaceholder(textbox, t);
5489 }
5490 } else if (t == '') {
5491 // allow blanking placeholder (for typeahead)
5492 _setPlaceholder(textbox, t);
5493 }
5494 }
5495 };
5496 });
5497 }
5498 } catch (e) {
5499 if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
5500 console.log("Unable to override Input.setPlaceholder()");
5501 console.dir(e);
5502 }
5503 }
5504 }, {"CANLOG":CANLOG});
5505 _fb_input_placeholderChanged = true;
5506 }
5507
5508 var placeholders = [];
5509 for (var i = 0, len = query.length; i < len; i += 1) {
5510 var textbox = query[i];
5511 if (textbox.getAttribute('data-ponyhoof-ponified')) {
5512 continue;
5513 }
5514 textbox.setAttribute('data-ponyhoof-ponified', 1);
5515
5516 if (typeof text == 'function') {
5517 placeholders[i] = text(textbox);
5518 } else {
5519 placeholders[i] = text;
5520 }
5521
5522 textbox.title = placeholders[i];
5523 textbox.setAttribute('aria-label', placeholders[i]);
5524 textbox.setAttribute('placeholder', placeholders[i]);
5525
5526 if (hasClass(textbox, 'DOMControl_placeholder')) {
5527 textbox.value = placeholders[i];
5528 }
5529 }
5530
5531 /*try {
5532 if (typeof USW.requireLazy == 'function') {
5533 USW.requireLazy(['TextAreaControl'], function(TextAreaControl) {
5534 for (var i = 0; i < query.length; i++) {
5535 if (placeholders[i]) {
5536 //if (query[i] != d.activeElement) {
5537 TextAreaControl.getInstance(query[i]).setPlaceholderText(placeholders[i]);
5538 //}
5539 }
5540 }
5541 });
5542 } else {*/
5543 for (var i = 0, len = query.length; i < len; i += 1) {
5544 if (placeholders[i]) {
5545 var textbox = query[i];
5546 if (!textbox.getAttribute('data-ponyhoof-ponified-overridefb')) {
5547 textbox.setAttribute('aria-label', placeholders[i]);
5548 textbox.setAttribute('placeholder', placeholders[i]);
5549 textbox.setAttribute('data-ponyhoof-ponified-overridefb', 1);
5550 if (textbox == d.activeElement) {
5551 continue;
5552 }
5553 if (textbox.value == '' || hasClass(textbox, 'DOMControl_placeholder')) {
5554 if (placeholders[i]) {
5555 addClass(textbox, 'DOMControl_placeholder');
5556 } else {
5557 removeClass(textbox, 'DOMControl_placeholder');
5558 }
5559 textbox.value = placeholders[i] || '';
5560 }
5561 }
5562 }
5563 }
5564 /*}
5565 } catch (e) {
5566 error("Unable to hook to TextAreaControl");
5567 dir(e);
5568 }*/
5569 };
5570
5571 var domReplaceFunc = function(ele, cn, deeper, func) {
5572 if (!ele || (cn == '' && deeper == '')) {
5573 return;
5574 }
5575
5576 var id = ele.getAttribute('id');
5577 if ((cn && hasClass(ele, cn)) || (cn && id && id == cn)) {
5578 func(ele);
5579 return;
5580 }
5581
5582 if (deeper) {
5583 var query = ele.querySelectorAll(deeper);
5584 if (query.length) {
5585 for (var i = 0, len = query.length; i < len; i += 1) {
5586 func(query[i]);
5587 }
5588 }
5589 }
5590 };
5591
5592 var replaceText = function(arr, t) {
5593 var lowercase = t.toLowerCase();
5594 for (var i = 0, len = arr.length; i < len; i += 1) {
5595 if (arr[i][0] instanceof RegExp) {
5596 t = t.replace(arr[i][0], arr[i][1]);
5597 } else {
5598 if (arr[i][0].toLowerCase() == lowercase) {
5599 t = arr[i][1];
5600 }
5601 }
5602 }
5603
5604 return t;
5605 };
5606
5607 var loopChildText = function(ele, func) {
5608 if (!ele || !ele.childNodes) {
5609 return;
5610 }
5611 for (var i = 0, len = ele.childNodes.length; i < len; i += 1) {
5612 func(ele.childNodes[i]);
5613 }
5614 };
5615
5616 var buttonTitles = [];
5617 var dialogTitles = [];
5618 var tooltipTitles = [];
5619 var headerTitles = [];
5620 var menuTitles = [];
5621 var menuPrivacyOnlyTitles = [];
5622 var dialogDerpTitles = [];
5623 var headerInsightsTitles = [];
5624 var dialogDescriptionTitles = [];
5625 function buildStackLang() {
5626 var ponyData = convertCodeToData(REALPONY);
5627
5628 buttonTitles = [
5629 ["Done", "Eeyup"]
5630 ,["Okay", "Eeyup"]
5631 ,["Done Editing", "Eeyup"]
5632 ,["Save Changes", "Eeyup"]
5633 ,["OK", "Eeyup"]
5634
5635 ,[/everyone/i, "Everypony"] // for Everyone (Most Recent)
5636 ,["Everybody", "Everypony"]
5637 ,["Public", "Everypony"]
5638 ,["Anyone", "Anypony"]
5639 ,["Friends of Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
5640 ,["Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])]
5641 ,["Friends of Guests", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of Guests"]
5642 ,["Only Me", "Alone"]
5643 ,["Only me", "Alone"]
5644 ,["Only Me (+)", "Alone (+)"]
5645 ,["Only me (+)", "Alone (+)"]
5646 ,["No One", "Alone"]
5647 ,["Nobody", "Nopony"]
5648
5649 ,["Add Friend", "Add "+capitaliseFirstLetter(CURRENTSTACK['friend'])]
5650 ,["Friend Request Sent", "Friendship Request Sent"]
5651 ,["Respond to Friend Request", "Respond to Friendship Request"]
5652 ,["Like", capitaliseFirstLetter(CURRENTSTACK['like'])]
5653 ,["Liked", capitaliseFirstLetter(CURRENTSTACK['liked_button'])]
5654 ,["Unlike", capitaliseFirstLetter(CURRENTSTACK['unlike'])]
5655 ,["Like Page", capitaliseFirstLetter(CURRENTSTACK['like'])+" Page"]
5656 ,["Like This Page", capitaliseFirstLetter(CURRENTSTACK['like'])+" This Page"]
5657 ,["Suggest Friends", "Suggest "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
5658 ,["Suggest Friend", "Suggest "+capitaliseFirstLetter(CURRENTSTACK['friend'])]
5659 ,["All Friends", "All "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
5660 ,["All friends", "All "+CURRENTSTACK['friends']]
5661 ,["Poke", "Nuzzle"]
5662
5663 ,["Likes", capitaliseFirstLetter(CURRENTSTACK['likes'])]
5664 ,["Friends' Posts", capitaliseFirstLetter(CURRENTSTACK['friends'])+"' Posts"]
5665
5666 ,["Photos", "Pony Pics"]
5667 ,["People", capitaliseFirstLetter(CURRENTSTACK['people'])]
5668 ,["Banned", "Banished to Moon"]
5669 ,["Blocked", "Banished to Moon"]
5670 ,["People who like this", capitaliseFirstLetter(CURRENTSTACK.people)+" that "+CURRENTSTACK.like_past+" this"]
5671 ,["Pages that like this", "Pages that "+CURRENTSTACK.like_past+" this"]
5672
5673 ,["Delete and Ban User", "Nuke and Banish to Moon"]
5674 ,["Remove from Friends", "Banish to Moon"]
5675 ,["Delete", "Nuke"]
5676 ,["Delete Photo", "Nuke Pony Pic"]
5677 ,["Delete Page", "Nuke Page"]
5678 ,["Delete All", "Nuke All"]
5679 ,["Delete Selected", "Nuke Selected"]
5680 ,["Delete Conversation", "Nuke Conversation"]
5681 ,["Delete Message", "Nuke Friendship Report"]
5682 ,["Delete Messages", "Nuke Friendship Reports"]
5683 ,["Delete Post", "Nuke Post"]
5684 ,["Remove", "Nuke"]
5685 ,["Delete Report", "Nuke This Whining"]
5686 ,["Report", "Whine"]
5687 ,["Report as Spam", "Whine as Spam"]
5688 ,["Clear Searches", "Nuke Searches"]
5689 ,["Report/Remove Tags", "Whine/Nuke Tags"]
5690 ,["Untag Photo", "Untag Pony Pic"]
5691 ,["Untag Photos", "Untag Pony Pics"]
5692 ,["Delete My Account", "Nuke My Account"]
5693 ,["Allowed on Timeline", "Allowed on Journal"]
5694 ,["Hidden from Timeline", "Hidden from Journal"]
5695 ,["Unban", "Unbanish"]
5696 ,["Delete Album", "Nuke Album"]
5697 ,["Cancel Report", "Cancel Whining"]
5698 ,["Unfriend", "Banish to Moon"]
5699 ,["Delete List", "Nuke List"]
5700
5701 ,["Messages", "Trough"]
5702 ,["New Message", "Write a Friendship Report"]
5703 ,["Other Messages", "Other Friendship Reports"]
5704
5705 ,["Share Photo", "Share Pony Pic"]
5706 ,["Share Application", "Share Magic"]
5707 ,["Share Note", "Share Scroll"]
5708 ,["Share Question", "Share Query"]
5709 ,["Share Event", "Share Adventure"]
5710 ,["Share Group", "Share Herd"]
5711 ,["Send Message", "Send Friendship Letter"]
5712 ,["Share Photos", "Share Pony Pics"]
5713 ,["Share This Note", "Share This Scroll"] // entstream
5714 ,["Share This Photo", "Share This Pony Pic"]
5715
5716 ,["Add Friends", "Add "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
5717 ,["Go to App", "Go to Magic"]
5718 ,["Back to Timeline", "Back to Journal"]
5719 ,["Add App", "Add Magic"]
5720 ,["Get More Likes", "Get More "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
5721 ,["Advertise Your App", "Advertise Your Magic"]
5722 ,["Leave App", "Leave Magic"]
5723 ,["Find another app", "Find another magic"]
5724 ,["Post on your timeline", "Post on your journal"]
5725 ,["App Center", "Magic Center"]
5726 ,["View App Center", "View Magic Center"]
5727
5728 ,["Events", "Adventures"]
5729 ,["Page Events", "Page Adventures"]
5730 ,["Suggested Events", "Suggested Adventures"]
5731 ,["Past Events", "Past Adventures"]
5732 ,["Declined Events", "Declined Adventures"]
5733 ,["Create Event", "Plan an Adventure"]
5734 ,["Save Event", "Save Adventure"]
5735 ,["Back to Event", "Back to Adventure"]
5736 ,["Invite Friends", "Invite "+capitaliseFirstLetter(CURRENTSTACK['friends_logic'])]
5737 ,["Page Event", "Page Adventures"]
5738 ,["Upcoming Events", "Upcoming Adventures"]
5739 ,["Group Events", "Herd Adventures"]
5740 ,["Change Event Photo", "Change Pony Pic for Adventure"]
5741 ,["Add Event Photo", "Add Pony Pic for Adventure"]
5742 ,["+ Create an Event", "+ Plan an Adventure"]
5743
5744 ,["Friend Activity", capitaliseFirstLetter(CURRENTSTACK['friend'])+" Activity"]
5745 ,["Activity Log", "Adventure Log"]
5746
5747 ,["Invite More Friends", "Invite More Pals"]
5748 ,["Find Friends", "Find Friendship"]
5749 ,["Pages I Like", "Pages I "+capitaliseFirstLetter(CURRENTSTACK['like_past'])]
5750 ,["Find My Friends", "Find Friendship"]
5751
5752 ,["Leave Group", "Leave Herd"]
5753 ,["Set Up Group Address", "Set Up Herd Address"]
5754 ,["Change Group Photo", "Change Herd Pony Pic"]
5755 ,["Notifications", "Sparks"]
5756 ,["Start Chat", "Start Whinny Chat"]
5757 ,["Create Group", "Create Herd"]
5758 ,["Add People", "Add "+capitaliseFirstLetter(CURRENTSTACK['people'])]
5759 ,["Groups", "Herds"]
5760 ,["Join Group", "Join the Herd"]
5761 ,["View group", "View herd"]
5762 ,["Create New Group", "Create New Herd"]
5763 ,["Set Up Group", "Set Up Herd"] // tour
5764
5765 ,["Move photo", "Move pony pic"]
5766 ,["Delete Photos", "Nuke Pony Pics"]
5767 ,["Keep Photos", "Keep Pony Pics"]
5768 ,["Save Photo", "Save Pony Pic"]
5769 ,["Tag Photos", "Tag Pony Pics"]
5770 ,["Add Photos", "Add Pony Pics"]
5771 ,["Upload Photos", "Upload Pony Pics"]
5772 ,["Tag Photo", "Tag Pony Pic"]
5773 ,["Add More Photos", "Add More Pony Pics"]
5774 ,["Post Photos", "Post Pony Pics"]
5775 ,["Add Photos to Map", "Add Pony Pics to Map"]
5776 ,["Add Photo", "Add Pony Pic"]
5777
5778 ,["On your own timeline", "On your own journal"]
5779 ,["On a friend's timeline", "On a "+CURRENTSTACK['friend']+"'s journal"]
5780 ,["In a group", "In a herd"]
5781 ,["In a private message", "In a private friendship report"]
5782
5783 ,["Timeline", "Journal"]
5784 ,["Notes", "Scrolls"]
5785 ,["Comments", "Friendship Letters"]
5786 ,["Posts and Apps", "Posts and Magic"]
5787 ,["Timeline Review", "Journal Review"]
5788 ,["Pokes", "Nuzzles"]
5789 ,["Add to Timeline", "Add to Journal"]
5790
5791 ,["Photo", "Pony Pic"]
5792 ,["Question", "Query"]
5793
5794 //,["Create List", "Create Directory"]
5795 ,["See All Friends", "See All "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
5796 //,["Manage List", "Manage Directory"]
5797 ,["Write a Note", "Write a Scroll"]
5798 ,["Add Note", "Add Scroll"]
5799 ,["Edit Featured Likes", "Edit Featured "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
5800 ,["Add Featured Likes", "Add Featured "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
5801 ,["Add profile picture", "Add journal pony pic"]
5802 ,["Edit Profile Picture", "Edit Journal Pony Pic"]
5803 //,["Create an Ad", "Buy a Cupcake"]
5804 //,["On This List", "On This Directory"]
5805 ,["Friend Requests", "Friendship Requests"]
5806 //,["Add Friends to List", "Add "+capitaliseFirstLetter(CURRENTSTACK['friends'])+" to Directory"]
5807 ,["Add Friends to List", "Add "+capitaliseFirstLetter(CURRENTSTACK['friends'])+" to List"]
5808
5809 ,["Pages I like", "Pages I "+capitaliseFirstLetter(CURRENTSTACK.like)]
5810 ,["My Friends", "My "+capitaliseFirstLetter(CURRENTSTACK.friends)]
5811 ,["Tell Friends", "Tell "+capitaliseFirstLetter(CURRENTSTACK.friends)]
5812
5813 ,["Add to Profile", "Add to Journal"]
5814 ,["Add Likes", "Add "+capitaliseFirstLetter(CURRENTSTACK.likes)]
5815 ,["Set as Profile Picture", "Set as Journal Pony Pic"]
5816 ,["View Activity Log", "View Adventure Log"]
5817 ,["Invite Your Friends", "Invite Your "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
5818 ,["Suggest Photo", "Suggest Pony Pic"]
5819 ,["All Apps", "All Magic"]
5820 ,["Link My Profile to Twitter", "Link My Journal to Twitter"]
5821 ,["Link profile to Twitter", "Link journal to Twitter"]
5822 ,["The app sends you a notification", "The magic sends you a spark"]
5823 ,["Upload a Photo", "Upload a Pony Pic"]
5824 ,["Take a Photo", "Take a Pony Pic"]
5825 ,["Take a Picture", "Take a Pony Pic"] // edit page
5826
5827 ,["Search All Friends", "Search All "+capitaliseFirstLetter(CURRENTSTACK.friends)] // invite friends
5828 ,["Top Comments", "Top Friendship Letters"] // comment resort
5829 ,["Go to Activity Log", "Go to Adventure Log"] // checkpoint
5830 ,["Upload Photo", "Upload Pony Pic"] // composer warning
5831 ,["Poke Back", "Nuzzle Back"] // newsfeed flyout
5832 ,["Friends to Invite", capitaliseFirstLetter(CURRENTSTACK['friends'])+" to Invite"] // app invite
5833 ,["Inbox", "Trough"] // page inbox
5834
5835 // graph search
5836 ,["Likers", "Brohoofers"] // @todo likers
5837 ,["Liked by", CURRENTSTACK['liked']+" by"] // @todo likers
5838
5839 ,["Create New App", "Create New Magic"]
5840 ,["Submit App Detail Page", "Submit Magic Detail Page"]
5841 ,["Edit App", "Edit Magic"]
5842 ,["Promote App", "Promote Magic"]
5843 ,["Make Friends", "Make "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
5844 ,["Add to Other Apps", "Add to Other Magic"]
5845 ];
5846
5847 dialogTitles = [
5848 [/People who like /, capitaliseFirstLetter(CURRENTSTACK['people'])+" who "+CURRENTSTACK['like_past']+" "]
5849 ,[/People Who Like /, capitaliseFirstLetter(CURRENTSTACK['people'])+" Who "+capitaliseFirstLetter(CURRENTSTACK['like_past'])+" "]
5850 ,[/Friends who like /i, capitaliseFirstLetter(CURRENTSTACK['friends_logic'])+" who "+CURRENTSTACK['like_past']+" "]
5851 ,["People who voted for this option", capitaliseFirstLetter(CURRENTSTACK['people'])+" who voted for this option"]
5852 ,["People who are following this question", capitaliseFirstLetter(CURRENTSTACK['people'])+" who are following this question"]
5853 ,[/People Connected to /, capitaliseFirstLetter(CURRENTSTACK['people'])+" Connected to "]
5854 ,["People who saw this", capitaliseFirstLetter(CURRENTSTACK['people'])+" who saw this"]
5855 ,["Added Friends", "Added "+capitaliseFirstLetter(CURRENTSTACK.friends)]
5856 ,["People who can repro this", capitaliseFirstLetter(CURRENTSTACK['people'])+" who can repro this"]
5857 ,["Friends that like this", capitaliseFirstLetter(CURRENTSTACK['friends_logic'])+" that "+CURRENTSTACK['like_past']+" this"]
5858
5859 ,["Share this Profile", "Share this Journal"]
5860 ,["Share This Photo", "Share This Pony Pic"]
5861 //,["Share this Album", ""]
5862 ,["Share this Note", "Share this Scroll"]
5863 ,["Share this Group", "Share this Herd"]
5864 ,["Share this Event", "Share this Adventure"]
5865 //,["Share this Ad", ""]
5866 ,["Share this Application", "Share this Magic"]
5867 //,["Share this Video", ""]
5868 //,["Share this Page", "Share this Landmark"]
5869 //,["Share this Page", "You gotta share!"]
5870 //,["Share this Job", ""]
5871 //,["Share this Status", "You gotta share!"]
5872 ,["Share this Question", "Share this Query"]
5873 //,["Share this Link", "You gotta share!"]
5874 ,["Share", "You gotta share!"]
5875 //,["Share this Help Content", ""]
5876 ,["Send This Photo", "Send This Pony Pic"]
5877 ,["Share Photo", "Share Pony Pic"]
5878
5879 ,["Timeline and Tagging", "Journal and Tagging"]
5880 ,["Timeline Review", "Journal Review"]
5881 //,["Friends Can Check You Into Places", capitaliseFirstLetter(CURRENTSTACK['friends_logic'])+" Can Check You Into Landmarks"]
5882 //,["Limit The Audience for Old Posts on Your Timeline", "Limit The Audience for Old Posts on Your Journal"]
5883 //,["How people bring your info to apps they use", "How "+CURRENTSTACK['people']+" bring your info to magic they use"]
5884 //,["Turn off Apps, Plugins and Websites", "Turn off Magic, Plugins and Websites"]
5885
5886 ,["Likes", capitaliseFirstLetter(CURRENTSTACK['likes'])]
5887 ,["Edit Featured Likes", "Edit Featured "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
5888 ,["Change Date", "Time Travel"]
5889 ,["Date Saved", "Time Traveled"]
5890
5891 ,["Delete", "Nuke"]
5892 ,["Delete Comment", "Nuke Friendship Letter"]
5893 ,["Delete Photo", "Nuke Pony Pic"]
5894 ,["Remove Picture?", "Nuke Pony Pic?"]
5895 ,["Delete Video?", "Nuke Video?"]
5896 ,["Delete Milestone", "Nuke Milestone"]
5897 ,["Delete Page?", "Nuke Page?"]
5898 ,["Delete this Message?", "Nuke this Friendship Report?"]
5899 ,["Delete This Entire Conversation?", "Nuke This Entire Conversation?"]
5900 ,["Delete These Messages?", "Nuke These Friendship Reports?"]
5901 ,["Delete Post", "Nuke Post"]
5902 ,["Delete Post?", "Nuke Post?"]
5903 ,["Delete Page Permanently?", "Nuke Page Permanently?"]
5904 ,["Unlike", capitaliseFirstLetter(CURRENTSTACK['unlike'])]
5905 ,["Remove Search", "Nuke Search"]
5906 //,["Clear Searches", "Nuke Searches"]
5907 ,["Untag Photo", "Untag Pony Pic"]
5908 ,["Untag Photos", "Untag Pony Pics"]
5909 ,["Permanently Delete Account", "Permanently Nuke Account"]
5910 ,["Remove", "Nuke"]
5911 ,["Delete and Ban Member", "Nuke and Banish to Moon"]
5912 ,["Delete Album", "Nuke Album"]
5913 ,["Are you sure you want to clear all your searches?", "Are you sure you want to nuke all your searches?"]
5914 ,["Remove Photo?", "Nuke Pony Pic?"]
5915 ,["Removed Group Photo", "Nuked Herd Pony Pic"]
5916 ,["Post Deleted", "Post Nuked"]
5917 ,["Remove Event", "Nuke Adventure"]
5918 ,["Delete Entry?", "Nuke Entry?"]
5919 ,["Delete Video", "Nuke Video"]
5920 ,["Delete Event", "Nuke Adventure"] // for group admin
5921 ,["Remove Profile Picture", "Nuke Journal Pony Pic"]
5922
5923 ,["Report and/or Block This Person", "Whine and/or Block This Pony"] // 0
5924 ,["Report This Photo", "Whine About This Pony Pic"]
5925 ,["Report This Event", "Whine About This Adventure"]
5926 ,["Report Conversation", "Whine About Conversation"]
5927 ,["Report as Spam?", "Whine as Spam?"]
5928 ,["Invalid Report", "Invalid Whining"]
5929 ,["Report This Page", "Whine About This Page"]
5930 ,["Report This Doc Revision", "Whine About This Doc Revision"]
5931 ,["Confirm Report", "Confirm Whining"]
5932 ,["Report This Place", "Whine About This Place"] // 64
5933 ,["Thanks For This Report", "Thanks For Whining"]
5934 ,["Send Message", "Send Friendship Report"] // social report
5935 ,["Send Messages", "Send Friendship Reports"]
5936 ,["Why don't you like these photos?", "Why don't you like these pony pics?"]
5937 ,["Photos Untagged and Messages Sent", "Pony Pics Untagged and Friendship Reports Sent"]
5938 ,["Report This Post", "Whine About This Post"] // report lists as a page
5939 ,["Report This?", "Whine About This?"]
5940 ,["Report Recommendation", "Whine About Recommendation"] // 108
5941 ,["Why don't you like this photo?", "Why don't you like this pony pic?"]
5942 ,["Report Spam or Abuse", "Whine as Spam or Abuse"] // messages
5943 ,["Report Incorrect External Link", "Whine About Incorrect External Link"] // page vertex // 87
5944
5945 // report types: 5: links / 125: status / 70: group post / 86: og post
5946 ,["Is this post about you or a friend?", "Is this post about you or a "+CURRENTSTACK.friend+"?"]
5947 ,["Why are you reporting this Page?", "Why are you whining about this Page?"] // 23
5948 ,["Is this group about you or a friend?", "Is this herd about you or a "+CURRENTSTACK['friend']+"?"] // 1
5949 ,["Is this comment about you or a friend?", "Is this friendship letter about you or a "+CURRENTSTACK['friend']+"?"] // 71 / 74: page comment
5950 //,["Is this list about you or a friend?", "Is this directory about you a "+CURRENTSTACK.friend+"?"] // 92
5951 ,["Is this list about you or a friend?", "Is this list about you a "+CURRENTSTACK.friend+"?"] // 92
5952 ,["Is this photo about you or a friend?", "Is this pony pic about you or a "+CURRENTSTACK['friend']+"?"] // 2
5953 ,["Is this note about you or a friend?", "Is this scroll about you or a "+CURRENTSTACK['friend']+"?"] // 4
5954 ,["Is this video about you or a friend?", "Is this video about you or a "+CURRENTSTACK['friend']+"?"] // 13
5955 ,["Is this event about you or a friend?", "Is this adventure about you or a "+CURRENTSTACK['friend']+"?"] // 81
5956
5957 ,["How to Report Posts", "How to Whine About Posts"]
5958 ,["How to Report Posts on My Timeline", "How to Whine About Posts on My Journal"]
5959 ,["How to Report the Profile Picture", "How to Whine About the Journal Pony Pic"]
5960 ,["Why are you reporting this photo?", "Why are you whining about this pony pic?"]
5961 ,["How to Report the Cover", "How to Whine About the Cover"]
5962 ,["How to Report Messages", "How to Whine About Friendship Reports"]
5963 ,["How to Report a Page", "How to Whine About a Page"]
5964 ,["How to Report a Group", "How to Whine About a Herd"]
5965 ,["How to Report an Event", "How to Whine About an Adventure"]
5966 ,["How to Report Page Posts", "How to Whine About Page Posts"]
5967
5968 ,["New Message", "Write a Friendship Report"]
5969 ,["Forward Message", "Forward this Friendship Report"]
5970 ,["Delete This Message?", "Nuke This Friendship Report?"]
5971 ,["Message Not Sent", "Friendship Report Not Sent"]
5972 ,["Add People", "Add "+capitaliseFirstLetter(CURRENTSTACK['people'])]
5973 ,["Add Photos", "Add Pony Pics"]
5974 ,["People in this message", capitaliseFirstLetter(CURRENTSTACK['people'])+" in this friendship report"]
5975 ,["Message Sent", "Friendship Report Sent"]
5976 ,["Message Filtering Preferences", "Friendship Report Filtering Preferences"]
5977
5978 ,["Create New Group", "Create New Herd"]
5979 ,[/Create New Event/, "Plan an Adventure"]
5980 ,["Notification Settings", "Spark Settings"]
5981 ,["Create Group Email Address", "Create Herd Email Address"]
5982 ,["Set Up Group Web and Email Address", "Set Up Herd Web and Email Address"]
5983 ,["Mute Chat?", "Mute Whinny Chat?"]
5984 ,["Add Friends to Group", "Add "+capitaliseFirstLetter(CURRENTSTACK['friends_logic'])+" to the Herd"]
5985 ,["Add People to Group", "Add "+capitaliseFirstLetter(CURRENTSTACK['people'])+" to the Herd"]
5986 ,["Not a member of the group", "Not a member of the herd"]
5987 ,["Invite People to Group by Email", "Invite "+capitaliseFirstLetter(CURRENTSTACK.people)+" to Herd by Email"]
5988 ,["Remove Group Admin", "Remove Herd Admin"]
5989 ,["Add Group Admin", "Add Herd Admin"]
5990 ,["Group Admins", "Herd Admins"]
5991 ,["Change Group Privacy?", "Change Herd Privacy?"]
5992
5993 ,["Cancel Event?", "Cancel Adventure?"]
5994 ,["Change Event Photo", "Change Pony Pic for Adventure"]
5995 ,["Add Event Photo", "Add Adventure Pony Pic"]
5996 ,["Export Event", "Export Adventure"]
5997 ,["Edit Event Info", "Edit Adventure Info"]
5998 ,["Create Repeat Event", "Plan a Repeat Adventure"]
5999 ,["Event Invites", "Adventure Invites"]
6000
6001 ,["Hide all recent profile changes?", "Hide all recent journal changes?"]
6002 ,["Edit your profile story settings", "Edit your journal story settings"]
6003 ,["Edit your timeline recent activity settings", "Edit your journal recent activity settings"]
6004 ,["Hide all recent likes activity?", "Hide all recent "+CURRENTSTACK.likes+" activity?"]
6005 ,["Edit Privacy of Likes", "Edit Privacy of "+capitaliseFirstLetter(CURRENTSTACK.likes)]
6006
6007 ,["Edit News Feed Settings", "Edit Feed Bag Settings"]
6008 //,["Create New List", "Create New Directory"]
6009 ,["Invite Friends", "Invite "+capitaliseFirstLetter(CURRENTSTACK['friends_logic'])]
6010 ,["Advanced Chat Settings", "Advanced Whinny Chat Settings"]
6011 ,["Notifications Updated", "Sparks Updated"]
6012 ,["Move photo to another album?", "Move pony pic to another album?"]
6013 ,["Group Muted", "Herd Muted"]
6014 ,["Block App?", "Block Magic?"]
6015 //,["List Notification Settings", "Directory Spark Settings"]
6016 ,["List Notification Settings", "List Spark Settings"]
6017 ,["Like This Photo?", capitaliseFirstLetter(CURRENTSTACK['like'])+" This Pony Pic?"]
6018 ,["Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])]
6019 ,["All Friends", "All "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
6020 ,["Suggest Friend", "Suggest "+capitaliseFirstLetter(CURRENTSTACK.friend)]
6021 ,["Blocked People", "Blocked "+capitaliseFirstLetter(CURRENTSTACK.people)]
6022 ,["Block People", "Block "+capitaliseFirstLetter(CURRENTSTACK.people)]
6023 ,["Tag Friends", "Tag "+capitaliseFirstLetter(CURRENTSTACK.friends)]
6024 ,["Unable to edit Group", "Unable to edit Herd"]
6025 ,["Thanks for Inviting Your Friends", "Thanks for Inviting Your "+capitaliseFirstLetter(CURRENTSTACK.friends)]
6026 ,["Timeline Gift Preview", "Journal Gift Preview"]
6027 ,["Friend Request Setting", "Friendship Request Setting"]
6028 ,["Invalid Question", "Invalid Query"]
6029 //,["List Subscribers", "Directory Subscribers"]
6030 ,["People Who Shared This", capitaliseFirstLetter(CURRENTSTACK.people)+" Who Shared This"]
6031 //,["Edit List Settings", "Edit Directory Settings"]
6032 ,["Remove App", "Remove Magic"]
6033 ,["Turn Off Chat", "Turn Off Whinny Chat"]
6034 ,["Access Log", "Adventure Log"]
6035 ,["Post to Your Wall", "Post to Your Journal"]
6036 ,["About Adding Comments by Email", "About Adding Friendship Letters by Email"]
6037
6038 ,["Take a Profile Picture", "Take a Journal Pony Pic"]
6039 ,["Choosing Your Cover Photo", "Choosing Your Cover Pony Pic"]
6040 ,["Choose from Group Photos", "Choose from Herd Pony Pics"]
6041 ,["Group Albums", "Herd Albums"]
6042 ,["Choose From Your Photos", "Choose From Your Pony Pics"]
6043 ,["Choose from Photos", "Choose from Pony Pics"]
6044 ,["Choose Your Cover Photo", "Choose Your Cover Pony Pic"]
6045 ,["Choose from your synced photos", "Choose from your synced pony pics"]
6046
6047 ,["Create New App", "Create New Magic"]
6048 ,["Add Test Users to other Apps", "Add Test Users to other Magic"]
6049
6050 ,["Hidden in Groups", "Hidden in Herds"] // timeline
6051 ];
6052 if (ponyData.successText) {
6053 dialogTitles.push(["Success", ponyData.successText]);
6054 dialogTitles.push(["Success!", ponyData.successText]);
6055 }
6056
6057 tooltipTitles = [
6058 [/everyone/gi, "Everypony"]
6059 //,[/\bpublic\b/g, "everypony"]
6060 ,[/\bPublic\b/g, "Everypony"]
6061 ,["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."]
6062 //,["These people subscribe to the lists you're featured on", "These "+capitaliseFirstLetter(CURRENTSTACK['people'])+" subscribe to the directories you're featured on"]
6063 ,["These people subscribe to the lists you're featured on", "These "+capitaliseFirstLetter(CURRENTSTACK['people'])+" subscribe to the lists you're featured on"]
6064 ,["Friends of anyone going to this event", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of anypony going to this adventure"]
6065 ,["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"]
6066 ,["Anyone can see and join this event", "Anypony can see and join this adventure"]
6067 ,["Your friends will see your comment in News Feed.", "Your "+CURRENTSTACK['friends']+" will see your friendship letter in Feed Bag."]
6068 ,[/\bfriends in group\b/, CURRENTSTACK['friends']+" in herd"]
6069 ,["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']]
6070 ,["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."]
6071 ,["Friends and friends of anyone tagged", capitaliseFirstLetter(CURRENTSTACK['friends'])+" and "+CURRENTSTACK['friends']+" of anypony tagged"]
6072 ,[/\bfriends of friends\b/g, CURRENTSTACK['friends']+" of "+CURRENTSTACK['friends']]
6073 ,[/\bFriends of Friends\b/g, capitaliseFirstLetter(CURRENTSTACK['friends'])+" of "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
6074 ,[/\bfriends\b/g, CURRENTSTACK['friends']]
6075 ,[/\bFriends\b/g, capitaliseFirstLetter(CURRENTSTACK['friends'])]
6076 ,["Only Me", "Alone"]
6077 ,["Only me", "Alone"]
6078 ,["No One", "Alone"]
6079 ,["Only you", "Alone"]
6080 ,["Anyone tagged", "Anypony tagged"]
6081 //,[/cover photos are everypony/i, "Everypony can see your cover pony pics"]
6082 ,["Cover photos are public", "Everypony can see your cover pony pics"]
6083 ,[/any other information you made Everypony/i, "any other information that everypony can see"]
6084 ,["Anyone can see this Everypony comment", "Everypony can see this public friendship letter"]
6085 //,["Remember: all place ratings are Everypony.", "Remember: everypony can see all place ratings."]
6086 ,["Everypony can see posts on this Everypony page.", "Everypony can see posts on this public page."]
6087 ,["Name, profile picture, age range, gender, language, country and other public info", "Name, profile picture, age range, gender, language, country and other public info"]
6088 //,["Name, profile picture, age range, gender, language, country and other Everypony info", "Name, profile picture, age range, gender, language, country and other public info"]
6089 ,["This will hide you from Everypony attribution", "This will hide you from public attribution"]
6090 ,["Remember: all place ratings are public.", "Remember: everypony can see all place ratings."]
6091 ,["Shared with: Anyone who can see this page", "Shared with: Anypony who can see this page"]
6092 ,["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."]
6093 ,["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)
6094 ,["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."]
6095 ,["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."]
6096 ,["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)
6097
6098 ,["Show comments", "Show friendship letters"]
6099 ,["Comment deleted", "Friendship letter nuked"]
6100 ,[/Comments/, "Friendship Letters"]
6101 ,[/Comment/, "Friendship Letter"]
6102
6103 ,["Remove", "Nuke"]
6104 ,["Edit or Delete", "Edit or Nuke"]
6105 ,["Edit or Remove", "Edit or Nuke"]
6106 ,["Delete Post", "Nuke Post"]
6107 ,["Remove or Report", "Nuke or Whine"]
6108 ,["Report", "Whine"]
6109 ,["Report/Mark as Spam", "Whine/Mark as Spam"]
6110 ,["Report as not relevant", "Whine as not relevant"]
6111 ,["Remove Invite", "Nuke Invite"]
6112 ,["Report/Remove Tag", "Whine/Nuke Tag"]
6113 ,["Delete", "Nuke"]
6114 ,["Delete and Ban", "Nuke and Banish"]
6115 ,["Report Place", "Whine About Place"]
6116
6117 ,["Shown on Timeline", "Shown on Journal"]
6118 ,["Allow on Timeline", "Allow on Journal"]
6119 ,["Highlighted on Timeline", "Highlighted on Journal"]
6120 ,["Allowed on Timeline", "Allowed on Journal"]
6121 ,["Hidden from Timeline", "Hidden from Journal"]
6122
6123 //,[/likes? this/g, "brohoof'd this"]
6124 ,["Sent from chat", "Sent from whinny chat"]
6125 ,["New Message", "Write a Friendship Report"]
6126
6127 //,[/\bpeople\b/gi, "ponies"]
6128 ,[/See who likes this/gi, "See who "+CURRENTSTACK['likes']+" this"]
6129 ,[/people like this\./gi, CURRENTSTACK['people']+" "+CURRENTSTACK['like_past']+" this."] // entstream
6130 ,[/like this\./gi, CURRENTSTACK['like_past']+" this."]
6131 ,[/likes this\./gi, CURRENTSTACK['likes_past']+" this."]
6132
6133 // top right pages
6134 ,["Status", "Take a Note"]
6135 ,["Photo / Video", "Add a Pic"]
6136 ,["Event, Milestone +", "Adventure, Milestone +"]
6137
6138 ,["Onsite Notifications", "Onsite Sparks"]
6139 ,["Create Event", "Plan an Adventure"]
6140 ,["Search messages in this conversation", "Search friendship reports in this conversation"]
6141 ,["Open photo viewer", "Open pony pic viewer"]
6142 ,["Choose a unique image for the cover of your timeline.", "Choose a unique pony pic for the cover of your journal."]
6143 ,["Remove from Dashboard", "Remove from Dashieboard"]
6144 ,["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."]
6145
6146 ,["Each photo has its own privacy setting", "Each pony pic has its own privacy setting"]
6147 ,["You can change the audience for each photo in this album", "You can change the audience for each pony pic in this album"]
6148
6149 ,["View Photo", "View Pony Pic"]
6150
6151 // litestand navigation when collapsed
6152 ,["News Feed", "Feed Bag"]
6153 ,["Messages", "Trough"]
6154 ,["Pokes", "Nuzzles"]
6155 ,["Manage Apps", "Manage Magic"]
6156 ,["Events", "Adventures"]
6157 ,["App Center", "Magic Center"]
6158 ,["Add Friend", "Add "+capitaliseFirstLetter(CURRENTSTACK['friend'])] // people you may know
6159
6160 // photo comments
6161 ,["Attach a Photo", "Attach a Pony Pic"]
6162 ,["Remove Photo", "Nuke Pony Pic"]
6163
6164 ,["Dismiss and go to most recent message", "Dismiss and go to most recent friendship letter"] // messages
6165 ,["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
6166 ,["Verified profile", "Verified journal"] // verified
6167 ,["Tags help people find groups about certain topics.", "Tags help "+CURRENTSTACK['people']+" find herds about certain topics."] // verified
6168
6169 // developers
6170 ,["Enable the newsfeed ticker", "Enable the feedbag ticker"]
6171 ,["Add selected users to other apps you own.", "Add selected users to other magic you own."]
6172 ,["Remove selected users from this app.", "Remove selected users from this magic."]
6173
6174 // insights
6175 ,["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']+", comments, or shares, which are broken out above."]
6176 ,["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."]
6177 ,["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"]
6178 ];
6179 if (ponyData.loadingText) {
6180 tooltipTitles.push(["Loading...", ponyData.loadingText]);
6181 }
6182
6183 headerTitles = [
6184 //["List Suggestions", "Directory Suggestions"]
6185 ["People You May Know", capitaliseFirstLetter(CURRENTSTACK.people)+" You May Know"]
6186 ,["Sponsored", "Cupcake Money"]
6187 ,["Pokes", "Nuzzles"]
6188 ,["People To Follow", capitaliseFirstLetter(CURRENTSTACK.people)+" To Follow"]
6189 ,["Poke Suggestions", "Nuzzle Suggestions"]
6190 ,["Suggested Groups", "Suggested Herds"]
6191 ,["Find More Friends", "Find Friendship"]
6192 ,["Rate Recently Used Apps", "Rate Recently Used Magic"]
6193 ,["Friends' Photos", "Pals' Pony Pics"]
6194 ,["Add a Location to Your Photos", "Add a Location to Your Pony Pics"]
6195 ,["Suggest Friends", "Suggest "+capitaliseFirstLetter(CURRENTSTACK.friends)]
6196 ,["Other Pages You Like", "Other Pages You "+capitaliseFirstLetter(CURRENTSTACK.like)]
6197 ,["Entertainment Pages You Might Like", "Entertainment Pages You Might "+capitaliseFirstLetter(CURRENTSTACK.like)]
6198 ,["Music Pages You Might Like", "Music Pages You Might "+capitaliseFirstLetter(CURRENTSTACK.like)]
6199 ,["Add Personal Contacts as Friends", "Add Personal Contacts as "+capitaliseFirstLetter(CURRENTSTACK.friends)]
6200 ,["Find Friends", "Find Friendship"]
6201 //,[/On This List/, "On This Directory"]
6202 //,["On this list", "On this directory"]
6203 //,["On This List", "On This Directory"]
6204 ,["Related Groups", "Related Herds"]
6205
6206 ,["Notifications", "Sparks"]
6207 ,["New Likes", "New "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
6208 ,["Invite Friends", "Invite "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
6209 ,["Get More Likes", "Get More "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
6210 ,["Added Apps", "Added Magic"]
6211 ,["Apps You May Like", "Magic You May "+capitaliseFirstLetter(CURRENTSTACK.like)]
6212 ,["Your Apps", "Your Magic"]
6213 ,["People Talking About This", capitaliseFirstLetter(CURRENTSTACK.people)+" Blabbering About This"]
6214 ,["Total Likes", "Total "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
6215 ,["Games You May Like", "Games You May "+capitaliseFirstLetter(CURRENTSTACK.like)]
6216 ,["Add To News Feed", "Add To Feed Bag"]
6217
6218 ,["Messages", "Trough"]
6219 //,["Other Messages", "Other Friendship Reports"]
6220 //,["Unread Messages", "Unread Friendship Reports"]
6221 //,["Sent Messages", "Sent Friendship Reports"]
6222 //,["Archived Messages", "Archived Friendship Reports"]
6223 ,["Inbox", "Trough"]
6224
6225 ,["Groups", "Herds"]
6226 //,["Pages and Ads", "Landmarks and Ads"]
6227 ,["Apps", "Magic"]
6228 ,[/Friends who like /gi, capitaliseFirstLetter(CURRENTSTACK['friends_logic'])+" who "+CURRENTSTACK['like_past']+" "]
6229 ,["Favorites", capitaliseFirstLetter(CURRENTSTACK['likes'])]
6230 ,["Likes", capitaliseFirstLetter(CURRENTSTACK['likes'])]
6231 ,["Events", "Adventures"]
6232 ,["Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])]
6233 ,["Ads", "Cupcakes"]
6234 ,["Mutual Likes", "Mutual "+capitaliseFirstLetter(CURRENTSTACK.likes)]
6235 ,[/Mutual Friends/, "Mutual "+capitaliseFirstLetter(CURRENTSTACK.friends)]
6236
6237 ,["Notes", "Scrolls"]
6238 ,["My Notes", "My Scrolls"]
6239 ,["Notes About Me", "Scrolls About Me"]
6240 ,["Write a Note", "Write a Scroll"]
6241 ,["Edit Note", "Edit Scroll"]
6242
6243 ,["Timeline and Tagging", "Journal and Tagging"]
6244 ,["Ads, Apps and Websites", "Ads, Magic and Websites"]
6245 ,["Blocked People and Apps", "Banished "+capitaliseFirstLetter(CURRENTSTACK['people'])+" and Magic"]
6246 ,["Notifications Settings", "Sparks Settings"]
6247 ,["App Settings", "Magic Settings"]
6248 ,["Friend Requests", "Friendship Requests"]
6249 ,["People Who Shared This", capitaliseFirstLetter(CURRENTSTACK.people)+" Who Shared This"]
6250 ,["Your Notifications", "Your Sparks"]
6251 ,["Timeline and Tagging Settings", "Journal and Tagging Settings"]
6252 ,["Delete My Account", "Nuke My Account"]
6253
6254 ,["Posts in Groups", "Posts in Herds"]
6255 ,["People", capitaliseFirstLetter(CURRENTSTACK['people'])]
6256
6257 ,["Posts by Friends", "Posts by "+capitaliseFirstLetter(CURRENTSTACK.friends)]
6258 ,["Support Dashboard", "Support Dashieboard"]
6259 ,["Event Invitations", "Adventure Invitations"]
6260 ,["Who Is in These Photos?", "Who Is in These Pony Pics?"]
6261 ,["People who like this", capitaliseFirstLetter(CURRENTSTACK.people)+" that "+CURRENTSTACK.like_past+" this"]
6262 //,["List Subscribers", "Directory Subscribers"]
6263 ,["Upcoming Events", "Upcoming Adventures"]
6264 ,["Photos and Videos", "Pony Pics and Videos"]
6265 ,["People Who Are Going", capitaliseFirstLetter(CURRENTSTACK.people)+" Who Are Going"]
6266 ,["Would you like to opt out of this email notification?", "Would you like to opt out of this email spark?"]
6267 ,["Confirm Like", "Confirm "+capitaliseFirstLetter(CURRENTSTACK['like'])]
6268
6269 ,["Invite Friends You Email", "Invite "+capitaliseFirstLetter(CURRENTSTACK['friends'])+" You Email "]
6270 ,["Invite Your Friends", "Invite Your "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
6271
6272 ,["Account Groups", "Account Herds"]
6273 ,["Ads Email Notifications", "Ads Email Soarks"]
6274 ,["Ads Notifications on Facebook", "Ads Sparks on Facebook"]
6275
6276 ,["App Restrictions", "Magic Restrictions"]
6277 ,["App Info", "Magic Info"]
6278
6279 ,["Tagged Photos", "Tagged Pony Pics"]
6280
6281 ,["Add Groups", "Add Herds"] // /addgroup
6282 ];
6283
6284 menuTitles = [
6285 ["Everyone", "Everypony"]
6286 ,["Everybody", "Everypony"]
6287 ,["Public", "Everypony"]
6288 ,["Anyone", "Anypony"]
6289 ,["Friends of Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
6290 ,["Friends except Acquaintances", capitaliseFirstLetter(CURRENTSTACK['friends'])+" except Acquaintances"]
6291 ,["Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])]
6292 ,["Friends ", capitaliseFirstLetter(CURRENTSTACK['friends'])]
6293 ,["Friends of Guests", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of Guests"]
6294 ,["Only Me", "Alone"]
6295 ,["Only me", "Alone"]
6296 ,["No One", "Alone"]
6297 ,["Nobody", "Nopony"]
6298 //,["See all lists...", "See entire directory..."]
6299
6300 ,["Mutual Friends", "Mutual "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
6301 ,["People You May Know", "Ponies You May Know"]
6302 ,["Poke...", "Nuzzle..."]
6303 ,["Poke", "Nuzzle"]
6304 ,["All Friends", "All "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
6305 ,["All friends", "All "+CURRENTSTACK['friends']]
6306
6307 ,["On your own timeline", "On your own journal"]
6308 ,["On a friend's timeline", "On a "+CURRENTSTACK['friend']+"'s journal"]
6309 ,["In a group", "In a herd"]
6310 ,["In a private Message", "In a private Friendship Report"]
6311
6312 ,["Friends' Posts", capitaliseFirstLetter(CURRENTSTACK['friends'])+"' Posts"]
6313 ,["Friend Activity", capitaliseFirstLetter(CURRENTSTACK['friend'])+" Activity"]
6314
6315 ,["Change Date...", "Time Travel..."]
6316 ,["Reposition Photo...", "Reposition Pony Pic..."]
6317 ,["Manage Notifications", "Manage Sparks"]
6318 ,["Use Activity Log", "Use Adventure Log"]
6319 ,["See Banned Users...", "See Ponies who were Banished to the Moon..."]
6320 ,["Invite Friends...", "Invite "+capitaliseFirstLetter(CURRENTSTACK['friends'])+"..."]
6321 ,["Like As Your Page...", capitaliseFirstLetter(CURRENTSTACK.like)+" As Your Page..."]
6322 ,["Add App to Page", "Add Magic to App"]
6323 ,["Change Primary Photo", "Change Primary Pony Pic"]
6324 ,["Change Date", "Time Travel"]
6325
6326 ,["People", capitaliseFirstLetter(CURRENTSTACK['people'])]
6327 //,["Pages", "Landmarks"]
6328 ,["Banned", "Banished to Moon"]
6329 ,["Blocked", "Banished to Moon"]
6330 ,["People who like this", capitaliseFirstLetter(CURRENTSTACK.people)+" who "+CURRENTSTACK.like_past+" this"]
6331 ,["Pages that like this", "Pages that "+CURRENTSTACK.like_past+" this"]
6332
6333 ,["Unlike", capitaliseFirstLetter(CURRENTSTACK['unlike'])]
6334 ,["Unlike...", capitaliseFirstLetter(CURRENTSTACK['unlike'])+"..."]
6335 ,["Show in News Feed", "Show in Feed Bag"]
6336 ,["Suggest Friends...", "Suggest "+capitaliseFirstLetter(CURRENTSTACK['friends'])+"..."]
6337 ,["Unfriend...", "Banish to Moon..."]
6338 ,["Unfriend", "Banish to Moon"]
6339 //,["New List...", "New Directory..."]
6340 ,["Get Notifications", "Get Sparks"]
6341 //,["Add to another list...", "Add to another directory..."]
6342
6343 ,["Create Event", "Plan an Adventure"]
6344 ,["Edit Group", "Edit Herd"]
6345 ,["Report Group", "Whine about Herd"]
6346 ,["Leave Group", "Leave Herd"]
6347 ,["Edit Group Settings", "Edit Herd Settings"]
6348 ,["Choose from Group Photos", "Choose from Herd Pony Pics"]
6349 ,["Upload a Photo", "Upload a Pony Pic"]
6350 ,["Remove from Group", "Banish to Moon"]
6351 ,["Share Group", "Share Herd"]
6352 ,["Create Group", "Create Herd"]
6353 ,["Change group settings", "Change herd settings"]
6354 ,["Add People to Group", "Add "+capitaliseFirstLetter(CURRENTSTACK['people'])+" to the Herd"]
6355 ,["Send Message", "Send Friendship Report"]
6356 ,["View Group", "View Herd"]
6357 ,["Add People", "Add "+capitaliseFirstLetter(CURRENTSTACK['people'])]
6358
6359 ,["Remove App", "Remove Magic"]
6360 ,["Uninstall App", "Uninstall Magic"]
6361 ,["Report App", "Whine about Magic"]
6362 ,["Block App", "Block Magic"]
6363 ,["Find More Apps", "Find More Magic"]
6364 ,["No more apps to add.", "No more magic to add."]
6365
6366 ,["Delete Post And Remove User", "Nuke Post And Banish to Moon"]
6367 ,["Delete Post And Ban User", "Nuke Post And Banish to Moon"]
6368 ,["Hide from Timeline", "Hide from Journal"]
6369 ,["Delete", "Nuke"]
6370 ,["Delete...", "Nuke..."]
6371 ,["Delete Photo", "Nuke Pony Pic..."]
6372 ,["Delete This Photo", "Nuke This Pony Pic"]
6373 ,["Delete Messages...", "Nuke Friendship Reports..."]
6374 ,["Delete Post", "Nuke Post"]
6375 ,["Delete Comment", "Nuke Friendship Letter..."]
6376 ,["Show on Timeline", "Show on Journal"]
6377 ,["Show on Profile", "Show on Journal"]
6378 ,["Shown on Timeline", "Shown on Journal"]
6379 ,["Allow on Timeline", "Allow on Journal"]
6380 ,["Highlighted on Timeline", "Highlighted on Journal"]
6381 ,["Allowed on Timeline", "Allowed on Journal"]
6382 ,["Hidden from Timeline", "Hidden from Journal"]
6383 ,["Remove", "Nuke"]
6384 ,["Delete Photo...", "Nuke Pony Pic..."]
6385 ,["Remove this photo", "Nuke this pony pic"]
6386 ,["Remove photo", "Nuke pony pic"]
6387 ,["Remove...", "Nuke..."]
6388 ,["Delete Conversation...", "Nuke Conversation..."]
6389 ,["Delete Album", "Nuke Album"]
6390 ,["Delete Comment...", "Nuke Friendship Letter..."]
6391 ,["Hide Comment...", "Hide Friendship Letter..."]
6392 ,["Hide Event", "Hide Adventure"]
6393 ,["Hide Comment", "Hide Friendship Letter"]
6394 ,["Delete Post...", "Nuke Post..."]
6395 ,["Delete Video", "Nuke Video"]
6396 ,["Delete Event", "Nuke Adventure"] // for group admin
6397
6398 ,["Report/Block...", "Whine/Block..."]
6399 ,["Report/Mark as Spam", "Whine/Mark as Spam"]
6400 ,["Report Page", "Whine about Page"]
6401 ,["Report Story or Spam", "Whine about Story or Spam"]
6402 ,["Report/Mark as Spam...", "Whine/Mark as Spam..."]
6403 ,["Report story...", "Whine about story..."]
6404 ,["Report as Spam or Abuse...", "Whine as Spam or Abuse..."]
6405 ,["Report Spam or Abuse...", "Whine as Spam or Abuse..."]
6406 ,["Report as Spam...", "Whine as Spam..."]
6407 ,["Report Conversation...", "Whine about Conversation..."]
6408 ,["Report This Photo", "Whine About This Pony Pic"]
6409 ,["Report/Remove Tag", "Whine/Nuke Tag"]
6410 ,["Mark as Spam", "Whine as Spam"]
6411 ,["Report/Remove Tag...", "Whine/Nuke Tag..."]
6412 ,["Report Content", "Whine about Content"]
6413 ,["Report Profile", "Whine about Journal"]
6414 ,["Report User", "Whine about This Pony"]
6415 ,["Report", "Whine"]
6416 ,["Report Place", "Whine about Place"]
6417 ,["Report App", "Whine about Magic"]
6418 //,["Report list", "Whine about directory"]
6419 ,["Report list", "Whine about list"]
6420 ,["Event at a place", "Adventure at a place"]
6421 ,["Report as Abuse", "Whine as Abuse"]
6422
6423 ,["Hide this recent activity story from Timeline", "Hide this recent activity story from Journal"]
6424 ,["Hide Similar Activity from Timeline...", "Hide Similar Activity from Journal..."]
6425 //,["Hide All Recent Lists from Timeline...", "Hide All Recent Directories from Journal..."]
6426 ,["Hide All Recent Lists from Timeline...", "Hide All Recent Lists from Journal..."]
6427 ,["Hide all Friend Highlights from Timeline", "Hide all "+capitaliseFirstLetter(CURRENTSTACK.friend)+" Highlights from Journal"]
6428 ,["Hide This Action from Profile...", "Hide This Action from Journal..."]
6429 ,["Hide All Recent profile changes from Profile...", "Hide All Recent journal changes from Journal..."]
6430 ,["Hide All Recent Pages from Timeline...", "Hide All Recent Pages from Journal..."]
6431 ,["See Photos Hidden From Timeline", "See Pony Pics Hidden From Journal"]
6432 ,["Hide Similar Activity from Timeline", "Hide Similar Activity from Journal"]
6433
6434 ,["Upcoming Events", "Upcoming Adventures"]
6435 ,["Suggested Events", "Suggested Adventures"]
6436 ,["Past Events", "Past Adventures"]
6437 ,["Past events", "Past adventures"]
6438 ,["Declined Events", "Declined Adventures"]
6439 ,["Export Events...", "Export Adventures..."]
6440 ,["Add Event Photo", "Add Adventure Pony Pic"]
6441 ,["Cancel Event", "Cancel Adventure"]
6442 ,["Export Event", "Export Adventure"]
6443 ,["Share Event", "Share Adventure"]
6444 ,["Turn Off Notifications", "Turn Off Sparks"]
6445 ,["Turn On Notifications", "Turn On Sparks"]
6446 ,["Promote Event", "Promote Adventure"]
6447 ,["Create Repeat Event", "Create Repeat Adventure"]
6448 ,["Message Guests", "Start Whinny Chat with Guests"]
6449 ,["Edit Event", "Edit Adventure"]
6450 ,["Publish Event on Timeline", "Publish Adventure on Journal"]
6451
6452 ,["Add Friends to Chat...", "Add "+capitaliseFirstLetter(CURRENTSTACK.friends)+" to Whinny Chat..."]
6453 ,["Chat Sounds", "Whinny Chat Sounds"]
6454 ,["Add People...", "Add "+capitaliseFirstLetter(CURRENTSTACK['people'])+"..."]
6455 ,["Unread Messages", "Unread Friendship Reports"]
6456 ,["Archived Messages", "Archived Friendship Reports"]
6457 ,["Sent Messages", "Sent Friendship Reports"]
6458 ,["Forward Messages...", "Forward Friendship Reports..."]
6459 ,["Turn Off Chat", "Turn Off Whinny Chat"]
6460 ,["Open in Chat", "Open in Whinny Chat"]
6461 ,["Create Group...", "Create Herd..."]
6462 ,["Turn On Chat", "Turn On Whinny Chat"]
6463
6464 ,["Add/Remove Friends...", "Add/Remove "+capitaliseFirstLetter(CURRENTSTACK.friends)+"..."]
6465 ,["Comments and Likes", "Friendship Letters and Brohoofs"]
6466 //,["Archive List", "Archive Directory"]
6467 //,["On This List", "On This Directory"]
6468 //,["Restore List", "Restore Directory"]
6469
6470 //,["Rename List", "Rename Directory"]
6471 //,["Edit List", "Edit Directory"]
6472 ,["Notification Settings...", "Spark Settings..."]
6473 //,["Delete List", "Nuke Directory"]
6474 ,["Delete List", "Nuke List"]
6475
6476 ,["Likes", capitaliseFirstLetter(CURRENTSTACK['likes'])]
6477 ,["Photos", "Pony Pics"]
6478 ,["Comments", "Friendship Letters"]
6479 ,["Questions", "Queries"]
6480 ,["Events", "Adventures"]
6481 ,["Groups", "Herds"]
6482 ,["Timeline", "Journal"]
6483 ,["Notes", "Scrolls"]
6484 ,["Posts and Apps", "Posts and Magic"]
6485 ,["Recent Likes", "Recent "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
6486 ,["Recent Comments", "Recent Friendship Letters"]
6487 ,["Timeline Review", "Journal Review"]
6488 ,["Pokes", "Nuzzles"]
6489 ,["Activity Log...", "Adventure Log..."]
6490 ,["Activity Log", "Adventure Log"]
6491 ,["Timeline Settings", "Journal Settings"]
6492 ,["Likers", "Brohoofers"] // @todo likers
6493 ,["Open Groups", "Open Herds"]
6494 ,["Cancel Friend Request", "Cancel Friendship Request"] // activity log
6495
6496 ,["Choose from Photos...", "Choose from Pony Pics..."]
6497 ,["Upload Photo...", "Upload Pony Pic..."]
6498 ,["Take Photo...", "Take Pony Pic..."]
6499 ,["Choose from my Photos", "Choose from my Pony Pics"]
6500 ,["Reposition Photo", "Reposition Pony Pic"]
6501 ,["Add Synced Photo...", "Add Synced Pony Pic..."]
6502 ,["Add Synced Photo", "Add Synced Pony Pic"]
6503 ,["Change Primary Photo...", "Change Primary Pony Pic..."]
6504 ,["Choose from Photo Albums...", "Choose from Pony Pic Albums..."]
6505 ,["Suggest this photo...", "Suggest this pony pic..."]
6506
6507 ,["Photo", "Pony Pic"]
6508 ,["Question", "Query"]
6509
6510 ,["Pages I like", "Pages I "+capitaliseFirstLetter(CURRENTSTACK.like)]
6511 ,["My Friends", "My "+capitaliseFirstLetter(CURRENTSTACK.friends)]
6512 ,["All Notifications", "All Sparks"]
6513 ,["Search All Friends", "Search All "+capitaliseFirstLetter(CURRENTSTACK.friends)]
6514 ,["All Apps", "All Magic"]
6515
6516 ,["Page Likes", "Page "+capitaliseFirstLetter(CURRENTSTACK.likes)]
6517 ,["Mentions and Photo Tags", "Mentions and Pony Pic Tags"]
6518
6519 ,["Suggest photos", "Suggest pony pics"]
6520
6521 ,["Make Profile Picture", "Make Journal Pony Pic"]
6522 ,["Make Profile Picture for Page", "Make Journal Pony Pic for Page"]
6523 ,["Make Cover Photo", "Make Cover Pony Pic"]
6524
6525 ,["The app sends you a notification", "The magic sends you a spark"]
6526
6527 ,["Top Comments", "Top Friendship Letters"] // comment resort
6528 ,["See All Groups", "See All Herds"] // timeline
6529 ,["Friends to Invite", capitaliseFirstLetter(CURRENTSTACK['friends'])+" to Invite"] // app invite
6530
6531 // insights
6532 ,["Post Clicks / Likes, Comments & Shares", "Post Clicks / "+capitaliseFirstLetter(CURRENTSTACK['likes'])+", Comments & Shares"]
6533 ,["Likes / Comments / Shares", capitaliseFirstLetter(CURRENTSTACK['likes'])+" / Comments / Shares"]
6534 ,["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
6535 ,["Likes, Comments & Shares", capitaliseFirstLetter(CURRENTSTACK['likes'])+", Comments & Shares"]
6536 ];
6537
6538 menuPrivacyOnlyTitles = [
6539 ["Everyone", "Everypony"]
6540 ,["Public", "Everypony"]
6541 ,["Anyone", "Anypony"]
6542 ,["Friends of Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
6543 ,["Friends except Acquaintances", capitaliseFirstLetter(CURRENTSTACK['friends'])+" except Acquaintances"]
6544 ,["Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])]
6545 ,["Friends ", capitaliseFirstLetter(CURRENTSTACK['friends'])]
6546 ,["Friends of Guests", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of Guests"]
6547 ,["Only Me", "Alone"]
6548 ,["Only me", "Alone"]
6549 //,["See all lists...", "See entire directory..."]
6550 ];
6551
6552 dialogDerpTitles = [
6553 "Insufficient send permissions"
6554 ,"Update Failed"
6555 ,"Failed to upload photo."
6556 ,"Hide Photo Failed"
6557 ,"Undo Mark Spam Failed"
6558 ,"Your Request Couldn't be Processed"
6559 ,"Sorry! The blocking system is overloaded"
6560 ,"Invalid Request"
6561 ,"Block! You are engaging in behavior that may be considered annoying or abusive by other users."
6562 ,"Already connected."
6563 ,"Cannot connect."
6564 ,"Database Down"
6565 ,"Failure to hide minifeed story."
6566 ,"Object cannot be liked"
6567 ,"Sorry, something went wrong"
6568 ,"Authentication Failure"
6569 ,"Unknown error"
6570 ,"Not Logged In"
6571 ,"No Permission to Add Comment or Trying to Comment on Deleted Post"
6572 ,"Could not determine coordinates of place"
6573 ,"Sorry, your account is temporarily unavailable."
6574 ,"Don't Have Permission"
6575 ,"Oops"
6576 ,"No Languages Provided ForUpdate"
6577 ,"Comment Does Not Exist"
6578 ,"Sorry, we got confused"
6579 ,"Database Write Failed"
6580 ,"Editing Bookmarks Failed"
6581 ,"Required Field Missing"
6582 ,"Could Not Load Story"
6583 ,"Invalid Name"
6584 ,"Cannot connect to yourself."
6585 ,"This content is no longer available"
6586 ,"Error" // poking someone who hasn't poked back yet
6587 ,"Please Try Again Later"
6588 ,"Submitting Documentation Feedback Failed"
6589 ,"Bad Request"
6590 ,"Internal Error"
6591 ,"Mark as Spam Failed"
6592 ,"Could not post to Wall"
6593 ,"No permissions"
6594 ,"Messages Unavailable"
6595 ,"Don't have Permission"
6596 ,"No file specified."
6597 ,"Storage Failure"
6598 ,"Invalid Date"
6599 ,"Vote submission failed."
6600 ,"Web Address is Invalid"
6601 ,"Oops!"
6602 ,"Invalid Recipients"
6603 ,"Add Fan Status Failed"
6604 ,"Adding Member Failed"
6605 ,"Post Has Been Removed"
6606 ,"Unable to edit Group"
6607 ,"Invalid Photo Selected"
6608 ,"Cannot backdate photo"
6609 ,"Invalid Search Query"
6610 ,"Unable to Add Friend"
6611 ,"Cannot Add Member"
6612 ,"Bad Image"
6613 ,"Missing Field"
6614 ,"Invalid Custom Privacy Setting"
6615 ,"Empty Friend List"
6616 ,"Unable to Add Attachment"
6617 ,"Unable to Change Date"
6618 ,"Invalid Whining"
6619 ,"Your Page Can't Be Promoted"
6620 ,"Cannot Send Gift"
6621 ,"An error occurred."
6622 ,"Image Resource Invalid"
6623 ];
6624
6625 headerInsightsTitles = [
6626 ["People Who Like Your Page (Demographics and Location)", capitaliseFirstLetter(CURRENTSTACK.people)+" Who "+capitaliseFirstLetter(CURRENTSTACK.like)+" Your Page (Demographics and Location)"]
6627 ,["Where Your Likes Came From", "Where Your "+capitaliseFirstLetter(CURRENTSTACK.likes)+" Came From"]
6628 ,["How You Reached People (Reach and Frequency)", "How You Reached "+capitaliseFirstLetter(CURRENTSTACK.people)+" (Reach and Frequency)"]
6629 ,["How People Are Talking About Your Page", "How "+capitaliseFirstLetter(CURRENTSTACK.people)+" Are Talking About Your Page"]
6630 ];
6631
6632 dialogDescriptionTitles = [
6633 ["Are you sure you want to delete this?", "Are you sure you want to nuke this?"]
6634 ,["Are you sure you want to delete this video?", "Are you sure you want to nuke this video?"]
6635 ,["Are you sure you want to delete this photo?", "Are you sure you want to nuke this pony pic?"]
6636 ,["Are you sure you want to delete this comment?", "Are you sure you want to nuke this friendship letter?"]
6637 ,["Are you sure you want to delete this event?", "Are you sure you want to nuke this adventure?"]
6638 ,["Are you sure you want to delete this post?", "Are you sure you want to nuke this post?"]
6639 ,["Are you sure you want to remove this picture?", "Are you sure you want to nuke this pony pic?"]
6640 ,["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."]
6641 ,["Are you sure you want to remove this event?", "Are you sure you want to nuke this adventure?"]
6642 ,["Are you sure you want to unlike this?", "Are you sure you want to "+CURRENTSTACK['unlike']+" this?"]
6643 ,["Are you sure you want to remove this profile picture?", "Are you sure you want to nuke this journal pony pic?"]
6644
6645 ,["Report this if it's not relevant to your search results.", "Whine about this if it's not relevant to your search results."]
6646
6647 ,["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?"]
6648 ];
6649 }
6650
6651 var DOMNodeInserted = function(dom) {
6652 domNodeHandlerMain.run(dom);
6653 };
6654
6655 var domNodeHandler = function() {
6656 var k = this;
6657 k.snowliftPinkieInjected = false;
6658
6659 k.run = function(dom) {
6660 if (INTERNALUPDATE) {
6661 return;
6662 }
6663
6664 if (k.shouldIgnore(dom)) {
6665 return;
6666 }
6667
6668 k.dumpConsole(dom);
6669
6670 // Start internal update
6671 var iu = INTERNALUPDATE;
6672 INTERNALUPDATE = true;
6673
6674 // Buttons
6675 if (dom.target.parentNode && dom.target.parentNode.parentNode) {
6676 var stop = true;
6677 var replacer = buttonTitles;
6678 if (hasClass(dom.target.parentNode, 'uiButtonText')) {
6679 var buttonText = dom.target.parentNode;
6680 var button = dom.target.parentNode.parentNode;
6681 stop = false;
6682
6683 if (button.parentNode && button.parentNode.parentNode && hasClass(button.parentNode.parentNode, 'audienceSelector')) {
6684 replacer = menuPrivacyOnlyTitles;
6685 }
6686 } else if (hasClass(dom.target.parentNode, '_42ft') || hasClass(dom.target.parentNode, '-cx-PRIVATE-abstractButton__root')) {
6687 // dropdown on close friends list dialog
6688 // <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>
6689 var buttonText = dom.target;
6690 var button = dom.target.parentNode;
6691 stop = false;
6692 } else if (hasClass(dom.target.parentNode.parentNode, '_42ft') || hasClass(dom.target.parentNode.parentNode, '-cx-PRIVATE-abstractButton__root')) {
6693 // hasClass(buttonText, '_55pe') || hasClass(buttonText, '-cx-PUBLIC-abstractPopoverButton__label')
6694 // "share to" dropdown on sharer dialog
6695 // comment resort on entstream
6696 var buttonText = dom.target;
6697 var button = dom.target.parentNode.parentNode;
6698 stop = false;
6699 }
6700
6701 if (!stop) {
6702 if (buttonText.nodeType == 3) {
6703 var orig = buttonText.textContent;
6704 } else {
6705 var orig = buttonText.innerHTML;
6706 }
6707 var replaced = replaceText(replacer, orig);
6708 if (hasClass(button, 'uiButton') || hasClass(button, '_42ft') || hasClass(button, '-cx-PRIVATE-abstractButton__root')) {
6709 // button text that didn't get ponified needs to be considered, e.g. share dialog's "On your Page"
6710 if (button.getAttribute('data-hover') != 'tooltip') {
6711 if (orig != replaced) {
6712 // ponified text
6713 if (button.title == '') {
6714 // tooltip is blank, so it would be OK to set our own
6715 button.title = orig;
6716 } else {
6717 // tooltip is NOT blank, this means (1) FB added their own tooltip or (2) we already added our own tooltip
6718 if (button.title == button.getAttribute('data-ponyhoof-button-orig')) {
6719 button.title = orig;
6720 }
6721 }
6722 } else {
6723 button.title = '';
6724 }
6725 }
6726 button.setAttribute('data-ponyhoof-button-orig', orig);
6727 button.setAttribute('data-ponyhoof-button-text', replaced);
6728 }
6729 if (orig != replaced) {
6730 if (buttonText.nodeType == 3) {
6731 buttonText.textContent = replaced;
6732 } else {
6733 buttonText.innerHTML = replaced;
6734 }
6735 }
6736 }
6737 }
6738
6739 // Text nodes
6740 if (dom.target.nodeType == 3) {
6741 //k.textNodes(dom);
6742 // firefox in mutationObserver goes to here when it should be characterData
6743 k.mutateCharacterData(dom);
6744 INTERNALUPDATE = iu;
6745 return;
6746 }
6747
6748 injectOptionsLink();
6749
6750 k.snowliftPinkie(dom);
6751 k.notificationsFlyoutSettings(dom);
6752
6753 // .ufb-button-input => mutateAttributes
6754 domReplaceFunc(dom.target, '', '.uiButtonText, .uiButton input, ._42ft, .-cx-PRIVATE-abstractButton__root, ._42fu, .-cx-PRIVATE-uiButton__root, ._4jy0, .-cx-PRIVATE-xuiButton__root', function(ele) {
6755 // <a class="uiButton uiButtonConfirm uiButtonLarge" href="#" role="button"><span class="uiButtonText">Finish</span></a>
6756 // <label class="uiButton uiButtonConfirm"><input value="Okay" type="submit"></label>
6757
6758 // <button class="_42ft _42fu _11b selected _42g-" type="submit">Post</button>
6759 // <a class="_42ft _42fu" role="button" href="#"><i class="mrs img sp_8jfoef sx_d2d7c4"></i>Promote App</a>
6760 var button = ele;
6761 var replacer = buttonTitles;
6762 var tagName = ele.tagName.toUpperCase();
6763 if (tagName != 'A' && tagName != 'LABEL' && tagName != 'BUTTON') {
6764 button = ele.parentNode;
6765
6766 // new message
6767 var potentialLabel = button.querySelector('._6q-, .-cx-PUBLIC-mercuryComposer__button');
6768 if (potentialLabel) {
6769 ele = potentialLabel;
6770 }
6771 } else {
6772 var potentialLabel = button.querySelector('._55pe, .-cx-PUBLIC-abstractPopoverButton__label');
6773 if (potentialLabel) {
6774 ele = potentialLabel;
6775 } else {
6776 // Get More Likes button on page admin panel
6777 // <button value="1" class="_42ft _42fu selected _42g- _42gy" id="fanAcquisitionPanelPreviewBodyConfirmButton" type="submit"><span id="u_x_a">Get More Likes</span></button>
6778 }
6779 // Get More Likes (above)
6780 // comment resort on entstream
6781 if (ele.childNodes && ele.childNodes.length == 1 && ele.childNodes[0].tagName && ele.childNodes[0].tagName.toUpperCase() == 'SPAN') {
6782 ele = ele.childNodes[0];
6783 }
6784 }
6785 if (button &&
6786 (button.getAttribute('data-ponyhoof-button-orig') == null || (hasClass(button, '_for') || hasClass(button, '-cx-PRIVATE-fbVaultBadgedButton__button'))) && // vault buttons are crapped
6787 (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')*/)
6788 ) {
6789 if (button.parentNode && button.parentNode.parentNode && hasClass(button.parentNode.parentNode, 'audienceSelector')) {
6790 replacer = menuPrivacyOnlyTitles;
6791 }
6792
6793 if (tagName == 'INPUT') {
6794 var orig = ele.value;
6795 button.setAttribute('data-ponyhoof-button-orig', orig);
6796 var replaced = replaceText(replacer, orig);
6797
6798 k.changeButtonText(ele, replaced);
6799 } else {
6800 var orig = '';
6801 var replaced = '';
6802 loopChildText(ele, function(child) {
6803 if (child.nodeType == 3) {
6804 orig += child.textContent;
6805 replaced += replaceText(replacer, child.textContent);
6806 if (child.textContent != replaced) {
6807 child.textContent = replaced;
6808 }
6809 }
6810 });
6811 button.setAttribute('data-ponyhoof-button-orig', orig);
6812 }
6813
6814 if (orig != replaced) {
6815 if (button.getAttribute('data-hover') != 'tooltip') {
6816 if (button.title == '') {
6817 button.title = orig;
6818 }
6819 }
6820 }
6821 button.setAttribute('data-ponyhoof-button-text', replaced);
6822
6823 // Top-right "Join Group" and "Notifications" link on groups requires some treatment to avoid long group names from being crapped
6824 var ajaxify = button.getAttribute('ajaxify');
6825 if ((ajaxify && ajaxify.indexOf('/ajax/groups/membership/r2j.php?ref=group_jump_header') == 0) || (button.parentNode && button.parentNode.parentNode && hasClass(button.parentNode.parentNode, 'groupNotificationsSelector'))) {
6826 var groupsJumpTitle = $('groupsJumpTitle');
6827 if (!groupsJumpTitle) {
6828 return;
6829 }
6830
6831 var groupsJumpBarTop = dom.target.getElementsByClassName('groupsJumpBarTop');
6832 if (!groupsJumpBarTop.length) {
6833 return;
6834 }
6835 groupsJumpBarTop = groupsJumpBarTop[0];
6836
6837 var rfloat = groupsJumpBarTop.getElementsByClassName('rfloat');
6838 if (!rfloat.length) {
6839 return;
6840 }
6841 rfloat = rfloat[0];
6842
6843 var groupsCleanLinks = groupsJumpBarTop.getElementsByClassName('groupsCleanLinks');
6844 if (!groupsCleanLinks.length) {
6845 return;
6846 }
6847 groupsCleanLinks = groupsCleanLinks[0];
6848
6849 groupsJumpTitle.style.maxWidth = (800 - ((groupsCleanLinks.offsetWidth || 0) + (rfloat.offsetWidth || 0) - (groupsJumpTitle.offsetWidth || 0)) - 10) + 'px';
6850 }
6851 }
6852
6853 });
6854
6855 k.ufiPagerLink(dom);
6856
6857 if (k.reactRoot(dom)) {
6858 INTERNALUPDATE = iu;
6859 return;
6860 }
6861
6862 k.postLike(dom);
6863
6864 if (k.ticker(dom)) {
6865 INTERNALUPDATE = iu;
6866 return;
6867 }
6868
6869 domReplaceFunc(dom.target, '', '.inCommonSectionList, #fbTimelineHeadline .name h2 > div, ._8yb, .-cx-PRIVATE-fbEntstreamAttachmentAvatar__secondarydetaillist, ._508a, .-cx-PRIVATE-pageLikeStory__fancountfooter, .permalinkHeaderInfo > .subscribeOrLikeSentence > .fwn', k.textBrohoof);
6870
6871 domReplaceFunc(dom.target, '', '.uiUfiViewAll, .uiUfiViewPrevious, .uiUfiViewMore', function(ele) {
6872 var button = ele.querySelector('input[type="submit"]');
6873 var t = button.value;
6874 t = t.replace(/comments/g, "friendship letters");
6875 t = t.replace(/comment/g, "friendship letter");
6876 if (button.value != t) {
6877 button.value = t;
6878 }
6879 });
6880
6881 k.tooltip(dom.target);
6882
6883 domReplaceFunc(dom.target, 'egoProfileTemplate', '.egoProfileTemplate', function(ele) {
6884 if (ele.getAttribute('data-ponyhoof-ponified')) {
6885 return;
6886 }
6887 var div = ele.getElementsByTagName('div');
6888 if (div.length) {
6889 for (var i = 0, len = div.length; i < len; i += 1) {
6890 var t = div[i].innerHTML;
6891 t = k.textStandard(t);
6892 if (div[i].innerHTML != t) {
6893 div[i].innerHTML = t;
6894 }
6895 }
6896 }
6897
6898 var action = ele.getElementsByClassName('uiIconText');
6899 if (action.length) {
6900 action = action[0];
6901 ele.setAttribute('data-ponyhoof-iconText', action.textContent);
6902
6903 var t = action.innerHTML;
6904 t = t.replace(/Like/g, capitaliseFirstLetter(CURRENTSTACK.like));
6905 t = t.replace(/Join Group/g, "Join the Herd");
6906 t = t.replace(/Add Friend/g, "Add "+capitaliseFirstLetter(CURRENTSTACK.friend));
6907 t = t.replace(/\bConfirm Friend\b/g, "Confirm Friendship");
6908 action.innerHTML = t;
6909 }
6910
6911 ele.setAttribute('data-ponyhoof-ponified', 1);
6912 });
6913
6914 domReplaceFunc(dom.target, 'uiInterstitial', '.uiInterstitial', function(ele) {
6915 if (ele.getAttribute('data-ponyhoof-ponified')) {
6916 return;
6917 }
6918 ele.setAttribute('data-ponyhoof-ponified', 1);
6919
6920 var title = ele.getElementsByClassName('uiHeaderTitle');
6921 if (title.length) {
6922 title = title[0];
6923 } else {
6924 title = ele.querySelector('.fsxl.fwb');
6925 if (!title) {
6926 return;
6927 }
6928 }
6929 ele.setAttribute('data-ponyhoof-inters-title', title.textContent);
6930 });
6931
6932 domReplaceFunc(dom.target, 'uiLayer', '.uiLayer', function(ele) {
6933 if (ele.getAttribute('data-ponyhoof-dialog-title')) {
6934 return;
6935 }
6936
6937 var titlebar = ele.querySelector('.-cx-PUBLIC-uiDialog__title, ._t ._1yw, ._4-i0, .-cx-PRIVATE-xuiDialog__title, .overlayTitle, .fbCalendarOverlayHeader');
6938 if (titlebar) {
6939 var titletext = ele.querySelector('._52c9, .-cx-PRIVATE-xuiDialog__titletext');
6940 if (!titletext) {
6941 titletext = titlebar;
6942 }
6943
6944 var orig = '';
6945 var replaced = '';
6946 loopChildText(titletext, function(child) {
6947 if (child.nodeType == 3) {
6948 orig += child.textContent;
6949 replaced += replaceText(dialogTitles, child.textContent);
6950 if (child.textContent != replaced) {
6951 child.textContent = replaced;
6952 }
6953 }
6954 });
6955 addClass(titlebar, 'ponyhoof_fbdialog_title');
6956 if (orig != replaced) {
6957 titlebar.title = orig;
6958 }
6959
6960 addClass(ele, 'ponyhoof_fbdialog');
6961 ele.setAttribute('data-ponyhoof-dialog-title', replaced);
6962 ele.setAttribute('data-ponyhoof-dialog-orig', orig);
6963
6964 var body = ele.querySelector('._t ._13, .-cx-PRIVATE-uiDialog__body, ._4-i2, .-cx-PRIVATE-xuiDialog__body, .uiLayerPageContent > .pvm');
6965 if (body) {
6966 addClass(body, 'ponyhoof_fbdialog_body');
6967
6968 var stop = false;
6969 loopChildText(body, function(child) {
6970 if (stop) {
6971 return;
6972 }
6973 if (child.nodeType == TEXT_NODE) {
6974 var replaced = replaceText(dialogDescriptionTitles, child.textContent);
6975 if (child.textContent != replaced) {
6976 child.textContent = replaced;
6977 stop = true;
6978 }
6979 }
6980 });
6981
6982 k._dialog_insertReadme(body);
6983 }
6984
6985 if (hasClass(dom.target, 'uiLayer')) {
6986 // dom.target is intentional
6987 // Detect rare cases when HTML detection just got turned on, and there is a dialog at the back
6988 k._dialog_playSound(replaced, ele);
6989 }
6990 }
6991
6992 domChangeTextbox(ele, '.groupsMemberFlyoutWelcomeTextarea', function(textbox) {
6993 var orig = textbox.getAttribute('placeholder');
6994 var t = orig.replace(/\bgroup\b/, 'herd');
6995 if (t != orig) {
6996 return t;
6997 }
6998 return "Welcome him/her to the herd...";
6999 });
7000 domChangeTextbox(ele, '.fbEventMemberComment', function(textbox) {
7001 var orig = textbox.getAttribute('placeholder');
7002 var t = orig.replace(/\bevent\b/, 'adventure');
7003 if (t != orig) {
7004 return t;
7005 }
7006 return orig; // for pages "Write something to let her know you're going too."
7007 });
7008
7009 // Hovercard
7010 $$(ele, '._7lo > .fcg, .-cx-PRIVATE-hovercard__footer > .fcg', function(footer) {
7011 loopChildText(footer, k.textBrohoof);
7012 });
7013 });
7014
7015 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) {
7016 if (CURRENTSTACK.stack == 'pony') {
7017 ele.setAttribute('data-hover', 'tooltip');
7018 ele.setAttribute('aria-label', CURRENTLANG.fb_share_tooltip);
7019 ele.setAttribute('title', '');
7020 }
7021 });
7022
7023 domReplaceFunc(dom.target, '', '.uiHeaderTitle, .legacyContextualDialogTitle, ._6dp, .-cx-PRIVATE-litestandRHC__titlename', function(ele) {
7024 var imgwrap = ele.querySelector('._8m, .-cx-PRIVATE-uiImageBlock__content, .adsCategoryTitleLink');
7025 if (imgwrap) {
7026 ele = imgwrap;
7027 };
7028
7029 loopChildText(ele, function(child) {
7030 if (!child.children || !child.children.length) {
7031 var t = replaceText(headerTitles, child.textContent);
7032 if (child.textContent != t) {
7033 child.textContent = t;
7034 }
7035 }
7036 });
7037 });
7038
7039 domReplaceFunc(dom.target, '', '.insights-header .header-title > .ufb-text-content', function(ele) {
7040 var t = replaceText(headerInsightsTitles, ele.textContent);
7041 if (ele.textContent != t) {
7042 ele.textContent = t;
7043 }
7044 });
7045
7046 if (k.fbDockChatBuddylistNub(dom.target)) {
7047 INTERNALUPDATE = iu;
7048 return;
7049 }
7050
7051 if (k.pokesDashboard(dom.target)) {
7052 INTERNALUPDATE = iu;
7053 return;
7054 }
7055
7056 k.commentBrohoofed(dom);
7057
7058 k.changeCommentBox(dom);
7059 k.changeComposer(dom);
7060
7061 k.notification(dom);
7062 k.menuItems(dom);
7063 k.fbRemindersStory(dom.target);
7064 if (k.flyoutLikeForm(dom.target)) {
7065 INTERNALUPDATE = iu;
7066 return;
7067 }
7068 k.pluginButton(dom.target);
7069 k.insightsCountry(dom);
7070 k.timelineMutualLikes(dom.target);
7071 k.videoStageContainer(dom.target);
7072 k.uiStreamShareLikePageBox(dom.target);
7073
7074 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...");
7075 domChangeTextbox(dom.target, '.groupAddMemberTypeaheadBox .inputtext', "Add "+capitaliseFirstLetter(CURRENTSTACK.friends)+" to the Herd");
7076 //domChangeTextbox(dom.target, '.friendListAddTypeahead .inputtext', "Add "+CURRENTSTACK.friends+" to this directory");
7077 domChangeTextbox(dom.target, '.friendListAddTypeahead .inputtext', "Add "+CURRENTSTACK.friends+" to this list");
7078 domChangeTextbox(dom.target, '.groupsJumpHeaderSearch .inputtext', "Search this herd");
7079 domChangeTextbox(dom.target, '.MessagingSearchFilter .inputtext', "Search Friendship Reports");
7080 domChangeTextbox(dom.target, '#chatFriendsOnline .fbChatTypeahead .inputtext', "Pals on Whinny Chat");
7081
7082 //domChangeTextbox(dom.target, '.uiComposer textarea', "What lessons in friendship have you learned today?");
7083 //domChangeTextbox(dom.target, '.uiComposerMessageBox textarea', "Share your friendship stories...");
7084 //domChangeTextbox(dom.target, '.uiMetaComposerMessageBox textarea', "What lessons in friendship have you learned today?");
7085 domChangeTextbox(dom.target, '#q, ._585- ._586f, .-cx-PUBLIC-fbFacebar__root .-cx-PUBLIC-uiStructuredInput__text', function(searchbox) {
7086 if (CURRENTLANG.sniff_fb_search_boxAlt && searchbox.getAttribute('placeholder').indexOf(CURRENTLANG.sniff_fb_search_boxAlt) != -1) {
7087 return CURRENTLANG.fb_search_boxAlt;
7088 }
7089 return CURRENTLANG.fb_search_box;
7090 });
7091
7092 k.ponyhoofPageOptions(dom);
7093 if (userSettings.debug_betaFacebookLinks && w.location.hostname == 'beta.facebook.com') {
7094 k.debug_betaFacebookLinks(dom.target);
7095 }
7096
7097 INTERNALUPDATE = iu;
7098 };
7099
7100 k.photos_snowlift = null;
7101 k.snowliftPinkie = function(dom) {
7102 if (!k.snowliftPinkieInjected) {
7103 var id = dom.target.getAttribute('id');
7104 if ((id && id == 'photos_snowlift') || hasClass(dom.target, 'fbPhotoSnowlift')) {
7105 k.snowliftPinkieInjected = true;
7106 k.photos_snowlift = dom.target;
7107
7108 addClass(k.photos_snowlift, 'ponyhoof_snowlift_haspinkiediv');
7109 var n = d.createElement('div');
7110 n.id = 'ponyhoof_snowlift_pinkie';
7111 k.photos_snowlift.appendChild(n);
7112 }
7113 }
7114 };
7115
7116 k.notificationsFlyoutSettingsInjected = false;
7117 k.notificationsFlyoutSettings = function(dom) {
7118 if (ISUSINGPAGE) {
7119 k.notificationsFlyoutSettingsInjected = true;
7120 return;
7121 }
7122 if (!k.notificationsFlyoutSettingsInjected) {
7123 var jewel = $('fbNotificationsJewel');
7124 if (jewel) {
7125 var header = jewel.getElementsByClassName('uiHeaderTop');
7126 if (!header.length || !header[0].childNodes || !header[0].childNodes.length) {
7127 return;
7128 }
7129 header = header[0];
7130
7131 var settingsLink = d.createElement('a');
7132 settingsLink.href = '#';
7133 settingsLink.textContent = 'Ponyhoof Sounds';
7134
7135 var actions = jewel.getElementsByClassName('uiHeaderActions');
7136 if (actions.length) {
7137 actions = actions[0];
7138 var span = d.createElement('span');
7139 span.innerHTML = ' &middot; ';
7140
7141 actions.appendChild(span);
7142 actions.appendChild(settingsLink);
7143 } else {
7144 var rfloat = d.createElement('div');
7145 rfloat.className = 'rfloat';
7146 rfloat.appendChild(settingsLink);
7147 header.insertBefore(rfloat, header.childNodes[0]);
7148 }
7149
7150 settingsLink.addEventListener('click', function(e) {
7151 e.preventDefault();
7152
7153 if (!optionsGlobal) {
7154 optionsGlobal = new Options();
7155 }
7156 optionsGlobal.create();
7157 optionsGlobal.switchTab('sounds');
7158 optionsGlobal.show();
7159
7160 try {
7161 clickLink(jewel.getElementsByClassName('jewelButton')[0]);
7162 } catch (e) {}
7163 }, false);
7164
7165 k.notificationsFlyoutSettingsInjected = true;
7166 }
7167 }
7168 };
7169
7170 k.textNodes = function(dom) {
7171 try {
7172 if (!dom.target.parentNode || !dom.target.parentNode.parentNode || !hasClass(dom.target.parentNode.parentNode, 'dialog_title')) {
7173 return false;
7174 }
7175
7176 var title = dom.target.parentNode.parentNode;
7177 var orig = dom.target.textContent;
7178 var replaced = replaceText(dialogTitles, orig);
7179
7180 if (dom.target.textContent != replaced) {
7181 dom.target.textContent = replaced;
7182 }
7183 addClass(title, 'ponyhoof_fbdialog_title');
7184 if (orig != replaced) {
7185 title.title = orig;
7186 }
7187
7188 k.getParent(title, function(ele) {
7189 return hasClass(ele, 'generic_dialog');
7190 }, function(ele) {
7191 if (hasClass(ele, 'fbQuestionsPopup')) {
7192 return;
7193 }
7194
7195 addClass(ele, 'ponyhoof_fbdialog');
7196 ele.setAttribute('data-ponyhoof-dialog-title', replaced);
7197 ele.setAttribute('data-ponyhoof-dialog-orig', orig);
7198
7199 var body = ele.getElementsByClassName('dialog_body');
7200 if (body.length) {
7201 body = body[0];
7202 addClass(body, 'ponyhoof_fbdialog_body');
7203
7204 var confirmation_message = body.getElementsByClassName('confirmation_message');
7205 if (confirmation_message.length) {
7206 confirmation_message = confirmation_message[0];
7207
7208 var stop = false;
7209 loopChildText(confirmation_message, function(child) {
7210 if (stop) {
7211 return;
7212 }
7213 if (child.nodeType == TEXT_NODE) {
7214 var replaced = replaceText(dialogDescriptionTitles, child.textContent);
7215 if (child.textContent != replaced) {
7216 child.textContent = replaced;
7217 stop = true;
7218 }
7219 }
7220 });
7221 } else {
7222 var video_dialog_text = body.getElementsByClassName('video_dialog_text');
7223 if (video_dialog_text.length) {
7224 video_dialog_text = video_dialog_text[0];
7225 if (video_dialog_text.childNodes.length == 3) {
7226 var i = 0;
7227 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?"];
7228 loopChildText(video_dialog_text, function(child) {
7229 if (!texts[i]) {
7230 return;
7231 }
7232 child.textContent = texts[i];
7233 i += 1;
7234 });
7235 }
7236 }
7237 }
7238 }
7239
7240 k._dialog_playSound(replaced, ele);
7241 });
7242
7243 return true;
7244 } catch (e) {}
7245
7246 return false;
7247 };
7248
7249 k.ufiPagerLink = function(dom) {
7250 domReplaceFunc(dom.target, '', '.UFIPagerLink', function(ele) {
7251 var t = ele.innerHTML;
7252 t = t.replace(/ comments/, " friendship letters");
7253 t = t.replace(/ comment/, " friendship letter");
7254 if (ele.innerHTML != t) {
7255 ele.innerHTML = t;
7256 }
7257 });
7258 };
7259
7260 k.postLike = function(dom) {
7261 if (hasClass(dom.target, 'uiUfiLike') || hasClass(dom.target, 'UFILikeSentence')) {
7262 k._likePostBox(dom.target);
7263 } else {
7264 /*if (dom.target.parentNode) {
7265 if (hasClass(dom.target.parentNode, 'UFILikeSentence')) {
7266 k._likePostBox(dom.target);
7267 return;
7268 }
7269 }*/
7270 domReplaceFunc(dom.target, '', '.uiUfiLike, .UFILikeSentence', k._likePostBox);
7271 }
7272 };
7273
7274 k._likePostBox = function(ele) {
7275 //var inner = ele.querySelector('._42ef, .-cx-PRIVATE-uiFlexibleBlock__flexiblecontent, .lfloat > span, .-cx-PRIVATE-uiImageBlockDeprecated__content, .-cx-PRIVATE-uiImageBlock__content, ._8m, .-cx-PRIVATE-uiFlexibleBlock__flexibleContent');
7276 //if (inner) {
7277
7278 var inner = ele.getElementsByClassName('UFILikeSentenceText');
7279 if (inner.length) {
7280 inner = inner[0];
7281 var t = k.likeSentence(inner.innerHTML);
7282 if (inner.innerHTML != t) {
7283 inner.innerHTML = t;
7284 }
7285 }
7286
7287 var reorder = ele.getElementsByClassName('UFIOrderingModeSelectorDownCaret');
7288 if (reorder.length) {
7289 reorder = reorder[0];
7290 if (reorder.previousSibling) {
7291 k.UFIOrderingMode(reorder.previousSibling);
7292 }
7293 }
7294 };
7295
7296 k.likeSentence = function(t) {
7297 //t = t.replace(/likes? this\./g, "brohoof'd this.");
7298 t = t.replace(/like this\./g, CURRENTSTACK['like_past']+" this.");
7299 t = t.replace(/likes this\./g, CURRENTSTACK['likes_past']+" this.");
7300 t = t.replace(/\bpeople\b/g, CURRENTSTACK['people']);
7301 t = t.replace(/\bperson\b/g, CURRENTSTACK['person']); // http://fb.com/647294431950845
7302 //t = t.replace(/(^|\\W|_)people(^|\\W|_)/g, "ponies");
7303 /*if (CURRENTSTACK == 'pony') {
7304 t = t.replace(/\<3 7h\!5/g, '/) 7h!5');
7305 t = t.replace(/\<3 7h15/g, '/) 7h!5');
7306 }*/
7307
7308 return t;
7309 };
7310
7311 k._likeCount = function(ufiitem) {
7312 var likecount = ufiitem.getElementsByClassName('comment_like_button');
7313 if (likecount.length) {
7314 likecount = likecount[0];
7315 var t = likecount.innerHTML;
7316 //t = t.replace(/likes? this\./g, "brohoof'd this.");
7317 t = t.replace(/like this/g, CURRENTSTACK['like_past']+" this");
7318 t = t.replace(/likes this/g, CURRENTSTACK['likes_past']+" this");
7319 if (likecount.innerHTML != t) {
7320 likecount.innerHTML = t;
7321 }
7322 }
7323 };
7324
7325 k.UFIOrderingMode = function(ele) {
7326 var t = ele.textContent;
7327 t = t.replace(/Top Comments/, "Top Friendship Letters");
7328 if (ele.textContent != t) {
7329 ele.textContent = t;
7330 }
7331 };
7332
7333 k._likeDesc = '';
7334 k._unlikeDesc = '';
7335 k._likeConditions = '';
7336 k._likeIsLikeConditions = '';
7337 k.FB_TN_LIKELINK = '>';
7338 k.FB_TN_UNLIKELINK = '?';
7339 k.commentBrohoofed = function(dom) {
7340 var targets = '.UFICommentActions a, .UFILikeLink';
7341 if (!USINGMUTATION) {
7342 targets += ', .UFILikeThumb';
7343 }
7344 domReplaceFunc(dom.target, '', targets, k._commentLikeLink);
7345 };
7346
7347 k.commentLikeDescInit = function() {
7348 if (k._likeDesc == '') {
7349 var locale = getDefaultUiLang();
7350 if (LANG[locale] && LANG[locale].sniff_comment_tooltip_like) {
7351 k._likeDesc = LANG[locale].sniff_comment_tooltip_like;
7352 } else {
7353 k._likeDesc = LANG['en_US'].sniff_comment_tooltip_like;
7354 }
7355 if (LANG[locale] && LANG[locale].sniff_comment_tooltip_unlike) {
7356 k._unlikeDesc = LANG[locale].sniff_comment_tooltip_unlike;
7357 } else {
7358 k._unlikeDesc = LANG['en_US'].sniff_comment_tooltip_unlike;
7359 }
7360
7361 k._likeConditions = [
7362 k._likeDesc, k._unlikeDesc,
7363 capitaliseFirstLetter(CURRENTSTACK.like)+" this friendship letter", capitaliseFirstLetter(CURRENTSTACK.unlike)+" this friendship letter"
7364 ];
7365 k._likeIsLikeConditions = [
7366 k._likeDesc,
7367 capitaliseFirstLetter(CURRENTSTACK.like)+" this friendship letter"
7368 ];
7369 }
7370 };
7371
7372 k._commentLikeLink = function(ele) {
7373 k.commentLikeDescInit();
7374
7375 var pass = false;
7376 var likeThumb = false;
7377 if (k._likeConditions.indexOf(ele.title) == -1) {
7378 // extreme sniffing
7379 var trackingNode = k.getTrackingNode(ele);
7380 if (trackingNode == k.FB_TN_LIKELINK || trackingNode == k.FB_TN_UNLIKELINK) {
7381 pass = true;
7382 } else if (!USINGMUTATION && hasClass(ele, 'UFILikeThumb')) {
7383 likeThumb = true;
7384 pass = true;
7385 }
7386 } else {
7387 pass = true;
7388 }
7389 if (!pass) {
7390 return;
7391 }
7392
7393 if (!hasClass(ele, 'ponyhoof_brohoof_button')) {
7394 if (!USINGMUTATION) {
7395 ele.addEventListener('click', function() {
7396 var ele = this;
7397 k.delayIU(function() {
7398 if (likeThumb) {
7399 // UFILikeThumb disappears after a post is brohoof'd
7400 k._likeBrohoofMagic(ele, false);
7401 } else {
7402 k._commentLikeLink(ele);
7403 }
7404 });
7405 }, false);
7406 }
7407 addClass(ele, 'ponyhoof_brohoof_button');
7408 }
7409
7410 var isLike = false;
7411 if (k.getTrackingNode(ele) == k.FB_TN_LIKELINK || likeThumb || k._likeIsLikeConditions.indexOf(ele.title) != -1) {
7412 isLike = true;
7413 }
7414
7415 k._likeBrohoofMagic(ele, isLike);
7416 };
7417
7418 k._likeBrohoofMagic = function(ele, isLike) {
7419 var comment = k.getReactComment(ele);
7420 var title = '';
7421 if (isLike) {
7422 removeClass(ele, 'ponyhoof_brohoof_button_unbrohoof');
7423 title = capitaliseFirstLetter(CURRENTSTACK.like)+" this";
7424 } else {
7425 addClass(ele, 'ponyhoof_brohoof_button_unbrohoof');
7426 title = capitaliseFirstLetter(CURRENTSTACK.unlike)+" this";
7427 }
7428 if (comment) {
7429 title += " friendship letter";
7430 }
7431 ele.setAttribute('data-ponyhoof-title', ele.title);
7432 ele.title = title;
7433 ele.setAttribute('data-ponyhoof-title-modified', title);
7434
7435 if (comment) {
7436 k._markCommentLiked(comment, isLike);
7437
7438 // Fix an edge case with jump to comment
7439 if (hasClass(comment, 'highlightComment')) {
7440 w.setTimeout(function() {
7441 k._markCommentLiked(comment, isLike);
7442 }, 1);
7443 }
7444 } else {
7445 k.delayIU(function() {
7446 if (!ele.parentNode) {
7447 var ufi = k.getReactUfi(ele);
7448 if (!ufi) {
7449 return;
7450 }
7451 ele = ufi;
7452 }
7453
7454 k.getParent(ele, function(form) {
7455 return (form.tagName.toUpperCase() == 'FORM' && hasClass(form, 'commentable_item'));
7456 }, function(form) {
7457 if (!form) {
7458 return;
7459 }
7460 var ufi = form.getElementsByClassName('UFIList');
7461 if (!ufi.length) {
7462 return;
7463 }
7464 ufi = ufi[0];
7465 if (!ufi.parentNode) {
7466 return;
7467 }
7468
7469 if (isLike) {
7470 removeClass(ufi.parentNode, 'ponyhoof_brohoofed');
7471 } else {
7472 addClass(ufi.parentNode, 'ponyhoof_brohoofed');
7473 }
7474 });
7475 });
7476 }
7477 };
7478
7479 k._markCommentLiked = function(ufiitem, isLike) {
7480 var child = null;
7481 if (ufiitem.childNodes && ufiitem.childNodes[0]) {
7482 child = ufiitem.childNodes[0];
7483 }
7484 if (isLike) {
7485 removeClass(ufiitem, 'ponyhoof_comment_liked');
7486 if (child) {
7487 removeClass(child, 'ponyhoof_comment_liked');
7488 }
7489 } else {
7490 addClass(ufiitem, 'ponyhoof_comment_liked');
7491 if (child) {
7492 addClass(child, 'ponyhoof_comment_liked');
7493 }
7494 }
7495 };
7496
7497 k.REACTROOTID = '.r['; // https://github.com/facebook/react/commit/8bc2abd367232eca66e4d38ff63b335c8cf23c45
7498 k.REACTATTRNAME = 'data-reactid'; // https://github.com/facebook/react/commit/67cf44e7c18e068e3f39462b7ac7149eee58d3e5
7499 k.getReactId = function(ufiitem) {
7500 var id = ufiitem.getAttribute(k.REACTATTRNAME);
7501 if (!id) {
7502 return false;
7503 }
7504 return id.substring(k.REACTROOTID.length, id.indexOf(']'));
7505 };
7506
7507 k.reactRoot = function(dom) {
7508 var id = dom.target.getAttribute(k.REACTATTRNAME);
7509 if (id || hasClass(dom.target, 'UFILikeIcon')) {
7510 // beeperNotificaton
7511 if (hasClass(dom.target, '_3sod') || hasClass(dom.target, '-cx-PRIVATE-notificationBeeperItem__beeperitem')) {
7512 var info = dom.target.querySelector('._3sol > span, .-cx-PRIVATE-notificationBeeperItem__imageblockcontent > span');
7513 if (!info) {
7514 return false;
7515 }
7516 k._beepNotification_change(dom.target, info, k._beepNotification_condition_react);
7517
7518 return true;
7519 }
7520
7521 // Notifications
7522 if (k._notification_react(dom.target)) {
7523 return true;
7524 }
7525 var notificationReact = false;
7526 domReplaceFunc(dom.target, '', '.'+k.notification_itemClass[0]+', .'+k.notification_itemClass[1], function(ele) {
7527 k._notification_react(ele);
7528 notificationReact = true;
7529 });
7530 if (notificationReact) {
7531 return true;
7532 }
7533
7534 // Comments
7535 if (hasClass(dom.target, 'UFIComment')) {
7536 k.commentBrohoofed({target: dom.target});
7537 } else if (hasClass(dom.target, 'UFIReplyList')) {
7538 k.changeCommentBox({target: dom.target});
7539 k.commentBrohoofed({target: dom.target}); // only 1 reply
7540 } else if (hasClass(dom.target, 'UFIAddComment')) {
7541 domChangeTextbox(dom.target, 'textarea', k._changeCommentBox_change);
7542 } else if (hasClass(dom.target, 'UFILikeSentence')) {
7543 k._likePostBox(dom.target);
7544 } else if (hasClass(dom.target, 'UFIImageBlockContent')) {
7545 //if (hasClass(dom.target, '_42ef') || hasClass(dom.target, '-cx-PRIVATE-uiFlexibleBlock__flexiblecontent')) {
7546 // on groups with seen, clicking a photo will open in the viewer, but the original post on the group messes up
7547 k._likePostBox(dom.target.parentNode);
7548 //} else {
7549 // marking a comment as spam in another section, and then unmark
7550 k.commentBrohoofed({target: dom.target});
7551 //}
7552 } else if (hasClass(dom.target, 'UFILikeLink') || (!USINGMUTATION && hasClass(dom.target, 'UFILikeThumb'))) {
7553 k._commentLikeLink(dom.target);
7554 } else if (dom.target.parentNode) {
7555
7556 if (hasClass(dom.target.parentNode, 'UFIComment')) {
7557 // marking a comment as spam, and then immediately undo
7558 k.commentBrohoofed({target: dom.target.parentNode});
7559 } else if (hasClass(dom.target.parentNode, 'UFILikeSentence')) {
7560 // groups with seen, from no likes to liked
7561 k._likePostBox(dom.target.parentNode);
7562 } else if (dom.target.parentNode.parentNode) {
7563
7564 //if (hasClass(dom.target.parentNode.parentNode, 'UFIImageBlockContent') || hasClass(dom.target.parentNode.parentNode, 'lfloat')) {
7565 if (hasClass(dom.target.parentNode.parentNode, 'UFILikeSentenceText')) {
7566 // John Amebijeigeba Laverdetberg brohoof this.
7567 // You and John Amebijeigeba Laverdetberg like this.
7568 var ufi = k.getReactUfi(dom.target);
7569 if (ufi) {
7570 k.postLike({target: ufi});
7571 }
7572 } else if (dom.target.parentNode.parentNode.parentNode) {
7573
7574 //if (hasClass(dom.target.parentNode.parentNode.parentNode, 'UFIImageBlockContent')) {
7575 if (hasClass(dom.target.parentNode.parentNode.parentNode, 'UFILikeSentenceText')) {
7576 var ufi = k.getReactUfi(dom.target);
7577 if (ufi) {
7578 k.postLike({target: ufi});
7579 }
7580 }
7581 }
7582 }
7583 }
7584 return true;
7585 }
7586
7587 return false;
7588 };
7589
7590 k.changeCommentBox = function(dom) {
7591 domChangeTextbox(dom.target, '.commentArea textarea, .UFIAddComment textarea', k._changeCommentBox_change);
7592 };
7593 k._changeCommentBox_change = function(textbox) {
7594 try {
7595 var form = textbox;
7596 while (form) {
7597 if (form.tagName.toUpperCase() == 'FORM' && form.getAttribute('action') == '/ajax/ufi/modify.php') {
7598 break;
7599 }
7600 form = form.parentNode;
7601 }
7602 if (form) {
7603 var feedback_params = JSON.parse(form.querySelector('input[name="feedback_params"]').value);
7604 switch (feedback_params.assoc_obj_id) {
7605 case '140792002656140':
7606 case '346855322017980':
7607 return LANG['ms_MY'].fb_comment_box;
7608
7609 case '146225765511748':
7610 return CURRENTLANG.fb_composer_coolstory;
7611
7612 default:
7613 break;
7614 }
7615 switch (feedback_params.target_profile_id) {
7616 case '496282487062916':
7617 return CURRENTLANG.fb_composer_coolstory;
7618
7619 default:
7620 break;
7621 }
7622 }
7623 } catch (e) {}
7624
7625 return CURRENTLANG.fb_comment_box;
7626 };
7627
7628 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');
7629 k.composerExclude = new RegExp(['suck', 'shit', 'fuck', 'assho', 'crap', 'ponyfag', 'faggo', 'retard', 'dick'].join('|'), 'i');
7630 k.composerSpecialPages = {
7631 '140792002656140': {composer: LANG['ms_MY'].fb_composer_lessons, malay:true}
7632 ,'346855322017980': {composer: LANG['ms_MY'].fb_composer_lessons, malay:true}
7633 ,'366748370110998': {composer: LANG['ms_MY'].fb_composer_lessons, malay:true}
7634 ,'146225765511748': {composer: CURRENTLANG.fb_composer_coolstory}
7635 ,'496282487062916': {composer: CURRENTLANG.fb_composer_coolstory}
7636 };
7637 k.composerSelectors = '.uiComposer textarea.mentionsTextarea, .composerTypeahead textarea';
7638 k.composerButtonSelectors = '.uiComposerMessageBoxControls .submitBtn input, .uiComposerMessageBoxControls .submitBtn .uiButtonText, ._11b input, .-cx-PRIVATE-fbComposerMessageBox__button input, button._11b, button.-cx-PRIVATE-fbComposerMessageBox__button';
7639 k.changeComposer = function(dom) {
7640 var pageid = '';
7641
7642 // tagging people with "Who are you with?" and new feelings feature
7643 if (hasClass(dom.target, 'uiMentionsInput')) {
7644 // fix group composers, ugh
7645 if (dom.target.parentNode && dom.target.parentNode.parentNode && dom.target.parentNode.parentNode.parentNode) {
7646 // .uiMentionsInput -> #id -> .-cx-PUBLIC-fbComposerMessageBox__root -> form -> .-cx-PUBLIC-fbComposer__content
7647 k._changeComposer_fixGroup(dom.target.parentNode.parentNode.parentNode);
7648 }
7649
7650 contentEval(function(arg) {
7651 try {
7652 if (typeof window.requireLazy == 'function') {
7653 window.requireLazy(['MentionsInput'], function(MentionsInput) {
7654 var mentions = MentionsInput.getInstance(document.getElementById(arg.uiMentionsInput));
7655 mentions.setPlaceholder(mentions._input.title);
7656 });
7657 }
7658 } catch (e) {
7659 if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
7660 console.log("Unable to hook to MentionsInput");
7661 console.dir(e);
7662 }
7663 }
7664 }, {"CANLOG":CANLOG, "uiMentionsInput":dom.target.id});
7665 return;
7666 }
7667
7668 domChangeTextbox(dom.target, k.composerSelectors, function(composer) {
7669 var placeholderText = CURRENTLANG.fb_composer_lessons;
7670
7671 try {
7672 var form = composer;
7673 var inputContainer = null;
7674 while (form) {
7675 if (hasClass(form, 'uiComposer') || hasClass(form, '_119' /*'_118'*/) || hasClass(form, '-cx-PRIVATE-fbComposer__root')) {
7676 break;
7677 }
7678 if (hasClass(form, 'inputContainer')) {
7679 inputContainer = form;
7680 }
7681 form = form.parentNode;
7682 }
7683
7684 if (!form) {
7685 return placeholderText;
7686 }
7687
7688 pageid = form.querySelector('input[name="xhpc_targetid"]');
7689 if (!pageid) {
7690 pageid = '';
7691 return placeholderText;
7692 }
7693 pageid = pageid.value;
7694 form.setAttribute('data-ponyhoof-xhpc_targetid', pageid);
7695 if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].composer) {
7696 placeholderText = k.composerSpecialPages[pageid].composer;
7697 }
7698
7699 k._changeComposerAttachment(dom, pageid);
7700
7701 if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
7702 $$(form, k.composerButtonSelectors, function(submit) {
7703 k.changeButtonText(submit, "Kirim");
7704 });
7705 }
7706
7707 composer.addEventListener('input', function() {
7708 var malay = false;
7709 var lang = CURRENTLANG;
7710 if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
7711 malay = true;
7712 lang = LANG['ms_MY'];
7713 }
7714
7715 // we can't guarantee the button anymore, so we have to do this expensive JS :(
7716 // group composers are funky and teleport the textbox to a new <div> onclick
7717 $$(form, k.composerButtonSelectors, function(submit) {
7718 if (!k.composerExclude.test(composer.value) && k.composerPonies.test(composer.value)) {
7719 if (composer.value.toUpperCase() == composer.value) {
7720 k.changeButtonText(submit, lang.fb_composer_ponies_caps);
7721 } else {
7722 k.changeButtonText(submit, lang.fb_composer_ponies);
7723 }
7724 } else if (malay) {
7725 k.changeButtonText(submit, "Kirim");
7726 } else {
7727 var submitParent = submit;
7728 if (submit.tagName.toUpperCase() != 'BUTTON') {
7729 submitParent = submit.parentNode;
7730 }
7731 if (submitParent.getAttribute('data-ponyhoof-button-text')) {
7732 k.changeButtonText(submit, submitParent.getAttribute('data-ponyhoof-button-text'));
7733 }
7734 }
7735 });
7736 });
7737
7738 if (isPonyhoofPage(pageid)) {
7739 composer.addEventListener('focus', function() {
7740 if (inputContainer) {
7741 k._changeComposer_insertReadme(inputContainer.nextSibling);
7742 return;
7743 }
7744
7745 // pages have ComposerX and teleports the textbox here and there
7746 $$(form, '._2yg, .-cx-PUBLIC-fbComposerMessageBox__root', function(composer) {
7747 // exclude inactives
7748 if (!composer.parentNode || hasClass(composer.parentNode, 'hidden_elem')) {
7749 return;
7750 }
7751
7752 var temp = composer.getElementsByClassName('ponyhoof_page_readme');
7753 if (temp.length) {
7754 return;
7755 }
7756
7757 // status: before taggersPlaceholder
7758 // photos: after uploader
7759 // fallback: before bottom bar
7760 var insertBefore = composer.querySelector('._3-6, .-cx-PRIVATE-fbComposerBootloadStatus__taggersplaceholder');
7761 if (!insertBefore) {
7762 insertBefore = composer.querySelector('._93, .-cx-PRIVATE-fbComposerUploadMedia__root');
7763 if (insertBefore) {
7764 insertBefore = insertBefore.nextSibling;
7765 }
7766 }
7767 if (!insertBefore) {
7768 insertBefore = composer.querySelector('._1dsp, .-cx-PUBLIC-fbComposerMessageBox__bar');
7769 }
7770 // abort if no good insertion
7771 if (!insertBefore) {
7772 return;
7773 }
7774
7775 k._changeComposer_insertReadme(insertBefore);
7776 });
7777 }, true);
7778 return "Send feedback for Ponyhoof...";
7779 }
7780 if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].composer) {
7781 return k.composerSpecialPages[pageid].composer;
7782 }
7783 } catch (e) {}
7784
7785 return placeholderText;
7786 });
7787
7788 // moved outside for timelineStickyHeader
7789 if (!pageid) {
7790 k._changeComposerAttachment(dom, null);
7791 }
7792
7793 // fix group composers, ugh
7794 //k._changeComposer_fixGroup(dom.target);
7795 };
7796
7797 k._changeComposerAttachment = function(dom, pageid) {
7798 $$(dom.target, '._4_ li a, ._9lb, .-cx-PUBLIC-fbComposerAttachment__link, .uiComposerAttachment', function(attachment) {
7799 if (attachment.getAttribute('data-ponyhoof-ponified')) {
7800 return;
7801 }
7802
7803 var switchit = false;
7804 switch (attachment.getAttribute('data-endpoint')) {
7805 case '/ajax/composerx/attachment/status/':
7806 case '/ajax/composerx/attachment/group/post/':
7807 case '/ajax/composerx/attachment/wallpost/':
7808 case '/ajax/metacomposer/attachment/timeline/status.php':
7809 case '/ajax/metacomposer/attachment/timeline/backdated_status.php':
7810 case '/ajax/metacomposer/attachment/timeline/wallpost.php':
7811 switchit = "Take a Note";
7812 if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
7813 switchit = "Tulis Kiriman";
7814 }
7815 break;
7816
7817 case '/ajax/composerx/attachment/media/chooser/':
7818 case '/ajax/composerx/attachment/media/chooser':
7819 case '/ajax/composerx/attachment/media/upload/':
7820 case '/ajax/metacomposer/attachment/timeline/photo/photo.php':
7821 case '/ajax/metacomposer/attachment/timeline/photo/backdated_upload.php':
7822 case '/ajax/metacomposer/attachment/timeline/backdated_vault.php?max_select=1':
7823 switchit = "Add a Pic";
7824 if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
7825 switchit = "Tambah Gambar / Video";
7826 }
7827 break;
7828
7829 case '/ajax/composerx/attachment/question/':
7830 switchit = "Query";
7831 if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
7832 switchit = "Tanya Soalan";
7833 }
7834 break;
7835
7836 case '/ajax/composerx/attachment/group/file/':
7837 case '/ajax/composerx/attachment/group/filedropbox/':
7838 if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
7839 switchit = "Muat Naik Fail";
7840 }
7841 break;
7842
7843 default:
7844 break;
7845 }
7846 if (!switchit) {
7847 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) {
7848 switchit = "Adventure, Milestone +";
7849 //if (attachment.id == 'offerEventAndOthersButton') {
7850 if (attachment.textContent.toLowerCase().indexOf('offer') != -1) {
7851 switchit = "Offer, Adventure +";
7852 }
7853 }
7854 }
7855
7856 if (switchit) {
7857 var done = false;
7858 var inner = attachment.querySelector('._2-s, .-cx-PUBLIC-fbTimelineComposerAttachment__label');
7859 if (!inner) {
7860 inner = attachment.querySelector('._51z7, .-cx-PUBLIC-fbComposerAttachment__linktext');
7861 if (!inner) {
7862 // page timelines use ".attachmentName" and are wacky, there are actually two copies of the <div> that show/hide
7863 $$(attachment, '.attachmentName', function(inner) {
7864 k._changeComposerAttachment_inner(inner, switchit);
7865 done = true;
7866 });
7867
7868 if (!done) {
7869 inner = attachment;
7870 }
7871 }
7872 }
7873
7874 if (!done) {
7875 k._changeComposerAttachment_inner(inner, switchit);
7876 }
7877 }
7878
7879 attachment.setAttribute('data-ponyhoof-ponified', 1);
7880 });
7881 };
7882
7883 k._changeComposerAttachment_inner = function(inner, switchit) {
7884 var stopit = false;
7885 loopChildText(inner, function(child) {
7886 if (stopit) {
7887 return;
7888 }
7889 if (child.nodeType == 3) {
7890 child.textContent = switchit;
7891 stopit = true;
7892 }
7893 });
7894 };
7895
7896 k._changeComposer_insertReadme = function(insertBefore) {
7897 var n = d.createElement('iframe');
7898 n.className = 'showOnceInteracted ponyhoof_page_readme _4- -cx-PRIVATE-fbComposer__showonceinteracted';
7899 n.scrolling = 'auto';
7900 n.frameborder = '0';
7901 n.allowtransparency = 'true';
7902 n.src = PONYHOOF_README;
7903 insertBefore.parentNode.insertBefore(n, insertBefore);
7904 };
7905
7906 k._changeComposer_fixGroup = function(target) {
7907 if (hasClass(target.parentNode, '_55d0') || hasClass(target.parentNode, '.-cx-PUBLIC-fbComposer__content')) {
7908 var pageid = target.querySelector('input[name="xhpc_targetid"]');
7909 if (!pageid) {
7910 return;
7911 }
7912 pageid = pageid.value;
7913
7914 // domChangeTextbox will not work as these <textarea>s already has "data-ponyhoof-ponified"
7915 var composer = target.querySelector(k.composerSelectors);
7916 if (!composer) {
7917 return;
7918 }
7919
7920 $$(target, k.composerButtonSelectors, function(submit) {
7921 var malay = false;
7922 var lang = CURRENTLANG;
7923 if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
7924 malay = true;
7925 lang = LANG['ms_MY'];
7926 }
7927
7928 if (!k.composerExclude.test(composer.value) && k.composerPonies.test(composer.value)) {
7929 if (composer.value.toUpperCase() == composer.value) {
7930 k.changeButtonText(submit, lang.fb_composer_ponies_caps);
7931 } else {
7932 k.changeButtonText(submit, lang.fb_composer_ponies);
7933 }
7934 } else if (malay) {
7935 k.changeButtonText(submit, "Kirim");
7936 }
7937 });
7938 }
7939 };
7940
7941 k.tooltip = function(target) {
7942 domReplaceFunc(target, '', '.tooltipContent', function(ele) {
7943 // <div class="tooltipContent"><div class="tooltipText"><span>Hide</span></div></div>
7944 // <div class="tooltipContent"><div>Ponyhoof brohoofs this.</div></div>
7945 // <div class="tooltipContent">xy</div>
7946 // <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>
7947 var io = ele.getElementsByClassName('tooltipText');
7948 if (io.length) {
7949 var target = io[0];
7950 } else {
7951 var target = ele;
7952 }
7953 var potentialLabel = target.querySelector('._5bqd, .-cx-PRIVATE-HubbleInfoTip__content');
7954 if (potentialLabel) {
7955 target = potentialLabel;
7956 }
7957 if (target.childNodes && target.childNodes[0] && target.childNodes[0].tagName && target.childNodes[0].tagName.toUpperCase() == 'DIV') {
7958 target = target.childNodes[0];
7959 }
7960 if (target.childNodes && target.childNodes[0] && target.childNodes[0].tagName && target.childNodes[0].tagName.toUpperCase() == 'SPAN') {
7961 target = target.childNodes[0];
7962 }
7963 /*io = target.getElementsByTagName('div');
7964 if (io.length) {
7965 target = io[0];
7966 }
7967 io = target.getElementsByTagName('span');
7968 if (io.length) {
7969 target = io[0];
7970 }*/
7971
7972 var t = target.innerHTML;
7973 t = replaceText(tooltipTitles, t);
7974 if (target.innerHTML != t) {
7975 var oldWidth = target.offsetWidth;
7976 target.innerHTML = t;
7977
7978 var layer = k._tooltipGetLayer(ele);
7979 if (!layer) {
7980 return;
7981 }
7982
7983 var layerInner = layer.getElementsByClassName('uiContextualLayer');
7984 if (!layerInner.length) {
7985 return;
7986 }
7987 layerInner = layerInner[0];
7988
7989 removeClass(layer, 'ponyhoof_tooltip_flip');
7990
7991 if (layerInner.className.match(/Center/)) {
7992 layer.style.width = 'auto'; // fix horizontal scrollbar
7993 var left = parseInt(layer.style.left);
7994 var newWidth = target.offsetWidth;
7995 layer.style.left = (left - Math.round((newWidth - oldWidth) / 2))+'px';
7996 } else if (layerInner.className.match(/Left/)) {
7997 // Fix "Remember: all place ratings are public." tooltips that are being ponified and causing a horizontal page scrollbar
7998 //
7999 // This is complicated, Facebook caches the ContextualLayer <div>s for tooltips
8000 // If we directly change the classNames like this:
8001 // layerInner.className = layerInner.className.replace(/Left/, 'Right');
8002 // This would cause future tooltips to display incorrectly
8003 // So what we done is add our own "ponyhoof_tooltip_flip" class which flips the tooltip left to right
8004
8005 var rect = ele.getBoundingClientRect();
8006 if (!rect) {
8007 return;
8008 }
8009 if (rect.right >= d.documentElement.clientWidth) {
8010 layer.style.width = 'auto'; // bogus anyway
8011 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
8012 addClass(layer, 'ponyhoof_tooltip_flip');
8013 }
8014 }
8015 }
8016 });
8017 };
8018
8019 k._tooltipGetLayer = function(ele) {
8020 // <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>
8021 if (!ele.parentNode || !ele.parentNode.parentNode || !ele.parentNode.parentNode.parentNode) {
8022 return false;
8023 }
8024 var layer = ele.parentNode.parentNode.parentNode;
8025 if (!hasClass(layer, 'uiContextualLayerPositioner')) {
8026 return false;
8027 }
8028 return layer;
8029 };
8030
8031 k.fbDockChatBuddylistNub = function(target) {
8032 if (target.parentNode && target.parentNode.parentNode && target.parentNode.parentNode.getAttribute && target.parentNode.parentNode.getAttribute('id') == 'fbDockChatBuddylistNub' && hasClass(target, 'label')) {
8033 k._fbDockChatBuddylistNub_change(target);
8034 return true;
8035 }
8036 // first loading
8037 var nub = target.querySelector('#fbDockChatBuddylistNub .label');
8038 if (nub) {
8039 k._fbDockChatBuddylistNub_change(nub);
8040 }
8041 return false;
8042 };
8043
8044 k._fbDockChatBuddylistNub_change = function(target) {
8045 if (target.childNodes && target.childNodes.length && target.childNodes[0] && target.childNodes[0].nodeType == TEXT_NODE) {
8046 var replaced = target.childNodes[0].textContent.replace(/Chat/, "Whinny");
8047 if (target.childNodes[0].textContent != replaced) {
8048 addClass(target, 'ponyhoof_chatLabel_ponified');
8049 target.childNodes[0].textContent = replaced;
8050 }
8051 }
8052 };
8053
8054 k.pokesDashboard = function(target) {
8055 if (target.getAttribute && target.getAttribute('id') && target.getAttribute('id').indexOf('poke_') == 0) {
8056 k._pokesDashboard_item(target);
8057 return true;
8058 }
8059
8060 //$$(target, '.pokesDashboard > .objectListItem', k._pokesDashboard_item);
8061 $$(target, '.objectListItem[id^="poke_"]', k._pokesDashboard_item);
8062
8063 if (hasClass(target, 'highlight')) {
8064 var t = target.textContent;
8065 t = t.replace(/You poked /, 'You nuzzled ');
8066 if (target.textContent != t) {
8067 target.textContent = t;
8068 }
8069 return true;
8070 }
8071
8072 k._pokesDashboard_pokeLink(target);
8073
8074 return false;
8075 };
8076
8077 k._pokesDashboard_item = function(item) {
8078 //var header = item.getElementsByClassName('pokeHeader');
8079 //if (!header || !header.length) {
8080 // return;
8081 //}
8082 //header = header[0];
8083
8084 var header = item.querySelector('.uiProfileBlockContent > ._6a > ._6b > .fwb'); // .-cx-PRIVATE-uiInlineBlock__root > .-cx-PRIVATE-uiInlineBlock__middle
8085 if (!header) {
8086 return;
8087 }
8088
8089 var t = header.innerHTML;
8090 t = t.replace(/ poked you\./, ' nuzzled you.');
8091 if (header.innerHTML != t) {
8092 header.innerHTML = t;
8093 }
8094
8095 k._pokesDashboard_pokeLink(item);
8096 };
8097
8098 k._pokesDashboard_pokeLink = function(target) {
8099 $$(target, 'a[ajaxify^="/ajax/pokes/poke_inline.php"]', function(poke) {
8100 var text = "Nuzzle";
8101 if (poke.getAttribute('ajaxify').indexOf('pokeback=1') != -1) { // http://fb.com/406911932763192
8102 text = "Nuzzle Back";
8103 }
8104
8105 if (poke.childNodes && poke.childNodes.length && poke.childNodes[1]) {
8106 poke.childNodes[1].textContent = text;
8107 return;
8108 }
8109
8110 var stop = false;
8111 loopChildText(poke, function(child) {
8112 if (stop) {
8113 return;
8114 }
8115 if (child.nodeType == TEXT_NODE) {
8116 child.textContent = text;
8117 stop = true;
8118 }
8119 });
8120 });
8121 };
8122
8123 k.notification = function(dom) {
8124 domReplaceFunc(dom.target, 'notification', '.notification', function(ele) {
8125 k._notification_change(ele, '.info', k._notification_general_metadata);
8126 });
8127
8128 if (ONPLUGINPAGE) {
8129 $$(dom.target, '.notification-item', function(ele) {
8130 k._notification_change(ele, '.notification-text > .message', k._notification_messenger_metadata);
8131 });
8132 }
8133 };
8134
8135 k.notification_itemClass = ['_33c', '-cx-PRIVATE-fbNotificationJewelItem__item'];
8136 k.notification_textClass = ['_4l_v', '-cx-PRIVATE-fbNotificationJewelItem__text'];
8137 k.notification_metadataClass = ['_33f', '-cx-PRIVATE-fbNotificationJewelItem__metadata'];
8138 k._notification_react = function(ele) {
8139 for (var i = 0; i <= 1; i += 1) {
8140 if (hasClass(ele, k.notification_itemClass[i])) {
8141 k._notification_change(ele, '.'+k.notification_textClass[i]+' > span', k._notification_react_metadata);
8142 return true;
8143 }
8144 }
8145 return false;
8146 };
8147
8148 k._notification_general_metadata = function(node) {
8149 if (hasClass(node, 'metadata') || hasClass(node, 'blueName')) {
8150 return false;
8151 }
8152 return true;
8153 };
8154
8155 k._notification_messenger_metadata = function(node) {
8156 if (node.nodeType != TEXT_NODE) {
8157 return false;
8158 }
8159 return true;
8160 };
8161
8162 k._notification_react_metadata = function(node) {
8163 if (hasClass(node, 'fwb')) {
8164 return false;
8165 }
8166 if (hasClass(node, k.notification_metadataClass[0]) || hasClass(node, k.notification_metadataClass[1])) {
8167 return false;
8168 }
8169 return true;
8170 };
8171
8172 k._notification_change = function(ele, info, metadataFunc) {
8173 var info = ele.querySelector(info);
8174 if (!info) {
8175 return;
8176 }
8177 if (!info.childNodes || !info.childNodes.length) {
8178 return;
8179 }
8180
8181 for (var i = 0, len = info.childNodes.length; i < len; i += 1) {
8182 var node = info.childNodes[i];
8183 if (!metadataFunc(node)) {
8184 continue;
8185 }
8186
8187 var text = node.textContent;
8188 if (text.indexOf('"') != -1) {
8189 var finalText = k.textNotification(text.substring(0, text.indexOf('"')));
8190 finalText += text.substring(text.indexOf('"'), text.length);
8191 } else {
8192 var finalText = k.textNotification(text);
8193 }
8194
8195 if (node.textContent != finalText) {
8196 node.textContent = finalText;
8197 }
8198
8199 if (text.indexOf('"') != -1) {
8200 break;
8201 }
8202 }
8203 };
8204
8205 k.menuPrivacyOnlyAjaxify = [
8206 // when posting
8207 '%22value%22%3A%2280%22' // Everyone
8208 ,'%22value%22%3A%2250%22' // Friends of Friends
8209 ,'%22value%22%3A%2240%22' // Friends
8210 ,'%22value%22%3A%22127%22' // Friends except Acquaintances
8211 ,'%22value%22%3A%2210%22' // Only Me
8212
8213 // https://www.facebook.com/settings?tab=timeline&section=posting&view
8214 ,'%22value%22%3A40'
8215 ,'%22value%22%3A10'
8216 ];
8217 k._processMenuXOldWidthDiff = 0;
8218 k.menuItems = function(dom) {
8219 var processMenuX = false;
8220 var hasScrollableArea = false;
8221 k._processMenuXOldWidthDiff = 0;
8222 domReplaceFunc(dom.target, 'uiMenuItem', '.uiMenuItem, ._54ni, .-cx-PUBLIC-abstractMenuItem__root, .ufb-menu-item', function(ele) {
8223 if (hasClass(ele, 'ponyhoof_fbmenuitem')) {
8224 return;
8225 }
8226 addClass(ele, 'ponyhoof_fbmenuitem');
8227
8228 // pages on share dialog
8229 if (hasClass(ele, '_90z') || hasClass(ele, '-cx-PRIVATE-fbShareModePage__smalliconcontainer')) {
8230 return;
8231 }
8232
8233 // lists/groups on Invite Friends dialogs
8234 var listendpoint = ele.getAttribute('data-listendpoint');
8235 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) {
8236 return;
8237 }
8238
8239 var replacer = menuTitles;
8240 if (hasClass(ele, 'fbPrivacyAudienceSelectorOption')) {
8241 replacer = menuPrivacyOnlyTitles;
8242
8243 // ensure that only FB-provided options get changed
8244 var itemAnchor = ele.getElementsByClassName('itemAnchor');
8245 if (itemAnchor.length) {
8246 var ajaxify = itemAnchor[0].getAttribute('ajaxify');
8247 // Sometimes ajaxify is missing (legacy edit video)
8248 if (ajaxify) {
8249 var _menuPrivacyOnlyOk = false;
8250 for (var i = 0, len = k.menuPrivacyOnlyAjaxify.length; i < len; i += 1) {
8251 if (ajaxify.indexOf(k.menuPrivacyOnlyAjaxify[i]) != -1) {
8252 _menuPrivacyOnlyOk = true;
8253 break;
8254 }
8255 }
8256 if (!_menuPrivacyOnlyOk) {
8257 return;
8258 }
8259 }
8260 }
8261 }
8262
8263 var label = ele.querySelector('.itemLabel, ._54nh, .-cx-PUBLIC-abstractMenuItem__label, .ufb-menu-item-label');
8264 if (label) {
8265 //if (label.childNodes.length == 1) {
8266 // timeline post has 2
8267 var io = label.getElementsByTagName('span');
8268 if (io.length) {
8269 if (!hasClass(io[0], 'hidden_elem')) {
8270 label = io[0];
8271 }
8272 }
8273
8274 var orig = '';
8275 var replaced = '';
8276 //var oldWidthBody = '';
8277 var oldLabelWidth = 0;
8278 ele.setAttribute('data-ponyhoof-menuitem-orig', ele.textContent);
8279 loopChildText(label, function(child) {
8280 if (child.nodeType == 3) {
8281 var t = child.textContent;
8282 orig += t+' ';
8283 t = replaceText(replacer, t);
8284 if (child.textContent != t) {
8285 if (!hasScrollableArea && (ele.parentNode && ele.parentNode.parentNode && hasClass(ele.parentNode.parentNode, 'uiScrollableAreaContent'))) {
8286 hasScrollableArea = true;
8287 }
8288 if (hasScrollableArea) {
8289 //oldWidthBody = ele.parentNode.parentNode.parentNode.style.width;
8290 //ele.parentNode.parentNode.parentNode.style.width = 'auto';
8291 label.style.display = 'inline-block';
8292 //var oldWidth = label.offsetWidth;
8293 if (!oldLabelWidth) {
8294 //oldLabelWidth = oldWidth;
8295 oldLabelWidth = label.offsetWidth;
8296 }
8297 }
8298 child.textContent = t;
8299 }
8300 replaced += t+' ';
8301 }
8302 });
8303 //if (hasScrollableArea) {
8304 //ele.parentNode.parentNode.parentNode.style.width = oldWidthBody;
8305 //}
8306
8307 orig = orig.substr(0, orig.length-1);
8308 replaced = replaced.substr(0, replaced.length-1);
8309 ele.setAttribute('data-ponyhoof-menuitem-text', replaced);
8310 ele.setAttribute('data-label', replaced); // technically, this is only used for .uiMenuItem
8311
8312 if (orig != replaced) {
8313 if (hasClass(ele, '_54ni') || hasClass(ele, '-cx-PUBLIC-abstractMenuItem__root')) {
8314 if (hasScrollableArea && oldLabelWidth) {
8315 var newWidth = label.offsetWidth;
8316 if (newWidth > oldLabelWidth) {
8317 k._processMenuXOldWidthDiff = Math.max(newWidth - oldLabelWidth, 0);
8318 processMenuX = true;
8319 }
8320 } else {
8321 processMenuX = true;
8322 }
8323 }
8324 }
8325 if (hasScrollableArea) {
8326 label.style.display = '';
8327 }
8328 }
8329 });
8330
8331 if (processMenuX) {
8332 if (hasClass(dom.target, 'uiContextualLayerPositioner')) {
8333 k._menuItems_processMenuX(dom.target);
8334 return;
8335 }
8336
8337 k.getParent(dom.target, function(parent) {
8338 return hasClass(parent, 'uiContextualLayerPositioner');
8339 }, k._menuItems_processMenuX);
8340 }
8341 };
8342 k._menuItems_processMenuX = function(layer) {
8343 if (!layer) {
8344 return;
8345 }
8346
8347 var ownerid = layer.getAttribute('data-ownerid');
8348 if (!ownerid) {
8349 return;
8350 }
8351 ownerid = $(ownerid);
8352 if (!ownerid) {
8353 return;
8354 }
8355
8356 var menu = layer.querySelector('._54nq, .-cx-PUBLIC-abstractMenu__wrapper');
8357 if (!menu) {
8358 return;
8359 }
8360
8361 if (k._processMenuXOldWidthDiff) {
8362 var uiScrollableArea = layer.getElementsByClassName('uiScrollableArea');
8363 var uiScrollableAreaBody = layer.getElementsByClassName('uiScrollableAreaBody');
8364 if (uiScrollableArea && uiScrollableAreaBody) {
8365 uiScrollableArea = uiScrollableArea[0];
8366 uiScrollableAreaBody = uiScrollableAreaBody[0];
8367
8368 uiScrollableArea.style.width = (parseInt(uiScrollableArea.style.width)+k._processMenuXOldWidthDiff)+'px';
8369 uiScrollableAreaBody.style.width = (parseInt(uiScrollableAreaBody.style.width)+k._processMenuXOldWidthDiff)+'px';
8370 }
8371 }
8372
8373 var border = layer.querySelector('._54hx, .-cx-PUBLIC-abstractMenu__shortborder');
8374 if (!border) {
8375 return;
8376 }
8377 border.style.width = (Math.max((menu.offsetWidth - ownerid.offsetWidth), 0))+'px';
8378 };
8379
8380 k.fbRemindersStory = function(target) {
8381 $$(target, '.fbRemindersStory', function(item) {
8382 var inner = item.querySelector('._42ef > .fcg, .-cx-PRIVATE-uiFlexibleBlock__flexiblecontent > .fcg');
8383 if (!inner) {
8384 return;
8385 }
8386
8387 loopChildText(inner, function(child) {
8388 if (child.nodeType == TEXT_NODE) {
8389 var t = child.textContent;
8390 t = t.replace(/\bpoked you\b/, "nuzzled you");
8391 if (child.textContent != t) {
8392 child.textContent = t;
8393 }
8394 } else {
8395 if (hasClass(child, 'fbRemindersTitle')) {
8396 var t = child.innerHTML;
8397 t = t.replace(/([0-9]+?) events/, "$1 adventures")
8398 if (child.innerHTML != t) {
8399 child.innerHTML = t;
8400 }
8401 }
8402 }
8403 });
8404 });
8405 };
8406
8407 k.flyoutLikeForm = function(target) {
8408 var result = k._flyoutLikeForm(target, 'groupsMemberFlyoutLikeForm', 'unlike');
8409 if (!result) {
8410 result = k._flyoutLikeForm(target, 'fbEventMemberLike', 'liked');
8411 }
8412 return result;
8413 };
8414
8415 k._flyoutLikeForm = function(target, className, forminput) {
8416 domReplaceFunc(target, className, '.'+className, function(ele) {
8417 if (!ele.elements[forminput]) {
8418 return;
8419 }
8420
8421 var isLike = true;
8422 if (ele.elements[forminput].value == 1) {
8423 isLike = false;
8424 }
8425
8426 var submit = ele.querySelector('input[type="submit"]');
8427 if (!submit) {
8428 return;
8429 }
8430 if (isLike) {
8431 submit.value = capitaliseFirstLetter(CURRENTSTACK['like']);
8432 } else {
8433 submit.value = capitaliseFirstLetter(CURRENTSTACK['unlike']);
8434 }
8435 });
8436
8437 if (hasClass(target, className)) {
8438 return true;
8439 }
8440 return false;
8441 };
8442
8443 k.pluginButton = function(target) {
8444 if (!ONPLUGINPAGE) {
8445 return;
8446 }
8447
8448 var root = target.getElementsByClassName('pluginConnectButtonLayoutRoot');
8449 //var root = target.getElementsByClassName('pluginSkinLight');
8450 if (!root.length) {
8451 return;
8452 }
8453 root = root[0];
8454
8455 domReplaceFunc(root, '', '.pluginButton', function(ele) {
8456 var div = ele.getElementsByTagName('div');
8457 if (div.length) {
8458 ele = div[0];
8459 }
8460
8461 // <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>
8462 var stop = false;
8463 loopChildText(ele, function(child) {
8464 if (stop) {
8465 return;
8466 }
8467 if (child.tagName.toUpperCase() == 'SPAN') {
8468 if (child.innerHTML == "Like") {
8469 child.innerHTML = capitaliseFirstLetter(CURRENTSTACK.like);
8470 stop = true;
8471 }
8472 }
8473 });
8474 });
8475
8476 domReplaceFunc(root, '', '.uiIconText', function(ele) {
8477 // <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>
8478 loopChildText(ele, function(child) {
8479 loopChildText(child, function(inner) {
8480 if (inner.nodeType === TEXT_NODE) {
8481 var t = k.likeSentence(inner.textContent);
8482 t = t.replace(/\bfriends\b/g, CURRENTSTACK['friends_logic']); // Be the first of your friends.
8483 if (inner.textContent != t) {
8484 inner.textContent = t;
8485 }
8486 }
8487 });
8488 });
8489 });
8490
8491 // likebox
8492 $$(root, '.pts > .pls > div > span', function(ele) {
8493 var t = k.likeSentence(ele.textContent);
8494 if (ele.textContent != t) {
8495 ele.textContent = t;
8496 }
8497 });
8498 };
8499
8500 k.ticker = function(dom) {
8501 domReplaceFunc(dom.target, 'fbFeedTickerStory', '.fbFeedTickerStory', function(ele) {
8502 var div = ele.getElementsByClassName('uiStreamMessage');
8503 if (div.length) {
8504 div = div[0];
8505
8506 // Ticker messages are really inconsistent
8507 // <span class="passiveName">Friend</span> brohoofs <span class="token">Page</span>'s <span class="token">photo</span>.
8508 // <span class="passiveName">Friend</span> added a new pony pic.
8509 // <span class="passiveName">Friend</span> brohoofs <span class="token">Page</span>'s <span class="token">video</span> Title. // http://fb.com/10200537039965966
8510 var continueTextNodes = true;
8511 for (var i = 0, len = div.childNodes.length; i < len; i += 1) {
8512 var node = div.childNodes[i];
8513 if (node.nodeType == TEXT_NODE) {
8514 if (!continueTextNodes) {
8515 continue;
8516 }
8517
8518 var t = node.textContent;
8519
8520 var boundary = '';
8521 var haltOnBoundary = false;
8522 if (t.indexOf('"') != -1) {
8523 boundary = '"';
8524 haltOnBoundary = true;
8525 } else if (t.indexOf('\'s') != -1) {
8526 boundary = '\'s';
8527 continueTextNodes = false;
8528 }
8529
8530 if (boundary) {
8531 var finalText = k.textNotification(t.substring(0, t.indexOf(boundary)));
8532 finalText += t.substring(t.indexOf(boundary), t.length);
8533 } else {
8534 var finalText = k.textNotification(t);
8535 }
8536 //t = t.replace(/\blikes\b/, " "+CURRENTSTACK['likes_past']);
8537 //t = t.replace(/\blike\b/, " "+CURRENTSTACK['like_past']);
8538 if (node.textContent != finalText) {
8539 node.textContent = finalText;
8540 }
8541
8542 if (boundary && haltOnBoundary) {
8543 break;
8544 }
8545 } else {
8546 // It's too risky changing legit page names, so we are doing this in isolated cases
8547 if (hasClass(node, 'token')) {
8548 var list = [
8549 ['photo', 'pony pic']
8550 ,['a photo', 'a pony pic']
8551 ,['wall', 'journal']
8552 ];
8553 var t = replaceText(list, node.textContent);
8554 if (node.textContent != t) {
8555 node.textContent = t;
8556 }
8557 }
8558 }
8559 }
8560 }
8561 });
8562 if (hasClass(dom.target, 'fbFeedTickerStory')) {
8563 return true;
8564 }
8565 return false;
8566 };
8567
8568 k.beepNotification = function(dom) {
8569 warn("domNodeHandler.beepNotification() is deprecated");
8570 return false;
8571 };
8572
8573 // XYZ commented on your Wall post: "I like it"
8574 k._beepNotification_condition_classic = function(node, gt) {
8575 // <div class="UIBeep_Title"><span class="blueName">XYZ</span> likes your comment: "12"</div>
8576 // <div class="UIBeep_Title"><span class="blueName">XYZ</span> brohoofs your friendship letter: "12"</div>
8577 if (node.nodeType == 3) {
8578 return true;
8579 }
8580 return false;
8581 };
8582 k._beepNotification_condition_react = function(node, gt) {
8583 // <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>
8584 // <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>
8585
8586 // **XYZ** posted on **Ponyhoof**'s **timeline**: "XYZ"
8587 //if (hasClass(node, 'fwb')) {
8588 // return false;
8589 //}
8590 return true;
8591 };
8592
8593 k._beepNotification_change = function(ele, info, condition) {
8594 if (!info) {
8595 return;
8596 }
8597
8598 var gt = JSON.parse(ele.getAttribute('data-gt'));
8599 ele.setAttribute('data-ponyhoof-beeper-orig', info.textContent);
8600 for (var i = 0, len = info.childNodes.length; i < len; i += 1) {
8601 var node = info.childNodes[i];
8602 if (condition(node, gt)) {
8603 var text = '';
8604 if (node.nodeType == 3) {
8605 text = node.textContent;
8606 k._beepNotification_change_text(node, text);
8607 } else {
8608 // emoticons are smacked together, so we need to run another loop
8609 for (var j = 0, jLen = node.childNodes.length; j < jLen; j += 1) {
8610 var textNode = node.childNodes[j];
8611 text = textNode.textContent;
8612 k._beepNotification_change_text(textNode, text);
8613 }
8614 }
8615
8616 if (text.indexOf('"') != -1) {
8617 break;
8618 }
8619 }
8620 }
8621 ele.setAttribute('data-ponyhoof-beeper-message', info.textContent);
8622
8623 if (userSettings.sounds) {
8624 var file = '';
8625 if (SOUNDS[userSettings.soundsFile]) {
8626 file = userSettings.soundsFile;
8627 }
8628
8629 if (!file || file == 'AUTO') {
8630 file = '_sound/defaultNotification';
8631
8632 var data = convertCodeToData(REALPONY);
8633 if (data.soundNotif) {
8634 file = data.soundNotif;
8635 }
8636 }
8637
8638 if (userSettings.soundsNotifTypeBlacklist) {
8639 var current = userSettings.soundsNotifTypeBlacklist.split('|');
8640
8641 if (current.indexOf(gt.notif_type) != -1) {
8642 return;
8643 }
8644 }
8645
8646 try {
8647 var finalfile = THEMEURL+file+'.EXT';
8648 if (gt.notif_type == 'poke' && CURRENTSTACK.stack == 'pony') {
8649 finalfile = THEMEURL+'_sound/pokeSound.EXT';
8650 }
8651
8652 var ps = initPonySound('notif', finalfile);
8653 ps.wait = 15;
8654 ps.play();
8655 } catch (e) {}
8656 }
8657 };
8658
8659 k._beepNotification_change_text = function(node, text) {
8660 if (!text) {
8661 return;
8662 }
8663 if (text.indexOf('"') != -1) {
8664 var finalText = k.textNotification(text.substring(0, text.indexOf('"')));
8665 finalText += text.substring(text.indexOf('"'), text.length);
8666 } else {
8667 var finalText = k.textNotification(text);
8668 }
8669
8670 if (node.nodeType == TEXT_NODE) {
8671 if (node.textContent != finalText) {
8672 node.textContent = finalText;
8673 }
8674 } else {
8675 if (node.innerHTML != finalText) {
8676 node.innerHTML = finalText;
8677 }
8678 }
8679 };
8680
8681 k.insightsCountryData = [
8682 ["United States of America", "United States of Amareica"]
8683 ,["Malaysia", "Marelaysia"]
8684 ,["Mexico", "Mexicolt"]
8685 ,["New Zealand", "Neigh Zealand"]
8686 ,["Philippines", "Fillypines"]
8687 ,["Singapore", "Singapony"]
8688 ,["Singapore, Singapore", "Singapony"]
8689 ];
8690 k.insightsCountry = function(dom) {
8691 domReplaceFunc(dom.target, 'breakdown-list-table', '.breakdown-list-table', function(ele) {
8692 if (ele.getAttribute('data-ponyhoof-ponified')) {
8693 return;
8694 }
8695 ele.setAttribute('data-ponyhoof-ponified', 1);
8696 $$(ele, '.breakdown-key .ufb-text-content', function(country) {
8697 country.textContent = replaceText(k.insightsCountryData, country.textContent);
8698 });
8699 });
8700 };
8701
8702 k.timelineMutualLikes = function(target) {
8703 $$(target, '.fbStreamTimelineFavStory', function(root) {
8704 $$(root, '.fbStreamTimelineFavInfoContainer', function(ele) {
8705 var done = false;
8706 loopChildText(ele, function(child) {
8707 if (done) {
8708 return;
8709 }
8710 if (child.nodeType == TEXT_NODE) {
8711 var t = k.textStandard(child.textContent);
8712 if (child.textContent != t) {
8713 child.textContent = t;
8714 done = true;
8715 }
8716 }
8717 });
8718 });
8719
8720 $$(root, '.fbStreamTimelineFavFriendContainer > .friendText > .fwn', function(ele) {
8721 loopChildText(ele, function(child) {
8722 if (child.nodeType == ELEMENT_NODE) {
8723 if (!child.href || child.href.indexOf('/browse/users/') == -1) {
8724 return;
8725 }
8726 }
8727 var t = k.textStandard(child.textContent);
8728 if (child.textContent != t) {
8729 child.textContent = t;
8730 }
8731 });
8732 });
8733 });
8734 };
8735
8736 // http://fb.com/406714556116263
8737 // http://fb.com/411361928984859
8738 k.videoStageContainer = function(target) {
8739 if (hasClass(target, 'videoStageContainer')) {
8740 addClass(k.photos_snowlift, 'ponyhoof_snowlift_video');
8741 } else if (hasClass(target, 'spotlight')) {
8742 removeClass(k.photos_snowlift, 'ponyhoof_snowlift_video');
8743 }
8744 };
8745
8746 k.uiStreamShareLikePageBox = function(target) {
8747 $$(target, '.uiStreamShareLikePageBox .uiPageLikeButton.rfloat + div > .fcg', function(ele) {
8748 var t = ele.textContent;
8749 t = t.replace(/likes/g, CURRENTSTACK['likes']);
8750 t = t.replace(/like/g, CURRENTSTACK['like']);
8751 if (ele.textContent != t) {
8752 ele.textContent = t;
8753 }
8754 });
8755 };
8756
8757 k._dialog_insertReadme = function(body) {
8758 var done = false;
8759 $$(body, '._22i .uiToken > input[type="hidden"]', function(input) { // @cx
8760 if (done) {
8761 return;
8762 }
8763 if (input.getAttribute('name') == 'undefined[]' && isPonyhoofPage(input.value)) { // undefined[] is intentional from FB, NOT A BUG
8764 addClass(body, 'ponyhoof_composer_hasReadme');
8765
8766 var n = d.createElement('iframe');
8767 n.className = 'ponyhoof_page_readme';
8768 n.scrolling = 'auto';
8769 n.frameborder = '0';
8770 n.allowtransparency = 'true';
8771 n.src = PONYHOOF_README;
8772 body.appendChild(n);
8773
8774 done = true;
8775 }
8776 });
8777 };
8778
8779 k._dialog_playSound = function(title, outer) {
8780 if (!title) {
8781 return;
8782 }
8783 var lowercase = title.toLowerCase();
8784 for (var i = 0, len = dialogDerpTitles.length; i < len; i += 1) {
8785 if (dialogDerpTitles[i].toLowerCase() == lowercase) {
8786 if (outer) {
8787 addClass(outer, 'ponyhoof_fbdialog_derp');
8788 }
8789
8790 if (CURRENTSTACK.stack == 'pony' && userSettings.sounds && !isPageHidden()) {
8791 var ps = initPonySound('ijustdontknowwhatwentwrong', THEMEURL+'_sound/ijustdontknowwhatwentwrong.EXT');
8792 ps.wait = 5;
8793 ps.play();
8794 break;
8795 }
8796 }
8797 }
8798 };
8799
8800 k.ponyhoofPageOptions = function(dom) {
8801 if (!$('pagelet_timeline_page_actions')) {
8802 return;
8803 }
8804 if ($('ponyhoof_footer_options')) {
8805 return;
8806 }
8807
8808 var selector = dom.target.querySelector('#pagelet_timeline_page_actions .fbTimelineActionSelector');
8809 if (!selector) {
8810 return;
8811 }
8812 var menu = selector.getElementsByClassName('uiMenuInner');
8813 if (!menu.length) {
8814 return;
8815 }
8816 menu = menu[0];
8817 var whatpage = menu.querySelector('#fbpage_share_action a');
8818 if (!whatpage) {
8819 return;
8820 }
8821 if (whatpage.getAttribute('href').indexOf('p[]='+PONYHOOF_PAGE) != -1) {
8822 var button = selector.getElementsByClassName('fbTimelineActionSelectorButton');
8823 if (!button.length) {
8824 return;
8825 }
8826 button = button[0];
8827
8828 var sep = d.createElement('li');
8829 sep.className = 'uiMenuSeparator';
8830
8831 var a = d.createElement('a');
8832 a.className = 'itemAnchor';
8833 a.setAttribute('role', 'menuitem');
8834 a.setAttribute('tabindex', '0');
8835 a.href = '#';
8836 a.id = "ponyhoof_footer_options";
8837 a.innerHTML = '<span class="itemLabel fsm">'+CURRENTLANG.options_title+'</span>';
8838 a.addEventListener('click', function(e) {
8839 optionsOpen();
8840
8841 try {
8842 clickLink(button);
8843 } catch (ex) {}
8844
8845 e.preventDefault();
8846 }, false);
8847
8848 var li = d.createElement('li');
8849 li.className = 'uiMenuItem ponyhoof_fbmenuitem';
8850 li.setAttribute('data-label', CURRENTLANG.options_title);
8851 li.setAttribute('data-ponyhoof-menuitem-orig', CURRENTLANG.options_title);
8852 li.setAttribute('data-ponyhoof-menuitem-text', CURRENTLANG.options_title);
8853 li.appendChild(a);
8854
8855 menu.insertBefore(sep, menu.firstChild);
8856 menu.insertBefore(li, sep);
8857 }
8858 };
8859
8860 k.debug_betaFacebookBaseRewrote = false;
8861 k.debug_betaFacebookLinks = function(target) {
8862 if (!k.debug_betaFacebookBaseRewrote) {
8863 contentEval(function(arg) {
8864 try {
8865 if (typeof window.requireLazy == 'function') {
8866 window.requireLazy(['Env'], function(Env) {
8867 Env.www_base = window.location.protocol+'//'+window.location.hostname+'/';
8868 });
8869 }
8870 } catch (e) {
8871 if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
8872 console.log("Unable to hook to Env");
8873 console.dir(e);
8874 }
8875 }
8876 }, {"CANLOG":CANLOG});
8877 k.debug_betaFacebookBaseRewrote = true;
8878 }
8879 var links = target.querySelectorAll('a[href^="http://www.facebook.com"], a[href^="https://www.facebook.com"]');
8880 for (var i = 0, len = links.length; i < len; i += 1) {
8881 var link = links[i];
8882 var href = link.href;
8883 href = href.replace(/http\:\/\/www.facebook.com\//, 'http://beta.facebook.com/');
8884 href = href.replace(/https\:\/\/www.facebook.com\//, 'https://beta.facebook.com/');
8885
8886 link.href = href;
8887 }
8888 };
8889
8890 // Mutation
8891 k.mutateCharacterData = function(mutation) {
8892 var parent = null;
8893 if (mutation.target && mutation.target.parentNode) {
8894 parent = mutation.target.parentNode;
8895 if (parent.tagName.toUpperCase() == 'ABBR') {
8896 return;
8897 }
8898 }
8899
8900 if (userSettings.debug_mutationDebug) {
8901 try {
8902 console.log('characterData:');
8903 if (!ISFIREFOX) {
8904 console.dir(mutation.target);
8905 }
8906 } catch (e) {}
8907 }
8908
8909 k.textNodes({target: mutation.target});
8910
8911 if (!parent) {
8912 return;
8913 }
8914 var id = parent.getAttribute(k.REACTATTRNAME);
8915 if (id) {
8916 if (parent.rel == 'dialog') {
8917 if (parent.getAttribute('ajaxify').indexOf('/ajax/browser/dialog/likes') == 0) {
8918 k.getParent(parent, function(likesentence) {
8919 return hasClass(likesentence, 'UFILikeSentence');
8920 }, function(likesentence) {
8921 if (likesentence) {
8922 k._likePostBox(likesentence);
8923 }
8924 });
8925 }
8926 } else if (hasClass(parent.parentNode, 'UFIPagerLink')) {
8927 k.ufiPagerLink({target: parent.parentNode.parentNode});
8928 } else if (hasClass(parent, 'ponyhoof_brohoof_button')) {
8929 k._commentLikeLink(parent);
8930 } else if (parent.nextSibling && hasClass(parent.nextSibling, 'UFIOrderingModeSelectorDownCaret')) {
8931 k.UFIOrderingMode(parent);
8932 } else {
8933 if (parent.parentNode && parent.parentNode.parentNode) {
8934 //if (hasClass(parent.parentNode.parentNode, 'UFIImageBlockContent') || (parent.parentNode.parentNode.parentNode && hasClass(parent.parentNode.parentNode.parentNode, 'UFIImageBlockContent'))) {
8935 if (hasClass(parent.parentNode.parentNode, 'UFILikeSentenceText') || (parent.parentNode.parentNode.parentNode && hasClass(parent.parentNode.parentNode.parentNode, 'UFILikeSentenceText'))) {
8936 // live commenting
8937 // You and John brohoof this.
8938 // You like this.
8939 var ufi = k.getReactUfi(parent);
8940 if (ufi) {
8941 k.postLike({target: ufi});
8942 }
8943 } else {
8944 if (hasClass(parent.parentNode.parentNode, k.notification_textClass[0]) || hasClass(parent.parentNode.parentNode, k.notification_textClass[1])) {
8945 // gosh, i dislike this...
8946 k.getParent(parent, function(notificationItem) {
8947 return hasClass(notificationItem, k.notification_itemClass[0]) || hasClass(notificationItem, k.notification_itemClass[1]);
8948 }, function(notificationItem) {
8949 if (!notificationItem) {
8950 return;
8951 }
8952
8953 var i = 0;
8954 if (hasClass(notificationItem, k.notification_itemClass[1])) {
8955 i = 1;
8956 }
8957
8958 k._notification_change(notificationItem, '.'+k.notification_textClass[i]+' > span', k.notification_metadataClass[i], 'fwb');
8959 });
8960 }
8961 }
8962 }
8963 }
8964 }
8965 };
8966
8967 k.mutateAttributes = function(mutation) {
8968 //if (mutation.attributeName.indexOf('data-ponyhoof-') == 0) {
8969 // return;
8970 //}
8971 var target = mutation.target;
8972 if (mutation.attributeName == 'title') {
8973 if (target.title == target.getAttribute('data-ponyhoof-title-modified')) {
8974 return;
8975 }
8976 }
8977 switch (mutation.attributeName) {
8978 case 'title':
8979 var id = target.getAttribute(k.REACTATTRNAME);
8980 if (id) {
8981 if (hasClass(target, 'UFILikeLink')) {
8982 if (target.title == '' && mutation.oldValue != '') { // thanks a lot Hover Zoom
8983 target.setAttribute('data-ponyhoof-title', mutation.oldValue);
8984 target.setAttribute('data-ponyhoof-title-modified', mutation.oldValue);
8985 } else {
8986 var orig = target.title;
8987 var t = orig;
8988 t = t.replace(/\bcomment\b/, "friendship letter");
8989 t = t.replace(/\bLike this \b/, capitaliseFirstLetter(CURRENTSTACK.like)+' this ');
8990 t = t.replace(/\bUnlike this \b/, capitaliseFirstLetter(CURRENTSTACK.unlike)+' this ');
8991 t = t.replace(/\bunlike this \b/, CURRENTSTACK.unlike+' this ');
8992 t = t.replace(/\bliking this \b/, CURRENTSTACK.liking+' this ');
8993
8994 if (target.title != t) {
8995 target.title = t;
8996 }
8997 target.setAttribute('data-ponyhoof-title', orig);
8998 target.setAttribute('data-ponyhoof-title-modified', t);
8999 }
9000 }
9001 }
9002 break;
9003
9004 /*case 'value':
9005 if (/*(target.parentNode && hasClass(target.parentNode, 'uiButton')) || * /hasClass(target, 'ufb-button-input')) {
9006 var button = target.parentNode;
9007 if (button) {
9008 var orig = target.value;
9009 var replaced = replaceText(buttonTitles, orig);
9010 if (/*hasClass(button, 'uiButton') || * /hasClass(button, 'ufb-button')) {
9011 if (button.getAttribute('data-hover') != 'tooltip') {
9012 if (orig != replaced) {
9013 if (button.title == '') {
9014 button.title = orig;
9015 } else {
9016 if (button.title == button.getAttribute('data-ponyhoof-button-orig')) {
9017 button.title = orig;
9018 }
9019 }
9020 } else {
9021 button.title = '';
9022 }
9023 }
9024 button.setAttribute('data-ponyhoof-button-orig', orig);
9025 button.setAttribute('data-ponyhoof-button-text', replaced);
9026 }
9027 if (orig != replaced) {
9028 target.value = replaced;
9029 }
9030 }
9031 }
9032 break;*/
9033
9034 default:
9035 break;
9036 }
9037 };
9038
9039 // Utilities
9040 k.getParent = function(ele, iffunc, func) {
9041 var outer = ele.parentNode;
9042 while (outer) {
9043 if (iffunc(outer)) {
9044 break;
9045 }
9046 outer = outer.parentNode;
9047 }
9048
9049 func(outer);
9050 };
9051
9052 k.changeButtonText = function(button, t) {
9053 if (button.tagName.toUpperCase() == 'INPUT') {
9054 button.value = t;
9055 } else {
9056 button.innerHTML = t;
9057 }
9058 };
9059
9060 // Delays and let Facebook finish changing the DOM
9061 // Note that this shouldn't be a problem when MutationObserver is used full-time
9062 k.delayIU = function(func, delay) {
9063 var delay = delay || 10;
9064
9065 if (USINGMUTATION) {
9066 func();
9067 return;
9068 }
9069
9070 w.setTimeout(function() {
9071 var iu = INTERNALUPDATE;
9072 INTERNALUPDATE = true;
9073 func();
9074 INTERNALUPDATE = iu;
9075 }, delay);
9076 };
9077
9078 k.getReactUfi = function(ele) {
9079 // .reactRoot[3].[1][0].0.[1].0.0.[2]
9080 var finalid = k.getReactId(ele);
9081
9082 var ufi = d.querySelector('div['+k.REACTATTRNAME+'=".r['+finalid+']"]');
9083 if (ufi && hasClass(ufi, 'UFIList')) {
9084 return ufi;
9085 }
9086
9087 // Rollback to old method
9088 k.getParent(ele, function(ufiitem) {
9089 return hasClass(ufiitem, 'UFIList');
9090 }, function(ufiitem) {
9091 ufi = ufiitem;
9092 });
9093 return ufi;
9094 };
9095
9096 k.getReactCommentComponent = function(ele) {
9097 // .reactRoot[3].[1][2][1]{comment105273202993369_7901}.0.[1].0.[1].0.[1].[2]
9098 // .reactRoot[1].:1:1:1:comment558202387555478_1973546.:0.:1.:0.:1.:0
9099 var id = ele.getAttribute(k.REACTATTRNAME);
9100 if (!id) {
9101 return false;
9102 }
9103 var open = id.indexOf('{comment');
9104 var close = '}';
9105 var closeCount = 1;
9106 if (open == -1) {
9107 open = id.indexOf(':comment');
9108 if (open == -1) {
9109 return false;
9110 }
9111 close = '.:';
9112 closeCount = 0;
9113 }
9114 var subEnd = id.substring(open, id.length).indexOf(close);
9115 var component = id.substring(0, open+subEnd+closeCount);
9116
9117 return component;
9118 };
9119
9120 k.getReactComment = function(ele) {
9121 var component = k.getReactCommentComponent(ele);
9122
9123 var comment = d.querySelector('div['+k.REACTATTRNAME+'="'+component+'"]');
9124 if (comment && hasClass(comment, 'UFIComment')) {
9125 return comment;
9126 }
9127
9128 // Rollback to old method
9129 k.getParent(ele, function(ufiitem) {
9130 return hasClass(ufiitem, 'UFIComment');
9131 }, function(ufiitem) {
9132 comment = ufiitem;
9133 });
9134 return comment;
9135 };
9136
9137 k.getTrackingNode = function(ele) {
9138 var trackingNode = ele.getAttribute('data-ft');
9139 if (trackingNode) {
9140 try {
9141 trackingNode = JSON.parse(trackingNode);
9142 return trackingNode.tn;
9143 } catch (e) {}
9144 }
9145 return false;
9146 };
9147
9148 // Ignore irrelevant tags and some classes
9149 k.shouldIgnore = function(dom) {
9150 if (dom.target.nodeType == 8) { // comments
9151 return true;
9152 }
9153
9154 if (dom.target.nodeType != 3) {
9155 var tn = dom.target.tagName.toUpperCase();
9156 if (tn == 'SCRIPT' || tn == 'STYLE' || tn == 'LINK' || tn == 'INPUT' || tn == 'BR' || tn == 'META') {
9157 return true;
9158 }
9159 }
9160
9161 if (dom.target.parentNode && /(DOMControl_shadow|highlighterContent|textMetrics)/.test(dom.target.parentNode.className)) {
9162 return true;
9163 }
9164
9165 return false;
9166 };
9167
9168 k.dumpConsole = function(dom) {
9169 if (!userSettings.debug_dominserted_console) {
9170 return;
9171 }
9172
9173 if (dom.target.nodeType == 8) { // comments
9174 return;
9175 }
9176
9177 if (dom.target.nodeType == 3) {
9178 if (dom.target.parentNode && dom.target.parentNode.tagName.toUpperCase() != 'ABBR') {
9179 if (typeof console !== 'undefined' && console.dir) {
9180 console.dir(dom.target);
9181 }
9182 }
9183 return;
9184 }
9185
9186 var id = dom.target.getAttribute('id');
9187 if (id && (id.indexOf('bfb_') == 0 || id.indexOf('sfx_') == 0)) {
9188 return;
9189 }
9190
9191 var className = dom.target.className;
9192 if (className.indexOf('bfb_') == 0 || className.indexOf('sfx_') == 0) {
9193 return;
9194 }
9195
9196 var tagName = dom.target.tagName.toUpperCase();
9197 if (tagName != 'BODY') {
9198 if (typeof console !== 'undefined' && console.log) {
9199 console.log(dom.target.outerHTML);
9200 }
9201 }
9202 };
9203
9204 k.textBrohoof = function(ele) {
9205 var t = '';
9206 if (ele.nodeType == TEXT_NODE) {
9207 t = ele.textContent;
9208 } else {
9209 t = ele.innerHTML;
9210 }
9211 t = t.replace(/\bpeople\b/g, " "+CURRENTSTACK['people']);
9212 t = t.replace(/\bperson\b/g, " "+CURRENTSTACK['person']);
9213 t = t.replace(/likes this/g, CURRENTSTACK['likes']+" this");
9214 t = t.replace(/like this/g, CURRENTSTACK['like']+" this");
9215 t = t.replace(/Likes/g, capitaliseFirstLetter(CURRENTSTACK['likes'])); // new news feed page likes
9216 t = t.replace(/likes/g, CURRENTSTACK['likes']);
9217 t = t.replace(/like/g, CURRENTSTACK['like']);
9218 t = t.replace(/talking about this/g, "blabbering about this");
9219 t = t.replace(/\bfriends\b/g, CURRENTSTACK['friends_logic']);
9220 t = t.replace(/\bfriend\b/g, CURRENTSTACK['friend_logic']);
9221 if (ele.nodeType == TEXT_NODE) {
9222 if (ele.textContent != t) {
9223 ele.textContent = t;
9224 }
9225 } else {
9226 if (ele.innerHTML != t) {
9227 ele.innerHTML = t;
9228 }
9229 }
9230 };
9231
9232 k.textStandard = function(t) {
9233 t = t.replace(/\bpeople\b/g, " "+CURRENTSTACK['people']);
9234 t = t.replace(/\bfriends\b/g, " "+CURRENTSTACK['friends_logic']);
9235 t = t.replace(/\bfriend\b/g, " "+CURRENTSTACK['friend_logic']);
9236 t = t.replace(/\blikes\b/g, " "+CURRENTSTACK['likes_past']);
9237 t = t.replace(/\blike\b/g, " "+CURRENTSTACK['like_past']);
9238 return t;
9239 };
9240
9241 k.textNotification = function(t) {
9242 t = t.replace(/\bpeople\b/g, " "+CURRENTSTACK['people']);
9243 t = t.replace(/\(friends\b/g, "("+CURRENTSTACK['friends_logic']);
9244 t = t.replace(/\bfriends\b/g, " "+CURRENTSTACK['friends_logic']);
9245 t = t.replace(/\binvited you to like\b/g, " invited you to "+CURRENTSTACK.like);
9246 t = t.replace(/\blikes\b/g, " "+CURRENTSTACK['likes_past']);
9247 t = t.replace(/\blike\b/g, " "+CURRENTSTACK['like_past']);
9248
9249 t = t.replace(/\bcomment\b/g, "friendship letter");
9250 t = t.replace(/\bphoto\b/g, "pony pic");
9251 t = t.replace(/\bphotos\b/g, "pony pics");
9252 t = t.replace(/\bgroup\b/g, "herd");
9253 t = t.replace(/\bevent\b/g, "adventure");
9254 t = t.replace(/\btimeline\b/g, "journal");
9255 t = t.replace(/\bTimeline Review\b/g, "Journal Review");
9256 t = t.replace(/\bTimeline\b/g, "Journal"); // English UK
9257 t = t.replace(/\bnew messages\b/, "new friendship reports");
9258 t = t.replace(/\bnew message\b/, "new friendship report");
9259 t = t.replace(/\bprofile picture\b/g, "journal pony pic");
9260 t = t.replace(/\bfriend request\b/g, "friendship request");
9261 t = t.replace(/\bpoked you/g, " nuzzled you");
9262 return t;
9263 };
9264 };
9265 var _optionsLinkInjected = false;
9266 var injectOptionsLink = function() {
9267 if (_optionsLinkInjected) {
9268 return;
9269 }
9270
9271 if ($('logout_form')) {
9272 _optionsLinkInjected = true;
9273
9274 var optionsLink = d.createElement('a');
9275 optionsLink.href = '#';
9276 optionsLink.id = 'ponyhoof_account_options';
9277 optionsLink.className = 'navSubmenu submenuNav'; // submenuNav is for developers.facebook.com
9278 optionsLink.innerHTML = CURRENTLANG.options_title+" <span class='ponyhoof_hide_if_injected inline'>(Disabled)</span>";
9279 optionsLink.addEventListener('click', function(e) {
9280 optionsOpen();
9281
9282 try {
9283 clickLink($('navAccountLink'));
9284 } catch (e) {}
9285 try {
9286 clickLink($('accountNavArrow'));
9287 } catch (e) {}
9288
9289 e.preventDefault();
9290 }, false);
9291
9292 var optionsLinkLi = d.createElement('li');
9293 optionsLinkLi.setAttribute('role', 'menuitem');
9294 optionsLinkLi.appendChild(optionsLink);
9295
9296 var logout = $('logout_form');
9297 logout.parentNode.parentNode.insertBefore(optionsLinkLi, logout.parentNode);
9298 } else {
9299 var pageNav = $('pageNav');
9300 if (!pageNav) {
9301 return;
9302 }
9303
9304 var isBusiness = pageNav.querySelector('.navLink[href*="logout.php?h="]');
9305 if (!isBusiness) {
9306 return;
9307 }
9308
9309 _optionsLinkInjected = true;
9310
9311 var optionsLink = d.createElement('a');
9312 optionsLink.href = '#';
9313 optionsLink.id = 'ponyhoof_account_options';
9314 optionsLink.className = 'navLink';
9315 optionsLink.innerHTML = CURRENTLANG.options_title+" <span class='ponyhoof_hide_if_injected inline'>(Disabled)</span>";
9316 optionsLink.addEventListener('click', function(e) {
9317 optionsOpen();
9318 e.preventDefault();
9319 }, false);
9320
9321 var optionsLinkLi = d.createElement('li');
9322 optionsLinkLi.className = 'navItem middleItem';
9323 optionsLinkLi.appendChild(optionsLink);
9324
9325 pageNav.insertBefore(optionsLinkLi, pageNav.childNodes[0]);
9326 }
9327 };
9328
9329 var domNodeHandlerMain = new domNodeHandler();
9330 var mutationObserverMain = null;
9331
9332 var ranDOMNodeInserted = false;
9333 var runDOMNodeInserted = function() {
9334 if (ranDOMNodeInserted) {
9335 return false;
9336 }
9337
9338 ranDOMNodeInserted = true;
9339
9340 onPageReady(function() {
9341 if (d.body) {
9342 DOMNodeInserted({target: d.body});
9343 }
9344 });
9345
9346 if (!userSettings.debug_noMutationObserver) {
9347 try {
9348 var mutationObserver = w.WebKitMutationObserver || w.MutationObserver || false;
9349 if (mutationObserver) {
9350 var observerOptions = {attributes:true, childList:true, characterData:true, subtree:true, attributeOldValue:true, attributeFilter:['title'/*, 'class', 'value'*/]};
9351 mutationObserverMain = new mutationObserver(function(mutations) {
9352 if (INTERNALUPDATE) {
9353 return;
9354 }
9355 mutationObserverMain.disconnect();
9356
9357 for (var i = 0, len = mutations.length; i < len; i += 1) {
9358 switch (mutations[i].type) {
9359 case 'characterData':
9360 var iu = INTERNALUPDATE;
9361 INTERNALUPDATE = true;
9362
9363 domNodeHandlerMain.mutateCharacterData(mutations[i]);
9364
9365 INTERNALUPDATE = iu;
9366 break;
9367
9368 case 'childList':
9369 for (var j = 0, jlen = mutations[i].addedNodes.length; j < jlen; j += 1) {
9370 if (userSettings.debug_mutationDebug) {
9371 if (mutations[i].addedNodes[j].parentNode && mutations[i].addedNodes[j].parentNode.tagName != 'ABBR') {
9372 try {
9373 console.log('childList:');
9374 if (!ISFIREFOX) {
9375 console.dir(mutations[i].addedNodes[j]);
9376 } else {
9377 if (typeof mutations[i].addedNodes[j].className == 'undefined') {
9378 console.dir(mutations[i].addedNodes[j]);
9379 } else {
9380 //console.log(' '+mutations[i].addedNodes[j].className);
9381 //console.log(' '+mutations[i].addedNodes[j].innerHTML);
9382 }
9383 }
9384 } catch (e) {}
9385 }
9386 }
9387 DOMNodeInserted({target: mutations[i].addedNodes[j]});
9388 }
9389 break;
9390
9391 case 'attributes':
9392 var iu = INTERNALUPDATE;
9393 INTERNALUPDATE = true;
9394
9395 domNodeHandlerMain.mutateAttributes(mutations[i]);
9396
9397 INTERNALUPDATE = iu;
9398 break;
9399
9400 default:
9401 break;
9402 }
9403 }
9404 if (userSettings.debug_mutationDebug) {
9405 console.log('=========================================');
9406 }
9407 mutationObserverMain.observe(d.documentElement, observerOptions);
9408 });
9409 mutationObserverMain.observe(d.documentElement, observerOptions);
9410 USINGMUTATION = true;
9411 }
9412 } catch (e) {
9413 warn("MutationObserver threw an exception, fallback to DOMNodeInserted");
9414 dir(e);
9415 }
9416 }
9417 if (!USINGMUTATION) {
9418 d.addEventListener('DOMNodeInserted', DOMNodeInserted, true);
9419 }
9420
9421 if (d.body) {
9422 DOMNodeInserted({target: d.body});
9423 }
9424 };
9425
9426 var turnOffFbNotificationSound = function() {
9427 contentEval(function(arg) {
9428 try {
9429 if (typeof window.requireLazy == 'function') {
9430 window.requireLazy(['NotificationSound'], function(NotificationSound) {
9431 NotificationSound.prototype.play = function() {};
9432 });
9433 }
9434 } catch (e) {
9435 if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
9436 console.log("Unable to hook to NotificationSound");
9437 console.dir(e);
9438 }
9439 }
9440 }, {"CANLOG":CANLOG});
9441 };
9442
9443 var changeChatSound = function(code) {
9444 onPageReady(function() {
9445 contentEval(function(arg) {
9446 try {
9447 if (typeof window.requireLazy == 'function') {
9448 window.requireLazy(['ChatConfig'], function(ChatConfig) {
9449 ChatConfig.set('sound.notif_ogg_url', arg.THEMEURL+arg.code+'.ogg');
9450 ChatConfig.set('sound.notif_mp3_url', arg.THEMEURL+arg.code+'.mp3');
9451 });
9452 }
9453 } catch (e) {
9454 if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
9455 console.log("Unable to hook to ChatConfig");
9456 console.dir(e);
9457 }
9458 }
9459 }, {"CANLOG":CANLOG, "THEMEURL":THEMEURL, 'code':code});
9460 });
9461 };
9462
9463 var ranExtraInjection = false;
9464 var extraInjection = function() {
9465 if (ranExtraInjection) {
9466 return false;
9467 }
9468 ranExtraInjection = true;
9469
9470 for (var x in HTMLCLASS_SETTINGS) {
9471 if (userSettings[HTMLCLASS_SETTINGS[x]]) {
9472 addClass(d.documentElement, 'ponyhoof_settings_'+HTMLCLASS_SETTINGS[x]);
9473 }
9474 }
9475
9476 var globalcss = '';
9477 globalcss += 'html.ponyhoof_settings_show_messages_other #navItem_app_217974574879787 > ul {display:block !important;}';
9478 globalcss += '.ponyhoof_page_readme {width:100%;height:300px;border:solid #B4BBCD;border-width:1px 0;-moz-box-sizing:border-box;box-sizing:border-box;}';
9479 globalcss += '#fbIndex_swf {position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;}';
9480 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;}';
9481 globalcss += '.ponyhoof_image_shadow.noshadow {-moz-box-shadow:none;box-shadow:none;}';
9482
9483 injectManualStyle(globalcss, 'global');
9484
9485 if (userSettings.customcss) {
9486 injectManualStyle(userSettings.customcss, 'customcss');
9487 }
9488
9489 INTERNALUPDATE = true;
9490 for (var i = 0; i < 10; i += 1) {
9491 var n = d.createElement('div');
9492 n.id = 'ponyhoof_extra_'+i;
9493 d.body.appendChild(n);
9494 }
9495
9496 var timeShift = function() {
9497 var now = new Date();
9498
9499 d.documentElement.setAttribute('data-ponyhoof-year', now.getFullYear());
9500 d.documentElement.setAttribute('data-ponyhoof-month', now.getMonth());
9501 d.documentElement.setAttribute('data-ponyhoof-date', now.getDate());
9502 d.documentElement.setAttribute('data-ponyhoof-hour', now.getHours());
9503 d.documentElement.setAttribute('data-ponyhoof-minute', now.getMinutes());
9504 };
9505 timeShift();
9506 w.setInterval(timeShift, 60*1000);
9507
9508 if (userSettings.chatSound) {
9509 if (!SOUNDS_CHAT[userSettings.chatSoundFile] || !SOUNDS_CHAT[userSettings.chatSoundFile].name) {
9510 userSettings.chatSoundFile = '_sound/grin2';
9511 }
9512 if (typeof w.Audio != 'undefined') {
9513 changeChatSound(userSettings.chatSoundFile);
9514 }
9515 }
9516
9517 if (userSettings.customBg) {
9518 changeCustomBg(userSettings.customBg);
9519 }
9520
9521 // Turn off Facebook's own notification sound
9522 if (userSettings.sounds) {
9523 turnOffFbNotificationSound();
9524 }
9525
9526 INTERNALUPDATE = false;
9527 };
9528
9529 var detectBrokenFbStyle = function() {
9530 var test = d.createElement('div');
9531 test.className = 'hidden_elem';
9532 d.documentElement.appendChild(test);
9533
9534 var style = w.getComputedStyle(test, null);
9535 if (style && style.display != 'none') {
9536 d.documentElement.removeChild(test);
9537
9538
9539 return true;
9540 }
9541 d.documentElement.removeChild(test);
9542 return false;
9543 };
9544
9545 // Wait for the current page to complete
9546 var scriptStarted = false;
9547 function startScript() {
9548 if (scriptStarted) {
9549 return;
9550 }
9551 scriptStarted = true;
9552
9553 // Don't run on exclusions
9554 if (w.location.hostname.indexOf('.facebook.com') == w.location.hostname.length-'.facebook.com'.length) {
9555 var excludes = ['/l.php', '/ai.php', '/ajax/'];
9556 for (var i = 0, len = excludes.length; i < len; i += 1) {
9557 if (w.location.pathname.indexOf(excludes[i]) == 0) {
9558 return;
9559 }
9560 }
9561 }
9562
9563 // Don't run on ajaxpipe
9564 if (w.location.search && w.location.search.indexOf('ajaxpipe=1') != -1) {
9565 return;
9566 }
9567
9568 // Don't run on Browser Ponies
9569 if (w.location.hostname == 'hoof.little.my') {
9570 var excludes = ['.gif', '.png'];
9571 for (var i = 0, len = excludes.length; i < len; i += 1) {
9572 if (w.location.pathname.indexOf(excludes[i]) != -1) {
9573 return;
9574 }
9575 }
9576 }
9577
9578 // Don't run on Open Graph Debugger
9579 if (w.location.hostname.indexOf('developers.') != -1 && w.location.hostname.indexOf('.facebook.com') != -1 && w.location.pathname == '/tools/debug/og/echo') {
9580 return;
9581 }
9582
9583 if (w.location.hostname == '0.facebook.com') {
9584 return;
9585 }
9586
9587 if (!d.head) {
9588 d.head = d.getElementsByTagName('head')[0];
9589 }
9590
9591 // Are we running in a special Ponyhoof page?
9592 if (d.documentElement.id == 'ponyhoof_page') {
9593 // Modify the <html> tag
9594 addClass(d.documentElement, 'ponyhoof_userscript');
9595 d.documentElement.setAttribute('data-ponyhoof-userscript-version', VERSION);
9596
9597 var changeVersion = function() {
9598 var v = d.getElementsByClassName('ponyhoof_VERSION');
9599 for (var i = 0, len = v.length; i < len; i += 1) {
9600 v[i].textContent = VERSION;
9601 }
9602 };
9603 changeVersion();
9604 onPageReady(changeVersion);
9605
9606 try {
9607 if (d.documentElement.getAttribute('data-ponyhoof-update-current') > VERSION) {
9608 addClass(d.documentElement, 'ponyhoof_update_outdated');
9609 } else {
9610 addClass(d.documentElement, 'ponyhoof_update_newest');
9611 }
9612 } catch (e) {}
9613 }
9614
9615 // Determine what storage method to use
9616 STORAGEMETHOD = 'none';
9617 try {
9618 if (typeof GM_getValue === 'function' && typeof GM_setValue === 'function') {
9619 // Chrome lies about GM_getValue support
9620 GM_setValue("ponyhoof_test", "ponies");
9621 if (GM_getValue("ponyhoof_test") === "ponies") {
9622 STORAGEMETHOD = 'greasemonkey';
9623 }
9624 }
9625 } catch (e) {}
9626
9627 if (STORAGEMETHOD == 'none') {
9628 try {
9629 if (typeof chrome != 'undefined' && chrome && chrome.extension && typeof GM_getValue == 'undefined') {
9630 STORAGEMETHOD = 'chrome';
9631 }
9632 } catch (e) {}
9633 }
9634
9635 if (STORAGEMETHOD == 'none') {
9636 try {
9637 if (typeof opera != 'undefined' && opera && opera.extension) {
9638 STORAGEMETHOD = 'opera';
9639 }
9640 } catch (e) {}
9641 }
9642
9643 if (STORAGEMETHOD == 'none') {
9644 try {
9645 if (typeof safari != 'undefined') {
9646 STORAGEMETHOD = 'safari';
9647 }
9648 } catch (e) {}
9649 }
9650
9651 if (STORAGEMETHOD == 'none') {
9652 if (DISTRIBUTION == 'xpi') {
9653 STORAGEMETHOD = 'xpi';
9654 }
9655 }
9656
9657 if (STORAGEMETHOD == 'none') {
9658 if (DISTRIBUTION == 'mxaddon') {
9659 STORAGEMETHOD = 'mxaddon';
9660 }
9661 }
9662
9663 if (STORAGEMETHOD == 'none') {
9664 STORAGEMETHOD = 'localstorage';
9665 }
9666
9667 if (d.documentElement.id == 'ponyhoof_page') {
9668 addClass(d.documentElement, 'ponyhoof_distribution_'+DISTRIBUTION);
9669 addClass(d.documentElement, 'ponyhoof_storagemethod_'+STORAGEMETHOD);
9670 return;
9671 }
9672
9673 // Inject the system style so we can do any error trapping
9674 injectSystemStyle();
9675
9676 // Grab the user
9677 USERID = cookie('c_user');
9678 if (!USERID) {
9679 USERID = 0;
9680 } else {
9681 SETTINGSPREFIX = USERID+'_';
9682 }
9683
9684 loadSettings(function(s) {
9685 userSettings = s;
9686
9687 loadSettings(function(s) {
9688 globalSettings = s;
9689
9690 if (userSettings.debug_slow_load) {
9691 onPageReady(settingsLoaded);
9692 return;
9693 }
9694 settingsLoaded();
9695 }, {prefix:'global_', defaultSettings:GLOBALDEFAULTSETTINGS});
9696 });
9697 };
9698
9699 // Check for legacy settings through message passing
9700 var migrateSettingsChromeDone = false;
9701 var migrateSettingsChrome = function(callback) {
9702 if (STORAGEMETHOD == 'chrome') {
9703 if (chrome.storage) {
9704 try {
9705 chrome_sendMessage({'command':'getValue', 'name':SETTINGSPREFIX+'settings'}, function(response) {
9706 if (response && typeof response.val != 'undefined') {
9707 var _settings = JSON.parse(response.val);
9708 if (_settings) {
9709 userSettings = _settings;
9710 saveSettings();
9711
9712 chrome_sendMessage({'command':'clearStorage'}, function() {});
9713 }
9714
9715 migrateSettingsChromeDone = true;
9716 callback();
9717 }
9718 });
9719 } catch (e) {
9720 error("Failed to read previous settings through message passing");
9721 dir(e);
9722 migrateSettingsChromeDone = true;
9723 callback();
9724 }
9725 return;
9726 }
9727 }
9728 migrateSettingsChromeDone = true;
9729 callback();
9730 };
9731
9732 // Check for previous settings from unprefixed settings
9733 var migrateSettingsUnprefixedDone = false;
9734 var migrateSettingsUnprefixed = function(callback) {
9735 loadSettings(function(s) {
9736 if (s.lastVersion) { // only existed in previous versions
9737 userSettings = s;
9738 saveSettings();
9739 saveValue('settings', JSON.stringify(null));
9740 }
9741
9742 migrateSettingsUnprefixedDone = true;
9743 callback();
9744 }, {prefix:''});
9745 };
9746
9747 var globalSettingsTryLastUserDone = false;
9748 var globalSettingsTryLastUser = function(callback) {
9749 if (!globalSettings.lastUserId) {
9750 globalSettingsTryLastUserDone = true;
9751 callback();
9752 return;
9753 }
9754
9755 SETTINGSPREFIX = globalSettings.lastUserId+'_';
9756 loadSettings(function(s) {
9757 if (s) {
9758 userSettings = s;
9759 }
9760
9761 globalSettingsTryLastUserDone = true;
9762 callback();
9763 });
9764 };
9765
9766 function settingsLoaded() {
9767 if (!userSettings.theme && !migrateSettingsChromeDone) {
9768 migrateSettingsChrome(settingsLoaded);
9769 return;
9770 }
9771
9772 // Migrate for multi-user
9773 if (!userSettings.theme && !migrateSettingsUnprefixedDone) {
9774 migrateSettingsUnprefixed(settingsLoaded);
9775 return;
9776 }
9777
9778 if (!globalSettings.globalSettingsMigrated) {
9779 if (!userSettings.lastVersion) {
9780 // New user
9781 statTrack('install');
9782 }
9783
9784 for (var i in GLOBALDEFAULTSETTINGS) {
9785 if (userSettings.hasOwnProperty(i)) {
9786 globalSettings[i] = userSettings[i];
9787 }
9788 }
9789 globalSettings.globalSettingsMigrated = true;
9790 saveGlobalSettings();
9791 }
9792
9793 if (!USERID && !globalSettingsTryLastUserDone) {
9794 // Try loading the last user
9795 globalSettingsTryLastUser(settingsLoaded);
9796 return;
9797 }
9798
9799 // If we haven't set up Ponyhoof, don't log
9800 if (!userSettings.theme || userSettings.debug_disablelog) {
9801 CANLOG = false;
9802 }
9803
9804 // Run ONLY on #facebook
9805 if (!(d.documentElement.id == 'facebook' && w.location.hostname.indexOf('.facebook.com') == w.location.hostname.length-'.facebook.com'.length) && d.documentElement.id != 'ponyhoof_page') {
9806 info("Ponyhoof does not run on "+w.location.href+" (html id is not #facebook)");
9807 return;
9808 }
9809
9810 // Did we already run our script?
9811 if (hasClass(d.documentElement, 'ponyhoof_userscript')) {
9812 info("Style already injected at "+w.location.href);
9813 return;
9814 }
9815
9816 // Don't run in frames
9817 var forceWhiteBackground = false;
9818 try {
9819 var href = w.location.href.toLowerCase();
9820
9821 if ((href.indexOf('/plugins/like.php') != -1 || href.indexOf('/plugins/likebox.php') != -1 || href.indexOf('/plugins/subscribe.php') || href.indexOf('/plugins/facepile.php') != -1) && (href.indexOf('login/plugin_roadblock.php') == -1 && (href.indexOf('#ponyhoof_runme') != -1 || href.indexOf('&ponyhoof_runme') != -1))) {
9822 // Allow like boxes for the Ponyhoof page (yeah, a bit cheating)
9823 } else if (hasClass(d.body, 'chrmxt')) {
9824 // Allow for Facebook Notifications for Chrome
9825 } else {
9826 // Allow for some frames
9827 var allowedFrames = ['/ads/manage/powereditor/funding', '/ads/manage/powereditor/convtrack', '/mobile/iframe_emails.php'];
9828 var allowedFramesOk = false;
9829 for (var i = 0, len = allowedFrames.length; i < len; i += 1) {
9830 if (w.location.pathname.indexOf(allowedFrames[i]) == 0) {
9831 allowedFramesOk = true;
9832 forceWhiteBackground = true;
9833 }
9834 }
9835
9836 if (!allowedFramesOk) {
9837 if (USW.self != USW.top) {
9838 throw 1;
9839 }
9840 }
9841 }
9842 } catch (e) {
9843 info("Framed");
9844 return;
9845 }
9846
9847 // Special instructions for browsers that needs localStorage
9848 runMe = true;
9849 if (STORAGEMETHOD == 'localstorage') {
9850 // Don't run on non-www :(
9851 if (userSettings.force_run) {
9852 log("Force running on "+w.location.href);
9853 } else {
9854 if (w.location.hostname != 'www.facebook.com') {
9855 info("w.location.hostname = "+w.location.hostname);
9856 runMe = false;
9857 }
9858 }
9859 }
9860
9861 if (!runMe) {
9862 info("Ponyhoof style is not injected on "+w.location.href);
9863 //return;
9864 }
9865
9866 CURRENTPONY = userSettings.theme;
9867
9868 if (!USERID && !globalSettings.allowLoginScreen) {
9869 info("Ponyhoof will not run when logged out because of a setting.");
9870 return;
9871 }
9872
9873 // Ban parasprites
9874 // 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
9875 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) {
9876 if (globalSettings.allowLoginScreen) {
9877 globalSettings.allowLoginScreen = false;
9878 saveGlobalSettings();
9879 }
9880 return;
9881 }
9882
9883 // If we don't have an old setting...
9884 if (userSettings.theme == null) {
9885 // ... and not logged in, DON'T show the welcome screen
9886 if (!USERID) {
9887 // Special exception at home page, we want that cool login background
9888 if (!hasClass(d.body, 'fbIndex')) {
9889 info("Ponyhoof does not run for logged out users.");
9890 return;
9891 }
9892 }
9893
9894 // Don't run on dialogs
9895 if (w.location.pathname.indexOf('/dialog/') == 0) {
9896 info("Ponyhoof does not run when there is no theme selected and running on dialogs.");
9897 return;
9898 }
9899 }
9900
9901 // v1.581: Detect broken Facebook styles and abort if derped
9902 if (userSettings.theme && detectBrokenFbStyle()) {
9903 error("Broken Facebook style: hidden_elem is not expected");
9904 return;
9905 }
9906
9907 // Modify the <html> tag
9908 addClass(d.documentElement, 'ponyhoof_userscript');
9909 addClass(d.documentElement, 'ponyhoof_storagemethod_'+STORAGEMETHOD);
9910 addClass(d.documentElement, 'ponyhoof_distribution_'+DISTRIBUTION);
9911 d.documentElement.setAttribute('data-ponyhoof-userscript-version', VERSION);
9912
9913 // CANLOG previously could be disabled before
9914 if (!userSettings.debug_disablelog) {
9915 CANLOG = true;
9916 }
9917
9918 // Load the language for the options link
9919 CURRENTLANG = LANG['en_US'];
9920 if (!userSettings.forceEnglish) {
9921 UILANG = getDefaultUiLang();
9922 if (!UILANG) {
9923 UILANG = 'en_US';
9924 } else {
9925 for (var i in LANG[UILANG]) {
9926 CURRENTLANG[i] = LANG[UILANG][i];
9927 }
9928 }
9929 }
9930
9931 // Inject Ponyhoof Options in the Account dropdown even when DOMNodeInserted is disabled
9932 onPageReady(function() {
9933 injectOptionsLink();
9934 domNodeHandlerMain.ponyhoofPageOptions({target: d.body});
9935 });
9936
9937 if (!runMe) {
9938 return;
9939 }
9940
9941 var luckyGuess = -1;
9942 if (!CURRENTPONY && globalSettings.runForNewUsers) {
9943 // If we have a "special" name, load the peferred theme for that character if we're in one
9944 try {
9945 getBronyName();
9946 for (var i = 0, len = PONIES.length; i < len; i += 1) {
9947 if (PONIES[i].users) {
9948 var lowercase = BRONYNAME.toLowerCase();
9949 for (var j = 0, jlen = PONIES[i].users.length; j < jlen; j += 1) {
9950 if (lowercase.indexOf(PONIES[i].users[j]) != -1) {
9951 // We got a match!
9952 CURRENTPONY = PONIES[i].code;
9953 luckyGuess = i;
9954 }
9955 }
9956 }
9957 }
9958 } catch (e) {
9959 error("Failed to get brony name");
9960 }
9961 }
9962
9963 // If we still don't have one, then assume none
9964 if (!CURRENTPONY) {
9965 CURRENTPONY = 'NONE';
9966 }
9967
9968 if ($('jewelFansTitle')) {
9969 ISUSINGPAGE = true;
9970 addClass(d.documentElement, 'ponyhoof_isusingpage');
9971 }
9972
9973 if (d.querySelector('#pageLogo > a[href*="/business/dashboard/"]')) {
9974 ISUSINGBUSINESS = true;
9975 addClass(d.documentElement, 'ponyhoof_isusingbusiness');
9976 }
9977
9978 // v1.401: Turn on new chat sound by default
9979 if (!userSettings.chatSound1401 && !userSettings.chatSound) {
9980 userSettings.chatSound = true;
9981 userSettings.chatSound1401 = true;
9982 saveSettings();
9983 }
9984
9985 // v1.501: Migrate previous randomSetting
9986 if (userSettings.randomSetting && !userSettings.randomSettingMigrated) {
9987 if (userSettings.randomSetting == 'mane6') {
9988 userSettings.randomPonies = 'twilight|dash|pinkie|applej|flutter|rarity';
9989 }
9990 userSettings.randomSettingMigrated = true;
9991 saveSettings();
9992 }
9993
9994 // v1.571
9995 userSettings.soundsVolume = Math.max(0, Math.min(parseFloat(userSettings.soundsVolume), 1));
9996
9997 // v1.601
9998 if (globalSettings.lastVersion < 1.6) {
9999 if (userSettings.customcss || userSettings.debug_dominserted_console || userSettings.debug_slow_load || userSettings.debug_disablelog || userSettings.debug_noMutationObserver || userSettings.debug_mutationDebug) {
10000 userSettings.debug_exposed = true;
10001 saveSettings();
10002 }
10003 }
10004
10005 // v1.511: Track updates
10006 if (userSettings.theme && globalSettings.lastVersion < VERSION) {
10007 statTrack('updated');
10008 globalSettings.lastVersion = VERSION;
10009 saveGlobalSettings();
10010 }
10011
10012 if (forceWhiteBackground || hasClass(d.body, 'plugin') || hasClass(d.body, 'transparent_widget') || hasClass(d.body, '_1_vn')) {
10013 ONPLUGINPAGE = true;
10014 addClass(d.documentElement, 'ponyhoof_fbplugin');
10015 changeThemeSmart(CURRENTPONY);
10016 } else {
10017 // Are we on homepage?
10018 if (hasClass(d.body, 'fbIndex') && globalSettings.allowLoginScreen) {
10019 // Activate screen saver
10020 screenSaverActivate();
10021
10022 $$(d.body, '#blueBar .loggedout_menubar > .rfloat, ._50dz > .ptl[style*="#3B5998"] .rfloat > #login_form, ._50dz > div[style*="#3B5998"] td > div[style*="float"] #login_form', function() {
10023 addClass(d.documentElement, 'ponyhoof_fbIndex_topRightLogin');
10024 });
10025 }
10026
10027 // No theme?
10028 if (userSettings.theme == null) {
10029 // No theme AND logged out
10030 if (!USERID) {
10031 changeTheme('login');
10032 log("Homepage is default to login.");
10033 extraInjection();
10034 if (!userSettings.disableDomNodeInserted) {
10035 runDOMNodeInserted();
10036 }
10037 return;
10038 }
10039
10040 if (globalSettings.runForNewUsers) {
10041 if (luckyGuess == -1) {
10042 CURRENTPONY = getRandomMane6();
10043 }
10044
10045 var welcome = new WelcomeUI({feature: luckyGuess});
10046 welcome.start();
10047 }
10048 } else {
10049 if (hasClass(d.body, 'fbIndex')) {
10050 if (CURRENTPONY == 'RANDOM' && !userSettings.randomPonies) {
10051 log("On login page and theme is RANDOM, choosing 'login'");
10052 changeThemeSmart('login');
10053 } else {
10054 changeThemeSmart(CURRENTPONY);
10055 }
10056
10057 if (canPlayFlash()) {
10058 var dat = convertCodeToData(REALPONY);
10059 if (dat.fbIndex_swf && !userSettings.disable_animation) {
10060 addClass(d.documentElement, 'ponyhoof_fbIndex_hasswf');
10061
10062 var swf = d.createElement('div');
10063 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>';
10064 d.body.appendChild(swf);
10065 }
10066 }
10067 } else {
10068 changeThemeSmart(CURRENTPONY);
10069 }
10070 }
10071 }
10072
10073 if (CURRENTPONY != 'NONE' && !userSettings.disableDomNodeInserted) {
10074 runDOMNodeInserted();
10075 }
10076
10077 if (CURRENTPONY != 'NONE') {
10078 extraInjection();
10079 }
10080
10081 // Record the last user to figure out what theme to load at login screen
10082 // This is low priority, if all else fails, we would just load the default Equestria 'login' anyway
10083 if (CURRENTPONY != 'NONE' && USERID && globalSettings.lastUserId != USERID) {
10084 globalSettings.lastUserId = USERID;
10085 saveGlobalSettings();
10086 }
10087 }
10088
10089 onPageReady(startScript);
10090 d.addEventListener('DOMContentLoaded', startScript, true);
10091
10092 var _loop = function() {
10093 if (d.body) {
10094 startScript();
10095 return;
10096 } else {
10097 w.setTimeout(_loop, 100);
10098 }
10099 };
10100 _loop();
10101 })();
10102
10103 /* ALL YOUR PONIES ARE BELONG TO US */
10104 /*eof*/