一键认领

一键认领,支持猫站、观众

目前為 2024-06-12 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         一键认领
// @namespace    http://tampermonkey.net/
// @version      1.2.2
// @description  一键认领,支持猫站、观众
// @license      MIT
// @author       AisukaYuki
// @match        https://pterclub.com/userdetails.php*
// @match        https://pterclub.com/getusertorrentlist.php*
// @match        https://audiences.me/usertorrentlist.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('torrentlist')) {
		$('#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');
            console.log(url);
			$.get(url);
		});
	}

	function act_AUD() {
		var list = $("span:contains(认领种子)");
		list.each(function() {
            console.log($(this).attr('id'));
			var url = 'https://audiences.me/claim.php?act=add&tid=' + $(this).attr('id').match(/(\d+)/)[0];
            console.log(url);
			$.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();
		}
	});
})();