Greasy Fork is available in English.

强制使用字体 - 核心

所有 强制使用字体 脚本的核心脚本

此脚本不应被直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.greasyfork.org/scripts/29500/671679/%E5%BC%BA%E5%88%B6%E4%BD%BF%E7%94%A8%E5%AD%97%E4%BD%93%20-%20%E6%A0%B8%E5%BF%83.js

// ==UserScript==
// @name         强制使用字体 - 核心
// @namespace    http://tampermonkey.net/
// @version      1.8
// @description  所有 强制使用字体 脚本的核心脚本
// @author       BackRunner
// @include      *
// @grant        unsafeWindow
// @license      MIT
// ==/UserScript==
function changeFont(s_font,mode){
	if (s_font !==  ""){
		
		switch(mode){
			case 0:
				var element = document.createElement("link");
				element.rel="stylesheet";
				element.type="text/css";
				element.href='data:text/css,*:not([class*="icon"]):not([class*="fa"]):not([class*="logo"]):not([class*="mi"]):not([class*="hwic"]):not([class*="code"]):not(i){font-family:' + s_font + ',Arial,"Material Icons Extended",stonefont,iknow-qb_share_icons,review-iconfont,mui-act-font,fontAwesome,tm-detail-font,office365icons,MWF-MDL2,global-iconfont,"Bowtie",myfont,sans-serif !important;}';
				document.documentElement.appendChild(element);
				break;
			case 1:
				setTimeout(function(){
					var modStyle = document.querySelector('#modCSS_font');
					if (modStyle === null)
					{
						modStyle = document.createElement('style');
						modStyle.id = 'modCSS_font';
						document.body.appendChild(modStyle);
					}   
					modStyle.innerHTML = '*:not([class*="icon"]):not([class*="fa"]):not([class*="logo"]):not([class*="mi"]):not([class*="hwic"]):not([class*="code"]):not(i){font-family:' + s_font + ',Arial,"Material Icons Extended",stonefont,iknow-qb_share_icons,review-iconfont,mui-act-font,fontAwesome,tm-detail-font,office365icons,MWF-MDL2,global-iconfont,"Bowtie",myfont,sans-serif !important;}';
				},300);
				break;
			case 2:
				var element = document.createElement("link");
				element.rel="stylesheet";
				element.type="text/css";
				element.href='data:text/css,*:not([class*="icon"]):not([class*="fa"]):not([class*="logo"]):not([class*="mi"]):not([class*="hwic"]):not([class*="code"]):not(i){font-family:' + s_font + ',Arial,"Material Icons Extended",stonefont,iknow-qb_share_icons,review-iconfont,mui-act-font,fontAwesome,tm-detail-font,office365icons,MWF-MDL2,global-iconfont,"Bowtie",myfont,sans-serif !important;}';
				document.documentElement.appendChild(element);
				setTimeout(function(){
					var modStyle = document.querySelector('#modCSS_font');
					if (modStyle === null)
					{
						modStyle = document.createElement('style');
						modStyle.id = 'modCSS_font';
						document.body.appendChild(modStyle);
					}   
					modStyle.innerHTML = '*:not([class*="icon"]):not([class*="fa"]):not([class*="logo"]):not([class*="mi"]):not([class*="code"]):not(i){font-family:' + s_font + ',Arial,"Material Icons Extended",stonefont,iknow-qb_share_icons,review-iconfont,mui-act-font,fontAwesome,tm-detail-font,office365icons,MWF-MDL2,global-iconfont,"Bowtie",myfont !important;}';
				},300);
				break;
			case 3:
				var element = document.createElement("link");
				element.rel="stylesheet";
				element.type="text/css";
				element.href='data:text/css,*:not(i):not([class*="icon"]):not([class*="fa"]):not([class*="logo"]):not([class*="mi"]):not([class*="code"]){font-family:' + s_font + ',Arial,"Material Icons Extended";}';
				document.documentElement.appendChild(element);
				setTimeout(function(){
					var modStyle = document.querySelector('#modCSS_font');
					if (modStyle === null)
					{
						modStyle = document.createElement('style');
						modStyle.id = 'modCSS_font';
						document.body.appendChild(modStyle);
					}   
					modStyle.innerHTML = '*:not(i):not([class*="icon"]):not([class*="fa"]):not([class*="logo"]):not([class*="mi"]):not([class*="code"]){font-family:' + s_font + ',"Material Icons Extended",Arial,"Material Icons Extended";}';
				},300);
				break;
		}
	}
}