您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Hold Alt click on text, Copy as plain text. Alt + Shift click on text, Copy as kebab-case.
当前为
// ==UserScript== // @name Copy it // @name:zh-CN 便捷复制 // @namespace https://github.com/xianghongai/Tampermonkey-UserScript // @version 1.0.3 // @description Hold Alt click on text, Copy as plain text. Alt + Shift click on text, Copy as kebab-case. // @description:zh-CN 按住 Alt 键点击文本,复制为纯文本。Alt + Shift 复制为 kebab-case 风格字符。 // @author Nicholas Hsiang // @icon https://xinlu.ink/favicon.ico // @match http*://*/* // @grant GM_setClipboard // @license MIT // ==/UserScript== (function () { 'use strict'; document.addEventListener('click', listener, false); function listener(event) { if (event.altKey) { event.preventDefault(); event.stopPropagation(); const text = event.target.innerText; if (event.shiftKey) { copyTextToClipboard(toKebab(text)); return false; } copyTextToClipboard(text); return false; } } function toKebab(input) { if (typeof input === 'string') { return input .replace(/[\W\s]/gi, '-') .replace(/([a-z0-9])([A-Z])/g, '$1-$2') .replace(/([A-Z])([A-Z])(?=[a-z])/g, '$1-$2') .toLowerCase(); } } function copyTextToClipboard(text) { GM_setClipboard(text, 'text'); } })();