forked from Mtarnuhal/FrozenCookies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
frozen_cookies.js
64 lines (60 loc) · 2.42 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
// Global Variables
var scriptElement = document.getElementById( 'frozenCookieScript' ),
baseUrl = scriptElement !== null ?
scriptElement.getAttribute('src').replace(/\/frozen_cookies\.js$/, '') :
'https://raw.github.com/felixkempf/FrozenCookies/master',
FrozenCookies = {
'baseUrl': baseUrl,
'branch' : 'M',
'version': '1.3 (Unsupported)'
};
// Load external libraries
var script_list = [
'//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js',
'//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css',
'//cdn.jsdelivr.net/underscorejs/1.6.0/underscore-min.js',
'//cdn.jsdelivr.net/jquery.jcanvas/13.04.26/jcanvas.min.js',
'//cdn.jsdelivr.net/jqplot/1.0.8/jquery.jqplot.min.js',
'//cdn.jsdelivr.net/jqplot/1.0.8/jquery.jqplot.min.css',
'//cdn.jsdelivr.net/jqplot/1.0.8/plugins/jqplot.canvasTextRenderer.min.js',
'//cdn.jsdelivr.net/jqplot/1.0.8/plugins/jqplot.canvasAxisLabelRenderer.min.js',
'//cdn.jsdelivr.net/jqplot/1.0.8/plugins/jqplot.canvasAxisTickRenderer.min.js',
'//cdn.jsdelivr.net/jqplot/1.0.8/plugins/jqplot.trendline.min.js',
'//cdn.jsdelivr.net/jqplot/1.0.8/plugins/jqplot.highlighter.min.js',
'//cdn.jsdelivr.net/jqplot/1.0.8/plugins/jqplot.logAxisRenderer.min.js',
'//cdn.jsdelivr.net/jqplot/1.0.8/plugins/jqplot.cursor.min.js',
FrozenCookies.baseUrl + '/cc_upgrade_prerequisites.js',
FrozenCookies.baseUrl + '/fc_main.js',
FrozenCookies.baseUrl + '/fc_button.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) {
setOverrides();
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/1.10.2/jquery.min.js');
jquery.onload = function() {loadScript(0);};
document.head.appendChild(jquery);
}