您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Substitutes arbitrary fonts on webpages
当前为
- // ==UserScript==
- // @name Font Substitution v3
- // @description Substitutes arbitrary fonts on webpages
- // @author Alan Davies
- // @copyright 2015, Alan Davies
- // @version 3.0.0
- // @date 2015-08-26
- // @namespace FontSub3
- // @include *
- // @grant GM_addStyle
- // @run-at document-start
- // ==/UserScript==
- var globalDebug = false;
- if (globalDebug) console.log("Font substitution start");
- var fontMap = new Map([
- [ "arial", "Verdana" ],
- [ "helvetica", "Verdana" ],
- [ "courier", "Consolas" ],
- [ "courier new", "Consolas" ]
- ]);
- function OverrideFontFaces()
- {
- for (let fontSub of fontMap)
- {
- let style = "@font-face { font-family: \"" + fontSub[0] + "\"; src: local(\"" + fontSub[1] + "\") !important }";
- if (globalDebug) console.log("Adding style: " + style);
- GM_addStyle(style);
- }
- }
- var done = false;
- // create an observer instance
- var observer = new MutationObserver(function(mutations) {
- if (globalDebug) console.log("Mutation event");
- // Add the font face overrides once we have a body element
- if (!done && (null != document.body))
- {
- observer.disconnect();
- OverrideFontFaces();
- done = true;
- }
- });
- observer.observe(document, { childList: true, attributes: false, characterData: false, subtree: true });
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址