From: Samir Benmendil Date: Sun, 2 Mar 2014 16:40:36 +0000 (+0000) Subject: dwb/greasemonkey: remove obsolete scripts X-Git-Url: https://git.rmz.io/dotfiles.git/commitdiff_plain/abe8219b52749ecc973d320dfe1ebf6b816efdeb dwb/greasemonkey: remove obsolete scripts --- diff --git a/dwb/greasemonkey/98706.user.js b/dwb/greasemonkey/98706.user.js deleted file mode 100644 index a48a2a3..0000000 --- a/dwb/greasemonkey/98706.user.js +++ /dev/null @@ -1,871 +0,0 @@ -// ==UserScript== -// @name (dm) Deviant Art Gallery Ripper -// @namespace DeviantRipper -// @description Click button and generate a list of direct image link urls for all images for a users gallery. -// @version 1.0.15 -// @lastupdated 2013-08-29 -// @include http://*.deviantart.com/favourites/* -// @match http://*.deviantart.com/favourites/* -// @include http://*.deviantart.com/gallery/* -// @match http://*.deviantart.com/gallery/* -// @!nclude http://*.deviantart.com/art/* -// @!atch http://*.deviantart.com/art/* -// @include http://browse.deviantart.com/* -// @match http://browse.deviantart.com/* -// @include http://backend.deviantart.com/rss.xml* -// @match http://backend.deviantart.com/rss.xml* -// ==/UserScript== - -/* - Known issue: ? - - Documentation needed. - - */ - -var GM_log; -if (typeof GM_log === 'undefined') { - GM_log = function (str) { console.log(str); }; -} - -var debug = false; -//var debug = true; - -/* - * xHttp object - * variables: - * maxreq - maximum number of async requests to do - * runcon - number of running connections - * interval - interval holder - * links - array() object used to help with triggering - * new connections for asyncLoad - * functions: - * - * startInterval - starts the interval loop - * accepts args: (heartbeat_function, interval) - * heartbeat_function = function called on each trigger pulse - * interval = integer of ms between interval triggers - * - * stopInterval() - stops the interval loop - * no args - * - * load - synchronous xmlHttpRequest - * only handles simple "GET" - * accepts args: (string url) - * - * asyncLoad - asynchronous xmlHttpRequest - * accepts args: (string url or associative array of options, - * function callback, optional args) - * url = url string to load - * if object can have params like GM_xmlHttpRequest ex: - * {url:String, method:String, headers:{associative array}, - * data:String, onload:Function, onerror:Function, - * onreadystatechange:Function} - * onload, onerror, onreadystatechange are called with - * function(xmlHttpRequest event object, objparams, - * callback, extra_args); - * - * See below in asyncLoad definition comment for more - * information. - * - * function = callback function called as - * callback(xhtr, string url, optional args) - * do not specify a callback if using an onload above - * - * optional args = single variable passed verbatim to - * the callback function - * - * default_heartbeat - * default heartbeat function - * - * default_next_url - * default routine to handle next url fetch - * - * default_callback_xhtr - * a default callback to use when retrieving a request - */ -function XHttp() { - var xHttpInstance = this; - this.maxreq = 4; - this.runcon = 0; - this.interval = null; - this.links = []; - - this.default_heartbeat = function () { - if ((xHttpInstance.runcon < xHttpInstance.maxreq) && - (xHttpInstance.links.length > 0)) { - // do something here when you have an opening to get more stuff - xHttpInstance.default_next_url(); - } - if ((xHttpInstance.links.length === 0) && - (xHttpInstance.runcon === 0)) { - // do something here when out of things to - xHttpInstance.stopInterval(); - } - }; - this.default_next_url = function () { - if (xHttpInstance.links.length > 0) { - var link_data = xHttpInstance.links.shift().toString(); - xHttpInstance.asyncLoad(link_data, - xHttpInstance.default_callback_xhtr); - } - }; - this.default_callback_xhtr = function (xhtr, strURL, args) { - // do something with the result - // xhtr is the xmlHttpRequest object - // common values are: - // xhtr.responseText - // xhtr.responseXml - // xhtr.readyState - // xhtr.status - - if (xhtr.status === 404) { - // do something when 404 not found - // like: - alert("Page wasn't found at: " + strURL + "\n" + - xhtr.status + " " + xhtr.statusText); - } else if (xhtr.status === 200) { - // do something when 200 ok - // like: - alert(xhtr.responseText); - } else { - // do other stuff with other codes - alert("Site returned: " + xhtr.status + " '" + - xhtr.statusText + "' for: \n" + strURL); - } - }; - /* - * startInterval (heartbeat_function, heartbeat_pulse) - * accepts: - * heartbeat_function: function reference to call on each heartbeat - * pulse - * heartbeat_pulse: integer - * - */ - this.startInterval = function (heartbeat_function, heartbeat_pulse) { - var pulse_rate; - var heartbeat_func; - // check for and stop existing interval - if (xHttpInstance.interval !== null) { xHttpInstance.stopInterval(); } - - if (typeof heartbeat_pulse === 'undefined') { - pulse_rate = 100; - } else { - pulse_rate = heartbeat_pulse; - if (isNaN(pulse_rate)) { // validate its an actual number - throw "startInterval given invalid pulse rate :" + - heartbeat_pulse; - } - } - if (typeof heartbeat_function === 'undefined') { - heartbeat_func = xHttpInstance.default_heartbeat; - } else { - heartbeat_func = heartbeat_function; - } - - if (!heartbeat_func instanceof Function) { - throw "startInterval given incorrect heartbeat function argument."; - } - /* end error checking */ - xHttpInstance.interval = setInterval(heartbeat_func, pulse_rate); - }; - - /* - * stopInterval () - * - * stops the xHttp interval loop. - */ - this.stopInterval = function () { - clearInterval(xHttpInstance.interval); - xHttpInstance.interval = null; - }; - - /* - * load (strURL) - * - * synchronus XMLHttpRequest load with simple parameter request. - * Returns text value of get request or false. - */ - this.load = function (strURL) { - //if (debug) { GM_log("Getting url: " + strURL); } - var xhtr = new XMLHttpRequest(); - xhtr.open("GET", strURL, false); - xhtr.send(); - if (xhtr.readyState === 4 && xhtr.status === 200) { - return xhtr.responseText; - } else { - return false; - } - }; - /* - * asyncLoad(objparams, callback, extra_args) - * - * multithreaded url fetching routine - * gets url contents and sends to callback function - * - * if objparams is passed as a string function assumes - * simple get request with objparams being a url string. - * - * otherwise: - * objparams object properties imitates grease monkey - * GM_xmlHttpRequest function. - * - * method - a string, the HTTP method to use on this request. - * Generally GET, but can be any HTTP verb, including POST, - * PUT, and DELETE. - * - * url - a string, the URL to use on this request. Required. - * - * headers - an associative array of HTTP headers to include on - * this request. Optional, defaults to an empty array. Example: - * headers: {'User-Agent': 'Mozilla/4.0 (compatible) Greasemonkey', - * 'Accept': 'application/atom+xml,application/xml,text/xml'} - * - * data - a string, the body of the HTTP request. Optional, defaults - * to an empty string. If you are simulating posting a form - * (method == 'POST'), you must include a Content-type of - * 'application/x-www-form-urlencoded' in the headers field, - * and include the URL-encoded form data in the data field. - * - * onreadystatechange - a function object, the callback function to be - * called repeatedly while the request is in progress. - * - * onerror - a function object, the callback function to be called - * if an error occurs while processing the request. - * - * onload - a function object, the callback function to be called when - * the request has finished successfully. - * ** DO NOT ** specify a callback function if using onload. - * onload will take precedence and fire instead of callback. - * onload will pass the callback value to its called function - * if you want to use the values in some way. See definition - * below for the default_onload. - */ - - this.asyncLoad = function (objparams, callback, extra_args) { - //if (debug) GM_log("Async Getting url : " + url); - - // local function Variables - var url = ""; - var method; - var default_method = "GET"; - var send_data = ""; - var http_req = new XMLHttpRequest(); - var xHttpPtr = xHttpInstance; - var headkey; - var useGMxml = false; - - var onerror_wrapper = null; - var onload_wrapper = null; - var onreadystatechange_wrapper = null; - // end local function variables - - var default_onerror = function (args) { - /* - * do something here when there's errors. - */ - var target; - if (args.target) { - target = args.target; - } else { - target = args; - } - xHttpInstance.runcon -= 1; - if (onerror_wrapper !== null) { - onerror_wrapper(target, objparams, callback, extra_args); - } - }; - - var default_onreadystatechange = function (args) { - var target; - if (args.target) { - target = args.target; - } else { - target = args; - } - if (onreadystatechange_wrapper !== null) { - onreadystatechange_wrapper(target, objparams, - callback, extra_args); - } - }; - - var default_onload = function (args) { -// if (debug) { -// GM_log("xmlHttpRequest response: " + -// args.readyState + " " + args.status + " " + -// url); -// } - var target; - if (args.target) { - target = args.target; - } else { - target = args; - } - xHttpPtr.runcon -= 1; - if (onload_wrapper !== null) { - onload_wrapper(target, objparams, callback, extra_args); - } else { - callback(target, url, extra_args); - } - }; - - if (typeof objparams !== 'object') { - if (typeof objparams === 'string') { - url = objparams; - method = default_method; - http_req.open(method, url, true); - } else { - throw "asyncLoad error: parameters not object or string"; - } - } else { - - // check url parameter value - if (typeof objparams['url'] !== 'string') { - throw "asyncLoad error: missing url parameter."; - } else { - // make sure its not blank - url = objparams['url']; - if (url === '') { - throw "asyncLoad error: url parameter is empty string."; - } - } - - // check if we specified method - if (typeof objparams['method'] === 'string') { - method = objparams['method']; - } else { - method = default_method; - } - - // open xmlHttpRequest so we can properly set headers - http_req.open(method, url, true); - - // check if we specified any custom headers and have some sort - // of validation of the data. Just ignores non strings. - if (typeof objparams['headers'] === 'object') { - for (headkey in objparams['headers']) { - if (objparams['headers'].hasOwnProperty(headkey)) { - if (typeof headkey === 'string') { - if (typeof objparams['headers'][headkey] - === 'string') { - http_req.setRequestHeader(headkey, - objparams['headers'][headkey]); - } - } - } - } - } - - if (typeof objparams['data'] === 'string') { - send_data = objparams['data']; - } - - if (typeof objparams['onreadystatechange'] === 'function') { - onreadystatechange_wrapper = objparams['onreadystatechange']; - } - - if (typeof objparams['onerror'] === 'function') { - onerror_wrapper = objparams['onerror']; - } - - if (typeof objparams['onload'] === 'function') { - onload_wrapper = objparams['onload']; - } - - if (objparams['useGMxml']) { - useGMxml = true; - } - - } - - if (typeof callback !== 'function' && - typeof onload_wrapper !== 'function') { - throw "asyncLoad error: no callback or onload function passed."; - } - - xHttpPtr.runcon += 1; - - if (useGMxml) { - GM_xmlhttpRequest({ - method: method, - url: url, - headers: objparams['headers'], - onload: default_onload, - onerror: default_onerror, - onreadystatechange: default_onreadystatechange - }); - - } else { - http_req.onerror = default_onerror; - http_req.onreadystatechange = default_onreadystatechange; - http_req.onload = default_onload; - - http_req.send(send_data); - } - }; -} - -var deviantRipper = { - isChrome : /chrome/i.test(navigator.userAgent), - isFireFox : /firefox/i.test(navigator.userAgent), - abort_links : false, - useGMxml : false, // flag to use GM_xmlHttpRequest instead of XMLHttpRequst - xml_link_data : [], // array holder for xlm page links - pages : { - //recurse var used for thumbnail pages mainly. if set to 0 and button - //clicked on single page it doesn't really do anything useful. - recurse: true, // recuse into lower gallery pages - current: 0, // current counter reused for image and gallery parsing - total: 0, // total counter used for image parsing - urls: [], // holder for url html list - toparse: [], // list of urls of single image pages that need to be parsed for DDL - textbox: null, // textbox holder - fetchStatus: 0 // status id for script checking status: - // 0 = not started, 1 = getting indexes - // 2 = getting image DDL, 3 = finished everything - // 4 = displayed urls (finished or aborted) - }, - - /* - * display_url_list() - * - * function called when we're all done and we want to - * display the list of url's we got. - */ - display_url_list : function () { - var docNamespace = 'http://www.w3.org/1999/xhtml'; - var counter; - var tmpStr; - if (debug) { GM_log("Call: display_url_list()"); } - if (debug) { GM_log(deviantRipper); } - if (deviantRipper.pages.fetchStatus > 3) { return; } - deviantRipper.pages.textbox = - document.createElementNS(docNamespace, "textarea"); - deviantRipper.pages.textbox.style.width = '100%'; - for (counter = 0; counter < deviantRipper.pages.urls.length; counter += 1) { - if (debug) { GM_log("Fixing " + deviantRipper.pages.urls[counter]); } - if (deviantRipper.pages.urls[counter].indexOf('http://th') > -1) { - tmpStr = deviantRipper.pages.urls[counter].replace('http://th', 'http://fc').replace('/PRE/', '/'); - deviantRipper.pages.urls[counter] = tmpStr; - } - } - deviantRipper.pages.textbox.innerHTML = - deviantRipper.pages.urls.join('\r\n'); - document.body.insertBefore(deviantRipper.pages.textbox, - document.body.firstChild); - deviantRipper.pages.fetchStatus = 4; - }, - - /* - * init() - * - * Called as first function execution upon script load. - * Sets up the xmlHttpRequest helpers and generates click button. - */ - init : function () { - // Check whether we're on backend - deviantRipper.xml_xHttp = new XHttp(); - - if (debug) { GM_log("init() isChrome: " + deviantRipper.isChrome + " isFireFox: " + deviantRipper.isFireFox); } - if (deviantRipper.isFireFox === true) { - deviantRipper.useGMxml = true; - } - - if (/backend/i.test(location.hostname) === true) { - if (/rss\.xml/i.test(location.href) === true) { - // test if we're in iframe if not then get out - if (window === parent) { return; } - - deviantRipper.pages.btnID = deviantRipper.btn.generateXMLButton(); - deviantRipper.btn.startXML(document.location.href); - } - } else { - deviantRipper.pages.btnID = deviantRipper.btn.generateButton(); - } - }, - - checker: { - /* - * isThumbnailGallery (doc) - * - * return true if page seems to be a gallery index - * or false if it looks like its a single image page - * detection is looking for the comments by the artist - * usually found on the single image page - */ - isThumbnailGallery : function (doc) { - if (debug) { GM_log("Call: isThumbnailGallery()"); } - return (doc.getElementById("artist-comments")) ? false : true; - }, - - /* - * isAborted () - * - * check if we clicked the button to abort script - * if we did it requires a page reload to start again - * - */ - isAborted : function () { - if (debug) { GM_log("isAborted(): " + deviantRipper.abort_links); } - if (deviantRipper.abort_links === true) { - deviantRipper.pages.btnID.value = 'Aborted: ' + deviantRipper.pages.btnID.value; - if (debug) { GM_log("FetchStatus: " + deviantRipper.pages.fetchStatus); } - if (deviantRipper.pages.fetchStatus > 1) { deviantRipper.display_url_list(); } - deviantRipper.xml_link_data = []; - deviantRipper.pages.toparse = []; - return true; - } else { - return false; - } - }, - - /* - * next_xml () - * - * get our next gallery page from our stack, - * increment our fetching counter, and fetch page - */ - next_xml : function () { - var link_uri; - - if (debug) { GM_log("Call: next_xml()"); } - if (deviantRipper.checker.isAborted()) { - return false; - } - if (deviantRipper.xml_link_data.length > 0) { - link_uri = deviantRipper.xml_link_data.shift().toString(); - if (debug) { GM_log("Shifted: " + link_uri + "\ntypeof: " + typeof link_uri); } - - if (deviantRipper.useGMxml) { - if (debug) { - GM_log("Using GreaseMonkey GM_xmlHttpRequest."); - } - deviantRipper.xml_xHttp.asyncLoad({ - url: link_uri, - useGMxml: true, - onload: deviantRipper.callback.scan_xml_dom - }); - } else { - deviantRipper.xml_xHttp.asyncLoad(link_uri, deviantRipper.callback.scan_xml_dom); - } - - } - } - }, // end checker - - parser: { - /* - * image_links_xml (docbase) - * - * function called after we load a gallery index page, - * "docbase" references the document of the index page - * so we can start looking for thumbnails in order to - * get the single image page links. - */ - image_links_xml : function (docbase) { - if (debug) { GM_log("Call: image_links_xml()"); } - var items; - var hifi = null; - var lofi = null; - var thumbnail; - var thumbnails; - var content; - var counter; - var locounter; - - items = docbase.getElementsByTagNameNS('*', 'item'); - if (items.length < 1) { - deviantRipper.pages.recurse = false; - return; - } - - for (counter = 0; counter < items.length; counter += 1) { - content = items[counter].getElementsByTagNameNS('*', 'content'); - thumbnails = items[counter].getElementsByTagNameNS('*', 'thumbnail'); - thumbnail = null; - - if (thumbnails.length > 0) { - // grab last thumbnail item and use it incase we don't find any content lines - thumbnail = thumbnails[thumbnails.length - 1].getAttribute('url'); - } - - for (locounter = 0; locounter < content.length; locounter += 1) { - if (content[locounter].getAttribute('medium') === 'image') { lofi = content[locounter].getAttribute('url'); } - if (content[locounter].getAttribute('medium') === 'document') { hifi = content[locounter].getAttribute('url'); } - } - if (hifi !== null) { - if (debug) { GM_log("Hifi: " + hifi); } - deviantRipper.pages.urls.push(hifi); - } else if (lofi !== null) { - if (debug) { GM_log("Lofi: " + lofi); } - deviantRipper.pages.urls.push(lofi); - } else { - if (debug) { GM_log("thumbnail: " + thumbnail); } - deviantRipper.pages.urls.push(thumbnail); - } - } - if (debug) { GM_log([counter, length, deviantRipper.pages.urls.length]); } - }, - - - /* - * next_xml_page_link (docbase) - * - * Function called after loading xml page looking for next - */ - next_xml_page_link : function (docbase) { - if (debug) { GM_log("Call: next_xml_page_link()"); } - if (debug) { GM_log(docbase); } - var rtn_val; -// var links; -// var counter, length; -// links = docbase.getElementsByTagNameNS('http://www.w3.org/2005/Atom', 'link'); -// for (counter = 0, length = links.length; -// counter < length; -// counter += 1) { -// if (links[counter].getAttribute('rel').toString() === "next") { -// rtn_val = links[counter]; -// break; -// } -// } - rtn_val = docbase.querySelector('link[rel="next"]'); - if (rtn_val) { - rtn_val = rtn_val.getAttribute('href'); - if (debug) { GM_log("NextXML page: " + rtn_val); } - return rtn_val; - } else { - return false; - } - } - - - }, // end parser - - callback: { - - /* - * scan_xml_dom (HTML_Data, url, args) - * - * called when gallery page html is loaded - * so we can parse images out and set next page - */ - scan_xml_dom : function (HTML_Data, url, args) { - if (debug) { GM_log("Call: scan_xml_dom()"); } - var html_dom; - var nextPage; - var parser; - - html_dom = HTML_Data.responseXML; - if (!html_dom) { - if (HTML_Data.responseText !== "") { - parser = new DOMParser(); - html_dom = parser.parseFromString(HTML_Data.responseText, "text/xml"); - } else { - throw "There was an error parsing XML from: " + url; - } - } - - // parse and add images on page to fetch stack - deviantRipper.parser.image_links_xml(html_dom); - - deviantRipper.pages.current += 1; - deviantRipper.pages.btnID.value = "Loading xml page " + - deviantRipper.pages.current + - "(" + deviantRipper.pages.urls.length + ")"; - - if (deviantRipper.pages.recurse) { - nextPage = deviantRipper.parser.next_xml_page_link(html_dom); - if (nextPage) { deviantRipper.xml_link_data.push(nextPage.toString()); } - } - - } - - }, // end callback - - btn: { - /* - * getLinks () - * - * onclick function triggered when the - * button we injected is clicked to get - * our direct links. - */ - getLinks : function () { - if (debug) { GM_log("Call: getLinks()"); } - var iframeLoader; - var feedbutton; - var docNamespace = 'http://www.w3.org/1999/xhtml'; - - deviantRipper.pages.btnID.removeEventListener("click", deviantRipper.btn.getLinks, false); - feedbutton = document.querySelector('link[type="application/rss+xml"]'); - if (!feedbutton) { - throw "No feed button on this page."; - } - - if (deviantRipper.isChrome === true) { - deviantRipper.pages.btnID.parentNode.removeChild( - deviantRipper.pages.btnID - ); - - iframeLoader = document.createElementNS( - docNamespace, - 'iframe' - ); - iframeLoader.src = feedbutton.href; - iframeLoader.style.width = '100%'; - iframeLoader.style.height = '100px'; - document.body.insertBefore( - iframeLoader, - document.body.firstChild - ); - } else { - deviantRipper.btn.startXML(feedbutton.href); - } - - }, - - /* - * startXML () - * - * started from init() to start grabbing XML pages - * starting with current loaded one. Script assumes - * we loaded from an iframe. - */ - startXML : function (galleryLink) { - if (debug) { GM_log("Call: startXML(" + arguments[0] + ")"); } - deviantRipper.pages.btnID.addEventListener('click', deviantRipper.btn.abortLinkChecking, false); - deviantRipper.xml_link_data.push(galleryLink.toString()); - deviantRipper.pages.fetchStatus = 1; - deviantRipper.xml_xHttp.startInterval(deviantRipper.heartbeat.load_xml, 50); - }, - - /* - * abortLinkChecking () - * - * onclick triggered when button is clicked - * while we're getting links. - */ - abortLinkChecking : function () { - deviantRipper.abort_links = true; - GM_log("abortLinkChecking()"); - deviantRipper.pages.btnID.removeEventListener('click', deviantRipper.abortLinkChecking, false); - }, - - /* - * generateButton() - * - * creates the click button for our page - */ - generateButton : function () { - if (debug) { GM_log("Call: generateButton()"); } - var new_button; - var btnLoc; - - new_button = document.createElement("input"); - new_button.type = "button"; - new_button.value = "Get URLs for Gallery"; - new_button.setAttribute("onsubmit", "return false;"); - - // var btnLoc = document.getElementById("gmi-GalleryEditor"); - btnLoc = document.getElementById("output"); - if (btnLoc) { - btnLoc.insertBefore(new_button, btnLoc.firstChild); - new_button.addEventListener("click", deviantRipper.btn.getLinks, false); - } else { - new_button.value = "Root Thumbnail Page?"; - document.body.insertBefore(new_button, document.body.firstChild); - } - return new_button; - }, - - /* - * generateXMLButton() - * - * creates the click button for our page - */ - generateXMLButton : function () { - if (debug) { GM_log("Call: generateXMLButton()"); } - var new_button; - var docNamespace = 'http://www.w3.org/1999/xhtml'; - var replacedRootNode = document.createElement('clearinghouse'); - - // empty out the current document view. - if (deviantRipper.isChrome === true) { - while (document.documentElement.firstChild) { - replacedRootNode.appendChild( - document.documentElement.firstChild - ); - } - } else if (deviantRipper.isFireFox === true) { - while (document.body.firstChild) { - replacedRootNode.appendChild( - document.body.firstChild - ); - } - } - - if (document.body === null) { - document.body = document.createElementNS('http://www.w3.org/1999/xhtml', 'body'); - document.documentElement.appendChild(document.body); - } - - new_button = document.createElementNS(docNamespace, 'input'); - new_button.type = "button"; - new_button.value = "Loading..."; - new_button.setAttribute("onsubmit", "return false;"); - document.body.appendChild(new_button); - new_button.addEventListener('click', deviantRipper.btn.abortLinkChecking, false); - - return new_button; - } - }, // end btn - - heartbeat: { - - /* - * load_xml () - * - * heartbeat loop while loading gallerie indices - */ - load_xml : function () { - var runcon = deviantRipper.xml_xHttp.runcon; - var maxreq = deviantRipper.xml_xHttp.maxreq; - var length = deviantRipper.xml_link_data.length; - if ((runcon < maxreq) && (length > 0)) { - if (debug) { GM_log("heartbeat load_xml()\nrunning connections: (" + runcon + ') max running (' + maxreq + ')'); } - deviantRipper.checker.next_xml(); - } - if ((length === 0) && (runcon === 0)) { - if (debug) { GM_log("Stopping heartbeat out of xml pages to pull."); } - deviantRipper.xml_xHttp.stopInterval(); - - deviantRipper.pages.total = deviantRipper.pages.toparse.length; - deviantRipper.pages.fetchStatus = 3; - deviantRipper.xml_xHttp.startInterval(deviantRipper.heartbeat.xml_finisher, 50); - } - }, - - /* - * xml_finisher () - * - * watches for xml to finish loading then displays the urls. - */ - xml_finisher : function () { - var runcon = deviantRipper.xml_xHttp.runcon; - var length = deviantRipper.xml_link_data.length; - if ((length === 0) && (runcon === 0)) { - if (debug) { GM_log("Stopping heartbeat xml_finisher."); } - deviantRipper.xml_xHttp.stopInterval(); - - deviantRipper.display_url_list(); - } - } - } // end heartbeat - - }; - - - -if (debug) { GM_log("Current URL loaded from: " + document.location.href); } -//start the dirty stuff -deviantRipper.init(); diff --git a/dwb/greasemonkey/fbpurity.EGTEGTWO.user.js b/dwb/greasemonkey/fbpurity.EGTEGTWO.user.js deleted file mode 100644 index 5ae6675..0000000 --- a/dwb/greasemonkey/fbpurity.EGTEGTWO.user.js +++ /dev/null @@ -1,4167 +0,0 @@ -// ==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. (More Info)'; - 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=[ -'
 FBP Tip: Want some help with using the Custom Text Filter? Visit the Custom Text Filter Help Section', -'
 FBP Tip: Want to further customise Facebook? Check out FBP\'s Custom CSS', -'
 FBP Tip: If you have any questions or problems with FBP Check out FBP\'s FAQ / Help Page', -'
 FBP Tip: Donations help keep the FB Purity project alive, Please show your support and Donate.', -'
 FBP Tip: Want to help test out new versions of FBP before they are officially released? Join the FBP Beta Testing Page.', -'
 FBP Tip: Please Help me out by telling all your friends about FB Purity: Share FB Purity.', -'
 FBP Tip: 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= '
'+ -''+ -''+ -'
F.B. Purity Logo' + -'

F.B. Purity ' + fbpVersion + ' Options

     ' + -'
FBP Home | News | User Guide | Help | Fan Page | Contact | Donate         [ X ]
'+ - -//'
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. Check for latest version
"Like" the FB Purity Fan Page 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". Check for latest version
'+ -''+ -'
'+ - -// -// - -'
'+ -'"; - } - this.buildTable =function(endmode){ - if(typeof endmode=='undefined') - return this.table; - else - return this.table + '
'; - -// add new dynamic opts -function optionsbox(mode) { - var table, rowstyle; - this.rownum=1; - if(1) // ischrome doesnt work in safari - var openallboxes=''; - else - var openallboxes=''; - if (typeof mode !='undefined' && mode=='extras') { - this.table=''; - } - else - //this.table="
'+ openallboxes +' Newsfeed Filters  ? Hide
"; - this.table=""; - - // Use tbody to group tables instead of divs ! !!! ! :) - this.tableHeader = function (title, hint, varname) { - //this.table+='

' + title + '

"; - this.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 += ''+ -''+ - -''+ -''+ -''+ -//''+ -''+ -''+ -''+ -''+ -''+ -''+ -''+ - -''+ -''+ -''+ -''+ -''+ -''+ - -// right column links options -''+ - -// left column links options -''+ - -// fonts and colours section -''+ - -'
More OptionsHide ' + -// new custom text filter/ css / app whitelist tabs -'Custom Text Filter - ' + -'Application Whitelist - ' + -'Custom CSS
' + -'Enter the words or phrases, on separate lines, that you wish to filter from your news feed. (Text Filter Help)
' + -'' + -//(window.navigator.userAgent.match(/Mozilla\/4\.0 \(compatible\; MSIE 7\.0\; Windows/) ? '' : '
 FBP Tip: Want to remove Facebook Timeline? Click here.') + - -fbptips[Math.floor(Math.random() * fbptips.length)] + - -'
'+ -'
Beta Tester Box
Further OptionsSet

Hide Links in Right Column

Hide Links in Left Column

Font and Colour Options

'+ -'' + -'' + -'' + -'' + -'' + -'
' + - -'

'+ -'

If you like F.B. Purity and would like to show your appreciation for all the work
I have put into it and also support future development, please make a donation.

' + - -'
 Please tell all your friends about FBP tooShare on Facebook
'+ -'
'+ -'
Export Settings / Import Settings / ?
'; - -var fbpfirstrunhtml='
'+ -'
X
'+ -'
'+ -'

Hello there! It looks like this is your first time running F.B. Purity *

'+ -'

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.

' + -'

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.

Update: 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.

'+ -'

First Step: Click Like:

'+ -'

Next Step: Click here for instructions on how to use F.B. Purity

'+ - -''+ -'
'; - -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 = "**Update** "; - 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=0;i--) - for(i=0;i1) // 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='F.B. Purity : Blocking Application : "' + appname + '"    '; - - 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= '

' +appname + ' has been BLOCKED!' + '

'; - 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;iBA"; - 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="WL"; - 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;iF.B. Purity hid:  0 app [ Show ]  0 extra [ Show ] '; - - 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'; - 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=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 -//as=document.getElementsByTagName('a');for(i=0;i=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=''; - blahlab.innerHTML='Block';//'; - blahlink.appendChild(blahlab); - // new block code, get id of cancel_click button, and click it to close dialog - // - - 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=''; - //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;iBA'; - 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;iTL'+ - '
X
'; - 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