Noto Sans CJK Fonts Import

Make Noto Sans CJK Fonts Available to all Sites

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Noto Sans CJK Fonts Import
// @name:ja         Noto Sans CJK Fonts Import
// @namespace    http://tampermonkey.net/
// @version      0.3.1
// @description  Make Noto Sans CJK Fonts Available to all Sites
// @description:ja  すべてのサイトでNoto Sans CJK Fontsを利用できるため
// @author       You
// @match        https://*/*
// @icon         https://cdn-1.webcatalog.io/catalog/google-fonts/google-fonts-icon-filled.png
// @grant        none
// ==/UserScript==
-(function $$($$count) {
    'use strict';

    if (!document.documentElement) return window.requestAnimation(() => $$count ? $$($$count - 1) : 0);

    function addStyle(styleText) {
        const styleNode = document.createElement('style');
        styleNode.type = 'text/css';
        styleNode.textContent = styleText;
        document.documentElement.appendChild(styleNode);
        return styleNode;
    }

    let r = [
        'family=Noto+Sans:wght@300;400;500;600;700',
        'family=Noto+Sans+HK:wght@300;400;500;600;700',
        'family=Noto+Sans+TC:wght@300;400;500;600;700',
        'family=Noto+Sans+SC:wght@300;400;500;600;700',
        'family=Noto+Sans+JP:wght@300;400;500;600;700',
        'family=Noto+Sans+KR:wght@300;400;500;600;700',
        'display=swap'
    ];

    let url = 'https://fonts.googleapis.com/css2?' + r.join('&');

    addStyle(`@import url('${url}');`);

})(4);