Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80737 views
1
// Generated by CoffeeScript 1.9.1
2
var CoffeeScript, compile, runScripts,
3
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
4
5
CoffeeScript = require('./coffee-react-script');
6
7
CoffeeScript.require = require;
8
9
compile = CoffeeScript.compile;
10
11
CoffeeScript["eval"] = function(code, options) {
12
if (options == null) {
13
options = {};
14
}
15
if (options.bare == null) {
16
options.bare = true;
17
}
18
return eval(compile(code, options));
19
};
20
21
CoffeeScript.run = function(code, options) {
22
if (options == null) {
23
options = {};
24
}
25
options.bare = true;
26
options.shiftLine = true;
27
return Function(compile(code, options))();
28
};
29
30
if (typeof window === "undefined" || window === null) {
31
return;
32
}
33
34
if ((typeof btoa !== "undefined" && btoa !== null) && (typeof JSON !== "undefined" && JSON !== null) && (typeof unescape !== "undefined" && unescape !== null) && (typeof encodeURIComponent !== "undefined" && encodeURIComponent !== null)) {
35
compile = function(code, options) {
36
var js, ref, v3SourceMap;
37
if (options == null) {
38
options = {};
39
}
40
options.sourceMap = true;
41
options.inline = true;
42
ref = CoffeeScript.compile(code, options), js = ref.js, v3SourceMap = ref.v3SourceMap;
43
return js + "\n//# sourceMappingURL=data:application/json;base64," + (btoa(unescape(encodeURIComponent(v3SourceMap)))) + "\n//# sourceURL=coffeescript";
44
};
45
}
46
47
CoffeeScript.load = function(url, callback, options, hold) {
48
var xhr;
49
if (options == null) {
50
options = {};
51
}
52
if (hold == null) {
53
hold = false;
54
}
55
options.sourceFiles = [url];
56
xhr = window.ActiveXObject ? new window.ActiveXObject('Microsoft.XMLHTTP') : new window.XMLHttpRequest();
57
xhr.open('GET', url, true);
58
if ('overrideMimeType' in xhr) {
59
xhr.overrideMimeType('text/plain');
60
}
61
xhr.onreadystatechange = function() {
62
var param, ref;
63
if (xhr.readyState === 4) {
64
if ((ref = xhr.status) === 0 || ref === 200) {
65
param = [xhr.responseText, options];
66
if (!hold) {
67
CoffeeScript.run.apply(CoffeeScript, param);
68
}
69
} else {
70
throw new Error("Could not load " + url);
71
}
72
if (callback) {
73
return callback(param);
74
}
75
}
76
};
77
return xhr.send(null);
78
};
79
80
runScripts = function() {
81
var coffees, coffeetypes, execute, fn, i, index, j, len, s, script, scripts;
82
scripts = window.document.getElementsByTagName('script');
83
coffeetypes = ['text/cjsx', 'text/coffeescript', 'text/literate-coffeescript'];
84
coffees = (function() {
85
var j, len, ref, results;
86
results = [];
87
for (j = 0, len = scripts.length; j < len; j++) {
88
s = scripts[j];
89
if (ref = s.type, indexOf.call(coffeetypes, ref) >= 0) {
90
results.push(s);
91
}
92
}
93
return results;
94
})();
95
index = 0;
96
execute = function() {
97
var param;
98
param = coffees[index];
99
if (param instanceof Array) {
100
CoffeeScript.run.apply(CoffeeScript, param);
101
index++;
102
return execute();
103
}
104
};
105
fn = function(script, i) {
106
var options, source;
107
options = {
108
literate: script.type === coffeetypes[1]
109
};
110
source = script.src || script.getAttribute('data-src');
111
if (source) {
112
return CoffeeScript.load(source, function(param) {
113
coffees[i] = param;
114
return execute();
115
}, options, true);
116
} else {
117
options.sourceFiles = ['embedded'];
118
return coffees[i] = [script.innerHTML, options];
119
}
120
};
121
for (i = j = 0, len = coffees.length; j < len; i = ++j) {
122
script = coffees[i];
123
fn(script, i);
124
}
125
return execute();
126
};
127
128
if (window.addEventListener) {
129
window.addEventListener('DOMContentLoaded', runScripts, false);
130
} else {
131
window.attachEvent('onload', runScripts);
132
}
133
134