您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Remove spaces
// ==UserScript== // @name Remove spaces from links in the clipboard // @version 0.1.0 // @description Remove spaces // @author dragonish // @namespace https://github.com/dragonish // @license GNU General Public License v3.0 or later // @match *://*/* // @grant none // ==/UserScript== (function () { document.addEventListener('paste', evt => { const clipboardData = evt.clipboardData; if (clipboardData) { const target = document.activeElement; if (target && (target.tagName === 'INPUT' || target?.tagName === 'TEXTAREA')) { let text = clipboardData.getData('text/plain'); if (text.startsWith('http:') || text.startsWith('https:') || text.startsWith('magnet:') || text.startsWith('ed2k:') || text.startsWith('torrent:') || text.startsWith('thunder:') || text.startsWith('thunderx:')) { evt.preventDefault(); text = text.replace(/\s+/g, ''); target.value = text; } } } }, true); })();