Greasy Fork

No "9GAGGER"

Remove 9gag's terrible promoted posts

当前为 2022-07-25 提交的版本,查看 最新版本

// ==UserScript==
// @name         No "9GAGGER"
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Remove 9gag's terrible promoted posts
// @author       You
// @match        https://9gag.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=9gag.com
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';
    setInterval(() => {
        let authors = document.getElementsByClassName("ui-post-creator__author")

        for (let i = 0; i < authors.length; i++) {
            try {
                if (authors[i].innerText == "9GAGGER") {
                    let post = authors[i].parentElement.parentElement.parentElement.parentElement;
                    console.log("Removing Post", post.innerText);
                    post.parentElement.removeChild(post);
                }
            } catch (e) {
                console.debug("Skipping post due to error.", e, authors[i]);
            }
        }
    }, 100);
    // Your code here...
})();