GreasyFork No Dark Mode

Disables dark mode on GreasyFork/SleazyFork.

Stan na 19-04-2025. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

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