-
Notifications
You must be signed in to change notification settings - Fork 0
/
EasyLoader.js
174 lines (173 loc) · 4.46 KB
/
EasyLoader.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
(function(){
var _1={draggable:{js:"jquery.draggable.js"},droppable:{js:"jquery.droppable.js"},resizable:{js:"jquery.resizable.js"},linkbutton:{js:"jquery.linkbutton.js",css:"linkbutton.css"},pagination:{js:"jquery.pagination.js",css:"pagination.css",dependencies:["linkbutton"]},datagrid:{js:"jquery.datagrid.js",css:"datagrid.css",dependencies:["resizable","linkbutton","pagination"]},panel:{js:"jquery.panel.js",css:"panel.css"},window:{js:"jquery.window.js",css:"window.css",dependencies:["resizable","draggable","panel"]},dialog:{js:"jquery.dialog.js",css:"dialog.css",dependencies:["window"]},messager:{js:"jquery.messager.js",css:"messager.css",dependencies:["linkbutton","window"]},layout:{js:"jquery.layout.js",css:"layout.css",dependencies:["resizable","panel"]},form:{js:"jquery.form.js"},menu:{js:"jquery.menu.js",css:"menu.css"},tabs:{js:"jquery.tabs.js",css:"tabs.css"},splitbutton:{js:"jquery.splitbutton.js",css:"splitbutton.css",dependencies:["linkbutton","menu"]},menubutton:{js:"jquery.menubutton.js",css:"menubutton.css",dependencies:["linkbutton","menu"]},accordion:{js:"jquery.accordion.js",css:"accordion.css",dependencies:["panel"]},calendar:{js:"jquery.calendar.js",css:"calendar.css"},combobox:{js:"jquery.combobox.js",css:"combobox.css",dependencies:["validatebox"]},combotree:{js:"jquery.combotree.js",css:"combotree.css",dependencies:["tree","validatebox"]},validatebox:{js:"jquery.validatebox.js",css:"validatebox.css"},numberbox:{js:"jquery.numberbox.js",dependencies:["validatebox"]},tree:{js:"jquery.tree.js",css:"tree.css"},datebox:{js:"jquery.datebox.js",css:"datebox.css",dependencies:["calendar"]},parser:{js:"jquery.parser.js"}};
var _2={};
function _3(_4,_5){
var _6=document.createElement("script");
_6.type="text/javascript";
_6.language="javascript";
_6.src=_4;
_6.onload=_6.onreadystatechange=function(){
if((!_6.readyState)||_6.readyState=="loaded"||_6.readyState=="complete"){
_6.onload=_6.onreadystatechange=null;
if(_5){
_5.call(_6);
}
}
};
document.getElementsByTagName("head")[0].appendChild(_6);
};
function _7(_8,_9){
_3(_8,function(){
document.getElementsByTagName("head")[0].removeChild(this);
if(_9){
_9();
}
});
};
function _a(_b,_c){
var _d=document.createElement("link");
_d.rel="stylesheet";
_d.type="text/css";
_d.media="screen";
_d.href=_b;
document.getElementsByTagName("head")[0].appendChild(_d);
if(_c){
_c.call(_d);
}
};
function _e(_f){
_2[_f]="loading";
var _10=_1[_f];
var _11="loading";
var _12=(EasyLoader.css&&_10["css"])?"loading":"loaded";
if(EasyLoader.css&&_10["css"]){
if(/^http/i.test(_10["css"])){
var url=_10["css"];
}else{
var url=EasyLoader.base+"themes/"+EasyLoader.theme+"/"+_10["css"];
}
_a(url,function(){
_12="loaded";
if(_11=="loaded"&&_12=="loaded"){
_13();
}
});
}
if(/^http/i.test(_10["js"])){
var url=_10["js"];
}else{
var url=EasyLoader.base+"plugins/"+_10["js"];
}
_3(url,function(){
_11="loaded";
if(_11=="loaded"&&_12=="loaded"){
_13();
}
});
function _13(){
_2[_f]="loaded";
EasyLoader.onProgress(_f);
};
};
function _14(_15,_16){
var p=[];
var _17=false;
if(typeof _15=="string"){
add(_15);
}else{
for(var i=0;i<_15.length;i++){
add(_15[i]);
}
}
function add(_18){
if(!_1[_18]){
return;
}
var d=_1[_18]["dependencies"];
if(d){
for(var i=0;i<d.length;i++){
add(d[i]);
}
}
if(!_2[_18]){
p.push(_18);
_e(_18);
_17=true;
}
};
function _19(){
if(_16){
_16();
}
EasyLoader.onLoad(_15);
};
var _1a=0;
(function(){
var b=true;
for(var i=0;i<p.length;i++){
if(_2[p[i]]=="loading"){
b=false;
break;
}
}
if(b==true){
if(EasyLoader.locale&&_17==true){
var url=EasyLoader.base+"locale/easyui-lang-"+EasyLoader.locale+".js";
_7(url,function(){
_19();
});
}else{
_19();
}
}else{
if(_1a<EasyLoader.timeout){
_1a+=10;
setTimeout(arguments.callee,10);
}
}
})();
};
EasyLoader={modules:_1,base:".",theme:"default",css:true,locale:null,timeout:2000,load:function(_1b,_1c){
if(/\.css$/i.test(_1b)){
if(/^http/i.test(_1b)){
_a(_1b,_1c);
}else{
_a(EasyLoader.base+_1b,_1c);
}
}else{
if(/\.js$/i.test(_1b)){
if(/^http/i.test(_1b)){
_3(_1b,_1c);
}else{
_3(EasyLoader.base+_1b,_1c);
}
}else{
_14(_1b,_1c);
}
}
},onProgress:function(_1d){
},onLoad:function(_1e){
}};
var _1f=document.getElementsByTagName("script");
for(var i=0;i<_1f.length;i++){
var src=_1f[i].src;
if(!src){
continue;
}
var m=src.match(/EasyLoader\.js(\W|$)/i);
if(m){
var _20=src.substring(0,m.index);
var _21=_20.length-2;
while(_20.substring(_21,_21+1)!="/"){
_21--;
}
EasyLoader.base=_20.substring(0,_21+1);
}
}
window.using=EasyLoader.load;
if(window.jQuery){
jQuery(function(){
EasyLoader.load("parser");
});
}
})();