forked from hnns88/FrozenCookies
-
Notifications
You must be signed in to change notification settings - Fork 5
/
frozen_cookies.js
70 lines (65 loc) · 2.78 KB
/
frozen_cookies.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
// Global Variables
var scriptElement = document.getElementById('frozenCookieScript') !== null ? document.getElementById('frozenCookieScript') : document.getElementById('modscript_frozen_cookies');
var baseUrl = scriptElement !== null ? scriptElement.getAttribute('src').replace(/\/frozen_cookies\.js$/, '') : 'https://rawgit.com/kisslab69/FrozenCookies/master';
var FrozenCookies = {
'baseUrl': baseUrl,
'branch': '',
'version': '1.7.6'
};
// Load external libraries
var script_list = [
'//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js',
'//ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css',
'//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js',
'//cdnjs.cloudflare.com/ajax/libs/jcanvas/20.1.1/min/jcanvas.min.js',
'//cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.9/jquery.jqplot.min.js',
'//cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.9/jquery.jqplot.min.css',
'//cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.9/plugins/jqplot.canvasTextRenderer.min.js',
'//cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.9/plugins/jqplot.canvasAxisLabelRenderer.min.js',
'//cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.9/plugins/jqplot.canvasAxisTickRenderer.min.js',
'//cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.9/plugins/jqplot.trendline.min.js',
'//cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.9/plugins/jqplot.highlighter.min.js',
'//cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.9/plugins/jqplot.logAxisRenderer.min.js',
'//cdnjs.cloudflare.com/ajax/libs/jqPlot/1.0.9/plugins/jqplot.cursor.min.js',
FrozenCookies.baseUrl + '/cc_upgrade_prerequisites.js',
FrozenCookies.baseUrl + '/fc_button.js',
FrozenCookies.baseUrl + '/fc_main.js'
]
FrozenCookies.loadInterval = setInterval(function() {
if (Game && Game.ready) {
clearInterval(FrozenCookies.loadInterval);
FrozenCookies.loadInterval = 0;
fcInit();
}
}, 1000);
function loadScript(id) {
if (id >= script_list.length) {
FCStart();
} else {
var url = script_list[id];
if (/\.js$/.exec(url)) {
$.getScript(url, function() {
loadScript(id + 1);
});
} else if (/\.css$/.exec(url)) {
$('<link>').attr({
rel: 'stylesheet',
type: 'text/css',
href: url
}).appendTo($('head'));
loadScript(id + 1);
} else {
console.log('Error loading script: ' + url);
loadScript(id + 1);
}
}
}
function fcInit() {
var jquery = document.createElement('script');
jquery.setAttribute('type', 'text/javascript');
jquery.setAttribute('src', '//ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js');
jquery.onload = function() {
loadScript(0);
};
document.head.appendChild(jquery);
}