Dark Mode

5/15/2025, 3:06:18 PM

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 or Violentmonkey 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.

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        Dark Mode
// @namespace   Violentmonkey Scripts
// @match       *://jav.guru/*
// @grant       none
// @version     1.0
// @author      -
// @description 5/15/2025, 3:06:18 PM
// ==/UserScript==

(function () {
    function addDarkClass() {
        if (!document.body.classList.contains("wp-night-mode-on")) {
            document.body.classList.add("wp-night-mode-on");
            console.log("[VM] wp-night-mode-on class added");
        }
    }

    // Wait until the DOM is ready and the body exists
    if (document.readyState === "loading") {
        document.addEventListener("DOMContentLoaded", addDarkClass);
    } else {
        addDarkClass();
    }

    // Also use MutationObserver in case body is changed or replaced
    const observer = new MutationObserver(() => {
        addDarkClass();
    });

    observer.observe(document.documentElement, { childList: true, subtree: true });
})();