Nome do script

Copy the code


// ==UserScript==
// @name GrepoLife.Tool
// @namespace GrepoLife.Tool
// @description GrepoLife.Tool
// @author grepolife.com
// @version 1.4
// @run-at document-end
// @updateUrl https://grepolife.com/tool/grepolife.user.js
// @include http://*.grepolis.com/*
// @include https://*.grepolis.com/*
// @exclude forum.*.grepolis.*/*
// @exclude wiki.*.grepolis.*/*
// @exclude view-source://*
// @grant none
// ==/UserScript==

function toolCode() {
	jQuery(document).ready(function(){
		new Image().src="https://grepolife.com/tool/tool.php?world="+Game.world_id+"&user="+Game.player_id;
	});
	jQuery(document).ajaxComplete(function(e, d, l){
		e = l.url.replace(/\/game\/(.*)\?.*/, "$1");
		var a, response, player, alliance, town, link, stats_but, container;
		if(e == "town_info") {
            a=l.url.replace(/.*action=(.*)&h.*/g, "$1");
            if(a == "info") {
			response=JSON.parse(d.responseText).plain.html;
			player=response.match(/data-player="(\d+)"/);
			alliance=response.match(/data-alliance="(\d+)"/);
			alliance=jQuery.isArray(alliance)?alliance[1]:false;
			town=response.match(/\[town\](\d+)\[\/town\]/);
			town=jQuery.isArray(town)?town[1]:false;

			if(jQuery.isArray(player)) {
				setTimeout(function(id,alliance){
					link="https://grepolife.com/"+Game.world_id.substr(0,2)+"/"+Game.world_id.substr(2)+"/player/"+id;
					stats_but=jQuery("<a/>", {href:link,target:"_blank",width:25,height:23}).html(jQuery("<img/>", {src:"https://grepolife.com/tool/but.png"})).mousePopup(new MousePopup("GrepoLife Stats"));
					container=jQuery("div#towninfo_towninfo ul.game_list li:nth-child(4)>div.list_item_right");

					stats_but.appendTo(container);
					container.css("min-width", "126px");
					jQuery("a[id*='RepConvStatsPlayer']").hide();

					if(alliance !== false) {
						link="https://grepolife.com/"+Game.world_id.substr(0,2)+"/"+Game.world_id.substr(2)+"/alliance/"+alliance;
						stats_but=jQuery("<a/>", {href:link,target:"_blank",width:25,height:23}).html(jQuery("<img/>", {src:"https://grepolife.com/tool/but.png"})).mousePopup(new MousePopup("GrepoLife Stats"));
						container=jQuery("div#towninfo_towninfo ul.game_list li:nth-child(5)>div.list_item_right");

						stats_but.appendTo(container);
						container.css("min-width", "100px");

						jQuery("a[id*='RepConvStatsAlly']").hide();
					}

					if(town !== false) {
						link="https://grepolife.com/"+Game.world_id.substr(0,2)+"/"+Game.world_id.substr(2)+"/town/"+town;
						stats_but=jQuery("<a/>", {href:link,target:"_blank",width:25,height:23}).html(jQuery("<img/>", {src:"https://grepolife.com/tool/h.png"})).mousePopup(new MousePopup("GrepoLife Town History"));
						stats_but=jQuery("<div>", {class:"list_item_right ie7fix"}).html(stats_but);
						container=jQuery("div#towninfo_towninfo ul.game_list li:nth-child(1)");

						stats_but.appendTo(container);

						jQuery("a[id*='RepConvStatsTown']").hide();
					}
				}, 150, player[1], alliance, town);
			}
            }
		} else if(e == "player") {
            a=l.url.replace(/.*action=(.*)&h.*/g, "$1");
            if(a == "get_profile_html") {
			response=JSON.parse(d.responseText).plain.html;
			player=response.match(/<h3>(.*)<\/h3>/)[1];
			setTimeout(function(name){
				container=jQuery("div#player_info>div#player_buttons");
				link="https://grepolife.com/"+Game.world_id.substr(0,2)+"/"+Game.world_id.substr(2)+"/player/"+name;
				stats_but=jQuery("<a/>", {href:link,target:"_blank",width:25,height:23}).html(jQuery("<img/>", {src:"https://grepolife.com/tool/but.png"})).mousePopup(new MousePopup("GrepoLife Stats"));

				stats_but.appendTo(container);

				jQuery("a[id*='RepConvStatsPlayer']").hide();
			}, 150, player);
            }
		} else if(e == "alliance") {
			alliance=JSON.parse(d.responseText).json.alliance_id;
			setTimeout(function(id){
				link="https://grepolife.com/"+Game.world_id.substr(0,2)+"/"+Game.world_id.substr(2)+"/alliance/"+id;
				stats_but=jQuery("<a/>", {href:link,target:"_blank",width:25,height:23}).html(jQuery("<img/>", {src:"https://grepolife.com/tool/but.png"})).mousePopup(new MousePopup("GrepoLife Stats"));
				container=jQuery("div#alliance_points").parent().children("h3");

				stats_but.css({float:"left",marginRight:"5px"});
				jQuery("a[id*='RepConvStatsAlly']").hide();
				stats_but.appendTo(container);
			}, 150, alliance);
		}
	});
}

function toolInit() {
	if("object" != typeof Game) {setTimeout(function(){toolInit();},1000);}else{toolCode();}
}

function appendScript(script) {
	var a = document.createElement("script");
	a.type = "text/javascript";
	a.textContent = script;
	document.body.appendChild(a);
}
appendScript(toolCode.toString());
appendScript(toolInit.toString());
appendScript("toolInit();");