Last active
July 11, 2022 00:36
-
-
Save ajorpheus/f0de1fb3f312a6ea197611ac043be8a7 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
// ==UserScript== | |
// @name Remove Promoted Reddit Posts | |
// @namespace / | |
// @version 2.0 | |
// @description try to take over the world! | |
// @author You | |
// @match /\* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
const promotedPosts = document.getElementsByClassName('promotedlink'); | |
let totalPosts = 0; | |
const hidePromotedPosts = () => { | |
alert(1) | |
if (promotedPosts.length === totalPosts) return; | |
totalPosts = promotedPosts.length; | |
Array.from(promotedPosts).forEach((post) => { | |
post.style.display = 'none'; | |
}); | |
}; | |
hidePromotedPosts(); | |
document.body.addEventListener('DOMNodeInserted', hidePromotedPosts); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment