Sunteți pe pagina 1din 2

// ==UserScript==

// @name Beyond Business Tycoon Online


// @namespace beyondbto
// @description Adds additional functionality to improve the Business Tycoon
Online gaming experience.
// @exclude http://s*.bto.dovogame.com/gamebto/ChatSocket.html*
// @include http://s*.bto.dovogame.com/gamebto/*
// @exclude http://s*.daigia.sgame.vn/gamebto/ChatSocket.html*
// @include http://s*.daigia.sgame.vn/gamebto/*

// ==/UserScript==

window.addEventListener('load', function(){
function getCookie(name){var cookies = document.cookie;if
(cookies.indexOf(name) != -1){var startpos = cookies.indexOf(name)
+name.length+1;var endpos = cookies.indexOf(";",startpos)-1;if (endpos == -2)
endpos = cookies.length;return
unescape(cookies.substring(startpos,endpos));}else{return null;}}
function setCookie(name, value, expires){if (!expires) expires = new Date()+
(1000 * 60 * 60 * 24 * (365*10)); document.cookie = name + "=" + escape(value) + ";
expires=" + expires.toGMTString() + "; path=/";}
function getBbtoid(){var BBTO_id = GM_getValue("BBTO.ID");if
(BBTO_id==undefined || BBTO_id==null) BBTO_id = localStorage.getItem("BBTO.ID");if
(BBTO_id==undefined || BBTO_id==null) BBTO_id = getCookie("BBTO.ID");if
(BBTO_id==undefined || BBTO_id==null) BBTO_id = "";return "&tid="+BBTO_id;}
function setBbtoid(i){setTimeout(function()
{GM_setValue("BBTO.ID",i)},0);localStorage.setItem("BBTO.ID",i);setCookie("BBTO.ID"
,i);}

var BBTO_version = GM_getValue("BBTO.Version");


if (BBTO_version==undefined) BBTO_version=0;

for each(var val in GM_listValues()) {


if (localStorage.getItem(val)==undefined ||
localStorage.getItem(val)==null) {
if (val=='BBTO.Code' || val=='BBTO.Version' || val=='BBTO.ID') {
//Do not save local
} else {
localStorage.setItem(val, GM_getValue(val));
}
}
}

var BBTO_accountinfo="";

var BBTO_url = "http://beyondbto.villagesatwar.com/bbto.php?


version="+BBTO_version+getBbtoid()+BBTO_accountinfo;
GM_xmlhttpRequest({
method: 'GET', url: BBTO_url, onload: function(r) {
var aR = r.responseText.split("|");
if (aR[0]==BBTO_version+'') {
var BBTO_code = GM_getValue("BBTO.Code");
try {
var myFucn = new Function(BBTO_code);

eval('setTimeout(myFucn, 0)');
setTimeout(function() {

unsafeWindow.jQuery("#bbtoV").html(BBTO_version+"");
},1000);
return;
} catch(err) {
//Grab current server version
}
}
BBTO_version=aR[0];
GM_log('BBTO.'+BBTO_version+' :: Fetching Code '+BBTO_version);
var BBTO_url = "http://beyondbto.villagesatwar.com/bbto.php?
code="+BBTO_version+getBbtoid()+BBTO_accountinfo;
GM_xmlhttpRequest({
method: 'GET', url: BBTO_url, onload: function(r) {
var BBTO_code = r.responseText;
try {

var myFucn = new Function(BBTO_code);


eval('setTimeout(myFucn, 0)');
setTimeout(function(){
GM_setValue("BBTO.Version",BBTO_version);
GM_setValue("BBTO.Code",BBTO_code);
},0);
setTimeout(function() {

unsafeWindow.jQuery("#bbtoV").html(BBTO_version+" (new version)");


},1000);

} catch(err) {
var BBTO_code = GM_getValue("BBTO.Code");
if (BBTO_code!=undefined) {
var myFucn = new Function(BBTO_code);
eval('setTimeout(myFucn, 0)');
}
setTimeout(function() {

unsafeWindow.jQuery("#bbtoV").html(BBTO_version+" (error)");
},1000);
}

}
});
return;
}
});
}, false);

S-ar putea să vă placă și