18P2P_autothanks

18P2P自动感谢

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name           18P2P_autothanks
// @description    18P2P自动感谢
// @include        http://111.92.236.50/*
// @include        http://18p2p.com/*
// @include        http://*.18p2p.com/*
// @author         congxz6688
// @version        2015.8.13.0
// @namespace https://greasyfork.org/scripts/165
// ==/UserScript==

if(window.location.href.indexOf("forumdisplay.php")!=-1){
	var fid=window.location.href.split("fid=")[1].match(/\d+/)[0];
	function playthanks(e){
		theAnchor=e.target;
		var formhash=document.querySelector('[name="formhash"]').value;
		var wwe=theAnchor.href;
		var tid=wwe.split("tid=")[1].match(/\d+/)[0];
		var urll=wwe.match(/htt.*?(?=(viewthread|redirect))/)[0] + "thankyou.php?fid=" + fid +"&tid="+tid+ "&thankyousubmit=1&formhash="+formhash+"&reason=Thanks";
		GM_xmlhttpRequest({
			method: 'POST',
			synchronous:true,
			url: urll,
			onload: function(){
				GM_log("自动感谢 ok!");
				window.location=wwe;
			}
		})
	}
	var allTabLink=document.querySelectorAll('[href*="viewthread.php"],[href*="redirect.php"]');
	for (sd=0;sd<allTabLink.length;sd++){
		allTabLink[sd].addEventListener("click",playthanks,false);
		allTabLink[sd].innerHTML = allTabLink[sd].innerHTML.replace(/<.*?>/g,"")
	}
}