Civitai Ad Remover

Removes add cell from the front page, and possibly others.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Civitai Ad Remover
// @namespace    https://civitai.com/user/superskirv
// @version      0.6
// @description  Removes add cell from the front page, and possibly others.
// @author       Super.Skirv and Qwen2.5-QwQ
// @match        https://civitai.com/*
// @icon         https://civitai.com/images/android-chrome-192x192.png
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    function removeAdDiv() {
        const adBannerClasses = [
            "relative flex overflow-hidden rounded-md border-gray-3 bg-gray-0 shadow-gray-4 dark:border-dark-4 dark:bg-dark-6 dark:shadow-dark-8 flex-col w-full items-center justify-center shadow",
            "relative flex overflow-hidden rounded-md border-gray-3 bg-gray-0 shadow-gray-4 dark:border-dark-4 dark:bg-dark-6 dark:shadow-dark-8 flex-col mx-auto min-w-80 justify-between gap-2 border p-2 shadow"
        ];

        document.querySelectorAll('div').forEach(div => {
            if (adBannerClasses.includes(div.className)) {
                div.remove();
            }
        });
    }

    function removeAdBannerDiv() {
        const adBannerClasses = [
            "relative box-content flex flex-col items-center justify-center gap-2 bg-gray-1 py-3 dark:bg-dark-6",
            "relative flex justify-center border-t border-gray-3 bg-gray-2 dark:border-dark-4 dark:bg-dark-9",
            "relative box-content flex flex-col items-center justify-center gap-2"
        ];

        document.querySelectorAll('div').forEach(div => {
            if (adBannerClasses.includes(div.className)) {
                div.remove();
            }
        });
    }

    // Run once on load and periodically in case new content loads dynamically
    window.addEventListener('load', function() {
        removeAdDiv();
        removeAdBannerDiv();
    });
    setInterval(function() {
        removeAdDiv();
        removeAdBannerDiv();
    }, 2000);
})();