Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/**
* Only display Facebook Ads
* in your news feed
*/
const renderFacebookAds = () => {
'use strict';
const userPosts = document.querySelectorAll('[id*="hyperfeed_story_id"]');
Array.from(userPosts).map(userPost => {
const isSponsoredPost = userPost.querySelector('span[class*=r_]');
if (!isSponsoredPost) userPost.style.display = 'none';
});
};
document.body.onkeyup = event => {
if (event.keyCode == 32) renderFacebookAds();
if (event.keyCode == 67 && event.ctrlKey) renderFacebookAds();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.