// ==UserScript== // @name 全局微软雅黑 // @namespace franciszhao // @version 2.2.0 // @description 一个使用微软的系列字体替换网页原有字体的用户样式表。 // @author Francis Zhao // @homepageURL https://n2o.io/go?page=custom.css // @supportURL https://weibo.com/francis4es // @license MIT // @grant GM_addStyle // @run-at document-start // @match *://*/* // @downloadURL none // ==/UserScript== (function() { let css = ""; css += `@charset "UTF-8"; html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; } html:lang(de) body { quotes: "„" "“"; } html:lang(en) body { font-family: "Segoe UI", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; } html:lang(en) code, html:lang(en) kbd, html:lang(en) pre, html:lang(en) samp { font-family: "Consolas", monospace, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; } html:lang(es) body, html:lang(no) body { quotes: "«" "»"; } html:lang(fr) body { quotes: "« " " »"; } html:lang(zh-CN) body, html:lang(zh-SG) body { font-family: "Microsoft YaHei", "HanHei SC", "方正兰亭黑_GB18030", "方正兰亭黑_GBK", -apple-system, BlinkMacSystemFont, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; } html:lang(zh-CN) code, html:lang(zh-CN) kbd, html:lang(zh-CN) pre, html:lang(zh-CN) samp, html:lang(zh-SG) code, html:lang(zh-SG) kbd, html:lang(zh-SG) pre, html:lang(zh-SG) samp { font-family: "", "Microsoft YaHei", "HanHei SC", "方正兰亭黑_GB18030", "方正兰亭黑_GBK", -apple-system, BlinkMacSystemFont, system-ui, monospace, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; } html:lang(zh-TW) body { font-family: "Microsoft JhengHei", "HanHei TC", -apple-system, BlinkMacSystemFont, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; quotes: "「" "」"; } html:lang(zh-TW) code, html:lang(zh-TW) kbd, html:lang(zh-TW) pre, html:lang(zh-TW) samp { font-family: "", "Microsoft JhengHei", "HanHei TC", -apple-system, BlinkMacSystemFont, system-ui, monospace, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; } html:lang(zh-HK) body, html:lang(zh-MO) body { font-family: "Microsoft JhengHei", "HanHei TC", -apple-system, BlinkMacSystemFont, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; quotes: "「" "」"; } html:lang(zh-HK) code, html:lang(zh-HK) kbd, html:lang(zh-HK) pre, html:lang(zh-HK) samp, html:lang(zh-MO) code, html:lang(zh-MO) kbd, html:lang(zh-MO) pre, html:lang(zh-MO) samp { font-family: "", "", "Microsoft JhengHei", "HanHei TC", -apple-system, BlinkMacSystemFont, system-ui, monospace, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; } html:lang(ja) body { font-family: "Yu Gothic", "Hiragino Kaku Gothic Pro", -apple-system, BlinkMacSystemFont, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; quotes: "「" "」"; } html:lang(ja) code, html:lang(ja) kbd, html:lang(ja) pre, html:lang(ja) samp { font-family: "", "Yu Gothic", "Hiragino Kaku Gothic Pro", -apple-system, BlinkMacSystemFont, system-ui, monospace, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; } html:lang(ko) body { font-family: "Malgun Gothic", -apple-system, BlinkMacSystemFont, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; } html:lang(ko) code, html:lang(ko) kbd, html:lang(ko) pre, html:lang(ko) samp { font-family: "", "Malgun Gothic", -apple-system, BlinkMacSystemFont, system-ui, monospace, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; } body { font-family: "Segoe UI", "Microsoft YaHei", "HanHei SC", "方正兰亭黑_GB18030", "方正兰亭黑_GBK", -apple-system, BlinkMacSystemFont, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; quotes: "“" "”"; } button, input, keygen, select, textarea { font-family: inherit; } button:disabled, input:disabled, keygen:disabled, select:disabled, textarea:disabled { cursor: not-allowed; } code, kbd, pre, samp { font-family: "Consolas", "", "Microsoft YaHei", "HanHei SC", "方正兰亭黑_GB18030", "方正兰亭黑_GBK", -apple-system, BlinkMacSystemFont, system-ui, monospace, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; } /* 字体替换:西里尔字母 */ @font-face { font-family: "Georgia"; src: local("Georgia"); } @font-face { font-family: "Times"; src: local("Georgia"); } @font-face { font-family: "Time New Roman"; src: local("Georgia"); } @font-face { font-family: "Arial"; src: local("Segoe UI"); } @font-face { font-family: "Helvetica"; src: local("Segoe UI"); } @font-face { font-family: "Helvetica Neue"; src: local("Segoe UI"); } @font-face { font-family: "Segoe UI"; src: local("Segoe UI"); } @font-face { font-family: "Tahoma"; src: local("Segoe UI"); } @font-face { font-family: "Trebuchet"; src: local("Segoe UI"); } @font-face { font-family: "Trebuchet MS"; src: local("Segoe UI"); } @font-face { font-family: "Verdana"; src: local("Segoe UI"); } @font-face { font-family: "Consolas"; src: local("Consolas"); } @font-face { font-family: "Courier"; src: local("Consolas"); } @font-face { font-family: "Courier New"; src: local("Consolas"); } /* 字体替换:中文 */ @font-face { font-family: "SimSun"; src: local("Microsoft YaHei"); } @font-face { font-family: "SimSun-ExtB"; src: local("Microsoft YaHei"); } @font-face { font-family: "宋体"; src: local("Microsoft YaHei"); } @font-face { font-family: "NSimSun"; src: local("Microsoft YaHei"); } @font-face { font-family: "新宋体"; src: local("Microsoft YaHei"); } @font-face { font-family: "SimHei"; src: local("Microsoft YaHei"); } @font-face { font-family: "黑体"; src: local("Microsoft YaHei"); } @font-face { font-family: "Microsoft YaHei UI"; src: local("Microsoft YaHei"); } @font-face { font-family: "Microsoft YaHei"; src: local("Microsoft YaHei"); } @font-face { font-family: "微软雅黑"; src: local("Microsoft YaHei"); } @font-face { font-family: "STHeiti SC"; src: local("Microsoft YaHei"); } @font-face { font-family: "PingFang SC"; src: local("Microsoft YaHei"); } @font-face { font-family: "苹方-简"; src: local("Microsoft YaHei"); } @font-face { font-family: "MingLiU"; src: local("Microsoft JhengHei"); } @font-face { font-family: "MingLiU-ExtB"; src: local("Microsoft JhengHei"); } @font-face { font-family: "PMingLiU"; src: local("Microsoft JhengHei"); } @font-face { font-family: "PMingLiU-ExtB"; src: local("Microsoft JhengHei"); } @font-face { font-family: "Microsoft JhengHei UI"; src: local("Microsoft JhengHei"); } @font-face { font-family: "Microsoft JhengHei"; src: local("Microsoft JhengHei"); } @font-face { font-family: "微軟正黑體"; src: local("Microsoft JhengHei"); } @font-face { font-family: "STHeiti TC"; src: local("Microsoft JhengHei"); } @font-face { font-family: "PingFang TC"; src: local("Microsoft JhengHei"); } @font-face { font-family: "蘋方-繁"; src: local("Microsoft JhengHei"); } @font-face { font-family: "MingLiU_HKSCS"; src: local("Microsoft JhengHei"); } @font-face { font-family: "MingLiU_HKSCS-ExtB"; src: local("Microsoft JhengHei"); } @font-face { font-family: "PingFang HK"; src: local("Microsoft JhengHei"); } @font-face { font-family: "蘋方-港"; src: local("Microsoft JhengHei"); } /* 字体替换:日文 */ @font-face { font-family: "MS Gothic"; src: local("Yu Gothic"); } @font-face { font-family: "MS PGothic"; src: local("Yu Gothic"); } @font-face { font-family: "MS UI Gothic"; src: local("Yu Gothic"); } @font-face { font-family: "Yu Gothic"; src: local("Yu Gothic"); } @font-face { font-family: "Yu Gothic UI"; src: local("Yu Gothic"); } /* 字体替换:朝鲜文 */ @font-face { font-family: "Malgun Gothic"; src: local("Malgun Gothic"); } /* 特定网站修正 */ `; if ((location.hostname === "baidu.com" || location.hostname.endsWith(".baidu.com"))) { css += ` * { font-family: "Microsoft YaHei", "HanHei SC", "方正兰亭黑_GB18030", "方正兰亭黑_GBK", -apple-system, BlinkMacSystemFont, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; } `; } if (new RegExp("^(?:https://www.baidu.com/#?)\$").test(location.href) || location.href.startsWith("https://www.baidu.com/?tn=")) { css += ` .s_ipt { font-family: "Microsoft YaHei", "HanHei SC", "方正兰亭黑_GB18030", "方正兰亭黑_GBK", -apple-system, BlinkMacSystemFont, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; } .s-treasure, .mnav[href^="http"]:not([href*="baidu.com"]), .qrcode-layer { display: none !important; } `; } if ((location.hostname === "github.com" || location.hostname.endsWith(".github.com"))) { css += ` .text-mono { font-family: "", "Microsoft YaHei", "HanHei SC", "方正兰亭黑_GB18030", "方正兰亭黑_GBK", -apple-system, BlinkMacSystemFont, system-ui, monospace, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji" !important; } .blob-num, .blob-code-inner { font-family: "", "Microsoft YaHei", "HanHei SC", "方正兰亭黑_GB18030", "方正兰亭黑_GBK", -apple-system, BlinkMacSystemFont, system-ui, monospace, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; } `; } if ((location.hostname === "ithome.com" || location.hostname.endsWith(".ithome.com"))) { css += ` .post_comment { font-family: "Microsoft YaHei", "HanHei SC", "方正兰亭黑_GB18030", "方正兰亭黑_GBK", -apple-system, BlinkMacSystemFont, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; } `; } if ((location.hostname === "jiemian.com" || location.hostname.endsWith(".jiemian.com"))) { css += ` .article-content { font-family: "Microsoft YaHei", "HanHei SC", "方正兰亭黑_GB18030", "方正兰亭黑_GBK", -apple-system, BlinkMacSystemFont, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji" !important; } #ad_header_top, .cnzz-ads, .jm-app { display: none !important; } `; } if ((location.hostname === "so.com" || location.hostname.endsWith(".so.com"))) { css += ` * { font-family: "Microsoft YaHei", "HanHei SC", "方正兰亭黑_GB18030", "方正兰亭黑_GBK", -apple-system, BlinkMacSystemFont, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; } #mohe-know_side_nlp-imagelist, #mohe-hot_hqr { display: none !important; } `; } if ((location.hostname === "sogou.com" || location.hostname.endsWith(".sogou.com"))) { css += ` * { font-family: "Microsoft YaHei", "HanHei SC", "方正兰亭黑_GB18030", "方正兰亭黑_GBK", -apple-system, BlinkMacSystemFont, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; } .nav-new, .bizr_rb, [id^="rightgameout"] { display: none !important; } `; } if ((location.hostname === "sspai.com" || location.hostname.endsWith(".sspai.com"))) { css += ` h1, h2, h3, h4, h5, h6, .title, .content, p, a { font-family: "Microsoft YaHei", "HanHei SC", "方正兰亭黑_GB18030", "方正兰亭黑_GBK", -apple-system, BlinkMacSystemFont, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji" !important; } `; } if ((location.hostname === "userstyles.org" || location.hostname.endsWith(".userstyles.org"))) { css += ` .ad, #top_android_button, .android_button_button, .android_button_banner, .walking { display: none !important; } `; } if (typeof GM_addStyle !== "undefined") { GM_addStyle(css); } else { const styleNode = document.createElement("style"); styleNode.appendChild(document.createTextNode(css)); (document.querySelector("head") || document.documentElement).appendChild(styleNode); } })();