Greasy Fork

来自缓存

Greasy Fork is available in English.

Bt磁力电驴迅雷双击复制

识别任意BT网站的磁力链接、电驴链接、迅雷下载链接,双击当前页面即可快速复制[hahacium(GitHub)]

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Bt磁力电驴迅雷双击复制
// @namespace    https://github.com/hahacium
// @version      0.5.1
// @description  识别任意BT网站的磁力链接、电驴链接、迅雷下载链接,双击当前页面即可快速复制[hahacium(GitHub)]
// @author       hahacium(GitHub)
// @include      *
// ==/UserScript==

(function() {
     'use strict';
      var cli=document.getElementsByTagName("a");
      var urlmag=/^magnet:\?xt=urn:btih:.*$/;
      var urled2k=/^ed2k:.*$/;
      var urlthunder=/^thunder:.*$/;
      var dbclick=function (){
        for(var i=0;i<cli.length;i++){
            var ok=cli[i].getAttribute("href");
            if(urlmag.test(ok)||urled2k.test(ok)||urlthunder.test(ok))
            {
                var input = document.createElement('input');
                input.setAttribute('value', ok);
                document.body.appendChild(input);
                input.select();
                if (document.execCommand("copy")) {
                    document.execCommand("copy");
                }
                input.style.cssText="display: none;";
                var div = document.createElement('div');
                div.style.cssText="width:0px;height:40px;color:#fff;background-color:#12709e;font-size:17px;text-align:center;transition:width .2s,height .2s,transform .2s;border-radius:5px;position:fixed;top:20%;right:0;display:flex;justify-content:center;align-items:center;";
                div.innerHTML='<span style="height:60%;overflow:hidden">复制成功</span>';
                document.body.appendChild(div);
                setTimeout( function(){
                    div.style.cssText+="width: 120px;";
                }, 10 );
                setTimeout( function(){
                    div.style.cssText+="width: 0px;";
                }, 1000 );
                break;
            }
        }
     }
    document.ondblclick=dbclick;
})();