Ghost Trapper Livefeed Clicker

Clicks and Refreshes the Live Feed

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==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);
}