Fapeza Dark Mode

Auto dark mode for fapeza.com and all subdomains

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

Advertisement:

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

Advertisement:

// ==UserScript==
// @name         Fapeza Dark Mode
// @namespace    https://greasyfork.org/en/users/1375891-wibu-elite
// @version      1.0 (June 24, 2026)
// @description  Auto dark mode for fapeza.com and all subdomains
// @author       Kinnena
// @match        https://fapeza.com/*
// @match        https://*.fapeza.com/*
// @icon         https://cdn-icons-png.flaticon.com/512/5261/5261958.png
// @grant        none
// @license      MIT
// @run-at       document-start
// ==/UserScript==

(function () {
    'use strict';

    const darkCSS = `
        /* ===== BASE ===== */
        html, body {
            background-color: #111111 !important;
            color: #e0e0e0 !important;
        }

        /* ===== NAVBAR & HEADER ===== */
        header,
        nav,
        .navbar,
        .navbar-default,
        .top-bar,
        .header,
        .site-header {
            background-color: #1a1a1a !important;
            border-bottom: 1px solid #333 !important;
        }

        /* ===== SIDEBAR ===== */
        .sidebar,
        aside,
        .side-panel {
            background-color: #1a1a1a !important;
        }

        /* ===== CARDS & PANELS ===== */
        .card,
        .panel,
        .box,
        .block,
        .model-block,
        .thumb,
        .item,
        .post,
        .entry,
        .content-box {
            background-color: #1e1e1e !important;
            border-color: #333 !important;
        }

        /* ===== FOOTER ===== */
        footer,
        .footer,
        .site-footer {
            background-color: #111111 !important;
            border-top: 1px solid #333 !important;
            color: #999 !important;
        }

        /* ===== LINKS ===== */
        a {
            color: #7eb8f7 !important;
        }
        a:hover {
            color: #aad4ff !important;
        }

        /* ===== BUTTONS ===== */
        .btn,
        button,
        input[type="button"],
        input[type="submit"] {
            background-color: #2a2a2a !important;
            color: #e0e0e0 !important;
            border-color: #444 !important;
        }
        .btn-primary,
        .btn-blue {
            background-color: #1a4a8a !important;
            border-color: #1a4a8a !important;
            color: #fff !important;
        }

        /* ===== INPUTS & FORMS ===== */
        input,
        textarea,
        select {
            background-color: #2a2a2a !important;
            color: #e0e0e0 !important;
            border-color: #444 !important;
        }
        input::placeholder,
        textarea::placeholder {
            color: #777 !important;
        }

        /* ===== DROPDOWNS ===== */
        .dropdown-menu,
        .menu,
        .submenu {
            background-color: #1e1e1e !important;
            border-color: #333 !important;
        }
        .dropdown-menu li a,
        .menu li a {
            color: #e0e0e0 !important;
        }
        .dropdown-menu li a:hover {
            background-color: #2a2a2a !important;
        }

        /* ===== MODALS ===== */
        .modal-content,
        .modal-header,
        .modal-body,
        .modal-footer {
            background-color: #1e1e1e !important;
            border-color: #333 !important;
            color: #e0e0e0 !important;
        }

        /* ===== TAGS & BADGES ===== */
        .tag,
        .badge,
        .label {
            background-color: #2a2a2a !important;
            color: #ccc !important;
        }

        /* ===== PAGINATION ===== */
        .pagination a,
        .pagination span,
        .page-link {
            background-color: #1e1e1e !important;
            color: #7eb8f7 !important;
            border-color: #333 !important;
        }
        .pagination .active a,
        .page-item.active .page-link {
            background-color: #1a4a8a !important;
            border-color: #1a4a8a !important;
            color: #fff !important;
        }

        /* ===== TABLES ===== */
        table, th, td {
            background-color: #1e1e1e !important;
            color: #e0e0e0 !important;
            border-color: #333 !important;
        }
        tr:nth-child(even) td {
            background-color: #242424 !important;
        }

        /* ===== SCROLLBAR ===== */
        ::-webkit-scrollbar {
            width: 8px;
        }
        ::-webkit-scrollbar-track {
            background: #1a1a1a;
        }
        ::-webkit-scrollbar-thumb {
            background: #444;
            border-radius: 4px;
        }
        ::-webkit-scrollbar-thumb:hover {
            background: #666;
        }

        /* ===== MISC TEXT ===== */
        h1, h2, h3, h4, h5, h6 {
            color: #f0f0f0 !important;
        }
        p, span, li, td, th, label, div {
            color: inherit !important;
        }

        /* ===== WHITE BACKGROUNDS ===== */
        [style*="background-color: #fff"],
        [style*="background-color: white"],
        [style*="background: white"],
        [style*="background: #fff"],
        [style*="background:#fff"],
        [style*="background:white"] {
            background-color: #1e1e1e !important;
        }

        /* ===== BORDERS ===== */
        [style*="border-color: #fff"],
        [style*="border: 1px solid white"] {
            border-color: #333 !important;
        }

        /* ===== IMAGES - keep normal, don't invert ===== */
        img, video {
            filter: none !important;
        }
    `;

    // Inject CSS before page renders (run-at: document-start)
    const style = document.createElement('style');
    style.id = 'fapeza-dark-mode';
    style.textContent = darkCSS;

    // Append as soon as <head> or <html> is available
    const inject = () => {
        const target = document.head || document.documentElement;
        if (target && !document.getElementById('fapeza-dark-mode')) {
            target.appendChild(style);
        }
    };

    inject();

    // Also re-inject after DOM is ready (in case the site re-renders)
    document.addEventListener('DOMContentLoaded', inject);

    // Watch for dynamic DOM changes (SPA behavior)
    const observer = new MutationObserver(() => {
        if (!document.getElementById('fapeza-dark-mode')) {
            inject();
        }
    });

    document.addEventListener('DOMContentLoaded', () => {
        observer.observe(document.body, { childList: true, subtree: true });
    });

})();