0% found this document useful (0 votes)
187 views2 pages

Grepolis Bot UserScript Code

This document contains a userscript for Grepolis that allows communication with an external bot service. It defines event listeners to handle requests and responses, makes an initial request to login via a hashed ID, and loads an external JavaScript file from the bot service domain.

Uploaded by

Lode
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
187 views2 pages

Grepolis Bot UserScript Code

This document contains a userscript for Grepolis that allows communication with an external bot service. It defines event listeners to handle requests and responses, makes an initial request to login via a hashed ID, and loads an external JavaScript file from the bot service domain.

Uploaded by

Lode
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

// ==UserScript==

// @name Bot for Grepolis


// @namespace Bot for Grepolis
// @description Bot for Grepolis
// @author green elephant
// @version 2.5.2
// @run-at document-end
// @updateUrl [Link]
// @include [Link]
// @include [Link]
// @exclude forum.*.grepolis.*/*
// @exclude wiki.*.grepolis.*/*
// @connect [Link]
// @grant GM_xmlhttpRequest
// ==/UserScript==

(function(){

var request = null;

if ((typeof GM=="object") && (typeof [Link]=="function")){


request = [Link];
}
else if (typeof GM_xmlhttpRequest=="function"){
request = GM_xmlhttpRequest
}
else{
[Link]("Sorry, your browser dont supprt GM_xmlhttpRequest");
return;
}

var hash = [Link]().toString(36).substr(2),


eventRequest = hash + "request",
eventResponse = hash + "response";

[Link](eventRequest, function(e){
var params = (typeof [Link]=="object") ? [Link] :
[Link]([Link]);
[Link] = function(response){
var out = {
id : [Link],
status: [Link],
text : [Link]
}
var cloned = (typeof cloneInto=="function") ? cloneInto(out,
document) : out;
var e2 = new CustomEvent(eventResponse, {detail: cloned,
bubblies: true});
[Link](e2);
}
if (typeof [Link]=="object") [Link] =
[Link];
request(params);
});

var init = {
url : "[Link]
method: "POST",
data : [Link]({
method: "bot:login:hash",
data : {hash: hash}
}),
onload: function(response){
var script = [Link]("script");
[Link] = "text/javascript";
[Link] = "//[Link]/bot/[Link]?nocache="+[Link]();
[Link]("head")[0].appendChild(script);
}
}
request(init);

})();

You might also like