Skip to content

Instantly share code, notes, and snippets.

@mayoralito
Last active June 3, 2018 17:33
Show Gist options
  • Save mayoralito/78b075f13af649ae201da1e021197584 to your computer and use it in GitHub Desktop.
Save mayoralito/78b075f13af649ae201da1e021197584 to your computer and use it in GitHub Desktop.
Facebook Scripting Tools
function removeAds() {
var allItems = document.querySelectorAll('._2b2e ._2b2p');
for (var item of allItems) {
var isAdEnabled = (item.getAttribute('data-tooltip-content').toLowerCase() == "remove");
if (isAdEnabled) {
item.click();
}
}
}
console.log("Starting removing ads from facebook prefences!");
removeAds();
console.log('Ads removed!');
eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('c 4(){1 3=b.d(\'.e .a\');g(1 0 8 3){1 2=(0.9(\'7-f-t\').p()=="q");h(2){0.s()}}}6.5("o n j i k l!");4();6.5(\'m r!\');',30,30,'item|var|isAdEnabled|allItems|removeAds|log|console|data|of|getAttribute|_2b2p|document|function|querySelectorAll|_2b2e|tooltip|for|if|from|ads|facebook|prefences|Ads|removing|Starting|toLowerCase|remove|removed|click|content'.split('|'),0,{}))
function markAllNotificationAsRead(read) {
var allItems = document.querySelectorAll('#globalContainer ._55mc ._h_c div');
for (var item of allItems) {
var ariaLabelValue = (read) ? "mark as read" : "mark as unread"
var isAdEnabled = (item.getAttribute('aria-label').toLowerCase() == ariaLabelValue);
if (isAdEnabled) {
item.click();
}
}
}
markAllNotificationAsRead(true);
eval(function(p,a,c,k,e,d){e=function(c){return c.toString(36)};if(!''.replace(/^/,String)){while(c--){d[c.toString(a)]=k[c]||c.toString(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('c 8(1){0 7=b.d(\'#a .f .g 9\');e(0 2 p 7){0 5=(1)?"3 4 1":"3 4 h"0 6=(2.o(\'m-l\').i()==5);j(6){2.k()}}}8(n);',26,26,'var|read|item|mark|as|ariaLabelValue|isAdEnabled|allItems|markAllNotificationAsRead|div|globalContainer|document|function|querySelectorAll|for|_55mc|_h_c|unread|toLowerCase|if|click|label|aria|true|getAttribute|of'.split('|'),0,{}))

Facebook Ad Removal

Want to clean up a little bit of your preferences on facebook ad? It will take some time, facebook only allows to remove ads one by one ... No surprise here thou. However, we can kind of automate the process ...

How to remove ad preferences from facebook website.

----------------------------------------------------------------------

Mark All Notifications As Read/UnRead

How to remove ad preferences from facebook website.

  • Go here: https://www.facebook.com/notifications
  • Open Developer Console
  • Pase the script from fb-mark-notif-as.min.js into the Developer Console
  • You will save a few (or a lot, it depends) clicks.

----------------------------------------------------------------------

Credits:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment