]> git.rmz.io Git - dotfiles.git/commitdiff
add dwb config
authorSamir Benmendil <samir.benmendil@gmail.com>
Fri, 23 Aug 2013 05:40:42 +0000 (07:40 +0200)
committerSamir Benmendil <samir.benmendil@gmail.com>
Fri, 23 Aug 2013 05:42:05 +0000 (07:42 +0200)
17 files changed:
dwb/.gitignore [new file with mode: 0644]
dwb/default/bookmarks [new file with mode: 0644]
dwb/default/cookies.allow [new file with mode: 0644]
dwb/default/cookies_session.allow [new file with mode: 0644]
dwb/default/custom_keys [new file with mode: 0644]
dwb/default/hsts [new file with mode: 0644]
dwb/default/plugins.allow [new file with mode: 0644]
dwb/default/quickmarks [new file with mode: 0644]
dwb/default/scripts.allow [new file with mode: 0644]
dwb/greasemonkey/fbpurity.EGHTFVTWO.user.js [new file with mode: 0644]
dwb/greasemonkey/ponyhoof.user.js [new file with mode: 0644]
dwb/keys [new file with mode: 0644]
dwb/mimetypes [new file with mode: 0644]
dwb/searchengines [new file with mode: 0644]
dwb/settings [new file with mode: 0644]
dwb/userscripts/extension_loader.js [new file with mode: 0644]
dwb/userscripts/youtube.js [new file with mode: 0755]

diff --git a/dwb/.gitignore b/dwb/.gitignore
new file mode 100644 (file)
index 0000000..0756e1f
--- /dev/null
@@ -0,0 +1,7 @@
+forms
+default/cookies
+default/commands.history
+default/history
+default/navigate.history
+default/search.history
+default/session
diff --git a/dwb/default/bookmarks b/dwb/default/bookmarks
new file mode 100644 (file)
index 0000000..1608097
--- /dev/null
@@ -0,0 +1,3 @@
+https://www.facebook.com/?ref=logo Facebook
+https://eleum.unimaas.nl/ Blackboard Learn
+http://chakra-project.org/ Chakra | Welcome
diff --git a/dwb/default/cookies.allow b/dwb/default/cookies.allow
new file mode 100644 (file)
index 0000000..b7419ee
--- /dev/null
@@ -0,0 +1,6 @@
+.facebook.com
+hoof.little.my
+.little.my
+apis.google.com
+.youtube.com
+.google.com
diff --git a/dwb/default/cookies_session.allow b/dwb/default/cookies_session.allow
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/dwb/default/custom_keys b/dwb/default/custom_keys
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/dwb/default/hsts b/dwb/default/hsts
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/dwb/default/plugins.allow b/dwb/default/plugins.allow
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/dwb/default/quickmarks b/dwb/default/quickmarks
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/dwb/default/scripts.allow b/dwb/default/scripts.allow
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/dwb/greasemonkey/fbpurity.EGHTFVTWO.user.js b/dwb/greasemonkey/fbpurity.EGHTFVTWO.user.js
new file mode 100644 (file)
index 0000000..dcdba5a
--- /dev/null
@@ -0,0 +1,3818 @@
+// ==UserScript==
+// @name           Facebook Purity
+// @namespace      http://steeev.freehostia.com
+// @description    F.B Purity hides application spam and other clutter from your facebook homepage
+// @icon           http://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/373593_408502197558_209872631_q.jpg
+// @include        http://*.facebook.com/*
+// @include        https://*.facebook.com/*
+// @match          http://*.facebook.com/*
+// @match          https://*.facebook.com/*
+// @exclude        http://*.facebook.com/ajax/*
+// @exclude        https://*.facebook.com/ajax/*
+// @exclude        http://*.facebook.com/ai.php*
+// @exclude        https://*.facebook.com/ai.php*
+// @exclude        http://*.channel.facebook.com/*
+// @exclude        https://*.channel.facebook.com/*
+// @exclude        http://*.facebook.com/ai.php?*
+// @exclude        https://*.facebook.com/ai.php?*
+// @grant          GM_getValue
+// @grant          GM_setValue
+// @version        8.5.3 - 19th Aug 2013
+// ==/UserScript==
+
+// these 2 excludes commented out for now, till we investigate which pages we need to exclude, as we need to run on certain "connect" pages for blocking apps.
+// @exclude        http://*.facebook.com/connect/*
+// @exclude        https://*.facebook.com/connect/*
+
+//
+// (C) 2009 - 2013 stephen fernandez - http://www.fbpurity.com
+//
+
+// If you like this script please donate, big or small donations, anything is welcome : 
+
+// http://donate.fbpurity.com/
+
+// ------------------------------------------------------------
+// F.B. Purity Home Page  : http://www.fbpurity.com
+// F.B  Purity Install    : http://install.fbpurity.com
+// F.B. Purity Fan Page   : http://fans.fbpurity.com
+// F.B. Purity UserGuide  : http://user-guide.fbpurity.com
+// F.B. Purity Custom CSS : http://css.fbpurity.com
+// F.B. Purity FAQ / Help : http://faq.fbpurity.com
+// F.B. Purity Search     : http://search.fbpurity.com
+// ------------------------------------------------------------
+
+// ABOUT
+// -----
+// This greasemonkey script hides all third party facebook application messages from your fb homepage.
+// Instructions on how to edit the "whitelist" are available here: http://whitelist.fbpurity.com
+// Instructions on how to edit the "extras" are available here:    http://extras.fbpurity.com
+// Make donations to F.B. Purity, to show your appreciation here:  http://donate.fbpurity.com
+
+// INSTALLATION
+// ------------
+// This script is compatible with the following web browsers: Firefox, Google Chrome, Opera and Safari
+//
+// Full installation instructions are available here: 
+// http://install.fbpurity.com
+//
+// If you have any problems, please see the Frequently Asked Questions / Help page:
+// http://faq.fbpurity.com
+
+// UPDATES
+// -------
+// 1.51  30th March 2009 Bug fixed: if there were no pending requests, the script didnt work
+// 1.52   4th April 2009 removed GM_addStyle command, for better compatibility with other browsers (chrome + opera)
+// 1.53  26th April 2009 changed insertpoint so its not dependent on suggestions box
+// 1.54  27th April 2009 script is now compatible with Google Chrome + Opera (and possibly safari, not tested yet)
+// 1.54a  5th May   2009 fixed a minor bug
+// 1.54b 24th June  2009 fixed for facebook code change
+// 1.54c 29th July  2009 fixed for facebook code change
+// 1.54d  5th Aug   2009 fixed for facebook code change
+// 1.54e 26th Aug   2009 fixed for facebook code change
+// 1.60   4th Sep   2009 added application whitelisting capability, the default whitelisted apps are:
+//                       FB Iphone, Selective Twitter and Living Social
+// 1.61  14th Oct   2009 optimised script, it should run faster and more efficiently now
+//                       added tumblr, digsby and tweetdeck to whitelist, removed livingsocial from whitelist
+// 1.8   21st Oct   2009 added "block app" functionality and ability to show just the app messages on the page
+//                       added blackberry app to default whitelist
+// 1.8a  22nd Oct   2009 fixed bug with blocking apps if language was not set to english
+// 1.8d  23rd Oct   2009 fixed for new facebook update ( "live feed" changes )
+//                       fixed if you click "Show x similar posts" on an application message, when you have chosen to display the app messages, the app messages will no longer be automatically hidden
+//                       if after you've blocked an app, and there are no more hidden app messages, it now returns to normal homepage view
+// 1.8e  26th Oct   2009 script now hides more apps (ones that use widgets) and should also now be restricted to running on the homepage
+// 1.9   28th Oct   2009 added filter for "extra" [joined group, became fan, attending event, became friend] messages
+// 2.0   31st Oct   2009 fixed Show/Hide Logic, made app+extra filters mutually exclusive, optimised the script a lot
+//                       moved fbpurity bar to the left to regain vertical space on the right hand column
+//                       newly added elements now obey the current filter
+// 2.1   2nd  Nov   2009 reset show/hide mode to default when user changes fb filter
+//                       added workaround for fb still showing apps that you have "blocked", script now "hides" app as well as blocking it, when you click the "block app" link
+//                       fixed bug with whitelisted apps being displayed via the "show hidden apps" filter
+//                       fixed - block link wasnt showing up on dynamically inserted app messages
+// 2.1a  4th  Nov   2009 fixed - now also hides apps that dont have a mini-icon
+// 2.1b  7th  Nov   2009 added option to hide suggestions box
+//                       added facebook for android to whitelist
+// 2.2  12th  Nov   2009 rewrote filter system, should block absolutely all apps now (except whitelisted ones)
+//                       added filter for photos posted by applications (eg farmville, top friends etc)
+// 2.2a 12th  Nov   2009 fixed suggestion box filter
+// 2.2b 20th  Nov   2009 added another "became friends" story id to extras list
+// 2.3  31st  Jan   2010 fixed block app function for google chrome v4 + hopefully fixed the random script loading problems too
+//                       speeded up script loading time by checking if the DOM is ready, rather than waiting for the whole page to load
+//                       added "attended event" messages to blocked extras list
+//                       added an option to allow blocking of "commented on status" and "likes status" messages
+//                       added facebook for palm to default application whitelist
+// 2.3a  5th  Feb   2010 fixed bug where the show/hide links wouldnt work if you navigated away from the homepage then came back again
+// 2.3b  7th  Feb   2010 fixed script to work with new layout
+// 2.3c  8th  Feb   2010 fixed script to work with custom friends lists
+// 2.4  13th  Feb   2010 fixed hide suggestions box option (wasnt working on custom friends list pages)
+//                       fixed app filtering ( some apps were getting around the app filter )
+//                       added the following optional extras : tagged/commented/liked photo, tagged in album, commented/liked album, commented/liked link, wall comment, group wall comment
+// 2.4a 18th  Feb   2010 added another app exception (generic status updates posted "via some app" - using widgets)
+//                       added motoblur + iphoto uploader to default whitelist
+//                       added optional extra : "Page Wall Comments"
+//                       added optional extra : "Posted Event"
+//                       fixed bug caused by "posted events" + "became friends" sharing same story code 
+//                       fixed bug caused by "became friends + became fan of" sharing same story code 
+// 2.4b 19th  Feb   2010 fixed bug in firefox where sometimes the "show extras" link stopped working
+// 2.4c 23rd  Feb   2010 fixed event/friend/fan story code differentiation
+// 2.5  25th  Feb   2010 added text filter list, so you  can specify words or phrases you want to block from your news feeds
+//                       separated userappwhitelist from the defaultappwhitelist, for easier copying and pasting of application id lists
+//                       added picasa uploader to the default application whitelist
+// 2.5a 26th  Feb   2010 fixed script to work with latest FB code change
+// 2.7   8th  Mar   2010 added options editing screen that lets you save your settings for extras, whitelist, suggestions box, and custom text filter
+//                       added sprint/samsung? photo/video uploader, sony/erricson uploader,music player + status shuffle to default whitelist.
+//                       added https:// to the list of included pages for those wanting greater security whilst browsing facebook
+// 2.8  13th  Mar   2010 fixed suggestions box wasnt being hidden on the requests page if the hide sb option was selected
+//                       fixed options screen occasionally not loading 
+//                       added hide option to hide the connect with friends box
+//                       added facebook exporter for iphoto and flickr app to default whitelist
+//                       added "Allow" link to application messages, for auto whitelisting of applications
+// 2.8a-test 19thMar2010 alpha test of temp fix for fb codechange, basic (show/hide) functionality should be restored
+// 2.8b-test 20thMar2010 fixed bug in show/hide app code, fixed "block app" and "allow" links on application messages
+// 2.9        2ndApr2010 Merged 2.8 + 2.8b-test so it doesnt matter which version of the site you are presented with, the script should still work 
+//                       Fixed bug in chrome where show/hide functions were sometimes not working.
+//                       Fixed Block + Allow links that were not showing up for certain applications (apps that post as normal FB stories)
+//                       Added LG Mobile, Windows Phone, Twitter and Posterous to the default application whitelist
+//                       Added hide "Sponsored box" (ads) option
+// 2.9a       6thApr2010 Fixed bug that was causing Firefox to lock up
+// 2.9b       9thApr2010 Fixed after blocking an app, not all the onscreen posts by that app would be hidden
+//                       Made some performance tweaks to make the script run better
+//                       Blocking app no longer requires "hiding" too so removed hideapp function call
+//                       Added Snaptu + SonyEricsson Panel + Nokia to default whitelist
+// 2.9c      15thApr2010 Added Ping.fm to default whitelist
+//                       Added a workaround for the bug in firefox which caused the script to fail when cookies are set to: "Keep until:" - "ask me every time"
+// 2.9d      15thApr2010 Fixed minor CSS style issue
+//                       Fixed friend/fan stories getting mixed up again (due to Facebooks code tinkering)
+// 2.9e      19thApr2010 Fixed bug where the display extras/apps would get screwed up some times
+//                       Fixed "allow" and "block app" buttons were not being hidden by default
+// 2.9f      26thApr2010 Fixed Display bug on custom friends list page.
+// 2.9g       4thMay2010 Fixed Extras differentiation (friends/fans)
+//                       Added wildcard for included pages
+//                       Added Gwibber to default whitelist
+// 2.9h      20thMay2010 Added new "likes website" type story to "became fan of" option
+//                       Fixed differentiation between like+became friends (again)
+// 2.9i      11thJun2010 Fixed Block App function
+//                       Added "changed profile info","changed relationship" and "changed profile pic" to the list of hideable extras
+//                       Fixed multiple words/phrases in custom text filter for chrome
+// 2.9j      22ndJun2010 Added option to hide "beta testers" box
+//                       Added HTC Sense + Samsung Mobile apps to default Whitelist
+// 3.0       30thJun2010 Fixed script for latest FB code change
+//                       Added visual feedback for "block app" function
+//                       Added extra security on domain name parsing
+//                       Stopped script from running in frames
+// 3.1       30thJun2010 Fixed for unforseen bugs
+// 3.11       9thJul2010 Fixed hide suggestions box (recommended pages + people you may know)
+// 3.2        5thAug2010 Fixed "Block" and "Allow" (whitelist) buttons, Added windows live messenger + o2 social link to default whitelist
+// 3.3       20thAug2010 Added new extra: "Checked in to location", addded LG Phone app to default whitelist
+// 3.4        3rdSep2010 Fixed script to work with facebook's latest code change, added Bloom photo uploader to default whitelist
+// 3.4a      11thSep2010 Fixed hide "get connected box" option, fixed freezeup in google chrome when creating a new friends list, fixed regex bug in custom text filter
+// 3.4b      14thSep2010 Fixed hide "get connected box" option again, fixed compatibility with ff4
+// 3.4c      22ndSep2010 Fixed hide "get connected box" option again
+// 3.5        2ndOct2010 The application filter now also hides "friend began using app/game" messages. Custom text filter now tells you which filter was activated when it hides a message
+// 3.6        7thOct2010 Added new extras "uploaded photo, uploaded video, tagged in video, posted note, tagged in note, posted link" 
+//                       Added "block app" and "allow app" links for "started using app" type messages
+//                       Added Import and Export Settings functionality.
+//                       Fixed loss of settings when user clears Firefox's cookies
+// 3.6a       7thOct2010 Fixed bug with Firefox settings recovery system
+// 3.7       14thOct2010 Incorporated new "joined group" story type to existing hide "joined group" extra, incorporated new "changed location" story types to existing "changed location" extra, added hide "poke box" option, added new HTC Sense, live journal and hootsuite to default app whitelist
+// 3.8       20thOct2010 Added options to hide the "questions box", "events box" and "requests box"
+// 3.8.1     27thOct2010 Fixed: "started using app filter", "hide request box code", added  Sony Ericsson X10 mini pro to default application whitelist
+// 3.8.2     29thOct2010 Fixed: Whitelist + Block App buttons were no longer showing due to a change in facebooks code.
+// 3.8.3      3rdNov2010 Fixed: Whitelist + Block App buttons were no longer showing due to a change in facebooks code.
+//                       Added Yahoo + Sony Ericsson + Vlingo to default whitelist
+//                       Added WL (whitelist + BA (Block App) links for messages posted by applications masquerading as "normal" fb status updates
+// 3.9.0      4thNov2010 Added font size option
+// 3.9.1     11thNov2010 Streamlined page processing, Fixed font size for group messages, Fixed "needs to access data on all sites" message on google chrome, fixed group wall comments filter, fixed hide questions box option
+// 3.9.2     15thNov2010 Updated hide sponsored box code, sponsored box should now be hidden on profiles and pages as well as the homepage/newsfeed, added block/whitelist links for photos/notes created uploaded by applications, tidied up code
+// 3.9.3     19thNov2010 Added script collision detection, to check if 2 versions of the script are running at the same time (script+extension etc)
+//                       Altered more font classes to give a more uniform font size across the site. Added Droid + Dell Mobile to default app whitelist
+// 3.9.4     25thNov2010 Fixed mangled BA + WL links, Fixed "FB-Glitch" error on friends list pages, Hides sponsored box on search pages if option set, Added link to info about AVG clash, Fixed Opera bug with localstorage
+// 3.9.5      7thDec2010 Added "changed to new profile" stories to "updated profile" filter, added new story code to "updated profile" filter, now hides sponsored box in a few more places, added RockMelt to default app whitelist
+// 3.9.6     17thDec2010 Added Custom CSS Box, Fixed hide "suggestions" box, Fixed bug with blocking "started using app", Added Friendly for Ipad, Slide, networked blogs, RSS Grafitti, Twitter Feed to default app whitelist
+// 4.0.0     23rdDec2010 Fixed intermittent app/extra filter problems, fixed bug with "started using app" previously it didnt check if app was in whitelist, added seesmic to app whitelist, fixed autoplay of videos when toggling show/hide
+// 4.1.0     18thJan2011 NEW: Application message filtering can now be turned off, NEW: Can now block multiple applications at the same time
+//                       Hide sponsored box option now hides more ads, Fixed name size on profile pages, Addeed Facebook mobile by Opentech ENG and flipboard to default app whitelist
+// 4.3.0     27thJan2011 "App + extra" filtering now works on profile pages, tweaked blockallapp function a little bit (scroll to top, single app block)
+//                       Added "delete all recent activity" button to profile pages, enabled full screen button for youtube videos, added delete friend request button, added nokia N900,and Ovi by Nokia to default app whitelist
+// 4.3.1     11thFeb2011 show/hide filters save youtube video's current position, hide sponsored box option now hide ads on new photo lightbox popups, catches more application messages in app filter, fixed del recent activity to work with new https settting, fixed missing info bar on profile pages, fixed anomalous delete button on privacy page, added kodak easyshare,Snaptu for Facebook and Instagram to default app whitelist.
+// 4.4.0     17thMar2011 fixed commenting ( hitting return/enter in the textarea no longer submits comments, also added comment button back for comments )
+//                       fixed filtering on application/profile pages with photo strip at top, fixed intermittent bug with display of block app/whitelist links, added eBuddy, mobileblog + Rockmelt Beta to default whitelist
+// 4.4.1     24thMar2011 Fixed block app function. Fixed Delete Recent Activity Function. (Known issue: In FF4 profile page needs to be reloaded to get the "del recent activity" button to show up)
+// 4.5.0     29thMar2011 Added an option to hide the new Facebook Questions. Fixed Delete Recent Activity Button not showing up in FF4. Fixed "extras" dual story type separation for facebook videos and events. Fixed options screen layout problem on wide screens.
+// 4.5.1     21stApr2011 Fixed for new Relationship stories and new "Is Using Application" stories
+// 4.5.2      8thJun2011 fixed block application function, Fixed hide sponsored box code, Fixed a bug with the extras filter, added "no longer listed as" to relationship story filter
+// 4.5.3     23rdJun2011 fixed fb places checkin anomaly, merged new "commented on a website" story type with "commented on link"
+// 5.0.0     19thJul2011 added "hide chat" option, added "hide happening now" sidebar option, added "hide commented on event wall" extra option, added "hide page updates" extra option, added "hide commented/liked stories on Top News feed" extra option
+// 5.1.0     20thSep2011 fixed spaces in application whitelist issue. fixed position of WL + BA links. added "updated school" and "relatives" stories to the updated profile extra filter. added "tagged in a post" stories to "commented/liked status" filter. added "subscribed to" stories to "friends with" extra filter. added windows phone 7, and facebook for windows phone 7 to default whitelist. fixed hiding ads on the photo lightbox
+// 5.2.0     21stSep2011 fixed for new newsfeed
+// 5.3.0     22ndOct2011 fixed/ish most extra filters (forced to use text filtering, so it only work on english interface), fixed comment button not showing up on ticker and birthday story popups. fixed ticker frame showing when hidden. fixed "meta.match" popup javascript error. fixed hide events box. Fixed BA + WL links not showing up.
+// 5.5.0     29thOct2011 fixed various issues with extra filtering, added hide "Shared photo" extra option, ff addon is now restartless and also compatible with seamonkey/iceape
+// 6.0.0      1stDec2011 fixed shared photo filter, fixed fan page stories filter, updated facebook places (checkins) filter, sped up the filtering a bit, fixed "likes page" filter, fixed event story filters, removed redundant box hiding options, added hide "read an article" option, reduced wall options to single "wrote on wall" option, added basic check for updates button, stopped filtering the current user and fbp's updates, FBP firefox extension is now restartless, FBP should now be compatible with the Seamonkey and Iceape browsers, app whitelist and custom text filter are now textareas and each item now needs to be on a separate line, rather than comma separated.
+// 6.1.1      9thDec2011 fixed too-wide textareas on options screen, fixed fan page story filter + logged in user filter, added "shared an event" to "created event" filter, fixed attending and attended event filters, improved tabbed textareas differentiation, fixed "friend requested" button being erroneously displayed, fixed "fb glitch" error on friends list pages, fixed "shared a link" filter, fixed upload photo button duplication
+// 6.3.0     22ndDec2011 added font and background colour options, added hide offline friends in chat option, added separate settings per logged in user, fixed "joined group" filter, fixed "regex error" freezing firefox, fixed https issues with options screen, fixed anomalous "delete" button showing up on timeline page, fixed "liked page" filter,improved fb places filter, added welcome message on first run 
+// 6.4.0     24thDec2011 Fixed filtering to work with international versions of FB, various other fixes.
+// 6.4.1     26thDec2011 Fixed FB for IE7 Spoofing (to help with disabling Timeline)
+// 6.4.2      6thJan2012 Fixed Application message filtering. Fixed hidden create album button on group pages. Fixed FB Purity Bar not showing on Friends list feeds. Fixed fbp not working for users with default user icon/pic. Improved welcome page.
+// 6.4.3     19thJan2012 Fixed story filtering 
+// 6.5.0      6thFeb2012 Added an auto update checker, Fixed comment button on new photo lightbox, Fixed birthday comment flyout button, fixed hide ads on photo lightbox, fixed go online/offline chat button when browser is in IE7 spoof mode, fixed hide events box, fixed a memory leak
+// 6.6.0      7thFeb2012 Added an option to force the newsfeed to be sorted by most recent, fixed photo comment button for "facebook fan pages"
+// 6.6.1     20thFeb2012 Added links to new FBP Fan Page on Google Plus to options screen. Turned on "Hide sponsored box" option by default. Added CSS to hide footer in Right hand column. Fixed youtube scrollbars issue, fixed hidden info on fb questions and fb insights when colour options are set
+// 6.6.2      2ndMar2012 Hides "press enter to submit comment" text when comment button enabled, fixes gap on new group pages when in ie7 spoof mode, fixes comment buttons on photo light box, brought back comments/likes on top news stories option
+// 6.7.0     28thMar2012 Fixed auto update checker in Firefox, Fixed hide ads in message pages, Fixed comment box growing too big in Safari, fixed hide chat box option, fixed force feed to be sorted by "most recent" option, fixed delete recent activity button
+// 6.7.1      3rdApr2012 Improved game/application and extra filtering, fixed hidden images at top of group pages if background colour had been set, fixed opera extension
+// 7.0.0      6thApr2012 Added built in IE7 user agent switch for chrome (for disabling timeline), improved CSS fixes for IE7 spoof mode, improved comment button restoration, improved "extra" filters
+// 7.1.0     28thApr2012 Fixed hide recent activity button, Fixed comment button on birthday and ticker flyout boxes, If hide "read an article" filter is ticked, it now also hides the "trending articles" box
+// 7.5.0     10thMay2012 Fixed news article redirects for Trending Articles stories also fixed the hide trending articles box option, added "block application" link to bottom of all facebook application pages, and "block application" button to all facebook application permission request pages, Fixed "BA" (Block Application) and "WL" (Whitelist) links on application posts in the newsfeed
+//                       Added a single column Timeline layout option, re-added ability to filter "frictionless sharing / FB actions" stories, Fixed hidden comment button in group welcome box
+// 7.5.1     25thMay2012 Fixed hiding trending articles option, hide sponsored box option now also hides sponsored stories in the newsfeed, various other minor tweaks and fixes
+// 7.5.2     14thJun2012 Fixed various extra filters including ('shared photo' and 'uploaded photo'), fixed news article redirects and hide "trending articles / trending videos"
+// 7.6.0      5thJul2012 Removes all external link redirects, so Facebook cant track them or block them. Adds remove event 'x's on events page (chrome + safari only), highlights applications in app center that request email or posting permissions, fixed block application link on application pages
+// 7.6.1      1stAug2012 Fixed hide sponsored box
+// 7.6.2     28thAug2012 Stopped New User screen from popping up when Facebook resets the user settings. Fixed external link interception. Fixed display anomalies in message send window, stopped hidden button from showing in "liked a page" message in ticker. Added extra highlighting/clarity on the App Center permissions section.
+// 7.8.0      7thSep2012 Fixed the user settings, so facebook cant delete them
+//                       Altered block app function to let you block just the app you select, it then asks if you also want to block the other apps
+// 7.9.0                 Fixed shared a link filter, Separated FB Actions/Frictionless sharing apps from the Trending Articles filter, FB Actions/ Frictionless sharing apps should now be filtered by the apps filter
+//                       Fixed TL button showing incorrect state after login
+// 7.9.5     18thSep2012 Fixed comment button (now 2 step submit process), fixed settings bug (facebook was resetting users settings, also clearing browser cookies would reset settings), completely hides sponsored stories from the newsfeed, restored new user greeting
+// 7.9.6     26thOct2012 Fixed hide trending articles, Fixed link and news article redirection/interception, Fixed filtering on interest lists, Fixed Block App link on permission request pages, Fixed inline youtube video playing on timeline pages, fixed missing images in fbp interface, fixed highlighting on application permission request dialogs
+// 7.9.7     15thNov2012 Fixed for FF17 (extension), Fixed block application function, added a more prominent block app button to appcenter app pages, fixed application filter + instagram whitelisting, Added FBP Info bar and filtering to game and "page feed", Fixed Fan Page filter, so it doesnt affect "Page Feed" or "Interest Lists", fixed emoticons when font size is altered, fixed app blocking for frictionless sharing apps such as netflix, fixed bug with birthday comment flyout (blue box), changed the default "restore comment buton" option to off., updated new user info page to include info about FBP interest list and page notifications. Added "posted an offer" to sponsored story filter
+// 8.0.1     30thNov2012 Added options for hiding left hand column links, added "upcoming events" to "hide events box" filter, made font options collapsible, improved ad blocking function
+// 8.2.0     --thJan2013 Added "Recently Released Albums" to sponsored box filter, fixed Questions filter, fixed "block app" on opera, Added create a group, create a page, and find friends to links you can hide in the left column. Added "Recent Articles About" and "Most Shared on" to trending articles filter, added "play with friends" story filter
+//                       redesigned options screen, added lots new options, fixed "drag image into box" covering options screen, cleared out lots of dead code, added option to hide smileys, added fix left column in place option
+// 8.2.2     13thFeb2013 Fixed slowdown on timeline / like/fan pages. Added hide like suggestions bar, to hide sponsored box option (after you like page, it shows a list of other pages to like). Updated welcome screen to 2 step process.
+// 8.3.0     21stMar2013 Added Hide "Gifts" and hide Notification Popup Box options, fixed bug in news panel on fbp options screen (bug-if feed was too short, surfaced due to fb post deletions), fixed add block link to fb apps sidebar, fixed hide all videos filter, fixed hidden event page buttons in single column timeline layout mode, improves group story filtering, fixed hidden file upload buttons when background color is set
+// 8.5.0     24thJun2013 Hide sponsored box option now also Hides the page suggestions on page feed, fixed opera specific bug when certain options were selected, fixed hide emoticons for new "feelings" functionality
+//                       Updated for new newsfeed design, Added hide links in right hand column options, Fix saving/retrieving settings. Fixed Timeline cover photo issues. Fixed timeline shift to right on personal timeline pages. Fixed hidden comment button when attaching image to comment.
+// 8.5.1     27thJul2013 Fixed hide "shared photos" when they are part of a "multi post update", fixed hidden group count and image attach icon when background color was set, updated "changed location" filter to include "is in" and "was in" a location
+// 8.5.2     14thAug2013 Fixed TL button for new search bar, Fixed hide emoticons option,  Fixed line-height in ticker and left column when font is set
+// 8.5.3     19thAug2013 Fixed Display of FBP info bar + filtering functionality for some users
+// (C) stephen fernandez 2009-2013   http://www.fbpurity.com
+
+// If you like F.B. Purity please donate, big or small donations, anything is welcome 
+// http://donate.fbpurity.com
+
+(function() {
+
+  var fbpVersion = "v8.5.3";
+  var debug=0; 
+
+  var fbpoptsobj = {}; // object to store the preferences etc
+  try {
+    if (window.top!=window.self) // dont run on framed pages
+         if(!window.location.href.match(/connect\/uiserver\.php\?/))  // but allow it to work on embedded permissions pages
+        return;
+  }
+  catch (e) {
+    ; //return;
+    //alert('caught error ' + e.message);
+       //unsafeWindow.console.log(e);
+  }
+
+  try {
+    if(!window.location.hostname.match(/facebook\.com$/))
+      return;
+  }
+  catch(e) {
+    ;
+       //alert('caught error ' + e.message);
+       //unsafeWindow.console.log(e);
+  }
+  
+  // set browser type
+  var ischrome=(typeof(chrome)!='undefined' && chrome.extension);
+  var issafari=(typeof(window.navigator.vendor)!='undefined') && (window.navigator.vendor.match(/Apple Computer, Inc\./)) && (window.navigator.userAgent.match(/Version\/5\./) || window.navigator.userAgent.match(/Version\/6\./));
+  //var isopera=window.navigator.userAgent.match(/Opera/);
+  try {
+    var isopera=(typeof(widget) && typeof(widget.preferences));
+  }
+  catch(e) {
+    var isopera=0;
+  }
+  var isasync=(ischrome || issafari);
+
+  //if(unsafeWindow)
+  //  console.log=unsafeWindow.console.log;
+       
+  //check if another version of the script is running at the same time and if so give a warning.
+  if(document.getElementById('fbpoptslink')) {
+    var collisionerrormsg='Error: You seem to be running 2 versions of FB Purity at the same time, perhaps you are running the addon and the script version, you need to uninstall or disable one of them, otherwise FBP wont function correctly. (<a href="http://faq.fbpurity.com/#collision">More Info</a>)';
+    if(document.getElementById('fbperrormsg'))
+      document.getElementById('fbperrormsg').innerHTML=collisionerrormsg;
+    else
+      window.alert(collisionerrormsg);
+  }
+  
+  var fbpstyle=document.createElement('style'); 
+  var hashead=document.getElementsByTagName('head').length;
+  
+  var fbpfreestyle=document.createElement('style'); // for setting a "global" font etc
+  fbpfreestyle.setAttribute('id','fbpfreestyler');
+  fbpfreestyle.setAttribute('type','text/css');
+  if(hashead)
+    document.getElementsByTagName('head')[0].appendChild(fbpfreestyle);
+  
+  var fbpboxstyle=document.createElement('style'); // for setting whether boxes are on or off
+  fbpboxstyle.setAttribute('id','fbpboxstyler');
+  fbpboxstyle.setAttribute('type','text/css');
+  if(hashead)
+    document.getElementsByTagName('head')[0].appendChild(fbpboxstyle);
+  
+  var fbpcssstyle=document.createElement('style'); // for adding the user's Custom CSS and general css stuff
+  fbpcssstyle.setAttribute('id','fbpcssstyler');
+  fbpcssstyle.setAttribute('type','text/css');
+  if(hashead)
+    document.getElementsByTagName('head')[0].appendChild(fbpcssstyle);
+    
+  var fbptlstyle=document.createElement('style');
+  fbptlstyle.setAttribute('id','fbptlstyle');
+  fbptlstyle.setAttribute('type','text/css');
+  if(hashead)
+    document.getElementsByTagName('head')[0].appendChild(fbptlstyle);
+
+fbpescaperegex = function(str){
+   // to escape brackets entered in the custom text filter, fixes some problems, but causes others... (users regexes that require brackets wont work, but the number of advanced users who will be using brackets are probably countable on one hand )
+    var replacements = {
+        '(': '\\(',
+        ')': '\\)',
+        '[': '\\[',
+        ']': '\\]',
+        '{': '\\{',
+        '}': '\\}'
+    }
+    var ret = this;
+    try {
+      for(key in replacements) {
+        str = str.replace('' + key, replacements[''+ key],'g');
+      }
+    }
+    catch(e) {
+      ; // do nothing, traps an error found in ff 4.0b5
+    }
+    return str;
+};
+
+var fbpoptslist='becamefriends,becamefan,joinedgroup,attendevent,attendedevent,createdevent,commentlikeslink,commentwall,commentgroupwall,commentpagewall,commenteventwall,updatedprofile,changedprofilepic,changedrelationship,suggestionsbox,connectbox,sponsoredbox,pokebox,happeningnowbar,betabox,commentbutton,offlinefriends,requestsbox,eventsbox,questionsbox,checkedin,uploadedphoto,sharedphoto,uploadedvideo,taggedinvideo,postednote,taggedinnote,postedlink,readarticle,fontfix,fontcolourfix,fontbgcolourfix,fbpfont,fbpfontfix,filterappmessages,recentactivity,chatbox,smileys,fixedleftcolumn,pagestory,sortmostrecent,fixarticleredirects,timelineonecol,upcomingevents,sharedevent,likedlink,sharedpage,commentedlink,hideallphotos,taggedphoto,likedphoto,commentedphoto,sharedvideo,likedvideo,commentedvideo,youtubevideo,sharedstatus,likedstatus,commentedstatus,taggedstatus,hideallvideos,hidealllinks,lcadvertmgr,lcconnect,lcallpages,lcpagesfeed,lclikepages,lcallapps,lcappcenter,lcevents,lcgamesfeed,lcpokes,lcmusic,lcplaceseditor,lcallgroups,lcallinterests,lccreategroup,lccreatepage,lcfindfriends,lcdeveloper,lcfriends,lcgifts,notificationpopup,rcrecommendedpages,rcrelatedgroups,rcpokes,rcbirthdays,rcfriendrequests,rcgamerequests';
+
+// new left column options = lcadvertmgr,lcconnect,lcallpages,lcpagesfeed,lclikepages,lcallapps,lcappcenter,lcevents,lcgamesfeed,lcpokes,lcmusic,lcplaceseditor,lcallgroups,lcallinterests,lccreategroup,lccreatepage,lcfindfriends,lcdeveloper,lcfriends
+// new right column options = rcrecommendedpages,rcrelatedgroups,rcpokes,rcbirthdays,rcfriendrequests,rcgamerequests
+var fbpoptsarr=fbpoptslist.split(',');
+
+var optsdiv=document.createElement('div');
+optsdiv.setAttribute('id','fbpoptsdiv');
+optsdiv.style.zIndex='155'; //99 (change to 155 to go above drag image box
+optsdiv.style.position='absolute';
+optsdiv.style.left='100px'; //143 //150px
+optsdiv.style.top='1px'; //42px
+optsdiv.style.background='white';
+optsdiv.style.border='3px solid black';
+optsdiv.style.display='none';
+
+var fbptips=[
+'<br/>&nbsp;<b>FBP Tip</b>: Want some help with using the Custom Text Filter? Visit the <a target="_blank" href="http://www.fbpurity.com/extras.htm?src=fbptips#customtextfilter">Custom Text Filter Help Section</a>',
+'<br/>&nbsp;<b>FBP Tip</b>: Want to further customise Facebook? <a target="_blank" href="http://fbpurity.com/css.htm?src=fbptips">Check out FBP\'s Custom CSS</a>',
+'<br/>&nbsp;<b>FBP Tip</b>: If you have any questions or problems with FBP <a target="_blank" href="http://fbpurity.com/faq.htm?src=fbptips">Check out FBP\'s FAQ / Help Page</a>',
+'<br/>&nbsp;<b>FBP Tip</b>: Donations help keep the FB Purity project alive, <a href="http://donate.fbpurity.com">Please show your support and Donate</a>.',
+'<br/>&nbsp;<b>FBP Tip</b>: Want to try out new versions of FBP before they are officially released? <a href="http://www.facebook.com/puritytest">Join the FBP Beta Testing Page</a>.',
+'<br/>&nbsp;<b>FBP Tip</b>: Please Help me out by telling all your friends about FB Purity: <a href="http://www.facebook.com/sharer.php?u=http://is.gd/fbpcnet">Share FB Purity</a>.'
+];
+
+var fbpoptshtml= '<div style="float:left;"><table style="top:0px"><tr>'+
+'<td valign="top"><a title="www.fbpurity.com" href="http://www.fbpurity.com"><img width="100" height="100" border="0" alt="F.B. Purity Logo" src="https://sites.google.com/site/st333v/fbp-1/fbp-ghost-lid-icon-100x100.png"></a></td>'+
+'<td width="800" valign="top">' +
+'<h2 style="display:inline" class="uiHeaderTitle">F.B. Purity ' + fbpVersion + ' Options</h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' +
+'<table cellpadding="0" cellspacing="0" style="margin-top:3px;width:100%"><tr><td><a target="_blank" title="The Home of the FB Purity browser extension" href="http://www.fbpurity.com">FBP Home</a> | <a title="Get the latest news about F.B. Purity" target="_blank" href="http://news.fbpurity.com">News</a> | <a title="Learn how to use F.B. Purity" target="_blank" href="http://user-guide.fbpurity.com">User Guide</a> | <a title="Get Help with F.B. Purity via the FAQ ( Frequently Asked Questions )" target="_blank" href="http://faq.fbpurity.com">Help</a> | <a title="Become a fan of FB Purity and get the latest FBP news directly in your newsfeed" target="_blank" href="http://fans.fbpurity.com">Fan Page</a> | <a title="Get in touch" target="_blank" href="http://contact.fbpurity.com">Contact</a> | <a title="Donate to FB Purity and help support the project" target="_blank" href="http://donate.fbpurity.com/">Donate</a></td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>[ <a onclick="document.getElementById(\'fbpoptsdiv\').style.display=\'none\'" id="closeoptslink" title="Close Options Screen" href="javascript:;"><b>X</b></a> ]</td></tr></table>'+
+
+//'<table><tr><td>Click the Like button on the FBP fan page to ensure you get the latest updates and news from the fan page directly in your newsfeed. <a href="" onclick="document.getElementById(\'updateframe\').src=\'http://www.fbpurity.com/latest.htm\';document.getElementById(\'updateframe\').style.display=\'block\';return false;">Check for latest version</a><iframe style="display:none" height="40" width="220" id="updateframe"></iframe></td><td><object align="middle" type="text/html" data="https://www.facebook.com/connect/connect.php?id=408502197558&connectis=0&stream=0" width="275" height="65"/></td></tr></table></td>'+
+'<table><tr><td>"Like" the <a target="_blank" href="http://fans.fbpurity.com">FB Purity Fan Page</a> to make sure you get the latest news and updates about F.B. Purity in your feed. (Please note, due to Facebook censorship of the FBP fan page, you now also need to subscribe to notifications from the Fan page, otherwise you wont see the FBP news in your newsfeed. To do this, go to the FBP Fan Page, hover over the "Like" button then select "Get Notifications". <a target="_blank" href="http://www.fbpurity.com/install.htm?v=' + fbpVersion.split(/v/)[1] + '">Check for latest version</a></td><td><iframe src="https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Ffluffbustingpurity&amp;width=292&amp;colorscheme=light&amp;show_faces=true&amp;stream=false&amp;header=false&amp;height=62&amp;ref=FBP_OPTIONS_SCREEN" scrolling="no" frameborder="0" marginwidth="0" style="border:none; overflow:hidden; width:200px; height:67px;" allowTransparency="true"></iframe></td></tr></table></td>'+
+'<td><!--a target="_blank" href="http://donate.fbpurity.com"><img style="margin-top:3px" border="0" src="https://www.paypal.com/en_US/GB/i/btn/btn_donateCC_LG.gif"></a--></td>'+
+'</tr></table></div>'+
+
+// <object align="middle" type="text/html" data="https://www.facebook.com/connect/connect.php?id=408502197558&connections=0&stream=0" width="275" height="65"/>
+// <iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.fbpurity.com&amp;send=false&amp;layout=standard&amp;width=275&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:275px; height:65px;" allowTransparency="true"></iframe>
+
+'<div style="clear:both"></div>'+
+'<table><tr><td valign="top">';
+
+// add new dynamic opts
+function optionsbox(mode) {
+  var table, rowstyle;
+  this.rownum=1;
+  if(1) // ischrome doesnt work in safari
+    var openallboxes='<a title="Open All" href="javascript:;" onclick="document.getElementById(\'fbvariousopts\').click();document.getElementById(\'fbstatusopts\').click();document.getElementById(\'fblinkopts\').click();document.getElementById(\'fbphotoopts\').click();document.getElementById(\'fbvideoopts\').click();document.getElementById(\'fbeventopts\').click();return false;">&#9660;</a>';
+  else
+    var openallboxes='';
+  if (typeof mode !='undefined' && mode=='extras') {
+    this.table='<table><tr><td>'+ openallboxes +'&nbsp;<b>Newsfeed Filters</b>&nbsp;&nbsp;<a title="Help with Extra Stories List" target="_blank" href="http://www.fbpurity.com/extras.htm"><b>?</b></a> </td><td><b>Hide</b></td></tr>';
+       }
+  else
+    //this.table="<table width='100%'>";
+       this.table="";
+  
+ // Use tbody to group tables instead of divs ! !!! ! :)
+  this.tableHeader = function (title, hint, varname) {
+        //this.table+='<tr title=""><td colspan="2"><p style="margin-top:3px;margin-bottom:3px;font-weight:bold"><a title="' + hint + '" style="margin-top:2px" href="#" onclick="document.getElementById(\'' + varname + '\').style.display==\'block\' ? (function(){document.getElementById(\'' + varname + '\').style.display=\'none\';document.getElementById(\'' + 'fb'+ varname + '\').setAttribute(\'class\',\'fbpclosedlist\')})() : (function(){document.getElementById(\'' + varname + '\').style.display=\'block\';document.getElementById(\'' + 'fb' + varname + '\').setAttribute(\'class\',\'fbpopenlist\')})();"><span id="' + 'fb' + varname + '" class="fbpclosedlist">' + title + '</span></a></p><div id="' + varname + '" style="display:none"><table>';
+        this.table+='<tbody><tr title=""><td><p style="margin-top:3px;margin-bottom:3px;font-weight:bold"><a title="' + hint + '" style="margin-top:2px" href="javascript:;" onclick="document.getElementById(\'' + varname + '\').style.display==\'none\' ? (function(){document.getElementById(\'' + varname + '\').style.display=\'table-row-group\';document.getElementById(\'' + 'fb'+ varname + '\').setAttribute(\'class\',\'fbpopenlist\');return false;})() : (function(){document.getElementById(\'' + varname + '\').style.display=\'none\';document.getElementById(\'' + 'fb' + varname + '\').setAttribute(\'class\',\'fbpclosedlist\');return false;})();"><span id="' + 'fb' + varname + '" class="fbpclosedlist">' + title + '</span></a></p></td><td></td></tr></tbody><tbody id="' + varname + '" style="display:none">';
+  }
+  this.addTableRow = function(title,hint,varname,inputtype) {
+        this.table+="<tr title='" + hint + "' style='" + ((this.rownum++ % 2) ? "background-color:#ECEFF5 !important" : "") + "'><td> <label style='color:black;font-weight:normal' for='" + varname + "'>" + title + "</label></td>" + "<td><input id='" + varname +"' type='" + inputtype + "'/></td></tr>";
+  }
+  this.tableFooter =function(){
+    //this.table+="</table></div></td></tr></table>";
+       this.table+="</tbody>";
+  }
+  this.buildTable =function(endmode){
+    if(typeof endmode=='undefined')
+      return this.table;
+       else
+         return this.table + '</table>';
+  }
+}
+
+newoptscolumn='';
+
+// Various Options
+v = new optionsbox('extras');
+v.tableHeader('Various Story Types','Hide Various story types from the newsfeed', 'variousopts');
+v.addTableRow('Fan Page Stories','Hide stories posted by Pages you have liked from the newsfeed','pagestory', 'checkbox');
+v.addTableRow('Trending Articles / Videos','Hide Trending Articles / Trending Videos / Most Shared on / Recent Articles About stories from the newsfeed','readarticle', 'checkbox');
+v.addTableRow('Facebook Questions','Hide Facebook Questions stories','questionsbox','checkbox');
+v.addTableRow('Became Friends','Hide Became Friends stories from the newsfeed','becamefriends','checkbox');
+v.addTableRow('Changed Relationship','Hide Changed Relationship stories from the newsfeed','changedrelationship', 'checkbox');
+v.addTableRow('Changed Location','Hide Changed Location (Check-in) Stories','checkedin','checkbox');
+v.addTableRow('Updated Profile Info','Hide Updated Profile Stories','updatedprofile','checkbox');
+v.addTableRow('Joined a Group','Hide Joined Group Stories (and other group related stories)','joinedgroup','checkbox');
+v.addTableRow('Posted Note','Hide Posted Note Stories','postednote','checkbox');
+v.addTableRow('Tagged in Note','Hide Tagged in Note Stories','taggedinnote','checkbox');
+v.tableFooter();
+newoptscolumn+=v.buildTable();
+
+// Event Options
+v=null
+v= new optionsbox();
+v.tableHeader('Event Stories','Hide event stories from the newsfeed', 'eventopts');
+v.addTableRow('Upcoming Events','Hide Upcoming Events / Upcoming Concerts','upcomingevents','checkbox');
+v.addTableRow('Attending Event','Hide Attending Event','attendevent','checkbox');
+v.addTableRow('Attended Event','Hide Attended Event','attendedevent','checkbox');
+v.addTableRow('Created Event','Hide Created Event','createdevent','checkbox');
+//v.addTableRow('Liked Event','Hide Liked Events','likedevent','checkbox');
+v.addTableRow('Shared Event','Hide Shared Events','sharedevent','checkbox');
+v.tableFooter();
+newoptscolumn+=v.buildTable();
+
+// Link / Page Options
+v=null;
+v = new optionsbox();
+v.tableHeader('Link / Page Stories','Hide Link / Page stories from the Newsfeed', 'linkopts');
+//v.addTableRow('Hide All External Links','All External Links from the Newsfeed','hidealllinks', 'checkbox');
+v.addTableRow('Liked Page','Hide Liked Page Stories','becamefan','checkbox');
+v.addTableRow('Shared Page','Hide Shared Page Stories','sharedpage','checkbox');
+v.addTableRow('Liked Link','Hide Liked Link Stories','likedlink','checkbox');
+v.addTableRow('Shared Link','Hide Shared Link Stories from the Newsfeed','postedlink','checkbox');
+v.addTableRow('Commented on Link','Hide Commented on Photo Stories','commentedlink','checkbox');
+v.tableFooter();
+newoptscolumn+=v.buildTable();
+
+// Photo Options
+v=null;
+v = new optionsbox();
+v.tableHeader('Photo Stories','Hide photo stories from the newsfeed', 'photoopts');
+v.addTableRow('Hide All Photos','Hide All Photo stories from the newsfeed','hideallphotos', 'checkbox');
+v.addTableRow('Shared Photo','Hide Shared Photo / Album stories from the newsfeed','sharedphoto','checkbox');
+v.addTableRow('Changed Profile Photo','Hide Updated Profile Picture / Cover Photo stories from the newsfeed','changedprofilepic', 'checkbox');
+v.addTableRow('Uploaded Photo','Hide Added Photo Stories','uploadedphoto','checkbox');
+v.addTableRow('Tagged in Photo','Hide Tagged in Photo / Album stories','taggedphoto','checkbox');
+v.addTableRow('Liked Photo','Hide Liked Photo / Album stories','likedphoto','checkbox');
+v.addTableRow('Commented on Photo','Hide Commented on Photo / Album stories','commentedphoto','checkbox');
+v.tableFooter();
+newoptscolumn+=v.buildTable();
+
+// Video Options
+v=null;
+v = new optionsbox();
+v.tableHeader('Video Stories','Hide Video stories from the Newsfeed', 'videoopts');
+v.addTableRow('Hide All Videos','Hide All Video Stories from the newsfeed','hideallvideos', 'checkbox');
+v.addTableRow('Shared Video','Hide Shared FB Video Stories from the newsfeed','sharedvideo','checkbox');
+v.addTableRow('Uploaded Video','Hide Added Video Stories','uploadedvideo','checkbox');
+v.addTableRow('Tagged in Video','Hide Tagged in Video Stories','taggedinvideo','checkbox');
+v.addTableRow('Liked Video','Hide Liked Video Stories','likedvideo','checkbox');
+v.addTableRow('Commented on Video','Hide Commented on Video Stories','commentedvideo','checkbox');
+v.addTableRow('Youtube / Vimeo Videos','Hide Youtube and Vimeo Stories','youtubevideo','checkbox');
+v.tableFooter();
+newoptscolumn+=v.buildTable();
+
+// Status // Wall Options
+v=null;
+v = new optionsbox();
+v.tableHeader('Status / Wall Stories','Hide Status / Wall stories from the newsfeed', 'statusopts');
+v.addTableRow('Shared Status','Hide Shared Status Stories','sharedstatus','checkbox');
+v.addTableRow('Liked Status','Hide Liked Status Stories','likedstatus','checkbox');
+v.addTableRow('Commented on Status','Hide Commented on Status stories','commentedstatus','checkbox');
+//v.addTableRow('Tagged in Status','Hide Tagged in Status Stories','taggedstatus','checkbox'); // not sure how to handle this, or if its even needed
+v.addTableRow('Wrote on Wall','Hide Wrote on Wall Stories (This should work for comments posted to event, page, user and group wall)','commentwall','checkbox');
+v.tableFooter();
+newoptscolumn+=v.buildTable('complete');
+
+// end new options layout
+fbpoptshtml += newoptscolumn ;
+
+fbpoptshtml += '</td><td valign="top">'+
+'<table><tr><td valign="top"><b>More Options</b></td><td valign="top"><b>Hide</b></td><td rowspan="19" width="12"></td><td valign="top" rowspan="19" width="405"> ' +
+// new custom text filter/ css / app whitelist tabs
+'<span id="custextheader" title="Click to access the Custom Text Filter" style="font-weight:bold;background:#ECEFF5;border:1 solid"><a href="#">Custom Text Filter</a></span> - ' +
+'<span id="appwhitelistheader"><a title="Click to access the Application Whitelist" href="#">Application Whitelist</a></span> - ' +
+'<span id="custcssheader"><a title="Click to access the Custom CSS BOX" href="#">Custom CSS</a></span><br/>' +
+'<span id="custextdesc" style="background:#ECEFF5;" title="Please note, \'Regular Expressions\' can also be used.">Enter the words or phrases, on separate lines, that you wish to filter from your news feed. (<a title="Help with Custom Text Filter" target="_blank" href="http://www.fbpurity.com/extras.htm#customtextfilter"><b>Text Filter Help</b></a>) <br/></span><span style="display:none" id="custcssdesc">Enter the Custom CSS code you would like applied to your facebook pages.  (<a title="Help with Custom CSS" target="_blank" href="http://www.fbpurity.com/css.htm"><b>CSS Help and examples</b></a>)</span><span style="display:none" id="appwhitelistdesc">Enter the numeric application IDs, on separate lines, of the apps whose stories you wish to allow in your news feed (<a title="Help with Application Whitelist" target="_blank" href="http://www.fbpurity.com/whitelist.htm"><b>Whitelist Help</b></a>)</span>' +
+'<textarea style="width:404px;height:275px" id="custextta">cust text filter</textarea><textarea style="display:none;" id="custcssta">Custom CSS</textarea><textarea style="display:none;" id="appwhitelistta">app whitelist</textarea>' +
+//(window.navigator.userAgent.match(/Mozilla\/4\.0 \(compatible\; MSIE 7\.0\; Windows/) ? '' : '<br/>&nbsp;FBP Tip: <a target="_blank" href="http://fbpurity.com/disable-timeline">Want to remove Facebook Timeline? Click here.</a>') +
+
+fbptips[Math.floor(Math.random() * fbptips.length)] +
+
+'<br/><div id="fbpnewsdiv"></div>'+
+'</td></tr>'+
+
+'<tr title="Hiding the sponsored box also hides Sponsored stories in the newsfeed, Suggested Posts, Facebook Offers, the people you may know, people to subscribe to and recommended pages boxes"><td><label style="color:black;font-weight:normal" for="sponsoredbox">Sponsored Box / Stories</label></td><td><input id="sponsoredbox" type="checkbox"></td></tr>'+
+'<tr style="background-color:#ECEFF5 !important" title="Un-Tick this if you dont want FBP to filter out application and game stories"><td><label style="color:black;font-weight:normal" for="filterappmessages">Application + Game Stories</label></td><td><input id="filterappmessages" type="checkbox"></td></tr>'+
+'<tr><td title="The ticker bar is the scrolling newsfeed along  the right hand side of your page"><label style="color:black;font-weight:normal" for="happeningnowbar">News Ticker Bar</label></td><td><input id="happeningnowbar" type="checkbox" title="The ticker bar is the scrolling newsfeed at the top right of your page"></td></tr>'+
+//'<tr title="Please note: Choosing this option also hides birthdays and pokes"><td title="This option hides the Events section in the right column beneath the news ticker and also the Events link in the left column. Please note that this option also hides birthdays and pokes in the right hand column"><label style="color:black;font-weight:normal" for="eventsbox">Events Box</label></td><td><input id="eventsbox" type="checkbox"></td></tr>'+
+'<tr style="background-color:#ECEFF5 !important"><td><label style="color:black;font-weight:normal" for="offlinefriends">Offline Friends in Chat</label></td><td><input id="offlinefriends" type="checkbox"></td></tr>'+
+'<tr><td><label style="color:black;font-weight:normal" for="chatbox">Chat Box</label></td><td><input id="chatbox" type="checkbox"></td></tr>'+
+'<tr style="background-color:#ECEFF5 !important" title="This option hides the smileys and replaces them with their text equivalent, if available"><td><label style="color:black;font-weight:normal" for="smileys">Graphical Smileys / Emoticons</label></td><td><input id="smileys" type="checkbox"></td></tr>'+
+'<tr title="This option hides the Notification box that pops up in the bottom left hand corner"><td><label style="color:black;font-weight:normal" for="notificationpopup">Notification Popup Box</label></td><td><input id="notificationpopup" type="checkbox"></td></tr>'+
+'<tr style="background-color:#ECEFF5 !important" title="This option hides Facebook Gifts Links"><td><label style="color:black;font-weight:normal" for="lcgifts">Gifts</label></td><td><input id="lcgifts" type="checkbox"></td></tr>'+
+'<tr style="display:none"><td>Beta Tester Box</td><td><input id="betabox" type="checkbox"></td></tr>'+
+
+'<tr><td><b>Further Options</b></td><td><b>Set</b></td></tr>'+
+'<tr style="background-color:#ECEFF5 !important" title="Selecting this option restores the comment button, though submitting a comment will be a 2 step submit process for techical reasons, if you dont like it, untick this box to make it hidden again. Theres a shortcut for submitting a comment when you have the comment button option enabled, and it is to press Tab, then Enter, then Enter again."><td><label style="color:black;font-weight:normal" for="commentbutton">Restore Comment Button</label></td><td><input id="commentbutton" type="checkbox"></td></tr>'+
+'<tr title="Makes news article links go directly to the news articles rather than via Facebook applications"><td><label style="color:black;font-weight:normal" for="fixarticleredirects">Fix news article &amp; link redirects</label></td><td><input id="fixarticleredirects" type="checkbox"></td></tr>'+
+'<tr style="background-color:#ECEFF5 !important"  title="Force the newsfeed to be sorted by \'Most Recent\'"><td><label style="color:black;font-weight:normal" for="sortmostrecent">Sort Feed : Most Recent</label></td><td><input id="sortmostrecent" type="checkbox"></td></tr>'+
+'<tr title="Freezes the left column of the newsfeed page in place even when you scroll the page down"><td><label style="color:black;font-weight:normal" for="fixedleftcolumn">Fix Left Column in Place</label></td><td><input id="fixedleftcolumn" type="checkbox"></td></tr>'+
+'<tr style="background-color:#ECEFF5 !important" title="Lets you view \'Fan Page\' Timeline pages in a single column layout format. N.B. You can also toggle this setting on and off by clicking the \'TL\' button next to the search box"><td><label style="color:black;font-weight:normal" for="timelineonecol">Timeline : Single Column</label></td><td><input id="timelineonecol" type="checkbox"></td></tr>'+
+
+// right column links options
+'<tr title=""><td colspan="2"><p style="margin-top:3px;margin-bottom:3px;font-weight:bold"><a title="Click to open/close the Hide Links in Right Hand Column Options" style="margin-top:2px" href="#" onclick="document.getElementById(\'rightcolopts\').style.display==\'block\' ? (function(){document.getElementById(\'rightcolopts\').style.display=\'none\';document.getElementById(\'fbprightcolopts\').setAttribute(\'class\',\'fbpclosedlist\')})() : (function(){document.getElementById(\'rightcolopts\').style.display=\'block\';document.getElementById(\'fbprightcolopts\').setAttribute(\'class\',\'fbpopenlist\')})();"><span id="fbprightcolopts" class="fbpclosedlist">Hide Links in Right Column</span></a></p><div id="rightcolopts" style="display:none"><table width="100%"><tr><td>Game / App Requests</td><td><input type="checkbox" id="rcgamerequests"></td></tr><tr style="background-color:#ECEFF5 !important"><td>Recommended Pages</td><td><input type="checkbox" id="rcrecommendedpages"></td></tr><tr><td>Suggested Groups</td><td><input type="checkbox" id="rcrelatedgroups"></td></tr><tr style="background-color:#ECEFF5 !important"><td>Pokes</td><td><input type="checkbox" id="rcpokes"></td></tr><tr><td>Events</td><td><input type="checkbox" id="eventsbox"></td></tr><tr style="background-color:#ECEFF5 !important"><td>Friend Requests</td><td><input type="checkbox" id="rcfriendrequests"></td></tr><tr><td>Birthdays</td><td><input type="checkbox" id="rcbirthdays"></td></tr></table></div></td></tr>'+
+
+// left column links options
+'<tr title=""><td colspan="2"><p style="margin-top:3px;margin-bottom:3px;font-weight:bold"><a title="Click to open/close the Hide Links in Left Hand Column Options" style="margin-top:2px" href="#" onclick="document.getElementById(\'leftcolopts\').style.display==\'block\' ? (function(){document.getElementById(\'leftcolopts\').style.display=\'none\';document.getElementById(\'fbpleftcolopts\').setAttribute(\'class\',\'fbpclosedlist\')})() : (function(){document.getElementById(\'leftcolopts\').style.display=\'block\';document.getElementById(\'fbpleftcolopts\').setAttribute(\'class\',\'fbpopenlist\')})();"><span id="fbpleftcolopts" class="fbpclosedlist">Hide Links in Left Column</span></a></p><div id="leftcolopts" style="display:none"><table width="100%"><tr title="This option will hide all links under the PAGES heading"><td>Pages Section</td><td><input type="checkbox" id="lcallpages"></td></tr><tr style="background-color:#ECEFF5 !important"><td>Pages Feed</td><td><input type="checkbox" id="lcpagesfeed"></td></tr><tr><td>Like Pages</td><td><input type="checkbox" id="lclikepages"></td></tr><tr style="background-color:#ECEFF5 !important"><td>Create a Page</td><td><input type="checkbox" id="lccreatepage"></td></tr><tr title="This option will hide all links under the APPS heading"><td>Apps Section</td><td><input type="checkbox" id="lcallapps"></td></tr><tr style="background-color:#ECEFF5 !important"><td>App Center</td><td><input type="checkbox" id="lcappcenter"></td></tr><tr><td>Events</td><td><input type="checkbox" id="lcevents"></td></tr><tr style="background-color:#ECEFF5 !important"><td>Games Feed</td><td><input type="checkbox" id="lcgamesfeed"></td></tr><tr><td>Pokes</td><td><input type="checkbox" id="lcpokes"></td></tr><tr style="background-color:#ECEFF5 !important"><td>Music</td><td><input type="checkbox" id="lcmusic"></td></tr><tr><td>Places Editor</td><td><input type="checkbox" id="lcplaceseditor"></td></tr><tr style="background-color:#ECEFF5 !important" title="This option will hide all links under the GROUPS heading"><td>Groups Section</td><td><input type="checkbox" id="lcallgroups"></td></tr><tr><td>Create Group</td><td><input type="checkbox" id="lccreategroup"></td></tr><tr style="background-color:#ECEFF5 !important" title="This option will hide all links under the INTERESTS heading"><td>Interests Section</td><td><input type="checkbox" id="lcallinterests"></td></tr><tr title="Hide Create Advert / Adverts Manager"><td>Create Advert</td><td><input type="checkbox" id="lcadvertmgr"></td></tr><tr style="background-color:#ECEFF5 !important" title="This option will hide all links under the CONNECT heading" ><td>Connect Section</td><td><input type="checkbox" id="lcconnect"></td></tr><tr><td>Find Friends</td><td><input type="checkbox" id="lcfindfriends"></td></tr><tr style="background-color:#ECEFF5 !important" title="This option will hide all links under the FRIENDS section"><td>Friends Section</td><td><input type="checkbox" id="lcfriends"></td></tr></tr><tr title="This option will hide all links under the DEVELOPER section including Manage Apps"><td>Developer Section</td><td><input type="checkbox" id="lcdeveloper"></td></tr></table></div></td></tr>'+
+
+// fonts and colours section
+'<tr><td colspan="2" align="center"><p style="margin-top:3px;margin-bottom:3px;font-weight:bold"><a title="Click to open/close Font and Colour Options" href="#" style="margin-top:2px" onclick="document.getElementById(\'fontColorSection\').style.display==\'block\' ? (function(){document.getElementById(\'fontColorSection\').style.display=\'none\';document.getElementById(\'fbpfacopts\').setAttribute(\'class\',\'fbpclosedlist\')})() : (function(){document.getElementById(\'fontColorSection\').style.display=\'block\';document.getElementById(\'fbpfacopts\').setAttribute(\'class\',\'fbpopenlist\')})()"><span id="fbpfacopts" class="fbpclosedlist">Font and Colour Options</span></a></p>'+
+'<table id="fontColorSection" style="display:none">' +
+'<tr><td><b>Background Colour</b></td><td><b>Set</b></td></tr><tr style="background-color:#ECEFF5 !important"><td title="Enter a colour name e.g Black,White,Blue,Red,Green etc (You can also use CSS/HTML colour codes)"><input style="width:90px" id="fontbgcolour" value="black"></td><td><input id="fontbgcolourfix" type="checkbox"></td></tr>' +
+'<tr><td><b>Font Colour</b></td><td><b>Set</b></td></tr><tr style="background-color:#ECEFF5 !important" title="Enter a colour name e.g Black,White,Blue,Red,Green etc (You can also use CSS/HTML colour codes)"><td><input style="width:90px" id="fontcolour" value="white"></td><td><input id="fontcolourfix" type="checkbox"></td></tr>' +
+'<tr><td><b>Font</b></td><td><b>Set</b></td></tr><tr style="background-color:#ECEFF5 !important" title="Enter a font name e.g Arial,Helvetica,Verdana,Courier, etc (If the font name has a space in it, put quote marks around the name)"><td><input style="width:90px" id="fbpfont" value="verdana"></td><td><input id="fbpfontfix" type="checkbox"></td></tr>' +
+'<tr><td><b>Font Size</b></td><td><b>Set</b></td></tr><tr style="background-color:#ECEFF5 !important"><td><input style="text-align:right;width:40px" id="fontsize" type="number" value="14" min="8" max="60"> px</td><td><input id="fontfix" type="checkbox"></td></tr>' +
+'</table></td></tr>'+
+
+'</table>' +
+
+'<p/><p/><input id="fbpsavesettings" type="button" onclick="this.disabled=1;" value="Save and Close" class="inputsubmit uiButton uiButtonConfirm uiButtonMedium"> <input onclick="document.getElementById(\'fbpoptsdiv\').style.display=\'none\'" id="closefbpsettings" type="button" value="Cancel" class="inputsubmit uiButton uiButtonConfirm uiButtonMedium">'+
+'<p>If you like F.B. Purity and would like to show your appreciation for all the work<br/>I have put into it and also support future development, please <a href="http://donate.fbpurity.com/">make a donation</a>.<br/></p>' +
+
+'<table><tr><td><a target="_blank" href="http://donate.fbpurity.com"><img style="margin-top:3px" border="0" height="47" width="160" src="https://www.paypal.com/en_US/GB/i/btn/btn_donateCC_LG.gif"></a></td><td>&nbsp;</td><td>Please tell all your friends about FBP too</td><td><a href="http://www.facebook.com/sharer.php?u=http://is.gd/fbpcnet" title="Share on Facebook" target="_blank"><img style="vertical-align:bottom" width="123" height="22" border="0" src="https://sites.google.com/site/st333v/fbp-1/shareonfacebook.gif" alt="Share on Facebook"></a></td></tr></table>'+
+'<br/><form><textarea id="fbpsettingstext" style="display:none"></textarea></form></td></tr></table>'+
+'<div><div style="float:left;margin:10px"><a id="exportsettingslink" href="javascript:;">Export Settings</a> / <a id="importsettingslink" href="javascript:;">Import Settings</a> / <a title="Help with Exporting and Importing Settings" target="_blank" href="http://www.fbpurity.com/faq.htm#importexport"><b>?</b></a></div><div style="float:right;margin:10px"></div></div>';
+
+var fbpfirstrunhtml='<div id="fbpfirstrundiv" style="width:600px;border:solid 3px;margin-left:150px;padding:8px;font-size:14px;font-family:verdana;background:white !important">'+
+'<table width="100%"><tr><td width="66%" style="text-align:right"><a target="_blank" href="http://www.fbpurity.com"><img style="margin-left:auto;margin-right:auto" border="0" src="https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/379777_10150515557207559_408502197558_10866589_209695435_a.jpg"></a></td><td width="33%" valign="top" style="text-align:right"><a href="#" title="Close" onclick="document.getElementById(\'fbpfirstrundiv\').style.display=\'none\'"><b>X</b></a></td></tr></table>'+
+'<br/>'+
+'<div id="firstpara"><p>Hello there! It looks like this is your first time running F.B. Purity <a title="If you are repeatedly seeing this message, then it means FBP cannot save its settings due to a browser restriction, please click here for the solution" href="http://www.fbpurity.com/faq.htm#troubleshooting"><b>*</b></a></p>'+
+'<p>The functionality of this extension is closely linked to the current design of the Facebook website. When Facebook change the design or functionality of the site, this can sometimes stop F.B. Purity from working correctly.</p>' +
+'<p>In order to keep up to date with news of any changes that may break F.B. Purity and for news of new versions of F.B Purity that fix any problems or add new functionality, it is extremely important that you click the like button for the F.B. Purity Fan page on Facebook (below). By doing this you should receive news of updates directly in your newsfeed, and you will also be able to leave feedback about the extension there too.<p/><p><b>Update:</b> Please note, due to Facebook censorship of the FBP fan page, you now also need to subscribe to notifications from the Fan page, otherwise you wont see the FBP news in your newsfeed. To do this, go to the FBP Fan Page, hover over the "Like" button then select "Get Notifications" and you will be notified whenever there is an important update.</p>'+
+'<div><p><b>First Step:</b> Click Like: <iframe src="https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Ffluffbustingpurity&amp;width=292&amp;colorscheme=light&amp;show_faces=true&amp;stream=false&amp;header=false&amp;height=62&amp;ref=FBP_WELCOME_POPUP" scrolling="no" frameborder="0" marginwidth="0" style="border:none; overflow:hidden; width:295px; height:67px;" allowTransparency="true"></iframe></p></div>'+
+'<p></p><p><b>Next Step:</b> <a onclick="document.getElementById(\'firstpara\').style.display=\'none\';document.getElementById(\'secondpara\').style.display=\'block\';" href="javascript:;">Click here for instructions on how to use F.B. Purity</a></p></div>'+
+
+'<div id="secondpara" style="display:none"><p>To change F.B. Purity&apos;s settings, click the &apos;<b>F.B. Purity</b>&apos; link at the top of your newsfeed and to learn more about how F.B. Purity works, please read the <a target="_blank" href="http://www.fbpurity.com/user-guide.htm">F.B. Purity User Guide</a><p/>'+
+'<p>If you have any problems with F.B. Purity, please check out the <a target="_blank" href="http://www.fbpurity.com/#troubleshooting">F.B. Purity Troubleshooting Guide / Help Page</a></p>'+
+'<p>If you have any questions about F.B. Purity, please first read the <a target="_blank" href="http://www.fbpurity.com/faq.htm">F.B. Purity FAQ (Frequently Asked Questions)</a> as your questions are most likely answered there.</p>'+
+
+'<p>If you like F.B. Purity, please show your support by <a target="_blank" href="http://www.fbpurity.com/donate.htm">Donating</a>, as developing, maintaining and supporting this project is an awful lot of work, and I dont get paid for this. Please also tell all your friends about F.B. Purity too.</p>'+
+'<p>Thanks!</p>'+
+'<p>Steve -  The Developer of <a target="_blank" href="http://www.fbpurity.com">F.B. (Fluff Busting) Purity</a></p>'+
+'<table width="100%"><tr><td style="text-align:center"><a onclick="document.getElementById(\'fbpfirstrundiv\').style.display=\'none\'" href="#">Close</a></td></tr></table></div>'+
+'</div>';
+
+function hideotherdivs(e) {
+  divname=e.target.parentNode.id.split(/header/)[0];
+  var boxlist="custext,appwhitelist,custcss";
+  boxarr=boxlist.split(',');
+  for (i in boxarr)
+    if(boxarr[i]==divname) {
+         document.getElementById(divname + "header").setAttribute('style','background:#ECEFF5; font-weight:bold; font-size:15; border:1 solid');
+         document.getElementById(divname + "desc").setAttribute('style','display:block;background:#ECEFF5;');
+         document.getElementById(divname + "ta").setAttribute('style','display:block;width:404px;height:275px');
+    }
+    else {
+         document.getElementById(boxarr[i] + 'header').setAttribute('style','background:white;font-weight:normal;font-size:14;border:0');
+         document.getElementById(boxarr[i] + 'desc').setAttribute('style','display:none');
+         document.getElementById(boxarr[i] + 'ta').setAttribute('style','display:none;');
+    }
+}
+       
+function importsettingsbasic(ev) {
+
+  ev.preventDefault();
+  fbpsettingstext=prompt('F.B. Purity Settings Importer\n\nPaste in your saved FBP settings text, then click OK.')
+  
+  if(fbpsettingstext==null)
+    return;
+    
+  if(!fbpsettingstext.length) {
+     window.alert('You didnt enter valid settings text');
+     return;
+  }
+  else {
+    try {
+      JSON.parse(fbpsettingstext);
+    }
+    catch(e) {
+      window.alert('Error, settings text malformed, not valid. Import failed!');
+      return;
+    }
+    fbpsavevalue('fbpoptsjson-' + currentuserid,fbpsettingstext);
+    
+    window.alert('Import Successful. FBP Settings have been updated! Page will now reload.');
+    
+    //close prefs screen
+    document.getElementById('fbpoptsdiv').style.display='none';
+  
+    //reload page to refresh preferences
+    window.location.reload(true);
+  }
+}
+
+function exportsettingsbasic(ev) {
+  ev.preventDefault();
+  exportsettingsbasic2();
+}
+
+// figure out how to use callbacks, may be a better solution here....
+
+function exportsettingsbasic2(opts) {
+  document.getElementById('fbpsettingstext').setAttribute('style','display:block;width:600px;height:220px');
+  var exporttext;
+  if(!opts && opts!='') {
+    exporttext=fbploadvalue('fbpoptsjson-' + currentuserid,exportsettingsbasic2);
+    if(exporttext==-999)
+      return
+  }
+  else
+    exporttext=opts;
+  
+  if ((typeof(exporttext)=='undefined') || (exporttext.length =="")) {
+    exporttext=fbploadvalue('fbpoptsjson',exportsettingsbasic2);
+       if(exporttext==-999)
+      return;
+  }
+  document.getElementById('fbpsettingstext').textContent=exporttext;
+  
+  window.alert('Copy the FBP settings text from the text box below and save it in a document or text file. If you ever need to restore your settings from that file, simply copy the text from the file, click the Import Settings link and paste the text in.');
+  // autoselect the text in the textarea
+  el=document.getElementById('fbpsettingstext');
+  var range;
+  if ((/textarea/i.test(el.tagName)) || ((/input/i.test(el.tagName)) && (/text/i.test(el.type)))) {
+    el.select();
+  } else if (!!window.getSelection) { // FF, Safari, Chrome, Opera
+    var sel = window.getSelection();
+    range = document.createRange();
+    range.selectNodeContents(el);
+    sel.removeAllRanges();
+    sel.addRange(range);
+  } else if (!!document.selection) { // IE
+    document.selection.empty();
+    range = document.body.createTextRange();
+    range.moveToElementText(el);
+    range.select();
+  }
+}
+
+function get_cookie ( cookie_name )
+{
+  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
+  if ( results )
+    return ( unescape ( results[2] ) );
+  else
+    return null;
+}
+
+function set_cookie (name,value) {
+  document.cookie = name+ "=" + escape(value)+ ';expires=01/04/2099 00:00:00';
+}
+
+// check for GM_set/get API
+var isgmapi, islocstor;
+try {
+  if(typeof(GM_setValue)!='undefined') {
+    GM_setValue('test',1)
+    if ( GM_getValue('test')==1)
+      isgmapi=1;
+    else
+      isgmapi=0;
+  }
+  else
+    isgmapi=0;
+}
+catch (e) {
+  console.log(e);
+  isgmapi=0;
+}
+// check for localstorage
+try {
+  if(typeof(window.localStorage)!='undefined')
+    islocstor=1;
+  else
+    islocstor=0;
+  }
+catch(e) {
+  islocstor=0;
+}
+
+function fbpsavevalue(name,value){
+  try {
+    if(isgmapi) {
+         GM_setValue(name,value);
+       }
+       else if(ischrome) { // ischrome
+      chrome.extension.sendRequest({method: "setLocalStorage", key: name, value: value}, function(response) {
+        ;//console.log(response.data);
+      });
+       }
+       else if(issafari) { //(typeof(window.navigator.vendor)!='undefined') && (window.navigator.vendor.match(/Apple Computer, Inc\./)) && window.navigator.userAgent.match(/Version\/5\./)
+         safari.self.tab.dispatchMessage("setLocalStorage",{key: name, value: value});
+      /*function replyToMessage(response) {
+        if (response.name === "data") {
+                       console.log('safari save value response:' + response.message);
+                       //if((typeof(response.message) !='undefined') && response.message.match(/\"filterappmessages\"/)) {
+                       //  window.localStorage[name]=response.message;
+            //  window.location.reload();
+                       //}
+        }
+      }*/
+         // register for message events
+      //safari.self.addEventListener("message", replyToMessage, false);
+       }
+       else if(isopera) { //window.navigator.userAgent.match(/Opera/)
+         widget.preferences[name]=value;
+       }
+       /* if i support localstorage and cookie, the user will repeatedly get the new user screen when the cookies are cleared, so lets comment this out
+       else if(locstor) {
+         window.localStorage[name]=value;
+       }
+       else
+         set_cookie(name,value);
+       */
+  }
+  catch (e) {
+    //console.log(e);
+    if(islocstor)
+      window.localStorage[name]=value;
+       else
+      set_cookie(name,value); 
+  }
+}
+
+function fbploadvalue(name,funct){
+  if(debug)
+    console.trace();
+    //console.log('entering function : ' + arguments.callee.name);
+       
+  try {
+    if(isgmapi) {
+         val = GM_getValue(name);
+       }
+       else if(ischrome) {
+         // Chrome Extension
+      chrome.extension.sendRequest({method: "getLocalStorage", key: name}, function(response) {
+                 //fbpdynamicreload(response.data); // we should maybe figure a way of doing this event driven
+                 if(funct) {
+                   if(debug)
+                     console.log("we in call back, and heres the data: " + response.data);
+                       if((typeof(response)=='undefined') || (typeof(response.data)=='undefined'))
+                         funct('');
+                       else
+                         funct(response.data);
+                 }  
+               //}
+      });
+         val=-999;
+         if(debug)
+           console.log('name: ' + name + ' value' + val);
+       }
+       else if(issafari) {
+      // Safari Extension
+      safari.self.tab.dispatchMessage("getLocalStorage",name);
+         function replyToMessage(response) {
+           if(debug)
+                 console.log(response.message);
+               if(funct) {
+                 if(debug)
+                   console.log("we in call back, and heres the data: " + response.message);
+                 if(typeof(response.message)=='undefined')
+            funct('');
+                 else
+                   funct(response.message);
+               }       
+      }
+         // register for message events
+      safari.self.addEventListener("message", replyToMessage, false);
+         val=-999;
+       }
+       else if(isopera) {
+         if((typeof(widget.preferences[name]) !='undefined') ) { 
+               val = widget.preferences[name];
+               //fbpdynamicreload();
+         }
+           else val='';
+       }
+  }
+  catch (e) {
+    console.log(e);
+    if(islocstor)
+      val=window.localStorage[name];
+       else
+      val=get_cookie(name); 
+    }
+  return val;
+}
+
+function initundef() {
+  if(typeof (fbpoptsobj.filterappmessages) =='undefined')
+    fbpoptsobj.filterappmessages=1;
+  if(typeof (fbpoptsobj.sortmostrecent) =='undefined')
+    fbpoptsobj.sortmostrecent=0;
+  if(typeof (fbpoptsobj.fixarticleredirects) =='undefined')
+    fbpoptsobj.fixarticleredirects=1;
+}
+
+function fbpgetprefs(opts) {
+  if(debug) {
+    console.trace();
+       console.log(arguments.callee.length);
+    console.log(opts);
+       //console.log('entering function : ' + arguments.callee.name);
+  }
+
+  var optsdump;
+  if(typeof(opts)!='undefined') {
+    if(opts && opts.length) {
+         if(debug)
+           console.log("opts=" + opts);
+      optsdump=opts;
+         try {
+           fbpoptsobj=JSON.parse(optsdump);
+         }
+         catch(e) {
+           console.log('error reading json in fbpgetprefs');
+           console.dir(e);
+           return;
+         }
+         initundef();
+         initstage2();
+         finalstage();
+       }
+       else {
+         if(debug)
+           console.log('are we at the top?');
+         if(!issafari) // because getting vars out of localstorage is not working in safari, we not checking for first run
+        fbpfirstruncheck();
+      fbpoptsobjinit();
+         initundef();
+         initstage2();
+         finalstage();
+       }
+  }
+  else {
+    //console.log("user" + currentuserid);
+    optsdump = fbploadvalue('fbpoptsjson-' + currentuserid,fbpgetprefs);//'fbpgetprefs'
+       if(optsdump!=-999) { //if(!isasync) {
+         if(optsdump && optsdump.length) {
+           try{
+             fbpoptsobj=JSON.parse(optsdump);
+               }
+               catch(e) {
+                 fbpoptsobj=JSON.parse(decodeURIComponent(optsdump)); // this line is to make it compatible with older firefox extension which urlencoded/decoded saved values inside the extension
+               }
+        initundef();
+               initstage2();
+               finalstage();
+         }
+         else {
+               if(debug)
+                 console.log('are we at the bottom?');
+               if(!issafari) // because getting vars out of localstorage is not working in safari, we not checking for first run
+          fbpfirstruncheck();
+        fbpoptsobjinit();
+               initundef();
+           initstage2();
+               finalstage();
+      }
+       }
+  }
+  //unsafeWindow.console.log(typeof(optsdump) + '  xxx  ' + optsdump  + 'xxx' + optsdump.length);
+}
+
+function fbpfirstruncheck(result) {
+  
+  if(debug) {
+    console.trace();
+       console.log('firstrun? ' + result);
+  }
+    //console.log('entering function : ' + arguments.callee.name);
+  var fbpfirstrun;
+  //alert("firstres = " + result);
+  //if(result || (result=='')) { was working on chrome and firefox and opera?
+  if(typeof(result)!='undefined') {
+    fbpfirstrun=result;
+  }
+  else 
+    fbpfirstrun=fbploadvalue('fbpfirstrun',fbpfirstruncheck);
+  if(fbpfirstrun==-999)
+    return;
+
+  //alert("secondres = " + fbpfirstrun); // make sure user is logged in (pageLogo element is there)
+  if (((fbpfirstrun=='') || (typeof(fbpfirstrun)=='undefined') || (fbpfirstrun==null)) && (!(window.location.href.match(/^https?:\/\/apps\.facebook|^https?:\/\/blog\.facebook|^https?:\/\/secure\.facebook/)))) {
+    if(!document.getElementById('fbpfirstrundiv') && document.getElementById('blueBar') && document.getElementById('pageLogo')) {
+         ph=document.getElementById('blueBar'); //pageHead
+         firstrundiv=document.createElement('div');
+         firstrundiv.innerHTML=fbpfirstrunhtml;
+         if(ph.firstChild)
+           ph.firstChild.parentNode.insertBefore(firstrundiv, ph.firstChild.nextSibling);
+      fbpsavevalue('fbpfirstrun',new Date() + "");
+       }
+  }
+}
+
+function checkifupdaterequired(currver,latestver) {
+  if(debug)
+    console.trace();
+    //console.log('entering function : ' + arguments.callee.name);
+       
+  if (currver && latestver) {
+    var fbpupdatehtml = "**<a title='An update is available for F.B. Purity (v" +  latestver +").\nClick here to begin the upgrade process' href='http://www.fbpurity.com/install.htm?v=" + currver + "'><b>Update</b></a>** ";
+    if (currver==latestver)
+         return; //window.alert('Congrats! You have the latest version of FB Purity :)');
+    else {
+      cvpart1=currver.split(/\./)[0];
+      cvpart2=currver.split(/\./)[1];
+      cvpart3=currver.split(/\./)[2];
+      lvpart1=latestver.split(/\./)[0];
+      lvpart2=latestver.split(/\./)[1];
+      lvpart3=latestver.split(/\./)[2];
+      if(cvpart1<lvpart1) {
+           if(document.getElementById('fbpupgradeinfo'))
+          document.getElementById('fbpupgradeinfo').innerHTML=fbpupdatehtml;
+         }
+      else if (cvpart1 == lvpart1) {
+        if(cvpart2 < lvpart2) {
+             if(document.getElementById('fbpupgradeinfo'))
+            document.getElementById('fbpupgradeinfo').innerHTML=fbpupdatehtml;
+               }
+        else if (cvpart2 == lvpart2) {
+          if(cvpart3 < lvpart3)
+                   if(document.getElementById('fbpupgradeinfo'))
+              document.getElementById('fbpupgradeinfo').innerHTML=fbpupdatehtml;
+        }
+      }
+      
+    }
+  }
+}
+
+function checkupdatefeed(result) {
+  if(debug)
+    console.trace();
+    //console.log('entering function : ' + arguments.callee.name);
+       
+  var fbplastupdatecheck;
+  if(result || (result=='')) {
+    if(debug)
+      console.log('fbplastupdatecheck val = ' + result);
+    fbplastupdatecheck=result;
+       if(typeof(fbplastupdatecheck)=='undefined')
+         fbplastupdatecheck='';
+  }
+  else
+    fbplastupdatecheck=fbploadvalue('fbplastupdatecheck',checkupdatefeed);
+  if(fbplastupdatecheck==-999)
+    return;
+       
+  if(debug)
+    console.log('fbplastupdate=' + fbplastupdatecheck);
+  
+  var currtime = new Date().getTime(); // creates a new Date representing today
+  var currver = fbpVersion.replace('v','');
+  
+  if( (typeof(fbplastupdatecheck)!='undefined') && (fbplastupdatecheck != '') && (fbplastupdatecheck!=null)) {
+    var fbplastupdatecheckdate=fbplastupdatecheck.split(/\:/)[0];
+       var fbplastupdatecheckver=fbplastupdatecheck.split(/\:/)[1];
+       if((typeof(fbplastupdatecheckver) !='undefined') && (!fbplastupdatecheckver.match(/\./)))
+         fbplastupdatecheckver='';
+       if(debug)
+         console.log('lastupdate check version= '+ fbplastupdatecheckver);
+    if((typeof(fbplastupdatecheckdate) !='undefined') && fbplastupdatecheckdate.match(/^\d+$/)) {
+      //To compute the difference, convert both to their millisecond representations and subtract:
+      var diff = currtime - fbplastupdatecheckdate;
+      //In this case the difference will be negative, as d1 preceeds d2.
+      var num_days = (((diff / 1000) / 60) / 60) / 24;
+      if(num_days < 1) {
+           //var cachedupdatever=fbploadvalue(fbpupdatever);
+               if((typeof(fbplastupdatecheckver)!='undefined') && (fbplastupdatecheckver != ''))
+                 checkifupdaterequired(currver,fbplastupdatecheckver);
+        return;
+      }
+    }
+       else {
+         // time value is corrupted somehow?
+         if (typeof(unsafeWindow) =='undefined') 
+           ;//console.log('error: fbplastupdatecheck= ' + fbplastupdatecheck); 
+      else 
+           ;//unsafeWindow.console.log('error: fbplastupdatecheck= ' + fbplastupdatecheck);
+         return;
+       }
+  }
+
+  //fbpsavevalue('fbplastupdatecheck',currtime + '');
+  var http = new window.XMLHttpRequest();
+  var url = window.location.protocol + "//www.facebook.com/feeds/page.php?id=186105101490362&format=json";  // https://www.facebook.com/pages/FB-Purity-Updates/186105101490362
+  http.open("GET", url, true);
+  //http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+  //http.setRequestHeader("Content-length", params.length);
+  //http.setRequestHeader("Connection", "close");
+
+  http.onreadystatechange = function() {
+    if(http.readyState == 4 && http.status == 200) {
+         //console.log(http.responseText);
+         try {
+           var fbpfeed = JSON.parse(http.responseText);
+         }
+      catch (e) {
+               http=fbpfeed=null;
+               return;
+      }
+         if(fbpfeed.entries[0].title.length && fbpfeed.entries[0].title.match(/F.B. Purity v(\d{1,}\.\d{1,}\.\d{1,}) /))
+           latestver=fbpfeed.entries[0].title.match(/F.B. Purity v(\d{1,}\.\d{1,}\.\d{1,}) /)[1];
+      else
+           return;
+         //var x = new Date (fbpfeed.entries[0].published);
+      //newsa.setAttribute('title', "Published - " + x.toLocaleDateString());  
+         //alert(currver + ' '  + latestver);
+         fbpsavevalue('fbplastupdatecheck', currtime + ':' + latestver);
+         checkifupdaterequired(currver,latestver);
+      http=null;
+    }
+  }
+  http.send();
+}
+
+if (!issafari) // workaround for bug in message passing in safari extension for getting fbpprefs (the messages were crossing over to the wrong locations)
+window.setTimeout(function() {
+  checkupdatefeed();
+}, 3000); // wait a bit, to insure fbpinfobar will be there...
+
+
+function fbppopulateprefs() {
+  if(debug)
+    console.trace();
+    //console.log('entering function : ' + arguments.callee.name);
+       
+  // if options screen has been wiped out, re-insert it
+  if(!document.getElementById('fbpoptsdiv') && document.getElementById('content') ) {
+    document.getElementById('content').appendChild(optsdiv);
+    document.getElementById('fbpsavesettings').addEventListener('click',fbpsavesettings,false);
+    
+    document.getElementById('exportsettingslink').addEventListener('click',exportsettingsbasic,false);
+    document.getElementById('importsettingslink').addEventListener('click',importsettingsbasic,false);
+       
+       document.getElementById('custextheader').addEventListener('click',hideotherdivs,false);
+       document.getElementById('appwhitelistheader').addEventListener('click',hideotherdivs,false);
+       document.getElementById('custcssheader').addEventListener('click',hideotherdivs,false);
+  }
+
+  // fill out the preferences form with current settings
+  for(var i=0;i<fbpoptsarr.length;i++) {
+    if(document.getElementById(fbpoptsarr[i])) {
+      if(fbpoptsobj[fbpoptsarr[i]]==1) {
+        document.getElementById(fbpoptsarr[i]).checked=true; 
+        //unsafeWindow.console.log (filterapptext, fbpoptsarr[i] + ' ' + ' ' + fbpoptsobj[fbpoptsarr[i]]);
+        }
+      else
+        document.getElementById(fbpoptsarr[i]).checked=false;
+    }
+  }
+  if(fbpoptsobj.customtextfilter && fbpoptsobj.customtextfilter.length) {
+       document.getElementById('custextta').value=fbpoptsobj.customtextfilter.replace(/\,/g,"\n");
+       //unsafeWindow.console.log(fbpoptsobj.customtextfilter);
+  }
+  else  
+    document.getElementById('custextta').value='';
+    
+  if(fbpoptsobj.userappwhitelist && fbpoptsobj.userappwhitelist.length) {
+       document.getElementById('appwhitelistta').value=fbpoptsobj.userappwhitelist.replace(/\,/g,"\n");
+       //unsafeWindow.console.log(fbpoptsobj.userappwhitelist);
+  }
+  else {
+       document.getElementById('appwhitelistta').value='';
+  }
+    
+  if(fbpoptsobj.fontsize)
+    document.getElementById('fontsize').value=fbpoptsobj.fontsize;
+       
+  if(fbpoptsobj.fontcolour)
+    document.getElementById('fontcolour').value=fbpoptsobj.fontcolour;
+       
+  if(fbpoptsobj.fontbgcolour)
+    document.getElementById('fontbgcolour').value=fbpoptsobj.fontbgcolour;
+  
+  if(fbpoptsobj.fbpfont)
+    document.getElementById('fbpfont').value=fbpoptsobj.fbpfont;
+  
+  if(fbpoptsobj.fbpcustomcss && (typeof(fbpoptsobj.fbpcustomcss) != 'undefined')) {
+       document.getElementById('custcssta').value=fbpoptsobj.fbpcustomcss;
+       //unsafeWindow.console.log(fbpoptsobj.fbpcustomcss);
+  }
+  else  
+    document.getElementById('custcssta').value='';
+}
+
+function fbpsavesettings(ev) {
+
+  for(var i=0;i<fbpoptsarr.length;i++) {
+  
+    if(document.getElementById(fbpoptsarr[i]) && document.getElementById(fbpoptsarr[i]).checked==true)
+      fbpoptsobj[fbpoptsarr[i]]=1;
+    else
+      fbpoptsobj[fbpoptsarr[i]]=0;
+  }
+  if(document.getElementById('custextta').value.length) {
+    //fbpoptsobj.customtextfilter=document.getElementById('customtextfilter').value.replace(/, *$/,'','g'); // replace trailing comma and spaces
+       tempcustomtextfilter=document.getElementById('custextta').value.replace(/[\r\n|\r|\n]/g,"\,").replace(/\,{1,}/g,'\,').replace(/,$/,'').replace(/^,/,'');
+       fbpoptsobj.customtextfilter='';
+       ctfarr=tempcustomtextfilter.split(',');
+       //for(i=ctfarr.length-1;i>=0;i--)
+       for(i=0;i<ctfarr.length;i++)
+         if (ctfarr[i].replace(/^ {1,}$/,'')!='')
+            fbpoptsobj.customtextfilter+=ctfarr[i] + ','; // strip out lines that are just spaces.
+                
+    fbpoptsobj.customtextfilter=fbpoptsobj.customtextfilter.replace(/,$/,''); // strip trailing comma
+//     alert(fbpoptsobj.customtextfilter);
+  }
+  else  
+    fbpoptsobj.customtextfilter='';
+
+  if(document.getElementById('appwhitelistta').value.length) {
+    fbpoptsobj.userappwhitelist=document.getElementById('appwhitelistta').value.replace(/ /g,'').replace(/[\r\n|\r|\n]/g,"\,").replace(/\,{1,}/g,'\,').replace(/,$/,'').replace(/^,/,'');
+       //alert(fbpoptsobj.userappwhitelist);
+  }
+  else  
+    fbpoptsobj.userappwhitelist='';
+  
+  // begin new custom css box
+  if(document.getElementById('custcssta').value.length) {
+       fbpoptsobj.fbpcustomcss=document.getElementById('custcssta').value;
+  }
+  else  
+    fbpoptsobj.fbpcustomcss='';
+  // end new custom css box
+    
+  fbpoptsobj.fontsize=document.getElementById('fontsize').value;
+  fbpoptsobj.fontcolour=document.getElementById('fontcolour').value;
+  fbpoptsobj.fontbgcolour=document.getElementById('fontbgcolour').value;
+  fbpoptsobj.fbpfont=document.getElementById('fbpfont').value;
+
+  //save to prefs obj to localstorage
+  fbpsavevalue('fbpoptsjson-' + currentuserid, JSON.stringify(fbpoptsobj));
+  
+  //console.log(JSON.stringify(fbpoptsobj));
+  
+  //close prefs screen
+  document.getElementById('fbpoptsdiv').style.display='none';
+  
+  //reload page to refresh preferences
+  window.location.reload(true);
+
+  // Dynamically update the page instead of reloading the whole page, only problem is if the page contains many posts, this is very slow.
+  /*
+  document.getElementById("fbpsavesettings").disabled=false;
+  fbpgetprefs();
+  resetclasses(); // need to also reset other filters and css
+  initstage2();
+  //updateblockedcount(); // doesnt seem to do anything and clear the shizzle, should automatically update it. (we are getting nodes with 2 classes fbpnormal and fbpblocked
+  cleartheshizzle(document);
+  */
+}
+
+function fbpoptsobjinit() {
+  if(debug)
+    console.trace();
+    //console.log('entering function : ' + arguments.callee.name);
+       
+  // set up default options
+  fbpoptsobj.filterappmessages=1;
+  fbpoptsobj.becamefriends=1;
+  fbpoptsobj.becamefan=1;
+  fbpoptsobj.joinedgroup=1;
+  fbpoptsobj.attendevent=1;
+  fbpoptsobj.attendedevent=1;
+  fbpoptsobj.createdevent=0;
+
+  fbpoptsobj.commentlikeslink=0;
+  fbpoptsobj.commentwall=0;
+  fbpoptsobj.commentgroupwall=0;
+  fbpoptsobj.commentpagewall=0;
+  fbpoptsobj.commenteventwall=0;
+  fbpoptsobj.updatedprofile=0;
+  fbpoptsobj.changedprofilepic=0;
+  fbpoptsobj.changedrelationship=0;
+  
+  fbpoptsobj.uploadedphoto=0;
+  fbpoptsobj.sharedphoto=0;
+  fbpoptsobj.uploadedvideo=0;
+  fbpoptsobj.taggedinvideo=0;
+  fbpoptsobj.postednote=0;
+  fbpoptsobj.taggedinnote=0;
+  fbpoptsobj.postedlink=0;
+  fbpoptsobj.readarticle=0;
+  fbpoptsobj.checkedin=0;
+  
+  fbpoptsobj.suggestionsbox=0;
+  fbpoptsobj.connectbox=0;
+  fbpoptsobj.sponsoredbox=1;
+  fbpoptsobj.pokebox=0;
+  fbpoptsobj.happeningnowbar=0;
+  fbpoptsobj.betabox=0;
+  fbpoptsobj.commentbutton=0;
+  fbpoptsobj.offlinefriends=1;
+  
+  fbpoptsobj.requestsbox=0;
+  fbpoptsobj.eventsbox=0;
+  fbpoptsobj.questionsbox=0;
+  fbpoptsobj.chatbox=0;
+  fbpoptsobj.pagestory=0;
+  
+  //fbpoptsobj.commentslikestopnews=0;
+  fbpoptsobj.recentactivity=0;
+  
+  fbpoptsobj.fontsize='13';
+  fbpoptsobj.fontfix='0';
+  fbpoptsobj.fontcolour='';
+  fbpoptsobj.fontcolourfix=0;
+  fbpoptsobj.fontbgcolour='';
+  fbpoptsobj.fontbgcolourfix=0;
+  fbpoptsobj.fbpfont='';
+  fbpoptsobj.fbpfontfix=0;
+  
+  fbpoptsobj.sortmostrecent=0;
+  fbpoptsobj.fixarticleredirects=1;
+  fbpoptsobj.timelineonecol=0;
+  
+  // left hand column options
+  fbpoptsobj.lcadvertmgr=0;
+  fbpoptsobj.lcconnect=0;
+  fbpoptsobj.lcallpages=0;
+  fbpoptsobj.lcpagesfeed=0;
+  fbpoptsobj.lclikepages=0;
+  fbpoptsobj.lcallapps=0;
+  fbpoptsobj.lcappcenter=0;
+  fbpoptsobj.lcevents=0;
+  fbpoptsobj.lcgamesfeed=0;
+  fbpoptsobj.lcpokes=0;
+  fbpoptsobj.lcmusic=0;
+  fbpoptsobj.lcplaceseditor=0;
+  fbpoptsobj.lcallgroups=0;
+  fbpoptsobj.lcallinterests=0;
+  fbpoptsobj.lcfindfriends=0;
+  fbpoptsobj.lccreatepage=0;
+  fbpoptsobj.lccreategroup=0;
+  fbpoptsobj.lcdeveloper=0;
+  fbpoptsobj.lcfriends=0;
+  fbpoptsobj.lcgifts=0;
+  
+  // right hand column options
+  fbpoptsobj.rcrecommendedpages=0;
+  fbpoptsobj.rcrelatedgroups=1;
+  fbpoptsobj.rcpokes=0;
+  fbpoptsobj.rcbirthdays=0;
+  fbpoptsobj.rcfriendrequests=0;
+  fbpoptsobj.rcgamerequests=0;
+  
+  // Begin new options 28th jan 2013
+  fbpoptsobj.upcomingevents=0;
+  fbpoptsobj.sharedevent=0;
+  
+  fbpoptsobj.sharedpage=0;
+  fbpoptsobj.likedlink=0;
+  fbpoptsobj.commentedlink=0;
+  fbpoptsobj.hideallphotos=0;
+  fbpoptsobj.taggedphoto=0;
+  fbpoptsobj.likedphoto=0;
+  fbpoptsobj.commentedphoto=0;
+
+  fbpoptsobj.sharedvideo=0;
+  fbpoptsobj.likedvideo=0;
+  fbpoptsobj.commentedvideo=0;
+  fbpoptsobj.youtubevideo=0;
+
+  fbpoptsobj.sharedstatus=0;
+  fbpoptsobj.likedstatus=0;
+  fbpoptsobj.commentedstatus=0;
+  fbpoptsobj.taggedstatus=0;
+  fbpoptsobj.smileys=0;
+  fbpoptsobj.notificationpopup=0;
+  
+  fbpoptsobj.hidealllinks=0;
+  fbpoptsobj.hideallvideos=0;
+  fbpoptsobj.fixedleftcolumn=1;
+  // End new options 28th jan 2013
+
+  fbpoptsobj.customtextfilter='';
+  fbpoptsobj.userappwhitelist='';
+  fbpoptsobj.fbpcustomcss='';
+  
+}
+
+// APPLICATION WHITELIST
+// ---------------------
+
+// If you would like to edit the list of applications in the user whitelist, 
+// theres detailed instructions here: http://whitelist.fbpurity.com
+
+var defaultappwhitelist = "6628568379,115463795461,48119224995,5895217474,56212371378,146139331013,2254487659,2915120374,74769995908,4620273157,14405921260,10754253724,2483740875,22950410511,43769862066,2550392059,8109791468,2238752371,21370137768,6195724695,6694405826,2231777543,53702860994,20407635301,38125372145,56137638329,10732101402,16297770890,2877035514,41158896424,72687635881,350685531728,30713015083,111527682205237,121958126090,2330519541,49340319393,26463759431,21810043296,24420472648,183319479511,189818072392,302006227267,90376669494,108160725869250,39010226174,247431880944,66746580154,96105046534,143907478979139,146563558702544,131289390231340,9953271133,45439413586,131732509879,23723376453,76456527540,105130332854716,27694818115,67878695711,124024574287414,79763977758,139682082719810,122580857763901,24553799497,159348674082705,112618498804176,148061315211358,104142802965358,149588628439275,7933375107,135892916448833,48505437520,198446803501767,193278124048833,165907476854626,213546525407071,531615603522381,149859461799466,178645865537776";
+
+// the application ids in the default app whitelist above belong to, in order:
+// 6628568379   = facebook iphone application
+// 115463795461 = selective twitter
+// 48119224995  = tumblr
+// 5895217474   = digsby
+// 56212371378  = tweetdeck
+// 146139331013 = tweetdeck for iphone
+// 2254487659   = facebook for blackberry
+// 2915120374   = facebook mobile widget
+// 74769995908  = facebook for android
+// 4620273157   = facebook for palm
+// 14405921260  = facebook for motorola (motoblur)
+// 10754253724  = iphoto uploader
+// 2483740875   = picasa uploader
+// 22950410511  = sprint/samsung? photo/video uploader
+// 43769862066  = SonyEricsson
+// 2550392059   = MusicPlayer
+// 8109791468   = Status Shuffle
+// 2238752371   = Facebook Exporter for iPhoto
+// 21370137768  = official flickr application
+// 6195724695   = Windows Phone
+// 6694405826   = Posterous
+// 2231777543   = Twitter
+// 53702860994  = LG Mobile
+// 20407635301  = Snaptu
+// 38125372145  = SonyEricsson Panel
+// 56137638329  = Nokia
+// 10732101402  = ping.fm
+// 16297770890  = 3Skypephone 'S2'
+// 2877035514   = Gwibber
+// 41158896424  = HTC Sense 
+// 24420472648  = HTC Sense
+// 72687635881  = Samsung Mobile
+// 350685531728 = facebook for android
+// 30713015083  = windows live messenger
+// 111527682205237 = O2 social link
+// 121958126090 = LG Phone
+// 2330519541   = Bloom photo uploader
+// 49340319393  = Ovi by Nokia
+// 26463759431  = My INQ Mobile
+// 21810043296  = Facebook for the T-Mobile Sidekick
+// 183319479511 = HootSuite
+// 189818072392 = live journal
+// 302006227267 = Sony Ericsson X10 mini pro
+// 90376669494  = Yahoo
+// 108160725869250 = Sony Ericsson
+// 39010226174  = Vlingo
+// 247431880944 = Droid
+// 66746580154  = Dell Mobile
+// 96105046534  = RockMelt
+// 143907478979139 = RockMelt Beta
+// 146563558702544 = Friendly for Ipad
+// 131289390231340 = Slide
+// 9953271133   = networked blogs
+// 45439413586  = RSS Grafitti
+// 131732509879 = Twitter Feed
+// 23723376453  = Seesmic
+// 76456527540  = Facebook mobile by Opentech ENG
+// 105130332854716 = flipboard
+// 27694818115     = Ovi by Nokia
+// 67878695711     = Nokia N900
+// 124024574287414 = Instagram
+// 79763977758     = Kodak Easy Share
+// 139682082719810 = Snaptu for Facebook
+// 122580857763901 = eBuddy
+// 24553799497     = mobileblog
+// 159348674082705 = Photoloader
+// 112618498804176 = FriendCaster for Android
+// 148061315211358 = Friendcaster Pro for android
+// 104142802965358 = My INQ Mobile
+// 149588628439275 = Twidroyd for Twitter
+// 7933375107      = Windows Phone
+// 135892916448833 = Facebook for Windows Phone
+// 48505437520 = Sony Ericsson Web Albums
+// 198446803501767 = HTC ChaCha
+// 193278124048833 = HTC Sense
+// 165907476854626 = Facebook Pages Manager
+// 213546525407071 = iOS
+// 531615603522381 = Facebook Site Governance voting app
+// 149859461799466 = Sony Xperia Smartphone
+// 178645865537776 = Blackberry
+// --193048140809145-- = Facebook Likes (built in facebook app? this is a weird one, ive actually removed it for now, will investigate further. just leaving this here as a reminder)
+
+
+// EXTRA STORIES ( see http://extras.fbpurity.com for more info )
+// Read option settings and set extra story codes
+
+////////////////////////
+/// BEGIN opts 
+////////////////////////   
+
+var arrwhitelist2={}; // this is the main application whitelist array
+var extraTextFilter;
+var headerTextFilter;
+var cleancustomtextfilter='';
+var headertextfilterRX;
+var textfilterRX;
+var filterapptext;
+var fbpboxstyles;
+var fbpfanpageid="408502197558";
+var fbpdevpageid="464154953615751";
+
+function getuserid(){
+  var userid='';
+  var currentuser=document.getElementsByClassName('headerTinymanPhoto');
+  if(currentuser.length && currentuser[0].src && currentuser[0].src.match(/_/))
+    userid=currentuser[0].src.split('_')[1];
+  else
+    try {
+      userid=document.cookie.match(/c_user=(\d+)/)[1];
+    }
+    catch(e) {
+      console.log('problem getting logged in user id: ' + e);
+    }
+  return userid;
+}
+
+var currentuserid=getuserid();
+
+if (!currentuserid.length)
+  var useridwhitelistRX=new RegExp(fbpfanpageid);
+else
+  var useridwhitelistRX=new RegExp(fbpfanpageid + "|" + fbpdevpageid + "|" + currentuserid);
+
+refreshwhitelist = function () {
+  var whitelist;
+  if (fbpoptsobj.userappwhitelist && fbpoptsobj.userappwhitelist.length)
+    whitelist = defaultappwhitelist + "," + fbpoptsobj.userappwhitelist;
+  else
+    whitelist = defaultappwhitelist;
+
+  whitelist = whitelist.replace(/,,/g,''); // remove blanks (if any)
+  whitelist = whitelist.replace(/ /g,'');  // remove spaces (if any)
+  whitelist = whitelist.replace(/,$/,'');  // remove trailing comma (if any)
+  
+  var arrwhitelist=whitelist.split(',');
+
+  for (i in arrwhitelist)
+    arrwhitelist2[arrwhitelist[i]]=true; // create hashmap
+}
+
+  fbptimelinerestyle=function (tloff) {
+    var tlstyle='';
+    if (tloff) {
+         //fix group cover image links 
+         tlstyle += ' .groupsCoverPhoto img.coverPhotoImg, .groupsCoverPhoto a.coverWrap {height:100px !important}'+
+         // make the Timeline Cover Photo Shorter (not doing this any more as it interfers with changing cover photo)
+      //  ' .cover {height:100px !important} .coverWrap {height:150px !important} #pagelet_timeline_nav {margin-top:-10px} #fbTimelineHeadline .name h2, .fbEventHeadline {text-shadow: 1px 1px grey;} #fbTimelineHeadline .name h2 .fsm {text-shadow: 0px 0px;} #fbTimelineHeadline {top:8px} '+        
+
+         // fix save and cancel and drag to reposition
+           ' #coverEditSaveCancelArea .saveAndCancel {margin-top:40px} a.coverWrap .instructionWrap {top:120px !important}'+
+      // hide the 'Coming Soon: Timeline' section at the top of Timeline pages
+        ' #pagelet_above_header_timeline {display:none}'+
+         // hide the "escape hatch" (friends / about / interests picture squares section)
+           ' #pagelet_escape_hatch {display:none}'+
+      // single column timeline
+        ' .fbTimelineUnit { float:left !important; clear:left !important; width:540px; border-top:1px solid #ccc !important; border-bottom:1px solid #ccc !important;} .fbTimelineUnit .topBorder { display:none} .fbTimelineUnit .spinePointer { display:none } .fbTimelineUnit .bottomBorder { display:none  } .timelineUnitContainer { width:auto !important} .timelineUnitContainer .uiCommentContainer { width:auto !important; } .fbTimelineCapsule { background:none !important; background-color:white !important; } .fbTimelineIndeterminateContent { float:right !important; width:280px !important; margin-right:10px; } .tlTxFe { font-size:inherit !important; line-height:inherit !important} #timelineNavContent .fbTimelineNavigation {width:849px}' +
+         // fix left margin and cover image size for personal timeline versus fan page timeline        
+         ' .pagesTimelineLayout .fbTimelineUnit {margin-left:150px !important} '+
+         //div[itemtype="http://data-vocabulary.org/Person"] #fbProfileCover .coverWrap { {height: 150px !important} div[itemtype="http://data-vocabulary.org/Person"] .coverWrap {height:150px !important}' +
+      // event page with cover image
+               ' div.fbEventLeftNav {position:relative;top:20px !important} div.fbEventHeaderBlock {position:relative;top:25px !important;left:0px !important }';
+       }
+       if (document.getElementById('fbptlstyle'))
+      document.getElementById('fbptlstyle').textContent=tlstyle;
+  }
+  
+initstage2 = function () {
+  if(debug)
+    console.trace();
+    //console.log('entering function : ' + arguments.callee.name);
+       
+  if(fbpoptsobj.sortmostrecent) { // force feed to sort by most recent
+    var sortlink=document.getElementsByClassName('sortLink');
+    if(sortlink.length) {
+      if(!sortlink[0].textContent.match(/\:/))
+        window.location.href=window.location.protocol +'//www.facebook.com/?sk=h_chr';
+    }
+  }
+  extraTextFilter='';  // init extraTextFilter
+  headerTextFilter=''; // init headerTextFilter
+  if(fbpoptsobj.filterappmessages==1) {
+    filterapptext=' fbpblocked';
+       headerTextFilter += ', played .*,started playing,started using';
+       extraTextFilter += ',games your friends are playing,Games You May Like';
+  }
+  else
+    filterapptext=' fbpnormal';
+
+  if(fbpoptsobj.becamefriends==1)
+    headerTextFilter += ',are now friends,is now friends with,now allows subscribers,subscribed to updates from,subscribed to .*\'s updates,subscribed to the list, followed .*\.'; // can probably get rid of subscribed to now (as they switched to follow)
+    
+  if(fbpoptsobj.becamefan==1){
+       headerTextFilter += ', recommends, likes .* and \\d* other pages,wrote a recommendation for, rated .*';
+    extraTextFilter += ',like page,Like this Page,Find More Pages ·, Write a recommendation ';
+  }
+  if(fbpoptsobj.joinedgroup==1) {
+       headerTextFilter += ",.* was added to ,uploaded a .* in the group, was invited to, were invited to, invited .* to ,updated the description of the group,updated the group";
+       extraTextFilter += ",· Join Group";
+  }
+  
+  if(fbpoptsobj.attendevent==1)
+       headerTextFilter += ",is attending, is going to";
+     
+  if(fbpoptsobj.attendedevent==1)
+       headerTextFilter += ", attended the event, went to .*\.";
+    
+  if(fbpoptsobj.createdevent==1)
+    headerTextFilter += ",created an event,updated the event photo";
+  
+  if((typeof fbpoptsobj.upcomingevents !=='undefined') && (fbpoptsobj.upcomingevents==1))
+    extraTextFilter += ",Upcoming Events,Upcoming Concerts";
+       
+  if((typeof fbpoptsobj.sharedevent !=='undefined') && (fbpoptsobj.sharedevent==1))
+    headerTextFilter += ",shared an event, shared .*\\'s event, posted an event";
+       //extraTextFilter += ",people are goingjoin" // may also filter out "created an event" stories
+       
+  if (typeof fbpoptsobj.checkedin == "undefined")
+    fbpoptsobj.checkedin = 0;
+       
+  if(fbpoptsobj.checkedin==1)
+       headerTextFilter += ", is with .*,was tagged at, is in .*\., was in .*\., is at .*\., was at .*\., were at .*\., are at .*\., was with ";
+
+  if((typeof fbpoptsobj.likedstatus !=='undefined') && (fbpoptsobj.likedstatus==1))
+       headerTextFilter += ", likes .*\'s status, like .*\'s status, like a status, likes a status, likes a post";
+
+  if((typeof fbpoptsobj.commentedstatus !=='undefined') && (fbpoptsobj.commentedstatus==1))
+       headerTextFilter += ",commented on .* status, commented on .* note, commented on .* activity";
+         
+  //if(fbpoptsobj.taggedstatus==1) {
+  //; //headerTextFilter += ", not sure how to handle this one
+  //}
+  if((typeof fbpoptsobj.sharedstatus !=='undefined') && (fbpoptsobj.sharedstatus==1))
+       headerTextFilter += ", shared .*\'s status, shared a status, shared .*\'s post";
+  
+  if((typeof fbpoptsobj.taggedphoto !=='undefined') && (fbpoptsobj.taggedphoto==1))
+    headerTextFilter += ",tagged in h.. own photo,tagged in .*\'s photo,tagged in h.. own album, tagged in .*\'s album";
+       
+  if((typeof fbpoptsobj.likedphoto !=='undefined') && (fbpoptsobj.likedphoto==1))
+    headerTextFilter += ",likes .* photo\.,likes? a photo,likes .*\'s album";
+       
+  if((typeof fbpoptsobj.commentedphoto !=='undefined') && (fbpoptsobj.commentedphoto==1))
+    headerTextFilter += ",commented on .*\'s photo,commented on h.. own photo,commented on a photo,commented on .*\'s album";
+
+  if((fbpoptsobj.commentedlink !== 'undefined') && (fbpoptsobj.commentedlink==1)) {
+    headerTextFilter += ",commented on .*\'s link,commented on a link,commented on h.. own link,commented on .*\.com\.";
+  }
+  // maybe move "likes an article" to the trending articles filter...
+  if((fbpoptsobj.likedlink !== 'undefined') && (fbpoptsobj.likedlink==1)) {
+    headerTextFilter += ",likes an article,recommends a link,likes a link,like a link,likes .*\'s link,likes \\d+ links";
+  }
+
+  if((fbpoptsobj.sharedpage !== 'undefined') && (fbpoptsobj.sharedpage==1)) {
+    headerTextFilter += ",shared a Page";
+  }
+  
+  if(fbpoptsobj.commentwall==1)
+       headerTextFilter += ",commented on .* post,wrote on .*\'s timeline,posted .* to .*\'s timeline"; //commented on h.. own post,commented on .*\'s post in,commented on a Post,
+
+// updated profile
+  if (typeof fbpoptsobj.updatedprofile == "undefined")
+    fbpoptsobj.updatedprofile = 0;
+
+  if(fbpoptsobj.updatedprofile==1)
+       headerTextFilter += ",added .* to h.. education\.,updated h.. education,added .* to h.. work\.,has worked on,updated h.. current .* to .*\\.,added .* as h.. hometown\\.,updated h.. work and education,added .* to h.. list of inspirational people\\.,to the inspirational people,added .* to h.. favourite sports\\.,added .* to h.. favourite teams\\.,added .* to h.. favourite athletes\\.,added .* to h.. activities\\.,added .* to h.. interests\\.,added .* to h.. profile\\.,to .* previous employers,added .* to h.. timeline,added a job at , now works at , took .* at .*,added details about,added a life event";
+    
+// changed profile pic
+  if (typeof fbpoptsobj.changedprofilepic == "undefined")
+    fbpoptsobj.changedprofilepic = 0;
+    
+  if(fbpoptsobj.changedprofilepic==1)
+    headerTextFilter += ",changed their profile picture,changed h.. profile picture,updated h.. cover photo\.,updated their cover photo";
+    
+// changed relationship
+  if (typeof fbpoptsobj.changedrelationship == "undefined")
+    fbpoptsobj.changedrelationship = 0;
+    
+  if(fbpoptsobj.changedrelationship==1)
+    headerTextFilter += ',went from being \".*\" to \".*\",went from being \".*\" to being \".*\",is in a relationship,complicated relationship,is single,is married,is engaged,is in a domestic partnership';
+    
+// uploaded photo 
+  if (typeof fbpoptsobj.uploadedphoto == "undefined")
+    fbpoptsobj.uploadedphoto = 0;
+    
+  if(fbpoptsobj.uploadedphoto==1){
+    headerTextFilter += ",added a photo,posted a photo to,added a new photo,added \\d* new photos,added \\d* photos,took a photo with,took \\d* photos with";
+       extraTextFilter +=', (\\d+ photos)';
+  }
+
+// shared photo 
+  if (typeof fbpoptsobj.sharedphoto == "undefined")
+    fbpoptsobj.sharedphoto = 0;
+    
+  if(fbpoptsobj.sharedphoto==1){
+    headerTextFilter += ",shared a photo,shared .*\'s album";//shared .*\'s photo,
+       extraTextFilter += ",by\:,shared .*?'s photo";
+  }
+
+//  uploaded video  
+  if (typeof fbpoptsobj.uploadedvideo == "undefined")
+    fbpoptsobj.uploadedvideo = 0;
+    
+  if(fbpoptsobj.uploadedvideo==1){
+       headerTextFilter += ",posted A video,added a video,uploaded.* video";
+       //extraTextFilter +=",Length: ‎?\\d+:\\d\\d"; // this filter doesnt seem to work...
+  }
+    
+// tagged in video
+  if (typeof fbpoptsobj.taggedinvideo == "undefined")
+    fbpoptsobj.taggedinvideo = 0;
+    
+  if(fbpoptsobj.taggedinvideo==1)
+       headerTextFilter += ",tagged in .*\'s video ";
+
+/* new video options 28th jan 
+sharedvideo
+likedvideo
+commentedvideo
+youtubevideo
+*/
+  if((typeof fbpoptsobj.sharedvideo!=='undefined') && (fbpoptsobj.sharedvideo==1))
+    // we also add a check for classname "shareMediaVideo" to improve filter coverage
+    headerTextFilter += ",shared a video,shared .*\'s video";
+  if((typeof fbpoptsobj.likedvideo!=='undefined') && (fbpoptsobj.likedvideo==1))
+    headerTextFilter += ",liked a video,liked .*\'s video,likes .*\'s video";
+  if((typeof fbpoptsobj.commentedvideo!=='undefined') && (fbpoptsobj.commentedvideo==1))
+    headerTextFilter += ",commented on a video,commented on .*'s video";
+  if((typeof fbpoptsobj.youtubevideo!=='undefined') && (fbpoptsobj.youtubevideo==1))
+    extraTextFilter += ",youtube\.com,youtu\.be,vimeo\.com";
+       
+  //if(fbpoptsobj.hideallvideos==1)
+  //  ; // we are dealing wtih this by  running a check on the node for the "shareMediaVideo" class
+       
+  //if(fbpoptsobj.hidealllinks==1)
+  // Need to Add all links filter here?
+       
+// posted note
+  if (typeof fbpoptsobj.postednote == "undefined")
+    fbpoptsobj.postednote = 0;
+    
+  if(fbpoptsobj.postednote==1)
+       headerTextFilter += ",posted a note";
+    
+//  tagged in note
+  if (typeof fbpoptsobj.taggedinnote == "undefined")
+    fbpoptsobj.taggedinnote = 0;
+    
+  if(fbpoptsobj.taggedinnote==1)
+       headerTextFilter += ",tagged in a note,tagged in a Post,tagged in .* life event";
+    
+// posted link
+  if (typeof fbpoptsobj.postedlink == "undefined")
+    fbpoptsobj.postedlink = 0;
+    
+  if(fbpoptsobj.postedlink==1)
+       headerTextFilter += ",shared link\\.,shared a link\\.";
+
+// read an article
+  if (typeof fbpoptsobj.readarticle == "undefined")
+    fbpoptsobj.readarticle = 0;
+    
+  if(fbpoptsobj.readarticle==1) {
+       headerTextFilter += ",read an article, recently read articles\\., read \\d* articles\\.";
+       extraTextFilter += ",Trending Articles,Trending Videos,Most Shared on ,Recent Articles About ";
+  }
+
+// facebook questions
+  if(fbpoptsobj.questionsbox==1) {
+    headerTextFilter += ", replied to: , asked: ,answered .*'s question,asked.*a question";
+       extraTextFilter += ",· Ask friends ·";
+  }
+
+// hide sponsored stories in newsfeed
+  if(fbpoptsobj.sponsoredbox==1) {
+    extraTextFilter += ",Recently Released Albums,Get Offer ·"; //· Sponsored
+       headerTextFilter += ", claimed an offer from, posted an offer";
+  }
+  
+// fix font size
+  if(fbpoptsobj.fontfix==1) {
+    if(document.getElementById('fbpfreestyler'))
+         document.getElementById('fbpfreestyler').textContent='div.actorName{display:inline;margin-right:3px !important} a.subject,div.preview,.mall_post_body_text,div,span,p,textarea,input,td,label,h3,h4,h5,h6{font-size:' + fbpoptsobj.fontsize + 'px !important} ' + 'div.commentContent {font-size:' + (fbpoptsobj.fontsize-1) +'px !important}' + ' .ginormousProfileName { font-size: 20px !important} ' + ' .emote_text {display:none}' + ' div.tickerFeedMessage, div.linkWrap {line-height:' + fbpoptsobj.fontsize + 'px !important} ' + 'li.uiStreamHeader {margin-bottom:' + (fbpoptsobj.fontsize-6) + 'px !important}';
+  }
+
+// fix font colour
+  if(fbpoptsobj.fontcolourfix==1) {
+    if(document.getElementById('fbpfreestyler'))
+      document.getElementById('fbpfreestyler').textContent +=' * {color:' + fbpoptsobj.fontcolour + ' !important}'; //span.fwb {color:' + fbpoptsobj.fontcolour + ' !important}';
+  }
+
+// fix font background colour
+  if(fbpoptsobj.fontbgcolourfix==1) {
+    if(document.getElementById('fbpfreestyler'))
+      document.getElementById('fbpfreestyler').textContent +=' * {background-color:' + fbpoptsobj.fontbgcolour + ' !important} .uiListLight { border-color: #333; } textarea, .inputtext, .inputpassword { border: 1px solid #555} .uiUfi .ufiItem { border-bottom: 1px dotted darkgray} n.tagsWrapper *, #fbPhotoTheaterTags, .tagsWrapper, .fbPhotosPhotoTagboxes *, #fbPhotoTheaterStageActions, .fbQuestionsPollClickTarget, .fbPhotosPhotoTagboxes, .flashUploaderOverlayButton, .fluploader_swfdiv, .coverBorder, .frame, .mat, .graph-canvas, .overlay, span.label, div.label, span.fwb ,#snowliftStageActions, .fbPhotoTagger, .faceBox, .typeaheadWrapper, .groupsJumpCoverBorder, .-cx-PRIVATE-uiFileInput__wrap, #fullScreenSwitch, #fbProfileCoverPhotoSelector, #fbProfileCoverPhotoSelector .wrap, #fbProfilePicSelector, #fbProfilePicSelector .wrap, .snowliftPager, .snowliftPager i, a.fbPhotoViewLarger {background-color:transparent !important} .fbQuestionsPollResultsBar .shaded, .bar {background-color: #6C83B2 !important}  .tagName, ol.balancingCapsule, div.fbTimelineFilters, ol.fbTimelineCapsule {background-color: ' + fbpoptsobj.fontbgcolour + ' !important} .hasSmurfbar #blueBarHolder #blueBar {background-image:url("") !important} /* like button: */ div._55k4, /*camera icon under composer*/ div._3jk , /* profile pic*/ i._96h, /* group count in left column*/ div.-cx-PRIVATE-blendedBookmarksNonLitestand__bookmark, div._5duc {background-color:transparent !important} /* attach image to comment icon*/ i.UFICommentPhotoIcon {background-color:grey !important}';
+  }
+
+  // fix font 
+  if(fbpoptsobj.fbpfontfix==1) {
+    if(document.getElementById('fbpfreestyler'))
+      document.getElementById('fbpfreestyler').textContent +=' * {font-family:' + fbpoptsobj.fbpfont + ' !important} ';
+  }
+
+  // single column timeline
+  if(fbpoptsobj.timelineonecol==1)
+    fbptimelinerestyle(1);
+  else 
+    fbptimelinerestyle(0);
+
+  lcoptsarr="lcadvertmgr,lcconnect,lcallpages,lcpagesfeed,lclikepages,lcallapps,lcappcenter,lcevents,lcgamesfeed,lcpokes,lcmusic,lcplaceseditor,lcallgroups,lcallinterests,lccreategroup,lccreatepage,lcfindfriends,lcdeveloper,lcfriends,lcgifts,rcrecommendedpages,rcrelatedgroups,rcpokes,rcbirthdays,rcfriendrequests,rcgamerequests".split(',');  
+  for(b=0;b<lcoptsarr.length;b++)
+    if (typeof fbpoptsobj[lcoptsarr[b]] == "undefined")
+      fbpoptsobj[lcoptsarr[b]]=0;
+       
+  var fbpfreestyler=document.getElementById('fbpfreestyler');
+  if (fbpfreestyler) {
+  
+    // start left column options
+    if(fbpoptsobj.lcconnect==1)
+      fbpfreestyler.textContent +=' #connectNav {display:none}';
+         
+    if(fbpoptsobj.lcallpages==1)
+      fbpfreestyler.textContent +=' #pagesNav {display:none}';
+         
+    if(fbpoptsobj.lcallapps==1)
+      fbpfreestyler.textContent +=' #appsNav {display:none}';
+         
+    if(fbpoptsobj.lcallgroups==1)
+      fbpfreestyler.textContent +=' #groupsNav {display:none}';
+         
+    if(fbpoptsobj.lcallinterests==1)
+      fbpfreestyler.textContent +=' #interestsNav { display:none }';
+         
+    if(fbpoptsobj.lcfriends==1)
+      fbpfreestyler.textContent +=' #listsNav { display:none}';
+       
+       // items beginning with #navItem_app_ are for the old newsfeed, and those with #sidebar_navigation_top are the new newsfeed
+    if(fbpoptsobj.lcadvertmgr==1)
+      fbpfreestyler.textContent +=' #adsNav, #navItem_app_6802152230, #navItem_app_400915586638539, #sidebar_navigation_top a[data-id="6802152230"], #sidebar_navigation_top a[data-id="400915586638539"] {display:none}';
+         
+    if(fbpoptsobj.lcpagesfeed==1)
+      fbpfreestyler.textContent +=' #navItem_app_140472815972081, #sidebar_navigation_top a[data-id="140472815972081"] {display:none}';
+         
+    if(fbpoptsobj.lclikepages==1)
+      fbpfreestyler.textContent +=' #navItem_app_357937250942127, #navFindFriends, #sidebar_navigation_top a[data-id="357937250942127"] {display:none}';
+         
+    if(fbpoptsobj.lcappcenter==1)
+      fbpfreestyler.textContent +=' #navItem_app_140332009231, #sidebar_navigation_top a[data-id="140332009231"] {display:none}';
+         
+    if(fbpoptsobj.lcevents==1)
+      fbpfreestyler.textContent +=' #navItem_app_2344061033, #sidebar_navigation_top a[data-id="2344061033"] {display:none}';
+
+    if(fbpoptsobj.lcgamesfeed==1)
+      fbpfreestyler.textContent +=' #navItem_app_261369767293002, #sidebar_navigation_top a[data-id="261369767293002"] {display:none}';
+
+    if(fbpoptsobj.lcpokes==1)
+      fbpfreestyler.textContent +=' #navItem_app_183217215062060, #sidebar_navigation_top a[data-id="183217215062060"] {display:none}';
+
+    if(fbpoptsobj.lcmusic==1)
+      fbpfreestyler.textContent +=' #navItem_app_119960514742544, #sidebar_navigation_top a[data-id="119960514742544"] {display:none}';
+
+    if(fbpoptsobj.lcplaceseditor==1)
+      fbpfreestyler.textContent +=' #navItem_app_219124168114356, #sidebar_navigation_top a[data-id="219124168114356"] {display:none}';
+    if(fbpoptsobj.lccreategroup==1)
+      fbpfreestyler.textContent +=' #navItem_app_230259100322928, #sidebar_navigation_top a[data-id="230259100322928"] {display:none}';
+  
+    if(fbpoptsobj.lccreatepage==1)
+      fbpfreestyler.textContent +=' #navItem_app_188619144602540, #sidebar_navigation_top a[data-id="188619144602540"] {display:none}';
+
+    if(fbpoptsobj.lcfindfriends==1)
+      fbpfreestyler.textContent +=' #navItem_app_2356318349, #sidebar_navigation_top a[data-id="2356318349"], #findFriendsNav {display:none !important}';
+
+    if(fbpoptsobj.lcdeveloper==1)
+      fbpfreestyler.textContent +=' #developerNav, #navItem_app_2345053339, #sidebar_navigation_top a[data-id="2345053339"] {display:none}';
+
+    if(fbpoptsobj.lcgifts==1)
+      fbpfreestyler.textContent +=' #navItem_app_329122197162272, a[data-endpoint="/ajax/composerx/attachment/gift/"], a[ajaxify^="/ajax/gifts/send?recipient_id="], div.fbRemindersContent div.uiBoxLightblue, #sidebar_navigation_top a[data-id="329122197162272"] {display:none}';
+
+       if(fbpoptsobj.rcrecommendedpages==1)
+      fbpfreestyler.textContent +=' #pages_reminders_link {display:none}';
+
+    if(fbpoptsobj.rcbirthdays==1)
+      fbpfreestyler.textContent +=' #birthday_reminders_link {display:none}';
+
+       if(fbpoptsobj.rcgamerequests==1)
+      fbpfreestyler.textContent +=' #custom_reminders_link {display:none}';
+         
+    if(fbpoptsobj.rcfriendrequests==1)
+      fbpfreestyler.textContent +=' #friends_reminders_link {display:none}';
+
+    if(fbpoptsobj.rcpokes==1)
+      fbpfreestyler.textContent +=' #poke_reminders_link {display:none}';
+
+    if(fbpoptsobj.rcrelatedgroups==1)
+      fbpfreestyler.textContent +=' #pagelet_ego_contextual_group {display:none !important}';
+         
+    // hide useless bottom right footer + ads on login + logout screen + useless links in top nav bar
+    fbpfreestyler.textContent += 'div.fbIndexFeaturedRegistration > div.lfloat, .-cx-PRIVATE-fbAdUnit__root, #pagelet_rhc_footer, #SetAsHomepage_Callout, .gradientContent > div[data-ad^="{"], #findFriendsNav, #navFindFriends {display:none !important}';
+
+    // hide contact importer at bottom of feed
+    fbpfreestyler.textContent += ' .contact_importer_widget {display:none} #ci_compact_right {display:none}';
+       
+    // add red border to publish permissions request and make light grey blurb black and bold
+    fbpfreestyler.textContent += ' .permissionsPublishActionsBadge {border:4px solid red} .gdpBlurb {color:black !important ; font-weight:bold !important} .tosPane > .sectionContent, .fcb > div, .tosPane .legalese, .tosPane .sectionHeader {color:black !important} .tosPane .mbm {color:black; border: 4px red solid}';
+       
+    // add open and close list styles
+    fbpfreestyler.textContent += ' span.fbpopenlist:before {content:"▼ "}  span.fbpclosedlist:before {content:"► "}';
+  }
+  
+////////////////////////
+/// END opts 
+////////////////////////         
+
+refreshwhitelist();
+
+//unsafeWindow.console.log("etf= " + extraTextFilter);
+
+var tmptextfilter='';
+tmptextfilter=fbpoptsobj.customtextfilter;
+if (tmptextfilter) 
+  tmptextfilter += ',' + extraTextFilter; // add emergency extra text filter
+else 
+  tmptextfilter = extraTextFilter;
+
+if( tmptextfilter.length ) {
+  tmptextfilter=tmptextfilter.replace(/,,/g,','); // remove blanks (if any)
+  tmptextfilter=tmptextfilter.replace(/,+$|^,+/g,'');  // remove trailing or leading commas
+  cleancustomtextfilter=fbpescaperegex(tmptextfilter); // escape regex special chars (brackets)
+  
+  try {
+    textfilterRX = new RegExp(cleancustomtextfilter.replace(/,/g,'|'),"gi");
+  }
+  catch (e)  {
+    window.alert('F.B. Purity: Error building Custom Text Filter RegEx: ' +  fbpoptsobj.customtextfilter + "\n\nHave you pasted CSS code into the Custom Text filter by mistake? If yes, go to the FBP options sceen, remove it and put it into the Custom CSS Box.")
+    //textfilterRX=null;
+       textfilterRX=new RegExp("fbpurity1234567890xyz"); // set a dummy regex, so firefox browser doesnt freeze, and user can go and reset the fbp options
+  }
+}
+
+//unsafeWindow.console.log('htf=' + headerTextFilter);
+
+headerTextFilter=headerTextFilter.replace(/^,/,'');  // remove leading comma (if any)
+
+if( headerTextFilter && headerTextFilter.length ) {
+  try {
+    headertextfilterRX = new RegExp(headerTextFilter.replace(/,/g,'|'),"gi");
+  }
+  catch (e)  {
+    window.alert('F.B. Purity: regex error building header text filter : ' +  headerTextFilter);
+    headertextfilterRX=null;
+  }
+}
+
+//unsafeWindow.console.log(fbpoptsobj.customtextfilter);
+
+  fbpboxstyles='';
+   
+  // hide suggestions box if option has been set
+  if (fbpoptsobj.suggestionsbox) {
+    fbpboxstyles +=' #ego_pane {display:none} #netego_organic {display:none} #pagelet_tips_box {display:none}';
+  }
+    // hide Get Connected (was: connect with friends) box if option has been set
+  if (fbpoptsobj.connectbox) {
+    fbpboxstyles +=' #pagelet_netego_lower {display:none} #pagelet_connectbox {display:none}';
+  }
+    
+  if (fbpoptsobj.betabox) {
+    fbpboxstyles +=' #pagelet_betabox {display:none}';
+  }
+    
+  if (fbpoptsobj.pokebox) {
+    fbpboxstyles +=' #pagelet_netego_pokes, #pagelet_pokes,  #navItem_app_183217215062060 {display:none}';
+  }
+    
+  if (fbpoptsobj.happeningnowbar) {
+    fbpboxstyles +=' .ticker_stream, #pagelet_ticker, #pagelet_rhc_ticker {display:none}';
+  }
+  
+  if (fbpoptsobj.questionsbox) {
+    fbpboxstyles +=' #pagelet_netego_questions, #pagelet_questionsbox {display:none}';
+  }
+
+  if (fbpoptsobj.eventsbox) {
+    fbpboxstyles +=' #event_reminders_link'; // hide left column events too #navItem_app_2344061033 {display:none} just hide create event link #pagelet_reminders [ajaxify="/ajax/plans/create/dialog.php"] * { display: none !important;}
+  }
+    
+  if (fbpoptsobj.requestsbox) {
+    fbpboxstyles +=' #pagelet_netego_requests {display:none}';
+  }
+  
+  if (fbpoptsobj.sponsoredbox) {
+       fbpboxstyles +=' div.megaphone_location_pages_feed, #pagelet_canvas_storybox, #pagelet_canvas_nav_content, .applifier, #side_ad_frame, .-cx-PRIVATE-suggestionOnLiking__body, .canvasRecommended, li.ownsection, li[aria-label="Sponsored"], #pagelet_adbox, #pagelet_search_ads2, #adcolumn_advertise, #ssponsor, #adcolumn_more_ads, #pagelet_friendship_netego_ads, #pagelet_ego_pane, .fbPhotosSideColumn, #pagelete_ego_pane_home_ads, #pagelet_ad_page_upsell, #fbPhotoSnowboxAdsBottom, .fbPhotoSnowboxAdsSponsored, .fbTimelineSideAds, #pagelet_ego_pane_m, #pagelet_organic_ego_pane, #pagelet_ego_pane_w, #pagelet_ads_when_no_friend_list_suggestion, #pagelet_side_ads, #fbPhotoSnowliftAdsSide, #MessagingNetegoSidebar, .-cx-PRIVATE-fbTimelineStyleAds__vertical, .-cx-PRIVATE-fbTimelineStyleAds__root, .-cx-PRIVATE-snowliftAds__root, ._24q, .rhcFooter, div[data-ad^="{"],.-cx-PRIVATE-suggestionOnSourceLiking__body {display:none !important} #sidebar_ads, #pagelet_ads, #pagelet_netego_ads, .UIStandardFrame_SidebarAds, #gb_muffin_area, .adsContainer, .fbPhotoAdsCol {visibility:hidden !important} ';
+  }
+  
+  if (fbpoptsobj.chatbox) {
+    fbpboxstyles +=' #pagelet_presence, #pagelet_friends_online, #pagelet_chat, #BuddylistPagelet, div.fbChatSidebarBody {display:none}';
+  }
+
+  if ((typeof fbpoptsobj.smileys !=='undefined') && fbpoptsobj.smileys) {
+   fbpboxstyles +=' img.wallArrowIcon, .emoticon_text {display:inline !important} .emoticon {display:none !important} i.-cx-PRIVATE-fbEntstreamEmoji__image, i.-cx-PRIVATE-ogAttachedSentenceToken__icon, span.-cx-PRIVATE-fbEmoji__icon, h5.uiStreamMessage img, span.userContent i.img, .userContentSecondary i.img, span.hasCaption i.img, div.shareSubtext i.img, div.uiStreamAttachments i.img, div.UFICommentContent span._1a- {display:none} div.userContentWrapper i.img {display:none} '; // !important
+  }
+  
+  if ((typeof fbpoptsobj.notificationpopup !=='undefined') && fbpoptsobj.notificationpopup) {
+    fbpboxstyles +=" ul[data-gt^='{\"ref\":\"beeper\"'] {display:none}";
+  }
+  
+  if ((typeof fbpoptsobj.fixedleftcolumn !=='undefined') && fbpoptsobj.fixedleftcolumn) {
+    fbpboxstyles +=' .home #leftCol {position:fixed !important}';
+  }
+  
+  if(fbpoptsobj.offlinefriends) { 
+    // hide offline friends in chat
+    fbpboxstyles +=" .fbChatOrderedList li {display: none;} .fbChatOrderedList .active {display: block;}";
+  }
+  
+  if(document.getElementById('fbpboxstyler'))
+    document.getElementById('fbpboxstyler').textContent = fbpboxstyles;
+
+  // set custom css (if user has specified any styles)
+  if (fbpoptsobj.fbpcustomcss) {
+    if(document.getElementById('fbpcssstyler'))
+      document.getElementById('fbpcssstyler').textContent = fbpoptsobj.fbpcustomcss;
+  }
+  
+  if(debug)
+    console.log('are we here at the end of initstage 2?');
+  
+} //END FUNCTION INITSTAGE2
+
+fbpdynamicreload = function (opts) {
+  fbpgetprefs(opts);
+  if(document.getElementById('fbpoptsdiv') && document.getElementById('fbpoptsdiv').style.display=='block') {
+    document.getElementById('fbpoptsdiv').style.display='none';
+       fbptoggleopts();
+  }
+  resetclasses();
+  initstage2();
+  //tlbuttinit(); // reset TL button state
+  if(fbpoptsobj.timelineonecol==false)
+    window.setTimeout(function(){document.getElementById('FBTLX').style.display='none';},1500);
+  else
+    window.setTimeout(function(){document.getElementById('FBTLX').style.display='block';},1500);
+
+  cleartheshizzle(document);
+}
+
+/*
+if(!isasync)
+  initstage2(); // run it once to finish initialisation
+  have moved this call into fbpgetprefs...
+  
+*/
+  // function to add delete friend request buttons
+  /*function adddelreqbuttons(node) {
+    // for adding delete request button to main friend request indicator panel and also the list at https://www.facebook.com/friends/requests/
+     commented out for now as was causing errors in line 1991
+    actiondivs=node.getElementsByClassName('actions');
+    if(!actiondivs.length || !node.getElementsByClassName('uiButtonConfirm').length || node.getElementsByClassName('privacyPlan').length || document.getElementById('questions_stories'))
+      return;
+    for(var i=0;i<actiondivs.length;i++) {
+         //unsafeWindow.console.log(actiondivs[i].childNodes[0].getAttribute('class'));
+         if((actiondivs[i].childNodes.length && actiondivs[i].childNodes[0].getAttribute && actiondivs[i].childNodes[0].getAttribute('class').match(/Timeline|actionsDropdown/gi)) || (actiondivs[i].childNodes[1] && actiondivs[i].childNodes[1].getAttribute('id') && actiondivs[i].childNodes[1].getAttribute('id').match(/pagelet_timeline_profile_actions/)) || (actiondivs[i].getElementsByTagName('input').length==0) || actiondivs[i].parentNode.getAttribute('class').match(/stickyHeaderWrap/)) {
+           //unsafeWindow.console.log('timeline page');
+           continue;
+         }
+      foundreject=0;
+      binps=actiondivs[i].getElementsByTagName('input');
+      for(j=0;j<binps.length;j++)
+        if(binps[j].getAttribute && binps[j].getAttribute('name') && binps[j].getAttribute('name').match(/actions\[reject\]|Admin Panel/))  {
+           foundreject=1;
+           break; 
+        }
+      if(!foundreject) {
+        delreqbutt=document.createElement('label');
+        delreqbutt.className='uiButton uiButtonDefault uiButtonMedium';
+        delreqbutt.innerHTML='<input type="submit" title="Delete this request. (The sender wont know.)" name="actions[reject]" value="Delete">';
+        actiondivs[i].appendChild(delreqbutt);
+      }
+    }
+       
+  }*/
+  
+  function fpInsertedNodeDomHandler(event) {
+
+    if((event.target.nodeName=='LI') ||  (event.target.nodeName=='UL'))  {
+      //if ((document.getElementById('pagelet_home_stream')||(document.getElementById('profile_minifeed'))) && (!document.getElementById('fb_multi_friend_selector'))) {  
+         if ((document.getElementById('pagelet_home_stream') ) && (!document.getElementById('fb_multi_friend_selector'))) {
+           //console.log(event.target.nodeName);
+        cleartheshizzle(event.target);
+               //unmanglelinks(event.target);
+      }
+      else {
+        ; // not doing anything at the mo
+      }
+         if(fbpoptsobj.fixarticleredirects && event.target.getElementsByTagName('a').length)
+           unmanglelinks(event.target);
+    }
+    else if(event.target.nodeName=='DIV') {
+      //var functRef = callLater(adddelreqbuttons,event.target);
+      //setTimeout(functRef, 1500);
+         if (document.getElementById('pagelet_litestand_section') || document.getElementById('stream_pagelet'))  {
+           //console.log(event.target.nodeName);
+        cleartheshizzle(event.target);
+               //unmanglelinks(event.target);
+      }
+         if((event.target.getAttribute('id')=='platform_dialog_content') || (event.target.getElementsByClassName('tosPane').length) || (event.target.getAttribute('class') && event.target.getAttribute('class').match(/tosPane/)))  {
+           //its most likely a facebook application requesting permissions
+               highlightemailrequest();
+               //appid=document.getElementById('input_app_id').getAttribute('value');
+               addblockbuttontopermreq();
+         }
+         if(event.target.getAttribute('class') && event.target.getAttribute('class').match('middle_area_content')){
+           if(window.location.href.match(/\/appcenter\//))
+             highlightemailrequest();
+         }
+         if(fbpoptsobj.fixarticleredirects && event.target.getElementsByTagName('a').length)
+           unmanglelinks(event.target);
+         //fixie7spoof();
+      //setTimeout(function(){adddelreqbuttons(event.target)},1000); // add delete friend request buttons if required
+    }
+       else if((event.target.nodeName=='SPAN') && (event.target.getAttribute && event.target.getAttribute('class') && event.target.getAttribute('class').match(/hasCaption/))) {
+         //console.log('hit a spanner');
+         unmanglelinks(event.target);
+       }
+  } // END fpInsertedNodeDomHandler function
+  
+  function updateblockedcount() {
+    crappyappmsgcounter=document.getElementsByClassName('fbpblocked').length;
+    var fbpblockcountspan=document.getElementById('fbpblockcount');
+    if(fbpblockcountspan) 
+      fbpblockcountspan.innerHTML=crappyappmsgcounter;
+      
+    xtramsgcounter=document.getElementsByClassName('fbpblockedx').length;
+    var fbpblockxcountspan=document.getElementById('fbpblockxcount');
+    if(fbpblockxcountspan) 
+      fbpblockxcountspan.innerHTML=xtramsgcounter;
+  }
+  
+  function destroyblockedappstories (appid,killmode) {
+
+    var appnodes=document.getElementsByClassName('aid_' + appid);
+    var appnodeslength=appnodes.length;
+    for (var i=0;i<appnodeslength;i++){
+      //appnodes=document.getElementsByClassName('aid_' + appid);
+      if(killmode=='kill')
+         appnodes[0].parentNode.removeChild(appnodes[0]);
+      else if(killmode=='allow')
+         appnodes[i].className = appnodes[i].className.replace(/\bfbpblocked\b/,'fbpnormal');
+         
+      if(fpbblockcountspan)
+           fpbblockcountspan.innerHTML=--crappyappmsgcounter;
+    }
+       updateblockedcount();
+    //check if there are any blocked msgs left and if not, return to normal homepage view
+    blockedmsgs=document.getElementsByClassName('fbpblocked');
+    if(!blockedmsgs.length)
+      fbpshowblocked();
+    appnodes=null;
+    
+  }// END destroyblockedappstories function
+
+  function getdtsg() {
+    var fb_dtsg='';
+       if(document.getElementsByClassName('autoexpand_mode').length) {
+      if(document.getElementsByClassName('autoexpand_mode')[0].wrappedJSObject)
+        fb_dtsg = document.getElementsByClassName('autoexpand_mode')[0].wrappedJSObject.fb_dtsg.value;
+      else
+        fb_dtsg = document.getElementsByClassName('autoexpand_mode')[0].fb_dtsg.value;
+      }
+       else {
+           navinps=document.getElementsByTagName('input');
+               for(var i=0;i<navinps.length;i++)
+                 if(navinps[i].getAttribute('name')=='fb_dtsg') {
+                   fb_dtsg=navinps[i].getAttribute('value');
+                       break;
+                 }
+       }
+    return fb_dtsg;
+  }
+
+  function allowapp(appid, appname) {
+   
+    if (confirm("Do you want to whitelist application : '" + appname +"'" + ".\n\nApplication ID: " + appid)) {
+      if(fbpoptsobj.userappwhitelist.length) {
+        // theres already value/s in userwhitelist
+        try {
+          fbpoptsobj.userappwhitelist+=','+appid;
+          fbpsavevalue('fbpoptsjson-' + currentuserid, JSON.stringify(fbpoptsobj));
+          //document.getElementById("MyElement").className = document.getElementById("MyElement").className.replace(/\bMyClass\b/','')
+          window.alert(appname + ' has been Saved to your whitelist');
+          refreshwhitelist();
+          destroyblockedappstories(appid,'allow');
+        }
+        catch(e) {
+          window.alert('error saving id to whitelist');
+        }  
+        
+      }
+      else {
+        // userwhitelist is blank
+        try {
+          fbpoptsobj.userappwhitelist=appid;
+          fbpsavevalue('fbpoptsjson-' + currentuserid, JSON.stringify(fbpoptsobj));
+          window.alert(appname + ' has been Saved to your whitelist');
+          refreshwhitelist();
+          destroyblockedappstories(appid,'allow');
+        }
+        catch(e) {
+          window.alert('error saving id to whitelist');
+        }
+      }
+    }
+    else
+      return;
+  } // END allowapp function
+
+  function blockapp(appid, appname, nodeid, autoblock) {
+    //var post_form_id = document.getElementById('post_form_id').getAttribute('value');
+    var fb_dtsg = getdtsg();
+       if(typeof currentuserid=='undefined' || currentuserid=='')
+         currentuserid=getuserid();
+         
+    //unsafeWindow.pages_show_block_app("49572793475", "block", "about");
+     
+    // if not autoblocking - check if there are multiple apps to block, if so ask if user wants to block all at once
+    if(typeof(autoblock)=='undefined') {
+      var app2bcount=document.getElementsByClassName('fbpblocked').length;
+      if (!confirm("Do you want to block application : '" + appname +"'"))
+        return;
+         if (app2bcount>1) // check if user wants to block all the currently shown applications
+         if(blockallapps())
+           return;
+    }
+    if(document.getElementById('blockapplab'))
+         document.getElementById('blockapplab').style.display='none';
+         
+    document.getElementById(nodeid).setAttribute('style','background:#DCDCDC !important;text-align:center');
+    document.getElementById(nodeid).innerHTML='<b>F.B. Purity</b> : Blocking Application : "<span style="color:red">' + appname + '</span>"&nbsp;&nbsp;&nbsp;&nbsp;<img style="text-align:middle" src="http://i289.photobucket.com/albums/ll237/bitingbiting/fb-loading-anim.gif">';
+
+    var http = new window.XMLHttpRequest();
+    //var url = window.location.protocol + "//" + window.location.hostname + "/ajax/apps/block_app.php?" + "app_id=" + appid + "&type_index=0&source=about&confirm_id=block_" + appid + "&__a=1";
+    //var params = "__d=1&confirm=1&fb_dtsg=" + fb_dtsg + "&ok=Okay" ;
+       var url = window.location.protocol + "//" + window.location.hostname + "/ajax/apps/block_app.php?" + "app_id=" + appid + "&type_index=0&source=about&confirm_id=block_" + appid;
+    var params = "__asyncDialog=1&__user=" + currentuserid + "&__a=1&confirmed=1&fb_dtsg=" + fb_dtsg ;// + phstamp:1658166771106811366130
+       
+    http.open("POST", url, true);
+    http.setRequestHeader("Referer", window.location.protocol + "//" + window.location.hostname + "/apps/application.php?id=" + appid);
+    http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+    //http.setRequestHeader("Content-length", params.length);
+    //http.setRequestHeader("Connection", "close");
+
+    http.onreadystatechange = function() {
+         if(http.readyState == 4 && http.status == 200) {
+                   if(!http.responseText.match('\"errorSummary\"')){
+                     //unsafeWindow.console.log("successfully blocked app : '" + appname +  "' with id=" +appid + "\n");
+                     if((nodeid!='platform_dialog_content') &&(nodeid!='pagelet_canvas_content'))
+                           destroyblockedappstories (appid,'kill');
+                         else {
+                           document.getElementById(nodeid).innerHTML= '<p style="margin-top:20px;font-size:25px"><a title="App was blocked by the F.B. Purity Browser Extension" href="http://www.fbpurity.com"><img style="vertical-align:middle" src="https://sites.google.com/site/st333v/fbp-1/fbp-ghost-lid-icon-48x48.jpg"></a> ' +appname + ' has been BLOCKED!' + '</p>';
+                               if(document.getElementsByClassName('platform_dialog_bottom_bar_table').length)
+                                 document.getElementsByClassName('platform_dialog_bottom_bar_table')[0].style.display='none';
+                         }
+                               
+                   }
+                   else {
+                         if(http.responseText.match(/\"errorSummary\"\:/))
+                           var errorsum=http.responseText.match(/\"errorSummary\"\:\"(.*)\",\"error/)[1];
+                         else
+                           var errorsum="";
+                         if(http.responseText.match(/\"errorDescription\"\:/))
+                           var errordesc=http.responseText.match(/\"errorDescription\"\:\"(.*)\",/)[1];
+                         else
+                           var errordesc="";
+                         if( errorsum.length && errordesc.length )
+                           var wholeerror = errorsum + ' : ' + errordesc;
+                         else
+                           var wholeerror = http.responseText;
+                     window.alert('app block failed for some reason:\n\n' + wholeerror);
+                       }
+                   http=null;
+           }
+    }
+  http.send(params);
+  
+  } // END blockapp function
+
+  function blockappev(ev) {
+  
+    ev.preventDefault();
+    var appname=this.getAttribute('appname');
+    var appid=this.getAttribute('appid');
+       var nodeid=this.getAttribute('nodeid');
+    blockapp(appid,appname,nodeid);
+  } // END blockappev function
+
+  function allowappev(ev) {
+  
+    ev.preventDefault();
+    var appname=this.getAttribute('appname');
+    var appid=this.getAttribute('appid');
+    var nodeid=this.getAttribute('nodeid');
+    document.getElementById(nodeid).setAttribute('class', document.getElementById(nodeid).getAttribute('class') + ' aid_' + appid);
+    allowapp(appid,appname);
+  } // END allowappev function
+  
+  function fbpshowblocked() {
+  
+    var showhidelink=document.getElementById('fbpshowblockedlink');
+    var showorhidetext=showhidelink.textContent;
+    
+    var showhidelinkx=document.getElementById('fbpshowblockedxlink');
+    var showorhidetextx=showhidelinkx.textContent;
+    
+    var blockedmsgs=document.getElementsByClassName('fbpblocked');
+    
+    if (showorhidetext=='Show') {
+      if(!blockedmsgs.length)
+        return;
+      showhidelink.innerHTML='Hide';
+      showhidelink.title='Hide Application + Game Stories';
+      showhidelinkx.innerHTML='Show';
+      showhidelinkx.title='Show Extras (Friend/Group/Fan/Event etc Stories)';
+      fbpstyle.textContent=fbpStyleApps;
+    }
+    else  {
+      showhidelink.innerHTML='Show';
+      showhidelink.title='Show Application + Game Stories';
+      fbpstyle.textContent=fbpStyleNormal;
+    }    
+    
+    //works better in reverse order
+    for(i=(blockedmsgs.length-1); i>=0; i--) {
+      //unsafeWindow.console.log("show block link: " + i);
+      dspBlockLink(blockedmsgs[i]);      
+    }
+
+    blockedmsgs=null;
+        
+  } // END fbpshowblocked function
+
+  function fbpshowblockedx() {
+
+    var showhidelinkx=document.getElementById('fbpshowblockedxlink');
+    var showorhidetextx=showhidelinkx.textContent;
+
+    var showhidelink=document.getElementById('fbpshowblockedlink');
+    var showorhidetext=showhidelink.textContent;
+    
+    var blockedmsgs=document.getElementsByClassName('fbpblockedx'); 
+    
+    if (showorhidetextx=='Show') {
+      if(!blockedmsgs.length)
+        return;
+      showhidelinkx.innerHTML='Hide';
+      showhidelinkx.title='Hide Extras (Friend/Group/Fan/Event etc Stories)';
+      showhidelink.innerHTML='Show';
+      showhidelink.title='Show Application + Game Stories';
+      fbpstyle.textContent=fbpStyleExtras;
+    }
+    else  {
+      showhidelinkx.innerHTML='Show';
+      showhidelinkx.title='Show Extras (Friend/Group/Fan/Event etc Stories)';
+      fbpstyle.textContent=fbpStyleNormal;
+    }
+    
+    blockedmsgs=null;
+  } // END fbpshowblockedx
+  
+  fbpshowblockedev = function (ev) {
+    ev.preventDefault();
+    fbpshowblocked();
+  }
+  
+  fbpshowblockedxev = function(ev) {
+    ev.preventDefault();
+    fbpshowblockedx();
+  }
+  
+  function dspBlockLink(node, blockmode) {
+    if (node.getElementsByClassName('blocklink').length)
+      return;
+       
+       var appid;
+    var appname='';
+       // check if its a new FB Actions / Frictionless sharing app
+       //uism =node.getElementsByClassName('uiStreamMessage');
+       //if(uism.length)
+       //  if (uism[0].innerHTML.match(/\/hovercard\/application\.php\?id\=(\d*)|\/hovercard\/hovercard\.php\?id=(\d*)/))
+    //    blockmode='sua';
+         
+    if (typeof(blockmode)=='undefined') {
+      var footernode, headernode;
+         headernode=node.getElementsByClassName('uiStreamMessage');
+           
+         if(document.getElementsByClassName('uiStreamFooter') && document.getElementsByClassName('uiStreamFooter').length) {
+                 footernode=node.getElementsByClassName('uiStreamFooter')[0];
+               }
+         else
+           if(document.getElementsByClassName('UIActionLinks_bottom') && document.getElementsByClassName('UIActionLinks_bottom').length) {
+                 footernode=node.getElementsByClassName('UIActionLinks_bottom')[0];
+               }
+      else {
+        footernode='x'; //invalid node will cause exception, luckily we have an exception handler isnt it ;-)
+      }
+    
+       //its possibly an app posing as a normal facebook message, so lets try and get the appid from the footer
+         if(headernode.length && headernode[0].innerHTML.match(/application\.php\?id=(\d+)/)) {
+           appid=headernode[0].innerHTML.match(/application\.php\?id=(\d+)/)[1];
+         }
+      else if(footernode.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)) {
+        if(typeof footernode.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)[1] !='undefined')
+          appid=footernode.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)[1];
+        else if(typeof footernode.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)[2] !='undefined')
+          appid=footernode.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)[2];
+      }
+      else
+               if(footernode.innerHTML.match(/application\.php\?id=(\d+)/)) {
+                 if(footernode.innerHTML.match(/application\.php\?id=(\d+)/)[1]!='undefined')
+                   appid=footernode.innerHTML.match(/application\.php\?id=(\d+)/)[1];
+               }
+               else
+          return;
+                 
+      try {
+        //appname=footernode.getElementsByClassName("GenericStory_BottomAttribution")[0].getElementsByTagName('a')[0].textContent;
+               if(footernode.innerHTML.match(/data-appname=/))
+                 appname=footernode.innerHTML.match(/data-appname="([^"]*)"/)[1] ;
+               else if (headernode[0].innerHTML.match(/application.php/)){
+          appname=headernode[0].innerHTML.match(/application\.php\?id=.*\>(.*)<\/\a\>/)[1];
+               }
+               else 
+               {
+          flinks=footernode.getElementsByTagName('a');
+          appname=flinks[flinks.length-1].textContent;
+                 if(appname=='')
+            appname=flinks[flinks.length-2].textContent;
+           }
+      } catch (e) {
+          appname='mystery app x';
+          //unsafeWindow.console.log('error getting application name');
+      }
+    
+    } // END if blockmode=normal (if !blockmode.length)
+    else {
+      // we are doing this for "started using app/game" (sua) type posts
+         var uism = node.getElementsByClassName('uiStreamMessage')
+      var alinks=uism[0].getElementsByTagName('a');
+         for(var i=0;i<alinks.length;i++){
+           var datahover=alinks[i].getAttribute('data-hovercard');
+               if(datahover) {
+                 var datahovermatch=datahover.match(/\/hovercard\/application\.php\?id\=(\d*)/);
+                 //var datahovermatch2=datahover.match(/\/hovercard\/hovercard\.php\?id=(\d*)/);
+             if(datahovermatch) {
+                   appid=datahovermatch[1];
+                   appname=alinks[i].textContent;
+                   break;
+                 }
+                 /* else if(datahovermatch2) {
+                   appname=alinks[i].textContent;
+                   var nodnod=node.getElementsByTagName('a');
+                   for(var q=0;q<nodnod.length;i++)
+                     if(nodnod[q].textContent.match(appname)) {
+                           appidmatch=nodnod[q].getAttribute('data-hovercard').match(/\/hovercard\/application\.php\?id\=(\d*)/);
+                               if(appidmatch) {
+                                 appid=appidmatch[1];
+                                 break;
+                               }
+                         }
+                   nodnod=null;        
+                 } */
+               }
+         }
+         if(typeof(appid)=='undefined' || appid =='') { // dealing with frictionless sharing apps such as netflix
+           if(node.getAttribute('data-gt')) {
+                 //"appid":"163114453728333"
+                 if(node.getAttribute('data-gt').match(/\"appid\":\"\d+\"/)) {
+                   appid=node.getAttribute('data-gt').match(/\"appid\":\"(\d+)\"/)[1];
+                       //appname=alinks[alinks.length-1].textContent;
+                       footerstuff=node.getElementsByClassName("uiStreamFooter");
+                       if(footerstuff.length){
+                         footerimagelink=footerstuff[0].getElementsByTagName('a');
+                         if(footerimagelink.length)
+                           if(footerimagelink[0].getAttribute('data-appname'))
+                                 appname=footerimagelink[0].getAttribute('data-appname');
+                       }
+                 }
+           }
+         }
+         alinks=null;
+    }
+    //console.log(appid + ' ' + appname);
+       
+    if (document.getElementsByClassName('uiStreamHide') && document.getElementsByClassName('uiStreamHide').length) {
+      hidebuttonclass='uiStreamHide';
+      hidebuttonclasses='uiStreamHide';
+      linkclasses='blocklink uiStreamContextButton uiPopoverTriggerElem';
+    }
+    else {
+      hidebuttonclass='hideButton';
+      hidebuttonclasses='mlm hideButton';
+      linkclasses='blocklink mlm hideButton';
+    }
+       
+       hidebuttonclasses='uiStreamContextButton uiPopoverTriggerElem';
+    
+    var blinkinsertpoint=node.getElementsByClassName(hidebuttonclass)[0];
+    
+    if(typeof blinkinsertpoint == 'undefined') {
+      //alert('hohoho');
+      var uism=node.getElementsByClassName('uiStreamMessage');
+      if(uism && uism.length)
+        blinkinsertpoint=uism[0];
+      else
+        return;
+    }
+        
+    node.setAttribute('class', node.getAttribute('class') + ' aid_' + appid); // lets do it for all apps (cos on profile pages apps sometimes dont include this class)
+    var blinkspan=document.createElement('div');
+
+    blinkspan.setAttribute('style',"position:relative;opacity:0.5; top : 23px");
+    blinkspan.className=hidebuttonclasses;
+                   
+    blinkspan.innerHTML="<a class='" + linkclasses +"' style='text-decoration: none;' onmouseover='this.style.background=\"red\";this.style.color=\"white\";this.parentNode.style.opacity=\"1\"' onmouseout='this.style.background=\"white\";this.style.color=\"#3B5998\";this.parentNode.style.opacity=\"0.5\"' title='FBP - Block this application' nodeid='" + node.getAttribute('id') + "' appid='" + appid + "' appname='" + appname.replace('"','','g').replace("'",'','g') + "' href='javascript:;'><b><nobr>BA</nobr></b></a>";
+    blinkspan.getElementsByTagName('a')[0].addEventListener("click", blockappev, false);
+    //blinkinsertpoint.parentNode.insertBefore(blinkspan, blinkinsertpoint); //(insert before pattern)
+    blinkinsertpoint.appendChild(blinkspan);
+    blinkinsertpoint.appendChild(document.createElement('br')); // separate the 2 links
+    
+    var alinkspan=document.createElement('div');
+    alinkspan.setAttribute('style',"position:relative; opacity:0.5; top : 23px;");
+    alinkspan.className=hidebuttonclasses;
+
+    alinkspan.innerHTML="<a class='" + linkclasses + "'style='text-decoration: none;' onmouseover='this.style.background=\"green\";this.style.color=\"white\";this.parentNode.style.opacity=\"1\"' onmouseout='this.style.background=\"white\";this.style.color=\"#3B5998\";this.parentNode.style.opacity=\"0.5\"' title='FBP - Whitelist this application' nodeid='" + node.getAttribute('id') + "' appid='" + appid + "' appname='" + appname.replace('"','','g').replace("'",'','g') + "' href='javascript:;'><b><nobr>WL</nobr></b></a>";
+    alinkspan.getElementsByTagName('a')[0].addEventListener("click", allowappev, false);
+    //blinkinsertpoint.parentNode.insertBefore(alinkspan, blinkinsertpoint); //(insert before pattern)
+    blinkinsertpoint.appendChild(alinkspan);
+       
+  } // END dspBlockLink function
+   
+  function callLater(paramA, paramB, paramC, paramD, paramE){
+    return (function(){
+      //blockapp(appid, appname, nodeid, auto);
+      paramA(paramB, paramC, paramD, paramE);
+      //unsafeWindow.console.log(paramA,paramB, paramC, paramD)
+    });
+  }
+  
+  blockallapps = function()  {
+    var appdump=document.getElementsByClassName('fbpblocked');
+    var apparray=[];
+    var appnamelist='';
+       var applength=0;
+    for(var i=0;i<appdump.length;i++) {
+      if(appdump[i].getElementsByClassName('blocklink').length && !apparray[appdump[i].getElementsByClassName('blocklink')[0].getAttribute('appid')]) {
+        apparray[appdump[i].getElementsByClassName('blocklink')[0].getAttribute('appid')] = appdump[i].getAttribute('id') + ',' + appdump[i].getElementsByClassName('blocklink')[0].getAttribute('appname');
+        appnamelist+= appdump[i].getElementsByClassName('blocklink')[0].getAttribute('appname') + '\n';
+                   applength++;
+      }
+    }
+    
+    if(applength==1)
+           return false; // return and use normal block app function
+         
+    if(!confirm('Would you also like to block *ALL* ' + applength + ' of the following facebook applications?\n' + '-------------------------------------------------------------------------------\n\n' + appnamelist.replace(/\n$/,'')))
+      return false;
+       
+    i=0;
+    for(var j in apparray) {
+      i++;
+      var functRef = callLater(blockapp,j,apparray[j].split(/,/)[1], apparray[j].split(/,/)[0], 1);
+      setTimeout(functRef, 1600*i);
+    }
+    
+    window.scrollTo(0,0); // scroll up, so user can see its working
+       
+    appdump=null;
+    apparray=null;
+    appnamelist=null;
+    return true;
+    
+  } // END blockallapps function  
+  
+  fbptoggleopts=function(e) {
+    if(e)
+      e.preventDefault();
+    if(!document.getElementById('fbpoptsdiv') && document.getElementById('content') ) {
+      optsdiv.innerHTML=fbpoptshtml;
+      document.getElementById('content').appendChild(optsdiv);
+      document.getElementById('fbpsavesettings').addEventListener('click',fbpsavesettings,false);
+      
+      document.getElementById('exportsettingslink').addEventListener('click',exportsettingsbasic,false);
+      document.getElementById('importsettingslink').addEventListener('click',importsettingsbasic,false);
+         
+         document.getElementById('custextheader').addEventListener('click',hideotherdivs,false);
+         document.getElementById('appwhitelistheader').addEventListener('click',hideotherdivs,false);
+         document.getElementById('custcssheader').addEventListener('click',hideotherdivs,false);
+    }
+
+    //fbpgetprefs(); // is this call really neccessary? opts obj should already be populated, though perhaps opts have changed in another tab/window
+    fbppopulateprefs();
+    document.getElementById('fbpoptsdiv').style.display='block';
+       // get latest fbp news
+       //grabjsonfeed('https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http%3A//feeds.feedburner.com/facebookpurity&callback=publishjsonnews'); // cant use till we update to manifest 2
+       getfbpnews();
+  }
+
+  getfbpnews=function() {
+    //var FBP_FEED = "https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=5&q=http://feeds.feedburner.com/FacebookPurity";
+       var FBP_FEED = "www.facebook.com/feeds/page.php?id=408502197558&format=json";
+       // set a callback function
+       // https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http%3A//api.flickr.com/services/feeds/photos_public.gne%3Fid%3D17472213@N00%26lang%3Den-us%26format%3Drss_200&v=1.0&callback=processResults
+    var FBP_FEED_URL =  window.location.protocol +"\/\/" + FBP_FEED ; //
+       var fbpnewsdiv=document.getElementById('fbpnewsdiv');
+       fbpnewsdiv.style.marginLeft='4px';
+       fbpnewsdiv.style.marginTop='4px';
+       if(fbpnewsdiv.innerHTML.length)
+         return;
+       fbpnewsdiv.innerHTML+='<h4 style="margin-top:4px"><a title="news.fbpurity.com" href="http://www.fbpurity.com/news.htm">F.B. Purity Latest News</a></h4>';
+       
+       //fbpnewsdiv.innerHTML+='<span style="color:red">Without warning or explanation, Facebook have disabled the personal account of the developer of F.B. Purity and also the F.B. Purity fan page, which had over 36,000 fans. [ <a href="http://news.fbpurity.com">Please click here for the full story</a> ] </span>';
+       
+    var http = new window.XMLHttpRequest();
+    http.open("GET", FBP_FEED_URL, true);
+    //http.setRequestHeader("Connection", "close");
+    http.onreadystatechange = function() {
+    if(http.readyState == 4 && http.status == 200) {
+         try {
+           var fbpfeed = JSON.parse(http.responseText);
+         }
+      catch (e) {
+               fbpnewsdiv.innerHTML+='Error : Cant get the news. This can occur if you are logged in to FB as a page Admin.' ;
+               http=fbpfeed=null;
+               return;
+      }
+         if(fbpfeed.entries.length<4)
+           feedlength=fbpfeed.entries.length;
+         else
+           feedlength=4;
+               
+      var newsul=document.createElement('ul');
+      newsul.style.marginTop='3px';
+      newsul.style.marginLeft='5px';
+      var newsli = document.createElement('li');
+         for(i=0;i<feedlength;i++)  {
+           if (!fbpfeed.entries[i].title.replace(/^\ /,'').length) // deal with stupid facebook bug (pics + polls in the json feed dont have titles)
+                 continue; 
+           x =new Date (fbpfeed.entries[i].published);
+        newsli = document.createElement('li');
+           newsli.style.marginBottom="2px";
+        newsli.style.listStyleType="disc";
+        newsa = document.createElement('a');
+        newsa.setAttribute('title', "Published - " + x.toLocaleDateString());
+        newsa.setAttribute('target', "_blank");
+        newsa.setAttribute('href', fbpfeed.entries[i].alternate);
+               newsa.appendChild(document.createTextNode(fbpfeed.entries[i].title.replace(/&#039;/g,"'").replace(/&quot;/g,'"')));
+        newsli.appendChild(newsa);
+        newsul.appendChild(newsli);
+     } 
+        fbpnewsdiv.appendChild(newsul);
+        http=fbpfeed=newsul=newsli=newsa=null;
+     }
+   }
+   http.send();
+  } // END getfbpnews function
+  
+  /* 
+  Commented out because code wont work with latest chrome, unless we update to manifest v2
+
+  function jsoncallbackwrapper() {
+
+    publishjsonnews=function(json) {
+         
+         var fbpnewsdiv=document.getElementById('fbpnewsdiv');
+         
+         if(fbpnewsdiv.innerHTML.length)
+        return;
+           fbpnewsdiv.innerHTML+='<h4 style="margin-top:4px"><a title="news.fbpurity.com" href="http://www.fbpurity.com/news.htm">F.B. Purity Latest News</a></h4>';
+         if(!json.responseData.feed.entries.length){
+       fbpnewsdiv.innerHTML+='Error : Cant get the news.' ;
+               return;
+      }
+         //console.log(json.responseData);
+         fbpfeed=json.responseData.feed;
+      var newsul=document.createElement('ul');
+      newsul.style.marginTop='3px';
+      newsul.style.marginLeft='5px';
+      var newsli = document.createElement('li');
+      for(var i=0;i<4;i++)  {
+           x =new Date (fbpfeed.entries[i].publishedDate);
+        newsli = document.createElement('li');
+           newsli.style.marginBottom="2px";
+        newsli.style.listStyleType="disc";
+        newsa = document.createElement('a');
+        newsa.setAttribute('title', "Published - " + x.toLocaleDateString());
+        newsa.setAttribute('target', "_blank");
+        newsa.setAttribute('href', fbpfeed.entries[i].link);
+        newsa.appendChild(document.createTextNode(fbpfeed.entries[i].title.replace(/&#039;/,"'")));
+        newsli.appendChild(newsa);
+        newsul.appendChild(newsli);
+      }
+         if(fbpnewsdiv)
+           fbpnewsdiv.appendChild(newsul);
+         fbpfeed=newsul=newsli=newsa=null;
+         //document.getElementsByTagName('body')[0].appendChild(fbpnewsdiv);
+    } // END publishjsonnews function
+       
+  } // END jsoncallbackwrapper
+  
+  // BEGIN inject code inside jsoncallbackwrapper function into fb page
+  var script = document.createElement('script');
+  script.appendChild(document.createTextNode('('+ jsoncallbackwrapper +')();'));
+  try {
+    (document.head || document.body || document.documentElement).appendChild(script);
+  }
+  catch(e) {
+    ;//console.log(e , location.href);
+  }
+  // END inject jsoncallbackwrapper code into fb page
+
+  function grabjsonfeed(url){
+    //console.log(url);
+    var script=document.createElement('script');
+    script.src=url;
+    script.type="text/javascript";
+       if(document.getElementsByTagName('head').length)
+      document.getElementsByTagName('head')[0].appendChild(script);
+  }
+  */
+  
+  function fixarticleredirects (node) {
+   try {
+    //console.log('fixarticleredriects');
+    var xtmp=node.getElementsByTagName('a');
+    //console.log(node.textContent + xtmp.length);
+       for (var i=0;i<xtmp.length;i++) 
+         if(xtmp[i].getAttribute('href')){
+           //console.log(xtmp[i].getAttribute('href'));
+        if(xtmp[i].getAttribute('href').match(/redirect_uri=(.*)\&/)) { // matches independent and yahoo
+                 //console.log('indep yahoo' + xtmp[i].getAttribute('href'));
+             xtmp[i].setAttribute('href', decodeURIComponent(xtmp[i].getAttribute('href').match(/redirect_uri=(.*?)\&/)[1].split(/fb_action_ids/)[0]));
+                 xtmp[i].setAttribute('rel','');
+                 xtmp[i].setAttribute('mousedown','');
+        }
+               else if (xtmp[i].getAttribute('href').match(/https?\:\/\/www\.guardian\.co\.uk/))  {
+                 xtmp[i].setAttribute('href',decodeURIComponent(xtmp[i].getAttribute('href').match(/(https?\:\/\/www\.guardian\.co\.uk.*?)\?fb_action_ids/)[1]));
+                 //console.log(decodeURIComponent(xtmp[i].getAttribute('href').match(/(http\:\/\/www\.guardian\.co\.uk.*?)\?fb_action_ids/)[1]));
+                 xtmp[i].setAttribute('rel','');
+                 xtmp[i].setAttribute('onmousedown','');
+               }
+               else if (xtmp[i].getAttribute('href').match(/https?\:\/\/www\.facebook\.com\/l\.php\?u=/))  {
+                 xtmp[i].setAttribute('href',decodeURIComponent(xtmp[i].getAttribute('href').match(/http\:\/\/www\.facebook\.com\/l\.php\?u=(.*)\%3Ffb_action_ids/)[1]));
+                 //console.log(xtmp[i].getAttribute('href'));
+                 xtmp[i].setAttribute('rel','');
+                 xtmp[i].setAttribute('onmousedown','');
+               }
+               else if(xtmp[i].getAttribute('href').match(/https?\:\/\/apps\.facebook\.com/)){
+          if(xtmp[i].textContent.length){ // && xtmp[i].parentNode.getAttribute('class').match(/ogAggregationAnimSubstorySlideHeadline/)
+                   xtmp[i].setAttribute('href',  'http://google.com/search?q=' + encodeURIComponent("'" + xtmp[i].textContent + "'") + "&btnI=I'm+Feeling+Lucky");
+                   xtmp[i].setAttribute('rel','');
+                   xtmp[i].setAttribute('mousedown','');
+                 }
+               }
+      } // end if
+               //else
+               // console.log(xtmp[i].getAttribute('href'));
+    xtmp=null;
+       } catch(e)
+        {
+          ;//console.log('feckit! ' + e );
+        }
+  }
+
+  function filtermatchmsg(mnode, msg) {
+    if(mnode.getElementsByClassName('filtermatchtext').length)
+      mnode.getElementsByClassName('filtermatchtext')[0].textContent=msg;
+    else {
+         var matchspan=document.createElement('div');
+         matchspan.setAttribute('class','filtermatchtext');
+         matchspan.style.color='grey';
+         matchspan.appendChild(document.createElement('br'));
+         matchspan.appendChild(document.createTextNode(msg));
+         mnode.appendChild(matchspan);
+       }
+  }
+  
+  function cleartheshizzle(thenode) {
+    //unsafeWindow.console.log('clearing the shizzle a : '  + location.href);
+       var oldfeedstyle=document.getElementById('pagelet_home_stream');
+    var newfeedstyle=document.getElementById('pagelet_litestand_section');
+       var neweststyle= document.getElementById('stream_pagelet');
+    //if(!oldfeedstyle && (!newfeedstyle) && (!neweststyle))
+       if(!(oldfeedstyle || newfeedstyle || neweststyle)) {
+         console.log('FBP Error: couldnt find the news stream');
+         return;
+       }
+    //if(!document.getElementById('pagelet_home_stream') || (!document.getElementById('pagelet_litestand_section')))
+       //  return;
+       
+    if(!document.getElementById('fbpblockcount')) {
+       
+      crappyappmsgcounter=0;
+      fbpstyle.textContent=fbpStyleNormal;
+
+      if(document.getElementById('pagelet_fl_composer')) // friends list page
+        var insertpoint = document.getElementById('pagelet_fl_composer');
+      else if (document.getElementById('profile_stream_composer'))  //profile page or fanpage
+        var insertpoint = document.getElementById('profile_stream_composer');
+      else if (document.getElementById('pagelet_composer')) //homepage
+        var insertpoint = document.getElementById('pagelet_composer');
+         else if(document.getElementById('timelineNavContent')) {
+           return; 
+           var insertpoint = document.getElementById('timelineNavContent');
+         }
+      else if(window.location.href.match(/facebook\.com\/apps\/feed/) || window.location.href.match(/facebook\.com\/pages\/feed/))
+           var insertpoint = document.getElementById('contentArea'); 
+         
+      if(insertpoint) {
+        if(document.getElementsByClassName('uiHeaderPage') && document.getElementsByClassName('uiHeaderPage').length)
+          document.getElementsByClassName('uiHeaderPage')[0].setAttribute('style','padding-bottom:5px');
+        var fbpurityinfowrapper=document.createElement('div');
+        if(oldfeedstyle)
+          fbpurityinfowrapper.style.marginTop='-10px';
+               fbpurityinfowrapper.style.marginBottom='2px';
+               fbpurityinfowrapper.setAttribute('id','fbpurityinfowrapper');
+               if(document.getElementById('boulder_fixed_header'))
+                  document.getElementById('boulder_fixed_header').firstChild.style.marginTop='13px';
+        var fbpurityinfo=document.createElement('div');
+        fbpurityinfo.setAttribute('id','fbpurityinfobar');
+        var fbpclear=document.createElement('div');
+        fbpclear.style.clear='both';
+        
+        fbpurityinfo.style.cssFloat='right';
+        fbpurityinfo.style.background='whitesmoke';
+        fbpurityinfo.innerHTML='<span id="fbpupgradeinfo" style="color:red"></span>&nbsp;<a id="fbpoptslink" title="' + fbpVersion + ' - Fluff Busting Purity - Options" href="javascript:;"><b>F.B. Purity</b></a> <span id="fbperrormsg" style="color:red"></span> hid: &nbsp;<span id="fbpblockcount">0</span> <abbr title="Application + Game Stories">app</abbr> [ <a title="Show Application + Game Stories" id="fbpshowblockedlink" href="javascript:;">Show</a> ] &nbsp;<span id="fbpblockxcount">0</span> <abbr title="Friend/Group/Fan/Event etc Stories">extra</abbr> [ <a title="Show Friend/Group/Fan/Event etc Stories" id="fbpshowblockedxlink" href="javascript:;">Show</a> ]&nbsp;';
+
+        fbpurityinfowrapper.appendChild(fbpurityinfo);
+        fbpurityinfowrapper.appendChild(fbpclear);
+
+        if((document.getElementById('pagelet_composer') || document.getElementById('pagelet_fl_composer')) && (!document.getElementById('fbpurityinfobar'))) // homepage // fanpage or // friends list page
+          insertpoint.parentNode.insertBefore(fbpurityinfowrapper, insertpoint.nextSibling); // after composer
+        else if (document.getElementById('profile_stream_composer')  && (!document.getElementById('fbpurityinfobar')))
+          insertpoint.parentNode.insertBefore(fbpurityinfowrapper, insertpoint.nextSibling);
+               else if (document.getElementById('timelineNavContent') && (!document.getElementById('fbpurityinfobar'))) {
+                 fbpurityinfowrapper.style.display='none'; // we not showing bar for now, as filtering doesnt work on timeline yet
+          insertpoint.appendChild(fbpurityinfowrapper);
+               }
+               else if(window.location.href.match(/facebook\.com\/apps\/feed/) || window.location.href.match(/facebook\.com\/pages\/feed/)) { // games feed page
+                 insertpoint.insertBefore(fbpurityinfowrapper, insertpoint.firstChild);
+               }
+          
+        document.getElementById('fbpshowblockedlink').addEventListener("click", fbpshowblockedev, false);
+        document.getElementById('fbpshowblockedxlink').addEventListener("click", fbpshowblockedxev, false);
+        document.getElementById('fbpoptslink').addEventListener("click", fbptoggleopts, false);
+       
+        fpbblockcountspan=document.getElementById('fbpblockcount');
+        fpbblockxcountspan=document.getElementById('fbpblockxcount');
+
+      }
+
+    }
+
+    //if we navigate away from the page then come back, the event listeners seem to disappear, so lets re-add them here.
+    if( document.getElementById('fbpshowblockedlink') ) {
+      document.getElementById('fbpshowblockedlink').removeEventListener("click", fbpshowblockedev, false);
+      document.getElementById('fbpshowblockedlink').addEventListener("click", fbpshowblockedev, false);
+    }
+    if( document.getElementById('fbpshowblockedxlink') ) {
+      document.getElementById('fbpshowblockedxlink').removeEventListener("click", fbpshowblockedxev, false);
+      document.getElementById('fbpshowblockedxlink').addEventListener("click", fbpshowblockedxev, false);
+    }
+    if( document.getElementById('fbpoptslink') ) {
+      document.getElementById('fbpoptslink').removeEventListener("click", fbptoggleopts, false);
+      document.getElementById('fbpoptslink').addEventListener("click", fbptoggleopts, false);
+    }
+    
+       // Deal with recent activity blocks
+    /*
+       if (thenode.getAttribute && thenode.getAttribute('class') && thenode.getAttribute('class').match(/uiStreamMinistoryGroup/)) {
+         if(fbpoptsobj.recentactivity) {
+           thenode.setAttribute('class',thenode.getAttribute('class') + ' fbpblockedx');
+               updateblockedcount();
+               return;
+         }
+         else {
+           thenode.setAttribute('class',thenode.getAttribute('class') + ' fbpnormal');
+           return;
+         }
+       }
+       else if(thenode.getElementsByClassName('uiStreamMinistoryGroup').length) {
+         var rablocks=thenode.getElementsByClassName('uiStreamMinistoryGroup');
+         for(var rai=0;rai<rablocks.length;i++)
+           if(fbpoptsobj.recentactivity) {
+              rablocks[rai].setAttribute('class',rablocks[rai].getAttribute('class') + ' fbpblockedx');
+                  updateblockedcount();
+               }
+           else
+                 rablocks[rai].setAttribute('class',rablocks[rai].getAttribute('class') + ' fbpnormal');
+         rablocks=null;
+       }
+       */
+
+    storyclass="uiStreamStory";
+    
+    var storynodes, singlestory;
+    singlestory=0;
+    if(oldfeedstyle) {
+      storynodes=thenode.getElementsByClassName(storyclass);
+      if (!storynodes[0])
+        if(thenode.getAttribute && thenode.getAttribute('class') && thenode.getAttribute('class').match(storyclass)) {       
+          storynodes[0]=thenode;
+          singlestory=1;
+        }
+        else {
+          //unsafeWindow.console.log('no generic: ' + thenode.getAttribute('class'));
+          return;
+        }
+    }
+    else { // new newsfeed design
+      storynodes=thenode.querySelectorAll("div[data-dedupekey]");
+      if (!storynodes[0])
+           if(thenode.getAttribute && thenode.getAttribute('data-dedupekey')) {       
+          storynodes[0]=thenode;
+          singlestory=1;
+        }
+        else {
+          //unsafeWindow.console.log('no generic: ' + thenode.getAttribute('class'));
+          return;
+        }
+    }
+
+    var blockit, blockitx; 
+    var story_meta, fbpAppId; // story_type,
+    var attribappid, attribnode, fbpAppIdMatch;
+       var storysaction, storysactiontext;
+       var actoria, actorialink, actoriadatacard;
+    var storyattachments,storyattachment;
+
+    if(singlestory)
+      storynodeslength=1;
+    else  
+      storynodeslength=storynodes.length;
+
+    // START MAIN LOOP 
+    for(i=0;i<storynodeslength;i++) {
+      if(oldfeedstyle) {
+        if(storynodes[i].nodeName=='DIV') //deal with anomalous div that has classname pvm
+          continue;
+           if((storynodes[i].parentNode.parentNode && storynodes[i].parentNode.parentNode.getAttribute('class') && storynodes[i].parentNode.parentNode.getAttribute('class').match('uiStreamMinistoryGroup')) || ((storynodes[i].parentNode.parentNode.parentNode.parentNode.getAttribute('class') && storynodes[i].parentNode.parentNode.parentNode.parentNode.getAttribute('class').match('uiStreamMinistoryGroup'))))
+             continue;
+      }
+      
+      blockit=0;
+       
+         //console.log(storynodes[i].textContent);
+         
+         //parse the story's header for the story type and check the header for any matches
+      if(oldfeedstyle)
+           storysaction=storynodes[i].getElementsByClassName('uiStreamMessage');
+      else
+        storysaction=storynodes[i].getElementsByTagName('h5');
+         if(storysaction && storysaction.length) {
+           //unsafeWindow.console.log(storysaction + storysaction.length + storysaction[0].textContent);
+           storysactiontext=storysaction[0].textContent;
+         }
+      else {
+        if(oldfeedstyle)
+             storysactiontext='';
+        else
+          storysactiontext=storynodes[i].textContent;
+      }
+         if(typeof storysactiontext=='undefined') 
+           storysactiontext='';
+
+         storyattachments=storynodes[i].getElementsByClassName('uiStreamAttachments');
+      story_meta=storynodes[i].getAttribute('data-ft');
+      if(story_meta==null) {
+        /*
+        if(storynodes[i].getElementsByClassName('fss').length) { // check for Recent Activity Blocks
+          // need to check fbpopts for whether to treat as extra
+          if(fbpoptsobj.recentactivity==1)
+            storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+ ' fbpblockedx');
+          else
+            storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+ ' fbpnormal');
+          updateblockedcount();
+          continue;
+        }
+        */
+        if(storynodes[i].className.match(/uiFacepile|uiListHorizontal|uiListVerticalItemBorder/)) { // deals with new feature of friends list pages
+                 continue;
+        }
+        break;
+      }
+
+         // sponsored stories filter
+         if(fbpoptsobj.sponsoredbox && story_meta && story_meta.match(/"ei"/)) {
+               storynodes[i].style.display='none';//backgroundColor='red';
+               continue;
+         }
+         // "play with friends" story filter
+         if(fbpoptsobj.filterappmessages && storynodes[i].getAttribute('class').match(/aid_140332009231/)) {
+               storynodes[i].style.display='none'; //.style.backgroundColor='red';
+               continue;
+         }
+         
+         // experimental swearing filter (seems a bit memory intensive..)
+         /*
+         var swearfilter=1;
+         if(swearfilter) {
+           storynodes[i].innerHTML=storynodes[i].innerHTML.split(/cunt|shit|piss|fuck|wank|arse|tits|cocksucker/).join("****");
+         }
+         */
+         
+               /*
+           var foundspon=0;
+           ufooter=storynodes[i].getElementsByClassName('uiStreamFooter');
+           if(ufooter.length){
+             for(g=0;g<ufooter.length;g++)     
+                   if(ufooter[g].textContent.match(/· Sponsored/)) {
+                     storynodes[i].style.display='none';
+                         if(debug)
+                           console.log("Hid sponsored story\n\n" + storynodes[i].textContent);
+                         foundspon=1;
+                         break;
+                   }
+                 if(foundspon)
+                   continue;
+               }
+               */
+
+      // start fan page story filter . also check that we are not on an fb fan page or the story is not by the current logged in user,
+      //if(fbpoptsobj.pagestory && (!document.getElementById('pagelet_pages_about'))) {
+      //console.log(storynodes[i].innerHTML);
+      actoria=storynodes[i].getElementsByClassName('uiStreamMessage');
+      if(actoria.length) {
+        actorialink=actoria[0].getElementsByTagName('a')[0];
+               if(typeof(actorialink)!='undefined') {
+                 actoriadatacard=actorialink.getAttribute('data-hovercardx');
+                 if(!actoriadatacard)
+            actoriadatacard=actorialink.getAttribute('data-hovercard');
+           }
+        if(actoriadatacard) {
+                 if (actoriadatacard.match(useridwhitelistRX)) { // if its fbp or the current user
+                   storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+ ' fbpnormal');
+            actoriadatcard=null;
+            actorialink=null;
+            actoria=null;
+            continue;
+                 }
+                 else if(fbpoptsobj.pagestory && (!document.getElementById('pagelet_pages_about')) && actoriadatacard.match(/page\.php/) && (!window.location.href.match(/facebook.com\/(pages\/feed|lists\/)/))) {
+                   // if we are on the "page feed" or interest list leave it alone
+            //if(actoriadatacard.match(/page\.php/) && (!actoriadatacard.match(/id=408502197558/))) {
+            //its a page and its not fbp;
+            storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+ ' fbpblockedx');
+                       filtermatchmsg(storynodes[i],'FBP : Story Type Filter Match - Fan Page Story');
+            updateblockedcount();
+            actoriadatcard=null;
+            actorialink=null;
+            actoria=null;
+            continue;
+          }
+          actoriadatacard=null;
+        }
+        actorialink=null;
+      }
+      actoria=null;
+      // end fan page story filter
+
+      //unsafeWindow.console.log('"'+storysactiontext+'"' + ' ' + headerTextFilter);
+         // lets check the header text filter
+         if((fbpoptsobj.fixarticleredirects && storysactiontext.length && storysactiontext.match(/ article/)) || storynodes[i].getElementsByClassName('ogAggregationSubstory').length || storynodes[i].getElementsByClassName('ogStaticSlidePager').length || storynodes[i].getElementsByClassName('ogSliderAnimPager').length) {
+               fixarticleredirects(storynodes[i]);
+         }
+         
+         if(storysactiontext.length && headerTextFilter.length && storysactiontext.match(headertextfilterRX)) {
+               storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
+               //matchspan=document.createElement('div');
+               //matchspan.style.color='grey';
+               matchedtext=storysactiontext.match(headertextfilterRX)[0];
+               filtermatchmsg(storynodes[i],'   FBP : Story Type Filter Match - ' + matchedtext);
+               //if(matchedtext.match(/ article/))
+               //  fixarticleredirects(storynodes[i]);
+               storysactiontext=matchedtext='';
+               updateblockedcount();
+        continue;
+         }
+
+      // lets check the text filter
+      if(cleancustomtextfilter.length && storynodes[i].textContent.length && storynodes[i].textContent.match(textfilterRX)) {
+        //window.console.log(storynodes[i].textContent)
+        storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
+               filtermatchmsg(storynodes[i],'   FBP : Custom Text Filter Match - ' + storynodes[i].textContent.match(textfilterRX)[0]);
+               updateblockedcount();
+        continue;
+      }
+
+         // if hide all photos option has specifically been ticked
+         //if(fbpoptsobj.sharedphoto && fbpoptsobj.uploadedphoto && fbpoptsobj.taggedlikescommentphoto && fbpoptsobj.taggedalbum)
+         if((typeof fbpoptsobj.hideallphotos!=='undefined') && fbpoptsobj.hideallphotos)
+          if(!window.location.href.match(/facebook\.com\/\?sk=app_2305272732_2392950137/))
+        if(storynodes[i].getElementsByClassName('photoRedesign').length) {
+                 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
+                 filtermatchmsg(storynodes[i],'   FBP : Story Type Filter Match - Hide All Photos');
+                 updateblockedcount();
+          continue;
+               }
+
+         if((typeof fbpoptsobj.hideallvideos!=='undefined') && fbpoptsobj.hideallvideos) {
+          //if(!window.location.href.match(/facebook\.com\/\?sk=app_2305272732_2392950137/))
+        if(storynodes[i].getElementsByClassName('uiVideoThumb').length) {
+                 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
+                 filtermatchmsg(storynodes[i],'   FBP : Story Type Filter Match - Hide All Videos');
+                 updateblockedcount();
+          continue;
+               }
+         }
+         else if ((typeof fbpoptsobj.sharedvideo!=='undefined') &&fbpoptsobj.sharedvideo){
+           var svid=storynodes[i].getElementsByClassName('shareMediaVideo');
+           if(svid.length) 
+                 if(svid[0].getAttribute('href') &&  svid[0].getAttribute('href').match(/facebook\.com\/video\/video\.php/)) {
+                   storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
+                   filtermatchmsg(storynodes[i],'   FBP : Story Type Filter Match - Hide Shared Video');
+                   updateblockedcount();
+                       svid=null;
+            continue;
+                 }
+         }
+
+         // probably could get rid of this bracket... (it used to be part of a big if/else statement
+      {
+        // so far it looks like a normal story, but lets check if its been posted by an application
+        //unsafeWindow.console.log("normal?:" + storynodes[i].getElementsByClassName('uiStreamSource')[0].textContent);
+        blockit=0;
+               
+        // these 3 blocks of code need to be refactored
+        attribnode=storynodes[i].getElementsByClassName('UIIntentionalStory_BottomAttribution');
+        if(attribnode && attribnode.length) {
+          attribnode=attribnode[0];
+          if(attribnode.innerHTML.match(/\?id=(\d+)\"/)) {
+            attribappid=attribnode.innerHTML.match(/\?id=(\d+)\"/)[1];
+            if(attribappid){
+              if(!arrwhitelist2[attribappid])
+                blockit=1; // its not in the whitelist so block it
+            }
+          }
+        }
+        
+        attribnode2=storynodes[i].getElementsByClassName('GenericStory_BottomAttribution');
+        if(attribnode2  && attribnode2.length) { // GenericStory
+          attribnode2=attribnode2[0];
+          if (attribnode2.innerHTML.match(/id=(\d+)/)) {
+            attribappid=attribnode2.innerHTML.match(/id=(\d+)/)[1];
+            if(attribappid){
+              if(!arrwhitelist2[attribappid])
+                blockit=1; // its not in the whitelist so block it
+            }
+          }
+        }
+        
+        attribnode3=storynodes[i].getElementsByClassName('uiStreamSource');
+        if(attribnode3 && attribnode3.length) {
+          attribnode3=attribnode3[0];
+          if (attribnode3.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)) {
+            if(typeof attribnode3.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)[1] !='undefined')
+              attribappid=attribnode3.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)[1];
+            else if (typeof attribnode3.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)[2] !='undefined')
+              attribappid=attribnode3.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)[2];
+            if(attribappid){
+              if(!arrwhitelist2[attribappid])
+                blockit=1; // its not in the whitelist so block it
+            }
+          }
+        }
+               
+               attribnode4=storynodes[i].getElementsByClassName('UIActionLinks_bottom');
+        if(attribnode4 && attribnode4.length) { 
+          attribnode4=attribnode4[0];
+          if (attribnode4.innerHTML.match(/application.php\?id=(\d+)/)) {
+            attribappid=attribnode4.innerHTML.match(/application.php\?id=(\d+)/)[1];
+            if(attribappid){
+              if(!arrwhitelist2[attribappid])
+                blockit=1; // its not in the whitelist so block it
+            }
+          }
+        }
+               // new app checks for fb actions / frictionless sharing apps
+               var sua=0;
+               if(storysaction && storysaction.length) {
+                 attribappid=storysaction[0].innerHTML.match(/\/hovercard\/application\.php\?id\=(\d*)/);
+                 if(attribappid) {
+                   if(!arrwhitelist2[attribappid[1]]) {
+                blockit=1; // its not in the whitelist so block it
+                               sua=1;  // sua = started using app?
+                   }
+                 }
+                 else {
+                   if(storynodes[i].getAttribute('data-gt')) {
+                         //"appid":"163114453728333"
+                         if(storynodes[i].getAttribute('data-gt').match(/\"appid\":\"\d+\"/)) {
+                           attribappid=storynodes[i].getAttribute('data-gt').match(/\"appid\":\"(\d+)\"/)[1];
+                               if(!arrwhitelist2[attribappid]) {
+                  blockit=1; // its not in the whitelist so block it
+                                 sua=1;  // sua = started using app?
+                       }
+                     }
+                       }
+                 }
+               }
+               
+        if(blockit) {
+          // mark app as blocked
+          storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+ filterapptext);
+                 if(sua)
+                   dspBlockLink(storynodes[i],"sua");
+                 else
+            dspBlockLink(storynodes[i]);
+        } 
+        else {
+          //its probably a "normal" story node but lets check for attachments (photos or links)
+                 //if ((fbpoptsobj.postedlink || fbpoptsobj.sharedphoto) && (!storynodes[i].getAttribute('class').match(/fbp/)) && storyattachments.length ) {
+                 if (fbpoptsobj.postedlink && (!storynodes[i].getAttribute('class').match(/fbp/)) && storyattachments.length ) {
+               storyattachment=storyattachments[0];
+                   storylinks=storyattachment.getElementsByTagName('a');
+                   if(storylinks.length) {
+                 storylink=storylinks[0];
+                     if (fbpoptsobj.postedlink && storylink.getAttribute('onclick') && storylink.getAttribute('onclick').match(/^LinkshimAsync/)) {
+                 //its an external link
+                                storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
+                                //unsafeWindow.console.log("postedlink= " +fbpoptsobj.postedlink);
+                                //storynodes[i].appendChild(filtermatchmsg('   FBP : Story Type Filter - Shared a link'));
+                                filtermatchmsg(storynodes[i],'   FBP : Story Type Filter - Shared a link');
+                         }
+                     /*else if (fbpoptsobj.sharedphoto && storynodes[i].getElementsByClassName('uiPhotoThumb').length) // should we also check for uiMediaThumb ???
+                        // its a shared photo
+                                storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');*/
+                         else {
+                           storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpnormal');
+                     }
+                   }
+                       else {
+                               storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpnormal');
+                       }
+                   //else if(storyattachment.getElementsByClassName('uiVideoThumb').length)
+                   //unsafeWindow.console.log(storyattachment.textContent);
+               //check for attachments
+                       storyattachments={};
+                       storyattachment=null;
+             }
+                 else
+                   storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpnormal');
+        }
+               // check for wall posts
+               if(fbpoptsobj.commentwall && (typeof(storynodes[i])!='undefined') && storynodes[i].getAttribute && storynodes[i].getAttribute('class').match(/fbpnormal/)) {
+                 var wallarrows=storynodes[i].getElementsByClassName('wallArrowIcon');
+                 if(wallarrows.length) {
+                       storynodes[i].setAttribute('class',storynodes[i].getAttribute('class').replace('fbpnormal','') + ' fbpblockedx');
+                       //storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
+                       //storynodes[i].appendChild(filtermatchmsg('   FBP : Story Type Filter Match - Commented on Wall'));
+                       filtermatchmsg(storynodes[i],'   FBP : Story Type Filter Match - Wrote on Wall');
+                 }
+               }
+      }
+
+      updateblockedcount();
+      
+    } // End For Loop through feed nodes
+    
+    storynodes=null;
+    
+  }// END cleartheshizzle function
+
+
+///////////////////////////////////////
+// BEGIN BRING BACK NORMAL COMMENTING
+///////////////////////////////////////
+bringbacknormalcommenting = function() {
+  if(typeof(window.navigator.vendor)!='undefined') //fix the stupid comment box growing too much in safari and chrome
+    if(window.navigator.userAgent.match(/Safari/)) //Apple Computer
+      //if(window.navigator.userAgent.match(/AppleWebKit/))
+         if(document.getElementById('fbpfreestyler'))
+        document.getElementById('fbpfreestyler').textContent += ' textarea.uiTextareaAutogrow {max-height:250px !important}' 
+
+  fbptasubmit = function (e) {
+       //console.log(e.target.getAttribute('id'));
+       //var fbpcta=document.getElementById('x' + e.target.getAttribute('id').split(/butt/)[0]);
+       var fbpcta=document.querySelector("textarea[data-x-reactid=\""+ e.target.getAttribute('id').split(/butt/)[0] + "\"]"); // getElementById('x' + e.target.getAttribute('id').split(/butt/)[0]);
+       if(!fbpcta)
+         return;
+       //fbpcta.setAttribute('id',fbpcta.getAttribute('id').split(/x/)[1]);
+       fbpcta.setAttribute('data-reactid',fbpcta.getAttribute('data-x-reactid'));
+       fbpcta.focus();
+       e.target.value="Now press 'Enter' to submit your comment";
+       //e.target.parentNode.style.left="95px"; // width is wrong for photo comments
+       
+       //if(window.navigator.userAgent.match(/Opera/))
+       //  e.target.removeListener('click',fbtasubmit)
+       //else
+       e.target.disabled=true;
+       if(window.navigator.userAgent.match(/Opera/))
+         e.target.style.backgroundColor='red !important';
+    var xnode=fbpcta;
+       while(xnode.parentNode) {
+         if(xnode.parentNode.nodeName=="FORM") {
+               //xnode.parentNode.submit();
+               //window.Event.__inlineSubmit(xnode.parentNode);
+               break;
+      }
+         xnode=xnode.parentNode
+    }
+  }
+       
+if (fbpoptsobj.commentbutton) { // when editing a comment, if first key pressed is enter, the text is submitted, if not then it works ok.
+  
+  window.addEventListener('keydown', function(event) {
+       if (event.target.tagName && (event.target.tagName=="TEXTAREA")) {
+         if(event.target.getAttribute('class')) {
+           event.target.setAttribute('class',event.target.getAttribute('class').replace(/enter_submit/,''));
+         }
+         if(event.target.getAttribute('data-reactid')) { // && event.target.getAttribute('id').match(/^\.reactRoot/)
+           event.target.setAttribute('data-x-reactid',event.target.getAttribute('data-reactid'));
+               event.target.setAttribute('data-reactid',''); //'x' + event.target.getAttribute('data-reactid'));
+               var tmph=event.target.parentNode.parentNode.parentNode.getElementsByClassName('monglab');
+               if(tmph.length) {
+                  tmph[0].getElementsByTagName('input')[0].value='Comment';
+                  //tmph[0].getElementsByTagName('input')[0].parentNode.style.left="250px";
+                  if(window.navigator.userAgent.match(/Opera/))
+                    tmph[0].getElementsByTagName('input')[0].style.backgroundColor="#5B74A8";
+                  tmph[0].getElementsByTagName('input')[0].disabled=false;
+                  //  tmph[0].addEventListener('click',fbptasubmit,false);
+                  //else  
+                  // tmph[0].getElementsByTagName('input')[0].disabled=false;
+               }
+               else {
+                 monglab=document.createElement('label');
+                 //monglab.setAttribute('style','float:right');
+                 monglab.setAttribute('class','monglab mts commentBtn stat_elem optimistic_submit uiButton uiButtonConfirm');
+                 monglab.setAttribute('style','');//position:relative;left:250px // width is wrong for photo comments
+                 monglab.innerHTML='<input value="Comment" class="enter_submit_target" name="comment" type="button" id="' + event.target.getAttribute('data-x-reactid') + 'butt' + '">';
+                 monglab.addEventListener('click',fbptasubmit,false);
+                 event.target.parentNode.parentNode.parentNode.appendChild(monglab);
+               }
+         }
+       }
+  } , false);
+  
+  if (document.getElementById('fbpfreestyler'))
+    document.getElementById('fbpfreestyler').textContent += ' .sendOnEnterTip , .commentUndoTip {display:none !important} .hidden_elem .optimistic_submit, #facebook .child_is_active .hidden_elem.commentBtn, #fbPhotoSnowliftFeedbackInput .hidden_elem.commentBtn  {display:block !important;} div.-cx-PRIVATE-fbGiftTodayBirthdaysCoverPhoto__coverBlock {overflow:auto}';
+  
+  bringbackcommentbuttons=function () {
+   //deal with the ticker flyout comment boxes
+    var plops=document.getElementsByClassName('uiContextualDialogPositioner');
+    var combutts2;
+    for(var i=0;i<plops.length;i++) {
+      combutts2=plops[i].getElementsByClassName('optimistic_submit');
+      if(combutts2.length)
+        combutts2[0].setAttribute('style','display:block !important');
+    }
+       //deal with birthday flyout comment boxes and groups new member boxes
+       var remconts=document.getElementsByClassName('fbRemindersContent');
+       if(remconts.length) {
+         for(var m=0;m<remconts.length;m++) {
+        plops=remconts[m].getElementsByClassName('pam');
+        var combutts3,comta;
+        for(i=0;i<plops.length;i++) {
+          combutts3=plops[i].getElementsByClassName('hidden_elem');
+          for(j=combutts3.length-1;j>=0;j--)
+                   if(!combutts3[j].getAttribute('class').match(/highlighterContent/) && (combutts3[j].nodeName!='DIV'))
+              combutts3[j].setAttribute('class','uiButton uiButtonConfirm');
+                 comta=plops[i].getElementsByClassName('enter_submit');
+                 for(l=comta.length-1;l>=0;l--)
+                   comta[l].setAttribute('class',comta[l].getAttribute('class').replace('enter_submit',''));
+        }
+         }
+    }
+       
+       // deal with  birthdays box in newsfeed itself
+       var blobuts=document.querySelectorAll('.-cx-PRIVATE-fbGiftTodayBirthdays__list label.hidden_elem');
+       if(blobuts.length)
+          for(m=0;m<blobuts.length;m++)
+            blobuts[m].setAttribute('class','uiButton uiButtonConfirm');
+       
+       plops=remconts=comta=blobuts=null;
+  }
+  
+  bringbackcommentbuttons();
+  
+  var waitfordom=setInterval(function(){
+  //clearInterval(waitfordom);
+      bringbackcommentbuttons();
+  }, 3000);
+
+} // END IF hide button option has not been selected
+/////////////////////////////////////
+// END BRING BACK NORMAL COMMENTING 
+/////////////////////////////////////
+} // end bringbacknormalcommenting function 
+
+function fixexternallinkredirects() {
+  // fix external link redirects 
+  window.setTimeout(function() {UntrustedLink=null;LinkshimAsyncLink.referrer_log = LinkshimAsyncLink.swap = search_logged_ajax=function(){;};},0);
+  window.setTimeout(function() {UntrustedLink=null;LinkshimAsyncLink.referrer_log = LinkshimAsyncLink.swap = search_logged_ajax=function(){;};},5000);
+  window.setInterval(function(){UntrustedLink=null;LinkshimAsyncLink.referrer_log = LinkshimAsyncLink.swap = search_logged_ajax=function(){;};},60000);
+  
+  unmanglelinks = function(nodetofix) {
+    //console.log(typeof(nodetofix));
+    if(typeof(nodetofix)=='undefined')
+      var nodetofix=document;
+       if(nodetofix.getElementsByTagName) {
+      var as=nodetofix.getElementsByTagName('a');
+      for(var i=0;i<as.length;i++)
+        if(as[i].href && as[i].href.match(/\/l\.php\?/)) {
+             as[i].href=decodeURIComponent(as[i].href.match(/\/l\.php\?u=(.*)\&h=/)[1]);
+             //console.log(decodeURIComponent(as[i].href));
+        }
+       }
+  }
+  window.setTimeout(unmanglelinks,3000); // run on first load of page
+}
+
+// new fix links code>
+//as=document.getElementsByTagName('a');for(i=0;i<as.length;i++)if(as[i].href.match(/\/l\.php/))console.log(as[i].href)
+
+  
+// this function is duplicated, as it is also injected into the page's dom, so it can run from there too
+unmanglelinks = function(nodetofix) {
+  //console.log('unmanglelinks');
+  if(typeof(nodetofix)=='undefined')
+    var nodetofix=document;
+  if(nodetofix.getElementsByTagName) {
+    var as=nodetofix.getElementsByTagName('a');
+    for(var i=0;i<as.length;i++) {
+         //if(as[i].href.match(/l\.php/)) console.log((as[i].href));
+      if(as[i].href.match(/\/l\.php\?u=(.*)\&h=/)) {
+           as[i].href=decodeURIComponent(as[i].href.match(/\/l\.php\?u=(.*)\&h=/)[1]);
+           //console.log(decodeURIComponent(as[i].href));
+         }
+       }
+  }
+}
+//  END Duplicated function
+
+////////////////////////////////////////////////////////////////
+// BEGIN FUNCTION deleterecentactivitymodule
+// function deleterecentactivitymodule is just a wrapper for the code, so we can inject it into the fb page
+function deleterecentactivitymodule () {
+
+/* BEGIN HISTORY STATE CHANGE HANDLER */
+(function(history){
+    var pushState = history.pushState;
+    history.pushState = function(state) {
+        if (typeof history.onpushstate == "function") {
+            history.onpushstate({state: state});
+        }
+        // ... whatever else you want to do
+        // maybe call onhashchange e.handler
+        //console.log('history state changed:' + arguments[0]);
+               // experiment to disable theatre mode
+               //if(arguments[0].match(/\/photo\.php\?.*\&theater/))
+               //  location.href=arguments[0];
+               
+               /* facebook has now added an event delete button
+               if(arguments[0].match(/\/events\//)) {
+                 setTimeout(deleventbutt,3000);
+               }
+               */
+               
+               if(arguments[0].match(/\/appcenter\//)) {
+                 setTimeout(highlightemailrequest,2500);
+               }
+               
+               //console.dir(arguments[0]);
+        return pushState.apply(window.history, arguments);
+    }
+})(window.history);
+/* END HISTORY STATE CHANGE HANDLER*/
+
+}
+// END FUNCTION deleterecentactivitymodule
+
+addexternallinkfix = function() {
+/////////////////////////////////////////////////////////////
+// BEGIN inject deleterecentactivitymodule code into fb page
+  var scriptx = document.createElement('script');
+  scriptx.setAttribute('id','scriptx');
+  if(fbpoptsobj.fixarticleredirects)  // fix external link redirects
+    scriptx.appendChild(document.createTextNode('('+ fixexternallinkredirects +')();'));
+  
+  scriptx.appendChild(document.createTextNode('('+ deleterecentactivitymodule +')();'));
+
+  (document.head || document.body || document.documentElement).appendChild(scriptx);
+// END inject deleterecentactivitymodule code into fb page
+////////////////////////////////////////////////////////////////
+}
+
+addblockbuttontopermreq = function() {
+  buttbars=document.getElementsByClassName('platform_dialog_buttons');
+  if(!buttbars.length)
+    buttbars=document.getElementsByClassName('rightContent');
+  if(buttbars.length) {
+    buttbar=buttbars[0];
+       //if(location.href.match(/client_id=/)
+       //var bappid=window.location.href.match(/[client|app]_id=(\d*)/)[1];
+       var bappid;
+       if(document.getElementById('input_app_id'))
+         bappid=document.getElementById('input_app_id').getAttribute('value');
+       else if (document.getElementsByClassName('legalese').length) {
+         var legas=document.getElementsByClassName('legalese')[0].getElementsByTagName('a');
+         if(legas.length)
+           for(var v=legas.length-1;v>=0;v--)
+                 if(legas[v].getAttribute('ajaxify').match(/cid=(\d+)/)) {
+                   bappid=legas[v].getAttribute('ajaxify').match(/cid=(\d+)/)[1];
+                       break;
+                 }
+    }
+       
+       var titleclass=document.getElementsByClassName('fsxl');
+       if(titleclass.length)
+         var bapname=titleclass[0].textContent;
+       else
+         if(document.getElementById('permPanel'))
+           bapname=document.getElementById('permPanel').getElementsByTagName('b')[0].textContent;
+       else
+      var bapname="Application";
+       /*
+       blahlink=document.createElement('a');
+       blahlink.setAttribute('ajaxify','/ajax/apps/block_app.php?app_id=' +  bappid + '&type_index=0&source=about&confirm_id=block_app_link');
+       blahlink.setAttribute('rel','dialog');
+       blahlink.setAttribute('id','js_3');
+       blahlink.style.marginLeft='4px';
+       
+    blahlab=document.createElement('label');
+    blahlab.setAttribute('class','uiButton uiButtonConfirm uiButtonLarge');
+       blahlab.setAttribute('id','blockapplab');
+       blahlab.setAttribute('appid',bappid);
+       blahlab.setAttribute('appname',bapname);
+       blahlab.setAttribute('nodeid','platform_dialog_content');  //globalContainer
+    //blahlab.setAttribute('style','position:absolute;top:-15px;left:520px');
+       blahlab.setAttribute('title','Block this application with F.B. Purity');
+    //blahlab.innerHTML='<input value="Block App" name="block" type="button" id="appblocker">';
+       blahlab.innerHTML='<span style="color:white">Block</span>';//<div id="block_app_link"><a style="color:white" rel="dialog" ajaxify="/ajax/apps/block_app.php?app_id=' +  bappid + '&type_index=0&source=about&confirm_id=block_app_link" href="#" id="js_3" class="">Block</a></div>';
+       blahlink.appendChild(blahlab);
+       // new block code, get id of cancel_click button, and click it to close dialog
+       //<div id="block_app_link"><a style="color:white" rel="dialog" ajaxify="/ajax/apps/block_app.php?app_id=182901371776451&amp;type_index=0&amp;source=about&amp;confirm_id=block_app_link" href="#" id="js_3" class="">Block</a></div>
+       
+       buttbox=document.getElementsByClassName('rightContent');
+       if(buttbox.length)
+         buttbox[0].appendChild(blahlink);
+       else {
+      buttbox2=document.getElementsByClassName('platform_dialog_buttons');
+         if(buttbox2.length)
+           buttbox2[0].appendChild(blahlink); 
+       }
+       */
+       
+       /* BEGIN NEW / OLD CODE */
+       /* ---------------------*/
+       blahlab=document.createElement('label');
+    blahlab.setAttribute('class','uiButton uiButtonConfirm uiButtonLarge');
+       blahlab.setAttribute('id','blockapplab');
+       blahlab.setAttribute('appid',bappid);
+       blahlab.setAttribute('appname',bapname);
+    blahlab.setAttribute('nodeid','platform_dialog_content');//globalContainer
+       if(!document.getElementById('platform_dialog_content'))
+         if(document.getElementsByClassName('tosPane').length)
+            document.getElementsByClassName('tosPane')[0].setAttribute('id','platform_dialog_content');
+                
+    //blahlab.setAttribute('style','position:absolute;top:-15px;left:520px');
+       blahlab.setAttribute('title','Block this application with F.B. Purity');
+    blahlab.innerHTML='<input value="Block App" name="block" type="button" id="appblocker">';
+       //document.getElementById('content').appendChild(blahlab);
+       buttbox=document.getElementsByClassName('rightContent');
+       if(buttbox.length)
+         buttbox[0].appendChild(blahlab);
+       else {
+      buttbox2=document.getElementsByClassName('platform_dialog_buttons');
+         if(buttbox2.length)
+           buttbox2[0].appendChild(blahlab); 
+       }        
+       
+       if(document.getElementById('appblocker'))
+         document.getElementById('blockapplab').addEventListener('click',blockappev,false);
+       /* -------------------*/
+    /* END NEW / OLD CODE */
+       
+       //if(document.getElementById('appblocker'))
+       //  document.getElementById('blockapplab').addEventListener('click',blockappev,false);
+       
+       //if((!location.href.match(/www\.facebook\.com\/connect\/uiserver\.php/)) && document.getElementById('block_app_link')) // hide the original dialog only if we are not in a frame on another site, otherwise we lose the block dialog too
+       //  document.getElementById('block_app_link').addEventListener('click',function() { document.getElementById('cancel_clicked').click();},false);
+         
+       // if requesting permission to send direct emails, warn user by highlighting it
+       highlightemailrequest();
+  }
+}
+
+highlightemailrequest = function() {
+  //console.log('did we get here?')
+  // if a facebook application is requesting the users email address highlight it
+  var appperms=document.getElementsByClassName('gdp_list_item');
+  if(appperms.length)
+       for(var i=0;i<appperms.length;i++) {
+         if(appperms[i].getElementsByClassName('send-email-change-link').length)
+           appperms[i].setAttribute('style', 'border:4px solid red');
+         if(appperms[i].textContent.match(/Post on my behalf/))
+               appperms[i].setAttribute('style', 'border:4px solid red');
+       }
+  var emailperms=document.getElementsByTagName('input');
+  if(emailperms.length)
+       for(i=0;i<emailperms.length;i++)
+         if(emailperms[i].getAttribute('name')=='GdpEmailBucket_grantEmailType')
+           emailperms[i].parentNode.setAttribute('style', 'border:4px solid red');
+  if(document.getElementsByClassName && document.getElementsByClassName('gdp_right_container').length && document.getElementsByClassName('gdp_right_container')[0].getElementsByClassName('mbm').length)
+       document.getElementsByClassName('gdp_right_container')[0].getElementsByClassName('mbm')[0].setAttribute('style','border:4px solid red; color:black !important'); // ( can post as you )
+  if(document.getElementsByClassName && document.getElementsByClassName('permissionsPublishActionsBadge').length)  
+       document.getElementsByClassName('permissionsPublishActionsBadge')[0].setAttribute('style','border:4px solid red');
+  if(document.getElementsByClassName('tosPane').length) {
+    var tossas=document.getElementsByClassName('tosPane')[0].getElementsByTagName('a');
+       for(i=0;i<tossas.length;i++)
+         if(tossas[i].getAttribute('href') && tossas[i].getAttribute('href').match(/about\/privacy\/your-info-on-other\#applications/)) {
+               if(!tossas[i].parentNode.textContent.match(tossas[i].getAttribute('aria-label'))) {
+                 tossas[i].parentNode.appendChild(document.createTextNode(' - ' + tossas[i].getAttribute('aria-label') ));
+                 break;
+               }
+         }
+  }
+  tossas=appperms=emailperms=null;
+  
+  // test why the button doesnt show up sometimes...
+  //console.log(location.href.match(/facebook\.com\/appcenter\//));
+  //console.log(location.href.match(document.getElementsByClassName('mll').length));
+  
+  // add prominent block app button to app center app pages
+  if(window.location.href.match(/facebook\.com\/appcenter\//) && document.getElementsByClassName('mll').length) // if theres buttons {
+    if(document.getElementById('block_app_link') && !document.getElementById('block_app_link2')) {
+         var aja=document.getElementById('block_app_link').getElementsByTagName('a')[0].getAttribute('ajaxify');
+         var ajatext=document.getElementById('block_app_link').getElementsByTagName('a')[0].textContent;
+         var ajalab=document.createElement('label');
+         ajalab.setAttribute('class','uiButton uiButtonConfirm uiButtonLarge');
+         ajalab.setAttribute('id','block_app_link2');
+         ajalab.setAttribute('title','Block this application with FB Purity');
+         ajalab.style.color='white';
+         ajalab.textContent= ajatext + ' App';
+         var ajalink=document.createElement('a');
+         ajalink.setAttribute('ajaxify',aja.replace('block_app_link','block_app_link2'));
+         ajalink.setAttribute('href','#');
+         ajalink.setAttribute('rel','dialog-post');
+         ajalink.setAttribute('role','button');
+         ajalink.appendChild(ajalab);
+      document.getElementsByClassName('mll')[0].setAttribute('class','mll');
+         document.getElementsByClassName('mll')[0].appendChild(document.createTextNode('  '));
+         document.getElementsByClassName('mll')[0].appendChild(ajalink);
+       }
+ if(window.location.href.match(/facebook\.com\/appcenter\//)) {
+   // add BA (and eventually WL) links to all app listings in app center (this part is a work in progress/not completed yet)
+   if(document.getElementsByClassName('appsListHeader').length) {
+     topspan=document.createElement('span');
+        topspan.setAttribute('style','color:red;font-weight:bold;margin-left:10px')
+     topspan.setAttribute('id','block_app_link');
+     document.getElementsByClassName('appsListHeader')[0].appendChild(topspan);
+        var appslistparent=document.getElementsByClassName('apps_list');
+        if(!appslistparent.length)
+          return;
+        var appslist = appslistparent[0].getElementsByClassName('uiListItem');
+        if(!appslist.length)
+          return;
+        for(i=0;i<appslist.length;i++) {
+       tspan=document.createElement('div');
+       tspan.setAttribute('class','uiPopover appFeedbackMenu');
+       tspan.setAttribute('style','top:18px');
+          appid=appslist[i].getAttribute('data-gt').match(/appid":"(\d+)"/)[1]; //match(/appid\&quot;:\&quot;(\d+)\&quot;/)[1]
+          tspan.innerHTML='<a title="Block Application" rel="dialog-post" ajaxify="/ajax/apps/block_app.php?app_id=' + appid + '&amp;type_index=0&amp;source=about&amp;confirm_id=block_app_link" href="#" role="button">BA</a>';
+          appslist[i].getElementsByClassName('appName')[0].appendChild(tspan);
+        }
+   
+   }
+ }
+ //<div style="top:15px"></div>
+
+} // END highlightemailrequest function
+
+/*BEGIN Check if this page is an authorise app page so we can add a block button
+Example URLS https://www.facebook.com/connect/uiserver.php?app_id=216694208368074
+Scenarios: oauth page / request permissions page / app page
+*/
+if(window.location.href.match(/\/dialog\/oauth/) || window.location.href.match(/dialog\/permissions\.request/) || window.location.href.match(/\/connect\/uiserver\.php\?/) || window.location.href.match(/\/dialog\/plugin\.perms/))
+  if(!window.navigator.userAgent.match(/Opera\//))
+    addblockbuttontopermreq();
+  else
+     setTimeout(addblockbuttontopermreq,2000); // pause because opera runs script b4 page has finished loading
+
+if(window.location.href.match(/\/appcenter\//))
+  setTimeout(highlightemailrequest,2500);
+/* END Check if this page is an authorise app page so we can add a block button */
+
+/* BEGIN add a "block application" link at the bottom left hand corner of all application pages */
+function addblockapplinktoapppage() {
+if (window.location.href.match(/\:\/\/apps\./)) {
+  if(document.getElementById('footerContainer')) {
+    var footzer=document.getElementById('footerContainer');
+       var footytxt='footerContainer';
+  }
+  else {
+    var footzer=document.getElementById('pagelet_canvas_footer_content');
+       var footytxt='pagelet_canvas_footer_content';
+  }
+  if(footzer) {
+    var fas=footzer.getElementsByTagName('a');
+    for(var i=0;i<fas.length;i++)
+      if(fas[i].getAttribute('ajaxify') && fas[i].getAttribute('ajaxify').match(/\/ajax\/report\.php\?content_type=17/)) {
+           zappid=fas[i].getAttribute('ajaxify').match(/cid=(\d*)/)[1];
+        zapplink=document.createElement('a');
+           zapplink.textContent='Block Application ';
+           zapptitle=document.getElementById(footytxt).getElementsByTagName('span')[0].textContent;
+           zapplink.setAttribute('appname',zapptitle);
+           zapplink.setAttribute('appid',zappid);
+           zapplink.setAttribute('nodeid','pagelet_canvas_content');
+           zapplink.setAttribute('id','zapplink');
+               zapplink.setAttribute('title','Block this application with F.B. Purity');
+           zparent=document.getElementById(footytxt).getElementsByClassName('fsm')[0];
+           zparent.insertBefore(zapplink,zparent.firstChild);
+           document.getElementById('zapplink').addEventListener('click',blockappev,false);
+           break;
+         }
+  }
+}
+}
+window.setTimeout(addblockapplinktoapppage,3500);
+/* END Add a block application link at bottom left of all application pages */
+
+function toggletimeline(ev) {
+  var TLBUTT=document.getElementById('TLJewel');
+  if (typeof(fbpoptsobj.timelineonecol)=='undefined')
+    fbpoptsobj.timelineonecol=true;
+  else
+    if(fbpoptsobj.timelineonecol==true)
+         fbpoptsobj.timelineonecol=false;
+       else
+         fbpoptsobj.timelineonecol=true;
+  if(fbpoptsobj.timelineonecol==false) {
+    document.getElementById('FBTLX').style.display='none';
+       var tdotxt='F.B. Purity - Normal Facebook Timeline Layout Restored';
+       TLBUTT.setAttribute('title','');
+  }
+  else {
+    document.getElementById('FBTLX').style.display='block';
+       var tdotxt='F.B. Purity - Single Column Timeline<br/>Layout Enabled';
+       TLBUTT.setAttribute('title','');
+  }
+  if(!document.getElementById('tdotxt')) {
+    tdo=document.createElement('div');
+    tdo.setAttribute('id','tdotxt');
+    tdo.setAttribute('style','position:absolute;top:25px;left:29px;font-size:15px;width:235px;background-color:white;border:2px solid;z-index:30'); //rgba(255,255,255,0.5)
+       document.getElementById('TLJewel').appendChild(tdo);
+  }
+  else 
+    tdo=document.getElementById('tdotxt');
+       
+  document.getElementById('tdotxt').style.display='block';
+  tdo.innerHTML='<a title="FB Purity Website" alt="FB Purity Website" href="http://fbpurity.com"><img style="border:0px;float:left;margin-right:10px" src="https://sites.google.com/site/st333v/fbp-1/fbp-ghost-lid-icon-48x48.jpg"></a> ' + tdotxt;
+  window.setTimeout(function(){document.getElementById('tdotxt').style.display='none';TLBUTT.setAttribute('title','F.B. Purity: Single Column Timeline Layout');},1700)
+
+  //save to prefs obj to localstorage
+  fbpsavevalue('fbpoptsjson-' + currentuserid, JSON.stringify(fbpoptsobj));
+  //window.location.reload();
+  fbptimelinerestyle(fbpoptsobj.timelineonecol);
+} // END toggletimeline function
+
+function tlbuttinit() {
+  // BEGIN add TL (single column timeline) button next to search box (now works on graph search bar too)
+  if(fbpoptsobj.timelineonecol==true)
+    var disx='block';
+  else
+    var disx='none';
+  var TLBUTTHTML='<a id="TLINK" href="javascript:;" class="jewelButton" style="top:3px;max-height:25px;">'+
+    '<div id="FBTL" style="position:absolute;top:0px;left:0px;background:transparent;font-size:22px !important;font-weight:bold;color:green">TL</div>'+
+    '<div id="FBTLX" style="' + 'display:' + disx + '; position:absolute;top:0px;left:6px;background:transparent;font-size:22px !important;color:#E80000;font-weight:bold">X</div></a>';
+  TLBUTT=document.createElement('div');
+  TLBUTT.setAttribute('class','lfloat fbJewel');
+  TLBUTT.setAttribute('id','TLJewel');
+  TLBUTT.setAttribute('title','F.B. Purity: Single Column Timeline Layout');
+  if(document.querySelector('body.hasSmurfbar'))
+    TLBUTT.setAttribute('style','top:0px;margin-left:3px;vertical-align:middle;font-size:20px;font-color:#173a85;font-weight:bold; left: 614px; top: -20px !important; '); // 
+  else
+    TLBUTT.setAttribute('style','top:0px;margin-left:3px;vertical-align:middle;font-size:20px;font-color:#173a85;font-weight:bold');
+
+  TLBUTT.innerHTML=TLBUTTHTML;
+  window.setTimeout( function(){
+    var datd=document.getElementById('navSearch');
+    if(!datd)
+      datd=document.querySelector('div[role="search"]');
+    if(datd && (!document.getElementById('TLJewel'))) {
+      datd.parentNode.insertBefore(TLBUTT,datd.nextSibling);
+      document.getElementById('TLINK').addEventListener('click',toggletimeline,false);
+    }
+  },0);
+  // END add TL button next to search box
+}
+
+function resetclasses () {
+  var fbpn,a;
+  var arrResetClasses=['fbpnormal','fbpblockedx','fbpblocked'];
+  for(a in arrResetClasses) {
+    //console.log(arrResetClasses[a]);
+    fbpn=document.getElementsByClassName(arrResetClasses[a]); 
+       for(i=fbpn.length;i>0;i--) {
+         //console.log(i);
+         fbpn[i-1].setAttribute('class',fbpn[i-1].getAttribute('class').replace(arrResetClasses[a],''));
+       }
+       //console.log("fbpoptsobj.filterappmessages=" + fbpoptsobj.filterappmessages + " current arr length=" + document.getElementsByClassName(arrResetClasses[a]).length);
+  }
+}
+
+function fbpurify() {
+  if(debug)
+    console.trace();
+  
+  var crappyappmsgcounter=0;
+  var xtramsgcounter=0;
+  fbpstyle.setAttribute('id','fbpstyler');
+  fbpstyle.setAttribute('type','text/css');
+  fbpStyleApps= ".fbpblocked {border-style: dashed !important; border-width:1px !important; border-top: 0px !important; border-color: pink !important; display:block !important} .fbpblockedx {display:none !important} .fbpnormal {display:none !important}";
+  if(document.querySelector('body.hasSmurfbar'))
+    fbpStyleExtras= ".fbpblocked {display:none !important} .fbpblockedx {border-style: dashed !important; border-width:1px !important; border-top: 0px !important; border-color: blue !important; display:block !important} .fbpnormal {display:none !important}";
+  else
+    fbpStyleExtras= ".fbpblocked {display:none !important} .fbpblockedx {border-style: dashed !important; border-width:1px !important; border-top: 0px !important; border-color: lightblue !important; display:block !important} .fbpnormal {display:none !important}";
+  fbpStyleNormal= ".fbpblocked {display:none !important} .fbpblockedx {display:none !important} .fbpnormal {display:block !important}";  
+  fbpstyle.textContent=fbpStyleNormal;
+  
+  if(document.getElementsByTagName('head')) {
+    document.getElementsByTagName('head')[0].appendChild(fbpstyle);
+  }
+  document.addEventListener("DOMNodeInserted", fpInsertedNodeDomHandler, false);
+  
+  if(document.getElementById('pagelet_home_stream') || document.getElementById('pagelet_litestand_section') || document.getElementById('stream_pagelet'))
+    cleartheshizzle(document);
+} // END fbpurify function
+
+
+var waitfordom1=setInterval(function(){
+    if(document.getElementById('globalContainer')) {
+      clearInterval(waitfordom1);
+         if(window.navigator.userAgent.match(/Opera/))
+           fbpgetprefs(); // grab user prefs if available if not populate them with defaults
+      //bringbacknormalcommenting();
+         window.setTimeout(bringbacknormalcommenting,2000); // prefs werent being read in before running this, so i added a short delay
+         window.setTimeout(addexternallinkfix,2000);
+      //addexternallinkfix();
+         tlbuttinit(); // initialise the timeline single column button
+    }
+  }, 500);
+  
+// only run if DOM has loaded
+finalstage=function () {
+// we should check to see if fbpurify is already running...
+
+if(document.getElementById('pagelet_home_stream') || document.getElementById('pagelet_litestand_section') || document.getElementById('stream_pagelet'))  { // || document.getElementById('pagelet_group_mall') || document.getElementById('timelineNavContent') // || document.getElementById('profile_minifeed')
+  fbpurify();
+}
+else {
+  var waitfordom=setInterval(function(){
+    if(document.getElementById('pagelet_home_stream') || document.getElementById('pagelet_litestand_section') || document.getElementById('stream_pagelet')) {  // || document.getElementById('pagelet_group_mall') || document.getElementById('timelineNavContent') // || document.getElementById('profile_minifeed') 
+      clearInterval(waitfordom);
+      fbpurify();
+    }
+  }, 500);
+}
+} // end finalstage function;
+
+if(!window.navigator.userAgent.match(/Opera/))
+  fbpgetprefs(); // opera loads the script before the page has loaded, so we need to delay a bit for opera, and load prefs in the waitfordom1 function instead.
+
+})();
\ No newline at end of file
diff --git a/dwb/greasemonkey/ponyhoof.user.js b/dwb/greasemonkey/ponyhoof.user.js
new file mode 100644 (file)
index 0000000..c71c00b
--- /dev/null
@@ -0,0 +1,9887 @@
+// ==UserScript==
+// @name        Ponyhoof
+// @namespace   http://www.facebook.com/ponyhoof
+// @run-at      document-start
+// @version     1.631
+// @installURL  https://hoof.little.my/files/ponyhoof.user.js
+// @updateURL   https://hoof.little.my/files/ponyhoof.meta.js
+// @icon        https://hoof.little.my/files/app32.png
+// @icon64      https://hoof.little.my/files/icon64.png
+// @description        Ponify Facebook and make it 20% cooler!
+// @author      The Ponyhoof Team <pony@little.my> http://ponyhoof.little.my
+// @developer   Ng Yik Phang
+// @contributor James
+// @contributor http://ponyhoof.little.my/credits
+// @homepage    http://ponyhoof.little.my
+// @supportURL  http://www.facebook.com/Ponyhoof
+// @contributionURL http://ponyhoof.little.my/donate
+// @include http://*.facebook.com/*
+// @include https://*.facebook.com/*
+// @include http://*.little.my/*
+// @include https://*.little.my/*
+// @match http://*.facebook.com/*
+// @match https://*.facebook.com/*
+// @match http://*.little.my/*
+// @match https://*.little.my/*
+// @exclude http://*.facebook.com/ai.php*
+// @exclude http://*.facebook.com/l.php*
+// @exclude http://*.facebook.com/ajax/*
+// @exclude http://*.channel.facebook.com/*
+// @exclude http://static.*.facebook.com/*
+// @exclude http://graph.facebook.com/*
+// @exclude http://0.facebook.com/*
+// @exclude https://*.facebook.com/ai.php*
+// @exclude https://*.facebook.com/l.php*
+// @exclude https://*.facebook.com/ajax/*
+// @exclude https://*.channel.facebook.com/*
+// @exclude https://s-static.*.facebook.com/*
+// @exclude https://graph.facebook.com/*
+// @exclude https://0.facebook.com/*
+// @exclude https://paste.little.my/*
+// ==/UserScript==
+
+/*******************************************************************************
+ * Please visit http://jointheherd.lttle.my for the official install!
+ *******************************************************************************/
+
+
+(function() {
+       if (window.location.hostname.indexOf('facebook.com') == -1 && window.location.hostname.indexOf('little.my') == -1) {
+               return;
+       }
+       
+       /**
+ * Hoof Framework
+ * 
+ * @author ngyikp (http://www.facebook.com/ngyikp)
+ */
+var d = document, w = window;
+var ELEMENT_NODE = 1;
+var TEXT_NODE = 3;
+
+var SIG = '[Hoof Framework]';
+var FRIENDLYNAME = 'Hoof Framework';
+var CANLOG = true;
+
+var userSettings = {};
+
+var USERAGENT = w.navigator.userAgent.toLowerCase();
+var ISOPERABLINK = /OPR\//.test(w.navigator.userAgent);
+var ISOPERA = !ISOPERABLINK && (typeof opera != 'undefined' || /opera/i.test(USERAGENT));
+var ISCHROME = !ISOPERABLINK && (typeof chrome != 'undefined' || /chrome/i.test(USERAGENT));
+var ISFIREFOX = /firefox/i.test(USERAGENT);
+var ISSAFARI = !ISOPERABLINK && !ISCHROME && /safari/i.test(USERAGENT);
+var ISMOBILE = /iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(USERAGENT);
+
+// R.I.P. unsafeWindow in Chrome 27+ http://crbug.com/222652
+if (typeof unsafeWindow == 'undefined') {
+       var USW = w;
+} else {
+       var USW = unsafeWindow;
+}
+
+function log(msg) {
+       if (CANLOG) {
+               if (typeof console !== 'undefined' && console.log) {
+                       console.log(SIG + ' ' + msg);
+               }
+       }
+}
+
+function dir(msg) {
+       if (CANLOG) {
+               if (typeof console !== 'undefined' && console.dir) {
+                       console.dir(SIG + ' ' + msg);
+               }
+       }
+}
+
+function debug(msg) {
+       if (CANLOG) {
+               if (typeof console !== 'undefined') {
+                       if (console.debug) {
+                               console.debug(SIG + ' ' + msg);
+                       } else if (console.log) {
+                               console.log(SIG + ' ' + msg);
+                       }
+               }
+       }
+}
+
+function info(msg) {
+       if (CANLOG) {
+               if (typeof console !== 'undefined') {
+                       if (console.info) {
+                               console.info(SIG + ' ' + msg);
+                       } else if (console.log) {
+                               console.log(SIG + ' ' + msg);
+                       }
+               }
+       }
+}
+
+function warn(msg) {
+       if (CANLOG) {
+               if (typeof console !== 'undefined') {
+                       if (console.warn) {
+                               console.warn(SIG + ' ' + msg);
+                       } else if (console.log) {
+                               console.log(SIG + ' ' + msg);
+                       }
+               }
+       }
+}
+
+function error(msg) {
+       if (CANLOG) {
+               if (typeof console !== 'undefined') {
+                       if (console.error) {
+                               console.error(SIG + ' ' + msg);
+                       } else if (console.log) {
+                               console.log(SIG + ' ' + msg);
+                       }
+               }
+       }
+}
+
+function trace() {
+       if (CANLOG) {
+               if (typeof console !== 'undefined' && console.trace) {
+                       console.trace();
+               }
+       }
+}
+
+function $(id) {
+       return d.getElementById(id);
+}
+
+function randNum(min, max) {
+       return min + Math.floor(Math.random() * (max - min + 1));
+}
+
+function hasClass(ele, c) {
+       if (!ele) {
+               return false;
+       }
+       if (ele.classList) {
+               return ele.classList.contains(c);
+       }
+
+       var regex = new RegExp("(^|\\s)"+c+"(\\s|$)");
+       if (ele.className) { // element node
+               return (ele.className && regex.test(ele.className));
+       } else { // string
+               return (ele && regex.test(ele));
+       }
+}
+
+function addClass(ele, c) {
+       if (ele.classList) {
+               ele.classList.add(c);
+       } else if (!hasClass(ele, c)) {
+               ele.className += ' '+c;
+       }
+}
+
+function removeClass(ele, c) {
+       if (ele.classList) {
+               ele.classList.remove(c);
+       } else {
+               ele.className = ele.className.replace(new RegExp('(^|\\s)'+c+'(?:\\s|$)','g'),'$1').replace(/\s+/g,' ').replace(/^\s*|\s*$/g,'');
+       }
+}
+
+function toggleClass(ele, c) {
+       if (hasClass(ele, c)) {
+               removeClass(ele, c);
+       } else {
+               ele.className += ' ' + c;
+       }
+}
+
+function clickLink(el) {
+       if (!el) {
+               return false;
+       }
+       
+       try {
+               var evt = d.createEvent('MouseEvents');
+               evt.initMouseEvent('click', true, true, w, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
+               el.dispatchEvent(evt);
+               return true;
+       } catch (e) {
+               return false;
+       }
+}
+
+function cookie(n) {
+       try {
+               return unescape(d.cookie.match('(^|;)?'+n+'=([^;]*)(;|$)')[2]);
+       } catch (e) {
+               return null;
+       }
+}
+
+function injectManualStyle(css, id) {
+       if ($('ponyhoof_style_'+id)) {
+               return $('ponyhoof_style_'+id);
+       }
+       
+       var n = d.createElement('style');
+       n.type = 'text/css';
+       if (id) {
+               n.id = 'ponyhoof_style_'+id;
+       }
+       n.textContent = '/* '+SIG+' */'+css;
+
+       if (d.head) {
+               d.head.appendChild(n);
+       } else if (d.body) {
+               d.body.appendChild(n);
+       } else {
+               d.documentElement.appendChild(n);
+       }
+       
+       return n;
+}
+
+function fadeOut(ele, callback) {
+       addClass(ele, 'ponyhoof_fadeout');
+       
+       w.setTimeout(function() {
+               ele.style.display = 'none';
+               
+               if (callback) {
+                       callback(ele);
+               }
+       }, 250);
+}
+
+function getFbDomain() {
+       if (w.location.hostname == 'beta.facebook.com') {
+               return w.location.hostname;
+       }
+       return 'www.facebook.com';
+}
+
+function onPageReady(callback) {
+       var _loop = function() {
+               if (/loaded|complete/.test(d.readyState)) {
+                       callback();
+               } else {
+                       w.setTimeout(_loop, 100);
+               }
+       };
+       _loop();
+}
+
+var loopClassName = function(name, func) {
+       var l = d.getElementsByClassName(name);
+       if (l) {
+               for (var i = 0, len = l.length; i < len; i++) {
+                       func(l[i]);
+               }
+       }
+};
+
+function $$(parent, query, func) {
+       if (!parent) {
+               return;
+       }
+       var l = parent.querySelectorAll(query);
+       if (l.length) {
+               for (var i = 0, len = l.length; i < len; i++) {
+                       func(l[i]);
+               }
+       }
+}
+
+// Hacky code adapted from http://www.javascripter.net/faq/browsern.htm
+function getBrowserVersion() {
+       var ua = w.navigator.userAgent;
+       var fullVersion  = ''+parseFloat(w.navigator.appVersion); 
+       var majorVersion = parseInt(w.navigator.appVersion, 10);
+       var nameOffset, offset, ix;
+
+       if (ua.indexOf('Opera') != -1) {
+               // In Opera, the true version is after 'Opera' or after 'Version'
+               offset = ua.indexOf('Opera');
+               fullVersion = ua.substring(offset + 6);
+
+               if (ua.indexOf('Version') != -1) {
+                       offset = ua.indexOf('Version');
+                       fullVersion = ua.substring(offset + 8);
+               }
+       } else if (ua.indexOf('OPR/') != -1) {
+               offset = ua.indexOf('OPR/');
+               fullVersion = ua.substring(offset + 4);
+       } else if (ua.indexOf('MSIE') != -1) {
+               // In MSIE, the true version is after 'MSIE' in userAgent
+               offset = ua.indexOf('MSIE');
+               fullVersion = ua.substring(offset + 5);
+       } else if (ua.indexOf('Chrome') != -1) {
+               // In Chrome, the true version is after 'Chrome'
+               offset = ua.indexOf('Chrome');
+               fullVersion = ua.substring(offset + 7);
+       } else if (ua.indexOf('Safari') != -1) {
+               // In Safari, the true version is after 'Safari' or after 'Version' 
+               offset = ua.indexOf('Safari');
+               fullVersion = ua.substring(offset + 7);
+
+               if (ua.indexOf('Version') != -1) {
+                       offset = ua.indexOf('Version');
+                       fullVersion = ua.substring(offset + 8);
+               }
+       } else if (ua.indexOf('Firefox') != -1) {
+               // In Firefox, the true version is after 'Firefox' 
+               offset = ua.indexOf('Firefox');
+               fullVersion = ua.substring(offset + 8);
+       } else {
+               throw "Unsupported browser";
+       }
+
+       if ((ix = fullVersion.indexOf(';')) != -1) {
+               fullVersion = fullVersion.substring(0, ix);
+       }
+       if ((ix = fullVersion.indexOf(' ')) != -1) {
+               fullVersion = fullVersion.substring(0, ix);
+       }
+
+       majorVersion = parseInt(''+fullVersion,10);
+       if (isNaN(majorVersion)) {
+               fullVersion = ''+parseFloat(w.navigator.appVersion); 
+               majorVersion = parseInt(w.navigator.appVersion,10);
+       }
+
+       return {
+                major: majorVersion
+               ,full: fullVersion
+       };
+}
+
+// http://wiki.greasespot.net/Content_Script_Injection
+var contentEval = function(source, arg) {
+       var arg = arg || {};
+       if (typeof source === 'function') {
+               source = '(' + source + ')(' + JSON.stringify(arg) + ');'
+       }
+
+       var script = d.createElement('script');
+       script.textContent = source;
+       d.documentElement.appendChild(script);
+       d.documentElement.removeChild(script);
+};
+
+var supportsRange = function() {
+       var i = d.createElement('input');
+       i.setAttribute('type', 'range');
+       return i.type !== 'text';
+};
+
+var supportsCssTransition = function() {
+       var s = d.createElement('div').style;
+       return ('transition' in s || 'WebkitTransition' in s || 'MozTransition' in s || 'msTransition' in s || 'OTransition' in s);
+};
+
+// Menu
+var MENUS = {};
+var Menu = function(id, p) {
+       var k = this;
+       
+       k.id = id;
+       MENUS['ponyhoof_menu_'+k.id] = k;
+       k.menu = null; // outer wrap
+       k.selectorMenu = null; // .uiMenu.uiSelectorMenu
+       k.menuInner = null; // .uiMenuInner
+       k.content = null; // .uiScrollableAreaContent
+       k.button = null;
+       k.wrap = null; // ponyhoof_menu_wrap, used to separate button and menu
+
+       k.menuSearch = null; // .ponyhoof_menu_search
+       k.menuSearchInput = null;
+       k.menuSearchNoResults = null;
+       k.focusStealer = null;
+
+       k.hasScrollableArea = false;
+       k.scrollableAreaDiv = null; // .uiScrollableArea
+       k.scrollableArea = null; // FB ScrollableArea class
+
+       k.p = p;
+       k.afterClose = function() {};
+
+       k.canSearch = true;
+       k.alwaysOverflow = false;
+       k.rightFaced = false;
+       k.buttonTextClipped = 0;
+
+       k.createButton = function(startText) {
+               if (!startText) {
+                       startText = '';
+               }
+               
+               var buttonText = d.createElement('span');
+               buttonText.className = 'uiButtonText';
+               buttonText.innerHTML = startText;
+
+               k.button = d.createElement('a');
+               k.button.href = '#';
+               k.button.className = 'uiButton ponyhoof_button_menu';
+               k.button.setAttribute('role', 'button');
+               k.button.setAttribute('aria-haspopup', 'true');
+               if (k.buttonTextClipped) {
+                       k.button.className += ' ponyhoof_button_clipped';
+                       buttonText.style.maxWidth = k.buttonTextClipped+'px';
+               }
+               k.button.appendChild(buttonText);
+
+               k.wrap = d.createElement('div');
+               k.wrap.className = 'ponyhoof_menu_wrap';
+               if (k.rightFaced) {
+                       k.wrap.className += ' uiSelectorRight';
+               }
+               k.wrap.appendChild(k.button);
+               k.p.appendChild(k.wrap);
+
+               return k.button;
+       }
+       
+       k.createMenu = function() {
+               if ($('ponyhoof_menu_'+k.id)) {
+                       k.menu = $('ponyhoof_menu_'+k.id);
+                       k.menuInner = k.menu.getElementsByClassName('uiMenuInner')[0];
+                       return k.menu;
+               }
+               
+               k.injectStyle();
+               
+               k.menu = d.createElement('div');
+               k.menu.className = 'ponyhoof_menu uiSelectorMenuWrapper';
+               k.menu.id = 'ponyhoof_menu_'+k.id;
+               k.menu.setAttribute('role', 'menu');
+               //k.menu.style.display = 'none';
+               k.menu.addEventListener('click', function(e) {
+                       e.stopPropagation();
+                       return false;
+               }, false);
+               k.wrap.appendChild(k.menu);
+               
+               k.selectorMenu = d.createElement('div');
+               k.selectorMenu.className = 'uiMenu uiSelectorMenu';
+               k.menu.appendChild(k.selectorMenu);
+               
+               k.menuInner = d.createElement('div');
+               k.menuInner.className = 'uiMenuInner';
+               k.selectorMenu.appendChild(k.menuInner);
+
+               k.content = d.createElement('div');
+               k.content.className = 'uiScrollableAreaContent';
+               k.menuInner.appendChild(k.content);
+               
+               if (k.canSearch) {
+                       k.menuSearch = d.createElement('div');
+                       k.menuSearch.className = 'ponyhoof_menu_search';
+                       k.content.appendChild(k.menuSearch);
+
+                       k.menuSearchInput = d.createElement('input');
+                       k.menuSearchInput.type = 'text';
+                       k.menuSearchInput.className = 'inputtext';
+                       k.menuSearchInput.placeholder = "Search";
+                       k.menuSearch.appendChild(k.menuSearchInput);
+
+                       k.menuSearchNoResults = d.createElement('div');
+                       k.menuSearchNoResults.className = 'ponyhoof_menu_search_noResults';
+                       k.menuSearchNoResults.textContent = "No results";
+                       k.menuSearch.appendChild(k.menuSearchNoResults);
+
+                       k.menuSearchInput.addEventListener('keydown', k.searchEscapeKey, false);
+                       k.menuSearchInput.addEventListener('input', k.performSearch, false);
+
+                       k.focusStealer = d.createElement('input');
+                       k.focusStealer.type = 'text';
+                       k.focusStealer.setAttribute('aria-hidden', 'true');
+                       k.focusStealer.style.position = 'absolute';
+                       k.focusStealer.style.top = '-9999px';
+                       k.focusStealer.style.left = '-9999px';
+                       k.focusStealer.addEventListener('focus', k.focusStealerFocused, false);
+                       k.selectorMenu.appendChild(k.focusStealer);
+               }
+
+               return k.menu;
+       };
+       
+       k.attachButton = function() {
+               k.button.addEventListener('click', function(e) {
+                       k.toggle();
+                       e.stopPropagation();
+                       e.preventDefault();
+               }, false);
+       };
+
+       k.changeButtonText = function(text) {
+               k.button.getElementsByClassName('uiButtonText')[0].innerHTML = text;
+               k.button.setAttribute('data-ponyhoof-button-orig', text);
+               k.button.setAttribute('data-ponyhoof-button-text', text);
+
+               if (k.buttonTextClipped) {
+                       k.button.title = text;
+               }
+       };
+       
+       k.createSeperator = function() {
+               var sep = d.createElement('div');
+               sep.className = 'uiMenuSeparator';
+               k.content.appendChild(sep);
+       };
+       
+       k.createMenuItem = function(param) {
+               var menuItem = new MenuItem(k);
+               menuItem._create(param);
+               
+               k.content.appendChild(menuItem.menuItem);
+               
+               return menuItem;
+       };
+       
+       k.injectStyle = function() {
+               var css = '';
+               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;}';
+               
+               css += 'html .ponyhoof_dialog .ponyhoof_button_menu {background-position:right 0;padding-right:23px;}';
+               css += 'html .ponyhoof_button_menu:active {background-position:right -98px;}';
+               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;}';
+               css += 'html .openToggler .ponyhoof_button_menu .uiButtonText {color:#fff;}';
+               
+               css += '.ponyhoof_menu_label {padding:7px 4px 0 0;}';
+               css += '.ponyhoof_menu_label, .ponyhoof_menu_withlabel .ponyhoof_menu_wrap {display:inline-block;}';
+               css += '.ponyhoof_menu_withlabel {margin-bottom:8px;}';
+               css += '.ponyhoof_menu_withlabel + .ponyhoof_menu_withlabel {margin-top:-8px;}';
+               css += '.ponyhoof_menu_withlabel .ponyhoof_button_menu {margin-top:-3px;}';
+               css += '.ponyhoof_menu_labelbreak .ponyhoof_menu_label {display:block;padding-bottom:7px;}';
+
+               css += '.ponyhoof_menu_wrap {position:relative;}';
+               css += 'html .ponyhoof_menu {z-index:1999;display:none;min-width:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;}';
+               css += '.ponyhoof_menu_wrap.openToggler .ponyhoof_menu {display:block;}';
+               css += '.ponyhoof_menu_wrap + .uiButton {margin:4px 0 0 4px;}';
+               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;}';
+               css += '.ponyhoof_menu .uiMenu.overflow {resize:vertical;height:200px;min-height:200px;}';
+               css += '.ponyhoof_menu_wrap.uiSelectorRight .uiMenu {left:auto;right:0;}';
+               css += '.ponyhoof_menu .ponyhoof_menu_search {padding:0 3px;margin-bottom:4px;}';
+               css += '.ponyhoof_menu .ponyhoof_menu_search input {width:100%;resize:none;}';
+               css += '.ponyhoof_menu .ponyhoof_menu_search_noResults {display:none;color:#999;text-align:center;margin-top:7px;width:100px;}';
+               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;}';
+               css += '.ponyhoof_menu .ponyhoof_menuitem {color:#111;}';
+               css += '.ponyhoof_menuitem:hover, .ponyhoof_menuitem:active, .ponyhoof_menuitem:focus {background-color:#6d84b4;border-color:#3b5998;color:#fff;text-decoration:none;}';
+               css += '.ponyhoof_menuitem_checked {background-position:0 -146px;font-weight:bold;}';
+               css += '.ponyhoof_menuitem_checked:hover, .ponyhoof_menuitem_checked:active, .ponyhoof_menuitem_checked:focus {background-position:0 -206px;}';
+               css += '.ponyhoof_menuitem_span {white-space:nowrap;text-overflow:ellipsis;display:inline-block;overflow:hidden;padding-right:16px;max-width:400px;}';
+
+               css += '.ponyhoof_button_clipped .uiButtonText {text-overflow:ellipsis;overflow:hidden;}';
+
+               injectManualStyle(css, 'menu');
+       };
+       
+       k.open = function() {
+               k.closeAllMenus();
+
+               addClass(k.wrap, 'openToggler');
+
+               if (!hasClass(k.menuInner.parentNode, 'overflow') && (k.menuInner.parentNode.offsetHeight >= 224 || k.alwaysOverflow)) {
+                       addClass(k.menuInner.parentNode, 'overflow');
+               }
+
+               if (k.canSearch) {
+                       var scrollTop = k.selectorMenu.scrollTop;
+                       k.menuSearchInput.focus();
+                       k.menuSearchInput.select();
+
+                       k.selectorMenu.scrollTop = scrollTop;
+               }
+
+               d.body.addEventListener('keydown', k.documentEscapeKey, false);
+               d.body.addEventListener('click', k.documentClick, false);
+       };
+       
+       k.close = function() {
+               if (hasClass(k.wrap, 'openToggler')) {
+                       removeClass(k.wrap, 'openToggler');
+                       d.body.removeEventListener('keydown', k.documentEscapeKey, false);
+                       d.body.removeEventListener('click', k.documentClick, false);
+
+                       k.afterClose();
+               }
+       };
+
+       k.closeAllMenus = function() {
+               for (var menu in MENUS) {
+                       if (MENUS.hasOwnProperty(menu)) {
+                               MENUS[menu].close();
+                       }
+               }
+       };
+       
+       k.toggle = function() {
+               if (hasClass(k.wrap, 'openToggler')) {
+                       k.close();
+               } else {
+                       k.open();
+               }
+       };
+       
+       k.changeChecked = function(menuItem) {
+               var already = k.menu.getElementsByClassName('ponyhoof_menuitem_checked');
+               if (already.length) {
+                       removeClass(already[0], 'ponyhoof_menuitem_checked');
+               }
+               addClass(menuItem.menuItem, 'ponyhoof_menuitem_checked');
+       };
+
+       k.performSearch = function() {
+               var val = k.menuSearchInput.value;
+               var regex = new RegExp(val, 'i');
+
+               var count = 0;
+               $$(k.menu, '.ponyhoof_menuitem', function(menuitem) {
+                       if (val == '') {
+                               menuitem.style.display = '';
+                               return;
+                       }
+
+                       if (!hasClass(menuitem, 'unsearchable')) {
+                               menuitem.style.display = 'none';
+
+                               var compare = menuitem.textContent;
+                               if (menuitem.getAttribute('data-ponyhoof-menu-searchAlternate')) {
+                                       compare = menuitem.getAttribute('data-ponyhoof-menu-searchAlternate');
+                               }
+
+                               if (regex.test(compare)) {
+                                       menuitem.style.display = 'block';
+                                       count += 1;
+                               }
+                       } else {
+                               menuitem.style.display = 'none';
+                       }
+               });
+
+               $$(k.menu, '.ponyhoof_menu_search_noResults', function(ele) {
+                       if (val) {
+                               if (!count) {
+                                       ele.style.display = 'block';
+                               } else {
+                                       ele.style.display = 'none';
+                               }
+                       } else {
+                               ele.style.display = 'none';
+                       }
+               });
+
+               $$(k.menu, '.uiMenuSeparator', function(menuitem) {
+                       if (val == '') {
+                               menuitem.style.display = '';
+                               return;
+                       }
+
+                       menuitem.style.display = 'none';
+               });
+
+               if (k.hasScrollableArea) {
+                       k.scrollableArea.poke();
+               }
+       };
+
+       k.searchEscapeKey = function(e) {
+               if (e.which == 27) {
+                       if (k.menuSearchInput.value != '') {
+                               k.menuSearchInput.value = '';
+                               k.performSearch();
+                       } else {
+                               k.close();
+                               if (k.button) {
+                                       k.button.focus();
+                               }
+                       }
+                       e.stopPropagation();
+                       e.cancelBubble = true;
+               }
+       };
+
+       k.documentEscapeKey = function(e) {
+               if (e.which == 27 && hasClass(k.wrap, 'openToggler')) { // esc
+                       k.close();
+                       e.stopPropagation();
+                       e.cancelBubble = true;
+
+                       if (k.button) {
+                               k.button.focus();
+                       }
+               }
+       };
+
+       k.documentClick = function(e) {
+               k.close();
+               e.stopPropagation();
+               e.preventDefault();
+       };
+
+       k.focusStealerFocused = function(e) {
+               if (k.canSearch) {
+                       k.menuSearchInput.focus();
+               }
+       };
+};
+
+var MenuItem = function(menu) {
+       var k = this;
+       
+       k.menuItem = null;
+       k.menu = menu;
+       k.onclick = null;
+
+       k._create = function(param) {
+               k.menuItem = d.createElement('a');
+               k.menuItem.href = '#';
+               k.menuItem.className = 'ponyhoof_menuitem';
+               k.menuItem.setAttribute('role', 'menuitem');
+               
+               if (param.check) {
+                       k.menuItem.className += ' ponyhoof_menuitem_checked';
+               }
+               
+               if (param.data) {
+                       k.menuItem.setAttribute('data-ponyhoof-menu-data', param.data);
+               }
+               
+               if (param.title) {
+                       k.menuItem.setAttribute('aria-label', param.title);
+                       k.menuItem.setAttribute('data-hover', 'tooltip');
+               }
+               
+               if (param.unsearchable) {
+                       k.menuItem.className += ' unsearchable';
+               }
+               
+               if (param.searchAlternate) {
+                       k.menuItem.setAttribute('data-ponyhoof-menu-searchAlternate', param.searchAlternate);
+               }
+               
+               if (param.extraClass) {
+                       k.menuItem.className += param.extraClass;
+               }
+               
+               k.menuItem.innerHTML = '<span class="ponyhoof_menuitem_span">'+param.html+'</span>';
+               
+               if (param.onclick) {
+                       k.onclick = param.onclick;
+               }
+               k.menuItem.addEventListener('click', function(e) {
+                       e.stopPropagation();
+                       if (k.onclick) {
+                               k.onclick(k, k.menu);
+                       }
+                       
+                       return false;
+               }, false);
+               k.menuItem.addEventListener('dragstart', function() {
+                       return false;
+               }, false);
+               
+               return k.menuItem;
+       };
+       
+       k.getText = function() {
+               return k.menuItem.getElementsByClassName('ponyhoof_menuitem_span')[0].innerHTML;
+       };
+};
+
+// Dialog
+var DIALOGS = {};
+var DIALOGCOUNT = 400;
+var Dialog = function(id) {
+       var k = this;
+       
+       k.dialog = null;
+       k.generic_dialogDiv = null;
+       k.popup_dialogDiv = null;
+       k.id = id;
+       k.visible = false;
+       
+       k.alwaysModal = false;
+       k.noTitle = false;
+       k.noBottom = false;
+       
+       k.canCardspace = true;
+       k.cardSpaceTimer = null;
+       k.cardspaced = false;
+
+       k.onclose = function() {};
+       k.onclosefinish = function() {};
+       k.canCloseByEscapeKey = true;
+       
+       k.skeleton = '';
+       
+       k.create = function() {
+               //if (DIALOGS[k.id]) {
+               //      log("Attempting to recreate dialog ID \""+k.id+"\"");
+               //      return DIALOGS[k.id].dialog;
+               //}
+               
+               //DIALOGS[k.id] = k;
+
+               log("Creating "+k.id+" dialog...");
+               
+               k.injectStyle();
+               
+               DIALOGCOUNT += 1;
+               k.skeleton  = '<!-- '+SIG+' Dialog -->';
+               k.skeleton += '<div class="generic_dialog pop_dialog" role="dialog" style="z-index:'+(DIALOGCOUNT)+';">';
+               k.skeleton += '  <div class="generic_dialog_popup">';
+               k.skeleton += '    <div class="popup">';
+               k.skeleton += '      <div class="wrap">';
+               k.skeleton += '            <h3 title="This dialog is sent from '+FRIENDLYNAME+'"></h3>';
+               k.skeleton += '            <div class="body">';
+               k.skeleton += '                <div class="content clearfix"></div>';
+               k.skeleton += '                <div class="bottom"></div>';
+               k.skeleton += '            </div>'; // body
+               k.skeleton += '      </div>'; // wrap
+               k.skeleton += '    </div>'; // popup
+               k.skeleton += '  </div>'; // generic_dialog_popup
+               k.skeleton += '</div>';
+               
+               INTERNALUPDATE = true;
+               
+               k.dialog = d.createElement('div');
+               k.dialog.className = 'ponyhoof_dialog';
+               k.dialog.id = 'ponyhoof_dialog_'+k.id;
+               k.dialog.innerHTML = k.skeleton;
+               d.body.appendChild(k.dialog);
+               
+               INTERNALUPDATE = false;
+               
+               k.generic_dialogDiv = k.dialog.getElementsByClassName('pop_dialog')[0];
+               k.popup_dialogDiv = k.dialog.getElementsByClassName('popup')[0];
+               
+               if (k.alwaysModal) {
+                       addClass(k.generic_dialogDiv, 'generic_dialog_modal');
+               }
+               if (k.noTitle) {
+                       addClass(k.dialog.getElementsByTagName('h3')[0], 'hidden_elem');
+               }
+               if (k.noBottom) {
+                       addClass(k.dialog.getElementsByClassName('bottom')[0], 'hidden_elem');
+               }
+               
+               k.show();
+               
+               return k.dialog;
+       };
+       
+       k.injectStyle = function() {
+               var cx = '._6nw';
+               if (d.getElementsByClassName('-cx-PUBLIC-hasLitestand__body').length) {
+                       cx = '.-cx-PUBLIC-hasLitestand__body';
+               }
+
+               var css = '';
+               css += '.ponyhoof_message .wrap {margin-top:3px;background:transparent !important;display:block;}';
+               css += '.ponyhoof_message .uiButton.rfloat {margin-left:10px;}';
+
+               css += '.ponyhoof_dialog, .ponyhoof_dialog .body {font-size:11px;}';
+               css += cx+' .ponyhoof_dialog, '+cx+' .ponyhoof_dialog .body {font-size:12px;}';
+               css += '.ponyhoof_dialog iframe {-webkit-user-select:none;-moz-user-select:none;user-select:none;}';
+               css += '.ponyhoof_dialog textarea, .ponyhoof_dialog input[type="text"] {cursor:text;-moz-box-sizing:border-box;box-sizing:border-box;}';
+               css += '.ponyhoof_dialog .generic_dialog_modal, .ponyhoof_dialog .generic_dialog_fixed_overflow {background-color:rgba(0,0,0,.4) !important;}';
+               css += '.ponyhoof_dialog .generic_dialog {z-index:250;}';
+               css += '.ponyhoof_dialog .generic_dialog_popup {margin-top:80px;}';
+               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);}';
+               css += cx+' .ponyhoof_dialog .popup {font-family:"Helvetica Neue", Helvetica, Arial, "lucida grande",tahoma,verdana,arial,sans-serif;}';
+               css += '.ponyhoof_dialog .wrap {background:#fff;color:#000;}';
+               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;}';
+               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;}';
+               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;}';
+               css += cx+' .ponyhoof_dialog h3:before {display:none;}';
+               css += '.ponyhoof_dialog .body {border:1px solid #555;border-top-width:0;}';
+               css += '.ponyhoof_dialog h3.hidden_elem + .body {border-top-width:1px;}';
+               css += cx+' .ponyhoof_dialog .body {border:0;}';
+               css += '.ponyhoof_dialog .content {padding:10px;}';
+               css += '.ponyhoof_dialog .bottom {background:#F2F2F2;border-top:1px solid #ccc;padding:8px 10px 8px 10px;text-align:right;}';
+               css += cx+' .ponyhoof_dialog .bottom {-moz-border-radius:0 0 3px 3px;border-radius:0 0 3px 3px;}';
+               css += '.ponyhoof_dialog .bottom .lfloat {line-height:17px;margin-top:4px;}';
+               
+               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;}';
+               css += '.ponyhoof_tabs {padding:4px 10px 0;background:#F2F2F2;border-bottom:1px solid #ccc;margin:-10px -10px 10px;}';
+               css += '.ponyhoof_tabs a {margin:3px 10px 0 0;padding:5px 8px;float:left;}';
+               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;}';
+               css += '.ponyhoof_tabs_section {display:none;}';
+               
+               if (ISMOBILE) {
+                       css += '#ponyhoof_welcome_scenery {background-image:none !important;}';
+                       css += '.ponyhoof_dialog .generic_dialog {position:absolute;}';
+                       css += '.ponyhoof_menu .uiMenu.overflow {resize:none !important;height:auto !important;}';
+               }
+               
+               injectManualStyle(css, 'dialog');
+       };
+       
+       k.show = function() {
+               removeClass(k.dialog, 'ponyhoof_fadeout');
+               removeClass(k.generic_dialogDiv, 'ponyhoof_fadeout');
+
+               k.visible = true;
+               k.dialog.style.display = 'block';
+               k.generic_dialogDiv.style.display = 'block';
+               
+               if (ISMOBILE) {
+                       k.canCardspace = false;
+               }
+               
+               if (k.canCardspace) {
+                       w.addEventListener('resize', k.onBodyResize, false);
+                       k.cardSpaceTick();
+               }
+
+               if (k.canCloseByEscapeKey) {
+                       d.body.addEventListener('keydown', k.documentEscapeKey, false);
+               }
+       };
+       
+       k.close = function(callback) {
+               k.onclose();
+
+               if (!userSettings.disable_animation) {
+                       fadeOut(k.dialog, function() {
+                               if (callback) {
+                                       callback();
+                               }
+                               k.onclosefinish();
+                       });
+                       if (callback) {
+                               log("Legacy dialog close code found");
+                       }
+
+                       if (ISOPERA) {
+                               fadeOut(k.generic_dialogDiv);
+                       }
+               } else {
+                       k.dialog.style.display = 'none';
+                       if (callback) {
+                               callback();
+                       }
+                       k.onclosefinish();
+               }
+               
+               k._close();
+       };
+
+       k.hide = function() {
+               k.onclose();
+
+               k.dialog.style.display = 'none';
+
+               k._close();
+       };
+
+       k._close = function() {
+               k.visible = false;
+
+               w.removeEventListener('resize', k.onBodyResize, false);
+               w.clearTimeout(k.cardSpaceTimer);
+               
+               if (k.cardspaced) {
+                       removeClass(d.documentElement, 'generic_dialog_overflow_mode');
+                       if (!k.alwaysModal) {
+                               removeClass(k.generic_dialogDiv, 'generic_dialog_modal');
+                       }
+               }
+               removeClass(k.generic_dialogDiv, 'generic_dialog_fixed_overflow');
+               k.cardspaced = false;
+
+               d.body.removeEventListener('keydown', k.documentEscapeKey, false);
+       };
+       
+       k.changeTitle = function(c) {
+               INTERNALUPDATE = true;
+               var title = k.dialog.getElementsByTagName('h3');
+               if (title.length) {
+                       title = title[0];
+                       title.innerHTML = c;
+               }
+               INTERNALUPDATE = false;
+       };
+       
+       k.changeContent = function(c) {
+               INTERNALUPDATE = true;
+               var content = k.dialog.getElementsByClassName('content');
+               if (content.length) {
+                       content = content[0];
+                       content.innerHTML = c;
+               }
+               INTERNALUPDATE = false;
+       };
+       
+       k.changeBottom = function(c) {
+               INTERNALUPDATE = true;
+               var bottom = k.dialog.getElementsByClassName('bottom');
+               if (bottom.length) {
+                       bottom = bottom[0];
+                       bottom.innerHTML = c;
+               }
+               INTERNALUPDATE = false;
+       };
+       
+       k.addCloseButton = function(callback) {
+               var text = "Close";
+               if (CURRENTLANG && CURRENTLANG.close) {
+                       text = CURRENTLANG.close;
+               }
+
+               var close = '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm" role="button"><span class="uiButtonText">'+text+'</span></a>';
+               k.changeBottom(close);
+               
+               k.dialog.querySelector('.bottom .uiButton').addEventListener('click', function(e) {
+                       k.close(function() {
+                               if (callback) {
+                                       log("Legacy dialog close code found");
+                                       callback();
+                               }
+                       });
+                       e.preventDefault();
+               }, false);
+       };
+       
+       k.onBodyResize = function() {
+               if (k.canCardspace) {
+                       var dialogHeight = k.popup_dialogDiv.clientHeight + 80 + 40;
+                       var windowHeight = w.innerHeight;
+                       
+                       if (dialogHeight > windowHeight) {
+                               if (!k.cardspaced) {
+                                       addClass(d.documentElement, 'generic_dialog_overflow_mode');
+                                       if (!k.alwaysModal) {
+                                               addClass(k.generic_dialogDiv, 'generic_dialog_modal');
+                                       }
+                                       addClass(k.generic_dialogDiv, 'generic_dialog_fixed_overflow');
+                                       
+                                       k.cardspaced = true;
+                               }
+                       } else {
+                               if (k.cardspaced) {
+                                       removeClass(d.documentElement, 'generic_dialog_overflow_mode');
+                                       if (!k.alwaysModal) {
+                                               removeClass(k.generic_dialogDiv, 'generic_dialog_modal');
+                                       }
+                                       removeClass(k.generic_dialogDiv, 'generic_dialog_fixed_overflow');
+                                       
+                                       k.cardspaced = false;
+                               }
+                       }
+               }
+       };
+       
+       k.cardSpaceTick = function() {
+               if (k.canCardspace && k.visible) {
+                       k.onBodyResize();
+                       k.cardSpaceTimer = w.setTimeout(k.cardSpaceTick, 500);
+               } else {
+                       w.clearTimeout(k.cardSpaceTimer);
+               }
+       };
+
+       k.documentEscapeKey = function(e) {
+               if (k.canCloseByEscapeKey) {
+                       if (e.which == 27 && k.visible) { // esc
+                               k.close();
+                               e.stopPropagation();
+                               e.cancelBubble = true;
+                       }
+               }
+       };
+
+       if (DIALOGS[k.id]) {
+               log("Attempting to recreate dialog ID \""+k.id+"\"");
+               return DIALOGS[k.id];
+       }
+       DIALOGS[k.id] = k;
+};
+
+function createSimpleDialog(id, title, message) {
+       if (DIALOGS[id]) {
+               DIALOGS[id].show();
+               return DIALOGS[id];
+       }
+
+       var di = new Dialog(id);
+       di.create();
+       di.changeTitle(title);
+       di.changeContent(message);
+       di.addCloseButton();
+       
+       return di;
+};
+
+function injectSystemStyle() {
+       var css = '';
+       css += '.ponyhoof_show_if_injected {display:none;}';
+       css += '.ponyhoof_hide_if_injected {display:block;}';
+       css += '.ponyhoof_hide_if_injected.inline {display:inline;}';
+       css += 'html.ponyhoof_injected .ponyhoof_show_if_injected {display:block;}';
+       css += 'html.ponyhoof_injected .ponyhoof_hide_if_injected {display:none;}';
+       css += '.ponyhoof_show_if_loaded {display:none;}';
+       css += '.ponyhoof_updater_latest, .ponyhoof_updater_newVersion, .ponyhoof_updater_error {display:none;}';
+       
+       css += '.ponyhoof_fadeout {opacity:0;-webkit-transition:opacity .25s linear;-moz-transition:opacity .25s linear;-o-transition:opacity .25s linear;transition:opacity .25s linear;}';
+       css += '.ponyhoof_message {padding:10px;color:#000;font-weight:bold;overflow:hidden;}';
+       
+       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;}';
+       css += '.ponyhoof_loading.ponyhoof_show_if_injected {display:none;}';
+       css += 'html.ponyhoof_injected .ponyhoof_loading_pony {display:inline-block;}';
+
+       css += '.uiHelpLink {background:url("data:image/gif;base64,R0lGODlhDAALAJEAANvb26enp////wAAACH5BAEAAAIALAAAAAAMAAsAAAIblI8WkbcswAtAwWVzwoIbSWliBzWjR5abagoFADs=") no-repeat 0 center;display:inline-block;height:9px;width:12px;}';
+
+       css += '.uiInputLabel + .uiInputLabel {margin-top:3px;}';
+       css += '.uiInputLabelCheckbox {float:left;margin:0;padding:0;}';
+       css += '.uiInputLabel label {color:#333;display:block;font-weight:normal;margin-left:17px;vertical-align:baseline;}';
+       css += '.webkit.mac .uiInputLabel label {margin-left:16px;}';
+       css += '.webkit.mac .uiInputLabelCheckbox {margin-top:2px;}';
+       
+       injectManualStyle(css, 'system');
+}
+
+// http://www.html5rocks.com/en/tutorials/pagevisibility/intro/
+var _hiddenPropCached = '';
+var getHiddenProp = function() {
+       if (_hiddenPropCached) {
+               return _hiddenPropCached;
+       }
+
+       var prefixes = ['webkit', 'moz', 'ms', 'o'];
+
+       if ('hidden' in document) {
+               _hiddenPropCached = 'hidden';
+               return _hiddenPropCached;
+       }
+
+       for (var i = 0, len = prefixes.length; i < len; i++){
+               if ((prefixes[i] + 'Hidden') in document) {
+                       _hiddenPropCached = prefixes[i] + 'Hidden';
+                       return _hiddenPropCached;
+               }
+       }
+
+       return null;
+};
+var isPageHidden = function() {
+       var prop = getHiddenProp();
+       if (!prop) {
+               return false;
+       }
+
+       return document[prop];
+};
+       // http://www.myersdaily.org/joseph/javascript/md5.js
+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});        
+       var VERSION = 1.631;
+       var FRIENDLYNAME = 'P'+'onyh'+'oof';
+       var SIG = '['+FRIENDLYNAME+' v'+VERSION+']';
+       var DISTRIBUTION = 'userjs';
+
+       var runMe = true;
+       var STORAGEMETHOD = 'none';
+       var INTERNALUPDATE = false;
+       var USINGMUTATION = false;
+       
+       var CURRENTPONY = null;
+       var REALPONY = CURRENTPONY;
+       var BRONYNAME = '';
+       var USERID = 0;
+       var UILANG = 'en_US';
+       var CURRENTLANG = {};
+       var ISUSINGPAGE = false;
+       var ISUSINGBUSINESS = false;
+
+       var SETTINGSPREFIX = '';
+       var globalSettings = {};
+       var GLOBALDEFAULTSETTINGS = {
+               'allowLoginScreen':true,
+               'runForNewUsers':true,
+               'globalSettingsMigrated':false, 'lastUserId':0, 'lastVersion':''
+       };
+       
+       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":"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","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","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}];
+       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 and help","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 4|\\||) |-|3\u00a3|*","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"}};
+       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\/octavia_nevermess":{"name":"Octavia - Never mess with Octavia"},"_sound\/rarity_dumbrock":{"name":"Rarity - Dumb rock!"},"_sound\/rarity_itison":{"name":"Rarity - Oh. It. Is. On!"},"_sound\/rarity_wahaha":{"name":"Rarity - Wahaha!"},"_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"}};
+       var SOUNDS_CHAT = {"_sound\/grin2":{"name":"Fluttershy - *squee*"},"_sound\/chat_boing":{"name":"Boing"}};
+       var HTMLCLASS_SETTINGS = ['login_bg', 'show_messages_other', 'disable_animation', 'pinkieproof', 'disable_emoticons'];
+       var DEFAULTSETTINGS = {
+               'theme':CURRENTPONY,
+               'login_bg':false, 'customBg':null, //'allowLoginScreen':true,
+               'sounds':false, 'soundsFile':'AUTO', 'soundsNotifTypeBlacklist':'', 'soundsVolume':1, 'chatSound':true, 'chatSoundFile':'_sound/grin2',
+               'show_messages_other':true, 'pinkieproof':false,  'forceEnglish':false, 'disable_emoticons':false, 'randomPonies':'', 'costume': '', //'commentBrohoofed':true,
+               'disable_animation':false, 'disableDomNodeInserted':false, //'disableCommentBrohoofed':false,
+               '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,
+               //'lastVersion':''
+
+               //'survivedTheNight', 'chatSound1401', 'randomSettingMigrated'
+       };
+       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"}];
+       var CURRENTSTACK = STACKS_LANG[0];
+       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"]}};
+       var SOUNDS_NOTIFTYPE = {
+                poke: {name:"Nuzzles", type:"poke"}
+               ,like: {name:"Brohoofs", type:"like"}
+               ,group_activity: {name:"New posts in herds and tags about you", type:"group_activity"}
+               ,group_r2j: {name:"Herd join requests", type:"group_r2j"}
+               ,group_added_to_group: {name:"Herd invites from friends", type:"group_added_to_group"}
+               ,plan_reminder: {name:"Adventure reminders", type:"plan_reminder"}
+               ,follow_profile: {name:"New followers", type:"follow_profile"}
+               ,photo_made_profile_pic: {name:"Made your pony pic his/her profile picture", type:"photo_made_profile_pic"}
+               ,answers_answered: {name:"New answers on the Facebook Help Center", type:"answers_answered"}
+
+               ,app_invite: {name:"Game/app requests", type:"app_invite"}
+               ,close_friend_activity: {name:"Posts from Close Friends", type:"close_friend_activity"}
+               ,notify_me: {name:"Page posts that you subscribed to", type:"notify_me"}
+
+               //,fbpage_presence: {name:"Facebook nagging you to post to your page", type:"fbpage_presence"}
+               ,fbpage_fan_invite: {name:"Page invites from friends", type:"fbpage_fan_invite"}
+               ,page_new_likes: {name:"New page brohoofs", type:"page_new_likes"}
+               //,fbpage_new_message: {name:"New private messages on your page", type:"fbpage_new_message"}
+       };
+       
+       var THEMEURL = w.location.protocol + '//hoof.little.my/files/';
+       var THEMECSS = THEMEURL+'';
+       var THEMECSS_EXT = '.css?userscript_version='+VERSION;
+       var UPDATEURL = w.location.protocol + '//hoof.little.my/files/update_check.js?' + (+new Date());
+       
+       var PONYHOOF_PAGE = '197956210325433';
+       var PONYHOOF_URL = '//'+getFbDomain()+'/Ponyhoof';
+       var PONYHOOF_README = '//hoof.little.my/files/_welcome/readme.htm?version='+VERSION+'&distribution='+DISTRIBUTION;
+       
+       var _ext_messageId = 0;
+       var _ext_messageCallback = {};
+
+       // Chrome
+               var chrome_sendMessage = function(message, callback) {
+                       if (chrome.extension.sendMessage) {
+                               chrome.extension.sendMessage(message, callback);
+                       } else {
+                               chrome.extension.sendRequest(message, callback);
+                       }
+               };
+
+               var chrome_storageFallback = false;
+               var chrome_getValue = function(name, callback) {
+                       if (chrome.storage && !chrome_storageFallback) {
+                               chrome.storage.local.get(name, function(item) {
+                                       if (chrome.runtime && chrome.runtime.lastError) {
+                                               // Fallback to old storage method
+                                               chrome_storageFallback = true;
+                                               chrome_getValue(name, callback);
+                                               return;
+                                       }
+
+                                       if (Object.keys(item).length === 0) {
+                                               callback(null);
+                                               return;
+                                       }
+                                       callback(item[name]);
+                               });
+                               return;
+                       }
+
+                       try {
+                               chrome_sendMessage({'command':'getValue', 'name':name}, function(response) {
+                                       if (response && typeof response.val != 'undefined') {
+                                               callback(response.val);
+                                       } else {
+                                               callback(null);
+                                       }
+                               });
+                       } catch (e) {
+                               dir(e);
+                               getValueError(e);
+                               callback(null);
+                       }
+               };
+               
+               var chrome_setValue = function(name, val) {
+                       if (chrome.storage && !chrome_storageFallback) {
+                               var toSet = {};
+                               toSet[name] = val;
+                               chrome.storage.local.set(toSet, function() {
+                                       if (chrome.runtime && chrome.runtime.lastError) {
+                                               saveValueError(chrome.runtime.lastError);
+                                               return;
+                                       }
+                               });
+                               return;
+                       }
+
+                       chrome_sendMessage({'command':'setValue', 'name':name, 'val':val}, function() {});
+               };
+               
+               var chrome_clearStorage = function() {
+                       if (chrome.storage) {
+                               chrome.storage.local.clear();
+                       }
+                       chrome_sendMessage({'command':'clearStorage'}, function() {});
+               };
+               
+               var chrome_ajax = function(details) {
+                       chrome_sendMessage({'command': 'ajax', 'details': details}, function(response) {
+                               if (response.val == 'success') {
+                                       if (details.onload) {
+                                               details.onload(response.request);
+                                       }
+                               } else {
+                                       if (details.onerror) {
+                                               details.onerror(response.request);
+                                       }
+                               }
+                       });
+               };
+       
+       if (ISOPERA) {
+               if (opera.extension) {
+                       opera.extension.onmessage = function(message) {
+                               if (message.data) {
+                                       var response = message.data;
+                                       var callback = _ext_messageCallback[response.messageid];
+                                       if (callback) {
+                                               callback(response.val);
+                                       }
+                               }
+                       }
+               }
+
+               var opera_getValue = function(name, callback) {
+                       _ext_messageCallback[_ext_messageId] = callback;
+                       opera.extension.postMessage({'command':'getValue', 'messageid':_ext_messageId, 'name':name});
+                       _ext_messageId += 1;
+               };
+               
+               var opera_setValue = function(name, val) {
+                       opera.extension.postMessage({'command':'setValue', 'name':name, 'val':val});
+               };
+               
+               var opera_clearStorage = function() {
+                       opera.extension.postMessage({'command':'clearStorage'});
+               };
+
+               var opera_ajax = function(details) {
+                       _ext_messageCallback[_ext_messageId] = function(response) {
+                               if (response.val == 'success') {
+                                       if (details.onload) {
+                                               details.onload(response.request);
+                                       }
+                               } else {
+                                       if (details.onerror) {
+                                               details.onerror(response.request);
+                                       }
+                               }
+                       };
+                       var detailsX = {
+                                'method': details.method
+                               ,'url': details.url
+                               ,'headers': details.headers
+                               ,'data': details.data
+                       };
+                       opera.extension.postMessage({'command':'ajax', 'messageid':_ext_messageId, 'details':detailsX});
+                       _ext_messageId += 1;
+               };
+       }
+
+       if (ISSAFARI) {
+               if (typeof safari != 'undefined') {
+                       safari.self.addEventListener('message', function(message) {
+                               var data = message.message;
+                               if (data) {
+                                       var response = data;
+                                       var callback = _ext_messageCallback[message.name];
+                                       if (callback) {
+                                               callback(response.val);
+                                       }
+                               }
+                       });
+               }
+
+               var safari_getValue = function(name, callback) {
+                       _ext_messageId = md5(Math.random().toString()); // safari, you don't know what's message passing/callbacks, do you?
+                       _ext_messageCallback[_ext_messageId] = callback;
+                       safari.self.tab.dispatchMessage('getValue', {'messageid':_ext_messageId, 'name':name});
+                       //_ext_messageId += 1;
+               };
+               
+               var safari_setValue = function(name, val) {
+                       safari.self.tab.dispatchMessage('setValue', {'name':name, 'val':val});
+               };
+               
+               var safari_clearStorage = function() {
+                       safari.self.tab.dispatchMessage('clearStorage', {});
+               };
+
+               var safari_ajax = function(details) {
+                       _ext_messageId = md5(Math.random().toString());
+                       _ext_messageCallback[_ext_messageId] = function(response) {
+                               if (response.val == 'success') {
+                                       if (details.onload) {
+                                               details.onload(response.request);
+                                       }
+                               } else {
+                                       if (details.onerror) {
+                                               details.onerror(response.request);
+                                       }
+                               }
+                       };
+                       var detailsX = {
+                                'method': details.method
+                               ,'url': details.url
+                               ,'headers': details.headers
+                               ,'data': details.data
+                       };
+                       safari.self.tab.dispatchMessage('ajax', {'messageid':_ext_messageId, 'details':detailsX});
+                       //_ext_messageId += 1;
+               };
+       }
+       
+       if (ISFIREFOX && typeof self != 'undefined' && typeof self.on != 'undefined') {
+               self.on('message', function(message) {
+                       var data = message;
+                       if (data) {
+                               var response = data;
+                               var callback = _ext_messageCallback[message.messageid];
+                               if (callback) {
+                                       callback(response.val);
+                               }
+                       }
+               });
+               var xpi_getValue = function(name, callback) {
+                       _ext_messageCallback[_ext_messageId] = callback;
+                       self.postMessage({'command':'getValue', 'messageid':_ext_messageId, 'name':name});
+                       _ext_messageId += 1;
+               };
+               
+               var xpi_setValue = function(name, val) {
+                       self.postMessage({'command':'setValue', 'name':name, 'val':val});
+               };
+               
+               var xpi_clearStorage = function(name, val) {
+                       self.postMessage({'command':'clearStorage'});
+               };
+
+               var xpi_ajax = function(details) {
+                       _ext_messageCallback[_ext_messageId] = function(response) {
+                               if (response.val == 'success') {
+                                       if (details.onload) {
+                                               details.onload(response.request);
+                                       }
+                               } else {
+                                       if (details.onerror) {
+                                               details.onerror(response.request);
+                                       }
+                               }
+                       };
+                       var detailsX = {
+                                'method': details.method
+                               ,'url': details.url
+                               ,'headers': details.headers
+                               ,'data': details.data
+                       };
+                       self.postMessage({'command':'ajax', 'messageid':_ext_messageId, 'details':detailsX});
+                       _ext_messageId += 1;
+               };
+       }
+
+       if (typeof w.external != 'undefined' && typeof w.external.mxGetRuntime != 'undefined') {
+               var maxthonRuntime = w.external.mxGetRuntime();
+
+               maxthonRuntime.listen('messageContentScript', function(message) {
+                       var data = message;
+                       if (data) {
+                               var response = data;
+                               var callback = _ext_messageCallback[message.messageid];
+                               if (callback) {
+                                       callback(response.val);
+                               }
+                       }
+               });
+
+               var mxaddon_ajax = function(details) {
+                       _ext_messageCallback[_ext_messageId] = function(response) {
+                               if (response.val == 'success') {
+                                       if (details.onload) {
+                                               details.onload(response.request);
+                                       }
+                               } else {
+                                       if (details.onerror) {
+                                               details.onerror(response.request);
+                                       }
+                               }
+                       };
+                       var detailsX = {
+                                'method': details.method
+                               ,'url': details.url
+                               ,'headers': details.headers
+                               ,'data': details.data
+                       };
+                       maxthonRuntime.post('messageBackground', {'command':'ajax', 'messageid':_ext_messageId, 'details':detailsX});
+                       _ext_messageId += 1;
+               };
+       }
+
+       function ajax(obj) {
+               switch (STORAGEMETHOD) {
+                       case 'greasemonkey':
+                               return GM_xmlhttpRequest(obj);
+
+                       case 'chrome':
+                               return chrome_ajax(obj);
+
+                       case 'opera':
+                               return opera_ajax(obj);
+
+                       case 'safari':
+                               return safari_ajax(obj);
+
+                       case 'xpi':
+                               return xpi_ajax(obj);
+
+                       case 'mxaddon':
+                               return mxaddon_ajax(obj);
+
+                       default:
+                               break;
+               }
+               
+               throw {
+                        responseXML:''
+                       ,responseText:''
+                       ,readyState:4
+                       ,responseHeaders:''
+                       ,status:-100
+                       ,statusText:'No GM_xmlhttpRequest support'
+               };
+       }
+       
+       function isPonyhoofPage(id) {
+               if (id == PONYHOOF_PAGE) {
+                       return true;
+               }
+                               return false;
+       }
+       
+       function capitaliseFirstLetter(string) {
+               return string.charAt(0).toUpperCase() + string.slice(1);
+       }
+       
+       // Settings
+       for (var i in HTMLCLASS_SETTINGS) {
+               if (!DEFAULTSETTINGS[HTMLCLASS_SETTINGS[i]]) {
+                       DEFAULTSETTINGS[HTMLCLASS_SETTINGS[i]] = false;
+               }
+       }
+       //DEFAULTSETTINGS.show_messages_other = true;
+       if (ISMOBILE) {
+               DEFAULTSETTINGS.disable_animation = true;
+       }
+       
+       function getValueError(extra) {
+               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>') {
+                       createSimpleDialog('localStorageError_getValueChromeExt', "Ponyhoof derp'd", "Ponyhoof has been disabled/updated recently. Please reload the page in order for Ponyhoof to work properly.");
+               } else {
+                       createSimpleDialog('localStorageError_getValue', "Ponyhoof derp'd", "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 the Ponyhoof page for help</a>.<br><br>"+extra);
+               }
+
+               trace();
+       }
+       
+       function saveValueError(extra) {
+               var desc = "Ponyhoof can't save your settings. There might be a conflict with another extension installed on your browser. 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 the Ponyhoof page for help</a>.<br><br>"+extra;
+               createSimpleDialog('localStorageError_saveValue', "Ponyhoof derp'd", desc);
+
+               trace();
+       }
+       
+       function ponyhoofError(extra) {
+               createSimpleDialog('ponyhoofError', "Ponyhoof derp'd", "Ponyhoof encountered an internal error. Please try again later and update to the latest version of Ponyhoof if available.<br><br>"+extra);
+
+               trace();
+       }
+       
+       function getValue(name, callback) {
+               switch (STORAGEMETHOD) {
+                       case 'greasemonkey':
+                               callback(GM_getValue(name));
+                               break;
+                       
+                       case 'chrome':
+                               chrome_getValue(name, callback);
+                               break;
+                       
+                       case 'opera':
+                               opera_getValue(name, callback);
+                               break;
+                       
+                       case 'safari':
+                               safari_getValue(name, callback);
+                               break;
+                       
+                       case 'xpi':
+                               xpi_getValue(name, callback);
+                               break;
+                       
+                       case 'mxaddon':
+                               callback(w.external.mxGetRuntime().storage.getConfig(name));
+                               break;
+                       
+                       case 'localstorage':
+                       default:
+                               name = 'ponyhoof_'+name;
+                               callback(w.localStorage.getItem(name));
+                               break;
+               }
+       }
+       
+       function saveValue(name, v) {
+               switch (STORAGEMETHOD) {
+                       case 'greasemonkey':
+                               GM_setValue(name, v);
+                               break;
+                       
+                       case 'chrome':
+                               chrome_setValue(name, v);
+                               break;
+                       
+                       case 'opera':
+                               opera_setValue(name, v);
+                               break;
+                       
+                       case 'safari':
+                               safari_setValue(name, v);
+                               break;
+                       
+                       case 'xpi':
+                               xpi_setValue(name, v);
+                               break;
+                       
+                       case 'mxaddon':
+                               w.external.mxGetRuntime().storage.setConfig(name, v);
+                               break;
+                       
+                       case 'localstorage':
+                       default:
+                               name = 'ponyhoof_'+name;
+                               w.localStorage.setItem(name, v);
+                               break;
+               }
+       }
+
+       function loadSettings(callback, opts) {
+               // opts => prefix, defaultsettings
+               var opts = opts || {prefix:null};
+               var settingsKey = 'settings';
+               if (opts.prefix != null) {
+                       settingsKey = opts.prefix+settingsKey;
+               } else {
+                       settingsKey = SETTINGSPREFIX+settingsKey;
+               }
+               if (!opts.defaultSettings) {
+                       opts.defaultSettings = DEFAULTSETTINGS;
+               }
+
+               try {
+                       getValue(settingsKey, function(s) {
+                               if (s) {
+                                       s = JSON.parse(s);
+                                       if (!s) {
+                                               s = {};
+                                       }
+                               } else {
+                                       s = {};
+                               }
+                               for (var i in opts.defaultSettings) {
+                                       if (!s.hasOwnProperty(i)) {
+                                               s[i] = opts.defaultSettings[i];
+                                       }
+                               }
+                               callback(s);
+                       });
+               } catch (e) {
+                       dir(e);
+
+                       var extra = '';
+                       if (e.message) {
+                               extra = "<code>"+e.message+"</code>";
+                       } else {
+                               extra = "<code>"+e.toString()+"</code>";
+                       }
+                       try {
+                               getValueError(extra);
+                       } catch (e) {
+                               onPageReady(function() {
+                                       if (d.body) {
+                                               getValueError(extra);
+                                       }
+                               });
+                       }
+                       callback();
+                       return false;
+               }
+       }
+       
+       function saveSettings(opts) {
+               // opts => prefix, settings
+               var opts = opts || {prefix:null, settings:userSettings};
+               var settingsKey = 'settings';
+               if (opts.prefix != null) {
+                       settingsKey = opts.prefix+settingsKey;
+               } else {
+                       settingsKey = SETTINGSPREFIX+settingsKey;
+               }
+               var settings = userSettings;
+               if (opts.settings) {
+                       settings = opts.settings;
+               }
+
+               try {
+                       saveValue(settingsKey, JSON.stringify(settings));
+                       return true;
+               } catch (e) {
+                       dir(e);
+
+                       var extra = '';
+                       if (e.message) {
+                               if (e.message == 'ModuleSystem has been deleted' || e.message == 'TypeError: Cannot read property \'sendMessage\' of undefined') {
+                                       createSimpleDialog('localStorageError_setValueChromeExt', "Ponyhoof derp'd", "Ponyhoof has been disabled/updated recently. Please reload the page in order for Ponyhoof to work properly.");
+                                       callback();
+                                       return;
+                               }
+
+                               extra = "<code>"+e.message+"</code>";
+                       } else {
+                               extra = "<code>"+e.toString()+"</code>";
+                       }
+                       saveValueError(extra);
+                       return false;
+               }
+       }
+
+       var saveGlobalSettings = function() {
+               saveSettings({prefix:'global_', settings:globalSettings});
+       };
+
+       function statTrack(stat) {
+               var i = d.createElement('iframe');
+               i.style.position = 'absolute';
+               i.style.top = '-9999px';
+               i.style.left = '-9999px';
+               i.src = '//hoof.little.my/files/_htm/stat_'+stat+'.htm?version='+VERSION;
+               d.body.appendChild(i);
+       }
+       
+       // Pony selector
+       var PonySelector = function(p, param) {
+               var k = this;
+               
+               if (param) {
+                       k.param = param;
+               } else {
+                       k.param = {};
+               }
+               k.p = p;
+               k.wrap = null;
+               k.button = null;
+               
+               k.oldPony = CURRENTPONY;
+               k.customClick = function() {};
+               k.customCheckCondition = false;
+               k.overrideClickAction = false;
+               
+               k.menu = null;
+               k.createSelector = function() {
+                       if (k.menu) {
+                               return k.menu;
+                       }
+                       
+                       k.injectStyle();
+                       
+                       var currentPonyData = convertCodeToData(CURRENTPONY);
+                       var name = "(Nopony)";
+                       if (currentPonyData) {
+                               name = currentPonyData.name;
+                       } else if (CURRENTPONY == 'RANDOM') {
+                               name = "(Random)";
+                       }
+                       
+                       var iu = INTERNALUPDATE;
+                       INTERNALUPDATE = true;
+                       
+                       k.menu = new Menu('ponies_'+p.id, k.p/*, {checkable:true}*/);
+                       k.button = k.menu.createButton(name);
+                       k.menu.alwaysOverflow = true;
+                       k.menu.createMenu();
+                       k.menu.attachButton();
+
+                       if (k.allowRandom) {
+                               var check = false;
+                               if (CURRENTPONY == 'RANDOM') {
+                                       check = true;
+                               }
+                               
+                               k.menu.createMenuItem({
+                                        html: "(Random)"
+                                       ,title: "To choose who to randomize, go to the Misc tab"
+                                       ,check: check
+                                       ,unsearchable: true
+                                       ,onclick: function(menuItem, menuClass) {
+                                               CURRENTPONY = 'RANDOM';
+                                               
+                                               changeThemeSmart('RANDOM');
+                                               userSettings.theme = 'RANDOM';
+                                               saveSettings();
+                                               
+                                               menuClass.changeButtonText("(Random)");
+                                               menuClass.changeChecked(menuItem);
+                                               menuClass.close();
+                                               
+                                               if (k.customClick) {
+                                                       k.customClick(menuItem, menuClass);
+                                               }
+                                       }
+                               });
+                       }
+                       
+                       if (k.allowRandom) {
+                               k.menu.createSeperator();
+                       }
+                       
+                       if (k.param.feature && k.param.feature != -1) {
+                               k._createItem(PONIES[k.param.feature], true);
+                               k.menu.createSeperator();
+                       }
+                       
+                       for (var i = 0, len = PONIES.length; i < len; i += 1) {
+                               if (k.param.feature && k.param.feature != -1 && PONIES[k.param.feature].code == PONIES[i].code) {
+                                       if (PONIES[i].seperator) {
+                                               k.menu.createSeperator();
+                                       }
+                                       continue;
+                               }
+                               
+                               var check = false;
+                               if (k.customCheckCondition) {
+                                       if (k.customCheckCondition(PONIES[i].code)) {
+                                               check = true;
+                                       }
+                               } else {
+                                       if (PONIES[i].code == CURRENTPONY) {
+                                               check = true;
+                                       }
+                               }
+                               
+                               k._createItem(PONIES[i], check);
+                               
+                               if (PONIES[i].seperator) {
+                                       k.menu.createSeperator();
+                               }
+                       }
+                       
+                       var img = d.createElement('span');
+                       img.className = 'ponyhoof_loading ponyhoof_show_if_injected ponyhoof_loading_pony';
+                       k.menu.wrap.appendChild(img);
+
+                       INTERNALUPDATE = iu;
+               };
+               
+               k._createItem = function(ponyData, check) {
+                       var unsearchable = false;
+                       if (ponyData.hidden) {
+                               unsearchable = true;
+                       }
+                       var menuItem = k.menu.createMenuItem({
+                                html: ponyData.name
+                               ,title: ponyData.menu_title
+                               ,data: ponyData.code
+                               ,check: check
+                               ,unsearchable: unsearchable
+                               ,searchAlternate: ponyData.search
+                               ,onclick: function(menuItem, menuClass) {
+                                       if (!k.overrideClickAction) {
+                                               var code = ponyData.code;
+                                               CURRENTPONY = code;
+                                               
+                                               changeThemeSmart(code);
+                                               userSettings.theme = code;
+                                               saveSettings();
+
+                                               menuClass.changeButtonText(ponyData.name);
+                                               menuClass.changeChecked(menuItem);
+                                               menuClass.close();
+                                       }
+                                       
+                                       if (k.customClick) {
+                                               k.customClick(menuItem, menuClass);
+                                       }
+                               }
+                       });
+                       if (ponyData.hidden) {
+                               addClass(menuItem.menuItem, 'ponyhoof_pony_hidden');
+                       }
+               };
+               
+               k.injectStyle = function() {
+                       var css = '';
+                       css += 'html .ponyhoof_pony_hidden {display:none;}';
+                       for (var i = 0, len = PONIES.length; i < len; i += 1) {
+                               if (PONIES[i].color) {
+                                       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;}';
+                               }
+                       }
+                       
+                       injectManualStyle(css, 'ponySelector');
+               };
+       };
+       
+       // Sounds
+       var _soundCache = {};
+       var PonySound = function(id) {
+               var k = this;
+               k.id = id;
+               
+               k.sound = d.createElement('audio');
+               
+               // Don't loop sounds for 3 seconds
+               k.wait = 3;
+               k.respectSettings = true;
+               k.respectVolumeSetting = true;
+               
+               k._time = 0;
+               
+               k.source = '';
+               k.changeSource = function(source) {
+                       k.source = source;
+               };
+               
+               k.changeSourceSmart = function(source) {
+                       if (k.canPlayMp3()) {
+                               source = source.replace(/\.EXT/, '.mp3');
+                       } else if (k.canPlayOgg()) {
+                               source = source.replace(/\.EXT/, '.ogg');
+                       } else {
+                               throw new Error("No supported audio formats");
+                       }
+
+                       k.changeSource(source);
+               };
+               
+               k.play = function() {
+                       if (k.respectSettings) {
+                               if (!userSettings.sounds) {
+                                       return;
+                               }
+                       }
+                       
+                       if (k.wait == 0) {
+                               k.continuePlaying();
+                               return;
+                       }
+
+                       // Make sure we aren't playing it on another page already
+                       k._time = Math.floor(Date.now() / 1000);
+                       
+                       //try {
+                               getValue(SETTINGSPREFIX+'soundCache', function(s) {
+                                       if (typeof s != 'undefined') {
+                                               try {
+                                                       _soundCache = JSON.parse(s);
+                                               } catch (e) {
+                                                       _soundCache = {};
+                                               }
+                                               
+                                               if (_soundCache == null) {
+                                                       _soundCache = {};
+                                               }
+
+                                               if (_soundCache[k.id]) {
+                                                       if (_soundCache[k.id]+k.wait <= k._time) {
+                                                       } else {
+                                                               return;
+                                                       }
+                                               }
+                                       }
+
+                                       k.continuePlaying();
+                               });
+                       //} catch (e) {
+                       //      k.continuePlaying();
+                       //}
+               };
+               
+               k.continuePlaying = function() {
+                       if (k.wait) {
+                               _soundCache[k.id] = k._time;
+                               saveValue(SETTINGSPREFIX+'soundCache', JSON.stringify(_soundCache));
+                       }
+
+                       if (k.respectVolumeSetting) {
+                               k.sound.volume = userSettings.soundsVolume;
+                       }
+                       k.sound.src = k.source;
+                       k.sound.play();
+               };
+               
+               // http://html5doctor.com/native-audio-in-the-browser/
+               k.audioTagSupported = function() {
+                       return !!(k.sound.canPlayType);
+               };
+               
+               k.canPlayMp3 = function() {
+                       return !!k.sound.canPlayType && '' != k.sound.canPlayType('audio/mpeg');
+               };
+               
+               k.canPlayOgg = function() {
+                       return !!k.sound.canPlayType && '' != k.sound.canPlayType('audio/ogg; codecs="vorbis"');
+               };
+       };
+       
+       var ponySounds = {};
+       function initPonySound(id, source) {
+               var source = source || '';
+
+               if (ponySounds[id]) {
+                       if (source) {
+                               ponySounds[id].changeSourceSmart(source);
+                       }
+                       
+                       return ponySounds[id];
+               }
+
+               var sound = new PonySound(id);
+               
+               if (!sound.audioTagSupported()) {
+                       throw new Error('No <audio> tag support');
+               }
+               
+               if (source) {
+                       sound.changeSourceSmart(source);
+               }
+               
+               ponySounds[id] = sound;
+
+               return sound;
+       }
+       
+       // Updater
+       var Updater = function() {
+               var k = this;
+               
+               k.classChecking = 'ponyhoof_updater_checking';
+               k.classLatest = 'ponyhoof_updater_latest';
+               k.classError = 'ponyhoof_updater_error';
+               k.classNewVersion = 'ponyhoof_updater_newVersion';
+               k.classVersionNum = 'ponyhoof_updater_versionNum';
+               k.classUpdateButton = 'ponyhoof_updater_updateNow';
+
+               k.update_url = UPDATEURL;
+
+               k.update_json = {};
+
+               k.checkForUpdates = function() {
+                                       loopClassName(k.classUpdateButton, function(ele) {
+                               if (ISSAFARI && STORAGEMETHOD != 'safari') {
+                                       // NinjaKit is bugged and only listens to install script requests on page load, no DOMNodeInserted, so we plan to open a new window
+                                       ele.target = '_blank';
+                               }
+                               
+                               ele.addEventListener('click', k._updateNowButton, false);
+                       });
+
+                       log("Checking for updates...");
+                       try {
+                               ajax({
+                                        method: 'GET'
+                                       ,url: k.update_url
+                                       ,onload: function(response) {
+                                               if (response.status != 200) {
+                                                       k._onError(response);
+                                                       return;
+                                               }
+                                               
+                                               try {
+                                                       var json = JSON.parse(response.responseText);
+                                               } catch (e) {
+                                                       k._onError(response);
+                                                       return;
+                                               }
+                                               
+                                               if (json.version > VERSION) {
+                                                       k._newVersion(json);
+                                               } else {
+                                                       k._noNewVersion();
+                                               }
+                                       }
+                                       ,onerror: function(response) {
+                                               k._onError(response);
+                                       }
+                               });
+                       } catch (e) {
+                               k._onError(e);
+                       }
+               };
+               
+               k._noNewVersion = function() {
+                       // Hide checking for updates
+                       loopClassName(k.classChecking, function(ele) {
+                               ele.style.display = 'none';
+                       });
+
+                       // Show yay
+                       loopClassName(k.classLatest, function(ele) {
+                               ele.style.display = 'block';
+                       });
+               };
+               k._newVersion = function(json) {
+                       k.update_json = json;
+
+                       // Hide checking for updates
+                       loopClassName(k.classChecking, function(ele) {
+                               ele.style.display = 'none';
+                       });
+
+                       // Show version number
+                       loopClassName(k.classVersionNum, function(ele) {
+                               ele.textContent = json.version;
+                       });
+                       // Show that we have a new version
+                       loopClassName(k.classNewVersion, function(ele) {
+                               ele.style.display = 'block';
+                       });
+                       // Change the update now button to point to the new link
+                       loopClassName(k.classUpdateButton, function(ele) {
+                               if (ISSAFARI && STORAGEMETHOD != 'safari') {
+                                       ele.href = json.safari;
+                                       return;
+                               }
+                               
+                               switch (STORAGEMETHOD) {
+                                       // v1.501
+                                       case 'chrome':
+                                               ele.href = json.chrome_url;
+                                               break;
+
+                                       case 'opera':
+                                               ele.href = json.opera_url;
+                                               break;
+
+                                       // v1.521
+                                       case 'safari':
+                                               ele.href = json.safariextz;
+                                               break;
+
+                                       // v1.611
+                                       case 'xpi':
+                                               //ele.href = json.xpi;
+                                               break;
+
+                                       default:
+                                               ele.href = json.update_url;
+                                               break;
+                               }
+                       });
+               };
+               k._onError = function(response) {
+                       // Hide checking for updates
+                       loopClassName(k.classChecking, function(ele) {
+                               ele.style.display = 'none';
+                       });
+
+                       // Show derp
+                       loopClassName(k.classError, function(ele) {
+                               ele.style.display = 'block';
+                       });
+
+                       error("Error checking for updates.");
+                       dir(response);
+               };
+
+               k.updateDialog = null;
+               k._updateNowButton = function() {
+                       statTrack('updateNowButton');
+
+                       switch (STORAGEMETHOD) {
+                               case 'chrome':
+                                       k._cws();
+                                       return false;
+
+                               case 'opera':
+                                       k._opera();
+                                       return false;
+
+                               case 'safari':
+                                       k.safariInstruction();
+                                       return false;
+
+                               case 'xpi':
+                                       k._xpi();
+                                       return;
+
+                               default:
+                                       break;
+                       }
+
+                       if (DIALOGS.updater_dialog) {
+                               k.updateDialog.show();
+                               return;
+                       }
+
+                       var c = "The update will load after you reload Facebook.";
+                       if (ISCHROME) { // still localstorage
+                               c = "Click Continue on the bottom of this window and click Add to finish updating. The update will load after you reload Facebook.";
+                       } else if (ISSAFARI) { // still ninjakit
+                               c = "Follow the instructions in the new window and reload Facebook when you are done.";
+                       } else if (ISOPERA) { // still localstorage
+                               c = "Follow the instructions in the new window and reload Facebook when you are done.";
+                       } else if (STORAGEMETHOD == 'greasemonkey') {
+                               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'>";
+                               injectManualStyle('#ponyhoof_dialog_updater_dialog .generic_dialog_popup, #ponyhoof_dialog_updater_dialog .popup {width:600px;}', 'updater_dialog');
+                       }
+                       
+                       var bottom = '';
+                       bottom += '<div class="lfloat"><a href="#" class="retry hidden_elem">Retry</a></div>';
+                       bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm reloadNow" role="button"><span class="uiButtonText">'+CURRENTLANG.reloadNow+'</span></a>';
+                       bottom += '<a href="#" class="uiButton uiButtonLarge notNow" role="button"><span class="uiButtonText">'+CURRENTLANG.notNow+'</span></a>';
+                       
+                       k.updateDialog = new Dialog('updater_dialog');
+                       k.updateDialog.alwaysModal = true;
+                       k.updateDialog.create();
+                       k.updateDialog.changeTitle(CURRENTLANG['updater_title']);
+                       k.updateDialog.changeContent(c);
+                       k.updateDialog.changeBottom(bottom);
+                       
+                       if (!ISCHROME && STORAGEMETHOD == 'greasemonkey') {
+                               var retry = k.updateDialog.dialog.getElementsByClassName('retry');
+                               if (retry.length) {
+                                       retry = retry[0];
+                                       retry.href = k.update_json.update_url;
+                                       removeClass(retry, 'hidden_elem');
+                               }
+                       }
+                       k._initReloadButtons(k.updateDialog);
+                       
+                       return false;
+               };
+
+               k.cwsDialog = null;
+               k.cwsWaitDialog = null;
+               k.cwsOneClickSuccess = false;
+               k._cws = function() {
+                       if (k.cwsWaitDialog) {
+                               k._cws_showDialog();
+                               return;
+                       }
+
+                       var ok = true;
+                       loopClassName(k.classUpdateButton, function(ele) {
+                               if (hasClass(ele, 'uiButtonDisabled')) {
+                                       ok = false;
+                               } else {
+                                       addClass(ele, 'uiButtonDisabled');
+                               }
+                       });
+                       if (!ok) {
+                               return;
+                       }
+
+                       var c = "Updating... <span class='ponyhoof_loading'></span>";
+                       k.cwsWaitDialog = new Dialog('update_cwsWait');
+                       k.cwsWaitDialog.alwaysModal = true;
+                       k.cwsWaitDialog.noBottom = true;
+                       k.cwsWaitDialog.canCloseByEscapeKey = false;
+                       k.cwsWaitDialog.create();
+                       k.cwsWaitDialog.changeTitle(CURRENTLANG.updater_title);
+                       k.cwsWaitDialog.changeContent(c);
+
+                       chrome_sendMessage({'command':'checkForUpdates'}, function(status, details) {
+                               if (status == 'update_available') {
+                                       var c = "Downloading update... <span class='ponyhoof_loading'></span>";
+                                       k.cwsWaitDialog.changeContent(c);
+                                       chrome_sendMessage({'command':'onUpdateAvailable'}, function(status) {
+                                               if (status == 'updated') {
+                                                       k.cwsOneClickSuccess = true;
+
+                                                       var successText = '';
+                                                       var ponyData = convertCodeToData(CURRENTPONY);
+                                                       if (ponyData.successText) {
+                                                               successText = ponyData.successText;
+                                                       } else {
+                                                               successText = "Yay!";
+                                                       }
+                                                       var c = successText+" Reloading... <span class='ponyhoof_loading'></span>";
+                                                       k.cwsWaitDialog.changeContent(c);
+
+                                                       if (!k.cwsDialog) {
+                                                               chrome_sendMessage({'command':'reloadNow'}, function() {});
+                                                               w.setTimeout(function() {
+                                                                       w.location.reload();
+                                                               }, 1000);
+                                                       }
+                                               } else {
+                                                       k._cws_fallback();
+                                               }
+                                       });
+                               } else {
+                                       k._cws_fallback();
+                               }
+                       });
+
+                       w.setTimeout(k._cws_fallback, 8000);
+               };
+
+               k._cws_fallback = function() {
+                       if (k.cwsOneClickSuccess) {
+                               return;
+                       }
+                       k.cwsOneClickSuccess = true;
+
+                       k.cwsWaitDialog.close();
+                       loopClassName(k.classUpdateButton, function(ele) {
+                               removeClass(ele, 'uiButtonDisabled');
+                       });
+                       k._cws_showDialog();
+               };
+
+               k._cws_showDialog = function() {
+                       if (k.cwsDialog) {
+                               k.cwsDialog.show();
+                               return;
+                       }
+
+                       var header = '';
+                       if (DISTRIBUTION == 'cws') {
+                               if (!ISOPERABLINK) {
+                                       header = "Ponyhoof automatically updates from the Chrome Web Store.";
+                               } else {
+                                       header = "Ponyhoof automatically updates on Opera.";
+                               }
+                       } else {
+                               header = "Ponyhoof automatically updates on Google Chrome.";
+                       }
+
+                       var newversion = k.update_json.version;
+                       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>.";
+                       if (newversion) {
+                               c += "<br><br>Verify that the version changes from "+VERSION+" to "+parseFloat(newversion)+" and reload Facebook.";
+                       }
+                       c += "<br><br><"+"img src='"+THEMEURL+"_welcome/chrome_forceupdate.png' alt='' width='177' height='108' class='ponyhoof_image_shadow'>";
+                       
+                       var bottom = '';
+                       bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm" role="button" id="ponyhoof_updater_cws_openExtensions"><span class="uiButtonText">Open Extensions</span></a>';
+                       bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm reloadNow" role="button"><span class="uiButtonText">'+CURRENTLANG.reloadNow+'</span></a>';
+                       bottom += '<a href="#" class="uiButton uiButtonLarge notNow" role="button"><span class="uiButtonText">'+CURRENTLANG.notNow+'</span></a>';
+                       
+                       k.cwsDialog = new Dialog('update_cws');
+                       k.cwsDialog.alwaysModal = true;
+                       k.cwsDialog.create();
+                       k.cwsDialog.changeTitle(CURRENTLANG['updater_title']);
+                       k.cwsDialog.changeContent(c);
+                       k.cwsDialog.changeBottom(bottom);
+                       
+                       var openExtensionsButton = $('ponyhoof_updater_cws_openExtensions');
+
+                       openExtensionsButton.addEventListener('click', function() {
+                               if (!hasClass(this, 'uiButtonDisabled')) {
+                                       chrome_sendMessage({'command':'openExtensions'}, function() {});
+                               }
+                               return false;
+                       });
+
+                       k._initReloadButtons(k.cwsDialog);
+               };
+
+               k.operaDialog = null;
+               k._opera = function() {
+                       if ($('ponyhoof_dialog_update_opera')) {
+                               k.operaDialog.show();
+                               return;
+                       }
+
+                       var version = getBrowserVersion();
+
+                       var c = '';
+                       if (parseFloat(version.full) >= 12.10) {
+                               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>";
+                       } else {
+                               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>";
+                               //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>";
+                               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>";
+                       }
+                       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'>";
+                       
+                       var bottom = '';
+                       bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm reloadNow" role="button"><span class="uiButtonText">'+CURRENTLANG.reloadNow+'</span></a>';
+                       bottom += '<a href="#" class="uiButton uiButtonLarge notNow" role="button"><span class="uiButtonText">'+CURRENTLANG.notNow+'</span></a>';
+                       
+                       k.operaDialog = new Dialog('update_opera');
+                       k.operaDialog.alwaysModal = true;
+                       k.operaDialog.create();
+                       k.operaDialog.changeTitle(CURRENTLANG.updater_title);
+                       k.operaDialog.changeContent(c);
+                       k.operaDialog.changeBottom(bottom);
+
+                       k._initReloadButtons(k.operaDialog);
+               };
+
+               k.safariDialog = null;
+               k.safariInstruction = function() {
+                       if (k.safariDialog) {
+                               k.safariDialog.show();
+                               return;
+                       }
+
+                       injectManualStyle('#ponyhoof_dialog_update_safari .generic_dialog_popup, #ponyhoof_dialog_update_safari .popup {width:600px;}', 'update_safari');
+
+                       var c = '';
+                       if (w.navigator.userAgent.indexOf('Mac OS X') != -1) {
+                               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>";
+                               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'>";
+                       } else {
+                               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>";
+                               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'>";
+                       }
+                       
+                       var bottom = '';
+                       bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm reloadNow" role="button"><span class="uiButtonText">'+CURRENTLANG.reloadNow+'</span></a>';
+                       bottom += '<a href="#" class="uiButton uiButtonLarge notNow" role="button"><span class="uiButtonText">'+CURRENTLANG.notNow+'</span></a>';
+                       
+                       k.safariDialog = new Dialog('update_safari');
+                       k.safariDialog.alwaysModal = true;
+                       k.safariDialog.create();
+                       k.safariDialog.changeTitle(CURRENTLANG.updater_title);
+                       k.safariDialog.changeContent(c);
+                       k.safariDialog.changeBottom(bottom);
+
+                       k._initReloadButtons(k.safariDialog);
+               };
+
+               k.xpiDialog = null;
+               k._xpi = function() {
+                       if (k.xpiDialog) {
+                               k.xpiDialog.show();
+                               return;
+                       }
+
+                       var c = '';
+                       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>";
+                       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'>";
+                       
+                       var bottom = '';
+                       bottom += '<div class="lfloat"><a href="#" class="retry">Retry</a></div>';
+                       bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm reloadNow" role="button"><span class="uiButtonText">'+CURRENTLANG.reloadNow+'</span></a>';
+                       bottom += '<a href="#" class="uiButton uiButtonLarge notNow" role="button"><span class="uiButtonText">'+CURRENTLANG.notNow+'</span></a>';
+                       
+                       k.xpiDialog = new Dialog('update_xpi');
+                       k.xpiDialog.alwaysModal = true;
+                       k.xpiDialog.create();
+                       k.xpiDialog.changeTitle(CURRENTLANG['updater_title']);
+                       k.xpiDialog.changeContent(c);
+                       k.xpiDialog.changeBottom(bottom);
+
+                       var retry = k.xpiDialog.dialog.getElementsByClassName('retry');
+                       if (retry.length) {
+                               retry = retry[0];
+                               retry.href = k.update_json.xpi;
+                       }
+                       k._initReloadButtons(k.xpiDialog);
+
+                       try {
+                               USW.InstallTrigger.install({
+                                       "Ponyhoof": {
+                                                URL: k.update_json.xpi
+                                               ,IconURL: 'https://hoof.little.my/files/app32.png'
+                                       }
+                               });
+                       } catch (e) {
+                               dir(e);
+                       }
+               };
+
+               k._initReloadButtons = function(dialog) {
+                       $$(dialog.dialog, '.reloadNow', function(ele) {
+                               ele.addEventListener('click', function() {
+                                       if (!hasClass(this, 'uiButtonDisabled')) {
+                                               dialog.canCloseByEscapeKey = false;
+                                               $$(dialog.dialog, '.uiButton', function(ele) {
+                                                       addClass(ele, 'uiButtonDisabled');
+                                               });
+                                               w.location.reload();
+                                       }
+                                       return false;
+                               });
+                       });
+
+                       $$(dialog.dialog, '.notNow', function(ele) {
+                               ele.addEventListener('click', function() {
+                                       if (!hasClass(this, 'uiButtonDisabled')) {
+                                               dialog.close();
+                                       }
+                                       return false;
+                               });
+                       });
+               };
+       };
+       
+       var BrowserPoniesHoof = function() {
+               var k = this;
+               
+               k.dialog = null;
+               k.errorDialog = null;
+               k.url = 'https://hoof.little.my/_browserponies/';
+               k.initLoaded = false;
+               k.ponies = [];
+               k.ponySelected = 'RANDOM';
+               k.doneCallback = function() {};
+
+               k.selectPoniesMenu = null;
+               k.selectPoniesButton = null;
+               
+               k.run = function() {
+                       if (!k.initLoaded) {
+                               k._init(k.run);
+                               return;
+                       }
+
+                       k.spawnPony(k.ponySelected);
+
+                       if (k.doneCallback) {
+                               k.doneCallback();
+                       }
+               };
+
+               k._init = function(callback) {
+                       k._getAjax(k.url+'BrowserPoniesBaseConfig.json?userscript_version='+VERSION, function(response) {
+                               try {
+                                       var tempPonies = JSON.parse(response.responseText);
+                               } catch (e) {
+                                       if (k.errorCallback) {
+                                               k.errorCallback(response);
+                                       }
+                                       return;
+                               }
+                               contentEval("var BrowserPoniesBaseConfig = "+response.responseText);
+
+                               for (var i = 0, len = tempPonies.ponies.length; i < len; i += 1) {
+                                       var pony = tempPonies.ponies[i].ini.split(/\r?\n/);
+                                       for (var j = 0, jLen = pony.length; j < jLen; j += 1) {
+                                               var temp = pony[j].split(',');
+                                               if (temp && temp[0].toLowerCase() == 'name') {
+                                                       k.ponies.push(temp[1].replace(/\"/g, ''));
+                                                       break;
+                                               }
+                                       }
+                               }
+
+                               k._getAjax(k.url+'browserponies.js?userscript_version='+VERSION, function(response) {
+                                       contentEval(response.responseText);
+                                       k.initLoaded = true;
+
+                                       contentEval(function(arg) {
+                                               try {
+                                                       (function(cfg) {
+                                                               if (typeof(window.BrowserPoniesConfig) === "undefined") {
+                                                                       window.BrowserPoniesConfig = {};
+                                                               }
+                                                               window.BrowserPonies.setBaseUrl(cfg.baseurl);
+                                                               if (!window.BrowserPoniesBaseConfig.loaded) {
+                                                                       window.BrowserPonies.loadConfig(window.BrowserPoniesBaseConfig);
+                                                                       window.BrowserPoniesBaseConfig.loaded = true;
+                                                               }
+                                                               window.BrowserPonies.loadConfig(cfg);
+                                                       })({"baseurl":arg.baseurl,"fadeDuration":500,"volume":1,"fps":25,"speed":3,"audioEnabled":false,"showFps":false,"showLoadProgress":true,"speakProbability":0.1});
+                                               } catch (e) {
+                                                       if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
+                                                               console.log("Unable to hook to BrowserPonies");
+                                                               console.dir(e);
+                                                       }
+                                               }
+                                       }, {"CANLOG":CANLOG, "baseurl":k.url});
+
+                                       callback();
+                               });
+                       });
+               }
+
+               k._getAjax = function(url, callback) {
+                       try {
+                               ajax({
+                                        method: 'GET'
+                                       ,url: url
+                                       ,onload: function(response) {
+                                               if (response.status != 200) {
+                                                       if (k.errorCallback) {
+                                                               k.errorCallback(response);
+                                                       }
+                                                       return;
+                                               }
+                                               
+                                               callback(response);
+                                       }
+                                       ,onerror: function(response) {
+                                               if (k.errorCallback) {
+                                                       k.errorCallback(response);
+                                               }
+                                       }
+                               });
+                       } catch (e) {
+                               if (k.errorCallback) {
+                                       k.errorCallback(e);
+                               }
+                       }
+               };
+               
+               k.createDialog = function() {
+                       if ($('ponyhoof_dialog_browserponies')) {
+                               k.dialog.show();
+                               return;
+                       }
+                       
+                       k.injectStyle();
+                       
+                       var c = '';
+                       c += '<div id="ponyhoof_bp_select"></div><br>';
+                       c += '<a href="#" class="uiButton uiButtonConfirm" role="button" id="ponyhoof_bp_more"><span class="uiButtonText">MORE PONY!</span></a><br><br>';
+                       c += '<a href="#" class="uiButton" role="button" id="ponyhoof_bp_close"><span class="uiButtonText">Hide this</span></a><br><br>';
+                       c += '<a href="#" class="uiButton" role="button" id="ponyhoof_bp_remove"><span class="uiButtonText">Reset</span></a>';
+                       
+                       k.dialog = new Dialog('browserponies');
+                       k.dialog.canCloseByEscapeKey = false;
+                       k.dialog.canCardspace = false;
+                       k.dialog.noTitle = true;
+                       k.dialog.noBottom = true;
+                       k.dialog.create();
+                       k.dialog.changeContent(c);
+                       
+                       $('ponyhoof_bp_more').addEventListener('click', k.morePonies, false);
+                       $('ponyhoof_bp_close').addEventListener('click', k.closeDialog, false);
+                       $('ponyhoof_bp_remove').addEventListener('click', k.clearAll, false);
+
+                       k.selectPoniesMenu = new Menu('browserponies_select', $('ponyhoof_bp_select'));
+                       k.selectPoniesMenu.rightFaced = true;
+                       k.selectPoniesMenu.buttonTextClipped = 59;
+                       k.selectPoniesButton = k.selectPoniesMenu.createButton("(Random)");
+                       k.selectPoniesMenu.createMenu();
+                       k.selectPoniesMenu.attachButton();
+
+                       k.selectPoniesMenu.createMenuItem({
+                                html: "(Random)"
+                               ,check: true
+                               ,unsearchable: true
+                               ,onclick: function(menuItem, menuClass) {
+                                       k._select_spawn(menuItem, menuClass, 'RANDOM');
+                               }
+                       });
+                       for (var code in k.ponies) {
+                               if (k.ponies.hasOwnProperty(code)) {
+                                       k._select_item(code);
+                               }
+                       }
+
+                       k.dialog.show();
+               };
+               
+               k._select_item = function(code) {
+                       var pony = k.ponies[code];
+                       k.selectPoniesMenu.createMenuItem({
+                                html: pony
+                               ,onclick: function(menuItem, menuClass) {
+                                       k._select_spawn(menuItem, menuClass, pony);
+                               }
+                       });
+               };
+
+               k._select_spawn = function(menuItem, menuClass, pony) {
+                       menuClass.changeChecked(menuItem);
+                       menuClass.close();
+
+                       if (pony == 'RANDOM') {
+                               menuClass.changeButtonText("(Random)");
+                       } else {
+                               menuClass.changeButtonText(pony);
+                       }
+
+                       k.ponySelected = pony;
+                       k.spawnPony(pony);
+               };
+
+               k.spawnPony = function(pony) {
+                       contentEval(function(arg) {
+                               try {
+                                       if (arg.pony == 'RANDOM') {
+                                               window.BrowserPonies.spawnRandom();
+                                       } else {
+                                               window.BrowserPonies.spawn(arg.pony);
+                                       }
+                                       if (!window.BrowserPonies.running()) {
+                                               window.BrowserPonies.start();
+                                       }
+                               } catch (e) {
+                                       if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
+                                               console.log("Unable to hook to BrowserPonies");
+                                               console.dir(e);
+                                       }
+                               }
+                       }, {"CANLOG":CANLOG, "pony":pony});
+               };
+
+               k.createErrorDialog = function(response) {
+                       createSimpleDialog('browserponies_error', "Browser Ponies derp'd", "An error occurred loading Browser Ponies. Please try again later and update to the latest version of Ponyhoof if available.");
+               }
+
+               k.injectStyle = function() {
+                       var css = '';
+                       css += '#ponyhoof_dialog_browserponies .generic_dialog {z-index:100000000 !important;}';
+                       css += '#ponyhoof_dialog_browserponies .generic_dialog_popup {width:'+(88+8+8+8+10+10)+'px;margin:'+(38+8)+'px 8px 0 auto;}';
+                       css += 'body.hasSmurfbar #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-top:'+(42+8)+'px;}';
+                       css += 'body.hasVoiceBar #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-top:'+(56+8)+'px;}';
+                       css += 'body.hasSmurfbar.hasVoiceBar #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-top:'+(70+8)+'px;}';
+                       css += 'body.hasViewasChromeBar #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-top:'+(76+8)+'px;}';
+                       css += 'body.hasSmurfbar.hasViewasChromeBar #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-top:'+(80+8)+'px;}';
+                       css += '.sidebarMode #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-right:213px;}';
+                       css += '._4g5r #ponyhoof_dialog_browserponies .generic_dialog_popup, .-cx-PUBLIC-hasLitestandBookmarksSidebar__root #ponyhoof_dialog_browserponies .generic_dialog_popup {margin-right:8px;}';
+                       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;}';
+                       css += '#ponyhoof_dialog_browserponies .popup:hover {opacity:1;}';
+                       css += '#ponyhoof_dialog_browserponies .content {background:#F2F2F2;text-align:center;}';
+                       css += '#ponyhoof_dialog_browserponies .uiButton {text-align:left;}';
+                       css += '#browser-ponies img {-webkit-user-select:none;-moz-user-select:none;user-select:none;}';
+                       injectManualStyle(css, 'browserponies');
+               };
+               
+               k.copyrightDialog = function() {
+                       createSimpleDialog('browserponies_copyright', "Browser Ponies", "<a href='http://panzi.github.io/Browser-Ponies/' target='_blank'>Browser Ponies</a> is created by Mathias Panzenb&ouml;ck, licensed under the <a href='http://opensource.org/licenses/mit-license.html' target='_blank'>MIT License</a>. Based on Desktop Ponies written by <a href='mailto:random.anonymous.pony@gmail.com'>random.anonymous.pony@gmail.com</a>");
+               };
+
+               k.morePonies = function(e) {
+                       k.spawnPony(k.ponySelected);
+                       if (e) {
+                               e.preventDefault();
+                       }
+               };
+
+               k.closeDialog = function(e) {
+                       k.dialog.close();
+                       if (e) {
+                               e.preventDefault();
+                       }
+               };
+
+               k.clearAll = function(e) {
+                       //k.closeDialog();
+                       contentEval(function(arg) {
+                               try {
+                                       window.BrowserPonies.unspawnAll();
+                                       window.BrowserPonies.stop();
+                               } catch (e) {
+                                       if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
+                                               console.log("Unable to hook to BrowserPonies");
+                                               console.dir(e);
+                                       }
+                               }
+                       }, {"CANLOG":CANLOG});
+                       if (e) {
+                               e.preventDefault();
+                       }
+               };
+       };
+       
+       // Options
+       var Options = function() {
+               var k = this;
+               
+               k.dialog = null;
+               k.saveButton = null;
+               
+               k.needToSaveLabel = false;
+               k.needToRefresh = false;
+               k.canSaveSettings = true;
+               
+               k._stack = CURRENTSTACK;
+               
+               k.created = false;
+               k.create = function() {
+                       // Did we create our Options interface already?
+                       if ($('ponyhoof_dialog_options')) {
+                               k._refreshDialog();
+                               return false;
+                       }
+                       
+                       k.injectStyle();
+                       
+                       if (!runMe) {
+                               var extra = '';
+                               if (ISCHROME) {
+                                       extra = '<br><br><a href="http://jointheherd.little.my" target="_top">Please update to the latest version of Ponyhoof here.</a>';
+                               }
+                               
+                               k.dialog = new Dialog('options_force_run');
+                               k.dialog.create();
+                               k.dialog.changeTitle("Ponyhoof does not run on "+w.location.hostname);
+                               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);
+                               k.dialog.addCloseButton();
+                               return;
+                       }
+                       
+                       var c = '';
+                       c += '<div class="ponyhoof_tabs clearfix">';
+                               c += '<a href="#" class="active" data-ponyhoof-tab="main">'+CURRENTLANG.options_tabs_main+'</a>';
+                               c += '<a href="#" class="ponyhoof_show_if_injected" data-ponyhoof-tab="background">'+CURRENTLANG.options_tabs_background+'</a>';
+                               c += '<a href="#" class="ponyhoof_show_if_injected" data-ponyhoof-tab="sounds">'+CURRENTLANG.options_tabs_sounds+'</a>';
+                               c += '<a href="#" data-ponyhoof-tab="extras">'+CURRENTLANG.options_tabs_extras+'</a>';
+                               c += '<a href="#" data-ponyhoof-tab="advanced">'+CURRENTLANG.options_tabs_advanced+'</a>';
+                               c += '<a href="#" data-ponyhoof-tab="about">'+CURRENTLANG.options_tabs_about+'</a>';
+                       c += '</div>';
+                       
+                       c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_main" style="display:block;">';
+                       //c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_main">';
+                               c += '<div class="clearfix">';
+                               c += '<a href="#" ajaxify="/ajax/sharer/?s=18&amp;p[]='+PONYHOOF_PAGE+'" rel="dialog" class="uiButton uiButtonSpecial rfloat ponyhoof_noShareIsCare" role="button" data-hover="tooltip" data-tooltip-alignh="right" aria-label="'+CURRENTLANG.fb_share_tooltip+'"><span class="uiButtonText">Share with your pals!</span></a>';
+                               
+                               var visitPageText = CURRENTLANG.settings_main_visitPage;
+                               if (ISUSINGBUSINESS) {
+                                       visitPageText = CURRENTLANG.settings_main_visitPageBusiness;
+                               }
+
+                               c += '<div class="ponyhoof_show_if_injected">Select your favorite character:</div>';
+                               c += '<div class="ponyhoof_hide_if_injected">Select your favorite character to re-enable Ponyhoof:</div>';
+                               c += '<div id="ponyhoof_options_pony"></div>';
+                               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>';
+                               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>';
+                               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>';
+                               c += '<div class="ponyhoof_show_if_injected"><a href="#" class="ponyhoof_options_fatlink" id="ponyhoof_options_disable">Disable Ponyhoof</a></div>';
+
+                                       c += '<div class="ponyhoof_message uiBoxYellow ponyhoof_updater_newVersion">';
+                                               c += '<a href="#" class="uiButton uiButtonSpecial rfloat ponyhoof_updater_updateNow" role="button"><span class="uiButtonText">Update now</span></a>';
+                                               c += '<span class="wrap">An update (v<span class="ponyhoof_updater_versionNum"></span>) for Ponyhoof is available.</span>';
+                                       c += '</div>';
+                                       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>';
+                               c += '</div>';
+                       c += '</div>';
+                       
+                       c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_background">';
+                               c += '<div class="ponyhoof_show_if_injected">';
+                                       c += 'Use as background:';
+                                       c += '<ul class="ponyhoof_options_fatradio clearfix">';
+                                               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>';
+                                               c += '<li id="ponyhoof_options_background_loginbg" data-ponyhoof-background="loginbg"><a href="#"><span>Background</span><div class="wrap"><i></i></div></a></li>';
+                                               c += '<li id="ponyhoof_options_background_custom" data-ponyhoof-background="custom"><a href="#"><span>Custom</span><div class="wrap"><i></i></div></a></li>';
+                                       c += '</ul>';
+
+                                       c += '<div class="ponyhoof_message uiBoxRed hidden_elem" id="ponyhoof_options_background_error"></div>';
+                                       c += '<div id="ponyhoof_options_background_drop">';
+                                               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="Maximum file size is 1 MB.\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."></a><br><br>Or browse for an image: <input type="file" id="ponyhoof_options_background_select" accept="image/*"></div>';
+                                               c += '<div id="ponyhoof_options_background_drop_dropping">Drop here</div>';
+                                       c += '</div>';
+                               c += '</div>';
+                       c += '</div>';
+
+                       c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_sounds">';
+                               c += '<div class="ponyhoof_show_if_injected">';
+                                       c += '<div class="ponyhoof_message uiBoxRed hidden_elem unavailable">'+CURRENTLANG.settings_sounds_unavailable+'</div>';
+
+                                       var soundsText = CURRENTLANG.settings_sounds;
+                                       if (ISUSINGPAGE || ISUSINGBUSINESS) {
+                                               soundsText = CURRENTLANG.settings_sounds_noNotification;
+                                       }
+
+                                       c += '<div class="available">';
+                                               c += '<div class="ponyhoof_message uiBoxYellow notPage">Sounds are experimental, they might derp from time to time.</div>';
+                                               c += '<div class="ponyhoof_message uiBoxRed usingPage">Notification sounds are not available when you are using Facebook as your page.</div><br>';
+                                               c += k.generateCheckbox('sounds', soundsText, {customFunc:k.soundsClicked});
+                                               c += '<div class="notPage notBusiness"><br>';
+                                                       c += '<div id="ponyhoof_options_soundsSettingsWrap">';
+                                                               c += '<div id="ponyhoof_options_soundsSetting" class="ponyhoof_menu_withlabel"><span class="ponyhoof_menu_label">Notification sound: </span></div>';
+                                                               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>';
+                                                               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>';
+                                                       c += '</div>';
+                                               c += '</div>';
+
+                                               c += '<div class="notPage notBusiness"><br>';
+                                               c += '<span class="ponyhoof_dialog_header">Chat</span>';
+                                                       c += '<div class="ponyhoof_message uiBoxYellow notPage hidden_elem" id="ponyhoof_options_soundsChatSoundWarning">';
+                                                               c += '<a href="#" class="uiButton uiButtonConfirm rfloat" role="button"><span class="uiButtonText">Enable now</span></a>';
+                                                               c += '<span class="wrap">The chat sound option built into Facebook needs to be enabled.</span>';
+                                                       c += '</div>';
+                                                       c += k.generateCheckbox('chatSound', "Change chat sound", {customFunc:k.chatSound});
+                                                               c += '<div id="ponyhoof_options_soundsChatWrap">';
+                                                                       c += '<div id="ponyhoof_options_soundsChatSetting" class="ponyhoof_menu_withlabel"><span class="ponyhoof_menu_label">Chat sound: </span></div>';
+                                                               c += '</div>';
+                                               c += '</div>';
+                                       c += '</div>'; // .available
+                               c += '</div>';
+                               c += '<div class="ponyhoof_hide_if_injected ponyhoof_message uiBoxRed">';
+                                       c += 'You must enable Ponyhoof to use Ponyhoof sounds.';
+                               c += '</div>';
+                       c += '</div>';
+
+                       c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_extras">';
+                               c += '<div class="ponyhoof_show_if_injected">';
+                                       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'});
+                                       c += k.generateCheckbox('pinkieproof', "Strengthen the fourth wall", {title:"Prevents Pinkie Pie from breaking the fourth wall for non-villains"});
+                               c += '</div>';
+                               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});
+                               c += '<div class="ponyhoof_show_if_injected">';
+                                       c += k.generateCheckbox('disable_emoticons', "Disable emoticon ponification");
+                                       c += '<div id="ponyhoof_options_randomPonies" class="ponyhoof_menu_withlabel"><span class="ponyhoof_menu_label">Who to randomize: </span></div>';
+                                       c += '<div id="ponyhoof_options_costume" class="ponyhoof_menu_withlabel"><span class="ponyhoof_menu_label">Appearance: </span></div>';
+                               c += '</div>';
+                               c += '<div class="ponyhoof_hide_if_injected"><br></div>';
+
+                               c += '<span class="ponyhoof_dialog_header">Multi-user</span>';
+                               c += k.generateCheckbox('allowLoginScreen', "Run Ponyhoof on the Facebook login screen", {global:true});
+                               c += k.generateCheckbox('runForNewUsers', "Run Ponyhoof for new users", {title:CURRENTLANG['settings_extras_runForNewUsers_explain'], global:true});
+                               c += '<br>';
+
+                               c += '<div class="ponyhoof_show_if_injected">';
+                                       c += '<span class="ponyhoof_dialog_header">Performance</span>';
+                                       c += k.generateCheckbox('disable_animation', "Disable all animations");
+                                       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});
+                                       c += '<br>';
+                               c += '</div>';
+                               
+                               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>';
+                               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>';
+                       c += '</div>';
+                       
+                       c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_advanced">';
+                               c += '<div class="ponyhoof_message uiBoxYellow">These features are unsupported and used for debugging. This should be used by advanced users only.</div><br>';
+                               c += '<span class="ponyhoof_show_if_loaded inline">Style version <span class="ponyhoof_VERSION_CSS"></span><br><br></span>';
+
+                               c += '<textarea id="ponyhoof_options_technical" READONLY spellcheck="false"></textarea><br><br>';
+                               
+                               if (STORAGEMETHOD == 'localstorage') {
+                                       c += '<span class="ponyhoof_dialog_header">localStorage dump</span>';
+                                       c += '<textarea id="ponyhoof_options_dump" READONLY spellcheck="false"></textarea><br><br>';
+                               }
+                               
+                               c += '<div class="ponyhoof_show_if_injected">';
+                                       c += '<span class="ponyhoof_dialog_header">Custom CSS</span>';
+                                       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>';
+                                       c += '<a href="#" class="uiButton" role="button" id="ponyhoof_options_customcss_preview"><span class="uiButtonText">Preview</span></a><br><br>';
+                               c += '</div>';
+                               
+                               c += '<span class="ponyhoof_dialog_header">Settings</span>';
+                               c += '<textarea id="ponyhoof_options_debug_settings" spellcheck="false"></textarea>';
+                               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>';
+                               
+                               c += '<span class="ponyhoof_dialog_header">Other</span>';
+                               c += '<div class="ponyhoof_hide_if_injected ponyhoof_message uiBoxYellow">';
+                                       c += 'You must enable Ponyhoof to use custom CSS or dump debug data.';
+                               c += '</div>';
+
+                               c += k.generateCheckbox('debug_exposed', "Always show Debug tab");
+                               c += k.generateCheckbox('debug_slow_load', "Disable fast load");
+                               c += '<div class="ponyhoof_show_if_injected">';
+                                       c += k.generateCheckbox('debug_dominserted_console', "Dump DOMNodeInserted data to console");
+                                       c += k.generateCheckbox('debug_disablelog', "Disable console logging", {customFunc:k.debug_disablelog});
+                                       c += k.generateCheckbox('debug_noMutationObserver', "Use legacy HTML detection (slower)", {refresh:true});
+                                       c += k.generateCheckbox('debug_mutationDebug', "Dump mutation debug info to console");
+                                       c += k.generateCheckbox('debug_betaFacebookLinks', "Rewrite links on beta.facebook.com", {refresh:true});
+                                       c += '<a href="#" id="ponyhoof_options_tempRemove" class="ponyhoof_options_fatlink">Remove style</a>';
+                               c += '</div>';
+                               c += '<a href="#" id="ponyhoof_options_sendSource" class="ponyhoof_options_fatlink">Send page source</a>';
+                               c += '<a href="#" class="ponyhoof_options_fatlink" id="ponyhoof_options_clearLocalStorage" data-hover="tooltip">Reset all settings (including global)</a>';
+                       c += '</div>';
+                       
+                       c += '<div class="ponyhoof_tabs_section" id="ponyhoof_options_tabs_about">';
+                               c += '<div class="clearfix">';
+                               c += '<div class="top">';
+                               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"><'+'img src="'+THEMEURL+'icon100.png" alt="" width="50" height="50"></a>';
+                               c += '</div>';
+                               c += '<strong>Ponyhoof v'+VERSION+'</strong><br>';
+                               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>';
+                               c += '</div>';
+                               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>';
+                               if (ISCHROME || (STORAGEMETHOD == 'chrome' && !ISOPERABLINK)) {
+                                       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>';
+                               }
+                               c += '<iframe src="about:blank" id="ponyhoof_options_twitter" allowtransparency="true" frameborder="0" scrolling="no"></iframe>';
+                               if (ISCHROME || STORAGEMETHOD == 'chrome') {
+                                       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>';
+                               }
+
+                               c += '<div class="ponyhoof_options_aboutsection"><div class="inner">';
+                               c += '<strong>If you love Ponyhoof, then please help us a hoof and contribute to support development! Thanks!</strong><br><br>';
+                               c += '<div id="ponyhoof_donate" class="clearfix">';
+                                 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>';
+                                 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>
+                               c += '</div>';
+                               c += '</div></div>';
+
+                               c += '<div class="ponyhoof_options_aboutsection"><div class="inner">The Ponyhoof extension for Facebook is not affiliated or endorsed by Facebook and/or Hasbro in any way. MY LITTLE PONY, FRIENDSHIP IS MAGIC and all related characters are trademarks of Hasbro. &copy; '+(new Date().getFullYear())+' Hasbro. All Rights Reserved.</div></div>';
+                               c += '</div>';
+                       c += '</div>';
+                       
+                       var successText = '';
+                       var ponyData = convertCodeToData(CURRENTPONY);
+                       if (ponyData.successText) {
+                               successText = ponyData.successText+' ';
+                       }
+                       var bottom = '';
+                       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>';
+                       bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm" role="button" id="ponyhoof_options_save"><span class="uiButtonText">'+CURRENTLANG.close+'</span></a>';
+                       
+                       k.dialog = new Dialog('options');
+                       k.dialog.create();
+                       k.dialog.changeTitle(CURRENTLANG.options_title);
+                       k.dialog.changeContent(c);
+                       k.dialog.changeBottom(bottom);
+                       k.dialog.onclose = k.dialogOnClose;
+                       k.dialog.onclosefinish = k.dialogOnCloseFinish;
+                       k.created = true;
+                       
+                       // After
+                       k.saveButton = $('ponyhoof_options_save');
+                       k.saveButton.addEventListener('click', k.saveButtonClick, false);
+                       
+                       k.dialog.dialog.getElementsByClassName('ponyhoof_noShareIsCare')[0].addEventListener('click', function() {
+                               k.dialog.close();
+                       }, false);
+                       
+                       var l = k.dialog.dialog.getElementsByClassName('ponyhoof_options_linkclick');
+                       for (var i = 0, len = l.length; i < len; i += 1) {
+                               l[i].addEventListener('click', function() {
+                                       k.dialog.close();
+                               }, false);
+                       }
+                       
+                       // Updater
+                       w.setTimeout(function() {
+                               var update = new Updater();
+                               update.checkForUpdates();
+                       }, 500);
+
+                       k.checkboxInit();
+                       k.tabsInit();
+
+                       // @todo make k.mainInit non-dependant
+                       k.mainInit();
+                       
+                       k._refreshDialog();
+
+                       if (userSettings.debug_exposed) {
+                               addClass(k.dialog.dialog, 'ponyhoof_options_debugExposed');
+                       }
+               };
+               
+               k._refreshDialog = function() {
+                       k.ki();
+                       k.disableDomNodeInserted();
+                       
+                       if (k.debugLoaded) {
+                               $('ponyhoof_options_technical').textContent = k.techInfo();
+                               //$('ponyhoof_options_linkedcss').textContent = k.linkedCss();
+                       }
+               };
+               
+               k.debugLoaded = false;
+               k.techInfo = function() {
+                       var cxPrivate = false;
+                       if (d.getElementsByClassName('-cx-PRIVATE-fbLayout__root').length) {
+                               cxPrivate = true;
+                       }
+
+                       var tech = SIG + " " + new Date().toString() + "\n";
+                       tech += "USERID: " + USERID + "\n";
+                       tech += "CURRENTPONY: " + CURRENTPONY + "\n";
+                       tech += "REALPONY: " + REALPONY + "\n";
+                       tech += "CURRENTSTACK: " + CURRENTSTACK.stack + "\n";
+                       tech += "STORAGEMETHOD: " + STORAGEMETHOD + "\n";
+                       tech += "DISTRIBUTION: " + DISTRIBUTION + "\n";
+                       if (STORAGEMETHOD == 'localstorage') {
+                               tech += "localStorage.length: " + localStorage.length + "\n";
+                       }
+                       tech += "\n";
+                       tech += "navigator.userAgent: " + w.navigator.userAgent + "\n";
+                       tech += "document.documentElement.className: " + d.documentElement.className + "\n";
+                       tech += "document.body.className: " + d.body.className + "\n";
+                       tech += "Has cx-PRIVATE: " + cxPrivate + "\n";
+                       tech += "window.location.href: " + w.location.href + "\n";
+                       tech += "\n";
+                       tech += k.linkedCss();
+                       tech += "\n";
+                       tech += k.linkedScript();
+                       tech += "\n";
+                       tech += k.linkedIframe();
+                       tech += "\n";
+
+                       var ext = [];
+                       var conflict = [];
+                       if ($('bfb_options_button')) {
+                               ext.push("Social Fixer");
+                       }
+                       if (d.getElementsByClassName('rg3fbpz-tooltip').length) {
+                               ext.push("Photo Zoom for Facebook");
+                       }
+                       if ($('fbpoptslink')) {
+                               ext.push("FB Purity");
+                       }
+                       if ($('fbfPopupContainer')) {
+                               ext.push("FFixer");
+                       }
+                       if ($('unfriend_finder')) {
+                               ext.push("Unfriend Finder");
+                       }
+                       if ($('window-resizer-tooltip')) {
+                               ext.push("Window Resizer");
+                       }
+                       if ($('hzImg')) {
+                               ext.push("Hover Zoom");
+                       }
+                       if ($('myGlobalPonies')) {
+                               ext.push("My Global Ponies");
+                       }
+                       if ($('memeticonStyle')) {
+                               ext.push("Memeticon (ads)");
+                       }
+                       if ($('socialplus')) {
+                               ext.push("SocialPlus! (ads)");
+                       }
+                       if (d.querySelector('script[src^="chrome-extension://igdhbblpcellaljokkpfhcjlagemhgjl"]')) {
+                               ext.push("Iminent (ads)");
+                       }
+                       if ($('_fbm-emoticons-wrapper')) {
+                               ext.push("myemoticons.com");
+                       }
+                       if (d.querySelector('script[src^="chrome-extension://lifbcibllhkdhoafpjfnlhfpfgnpldfl"]')) {
+                               ext.push("Skype plugin");
+                       }
+                       if (d.querySelector('script[src^="chrome-extension://jmfkcklnlgedgbglfkkgedjfmejoahla"]')) {
+                               ext.push("AVG Safe Search");
+                       }
+                       if ($('DAPPlugin')) {
+                               ext.push("Download Accelerator Plus");
+                       }
+
+                       if ($('bfb_theme')) {
+                               conflict.push("Social Fixer theme");
+                       }
+                       if ($('mycssstyle')) {
+                               conflict.push("SocialPlus! theme");
+                       }
+                       if ($('ColourChanger')) {
+                               conflict.push("Facebook Colour Changer");
+                       }
+                       if (hasClass(d.documentElement, 'myFacebook')) {
+                               conflict.push("Color My Facebook");
+                       }
+                       if (w.navigator.userAgent.match(/Mozilla\/4\.0 \(compatible\; MSIE 7\.0\; Windows/)) {
+                               conflict.push("IE 7 user-agent spoofing");
+                       }
+                       tech += "Installed extensions: ";
+                       if (ext.length) {
+                               for (var i = 0, len = ext.length; i < len; i += 1) {
+                                       tech += ext[i];
+                                       if (ext.length-1 != i) {
+                                               tech += ', ';
+                                       }
+                               }
+                       } else {
+                               tech += "None detected";
+                       }
+                       tech += "\n";
+
+                       tech += "Conflicts: ";
+                       if (conflict.length) {
+                               for (var i = 0, len = conflict.length; i < len; i += 1) {
+                                       tech += conflict[i];
+                                       if (conflict.length-1 != i) {
+                                               tech += ', ';
+                                       }
+                               }
+                       } else {
+                               tech += "None detected";
+                       }
+                       tech += "\n";
+                       
+                       return tech;
+               };
+               
+               k.linkedCss = function() {
+                       var css = d.getElementsByTagName('link');
+                       var t = '';
+                       for (var i = 0, len = css.length; i < len; i += 1) {
+                               if (css[i].rel == 'stylesheet') {
+                                       t += css[i].href + "\n";
+                               }
+                       }
+                       
+                       return t;
+               };
+               
+               k.linkedScript = function() {
+                       var script = d.getElementsByTagName('script');
+                       var t = '';
+                       for (var i = 0, len = script.length; i < len; i += 1) {
+                               if (script[i].src) {
+                                       t += script[i].src + "\n";
+                               }
+                       }
+                       
+                       return t;
+               };
+               
+               k.linkedIframe = function() {
+                       var iframe = d.getElementsByTagName('iframe');
+                       var t = '';
+                       for (var i = 0, len = iframe.length; i < len; i += 1) {
+                               if (iframe[i].src && iframe[i].src.indexOf('://'+getFbDomain()+'/ai.php') == -1) {
+                                       t += iframe[i].src + "\n";
+                               }
+                       }
+                       
+                       return t;
+               };
+               
+               k.debugInfo = function() {
+                       if (k.debugLoaded) {
+                               return;
+                       }
+                       k.debugLoaded = true;
+                       
+                       // Custom CSS
+                       var customcss = $('ponyhoof_options_customcss');
+                       if (userSettings.customcss) {
+                               customcss.value = userSettings.customcss;
+                       }
+                       customcss.addEventListener('input', function() {
+                               if (!k.needsToRefresh) {
+                                       k.needsToRefresh = true;
+                                       k.updateCloseButton();
+                               }
+                       }, false);
+                       $('ponyhoof_options_customcss_preview').addEventListener('click', function() {
+                               if (!$('ponyhoof_style_customcss')) {
+                                       injectManualStyle('', 'customcss');
+                               }
+                               
+                               $('ponyhoof_style_customcss').textContent = '/* '+SIG+' */'+customcss.value;
+                       }, false);
+                       
+                       // Technical info
+                       var techFirstHover = false;
+                       $('ponyhoof_options_technical').addEventListener('click', function() {
+                               if (!techFirstHover) {
+                                       techFirstHover = true;
+                                       this.focus();
+                                       this.select();
+                               }
+                       }, false);
+                       
+                       if (STORAGEMETHOD == 'localstorage') {
+                               var dump = '';
+                               for (i in localStorage) {
+                                       dump += i+": "+localStorage[i]+"\n";
+                               }
+                               $('ponyhoof_options_dump').value = dump;
+                       }
+                       
+                       // Settings
+                       var settingsTextarea = $('ponyhoof_options_debug_settings');
+
+                       $('ponyhoof_options_debug_settings_export').addEventListener('click', function() {
+                               settingsTextarea.value = JSON.stringify(userSettings);
+                       }, false);
+
+                       $('ponyhoof_options_debug_settings_saveall').addEventListener('click', function(e) {
+                               e.preventDefault();
+                               try {
+                                       var s = JSON.parse(settingsTextarea.value);
+                               } catch (e) {
+                                       createSimpleDialog('debug_settingsKey_error', "Derp'd", "Invalid JSON<br><br><code>\n\n"+e.toString()+"</code>");
+                                       return false;
+                               }
+
+                               if (confirm(SIG+" Are you sure you want to overwrite your settings? Facebook will be reloaded immediately after saving.")) {
+                                       userSettings = s;
+                                       saveSettings();
+                                       w.location.reload();
+                               }
+                       }, false);
+
+                       // Other
+                       $('ponyhoof_options_tempRemove').addEventListener('click', k._debugRemoveStyle, false);
+                       k._debugNoMutationObserver();
+                       
+                       $('ponyhoof_options_sendSource').addEventListener('click', function() {
+                               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.")) {
+                                       k.dialog.hide();
+
+                                       var temp = $('ponyhoof_options_technical').value;
+                                       $('ponyhoof_options_technical').value = '';
+                                       if ($('ponyhoof_sourceSend_input')) {
+                                               $('ponyhoof_sourceSend_input').value = '';
+                                               var sourceSend = $('ponyhoof_sourceSend_input').parentNode;
+                                       }
+
+                                       var settings = {};
+                                       for (var x in userSettings) {
+                                               settings[x] = userSettings[x];
+                                       }
+                                       settings['customBg'] = null;
+
+                                       var t = d.documentElement.innerHTML.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
+                                       t = '<!DOCTYPE html><html class="'+d.documentElement.className+'" id="'+d.documentElement.id+'"><!-- '+k.techInfo()+"\n\n"+JSON.stringify(settings)+' -->'+t+'</html>';
+
+                                       if ($('ponyhoof_sourceSend_input')) {
+                                               $('ponyhoof_sourceSend_input').value = t;
+                                       } else {
+                                               var sourceSendTxt = d.createElement('input');
+                                               sourceSendTxt.type = 'hidden';
+                                               sourceSendTxt.id = 'ponyhoof_sourceSend_input';
+                                               sourceSendTxt.name = 'post';
+                                               sourceSendTxt.value = t;
+
+                                               var sourceSend = d.createElement('form');
+                                               sourceSend.method = 'POST';
+                                               sourceSend.action = 'https://paste.little.my/post/';
+                                               sourceSend.target = '_blank';
+                                               sourceSend.appendChild(sourceSendTxt);
+                                               d.body.appendChild(sourceSend);
+                                       }
+
+                                       sourceSend.submit();
+
+                                       $('ponyhoof_options_technical').value = temp;
+                               }
+                               return false;
+                       }, false);
+                       
+                       $('ponyhoof_options_technical').textContent = k.techInfo();
+                       //$('ponyhoof_options_linkedcss').textContent = k.linkedCss();
+               };
+
+               k._debugRemoveStyle = function(e) {
+                       changeThemeSmart('NONE');
+
+                       d.removeEventListener('DOMNodeInserted', DOMNodeInserted, true);
+                       if (mutationObserverMain) {
+                               mutationObserverMain.disconnect();
+                       }
+                       
+                       k.dialog.close();
+                       e.preventDefault();
+               };
+
+               k._debugNoMutationObserver = function() {
+                       var mutationObserver = w.WebKitMutationObserver || w.MutationObserver || false;
+                       if (!mutationObserver) {
+                               var option = $('ponyhoof_options_debug_noMutationObserver');
+                               option.disabled = true;
+                               option.checked = true;
+
+                               var label = $('ponyhoof_options_label_debug_noMutationObserver');
+                               addClass(label, 'ponyhoof_options_unavailable');
+                               label.setAttribute('data-hover', 'tooltip');
+                               label.setAttribute('aria-label', "The new HTML detection method is not supported on your browser. Please update your browser if possible.");
+                       }
+               };
+
+               k.mainInitLoaded = false;
+               k.mainInit = function() {
+                       if (k.mainInitLoaded) {
+                               return;
+                       }
+
+                       // Pony selector
+                       var ponySelector = new PonySelector($('ponyhoof_options_pony'), {});
+                       ponySelector.allowRandom = true;
+                       ponySelector.customClick = function(menuItem, menuClass) {
+                               if (ponySelector.oldPony == 'NONE' || CURRENTPONY == 'NONE') {
+                                       if (ponySelector.oldPony == 'NONE' && CURRENTPONY != 'NONE') {
+                                               extraInjection();
+                                               runDOMNodeInserted();
+                                       }
+                               }
+                               if (ponySelector.oldPony != 'NONE' && CURRENTPONY == 'NONE') {
+                                       k.needsToRefresh = true;
+                               }
+                               if (k._stack != CURRENTSTACK) {
+                                       k.needsToRefresh = true;
+                               }
+                               k.needToSaveLabel = true;
+                               k.updateCloseButton();
+                               
+                               var f = k.dialog.dialog.getElementsByClassName('ponyhoof_options_framerefresh');
+                               for (var i = 0, len = f.length; i < len; i += 1) {
+                                       (function() {
+                                               var iframe = f[i];
+                                               fadeOut(iframe, function() {
+                                                       w.setTimeout(function() {
+                                                               iframe.style.display = '';
+                                                               removeClass(iframe, 'ponyhoof_fadeout');
+                                                               
+                                                               iframe.src = iframe.src.replace(/\href\=/, '&href=');
+                                                       }, 250);
+                                               });
+                                       })();
+                               }
+                       };
+                       ponySelector.createSelector();
+
+                       if (!ISUSINGPAGE && !ISUSINGBUSINESS) {
+                               w.setTimeout(function() {
+                                       $('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';
+                               }, 500);
+                       }
+
+                       // Disable Ponyhoof
+                       $('ponyhoof_options_disable').addEventListener('click', k.disablePonyhoof, false);
+
+                       // Browser Ponies
+                       $('ponyhoof_browserponies').addEventListener('click', k.runBrowserPonies, false);
+
+                       k.mainInitLoaded = true;
+               };
+
+               k.extrasInitLoaded = false;
+               k.extrasInit = function() {
+                       if (k.extrasInitLoaded) {
+                               return;
+                       }
+
+                       var litestand = false;
+                       if (d.getElementsByClassName('_4g5r').length) {
+                               litestand = true;
+                       } else if (d.getElementsByClassName('-cx-PUBLIC-hasLitestandBookmarksSidebar__root').length) {
+                               litestand = true;
+                       }
+                       if (litestand) {
+                               var option = $('ponyhoof_options_show_messages_other');
+                               option.disabled = true;
+                               option.checked = false;
+
+                               var label = $('ponyhoof_options_label_show_messages_other');
+                               addClass(label, 'ponyhoof_options_unavailable');
+                               label.setAttribute('data-hover', 'tooltip');
+                               label.setAttribute('aria-label', "This option is not available on the new Facebook news feed");
+                       }
+
+                       k.randomInit();
+                       k.costumesInit();
+
+                       // Disable animations
+                       if (!supportsCssTransition()) {
+                               var option = $('ponyhoof_options_disable_animation');
+                               option.disabled = true;
+                               option.checked = true;
+
+                               var label = $('ponyhoof_options_label_disable_animation');
+                               addClass(label, 'ponyhoof_options_unavailable');
+                               label.setAttribute('data-hover', 'tooltip');
+                               label.setAttribute('aria-label', "Animations are not supported on your browser. Please update your browser if possible.");
+                       }
+
+                       // Reset settings
+                       $('ponyhoof_options_resetSettings').addEventListener('click', k.resetSettings, false);
+                       $('ponyhoof_options_clearLocalStorage').addEventListener('click', k.clearStorage, false);
+
+                       k.extrasInitLoaded = true;
+               };
+
+               k.extrasCostumeMenu = null;
+               k.extrasCostumeButton = null;
+               k.extrasCostumeMenuItemNormal = null;
+               k.extrasCostumeMenuItems = {};
+               k.costumesInit = function() {
+                       var desc = "(Normal)";
+                       var check = true;
+                       if (userSettings.costume && doesCharacterHaveCostume(REALPONY, userSettings.costume)) {
+                               desc = COSTUMESX[userSettings.costume].name;
+                               check = false;
+                       }
+
+                       k.extrasCostumeMenu = new Menu('costume', $('ponyhoof_options_costume'));
+                       k.extrasCostumeButton = k.extrasCostumeMenu.createButton(desc);
+                       k.extrasCostumeButton.setAttribute('data-hover', 'tooltip');
+                       k.extrasCostumeButton.setAttribute('aria-label', CURRENTLANG.costume_tooltip);
+                       k.extrasCostumeMenu.canSearch = false;
+                       k.extrasCostumeMenu.createMenu();
+                       k.extrasCostumeMenu.attachButton();
+                       k.extrasCostumeMenuItemNormal = k.extrasCostumeMenu.createMenuItem({
+                                html: "(Normal)"
+                               ,data: ''
+                               ,check: check
+                               ,onclick: function(menuItem, menuClass) {
+                                       k._costumesInit_save(menuItem, menuClass, '');
+                               }
+                       });
+
+                       for (var code in COSTUMESX) {
+                               if (COSTUMESX.hasOwnProperty(code)) {
+                                       k._costumesInit_item(code);
+                               }
+                       }
+
+                       changeThemeFuncQueue.push(function() {
+                               if (doesCharacterHaveCostume(REALPONY, userSettings.costume)) {
+                                       k.extrasCostumeMenu.changeButtonText(COSTUMESX[userSettings.costume].name);
+                                       k.extrasCostumeMenu.changeChecked(k.extrasCostumeMenuItems[userSettings.costume]);
+                               } else {
+                                       k.extrasCostumeMenu.changeButtonText("(Normal)");
+                                       k.extrasCostumeMenu.changeChecked(k.extrasCostumeMenuItemNormal);
+                               }
+
+                               for (var code in COSTUMESX) {
+                                       if (COSTUMESX.hasOwnProperty(code)) {
+                                               if (doesCharacterHaveCostume(REALPONY, code)) {
+                                                       removeClass(k.extrasCostumeMenuItems[code].menuItem, 'hidden_elem');
+                                               } else {
+                                                       addClass(k.extrasCostumeMenuItems[code].menuItem, 'hidden_elem');
+                                               }
+                                       }
+                               }
+                       });
+               };
+
+               k._costumesInit_item = function(code) {
+                       var check = false;
+                       var extraClass = '';
+                       if (doesCharacterHaveCostume(REALPONY, code)) {
+                               if (userSettings.costume == code) {
+                                       check = true;
+                               }
+                       } else {
+                               extraClass += ' hidden_elem';
+                       }
+
+                       k.extrasCostumeMenuItems[code] = k.extrasCostumeMenu.createMenuItem({
+                                html: COSTUMESX[code].name
+                               ,data: code
+                               ,check: check
+                               ,extraClass: extraClass
+                               ,onclick: function(menuItem, menuClass) {
+                                       k._costumesInit_save(menuItem, menuClass, code);
+                               }
+                       });
+               };
+
+               k._costumesInit_save = function(menuItem, menuClass, code) {
+                       if (!COSTUMESX[code] && code != '') {
+                               return;
+                       }
+
+                       changeCostume(code);
+                       userSettings.costume = code;
+                       saveSettings();
+
+                       if (COSTUMESX[code]) {
+                               menuClass.changeButtonText(COSTUMESX[code].name);
+                       } else {
+                               menuClass.changeButtonText("(Normal)");
+                       }
+                       menuClass.changeChecked(menuItem);
+                       menuClass.close();
+                       
+                       k.needToSaveLabel = true;
+                       k.updateCloseButton();
+               };
+
+               k.resetSettings = function(e) {
+                       e.preventDefault();
+
+                       userSettings = {};
+                       saveSettings();
+
+                       saveValue(SETTINGSPREFIX+'soundCache', JSON.stringify(null));
+
+                       k.canSaveSettings = false;
+                       k.dialog.close();
+                       w.location.reload();
+               };
+
+               k.clearStorage = function(e) {
+                       k.canSaveSettings = false;
+
+                       if (typeof GM_listValues != 'undefined') {
+                               try {
+                                       var keys = GM_listValues();
+                                       for (var i = 0, len = keys.length; i < len; i += 1) {
+                                               GM_deleteValue(keys[i]);
+                                       }
+                               } catch (e) {
+                                       alert(e.toString());
+                               }
+                       }
+                       
+                       switch (STORAGEMETHOD) {
+                               case 'localstorage':
+                                       if (confirm(SIG+" localStorage must be cleared in order to reset settings. Doing this may cause other extensions to lose their settings.")) {
+                                               try {
+                                                       localStorage.clear();
+                                               } catch (e) {
+                                                       alert(e.toString());
+                                               }
+                                       } else {
+                                               return false;
+                                       }
+                                       break;
+
+                               case 'chrome':
+                                       chrome_clearStorage();
+                                       break;
+
+                               case 'opera':
+                                       opera_clearStorage();
+                                       break;
+
+                               case 'safari':
+                                       safari_clearStorage();
+                                       break;
+
+                               case 'xpi':
+                                       xpi_clearStorage();
+                                       break;
+
+                               default:
+                                       break;
+                       }
+                       
+                       k.dialog.close();
+                       e.preventDefault();
+                       w.location.reload();
+               };
+
+               k.donateLoaded = false;
+               k.loadDonate = function() {
+                       if (k.donateLoaded) {
+                               return;
+                       }
+
+                       statTrack('aboutclicked');
+
+                       $('ponyhoof_options_twitter').src = 'https://platform.twitter.com/widgets/follow_button.html?screen_name=ponyhoof&show_screen_name=true&show_count=true';
+                       if (ISCHROME || STORAGEMETHOD == 'chrome') {
+                               (function() {
+                                       var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
+                                       po.src = 'https://apis.google.com/js/plusone.js';
+                                       var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
+                               })();
+                       }
+
+                       $('ponyhoof_options_donatepaypal_link').addEventListener('click', function() {
+                               $('ponyhoof_options_donatepaypal').submit();
+                               statTrack('paypalClicked');
+                               return false;
+                       }, false);
+
+                       $('ponyhoof_donate_flattr_iframe').src = THEMEURL+'_welcome/flattrStandalone.htm';
+
+                       k.donateLoaded = true;
+               };
+               
+               k.randomInit = function() {
+                       var current = [];
+                       if (userSettings.randomPonies) {
+                               current = userSettings.randomPonies.split('|');
+                       }
+
+                       var outerwrap = $('ponyhoof_options_randomPonies');
+                       var ponySelector = new PonySelector(outerwrap, {});
+                       ponySelector.overrideClickAction = true;
+                       ponySelector.customCheckCondition = function(code) {
+                               if (current.indexOf(code) != -1) {
+                                       return true;
+                               }
+
+                               return false;
+                       };
+                       ponySelector.customClick = function(menuItem, menuClass) {
+                               var code = menuItem.menuItem.getAttribute('data-ponyhoof-menu-data');
+
+                               if (!hasClass(menuItem.menuItem, 'ponyhoof_menuitem_checked')) {
+                                       menuItem.menuItem.className += ' ponyhoof_menuitem_checked';
+
+                                       current.push(code);
+                               } else {
+                                       removeClass(menuItem.menuItem, 'ponyhoof_menuitem_checked');
+
+                                       current.splice(current.indexOf(code), 1);
+                               }
+                               userSettings.randomPonies = current.join('|');
+                               saveSettings();
+
+                               k._randomUpdateButtonText(current, menuClass);
+                               k.needToSaveLabel = true;
+                               k.updateCloseButton();
+                       };
+                       ponySelector.createSelector();
+                       k._randomUpdateButtonText(current, ponySelector.menu);
+
+                       var mass = d.createElement('a');
+                       mass.href = '#';
+                       mass.className = 'uiButton';
+                       mass.setAttribute('role', 'button');
+                       mass.id = 'ponyhoof_options_randomPonies_mass';
+                       mass.innerHTML = '<span class="uiButtonText">'+CURRENTLANG.invertSelection+'</span>';
+                       mass.addEventListener('click', function(e) {
+                               var newCurrent = [];
+                               for (var i = 0, len = PONIES.length; i < len; i += 1) {
+                                       var menuitem = ponySelector.menu.menu.querySelector('.ponyhoof_menuitem[data-ponyhoof-menu-data="'+PONIES[i].code+'"]');
+                                       if (PONIES[i].hidden) {
+                                               if (menuitem) {
+                                                       removeClass(menuitem, 'ponyhoof_menuitem_checked');
+                                               }
+                                               continue;
+                                       }
+                                       if (current.indexOf(PONIES[i].code) == -1) {
+                                               newCurrent.push(PONIES[i].code);
+
+                                               if (menuitem) {
+                                                       addClass(menuitem, 'ponyhoof_menuitem_checked');
+                                               }
+                                       } else {
+                                               if (menuitem) {
+                                                       removeClass(menuitem, 'ponyhoof_menuitem_checked');
+                                               }
+                                       }
+                               }
+                               current = newCurrent;
+                               userSettings.randomPonies = current.join('|');
+                               saveSettings();
+
+                               k._randomUpdateButtonText(current, ponySelector.menu);
+                               k.needToSaveLabel = true;
+                               k.updateCloseButton();
+                               w.setTimeout(function() {
+                                       ponySelector.menu.open();
+                               }, 1);
+
+                               return false;
+                       }, false);
+                       outerwrap.appendChild(mass);
+               };
+
+               k._randomUpdateButtonText = function(current, menuClass) {
+                       var buttonText = "("+current.length+" characters)";
+                       if (current.length == 0) {
+                               buttonText = "(All characters)";
+                       } else if (current.length == 1) {
+                               var data = convertCodeToData(current[0]);
+                               buttonText = data.name;
+                       }
+                       menuClass.changeButtonText(buttonText);
+               };
+
+               k.soundsMenu = null;
+               k.soundsButton = null;
+               k.soundsInitLoaded = false;
+               k.soundsNotifTypeMenu = null;
+               k.soundsNotifTypeButton = null;
+               k.soundsSettingsWrap = null;
+
+               k.soundsChatSoundWarning = null;
+               k.soundsChatLoaded = false;
+               k.soundsChatWrap = null;
+               k.soundsChatMenu = null;
+               k.soundsChatButton = null;
+               k.soundsInit = function() {
+                       if (k.soundsInitLoaded) {
+                               return;
+                       }
+
+                       try {
+                               if (typeof w.Audio === 'undefined') {
+                                       throw 1;
+                               }
+                               initPonySound('soundsTest');
+                       } catch (e) {
+                               $$(k.dialog.dialog, '.unavailable', function(ele) {
+                                       removeClass(ele, 'hidden_elem');
+                               });
+                               $$(k.dialog.dialog, '.available', function(ele) {
+                                       addClass(ele, 'hidden_elem');
+                               });
+                               k.soundsInitLoaded = true;
+                               return;
+                       }
+
+                       var desc = "(Auto-select)";
+                       if (SOUNDS[userSettings.soundsFile] && SOUNDS[userSettings.soundsFile].name) {
+                               desc = SOUNDS[userSettings.soundsFile].name;
+                       }
+
+                       k.soundsMenu = new Menu('sounds', $('ponyhoof_options_soundsSetting'));
+                       k.soundsButton = k.soundsMenu.createButton(desc);
+                       k.soundsMenu.createMenu();
+                       k.soundsMenu.attachButton();
+
+                       for (var code in SOUNDS) {
+                               if (SOUNDS.hasOwnProperty(code)) {
+                                       k._soundsMenu_item(code);
+
+                                       if (SOUNDS[code].seperator) {
+                                               k.soundsMenu.createSeperator();
+                                       }
+                               }
+                       }
+
+                       k._soundsNotifTypeInit();
+
+                       var volumeInput = $('ponyhoof_options_soundsVolume');
+                       var volumePreview = $('ponyhoof_options_soundsVolumePreview');
+                       var volumeValue = $('ponyhoof_options_soundsVolumeValue');
+                       var volumeTimeout = null;
+
+                       volumeInput.value = userSettings.soundsVolume * 100;
+                       if (supportsRange()) {
+                               volumePreview.style.display = 'none';
+                               volumeValue.style.display = 'inline';
+                               volumeValue.innerText = volumeInput.value+"%";
+                               volumeInput.addEventListener('change', function() {
+                                       volumeValue.innerText = volumeInput.value+"%";
+
+                                       w.clearTimeout(volumeTimeout);
+                                       volumeTimeout = w.setTimeout(function() {
+                                               var volume = volumeInput.value / 100;
+                                               userSettings.soundsVolume = Math.max(0, Math.min(volume, 1));
+                                               saveSettings();
+
+                                               k._soundsPreview(userSettings.soundsFile);
+                                       }, 300);
+                               }, false);
+                       } else {
+                               volumeInput.type = 'number';
+                               volumeInput.className = 'inputtext';
+                               volumeInput.setAttribute('data-hover', 'tooltip');
+                               volumeInput.setAttribute('aria-label', "Enter a number between 1-100");
+                               volumePreview.addEventListener('click', function(e) {
+                                       var volume = volumeInput.value / 100;
+                                       userSettings.soundsVolume = Math.max(0, Math.min(volume, 1));
+                                       saveSettings();
+
+                                       k._soundsPreview(userSettings.soundsFile);
+                                       e.preventDefault();
+                               }, false);
+                       }
+
+                       k.soundsChanged();
+
+                       // Detect chat sound enabled setting
+                       k.soundsChatSoundWarning = $('ponyhoof_options_soundsChatSoundWarning');
+                       k.soundsChatWrap = $('ponyhoof_options_soundsChatWrap');
+                       try {
+                               if (typeof USW.requireLazy == 'function') {
+                                       USW.requireLazy(['ChatOptions', 'Arbiter'], function(ChatOptions, Arbiter) {
+                                               if (userSettings.chatSound) {
+                                                       k._soundsChatSoundWarn(ChatOptions.getSetting('sound'));
+                                               } else {
+                                                       addClass(k.soundsChatSoundWarning, 'hidden_elem');
+                                               }
+
+                                               Arbiter.subscribe('chat/option-changed', function(e, option) {
+                                                       if (!userSettings.chatSound) {
+                                                               return;
+                                                       }
+                                                       if (option.name == 'sound') {
+                                                               k._soundsChatSoundWarn(option.value);
+                                                       }
+                                               });
+                                       });
+                               }
+                       } catch (e) {
+                               error("Unable to hook to ChatOptions and Arbiter");
+                               dir(e);
+                       }
+                       k._soundsChatLoad();
+                       k._soundsChatInit();
+
+                       var button = k.soundsChatSoundWarning.getElementsByClassName('uiButton');
+                       button[0].addEventListener('click', function() {
+                               k._soundsTurnOnFbSound();
+                       }, false);
+
+                       k.soundsInitLoaded = true;
+               };
+
+               // Create a menu item for notification sounds
+               // Used only on k.soundsInit()
+               k._soundsMenu_item = function(code) {
+                       var check = false;
+                       if (userSettings.soundsFile == code) {
+                               check = true;
+                       }
+
+                       k.soundsMenu.createMenuItem({
+                                html: SOUNDS[code].name
+                               ,title: SOUNDS[code].title
+                               ,data: code
+                               ,check: check
+                               ,onclick: function(menuItem, menuClass) {
+                                       if (!SOUNDS[code] || !SOUNDS[code].name) {
+                                               return;
+                                       }
+                                       
+                                       //$('ponyhoof_options_sounds').checked = true;
+                                       //userSettings.sounds = true;
+                                       userSettings.soundsFile = code;
+                                       saveSettings();
+
+                                       k._soundsPreview(code);
+
+                                       menuClass.changeButtonText(menuItem.getText());
+                                       menuClass.changeChecked(menuItem);
+                                       
+                                       k.needToSaveLabel = true;
+                                       k.updateCloseButton();
+                               }
+                       });
+               };
+
+               // Warn people that Facebook's own chat sound needs to be enabled
+               // Used 2 times on k.soundsInit()
+               k._soundsChatSoundWarn = function(isFbSoundEnabled) {
+                       if (isFbSoundEnabled) {
+                               addClass(k.soundsChatSoundWarning, 'hidden_elem');
+                               $('ponyhoof_options_chatSound').disabled = false;
+                               if (userSettings.chatSound) {
+                                       $('ponyhoof_options_chatSound').checked = true;
+                               }
+                       } else {
+                               removeClass(k.soundsChatSoundWarning, 'hidden_elem');
+                               $('ponyhoof_options_chatSound').disabled = true;
+                               $('ponyhoof_options_chatSound').checked = false;
+                       }
+               };
+
+               // Turn on Facebook chat sounds
+               // Used on k.soundsInit() and k.chatSound()
+               k._soundsTurnOnFbSound = function() {
+                       try {
+                               if (typeof USW.requireLazy == 'function') {
+                                       USW.requireLazy(['ChatOptions', 'ChatSidebarDropdown'], function(ChatOptions, ChatSidebarDropdown) {
+                                               ChatOptions.setSetting('sound', 1);
+                                               ChatSidebarDropdown.prototype.changeSetting('sound', 1);
+                                       });
+                               }
+                       } catch (e) {
+                               error("Unable to hook to ChatOptions and ChatSidebarDropdown");
+                               dir(e);
+                       }
+               };
+
+               k._soundsNotifTypeCurrent = [];
+               // Initialize the notification sound blacklist and its HTML template
+               // Used only on k.soundsInit()
+               k._soundsNotifTypeInit = function() {
+                       if (userSettings.soundsNotifTypeBlacklist) {
+                               var current = userSettings.soundsNotifTypeBlacklist.split('|');
+
+                               for (var code in SOUNDS_NOTIFTYPE) {
+                                       if (current.indexOf(code) != -1) {
+                                               k._soundsNotifTypeCurrent.push(code);
+                                       }
+                               }
+                       }
+
+                       k.soundsNotifTypeMenu = new Menu('soundsNotifType', $('ponyhoof_options_soundsNotifType'));
+                       k.soundsNotifTypeButton = k.soundsNotifTypeMenu.createButton('');
+                       k.soundsNotifTypeMenu.canSearch = false;
+                       k.soundsNotifTypeMenu.createMenu();
+                       k.soundsNotifTypeMenu.attachButton();
+
+                       for (var code in SOUNDS_NOTIFTYPE) {
+                               if (SOUNDS_NOTIFTYPE.hasOwnProperty(code)) {
+                                       k._soundsNotifTypeInit_item(code);
+                               }
+                       }
+                       k._soundsNotifTypeUpdateButtonText(k._soundsNotifTypeCurrent, k.soundsNotifTypeMenu);
+               };
+
+               // Create a menu item for notification sound blacklist
+               // Used only on k._soundsNotifTypeInit()
+               k._soundsNotifTypeInit_item = function(code) {
+                       var check = false;
+                       if (k._soundsNotifTypeCurrent.indexOf(code) != -1) {
+                               check = true;
+                       }
+
+                       k.soundsNotifTypeMenu.createMenuItem({
+                                html: SOUNDS_NOTIFTYPE[code].name
+                               ,data: code
+                               ,check: check
+                               ,onclick: function(menuItem, menuClass) {
+                                       if (!SOUNDS_NOTIFTYPE[code] || !SOUNDS_NOTIFTYPE[code].name) {
+                                               return;
+                                       }
+
+                                       if (!hasClass(menuItem.menuItem, 'ponyhoof_menuitem_checked')) {
+                                               menuItem.menuItem.className += ' ponyhoof_menuitem_checked';
+
+                                               k._soundsNotifTypeCurrent.push(code);
+                                       } else {
+                                               removeClass(menuItem.menuItem, 'ponyhoof_menuitem_checked');
+
+                                               k._soundsNotifTypeCurrent.splice(k._soundsNotifTypeCurrent.indexOf(code), 1);
+                                       }
+                                       userSettings.soundsNotifTypeBlacklist = k._soundsNotifTypeCurrent.join('|');
+                                       saveSettings();
+
+                                       k._soundsNotifTypeUpdateButtonText(k._soundsNotifTypeCurrent, menuClass);
+                                       k.needToSaveLabel = true;
+                                       k.updateCloseButton();
+                               }
+                       });
+               };
+
+               // Update the notification sound blacklist button text, perhaps after changes
+               // Used on k._soundsNotifTypeInit() and k._soundsNotifType_item()
+               k._soundsNotifTypeUpdateButtonText = function(current, menuClass) {
+                       var buttonText = "("+current.length+" types)";
+                       if (current.length == 0) {
+                               buttonText = "(None)";
+                       } else if (current.length == 1) {
+                               buttonText = SOUNDS_NOTIFTYPE[current[0]].name;
+                       }
+                       menuClass.changeButtonText(buttonText);
+               };
+
+               // Hide/show the extra sound options if the main sound option id disabled/enabled
+               // Used on k.soundsInit(), the sound option is changed, or DOMNodeInserted is disabled
+               k.soundsChanged = function() {
+                       k.soundsSettingsWrap = k.soundsSettingsWrap || $('ponyhoof_options_soundsSettingsWrap');
+                       if (userSettings.sounds && !userSettings.disableDomNodeInserted) {
+                               removeClass(k.soundsSettingsWrap, 'hidden_elem');
+                       } else {
+                               addClass(k.soundsSettingsWrap, 'hidden_elem');
+                       }
+               };
+
+               // 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"
+               // Used when the sound option is changed
+               k.soundsClicked = function() {
+                       k.soundsChanged();
+
+                       if (userSettings.sounds) {
+                               turnOffFbNotificationSound();
+                       } else {
+                               // We already nuked Facebook's sounds, so we need to reload
+                               k.needsToRefresh = true;
+                               k.updateCloseButton();
+                       }
+               };
+
+               // The wording of this function is a bit confusing
+               // Hide/show the extra chat sound options if the chat sound option is disabled/enabled
+               // Used on k.soundsInit() and k.chatSound()
+               k._soundsChatInit = function() {
+                       if (userSettings.chatSound) {
+                               removeClass(k.soundsChatWrap, 'hidden_elem');
+                       } else {
+                               addClass(k.soundsChatSoundWarning, 'hidden_elem');
+                               addClass(k.soundsChatWrap, 'hidden_elem');
+                       }
+               };
+
+               // Initialize the chat sounds options and its HTML template
+               // Used only on k.soundsInit()
+               k._soundsChatLoad = function() {
+                       if (k.soundsChatLoaded) {
+                               return;
+                       }
+
+                       var desc = "(Select a chat sound)";
+                       if (SOUNDS_CHAT[userSettings.chatSoundFile] && SOUNDS_CHAT[userSettings.chatSoundFile].name) {
+                               desc = SOUNDS_CHAT[userSettings.chatSoundFile].name;
+                       }
+                       k.soundsChatMenu = new Menu('sounds_chat', $('ponyhoof_options_soundsChatSetting'));
+                       k.soundsChatButton = k.soundsChatMenu.createButton(desc);
+                       k.soundsChatMenu.canSearch = false;
+                       k.soundsChatMenu.createMenu();
+                       k.soundsChatMenu.attachButton();
+                       for (var code in SOUNDS_CHAT) {
+                               if (SOUNDS_CHAT.hasOwnProperty(code)) {
+                                       k._soundsChatLoad_item(code);
+                               }
+                       }
+                       k.soundsChatLoaded = true;
+               };
+
+               // Create a menu item for chat sound options
+               // Used only on k._soundsChatLoad()
+               k._soundsChatLoad_item = function(code) {
+                       var check = false;
+                       if (userSettings.chatSoundFile == code) {
+                               check = true;
+                       }
+
+                       k.soundsChatMenu.createMenuItem({
+                                html: SOUNDS_CHAT[code].name
+                               ,title: SOUNDS_CHAT[code].title
+                               ,data: code
+                               ,check: check
+                               ,onclick: function(menuItem, menuClass) {
+                                       if (!SOUNDS_CHAT[code] || !SOUNDS_CHAT[code].name) {
+                                               return;
+                                       }
+                                       
+                                       userSettings.chatSoundFile = code;
+                                       saveSettings();
+
+                                       k._soundsPreview(code);
+                                       changeChatSound(code);
+
+                                       menuClass.changeButtonText(menuItem.getText());
+                                       menuClass.changeChecked(menuItem);
+                                       
+                                       k.needToSaveLabel = true;
+                                       k.updateCloseButton();
+                               }
+                       });
+               };
+
+               // 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"
+               // Also calls k._soundsChatInit()
+               // Used when the chat sound option is changed
+               k.chatSound = function() {
+                       if (userSettings.chatSound) {
+                               // Enable Facebook's chat sound automatically
+                               k._soundsTurnOnFbSound();
+                               if (SOUNDS_CHAT[userSettings.chatSoundFile] && SOUNDS_CHAT[userSettings.chatSoundFile].name) {
+                                       changeChatSound(userSettings.chatSoundFile);
+                               }
+                       } else {
+                               // Chat sounds are already ponified, we need to reload to clear it
+                               k.needsToRefresh = true;
+                               k.updateCloseButton();
+                       }
+                       k._soundsChatInit();
+               };
+
+               // Run a sound preview
+               k._soundsPreview = function(code) {
+                       var sound = code;
+                       if (code == 'AUTO') {
+                               sound = '_sound/defaultNotification';
+
+                               var data = convertCodeToData(REALPONY);
+                               if (data.soundNotif) {
+                                       sound = data.soundNotif;
+                               }
+                       }
+                       try {
+                               var ps = initPonySound('soundsTest', THEMEURL+sound+'.EXT');
+                               ps.respectSettings = false;
+                               ps.wait = 0;
+                               ps.play();
+                       } catch (e) {}
+               };
+
+               k.bgError = null;
+               k.bgTab = null;
+               k.bgDrop = null;
+               k.bgClearCustomBg = false;
+               k.bgInitLoaded = false;
+               k.bgInit = function() {
+                       if (k.bgInitLoaded) {
+                               return;
+                       }
+
+                       k.bgError = $('ponyhoof_options_background_error');
+                       k.bgTab = $('ponyhoof_options_tabs_background');
+                       k.bgDrop = $('ponyhoof_options_background_drop');
+
+                       if (userSettings.customBg) {
+                               addClass(k.bgTab, 'hasCustom');
+                               addClass($('ponyhoof_options_background_custom'), 'active');
+                       } else if (userSettings.login_bg) {
+                               addClass($('ponyhoof_options_background_loginbg'), 'active');
+                       } else {
+                               addClass($('ponyhoof_options_background_cutie'), 'active');
+                       }
+
+                       $$(k.bgTab, '.ponyhoof_options_fatradio a', function(ele) {
+                               ele.addEventListener('click', function() {
+                                       $$(k.bgTab, '.ponyhoof_options_fatradio a', function(ele2) {
+                                               removeClass(ele2.parentNode, 'active');
+                                       });
+
+                                       var parent = this.parentNode;
+                                       var attr = parent.getAttribute('data-ponyhoof-background');
+                                       if (attr == 'custom') {
+                                               userSettings.login_bg = false;
+                                               changeCustomBg(userSettings.customBg);
+                                               k.bgClearCustomBg = false;
+                                       } else if (attr == 'loginbg') {
+                                               userSettings.login_bg = true;
+                                               changeCustomBg(null);
+                                               addClass(d.documentElement, 'ponyhoof_settings_login_bg');
+                                               k.bgClearCustomBg = true;
+                                       } else {
+                                               userSettings.login_bg = false;
+                                               changeCustomBg(null);
+                                               k.bgClearCustomBg = true;
+                                       }
+                                       addClass(parent, 'active');
+                                       saveSettings();
+
+                                       k.needToSaveLabel = true;
+                                       k.updateCloseButton();
+
+                                       return false;
+                               }, false);
+                       });
+
+                       $('ponyhoof_options_background_select').addEventListener('change', function(e) {
+                               if (this.files && this.files[0]) {
+                                       k.bgProcessFile(this.files[0]);
+                               }
+                       }, false);
+
+                       k.bgDropInit();
+
+                       k.bgInitLoaded = true;
+               };
+
+               k.bgDropInit = function() {
+                       if (typeof w.FileReader == 'undefined') {
+                               k.bgError.textContent = "Custom background images are not supported on your browser. Please update your browser if possible.";
+                               removeClass(k.bgError, 'hidden_elem');
+                               addClass(k.bgDrop, 'hidden_elem');
+                               return;
+                       }
+
+                       k.bgDrop.addEventListener('drop', function(e) {
+                               e.stopPropagation();
+                               e.preventDefault();
+
+                               removeClass(this, 'ponyhoof_dropping');
+
+                               if (e.dataTransfer.files && e.dataTransfer.files[0]) {
+                                       k.bgProcessFile(e.dataTransfer.files[0]);
+                               }
+                       }, false);
+
+                       k.bgDrop.addEventListener('dragover', function(e) {
+                               e.stopPropagation();
+                               e.preventDefault();
+
+                               e.dataTransfer.dropEffect = 'copy';
+                       }, false);
+
+                       k.bgDrop.addEventListener('dragenter', function(e) {
+                               addClass(k.bgDrop, 'ponyhoof_dropping');
+                                                       }, false);
+
+                       
+                       k.bgDrop.addEventListener('dragend', function(e) {
+                               removeClass(k.bgDrop, 'ponyhoof_dropping')
+                       }, false);
+               }
+
+               k.bgProcessFile = function(file) {
+                       if (!file.type.match(/image.*/)) {
+                               if (file.type) {
+                                       k.bgError.textContent = "The file ("+file.name+") doesn't seem to be an image ("+file.type+").";
+                               } else {
+                                       k.bgError.textContent = "The file ("+file.name+") doesn't seem to be an image.";
+                               }
+                               removeClass(k.bgError, 'hidden_elem');
+                               return;
+                       }
+
+                       if (file.size > 1024*1024) {
+                               if (file.type && file.type != 'image/jpeg') {
+                                       k.bgError.textContent = "Sorry, the file size of your image is too big (over 1 MB) and may not save properly. Try saving your image as a JPEG or resize your image.";
+                               } else {
+                                       k.bgError.textContent = "Sorry, the file size of your image is too big (over 1 MB) and may not save properly. Try resizing your image.";
+                               }
+                               removeClass(k.bgError, 'hidden_elem');
+                               return;
+                       }
+
+                       var reader = new w.FileReader();
+                       reader.onload = function(e) {
+                               addClass(k.bgError, 'hidden_elem');
+                               addClass(k.bgTab, 'hasCustom');
+
+                               $$(k.bgTab, '.ponyhoof_options_fatradio a', function(ele2) {
+                                       removeClass(ele2.parentNode, 'active');
+                               });
+                               addClass($('ponyhoof_options_background_custom'), 'active');
+                               k.bgClearCustomBg = false;
+
+                               userSettings.login_bg = false;
+                               userSettings.customBg = e.target.result;
+                               saveSettings();
+
+                               k.needToSaveLabel = true;
+                               k.updateCloseButton();
+
+                               changeCustomBg(e.target.result);
+                       };
+                       reader.onerror = function(e) {
+                               k.bgError.textContent = "An error occurred reading the file. Please try again.";
+                               dir(e);
+                               removeClass(k.bgError, 'hidden_elem');
+                       };
+                       reader.readAsDataURL(file);
+               };
+
+               k.disableDomNodeInserted = function() {
+                       k.soundsChanged(); // to set k.soundsSettingsWrap
+
+                       var affectedOptions = ['sounds', 'debug_dominserted_console', 'debug_noMutationObserver', 'debug_mutationDebug', 'debug_betaFacebookLinks'];
+                       //'disableCommentBrohoofed','debug_mutationObserver'
+                       for (var i = 0, len = affectedOptions.length; i < len; i += 1) {
+                               var option = $('ponyhoof_options_'+affectedOptions[i]);
+                               var label = $('ponyhoof_options_label_'+affectedOptions[i]);
+                               if (userSettings.disableDomNodeInserted) {
+                                       if (ranDOMNodeInserted) {
+                                               k.needsToRefresh = true;
+                                               k.updateCloseButton();
+                                       }
+
+                                       option.disabled = true;
+                                       option.checked = false;
+
+                                       addClass(label, 'ponyhoof_options_unavailable');
+                                       label.setAttribute('data-hover', 'tooltip');
+                                       label.setAttribute('aria-label', "This feature is not available because HTML detection is disabled, re-enable it at the Misc tab");
+                               } else {
+                                       var option = $('ponyhoof_options_'+affectedOptions[i]);
+                                       option.disabled = false;
+                                       if (userSettings[affectedOptions[i]]) {
+                                               option.checked = true;
+                                       }
+
+                                       removeClass(label, 'ponyhoof_options_unavailable');
+                                       label.removeAttribute('data-hover');
+                                       label.removeAttribute('aria-label');
+                                       label.removeAttribute('aria-owns');
+                                       label.removeAttribute('aria-controls');
+                                       label.removeAttribute('aria-haspopup');
+                               }
+                       }
+                       k._debugNoMutationObserver();
+               };
+
+               k.disableDomNodeInsertedClicked = function() {
+                       if (!userSettings.disableDomNodeInserted) {
+                               runDOMNodeInserted();
+                       }
+                       k.disableDomNodeInserted();
+               };
+
+               k.debug_disablelog = function() {
+                       if ($('ponyhoof_options_debug_disablelog').checked) {
+                               CANLOG = false;
+                       } else {
+                               CANLOG = true;
+                       }
+               };
+
+               k.disableDialog = null;
+               k.disablePonyhoof = function() {
+                       if ($('ponyhoof_dialog_disable')) {
+                               $('ponyhoof_disable_allowLoginScreen').checked = !globalSettings.allowLoginScreen;
+                               $('ponyhoof_disable_runForNewUsers').checked = !globalSettings.runForNewUsers;
+
+                               k.dialog.hide();
+                               k.disableDialog.show();
+                               $('ponyhoof_disable_ok').focus();
+                               return false;
+                       }
+
+                       var c = '';
+                       c += "<strong>Are you sure you want to disable Ponyhoof for yourself?</strong><br><br>";
+                       c += "You can re-enable Ponyhoof for yourself at any time by going back to Ponyhoof Options and re-select a character.<br><br>";
+                       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>';
+                       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>';
+                       
+                       var bottom = '';
+                       bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm" role="button" id="ponyhoof_disable_ok"><span class="uiButtonText">Disable</span></a>';
+                       bottom += '<a href="#" class="uiButton uiButtonLarge" role="button" id="ponyhoof_disable_no"><span class="uiButtonText">Cancel</span></a>';
+                       
+                       k.dialog.hide();
+                       k.disableDialog = new Dialog('disable');
+                       k.disableDialog.alwaysModal = true;
+                       k.disableDialog.create();
+                       k.disableDialog.changeTitle("Disable Ponyhoof");
+                       k.disableDialog.changeContent(c);
+                       k.disableDialog.changeBottom(bottom);
+
+                       $('ponyhoof_disable_allowLoginScreen').checked = !globalSettings.allowLoginScreen;
+                       $('ponyhoof_disable_runForNewUsers').checked = !globalSettings.runForNewUsers;
+
+                       k.disableDialog.show();
+                       k.disableDialog.onclose = function() {
+                               k.dialog.show();
+                       };
+
+                       $('ponyhoof_disable_ok').focus();
+                       $('ponyhoof_disable_ok').addEventListener('click', function() {
+                               userSettings.theme = 'NONE';
+                               saveSettings();
+
+                               globalSettings.allowLoginScreen = !$('ponyhoof_disable_allowLoginScreen').checked;
+                               globalSettings.runForNewUsers = !$('ponyhoof_disable_runForNewUsers').checked;
+                               saveGlobalSettings();
+
+                               k.disableDialog.canCloseByEscapeKey = false;
+                               d.body.style.cursor = 'progress';
+                               $('ponyhoof_disable_allowLoginScreen').disabled = true;
+                               $('ponyhoof_disable_runForNewUsers').disabled = true;
+                               $('ponyhoof_disable_ok').className += ' uiButtonDisabled';
+                               $('ponyhoof_disable_no').className += ' uiButtonDisabled';
+                               w.location.reload();
+
+                               return false;
+                       }, false);
+
+                       $('ponyhoof_disable_no').addEventListener('click', function() {
+                               k.disableDialog.close();
+                               return false;
+                       }, false);
+                       
+                       return false;
+               };
+
+               k.browserPonies = null;
+               k.runBrowserPonies = function() {
+                       var link = this;
+                       if (hasClass(link, 'ponyhoof_browserponies_loading')) {
+                               return false;
+                       }
+
+                       var alreadyLoaded = !!k.browserPonies;
+                       addClass(link, 'ponyhoof_browserponies_loading');
+                       
+                       if (!alreadyLoaded) {
+                               k.browserPonies = new BrowserPoniesHoof();
+                       }
+                       k.browserPonies.doneCallback = function() {
+                               k.dialog.close();
+                               removeClass(link, 'ponyhoof_browserponies_loading');
+                               if (!alreadyLoaded) {
+                                       k.browserPonies.copyrightDialog();
+                               }
+                               k.browserPonies.createDialog();
+                       };
+                       k.browserPonies.errorCallback = function(error) {
+                               removeClass(link, 'ponyhoof_browserponies_loading');
+                               k.browserPonies.createErrorDialog(error);
+                       };
+                       k.browserPonies.run();
+                       
+                       return false;
+               }
+
+               k.checkboxStore = {};
+               k.generateCheckbox = function(id, label, data) {
+                       data = data || {};
+                       var ex = '';
+                       var checkmark = '';
+
+                       if ((!data.global && userSettings[id]) || (data.global && globalSettings[id])) {
+                               checkmark += ' CHECKED';
+                       }
+                       data.extraClass = data.extraClass || '';
+                       if (data.title) {
+                               label += ' <a href="#" class="uiHelpLink"></a>';
+                               ex += ' data-hover="tooltip" aria-label="'+data.title+'"';
+                       }
+                       if (data.tip) {
+                               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>';
+                       }
+
+                       k.checkboxStore[id] = data;
+
+                       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>';
+               };
+               
+               k.checkboxInit = function() {
+                       var extras = $('ponyhoof_dialog_options').querySelectorAll('input[type="checkbox"]');
+                       for (var i = 0, len = extras.length; i < len; i += 1) {
+                               var checkmark = extras[i].getAttribute('data-ponyhoof-checkmark');
+                               var data = {};
+                               if (k.checkboxStore[checkmark]) {
+                                       data = k.checkboxStore[checkmark];
+                               }
+                               if (data.tooltipPosition) {
+                                       extras[i].parentNode.setAttribute('data-tooltip-position', data.tooltipPosition);
+                               }
+
+                               extras[i].addEventListener('click', function() {
+                                       var checkmark = this.getAttribute('data-ponyhoof-checkmark');
+                                       var data = {};
+                                       if (k.checkboxStore[checkmark]) {
+                                               data = k.checkboxStore[checkmark];
+                                       }
+
+                                       if (!data.global) {
+                                               userSettings[checkmark] = this.checked;
+                                               saveSettings();
+                                       } else {
+                                               globalSettings[checkmark] = this.checked;
+                                               saveGlobalSettings();
+                                       }
+                                       
+                                       if (this.checked) {
+                                               addClass(d.documentElement, 'ponyhoof_settings_'+checkmark);
+                                       } else {
+                                               removeClass(d.documentElement, 'ponyhoof_settings_'+checkmark);
+                                       }
+                                       if (data.refresh) {
+                                               k.needsToRefresh = true;
+                                       }
+                                       if (data.customFunc) {
+                                               data.customFunc();
+                                       }
+                                       
+                                       k.needToSaveLabel = true;
+                                       k.updateCloseButton();
+                               }, true);
+                       }
+               };
+               
+               k.tabsExposeDebug = 0;
+               k.tabsInit = function() {
+                       var tabs = k.dialog.dialog.querySelectorAll('.ponyhoof_tabs a');
+                       for (var i = 0, len = tabs.length; i < len; i += 1) {
+                               tabs[i].addEventListener('click', function(e) {
+                                       var tabName = this.getAttribute('data-ponyhoof-tab');
+                                       if (tabName == 'extras') {
+                                               if (!userSettings.debug_exposed && k.tabsExposeDebug < 5) {
+                                                       k.tabsExposeDebug += 1;
+                                                       if (k.tabsExposeDebug >= 5) {
+                                                               addClass(k.dialog.dialog, 'ponyhoof_options_debugExposed');
+                                                               k.switchTab('advanced');
+                                                               return;
+                                                       }
+                                               }
+                                       } else {
+                                               k.tabsExposeDebug = 0;
+                                       }
+
+                                       k.switchTab(tabName);
+                                       e.preventDefault();
+                               }, false);
+                       }
+               };
+
+               k.switchTab = function(tabName) {
+                       var tabActions = {
+                                'main': k.mainInit
+                               ,'background': k.bgInit
+                               ,'sounds': k.soundsInit
+                               ,'extras': k.extrasInit
+                               ,'advanced': k.debugInfo
+                               ,'about': k.loadDonate
+                       };
+                       removeClass(k.dialog.dialog.querySelector('.ponyhoof_tabs a.active'), 'active');
+                       addClass(k.dialog.dialog.querySelector('.ponyhoof_tabs a[data-ponyhoof-tab="'+tabName+'"]'), 'active');
+                       
+                       try {
+                               if (tabActions[tabName]) {
+                                       tabActions[tabName]();
+                               }
+                       } catch (e) {
+                               dir(e);
+                               ponyhoofError(e.toString());
+                       }
+
+                       $$(k.dialog.dialog, '.ponyhoof_tabs_section', function(section) {
+                               section.style.display = 'none';
+                       });
+                       $('ponyhoof_options_tabs_'+tabName).style.display = 'block';
+                       
+                       k.dialog.cardSpaceTick();
+               };
+
+               k.saveButtonClick = function() {
+                       k.dialog.close();
+                       return false;
+               };
+
+               k.dialogOnClose = function() {
+                       d.removeEventListener('keydown', k.kf, true);
+
+                       if (k.debugLoaded) {
+                               if ($('ponyhoof_options_customcss').value == "Enter any custom CSS to load after Ponyhoof is loaded.") {
+                                       userSettings.customcss = '';
+                               } else {
+                                       userSettings.customcss = $('ponyhoof_options_customcss').value;
+                               }
+                       }
+                       if (k.canSaveSettings) {
+                               saveSettings();
+                       }
+
+                       if (k.needsToRefresh) {
+                               w.location.reload();
+                       }
+               };
+               
+               k.dialogOnCloseFinish = function() {
+                       k.saveButton.getElementsByClassName('uiButtonText')[0].innerHTML = CURRENTLANG.close;
+
+                       if (k.canSaveSettings) {
+                               if (k.bgClearCustomBg) {
+                                       removeClass(k.bgTab, 'hasCustom');
+                                       userSettings.customBg = null;
+                                       saveSettings();
+                               }
+                       }
+               };
+
+               k.updateCloseButton = function() {
+                       var button = k.saveButton.getElementsByClassName('uiButtonText')[0];
+                       var text = CURRENTLANG.close;
+                       
+                       if (k.needToSaveLabel) {
+                               text = "Save & Close";
+                       }
+                       
+                       if (k.needsToRefresh) {
+                               text = "Save & Reload";
+                       }
+                       
+                       button.innerHTML = text;
+               };
+               
+               k.injectStyle = function() {
+                       var css = '';
+                       //css += '#ponyhoof_options_tabs_main .clearfix {margin-bottom:10px;}';
+                       css += '#ponyhoof_dialog_options .generic_dialog_popup, #ponyhoof_dialog_options .popup {width:480px;}';
+                       css += '#ponyhoof_options_likebox_div {height:80px;}';
+                       //css += 'html.ponyhoof_isusingpage #ponyhoof_options_likebox_div {display:none;}';
+                       css += '#ponyhoof_options_likebox {border:none;overflow:hidden;width:100%;height:80px;}';
+                       css += '#ponyhoof_options_pony {margin:8px 0 16px;}';
+                       css += '.ponyhoof_options_fatlink {display:block;margin-top:10px;}';
+                       css += '.ponyhoof_options_unavailable label {cursor:default;}';
+                       css += '#ponyhoof_dialog_options .usingPage, html.ponyhoof_isusingpage #ponyhoof_dialog_options .notPage {display:none;}';
+                       css += 'html.ponyhoof_isusingpage #ponyhoof_dialog_options .usingPage {display:block;}';
+                       css += 'html.ponyhoof_isusingbusiness #ponyhoof_dialog_options .notBusiness {display:none;}';
+                       
+                       css += '#ponyhoof_dialog_options .uiHelpLink {margin-left:2px;}';
+                       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;}';
+                       css += '#ponyhoof_dialog_options textarea {resize:vertical;width:100%;height:60px;min-height:60px;line-height:normal;}';
+                       css += '#ponyhoof_dialog_options .ponyhoof_tabs > a[data-ponyhoof-tab="advanced"] {display:none;}';
+                       css += '#ponyhoof_dialog_options.ponyhoof_options_debugExposed .ponyhoof_tabs > a[data-ponyhoof-tab="advanced"] {display:block;}';
+
+                       // 214px
+                       css += '.ponyhoof_options_fatradio {margin:8px 0;}';
+                       css += '.ponyhoof_options_fatradio li {width:222px;float:left;margin-left:12px;}';
+                               css += '#ponyhoof_options_tabs_background.hasCustom .ponyhoof_options_fatradio li {width:144px;}';
+                       css += '.ponyhoof_options_fatradio li:first-child {margin:0;}';
+                       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;}';
+                       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);}';
+                       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);}';
+                       css += '.ponyhoof_options_fatradio li.active a {background-color:#6D84B4;border-color:#3b5998;color:#fff;}';
+                       css += '.ponyhoof_options_fatradio span {padding:4px;display:block;}';
+                       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;}';
+                               css += '#ponyhoof_options_tabs_background.hasCustom .ponyhoof_options_fatradio .wrap i {height:144px;}';
+                       css += '#ponyhoof_options_background_cutie .wrap {padding:8px;}';
+                       css += '#ponyhoof_options_background_cutie .wrap i {width:206px;height:184px;}';
+                               css += '#ponyhoof_options_tabs_background.hasCustom #ponyhoof_options_background_cutie .wrap i {width:128px;height:128px;}';
+                       css += '#ponyhoof_options_background_custom {display:none;}';
+                               css += '#ponyhoof_options_tabs_background.hasCustom #ponyhoof_options_background_custom {display:block;}';
+                       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;}';
+
+                       css += '#ponyhoof_options_background_error {margin-bottom:10px;}';
+                       css += '#ponyhoof_options_background_drop {background:#fff;border:2px dashed #75a3f5;padding:8px;position:relative;}'; //margin-bottom:8px;
+                       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;}';
+                       css += '#ponyhoof_options_background_drop.ponyhoof_dropping #ponyhoof_options_background_drop_dropping {display:block;}';
+
+                       css += '#ponyhoof_options_tabs_main .ponyhoof_message {margin-top:10px;}';
+                       css += '#ponyhoof_browserponies .ponyhoof_loading {display:none;margin-top:0;vertical-align:text-bottom;}';
+                       css += '#ponyhoof_browserponies.ponyhoof_browserponies_loading .ponyhoof_loading {display:inline-block;}';
+                       css += '#ponyhoof_options_randomPonies .ponyhoof_loading {display:none !important;}';
+                       css += '#ponyhoof_options_randomPonies .ponyhoof_menuitem_checked {display:block;}';
+                       //css += '#ponyhoof_options_tabs_sounds .ponyhoof_message.unavailable {margin-bottom:10px;}';
+                       css += '#ponyhoof_options_soundsSettingsWrap {margin-top:-14px;}';
+                       css += '#ponyhoof_options_soundsVolume {vertical-align:middle;width:50px;}';
+                       css += '#ponyhoof_options_soundsVolume[type="range"] {cursor:pointer;width:200px;}';
+                       css += '#ponyhoof_options_soundsVolumePreview {vertical-align:middle;}';
+                       css += '#ponyhoof_options_soundsVolumeValue {display:none;padding-left:3px;}';
+                       css += '#ponyhoof_options_soundsChatSoundWarning {margin-bottom:10px;}';
+                       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;}';
+                       css += '#ponyhoof_options_tabs_advanced .ponyhoof_hide_if_injected.ponyhoof_message {margin-bottom:10px;}';
+                       css += '.ponyhoof_options_aboutsection {border-top:1px solid #ccc;margin:10px -10px 0;}';
+                       css += '.ponyhoof_options_aboutsection > .inner {border-top:1px solid #E9E9E9;padding:10px 10px 0;}';
+                       css += '#ponyhoof_options_devpic {display:block;}';
+                       css += '#ponyhoof_options_devpic img {width:50px !important;height:50px !important;}';
+                       css += '#ponyhoof_options_twitter {margin-top:10px;width:100%;height:20px;}';
+                       css += '#ponyhoof_options_plusone {margin-top:10px;height:23px;}';
+
+                       css += '.ponyhoof_tip_wrapper {position:relative;z-index:10;}';
+                       css += '.ponyhoof_tip_trigger, .ponyhoof_tip_trigger:hover {text-decoration:none;}';
+                       css += '.ponyhoof_tip_trigger:hover .ponyhoof_tip {display:block;}';
+                       css += '.ponyhoof_options_unavailable .ponyhoof_tip_trigger {display:none !important;}';
+                       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;}';
+                       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);}';
+                       css += '.ponyhoof_tip_arrow {position:absolute;top:0;right:10px;border:solid transparent;border-width:0 3px 5px 4px;border-bottom-color:#888;}';
+
+                       css += '#ponyhoof_donate {background:#EDEFF4;border:1px solid #D2DBEA;color:#9CADCF;font-family:Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;}';
+                       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%;}';
+                       css += '#ponyhoof_donate a {display:block;width:100%;color:#9CADCF;text-decoration:none;}';
+                       css += '#ponyhoof_options_donatepaypal {border-right:1px solid #D2DBEA;}';
+                       //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;}';
+                       css += '#ponyhoof_donate_flattr_iframe {width:55px;height:62px;margin-top:6px;}';
+                       css += '#ponyhoof_donate a:hover {background-color:#DEDFE7;color:#3B5998;}';
+                       
+                       injectManualStyle(css, 'options');
+               };
+               
+               k.show = function() {
+                       if (!k.created) {
+                               k.create();
+                       }
+                       k.dialog.show();
+               };
+               
+               k.kr = false;
+               k.ks = [];
+               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';
+               k.kf = function(e) {
+                       if (k.kr) {
+                               return;
+                       }
+                       
+                       k.ks.push(e.which);
+                       if (k.ks.join(',').indexOf(k.kc) > -1) {
+                               k.kr = true;
+                               k.dialog.close();
+                               
+                               var width = 720;
+                               var height = 405;
+                               
+                               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');
+                               var di = new Dialog('ky');
+                               di.alwaysModal = true;
+                               di.create();
+                               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");
+                               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>');
+                               di.addCloseButton();
+                               di.onclosefinish = function() {
+                                       di.changeContent('');
+                               };
+                               
+                               $('ponyhoof_kc_share').addEventListener('click', function() {
+                                       var width = 657;
+                                       var height = 412;
+                                       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);
+                                       return false;
+                               }, false);
+                       }
+               };
+               
+               k.ki = function() {
+                       d.addEventListener('keydown', k.kf, true);
+               };
+       };
+       
+       var optionsGlobal = null;
+       function optionsOpen() {
+               log("Opening options...");
+               
+               if (!optionsGlobal) {
+                       optionsGlobal = new Options();
+               }
+               optionsGlobal.create();
+               optionsGlobal.show();
+
+               $$($('ponyhoof_dialog_options'), '#ponyhoof_options_pony .ponyhoof_button_menu', function(button) {
+                       try {
+                               button.focus();
+                       } catch (e) {}
+               });
+       }
+       
+       // Welcome
+       var WelcomeUI = function(param) {
+               var k = this;
+               
+               if (param) {
+                       k.param = param;
+               } else {
+                       k.param = {};
+               }
+               k.dialogFirst = null;
+               k.dialogPinkie = null;
+               k.dialogFinish = null;
+               
+               k._stack = '';
+               
+               k.start = function() {
+                       k.injectStyle();
+                       k.createScenery();
+                       addClass(d.documentElement, 'ponyhoof_welcome_html');
+                       statTrack('welcomeUI');
+                       
+                       k.showWelcome();
+               };
+               
+               k.showWelcome = function() {
+                       if ($('ponyhoof_dialog_welcome')) {
+                               return;
+                       }
+                       
+                       addClass(d.documentElement, 'ponyhoof_welcome_html_scenery_loaded');
+                       
+                       var co = '';
+                       co += '<div class="uiBoxYellow ponyhoof_message ponyhoof_updater_newVersion">';
+                               co += '<a href="#" class="uiButton uiButtonSpecial rfloat ponyhoof_updater_updateNow" role="button"><span class="uiButtonText">Update now</span></a>';
+                               co += '<span class="wrap">An update (v<span class="ponyhoof_updater_versionNum"></span>) for Ponyhoof is available.</span>';
+                       co += '</div>';
+                       
+                       co += '<strong>Select your favorite character to get started:</strong>';
+                       co += '<div id="ponyhoof_welcome_pony"></div>';
+                       co += '<div id="ponyhoof_welcome_afterClose">You can re-select your character in Ponyhoof Options at the Account menu.</div>';
+                       
+                       var bottom = '';
+                       bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm uiButtonDisabled" role="button" id="ponyhoof_welcome_next"><span class="uiButtonText">Next</span></a>';
+                       
+                       DIALOGCOUNT += 5;
+
+                       k.dialogFirst = new Dialog('welcome');
+                       k.dialogFirst.canCardspace = false;
+                       k.dialogFirst.canCloseByEscapeKey = false;
+                       k.dialogFirst.create();
+                       k.dialogFirst.generic_dialogDiv.className += ' generic_dialog_fixed_overflow';
+                       if (BRONYNAME) {
+                               k.dialogFirst.changeTitle("Welcome to Ponyhoof, "+BRONYNAME+"!");
+                       } else {
+                               k.dialogFirst.changeTitle("Welcome to Ponyhoof!");
+                       }
+                       k.dialogFirst.changeContent(co);
+                       k.dialogFirst.changeBottom(bottom);
+                       
+                       DIALOGCOUNT += 4;
+
+                       var menuClosed = false;
+                       var ponySelector = new PonySelector($('ponyhoof_welcome_pony'), k.param);
+                       ponySelector.createSelector();
+                       w.setTimeout(function() {
+                               ponySelector.menu.open();
+                       }, 1);
+                       ponySelector.menu.afterClose = function() {
+                               if (!menuClosed) {
+                                       menuClosed = true;
+                                       addClass($('ponyhoof_welcome_afterClose'), 'show');
+                                       
+                                       addClass(d.documentElement, 'ponyhoof_welcome_showmedemo');
+                                       if ($('navAccount')) {
+                                               addClass($('navAccount'), 'openToggler');
+                                       }
+                                       //addClass($('ponyhoof_account_options'), 'active');
+                                       
+                                       w.setTimeout(function() {
+                                               removeClass($('ponyhoof_welcome_next'), 'uiButtonDisabled');
+                                       }, 200);
+                               }
+                       };
+                       
+                       w.setTimeout(function() {
+                               changeThemeSmart(CURRENTPONY);
+                       }, 10);
+                       k._stack = CURRENTSTACK;
+                       
+                       w.setTimeout(function() {
+                               var update = new Updater();
+                               update.checkForUpdates();
+                       }, 500);
+                       
+                       // Detect if the Facebook's chat sound setting is turned off
+                       // We need to do this here as it is async
+                       try {
+                               if (typeof USW.requireLazy == 'function') {
+                                       USW.requireLazy(['ChatOptions'], function(ChatOptions) {
+                                               if (!ChatOptions.getSetting('sound')) {
+                                                       userSettings.chatSound = false;
+                                               }
+                                       });
+                               }
+                       } catch (e) {
+                               error("Unable to hook to ChatOptions");
+                               dir(e);
+                       }
+
+                       $('ponyhoof_welcome_next').addEventListener('click', function(e) {
+                               if (hasClass(this, 'uiButtonDisabled')) {
+                                       e.preventDefault();
+                                       return false;
+                               }
+                               
+                               k.dialogFirst.close();
+                               fadeOut($('ponyhoof_welcome_scenery'));
+                               
+                               w.setTimeout(function() {
+                                       removeClass(d.documentElement, 'ponyhoof_welcome_showmedemo');
+                                       removeClass($('navAccount'), 'openToggler');
+                                       removeClass($('ponyhoof_account_options'), 'active');
+                               }, 100);
+                               
+                               userSettings.theme = CURRENTPONY;
+                               userSettings.chatSound1401 = true;
+                               // Detect Social Fixer
+                               if ($('bfb_options_button')) {
+                                       userSettings.show_messages_other = false;
+                               }
+                               saveSettings();
+
+                               globalSettings.lastVersion = VERSION;
+                               saveGlobalSettings();
+                               
+                               if (CURRENTPONY == 'pinkie') {
+                                       k.pinkieWelcome();
+                               } else {
+                                       k.createFinalDialog();
+                               }
+
+                               e.preventDefault();
+                       }, false);
+               };
+               
+               k.pinkieWelcome = function() {
+                       removeClass(d.documentElement, 'ponyhoof_welcome_html_scenery_loaded');
+
+                       var width = 720;
+                       var height = 405;
+                       
+                       var bottom = '';
+                       bottom += '<a href="#" class="uiButton uiButtonLarge uiButtonConfirm" role="button" id="ponyhoof_welcome_pinkie_next"><span class="uiButtonText">Stop being silly, Pinkie</span></a>';
+                       
+                       k.dialogPinkie = new Dialog('welcome_pinkie');
+                       k.dialogPinkie.alwaysModal = true;
+                       k.dialogPinkie.create();
+                       k.dialogPinkie.changeTitle("\x59\x4F\x55\x20\x43\x48\x4F\x4F\x53\x45\x20\x50\x49\x4E\x4B\x49\x45\x21\x3F\x21");
+                       k.dialogPinkie.changeContent('<iframe src="//hoof.little.my/files/aEPDsG6R4dY.htm" width="100%" height="405" scrolling="auto" frameborder="0" allowTransparency="true"></iframe>');
+                       k.dialogPinkie.changeBottom(bottom);
+                       k.dialogPinkie.onclose = function() {
+                               fadeOut($('ponyhoof_welcome_scenery'));
+                               k.createFinalDialog();
+                       };
+                       k.dialogPinkie.onclosefinish = function() {
+                               k.dialogPinkie.changeContent('');
+                       };
+                       
+                       $('ponyhoof_welcome_pinkie_next').addEventListener('click', function(e) {
+                               k.dialogPinkie.close();
+                               e.preventDefault();
+                       }, false);
+               };
+               
+               k.createFinalDialog = function() {
+                       removeClass(d.documentElement, 'ponyhoof_welcome_html');
+                       removeClass(d.documentElement, 'ponyhoof_welcome_html_scenery_loaded');
+                       
+                       var c = '';
+
+                       var lang = getDefaultUiLang();
+                       if (lang != 'en_US' && lang != 'en_GB') {
+                               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>';
+                       }
+
+                       if (!ISUSINGBUSINESS) {
+                               c += '<span class="ponyhoof_brohoof_button">'+capitaliseFirstLetter(CURRENTSTACK['like'])+'</span> us to receive news and help for Ponyhoof!';
+                               c += '<iframe src="about:blank" id="ponyhoof_welcome_like" scrolling="no" frameborder="0" allowTransparency="true"></iframe>';
+                               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>';
+                       } else {
+                               c += '<a href="'+w.location.protocol+PONYHOOF_URL+'" target="_top" id="ponyhoof_welcome_posttowall">Visit our Ponyhoof page for the latest news!</a>';
+                       }
+                       
+                       var successText = '';
+                       var ponyData = convertCodeToData(CURRENTPONY);
+                       if (ponyData.successText) {
+                               successText = ponyData.successText;
+                       } else {
+                               successText = "Yay!";
+                       }
+
+                       k.dialogFinish = new Dialog('welcome_final');
+                       if (k._stack != CURRENTSTACK) {
+                               k.dialogFinish.alwaysModal = true;
+                       }
+                       k.dialogFinish.create();
+                       k.dialogFinish.changeTitle(successText);
+                       k.dialogFinish.changeContent(c);
+                       var buttonText = CURRENTLANG.done;
+                       if (k._stack != CURRENTSTACK) {
+                               buttonText = CURRENTLANG.finish;
+                       }
+                       k.dialogFinish.changeBottom('<a href="#" class="uiButton uiButtonLarge uiButtonConfirm" role="button" id="ponyhoof_welcomefinal_ok"><span class="uiButtonText">'+buttonText+'</span></a>');
+                       k.dialogFinish.onclose = function() {
+                               if (k._stack != CURRENTSTACK) {
+                                       w.location.reload();
+                               }
+                       };
+
+                       $('ponyhoof_welcomefinal_ok').addEventListener('click', k.dialogFinishOk, false);
+                       $('ponyhoof_welcomefinal_ok').focus();
+                       
+                       if (!ISUSINGBUSINESS) {
+                               w.setTimeout(function() {
+                                       $('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';
+                               }, 1);
+                       }
+                       
+                       $('ponyhoof_welcome_posttowall').addEventListener('click', function(e) {
+                               k.dialogFinish.onclose = function() {};
+                               k.dialogFinish.close();
+                       }, false);
+               };
+
+               k.dialogFinishOk = function(e) {
+                       if (k._stack != CURRENTSTACK) {
+                               if (hasClass(this, 'uiButtonDisabled')) {
+                                       return false;
+                               }
+                               
+                               this.className += ' uiButtonDisabled';
+                               w.location.reload();
+                       } else {
+                               k.dialogFinish.close();
+                       }
+                       e.preventDefault();
+               };
+               
+               k.createScenery = function() {
+                       if ($('ponyhoof_welcome_scenery')) {
+                               $('ponyhoof_welcome_scenery').style.display = 'block';
+                               return;
+                       }
+                       
+                       var n = d.createElement('div');
+                       n.id = 'ponyhoof_welcome_scenery';
+                       d.body.appendChild(n);
+                       
+                       return n;
+               };
+               
+               k.injectStyle = function() {
+                       var css = '';
+                       css += 'html.ponyhoof_welcome_html {overflow:hidden;}';
+                       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;}';
+                       css += 'html #ponyhoof_dialog_welcome .generic_dialog_fixed_overflow {background:transparent !important;}';
+                       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)+';}';
+                       
+                       //css += '#ponyhoof_dialog_welcome .generic_dialog {z-index:401 !important;}';
+                       css += '#ponyhoof_dialog_welcome .generic_dialog_popup, #ponyhoof_dialog_welcome .popup {width:475px !important;}';
+                       //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;}';
+                       css += '#ponyhoof_dialog_welcome .ponyhoof_updater_newVersion {margin-bottom:10px;}';
+                       
+                       css += '#ponyhoof_welcome_newVersion {display:none;margin:0 0 10px;}';
+                       css += '#ponyhoof_welcome_pony {margin:8px 0;}';
+                       css += '#ponyhoof_welcome_afterClose {visibility:hidden;opacity:0;}';
+                       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;}';
+                       
+                       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;}';
+                       css += 'html.ponyhoof_welcome_showmedemo {cursor:not-allowed;}';
+                       css += 'html.ponyhoof_welcome_showmedemo .popup {cursor:default;}';
+                       css += 'html.ponyhoof_welcome_showmedemo #blueBar #pageHead {width:981px !important;padding-right:0 !important;}';
+                       css += 'html.sidebarMode.ponyhoof_welcome_showmedemo #pageHead, html.sidebarMode.ponyhoof_welcome_showmedemo .sidebarMode #globalContainer {left:0 !important;}';
+                       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;}';
+                       
+                       css += '#ponyhoof_dialog_welcome_pinkie .generic_dialog_popup, #ponyhoof_dialog_welcome_pinkie .popup {width:720px;}';
+                       css += '#ponyhoof_dialog_welcome_pinkie .content {line-height:0;padding:0;}';
+                       
+                       css += '#ponyhoof_welcome_like {border:none;overflow:hidden;width:292px;height:62px;margin:8px 0;display:block;}';
+                       
+                       injectManualStyle(css, 'welcome');
+               };
+       };
+       
+       // Theme
+       function getFaviconTag() {
+               var l = d.getElementsByTagName('link');
+               for (var i = 0, len = l.length; i < len; i += 1) {
+                       if (l[i].getAttribute('rel') == 'shortcut icon') {
+                               return l[i];
+                       }
+               }
+               
+               return false;
+       }
+       
+       function changeFavicon(character) {
+               if (userSettings.noFavicon) {
+                       return;
+               }
+
+               var favicon = getFaviconTag();
+               
+               if (favicon) {
+                       var newIcon = favicon.cloneNode(true);
+               } else {
+                       var newIcon = d.createElement('link');
+                       newIcon.rel = 'shortcut icon';
+               }
+               
+               if (character != 'NONE') {
+                       newIcon.type = 'image/png';
+
+                       var data = convertCodeToData(character);
+                       if (data.icon16) {
+                               newIcon.href = THEMEURL+data.icon16;
+                       } else {
+                               newIcon.href = THEMEURL+character+'/icon16.png';
+                       }
+               } else {
+                       newIcon.type = 'image/x-icon';
+                       newIcon.href = '//fbstatic-a.akamaihd.net/rsrc.php/y9/r/FXHC9IQ-JIj.ico';
+               }
+
+               if (favicon) {
+                       favicon.parentNode.replaceChild(newIcon, favicon);
+               } else {
+                       d.head.appendChild(newIcon);
+               }
+       }
+       
+       function changeStack(character) {
+               var pony = convertCodeToData(character);
+               CURRENTSTACK = STACKS_LANG[0];
+               if (pony.stack) {
+                       for (var i = 0, len = STACKS_LANG.length; i < len; i += 1) {
+                               if (STACKS_LANG[i].stack == pony.stack) {
+                                       CURRENTSTACK = STACKS_LANG[i];
+                                       break;
+                               }
+                       }
+               }
+
+               if (UILANG == 'fb_LT') {
+                       if (CURRENTSTACK['people'] == 'ponies') {
+                               CURRENTSTACK['people'] = 'pwnies';
+                       }
+                       if (CURRENTSTACK['person'] == 'pony') {
+                               CURRENTSTACK['person'] = 'pwnie';
+                       }
+                       if (CURRENTSTACK['like'] == 'brohoof') {
+                               CURRENTSTACK['like'] = '/)';
+                       }
+                       if (CURRENTSTACK['likes'] == 'brohoofs') {
+                               CURRENTSTACK['likes'] = '/)';
+                       }
+                       //if (CURRENTSTACK['unlike'] == 'unbrohoof') {
+                       //      CURRENTSTACK['unlike'] = '/)(\\';
+                       //}
+                       if (CURRENTSTACK['like_past'] == 'brohoof') {
+                               CURRENTSTACK['like_past'] = '/)';
+                       }
+                       if (CURRENTSTACK['likes_past'] == 'brohoofs') {
+                               CURRENTSTACK['likes_past'] = '/)';
+                       }
+                       if (CURRENTSTACK['liked'] == 'brohoof\'d') {
+                               CURRENTSTACK['liked'] = '/)';
+                       }
+                       if (CURRENTSTACK['liked_button'] == 'brohoof\'d') {
+                               CURRENTSTACK['liked_button'] = '/)';
+                       }
+                       if (CURRENTSTACK['liking'] == 'brohoofing') {
+                               CURRENTSTACK['liking'] = '/)';
+                       }
+               }
+       }
+       
+       var changeThemeFuncQueue = [];
+       function changeTheme(character) {
+               addClass(d.documentElement, 'ponyhoof_injected');
+               
+               REALPONY = character;
+               d.documentElement.setAttribute('data-ponyhoof-character', character);
+
+               changeFavicon(character);
+               changeStack(character);
+               buildStackLang();
+               
+               if (changeThemeFuncQueue) {
+                       for (var x in changeThemeFuncQueue) {
+                               if (changeThemeFuncQueue.hasOwnProperty(x) && changeThemeFuncQueue[x]) {
+                                       changeThemeFuncQueue[x]();
+                               }
+                       }
+               }
+
+               // Did we injected our theme already?
+               if ($('ponyhoof_userscript_style')) {
+                       changeCostume(userSettings.costume);
+                       $('ponyhoof_userscript_style').href = THEMECSS+character+THEMECSS_EXT;
+                       return;
+               }
+               
+               addClass(d.documentElement, 'ponyhoof_initial');
+               w.setTimeout(function() {
+                       removeClass(d.documentElement, 'ponyhoof_initial');
+               }, 1000);
+
+               var n = d.createElement('link');
+               n.href = THEMECSS+character+THEMECSS_EXT;
+               n.type = 'text/css';
+               n.rel = 'stylesheet';
+               n.id = 'ponyhoof_userscript_style';
+               d.head.appendChild(n);
+
+               changeCostume(userSettings.costume);
+       }
+       
+       function getRandomPony() {
+               while (1) {
+                       var r = randNum(0, PONIES.length-1);
+                       if (!PONIES[r].hidden) {
+                               return PONIES[r].code;
+                       }
+               }
+       }
+       
+       function getRandomMane6() {
+               while (1) {
+                       var r = randNum(0, PONIES.length-1);
+                       if (PONIES[r].mane6) {
+                               return PONIES[r].code;
+                       }
+               }
+       }
+       
+       function convertCodeToData(code) {
+               for (var i = 0, len = PONIES.length; i < len; i += 1) {
+                       if (PONIES[i].code == code) {
+                               return PONIES[i];
+                       }
+               }
+               
+               return false;
+       }
+       
+       function changeThemeSmart(theme) {
+               switch (theme) {
+                       case 'NONE':
+                               removeClass(d.documentElement, 'ponyhoof_injected');
+                               changeFavicon('NONE');
+                               changeCostume(null);
+                               
+                               var style = $('ponyhoof_userscript_style');
+                               if (style) {
+                                       style.parentNode.removeChild(style);
+                               }
+                               break;
+
+                       case 'RANDOM':
+                               var current = [];
+                               if (userSettings.randomPonies) {
+                                       current = userSettings.randomPonies.split('|');
+                                       changeTheme(current[Math.floor(Math.random() * current.length)]);
+                               } else {
+                                       changeTheme(getRandomPony());
+                               }
+
+                               break;
+
+                       default:
+                               if (theme == 'login' || convertCodeToData(theme)) {
+                                       changeTheme(theme);
+                               } else {
+                                       error("changeThemeSmart: "+theme+" is not a valid theme");
+                                       userSettings.theme = null;
+                                       CURRENTPONY = REALPONY = 'NONE';
+                               }
+                               break;
+               }
+       }
+
+       function changeCustomBg(base64) {
+               if (!base64) {
+                       removeClass(d.documentElement, 'ponyhoof_settings_login_bg');
+                       removeClass(d.documentElement, 'ponyhoof_settings_customBg');
+
+                       var style = $('ponyhoof_style_custombg');
+                       if (style) {
+                               style.parentNode.removeChild(style);
+                       }
+                       return;
+               }
+
+               addClass(d.documentElement, 'ponyhoof_settings_login_bg');
+               addClass(d.documentElement, 'ponyhoof_settings_customBg');
+
+               if (!$('ponyhoof_style_custombg')) {
+                       injectManualStyle('', 'custombg');
+               }
+               $('ponyhoof_style_custombg').textContent = '/* '+SIG+' */html,.fbIndex{background-position:center center !important;background-image:url("'+base64+'") !important;}';
+       }
+
+       var changeCostume = function(costume) {
+               // Make sure the costume exists
+               if (!COSTUMESX[costume]) {
+                       removeCostume();
+                       return false;
+               }
+
+               // Make sure the character has the costume
+               if (!doesCharacterHaveCostume(REALPONY, costume)) {
+                       //removeCostume(); // leaving the costume alone wouldn't hurt...
+                       return false;
+               }
+
+               d.documentElement.setAttribute('data-ponyhoof-costume', costume);
+       };
+
+       var removeCostume = function() {
+               d.documentElement.removeAttribute('data-ponyhoof-costume');
+       };
+
+       var doesCharacterHaveCostume = function(character, costume) {
+                return (COSTUMESX[costume] && COSTUMESX[costume].characters && COSTUMESX[costume].characters.indexOf(character) != -1);
+       }
+
+       function getBronyName() {
+               var name = d.querySelector('.headerTinymanName, #navTimeline > .navLink, .fbxWelcomeBoxName, ._521h ._4g5y, .-cx-PRIVATE-litestandSidebarBookmarks__profilewrapper .-cx-PRIVATE-litestandSidebarBookmarks__name');
+               if (name) {
+                       BRONYNAME = name.textContent;
+               }
+
+               return BRONYNAME;
+       }
+
+       function getDefaultUiLang() {
+               if (!d.body) {
+                       return false;
+               }
+               var classes = d.body.className.split(' ');
+               for (var i = 0, len = classes.length; i < len; i += 1) {
+                       if (classes[i].indexOf('Locale_') == 0) {
+                               return classes[i].substring('Locale_'.length);
+                       }
+               }
+
+               return false;
+       }
+       
+       // Screen saver
+       var screenSaverTimer = null;
+       var screenSaverActive = false;
+       var screenSaverInactivity = function() {
+               if (!screenSaverActive) {
+                       addClass(d.body, 'ponyhoof_screensaver');
+               }
+               screenSaverActive = true;
+       };
+       var screenSaverActivity = function() {
+               if (screenSaverActive) {
+                       removeClass(d.body, 'ponyhoof_screensaver');
+               }
+               screenSaverActive = false;
+               
+               w.clearTimeout(screenSaverTimer);
+               screenSaverTimer = w.setTimeout(screenSaverInactivity, 30000);
+       };
+       var screenSaverActivate = function() {
+               var mousemoveX = 0;
+               var mousemoveY = 0;
+               
+               d.addEventListener('click', screenSaverActivity, true);
+               d.addEventListener('mousemove', function(e) {
+                       if (mousemoveX == e.clientX && mousemoveY == e.clientY) {
+                               return;
+                       }
+                       mousemoveX = e.clientX;
+                       mousemoveY = e.clientY;
+                       
+                       screenSaverActivity();
+               }, true);
+               d.addEventListener('keydown', screenSaverActivity, true);
+               d.addEventListener('contextmenu', screenSaverActivity, true);
+               d.addEventListener('mousewheel', screenSaverActivity, true);
+               d.addEventListener('touchstart', screenSaverActivity, true);
+               
+               screenSaverActivity();
+       };
+       
+       // DOMNodeInserted
+       var domReplaceText = function(ele, cn, deeper, regex, text) {
+               var t = '';
+               var id = ele.getAttribute('id');
+               if ((cn == '' && deeper == '') || (cn && hasClass(ele, cn)) || (cn && id && id == nc)) {
+                       t = ele.innerHTML;
+                       t = t.replace(regex, text);
+                       if (ele.innerHTML != t) {
+                               ele.innerHTML = t;
+                       }
+                       
+                       return;
+               }
+               
+               if (deeper) {
+                       var query = ele.querySelectorAll(deeper);
+                       if (query.length) {
+                               for (var i = 0, len = query.length; i < len; i += 1) {
+                                       t = query[i].innerHTML;
+                                       t = t.replace(regex, text);
+                                       if (query[i].innerHTML != t) {
+                                               query[i].innerHTML = t;
+                                       }
+                               }
+                       }
+               }
+       };
+       
+       var _fb_input_placeholderChanged = false;
+       var domChangeTextbox = function(ele, cn, text) {
+               var query = ele.querySelectorAll(cn);
+               if (!query.length) {
+                       return;
+               }
+               if (!_fb_input_placeholderChanged) {
+                       contentEval(function(arg) {
+                               try {
+                                       if (typeof window.requireLazy == 'function') {
+                                               window.requireLazy(['Input'], function(Input) {
+                                                       var _setPlaceholder = Input.setPlaceholder;
+                                                       Input.setPlaceholder = function(textbox, t) {
+                                                               if (!textbox.getAttribute('data-ponyhoof-ponified-overridefb')) {
+                                                                       if (textbox != document.activeElement) {
+                                                                               _setPlaceholder(textbox, t);
+                                                                       }
+                                                                       textbox.setAttribute('data-ponyhoof-ponified-overridefb', 1);
+                                                               } else {
+                                                                       // we already overridden, now FB wants to change the placeholder
+                                                                       if (textbox.getAttribute('placeholder') == '' && t) {
+                                                                               if (textbox.title) {
+                                                                                       // for composer
+                                                                                       _setPlaceholder(textbox, textbox.title);
+                                                                               } else {
+                                                                                       // for typeahead (share dialog > private message)
+                                                                                       _setPlaceholder(textbox, t);
+                                                                               }
+                                                                       } else if (t == '') {
+                                                                               // allow blanking placeholder (for typeahead)
+                                                                               _setPlaceholder(textbox, t);
+                                                                       }
+                                                               }
+                                                       };
+                                               });
+                                       }
+                               } catch (e) {
+                                       if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
+                                               console.log("Unable to override Input.setPlaceholder()");
+                                               console.dir(e);
+                                       }
+                               }
+                       }, {"CANLOG":CANLOG});
+                       _fb_input_placeholderChanged = true;
+               }
+
+               var placeholders = [];
+               for (var i = 0, len = query.length; i < len; i += 1) {
+                       var textbox = query[i];
+                       if (textbox.getAttribute('data-ponyhoof-ponified')) {
+                               continue;
+                       }
+                       textbox.setAttribute('data-ponyhoof-ponified', 1);
+
+                       if (typeof text == 'function') {
+                               placeholders[i] = text(textbox);
+                       } else {
+                               placeholders[i] = text;
+                       }
+
+                       textbox.title = placeholders[i];
+                       textbox.setAttribute('aria-label', placeholders[i]);
+                       textbox.setAttribute('placeholder', placeholders[i]);
+
+                       if (hasClass(textbox, 'DOMControl_placeholder')) {
+                               textbox.value = placeholders[i];
+                       }
+               }
+
+               /*try {
+                       if (typeof USW.requireLazy == 'function') {
+                               USW.requireLazy(['TextAreaControl'], function(TextAreaControl) {
+                                       for (var i = 0; i < query.length; i++) {
+                                               if (placeholders[i]) {
+                                                       //if (query[i] != d.activeElement) {
+                                                               TextAreaControl.getInstance(query[i]).setPlaceholderText(placeholders[i]);
+                                                       //}
+                                               }
+                                       }
+                               });
+                       } else {*/
+                               for (var i = 0, len = query.length; i < len; i += 1) {
+                                       if (placeholders[i]) {
+                                               var textbox = query[i];
+                                               if (!textbox.getAttribute('data-ponyhoof-ponified-overridefb')) {
+                                                       textbox.setAttribute('aria-label', placeholders[i]);
+                                                       textbox.setAttribute('placeholder', placeholders[i]);
+                                                       textbox.setAttribute('data-ponyhoof-ponified-overridefb', 1);
+                                                       if (textbox == d.activeElement) {
+                                                               continue;
+                                                       }
+                                                       if (textbox.value == '' || hasClass(textbox, 'DOMControl_placeholder')) {
+                                                               if (placeholders[i]) {
+                                                                       addClass(textbox, 'DOMControl_placeholder');
+                                                               } else {
+                                                                       removeClass(textbox, 'DOMControl_placeholder');
+                                                               }
+                                                               textbox.value = placeholders[i] || '';
+                                                       }
+                                               }
+                                       }
+                               }
+                       /*}
+               } catch (e) {
+                       error("Unable to hook to TextAreaControl");
+                       dir(e);
+               }*/
+       };
+
+       var domReplaceFunc = function(ele, cn, deeper, func) {
+               if (!ele || (cn == '' && deeper == '')) {
+                       return;
+               }
+               
+               var id = ele.getAttribute('id');
+               if ((cn && hasClass(ele, cn)) || (cn && id && id == cn)) {
+                       func(ele);
+                       return;
+               }
+               
+               if (deeper) {
+                       var query = ele.querySelectorAll(deeper);
+                       if (query.length) {
+                               for (var i = 0, len = query.length; i < len; i += 1) {
+                                       func(query[i]);
+                               }
+                       }
+               }
+       };
+       
+       var replaceText = function(arr, t) {
+               var lowercase = t.toLowerCase();
+               for (var i = 0, len = arr.length; i < len; i += 1) {
+                       if (arr[i][0] instanceof RegExp) {
+                               t = t.replace(arr[i][0], arr[i][1]);
+                       } else {
+                               if (arr[i][0].toLowerCase() == lowercase) {
+                                       t = arr[i][1];
+                               }
+                       }
+               }
+               
+               return t;
+       };
+
+       var loopChildText = function(ele, func) {
+               if (!ele || !ele.childNodes) {
+                       return;
+               }
+               for (var i = 0, len = ele.childNodes.length; i < len; i += 1) {
+                       func(ele.childNodes[i]);
+               }
+       };
+       
+       var buttonTitles = [];
+       var dialogTitles = [];
+       var tooltipTitles = [];
+       var headerTitles = [];
+       var menuTitles = [];
+       var menuPrivacyOnlyTitles = [];
+       var dialogDerpTitles = [];
+       var headerInsightsTitles = [];
+       var dialogDescriptionTitles = [];
+       function buildStackLang() {
+               var ponyData = convertCodeToData(REALPONY);
+
+               buttonTitles = [
+                        ["Done", "Eeyup"]
+                       ,["Okay", "Eeyup"]
+                       ,["Done Editing", "Eeyup"]
+                       ,["Save Changes", "Eeyup"]
+                       ,["OK", "Eeyup"]
+                       
+                       ,[/everyone/i, "Everypony"] // for Everyone (Most Recent)
+                       ,["Everybody", "Everypony"]
+                       ,["Public", "Everypony"]
+                       ,["Anyone", "Anypony"]
+                       ,["Friends of Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["Friends of Guests", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of Guests"]
+                       ,["Only Me", "Alone"]
+                       ,["Only me", "Alone"]
+                       ,["Only Me (+)", "Alone (+)"]
+                       ,["Only me (+)", "Alone (+)"]
+                       ,["No One", "Alone"]
+                       ,["Nobody", "Nopony"]
+                       
+                       ,["Add Friend", "Add "+capitaliseFirstLetter(CURRENTSTACK['friend'])]
+                       ,["Friend Request Sent", "Friendship Request Sent"]
+                       ,["Respond to Friend Request", "Respond to Friendship Request"]
+                       ,["Like", capitaliseFirstLetter(CURRENTSTACK['like'])]
+                       ,["Liked", capitaliseFirstLetter(CURRENTSTACK['liked_button'])]
+                       ,["Unlike", capitaliseFirstLetter(CURRENTSTACK['unlike'])]
+                       ,["Like Page", capitaliseFirstLetter(CURRENTSTACK['like'])+" Page"]
+                       ,["Like This Page", capitaliseFirstLetter(CURRENTSTACK['like'])+" This Page"]
+                       ,["Suggest Friends", "Suggest "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["Suggest Friend", "Suggest "+capitaliseFirstLetter(CURRENTSTACK['friend'])]
+                       ,["All Friends", "All "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["All friends", "All "+CURRENTSTACK['friends']]
+                       ,["Poke", "Nuzzle"]
+                       
+                       ,["Likes", capitaliseFirstLetter(CURRENTSTACK['likes'])]
+                       ,["Friends' Posts", capitaliseFirstLetter(CURRENTSTACK['friends'])+"' Posts"]
+                       
+                       ,["Photos", "Pony Pics"]
+                       ,["People", capitaliseFirstLetter(CURRENTSTACK['people'])]
+                       ,["Banned", "Banished to Moon"]
+                       ,["Blocked", "Banished to Moon"]
+                       ,["People who like this", capitaliseFirstLetter(CURRENTSTACK.people)+" that "+CURRENTSTACK.like_past+" this"]
+                       ,["Pages that like this", "Pages that "+CURRENTSTACK.like_past+" this"]
+                       
+                       ,["Delete and Ban User", "Nuke and Banish to Moon"]
+                       ,["Remove from Friends", "Banish to Moon"]
+                       ,["Delete", "Nuke"]
+                       ,["Delete Photo", "Nuke Pony Pic"]
+                       ,["Delete Page", "Nuke Page"]
+                       ,["Delete All", "Nuke All"]
+                       ,["Delete Selected", "Nuke Selected"]
+                       ,["Delete Conversation", "Nuke Conversation"]
+                       ,["Delete Message", "Nuke Friendship Report"]
+                       ,["Delete Messages", "Nuke Friendship Reports"]
+                       ,["Delete Post", "Nuke Post"]
+                       ,["Remove", "Nuke"]
+                       ,["Delete Report", "Nuke This Whining"]
+                       ,["Report", "Whine"]
+                       ,["Report as Spam", "Whine as Spam"]
+                       ,["Clear Searches", "Nuke Searches"]
+                       ,["Report/Remove Tags", "Whine/Nuke Tags"]
+                       ,["Untag Photo", "Untag Pony Pic"]
+                       ,["Untag Photos", "Untag Pony Pics"]
+                       ,["Delete My Account", "Nuke My Account"]
+                       ,["Allowed on Timeline", "Allowed on Journal"]
+                       ,["Hidden from Timeline", "Hidden from Journal"]
+                       ,["Unban", "Unbanish"]
+                       ,["Delete Album", "Nuke Album"]
+                       ,["Cancel Report", "Cancel Whining"]
+                       ,["Unfriend", "Banish to Moon"]
+                       ,["Delete List", "Nuke List"]
+                       
+                       ,["Messages", "Trough"]
+                       ,["New Message", "Write a Friendship Report"]
+                       ,["Other Messages", "Other Friendship Reports"]
+                       
+                       ,["Share Photo", "Share Pony Pic"]
+                       ,["Share Application", "Share Magic"]
+                       ,["Share Note", "Share Scroll"]
+                       ,["Share Question", "Share Query"]
+                       ,["Share Event", "Share Adventure"]
+                       ,["Share Group", "Share Herd"]
+                       ,["Send Message", "Send Friendship Letter"]
+                       ,["Share Photos", "Share Pony Pics"]
+                       ,["Share This Note", "Share This Scroll"] // entstream
+                       ,["Share This Photo", "Share This Pony Pic"]
+                       
+                       ,["Add Friends", "Add "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["Go to App", "Go to Magic"]
+                       ,["Back to Timeline", "Back to Journal"]
+                       ,["Add App", "Add Magic"]
+                       ,["Get More Likes", "Get More "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
+                       ,["Advertise Your App", "Advertise Your Magic"]
+                       ,["Leave App", "Leave Magic"]
+                       ,["Find another app", "Find another magic"]
+                       ,["Post on your timeline", "Post on your journal"]
+                       ,["App Center", "Magic Center"]
+                       ,["View App Center", "View Magic Center"]
+
+                       ,["Events", "Adventures"]
+                       ,["Page Events", "Page Adventures"]
+                       ,["Suggested Events", "Suggested Adventures"]
+                       ,["Past Events", "Past Adventures"]
+                       ,["Declined Events", "Declined Adventures"]
+                       ,["Create Event", "Plan an Adventure"]
+                       ,["Save Event", "Save Adventure"]
+                       ,["Back to Event", "Back to Adventure"]
+                       ,["Invite Friends", "Invite "+capitaliseFirstLetter(CURRENTSTACK['friends_logic'])]
+                       ,["Page Event", "Page Adventures"]
+                       ,["Upcoming Events", "Upcoming Adventures"]
+                       ,["Group Events", "Herd Adventures"]
+                       ,["Change Event Photo", "Change Pony Pic for Adventure"]
+                       ,["Add Event Photo", "Add Pony Pic for Adventure"]
+                       ,["+ Create an Event", "+ Plan an Adventure"]
+
+                       ,["Friend Activity", capitaliseFirstLetter(CURRENTSTACK['friend'])+" Activity"]
+                       ,["Activity Log", "Adventure Log"]
+
+                       ,["Invite More Friends", "Invite More Pals"]
+                       ,["Find Friends", "Find Friendship"]
+                       ,["Pages I Like", "Pages I "+capitaliseFirstLetter(CURRENTSTACK['like_past'])]
+                       ,["Find My Friends", "Find Friendship"]
+                       
+                       ,["Leave Group", "Leave Herd"]
+                       ,["Set Up Group Address", "Set Up Herd Address"]
+                       ,["Change Group Photo", "Change Herd Pony Pic"]
+                       ,["Notifications", "Sparks"]
+                       ,["Start Chat", "Start Whinny Chat"]
+                       ,["Create Group", "Create Herd"]
+                       ,["Add People", "Add "+capitaliseFirstLetter(CURRENTSTACK['people'])]
+                       ,["Groups", "Herds"]
+                       ,["Join Group", "Join the Herd"]
+                       ,["View group", "View herd"]
+                       ,["Create New Group", "Create New Herd"]
+                       ,["Set Up Group", "Set Up Herd"] // tour
+                       
+                       ,["Move photo", "Move pony pic"]
+                       ,["Delete Photos", "Nuke Pony Pics"]
+                       ,["Keep Photos", "Keep Pony Pics"]
+                       ,["Save Photo", "Save Pony Pic"]
+                       ,["Tag Photos", "Tag Pony Pics"]
+                       ,["Add Photos", "Add Pony Pics"]
+                       ,["Upload Photos", "Upload Pony Pics"]
+                       ,["Tag Photo", "Tag Pony Pic"]
+                       ,["Add More Photos", "Add More Pony Pics"]
+                       ,["Post Photos", "Post Pony Pics"]
+                       ,["Add Photos to Map", "Add Pony Pics to Map"]
+                       ,["Add Photo", "Add Pony Pic"]
+                       
+                       ,["On your own timeline", "On your own journal"]
+                       ,["On a friend's timeline", "On a "+CURRENTSTACK['friend']+"'s journal"]
+                       ,["In a group", "In a herd"]
+                       ,["In a private Message", "In a private Friendship Report"]
+
+                       ,["Timeline", "Journal"]
+                       ,["Notes", "Scrolls"]
+                       ,["Comments", "Friendship Letters"]
+                       ,["Posts and Apps", "Posts and Magic"]
+                       ,["Timeline Review", "Journal Review"]
+                       ,["Pokes", "Nuzzles"]
+                       ,["Add to Timeline", "Add to Journal"]
+
+                       ,["Photo", "Pony Pic"]
+                       ,["Question", "Query"]
+
+                       //,["Create List", "Create Directory"]
+                       ,["See All Friends", "See All "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       //,["Manage List", "Manage Directory"]
+                       ,["Write a Note", "Write a Scroll"]
+                       ,["Add Note", "Add Scroll"]
+                       ,["Edit Featured Likes", "Edit Featured "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
+                       ,["Add Featured Likes", "Add Featured "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
+                       ,["Add profile picture", "Add journal pony pic"]
+                       ,["Edit Profile Picture", "Edit Journal Pony Pic"]
+                       //,["Create an Ad", "Buy a Cupcake"]
+                       //,["On This List", "On This Directory"]
+                       ,["Friend Requests", "Friendship Requests"]
+                       //,["Add Friends to List", "Add "+capitaliseFirstLetter(CURRENTSTACK['friends'])+" to Directory"]
+                       ,["Add Friends to List", "Add "+capitaliseFirstLetter(CURRENTSTACK['friends'])+" to List"]
+
+                       ,["Pages I like", "Pages I "+capitaliseFirstLetter(CURRENTSTACK.like)]
+                       ,["My Friends", "My "+capitaliseFirstLetter(CURRENTSTACK.friends)]
+                       ,["Tell Friends", "Tell "+capitaliseFirstLetter(CURRENTSTACK.friends)]
+
+                       ,["Add to Profile", "Add to Journal"]
+                       ,["Add Likes", "Add "+capitaliseFirstLetter(CURRENTSTACK.likes)]
+                       ,["Set as Profile Picture", "Set as Journal Pony Pic"]
+                       ,["View Activity Log", "View Adventure Log"]
+                       ,["Invite Your Friends", "Invite Your "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["Suggest Photo", "Suggest Pony Pic"]
+                       ,["All Apps", "All Magic"]
+                       ,["Link My Profile to Twitter", "Link My Journal to Twitter"]
+                       ,["Link profile to Twitter", "Link journal to Twitter"]
+                       ,["The app sends you a notification", "The magic sends you a spark"]
+                       ,["Upload a Photo", "Upload a Pony Pic"]
+                       ,["Take a Photo", "Take a Pony Pic"]
+                       ,["Take a Picture", "Take a Pony Pic"] // edit page
+
+                       ,["Search All Friends", "Search All "+capitaliseFirstLetter(CURRENTSTACK.friends)] // invite friends
+                       ,["Top Comments", "Top Friendship Letters"] // comment resort
+                       ,["Likers", "Brohoofers"] // graph search @todo likers
+                       ,["Go to Activity Log", "Go to Adventure Log"] // checkpoint
+
+                       ,["Create New App", "Create New Magic"]
+                       ,["Submit App Detail Page", "Submit Magic Detail Page"]
+                       ,["Edit App", "Edit Magic"]
+                       ,["Promote App", "Promote Magic"]
+                       ,["Make Friends", "Make "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["Add to Other Apps", "Add to Other Magic"]
+               ];
+               
+               dialogTitles = [
+                        [/People who like /i, capitaliseFirstLetter(CURRENTSTACK['people'])+" who "+CURRENTSTACK['like_past']+" "]
+                       ,[/Friends who like /i, capitaliseFirstLetter(CURRENTSTACK['friends_logic'])+" who "+CURRENTSTACK['like_past']+" "]
+                       ,["People who voted for this option", capitaliseFirstLetter(CURRENTSTACK['people'])+" who voted for this option"]
+                       ,["People who are following this question", capitaliseFirstLetter(CURRENTSTACK['people'])+" who are following this question"]
+                       ,[/People Connected to /, capitaliseFirstLetter(CURRENTSTACK['people'])+" Connected to "]
+                       ,["People who saw this", capitaliseFirstLetter(CURRENTSTACK['people'])+" who saw this"]
+                       ,["Added Friends", "Added "+capitaliseFirstLetter(CURRENTSTACK.friends)]
+                       ,["People who can repro this", capitaliseFirstLetter(CURRENTSTACK['people'])+" who can repro this"]
+                       ,["Friends that like this", capitaliseFirstLetter(CURRENTSTACK['friends_logic'])+" that "+CURRENTSTACK['like_past']+" this"]
+                       
+                       ,["Share this Profile", "Share this Journal"]
+                       ,["Share This Photo", "Share This Pony Pic"]
+                       //,["Share this Album", ""]
+                       ,["Share this Note", "Share this Scroll"]
+                       ,["Share this Group", "Share this Herd"]
+                       ,["Share this Event", "Share this Adventure"]
+                       //,["Share this Ad", ""]
+                       ,["Share this Application", "Share this Magic"]
+                       //,["Share this Video", ""]
+                               //,["Share this Page", "Share this Landmark"]
+                               //,["Share this Page", "You gotta share!"]
+                       //,["Share this Job", ""]
+                               //,["Share this Status", "You gotta share!"]
+                       ,["Share this Question", "Share this Query"]
+                               //,["Share this Link", "You gotta share!"]
+                               ,["Share", "You gotta share!"]
+                       //,["Share this Help Content", ""]
+                       ,["Send This Photo", "Send This Pony Pic"]
+                       ,["Share Photo", "Share Pony Pic"]
+                       
+                       ,["Timeline and Tagging", "Journal and Tagging"]
+                       ,["Timeline Review", "Journal Review"]
+                       //,["Friends Can Check You Into Places", capitaliseFirstLetter(CURRENTSTACK['friends_logic'])+" Can Check You Into Landmarks"]
+                       //,["Limit The Audience for Old Posts on Your Timeline", "Limit The Audience for Old Posts on Your Journal"]
+                       //,["How people bring your info to apps they use", "How "+CURRENTSTACK['people']+" bring your info to magic they use"]
+                       //,["Turn off Apps, Plugins and Websites", "Turn off Magic, Plugins and Websites"]
+                       
+                       ,["Likes", capitaliseFirstLetter(CURRENTSTACK['likes'])]
+                       ,["Edit Featured Likes", "Edit Featured "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
+                       ,["Change Date", "Time Travel"]
+                       ,["Date Saved", "Time Traveled"]
+                       
+                       ,["Delete", "Nuke"]
+                       ,["Delete Comment", "Nuke Friendship Letter"]
+                       ,["Delete Photo", "Nuke Pony Pic"]
+                       ,["Remove Picture?", "Nuke Pony Pic?"]
+                       ,["Delete Video?", "Nuke Video?"]
+                       ,["Delete Milestone", "Nuke Milestone"]
+                       ,["Delete Page?", "Nuke Page?"]
+                       ,["Delete this Message?", "Nuke this Friendship Report?"]
+                       ,["Delete This Entire Conversation?", "Nuke This Entire Conversation?"]
+                       ,["Delete These Messages?", "Nuke These Friendship Reports?"]
+                       ,["Delete Post", "Nuke Post"]
+                       ,["Delete Post?", "Nuke Post?"]
+                       ,["Delete Page Permanently?", "Nuke Page Permanently?"]
+                       ,["Unlike", capitaliseFirstLetter(CURRENTSTACK['unlike'])]
+                       ,["Remove Search", "Nuke Search"]
+                       //,["Clear Searches", "Nuke Searches"]
+                       ,["Untag Photo", "Untag Pony Pic"]
+                       ,["Untag Photos", "Untag Pony Pics"]
+                       ,["Permanently Delete Account", "Permanently Nuke Account"]
+                       ,["Remove", "Nuke"]
+                       ,["Delete and Ban Member", "Nuke and Banish to Moon"]
+                       ,["Delete Album", "Nuke Album"]
+                       ,["Are you sure you want to clear all your searches?", "Are you sure you want to nuke all your searches?"]
+                       ,["Remove Photo?", "Nuke Pony Pic?"]
+                       ,["Removed Group Photo", "Nuked Herd Pony Pic"]
+                       ,["Post Deleted", "Post Nuked"]
+                       ,["Remove Event", "Nuke Adventure"]
+                       ,["Delete Entry?", "Nuke Entry?"]
+                       ,["Delete Video", "Nuke Video"]
+                       ,["Delete Event", "Nuke Adventure"] // for group admin
+
+                       ,["Report and/or Block This Person", "Whine and/or Block This Pony"] // 0
+                       ,["Report This Photo", "Whine About This Pony Pic"]
+                       ,["Report This Event", "Whine About This Adventure"]
+                       ,["Report Conversation", "Whine About Conversation"]
+                       ,["Report as Spam?", "Whine as Spam?"]
+                       ,["Invalid Report", "Invalid Whining"]
+                       ,["Report This Page", "Whine About This Page"]
+                       ,["Report This Doc Revision", "Whine About This Doc Revision"]
+                       ,["Confirm Report", "Confirm Whining"]
+                       ,["Report This Place", "Whine About This Place"] // 64
+                       ,["Thanks For This Report", "Thanks For Whining"]
+                       ,["Send Message", "Send Friendship Report"] // social report
+                       ,["Send Messages", "Send Friendship Reports"]
+                       ,["Why don't you like these photos?", "Why don't you like these pony pics?"]
+                       ,["Photos Untagged and Messages Sent", "Pony Pics Untagged and Friendship Reports Sent"]
+                       ,["Report This Post", "Whine About This Post"] // report lists as a page
+                       ,["Report This?", "Whine About This?"]
+                       ,["Report Recommendation", "Whine About Recommendation"] // 108
+                       ,["Why don't you like this photo?", "Why don't you like this pony pic?"]
+                       ,["Report Spam or Abuse", "Whine as Spam or Abuse"] // messages
+                       ,["Report Incorrect External Link", "Whine About Incorrect External Link"] // page vertex // 87
+
+                       // report types: 5: links / 125: status / 70: group post / 86: og post
+                       ,["Is this post about you or a friend?", "Is this post about you or a "+CURRENTSTACK.friend+"?"] 
+                       ,["Why are you reporting this Page?", "Why are you whining about this Page?"] // 23
+                       ,["Is this group about you or a friend?", "Is this herd about you or a "+CURRENTSTACK['friend']+"?"] // 1
+                       ,["Is this comment about you or a friend?", "Is this friendship letter about you or a "+CURRENTSTACK['friend']+"?"] // 71 / 74: page comment
+                       //,["Is this list about you or a friend?", "Is this directory about you a "+CURRENTSTACK.friend+"?"] // 92
+                       ,["Is this list about you or a friend?", "Is this list about you a "+CURRENTSTACK.friend+"?"] // 92
+                       ,["Is this photo about you or a friend?", "Is this pony pic about you or a "+CURRENTSTACK['friend']+"?"] // 2
+                       ,["Is this note about you or a friend?", "Is this scroll about you or a "+CURRENTSTACK['friend']+"?"] // 4
+                       ,["Is this video about you or a friend?", "Is this video about you or a "+CURRENTSTACK['friend']+"?"] // 13
+                       ,["Is this event about you or a friend?", "Is this adventure about you or a "+CURRENTSTACK['friend']+"?"] // 81
+
+                       ,["How to Report Posts", "How to Whine About Posts"]
+                       ,["How to Report Posts on My Timeline", "How to Whine About Posts on My Journal"]
+                       ,["How to Report the Profile Picture", "How to Whine About the Journal Pony Pic"]
+                       ,["Why are you reporting this photo?", "Why are you whining about this pony pic?"]
+                       ,["How to Report the Cover", "How to Whine About the Cover"]
+                       ,["How to Report Messages", "How to Whine About Friendship Reports"]
+                       ,["How to Report a Page", "How to Whine About a Page"]
+                       ,["How to Report a Group", "How to Whine About a Herd"]
+                       ,["How to Report an Event", "How to Whine About an Adventure"]
+                       ,["How to Report Page Posts", "How to Whine About Page Posts"]
+
+                       ,["New Message", "Write a Friendship Report"]
+                       ,["Forward Message", "Forward this Friendship Report"]
+                       ,["Delete This Message?", "Nuke This Friendship Report?"]
+                       ,["Message Not Sent", "Friendship Report Not Sent"]
+                       ,["Add People", "Add "+capitaliseFirstLetter(CURRENTSTACK['people'])]
+                       ,["Add Photos", "Add Pony Pics"]
+                       ,["People in this message", capitaliseFirstLetter(CURRENTSTACK['people'])+" in this friendship report"]
+                       ,["Message Sent", "Friendship Report Sent"]
+                       ,["Message Filtering Preferences", "Friendship Report Filtering Preferences"]
+                       
+                       ,["Create New Group", "Create New Herd"]
+                       ,[/Create New Event/, "Plan an Adventure"]
+                       ,["Notification Settings", "Spark Settings"]
+                       ,["Create Group Email Address", "Create Herd Email Address"]
+                       ,["Set Up Group Web and Email Address", "Set Up Herd Web and Email Address"]
+                       ,["Mute Chat?", "Mute Whinny Chat?"]
+                       ,["Add Friends to Group", "Add "+capitaliseFirstLetter(CURRENTSTACK['friends_logic'])+" to the Herd"]
+                       ,["Add People to Group", "Add "+capitaliseFirstLetter(CURRENTSTACK['people'])+" to the Herd"]
+                       ,["Not a member of the group", "Not a member of the herd"]
+                       ,["Invite People to Group by Email", "Invite "+capitaliseFirstLetter(CURRENTSTACK.people)+" to Herd by Email"]
+                       ,["Remove Group Admin", "Remove Herd Admin"]
+                       ,["Add Group Admin", "Add Herd Admin"]
+
+                       ,["Cancel Event?", "Cancel Adventure?"]
+                       ,["Change Event Photo", "Change Pony Pic for Adventure"]
+                       ,["Add Event Photo", "Add Adventure Pony Pic"]
+                       ,["Export Event", "Export Adventure"]
+                       ,["Edit Event Info", "Edit Adventure Info"]
+                       ,["Create Repeat Event", "Plan a Repeat Adventure"]
+                       ,["Event Invites", "Adventure Invites"]
+
+                       ,["Hide all recent profile changes?", "Hide all recent journal changes?"]
+                       ,["Edit your profile story settings", "Edit your journal story settings"]
+                       ,["Edit your timeline recent activity settings", "Edit your journal recent activity settings"]
+                       ,["Hide all recent likes activity?", "Hide all recent "+CURRENTSTACK.likes+" activity?"]
+                       ,["Edit Privacy of Likes", "Edit Privacy of "+capitaliseFirstLetter(CURRENTSTACK.likes)]
+
+                       ,["Edit News Feed Settings", "Edit Feed Bag Settings"]
+                       //,["Create New List", "Create New Directory"]
+                       ,["Invite Friends", "Invite "+capitaliseFirstLetter(CURRENTSTACK['friends_logic'])]
+                       ,["Advanced Chat Settings", "Advanced Whinny Chat Settings"]
+                       ,["Notifications Updated", "Sparks Updated"]
+                       ,["Move photo to another album?", "Move pony pic to another album?"]
+                       ,["Group Muted", "Herd Muted"]
+                       ,["Block App?", "Block Magic?"]
+                       //,["List Notification Settings", "Directory Spark Settings"]
+                       ,["List Notification Settings", "List Spark Settings"]
+                       ,["Like This Photo?", "Like This Pony Pic?"]
+                       ,["Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["All Friends", "All "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["Suggest Friend", "Suggest "+capitaliseFirstLetter(CURRENTSTACK.friend)]
+                       ,["Blocked People", "Blocked "+capitaliseFirstLetter(CURRENTSTACK.people)]
+                       ,["Block People", "Block "+capitaliseFirstLetter(CURRENTSTACK.people)]
+                       ,["Tag Friends", "Tag "+capitaliseFirstLetter(CURRENTSTACK.friends)]
+                       ,["Unable to edit Group", "Unable to edit Herd"]
+                       ,["Thanks for Inviting Your Friends", "Thanks for Inviting Your "+capitaliseFirstLetter(CURRENTSTACK.friends)]
+                       ,["Timeline Gift Preview", "Journal Gift Preview"]
+                       ,["Friend Request Setting", "Friendship Request Setting"]
+                       ,["Invalid Question", "Invalid Query"]
+                       //,["List Subscribers", "Directory Subscribers"]
+                       ,["People Who Shared This", capitaliseFirstLetter(CURRENTSTACK.people)+" Who Shared This"]
+                       //,["Edit List Settings", "Edit Directory Settings"]
+                       ,["Remove App", "Remove Magic"]
+                       ,["Turn Off Chat", "Turn Off Whinny Chat"]
+                       ,["Access Log", "Adventure Log"]
+                       ,["Post to Your Wall", "Post to Your Journal"]
+
+                       ,["Take a Profile Picture", "Take a Journal Pony Pic"]
+                       ,["Choosing Your Cover Photo", "Choosing Your Cover Pony Pic"]
+                       ,["Choose from Group Photos", "Choose from Herd Pony Pics"]
+                       ,["Group Albums", "Herd Albums"]
+                       ,["Choose From Your Photos", "Choose From Your Pony Pics"]
+                       ,["Choose from Photos", "Choose from Pony Pics"]
+                       ,["Choose Your Cover Photo", "Choose Your Cover Pony Pic"]
+                       ,["Choose from your synced photos", "Choose from your synced pony pics"]
+
+                       ,["Create New App", "Create New Magic"]
+                       ,["Add Test Users to other Apps", "Add Test Users to other Magic"]
+               ];
+               if (ponyData.successText) {
+                       dialogTitles.push(["Success", ponyData.successText]);
+                       dialogTitles.push(["Success!", ponyData.successText]);
+               }
+               
+               tooltipTitles = [
+                        [/everyone/gi, "Everypony"]
+                       //,[/\bpublic\b/g, "everypony"]
+                       ,[/\bPublic\b/g, "Everypony"]
+                               ,["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."]
+                               //,["These people subscribe to the lists you're featured on", "These "+capitaliseFirstLetter(CURRENTSTACK['people'])+" subscribe to the directories you're featured on"]
+                               ,["These people subscribe to the lists you're featured on", "These "+capitaliseFirstLetter(CURRENTSTACK['people'])+" subscribe to the lists you're featured on"]
+                               ,["Friends of anyone going to this event", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of anypony going to this adventure"]
+                               ,["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"]
+                               ,["Anyone can see and join this event", "Anypony can see and join this adventure"]
+                               ,["Your friends will see your comment in News Feed.", "Your "+CURRENTSTACK['friends']+" will see your friendship letter in Feed Bag."]
+                               ,[/\bfriends in group\b/, CURRENTSTACK['friends']+" in herd"]
+                       ,[/\bfriends of friends\b/g, CURRENTSTACK['friends']+" of "+CURRENTSTACK['friends']]
+                       ,[/\bFriends of Friends\b/g, capitaliseFirstLetter(CURRENTSTACK['friends'])+" of "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,[/\bfriends\b/g, CURRENTSTACK['friends']]
+                       ,[/\bFriends\b/g, capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["Only Me", "Alone"]
+                       ,["Only me", "Alone"]
+                       ,["No One", "Alone"]
+                       ,["Only you", "Alone"]
+                       ,["Anyone tagged", "Anypony tagged"]
+                               //,[/cover photos are everypony/i, "Everypony can see your cover pony pics"]
+                               ,["Cover photos are public", "Everypony can see your cover pony pics"]
+                               ,[/any other information you made Everypony/i, "any other information that everypony can see"]
+                               ,["Anyone can see this Everypony comment", "Everypony can see this public friendship letter"]
+                               //,["Remember: all place ratings are Everypony.", "Remember: everypony can see all place ratings."]
+                               ,["Everypony can see posts on this Everypony page.", "Everypony can see posts on this public page."]
+                               ,["Name, profile picture, age range, gender, language, country and other public info", "Name, profile picture, age range, gender, language, country and other public info"]
+                               //,["Name, profile picture, age range, gender, language, country and other Everypony info", "Name, profile picture, age range, gender, language, country and other public info"]
+                               ,["This will hide you from Everypony attribution", "This will hide you from public attribution"]
+                       ,["Remember: all place ratings are public.", "Remember: everypony can see all place ratings."]
+                       ,["Shared with: Anyone who can see this page", "Shared with: Anypony who can see this page"]
+                       ,["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."]
+                       ,["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."]
+                       ,["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."]
+                       
+                       ,["Show comments", "Show friendship letters"]
+                       ,["Comment deleted", "Friendship letter nuked"]
+                       ,[/Comments/, "Friendship Letters"]
+                       ,[/Comment/, "Friendship Letter"]
+                       
+                       ,["Remove", "Nuke"]
+                       ,["Edit or Delete", "Edit or Nuke"]
+                       ,["Edit or Remove", "Edit or Nuke"]
+                       ,["Delete Post", "Nuke Post"]
+                       ,["Remove or Report", "Nuke or Whine"]
+                       ,["Report", "Whine"]
+                       ,["Report/Mark as Spam", "Whine/Mark as Spam"]
+                       ,["Report as not relevant", "Whine as not relevant"]
+                       ,["Remove Invite", "Nuke Invite"]
+                       ,["Report/Remove Tag", "Whine/Nuke Tag"]
+                       ,["Delete", "Nuke"]
+                       ,["Delete and Ban", "Nuke and Banish"]
+                       ,["Report Place", "Whine About Place"]
+
+                       ,["Shown on Timeline", "Shown on Journal"]
+                       ,["Allow on Timeline", "Allow on Journal"]
+                       ,["Highlighted on Timeline", "Highlighted on Journal"]
+                       ,["Allowed on Timeline", "Allowed on Journal"]
+                       ,["Hidden from Timeline", "Hidden from Journal"]
+                       
+                       //,[/likes? this/g, "brohoof'd this"]
+                       ,["Sent from chat", "Sent from whinny chat"]
+                       ,["New Message", "Write a Friendship Report"]
+                       
+                       //,[/\bpeople\b/gi, "ponies"]
+                       ,[/See who likes this/gi, "See who "+CURRENTSTACK['likes']+" this"]
+                       ,[/people like this\./gi, CURRENTSTACK['people']+" "+CURRENTSTACK['like_past']+" this."] // entstream
+                       ,[/like this\./gi, CURRENTSTACK['like_past']+" this."]
+                       ,[/likes this\./gi, CURRENTSTACK['likes_past']+" this."]
+
+                       // top right pages
+                       ,["Status", "Take a Note"]
+                       ,["Photo / Video", "Add a Pic"]
+                       ,["Event, Milestone +", "Adventure, Milestone +"]
+
+                       ,["Onsite Notifications", "Onsite Sparks"]
+                       ,["Create Event", "Plan an Adventure"]
+                       ,["Search messages in this conversation", "Search friendship reports in this conversation"]
+                       ,["Open photo viewer", "Open pony pic viewer"]
+                       ,["Choose a unique image for the cover of your timeline.", "Choose a unique pony pic for the cover of your journal."]
+                       ,["Remove from Dashboard", "Remove from Dashieboard"]
+                       ,["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."]
+
+                       ,["Each photo has its own privacy setting", "Each pony pic has its own privacy setting"]
+                       ,["You can change the audience for each photo in this album", "You can change the audience for each pony pic in this album"]
+
+                       ,["View Photo", "View Pony Pic"]
+
+                       // litestand navigation when collapsed
+                       ,["News Feed", "Feed Bag"]
+                       ,["Messages", "Trough"]
+                       ,["Pokes", "Nuzzles"]
+                       ,["Manage Apps", "Manage Magic"]
+                       ,["Events", "Adventures"]
+                       ,["App Center", "Magic Center"]
+
+                       // photo comments
+                       ,["Attach a Photo", "Attach a Pony Pic"]
+
+                       ,["Dismiss and go to most recent message", "Dismiss and go to most recent friendship letter"] // messages
+                       ,["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
+
+                       // developers
+                       ,["Enable the newsfeed ticker", "Enable the feedbag ticker"]
+                       ,["Add selected users to other apps you own.", "Add selected users to other magic you own."]
+                       ,["Remove selected users from this app.", "Remove selected users from this magic."]
+
+                       // insights
+                       ,["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."]
+                       ,["The percentage of people who liked, commented, shared or clicked on your post after having seen it.", "The percentage of people who "+CURRENTSTACK['liked']+", commented, shared or clicked on your post after having seen it."]
+               ];
+               if (ponyData.loadingText) {
+                       tooltipTitles.push(["Loading...", ponyData.loadingText]);
+               }
+
+               headerTitles = [
+                       //["List Suggestions", "Directory Suggestions"]
+                        ["People You May Know", capitaliseFirstLetter(CURRENTSTACK.people)+" You May Know"]
+                       ,["Sponsored", "Cupcake Money"]
+                       ,["Pokes", "Nuzzles"]
+                       ,["People To Follow", capitaliseFirstLetter(CURRENTSTACK.people)+" To Follow"]
+                       ,["Poke Suggestions", "Nuzzle Suggestions"]
+                       ,["Suggested Groups", "Suggested Herds"]
+                       ,["Find More Friends", "Find Friendship"]
+                       ,["Rate Recently Used Apps", "Rate Recently Used Magic"]
+                       ,["Friends' Photos", "Pals' Pony Pics"]
+                       ,["Add a Location to Your Photos", "Add a Location to Your Pony Pics"]
+                       ,["Suggest Friends", "Suggest "+capitaliseFirstLetter(CURRENTSTACK.friends)]
+                       ,["Other Pages You Like", "Other Pages You "+capitaliseFirstLetter(CURRENTSTACK.like)]
+                       ,["Entertainment Pages You Might Like", "Entertainment Pages You Might "+capitaliseFirstLetter(CURRENTSTACK.like)]
+                       ,["Music Pages You Might Like", "Music Pages You Might "+capitaliseFirstLetter(CURRENTSTACK.like)]
+                       ,["Add Personal Contacts as Friends", "Add Personal Contacts as "+capitaliseFirstLetter(CURRENTSTACK.friends)]
+                       ,["Find Friends", "Find Friendship"]
+                       //,[/On This List/, "On This Directory"]
+                       //,["On this list", "On this directory"]
+                       //,["On This List", "On This Directory"]
+                       ,["Related Groups", "Related Herds"]
+
+                       ,["Notifications", "Sparks"]
+                       ,["New Likes", "New "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
+                       ,["Invite Friends", "Invite "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["Get More Likes", "Get More "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
+                       ,["Added Apps", "Added Magic"]
+                       ,["Apps You May Like", "Magic You May "+capitaliseFirstLetter(CURRENTSTACK.like)]
+                       ,["Your Apps", "Your Magic"]
+                       ,["People Talking About This", capitaliseFirstLetter(CURRENTSTACK.people)+" Blabbering About This"]
+                       ,["Total Likes", "Total "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
+                       ,["Games You May Like", "Games You May "+capitaliseFirstLetter(CURRENTSTACK.like)]
+
+                       ,["Messages", "Trough"]
+                       ,["Other Messages", "Other Friendship Reports"]
+                       ,["Unread Messages", "Unread Friendship Reports"]
+                       ,["Sent Messages", "Sent Friendship Reports"]
+                       ,["Archived Messages", "Archived Friendship Reports"]
+
+                       ,["Groups", "Herds"]
+                       //,["Pages and Ads", "Landmarks and Ads"]
+                       ,["Apps", "Magic"]
+                       ,[/Friends who like /gi, capitaliseFirstLetter(CURRENTSTACK['friends_logic'])+" who "+CURRENTSTACK['like_past']+" "]
+                       ,["Favorites", capitaliseFirstLetter(CURRENTSTACK['likes'])]
+                       ,["Likes", capitaliseFirstLetter(CURRENTSTACK['likes'])]
+                       ,["Events", "Adventures"]
+                       ,["Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["Ads", "Cupcakes"]
+                       ,["Mutual Likes", "Mutual "+capitaliseFirstLetter(CURRENTSTACK.likes)]
+                       ,[/Mutual Friends/, "Mutual "+capitaliseFirstLetter(CURRENTSTACK.friends)]
+
+                       ,["Notes", "Scrolls"]
+                       ,["My Notes", "My Scrolls"]
+                       ,["Notes About Me", "Scrolls About Me"]
+                       ,["Write a Note", "Write a Scroll"]
+                       ,["Edit Note", "Edit Scroll"]
+
+                       ,["Timeline and Tagging", "Journal and Tagging"]
+                       ,["Ads, Apps and Websites", "Ads, Magic and Websites"]
+                       ,["Blocked People and Apps", "Banished "+capitaliseFirstLetter(CURRENTSTACK['people'])+" and Magic"]
+                       ,["Notifications Settings", "Sparks Settings"]
+                       ,["App Settings", "Magic Settings"]
+                       ,["Friend Requests", "Friendship Requests"]
+                       ,["People Who Shared This", capitaliseFirstLetter(CURRENTSTACK.people)+" Who Shared This"]
+                       ,["Your Notifications", "Your Sparks"]
+                       ,["Timeline and Tagging Settings", "Journal and Tagging Settings"]
+                       ,["Delete My Account", "Nuke My Account"]
+
+                       ,["Posts in Groups", "Posts in Herds"]
+                       ,["People", capitaliseFirstLetter(CURRENTSTACK['people'])]
+
+                       ,["Posts by Friends", "Posts by "+capitaliseFirstLetter(CURRENTSTACK.friends)]
+                       ,["Support Dashboard", "Support Dashieboard"]
+                       ,["Event Invitations", "Adventure Invitations"]
+                       ,["Who Is in These Photos?", "Who Is in These Pony Pics?"]
+                       ,["People who like this", capitaliseFirstLetter(CURRENTSTACK.people)+" that "+CURRENTSTACK.like_past+" this"]
+                       //,["List Subscribers", "Directory Subscribers"]
+                       ,["Upcoming Events", "Upcoming Adventures"]
+                       ,["Photos and Videos", "Pony Pics and Videos"]
+                       ,["People Who Are Going", capitaliseFirstLetter(CURRENTSTACK.people)+" Who Are Going"]
+                       ,["Would you like to opt out of this email notification?", "Would you like to opt out of this email spark?"]
+                       ,["Confirm Like", "Confirm "+capitaliseFirstLetter(CURRENTSTACK['like'])]
+
+                       ,["Invite Friends You Email", "Invite "+capitaliseFirstLetter(CURRENTSTACK['friends'])+" You Email "]
+                       ,["Invite Your Friends", "Invite Your "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
+
+                       ,["Account Groups", "Account Herds"]
+                       ,["Ads Email Notifications", "Ads Email Soarks"]
+                       ,["Ads Notifications on Facebook", "Ads Sparks on Facebook"]
+
+                       ,["App Restrictions", "Magic Restrictions"]
+                       ,["App Info", "Magic Info"]
+
+                       ,["Tagged Photos", "Tagged Pony Pics"]
+
+                       ,["Add Groups", "Add Herds"] // /addgroup
+               ];
+
+               menuTitles = [
+                        ["Everyone", "Everypony"]
+                       ,["Everybody", "Everypony"]
+                       ,["Public", "Everypony"]
+                       ,["Anyone", "Anypony"]
+                       ,["Friends of Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["Friends except Acquaintances", capitaliseFirstLetter(CURRENTSTACK['friends'])+" except Acquaintances"]
+                       ,["Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["Friends ", capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["Friends of Guests", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of Guests"]
+                       ,["Only Me", "Alone"]
+                       ,["Only me", "Alone"]
+                       ,["No One", "Alone"]
+                       ,["Nobody", "Nopony"]
+                       //,["See all lists...", "See entire directory..."]
+
+                       ,["Mutual Friends", "Mutual "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["People You May Know", "Ponies You May Know"]
+                       ,["Poke...", "Nuzzle..."]
+                       ,["Poke", "Nuzzle"]
+                       ,["All Friends", "All "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["All friends", "All "+CURRENTSTACK['friends']]
+
+                       ,["On your own timeline", "On your own journal"]
+                       ,["On a friend's timeline", "On a "+CURRENTSTACK['friend']+"'s journal"]
+                       ,["In a group", "In a herd"]
+                       ,["In a private Message", "In a private Friendship Report"]
+
+                       ,["Friends' Posts", capitaliseFirstLetter(CURRENTSTACK['friends'])+"' Posts"]
+                       ,["Friend Activity", capitaliseFirstLetter(CURRENTSTACK['friend'])+" Activity"]
+
+                       ,["Change Date...", "Time Travel..."]
+                       ,["Reposition Photo...", "Reposition Pony Pic..."]
+                       ,["Manage Notifications", "Manage Sparks"]
+                       ,["Use Activity Log", "Use Adventure Log"]
+                       ,["See Banned Users...", "See Ponies who were Banished to the Moon..."]
+                       ,["Invite Friends...", "Invite "+capitaliseFirstLetter(CURRENTSTACK['friends'])+"..."]
+                       ,["Like As Your Page...", capitaliseFirstLetter(CURRENTSTACK.like)+" As Your Page..."]
+                       ,["Add App to Page", "Add Magic to App"]
+                       ,["Change Primary Photo", "Change Primary Pony Pic"]
+                       ,["Change Date", "Time Travel"]
+
+                       ,["People", capitaliseFirstLetter(CURRENTSTACK['people'])]
+                       //,["Pages", "Landmarks"]
+                       ,["Banned", "Banished to Moon"]
+                       ,["Blocked", "Banished to Moon"]
+                       ,["People who like this", capitaliseFirstLetter(CURRENTSTACK.people)+" who "+CURRENTSTACK.like_past+" this"]
+                       ,["Pages that like this", "Pages that "+CURRENTSTACK.like_past+" this"]
+
+                       ,["Unlike", capitaliseFirstLetter(CURRENTSTACK['unlike'])]
+                       ,["Unlike...", capitaliseFirstLetter(CURRENTSTACK['unlike'])+"..."]
+                       ,["Show in News Feed", "Show in Feed Bag"]
+                       ,["Suggest Friends...", "Suggest "+capitaliseFirstLetter(CURRENTSTACK['friends'])+"..."]
+                       ,["Unfriend...", "Banish to Moon..."]
+                       ,["Unfriend", "Banish to Moon"]
+                       //,["New List...", "New Directory..."]
+                       ,["Get Notifications", "Get Sparks"]
+                       //,["Add to another list...", "Add to another directory..."]
+
+                       ,["Create Event", "Plan an Adventure"]
+                       ,["Edit Group", "Edit Herd"]
+                       ,["Report Group", "Whine about Herd"]
+                       ,["Leave Group", "Leave Herd"]
+                       ,["Edit Group Settings", "Edit Herd Settings"]
+                       ,["Choose from Group Photos", "Choose from Herd Pony Pics"]
+                       ,["Upload a Photo", "Upload a Pony Pic"]
+                       ,["Remove from Group", "Banish to Moon"]
+                       ,["Share Group", "Share Herd"]
+                       ,["Create Group", "Create Herd"]
+                       ,["Change group settings", "Change herd settings"]
+                       ,["Add People to Group", "Add "+capitaliseFirstLetter(CURRENTSTACK['people'])+" to the Herd"]
+                       ,["Send Message", "Send Friendship Report"]
+                       ,["View Group", "View Herd"]
+                       ,["Add People", "Add "+capitaliseFirstLetter(CURRENTSTACK['people'])]
+
+                       ,["Remove App", "Remove Magic"]
+                       ,["Uninstall App", "Uninstall Magic"]
+                       ,["Report App", "Whine about Magic"]
+                       ,["Block App", "Block Magic"]
+                       ,["Find More Apps", "Find More Magic"]
+                       ,["No more apps to add.", "No more magic to add."]
+
+                       ,["Delete Post And Remove User", "Nuke Post And Banish to Moon"]
+                       ,["Delete Post And Ban User", "Nuke Post And Banish to Moon"]
+                       ,["Hide from Timeline", "Hide from Journal"]
+                       ,["Delete", "Nuke"]
+                       ,["Delete...", "Nuke..."]
+                       ,["Delete Photo", "Nuke Pony Pic..."]
+                       ,["Delete This Photo", "Nuke This Pony Pic"]
+                       ,["Delete Messages...", "Nuke Friendship Reports..."]
+                       ,["Delete Post", "Nuke Post"]
+                       ,["Delete Comment", "Nuke Friendship Letter..."]
+                       ,["Show on Timeline", "Show on Journal"]
+                       ,["Show on Profile", "Show on Journal"]
+                       ,["Shown on Timeline", "Shown on Journal"]
+                       ,["Allow on Timeline", "Allow on Journal"]
+                       ,["Highlighted on Timeline", "Highlighted on Journal"]
+                       ,["Allowed on Timeline", "Allowed on Journal"]
+                       ,["Hidden from Timeline", "Hidden from Journal"]
+                       ,["Remove", "Nuke"]
+                       ,["Delete Photo...", "Nuke Pony Pic..."]
+                       ,["Remove this photo", "Nuke this pony pic"]
+                       ,["Remove photo", "Nuke pony pic"]
+                       ,["Remove...", "Nuke..."]
+                       ,["Delete Conversation...", "Nuke Conversation..."]
+                       ,["Delete Album", "Nuke Album"]
+                       ,["Delete Comment...", "Nuke Friendship Letter..."]
+                       ,["Hide Comment...", "Hide Friendship Letter..."]
+                       ,["Hide Event", "Hide Adventure"]
+                       ,["Hide Comment", "Hide Friendship Letter"]
+                       ,["Delete Post...", "Nuke Post..."]
+                       ,["Delete Video", "Nuke Video"]
+                       ,["Delete Event", "Nuke Adventure"] // for group admin
+
+                       ,["Report/Block...", "Whine/Block..."]
+                       ,["Report/Mark as Spam", "Whine/Mark as Spam"]
+                       ,["Report Page", "Whine about Page"]
+                       ,["Report Story or Spam", "Whine about Story or Spam"]
+                       ,["Report/Mark as Spam...", "Whine/Mark as Spam..."]
+                       ,["Report story...", "Whine about story..."]
+                       ,["Report as Spam or Abuse...", "Whine as Spam or Abuse..."]
+                       ,["Report Spam or Abuse...", "Whine as Spam or Abuse..."]
+                       ,["Report as Spam...", "Whine as Spam..."]
+                       ,["Report Conversation...", "Whine about Conversation..."]
+                       ,["Report This Photo", "Whine About This Pony Pic"]
+                       ,["Report/Remove Tag", "Whine/Nuke Tag"]
+                       ,["Mark as Spam", "Whine as Spam"]
+                       ,["Report/Remove Tag...", "Whine/Nuke Tag..."]
+                       ,["Report Content", "Whine about Content"]
+                       ,["Report Profile", "Whine about Journal"]
+                       ,["Report User", "Whine about This Pony"]
+                       ,["Report", "Whine"]
+                       ,["Report Place", "Whine about Place"]
+                       ,["Report App", "Whine about Magic"]
+                       //,["Report list", "Whine about directory"]
+                       ,["Report list", "Whine about list"]
+                       ,["Event at a place", "Adventure at a place"]
+
+                       ,["Hide this recent activity story from Timeline", "Hide this recent activity story from Journal"]
+                       ,["Hide Similar Activity from Timeline...", "Hide Similar Activity from Journal..."]
+                       //,["Hide All Recent Lists from Timeline...", "Hide All Recent Directories from Journal..."]
+                       ,["Hide All Recent Lists from Timeline...", "Hide All Recent Lists from Journal..."]
+                       ,["Hide all Friend Highlights from Timeline", "Hide all "+capitaliseFirstLetter(CURRENTSTACK.friend)+" Highlights from Journal"]
+                       ,["Hide This Action from Profile...", "Hide This Action from Journal..."]
+                       ,["Hide All Recent profile changes from Profile...", "Hide All Recent journal changes from Journal..."]
+                       ,["Hide All Recent Pages from Timeline...", "Hide All Recent Pages from Journal..."]
+                       ,["See Photos Hidden From Timeline", "See Pony Pics Hidden From Journal"]
+                       ,["Hide Similar Activity from Timeline", "Hide Similar Activity from Journal"]
+
+                       ,["Upcoming Events", "Upcoming Adventures"]
+                       ,["Suggested Events", "Suggested Adventures"]
+                       ,["Past Events", "Past Adventures"]
+                       ,["Past events", "Past adventures"]
+                       ,["Declined Events", "Declined Adventures"]
+                       ,["Export Events...", "Export Adventures..."]
+                       ,["Add Event Photo", "Add Adventure Pony Pic"]
+                       ,["Cancel Event", "Cancel Adventure"]
+                       ,["Export Event", "Export Adventure"]
+                       ,["Share Event", "Share Adventure"]
+                       ,["Turn Off Notifications", "Turn Off Sparks"]
+                       ,["Turn On Notifications", "Turn On Sparks"]
+                       ,["Promote Event", "Promote Adventure"]
+                       ,["Create Repeat Event", "Create Repeat Adventure"]
+                       ,["Message Guests", "Start Whinny Chat with Guests"]
+                       ,["Edit Event", "Edit Adventure"]
+                       ,["Publish Event on Timeline", "Publish Adventure on Journal"]
+
+                       ,["Add Friends to Chat...", "Add "+capitaliseFirstLetter(CURRENTSTACK.friends)+" to Whinny Chat..."]
+                       ,["Chat Sounds", "Whinny Chat Sounds"]
+                       ,["Add People...", "Add "+capitaliseFirstLetter(CURRENTSTACK['people'])+"..."]
+                       ,["Unread Messages", "Unread Friendship Reports"]
+                       ,["Archived Messages", "Archived Friendship Reports"]
+                       ,["Sent Messages", "Sent Friendship Reports"]
+                       ,["Forward Messages...", "Forward Friendship Reports..."]
+                       ,["Turn Off Chat", "Turn Off Whinny Chat"]
+                       ,["Open in Chat", "Open in Whinny Chat"]
+                       ,["Create Group...", "Create Herd..."]
+                       ,["Turn On Chat", "Turn On Whinny Chat"]
+
+                       ,["Add/Remove Friends...", "Add/Remove "+capitaliseFirstLetter(CURRENTSTACK.friends)+"..."]
+                       ,["Comments and Likes", "Friendship Letters and Brohoofs"]
+                       //,["Archive List", "Archive Directory"]
+                       //,["On This List", "On This Directory"]
+                       //,["Restore List", "Restore Directory"]
+
+                       //,["Rename List", "Rename Directory"]
+                       //,["Edit List", "Edit Directory"]
+                       ,["Notification Settings...", "Spark Settings..."]
+                       //,["Delete List", "Nuke Directory"]
+                       ,["Delete List", "Nuke List"]
+
+                       ,["Likes", capitaliseFirstLetter(CURRENTSTACK['likes'])]
+                       ,["Photos", "Pony Pics"]
+                       ,["Comments", "Friendship Letters"]
+                       ,["Questions", "Queries"]
+                       ,["Events", "Adventures"]
+                       ,["Groups", "Herds"]
+                       ,["Timeline", "Journal"]
+                       ,["Notes", "Scrolls"]
+                       ,["Posts and Apps", "Posts and Magic"]
+                       ,["Recent Likes", "Recent "+capitaliseFirstLetter(CURRENTSTACK['likes'])]
+                       ,["Recent Comments", "Recent Friendship Letters"]
+                       ,["Timeline Review", "Journal Review"]
+                       ,["Pokes", "Nuzzles"]
+                       ,["Activity Log...", "Adventure Log..."]
+                       ,["Activity Log", "Adventure Log"]
+                       ,["Timeline Settings", "Journal Settings"]
+                       ,["Likers", "Brohoofers"] // @todo likers
+                       ,["Open Groups", "Open Herds"]
+                       ,["Cancel Friend Request", "Cancel Friendship Request"] // activity log
+
+                       ,["Choose from Photos...", "Choose from Pony Pics..."]
+                       ,["Upload Photo...", "Upload Pony Pic..."]
+                       ,["Take Photo...", "Take Pony Pic..."]
+                       ,["Choose from my Photos", "Choose from my Pony Pics"]
+                       ,["Reposition Photo", "Reposition Pony Pic"]
+                       ,["Add Synced Photo...", "Add Synced Pony Pic..."]
+                       ,["Change Primary Photo...", "Change Primary Pony Pic..."]
+                       ,["Choose from Photo Albums...", "Choose from Pony Pic Albums..."]
+                       ,["Suggest this photo...", "Suggest this pony pic..."]
+
+                       ,["Photo", "Pony Pic"]
+                       ,["Question", "Query"]
+
+                       ,["Pages I like", "Pages I "+capitaliseFirstLetter(CURRENTSTACK.like)]
+                       ,["My Friends", "My "+capitaliseFirstLetter(CURRENTSTACK.friends)]
+                       ,["All Notifications", "All Sparks"]
+                       ,["Search All Friends", "Search All "+capitaliseFirstLetter(CURRENTSTACK.friends)]
+                       ,["All Apps", "All Magic"]
+
+                       ,["Page Likes", "Page "+capitaliseFirstLetter(CURRENTSTACK.likes)]
+                       ,["Mentions and Photo Tags", "Mentions and Pony Pic Tags"]
+
+                       ,["Suggest photos", "Suggest pony pics"]
+
+                       ,["Make Profile Picture", "Make Journal Pony Pic"]
+                       ,["Make Profile Picture for Page", "Make Journal Pony Pic for Page"]
+                       ,["Make Cover Photo", "Make Cover Pony Pic"]
+
+                       ,["The app sends you a notification", "The magic sends you a spark"]
+
+                       // comment resort
+                       ,["Top Comments", "Top Friendship Letters"]
+
+                       // insights
+                       ,["Post Clicks / Likes, Comments & Shares", "Post Clicks / "+capitaliseFirstLetter(CURRENTSTACK['likes'])+", Comments & Shares"]
+                       ,["Likes / Comments / Shares", capitaliseFirstLetter(CURRENTSTACK['likes'])+" / Comments / Shares"]
+                       ,["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
+                       ,["Likes, Comments & Shares", capitaliseFirstLetter(CURRENTSTACK['likes'])+", Comments & Shares"]
+               ];
+
+               menuPrivacyOnlyTitles = [
+                        ["Everyone", "Everypony"]
+                       ,["Public", "Everypony"]
+                       ,["Anyone", "Anypony"]
+                       ,["Friends of Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of "+capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["Friends except Acquaintances", capitaliseFirstLetter(CURRENTSTACK['friends'])+" except Acquaintances"]
+                       ,["Friends", capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["Friends ", capitaliseFirstLetter(CURRENTSTACK['friends'])]
+                       ,["Friends of Guests", capitaliseFirstLetter(CURRENTSTACK['friends'])+" of Guests"]
+                       ,["Only Me", "Alone"]
+                       ,["Only me", "Alone"]
+                       //,["See all lists...", "See entire directory..."]
+               ];
+
+               dialogDerpTitles = [
+                        "Insufficient send permissions"
+                       ,"Update Failed"
+                       ,"Failed to upload photo."
+                       ,"Hide Photo Failed"
+                       ,"Undo Mark Spam Failed"
+                       ,"Your Request Couldn't be Processed"
+                       ,"Sorry! The blocking system is overloaded"
+                       ,"Invalid Request"
+                       ,"Block! You are engaging in behavior that may be considered annoying or abusive by other users."
+                       ,"Already connected."
+                       ,"Cannot connect."
+                       ,"Database Down"
+                       ,"Failure to hide minifeed story."
+                       ,"Object cannot be liked"
+                       ,"Sorry, something went wrong"
+                       ,"Authentication Failure"
+                       ,"Unknown error"
+                       ,"Not Logged In"
+                       ,"No Permission to Add Comment or Trying to Comment on Deleted Post"
+                       ,"Could not determine coordinates of place"
+                       ,"Sorry, your account is temporarily unavailable."
+                       ,"Don't Have Permission"
+                       ,"Oops"
+                       ,"No Languages Provided ForUpdate"
+                       ,"Comment Does Not Exist"
+                       ,"Sorry, we got confused"
+                       ,"Database Write Failed"
+                       ,"Editing Bookmarks Failed"
+                       ,"Required Field Missing"
+                       ,"Could Not Load Story"
+                       ,"Invalid Name"
+                       ,"Cannot connect to yourself."
+                       ,"This content is no longer available"
+                       ,"Error" // poking someone who hasn't poked back yet
+                       ,"Please Try Again Later"
+                       ,"Submitting Documentation Feedback Failed"
+                       ,"Bad Request"
+                       ,"Internal Error"
+                       ,"Mark as Spam Failed"
+                       ,"Could not post to Wall"
+                       ,"No permissions"
+                       ,"Messages Unavailable"
+                       ,"Don't have Permission"
+                       ,"No file specified."
+                       ,"Storage Failure"
+                       ,"Invalid Date"
+                       ,"Vote submission failed."
+                       ,"Web Address is Invalid"
+                       ,"Oops!"
+                       ,"Invalid Recipients"
+                       ,"Add Fan Status Failed"
+                       ,"Adding Member Failed"
+                       ,"Post Has Been Removed"
+                       ,"Unable to edit Group"
+                       ,"Invalid Photo Selected"
+                       ,"Cannot backdate photo"
+                       ,"Invalid Search Query"
+                       ,"Unable to Add Friend"
+                       ,"Cannot Add Member"
+                       ,"Bad Image"
+                       ,"Missing Field"
+                       ,"Invalid Custom Privacy Setting"
+                       ,"Empty Friend List"
+                       ,"Unable to Add Attachment"
+                       ,"Unable to Change Date"
+                       ,"Invalid Whining"
+                       ,"Your Page Can't Be Promoted"
+                       ,"Cannot Send Gift"
+                       ,"An error occurred."
+               ];
+
+               headerInsightsTitles = [
+                        ["People Who Like Your Page (Demographics and Location)", capitaliseFirstLetter(CURRENTSTACK.people)+" Who "+capitaliseFirstLetter(CURRENTSTACK.like)+" Your Page (Demographics and Location)"]
+                       ,["Where Your Likes Came From", "Where Your "+capitaliseFirstLetter(CURRENTSTACK.likes)+" Came From"]
+                       ,["How You Reached People (Reach and Frequency)", "How You Reached "+capitaliseFirstLetter(CURRENTSTACK.people)+" (Reach and Frequency)"]
+                       ,["How People Are Talking About Your Page", "How "+capitaliseFirstLetter(CURRENTSTACK.people)+" Are Talking About Your Page"]
+               ];
+
+               dialogDescriptionTitles = [
+                        ["Are you sure you want to delete this?", "Are you sure you want to nuke this?"]
+                       ,["Are you sure you want to delete this video?", "Are you sure you want to nuke this video?"]
+                       ,["Are you sure you want to delete this photo?", "Are you sure you want to nuke this pony pic?"]
+                       ,["Are you sure you want to delete this comment?", "Are you sure you want to nuke this friendship letter?"]
+                       ,["Are you sure you want to delete this event?", "Are you sure you want to nuke this adventure?"]
+                       ,["Are you sure you want to delete this post?", "Are you sure you want to nuke this post?"]
+                       ,["Are you sure you want to remove this picture?", "Are you sure you want to nuke this pony pic?"]
+                       ,["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."]
+                       ,["Are you sure you want to remove this event?", "Are you sure you want to nuke this adventure?"]
+
+                       ,["Report this if it's not relevant to your search results.", "Whine about this if it's not relevant to your search results."]
+               ];
+       }
+       
+       var DOMNodeInserted = function(dom) {
+               domNodeHandlerMain.run(dom);
+       };
+
+       var domNodeHandler = function() {
+               var k = this;
+               k.snowliftPinkieInjected = false;
+                               //k.ufiData = {};
+
+               k.run = function(dom) {
+                       if (INTERNALUPDATE) {
+                               return;
+                       }
+
+                       if (k.shouldIgnore(dom)) {
+                               return;
+                       }
+                       
+                       k.dumpConsole(dom);
+                       
+                       // Start internal update
+                       var iu = INTERNALUPDATE;
+                       INTERNALUPDATE = true;
+                       
+                       // Buttons
+                       if (dom.target.parentNode && dom.target.parentNode.parentNode) {
+                                       var stop = true;
+                                       var replacer = buttonTitles;
+                                       if (hasClass(dom.target.parentNode, 'uiButtonText')) {
+                                               var buttonText = dom.target.parentNode;
+                                               var button = dom.target.parentNode.parentNode;
+                                               stop = false;
+
+                                               if (button.parentNode && button.parentNode.parentNode && hasClass(button.parentNode.parentNode, 'audienceSelector')) {
+                                                       replacer = menuPrivacyOnlyTitles;
+                                               }
+                                       } else if (hasClass(dom.target.parentNode, '_42ft') || hasClass(dom.target.parentNode, '-cx-PRIVATE-abstractButton__root')) {
+                                               // dropdown on close friends list dialog
+                                               // <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>
+                                               var buttonText = dom.target;
+                                               var button = dom.target.parentNode;
+                                               stop = false;
+                                       } else if (hasClass(dom.target.parentNode.parentNode, '_42ft') || hasClass(dom.target.parentNode.parentNode, '-cx-PRIVATE-abstractButton__root')) {
+                                               // hasClass(buttonText, '_55pe') || hasClass(buttonText, '-cx-PUBLIC-abstractPopoverButton__label')
+                                               // "share to" dropdown on sharer dialog
+                                               // comment resort on entstream
+                                               var buttonText = dom.target;
+                                               var button = dom.target.parentNode.parentNode;
+                                               stop = false;
+                                       }
+
+                                       if (!stop) {
+                                               if (buttonText.nodeType == 3) {
+                                                       var orig = buttonText.textContent;
+                                               } else {
+                                                       var orig = buttonText.innerHTML;
+                                               }
+                                               var replaced = replaceText(replacer, orig);
+                                               if (hasClass(button, 'uiButton') || hasClass(button, '_42ft') || hasClass(button, '-cx-PRIVATE-abstractButton__root')) {
+                                                       // button text that didn't get ponified needs to be considered, e.g. share dialog's "On your Page"
+                                                       if (button.getAttribute('data-hover') != 'tooltip') {
+                                                               if (orig != replaced) {
+                                                                       // ponified text
+                                                                       if (button.title == '') {
+                                                                               // tooltip is blank, so it would be OK to set our own
+                                                                               button.title = orig;
+                                                                       } else {
+                                                                               // tooltip is NOT blank, this means (1) FB added their own tooltip or (2) we already added our own tooltip
+                                                                               if (button.title == button.getAttribute('data-ponyhoof-button-orig')) {
+                                                                                       button.title = orig;
+                                                                               }
+                                                                       }
+                                                               } else {
+                                                                       button.title = '';
+                                                               }
+                                                       }
+                                                       button.setAttribute('data-ponyhoof-button-orig', orig);
+                                                       button.setAttribute('data-ponyhoof-button-text', replaced);
+                                               }
+                                               if (orig != replaced) {
+                                                       if (buttonText.nodeType == 3) {
+                                                               buttonText.textContent = replaced;
+                                                       } else {
+                                                               buttonText.innerHTML = replaced;
+                                                       }
+                                               }
+                                       }
+                       }
+
+                       // Text nodes
+                       if (dom.target.nodeType == 3) {
+                               //k.textNodes(dom);
+                               // firefox in mutationObserver goes to here when it should be characterData
+                               k.mutateCharacterData(dom);
+                               INTERNALUPDATE = iu;
+                               return;
+                       }
+                       
+                       injectOptionsLink();
+                       
+                       k.snowliftPinkie(dom);
+                       k.notificationsFlyoutSettings(dom);
+                       
+                       // .ufb-button-input => mutateAttributes
+                       domReplaceFunc(dom.target, '', '.uiButtonText, .uiButton input, ._42ft, .-cx-PRIVATE-abstractButton__root, ._42fu, .-cx-PRIVATE-uiButton__root, ._4jy0, .-cx-PRIVATE-xuiButton__root', function(ele) {
+                               // <a class="uiButton uiButtonConfirm uiButtonLarge" href="#" role="button"><span class="uiButtonText">Finish</span></a>
+                               // <label class="uiButton uiButtonConfirm"><input value="Okay" type="submit"></label>
+
+                               // <button class="_42ft _42fu _11b selected _42g-" type="submit">Post</button>
+                               // <a class="_42ft _42fu" role="button" href="#"><i class="mrs img sp_8jfoef sx_d2d7c4"></i>Promote App</a>
+                               var button = ele;
+                               var replacer = buttonTitles;
+                               var tagName = ele.tagName.toUpperCase();
+                               if (tagName != 'A' && tagName != 'LABEL' && tagName != 'BUTTON') {
+                                       button = ele.parentNode;
+
+                                       // new message
+                                       var potentialLabel = button.querySelector('._6q-, .-cx-PUBLIC-mercuryComposer__button');
+                                       if (potentialLabel) {
+                                               ele = potentialLabel;
+                                       }
+                               } else {
+                                       var potentialLabel = button.querySelector('._55pe, .-cx-PUBLIC-abstractPopoverButton__label');
+                                       if (potentialLabel) {
+                                               ele = potentialLabel;
+                                       } else {
+                                               // Get More Likes button on page admin panel
+                                               // <button value="1" class="_42ft _42fu selected _42g- _42gy" id="fanAcquisitionPanelPreviewBodyConfirmButton" type="submit"><span id="u_x_a">Get More Likes</span></button>
+                                       }
+                                       // Get More Likes (above)
+                                       // comment resort on entstream
+                                       if (ele.childNodes && ele.childNodes.length == 1 && ele.childNodes[0].tagName && ele.childNodes[0].tagName.toUpperCase() == 'SPAN') {
+                                               ele = ele.childNodes[0];
+                                       }
+                               }
+                               if (button &&
+                                       (button.getAttribute('data-ponyhoof-button-orig') == null || (hasClass(button, '_for') || hasClass(button, '-cx-PRIVATE-fbVaultBadgedButton__button'))) && // vault buttons are crapped
+                                       (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')*/)
+                               ) {
+                                       if (button.parentNode && button.parentNode.parentNode && hasClass(button.parentNode.parentNode, 'audienceSelector')) {
+                                               replacer = menuPrivacyOnlyTitles;
+                                       }
+
+                                       if (tagName == 'INPUT') {
+                                               var orig = ele.value;
+                                               button.setAttribute('data-ponyhoof-button-orig', orig);
+                                               var replaced = replaceText(replacer, orig);
+
+                                               k.changeButtonText(ele, replaced);
+                                       } else {
+                                               var orig = '';
+                                               var replaced = '';
+                                               loopChildText(ele, function(child) {
+                                                       if (child.nodeType == 3) {
+                                                               orig += child.textContent;
+                                                               replaced += replaceText(replacer, child.textContent);
+                                                               if (child.textContent != replaced) {
+                                                                       child.textContent = replaced;
+                                                               }
+                                                       }
+                                               });
+                                               button.setAttribute('data-ponyhoof-button-orig', orig);
+                                       }
+
+                                       if (orig != replaced) {
+                                               if (button.getAttribute('data-hover') != 'tooltip') {
+                                                       if (button.title == '') {
+                                                               button.title = orig;
+                                                       }
+                                               }
+                                       }
+                                       button.setAttribute('data-ponyhoof-button-text', replaced);
+                               }
+
+                                                       });
+                       
+                       k.ufiPagerLink(dom);
+
+                       if (k.reactRoot(dom)) {
+                               INTERNALUPDATE = iu;
+                               return;
+                       }
+
+                       k.postLike(dom);
+
+                       if (k.ticker(dom)) {
+                               INTERNALUPDATE = iu;
+                               return;
+                       }
+
+                       domReplaceFunc(dom.target, '', '.inCommonSectionList, #fbTimelineHeadline .name h2 > div, ._8yb, .-cx-PRIVATE-fbEntstreamAttachmentAvatar__secondarydetaillist, ._508a, .-cx-PRIVATE-pageLikeStory__fancountfooter, .permalinkHeaderInfo > .subscribeOrLikeSentence > .fwn', k.textBrohoof);
+                       
+                       domReplaceFunc(dom.target, '', '.uiUfiViewAll, .uiUfiViewPrevious, .uiUfiViewMore', function(ele) {
+                               var button = ele.querySelector('input[type="submit"]');
+                               var t = button.value;
+                               t = t.replace(/comments/g, "friendship letters");
+                               t = t.replace(/comment/g, "friendship letter");
+                               if (button.value != t) {
+                                       button.value = t;
+                               }
+                       });
+                       
+                       domReplaceFunc(dom.target, '', '.tooltipContent', function(ele) {
+                               // <div class="tooltipContent"><div class="tooltipText"><span>xy</span></div></div>
+                               // <div class="tooltipContent">xy</div>
+
+                               // <div class="tooltipContent"><div>Edit or Delete</div></div>
+                               var io = ele.getElementsByClassName('tooltipText');
+                               if (io.length) {
+                                       var target = io[0];
+                               } else {
+                                       var target = ele;
+                               }
+                               var potentialLabel = target.querySelector('._5bqd, .-cx-PRIVATE-HubbleInfoTip__content');
+                               if (potentialLabel) {
+                                       target = potentialLabel;
+                               }
+                               io = target.getElementsByTagName('div');
+                               if (io.length) {
+                                       target = io[0];
+                               }
+                               io = target.getElementsByTagName('span');
+                               if (io.length) {
+                                       target = io[0];
+                               }
+                               
+                               var t = target.innerHTML;
+                               t = replaceText(tooltipTitles, t);
+                               if (target.innerHTML != t) {
+                                       var oldWidth = target.offsetWidth;
+                                       target.innerHTML = t;
+
+                                       // <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>
+                                       if (!ele.parentNode || !ele.parentNode.parentNode || !ele.parentNode.parentNode.parentNode) {
+                                               return;
+                                       }
+                                       var layer = ele.parentNode.parentNode.parentNode;
+                                       if (!ele.parentNode.parentNode.className.match(/Center/) || !hasClass(layer, 'uiContextualLayerPositioner')) {
+                                               return;
+                                       }
+                                       layer.style.width = 'auto'; // fix horizontal scrollbar
+                                       var left = parseInt(layer.style.left);
+                                       var newWidth = target.offsetWidth;
+                                       layer.style.left = (left - Math.round((newWidth - oldWidth) / 2))+'px';
+                               }
+                       });
+                       
+                       domReplaceFunc(dom.target, 'egoProfileTemplate', '.egoProfileTemplate', function(ele) {
+                               if (ele.getAttribute('data-ponyhoof-ponified')) {
+                                       return;
+                               }
+                               var div = ele.getElementsByTagName('div');
+                               if (div.length) {
+                                       for (var i = 0, len = div.length; i < len; i += 1) {
+                                               var t = div[i].innerHTML;
+                                               t = k.textStandard(t);
+                                               if (div[i].innerHTML != t) {
+                                                       div[i].innerHTML = t;
+                                               }
+                                       }
+                               }
+                               
+                               var action = ele.getElementsByClassName('uiIconText');
+                               if (action.length) {
+                                       action = action[0];
+                                       ele.setAttribute('data-ponyhoof-iconText', action.textContent);
+
+                                       var t = action.innerHTML;
+                                       t = t.replace(/Like/g, capitaliseFirstLetter(CURRENTSTACK.like));
+                                       t = t.replace(/Join Group/g, "Join the Herd");
+                                       t = t.replace(/Add Friend/g, "Add "+capitaliseFirstLetter(CURRENTSTACK.friend));
+                                       t = t.replace(/\bConfirm Friend\b/g, "Confirm Friendship");
+                                       action.innerHTML = t;
+                               }
+
+                               ele.setAttribute('data-ponyhoof-ponified', 1);
+                       });
+                       
+                       domReplaceFunc(dom.target, 'uiInterstitial', '.uiInterstitial', function(ele) {
+                               if (ele.getAttribute('data-ponyhoof-ponified')) {
+                                       return;
+                               }
+                               ele.setAttribute('data-ponyhoof-ponified', 1);
+
+                               var title = ele.getElementsByClassName('uiHeaderTitle');
+                               if (title.length) {
+                                       title = title[0];
+                               } else {
+                                       title = ele.querySelector('.fsxl.fwb');
+                                       if (!title) {
+                                               return;
+                                       }
+                               }
+                               ele.setAttribute('data-ponyhoof-inters-title', title.textContent);
+                       });
+
+                       domReplaceFunc(dom.target, 'uiLayer', '.uiLayer', function(ele) {
+                               if (ele.getAttribute('data-ponyhoof-dialog-title')) {
+                                       return;
+                               }
+
+                               var titlebar = ele.querySelector('.-cx-PUBLIC-uiDialog__title, ._t ._1yw, ._4-i0, .-cx-PRIVATE-xuiDialog__title, .overlayTitle, .fbCalendarOverlayHeader');
+                               if (titlebar) {
+                                       var titletext = ele.querySelector('._52c9, .-cx-PRIVATE-xuiDialog__titletext');
+                                       if (!titletext) {
+                                               titletext = titlebar;
+                                       }
+
+                                       var orig = '';
+                                       var replaced = '';
+                                       loopChildText(titletext, function(child) {
+                                               if (child.nodeType == 3) {
+                                                       orig += child.textContent;
+                                                       replaced += replaceText(dialogTitles, child.textContent);
+                                                       if (child.textContent != replaced) {
+                                                               child.textContent = replaced;
+                                                       }
+                                               }
+                                       });
+                                       addClass(titlebar, 'ponyhoof_fbdialog_title');
+                                       if (orig != replaced) {
+                                               titlebar.title = orig;
+                                       }
+
+                                       addClass(ele, 'ponyhoof_fbdialog');
+                                       ele.setAttribute('data-ponyhoof-dialog-title', replaced);
+                                       ele.setAttribute('data-ponyhoof-dialog-orig', orig);
+
+                                       var body = ele.querySelector('._t ._13, .-cx-PRIVATE-uiDialog__body, ._4-i2, .-cx-PRIVATE-xuiDialog__body, .uiLayerPageContent > .pvm');
+                                       if (body) {
+                                               addClass(body, 'ponyhoof_fbdialog_body');
+
+                                               var stop = false;
+                                               loopChildText(body, function(child) {
+                                                       if (stop) {
+                                                               return;
+                                                       }
+                                                       if (child.nodeType == TEXT_NODE) {
+                                                               var replaced = replaceText(dialogDescriptionTitles, child.textContent);
+                                                               if (child.textContent != replaced) {
+                                                                       child.textContent = replaced;
+                                                                       stop = true;
+                                                               }
+                                                       }
+                                               });
+                                       }
+
+                                       if (hasClass(dom.target, 'uiLayer')) {
+                                               // dom.target is intentional
+                                               // Detect rare cases when HTML detection just got turned on, and there is a dialog at the back
+                                               k._dialog_playSound(replaced, ele);
+                                       }
+                               }
+
+                               domChangeTextbox(ele, '.groupsMemberFlyoutWelcomeTextarea', function(textbox) {
+                                       var orig = textbox.getAttribute('placeholder');
+                                       var t = orig.replace(/\bgroup\b/, 'herd');
+                                       if (t != orig) {
+                                               return t;
+                                       }
+                                       return "Welcome him/her to the herd...";
+                               });
+                               domChangeTextbox(ele, '.fbEventMemberComment', function(textbox) {
+                                       var orig = textbox.getAttribute('placeholder');
+                                       var t = orig.replace(/\bevent\b/, 'adventure');
+                                       if (t != orig) {
+                                               return t;
+                                       }
+                                       return orig; // for pages "Write something to let her know you're going too."
+                               });
+
+                               // Hovercard
+                               $$(ele, '._7lo > .fcg, .-cx-PRIVATE-hovercard__footer > .fcg', function(footer) {
+                                       loopChildText(footer, k.textBrohoof);
+                               });
+                       });
+
+                       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) {
+                               if (CURRENTSTACK.stack == 'pony') {
+                                       ele.setAttribute('data-hover', 'tooltip');
+                                       ele.setAttribute('aria-label', CURRENTLANG.fb_share_tooltip);
+                                       ele.setAttribute('title', '');
+                               }
+                       });
+                       
+                       domReplaceFunc(dom.target, '', '.uiHeaderTitle, .legacyContextualDialogTitle, ._6dp, .-cx-PRIVATE-litestandRHC__titlename', function(ele) {
+                               var imgwrap = ele.querySelector('._8m, .-cx-PRIVATE-uiImageBlock__content, .adsCategoryTitleLink');
+                               if (imgwrap) {
+                                       ele = imgwrap;
+                               };
+
+                               loopChildText(ele, function(child) {
+                                       if (!child.children || !child.children.length) {
+                                               var t = replaceText(headerTitles, child.textContent);
+                                               if (child.textContent != t) {
+                                                       child.textContent = t;
+                                               }
+                                       }
+                               });
+                       });
+                       
+                       domReplaceFunc(dom.target, '', '.insights-header .header-title > .ufb-text-content', function(ele) {
+                               var t = replaceText(headerInsightsTitles, ele.textContent);
+                               if (ele.textContent != t) {
+                                       ele.textContent = t;
+                               }
+                       });
+
+                       if (k.fbDockChatBuddylistNub(dom.target)) {
+                               INTERNALUPDATE = iu;
+                               return;
+                       }
+
+                       if (k.pokesDashboard(dom.target)) {
+                               INTERNALUPDATE = iu;
+                               return;
+                       }
+
+                       k.commentBrohoofed(dom);
+
+                       k.changeCommentBox(dom);
+                       k.changeComposer(dom);
+
+                       k.notification(dom);
+                       k.menuItems(dom);
+                       k.fbRemindersStory(dom.target);
+                       if (k.flyoutLikeForm(dom.target)) {
+                               INTERNALUPDATE = iu;
+                               return;
+                       }
+                       k.pluginButton(dom.target);
+                       k.insightsCountry(dom);
+                       k.timelineMutualLikes(dom.target);
+                       k.videoStageContainer(dom.target);
+
+                       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...");
+                       domChangeTextbox(dom.target, '.groupAddMemberTypeaheadBox .inputtext', "Add "+capitaliseFirstLetter(CURRENTSTACK.friends)+" to the Herd");
+                       //domChangeTextbox(dom.target, '.friendListAddTypeahead .inputtext', "Add "+CURRENTSTACK.friends+" to this directory");
+                       domChangeTextbox(dom.target, '.friendListAddTypeahead .inputtext', "Add "+CURRENTSTACK.friends+" to this list");
+                       domChangeTextbox(dom.target, '.groupsJumpHeaderSearch .inputtext', "Search this herd");
+                       domChangeTextbox(dom.target, '.MessagingSearchFilter .inputtext', "Search Friendship Reports");
+                       domChangeTextbox(dom.target, '#chatFriendsOnline .fbChatTypeahead .inputtext', "Pals on Whinny Chat");
+                       
+                       //domChangeTextbox(dom.target, '.uiComposer textarea', "What lessons in friendship have you learned today?");
+                       //domChangeTextbox(dom.target, '.uiComposerMessageBox textarea', "Share your friendship stories...");
+                       //domChangeTextbox(dom.target, '.uiMetaComposerMessageBox textarea', "What lessons in friendship have you learned today?");
+                       domChangeTextbox(dom.target, '#q, .fbFacebar .facebarInput .structuredText, ._585- ._586f, .-cx-PUBLIC-fbFacebar__root .-cx-PUBLIC-uiStructuredInput__text', function(searchbox) {
+                               if (CURRENTLANG.sniff_fb_search_boxAlt && searchbox.getAttribute('placeholder').indexOf(CURRENTLANG.sniff_fb_search_boxAlt) != -1) {
+                                       return CURRENTLANG.fb_search_boxAlt;
+                               }
+                               return CURRENTLANG.fb_search_box;
+                       });
+
+                       k.ponyhoofPageOptions(dom);
+                       if (userSettings.debug_betaFacebookLinks && w.location.hostname == 'beta.facebook.com') {
+                               k.debug_betaFacebookLinks(dom.target);
+                       }
+                       
+                       INTERNALUPDATE = iu;
+               };
+
+               k.photos_snowlift = null;
+               k.snowliftPinkie = function(dom) {
+                       if (!k.snowliftPinkieInjected) {
+                               var id = dom.target.getAttribute('id');
+                               if ((id && id == 'photos_snowlift') || hasClass(dom.target, 'fbPhotoSnowlift')) {
+                                       k.snowliftPinkieInjected = true;
+                                       k.photos_snowlift = dom.target;
+
+                                       addClass(k.photos_snowlift, 'ponyhoof_snowlift_haspinkiediv');
+                                       var n = d.createElement('div');
+                                       n.id = 'ponyhoof_snowlift_pinkie';
+                                       k.photos_snowlift.appendChild(n);
+                               }
+                       }
+               };
+
+               k.notificationsFlyoutSettingsInjected = false;
+               k.notificationsFlyoutSettings = function(dom) {
+                       if (ISUSINGPAGE) {
+                               k.notificationsFlyoutSettingsInjected = true;
+                               return;
+                       }
+                       if (!k.notificationsFlyoutSettingsInjected) {
+                               var jewel = $('fbNotificationsJewel');
+                               if (jewel) {
+                                       var header = jewel.getElementsByClassName('uiHeaderTop');
+                                       if (!header.length || !header[0].childNodes || !header[0].childNodes.length) {
+                                               return;
+                                       }
+                                       header = header[0];
+
+                                       var settingsLink = d.createElement('a');
+                                       settingsLink.href = '#';
+                                       settingsLink.textContent = 'Ponyhoof Sounds';
+
+                                       var actions = jewel.getElementsByClassName('uiHeaderActions');
+                                       if (actions.length) {
+                                               actions = actions[0];
+                                               var span = d.createElement('span');
+                                               span.innerHTML = ' &middot; ';
+                                               
+                                               actions.appendChild(span);
+                                               actions.appendChild(settingsLink);
+                                       } else {
+                                               var rfloat = d.createElement('div');
+                                               rfloat.className = 'rfloat';
+                                               rfloat.appendChild(settingsLink);
+                                               header.insertBefore(rfloat, header.childNodes[0]);
+                                       }
+
+                                       settingsLink.addEventListener('click', function(e) {
+                                               e.preventDefault();
+
+                                               if (!optionsGlobal) {
+                                                       optionsGlobal = new Options();
+                                               }
+                                               optionsGlobal.create();
+                                               optionsGlobal.switchTab('sounds');
+                                               optionsGlobal.show();
+
+                                               try {
+                                                       clickLink(jewel.getElementsByClassName('jewelButton')[0]);
+                                               } catch (e) {}
+                                       }, false);
+
+                                       k.notificationsFlyoutSettingsInjected = true;
+                               }
+                       }
+               };
+
+               k.textNodes = function(dom) {
+                       try {
+                               if (!dom.target.parentNode || !dom.target.parentNode.parentNode || !hasClass(dom.target.parentNode.parentNode, 'dialog_title')) {
+                                       return false;
+                               }
+
+                               var title = dom.target.parentNode.parentNode;
+                               var orig = dom.target.textContent;
+                               var replaced = replaceText(dialogTitles, orig);
+
+                               if (dom.target.textContent != replaced) {
+                                       dom.target.textContent = replaced;
+                               }
+                               addClass(title, 'ponyhoof_fbdialog_title');
+                               if (orig != replaced) {
+                                       title.title = orig;
+                               }
+
+                               k.getParent(title, function(ele) {
+                                       return hasClass(ele, 'generic_dialog');
+                               }, function(ele) {
+                                       if (hasClass(ele, 'fbQuestionsPopup')) {
+                                               return;
+                                       }
+
+                                       addClass(ele, 'ponyhoof_fbdialog');
+                                       ele.setAttribute('data-ponyhoof-dialog-title', replaced);
+                                       ele.setAttribute('data-ponyhoof-dialog-orig', orig);
+
+                                       var body = ele.getElementsByClassName('dialog_body');
+                                       if (body.length) {
+                                               body = body[0];
+                                               addClass(body, 'ponyhoof_fbdialog_body');
+
+                                               var confirmation_message = body.getElementsByClassName('confirmation_message');
+                                               if (confirmation_message.length) {
+                                                       confirmation_message = confirmation_message[0];
+
+                                                       var stop = false;
+                                                       loopChildText(confirmation_message, function(child) {
+                                                               if (stop) {
+                                                                       return;
+                                                               }
+                                                               if (child.nodeType == TEXT_NODE) {
+                                                                       var replaced = replaceText(dialogDescriptionTitles, child.textContent);
+                                                                       if (child.textContent != replaced) {
+                                                                               child.textContent = replaced;
+                                                                               stop = true;
+                                                                       }
+                                                               }
+                                                       });
+                                               } else {
+                                                       var video_dialog_text = body.getElementsByClassName('video_dialog_text');
+                                                       if (video_dialog_text.length) {
+                                                               video_dialog_text = video_dialog_text[0];
+                                                               if (video_dialog_text.childNodes.length == 3) {
+                                                                       var i = 0;
+                                                                       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?"];
+                                                                       loopChildText(video_dialog_text, function(child) {
+                                                                               if (!texts[i]) {
+                                                                                       return;
+                                                                               }
+                                                                               child.textContent = texts[i];
+                                                                               i++;
+                                                                       });
+                                                               }
+                                                       }
+                                               }
+                                       }
+
+                                       k._dialog_playSound(replaced, ele);
+                               });
+
+                               return true;
+                       } catch (e) {}
+
+                       return false;
+               };
+
+               k.ufiPagerLink = function(dom) {
+                       domReplaceFunc(dom.target, '', '.UFIPagerLink', function(ele) {
+                               var t = ele.innerHTML;
+                               t = t.replace(/ comments/, " friendship letters");
+                               t = t.replace(/ comment/, " friendship letter");
+                               if (ele.innerHTML != t) {
+                                       ele.innerHTML = t;
+                               }
+                       });
+               };
+
+               k.postLike = function(dom) {
+                       if (hasClass(dom.target, 'uiUfiLike') || hasClass(dom.target, 'UFILikeSentence')) {
+                               k._likePostBox(dom.target);
+                       } else {
+                               /*if (dom.target.parentNode) {
+                                       if (hasClass(dom.target.parentNode, 'UFILikeSentence')) {
+                                               k._likePostBox(dom.target);
+                                               return;
+                                       }
+                               }*/
+                               domReplaceFunc(dom.target, '', '.uiUfiLike, .UFILikeSentence', k._likePostBox);
+                       }
+               };
+               
+               k._likePostBox = function(ele) {
+                       //var inner = ele.querySelector('._42ef, .-cx-PRIVATE-uiFlexibleBlock__flexiblecontent, .lfloat > span, .-cx-PRIVATE-uiImageBlockDeprecated__content, .-cx-PRIVATE-uiImageBlock__content, ._8m, .-cx-PRIVATE-uiFlexibleBlock__flexibleContent');
+                       //if (inner) {
+
+                       var inner = ele.getElementsByClassName('UFILikeSentenceText');
+                       if (inner.length) {
+                               inner = inner[0];
+                               var t = k.likeSentence(inner.innerHTML);
+                               if (inner.innerHTML != t) {
+                                       inner.innerHTML = t;
+                               }
+                       }
+
+                       var reorder = ele.getElementsByClassName('UFIOrderingModeSelectorDownCaret');
+                       if (reorder.length) {
+                               reorder = reorder[0];
+                               if (reorder.previousSibling) {
+                                       k.UFIOrderingMode(reorder.previousSibling);
+                               }
+                       }
+               };
+
+               k.likeSentence = function(t) {
+                       //t = t.replace(/likes? this\./g, "brohoof'd this.");
+                       t = t.replace(/like this\./g, CURRENTSTACK['like_past']+" this.");
+                       t = t.replace(/likes this\./g, CURRENTSTACK['likes_past']+" this.");
+                       t = t.replace(/\bpeople\b/g, CURRENTSTACK['people']);
+                       t = t.replace(/\bperson\b/g, CURRENTSTACK['person']); // http://fb.com/647294431950845
+                       //t = t.replace(/(^|\\W|_)people(^|\\W|_)/g, "ponies");
+                       /*if (CURRENTSTACK == 'pony') {
+                               t = t.replace(/\<3 7h\!5/g, '/) 7h!5');
+                               t = t.replace(/\<3 7h15/g, '/) 7h!5');
+                       }*/
+
+                       return t;
+               };
+
+               k._likeCount = function(ufiitem) {
+                       var likecount = ufiitem.getElementsByClassName('comment_like_button');
+                       if (likecount.length) {
+                               likecount = likecount[0];
+                               var t = likecount.innerHTML;
+                               //t = t.replace(/likes? this\./g, "brohoof'd this.");
+                               t = t.replace(/like this/g, CURRENTSTACK['like_past']+" this");
+                               t = t.replace(/likes this/g, CURRENTSTACK['likes_past']+" this");
+                               if (likecount.innerHTML != t) {
+                                       likecount.innerHTML = t;
+                               }
+                       }
+               };
+
+               k.UFIOrderingMode = function(ele) {
+                       var t = ele.textContent;
+                       t = t.replace(/Top Comments/, "Top Friendship Letters");
+                       if (ele.textContent != t) {
+                               ele.textContent = t;
+                       }
+               };
+
+               k._likeDesc = '';
+               k._unlikeDesc = '';
+               k._likeConditions = '';
+               k._likeIsLikeConditions = '';
+               k.FB_TN_LIKELINK = '>';
+               k.FB_TN_UNLIKELINK = '?';
+               k.commentBrohoofed = function(dom) {
+                       var targets = '.UFICommentActions a, .UFILikeLink';
+                       if (!USINGMUTATION) {
+                               targets += ', .UFILikeThumb';
+                       }
+                       domReplaceFunc(dom.target, '', targets, k._commentLikeLink);
+               };
+
+               k.commentLikeDescInit = function() {
+                       if (k._likeDesc == '') {
+                               var locale = getDefaultUiLang();
+                               if (LANG[locale] && LANG[locale].sniff_comment_tooltip_like) {
+                                       k._likeDesc = LANG[locale].sniff_comment_tooltip_like;
+                               } else {
+                                       k._likeDesc = LANG['en_US'].sniff_comment_tooltip_like;
+                               }
+                               if (LANG[locale] && LANG[locale].sniff_comment_tooltip_unlike) {
+                                       k._unlikeDesc = LANG[locale].sniff_comment_tooltip_unlike;
+                               } else {
+                                       k._unlikeDesc = LANG['en_US'].sniff_comment_tooltip_unlike;
+                               }
+
+                               k._likeConditions = [
+                                       k._likeDesc, k._unlikeDesc,
+                                       capitaliseFirstLetter(CURRENTSTACK.like)+" this friendship letter", capitaliseFirstLetter(CURRENTSTACK.unlike)+" this friendship letter"
+                               ];
+                               k._likeIsLikeConditions = [
+                                       k._likeDesc,
+                                       capitaliseFirstLetter(CURRENTSTACK.like)+" this friendship letter"
+                               ];
+                       }
+               };
+
+               k._commentLikeLink = function(ele) {
+                       k.commentLikeDescInit();
+
+                       var pass = false;
+                       var likeThumb = false;
+                       if (k._likeConditions.indexOf(ele.title) == -1) {
+                               // extreme sniffing
+                               var trackingNode = k.getTrackingNode(ele);
+                               if (trackingNode == k.FB_TN_LIKELINK || trackingNode == k.FB_TN_UNLIKELINK) {
+                                       pass = true;
+                               } else if (!USINGMUTATION && hasClass(ele, 'UFILikeThumb')) {
+                                       likeThumb = true;
+                                       pass = true;
+                               }
+                       } else {
+                               pass = true;
+                       }
+                       if (!pass) {
+                               return;
+                       }
+
+                       if (!hasClass(ele, 'ponyhoof_brohoof_button')) {
+                               if (!USINGMUTATION) {
+                                       ele.addEventListener('click', function() {
+                                               var ele = this;
+                                               k.delayIU(function() {
+                                                       if (likeThumb) {
+                                                               // UFILikeThumb disappears after a post is brohoof'd
+                                                               k._likeBrohoofMagic(ele, false);
+                                                       } else {
+                                                               k._commentLikeLink(ele);
+                                                       }
+                                               });
+                                       }, false);
+                               }
+                               addClass(ele, 'ponyhoof_brohoof_button');
+                       }
+
+                       var isLike = false;
+                       if (k.getTrackingNode(ele) == k.FB_TN_LIKELINK || likeThumb || k._likeIsLikeConditions.indexOf(ele.title) != -1) {
+                               isLike = true;
+                       }
+
+                       k._likeBrohoofMagic(ele, isLike);
+               };
+
+               k._likeBrohoofMagic = function(ele, isLike) {
+                       var comment = k.getReactComment(ele);
+                       var title = '';
+                       if (isLike) {
+                               removeClass(ele, 'ponyhoof_brohoof_button_unbrohoof');
+                               title = capitaliseFirstLetter(CURRENTSTACK.like)+" this";
+                       } else {
+                               addClass(ele, 'ponyhoof_brohoof_button_unbrohoof');
+                               title = capitaliseFirstLetter(CURRENTSTACK.unlike)+" this";
+                       }
+                       if (comment) {
+                               title += " friendship letter";
+                       }
+                       ele.setAttribute('data-ponyhoof-title', ele.title);
+                       ele.title = title;
+                       ele.setAttribute('data-ponyhoof-title-modified', title);
+
+                       if (comment) {
+                               k._markCommentLiked(comment, isLike);
+
+                               // Fix an edge case with jump to comment
+                               if (hasClass(comment, 'highlightComment')) {
+                                       w.setTimeout(function() {
+                                               k._markCommentLiked(comment, isLike);
+                                       }, 1);
+                               }
+                       } else {
+                               k.delayIU(function() {
+                                       if (!ele.parentNode) {
+                                               var ufi = k.getReactUfi(ele);
+                                               if (!ufi) {
+                                                       return;
+                                               }
+                                               ele = ufi;
+                                       }
+
+                                       k.getParent(ele, function(form) {
+                                               return (form.tagName.toUpperCase() == 'FORM' && hasClass(form, 'commentable_item'));
+                                       }, function(form) {
+                                               if (!form) {
+                                                       return;
+                                               }
+                                               var ufi = form.getElementsByClassName('UFIList');
+                                               if (!ufi.length) {
+                                                       return;
+                                               }
+                                               ufi = ufi[0];
+                                               if (!ufi.parentNode) {
+                                                       return;
+                                               }
+
+                                               /*var id = k.getReactId(ufi);
+                                               if (!id) {
+                                                       return;
+                                               }
+                                               if (!k.ufiData[id]) {
+                                                       k.ufiData[id] = {};
+                                               }*/
+
+                                               if (isLike) {
+                                                       //k.ufiData[id].brohoofed = false;
+                                                       removeClass(ufi.parentNode, 'ponyhoof_brohoofed');
+                                               } else {
+                                                       //k.ufiData[id].brohoofed = true;
+                                                       addClass(ufi.parentNode, 'ponyhoof_brohoofed');
+                                               }
+                                       });
+                               });
+                       }
+               };
+
+               k._markCommentLiked = function(ufiitem, isLike) {
+                       var child = null;
+                       if (ufiitem.childNodes && ufiitem.childNodes[0]) {
+                               child = ufiitem.childNodes[0];
+                       }
+                       if (isLike) {
+                               removeClass(ufiitem, 'ponyhoof_comment_liked');
+                               if (child) {
+                                       removeClass(child, 'ponyhoof_comment_liked');
+                               }
+                       } else {
+                               addClass(ufiitem, 'ponyhoof_comment_liked');
+                               if (child) {
+                                       addClass(child, 'ponyhoof_comment_liked');
+                               }
+                       }
+               };
+
+               k.REACTROOTID = '.r['; // https://github.com/facebook/react/commit/8bc2abd367232eca66e4d38ff63b335c8cf23c45
+               k.REACTATTRNAME = 'data-reactid'; // https://github.com/facebook/react/commit/67cf44e7c18e068e3f39462b7ac7149eee58d3e5
+               k.getReactId = function(ufiitem) {
+                       var id = ufiitem.getAttribute(k.REACTATTRNAME);
+                       if (!id) {
+                               return false;
+                       }
+                       return id.substring(k.REACTROOTID.length, id.indexOf(']'));
+               };
+
+               k.reactRoot = function(dom) {
+                       var id = dom.target.getAttribute(k.REACTATTRNAME);
+                       if (id || hasClass(dom.target, 'UFILikeIcon')) {
+                               // beeperNotificaton
+                               if (hasClass(dom.target, '_3sod') || hasClass(dom.target, '-cx-PRIVATE-notificationBeeperItem__beeperitem')) {
+                                       var info = dom.target.querySelector('._3sol > span, .-cx-PRIVATE-notificationBeeperItem__imageblockcontent > span');
+                                       if (!info) {
+                                               return false;
+                                       }
+                                       k._beepNotification_change(dom.target, info, k._beepNotification_condition_react);
+
+                                       return true;
+                               }
+
+                               // Notifications
+                               if (k._notification_react(dom.target)) {
+                                       return true;
+                               }
+                               var notificationReact = false;
+                               domReplaceFunc(dom.target, '', '.'+k.notification_itemClass[0]+', .'+k.notification_itemClass[1], function(ele) {
+                                       k._notification_react(ele);
+                                       notificationReact = true;
+                               });
+                               if (notificationReact) {
+                                       return true;
+                               }
+
+                               // Comments
+                               if (hasClass(dom.target, 'UFIComment')) {
+                                       k.commentBrohoofed({target: dom.target});
+                               } else if (hasClass(dom.target, 'UFIReplyList')) {
+                                       k.changeCommentBox({target: dom.target});
+                                       k.commentBrohoofed({target: dom.target}); // only 1 reply
+                               } else if (hasClass(dom.target, 'UFIAddComment')) {
+                                       domChangeTextbox(dom.target, 'textarea', k._changeCommentBox_change);
+                               } else if (hasClass(dom.target, 'UFILikeSentence')) {
+                                       k._likePostBox(dom.target);
+                               } else if (hasClass(dom.target, 'UFIImageBlockContent')) {
+                                       if (hasClass(dom.target, '_42ef') || hasClass(dom.target, '-cx-PRIVATE-uiFlexibleBlock__flexiblecontent')) {
+                                               // on groups with seen, clicking a photo will open in the viewer, but the original post on the group messes up
+                                               k._likePostBox(dom.target.parentNode);
+                                       } else {
+                                               // marking a comment as spam in another section, and then unmark
+                                               k.commentBrohoofed({target: dom.target});
+                                       }
+                               } else if (hasClass(dom.target, 'UFILikeLink') || (!USINGMUTATION && hasClass(dom.target, 'UFILikeThumb'))) {
+                                       k._commentLikeLink(dom.target);
+                               } else if (dom.target.parentNode) {
+
+                                       if (hasClass(dom.target.parentNode, 'UFIComment')) {
+                                               // marking a comment as spam, and then immediately undo
+                                               k.commentBrohoofed({target: dom.target.parentNode});
+                                       } else if (hasClass(dom.target.parentNode, 'UFILikeSentence')) {
+                                               // groups with seen, from no likes to liked
+                                               k._likePostBox(dom.target.parentNode);
+                                       } else if (dom.target.parentNode.parentNode) {
+
+                                               //if (hasClass(dom.target.parentNode.parentNode, 'UFIImageBlockContent') || hasClass(dom.target.parentNode.parentNode, 'lfloat')) {
+                                               if (hasClass(dom.target.parentNode.parentNode, 'UFILikeSentenceText')) {
+                                                       // John Amebijeigeba Laverdetberg brohoof this.
+                                                       // You and John Amebijeigeba Laverdetberg like this.
+                                                       var ufi = k.getReactUfi(dom.target);
+                                                       if (ufi) {
+                                                               k.postLike({target: ufi});
+                                                       }
+                                               } else if (dom.target.parentNode.parentNode.parentNode) {
+
+                                                       //if (hasClass(dom.target.parentNode.parentNode.parentNode, 'UFIImageBlockContent')) {
+                                                       if (hasClass(dom.target.parentNode.parentNode.parentNode, 'UFILikeSentenceText')) {
+                                                               var ufi = k.getReactUfi(dom.target);
+                                                               if (ufi) {
+                                                                       k.postLike({target: ufi});
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
+                               return true;
+                       }
+
+                       return false;
+               };
+
+               k.changeCommentBox = function(dom) {
+                       domChangeTextbox(dom.target, '.commentArea textarea, .UFIAddComment textarea', k._changeCommentBox_change);
+               };
+               k._changeCommentBox_change = function(textbox) {
+                       try {
+                               var form = textbox;
+                               while (form) {
+                                       if (form.tagName.toUpperCase() == 'FORM' && form.getAttribute('action') == '/ajax/ufi/modify.php') {
+                                               break;
+                                       }
+                                       form = form.parentNode;
+                               }
+                               if (form) {
+                                       var feedback_params = JSON.parse(form.querySelector('input[name="feedback_params"]').value);
+                                       switch (feedback_params.assoc_obj_id) {
+                                               case '140792002656140':
+                                               case '346855322017980':
+                                                       return LANG['ms_MY'].fb_comment_box;
+
+                                               case '146225765511748':
+                                                       return CURRENTLANG.fb_composer_coolstory;
+
+                                               default:
+                                                       break;
+                                       }
+                                       switch (feedback_params.target_profile_id) {
+                                               case '496282487062916':
+                                                       return CURRENTLANG.fb_composer_coolstory;
+
+                                               default:
+                                                       break;
+                                       }
+                               }
+                       } catch (e) {}
+                       
+                       return CURRENTLANG.fb_comment_box;
+               };
+
+               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'].join('|'), 'i');
+               k.composerExclude = new RegExp(['suck', 'shit', 'fuck', 'assho', 'crap', 'ponyfag', 'faggo', 'retard', 'dick'].join('|'), 'i');
+               k.composerSpecialPages = {
+                        '140792002656140': {composer: LANG['ms_MY'].fb_composer_lessons, malay:true}
+                       ,'346855322017980': {composer: LANG['ms_MY'].fb_composer_lessons, malay:true}
+                       ,'366748370110998': {composer: LANG['ms_MY'].fb_composer_lessons, malay:true}
+                       ,'146225765511748': {composer: CURRENTLANG.fb_composer_coolstory}
+                       ,'496282487062916': {composer: CURRENTLANG.fb_composer_coolstory}
+               };
+               k.composerSelectors = '.uiComposer textarea.mentionsTextarea, .composerTypeahead textarea';
+               k.composerButtonSelectors = '.uiComposerMessageBoxControls .submitBtn input, .uiComposerMessageBoxControls .submitBtn .uiButtonText, ._11b input, .-cx-PRIVATE-fbComposerMessageBox__button input, button._11b, button.-cx-PRIVATE-fbComposerMessageBox__button';
+               k.changeComposer = function(dom) {
+                       var pageid = '';
+
+                       // tagging people with "Who are you with?" and new feelings feature
+                       if (hasClass(dom.target, 'uiMentionsInput')) {
+                               // fix group composers, ugh
+                               if (dom.target.parentNode && dom.target.parentNode.parentNode && dom.target.parentNode.parentNode.parentNode) {
+                                       // .uiMentionsInput -> #id -> .-cx-PUBLIC-fbComposerMessageBox__root -> form -> .-cx-PUBLIC-fbComposer__content
+                                       k._changeComposer_fixGroup(dom.target.parentNode.parentNode.parentNode);
+                               }
+
+                               contentEval(function(arg) {
+                                       try {
+                                               if (typeof window.requireLazy == 'function') {
+                                                       window.requireLazy(['MentionsInput'], function(MentionsInput) {
+                                                               var mentions = MentionsInput.getInstance(document.getElementById(arg.uiMentionsInput));
+                                                               mentions.setPlaceholder(mentions._input.title);
+                                                       });
+                                               }
+                                       } catch (e) {
+                                               if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
+                                                       console.log("Unable to hook to MentionsInput");
+                                                       console.dir(e);
+                                               }
+                                       }
+                               }, {"CANLOG":CANLOG, "uiMentionsInput":dom.target.id});
+                               return;
+                       }
+
+                       domChangeTextbox(dom.target, k.composerSelectors, function(composer) {
+                               var placeholderText = CURRENTLANG.fb_composer_lessons;
+
+                               try {
+                                       var form = composer;
+                                       var inputContainer = null;
+                                       while (form) {
+                                               if (hasClass(form, 'uiComposer') || hasClass(form, '_119' /*'_118'*/) || hasClass(form, '-cx-PRIVATE-fbComposer__root')) {
+                                                       break;
+                                               }
+                                               if (hasClass(form, 'inputContainer')) {
+                                                       inputContainer = form;
+                                               }
+                                               form = form.parentNode;
+                                       }
+
+                                       if (!form) {
+                                               return placeholderText;
+                                       }
+
+                                       pageid = form.querySelector('input[name="xhpc_targetid"]');
+                                       if (!pageid) {
+                                               pageid = '';
+                                               return placeholderText;
+                                       }
+                                       pageid = pageid.value;
+                                       form.setAttribute('data-ponyhoof-xhpc_targetid', pageid);
+                                       if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].composer) {
+                                               placeholderText = k.composerSpecialPages[pageid].composer;
+                                       }
+
+                                       k._changeComposerAttachment(dom, pageid);
+
+                                       if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
+                                               $$(form, k.composerButtonSelectors, function(submit) {
+                                                       k.changeButtonText(submit, "Kirim");
+                                               });
+                                       }
+
+                                       composer.addEventListener('input', function() {
+                                               var malay = false;
+                                               var lang = CURRENTLANG;
+                                               if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
+                                                       malay = true;
+                                                       lang = LANG['ms_MY'];
+                                               }
+
+                                               // we can't guarantee the button anymore, so we have to do this expensive JS :(
+                                               // group composers are funky and teleport the textbox to a new <div> onclick
+                                               $$(form, k.composerButtonSelectors, function(submit) {
+                                                       if (!k.composerExclude.test(composer.value) && k.composerPonies.test(composer.value)) {
+                                                               if (composer.value.toUpperCase() == composer.value) {
+                                                                       k.changeButtonText(submit, lang.fb_composer_ponies_caps);
+                                                               } else {
+                                                                       k.changeButtonText(submit, lang.fb_composer_ponies);
+                                                               }
+                                                       } else if (malay) {
+                                                               k.changeButtonText(submit, "Kirim");
+                                                       } else {
+                                                               var submitParent = submit;
+                                                               if (submit.tagName.toUpperCase() != 'BUTTON') {
+                                                                       submitParent = submit.parentNode;
+                                                               }
+                                                               if (submitParent.getAttribute('data-ponyhoof-button-text')) {
+                                                                       k.changeButtonText(submit, submitParent.getAttribute('data-ponyhoof-button-text'));
+                                                               }
+                                                       }
+                                               });
+                                       });
+
+                                       if (isPonyhoofPage(pageid)) {
+                                               composer.addEventListener('focus', function() {
+                                                       if (inputContainer) {
+                                                               k._changeComposer_insertReadme(inputContainer.nextSibling);
+                                                               return;
+                                                       }
+
+                                                       // pages have ComposerX and teleports the textbox here and there
+                                                       $$(form, '._2yg, .-cx-PUBLIC-fbComposerMessageBox__root', function(composer) {
+                                                               // exclude inactives
+                                                               if (!composer.parentNode || hasClass(composer.parentNode, 'hidden_elem')) {
+                                                                       return;
+                                                               }
+
+                                                               var temp = composer.getElementsByClassName('ponyhoof_page_readme');
+                                                               if (temp.length) {
+                                                                       return;
+                                                               }
+
+                                                               // status: before taggersPlaceholder
+                                                               // photos: after uploader
+                                                               // fallback: before bottom bar
+                                                               var insertBefore = composer.querySelector('._3-6, .-cx-PRIVATE-fbComposerBootloadStatus__taggersplaceholder');
+                                                               if (!insertBefore) {
+                                                                       insertBefore = composer.querySelector('._93, .-cx-PRIVATE-fbComposerUploadMedia__root');
+                                                                       if (insertBefore) {
+                                                                               insertBefore = insertBefore.nextSibling;
+                                                                       }
+                                                               }
+                                                               if (!insertBefore) {
+                                                                       insertBefore = composer.querySelector('._1dsp, .-cx-PUBLIC-fbComposerMessageBox__bar');
+                                                               }
+                                                               // abort if no good insertion
+                                                               if (!insertBefore) {
+                                                                       return;
+                                                               }
+
+                                                               k._changeComposer_insertReadme(insertBefore);
+                                                       });
+                                               }, true);
+                                               return "Suggest something for Ponyhoof...";
+                                       }
+                                       if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].composer) {
+                                               return k.composerSpecialPages[pageid].composer;
+                                       }
+                               } catch (e) {}
+                               
+                               return placeholderText;
+                       });
+
+                       // moved outside for timelineStickyHeader
+                       if (!pageid) {
+                               k._changeComposerAttachment(dom, null);
+                       }
+
+                       // fix group composers, ugh
+                       //k._changeComposer_fixGroup(dom.target);
+               };
+
+               k._changeComposerAttachment = function(dom, pageid) {
+                       $$(dom.target, '._4_ li a, ._9lb, .-cx-PUBLIC-fbComposerAttachment__link, .uiComposerAttachment', function(attachment) {
+                               if (attachment.getAttribute('data-ponyhoof-ponified')) {
+                                       return;
+                               }
+
+                               var switchit = false;
+                               switch (attachment.getAttribute('data-endpoint')) {
+                                       case '/ajax/composerx/attachment/status/':
+                                       case '/ajax/composerx/attachment/group/post/':
+                                       case '/ajax/composerx/attachment/wallpost/':
+                                       case '/ajax/metacomposer/attachment/timeline/status.php':
+                                       case '/ajax/metacomposer/attachment/timeline/backdated_status.php':
+                                       case '/ajax/metacomposer/attachment/timeline/wallpost.php':
+                                               switchit = "Take a Note";
+                                               if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
+                                                       switchit = "Tulis Kiriman";
+                                               }
+                                               break;
+
+                                       case '/ajax/composerx/attachment/media/chooser/':
+                                       case '/ajax/composerx/attachment/media/chooser':
+                                       case '/ajax/composerx/attachment/media/upload/':
+                                       case '/ajax/metacomposer/attachment/timeline/photo/photo.php':
+                                       case '/ajax/metacomposer/attachment/timeline/photo/backdated_upload.php':
+                                       case '/ajax/metacomposer/attachment/timeline/backdated_vault.php?max_select=1':
+                                               switchit = "Add a Pic";
+                                               if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
+                                                       switchit = "Tambah Gambar / Video";
+                                               }
+                                               break;
+
+                                       case '/ajax/composerx/attachment/question/':
+                                               switchit = "Query";
+                                               if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
+                                                       switchit = "Tanya Soalan";
+                                               }
+                                               break;
+
+                                       case '/ajax/composerx/attachment/group/file/':
+                                       case '/ajax/composerx/attachment/group/filedropbox/':
+                                               if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
+                                                       switchit = "Muat Naik Fail";
+                                               }
+                                               break;
+
+                                       default:
+                                               break;
+                               }
+                               if (!switchit) {
+                                       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) {
+                                               switchit = "Adventure, Milestone +";
+                                               //if (attachment.id == 'offerEventAndOthersButton') {
+                                               if (attachment.textContent.toLowerCase().indexOf('offer') != -1) {
+                                                       switchit = "Offer, Adventure +";
+                                               }
+                                       }
+                               }
+
+                               if (switchit) {
+                                       var done = false;
+                                       var inner = attachment.querySelector('._2-s, .-cx-PUBLIC-fbTimelineComposerAttachment__label');
+                                       if (!inner) {
+                                               inner = attachment.querySelector('._51z7, .-cx-PUBLIC-fbComposerAttachment__linktext');
+                                               if (!inner) {
+                                                       // page timelines use ".attachmentName" and are wacky, there are actually two copies of the <div> that show/hide
+                                                       $$(attachment, '.attachmentName', function(inner) {
+                                                               k._changeComposerAttachment_inner(inner, switchit);
+                                                               done = true;
+                                                       });
+
+                                                       if (!done) {
+                                                               inner = attachment;
+                                                       }
+                                               }
+                                       }
+
+                                       if (!done) {
+                                               k._changeComposerAttachment_inner(inner, switchit);
+                                       }
+                               }
+
+                               attachment.setAttribute('data-ponyhoof-ponified', 1);
+                       });
+               };
+
+               k._changeComposerAttachment_inner = function(inner, switchit) {
+                       var stopit = false;
+                       loopChildText(inner, function(child) {
+                               if (stopit) {
+                                       return;
+                               }
+                               if (child.nodeType == 3) {
+                                       child.textContent = switchit;
+                                       stopit = true;
+                               }
+                       });
+               };
+
+               k._changeComposer_insertReadme = function(insertBefore) {
+                       var n = d.createElement('iframe');
+                       n.className = 'showOnceInteracted ponyhoof_page_readme _4- -cx-PRIVATE-fbComposer__showonceinteracted';
+                       n.scrolling = 'auto';
+                       n.frameborder = '0';
+                       n.allowtransparency = 'true';
+                       n.src = PONYHOOF_README;
+                       insertBefore.parentNode.insertBefore(n, insertBefore);
+               };
+
+               k._changeComposer_fixGroup = function(target) {
+                       if (hasClass(target.parentNode, '_55d0') || hasClass(target.parentNode, '.-cx-PUBLIC-fbComposer__content')) {
+                               var pageid = target.querySelector('input[name="xhpc_targetid"]');
+                               if (!pageid) {
+                                       return;
+                               }
+                               pageid = pageid.value;
+
+                               // domChangeTextbox will not work as these <textarea>s already has "data-ponyhoof-ponified"
+                               var composer = target.querySelector(k.composerSelectors);
+                               if (!composer) {
+                                       return;
+                               }
+
+                               $$(target, k.composerButtonSelectors, function(submit) {
+                                       var malay = false;
+                                       var lang = CURRENTLANG;
+                                       if (k.composerSpecialPages[pageid] && k.composerSpecialPages[pageid].malay) {
+                                               malay = true;
+                                               lang = LANG['ms_MY'];
+                                       }
+
+                                       if (!k.composerExclude.test(composer.value) && k.composerPonies.test(composer.value)) {
+                                               if (composer.value.toUpperCase() == composer.value) {
+                                                       k.changeButtonText(submit, lang.fb_composer_ponies_caps);
+                                               } else {
+                                                       k.changeButtonText(submit, lang.fb_composer_ponies);
+                                               }
+                                       } else if (malay) {
+                                               k.changeButtonText(submit, "Kirim");
+                                       }
+                               });
+                       }
+               };
+
+               k.fbDockChatBuddylistNub = function(target) {
+                       if (target.parentNode && target.parentNode.parentNode && target.parentNode.parentNode.getAttribute && target.parentNode.parentNode.getAttribute('id') == 'fbDockChatBuddylistNub' && hasClass(target, 'label')) {
+                               k._fbDockChatBuddylistNub_change(target);
+                               return true;
+                       }
+                       // first loading
+                       var nub = target.querySelector('#fbDockChatBuddylistNub .label');
+                       if (nub) {
+                               k._fbDockChatBuddylistNub_change(nub);
+                       }
+                       return false;
+               };
+
+               k._fbDockChatBuddylistNub_change = function(target) {
+                       if (target.childNodes && target.childNodes.length && target.childNodes[0] && target.childNodes[0].nodeType == TEXT_NODE) {
+                               var replaced = target.childNodes[0].textContent.replace(/Chat/, "Whinny");
+                               if (target.childNodes[0].textContent != replaced) {
+                                       addClass(target, 'ponyhoof_chatLabel_ponified');
+                                       target.childNodes[0].textContent = replaced;
+                               }
+                       }
+               };
+
+               k.pokesDashboard = function(target) {
+                       if (target.getAttribute && target.getAttribute('id') && target.getAttribute('id').indexOf('poke_') == 0) {
+                               k._pokesDashboard_item(target);
+                               return true;
+                       }
+
+                       $$(target, '.pokesDashboard > .objectListItem', k._pokesDashboard_item);
+
+                       if (hasClass(target, 'highlight')) {
+                               var t = target.textContent;
+                               t = t.replace(/You poked /, 'You nuzzled ');
+                               if (target.textContent != t) {
+                                       target.textContent = t;
+                               }
+                               return true;
+                       }
+
+                       k._pokesDashboard_pokeLink(target);
+
+                       return false;
+               };
+
+               k._pokesDashboard_item = function(item) {
+                       var header = item.getElementsByClassName('pokeHeader');
+                       if (!header || !header.length) {
+                               return;
+                       }
+                       header = header[0];
+
+                       var t = header.innerHTML;
+                       t = t.replace(/ has poked you\./, ' has nuzzled you.');
+                       if (header.innerHTML != t) {
+                               header.innerHTML = t;
+                       }
+
+                       k._pokesDashboard_pokeLink(item);
+               };
+
+               k._pokesDashboard_pokeLink = function(target) {
+                       $$(target, 'a[ajaxify^="/ajax/pokes/poke_inline.php"]', function(poke) {
+                               var text = "Nuzzle";
+                               if (poke.getAttribute('ajaxify').indexOf('pokeback=1') != -1) { // http://fb.com/406911932763192
+                                       text = "Nuzzle Back";
+                               }
+
+                               if (poke.childNodes && poke.childNodes.length && poke.childNodes[1]) {
+                                       poke.childNodes[1].textContent = text;
+                                       return;
+                               }
+
+                               var stop = false;
+                               loopChildText(poke, function(child) {
+                                       if (stop) {
+                                               return;
+                                       }
+                                       if (child.nodeType == TEXT_NODE) {
+                                               child.textContent = text;
+                                               stop = true;
+                                       }
+                               });
+                       });
+               };
+
+               k.notification = function(dom) {
+                       domReplaceFunc(dom.target, 'notification', '.notification', function(ele) {
+                               k._notification_change(ele, '.info', 'metadata', 'blueName');
+                       });
+               };
+
+               k.notification_itemClass = ['_33c', '-cx-PRIVATE-fbNotificationJewelItem__item'];
+               k.notification_textClass = ['_4l_v', '-cx-PRIVATE-fbNotificationJewelItem__text'];
+               k.notification_metadataClass = ['_33f', '-cx-PRIVATE-fbNotificationJewelItem__metadata'];
+               k._notification_react = function(ele) {
+                       for (var i = 0; i <= 1; i += 1) {
+                               if (hasClass(ele, k.notification_itemClass[i])) {
+                                       k._notification_change(ele, '.'+k.notification_textClass[i]+' > span', k.notification_metadataClass[i], 'fwb');
+                                       return true;
+                               }
+                       }
+                       return false;
+               };
+
+               k._notification_change = function(ele, info, metadata, bold) {
+                       var info = ele.querySelector(info);
+                       if (!info) {
+                               return;
+                       }
+                       if (!info.childNodes || !info.childNodes.length) {
+                               return;
+                       }
+
+                       for (var i = 0, len = info.childNodes.length; i < len; i += 1) {
+                               var node = info.childNodes[i];
+                               if (hasClass(node, metadata) || hasClass(node, bold)) {
+                                       continue;
+                               }
+
+                               var text = node.textContent;
+                               if (text.indexOf('"') != -1) {
+                                       var finalText = k.textNotification(text.substring(0, text.indexOf('"')));
+                                       finalText += text.substring(text.indexOf('"'), text.length);
+                               } else {
+                                       var finalText = k.textNotification(text);
+                               }
+
+                               if (node.textContent != finalText) {
+                                       node.textContent = finalText;
+                               }
+
+                               if (text.indexOf('"') != -1) {
+                                       break;
+                               }
+                       }
+               };
+
+               k.menuPrivacyOnlyAjaxify = [
+                       // when posting
+                        '%22value%22%3A%2280%22' // Everyone
+                       ,'%22value%22%3A%2250%22' // Friends of Friends
+                       ,'%22value%22%3A%2240%22' // Friends
+                       ,'%22value%22%3A%22127%22' // Friends except Acquaintances
+                       ,'%22value%22%3A%2210%22' // Only Me
+
+                       // https://www.facebook.com/settings?tab=timeline&section=posting&view
+                       ,'%22value%22%3A40'
+                       ,'%22value%22%3A10'
+               ];
+               k._processMenuXOldWidthDiff = 0;
+               k.menuItems = function(dom) {
+                       var processMenuX = false;
+                       var hasScrollableArea = false;
+                       k._processMenuXOldWidthDiff = 0;
+                       domReplaceFunc(dom.target, 'uiMenuItem', '.uiMenuItem, ._54ni, .-cx-PUBLIC-abstractMenuItem__root, .ufb-menu-item', function(ele) {
+                               if (hasClass(ele, 'ponyhoof_fbmenuitem')) {
+                                       return;
+                               }
+                               addClass(ele, 'ponyhoof_fbmenuitem');
+
+                               // pages on share dialog
+                               if (hasClass(ele, '_90z') || hasClass(ele, '-cx-PRIVATE-fbShareModePage__smalliconcontainer')) {
+                                       return;
+                               }
+
+                               // lists/groups on Invite Friends dialogs
+                               var listendpoint = ele.getAttribute('data-listendpoint');
+                               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) {
+                                       return;
+                               }
+
+                               var replacer = menuTitles;
+                               if (hasClass(ele, 'fbPrivacyAudienceSelectorOption')) {
+                                       replacer = menuPrivacyOnlyTitles;
+
+                                       // ensure that only FB-provided options get changed
+                                       var itemAnchor = ele.getElementsByClassName('itemAnchor');
+                                       if (itemAnchor.length) {
+                                               var ajaxify = itemAnchor[0].getAttribute('ajaxify');
+                                               // Sometimes ajaxify is missing (legacy edit video)
+                                               if (ajaxify) {
+                                                       var _menuPrivacyOnlyOk = false;
+                                                       for (var i = 0, len = k.menuPrivacyOnlyAjaxify.length; i < len; i += 1) {
+                                                               if (ajaxify.indexOf(k.menuPrivacyOnlyAjaxify[i]) != -1) {
+                                                                       _menuPrivacyOnlyOk = true;
+                                                                       break;
+                                                               }
+                                                       }
+                                                       if (!_menuPrivacyOnlyOk) {
+                                                               return;
+                                                       }
+                                               }
+                                       }
+                               }
+
+                               var label = ele.querySelector('.itemLabel, ._54nh, .-cx-PUBLIC-abstractMenuItem__label, .ufb-menu-item-label');
+                               if (label) {
+                                       //if (label.childNodes.length == 1) {
+                                       // timeline post has 2
+                                       var io = label.getElementsByTagName('span');
+                                       if (io.length) {
+                                               if (!hasClass(io[0], 'hidden_elem')) {
+                                                       label = io[0];
+                                               }
+                                       }
+
+                                       var orig = '';
+                                       var replaced = '';
+                                       //var oldWidthBody = '';
+                                       var oldLabelWidth = 0;
+                                       ele.setAttribute('data-ponyhoof-menuitem-orig', ele.textContent);
+                                       loopChildText(label, function(child) {
+                                               if (child.nodeType == 3) {
+                                                       var t = child.textContent;
+                                                       orig += t+' ';
+                                                       t = replaceText(replacer, t);
+                                                       if (child.textContent != t) {
+                                                               if (!hasScrollableArea && (ele.parentNode && ele.parentNode.parentNode && hasClass(ele.parentNode.parentNode, 'uiScrollableAreaContent'))) {
+                                                                       hasScrollableArea = true;
+                                                               }
+                                                               if (hasScrollableArea) {
+                                                                       //oldWidthBody = ele.parentNode.parentNode.parentNode.style.width;
+                                                                       //ele.parentNode.parentNode.parentNode.style.width = 'auto';
+                                                                       label.style.display = 'inline-block';
+                                                                       //var oldWidth = label.offsetWidth;
+                                                                       if (!oldLabelWidth) {
+                                                                               //oldLabelWidth = oldWidth;
+                                                                               oldLabelWidth = label.offsetWidth;
+                                                                       }
+                                                               }
+                                                               child.textContent = t;
+                                                       }
+                                                       replaced += t+' ';
+                                               }
+                                       });
+                                       //if (hasScrollableArea) {
+                                               //ele.parentNode.parentNode.parentNode.style.width = oldWidthBody;
+                                       //}
+
+                                       orig = orig.substr(0, orig.length-1);
+                                       replaced = replaced.substr(0, replaced.length-1);
+                                       ele.setAttribute('data-ponyhoof-menuitem-text', replaced);
+                                       ele.setAttribute('data-label', replaced); // technically, this is only used for .uiMenuItem
+
+                                       if (orig != replaced) {
+                                               if (hasClass(ele, '_54ni') || hasClass(ele, '-cx-PUBLIC-abstractMenuItem__root')) {
+                                                       if (hasScrollableArea && oldLabelWidth) {
+                                                               var newWidth = label.offsetWidth;
+                                                               if (newWidth > oldLabelWidth) {
+                                                                       k._processMenuXOldWidthDiff = Math.max(newWidth - oldLabelWidth, 0);
+                                                                       processMenuX = true;
+                                                               }
+                                                       } else {
+                                                               processMenuX = true;
+                                                       }
+                                               }
+                                       }
+                                       if (hasScrollableArea) {
+                                               label.style.display = '';
+                                       }
+                               }
+                       });
+
+                       if (processMenuX) {
+                               if (hasClass(dom.target, 'uiContextualLayerPositioner')) {
+                                       k._menuItems_processMenuX(dom.target);
+                                       return;
+                               }
+
+                               k.getParent(dom.target, function(parent) {
+                                       return hasClass(parent, 'uiContextualLayerPositioner');
+                               }, k._menuItems_processMenuX);
+                       }
+               };
+               k._menuItems_processMenuX = function(layer) {
+                       if (!layer) {
+                               return;
+                       }
+
+                       var ownerid = layer.getAttribute('data-ownerid');
+                       if (!ownerid) {
+                               return;
+                       }
+                       ownerid = $(ownerid);
+                       if (!ownerid) {
+                               return;
+                       }
+                       
+                       var menu = layer.querySelector('._54nq, .-cx-PUBLIC-abstractMenu__wrapper');
+                       if (!menu) {
+                               return;
+                       }
+
+                       if (k._processMenuXOldWidthDiff) {
+                               var uiScrollableArea = layer.getElementsByClassName('uiScrollableArea');
+                               var uiScrollableAreaBody = layer.getElementsByClassName('uiScrollableAreaBody');
+                               if (uiScrollableArea && uiScrollableAreaBody) {
+                                       uiScrollableArea = uiScrollableArea[0];
+                                       uiScrollableAreaBody = uiScrollableAreaBody[0];
+
+                                       uiScrollableArea.style.width = (parseInt(uiScrollableArea.style.width)+k._processMenuXOldWidthDiff)+'px';
+                                       uiScrollableAreaBody.style.width = (parseInt(uiScrollableAreaBody.style.width)+k._processMenuXOldWidthDiff)+'px';
+                               }
+                       }
+
+                       var border = layer.querySelector('._54hx, .-cx-PUBLIC-abstractMenu__shortborder');
+                       if (!border) {
+                               return;
+                       }
+                       border.style.width = (Math.max((menu.offsetWidth - ownerid.offsetWidth), 0))+'px';
+               };
+
+               k.fbRemindersStory = function(target) {
+                       $$(target, '.fbRemindersStory', function(item) {
+                               var inner = item.querySelector('._42ef > .fcg, .-cx-PRIVATE-uiFlexibleBlock__flexiblecontent > .fcg');
+                               if (!inner) {
+                                       return;
+                               }
+
+                               loopChildText(inner, function(child) {
+                                       if (child.nodeType == TEXT_NODE) {
+                                               var t = child.textContent;
+                                               t = t.replace(/\bpoked you\b/, "nuzzled you");
+                                               if (child.textContent != t) {
+                                                       child.textContent = t;
+                                               }
+                                       } else {
+                                               if (hasClass(child, 'fbRemindersTitle')) {
+                                                       var t = child.innerHTML;
+                                                       t = t.replace(/([0-9]+?) events/, "$1 adventures")
+                                                       if (child.innerHTML != t) {
+                                                               child.innerHTML = t;
+                                                       }
+                                               }
+                                       }
+                               });
+                       });
+               };
+
+               k.flyoutLikeForm = function(target) {
+                       var result = k._flyoutLikeForm(target, 'groupsMemberFlyoutLikeForm', 'unlike');
+                       if (!result) {
+                               result = k._flyoutLikeForm(target, 'fbEventMemberLike', 'liked');
+                       }
+                       return result;
+               };
+
+               k._flyoutLikeForm = function(target, className, forminput) {
+                       domReplaceFunc(target, className, '.'+className, function(ele) {
+                               if (!ele.elements[forminput]) {
+                                       return;
+                               }
+
+                               var isLike = true;
+                               if (ele.elements[forminput].value == 1) {
+                                       isLike = false;
+                               }
+
+                               var submit = ele.querySelector('input[type="submit"]');
+                               if (!submit) {
+                                       return;
+                               }
+                               if (isLike) {
+                                       submit.value = capitaliseFirstLetter(CURRENTSTACK['like']);
+                               } else {
+                                       submit.value = capitaliseFirstLetter(CURRENTSTACK['unlike']);
+                               }
+                       });
+
+                       if (hasClass(target, className)) {
+                               return true;
+                       }
+                       return false;
+               };
+
+               k.pluginButton = function(target) {
+                       if (!hasClass(d.body, 'plugin')) {
+                               return;
+                       }
+
+                       //var root = target.getElementsByClassName('pluginConnectButtonLayoutRoot');
+                       var root = target.getElementsByClassName('pluginSkinLight');
+                       if (!root.length) {
+                               return;
+                       }
+                       root = root[0];
+
+                       domReplaceFunc(root, '', '.pluginButton', function(ele) {
+                               var div = ele.getElementsByTagName('div');
+                               if (div.length) {
+                                       ele = div[0];
+                               }
+
+                               // <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>
+                               var stop = false;
+                               loopChildText(ele, function(child) {
+                                       if (stop) {
+                                               return;
+                                       }
+                                       if (child.tagName.toUpperCase() == 'SPAN') {
+                                               if (child.innerHTML == "Like") {
+                                                       child.innerHTML = capitaliseFirstLetter(CURRENTSTACK.like);
+                                                       stop = true;
+                                               }
+                                       }
+                               });
+                       });
+
+                       domReplaceFunc(root, '', '.uiIconText', function(ele) {
+                               // <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>
+                               loopChildText(ele, function(child) {
+                                       loopChildText(child, function(inner) {
+                                               if (inner.nodeType === TEXT_NODE) {
+                                                       var t = k.likeSentence(inner.textContent);
+                                                       t = t.replace(/\bfriends\b/g, CURRENTSTACK['friends_logic']); // Be the first of your friends.
+                                                       if (inner.textContent != t) {
+                                                               inner.textContent = t;
+                                                       }
+                                               }
+                                       });
+                               });
+                       });
+
+                       // likebox
+                       $$(root, '.uiGrid .pts > .uiGrid .pls > div > span', function(ele) {
+                               var t = k.likeSentence(ele.textContent);
+                               if (ele.textContent != t) {
+                                       ele.textContent = t;
+                               }
+                       });
+               };
+
+               k.ticker = function(dom) {
+                       domReplaceFunc(dom.target, 'fbFeedTickerStory', '.fbFeedTickerStory', function(ele) {
+                               var div = ele.getElementsByClassName('uiStreamMessage');
+                               if (div.length) {
+                                       div = div[0];
+
+                                       // Ticker messages are really inconsistent
+                                       // <span class="passiveName">Friend</span>  brohoofs <span class="token">Page</span>'s <span class="token">photo</span>.
+                                       // <span class="passiveName">Friend</span> added a new pony pic.
+                                       // <span class="passiveName">Friend</span>  brohoofs <span class="token">Page</span>'s <span class="token">video</span> Title. // http://fb.com/10200537039965966
+                                       var continueTextNodes = true;
+                                       for (var i = 0, len = div.childNodes.length; i < len; i += 1) {
+                                               var node = div.childNodes[i];
+                                               if (node.nodeType == TEXT_NODE) {
+                                                       if (!continueTextNodes) {
+                                                               continue;
+                                                       }
+
+                                                       var t = node.textContent;
+
+                                                       var boundary = '';
+                                                       var haltOnBoundary = false;
+                                                       if (t.indexOf('"') != -1) {
+                                                               boundary = '"';
+                                                               haltOnBoundary = true;
+                                                       } else if (t.indexOf('\'s') != -1) {
+                                                               boundary = '\'s';
+                                                               continueTextNodes = false;
+                                                       }
+
+                                                       if (boundary) {
+                                                               var finalText = k.textNotification(t.substring(0, t.indexOf(boundary)));
+                                                               finalText += t.substring(t.indexOf(boundary), t.length);
+                                                       } else {
+                                                               var finalText = k.textNotification(t);
+                                                       }
+                                                       //t = t.replace(/\blikes\b/, " "+CURRENTSTACK['likes_past']);
+                                                       //t = t.replace(/\blike\b/, " "+CURRENTSTACK['like_past']);
+                                                       if (node.textContent != finalText) {
+                                                               node.textContent = finalText;
+                                                       }
+
+                                                       if (boundary && haltOnBoundary) {
+                                                               break;
+                                                       }
+                                               } else {
+                                                       // It's too risky changing legit page names, so we are doing this in isolated cases
+                                                       if (hasClass(node, 'token')) {
+                                                               var list = [
+                                                                        ['photo', 'pony pic']
+                                                                       ,['a photo', 'a pony pic']
+                                                                       ,['wall', 'journal']
+                                                               ];
+                                                               var t = replaceText(list, node.textContent);
+                                                               if (node.textContent != t) {
+                                                                       node.textContent = t;
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               }
+                       });
+                       if (hasClass(dom.target, 'fbFeedTickerStory')) {
+                               return true;
+                       }
+                       return false;
+               };
+
+               k.beepNotification = function(dom) {
+                       warn("domNodeHandler.beepNotification() is deprecated");
+                       return false;
+               };
+
+               // XYZ commented on your Wall post: "I like it"
+               k._beepNotification_condition_classic = function(node, gt) {
+                       // <div class="UIBeep_Title"><span class="blueName">XYZ</span> likes your comment: "12"</div>
+                       // <div class="UIBeep_Title"><span class="blueName">XYZ</span>  brohoofs your friendship letter: "12"</div>
+                       if (node.nodeType == 3) {
+                               return true;
+                       }
+                       return false;
+               };
+               k._beepNotification_condition_react = function(node, gt) {
+                       // <span id=".reactRoot[37].[0]{NUMBER}.0.[1].0.[1].0.0.[0]"><span class="fwb" id=".reactRoot[37].[0]{NUMBER}.0.[1].0.[1].0.0.[0].[0]"><span id=".reactRoot[37].[0]{NUMBER}.0.[1].0.[1].0.0.[0].[0].0">XYZ</span></span><span id=".reactRoot[37].[0]{NUMBER}.0.[1].0.[1].0.0.[0].[1]"> also commented on a </span><span class="fwb" id=".reactRoot[37].[0]{NUMBER}.0.[1].0.[1].0.0.[0].[2]"><span id=".reactRoot[37].[0]{NUMBER}.0.[1].0.[1].0.0.[0].[2].0">photo</span></span><span id=".reactRoot[37].[0]{NUMBER}.0.[1].0.[1].0.0.[0].[3]"> in </span><span class="fwb" id=".reactRoot[37].[0]{NUMBER}.0.[1].0.[1].0.0.[0].[4]"><span id=".reactRoot[37].[0]{NUMBER}.0.[1].0.[1].0.0.[0].[4].0">GROUP NAME</span></span><span id=".reactRoot[37].[0]{NUMBER}.0.[1].0.[1].0.0.[0].[5]">: "What?"</span></span>
+
+                       // **XYZ** posted on **Ponyhoof**'s **timeline**: "XYZ"
+                       //if (hasClass(node, 'fwb')) {
+                       //      return false;
+                       //}
+                       return true;
+               };
+
+               k._beepNotification_change = function(ele, info, condition) {
+                       if (!info) {
+                               return;
+                       }
+
+                       var gt = JSON.parse(ele.getAttribute('data-gt'));
+                       ele.setAttribute('data-ponyhoof-beeper-orig', info.textContent);
+                       for (var i = 0, len = info.childNodes.length; i < len; i += 1) {
+                               var node = info.childNodes[i];
+                               if (condition(node, gt)) {
+                                       if (node.nodeType == 3) {
+                                               var text = node.textContent;
+                                       } else {
+                                               var inner = node.getElementsByTagName('span');
+                                               if (inner.length) {
+                                                       // reactRoot .fwb
+                                                       node = inner[0];
+                                               }
+                                               var text = node.innerHTML;
+                                       }
+
+                                       if (text.indexOf('"') != -1) {
+                                               var finalText = k.textNotification(text.substring(0, text.indexOf('"')));
+                                               finalText += text.substring(text.indexOf('"'), text.length);
+                                       } else {
+                                               var finalText = k.textNotification(text);
+                                       }
+
+                                       if (node.nodeType == 3) {
+                                               if (node.textContent != finalText) {
+                                                       node.textContent = finalText;
+                                               }
+                                       } else {
+                                               if (node.innerHTML != finalText) {
+                                                       node.innerHTML = finalText;
+                                               }
+                                       }
+
+                                       if (text.indexOf('"') != -1) {
+                                               break;
+                                       }
+                               }
+                       }
+                       ele.setAttribute('data-ponyhoof-beeper-message', info.textContent);
+                       
+                       if (userSettings.sounds) {
+                               var file = '';
+                               if (SOUNDS[userSettings.soundsFile]) {
+                                       file = userSettings.soundsFile;
+                               }
+
+                               if (!file || file == 'AUTO') {
+                                       file = '_sound/defaultNotification';
+
+                                       var data = convertCodeToData(REALPONY);
+                                       if (data.soundNotif) {
+                                               file = data.soundNotif;
+                                       }
+                               }
+
+                               if (userSettings.soundsNotifTypeBlacklist) {
+                                       var current = userSettings.soundsNotifTypeBlacklist.split('|');
+
+                                       if (current.indexOf(gt.notif_type) != -1) {
+                                               return;
+                                       }
+                               }
+
+                               try {
+                                       var finalfile = THEMEURL+file+'.EXT';
+                                       if (gt.notif_type == 'poke' && CURRENTSTACK.stack == 'pony') {
+                                               finalfile = THEMEURL+'_sound/pokeSound.EXT';
+                                       }
+
+                                       var ps = initPonySound('notif', finalfile);
+                                       ps.wait = 15;
+                                       ps.play();
+                               } catch (e) {}
+                       }
+               };
+
+               k.insightsCountryData = [
+                        ["United States of America", "United States of Amareica"]
+                       ,["Malaysia", "Marelaysia"]
+                       ,["Mexico", "Mexicolt"]
+                       ,["New Zealand", "Neigh Zealand"]
+                       ,["Philippines", "Fillypines"]
+                       ,["Singapore", "Singapony"]
+                       ,["Singapore, Singapore", "Singapony"]
+               ];
+               k.insightsCountry = function(dom) {
+                       domReplaceFunc(dom.target, 'breakdown-list-table', '.breakdown-list-table', function(ele) {
+                               if (ele.getAttribute('data-ponyhoof-ponified')) {
+                                       return;
+                               }
+                               ele.setAttribute('data-ponyhoof-ponified', 1);
+                               $$(ele, '.breakdown-key .ufb-text-content', function(country) {
+                                       country.textContent = replaceText(k.insightsCountryData, country.textContent);
+                               });
+                       });
+               };
+
+               k.timelineMutualLikes = function(target) {
+                       $$(target, '.fbStreamTimelineFavStory', function(root) {
+                               $$(root, '.fbStreamTimelineFavInfoContainer', function(ele) {
+                                       var done = false;
+                                       loopChildText(ele, function(child) {
+                                               if (done) {
+                                                       return;
+                                               }
+                                               if (child.nodeType == TEXT_NODE) {
+                                                       var t = k.textStandard(child.textContent);
+                                                       if (child.textContent != t) {
+                                                               child.textContent = t;
+                                                               done = true;
+                                                       }
+                                               }
+                                       });
+                               });
+
+                               $$(root, '.fbStreamTimelineFavFriendContainer > .friendText > .fwn', function(ele) {
+                                       loopChildText(ele, function(child) {
+                                               if (child.nodeType == ELEMENT_NODE) {
+                                                       if (!child.href || child.href.indexOf('/browse/users/') == -1) {
+                                                               return;
+                                                       }
+                                               }
+                                               var t = k.textStandard(child.textContent);
+                                               if (child.textContent != t) {
+                                                       child.textContent = t;
+                                               }
+                                       });
+                               });
+                       });
+               };
+
+               // http://fb.com/406714556116263
+               // http://fb.com/411361928984859
+               k.videoStageContainer = function(target) {
+                       if (hasClass(target, 'videoStageContainer')) {
+                               addClass(k.photos_snowlift, 'ponyhoof_snowlift_video');
+                       } else if (hasClass(target, 'spotlight')) {
+                               removeClass(k.photos_snowlift, 'ponyhoof_snowlift_video');
+                       }
+               };
+
+               k._dialog_playSound = function(title, outer) {
+                       if (!title) {
+                               return;
+                       }
+                       var lowercase = title.toLowerCase();
+                       for (var i = 0, len = dialogDerpTitles.length; i < len; i += 1) {
+                               if (dialogDerpTitles[i].toLowerCase() == lowercase) {
+                                       if (outer) {
+                                               addClass(outer, 'ponyhoof_fbdialog_derp');
+                                       }
+
+                                       if (CURRENTSTACK.stack == 'pony' && userSettings.sounds && !isPageHidden()) {
+                                               var ps = initPonySound('ijustdontknowwhatwentwrong', THEMEURL+'_sound/ijustdontknowwhatwentwrong.EXT');
+                                               ps.wait = 5;
+                                               ps.play();
+                                               break;
+                                       }
+                               }
+                       }
+               };
+
+               k.ponyhoofPageOptions = function(dom) {
+                       if (!$('pagelet_timeline_page_actions')) {
+                               return;
+                       }
+                       if ($('ponyhoof_footer_options')) {
+                               return;
+                       }
+
+                       var selector = dom.target.querySelector('#pagelet_timeline_page_actions .fbTimelineActionSelector');
+                       if (!selector) {
+                               return;
+                       }
+                       var menu = selector.getElementsByClassName('uiMenuInner');
+                       if (!menu.length) {
+                               return;
+                       }
+                       menu = menu[0];
+                       var whatpage = menu.querySelector('#fbpage_share_action a');
+                       if (!whatpage) {
+                               return;
+                       }
+                       if (whatpage.getAttribute('href').indexOf('p[]='+PONYHOOF_PAGE) != -1) {
+                               var button = selector.getElementsByClassName('fbTimelineActionSelectorButton');
+                               if (!button.length) {
+                                       return;
+                               }
+                               button = button[0];
+
+                               var sep = d.createElement('li');
+                               sep.className = 'uiMenuSeparator';
+
+                               var a = d.createElement('a');
+                               a.className = 'itemAnchor';
+                               a.setAttribute('role', 'menuitem');
+                               a.setAttribute('tabindex', '0');
+                               a.href = '#';
+                               a.id = "ponyhoof_footer_options";
+                               a.innerHTML = '<span class="itemLabel fsm">'+CURRENTLANG.options_title+'</span>';
+                               a.addEventListener('click', function(e) {
+                                       optionsOpen();
+
+                                       try {
+                                               clickLink(button);
+                                       } catch (ex) {}
+
+                                       e.preventDefault();
+                               }, false);
+                               
+                               var li = d.createElement('li');
+                               li.className = 'uiMenuItem ponyhoof_fbmenuitem';
+                               li.setAttribute('data-label', CURRENTLANG.options_title);
+                               li.setAttribute('data-ponyhoof-menuitem-orig', CURRENTLANG.options_title);
+                               li.setAttribute('data-ponyhoof-menuitem-text', CURRENTLANG.options_title);
+                               li.appendChild(a);
+                               
+                               menu.insertBefore(sep, menu.firstChild);
+                               menu.insertBefore(li, sep);
+                       }
+               };
+
+               k.debug_betaFacebookBaseRewrote = false;
+               k.debug_betaFacebookLinks = function(target) {
+                       if (!k.debug_betaFacebookBaseRewrote) {
+                               contentEval(function(arg) {
+                                       try {
+                                               if (typeof window.requireLazy == 'function') {
+                                                       window.requireLazy(['Env'], function(Env) {
+                                                               Env.www_base = window.location.protocol+'//'+window.location.hostname+'/';
+                                                       });
+                                               }
+                                       } catch (e) {
+                                               if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
+                                                       console.log("Unable to hook to Env");
+                                                       console.dir(e);
+                                               }
+                                       }
+                               }, {"CANLOG":CANLOG});
+                               k.debug_betaFacebookBaseRewrote = true;
+                       }
+                       var links = target.querySelectorAll('a[href^="http://www.facebook.com"], a[href^="https://www.facebook.com"]');
+                       for (var i = 0, len = links.length; i < len; i += 1) {
+                               var link = links[i];
+                               var href = link.href;
+                               href = href.replace(/http\:\/\/www.facebook.com\//, 'http://beta.facebook.com/');
+                               href = href.replace(/https\:\/\/www.facebook.com\//, 'https://beta.facebook.com/');
+
+                               link.href = href;
+                       }
+               };
+
+               // Mutation
+               k.mutateCharacterData = function(mutation) {
+                       var parent = null;
+                       if (mutation.target && mutation.target.parentNode) {
+                               parent = mutation.target.parentNode;
+                               if (parent.tagName.toUpperCase() == 'ABBR') {
+                                       return;
+                               }
+                       }
+
+                       if (userSettings.debug_mutationDebug) {
+                               try {
+                                       console.log('characterData:');
+                                       if (!ISFIREFOX) {
+                                               console.dir(mutation.target);
+                                       }
+                               } catch (e) {}
+                       }
+
+                       k.textNodes({target: mutation.target});
+
+                       if (!parent) {
+                               return;
+                       }
+                       var id = parent.getAttribute(k.REACTATTRNAME);
+                       if (id) {
+                               if (parent.rel == 'dialog') {
+                                       if (parent.getAttribute('ajaxify').indexOf('/ajax/browser/dialog/likes') == 0) {
+                                               k.getParent(parent, function(likesentence) {
+                                                       return hasClass(likesentence, 'UFILikeSentence');
+                                               }, function(likesentence) {
+                                                       if (likesentence) {
+                                                               k._likePostBox(likesentence);
+                                                       }
+                                               });
+                                       }
+                               } else if (hasClass(parent.parentNode, 'UFIPagerLink')) {
+                                       k.ufiPagerLink({target: parent.parentNode.parentNode});
+                               } else if (hasClass(parent, 'ponyhoof_brohoof_button')) {
+                                       k._commentLikeLink(parent);
+                               } else if (parent.nextSibling && hasClass(parent.nextSibling, 'UFIOrderingModeSelectorDownCaret')) {
+                                       k.UFIOrderingMode(parent);
+                               } else {
+                                       if (parent.parentNode && parent.parentNode.parentNode) {
+                                               //if (hasClass(parent.parentNode.parentNode, 'UFIImageBlockContent') || (parent.parentNode.parentNode.parentNode && hasClass(parent.parentNode.parentNode.parentNode, 'UFIImageBlockContent'))) {
+                                               if (hasClass(parent.parentNode.parentNode, 'UFILikeSentenceText') || (parent.parentNode.parentNode.parentNode && hasClass(parent.parentNode.parentNode.parentNode, 'UFILikeSentenceText'))) {
+                                                       // live commenting
+                                                       // You and John brohoof this.
+                                                       // You like this.
+                                                       var ufi = k.getReactUfi(parent);
+                                                       if (ufi) {
+                                                               k.postLike({target: ufi});
+                                                       }
+                                               } else {
+                                                       if (hasClass(parent.parentNode.parentNode, k.notification_textClass[0]) || hasClass(parent.parentNode.parentNode, k.notification_textClass[1])) {
+                                                               // gosh, i dislike this...
+                                                               k.getParent(parent, function(notificationItem) {
+                                                                       return hasClass(notificationItem, k.notification_itemClass[0]) || hasClass(notificationItem, k.notification_itemClass[1]);
+                                                               }, function(notificationItem) {
+                                                                       if (!notificationItem) {
+                                                                               return;
+                                                                       }
+
+                                                                       var i = 0;
+                                                                       if (hasClass(notificationItem, k.notification_itemClass[1])) {
+                                                                               i = 1;
+                                                                       }
+
+                                                                       k._notification_change(notificationItem, '.'+k.notification_textClass[i]+' > span', k.notification_metadataClass[i], 'fwb');
+                                                               });
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+               };
+
+               k.mutateAttributes = function(mutation) {
+                       //if (mutation.attributeName.indexOf('data-ponyhoof-') == 0) {
+                       //      return;
+                       //}
+                       var target = mutation.target;
+                       if (mutation.attributeName == 'title') {
+                               if (target.title == target.getAttribute('data-ponyhoof-title-modified')) {
+                                       return;
+                               }
+                       }
+                       switch (mutation.attributeName) {
+                               case 'title':
+                                       var id = target.getAttribute(k.REACTATTRNAME);
+                                       if (id) {
+                                               if (hasClass(target, 'UFILikeLink')) {
+                                                       if (target.title == '' && mutation.oldValue != '') { // thanks a lot Hover Zoom
+                                                               target.setAttribute('data-ponyhoof-title', mutation.oldValue);
+                                                               target.setAttribute('data-ponyhoof-title-modified', mutation.oldValue);
+                                                       } else {
+                                                               var orig = target.title;
+                                                               var t = orig;
+                                                               t = t.replace(/\bcomment\b/, "friendship letter");
+                                                               t = t.replace(/\bLike this \b/, capitaliseFirstLetter(CURRENTSTACK.like)+' this ');
+                                                               t = t.replace(/\bUnlike this \b/, capitaliseFirstLetter(CURRENTSTACK.unlike)+' this ');
+                                                               t = t.replace(/\bunlike this \b/, CURRENTSTACK.unlike+' this ');
+                                                               t = t.replace(/\bliking this \b/, CURRENTSTACK.liking+' this ');
+
+                                                               if (target.title != t) {
+                                                                       target.title = t;
+                                                               }
+                                                               target.setAttribute('data-ponyhoof-title', orig);
+                                                               target.setAttribute('data-ponyhoof-title-modified', t);
+                                                       }
+                                               }
+                                       }
+                                       break;
+
+                               /*case 'value':
+                                       if (/*(target.parentNode && hasClass(target.parentNode, 'uiButton')) || * /hasClass(target, 'ufb-button-input')) {
+                                               var button = target.parentNode;
+                                               if (button) {
+                                                       var orig = target.value;
+                                                       var replaced = replaceText(buttonTitles, orig);
+                                                       if (/*hasClass(button, 'uiButton') || * /hasClass(button, 'ufb-button')) {
+                                                               if (button.getAttribute('data-hover') != 'tooltip') {
+                                                                       if (orig != replaced) {
+                                                                               if (button.title == '') {
+                                                                                       button.title = orig;
+                                                                               } else {
+                                                                                       if (button.title == button.getAttribute('data-ponyhoof-button-orig')) {
+                                                                                               button.title = orig;
+                                                                                       }
+                                                                               }
+                                                                       } else {
+                                                                               button.title = '';
+                                                                       }
+                                                               }
+                                                               button.setAttribute('data-ponyhoof-button-orig', orig);
+                                                               button.setAttribute('data-ponyhoof-button-text', replaced);
+                                                       }
+                                                       if (orig != replaced) {
+                                                               target.value = replaced;
+                                                       }
+                                               }
+                                       }
+                                       break;*/
+
+                               default:
+                                       break;
+                       }
+               };
+
+               // Utilities
+               k.getParent = function(ele, iffunc, func) {
+                       var outer = ele.parentNode;
+                       while (outer) {
+                               if (iffunc(outer)) {
+                                       break;
+                               }
+                               outer = outer.parentNode;
+                       }
+                       
+                       func(outer);
+               };
+
+               k.changeButtonText = function(button, t) {
+                       if (button.tagName.toUpperCase() == 'INPUT') {
+                               button.value = t;
+                       } else {
+                               button.innerHTML = t;
+                       }
+               };
+
+               // Delays and let Facebook finish changing the DOM
+               // Note that this shouldn't be a problem when MutationObserver is used full-time
+               k.delayIU = function(func, delay) {
+                       var delay = delay || 10;
+
+                       if (USINGMUTATION) {
+                               func();
+                               return;
+                       }
+
+                       w.setTimeout(function() {
+                               var iu = INTERNALUPDATE;
+                               INTERNALUPDATE = true;
+                               func();
+                               INTERNALUPDATE = iu;
+                       }, delay);
+               };
+
+               k.getReactUfi = function(ele) {
+                       // .reactRoot[3].[1][0].0.[1].0.0.[2]
+                       var finalid = k.getReactId(ele);
+
+                       var ufi = d.querySelector('div['+k.REACTATTRNAME+'=".r['+finalid+']"]');
+                       if (ufi && hasClass(ufi, 'UFIList')) {
+                               return ufi;
+                       }
+
+                       // Rollback to old method
+                       k.getParent(ele, function(ufiitem) {
+                               return hasClass(ufiitem, 'UFIList');
+                       }, function(ufiitem) {
+                               ufi = ufiitem;
+                       });
+                       return ufi;
+               };
+
+               k.getReactCommentComponent = function(ele) {
+                       // .reactRoot[3].[1][2][1]{comment105273202993369_7901}.0.[1].0.[1].0.[1].[2]
+                       // .reactRoot[1].:1:1:1:comment558202387555478_1973546.:0.:1.:0.:1.:0
+                       var id = ele.getAttribute(k.REACTATTRNAME);
+                       if (!id) {
+                               return false;
+                       }
+                       var open = id.indexOf('{comment');
+                       var close = '}';
+                       var closeCount = 1;
+                       if (open == -1) {
+                               open = id.indexOf(':comment');
+                               if (open == -1) {
+                                       return false;
+                               }
+                               close = '.:';
+                               closeCount = 0;
+                       }
+                       var subEnd = id.substring(open, id.length).indexOf(close);
+                       var component = id.substring(0, open+subEnd+closeCount);
+
+                       return component;
+               };
+
+               k.getReactComment = function(ele) {
+                       var component = k.getReactCommentComponent(ele);
+
+                       var comment = d.querySelector('div['+k.REACTATTRNAME+'="'+component+'"]');
+                       if (comment && hasClass(comment, 'UFIComment')) {
+                               return comment;
+                       }
+
+                       // Rollback to old method
+                       k.getParent(ele, function(ufiitem) {
+                               return hasClass(ufiitem, 'UFIComment');
+                       }, function(ufiitem) {
+                               comment = ufiitem;
+                       });
+                       return comment;
+               };
+
+               k.getTrackingNode = function(ele) {
+                       var trackingNode = ele.getAttribute('data-ft');
+                       if (trackingNode) {
+                               try {
+                                       trackingNode = JSON.parse(trackingNode);
+                                       return trackingNode.tn;
+                               } catch (e) {}
+                       }
+                       return false;
+               };
+
+               // Ignore irrelevant tags and some classes
+               k.shouldIgnore = function(dom) {
+                       if (dom.target.nodeType == 8) { // comments
+                               return true;
+                       }
+
+                       if (dom.target.nodeType != 3) {
+                               var tn = dom.target.tagName.toUpperCase();
+                               if (tn == 'SCRIPT' || tn == 'STYLE' || tn == 'LINK' || tn == 'INPUT' || tn == 'BR' || tn == 'META') {
+                                       return true;
+                               }
+                       }
+
+                       if (dom.target.parentNode && /(DOMControl_shadow|highlighterContent|textMetrics)/.test(dom.target.parentNode.className)) {
+                               return true;
+                       }
+
+                       return false;
+               };
+
+               k.dumpConsole = function(dom) {
+                       if (!userSettings.debug_dominserted_console) {
+                               return;
+                       }
+
+                       if (dom.target.nodeType == 8) { // comments
+                               return;
+                       }
+
+                       if (dom.target.nodeType == 3) {
+                               if (dom.target.parentNode && dom.target.parentNode.tagName.toUpperCase() != 'ABBR') {
+                                       if (typeof console !== 'undefined' && console.dir) {
+                                               console.dir(dom.target);
+                                       }
+                               }
+                               return;
+                       }
+
+                       var id = dom.target.getAttribute('id');
+                       if (id && (id.indexOf('bfb_') == 0 || id.indexOf('sfx_') == 0)) {
+                               return;
+                       }
+
+                       var className = dom.target.className;
+                       if (className.indexOf('bfb_') == 0 || className.indexOf('sfx_') == 0) {
+                               return;
+                       }
+
+                       var tagName = dom.target.tagName.toUpperCase();
+                       if (tagName != 'BODY') {
+                               if (typeof console !== 'undefined' && console.log) {
+                                       console.log(dom.target.outerHTML);
+                               }
+                       }
+               };
+
+               k.textBrohoof = function(ele) {
+                       var t = '';
+                       if (ele.nodeType == TEXT_NODE) {
+                               t = ele.textContent;
+                       } else {
+                               t = ele.innerHTML;
+                       }
+                       t = t.replace(/\bpeople\b/g, " "+CURRENTSTACK['people']);
+                       t = t.replace(/\bperson\b/g, " "+CURRENTSTACK['person']);
+                       t = t.replace(/likes this/g, CURRENTSTACK['likes']+" this");
+                       t = t.replace(/like this/g, CURRENTSTACK['like']+" this");
+                       t = t.replace(/Likes/g, capitaliseFirstLetter(CURRENTSTACK['likes'])); // new news feed page likes
+                       t = t.replace(/likes/g, CURRENTSTACK['likes']);
+                       t = t.replace(/like/g, CURRENTSTACK['like']);
+                       t = t.replace(/talking about this/g, "blabbering about this");
+                       t = t.replace(/\bfriends\b/g, CURRENTSTACK['friends_logic']);
+                       t = t.replace(/\bfriend\b/g, CURRENTSTACK['friend_logic']);
+                       if (ele.nodeType == TEXT_NODE) {
+                               if (ele.textContent != t) {
+                                       ele.textContent = t;
+                               }
+                       } else {
+                               if (ele.innerHTML != t) {
+                                       ele.innerHTML = t;
+                               }
+                       }
+               };
+               
+               k.textStandard = function(t) {
+                       t = t.replace(/\bpeople\b/g, " "+CURRENTSTACK['people']);
+                       t = t.replace(/\bfriends\b/g, " "+CURRENTSTACK['friends_logic']);
+                       t = t.replace(/\bfriend\b/g, " "+CURRENTSTACK['friend_logic']);
+                       t = t.replace(/\blikes\b/g, " "+CURRENTSTACK['likes_past']);
+                       t = t.replace(/\blike\b/g, " "+CURRENTSTACK['like_past']);
+                       return t;
+               };
+               
+               k.textNotification = function(t) {
+                       t = t.replace(/\bpeople\b/g, " "+CURRENTSTACK['people']);
+                       t = t.replace(/\(friends\b/g, "("+CURRENTSTACK['friends_logic']);
+                       t = t.replace(/\bfriends\b/g, " "+CURRENTSTACK['friends_logic']);
+                       t = t.replace(/\binvited you to like\b/g, " invited you to "+CURRENTSTACK.like);
+                       t = t.replace(/\blikes\b/g, " "+CURRENTSTACK['likes_past']);
+                       t = t.replace(/\blike\b/g, " "+CURRENTSTACK['like_past']);
+
+                       t = t.replace(/\bcomment\b/g, "friendship letter");
+                       t = t.replace(/\bphoto\b/g, "pony pic");
+                       t = t.replace(/\bphotos\b/g, "pony pics");
+                       t = t.replace(/\bgroup\b/g, "herd");
+                       t = t.replace(/\bevent\b/g, "adventure");
+                       t = t.replace(/\btimeline\b/g, "journal");
+                       t = t.replace(/\bTimeline Review\b/g, "Journal Review");
+                       t = t.replace(/\bTimeline\b/g, "Journal"); // English UK
+                       t = t.replace(/\bnew messages\b/, "new friendship reports");
+                       t = t.replace(/\bnew message\b/, "new friendship report");
+                       t = t.replace(/\bprofile picture\b/g, "journal pony pic");
+                       t = t.replace(/\bfriend request\b/g, "friendship request");
+                       t = t.replace(/\bpoked you/g, " nuzzled you");
+                       return t;
+               };
+       };
+       var _optionsLinkInjected = false;
+       var injectOptionsLink = function() {
+               if (_optionsLinkInjected) {
+                       return;
+               }
+               
+               if ($('logout_form')) {
+                       _optionsLinkInjected = true;
+                       
+                       var optionsLink = d.createElement('a');
+                       optionsLink.href = '#';
+                       optionsLink.id = 'ponyhoof_account_options';
+                       optionsLink.className = 'navSubmenu submenuNav'; // submenuNav is for developers.facebook.com
+                       optionsLink.innerHTML = CURRENTLANG.options_title+" <span class='ponyhoof_hide_if_injected inline'>(Disabled)</span>";
+                       optionsLink.addEventListener('click', function(e) {
+                               optionsOpen();
+                               
+                               try {
+                                       clickLink($('navAccountLink'));
+                               } catch (e) {}
+                               try {
+                                       clickLink($('accountNavArrow'));
+                               } catch (e) {}
+                               
+                               e.preventDefault();
+                       }, false);
+                       
+                       var optionsLinkLi = d.createElement('li');
+                       optionsLinkLi.setAttribute('role', 'menuitem');
+                       optionsLinkLi.appendChild(optionsLink);
+                       
+                       var logout = $('logout_form');
+                       logout.parentNode.parentNode.insertBefore(optionsLinkLi, logout.parentNode);
+               } else {
+                       var pageNav = $('pageNav');
+                       if (!pageNav) {
+                               return;
+                       }
+
+                       var isBusiness = pageNav.querySelector('.navLink[href*="logout.php?h="]');
+                       if (!isBusiness) {
+                               return;
+                       }
+
+                       _optionsLinkInjected = true;
+
+                       var optionsLink = d.createElement('a');
+                       optionsLink.href = '#';
+                       optionsLink.id = 'ponyhoof_account_options';
+                       optionsLink.className = 'navLink';
+                       optionsLink.innerHTML = CURRENTLANG.options_title+" <span class='ponyhoof_hide_if_injected inline'>(Disabled)</span>";
+                       optionsLink.addEventListener('click', function(e) {
+                               optionsOpen();
+                               e.preventDefault();
+                       }, false);
+
+                       var optionsLinkLi = d.createElement('li');
+                       optionsLinkLi.className = 'navItem middleItem';
+                       optionsLinkLi.appendChild(optionsLink);
+                       
+                       pageNav.insertBefore(optionsLinkLi, pageNav.childNodes[0]);
+               }
+       };
+       
+       var domNodeHandlerMain = new domNodeHandler();
+       var mutationObserverMain = null;
+       
+       var ranDOMNodeInserted = false;
+       var runDOMNodeInserted = function() {
+               if (ranDOMNodeInserted) {
+                       return false;
+               }
+               
+               ranDOMNodeInserted = true;
+               
+               onPageReady(function() {
+                       if (d.body) {
+                               DOMNodeInserted({target: d.body});
+                       }
+               });
+
+               if (!userSettings.debug_noMutationObserver) {
+                       try {
+                               var mutationObserver = w.WebKitMutationObserver || w.MutationObserver || false;
+                               if (mutationObserver) {
+                                       var observerOptions = {attributes:true, childList:true, characterData:true, subtree:true, attributeOldValue:true, attributeFilter:['title'/*, 'class', 'value'*/]};
+                                       mutationObserverMain = new mutationObserver(function(mutations) {
+                                               if (INTERNALUPDATE) {
+                                                       return;
+                                               }
+                                               mutationObserverMain.disconnect();
+
+                                               for (var i = 0, len = mutations.length; i < len; i += 1) {
+                                                       switch (mutations[i].type) {
+                                                               case 'characterData':
+                                                                       var iu = INTERNALUPDATE;
+                                                                       INTERNALUPDATE = true;
+
+                                                                       domNodeHandlerMain.mutateCharacterData(mutations[i]);
+
+                                                                       INTERNALUPDATE = iu;
+                                                                       break;
+
+                                                               case 'childList':
+                                                                       for (var j = 0, jlen = mutations[i].addedNodes.length; j < jlen; j += 1) {
+                                                                               if (userSettings.debug_mutationDebug) {
+                                                                                       if (mutations[i].addedNodes[j].parentNode && mutations[i].addedNodes[j].parentNode.tagName != 'ABBR') {
+                                                                                               try {
+                                                                                                       console.log('childList:');
+                                                                                                       if (!ISFIREFOX) {
+                                                                                                               console.dir(mutations[i].addedNodes[j]);
+                                                                                                       } else {
+                                                                                                               if (typeof mutations[i].addedNodes[j].className == 'undefined') {
+                                                                                                                       console.dir(mutations[i].addedNodes[j]);
+                                                                                                               } else {
+                                                                                                                       //console.log('    '+mutations[i].addedNodes[j].className);
+                                                                                                                       //console.log('        '+mutations[i].addedNodes[j].innerHTML);
+                                                                                                               }
+                                                                                                       }
+                                                                                               } catch (e) {}
+                                                                                       }
+                                                                               }
+                                                                               DOMNodeInserted({target: mutations[i].addedNodes[j]});
+                                                                       }
+                                                                       break;
+
+                                                               case 'attributes':
+                                                                       var iu = INTERNALUPDATE;
+                                                                       INTERNALUPDATE = true;
+
+                                                                       domNodeHandlerMain.mutateAttributes(mutations[i]);
+
+                                                                       INTERNALUPDATE = iu;
+                                                                       break;
+
+                                                               default:
+                                                                       break;
+                                                       }
+                                               }
+                                               if (userSettings.debug_mutationDebug) {
+                                                       console.log('=========================================');
+                                               }
+                                               mutationObserverMain.observe(d.documentElement, observerOptions);
+                                       });
+                                       mutationObserverMain.observe(d.documentElement, observerOptions);
+                                       USINGMUTATION = true;
+                               }
+                       } catch (e) {
+                               warn("MutationObserver threw an exception, fallback to DOMNodeInserted");
+                               dir(e);
+                       }
+               }
+               if (!USINGMUTATION) {
+                       d.addEventListener('DOMNodeInserted', DOMNodeInserted, true);
+               }
+
+               if (d.body) {
+                       DOMNodeInserted({target: d.body});
+               }
+       };
+       
+       var turnOffFbNotificationSound = function() {
+               contentEval(function(arg) {
+                       try {
+                               if (typeof window.requireLazy == 'function') {
+                                       window.requireLazy(['NotificationSound'], function(NotificationSound) {
+                                               NotificationSound.prototype.play = function() {};
+                                       });
+                               }
+                       } catch (e) {
+                               if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
+                                       console.log("Unable to hook to NotificationSound");
+                                       console.dir(e);
+                               }
+                       }
+               }, {"CANLOG":CANLOG});
+       };
+
+       var changeChatSound = function(code) {
+               onPageReady(function() {
+                       contentEval(function(arg) {
+                               try {
+                                       if (typeof window.requireLazy == 'function') {
+                                               window.requireLazy(['ChatConfig'], function(ChatConfig) {
+                                                       ChatConfig.set('sound.notif_ogg_url', arg.THEMEURL+arg.code+'.ogg');
+                                                       ChatConfig.set('sound.notif_mp3_url', arg.THEMEURL+arg.code+'.mp3');
+                                               });
+                                       }
+                               } catch (e) {
+                                       if (arg.CANLOG && typeof console != 'undefined' && console.log && console.dir) {
+                                               console.log("Unable to hook to ChatConfig");
+                                               console.dir(e);
+                                       }
+                               }
+                       }, {"CANLOG":CANLOG, "THEMEURL":THEMEURL, 'code':code});
+               });
+       };
+
+       var ranExtraInjection = false;
+       var extraInjection = function() {
+               if (ranExtraInjection) {
+                       return false;
+               }
+               ranExtraInjection = true;
+               
+               for (var x in HTMLCLASS_SETTINGS) {
+                       if (userSettings[HTMLCLASS_SETTINGS[x]]) {
+                               addClass(d.documentElement, 'ponyhoof_settings_'+HTMLCLASS_SETTINGS[x]);
+                       }
+               }
+               
+               var globalcss = '';
+               globalcss += 'html.ponyhoof_settings_show_messages_other #navItem_app_217974574879787 > ul {display:block !important;}';
+               globalcss += '.ponyhoof_page_readme {width:100%;height:300px;border:solid #B4BBCD;border-width:1px 0;-moz-box-sizing:border-box;box-sizing:border-box;}';
+               globalcss += '#fbIndex_swf {position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;}';
+               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;}';
+               globalcss += '.ponyhoof_image_shadow.noshadow {-moz-box-shadow:none;box-shadow:none;}';
+
+               injectManualStyle(globalcss, 'global');
+               
+               if (userSettings.customcss) {
+                       injectManualStyle(userSettings.customcss, 'customcss');
+               }
+               
+               INTERNALUPDATE = true;
+               for (var i = 0; i < 10; i += 1) {
+                       var n = d.createElement('div');
+                       n.id = 'ponyhoof_extra_'+i;
+                       d.body.appendChild(n);
+               }
+               
+               var timeShift = function() {
+                       var now = new Date();
+                       
+                       d.documentElement.setAttribute('data-ponyhoof-year', now.getFullYear());
+                       d.documentElement.setAttribute('data-ponyhoof-month', now.getMonth());
+                       d.documentElement.setAttribute('data-ponyhoof-date', now.getDate());
+                       d.documentElement.setAttribute('data-ponyhoof-hour', now.getHours());
+                       d.documentElement.setAttribute('data-ponyhoof-minute', now.getMinutes());
+               };
+               timeShift();
+               w.setInterval(timeShift, 60*1000);
+               
+               if (userSettings.chatSound) {
+                       if (!SOUNDS_CHAT[userSettings.chatSoundFile] || !SOUNDS_CHAT[userSettings.chatSoundFile].name) {
+                               userSettings.chatSoundFile = '_sound/grin2';
+                       }
+                       if (typeof w.Audio != 'undefined') {
+                               changeChatSound(userSettings.chatSoundFile);
+                       }
+               }
+               
+               if (userSettings.customBg) {
+                       changeCustomBg(userSettings.customBg);
+               }
+
+               // Turn off Facebook's own notification sound
+               if (userSettings.sounds) {
+                       turnOffFbNotificationSound();
+               }
+
+                               INTERNALUPDATE = false;
+       };
+
+       var detectBrokenFbStyle = function() {
+               var test = d.createElement('div');
+               test.className = 'hidden_elem';
+               d.documentElement.appendChild(test);
+
+               var style = w.getComputedStyle(test, null);
+               if (style && style.display != 'none') {
+                       d.documentElement.removeChild(test);
+
+                       
+                       return true;
+               }
+               d.documentElement.removeChild(test);
+               return false;
+       };
+       
+       // Wait for the current page to complete
+       var scriptStarted = false;
+       function startScript() {
+               if (scriptStarted) {
+                       return;
+               }
+               scriptStarted = true;
+
+               // Don't run on exclusions
+               if (w.location.hostname.indexOf('.facebook.com') == w.location.hostname.length-'.facebook.com'.length) {
+                       var excludes = ['/l.php', '/ai.php', '/ajax/'];
+                       for (var i = 0, len = excludes.length; i < len; i += 1) {
+                               if (w.location.pathname.indexOf(excludes[i]) == 0) {
+                                       return;
+                               }
+                       }
+               }
+
+               // Don't run on ajaxpipe
+               if (w.location.search && w.location.search.indexOf('ajaxpipe=1') != -1) {
+                       return;
+               }
+               
+               // Don't run on Browser Ponies
+               if (w.location.hostname == 'hoof.little.my') {
+                       var excludes = ['.gif', '.png'];
+                       for (var i = 0, len = excludes.length; i < len; i += 1) {
+                               if (w.location.pathname.indexOf(excludes[i]) != -1) {
+                                       return;
+                               }
+                       }
+               }
+
+               // Don't run on Open Graph Debugger
+               if (w.location.hostname.indexOf('developers.') != -1 && w.location.hostname.indexOf('.facebook.com') != -1 && w.location.pathname == '/tools/debug/og/echo') {
+                       return;
+               }
+
+               if (w.location.hostname == '0.facebook.com') {
+                       return;
+               }
+               
+               if (!d.head) {
+                       d.head = d.getElementsByTagName('head')[0];
+               }
+
+               // Are we running in a special Ponyhoof page?
+               if (d.documentElement.id == 'ponyhoof_page') {
+                       // Modify the <html> tag
+                       addClass(d.documentElement, 'ponyhoof_userscript');
+                       d.documentElement.setAttribute('data-ponyhoof-userscript-version', VERSION);
+                       
+                       var changeVersion = function() {
+                               var v = d.getElementsByClassName('ponyhoof_VERSION');
+                               for (var i = 0, len = v.length; i < len; i += 1) {
+                                       v[i].textContent = VERSION;
+                               }
+                       };
+                       changeVersion();
+                       onPageReady(changeVersion);
+                       
+                       try {
+                               if (d.documentElement.getAttribute('data-ponyhoof-update-current') > VERSION) {
+                                       addClass(d.documentElement, 'ponyhoof_update_outdated');
+                               } else {
+                                       addClass(d.documentElement, 'ponyhoof_update_newest');
+                               }
+                       } catch (e) {}
+               }
+               
+               // Determine what storage method to use
+               STORAGEMETHOD = 'none';
+               try {
+                       if (typeof GM_getValue === 'function' && typeof GM_setValue === 'function') {
+                               // Chrome lies about GM_getValue support
+                               GM_setValue("ponyhoof_test", "ponies");
+                               if (GM_getValue("ponyhoof_test") === "ponies") {
+                                       STORAGEMETHOD = 'greasemonkey';
+                               }
+                       }
+               } catch (e) {}
+               
+               if (STORAGEMETHOD == 'none') {
+                       try {
+                               if (typeof chrome != 'undefined' && chrome && chrome.extension && typeof GM_getValue == 'undefined') {
+                                       STORAGEMETHOD = 'chrome';
+                               }
+                       } catch (e) {}
+               }
+               
+               if (STORAGEMETHOD == 'none') {
+                       try {
+                               if (typeof opera != 'undefined' && opera && opera.extension) {
+                                       STORAGEMETHOD = 'opera';
+                               }
+                       } catch (e) {}
+               }
+               
+               if (STORAGEMETHOD == 'none') {
+                       try {
+                               if (typeof safari != 'undefined') {
+                                       STORAGEMETHOD = 'safari';
+                               }
+                       } catch (e) {}
+               }
+               
+               if (STORAGEMETHOD == 'none') {
+                       if (DISTRIBUTION == 'xpi') {
+                               STORAGEMETHOD = 'xpi';
+                       }
+               }
+               
+               if (STORAGEMETHOD == 'none') {
+                       if (DISTRIBUTION == 'mxaddon') {
+                               STORAGEMETHOD = 'mxaddon';
+                       }
+               }
+               
+               if (STORAGEMETHOD == 'none') {
+                       STORAGEMETHOD = 'localstorage';
+               }
+               
+               if (d.documentElement.id == 'ponyhoof_page') {
+                       addClass(d.documentElement, 'ponyhoof_distribution_'+DISTRIBUTION);
+                       addClass(d.documentElement, 'ponyhoof_storagemethod_'+STORAGEMETHOD);
+                       return;
+               }
+
+               // Inject the system style so we can do any error trapping
+               injectSystemStyle();
+
+               // Grab the user
+               USERID = cookie('c_user');
+               if (!USERID) {
+                       USERID = 0;
+               } else {
+                       SETTINGSPREFIX = USERID+'_';
+               }
+
+               loadSettings(function(s) {
+                       userSettings = s;
+
+                       loadSettings(function(s) {
+                               globalSettings = s;
+
+                               if (userSettings.debug_slow_load) {
+                                       onPageReady(settingsLoaded);
+                                       return;
+                               }
+                               settingsLoaded();
+                       }, {prefix:'global_', defaultSettings:GLOBALDEFAULTSETTINGS});
+               });
+       };
+
+       // Check for legacy settings through message passing
+       var migrateSettingsChromeDone = false;
+       var migrateSettingsChrome = function(callback) {
+               if (STORAGEMETHOD == 'chrome') {
+                       if (chrome.storage) {
+                               try {
+                                       chrome_sendMessage({'command':'getValue', 'name':SETTINGSPREFIX+'settings'}, function(response) {
+                                               if (response && typeof response.val != 'undefined') {
+                                                       var _settings = JSON.parse(response.val);
+                                                       if (_settings) {
+                                                               userSettings = _settings;
+                                                               saveSettings();
+                                                               
+                                                               chrome_sendMessage({'command':'clearStorage'}, function() {});
+                                                       }
+
+                                                       migrateSettingsChromeDone = true;
+                                                       callback();
+                                               }
+                                       });
+                               } catch (e) {
+                                       error("Failed to read previous settings through message passing");
+                                       dir(e);
+                                       migrateSettingsChromeDone = true;
+                                       callback();
+                               }
+                               return;
+                       }
+               }
+               migrateSettingsChromeDone = true;
+               callback();
+       };
+
+       // Check for previous settings from unprefixed settings
+       var migrateSettingsUnprefixedDone = false;
+       var migrateSettingsUnprefixed = function(callback) {
+               loadSettings(function(s) {
+                       if (s.lastVersion) { // only existed in previous versions
+                               userSettings = s;
+                               saveSettings();
+                               saveValue('settings', JSON.stringify(null));
+                       }
+
+                       migrateSettingsUnprefixedDone = true;
+                       callback();
+               }, {prefix:''});
+       };
+
+       var globalSettingsTryLastUserDone = false;
+       var globalSettingsTryLastUser = function(callback) {
+               if (!globalSettings.lastUserId) {
+                       globalSettingsTryLastUserDone = true;
+                       callback();
+                       return;
+               }
+
+               SETTINGSPREFIX = globalSettings.lastUserId+'_';
+               loadSettings(function(s) {
+                       if (s) {
+                               userSettings = s;
+                       }
+
+                       globalSettingsTryLastUserDone = true;
+                       callback();
+               });
+       };
+
+       function settingsLoaded() {
+               if (!userSettings.theme && !migrateSettingsChromeDone) {
+                       migrateSettingsChrome(settingsLoaded);
+                       return;
+               }
+
+               // Migrate for multi-user
+               if (!userSettings.theme && !migrateSettingsUnprefixedDone) {
+                       migrateSettingsUnprefixed(settingsLoaded);
+                       return;
+               }
+
+               if (!globalSettings.globalSettingsMigrated) {
+                       if (!userSettings.lastVersion) {
+                               // New user
+                               statTrack('install');
+                       }
+
+                       for (var i in GLOBALDEFAULTSETTINGS) {
+                               if (userSettings.hasOwnProperty(i)) {
+                                       globalSettings[i] = userSettings[i];
+                               }
+                       }
+                       globalSettings.globalSettingsMigrated = true;
+                       saveGlobalSettings();
+               }
+
+               if (!USERID && !globalSettingsTryLastUserDone) {
+                       // Try loading the last user
+                       globalSettingsTryLastUser(settingsLoaded);
+                       return;
+               }
+
+               // If we haven't set up Ponyhoof, don't log
+               if (!userSettings.theme || userSettings.debug_disablelog) {
+                       CANLOG = false;
+               }
+
+               // Run ONLY on #facebook
+               if (!(d.documentElement.id == 'facebook' && w.location.hostname.indexOf('.facebook.com') == w.location.hostname.length-'.facebook.com'.length) && d.documentElement.id != 'ponyhoof_page') {
+                       info("Ponyhoof does not run on "+w.location.href+" (html id is not #facebook)");
+                       return;
+               }
+               
+               // Did we already run our script?
+               if (hasClass(d.documentElement, 'ponyhoof_userscript')) {
+                       info("Style already injected at "+w.location.href);
+                       return;
+               }
+               
+               // Don't run in frames
+               var forceWhiteBackground = false;
+               try {
+                       var href = w.location.href.toLowerCase();
+                       
+                       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))) {
+                               // Allow like boxes for the Ponyhoof page (yeah, a bit cheating)
+                       } else if (hasClass(d.body, 'chrmxt')) {
+                               // Allow for Facebook Notifications for Chrome
+                       } else {
+                               // Allow for some frames
+                               var allowedFrames = ['/ads/manage/powereditor/funding', '/ads/manage/powereditor/convtrack', '/mobile/iframe_emails.php'];
+                               var allowedFramesOk = false;
+                               for (var i = 0, len = allowedFrames.length; i < len; i += 1) {
+                                       if (w.location.pathname.indexOf(allowedFrames[i]) == 0) {
+                                               allowedFramesOk = true;
+                                               forceWhiteBackground = true;
+                                       }
+                               }
+
+                               if (!allowedFramesOk) {
+                                       if (USW.self != USW.top) {
+                                               throw 1;
+                                       }
+                               }
+                       }
+               } catch (e) {
+                       info("Framed");
+                       return;
+               }
+               
+               // Special instructions for browsers that needs localStorage
+               runMe = true;
+               if (STORAGEMETHOD == 'localstorage') {
+                       // Don't run on non-www :(
+                       if (userSettings.force_run) {
+                               log("Force running on "+w.location.href);
+                       } else {
+                               if (w.location.hostname != 'www.facebook.com') {
+                                       info("w.location.hostname = "+w.location.hostname);
+                                       runMe = false;
+                               }
+                       }
+               }
+               
+               if (!runMe) {
+                       info("Ponyhoof style is not injected on "+w.location.href);
+                       //return;
+               }
+               
+               CURRENTPONY = userSettings.theme;
+
+               if (!USERID && !globalSettings.allowLoginScreen) {
+                       info("Ponyhoof will not run when logged out because of a setting.");
+                       return;
+               }
+
+               // Ban parasprites
+               // 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
+               if (USERID && ['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) {
+                       if (globalSettings.allowLoginScreen) {
+                               globalSettings.allowLoginScreen = false;
+                               saveGlobalSettings();
+                       }
+                       return;
+               }
+
+               // If we don't have an old setting...
+               if (userSettings.theme == null) {
+                       // ... and not logged in, DON'T show the welcome screen
+                       if (!USERID) {
+                               // Special exception at home page, we want that cool login background
+                               if (!hasClass(d.body, 'fbIndex')) {
+                                       info("Ponyhoof does not run for logged out users.");
+                                       return;
+                               }
+                       }
+
+                       // Don't run on dialogs
+                       if (w.location.pathname.indexOf('/dialog/') == 0) {
+                               info("Ponyhoof does not run when there is no theme selected and running on dialogs.");
+                               return;
+                       }
+               }
+
+               // v1.581: Detect broken Facebook styles and abort if derped
+               if (userSettings.theme && detectBrokenFbStyle()) {
+                       error("Broken Facebook style: hidden_elem is not expected");
+                       return;
+               }
+               
+               // Modify the <html> tag
+               addClass(d.documentElement, 'ponyhoof_userscript');
+               addClass(d.documentElement, 'ponyhoof_storagemethod_'+STORAGEMETHOD);
+               addClass(d.documentElement, 'ponyhoof_distribution_'+DISTRIBUTION);
+               d.documentElement.setAttribute('data-ponyhoof-userscript-version', VERSION);
+
+               // CANLOG previously could be disabled before
+               if (!userSettings.debug_disablelog) {
+                       CANLOG = true;
+               }
+
+               // Load the language for the options link
+               CURRENTLANG = LANG['en_US'];
+               if (!userSettings.forceEnglish) {
+                       UILANG = getDefaultUiLang();
+                       if (!UILANG) {
+                               UILANG = 'en_US';
+                       } else {
+                               for (var i in LANG[UILANG]) {
+                                       CURRENTLANG[i] = LANG[UILANG][i];
+                               }
+                       }
+               }
+
+               // Inject Ponyhoof Options in the Account dropdown even when DOMNodeInserted is disabled
+               onPageReady(function() {
+                       injectOptionsLink();
+                       domNodeHandlerMain.ponyhoofPageOptions({target: d.body});
+               });
+
+               if (!runMe) {
+                       return;
+               }
+
+               var luckyGuess = -1;
+               if (!CURRENTPONY) {
+                       // If we have a "special" name, load the peferred theme for that character if we're in one
+                       try {
+                               getBronyName();
+                               for (var i = 0, len = PONIES.length; i < len; i += 1) {
+                                       if (PONIES[i].users) {
+                                               var lowercase = BRONYNAME.toLowerCase();
+                                               for (var j = 0, jlen = PONIES[i].users.length; j < jlen; j += 1) {
+                                                       if (lowercase.indexOf(PONIES[i].users[j]) != -1) {
+                                                               // We got a match!
+                                                               CURRENTPONY = PONIES[i].code;
+                                                               luckyGuess = i;
+                                                       }
+                                               }
+                                       }
+                               }
+                       } catch (e) {
+                               error("Failed to get brony name");
+                       }
+               }
+               
+               // If we still don't have one, then assume none
+               if (!CURRENTPONY) {
+                       CURRENTPONY = 'NONE';
+               }
+
+               if ($('jewelFansTitle')) {
+                       ISUSINGPAGE = true;
+                       addClass(d.documentElement, 'ponyhoof_isusingpage');
+               }
+
+               var logo = d.querySelector('#pageLogo > a[href*="/business/dashboard/"]');
+               if (logo) {
+                       ISUSINGBUSINESS = true;
+                       addClass(d.documentElement, 'ponyhoof_isusingbusiness');
+               }
+
+               // v1.401: Turn on new chat sound by default
+               if (!userSettings.chatSound1401 && !userSettings.chatSound) {
+                       userSettings.chatSound = true;
+                       userSettings.chatSound1401 = true;
+                       saveSettings();
+               }
+
+               // v1.501: Migrate previous randomSetting
+               if (userSettings.randomSetting && !userSettings.randomSettingMigrated) {
+                       if (userSettings.randomSetting == 'mane6') {
+                               userSettings.randomPonies = 'twilight|dash|pinkie|applej|flutter|rarity';
+                       }
+                       userSettings.randomSettingMigrated = true;
+                       saveSettings();
+               }
+
+               // v1.571
+               userSettings.soundsVolume = Math.max(0, Math.min(parseFloat(userSettings.soundsVolume), 1));
+
+               // v1.601
+               if (globalSettings.lastVersion < 1.6) {
+                       if (userSettings.customcss || userSettings.debug_dominserted_console || userSettings.debug_slow_load || userSettings.debug_disablelog || userSettings.debug_noMutationObserver || userSettings.debug_mutationDebug) {
+                               userSettings.debug_exposed = true;
+                               saveSettings();
+                       }
+               }
+
+               // v1.511: Track updates
+               if (userSettings.theme && globalSettings.lastVersion < VERSION) {
+                       statTrack('updated');
+                       globalSettings.lastVersion = VERSION;
+                       saveGlobalSettings();
+               }
+
+               if (forceWhiteBackground || hasClass(d.body, 'plugin') || hasClass(d.body, 'transparent_widget')) {
+                       addClass(d.documentElement, 'ponyhoof_fbplugin');
+                       changeThemeSmart(CURRENTPONY);
+               } else {
+                       // Are we on homepage?
+                       if (hasClass(d.body, 'fbIndex') && globalSettings.allowLoginScreen) {
+                               // Activate screen saver
+                               screenSaverActivate();
+
+                               $$(d.body, '#blueBar .loggedout_menubar > .rfloat, ._50dz > .ptl[style*="#3B5998"] .rfloat > #login_form, ._50dz > div[style*="#3B5998"] td > div[style*="float"] #login_form, .-cx-PRIVATE-regCmsContainer__root > .ptl[style*="#3B5998"] .rfloat > #login_form, .-cx-PRIVATE-regCmsContainer__root > div[style*="#3B5998"] td > div[style*="float"] #login_form', function() {
+                                       addClass(d.documentElement, 'ponyhoof_fbIndex_topRightLogin');
+                               });
+                       }
+                       
+                       // No theme?
+                       if (userSettings.theme == null) {
+                               // No theme AND logged out
+                               if (!USERID) {
+                                       changeTheme('login');
+                                       log("Homepage is default to login.");
+                                       extraInjection();
+                                       if (!userSettings.disableDomNodeInserted) {
+                                               runDOMNodeInserted();
+                                       }
+                                       return;
+                               }
+                               
+                               if (globalSettings.runForNewUsers) {
+                                       if (luckyGuess == -1) {
+                                               CURRENTPONY = getRandomMane6();
+                                       }
+
+                                       var welcome = new WelcomeUI({feature: luckyGuess});
+                                       welcome.start();
+                               }
+                       } else {
+                               if (hasClass(d.body, 'fbIndex')) {
+                                       if (CURRENTPONY == 'RANDOM' && !userSettings.randomPonies) {
+                                               log("On login page and theme is RANDOM, choosing 'login'");
+                                               changeThemeSmart('login');
+                                       } else {
+                                               changeThemeSmart(CURRENTPONY);
+                                       }
+
+                                       var dat = convertCodeToData(REALPONY);
+                                       if (dat.fbIndex_swf && !userSettings.disable_animation) {
+                                               addClass(d.documentElement, 'ponyhoof_fbIndex_hasswf');
+
+                                               var swf = d.createElement('div');
+                                               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>';
+                                               d.body.appendChild(swf);
+                                       }
+                               } else {
+                                       changeThemeSmart(CURRENTPONY);
+                               }
+                       }
+               }
+               
+               if (CURRENTPONY != 'NONE' && !userSettings.disableDomNodeInserted) {
+                       runDOMNodeInserted();
+               }
+               
+               if (CURRENTPONY != 'NONE') {
+                       extraInjection();
+               }
+
+               // Record the last user to figure out what theme to load at login screen
+               // This is low priority, if all else fails, we would just load the default Equestria 'login' anyway
+               if (CURRENTPONY != 'NONE' && USERID && globalSettings.lastUserId != USERID) {
+                       globalSettings.lastUserId = USERID;
+                       saveGlobalSettings();
+               }
+       }
+       
+       onPageReady(startScript);
+       d.addEventListener('DOMContentLoaded', startScript, true);
+       
+       var _loop = function() {
+               if (d.body) {
+                       startScript();
+                       return;
+               } else {
+                       w.setTimeout(_loop, 100);
+               }
+       };
+       _loop();
+})();
+
+/* ALL YOUR PONIES ARE BELONG TO US */
+/*eof*/
\ No newline at end of file
diff --git a/dwb/keys b/dwb/keys
new file mode 100644 (file)
index 0000000..8e7a503
--- /dev/null
+++ b/dwb/keys
@@ -0,0 +1,171 @@
+[default]
+save_search_field= gs
+tab_new= ga
+allow_session_cookie_tmp= CT
+allow_cookie= CC
+allow_session_cookie= CS
+bookmark= M
+buffers= gt
+cancel_download= ad
+sanitize= 
+clear_tab= gc
+only= co
+close_tab= d
+entry_escape=Control c
+entry_confirm=Control g
+entry_history_back=Control k
+entry_history_forward=Control j
+entry_delete_letter=Control h
+entry_delete_line=Control u
+entry_delete_line_end=Control e
+entry_delete_word=Control w
+entry_delete_word_forward=Control e
+entry_word_back=Control b
+entry_word_forward=Control f
+complete_bookmarks=Control B
+complete_history=Control H
+complete_path=Control p
+complete_searchengines=Control S
+complete_userscript=Control U
+download= gd
+download_set_execute=Control x
+command_mode= :
+tabdo= 
+execute_javascript= 
+eval= 
+execute_userscript= eu
+find_backward_ic= c?
+find_backward= ?
+find_forward_ic= c/
+find_forward= /
+find_next= n
+find_previous= N
+focus_input= gi
+focus_next= J
+focus_tab= T
+focus_prev= K
+win_hist_back= wh
+tab_hist_back= th
+history_back= H
+win_hist_forward= wl
+tab_hist_forward= tl
+history_forward= L
+insert_mode= i
+show_keys= Sk
+load_html= 
+load_html_tab= 
+lock_domain= xd
+lock_uri= xu
+tab_move_left= gl
+tab_move_right= gr
+tab_move= gm
+normal_mode=Control n
+open_editor=Control e
+quickmark= b
+tab_quickmark= B
+win_quickmark= wb
+start_page=Control h
+web_inspector= wi
+paste= pp
+tab_paste= Pp
+win_paste= wp
+paste_primary= pP
+win_paste_primary= wP
+tab_paste_primary= PP
+print=Control Mod1 p
+protect=Control P
+quit=Control q
+reload_bookmarks= 
+reload= r
+reload_bypass_cache= R
+reload_quickmarks= 
+reload_userscripts= 
+save= sf
+save_session= ZZ
+save_named_session= gZZ
+save_quickmark= m
+scroll_down= j
+scroll_right= l
+scroll_left= h
+scroll_page_down=Control f
+scroll_page_up=Control b
+scroll_halfpage_down=Control d
+scroll_halfpage_up=Control u
+scroll_bottom= G
+scroll_top= gg
+scroll_up= k
+local_set= 
+set= 
+set_key= sk
+set_local_setting= sl
+set_setting= ss
+show_settings= Ss
+print_preview= 
+show_bookmarks= Sb
+show_downloads= Sd
+show_history= Sh
+show_quickmarks= Sq
+stop_loading=Control s
+toggle_local_setting= 
+toggle_setting= 
+toggle_tab=Control @Tab@
+toggle_plugins_host_tmp= pth
+toggle_scripts_host= tsh
+toggle_scripts_host_tmp= tth
+toggle_scripts_uri= tsu
+toggle_plugins_uri_tmp= ptu
+toggle_scripts_uri_tmp= ttu
+fullscreen= @F11@
+toggle_hidden_files= g.
+toggle_plugins_host= ph
+toggle_plugins_uri= pu
+presentation_mode= @F12@
+proxy=Control p
+visible= xv
+toggle_bars= xx
+toggle_statusbar= xb
+toggle_tabbar= xt
+undo= u
+view_source= gf
+dump= 
+yank_title= yt
+yank_title_primary= yT
+yank= yy
+yank_primary= yY
+zoom= =
+zoom_in= +
+zoom_out= -
+hints_background= ;b
+hints_images_background= .i
+hints_url_background= .o
+backopen_url= xO
+backopen= xo
+bookmarks= gb
+hints= f
+hints_clipboard= ;y
+hints_download= ;d
+hints_editable= ;e
+hints_images= ;i
+hints_links= ;;
+hints_primary= ;Y
+hints_rapid= ;r
+hints_url= ;o
+new_tab= V
+new_win= W
+open_url= go
+open= o
+hints_tab= F
+hints_images_tab= ;I
+hints_url_tab= ;O
+tab_bookmarks= gB
+tabopen_url= gO
+tabopen= O
+hints_win= wf
+hints_rapid_win= ;R
+win_bookmarks= wB
+winopen_url= wO
+winopen= wo
+adblock_reload_rules=
+visual_mode=v
+tabgrep=
+repeat=.
diff --git a/dwb/mimetypes b/dwb/mimetypes
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/dwb/searchengines b/dwb/searchengines
new file mode 100644 (file)
index 0000000..27453fc
--- /dev/null
@@ -0,0 +1 @@
+ddg https://duckduckgo.com/?q=_dwb_search_submit_
diff --git a/dwb/settings b/dwb/settings
new file mode 100644 (file)
index 0000000..b2df14d
--- /dev/null
@@ -0,0 +1,162 @@
+[default]
+javascript-can-access-clipboard=false
+complete-userscripts=false
+file-sync-interval=120
+download-gradient-end=#00aa00
+status-allowed-color=#00ff00
+tab-number-color=#7ac5cd
+enable-default-context-menu=true
+editable=false
+background-tabs=false
+enable-webgl=true
+minimum-logical-font-size=5
+enable-page-cache=false
+cache-model=webbrowser
+sans-serif-font-family=sans-serif
+prompt-color=#00ff00
+complete-searchengines=false
+update-search-delay=200
+fantasy-font-family=serif
+hint-fg-color=#000000
+sync-files=all
+default-height=600
+scrollbars=false
+hint-bg-color=#ffffff
+show-single-tab=true
+private-color=#505050
+enable-developer-extras=true
+complete-bookmarks=true
+zoom-level=1.00
+download-use-external-program=false
+enable-xss-auditor=true
+custom-encoding=
+print-previewer=
+normal-completion-fg-color=#eeeeee
+close-tab-focus-policy=left
+enable-dns-prefetching=true
+new-tab-position-policy=right
+auto-shrink-images=true
+print-backgrounds=true
+enable-caret-browsing=false
+enable-scripts=true
+adblocker-filterlist=
+proxy=false
+user-agent=Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.6+ (KHTML, like Gecko) Chromium/23.0.1271.95 Chrome/23.0.1271.95 Safari/537.6+ dwb/2013.08.21
+full-content-zoom=false
+editor=xterm -e vim dwb_uri
+enable-accelerated-compositing=true
+hsts=false
+enable-private-browsing=false
+enable-favicon=true
+hint-active-color=#00ff00
+resizable-text-areas=true
+javascript-schemes=true
+load-on-focus=false
+download-gradient-start=#0000aa
+hint-normal-color=#ffff99
+spell-checking-languages=
+cookies-accept-policy=always
+font-nofocus=
+status-blocked-color=#ffffff
+download-fg-color=#ffffff
+enable-plugins=true
+enable-frame-flattening=false
+ssl-use-system-ca-file=true
+cookies-store-policy=session
+bars-padding=0
+active-completion-fg-color=#53868b
+hint-font=bold 10px monospace
+progress-bar-full-color=#ffffff
+tabbed-browsing=true
+hint-highlight-links=false
+active-completion-bg-color=#000000
+enable-spell-checking=true
+font-hidden-statusbar=normal 10px helvetica
+tab-normal-fg-color-2=#dddddd
+tab-normal-fg-color-1=#cccccc
+default-monospace-font-size=10
+save-session=true
+tabbar-visible=2
+auto-insert-mode=false
+tab-normal-bg-color-2=#707070
+tab-normal-bg-color-1=#505050
+serif-font-family=serif
+accept-language=
+enable-html5-local-storage=true
+tab-protected-color=#ff0000
+hint-letter-seq=FDSARTGBVECWXQYIOPMNHZULKJ
+progress-bar-style=default
+use-ntlm=false
+passthrough-keys=webkit
+enable-html5-database=true
+hint-autofollow=true
+enable-dom-paste=false
+javascript-can-open-windows-automatically=false
+max-visible-completions=11
+hint-border=1px solid #000000
+widget-packing=dtws
+ssl-trusted-color=#00ff00
+enable-java-applet=true
+hints-key-lock=250
+navigation-history-max=500
+hint-style=letter
+enable-site-specific-quirks=false
+auto-resize-window=false
+zoom-step=0.10
+default-font-family=sans-serif
+ssl-untrusted-color=#ff0000
+plugin-blocker=true
+startpage=dwb:bookmarks
+normal-completion-bg-color=#151515
+cursive-font-family=serif
+default-encoding=
+error-color=#ff0000
+searchengine-submit-pattern=
+hint-opacity=0.80
+font-entry=
+proxy-url=
+font=monospace 8
+monospace-font-family=monospace
+addressbar-dns-lookup=false
+enable-universal-access-from-file-uris=true
+background-color=#000000
+do-not-track=true
+progress-bar-empty-color=#ffffff
+default-width=800
+single-instance=true
+auto-completion=true
+minimum-font-size=5
+font-completion=
+enable-spatial-navigation=false
+download-directory=
+adblocker=false
+download-external-command=xterm -e wget dwb_uri -O dwb_output --load-cookies dwb_cookies
+user-stylesheet-uri=
+auto-load-images=true
+tab-active-fg-color=#ffffff
+history-length=500
+tab-active-bg-color=#000000
+download-bg-color=#000000
+download-no-confirm=false
+enable-file-access-from-file-uris=true
+complete-history=true
+tab-key-cycles-through-elements=true
+enforce-96-dpi=false
+ssl-strict=false
+scroll-step=0.00
+close-last-tab-policy=ignore
+foreground-color=#ffffff
+message-delay=2
+scheme-handler=
+default-font-size=12
+enable-offline-web-application-cache=true
+hint-offset-top=0
+javascript-api=automatic
+mouse-cycles-through-tabs=true
+tab-orientation=horizontal
+maximum-tabs=0
+cookie-expiration=0
+tab-width=100
+hint-offset-left=0
+enable-ipc=true
+block-insecure-content=false
diff --git a/dwb/userscripts/extension_loader.js b/dwb/userscripts/extension_loader.js
new file mode 100644 (file)
index 0000000..bb4fe1b
--- /dev/null
@@ -0,0 +1,48 @@
+//!javascript
+//<formfiller___SCRIPT
+extensions.load("formfiller", {
+//<formfiller___CONFIG
+// shortcut that gets and saves formdata
+scGetForm : "efg",
+
+// shortcut that fills a form
+scFillForm : "eff",
+
+// path to the formdata file
+formData : data.configDir + "/forms",
+
+// whether to use a gpg-encrypted file
+useGPG : false,
+
+// your GPG key ID (leave empty to use a symmetric cipher)
+GPGKeyID : "",
+
+// whether to use a GPG agent (requires non-empty GPGKeyID to work)
+GPGAgent : false,
+
+// additional arguments passed to gpg2 when encrypting the formdata
+GPGOptEncrypt : "",
+
+// additional arguments passed to gpg2 when decrypting the formdata
+GPGOptDecrypt : "",
+
+// whether to save the password in memory when gpg is used
+keepPassword : true,
+
+// whether to save the whole formdata in memory when gpg is used
+keepFormdata : false
+
+//>formfiller___CONFIG
+});
+//>formfiller___SCRIPT
+//<userscripts___SCRIPT
+extensions.load("userscripts", {
+//<userscripts___CONFIG
+  // paths to userscripts, this extension will also load all scripts in 
+  // $XDG_CONFIG_HOME/dwb/greasemonkey, it will also load all scripts in
+  // $XDG_CONFIG_HOME/dwb/scripts but this is deprecated and will be
+  // disabled in future versions.
+  scripts : []
+//>userscripts___CONFIG
+});
+//>userscripts___SCRIPT
diff --git a/dwb/userscripts/youtube.js b/dwb/userscripts/youtube.js
new file mode 100755 (executable)
index 0000000..71d02f4
--- /dev/null
@@ -0,0 +1,9 @@
+#!javascript 
+
+var regex = new RegExp("https?://www.youtube.com/watch\\?(.*&)*v=.*");
+
+signals.connect("navigation", function (wv, frame, request) {
+  if (wv.mainFrame == frame && regex.test(request.uri)) 
+    system.spawn("sh -c 'mplayer \"$(youtube-dl -g " + request.uri + ")\"'");
+  return false;
+});