您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
修复 Google 翻译导致段落合并的问题
当前为
// ==UserScript== // @name COC2 翻译分段修复 // @namespace http://tampermonkey.net/ // @version 2024-10-10 // @description 修复 Google 翻译导致段落合并的问题 // @author LinHQ // @match *://*/* // @run-at context-menu // @license AGPL-v3 // ==/UserScript== (function () { 'use strict'; new MutationObserver((li, ob) => { try { li.forEach((mu) => { if (mu.type !== 'childList') return const nodes = mu.addedNodes nodes.forEach(node => { // 翻译会为 br 处理换行 let t if (node.nodeType === 3) { t = node.parentNode } else if (node?.querySelector('.mainText')) { t = node?.querySelector('.mainText') } if (!t?.matches('.mainText')) return ob.disconnect() t.innerHTML = t.innerHTML?.replaceAll('\n', '<br>') ?? t.innerHTML ob.observe(document, { subtree: true, childList: true }) }) }) } catch (e) { console.warn('Script Error!', e) } }).observe(document, { subtree: true, childList: true }) })();