Digit77 Helper

Digit77下载助手。自动复制提取码,跳过ouo.io的三秒等待时间!

当前为 2022-06-03 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Digit77 Helper
// @namespace    cn.XYZliang.digit77Helper
// @version      1.0
// @description  Digit77下载助手。自动复制提取码,跳过ouo.io的三秒等待时间!
// @require      https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.min.js
// @license      GNU General Public License v3.0
// @author       XYZliang
// @match        https://www.digit77.com/*
// @match        http://www.digit77.com/*
// @match        https://ouo.press/*
// @match        http://ouo.press/*
// @match        https://ouo.io/*
// @match        http://ouo.io/*
// @icon         https://www.digit77.com/lib/img/logo.svg
// @grant        unsafeWindow
// @grant        GM_setClipboard
// @run-at       document-end
// ==/UserScript==
/* globals jQuery, $ */

// 用户设置
// 设置选项 1为开启 0为关闭
var seeting = {
    //是否自动复制下载页面的提取码
    automaticCopyingExtractedCode: 1
        //是否ouo.io的三秒等待时间
    ,skipWaitingTime: 1
}


// 脚本代码
'use strict';
let url = location.host;
if (url == "www.digit77.com" && seeting.automaticCopyingExtractedCode == 1) {
    $("#history_version a").each(function () {
        $("#history_version th")[2].innerText="下载链接(已开启Digit77 Helper自动复制提取码)"
        let codeText = this.innerText;
        let code = codeText.split(" ")[1]
        if (code != undefined) {
            this.addEventListener('click', function () {
                let text = code;
                let copyButton = document.createElement('button')
                copyButton.setAttribute("id", "copy")
                copyButton.setAttribute("class", "btn")
                copyButton.setAttribute("data-clipboard-text", text)
                copyButton.innerText = "已复制提取码"+code
                this.parentNode.appendChild(copyButton)
                let clipboard = new ClipboardJS('.btn');
                clipboard.on('success', function (e) {
                    console.info('Action:', e.action);
                    console.info('Text:', e.text);
                    console.info("提取码"+text+"复制成功");
                    e.clearSelection();
                });
                clipboard.on('error', function (e) {
                    console.error('Action:', e.action);
                    console.error('Trigger:', e.trigger);
                    console.error("提取码"+text+"复制失败");
                });
                $("#copy").click()
                this.parentNode.removeChild(copyButton)
            });
        }
    })
}
else if(url.indexOf("ouo")!=-1 && seeting.skipWaitingTime == 1){
    console.log("正在跳过ouo")
    $("h4").innerText="Digit77 Help正在跳过等待!"
    $(".btn-main").innerText="欢迎使用Digit77 Helper"
    $(".btn-main").click()
}