Last active
March 13, 2023 10:12
-
-
Save dijikul/d321fb12fe15acc7bfca9540af700912 to your computer and use it in GitHub Desktop.
Tampermonkey Script: Facebook Suggested Post Blocker
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
// ==UserScript== | |
// @name Facebook Suggested Post Blocker | |
// @namespace http://*.facebook.com | |
// @version 0.1 | |
// @description try to remove the "Suggested Post" blocks in the facebook feed | |
// @author jenksy | |
// @match https://www.facebook.com/ | |
// @grant none | |
// @require http://code.jquery.com/jquery-3.1.1.min.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// Colour the ads. | |
$(document).ready(function() { | |
// Create some fun functions | |
var hideAd = function() { | |
$("span:contains('Suggested Post')").parent().parent().parent().replaceWith('<div style="color:grey;text-align:center;">Ad Removed<div>'); | |
$("div:contains('People Also Shared')").parent().parent().parent().replaceWith('<div style="color:grey;text-align:center;">\'People Also Shared\'Removed<div>'); | |
$("div:contains('Suggested Videos')").parent().parent().parent().replaceWith('<div style="color:grey;text-align:center;">Suggested Videos Removed<div>'); | |
$("div:contains('Suggested Videos')").parent().parent().replaceWith('<div style="color:grey;text-align:center;">Suggested Videos Removed<div>'); | |
$("a:contains('Sponsored')").parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().parent().replaceWith('<div style="color:grey;text-align:center;">Sponsored Like Removed'); | |
}; | |
$(window).bind('mousewheel DOMMouseScroll', function(event) { | |
if (event.originalEvent.wheelDelta > 0 || event.originalEvent.detail < 0 ) { | |
// Scroll Up | |
hideAd(); | |
} | |
else { | |
//Scroll Down | |
hideAd(); | |
} | |
hideAd(); | |
}); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment