Greasyfork No Dark Mode

Disables dark mode on GreasyFork/SleazyFork.

Verze ze dne 19. 04. 2025. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==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();
    }
})();