您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
移除谷歌翻译框中的换行符,尤其适用于PDF复制文字
// ==UserScript== // @name 翻译移除换行符 // @namespace https://github.com/yzx9/ // @version 0.0.5 // @description 移除谷歌翻译框中的换行符,尤其适用于PDF复制文字 // @author [email protected] // @match https://translate.google.cn/* // @match https://translate.google.com/* // @license MIT // @grant none // ==/UserScript== (function() { 'use strict'; const validLineReg = [/^\s*$/, /\.\s*$/, /。\s*$/] const removeNewline = text => text .split('\n') .reduce((arr, val) => { arr[arr.length-1] += val + ' ' if (validLineReg.some(r => r.test(val))) arr.push('') return arr }, ['']) .join('\n') const listener = () => { const state = window.location.search .substring(1) .split("&") .map(a => a.split('=')) .reduce((q, [k, ...v]) => ({ ...q, [k]: v.join('=') }), {}) if (!state.text) return const text = removeNewline(decodeURIComponent(state.text)) if (text === state.text) return const newState = { ...state, text } const query = Reflect.ownKeys(newState) .map(k => [k, encodeURIComponent(newState[k])]) .map(([k, v]) => `${k}=${v}`) .join('&') const href = window.location.href.split('?')[0] window.location.href = `${href}?${query}` } window.addEventListener('paste', () => setTimeout(listener, 5)); })();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址