Skip to content

Instantly share code, notes, and snippets.

@sharnie
Created May 29, 2018 02:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sharnie/29cae94ee6cf1caac86d89731b32b5fc to your computer and use it in GitHub Desktop.
Save sharnie/29cae94ee6cf1caac86d89731b32b5fc to your computer and use it in GitHub Desktop.
/**
* 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