网站字体统一使用微软雅黑

统一浏览器字体:所有网站使用微软雅黑,防止技术文档使用特殊字体库,无法正常浏览!

目前為 2022-09-10 提交的版本,檢視 最新版本

// ==UserScript==
// @name         网站字体统一使用微软雅黑
// @namespace    blak-kong
// @version      0.1
// @description  统一浏览器字体:所有网站使用微软雅黑,防止技术文档使用特殊字体库,无法正常浏览!
// @author       blak-kong
// @icon         https://www.google.com/s2/favicons?sz=64&domain=web3doc.top
// @grant        GM_addStyle
// @match        *
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    GM_addStyle("*{ font-family: '微软雅黑' !important; }")
    /*
    * 这里使用油猴提供的API,document操作的源代码留着,防止忘记dom操作
    window.onload = function () {
        function createStyleCss(){
            // 1.新建style标签
            var el=document.createElement("style");

            // 2.新建标签文本内容
            var elText=document.createTextNode("*{ font-family: '微软雅黑' !important; }");

            // 3.新建attr属性
            var elType = document.createAttribute("type");
            elType.value = "text/css";

            // 4.style设置attr属性与文本
            el.setAttributeNode(elType);
            el.appendChild(elText);
            document.body.appendChild(el);
        };
        createStyleCss()
    }
    */
})();