// ==UserScript== // @name 去圆角 - 让所有网站元素变直角 #网页外观 // @namespace https://example.com // @version 2.1 // @description 让所有网站的输入框、按钮、容器等元素变成直角,去掉所有 border-radius // @author 宗品建 // @match *://*/* // @grant GM_addStyle // @license MIT // @run-at document-start // @downloadURL none // ==/UserScript== (function() { 'use strict'; // 强制覆盖所有可能的 UI 元素 GM_addStyle(` *, *::before, *::after { border-radius: 0px !important; } `); // 监听 DOM 变化,确保动态加载的元素也被处理 const observer = new MutationObserver(() => { document.querySelectorAll('*').forEach(el => { if (el.style.borderRadius) { el.style.borderRadius = '0px'; } }); }); observer.observe(document.documentElement, { childList: true, subtree: true }); // 处理 Shadow DOM function processShadowRoots(node) { if (node.shadowRoot) { GM_addStyle(` :host, * { border-radius: 0px !important; } `); node.shadowRoot.querySelectorAll('*').forEach(el => { el.style.borderRadius = '0px'; }); } } // 监听 Shadow DOM 变化 new MutationObserver(mutations => { mutations.forEach(mutation => { mutation.addedNodes.forEach(node => processShadowRoots(node)); }); }).observe(document.documentElement, { childList: true, subtree: true }); })();