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