TJUPT Helper

TJUPT 辅种工具

当前为 2022-05-30 提交的版本,查看 最新版本

// ==UserScript==
// @name         TJUPT Helper
// @namespace    https://gf.qytechs.cn/scripts/445739
// @version      1.0
// @description  TJUPT 辅种工具
// @author       xqm32
// @match        https://tjupt.org/userdetails.php?id=*
// @icon         none
// @grant        none
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js
// @require      https://cdn.jsdelivr.net/npm/[email protected]/dist/clipboard.min.js
// @license      MIT
// ==/UserScript==

(function () {
    let getUserID = function () {
        let url = new URL(window.location.href)
        return url.searchParams.get("id")
    }

    let getTorrentList = async function (e, t, n) {
        const i = $(`#${n}`);
        console.log("getTorrentList")
        $("#th-msg").text(`获取中`)
        klappe_news(n.substr(1)),
            "加载中..." === i.html() && await $.get("getusertorrentlistajax.php", {
                userid: e,
                type: t
            }, (e => {
                i.html(e)
            }
            ))
    }

    let showTorrentList = function (n) {
        $(`#${n} > table > tbody > tr:nth-child(1)`).append(`<td class="colhead" align="center">种子 ID</td>`)
        let trs = $(`#${n} > table > tbody > tr`);
        $("#th-msg").text(`获取了 ${trs.length - 1} 条记录`)
        for (let i = 1; i < trs.length; ++i) {
            let href = $(trs[i]).find(`td[class="rowfollow"] > a`).attr("href");
            let url = new URL(window.location.origin + "/" + href);
            let id = url.searchParams.get("id");
            $(trs[i]).append(`<td class="rowfollow" align="center">${id}</td>`);
            $("#th-torrentList").append(
                `https://www.tjupt.org/download.php?id=${id}&passkey=YOUR_PASSKEY\n`
            );
        }
    }

    $("#outer > table > tbody > tr > td > h2").after(
        `<button id="th-seeding">获取做种中种子</button>` +
        `<button id="th-completed">获取已完成种子</button>` +
        `<button class="th-btn" data-clipboard-target="#th-torrentList">复制</button>` +
        `<span id="th-msg"></span>` +
        `<br/>` +
        `<textarea id="th-torrentList" rows="5" style="width: 320px; height: 80px;"></textarea>`
    )

    $("#th-seeding").click(() => getTorrentList(getUserID(), "seeding", "ka1").then(() => showTorrentList("ka1")))
    $("#th-completed").click(() => getTorrentList(getUserID(), "completed", "ka3").then(() => showTorrentList("ka3")))

    new ClipboardJS(".th-btn");
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址