您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
A simple script to bypass ad AD detection
当前为
// ==UserScript== // @name uBlock Ad Bypass // // @version 1.0.0 // @description A simple script to bypass ad AD detection // @match *://*/* // @run-at document-start // @grant none // @license MIT // @namespace http://greasyfork.icu/users/1440075 // ==/UserScript== // 获取原始的 getComputedStyle 函数 const originalGetComputedStyle = window.getComputedStyle; Object.defineProperty(window, "getComputedStyle", { get() { return (element) => { // 判断元素是否为可能的广告类型 if ( element instanceof HTMLImageElement || // 图片 element instanceof HTMLIFrameElement || // iframe element instanceof HTMLScriptElement || // 脚本 element instanceof HTMLDivElement || // div 元素,通常用于广告容器 element instanceof HTMLSpanElement // span 元素,某些广告可能使用 span ) { // 通过元素的属性判断是否是广告 const isAd = ( (element.src && (element.src.includes('ad') || element.src.includes('banner') || element.src.includes('ads'))) || (element.id && element.id.includes('ad')) || (element.className && element.className.includes('ad')) || (element.style && element.style.display === 'none') ); // 如果判断为广告,强制其显示 if (isAd) { return { ...originalGetComputedStyle(element), display: "block" }; } } // 返回原始样式,非广告元素 return originalGetComputedStyle(element); }; } });