去manwa检测广告弹窗-强制方法

强制拦截manwa广告检测

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         去manwa检测广告弹窗-强制方法
// @namespace    pipi
// @version      0.8
// @description  强制拦截manwa广告检测
// @run-at       document-start
// @match        https://manwa.me/chapter/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // 拦截可能创建弹窗的脚本
    const originalCreateElement = document.createElement;
    document.createElement = function(tagName) {
        const element = originalCreateElement.call(this, tagName);

        if (tagName.toLowerCase() === 'div') {
            const originalSetAttribute = element.setAttribute;
            element.setAttribute = function(name, value) {
                originalSetAttribute.call(this, name, value);

                // 检查是否是弹窗相关属性
                if ((name === 'class' && value.includes('modal')) ||
                    (name === 'style' && value.includes('fixed'))) {
                    console.log('拦截潜在弹窗元素创建');
                }
            };
        }
        return element;
    };

    // 覆盖alert显示方法(针对自定义alert)
    window.alert = function() {
        const message = arguments[0] || '';
        if (message.includes('请关闭阻挡广告插件') || message.includes('manwa.me')) {
            console.log('拦截广告检测alert:', message);
            return;
        }
        // 其他正常alert允许通过
        return Function.prototype;
    };

    // 定期清理弹窗
    setInterval(() => {
        const modals = document.querySelectorAll('div[style*="fixed"], div[style*="absolute"]');
        modals.forEach(modal => {
            if (modal.textContent.includes('请关闭阻挡广告插件') ||
                modal.textContent.includes('manwa.me 显示')) {
                modal.remove();
                console.log('已移除广告弹窗');
            }
        });
    }, 1000);
})();