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
21 // @version 8.6.1 - 23rd Aug 2013
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/*
29 // (C) 2009 - 2013 stephen fernandez - http://www.fbpurity.com
32 // If you like this script please donate, big or small donations, anything is welcome :
34 // http://donate.fbpurity.com/
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 // ------------------------------------------------------------
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
55 // This script is compatible with the following web browsers: Firefox, Google Chrome, Opera and Safari
57 // Full installation instructions are available here:
58 // http://install.fbpurity.com
60 // If you have any problems, please see the Frequently Asked Questions / Help page:
61 // http://faq.fbpurity.com
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 // (C) stephen fernandez 2009-2013 http://www.fbpurity.com
253 // If you like F.B. Purity please donate, big or small donations, anything is welcome
254 // http://donate.fbpurity.com
258 var fbpVersion
= "v8.6.1";
261 var fbpoptsobj
= {}; // object to store the preferences etc
263 if (window
.top
!=window
.self
) // dont run on framed pages
264 if(!window
.location
.href
.match(/connect\/uiserver\.php\?/)) // but allow it to work on embedded permissions pages
269 //alert('caught error ' + e.message);
270 //unsafeWindow.console.log(e);
273 // only run on actual facebook pages
275 if(!window
.location
.hostname
.match(/facebook\.com$/))
280 //alert('caught error ' + e.message);
281 //unsafeWindow.console.log(e);
285 var ischrome
=(typeof(chrome
)!='undefined' && chrome
.extension
);
286 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\./));
287 //var isopera=window.navigator.userAgent.match(/Opera/);
289 var isopera
=(typeof(widget
) && typeof(widget
.preferences
));
294 var isasync
=(ischrome
|| issafari
);
297 // console.log=unsafeWindow.console.log;
299 //check if another version of the script is running at the same time and if so give a warning.
300 if(document
.getElementById('fbpoptslink')) {
301 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>)';
302 if(document
.getElementById('fbperrormsg'))
303 document
.getElementById('fbperrormsg').innerHTML
=collisionerrormsg
;
305 window
.alert(collisionerrormsg
);
308 var fbpstyle
=document
.createElement('style');
309 var hashead
=document
.getElementsByTagName('head').length
;
311 var fbpfreestyle
=document
.createElement('style'); // for setting a "global" font etc
312 fbpfreestyle
.setAttribute('id','fbpfreestyler');
313 fbpfreestyle
.setAttribute('type','text/css');
316 document.getElementsByTagName('head')[0].appendChild(fbpfreestyle);
318 var fbpboxstyle
=document
.createElement('style'); // for setting whether boxes are on or off
319 fbpboxstyle
.setAttribute('id','fbpboxstyler');
320 fbpboxstyle
.setAttribute('type','text/css');
322 document.getElementsByTagName('head')[0].appendChild(fbpboxstyle);
324 var fbpcssstyle
=document
.createElement('style'); // for adding the user's Custom CSS and general css stuff
325 fbpcssstyle
.setAttribute('id','fbpcssstyler');
326 fbpcssstyle
.setAttribute('type','text/css');
328 document.getElementsByTagName('head')[0].appendChild(fbpcssstyle);
330 var fbptlstyle
=document
.createElement('style');
331 fbptlstyle
.setAttribute('id','fbptlstyle');
332 fbptlstyle
.setAttribute('type','text/css');
334 document.getElementsByTagName('head')[0].appendChild(fbptlstyle);
337 fbpescaperegex = function(str
){
338 // 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 )
349 for(key
in replacements
) {
350 str
= str
.replace('' + key
, replacements
[''+ key
],'g');
354 ; // do nothing, traps an error found in ff 4.0b5
359 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';
361 // new left column options = lcadvertmgr,lcconnect,lcallpages,lcpagesfeed,lclikepages,lcallapps,lcappcenter,lcevents,lcgamesfeed,lcpokes,lcmusic,lcplaceseditor,lcallgroups,lcallinterests,lccreategroup,lccreatepage,lcfindfriends,lcdeveloper,lcfriends
362 // new right column options = rcrecommendedpages,rcrelatedgroups,rcpokes,rcbirthdays,rcfriendrequests,rcgamerequests
363 var fbpoptsarr
=fbpoptslist
.split(',');
365 var optsdiv
=document
.createElement('div');
366 optsdiv
.setAttribute('id','fbpoptsdiv');
367 optsdiv
.style
.zIndex
='155'; //99 (change to 155 to go above drag image box
368 optsdiv
.style
.position
='absolute';
369 optsdiv
.style
.left
='100px'; //143 //150px
370 optsdiv
.style
.top
='1px'; //42px
371 optsdiv
.style
.background
='white';
372 optsdiv
.style
.border
='3px solid black';
373 optsdiv
.style
.display
='none';
376 '<br/> <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>',
377 '<br/> <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>',
378 '<br/> <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>',
379 '<br/> <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>.',
380 '<br/> <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>.',
381 '<br/> <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>.'
384 var fbpoptshtml
= '<div style="float:left;"><table style="top:0px"><tr>'+
385 '<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>'+
386 '<td width="800" valign="top">' +
387 '<h2 style="display:inline" class="uiHeaderTitle">F.B. Purity ' + fbpVersion
+ ' Options</h2> ' +
388 '<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> </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>'+
390 //'<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>'+
391 '<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&width=292&colorscheme=light&show_faces=true&stream=false&header=false&height=62&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>'+
392 '<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>'+
393 '</tr></table></div>'+
395 // <object align="middle" type="text/html" data="https://www.facebook.com/connect/connect.php?id=408502197558&connections=0&stream=0" width="275" height="65"/>
396 // <iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.fbpurity.com&send=false&layout=standard&width=275&show_faces=false&action=like&colorscheme=light&font=arial&height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:275px; height:65px;" allowTransparency="true"></iframe>
398 '<div style="clear:both"></div>'+
399 '<table><tr><td valign="top">';
401 // add new dynamic opts
402 function optionsbox(mode
) {
405 if(1) // ischrome doesnt work in safari
406 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;">▼</a>';
409 if (typeof mode
!='undefined' && mode
=='extras') {
410 this.table
='<table><tr><td>'+ openallboxes
+' <b>Newsfeed Filters</b> <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 //this.table="<table width='100%'>";
416 // Use tbody to group tables instead of divs ! !!! ! :)
417 this.tableHeader = function (title
, hint
, varname
) {
418 //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>';
419 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">';
421 this.addTableRow = function(title
,hint
,varname
,inputtype
) {
422 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>";
424 this.tableFooter =function(){
425 //this.table+="</table></div></td></tr></table>";
426 this.table
+="</tbody>";
428 this.buildTable =function(endmode
){
429 if(typeof endmode
=='undefined')
432 return this.table
+ '</table>';
439 v
= new optionsbox('extras');
440 v
.tableHeader('Various Story Types','Hide Various story types from the newsfeed', 'variousopts');
441 v
.addTableRow('Fan Page Stories','Hide stories posted by Pages you have liked from the newsfeed','pagestory', 'checkbox');
442 v
.addTableRow('Trending Articles / Videos','Hide Trending Articles / Trending Videos / Most Shared on / Recent Articles About stories from the newsfeed','readarticle', 'checkbox');
443 v
.addTableRow('Facebook Questions','Hide Facebook Questions stories','questionsbox','checkbox');
444 v
.addTableRow('Became Friends','Hide Became Friends stories from the newsfeed','becamefriends','checkbox');
445 v
.addTableRow('Changed Relationship','Hide Changed Relationship stories from the newsfeed','changedrelationship', 'checkbox');
446 v
.addTableRow('Changed Location','Hide Changed Location (Check-in) Stories','checkedin','checkbox');
447 v
.addTableRow('Updated Profile Info','Hide Updated Profile Stories','updatedprofile','checkbox');
448 v
.addTableRow('Joined a Group','Hide Joined Group Stories (and other group related stories)','joinedgroup','checkbox');
449 v
.addTableRow('Posted Note','Hide Posted Note Stories','postednote','checkbox');
450 v
.addTableRow('Tagged in Note','Hide Tagged in Note Stories','taggedinnote','checkbox');
452 newoptscolumn
+=v
.buildTable();
457 v
.tableHeader('Event Stories','Hide event stories from the newsfeed', 'eventopts');
458 v
.addTableRow('Upcoming Events','Hide Upcoming Events / Upcoming Concerts','upcomingevents','checkbox');
459 v
.addTableRow('Attending Event','Hide Attending Event','attendevent','checkbox');
460 v
.addTableRow('Attended Event','Hide Attended Event','attendedevent','checkbox');
461 v
.addTableRow('Created Event','Hide Created Event','createdevent','checkbox');
462 //v.addTableRow('Liked Event','Hide Liked Events','likedevent','checkbox');
463 v
.addTableRow('Shared Event','Hide Shared Events','sharedevent','checkbox');
465 newoptscolumn
+=v
.buildTable();
467 // Link / Page Options
469 v
= new optionsbox();
470 v
.tableHeader('Link / Page Stories','Hide Link / Page stories from the Newsfeed', 'linkopts');
471 //v.addTableRow('Hide All External Links','All External Links from the Newsfeed','hidealllinks', 'checkbox');
472 v
.addTableRow('Liked Page','Hide Liked Page Stories','becamefan','checkbox');
473 v
.addTableRow('Shared Page','Hide Shared Page Stories','sharedpage','checkbox');
474 v
.addTableRow('Liked Link','Hide Liked Link Stories','likedlink','checkbox');
475 v
.addTableRow('Shared Link','Hide Shared Link Stories from the Newsfeed','postedlink','checkbox');
476 v
.addTableRow('Commented on Link','Hide Commented on Photo Stories','commentedlink','checkbox');
477 v
.addTableRow('"Like Page" buttons','Hide the "Like Page" buttons from shared items in the newsfeed','likepagebutton','checkbox');
479 newoptscolumn
+=v
.buildTable();
483 v
= new optionsbox();
484 v
.tableHeader('Photo Stories','Hide photo stories from the newsfeed', 'photoopts');
485 v
.addTableRow('Hide All Photos','Hide All Photo stories from the newsfeed','hideallphotos', 'checkbox');
486 v
.addTableRow('Shared Photo','Hide Shared Photo / Album stories from the newsfeed','sharedphoto','checkbox');
487 v
.addTableRow('Changed Profile Photo','Hide Updated Profile Picture / Cover Photo stories from the newsfeed','changedprofilepic', 'checkbox');
488 v
.addTableRow('Uploaded Photo','Hide Added Photo Stories','uploadedphoto','checkbox');
489 v
.addTableRow('Tagged in Photo','Hide Tagged in Photo / Album stories','taggedphoto','checkbox');
490 v
.addTableRow('Liked Photo','Hide Liked Photo / Album stories','likedphoto','checkbox');
491 v
.addTableRow('Commented on Photo','Hide Commented on Photo / Album stories','commentedphoto','checkbox');
493 newoptscolumn
+=v
.buildTable();
497 v
= new optionsbox();
498 v
.tableHeader('Video Stories','Hide Video stories from the Newsfeed', 'videoopts');
499 v
.addTableRow('Hide All Videos','Hide All Video Stories from the newsfeed','hideallvideos', 'checkbox');
500 v
.addTableRow('Shared Video','Hide Shared FB Video Stories from the newsfeed','sharedvideo','checkbox');
501 v
.addTableRow('Uploaded Video','Hide Added Video Stories','uploadedvideo','checkbox');
502 v
.addTableRow('Tagged in Video','Hide Tagged in Video Stories','taggedinvideo','checkbox');
503 v
.addTableRow('Liked Video','Hide Liked Video Stories','likedvideo','checkbox');
504 v
.addTableRow('Commented on Video','Hide Commented on Video Stories','commentedvideo','checkbox');
505 v
.addTableRow('Youtube / Vimeo Videos','Hide Youtube and Vimeo Stories','youtubevideo','checkbox');
507 newoptscolumn
+=v
.buildTable();
509 // Status // Wall Options
511 v
= new optionsbox();
512 v
.tableHeader('Status / Wall Stories','Hide Status / Wall stories from the newsfeed', 'statusopts');
513 v
.addTableRow('Shared Status','Hide Shared Status Stories','sharedstatus','checkbox');
514 v
.addTableRow('Liked Status','Hide Liked Status Stories','likedstatus','checkbox');
515 v
.addTableRow('Commented on Status','Hide Commented on Status stories','commentedstatus','checkbox');
516 //v.addTableRow('Tagged in Status','Hide Tagged in Status Stories','taggedstatus','checkbox'); // not sure how to handle this, or if its even needed
517 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');
519 newoptscolumn
+=v
.buildTable('complete');
521 // end new options layout
522 fbpoptshtml
+= newoptscolumn
;
524 fbpoptshtml
+= '</td><td valign="top">'+
525 '<table><tr><td valign="top"><b>More Options</b></td><td valign="top"><b>Hide</b></td><td rowspan="19" width="12"></td><td valign="top" rowspan="19" width="405"> ' +
526 // new custom text filter/ css / app whitelist tabs
527 '<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> - ' +
528 '<span id="appwhitelistheader"><a title="Click to access the Application Whitelist" href="#">Application Whitelist</a></span> - ' +
529 '<span id="custcssheader"><a title="Click to access the Custom CSS BOX" href="#">Custom CSS</a></span><br/>' +
530 '<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>' +
531 '<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>' +
532 //(window.navigator.userAgent.match(/Mozilla\/4\.0 \(compatible\; MSIE 7\.0\; Windows/) ? '' : '<br/> FBP Tip: <a target="_blank" href="http://fbpurity.com/disable-timeline">Want to remove Facebook Timeline? Click here.</a>') +
534 fbptips
[Math
.floor(Math
.random() * fbptips
.length
)] +
536 '<br/><div id="fbpnewsdiv"></div>'+
539 '<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>'+
540 '<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>'+
541 '<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>'+
542 //'<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>'+
543 '<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>'+
544 '<tr><td><label style="color:black;font-weight:normal" for="chatbox">Chat Box</label></td><td><input id="chatbox" type="checkbox"></td></tr>'+
545 '<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>'+
546 '<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>'+
547 '<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>'+
548 '<tr style="display:none"><td>Beta Tester Box</td><td><input id="betabox" type="checkbox"></td></tr>'+
550 '<tr><td><b>Further Options</b></td><td><b>Set</b></td></tr>'+
551 '<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>'+
552 '<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>'+
553 '<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>'+
554 '<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>'+
555 '<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>'+
557 // right column links options
558 '<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>'+
560 // left 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 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>'+
563 // fonts and colours section
564 '<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>'+
565 '<table id="fontColorSection" style="display:none">' +
566 '<tr><td><b>Background Colour</b></td><td><b>Set</b></td></tr><tr style="background-color:#ECEFF5 !important"><td title="Enter a colour name e.g Black,White,Blue,Red,Green etc (You can also use CSS/HTML colour codes)"><input style="width:90px" id="fontbgcolour" value="black"></td><td><input id="fontbgcolourfix" type="checkbox"></td></tr>' +
567 '<tr><td><b>Font Colour</b></td><td><b>Set</b></td></tr><tr style="background-color:#ECEFF5 !important" title="Enter a colour name e.g Black,White,Blue,Red,Green etc (You can also use CSS/HTML colour codes)"><td><input style="width:90px" id="fontcolour" value="white"></td><td><input id="fontcolourfix" type="checkbox"></td></tr>' +
568 '<tr><td><b>Font</b></td><td><b>Set</b></td></tr><tr style="background-color:#ECEFF5 !important" title="Enter a font name e.g Arial,Helvetica,Verdana,Courier, etc (If the font name has a space in it, put quote marks around the name)"><td><input style="width:90px" id="fbpfont" value="verdana"></td><td><input id="fbpfontfix" type="checkbox"></td></tr>' +
569 '<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>' +
570 '</table></td></tr>'+
574 '<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">'+
575 '<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>' +
577 '<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> </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>'+
578 '<br/><form><textarea id="fbpsettingstext" style="display:none"></textarea></form></td></tr></table>'+
579 '<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>';
581 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">'+
582 '<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>'+
584 '<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>'+
585 '<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>' +
586 '<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>'+
587 '<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&width=292&colorscheme=light&show_faces=true&stream=false&header=false&height=62&ref=FBP_WELCOME_POPUP" scrolling="no" frameborder="0" marginwidth="0" style="border:none; overflow:hidden; width:295px; height:67px;" allowTransparency="true"></iframe></p></div>'+
588 '<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>'+
590 '<div id="secondpara" style="display:none"><p>To change F.B. Purity's settings, click the '<b>F.B. Purity</b>' 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/>'+
591 '<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>'+
592 '<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>'+
594 '<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>'+
596 '<p>Steve - The Developer of <a target="_blank" href="http://www.fbpurity.com">F.B. (Fluff Busting) Purity</a></p>'+
597 '<table width="100%"><tr><td style="text-align:center"><a onclick="document.getElementById(\'fbpfirstrundiv\').style.display=\'none\'" href="#">Close</a></td></tr></table></div>'+
600 function hideotherdivs(e
) {
601 divname
=e
.target
.parentNode
.id
.split(/header/)[0];
602 var boxlist
="custext,appwhitelist,custcss";
603 boxarr
=boxlist
.split(',');
605 if(boxarr
[i
]==divname
) {
606 document
.getElementById(divname
+ "header").setAttribute('style','background:#ECEFF5; font-weight:bold; font-size:15; border:1 solid');
607 document
.getElementById(divname
+ "desc").setAttribute('style','display:block;background:#ECEFF5;');
608 document
.getElementById(divname
+ "ta").setAttribute('style','display:block;width:404px;height:275px');
611 document
.getElementById(boxarr
[i
] + 'header').setAttribute('style','background:white;font-weight:normal;font-size:14;border:0');
612 document
.getElementById(boxarr
[i
] + 'desc').setAttribute('style','display:none');
613 document
.getElementById(boxarr
[i
] + 'ta').setAttribute('style','display:none;');
617 function importsettingsbasic(ev
) {
620 fbpsettingstext
=prompt('F.B. Purity Settings Importer\n\nPaste in your saved FBP settings text, then click OK.')
622 if(fbpsettingstext
==null)
625 if(!fbpsettingstext
.length
) {
626 window
.alert('You didnt enter valid settings text');
631 JSON
.parse(fbpsettingstext
);
634 window
.alert('Error, settings text malformed, not valid. Import failed!');
637 fbpsavevalue('fbpoptsjson-' + currentuserid
,fbpsettingstext
);
639 window
.alert('Import Successful. FBP Settings have been updated! Page will now reload.');
642 document
.getElementById('fbpoptsdiv').style
.display
='none';
644 //reload page to refresh preferences
645 window
.location
.reload(true);
649 function exportsettingsbasic(ev
) {
651 exportsettingsbasic2();
654 // figure out how to use callbacks, may be a better solution here....
656 function exportsettingsbasic2(opts
) {
657 document
.getElementById('fbpsettingstext').setAttribute('style','display:block;width:600px;height:220px');
659 if(!opts
&& opts
!='') {
660 exporttext
=fbploadvalue('fbpoptsjson-' + currentuserid
,exportsettingsbasic2
);
667 if ((typeof(exporttext
)=='undefined') || (exporttext
.length
=="")) {
668 exporttext
=fbploadvalue('fbpoptsjson',exportsettingsbasic2
);
672 document
.getElementById('fbpsettingstext').textContent
=exporttext
;
674 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.');
675 // autoselect the text in the textarea
676 el
=document
.getElementById('fbpsettingstext');
678 if ((/textarea/i.test(el
.tagName
)) || ((/input/i.test(el
.tagName
)) && (/text/i.test(el
.type
)))) {
680 } else if (!!window
.getSelection
) { // FF, Safari, Chrome, Opera
681 var sel
= window
.getSelection();
682 range
= document
.createRange();
683 range
.selectNodeContents(el
);
684 sel
.removeAllRanges();
686 } else if (!!document
.selection
) { // IE
687 document
.selection
.empty();
688 range
= document
.body
.createTextRange();
689 range
.moveToElementText(el
);
694 function get_cookie ( cookie_name
)
696 var results
= document
.cookie
.match ( '(^|;) ?' + cookie_name
+ '=([^;]*)(;|$)' );
698 return ( unescape ( results
[2] ) );
703 function set_cookie (name
,value
) {
704 document
.cookie
= name
+ "=" + escape(value
)+ ';expires=01/04/2099 00:00:00';
707 // check for GM_set/get API
708 var isgmapi
, islocstor
;
710 if(typeof(GM_setValue
)!='undefined') {
711 GM_setValue('test',1)
712 if ( GM_getValue('test')==1)
724 // check for localstorage
726 if(typeof(window
.localStorage
)!='undefined')
735 function fbpsavevalue(name
,value
){
738 GM_setValue(name
,value
);
740 else if(ischrome
) { // ischrome
741 chrome
.extension
.sendRequest({method: "setLocalStorage", key: name
, value: value
}, function(response
) {
742 ;//console.log(response.data);
745 else if(issafari
) { //(typeof(window.navigator.vendor)!='undefined') && (window.navigator.vendor.match(/Apple Computer, Inc\./)) && window.navigator.userAgent.match(/Version\/5\./)
746 safari
.self
.tab
.dispatchMessage("setLocalStorage",{key: name
, value: value
});
747 /*function replyToMessage(response) {
748 if (response.name === "data") {
749 console.log('safari save value response:' + response.message);
750 //if((typeof(response.message) !='undefined') && response.message.match(/\"filterappmessages\"/)) {
751 // window.localStorage[name]=response.message;
752 // window.location.reload();
756 // register for message events
757 //safari.self.addEventListener("message", replyToMessage, false);
759 else if(isopera
) { //window.navigator.userAgent.match(/Opera/)
760 widget
.preferences
[name
]=value
;
762 /* 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
764 window.localStorage[name]=value;
767 set_cookie(name,value);
773 window
.localStorage
[name
]=value
;
775 set_cookie(name
,value
);
779 function fbploadvalue(name
,funct
){
782 //console.log('entering function : ' + arguments.callee.name);
786 val
= GM_getValue(name
);
790 chrome
.extension
.sendRequest({method: "getLocalStorage", key: name
}, function(response
) {
791 //fbpdynamicreload(response.data); // we should maybe figure a way of doing this event driven
794 console
.log("we in call back, and heres the data: " + response
.data
);
795 if((typeof(response
)=='undefined') || (typeof(response
.data
)=='undefined'))
798 funct(response
.data
);
804 console
.log('name: ' + name
+ ' value' + val
);
808 safari
.self
.tab
.dispatchMessage("getLocalStorage",name
);
809 function replyToMessage(response
) {
811 console
.log(response
.message
);
814 console
.log("we in call back, and heres the data: " + response
.message
);
815 if(typeof(response
.message
)=='undefined')
818 funct(response
.message
);
821 // register for message events
822 safari
.self
.addEventListener("message", replyToMessage
, false);
826 if((typeof(widget
.preferences
[name
]) !='undefined') ) {
827 val
= widget
.preferences
[name
];
828 //fbpdynamicreload();
836 val
=window
.localStorage
[name
];
838 val
=get_cookie(name
);
843 function initundef() {
844 if(typeof (fbpoptsobj
.filterappmessages
) =='undefined')
845 fbpoptsobj
.filterappmessages
=1;
846 if(typeof (fbpoptsobj
.sortmostrecent
) =='undefined')
847 fbpoptsobj
.sortmostrecent
=0;
848 if(typeof (fbpoptsobj
.fixarticleredirects
) =='undefined')
849 fbpoptsobj
.fixarticleredirects
=1;
852 function fbpgetprefs(opts
) {
855 console
.log(arguments
.callee
.length
);
857 //console.log('entering function : ' + arguments.callee.name);
861 if(typeof(opts
)!='undefined') {
862 if(opts
&& opts
.length
) {
864 console
.log("opts=" + opts
);
867 fbpoptsobj
=JSON
.parse(optsdump
);
870 console
.log('error reading json in fbpgetprefs');
880 console
.log('are we at the top?');
881 if(!issafari
) // because getting vars out of localstorage is not working in safari, we not checking for first run
890 //console.log("user" + currentuserid);
891 optsdump
= fbploadvalue('fbpoptsjson-' + currentuserid
,fbpgetprefs
);//'fbpgetprefs'
892 if(optsdump
!=-999) { //if(!isasync) {
893 if(optsdump
&& optsdump
.length
) {
895 fbpoptsobj
=JSON
.parse(optsdump
);
898 fbpoptsobj
=JSON
.parse(decodeURIComponent(optsdump
)); // this line is to make it compatible with older firefox extension which urlencoded/decoded saved values inside the extension
906 console
.log('are we at the bottom?');
907 if(!issafari
) // because getting vars out of localstorage is not working in safari, we not checking for first run
916 //unsafeWindow.console.log(typeof(optsdump) + ' xxx ' + optsdump + 'xxx' + optsdump.length);
919 function fbpfirstruncheck(result
) {
923 console
.log('firstrun? ' + result
);
925 //console.log('entering function : ' + arguments.callee.name);
927 //alert("firstres = " + result);
928 //if(result || (result=='')) { was working on chrome and firefox and opera?
929 if(typeof(result
)!='undefined') {
933 fbpfirstrun
=fbploadvalue('fbpfirstrun',fbpfirstruncheck
);
934 if(fbpfirstrun
==-999)
937 //alert("secondres = " + fbpfirstrun); // make sure user is logged in (pageLogo element is there)
938 if (((fbpfirstrun
=='') || (typeof(fbpfirstrun
)=='undefined') || (fbpfirstrun
==null)) && (!(window
.location
.href
.match(/^https?:\/\/apps\.facebook|^https?:\/\/blog\.facebook|^https?:\/\/secure\.facebook/)))) {
939 if(!document
.getElementById('fbpfirstrundiv') && document
.getElementById('blueBar') && document
.getElementById('pageLogo')) {
940 ph
=document
.getElementById('blueBar'); //pageHead
941 firstrundiv
=document
.createElement('div');
942 firstrundiv
.innerHTML
=fbpfirstrunhtml
;
944 ph
.firstChild
.parentNode
.insertBefore(firstrundiv
, ph
.firstChild
.nextSibling
);
945 fbpsavevalue('fbpfirstrun',new Date() + "");
950 function checkifupdaterequired(currver
,latestver
) {
953 //console.log('entering function : ' + arguments.callee.name);
955 if (currver
&& latestver
) {
956 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>** ";
957 if (currver
==latestver
)
958 return; //window.alert('Congrats! You have the latest version of FB Purity :)');
960 cvpart1
=currver
.split(/\./)[0];
961 cvpart2
=currver
.split(/\./)[1];
962 cvpart3
=currver
.split(/\./)[2];
963 lvpart1
=latestver
.split(/\./)[0];
964 lvpart2
=latestver
.split(/\./)[1];
965 lvpart3
=latestver
.split(/\./)[2];
966 if(cvpart1
<lvpart1
) {
967 if(document
.getElementById('fbpupgradeinfo'))
968 document
.getElementById('fbpupgradeinfo').innerHTML
=fbpupdatehtml
;
970 else if (cvpart1
== lvpart1
) {
971 if(cvpart2
< lvpart2
) {
972 if(document
.getElementById('fbpupgradeinfo'))
973 document
.getElementById('fbpupgradeinfo').innerHTML
=fbpupdatehtml
;
975 else if (cvpart2
== lvpart2
) {
976 if(cvpart3
< lvpart3
)
977 if(document
.getElementById('fbpupgradeinfo'))
978 document
.getElementById('fbpupgradeinfo').innerHTML
=fbpupdatehtml
;
986 function checkupdatefeed(result
) {
989 //console.log('entering function : ' + arguments.callee.name);
991 var fbplastupdatecheck
;
992 if(result
|| (result
=='')) {
994 console
.log('fbplastupdatecheck val = ' + result
);
995 fbplastupdatecheck
=result
;
996 if(typeof(fbplastupdatecheck
)=='undefined')
997 fbplastupdatecheck
='';
1000 fbplastupdatecheck
=fbploadvalue('fbplastupdatecheck',checkupdatefeed
);
1001 if(fbplastupdatecheck
==-999)
1005 console
.log('fbplastupdate=' + fbplastupdatecheck
);
1007 var currtime
= new Date().getTime(); // creates a new Date representing today
1008 var currver
= fbpVersion
.replace('v','');
1010 if( (typeof(fbplastupdatecheck
)!='undefined') && (fbplastupdatecheck
!= '') && (fbplastupdatecheck
!=null)) {
1011 var fbplastupdatecheckdate
=fbplastupdatecheck
.split(/\:/)[0];
1012 var fbplastupdatecheckver
=fbplastupdatecheck
.split(/\:/)[1];
1013 if((typeof(fbplastupdatecheckver
) !='undefined') && (!fbplastupdatecheckver
.match(/\./)))
1014 fbplastupdatecheckver
='';
1016 console
.log('lastupdate check version= '+ fbplastupdatecheckver
);
1017 if((typeof(fbplastupdatecheckdate
) !='undefined') && fbplastupdatecheckdate
.match(/^\d+$/)) {
1018 //To compute the difference, convert both to their millisecond representations and subtract:
1019 var diff
= currtime
- fbplastupdatecheckdate
;
1020 //In this case the difference will be negative, as d1 preceeds d2.
1021 var num_days
= (((diff
/ 1000) / 60) / 60) / 24;
1023 //var cachedupdatever=fbploadvalue(fbpupdatever);
1024 if((typeof(fbplastupdatecheckver
)!='undefined') && (fbplastupdatecheckver
!= ''))
1025 checkifupdaterequired(currver
,fbplastupdatecheckver
);
1030 // time value is corrupted somehow?
1031 if (typeof(unsafeWindow
) =='undefined')
1032 ;//console.log('error: fbplastupdatecheck= ' + fbplastupdatecheck);
1034 ;//unsafeWindow.console.log('error: fbplastupdatecheck= ' + fbplastupdatecheck);
1039 //fbpsavevalue('fbplastupdatecheck',currtime + '');
1040 var http
= new window
.XMLHttpRequest();
1041 var url
= window
.location
.protocol
+ "//www.facebook.com/feeds/page.php?id=186105101490362&format=json"; // https://www.facebook.com/pages/FB-Purity-Updates/186105101490362
1042 http
.open("GET", url
, true);
1043 //http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
1044 //http.setRequestHeader("Content-length", params.length);
1045 //http.setRequestHeader("Connection", "close");
1047 http
.onreadystatechange = function() {
1048 if(http
.readyState
== 4 && http
.status
== 200) {
1049 //console.log(http.responseText);
1051 var fbpfeed
= JSON
.parse(http
.responseText
);
1057 if(fbpfeed
.entries
[0].title
.length
&& fbpfeed
.entries
[0].title
.match(/F
.B
. Purity
v(\d
{1,}\.\d
{1,}\.\d
{1,}) /))
1058 latestver
=fbpfeed
.entries
[0].title
.match(/F
.B
. Purity
v(\d
{1,}\.\d
{1,}\.\d
{1,}) /)[1];
1061 //var x = new Date (fbpfeed.entries[0].published);
1062 //newsa.setAttribute('title', "Published - " + x.toLocaleDateString());
1063 //alert(currver + ' ' + latestver);
1064 fbpsavevalue('fbplastupdatecheck', currtime
+ ':' + latestver
);
1065 checkifupdaterequired(currver
,latestver
);
1072 if (!issafari
) // workaround for bug in message passing in safari extension for getting fbpprefs (the messages were crossing over to the wrong locations)
1073 window
.setTimeout(function() {
1075 }, 3000); // wait a bit, to insure fbpinfobar will be there...
1078 function fbppopulateprefs() {
1081 //console.log('entering function : ' + arguments.callee.name);
1083 // if options screen has been wiped out, re-insert it
1084 if(!document
.getElementById('fbpoptsdiv') && document
.getElementById('content') ) {
1085 document
.getElementById('content').appendChild(optsdiv
);
1086 document
.getElementById('fbpsavesettings').addEventListener('click',fbpsavesettings
,false);
1088 document
.getElementById('exportsettingslink').addEventListener('click',exportsettingsbasic
,false);
1089 document
.getElementById('importsettingslink').addEventListener('click',importsettingsbasic
,false);
1091 document
.getElementById('custextheader').addEventListener('click',hideotherdivs
,false);
1092 document
.getElementById('appwhitelistheader').addEventListener('click',hideotherdivs
,false);
1093 document
.getElementById('custcssheader').addEventListener('click',hideotherdivs
,false);
1096 // fill out the preferences form with current settings
1097 for(var i
=0;i
<fbpoptsarr
.length
;i
++) {
1098 if(document
.getElementById(fbpoptsarr
[i
])) {
1099 if(fbpoptsobj
[fbpoptsarr
[i
]]==1) {
1100 document
.getElementById(fbpoptsarr
[i
]).checked
=true;
1101 //unsafeWindow.console.log (filterapptext, fbpoptsarr[i] + ' ' + ' ' + fbpoptsobj[fbpoptsarr[i]]);
1104 document
.getElementById(fbpoptsarr
[i
]).checked
=false;
1107 if(fbpoptsobj
.customtextfilter
&& fbpoptsobj
.customtextfilter
.length
) {
1108 document
.getElementById('custextta').value
=fbpoptsobj
.customtextfilter
.replace(/\,/g,"\n");
1109 //unsafeWindow.console.log(fbpoptsobj.customtextfilter);
1112 document
.getElementById('custextta').value
='';
1114 if(fbpoptsobj
.userappwhitelist
&& fbpoptsobj
.userappwhitelist
.length
) {
1115 document
.getElementById('appwhitelistta').value
=fbpoptsobj
.userappwhitelist
.replace(/\,/g,"\n");
1116 //unsafeWindow.console.log(fbpoptsobj.userappwhitelist);
1119 document
.getElementById('appwhitelistta').value
='';
1122 if(fbpoptsobj
.fontsize
)
1123 document
.getElementById('fontsize').value
=fbpoptsobj
.fontsize
;
1125 if(fbpoptsobj
.fontcolour
)
1126 document
.getElementById('fontcolour').value
=fbpoptsobj
.fontcolour
;
1128 if(fbpoptsobj
.fontbgcolour
)
1129 document
.getElementById('fontbgcolour').value
=fbpoptsobj
.fontbgcolour
;
1131 if(fbpoptsobj
.fbpfont
)
1132 document
.getElementById('fbpfont').value
=fbpoptsobj
.fbpfont
;
1134 if(fbpoptsobj
.fbpcustomcss
&& (typeof(fbpoptsobj
.fbpcustomcss
) != 'undefined')) {
1135 document
.getElementById('custcssta').value
=fbpoptsobj
.fbpcustomcss
;
1136 //unsafeWindow.console.log(fbpoptsobj.fbpcustomcss);
1139 document
.getElementById('custcssta').value
='';
1142 function fbpsavesettings(ev
) {
1144 for(var i
=0;i
<fbpoptsarr
.length
;i
++) {
1146 if(document
.getElementById(fbpoptsarr
[i
]) && document
.getElementById(fbpoptsarr
[i
]).checked
==true)
1147 fbpoptsobj
[fbpoptsarr
[i
]]=1;
1149 fbpoptsobj
[fbpoptsarr
[i
]]=0;
1152 if(document
.getElementById('custextta').value
.length
) {
1153 //fbpoptsobj.customtextfilter=document.getElementById('customtextfilter').value.replace(/, *$/,'','g'); // replace trailing comma and spaces
1154 tempcustomtextfilter
=document
.getElementById('custextta').value
.replace(/[\r\n|\r|\n]/g,"\,").replace(/\,{1,}/g,'\,').replace(/,$/,'').replace(/^,/,'');
1155 fbpoptsobj
.customtextfilter
='';
1156 ctfarr
=tempcustomtextfilter
.split(',');
1157 //for(i=ctfarr.length-1;i>=0;i--)
1158 for(i
=0;i
<ctfarr
.length
;i
++)
1159 if (ctfarr
[i
].replace(/^ {1,}$/,'')!='')
1160 fbpoptsobj
.customtextfilter
+=ctfarr
[i
] + ','; // strip out lines that are just spaces.
1162 fbpoptsobj
.customtextfilter
=fbpoptsobj
.customtextfilter
.replace(/,$/,''); // strip trailing comma
1163 // alert(fbpoptsobj.customtextfilter);
1166 fbpoptsobj
.customtextfilter
='';
1168 if(document
.getElementById('appwhitelistta').value
.length
) {
1169 fbpoptsobj
.userappwhitelist
=document
.getElementById('appwhitelistta').value
.replace(/ /g,'').replace(/[\r\n|\r|\n]/g,"\,").replace(/\,{1,}/g,'\,').replace(/,$/,'').replace(/^,/,'');
1170 //alert(fbpoptsobj.userappwhitelist);
1173 fbpoptsobj
.userappwhitelist
='';
1175 // begin new custom css box
1176 if(document
.getElementById('custcssta').value
.length
) {
1177 fbpoptsobj
.fbpcustomcss
=document
.getElementById('custcssta').value
;
1180 fbpoptsobj
.fbpcustomcss
='';
1181 // end new custom css box
1183 fbpoptsobj
.fontsize
=document
.getElementById('fontsize').value
;
1184 fbpoptsobj
.fontcolour
=document
.getElementById('fontcolour').value
;
1185 fbpoptsobj
.fontbgcolour
=document
.getElementById('fontbgcolour').value
;
1186 fbpoptsobj
.fbpfont
=document
.getElementById('fbpfont').value
;
1188 //save to prefs obj to localstorage
1189 fbpsavevalue('fbpoptsjson-' + currentuserid
, JSON
.stringify(fbpoptsobj
));
1191 //console.log(JSON.stringify(fbpoptsobj));
1193 //close prefs screen
1194 document
.getElementById('fbpoptsdiv').style
.display
='none';
1196 //reload page to refresh preferences
1197 window
.location
.reload(true);
1199 // Dynamically update the page instead of reloading the whole page, only problem is if the page contains many posts, this is very slow.
1201 document.getElementById("fbpsavesettings").disabled=false;
1203 resetclasses(); // need to also reset other filters and css
1205 //updateblockedcount(); // doesnt seem to do anything and clear the shizzle, should automatically update it. (we are getting nodes with 2 classes fbpnormal and fbpblocked
1206 cleartheshizzle(document);
1210 function fbpoptsobjinit() {
1213 //console.log('entering function : ' + arguments.callee.name);
1215 // set up default options
1216 fbpoptsobj
.filterappmessages
=1;
1217 fbpoptsobj
.becamefriends
=1;
1218 fbpoptsobj
.becamefan
=1;
1219 fbpoptsobj
.joinedgroup
=1;
1220 fbpoptsobj
.attendevent
=1;
1221 fbpoptsobj
.attendedevent
=1;
1222 fbpoptsobj
.createdevent
=0;
1224 fbpoptsobj
.commentlikeslink
=0;
1225 fbpoptsobj
.commentwall
=0;
1226 fbpoptsobj
.commentgroupwall
=0;
1227 fbpoptsobj
.commentpagewall
=0;
1228 fbpoptsobj
.commenteventwall
=0;
1229 fbpoptsobj
.updatedprofile
=0;
1230 fbpoptsobj
.changedprofilepic
=0;
1231 fbpoptsobj
.changedrelationship
=0;
1233 fbpoptsobj
.uploadedphoto
=0;
1234 fbpoptsobj
.sharedphoto
=0;
1235 fbpoptsobj
.uploadedvideo
=0;
1236 fbpoptsobj
.taggedinvideo
=0;
1237 fbpoptsobj
.postednote
=0;
1238 fbpoptsobj
.taggedinnote
=0;
1239 fbpoptsobj
.postedlink
=0;
1240 fbpoptsobj
.readarticle
=0;
1241 fbpoptsobj
.checkedin
=0;
1243 fbpoptsobj
.suggestionsbox
=0;
1244 fbpoptsobj
.connectbox
=0;
1245 fbpoptsobj
.sponsoredbox
=1;
1246 fbpoptsobj
.pokebox
=0;
1247 fbpoptsobj
.happeningnowbar
=0;
1248 fbpoptsobj
.betabox
=0;
1249 fbpoptsobj
.commentbutton
=0;
1250 fbpoptsobj
.offlinefriends
=1;
1252 fbpoptsobj
.requestsbox
=0;
1253 fbpoptsobj
.eventsbox
=0;
1254 fbpoptsobj
.questionsbox
=0;
1255 fbpoptsobj
.chatbox
=0;
1256 fbpoptsobj
.pagestory
=0;
1258 //fbpoptsobj.commentslikestopnews=0;
1259 fbpoptsobj
.recentactivity
=0;
1261 fbpoptsobj
.fontsize
='13';
1262 fbpoptsobj
.fontfix
='0';
1263 fbpoptsobj
.fontcolour
='';
1264 fbpoptsobj
.fontcolourfix
=0;
1265 fbpoptsobj
.fontbgcolour
='';
1266 fbpoptsobj
.fontbgcolourfix
=0;
1267 fbpoptsobj
.fbpfont
='';
1268 fbpoptsobj
.fbpfontfix
=0;
1270 fbpoptsobj
.sortmostrecent
=0;
1271 fbpoptsobj
.fixarticleredirects
=1;
1272 fbpoptsobj
.timelineonecol
=0;
1274 // left hand column options
1275 fbpoptsobj
.lcadvertmgr
=0;
1276 fbpoptsobj
.lcconnect
=0;
1277 fbpoptsobj
.lcallpages
=0;
1278 fbpoptsobj
.lcpagesfeed
=0;
1279 fbpoptsobj
.lclikepages
=0;
1280 fbpoptsobj
.lcallapps
=0;
1281 fbpoptsobj
.lcappcenter
=0;
1282 fbpoptsobj
.lcevents
=0;
1283 fbpoptsobj
.lcgamesfeed
=0;
1284 fbpoptsobj
.lcpokes
=0;
1285 fbpoptsobj
.lcmusic
=0;
1286 fbpoptsobj
.lcplaceseditor
=0;
1287 fbpoptsobj
.lcallgroups
=0;
1288 fbpoptsobj
.lcallinterests
=0;
1289 fbpoptsobj
.lcfindfriends
=0;
1290 fbpoptsobj
.lccreatepage
=0;
1291 fbpoptsobj
.lccreategroup
=0;
1292 fbpoptsobj
.lcdeveloper
=0;
1293 fbpoptsobj
.lcfriends
=0;
1294 fbpoptsobj
.lcgifts
=0;
1296 // right hand column options
1297 fbpoptsobj
.rcrecommendedpages
=0;
1298 fbpoptsobj
.rcrelatedgroups
=1;
1299 fbpoptsobj
.rcpokes
=0;
1300 fbpoptsobj
.rcbirthdays
=0;
1301 fbpoptsobj
.rcfriendrequests
=0;
1302 fbpoptsobj
.rcgamerequests
=0;
1304 // Begin new options 28th jan 2013
1305 fbpoptsobj
.upcomingevents
=0;
1306 fbpoptsobj
.sharedevent
=0;
1308 fbpoptsobj
.sharedpage
=0;
1309 fbpoptsobj
.likedlink
=0;
1310 fbpoptsobj
.commentedlink
=0;
1311 fbpoptsobj
.likepagebutton
=0;
1312 fbpoptsobj
.hideallphotos
=0;
1313 fbpoptsobj
.taggedphoto
=0;
1314 fbpoptsobj
.likedphoto
=0;
1315 fbpoptsobj
.commentedphoto
=0;
1317 fbpoptsobj
.sharedvideo
=0;
1318 fbpoptsobj
.likedvideo
=0;
1319 fbpoptsobj
.commentedvideo
=0;
1320 fbpoptsobj
.youtubevideo
=0;
1322 fbpoptsobj
.sharedstatus
=0;
1323 fbpoptsobj
.likedstatus
=0;
1324 fbpoptsobj
.commentedstatus
=0;
1325 fbpoptsobj
.taggedstatus
=0;
1326 fbpoptsobj
.smileys
=0;
1327 fbpoptsobj
.notificationpopup
=0;
1329 fbpoptsobj
.hidealllinks
=0;
1330 fbpoptsobj
.hideallvideos
=0;
1331 fbpoptsobj
.fixedleftcolumn
=1;
1332 // End new options 28th jan 2013
1334 fbpoptsobj
.customtextfilter
='';
1335 fbpoptsobj
.userappwhitelist
='';
1336 fbpoptsobj
.fbpcustomcss
='';
1340 // APPLICATION WHITELIST
1341 // ---------------------
1343 // If you would like to edit the list of applications in the user whitelist,
1344 // theres detailed instructions here: http://whitelist.fbpurity.com
1346 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";
1348 // the application ids in the default app whitelist above belong to, in order:
1349 // 6628568379 = facebook iphone application
1350 // 115463795461 = selective twitter
1351 // 48119224995 = tumblr
1352 // 5895217474 = digsby
1353 // 56212371378 = tweetdeck
1354 // 146139331013 = tweetdeck for iphone
1355 // 2254487659 = facebook for blackberry
1356 // 2915120374 = facebook mobile widget
1357 // 74769995908 = facebook for android
1358 // 4620273157 = facebook for palm
1359 // 14405921260 = facebook for motorola (motoblur)
1360 // 10754253724 = iphoto uploader
1361 // 2483740875 = picasa uploader
1362 // 22950410511 = sprint/samsung? photo/video uploader
1363 // 43769862066 = SonyEricsson
1364 // 2550392059 = MusicPlayer
1365 // 8109791468 = Status Shuffle
1366 // 2238752371 = Facebook Exporter for iPhoto
1367 // 21370137768 = official flickr application
1368 // 6195724695 = Windows Phone
1369 // 6694405826 = Posterous
1370 // 2231777543 = Twitter
1371 // 53702860994 = LG Mobile
1372 // 20407635301 = Snaptu
1373 // 38125372145 = SonyEricsson Panel
1374 // 56137638329 = Nokia
1375 // 10732101402 = ping.fm
1376 // 16297770890 = 3Skypephone 'S2'
1377 // 2877035514 = Gwibber
1378 // 41158896424 = HTC Sense
1379 // 24420472648 = HTC Sense
1380 // 72687635881 = Samsung Mobile
1381 // 350685531728 = facebook for android
1382 // 30713015083 = windows live messenger
1383 // 111527682205237 = O2 social link
1384 // 121958126090 = LG Phone
1385 // 2330519541 = Bloom photo uploader
1386 // 49340319393 = Ovi by Nokia
1387 // 26463759431 = My INQ Mobile
1388 // 21810043296 = Facebook for the T-Mobile Sidekick
1389 // 183319479511 = HootSuite
1390 // 189818072392 = live journal
1391 // 302006227267 = Sony Ericsson X10 mini pro
1392 // 90376669494 = Yahoo
1393 // 108160725869250 = Sony Ericsson
1394 // 39010226174 = Vlingo
1395 // 247431880944 = Droid
1396 // 66746580154 = Dell Mobile
1397 // 96105046534 = RockMelt
1398 // 143907478979139 = RockMelt Beta
1399 // 146563558702544 = Friendly for Ipad
1400 // 131289390231340 = Slide
1401 // 9953271133 = networked blogs
1402 // 45439413586 = RSS Grafitti
1403 // 131732509879 = Twitter Feed
1404 // 23723376453 = Seesmic
1405 // 76456527540 = Facebook mobile by Opentech ENG
1406 // 105130332854716 = flipboard
1407 // 27694818115 = Ovi by Nokia
1408 // 67878695711 = Nokia N900
1409 // 124024574287414 = Instagram
1410 // 79763977758 = Kodak Easy Share
1411 // 139682082719810 = Snaptu for Facebook
1412 // 122580857763901 = eBuddy
1413 // 24553799497 = mobileblog
1414 // 159348674082705 = Photoloader
1415 // 112618498804176 = FriendCaster for Android
1416 // 148061315211358 = Friendcaster Pro for android
1417 // 104142802965358 = My INQ Mobile
1418 // 149588628439275 = Twidroyd for Twitter
1419 // 7933375107 = Windows Phone
1420 // 135892916448833 = Facebook for Windows Phone
1421 // 48505437520 = Sony Ericsson Web Albums
1422 // 198446803501767 = HTC ChaCha
1423 // 193278124048833 = HTC Sense
1424 // 165907476854626 = Facebook Pages Manager
1425 // 213546525407071 = iOS
1426 // 531615603522381 = Facebook Site Governance voting app
1427 // 149859461799466 = Sony Xperia Smartphone
1428 // 178645865537776 = Blackberry
1429 // --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)
1432 // EXTRA STORIES ( see http://extras.fbpurity.com for more info )
1433 // Read option settings and set extra story codes
1435 ////////////////////////
1437 ////////////////////////
1439 var arrwhitelist2
={}; // this is the main application whitelist array
1440 var extraTextFilter
;
1441 var headerTextFilter
;
1442 var cleancustomtextfilter
='';
1443 var headertextfilterRX
;
1447 var fbpfanpageid
="408502197558";
1448 var fbpdevpageid
="464154953615751";
1450 function getuserid(){
1452 var currentuser
=document
.getElementsByClassName('headerTinymanPhoto');
1453 if(currentuser
.length
&& currentuser
[0].src
&& currentuser
[0].src
.match(/_
/))
1454 userid
=currentuser
[0].src
.split('_')[1];
1457 userid
=document
.cookie
.match(/c_user=(\d+)/)[1];
1460 console
.log('problem getting logged in user id: ' + e
);
1465 var currentuserid
=getuserid();
1467 if (!currentuserid
.length
)
1468 var useridwhitelistRX
=new RegExp(fbpfanpageid
);
1470 var useridwhitelistRX
=new RegExp(fbpfanpageid
+ "|" + fbpdevpageid
+ "|" + currentuserid
);
1472 refreshwhitelist = function () {
1474 if (fbpoptsobj
.userappwhitelist
&& fbpoptsobj
.userappwhitelist
.length
)
1475 whitelist
= defaultappwhitelist
+ "," + fbpoptsobj
.userappwhitelist
;
1477 whitelist
= defaultappwhitelist
;
1479 whitelist
= whitelist
.replace(/,,/g,''); // remove blanks (if any)
1480 whitelist
= whitelist
.replace(/ /g
,''); // remove spaces (if any)
1481 whitelist
= whitelist
.replace(/,$/,''); // remove trailing comma (if any)
1483 var arrwhitelist
=whitelist
.split(',');
1485 for (i
in arrwhitelist
)
1486 arrwhitelist2
[arrwhitelist
[i
]]=true; // create hashmap
1489 fbptimelinerestyle=function (tloff
) {
1492 //fix group cover image links
1493 tlstyle
+= ' .groupsCoverPhoto img.coverPhotoImg, .groupsCoverPhoto a.coverWrap {height:100px !important}'+
1494 // make the Timeline Cover Photo Shorter (not doing this any more as it interfers with changing cover photo)
1495 // ' .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} '+
1497 // fix save and cancel and drag to reposition
1498 ' #coverEditSaveCancelArea .saveAndCancel {margin-top:40px} a.coverWrap .instructionWrap {top:120px !important}'+
1499 // hide the 'Coming Soon: Timeline' section at the top of Timeline pages
1500 ' #pagelet_above_header_timeline {display:none}'+
1501 // hide the "escape hatch" (friends / about / interests picture squares section)
1502 ' #pagelet_escape_hatch {display:none}'+
1503 // single column timeline
1504 ' .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}' +
1505 // fix left margin and cover image size for personal timeline versus fan page timeline
1506 ' .pagesTimelineLayout .fbTimelineUnit {margin-left:150px !important} '+
1507 //div[itemtype="http://data-vocabulary.org/Person"] #fbProfileCover .coverWrap { {height: 150px !important} div[itemtype="http://data-vocabulary.org/Person"] .coverWrap {height:150px !important}' +
1508 // event page with cover image
1509 ' div.fbEventLeftNav {position:relative;top:20px !important} div.fbEventHeaderBlock {position:relative;top:25px !important;left:0px !important }';
1511 if (document
.getElementById('fbptlstyle'))
1512 document
.getElementById('fbptlstyle').textContent
=tlstyle
;
1515 initstage2 = function () {
1518 //console.log('entering function : ' + arguments.callee.name);
1520 if(fbpoptsobj
.sortmostrecent
) { // force feed to sort by most recent
1521 var sortlink
=document
.getElementsByClassName('sortLink');
1522 if(sortlink
.length
) {
1523 if(!sortlink
[0].textContent
.match(/\:/))
1524 window
.location
.href
=window
.location
.protocol
+'//www.facebook.com/?sk=h_chr';
1527 extraTextFilter
=''; // init extraTextFilter
1528 headerTextFilter
=''; // init headerTextFilter
1529 if(fbpoptsobj
.filterappmessages
==1) {
1530 filterapptext
=' fbpblocked';
1531 headerTextFilter
+= ', played .*,started playing,started using';
1532 extraTextFilter
+= ',games your friends are playing,Games You May Like';
1535 filterapptext
=' fbpnormal';
1537 if(fbpoptsobj
.becamefriends
==1)
1538 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)
1540 if(fbpoptsobj
.becamefan
==1){
1541 headerTextFilter
+= ', recommends, likes .* and \\d* other pages,wrote a recommendation for, rated .*';
1542 extraTextFilter
+= ',like page,Like this Page,Find More Pages ·, Write a recommendation ';
1545 if(fbpoptsobj
.joinedgroup
==1) {
1546 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";
1547 extraTextFilter
+= ",· Join Group";
1550 if(fbpoptsobj
.attendevent
==1)
1551 headerTextFilter
+= ",is attending, is going to";
1553 if(fbpoptsobj
.attendedevent
==1)
1554 headerTextFilter
+= ", attended the event, went to .*\.";
1556 if(fbpoptsobj
.createdevent
==1)
1557 headerTextFilter
+= ",created an event,updated the event photo";
1559 if((typeof fbpoptsobj
.upcomingevents
!=='undefined') && (fbpoptsobj
.upcomingevents
==1))
1560 extraTextFilter
+= ",Upcoming Events,Upcoming Concerts";
1562 if((typeof fbpoptsobj
.sharedevent
!=='undefined') && (fbpoptsobj
.sharedevent
==1))
1563 headerTextFilter
+= ",shared an event, shared .*\\'s event, posted an event";
1564 //extraTextFilter += ",people are goingjoin" // may also filter out "created an event" stories
1566 if (typeof fbpoptsobj
.checkedin
== "undefined")
1567 fbpoptsobj
.checkedin
= 0;
1569 if(fbpoptsobj
.checkedin
==1)
1570 headerTextFilter
+= ", is with .*,was tagged at, is in .*\., was in .*\., is at .*\., was at .*\., were at .*\., are at .*\., was with ";
1572 if((typeof fbpoptsobj
.likedstatus
!=='undefined') && (fbpoptsobj
.likedstatus
==1))
1573 headerTextFilter
+= ", likes .*\'s status, like .*\'s status, like a status, likes a status, likes a post";
1575 if((typeof fbpoptsobj
.commentedstatus
!=='undefined') && (fbpoptsobj
.commentedstatus
==1))
1576 headerTextFilter
+= ",commented on .* status, commented on .* note, commented on .* activity";
1578 //if(fbpoptsobj.taggedstatus==1) {
1579 //; //headerTextFilter += ", not sure how to handle this one
1581 if((typeof fbpoptsobj
.sharedstatus
!=='undefined') && (fbpoptsobj
.sharedstatus
==1))
1582 headerTextFilter
+= ", shared .*\'s status, shared a status, shared .*\'s post";
1584 if((typeof fbpoptsobj
.taggedphoto
!=='undefined') && (fbpoptsobj
.taggedphoto
==1))
1585 headerTextFilter
+= ",tagged in h.. own photo,tagged in .*\'s photo,tagged in h.. own album, tagged in .*\'s album";
1587 if((typeof fbpoptsobj
.likedphoto
!=='undefined') && (fbpoptsobj
.likedphoto
==1))
1588 headerTextFilter
+= ",likes .* photo\.,likes? a photo,likes .*\'s album";
1590 if((typeof fbpoptsobj
.commentedphoto
!=='undefined') && (fbpoptsobj
.commentedphoto
==1))
1591 headerTextFilter
+= ",commented on .*\'s photo,commented on h.. own photo,commented on h.. own album,commented on a photo,commented on .*\'s album";
1593 if((fbpoptsobj
.commentedlink
!== 'undefined') && (fbpoptsobj
.commentedlink
==1)) {
1594 headerTextFilter
+= ",commented on .*\'s link,commented on a link,commented on h.. own link,commented on .*\.com\.";
1596 // maybe move "likes an article" to the trending articles filter...
1597 if((fbpoptsobj
.likedlink
!== 'undefined') && (fbpoptsobj
.likedlink
==1)) {
1598 headerTextFilter
+= ",likes an article,recommends a link,likes a link,like a link,likes .*\'s link,likes \\d+ links";
1601 if((fbpoptsobj
.sharedpage
!== 'undefined') && (fbpoptsobj
.sharedpage
==1)) {
1602 headerTextFilter
+= ",shared a Page";
1605 if(fbpoptsobj
.commentwall
==1)
1606 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,
1609 if (typeof fbpoptsobj
.updatedprofile
== "undefined")
1610 fbpoptsobj
.updatedprofile
= 0;
1612 if(fbpoptsobj
.updatedprofile
==1)
1613 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";
1615 // changed profile pic
1616 if (typeof fbpoptsobj
.changedprofilepic
== "undefined")
1617 fbpoptsobj
.changedprofilepic
= 0;
1619 if(fbpoptsobj
.changedprofilepic
==1)
1620 headerTextFilter
+= ",changed their profile picture,changed h.. profile picture,updated h.. cover photo\.,updated their cover photo";
1622 // changed relationship
1623 if (typeof fbpoptsobj
.changedrelationship
== "undefined")
1624 fbpoptsobj
.changedrelationship
= 0;
1626 if(fbpoptsobj
.changedrelationship
==1)
1627 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';
1630 if (typeof fbpoptsobj
.uploadedphoto
== "undefined")
1631 fbpoptsobj
.uploadedphoto
= 0;
1633 if(fbpoptsobj
.uploadedphoto
==1){
1634 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";
1635 extraTextFilter
+=', (\\d+ photos)';
1639 if (typeof fbpoptsobj
.sharedphoto
== "undefined")
1640 fbpoptsobj
.sharedphoto
= 0;
1642 if(fbpoptsobj
.sharedphoto
==1){
1643 headerTextFilter
+= ",shared a photo,shared .*\'s album";//shared .*\'s photo,
1644 extraTextFilter
+= ",by\:,shared .*?'s photo";
1648 if (typeof fbpoptsobj
.uploadedvideo
== "undefined")
1649 fbpoptsobj
.uploadedvideo
= 0;
1651 if(fbpoptsobj
.uploadedvideo
==1){
1652 headerTextFilter
+= ",posted A video,added a video,uploaded.* video";
1653 //extraTextFilter +=",Length: ?\\d+:\\d\\d"; // this filter doesnt seem to work...
1657 if (typeof fbpoptsobj
.taggedinvideo
== "undefined")
1658 fbpoptsobj
.taggedinvideo
= 0;
1660 if(fbpoptsobj
.taggedinvideo
==1)
1661 headerTextFilter
+= ",tagged in .*\'s video ";
1663 /* new video options 28th jan
1669 if((typeof fbpoptsobj
.sharedvideo
!=='undefined') && (fbpoptsobj
.sharedvideo
==1))
1670 // we also add a check for classname "shareMediaVideo" to improve filter coverage
1671 headerTextFilter
+= ",shared a video,shared .*\'s video";
1673 if((typeof fbpoptsobj
.likedvideo
!=='undefined') && (fbpoptsobj
.likedvideo
==1))
1674 headerTextFilter
+= ",liked a video,liked .*\'s video,likes .*\'s video";
1676 if((typeof fbpoptsobj
.commentedvideo
!=='undefined') && (fbpoptsobj
.commentedvideo
==1))
1677 headerTextFilter
+= ",commented on a video,commented on .*'s video";
1679 if((typeof fbpoptsobj
.youtubevideo
!=='undefined') && (fbpoptsobj
.youtubevideo
==1))
1680 extraTextFilter
+= ",youtube\.com,youtu\.be,vimeo\.com";
1682 //if(fbpoptsobj.hideallvideos==1)
1683 // ; // we are dealing wtih this by running a check on the node for the "shareMediaVideo" class
1685 //if(fbpoptsobj.hidealllinks==1)
1686 // Need to Add all links filter here?
1689 if (typeof fbpoptsobj
.postednote
== "undefined")
1690 fbpoptsobj
.postednote
= 0;
1692 if(fbpoptsobj
.postednote
==1)
1693 headerTextFilter
+= ",posted a note";
1696 if (typeof fbpoptsobj
.taggedinnote
== "undefined")
1697 fbpoptsobj
.taggedinnote
= 0;
1699 if(fbpoptsobj
.taggedinnote
==1)
1700 headerTextFilter
+= ",tagged in a note,tagged in a Post,tagged in .* life event";
1703 if (typeof fbpoptsobj
.postedlink
== "undefined")
1704 fbpoptsobj
.postedlink
= 0;
1706 if(fbpoptsobj
.postedlink
==1)
1707 headerTextFilter
+= ",shared link\\.,shared a link\\.";
1710 if (typeof fbpoptsobj
.readarticle
== "undefined")
1711 fbpoptsobj
.readarticle
= 0;
1713 if(fbpoptsobj
.readarticle
==1) {
1714 headerTextFilter
+= ",read an article, recently read articles\\., read \\d* articles\\.";
1715 extraTextFilter
+= ",Trending Articles,Trending Videos,Most Shared on ,Recent Articles About ";
1718 // facebook questions
1719 if(fbpoptsobj
.questionsbox
==1) {
1720 headerTextFilter
+= ", replied to: , asked: ,answered .*'s question,asked.*a question";
1721 extraTextFilter
+= ",· Ask friends ·";
1724 // hide sponsored stories in newsfeed
1725 if(fbpoptsobj
.sponsoredbox
==1) {
1726 extraTextFilter
+= ",Recently Released Albums,Get Offer ·"; //· Sponsored
1727 headerTextFilter
+= ", claimed an offer from, posted an offer";
1731 if(fbpoptsobj
.fontfix
==1) {
1732 /*if(document.getElementById('fbpfreestyler'))
1733 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}';
1735 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}';
1739 if(fbpoptsobj
.fontcolourfix
==1) {
1740 /*if(document.getElementById('fbpfreestyler'))
1741 document.getElementById('fbpfreestyler').textContent +=' * {color:' + fbpoptsobj.fontcolour + ' !important}'; //span.fwb {color:' + fbpoptsobj.fontcolour + ' !important}';
1743 fbpfreestyle
.textContent
+=' * {color:' + fbpoptsobj
.fontcolour
+ ' !important}'; //span.fwb {color:' + fbpoptsobj.fontcolour + ' !important}';
1746 // fix font background colour
1747 if(fbpoptsobj
.fontbgcolourfix
==1) {
1748 //if(document.getElementById('fbpfreestyler'))
1749 // document.getElementById('fbpfreestyler')
1750 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 {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}';
1754 if(fbpoptsobj
.fbpfontfix
==1) {
1755 //if(document.getElementById('fbpfreestyler'))
1756 // document.getElementById('fbpfreestyler')
1757 fbpfreestyle
.textContent
+=' * {font-family:' + fbpoptsobj
.fbpfont
+ ' !important} ';
1761 if(fbpoptsobj
.likepagebutton
==1) {
1762 fbpfreestyle
.textContent
+=' div.uiStreamShareLikePageBox div.uiPageLikeButton, div.genericStreamStory a.PageLikeButton, div[data-dedupekey] span.PageLikeButton {display:none} ';
1764 // single column timeline
1766 if(fbpoptsobj.timelineonecol==1)
1767 fbptimelinerestyle(1);
1769 fbptimelinerestyle(0);
1772 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(',');
1773 for(b
=0;b
<lcoptsarr
.length
;b
++)
1774 if (typeof fbpoptsobj
[lcoptsarr
[b
]] == "undefined")
1775 fbpoptsobj
[lcoptsarr
[b
]]=0;
1777 //var fbpfreestyler=document.getElementById('fbpfreestyler');
1778 //if (fbpfreestyler) {
1782 // start left column options
1783 if(fbpoptsobj
.lcconnect
==1)
1784 fbpfreestyle
.textContent
+=' #connectNav {display:none}';
1786 if(fbpoptsobj
.lcallpages
==1)
1787 fbpfreestyle
.textContent
+=' #pagesNav {display:none}';
1789 if(fbpoptsobj
.lcallapps
==1)
1790 fbpfreestyle
.textContent
+=' #appsNav {display:none}';
1792 if(fbpoptsobj
.lcallgroups
==1)
1793 fbpfreestyle
.textContent
+=' #groupsNav {display:none}';
1795 if(fbpoptsobj
.lcallinterests
==1)
1796 fbpfreestyle
.textContent
+=' #interestsNav { display:none }';
1798 if(fbpoptsobj
.lcfriends
==1)
1799 fbpfreestyle
.textContent
+=' #listsNav { display:none}';
1801 // items beginning with #navItem_app_ are for the old newsfeed, and those with #sidebar_navigation_top are the new newsfeed
1802 if(fbpoptsobj
.lcadvertmgr
==1)
1803 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}';
1805 if(fbpoptsobj
.lcpagesfeed
==1)
1806 fbpfreestyle
.textContent
+=' #navItem_app_140472815972081, #sidebar_navigation_top a[data-id="140472815972081"] {display:none}';
1808 if(fbpoptsobj
.lclikepages
==1)
1809 fbpfreestyle
.textContent
+=' #navItem_app_357937250942127, #navFindFriends, #sidebar_navigation_top a[data-id="357937250942127"] {display:none}';
1811 if(fbpoptsobj
.lcappcenter
==1)
1812 fbpfreestyle
.textContent
+=' #navItem_app_140332009231, #sidebar_navigation_top a[data-id="140332009231"] {display:none}';
1814 if(fbpoptsobj
.lcevents
==1)
1815 fbpfreestyle
.textContent
+=' #navItem_app_2344061033, #sidebar_navigation_top a[data-id="2344061033"] {display:none}';
1817 if(fbpoptsobj
.lcgamesfeed
==1)
1818 fbpfreestyle
.textContent
+=' #navItem_app_261369767293002, #sidebar_navigation_top a[data-id="261369767293002"] {display:none}';
1820 if(fbpoptsobj
.lcpokes
==1)
1821 fbpfreestyle
.textContent
+=' #navItem_app_183217215062060, #sidebar_navigation_top a[data-id="183217215062060"] {display:none}';
1823 if(fbpoptsobj
.lcmusic
==1)
1824 fbpfreestyle
.textContent
+=' #navItem_app_119960514742544, #sidebar_navigation_top a[data-id="119960514742544"] {display:none}';
1826 if(fbpoptsobj
.lcplaceseditor
==1)
1827 fbpfreestyle
.textContent
+=' #navItem_app_219124168114356, #sidebar_navigation_top a[data-id="219124168114356"] {display:none}';
1829 if(fbpoptsobj
.lccreategroup
==1)
1830 fbpfreestyle
.textContent
+=' #navItem_app_230259100322928, #sidebar_navigation_top a[data-id="230259100322928"] {display:none}';
1832 if(fbpoptsobj
.lccreatepage
==1)
1833 fbpfreestyle
.textContent
+=' #navItem_app_188619144602540, #sidebar_navigation_top a[data-id="188619144602540"] {display:none}';
1835 if(fbpoptsobj
.lcfindfriends
==1)
1836 fbpfreestyle
.textContent
+=' #navItem_app_2356318349, #sidebar_navigation_top a[data-id="2356318349"], #findFriendsNav {display:none !important}';
1838 if(fbpoptsobj
.lcdeveloper
==1)
1839 fbpfreestyle
.textContent
+=' #developerNav, #navItem_app_2345053339, #sidebar_navigation_top a[data-id="2345053339"] {display:none}';
1841 if(fbpoptsobj
.lcgifts
==1)
1842 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"] {display:none}';
1844 if(fbpoptsobj
.rcrecommendedpages
==1)
1845 fbpfreestyle
.textContent
+=' #pages_reminders_link {display:none}';
1847 if(fbpoptsobj
.rcbirthdays
==1)
1848 fbpfreestyle
.textContent
+=' #birthday_reminders_link {display:none}';
1850 if(fbpoptsobj
.rcgamerequests
==1)
1851 fbpfreestyle
.textContent
+=' #custom_reminders_link {display:none}';
1853 if(fbpoptsobj
.rcfriendrequests
==1)
1854 fbpfreestyle
.textContent
+=' #friends_reminders_link {display:none}';
1856 if(fbpoptsobj
.rcpokes
==1)
1857 fbpfreestyle
.textContent
+=' #poke_reminders_link, #pagelet_pokes {display:none}';
1859 if(fbpoptsobj
.rcrelatedgroups
==1)
1860 fbpfreestyle
.textContent
+=' #pagelet_ego_contextual_group {display:none !important}';
1862 // hide useless bottom right footer + ads on login + logout screen + useless links in top nav bar
1863 fbpfreestyle
.textContent
+= 'div.fbIndexFeaturedRegistration > div.lfloat, .-cx-PRIVATE-fbAdUnit__root, #pagelet_rhc_footer, #SetAsHomepage_Callout, .gradientContent > div[data-ad^="{"], #findFriendsNav, #navFindFriends {display:none !important}';
1865 // hide contact importer at bottom of feed
1866 fbpfreestyle
.textContent
+= ' .contact_importer_widget {display:none} #ci_compact_right {display:none}';
1868 // add red border to publish permissions request and make light grey blurb black and bold
1869 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}';
1871 // add open and close list styles
1872 fbpfreestyle
.textContent
+= ' span.fbpopenlist:before {content:"▼ "} span.fbpclosedlist:before {content:"► "}';
1875 ////////////////////////
1877 ////////////////////////
1881 //unsafeWindow.console.log("etf= " + extraTextFilter);
1883 var tmptextfilter
='';
1884 tmptextfilter
=fbpoptsobj
.customtextfilter
;
1886 tmptextfilter
+= ',' + extraTextFilter
; // add emergency extra text filter
1888 tmptextfilter
= extraTextFilter
;
1890 if( tmptextfilter
.length
) {
1891 tmptextfilter
=tmptextfilter
.replace(/,,/g,','); // remove blanks (if any)
1892 tmptextfilter
=tmptextfilter
.replace(/,+$|^,+/g,''); // remove trailing or leading commas
1893 cleancustomtextfilter
=fbpescaperegex(tmptextfilter
); // escape regex special chars (brackets)
1896 textfilterRX
= new RegExp(cleancustomtextfilter
.replace(/,/g
,'|'),"gi");
1899 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.")
1900 //textfilterRX=null;
1901 textfilterRX
=new RegExp("fbpurity1234567890xyz"); // set a dummy regex, so firefox browser doesnt freeze, and user can go and reset the fbp options
1905 //unsafeWindow.console.log('htf=' + headerTextFilter);
1907 headerTextFilter
=headerTextFilter
.replace(/^,/,''); // remove leading comma (if any)
1909 if( headerTextFilter
&& headerTextFilter
.length
) {
1911 headertextfilterRX
= new RegExp(headerTextFilter
.replace(/,/g
,'|'),"gi");
1914 window
.alert('F.B. Purity: regex error building header text filter : ' + headerTextFilter
);
1915 headertextfilterRX
=null;
1919 //unsafeWindow.console.log(fbpoptsobj.customtextfilter);
1923 // hide suggestions box if option has been set
1924 if (fbpoptsobj
.suggestionsbox
) {
1925 fbpboxstyles
+=' #ego_pane {display:none} #netego_organic {display:none} #pagelet_tips_box {display:none}';
1927 // hide Get Connected (was: connect with friends) box if option has been set
1928 if (fbpoptsobj
.connectbox
) {
1929 fbpboxstyles
+=' #pagelet_netego_lower {display:none} #pagelet_connectbox {display:none}';
1932 if (fbpoptsobj
.betabox
) {
1933 fbpboxstyles
+=' #pagelet_betabox {display:none}';
1936 if (fbpoptsobj
.pokebox
) {
1937 fbpboxstyles
+=' #pagelet_netego_pokes, #pagelet_pokes, #navItem_app_183217215062060 {display:none}';
1940 if (fbpoptsobj
.happeningnowbar
) {
1941 fbpboxstyles
+=' .ticker_stream, #pagelet_ticker, #pagelet_rhc_ticker {display:none}';
1944 if (fbpoptsobj
.questionsbox
) {
1945 fbpboxstyles
+=' #pagelet_netego_questions, #pagelet_questionsbox {display:none}';
1948 if (fbpoptsobj
.eventsbox
) {
1949 fbpboxstyles
+=' #event_reminders_link'; // hide left column events too #navItem_app_2344061033 {display:none} just hide create event link #pagelet_reminders [ajaxify="/ajax/plans/create/dialog.php"] * { display: none !important;}
1952 if (fbpoptsobj
.requestsbox
) {
1953 fbpboxstyles
+=' #pagelet_netego_requests {display:none}';
1956 if (fbpoptsobj
.sponsoredbox
) {
1957 fbpboxstyles
+=' 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} ';
1960 if (fbpoptsobj
.chatbox
) {
1961 fbpboxstyles
+=' #pagelet_presence, #pagelet_friends_online, #pagelet_chat, #BuddylistPagelet, div.fbChatSidebarBody {display:none}';
1964 if ((typeof fbpoptsobj
.smileys
!=='undefined') && fbpoptsobj
.smileys
) {
1965 fbpboxstyles
+=' img.wallArrowIcon, .emoticon_text {display:inline !important} .emoticon {display:none !important} i.-cx-PRIVATE-fbEntstreamEmoji__image, i.-cx-PRIVATE-ogAttachedSentenceToken__icon, span.-cx-PRIVATE-fbEmoji__icon, h5.uiStreamMessage img, span.userContent i.img, .userContentSecondary i.img, span.hasCaption i.img, div.shareSubtext i.img, div.uiStreamAttachments i.img, div.UFICommentContent span._1a- {display:none} div.userContentWrapper i.img, h5.uiStreamMessage i.img {display:none} '; // !important
1968 if ((typeof fbpoptsobj
.notificationpopup
!=='undefined') && fbpoptsobj
.notificationpopup
) {
1969 fbpboxstyles
+=" ul[data-gt^='{\"ref\":\"beeper\"'] {display:none}";
1972 if ((typeof fbpoptsobj
.fixedleftcolumn
!=='undefined') && fbpoptsobj
.fixedleftcolumn
) {
1973 fbpboxstyles
+=' .home #leftCol {position:fixed !important}';
1976 if(fbpoptsobj
.offlinefriends
) {
1977 // hide offline friends in chat
1978 fbpboxstyles
+=" .fbChatOrderedList li {display: none;} .fbChatOrderedList .active {display: block;}";
1981 //if(document.getElementById('fbpboxstyler'))
1982 // document.getElementById('fbpboxstyler').textContent = fbpboxstyles;
1983 fbpboxstyle
.textContent
= fbpboxstyles
;
1985 // set custom css (if user has specified any styles)
1986 if (fbpoptsobj
.fbpcustomcss
) {
1987 //if(document.getElementById('fbpcssstyler'))
1988 // document.getElementById('fbpcssstyler').textContent = fbpoptsobj.fbpcustomcss;
1989 fbpcssstyle
.textContent
= fbpoptsobj
.fbpcustomcss
;
1993 console
.log('are we here at the end of initstage 2?');
1995 } //END FUNCTION INITSTAGE2
1997 fbpdynamicreload = function (opts
) {
1999 if(document
.getElementById('fbpoptsdiv') && document
.getElementById('fbpoptsdiv').style
.display
=='block') {
2000 document
.getElementById('fbpoptsdiv').style
.display
='none';
2005 //tlbuttinit(); // reset TL button state
2006 if(fbpoptsobj
.timelineonecol
==false)
2007 window
.setTimeout(function(){document
.getElementById('FBTLX').style
.display
='none';},1500);
2009 window
.setTimeout(function(){document
.getElementById('FBTLX').style
.display
='block';},1500);
2011 cleartheshizzle(document
);
2016 initstage2(); // run it once to finish initialisation
2017 have moved this call into fbpgetprefs...
2020 // function to add delete friend request buttons
2021 /*function adddelreqbuttons(node) {
2022 // for adding delete request button to main friend request indicator panel and also the list at https://www.facebook.com/friends/requests/
2023 commented out for now as was causing errors in line 1991
2024 actiondivs=node.getElementsByClassName('actions');
2025 if(!actiondivs.length || !node.getElementsByClassName('uiButtonConfirm').length || node.getElementsByClassName('privacyPlan').length || document.getElementById('questions_stories'))
2027 for(var i=0;i<actiondivs.length;i++) {
2028 //unsafeWindow.console.log(actiondivs[i].childNodes[0].getAttribute('class'));
2029 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/)) {
2030 //unsafeWindow.console.log('timeline page');
2034 binps=actiondivs[i].getElementsByTagName('input');
2035 for(j=0;j<binps.length;j++)
2036 if(binps[j].getAttribute && binps[j].getAttribute('name') && binps[j].getAttribute('name').match(/actions\[reject\]|Admin Panel/)) {
2041 delreqbutt=document.createElement('label');
2042 delreqbutt.className='uiButton uiButtonDefault uiButtonMedium';
2043 delreqbutt.innerHTML='<input type="submit" title="Delete this request. (The sender wont know.)" name="actions[reject]" value="Delete">';
2044 actiondivs[i].appendChild(delreqbutt);
2050 function fpInsertedNodeDomHandler(event
) {
2052 if((event
.target
.nodeName
=='LI') || (event
.target
.nodeName
=='UL')) {
2053 //if ((document.getElementById('pagelet_home_stream')||(document.getElementById('profile_minifeed'))) && (!document.getElementById('fb_multi_friend_selector'))) {
2054 if ((document
.getElementById('pagelet_home_stream') ) && (!document
.getElementById('fb_multi_friend_selector'))) {
2055 //console.log(event.target.nodeName);
2056 cleartheshizzle(event
.target
);
2057 //unmanglelinks(event.target);
2060 ; // not doing anything at the mo
2062 if(fbpoptsobj
.fixarticleredirects
&& event
.target
.getElementsByTagName('a').length
)
2063 unmanglelinks(event
.target
);
2065 else if(event
.target
.nodeName
=='DIV') {
2066 //var functRef = callLater(adddelreqbuttons,event.target);
2067 //setTimeout(functRef, 1500);
2068 if (document
.getElementById('pagelet_litestand_section') || document
.getElementById('stream_pagelet')) {
2069 //console.log(event.target.nodeName);
2070 cleartheshizzle(event
.target
);
2071 //unmanglelinks(event.target);
2073 if((event
.target
.getAttribute('id')=='platform_dialog_content') || (event
.target
.getElementsByClassName('tosPane').length
) || (event
.target
.getAttribute('class') && event
.target
.getAttribute('class').match(/tosPane/))) {
2074 //its most likely a facebook application requesting permissions
2075 highlightemailrequest();
2076 //appid=document.getElementById('input_app_id').getAttribute('value');
2077 addblockbuttontopermreq();
2079 if(event
.target
.getAttribute('class') && event
.target
.getAttribute('class').match('middle_area_content')){
2080 if(window
.location
.href
.match(/\/appcenter\//))
2081 highlightemailrequest();
2083 if(fbpoptsobj
.fixarticleredirects
&& event
.target
.getElementsByTagName('a').length
)
2084 unmanglelinks(event
.target
);
2086 //setTimeout(function(){adddelreqbuttons(event.target)},1000); // add delete friend request buttons if required
2088 else if((event
.target
.nodeName
=='SPAN') && (event
.target
.getAttribute
&& event
.target
.getAttribute('class') && event
.target
.getAttribute('class').match(/hasCaption/))) {
2089 //console.log('hit a spanner');
2090 unmanglelinks(event
.target
);
2092 } // END fpInsertedNodeDomHandler function
2094 function updateblockedcount() {
2095 crappyappmsgcounter
=document
.getElementsByClassName('fbpblocked').length
;
2096 var fbpblockcountspan
=document
.getElementById('fbpblockcount');
2097 if(fbpblockcountspan
)
2098 fbpblockcountspan
.innerHTML
=crappyappmsgcounter
;
2100 xtramsgcounter
=document
.getElementsByClassName('fbpblockedx').length
;
2101 var fbpblockxcountspan
=document
.getElementById('fbpblockxcount');
2102 if(fbpblockxcountspan
)
2103 fbpblockxcountspan
.innerHTML
=xtramsgcounter
;
2106 function destroyblockedappstories (appid
,killmode
) {
2108 var appnodes
=document
.getElementsByClassName('aid_' + appid
);
2109 var appnodeslength
=appnodes
.length
;
2110 for (var i
=0;i
<appnodeslength
;i
++){
2111 //appnodes=document.getElementsByClassName('aid_' + appid);
2112 if(killmode
=='kill')
2113 appnodes
[0].parentNode
.removeChild(appnodes
[0]);
2114 else if(killmode
=='allow')
2115 appnodes
[i
].className
= appnodes
[i
].className
.replace(/\bfbpblocked\b/,'fbpnormal');
2117 if(fpbblockcountspan
)
2118 fpbblockcountspan
.innerHTML
=--crappyappmsgcounter
;
2120 updateblockedcount();
2121 //check if there are any blocked msgs left and if not, return to normal homepage view
2122 blockedmsgs
=document
.getElementsByClassName('fbpblocked');
2123 if(!blockedmsgs
.length
)
2127 }// END destroyblockedappstories function
2129 function getdtsg() {
2131 if(document
.getElementsByClassName('autoexpand_mode').length
) {
2132 if(document
.getElementsByClassName('autoexpand_mode')[0].wrappedJSObject
)
2133 fb_dtsg
= document
.getElementsByClassName('autoexpand_mode')[0].wrappedJSObject
.fb_dtsg
.value
;
2135 fb_dtsg
= document
.getElementsByClassName('autoexpand_mode')[0].fb_dtsg
.value
;
2138 navinps
=document
.getElementsByTagName('input');
2139 for(var i
=0;i
<navinps
.length
;i
++)
2140 if(navinps
[i
].getAttribute('name')=='fb_dtsg') {
2141 fb_dtsg
=navinps
[i
].getAttribute('value');
2148 function allowapp(appid
, appname
) {
2150 if (confirm("Do you want to whitelist application : '" + appname
+"'" + ".\n\nApplication ID: " + appid
)) {
2151 if(fbpoptsobj
.userappwhitelist
.length
) {
2152 // theres already value/s in userwhitelist
2154 fbpoptsobj
.userappwhitelist
+=','+appid
;
2155 fbpsavevalue('fbpoptsjson-' + currentuserid
, JSON
.stringify(fbpoptsobj
));
2156 //document.getElementById("MyElement").className = document.getElementById("MyElement").className.replace(/\bMyClass\b/','')
2157 window
.alert(appname
+ ' has been Saved to your whitelist');
2159 destroyblockedappstories(appid
,'allow');
2162 window
.alert('error saving id to whitelist');
2167 // userwhitelist is blank
2169 fbpoptsobj
.userappwhitelist
=appid
;
2170 fbpsavevalue('fbpoptsjson-' + currentuserid
, JSON
.stringify(fbpoptsobj
));
2171 window
.alert(appname
+ ' has been Saved to your whitelist');
2173 destroyblockedappstories(appid
,'allow');
2176 window
.alert('error saving id to whitelist');
2183 } // END allowapp function
2185 function blockapp(appid
, appname
, nodeid
, autoblock
) {
2186 //var post_form_id = document.getElementById('post_form_id').getAttribute('value');
2187 var fb_dtsg
= getdtsg();
2188 if(typeof currentuserid
=='undefined' || currentuserid
=='')
2189 currentuserid
=getuserid();
2191 //unsafeWindow.pages_show_block_app("49572793475", "block", "about");
2193 // if not autoblocking - check if there are multiple apps to block, if so ask if user wants to block all at once
2194 if(typeof(autoblock
)=='undefined') {
2195 var app2bcount
=document
.getElementsByClassName('fbpblocked').length
;
2196 if (!confirm("Do you want to block application : '" + appname
+"'"))
2198 if (app2bcount
>1) // check if user wants to block all the currently shown applications
2202 if(document
.getElementById('blockapplab'))
2203 document
.getElementById('blockapplab').style
.display
='none';
2205 document
.getElementById(nodeid
).setAttribute('style','background:#DCDCDC !important;text-align:center');
2206 document
.getElementById(nodeid
).innerHTML
='<b>F.B. Purity</b> : Blocking Application : "<span style="color:red">' + appname
+ '</span>" <img style="text-align:middle" src="http://i289.photobucket.com/albums/ll237/bitingbiting/fb-loading-anim.gif">';
2208 var http
= new window
.XMLHttpRequest();
2209 //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";
2210 //var params = "__d=1&confirm=1&fb_dtsg=" + fb_dtsg + "&ok=Okay" ;
2211 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
;
2212 var params
= "__asyncDialog=1&__user=" + currentuserid
+ "&__a=1&confirmed=1&fb_dtsg=" + fb_dtsg
;// + phstamp:1658166771106811366130
2214 http
.open("POST", url
, true);
2215 http
.setRequestHeader("Referer", window
.location
.protocol
+ "//" + window
.location
.hostname
+ "/apps/application.php?id=" + appid
);
2216 http
.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
2217 //http.setRequestHeader("Content-length", params.length);
2218 //http.setRequestHeader("Connection", "close");
2220 http
.onreadystatechange = function() {
2221 if(http
.readyState
== 4 && http
.status
== 200) {
2222 if(!http
.responseText
.match('\"errorSummary\"')){
2223 //unsafeWindow.console.log("successfully blocked app : '" + appname + "' with id=" +appid + "\n");
2224 if((nodeid
!='platform_dialog_content') &&(nodeid
!='pagelet_canvas_content'))
2225 destroyblockedappstories (appid
,'kill');
2227 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>';
2228 if(document
.getElementsByClassName('platform_dialog_bottom_bar_table').length
)
2229 document
.getElementsByClassName('platform_dialog_bottom_bar_table')[0].style
.display
='none';
2234 if(http
.responseText
.match(/\"errorSummary\"\:/))
2235 var errorsum
=http
.responseText
.match(/\"errorSummary\"\:\"(.*)\",\"error/)[1];
2238 if(http
.responseText
.match(/\"errorDescription\"\:/))
2239 var errordesc
=http
.responseText
.match(/\"errorDescription\"\:\"(.*)\",/)[1];
2242 if( errorsum
.length
&& errordesc
.length
)
2243 var wholeerror
= errorsum
+ ' : ' + errordesc
;
2245 var wholeerror
= http
.responseText
;
2246 window
.alert('app block failed for some reason:\n\n' + wholeerror
);
2253 } // END blockapp function
2255 function blockappev(ev
) {
2257 ev
.preventDefault();
2258 var appname
=this.getAttribute('appname');
2259 var appid
=this.getAttribute('appid');
2260 var nodeid
=this.getAttribute('nodeid');
2261 blockapp(appid
,appname
,nodeid
);
2262 } // END blockappev function
2264 function allowappev(ev
) {
2266 ev
.preventDefault();
2267 var appname
=this.getAttribute('appname');
2268 var appid
=this.getAttribute('appid');
2269 var nodeid
=this.getAttribute('nodeid');
2270 document
.getElementById(nodeid
).setAttribute('class', document
.getElementById(nodeid
).getAttribute('class') + ' aid_' + appid
);
2271 allowapp(appid
,appname
);
2272 } // END allowappev function
2274 function fbpshowblocked() {
2276 var showhidelink
=document
.getElementById('fbpshowblockedlink');
2277 var showorhidetext
=showhidelink
.textContent
;
2279 var showhidelinkx
=document
.getElementById('fbpshowblockedxlink');
2280 var showorhidetextx
=showhidelinkx
.textContent
;
2282 var blockedmsgs
=document
.getElementsByClassName('fbpblocked');
2284 if (showorhidetext
=='Show') {
2285 if(!blockedmsgs
.length
)
2287 showhidelink
.innerHTML
='Hide';
2288 showhidelink
.title
='Hide Application + Game Stories';
2289 showhidelinkx
.innerHTML
='Show';
2290 showhidelinkx
.title
='Show Extras (Friend/Group/Fan/Event etc Stories)';
2291 fbpstyle
.textContent
=fbpStyleApps
;
2294 showhidelink
.innerHTML
='Show';
2295 showhidelink
.title
='Show Application + Game Stories';
2296 fbpstyle
.textContent
=fbpStyleNormal
;
2299 //works better in reverse order
2300 for(i
=(blockedmsgs
.length
-1); i
>=0; i
--) {
2301 //unsafeWindow.console.log("show block link: " + i);
2302 dspBlockLink(blockedmsgs
[i
]);
2307 } // END fbpshowblocked function
2309 function fbpshowblockedx() {
2311 var showhidelinkx
=document
.getElementById('fbpshowblockedxlink');
2312 var showorhidetextx
=showhidelinkx
.textContent
;
2314 var showhidelink
=document
.getElementById('fbpshowblockedlink');
2315 var showorhidetext
=showhidelink
.textContent
;
2317 var blockedmsgs
=document
.getElementsByClassName('fbpblockedx');
2319 if (showorhidetextx
=='Show') {
2320 if(!blockedmsgs
.length
)
2322 showhidelinkx
.innerHTML
='Hide';
2323 showhidelinkx
.title
='Hide Extras (Friend/Group/Fan/Event etc Stories)';
2324 showhidelink
.innerHTML
='Show';
2325 showhidelink
.title
='Show Application + Game Stories';
2326 fbpstyle
.textContent
=fbpStyleExtras
;
2329 showhidelinkx
.innerHTML
='Show';
2330 showhidelinkx
.title
='Show Extras (Friend/Group/Fan/Event etc Stories)';
2331 fbpstyle
.textContent
=fbpStyleNormal
;
2336 } // END fbpshowblockedx
2338 fbpshowblockedev = function (ev
) {
2339 ev
.preventDefault();
2343 fbpshowblockedxev = function(ev
) {
2344 ev
.preventDefault();
2348 function dspBlockLink(node
, blockmode
) {
2349 if (node
.getElementsByClassName('blocklink').length
)
2354 // check if its a new FB Actions / Frictionless sharing app
2355 //uism =node.getElementsByClassName('uiStreamMessage');
2357 // if (uism[0].innerHTML.match(/\/hovercard\/application\.php\?id\=(\d*)|\/hovercard\/hovercard\.php\?id=(\d*)/))
2360 if (typeof(blockmode
)=='undefined') {
2361 var footernode
, headernode
;
2362 headernode
=node
.getElementsByClassName('uiStreamMessage');
2364 if(document
.getElementsByClassName('uiStreamFooter') && document
.getElementsByClassName('uiStreamFooter').length
) {
2365 footernode
=node
.getElementsByClassName('uiStreamFooter')[0];
2368 if(document
.getElementsByClassName('UIActionLinks_bottom') && document
.getElementsByClassName('UIActionLinks_bottom').length
) {
2369 footernode
=node
.getElementsByClassName('UIActionLinks_bottom')[0];
2372 footernode
='x'; //invalid node will cause exception, luckily we have an exception handler isnt it ;-)
2375 //its possibly an app posing as a normal facebook message, so lets try and get the appid from the footer
2376 if(headernode
.length
&& headernode
[0].innerHTML
.match(/application\.php\?id=(\d+)/)) {
2377 appid
=headernode
[0].innerHTML
.match(/application\.php\?id=(\d+)/)[1];
2379 else if(footernode
.innerHTML
.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)) {
2380 if(typeof footernode
.innerHTML
.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)[1] !='undefined')
2381 appid
=footernode
.innerHTML
.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)[1];
2382 else if(typeof footernode
.innerHTML
.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)[2] !='undefined')
2383 appid
=footernode
.innerHTML
.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)[2];
2386 if(footernode
.innerHTML
.match(/application\.php\?id=(\d+)/)) {
2387 if(footernode
.innerHTML
.match(/application\.php\?id=(\d+)/)[1]!='undefined')
2388 appid
=footernode
.innerHTML
.match(/application\.php\?id=(\d+)/)[1];
2394 //appname=footernode.getElementsByClassName("GenericStory_BottomAttribution")[0].getElementsByTagName('a')[0].textContent;
2395 if(footernode
.innerHTML
.match(/data-appname=/))
2396 appname
=footernode
.innerHTML
.match(/data-appname="([^"]*)"/)[1] ;
2397 else if (headernode
[0].innerHTML
.match(/application.php/)){
2398 appname
=headernode
[0].innerHTML
.match(/application\.php\?id=.*\>(.*)<\/\a\>/)[1];
2402 flinks
=footernode
.getElementsByTagName('a');
2403 appname
=flinks
[flinks
.length
-1].textContent
;
2405 appname
=flinks
[flinks
.length
-2].textContent
;
2408 appname
='mystery app x';
2409 //unsafeWindow.console.log('error getting application name');
2412 } // END if blockmode=normal (if !blockmode.length)
2414 // we are doing this for "started using app/game" (sua) type posts
2415 var uism
= node
.getElementsByClassName('uiStreamMessage')
2416 var alinks
=uism
[0].getElementsByTagName('a');
2417 for(var i
=0;i
<alinks
.length
;i
++){
2418 var datahover
=alinks
[i
].getAttribute('data-hovercard');
2420 var datahovermatch
=datahover
.match(/\/hovercard\/application\.php\?id\=(\d*)/);
2421 //var datahovermatch2=datahover.match(/\/hovercard\/hovercard\.php\?id=(\d*)/);
2422 if(datahovermatch
) {
2423 appid
=datahovermatch
[1];
2424 appname
=alinks
[i
].textContent
;
2427 /* else if(datahovermatch2) {
2428 appname=alinks[i].textContent;
2429 var nodnod=node.getElementsByTagName('a');
2430 for(var q=0;q<nodnod.length;i++)
2431 if(nodnod[q].textContent.match(appname)) {
2432 appidmatch=nodnod[q].getAttribute('data-hovercard').match(/\/hovercard\/application\.php\?id\=(\d*)/);
2434 appid=appidmatch[1];
2442 if(typeof(appid
)=='undefined' || appid
=='') { // dealing with frictionless sharing apps such as netflix
2443 if(node
.getAttribute('data-gt')) {
2444 //"appid":"163114453728333"
2445 if(node
.getAttribute('data-gt').match(/\"appid\":\"\d+\"/)) {
2446 appid
=node
.getAttribute('data-gt').match(/\"appid\":\"(\d+)\"/)[1];
2447 //appname=alinks[alinks.length-1].textContent;
2448 footerstuff
=node
.getElementsByClassName("uiStreamFooter");
2449 if(footerstuff
.length
){
2450 footerimagelink
=footerstuff
[0].getElementsByTagName('a');
2451 if(footerimagelink
.length
)
2452 if(footerimagelink
[0].getAttribute('data-appname'))
2453 appname
=footerimagelink
[0].getAttribute('data-appname');
2460 //console.log(appid + ' ' + appname);
2462 if (document
.getElementsByClassName('uiStreamHide') && document
.getElementsByClassName('uiStreamHide').length
) {
2463 hidebuttonclass
='uiStreamHide';
2464 hidebuttonclasses
='uiStreamHide';
2465 linkclasses
='blocklink uiStreamContextButton uiPopoverTriggerElem';
2468 hidebuttonclass
='hideButton';
2469 hidebuttonclasses
='mlm hideButton';
2470 linkclasses
='blocklink mlm hideButton';
2473 hidebuttonclasses
='uiStreamContextButton uiPopoverTriggerElem';
2475 var blinkinsertpoint
=node
.getElementsByClassName(hidebuttonclass
)[0];
2477 if(typeof blinkinsertpoint
== 'undefined') {
2479 var uism
=node
.getElementsByClassName('uiStreamMessage');
2480 if(uism
&& uism
.length
)
2481 blinkinsertpoint
=uism
[0];
2486 node
.setAttribute('class', node
.getAttribute('class') + ' aid_' + appid
); // lets do it for all apps (cos on profile pages apps sometimes dont include this class)
2487 var blinkspan
=document
.createElement('div');
2489 blinkspan
.setAttribute('style',"position:relative;opacity:0.5; top : 23px");
2490 blinkspan
.className
=hidebuttonclasses
;
2492 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>";
2493 blinkspan
.getElementsByTagName('a')[0].addEventListener("click", blockappev
, false);
2494 //blinkinsertpoint.parentNode.insertBefore(blinkspan, blinkinsertpoint); //(insert before pattern)
2495 blinkinsertpoint
.appendChild(blinkspan
);
2496 blinkinsertpoint
.appendChild(document
.createElement('br')); // separate the 2 links
2498 var alinkspan
=document
.createElement('div');
2499 alinkspan
.setAttribute('style',"position:relative; opacity:0.5; top : 23px;");
2500 alinkspan
.className
=hidebuttonclasses
;
2502 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>";
2503 alinkspan
.getElementsByTagName('a')[0].addEventListener("click", allowappev
, false);
2504 //blinkinsertpoint.parentNode.insertBefore(alinkspan, blinkinsertpoint); //(insert before pattern)
2505 blinkinsertpoint
.appendChild(alinkspan
);
2507 } // END dspBlockLink function
2509 function callLater(paramA
, paramB
, paramC
, paramD
, paramE
){
2511 //blockapp(appid, appname, nodeid, auto);
2512 paramA(paramB
, paramC
, paramD
, paramE
);
2513 //unsafeWindow.console.log(paramA,paramB, paramC, paramD)
2517 blockallapps = function() {
2518 var appdump
=document
.getElementsByClassName('fbpblocked');
2522 for(var i
=0;i
<appdump
.length
;i
++) {
2523 if(appdump
[i
].getElementsByClassName('blocklink').length
&& !apparray
[appdump
[i
].getElementsByClassName('blocklink')[0].getAttribute('appid')]) {
2524 apparray
[appdump
[i
].getElementsByClassName('blocklink')[0].getAttribute('appid')] = appdump
[i
].getAttribute('id') + ',' + appdump
[i
].getElementsByClassName('blocklink')[0].getAttribute('appname');
2525 appnamelist
+= appdump
[i
].getElementsByClassName('blocklink')[0].getAttribute('appname') + '\n';
2531 return false; // return and use normal block app function
2533 if(!confirm('Would you also like to block *ALL* ' + applength
+ ' of the following facebook applications?\n' + '-------------------------------------------------------------------------------\n\n' + appnamelist
.replace(/\n$/,'')))
2537 for(var j
in apparray
) {
2539 var functRef
= callLater(blockapp
,j
,apparray
[j
].split(/,/)[1], apparray
[j
].split(/,/)[0], 1);
2540 setTimeout(functRef
, 1600*i
);
2543 window
.scrollTo(0,0); // scroll up, so user can see its working
2550 } // END blockallapps function
2552 fbptoggleopts=function(e
) {
2555 if(!document
.getElementById('fbpoptsdiv') && document
.getElementById('content') ) {
2556 optsdiv
.innerHTML
=fbpoptshtml
;
2557 document
.getElementById('content').appendChild(optsdiv
);
2558 document
.getElementById('fbpsavesettings').addEventListener('click',fbpsavesettings
,false);
2560 document
.getElementById('exportsettingslink').addEventListener('click',exportsettingsbasic
,false);
2561 document
.getElementById('importsettingslink').addEventListener('click',importsettingsbasic
,false);
2563 document
.getElementById('custextheader').addEventListener('click',hideotherdivs
,false);
2564 document
.getElementById('appwhitelistheader').addEventListener('click',hideotherdivs
,false);
2565 document
.getElementById('custcssheader').addEventListener('click',hideotherdivs
,false);
2568 //fbpgetprefs(); // is this call really neccessary? opts obj should already be populated, though perhaps opts have changed in another tab/window
2570 document
.getElementById('fbpoptsdiv').style
.display
='block';
2571 // get latest fbp news
2572 //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
2576 getfbpnews=function() {
2577 //var FBP_FEED = "https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=5&q=http://feeds.feedburner.com/FacebookPurity";
2578 var FBP_FEED
= "www.facebook.com/feeds/page.php?id=408502197558&format=json";
2579 // set a callback function
2580 // 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
2581 var FBP_FEED_URL
= window
.location
.protocol
+"\/\/" + FBP_FEED
; //
2582 var fbpnewsdiv
=document
.getElementById('fbpnewsdiv');
2583 fbpnewsdiv
.style
.marginLeft
='4px';
2584 fbpnewsdiv
.style
.marginTop
='4px';
2585 if(fbpnewsdiv
.innerHTML
.length
)
2587 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>';
2589 //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>';
2591 var http
= new window
.XMLHttpRequest();
2592 http
.open("GET", FBP_FEED_URL
, true);
2593 //http.setRequestHeader("Connection", "close");
2594 http
.onreadystatechange = function() {
2595 if(http
.readyState
== 4 && http
.status
== 200) {
2597 var fbpfeed
= JSON
.parse(http
.responseText
);
2600 fbpnewsdiv
.innerHTML
+='Error : Cant get the news. This can occur if you are logged in to FB as a page Admin.' ;
2604 if(fbpfeed
.entries
.length
<4)
2605 feedlength
=fbpfeed
.entries
.length
;
2609 var newsul
=document
.createElement('ul');
2610 newsul
.style
.marginTop
='3px';
2611 newsul
.style
.marginLeft
='5px';
2612 var newsli
= document
.createElement('li');
2613 for(i
=0;i
<feedlength
;i
++) {
2614 if (!fbpfeed
.entries
[i
].title
.replace(/^\ /,'').length
) // deal with stupid facebook bug (pics + polls in the json feed dont have titles)
2616 x
=new Date (fbpfeed
.entries
[i
].published
);
2617 newsli
= document
.createElement('li');
2618 newsli
.style
.marginBottom
="2px";
2619 newsli
.style
.listStyleType
="disc";
2620 newsa
= document
.createElement('a');
2621 newsa
.setAttribute('title', "Published - " + x
.toLocaleDateString());
2622 newsa
.setAttribute('target', "_blank");
2623 newsa
.setAttribute('href', fbpfeed
.entries
[i
].alternate
);
2624 newsa
.appendChild(document
.createTextNode(fbpfeed
.entries
[i
].title
.replace(/'/g,"'").replace(/"/g,'"')));
2625 newsli
.appendChild(newsa
);
2626 newsul
.appendChild(newsli
);
2628 fbpnewsdiv
.appendChild(newsul
);
2629 http
=fbpfeed
=newsul
=newsli
=newsa
=null;
2633 } // END getfbpnews function
2636 Commented out because code wont work with latest chrome, unless we update to manifest v2
2638 function jsoncallbackwrapper() {
2640 publishjsonnews=function(json) {
2642 var fbpnewsdiv=document.getElementById('fbpnewsdiv');
2644 if(fbpnewsdiv.innerHTML.length)
2646 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>';
2647 if(!json.responseData.feed.entries.length){
2648 fbpnewsdiv.innerHTML+='Error : Cant get the news.' ;
2651 //console.log(json.responseData);
2652 fbpfeed=json.responseData.feed;
2653 var newsul=document.createElement('ul');
2654 newsul.style.marginTop='3px';
2655 newsul.style.marginLeft='5px';
2656 var newsli = document.createElement('li');
2657 for(var i=0;i<4;i++) {
2658 x =new Date (fbpfeed.entries[i].publishedDate);
2659 newsli = document.createElement('li');
2660 newsli.style.marginBottom="2px";
2661 newsli.style.listStyleType="disc";
2662 newsa = document.createElement('a');
2663 newsa.setAttribute('title', "Published - " + x.toLocaleDateString());
2664 newsa.setAttribute('target', "_blank");
2665 newsa.setAttribute('href', fbpfeed.entries[i].link);
2666 newsa.appendChild(document.createTextNode(fbpfeed.entries[i].title.replace(/'/,"'")));
2667 newsli.appendChild(newsa);
2668 newsul.appendChild(newsli);
2671 fbpnewsdiv.appendChild(newsul);
2672 fbpfeed=newsul=newsli=newsa=null;
2673 //document.getElementsByTagName('body')[0].appendChild(fbpnewsdiv);
2674 } // END publishjsonnews function
2676 } // END jsoncallbackwrapper
2678 // BEGIN inject code inside jsoncallbackwrapper function into fb page
2679 var script = document.createElement('script');
2680 script.appendChild(document.createTextNode('('+ jsoncallbackwrapper +')();'));
2682 (document.head || document.body || document.documentElement).appendChild(script);
2685 ;//console.log(e , location.href);
2687 // END inject jsoncallbackwrapper code into fb page
2689 function grabjsonfeed(url){
2691 var script=document.createElement('script');
2693 script.type="text/javascript";
2694 if(document.getElementsByTagName('head').length)
2695 document.getElementsByTagName('head')[0].appendChild(script);
2699 function fixarticleredirects (node
) {
2701 //console.log('fixarticleredriects');
2702 var xtmp
=node
.getElementsByTagName('a');
2703 //console.log(node.textContent + xtmp.length);
2704 for (var i
=0;i
<xtmp
.length
;i
++)
2705 if(xtmp
[i
].getAttribute('href')){
2706 //console.log(xtmp[i].getAttribute('href'));
2707 if(xtmp
[i
].getAttribute('href').match(/redirect_uri=(.*)\&/)) { // matches independent and yahoo
2708 //console.log('indep yahoo' + xtmp[i].getAttribute('href'));
2709 xtmp
[i
].setAttribute('href', decodeURIComponent(xtmp
[i
].getAttribute('href').match(/redirect_uri=(.*?)\&/)[1].split(/fb_action_ids/)[0]));
2710 xtmp
[i
].setAttribute('rel','');
2711 xtmp
[i
].setAttribute('mousedown','');
2713 else if (xtmp
[i
].getAttribute('href').match(/https?\:\/\/www\.guardian\.co\.uk/)) {
2714 xtmp
[i
].setAttribute('href',decodeURIComponent(xtmp
[i
].getAttribute('href').match(/(https?\:\/\/www\.guardian\.co\.uk.*?)\?fb_action_ids/)[1]));
2715 //console.log(decodeURIComponent(xtmp[i].getAttribute('href').match(/(http\:\/\/www\.guardian\.co\.uk.*?)\?fb_action_ids/)[1]));
2716 xtmp
[i
].setAttribute('rel','');
2717 xtmp
[i
].setAttribute('onmousedown','');
2719 else if (xtmp
[i
].getAttribute('href').match(/https?\:\/\/www\.facebook\.com\/l\.php\?u=/)) {
2720 xtmp
[i
].setAttribute('href',decodeURIComponent(xtmp
[i
].getAttribute('href').match(/http\:\/\/www\.facebook\.com\/l\.php\?u=(.*)\%3Ffb_action_ids/)[1]));
2721 //console.log(xtmp[i].getAttribute('href'));
2722 xtmp
[i
].setAttribute('rel','');
2723 xtmp
[i
].setAttribute('onmousedown','');
2725 else if(xtmp
[i
].getAttribute('href').match(/https?\:\/\/apps\.facebook\.com/)){
2726 if(xtmp
[i
].textContent
.length
){ // && xtmp[i].parentNode.getAttribute('class').match(/ogAggregationAnimSubstorySlideHeadline/)
2727 xtmp
[i
].setAttribute('href', 'http://google.com/search?q=' + encodeURIComponent("'" + xtmp
[i
].textContent
+ "'") + "&btnI=I'm+Feeling+Lucky");
2728 xtmp
[i
].setAttribute('rel','');
2729 xtmp
[i
].setAttribute('mousedown','');
2734 // console.log(xtmp[i].getAttribute('href'));
2738 ;//console.log('feckit! ' + e );
2742 function filtermatchmsg(mnode
, msg
) {
2743 if(mnode
.getElementsByClassName('filtermatchtext').length
)
2744 mnode
.getElementsByClassName('filtermatchtext')[0].textContent
=msg
;
2746 var matchspan
=document
.createElement('div');
2747 matchspan
.setAttribute('class','filtermatchtext');
2748 matchspan
.style
.color
='grey';
2749 matchspan
.appendChild(document
.createElement('br'));
2750 matchspan
.appendChild(document
.createTextNode(msg
));
2751 mnode
.appendChild(matchspan
);
2755 function cleartheshizzle(thenode
) {
2756 //unsafeWindow.console.log('clearing the shizzle a : ' + location.href);
2757 var oldfeedstyle
=document
.getElementById('pagelet_home_stream');
2758 var newfeedstyle
=document
.getElementById('pagelet_litestand_section');
2759 var neweststyle
= document
.getElementById('stream_pagelet');
2760 //if(!oldfeedstyle && (!newfeedstyle) && (!neweststyle))
2761 if(!(oldfeedstyle
|| newfeedstyle
|| neweststyle
)) {
2762 console
.log('FBP Error: couldnt find the news stream');
2765 //if(!document.getElementById('pagelet_home_stream') || (!document.getElementById('pagelet_litestand_section')))
2768 if(!document
.getElementById('fbpblockcount')) {
2770 crappyappmsgcounter
=0;
2771 fbpstyle
.textContent
=fbpStyleNormal
;
2773 if(document
.getElementById('pagelet_fl_composer')) // friends list page
2774 var insertpoint
= document
.getElementById('pagelet_fl_composer');
2775 else if (document
.getElementById('profile_stream_composer')) //profile page or fanpage
2776 var insertpoint
= document
.getElementById('profile_stream_composer');
2777 else if (document
.getElementById('pagelet_composer')) //homepage
2778 var insertpoint
= document
.getElementById('pagelet_composer');
2779 else if(document
.getElementById('timelineNavContent')) {
2781 var insertpoint
= document
.getElementById('timelineNavContent');
2783 else if(window
.location
.href
.match(/facebook\.com\/apps\/feed/) || window
.location
.href
.match(/facebook\.com\/pages\/feed/))
2784 var insertpoint
= document
.getElementById('contentArea');
2787 if(document
.getElementsByClassName('uiHeaderPage') && document
.getElementsByClassName('uiHeaderPage').length
)
2788 document
.getElementsByClassName('uiHeaderPage')[0].setAttribute('style','padding-bottom:5px');
2789 var fbpurityinfowrapper
=document
.createElement('div');
2791 fbpurityinfowrapper
.style
.marginTop
='-10px';
2792 fbpurityinfowrapper
.style
.marginBottom
='2px';
2793 fbpurityinfowrapper
.setAttribute('id','fbpurityinfowrapper');
2794 if(document
.getElementById('boulder_fixed_header'))
2795 document
.getElementById('boulder_fixed_header').firstChild
.style
.marginTop
='13px';
2796 var fbpurityinfo
=document
.createElement('div');
2797 fbpurityinfo
.setAttribute('id','fbpurityinfobar');
2798 var fbpclear
=document
.createElement('div');
2799 fbpclear
.style
.clear
='both';
2801 fbpurityinfo
.style
.cssFloat
='right';
2802 fbpurityinfo
.style
.background
='whitesmoke';
2803 fbpurityinfo
.innerHTML
='<span id="fbpupgradeinfo" style="color:red"></span> <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: <span id="fbpblockcount">0</span> <abbr title="Application + Game Stories">app</abbr> [ <a title="Show Application + Game Stories" id="fbpshowblockedlink" href="javascript:;">Show</a> ] <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> ] ';
2805 fbpurityinfowrapper
.appendChild(fbpurityinfo
);
2806 fbpurityinfowrapper
.appendChild(fbpclear
);
2808 if((document
.getElementById('pagelet_composer') || document
.getElementById('pagelet_fl_composer')) && (!document
.getElementById('fbpurityinfobar'))) // homepage // fanpage or // friends list page
2809 insertpoint
.parentNode
.insertBefore(fbpurityinfowrapper
, insertpoint
.nextSibling
); // after composer
2810 else if (document
.getElementById('profile_stream_composer') && (!document
.getElementById('fbpurityinfobar')))
2811 insertpoint
.parentNode
.insertBefore(fbpurityinfowrapper
, insertpoint
.nextSibling
);
2812 else if (document
.getElementById('timelineNavContent') && (!document
.getElementById('fbpurityinfobar'))) {
2813 fbpurityinfowrapper
.style
.display
='none'; // we not showing bar for now, as filtering doesnt work on timeline yet
2814 insertpoint
.appendChild(fbpurityinfowrapper
);
2816 else if(window
.location
.href
.match(/facebook\.com\/apps\/feed/) || window
.location
.href
.match(/facebook\.com\/pages\/feed/)) { // games feed page
2817 insertpoint
.insertBefore(fbpurityinfowrapper
, insertpoint
.firstChild
);
2820 document
.getElementById('fbpshowblockedlink').addEventListener("click", fbpshowblockedev
, false);
2821 document
.getElementById('fbpshowblockedxlink').addEventListener("click", fbpshowblockedxev
, false);
2822 document
.getElementById('fbpoptslink').addEventListener("click", fbptoggleopts
, false);
2824 fpbblockcountspan
=document
.getElementById('fbpblockcount');
2825 fpbblockxcountspan
=document
.getElementById('fbpblockxcount');
2831 //if we navigate away from the page then come back, the event listeners seem to disappear, so lets re-add them here.
2832 if( document
.getElementById('fbpshowblockedlink') ) {
2833 document
.getElementById('fbpshowblockedlink').removeEventListener("click", fbpshowblockedev
, false);
2834 document
.getElementById('fbpshowblockedlink').addEventListener("click", fbpshowblockedev
, false);
2836 if( document
.getElementById('fbpshowblockedxlink') ) {
2837 document
.getElementById('fbpshowblockedxlink').removeEventListener("click", fbpshowblockedxev
, false);
2838 document
.getElementById('fbpshowblockedxlink').addEventListener("click", fbpshowblockedxev
, false);
2840 if( document
.getElementById('fbpoptslink') ) {
2841 document
.getElementById('fbpoptslink').removeEventListener("click", fbptoggleopts
, false);
2842 document
.getElementById('fbpoptslink').addEventListener("click", fbptoggleopts
, false);
2845 // Deal with recent activity blocks
2847 if (thenode.getAttribute && thenode.getAttribute('class') && thenode.getAttribute('class').match(/uiStreamMinistoryGroup/)) {
2848 if(fbpoptsobj.recentactivity) {
2849 thenode.setAttribute('class',thenode.getAttribute('class') + ' fbpblockedx');
2850 updateblockedcount();
2854 thenode.setAttribute('class',thenode.getAttribute('class') + ' fbpnormal');
2858 else if(thenode.getElementsByClassName('uiStreamMinistoryGroup').length) {
2859 var rablocks=thenode.getElementsByClassName('uiStreamMinistoryGroup');
2860 for(var rai=0;rai<rablocks.length;i++)
2861 if(fbpoptsobj.recentactivity) {
2862 rablocks[rai].setAttribute('class',rablocks[rai].getAttribute('class') + ' fbpblockedx');
2863 updateblockedcount();
2866 rablocks[rai].setAttribute('class',rablocks[rai].getAttribute('class') + ' fbpnormal');
2871 storyclass
="uiStreamStory";
2873 var storynodes
, singlestory
;
2876 storynodes
=thenode
.getElementsByClassName(storyclass
);
2878 if(thenode
.getAttribute
&& thenode
.getAttribute('class') && thenode
.getAttribute('class').match(storyclass
)) {
2879 storynodes
[0]=thenode
;
2883 //unsafeWindow.console.log('no generic: ' + thenode.getAttribute('class'));
2887 else { // new newsfeed design
2888 storynodes
=thenode
.querySelectorAll("div[data-dedupekey]");
2890 if(thenode
.getAttribute
&& thenode
.getAttribute('data-dedupekey')) {
2891 storynodes
[0]=thenode
;
2895 //unsafeWindow.console.log('no generic: ' + thenode.getAttribute('class'));
2900 var blockit
, blockitx
;
2901 var story_meta
, fbpAppId
; // story_type,
2902 var attribappid
, attribnode
, fbpAppIdMatch
;
2903 var storysaction
, storysactiontext
;
2904 var actoria
, actorialink
, actoriadatacard
;
2905 var storyattachments
,storyattachment
;
2910 storynodeslength
=storynodes
.length
;
2913 for(i
=0;i
<storynodeslength
;i
++) {
2915 if(storynodes
[i
].nodeName
=='DIV') //deal with anomalous div that has classname pvm
2917 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'))))
2923 //console.log(storynodes[i].textContent);
2925 //parse the story's header for the story type and check the header for any matches
2927 storysaction
=storynodes
[i
].getElementsByClassName('uiStreamMessage');
2929 storysaction
=storynodes
[i
].getElementsByTagName('h5');
2930 if(storysaction
&& storysaction
.length
) {
2931 //unsafeWindow.console.log(storysaction + storysaction.length + storysaction[0].textContent);
2932 storysactiontext
=storysaction
[0].textContent
;
2936 storysactiontext
='';
2938 storysactiontext
=storynodes
[i
].textContent
;
2940 if(typeof storysactiontext
=='undefined')
2941 storysactiontext
='';
2944 console
.log(storysactiontext
);
2945 storyattachments
=storynodes
[i
].getElementsByClassName('uiStreamAttachments');
2946 story_meta
=storynodes
[i
].getAttribute('data-ft');
2947 if(story_meta
==null) {
2949 if(storynodes[i].getElementsByClassName('fss').length) { // check for Recent Activity Blocks
2950 // need to check fbpopts for whether to treat as extra
2951 if(fbpoptsobj.recentactivity==1)
2952 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+ ' fbpblockedx');
2954 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+ ' fbpnormal');
2955 updateblockedcount();
2959 if(storynodes
[i
].className
.match(/uiFacepile|uiListHorizontal|uiListVerticalItemBorder/)) { // deals with new feature of friends list pages
2965 // sponsored stories filter
2966 if(fbpoptsobj
.sponsoredbox
&& story_meta
&& story_meta
.match(/"ei"/)) {
2967 storynodes
[i
].style
.display
='none';//backgroundColor='red';
2970 // "play with friends" story filter
2971 if(fbpoptsobj
.filterappmessages
&& storynodes
[i
].getAttribute('class').match(/aid_140332009231/)) {
2972 storynodes
[i
].style
.display
='none'; //.style.backgroundColor='red';
2976 // experimental swearing filter (seems a bit memory intensive..)
2980 storynodes[i].innerHTML=storynodes[i].innerHTML.split(/cunt|shit|piss|fuck|wank|arse|tits|cocksucker/).join("****");
2986 ufooter=storynodes[i].getElementsByClassName('uiStreamFooter');
2988 for(g=0;g<ufooter.length;g++)
2989 if(ufooter[g].textContent.match(/· Sponsored/)) {
2990 storynodes[i].style.display='none';
2992 console.log("Hid sponsored story\n\n" + storynodes[i].textContent);
3001 // 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,
3002 //if(fbpoptsobj.pagestory && (!document.getElementById('pagelet_pages_about'))) {
3003 //console.log(storynodes[i].innerHTML);
3004 actoria
=storynodes
[i
].getElementsByClassName('uiStreamMessage');
3005 if(actoria
.length
) {
3006 actorialink
=actoria
[0].getElementsByTagName('a')[0];
3007 if(typeof(actorialink
)!='undefined') {
3008 actoriadatacard
=actorialink
.getAttribute('data-hovercardx');
3009 if(!actoriadatacard
)
3010 actoriadatacard
=actorialink
.getAttribute('data-hovercard');
3012 if(actoriadatacard
) {
3013 if (actoriadatacard
.match(useridwhitelistRX
)) { // if its fbp or the current user
3014 storynodes
[i
].setAttribute('class',storynodes
[i
].getAttribute('class')+ ' fbpnormal');
3015 actoriadatcard
=null;
3020 else if(fbpoptsobj
.pagestory
&& (!document
.getElementById('pagelet_pages_about')) && actoriadatacard
.match(/page\.php/) && (!window
.location
.href
.match(/facebook.com\/(pages\/feed|lists\/)/))) {
3021 // if we are on the "page feed" or interest list leave it alone
3022 //if(actoriadatacard.match(/page\.php/) && (!actoriadatacard.match(/id=408502197558/))) {
3023 //its a page and its not fbp;
3024 storynodes
[i
].setAttribute('class',storynodes
[i
].getAttribute('class')+ ' fbpblockedx');
3025 filtermatchmsg(storynodes
[i
],'FBP : Story Type Filter Match - Fan Page Story');
3026 updateblockedcount();
3027 actoriadatcard
=null;
3032 actoriadatacard
=null;
3037 // end fan page story filter
3039 //unsafeWindow.console.log('"'+storysactiontext+'"' + ' ' + headerTextFilter);
3040 // lets check the header text filter
3041 if((fbpoptsobj
.fixarticleredirects
&& storysactiontext
.length
&& storysactiontext
.match(/ article
/)) || storynodes
[i
].getElementsByClassName('ogAggregationSubstory').length
|| storynodes
[i
].getElementsByClassName('ogStaticSlidePager').length
|| storynodes
[i
].getElementsByClassName('ogSliderAnimPager').length
) {
3042 fixarticleredirects(storynodes
[i
]);
3045 if(storysactiontext
.length
&& headerTextFilter
.length
&& storysactiontext
.match(headertextfilterRX
)) {
3046 storynodes
[i
].setAttribute('class',storynodes
[i
].getAttribute('class')+' fbpblockedx');
3047 //matchspan=document.createElement('div');
3048 //matchspan.style.color='grey';
3049 matchedtext
=storysactiontext
.match(headertextfilterRX
)[0];
3050 filtermatchmsg(storynodes
[i
],' FBP : Story Type Filter Match - ' + matchedtext
);
3051 //if(matchedtext.match(/ article/))
3052 // fixarticleredirects(storynodes[i]);
3053 storysactiontext
=matchedtext
='';
3054 updateblockedcount();
3058 // lets check the text filter
3059 if(cleancustomtextfilter
.length
&& storynodes
[i
].textContent
.length
&& storynodes
[i
].textContent
.match(textfilterRX
)) {
3060 //window.console.log(storynodes[i].textContent)
3061 storynodes
[i
].setAttribute('class',storynodes
[i
].getAttribute('class')+' fbpblockedx');
3062 filtermatchmsg(storynodes
[i
],' FBP : Custom Text Filter Match - ' + storynodes
[i
].textContent
.match(textfilterRX
)[0]);
3063 updateblockedcount();
3067 // if hide all photos option has specifically been ticked
3068 //if(fbpoptsobj.sharedphoto && fbpoptsobj.uploadedphoto && fbpoptsobj.taggedlikescommentphoto && fbpoptsobj.taggedalbum)
3069 if((typeof fbpoptsobj
.hideallphotos
!=='undefined') && fbpoptsobj
.hideallphotos
)
3070 if(!window
.location
.href
.match(/facebook\.com\/\?sk=app_2305272732_2392950137/))
3071 if(storynodes
[i
].getElementsByClassName('photoRedesign').length
) {
3072 storynodes
[i
].setAttribute('class',storynodes
[i
].getAttribute('class')+' fbpblockedx');
3073 filtermatchmsg(storynodes
[i
],' FBP : Story Type Filter Match - Hide All Photos');
3074 updateblockedcount();
3078 if((typeof fbpoptsobj
.hideallvideos
!=='undefined') && fbpoptsobj
.hideallvideos
) {
3079 //if(!window.location.href.match(/facebook\.com\/\?sk=app_2305272732_2392950137/))
3080 if(storynodes
[i
].getElementsByClassName('uiVideoThumb').length
) {
3081 storynodes
[i
].setAttribute('class',storynodes
[i
].getAttribute('class')+' fbpblockedx');
3082 filtermatchmsg(storynodes
[i
],' FBP : Story Type Filter Match - Hide All Videos');
3083 updateblockedcount();
3087 else if ((typeof fbpoptsobj
.sharedvideo
!=='undefined') &&fbpoptsobj
.sharedvideo
){
3088 var svid
=storynodes
[i
].getElementsByClassName('shareMediaVideo');
3090 if(svid
[0].getAttribute('href') && svid
[0].getAttribute('href').match(/facebook\.com\/video\/video\.php/)) {
3091 storynodes
[i
].setAttribute('class',storynodes
[i
].getAttribute('class')+' fbpblockedx');
3092 filtermatchmsg(storynodes
[i
],' FBP : Story Type Filter Match - Hide Shared Video');
3093 updateblockedcount();
3099 // probably could get rid of this bracket... (it used to be part of a big if/else statement
3101 // so far it looks like a normal story, but lets check if its been posted by an application
3102 //unsafeWindow.console.log("normal?:" + storynodes[i].getElementsByClassName('uiStreamSource')[0].textContent);
3105 // these 3 blocks of code need to be refactored
3106 attribnode
=storynodes
[i
].getElementsByClassName('UIIntentionalStory_BottomAttribution');
3107 if(attribnode
&& attribnode
.length
) {
3108 attribnode
=attribnode
[0];
3109 if(attribnode
.innerHTML
.match(/\?id=(\d+)\"/)) {
3110 attribappid
=attribnode
.innerHTML
.match(/\?id=(\d+)\"/)[1];
3112 if(!arrwhitelist2
[attribappid
])
3113 blockit
=1; // its not in the whitelist so block it
3118 attribnode2
=storynodes
[i
].getElementsByClassName('GenericStory_BottomAttribution');
3119 if(attribnode2
&& attribnode2
.length
) { // GenericStory
3120 attribnode2
=attribnode2
[0];
3121 if (attribnode2
.innerHTML
.match(/id=(\d+)/)) {
3122 attribappid
=attribnode2
.innerHTML
.match(/id=(\d+)/)[1];
3124 if(!arrwhitelist2
[attribappid
])
3125 blockit
=1; // its not in the whitelist so block it
3130 attribnode3
=storynodes
[i
].getElementsByClassName('uiStreamSource');
3131 if(attribnode3
&& attribnode3
.length
) {
3132 attribnode3
=attribnode3
[0];
3133 if (attribnode3
.innerHTML
.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)) {
3134 if(typeof attribnode3
.innerHTML
.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)[1] !='undefined')
3135 attribappid
=attribnode3
.innerHTML
.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)[1];
3136 else if (typeof attribnode3
.innerHTML
.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)[2] !='undefined')
3137 attribappid
=attribnode3
.innerHTML
.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)[2];
3139 if(!arrwhitelist2
[attribappid
])
3140 blockit
=1; // its not in the whitelist so block it
3145 attribnode4
=storynodes
[i
].getElementsByClassName('UIActionLinks_bottom');
3146 if(attribnode4
&& attribnode4
.length
) {
3147 attribnode4
=attribnode4
[0];
3148 if (attribnode4
.innerHTML
.match(/application.php\?id=(\d+)/)) {
3149 attribappid
=attribnode4
.innerHTML
.match(/application.php\?id=(\d+)/)[1];
3151 if(!arrwhitelist2
[attribappid
])
3152 blockit
=1; // its not in the whitelist so block it
3156 // new app checks for fb actions / frictionless sharing apps
3158 if(storysaction
&& storysaction
.length
) {
3159 attribappid
=storysaction
[0].innerHTML
.match(/\/hovercard\/application\.php\?id\=(\d*)/);
3161 if(!arrwhitelist2
[attribappid
[1]]) {
3162 blockit
=1; // its not in the whitelist so block it
3163 sua
=1; // sua = started using app?
3167 if(storynodes
[i
].getAttribute('data-gt')) {
3168 //"appid":"163114453728333"
3169 if(storynodes
[i
].getAttribute('data-gt').match(/\"appid\":\"\d+\"/)) {
3170 attribappid
=storynodes
[i
].getAttribute('data-gt').match(/\"appid\":\"(\d+)\"/)[1];
3171 if(!arrwhitelist2
[attribappid
]) {
3172 blockit
=1; // its not in the whitelist so block it
3173 sua
=1; // sua = started using app?
3181 // mark app as blocked
3182 storynodes
[i
].setAttribute('class',storynodes
[i
].getAttribute('class')+ filterapptext
);
3184 dspBlockLink(storynodes
[i
],"sua");
3186 dspBlockLink(storynodes
[i
]);
3189 //its probably a "normal" story node but lets check for attachments (photos or links)
3190 //if ((fbpoptsobj.postedlink || fbpoptsobj.sharedphoto) && (!storynodes[i].getAttribute('class').match(/fbp/)) && storyattachments.length ) {
3191 if (fbpoptsobj
.postedlink
&& (!storynodes
[i
].getAttribute('class').match(/fbp/)) && storyattachments
.length
) {
3192 storyattachment
=storyattachments
[0];
3193 storylinks
=storyattachment
.getElementsByTagName('a');
3194 if(storylinks
.length
) {
3195 storylink
=storylinks
[0];
3196 if (fbpoptsobj
.postedlink
&& storylink
.getAttribute('onclick') && storylink
.getAttribute('onclick').match(/^LinkshimAsync/)) {
3197 //its an external link
3198 storynodes
[i
].setAttribute('class',storynodes
[i
].getAttribute('class')+' fbpblockedx');
3199 //unsafeWindow.console.log("postedlink= " +fbpoptsobj.postedlink);
3200 //storynodes[i].appendChild(filtermatchmsg(' FBP : Story Type Filter - Shared a link'));
3201 filtermatchmsg(storynodes
[i
],' FBP : Story Type Filter - Shared a link');
3203 /*else if (fbpoptsobj.sharedphoto && storynodes[i].getElementsByClassName('uiPhotoThumb').length) // should we also check for uiMediaThumb ???
3204 // its a shared photo
3205 storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');*/
3207 storynodes
[i
].setAttribute('class',storynodes
[i
].getAttribute('class')+' fbpnormal');
3211 storynodes
[i
].setAttribute('class',storynodes
[i
].getAttribute('class')+' fbpnormal');
3213 //else if(storyattachment.getElementsByClassName('uiVideoThumb').length)
3214 //unsafeWindow.console.log(storyattachment.textContent);
3215 //check for attachments
3216 storyattachments
={};
3217 storyattachment
=null;
3220 storynodes
[i
].setAttribute('class',storynodes
[i
].getAttribute('class')+' fbpnormal');
3222 // check for wall posts
3223 if(fbpoptsobj
.commentwall
&& (typeof(storynodes
[i
])!='undefined') && storynodes
[i
].getAttribute
&& storynodes
[i
].getAttribute('class').match(/fbpnormal/)) {
3224 var wallarrows
=storynodes
[i
].getElementsByClassName('wallArrowIcon');
3225 if(wallarrows
.length
) {
3226 storynodes
[i
].setAttribute('class',storynodes
[i
].getAttribute('class').replace('fbpnormal','') + ' fbpblockedx');
3227 //storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
3228 //storynodes[i].appendChild(filtermatchmsg(' FBP : Story Type Filter Match - Commented on Wall'));
3229 filtermatchmsg(storynodes
[i
],' FBP : Story Type Filter Match - Wrote on Wall');
3234 updateblockedcount();
3236 } // End For Loop through feed nodes
3240 }// END cleartheshizzle function
3243 ///////////////////////////////////////
3244 // BEGIN BRING BACK NORMAL COMMENTING
3245 ///////////////////////////////////////
3246 bringbacknormalcommenting = function() {
3248 console
.log('inside bring back normal commenting function');
3250 if(typeof(window
.navigator
.vendor
)!='undefined') //fix the stupid comment box growing too much in safari and chrome
3251 if(window
.navigator
.userAgent
.match(/Safari/)) //Apple Computer
3252 //if(window.navigator.userAgent.match(/AppleWebKit/))
3253 if(document
.getElementById('fbpfreestyler'))
3254 document
.getElementById('fbpfreestyler').textContent
+= ' textarea.uiTextareaAutogrow {max-height:250px !important}'
3256 fbptasubmit = function (e
) {
3257 //console.log(e.target.getAttribute('id'));
3258 //var fbpcta=document.getElementById('x' + e.target.getAttribute('id').split(/butt/)[0]);
3259 var fbpcta
=document
.querySelector("textarea[data-x-reactid=\""+ e
.target
.getAttribute('id').split(/butt/)[0] + "\"]"); // getElementById('x' + e.target.getAttribute('id').split(/butt/)[0]);
3262 //fbpcta.setAttribute('id',fbpcta.getAttribute('id').split(/x/)[1]);
3263 fbpcta
.setAttribute('data-reactid',fbpcta
.getAttribute('data-x-reactid'));
3265 e
.target
.value
="Now press 'Enter' to submit your comment";
3266 //e.target.parentNode.style.left="95px"; // width is wrong for photo comments
3268 //if(window.navigator.userAgent.match(/Opera/))
3269 // e.target.removeListener('click',fbtasubmit)
3271 e
.target
.disabled
=true;
3272 if(window
.navigator
.userAgent
.match(/Opera/))
3273 e
.target
.style
.backgroundColor
='red !important';
3275 while(xnode
.parentNode
) {
3276 if(xnode
.parentNode
.nodeName
=="FORM") {
3277 //xnode.parentNode.submit();
3278 //window.Event.__inlineSubmit(xnode.parentNode);
3281 xnode
=xnode
.parentNode
3285 if (fbpoptsobj
.commentbutton
) { // when editing a comment, if first key pressed is enter, the text is submitted, if not then it works ok.
3287 console
.log('bring back normal commenting function is ENABLED');
3288 window
.addEventListener('keydown', function(event
) {
3289 if (event
.target
.tagName
&& (event
.target
.tagName
=="TEXTAREA")) {
3290 if(event
.target
.getAttribute('class')) {
3291 event
.target
.setAttribute('class',event
.target
.getAttribute('class').replace(/enter_submit/,''));
3293 if(event
.target
.getAttribute('data-reactid')) { // && event.target.getAttribute('id').match(/^\.reactRoot/)
3294 event
.target
.setAttribute('data-x-reactid',event
.target
.getAttribute('data-reactid'));
3295 event
.target
.setAttribute('data-reactid',''); //'x' + event.target.getAttribute('data-reactid'));
3296 var tmph
=event
.target
.parentNode
.parentNode
.parentNode
.getElementsByClassName('monglab');
3298 tmph
[0].getElementsByTagName('input')[0].value
='Comment';
3299 //tmph[0].getElementsByTagName('input')[0].parentNode.style.left="250px";
3300 if(window
.navigator
.userAgent
.match(/Opera/))
3301 tmph
[0].getElementsByTagName('input')[0].style
.backgroundColor
="#5B74A8";
3302 tmph
[0].getElementsByTagName('input')[0].disabled
=false;
3303 // tmph[0].addEventListener('click',fbptasubmit,false);
3305 // tmph[0].getElementsByTagName('input')[0].disabled=false;
3308 monglab
=document
.createElement('label');
3309 //monglab.setAttribute('style','float:right');
3310 monglab
.setAttribute('class','monglab mts commentBtn stat_elem optimistic_submit uiButton uiButtonConfirm');
3311 monglab
.setAttribute('style','');//position:relative;left:250px // width is wrong for photo comments
3312 monglab
.innerHTML
='<input value="Comment" class="enter_submit_target" name="comment" type="button" id="' + event
.target
.getAttribute('data-x-reactid') + 'butt' + '">';
3313 monglab
.addEventListener('click',fbptasubmit
,false);
3314 event
.target
.parentNode
.parentNode
.parentNode
.appendChild(monglab
);
3320 if (document
.getElementById('fbpfreestyler'))
3321 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}';
3323 bringbackcommentbuttons=function () {
3324 //deal with the ticker flyout comment boxes
3325 var plops
=document
.getElementsByClassName('uiContextualDialogPositioner');
3327 for(var i
=0;i
<plops
.length
;i
++) {
3328 combutts2
=plops
[i
].getElementsByClassName('optimistic_submit');
3329 if(combutts2
.length
)
3330 combutts2
[0].setAttribute('style','display:block !important');
3332 //deal with birthday flyout comment boxes and groups new member boxes
3333 var remconts
=document
.getElementsByClassName('fbRemindersContent');
3334 if(remconts
.length
) {
3335 for(var m
=0;m
<remconts
.length
;m
++) {
3336 plops
=remconts
[m
].getElementsByClassName('pam');
3337 var combutts3
,comta
;
3338 for(i
=0;i
<plops
.length
;i
++) {
3339 combutts3
=plops
[i
].getElementsByClassName('hidden_elem');
3340 for(j
=combutts3
.length
-1;j
>=0;j
--)
3341 if(!combutts3
[j
].getAttribute('class').match(/highlighterContent/) && (combutts3
[j
].nodeName
!='DIV'))
3342 combutts3
[j
].setAttribute('class','uiButton uiButtonConfirm');
3343 comta
=plops
[i
].getElementsByClassName('enter_submit');
3344 for(l
=comta
.length
-1;l
>=0;l
--)
3345 comta
[l
].setAttribute('class',comta
[l
].getAttribute('class').replace('enter_submit',''));
3350 // deal with birthdays box in newsfeed itself
3351 var blobuts
=document
.querySelectorAll('.-cx-PRIVATE-fbGiftTodayBirthdays__list label.hidden_elem');
3353 for(m
=0;m
<blobuts
.length
;m
++)
3354 blobuts
[m
].setAttribute('class','uiButton uiButtonConfirm');
3356 plops
=remconts
=comta
=blobuts
=null;
3359 bringbackcommentbuttons();
3361 var waitfordom
=setInterval(function(){
3362 //clearInterval(waitfordom);
3363 bringbackcommentbuttons();
3366 } // END IF hide button option has not been selected
3369 console
.log('bring back normal commenting function is NOT ENABLED');
3370 /////////////////////////////////////
3371 // END BRING BACK NORMAL COMMENTING
3372 /////////////////////////////////////
3373 } // end bringbacknormalcommenting function
3375 function fixexternallinkredirects() {
3376 // fix external link redirects
3377 window
.setTimeout(function() {UntrustedLink
=null;LinkshimAsyncLink
.referrer_log
= LinkshimAsyncLink
.swap
= search_logged_ajax=function(){;};},0);
3378 window
.setTimeout(function() {UntrustedLink
=null;LinkshimAsyncLink
.referrer_log
= LinkshimAsyncLink
.swap
= search_logged_ajax=function(){;};},5000);
3379 window
.setInterval(function(){UntrustedLink
=null;LinkshimAsyncLink
.referrer_log
= LinkshimAsyncLink
.swap
= search_logged_ajax=function(){;};},60000);
3381 unmanglelinks = function(nodetofix
) {
3382 //console.log(typeof(nodetofix));
3383 if(typeof(nodetofix
)=='undefined')
3384 var nodetofix
=document
;
3385 if(nodetofix
.getElementsByTagName
) {
3386 var as
=nodetofix
.getElementsByTagName('a');
3387 for(var i
=0;i
<as
.length
;i
++)
3388 if(as
[i
].href
&& as
[i
].href
.match(/\/l\.php\?/)) {
3389 as
[i
].href
=decodeURIComponent(as
[i
].href
.match(/\/l\.php\?u=(.*)\&h=/)[1]);
3390 //console.log(decodeURIComponent(as[i].href));
3394 window
.setTimeout(unmanglelinks
,3000); // run on first load of page
3397 // new fix links code>
3398 //as=document.getElementsByTagName('a');for(i=0;i<as.length;i++)if(as[i].href.match(/\/l\.php/))console.log(as[i].href)
3401 // this function is duplicated, as it is also injected into the page's dom, so it can run from there too
3402 unmanglelinks = function(nodetofix
) {
3403 //console.log('unmanglelinks');
3404 if(typeof(nodetofix
)=='undefined')
3405 var nodetofix
=document
;
3406 if(nodetofix
.getElementsByTagName
) {
3407 var as
=nodetofix
.getElementsByTagName('a');
3408 for(var i
=0;i
<as
.length
;i
++) {
3409 //if(as[i].href.match(/l\.php/)) console.log((as[i].href));
3410 if(as
[i
].href
.match(/\/l\.php\?u=(.*)\&h=/)) {
3411 as
[i
].href
=decodeURIComponent(as
[i
].href
.match(/\/l\.php\?u=(.*)\&h=/)[1]);
3412 //console.log(decodeURIComponent(as[i].href));
3417 // END Duplicated function
3419 ////////////////////////////////////////////////////////////////
3420 // BEGIN FUNCTION deleterecentactivitymodule
3421 // function deleterecentactivitymodule is just a wrapper for the code, so we can inject it into the fb page
3422 function deleterecentactivitymodule () {
3424 /* BEGIN HISTORY STATE CHANGE HANDLER */
3426 var pushState
= history
.pushState
;
3427 history
.pushState = function(state
) {
3428 if (typeof history
.onpushstate
== "function") {
3429 history
.onpushstate({state: state
});
3431 // ... whatever else you want to do
3432 // maybe call onhashchange e.handler
3433 //console.log('history state changed:' + arguments[0]);
3434 // experiment to disable theatre mode
3435 //if(arguments[0].match(/\/photo\.php\?.*\&theater/))
3436 // location.href=arguments[0];
3438 /* facebook has now added an event delete button
3439 if(arguments[0].match(/\/events\//)) {
3440 setTimeout(deleventbutt,3000);
3444 if(arguments
[0].match(/\/appcenter\//)) {
3445 setTimeout(highlightemailrequest
,2500);
3448 //console.dir(arguments[0]);
3449 return pushState
.apply(window
.history
, arguments
);
3452 /* END HISTORY STATE CHANGE HANDLER*/
3455 // END FUNCTION deleterecentactivitymodule
3457 addexternallinkfix = function() {
3458 /////////////////////////////////////////////////////////////
3459 // BEGIN inject deleterecentactivitymodule code into fb page
3460 var scriptx
= document
.createElement('script');
3461 scriptx
.setAttribute('id','scriptx');
3462 if(fbpoptsobj
.fixarticleredirects
) // fix external link redirects
3463 scriptx
.appendChild(document
.createTextNode('('+ fixexternallinkredirects
+')();'));
3465 scriptx
.appendChild(document
.createTextNode('('+ deleterecentactivitymodule
+')();'));
3467 (document
.head
|| document
.body
|| document
.documentElement
).appendChild(scriptx
);
3468 // END inject deleterecentactivitymodule code into fb page
3469 ////////////////////////////////////////////////////////////////
3472 addblockbuttontopermreq = function() {
3473 buttbars
=document
.getElementsByClassName('platform_dialog_buttons');
3474 if(!buttbars
.length
)
3475 buttbars
=document
.getElementsByClassName('rightContent');
3476 if(buttbars
.length
) {
3477 buttbar
=buttbars
[0];
3478 //if(location.href.match(/client_id=/)
3479 //var bappid=window.location.href.match(/[client|app]_id=(\d*)/)[1];
3481 if(document
.getElementById('input_app_id'))
3482 bappid
=document
.getElementById('input_app_id').getAttribute('value');
3483 else if (document
.getElementsByClassName('legalese').length
) {
3484 var legas
=document
.getElementsByClassName('legalese')[0].getElementsByTagName('a');
3486 for(var v
=legas
.length
-1;v
>=0;v
--)
3487 if(legas
[v
].getAttribute('ajaxify').match(/cid=(\d+)/)) {
3488 bappid
=legas
[v
].getAttribute('ajaxify').match(/cid=(\d+)/)[1];
3493 var titleclass
=document
.getElementsByClassName('fsxl');
3494 if(titleclass
.length
)
3495 var bapname
=titleclass
[0].textContent
;
3497 if(document
.getElementById('permPanel'))
3498 bapname
=document
.getElementById('permPanel').getElementsByTagName('b')[0].textContent
;
3500 var bapname
="Application";
3502 blahlink=document.createElement('a');
3503 blahlink.setAttribute('ajaxify','/ajax/apps/block_app.php?app_id=' + bappid + '&type_index=0&source=about&confirm_id=block_app_link');
3504 blahlink.setAttribute('rel','dialog');
3505 blahlink.setAttribute('id','js_3');
3506 blahlink.style.marginLeft='4px';
3508 blahlab=document.createElement('label');
3509 blahlab.setAttribute('class','uiButton uiButtonConfirm uiButtonLarge');
3510 blahlab.setAttribute('id','blockapplab');
3511 blahlab.setAttribute('appid',bappid);
3512 blahlab.setAttribute('appname',bapname);
3513 blahlab.setAttribute('nodeid','platform_dialog_content'); //globalContainer
3514 //blahlab.setAttribute('style','position:absolute;top:-15px;left:520px');
3515 blahlab.setAttribute('title','Block this application with F.B. Purity');
3516 //blahlab.innerHTML='<input value="Block App" name="block" type="button" id="appblocker">';
3517 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>';
3518 blahlink.appendChild(blahlab);
3519 // new block code, get id of cancel_click button, and click it to close dialog
3520 //<div id="block_app_link"><a style="color:white" rel="dialog" ajaxify="/ajax/apps/block_app.php?app_id=182901371776451&type_index=0&source=about&confirm_id=block_app_link" href="#" id="js_3" class="">Block</a></div>
3522 buttbox=document.getElementsByClassName('rightContent');
3524 buttbox[0].appendChild(blahlink);
3526 buttbox2=document.getElementsByClassName('platform_dialog_buttons');
3528 buttbox2[0].appendChild(blahlink);
3532 /* BEGIN NEW / OLD CODE */
3533 /* ---------------------*/
3534 blahlab
=document
.createElement('label');
3535 blahlab
.setAttribute('class','uiButton uiButtonConfirm uiButtonLarge');
3536 blahlab
.setAttribute('id','blockapplab');
3537 blahlab
.setAttribute('appid',bappid
);
3538 blahlab
.setAttribute('appname',bapname
);
3539 blahlab
.setAttribute('nodeid','platform_dialog_content');//globalContainer
3540 if(!document
.getElementById('platform_dialog_content'))
3541 if(document
.getElementsByClassName('tosPane').length
)
3542 document
.getElementsByClassName('tosPane')[0].setAttribute('id','platform_dialog_content');
3544 //blahlab.setAttribute('style','position:absolute;top:-15px;left:520px');
3545 blahlab
.setAttribute('title','Block this application with F.B. Purity');
3546 blahlab
.innerHTML
='<input value="Block App" name="block" type="button" id="appblocker">';
3547 //document.getElementById('content').appendChild(blahlab);
3548 buttbox
=document
.getElementsByClassName('rightContent');
3550 buttbox
[0].appendChild(blahlab
);
3552 buttbox2
=document
.getElementsByClassName('platform_dialog_buttons');
3554 buttbox2
[0].appendChild(blahlab
);
3557 if(document
.getElementById('appblocker'))
3558 document
.getElementById('blockapplab').addEventListener('click',blockappev
,false);
3559 /* -------------------*/
3560 /* END NEW / OLD CODE */
3562 //if(document.getElementById('appblocker'))
3563 // document.getElementById('blockapplab').addEventListener('click',blockappev,false);
3565 //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
3566 // document.getElementById('block_app_link').addEventListener('click',function() { document.getElementById('cancel_clicked').click();},false);
3568 // if requesting permission to send direct emails, warn user by highlighting it
3569 highlightemailrequest();
3573 highlightemailrequest = function() {
3574 //console.log('did we get here?')
3575 // if a facebook application is requesting the users email address highlight it
3576 var appperms
=document
.getElementsByClassName('gdp_list_item');
3578 for(var i
=0;i
<appperms
.length
;i
++) {
3579 if(appperms
[i
].getElementsByClassName('send-email-change-link').length
)
3580 appperms
[i
].setAttribute('style', 'border:4px solid red');
3581 if(appperms
[i
].textContent
.match(/Post on my behalf
/))
3582 appperms
[i
].setAttribute('style', 'border:4px solid red');
3584 var emailperms
=document
.getElementsByTagName('input');
3585 if(emailperms
.length
)
3586 for(i
=0;i
<emailperms
.length
;i
++)
3587 if(emailperms
[i
].getAttribute('name')=='GdpEmailBucket_grantEmailType')
3588 emailperms
[i
].parentNode
.setAttribute('style', 'border:4px solid red');
3589 if(document
.getElementsByClassName
&& document
.getElementsByClassName('gdp_right_container').length
&& document
.getElementsByClassName('gdp_right_container')[0].getElementsByClassName('mbm').length
)
3590 document
.getElementsByClassName('gdp_right_container')[0].getElementsByClassName('mbm')[0].setAttribute('style','border:4px solid red; color:black !important'); // ( can post as you )
3591 if(document
.getElementsByClassName
&& document
.getElementsByClassName('permissionsPublishActionsBadge').length
)
3592 document
.getElementsByClassName('permissionsPublishActionsBadge')[0].setAttribute('style','border:4px solid red');
3593 if(document
.getElementsByClassName('tosPane').length
) {
3594 var tossas
=document
.getElementsByClassName('tosPane')[0].getElementsByTagName('a');
3595 for(i
=0;i
<tossas
.length
;i
++)
3596 if(tossas
[i
].getAttribute('href') && tossas
[i
].getAttribute('href').match(/about\/privacy\/your-info-on-other\#applications/)) {
3597 if(!tossas
[i
].parentNode
.textContent
.match(tossas
[i
].getAttribute('aria-label'))) {
3598 tossas
[i
].parentNode
.appendChild(document
.createTextNode(' - ' + tossas
[i
].getAttribute('aria-label') ));
3603 tossas
=appperms
=emailperms
=null;
3605 // test why the button doesnt show up sometimes...
3606 //console.log(location.href.match(/facebook\.com\/appcenter\//));
3607 //console.log(location.href.match(document.getElementsByClassName('mll').length));
3609 // add prominent block app button to app center app pages
3610 if(window
.location
.href
.match(/facebook\.com\/appcenter\//) && document
.getElementsByClassName('mll').length
) // if theres buttons {
3611 if(document
.getElementById('block_app_link') && !document
.getElementById('block_app_link2')) {
3612 var aja
=document
.getElementById('block_app_link').getElementsByTagName('a')[0].getAttribute('ajaxify');
3613 var ajatext
=document
.getElementById('block_app_link').getElementsByTagName('a')[0].textContent
;
3614 var ajalab
=document
.createElement('label');
3615 ajalab
.setAttribute('class','uiButton uiButtonConfirm uiButtonLarge');
3616 ajalab
.setAttribute('id','block_app_link2');
3617 ajalab
.setAttribute('title','Block this application with FB Purity');
3618 ajalab
.style
.color
='white';
3619 ajalab
.textContent
= ajatext
+ ' App';
3620 var ajalink
=document
.createElement('a');
3621 ajalink
.setAttribute('ajaxify',aja
.replace('block_app_link','block_app_link2'));
3622 ajalink
.setAttribute('href','#');
3623 ajalink
.setAttribute('rel','dialog-post');
3624 ajalink
.setAttribute('role','button');
3625 ajalink
.appendChild(ajalab
);
3626 document
.getElementsByClassName('mll')[0].setAttribute('class','mll');
3627 document
.getElementsByClassName('mll')[0].appendChild(document
.createTextNode(' '));
3628 document
.getElementsByClassName('mll')[0].appendChild(ajalink
);
3630 if(window
.location
.href
.match(/facebook\.com\/appcenter\//)) {
3631 // add BA (and eventually WL) links to all app listings in app center (this part is a work in progress/not completed yet)
3632 if(document
.getElementsByClassName('appsListHeader').length
) {
3633 topspan
=document
.createElement('span');
3634 topspan
.setAttribute('style','color:red;font-weight:bold;margin-left:10px')
3635 topspan
.setAttribute('id','block_app_link');
3636 document
.getElementsByClassName('appsListHeader')[0].appendChild(topspan
);
3637 var appslistparent
=document
.getElementsByClassName('apps_list');
3638 if(!appslistparent
.length
)
3640 var appslist
= appslistparent
[0].getElementsByClassName('uiListItem');
3641 if(!appslist
.length
)
3643 for(i
=0;i
<appslist
.length
;i
++) {
3644 tspan
=document
.createElement('div');
3645 tspan
.setAttribute('class','uiPopover appFeedbackMenu');
3646 tspan
.setAttribute('style','top:18px');
3647 appid
=appslist
[i
].getAttribute('data-gt').match(/appid":"(\d+)"/)[1]; //match(/appid\":\"(\d+)\"/)[1]
3648 tspan
.innerHTML
='<a title="Block Application" rel="dialog-post" ajaxify="/ajax/apps/block_app.php?app_id=' + appid
+ '&type_index=0&source=about&confirm_id=block_app_link" href="#" role="button">BA</a>';
3649 appslist
[i
].getElementsByClassName('appName')[0].appendChild(tspan
);
3654 //<div style="top:15px"></div>
3656 } // END highlightemailrequest function
3658 /*BEGIN Check if this page is an authorise app page so we can add a block button
3659 Example URLS https://www.facebook.com/connect/uiserver.php?app_id=216694208368074
3660 Scenarios: oauth page / request permissions page / app page
3662 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/))
3663 if(!window
.navigator
.userAgent
.match(/Opera\//))
3664 addblockbuttontopermreq();
3666 setTimeout(addblockbuttontopermreq
,2000); // pause because opera runs script b4 page has finished loading
3668 if(window
.location
.href
.match(/\/appcenter\//))
3669 setTimeout(highlightemailrequest
,2500);
3670 /* END Check if this page is an authorise app page so we can add a block button */
3672 /* BEGIN add a "block application" link at the bottom left hand corner of all application pages */
3673 function addblockapplinktoapppage() {
3674 if (window
.location
.href
.match(/\:\/\/apps\./)) {
3675 if(document
.getElementById('footerContainer')) {
3676 var footzer
=document
.getElementById('footerContainer');
3677 var footytxt
='footerContainer';
3680 var footzer
=document
.getElementById('pagelet_canvas_footer_content');
3681 var footytxt
='pagelet_canvas_footer_content';
3684 var fas
=footzer
.getElementsByTagName('a');
3685 for(var i
=0;i
<fas
.length
;i
++)
3686 if(fas
[i
].getAttribute('ajaxify') && fas
[i
].getAttribute('ajaxify').match(/\/ajax\/report\.php\?content_type=17/)) {
3687 zappid
=fas
[i
].getAttribute('ajaxify').match(/cid=(\d*)/)[1];
3688 zapplink
=document
.createElement('a');
3689 zapplink
.textContent
='Block Application ';
3690 zapptitle
=document
.getElementById(footytxt
).getElementsByTagName('span')[0].textContent
;
3691 zapplink
.setAttribute('appname',zapptitle
);
3692 zapplink
.setAttribute('appid',zappid
);
3693 zapplink
.setAttribute('nodeid','pagelet_canvas_content');
3694 zapplink
.setAttribute('id','zapplink');
3695 zapplink
.setAttribute('title','Block this application with F.B. Purity');
3696 zparent
=document
.getElementById(footytxt
).getElementsByClassName('fsm')[0];
3697 zparent
.insertBefore(zapplink
,zparent
.firstChild
);
3698 document
.getElementById('zapplink').addEventListener('click',blockappev
,false);
3704 window
.setTimeout(addblockapplinktoapppage
,3500);
3705 /* END Add a block application link at bottom left of all application pages */
3707 function toggletimeline(ev
) {
3708 var TLBUTT
=document
.getElementById('TLJewel');
3709 if (typeof(fbpoptsobj
.timelineonecol
)=='undefined')
3710 fbpoptsobj
.timelineonecol
=true;
3712 if(fbpoptsobj
.timelineonecol
==true)
3713 fbpoptsobj
.timelineonecol
=false;
3715 fbpoptsobj
.timelineonecol
=true;
3716 if(fbpoptsobj
.timelineonecol
==false) {
3717 document
.getElementById('FBTLX').style
.display
='none';
3718 var tdotxt
='F.B. Purity - Normal Facebook Timeline Layout Restored';
3719 TLBUTT
.setAttribute('title','');
3722 document
.getElementById('FBTLX').style
.display
='block';
3723 var tdotxt
='F.B. Purity - Single Column Timeline<br/>Layout Enabled';
3724 TLBUTT
.setAttribute('title','');
3726 if(!document
.getElementById('tdotxt')) {
3727 tdo
=document
.createElement('div');
3728 tdo
.setAttribute('id','tdotxt');
3729 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)
3730 document
.getElementById('TLJewel').appendChild(tdo
);
3733 tdo
=document
.getElementById('tdotxt');
3735 document
.getElementById('tdotxt').style
.display
='block';
3736 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
;
3737 window
.setTimeout(function(){document
.getElementById('tdotxt').style
.display
='none';TLBUTT
.setAttribute('title','F.B. Purity: Single Column Timeline Layout');},1700)
3739 //save to prefs obj to localstorage
3740 fbpsavevalue('fbpoptsjson-' + currentuserid
, JSON
.stringify(fbpoptsobj
));
3741 //window.location.reload();
3742 fbptimelinerestyle(fbpoptsobj
.timelineonecol
);
3743 } // END toggletimeline function
3745 function tlbuttinit() {
3746 // BEGIN add TL (single column timeline) button next to search box (now works on graph search bar too)
3747 if(fbpoptsobj
.timelineonecol
==true)
3751 var TLBUTTHTML
='<a id="TLINK" href="javascript:;" class="jewelButton" style="top:3px;max-height:25px;">'+
3752 '<div id="FBTL" style="position:absolute;top:0px;left:0px;background:transparent;font-size:22px !important;font-weight:bold;color:green">TL</div>'+
3753 '<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>';
3754 TLBUTT
=document
.createElement('div');
3755 TLBUTT
.setAttribute('class','lfloat fbJewel');
3756 TLBUTT
.setAttribute('id','TLJewel');
3757 TLBUTT
.setAttribute('title','F.B. Purity: Single Column Timeline Layout');
3759 window.setTimeout(function() {
3760 console.log('delayed??');
3761 if(document.querySelector('body.hasSmurfbar'))
3762 //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; '); //
3763 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; '); //
3765 //TLBUTT.setAttribute('style','top:0px;margin-left:3px;vertical-align:middle;font-size:20px;font-color:#173a85;font-weight:bold');
3766 document.getElementById('TLJewel').setAttribute('style','top:0px;margin-left:3px;vertical-align:middle;font-size:20px;font-color:#173a85;font-weight:bold');
3770 TLBUTT
.innerHTML
=TLBUTTHTML
;
3771 window
.setTimeout( function(){
3772 var datd
=document
.getElementById('navSearch');
3774 datd
=document
.querySelector('div[role="search"]');
3775 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'); //
3776 if(debug
) console
.log('no navsearch, so must be graph search?' + TLBUTT
);
3779 TLBUTT
.setAttribute('style','top:0px;margin-left:3px;vertical-align:middle;font-size:20px;font-color:#173a85;font-weight:bold;'); // left :0px !important'
3780 if(debug
) console
.log('oldschool navsearch' + TLBUTT
);
3782 if(datd
&& (!document
.getElementById('TLJewel'))) {
3783 datd
.parentNode
.insertBefore(TLBUTT
,datd
.nextSibling
);
3784 document
.getElementById('TLINK').addEventListener('click',toggletimeline
,false);
3786 //single column timeline
3787 if(fbpoptsobj
.timelineonecol
==1)
3788 fbptimelinerestyle(1);
3790 fbptimelinerestyle(0);
3792 // END add TL button next to search box
3795 function resetclasses () {
3797 var arrResetClasses
=['fbpnormal','fbpblockedx','fbpblocked'];
3798 for(a
in arrResetClasses
) {
3799 //console.log(arrResetClasses[a]);
3800 fbpn
=document
.getElementsByClassName(arrResetClasses
[a
]);
3801 for(i
=fbpn
.length
;i
>0;i
--) {
3803 fbpn
[i
-1].setAttribute('class',fbpn
[i
-1].getAttribute('class').replace(arrResetClasses
[a
],''));
3805 //console.log("fbpoptsobj.filterappmessages=" + fbpoptsobj.filterappmessages + " current arr length=" + document.getElementsByClassName(arrResetClasses[a]).length);
3809 function fbpurify() {
3813 var crappyappmsgcounter
=0;
3814 var xtramsgcounter
=0;
3815 fbpstyle
.setAttribute('id','fbpstyler');
3816 fbpstyle
.setAttribute('type','text/css');
3817 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}";
3818 if(document
.querySelector('body.hasSmurfbar'))
3819 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}";
3821 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}";
3822 fbpStyleNormal
= ".fbpblocked {display:none !important} .fbpblockedx {display:none !important} .fbpnormal {display:block !important}";
3823 fbpstyle
.textContent
=fbpStyleNormal
;
3826 if(document.getElementsByTagName('head')) {
3827 document.getElementsByTagName('head')[0].appendChild(fbpstyle);
3828 document.getElementsByTagName('head')[0].appendChild(fbpfreestyle);
3829 document.getElementsByTagName('head')[0].appendChild(fbpboxstyle);
3830 document.getElementsByTagName('head')[0].appendChild(fbpcssstyle);
3831 document.getElementsByTagName('head')[0].appendChild(fbptlstyle);
3835 document
.addEventListener("DOMNodeInserted", fpInsertedNodeDomHandler
, false);
3837 if(document
.getElementById('pagelet_home_stream') || document
.getElementById('pagelet_litestand_section') || document
.getElementById('stream_pagelet'))
3838 cleartheshizzle(document
);
3840 } // END fbpurify function
3843 var waitfordom1
=setInterval(function(){
3844 if(document
.getElementById('globalContainer')) {
3845 clearInterval(waitfordom1
);
3846 //if(window.navigator.userAgent.match(/Opera/))
3847 // fbpgetprefs(); // grab user prefs if available if not populate them with defaults
3849 //bringbacknormalcommenting(); moved these to finalstage function to ensure the prefs have already been read
3850 //window.setTimeout(addexternallinkfix,2000);
3851 //addexternallinkfix();
3855 // only run if DOM has loaded
3856 finalstage=function () {
3857 // we should check to see if fbpurify is already running...
3859 if(document
.getElementsByTagName('head').length
) {
3860 document
.getElementsByTagName('head')[0].appendChild(fbpstyle
);
3861 document
.getElementsByTagName('head')[0].appendChild(fbpfreestyle
);
3862 document
.getElementsByTagName('head')[0].appendChild(fbpboxstyle
);
3863 document
.getElementsByTagName('head')[0].appendChild(fbpcssstyle
);
3864 document
.getElementsByTagName('head')[0].appendChild(fbptlstyle
);
3866 //window.setTimeout(bringbacknormalcommenting,2000); // prefs werent being read in before running this, so i added a short delay
3867 bringbacknormalcommenting();
3868 //window.setTimeout(addexternallinkfix,2000);
3869 addexternallinkfix();
3870 tlbuttinit(); // initialise the timeline single column button
3873 var waitforhead
=setInterval(function(){
3874 if(document
.getElementsByTagName('head').length
) {
3875 document
.getElementsByTagName('head')[0].appendChild(fbpstyle
);
3876 document
.getElementsByTagName('head')[0].appendChild(fbpfreestyle
);
3877 document
.getElementsByTagName('head')[0].appendChild(fbpboxstyle
);
3878 document
.getElementsByTagName('head')[0].appendChild(fbpcssstyle
);
3879 document
.getElementsByTagName('head')[0].appendChild(fbptlstyle
);
3881 //window.setTimeout(bringbacknormalcommenting,2000); // prefs werent being read in before running this, so i added a short delay
3882 bringbacknormalcommenting();
3883 //window.setTimeout(addexternallinkfix,2000);
3884 addexternallinkfix();
3886 tlbuttinit(); // initialise the timeline single column button
3887 clearInterval(waitforhead
);
3893 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')
3897 var waitfordom
=setInterval(function(){
3898 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')
3899 clearInterval(waitfordom
);
3904 } // end finalstage function;
3906 //if(!window.navigator.userAgent.match(/Opera/))
3907 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.