3 // @namespace http://www.facebook.com/ponyhoof
4 // @run-at document-start
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
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/*
43 /*******************************************************************************
44 * Please visit http://jointheherd.lttle.my for the official install!
45 *******************************************************************************/
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.");
54 if (window
.location
.hostname
.indexOf('facebook.com') == -1 && window
.location
.hostname
.indexOf('little.my') == -1) {
61 * @author ngyikp (http://www.facebook.com/ngyikp)
63 var d
= document
, w
= window
;
67 var SIG
= '[Hoof Framework]';
68 var FRIENDLYNAME
= 'Hoof Framework';
71 var userSettings
= {};
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
);
81 // R.I.P. unsafeWindow in Chrome 27+ http://crbug.com/222652
82 if (typeof unsafeWindow
== 'undefined') {
85 var USW
= unsafeWindow
;
90 if (typeof console
!== 'undefined' && console
.log
) {
91 console
.log(SIG
+ ' ' + msg
);
98 if (typeof console
!== 'undefined' && console
.dir
) {
99 console
.dir(SIG
+ ' ' + msg
);
104 function debug(msg
) {
106 if (typeof console
!== 'undefined') {
108 console
.debug(SIG
+ ' ' + msg
);
109 } else if (console
.log
) {
110 console
.log(SIG
+ ' ' + msg
);
118 if (typeof console
!== 'undefined') {
120 console
.info(SIG
+ ' ' + msg
);
121 } else if (console
.log
) {
122 console
.log(SIG
+ ' ' + msg
);
130 if (typeof console
!== 'undefined') {
132 console
.warn(SIG
+ ' ' + msg
);
133 } else if (console
.log
) {
134 console
.log(SIG
+ ' ' + msg
);
140 function error(msg
) {
142 if (typeof console
!== 'undefined') {
144 console
.error(SIG
+ ' ' + msg
);
145 } else if (console
.log
) {
146 console
.log(SIG
+ ' ' + msg
);
154 if (typeof console
!== 'undefined' && console
.trace
) {
161 return d
.getElementById(id
);
164 function randNum(min
, max
) {
165 return min
+ Math
.floor(Math
.random() * (max
- min
+ 1));
168 function hasClass(ele
, c
) {
173 return ele
.classList
.contains(c
);
176 var regex
= new RegExp("(^|\\s)"+c
+"(\\s|$)");
177 if (ele
.className
) { // element node
178 return (ele
.className
&& regex
.test(ele
.className
));
180 return (ele
&& regex
.test(ele
));
184 function addClass(ele
, c
) {
186 ele
.classList
.add(c
);
187 } else if (!hasClass(ele
, c
)) {
188 ele
.className
+= ' '+c
;
192 function removeClass(ele
, c
) {
194 ele
.classList
.remove(c
);
196 ele
.className
= ele
.className
.replace(new RegExp('(^|\\s)'+c
+'(?:\\s|$)','g'),'$1').replace(/\s+/g,' ').replace(/^\s*|\s*$/g,'');
200 function toggleClass(ele
, c
) {
201 if (hasClass(ele
, c
)) {
204 ele
.className
+= ' ' + c
;
208 function clickLink(el
) {
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
);
225 return unescape(d
.cookie
.match('(^|;)?'+n
+'=([^;]*)(;|$)')[2]);
231 function injectManualStyle(css
, id
) {
232 if ($('ponyhoof_style_'+id
)) {
233 return $('ponyhoof_style_'+id
);
236 var n
= d
.createElement('style');
239 n
.id
= 'ponyhoof_style_'+id
;
241 n
.textContent
= '/* '+SIG
+' */'+css
;
244 d
.head
.appendChild(n
);
246 d
.body
.appendChild(n
);
248 d
.documentElement
.appendChild(n
);
254 function fadeOut(ele
, callback
) {
255 addClass(ele
, 'ponyhoof_fadeout');
257 w
.setTimeout(function() {
258 ele
.style
.display
= 'none';
266 function getFbDomain() {
267 if (w
.location
.hostname
== 'beta.facebook.com') {
268 return w
.location
.hostname
;
270 return 'www.facebook.com';
273 function onPageReady(callback
) {
274 var _loop = function() {
275 if (/loaded|complete/.test(d
.readyState
)) {
278 w
.setTimeout(_loop
, 100);
284 var loopClassName = function(name
, func
) {
285 var l
= d
.getElementsByClassName(name
);
287 for (var i
= 0, len
= l
.length
; i
< len
; i
++) {
293 function $$(parent
, query
, func
) {
297 var l
= parent
.querySelectorAll(query
);
299 for (var i
= 0, len
= l
.length
; i
< len
; i
++) {
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
;
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);
317 if (ua
.indexOf('Version') != -1) {
318 offset
= ua
.indexOf('Version');
319 fullVersion
= ua
.substring(offset
+ 8);
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);
337 if (ua
.indexOf('Version') != -1) {
338 offset
= ua
.indexOf('Version');
339 fullVersion
= ua
.substring(offset
+ 8);
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);
346 throw "Unsupported browser";
349 if ((ix
= fullVersion
.indexOf(';')) != -1) {
350 fullVersion
= fullVersion
.substring(0, ix
);
352 if ((ix
= fullVersion
.indexOf(' ')) != -1) {
353 fullVersion
= fullVersion
.substring(0, ix
);
356 majorVersion
= parseInt(''+fullVersion
,10);
357 if (isNaN(majorVersion
)) {
358 fullVersion
= ''+parseFloat(w
.navigator
.appVersion
);
359 majorVersion
= parseInt(w
.navigator
.appVersion
,10);
368 // http://wiki.greasespot.net/Content_Script_Injection
369 var contentEval = function(source
, arg
) {
371 if (typeof source
=== 'function') {
372 source
= '(' + source
+ ')(' + JSON
.stringify(arg
) + ');'
375 var script
= d
.createElement('script');
376 script
.textContent
= source
;
377 d
.documentElement
.appendChild(script
);
378 d
.documentElement
.removeChild(script
);
381 var supportsRange = function() {
382 var i
= d
.createElement('input');
383 i
.setAttribute('type', 'range');
384 return i
.type
!== 'text';
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
);
394 var Menu = function(id
, p
) {
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
404 k
.wrap
= null; // ponyhoof_menu_wrap, used to separate button and menu
406 k
.menuSearch
= null; // .ponyhoof_menu_search
407 k
.menuSearchInput
= null;
408 k
.menuSearchNoResults
= null;
409 k
.focusStealer
= null;
411 k
.hasScrollableArea
= false;
412 k
.scrollableAreaDiv
= null; // .uiScrollableArea
413 k
.scrollableArea
= null; // FB ScrollableArea class
416 k
.afterClose = function() {};
419 k
.alwaysOverflow
= false;
420 k
.rightFaced
= false;
421 k
.buttonTextClipped
= 0;
423 k
.createButton = function(startText
) {
428 var buttonText
= d
.createElement('span');
429 buttonText
.className
= 'uiButtonText';
430 buttonText
.innerHTML
= startText
;
432 k
.button
= d
.createElement('a');
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';
441 k
.button
.appendChild(buttonText
);
443 k
.wrap
= d
.createElement('div');
444 k
.wrap
.className
= 'ponyhoof_menu_wrap';
446 k
.wrap
.className
+= ' uiSelectorRight';
448 k
.wrap
.appendChild(k
.button
);
449 k
.p
.appendChild(k
.wrap
);
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];
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
) {
472 k
.wrap
.appendChild(k
.menu
);
474 k
.selectorMenu
= d
.createElement('div');
475 k
.selectorMenu
.className
= 'uiMenu uiSelectorMenu';
476 k
.menu
.appendChild(k
.selectorMenu
);
478 k
.menuInner
= d
.createElement('div');
479 k
.menuInner
.className
= 'uiMenuInner';
480 k
.selectorMenu
.appendChild(k
.menuInner
);
482 k
.content
= d
.createElement('div');
483 k
.content
.className
= 'uiScrollableAreaContent';
484 k
.menuInner
.appendChild(k
.content
);
487 k
.menuSearch
= d
.createElement('div');
488 k
.menuSearch
.className
= 'ponyhoof_menu_search';
489 k
.content
.appendChild(k
.menuSearch
);
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
);
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
);
502 k
.menuSearchInput
.addEventListener('keydown', k
.searchEscapeKey
, false);
503 k
.menuSearchInput
.addEventListener('input', k
.performSearch
, false);
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
);
518 k
.attachButton = function() {
519 k
.button
.addEventListener('click', function(e
) {
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
);
531 if (k
.buttonTextClipped
) {
532 k
.button
.title
= text
;
536 k
.createSeperator = function() {
537 var sep
= d
.createElement('div');
538 sep
.className
= 'uiMenuSeparator';
539 k
.content
.appendChild(sep
);
542 k
.createMenuItem = function(param
) {
543 var menuItem
= new MenuItem(k
);
544 menuItem
._create(param
);
546 k
.content
.appendChild(menuItem
.menuItem
);
551 k
.injectStyle = function() {
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;}';
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;}';
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;}';
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;}';
584 css
+= '.ponyhoof_button_clipped .uiButtonText {text-overflow:ellipsis;overflow:hidden;}';
586 injectManualStyle(css
, 'menu');
589 k
.open = function() {
592 addClass(k
.wrap
, 'openToggler');
594 if (!hasClass(k
.menuInner
.parentNode
, 'overflow') && (k
.menuInner
.parentNode
.offsetHeight
>= 224 || k
.alwaysOverflow
)) {
595 addClass(k
.menuInner
.parentNode
, 'overflow');
599 var scrollTop
= k
.selectorMenu
.scrollTop
;
600 k
.menuSearchInput
.focus();
601 k
.menuSearchInput
.select();
603 k
.selectorMenu
.scrollTop
= scrollTop
;
606 d
.body
.addEventListener('keydown', k
.documentEscapeKey
, false);
607 d
.body
.addEventListener('click', k
.documentClick
, false);
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);
620 k
.closeAllMenus = function() {
621 for (var menu
in MENUS
) {
622 if (MENUS
.hasOwnProperty(menu
)) {
628 k
.toggle = function() {
629 if (hasClass(k
.wrap
, 'openToggler')) {
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');
641 addClass(menuItem
.menuItem
, 'ponyhoof_menuitem_checked');
644 k
.performSearch = function() {
645 var val
= k
.menuSearchInput
.value
;
646 var regex
= new RegExp(val
, 'i');
649 $$(k
.menu
, '.ponyhoof_menuitem', function(menuitem
) {
651 menuitem
.style
.display
= '';
655 if (!hasClass(menuitem
, 'unsearchable')) {
656 menuitem
.style
.display
= 'none';
658 var compare
= menuitem
.textContent
;
659 if (menuitem
.getAttribute('data-ponyhoof-menu-searchAlternate')) {
660 compare
= menuitem
.getAttribute('data-ponyhoof-menu-searchAlternate');
663 if (regex
.test(compare
)) {
664 menuitem
.style
.display
= 'block';
668 menuitem
.style
.display
= 'none';
672 $$(k
.menu
, '.ponyhoof_menu_search_noResults', function(ele
) {
675 ele
.style
.display
= 'block';
677 ele
.style
.display
= 'none';
680 ele
.style
.display
= 'none';
684 $$(k
.menu
, '.uiMenuSeparator', function(menuitem
) {
686 menuitem
.style
.display
= '';
690 menuitem
.style
.display
= 'none';
693 if (k
.hasScrollableArea
) {
694 k
.scrollableArea
.poke();
698 k
.searchEscapeKey = function(e
) {
700 if (k
.menuSearchInput
.value
!= '') {
701 k
.menuSearchInput
.value
= '';
710 e
.cancelBubble
= true;
714 k
.documentEscapeKey = function(e
) {
715 if (e
.which
== 27 && hasClass(k
.wrap
, 'openToggler')) { // esc
718 e
.cancelBubble
= true;
726 k
.documentClick = function(e
) {
732 k
.focusStealerFocused = function(e
) {
734 k
.menuSearchInput
.focus();
739 var MenuItem = function(menu
) {
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');
753 k
.menuItem
.className
+= ' ponyhoof_menuitem_checked';
757 k
.menuItem
.setAttribute('data-ponyhoof-menu-data', param
.data
);
761 k
.menuItem
.setAttribute('aria-label', param
.title
);
762 k
.menuItem
.setAttribute('data-hover', 'tooltip');
765 if (param
.unsearchable
) {
766 k
.menuItem
.className
+= ' unsearchable';
769 if (param
.searchAlternate
) {
770 k
.menuItem
.setAttribute('data-ponyhoof-menu-searchAlternate', param
.searchAlternate
);
773 if (param
.extraClass
) {
774 k
.menuItem
.className
+= param
.extraClass
;
777 k
.menuItem
.innerHTML
= '<span class="ponyhoof_menuitem_span">'+param
.html
+'</span>';
780 k
.onclick
= param
.onclick
;
782 k
.menuItem
.addEventListener('click', function(e
) {
785 k
.onclick(k
, k
.menu
);
790 k
.menuItem
.addEventListener('dragstart', function() {
797 k
.getText = function() {
798 return k
.menuItem
.getElementsByClassName('ponyhoof_menuitem_span')[0].innerHTML
;
804 var DIALOGCOUNT
= 400;
805 var Dialog = function(id
) {
809 k
.generic_dialogDiv
= null;
810 k
.popup_dialogDiv
= null;
814 k
.alwaysModal
= false;
818 k
.canCardspace
= true;
819 k
.cardSpaceTimer
= null;
820 k
.cardspaced
= false;
822 k
.onclose = function() {};
823 k
.onclosefinish = function() {};
824 k
.canCloseByEscapeKey
= true;
828 k
.create = function() {
829 //if (DIALOGS[k.id]) {
830 // log("Attempting to recreate dialog ID \""+k.id+"\"");
831 // return DIALOGS[k.id].dialog;
836 log("Creating "+k
.id
+" dialog...");
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>';
856 INTERNALUPDATE
= true;
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
);
864 INTERNALUPDATE
= false;
866 k
.generic_dialogDiv
= k
.dialog
.getElementsByClassName('pop_dialog')[0];
867 k
.popup_dialogDiv
= k
.dialog
.getElementsByClassName('popup')[0];
870 addClass(k
.generic_dialogDiv
, 'generic_dialog_modal');
873 addClass(k
.dialog
.getElementsByTagName('h3')[0], 'hidden_elem');
876 addClass(k
.dialog
.getElementsByClassName('bottom')[0], 'hidden_elem');
884 k
.injectStyle = function() {
886 if (d
.getElementsByClassName('-cx-PUBLIC-hasLitestand__body').length
) {
887 cx
= '.-cx-PUBLIC-hasLitestand__body';
891 css
+= '.ponyhoof_message .wrap {margin-top:3px;background:transparent !important;display:block;}';
892 css
+= '.ponyhoof_message .uiButton.rfloat {margin-left:10px;}';
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;}';
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;}';
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;}';
928 injectManualStyle(css
, 'dialog');
931 k
.show = function() {
932 removeClass(k
.dialog
, 'ponyhoof_fadeout');
933 removeClass(k
.generic_dialogDiv
, 'ponyhoof_fadeout');
936 k
.dialog
.style
.display
= 'block';
937 k
.generic_dialogDiv
.style
.display
= 'block';
940 k
.canCardspace
= false;
943 if (k
.canCardspace
) {
944 w
.addEventListener('resize', k
.onBodyResize
, false);
948 if (k
.canCloseByEscapeKey
) {
949 d
.body
.addEventListener('keydown', k
.documentEscapeKey
, false);
953 k
.close = function(callback
) {
956 if (!userSettings
.disable_animation
) {
957 fadeOut(k
.dialog
, function() {
964 log("Legacy dialog close code found");
968 fadeOut(k
.generic_dialogDiv
);
971 k
.dialog
.style
.display
= 'none';
981 k
.hide = function() {
984 k
.dialog
.style
.display
= 'none';
989 k
._close = function() {
992 w
.removeEventListener('resize', k
.onBodyResize
, false);
993 w
.clearTimeout(k
.cardSpaceTimer
);
996 removeClass(d
.documentElement
, 'generic_dialog_overflow_mode');
997 if (!k
.alwaysModal
) {
998 removeClass(k
.generic_dialogDiv
, 'generic_dialog_modal');
1001 removeClass(k
.generic_dialogDiv
, 'generic_dialog_fixed_overflow');
1002 k
.cardspaced
= false;
1004 d
.body
.removeEventListener('keydown', k
.documentEscapeKey
, false);
1007 k
.changeTitle = function(c
) {
1008 INTERNALUPDATE
= true;
1009 var title
= k
.dialog
.getElementsByTagName('h3');
1012 title
.innerHTML
= c
;
1014 INTERNALUPDATE
= false;
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
;
1024 INTERNALUPDATE
= false;
1027 k
.changeBottom = function(c
) {
1028 INTERNALUPDATE
= true;
1029 var bottom
= k
.dialog
.getElementsByClassName('bottom');
1030 if (bottom
.length
) {
1032 bottom
.innerHTML
= c
;
1034 INTERNALUPDATE
= false;
1037 k
.addCloseButton = function(callback
) {
1039 if (CURRENTLANG
&& CURRENTLANG
.close
) {
1040 text
= CURRENTLANG
.close
;
1043 var close
= '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm" role="button"><span class="uiButtonText">'+text
+'</span></a>';
1044 k
.changeBottom(close
);
1046 k
.dialog
.querySelector('.bottom .uiButton').addEventListener('click', function(e
) {
1047 k
.close(function() {
1049 log("Legacy dialog close code found");
1057 k
.onBodyResize = function() {
1058 if (k
.canCardspace
) {
1059 var dialogHeight
= k
.popup_dialogDiv
.clientHeight
+ 80 + 40;
1060 var windowHeight
= w
.innerHeight
;
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');
1068 addClass(k
.generic_dialogDiv
, 'generic_dialog_fixed_overflow');
1070 k
.cardspaced
= true;
1074 removeClass(d
.documentElement
, 'generic_dialog_overflow_mode');
1075 if (!k
.alwaysModal
) {
1076 removeClass(k
.generic_dialogDiv
, 'generic_dialog_modal');
1078 removeClass(k
.generic_dialogDiv
, 'generic_dialog_fixed_overflow');
1080 k
.cardspaced
= false;
1086 k
.cardSpaceTick = function() {
1087 if (k
.canCardspace
&& k
.visible
) {
1089 k
.cardSpaceTimer
= w
.setTimeout(k
.cardSpaceTick
, 500);
1091 w
.clearTimeout(k
.cardSpaceTimer
);
1095 k
.documentEscapeKey = function(e
) {
1096 if (k
.canCloseByEscapeKey
) {
1097 if (e
.which
== 27 && k
.visible
) { // esc
1099 e
.stopPropagation();
1100 e
.cancelBubble
= true;
1105 if (DIALOGS
[k
.id
]) {
1106 log("Attempting to recreate dialog ID \""+k
.id
+"\"");
1107 return DIALOGS
[k
.id
];
1112 function createSimpleDialog(id
, title
, message
) {
1118 var di
= new Dialog(id
);
1120 di
.changeTitle(title
);
1121 di
.changeContent(message
);
1122 di
.addCloseButton();
1127 function injectSystemStyle() {
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;}';
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;}';
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;}';
1144 css
+= '.uiHelpLink {background:url("data:image/gif;base64,R0lGODlhDAALAJEAANvb26enp////wAAACH5BAEAAAIALAAAAAAMAAsAAAIblI8WkbcswAtAwWVzwoIbSWliBzWjR5abagoFADs=") no-repeat 0 center;display:inline-block;height:9px;width:12px;}';
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;}';
1152 injectManualStyle(css
, 'system');
1155 // http://www.html5rocks.com/en/tutorials/pagevisibility/intro/
1156 var _hiddenPropCached
= '';
1157 var getHiddenProp = function() {
1158 if (_hiddenPropCached
) {
1159 return _hiddenPropCached
;
1162 var prefixes
= ['webkit', 'moz', 'ms', 'o'];
1164 if ('hidden' in document
) {
1165 _hiddenPropCached
= 'hidden';
1166 return _hiddenPropCached
;
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
;
1178 var isPageHidden = function() {
1179 var prop
= getHiddenProp();
1184 return document
[prop
];
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';
1194 var STORAGEMETHOD
= 'none';
1195 var INTERNALUPDATE
= false;
1196 var USINGMUTATION
= false;
1198 var CURRENTPONY
= null;
1199 var REALPONY
= CURRENTPONY
;
1202 var UILANG
= 'en_US';
1203 var CURRENTLANG
= {};
1204 var ISUSINGPAGE
= false;
1205 var ISUSINGBUSINESS
= false;
1206 var ONPLUGINPAGE
= false;
1208 var SETTINGSPREFIX
= '';
1209 var globalSettings
= {};
1210 var GLOBALDEFAULTSETTINGS
= {
1211 'allowLoginScreen':true,
1212 'runForNewUsers':true,
1213 'globalSettingsMigrated':false, 'lastUserId':0, 'lastVersion':''
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,
1230 //'survivedTheNight', 'chatSound1401', 'randomSettingMigrated'
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"}
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"}
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"}
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());
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
;
1265 var _ext_messageId
= 0;
1266 var _ext_messageCallback
= {};
1269 var chrome_sendMessage = function(message
, callback
) {
1270 if (chrome
.extension
.sendMessage
) {
1271 chrome
.extension
.sendMessage(message
, callback
);
1273 chrome
.extension
.sendRequest(message
, callback
);
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
);
1288 if (Object
.keys(item
).length
=== 0) {
1292 callback(item
[name
]);
1298 chrome_sendMessage({'command':'getValue', 'name':name
}, function(response
) {
1299 if (response
&& typeof response
.val
!= 'undefined') {
1300 callback(response
.val
);
1312 var chrome_setValue = function(name
, val
) {
1313 if (chrome
.storage
&& !chrome_storageFallback
) {
1316 chrome
.storage
.local
.set(toSet
, function() {
1317 if (chrome
.runtime
&& chrome
.runtime
.lastError
) {
1318 saveValueError(chrome
.runtime
.lastError
);
1325 chrome_sendMessage({'command':'setValue', 'name':name
, 'val':val
}, function() {});
1328 var chrome_clearStorage = function() {
1329 if (chrome
.storage
) {
1330 chrome
.storage
.local
.clear();
1332 chrome_sendMessage({'command':'clearStorage'}, function() {});
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
);
1342 if (details
.onerror
) {
1343 details
.onerror(response
.request
);
1350 if (opera
.extension
) {
1351 opera
.extension
.onmessage = function(message
) {
1353 var response
= message
.data
;
1354 var callback
= _ext_messageCallback
[response
.messageid
];
1356 callback(response
.val
);
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;
1368 var opera_setValue = function(name
, val
) {
1369 opera
.extension
.postMessage({'command':'setValue', 'name':name
, 'val':val
});
1372 var opera_clearStorage = function() {
1373 opera
.extension
.postMessage({'command':'clearStorage'});
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
);
1383 if (details
.onerror
) {
1384 details
.onerror(response
.request
);
1389 'method': details
.method
1391 ,'headers': details
.headers
1392 ,'data': details
.data
1394 opera
.extension
.postMessage({'command':'ajax', 'messageid':_ext_messageId
, 'details':detailsX
});
1395 _ext_messageId
+= 1;
1400 if (typeof safari
!= 'undefined') {
1401 safari
.self
.addEventListener('message', function(message
) {
1402 var data
= message
.message
;
1404 var response
= data
;
1405 var callback
= _ext_messageCallback
[message
.name
];
1407 callback(response
.val
);
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;
1420 var safari_setValue = function(name
, val
) {
1421 safari
.self
.tab
.dispatchMessage('setValue', {'name':name
, 'val':val
});
1424 var safari_clearStorage = function() {
1425 safari
.self
.tab
.dispatchMessage('clearStorage', {});
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
);
1436 if (details
.onerror
) {
1437 details
.onerror(response
.request
);
1442 'method': details
.method
1444 ,'headers': details
.headers
1445 ,'data': details
.data
1447 safari
.self
.tab
.dispatchMessage('ajax', {'messageid':_ext_messageId
, 'details':detailsX
});
1448 //_ext_messageId += 1;
1452 if (ISFIREFOX
&& typeof self
!= 'undefined' && typeof self
.on
!= 'undefined') {
1453 self
.on('message', function(message
) {
1456 var response
= data
;
1457 var callback
= _ext_messageCallback
[message
.messageid
];
1459 callback(response
.val
);
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;
1469 var xpi_setValue = function(name
, val
) {
1470 self
.postMessage({'command':'setValue', 'name':name
, 'val':val
});
1473 var xpi_clearStorage = function(name
, val
) {
1474 self
.postMessage({'command':'clearStorage'});
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
);
1484 if (details
.onerror
) {
1485 details
.onerror(response
.request
);
1490 'method': details
.method
1492 ,'headers': details
.headers
1493 ,'data': details
.data
1495 self
.postMessage({'command':'ajax', 'messageid':_ext_messageId
, 'details':detailsX
});
1496 _ext_messageId
+= 1;
1500 if (typeof w
.external
!= 'undefined' && typeof w
.external
.mxGetRuntime
!= 'undefined') {
1501 var maxthonRuntime
= w
.external
.mxGetRuntime();
1503 maxthonRuntime
.listen('messageContentScript', function(message
) {
1506 var response
= data
;
1507 var callback
= _ext_messageCallback
[message
.messageid
];
1509 callback(response
.val
);
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
);
1521 if (details
.onerror
) {
1522 details
.onerror(response
.request
);
1527 'method': details
.method
1529 ,'headers': details
.headers
1530 ,'data': details
.data
1532 maxthonRuntime
.post('messageBackground', {'command':'ajax', 'messageid':_ext_messageId
, 'details':detailsX
});
1533 _ext_messageId
+= 1;
1537 function ajax(obj
) {
1538 switch (STORAGEMETHOD
) {
1539 case 'greasemonkey':
1540 return GM_xmlhttpRequest(obj
);
1543 return chrome_ajax(obj
);
1546 return opera_ajax(obj
);
1549 return safari_ajax(obj
);
1552 return xpi_ajax(obj
);
1555 return mxaddon_ajax(obj
);
1567 ,statusText:'No GM_xmlhttpRequest support'
1571 function isPonyhoofPage(id
) {
1572 if (id
== PONYHOOF_PAGE
) {
1578 function capitaliseFirstLetter(string
) {
1579 return string
.charAt(0).toUpperCase() + string
.slice(1);
1583 for (var i
in HTMLCLASS_SETTINGS
) {
1584 if (!DEFAULTSETTINGS
[HTMLCLASS_SETTINGS
[i
]]) {
1585 DEFAULTSETTINGS
[HTMLCLASS_SETTINGS
[i
]] = false;
1588 //DEFAULTSETTINGS.show_messages_other = true;
1590 DEFAULTSETTINGS
.disable_animation
= true;
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.");
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
);
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
);
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
);
1616 function getValue(name
, callback
) {
1617 switch (STORAGEMETHOD
) {
1618 case 'greasemonkey':
1619 callback(GM_getValue(name
));
1623 chrome_getValue(name
, callback
);
1627 opera_getValue(name
, callback
);
1631 safari_getValue(name
, callback
);
1635 xpi_getValue(name
, callback
);
1639 callback(w
.external
.mxGetRuntime().storage
.getConfig(name
));
1642 case 'localstorage':
1644 name
= 'ponyhoof_'+name
;
1645 callback(w
.localStorage
.getItem(name
));
1650 function saveValue(name
, v
) {
1651 switch (STORAGEMETHOD
) {
1652 case 'greasemonkey':
1653 GM_setValue(name
, v
);
1657 chrome_setValue(name
, v
);
1661 opera_setValue(name
, v
);
1665 safari_setValue(name
, v
);
1669 xpi_setValue(name
, v
);
1673 w
.external
.mxGetRuntime().storage
.setConfig(name
, v
);
1676 case 'localstorage':
1678 name
= 'ponyhoof_'+name
;
1679 w
.localStorage
.setItem(name
, v
);
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
;
1691 settingsKey
= SETTINGSPREFIX
+settingsKey
;
1693 if (!opts
.defaultSettings
) {
1694 opts
.defaultSettings
= DEFAULTSETTINGS
;
1698 getValue(settingsKey
, function(s
) {
1707 for (var i
in opts
.defaultSettings
) {
1708 if (!s
.hasOwnProperty(i
)) {
1709 s
[i
] = opts
.defaultSettings
[i
];
1719 extra
= "<code>"+e
.message
+"</code>";
1721 extra
= "<code>"+e
.toString()+"</code>";
1724 getValueError(extra
);
1726 onPageReady(function() {
1728 getValueError(extra
);
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
;
1744 settingsKey
= SETTINGSPREFIX
+settingsKey
;
1746 var settings
= userSettings
;
1747 if (opts
.settings
) {
1748 settings
= opts
.settings
;
1752 saveValue(settingsKey
, JSON
.stringify(settings
));
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.");
1765 extra
= "<code>"+e
.message
+"</code>";
1767 extra
= "<code>"+e
.toString()+"</code>";
1769 saveValueError(extra
);
1774 var saveGlobalSettings = function() {
1775 saveSettings({prefix:'global_', settings:globalSettings
});
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
);
1787 var canPlayFlash = function() {
1788 return !!w
.navigator
.mimeTypes
['application/x-shockwave-flash'];
1792 var PonySelector = function(p
, param
) {
1804 k
.oldPony
= CURRENTPONY
;
1805 k
.customClick = function() {};
1806 k
.customCheckCondition
= false;
1807 k
.overrideClickAction
= false;
1810 k
.createSelector = function() {
1817 var currentPonyData
= convertCodeToData(CURRENTPONY
);
1818 var name
= "(Nopony)";
1819 if (currentPonyData
) {
1820 name
= currentPonyData
.name
;
1821 } else if (CURRENTPONY
== 'RANDOM') {
1825 var iu
= INTERNALUPDATE
;
1826 INTERNALUPDATE
= true;
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();
1834 if (k
.allowRandom
) {
1836 if (CURRENTPONY
== 'RANDOM') {
1840 k
.menu
.createMenuItem({
1842 ,title: "To choose which characters to randomize, go to the Misc tab"
1845 ,onclick: function(menuItem
, menuClass
) {
1846 CURRENTPONY
= 'RANDOM';
1848 changeThemeSmart('RANDOM');
1849 userSettings
.theme
= 'RANDOM';
1852 menuClass
.changeButtonText("(Random)");
1853 menuClass
.changeChecked(menuItem
);
1856 if (k
.customClick
) {
1857 k
.customClick(menuItem
, menuClass
);
1863 if (k
.allowRandom
) {
1864 k
.menu
.createSeperator();
1867 if (k
.param
.feature
&& k
.param
.feature
!= -1) {
1868 k
._createItem(PONIES
[k
.param
.feature
], true);
1869 k
.menu
.createSeperator();
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();
1881 if (k
.customCheckCondition
) {
1882 if (k
.customCheckCondition(PONIES
[i
].code
)) {
1886 if (PONIES
[i
].code
== CURRENTPONY
) {
1891 k
._createItem(PONIES
[i
], check
);
1893 if (PONIES
[i
].seperator
) {
1894 k
.menu
.createSeperator();
1898 var img
= d
.createElement('span');
1899 img
.className
= 'ponyhoof_loading ponyhoof_show_if_injected ponyhoof_loading_pony';
1900 k
.menu
.wrap
.appendChild(img
);
1902 INTERNALUPDATE
= iu
;
1905 k
._createItem = function(ponyData
, check
) {
1906 var unsearchable
= false;
1907 if (ponyData
.hidden
) {
1908 unsearchable
= true;
1910 var menuItem
= k
.menu
.createMenuItem({
1912 ,title: ponyData
.menu_title
1913 ,data: ponyData
.code
1915 ,unsearchable: unsearchable
1916 ,searchAlternate: ponyData
.search
1917 ,onclick: function(menuItem
, menuClass
) {
1918 if (!k
.overrideClickAction
) {
1919 var code
= ponyData
.code
;
1922 changeThemeSmart(code
);
1923 userSettings
.theme
= code
;
1926 menuClass
.changeButtonText(ponyData
.name
);
1927 menuClass
.changeChecked(menuItem
);
1931 if (k
.customClick
) {
1932 k
.customClick(menuItem
, menuClass
);
1936 if (ponyData
.hidden
) {
1937 addClass(menuItem
.menuItem
, 'ponyhoof_pony_hidden');
1941 k
.injectStyle = function() {
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;}';
1950 injectManualStyle(css
, 'ponySelector');
1955 var _soundCache
= {};
1956 var PonySound = function(id
) {
1960 k
.sound
= d
.createElement('audio');
1962 // Don't loop sounds for 3 seconds
1964 k
.respectSettings
= true;
1965 k
.respectVolumeSetting
= true;
1970 k
.changeSource = function(source
) {
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');
1980 throw new Error("No supported audio formats");
1983 k
.changeSource(source
);
1986 k
.play = function() {
1987 if (k
.respectSettings
) {
1988 if (!userSettings
.sounds
) {
1994 k
.continuePlaying();
1998 // Make sure we aren't playing it on another page already
1999 k
._time
= Math
.floor(Date
.now() / 1000);
2002 getValue(SETTINGSPREFIX
+'soundCache', function(s
) {
2003 if (typeof s
!= 'undefined') {
2005 _soundCache
= JSON
.parse(s
);
2010 if (_soundCache
== null) {
2014 if (_soundCache
[k
.id
]) {
2015 if (_soundCache
[k
.id
]+k
.wait
<= k
._time
) {
2022 k
.continuePlaying();
2025 // k.continuePlaying();
2029 k
.continuePlaying = function() {
2031 _soundCache
[k
.id
] = k
._time
;
2032 saveValue(SETTINGSPREFIX
+'soundCache', JSON
.stringify(_soundCache
));
2035 if (k
.respectVolumeSetting
) {
2036 k
.sound
.volume
= userSettings
.soundsVolume
;
2038 k
.sound
.src
= k
.source
;
2042 // http://html5doctor.com/native-audio-in-the-browser/
2043 k
.audioTagSupported = function() {
2044 return !!(k
.sound
.canPlayType
);
2047 k
.canPlayMp3 = function() {
2048 return !!k
.sound
.canPlayType
&& '' != k
.sound
.canPlayType('audio/mpeg');
2051 k
.canPlayOgg = function() {
2052 return !!k
.sound
.canPlayType
&& '' != k
.sound
.canPlayType('audio/ogg; codecs="vorbis"');
2056 var ponySounds
= {};
2057 function initPonySound(id
, source
) {
2058 var source
= source
|| '';
2060 if (ponySounds
[id
]) {
2062 ponySounds
[id
].changeSourceSmart(source
);
2065 return ponySounds
[id
];
2068 var sound
= new PonySound(id
);
2070 if (!sound
.audioTagSupported()) {
2071 throw new Error('No <audio> tag support');
2075 sound
.changeSourceSmart(source
);
2078 ponySounds
[id
] = sound
;
2084 var Updater = function() {
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';
2094 k
.update_url
= UPDATEURL
;
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';
2105 ele
.addEventListener('click', k
._updateNowButton
, false);
2108 log("Checking for updates...");
2113 ,onload: function(response
) {
2114 if (response
.status
!= 200) {
2115 k
._onError(response
);
2120 var json
= JSON
.parse(response
.responseText
);
2122 k
._onError(response
);
2126 if (json
.version
> VERSION
) {
2127 k
._newVersion(json
);
2132 ,onerror: function(response
) {
2133 k
._onError(response
);
2141 k
._noNewVersion = function() {
2142 // Hide checking for updates
2143 loopClassName(k
.classChecking
, function(ele
) {
2144 ele
.style
.display
= 'none';
2148 loopClassName(k
.classLatest
, function(ele
) {
2149 ele
.style
.display
= 'block';
2152 k
._newVersion = function(json
) {
2153 k
.update_json
= json
;
2155 // Hide checking for updates
2156 loopClassName(k
.classChecking
, function(ele
) {
2157 ele
.style
.display
= 'none';
2160 // Show version number
2161 loopClassName(k
.classVersionNum
, function(ele
) {
2162 ele
.textContent
= json
.version
;
2164 // Show that we have a new version
2165 loopClassName(k
.classNewVersion
, function(ele
) {
2166 ele
.style
.display
= 'block';
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
;
2175 switch (STORAGEMETHOD
) {
2178 ele
.href
= json
.chrome_url
;
2182 ele
.href
= json
.opera_url
;
2187 ele
.href
= json
.safariextz
;
2200 ele
.href
= json
.update_url
;
2205 k
._onError = function(response
) {
2206 // Hide checking for updates
2207 loopClassName(k
.classChecking
, function(ele
) {
2208 ele
.style
.display
= 'none';
2212 loopClassName(k
.classError
, function(ele
) {
2213 ele
.style
.display
= 'block';
2216 error("Error checking for updates.");
2220 k
.updateDialog
= null;
2221 k
._updateNowButton = function() {
2222 statTrack('updateNowButton');
2224 switch (STORAGEMETHOD
) {
2234 k
.safariInstruction();
2249 if (DIALOGS
.updater_dialog
) {
2250 k
.updateDialog
.show();
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');
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>';
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
);
2278 if (!ISCHROME
&& STORAGEMETHOD
== 'greasemonkey') {
2279 var retry
= k
.updateDialog
.dialog
.getElementsByClassName('retry');
2282 retry
.href
= k
.update_json
.update_url
;
2283 removeClass(retry
, 'hidden_elem');
2286 k
._initReloadButtons(k
.updateDialog
);
2292 k
.cwsWaitDialog
= null;
2293 k
.cwsOneClickSuccess
= false;
2294 k
._cws = function() {
2295 if (k
.cwsWaitDialog
) {
2296 k
._cws_showDialog();
2301 loopClassName(k
.classUpdateButton
, function(ele
) {
2302 if (hasClass(ele
, 'uiButtonDisabled')) {
2305 addClass(ele
, 'uiButtonDisabled');
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
);
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;
2329 var successText
= '';
2330 var ponyData
= convertCodeToData(REALPONY
);
2331 if (ponyData
.successText
) {
2332 successText
= ponyData
.successText
;
2334 successText
= "Yay!";
2336 var c
= successText
+" Reloading... <span class='ponyhoof_loading'></span>";
2337 k
.cwsWaitDialog
.changeContent(c
);
2340 chrome_sendMessage({'command':'reloadNow'}, function() {});
2341 w
.setTimeout(function() {
2342 w
.location
.reload();
2354 w
.setTimeout(k
._cws_fallback
, 8000);
2357 k
._cws_fallback = function() {
2358 if (k
.cwsOneClickSuccess
) {
2361 k
.cwsOneClickSuccess
= true;
2363 k
.cwsWaitDialog
.close();
2364 loopClassName(k
.classUpdateButton
, function(ele
) {
2365 removeClass(ele
, 'uiButtonDisabled');
2367 k
._cws_showDialog();
2370 k
._cws_showDialog = function() {
2377 if (DISTRIBUTION
== 'cws') {
2378 if (!ISOPERABLINK
) {
2379 header
= "Ponyhoof automatically updates from the Chrome Web Store.";
2381 header
= "Ponyhoof automatically updates on Opera.";
2384 header
= "Ponyhoof automatically updates on Google Chrome.";
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>.";
2390 c
+= "<br><br>Verify that the version changes from "+VERSION
+" to "+parseFloat(newversion
)+" and reload Facebook.";
2392 c
+= "<br><br><"+"img src='"+THEMEURL
+"_welcome/chrome_forceupdate.png' alt='' width='177' height='108' class='ponyhoof_image_shadow'>";
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>';
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
);
2406 var openExtensionsButton
= $('ponyhoof_updater_cws_openExtensions');
2408 openExtensionsButton
.addEventListener('click', function() {
2409 if (!hasClass(this, 'uiButtonDisabled')) {
2410 chrome_sendMessage({'command':'openExtensions'}, function() {});
2415 k
._initReloadButtons(k
.cwsDialog
);
2418 k
.operaDialog
= null;
2419 k
._opera = function() {
2420 if ($('ponyhoof_dialog_update_opera')) {
2421 k
.operaDialog
.show();
2425 var version
= getBrowserVersion();
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>";
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>";
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'>";
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>';
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
);
2448 k
._initReloadButtons(k
.operaDialog
);
2451 k
.safariDialog
= null;
2452 k
.safariInstruction = function() {
2453 if (k
.safariDialog
) {
2454 k
.safariDialog
.show();
2458 injectManualStyle('#ponyhoof_dialog_update_safari .generic_dialog_popup, #ponyhoof_dialog_update_safari .popup {width:600px;}', 'update_safari');
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'>";
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'>";
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>';
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
);
2480 k
._initReloadButtons(k
.safariDialog
);
2484 k
._xpi = function() {
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'>";
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>';
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
);
2506 var retry
= k
.xpiDialog
.dialog
.getElementsByClassName('retry');
2509 retry
.href
= k
.update_json
.xpi
;
2511 k
._initReloadButtons(k
.xpiDialog
);
2514 USW
.InstallTrigger
.install({
2516 URL: k
.update_json
.xpi
2517 ,IconURL: 'https://hoof.little.my/files/app32.png'
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');
2533 w
.location
.reload();
2539 $$(dialog
.dialog
, '.notNow', function(ele
) {
2540 ele
.addEventListener('click', function() {
2541 if (!hasClass(this, 'uiButtonDisabled')) {
2550 var BrowserPoniesHoof = function() {
2554 k
.errorDialog
= null;
2555 k
.url
= 'https://hoof.little.my/_browserponies/';
2556 k
.initLoaded
= false;
2558 k
.ponySelected
= 'RANDOM';
2559 k
.doneCallback = function() {};
2561 k
.selectPoniesMenu
= null;
2562 k
.selectPoniesButton
= null;
2564 k
.run = function() {
2565 if (!k
.initLoaded
) {
2570 k
.spawnPony(k
.ponySelected
);
2572 if (k
.doneCallback
) {
2577 k
._init = function(callback
) {
2578 k
._getAjax(k
.url
+'BrowserPoniesBaseConfig.json?userscript_version='+VERSION
, function(response
) {
2580 var tempPonies
= JSON
.parse(response
.responseText
);
2582 if (k
.errorCallback
) {
2583 k
.errorCallback(response
);
2587 contentEval("var BrowserPoniesBaseConfig = "+response
.responseText
);
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, ''));
2600 k
._getAjax(k
.url
+'browserponies.js?userscript_version='+VERSION
, function(response
) {
2601 contentEval(response
.responseText
);
2602 k
.initLoaded
= true;
2604 contentEval(function(arg
) {
2607 if (typeof(window
.BrowserPoniesConfig
) === "undefined") {
2608 window
.BrowserPoniesConfig
= {};
2610 window
.BrowserPonies
.setBaseUrl(cfg
.baseurl
);
2611 if (!window
.BrowserPoniesBaseConfig
.loaded
) {
2612 window
.BrowserPonies
.loadConfig(window
.BrowserPoniesBaseConfig
);
2613 window
.BrowserPoniesBaseConfig
.loaded
= true;
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});
2618 if (arg
.CANLOG
&& typeof console
!= 'undefined' && console
.log
&& console
.dir
) {
2619 console
.log("Unable to hook to BrowserPonies");
2623 }, {"CANLOG":CANLOG
, "baseurl":k
.url
});
2630 k
._getAjax = function(url
, callback
) {
2635 ,onload: function(response
) {
2636 if (response
.status
!= 200) {
2637 if (k
.errorCallback
) {
2638 k
.errorCallback(response
);
2645 ,onerror: function(response
) {
2646 if (k
.errorCallback
) {
2647 k
.errorCallback(response
);
2652 if (k
.errorCallback
) {
2658 k
.createDialog = function() {
2659 if ($('ponyhoof_dialog_browserponies')) {
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>';
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;
2678 k
.dialog
.changeContent(c
);
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);
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();
2691 k
.selectPoniesMenu
.createMenuItem({
2695 ,onclick: function(menuItem
, menuClass
) {
2696 k
._select_spawn(menuItem
, menuClass
, 'RANDOM');
2699 for (var code
in k
.ponies
) {
2700 if (k
.ponies
.hasOwnProperty(code
)) {
2701 k
._select_item(code
);
2708 k
._select_item = function(code
) {
2709 var pony
= k
.ponies
[code
];
2710 k
.selectPoniesMenu
.createMenuItem({
2712 ,onclick: function(menuItem
, menuClass
) {
2713 k
._select_spawn(menuItem
, menuClass
, pony
);
2718 k
._select_spawn = function(menuItem
, menuClass
, pony
) {
2719 menuClass
.changeChecked(menuItem
);
2722 if (pony
== 'RANDOM') {
2723 menuClass
.changeButtonText("(Random)");
2725 menuClass
.changeButtonText(pony
);
2728 k
.ponySelected
= pony
;
2732 k
.spawnPony = function(pony
) {
2733 contentEval(function(arg
) {
2735 if (arg
.pony
== 'RANDOM') {
2736 window
.BrowserPonies
.spawnRandom();
2738 window
.BrowserPonies
.spawn(arg
.pony
);
2740 if (!window
.BrowserPonies
.running()) {
2741 window
.BrowserPonies
.start();
2744 if (arg
.CANLOG
&& typeof console
!= 'undefined' && console
.log
&& console
.dir
) {
2745 console
.log("Unable to hook to BrowserPonies");
2749 }, {"CANLOG":CANLOG
, "pony":pony
});
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>.");
2756 k
.injectStyle = function() {
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');
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ö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>");
2779 k
.morePonies = function(e
) {
2780 k
.spawnPony(k
.ponySelected
);
2786 k
.closeDialog = function(e
) {
2793 k
.clearAll = function(e
) {
2795 contentEval(function(arg
) {
2797 window
.BrowserPonies
.unspawnAll();
2798 window
.BrowserPonies
.stop();
2800 if (arg
.CANLOG
&& typeof console
!= 'undefined' && console
.log
&& console
.dir
) {
2801 console
.log("Unable to hook to BrowserPonies");
2805 }, {"CANLOG":CANLOG
});
2813 var Options = function() {
2817 k
.saveButton
= null;
2819 k
.needToSaveLabel
= false;
2820 k
.needToRefresh
= false;
2821 k
.canSaveSettings
= true;
2823 k
._stack
= CURRENTSTACK
;
2826 k
.create = function() {
2827 // Did we create our Options interface already?
2828 if ($('ponyhoof_dialog_options')) {
2838 extra
= '<br><br><a href="http://jointheherd.little.my" target="_top">Please update to the latest version of Ponyhoof here.</a>';
2841 k
.dialog
= new Dialog('options_force_run');
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();
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>';
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&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>';
2864 var visitPageText
= CURRENTLANG
.settings_main_visitPage
;
2865 if (ISUSINGBUSINESS
) {
2866 visitPageText
= CURRENTLANG
.settings_main_visitPageBusiness
;
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>';
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>';
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>';
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>';
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>';
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>';
2906 var soundsText
= CURRENTLANG
.settings_sounds
;
2907 if (ISUSINGPAGE
|| ISUSINGBUSINESS
) {
2908 soundsText
= CURRENTLANG
.settings_sounds_noNotification
;
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>';
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>';
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>';
2934 c
+= '</div>'; // .available
2936 c
+= '<div class="ponyhoof_hide_if_injected ponyhoof_message uiBoxRed">';
2937 c
+= 'You must enable Ponyhoof to use Ponyhoof sounds.';
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"});
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>';
2952 c
+= '<div class="ponyhoof_hide_if_injected"><br></div>';
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});
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
});
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>';
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>';
2974 c
+= '<textarea id="ponyhoof_options_technical" READONLY spellcheck="false"></textarea><br><br>';
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>';
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>';
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>';
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.';
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>';
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>';
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>';
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>';
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>';
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>';
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>
3033 c
+= '</div></div>';
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. © '+(new Date().getFullYear())+' Hasbro. All Rights Reserved.</div></div>';
3039 var successText
= '';
3040 var ponyData
= convertCodeToData(REALPONY
);
3041 if (ponyData
.successText
) {
3042 successText
= ponyData
.successText
+' ';
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>';
3048 k
.dialog
= new Dialog('options');
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
;
3058 k
.saveButton
= $('ponyhoof_options_save');
3059 k
.saveButton
.addEventListener('click', k
.saveButtonClick
, false);
3061 k
.dialog
.dialog
.getElementsByClassName('ponyhoof_noShareIsCare')[0].addEventListener('click', function() {
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() {
3073 w
.setTimeout(function() {
3074 var update
= new Updater();
3075 update
.checkForUpdates();
3081 // @todo make k.mainInit non-dependant
3086 if (userSettings
.debug_exposed
) {
3087 addClass(k
.dialog
.dialog
, 'ponyhoof_options_debugExposed');
3091 k
._refreshDialog = function() {
3093 k
.disableDomNodeInserted();
3095 if (k
.debugLoaded
) {
3096 $('ponyhoof_options_technical').textContent
= k
.techInfo();
3097 //$('ponyhoof_options_linkedcss').textContent = k.linkedCss();
3101 k
.debugLoaded
= false;
3102 k
.techInfo = function() {
3103 var cxPrivate
= false;
3104 if (d
.getElementsByClassName('-cx-PRIVATE-fbLayout__root').length
) {
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";
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";
3125 tech
+= k
.linkedCss();
3127 tech
+= k
.linkedScript();
3129 tech
+= k
.linkedIframe();
3134 if ($('bfb_options_button')) {
3135 ext
.push("Social Fixer");
3137 if (d
.getElementsByClassName('rg3fbpz-tooltip').length
) {
3138 ext
.push("Photo Zoom for Facebook");
3140 if ($('fbpoptslink')) {
3141 ext
.push("FB Purity");
3143 if ($('fbfPopupContainer')) {
3146 if ($('unfriend_finder')) {
3147 ext
.push("Unfriend Finder");
3149 if ($('window-resizer-tooltip')) {
3150 ext
.push("Window Resizer");
3153 ext
.push("Hover Zoom");
3155 if ($('myGlobalPonies')) {
3156 ext
.push("My Global Ponies");
3158 if ($('memeticonStyle')) {
3159 ext
.push("Memeticon (ads)");
3161 if ($('socialplus')) {
3162 ext
.push("SocialPlus! (ads)");
3164 if (d
.querySelector('script[src^="chrome-extension://igdhbblpcellaljokkpfhcjlagemhgjl"]')) {
3165 ext
.push("Iminent (ads)");
3167 if ($('_fbm-emoticons-wrapper')) {
3168 ext
.push("myemoticons.com");
3170 if (d
.querySelector('script[src^="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl"]')) {
3171 ext
.push("Skype plugin");
3173 if (d
.querySelector('script[src^="chrome-extension://jmfkcklnlgedgbglfkkgedjfmejoahla"]')) {
3174 ext
.push("AVG Safe Search");
3176 if ($('DAPPlugin')) {
3177 ext
.push("Download Accelerator Plus");
3180 if ($('bfb_theme')) {
3181 conflict
.push("Social Fixer theme");
3183 if ($('mycssstyle')) {
3184 conflict
.push("SocialPlus! theme");
3186 if ($('ColourChanger')) {
3187 conflict
.push("Facebook Colour Changer");
3189 if (hasClass(d
.documentElement
, 'myFacebook')) {
3190 conflict
.push("Color My Facebook");
3192 if (w
.navigator
.userAgent
.match(/Mozilla
\/4\.0 \(compatible
\; MSIE
7\.0\; Windows
/)) {
3193 conflict
.push("IE 7 user-agent spoofing");
3195 tech
+= "Installed extensions: ";
3197 for (var i
= 0, len
= ext
.length
; i
< len
; i
+= 1) {
3199 if (ext
.length
-1 != i
) {
3204 tech
+= "None detected";
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
) {
3217 tech
+= "None detected";
3224 k
.linkedCss = function() {
3225 var css
= d
.getElementsByTagName('link');
3227 for (var i
= 0, len
= css
.length
; i
< len
; i
+= 1) {
3228 if (css
[i
].rel
== 'stylesheet') {
3229 t
+= css
[i
].href
+ "\n";
3236 k
.linkedScript = function() {
3237 var script
= d
.getElementsByTagName('script');
3239 for (var i
= 0, len
= script
.length
; i
< len
; i
+= 1) {
3240 if (script
[i
].src
) {
3241 t
+= script
[i
].src
+ "\n";
3248 k
.linkedIframe = function() {
3249 var iframe
= d
.getElementsByTagName('iframe');
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";
3260 k
.debugInfo = function() {
3261 if (k
.debugLoaded
) {
3264 k
.debugLoaded
= true;
3267 var customcss
= $('ponyhoof_options_customcss');
3268 if (userSettings
.customcss
) {
3269 customcss
.value
= userSettings
.customcss
;
3271 customcss
.addEventListener('input', function() {
3272 if (!k
.needsToRefresh
) {
3273 k
.needsToRefresh
= true;
3274 k
.updateCloseButton();
3277 $('ponyhoof_options_customcss_preview').addEventListener('click', function() {
3278 if (!$('ponyhoof_style_customcss')) {
3279 injectManualStyle('', 'customcss');
3282 $('ponyhoof_style_customcss').textContent
= '/* '+SIG
+' */'+customcss
.value
;
3286 var techFirstHover
= false;
3287 $('ponyhoof_options_technical').addEventListener('click', function() {
3288 if (!techFirstHover
) {
3289 techFirstHover
= true;
3295 if (STORAGEMETHOD
== 'localstorage') {
3297 for (var i
in localStorage
) {
3298 dump
+= i
+": "+localStorage
[i
]+"\n";
3300 $('ponyhoof_options_dump').value
= dump
;
3304 var settingsTextarea
= $('ponyhoof_options_debug_settings');
3306 $('ponyhoof_options_debug_settings_export').addEventListener('click', function() {
3307 settingsTextarea
.value
= JSON
.stringify(userSettings
);
3310 $('ponyhoof_options_debug_settings_saveall').addEventListener('click', function(e
) {
3313 var s
= JSON
.parse(settingsTextarea
.value
);
3315 createSimpleDialog('debug_settingsKey_error', "Derp'd", "Invalid JSON<br><br><code>\n\n"+e
.toString()+"</code>");
3319 if (confirm(SIG
+" Are you sure you want to overwrite your settings? Facebook will be reloaded immediately after saving.")) {
3322 w
.location
.reload();
3327 $('ponyhoof_options_tempRemove').addEventListener('click', k
._debugRemoveStyle
, false);
3328 k
._debugNoMutationObserver();
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.")) {
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
;
3342 for (var x
in userSettings
) {
3343 settings
[x
] = userSettings
[x
];
3345 settings
['customBg'] = null;
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>';
3350 if ($('ponyhoof_sourceSend_input')) {
3351 $('ponyhoof_sourceSend_input').value
= t
;
3353 var sourceSendTxt
= d
.createElement('input');
3354 sourceSendTxt
.type
= 'hidden';
3355 sourceSendTxt
.id
= 'ponyhoof_sourceSend_input';
3356 sourceSendTxt
.name
= 'post';
3357 sourceSendTxt
.value
= t
;
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
);
3367 sourceSend
.submit();
3369 $('ponyhoof_options_technical').value
= temp
;
3374 $('ponyhoof_options_technical').textContent
= k
.techInfo();
3375 //$('ponyhoof_options_linkedcss').textContent = k.linkedCss();
3378 k
._debugRemoveStyle = function(e
) {
3379 changeThemeSmart('NONE');
3381 d
.removeEventListener('DOMNodeInserted', DOMNodeInserted
, true);
3382 if (mutationObserverMain
) {
3383 mutationObserverMain
.disconnect();
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;
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.");
3404 k
.mainInitLoaded
= false;
3405 k
.mainInit = function() {
3406 if (k
.mainInitLoaded
) {
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') {
3417 runDOMNodeInserted();
3420 if (ponySelector
.oldPony
!= 'NONE' && CURRENTPONY
== 'NONE') {
3421 k
.needsToRefresh
= true;
3423 if (k
._stack
!= CURRENTSTACK
) {
3424 k
.needsToRefresh
= true;
3426 k
.needToSaveLabel
= true;
3427 k
.updateCloseButton();
3429 var f
= k
.dialog
.dialog
.getElementsByClassName('ponyhoof_options_framerefresh');
3430 for (var i
= 0, len
= f
.length
; i
< len
; i
+= 1) {
3433 fadeOut(iframe
, function() {
3434 w
.setTimeout(function() {
3435 iframe
.style
.display
= '';
3436 removeClass(iframe
, 'ponyhoof_fadeout');
3438 iframe
.src
= iframe
.src
.replace(/\href\=/, '&href=');
3444 ponySelector
.createSelector();
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';
3453 $('ponyhoof_options_disable').addEventListener('click', k
.disablePonyhoof
, false);
3456 $('ponyhoof_browserponies').addEventListener('click', k
.runBrowserPonies
, false);
3458 k
.mainInitLoaded
= true;
3461 k
.extrasInitLoaded
= false;
3462 k
.extrasInit = function() {
3463 if (k
.extrasInitLoaded
) {
3467 var litestand
= false;
3468 if (d
.getElementsByClassName('_4g5r').length
) {
3470 } else if (d
.getElementsByClassName('-cx-PUBLIC-hasLitestandBookmarksSidebar__root').length
) {
3474 var option
= $('ponyhoof_options_show_messages_other');
3475 option
.disabled
= true;
3476 option
.checked
= false;
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");
3487 // Disable animations
3488 if (!supportsCssTransition()) {
3489 var option
= $('ponyhoof_options_disable_animation');
3490 option
.disabled
= true;
3491 option
.checked
= true;
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.");
3500 $('ponyhoof_options_resetSettings').addEventListener('click', k
.resetSettings
, false);
3501 $('ponyhoof_options_clearLocalStorage').addEventListener('click', k
.clearStorage
, false);
3503 k
.extrasInitLoaded
= true;
3506 k
.extrasCostumeMenu
= null;
3507 k
.extrasCostumeButton
= null;
3508 k
.extrasCostumeMenuItemNormal
= null;
3509 k
.extrasCostumeMenuItems
= {};
3510 k
.costumesInit = function() {
3511 var desc
= "(Normal)";
3513 if (userSettings
.costume
&& doesCharacterHaveCostume(REALPONY
, userSettings
.costume
)) {
3514 desc
= COSTUMESX
[userSettings
.costume
].name
;
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({
3529 ,onclick: function(menuItem
, menuClass
) {
3530 k
._costumesInit_save(menuItem
, menuClass
, '');
3534 for (var code
in COSTUMESX
) {
3535 if (COSTUMESX
.hasOwnProperty(code
)) {
3536 k
._costumesInit_item(code
);
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
]);
3545 k
.extrasCostumeMenu
.changeButtonText("(Normal)");
3546 k
.extrasCostumeMenu
.changeChecked(k
.extrasCostumeMenuItemNormal
);
3549 for (var code
in COSTUMESX
) {
3550 if (COSTUMESX
.hasOwnProperty(code
)) {
3551 if (doesCharacterHaveCostume(REALPONY
, code
)) {
3552 removeClass(k
.extrasCostumeMenuItems
[code
].menuItem
, 'hidden_elem');
3554 addClass(k
.extrasCostumeMenuItems
[code
].menuItem
, 'hidden_elem');
3561 k
._costumesInit_item = function(code
) {
3563 var extraClass
= '';
3564 if (doesCharacterHaveCostume(REALPONY
, code
)) {
3565 if (userSettings
.costume
== code
) {
3569 extraClass
+= ' hidden_elem';
3572 k
.extrasCostumeMenuItems
[code
] = k
.extrasCostumeMenu
.createMenuItem({
3573 html: COSTUMESX
[code
].name
3576 ,extraClass: extraClass
3577 ,onclick: function(menuItem
, menuClass
) {
3578 k
._costumesInit_save(menuItem
, menuClass
, code
);
3583 k
._costumesInit_save = function(menuItem
, menuClass
, code
) {
3584 if (!COSTUMESX
[code
] && code
!= '') {
3588 changeCostume(code
);
3589 userSettings
.costume
= code
;
3592 if (COSTUMESX
[code
]) {
3593 menuClass
.changeButtonText(COSTUMESX
[code
].name
);
3595 menuClass
.changeButtonText("(Normal)");
3597 menuClass
.changeChecked(menuItem
);
3600 k
.needToSaveLabel
= true;
3601 k
.updateCloseButton();
3604 k
.resetSettings = function(e
) {
3610 saveValue(SETTINGSPREFIX
+'soundCache', JSON
.stringify(null));
3612 k
.canSaveSettings
= false;
3614 w
.location
.reload();
3617 k
.clearStorage = function(e
) {
3618 k
.canSaveSettings
= false;
3620 if (typeof GM_listValues
!= 'undefined') {
3622 var keys
= GM_listValues();
3623 for (var i
= 0, len
= keys
.length
; i
< len
; i
+= 1) {
3624 GM_deleteValue(keys
[i
]);
3627 alert(e
.toString());
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.")) {
3635 localStorage
.clear();
3637 alert(e
.toString());
3645 chrome_clearStorage();
3649 opera_clearStorage();
3653 safari_clearStorage();
3670 w
.location
.reload();
3673 k
.donateLoaded
= false;
3674 k
.loadDonate = function() {
3675 if (k
.donateLoaded
) {
3679 statTrack('aboutclicked');
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') {
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
);
3690 $('ponyhoof_options_donatepaypal_link').addEventListener('click', function() {
3691 $('ponyhoof_options_donatepaypal').submit();
3692 statTrack('paypalClicked');
3696 $('ponyhoof_donate_flattr_iframe').src
= THEMEURL
+'_welcome/flattrStandalone.htm';
3698 k
.donateLoaded
= true;
3701 k
.randomInit = function() {
3703 if (userSettings
.randomPonies
) {
3704 current
= userSettings
.randomPonies
.split('|');
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) {
3717 ponySelector
.customClick = function(menuItem
, menuClass
) {
3718 var code
= menuItem
.menuItem
.getAttribute('data-ponyhoof-menu-data');
3720 if (!hasClass(menuItem
.menuItem
, 'ponyhoof_menuitem_checked')) {
3721 menuItem
.menuItem
.className
+= ' ponyhoof_menuitem_checked';
3725 removeClass(menuItem
.menuItem
, 'ponyhoof_menuitem_checked');
3727 current
.splice(current
.indexOf(code
), 1);
3729 userSettings
.randomPonies
= current
.join('|');
3732 k
._randomUpdateButtonText(current
, menuClass
);
3733 k
.needToSaveLabel
= true;
3734 k
.updateCloseButton();
3736 ponySelector
.createSelector();
3737 k
._randomUpdateButtonText(current
, ponySelector
.menu
);
3739 var mass
= d
.createElement('a');
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
) {
3751 removeClass(menuitem
, 'ponyhoof_menuitem_checked');
3755 if (current
.indexOf(PONIES
[i
].code
) == -1) {
3756 newCurrent
.push(PONIES
[i
].code
);
3759 addClass(menuitem
, 'ponyhoof_menuitem_checked');
3763 removeClass(menuitem
, 'ponyhoof_menuitem_checked');
3767 current
= newCurrent
;
3768 userSettings
.randomPonies
= current
.join('|');
3771 k
._randomUpdateButtonText(current
, ponySelector
.menu
);
3772 k
.needToSaveLabel
= true;
3773 k
.updateCloseButton();
3774 w
.setTimeout(function() {
3775 ponySelector
.menu
.open();
3780 outerwrap
.appendChild(mass
);
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
;
3791 menuClass
.changeButtonText(buttonText
);
3794 k
.soundsMenu
= null;
3795 k
.soundsButton
= null;
3796 k
.soundsInitLoaded
= false;
3797 k
.soundsNotifTypeMenu
= null;
3798 k
.soundsNotifTypeButton
= null;
3799 k
.soundsSettingsWrap
= null;
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
) {
3812 if (typeof w
.Audio
=== 'undefined') {
3815 initPonySound('soundsTest');
3817 $$(k
.dialog
.dialog
, '.unavailable', function(ele
) {
3818 removeClass(ele
, 'hidden_elem');
3820 $$(k
.dialog
.dialog
, '.available', function(ele
) {
3821 addClass(ele
, 'hidden_elem');
3823 k
.soundsInitLoaded
= true;
3827 var desc
= "(Auto-select)";
3828 if (SOUNDS
[userSettings
.soundsFile
] && SOUNDS
[userSettings
.soundsFile
].name
) {
3829 desc
= SOUNDS
[userSettings
.soundsFile
].name
;
3832 k
.soundsMenu
= new Menu('sounds', $('ponyhoof_options_soundsSetting'));
3833 k
.soundsButton
= k
.soundsMenu
.createButton(desc
);
3834 k
.soundsMenu
.createMenu();
3835 k
.soundsMenu
.attachButton();
3837 for (var code
in SOUNDS
) {
3838 if (SOUNDS
.hasOwnProperty(code
)) {
3839 k
._soundsMenu_item(code
);
3841 if (SOUNDS
[code
].seperator
) {
3842 k
.soundsMenu
.createSeperator();
3847 k
._soundsNotifTypeInit();
3849 var volumeInput
= $('ponyhoof_options_soundsVolume');
3850 var volumePreview
= $('ponyhoof_options_soundsVolumePreview');
3851 var volumeValue
= $('ponyhoof_options_soundsVolumeValue');
3852 var volumeTimeout
= null;
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
+"%";
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));
3868 k
._soundsPreview(userSettings
.soundsFile
);
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));
3881 k
._soundsPreview(userSettings
.soundsFile
);
3888 // Detect chat sound enabled setting
3889 k
.soundsChatSoundWarning
= $('ponyhoof_options_soundsChatSoundWarning');
3890 k
.soundsChatWrap
= $('ponyhoof_options_soundsChatWrap');
3892 if (typeof USW
.requireLazy
== 'function') {
3893 USW
.requireLazy(['ChatOptions', 'Arbiter'], function(ChatOptions
, Arbiter
) {
3894 if (userSettings
.chatSound
) {
3895 k
._soundsChatSoundWarn(ChatOptions
.getSetting('sound'));
3897 addClass(k
.soundsChatSoundWarning
, 'hidden_elem');
3900 Arbiter
.subscribe('chat/option-changed', function(e
, option
) {
3901 if (!userSettings
.chatSound
) {
3904 if (option
.name
== 'sound') {
3905 k
._soundsChatSoundWarn(option
.value
);
3911 error("Unable to hook to ChatOptions and Arbiter");
3914 k
._soundsChatLoad();
3915 k
._soundsChatInit();
3917 var button
= k
.soundsChatSoundWarning
.getElementsByClassName('uiButton');
3918 button
[0].addEventListener('click', function() {
3919 k
._soundsTurnOnFbSound();
3922 k
.soundsInitLoaded
= true;
3925 // Create a menu item for notification sounds
3926 // Used only on k.soundsInit()
3927 k
._soundsMenu_item = function(code
) {
3929 if (userSettings
.soundsFile
== code
) {
3933 k
.soundsMenu
.createMenuItem({
3934 html: SOUNDS
[code
].name
3935 ,title: SOUNDS
[code
].title
3938 ,onclick: function(menuItem
, menuClass
) {
3939 if (!SOUNDS
[code
] || !SOUNDS
[code
].name
) {
3943 //$('ponyhoof_options_sounds').checked = true;
3944 //userSettings.sounds = true;
3945 userSettings
.soundsFile
= code
;
3948 k
._soundsPreview(code
);
3950 menuClass
.changeButtonText(menuItem
.getText());
3951 menuClass
.changeChecked(menuItem
);
3953 k
.needToSaveLabel
= true;
3954 k
.updateCloseButton();
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;
3969 removeClass(k
.soundsChatSoundWarning
, 'hidden_elem');
3970 $('ponyhoof_options_chatSound').disabled
= true;
3971 $('ponyhoof_options_chatSound').checked
= false;
3975 // Turn on Facebook chat sounds
3976 // Used on k.soundsInit() and k.chatSound()
3977 k
._soundsTurnOnFbSound = function() {
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);
3986 error("Unable to hook to ChatOptions and ChatSidebarDropdown");
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('|');
3998 for (var code
in SOUNDS_NOTIFTYPE
) {
3999 if (current
.indexOf(code
) != -1) {
4000 k
._soundsNotifTypeCurrent
.push(code
);
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();
4011 for (var code
in SOUNDS_NOTIFTYPE
) {
4012 if (SOUNDS_NOTIFTYPE
.hasOwnProperty(code
)) {
4013 k
._soundsNotifTypeInit_item(code
);
4016 k
._soundsNotifTypeUpdateButtonText(k
._soundsNotifTypeCurrent
, k
.soundsNotifTypeMenu
);
4019 // Create a menu item for notification sound blacklist
4020 // Used only on k._soundsNotifTypeInit()
4021 k
._soundsNotifTypeInit_item = function(code
) {
4023 if (k
._soundsNotifTypeCurrent
.indexOf(code
) != -1) {
4027 k
.soundsNotifTypeMenu
.createMenuItem({
4028 html: SOUNDS_NOTIFTYPE
[code
].name
4031 ,onclick: function(menuItem
, menuClass
) {
4032 if (!SOUNDS_NOTIFTYPE
[code
] || !SOUNDS_NOTIFTYPE
[code
].name
) {
4036 if (!hasClass(menuItem
.menuItem
, 'ponyhoof_menuitem_checked')) {
4037 menuItem
.menuItem
.className
+= ' ponyhoof_menuitem_checked';
4039 k
._soundsNotifTypeCurrent
.push(code
);
4041 removeClass(menuItem
.menuItem
, 'ponyhoof_menuitem_checked');
4043 k
._soundsNotifTypeCurrent
.splice(k
._soundsNotifTypeCurrent
.indexOf(code
), 1);
4045 userSettings
.soundsNotifTypeBlacklist
= k
._soundsNotifTypeCurrent
.join('|');
4048 k
._soundsNotifTypeUpdateButtonText(k
._soundsNotifTypeCurrent
, menuClass
);
4049 k
.needToSaveLabel
= true;
4050 k
.updateCloseButton();
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
;
4064 menuClass
.changeButtonText(buttonText
);
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');
4074 addClass(k
.soundsSettingsWrap
, 'hidden_elem');
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() {
4083 if (userSettings
.sounds
) {
4084 turnOffFbNotificationSound();
4086 // We already nuked Facebook's sounds, so we need to reload
4087 k
.needsToRefresh
= true;
4088 k
.updateCloseButton();
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');
4099 addClass(k
.soundsChatSoundWarning
, 'hidden_elem');
4100 addClass(k
.soundsChatWrap
, 'hidden_elem');
4104 // Initialize the chat sounds options and its HTML template
4105 // Used only on k.soundsInit()
4106 k
._soundsChatLoad = function() {
4107 if (k
.soundsChatLoaded
) {
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
;
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
);
4125 k
.soundsChatLoaded
= true;
4128 // Create a menu item for chat sound options
4129 // Used only on k._soundsChatLoad()
4130 k
._soundsChatLoad_item = function(code
) {
4132 if (userSettings
.chatSoundFile
== code
) {
4136 k
.soundsChatMenu
.createMenuItem({
4137 html: SOUNDS_CHAT
[code
].name
4138 ,title: SOUNDS_CHAT
[code
].title
4141 ,onclick: function(menuItem
, menuClass
) {
4142 if (!SOUNDS_CHAT
[code
] || !SOUNDS_CHAT
[code
].name
) {
4146 userSettings
.chatSoundFile
= code
;
4149 k
._soundsPreview(code
);
4150 changeChatSound(code
);
4152 menuClass
.changeButtonText(menuItem
.getText());
4153 menuClass
.changeChecked(menuItem
);
4155 k
.needToSaveLabel
= true;
4156 k
.updateCloseButton();
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
);
4172 // Chat sounds are already ponified, we need to reload to clear it
4173 k
.needsToRefresh
= true;
4174 k
.updateCloseButton();
4176 k
._soundsChatInit();
4179 // Run a sound preview
4180 k
._soundsPreview = function(code
) {
4182 if (code
== 'AUTO') {
4183 sound
= '_sound/defaultNotification';
4185 var data
= convertCodeToData(REALPONY
);
4186 if (data
.soundNotif
) {
4187 sound
= data
.soundNotif
;
4191 var ps
= initPonySound('soundsTest', THEMEURL
+sound
+'.EXT');
4192 ps
.respectSettings
= false;
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
) {
4210 k
.bgError
= $('ponyhoof_options_background_error');
4211 k
.bgTab
= $('ponyhoof_options_tabs_background');
4212 k
.bgDrop
= $('ponyhoof_options_background_drop');
4214 // Firefox 23 started enforcing a 1MB limit per preference
4215 // http://hg.mozilla.org/mozilla-central/rev/2e46cabb6a11
4217 k
.bgSizeLimit
= 1024 * 512;
4218 k
.bgSizeLimitDescription
= '512 KB';
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');
4227 addClass($('ponyhoof_options_background_cutie'), 'active');
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');
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;
4248 userSettings
.login_bg
= false;
4249 changeCustomBg(null);
4250 k
.bgClearCustomBg
= true;
4252 addClass(parent
, 'active');
4255 k
.needToSaveLabel
= true;
4256 k
.updateCloseButton();
4262 $('ponyhoof_options_background_select').addEventListener('change', function(e
) {
4263 if (this.files
&& this.files
[0]) {
4264 k
.bgProcessFile(this.files
[0]);
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.');
4275 k
.bgInitLoaded
= true;
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');
4286 k
.bgDrop
.addEventListener('drop', function(e
) {
4287 e
.stopPropagation();
4290 removeClass(this, 'ponyhoof_dropping');
4292 if (e
.dataTransfer
.files
&& e
.dataTransfer
.files
[0]) {
4293 k
.bgProcessFile(e
.dataTransfer
.files
[0]);
4297 k
.bgDrop
.addEventListener('dragover', function(e
) {
4298 e
.stopPropagation();
4301 e
.dataTransfer
.dropEffect
= 'copy';
4304 k
.bgDrop
.addEventListener('dragenter', function(e
) {
4305 addClass(k
.bgDrop
, 'ponyhoof_dropping');
4309 k
.bgDrop
.addEventListener('dragend', function(e
) {
4310 removeClass(k
.bgDrop
, 'ponyhoof_dropping')
4314 k
.bgProcessFile = function(file
) {
4315 if (!file
.type
.match(/image.*/)) {
4317 k
.bgError
.textContent
= "The file ("+file
.name
+") doesn't seem to be an image ("+file
.type
+").";
4319 k
.bgError
.textContent
= "The file ("+file
.name
+") doesn't seem to be an image.";
4321 removeClass(k
.bgError
, 'hidden_elem');
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.";
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.";
4331 removeClass(k
.bgError
, 'hidden_elem');
4335 var reader
= new w
.FileReader();
4336 reader
.onload = function(e
) {
4337 addClass(k
.bgError
, 'hidden_elem');
4338 addClass(k
.bgTab
, 'hasCustom');
4340 $$(k
.bgTab
, '.ponyhoof_options_fatradio a', function(ele2
) {
4341 removeClass(ele2
.parentNode
, 'active');
4343 addClass($('ponyhoof_options_background_custom'), 'active');
4344 k
.bgClearCustomBg
= false;
4346 userSettings
.login_bg
= false;
4347 userSettings
.customBg
= e
.target
.result
;
4350 k
.needToSaveLabel
= true;
4351 k
.updateCloseButton();
4353 changeCustomBg(e
.target
.result
);
4355 reader
.onerror = function(e
) {
4356 k
.bgError
.textContent
= "An error occurred reading the file. Please try again.";
4358 removeClass(k
.bgError
, 'hidden_elem');
4360 reader
.readAsDataURL(file
);
4363 k
.disableDomNodeInserted = function() {
4364 k
.soundsChanged(); // to set k.soundsSettingsWrap
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();
4377 option
.disabled
= true;
4378 option
.checked
= false;
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");
4384 var option
= $('ponyhoof_options_'+affectedOptions
[i
]);
4385 option
.disabled
= false;
4386 if (userSettings
[affectedOptions
[i
]]) {
4387 option
.checked
= true;
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');
4398 k
._debugNoMutationObserver();
4401 k
.disableDomNodeInsertedClicked = function() {
4402 if (!userSettings
.disableDomNodeInserted
) {
4403 runDOMNodeInserted();
4405 k
.disableDomNodeInserted();
4408 k
.debug_disablelog = function() {
4409 if ($('ponyhoof_options_debug_disablelog').checked
) {
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
;
4423 k
.disableDialog
.show();
4424 $('ponyhoof_disable_ok').focus();
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>';
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>';
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
);
4446 $('ponyhoof_disable_allowLoginScreen').checked
= !globalSettings
.allowLoginScreen
;
4447 $('ponyhoof_disable_runForNewUsers').checked
= !globalSettings
.runForNewUsers
;
4449 k
.disableDialog
.show();
4450 k
.disableDialog
.onclose = function() {
4454 $('ponyhoof_disable_ok').focus();
4455 $('ponyhoof_disable_ok').addEventListener('click', function() {
4456 userSettings
.theme
= 'NONE';
4459 globalSettings
.allowLoginScreen
= !$('ponyhoof_disable_allowLoginScreen').checked
;
4460 globalSettings
.runForNewUsers
= !$('ponyhoof_disable_runForNewUsers').checked
;
4461 saveGlobalSettings();
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();
4474 $('ponyhoof_disable_no').addEventListener('click', function() {
4475 k
.disableDialog
.close();
4482 k
.browserPonies
= null;
4483 k
.runBrowserPonies = function() {
4485 if (hasClass(link
, 'ponyhoof_browserponies_loading')) {
4489 var alreadyLoaded
= !!k
.browserPonies
;
4490 addClass(link
, 'ponyhoof_browserponies_loading');
4492 if (!alreadyLoaded
) {
4493 k
.browserPonies
= new BrowserPoniesHoof();
4495 k
.browserPonies
.doneCallback = function() {
4497 removeClass(link
, 'ponyhoof_browserponies_loading');
4498 if (!alreadyLoaded
) {
4499 k
.browserPonies
.copyrightDialog();
4501 k
.browserPonies
.createDialog();
4503 k
.browserPonies
.errorCallback = function(error
) {
4504 removeClass(link
, 'ponyhoof_browserponies_loading');
4505 k
.browserPonies
.createErrorDialog(error
);
4507 k
.browserPonies
.run();
4512 k
.checkboxStore
= {};
4513 k
.generateCheckbox = function(id
, label
, data
) {
4518 if ((!data
.global
&& userSettings
[id
]) || (data
.global
&& globalSettings
[id
])) {
4519 checkmark
+= ' CHECKED';
4521 data
.extraClass
= data
.extraClass
|| '';
4523 label
+= ' <a href="#" class="uiHelpLink"></a>';
4524 ex
+= ' data-hover="tooltip" aria-label="'+data
.title
+'"';
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>';
4530 k
.checkboxStore
[id
] = data
;
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>';
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');
4540 if (k
.checkboxStore
[checkmark
]) {
4541 data
= k
.checkboxStore
[checkmark
];
4543 if (data
.tooltipPosition
) {
4544 extras
[i
].parentNode
.setAttribute('data-tooltip-position', data
.tooltipPosition
);
4547 extras
[i
].addEventListener('click', function() {
4548 var checkmark
= this.getAttribute('data-ponyhoof-checkmark');
4550 if (k
.checkboxStore
[checkmark
]) {
4551 data
= k
.checkboxStore
[checkmark
];
4555 userSettings
[checkmark
] = this.checked
;
4558 globalSettings
[checkmark
] = this.checked
;
4559 saveGlobalSettings();
4563 addClass(d
.documentElement
, 'ponyhoof_settings_'+checkmark
);
4565 removeClass(d
.documentElement
, 'ponyhoof_settings_'+checkmark
);
4568 k
.needsToRefresh
= true;
4570 if (data
.customFunc
) {
4574 k
.needToSaveLabel
= true;
4575 k
.updateCloseButton();
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');
4596 k
.tabsExposeDebug
= 0;
4599 k
.switchTab(tabName
);
4605 k
.switchTab = function(tabName
) {
4608 ,'background': k
.bgInit
4609 ,'sounds': k
.soundsInit
4610 ,'extras': k
.extrasInit
4611 ,'advanced': k
.debugInfo
4612 ,'about': k
.loadDonate
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');
4618 if (tabActions
[tabName
]) {
4619 tabActions
[tabName
]();
4623 ponyhoofError(e
.toString());
4626 $$(k
.dialog
.dialog
, '.ponyhoof_tabs_section', function(section
) {
4627 section
.style
.display
= 'none';
4629 $('ponyhoof_options_tabs_'+tabName
).style
.display
= 'block';
4631 k
.dialog
.cardSpaceTick();
4634 k
.saveButtonClick = function() {
4639 k
.dialogOnClose = function() {
4640 d
.removeEventListener('keydown', k
.kf
, true);
4642 if (k
.debugLoaded
) {
4643 if ($('ponyhoof_options_customcss').value
== "Enter any custom CSS to load after Ponyhoof is loaded.") {
4644 userSettings
.customcss
= '';
4646 userSettings
.customcss
= $('ponyhoof_options_customcss').value
;
4649 if (k
.canSaveSettings
) {
4653 if (k
.needsToRefresh
) {
4654 w
.location
.reload();
4658 k
.dialogOnCloseFinish = function() {
4659 k
.saveButton
.getElementsByClassName('uiButtonText')[0].innerHTML
= CURRENTLANG
.close
;
4661 if (k
.canSaveSettings
) {
4662 if (k
.bgClearCustomBg
) {
4663 removeClass(k
.bgTab
, 'hasCustom');
4664 userSettings
.customBg
= null;
4670 k
.updateCloseButton = function() {
4671 var button
= k
.saveButton
.getElementsByClassName('uiButtonText')[0];
4672 var text
= CURRENTLANG
.close
;
4674 if (k
.needToSaveLabel
) {
4675 text
= "Save & Close";
4678 if (k
.needsToRefresh
) {
4679 text
= "Save & Reload";
4682 button
.innerHTML
= text
;
4685 k
.injectStyle = function() {
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;}';
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;}';
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;}';
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;}';
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;}';
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;}';
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;}';
4766 injectManualStyle(css
, 'options');
4769 k
.show = function() {
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
) {
4785 if (k
.ks
.join(',').indexOf(k
.kc
) > -1) {
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;
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('');
4803 $('ponyhoof_kc_share').addEventListener('click', function() {
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
);
4813 d
.addEventListener('keydown', k
.kf
, true);
4817 var optionsGlobal
= null;
4818 function optionsOpen() {
4819 log("Opening options...");
4821 if (!optionsGlobal
) {
4822 optionsGlobal
= new Options();
4824 optionsGlobal
.create();
4825 optionsGlobal
.show();
4827 $$($('ponyhoof_dialog_options'), '#ponyhoof_options_pony .ponyhoof_button_menu', function(button
) {
4835 var WelcomeUI = function(param
) {
4843 k
.dialogFirst
= null;
4844 k
.dialogPinkie
= null;
4845 k
.dialogFinish
= null;
4849 k
.start = function() {
4852 addClass(d
.documentElement
, 'ponyhoof_welcome_html');
4853 statTrack('welcomeUI');
4858 k
.showWelcome = function() {
4859 if ($('ponyhoof_dialog_welcome')) {
4863 addClass(d
.documentElement
, 'ponyhoof_welcome_html_scenery_loaded');
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>';
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>';
4876 bottom
+= '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm uiButtonDisabled" role="button" id="ponyhoof_welcome_next"><span class="uiButtonText">Next</span></a>';
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';
4886 k
.dialogFirst
.changeTitle("Welcome to Ponyhoof, "+BRONYNAME
+"!");
4888 k
.dialogFirst
.changeTitle("Welcome to Ponyhoof!");
4890 k
.dialogFirst
.changeContent(co
);
4891 k
.dialogFirst
.changeBottom(bottom
);
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();
4901 ponySelector
.menu
.afterClose = function() {
4904 addClass($('ponyhoof_welcome_afterClose'), 'show');
4906 addClass(d
.documentElement
, 'ponyhoof_welcome_showmedemo');
4907 if ($('navAccount')) {
4908 addClass($('navAccount'), 'openToggler');
4910 //addClass($('ponyhoof_account_options'), 'active');
4912 w
.setTimeout(function() {
4913 removeClass($('ponyhoof_welcome_next'), 'uiButtonDisabled');
4918 w
.setTimeout(function() {
4919 changeThemeSmart(CURRENTPONY
);
4921 k
._stack
= CURRENTSTACK
;
4923 w
.setTimeout(function() {
4924 var update
= new Updater();
4925 update
.checkForUpdates();
4928 // Detect if the Facebook's chat sound setting is turned off
4929 // We need to do this here as it is async
4931 if (typeof USW
.requireLazy
== 'function') {
4932 USW
.requireLazy(['ChatOptions'], function(ChatOptions
) {
4933 if (!ChatOptions
.getSetting('sound')) {
4934 userSettings
.chatSound
= false;
4939 error("Unable to hook to ChatOptions");
4943 $('ponyhoof_welcome_next').addEventListener('click', function(e
) {
4944 if (hasClass(this, 'uiButtonDisabled')) {
4949 k
.dialogFirst
.close();
4950 fadeOut($('ponyhoof_welcome_scenery'));
4952 w
.setTimeout(function() {
4953 removeClass(d
.documentElement
, 'ponyhoof_welcome_showmedemo');
4954 removeClass($('navAccount'), 'openToggler');
4955 removeClass($('ponyhoof_account_options'), 'active');
4958 userSettings
.theme
= CURRENTPONY
;
4959 userSettings
.chatSound1401
= true;
4960 // Detect Social Fixer
4961 if ($('bfb_options_button')) {
4962 userSettings
.show_messages_other
= false;
4966 globalSettings
.lastVersion
= VERSION
;
4967 saveGlobalSettings();
4969 if (CURRENTPONY
== 'pinkie') {
4972 k
.createFinalDialog();
4979 k
.pinkieWelcome = function() {
4980 removeClass(d
.documentElement
, 'ponyhoof_welcome_html_scenery_loaded');
4986 bottom
+= '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm" role="button" id="ponyhoof_welcome_pinkie_next"><span class="uiButtonText">Stop being silly, Pinkie</span></a>';
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();
4998 k
.dialogPinkie
.onclosefinish = function() {
4999 k
.dialogPinkie
.changeContent('');
5002 $('ponyhoof_welcome_pinkie_next').addEventListener('click', function(e
) {
5003 k
.dialogPinkie
.close();
5008 k
.createFinalDialog = function() {
5009 removeClass(d
.documentElement
, 'ponyhoof_welcome_html');
5010 removeClass(d
.documentElement
, 'ponyhoof_welcome_html_scenery_loaded');
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>';
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>';
5024 c
+= '<a href="'+w
.location
.protocol
+PONYHOOF_URL
+'" target="_top" id="ponyhoof_welcome_posttowall">Visit our Ponyhoof page for the latest news!</a>';
5027 var successText
= '';
5028 var ponyData
= convertCodeToData(REALPONY
);
5029 if (ponyData
.successText
) {
5030 successText
= ponyData
.successText
;
5032 successText
= "Yay!";
5035 k
.dialogFinish
= new Dialog('welcome_final');
5036 if (k
._stack
!= CURRENTSTACK
) {
5037 k
.dialogFinish
.alwaysModal
= true;
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
;
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();
5053 $('ponyhoof_welcomefinal_ok').addEventListener('click', k
.dialogFinishOk
, false);
5054 $('ponyhoof_welcomefinal_ok').focus();
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';
5062 $('ponyhoof_welcome_posttowall').addEventListener('click', function(e
) {
5063 k
.dialogFinish
.onclose = function() {};
5064 k
.dialogFinish
.close();
5068 k
.dialogFinishOk = function(e
) {
5069 if (k
._stack
!= CURRENTSTACK
) {
5070 if (hasClass(this, 'uiButtonDisabled')) {
5074 this.className
+= ' uiButtonDisabled';
5075 w
.location
.reload();
5077 k
.dialogFinish
.close();
5082 k
.createScenery = function() {
5083 if ($('ponyhoof_welcome_scenery')) {
5084 $('ponyhoof_welcome_scenery').style
.display
= 'block';
5088 var n
= d
.createElement('div');
5089 n
.id
= 'ponyhoof_welcome_scenery';
5090 d
.body
.appendChild(n
);
5095 k
.injectStyle = function() {
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)+';}';
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;}';
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;}';
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;}';
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;}';
5122 css
+= '#ponyhoof_welcome_like {border:none;overflow:hidden;width:292px;height:62px;margin:8px 0;display:block;}';
5124 injectManualStyle(css
, 'welcome');
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') {
5140 function changeFavicon(character
) {
5141 if (userSettings
.noFavicon
) {
5145 var favicon
= getFaviconTag();
5148 var newIcon
= favicon
.cloneNode(true);
5150 var newIcon
= d
.createElement('link');
5151 newIcon
.rel
= 'shortcut icon';
5154 if (character
!= 'NONE') {
5155 newIcon
.type
= 'image/png';
5157 var data
= convertCodeToData(character
);
5159 newIcon
.href
= THEMEURL
+data
.icon16
;
5161 newIcon
.href
= THEMEURL
+character
+'/icon16.png';
5164 newIcon
.type
= 'image/x-icon';
5165 newIcon
.href
= '//fbstatic-a.akamaihd.net/rsrc.php/y9/r/FXHC9IQ-JIj.ico';
5169 favicon
.parentNode
.replaceChild(newIcon
, favicon
);
5171 d
.head
.appendChild(newIcon
);
5175 function changeStack(character
) {
5176 var pony
= convertCodeToData(character
);
5177 CURRENTSTACK
= STACKS_LANG
[0];
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
];
5187 if (UILANG
== 'fb_LT') {
5188 if (CURRENTSTACK
['people'] == 'ponies') {
5189 CURRENTSTACK
['people'] = 'pwnies';
5191 if (CURRENTSTACK
['person'] == 'pony') {
5192 CURRENTSTACK
['person'] = 'pwnie';
5194 if (CURRENTSTACK
['like'] == 'brohoof') {
5195 CURRENTSTACK
['like'] = '/)';
5197 if (CURRENTSTACK
['likes'] == 'brohoofs') {
5198 CURRENTSTACK
['likes'] = '/)';
5200 //if (CURRENTSTACK['unlike'] == 'unbrohoof') {
5201 // CURRENTSTACK['unlike'] = '/)(\\';
5203 if (CURRENTSTACK
['like_past'] == 'brohoof') {
5204 CURRENTSTACK
['like_past'] = '/)';
5206 if (CURRENTSTACK
['likes_past'] == 'brohoofs') {
5207 CURRENTSTACK
['likes_past'] = '/)';
5209 if (CURRENTSTACK
['liked'] == 'brohoof\'d') {
5210 CURRENTSTACK
['liked'] = '/)';
5212 if (CURRENTSTACK
['liked_button'] == 'brohoof\'d') {
5213 CURRENTSTACK
['liked_button'] = '/)';
5215 if (CURRENTSTACK
['liking'] == 'brohoofing') {
5216 CURRENTSTACK
['liking'] = '/)';
5221 var changeThemeFuncQueue
= [];
5222 function changeTheme(character
) {
5223 addClass(d
.documentElement
, 'ponyhoof_injected');
5225 REALPONY
= character
;
5226 d
.documentElement
.setAttribute('data-ponyhoof-character', character
);
5228 changeFavicon(character
);
5229 changeStack(character
);
5232 if (changeThemeFuncQueue
) {
5233 for (var x
in changeThemeFuncQueue
) {
5234 if (changeThemeFuncQueue
.hasOwnProperty(x
) && changeThemeFuncQueue
[x
]) {
5235 changeThemeFuncQueue
[x
]();
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
;
5247 addClass(d
.documentElement
, 'ponyhoof_initial');
5248 w
.setTimeout(function() {
5249 removeClass(d
.documentElement
, 'ponyhoof_initial');
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
);
5259 changeCostume(userSettings
.costume
);
5262 function getRandomPony() {
5264 var r
= randNum(0, PONIES
.length
-1);
5265 if (!PONIES
[r
].hidden
) {
5266 return PONIES
[r
].code
;
5271 function getRandomMane6() {
5273 var r
= randNum(0, PONIES
.length
-1);
5274 if (PONIES
[r
].mane6
) {
5275 return PONIES
[r
].code
;
5280 function convertCodeToData(code
) {
5281 for (var i
= 0, len
= PONIES
.length
; i
< len
; i
+= 1) {
5282 if (PONIES
[i
].code
== code
) {
5290 function changeThemeSmart(theme
) {
5293 removeClass(d
.documentElement
, 'ponyhoof_injected');
5294 changeFavicon('NONE');
5295 changeCostume(null);
5297 var style
= $('ponyhoof_userscript_style');
5299 style
.parentNode
.removeChild(style
);
5305 if (userSettings
.randomPonies
) {
5306 current
= userSettings
.randomPonies
.split('|');
5307 changeTheme(current
[Math
.floor(Math
.random() * current
.length
)]);
5309 changeTheme(getRandomPony());
5315 if (theme
== 'login' || convertCodeToData(theme
)) {
5318 error("changeThemeSmart: "+theme
+" is not a valid theme");
5319 userSettings
.theme
= null;
5320 CURRENTPONY
= REALPONY
= 'NONE';
5326 function changeCustomBg(base64
) {
5328 removeClass(d
.documentElement
, 'ponyhoof_settings_login_bg');
5329 removeClass(d
.documentElement
, 'ponyhoof_settings_customBg');
5331 var style
= $('ponyhoof_style_custombg');
5333 style
.parentNode
.removeChild(style
);
5338 addClass(d
.documentElement
, 'ponyhoof_settings_login_bg');
5339 addClass(d
.documentElement
, 'ponyhoof_settings_customBg');
5341 if (!$('ponyhoof_style_custombg')) {
5342 injectManualStyle('', 'custombg');
5344 $('ponyhoof_style_custombg').textContent
= '/* '+SIG
+' */html,.fbIndex{background-position:center center !important;background-image:url("'+base64
+'") !important;}';
5347 var changeCostume = function(costume
) {
5348 // Make sure the costume exists
5349 if (!COSTUMESX
[costume
]) {
5354 // Make sure the character has the costume
5355 if (!doesCharacterHaveCostume(REALPONY
, costume
)) {
5356 //removeCostume(); // leaving the costume alone wouldn't hurt...
5360 d
.documentElement
.setAttribute('data-ponyhoof-costume', costume
);
5363 var removeCostume = function() {
5364 d
.documentElement
.removeAttribute('data-ponyhoof-costume');
5367 var doesCharacterHaveCostume = function(character
, costume
) {
5368 return (COSTUMESX
[costume
] && COSTUMESX
[costume
].characters
&& COSTUMESX
[costume
].characters
.indexOf(character
) != -1);
5371 function getBronyName() {
5372 var name
= d
.querySelector('.headerTinymanName, #navTimeline > .navLink, .fbxWelcomeBoxName, ._521h ._4g5y, .-cx-PRIVATE-litestandSidebarBookmarks__profilewrapper .-cx-PRIVATE-litestandSidebarBookmarks__name');
5374 BRONYNAME
= name
.textContent
;
5380 function getDefaultUiLang() {
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
);
5395 var screenSaverTimer
= null;
5396 var screenSaverActive
= false;
5397 var screenSaverInactivity = function() {
5398 if (!screenSaverActive
) {
5399 addClass(d
.body
, 'ponyhoof_screensaver');
5401 screenSaverActive
= true;
5403 var screenSaverActivity = function() {
5404 if (screenSaverActive
) {
5405 removeClass(d
.body
, 'ponyhoof_screensaver');
5407 screenSaverActive
= false;
5409 w
.clearTimeout(screenSaverTimer
);
5410 screenSaverTimer
= w
.setTimeout(screenSaverInactivity
, 30000);
5412 var screenSaverActivate = function() {
5416 d
.addEventListener('click', screenSaverActivity
, true);
5417 d
.addEventListener('mousemove', function(e
) {
5418 if (mousemoveX
== e
.clientX
&& mousemoveY
== e
.clientY
) {
5421 mousemoveX
= e
.clientX
;
5422 mousemoveY
= e
.clientY
;
5424 screenSaverActivity();
5426 d
.addEventListener('keydown', screenSaverActivity
, true);
5427 d
.addEventListener('contextmenu', screenSaverActivity
, true);
5428 d
.addEventListener('mousewheel', screenSaverActivity
, true);
5429 d
.addEventListener('touchstart', screenSaverActivity
, true);
5431 screenSaverActivity();
5435 var domReplaceText = function(ele
, cn
, deeper
, regex
, text
) {
5437 var id
= ele
.getAttribute('id');
5438 if ((cn
== '' && deeper
== '') || (cn
&& hasClass(ele
, cn
)) || (cn
&& id
&& id
== nc
)) {
5440 t
= t
.replace(regex
, text
);
5441 if (ele
.innerHTML
!= t
) {
5449 var query
= ele
.querySelectorAll(deeper
);
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
;
5462 var _fb_input_placeholderChanged
= false;
5463 var domChangeTextbox = function(ele
, cn
, text
) {
5464 var query
= ele
.querySelectorAll(cn
);
5465 if (!query
.length
) {
5468 if (!_fb_input_placeholderChanged
) {
5469 contentEval(function(arg
) {
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
);
5479 textbox
.setAttribute('data-ponyhoof-ponified-overridefb', 1);
5481 // we already overridden, now FB wants to change the placeholder
5482 if (textbox
.getAttribute('placeholder') == '' && t
) {
5483 if (textbox
.title
) {
5485 _setPlaceholder(textbox
, textbox
.title
);
5487 // for typeahead (share dialog > private message)
5488 _setPlaceholder(textbox
, t
);
5490 } else if (t
== '') {
5491 // allow blanking placeholder (for typeahead)
5492 _setPlaceholder(textbox
, t
);
5499 if (arg
.CANLOG
&& typeof console
!= 'undefined' && console
.log
&& console
.dir
) {
5500 console
.log("Unable to override Input.setPlaceholder()");
5504 }, {"CANLOG":CANLOG
});
5505 _fb_input_placeholderChanged
= true;
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')) {
5514 textbox
.setAttribute('data-ponyhoof-ponified', 1);
5516 if (typeof text
== 'function') {
5517 placeholders
[i
] = text(textbox
);
5519 placeholders
[i
] = text
;
5522 textbox
.title
= placeholders
[i
];
5523 textbox
.setAttribute('aria-label', placeholders
[i
]);
5524 textbox
.setAttribute('placeholder', placeholders
[i
]);
5526 if (hasClass(textbox
, 'DOMControl_placeholder')) {
5527 textbox
.value
= placeholders
[i
];
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]);
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
) {
5553 if (textbox
.value
== '' || hasClass(textbox
, 'DOMControl_placeholder')) {
5554 if (placeholders
[i
]) {
5555 addClass(textbox
, 'DOMControl_placeholder');
5557 removeClass(textbox
, 'DOMControl_placeholder');
5559 textbox
.value
= placeholders
[i
] || '';
5566 error("Unable to hook to TextAreaControl");
5571 var domReplaceFunc = function(ele
, cn
, deeper
, func
) {
5572 if (!ele
|| (cn
== '' && deeper
== '')) {
5576 var id
= ele
.getAttribute('id');
5577 if ((cn
&& hasClass(ele
, cn
)) || (cn
&& id
&& id
== cn
)) {
5583 var query
= ele
.querySelectorAll(deeper
);
5585 for (var i
= 0, len
= query
.length
; i
< len
; i
+= 1) {
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]);
5598 if (arr
[i
][0].toLowerCase() == lowercase
) {
5607 var loopChildText = function(ele
, func
) {
5608 if (!ele
|| !ele
.childNodes
) {
5611 for (var i
= 0, len
= ele
.childNodes
.length
; i
< len
; i
+= 1) {
5612 func(ele
.childNodes
[i
]);
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
);
5631 ,["Done Editing", "Eeyup"]
5632 ,["Save Changes", "Eeyup"]
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"]
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']]
5663 ,["Likes", capitaliseFirstLetter(CURRENTSTACK
['likes'])]
5664 ,["Friends' Posts", capitaliseFirstLetter(CURRENTSTACK
['friends'])+"' Posts"]
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"]
5673 ,["Delete and Ban User", "Nuke and Banish to Moon"]
5674 ,["Remove from Friends", "Banish to Moon"]
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"]
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"]
5701 ,["Messages", "Trough"]
5702 ,["New Message", "Write a Friendship Report"]
5703 ,["Other Messages", "Other Friendship Reports"]
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"]
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"]
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"]
5744 ,["Friend Activity", capitaliseFirstLetter(CURRENTSTACK
['friend'])+" Activity"]
5745 ,["Activity Log", "Adventure Log"]
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"]
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
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"]
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"]
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"]
5791 ,["Photo", "Pony Pic"]
5792 ,["Question", "Query"]
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"]
5809 ,["Pages I like", "Pages I "+capitaliseFirstLetter(CURRENTSTACK
.like
)]
5810 ,["My Friends", "My "+capitaliseFirstLetter(CURRENTSTACK
.friends
)]
5811 ,["Tell Friends", "Tell "+capitaliseFirstLetter(CURRENTSTACK
.friends
)]
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
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
5836 ,["Likers", "Brohoofers"] // @todo likers
5837 ,["Liked by", CURRENTSTACK
['liked']+" by"] // @todo likers
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"]
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"]
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"]
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"]
5886 ,["Likes", capitaliseFirstLetter(CURRENTSTACK
['likes'])]
5887 ,["Edit Featured Likes", "Edit Featured "+capitaliseFirstLetter(CURRENTSTACK
['likes'])]
5888 ,["Change Date", "Time Travel"]
5889 ,["Date Saved", "Time Traveled"]
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"]
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"]
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
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
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"]
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"]
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?"]
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"]
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
)]
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"]
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"]
6047 ,["Create New App", "Create New Magic"]
6048 ,["Add Test Users to other Apps", "Add Test Users to other Magic"]
6050 ,["Hidden in Groups", "Hidden in Herds"] // timeline
6052 if (ponyData
.successText
) {
6053 dialogTitles
.push(["Success", ponyData
.successText
]);
6054 dialogTitles
.push(["Success!", ponyData
.successText
]);
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)
6098 ,["Show comments", "Show friendship letters"]
6099 ,["Comment deleted", "Friendship letter nuked"]
6100 ,[/Comments/, "Friendship Letters"]
6101 ,[/Comment/, "Friendship Letter"]
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"]
6114 ,["Delete and Ban", "Nuke and Banish"]
6115 ,["Report Place", "Whine About Place"]
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"]
6123 //,[/likes? this/g, "brohoof'd this"]
6124 ,["Sent from chat", "Sent from whinny chat"]
6125 ,["New Message", "Write a Friendship Report"]
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."]
6134 ,["Status", "Take a Note"]
6135 ,["Photo / Video", "Add a Pic"]
6136 ,["Event, Milestone +", "Adventure, Milestone +"]
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."]
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"]
6149 ,["View Photo", "View Pony Pic"]
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
6161 ,["Attach a Photo", "Attach a Pony Pic"]
6162 ,["Remove Photo", "Nuke Pony Pic"]
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
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."]
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"]
6179 if (ponyData
.loadingText
) {
6180 tooltipTitles
.push(["Loading...", ponyData
.loadingText
]);
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"]
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"]
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"]
6225 ,["Groups", "Herds"]
6226 //,["Pages and Ads", "Landmarks and Ads"]
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
)]
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"]
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"]
6254 ,["Posts in Groups", "Posts in Herds"]
6255 ,["People", capitaliseFirstLetter(CURRENTSTACK
['people'])]
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'])]
6269 ,["Invite Friends You Email", "Invite "+capitaliseFirstLetter(CURRENTSTACK
['friends'])+" You Email "]
6270 ,["Invite Your Friends", "Invite Your "+capitaliseFirstLetter(CURRENTSTACK
['friends'])]
6272 ,["Account Groups", "Account Herds"]
6273 ,["Ads Email Notifications", "Ads Email Soarks"]
6274 ,["Ads Notifications on Facebook", "Ads Sparks on Facebook"]
6276 ,["App Restrictions", "Magic Restrictions"]
6277 ,["App Info", "Magic Info"]
6279 ,["Tagged Photos", "Tagged Pony Pics"]
6281 ,["Add Groups", "Add Herds"] // /addgroup
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..."]
6300 ,["Mutual Friends", "Mutual "+capitaliseFirstLetter(CURRENTSTACK
['friends'])]
6301 ,["People You May Know", "Ponies You May Know"]
6302 ,["Poke...", "Nuzzle..."]
6304 ,["All Friends", "All "+capitaliseFirstLetter(CURRENTSTACK
['friends'])]
6305 ,["All friends", "All "+CURRENTSTACK
['friends']]
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"]
6312 ,["Friends' Posts", capitaliseFirstLetter(CURRENTSTACK
['friends'])+"' Posts"]
6313 ,["Friend Activity", capitaliseFirstLetter(CURRENTSTACK
['friend'])+" Activity"]
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"]
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"]
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..."]
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'])]
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."]
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"]
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"]
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
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"]
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"]
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"]
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"]
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"]
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"]
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
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..."]
6507 ,["Photo", "Pony Pic"]
6508 ,["Question", "Query"]
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"]
6516 ,["Page Likes", "Page "+capitaliseFirstLetter(CURRENTSTACK
.likes
)]
6517 ,["Mentions and Photo Tags", "Mentions and Pony Pic Tags"]
6519 ,["Suggest photos", "Suggest pony pics"]
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"]
6525 ,["The app sends you a notification", "The magic sends you a spark"]
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
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"]
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..."]
6552 dialogDerpTitles
= [
6553 "Insufficient send permissions"
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"
6561 ,"Block! You are engaging in behavior that may be considered annoying or abusive by other users."
6562 ,"Already connected."
6565 ,"Failure to hide minifeed story."
6566 ,"Object cannot be liked"
6567 ,"Sorry, something went wrong"
6568 ,"Authentication Failure"
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"
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"
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"
6591 ,"Mark as Spam Failed"
6592 ,"Could not post to Wall"
6594 ,"Messages Unavailable"
6595 ,"Don't have Permission"
6596 ,"No file specified."
6599 ,"Vote submission failed."
6600 ,"Web Address is Invalid"
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"
6614 ,"Invalid Custom Privacy Setting"
6615 ,"Empty Friend List"
6616 ,"Unable to Add Attachment"
6617 ,"Unable to Change Date"
6619 ,"Your Page Can't Be Promoted"
6621 ,"An error occurred."
6622 ,"Image Resource Invalid"
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"]
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?"]
6645 ,["Report this if it's not relevant to your search results.", "Whine about this if it's not relevant to your search results."]
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?"]
6651 var DOMNodeInserted = function(dom
) {
6652 domNodeHandlerMain
.run(dom
);
6655 var domNodeHandler = function() {
6657 k
.snowliftPinkieInjected
= false;
6659 k
.run = function(dom
) {
6660 if (INTERNALUPDATE
) {
6664 if (k
.shouldIgnore(dom
)) {
6670 // Start internal update
6671 var iu
= INTERNALUPDATE
;
6672 INTERNALUPDATE
= true;
6675 if (dom
.target
.parentNode
&& dom
.target
.parentNode
.parentNode
) {
6677 var replacer
= buttonTitles
;
6678 if (hasClass(dom
.target
.parentNode
, 'uiButtonText')) {
6679 var buttonText
= dom
.target
.parentNode
;
6680 var button
= dom
.target
.parentNode
.parentNode
;
6683 if (button
.parentNode
&& button
.parentNode
.parentNode
&& hasClass(button
.parentNode
.parentNode
, 'audienceSelector')) {
6684 replacer
= menuPrivacyOnlyTitles
;
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
;
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
;
6702 if (buttonText
.nodeType
== 3) {
6703 var orig
= buttonText
.textContent
;
6705 var orig
= buttonText
.innerHTML
;
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
) {
6713 if (button
.title
== '') {
6714 // tooltip is blank, so it would be OK to set our own
6715 button
.title
= orig
;
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
;
6726 button
.setAttribute('data-ponyhoof-button-orig', orig
);
6727 button
.setAttribute('data-ponyhoof-button-text', replaced
);
6729 if (orig
!= replaced
) {
6730 if (buttonText
.nodeType
== 3) {
6731 buttonText
.textContent
= replaced
;
6733 buttonText
.innerHTML
= replaced
;
6740 if (dom
.target
.nodeType
== 3) {
6742 // firefox in mutationObserver goes to here when it should be characterData
6743 k
.mutateCharacterData(dom
);
6744 INTERNALUPDATE
= iu
;
6748 injectOptionsLink();
6750 k
.snowliftPinkie(dom
);
6751 k
.notificationsFlyoutSettings(dom
);
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>
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>
6761 var replacer
= buttonTitles
;
6762 var tagName
= ele
.tagName
.toUpperCase();
6763 if (tagName
!= 'A' && tagName
!= 'LABEL' && tagName
!= 'BUTTON') {
6764 button
= ele
.parentNode
;
6767 var potentialLabel
= button
.querySelector('._6q-, .-cx-PUBLIC-mercuryComposer__button');
6768 if (potentialLabel
) {
6769 ele
= potentialLabel
;
6772 var potentialLabel
= button
.querySelector('._55pe, .-cx-PUBLIC-abstractPopoverButton__label');
6773 if (potentialLabel
) {
6774 ele
= potentialLabel
;
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>
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];
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')*/)
6789 if (button
.parentNode
&& button
.parentNode
.parentNode
&& hasClass(button
.parentNode
.parentNode
, 'audienceSelector')) {
6790 replacer
= menuPrivacyOnlyTitles
;
6793 if (tagName
== 'INPUT') {
6794 var orig
= ele
.value
;
6795 button
.setAttribute('data-ponyhoof-button-orig', orig
);
6796 var replaced
= replaceText(replacer
, orig
);
6798 k
.changeButtonText(ele
, 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
;
6811 button
.setAttribute('data-ponyhoof-button-orig', orig
);
6814 if (orig
!= replaced
) {
6815 if (button
.getAttribute('data-hover') != 'tooltip') {
6816 if (button
.title
== '') {
6817 button
.title
= orig
;
6821 button
.setAttribute('data-ponyhoof-button-text', replaced
);
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
) {
6831 var groupsJumpBarTop
= dom
.target
.getElementsByClassName('groupsJumpBarTop');
6832 if (!groupsJumpBarTop
.length
) {
6835 groupsJumpBarTop
= groupsJumpBarTop
[0];
6837 var rfloat
= groupsJumpBarTop
.getElementsByClassName('rfloat');
6838 if (!rfloat
.length
) {
6843 var groupsCleanLinks
= groupsJumpBarTop
.getElementsByClassName('groupsCleanLinks');
6844 if (!groupsCleanLinks
.length
) {
6847 groupsCleanLinks
= groupsCleanLinks
[0];
6849 groupsJumpTitle
.style
.maxWidth
= (800 - ((groupsCleanLinks
.offsetWidth
|| 0) + (rfloat
.offsetWidth
|| 0) - (groupsJumpTitle
.offsetWidth
|| 0)) - 10) + 'px';
6855 k
.ufiPagerLink(dom
);
6857 if (k
.reactRoot(dom
)) {
6858 INTERNALUPDATE
= iu
;
6864 if (k
.ticker(dom
)) {
6865 INTERNALUPDATE
= iu
;
6869 domReplaceFunc(dom
.target
, '', '.inCommonSectionList, #fbTimelineHeadline .name h2 > div, ._8yb, .-cx-PRIVATE-fbEntstreamAttachmentAvatar__secondarydetaillist, ._508a, .-cx-PRIVATE-pageLikeStory__fancountfooter, .permalinkHeaderInfo > .subscribeOrLikeSentence > .fwn', k
.textBrohoof
);
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
) {
6881 k
.tooltip(dom
.target
);
6883 domReplaceFunc(dom
.target
, 'egoProfileTemplate', '.egoProfileTemplate', function(ele
) {
6884 if (ele
.getAttribute('data-ponyhoof-ponified')) {
6887 var div
= ele
.getElementsByTagName('div');
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
;
6898 var action
= ele
.getElementsByClassName('uiIconText');
6899 if (action
.length
) {
6901 ele
.setAttribute('data-ponyhoof-iconText', action
.textContent
);
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
;
6911 ele
.setAttribute('data-ponyhoof-ponified', 1);
6914 domReplaceFunc(dom
.target
, 'uiInterstitial', '.uiInterstitial', function(ele
) {
6915 if (ele
.getAttribute('data-ponyhoof-ponified')) {
6918 ele
.setAttribute('data-ponyhoof-ponified', 1);
6920 var title
= ele
.getElementsByClassName('uiHeaderTitle');
6924 title
= ele
.querySelector('.fsxl.fwb');
6929 ele
.setAttribute('data-ponyhoof-inters-title', title
.textContent
);
6932 domReplaceFunc(dom
.target
, 'uiLayer', '.uiLayer', function(ele
) {
6933 if (ele
.getAttribute('data-ponyhoof-dialog-title')) {
6937 var titlebar
= ele
.querySelector('.-cx-PUBLIC-uiDialog__title, ._t ._1yw, ._4-i0, .-cx-PRIVATE-xuiDialog__title, .overlayTitle, .fbCalendarOverlayHeader');
6939 var titletext
= ele
.querySelector('._52c9, .-cx-PRIVATE-xuiDialog__titletext');
6941 titletext
= titlebar
;
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
;
6955 addClass(titlebar
, 'ponyhoof_fbdialog_title');
6956 if (orig
!= replaced
) {
6957 titlebar
.title
= orig
;
6960 addClass(ele
, 'ponyhoof_fbdialog');
6961 ele
.setAttribute('data-ponyhoof-dialog-title', replaced
);
6962 ele
.setAttribute('data-ponyhoof-dialog-orig', orig
);
6964 var body
= ele
.querySelector('._t ._13, .-cx-PRIVATE-uiDialog__body, ._4-i2, .-cx-PRIVATE-xuiDialog__body, .uiLayerPageContent > .pvm');
6966 addClass(body
, 'ponyhoof_fbdialog_body');
6969 loopChildText(body
, function(child
) {
6973 if (child
.nodeType
== TEXT_NODE
) {
6974 var replaced
= replaceText(dialogDescriptionTitles
, child
.textContent
);
6975 if (child
.textContent
!= replaced
) {
6976 child
.textContent
= replaced
;
6982 k
._dialog_insertReadme(body
);
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
);
6992 domChangeTextbox(ele
, '.groupsMemberFlyoutWelcomeTextarea', function(textbox
) {
6993 var orig
= textbox
.getAttribute('placeholder');
6994 var t
= orig
.replace(/\bgroup\b/, 'herd');
6998 return "Welcome him/her to the herd...";
7000 domChangeTextbox(ele
, '.fbEventMemberComment', function(textbox
) {
7001 var orig
= textbox
.getAttribute('placeholder');
7002 var t
= orig
.replace(/\bevent\b/, 'adventure');
7006 return orig
; // for pages "Write something to let her know you're going too."
7010 $$(ele
, '._7lo > .fcg, .-cx-PRIVATE-hovercard__footer > .fcg', function(footer
) {
7011 loopChildText(footer
, k
.textBrohoof
);
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', '');
7023 domReplaceFunc(dom
.target
, '', '.uiHeaderTitle, .legacyContextualDialogTitle, ._6dp, .-cx-PRIVATE-litestandRHC__titlename', function(ele
) {
7024 var imgwrap
= ele
.querySelector('._8m, .-cx-PRIVATE-uiImageBlock__content, .adsCategoryTitleLink');
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
;
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
;
7046 if (k
.fbDockChatBuddylistNub(dom
.target
)) {
7047 INTERNALUPDATE
= iu
;
7051 if (k
.pokesDashboard(dom
.target
)) {
7052 INTERNALUPDATE
= iu
;
7056 k
.commentBrohoofed(dom
);
7058 k
.changeCommentBox(dom
);
7059 k
.changeComposer(dom
);
7061 k
.notification(dom
);
7063 k
.fbRemindersStory(dom
.target
);
7064 if (k
.flyoutLikeForm(dom
.target
)) {
7065 INTERNALUPDATE
= iu
;
7068 k
.pluginButton(dom
.target
);
7069 k
.insightsCountry(dom
);
7070 k
.timelineMutualLikes(dom
.target
);
7071 k
.videoStageContainer(dom
.target
);
7072 k
.uiStreamShareLikePageBox(dom
.target
);
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");
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
;
7089 return CURRENTLANG
.fb_search_box
;
7092 k
.ponyhoofPageOptions(dom
);
7093 if (userSettings
.debug_betaFacebookLinks
&& w
.location
.hostname
== 'beta.facebook.com') {
7094 k
.debug_betaFacebookLinks(dom
.target
);
7097 INTERNALUPDATE
= iu
;
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
;
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
);
7116 k
.notificationsFlyoutSettingsInjected
= false;
7117 k
.notificationsFlyoutSettings = function(dom
) {
7119 k
.notificationsFlyoutSettingsInjected
= true;
7122 if (!k
.notificationsFlyoutSettingsInjected
) {
7123 var jewel
= $('fbNotificationsJewel');
7125 var header
= jewel
.getElementsByClassName('uiHeaderTop');
7126 if (!header
.length
|| !header
[0].childNodes
|| !header
[0].childNodes
.length
) {
7131 var settingsLink
= d
.createElement('a');
7132 settingsLink
.href
= '#';
7133 settingsLink
.textContent
= 'Ponyhoof Sounds';
7135 var actions
= jewel
.getElementsByClassName('uiHeaderActions');
7136 if (actions
.length
) {
7137 actions
= actions
[0];
7138 var span
= d
.createElement('span');
7139 span
.innerHTML
= ' · ';
7141 actions
.appendChild(span
);
7142 actions
.appendChild(settingsLink
);
7144 var rfloat
= d
.createElement('div');
7145 rfloat
.className
= 'rfloat';
7146 rfloat
.appendChild(settingsLink
);
7147 header
.insertBefore(rfloat
, header
.childNodes
[0]);
7150 settingsLink
.addEventListener('click', function(e
) {
7153 if (!optionsGlobal
) {
7154 optionsGlobal
= new Options();
7156 optionsGlobal
.create();
7157 optionsGlobal
.switchTab('sounds');
7158 optionsGlobal
.show();
7161 clickLink(jewel
.getElementsByClassName('jewelButton')[0]);
7165 k
.notificationsFlyoutSettingsInjected
= true;
7170 k
.textNodes = function(dom
) {
7172 if (!dom
.target
.parentNode
|| !dom
.target
.parentNode
.parentNode
|| !hasClass(dom
.target
.parentNode
.parentNode
, 'dialog_title')) {
7176 var title
= dom
.target
.parentNode
.parentNode
;
7177 var orig
= dom
.target
.textContent
;
7178 var replaced
= replaceText(dialogTitles
, orig
);
7180 if (dom
.target
.textContent
!= replaced
) {
7181 dom
.target
.textContent
= replaced
;
7183 addClass(title
, 'ponyhoof_fbdialog_title');
7184 if (orig
!= replaced
) {
7188 k
.getParent(title
, function(ele
) {
7189 return hasClass(ele
, 'generic_dialog');
7191 if (hasClass(ele
, 'fbQuestionsPopup')) {
7195 addClass(ele
, 'ponyhoof_fbdialog');
7196 ele
.setAttribute('data-ponyhoof-dialog-title', replaced
);
7197 ele
.setAttribute('data-ponyhoof-dialog-orig', orig
);
7199 var body
= ele
.getElementsByClassName('dialog_body');
7202 addClass(body
, 'ponyhoof_fbdialog_body');
7204 var confirmation_message
= body
.getElementsByClassName('confirmation_message');
7205 if (confirmation_message
.length
) {
7206 confirmation_message
= confirmation_message
[0];
7209 loopChildText(confirmation_message
, function(child
) {
7213 if (child
.nodeType
== TEXT_NODE
) {
7214 var replaced
= replaceText(dialogDescriptionTitles
, child
.textContent
);
7215 if (child
.textContent
!= replaced
) {
7216 child
.textContent
= replaced
;
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) {
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
) {
7232 child
.textContent
= texts
[i
];
7240 k
._dialog_playSound(replaced
, ele
);
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
) {
7260 k
.postLike = function(dom
) {
7261 if (hasClass(dom
.target
, 'uiUfiLike') || hasClass(dom
.target
, 'UFILikeSentence')) {
7262 k
._likePostBox(dom
.target
);
7264 /*if (dom.target.parentNode) {
7265 if (hasClass(dom.target.parentNode, 'UFILikeSentence')) {
7266 k._likePostBox(dom.target);
7270 domReplaceFunc(dom
.target
, '', '.uiUfiLike, .UFILikeSentence', k
._likePostBox
);
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');
7278 var inner
= ele
.getElementsByClassName('UFILikeSentenceText');
7281 var t
= k
.likeSentence(inner
.innerHTML
);
7282 if (inner
.innerHTML
!= t
) {
7283 inner
.innerHTML
= t
;
7287 var reorder
= ele
.getElementsByClassName('UFIOrderingModeSelectorDownCaret');
7288 if (reorder
.length
) {
7289 reorder
= reorder
[0];
7290 if (reorder
.previousSibling
) {
7291 k
.UFIOrderingMode(reorder
.previousSibling
);
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');
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
;
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
;
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';
7344 domReplaceFunc(dom
.target
, '', targets
, k
._commentLikeLink
);
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
;
7353 k
._likeDesc
= LANG
['en_US'].sniff_comment_tooltip_like
;
7355 if (LANG
[locale
] && LANG
[locale
].sniff_comment_tooltip_unlike
) {
7356 k
._unlikeDesc
= LANG
[locale
].sniff_comment_tooltip_unlike
;
7358 k
._unlikeDesc
= LANG
['en_US'].sniff_comment_tooltip_unlike
;
7361 k
._likeConditions
= [
7362 k
._likeDesc
, k
._unlikeDesc
,
7363 capitaliseFirstLetter(CURRENTSTACK
.like
)+" this friendship letter", capitaliseFirstLetter(CURRENTSTACK
.unlike
)+" this friendship letter"
7365 k
._likeIsLikeConditions
= [
7367 capitaliseFirstLetter(CURRENTSTACK
.like
)+" this friendship letter"
7372 k
._commentLikeLink = function(ele
) {
7373 k
.commentLikeDescInit();
7376 var likeThumb
= false;
7377 if (k
._likeConditions
.indexOf(ele
.title
) == -1) {
7379 var trackingNode
= k
.getTrackingNode(ele
);
7380 if (trackingNode
== k
.FB_TN_LIKELINK
|| trackingNode
== k
.FB_TN_UNLIKELINK
) {
7382 } else if (!USINGMUTATION
&& hasClass(ele
, 'UFILikeThumb')) {
7393 if (!hasClass(ele
, 'ponyhoof_brohoof_button')) {
7394 if (!USINGMUTATION
) {
7395 ele
.addEventListener('click', function() {
7397 k
.delayIU(function() {
7399 // UFILikeThumb disappears after a post is brohoof'd
7400 k
._likeBrohoofMagic(ele
, false);
7402 k
._commentLikeLink(ele
);
7407 addClass(ele
, 'ponyhoof_brohoof_button');
7411 if (k
.getTrackingNode(ele
) == k
.FB_TN_LIKELINK
|| likeThumb
|| k
._likeIsLikeConditions
.indexOf(ele
.title
) != -1) {
7415 k
._likeBrohoofMagic(ele
, isLike
);
7418 k
._likeBrohoofMagic = function(ele
, isLike
) {
7419 var comment
= k
.getReactComment(ele
);
7422 removeClass(ele
, 'ponyhoof_brohoof_button_unbrohoof');
7423 title
= capitaliseFirstLetter(CURRENTSTACK
.like
)+" this";
7425 addClass(ele
, 'ponyhoof_brohoof_button_unbrohoof');
7426 title
= capitaliseFirstLetter(CURRENTSTACK
.unlike
)+" this";
7429 title
+= " friendship letter";
7431 ele
.setAttribute('data-ponyhoof-title', ele
.title
);
7433 ele
.setAttribute('data-ponyhoof-title-modified', title
);
7436 k
._markCommentLiked(comment
, isLike
);
7438 // Fix an edge case with jump to comment
7439 if (hasClass(comment
, 'highlightComment')) {
7440 w
.setTimeout(function() {
7441 k
._markCommentLiked(comment
, isLike
);
7445 k
.delayIU(function() {
7446 if (!ele
.parentNode
) {
7447 var ufi
= k
.getReactUfi(ele
);
7454 k
.getParent(ele
, function(form
) {
7455 return (form
.tagName
.toUpperCase() == 'FORM' && hasClass(form
, 'commentable_item'));
7460 var ufi
= form
.getElementsByClassName('UFIList');
7465 if (!ufi
.parentNode
) {
7470 removeClass(ufi
.parentNode
, 'ponyhoof_brohoofed');
7472 addClass(ufi
.parentNode
, 'ponyhoof_brohoofed');
7479 k
._markCommentLiked = function(ufiitem
, isLike
) {
7481 if (ufiitem
.childNodes
&& ufiitem
.childNodes
[0]) {
7482 child
= ufiitem
.childNodes
[0];
7485 removeClass(ufiitem
, 'ponyhoof_comment_liked');
7487 removeClass(child
, 'ponyhoof_comment_liked');
7490 addClass(ufiitem
, 'ponyhoof_comment_liked');
7492 addClass(child
, 'ponyhoof_comment_liked');
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
);
7504 return id
.substring(k
.REACTROOTID
.length
, id
.indexOf(']'));
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');
7516 k
._beepNotification_change(dom
.target
, info
, k
._beepNotification_condition_react
);
7522 if (k
._notification_react(dom
.target
)) {
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;
7530 if (notificationReact
) {
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
);
7549 // marking a comment as spam in another section, and then unmark
7550 k
.commentBrohoofed({target: dom
.target
});
7552 } else if (hasClass(dom
.target
, 'UFILikeLink') || (!USINGMUTATION
&& hasClass(dom
.target
, 'UFILikeThumb'))) {
7553 k
._commentLikeLink(dom
.target
);
7554 } else if (dom
.target
.parentNode
) {
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
) {
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
);
7570 k
.postLike({target: ufi
});
7572 } else if (dom
.target
.parentNode
.parentNode
.parentNode
) {
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
);
7578 k
.postLike({target: ufi
});
7590 k
.changeCommentBox = function(dom
) {
7591 domChangeTextbox(dom
.target
, '.commentArea textarea, .UFIAddComment textarea', k
._changeCommentBox_change
);
7593 k
._changeCommentBox_change = function(textbox
) {
7597 if (form
.tagName
.toUpperCase() == 'FORM' && form
.getAttribute('action') == '/ajax/ufi/modify.php') {
7600 form
= form
.parentNode
;
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
;
7609 case '146225765511748':
7610 return CURRENTLANG
.fb_composer_coolstory
;
7615 switch (feedback_params
.target_profile_id
) {
7616 case '496282487062916':
7617 return CURRENTLANG
.fb_composer_coolstory
;
7625 return CURRENTLANG
.fb_comment_box
;
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
}
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
) {
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
);
7650 contentEval(function(arg
) {
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
);
7659 if (arg
.CANLOG
&& typeof console
!= 'undefined' && console
.log
&& console
.dir
) {
7660 console
.log("Unable to hook to MentionsInput");
7664 }, {"CANLOG":CANLOG
, "uiMentionsInput":dom
.target
.id
});
7668 domChangeTextbox(dom
.target
, k
.composerSelectors
, function(composer
) {
7669 var placeholderText
= CURRENTLANG
.fb_composer_lessons
;
7672 var form
= composer
;
7673 var inputContainer
= null;
7675 if (hasClass(form
, 'uiComposer') || hasClass(form
, '_119' /*'_118'*/) || hasClass(form
, '-cx-PRIVATE-fbComposer__root')) {
7678 if (hasClass(form
, 'inputContainer')) {
7679 inputContainer
= form
;
7681 form
= form
.parentNode
;
7685 return placeholderText
;
7688 pageid
= form
.querySelector('input[name="xhpc_targetid"]');
7691 return placeholderText
;
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
;
7699 k
._changeComposerAttachment(dom
, pageid
);
7701 if (k
.composerSpecialPages
[pageid
] && k
.composerSpecialPages
[pageid
].malay
) {
7702 $$(form
, k
.composerButtonSelectors
, function(submit
) {
7703 k
.changeButtonText(submit
, "Kirim");
7707 composer
.addEventListener('input', function() {
7709 var lang
= CURRENTLANG
;
7710 if (k
.composerSpecialPages
[pageid
] && k
.composerSpecialPages
[pageid
].malay
) {
7712 lang
= LANG
['ms_MY'];
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
);
7722 k
.changeButtonText(submit
, lang
.fb_composer_ponies
);
7725 k
.changeButtonText(submit
, "Kirim");
7727 var submitParent
= submit
;
7728 if (submit
.tagName
.toUpperCase() != 'BUTTON') {
7729 submitParent
= submit
.parentNode
;
7731 if (submitParent
.getAttribute('data-ponyhoof-button-text')) {
7732 k
.changeButtonText(submit
, submitParent
.getAttribute('data-ponyhoof-button-text'));
7738 if (isPonyhoofPage(pageid
)) {
7739 composer
.addEventListener('focus', function() {
7740 if (inputContainer
) {
7741 k
._changeComposer_insertReadme(inputContainer
.nextSibling
);
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')) {
7752 var temp
= composer
.getElementsByClassName('ponyhoof_page_readme');
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');
7764 insertBefore
= insertBefore
.nextSibling
;
7767 if (!insertBefore
) {
7768 insertBefore
= composer
.querySelector('._1dsp, .-cx-PUBLIC-fbComposerMessageBox__bar');
7770 // abort if no good insertion
7771 if (!insertBefore
) {
7775 k
._changeComposer_insertReadme(insertBefore
);
7778 return "Send feedback for Ponyhoof...";
7780 if (k
.composerSpecialPages
[pageid
] && k
.composerSpecialPages
[pageid
].composer
) {
7781 return k
.composerSpecialPages
[pageid
].composer
;
7785 return placeholderText
;
7788 // moved outside for timelineStickyHeader
7790 k
._changeComposerAttachment(dom
, null);
7793 // fix group composers, ugh
7794 //k._changeComposer_fixGroup(dom.target);
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')) {
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";
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";
7829 case '/ajax/composerx/attachment/question/':
7831 if (k
.composerSpecialPages
[pageid
] && k
.composerSpecialPages
[pageid
].malay
) {
7832 switchit
= "Tanya Soalan";
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";
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 +";
7858 var inner
= attachment
.querySelector('._2-s, .-cx-PUBLIC-fbTimelineComposerAttachment__label');
7860 inner
= attachment
.querySelector('._51z7, .-cx-PUBLIC-fbComposerAttachment__linktext');
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
);
7875 k
._changeComposerAttachment_inner(inner
, switchit
);
7879 attachment
.setAttribute('data-ponyhoof-ponified', 1);
7883 k
._changeComposerAttachment_inner = function(inner
, switchit
) {
7885 loopChildText(inner
, function(child
) {
7889 if (child
.nodeType
== 3) {
7890 child
.textContent
= switchit
;
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
);
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"]');
7912 pageid
= pageid
.value
;
7914 // domChangeTextbox will not work as these <textarea>s already has "data-ponyhoof-ponified"
7915 var composer
= target
.querySelector(k
.composerSelectors
);
7920 $$(target
, k
.composerButtonSelectors
, function(submit
) {
7922 var lang
= CURRENTLANG
;
7923 if (k
.composerSpecialPages
[pageid
] && k
.composerSpecialPages
[pageid
].malay
) {
7925 lang
= LANG
['ms_MY'];
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
);
7932 k
.changeButtonText(submit
, lang
.fb_composer_ponies
);
7935 k
.changeButtonText(submit
, "Kirim");
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');
7953 var potentialLabel
= target
.querySelector('._5bqd, .-cx-PRIVATE-HubbleInfoTip__content');
7954 if (potentialLabel
) {
7955 target
= potentialLabel
;
7957 if (target
.childNodes
&& target
.childNodes
[0] && target
.childNodes
[0].tagName
&& target
.childNodes
[0].tagName
.toUpperCase() == 'DIV') {
7958 target
= target
.childNodes
[0];
7960 if (target
.childNodes
&& target
.childNodes
[0] && target
.childNodes
[0].tagName
&& target
.childNodes
[0].tagName
.toUpperCase() == 'SPAN') {
7961 target
= target
.childNodes
[0];
7963 /*io = target.getElementsByTagName('div');
7967 io = target.getElementsByTagName('span');
7972 var t
= target
.innerHTML
;
7973 t
= replaceText(tooltipTitles
, t
);
7974 if (target
.innerHTML
!= t
) {
7975 var oldWidth
= target
.offsetWidth
;
7976 target
.innerHTML
= t
;
7978 var layer
= k
._tooltipGetLayer(ele
);
7983 var layerInner
= layer
.getElementsByClassName('uiContextualLayer');
7984 if (!layerInner
.length
) {
7987 layerInner
= layerInner
[0];
7989 removeClass(layer
, 'ponyhoof_tooltip_flip');
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
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
8005 var rect
= ele
.getBoundingClientRect();
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');
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
) {
8024 var layer
= ele
.parentNode
.parentNode
.parentNode
;
8025 if (!hasClass(layer
, 'uiContextualLayerPositioner')) {
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
);
8037 var nub
= target
.querySelector('#fbDockChatBuddylistNub .label');
8039 k
._fbDockChatBuddylistNub_change(nub
);
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
;
8054 k
.pokesDashboard = function(target
) {
8055 if (target
.getAttribute
&& target
.getAttribute('id') && target
.getAttribute('id').indexOf('poke_') == 0) {
8056 k
._pokesDashboard_item(target
);
8060 //$$(target, '.pokesDashboard > .objectListItem', k._pokesDashboard_item);
8061 $$(target
, '.objectListItem[id^="poke_"]', k
._pokesDashboard_item
);
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
;
8072 k
._pokesDashboard_pokeLink(target
);
8077 k
._pokesDashboard_item = function(item
) {
8078 //var header = item.getElementsByClassName('pokeHeader');
8079 //if (!header || !header.length) {
8082 //header = header[0];
8084 var header
= item
.querySelector('.uiProfileBlockContent > ._6a > ._6b > .fwb'); // .-cx-PRIVATE-uiInlineBlock__root > .-cx-PRIVATE-uiInlineBlock__middle
8089 var t
= header
.innerHTML
;
8090 t
= t
.replace(/ poked you
\./, ' nuzzled you.');
8091 if (header
.innerHTML
!= t
) {
8092 header
.innerHTML
= t
;
8095 k
._pokesDashboard_pokeLink(item
);
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";
8105 if (poke
.childNodes
&& poke
.childNodes
.length
&& poke
.childNodes
[1]) {
8106 poke
.childNodes
[1].textContent
= text
;
8111 loopChildText(poke
, function(child
) {
8115 if (child
.nodeType
== TEXT_NODE
) {
8116 child
.textContent
= text
;
8123 k
.notification = function(dom
) {
8124 domReplaceFunc(dom
.target
, 'notification', '.notification', function(ele
) {
8125 k
._notification_change(ele
, '.info', k
._notification_general_metadata
);
8129 $$(dom
.target
, '.notification-item', function(ele
) {
8130 k
._notification_change(ele
, '.notification-text > .message', k
._notification_messenger_metadata
);
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
);
8148 k
._notification_general_metadata = function(node
) {
8149 if (hasClass(node
, 'metadata') || hasClass(node
, 'blueName')) {
8155 k
._notification_messenger_metadata = function(node
) {
8156 if (node
.nodeType
!= TEXT_NODE
) {
8162 k
._notification_react_metadata = function(node
) {
8163 if (hasClass(node
, 'fwb')) {
8166 if (hasClass(node
, k
.notification_metadataClass
[0]) || hasClass(node
, k
.notification_metadataClass
[1])) {
8172 k
._notification_change = function(ele
, info
, metadataFunc
) {
8173 var info
= ele
.querySelector(info
);
8177 if (!info
.childNodes
|| !info
.childNodes
.length
) {
8181 for (var i
= 0, len
= info
.childNodes
.length
; i
< len
; i
+= 1) {
8182 var node
= info
.childNodes
[i
];
8183 if (!metadataFunc(node
)) {
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
);
8192 var finalText
= k
.textNotification(text
);
8195 if (node
.textContent
!= finalText
) {
8196 node
.textContent
= finalText
;
8199 if (text
.indexOf('"') != -1) {
8205 k
.menuPrivacyOnlyAjaxify
= [
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
8213 // https://www.facebook.com/settings?tab=timeline§ion=posting&view
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')) {
8226 addClass(ele
, 'ponyhoof_fbmenuitem');
8228 // pages on share dialog
8229 if (hasClass(ele
, '_90z') || hasClass(ele
, '-cx-PRIVATE-fbShareModePage__smalliconcontainer')) {
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) {
8239 var replacer
= menuTitles
;
8240 if (hasClass(ele
, 'fbPrivacyAudienceSelectorOption')) {
8241 replacer
= menuPrivacyOnlyTitles
;
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)
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;
8256 if (!_menuPrivacyOnlyOk
) {
8263 var label
= ele
.querySelector('.itemLabel, ._54nh, .-cx-PUBLIC-abstractMenuItem__label, .ufb-menu-item-label');
8265 //if (label.childNodes.length == 1) {
8266 // timeline post has 2
8267 var io
= label
.getElementsByTagName('span');
8269 if (!hasClass(io
[0], 'hidden_elem')) {
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
;
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;
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
;
8298 child
.textContent
= t
;
8303 //if (hasScrollableArea) {
8304 //ele.parentNode.parentNode.parentNode.style.width = oldWidthBody;
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
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;
8321 processMenuX
= true;
8325 if (hasScrollableArea
) {
8326 label
.style
.display
= '';
8332 if (hasClass(dom
.target
, 'uiContextualLayerPositioner')) {
8333 k
._menuItems_processMenuX(dom
.target
);
8337 k
.getParent(dom
.target
, function(parent
) {
8338 return hasClass(parent
, 'uiContextualLayerPositioner');
8339 }, k
._menuItems_processMenuX
);
8342 k
._menuItems_processMenuX = function(layer
) {
8347 var ownerid
= layer
.getAttribute('data-ownerid');
8351 ownerid
= $(ownerid
);
8356 var menu
= layer
.querySelector('._54nq, .-cx-PUBLIC-abstractMenu__wrapper');
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];
8368 uiScrollableArea
.style
.width
= (parseInt(uiScrollableArea
.style
.width
)+k
._processMenuXOldWidthDiff
)+'px';
8369 uiScrollableAreaBody
.style
.width
= (parseInt(uiScrollableAreaBody
.style
.width
)+k
._processMenuXOldWidthDiff
)+'px';
8373 var border
= layer
.querySelector('._54hx, .-cx-PUBLIC-abstractMenu__shortborder');
8377 border
.style
.width
= (Math
.max((menu
.offsetWidth
- ownerid
.offsetWidth
), 0))+'px';
8380 k
.fbRemindersStory = function(target
) {
8381 $$(target
, '.fbRemindersStory', function(item
) {
8382 var inner
= item
.querySelector('._42ef > .fcg, .-cx-PRIVATE-uiFlexibleBlock__flexiblecontent > .fcg');
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
;
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
;
8407 k
.flyoutLikeForm = function(target
) {
8408 var result
= k
._flyoutLikeForm(target
, 'groupsMemberFlyoutLikeForm', 'unlike');
8410 result
= k
._flyoutLikeForm(target
, 'fbEventMemberLike', 'liked');
8415 k
._flyoutLikeForm = function(target
, className
, forminput
) {
8416 domReplaceFunc(target
, className
, '.'+className
, function(ele
) {
8417 if (!ele
.elements
[forminput
]) {
8422 if (ele
.elements
[forminput
].value
== 1) {
8426 var submit
= ele
.querySelector('input[type="submit"]');
8431 submit
.value
= capitaliseFirstLetter(CURRENTSTACK
['like']);
8433 submit
.value
= capitaliseFirstLetter(CURRENTSTACK
['unlike']);
8437 if (hasClass(target
, className
)) {
8443 k
.pluginButton = function(target
) {
8444 if (!ONPLUGINPAGE
) {
8448 var root
= target
.getElementsByClassName('pluginConnectButtonLayoutRoot');
8449 //var root = target.getElementsByClassName('pluginSkinLight');
8455 domReplaceFunc(root
, '', '.pluginButton', function(ele
) {
8456 var div
= ele
.getElementsByTagName('div');
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>
8463 loopChildText(ele
, function(child
) {
8467 if (child
.tagName
.toUpperCase() == 'SPAN') {
8468 if (child
.innerHTML
== "Like") {
8469 child
.innerHTML
= capitaliseFirstLetter(CURRENTSTACK
.like
);
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
;
8492 $$(root
, '.pts > .pls > div > span', function(ele
) {
8493 var t
= k
.likeSentence(ele
.textContent
);
8494 if (ele
.textContent
!= t
) {
8495 ele
.textContent
= t
;
8500 k
.ticker = function(dom
) {
8501 domReplaceFunc(dom
.target
, 'fbFeedTickerStory', '.fbFeedTickerStory', function(ele
) {
8502 var div
= ele
.getElementsByClassName('uiStreamMessage');
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
) {
8518 var t
= node
.textContent
;
8521 var haltOnBoundary
= false;
8522 if (t
.indexOf('"') != -1) {
8524 haltOnBoundary
= true;
8525 } else if (t
.indexOf('\'s') != -1) {
8527 continueTextNodes
= false;
8531 var finalText
= k
.textNotification(t
.substring(0, t
.indexOf(boundary
)));
8532 finalText
+= t
.substring(t
.indexOf(boundary
), t
.length
);
8534 var finalText
= k
.textNotification(t
);
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
;
8542 if (boundary
&& haltOnBoundary
) {
8546 // It's too risky changing legit page names, so we are doing this in isolated cases
8547 if (hasClass(node
, 'token')) {
8549 ['photo', 'pony pic']
8550 ,['a photo', 'a pony pic']
8551 ,['wall', 'journal']
8553 var t
= replaceText(list
, node
.textContent
);
8554 if (node
.textContent
!= t
) {
8555 node
.textContent
= t
;
8562 if (hasClass(dom
.target
, 'fbFeedTickerStory')) {
8568 k
.beepNotification = function(dom
) {
8569 warn("domNodeHandler.beepNotification() is deprecated");
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) {
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>
8586 // **XYZ** posted on **Ponyhoof**'s **timeline**: "XYZ"
8587 //if (hasClass(node, 'fwb')) {
8593 k
._beepNotification_change = function(ele
, info
, condition
) {
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
)) {
8604 if (node
.nodeType
== 3) {
8605 text
= node
.textContent
;
8606 k
._beepNotification_change_text(node
, text
);
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
);
8616 if (text
.indexOf('"') != -1) {
8621 ele
.setAttribute('data-ponyhoof-beeper-message', info
.textContent
);
8623 if (userSettings
.sounds
) {
8625 if (SOUNDS
[userSettings
.soundsFile
]) {
8626 file
= userSettings
.soundsFile
;
8629 if (!file
|| file
== 'AUTO') {
8630 file
= '_sound/defaultNotification';
8632 var data
= convertCodeToData(REALPONY
);
8633 if (data
.soundNotif
) {
8634 file
= data
.soundNotif
;
8638 if (userSettings
.soundsNotifTypeBlacklist
) {
8639 var current
= userSettings
.soundsNotifTypeBlacklist
.split('|');
8641 if (current
.indexOf(gt
.notif_type
) != -1) {
8647 var finalfile
= THEMEURL
+file
+'.EXT';
8648 if (gt
.notif_type
== 'poke' && CURRENTSTACK
.stack
== 'pony') {
8649 finalfile
= THEMEURL
+'_sound/pokeSound.EXT';
8652 var ps
= initPonySound('notif', finalfile
);
8659 k
._beepNotification_change_text = function(node
, text
) {
8663 if (text
.indexOf('"') != -1) {
8664 var finalText
= k
.textNotification(text
.substring(0, text
.indexOf('"')));
8665 finalText
+= text
.substring(text
.indexOf('"'), text
.length
);
8667 var finalText
= k
.textNotification(text
);
8670 if (node
.nodeType
== TEXT_NODE
) {
8671 if (node
.textContent
!= finalText
) {
8672 node
.textContent
= finalText
;
8675 if (node
.innerHTML
!= finalText
) {
8676 node
.innerHTML
= finalText
;
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"]
8690 k
.insightsCountry = function(dom
) {
8691 domReplaceFunc(dom
.target
, 'breakdown-list-table', '.breakdown-list-table', function(ele
) {
8692 if (ele
.getAttribute('data-ponyhoof-ponified')) {
8695 ele
.setAttribute('data-ponyhoof-ponified', 1);
8696 $$(ele
, '.breakdown-key .ufb-text-content', function(country
) {
8697 country
.textContent
= replaceText(k
.insightsCountryData
, country
.textContent
);
8702 k
.timelineMutualLikes = function(target
) {
8703 $$(target
, '.fbStreamTimelineFavStory', function(root
) {
8704 $$(root
, '.fbStreamTimelineFavInfoContainer', function(ele
) {
8706 loopChildText(ele
, function(child
) {
8710 if (child
.nodeType
== TEXT_NODE
) {
8711 var t
= k
.textStandard(child
.textContent
);
8712 if (child
.textContent
!= t
) {
8713 child
.textContent
= t
;
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) {
8727 var t
= k
.textStandard(child
.textContent
);
8728 if (child
.textContent
!= t
) {
8729 child
.textContent
= t
;
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');
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
;
8757 k
._dialog_insertReadme = function(body
) {
8759 $$(body
, '._22i .uiToken > input[type="hidden"]', function(input
) { // @cx
8763 if (input
.getAttribute('name') == 'undefined[]' && isPonyhoofPage(input
.value
)) { // undefined[] is intentional from FB, NOT A BUG
8764 addClass(body
, 'ponyhoof_composer_hasReadme');
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
);
8779 k
._dialog_playSound = function(title
, outer
) {
8783 var lowercase
= title
.toLowerCase();
8784 for (var i
= 0, len
= dialogDerpTitles
.length
; i
< len
; i
+= 1) {
8785 if (dialogDerpTitles
[i
].toLowerCase() == lowercase
) {
8787 addClass(outer
, 'ponyhoof_fbdialog_derp');
8790 if (CURRENTSTACK
.stack
== 'pony' && userSettings
.sounds
&& !isPageHidden()) {
8791 var ps
= initPonySound('ijustdontknowwhatwentwrong', THEMEURL
+'_sound/ijustdontknowwhatwentwrong.EXT');
8800 k
.ponyhoofPageOptions = function(dom
) {
8801 if (!$('pagelet_timeline_page_actions')) {
8804 if ($('ponyhoof_footer_options')) {
8808 var selector
= dom
.target
.querySelector('#pagelet_timeline_page_actions .fbTimelineActionSelector');
8812 var menu
= selector
.getElementsByClassName('uiMenuInner');
8817 var whatpage
= menu
.querySelector('#fbpage_share_action a');
8821 if (whatpage
.getAttribute('href').indexOf('p[]='+PONYHOOF_PAGE
) != -1) {
8822 var button
= selector
.getElementsByClassName('fbTimelineActionSelectorButton');
8823 if (!button
.length
) {
8828 var sep
= d
.createElement('li');
8829 sep
.className
= 'uiMenuSeparator';
8831 var a
= d
.createElement('a');
8832 a
.className
= 'itemAnchor';
8833 a
.setAttribute('role', 'menuitem');
8834 a
.setAttribute('tabindex', '0');
8836 a
.id
= "ponyhoof_footer_options";
8837 a
.innerHTML
= '<span class="itemLabel fsm">'+CURRENTLANG
.options_title
+'</span>';
8838 a
.addEventListener('click', function(e
) {
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
);
8855 menu
.insertBefore(sep
, menu
.firstChild
);
8856 menu
.insertBefore(li
, sep
);
8860 k
.debug_betaFacebookBaseRewrote
= false;
8861 k
.debug_betaFacebookLinks = function(target
) {
8862 if (!k
.debug_betaFacebookBaseRewrote
) {
8863 contentEval(function(arg
) {
8865 if (typeof window
.requireLazy
== 'function') {
8866 window
.requireLazy(['Env'], function(Env
) {
8867 Env
.www_base
= window
.location
.protocol
+'//'+window
.location
.hostname
+'/';
8871 if (arg
.CANLOG
&& typeof console
!= 'undefined' && console
.log
&& console
.dir
) {
8872 console
.log("Unable to hook to Env");
8876 }, {"CANLOG":CANLOG
});
8877 k
.debug_betaFacebookBaseRewrote
= true;
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/');
8891 k
.mutateCharacterData = function(mutation
) {
8893 if (mutation
.target
&& mutation
.target
.parentNode
) {
8894 parent
= mutation
.target
.parentNode
;
8895 if (parent
.tagName
.toUpperCase() == 'ABBR') {
8900 if (userSettings
.debug_mutationDebug
) {
8902 console
.log('characterData:');
8904 console
.dir(mutation
.target
);
8909 k
.textNodes({target: mutation
.target
});
8914 var id
= parent
.getAttribute(k
.REACTATTRNAME
);
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
) {
8922 k
._likePostBox(likesentence
);
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
);
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'))) {
8937 // You and John brohoof this.
8939 var ufi
= k
.getReactUfi(parent
);
8941 k
.postLike({target: ufi
});
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
) {
8954 if (hasClass(notificationItem
, k
.notification_itemClass
[1])) {
8958 k
._notification_change(notificationItem
, '.'+k
.notification_textClass
[i
]+' > span', k
.notification_metadataClass
[i
], 'fwb');
8967 k
.mutateAttributes = function(mutation
) {
8968 //if (mutation.attributeName.indexOf('data-ponyhoof-') == 0) {
8971 var target
= mutation
.target
;
8972 if (mutation
.attributeName
== 'title') {
8973 if (target
.title
== target
.getAttribute('data-ponyhoof-title-modified')) {
8977 switch (mutation
.attributeName
) {
8979 var id
= target
.getAttribute(k
.REACTATTRNAME
);
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
);
8986 var orig
= target
.title
;
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 ');
8994 if (target
.title
!= t
) {
8997 target
.setAttribute('data-ponyhoof-title', orig
);
8998 target
.setAttribute('data-ponyhoof-title-modified', t
);
9005 if (/*(target.parentNode && hasClass(target.parentNode, 'uiButton')) || * /hasClass(target, 'ufb-button-input')) {
9006 var button = target.parentNode;
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;
9016 if (button.title == button.getAttribute('data-ponyhoof-button-orig')) {
9017 button.title = orig;
9024 button.setAttribute('data-ponyhoof-button-orig', orig);
9025 button.setAttribute('data-ponyhoof-button-text', replaced);
9027 if (orig != replaced) {
9028 target.value = replaced;
9040 k
.getParent = function(ele
, iffunc
, func
) {
9041 var outer
= ele
.parentNode
;
9043 if (iffunc(outer
)) {
9046 outer
= outer
.parentNode
;
9052 k
.changeButtonText = function(button
, t
) {
9053 if (button
.tagName
.toUpperCase() == 'INPUT') {
9056 button
.innerHTML
= t
;
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;
9065 if (USINGMUTATION
) {
9070 w
.setTimeout(function() {
9071 var iu
= INTERNALUPDATE
;
9072 INTERNALUPDATE
= true;
9074 INTERNALUPDATE
= iu
;
9078 k
.getReactUfi = function(ele
) {
9079 // .reactRoot[3].[1][0].0.[1].0.0.[2]
9080 var finalid
= k
.getReactId(ele
);
9082 var ufi
= d
.querySelector('div['+k
.REACTATTRNAME
+'=".r['+finalid
+']"]');
9083 if (ufi
&& hasClass(ufi
, 'UFIList')) {
9087 // Rollback to old method
9088 k
.getParent(ele
, function(ufiitem
) {
9089 return hasClass(ufiitem
, 'UFIList');
9090 }, function(ufiitem
) {
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
);
9103 var open
= id
.indexOf('{comment');
9107 open
= id
.indexOf(':comment');
9114 var subEnd
= id
.substring(open
, id
.length
).indexOf(close
);
9115 var component
= id
.substring(0, open
+subEnd
+closeCount
);
9120 k
.getReactComment = function(ele
) {
9121 var component
= k
.getReactCommentComponent(ele
);
9123 var comment
= d
.querySelector('div['+k
.REACTATTRNAME
+'="'+component
+'"]');
9124 if (comment
&& hasClass(comment
, 'UFIComment')) {
9128 // Rollback to old method
9129 k
.getParent(ele
, function(ufiitem
) {
9130 return hasClass(ufiitem
, 'UFIComment');
9131 }, function(ufiitem
) {
9137 k
.getTrackingNode = function(ele
) {
9138 var trackingNode
= ele
.getAttribute('data-ft');
9141 trackingNode
= JSON
.parse(trackingNode
);
9142 return trackingNode
.tn
;
9148 // Ignore irrelevant tags and some classes
9149 k
.shouldIgnore = function(dom
) {
9150 if (dom
.target
.nodeType
== 8) { // comments
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') {
9161 if (dom
.target
.parentNode
&& /(DOMControl_shadow|highlighterContent|textMetrics)/.test(dom
.target
.parentNode
.className
)) {
9168 k
.dumpConsole = function(dom
) {
9169 if (!userSettings
.debug_dominserted_console
) {
9173 if (dom
.target
.nodeType
== 8) { // comments
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
);
9186 var id
= dom
.target
.getAttribute('id');
9187 if (id
&& (id
.indexOf('bfb_') == 0 || id
.indexOf('sfx_') == 0)) {
9191 var className
= dom
.target
.className
;
9192 if (className
.indexOf('bfb_') == 0 || className
.indexOf('sfx_') == 0) {
9196 var tagName
= dom
.target
.tagName
.toUpperCase();
9197 if (tagName
!= 'BODY') {
9198 if (typeof console
!== 'undefined' && console
.log
) {
9199 console
.log(dom
.target
.outerHTML
);
9204 k
.textBrohoof = function(ele
) {
9206 if (ele
.nodeType
== TEXT_NODE
) {
9207 t
= ele
.textContent
;
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
;
9226 if (ele
.innerHTML
!= t
) {
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']);
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']);
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");
9265 var _optionsLinkInjected
= false;
9266 var injectOptionsLink = function() {
9267 if (_optionsLinkInjected
) {
9271 if ($('logout_form')) {
9272 _optionsLinkInjected
= true;
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
) {
9283 clickLink($('navAccountLink'));
9286 clickLink($('accountNavArrow'));
9292 var optionsLinkLi
= d
.createElement('li');
9293 optionsLinkLi
.setAttribute('role', 'menuitem');
9294 optionsLinkLi
.appendChild(optionsLink
);
9296 var logout
= $('logout_form');
9297 logout
.parentNode
.parentNode
.insertBefore(optionsLinkLi
, logout
.parentNode
);
9299 var pageNav
= $('pageNav');
9304 var isBusiness
= pageNav
.querySelector('.navLink[href*="logout.php?h="]');
9309 _optionsLinkInjected
= true;
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
) {
9321 var optionsLinkLi
= d
.createElement('li');
9322 optionsLinkLi
.className
= 'navItem middleItem';
9323 optionsLinkLi
.appendChild(optionsLink
);
9325 pageNav
.insertBefore(optionsLinkLi
, pageNav
.childNodes
[0]);
9329 var domNodeHandlerMain
= new domNodeHandler();
9330 var mutationObserverMain
= null;
9332 var ranDOMNodeInserted
= false;
9333 var runDOMNodeInserted = function() {
9334 if (ranDOMNodeInserted
) {
9338 ranDOMNodeInserted
= true;
9340 onPageReady(function() {
9342 DOMNodeInserted({target: d
.body
});
9346 if (!userSettings
.debug_noMutationObserver
) {
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
) {
9355 mutationObserverMain
.disconnect();
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;
9363 domNodeHandlerMain
.mutateCharacterData(mutations
[i
]);
9365 INTERNALUPDATE
= iu
;
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') {
9373 console
.log('childList:');
9375 console
.dir(mutations
[i
].addedNodes
[j
]);
9377 if (typeof mutations
[i
].addedNodes
[j
].className
== 'undefined') {
9378 console
.dir(mutations
[i
].addedNodes
[j
]);
9380 //console.log(' '+mutations[i].addedNodes[j].className);
9381 //console.log(' '+mutations[i].addedNodes[j].innerHTML);
9387 DOMNodeInserted({target: mutations
[i
].addedNodes
[j
]});
9392 var iu
= INTERNALUPDATE
;
9393 INTERNALUPDATE
= true;
9395 domNodeHandlerMain
.mutateAttributes(mutations
[i
]);
9397 INTERNALUPDATE
= iu
;
9404 if (userSettings
.debug_mutationDebug
) {
9405 console
.log('=========================================');
9407 mutationObserverMain
.observe(d
.documentElement
, observerOptions
);
9409 mutationObserverMain
.observe(d
.documentElement
, observerOptions
);
9410 USINGMUTATION
= true;
9413 warn("MutationObserver threw an exception, fallback to DOMNodeInserted");
9417 if (!USINGMUTATION
) {
9418 d
.addEventListener('DOMNodeInserted', DOMNodeInserted
, true);
9422 DOMNodeInserted({target: d
.body
});
9426 var turnOffFbNotificationSound = function() {
9427 contentEval(function(arg
) {
9429 if (typeof window
.requireLazy
== 'function') {
9430 window
.requireLazy(['NotificationSound'], function(NotificationSound
) {
9431 NotificationSound
.prototype.play = function() {};
9435 if (arg
.CANLOG
&& typeof console
!= 'undefined' && console
.log
&& console
.dir
) {
9436 console
.log("Unable to hook to NotificationSound");
9440 }, {"CANLOG":CANLOG
});
9443 var changeChatSound = function(code
) {
9444 onPageReady(function() {
9445 contentEval(function(arg
) {
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');
9454 if (arg
.CANLOG
&& typeof console
!= 'undefined' && console
.log
&& console
.dir
) {
9455 console
.log("Unable to hook to ChatConfig");
9459 }, {"CANLOG":CANLOG
, "THEMEURL":THEMEURL
, 'code':code
});
9463 var ranExtraInjection
= false;
9464 var extraInjection = function() {
9465 if (ranExtraInjection
) {
9468 ranExtraInjection
= true;
9470 for (var x
in HTMLCLASS_SETTINGS
) {
9471 if (userSettings
[HTMLCLASS_SETTINGS
[x
]]) {
9472 addClass(d
.documentElement
, 'ponyhoof_settings_'+HTMLCLASS_SETTINGS
[x
]);
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;}';
9483 injectManualStyle(globalcss
, 'global');
9485 if (userSettings
.customcss
) {
9486 injectManualStyle(userSettings
.customcss
, 'customcss');
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
);
9496 var timeShift = function() {
9497 var now
= new Date();
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());
9506 w
.setInterval(timeShift
, 60*1000);
9508 if (userSettings
.chatSound
) {
9509 if (!SOUNDS_CHAT
[userSettings
.chatSoundFile
] || !SOUNDS_CHAT
[userSettings
.chatSoundFile
].name
) {
9510 userSettings
.chatSoundFile
= '_sound/grin2';
9512 if (typeof w
.Audio
!= 'undefined') {
9513 changeChatSound(userSettings
.chatSoundFile
);
9517 if (userSettings
.customBg
) {
9518 changeCustomBg(userSettings
.customBg
);
9521 // Turn off Facebook's own notification sound
9522 if (userSettings
.sounds
) {
9523 turnOffFbNotificationSound();
9526 INTERNALUPDATE
= false;
9529 var detectBrokenFbStyle = function() {
9530 var test
= d
.createElement('div');
9531 test
.className
= 'hidden_elem';
9532 d
.documentElement
.appendChild(test
);
9534 var style
= w
.getComputedStyle(test
, null);
9535 if (style
&& style
.display
!= 'none') {
9536 d
.documentElement
.removeChild(test
);
9541 d
.documentElement
.removeChild(test
);
9545 // Wait for the current page to complete
9546 var scriptStarted
= false;
9547 function startScript() {
9548 if (scriptStarted
) {
9551 scriptStarted
= true;
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) {
9563 // Don't run on ajaxpipe
9564 if (w
.location
.search
&& w
.location
.search
.indexOf('ajaxpipe=1') != -1) {
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) {
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') {
9583 if (w
.location
.hostname
== '0.facebook.com') {
9588 d
.head
= d
.getElementsByTagName('head')[0];
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
);
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
;
9604 onPageReady(changeVersion
);
9607 if (d
.documentElement
.getAttribute('data-ponyhoof-update-current') > VERSION
) {
9608 addClass(d
.documentElement
, 'ponyhoof_update_outdated');
9610 addClass(d
.documentElement
, 'ponyhoof_update_newest');
9615 // Determine what storage method to use
9616 STORAGEMETHOD
= 'none';
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';
9627 if (STORAGEMETHOD
== 'none') {
9629 if (typeof chrome
!= 'undefined' && chrome
&& chrome
.extension
&& typeof GM_getValue
== 'undefined') {
9630 STORAGEMETHOD
= 'chrome';
9635 if (STORAGEMETHOD
== 'none') {
9637 if (typeof opera
!= 'undefined' && opera
&& opera
.extension
) {
9638 STORAGEMETHOD
= 'opera';
9643 if (STORAGEMETHOD
== 'none') {
9645 if (typeof safari
!= 'undefined') {
9646 STORAGEMETHOD
= 'safari';
9651 if (STORAGEMETHOD
== 'none') {
9652 if (DISTRIBUTION
== 'xpi') {
9653 STORAGEMETHOD
= 'xpi';
9657 if (STORAGEMETHOD
== 'none') {
9658 if (DISTRIBUTION
== 'mxaddon') {
9659 STORAGEMETHOD
= 'mxaddon';
9663 if (STORAGEMETHOD
== 'none') {
9664 STORAGEMETHOD
= 'localstorage';
9667 if (d
.documentElement
.id
== 'ponyhoof_page') {
9668 addClass(d
.documentElement
, 'ponyhoof_distribution_'+DISTRIBUTION
);
9669 addClass(d
.documentElement
, 'ponyhoof_storagemethod_'+STORAGEMETHOD
);
9673 // Inject the system style so we can do any error trapping
9674 injectSystemStyle();
9677 USERID
= cookie('c_user');
9681 SETTINGSPREFIX
= USERID
+'_';
9684 loadSettings(function(s
) {
9687 loadSettings(function(s
) {
9690 if (userSettings
.debug_slow_load
) {
9691 onPageReady(settingsLoaded
);
9695 }, {prefix:'global_', defaultSettings:GLOBALDEFAULTSETTINGS
});
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
) {
9705 chrome_sendMessage({'command':'getValue', 'name':SETTINGSPREFIX
+'settings'}, function(response
) {
9706 if (response
&& typeof response
.val
!= 'undefined') {
9707 var _settings
= JSON
.parse(response
.val
);
9709 userSettings
= _settings
;
9712 chrome_sendMessage({'command':'clearStorage'}, function() {});
9715 migrateSettingsChromeDone
= true;
9720 error("Failed to read previous settings through message passing");
9722 migrateSettingsChromeDone
= true;
9728 migrateSettingsChromeDone
= true;
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
9739 saveValue('settings', JSON
.stringify(null));
9742 migrateSettingsUnprefixedDone
= true;
9747 var globalSettingsTryLastUserDone
= false;
9748 var globalSettingsTryLastUser = function(callback
) {
9749 if (!globalSettings
.lastUserId
) {
9750 globalSettingsTryLastUserDone
= true;
9755 SETTINGSPREFIX
= globalSettings
.lastUserId
+'_';
9756 loadSettings(function(s
) {
9761 globalSettingsTryLastUserDone
= true;
9766 function settingsLoaded() {
9767 if (!userSettings
.theme
&& !migrateSettingsChromeDone
) {
9768 migrateSettingsChrome(settingsLoaded
);
9772 // Migrate for multi-user
9773 if (!userSettings
.theme
&& !migrateSettingsUnprefixedDone
) {
9774 migrateSettingsUnprefixed(settingsLoaded
);
9778 if (!globalSettings
.globalSettingsMigrated
) {
9779 if (!userSettings
.lastVersion
) {
9781 statTrack('install');
9784 for (var i
in GLOBALDEFAULTSETTINGS
) {
9785 if (userSettings
.hasOwnProperty(i
)) {
9786 globalSettings
[i
] = userSettings
[i
];
9789 globalSettings
.globalSettingsMigrated
= true;
9790 saveGlobalSettings();
9793 if (!USERID
&& !globalSettingsTryLastUserDone
) {
9794 // Try loading the last user
9795 globalSettingsTryLastUser(settingsLoaded
);
9799 // If we haven't set up Ponyhoof, don't log
9800 if (!userSettings
.theme
|| userSettings
.debug_disablelog
) {
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)");
9810 // Did we already run our script?
9811 if (hasClass(d
.documentElement
, 'ponyhoof_userscript')) {
9812 info("Style already injected at "+w
.location
.href
);
9816 // Don't run in frames
9817 var forceWhiteBackground
= false;
9819 var href
= w
.location
.href
.toLowerCase();
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
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;
9836 if (!allowedFramesOk
) {
9837 if (USW
.self
!= USW
.top
) {
9847 // Special instructions for browsers that needs localStorage
9849 if (STORAGEMETHOD
== 'localstorage') {
9850 // Don't run on non-www :(
9851 if (userSettings
.force_run
) {
9852 log("Force running on "+w
.location
.href
);
9854 if (w
.location
.hostname
!= 'www.facebook.com') {
9855 info("w.location.hostname = "+w
.location
.hostname
);
9862 info("Ponyhoof style is not injected on "+w
.location
.href
);
9866 CURRENTPONY
= userSettings
.theme
;
9868 if (!USERID
&& !globalSettings
.allowLoginScreen
) {
9869 info("Ponyhoof will not run when logged out because of a setting.");
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();
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
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.");
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.");
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");
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
);
9913 // CANLOG previously could be disabled before
9914 if (!userSettings
.debug_disablelog
) {
9918 // Load the language for the options link
9919 CURRENTLANG
= LANG
['en_US'];
9920 if (!userSettings
.forceEnglish
) {
9921 UILANG
= getDefaultUiLang();
9925 for (var i
in LANG
[UILANG
]) {
9926 CURRENTLANG
[i
] = LANG
[UILANG
][i
];
9931 // Inject Ponyhoof Options in the Account dropdown even when DOMNodeInserted is disabled
9932 onPageReady(function() {
9933 injectOptionsLink();
9934 domNodeHandlerMain
.ponyhoofPageOptions({target: d
.body
});
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
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) {
9952 CURRENTPONY
= PONIES
[i
].code
;
9959 error("Failed to get brony name");
9963 // If we still don't have one, then assume none
9965 CURRENTPONY
= 'NONE';
9968 if ($('jewelFansTitle')) {
9970 addClass(d
.documentElement
, 'ponyhoof_isusingpage');
9973 if (d
.querySelector('#pageLogo > a[href*="/business/dashboard/"]')) {
9974 ISUSINGBUSINESS
= true;
9975 addClass(d
.documentElement
, 'ponyhoof_isusingbusiness');
9978 // v1.401: Turn on new chat sound by default
9979 if (!userSettings
.chatSound1401
&& !userSettings
.chatSound
) {
9980 userSettings
.chatSound
= true;
9981 userSettings
.chatSound1401
= true;
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';
9990 userSettings
.randomSettingMigrated
= true;
9995 userSettings
.soundsVolume
= Math
.max(0, Math
.min(parseFloat(userSettings
.soundsVolume
), 1));
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;
10005 // v1.511: Track updates
10006 if (userSettings
.theme
&& globalSettings
.lastVersion
< VERSION
) {
10007 statTrack('updated');
10008 globalSettings
.lastVersion
= VERSION
;
10009 saveGlobalSettings();
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
);
10017 // Are we on homepage?
10018 if (hasClass(d
.body
, 'fbIndex') && globalSettings
.allowLoginScreen
) {
10019 // Activate screen saver
10020 screenSaverActivate();
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');
10028 if (userSettings
.theme
== null) {
10029 // No theme AND logged out
10031 changeTheme('login');
10032 log("Homepage is default to login.");
10034 if (!userSettings
.disableDomNodeInserted
) {
10035 runDOMNodeInserted();
10040 if (globalSettings
.runForNewUsers
) {
10041 if (luckyGuess
== -1) {
10042 CURRENTPONY
= getRandomMane6();
10045 var welcome
= new WelcomeUI({feature: luckyGuess
});
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');
10054 changeThemeSmart(CURRENTPONY
);
10057 if (canPlayFlash()) {
10058 var dat
= convertCodeToData(REALPONY
);
10059 if (dat
.fbIndex_swf
&& !userSettings
.disable_animation
) {
10060 addClass(d
.documentElement
, 'ponyhoof_fbIndex_hasswf');
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
);
10068 changeThemeSmart(CURRENTPONY
);
10073 if (CURRENTPONY
!= 'NONE' && !userSettings
.disableDomNodeInserted
) {
10074 runDOMNodeInserted();
10077 if (CURRENTPONY
!= 'NONE') {
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();
10089 onPageReady(startScript
);
10090 d
.addEventListener('DOMContentLoaded', startScript
, true);
10092 var _loop = function() {
10097 w
.setTimeout(_loop
, 100);
10103 /* ALL YOUR PONIES ARE BELONG TO US */