Created
May 29, 2018 02:25
-
-
Save sharnie/29cae94ee6cf1caac86d89731b32b5fc to your computer and use it in GitHub Desktop.
This file contains 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
/** | |
* 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