Last active
December 3, 2016 00:51
-
-
Save leotm/084ae769bdd2b90227bbec39abb88a96 to your computer and use it in GitHub Desktop.
How to Undo/Remove/Delete All Facebook Ad Preferences via the Console
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @undo-all-facebook-ad-preferences.js | |
* Undo/Remove/Delete All Facebook Ad Preferences. | |
* Page: 'Your Ad Preferences' | |
* URL: https://www.facebook.com/ads/preferences/ | |
* Instructions: Just paste each section to your Console. | |
*/ | |
// Expand each Category | |
var selector = "div > div > div > div > ul > li"; | |
var nodeList = document.querySelectorAll(selector); | |
var array = Array.prototype.slice.call(nodeList); | |
var interval = setInterval(function() { | |
array.shift().click(); | |
if (!array.length) clearInterval(interval); | |
}, 100); | |
// Expand each 'See More' button | |
// Note: your li.class may vary | |
var selector = "div > div > div > div > ul > li._z0p > div > span"; | |
var nodeList = document.querySelectorAll(selector); | |
var array = Array.prototype.slice.call(nodeList); | |
var interval = setInterval(function() { | |
if (array.length) { | |
array.shift().click(); | |
nodeList = document.querySelectorAll(selector); | |
array = Array.prototype.slice.call(nodeList); | |
} | |
if (!array.length) clearInterval(interval); | |
}, 100); | |
// Undo each Ad Preference | |
var selector = "div > div > div > div > ul > li > div > div > div > span > i"; | |
var nodeList = document.querySelectorAll(selector); | |
var array = Array.prototype.slice.call(nodeList); | |
var interval = setInterval(function() { | |
array.shift().click(); | |
if (!array.length) clearInterval(interval); | |
}, 100); | |
// ~100 milliseconds seems about right until the requests get rejected. | |
/** | |
* What?! Ad Preferences are Undoing! | |
* 1, 2, and ... Poof! | |
* Congratulations! Your Ad Preferences are now Free! | |
*/ | |
/** | |
* "A lack of transparency results in distrust and a deep sense of insecurity" - Dalai Lama | |
* "Relying on the government to protect your privacy is like asking a peeping tom to install your window blinds." - John Perry Barlow | |
* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment