+++ /dev/null
-// ==UserScript==
-// @name Facebook Purity
-// @namespace http://steeev.freehostia.com
-// @description F.B Purity hides application spam and other clutter from your facebook homepage
-// @icon http://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/373593_408502197558_209872631_q.jpg
-// @include http://*.facebook.com/*
-// @include https://*.facebook.com/*
-// @match http://*.facebook.com/*
-// @match https://*.facebook.com/*
-// @exclude http://*.facebook.com/ajax/*
-// @exclude https://*.facebook.com/ajax/*
-// @exclude http://*.facebook.com/ai.php*
-// @exclude https://*.facebook.com/ai.php*
-// @exclude http://*.channel.facebook.com/*
-// @exclude https://*.channel.facebook.com/*
-// @exclude http://*.facebook.com/ai.php?*
-// @exclude https://*.facebook.com/ai.php?*
-// @run-at document-start
-// @grant GM_getValue
-// @grant GM_setValue
-// @version 8.8.2 - 1st Oct 2013
-// ==/UserScript==
-
-// these 2 excludes commented out for now, till we investigate which pages we need to exclude, as we need to run on certain "connect" pages for blocking apps.
-// @exclude http://*.facebook.com/connect/*
-// @exclude https://*.facebook.com/connect/*
-
-//
-// (C) 2009 - 2013 stephen fernandez - http://www.fbpurity.com
-//
-
-// If you like this script please donate, big or small donations, anything is welcome :
-
-// http://donate.fbpurity.com/
-
-// ------------------------------------------------------------
-// F.B. Purity Home Page : http://www.fbpurity.com
-// F.B Purity Install : http://install.fbpurity.com
-// F.B. Purity Fan Page : http://fans.fbpurity.com
-// F.B. Purity UserGuide : http://user-guide.fbpurity.com
-// F.B. Purity Custom CSS : http://css.fbpurity.com
-// F.B. Purity FAQ / Help : http://faq.fbpurity.com
-// F.B. Purity Search : http://search.fbpurity.com
-// ------------------------------------------------------------
-
-// ABOUT
-// -----
-// This greasemonkey script hides all third party facebook application messages from your fb homepage.
-// Instructions on how to edit the "whitelist" are available here: http://whitelist.fbpurity.com
-// Instructions on how to edit the "extras" are available here: http://extras.fbpurity.com
-// Make donations to F.B. Purity, to show your appreciation here: http://donate.fbpurity.com
-
-// INSTALLATION
-// ------------
-// This script is compatible with the following web browsers: Firefox, Google Chrome, Opera and Safari
-//
-// Full installation instructions are available here:
-// http://install.fbpurity.com
-//
-// If you have any problems, please see the Frequently Asked Questions / Help page:
-// http://faq.fbpurity.com
-
-// UPDATES
-// -------
-// 1.51 30th March 2009 Bug fixed: if there were no pending requests, the script didnt work
-// 1.52 4th April 2009 removed GM_addStyle command, for better compatibility with other browsers (chrome + opera)
-// 1.53 26th April 2009 changed insertpoint so its not dependent on suggestions box
-// 1.54 27th April 2009 script is now compatible with Google Chrome + Opera (and possibly safari, not tested yet)
-// 1.54a 5th May 2009 fixed a minor bug
-// 1.54b 24th June 2009 fixed for facebook code change
-// 1.54c 29th July 2009 fixed for facebook code change
-// 1.54d 5th Aug 2009 fixed for facebook code change
-// 1.54e 26th Aug 2009 fixed for facebook code change
-// 1.60 4th Sep 2009 added application whitelisting capability, the default whitelisted apps are:
-// FB Iphone, Selective Twitter and Living Social
-// 1.61 14th Oct 2009 optimised script, it should run faster and more efficiently now
-// added tumblr, digsby and tweetdeck to whitelist, removed livingsocial from whitelist
-// 1.8 21st Oct 2009 added "block app" functionality and ability to show just the app messages on the page
-// added blackberry app to default whitelist
-// 1.8a 22nd Oct 2009 fixed bug with blocking apps if language was not set to english
-// 1.8d 23rd Oct 2009 fixed for new facebook update ( "live feed" changes )
-// fixed if you click "Show x similar posts" on an application message, when you have chosen to display the app messages, the app messages will no longer be automatically hidden
-// if after you've blocked an app, and there are no more hidden app messages, it now returns to normal homepage view
-// 1.8e 26th Oct 2009 script now hides more apps (ones that use widgets) and should also now be restricted to running on the homepage
-// 1.9 28th Oct 2009 added filter for "extra" [joined group, became fan, attending event, became friend] messages
-// 2.0 31st Oct 2009 fixed Show/Hide Logic, made app+extra filters mutually exclusive, optimised the script a lot
-// moved fbpurity bar to the left to regain vertical space on the right hand column
-// newly added elements now obey the current filter
-// 2.1 2nd Nov 2009 reset show/hide mode to default when user changes fb filter
-// added workaround for fb still showing apps that you have "blocked", script now "hides" app as well as blocking it, when you click the "block app" link
-// fixed bug with whitelisted apps being displayed via the "show hidden apps" filter
-// fixed - block link wasnt showing up on dynamically inserted app messages
-// 2.1a 4th Nov 2009 fixed - now also hides apps that dont have a mini-icon
-// 2.1b 7th Nov 2009 added option to hide suggestions box
-// added facebook for android to whitelist
-// 2.2 12th Nov 2009 rewrote filter system, should block absolutely all apps now (except whitelisted ones)
-// added filter for photos posted by applications (eg farmville, top friends etc)
-// 2.2a 12th Nov 2009 fixed suggestion box filter
-// 2.2b 20th Nov 2009 added another "became friends" story id to extras list
-// 2.3 31st Jan 2010 fixed block app function for google chrome v4 + hopefully fixed the random script loading problems too
-// speeded up script loading time by checking if the DOM is ready, rather than waiting for the whole page to load
-// added "attended event" messages to blocked extras list
-// added an option to allow blocking of "commented on status" and "likes status" messages
-// added facebook for palm to default application whitelist
-// 2.3a 5th Feb 2010 fixed bug where the show/hide links wouldnt work if you navigated away from the homepage then came back again
-// 2.3b 7th Feb 2010 fixed script to work with new layout
-// 2.3c 8th Feb 2010 fixed script to work with custom friends lists
-// 2.4 13th Feb 2010 fixed hide suggestions box option (wasnt working on custom friends list pages)
-// fixed app filtering ( some apps were getting around the app filter )
-// added the following optional extras : tagged/commented/liked photo, tagged in album, commented/liked album, commented/liked link, wall comment, group wall comment
-// 2.4a 18th Feb 2010 added another app exception (generic status updates posted "via some app" - using widgets)
-// added motoblur + iphoto uploader to default whitelist
-// added optional extra : "Page Wall Comments"
-// added optional extra : "Posted Event"
-// fixed bug caused by "posted events" + "became friends" sharing same story code
-// fixed bug caused by "became friends + became fan of" sharing same story code
-// 2.4b 19th Feb 2010 fixed bug in firefox where sometimes the "show extras" link stopped working
-// 2.4c 23rd Feb 2010 fixed event/friend/fan story code differentiation
-// 2.5 25th Feb 2010 added text filter list, so you can specify words or phrases you want to block from your news feeds
-// separated userappwhitelist from the defaultappwhitelist, for easier copying and pasting of application id lists
-// added picasa uploader to the default application whitelist
-// 2.5a 26th Feb 2010 fixed script to work with latest FB code change
-// 2.7 8th Mar 2010 added options editing screen that lets you save your settings for extras, whitelist, suggestions box, and custom text filter
-// added sprint/samsung? photo/video uploader, sony/erricson uploader,music player + status shuffle to default whitelist.
-// added https:// to the list of included pages for those wanting greater security whilst browsing facebook
-// 2.8 13th Mar 2010 fixed suggestions box wasnt being hidden on the requests page if the hide sb option was selected
-// fixed options screen occasionally not loading
-// added hide option to hide the connect with friends box
-// added facebook exporter for iphoto and flickr app to default whitelist
-// added "Allow" link to application messages, for auto whitelisting of applications
-// 2.8a-test 19thMar2010 alpha test of temp fix for fb codechange, basic (show/hide) functionality should be restored
-// 2.8b-test 20thMar2010 fixed bug in show/hide app code, fixed "block app" and "allow" links on application messages
-// 2.9 2ndApr2010 Merged 2.8 + 2.8b-test so it doesnt matter which version of the site you are presented with, the script should still work
-// Fixed bug in chrome where show/hide functions were sometimes not working.
-// Fixed Block + Allow links that were not showing up for certain applications (apps that post as normal FB stories)
-// Added LG Mobile, Windows Phone, Twitter and Posterous to the default application whitelist
-// Added hide "Sponsored box" (ads) option
-// 2.9a 6thApr2010 Fixed bug that was causing Firefox to lock up
-// 2.9b 9thApr2010 Fixed after blocking an app, not all the onscreen posts by that app would be hidden
-// Made some performance tweaks to make the script run better
-// Blocking app no longer requires "hiding" too so removed hideapp function call
-// Added Snaptu + SonyEricsson Panel + Nokia to default whitelist
-// 2.9c 15thApr2010 Added Ping.fm to default whitelist
-// Added a workaround for the bug in firefox which caused the script to fail when cookies are set to: "Keep until:" - "ask me every time"
-// 2.9d 15thApr2010 Fixed minor CSS style issue
-// Fixed friend/fan stories getting mixed up again (due to Facebooks code tinkering)
-// 2.9e 19thApr2010 Fixed bug where the display extras/apps would get screwed up some times
-// Fixed "allow" and "block app" buttons were not being hidden by default
-// 2.9f 26thApr2010 Fixed Display bug on custom friends list page.
-// 2.9g 4thMay2010 Fixed Extras differentiation (friends/fans)
-// Added wildcard for included pages
-// Added Gwibber to default whitelist
-// 2.9h 20thMay2010 Added new "likes website" type story to "became fan of" option
-// Fixed differentiation between like+became friends (again)
-// 2.9i 11thJun2010 Fixed Block App function
-// Added "changed profile info","changed relationship" and "changed profile pic" to the list of hideable extras
-// Fixed multiple words/phrases in custom text filter for chrome
-// 2.9j 22ndJun2010 Added option to hide "beta testers" box
-// Added HTC Sense + Samsung Mobile apps to default Whitelist
-// 3.0 30thJun2010 Fixed script for latest FB code change
-// Added visual feedback for "block app" function
-// Added extra security on domain name parsing
-// Stopped script from running in frames
-// 3.1 30thJun2010 Fixed for unforseen bugs
-// 3.11 9thJul2010 Fixed hide suggestions box (recommended pages + people you may know)
-// 3.2 5thAug2010 Fixed "Block" and "Allow" (whitelist) buttons, Added windows live messenger + o2 social link to default whitelist
-// 3.3 20thAug2010 Added new extra: "Checked in to location", addded LG Phone app to default whitelist
-// 3.4 3rdSep2010 Fixed script to work with facebook's latest code change, added Bloom photo uploader to default whitelist
-// 3.4a 11thSep2010 Fixed hide "get connected box" option, fixed freezeup in google chrome when creating a new friends list, fixed regex bug in custom text filter
-// 3.4b 14thSep2010 Fixed hide "get connected box" option again, fixed compatibility with ff4
-// 3.4c 22ndSep2010 Fixed hide "get connected box" option again
-// 3.5 2ndOct2010 The application filter now also hides "friend began using app/game" messages. Custom text filter now tells you which filter was activated when it hides a message
-// 3.6 7thOct2010 Added new extras "uploaded photo, uploaded video, tagged in video, posted note, tagged in note, posted link"
-// Added "block app" and "allow app" links for "started using app" type messages
-// Added Import and Export Settings functionality.
-// Fixed loss of settings when user clears Firefox's cookies
-// 3.6a 7thOct2010 Fixed bug with Firefox settings recovery system
-// 3.7 14thOct2010 Incorporated new "joined group" story type to existing hide "joined group" extra, incorporated new "changed location" story types to existing "changed location" extra, added hide "poke box" option, added new HTC Sense, live journal and hootsuite to default app whitelist
-// 3.8 20thOct2010 Added options to hide the "questions box", "events box" and "requests box"
-// 3.8.1 27thOct2010 Fixed: "started using app filter", "hide request box code", added Sony Ericsson X10 mini pro to default application whitelist
-// 3.8.2 29thOct2010 Fixed: Whitelist + Block App buttons were no longer showing due to a change in facebooks code.
-// 3.8.3 3rdNov2010 Fixed: Whitelist + Block App buttons were no longer showing due to a change in facebooks code.
-// Added Yahoo + Sony Ericsson + Vlingo to default whitelist
-// Added WL (whitelist + BA (Block App) links for messages posted by applications masquerading as "normal" fb status updates
-// 3.9.0 4thNov2010 Added font size option
-// 3.9.1 11thNov2010 Streamlined page processing, Fixed font size for group messages, Fixed "needs to access data on all sites" message on google chrome, fixed group wall comments filter, fixed hide questions box option
-// 3.9.2 15thNov2010 Updated hide sponsored box code, sponsored box should now be hidden on profiles and pages as well as the homepage/newsfeed, added block/whitelist links for photos/notes created uploaded by applications, tidied up code
-// 3.9.3 19thNov2010 Added script collision detection, to check if 2 versions of the script are running at the same time (script+extension etc)
-// Altered more font classes to give a more uniform font size across the site. Added Droid + Dell Mobile to default app whitelist
-// 3.9.4 25thNov2010 Fixed mangled BA + WL links, Fixed "FB-Glitch" error on friends list pages, Hides sponsored box on search pages if option set, Added link to info about AVG clash, Fixed Opera bug with localstorage
-// 3.9.5 7thDec2010 Added "changed to new profile" stories to "updated profile" filter, added new story code to "updated profile" filter, now hides sponsored box in a few more places, added RockMelt to default app whitelist
-// 3.9.6 17thDec2010 Added Custom CSS Box, Fixed hide "suggestions" box, Fixed bug with blocking "started using app", Added Friendly for Ipad, Slide, networked blogs, RSS Grafitti, Twitter Feed to default app whitelist
-// 4.0.0 23rdDec2010 Fixed intermittent app/extra filter problems, fixed bug with "started using app" previously it didnt check if app was in whitelist, added seesmic to app whitelist, fixed autoplay of videos when toggling show/hide
-// 4.1.0 18thJan2011 NEW: Application message filtering can now be turned off, NEW: Can now block multiple applications at the same time
-// Hide sponsored box option now hides more ads, Fixed name size on profile pages, Addeed Facebook mobile by Opentech ENG and flipboard to default app whitelist
-// 4.3.0 27thJan2011 "App + extra" filtering now works on profile pages, tweaked blockallapp function a little bit (scroll to top, single app block)
-// Added "delete all recent activity" button to profile pages, enabled full screen button for youtube videos, added delete friend request button, added nokia N900,and Ovi by Nokia to default app whitelist
-// 4.3.1 11thFeb2011 show/hide filters save youtube video's current position, hide sponsored box option now hide ads on new photo lightbox popups, catches more application messages in app filter, fixed del recent activity to work with new https settting, fixed missing info bar on profile pages, fixed anomalous delete button on privacy page, added kodak easyshare,Snaptu for Facebook and Instagram to default app whitelist.
-// 4.4.0 17thMar2011 fixed commenting ( hitting return/enter in the textarea no longer submits comments, also added comment button back for comments )
-// fixed filtering on application/profile pages with photo strip at top, fixed intermittent bug with display of block app/whitelist links, added eBuddy, mobileblog + Rockmelt Beta to default whitelist
-// 4.4.1 24thMar2011 Fixed block app function. Fixed Delete Recent Activity Function. (Known issue: In FF4 profile page needs to be reloaded to get the "del recent activity" button to show up)
-// 4.5.0 29thMar2011 Added an option to hide the new Facebook Questions. Fixed Delete Recent Activity Button not showing up in FF4. Fixed "extras" dual story type separation for facebook videos and events. Fixed options screen layout problem on wide screens.
-// 4.5.1 21stApr2011 Fixed for new Relationship stories and new "Is Using Application" stories
-// 4.5.2 8thJun2011 fixed block application function, Fixed hide sponsored box code, Fixed a bug with the extras filter, added "no longer listed as" to relationship story filter
-// 4.5.3 23rdJun2011 fixed fb places checkin anomaly, merged new "commented on a website" story type with "commented on link"
-// 5.0.0 19thJul2011 added "hide chat" option, added "hide happening now" sidebar option, added "hide commented on event wall" extra option, added "hide page updates" extra option, added "hide commented/liked stories on Top News feed" extra option
-// 5.1.0 20thSep2011 fixed spaces in application whitelist issue. fixed position of WL + BA links. added "updated school" and "relatives" stories to the updated profile extra filter. added "tagged in a post" stories to "commented/liked status" filter. added "subscribed to" stories to "friends with" extra filter. added windows phone 7, and facebook for windows phone 7 to default whitelist. fixed hiding ads on the photo lightbox
-// 5.2.0 21stSep2011 fixed for new newsfeed
-// 5.3.0 22ndOct2011 fixed/ish most extra filters (forced to use text filtering, so it only work on english interface), fixed comment button not showing up on ticker and birthday story popups. fixed ticker frame showing when hidden. fixed "meta.match" popup javascript error. fixed hide events box. Fixed BA + WL links not showing up.
-// 5.5.0 29thOct2011 fixed various issues with extra filtering, added hide "Shared photo" extra option, ff addon is now restartless and also compatible with seamonkey/iceape
-// 6.0.0 1stDec2011 fixed shared photo filter, fixed fan page stories filter, updated facebook places (checkins) filter, sped up the filtering a bit, fixed "likes page" filter, fixed event story filters, removed redundant box hiding options, added hide "read an article" option, reduced wall options to single "wrote on wall" option, added basic check for updates button, stopped filtering the current user and fbp's updates, FBP firefox extension is now restartless, FBP should now be compatible with the Seamonkey and Iceape browsers, app whitelist and custom text filter are now textareas and each item now needs to be on a separate line, rather than comma separated.
-// 6.1.1 9thDec2011 fixed too-wide textareas on options screen, fixed fan page story filter + logged in user filter, added "shared an event" to "created event" filter, fixed attending and attended event filters, improved tabbed textareas differentiation, fixed "friend requested" button being erroneously displayed, fixed "fb glitch" error on friends list pages, fixed "shared a link" filter, fixed upload photo button duplication
-// 6.3.0 22ndDec2011 added font and background colour options, added hide offline friends in chat option, added separate settings per logged in user, fixed "joined group" filter, fixed "regex error" freezing firefox, fixed https issues with options screen, fixed anomalous "delete" button showing up on timeline page, fixed "liked page" filter,improved fb places filter, added welcome message on first run
-// 6.4.0 24thDec2011 Fixed filtering to work with international versions of FB, various other fixes.
-// 6.4.1 26thDec2011 Fixed FB for IE7 Spoofing (to help with disabling Timeline)
-// 6.4.2 6thJan2012 Fixed Application message filtering. Fixed hidden create album button on group pages. Fixed FB Purity Bar not showing on Friends list feeds. Fixed fbp not working for users with default user icon/pic. Improved welcome page.
-// 6.4.3 19thJan2012 Fixed story filtering
-// 6.5.0 6thFeb2012 Added an auto update checker, Fixed comment button on new photo lightbox, Fixed birthday comment flyout button, fixed hide ads on photo lightbox, fixed go online/offline chat button when browser is in IE7 spoof mode, fixed hide events box, fixed a memory leak
-// 6.6.0 7thFeb2012 Added an option to force the newsfeed to be sorted by most recent, fixed photo comment button for "facebook fan pages"
-// 6.6.1 20thFeb2012 Added links to new FBP Fan Page on Google Plus to options screen. Turned on "Hide sponsored box" option by default. Added CSS to hide footer in Right hand column. Fixed youtube scrollbars issue, fixed hidden info on fb questions and fb insights when colour options are set
-// 6.6.2 2ndMar2012 Hides "press enter to submit comment" text when comment button enabled, fixes gap on new group pages when in ie7 spoof mode, fixes comment buttons on photo light box, brought back comments/likes on top news stories option
-// 6.7.0 28thMar2012 Fixed auto update checker in Firefox, Fixed hide ads in message pages, Fixed comment box growing too big in Safari, fixed hide chat box option, fixed force feed to be sorted by "most recent" option, fixed delete recent activity button
-// 6.7.1 3rdApr2012 Improved game/application and extra filtering, fixed hidden images at top of group pages if background colour had been set, fixed opera extension
-// 7.0.0 6thApr2012 Added built in IE7 user agent switch for chrome (for disabling timeline), improved CSS fixes for IE7 spoof mode, improved comment button restoration, improved "extra" filters
-// 7.1.0 28thApr2012 Fixed hide recent activity button, Fixed comment button on birthday and ticker flyout boxes, If hide "read an article" filter is ticked, it now also hides the "trending articles" box
-// 7.5.0 10thMay2012 Fixed news article redirects for Trending Articles stories also fixed the hide trending articles box option, added "block application" link to bottom of all facebook application pages, and "block application" button to all facebook application permission request pages, Fixed "BA" (Block Application) and "WL" (Whitelist) links on application posts in the newsfeed
-// Added a single column Timeline layout option, re-added ability to filter "frictionless sharing / FB actions" stories, Fixed hidden comment button in group welcome box
-// 7.5.1 25thMay2012 Fixed hiding trending articles option, hide sponsored box option now also hides sponsored stories in the newsfeed, various other minor tweaks and fixes
-// 7.5.2 14thJun2012 Fixed various extra filters including ('shared photo' and 'uploaded photo'), fixed news article redirects and hide "trending articles / trending videos"
-// 7.6.0 5thJul2012 Removes all external link redirects, so Facebook cant track them or block them. Adds remove event 'x's on events page (chrome + safari only), highlights applications in app center that request email or posting permissions, fixed block application link on application pages
-// 7.6.1 1stAug2012 Fixed hide sponsored box
-// 7.6.2 28thAug2012 Stopped New User screen from popping up when Facebook resets the user settings. Fixed external link interception. Fixed display anomalies in message send window, stopped hidden button from showing in "liked a page" message in ticker. Added extra highlighting/clarity on the App Center permissions section.
-// 7.8.0 7thSep2012 Fixed the user settings, so facebook cant delete them
-// Altered block app function to let you block just the app you select, it then asks if you also want to block the other apps
-// 7.9.0 Fixed shared a link filter, Separated FB Actions/Frictionless sharing apps from the Trending Articles filter, FB Actions/ Frictionless sharing apps should now be filtered by the apps filter
-// Fixed TL button showing incorrect state after login
-// 7.9.5 18thSep2012 Fixed comment button (now 2 step submit process), fixed settings bug (facebook was resetting users settings, also clearing browser cookies would reset settings), completely hides sponsored stories from the newsfeed, restored new user greeting
-// 7.9.6 26thOct2012 Fixed hide trending articles, Fixed link and news article redirection/interception, Fixed filtering on interest lists, Fixed Block App link on permission request pages, Fixed inline youtube video playing on timeline pages, fixed missing images in fbp interface, fixed highlighting on application permission request dialogs
-// 7.9.7 15thNov2012 Fixed for FF17 (extension), Fixed block application function, added a more prominent block app button to appcenter app pages, fixed application filter + instagram whitelisting, Added FBP Info bar and filtering to game and "page feed", Fixed Fan Page filter, so it doesnt affect "Page Feed" or "Interest Lists", fixed emoticons when font size is altered, fixed app blocking for frictionless sharing apps such as netflix, fixed bug with birthday comment flyout (blue box), changed the default "restore comment buton" option to off., updated new user info page to include info about FBP interest list and page notifications. Added "posted an offer" to sponsored story filter
-// 8.0.1 30thNov2012 Added options for hiding left hand column links, added "upcoming events" to "hide events box" filter, made font options collapsible, improved ad blocking function
-// 8.2.0 --thJan2013 Added "Recently Released Albums" to sponsored box filter, fixed Questions filter, fixed "block app" on opera, Added create a group, create a page, and find friends to links you can hide in the left column. Added "Recent Articles About" and "Most Shared on" to trending articles filter, added "play with friends" story filter
-// redesigned options screen, added lots new options, fixed "drag image into box" covering options screen, cleared out lots of dead code, added option to hide smileys, added fix left column in place option
-// 8.2.2 13thFeb2013 Fixed slowdown on timeline / like/fan pages. Added hide like suggestions bar, to hide sponsored box option (after you like page, it shows a list of other pages to like). Updated welcome screen to 2 step process.
-// 8.3.0 21stMar2013 Added Hide "Gifts" and hide Notification Popup Box options, fixed bug in news panel on fbp options screen (bug-if feed was too short, surfaced due to fb post deletions), fixed add block link to fb apps sidebar, fixed hide all videos filter, fixed hidden event page buttons in single column timeline layout mode, improves group story filtering, fixed hidden file upload buttons when background color is set
-// 8.5.0 24thJun2013 Hide sponsored box option now also Hides the page suggestions on page feed, fixed opera specific bug when certain options were selected, fixed hide emoticons for new "feelings" functionality
-// Updated for new newsfeed design, Added hide links in right hand column options, Fix saving/retrieving settings. Fixed Timeline cover photo issues. Fixed timeline shift to right on personal timeline pages. Fixed hidden comment button when attaching image to comment.
-// 8.5.1 27thJul2013 Fixed hide "shared photos" when they are part of a "multi post update", fixed hidden group count and image attach icon when background color was set, updated "changed location" filter to include "is in" and "was in" a location
-// 8.5.2 14thAug2013 Fixed TL button for new search bar, Fixed hide emoticons option, Fixed line-height in ticker and left column when font is set
-// 8.5.3 19thAug2013 Fixed Display of FBP info bar + filtering functionality for some users
-// 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
-// 8.7.0 12thSep2013 Updated FB Gift hiding option, Added "hide tagged in status" option, added app and game filtering in the news ticker to the hide "app / game messages" filter, updated hide sponsored box filter to also hide "similar to" box, updated hide gifts option
-// 8.8.2 1stOct2013 Added hide sticker packs functionality to sticker store, Improved the force Sort Most Recent function, Fixed "Block application" button wasnt showing in some situations, added BA links to appcenter app listings, fixed hide trending box option, fixed hide like page button for new newsfeed design
-
-// (C) stephen fernandez 2009-2013 http://www.fbpurity.com
-
-// If you like F.B. Purity please donate, big or small donations, anything is welcome
-// http://donate.fbpurity.com
-
-(function() {
-
- var fbpVersion = "v8.8.2";
- var debug=0;
-
- var fbpoptsobj = {}; // object to store the preferences etc
- try {
- if (window.top!=window.self) // dont run on framed pages
- if(!window.location.href.match(/connect\/uiserver\.php\?/)) // but allow it to work on embedded permissions pages
- return;
- }
- catch (e) {
- ; //return;
- //alert('caught error ' + e.message);
- //unsafeWindow.console.log(e);
- }
-
- // only run on actual facebook pages
- try {
- if(!window.location.hostname.match(/facebook\.com$/))
- return;
- }
- catch(e) {
- ;
- //alert('caught error ' + e.message);
- //unsafeWindow.console.log(e);
- }
-
- // set browser type
- var ischrome=(typeof(chrome)!='undefined' && chrome.extension);
- var issafari=(typeof(window.navigator.vendor)!='undefined') && (window.navigator.vendor.match(/Apple Computer, Inc\./)) && (window.navigator.userAgent.match(/Version\/5\./) || window.navigator.userAgent.match(/Version\/6\./));
- //var isopera=window.navigator.userAgent.match(/Opera/);
- try {
- var isopera=(typeof(widget) && typeof(widget.preferences));
- }
- catch(e) {
- var isopera=0;
- }
- var isasync=(ischrome || issafari);
-
- //if(unsafeWindow)
- // console.log=unsafeWindow.console.log;
-
- //check if another version of the script is running at the same time and if so give a warning.
- if(document.getElementById('fbpoptslink')) {
- var collisionerrormsg='Error: You seem to be running 2 versions of FB Purity at the same time, perhaps you are running the addon and the script version, you need to uninstall or disable one of them, otherwise FBP wont function correctly. (<a href="http://faq.fbpurity.com/#collision">More Info</a>)';
- if(document.getElementById('fbperrormsg'))
- document.getElementById('fbperrormsg').innerHTML=collisionerrormsg;
- else
- window.alert(collisionerrormsg);
- }
-
- var fbpstyle=document.createElement('style');
- var hashead=document.getElementsByTagName('head').length;
-
- var fbpfreestyle=document.createElement('style'); // for setting a "global" font etc
- fbpfreestyle.setAttribute('id','fbpfreestyler');
- fbpfreestyle.setAttribute('type','text/css');
-
- /*if(hashead)
- document.getElementsByTagName('head')[0].appendChild(fbpfreestyle);
- */
- var fbpboxstyle=document.createElement('style'); // for setting whether boxes are on or off
- fbpboxstyle.setAttribute('id','fbpboxstyler');
- fbpboxstyle.setAttribute('type','text/css');
- /* if(hashead)
- document.getElementsByTagName('head')[0].appendChild(fbpboxstyle);
- */
- var fbpcssstyle=document.createElement('style'); // for adding the user's Custom CSS and general css stuff
- fbpcssstyle.setAttribute('id','fbpcssstyler');
- fbpcssstyle.setAttribute('type','text/css');
- /*if(hashead)
- document.getElementsByTagName('head')[0].appendChild(fbpcssstyle);
- */
- var fbptlstyle=document.createElement('style');
- fbptlstyle.setAttribute('id','fbptlstyle');
- fbptlstyle.setAttribute('type','text/css');
- /*if(hashead)
- document.getElementsByTagName('head')[0].appendChild(fbptlstyle);
- */
-
-fbpescaperegex = function(str){
- // to escape brackets entered in the custom text filter, fixes some problems, but causes others... (users regexes that require brackets wont work, but the number of advanced users who will be using brackets are probably countable on one hand )
- var replacements = {
- '(': '\\(',
- ')': '\\)',
- '[': '\\[',
- ']': '\\]',
- '{': '\\{',
- '}': '\\}'
- }
- var ret = this;
- try {
- for(key in replacements) {
- str = str.replace('' + key, replacements[''+ key],'g');
- }
- }
- catch(e) {
- ; // do nothing, traps an error found in ff 4.0b5
- }
- return str;
-};
-
-var fbpoptslist='becamefriends,becamefan,joinedgroup,attendevent,attendedevent,createdevent,commentlikeslink,commentwall,commentgroupwall,commentpagewall,commenteventwall,updatedprofile,changedprofilepic,changedrelationship,suggestionsbox,connectbox,sponsoredbox,pokebox,happeningnowbar,betabox,commentbutton,offlinefriends,requestsbox,eventsbox,questionsbox,checkedin,uploadedphoto,sharedphoto,uploadedvideo,taggedinvideo,postednote,taggedinnote,postedlink,readarticle,fontfix,fontcolourfix,fontbgcolourfix,fbpfont,fbpfontfix,filterappmessages,recentactivity,chatbox,smileys,fixedleftcolumn,pagestory,sortmostrecent,fixarticleredirects,timelineonecol,upcomingevents,sharedevent,likedlink,sharedpage,commentedlink,likepagebutton,hideallphotos,taggedphoto,likedphoto,commentedphoto,sharedvideo,likedvideo,commentedvideo,youtubevideo,sharedstatus,likedstatus,commentedstatus,taggedstatus,hideallvideos,hidealllinks,lcadvertmgr,lcconnect,lcallpages,lcpagesfeed,lclikepages,lcallapps,lcappcenter,lcevents,lcgamesfeed,lcpokes,lcmusic,lcplaceseditor,lcallgroups,lcallinterests,lccreategroup,lccreatepage,lcfindfriends,lcdeveloper,lcfriends,lcgifts,notificationpopup,rcrecommendedpages,rcrelatedgroups,rcpokes,rcbirthdays,rcfriendrequests,rcgamerequests,trendingbox';
-
-// new left column options = lcadvertmgr,lcconnect,lcallpages,lcpagesfeed,lclikepages,lcallapps,lcappcenter,lcevents,lcgamesfeed,lcpokes,lcmusic,lcplaceseditor,lcallgroups,lcallinterests,lccreategroup,lccreatepage,lcfindfriends,lcdeveloper,lcfriends
-// new right column options = rcrecommendedpages,rcrelatedgroups,rcpokes,rcbirthdays,rcfriendrequests,rcgamerequests
-var fbpoptsarr=fbpoptslist.split(',');
-
-var optsdiv=document.createElement('div');
-optsdiv.setAttribute('id','fbpoptsdiv');
-optsdiv.style.zIndex='155'; //99 (change to 155 to go above drag image box
-optsdiv.style.position='absolute';
-optsdiv.style.left='100px'; //143 //150px
-optsdiv.style.top='1px'; //42px
-optsdiv.style.background='white';
-optsdiv.style.border='3px solid black';
-optsdiv.style.display='none';
-
-var fbptips=[
-'<br/> <b>FBP Tip</b>: Want some help with using the Custom Text Filter? Visit the <a target="_blank" href="http://www.fbpurity.com/extras.htm?src=fbptips#customtextfilter">Custom Text Filter Help Section</a>',
-'<br/> <b>FBP Tip</b>: Want to further customise Facebook? <a target="_blank" href="http://fbpurity.com/css.htm?src=fbptips">Check out FBP\'s Custom CSS</a>',
-'<br/> <b>FBP Tip</b>: If you have any questions or problems with FBP <a target="_blank" href="http://fbpurity.com/faq.htm?src=fbptips">Check out FBP\'s FAQ / Help Page</a>',
-'<br/> <b>FBP Tip</b>: Donations help keep the FB Purity project alive, <a href="http://donate.fbpurity.com">Please show your support and Donate</a>.',
-'<br/> <b>FBP Tip</b>: Want to help test out new versions of FBP before they are officially released? <a href="http://www.facebook.com/puritytest">Join the FBP Beta Testing Page</a>.',
-'<br/> <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>.',
-'<br/> <b>FBP Tip</b>: If you hover your mouse over any of the options on the FBP options screen, extra information about that option is usually displayed.'
-];
-
-var fbpoptshtml= '<div style="float:left;"><table style="top:0px"><tr>'+
-'<td valign="top"><a title="www.fbpurity.com" href="http://www.fbpurity.com"><img width="100" height="100" border="0" alt="F.B. Purity Logo" src="https://sites.google.com/site/st333v/fbp-1/fbp-ghost-lid-icon-100x100.png"></a></td>'+
-'<td width="800" valign="top">' +
-'<h2 style="display:inline" class="uiHeaderTitle">F.B. Purity ' + fbpVersion + ' Options</h2> ' +
-'<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>'+
-
-//'<table><tr><td>Click the Like button on the FBP fan page to ensure you get the latest updates and news from the fan page directly in your newsfeed. <a href="" onclick="document.getElementById(\'updateframe\').src=\'http://www.fbpurity.com/latest.htm\';document.getElementById(\'updateframe\').style.display=\'block\';return false;">Check for latest version</a><iframe style="display:none" height="40" width="220" id="updateframe"></iframe></td><td><object align="middle" type="text/html" data="https://www.facebook.com/connect/connect.php?id=408502197558&connectis=0&stream=0" width="275" height="65"/></td></tr></table></td>'+
-'<table><tr><td>"Like" the <a target="_blank" href="http://fans.fbpurity.com">FB Purity Fan Page</a> to make sure you get the latest news and updates about F.B. Purity in your feed. (Please note, due to Facebook censorship of the FBP fan page, you now also need to subscribe to notifications from the Fan page, otherwise you wont see the FBP news in your newsfeed. To do this, go to the FBP Fan Page, hover over the "Like" button then select "Get Notifications". <a target="_blank" href="http://www.fbpurity.com/install.htm?v=' + fbpVersion.split(/v/)[1] + '">Check for latest version</a></td><td><iframe src="https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Ffluffbustingpurity&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>'+
-'<td><!--a target="_blank" href="http://donate.fbpurity.com"><img style="margin-top:3px" border="0" src="https://www.paypal.com/en_US/GB/i/btn/btn_donateCC_LG.gif"></a--></td>'+
-'</tr></table></div>'+
-
-// <object align="middle" type="text/html" data="https://www.facebook.com/connect/connect.php?id=408502197558&connections=0&stream=0" width="275" height="65"/>
-// <iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.fbpurity.com&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>
-
-'<div style="clear:both"></div>'+
-'<table><tr><td valign="top">';
-
-// add new dynamic opts
-function optionsbox(mode) {
- var table, rowstyle;
- this.rownum=1;
- if(1) // ischrome doesnt work in safari
- var openallboxes='<a title="Open All" href="javascript:;" onclick="document.getElementById(\'fbvariousopts\').click();document.getElementById(\'fbstatusopts\').click();document.getElementById(\'fblinkopts\').click();document.getElementById(\'fbphotoopts\').click();document.getElementById(\'fbvideoopts\').click();document.getElementById(\'fbeventopts\').click();return false;">▼</a>';
- else
- var openallboxes='';
- if (typeof mode !='undefined' && mode=='extras') {
- 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>';
- }
- else
- //this.table="<table width='100%'>";
- this.table="";
-
- // Use tbody to group tables instead of divs ! !!! ! :)
- this.tableHeader = function (title, hint, varname) {
- //this.table+='<tr title=""><td colspan="2"><p style="margin-top:3px;margin-bottom:3px;font-weight:bold"><a title="' + hint + '" style="margin-top:2px" href="#" onclick="document.getElementById(\'' + varname + '\').style.display==\'block\' ? (function(){document.getElementById(\'' + varname + '\').style.display=\'none\';document.getElementById(\'' + 'fb'+ varname + '\').setAttribute(\'class\',\'fbpclosedlist\')})() : (function(){document.getElementById(\'' + varname + '\').style.display=\'block\';document.getElementById(\'' + 'fb' + varname + '\').setAttribute(\'class\',\'fbpopenlist\')})();"><span id="' + 'fb' + varname + '" class="fbpclosedlist">' + title + '</span></a></p><div id="' + varname + '" style="display:none"><table>';
- this.table+='<tbody><tr title=""><td><p style="margin-top:3px;margin-bottom:3px;font-weight:bold"><a title="' + hint + '" style="margin-top:2px" href="javascript:;" onclick="document.getElementById(\'' + varname + '\').style.display==\'none\' ? (function(){document.getElementById(\'' + varname + '\').style.display=\'table-row-group\';document.getElementById(\'' + 'fb'+ varname + '\').setAttribute(\'class\',\'fbpopenlist\');return false;})() : (function(){document.getElementById(\'' + varname + '\').style.display=\'none\';document.getElementById(\'' + 'fb' + varname + '\').setAttribute(\'class\',\'fbpclosedlist\');return false;})();"><span id="' + 'fb' + varname + '" class="fbpclosedlist">' + title + '</span></a></p></td><td></td></tr></tbody><tbody id="' + varname + '" style="display:none">';
- }
- this.addTableRow = function(title,hint,varname,inputtype) {
- this.table+="<tr title='" + hint + "' style='" + ((this.rownum++ % 2) ? "background-color:#ECEFF5 !important" : "") + "'><td> <label style='color:black;font-weight:normal' for='" + varname + "'>" + title + "</label></td>" + "<td><input id='" + varname +"' type='" + inputtype + "'/></td></tr>";
- }
- this.tableFooter =function(){
- //this.table+="</table></div></td></tr></table>";
- this.table+="</tbody>";
- }
- this.buildTable =function(endmode){
- if(typeof endmode=='undefined')
- return this.table;
- else
- return this.table + '</table>';
- }
-}
-
-newoptscolumn='';
-
-// Various Options
-v = new optionsbox('extras');
-v.tableHeader('Various Story Types','Hide Various story types from the newsfeed', 'variousopts');
-v.addTableRow('Fan Page Stories','Hide stories posted by Pages you have liked from the newsfeed','pagestory', 'checkbox');
-v.addTableRow('Trending Articles / Videos','Hide Trending Articles / Trending Videos / Most Shared on / Recent Articles About stories from the newsfeed','readarticle', 'checkbox');
-v.addTableRow('Facebook Questions','Hide Facebook Questions stories','questionsbox','checkbox');
-v.addTableRow('Became Friends','Hide Became Friends stories from the newsfeed','becamefriends','checkbox');
-v.addTableRow('Changed Relationship','Hide Changed Relationship stories from the newsfeed','changedrelationship', 'checkbox');
-v.addTableRow('Changed Location','Hide Changed Location (Check-in) Stories','checkedin','checkbox');
-v.addTableRow('Updated Profile Info','Hide Updated Profile Stories','updatedprofile','checkbox');
-v.addTableRow('Joined a Group','Hide Joined Group Stories (and other group related stories)','joinedgroup','checkbox');
-v.addTableRow('Posted Note','Hide Posted Note Stories','postednote','checkbox');
-v.addTableRow('Tagged in Note','Hide Tagged in Note Stories','taggedinnote','checkbox');
-v.tableFooter();
-newoptscolumn+=v.buildTable();
-
-// Event Options
-v=null
-v= new optionsbox();
-v.tableHeader('Event Stories','Hide event stories from the newsfeed', 'eventopts');
-v.addTableRow('Upcoming Events','Hide Upcoming Events / Upcoming Concerts','upcomingevents','checkbox');
-v.addTableRow('Attending Event','Hide Attending Event','attendevent','checkbox');
-v.addTableRow('Attended Event','Hide Attended Event','attendedevent','checkbox');
-v.addTableRow('Created Event','Hide Created Event','createdevent','checkbox');
-//v.addTableRow('Liked Event','Hide Liked Events','likedevent','checkbox');
-v.addTableRow('Shared Event','Hide Shared Events','sharedevent','checkbox');
-v.tableFooter();
-newoptscolumn+=v.buildTable();
-
-// Link / Page Options
-v=null;
-v = new optionsbox();
-v.tableHeader('Link / Page Stories','Hide Link / Page stories from the Newsfeed', 'linkopts');
-//v.addTableRow('Hide All External Links','All External Links from the Newsfeed','hidealllinks', 'checkbox');
-v.addTableRow('Liked Page','Hide Liked Page Stories','becamefan','checkbox');
-v.addTableRow('Shared Page','Hide Shared Page Stories','sharedpage','checkbox');
-v.addTableRow('Liked Link','Hide Liked Link Stories','likedlink','checkbox');
-v.addTableRow('Shared Link','Hide Shared Link Stories from the Newsfeed','postedlink','checkbox');
-v.addTableRow('Commented on Link','Hide Commented on Link Stories','commentedlink','checkbox');
-v.addTableRow('"Like Page" buttons','Hide the "Like Page" buttons from shared items in the newsfeed','likepagebutton','checkbox');
-v.tableFooter();
-newoptscolumn+=v.buildTable();
-
-// Photo Options
-v=null;
-v = new optionsbox();
-v.tableHeader('Photo Stories','Hide photo stories from the newsfeed', 'photoopts');
-v.addTableRow('Hide All Photos','Hide All Photo stories from the newsfeed','hideallphotos', 'checkbox');
-v.addTableRow('Shared Photo','Hide Shared Photo / Album stories from the newsfeed','sharedphoto','checkbox');
-v.addTableRow('Changed Profile Photo','Hide Updated Profile Picture / Cover Photo stories from the newsfeed','changedprofilepic', 'checkbox');
-v.addTableRow('Uploaded Photo','Hide Added Photo Stories','uploadedphoto','checkbox');
-v.addTableRow('Tagged in Photo','Hide Tagged in Photo / Album stories','taggedphoto','checkbox');
-v.addTableRow('Liked Photo','Hide Liked Photo / Album stories','likedphoto','checkbox');
-v.addTableRow('Commented on Photo','Hide Commented on Photo / Album stories','commentedphoto','checkbox');
-v.tableFooter();
-newoptscolumn+=v.buildTable();
-
-// Video Options
-v=null;
-v = new optionsbox();
-v.tableHeader('Video Stories','Hide Video stories from the Newsfeed', 'videoopts');
-v.addTableRow('Hide All Videos','Hide All Video Stories from the newsfeed','hideallvideos', 'checkbox');
-v.addTableRow('Shared Video','Hide Shared FB Video Stories from the newsfeed','sharedvideo','checkbox');
-v.addTableRow('Uploaded Video','Hide Added Video Stories','uploadedvideo','checkbox');
-v.addTableRow('Tagged in Video','Hide Tagged in Video Stories','taggedinvideo','checkbox');
-v.addTableRow('Liked Video','Hide Liked Video Stories','likedvideo','checkbox');
-v.addTableRow('Commented on Video','Hide Commented on Video Stories','commentedvideo','checkbox');
-v.addTableRow('Youtube / Vimeo Videos','Hide Youtube and Vimeo Stories','youtubevideo','checkbox');
-v.tableFooter();
-newoptscolumn+=v.buildTable();
-
-// Status // Wall Options
-v=null;
-v = new optionsbox();
-v.tableHeader('Status / Wall Stories','Hide Status / Wall stories from the newsfeed', 'statusopts');
-v.addTableRow('Shared Status','Hide Shared Status Stories','sharedstatus','checkbox');
-v.addTableRow('Liked Status','Hide Liked Status Stories','likedstatus','checkbox');
-v.addTableRow('Commented on Status','Hide Commented on Status stories','commentedstatus','checkbox');
-v.addTableRow('Tagged in Status','Hide Tagged in Status Stories','taggedstatus','checkbox');
-v.addTableRow('Wrote on Wall','Hide Wrote on Wall Stories (This should work for comments posted to event, page, user and group wall)','commentwall','checkbox');
-v.tableFooter();
-newoptscolumn+=v.buildTable('complete');
-
-// end new options layout
-fbpoptshtml += newoptscolumn ;
-
-fbpoptshtml += '</td><td valign="top">'+
-'<table><tr><td valign="top"><b>More Options</b></td><td valign="top"><b>Hide</b></td><td rowspan="20" width="12"></td><td valign="top" rowspan="20" width="405"> ' +
-// new custom text filter/ css / app whitelist tabs
-'<span id="custextheader" title="Click to access the Custom Text Filter" style="font-weight:bold;background:#ECEFF5;border:1 solid"><a href="#">Custom Text Filter</a></span> - ' +
-'<span id="appwhitelistheader"><a title="Click to access the Application Whitelist" href="#">Application Whitelist</a></span> - ' +
-'<span id="custcssheader"><a title="Click to access the Custom CSS BOX" href="#">Custom CSS</a></span><br/>' +
-'<span id="custextdesc" style="background:#ECEFF5;" title="Please note, \'Regular Expressions\' can also be used.">Enter the words or phrases, on separate lines, that you wish to filter from your news feed. (<a title="Help with Custom Text Filter" target="_blank" href="http://www.fbpurity.com/extras.htm#customtextfilter"><b>Text Filter Help</b></a>) <br/></span><span style="display:none" id="custcssdesc">Enter the Custom CSS code you would like applied to your facebook pages. (<a title="Help with Custom CSS" target="_blank" href="http://www.fbpurity.com/css.htm"><b>CSS Help and examples</b></a>)</span><span style="display:none" id="appwhitelistdesc">Enter the numeric application IDs, on separate lines, of the apps whose stories you wish to allow in your news feed (<a title="Help with Application Whitelist" target="_blank" href="http://www.fbpurity.com/whitelist.htm"><b>Whitelist Help</b></a>)</span>' +
-'<textarea style="width:404px;height:275px" id="custextta">cust text filter</textarea><textarea style="display:none;" id="custcssta">Custom CSS</textarea><textarea style="display:none;" id="appwhitelistta">app whitelist</textarea>' +
-//(window.navigator.userAgent.match(/Mozilla\/4\.0 \(compatible\; MSIE 7\.0\; Windows/) ? '' : '<br/> FBP Tip: <a target="_blank" href="http://fbpurity.com/disable-timeline">Want to remove Facebook Timeline? Click here.</a>') +
-
-fbptips[Math.floor(Math.random() * fbptips.length)] +
-
-'<br/><div id="fbpnewsdiv"></div>'+
-'</td></tr>'+
-
-'<tr title="Hiding the sponsored box also hides Sponsored stories in the newsfeed, Suggested Posts, Facebook Offers, the people you may know, people to subscribe to and recommended pages boxes"><td><label style="color:black;font-weight:normal" for="sponsoredbox">Sponsored Box / Stories</label></td><td><input id="sponsoredbox" type="checkbox"></td></tr>'+
-'<tr style="background-color:#ECEFF5 !important" title="Un-Tick this if you dont want FBP to filter out application and game stories"><td><label style="color:black;font-weight:normal" for="filterappmessages">Application + Game Stories</label></td><td><input id="filterappmessages" type="checkbox"></td></tr>'+
-'<tr><td title="The ticker bar is the scrolling newsfeed along the right hand side of your page"><label style="color:black;font-weight:normal" for="happeningnowbar">News Ticker Bar</label></td><td><input id="happeningnowbar" type="checkbox" title="The ticker bar is the scrolling newsfeed at the top right of your page"></td></tr>'+
-//'<tr title="Please note: Choosing this option also hides birthdays and pokes"><td title="This option hides the Events section in the right column beneath the news ticker and also the Events link in the left column. Please note that this option also hides birthdays and pokes in the right hand column"><label style="color:black;font-weight:normal" for="eventsbox">Events Box</label></td><td><input id="eventsbox" type="checkbox"></td></tr>'+
-'<tr style="background-color:#ECEFF5 !important"><td><label style="color:black;font-weight:normal" for="offlinefriends">Offline Friends in Chat</label></td><td><input id="offlinefriends" type="checkbox"></td></tr>'+
-'<tr><td><label style="color:black;font-weight:normal" for="chatbox">Chat Box</label></td><td><input id="chatbox" type="checkbox"></td></tr>'+
-'<tr style="background-color:#ECEFF5 !important" title="This option hides the smileys and replaces them with their text equivalent, if available"><td><label style="color:black;font-weight:normal" for="smileys">Graphical Smileys / Emoticons</label></td><td><input id="smileys" type="checkbox"></td></tr>'+
-'<tr title="This option hides the Notification box that pops up in the bottom left hand corner"><td><label style="color:black;font-weight:normal" for="notificationpopup">Notification Popup Box</label></td><td><input id="notificationpopup" type="checkbox"></td></tr>'+
-'<tr style="background-color:#ECEFF5 !important" title="This option hides Facebook Gifts Links"><td><label style="color:black;font-weight:normal" for="lcgifts">Gifts</label></td><td><input id="lcgifts" type="checkbox"></td></tr>'+
-'<tr title="Hide the Trending Topics / Hashtags box"><td><label style="color:black;font-weight:normal" for="trendingbox">Trending Topics / Hashtags</label></td><td><input id="trendingbox" type="checkbox"></td></tr>'+
-'<tr style="display:none"><td>Beta Tester Box</td><td><input id="betabox" type="checkbox"></td></tr>'+
-
-'<tr><td><b>Further Options</b></td><td><b>Set</b></td></tr>'+
-'<tr style="background-color:#ECEFF5 !important" title="Selecting this option restores the comment button, though submitting a comment will be a 2 step submit process for techical reasons, if you dont like it, untick this box to make it hidden again. Theres a shortcut for submitting a comment when you have the comment button option enabled, and it is to press Tab, then Enter, then Enter again."><td><label style="color:black;font-weight:normal" for="commentbutton">Restore Comment Button</label></td><td><input id="commentbutton" type="checkbox"></td></tr>'+
-'<tr title="Makes 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>'+
-'<tr style="background-color:#ECEFF5 !important" title="Force the newsfeed to be sorted by \'Most Recent\'"><td><label style="color:black;font-weight:normal" for="sortmostrecent">Sort Feed : Most Recent</label></td><td><input id="sortmostrecent" type="checkbox"></td></tr>'+
-'<tr title="Freezes the left column of the newsfeed page in place even when you scroll the page down"><td><label style="color:black;font-weight:normal" for="fixedleftcolumn">Freeze Left Column in Place</label></td><td><input id="fixedleftcolumn" type="checkbox"></td></tr>'+
-'<tr style="background-color:#ECEFF5 !important" title="Lets you view \'Fan Page\' Timeline pages in a single column layout format. N.B. You can also toggle this setting on and off by clicking the \'TL\' button next to the search box"><td><label style="color:black;font-weight:normal" for="timelineonecol">Timeline : Single Column</label></td><td><input id="timelineonecol" type="checkbox"></td></tr>'+
-
-// right column links options
-'<tr title=""><td colspan="2"><p style="margin-top:3px;margin-bottom:3px;font-weight:bold"><a title="Click to open/close the Hide Links in Right Hand Column Options" style="margin-top:2px" href="#" onclick="document.getElementById(\'rightcolopts\').style.display==\'block\' ? (function(){document.getElementById(\'rightcolopts\').style.display=\'none\';document.getElementById(\'fbprightcolopts\').setAttribute(\'class\',\'fbpclosedlist\')})() : (function(){document.getElementById(\'rightcolopts\').style.display=\'block\';document.getElementById(\'fbprightcolopts\').setAttribute(\'class\',\'fbpopenlist\')})();"><span id="fbprightcolopts" class="fbpclosedlist">Hide Links in Right Column</span></a></p><div id="rightcolopts" style="display:none"><table width="100%"><tr><td>Game / App Requests</td><td><input type="checkbox" id="rcgamerequests"></td></tr><tr style="background-color:#ECEFF5 !important"><td>Recommended Pages</td><td><input type="checkbox" id="rcrecommendedpages"></td></tr><tr><td>Suggested Groups</td><td><input type="checkbox" id="rcrelatedgroups"></td></tr><tr style="background-color:#ECEFF5 !important"><td>Pokes</td><td><input type="checkbox" id="rcpokes"></td></tr><tr><td>Events</td><td><input type="checkbox" id="eventsbox"></td></tr><tr style="background-color:#ECEFF5 !important"><td>Friend Requests</td><td><input type="checkbox" id="rcfriendrequests"></td></tr><tr><td>Birthdays</td><td><input type="checkbox" id="rcbirthdays"></td></tr></table></div></td></tr>'+
-
-// left column links options
-'<tr title=""><td colspan="2"><p style="margin-top:3px;margin-bottom:3px;font-weight:bold"><a title="Click to open/close the Hide Links in Left Hand Column Options" style="margin-top:2px" href="#" onclick="document.getElementById(\'leftcolopts\').style.display==\'block\' ? (function(){document.getElementById(\'leftcolopts\').style.display=\'none\';document.getElementById(\'fbpleftcolopts\').setAttribute(\'class\',\'fbpclosedlist\')})() : (function(){document.getElementById(\'leftcolopts\').style.display=\'block\';document.getElementById(\'fbpleftcolopts\').setAttribute(\'class\',\'fbpopenlist\')})();"><span id="fbpleftcolopts" class="fbpclosedlist">Hide Links in Left Column</span></a></p><div id="leftcolopts" style="display:none"><table width="100%"><tr title="This option will hide all links under the PAGES heading"><td>Pages Section</td><td><input type="checkbox" id="lcallpages"></td></tr><tr style="background-color:#ECEFF5 !important"><td>Pages Feed</td><td><input type="checkbox" id="lcpagesfeed"></td></tr><tr><td>Like Pages</td><td><input type="checkbox" id="lclikepages"></td></tr><tr style="background-color:#ECEFF5 !important"><td>Create a Page</td><td><input type="checkbox" id="lccreatepage"></td></tr><tr title="This option will hide all links under the APPS heading"><td>Apps Section</td><td><input type="checkbox" id="lcallapps"></td></tr><tr style="background-color:#ECEFF5 !important"><td>App Center</td><td><input type="checkbox" id="lcappcenter"></td></tr><tr><td>Events</td><td><input type="checkbox" id="lcevents"></td></tr><tr style="background-color:#ECEFF5 !important"><td>Games Feed</td><td><input type="checkbox" id="lcgamesfeed"></td></tr><tr><td>Pokes</td><td><input type="checkbox" id="lcpokes"></td></tr><tr style="background-color:#ECEFF5 !important"><td>Music</td><td><input type="checkbox" id="lcmusic"></td></tr><tr><td>Places Editor</td><td><input type="checkbox" id="lcplaceseditor"></td></tr><tr style="background-color:#ECEFF5 !important" title="This option will hide all links under the GROUPS heading"><td>Groups Section</td><td><input type="checkbox" id="lcallgroups"></td></tr><tr><td>Create Group</td><td><input type="checkbox" id="lccreategroup"></td></tr><tr style="background-color:#ECEFF5 !important" title="This option will hide all links under the INTERESTS heading"><td>Interests Section</td><td><input type="checkbox" id="lcallinterests"></td></tr><tr title="Hide Create Advert / Adverts Manager"><td>Create Advert</td><td><input type="checkbox" id="lcadvertmgr"></td></tr><tr style="background-color:#ECEFF5 !important" title="This option will hide all links under the CONNECT heading" ><td>Connect Section</td><td><input type="checkbox" id="lcconnect"></td></tr><tr><td>Find Friends</td><td><input type="checkbox" id="lcfindfriends"></td></tr><tr style="background-color:#ECEFF5 !important" title="This option will hide all links under the FRIENDS section"><td>Friends Section</td><td><input type="checkbox" id="lcfriends"></td></tr></tr><tr title="This option will hide all links under the DEVELOPER section including Manage Apps"><td>Developer Section</td><td><input type="checkbox" id="lcdeveloper"></td></tr></table></div></td></tr>'+
-
-// fonts and colours section
-'<tr><td colspan="2" align="center"><p style="margin-top:3px;margin-bottom:3px;font-weight:bold"><a title="Click to open/close Font and Colour Options" href="#" style="margin-top:2px" onclick="document.getElementById(\'fontColorSection\').style.display==\'block\' ? (function(){document.getElementById(\'fontColorSection\').style.display=\'none\';document.getElementById(\'fbpfacopts\').setAttribute(\'class\',\'fbpclosedlist\')})() : (function(){document.getElementById(\'fontColorSection\').style.display=\'block\';document.getElementById(\'fbpfacopts\').setAttribute(\'class\',\'fbpopenlist\')})()"><span id="fbpfacopts" class="fbpclosedlist">Font and Colour Options</span></a></p>'+
-'<table id="fontColorSection" style="display:none">' +
-'<tr><td><b>Background Colour</b></td><td><b>Set</b></td></tr><tr style="background-color:#ECEFF5 !important"><td title="Enter a colour name e.g Black,White,Blue,Red,Green etc (You can also use CSS/HTML colour codes)"><input style="width:90px" id="fontbgcolour" value="black" type="color"></td><td><input id="fontbgcolourfix" type="checkbox"></td></tr>' +
-'<tr><td><b>Font Colour</b></td><td><b>Set</b></td></tr><tr style="background-color:#ECEFF5 !important" title="Enter a colour name e.g Black,White,Blue,Red,Green etc (You can also use CSS/HTML colour codes)"><td><input style="width:90px" id="fontcolour" value="white" type="color"></td><td><input id="fontcolourfix" type="checkbox"></td></tr>' +
-'<tr><td><b>Font</b></td><td><b>Set</b></td></tr><tr style="background-color:#ECEFF5 !important" title="Enter a font name e.g Arial,Helvetica,Verdana,Courier, etc of a font you have installed on your computer. (If the font name has a space in it, put quote marks around the name)"><td><input style="width:90px" id="fbpfont" value="verdana"></td><td><input id="fbpfontfix" type="checkbox"></td></tr>' +
-'<tr><td><b>Font Size</b></td><td><b>Set</b></td></tr><tr style="background-color:#ECEFF5 !important"><td><input style="text-align:right;width:40px" id="fontsize" type="number" value="14" min="8" max="60"> px</td><td><input id="fontfix" type="checkbox"></td></tr>' +
-'</table></td></tr>'+
-
-'</table>' +
-
-'<p/><p/><input id="fbpsavesettings" type="button" onclick="this.disabled=1;" value="Save and Close" class="inputsubmit uiButton uiButtonConfirm uiButtonMedium"> <input onclick="document.getElementById(\'fbpoptsdiv\').style.display=\'none\'" id="closefbpsettings" type="button" value="Cancel" class="inputsubmit uiButton uiButtonConfirm uiButtonMedium">'+
-'<p>If you like F.B. Purity and would like to show your appreciation for all the work<br/>I have put into it and also support future development, please <a href="http://donate.fbpurity.com/">make a donation</a>.<br/></p>' +
-
-'<table><tr><td><a target="_blank" href="http://donate.fbpurity.com"><img style="margin-top:3px" border="0" height="47" width="160" src="https://www.paypal.com/en_US/GB/i/btn/btn_donateCC_LG.gif"></a></td><td> </td><td>Please tell all your friends about FBP too</td><td><a href="http://www.facebook.com/sharer.php?u=http://is.gd/fbpcnet" title="Share on Facebook" target="_blank"><img style="vertical-align:bottom" width="123" height="22" border="0" src="https://sites.google.com/site/st333v/fbp-1/shareonfacebook.gif" alt="Share on Facebook"></a></td></tr></table>'+
-'<br/><form><textarea id="fbpsettingstext" style="display:none"></textarea></form></td></tr></table>'+
-'<div><div style="float:left;margin:10px"><a id="exportsettingslink" href="javascript:;">Export Settings</a> / <a id="importsettingslink" href="javascript:;">Import Settings</a> / <a title="Help with Exporting and Importing Settings" target="_blank" href="http://www.fbpurity.com/faq.htm#importexport"><b>?</b></a></div><div style="float:right;margin:10px"></div></div>';
-
-var fbpfirstrunhtml='<div id="fbpfirstrundiv" style="width:600px;border:solid 3px;margin-left:150px;padding:8px;font-size:14px;font-family:verdana;background:white !important">'+
-'<table width="100%"><tr><td width="66%" style="text-align:right"><a target="_blank" href="http://www.fbpurity.com"><img style="margin-left:auto;margin-right:auto" border="0" src="https://fbcdn-photos-a.akamaihd.net/hphotos-ak-ash4/379777_10150515557207559_408502197558_10866589_209695435_a.jpg"></a></td><td width="33%" valign="top" style="text-align:right"><a href="#" title="Close" onclick="document.getElementById(\'fbpfirstrundiv\').style.display=\'none\'"><b>X</b></a></td></tr></table>'+
-'<br/>'+
-'<div id="firstpara"><p>Hello there! It looks like this is your first time running F.B. Purity <a title="If you are repeatedly seeing this message, then it means FBP cannot save its settings due to a browser restriction, please click here for the solution" href="http://www.fbpurity.com/faq.htm#troubleshooting"><b>*</b></a></p>'+
-'<p>The functionality of this extension is closely linked to the current design of the Facebook website. When Facebook change the design or functionality of the site, this can sometimes stop F.B. Purity from working correctly.</p>' +
-'<p>In order to keep up to date with news of any changes that may break F.B. Purity and for news of new versions of F.B Purity that fix any problems or add new functionality, it is extremely important that you click the like button for the F.B. Purity Fan page on Facebook (below). By doing this you should receive news of updates directly in your newsfeed, and you will also be able to leave feedback about the extension there too.<p/><p><b>Update:</b> Please note, due to Facebook censorship of the FBP fan page, you now also need to subscribe to notifications from the Fan page, otherwise you wont see the FBP news in your newsfeed. To do this, go to the FBP Fan Page, hover over the "Like" button then select "Get Notifications" and you will be notified whenever there is an important update.</p>'+
-'<div><p><b>First Step:</b> Click Like: <iframe src="https://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Ffluffbustingpurity&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>'+
-'<p></p><p><b>Next Step:</b> <a onclick="document.getElementById(\'firstpara\').style.display=\'none\';document.getElementById(\'secondpara\').style.display=\'block\';" href="javascript:;">Click here for instructions on how to use F.B. Purity</a></p></div>'+
-
-'<div id="secondpara" style="display:none"><p>To change F.B. Purity'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/>'+
-'<p>If you have any problems with F.B. Purity, please check out the <a target="_blank" href="http://www.fbpurity.com/#troubleshooting">F.B. Purity Troubleshooting Guide / Help Page</a></p>'+
-'<p>If you have any questions about F.B. Purity, please first read the <a target="_blank" href="http://www.fbpurity.com/faq.htm">F.B. Purity FAQ (Frequently Asked Questions)</a> as your questions are most likely answered there.</p>'+
-
-'<p>If you like F.B. Purity, please show your support by <a target="_blank" href="http://www.fbpurity.com/donate.htm">Donating</a>, as developing, maintaining and supporting this project is an awful lot of work, and I dont get paid for this. Please also tell all your friends about F.B. Purity too.</p>'+
-'<p>Thanks!</p>'+
-'<p>Steve - The Developer of <a target="_blank" href="http://www.fbpurity.com">F.B. (Fluff Busting) Purity</a></p>'+
-'<table width="100%"><tr><td style="text-align:center"><a onclick="document.getElementById(\'fbpfirstrundiv\').style.display=\'none\'" href="#">Close</a></td></tr></table></div>'+
-'</div>';
-
-function hideotherdivs(e) {
- divname=e.target.parentNode.id.split(/header/)[0];
- var boxlist="custext,appwhitelist,custcss";
- boxarr=boxlist.split(',');
- for (i in boxarr)
- if(boxarr[i]==divname) {
- document.getElementById(divname + "header").setAttribute('style','background:#ECEFF5; font-weight:bold; font-size:15; border:1 solid');
- document.getElementById(divname + "desc").setAttribute('style','display:block;background:#ECEFF5;');
- document.getElementById(divname + "ta").setAttribute('style','display:block;width:404px;height:275px');
- }
- else {
- document.getElementById(boxarr[i] + 'header').setAttribute('style','background:white;font-weight:normal;font-size:14;border:0');
- document.getElementById(boxarr[i] + 'desc').setAttribute('style','display:none');
- document.getElementById(boxarr[i] + 'ta').setAttribute('style','display:none;');
- }
-}
-
-function importsettingsbasic(ev) {
-
- ev.preventDefault();
- fbpsettingstext=prompt('F.B. Purity Settings Importer\n\nPaste in your saved FBP settings text, then click OK.')
-
- if(fbpsettingstext==null)
- return;
-
- if(!fbpsettingstext.length) {
- window.alert('You didnt enter valid settings text');
- return;
- }
- else {
- try {
- JSON.parse(fbpsettingstext);
- }
- catch(e) {
- window.alert('Error, settings text malformed, not valid. Import failed!');
- return;
- }
- fbpsavevalue('fbpoptsjson-' + currentuserid,fbpsettingstext);
-
- window.alert('Import Successful. FBP Settings have been updated! Page will now reload.');
-
- //close prefs screen
- document.getElementById('fbpoptsdiv').style.display='none';
-
- //reload page to refresh preferences
- window.location.reload(true);
- }
-}
-
-function exportsettingsbasic(ev) {
- ev.preventDefault();
- exportsettingsbasic2();
-}
-
-// figure out how to use callbacks, may be a better solution here....
-
-function exportsettingsbasic2(opts) {
- document.getElementById('fbpsettingstext').setAttribute('style','display:block;width:600px;height:220px');
- var exporttext;
- if(!opts && opts!='') {
- exporttext=fbploadvalue('fbpoptsjson-' + currentuserid,exportsettingsbasic2);
- if(exporttext==-999)
- return
- }
- else
- exporttext=opts;
-
- if ((typeof(exporttext)=='undefined') || (exporttext.length =="")) {
- exporttext=fbploadvalue('fbpoptsjson',exportsettingsbasic2);
- if(exporttext==-999)
- return;
- }
- document.getElementById('fbpsettingstext').textContent=exporttext;
-
- window.alert('Copy the FBP settings text from the text box below and save it in a document or text file. If you ever need to restore your settings from that file, simply copy the text from the file, click the Import Settings link and paste the text in.');
- // autoselect the text in the textarea
- el=document.getElementById('fbpsettingstext');
- var range;
- if ((/textarea/i.test(el.tagName)) || ((/input/i.test(el.tagName)) && (/text/i.test(el.type)))) {
- el.select();
- } else if (!!window.getSelection) { // FF, Safari, Chrome, Opera
- var sel = window.getSelection();
- range = document.createRange();
- range.selectNodeContents(el);
- sel.removeAllRanges();
- sel.addRange(range);
- } else if (!!document.selection) { // IE
- document.selection.empty();
- range = document.body.createTextRange();
- range.moveToElementText(el);
- range.select();
- }
-}
-
-function get_cookie ( cookie_name )
-{
- var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
- if ( results )
- return ( unescape ( results[2] ) );
- else
- return null;
-}
-
-function set_cookie (name,value) {
- document.cookie = name+ "=" + escape(value)+ ';expires=01/04/2099 00:00:00';
-}
-
-// check for GM_set/get API
-var isgmapi, islocstor;
-try {
- if(typeof(GM_setValue)!='undefined') {
- GM_setValue('test',1)
- if ( GM_getValue('test')==1)
- isgmapi=1;
- else
- isgmapi=0;
- }
- else
- isgmapi=0;
-}
-catch (e) {
- console.log(e);
- isgmapi=0;
-}
-// check for localstorage
-try {
- if(typeof(window.localStorage)!='undefined')
- islocstor=1;
- else
- islocstor=0;
- }
-catch(e) {
- islocstor=0;
-}
-
-function fbpsavevalue(name,value){
- try {
- if(isgmapi) {
- GM_setValue(name,value);
- }
- else if(ischrome) { // ischrome
- chrome.extension.sendRequest({method: "setLocalStorage", key: name, value: value}, function(response) {
- ;//console.log(response.data);
- });
- }
- else if(issafari) { //(typeof(window.navigator.vendor)!='undefined') && (window.navigator.vendor.match(/Apple Computer, Inc\./)) && window.navigator.userAgent.match(/Version\/5\./)
- safari.self.tab.dispatchMessage("setLocalStorage",{key: name, value: value});
- /*function replyToMessage(response) {
- if (response.name === "data") {
- console.log('safari save value response:' + response.message);
- //if((typeof(response.message) !='undefined') && response.message.match(/\"filterappmessages\"/)) {
- // window.localStorage[name]=response.message;
- // window.location.reload();
- //}
- }
- }*/
- // register for message events
- //safari.self.addEventListener("message", replyToMessage, false);
- }
- else if(isopera) { //window.navigator.userAgent.match(/Opera/)
- widget.preferences[name]=value;
- }
- /* if i support localstorage and cookie, the user will repeatedly get the new user screen when the cookies are cleared, so lets comment this out
- else if(locstor) {
- window.localStorage[name]=value;
- }
- else
- set_cookie(name,value);
- */
- }
- catch (e) {
- //console.log(e);
- if(islocstor)
- window.localStorage[name]=value;
- else
- set_cookie(name,value);
- }
-}
-
-function fbploadvalue(name,funct){
- if(debug)
- console.trace();
- //console.log('entering function : ' + arguments.callee.name);
-
- try {
- if(isgmapi) {
- val = GM_getValue(name);
- }
- else if(ischrome) {
- // Chrome Extension
- chrome.extension.sendRequest({method: "getLocalStorage", key: name}, function(response) {
- //fbpdynamicreload(response.data); // we should maybe figure a way of doing this event driven
- if(funct) {
- if(debug)
- console.log("we in call back, and heres the data: " + response.data);
- if((typeof(response)=='undefined') || (typeof(response.data)=='undefined'))
- funct('');
- else
- funct(response.data);
- }
- //}
- });
- val=-999;
- if(debug)
- console.log('name: ' + name + ' value' + val);
- }
- else if(issafari) {
- // Safari Extension
- safari.self.tab.dispatchMessage("getLocalStorage",name);
- function replyToMessage(response) {
- if(debug)
- console.log(response.message);
- if(funct) {
- if(debug)
- console.log("we in call back, and heres the data: " + response.message);
- if(typeof(response.message)=='undefined')
- funct('');
- else
- funct(response.message);
- }
- }
- // register for message events
- safari.self.addEventListener("message", replyToMessage, false);
- val=-999;
- }
- else if(isopera) {
- if((typeof(widget.preferences[name]) !='undefined') ) {
- val = widget.preferences[name];
- //fbpdynamicreload();
- }
- else val='';
- }
- }
- catch (e) {
- console.log(e);
- if(islocstor)
- val=window.localStorage[name];
- else
- val=get_cookie(name);
- }
- return val;
-}
-
-function initundef() {
- if(typeof (fbpoptsobj.filterappmessages) =='undefined')
- fbpoptsobj.filterappmessages=1;
- if(typeof (fbpoptsobj.sortmostrecent) =='undefined')
- fbpoptsobj.sortmostrecent=0;
- if(typeof (fbpoptsobj.fixarticleredirects) =='undefined')
- fbpoptsobj.fixarticleredirects=1;
-}
-
-function fbpgetprefs(opts) {
- if(debug) {
- console.trace();
- console.log(arguments.callee.length);
- console.log(opts);
- //console.log('entering function : ' + arguments.callee.name);
- }
-
- var optsdump;
- if(typeof(opts)!='undefined') {
- if(opts && opts.length) {
- if(debug)
- console.log("opts=" + opts);
- optsdump=opts;
- try {
- fbpoptsobj=JSON.parse(optsdump);
- }
- catch(e) {
- console.log('error reading json in fbpgetprefs');
- console.dir(e);
- return;
- }
- initundef();
- initstage2();
- finalstage();
- }
- else {
- if(debug)
- console.log('are we at the top?');
- if(!issafari) // because getting vars out of localstorage is not working in safari, we not checking for first run
- fbpfirstruncheck();
- fbpoptsobjinit();
- initundef();
- initstage2();
- finalstage();
- }
- }
- else {
- //console.log("user" + currentuserid);
- optsdump = fbploadvalue('fbpoptsjson-' + currentuserid,fbpgetprefs);//'fbpgetprefs'
- if(optsdump!=-999) { //if(!isasync) {
- if(optsdump && optsdump.length) {
- try{
- fbpoptsobj=JSON.parse(optsdump);
- }
- catch(e) {
- fbpoptsobj=JSON.parse(decodeURIComponent(optsdump)); // this line is to make it compatible with older firefox extension which urlencoded/decoded saved values inside the extension
- }
- initundef();
- initstage2();
- finalstage();
- }
- else {
- if(debug)
- console.log('are we at the bottom?');
- if(!issafari) // because getting vars out of localstorage is not working in safari, we not checking for first run
- fbpfirstruncheck();
- fbpoptsobjinit();
- initundef();
- initstage2();
- finalstage();
- }
- }
- }
- //unsafeWindow.console.log(typeof(optsdump) + ' xxx ' + optsdump + 'xxx' + optsdump.length);
-}
-
-function fbpfirstruncheck(result) {
-
- if(debug) {
- console.trace();
- console.log('firstrun? ' + result);
- }
- //console.log('entering function : ' + arguments.callee.name);
- var fbpfirstrun;
- //alert("firstres = " + result);
- //if(result || (result=='')) { was working on chrome and firefox and opera?
- if(typeof(result)!='undefined') {
- fbpfirstrun=result;
- }
- else
- fbpfirstrun=fbploadvalue('fbpfirstrun',fbpfirstruncheck);
- if(fbpfirstrun==-999)
- return;
-
- //alert("secondres = " + fbpfirstrun); // make sure user is logged in (pageLogo element is there)
- if (((fbpfirstrun=='') || (typeof(fbpfirstrun)=='undefined') || (fbpfirstrun==null)) && (!(window.location.href.match(/^https?:\/\/apps\.facebook|^https?:\/\/blog\.facebook|^https?:\/\/secure\.facebook/)))) {
- if(!document.getElementById('fbpfirstrundiv') && document.getElementById('blueBar') && document.getElementById('pageLogo')) {
- ph=document.getElementById('blueBar'); //pageHead
- firstrundiv=document.createElement('div');
- firstrundiv.innerHTML=fbpfirstrunhtml;
- if(ph.firstChild)
- ph.firstChild.parentNode.insertBefore(firstrundiv, ph.firstChild.nextSibling);
- fbpsavevalue('fbpfirstrun',new Date() + "");
- }
- }
-}
-
-function checkifupdaterequired(currver,latestver) {
- if(debug)
- console.trace();
- //console.log('entering function : ' + arguments.callee.name);
-
- if (currver && latestver) {
- var fbpupdatehtml = "**<a title='An update is available for F.B. Purity (v" + latestver +").\nClick here to begin the upgrade process' href='http://www.fbpurity.com/install.htm?v=" + currver + "'><b>Update</b></a>** ";
- if (currver==latestver)
- return; //window.alert('Congrats! You have the latest version of FB Purity :)');
- else {
- cvpart1=currver.split(/\./)[0];
- cvpart2=currver.split(/\./)[1];
- cvpart3=currver.split(/\./)[2];
- lvpart1=latestver.split(/\./)[0];
- lvpart2=latestver.split(/\./)[1];
- lvpart3=latestver.split(/\./)[2];
- if(cvpart1<lvpart1) {
- if(document.getElementById('fbpupgradeinfo'))
- document.getElementById('fbpupgradeinfo').innerHTML=fbpupdatehtml;
- }
- else if (cvpart1 == lvpart1) {
- if(cvpart2 < lvpart2) {
- if(document.getElementById('fbpupgradeinfo'))
- document.getElementById('fbpupgradeinfo').innerHTML=fbpupdatehtml;
- }
- else if (cvpart2 == lvpart2) {
- if(cvpart3 < lvpart3)
- if(document.getElementById('fbpupgradeinfo'))
- document.getElementById('fbpupgradeinfo').innerHTML=fbpupdatehtml;
- }
- }
-
- }
- }
-}
-
-function checkupdatefeed(result) {
- if(debug)
- console.trace();
- //console.log('entering function : ' + arguments.callee.name);
-
- var fbplastupdatecheck;
- if(result || (result=='')) {
- if(debug)
- console.log('fbplastupdatecheck val = ' + result);
- fbplastupdatecheck=result;
- if(typeof(fbplastupdatecheck)=='undefined')
- fbplastupdatecheck='';
- }
- else
- fbplastupdatecheck=fbploadvalue('fbplastupdatecheck',checkupdatefeed);
- if(fbplastupdatecheck==-999)
- return;
-
- if(debug)
- console.log('fbplastupdate=' + fbplastupdatecheck);
-
- var currtime = new Date().getTime(); // creates a new Date representing today
- var currver = fbpVersion.replace('v','');
-
- if( (typeof(fbplastupdatecheck)!='undefined') && (fbplastupdatecheck != '') && (fbplastupdatecheck!=null)) {
- var fbplastupdatecheckdate=fbplastupdatecheck.split(/\:/)[0];
- var fbplastupdatecheckver=fbplastupdatecheck.split(/\:/)[1];
- if((typeof(fbplastupdatecheckver) !='undefined') && (!fbplastupdatecheckver.match(/\./)))
- fbplastupdatecheckver='';
- if(debug)
- console.log('lastupdate check version= '+ fbplastupdatecheckver);
- if((typeof(fbplastupdatecheckdate) !='undefined') && fbplastupdatecheckdate.match(/^\d+$/)) {
- //To compute the difference, convert both to their millisecond representations and subtract:
- var diff = currtime - fbplastupdatecheckdate;
- //In this case the difference will be negative, as d1 preceeds d2.
- var num_days = (((diff / 1000) / 60) / 60) / 24;
- if(num_days < 1) {
- //var cachedupdatever=fbploadvalue(fbpupdatever);
- if((typeof(fbplastupdatecheckver)!='undefined') && (fbplastupdatecheckver != ''))
- checkifupdaterequired(currver,fbplastupdatecheckver);
- return;
- }
- }
- else {
- // time value is corrupted somehow?
- if (typeof(unsafeWindow) =='undefined')
- ;//console.log('error: fbplastupdatecheck= ' + fbplastupdatecheck);
- else
- ;//unsafeWindow.console.log('error: fbplastupdatecheck= ' + fbplastupdatecheck);
- return;
- }
- }
-
- //fbpsavevalue('fbplastupdatecheck',currtime + '');
- var http = new window.XMLHttpRequest();
- var url = window.location.protocol + "//www.facebook.com/feeds/page.php?id=186105101490362&format=json"; // https://www.facebook.com/pages/FB-Purity-Updates/186105101490362
- http.open("GET", url, true);
- //http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
- //http.setRequestHeader("Content-length", params.length);
- //http.setRequestHeader("Connection", "close");
-
- http.onreadystatechange = function() {
- if(http.readyState == 4 && http.status == 200) {
- //console.log(http.responseText);
- try {
- var fbpfeed = JSON.parse(http.responseText);
- }
- catch (e) {
- http=fbpfeed=null;
- return;
- }
- if(fbpfeed.entries[0].title.length && fbpfeed.entries[0].title.match(/F.B. Purity v(\d{1,}\.\d{1,}\.\d{1,}) /))
- latestver=fbpfeed.entries[0].title.match(/F.B. Purity v(\d{1,}\.\d{1,}\.\d{1,}) /)[1];
- else
- return;
- //var x = new Date (fbpfeed.entries[0].published);
- //newsa.setAttribute('title', "Published - " + x.toLocaleDateString());
- //alert(currver + ' ' + latestver);
- fbpsavevalue('fbplastupdatecheck', currtime + ':' + latestver);
- checkifupdaterequired(currver,latestver);
- http=null;
- }
- }
- http.send();
-}
-
-if (!issafari) // workaround for bug in message passing in safari extension for getting fbpprefs (the messages were crossing over to the wrong locations)
-window.setTimeout(function() {
- checkupdatefeed();
-}, 3000); // wait a bit, to insure fbpinfobar will be there...
-
-
-function fbppopulateprefs() {
- if(debug)
- console.trace();
- //console.log('entering function : ' + arguments.callee.name);
-
- // if options screen has been wiped out, re-insert it
- if(!document.getElementById('fbpoptsdiv') && document.getElementById('content') ) {
- document.getElementById('content').appendChild(optsdiv);
- document.getElementById('fbpsavesettings').addEventListener('click',fbpsavesettings,false);
-
- document.getElementById('exportsettingslink').addEventListener('click',exportsettingsbasic,false);
- document.getElementById('importsettingslink').addEventListener('click',importsettingsbasic,false);
-
- document.getElementById('custextheader').addEventListener('click',hideotherdivs,false);
- document.getElementById('appwhitelistheader').addEventListener('click',hideotherdivs,false);
- document.getElementById('custcssheader').addEventListener('click',hideotherdivs,false);
- }
-
- // fill out the preferences form with current settings
- for(var i=0;i<fbpoptsarr.length;i++) {
- if(document.getElementById(fbpoptsarr[i])) {
- if(fbpoptsobj[fbpoptsarr[i]]==1) {
- document.getElementById(fbpoptsarr[i]).checked=true;
- //unsafeWindow.console.log (filterapptext, fbpoptsarr[i] + ' ' + ' ' + fbpoptsobj[fbpoptsarr[i]]);
- }
- else
- document.getElementById(fbpoptsarr[i]).checked=false;
- }
- }
- if(fbpoptsobj.customtextfilter && fbpoptsobj.customtextfilter.length) {
- document.getElementById('custextta').value=fbpoptsobj.customtextfilter.replace(/\,/g,"\n");
- //unsafeWindow.console.log(fbpoptsobj.customtextfilter);
- }
- else
- document.getElementById('custextta').value='';
-
- if(fbpoptsobj.userappwhitelist && fbpoptsobj.userappwhitelist.length) {
- document.getElementById('appwhitelistta').value=fbpoptsobj.userappwhitelist.replace(/\,/g,"\n");
- //unsafeWindow.console.log(fbpoptsobj.userappwhitelist);
- }
- else {
- document.getElementById('appwhitelistta').value='';
- }
-
- if(fbpoptsobj.fontsize)
- document.getElementById('fontsize').value=fbpoptsobj.fontsize;
-
- if(fbpoptsobj.fontcolour)
- document.getElementById('fontcolour').value=fbpoptsobj.fontcolour;
-
- if(fbpoptsobj.fontbgcolour)
- document.getElementById('fontbgcolour').value=fbpoptsobj.fontbgcolour;
-
- if(fbpoptsobj.fbpfont)
- document.getElementById('fbpfont').value=fbpoptsobj.fbpfont;
-
- if(fbpoptsobj.fbpcustomcss && (typeof(fbpoptsobj.fbpcustomcss) != 'undefined')) {
- document.getElementById('custcssta').value=fbpoptsobj.fbpcustomcss;
- //unsafeWindow.console.log(fbpoptsobj.fbpcustomcss);
- }
- else
- document.getElementById('custcssta').value='';
-}
-
-function fbpsavesettings(ev) {
-
- for(var i=0;i<fbpoptsarr.length;i++) {
-
- if(document.getElementById(fbpoptsarr[i]) && document.getElementById(fbpoptsarr[i]).checked==true)
- fbpoptsobj[fbpoptsarr[i]]=1;
- else
- fbpoptsobj[fbpoptsarr[i]]=0;
- }
-
- if(document.getElementById('custextta').value.length) {
- //fbpoptsobj.customtextfilter=document.getElementById('customtextfilter').value.replace(/, *$/,'','g'); // replace trailing comma and spaces
- tempcustomtextfilter=document.getElementById('custextta').value.replace(/[\r\n|\r|\n]/g,"\,").replace(/\,{1,}/g,'\,').replace(/,$/,'').replace(/^,/,'');
- fbpoptsobj.customtextfilter='';
- ctfarr=tempcustomtextfilter.split(',');
- //for(i=ctfarr.length-1;i>=0;i--)
- for(i=0;i<ctfarr.length;i++)
- if (ctfarr[i].replace(/^ {1,}$/,'')!='')
- fbpoptsobj.customtextfilter+=ctfarr[i] + ','; // strip out lines that are just spaces.
-
- fbpoptsobj.customtextfilter=fbpoptsobj.customtextfilter.replace(/,$/,''); // strip trailing comma
-// alert(fbpoptsobj.customtextfilter);
- }
- else
- fbpoptsobj.customtextfilter='';
-
- if(document.getElementById('appwhitelistta').value.length) {
- fbpoptsobj.userappwhitelist=document.getElementById('appwhitelistta').value.replace(/ /g,'').replace(/[\r\n|\r|\n]/g,"\,").replace(/\,{1,}/g,'\,').replace(/,$/,'').replace(/^,/,'');
- //alert(fbpoptsobj.userappwhitelist);
- }
- else
- fbpoptsobj.userappwhitelist='';
-
- // begin new custom css box
- if(document.getElementById('custcssta').value.length) {
- fbpoptsobj.fbpcustomcss=document.getElementById('custcssta').value;
- }
- else
- fbpoptsobj.fbpcustomcss='';
- // end new custom css box
-
- fbpoptsobj.fontsize=document.getElementById('fontsize').value;
- fbpoptsobj.fontcolour=document.getElementById('fontcolour').value;
- fbpoptsobj.fontbgcolour=document.getElementById('fontbgcolour').value;
- fbpoptsobj.fbpfont=document.getElementById('fbpfont').value;
-
- //save to prefs obj to localstorage
- fbpsavevalue('fbpoptsjson-' + currentuserid, JSON.stringify(fbpoptsobj));
-
- //console.log(JSON.stringify(fbpoptsobj));
-
- //close prefs screen
- document.getElementById('fbpoptsdiv').style.display='none';
-
- //reload page to refresh preferences
- window.location.reload(true);
-
- // Dynamically update the page instead of reloading the whole page, only problem is if the page contains many posts, this is very slow.
- /*
- document.getElementById("fbpsavesettings").disabled=false;
- fbpgetprefs();
- resetclasses(); // need to also reset other filters and css
- initstage2();
- //updateblockedcount(); // doesnt seem to do anything and clear the shizzle, should automatically update it. (we are getting nodes with 2 classes fbpnormal and fbpblocked
- cleartheshizzle(document);
- */
-}
-
-function fbpoptsobjinit() {
- if(debug)
- console.trace();
- //console.log('entering function : ' + arguments.callee.name);
-
- // set up default options
- fbpoptsobj.filterappmessages=1;
- fbpoptsobj.becamefriends=1;
- fbpoptsobj.becamefan=1;
- fbpoptsobj.joinedgroup=1;
- fbpoptsobj.attendevent=1;
- fbpoptsobj.attendedevent=1;
- fbpoptsobj.createdevent=0;
-
- fbpoptsobj.commentlikeslink=0;
- fbpoptsobj.commentwall=0;
- fbpoptsobj.commentgroupwall=0;
- fbpoptsobj.commentpagewall=0;
- fbpoptsobj.commenteventwall=0;
- fbpoptsobj.updatedprofile=0;
- fbpoptsobj.changedprofilepic=0;
- fbpoptsobj.changedrelationship=0;
-
- fbpoptsobj.uploadedphoto=0;
- fbpoptsobj.sharedphoto=0;
- fbpoptsobj.uploadedvideo=0;
- fbpoptsobj.taggedinvideo=0;
- fbpoptsobj.postednote=0;
- fbpoptsobj.taggedinnote=0;
- fbpoptsobj.postedlink=0;
- fbpoptsobj.readarticle=0;
- fbpoptsobj.checkedin=0;
-
- fbpoptsobj.suggestionsbox=0;
- fbpoptsobj.connectbox=0;
- fbpoptsobj.sponsoredbox=1;
- fbpoptsobj.pokebox=0;
- fbpoptsobj.happeningnowbar=0;
- fbpoptsobj.betabox=0;
- fbpoptsobj.commentbutton=0;
- fbpoptsobj.offlinefriends=1;
-
- fbpoptsobj.requestsbox=0;
- fbpoptsobj.eventsbox=0;
- fbpoptsobj.questionsbox=0;
- fbpoptsobj.chatbox=0;
- fbpoptsobj.pagestory=0;
- fbpoptsobj.trendingbox=0;
-
- //fbpoptsobj.commentslikestopnews=0;
- fbpoptsobj.recentactivity=0;
-
- fbpoptsobj.fontsize='13';
- fbpoptsobj.fontfix='0';
- fbpoptsobj.fontcolour='';
- fbpoptsobj.fontcolourfix=0;
- fbpoptsobj.fontbgcolour='';
- fbpoptsobj.fontbgcolourfix=0;
- fbpoptsobj.fbpfont='';
- fbpoptsobj.fbpfontfix=0;
-
- fbpoptsobj.sortmostrecent=0;
- fbpoptsobj.fixarticleredirects=1;
- fbpoptsobj.timelineonecol=0;
-
- // left hand column options
- fbpoptsobj.lcadvertmgr=0;
- fbpoptsobj.lcconnect=0;
- fbpoptsobj.lcallpages=0;
- fbpoptsobj.lcpagesfeed=0;
- fbpoptsobj.lclikepages=0;
- fbpoptsobj.lcallapps=0;
- fbpoptsobj.lcappcenter=0;
- fbpoptsobj.lcevents=0;
- fbpoptsobj.lcgamesfeed=0;
- fbpoptsobj.lcpokes=0;
- fbpoptsobj.lcmusic=0;
- fbpoptsobj.lcplaceseditor=0;
- fbpoptsobj.lcallgroups=0;
- fbpoptsobj.lcallinterests=0;
- fbpoptsobj.lcfindfriends=0;
- fbpoptsobj.lccreatepage=0;
- fbpoptsobj.lccreategroup=0;
- fbpoptsobj.lcdeveloper=0;
- fbpoptsobj.lcfriends=0;
- fbpoptsobj.lcgifts=0;
-
- // right hand column options
- fbpoptsobj.rcrecommendedpages=0;
- fbpoptsobj.rcrelatedgroups=1;
- fbpoptsobj.rcpokes=0;
- fbpoptsobj.rcbirthdays=0;
- fbpoptsobj.rcfriendrequests=0;
- fbpoptsobj.rcgamerequests=0;
-
- // Begin new options 28th jan 2013
- fbpoptsobj.upcomingevents=0;
- fbpoptsobj.sharedevent=0;
-
- fbpoptsobj.sharedpage=0;
- fbpoptsobj.likedlink=0;
- fbpoptsobj.commentedlink=0;
- fbpoptsobj.likepagebutton=0;
- fbpoptsobj.hideallphotos=0;
- fbpoptsobj.taggedphoto=0;
- fbpoptsobj.likedphoto=0;
- fbpoptsobj.commentedphoto=0;
-
- fbpoptsobj.sharedvideo=0;
- fbpoptsobj.likedvideo=0;
- fbpoptsobj.commentedvideo=0;
- fbpoptsobj.youtubevideo=0;
-
- fbpoptsobj.sharedstatus=0;
- fbpoptsobj.likedstatus=0;
- fbpoptsobj.commentedstatus=0;
- fbpoptsobj.taggedstatus=0;
- fbpoptsobj.smileys=0;
- fbpoptsobj.notificationpopup=0;
-
- fbpoptsobj.hidealllinks=0;
- fbpoptsobj.hideallvideos=0;
- fbpoptsobj.fixedleftcolumn=1;
- // End new options 28th jan 2013
-
- fbpoptsobj.customtextfilter='';
- fbpoptsobj.userappwhitelist='';
- fbpoptsobj.fbpcustomcss='';
-
- fbpoptsobj.stickerpacks='';
-
-}
-
-// APPLICATION WHITELIST
-// ---------------------
-
-// If you would like to edit the list of applications in the user whitelist,
-// theres detailed instructions here: http://whitelist.fbpurity.com
-
-var defaultappwhitelist = "6628568379,115463795461,48119224995,5895217474,56212371378,146139331013,2254487659,2915120374,74769995908,4620273157,14405921260,10754253724,2483740875,22950410511,43769862066,2550392059,8109791468,2238752371,21370137768,6195724695,6694405826,2231777543,53702860994,20407635301,38125372145,56137638329,10732101402,16297770890,2877035514,41158896424,72687635881,350685531728,30713015083,111527682205237,121958126090,2330519541,49340319393,26463759431,21810043296,24420472648,183319479511,189818072392,302006227267,90376669494,108160725869250,39010226174,247431880944,66746580154,96105046534,143907478979139,146563558702544,131289390231340,9953271133,45439413586,131732509879,23723376453,76456527540,105130332854716,27694818115,67878695711,124024574287414,79763977758,139682082719810,122580857763901,24553799497,159348674082705,112618498804176,148061315211358,104142802965358,149588628439275,7933375107,135892916448833,48505437520,198446803501767,193278124048833,165907476854626,213546525407071,531615603522381,149859461799466,178645865537776,220353874751486";
-
-// the application ids in the default app whitelist above belong to, in order:
-// 6628568379 = facebook iphone application
-// 115463795461 = selective twitter
-// 48119224995 = tumblr
-// 5895217474 = digsby
-// 56212371378 = tweetdeck
-// 146139331013 = tweetdeck for iphone
-// 2254487659 = facebook for blackberry
-// 2915120374 = facebook mobile widget
-// 74769995908 = facebook for android
-// 4620273157 = facebook for palm
-// 14405921260 = facebook for motorola (motoblur)
-// 10754253724 = iphoto uploader
-// 2483740875 = picasa uploader
-// 22950410511 = sprint/samsung? photo/video uploader
-// 43769862066 = SonyEricsson
-// 2550392059 = MusicPlayer
-// 8109791468 = Status Shuffle
-// 2238752371 = Facebook Exporter for iPhoto
-// 21370137768 = official flickr application
-// 6195724695 = Windows Phone
-// 6694405826 = Posterous
-// 2231777543 = Twitter
-// 53702860994 = LG Mobile
-// 20407635301 = Snaptu
-// 38125372145 = SonyEricsson Panel
-// 56137638329 = Nokia
-// 10732101402 = ping.fm
-// 16297770890 = 3Skypephone 'S2'
-// 2877035514 = Gwibber
-// 41158896424 = HTC Sense
-// 24420472648 = HTC Sense
-// 72687635881 = Samsung Mobile
-// 350685531728 = facebook for android
-// 30713015083 = windows live messenger
-// 111527682205237 = O2 social link
-// 121958126090 = LG Phone
-// 2330519541 = Bloom photo uploader
-// 49340319393 = Ovi by Nokia
-// 26463759431 = My INQ Mobile
-// 21810043296 = Facebook for the T-Mobile Sidekick
-// 183319479511 = HootSuite
-// 189818072392 = live journal
-// 302006227267 = Sony Ericsson X10 mini pro
-// 90376669494 = Yahoo
-// 108160725869250 = Sony Ericsson
-// 39010226174 = Vlingo
-// 247431880944 = Droid
-// 66746580154 = Dell Mobile
-// 96105046534 = RockMelt
-// 143907478979139 = RockMelt Beta
-// 146563558702544 = Friendly for Ipad
-// 131289390231340 = Slide
-// 9953271133 = networked blogs
-// 45439413586 = RSS Grafitti
-// 131732509879 = Twitter Feed
-// 23723376453 = Seesmic
-// 76456527540 = Facebook mobile by Opentech ENG
-// 105130332854716 = flipboard
-// 27694818115 = Ovi by Nokia
-// 67878695711 = Nokia N900
-// 124024574287414 = Instagram
-// 79763977758 = Kodak Easy Share
-// 139682082719810 = Snaptu for Facebook
-// 122580857763901 = eBuddy
-// 24553799497 = mobileblog
-// 159348674082705 = Photoloader
-// 112618498804176 = FriendCaster for Android
-// 148061315211358 = Friendcaster Pro for android
-// 104142802965358 = My INQ Mobile
-// 149588628439275 = Twidroyd for Twitter
-// 7933375107 = Windows Phone
-// 135892916448833 = Facebook for Windows Phone
-// 48505437520 = Sony Ericsson Web Albums
-// 198446803501767 = HTC ChaCha
-// 193278124048833 = HTC Sense
-// 165907476854626 = Facebook Pages Manager
-// 213546525407071 = iOS
-// 531615603522381 = Facebook Site Governance voting app
-// 149859461799466 = Sony Xperia Smartphone
-// 178645865537776 = Blackberry
-// 220353874751486 = Facebook for Blackberry 10
-// --193048140809145-- = Facebook Likes (built in facebook app? this is a weird one, ive actually removed it for now, will investigate further. just leaving this here as a reminder)
-
-// EXTRA STORIES ( see http://extras.fbpurity.com for more info )
-// Read option settings and set extra story codes
-
-////////////////////////
-/// BEGIN opts
-////////////////////////
-
-var arrwhitelist2={}; // this is the main application whitelist array
-var extraTextFilter;
-var headerTextFilter;
-var cleancustomtextfilter='';
-var headertextfilterRX;
-var textfilterRX;
-var filterapptext;
-var fbpboxstyles;
-var fbpfanpageid="408502197558";
-var fbpdevpageid="464154953615751";
-
-function getuserid(){
- var userid='';
- var currentuser=document.getElementsByClassName('headerTinymanPhoto');
- if(currentuser.length && currentuser[0].src && currentuser[0].src.match(/_/))
- userid=currentuser[0].src.split('_')[1];
- else
- try {
- userid=document.cookie.match(/c_user=(\d+)/)[1];
- }
- catch(e) {
- console.log('problem getting logged in user id: ' + e);
- }
- return userid;
-}
-
-var currentuserid=getuserid();
-
-if (!currentuserid.length)
- var useridwhitelistRX=new RegExp(fbpfanpageid);
-else
- var useridwhitelistRX=new RegExp(fbpfanpageid + "|" + fbpdevpageid + "|" + currentuserid);
-
-refreshwhitelist = function () {
- var whitelist;
- if (fbpoptsobj.userappwhitelist && fbpoptsobj.userappwhitelist.length)
- whitelist = defaultappwhitelist + "," + fbpoptsobj.userappwhitelist;
- else
- whitelist = defaultappwhitelist;
-
- whitelist = whitelist.replace(/,,/g,''); // remove blanks (if any)
- whitelist = whitelist.replace(/ /g,''); // remove spaces (if any)
- whitelist = whitelist.replace(/,$/,''); // remove trailing comma (if any)
-
- var arrwhitelist=whitelist.split(',');
-
- for (i in arrwhitelist)
- arrwhitelist2[arrwhitelist[i]]=true; // create hashmap
-}
-
- fbptimelinerestyle=function (tloff) {
- var tlstyle='';
- if (tloff) {
- //fix group cover image links
- tlstyle += ' .groupsCoverPhoto img.coverPhotoImg, .groupsCoverPhoto a.coverWrap {height:100px !important}'+
- // make the Timeline Cover Photo Shorter (not doing this any more as it interfers with changing cover photo)
- // ' .cover {height:100px !important} .coverWrap {height:150px !important} #pagelet_timeline_nav {margin-top:-10px} #fbTimelineHeadline .name h2, .fbEventHeadline {text-shadow: 1px 1px grey;} #fbTimelineHeadline .name h2 .fsm {text-shadow: 0px 0px;} #fbTimelineHeadline {top:8px} '+
-
- // fix save and cancel and drag to reposition
- ' #coverEditSaveCancelArea .saveAndCancel {margin-top:40px} a.coverWrap .instructionWrap {top:120px !important}'+
- // hide the 'Coming Soon: Timeline' section at the top of Timeline pages
- ' #pagelet_above_header_timeline {display:none}'+
- // hide the "escape hatch" (friends / about / interests picture squares section)
- ' #pagelet_escape_hatch {display:none}'+
- // single column timeline
- ' .fbTimelineUnit { float:left !important; clear:left !important; width:540px; border-top:1px solid #ccc !important; border-bottom:1px solid #ccc !important;} .fbTimelineUnit .topBorder { display:none} .fbTimelineUnit .spinePointer { display:none } .fbTimelineUnit .bottomBorder { display:none } .timelineUnitContainer { width:auto !important} .timelineUnitContainer .uiCommentContainer { width:auto !important; } .fbTimelineCapsule { background:none !important; background-color:white !important; } .fbTimelineIndeterminateContent { float:right !important; width:280px !important; margin-right:10px; } .tlTxFe { font-size:inherit !important; line-height:inherit !important} #timelineNavContent .fbTimelineNavigation {width:849px}' +
- // fix left margin and cover image size for personal timeline versus fan page timeline
- ' .pagesTimelineLayout .fbTimelineUnit {margin-left:150px !important} '+
- //div[itemtype="http://data-vocabulary.org/Person"] #fbProfileCover .coverWrap { {height: 150px !important} div[itemtype="http://data-vocabulary.org/Person"] .coverWrap {height:150px !important}' +
- // event page with cover image
- ' div.fbEventLeftNav {position:relative;top:20px !important} div.fbEventHeaderBlock {position:relative;top:25px !important;left:0px !important }';
- }
- if (document.getElementById('fbptlstyle'))
- document.getElementById('fbptlstyle').textContent=tlstyle;
- }
-
-fixsortorder = function() {
- if(debug)
- console.log('fix sort order function');
- if(fbpoptsobj.sortmostrecent) { // force feed to sort by most recent
-
- var sortlink=document.getElementsByClassName('sortLink');
- if(sortlink.length) {
- if(!sortlink[0].textContent.match(/\:/)) {
- document.getElementById('globalContainer').innerHTML="<div style='text-align:center;font-size:60px;font-weight:bold;'>F.B. Purity:<br/> Switching Sort Order<br/>to Most Recent!</h1>";
- window.location.href=window.location.protocol +'//www.facebook.com/?sk=h_chr';
- }
- }
- else { // deal with new newsfeed design
- sortlink=document.getElementsByClassName('_5eo3');
- if(sortlink.length) {
- if(!sortlink[0].textContent.match(/\:/)) {
- document.getElementById('globalContainer').innerHTML="<div style='text-align:center;font-size:60px;font-weight:bold;'>F.B. Purity:<br/> Switching Sort Order<br/>to Most Recent!</h1>";
- window.location.href=window.location.protocol +'//www.facebook.com/feed/recent';
- }
- }
- }
- /*
- new newsfeed design, urls Old newsfeed
- https://www.facebook.com/?sk=nf (Top Stories) https://www.facebook.com/?sk=h_nor (Top Stories)
- https://www.facebook.com/feed/recent (Most Recent) https://www.facebook.com/?sk=h_chr (Most Recent)
- */
- // change newsfeed links to point to most recent feed
- // the F logo needs to be set whether or not the left side navbar is found, as not all pages have the left navbar, but all pages have the F logo
-
- if(document.getElementsByClassName('litestandNavItem').length) { // new newsfeed design
- document.getElementById('pageLogo').querySelector("a").setAttribute('href','/feed/recent');
- document.getElementById('navHome').querySelector("a").setAttribute('href','/feed/recent');
- if(document.querySelector("a[data-id='4748854339']")) {
- //console.log(document.querySelector("a[data-id='4748854339']").getAttribute('href'));
- document.querySelector("a[data-id='4748854339']").setAttribute('href','/feed/recent');
- //console.log(document.querySelector("a[data-id='4748854339']").getAttribute('href'));
- document.querySelector("a[data-id='4748854339']").setAttribute('data-gt','');
-
- // try removing event listeners by cloning the node and replacing it
- var old_element = document.querySelector("a[data-id='4748854339']");
- var new_element = old_element.cloneNode(true);
- old_element.parentNode.replaceChild(new_element, old_element);
- }
- }
- else { // old newsfeed design
- document.getElementById('pageLogo').querySelector("a").setAttribute('href','/?sk=h_chr');
- document.getElementById('navHome').querySelector("a").setAttribute('href','/?sk=h_chr');
- if(document.getElementById('navItem_app_4748854339') && document.getElementById('navItem_app_4748854339').getElementsByTagName("a").length) {
- //console.log(document.getElementById('navItem_app_4748854339').getElementsByTagName("a").length);
- //console.log(document.getElementById('navItem_app_4748854339').querySelector("a[data-gt]").getAttribute('href'));
- document.getElementById('navItem_app_4748854339').querySelector("a[data-gt]").setAttribute('href','/?sk=h_chr');
- //console.log(document.getElementById('navItem_app_4748854339').querySelector("a[data-gt]").getAttribute('href'));
- document.getElementById('navItem_app_4748854339').querySelector("a[data-gt]").setAttribute('data-gt','');
- }
- }
- } // end if sortmostrecent is enabled
- else {
- if(debug)
- console.log('Sort most recent option is not enabled');
- }
-}
-
-initstage2 = function () {
- if(debug)
- console.trace();
- //console.log('entering function : ' + arguments.callee.name);
-
- /* moved this to separate function
- if(fbpoptsobj.sortmostrecent) { // force feed to sort by most recent
- var sortlink=document.getElementsByClassName('sortLink');
- if(sortlink.length) {
- if(!sortlink[0].textContent.match(/\:/))
- window.location.href=window.location.protocol +'//www.facebook.com/?sk=h_chr';
- }
- }
- */
-
- extraTextFilter=''; // init extraTextFilter
- headerTextFilter=''; // init headerTextFilter
- if(fbpoptsobj.filterappmessages==1) {
- filterapptext=' fbpblocked';
- headerTextFilter += ', played .*,started playing,started using';
- extraTextFilter += ',games your friends are playing,Games You May Like';
- }
- else
- filterapptext=' fbpnormal';
-
- if(fbpoptsobj.becamefriends==1)
- headerTextFilter += ',are now friends,is now friends with,now allows subscribers,subscribed to updates from,subscribed to .*\'s updates,subscribed to the list, followed .*\.'; // can probably get rid of subscribed to now (as they switched to follow)
-
- if(fbpoptsobj.becamefan==1){
- headerTextFilter += ', recommends, likes .* and \\d* other pages,wrote a recommendation for, rated .*';
- extraTextFilter += ',like page,Like this Page,Find More Pages ·, Write a recommendation ';
- }
-
- if(fbpoptsobj.joinedgroup==1) {
- headerTextFilter += ",.* was added to ,uploaded a .* in the group, was invited to, were invited to, invited .* to ,updated the description of the group,updated the group";
- extraTextFilter += ",· Join Group";
- }
-
- if(fbpoptsobj.attendevent==1)
- headerTextFilter += ",is attending, is going to";
-
- if(fbpoptsobj.attendedevent==1)
- headerTextFilter += ", attended the event, went to .*\.";
-
- if(fbpoptsobj.createdevent==1)
- headerTextFilter += ",created an event,updated the event photo";
-
- if((typeof fbpoptsobj.upcomingevents !=='undefined') && (fbpoptsobj.upcomingevents==1))
- extraTextFilter += ",Upcoming Events,Upcoming Concerts";
-
- if((typeof fbpoptsobj.sharedevent !=='undefined') && (fbpoptsobj.sharedevent==1))
- headerTextFilter += ",shared an event, shared .*\\'s event, posted an event";
- //extraTextFilter += ",people are goingjoin" // may also filter out "created an event" stories
-
- if (typeof fbpoptsobj.checkedin == "undefined")
- fbpoptsobj.checkedin = 0;
-
- if(fbpoptsobj.checkedin==1)
- headerTextFilter += ", is with .*,was tagged at, is in .*\., was in .*\., is at .*\., was at .*\., were at .*\., are at .*\., was with ";
-
- if((typeof fbpoptsobj.likedstatus !=='undefined') && (fbpoptsobj.likedstatus==1))
- headerTextFilter += ", likes .*\'s status, like .*\'s status, like a status, likes h.. own status,likes a status, likes a post";
-
- if((typeof fbpoptsobj.commentedstatus !=='undefined') && (fbpoptsobj.commentedstatus==1))
- headerTextFilter += ",commented on .* status, commented on .* note, commented on .* activity";
-
- if((typeof fbpoptsobj.taggedstatus !=='undefined') && fbpoptsobj.taggedstatus==1)
- headerTextFilter += ", tagged .* status\.";
-
- if((typeof fbpoptsobj.sharedstatus !=='undefined') && (fbpoptsobj.sharedstatus==1))
- headerTextFilter += ", shared .*\'s status, shared a status, shared .*\'s post";
-
- if((typeof fbpoptsobj.taggedphoto !=='undefined') && (fbpoptsobj.taggedphoto==1))
- headerTextFilter += ",tagged in h.. own photo,tagged in a photo,tagged in .*\'s photo,tagged in h.. own album, tagged in .*\'s album";
-
- if((typeof fbpoptsobj.likedphoto !=='undefined') && (fbpoptsobj.likedphoto==1))
- headerTextFilter += ",likes .* photo\.,likes? a photo,likes .*\'s album";
-
- if((typeof fbpoptsobj.commentedphoto !=='undefined') && (fbpoptsobj.commentedphoto==1))
- headerTextFilter += ",commented on .*\'s photo,commented on h.. own photo,commented on h.. own album,commented on a photo,commented on .*\'s album";
-
- if((fbpoptsobj.commentedlink !== 'undefined') && (fbpoptsobj.commentedlink==1)) {
- headerTextFilter += ",commented on .*\'s link,commented on a link,commented on h.. own link,commented on .*\.com\.";
- }
- // maybe move "likes an article" to the trending articles filter...
- if((fbpoptsobj.likedlink !== 'undefined') && (fbpoptsobj.likedlink==1)) {
- headerTextFilter += ",likes an article,recommends a link,likes a link,like a link,likes .*\'s link,likes \\d+ links";
- }
-
- if((fbpoptsobj.sharedpage !== 'undefined') && (fbpoptsobj.sharedpage==1)) {
- headerTextFilter += ",shared a Page";
- }
-
- if(fbpoptsobj.commentwall==1)
- headerTextFilter += ",commented on .* post,wrote on .*\'s timeline,posted .* to .*\'s timeline"; //commented on h.. own post,commented on .*\'s post in,commented on a Post,
-
-// updated profile
- if (typeof fbpoptsobj.updatedprofile == "undefined")
- fbpoptsobj.updatedprofile = 0;
-
- if(fbpoptsobj.updatedprofile==1)
- headerTextFilter += ",added .* to h.. education\.,updated h.. education,added .* to h.. work\.,has worked on,updated h.. current .* to .*\\.,added .* as h.. hometown\\.,updated h.. work and education,added .* to h.. list of inspirational people\\.,to the inspirational people,added .* to h.. favourite sports\\.,added .* to h.. favourite teams\\.,added .* to h.. favourite athletes\\.,added .* to h.. activities\\.,added .* to h.. interests\\.,added .* to h.. profile\\.,to .* previous employers,added .* to h.. timeline,added a job at , now works at , took .* at .*,added details about,added a life event";
-
-// changed profile pic
- if (typeof fbpoptsobj.changedprofilepic == "undefined")
- fbpoptsobj.changedprofilepic = 0;
-
- if(fbpoptsobj.changedprofilepic==1)
- headerTextFilter += ",changed their profile picture,changed h.. profile picture,updated h.. cover photo\.,updated their cover photo";
-
-// changed relationship
- if (typeof fbpoptsobj.changedrelationship == "undefined")
- fbpoptsobj.changedrelationship = 0;
-
- if(fbpoptsobj.changedrelationship==1)
- headerTextFilter += ',went from being \".*\" to \".*\",went from being \".*\" to being \".*\",is in a relationship,complicated relationship,is single,is married,is engaged,is in a domestic partnership';
-
-// uploaded photo
- if (typeof fbpoptsobj.uploadedphoto == "undefined")
- fbpoptsobj.uploadedphoto = 0;
-
- if(fbpoptsobj.uploadedphoto==1){
- headerTextFilter += ",added a photo,posted a photo to,added a new photo,added \\d* new photos,added \\d* photos,took a photo with,took \\d* photos with";
- extraTextFilter +=', (\\d+ photos)';
- }
-
-// shared photo
- if (typeof fbpoptsobj.sharedphoto == "undefined")
- fbpoptsobj.sharedphoto = 0;
-
- if(fbpoptsobj.sharedphoto==1){
- headerTextFilter += ",shared a photo,shared .*\'s album";//shared .*\'s photo,
- extraTextFilter += ",by\:,shared .*?'s photo";
- }
-
-// uploaded video
- if (typeof fbpoptsobj.uploadedvideo == "undefined")
- fbpoptsobj.uploadedvideo = 0;
-
- if(fbpoptsobj.uploadedvideo==1){
- headerTextFilter += ",posted A video,added a video,uploaded.* video";
- //extraTextFilter +=",Length: ‎?\\d+:\\d\\d"; // this filter doesnt seem to work...
- }
-
-// tagged in video
- if (typeof fbpoptsobj.taggedinvideo == "undefined")
- fbpoptsobj.taggedinvideo = 0;
-
- if(fbpoptsobj.taggedinvideo==1)
- headerTextFilter += ",tagged in .*\'s video ";
-
-/* new video options 28th jan
-sharedvideo
-likedvideo
-commentedvideo
-youtubevideo
-*/
- if((typeof fbpoptsobj.sharedvideo!=='undefined') && (fbpoptsobj.sharedvideo==1))
- // we also add a check for classname "shareMediaVideo" to improve filter coverage
- headerTextFilter += ",shared a video,shared .*\'s video";
-
- if((typeof fbpoptsobj.likedvideo!=='undefined') && (fbpoptsobj.likedvideo==1))
- headerTextFilter += ",liked a video,liked .*\'s video,likes .*\'s video";
-
- if((typeof fbpoptsobj.commentedvideo!=='undefined') && (fbpoptsobj.commentedvideo==1))
- headerTextFilter += ",commented on a video,commented on .*'s video";
-
- if((typeof fbpoptsobj.youtubevideo!=='undefined') && (fbpoptsobj.youtubevideo==1))
- extraTextFilter += ",youtube\.com,youtu\.be,vimeo\.com";
-
- //if(fbpoptsobj.hideallvideos==1)
- // ; // we are dealing wtih this by running a check on the node for the "shareMediaVideo" class
-
- //if(fbpoptsobj.hidealllinks==1)
- // Need to Add all links filter here?
-
-// posted note
- if (typeof fbpoptsobj.postednote == "undefined")
- fbpoptsobj.postednote = 0;
-
- if(fbpoptsobj.postednote==1)
- headerTextFilter += ",posted a note";
-
-// tagged in note
- if (typeof fbpoptsobj.taggedinnote == "undefined")
- fbpoptsobj.taggedinnote = 0;
-
- if(fbpoptsobj.taggedinnote==1)
- headerTextFilter += ",tagged in a note,tagged in a Post,tagged in .* life event";
-
-// posted link
- if (typeof fbpoptsobj.postedlink == "undefined")
- fbpoptsobj.postedlink = 0;
-
- if(fbpoptsobj.postedlink==1)
- headerTextFilter += ",shared link\\.,shared a link\\.";
-
-// read an article
- if (typeof fbpoptsobj.readarticle == "undefined")
- fbpoptsobj.readarticle = 0;
-
- if(fbpoptsobj.readarticle==1) {
- headerTextFilter += ",read an article, recently read articles\\., read \\d* articles\\.";
- extraTextFilter += ",Trending Articles,Trending Videos,Most Shared on ,Recent Articles About ";
- }
-
-// facebook questions
- if(fbpoptsobj.questionsbox==1) {
- headerTextFilter += ", replied to: , asked: ,answered .*'s question,asked.*a question";
- extraTextFilter += ",· Ask friends ·";
- }
-
-// hide sponsored stories in newsfeed
- if(fbpoptsobj.sponsoredbox==1) {
- extraTextFilter += ",Recently Released Albums,Get Offer ·"; //· Sponsored
- headerTextFilter += ", claimed an offer from, posted an offer";
- }
-
- if (fbpoptsobj.trendingbox) {
- headerTextFilter += ', is trending\\.';
- }
-
-// fix font size
- if(fbpoptsobj.fontfix==1) {
- /*if(document.getElementById('fbpfreestyler'))
- document.getElementById('fbpfreestyler').textContent='div.actorName{display:inline;margin-right:3px !important} a.subject,div.preview,.mall_post_body_text,div,span,p,textarea,input,td,label,h3,h4,h5,h6{font-size:' + fbpoptsobj.fontsize + 'px !important} ' + 'div.commentContent {font-size:' + (fbpoptsobj.fontsize-1) +'px !important}' + ' .ginormousProfileName { font-size: 20px !important} ' + ' .emote_text {display:none}' + ' div.tickerFeedMessage, div.linkWrap {line-height:' + fbpoptsobj.fontsize + 'px !important} ' + 'li.uiStreamHeader {margin-bottom:' + (fbpoptsobj.fontsize-6) + 'px !important}';
- */
- 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}';
- }
-
-// fix font colour
- if(fbpoptsobj.fontcolourfix==1) {
- /*if(document.getElementById('fbpfreestyler'))
- document.getElementById('fbpfreestyler').textContent +=' * {color:' + fbpoptsobj.fontcolour + ' !important}'; //span.fwb {color:' + fbpoptsobj.fontcolour + ' !important}';
- */
- fbpfreestyle.textContent+=' * {color:' + fbpoptsobj.fontcolour + ' !important}'; //span.fwb {color:' + fbpoptsobj.fontcolour + ' !important}';
- }
-
-// fix font background colour
- if(fbpoptsobj.fontbgcolourfix==1) {
- //if(document.getElementById('fbpfreestyler'))
- // document.getElementById('fbpfreestyler')
- fbpfreestyle.textContent +=' * {background-color:' + fbpoptsobj.fontbgcolour + ' !important} .uiListLight { border-color: #333; } textarea, .inputtext, .inputpassword { border: 1px solid #555} .uiUfi .ufiItem { border-bottom: 1px dotted darkgray} n.tagsWrapper *, #fbPhotoTheaterTags, .tagsWrapper, .fbPhotosPhotoTagboxes *, #fbPhotoTheaterStageActions, .fbQuestionsPollClickTarget, .fbPhotosPhotoTagboxes, .flashUploaderOverlayButton, .fluploader_swfdiv, .coverBorder, .frame, .mat, .graph-canvas, .overlay, span.label, div.label, span.fwb ,#snowliftStageActions, .fbPhotoTagger, .faceBox, .typeaheadWrapper, .groupsJumpCoverBorder, .-cx-PRIVATE-uiFileInput__wrap, #fullScreenSwitch, #fbProfileCoverPhotoSelector, #fbProfileCoverPhotoSelector .wrap, #fbProfilePicSelector, #fbProfilePicSelector .wrap, .snowliftPager, .snowliftPager i, a.fbPhotoViewLarger, div._7m4 {background-color:transparent !important} .fbQuestionsPollResultsBar .shaded, .bar {background-color: #6C83B2 !important} .tagName, ol.balancingCapsule, div.fbTimelineFilters, ol.fbTimelineCapsule {background-color: ' + fbpoptsobj.fontbgcolour + ' !important} .hasSmurfbar #blueBarHolder #blueBar {background-image:url("") !important} /* like button: */ div._55k4, /*camera icon under composer*/ div._3jk , /* profile pic*/ i._96h, /* group count in left column*/ div.-cx-PRIVATE-blendedBookmarksNonLitestand__bookmark, div._5duc {background-color:transparent !important} /* attach image to comment icon*/ i.UFICommentPhotoIcon {background-color:grey !important}';
- }
-
- // fix font
- if(fbpoptsobj.fbpfontfix==1) {
- //if(document.getElementById('fbpfreestyler'))
- // document.getElementById('fbpfreestyler')
- fbpfreestyle.textContent +=' * {font-family:' + fbpoptsobj.fbpfont + ' !important} ';
- }
-
-
- if(fbpoptsobj.likepagebutton==1) {
- fbpfreestyle.textContent +=' div.uiStreamShareLikePageBox div.uiPageLikeButton, div.genericStreamStory a.PageLikeButton, div[data-dedupekey] span.PageLikeButton, div.shareFooter label.shareLikeButton, #pagelet_litestand_section a.PageLikeButton {display:none} ';
- }
- // single column timeline
- /*
- if(fbpoptsobj.timelineonecol==1)
- fbptimelinerestyle(1);
- else
- fbptimelinerestyle(0);
- */
-
- lcoptsarr="lcadvertmgr,lcconnect,lcallpages,lcpagesfeed,lclikepages,lcallapps,lcappcenter,lcevents,lcgamesfeed,lcpokes,lcmusic,lcplaceseditor,lcallgroups,lcallinterests,lccreategroup,lccreatepage,lcfindfriends,lcdeveloper,lcfriends,lcgifts,rcrecommendedpages,rcrelatedgroups,rcpokes,rcbirthdays,rcfriendrequests,rcgamerequests".split(',');
- for(b=0;b<lcoptsarr.length;b++)
- if (typeof fbpoptsobj[lcoptsarr[b]] == "undefined")
- fbpoptsobj[lcoptsarr[b]]=0;
-
- //var fbpfreestyler=document.getElementById('fbpfreestyler');
- //if (fbpfreestyler) {
-
-
-
- // start left column options
- if(fbpoptsobj.lcconnect==1)
- fbpfreestyle.textContent +=' #connectNav {display:none}';
-
- if(fbpoptsobj.lcallpages==1)
- fbpfreestyle.textContent +=' #pagesNav {display:none}';
-
- if(fbpoptsobj.lcallapps==1)
- fbpfreestyle.textContent +=' #appsNav {display:none}';
-
- if(fbpoptsobj.lcallgroups==1)
- fbpfreestyle.textContent +=' #groupsNav {display:none}';
-
- if(fbpoptsobj.lcallinterests==1)
- fbpfreestyle.textContent +=' #interestsNav { display:none }';
-
- if(fbpoptsobj.lcfriends==1)
- fbpfreestyle.textContent +=' #listsNav { display:none}';
-
- // items beginning with #navItem_app_ are for the old newsfeed, and those with #sidebar_navigation_top are the new newsfeed
- if(fbpoptsobj.lcadvertmgr==1)
- 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}';
-
- if(fbpoptsobj.lcpagesfeed==1)
- fbpfreestyle.textContent +=' #navItem_app_140472815972081, #sidebar_navigation_top a[data-id="140472815972081"] {display:none}';
-
- if(fbpoptsobj.lclikepages==1)
- fbpfreestyle.textContent +=' #navItem_app_357937250942127, #navFindFriends, #sidebar_navigation_top a[data-id="357937250942127"] {display:none}';
-
- if(fbpoptsobj.lcappcenter==1)
- fbpfreestyle.textContent +=' #navItem_app_140332009231, #sidebar_navigation_top a[data-id="140332009231"] {display:none}';
-
- if(fbpoptsobj.lcevents==1)
- fbpfreestyle.textContent +=' #navItem_app_2344061033, #sidebar_navigation_top a[data-id="2344061033"] {display:none}';
-
- if(fbpoptsobj.lcgamesfeed==1)
- fbpfreestyle.textContent +=' #navItem_app_261369767293002, #sidebar_navigation_top a[data-id="261369767293002"] {display:none}';
-
- if(fbpoptsobj.lcpokes==1)
- fbpfreestyle.textContent +=' #navItem_app_183217215062060, #sidebar_navigation_top a[data-id="183217215062060"] {display:none}';
-
- if(fbpoptsobj.lcmusic==1)
- fbpfreestyle.textContent +=' #navItem_app_119960514742544, #sidebar_navigation_top a[data-id="119960514742544"] {display:none}';
-
- if(fbpoptsobj.lcplaceseditor==1)
- fbpfreestyle.textContent +=' #navItem_app_219124168114356, #sidebar_navigation_top a[data-id="219124168114356"] {display:none}';
-
- if(fbpoptsobj.lccreategroup==1)
- fbpfreestyle.textContent +=' #navItem_app_230259100322928, #sidebar_navigation_top a[data-id="230259100322928"] {display:none}';
-
- if(fbpoptsobj.lccreatepage==1)
- fbpfreestyle.textContent +=' #navItem_app_188619144602540, #sidebar_navigation_top a[data-id="188619144602540"] {display:none}';
-
- if(fbpoptsobj.lcfindfriends==1)
- fbpfreestyle.textContent +=' #navItem_app_2356318349, #sidebar_navigation_top a[data-id="2356318349"], #findFriendsNav {display:none !important}';
-
- if(fbpoptsobj.lcdeveloper==1)
- fbpfreestyle.textContent +=' #developerNav, #navItem_app_2345053339, #sidebar_navigation_top a[data-id="2345053339"] {display:none}';
-
- if(fbpoptsobj.lcgifts==1)
- fbpfreestyle.textContent +=' #navItem_app_329122197162272, a[data-endpoint="/ajax/composerx/attachment/gift/"], a[ajaxify^="/ajax/gifts/send?recipient_id="], div.fbRemindersContent div.uiBoxLightblue, #sidebar_navigation_top a[data-id="329122197162272"], a[href^="/gifts?recipient_id="], div.timelineReportContainer[data-gt*=\'"timeline_unit_type":"BirthdayGiftUnit"\'],a.uiButton[href^="/gifts?recipient_id="] {display:none}';
-
- if(fbpoptsobj.rcrecommendedpages==1)
- fbpfreestyle.textContent +=' #pages_reminders_link {display:none}';
-
- if(fbpoptsobj.rcbirthdays==1)
- fbpfreestyle.textContent +=' #birthday_reminders_link {display:none}';
-
- if(fbpoptsobj.rcgamerequests==1)
- fbpfreestyle.textContent +=' #custom_reminders_link {display:none}';
-
- if(fbpoptsobj.rcfriendrequests==1)
- fbpfreestyle.textContent +=' #friends_reminders_link {display:none}';
-
- if(fbpoptsobj.rcpokes==1)
- fbpfreestyle.textContent +=' #poke_reminders_link, #pagelet_pokes {display:none}';
-
- if(fbpoptsobj.rcrelatedgroups==1)
- fbpfreestyle.textContent +=' #pagelet_ego_contextual_group {display:none !important}';
-
- // hide useless bottom right footer + ads on login + logout screen + useless links in top nav bar
- fbpfreestyle.textContent += 'div.fbIndexFeaturedRegistration > div.lfloat, .-cx-PRIVATE-fbAdUnit__root, #pagelet_rhc_footer, #SetAsHomepage_Callout, .gradientContent > div[data-ad^="{"], #findFriendsNav, #navFindFriends {display:none !important}';
-
- // hide contact importer at bottom of feed
- fbpfreestyle.textContent += ' .contact_importer_widget {display:none} #ci_compact_right {display:none}';
-
- // add red border to publish permissions request and make light grey blurb black and bold
- 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}';
-
- // add open and close list styles
- fbpfreestyle.textContent += ' span.fbpopenlist:before {content:"â–¼ "} span.fbpclosedlist:before {content:"â–º "}';
-
-
-////////////////////////
-/// END opts
-////////////////////////
-
-refreshwhitelist();
-
-//unsafeWindow.console.log("etf= " + extraTextFilter);
-
-var tmptextfilter='';
-tmptextfilter=fbpoptsobj.customtextfilter;
-if (tmptextfilter)
- tmptextfilter += ',' + extraTextFilter; // add emergency extra text filter
-else
- tmptextfilter = extraTextFilter;
-
-if( tmptextfilter.length ) {
- tmptextfilter=tmptextfilter.replace(/,,/g,','); // remove blanks (if any)
- tmptextfilter=tmptextfilter.replace(/,+$|^,+/g,''); // remove trailing or leading commas
- cleancustomtextfilter=fbpescaperegex(tmptextfilter); // escape regex special chars (brackets)
-
- try {
- textfilterRX = new RegExp(cleancustomtextfilter.replace(/,/g,'|'),"gi");
- }
- catch (e) {
- window.alert('F.B. Purity: Error building Custom Text Filter RegEx: ' + fbpoptsobj.customtextfilter + "\n\nHave you pasted CSS code into the Custom Text filter by mistake? If yes, go to the FBP options sceen, remove it and put it into the Custom CSS Box.")
- //textfilterRX=null;
- textfilterRX=new RegExp("fbpurity1234567890xyz"); // set a dummy regex, so firefox browser doesnt freeze, and user can go and reset the fbp options
- }
-}
-
-//unsafeWindow.console.log('htf=' + headerTextFilter);
-
-headerTextFilter=headerTextFilter.replace(/^,/,''); // remove leading comma (if any)
-
-if( headerTextFilter && headerTextFilter.length ) {
- try {
- headertextfilterRX = new RegExp(headerTextFilter.replace(/,/g,'|'),"gi");
- }
- catch (e) {
- window.alert('F.B. Purity: regex error building header text filter : ' + headerTextFilter);
- headertextfilterRX=null;
- }
-}
-
-//unsafeWindow.console.log(fbpoptsobj.customtextfilter);
-
- fbpboxstyles='';
-
- // hide suggestions box if option has been set
- if (fbpoptsobj.suggestionsbox) {
- fbpboxstyles +=' #ego_pane {display:none} #netego_organic {display:none} #pagelet_tips_box {display:none}';
- }
- // hide Get Connected (was: connect with friends) box if option has been set
- if (fbpoptsobj.connectbox) {
- fbpboxstyles +=' #pagelet_netego_lower {display:none} #pagelet_connectbox {display:none}';
- }
-
- if (fbpoptsobj.betabox) {
- fbpboxstyles +=' #pagelet_betabox {display:none}';
- }
-
- if (fbpoptsobj.pokebox) {
- fbpboxstyles +=' #pagelet_netego_pokes, #pagelet_pokes, #navItem_app_183217215062060 {display:none}';
- }
-
- if (fbpoptsobj.happeningnowbar) {
- fbpboxstyles +=' .ticker_stream, #pagelet_ticker, #pagelet_rhc_ticker {display:none}';
- }
-
- if (fbpoptsobj.questionsbox) {
- fbpboxstyles +=' #pagelet_netego_questions, #pagelet_questionsbox {display:none}';
- }
-
- if (fbpoptsobj.eventsbox) {
- fbpboxstyles +=' #event_reminders_link {display:none}'; // hide left column events too #navItem_app_2344061033 {display:none} just hide create event link #pagelet_reminders [ajaxify="/ajax/plans/create/dialog.php"] * { display: none !important;}
- }
-
- if (fbpoptsobj.requestsbox) {
- fbpboxstyles +=' #pagelet_netego_requests {display:none}';
- }
-
- if (fbpoptsobj.sponsoredbox) {
- fbpboxstyles +=' div._5j5u,div[data-adblock-hash],div.megaphone_location_pages_feed, #pagelet_canvas_storybox, #pagelet_canvas_nav_content, .applifier, #side_ad_frame, .-cx-PRIVATE-suggestionOnLiking__body, .canvasRecommended, li.ownsection, li[aria-label="Sponsored"], #pagelet_adbox, #pagelet_search_ads2, #adcolumn_advertise, #ssponsor, #adcolumn_more_ads, #pagelet_friendship_netego_ads, #pagelet_ego_pane, .fbPhotosSideColumn, #pagelete_ego_pane_home_ads, #pagelet_ad_page_upsell, #fbPhotoSnowboxAdsBottom, .fbPhotoSnowboxAdsSponsored, .fbTimelineSideAds, #pagelet_ego_pane_m, #pagelet_organic_ego_pane, #pagelet_ego_pane_w, #pagelet_ads_when_no_friend_list_suggestion, #pagelet_side_ads, #fbPhotoSnowliftAdsSide, #MessagingNetegoSidebar, .-cx-PRIVATE-fbTimelineStyleAds__vertical, .-cx-PRIVATE-fbTimelineStyleAds__root, .-cx-PRIVATE-snowliftAds__root, ._24q, .rhcFooter, div[data-ad^="{"],.-cx-PRIVATE-suggestionOnSourceLiking__body, #endOfFeedPymlContainer {display:none !important} #sidebar_ads, #pagelet_ads, #pagelet_netego_ads, .UIStandardFrame_SidebarAds, #gb_muffin_area, .adsContainer, .fbPhotoAdsCol {visibility:hidden !important} ';
- }
- //div._5j5u = current code for hiding "similar to" box.
-
- if (fbpoptsobj.filterappmessages) { // hide app and game messages from the ticker
- fbpboxstyles +=' div.fbFeedTickerStory[data-gt*=\'"appid":\'] {display:none} ';
- }
-
- if (fbpoptsobj.chatbox) {
- fbpboxstyles +=' #pagelet_presence, #pagelet_friends_online, #pagelet_chat, #BuddylistPagelet, div.fbChatSidebarBody {display:none}';
- }
-
- if (fbpoptsobj.trendingbox) {
- fbpboxstyles +=' #pagelet_trending_tags_and_topics, #under_composer_trending {display:none}';
- }
-
- if ((typeof fbpoptsobj.smileys !=='undefined') && fbpoptsobj.smileys) {
- fbpboxstyles +=' img.wallArrowIcon, .emoticon_text {display:inline !important} .emoticon {display:none !important} i.-cx-PRIVATE-fbEntstreamEmoji__image, i.-cx-PRIVATE-ogAttachedSentenceToken__icon, span.-cx-PRIVATE-fbEmoji__icon, h5.uiStreamMessage img, span.userContent i.img, .userContentSecondary i.img, span.hasCaption i.img, div.shareSubtext i.img, div.uiStreamAttachments i.img, div.UFICommentContent span._1a-, div.userContentWrapper i.img, h5.uiStreamMessage i.img, span.userContentSecondary img[height="16"] {display:none} ';
- }
-
- if ((typeof fbpoptsobj.notificationpopup !=='undefined') && fbpoptsobj.notificationpopup) {
- fbpboxstyles +=" ul[data-gt^='{\"ref\":\"beeper\"'] {display:none}";
- }
-
- if ((typeof fbpoptsobj.fixedleftcolumn !=='undefined') && fbpoptsobj.fixedleftcolumn) {
- fbpboxstyles +=' .home #leftCol {position:fixed !important}';
- }
-
- if(fbpoptsobj.offlinefriends) {
- // hide offline friends in chat
- fbpboxstyles +=" .fbChatOrderedList li {display: none;} .fbChatOrderedList .active {display: block;}";
- }
-
- //if(document.getElementById('fbpboxstyler'))
- // document.getElementById('fbpboxstyler').textContent = fbpboxstyles;
- fbpboxstyle.textContent = fbpboxstyles;
-
- // set custom css (if user has specified any styles)
- if (fbpoptsobj.fbpcustomcss) {
- //if(document.getElementById('fbpcssstyler'))
- // document.getElementById('fbpcssstyler').textContent = fbpoptsobj.fbpcustomcss;
- fbpcssstyle.textContent = fbpoptsobj.fbpcustomcss;
- }
-
- if(debug)
- console.log('are we here at the end of initstage 2?');
-
-} //END FUNCTION INITSTAGE2
-
-fbpdynamicreload = function (opts) {
- fbpgetprefs(opts);
- if(document.getElementById('fbpoptsdiv') && document.getElementById('fbpoptsdiv').style.display=='block') {
- document.getElementById('fbpoptsdiv').style.display='none';
- fbptoggleopts();
- }
- resetclasses();
- initstage2();
- //tlbuttinit(); // reset TL button state
- if(fbpoptsobj.timelineonecol==false)
- window.setTimeout(function(){document.getElementById('FBTLX').style.display='none';},1500);
- else
- window.setTimeout(function(){document.getElementById('FBTLX').style.display='block';},1500);
-
- cleartheshizzle(document);
-}
-
-/*
-if(!isasync)
- initstage2(); // run it once to finish initialisation
- have moved this call into fbpgetprefs...
-
-*/
- // function to add delete friend request buttons
- /*function adddelreqbuttons(node) {
- // for adding delete request button to main friend request indicator panel and also the list at https://www.facebook.com/friends/requests/
- commented out for now as was causing errors in line 1991
- actiondivs=node.getElementsByClassName('actions');
- if(!actiondivs.length || !node.getElementsByClassName('uiButtonConfirm').length || node.getElementsByClassName('privacyPlan').length || document.getElementById('questions_stories'))
- return;
- for(var i=0;i<actiondivs.length;i++) {
- //unsafeWindow.console.log(actiondivs[i].childNodes[0].getAttribute('class'));
- if((actiondivs[i].childNodes.length && actiondivs[i].childNodes[0].getAttribute && actiondivs[i].childNodes[0].getAttribute('class').match(/Timeline|actionsDropdown/gi)) || (actiondivs[i].childNodes[1] && actiondivs[i].childNodes[1].getAttribute('id') && actiondivs[i].childNodes[1].getAttribute('id').match(/pagelet_timeline_profile_actions/)) || (actiondivs[i].getElementsByTagName('input').length==0) || actiondivs[i].parentNode.getAttribute('class').match(/stickyHeaderWrap/)) {
- //unsafeWindow.console.log('timeline page');
- continue;
- }
- foundreject=0;
- binps=actiondivs[i].getElementsByTagName('input');
- for(j=0;j<binps.length;j++)
- if(binps[j].getAttribute && binps[j].getAttribute('name') && binps[j].getAttribute('name').match(/actions\[reject\]|Admin Panel/)) {
- foundreject=1;
- break;
- }
- if(!foundreject) {
- delreqbutt=document.createElement('label');
- delreqbutt.className='uiButton uiButtonDefault uiButtonMedium';
- delreqbutt.innerHTML='<input type="submit" title="Delete this request. (The sender wont know.)" name="actions[reject]" value="Delete">';
- actiondivs[i].appendChild(delreqbutt);
- }
- }
-
- }*/
-
- function fpInsertedNodeDomHandler(event) {
- //console.dir(event.target);
- if((event.target.nodeName=='LI') || (event.target.nodeName=='UL')) {
- //if ((document.getElementById('pagelet_home_stream')||(document.getElementById('profile_minifeed'))) && (!document.getElementById('fb_multi_friend_selector'))) {
- if ((document.getElementById('pagelet_home_stream') ) && (!document.getElementById('fb_multi_friend_selector'))) {
- //console.log(event.target.nodeName);
- cleartheshizzle(event.target);
- //unmanglelinks(event.target);
- }
- else {
- ; // not doing anything at the mo
- }
- if(fbpoptsobj.fixarticleredirects && event.target.getElementsByTagName('a').length)
- unmanglelinks(event.target);
- }
- else if(event.target.nodeName=='DIV') {
- //var functRef = callLater(adddelreqbuttons,event.target);
- //setTimeout(functRef, 1500);
- if (document.getElementById('pagelet_litestand_section') || document.getElementById('stream_pagelet')) {
- //console.log(event.target.nodeName);
- cleartheshizzle(event.target);
- //unmanglelinks(event.target);
- }
- if((event.target.getAttribute('id')=='platform_dialog_content') || (event.target.getElementsByClassName('tosPane').length) || (event.target.getAttribute('class') && event.target.getAttribute('class').match(/tosPane/))) {
- //its most likely a facebook application requesting permissions
- highlightemailrequest();
- //appid=document.getElementById('input_app_id').getAttribute('value');
- addblockbuttontopermreq();
- }
- if(event.target.getAttribute('class') && event.target.getAttribute('class').match('middle_area_content')){
- if(window.location.href.match(/\/appcenter\/?/))
- highlightemailrequest();
- }
- if(fbpoptsobj.fixarticleredirects && event.target.getElementsByTagName('a').length)
- unmanglelinks(event.target);
- //fixie7spoof();
- //setTimeout(function(){adddelreqbuttons(event.target)},1000); // add delete friend request buttons if required
- }
- else if((event.target.nodeName=='SPAN') && (event.target.getAttribute && event.target.getAttribute('class') && event.target.getAttribute('class').match(/hasCaption/))) {
- //console.log('hit a spanner');
- unmanglelinks(event.target);
- }
- } // END fpInsertedNodeDomHandler function
-
- function updateblockedcount() {
- crappyappmsgcounter=document.getElementsByClassName('fbpblocked').length;
- var fbpblockcountspan=document.getElementById('fbpblockcount');
- if(fbpblockcountspan)
- fbpblockcountspan.innerHTML=crappyappmsgcounter;
-
- xtramsgcounter=document.getElementsByClassName('fbpblockedx').length;
- var fbpblockxcountspan=document.getElementById('fbpblockxcount');
- if(fbpblockxcountspan)
- fbpblockxcountspan.innerHTML=xtramsgcounter;
- }
-
- function destroyblockedappstories (appid,killmode) {
-
- var appnodes=document.getElementsByClassName('aid_' + appid);
- var appnodeslength=appnodes.length;
- for (var i=0;i<appnodeslength;i++){
- //appnodes=document.getElementsByClassName('aid_' + appid);
- if(killmode=='kill')
- appnodes[0].parentNode.removeChild(appnodes[0]);
- else if(killmode=='allow')
- appnodes[i].className = appnodes[i].className.replace(/\bfbpblocked\b/,'fbpnormal');
-
- if(fpbblockcountspan)
- fpbblockcountspan.innerHTML=--crappyappmsgcounter;
- }
- updateblockedcount();
- //check if there are any blocked msgs left and if not, return to normal homepage view
- blockedmsgs=document.getElementsByClassName('fbpblocked');
- if(!blockedmsgs.length)
- fbpshowblocked();
- appnodes=null;
-
- }// END destroyblockedappstories function
-
- function getdtsg() {
- var fb_dtsg='';
- if(document.getElementsByClassName('autoexpand_mode').length) {
- if(document.getElementsByClassName('autoexpand_mode')[0].wrappedJSObject)
- fb_dtsg = document.getElementsByClassName('autoexpand_mode')[0].wrappedJSObject.fb_dtsg.value;
- else
- fb_dtsg = document.getElementsByClassName('autoexpand_mode')[0].fb_dtsg.value;
- }
- else {
- navinps=document.getElementsByTagName('input');
- for(var i=0;i<navinps.length;i++)
- if(navinps[i].getAttribute('name')=='fb_dtsg') {
- fb_dtsg=navinps[i].getAttribute('value');
- break;
- }
- }
- return fb_dtsg;
- }
-
- function allowapp(appid, appname) {
-
- if (confirm("Do you want to whitelist application : '" + appname +"'" + ".\n\nApplication ID: " + appid)) {
- if(fbpoptsobj.userappwhitelist.length) {
- // theres already value/s in userwhitelist
- try {
- fbpoptsobj.userappwhitelist+=','+appid;
- fbpsavevalue('fbpoptsjson-' + currentuserid, JSON.stringify(fbpoptsobj));
- //document.getElementById("MyElement").className = document.getElementById("MyElement").className.replace(/\bMyClass\b/','')
- window.alert(appname + ' has been Saved to your whitelist');
- refreshwhitelist();
- destroyblockedappstories(appid,'allow');
- }
- catch(e) {
- window.alert('error saving id to whitelist');
- }
-
- }
- else {
- // userwhitelist is blank
- try {
- fbpoptsobj.userappwhitelist=appid;
- fbpsavevalue('fbpoptsjson-' + currentuserid, JSON.stringify(fbpoptsobj));
- window.alert(appname + ' has been Saved to your whitelist');
- refreshwhitelist();
- destroyblockedappstories(appid,'allow');
- }
- catch(e) {
- window.alert('error saving id to whitelist');
- }
- }
- }
- else
- return;
-
- } // END allowapp function
-
- function blockapp(appid, appname, nodeid, autoblock) {
- //var post_form_id = document.getElementById('post_form_id').getAttribute('value');
- var fb_dtsg = getdtsg();
- if(typeof currentuserid=='undefined' || currentuserid=='')
- currentuserid=getuserid();
-
- //unsafeWindow.pages_show_block_app("49572793475", "block", "about");
-
- // if not autoblocking - check if there are multiple apps to block, if so ask if user wants to block all at once
- if(typeof(autoblock)=='undefined') {
- var app2bcount=document.getElementsByClassName('fbpblocked').length;
- if (!confirm("Do you want to block application : '" + appname +"'"))
- return;
- if (app2bcount>1) // check if user wants to block all the currently shown applications
- if(blockallapps())
- return;
- }
- if(document.getElementById('blockapplab'))
- document.getElementById('blockapplab').style.display='none';
-
- document.getElementById(nodeid).setAttribute('style','background:#DCDCDC !important;text-align:center');
- document.getElementById(nodeid).innerHTML='<b>F.B. Purity</b> : Blocking Application : "<span style="color:red">' + appname + '</span>" <img style="text-align:middle" src="http://i289.photobucket.com/albums/ll237/bitingbiting/fb-loading-anim.gif">';
-
- var http = new window.XMLHttpRequest();
- //var url = window.location.protocol + "//" + window.location.hostname + "/ajax/apps/block_app.php?" + "app_id=" + appid + "&type_index=0&source=about&confirm_id=block_" + appid + "&__a=1";
- //var params = "__d=1&confirm=1&fb_dtsg=" + fb_dtsg + "&ok=Okay" ;
- var url = window.location.protocol + "//" + window.location.hostname + "/ajax/apps/block_app.php?" + "app_id=" + appid + "&type_index=0&source=about&confirm_id=block_" + appid;
- var params = "__asyncDialog=1&__user=" + currentuserid + "&__a=1&confirmed=1&fb_dtsg=" + fb_dtsg ;// + phstamp:1658166771106811366130
-
- http.open("POST", url, true);
- //http.setRequestHeader("Referer", window.location.protocol + "//" + window.location.hostname + "/apps/application.php?id=" + appid);
- http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
- //http.setRequestHeader("Content-length", params.length);
- //http.setRequestHeader("Connection", "close");
-
- http.onreadystatechange = function() {
- if(http.readyState == 4 && http.status == 200) {
- if(!http.responseText.match('\"errorSummary\"')){
- //unsafeWindow.console.log("successfully blocked app : '" + appname + "' with id=" +appid + "\n");
- if((nodeid!='platform_dialog_content') &&(nodeid!='pagelet_canvas_content') &&(nodeid!='platformDialogForm'))
- destroyblockedappstories (appid,'kill');
- else {
- document.getElementById(nodeid).innerHTML= '<p style="margin-top:20px;font-size:25px"><a title="App was blocked by the F.B. Purity Browser Extension" href="http://www.fbpurity.com"><img style="vertical-align:middle" src="https://sites.google.com/site/st333v/fbp-1/fbp-ghost-lid-icon-48x48.jpg"></a> ' +appname + ' has been BLOCKED!' + '</p>';
- if(document.getElementsByClassName('platform_dialog_bottom_bar_table').length)
- document.getElementsByClassName('platform_dialog_bottom_bar_table')[0].style.display='none';
- }
-
- }
- else {
- if(http.responseText.match(/\"errorSummary\"\:/))
- var errorsum=http.responseText.match(/\"errorSummary\"\:\"(.*)\",\"error/)[1];
- else
- var errorsum="";
- if(http.responseText.match(/\"errorDescription\"\:/))
- var errordesc=http.responseText.match(/\"errorDescription\"\:\"(.*)\",/)[1];
- else
- var errordesc="";
- if( errorsum.length && errordesc.length )
- var wholeerror = errorsum + ' : ' + errordesc;
- else
- var wholeerror = http.responseText;
- window.alert('app block failed for some reason:\n\n' + wholeerror);
- }
- http=null;
- }
- }
- http.send(params);
-
- } // END blockapp function
-
- function blockappev(ev) {
-
- ev.preventDefault();
- var appname=this.getAttribute('appname');
- var appid=this.getAttribute('appid');
- var nodeid=this.getAttribute('nodeid');
- blockapp(appid,appname,nodeid);
- } // END blockappev function
-
- function allowappev(ev) {
-
- ev.preventDefault();
- var appname=this.getAttribute('appname');
- var appid=this.getAttribute('appid');
- var nodeid=this.getAttribute('nodeid');
- document.getElementById(nodeid).setAttribute('class', document.getElementById(nodeid).getAttribute('class') + ' aid_' + appid);
- allowapp(appid,appname);
- } // END allowappev function
-
- function fbpshowblocked() {
-
- var showhidelink=document.getElementById('fbpshowblockedlink');
- var showorhidetext=showhidelink.textContent;
-
- var showhidelinkx=document.getElementById('fbpshowblockedxlink');
- var showorhidetextx=showhidelinkx.textContent;
-
- var blockedmsgs=document.getElementsByClassName('fbpblocked');
-
- if (showorhidetext=='Show') {
- if(!blockedmsgs.length)
- return;
- showhidelink.innerHTML='Hide';
- showhidelink.title='Hide Application + Game Stories';
- showhidelinkx.innerHTML='Show';
- showhidelinkx.title='Show Extras (Friend/Group/Fan/Event etc Stories)';
- fbpstyle.textContent=fbpStyleApps;
- }
- else {
- showhidelink.innerHTML='Show';
- showhidelink.title='Show Application + Game Stories';
- fbpstyle.textContent=fbpStyleNormal;
- }
-
- //works better in reverse order
- for(i=(blockedmsgs.length-1); i>=0; i--) {
- //unsafeWindow.console.log("show block link: " + i);
- dspBlockLink(blockedmsgs[i]);
- }
-
- blockedmsgs=null;
-
- } // END fbpshowblocked function
-
- function fbpshowblockedx() {
-
- var showhidelinkx=document.getElementById('fbpshowblockedxlink');
- var showorhidetextx=showhidelinkx.textContent;
-
- var showhidelink=document.getElementById('fbpshowblockedlink');
- var showorhidetext=showhidelink.textContent;
-
- var blockedmsgs=document.getElementsByClassName('fbpblockedx');
-
- if (showorhidetextx=='Show') {
- if(!blockedmsgs.length)
- return;
- showhidelinkx.innerHTML='Hide';
- showhidelinkx.title='Hide Extras (Friend/Group/Fan/Event etc Stories)';
- showhidelink.innerHTML='Show';
- showhidelink.title='Show Application + Game Stories';
- fbpstyle.textContent=fbpStyleExtras;
- }
- else {
- showhidelinkx.innerHTML='Show';
- showhidelinkx.title='Show Extras (Friend/Group/Fan/Event etc Stories)';
- fbpstyle.textContent=fbpStyleNormal;
- }
-
- blockedmsgs=null;
-
- } // END fbpshowblockedx
-
- fbpshowblockedev = function (ev) {
- ev.preventDefault();
- fbpshowblocked();
- }
-
- fbpshowblockedxev = function(ev) {
- ev.preventDefault();
- fbpshowblockedx();
- }
-
- function dspBlockLink(node, blockmode) {
- if (node.getElementsByClassName('blocklink').length)
- return;
-
- var appid;
- var appname='';
- // check if its a new FB Actions / Frictionless sharing app
- //uism =node.getElementsByClassName('uiStreamMessage');
- //if(uism.length)
- // if (uism[0].innerHTML.match(/\/hovercard\/application\.php\?id\=(\d*)|\/hovercard\/hovercard\.php\?id=(\d*)/))
- // blockmode='sua';
-
- if (typeof(blockmode)=='undefined') {
- var footernode, headernode;
- headernode=node.getElementsByClassName('uiStreamMessage');
-
- if(document.getElementsByClassName('uiStreamFooter') && document.getElementsByClassName('uiStreamFooter').length) {
- footernode=node.getElementsByClassName('uiStreamFooter')[0];
- }
- else
- if(document.getElementsByClassName('UIActionLinks_bottom') && document.getElementsByClassName('UIActionLinks_bottom').length) {
- footernode=node.getElementsByClassName('UIActionLinks_bottom')[0];
- }
- else {
- footernode='x'; //invalid node will cause exception, luckily we have an exception handler isnt it ;-)
- }
-
- //its possibly an app posing as a normal facebook message, so lets try and get the appid from the footer
- if(headernode.length && headernode[0].innerHTML.match(/application\.php\?id=(\d+)/)) {
- appid=headernode[0].innerHTML.match(/application\.php\?id=(\d+)/)[1];
- }
- else if(footernode.innerHTML.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)) {
- if(typeof footernode.innerHTML.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)[1] !='undefined')
- appid=footernode.innerHTML.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)[1];
- else if(typeof footernode.innerHTML.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)[2] !='undefined')
- appid=footernode.innerHTML.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)[2];
- }
- else
- if(footernode.innerHTML.match(/application\.php\?id=(\d+)/)) {
- if(footernode.innerHTML.match(/application\.php\?id=(\d+)/)[1]!='undefined')
- appid=footernode.innerHTML.match(/application\.php\?id=(\d+)/)[1];
- }
- else
- return;
-
- try {
- //appname=footernode.getElementsByClassName("GenericStory_BottomAttribution")[0].getElementsByTagName('a')[0].textContent;
- if(footernode.innerHTML.match(/data-appname=/))
- appname=footernode.innerHTML.match(/data-appname="([^"]*)"/)[1] ;
- else if (headernode[0].innerHTML.match(/application.php/)){
- appname=headernode[0].innerHTML.match(/application\.php\?id=.*\>(.*)<\/\a\>/)[1];
- }
- else
- {
- flinks=footernode.getElementsByTagName('a');
- appname=flinks[flinks.length-1].textContent;
- if(appname=='')
- appname=flinks[flinks.length-2].textContent;
- }
- } catch (e) {
- appname='mystery app x';
- //unsafeWindow.console.log('error getting application name');
- }
-
- } // END if blockmode=normal (if !blockmode.length)
- else {
- // we are doing this for "started using app/game" (sua) type posts
- var uism = node.getElementsByClassName('uiStreamMessage')
- var alinks=uism[0].getElementsByTagName('a');
- for(var i=0;i<alinks.length;i++){
- var datahover=alinks[i].getAttribute('data-hovercard');
- if(datahover) {
- var datahovermatch=datahover.match(/\/hovercard\/application\.php\?id\=(\d*)/);
- //var datahovermatch2=datahover.match(/\/hovercard\/hovercard\.php\?id=(\d*)/);
- if(datahovermatch) {
- appid=datahovermatch[1];
- appname=alinks[i].textContent;
- break;
- }
- /* else if(datahovermatch2) {
- appname=alinks[i].textContent;
- var nodnod=node.getElementsByTagName('a');
- for(var q=0;q<nodnod.length;i++)
- if(nodnod[q].textContent.match(appname)) {
- appidmatch=nodnod[q].getAttribute('data-hovercard').match(/\/hovercard\/application\.php\?id\=(\d*)/);
- if(appidmatch) {
- appid=appidmatch[1];
- break;
- }
- }
- nodnod=null;
- } */
- }
- }
- if(typeof(appid)=='undefined' || appid =='') { // dealing with frictionless sharing apps such as netflix
- if(node.getAttribute('data-gt')) {
- //"appid":"163114453728333"
- if(node.getAttribute('data-gt').match(/\"appid\":\"\d+\"/)) {
- appid=node.getAttribute('data-gt').match(/\"appid\":\"(\d+)\"/)[1];
- //appname=alinks[alinks.length-1].textContent;
- footerstuff=node.getElementsByClassName("uiStreamFooter");
- if(footerstuff.length){
- footerimagelink=footerstuff[0].getElementsByTagName('a');
- if(footerimagelink.length)
- if(footerimagelink[0].getAttribute('data-appname'))
- appname=footerimagelink[0].getAttribute('data-appname');
- }
- }
- }
- }
- alinks=null;
- }
- //console.log(appid + ' ' + appname);
-
- if (document.getElementsByClassName('uiStreamHide') && document.getElementsByClassName('uiStreamHide').length) {
- hidebuttonclass='uiStreamHide';
- hidebuttonclasses='uiStreamHide';
- linkclasses='blocklink uiStreamContextButton uiPopoverTriggerElem';
- }
- else {
- hidebuttonclass='hideButton';
- hidebuttonclasses='mlm hideButton';
- linkclasses='blocklink mlm hideButton';
- }
-
- hidebuttonclasses='uiStreamContextButton uiPopoverTriggerElem';
-
- var blinkinsertpoint=node.getElementsByClassName(hidebuttonclass)[0];
-
- if(typeof blinkinsertpoint == 'undefined') {
- //alert('hohoho');
- var uism=node.getElementsByClassName('uiStreamMessage');
- if(uism && uism.length)
- blinkinsertpoint=uism[0];
- else
- return;
- }
-
- node.setAttribute('class', node.getAttribute('class') + ' aid_' + appid); // lets do it for all apps (cos on profile pages apps sometimes dont include this class)
- var blinkspan=document.createElement('div');
-
- blinkspan.setAttribute('style',"position:relative;opacity:0.5; top : 23px");
- blinkspan.className=hidebuttonclasses;
-
- blinkspan.innerHTML="<a class='" + linkclasses +"' style='text-decoration: none;' onmouseover='this.style.background=\"red\";this.style.color=\"white\";this.parentNode.style.opacity=\"1\"' onmouseout='this.style.background=\"white\";this.style.color=\"#3B5998\";this.parentNode.style.opacity=\"0.5\"' title='FBP - Block this application' nodeid='" + node.getAttribute('id') + "' appid='" + appid + "' appname='" + appname.replace('"','','g').replace("'",'','g') + "' href='javascript:;'><b><nobr>BA</nobr></b></a>";
- blinkspan.getElementsByTagName('a')[0].addEventListener("click", blockappev, false);
- //blinkinsertpoint.parentNode.insertBefore(blinkspan, blinkinsertpoint); //(insert before pattern)
- blinkinsertpoint.appendChild(blinkspan);
- blinkinsertpoint.appendChild(document.createElement('br')); // separate the 2 links
-
- var alinkspan=document.createElement('div');
- alinkspan.setAttribute('style',"position:relative; opacity:0.5; top : 23px;");
- alinkspan.className=hidebuttonclasses;
-
- alinkspan.innerHTML="<a class='" + linkclasses + "'style='text-decoration: none;' onmouseover='this.style.background=\"green\";this.style.color=\"white\";this.parentNode.style.opacity=\"1\"' onmouseout='this.style.background=\"white\";this.style.color=\"#3B5998\";this.parentNode.style.opacity=\"0.5\"' title='FBP - Whitelist this application' nodeid='" + node.getAttribute('id') + "' appid='" + appid + "' appname='" + appname.replace('"','','g').replace("'",'','g') + "' href='javascript:;'><b><nobr>WL</nobr></b></a>";
- alinkspan.getElementsByTagName('a')[0].addEventListener("click", allowappev, false);
- //blinkinsertpoint.parentNode.insertBefore(alinkspan, blinkinsertpoint); //(insert before pattern)
- blinkinsertpoint.appendChild(alinkspan);
-
- } // END dspBlockLink function
-
- function callLater(paramA, paramB, paramC, paramD, paramE){
- return (function(){
- //blockapp(appid, appname, nodeid, auto);
- paramA(paramB, paramC, paramD, paramE);
- //unsafeWindow.console.log(paramA,paramB, paramC, paramD)
- });
- }
-
- blockallapps = function() {
- var appdump=document.getElementsByClassName('fbpblocked');
- var apparray=[];
- var appnamelist='';
- var applength=0;
- for(var i=0;i<appdump.length;i++) {
- if(appdump[i].getElementsByClassName('blocklink').length && !apparray[appdump[i].getElementsByClassName('blocklink')[0].getAttribute('appid')]) {
- apparray[appdump[i].getElementsByClassName('blocklink')[0].getAttribute('appid')] = appdump[i].getAttribute('id') + ',' + appdump[i].getElementsByClassName('blocklink')[0].getAttribute('appname');
- appnamelist+= appdump[i].getElementsByClassName('blocklink')[0].getAttribute('appname') + '\n';
- applength++;
- }
- }
-
- if(applength==1)
- return false; // return and use normal block app function
-
- if(!confirm('Would you also like to block *ALL* ' + applength + ' of the following facebook applications?\n' + '-------------------------------------------------------------------------------\n\n' + appnamelist.replace(/\n$/,'')))
- return false;
-
- i=0;
- for(var j in apparray) {
- i++;
- var functRef = callLater(blockapp,j,apparray[j].split(/,/)[1], apparray[j].split(/,/)[0], 1);
- window.setTimeout(functRef, 1600*i);
- }
-
- window.scrollTo(0,0); // scroll up, so user can see its working
- appdump=null;
- apparray=null;
- appnamelist=null;
- return true;
- } // END blockallapps function
-
- fbptoggleopts=function(e) {
- if(e)
- e.preventDefault();
- if(!document.getElementById('fbpoptsdiv') && document.getElementById('content') ) {
- optsdiv.innerHTML=fbpoptshtml;
- document.getElementById('content').appendChild(optsdiv);
- document.getElementById('fbpsavesettings').addEventListener('click',fbpsavesettings,false);
-
- document.getElementById('exportsettingslink').addEventListener('click',exportsettingsbasic,false);
- document.getElementById('importsettingslink').addEventListener('click',importsettingsbasic,false);
-
- document.getElementById('custextheader').addEventListener('click',hideotherdivs,false);
- document.getElementById('appwhitelistheader').addEventListener('click',hideotherdivs,false);
- document.getElementById('custcssheader').addEventListener('click',hideotherdivs,false);
- }
-
- //fbpgetprefs(); // is this call really neccessary? opts obj should already be populated, though perhaps opts have changed in another tab/window
- fbppopulateprefs();
- document.getElementById('fbpoptsdiv').style.display='block';
- // get latest fbp news
- //grabjsonfeed('https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http%3A//feeds.feedburner.com/facebookpurity&callback=publishjsonnews'); // cant use till we update to manifest 2
- getfbpnews();
- }
-
- getfbpnews=function() {
- //var FBP_FEED = "https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=5&q=http://feeds.feedburner.com/FacebookPurity";
- var FBP_FEED = "www.facebook.com/feeds/page.php?id=408502197558&format=json";
- // set a callback function
- // https://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=http%3A//api.flickr.com/services/feeds/photos_public.gne%3Fid%3D17472213@N00%26lang%3Den-us%26format%3Drss_200&v=1.0&callback=processResults
- var FBP_FEED_URL = window.location.protocol +"\/\/" + FBP_FEED ; //
- var fbpnewsdiv=document.getElementById('fbpnewsdiv');
- fbpnewsdiv.style.marginLeft='4px';
- fbpnewsdiv.style.marginTop='4px';
- if(fbpnewsdiv.innerHTML.length)
- return;
- fbpnewsdiv.innerHTML+='<h4 style="margin-top:4px"><a title="news.fbpurity.com" href="http://www.fbpurity.com/news.htm">F.B. Purity Latest News</a></h4>';
-
- //fbpnewsdiv.innerHTML+='<span style="color:red">Without warning or explanation, Facebook have disabled the personal account of the developer of F.B. Purity and also the F.B. Purity fan page, which had over 36,000 fans. [ <a href="http://news.fbpurity.com">Please click here for the full story</a> ] </span>';
-
- var http = new window.XMLHttpRequest();
- http.open("GET", FBP_FEED_URL, true);
- //http.setRequestHeader("Connection", "close");
- http.onreadystatechange = function() {
- if(http.readyState == 4 && http.status == 200) {
- try {
- var fbpfeed = JSON.parse(http.responseText);
- }
- catch (e) {
- fbpnewsdiv.innerHTML+='Error : Cant get the news. This can occur if you are logged in to FB as a page Admin.' ;
- http=fbpfeed=null;
- return;
- }
- if(fbpfeed.entries.length<4)
- feedlength=fbpfeed.entries.length;
- else
- feedlength=4;
-
- var newsul=document.createElement('ul');
- newsul.style.marginTop='3px';
- newsul.style.marginLeft='5px';
- var newsli = document.createElement('li');
- for(i=0;i<feedlength;i++) {
- if (!fbpfeed.entries[i].title.replace(/^\ /,'').length) // deal with stupid facebook bug (pics + polls in the json feed dont have titles)
- continue;
- x =new Date (fbpfeed.entries[i].published);
- newsli = document.createElement('li');
- newsli.style.marginBottom="2px";
- newsli.style.listStyleType="disc";
- newsa = document.createElement('a');
- newsa.setAttribute('title', "Published - " + x.toLocaleDateString());
- newsa.setAttribute('target', "_blank");
- newsa.setAttribute('href', fbpfeed.entries[i].alternate);
- newsa.appendChild(document.createTextNode(fbpfeed.entries[i].title.replace(/'/g,"'").replace(/"/g,'"')));
- newsli.appendChild(newsa);
- newsul.appendChild(newsli);
- }
- fbpnewsdiv.appendChild(newsul);
- http=fbpfeed=newsul=newsli=newsa=null;
- }
- }
- http.send();
- } // END getfbpnews function
-
- /*
- Commented out because code wont work with latest chrome, unless we update to manifest v2
-
- function jsoncallbackwrapper() {
-
- publishjsonnews=function(json) {
-
- var fbpnewsdiv=document.getElementById('fbpnewsdiv');
-
- if(fbpnewsdiv.innerHTML.length)
- return;
- fbpnewsdiv.innerHTML+='<h4 style="margin-top:4px"><a title="news.fbpurity.com" href="http://www.fbpurity.com/news.htm">F.B. Purity Latest News</a></h4>';
- if(!json.responseData.feed.entries.length){
- fbpnewsdiv.innerHTML+='Error : Cant get the news.' ;
- return;
- }
- //console.log(json.responseData);
- fbpfeed=json.responseData.feed;
- var newsul=document.createElement('ul');
- newsul.style.marginTop='3px';
- newsul.style.marginLeft='5px';
- var newsli = document.createElement('li');
- for(var i=0;i<4;i++) {
- x =new Date (fbpfeed.entries[i].publishedDate);
- newsli = document.createElement('li');
- newsli.style.marginBottom="2px";
- newsli.style.listStyleType="disc";
- newsa = document.createElement('a');
- newsa.setAttribute('title', "Published - " + x.toLocaleDateString());
- newsa.setAttribute('target', "_blank");
- newsa.setAttribute('href', fbpfeed.entries[i].link);
- newsa.appendChild(document.createTextNode(fbpfeed.entries[i].title.replace(/'/,"'")));
- newsli.appendChild(newsa);
- newsul.appendChild(newsli);
- }
- if(fbpnewsdiv)
- fbpnewsdiv.appendChild(newsul);
- fbpfeed=newsul=newsli=newsa=null;
- //document.getElementsByTagName('body')[0].appendChild(fbpnewsdiv);
- } // END publishjsonnews function
-
- } // END jsoncallbackwrapper
-
- // BEGIN inject code inside jsoncallbackwrapper function into fb page
- var script = document.createElement('script');
- script.appendChild(document.createTextNode('('+ jsoncallbackwrapper +')();'));
- try {
- (document.head || document.body || document.documentElement).appendChild(script);
- }
- catch(e) {
- ;//console.log(e , location.href);
- }
- // END inject jsoncallbackwrapper code into fb page
-
- function grabjsonfeed(url){
- //console.log(url);
- var script=document.createElement('script');
- script.src=url;
- script.type="text/javascript";
- if(document.getElementsByTagName('head').length)
- document.getElementsByTagName('head')[0].appendChild(script);
- }
- */
-
- function fixarticleredirects (node) {
- try {
- //console.log('fixarticleredriects');
- var xtmp=node.getElementsByTagName('a');
- //console.log(node.textContent + xtmp.length);
- for (var i=0;i<xtmp.length;i++)
- if(xtmp[i].getAttribute('href')){
- //console.log(xtmp[i].getAttribute('href'));
- if(xtmp[i].getAttribute('href').match(/redirect_uri=(.*)\&/)) { // matches independent and yahoo
- //console.log('indep yahoo' + xtmp[i].getAttribute('href'));
- xtmp[i].setAttribute('href', decodeURIComponent(xtmp[i].getAttribute('href').match(/redirect_uri=(.*?)\&/)[1].split(/fb_action_ids/)[0]));
- xtmp[i].setAttribute('rel','');
- xtmp[i].setAttribute('mousedown','');
- }
- else if (xtmp[i].getAttribute('href').match(/https?\:\/\/www\.guardian\.co\.uk/)) {
- xtmp[i].setAttribute('href',decodeURIComponent(xtmp[i].getAttribute('href').match(/(https?\:\/\/www\.guardian\.co\.uk.*?)\?fb_action_ids/)[1]));
- //console.log(decodeURIComponent(xtmp[i].getAttribute('href').match(/(http\:\/\/www\.guardian\.co\.uk.*?)\?fb_action_ids/)[1]));
- xtmp[i].setAttribute('rel','');
- xtmp[i].setAttribute('onmousedown','');
- }
- else if (xtmp[i].getAttribute('href').match(/https?\:\/\/www\.facebook\.com\/l\.php\?u=/)) {
- xtmp[i].setAttribute('href',decodeURIComponent(xtmp[i].getAttribute('href').match(/http\:\/\/www\.facebook\.com\/l\.php\?u=(.*)\%3Ffb_action_ids/)[1]));
- //console.log(xtmp[i].getAttribute('href'));
- xtmp[i].setAttribute('rel','');
- xtmp[i].setAttribute('onmousedown','');
- }
- else if(xtmp[i].getAttribute('href').match(/https?\:\/\/apps\.facebook\.com/)){
- if(xtmp[i].textContent.length){ // && xtmp[i].parentNode.getAttribute('class').match(/ogAggregationAnimSubstorySlideHeadline/)
- xtmp[i].setAttribute('href', 'http://google.com/search?q=' + encodeURIComponent("'" + xtmp[i].textContent + "'") + "&btnI=I'm+Feeling+Lucky");
- xtmp[i].setAttribute('rel','');
- xtmp[i].setAttribute('mousedown','');
- }
- }
- } // end if
- //else
- // console.log(xtmp[i].getAttribute('href'));
- xtmp=null;
- } catch(e)
- {
- ;//console.log('feckit! ' + e );
- }
- }
-
- function filtermatchmsg(mnode, msg) {
- if(mnode.getElementsByClassName('filtermatchtext').length)
- mnode.getElementsByClassName('filtermatchtext')[0].textContent=msg;
- else {
- var matchspan=document.createElement('div');
- matchspan.setAttribute('class','filtermatchtext');
- matchspan.style.color='grey';
- matchspan.appendChild(document.createElement('br'));
- matchspan.appendChild(document.createTextNode(msg));
- mnode.appendChild(matchspan);
- }
- }
-
- function cleartheshizzle(thenode) {
- //if(location.href.match(/facebook\.com\/messages\//))
- // return;
- //unsafeWindow.console.log('clearing the shizzle a : ' + location.href);
- var oldfeedstyle=document.getElementById('pagelet_home_stream');
- var newfeedstyle=document.getElementById('pagelet_litestand_section');
- var neweststyle= document.getElementById('stream_pagelet');
- //if(!oldfeedstyle && (!newfeedstyle) && (!neweststyle))
- if(!(oldfeedstyle || newfeedstyle || neweststyle)) {
- console.log('FBP Error: couldnt find the news stream');
- return;
- }
- //if(!document.getElementById('pagelet_home_stream') || (!document.getElementById('pagelet_litestand_section')))
- // return;
-
- if(!document.getElementById('fbpblockcount')) {
-
- crappyappmsgcounter=0;
- fbpstyle.textContent=fbpStyleNormal;
-
- if(document.getElementById('pagelet_fl_composer')) // friends list page
- var insertpoint = document.getElementById('pagelet_fl_composer');
- else if (document.getElementById('profile_stream_composer')) //profile page or fanpage
- var insertpoint = document.getElementById('profile_stream_composer');
- else if (document.getElementById('pagelet_composer')) //homepage
- var insertpoint = document.getElementById('pagelet_composer');
- else if(document.getElementById('timelineNavContent')) {
- return;
- var insertpoint = document.getElementById('timelineNavContent');
- }
- else if(window.location.href.match(/facebook\.com\/apps\/feed/) || window.location.href.match(/facebook\.com\/pages\/feed/))
- var insertpoint = document.getElementById('contentArea');
-
- if(insertpoint) {
- if(document.getElementsByClassName('uiHeaderPage') && document.getElementsByClassName('uiHeaderPage').length)
- document.getElementsByClassName('uiHeaderPage')[0].setAttribute('style','padding-bottom:5px');
- var fbpurityinfowrapper=document.createElement('div');
- if(oldfeedstyle)
- fbpurityinfowrapper.style.marginTop='-10px';
- fbpurityinfowrapper.style.marginBottom='2px';
- fbpurityinfowrapper.setAttribute('id','fbpurityinfowrapper');
- if(document.getElementById('boulder_fixed_header'))
- document.getElementById('boulder_fixed_header').firstChild.style.marginTop='13px';
- var fbpurityinfo=document.createElement('div');
- fbpurityinfo.setAttribute('id','fbpurityinfobar');
- var fbpclear=document.createElement('div');
- fbpclear.style.clear='both';
-
- fbpurityinfo.style.cssFloat='right';
- fbpurityinfo.style.background='whitesmoke';
- fbpurityinfo.innerHTML='<span id="fbpupgradeinfo" style="color:red"></span> <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> ] ';
-
- fbpurityinfowrapper.appendChild(fbpurityinfo);
- fbpurityinfowrapper.appendChild(fbpclear);
-
- if((document.getElementById('pagelet_composer') || document.getElementById('pagelet_fl_composer')) && (!document.getElementById('fbpurityinfobar'))) // homepage // fanpage or // friends list page
- insertpoint.parentNode.insertBefore(fbpurityinfowrapper, insertpoint.nextSibling); // after composer
- else if (document.getElementById('profile_stream_composer') && (!document.getElementById('fbpurityinfobar')))
- insertpoint.parentNode.insertBefore(fbpurityinfowrapper, insertpoint.nextSibling);
- else if (document.getElementById('timelineNavContent') && (!document.getElementById('fbpurityinfobar'))) {
- fbpurityinfowrapper.style.display='none'; // we not showing bar for now, as filtering doesnt work on timeline yet
- insertpoint.appendChild(fbpurityinfowrapper);
- }
- else if(window.location.href.match(/facebook\.com\/apps\/feed/) || window.location.href.match(/facebook\.com\/pages\/feed/)) { // games feed page
- insertpoint.insertBefore(fbpurityinfowrapper, insertpoint.firstChild);
- }
-
- document.getElementById('fbpshowblockedlink').addEventListener("click", fbpshowblockedev, false);
- document.getElementById('fbpshowblockedxlink').addEventListener("click", fbpshowblockedxev, false);
- document.getElementById('fbpoptslink').addEventListener("click", fbptoggleopts, false);
-
- fpbblockcountspan=document.getElementById('fbpblockcount');
- fpbblockxcountspan=document.getElementById('fbpblockxcount');
-
- }
-
- }
-
- //if we navigate away from the page then come back, the event listeners seem to disappear, so lets re-add them here.
- if( document.getElementById('fbpshowblockedlink') ) {
- document.getElementById('fbpshowblockedlink').removeEventListener("click", fbpshowblockedev, false);
- document.getElementById('fbpshowblockedlink').addEventListener("click", fbpshowblockedev, false);
- }
- if( document.getElementById('fbpshowblockedxlink') ) {
- document.getElementById('fbpshowblockedxlink').removeEventListener("click", fbpshowblockedxev, false);
- document.getElementById('fbpshowblockedxlink').addEventListener("click", fbpshowblockedxev, false);
- }
- if( document.getElementById('fbpoptslink') ) {
- document.getElementById('fbpoptslink').removeEventListener("click", fbptoggleopts, false);
- document.getElementById('fbpoptslink').addEventListener("click", fbptoggleopts, false);
- }
-
- // Deal with recent activity blocks
- /*
- if (thenode.getAttribute && thenode.getAttribute('class') && thenode.getAttribute('class').match(/uiStreamMinistoryGroup/)) {
- if(fbpoptsobj.recentactivity) {
- thenode.setAttribute('class',thenode.getAttribute('class') + ' fbpblockedx');
- updateblockedcount();
- return;
- }
- else {
- thenode.setAttribute('class',thenode.getAttribute('class') + ' fbpnormal');
- return;
- }
- }
- else if(thenode.getElementsByClassName('uiStreamMinistoryGroup').length) {
- var rablocks=thenode.getElementsByClassName('uiStreamMinistoryGroup');
- for(var rai=0;rai<rablocks.length;i++)
- if(fbpoptsobj.recentactivity) {
- rablocks[rai].setAttribute('class',rablocks[rai].getAttribute('class') + ' fbpblockedx');
- updateblockedcount();
- }
- else
- rablocks[rai].setAttribute('class',rablocks[rai].getAttribute('class') + ' fbpnormal');
- rablocks=null;
- }
- */
-
- storyclass="uiStreamStory";
-
- var storynodes, singlestory;
- singlestory=0;
- if(oldfeedstyle) {
- storynodes=thenode.getElementsByClassName(storyclass);
- if (!storynodes[0])
- if(thenode.getAttribute && thenode.getAttribute('class') && thenode.getAttribute('class').match(storyclass)) {
- storynodes[0]=thenode;
- singlestory=1;
- }
- else {
- //unsafeWindow.console.log('no generic: ' + thenode.getAttribute('class'));
- return;
- }
- }
- else { // new newsfeed design
- storynodes=thenode.querySelectorAll("div[data-dedupekey]");
- if (!storynodes[0])
- if(thenode.getAttribute && thenode.getAttribute('data-dedupekey')) {
- storynodes[0]=thenode;
- singlestory=1;
- }
- else {
- //unsafeWindow.console.log('no generic: ' + thenode.getAttribute('class'));
- return;
- }
- }
-
- var blockit, blockitx;
- var story_meta, fbpAppId; // story_type,
- var attribappid, attribnode, fbpAppIdMatch;
- var storysaction, storysactiontext;
- var actoria, actorialink, actoriadatacard;
- var storyattachments,storyattachment;
-
- if(singlestory)
- storynodeslength=1;
- else
- storynodeslength=storynodes.length;
-
- // START MAIN LOOP
- for(i=0;i<storynodeslength;i++) {
- if(oldfeedstyle) {
- if(storynodes[i].nodeName=='DIV') //deal with anomalous div that has classname pvm
- continue;
- if((storynodes[i].parentNode.parentNode && storynodes[i].parentNode.parentNode.getAttribute('class') && storynodes[i].parentNode.parentNode.getAttribute('class').match('uiStreamMinistoryGroup')) || ((storynodes[i].parentNode.parentNode.parentNode.parentNode.getAttribute('class') && storynodes[i].parentNode.parentNode.parentNode.parentNode.getAttribute('class').match('uiStreamMinistoryGroup'))))
- continue;
- }
-
- blockit=0;
-
- //console.log(storynodes[i].textContent);
-
- //parse the story's header for the story type and check the header for any matches
- if(oldfeedstyle)
- storysaction=storynodes[i].getElementsByClassName('uiStreamMessage');
- else
- storysaction=storynodes[i].getElementsByTagName('h5');
- if(storysaction && storysaction.length) {
- //unsafeWindow.console.log(storysaction + storysaction.length + storysaction[0].textContent);
- storysactiontext=storysaction[0].textContent;
- }
- else {
- if(oldfeedstyle)
- storysactiontext='';
- else
- storysactiontext=storynodes[i].textContent;
- }
- if(typeof storysactiontext=='undefined')
- storysactiontext='';
-
- if(debug)
- console.log(storysactiontext);
- storyattachments=storynodes[i].getElementsByClassName('uiStreamAttachments');
- story_meta=storynodes[i].getAttribute('data-ft');
- if(story_meta==null) {
- /*
- if(storynodes[i].getElementsByClassName('fss').length) { // check for Recent Activity Blocks
- // need to check fbpopts for whether to treat as extra
- if(fbpoptsobj.recentactivity==1)
- storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+ ' fbpblockedx');
- else
- storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+ ' fbpnormal');
- updateblockedcount();
- continue;
- }
- */
- if(storynodes[i].className.match(/uiFacepile|uiListHorizontal|uiListVerticalItemBorder/)) { // deals with new feature of friends list pages
- continue;
- }
- break;
- }
-
- // sponsored stories filter
- if(fbpoptsobj.sponsoredbox && story_meta && story_meta.match(/"ei"/)) {
- storynodes[i].style.display='none';//backgroundColor='red';
- continue;
- }
- // "play with friends" story filter
- if(fbpoptsobj.filterappmessages && storynodes[i].getAttribute('class').match(/aid_140332009231/)) {
- storynodes[i].style.display='none'; //.style.backgroundColor='red';
- continue;
- }
-
- // experimental swearing filter (seems a bit memory intensive..)
- /*
- var swearfilter=1;
- if(swearfilter) {
- storynodes[i].innerHTML=storynodes[i].innerHTML.split(/cunt|shit|piss|fuck|wank|arse|tits|cocksucker/).join("****");
- }
- */
-
- /*
- var foundspon=0;
- ufooter=storynodes[i].getElementsByClassName('uiStreamFooter');
- if(ufooter.length){
- for(g=0;g<ufooter.length;g++)
- if(ufooter[g].textContent.match(/· Sponsored/)) {
- storynodes[i].style.display='none';
- if(debug)
- console.log("Hid sponsored story\n\n" + storynodes[i].textContent);
- foundspon=1;
- break;
- }
- if(foundspon)
- continue;
- }
- */
-
- // start fan page story filter . also check that we are not on an fb fan page or the story is not by the current logged in user,
- //if(fbpoptsobj.pagestory && (!document.getElementById('pagelet_pages_about'))) {
- //console.log(storynodes[i].innerHTML);
- actoria=storynodes[i].getElementsByClassName('uiStreamMessage');
- if(actoria.length) {
- actorialink=actoria[0].getElementsByTagName('a')[0];
- if(typeof(actorialink)!='undefined') {
- actoriadatacard=actorialink.getAttribute('data-hovercardx');
- if(!actoriadatacard)
- actoriadatacard=actorialink.getAttribute('data-hovercard');
- }
- if(actoriadatacard) {
- if (actoriadatacard.match(useridwhitelistRX)) { // if its fbp or the current user
- storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+ ' fbpnormal');
- actoriadatcard=null;
- actorialink=null;
- actoria=null;
- continue;
- }
- else if(fbpoptsobj.pagestory && (!document.getElementById('pagelet_pages_about')) && actoriadatacard.match(/page\.php/) && (!window.location.href.match(/facebook.com\/(pages\/feed|lists\/)/))) {
- // if we are on the "page feed" or interest list leave it alone
- //if(actoriadatacard.match(/page\.php/) && (!actoriadatacard.match(/id=408502197558/))) {
- //its a page and its not fbp;
- storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+ ' fbpblockedx');
- filtermatchmsg(storynodes[i],'FBP : Story Type Filter Match - Fan Page Story');
- updateblockedcount();
- actoriadatcard=null;
- actorialink=null;
- actoria=null;
- continue;
- }
- actoriadatacard=null;
- }
- actorialink=null;
- }
- actoria=null;
- // end fan page story filter
-
- //unsafeWindow.console.log('"'+storysactiontext+'"' + ' ' + headerTextFilter);
- // lets check the header text filter
- if((fbpoptsobj.fixarticleredirects && storysactiontext.length && storysactiontext.match(/ article/)) || storynodes[i].getElementsByClassName('ogAggregationSubstory').length || storynodes[i].getElementsByClassName('ogStaticSlidePager').length || storynodes[i].getElementsByClassName('ogSliderAnimPager').length) {
- fixarticleredirects(storynodes[i]);
- }
-
- if(storysactiontext.length && headerTextFilter.length && storysactiontext.match(headertextfilterRX)) {
- storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
- //matchspan=document.createElement('div');
- //matchspan.style.color='grey';
- matchedtext=storysactiontext.match(headertextfilterRX)[0];
- filtermatchmsg(storynodes[i],' FBP : Story Type Filter Match - ' + matchedtext);
- //if(matchedtext.match(/ article/))
- // fixarticleredirects(storynodes[i]);
- storysactiontext=matchedtext='';
- updateblockedcount();
- continue;
- }
-
- // lets check the text filter
- if(cleancustomtextfilter.length && storynodes[i].textContent.length && storynodes[i].textContent.match(textfilterRX)) {
- //window.console.log(storynodes[i].textContent)
- storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
- filtermatchmsg(storynodes[i],' FBP : Custom Text Filter Match - ' + storynodes[i].textContent.match(textfilterRX)[0]);
- updateblockedcount();
- continue;
- }
-
- // if hide all photos option has specifically been ticked
- //if(fbpoptsobj.sharedphoto && fbpoptsobj.uploadedphoto && fbpoptsobj.taggedlikescommentphoto && fbpoptsobj.taggedalbum)
- if((typeof fbpoptsobj.hideallphotos!=='undefined') && fbpoptsobj.hideallphotos)
- if(!window.location.href.match(/facebook\.com\/\?sk=app_2305272732_2392950137/))
- if(storynodes[i].getElementsByClassName('photoRedesign').length) {
- storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
- filtermatchmsg(storynodes[i],' FBP : Story Type Filter Match - Hide All Photos');
- updateblockedcount();
- continue;
- }
-
- if((typeof fbpoptsobj.hideallvideos!=='undefined') && fbpoptsobj.hideallvideos) {
- //if(!window.location.href.match(/facebook\.com\/\?sk=app_2305272732_2392950137/))
- if(storynodes[i].getElementsByClassName('uiVideoThumb').length) {
- storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
- filtermatchmsg(storynodes[i],' FBP : Story Type Filter Match - Hide All Videos');
- updateblockedcount();
- continue;
- }
- }
- else if ((typeof fbpoptsobj.sharedvideo!=='undefined') &&fbpoptsobj.sharedvideo){
- var svid=storynodes[i].getElementsByClassName('shareMediaVideo');
- if(svid.length)
- if(svid[0].getAttribute('href') && svid[0].getAttribute('href').match(/facebook\.com\/video\/video\.php/)) {
- storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
- filtermatchmsg(storynodes[i],' FBP : Story Type Filter Match - Hide Shared Video');
- updateblockedcount();
- svid=null;
- continue;
- }
- }
-
- // probably could get rid of this bracket... (it used to be part of a big if/else statement
- {
- // so far it looks like a normal story, but lets check if its been posted by an application
- //unsafeWindow.console.log("normal?:" + storynodes[i].getElementsByClassName('uiStreamSource')[0].textContent);
- blockit=0;
-
- // these 3 blocks of code need to be refactored
- attribnode=storynodes[i].getElementsByClassName('UIIntentionalStory_BottomAttribution');
- if(attribnode && attribnode.length) {
- attribnode=attribnode[0];
- if(attribnode.innerHTML.match(/\?id=(\d+)\"/)) {
- attribappid=attribnode.innerHTML.match(/\?id=(\d+)\"/)[1];
- if(attribappid){
- if(!arrwhitelist2[attribappid])
- blockit=1; // its not in the whitelist so block it
- }
- }
- }
-
- attribnode2=storynodes[i].getElementsByClassName('GenericStory_BottomAttribution');
- if(attribnode2 && attribnode2.length) { // GenericStory
- attribnode2=attribnode2[0];
- if (attribnode2.innerHTML.match(/id=(\d+)/)) {
- attribappid=attribnode2.innerHTML.match(/id=(\d+)/)[1];
- if(attribappid){
- if(!arrwhitelist2[attribappid])
- blockit=1; // its not in the whitelist so block it
- }
- }
- }
-
- attribnode3=storynodes[i].getElementsByClassName('uiStreamSource');
- if(attribnode3 && attribnode3.length) {
- attribnode3=attribnode3[0];
- if (attribnode3.innerHTML.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)) {
- if(typeof attribnode3.innerHTML.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)[1] !='undefined')
- attribappid=attribnode3.innerHTML.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)[1];
- else if (typeof attribnode3.innerHTML.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)[2] !='undefined')
- attribappid=attribnode3.innerHTML.match(/php\?id=(\d+)\"|\"\;app_id\"\;\:(\d+)\,/)[2];
- if(attribappid){
- if(!arrwhitelist2[attribappid])
- blockit=1; // its not in the whitelist so block it
- }
- }
- }
-
- attribnode4=storynodes[i].getElementsByClassName('UIActionLinks_bottom');
- if(attribnode4 && attribnode4.length) {
- attribnode4=attribnode4[0];
- if (attribnode4.innerHTML.match(/application.php\?id=(\d+)/)) {
- attribappid=attribnode4.innerHTML.match(/application.php\?id=(\d+)/)[1];
- if(attribappid){
- if(!arrwhitelist2[attribappid])
- blockit=1; // its not in the whitelist so block it
- }
- }
- }
- // new app checks for fb actions / frictionless sharing apps
- var sua=0;
- if(storysaction && storysaction.length) {
- attribappid=storysaction[0].innerHTML.match(/\/hovercard\/application\.php\?id\=(\d*)/);
- if(attribappid) {
- if(!arrwhitelist2[attribappid[1]]) {
- blockit=1; // its not in the whitelist so block it
- sua=1; // sua = started using app?
- }
- }
- else {
- if(storynodes[i].getAttribute('data-gt')) {
- //"appid":"163114453728333"
- if(storynodes[i].getAttribute('data-gt').match(/\"appid\":\"\d+\"/)) {
- attribappid=storynodes[i].getAttribute('data-gt').match(/\"appid\":\"(\d+)\"/)[1];
- if(!arrwhitelist2[attribappid]) {
- blockit=1; // its not in the whitelist so block it
- sua=1; // sua = started using app?
- }
- }
- }
- }
- }
-
- if(blockit) {
- // mark app as blocked
- storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+ filterapptext);
- if(sua)
- dspBlockLink(storynodes[i],"sua");
- else
- dspBlockLink(storynodes[i]);
- }
- else {
- //its probably a "normal" story node but lets check for attachments (photos or links)
- //if ((fbpoptsobj.postedlink || fbpoptsobj.sharedphoto) && (!storynodes[i].getAttribute('class').match(/fbp/)) && storyattachments.length ) {
- if (fbpoptsobj.postedlink && (!storynodes[i].getAttribute('class').match(/fbp/)) && storyattachments.length ) {
- storyattachment=storyattachments[0];
- storylinks=storyattachment.getElementsByTagName('a');
- if(storylinks.length) {
- storylink=storylinks[0];
- if (fbpoptsobj.postedlink && storylink.getAttribute('onclick') && storylink.getAttribute('onclick').match(/^LinkshimAsync/)) {
- //its an external link
- storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
- //unsafeWindow.console.log("postedlink= " +fbpoptsobj.postedlink);
- //storynodes[i].appendChild(filtermatchmsg(' FBP : Story Type Filter - Shared a link'));
- filtermatchmsg(storynodes[i],' FBP : Story Type Filter - Shared a link');
- }
- /*else if (fbpoptsobj.sharedphoto && storynodes[i].getElementsByClassName('uiPhotoThumb').length) // should we also check for uiMediaThumb ???
- // its a shared photo
- storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');*/
- else {
- storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpnormal');
- }
- }
- else {
- storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpnormal');
- }
- //else if(storyattachment.getElementsByClassName('uiVideoThumb').length)
- //unsafeWindow.console.log(storyattachment.textContent);
- //check for attachments
- storyattachments={};
- storyattachment=null;
- }
- else
- storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpnormal');
- }
- // check for wall posts
- if(fbpoptsobj.commentwall && (typeof(storynodes[i])!='undefined') && storynodes[i].getAttribute && storynodes[i].getAttribute('class').match(/fbpnormal/)) {
- var wallarrows=storynodes[i].getElementsByClassName('wallArrowIcon');
- if(wallarrows.length) {
- storynodes[i].setAttribute('class',storynodes[i].getAttribute('class').replace('fbpnormal','') + ' fbpblockedx');
- //storynodes[i].setAttribute('class',storynodes[i].getAttribute('class')+' fbpblockedx');
- //storynodes[i].appendChild(filtermatchmsg(' FBP : Story Type Filter Match - Commented on Wall'));
- filtermatchmsg(storynodes[i],' FBP : Story Type Filter Match - Wrote on Wall');
- }
- }
- }
-
- updateblockedcount();
-
- } // End For Loop through feed nodes
-
- storynodes=null;
-
- }// END cleartheshizzle function
-
-
-///////////////////////////////////////
-// BEGIN BRING BACK NORMAL COMMENTING
-///////////////////////////////////////
-bringbacknormalcommenting = function() {
- if(debug)
- console.log('inside bring back normal commenting function');
-
- if(typeof(window.navigator.vendor)!='undefined') //fix the stupid comment box growing too much in safari and chrome
- if(window.navigator.userAgent.match(/Safari/)) //Apple Computer
- //if(window.navigator.userAgent.match(/AppleWebKit/))
- if(document.getElementById('fbpfreestyler'))
- document.getElementById('fbpfreestyler').textContent += ' textarea.uiTextareaAutogrow {max-height:250px !important}'
-
- fbptasubmit = function (e) {
- //console.log(e.target.getAttribute('id'));
- //var fbpcta=document.getElementById('x' + e.target.getAttribute('id').split(/butt/)[0]);
- var fbpcta=document.querySelector("textarea[data-x-reactid=\""+ e.target.getAttribute('id').split(/butt/)[0] + "\"]"); // getElementById('x' + e.target.getAttribute('id').split(/butt/)[0]);
- if(!fbpcta)
- return;
- //fbpcta.setAttribute('id',fbpcta.getAttribute('id').split(/x/)[1]);
- fbpcta.setAttribute('data-reactid',fbpcta.getAttribute('data-x-reactid'));
- fbpcta.focus();
- e.target.value="Now press 'Enter' to submit your comment";
- //e.target.parentNode.style.left="95px"; // width is wrong for photo comments
-
- //if(window.navigator.userAgent.match(/Opera/))
- // e.target.removeListener('click',fbtasubmit)
- //else
- e.target.disabled=true;
- if(window.navigator.userAgent.match(/Opera/))
- e.target.style.backgroundColor='red !important';
- var xnode=fbpcta;
- while(xnode.parentNode) {
- if(xnode.parentNode.nodeName=="FORM") {
- //xnode.parentNode.submit();
- //window.Event.__inlineSubmit(xnode.parentNode);
- break;
- }
- xnode=xnode.parentNode
- }
- }
-
-if (fbpoptsobj.commentbutton) { // when editing a comment, if first key pressed is enter, the text is submitted, if not then it works ok.
- if(debug)
- console.log('bring back normal commenting function is ENABLED');
- window.addEventListener('keydown', function(event) {
- if (event.target.tagName && (event.target.tagName=="TEXTAREA")) {
- if(event.target.getAttribute('class')) {
- event.target.setAttribute('class',event.target.getAttribute('class').replace(/enter_submit/,''));
- }
- if(event.target.getAttribute('data-reactid')) { // && event.target.getAttribute('id').match(/^\.reactRoot/)
- event.target.setAttribute('data-x-reactid',event.target.getAttribute('data-reactid'));
- event.target.setAttribute('data-reactid',''); //'x' + event.target.getAttribute('data-reactid'));
- var tmph=event.target.parentNode.parentNode.parentNode.getElementsByClassName('monglab');
- if(tmph.length) {
- tmph[0].getElementsByTagName('input')[0].value='Comment';
- //tmph[0].getElementsByTagName('input')[0].parentNode.style.left="250px";
- if(window.navigator.userAgent.match(/Opera/))
- tmph[0].getElementsByTagName('input')[0].style.backgroundColor="#5B74A8";
- tmph[0].getElementsByTagName('input')[0].disabled=false;
- // tmph[0].addEventListener('click',fbptasubmit,false);
- //else
- // tmph[0].getElementsByTagName('input')[0].disabled=false;
- }
- else {
- monglab=document.createElement('label');
- //monglab.setAttribute('style','float:right');
- monglab.setAttribute('class','monglab mts commentBtn stat_elem optimistic_submit uiButton uiButtonConfirm');
- monglab.setAttribute('style','');//position:relative;left:250px // width is wrong for photo comments
- monglab.innerHTML='<input value="Comment" class="enter_submit_target" name="comment" type="button" id="' + event.target.getAttribute('data-x-reactid') + 'butt' + '">';
- monglab.addEventListener('click',fbptasubmit,false);
- event.target.parentNode.parentNode.parentNode.appendChild(monglab);
- }
- }
- }
- } , false);
-
- if (document.getElementById('fbpfreestyler'))
- document.getElementById('fbpfreestyler').textContent += ' .sendOnEnterTip , .commentUndoTip {display:none !important} .hidden_elem .optimistic_submit, #facebook .child_is_active .hidden_elem.commentBtn, #fbPhotoSnowliftFeedbackInput .hidden_elem.commentBtn {display:block !important;} div.-cx-PRIVATE-fbGiftTodayBirthdaysCoverPhoto__coverBlock {overflow:auto}';
-
- bringbackcommentbuttons=function () {
- //deal with the ticker flyout comment boxes
- var plops=document.getElementsByClassName('uiContextualDialogPositioner');
- var combutts2;
- for(var i=0;i<plops.length;i++) {
- combutts2=plops[i].getElementsByClassName('optimistic_submit');
- if(combutts2.length)
- combutts2[0].setAttribute('style','display:block !important');
- }
- //deal with birthday flyout comment boxes and groups new member boxes
- var remconts=document.getElementsByClassName('fbRemindersContent');
- if(remconts.length) {
- for(var m=0;m<remconts.length;m++) {
- plops=remconts[m].getElementsByClassName('pam');
- var combutts3,comta;
- for(i=0;i<plops.length;i++) {
- combutts3=plops[i].getElementsByClassName('hidden_elem');
- for(j=combutts3.length-1;j>=0;j--)
- if(!combutts3[j].getAttribute('class').match(/highlighterContent/) && (combutts3[j].nodeName!='DIV'))
- combutts3[j].setAttribute('class','uiButton uiButtonConfirm');
- comta=plops[i].getElementsByClassName('enter_submit');
- for(l=comta.length-1;l>=0;l--)
- comta[l].setAttribute('class',comta[l].getAttribute('class').replace('enter_submit',''));
- }
- }
- }
-
- // deal with birthdays box in newsfeed itself
- var blobuts=document.querySelectorAll('.-cx-PRIVATE-fbGiftTodayBirthdays__list label.hidden_elem');
- if(blobuts.length)
- for(m=0;m<blobuts.length;m++)
- blobuts[m].setAttribute('class','uiButton uiButtonConfirm');
-
- plops=remconts=comta=blobuts=null;
- }
-
- bringbackcommentbuttons();
-
- var waitfordom=setInterval(function(){
- //clearInterval(waitfordom);
- bringbackcommentbuttons();
- }, 3000);
-
-} // END IF hide button option has not been selected
-else
- if(debug)
- console.log('bring back normal commenting function is NOT ENABLED');
-/////////////////////////////////////
-// END BRING BACK NORMAL COMMENTING
-/////////////////////////////////////
-} // end bringbacknormalcommenting function
-
-function fixexternallinkredirects() {
- // fix external link redirects
- window.setTimeout(function() {UntrustedLink=null;if(typeof(LinkshimAsyncLink)!='undefined') LinkshimAsyncLink.referrer_log = LinkshimAsyncLink.swap = search_logged_ajax=function(){;};},0);
- window.setTimeout(function() {UntrustedLink=null;if(typeof(LinkshimAsyncLink)!='undefined') LinkshimAsyncLink.referrer_log = LinkshimAsyncLink.swap = search_logged_ajax=function(){;};},5000);
- window.setInterval(function(){UntrustedLink=null;if(typeof(LinkshimAsyncLink)!='undefined') LinkshimAsyncLink.referrer_log = LinkshimAsyncLink.swap = search_logged_ajax=function(){;};},60000);
-
- unmanglelinks = function(nodetofix) {
- //console.log(typeof(nodetofix));
- if(typeof(nodetofix)=='undefined')
- var nodetofix=document;
- if(nodetofix.getElementsByTagName) {
- var as=nodetofix.getElementsByTagName('a');
- for(var i=0;i<as.length;i++)
- if(as[i].href && as[i].href.match(/\/l\.php\?/)) {
- as[i].href=decodeURIComponent(as[i].href.match(/\/l\.php\?u=(.*)\&h=/)[1]);
- //console.log(decodeURIComponent(as[i].href));
- }
- }
- }
- window.setTimeout(unmanglelinks,3000); // run on first load of page
-}
-
-// new fix links code>
-//as=document.getElementsByTagName('a');for(i=0;i<as.length;i++)if(as[i].href.match(/\/l\.php/))console.log(as[i].href)
-
-
-// this function is duplicated, as it is also injected into the page's dom, so it can run from there too
-unmanglelinks = function(nodetofix) {
- //console.log('unmanglelinks');
- if(typeof(nodetofix)=='undefined')
- var nodetofix=document;
- if(nodetofix.getElementsByTagName) {
- var as=nodetofix.getElementsByTagName('a');
- for(var i=0;i<as.length;i++) {
- //if(as[i].href.match(/l\.php/)) console.log((as[i].href));
- if(as[i].href.match(/\/l\.php\?u=(.*)\&h=/)) {
- as[i].href=decodeURIComponent(as[i].href.match(/\/l\.php\?u=(.*)\&h=/)[1]);
- //console.log(decodeURIComponent(as[i].href));
- }
- }
- }
-}
-// END Duplicated function
-
-////////////////////////////////////////////////////////////////
-// BEGIN FUNCTION deleterecentactivitymodule
-// function deleterecentactivitymodule is just a wrapper for the code, so we can inject it into the fb page
-function deleterecentactivitymodule () {
-
-/* BEGIN HISTORY STATE CHANGE HANDLER */
-(function(history){
- var pushState = history.pushState;
- history.pushState = function(state) {
- if (typeof history.onpushstate == "function") {
- history.onpushstate({state: state});
- }
- // ... whatever else you want to do
- // maybe call onhashchange e.handler
- //console.log('history state changed:' + arguments[0]);
- // experiment to disable theatre mode
- //if(arguments[0].match(/\/photo\.php\?.*\&theater/))
- // location.href=arguments[0];
-
- /* facebook has now added an event delete button
- if(arguments[0].match(/\/events\//)) {
- setTimeout(deleventbutt,3000);
- }
- */
- if(arguments[0].match(/facebook\.com\/?$|\/\?sk=/)) {
- window.setTimeout(fixsortorder,5500); // this line stops image viewer from working properly if the "if statement" above is not there
- }
- else if(arguments[0].match(/\/appcenter\/|\/dialog\/oauth\//)) {
- window.setTimeout(highlightemailrequest,6500);
- window.setTimeout(addblockapplinktoapppage,6500);
- window.setTimeout(addblockbuttontopermreq,6500)
- }
-
-
- //console.dir(arguments[0]);
- return pushState.apply(window.history, arguments);
- }
-})(window.history);
-/* END HISTORY STATE CHANGE HANDLER*/
-
-}
-// END FUNCTION deleterecentactivitymodule
-
-addexternallinkfix = function() {
-/////////////////////////////////////////////////////////////
-// BEGIN inject deleterecentactivitymodule code into fb page
- var scriptx = document.createElement('script');
- scriptx.setAttribute('id','scriptx');
- if(fbpoptsobj.fixarticleredirects) // fix external link redirects
- scriptx.appendChild(document.createTextNode('('+ fixexternallinkredirects +')();'));
-
- scriptx.appendChild(document.createTextNode('('+ deleterecentactivitymodule +')();'));
-
- (document.head || document.body || document.documentElement).appendChild(scriptx);
-// END inject deleterecentactivitymodule code into fb page
-////////////////////////////////////////////////////////////////
-}
-
-addblockbuttontopermreq = function() {
- //console.log("in addblockbuttontopermreq function");
- buttbars=document.getElementsByClassName('platform_dialog_buttons');
- if(!buttbars.length)
- buttbars=document.getElementsByClassName('rightContent');
- if(!buttbars.length)
- buttbars=document.getElementsByClassName('uiOverlayFooterButtons');
- if(buttbars.length) {
- buttbar=buttbars[0];
- //if(location.href.match(/client_id=/)
- //var bappid=window.location.href.match(/[client|app]_id=(\d*)/)[1];
- var bappid;
- if(document.getElementById('input_app_id'))
- bappid=document.getElementById('input_app_id').getAttribute('value');
- else if (document.getElementsByClassName('legalese').length) {
- var legas=document.getElementsByClassName('legalese')[0].getElementsByTagName('a');
- if(legas.length)
- for(var v=legas.length-1;v>=0;v--)
- if(legas[v].getAttribute('ajaxify').match(/cid=(\d+)/)) {
- bappid=legas[v].getAttribute('ajaxify').match(/cid=(\d+)/)[1];
- break;
- }
- }
- else if (document.getElementsByName('app_id').length ){
- bappid=document.getElementsByName('app_id')[0].getAttribute('value');
- }
-
- var titleclass=document.getElementsByClassName('fsxl');
- if(titleclass.length)
- var bapname=titleclass[0].textContent;
- else
- if(document.getElementById('permPanel'))
- bapname=document.getElementById('permPanel').getElementsByTagName('b')[0].textContent;
- else if (document.getElementsByClassName('permissions_app_name').length)
- bapname=document.getElementsByClassName('permissions_app_name')[0].textContent;
- else
- var bapname="Application";
- /*
- blahlink=document.createElement('a');
- blahlink.setAttribute('ajaxify','/ajax/apps/block_app.php?app_id=' + bappid + '&type_index=0&source=about&confirm_id=block_app_link');
- blahlink.setAttribute('rel','dialog');
- blahlink.setAttribute('id','js_3');
- blahlink.style.marginLeft='4px';
-
- blahlab=document.createElement('label');
- blahlab.setAttribute('class','uiButton uiButtonConfirm uiButtonLarge');
- blahlab.setAttribute('id','blockapplab');
- blahlab.setAttribute('appid',bappid);
- blahlab.setAttribute('appname',bapname);
- blahlab.setAttribute('nodeid','platform_dialog_content'); //globalContainer
- //blahlab.setAttribute('style','position:absolute;top:-15px;left:520px');
- blahlab.setAttribute('title','Block this application with F.B. Purity');
- //blahlab.innerHTML='<input value="Block App" name="block" type="button" id="appblocker">';
- blahlab.innerHTML='<span style="color:white">Block</span>';//<div id="block_app_link"><a style="color:white" rel="dialog" ajaxify="/ajax/apps/block_app.php?app_id=' + bappid + '&type_index=0&source=about&confirm_id=block_app_link" href="#" id="js_3" class="">Block</a></div>';
- blahlink.appendChild(blahlab);
- // new block code, get id of cancel_click button, and click it to close dialog
- //<div id="block_app_link"><a style="color:white" rel="dialog" ajaxify="/ajax/apps/block_app.php?app_id=182901371776451&type_index=0&source=about&confirm_id=block_app_link" href="#" id="js_3" class="">Block</a></div>
-
- buttbox=document.getElementsByClassName('rightContent');
- if(buttbox.length)
- buttbox[0].appendChild(blahlink);
- else {
- buttbox2=document.getElementsByClassName('platform_dialog_buttons');
- if(buttbox2.length)
- buttbox2[0].appendChild(blahlink);
- }
- */
-
- /* BEGIN NEW / OLD CODE */
- /* ---------------------*/
- blahlab=document.createElement('label');
- blahlab.setAttribute('class','uiButton uiButtonConfirm uiButtonLarge');
- blahlab.style.marginLeft="2px";
- blahlab.setAttribute('id','blockapplab');
- blahlab.setAttribute('appid',bappid);
- blahlab.setAttribute('appname',bapname);
- if(document.getElementById('platform_dialog_content'))
- blahlab.setAttribute('nodeid','platform_dialog_content');//globalContainer
- else if(document.getElementsByClassName('tosPane').length)
- document.getElementsByClassName('tosPane')[0].setAttribute('id','platform_dialog_content');
- else if (document.getElementById('platformDialogForm'))
- blahlab.setAttribute('nodeid','platformDialogForm');
-
- //blahlab.setAttribute('style','position:absolute;top:-15px;left:520px');
- blahlab.setAttribute('title','Block this application with F.B. Purity');
- blahlab.innerHTML='<input value="Block App" name="block" type="button" id="appblocker">';
- //document.getElementById('content').appendChild(blahlab);
-
-
- /*buttbox=document.getElementsByClassName('rightContent');
- if(buttbox.length)
- buttbox[0].appendChild(blahlab);
- else {
- buttbox2=document.getElementsByClassName('platform_dialog_buttons');
- if(buttbox2.length)
- buttbox2[0].appendChild(blahlab);
- }
- */
-
- buttbar.appendChild(blahlab);
-
- if(document.getElementById('appblocker'))
- document.getElementById('blockapplab').addEventListener('click',blockappev,false);
- /* -------------------*/
- /* END NEW / OLD CODE */
-
- //if(document.getElementById('appblocker'))
- // document.getElementById('blockapplab').addEventListener('click',blockappev,false);
-
- //if((!location.href.match(/www\.facebook\.com\/connect\/uiserver\.php/)) && document.getElementById('block_app_link')) // hide the original dialog only if we are not in a frame on another site, otherwise we lose the block dialog too
- // document.getElementById('block_app_link').addEventListener('click',function() { document.getElementById('cancel_clicked').click();},false);
-
- // if requesting permission to send direct emails, warn user by highlighting it
- highlightemailrequest();
- }
-}
-
-highlightemailrequest = function() {
- if(debug)
- console.log('in highlightemailrequest function');
- // if a facebook application is requesting the users email address highlight it
- var appperms=document.getElementsByClassName('gdp_list_item');
- if(appperms.length)
- for(var i=0;i<appperms.length;i++) {
- if(appperms[i].getElementsByClassName('send-email-change-link').length)
- appperms[i].setAttribute('style', 'border:4px solid red');
- if(appperms[i].textContent.match(/Post on my behalf/))
- appperms[i].setAttribute('style', 'border:4px solid red');
- }
- var emailperms=document.getElementsByTagName('input');
- if(emailperms.length)
- for(i=0;i<emailperms.length;i++)
- if(emailperms[i].getAttribute('name')=='GdpEmailBucket_grantEmailType')
- emailperms[i].parentNode.setAttribute('style', 'border:4px solid red');
- if(document.getElementsByClassName && document.getElementsByClassName('gdp_right_container').length && document.getElementsByClassName('gdp_right_container')[0].getElementsByClassName('mbm').length)
- document.getElementsByClassName('gdp_right_container')[0].getElementsByClassName('mbm')[0].setAttribute('style','border:4px solid red; color:black !important'); // ( can post as you )
- if(document.getElementsByClassName && document.getElementsByClassName('permissionsPublishActionsBadge').length)
- document.getElementsByClassName('permissionsPublishActionsBadge')[0].setAttribute('style','border:4px solid red');
- if(document.getElementsByClassName('tosPane').length) {
- var tossas=document.getElementsByClassName('tosPane')[0].getElementsByTagName('a');
- for(i=0;i<tossas.length;i++)
- if(tossas[i].getAttribute('href') && tossas[i].getAttribute('href').match(/about\/privacy\/your-info-on-other\#applications/)) {
- if(!tossas[i].parentNode.textContent.match(tossas[i].getAttribute('aria-label'))) {
- tossas[i].parentNode.appendChild(document.createTextNode(' - ' + tossas[i].getAttribute('aria-label') ));
- break;
- }
- }
- }
- tossas=appperms=emailperms=null;
-
- // test why the button doesnt show up sometimes...
- //console.log(location.href.match(/facebook\.com\/appcenter\//));
- //console.log(location.href.match(document.getElementsByClassName('mll').length));
-
- // add prominent block app button to app center app pages
- if((window.location.href.match(/facebook\.com\/appcenter\//) || document.getElementsByTagName('body')[0].getAttribute('class').match(/app_center/)) && document.getElementsByClassName('mll').length) // if theres buttons {
- if(document.getElementById('block_app_link') && !document.getElementById('block_app_link2')) {
- var aja=document.getElementById('block_app_link').getElementsByTagName('a')[0].getAttribute('ajaxify');
- var ajatext=document.getElementById('block_app_link').getElementsByTagName('a')[0].textContent;
- var ajalab=document.createElement('label');
- ajalab.setAttribute('class','uiButton uiButtonConfirm uiButtonLarge');
- ajalab.setAttribute('id','block_app_link2');
- ajalab.setAttribute('title','Block this application with FB Purity');
- ajalab.style.color='white';
- ajalab.textContent= ajatext + ' App';
- var ajalink=document.createElement('a');
- ajalink.setAttribute('ajaxify',aja.replace('block_app_link','block_app_link2'));
- ajalink.setAttribute('href','#');
- ajalink.setAttribute('rel','dialog-post');
- ajalink.setAttribute('role','button');
- ajalink.appendChild(ajalab);
- document.getElementsByClassName('mll')[0].setAttribute('class','mll');
- document.getElementsByClassName('mll')[0].appendChild(document.createTextNode(' '));
- document.getElementsByClassName('mll')[0].appendChild(ajalink);
- }
- if(window.location.href.match(/facebook\.com\/appcenter\/?/) || document.getElementsByTagName('body')[0].getAttribute('class').match(/app_center/)) {
- // add BA (and eventually WL) links to all app listings in app center (this part is a work in progress/not completed yet)
- if(document.getElementsByClassName('appsListHeader').length) {
- topspan=document.createElement('span');
- topspan.setAttribute('style','color:red;font-weight:bold;margin-left:10px')
- topspan.setAttribute('id','block_app_link');
- document.getElementsByClassName('appsListHeader')[0].appendChild(topspan);
-
- var appslist = document.getElementsByClassName('appsListItem');
-
- for(i=0;i<appslist.length;i++) {
- tspan=document.createElement('div');
- tspan.setAttribute('class','uiPopover appFeedbackMenu');
- tspan.setAttribute('style','top:18px');
- if(appslist[i].getAttribute('data-gt'))
- appid=appslist[i].getAttribute('data-gt').match(/appid":"(\d+)"/)[1]; //match(/appid\":\"(\d+)\"/)[1]
- else
- appid=appslist[i].querySelector('a[data-gt]').getAttribute('data-gt').match(/appid":"(\d+)"/)[1]; //match(/appid\":\"(\d+)\"/)[1]
- tspan.innerHTML='<a title="Block Application with FB Purity" 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>';
- appslist[i].getElementsByClassName('appName')[0].appendChild(tspan);
- }
-
- }
- }
-
-} // END highlightemailrequest function
-
-/*BEGIN Check if this page is an authorise app page so we can add a block button
-Example URLS https://www.facebook.com/connect/uiserver.php?app_id=216694208368074
-Scenarios: oauth page / request permissions page / app page
-*/
-if(window.location.href.match(/\/dialog\/oauth/) || window.location.href.match(/dialog\/permissions\.request/) || window.location.href.match(/\/connect\/uiserver\.php\?/) || window.location.href.match(/\/dialog\/plugin\.perms/))
- //if(!window.navigator.userAgent.match(/Opera\//))
- // addblockbuttontopermreq();
- //else
- window.setTimeout(addblockbuttontopermreq,10000); // pause a while because we are now running the script before the dom is fully loaded for all browsers...
-
-if(window.location.href.match(/\/appcenter\/?/))
- window.setTimeout(highlightemailrequest,10000);
-/* END Check if this page is an authorise app page so we can add a block button */
-
-/* BEGIN add a "block application" link at the bottom left hand corner of all application pages */
-function addblockapplinktoapppage() {
-if (window.location.href.match(/\:\/\/apps\./)) {
- if(document.getElementById('footerContainer')) {
- var footzer=document.getElementById('footerContainer');
- var footytxt='footerContainer';
- }
- else {
- var footzer=document.getElementById('pagelet_canvas_footer_content');
- var footytxt='pagelet_canvas_footer_content';
- }
- if(footzer) {
- var fas=footzer.getElementsByTagName('a');
- for(var i=0;i<fas.length;i++)
- if(fas[i].getAttribute('ajaxify') && fas[i].getAttribute('ajaxify').match(/\/ajax\/report\.php\?content_type=17/)) {
- zappid=fas[i].getAttribute('ajaxify').match(/cid=(\d*)/)[1];
- zapplink=document.createElement('a');
- zapplink.textContent='Block Application ';
- zapptitle=document.getElementById(footytxt).getElementsByTagName('span')[0].textContent;
- zapplink.setAttribute('appname',zapptitle);
- zapplink.setAttribute('appid',zappid);
- zapplink.setAttribute('nodeid','pagelet_canvas_content');
- zapplink.setAttribute('id','zapplink');
- zapplink.setAttribute('title','Block this application with F.B. Purity');
- zparent=document.getElementById(footytxt).getElementsByClassName('fsm')[0];
- zparent.insertBefore(zapplink,zparent.firstChild);
- document.getElementById('zapplink').addEventListener('click',blockappev,false);
- break;
- }
- }
-}
-}
-window.setTimeout(addblockapplinktoapppage,13000); // needed to make the delay longer, because we are starting the script before the dom has loaded
-/* END Add a block application link at bottom left of all application pages */
-
-function toggletimeline(ev) {
- var TLBUTT=document.getElementById('TLJewel');
- if (typeof(fbpoptsobj.timelineonecol)=='undefined')
- fbpoptsobj.timelineonecol=true;
- else
- if(fbpoptsobj.timelineonecol==true)
- fbpoptsobj.timelineonecol=false;
- else
- fbpoptsobj.timelineonecol=true;
- if(fbpoptsobj.timelineonecol==false) {
- document.getElementById('FBTLX').style.display='none';
- var tdotxt='F.B. Purity - Normal Facebook Timeline Layout Restored';
- TLBUTT.setAttribute('title','');
- }
- else {
- document.getElementById('FBTLX').style.display='block';
- var tdotxt='F.B. Purity - Single Column Timeline<br/>Layout Enabled';
- TLBUTT.setAttribute('title','');
- }
- if(!document.getElementById('tdotxt')) {
- tdo=document.createElement('div');
- tdo.setAttribute('id','tdotxt');
- tdo.setAttribute('style','position:absolute;top:25px;left:29px;font-size:15px;width:235px;background-color:white;border:2px solid;z-index:30'); //rgba(255,255,255,0.5)
- document.getElementById('TLJewel').appendChild(tdo);
- }
- else
- tdo=document.getElementById('tdotxt');
-
- document.getElementById('tdotxt').style.display='block';
- tdo.innerHTML='<a title="FB Purity Website" alt="FB Purity Website" href="http://fbpurity.com"><img style="border:0px;float:left;margin-right:10px" src="https://sites.google.com/site/st333v/fbp-1/fbp-ghost-lid-icon-48x48.jpg"></a> ' + tdotxt;
- window.setTimeout(function(){document.getElementById('tdotxt').style.display='none';TLBUTT.setAttribute('title','F.B. Purity: Single Column Timeline Layout');},1700)
-
- //save to prefs obj to localstorage
- fbpsavevalue('fbpoptsjson-' + currentuserid, JSON.stringify(fbpoptsobj));
- //window.location.reload();
- fbptimelinerestyle(fbpoptsobj.timelineonecol);
-} // END toggletimeline function
-
-function tlbuttinit() {
- // BEGIN add TL (single column timeline) button next to search box (now works on graph search bar too)
- if(fbpoptsobj.timelineonecol==true)
- var disx='block';
- else
- var disx='none';
- var TLBUTTHTML='<a id="TLINK" href="javascript:;" class="jewelButton" style="top:3px;max-height:25px;">'+
- '<div id="FBTL" style="position:absolute;top:0px;left:0px;background:transparent;font-size:22px !important;font-weight:bold;color:green">TL</div>'+
- '<div id="FBTLX" style="' + 'display:' + disx + '; position:absolute;top:0px;left:6px;background:transparent;font-size:22px !important;color:#E80000;font-weight:bold">X</div></a>';
- TLBUTT=document.createElement('div');
- TLBUTT.setAttribute('class','lfloat fbJewel');
- TLBUTT.setAttribute('id','TLJewel');
- TLBUTT.setAttribute('title','F.B. Purity: Single Column Timeline Layout');
- /*
- window.setTimeout(function() {
- console.log('delayed??');
- if(document.querySelector('body.hasSmurfbar'))
- //TLBUTT.setAttribute('style','top:0px;margin-left:3px;vertical-align:middle;font-size:20px;font-color:#173a85;font-weight:bold; left: 614px; top: -20px !important; '); //
- 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; '); //
- else
- //TLBUTT.setAttribute('style','top:0px;margin-left:3px;vertical-align:middle;font-size:20px;font-color:#173a85;font-weight:bold');
- document.getElementById('TLJewel').setAttribute('style','top:0px;margin-left:3px;vertical-align:middle;font-size:20px;font-color:#173a85;font-weight:bold');
- },3500);
- */
-
- TLBUTT.innerHTML=TLBUTTHTML;
- window.setTimeout( function(){
- var datd=document.getElementById('navSearch');
- if(!datd) {
- datd=document.querySelector('div[role="search"]');
- 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'); //
- if(debug) console.log('no navsearch, so must be graph search?' + TLBUTT);
- }
- else {
- TLBUTT.setAttribute('style','top:0px;margin-left:3px;vertical-align:middle;font-size:20px;font-color:#173a85;font-weight:bold;'); // left :0px !important'
- if(debug) console.log('oldschool navsearch' + TLBUTT);
- }
- if(datd && (!document.getElementById('TLJewel'))) {
- datd.parentNode.insertBefore(TLBUTT,datd.nextSibling);
- document.getElementById('TLINK').addEventListener('click',toggletimeline,false);
- }
- //single column timeline
- if(fbpoptsobj.timelineonecol==1)
- fbptimelinerestyle(1);
- else
- fbptimelinerestyle(0);
- },3000);
- // END add TL button next to search box
-}
-
-function resetclasses () {
- var fbpn,a;
- var arrResetClasses=['fbpnormal','fbpblockedx','fbpblocked'];
- for(a in arrResetClasses) {
- //console.log(arrResetClasses[a]);
- fbpn=document.getElementsByClassName(arrResetClasses[a]);
- for(i=fbpn.length;i>0;i--) {
- //console.log(i);
- fbpn[i-1].setAttribute('class',fbpn[i-1].getAttribute('class').replace(arrResetClasses[a],''));
- }
- //console.log("fbpoptsobj.filterappmessages=" + fbpoptsobj.filterappmessages + " current arr length=" + document.getElementsByClassName(arrResetClasses[a]).length);
- }
-}
-
-
-////// BEGIN HIDE STICKER PACK FUNCTIONALITY
-
-// Hide sticker packs functionality
-// /* hide Heromals pack*/
-// a[data-id="633721996647110"] {display:none !important}
-
-function fbpInsertedStickerStoreHandler(records) { //event // mutationObserverRef
-//try{
- var q,p,tempnode;
- if(records.length) {
- for(q=0;q<records.length;q++) {
- //if(records[q].addedNodes.length)
- for(p=0;p<records[q].addedNodes.length;p++) {
- tempnode=records[q].addedNodes[p];
- if(tempnode.nodeName=='DIV') //console.log(tempnode);
- if(tempnode.getAttribute && tempnode.getAttribute("class")=="_10 uiLayer _4-hy _3qw") {
- if(document.getElementById('pagelet_sticker_store_dialog')) {
- if(debug)
- console.log('found sticker store!!');
- managestickerpacks();
- }
- }
- }
- }
- }
-//} catch(e) {
-// console.log("something wrong in inserted stickerstorehandler: " + e);
-//}
-}
-
-function hidestickerpacks() {
- if(debug) {
- console.log("\nhidestickerpacks function");
- console.log("typeof fbpoptsobj:" + typeof(fbpoptsobj));
- console.log("typeof fbpoptsobj.stickerpacks:" + typeof(fbpoptsobj.stickerpacks));
- console.log("stickerpack ids in fbpoptsobj:\"" + fbpoptsobj.stickerpacks +"\"");
- }
- if((typeof(fbpoptsobj)=='undefined') || typeof(fbpoptsobj.stickerpacks)=='undefined') {
- if(debug)
- console.log("fbpoptsobj is not yet defined");
- fbpoptsobj.stickerpacks='';
- //return;
- }
- var spar=fbpoptsobj.stickerpacks.split(',');
- var stickerpackstyles='';
- if(spar.length && (spar[0]!=''))
- for(var i=0;i<spar.length;i++)
- stickerpackstyles+= 'a[data-id="' + spar[i] + '"] {display:none} ';
- else
- ; //console.log('array was empty');
- if(debug)
- console.log(stickerpackstyles);
- stickerpackstyle=document.getElementById('stickerpackstyle');
- stickerpackstyle.textContent=stickerpackstyles;
-}
-
-function hidestickerpackclick(e) {
- //console.log('clicked it');
- var spid=e.target.getAttribute('id');
- if(debug) {
- console.log("\nhidestickerpackclick function");
- }
-
- if(e.target.checked) {
- if(!fbpoptsobj.stickerpacks.match("'" + spid +"'")) {
- if(fbpoptsobj.stickerpacks.length)
- fbpoptsobj.stickerpacks+=',' + spid;
- else
- fbpoptsobj.stickerpacks+= spid;
- }
- }
- else {
- fbpoptsobj.stickerpacks=fbpoptsobj.stickerpacks.replace(spid,'');
- fbpoptsobj.stickerpacks=fbpoptsobj.stickerpacks.replace(/,,/,',');
- fbpoptsobj.stickerpacks=fbpoptsobj.stickerpacks.replace(/(^,|,$)/,'');
- }
- //console.log(fbpoptsobj.stickerpacks);
-
- //save prefs obj to localstorage
- fbpsavevalue('fbpoptsjson-' + currentuserid, JSON.stringify(fbpoptsobj));
-
- hidestickerpacks();
-}
-
-// BEGIN init stickerpack variables
-var stickerpackstyle;
-var stickyobject={};
-
-function managestickerpacks() {
-
- // BEGIN cache current stickerpacks
- if(typeof(stickyobject.ready)=='undefined') {
- var stickerpackbar=document.getElementsByClassName('_590r');
- if(!stickerpackbar.length) {
- console.log('couldnt find stickerpack bar, maybe the class name has changed');
- return;
- }
-
- var stickypacks=stickerpackbar[0].getElementsByClassName('_55bn')
- if(!stickypacks.length) {
- console.log('couldnt find individual sticker packs in stickerpack bar, maybe the class name has changed')
- return;
- }
-
- for(var i=0;i<stickypacks.length-1;i++) {
- if(debug)
- console.log(stickypacks[i].getAttribute('aria-label') + ':' + stickypacks[i].getAttribute('data-id'))
- stickyobject[stickypacks[i].getAttribute('aria-label')]=stickypacks[i].getAttribute('data-id');
- }
- }
- stickyobject.ready=1;
- // END cache current stickerpacks
-
- var spboxes=document.getElementsByClassName('_5b2l');
- if(!spboxes.length) {
- console.log('didnt find the stickerpack boxes in the stickerstore')
- return;
- }
- if(!spboxes[0].getElementsByClassName('_5b2r').length) {
- console.log('we didnt find the stickerpack names in the stickerpack store, maybe the class name has changed.')
- return;
- }
-
- var spcheckboxspan=document.createElement('span');
- spcheckboxspan.setAttribute('title','Hide sticker pack with with FB Purity.');
- var sptextnode=document.createTextNode(' Hide');
- spcheckboxspan.appendChild(sptextnode);
- var spcheckbox=document.createElement('input');
- spcheckbox.setAttribute('type','checkbox');
- spcheckbox.setAttribute('style','vertical-align:middle');
- spcheckboxspan.appendChild(spcheckbox);
-
- for(var i=0;i<spboxes.length;i++) {
- if(typeof (stickyobject[ spboxes[i].getElementsByClassName('_5b2r')[0].textContent ])!='undefined') {
- spboxes[i].getElementsByClassName('mts rfloat')[0].appendChild(spcheckboxspan.cloneNode(1));
- spboxes[i].getElementsByTagName('input')[0].setAttribute('id',stickyobject[spboxes[i].getElementsByClassName('_5b2r')[0].textContent]);
- spboxes[i].getElementsByTagName('input')[0].addEventListener('click',hidestickerpackclick,false);
- if(fbpoptsobj && fbpoptsobj.stickerpacks && fbpoptsobj.stickerpacks.length)
- if(fbpoptsobj.stickerpacks.match(stickyobject[spboxes[i].getElementsByClassName('_5b2r')[0].textContent]))
- spboxes[i].getElementsByTagName('input')[0].checked=true;
- }
- }
-} // end managestickerpacks function
-
-////// END HIDE STICKER PACK FUNCTIONALITY
-
-function fbpurify() {
- if(debug)
- console.trace();
-
- var crappyappmsgcounter=0;
- var xtramsgcounter=0;
- fbpstyle.setAttribute('id','fbpstyler');
- fbpstyle.setAttribute('type','text/css');
- fbpStyleApps= ".fbpblocked {border-style: dashed !important; border-width:1px !important; border-top: 0px !important; border-color: pink !important; display:block !important} .fbpblockedx {display:none !important} .fbpnormal {display:none !important}";
- if(document.querySelector('body.hasSmurfbar'))
- fbpStyleExtras= ".fbpblocked {display:none !important} .fbpblockedx {border-style: dashed !important; border-width:1px !important; border-top: 0px !important; border-color: blue !important; display:block !important} .fbpnormal {display:none !important}";
- else
- fbpStyleExtras= ".fbpblocked {display:none !important} .fbpblockedx {border-style: dashed !important; border-width:1px !important; border-top: 0px !important; border-color: lightblue !important; display:block !important} .fbpnormal {display:none !important}";
- fbpStyleNormal= ".fbpblocked {display:none !important} .fbpblockedx {display:none !important} .fbpnormal {display:block !important}";
- fbpstyle.textContent=fbpStyleNormal;
-
- document.addEventListener("DOMNodeInserted", fpInsertedNodeDomHandler, false);
-
- if(document.getElementById('pagelet_home_stream') || document.getElementById('pagelet_litestand_section') || document.getElementById('stream_pagelet'))
- cleartheshizzle(document);
-
-} // END fbpurify function
-
-// only run if DOM has loaded
-finalstage=function () {
-// we should check to see if fbpurify is already running...
-
- if(document.getElementsByTagName('head').length) {
- if(!document.getElementById('stickerpackstyle')) {
- stickerpackstyle=document.createElement('style');
- stickerpackstyle.setAttribute('id','stickerpackstyle');
- }
- document.getElementsByTagName('head')[0].appendChild(fbpstyle);
- document.getElementsByTagName('head')[0].appendChild(fbpfreestyle);
- document.getElementsByTagName('head')[0].appendChild(fbpboxstyle);
- document.getElementsByTagName('head')[0].appendChild(fbpcssstyle);
- document.getElementsByTagName('head')[0].appendChild(fbptlstyle);
- document.getElementsByTagName('head')[0].appendChild(stickerpackstyle);
-
- //window.setTimeout(bringbacknormalcommenting,2000); // prefs werent being read in before running this, so i added a short delay
- bringbacknormalcommenting();
- //window.setTimeout(addexternallinkfix,2000);
- addexternallinkfix();
- tlbuttinit(); // initialise the timeline single column button
- window.setTimeout(fixsortorder,6000);
- hidestickerpacks();
- }
- else {
- var waitforhead=setInterval(function(){
- if(document.getElementsByTagName('head').length ) {
- if(!document.getElementById('stickerpackstyle')) {
- stickerpackstyle=document.createElement('style');
- stickerpackstyle.setAttribute('id','stickerpackstyle');
- }
- document.getElementsByTagName('head')[0].appendChild(fbpstyle);
- document.getElementsByTagName('head')[0].appendChild(fbpfreestyle);
- document.getElementsByTagName('head')[0].appendChild(fbpboxstyle);
- document.getElementsByTagName('head')[0].appendChild(fbpcssstyle);
- document.getElementsByTagName('head')[0].appendChild(fbptlstyle);
- document.getElementsByTagName('head')[0].appendChild(stickerpackstyle);
-
- //window.setTimeout(bringbacknormalcommenting,2000); // prefs werent being read in before running this, so i added a short delay
- bringbacknormalcommenting();
- //window.setTimeout(addexternallinkfix,2000);
- addexternallinkfix();
- tlbuttinit(); // initialise the timeline single column button
- hidestickerpacks();
- window.setTimeout(fixsortorder,6000);
- clearInterval(waitforhead);
- }
- }, 500);
-
- }
-
- var waitforbody=setInterval(function(){
- if(document.getElementsByTagName('body').length) {
- //new (this.MutationObserver || this.MozMutationObserver || this.WebKitMutationObserver)(fbpInsertedStickerStoreHandler).observe(document.getElementsByTagName('body')[0], { childList: true, subtree: true }); //document.body
- try{
- new (MutationObserver || MozMutationObserver || WebKitMutationObserver)(fbpInsertedStickerStoreHandler).observe(document.body, { childList: true, subtree: true }); //document.body
- }
- catch(e) {
- console.log('Mutation Observer not supported');
- }
- clearInterval(waitforbody);
- }
- }, 500);
-
- if(document.getElementById('pagelet_home_stream') || document.getElementById('pagelet_litestand_section') || document.getElementById('stream_pagelet')) { // || document.getElementById('pagelet_group_mall') || document.getElementById('timelineNavContent') // || document.getElementById('profile_minifeed')
- fbpurify();
- window.setTimeout(fixsortorder,3000);
- }
- else {
- var waitfordom=setInterval(function(){
- if(document.getElementById('pagelet_home_stream') || document.getElementById('pagelet_litestand_section') || document.getElementById('stream_pagelet')) { // || document.getElementById('pagelet_group_mall') || document.getElementById('timelineNavContent') // || document.getElementById('profile_minifeed')
- clearInterval(waitfordom);
- fbpurify();
- window.setTimeout(fixsortorder,3000);
- }
- }, 500);
- }
-} // end finalstage function;
-
-fbpgetprefs();
-
-})();
\ No newline at end of file