Created
April 3, 2020 18:49
-
-
Save ricealexander/289bc6f9fe4820cbb118360871f13795 to your computer and use it in GitHub Desktop.
Remove promoted content on different platforms
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
// Remove Twitter Promoted Tweets | |
window.addEventListener('scroll', _event => { | |
[ ...document.querySelectorAll('h2') ] | |
.filter(heading => heading.textContent.includes("Promoted Tweet")) | |
.map(heading => heading.parentElement.parentElement) | |
.forEach(promotion => promotion.remove()) | |
}) | |
// Remove LinkedIn Promoted Posts | |
window.addEventListener('scroll', _event => { | |
[ ...document.querySelectorAll('span') ] | |
.filter(span => span.textContent.includes("Promoted")) | |
.map(span => span.closest('.ember-view')) | |
.forEach(promotion => promotion.remove()) | |
}) | |
// Remove Reddit Promoted Posts | |
window.addEventListener('scroll', _event => { | |
[ ...document.querySelectorAll('span') ] | |
.filter(span => span.textContent.includes("promoted")) | |
.map(span => span.closest('[tabindex]')) | |
.forEach(promotion => promotion.remove()) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment