-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsimulator_user_script.user.js
More file actions
126 lines (90 loc) · 4.24 KB
/
simulator_user_script.user.js
File metadata and controls
126 lines (90 loc) · 4.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
// ==UserScript==
// @name simulator user script
// @version 0.0.3.5
// @description simulator user script
// @author ChickenStorm
// @match http://game.asylamba.com/beta/fleet/view-spyreport*
// @match http://game.asylamba.com/s6/fleet/view-spyreport*
// @match http://game.asylamba.com/s7/fleet/view-spyreport*
// @match http://game.asylamba.com/s*/fleet/view-spyreport*
// @match http://s*.asylamba.com/fleet/view-spyreport*
// @include http://s*.asylamba.com/fleet/view-spyreport*
// @match https://dl.dropboxusercontent.com/u/110049848/Projecet_script_public/*
// @updateURL https://github.com/ChickenStorm/Asylamba-Combat-Simulator/raw/master/userScript/simulator_user_script.user.js
// @grant none
// ==/UserScript==
var versionUserScript = "0.0.3.5";
var d = document.getElementsByTagName("span");
function setOnClickFunction(decalage){
var decString ="";
for (var i=0;i< decalage;++i){
decString+="0,";
}
var regExp = new RegExp("^commander full show*");
for(var i in d){
if (regExp.test(d[i].className)) {
d[i].onclick = function(event){
//******
var temp = this["outerHTML"]
//var temp = ""
const SEARCH_TEXT = "data-army=\"[";
var pos = temp.indexOf(SEARCH_TEXT) + SEARCH_TEXT.length;
temp = temp.substring(pos,temp.length-1);
var pos2 = temp.indexOf("]\">");
temp = temp.substring(0,pos2);
window.open("http://chickenbot.cloudapp.net:8080/simulateur?d=" +decString+ temp +";");
//**********
};
}
}
}
/*function getVersionUS() {
return version;
}*/
function messageForSimulator(){
document.getElementById("UserScriptMessage").innerHTML = "";
try{
if (versionUserScript == userScriptLastVersion) {
$("generalInfos").innerHTML += "user script à jour.";
}
else{
$("generalInfos").innerHTML += "l'user script n'est pas à jour. Téléchargez le <a href='https://github.com/ChickenStorm/Asylamba-Combat-Simulator/raw/master/userScript/simulator_user_script.user.js'>ici</a>.";
}
}
catch(e){
}
/*
if (getVersionUS() == userScriptLastVersion) {
$("generalInfos").innerHTML += "user script à jour."
}
else{
$("generalInfos").innerHTML += "l'user script n'est pas à jour. Téléchargez le <a href='https://github.com/ChickenStorm/Asylamba-Combat-Simulator/raw/master/userScript/simulator_user_script.user.js'>ici</a>."
}
*/
}
//##############################################################################################################################################################################
var regExpUrlAsylambaBeta1 = new RegExp("(^http://game.asylamba.com/beta/fleet/view-spyreport*)");
var regExpUrlAsylambaBeta2 = new RegExp("(^http://game.asylamba.com/s6/fleet/view-spyreport*)")
var regExpUrlAsylambaBeta3 = new RegExp("(^http://game.asylamba.com/s7/fleet/view-spyreport*)")
var regExpUrlAsylambaGammaS = new RegExp("(^http://game.asylamba.com/s[0-9]+/fleet/view-spyreport*)")
var regExpUrlAsylambaEtaS = new RegExp("(^http://s[0-9]+.asylamba.com/fleet/view-spyreport*)")
var regExpUrlSimulator = new RegExp("^https://dl.dropboxusercontent.com/u/110049848/Projecet_script_public/*");
if (regExpUrlAsylambaBeta1.test(window.location.href)) {
setOnClickFunction(12);
}
else if (regExpUrlAsylambaBeta2.test(window.location.href)){
setOnClickFunction(0);
}
else if (regExpUrlAsylambaBeta3.test(window.location.href)){
setOnClickFunction(0);
}
else if(regExpUrlAsylambaGammaS.test(window.location.href)){
setOnClickFunction(0);
}
else if(regExpUrlAsylambaEtaS.test(window.location.href)){
setOnClickFunction(0);
}
else if (regExpUrlSimulator.test(window.location.href)) {
//messageForSimulator();
setTimeout(messageForSimulator,0);
}