// ==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 https://greasyfork.org/users/1440075 // @downloadURL none // ==/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); }; } });