您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Userscript to use Local JP Serif font on all websites in Android browser for Android 9+.
当前为
- // ==UserScript==
- // @name Font substitution: Noto Serif CJK JP using local fonts for Android9+
- // @name:ja フォント置換:Noto Serif CJK JP Android9以降搭載のローカルフォント
- // @namespace https://greasyfork.org/ja/users/747568-yomosu
- // @description Userscript to use Local JP Serif font on all websites in Android browser for Android 9+.
- // @description:ja ウェブページでローカルの日本語明朝体フォントを使うユーザースクリプト。Android 9以降用。
- // @version 0.1.20220611.2
- // @license CC0-1.0
- // @include http://*
- // @include https://*
- // @match *://*/*
- // @grant none
- // ==/UserScript==
- (function() {
- 'use strict';
- const setSerifFont = () => {
- const newFontFamilyName = 'Noto Serif CJK JP';
- // const oldFontFamilyNames = [
- // "Roboto",
- // "Google Sans",
- // "Droid Sans",
- // "MotoyaLMaru",
- // "MotoyaLCedar",
- // "Noto Sans JP",
- // "Noto Sans CJK JP",
- // "SEC CJK JP",
- // "Droid Sans Japanese"
- // ]
- const font = new FontFace(newFontFamilyName, `local(${newFontFamilyName})`);
- font.load().then(() => {document.fonts.add(font)});
- const myHead = document.getElementsByTagName('head')[0];
- const myCss = document.createElement('style');
- myCss.id = 'set_serif_font_style';
- myCss.insertAdjacentHTML('beforeend', `
- @font-face {font-family: ${newFontFamilyName}; src: local(${newFontFamilyName});}
- @font-face {font-family: "Roboto"; src: local(${newFontFamilyName});}
- @font-face {font-family: "Google Sans"; src: local(${newFontFamilyName});}
- @font-face {font-family: "Droid Sans"; src: local(${newFontFamilyName});}
- @font-face {font-family: "MotoyaLMaru"; src: local(${newFontFamilyName});}
- @font-face {font-family: "MotoyaLCedar"; src: local(${newFontFamilyName});}
- @font-face {font-family: "Noto Sans JP"; src: local(${newFontFamilyName});}
- @font-face {font-family: "Noto Sans CJK JP"; src: local(${newFontFamilyName});}
- @font-face {font-family: "SEC CJK JP"; src: local(${newFontFamilyName});}
- @font-face {font-family: "Droid Sans Japanese"; src: local(${newFontFamilyName});}
- *:not(pre):not(span):not(code):not(samp){font-family:'USERFONT-${newFontFamilyName}', Charis SIL Compact, Noto Serif CJK JP, Noto Serif, Droid Serif, serif;}
- `);
- myHead.appendChild(myCss);
- };
- if (document.readyState === "loading") {
- document.addEventListener("DOMContentLoaded", setSerifFont);
- } else {
- setSerifFont();
- }
- })();