一键认领,支持猫站、观众
当前为
// ==UserScript==
// @name 猫站一键认领
// @namespace http://tampermonkey.net/
// @version 1.2
// @description 一键认领,支持猫站、观众
// @license MIT
// @author AisukaYuki
// @match https://pterclub.com/userdetails.php*
// @match https://pterclub.com/getusertorrentlist.php*
// @match https://audiences.me/userdetails.php*
// @require https://greasyfork.org/scripts/453166-jquery/code/jquery.js?version=1105525
// @icon https://www.google.com/s2/favicons?sz=64&domain=pterclub.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
/* globals jQuery, $, waitForKeyElements */
var claim_btn = $('<input>', {
id: 'claim_btn_act',
type: 'button',
value: '一键认领',
style: 'margin-Left:5px'
});
var currentURL = window.location.href;
if (currentURL.includes('userdetails')) {
$('#ka1').before(claim_btn);
} else if (currentURL.includes('getusertorrentlist')) {
$('#outer p:first').after(claim_btn);
} else {
console.log('找不到元素');
}
function act_CAT() {
var list = $('.claim-confirm');
list.each(function() {
var url = 'https://pterclub.com/' + $(this).data('url');
$.get(url);
});
}
function act_AUD() {
var list = $("span a:contains(认领种子)");
list.each(function() {
var url = 'https://audiences.me/claim.php?act=add&tid=' + $(this).attr('href').match(/(?:^|,)'([^']*)'/)[1];
$.get(url);
});
}
function act() {
if (currentURL.includes("pterclub.com")) {
act_CAT();
} else if (currentURL.includes("audiences.me")) {
act_AUD();
} else {
console.log("暂不支持该站。");
}
}
claim_btn.on('click',
function() {
var ka1 = $('#ka1').css('display');
if (ka1 === 'none') {
alert('请先展开做种列表。');
} else {
alert('开始执行,F12打开控制台,查看网络日志,等待响应完毕。');
act();
alert('完成');
location.reload();
}
});
})();