// ==UserScript== // @name No "9GAGGER" // @namespace http://tampermonkey.net/ // @version 0.11 // @description Remove 9gag's terrible promoted posts and some spam // @author You // @match https://9gag.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=9gag.com // @grant none // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; let forbiddenAuthors = ["^$", "9gagger", "\\spro"]; let forbiddenText = [ "velma", "woke", "lgbt", "rowling", "wahmen", "wahman", "dark humor", "dark humour", "joe rog", "rogan", "generation", "politics", "climate", "election", "vote", "lula", "bozo", "bolso", "news", "modern", "true", "truth", "qatar", "world cup", "russia", "ukraine", "latest news", "german", "brazil", "brasil", "usa", "war", "russo", "marvel", "mcu", "ariel", "mermaid", "lord of the rings", "rings of power", "lotr", "whame", "relationship", "rekt", "black", "white", "opress", "nazi", "not funny", "religion", "lgb", "gay", "patriarchy", "netflix", "politic", "liberal", "democrat", "libs", "groom", "diversity", "male", "sigma", "alpha", "beta", "based", "politics", "sjw", "trump", "jordan", "peterson", "women", "woman", "girl", "alphabet", "lgbt", "latest news", "alt right", "altright", "leftist", "socialism", "communism", "china", "russia", "ukraine", "covid", "corona", "rona", "she-", "groomer", "sex", "censure", "trans", "cancel", "elon", "musk", "triggered", "trigger", "woke", "repost", "troon", "clown", "tranny", "leftard", "netflix", "feminism", "nazi", "censored", "censor", "cesored", "racis", "gender", "pronoun", "savage", ] let forbiddenRegExp = new RegExp("(" + forbiddenText.join(")|(") + ")", "gi"); let forbiddenAuthorRegExp = new RegExp("(" + forbiddenAuthors.join(")|(") + ")", "gi"); function removePost (post, reason) { console.log(`Removing bad post due to ${reason}: `, post, post.innerText.replaceAll("\n", " ")); post.parentElement.removeChild(post); } setInterval(() => { let posts = document.getElementsByTagName("article"); for (let i = 0; i < posts.length; i++) { try { let post = posts[i]; if (post.dataset.checkedForShit == "1") { continue; // this is a clean post } let text = post.innerText; let authorElement = post.getElementsByClassName("ui-post-creator")[0]; if (typeof authorElement == "undefined" && window.location.href.indexOf("/gag/") == -1) { // promoted post removePost(post, "No author element"); } let author = authorElement.innerText.replaceAll("\n", " ").trim(); let match = author.match(forbiddenAuthorRegExp); if (match != null) { removePost(post, match); continue; } match = text.match(forbiddenRegExp); if (match != null) { removePost(post, match); continue; } post.dataset.checkedForShit = "1"; } catch (e) { console.warn(e); } } }, 100); // Your code here... })();