// ==UserScript==
// @name         Auto-Close Reply to Thread window when banned
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Automatically closes the quick reply window if "Error: You are banned." appears.
// @match        https://boards.4chan.org/*
// @match        http://boards.4chan.org/*
// @run-at       document-end
// ==/UserScript==

(function () {
    const observeTarget = document.body;

    function checkAndClose() {
        const qr = document.querySelector("#qr");
        if (!qr) return;

        const errorBox = qr.querySelector(".error");
        if (!errorBox) return;

        const text = errorBox.textContent.trim();

        if (text.includes("Error: You are banned.")) {
            const closeBtn = document.getElementById("qrClose");
            if (closeBtn) {
                closeBtn.click();
            }
        }
    }

    // Observe DOM for new error messages appearing
    const observer = new MutationObserver(checkAndClose);
    observer.observe(observeTarget, { childList: true, subtree: true });
})();
Edit

Pub: 26 Nov 2025 11:30 UTC

Views: 10