您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
在种子列表页中,过滤官种和保种中的种子,新增一列快速认领
当前为
// ==UserScript== // @name 种子列表过滤与认领 // @namespace https://greasyfork.org/zh-CN/scripts/ // @version 0.2 // @license GPL-3.0 License // @description 在种子列表页中,过滤官种和保种中的种子,新增一列快速认领 // @author ccf2012 // @icon https://pterclub.com/favicon.ico // @grant GM_setClipboard // @grant GM_xmlhttpRequest // @require https://code.jquery.com/jquery-3.6.0.min.js // @match https://pterclub.com/torrents.php* // @match https://pterclub.com/officialgroup* // ==/UserScript== var config = [ { host: "pterclub.com", eleTorTable: "#torrenttable", eleCurPage: "#outer > table > tbody > tr > td > p:nth-child(4) > font", eleTorList: "#torrenttable > tbody > tr", eleTorItem: "td:nth-child(2) > table > tbody > tr > td:nth-child(2) > div > div:nth-child(1) > a", eleTorItemSize: "td:nth-child(5)", eleTorItemSeednum: "td:nth-child(6)", eleTorItemAdded: "td:nth-child(4) > span", useTitleName: true, eleSeeding: "img.progbargreen", eleIntnTag: "a.chs_tag-gf", eleDownLink: "td:nth-child(2) > table > tbody > tr > td:nth-child(5) > a", eleCatImg: "td:nth-child(1) > a:nth-child(1) > img", }, ] var THISCONFIG = config.find((cc) => window.location.host.includes(cc.host)); function addFilterPanel() { var torTable = $("#torrenttable"); var donwnloadPanel = ` <table align='center'> <tr> <td style='width: 140px; border: none;'> <input type="checkbox" id="seeding" name="seeding" value="uncheck"><label for="seeding">只显示自己作种 </label> </td> <td style='width: 140px; border: none;'> <input type="checkbox" id="intn_tor" name="intn_tor" value="uncheck"><label for="intn_tor">只显示官种 </label> </td> <td style='width: 140px; border: none;'> <button type="button" id="btn-filterlist" style="margin-top: 5px;margin-bottom: 5px;margin-left: 5px;padding: 5px 10px;"> 过滤当前页 </button> </td> <td style='width: 200px; border: none;'> <button type="button" id="btn-downloadfiltered" style="margin-top: 5px;margin-bottom: 5px;margin-left: 5px;padding: 5px 10px;"> 拷贝过滤后的下载链接 </button> </td> <td style='width: 200px; border: none;'> <div id="process-log" style="margin-left: 5px;padding: 5px 10px;"></div> </td> </tr> </table> ` torTable.before(donwnloadPanel); } var onClickFilterList = (html) => { $("#process-log").text("处理中..."); let torlist = $(html).find(THISCONFIG.eleTorList); for (let index = 1; index < torlist.length; ++index) { let element = torlist[index]; let intnTag = $(torlist[index]).find(THISCONFIG.eleIntnTag).length > 0; var barGreen = torlist[index].querySelector(THISCONFIG.eleSeeding); // debugger; $(element).show() if ($("#intn_tor").is(":checked") && !intnTag) { $(element).hide() } if ($("#seeding").is(":checked") && !barGreen) { $(element).hide() } } $("#process-log").text("完成..."); }; function onClickDownloadFiltered(html) { $("#process-log").text('处理中...') let torlist = $(html).find(THISCONFIG.eleTorList); var resulttext = ''; for (let index = 1; index < torlist.length; ++index) { if ($(torlist[index]).is(":visible")) { var hrefele = torlist[index].querySelector(THISCONFIG.eleDownLink) if (hrefele) { resulttext += hrefele.href + '\n' } } } GM_setClipboard(resulttext, 'text'); $("#process-log").text('下载链接 已拷贝在剪贴板中'); } function addAdoptColumn(html) { // const torTable = $(THISCONFIG.eleTorTable); const idregex = /id=(\d+)/; var torlist = $(html).find(THISCONFIG.eleTorList); for (let index = 0; index < torlist.length; ++index) { let element = torlist[index]; let item = $(element).find(THISCONFIG.eleTorItem); let href = item.attr("href"); if (href) { let torid = href.match(idregex); if (torid) { let sizeele = $(element).find(THISCONFIG.eleTorItemSize); $(element).append('<td ><a href=/viewclaims.php?add_torrent_id=' + torid[1] + '> 认领</a></td>'); } } else { $(element).append('<td class="colhead"> 认领种子 </td>'); } } } (function () { "use strict"; if (THISCONFIG) { addAdoptColumn(document); addFilterPanel(); $("#btn-filterlist").click(function () { onClickFilterList(document); }); $("#btn-downloadfiltered").click(function () { onClickDownloadFiltered(document); }); } })();