Ghost Trapper Livefeed Clicker

Clicks and Refreshes the Live Feed

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Ghost Trapper Livefeed Clicker
// @namespace   Hazado
// @description Clicks and Refreshes the Live Feed
// @include     *www.ghost-trappers.com/fb/live_feed.php*
// @version     1.0
// ==/UserScript==

function selectNodes(xPath,params){
	params=(params||{});
	return (params['doc']||document).evaluate(xPath,(params['node']||document),null,(params['type']||6),null);
}

//short form for evaluate with single node return
function selectSingleNode(xPath,params){
	params=params||{}; params['type']=9;
	return selectNodes(xPath,params).singleNodeValue;
}

function click(e) {
	if(!e && typeof e=='string') e=document.getElementById(e);
	if(!e) return;
	var evObj = e.ownerDocument.createEvent('MouseEvents');
	evObj.initMouseEvent("click",true,true,e.ownerDocument.defaultView,0,0,0,0,0,false,false,false,false,0,null);
	e.dispatchEvent(evObj);
	evObj=null;
}

noclick = false;
function checkforfeed() {
	if (noclick === false) {
		var link = document.getElementById('updateButton');
		var test = document.getElementById('updateText');
		document.title = "GT Live Feed - "+test.title.match(/[0-9]* s/)+" until refresh";
		if (test === null) window.setTimeout(function () {window.location.href = "http://www.ghost-trappers.com/fb/live_feed.php"}, 300000);
		else if (test.title == 'You can update the live feed in 0 seconds.') 
		{
			noclick = true;
			window.setTimeout(function () {click(link.children[0])},1000);
		}
	}
}

function clickfeed() {
	var link = selectSingleNode(".//div[contains(@id,'showMonsterContainer') and not(contains(@title,'processed'))]");
	if (link !== null) 
	{
		link.setAttribute("title","processed");
		click(link.children[0]);
		window.setTimeout(clickfeed,(Math.round((Math.random() * 1)) + 1) * 1000);
	}
}

if (document.body.innerHTML.match(/doing maintenance and will be back in a few minutes/)) window.setTimeout(function () {window.location.href = "http://www.ghost-trappers.com/fb/live_feed.php"}, 300000);
else 
{
	window.setInterval(checkforfeed,1000);
	window.setTimeout(clickfeed,(Math.round((Math.random() * 1)) + 1) * 1000);
}