]> git.rmz.io Git - dotfiles.git/blob - dwb/greasemonkey/fbpurity.EGTSVNOH.user.js
add chakra-project.org
[dotfiles.git] / dwb / greasemonkey / fbpurity.EGTSVNOH.user.js
1 // ==UserScript==
2 // @name Facebook Purity
3 // @namespace http://steeev.freehostia.com
4 // @description F.B Purity hides application spam and other clutter from your facebook homepage
5 // @icon http://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/373593_408502197558_209872631_q.jpg
6 // @include http://*.facebook.com/*
7 // @include https://*.facebook.com/*
8 // @match http://*.facebook.com/*
9 // @match https://*.facebook.com/*
10 // @exclude http://*.facebook.com/ajax/*
11 // @exclude https://*.facebook.com/ajax/*
12 // @exclude http://*.facebook.com/ai.php*
13 // @exclude https://*.facebook.com/ai.php*
14 // @exclude http://*.channel.facebook.com/*
15 // @exclude https://*.channel.facebook.com/*
16 // @exclude http://*.facebook.com/ai.php?*
17 // @exclude https://*.facebook.com/ai.php?*
18 // @run-at document-start
19 // @grant GM_getValue
20 // @grant GM_setValue
21 // @version 8.7.0 - 12th Sep 2013
22 // ==/UserScript==
23
24 // 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.
25 // @exclude http://*.facebook.com/connect/*
26 // @exclude https://*.facebook.com/connect/*
27
28 //
29 // (C) 2009 - 2013 stephen fernandez - http://www.fbpurity.com
30 //
31
32 // If you like this script please donate, big or small donations, anything is welcome :
33
34 // http://donate.fbpurity.com/
35
36 // ------------------------------------------------------------
37 // F.B. Purity Home Page : http://www.fbpurity.com
38 // F.B Purity Install : http://install.fbpurity.com
39 // F.B. Purity Fan Page : http://fans.fbpurity.com
40 // F.B. Purity UserGuide : http://user-guide.fbpurity.com
41 // F.B. Purity Custom CSS : http://css.fbpurity.com
42 // F.B. Purity FAQ / Help : http://faq.fbpurity.com
43 // F.B. Purity Search : http://search.fbpurity.com
44 // ------------------------------------------------------------
45
46 // ABOUT
47 // -----
48 // This greasemonkey script hides all third party facebook application messages from your fb homepage.
49 // Instructions on how to edit the "whitelist" are available here: http://whitelist.fbpurity.com
50 // Instructions on how to edit the "extras" are available here: http://extras.fbpurity.com
51 // Make donations to F.B. Purity, to show your appreciation here: http://donate.fbpurity.com
52
53 // INSTALLATION
54 // ------------
55 // This script is compatible with the following web browsers: Firefox, Google Chrome, Opera and Safari
56 //
57 // Full installation instructions are available here:
58 // http://install.fbpurity.com
59 //
60 // If you have any problems, please see the Frequently Asked Questions / Help page:
61 // http://faq.fbpurity.com
62
63 // UPDATES
64 // -------
65 // 1.51 30th March 2009 Bug fixed: if there were no pending requests, the script didnt work
66 // 1.52 4th April 2009 removed GM_addStyle command, for better compatibility with other browsers (chrome + opera)
67 // 1.53 26th April 2009 changed insertpoint so its not dependent on suggestions box
68 // 1.54 27th April 2009 script is now compatible with Google Chrome + Opera (and possibly safari, not tested yet)
69 // 1.54a 5th May 2009 fixed a minor bug
70 // 1.54b 24th June 2009 fixed for facebook code change
71 // 1.54c 29th July 2009 fixed for facebook code change
72 // 1.54d 5th Aug 2009 fixed for facebook code change
73 // 1.54e 26th Aug 2009 fixed for facebook code change
74 // 1.60 4th Sep 2009 added application whitelisting capability, the default whitelisted apps are:
75 // FB Iphone, Selective Twitter and Living Social
76 // 1.61 14th Oct 2009 optimised script, it should run faster and more efficiently now
77 // added tumblr, digsby and tweetdeck to whitelist, removed livingsocial from whitelist
78 // 1.8 21st Oct 2009 added "block app" functionality and ability to show just the app messages on the page
79 // added blackberry app to default whitelist
80 // 1.8a 22nd Oct 2009 fixed bug with blocking apps if language was not set to english
81 // 1.8d 23rd Oct 2009 fixed for new facebook update ( "live feed" changes )
82 // 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
83 // if after you've blocked an app, and there are no more hidden app messages, it now returns to normal homepage view
84 // 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
85 // 1.9 28th Oct 2009 added filter for "extra" [joined group, became fan, attending event, became friend] messages
86 // 2.0 31st Oct 2009 fixed Show/Hide Logic, made app+extra filters mutually exclusive, optimised the script a lot
87 // moved fbpurity bar to the left to regain vertical space on the right hand column
88 // newly added elements now obey the current filter
89 // 2.1 2nd Nov 2009 reset show/hide mode to default when user changes fb filter
90 // 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
91 // fixed bug with whitelisted apps being displayed via the "show hidden apps" filter
92 // fixed - block link wasnt showing up on dynamically inserted app messages
93 // 2.1a 4th Nov 2009 fixed - now also hides apps that dont have a mini-icon
94 // 2.1b 7th Nov 2009 added option to hide suggestions box
95 // added facebook for android to whitelist
96 // 2.2 12th Nov 2009 rewrote filter system, should block absolutely all apps now (except whitelisted ones)
97 // added filter for photos posted by applications (eg farmville, top friends etc)
98 // 2.2a 12th Nov 2009 fixed suggestion box filter
99 // 2.2b 20th Nov 2009 added another "became friends" story id to extras list
100 // 2.3 31st Jan 2010 fixed block app function for google chrome v4 + hopefully fixed the random script loading problems too
101 // speeded up script loading time by checking if the DOM is ready, rather than waiting for the whole page to load
102 // added "attended event" messages to blocked extras list
103 // added an option to allow blocking of "commented on status" and "likes status" messages
104 // added facebook for palm to default application whitelist
105 // 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
106 // 2.3b 7th Feb 2010 fixed script to work with new layout
107 // 2.3c 8th Feb 2010 fixed script to work with custom friends lists
108 // 2.4 13th Feb 2010 fixed hide suggestions box option (wasnt working on custom friends list pages)
109 // fixed app filtering ( some apps were getting around the app filter )
110 // added the following optional extras : tagged/commented/liked photo, tagged in album, commented/liked album, commented/liked link, wall comment, group wall comment
111 // 2.4a 18th Feb 2010 added another app exception (generic status updates posted "via some app" - using widgets)
112 // added motoblur + iphoto uploader to default whitelist
113 // added optional extra : "Page Wall Comments"
114 // added optional extra : "Posted Event"
115 // fixed bug caused by "posted events" + "became friends" sharing same story code
116 // fixed bug caused by "became friends + became fan of" sharing same story code
117 // 2.4b 19th Feb 2010 fixed bug in firefox where sometimes the "show extras" link stopped working
118 // 2.4c 23rd Feb 2010 fixed event/friend/fan story code differentiation
119 // 2.5 25th Feb 2010 added text filter list, so you can specify words or phrases you want to block from your news feeds
120 // separated userappwhitelist from the defaultappwhitelist, for easier copying and pasting of application id lists
121 // added picasa uploader to the default application whitelist
122 // 2.5a 26th Feb 2010 fixed script to work with latest FB code change
123 // 2.7 8th Mar 2010 added options editing screen that lets you save your settings for extras, whitelist, suggestions box, and custom text filter
124 // added sprint/samsung? photo/video uploader, sony/erricson uploader,music player + status shuffle to default whitelist.
125 // added https:// to the list of included pages for those wanting greater security whilst browsing facebook
126 // 2.8 13th Mar 2010 fixed suggestions box wasnt being hidden on the requests page if the hide sb option was selected
127 // fixed options screen occasionally not loading
128 // added hide option to hide the connect with friends box
129 // added facebook exporter for iphoto and flickr app to default whitelist
130 // added "Allow" link to application messages, for auto whitelisting of applications
131 // 2.8a-test 19thMar2010 alpha test of temp fix for fb codechange, basic (show/hide) functionality should be restored
132 // 2.8b-test 20thMar2010 fixed bug in show/hide app code, fixed "block app" and "allow" links on application messages
133 // 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
134 // Fixed bug in chrome where show/hide functions were sometimes not working.
135 // Fixed Block + Allow links that were not showing up for certain applications (apps that post as normal FB stories)
136 // Added LG Mobile, Windows Phone, Twitter and Posterous to the default application whitelist
137 // Added hide "Sponsored box" (ads) option
138 // 2.9a 6thApr2010 Fixed bug that was causing Firefox to lock up
139 // 2.9b 9thApr2010 Fixed after blocking an app, not all the onscreen posts by that app would be hidden
140 // Made some performance tweaks to make the script run better
141 // Blocking app no longer requires "hiding" too so removed hideapp function call
142 // Added Snaptu + SonyEricsson Panel + Nokia to default whitelist
143 // 2.9c 15thApr2010 Added Ping.fm to default whitelist
144 // 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"
145 // 2.9d 15thApr2010 Fixed minor CSS style issue
146 // Fixed friend/fan stories getting mixed up again (due to Facebooks code tinkering)
147 // 2.9e 19thApr2010 Fixed bug where the display extras/apps would get screwed up some times
148 // Fixed "allow" and "block app" buttons were not being hidden by default
149 // 2.9f 26thApr2010 Fixed Display bug on custom friends list page.
150 // 2.9g 4thMay2010 Fixed Extras differentiation (friends/fans)
151 // Added wildcard for included pages
152 // Added Gwibber to default whitelist
153 // 2.9h 20thMay2010 Added new "likes website" type story to "became fan of" option
154 // Fixed differentiation between like+became friends (again)
155 // 2.9i 11thJun2010 Fixed Block App function
156 // Added "changed profile info","changed relationship" and "changed profile pic" to the list of hideable extras
157 // Fixed multiple words/phrases in custom text filter for chrome
158 // 2.9j 22ndJun2010 Added option to hide "beta testers" box
159 // Added HTC Sense + Samsung Mobile apps to default Whitelist
160 // 3.0 30thJun2010 Fixed script for latest FB code change
161 // Added visual feedback for "block app" function
162 // Added extra security on domain name parsing
163 // Stopped script from running in frames
164 // 3.1 30thJun2010 Fixed for unforseen bugs
165 // 3.11 9thJul2010 Fixed hide suggestions box (recommended pages + people you may know)
166 // 3.2 5thAug2010 Fixed "Block" and "Allow" (whitelist) buttons, Added windows live messenger + o2 social link to default whitelist
167 // 3.3 20thAug2010 Added new extra: "Checked in to location", addded LG Phone app to default whitelist
168 // 3.4 3rdSep2010 Fixed script to work with facebook's latest code change, added Bloom photo uploader to default whitelist
169 // 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
170 // 3.4b 14thSep2010 Fixed hide "get connected box" option again, fixed compatibility with ff4
171 // 3.4c 22ndSep2010 Fixed hide "get connected box" option again
172 // 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
173 // 3.6 7thOct2010 Added new extras "uploaded photo, uploaded video, tagged in video, posted note, tagged in note, posted link"
174 // Added "block app" and "allow app" links for "started using app" type messages
175 // Added Import and Export Settings functionality.
176 // Fixed loss of settings when user clears Firefox's cookies
177 // 3.6a 7thOct2010 Fixed bug with Firefox settings recovery system
178 // 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
179 // 3.8 20thOct2010 Added options to hide the "questions box", "events box" and "requests box"
180 // 3.8.1 27thOct2010 Fixed: "started using app filter", "hide request box code", added Sony Ericsson X10 mini pro to default application whitelist
181 // 3.8.2 29thOct2010 Fixed: Whitelist + Block App buttons were no longer showing due to a change in facebooks code.
182 // 3.8.3 3rdNov2010 Fixed: Whitelist + Block App buttons were no longer showing due to a change in facebooks code.
183 // Added Yahoo + Sony Ericsson + Vlingo to default whitelist
184 // Added WL (whitelist + BA (Block App) links for messages posted by applications masquerading as "normal" fb status updates
185 // 3.9.0 4thNov2010 Added font size option
186 // 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
187 // 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
188 // 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)
189 // Altered more font classes to give a more uniform font size across the site. Added Droid + Dell Mobile to default app whitelist
190 // 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
191 // 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
192 // 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
193 // 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
194 // 4.1.0 18thJan2011 NEW: Application message filtering can now be turned off, NEW: Can now block multiple applications at the same time
195 // 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
196 // 4.3.0 27thJan2011 "App + extra" filtering now works on profile pages, tweaked blockallapp function a little bit (scroll to top, single app block)
197 // 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
198 // 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.
199 // 4.4.0 17thMar2011 fixed commenting ( hitting return/enter in the textarea no longer submits comments, also added comment button back for comments )
200 // 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
201 // 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)
202 // 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.
203 // 4.5.1 21stApr2011 Fixed for new Relationship stories and new "Is Using Application" stories
204 // 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
205 // 4.5.3 23rdJun2011 fixed fb places checkin anomaly, merged new "commented on a website" story type with "commented on link"
206 // 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
207 // 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
208 // 5.2.0 21stSep2011 fixed for new newsfeed
209 // 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.
210 // 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
211 // 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.
212 // 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
213 // 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
214 // 6.4.0 24thDec2011 Fixed filtering to work with international versions of FB, various other fixes.
215 // 6.4.1 26thDec2011 Fixed FB for IE7 Spoofing (to help with disabling Timeline)
216 // 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.
217 // 6.4.3 19thJan2012 Fixed story filtering
218 // 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
219 // 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"
220 // 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
221 // 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
222 // 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
223 // 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
224 // 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
225 // 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
226 // 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
227 // 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
228 // 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
229 // 7.5.2 14thJun2012 Fixed various extra filters including ('shared photo' and 'uploaded photo'), fixed news article redirects and hide "trending articles / trending videos"
230 // 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
231 // 7.6.1 1stAug2012 Fixed hide sponsored box
232 // 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.
233 // 7.8.0 7thSep2012 Fixed the user settings, so facebook cant delete them
234 // 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
235 // 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
236 // Fixed TL button showing incorrect state after login
237 // 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
238 // 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
239 // 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
240 // 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
241 // 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
242 // 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
243 // 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.
244 // 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
245 // 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
246 // 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.
247 // 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
248 // 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
249 // 8.5.3 19thAug2013 Fixed Display of FBP info bar + filtering functionality for some users
250 // 8.6.1 23rdAug2013 Faster start up and CSS loading, fixed hide pokes and hide emoticons, fixed intermittent functioning of "restore comment button" option, and intermittent functioning of "fix external link redirection" options
251 // 8.7.0 12thSep2013 Updated FB Gift hiding option, Added "hide tagged in status" option, added app and game filtering in the news ticker to the hide "app / game messages" filter, updated hide sponsored box filter to also hide "similar to" box, updated hide gifts option
252 // (C) stephen fernandez 2009-2013 http://www.fbpurity.com
253
254 // If you like F.B. Purity please donate, big or small donations, anything is welcome
255 // http://donate.fbpurity.com
256
257 (function() {
258
259 var fbpVersion = "v8.7.0";
260 var debug=0;
261
262 var fbpoptsobj = {}; // object to store the preferences etc
263 try {
264 if (window.top!=window.self) // dont run on framed pages
265 if(!window.location.href.match(/connect\/uiserver\.php\?/)) // but allow it to work on embedded permissions pages
266 return;
267 }
268 catch (e) {
269 ; //return;
270 //alert('caught error ' + e.message);
271 //unsafeWindow.console.log(e);
272 }
273
274 // only run on actual facebook pages
275 try {
276 if(!window.location.hostname.match(/facebook\.com$/))
277 return;
278 }
279 catch(e) {
280 ;
281 //alert('caught error ' + e.message);
282 //unsafeWindow.console.log(e);
283 }
284
285 // set browser type
286 var ischrome=(typeof(chrome)!='undefined' && chrome.extension);
287 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\./));
288 //var isopera=window.navigator.userAgent.match(/Opera/);
289 try {
290 var isopera=(typeof(widget) && typeof(widget.preferences));
291 }
292 catch(e) {
293 var isopera=0;
294 }
295 var isasync=(ischrome || issafari);
296
297 //if(unsafeWindow)
298 // console.log=unsafeWindow.console.log;
299
300 //check if another version of the script is running at the same time and if so give a warning.
301 if(document.getElementById('fbpoptslink')) {
302 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>)';
303 if(document.getElementById('fbperrormsg'))
304 document.getElementById('fbperrormsg').innerHTML=collisionerrormsg;
305 else
306 window.alert(collisionerrormsg);
307 }
308
309 var fbpstyle=document.createElement('style');
310 var hashead=document.getElementsByTagName('head').length;
311
312 var fbpfreestyle=document.createElement('style'); // for setting a "global" font etc
313 fbpfreestyle.setAttribute('id','fbpfreestyler');
314 fbpfreestyle.setAttribute('type','text/css');
315
316 /*if(hashead)
317 document.getElementsByTagName('head')[0].appendChild(fbpfreestyle);
318 */
319 var fbpboxstyle=document.createElement('style'); // for setting whether boxes are on or off
320 fbpboxstyle.setAttribute('id','fbpboxstyler');
321 fbpboxstyle.setAttribute('type','text/css');
322 /* if(hashead)
323 document.getElementsByTagName('head')[0].appendChild(fbpboxstyle);
324 */
325 var fbpcssstyle=document.createElement('style'); // for adding the user's Custom CSS and general css stuff
326 fbpcssstyle.setAttribute('id','fbpcssstyler');
327 fbpcssstyle.setAttribute('type','text/css');
328 /*if(hashead)
329 document.getElementsByTagName('head')[0].appendChild(fbpcssstyle);
330 */
331 var fbptlstyle=document.createElement('style');
332 fbptlstyle.setAttribute('id','fbptlstyle');
333 fbptlstyle.setAttribute('type','text/css');
334 /*if(hashead)
335 document.getElementsByTagName('head')[0].appendChild(fbptlstyle);
336 */
337
338 fbpescaperegex = function(str){
339 // 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 )
340 var replacements = {
341 '(': '\\(',
342 ')': '\\)',
343 '[': '\\[',
344 ']': '\\]',
345 '{': '\\{',
346 '}': '\\}'
347 }
348 var ret = this;
349 try {
350 for(key in replacements) {
351 str = str.replace('' + key, replacements[''+ key],'g');
352 }
353 }
354 catch(e) {
355 ; // do nothing, traps an error found in ff 4.0b5
356 }
357 return str;
358 };
359
360 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,likepagebutton,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,trendingbox';
361
362 // new left column options = lcadvertmgr,lcconnect,lcallpages,lcpagesfeed,lclikepages,lcallapps,lcappcenter,lcevents,lcgamesfeed,lcpokes,lcmusic,lcplaceseditor,lcallgroups,lcallinterests,lccreategroup,lccreatepage,lcfindfriends,lcdeveloper,lcfriends
363 // new right column options = rcrecommendedpages,rcrelatedgroups,rcpokes,rcbirthdays,rcfriendrequests,rcgamerequests
364 var fbpoptsarr=fbpoptslist.split(',');
365
366 var optsdiv=document.createElement('div');
367 optsdiv.setAttribute('id','fbpoptsdiv');
368 optsdiv.style.zIndex='155'; //99 (change to 155 to go above drag image box
369 optsdiv.style.position='absolute';
370 optsdiv.style.left='100px'; //143 //150px
371 optsdiv.style.top='1px'; //42px
372 optsdiv.style.background='white';
373 optsdiv.style.border='3px solid black';
374 optsdiv.style.display='none';
375
376 var fbptips=[
377 '<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>',
378 '<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>',
379 '<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>',
380 '<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>.',
381 '<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>.',
382 '<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>.',
383 '<br/>&nbsp;<b>FBP Tip</b>: If you hover your mouse over any of the options on the FBP options screen, extra information about that option is usually displayed.'
384 ];
385
386 var fbpoptshtml= '<div style="float:left;"><table style="top:0px"><tr>'+
387 '<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>'+
388 '<td width="800" valign="top">' +
389 '<h2 style="display:inline" class="uiHeaderTitle">F.B. Purity ' + fbpVersion + ' Options</h2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;' +
390 '<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>'+
391
392 //'<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>'+
393 '<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>'+
394 '<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>'+
395 '</tr></table></div>'+
396
397 // <object align="middle" type="text/html" data="https://www.facebook.com/connect/connect.php?id=408502197558&connections=0&stream=0" width="275" height="65"/>
398 // <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>
399
400 '<div style="clear:both"></div>'+
401 '<table><tr><td valign="top">';
402
403 // add new dynamic opts
404 function optionsbox(mode) {
405 var table, rowstyle;
406 this.rownum=1;
407 if(1) // ischrome doesnt work in safari
408 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>';
409 else
410 var openallboxes='';
411 if (typeof mode !='undefined' && mode=='extras') {
412 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>';
413 }
414 else
415 //this.table="<table width='100%'>";
416 this.table="";
417
418 // Use tbody to group tables instead of divs ! !!! ! :)
419 this.tableHeader = function (title, hint, varname) {
420 //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>';
421 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">';
422 }
423 this.addTableRow = function(title,hint,varname,inputtype) {
424 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>";
425 }
426 this.tableFooter =function(){
427 //this.table+="</table></div></td></tr></table>";
428 this.table+="</tbody>";
429 }
430 this.buildTable =function(endmode){
431 if(typeof endmode=='undefined')
432 return this.table;
433 else
434 return this.table + '</table>';
435 }
436 }
437
438 newoptscolumn='';
439
440 // Various Options
441 v = new optionsbox('extras');
442 v.tableHeader('Various Story Types','Hide Various story types from the newsfeed', 'variousopts');
443 v.addTableRow('Fan Page Stories','Hide stories posted by Pages you have liked from the newsfeed','pagestory', 'checkbox');
444 v.addTableRow('Trending Articles / Videos','Hide Trending Articles / Trending Videos / Most Shared on / Recent Articles About stories from the newsfeed','readarticle', 'checkbox');
445 v.addTableRow('Facebook Questions','Hide Facebook Questions stories','questionsbox','checkbox');
446 v.addTableRow('Became Friends','Hide Became Friends stories from the newsfeed','becamefriends','checkbox');
447 v.addTableRow('Changed Relationship','Hide Changed Relationship stories from the newsfeed','changedrelationship', 'checkbox');
448 v.addTableRow('Changed Location','Hide Changed Location (Check-in) Stories','checkedin','checkbox');
449 v.addTableRow('Updated Profile Info','Hide Updated Profile Stories','updatedprofile','checkbox');
450 v.addTableRow('Joined a Group','Hide Joined Group Stories (and other group related stories)','joinedgroup','checkbox');
451 v.addTableRow('Posted Note','Hide Posted Note Stories','postednote','checkbox');
452 v.addTableRow('Tagged in Note','Hide Tagged in Note Stories','taggedinnote','checkbox');
453 v.tableFooter();
454 newoptscolumn+=v.buildTable();
455
456 // Event Options
457 v=null
458 v= new optionsbox();
459 v.tableHeader('Event Stories','Hide event stories from the newsfeed', 'eventopts');
460 v.addTableRow('Upcoming Events','Hide Upcoming Events / Upcoming Concerts','upcomingevents','checkbox');
461 v.addTableRow('Attending Event','Hide Attending Event','attendevent','checkbox');
462 v.addTableRow('Attended Event','Hide Attended Event','attendedevent','checkbox');
463 v.addTableRow('Created Event','Hide Created Event','createdevent','checkbox');
464 //v.addTableRow('Liked Event','Hide Liked Events','likedevent','checkbox');
465 v.addTableRow('Shared Event','Hide Shared Events','sharedevent','checkbox');
466 v.tableFooter();
467 newoptscolumn+=v.buildTable();
468
469 // Link / Page Options
470 v=null;
471 v = new optionsbox();
472 v.tableHeader('Link / Page Stories','Hide Link / Page stories from the Newsfeed', 'linkopts');
473 //v.addTableRow('Hide All External Links','All External Links from the Newsfeed','hidealllinks', 'checkbox');
474 v.addTableRow('Liked Page','Hide Liked Page Stories','becamefan','checkbox');
475 v.addTableRow('Shared Page','Hide Shared Page Stories','sharedpage','checkbox');
476 v.addTableRow('Liked Link','Hide Liked Link Stories','likedlink','checkbox');
477 v.addTableRow('Shared Link','Hide Shared Link Stories from the Newsfeed','postedlink','checkbox');
478 v.addTableRow('Commented on Link','Hide Commented on Link Stories','commentedlink','checkbox');
479 v.addTableRow('&quotLike Page&quot; buttons','Hide the &quot;Like Page&quot; buttons from shared items in the newsfeed','likepagebutton','checkbox');
480 v.tableFooter();
481 newoptscolumn+=v.buildTable();
482
483 // Photo Options
484 v=null;
485 v = new optionsbox();
486 v.tableHeader('Photo Stories','Hide photo stories from the newsfeed', 'photoopts');
487 v.addTableRow('Hide All Photos','Hide All Photo stories from the newsfeed','hideallphotos', 'checkbox');
488 v.addTableRow('Shared Photo','Hide Shared Photo / Album stories from the newsfeed','sharedphoto','checkbox');
489 v.addTableRow('Changed Profile Photo','Hide Updated Profile Picture / Cover Photo stories from the newsfeed','changedprofilepic', 'checkbox');
490 v.addTableRow('Uploaded Photo','Hide Added Photo Stories','uploadedphoto','checkbox');
491 v.addTableRow('Tagged in Photo','Hide Tagged in Photo / Album stories','taggedphoto','checkbox');
492 v.addTableRow('Liked Photo','Hide Liked Photo / Album stories','likedphoto','checkbox');
493 v.addTableRow('Commented on Photo','Hide Commented on Photo / Album stories','commentedphoto','checkbox');
494 v.tableFooter();
495 newoptscolumn+=v.buildTable();
496
497 // Video Options
498 v=null;
499 v = new optionsbox();
500 v.tableHeader('Video Stories','Hide Video stories from the Newsfeed', 'videoopts');
501 v.addTableRow('Hide All Videos','Hide All Video Stories from the newsfeed','hideallvideos', 'checkbox');
502 v.addTableRow('Shared Video','Hide Shared FB Video Stories from the newsfeed','sharedvideo','checkbox');
503 v.addTableRow('Uploaded Video','Hide Added Video Stories','uploadedvideo','checkbox');
504 v.addTableRow('Tagged in Video','Hide Tagged in Video Stories','taggedinvideo','checkbox');
505 v.addTableRow('Liked Video','Hide Liked Video Stories','likedvideo','checkbox');
506 v.addTableRow('Commented on Video','Hide Commented on Video Stories','commentedvideo','checkbox');
507 v.addTableRow('Youtube / Vimeo Videos','Hide Youtube and Vimeo Stories','youtubevideo','checkbox');
508 v.tableFooter();
509 newoptscolumn+=v.buildTable();
510
511 // Status // Wall Options
512 v=null;
513 v = new optionsbox();
514 v.tableHeader('Status / Wall Stories','Hide Status / Wall stories from the newsfeed', 'statusopts');
515 v.addTableRow('Shared Status','Hide Shared Status Stories','sharedstatus','checkbox');
516 v.addTableRow('Liked Status','Hide Liked Status Stories','likedstatus','checkbox');
517 v.addTableRow('Commented on Status','Hide Commented on Status stories','commentedstatus','checkbox');
518 v.addTableRow('Tagged in Status','Hide Tagged in Status Stories','taggedstatus','checkbox');
519 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');
520 v.tableFooter();
521 newoptscolumn+=v.buildTable('complete');
522
523 // end new options layout
524 fbpoptshtml += newoptscolumn ;
525
526 fbpoptshtml += '</td><td valign="top">'+
527 '<table><tr><td valign="top"><b>More Options</b></td><td valign="top"><b>Hide</b></td><td rowspan="20" width="12"></td><td valign="top" rowspan="20" width="405"> ' +
528 // new custom text filter/ css / app whitelist tabs
529 '<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> - ' +
530 '<span id="appwhitelistheader"><a title="Click to access the Application Whitelist" href="#">Application Whitelist</a></span> - ' +
531 '<span id="custcssheader"><a title="Click to access the Custom CSS BOX" href="#">Custom CSS</a></span><br/>' +
532 '<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>' +
533 '<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>' +
534 //(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>') +
535
536 fbptips[Math.floor(Math.random() * fbptips.length)] +
537
538 '<br/><div id="fbpnewsdiv"></div>'+
539 '</td></tr>'+
540
541 '<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>'+
542 '<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>'+
543 '<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>'+
544 //'<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>'+
545 '<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>'+
546 '<tr><td><label style="color:black;font-weight:normal" for="chatbox">Chat Box</label></td><td><input id="chatbox" type="checkbox"></td></tr>'+
547 '<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>'+
548 '<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>'+
549 '<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>'+
550 '<tr title="Hide the Trending Topics / Hashtags box"><td><label style="color:black;font-weight:normal" for="trendingbox">Trending Topics / Hashtags</label></td><td><input id="trendingbox" type="checkbox"></td></tr>'+
551 '<tr style="display:none"><td>Beta Tester Box</td><td><input id="betabox" type="checkbox"></td></tr>'+
552
553 '<tr><td><b>Further Options</b></td><td><b>Set</b></td></tr>'+
554 '<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>'+
555 '<tr title="Makes external links go directly to the site rather than being intercepted and tracked by Facebook first"><td><label style="color:black;font-weight:normal" for="fixarticleredirects">Fix External Link Redirection</label></td><td><input id="fixarticleredirects" type="checkbox"></td></tr>'+
556 '<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>'+
557 '<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">Freeze Left Column in Place</label></td><td><input id="fixedleftcolumn" type="checkbox"></td></tr>'+
558 '<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>'+
559
560 // right column links options
561 '<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>'+
562
563 // left column links options
564 '<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>'+
565
566 // fonts and colours section
567 '<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>'+
568 '<table id="fontColorSection" style="display:none">' +
569 '<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" type="color"></td><td><input id="fontbgcolourfix" type="checkbox"></td></tr>' +
570 '<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" type="color"></td><td><input id="fontcolourfix" type="checkbox"></td></tr>' +
571 '<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 of a font you have installed on your computer. (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>' +
572 '<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>' +
573 '</table></td></tr>'+
574
575 '</table>' +
576
577 '<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">'+
578 '<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>' +
579
580 '<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>'+
581 '<br/><form><textarea id="fbpsettingstext" style="display:none"></textarea></form></td></tr></table>'+
582 '<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>';
583
584 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">'+
585 '<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>'+
586 '<br/>'+
587 '<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>'+
588 '<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>' +
589 '<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>'+
590 '<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>'+
591 '<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>'+
592
593 '<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/>'+
594 '<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>'+
595 '<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>'+
596
597 '<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>'+
598 '<p>Thanks!</p>'+
599 '<p>Steve - The Developer of <a target="_blank" href="http://www.fbpurity.com">F.B. (Fluff Busting) Purity</a></p>'+
600 '<table width="100%"><tr><td style="text-align:center"><a onclick="document.getElementById(\'fbpfirstrundiv\').style.display=\'none\'" href="#">Close</a></td></tr></table></div>'+
601 '</div>';
602
603 function hideotherdivs(e) {
604 divname=e.target.parentNode.id.split(/header/)[0];
605 var boxlist="custext,appwhitelist,custcss";
606 boxarr=boxlist.split(',');
607 for (i in boxarr)
608 if(boxarr[i]==divname) {
609 document.getElementById(divname + "header").setAttribute('style','background:#ECEFF5; font-weight:bold; font-size:15; border:1 solid');
610 document.getElementById(divname + "desc").setAttribute('style','display:block;background:#ECEFF5;');
611 document.getElementById(divname + "ta").setAttribute('style','display:block;width:404px;height:275px');
612 }
613 else {
614 document.getElementById(boxarr[i] + 'header').setAttribute('style','background:white;font-weight:normal;font-size:14;border:0');
615 document.getElementById(boxarr[i] + 'desc').setAttribute('style','display:none');
616 document.getElementById(boxarr[i] + 'ta').setAttribute('style','display:none;');
617 }
618 }
619
620 function importsettingsbasic(ev) {
621
622 ev.preventDefault();
623 fbpsettingstext=prompt('F.B. Purity Settings Importer\n\nPaste in your saved FBP settings text, then click OK.')
624
625 if(fbpsettingstext==null)
626 return;
627
628 if(!fbpsettingstext.length) {
629 window.alert('You didnt enter valid settings text');
630 return;
631 }
632 else {
633 try {
634 JSON.parse(fbpsettingstext);
635 }
636 catch(e) {
637 window.alert('Error, settings text malformed, not valid. Import failed!');
638 return;
639 }
640 fbpsavevalue('fbpoptsjson-' + currentuserid,fbpsettingstext);
641
642 window.alert('Import Successful. FBP Settings have been updated! Page will now reload.');
643
644 //close prefs screen
645 document.getElementById('fbpoptsdiv').style.display='none';
646
647 //reload page to refresh preferences
648 window.location.reload(true);
649 }
650 }
651
652 function exportsettingsbasic(ev) {
653 ev.preventDefault();
654 exportsettingsbasic2();
655 }
656
657 // figure out how to use callbacks, may be a better solution here....
658
659 function exportsettingsbasic2(opts) {
660 document.getElementById('fbpsettingstext').setAttribute('style','display:block;width:600px;height:220px');
661 var exporttext;
662 if(!opts && opts!='') {
663 exporttext=fbploadvalue('fbpoptsjson-' + currentuserid,exportsettingsbasic2);
664 if(exporttext==-999)
665 return
666 }
667 else
668 exporttext=opts;
669
670 if ((typeof(exporttext)=='undefined') || (exporttext.length =="")) {
671 exporttext=fbploadvalue('fbpoptsjson',exportsettingsbasic2);
672 if(exporttext==-999)
673 return;
674 }
675 document.getElementById('fbpsettingstext').textContent=exporttext;
676
677 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.');
678 // autoselect the text in the textarea
679 el=document.getElementById('fbpsettingstext');
680 var range;
681 if ((/textarea/i.test(el.tagName)) || ((/input/i.test(el.tagName)) && (/text/i.test(el.type)))) {
682 el.select();
683 } else if (!!window.getSelection) { // FF, Safari, Chrome, Opera
684 var sel = window.getSelection();
685 range = document.createRange();
686 range.selectNodeContents(el);
687 sel.removeAllRanges();
688 sel.addRange(range);
689 } else if (!!document.selection) { // IE
690 document.selection.empty();
691 range = document.body.createTextRange();
692 range.moveToElementText(el);
693 range.select();
694 }
695 }
696
697 function get_cookie ( cookie_name )
698 {
699 var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
700 if ( results )
701 return ( unescape ( results[2] ) );
702 else
703 return null;
704 }
705
706 function set_cookie (name,value) {
707 document.cookie = name+ "=" + escape(value)+ ';expires=01/04/2099 00:00:00';
708 }
709
710 // check for GM_set/get API
711 var isgmapi, islocstor;
712 try {
713 if(typeof(GM_setValue)!='undefined') {
714 GM_setValue('test',1);
715 if ( GM_getValue('test')==1)
716 isgmapi=1;
717 else
718 isgmapi=0;
719 }
720 else
721 isgmapi=0;
722 }
723 catch (e) {
724 console.log(e);
725 isgmapi=0;
726 }
727 // check for localstorage
728 try {
729 if(typeof(window.localStorage)!='undefined')
730 islocstor=1;
731 else
732 islocstor=0;
733 }
734 catch(e) {
735 islocstor=0;
736 }
737
738 function fbpsavevalue(name,value){
739 try {
740 if(isgmapi) {
741 GM_setValue(name,value);
742 }
743 else if(ischrome) { // ischrome
744 chrome.extension.sendRequest({method: "setLocalStorage", key: name, value: value}, function(response) {
745 ;//console.log(response.data);
746 });
747 }
748 else if(issafari) { //(typeof(window.navigator.vendor)!='undefined') && (window.navigator.vendor.match(/Apple Computer, Inc\./)) && window.navigator.userAgent.match(/Version\/5\./)
749 safari.self.tab.dispatchMessage("setLocalStorage",{key: name, value: value});
750 /*function replyToMessage(response) {
751 if (response.name === "data") {
752 console.log('safari save value response:' + response.message);
753 //if((typeof(response.message) !='undefined') && response.message.match(/\"filterappmessages\"/)) {
754 // window.localStorage[name]=response.message;
755 // window.location.reload();
756 //}
757 }
758 }*/
759 // register for message events
760 //safari.self.addEventListener("message", replyToMessage, false);
761 }
762 else if(isopera) { //window.navigator.userAgent.match(/Opera/)
763 widget.preferences[name]=value;
764 }
765 /* 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*/
766 else if(islocstor) {
767 window.localStorage[name]=value;
768 }
769 else
770 set_cookie(name,value);
771
772 }
773 catch (e) {
774 //console.log(e);
775 if(islocstor)
776 window.localStorage[name]=value;
777 else
778 set_cookie(name,value);
779 }
780 }
781
782 function fbploadvalue(name,funct){
783 if(debug)
784 console.trace();
785 //console.log('entering function : ' + arguments.callee.name);
786
787 try {
788 if(isgmapi) {
789 val = GM_getValue(name);
790 }
791 else if(ischrome) {
792 // Chrome Extension
793 chrome.extension.sendRequest({method: "getLocalStorage", key: name}, function(response) {
794 //fbpdynamicreload(response.data); // we should maybe figure a way of doing this event driven
795 if(funct) {
796 if(debug)
797 console.log("we in call back, and heres the data: " + response.data);
798 if((typeof(response)=='undefined') || (typeof(response.data)=='undefined'))
799 funct('');
800 else
801 funct(response.data);
802 }
803 });
804 val=-999;
805 if(debug)
806 console.log('name: ' + name + ' value' + val);
807 }
808 else if(issafari) {
809 // Safari Extension
810 safari.self.tab.dispatchMessage("getLocalStorage",name);
811 function replyToMessage(response) {
812 if(debug)
813 console.log(response.message);
814 if(funct) {
815 if(debug)
816 console.log("we in call back, and heres the data: " + response.message);
817 if(typeof(response.message)=='undefined')
818 funct('');
819 else
820 funct(response.message);
821 }
822 }
823 // register for message events
824 safari.self.addEventListener("message", replyToMessage, false);
825 val=-999;
826 }
827 else if(isopera) {
828 if((typeof(widget.preferences[name]) !='undefined') ) {
829 val = widget.preferences[name];
830 //fbpdynamicreload();
831 }
832 else val='';
833 }
834 else if(islocstor)
835 val=window.localStorage[name];
836 else
837 val=get_cookie(name);
838 }
839 catch (e) {
840 console.log(e);
841 if(islocstor)
842 val=window.localStorage[name];
843 else
844 val=get_cookie(name);
845 }
846 return val;
847 }
848
849 function initundef() {
850 if(typeof (fbpoptsobj.filterappmessages) =='undefined')
851 fbpoptsobj.filterappmessages=1;
852 if(typeof (fbpoptsobj.sortmostrecent) =='undefined')
853 fbpoptsobj.sortmostrecent=0;
854 if(typeof (fbpoptsobj.fixarticleredirects) =='undefined')
855 fbpoptsobj.fixarticleredirects=1;
856 }
857
858 function fbpgetprefs(opts) {
859 if(debug) {
860 console.trace();
861 console.log(arguments.callee.length);
862 console.log(opts);
863 //console.log('entering function : ' + arguments.callee.name);
864 }
865
866 var optsdump;
867 if(typeof(opts)!='undefined') {
868 if(opts && opts.length) {
869 if(debug)
870 console.log("opts=" + opts);
871 optsdump=opts;
872 try {
873 fbpoptsobj=JSON.parse(optsdump);
874 }
875 catch(e) {
876 console.log('error reading json in fbpgetprefs');
877 console.dir(e);
878 return;
879 }
880 initundef();
881 initstage2();
882 finalstage();
883 }
884 else {
885 if(debug)
886 console.log('are we at the top?');
887 if(!issafari) // because getting vars out of localstorage is not working in safari, we not checking for first run
888 fbpfirstruncheck();
889 fbpoptsobjinit();
890 initundef();
891 initstage2();
892 finalstage();
893 }
894 }
895 else {
896 //console.log("user" + currentuserid);
897 optsdump = fbploadvalue('fbpoptsjson-' + currentuserid,fbpgetprefs);//'fbpgetprefs'
898 if(optsdump!=-999) { //if(!isasync) {
899 if(optsdump && optsdump.length) {
900 try{
901 fbpoptsobj=JSON.parse(optsdump);
902 }
903 catch(e) {
904 fbpoptsobj=JSON.parse(decodeURIComponent(optsdump)); // this line is to make it compatible with older firefox extension which urlencoded/decoded saved values inside the extension
905 }
906 initundef();
907 initstage2();
908 finalstage();
909 }
910 else {
911 if(debug)
912 console.log('are we at the bottom?');
913 if(!issafari) // because getting vars out of localstorage is not working in safari, we not checking for first run
914 fbpfirstruncheck();
915 fbpoptsobjinit();
916 initundef();
917 initstage2();
918 finalstage();
919 }
920 }
921 }
922 //unsafeWindow.console.log(typeof(optsdump) + ' xxx ' + optsdump + 'xxx' + optsdump.length);
923 }
924
925 function fbpfirstruncheck(result) {
926
927 if(debug) {
928 console.trace();
929 console.log('firstrun? ' + result);
930 }
931 //console.log('entering function : ' + arguments.callee.name);
932 var fbpfirstrun;
933 //alert("firstres = " + result);
934 //if(result || (result=='')) { was working on chrome and firefox and opera?
935 if(typeof(result)!='undefined') {
936 fbpfirstrun=result;
937 }
938 else
939 fbpfirstrun=fbploadvalue('fbpfirstrun',fbpfirstruncheck);
940 if(fbpfirstrun==-999)
941 return;
942
943 //alert("secondres = " + fbpfirstrun); // make sure user is logged in (pageLogo element is there)
944 if (((fbpfirstrun=='') || (typeof(fbpfirstrun)=='undefined') || (fbpfirstrun==null)) && (!(window.location.href.match(/^https?:\/\/apps\.facebook|^https?:\/\/blog\.facebook|^https?:\/\/secure\.facebook/)))) {
945 if(!document.getElementById('fbpfirstrundiv') && document.getElementById('blueBar') && document.getElementById('pageLogo')) {
946 ph=document.getElementById('blueBar'); //pageHead
947 firstrundiv=document.createElement('div');
948 firstrundiv.innerHTML=fbpfirstrunhtml;
949 if(ph.firstChild)
950 ph.firstChild.parentNode.insertBefore(firstrundiv, ph.firstChild.nextSibling);
951 fbpsavevalue('fbpfirstrun',new Date() + "");
952 }
953 }
954 }
955
956 function checkifupdaterequired(currver,latestver) {
957 if(debug)
958 console.trace();
959 //console.log('entering function : ' + arguments.callee.name);
960
961 if (currver && latestver) {
962 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>** ";
963 if (currver==latestver)
964 return; //window.alert('Congrats! You have the latest version of FB Purity :)');
965 else {
966 cvpart1=currver.split(/\./)[0];
967 cvpart2=currver.split(/\./)[1];
968 cvpart3=currver.split(/\./)[2];
969 lvpart1=latestver.split(/\./)[0];
970 lvpart2=latestver.split(/\./)[1];
971 lvpart3=latestver.split(/\./)[2];
972 if(cvpart1<lvpart1) {
973 if(document.getElementById('fbpupgradeinfo'))
974 document.getElementById('fbpupgradeinfo').innerHTML=fbpupdatehtml;
975 }
976 else if (cvpart1 == lvpart1) {
977 if(cvpart2 < lvpart2) {
978 if(document.getElementById('fbpupgradeinfo'))
979 document.getElementById('fbpupgradeinfo').innerHTML=fbpupdatehtml;
980 }
981 else if (cvpart2 == lvpart2) {
982 if(cvpart3 < lvpart3)
983 if(document.getElementById('fbpupgradeinfo'))
984 document.getElementById('fbpupgradeinfo').innerHTML=fbpupdatehtml;
985 }
986 }
987
988 }
989 }
990 }
991
992 function checkupdatefeed(result) {
993 if(debug)
994 console.trace();
995 //console.log('entering function : ' + arguments.callee.name);
996
997 var fbplastupdatecheck;
998 if(result || (result=='')) {
999 if(debug)
1000 console.log('fbplastupdatecheck val = ' + result);
1001 fbplastupdatecheck=result;
1002 if(typeof(fbplastupdatecheck)=='undefined')
1003 fbplastupdatecheck='';
1004 }
1005 else
1006 fbplastupdatecheck=fbploadvalue('fbplastupdatecheck',checkupdatefeed);
1007 if(fbplastupdatecheck==-999)
1008 return;
1009
1010 if(debug)
1011 console.log('fbplastupdate=' + fbplastupdatecheck);
1012
1013 var currtime = new Date().getTime(); // creates a new Date representing today
1014 var currver = fbpVersion.replace('v','');
1015
1016 if( (typeof(fbplastupdatecheck)!='undefined') && (fbplastupdatecheck != '') && (fbplastupdatecheck!=null)) {
1017 var fbplastupdatecheckdate=fbplastupdatecheck.split(/\:/)[0];
1018 var fbplastupdatecheckver=fbplastupdatecheck.split(/\:/)[1];
1019 if((typeof(fbplastupdatecheckver) !='undefined') && (!fbplastupdatecheckver.match(/\./)))
1020 fbplastupdatecheckver='';
1021 if(debug)
1022 console.log('lastupdate check version= '+ fbplastupdatecheckver);
1023 if((typeof(fbplastupdatecheckdate) !='undefined') && fbplastupdatecheckdate.match(/^\d+$/)) {
1024 //To compute the difference, convert both to their millisecond representations and subtract:
1025 var diff = currtime - fbplastupdatecheckdate;
1026 //In this case the difference will be negative, as d1 preceeds d2.
1027 var num_days = (((diff / 1000) / 60) / 60) / 24;
1028 if(num_days < 1) {
1029 //var cachedupdatever=fbploadvalue(fbpupdatever);
1030 if((typeof(fbplastupdatecheckver)!='undefined') && (fbplastupdatecheckver != ''))
1031 checkifupdaterequired(currver,fbplastupdatecheckver);
1032 return;
1033 }
1034 }
1035 else {
1036 // time value is corrupted somehow?
1037 if (typeof(unsafeWindow) =='undefined')
1038 ;//console.log('error: fbplastupdatecheck= ' + fbplastupdatecheck);
1039 else
1040 ;//unsafeWindow.console.log('error: fbplastupdatecheck= ' + fbplastupdatecheck);
1041 return;
1042 }
1043 }
1044
1045 //fbpsavevalue('fbplastupdatecheck',currtime + '');
1046 var http = new window.XMLHttpRequest();
1047 var url = window.location.protocol + "//www.facebook.com/feeds/page.php?id=186105101490362&format=json"; // https://www.facebook.com/pages/FB-Purity-Updates/186105101490362
1048 http.open("GET", url, true);
1049 //http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
1050 //http.setRequestHeader("Content-length", params.length);
1051 //http.setRequestHeader("Connection", "close");
1052
1053 http.onreadystatechange = function() {
1054 if(http.readyState == 4 && http.status == 200) {
1055 //console.log(http.responseText);
1056 try {
1057 var fbpfeed = JSON.parse(http.responseText);
1058 }
1059 catch (e) {
1060 http=fbpfeed=null;
1061 return;
1062 }
1063 if(fbpfeed.entries[0].title.length && fbpfeed.entries[0].title.match(/F.B. Purity v(\d{1,}\.\d{1,}\.\d{1,}) /))
1064 latestver=fbpfeed.entries[0].title.match(/F.B. Purity v(\d{1,}\.\d{1,}\.\d{1,}) /)[1];
1065 else
1066 return;
1067 //var x = new Date (fbpfeed.entries[0].published);
1068 //newsa.setAttribute('title', "Published - " + x.toLocaleDateString());
1069 //alert(currver + ' ' + latestver);
1070 fbpsavevalue('fbplastupdatecheck', currtime + ':' + latestver);
1071 checkifupdaterequired(currver,latestver);
1072 http=null;
1073 }
1074 }
1075 http.send();
1076 }
1077
1078 if (!issafari) // workaround for bug in message passing in safari extension for getting fbpprefs (the messages were crossing over to the wrong locations)
1079 window.setTimeout(function() {
1080 checkupdatefeed();
1081 }, 3000); // wait a bit, to insure fbpinfobar will be there...
1082
1083
1084 function fbppopulateprefs() {
1085 if(debug)
1086 console.trace();
1087 //console.log('entering function : ' + arguments.callee.name);
1088
1089 // if options screen has been wiped out, re-insert it
1090 if(!document.getElementById('fbpoptsdiv') && document.getElementById('content') ) {
1091 document.getElementById('content').appendChild(optsdiv);
1092 document.getElementById('fbpsavesettings').addEventListener('click',fbpsavesettings,false);
1093
1094 document.getElementById('exportsettingslink').addEventListener('click',exportsettingsbasic,false);
1095 document.getElementById('importsettingslink').addEventListener('click',importsettingsbasic,false);
1096
1097 document.getElementById('custextheader').addEventListener('click',hideotherdivs,false);
1098 document.getElementById('appwhitelistheader').addEventListener('click',hideotherdivs,false);
1099 document.getElementById('custcssheader').addEventListener('click',hideotherdivs,false);
1100 }
1101
1102 // fill out the preferences form with current settings
1103 for(var i=0;i<fbpoptsarr.length;i++) {
1104 if(document.getElementById(fbpoptsarr[i])) {
1105 if(fbpoptsobj[fbpoptsarr[i]]==1) {
1106 document.getElementById(fbpoptsarr[i]).checked=true;
1107 //unsafeWindow.console.log (filterapptext, fbpoptsarr[i] + ' ' + ' ' + fbpoptsobj[fbpoptsarr[i]]);
1108 }
1109 else
1110 document.getElementById(fbpoptsarr[i]).checked=false;
1111 }
1112 }
1113 if(fbpoptsobj.customtextfilter && fbpoptsobj.customtextfilter.length) {
1114 document.getElementById('custextta').value=fbpoptsobj.customtextfilter.replace(/\,/g,"\n");
1115 //unsafeWindow.console.log(fbpoptsobj.customtextfilter);
1116 }
1117 else
1118 document.getElementById('custextta').value='';
1119
1120 if(fbpoptsobj.userappwhitelist && fbpoptsobj.userappwhitelist.length) {
1121 document.getElementById('appwhitelistta').value=fbpoptsobj.userappwhitelist.replace(/\,/g,"\n");
1122 //unsafeWindow.console.log(fbpoptsobj.userappwhitelist);
1123 }
1124 else {
1125 document.getElementById('appwhitelistta').value='';
1126 }
1127
1128 if(fbpoptsobj.fontsize)
1129 document.getElementById('fontsize').value=fbpoptsobj.fontsize;
1130
1131 if(fbpoptsobj.fontcolour)
1132 document.getElementById('fontcolour').value=fbpoptsobj.fontcolour;
1133
1134 if(fbpoptsobj.fontbgcolour)
1135 document.getElementById('fontbgcolour').value=fbpoptsobj.fontbgcolour;
1136
1137 if(fbpoptsobj.fbpfont)
1138 document.getElementById('fbpfont').value=fbpoptsobj.fbpfont;
1139
1140 if(fbpoptsobj.fbpcustomcss && (typeof(fbpoptsobj.fbpcustomcss) != 'undefined')) {
1141 document.getElementById('custcssta').value=fbpoptsobj.fbpcustomcss;
1142 //unsafeWindow.console.log(fbpoptsobj.fbpcustomcss);
1143 }
1144 else
1145 document.getElementById('custcssta').value='';
1146 }
1147
1148 function fbpsavesettings(ev) {
1149
1150 for(var i=0;i<fbpoptsarr.length;i++) {
1151
1152 if(document.getElementById(fbpoptsarr[i]) && document.getElementById(fbpoptsarr[i]).checked==true)
1153 fbpoptsobj[fbpoptsarr[i]]=1;
1154 else
1155 fbpoptsobj[fbpoptsarr[i]]=0;
1156 }
1157
1158 if(document.getElementById('custextta').value.length) {
1159 //fbpoptsobj.customtextfilter=document.getElementById('customtextfilter').value.replace(/, *$/,'','g'); // replace trailing comma and spaces
1160 tempcustomtextfilter=document.getElementById('custextta').value.replace(/[\r\n|\r|\n]/g,"\,").replace(/\,{1,}/g,'\,').replace(/,$/,'').replace(/^,/,'');
1161 fbpoptsobj.customtextfilter='';
1162 ctfarr=tempcustomtextfilter.split(',');
1163 //for(i=ctfarr.length-1;i>=0;i--)
1164 for(i=0;i<ctfarr.length;i++)
1165 if (ctfarr[i].replace(/^ {1,}$/,'')!='')
1166 fbpoptsobj.customtextfilter+=ctfarr[i] + ','; // strip out lines that are just spaces.
1167
1168 fbpoptsobj.customtextfilter=fbpoptsobj.customtextfilter.replace(/,$/,''); // strip trailing comma
1169 // alert(fbpoptsobj.customtextfilter);
1170 }
1171 else
1172 fbpoptsobj.customtextfilter='';
1173
1174 if(document.getElementById('appwhitelistta').value.length) {
1175 fbpoptsobj.userappwhitelist=document.getElementById('appwhitelistta').value.replace(/ /g,'').replace(/[\r\n|\r|\n]/g,"\,").replace(/\,{1,}/g,'\,').replace(/,$/,'').replace(/^,/,'');
1176 //alert(fbpoptsobj.userappwhitelist);
1177 }
1178 else
1179 fbpoptsobj.userappwhitelist='';
1180
1181 // begin new custom css box
1182 if(document.getElementById('custcssta').value.length) {
1183 fbpoptsobj.fbpcustomcss=document.getElementById('custcssta').value;
1184 }
1185 else
1186 fbpoptsobj.fbpcustomcss='';
1187 // end new custom css box
1188
1189 fbpoptsobj.fontsize=document.getElementById('fontsize').value;
1190 fbpoptsobj.fontcolour=document.getElementById('fontcolour').value;
1191 fbpoptsobj.fontbgcolour=document.getElementById('fontbgcolour').value;
1192 fbpoptsobj.fbpfont=document.getElementById('fbpfont').value;
1193
1194 //save to prefs obj to localstorage
1195 fbpsavevalue('fbpoptsjson-' + currentuserid, JSON.stringify(fbpoptsobj));
1196
1197 //console.log(JSON.stringify(fbpoptsobj));
1198
1199 //close prefs screen
1200 document.getElementById('fbpoptsdiv').style.display='none';
1201
1202 //reload page to refresh preferences
1203 window.location.reload(true);
1204
1205 // Dynamically update the page instead of reloading the whole page, only problem is if the page contains many posts, this is very slow.
1206 /*
1207 document.getElementById("fbpsavesettings").disabled=false;
1208 fbpgetprefs();
1209 resetclasses(); // need to also reset other filters and css
1210 initstage2();
1211 //updateblockedcount(); // doesnt seem to do anything and clear the shizzle, should automatically update it. (we are getting nodes with 2 classes fbpnormal and fbpblocked
1212 cleartheshizzle(document);
1213 */
1214 }
1215
1216 function fbpoptsobjinit() {
1217 if(debug)
1218 console.trace();
1219 //console.log('entering function : ' + arguments.callee.name);
1220
1221 // set up default options
1222 fbpoptsobj.filterappmessages=1;
1223 fbpoptsobj.becamefriends=1;
1224 fbpoptsobj.becamefan=1;
1225 fbpoptsobj.joinedgroup=1;
1226 fbpoptsobj.attendevent=1;
1227 fbpoptsobj.attendedevent=1;
1228 fbpoptsobj.createdevent=0;
1229
1230 fbpoptsobj.commentlikeslink=0;
1231 fbpoptsobj.commentwall=0;
1232 fbpoptsobj.commentgroupwall=0;
1233 fbpoptsobj.commentpagewall=0;
1234 fbpoptsobj.commenteventwall=0;
1235 fbpoptsobj.updatedprofile=0;
1236 fbpoptsobj.changedprofilepic=0;
1237 fbpoptsobj.changedrelationship=0;
1238
1239 fbpoptsobj.uploadedphoto=0;
1240 fbpoptsobj.sharedphoto=0;
1241 fbpoptsobj.uploadedvideo=0;
1242 fbpoptsobj.taggedinvideo=0;
1243 fbpoptsobj.postednote=0;
1244 fbpoptsobj.taggedinnote=0;
1245 fbpoptsobj.postedlink=0;
1246 fbpoptsobj.readarticle=0;
1247 fbpoptsobj.checkedin=0;
1248
1249 fbpoptsobj.suggestionsbox=0;
1250 fbpoptsobj.connectbox=0;
1251 fbpoptsobj.sponsoredbox=1;
1252 fbpoptsobj.pokebox=0;
1253 fbpoptsobj.happeningnowbar=0;
1254 fbpoptsobj.betabox=0;
1255 fbpoptsobj.commentbutton=0;
1256 fbpoptsobj.offlinefriends=1;
1257
1258 fbpoptsobj.requestsbox=0;
1259 fbpoptsobj.eventsbox=0;
1260 fbpoptsobj.questionsbox=0;
1261 fbpoptsobj.chatbox=0;
1262 fbpoptsobj.pagestory=0;
1263 fbpoptsobj.trendingbox=0;
1264
1265 //fbpoptsobj.commentslikestopnews=0;
1266 fbpoptsobj.recentactivity=0;
1267
1268 fbpoptsobj.fontsize='13';
1269 fbpoptsobj.fontfix='0';
1270 fbpoptsobj.fontcolour='';
1271 fbpoptsobj.fontcolourfix=0;
1272 fbpoptsobj.fontbgcolour='';
1273 fbpoptsobj.fontbgcolourfix=0;
1274 fbpoptsobj.fbpfont='';
1275 fbpoptsobj.fbpfontfix=0;
1276
1277 fbpoptsobj.sortmostrecent=0;
1278 fbpoptsobj.fixarticleredirects=1;
1279 fbpoptsobj.timelineonecol=0;
1280
1281 // left hand column options
1282 fbpoptsobj.lcadvertmgr=0;
1283 fbpoptsobj.lcconnect=0;
1284 fbpoptsobj.lcallpages=0;
1285 fbpoptsobj.lcpagesfeed=0;
1286 fbpoptsobj.lclikepages=0;
1287 fbpoptsobj.lcallapps=0;
1288 fbpoptsobj.lcappcenter=0;
1289 fbpoptsobj.lcevents=0;
1290 fbpoptsobj.lcgamesfeed=0;
1291 fbpoptsobj.lcpokes=0;
1292 fbpoptsobj.lcmusic=0;
1293 fbpoptsobj.lcplaceseditor=0;
1294 fbpoptsobj.lcallgroups=0;
1295 fbpoptsobj.lcallinterests=0;
1296 fbpoptsobj.lcfindfriends=0;
1297 fbpoptsobj.lccreatepage=0;
1298 fbpoptsobj.lccreategroup=0;
1299 fbpoptsobj.lcdeveloper=0;
1300 fbpoptsobj.lcfriends=0;
1301 fbpoptsobj.lcgifts=0;
1302
1303 // right hand column options
1304 fbpoptsobj.rcrecommendedpages=0;
1305 fbpoptsobj.rcrelatedgroups=1;
1306 fbpoptsobj.rcpokes=0;
1307 fbpoptsobj.rcbirthdays=0;
1308 fbpoptsobj.rcfriendrequests=0;
1309 fbpoptsobj.rcgamerequests=0;
1310
1311 // Begin new options 28th jan 2013
1312 fbpoptsobj.upcomingevents=0;
1313 fbpoptsobj.sharedevent=0;
1314
1315 fbpoptsobj.sharedpage=0;
1316 fbpoptsobj.likedlink=0;
1317 fbpoptsobj.commentedlink=0;
1318 fbpoptsobj.likepagebutton=0;
1319 fbpoptsobj.hideallphotos=0;
1320 fbpoptsobj.taggedphoto=0;
1321 fbpoptsobj.likedphoto=0;
1322 fbpoptsobj.commentedphoto=0;
1323
1324 fbpoptsobj.sharedvideo=0;
1325 fbpoptsobj.likedvideo=0;
1326 fbpoptsobj.commentedvideo=0;
1327 fbpoptsobj.youtubevideo=0;
1328
1329 fbpoptsobj.sharedstatus=0;
1330 fbpoptsobj.likedstatus=0;
1331 fbpoptsobj.commentedstatus=0;
1332 fbpoptsobj.taggedstatus=0;
1333 fbpoptsobj.smileys=0;
1334 fbpoptsobj.notificationpopup=0;
1335
1336 fbpoptsobj.hidealllinks=0;
1337 fbpoptsobj.hideallvideos=0;
1338 fbpoptsobj.fixedleftcolumn=1;
1339 // End new options 28th jan 2013
1340
1341 fbpoptsobj.customtextfilter='';
1342 fbpoptsobj.userappwhitelist='';
1343 fbpoptsobj.fbpcustomcss='';
1344
1345 }
1346
1347 // APPLICATION WHITELIST
1348 // ---------------------
1349
1350 // If you would like to edit the list of applications in the user whitelist,
1351 // theres detailed instructions here: http://whitelist.fbpurity.com
1352
1353 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,220353874751486";
1354
1355 // the application ids in the default app whitelist above belong to, in order:
1356 // 6628568379 = facebook iphone application
1357 // 115463795461 = selective twitter
1358 // 48119224995 = tumblr
1359 // 5895217474 = digsby
1360 // 56212371378 = tweetdeck
1361 // 146139331013 = tweetdeck for iphone
1362 // 2254487659 = facebook for blackberry
1363 // 2915120374 = facebook mobile widget
1364 // 74769995908 = facebook for android
1365 // 4620273157 = facebook for palm
1366 // 14405921260 = facebook for motorola (motoblur)
1367 // 10754253724 = iphoto uploader
1368 // 2483740875 = picasa uploader
1369 // 22950410511 = sprint/samsung? photo/video uploader
1370 // 43769862066 = SonyEricsson
1371 // 2550392059 = MusicPlayer
1372 // 8109791468 = Status Shuffle
1373 // 2238752371 = Facebook Exporter for iPhoto
1374 // 21370137768 = official flickr application
1375 // 6195724695 = Windows Phone
1376 // 6694405826 = Posterous
1377 // 2231777543 = Twitter
1378 // 53702860994 = LG Mobile
1379 // 20407635301 = Snaptu
1380 // 38125372145 = SonyEricsson Panel
1381 // 56137638329 = Nokia
1382 // 10732101402 = ping.fm
1383 // 16297770890 = 3Skypephone 'S2'
1384 // 2877035514 = Gwibber
1385 // 41158896424 = HTC Sense
1386 // 24420472648 = HTC Sense
1387 // 72687635881 = Samsung Mobile
1388 // 350685531728 = facebook for android
1389 // 30713015083 = windows live messenger
1390 // 111527682205237 = O2 social link
1391 // 121958126090 = LG Phone
1392 // 2330519541 = Bloom photo uploader
1393 // 49340319393 = Ovi by Nokia
1394 // 26463759431 = My INQ Mobile
1395 // 21810043296 = Facebook for the T-Mobile Sidekick
1396 // 183319479511 = HootSuite
1397 // 189818072392 = live journal
1398 // 302006227267 = Sony Ericsson X10 mini pro
1399 // 90376669494 = Yahoo
1400 // 108160725869250 = Sony Ericsson
1401 // 39010226174 = Vlingo
1402 // 247431880944 = Droid
1403 // 66746580154 = Dell Mobile
1404 // 96105046534 = RockMelt
1405 // 143907478979139 = RockMelt Beta
1406 // 146563558702544 = Friendly for Ipad
1407 // 131289390231340 = Slide
1408 // 9953271133 = networked blogs
1409 // 45439413586 = RSS Grafitti
1410 // 131732509879 = Twitter Feed
1411 // 23723376453 = Seesmic
1412 // 76456527540 = Facebook mobile by Opentech ENG
1413 // 105130332854716 = flipboard
1414 // 27694818115 = Ovi by Nokia
1415 // 67878695711 = Nokia N900
1416 // 124024574287414 = Instagram
1417 // 79763977758 = Kodak Easy Share
1418 // 139682082719810 = Snaptu for Facebook
1419 // 122580857763901 = eBuddy
1420 // 24553799497 = mobileblog
1421 // 159348674082705 = Photoloader
1422 // 112618498804176 = FriendCaster for Android
1423 // 148061315211358 = Friendcaster Pro for android
1424 // 104142802965358 = My INQ Mobile
1425 // 149588628439275 = Twidroyd for Twitter
1426 // 7933375107 = Windows Phone
1427 // 135892916448833 = Facebook for Windows Phone
1428 // 48505437520 = Sony Ericsson Web Albums
1429 // 198446803501767 = HTC ChaCha
1430 // 193278124048833 = HTC Sense
1431 // 165907476854626 = Facebook Pages Manager
1432 // 213546525407071 = iOS
1433 // 531615603522381 = Facebook Site Governance voting app
1434 // 149859461799466 = Sony Xperia Smartphone
1435 // 178645865537776 = Blackberry
1436 // 220353874751486 = Facebook for Blackberry 10
1437 // --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)
1438
1439 // EXTRA STORIES ( see http://extras.fbpurity.com for more info )
1440 // Read option settings and set extra story codes
1441
1442 ////////////////////////
1443 /// BEGIN opts
1444 ////////////////////////
1445
1446 var arrwhitelist2={}; // this is the main application whitelist array
1447 var extraTextFilter;
1448 var headerTextFilter;
1449 var cleancustomtextfilter='';
1450 var headertextfilterRX;
1451 var textfilterRX;
1452 var filterapptext;
1453 var fbpboxstyles;
1454 var fbpfanpageid="408502197558";
1455 var fbpdevpageid="464154953615751";
1456
1457 function getuserid(){
1458 var userid='';
1459 var currentuser=document.getElementsByClassName('headerTinymanPhoto');
1460 if(currentuser.length && currentuser[0].src && currentuser[0].src.match(/_/))
1461 userid=currentuser[0].src.split('_')[1];
1462 else
1463 try {
1464 userid=document.cookie.match(/c_user=(\d+)/)[1];
1465 }
1466 catch(e) {
1467 console.log('problem getting logged in user id: ' + e);
1468 }
1469 return userid;
1470 }
1471
1472 var currentuserid=getuserid();
1473
1474 if (!currentuserid.length)
1475 var useridwhitelistRX=new RegExp(fbpfanpageid);
1476 else
1477 var useridwhitelistRX=new RegExp(fbpfanpageid + "|" + fbpdevpageid + "|" + currentuserid);
1478
1479 refreshwhitelist = function () {
1480 var whitelist;
1481 if (fbpoptsobj.userappwhitelist && fbpoptsobj.userappwhitelist.length)
1482 whitelist = defaultappwhitelist + "," + fbpoptsobj.userappwhitelist;
1483 else
1484 whitelist = defaultappwhitelist;
1485
1486 whitelist = whitelist.replace(/,,/g,''); // remove blanks (if any)
1487 whitelist = whitelist.replace(/ /g,''); // remove spaces (if any)
1488 whitelist = whitelist.replace(/,$/,''); // remove trailing comma (if any)
1489
1490 var arrwhitelist=whitelist.split(',');
1491
1492 for (i in arrwhitelist)
1493 arrwhitelist2[arrwhitelist[i]]=true; // create hashmap
1494 }
1495
1496 fbptimelinerestyle=function (tloff) {
1497 var tlstyle='';
1498 if (tloff) {
1499 //fix group cover image links
1500 tlstyle += ' .groupsCoverPhoto img.coverPhotoImg, .groupsCoverPhoto a.coverWrap {height:100px !important}'+
1501 // make the Timeline Cover Photo Shorter (not doing this any more as it interfers with changing cover photo)
1502 // ' .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} '+
1503
1504 // fix save and cancel and drag to reposition
1505 ' #coverEditSaveCancelArea .saveAndCancel {margin-top:40px} a.coverWrap .instructionWrap {top:120px !important}'+
1506 // hide the 'Coming Soon: Timeline' section at the top of Timeline pages
1507 ' #pagelet_above_header_timeline {display:none}'+
1508 // hide the "escape hatch" (friends / about / interests picture squares section)
1509 ' #pagelet_escape_hatch {display:none}'+
1510 // single column timeline
1511 ' .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}' +
1512 // fix left margin and cover image size for personal timeline versus fan page timeline
1513 ' .pagesTimelineLayout .fbTimelineUnit {margin-left:150px !important} '+
1514 //div[itemtype="http://data-vocabulary.org/Person"] #fbProfileCover .coverWrap { {height: 150px !important} div[itemtype="http://data-vocabulary.org/Person"] .coverWrap {height:150px !important}' +
1515 // event page with cover image
1516 ' div.fbEventLeftNav {position:relative;top:20px !important} div.fbEventHeaderBlock {position:relative;top:25px !important;left:0px !important }';
1517 }
1518 if (document.getElementById('fbptlstyle'))
1519 document.getElementById('fbptlstyle').textContent=tlstyle;
1520 }
1521
1522 fixsortorder = function() {
1523 if(fbpoptsobj.sortmostrecent) { // force feed to sort by most recent
1524 var sortlink=document.getElementsByClassName('sortLink');
1525 if(sortlink.length) {
1526 if(!sortlink[0].textContent.match(/\:/))
1527 window.location.href=window.location.protocol +'//www.facebook.com/?sk=h_chr';
1528 }
1529 }
1530 }
1531
1532 initstage2 = function () {
1533 if(debug)
1534 console.trace();
1535 //console.log('entering function : ' + arguments.callee.name);
1536
1537 /* moved this to separate function
1538 if(fbpoptsobj.sortmostrecent) { // force feed to sort by most recent
1539 var sortlink=document.getElementsByClassName('sortLink');
1540 if(sortlink.length) {
1541 if(!sortlink[0].textContent.match(/\:/))
1542 window.location.href=window.location.protocol +'//www.facebook.com/?sk=h_chr';
1543 }
1544 }
1545 */
1546
1547 extraTextFilter=''; // init extraTextFilter
1548 headerTextFilter=''; // init headerTextFilter
1549 if(fbpoptsobj.filterappmessages==1) {
1550 filterapptext=' fbpblocked';
1551 headerTextFilter += ', played .*,started playing,started using';
1552 extraTextFilter += ',games your friends are playing,Games You May Like';
1553 }
1554 else
1555 filterapptext=' fbpnormal';
1556
1557 if(fbpoptsobj.becamefriends==1)
1558 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)
1559
1560 if(fbpoptsobj.becamefan==1){
1561 headerTextFilter += ', recommends, likes .* and \\d* other pages,wrote a recommendation for, rated .*';
1562 extraTextFilter += ',like page,Like this Page,Find More Pages ·, Write a recommendation ';
1563 }
1564
1565 if(fbpoptsobj.joinedgroup==1) {
1566 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";
1567 extraTextFilter += ",· Join Group";
1568 }
1569
1570 if(fbpoptsobj.attendevent==1)
1571 headerTextFilter += ",is attending, is going to";
1572
1573 if(fbpoptsobj.attendedevent==1)
1574 headerTextFilter += ", attended the event, went to .*\.";
1575
1576 if(fbpoptsobj.createdevent==1)
1577 headerTextFilter += ",created an event,updated the event photo";
1578
1579 if((typeof fbpoptsobj.upcomingevents !=='undefined') && (fbpoptsobj.upcomingevents==1))
1580 extraTextFilter += ",Upcoming Events,Upcoming Concerts";
1581
1582 if((typeof fbpoptsobj.sharedevent !=='undefined') && (fbpoptsobj.sharedevent==1))
1583 headerTextFilter += ",shared an event, shared .*\\'s event, posted an event";
1584 //extraTextFilter += ",people are goingjoin" // may also filter out "created an event" stories
1585
1586 if (typeof fbpoptsobj.checkedin == "undefined")
1587 fbpoptsobj.checkedin = 0;
1588
1589 if(fbpoptsobj.checkedin==1)
1590 headerTextFilter += ", is with .*,was tagged at, is in .*\., was in .*\., is at .*\., was at .*\., were at .*\., are at .*\., was with ";
1591
1592 if((typeof fbpoptsobj.likedstatus !=='undefined') && (fbpoptsobj.likedstatus==1))
1593 headerTextFilter += ", likes .*\'s status, like .*\'s status, like a status, likes a status, likes a post";
1594
1595 if((typeof fbpoptsobj.commentedstatus !=='undefined') && (fbpoptsobj.commentedstatus==1))
1596 headerTextFilter += ",commented on .* status, commented on .* note, commented on .* activity";
1597
1598 if((typeof fbpoptsobj.taggedstatus !=='undefined') && fbpoptsobj.taggedstatus==1)
1599 headerTextFilter += ", tagged .* status\.";
1600
1601 if((typeof fbpoptsobj.sharedstatus !=='undefined') && (fbpoptsobj.sharedstatus==1))
1602 headerTextFilter += ", shared .*\'s status, shared a status, shared .*\'s post";
1603
1604 if((typeof fbpoptsobj.taggedphoto !=='undefined') && (fbpoptsobj.taggedphoto==1))
1605 headerTextFilter += ",tagged in h.. own photo,tagged in a photo,tagged in .*\'s photo,tagged in h.. own album, tagged in .*\'s album";
1606
1607 if((typeof fbpoptsobj.likedphoto !=='undefined') && (fbpoptsobj.likedphoto==1))
1608 headerTextFilter += ",likes .* photo\.,likes? a photo,likes .*\'s album";
1609
1610 if((typeof fbpoptsobj.commentedphoto !=='undefined') && (fbpoptsobj.commentedphoto==1))
1611 headerTextFilter += ",commented on .*\'s photo,commented on h.. own photo,commented on h.. own album,commented on a photo,commented on .*\'s album";
1612
1613 if((fbpoptsobj.commentedlink !== 'undefined') && (fbpoptsobj.commentedlink==1)) {
1614 headerTextFilter += ",commented on .*\'s link,commented on a link,commented on h.. own link,commented on .*\.com\.";
1615 }
1616 // maybe move "likes an article" to the trending articles filter...
1617 if((fbpoptsobj.likedlink !== 'undefined') && (fbpoptsobj.likedlink==1)) {
1618 headerTextFilter += ",likes an article,recommends a link,likes a link,like a link,likes .*\'s link,likes \\d+ links";
1619 }
1620
1621 if((fbpoptsobj.sharedpage !== 'undefined') && (fbpoptsobj.sharedpage==1)) {
1622 headerTextFilter += ",shared a Page";
1623 }
1624
1625 if(fbpoptsobj.commentwall==1)
1626 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,
1627
1628 // updated profile
1629 if (typeof fbpoptsobj.updatedprofile == "undefined")
1630 fbpoptsobj.updatedprofile = 0;
1631
1632 if(fbpoptsobj.updatedprofile==1)
1633 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";
1634
1635 // changed profile pic
1636 if (typeof fbpoptsobj.changedprofilepic == "undefined")
1637 fbpoptsobj.changedprofilepic = 0;
1638
1639 if(fbpoptsobj.changedprofilepic==1)
1640 headerTextFilter += ",changed their profile picture,changed h.. profile picture,updated h.. cover photo\.,updated their cover photo";
1641
1642 // changed relationship
1643 if (typeof fbpoptsobj.changedrelationship == "undefined")
1644 fbpoptsobj.changedrelationship = 0;
1645
1646 if(fbpoptsobj.changedrelationship==1)
1647 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';
1648
1649 // uploaded photo
1650 if (typeof fbpoptsobj.uploadedphoto == "undefined")
1651 fbpoptsobj.uploadedphoto = 0;
1652
1653 if(fbpoptsobj.uploadedphoto==1){
1654 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";
1655 extraTextFilter +=', (\\d+ photos)';
1656 }
1657
1658 // shared photo
1659 if (typeof fbpoptsobj.sharedphoto == "undefined")
1660 fbpoptsobj.sharedphoto = 0;
1661
1662 if(fbpoptsobj.sharedphoto==1){
1663 headerTextFilter += ",shared a photo,shared .*\'s album";//shared .*\'s photo,
1664 extraTextFilter += ",by\:,shared .*?'s photo";
1665 }
1666
1667 // uploaded video
1668 if (typeof fbpoptsobj.uploadedvideo == "undefined")
1669 fbpoptsobj.uploadedvideo = 0;
1670
1671 if(fbpoptsobj.uploadedvideo==1){
1672 headerTextFilter += ",posted A video,added a video,uploaded.* video";
1673 //extraTextFilter +=",Length: ‎?\\d+:\\d\\d"; // this filter doesnt seem to work...
1674 }
1675
1676 // tagged in video
1677 if (typeof fbpoptsobj.taggedinvideo == "undefined")
1678 fbpoptsobj.taggedinvideo = 0;
1679
1680 if(fbpoptsobj.taggedinvideo==1)
1681 headerTextFilter += ",tagged in .*\'s video ";
1682
1683 /* new video options 28th jan
1684 sharedvideo
1685 likedvideo
1686 commentedvideo
1687 youtubevideo
1688 */
1689 if((typeof fbpoptsobj.sharedvideo!=='undefined') && (fbpoptsobj.sharedvideo==1))
1690 // we also add a check for classname "shareMediaVideo" to improve filter coverage
1691 headerTextFilter += ",shared a video,shared .*\'s video";
1692
1693 if((typeof fbpoptsobj.likedvideo!=='undefined') && (fbpoptsobj.likedvideo==1))
1694 headerTextFilter += ",liked a video,liked .*\'s video,likes .*\'s video";
1695
1696 if((typeof fbpoptsobj.commentedvideo!=='undefined') && (fbpoptsobj.commentedvideo==1))
1697 headerTextFilter += ",commented on a video,commented on .*'s video";
1698
1699 if((typeof fbpoptsobj.youtubevideo!=='undefined') && (fbpoptsobj.youtubevideo==1))
1700 extraTextFilter += ",youtube\.com,youtu\.be,vimeo\.com";
1701
1702 //if(fbpoptsobj.hideallvideos==1)
1703 // ; // we are dealing wtih this by running a check on the node for the "shareMediaVideo" class
1704
1705 //if(fbpoptsobj.hidealllinks==1)
1706 // Need to Add all links filter here?
1707
1708 // posted note
1709 if (typeof fbpoptsobj.postednote == "undefined")
1710 fbpoptsobj.postednote = 0;
1711
1712 if(fbpoptsobj.postednote==1)
1713 headerTextFilter += ",posted a note";
1714
1715 // tagged in note
1716 if (typeof fbpoptsobj.taggedinnote == "undefined")
1717 fbpoptsobj.taggedinnote = 0;
1718
1719 if(fbpoptsobj.taggedinnote==1)
1720 headerTextFilter += ",tagged in a note,tagged in a Post,tagged in .* life event";
1721
1722 // posted link
1723 if (typeof fbpoptsobj.postedlink == "undefined")
1724 fbpoptsobj.postedlink = 0;
1725
1726 if(fbpoptsobj.postedlink==1)
1727 headerTextFilter += ",shared link\\.,shared a link\\.";
1728
1729 // read an article
1730 if (typeof fbpoptsobj.readarticle == "undefined")
1731 fbpoptsobj.readarticle = 0;
1732
1733 if(fbpoptsobj.readarticle==1) {
1734 headerTextFilter += ",read an article, recently read articles\\., read \\d* articles\\.";
1735 extraTextFilter += ",Trending Articles,Trending Videos,Most Shared on ,Recent Articles About ";
1736 }
1737
1738 // facebook questions
1739 if(fbpoptsobj.questionsbox==1) {
1740 headerTextFilter += ", replied to: , asked: ,answered .*'s question,asked.*a question";
1741 extraTextFilter += ",· Ask friends ·";
1742 }
1743
1744 // hide sponsored stories in newsfeed
1745 if(fbpoptsobj.sponsoredbox==1) {
1746 extraTextFilter += ",Recently Released Albums,Get Offer ·"; //· Sponsored
1747 headerTextFilter += ", claimed an offer from, posted an offer";
1748 }
1749
1750 if (fbpoptsobj.trendingbox) {
1751 headerTextFilter += ', is trending\\.';
1752 }
1753
1754 // fix font size
1755 if(fbpoptsobj.fontfix==1) {
1756 /*if(document.getElementById('fbpfreestyler'))
1757 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}';
1758 */
1759 fbpfreestyle.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}';
1760 }
1761
1762 // fix font colour
1763 if(fbpoptsobj.fontcolourfix==1) {
1764 /*if(document.getElementById('fbpfreestyler'))
1765 document.getElementById('fbpfreestyler').textContent +=' * {color:' + fbpoptsobj.fontcolour + ' !important}'; //span.fwb {color:' + fbpoptsobj.fontcolour + ' !important}';
1766 */
1767 fbpfreestyle.textContent+=' * {color:' + fbpoptsobj.fontcolour + ' !important}'; //span.fwb {color:' + fbpoptsobj.fontcolour + ' !important}';
1768 }
1769
1770 // fix font background colour
1771 if(fbpoptsobj.fontbgcolourfix==1) {
1772 //if(document.getElementById('fbpfreestyler'))
1773 // document.getElementById('fbpfreestyler')
1774 fbpfreestyle.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, div._7m4 {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}';
1775 }
1776
1777 // fix font
1778 if(fbpoptsobj.fbpfontfix==1) {
1779 //if(document.getElementById('fbpfreestyler'))
1780 // document.getElementById('fbpfreestyler')
1781 fbpfreestyle.textContent +=' * {font-family:' + fbpoptsobj.fbpfont + ' !important} ';
1782 }
1783
1784
1785 if(fbpoptsobj.likepagebutton==1) {
1786 fbpfreestyle.textContent +=' div.uiStreamShareLikePageBox div.uiPageLikeButton, div.genericStreamStory a.PageLikeButton, div[data-dedupekey] span.PageLikeButton, div.shareFooter label.shareLikeButton {display:none} ';
1787 }
1788 // single column timeline
1789 /*
1790 if(fbpoptsobj.timelineonecol==1)
1791 fbptimelinerestyle(1);
1792 else
1793 fbptimelinerestyle(0);
1794 */
1795
1796 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(',');
1797 for(b=0;b<lcoptsarr.length;b++)
1798 if (typeof fbpoptsobj[lcoptsarr[b]] == "undefined")
1799 fbpoptsobj[lcoptsarr[b]]=0;
1800
1801 //var fbpfreestyler=document.getElementById('fbpfreestyler');
1802 //if (fbpfreestyler) {
1803
1804
1805
1806 // start left column options
1807 if(fbpoptsobj.lcconnect==1)
1808 fbpfreestyle.textContent +=' #connectNav {display:none}';
1809
1810 if(fbpoptsobj.lcallpages==1)
1811 fbpfreestyle.textContent +=' #pagesNav {display:none}';
1812
1813 if(fbpoptsobj.lcallapps==1)
1814 fbpfreestyle.textContent +=' #appsNav {display:none}';
1815
1816 if(fbpoptsobj.lcallgroups==1)
1817 fbpfreestyle.textContent +=' #groupsNav {display:none}';
1818
1819 if(fbpoptsobj.lcallinterests==1)
1820 fbpfreestyle.textContent +=' #interestsNav { display:none }';
1821
1822 if(fbpoptsobj.lcfriends==1)
1823 fbpfreestyle.textContent +=' #listsNav { display:none}';
1824
1825 // items beginning with #navItem_app_ are for the old newsfeed, and those with #sidebar_navigation_top are the new newsfeed
1826 if(fbpoptsobj.lcadvertmgr==1)
1827 fbpfreestyle.textContent +=' #adsNav, #navItem_app_6802152230, #navItem_app_400915586638539, #sidebar_navigation_top a[data-id="6802152230"], #sidebar_navigation_top a[data-id="400915586638539"] {display:none}';
1828
1829 if(fbpoptsobj.lcpagesfeed==1)
1830 fbpfreestyle.textContent +=' #navItem_app_140472815972081, #sidebar_navigation_top a[data-id="140472815972081"] {display:none}';
1831
1832 if(fbpoptsobj.lclikepages==1)
1833 fbpfreestyle.textContent +=' #navItem_app_357937250942127, #navFindFriends, #sidebar_navigation_top a[data-id="357937250942127"] {display:none}';
1834
1835 if(fbpoptsobj.lcappcenter==1)
1836 fbpfreestyle.textContent +=' #navItem_app_140332009231, #sidebar_navigation_top a[data-id="140332009231"] {display:none}';
1837
1838 if(fbpoptsobj.lcevents==1)
1839 fbpfreestyle.textContent +=' #navItem_app_2344061033, #sidebar_navigation_top a[data-id="2344061033"] {display:none}';
1840
1841 if(fbpoptsobj.lcgamesfeed==1)
1842 fbpfreestyle.textContent +=' #navItem_app_261369767293002, #sidebar_navigation_top a[data-id="261369767293002"] {display:none}';
1843
1844 if(fbpoptsobj.lcpokes==1)
1845 fbpfreestyle.textContent +=' #navItem_app_183217215062060, #sidebar_navigation_top a[data-id="183217215062060"] {display:none}';
1846
1847 if(fbpoptsobj.lcmusic==1)
1848 fbpfreestyle.textContent +=' #navItem_app_119960514742544, #sidebar_navigation_top a[data-id="119960514742544"] {display:none}';
1849
1850 if(fbpoptsobj.lcplaceseditor==1)
1851 fbpfreestyle.textContent +=' #navItem_app_219124168114356, #sidebar_navigation_top a[data-id="219124168114356"] {display:none}';
1852
1853 if(fbpoptsobj.lccreategroup==1)
1854 fbpfreestyle.textContent +=' #navItem_app_230259100322928, #sidebar_navigation_top a[data-id="230259100322928"] {display:none}';
1855
1856 if(fbpoptsobj.lccreatepage==1)
1857 fbpfreestyle.textContent +=' #navItem_app_188619144602540, #sidebar_navigation_top a[data-id="188619144602540"] {display:none}';
1858
1859 if(fbpoptsobj.lcfindfriends==1)
1860 fbpfreestyle.textContent +=' #navItem_app_2356318349, #sidebar_navigation_top a[data-id="2356318349"], #findFriendsNav {display:none !important}';
1861
1862 if(fbpoptsobj.lcdeveloper==1)
1863 fbpfreestyle.textContent +=' #developerNav, #navItem_app_2345053339, #sidebar_navigation_top a[data-id="2345053339"] {display:none}';
1864
1865 if(fbpoptsobj.lcgifts==1)
1866 fbpfreestyle.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"], a[href^="/gifts?recipient_id="], div.timelineReportContainer[data-gt*=\'"timeline_unit_type":"BirthdayGiftUnit"\'],a.uiButton[href^="/gifts?recipient_id="] {display:none}';
1867
1868 if(fbpoptsobj.rcrecommendedpages==1)
1869 fbpfreestyle.textContent +=' #pages_reminders_link {display:none}';
1870
1871 if(fbpoptsobj.rcbirthdays==1)
1872 fbpfreestyle.textContent +=' #birthday_reminders_link {display:none}';
1873
1874 if(fbpoptsobj.rcgamerequests==1)
1875 fbpfreestyle.textContent +=' #custom_reminders_link {display:none}';
1876
1877 if(fbpoptsobj.rcfriendrequests==1)
1878 fbpfreestyle.textContent +=' #friends_reminders_link {display:none}';
1879
1880 if(fbpoptsobj.rcpokes==1)
1881 fbpfreestyle.textContent +=' #poke_reminders_link, #pagelet_pokes {display:none}';
1882
1883 if(fbpoptsobj.rcrelatedgroups==1)
1884 fbpfreestyle.textContent +=' #pagelet_ego_contextual_group {display:none !important}';
1885
1886 // hide useless bottom right footer + ads on login + logout screen + useless links in top nav bar
1887 fbpfreestyle.textContent += 'div.fbIndexFeaturedRegistration > div.lfloat, .-cx-PRIVATE-fbAdUnit__root, #pagelet_rhc_footer, #SetAsHomepage_Callout, .gradientContent > div[data-ad^="{"], #findFriendsNav, #navFindFriends {display:none !important}';
1888
1889 // hide contact importer at bottom of feed
1890 fbpfreestyle.textContent += ' .contact_importer_widget {display:none} #ci_compact_right {display:none}';
1891
1892 // add red border to publish permissions request and make light grey blurb black and bold
1893 fbpfreestyle.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}';
1894
1895 // add open and close list styles
1896 fbpfreestyle.textContent += ' span.fbpopenlist:before {content:"▼ "} span.fbpclosedlist:before {content:"► "}';
1897
1898
1899 ////////////////////////
1900 /// END opts
1901 ////////////////////////
1902
1903 refreshwhitelist();
1904
1905 //unsafeWindow.console.log("etf= " + extraTextFilter);
1906
1907 var tmptextfilter='';
1908 tmptextfilter=fbpoptsobj.customtextfilter;
1909 if (tmptextfilter)
1910 tmptextfilter += ',' + extraTextFilter; // add emergency extra text filter
1911 else
1912 tmptextfilter = extraTextFilter;
1913
1914 if( tmptextfilter.length ) {
1915 tmptextfilter=tmptextfilter.replace(/,,/g,','); // remove blanks (if any)
1916 tmptextfilter=tmptextfilter.replace(/,+$|^,+/g,''); // remove trailing or leading commas
1917 cleancustomtextfilter=fbpescaperegex(tmptextfilter); // escape regex special chars (brackets)
1918
1919 try {
1920 textfilterRX = new RegExp(cleancustomtextfilter.replace(/,/g,'|'),"gi");
1921 }
1922 catch (e) {
1923 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.")
1924 //textfilterRX=null;
1925 textfilterRX=new RegExp("fbpurity1234567890xyz"); // set a dummy regex, so firefox browser doesnt freeze, and user can go and reset the fbp options
1926 }
1927 }
1928
1929 //unsafeWindow.console.log('htf=' + headerTextFilter);
1930
1931 headerTextFilter=headerTextFilter.replace(/^,/,''); // remove leading comma (if any)
1932
1933 if( headerTextFilter && headerTextFilter.length ) {
1934 try {
1935 headertextfilterRX = new RegExp(headerTextFilter.replace(/,/g,'|'),"gi");
1936 }
1937 catch (e) {
1938 window.alert('F.B. Purity: regex error building header text filter : ' + headerTextFilter);
1939 headertextfilterRX=null;
1940 }
1941 }
1942
1943 //unsafeWindow.console.log(fbpoptsobj.customtextfilter);
1944
1945 fbpboxstyles='';
1946
1947 // hide suggestions box if option has been set
1948 if (fbpoptsobj.suggestionsbox) {
1949 fbpboxstyles +=' #ego_pane {display:none} #netego_organic {display:none} #pagelet_tips_box {display:none}';
1950 }
1951 // hide Get Connected (was: connect with friends) box if option has been set
1952 if (fbpoptsobj.connectbox) {
1953 fbpboxstyles +=' #pagelet_netego_lower {display:none} #pagelet_connectbox {display:none}';
1954 }
1955
1956 if (fbpoptsobj.betabox) {
1957 fbpboxstyles +=' #pagelet_betabox {display:none}';
1958 }
1959
1960 if (fbpoptsobj.pokebox) {
1961 fbpboxstyles +=' #pagelet_netego_pokes, #pagelet_pokes, #navItem_app_183217215062060 {display:none}';
1962 }
1963
1964 if (fbpoptsobj.happeningnowbar) {
1965 fbpboxstyles +=' .ticker_stream, #pagelet_ticker, #pagelet_rhc_ticker {display:none}';
1966 }
1967
1968 if (fbpoptsobj.questionsbox) {
1969 fbpboxstyles +=' #pagelet_netego_questions, #pagelet_questionsbox {display:none}';
1970 }
1971
1972 if (fbpoptsobj.eventsbox) {
1973 fbpboxstyles +=' #event_reminders_link {display:none}'; // 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;}
1974 }
1975
1976 if (fbpoptsobj.requestsbox) {
1977 fbpboxstyles +=' #pagelet_netego_requests {display:none}';
1978 }
1979
1980 if (fbpoptsobj.sponsoredbox) {
1981 fbpboxstyles +=' div._5j5u,div[data-adblock-hash],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, #endOfFeedPymlContainer {display:none !important} #sidebar_ads, #pagelet_ads, #pagelet_netego_ads, .UIStandardFrame_SidebarAds, #gb_muffin_area, .adsContainer, .fbPhotoAdsCol {visibility:hidden !important} ';
1982 }
1983 //div._5j5u = current code for hiding "similar to" box.
1984
1985 if (fbpoptsobj.filterappmessages) { // hide app and game messages from the ticker
1986 fbpboxstyles +=' div.fbFeedTickerStory[data-gt*=\'"appid":\'] {display:none} ';
1987 }
1988
1989 if (fbpoptsobj.chatbox) {
1990 fbpboxstyles +=' #pagelet_presence, #pagelet_friends_online, #pagelet_chat, #BuddylistPagelet, div.fbChatSidebarBody {display:none}';
1991 }
1992
1993 if (fbpoptsobj.trendingbox) {
1994 fbpboxstyles +=' #pagelet_trending_tags_and_topics {display:none} {display:none}';
1995 }
1996
1997 if ((typeof fbpoptsobj.smileys !=='undefined') && fbpoptsobj.smileys) {
1998 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-, div.userContentWrapper i.img, h5.uiStreamMessage i.img, span.userContentSecondary img[height="16"] {display:none} ';
1999 }
2000
2001 if ((typeof fbpoptsobj.notificationpopup !=='undefined') && fbpoptsobj.notificationpopup) {
2002 fbpboxstyles +=" ul[data-gt^='{\"ref\":\"beeper\"'] {display:none}";
2003 }
2004
2005 if ((typeof fbpoptsobj.fixedleftcolumn !=='undefined') && fbpoptsobj.fixedleftcolumn) {
2006 fbpboxstyles +=' .home #leftCol {position:fixed !important}';
2007 }
2008
2009 if(fbpoptsobj.offlinefriends) {
2010 // hide offline friends in chat
2011 fbpboxstyles +=" .fbChatOrderedList li {display: none;} .fbChatOrderedList .active {display: block;}";
2012 }
2013
2014 //if(document.getElementById('fbpboxstyler'))
2015 // document.getElementById('fbpboxstyler').textContent = fbpboxstyles;
2016 fbpboxstyle.textContent = fbpboxstyles;
2017
2018 // set custom css (if user has specified any styles)
2019 if (fbpoptsobj.fbpcustomcss) {
2020 //if(document.getElementById('fbpcssstyler'))
2021 // document.getElementById('fbpcssstyler').textContent = fbpoptsobj.fbpcustomcss;
2022 fbpcssstyle.textContent = fbpoptsobj.fbpcustomcss;
2023 }
2024
2025 if(debug)
2026 console.log('are we here at the end of initstage 2?');
2027
2028 } //END FUNCTION INITSTAGE2
2029
2030 fbpdynamicreload = function (opts) {
2031 fbpgetprefs(opts);
2032 if(document.getElementById('fbpoptsdiv') && document.getElementById('fbpoptsdiv').style.display=='block') {
2033 document.getElementById('fbpoptsdiv').style.display='none';
2034 fbptoggleopts();
2035 }
2036 resetclasses();
2037 initstage2();
2038 //tlbuttinit(); // reset TL button state
2039 if(fbpoptsobj.timelineonecol==false)
2040 window.setTimeout(function(){document.getElementById('FBTLX').style.display='none';},1500);
2041 else
2042 window.setTimeout(function(){document.getElementById('FBTLX').style.display='block';},1500);
2043
2044 cleartheshizzle(document);
2045 }
2046
2047 /*
2048 if(!isasync)
2049 initstage2(); // run it once to finish initialisation
2050 have moved this call into fbpgetprefs...
2051
2052 */
2053 // function to add delete friend request buttons
2054 /*function adddelreqbuttons(node) {
2055 // for adding delete request button to main friend request indicator panel and also the list at https://www.facebook.com/friends/requests/
2056 commented out for now as was causing errors in line 1991
2057 actiondivs=node.getElementsByClassName('actions');
2058 if(!actiondivs.length || !node.getElementsByClassName('uiButtonConfirm').length || node.getElementsByClassName('privacyPlan').length || document.getElementById('questions_stories'))
2059 return;
2060 for(var i=0;i<actiondivs.length;i++) {
2061 //unsafeWindow.console.log(actiondivs[i].childNodes[0].getAttribute('class'));
2062 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/)) {
2063 //unsafeWindow.console.log('timeline page');
2064 continue;
2065 }
2066 foundreject=0;
2067 binps=actiondivs[i].getElementsByTagName('input');
2068 for(j=0;j<binps.length;j++)
2069 if(binps[j].getAttribute && binps[j].getAttribute('name') && binps[j].getAttribute('name').match(/actions\[reject\]|Admin Panel/)) {
2070 foundreject=1;
2071 break;
2072 }
2073 if(!foundreject) {
2074 delreqbutt=document.createElement('label');
2075 delreqbutt.className='uiButton uiButtonDefault uiButtonMedium';
2076 delreqbutt.innerHTML='<input type="submit" title="Delete this request. (The sender wont know.)" name="actions[reject]" value="Delete">';
2077 actiondivs[i].appendChild(delreqbutt);
2078 }
2079 }
2080
2081 }*/
2082
2083 function fpInsertedNodeDomHandler(event) {
2084
2085 if((event.target.nodeName=='LI') || (event.target.nodeName=='UL')) {
2086 //if ((document.getElementById('pagelet_home_stream')||(document.getElementById('profile_minifeed'))) && (!document.getElementById('fb_multi_friend_selector'))) {
2087 if ((document.getElementById('pagelet_home_stream') ) && (!document.getElementById('fb_multi_friend_selector'))) {
2088 //console.log(event.target.nodeName);
2089 cleartheshizzle(event.target);
2090 //unmanglelinks(event.target);
2091 }
2092 else {
2093 ; // not doing anything at the mo
2094 }
2095 if(fbpoptsobj.fixarticleredirects && event.target.getElementsByTagName('a').length)
2096 unmanglelinks(event.target);
2097 }
2098 else if(event.target.nodeName=='DIV') {
2099 //var functRef = callLater(adddelreqbuttons,event.target);
2100 //setTimeout(functRef, 1500);
2101 if (document.getElementById('pagelet_litestand_section') || document.getElementById('stream_pagelet')) {
2102 //console.log(event.target.nodeName);
2103 cleartheshizzle(event.target);
2104 //unmanglelinks(event.target);
2105 }
2106 if((event.target.getAttribute('id')=='platform_dialog_content') || (event.target.getElementsByClassName('tosPane').length) || (event.target.getAttribute('class') && event.target.getAttribute('class').match(/tosPane/))) {
2107 //its most likely a facebook application requesting permissions
2108 highlightemailrequest();
2109 //appid=document.getElementById('input_app_id').getAttribute('value');
2110 addblockbuttontopermreq();
2111 }
2112 if(event.target.getAttribute('class') && event.target.getAttribute('class').match('middle_area_content')){
2113 if(window.location.href.match(/\/appcenter\//))
2114 highlightemailrequest();
2115 }
2116 if(fbpoptsobj.fixarticleredirects && event.target.getElementsByTagName('a').length)
2117 unmanglelinks(event.target);
2118 //fixie7spoof();
2119 //setTimeout(function(){adddelreqbuttons(event.target)},1000); // add delete friend request buttons if required
2120 }
2121 else if((event.target.nodeName=='SPAN') && (event.target.getAttribute && event.target.getAttribute('class') && event.target.getAttribute('class').match(/hasCaption/))) {
2122 //console.log('hit a spanner');
2123 unmanglelinks(event.target);
2124 }
2125 } // END fpInsertedNodeDomHandler function
2126
2127 function updateblockedcount() {
2128 crappyappmsgcounter=document.getElementsByClassName('fbpblocked').length;
2129 var fbpblockcountspan=document.getElementById('fbpblockcount');
2130 if(fbpblockcountspan)
2131 fbpblockcountspan.innerHTML=crappyappmsgcounter;
2132
2133 xtramsgcounter=document.getElementsByClassName('fbpblockedx').length;
2134 var fbpblockxcountspan=document.getElementById('fbpblockxcount');
2135 if(fbpblockxcountspan)
2136 fbpblockxcountspan.innerHTML=xtramsgcounter;
2137 }
2138
2139 function destroyblockedappstories (appid,killmode) {
2140
2141 var appnodes=document.getElementsByClassName('aid_' + appid);
2142 var appnodeslength=appnodes.length;
2143 for (var i=0;i<appnodeslength;i++){
2144 //appnodes=document.getElementsByClassName('aid_' + appid);
2145 if(killmode=='kill')
2146 appnodes[0].parentNode.removeChild(appnodes[0]);
2147 else if(killmode=='allow')
2148 appnodes[i].className = appnodes[i].className.replace(/\bfbpblocked\b/,'fbpnormal');
2149
2150 if(fpbblockcountspan)
2151 fpbblockcountspan.innerHTML=--crappyappmsgcounter;
2152 }
2153 updateblockedcount();
2154 //check if there are any blocked msgs left and if not, return to normal homepage view
2155 blockedmsgs=document.getElementsByClassName('fbpblocked');
2156 if(!blockedmsgs.length)
2157 fbpshowblocked();
2158 appnodes=null;
2159
2160 }// END destroyblockedappstories function
2161
2162 function getdtsg() {
2163 var fb_dtsg='';
2164 if(document.getElementsByClassName('autoexpand_mode').length) {
2165 if(document.getElementsByClassName('autoexpand_mode')[0].wrappedJSObject)
2166 fb_dtsg = document.getElementsByClassName('autoexpand_mode')[0].wrappedJSObject.fb_dtsg.value;
2167 else
2168 fb_dtsg = document.getElementsByClassName('autoexpand_mode')[0].fb_dtsg.value;
2169 }
2170 else {
2171 navinps=document.getElementsByTagName('input');
2172 for(var i=0;i<navinps.length;i++)
2173 if(navinps[i].getAttribute('name')=='fb_dtsg') {
2174 fb_dtsg=navinps[i].getAttribute('value');
2175 break;
2176 }
2177 }
2178 return fb_dtsg;
2179 }
2180
2181 function allowapp(appid, appname) {
2182
2183 if (confirm("Do you want to whitelist application : '" + appname +"'" + ".\n\nApplication ID: " + appid)) {
2184 if(fbpoptsobj.userappwhitelist.length) {
2185 // theres already value/s in userwhitelist
2186 try {
2187 fbpoptsobj.userappwhitelist+=','+appid;
2188 fbpsavevalue('fbpoptsjson-' + currentuserid, JSON.stringify(fbpoptsobj));
2189 //document.getElementById("MyElement").className = document.getElementById("MyElement").className.replace(/\bMyClass\b/','')
2190 window.alert(appname + ' has been Saved to your whitelist');
2191 refreshwhitelist();
2192 destroyblockedappstories(appid,'allow');
2193 }
2194 catch(e) {
2195 window.alert('error saving id to whitelist');
2196 }
2197
2198 }
2199 else {
2200 // userwhitelist is blank
2201 try {
2202 fbpoptsobj.userappwhitelist=appid;
2203 fbpsavevalue('fbpoptsjson-' + currentuserid, JSON.stringify(fbpoptsobj));
2204 window.alert(appname + ' has been Saved to your whitelist');
2205 refreshwhitelist();
2206 destroyblockedappstories(appid,'allow');
2207 }
2208 catch(e) {
2209 window.alert('error saving id to whitelist');
2210 }
2211 }
2212 }
2213 else
2214 return;
2215
2216 } // END allowapp function
2217
2218 function blockapp(appid, appname, nodeid, autoblock) {
2219 //var post_form_id = document.getElementById('post_form_id').getAttribute('value');
2220 var fb_dtsg = getdtsg();
2221 if(typeof currentuserid=='undefined' || currentuserid=='')
2222 currentuserid=getuserid();
2223
2224 //unsafeWindow.pages_show_block_app("49572793475", "block", "about");
2225
2226 // if not autoblocking - check if there are multiple apps to block, if so ask if user wants to block all at once
2227 if(typeof(autoblock)=='undefined') {
2228 var app2bcount=document.getElementsByClassName('fbpblocked').length;
2229 if (!confirm("Do you want to block application : '" + appname +"'"))
2230 return;
2231 if (app2bcount>1) // check if user wants to block all the currently shown applications
2232 if(blockallapps())
2233 return;
2234 }
2235 if(document.getElementById('blockapplab'))
2236 document.getElementById('blockapplab').style.display='none';
2237
2238 document.getElementById(nodeid).setAttribute('style','background:#DCDCDC !important;text-align:center');
2239 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">';
2240
2241 var http = new window.XMLHttpRequest();
2242 //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";
2243 //var params = "__d=1&confirm=1&fb_dtsg=" + fb_dtsg + "&ok=Okay" ;
2244 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;
2245 var params = "__asyncDialog=1&__user=" + currentuserid + "&__a=1&confirmed=1&fb_dtsg=" + fb_dtsg ;// + phstamp:1658166771106811366130
2246
2247 http.open("POST", url, true);
2248 http.setRequestHeader("Referer", window.location.protocol + "//" + window.location.hostname + "/apps/application.php?id=" + appid);
2249 http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
2250 //http.setRequestHeader("Content-length", params.length);
2251 //http.setRequestHeader("Connection", "close");
2252
2253 http.onreadystatechange = function() {
2254 if(http.readyState == 4 && http.status == 200) {
2255 if(!http.responseText.match('\"errorSummary\"')){
2256 //unsafeWindow.console.log("successfully blocked app : '" + appname + "' with id=" +appid + "\n");
2257 if((nodeid!='platform_dialog_content') &&(nodeid!='pagelet_canvas_content'))
2258 destroyblockedappstories (appid,'kill');
2259 else {
2260 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>';
2261 if(document.getElementsByClassName('platform_dialog_bottom_bar_table').length)
2262 document.getElementsByClassName('platform_dialog_bottom_bar_table')[0].style.display='none';
2263 }
2264
2265 }
2266 else {
2267 if(http.responseText.match(/\"errorSummary\"\:/))
2268 var errorsum=http.responseText.match(/\"errorSummary\"\:\"(.*)\",\"error/)[1];
2269 else
2270 var errorsum="";
2271 if(http.responseText.match(/\"errorDescription\"\:/))
2272 var errordesc=http.responseText.match(/\"errorDescription\"\:\"(.*)\",/)[1];
2273 else
2274 var errordesc="";
2275 if( errorsum.length && errordesc.length )
2276 var wholeerror = errorsum + ' : ' + errordesc;
2277 else
2278 var wholeerror = http.responseText;
2279 window.alert('app block failed for some reason:\n\n' + wholeerror);
2280 }
2281 http=null;
2282 }
2283 }
2284 http.send(params);
2285
2286 } // END blockapp function
2287
2288 function blockappev(ev) {
2289
2290 ev.preventDefault();
2291 var appname=this.getAttribute('appname');
2292 var appid=this.getAttribute('appid');
2293 var nodeid=this.getAttribute('nodeid');
2294 blockapp(appid,appname,nodeid);
2295 } // END blockappev function
2296
2297 function allowappev(ev) {
2298
2299 ev.preventDefault();
2300 var appname=this.getAttribute('appname');
2301 var appid=this.getAttribute('appid');
2302 var nodeid=this.getAttribute('nodeid');
2303 document.getElementById(nodeid).setAttribute('class', document.getElementById(nodeid).getAttribute('class') + ' aid_' + appid);
2304 allowapp(appid,appname);
2305 } // END allowappev function
2306
2307 function fbpshowblocked() {
2308
2309 var showhidelink=document.getElementById('fbpshowblockedlink');
2310 var showorhidetext=showhidelink.textContent;
2311
2312 var showhidelinkx=document.getElementById('fbpshowblockedxlink');
2313 var showorhidetextx=showhidelinkx.textContent;
2314
2315 var blockedmsgs=document.getElementsByClassName('fbpblocked');
2316
2317 if (showorhidetext=='Show') {
2318 if(!blockedmsgs.length)
2319 return;
2320 showhidelink.innerHTML='Hide';
2321 showhidelink.title='Hide Application + Game Stories';
2322 showhidelinkx.innerHTML='Show';
2323 showhidelinkx.title='Show Extras (Friend/Group/Fan/Event etc Stories)';
2324 fbpstyle.textContent=fbpStyleApps;
2325 }
2326 else {
2327 showhidelink.innerHTML='Show';
2328 showhidelink.title='Show Application + Game Stories';
2329 fbpstyle.textContent=fbpStyleNormal;
2330 }
2331
2332 //works better in reverse order
2333 for(i=(blockedmsgs.length-1); i>=0; i--) {
2334 //unsafeWindow.console.log("show block link: " + i);
2335 dspBlockLink(blockedmsgs[i]);
2336 }
2337
2338 blockedmsgs=null;
2339
2340 } // END fbpshowblocked function
2341
2342 function fbpshowblockedx() {
2343
2344 var showhidelinkx=document.getElementById('fbpshowblockedxlink');
2345 var showorhidetextx=showhidelinkx.textContent;
2346
2347 var showhidelink=document.getElementById('fbpshowblockedlink');
2348 var showorhidetext=showhidelink.textContent;
2349
2350 var blockedmsgs=document.getElementsByClassName('fbpblockedx');
2351
2352 if (showorhidetextx=='Show') {
2353 if(!blockedmsgs.length)
2354 return;
2355 showhidelinkx.innerHTML='Hide';
2356 showhidelinkx.title='Hide Extras (Friend/Group/Fan/Event etc Stories)';
2357 showhidelink.innerHTML='Show';
2358 showhidelink.title='Show Application + Game Stories';
2359 fbpstyle.textContent=fbpStyleExtras;
2360 }
2361 else {
2362 showhidelinkx.innerHTML='Show';
2363 showhidelinkx.title='Show Extras (Friend/Group/Fan/Event etc Stories)';
2364 fbpstyle.textContent=fbpStyleNormal;
2365 }
2366
2367 blockedmsgs=null;
2368
2369 } // END fbpshowblockedx
2370
2371 fbpshowblockedev = function (ev) {
2372 ev.preventDefault();
2373 fbpshowblocked();
2374 }
2375
2376 fbpshowblockedxev = function(ev) {
2377 ev.preventDefault();
2378 fbpshowblockedx();
2379 }
2380
2381 function dspBlockLink(node, blockmode) {
2382 if (node.getElementsByClassName('blocklink').length)
2383 return;
2384
2385 var appid;
2386 var appname='';
2387 // check if its a new FB Actions / Frictionless sharing app
2388 //uism =node.getElementsByClassName('uiStreamMessage');
2389 //if(uism.length)
2390 // if (uism[0].innerHTML.match(/\/hovercard\/application\.php\?id\=(\d*)|\/hovercard\/hovercard\.php\?id=(\d*)/))
2391 // blockmode='sua';
2392
2393 if (typeof(blockmode)=='undefined') {
2394 var footernode, headernode;
2395 headernode=node.getElementsByClassName('uiStreamMessage');
2396
2397 if(document.getElementsByClassName('uiStreamFooter') && document.getElementsByClassName('uiStreamFooter').length) {
2398 footernode=node.getElementsByClassName('uiStreamFooter')[0];
2399 }
2400 else
2401 if(document.getElementsByClassName('UIActionLinks_bottom') && document.getElementsByClassName('UIActionLinks_bottom').length) {
2402 footernode=node.getElementsByClassName('UIActionLinks_bottom')[0];
2403 }
2404 else {
2405 footernode='x'; //invalid node will cause exception, luckily we have an exception handler isnt it ;-)
2406 }
2407
2408 //its possibly an app posing as a normal facebook message, so lets try and get the appid from the footer
2409 if(headernode.length && headernode[0].innerHTML.match(/application\.php\?id=(\d+)/)) {
2410 appid=headernode[0].innerHTML.match(/application\.php\?id=(\d+)/)[1];
2411 }
2412 else if(footernode.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)) {
2413 if(typeof footernode.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)[1] !='undefined')
2414 appid=footernode.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)[1];
2415 else if(typeof footernode.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)[2] !='undefined')
2416 appid=footernode.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)[2];
2417 }
2418 else
2419 if(footernode.innerHTML.match(/application\.php\?id=(\d+)/)) {
2420 if(footernode.innerHTML.match(/application\.php\?id=(\d+)/)[1]!='undefined')
2421 appid=footernode.innerHTML.match(/application\.php\?id=(\d+)/)[1];
2422 }
2423 else
2424 return;
2425
2426 try {
2427 //appname=footernode.getElementsByClassName("GenericStory_BottomAttribution")[0].getElementsByTagName('a')[0].textContent;
2428 if(footernode.innerHTML.match(/data-appname=/))
2429 appname=footernode.innerHTML.match(/data-appname="([^"]*)"/)[1] ;
2430 else if (headernode[0].innerHTML.match(/application.php/)){
2431 appname=headernode[0].innerHTML.match(/application\.php\?id=.*\>(.*)<\/\a\>/)[1];
2432 }
2433 else
2434 {
2435 flinks=footernode.getElementsByTagName('a');
2436 appname=flinks[flinks.length-1].textContent;
2437 if(appname=='')
2438 appname=flinks[flinks.length-2].textContent;
2439 }
2440 } catch (e) {
2441 appname='mystery app x';
2442 //unsafeWindow.console.log('error getting application name');
2443 }
2444
2445 } // END if blockmode=normal (if !blockmode.length)
2446 else {
2447 // we are doing this for "started using app/game" (sua) type posts
2448 var uism = node.getElementsByClassName('uiStreamMessage')
2449 var alinks=uism[0].getElementsByTagName('a');
2450 for(var i=0;i<alinks.length;i++){
2451 var datahover=alinks[i].getAttribute('data-hovercard');
2452 if(datahover) {
2453 var datahovermatch=datahover.match(/\/hovercard\/application\.php\?id\=(\d*)/);
2454 //var datahovermatch2=datahover.match(/\/hovercard\/hovercard\.php\?id=(\d*)/);
2455 if(datahovermatch) {
2456 appid=datahovermatch[1];
2457 appname=alinks[i].textContent;
2458 break;
2459 }
2460 /* else if(datahovermatch2) {
2461 appname=alinks[i].textContent;
2462 var nodnod=node.getElementsByTagName('a');
2463 for(var q=0;q<nodnod.length;i++)
2464 if(nodnod[q].textContent.match(appname)) {
2465 appidmatch=nodnod[q].getAttribute('data-hovercard').match(/\/hovercard\/application\.php\?id\=(\d*)/);
2466 if(appidmatch) {
2467 appid=appidmatch[1];
2468 break;
2469 }
2470 }
2471 nodnod=null;
2472 } */
2473 }
2474 }
2475 if(typeof(appid)=='undefined' || appid =='') { // dealing with frictionless sharing apps such as netflix
2476 if(node.getAttribute('data-gt')) {
2477 //"appid":"163114453728333"
2478 if(node.getAttribute('data-gt').match(/\"appid\":\"\d+\"/)) {
2479 appid=node.getAttribute('data-gt').match(/\"appid\":\"(\d+)\"/)[1];
2480 //appname=alinks[alinks.length-1].textContent;
2481 footerstuff=node.getElementsByClassName("uiStreamFooter");
2482 if(footerstuff.length){
2483 footerimagelink=footerstuff[0].getElementsByTagName('a');
2484 if(footerimagelink.length)
2485 if(footerimagelink[0].getAttribute('data-appname'))
2486 appname=footerimagelink[0].getAttribute('data-appname');
2487 }
2488 }
2489 }
2490 }
2491 alinks=null;
2492 }
2493 //console.log(appid + ' ' + appname);
2494
2495 if (document.getElementsByClassName('uiStreamHide') && document.getElementsByClassName('uiStreamHide').length) {
2496 hidebuttonclass='uiStreamHide';
2497 hidebuttonclasses='uiStreamHide';
2498 linkclasses='blocklink uiStreamContextButton uiPopoverTriggerElem';
2499 }
2500 else {
2501 hidebuttonclass='hideButton';
2502 hidebuttonclasses='mlm hideButton';
2503 linkclasses='blocklink mlm hideButton';
2504 }
2505
2506 hidebuttonclasses='uiStreamContextButton uiPopoverTriggerElem';
2507
2508 var blinkinsertpoint=node.getElementsByClassName(hidebuttonclass)[0];
2509
2510 if(typeof blinkinsertpoint == 'undefined') {
2511 //alert('hohoho');
2512 var uism=node.getElementsByClassName('uiStreamMessage');
2513 if(uism && uism.length)
2514 blinkinsertpoint=uism[0];
2515 else
2516 return;
2517 }
2518
2519 node.setAttribute('class', node.getAttribute('class') + ' aid_' + appid); // lets do it for all apps (cos on profile pages apps sometimes dont include this class)
2520 var blinkspan=document.createElement('div');
2521
2522 blinkspan.setAttribute('style',"position:relative;opacity:0.5; top : 23px");
2523 blinkspan.className=hidebuttonclasses;
2524
2525 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>";
2526 blinkspan.getElementsByTagName('a')[0].addEventListener("click", blockappev, false);
2527 //blinkinsertpoint.parentNode.insertBefore(blinkspan, blinkinsertpoint); //(insert before pattern)
2528 blinkinsertpoint.appendChild(blinkspan);
2529 blinkinsertpoint.appendChild(document.createElement('br')); // separate the 2 links
2530
2531 var alinkspan=document.createElement('div');
2532 alinkspan.setAttribute('style',"position:relative; opacity:0.5; top : 23px;");
2533 alinkspan.className=hidebuttonclasses;
2534
2535 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>";
2536 alinkspan.getElementsByTagName('a')[0].addEventListener("click", allowappev, false);
2537 //blinkinsertpoint.parentNode.insertBefore(alinkspan, blinkinsertpoint); //(insert before pattern)
2538 blinkinsertpoint.appendChild(alinkspan);
2539
2540 } // END dspBlockLink function
2541
2542 function callLater(paramA, paramB, paramC, paramD, paramE){
2543 return (function(){
2544 //blockapp(appid, appname, nodeid, auto);
2545 paramA(paramB, paramC, paramD, paramE);
2546 //unsafeWindow.console.log(paramA,paramB, paramC, paramD)
2547 });
2548 }
2549
2550 blockallapps = function() {
2551 var appdump=document.getElementsByClassName('fbpblocked');
2552 var apparray=[];
2553 var appnamelist='';
2554 var applength=0;
2555 for(var i=0;i<appdump.length;i++) {
2556 if(appdump[i].getElementsByClassName('blocklink').length && !apparray[appdump[i].getElementsByClassName('blocklink')[0].getAttribute('appid')]) {
2557 apparray[appdump[i].getElementsByClassName('blocklink')[0].getAttribute('appid')] = appdump[i].getAttribute('id') + ',' + appdump[i].getElementsByClassName('blocklink')[0].getAttribute('appname');
2558 appnamelist+= appdump[i].getElementsByClassName('blocklink')[0].getAttribute('appname') + '\n';
2559 applength++;
2560 }
2561 }
2562
2563 if(applength==1)
2564 return false; // return and use normal block app function
2565
2566 if(!confirm('Would you also like to block *ALL* ' + applength + ' of the following facebook applications?\n' + '-------------------------------------------------------------------------------\n\n' + appnamelist.replace(/\n$/,'')))
2567 return false;
2568
2569 i=0;
2570 for(var j in apparray) {
2571 i++;
2572 var functRef = callLater(blockapp,j,apparray[j].split(/,/)[1], apparray[j].split(/,/)[0], 1);
2573 setTimeout(functRef, 1600*i);
2574 }
2575
2576 window.scrollTo(0,0); // scroll up, so user can see its working
2577
2578 appdump=null;
2579 apparray=null;
2580 appnamelist=null;
2581 return true;
2582
2583 } // END blockallapps function
2584
2585 fbptoggleopts=function(e) {
2586 if(e)
2587 e.preventDefault();
2588 if(!document.getElementById('fbpoptsdiv') && document.getElementById('content') ) {
2589 optsdiv.innerHTML=fbpoptshtml;
2590 document.getElementById('content').appendChild(optsdiv);
2591 document.getElementById('fbpsavesettings').addEventListener('click',fbpsavesettings,false);
2592
2593 document.getElementById('exportsettingslink').addEventListener('click',exportsettingsbasic,false);
2594 document.getElementById('importsettingslink').addEventListener('click',importsettingsbasic,false);
2595
2596 document.getElementById('custextheader').addEventListener('click',hideotherdivs,false);
2597 document.getElementById('appwhitelistheader').addEventListener('click',hideotherdivs,false);
2598 document.getElementById('custcssheader').addEventListener('click',hideotherdivs,false);
2599 }
2600
2601 //fbpgetprefs(); // is this call really neccessary? opts obj should already be populated, though perhaps opts have changed in another tab/window
2602 fbppopulateprefs();
2603 document.getElementById('fbpoptsdiv').style.display='block';
2604 // get latest fbp news
2605 //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
2606 getfbpnews();
2607 }
2608
2609 getfbpnews=function() {
2610 //var FBP_FEED = "https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=5&q=http://feeds.feedburner.com/FacebookPurity";
2611 var FBP_FEED = "www.facebook.com/feeds/page.php?id=408502197558&format=json";
2612 // set a callback function
2613 // 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
2614 var FBP_FEED_URL = window.location.protocol +"\/\/" + FBP_FEED ; //
2615 var fbpnewsdiv=document.getElementById('fbpnewsdiv');
2616 fbpnewsdiv.style.marginLeft='4px';
2617 fbpnewsdiv.style.marginTop='4px';
2618 if(fbpnewsdiv.innerHTML.length)
2619 return;
2620 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>';
2621
2622 //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>';
2623
2624 var http = new window.XMLHttpRequest();
2625 http.open("GET", FBP_FEED_URL, true);
2626 //http.setRequestHeader("Connection", "close");
2627 http.onreadystatechange = function() {
2628 if(http.readyState == 4 && http.status == 200) {
2629 try {
2630 var fbpfeed = JSON.parse(http.responseText);
2631 }
2632 catch (e) {
2633 fbpnewsdiv.innerHTML+='Error : Cant get the news. This can occur if you are logged in to FB as a page Admin.' ;
2634 http=fbpfeed=null;
2635 return;
2636 }
2637 if(fbpfeed.entries.length<4)
2638 feedlength=fbpfeed.entries.length;
2639 else
2640 feedlength=4;
2641
2642 var newsul=document.createElement('ul');
2643 newsul.style.marginTop='3px';
2644 newsul.style.marginLeft='5px';
2645 var newsli = document.createElement('li');
2646 for(i=0;i<feedlength;i++) {
2647 if (!fbpfeed.entries[i].title.replace(/^\ /,'').length) // deal with stupid facebook bug (pics + polls in the json feed dont have titles)
2648 continue;
2649 x =new Date (fbpfeed.entries[i].published);
2650 newsli = document.createElement('li');
2651 newsli.style.marginBottom="2px";
2652 newsli.style.listStyleType="disc";
2653 newsa = document.createElement('a');
2654 newsa.setAttribute('title', "Published - " + x.toLocaleDateString());
2655 newsa.setAttribute('target', "_blank");
2656 newsa.setAttribute('href', fbpfeed.entries[i].alternate);
2657 newsa.appendChild(document.createTextNode(fbpfeed.entries[i].title.replace(/&#039;/g,"'").replace(/&quot;/g,'"')));
2658 newsli.appendChild(newsa);
2659 newsul.appendChild(newsli);
2660 }
2661 fbpnewsdiv.appendChild(newsul);
2662 http=fbpfeed=newsul=newsli=newsa=null;
2663 }
2664 }
2665 http.send();
2666 } // END getfbpnews function
2667
2668 /*
2669 Commented out because code wont work with latest chrome, unless we update to manifest v2
2670
2671 function jsoncallbackwrapper() {
2672
2673 publishjsonnews=function(json) {
2674
2675 var fbpnewsdiv=document.getElementById('fbpnewsdiv');
2676
2677 if(fbpnewsdiv.innerHTML.length)
2678 return;
2679 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>';
2680 if(!json.responseData.feed.entries.length){
2681 fbpnewsdiv.innerHTML+='Error : Cant get the news.' ;
2682 return;
2683 }
2684 //console.log(json.responseData);
2685 fbpfeed=json.responseData.feed;
2686 var newsul=document.createElement('ul');
2687 newsul.style.marginTop='3px';
2688 newsul.style.marginLeft='5px';
2689 var newsli = document.createElement('li');
2690 for(var i=0;i<4;i++) {
2691 x =new Date (fbpfeed.entries[i].publishedDate);
2692 newsli = document.createElement('li');
2693 newsli.style.marginBottom="2px";
2694 newsli.style.listStyleType="disc";
2695 newsa = document.createElement('a');
2696 newsa.setAttribute('title', "Published - " + x.toLocaleDateString());
2697 newsa.setAttribute('target', "_blank");
2698 newsa.setAttribute('href', fbpfeed.entries[i].link);
2699 newsa.appendChild(document.createTextNode(fbpfeed.entries[i].title.replace(/&#039;/,"'")));
2700 newsli.appendChild(newsa);
2701 newsul.appendChild(newsli);
2702 }
2703 if(fbpnewsdiv)
2704 fbpnewsdiv.appendChild(newsul);
2705 fbpfeed=newsul=newsli=newsa=null;
2706 //document.getElementsByTagName('body')[0].appendChild(fbpnewsdiv);
2707 } // END publishjsonnews function
2708
2709 } // END jsoncallbackwrapper
2710
2711 // BEGIN inject code inside jsoncallbackwrapper function into fb page
2712 var script = document.createElement('script');
2713 script.appendChild(document.createTextNode('('+ jsoncallbackwrapper +')();'));
2714 try {
2715 (document.head || document.body || document.documentElement).appendChild(script);
2716 }
2717 catch(e) {
2718 ;//console.log(e , location.href);
2719 }
2720 // END inject jsoncallbackwrapper code into fb page
2721
2722 function grabjsonfeed(url){
2723 //console.log(url);
2724 var script=document.createElement('script');
2725 script.src=url;
2726 script.type="text/javascript";
2727 if(document.getElementsByTagName('head').length)
2728 document.getElementsByTagName('head')[0].appendChild(script);
2729 }
2730 */
2731
2732 function fixarticleredirects (node) {
2733 try {
2734 //console.log('fixarticleredriects');
2735 var xtmp=node.getElementsByTagName('a');
2736 //console.log(node.textContent + xtmp.length);
2737 for (var i=0;i<xtmp.length;i++)
2738 if(xtmp[i].getAttribute('href')){
2739 //console.log(xtmp[i].getAttribute('href'));
2740 if(xtmp[i].getAttribute('href').match(/redirect_uri=(.*)\&/)) { // matches independent and yahoo
2741 //console.log('indep yahoo' + xtmp[i].getAttribute('href'));
2742 xtmp[i].setAttribute('href', decodeURIComponent(xtmp[i].getAttribute('href').match(/redirect_uri=(.*?)\&/)[1].split(/fb_action_ids/)[0]));
2743 xtmp[i].setAttribute('rel','');
2744 xtmp[i].setAttribute('mousedown','');
2745 }
2746 else if (xtmp[i].getAttribute('href').match(/https?\:\/\/www\.guardian\.co\.uk/)) {
2747 xtmp[i].setAttribute('href',decodeURIComponent(xtmp[i].getAttribute('href').match(/(https?\:\/\/www\.guardian\.co\.uk.*?)\?fb_action_ids/)[1]));
2748 //console.log(decodeURIComponent(xtmp[i].getAttribute('href').match(/(http\:\/\/www\.guardian\.co\.uk.*?)\?fb_action_ids/)[1]));
2749 xtmp[i].setAttribute('rel','');
2750 xtmp[i].setAttribute('onmousedown','');
2751 }
2752 else if (xtmp[i].getAttribute('href').match(/https?\:\/\/www\.facebook\.com\/l\.php\?u=/)) {
2753 xtmp[i].setAttribute('href',decodeURIComponent(xtmp[i].getAttribute('href').match(/http\:\/\/www\.facebook\.com\/l\.php\?u=(.*)\%3Ffb_action_ids/)[1]));
2754 //console.log(xtmp[i].getAttribute('href'));
2755 xtmp[i].setAttribute('rel','');
2756 xtmp[i].setAttribute('onmousedown','');
2757 }
2758 else if(xtmp[i].getAttribute('href').match(/https?\:\/\/apps\.facebook\.com/)){
2759 if(xtmp[i].textContent.length){ // && xtmp[i].parentNode.getAttribute('class').match(/ogAggregationAnimSubstorySlideHeadline/)
2760 xtmp[i].setAttribute('href', 'http://google.com/search?q=' + encodeURIComponent("'" + xtmp[i].textContent + "'") + "&btnI=I'm+Feeling+Lucky");
2761 xtmp[i].setAttribute('rel','');
2762 xtmp[i].setAttribute('mousedown','');
2763 }
2764 }
2765 } // end if
2766 //else
2767 // console.log(xtmp[i].getAttribute('href'));
2768 xtmp=null;
2769 } catch(e)
2770 {
2771 ;//console.log('feckit! ' + e );
2772 }
2773 }
2774
2775 function filtermatchmsg(mnode, msg) {
2776 if(mnode.getElementsByClassName('filtermatchtext').length)
2777 mnode.getElementsByClassName('filtermatchtext')[0].textContent=msg;
2778 else {
2779 var matchspan=document.createElement('div');
2780 matchspan.setAttribute('class','filtermatchtext');
2781 matchspan.style.color='grey';
2782 matchspan.appendChild(document.createElement('br'));
2783 matchspan.appendChild(document.createTextNode(msg));
2784 mnode.appendChild(matchspan);
2785 }
2786 }
2787
2788 function cleartheshizzle(thenode) {
2789 //if(location.href.match(/facebook\.com\/messages\//))
2790 // return;
2791 //unsafeWindow.console.log('clearing the shizzle a : ' + location.href);
2792 var oldfeedstyle=document.getElementById('pagelet_home_stream');
2793 var newfeedstyle=document.getElementById('pagelet_litestand_section');
2794 var neweststyle= document.getElementById('stream_pagelet');
2795 //if(!oldfeedstyle && (!newfeedstyle) && (!neweststyle))
2796 if(!(oldfeedstyle || newfeedstyle || neweststyle)) {
2797 console.log('FBP Error: couldnt find the news stream');
2798 return;
2799 }
2800 //if(!document.getElementById('pagelet_home_stream') || (!document.getElementById('pagelet_litestand_section')))
2801 // return;
2802
2803 if(!document.getElementById('fbpblockcount')) {
2804
2805 crappyappmsgcounter=0;
2806 fbpstyle.textContent=fbpStyleNormal;
2807
2808 if(document.getElementById('pagelet_fl_composer')) // friends list page
2809 var insertpoint = document.getElementById('pagelet_fl_composer');
2810 else if (document.getElementById('profile_stream_composer')) //profile page or fanpage
2811 var insertpoint = document.getElementById('profile_stream_composer');
2812 else if (document.getElementById('pagelet_composer')) //homepage
2813 var insertpoint = document.getElementById('pagelet_composer');
2814 else if(document.getElementById('timelineNavContent')) {
2815 return;
2816 var insertpoint = document.getElementById('timelineNavContent');
2817 }
2818 else if(window.location.href.match(/facebook\.com\/apps\/feed/) || window.location.href.match(/facebook\.com\/pages\/feed/))
2819 var insertpoint = document.getElementById('contentArea');
2820
2821 if(insertpoint) {
2822 if(document.getElementsByClassName('uiHeaderPage') && document.getElementsByClassName('uiHeaderPage').length)
2823 document.getElementsByClassName('uiHeaderPage')[0].setAttribute('style','padding-bottom:5px');
2824 var fbpurityinfowrapper=document.createElement('div');
2825 if(oldfeedstyle)
2826 fbpurityinfowrapper.style.marginTop='-10px';
2827 fbpurityinfowrapper.style.marginBottom='2px';
2828 fbpurityinfowrapper.setAttribute('id','fbpurityinfowrapper');
2829 if(document.getElementById('boulder_fixed_header'))
2830 document.getElementById('boulder_fixed_header').firstChild.style.marginTop='13px';
2831 var fbpurityinfo=document.createElement('div');
2832 fbpurityinfo.setAttribute('id','fbpurityinfobar');
2833 var fbpclear=document.createElement('div');
2834 fbpclear.style.clear='both';
2835
2836 fbpurityinfo.style.cssFloat='right';
2837 fbpurityinfo.style.background='whitesmoke';
2838 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;';
2839
2840 fbpurityinfowrapper.appendChild(fbpurityinfo);
2841 fbpurityinfowrapper.appendChild(fbpclear);
2842
2843 if((document.getElementById('pagelet_composer') || document.getElementById('pagelet_fl_composer')) && (!document.getElementById('fbpurityinfobar'))) // homepage // fanpage or // friends list page
2844 insertpoint.parentNode.insertBefore(fbpurityinfowrapper, insertpoint.nextSibling); // after composer
2845 else if (document.getElementById('profile_stream_composer') && (!document.getElementById('fbpurityinfobar')))
2846 insertpoint.parentNode.insertBefore(fbpurityinfowrapper, insertpoint.nextSibling);
2847 else if (document.getElementById('timelineNavContent') && (!document.getElementById('fbpurityinfobar'))) {
2848 fbpurityinfowrapper.style.display='none'; // we not showing bar for now, as filtering doesnt work on timeline yet
2849 insertpoint.appendChild(fbpurityinfowrapper);
2850 }
2851 else if(window.location.href.match(/facebook\.com\/apps\/feed/) || window.location.href.match(/facebook\.com\/pages\/feed/)) { // games feed page
2852 insertpoint.insertBefore(fbpurityinfowrapper, insertpoint.firstChild);
2853 }
2854
2855 document.getElementById('fbpshowblockedlink').addEventListener("click", fbpshowblockedev, false);
2856 document.getElementById('fbpshowblockedxlink').addEventListener("click", fbpshowblockedxev, false);
2857 document.getElementById('fbpoptslink').addEventListener("click", fbptoggleopts, false);
2858
2859 fpbblockcountspan=document.getElementById('fbpblockcount');
2860 fpbblockxcountspan=document.getElementById('fbpblockxcount');
2861
2862 }
2863
2864 }
2865
2866 //if we navigate away from the page then come back, the event listeners seem to disappear, so lets re-add them here.
2867 if( document.getElementById('fbpshowblockedlink') ) {
2868 document.getElementById('fbpshowblockedlink').removeEventListener("click", fbpshowblockedev, false);
2869 document.getElementById('fbpshowblockedlink').addEventListener("click", fbpshowblockedev, false);
2870 }
2871 if( document.getElementById('fbpshowblockedxlink') ) {
2872 document.getElementById('fbpshowblockedxlink').removeEventListener("click", fbpshowblockedxev, false);
2873 document.getElementById('fbpshowblockedxlink').addEventListener("click", fbpshowblockedxev, false);
2874 }
2875 if( document.getElementById('fbpoptslink') ) {
2876 document.getElementById('fbpoptslink').removeEventListener("click", fbptoggleopts, false);
2877 document.getElementById('fbpoptslink').addEventListener("click", fbptoggleopts, false);
2878 }
2879
2880 // Deal with recent activity blocks
2881 /*
2882 if (thenode.getAttribute && thenode.getAttribute('class') && thenode.getAttribute('class').match(/uiStreamMinistoryGroup/)) {
2883 if(fbpoptsobj.recentactivity) {
2884 thenode.setAttribute('class',thenode.getAttribute('class') + ' fbpblockedx');
2885 updateblockedcount();
2886 return;
2887 }
2888 else {
2889 thenode.setAttribute('class',thenode.getAttribute('class') + ' fbpnormal');
2890 return;
2891 }
2892 }
2893 else if(thenode.getElementsByClassName('uiStreamMinistoryGroup').length) {
2894 var rablocks=thenode.getElementsByClassName('uiStreamMinistoryGroup');
2895 for(var rai=0;rai<rablocks.length;i++)
2896 if(fbpoptsobj.recentactivity) {
2897 rablocks[rai].setAttribute('class',rablocks[rai].getAttribute('class') + ' fbpblockedx');
2898 updateblockedcount();
2899 }
2900 else
2901 rablocks[rai].setAttribute('class',rablocks[rai].getAttribute('class') + ' fbpnormal');
2902 rablocks=null;
2903 }
2904 */
2905
2906 storyclass="uiStreamStory";
2907
2908 var storynodes, singlestory;
2909 singlestory=0;
2910 if(oldfeedstyle) {
2911 storynodes=thenode.getElementsByClassName(storyclass);
2912 if (!storynodes[0])
2913 if(thenode.getAttribute && thenode.getAttribute('class') && thenode.getAttribute('class').match(storyclass)) {
2914 storynodes[0]=thenode;
2915 singlestory=1;
2916 }
2917 else {
2918 //unsafeWindow.console.log('no generic: ' + thenode.getAttribute('class'));
2919 return;
2920 }
2921 }
2922 else { // new newsfeed design
2923 storynodes=thenode.querySelectorAll("div[data-dedupekey]");
2924 if (!storynodes[0])
2925 if(thenode.getAttribute && thenode.getAttribute('data-dedupekey')) {
2926 storynodes[0]=thenode;
2927 singlestory=1;
2928 }
2929 else {
2930 //unsafeWindow.console.log('no generic: ' + thenode.getAttribute('class'));
2931 return;
2932 }
2933 }
2934
2935 var blockit, blockitx;
2936 var story_meta, fbpAppId; // story_type,
2937 var attribappid, attribnode, fbpAppIdMatch;
2938 var storysaction, storysactiontext;
2939 var actoria, actorialink, actoriadatacard;
2940 var storyattachments,storyattachment;
2941
2942 if(singlestory)
2943 storynodeslength=1;
2944 else
2945 storynodeslength=storynodes.length;
2946
2947 // START MAIN LOOP
2948 for(i=0;i<storynodeslength;i++) {
2949 if(oldfeedstyle) {
2950 if(storynodes[i].nodeName=='DIV') //deal with anomalous div that has classname pvm
2951 continue;
2952 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'))))
2953 continue;
2954 }
2955
2956 blockit=0;
2957
2958 //console.log(storynodes[i].textContent);
2959
2960 //parse the story's header for the story type and check the header for any matches
2961 if(oldfeedstyle)
2962 storysaction=storynodes[i].getElementsByClassName('uiStreamMessage');
2963 else
2964 storysaction=storynodes[i].getElementsByTagName('h5');
2965 if(storysaction && storysaction.length) {
2966 //unsafeWindow.console.log(storysaction + storysaction.length + storysaction[0].textContent);
2967 storysactiontext=storysaction[0].textContent;
2968 }
2969 else {
2970 if(oldfeedstyle)
2971 storysactiontext='';
2972 else
2973 storysactiontext=storynodes[i].textContent;
2974 }
2975 if(typeof storysactiontext=='undefined')
2976 storysactiontext='';
2977
2978 if(debug)
2979 console.log(storysactiontext);
2980 storyattachments=storynodes[i].getElementsByClassName('uiStreamAttachments');
2981 story_meta=storynodes[i].getAttribute('data-ft');
2982 if(story_meta==null) {
2983 /*
2984 if(storynodes[i].getElementsByClassName('fss').length) { // check for Recent Activity Blocks
2985 // need to check fbpopts for whether to treat as extra
2986 if(fbpoptsobj.recentactivity==1)
2987 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+ ' fbpblockedx');
2988 else
2989 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+ ' fbpnormal');
2990 updateblockedcount();
2991 continue;
2992 }
2993 */
2994 if(storynodes[i].className.match(/uiFacepile|uiListHorizontal|uiListVerticalItemBorder/)) { // deals with new feature of friends list pages
2995 continue;
2996 }
2997 break;
2998 }
2999
3000 // sponsored stories filter
3001 if(fbpoptsobj.sponsoredbox && story_meta && story_meta.match(/"ei"/)) {
3002 storynodes[i].style.display='none';//backgroundColor='red';
3003 continue;
3004 }
3005 // "play with friends" story filter
3006 if(fbpoptsobj.filterappmessages && storynodes[i].getAttribute('class').match(/aid_140332009231/)) {
3007 storynodes[i].style.display='none'; //.style.backgroundColor='red';
3008 continue;
3009 }
3010
3011 // experimental swearing filter (seems a bit memory intensive..)
3012 /*
3013 var swearfilter=1;
3014 if(swearfilter) {
3015 storynodes[i].innerHTML=storynodes[i].innerHTML.split(/cunt|shit|piss|fuck|wank|arse|tits|cocksucker/).join("****");
3016 }
3017 */
3018
3019 /*
3020 var foundspon=0;
3021 ufooter=storynodes[i].getElementsByClassName('uiStreamFooter');
3022 if(ufooter.length){
3023 for(g=0;g<ufooter.length;g++)
3024 if(ufooter[g].textContent.match(/· Sponsored/)) {
3025 storynodes[i].style.display='none';
3026 if(debug)
3027 console.log("Hid sponsored story\n\n" + storynodes[i].textContent);
3028 foundspon=1;
3029 break;
3030 }
3031 if(foundspon)
3032 continue;
3033 }
3034 */
3035
3036 // 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,
3037 //if(fbpoptsobj.pagestory && (!document.getElementById('pagelet_pages_about'))) {
3038 //console.log(storynodes[i].innerHTML);
3039 actoria=storynodes[i].getElementsByClassName('uiStreamMessage');
3040 if(actoria.length) {
3041 actorialink=actoria[0].getElementsByTagName('a')[0];
3042 if(typeof(actorialink)!='undefined') {
3043 actoriadatacard=actorialink.getAttribute('data-hovercardx');
3044 if(!actoriadatacard)
3045 actoriadatacard=actorialink.getAttribute('data-hovercard');
3046 }
3047 if(actoriadatacard) {
3048 if (actoriadatacard.match(useridwhitelistRX)) { // if its fbp or the current user
3049 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+ ' fbpnormal');
3050 actoriadatcard=null;
3051 actorialink=null;
3052 actoria=null;
3053 continue;
3054 }
3055 else if(fbpoptsobj.pagestory && (!document.getElementById('pagelet_pages_about')) && actoriadatacard.match(/page\.php/) && (!window.location.href.match(/facebook.com\/(pages\/feed|lists\/)/))) {
3056 // if we are on the "page feed" or interest list leave it alone
3057 //if(actoriadatacard.match(/page\.php/) && (!actoriadatacard.match(/id=408502197558/))) {
3058 //its a page and its not fbp;
3059 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+ ' fbpblockedx');
3060 filtermatchmsg(storynodes[i],'FBP : Story Type Filter Match - Fan Page Story');
3061 updateblockedcount();
3062 actoriadatcard=null;
3063 actorialink=null;
3064 actoria=null;
3065 continue;
3066 }
3067 actoriadatacard=null;
3068 }
3069 actorialink=null;
3070 }
3071 actoria=null;
3072 // end fan page story filter
3073
3074 //unsafeWindow.console.log('"'+storysactiontext+'"' + ' ' + headerTextFilter);
3075 // lets check the header text filter
3076 if((fbpoptsobj.fixarticleredirects && storysactiontext.length && storysactiontext.match(/ article/)) || storynodes[i].getElementsByClassName('ogAggregationSubstory').length || storynodes[i].getElementsByClassName('ogStaticSlidePager').length || storynodes[i].getElementsByClassName('ogSliderAnimPager').length) {
3077 fixarticleredirects(storynodes[i]);
3078 }
3079
3080 if(storysactiontext.length && headerTextFilter.length && storysactiontext.match(headertextfilterRX)) {
3081 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
3082 //matchspan=document.createElement('div');
3083 //matchspan.style.color='grey';
3084 matchedtext=storysactiontext.match(headertextfilterRX)[0];
3085 filtermatchmsg(storynodes[i],' FBP : Story Type Filter Match - ' + matchedtext);
3086 //if(matchedtext.match(/ article/))
3087 // fixarticleredirects(storynodes[i]);
3088 storysactiontext=matchedtext='';
3089 updateblockedcount();
3090 continue;
3091 }
3092
3093 // lets check the text filter
3094 if(cleancustomtextfilter.length && storynodes[i].textContent.length && storynodes[i].textContent.match(textfilterRX)) {
3095 //window.console.log(storynodes[i].textContent)
3096 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
3097 filtermatchmsg(storynodes[i],' FBP : Custom Text Filter Match - ' + storynodes[i].textContent.match(textfilterRX)[0]);
3098 updateblockedcount();
3099 continue;
3100 }
3101
3102 // if hide all photos option has specifically been ticked
3103 //if(fbpoptsobj.sharedphoto && fbpoptsobj.uploadedphoto && fbpoptsobj.taggedlikescommentphoto && fbpoptsobj.taggedalbum)
3104 if((typeof fbpoptsobj.hideallphotos!=='undefined') && fbpoptsobj.hideallphotos)
3105 if(!window.location.href.match(/facebook\.com\/\?sk=app_2305272732_2392950137/))
3106 if(storynodes[i].getElementsByClassName('photoRedesign').length) {
3107 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
3108 filtermatchmsg(storynodes[i],' FBP : Story Type Filter Match - Hide All Photos');
3109 updateblockedcount();
3110 continue;
3111 }
3112
3113 if((typeof fbpoptsobj.hideallvideos!=='undefined') && fbpoptsobj.hideallvideos) {
3114 //if(!window.location.href.match(/facebook\.com\/\?sk=app_2305272732_2392950137/))
3115 if(storynodes[i].getElementsByClassName('uiVideoThumb').length) {
3116 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
3117 filtermatchmsg(storynodes[i],' FBP : Story Type Filter Match - Hide All Videos');
3118 updateblockedcount();
3119 continue;
3120 }
3121 }
3122 else if ((typeof fbpoptsobj.sharedvideo!=='undefined') &&fbpoptsobj.sharedvideo){
3123 var svid=storynodes[i].getElementsByClassName('shareMediaVideo');
3124 if(svid.length)
3125 if(svid[0].getAttribute('href') && svid[0].getAttribute('href').match(/facebook\.com\/video\/video\.php/)) {
3126 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
3127 filtermatchmsg(storynodes[i],' FBP : Story Type Filter Match - Hide Shared Video');
3128 updateblockedcount();
3129 svid=null;
3130 continue;
3131 }
3132 }
3133
3134 // probably could get rid of this bracket... (it used to be part of a big if/else statement
3135 {
3136 // so far it looks like a normal story, but lets check if its been posted by an application
3137 //unsafeWindow.console.log("normal?:" + storynodes[i].getElementsByClassName('uiStreamSource')[0].textContent);
3138 blockit=0;
3139
3140 // these 3 blocks of code need to be refactored
3141 attribnode=storynodes[i].getElementsByClassName('UIIntentionalStory_BottomAttribution');
3142 if(attribnode && attribnode.length) {
3143 attribnode=attribnode[0];
3144 if(attribnode.innerHTML.match(/\?id=(\d+)\"/)) {
3145 attribappid=attribnode.innerHTML.match(/\?id=(\d+)\"/)[1];
3146 if(attribappid){
3147 if(!arrwhitelist2[attribappid])
3148 blockit=1; // its not in the whitelist so block it
3149 }
3150 }
3151 }
3152
3153 attribnode2=storynodes[i].getElementsByClassName('GenericStory_BottomAttribution');
3154 if(attribnode2 && attribnode2.length) { // GenericStory
3155 attribnode2=attribnode2[0];
3156 if (attribnode2.innerHTML.match(/id=(\d+)/)) {
3157 attribappid=attribnode2.innerHTML.match(/id=(\d+)/)[1];
3158 if(attribappid){
3159 if(!arrwhitelist2[attribappid])
3160 blockit=1; // its not in the whitelist so block it
3161 }
3162 }
3163 }
3164
3165 attribnode3=storynodes[i].getElementsByClassName('uiStreamSource');
3166 if(attribnode3 && attribnode3.length) {
3167 attribnode3=attribnode3[0];
3168 if (attribnode3.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)) {
3169 if(typeof attribnode3.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)[1] !='undefined')
3170 attribappid=attribnode3.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)[1];
3171 else if (typeof attribnode3.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)[2] !='undefined')
3172 attribappid=attribnode3.innerHTML.match(/php\?id=(\d+)\"|\&quot\;app_id\&quot\;\:(\d+)\,/)[2];
3173 if(attribappid){
3174 if(!arrwhitelist2[attribappid])
3175 blockit=1; // its not in the whitelist so block it
3176 }
3177 }
3178 }
3179
3180 attribnode4=storynodes[i].getElementsByClassName('UIActionLinks_bottom');
3181 if(attribnode4 && attribnode4.length) {
3182 attribnode4=attribnode4[0];
3183 if (attribnode4.innerHTML.match(/application.php\?id=(\d+)/)) {
3184 attribappid=attribnode4.innerHTML.match(/application.php\?id=(\d+)/)[1];
3185 if(attribappid){
3186 if(!arrwhitelist2[attribappid])
3187 blockit=1; // its not in the whitelist so block it
3188 }
3189 }
3190 }
3191 // new app checks for fb actions / frictionless sharing apps
3192 var sua=0;
3193 if(storysaction && storysaction.length) {
3194 attribappid=storysaction[0].innerHTML.match(/\/hovercard\/application\.php\?id\=(\d*)/);
3195 if(attribappid) {
3196 if(!arrwhitelist2[attribappid[1]]) {
3197 blockit=1; // its not in the whitelist so block it
3198 sua=1; // sua = started using app?
3199 }
3200 }
3201 else {
3202 if(storynodes[i].getAttribute('data-gt')) {
3203 //"appid":"163114453728333"
3204 if(storynodes[i].getAttribute('data-gt').match(/\"appid\":\"\d+\"/)) {
3205 attribappid=storynodes[i].getAttribute('data-gt').match(/\"appid\":\"(\d+)\"/)[1];
3206 if(!arrwhitelist2[attribappid]) {
3207 blockit=1; // its not in the whitelist so block it
3208 sua=1; // sua = started using app?
3209 }
3210 }
3211 }
3212 }
3213 }
3214
3215 if(blockit) {
3216 // mark app as blocked
3217 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+ filterapptext);
3218 if(sua)
3219 dspBlockLink(storynodes[i],"sua");
3220 else
3221 dspBlockLink(storynodes[i]);
3222 }
3223 else {
3224 //its probably a "normal" story node but lets check for attachments (photos or links)
3225 //if ((fbpoptsobj.postedlink || fbpoptsobj.sharedphoto) && (!storynodes[i].getAttribute('class').match(/fbp/)) && storyattachments.length ) {
3226 if (fbpoptsobj.postedlink && (!storynodes[i].getAttribute('class').match(/fbp/)) && storyattachments.length ) {
3227 storyattachment=storyattachments[0];
3228 storylinks=storyattachment.getElementsByTagName('a');
3229 if(storylinks.length) {
3230 storylink=storylinks[0];
3231 if (fbpoptsobj.postedlink && storylink.getAttribute('onclick') && storylink.getAttribute('onclick').match(/^LinkshimAsync/)) {
3232 //its an external link
3233 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
3234 //unsafeWindow.console.log("postedlink= " +fbpoptsobj.postedlink);
3235 //storynodes[i].appendChild(filtermatchmsg(' FBP : Story Type Filter - Shared a link'));
3236 filtermatchmsg(storynodes[i],' FBP : Story Type Filter - Shared a link');
3237 }
3238 /*else if (fbpoptsobj.sharedphoto && storynodes[i].getElementsByClassName('uiPhotoThumb').length) // should we also check for uiMediaThumb ???
3239 // its a shared photo
3240 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');*/
3241 else {
3242 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpnormal');
3243 }
3244 }
3245 else {
3246 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpnormal');
3247 }
3248 //else if(storyattachment.getElementsByClassName('uiVideoThumb').length)
3249 //unsafeWindow.console.log(storyattachment.textContent);
3250 //check for attachments
3251 storyattachments={};
3252 storyattachment=null;
3253 }
3254 else
3255 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpnormal');
3256 }
3257 // check for wall posts
3258 if(fbpoptsobj.commentwall && (typeof(storynodes[i])!='undefined') && storynodes[i].getAttribute && storynodes[i].getAttribute('class').match(/fbpnormal/)) {
3259 var wallarrows=storynodes[i].getElementsByClassName('wallArrowIcon');
3260 if(wallarrows.length) {
3261 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class').replace('fbpnormal','') + ' fbpblockedx');
3262 //storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
3263 //storynodes[i].appendChild(filtermatchmsg(' FBP : Story Type Filter Match - Commented on Wall'));
3264 filtermatchmsg(storynodes[i],' FBP : Story Type Filter Match - Wrote on Wall');
3265 }
3266 }
3267 }
3268
3269 updateblockedcount();
3270
3271 } // End For Loop through feed nodes
3272
3273 storynodes=null;
3274
3275 }// END cleartheshizzle function
3276
3277
3278 ///////////////////////////////////////
3279 // BEGIN BRING BACK NORMAL COMMENTING
3280 ///////////////////////////////////////
3281 bringbacknormalcommenting = function() {
3282 if(debug)
3283 console.log('inside bring back normal commenting function');
3284
3285 if(typeof(window.navigator.vendor)!='undefined') //fix the stupid comment box growing too much in safari and chrome
3286 if(window.navigator.userAgent.match(/Safari/)) //Apple Computer
3287 //if(window.navigator.userAgent.match(/AppleWebKit/))
3288 if(document.getElementById('fbpfreestyler'))
3289 document.getElementById('fbpfreestyler').textContent += ' textarea.uiTextareaAutogrow {max-height:250px !important}'
3290
3291 fbptasubmit = function (e) {
3292 //console.log(e.target.getAttribute('id'));
3293 //var fbpcta=document.getElementById('x' + e.target.getAttribute('id').split(/butt/)[0]);
3294 var fbpcta=document.querySelector("textarea[data-x-reactid=\""+ e.target.getAttribute('id').split(/butt/)[0] + "\"]"); // getElementById('x' + e.target.getAttribute('id').split(/butt/)[0]);
3295 if(!fbpcta)
3296 return;
3297 //fbpcta.setAttribute('id',fbpcta.getAttribute('id').split(/x/)[1]);
3298 fbpcta.setAttribute('data-reactid',fbpcta.getAttribute('data-x-reactid'));
3299 fbpcta.focus();
3300 e.target.value="Now press 'Enter' to submit your comment";
3301 //e.target.parentNode.style.left="95px"; // width is wrong for photo comments
3302
3303 //if(window.navigator.userAgent.match(/Opera/))
3304 // e.target.removeListener('click',fbtasubmit)
3305 //else
3306 e.target.disabled=true;
3307 if(window.navigator.userAgent.match(/Opera/))
3308 e.target.style.backgroundColor='red !important';
3309 var xnode=fbpcta;
3310 while(xnode.parentNode) {
3311 if(xnode.parentNode.nodeName=="FORM") {
3312 //xnode.parentNode.submit();
3313 //window.Event.__inlineSubmit(xnode.parentNode);
3314 break;
3315 }
3316 xnode=xnode.parentNode
3317 }
3318 }
3319
3320 if (fbpoptsobj.commentbutton) { // when editing a comment, if first key pressed is enter, the text is submitted, if not then it works ok.
3321 if(debug)
3322 console.log('bring back normal commenting function is ENABLED');
3323 window.addEventListener('keydown', function(event) {
3324 if (event.target.tagName && (event.target.tagName=="TEXTAREA")) {
3325 if(event.target.getAttribute('class')) {
3326 event.target.setAttribute('class',event.target.getAttribute('class').replace(/enter_submit/,''));
3327 }
3328 if(event.target.getAttribute('data-reactid')) { // && event.target.getAttribute('id').match(/^\.reactRoot/)
3329 event.target.setAttribute('data-x-reactid',event.target.getAttribute('data-reactid'));
3330 event.target.setAttribute('data-reactid',''); //'x' + event.target.getAttribute('data-reactid'));
3331 var tmph=event.target.parentNode.parentNode.parentNode.getElementsByClassName('monglab');
3332 if(tmph.length) {
3333 tmph[0].getElementsByTagName('input')[0].value='Comment';
3334 //tmph[0].getElementsByTagName('input')[0].parentNode.style.left="250px";
3335 if(window.navigator.userAgent.match(/Opera/))
3336 tmph[0].getElementsByTagName('input')[0].style.backgroundColor="#5B74A8";
3337 tmph[0].getElementsByTagName('input')[0].disabled=false;
3338 // tmph[0].addEventListener('click',fbptasubmit,false);
3339 //else
3340 // tmph[0].getElementsByTagName('input')[0].disabled=false;
3341 }
3342 else {
3343 monglab=document.createElement('label');
3344 //monglab.setAttribute('style','float:right');
3345 monglab.setAttribute('class','monglab mts commentBtn stat_elem optimistic_submit uiButton uiButtonConfirm');
3346 monglab.setAttribute('style','');//position:relative;left:250px // width is wrong for photo comments
3347 monglab.innerHTML='<input value="Comment" class="enter_submit_target" name="comment" type="button" id="' + event.target.getAttribute('data-x-reactid') + 'butt' + '">';
3348 monglab.addEventListener('click',fbptasubmit,false);
3349 event.target.parentNode.parentNode.parentNode.appendChild(monglab);
3350 }
3351 }
3352 }
3353 } , false);
3354
3355 if (document.getElementById('fbpfreestyler'))
3356 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}';
3357
3358 bringbackcommentbuttons=function () {
3359 //deal with the ticker flyout comment boxes
3360 var plops=document.getElementsByClassName('uiContextualDialogPositioner');
3361 var combutts2;
3362 for(var i=0;i<plops.length;i++) {
3363 combutts2=plops[i].getElementsByClassName('optimistic_submit');
3364 if(combutts2.length)
3365 combutts2[0].setAttribute('style','display:block !important');
3366 }
3367 //deal with birthday flyout comment boxes and groups new member boxes
3368 var remconts=document.getElementsByClassName('fbRemindersContent');
3369 if(remconts.length) {
3370 for(var m=0;m<remconts.length;m++) {
3371 plops=remconts[m].getElementsByClassName('pam');
3372 var combutts3,comta;
3373 for(i=0;i<plops.length;i++) {
3374 combutts3=plops[i].getElementsByClassName('hidden_elem');
3375 for(j=combutts3.length-1;j>=0;j--)
3376 if(!combutts3[j].getAttribute('class').match(/highlighterContent/) && (combutts3[j].nodeName!='DIV'))
3377 combutts3[j].setAttribute('class','uiButton uiButtonConfirm');
3378 comta=plops[i].getElementsByClassName('enter_submit');
3379 for(l=comta.length-1;l>=0;l--)
3380 comta[l].setAttribute('class',comta[l].getAttribute('class').replace('enter_submit',''));
3381 }
3382 }
3383 }
3384
3385 // deal with birthdays box in newsfeed itself
3386 var blobuts=document.querySelectorAll('.-cx-PRIVATE-fbGiftTodayBirthdays__list label.hidden_elem');
3387 if(blobuts.length)
3388 for(m=0;m<blobuts.length;m++)
3389 blobuts[m].setAttribute('class','uiButton uiButtonConfirm');
3390
3391 plops=remconts=comta=blobuts=null;
3392 }
3393
3394 bringbackcommentbuttons();
3395
3396 var waitfordom=setInterval(function(){
3397 //clearInterval(waitfordom);
3398 bringbackcommentbuttons();
3399 }, 3000);
3400
3401 } // END IF hide button option has not been selected
3402 else
3403 if(debug)
3404 console.log('bring back normal commenting function is NOT ENABLED');
3405 /////////////////////////////////////
3406 // END BRING BACK NORMAL COMMENTING
3407 /////////////////////////////////////
3408 } // end bringbacknormalcommenting function
3409
3410 function fixexternallinkredirects() {
3411 // fix external link redirects
3412 window.setTimeout(function() {UntrustedLink=null;if(typeof(LinkshimAsyncLink)!='undefined') LinkshimAsyncLink.referrer_log = LinkshimAsyncLink.swap = search_logged_ajax=function(){;};},0);
3413 window.setTimeout(function() {UntrustedLink=null;if(typeof(LinkshimAsyncLink)!='undefined') LinkshimAsyncLink.referrer_log = LinkshimAsyncLink.swap = search_logged_ajax=function(){;};},5000);
3414 window.setInterval(function(){UntrustedLink=null;if(typeof(LinkshimAsyncLink)!='undefined') LinkshimAsyncLink.referrer_log = LinkshimAsyncLink.swap = search_logged_ajax=function(){;};},60000);
3415
3416 unmanglelinks = function(nodetofix) {
3417 //console.log(typeof(nodetofix));
3418 if(typeof(nodetofix)=='undefined')
3419 var nodetofix=document;
3420 if(nodetofix.getElementsByTagName) {
3421 var as=nodetofix.getElementsByTagName('a');
3422 for(var i=0;i<as.length;i++)
3423 if(as[i].href && as[i].href.match(/\/l\.php\?/)) {
3424 as[i].href=decodeURIComponent(as[i].href.match(/\/l\.php\?u=(.*)\&h=/)[1]);
3425 //console.log(decodeURIComponent(as[i].href));
3426 }
3427 }
3428 }
3429 window.setTimeout(unmanglelinks,3000); // run on first load of page
3430 }
3431
3432 // new fix links code>
3433 //as=document.getElementsByTagName('a');for(i=0;i<as.length;i++)if(as[i].href.match(/\/l\.php/))console.log(as[i].href)
3434
3435
3436 // this function is duplicated, as it is also injected into the page's dom, so it can run from there too
3437 unmanglelinks = function(nodetofix) {
3438 //console.log('unmanglelinks');
3439 if(typeof(nodetofix)=='undefined')
3440 var nodetofix=document;
3441 if(nodetofix.getElementsByTagName) {
3442 var as=nodetofix.getElementsByTagName('a');
3443 for(var i=0;i<as.length;i++) {
3444 //if(as[i].href.match(/l\.php/)) console.log((as[i].href));
3445 if(as[i].href.match(/\/l\.php\?u=(.*)\&h=/)) {
3446 as[i].href=decodeURIComponent(as[i].href.match(/\/l\.php\?u=(.*)\&h=/)[1]);
3447 //console.log(decodeURIComponent(as[i].href));
3448 }
3449 }
3450 }
3451 }
3452 // END Duplicated function
3453
3454 ////////////////////////////////////////////////////////////////
3455 // BEGIN FUNCTION deleterecentactivitymodule
3456 // function deleterecentactivitymodule is just a wrapper for the code, so we can inject it into the fb page
3457 function deleterecentactivitymodule () {
3458
3459 /* BEGIN HISTORY STATE CHANGE HANDLER */
3460 (function(history){
3461 var pushState = history.pushState;
3462 history.pushState = function(state) {
3463 if (typeof history.onpushstate == "function") {
3464 history.onpushstate({state: state});
3465 }
3466 // ... whatever else you want to do
3467 // maybe call onhashchange e.handler
3468 //console.log('history state changed:' + arguments[0]);
3469 // experiment to disable theatre mode
3470 //if(arguments[0].match(/\/photo\.php\?.*\&theater/))
3471 // location.href=arguments[0];
3472
3473 /* facebook has now added an event delete button
3474 if(arguments[0].match(/\/events\//)) {
3475 setTimeout(deleventbutt,3000);
3476 }
3477 */
3478
3479 if(arguments[0].match(/\/appcenter\//)) {
3480 setTimeout(highlightemailrequest,2500);
3481 }
3482
3483 //console.dir(arguments[0]);
3484 return pushState.apply(window.history, arguments);
3485 }
3486 })(window.history);
3487 /* END HISTORY STATE CHANGE HANDLER*/
3488
3489 }
3490 // END FUNCTION deleterecentactivitymodule
3491
3492 addexternallinkfix = function() {
3493 /////////////////////////////////////////////////////////////
3494 // BEGIN inject deleterecentactivitymodule code into fb page
3495 var scriptx = document.createElement('script');
3496 scriptx.setAttribute('id','scriptx');
3497 if(fbpoptsobj.fixarticleredirects) // fix external link redirects
3498 scriptx.appendChild(document.createTextNode('('+ fixexternallinkredirects +')();'));
3499
3500 scriptx.appendChild(document.createTextNode('('+ deleterecentactivitymodule +')();'));
3501
3502 (document.head || document.body || document.documentElement).appendChild(scriptx);
3503 // END inject deleterecentactivitymodule code into fb page
3504 ////////////////////////////////////////////////////////////////
3505 }
3506
3507 addblockbuttontopermreq = function() {
3508 buttbars=document.getElementsByClassName('platform_dialog_buttons');
3509 if(!buttbars.length)
3510 buttbars=document.getElementsByClassName('rightContent');
3511 if(buttbars.length) {
3512 buttbar=buttbars[0];
3513 //if(location.href.match(/client_id=/)
3514 //var bappid=window.location.href.match(/[client|app]_id=(\d*)/)[1];
3515 var bappid;
3516 if(document.getElementById('input_app_id'))
3517 bappid=document.getElementById('input_app_id').getAttribute('value');
3518 else if (document.getElementsByClassName('legalese').length) {
3519 var legas=document.getElementsByClassName('legalese')[0].getElementsByTagName('a');
3520 if(legas.length)
3521 for(var v=legas.length-1;v>=0;v--)
3522 if(legas[v].getAttribute('ajaxify').match(/cid=(\d+)/)) {
3523 bappid=legas[v].getAttribute('ajaxify').match(/cid=(\d+)/)[1];
3524 break;
3525 }
3526 }
3527
3528 var titleclass=document.getElementsByClassName('fsxl');
3529 if(titleclass.length)
3530 var bapname=titleclass[0].textContent;
3531 else
3532 if(document.getElementById('permPanel'))
3533 bapname=document.getElementById('permPanel').getElementsByTagName('b')[0].textContent;
3534 else
3535 var bapname="Application";
3536 /*
3537 blahlink=document.createElement('a');
3538 blahlink.setAttribute('ajaxify','/ajax/apps/block_app.php?app_id=' + bappid + '&type_index=0&source=about&confirm_id=block_app_link');
3539 blahlink.setAttribute('rel','dialog');
3540 blahlink.setAttribute('id','js_3');
3541 blahlink.style.marginLeft='4px';
3542
3543 blahlab=document.createElement('label');
3544 blahlab.setAttribute('class','uiButton uiButtonConfirm uiButtonLarge');
3545 blahlab.setAttribute('id','blockapplab');
3546 blahlab.setAttribute('appid',bappid);
3547 blahlab.setAttribute('appname',bapname);
3548 blahlab.setAttribute('nodeid','platform_dialog_content'); //globalContainer
3549 //blahlab.setAttribute('style','position:absolute;top:-15px;left:520px');
3550 blahlab.setAttribute('title','Block this application with F.B. Purity');
3551 //blahlab.innerHTML='<input value="Block App" name="block" type="button" id="appblocker">';
3552 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>';
3553 blahlink.appendChild(blahlab);
3554 // new block code, get id of cancel_click button, and click it to close dialog
3555 //<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>
3556
3557 buttbox=document.getElementsByClassName('rightContent');
3558 if(buttbox.length)
3559 buttbox[0].appendChild(blahlink);
3560 else {
3561 buttbox2=document.getElementsByClassName('platform_dialog_buttons');
3562 if(buttbox2.length)
3563 buttbox2[0].appendChild(blahlink);
3564 }
3565 */
3566
3567 /* BEGIN NEW / OLD CODE */
3568 /* ---------------------*/
3569 blahlab=document.createElement('label');
3570 blahlab.setAttribute('class','uiButton uiButtonConfirm uiButtonLarge');
3571 blahlab.setAttribute('id','blockapplab');
3572 blahlab.setAttribute('appid',bappid);
3573 blahlab.setAttribute('appname',bapname);
3574 blahlab.setAttribute('nodeid','platform_dialog_content');//globalContainer
3575 if(!document.getElementById('platform_dialog_content'))
3576 if(document.getElementsByClassName('tosPane').length)
3577 document.getElementsByClassName('tosPane')[0].setAttribute('id','platform_dialog_content');
3578
3579 //blahlab.setAttribute('style','position:absolute;top:-15px;left:520px');
3580 blahlab.setAttribute('title','Block this application with F.B. Purity');
3581 blahlab.innerHTML='<input value="Block App" name="block" type="button" id="appblocker">';
3582 //document.getElementById('content').appendChild(blahlab);
3583 buttbox=document.getElementsByClassName('rightContent');
3584 if(buttbox.length)
3585 buttbox[0].appendChild(blahlab);
3586 else {
3587 buttbox2=document.getElementsByClassName('platform_dialog_buttons');
3588 if(buttbox2.length)
3589 buttbox2[0].appendChild(blahlab);
3590 }
3591
3592 if(document.getElementById('appblocker'))
3593 document.getElementById('blockapplab').addEventListener('click',blockappev,false);
3594 /* -------------------*/
3595 /* END NEW / OLD CODE */
3596
3597 //if(document.getElementById('appblocker'))
3598 // document.getElementById('blockapplab').addEventListener('click',blockappev,false);
3599
3600 //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
3601 // document.getElementById('block_app_link').addEventListener('click',function() { document.getElementById('cancel_clicked').click();},false);
3602
3603 // if requesting permission to send direct emails, warn user by highlighting it
3604 highlightemailrequest();
3605 }
3606 }
3607
3608 highlightemailrequest = function() {
3609 //console.log('did we get here?')
3610 // if a facebook application is requesting the users email address highlight it
3611 var appperms=document.getElementsByClassName('gdp_list_item');
3612 if(appperms.length)
3613 for(var i=0;i<appperms.length;i++) {
3614 if(appperms[i].getElementsByClassName('send-email-change-link').length)
3615 appperms[i].setAttribute('style', 'border:4px solid red');
3616 if(appperms[i].textContent.match(/Post on my behalf/))
3617 appperms[i].setAttribute('style', 'border:4px solid red');
3618 }
3619 var emailperms=document.getElementsByTagName('input');
3620 if(emailperms.length)
3621 for(i=0;i<emailperms.length;i++)
3622 if(emailperms[i].getAttribute('name')=='GdpEmailBucket_grantEmailType')
3623 emailperms[i].parentNode.setAttribute('style', 'border:4px solid red');
3624 if(document.getElementsByClassName && document.getElementsByClassName('gdp_right_container').length && document.getElementsByClassName('gdp_right_container')[0].getElementsByClassName('mbm').length)
3625 document.getElementsByClassName('gdp_right_container')[0].getElementsByClassName('mbm')[0].setAttribute('style','border:4px solid red; color:black !important'); // ( can post as you )
3626 if(document.getElementsByClassName && document.getElementsByClassName('permissionsPublishActionsBadge').length)
3627 document.getElementsByClassName('permissionsPublishActionsBadge')[0].setAttribute('style','border:4px solid red');
3628 if(document.getElementsByClassName('tosPane').length) {
3629 var tossas=document.getElementsByClassName('tosPane')[0].getElementsByTagName('a');
3630 for(i=0;i<tossas.length;i++)
3631 if(tossas[i].getAttribute('href') && tossas[i].getAttribute('href').match(/about\/privacy\/your-info-on-other\#applications/)) {
3632 if(!tossas[i].parentNode.textContent.match(tossas[i].getAttribute('aria-label'))) {
3633 tossas[i].parentNode.appendChild(document.createTextNode(' - ' + tossas[i].getAttribute('aria-label') ));
3634 break;
3635 }
3636 }
3637 }
3638 tossas=appperms=emailperms=null;
3639
3640 // test why the button doesnt show up sometimes...
3641 //console.log(location.href.match(/facebook\.com\/appcenter\//));
3642 //console.log(location.href.match(document.getElementsByClassName('mll').length));
3643
3644 // add prominent block app button to app center app pages
3645 if(window.location.href.match(/facebook\.com\/appcenter\//) && document.getElementsByClassName('mll').length) // if theres buttons {
3646 if(document.getElementById('block_app_link') && !document.getElementById('block_app_link2')) {
3647 var aja=document.getElementById('block_app_link').getElementsByTagName('a')[0].getAttribute('ajaxify');
3648 var ajatext=document.getElementById('block_app_link').getElementsByTagName('a')[0].textContent;
3649 var ajalab=document.createElement('label');
3650 ajalab.setAttribute('class','uiButton uiButtonConfirm uiButtonLarge');
3651 ajalab.setAttribute('id','block_app_link2');
3652 ajalab.setAttribute('title','Block this application with FB Purity');
3653 ajalab.style.color='white';
3654 ajalab.textContent= ajatext + ' App';
3655 var ajalink=document.createElement('a');
3656 ajalink.setAttribute('ajaxify',aja.replace('block_app_link','block_app_link2'));
3657 ajalink.setAttribute('href','#');
3658 ajalink.setAttribute('rel','dialog-post');
3659 ajalink.setAttribute('role','button');
3660 ajalink.appendChild(ajalab);
3661 document.getElementsByClassName('mll')[0].setAttribute('class','mll');
3662 document.getElementsByClassName('mll')[0].appendChild(document.createTextNode(' '));
3663 document.getElementsByClassName('mll')[0].appendChild(ajalink);
3664 }
3665 if(window.location.href.match(/facebook\.com\/appcenter\//)) {
3666 // add BA (and eventually WL) links to all app listings in app center (this part is a work in progress/not completed yet)
3667 if(document.getElementsByClassName('appsListHeader').length) {
3668 topspan=document.createElement('span');
3669 topspan.setAttribute('style','color:red;font-weight:bold;margin-left:10px')
3670 topspan.setAttribute('id','block_app_link');
3671 document.getElementsByClassName('appsListHeader')[0].appendChild(topspan);
3672 var appslistparent=document.getElementsByClassName('apps_list');
3673 if(!appslistparent.length)
3674 return;
3675 var appslist = appslistparent[0].getElementsByClassName('uiListItem');
3676 if(!appslist.length)
3677 return;
3678 for(i=0;i<appslist.length;i++) {
3679 tspan=document.createElement('div');
3680 tspan.setAttribute('class','uiPopover appFeedbackMenu');
3681 tspan.setAttribute('style','top:18px');
3682 appid=appslist[i].getAttribute('data-gt').match(/appid":"(\d+)"/)[1]; //match(/appid\&quot;:\&quot;(\d+)\&quot;/)[1]
3683 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>';
3684 appslist[i].getElementsByClassName('appName')[0].appendChild(tspan);
3685 }
3686
3687 }
3688 }
3689 //<div style="top:15px"></div>
3690
3691 } // END highlightemailrequest function
3692
3693 /*BEGIN Check if this page is an authorise app page so we can add a block button
3694 Example URLS https://www.facebook.com/connect/uiserver.php?app_id=216694208368074
3695 Scenarios: oauth page / request permissions page / app page
3696 */
3697 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/))
3698 if(!window.navigator.userAgent.match(/Opera\//))
3699 addblockbuttontopermreq();
3700 else
3701 setTimeout(addblockbuttontopermreq,2000); // pause because opera runs script b4 page has finished loading
3702
3703 if(window.location.href.match(/\/appcenter\//))
3704 setTimeout(highlightemailrequest,2500);
3705 /* END Check if this page is an authorise app page so we can add a block button */
3706
3707 /* BEGIN add a "block application" link at the bottom left hand corner of all application pages */
3708 function addblockapplinktoapppage() {
3709 if (window.location.href.match(/\:\/\/apps\./)) {
3710 if(document.getElementById('footerContainer')) {
3711 var footzer=document.getElementById('footerContainer');
3712 var footytxt='footerContainer';
3713 }
3714 else {
3715 var footzer=document.getElementById('pagelet_canvas_footer_content');
3716 var footytxt='pagelet_canvas_footer_content';
3717 }
3718 if(footzer) {
3719 var fas=footzer.getElementsByTagName('a');
3720 for(var i=0;i<fas.length;i++)
3721 if(fas[i].getAttribute('ajaxify') && fas[i].getAttribute('ajaxify').match(/\/ajax\/report\.php\?content_type=17/)) {
3722 zappid=fas[i].getAttribute('ajaxify').match(/cid=(\d*)/)[1];
3723 zapplink=document.createElement('a');
3724 zapplink.textContent='Block Application ';
3725 zapptitle=document.getElementById(footytxt).getElementsByTagName('span')[0].textContent;
3726 zapplink.setAttribute('appname',zapptitle);
3727 zapplink.setAttribute('appid',zappid);
3728 zapplink.setAttribute('nodeid','pagelet_canvas_content');
3729 zapplink.setAttribute('id','zapplink');
3730 zapplink.setAttribute('title','Block this application with F.B. Purity');
3731 zparent=document.getElementById(footytxt).getElementsByClassName('fsm')[0];
3732 zparent.insertBefore(zapplink,zparent.firstChild);
3733 document.getElementById('zapplink').addEventListener('click',blockappev,false);
3734 break;
3735 }
3736 }
3737 }
3738 }
3739 window.setTimeout(addblockapplinktoapppage,3500);
3740 /* END Add a block application link at bottom left of all application pages */
3741
3742 function toggletimeline(ev) {
3743 var TLBUTT=document.getElementById('TLJewel');
3744 if (typeof(fbpoptsobj.timelineonecol)=='undefined')
3745 fbpoptsobj.timelineonecol=true;
3746 else
3747 if(fbpoptsobj.timelineonecol==true)
3748 fbpoptsobj.timelineonecol=false;
3749 else
3750 fbpoptsobj.timelineonecol=true;
3751 if(fbpoptsobj.timelineonecol==false) {
3752 document.getElementById('FBTLX').style.display='none';
3753 var tdotxt='F.B. Purity - Normal Facebook Timeline Layout Restored';
3754 TLBUTT.setAttribute('title','');
3755 }
3756 else {
3757 document.getElementById('FBTLX').style.display='block';
3758 var tdotxt='F.B. Purity - Single Column Timeline<br/>Layout Enabled';
3759 TLBUTT.setAttribute('title','');
3760 }
3761 if(!document.getElementById('tdotxt')) {
3762 tdo=document.createElement('div');
3763 tdo.setAttribute('id','tdotxt');
3764 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)
3765 document.getElementById('TLJewel').appendChild(tdo);
3766 }
3767 else
3768 tdo=document.getElementById('tdotxt');
3769
3770 document.getElementById('tdotxt').style.display='block';
3771 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;
3772 window.setTimeout(function(){document.getElementById('tdotxt').style.display='none';TLBUTT.setAttribute('title','F.B. Purity: Single Column Timeline Layout');},1700)
3773
3774 //save to prefs obj to localstorage
3775 fbpsavevalue('fbpoptsjson-' + currentuserid, JSON.stringify(fbpoptsobj));
3776 //window.location.reload();
3777 fbptimelinerestyle(fbpoptsobj.timelineonecol);
3778 } // END toggletimeline function
3779
3780 function tlbuttinit() {
3781 // BEGIN add TL (single column timeline) button next to search box (now works on graph search bar too)
3782 if(fbpoptsobj.timelineonecol==true)
3783 var disx='block';
3784 else
3785 var disx='none';
3786 var TLBUTTHTML='<a id="TLINK" href="javascript:;" class="jewelButton" style="top:3px;max-height:25px;">'+
3787 '<div id="FBTL" style="position:absolute;top:0px;left:0px;background:transparent;font-size:22px !important;font-weight:bold;color:green">TL</div>'+
3788 '<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>';
3789 TLBUTT=document.createElement('div');
3790 TLBUTT.setAttribute('class','lfloat fbJewel');
3791 TLBUTT.setAttribute('id','TLJewel');
3792 TLBUTT.setAttribute('title','F.B. Purity: Single Column Timeline Layout');
3793 /*
3794 window.setTimeout(function() {
3795 console.log('delayed??');
3796 if(document.querySelector('body.hasSmurfbar'))
3797 //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; '); //
3798 document.getElementById('TLJewel').setAttribute('style','top:0px;margin-left:3px;vertical-align:middle;font-size:20px;font-color:#173a85;font-weight:bold; left: 614px; top: -20px !important; '); //
3799 else
3800 //TLBUTT.setAttribute('style','top:0px;margin-left:3px;vertical-align:middle;font-size:20px;font-color:#173a85;font-weight:bold');
3801 document.getElementById('TLJewel').setAttribute('style','top:0px;margin-left:3px;vertical-align:middle;font-size:20px;font-color:#173a85;font-weight:bold');
3802 },3500);
3803 */
3804
3805 TLBUTT.innerHTML=TLBUTTHTML;
3806 window.setTimeout( function(){
3807 var datd=document.getElementById('navSearch');
3808 if(!datd) {
3809 datd=document.querySelector('div[role="search"]');
3810 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'); //
3811 if(debug) console.log('no navsearch, so must be graph search?' + TLBUTT);
3812 }
3813 else {
3814 TLBUTT.setAttribute('style','top:0px;margin-left:3px;vertical-align:middle;font-size:20px;font-color:#173a85;font-weight:bold;'); // left :0px !important'
3815 if(debug) console.log('oldschool navsearch' + TLBUTT);
3816 }
3817 if(datd && (!document.getElementById('TLJewel'))) {
3818 datd.parentNode.insertBefore(TLBUTT,datd.nextSibling);
3819 document.getElementById('TLINK').addEventListener('click',toggletimeline,false);
3820 }
3821 //single column timeline
3822 if(fbpoptsobj.timelineonecol==1)
3823 fbptimelinerestyle(1);
3824 else
3825 fbptimelinerestyle(0);
3826 },3000);
3827 // END add TL button next to search box
3828 }
3829
3830 function resetclasses () {
3831 var fbpn,a;
3832 var arrResetClasses=['fbpnormal','fbpblockedx','fbpblocked'];
3833 for(a in arrResetClasses) {
3834 //console.log(arrResetClasses[a]);
3835 fbpn=document.getElementsByClassName(arrResetClasses[a]);
3836 for(i=fbpn.length;i>0;i--) {
3837 //console.log(i);
3838 fbpn[i-1].setAttribute('class',fbpn[i-1].getAttribute('class').replace(arrResetClasses[a],''));
3839 }
3840 //console.log("fbpoptsobj.filterappmessages=" + fbpoptsobj.filterappmessages + " current arr length=" + document.getElementsByClassName(arrResetClasses[a]).length);
3841 }
3842 }
3843
3844 function fbpurify() {
3845 if(debug)
3846 console.trace();
3847
3848 var crappyappmsgcounter=0;
3849 var xtramsgcounter=0;
3850 fbpstyle.setAttribute('id','fbpstyler');
3851 fbpstyle.setAttribute('type','text/css');
3852 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}";
3853 if(document.querySelector('body.hasSmurfbar'))
3854 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}";
3855 else
3856 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}";
3857 fbpStyleNormal= ".fbpblocked {display:none !important} .fbpblockedx {display:none !important} .fbpnormal {display:block !important}";
3858 fbpstyle.textContent=fbpStyleNormal;
3859
3860 /*
3861 if(document.getElementsByTagName('head')) {
3862 document.getElementsByTagName('head')[0].appendChild(fbpstyle);
3863 document.getElementsByTagName('head')[0].appendChild(fbpfreestyle);
3864 document.getElementsByTagName('head')[0].appendChild(fbpboxstyle);
3865 document.getElementsByTagName('head')[0].appendChild(fbpcssstyle);
3866 document.getElementsByTagName('head')[0].appendChild(fbptlstyle);
3867 }
3868 */
3869
3870 document.addEventListener("DOMNodeInserted", fpInsertedNodeDomHandler, false);
3871
3872 if(document.getElementById('pagelet_home_stream') || document.getElementById('pagelet_litestand_section') || document.getElementById('stream_pagelet'))
3873 cleartheshizzle(document);
3874
3875 } // END fbpurify function
3876
3877
3878 var waitfordom1=setInterval(function(){
3879 if(document.getElementById('globalContainer')) {
3880 clearInterval(waitfordom1);
3881 //if(window.navigator.userAgent.match(/Opera/))
3882 // fbpgetprefs(); // grab user prefs if available if not populate them with defaults
3883
3884 //bringbacknormalcommenting(); moved these to finalstage function to ensure the prefs have already been read
3885 //window.setTimeout(addexternallinkfix,2000);
3886 //addexternallinkfix();
3887 }
3888 }, 500);
3889
3890 // only run if DOM has loaded
3891 finalstage=function () {
3892 // we should check to see if fbpurify is already running...
3893
3894 if(document.getElementsByTagName('head').length) {
3895 document.getElementsByTagName('head')[0].appendChild(fbpstyle);
3896 document.getElementsByTagName('head')[0].appendChild(fbpfreestyle);
3897 document.getElementsByTagName('head')[0].appendChild(fbpboxstyle);
3898 document.getElementsByTagName('head')[0].appendChild(fbpcssstyle);
3899 document.getElementsByTagName('head')[0].appendChild(fbptlstyle);
3900
3901 //window.setTimeout(bringbacknormalcommenting,2000); // prefs werent being read in before running this, so i added a short delay
3902 bringbacknormalcommenting();
3903 //window.setTimeout(addexternallinkfix,2000);
3904 addexternallinkfix();
3905 tlbuttinit(); // initialise the timeline single column button
3906 }
3907 else {
3908 var waitforhead=setInterval(function(){
3909 if(document.getElementsByTagName('head').length ) {
3910 document.getElementsByTagName('head')[0].appendChild(fbpstyle);
3911 document.getElementsByTagName('head')[0].appendChild(fbpfreestyle);
3912 document.getElementsByTagName('head')[0].appendChild(fbpboxstyle);
3913 document.getElementsByTagName('head')[0].appendChild(fbpcssstyle);
3914 document.getElementsByTagName('head')[0].appendChild(fbptlstyle);
3915
3916 //window.setTimeout(bringbacknormalcommenting,2000); // prefs werent being read in before running this, so i added a short delay
3917 bringbacknormalcommenting();
3918 //window.setTimeout(addexternallinkfix,2000);
3919 addexternallinkfix();
3920
3921 tlbuttinit(); // initialise the timeline single column button
3922 clearInterval(waitforhead);
3923 }
3924 }, 500);
3925
3926 }
3927
3928 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')
3929 fixsortorder();
3930 fbpurify();
3931 }
3932 else {
3933 var waitfordom=setInterval(function(){
3934 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')
3935 clearInterval(waitfordom);
3936 fixsortorder();
3937 fbpurify();
3938 }
3939 }, 500);
3940 }
3941 } // end finalstage function;
3942
3943 //if(!window.navigator.userAgent.match(/Opera/))
3944 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.
3945
3946 })();