中英文空格排版

中英/数字混排的视觉留白(不改文本);跳过输入框、代码块和可编辑区域。

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

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

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

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

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

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

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         中英文空格排版
// @namespace    https://loongphy.com
// @author       Loongphy
// @version      0.2.1
// @description  中英/数字混排的视觉留白(不改文本);跳过输入框、代码块和可编辑区域。
// @license      PolyForm-Noncommercial-1.0.0; https://polyformproject.org/licenses/noncommercial/1.0.0/
// @match        *://*/*
// @run-at       document-start
// @grant        none
// ==/UserScript==

(() => {
    if (!(typeof CSS !== "undefined" && CSS.supports("text-autospace: normal")))
        return;
    const s = document.createElement("style");
    s.id = "cjk-latin-autospace-style";
    s.textContent = `
html { text-autospace: normal; }
@supports (text-autospace: ideograph-alpha ideograph-numeric) {
  html { text-autospace: ideograph-alpha ideograph-numeric; }
}
@supports (text-autospace: ideograph-alpha ideograph-numeric punctuation) {
  html { text-autospace: ideograph-alpha ideograph-numeric punctuation; }
}
@supports (text-autospace: ideograph-alpha ideograph-numeric punctuation replace) {
  html { text-autospace: ideograph-alpha ideograph-numeric punctuation replace; }
}
code, pre, kbd, samp {
  text-autospace: no-autospace;
}
`;
    (document.head || document.documentElement).appendChild(s);
})();