您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Copy text of any link by simply dragging it.
当前为
- // ==UserScript==
- // @name Drag Link to Copy Text
- // @name:zh 拖动链接以复制文本
- // @name:fr Faites glisser le lien pour copier du texte
- // @name:de Ziehen Sie den Link zum Kopieren von Text
- // @name:ru Перетащите ссылку, чтобы скопировать текст
- // @name:es Arrastre el enlace para copiar texto
- // @description Copy text of any link by simply dragging it.
- // @description:zh 只需拖动即可复制任何链接的文本。
- // @description:fr Copiez le texte de n'importe quel lien en le faisant simplement glisser.
- // @description:de Kopieren Sie den Text eines Links, indem Sie ihn einfach ziehen.
- // @description:ru Скопируйте текст любой ссылки, просто перетащив ее.
- // @description:es Copia el texto de cualquier enlace simplemente arrastrándolo.
- // @namespace iamMG
- // @license MIT
- // @version 1.0
- // @icon https://i.imgur.com/43qD1oK.png
- // @match http*://*/*
- // @author iamMG
- // @run-at document-end
- // @grant GM_setClipboard
- // @copyright 2019, iamMG (https://openuserjs.org/users/iamMG)
- // ==/UserScript==
- (function() {
- 'use strict';
- var links = document.getElementsByTagName("a");
- function copier(txt){
- return function(){
- var temp = document.createElement("textarea");
- document.body.appendChild(temp);
- temp.innerText = txt;
- temp.select();
- document.execCommand('copy');
- temp.parentElement.removeChild(temp);
- }
- }
- for (var i=0; i<links.length;i++ ){
- var txt = links[i].innerText;
- if (txt) {links[i].addEventListener('dragend', copier(txt),false);}
- }
- })();