-
Notifications
You must be signed in to change notification settings - Fork 24
/
start.js
82 lines (69 loc) · 2.04 KB
/
start.js
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
var runScript = function(scriptName, callOnLoad, isAsync) {
try {
var e = document.createElement('script');
e.src = chrome.extension.getURL(scriptName);
e.async = !!isAsync;
(document.head || document.documentElement).appendChild(e);
e.onload = function() {
e.parentNode.removeChild(e);
if(callOnLoad)
callOnLoad.call(this);
};
} catch (e) {}
};
// injection point lookup
runScript('webpack_detect.js', false, true);
var loadFile = function(fileName) {
try{
var request = new XMLHttpRequest();
request.open('GET', chrome.extension.getURL(fileName), false);
request.send(null);
if (request.status === 200) {
return request.responseText;
}
}
catch(e) {}
return "";
};
(function() {
try {
var e = document.createElement("script");
var menuHtml = loadFile('payload/menu.html');
var helpEnHtml = loadFile('payload/help-en.html');
var helpRuHtml = loadFile('payload/help-ru.html');
var counterHtml = loadFile('payload/FPSCounter.html');
code = "window.tempVars = {" +
"menuHtml: `" + menuHtml + "`," +
"helpEnHtml: `" + helpEnHtml + "`," +
"helpRuHtml: `" + helpRuHtml + "`," +
"counterHtml: `" + counterHtml + "`," +
"};";
e.setAttribute('type', 'text/javascript');
e.innerHTML = code;
(document.head || document.documentElement).appendChild(e);
e.onload = function() {
e.parentNode.removeChild(e);
};
} catch (e) {}
})();
// payload vars
runScript('payload/gameVars.js');
runScript('payload/gameSetting.js');
// payload functions
runScript('payload/gameInit.js');
runScript('payload/gameFree.js');
runScript('payload/gameOverride.js');
runScript('payload/gameUpdate.js');
runScript('payload/gameRender.js');
runScript('payload/pingOverride.js');
window.addEventListener("load", function load(event){
window.removeEventListener("load", load, false);
// injection point
runScript('webpack_override.js');
// appearance
runScript('third_party/jquery-3.3.1.min.js',
() => {
runScript('payload/menuAppearance.js');
runScript('payload/documentChange.js');
});
},false);