Noto Sans CJK Fonts Import

Make Noto Sans CJK Fonts Available to all Sites

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);