Skip to content

Instantly share code, notes, and snippets.

@ajorpheus
Last active July 11, 2022 00:36
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 ajorpheus/f0de1fb3f312a6ea197611ac043be8a7 to your computer and use it in GitHub Desktop.
Save ajorpheus/f0de1fb3f312a6ea197611ac043be8a7 to your computer and use it in GitHub Desktop.
// ==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