forked from enyojs/enyo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
enyo.js
41 lines (34 loc) · 1.24 KB
/
enyo.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
(function() {
// enyo can use information from the script tag that loads this bootstrap file
var thisScript = "enyo.js";
enyo = window.enyo || {};
enyo.locateScript = function(inName) {
var scripts = document.getElementsByTagName("script");
for (var i=scripts.length-1, s, src, l=inName.length; (i>=0) && (s=scripts[i]); i--) {
if (!s.located) {
src = s.getAttribute("src") || "";
if (src.slice(-l) == inName) {
s.located = true;
return {path: src.slice(0, Math.max(0, src.lastIndexOf("/"))), node: s};
}
}
}
};
enyo.args = enyo.args || {};
var tag = enyo.locateScript(thisScript);
if (tag) {
// infer the framework path from the document, unless the user has specified one explicitly
enyo.args.root = (enyo.args.root || tag.path); /*.replace("/source", "")*/;
// all attributes of the bootstrap script tag become enyo.args
for (var i=0, al = tag.node.attributes.length, it; (i < al) && (it = tag.node.attributes.item(i)); i++) {
enyo.args[it.nodeName] = it.value;
}
}
var root = enyo.args.root;
var script = function(inSrc) {
document.write('<scri' + 'pt src="' + root + "/source/boot/" + inSrc + '"></scri' + 'pt>');
};
script("../../loader.js");
script("boot.js");
script("../package.js");
})();