// ==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("", {href:link,target:"_blank",width:25,height:23}).html(jQuery("", {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("", {href:link,target:"_blank",width:25,height:23}).html(jQuery("", {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("", {href:link,target:"_blank",width:25,height:23}).html(jQuery("", {src:"https://grepolife.com/tool/h.png"})).mousePopup(new MousePopup("GrepoLife Town History")); stats_but=jQuery("