Greasyfork No Dark Mode

Disables dark mode on GreasyFork/SleazyFork.

Version vom 19.04.2025. Aktuellste Version

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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.

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

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

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

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

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

// ==UserScript==
// @name         Greasyfork No Dark Mode
// @description  Disables dark mode on GreasyFork/SleazyFork.
// @icon         https://greasyfork.org/vite/assets/blacklogo96-CxYTSM_T.png
// @version      1.0
// @author       afkarxyz
// @namespace    https://github.com/afkarxyz/userscripts/
// @supportURL   https://github.com/afkarxyz/userscripts/issues
// @license      MIT
// @match        https://greasyfork.org/*
// @match        https://sleazyfork.org/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    function removeDarkModeCSS() {
        for (let i = 0; i < document.styleSheets.length; i++) {
            const sheet = document.styleSheets[i];

            try {
                const rules = sheet.cssRules;
                if (!rules) continue;

                for (let j = rules.length - 1; j >= 0; j--) {
                    const rule = rules[j];

                    if (
                        rule.type === CSSRule.MEDIA_RULE &&
                        rule.conditionText.includes('prefers-color-scheme: dark')
                    ) {
                        sheet.deleteRule(j);
                    }
                }
            } catch (e) {
                continue;
            }
        }
    }

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', removeDarkModeCSS);
    } else {
        removeDarkModeCSS();
    }
})();