Reddit Cleaner

Auto version of working bookmarklet (no reload needed)

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

ستحتاج إلى تثبيت إضافة مثل Stylus لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتتمكن من تثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

ستحتاج إلى تثبيت إضافة لإدارة أنماط المستخدم لتثبيت هذا النمط.

(لدي بالفعل مثبت أنماط للمستخدم، دعني أقم بتثبيته!)

// ==UserScript==
// @name         Reddit Cleaner
// @namespace    https://greasyfork.org/users/aakash-yadav
// @version      2.0
// @description  Auto version of working bookmarklet (no reload needed)
// @author       graphite
// @match        https://www.reddit.com/*
// @run-at       document-end
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    function unblock() {
        try {
            // Reset body lock
            document.body.style = "";

            // Remove blur layer
            document.querySelector("div[style*='blur(4px)']")?.remove();

            // Remove main modal
            document.getElementById("blocking-modal")?.remove();

            // Remove shadow popup
            try {
                const x = document.getElementsByTagName("xpromo-nsfw-blocking-container")[0];
                if (x && x.shadowRoot && x.shadowRoot.children[1]) {
                    x.shadowRoot.children[1].remove();
                }
            } catch(e) {}

            // Remove other popups
            document.getElementsByTagName("xpromo-untagged-content-blocking-modal")[0]?.remove();
            document.querySelector("shreddit-exit-app-modal")?.remove();

        } catch(e) {}
    }

    // Run immediately on load
    unblock();

    // Keep running for dynamic content
    setInterval(unblock, 800);

    // Re-run on Reddit SPA navigation (page changes without reload)
    if (window.navigation) {
        window.navigation.addEventListener("navigate", () => {
            unblock();
            setTimeout(unblock, 500);
            setTimeout(unblock, 1500);
            setTimeout(unblock, 3000);
        });
    }

})();