wkgo download seeds

增加页面顶部底部按钮和一键下种按钮

Versão de: 22/09/2024. Veja: a última versão.

// ==UserScript==
// @name         wkgo download seeds
// @namespace    websiteEnhancement
// @author   You
// @version      2024.9.3
// @description  增加页面顶部底部按钮和一键下种按钮
// @create         2023-9-21
// @include        *wkgo*
// @grant         GM_getValue
// @grant         GM_setValue
// @grant         GM.getValue
// @grant         GM.setValue
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @license MIT
// @run-at document-end
// ==/UserScript==
;
(async function (loadJS) {
    Array.prototype.push = function (...items) {
        let len = this.length >>> 0;
        let argCount = items.length >>> 0;
        if (len + argCount > 2 ** 53 - 1) {
            throw new TypeError("Invalid array length");
        }
        for (let i = 0; i < argCount; i++) {
            this[len + i] = items[i];
        }
        this.length = len + argCount;
        return this.length;
    };
    ["https://cdn.jsdelivr.net/gh/sodiray/radash@master/cdn/radash.min.js",
     "https://update.greasyfork.org/scripts/483173/1301961/GM_config_cnjames.js",
     "https://update.sleazyfork.org/scripts/476583/common_libs_of_array.js"
    ].reduce((p, url) => { return p.then(() => loadJS(url)) }, Promise.resolve())
        .then(v => {
        withJQuery(function ($, win) {

            win.funcDownload = function () {
                $("a:contains(.torrent)").each((i, element) => {

                    let url = $(element).attr('href');
                    let filename = $(element).text().trim();
                    if (filename.indexOf('torrent') == -1)
                        return true;
                    console.log("download file name:", $(element).text())
                    createSuperLabel(url, url, filename, win)
                });
            }
            win.funcList = function () { }
            win.funcDetail = function () { }
            const reg = /(\d{6,})/
            win.__compareKey = function (cache, curr) {
                if (cache === curr)
                    return true
                ///thread-6638382-
                let result=reg.exec(cache)
                if (result&& result.length>1)
                    return result[1] === curr
                return false
            }
            win.fixValue = function (value) {
                let result=reg.exec(value)
                if (result&& result.length>1)
                    return result[1]
                return value
            }
            $('table a').removeAttr('style')

            autoFind(() => /wkgo.xyz\/forum[-\d]*.html/.test(win.location.href) || /wkgo.xyz\/forum.php\?mod=forumdisplay/.test(win.location.href), 'wkgo', 'a.s.xst', el => el.text(), $, {}, win, funcDownload, funcList, funcDetail);

        })
    })


})(function (FILE_URL, async = true) {
    return new Promise((resolve, reject) => {
        let scriptEle = document.createElement("script");
        scriptEle.setAttribute("src", FILE_URL);
        scriptEle.setAttribute("type", "text/javascript");
        scriptEle.setAttribute("async", async);
        // success event
        scriptEle.addEventListener("load", () => {
            resolve(FILE_URL)
        });
        // error event
        scriptEle.addEventListener("error", (ev) => {
            reject(ev);
        });
        if (document.currentScript)
            document.currentScript.insertBefore(scriptEle)
        else
            (document.head || document.getElementsByTagName('head')[0]).appendChild(scriptEle);
    })
});