// ==UserScript== // @name 脚本猫去广告 // @namespace https://scriptcat.org/ // @version 1.0.0 // @description 隐藏 scriptcat.org 站内全部广告位:首页横幅 / 搜索信息流横幅 / 侧栏 / 详情右竖栏 / 赞助卡片。无界面无按钮,装上即生效。 // @match *://scriptcat.org/* // @match *://*.scriptcat.org/* // @run-at document-start // @grant none // @license MIT // ==/UserScript== (function () { 'use strict'; // 站点所有广告位(横幅/侧栏/竖栏/卡片)都渲染在 [data-ad-render] 容器里, // 内含"广告"标签 + ins.adsbygoogle。用 CSS 按属性隐藏而不是 remove, // React 后续重渲染也不会报错,且 document-start 注入无广告闪现。 const css = ` [data-ad-render] { display: none !important; } /* 兜底:漏网的 AdSense 原始单元 */ ins.adsbygoogle { display: none !important; height: 0 !important; } `; const style = document.createElement('style'); style.textContent = css; (document.head || document.documentElement).appendChild(style); })();