]> git.wh0rd.org - tt-rss.git/blob - lib/dojo/_base/_loader/loader.js
add dijit/dojo stuff; initial ui mockup
[tt-rss.git] / lib / dojo / _base / _loader / loader.js
1 /*
2 Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved.
3 Available via Academic Free License >= 2.1 OR the modified BSD license.
4 see: http://dojotoolkit.org/license for details
5 */
6
7
8 if(!dojo._hasResource["dojo.foo"]){
9 dojo._hasResource["dojo.foo"]=true;
10 (function(){
11 var d=dojo;
12 d.mixin(d,{_loadedModules:{},_inFlightCount:0,_hasResource:{},_modulePrefixes:{dojo:{name:"dojo",value:"."},doh:{name:"doh",value:"../util/doh"},tests:{name:"tests",value:"tests"}},_moduleHasPrefix:function(_1){
13 var mp=d._modulePrefixes;
14 return !!(mp[_1]&&mp[_1].value);
15 },_getModulePrefix:function(_2){
16 var mp=d._modulePrefixes;
17 if(d._moduleHasPrefix(_2)){
18 return mp[_2].value;
19 }
20 return _2;
21 },_loadedUrls:[],_postLoad:false,_loaders:[],_unloaders:[],_loadNotifying:false});
22 dojo._loadPath=function(_3,_4,cb){
23 var _5=((_3.charAt(0)=="/"||_3.match(/^\w+:/))?"":d.baseUrl)+_3;
24 try{
25 return !_4?d._loadUri(_5,cb):d._loadUriAndCheck(_5,_4,cb);
26 }
27 catch(e){
28 console.error(e);
29 return false;
30 }
31 };
32 dojo._loadUri=function(_6,cb){
33 if(d._loadedUrls[_6]){
34 return true;
35 }
36 d._inFlightCount++;
37 var _7=d._getText(_6,true);
38 if(_7){
39 d._loadedUrls[_6]=true;
40 d._loadedUrls.push(_6);
41 if(cb){
42 _7="("+_7+")";
43 }else{
44 _7=d._scopePrefix+_7+d._scopeSuffix;
45 }
46 if(!d.isIE){
47 _7+="\r\n//@ sourceURL="+_6;
48 }
49 var _8=d["eval"](_7);
50 if(cb){
51 cb(_8);
52 }
53 }
54 if(--d._inFlightCount==0&&d._postLoad&&d._loaders.length){
55 setTimeout(function(){
56 if(d._inFlightCount==0){
57 d._callLoaded();
58 }
59 },0);
60 }
61 return !!_7;
62 };
63 dojo._loadUriAndCheck=function(_9,_a,cb){
64 var ok=false;
65 try{
66 ok=d._loadUri(_9,cb);
67 }
68 catch(e){
69 console.error("failed loading "+_9+" with error: "+e);
70 }
71 return !!(ok&&d._loadedModules[_a]);
72 };
73 dojo.loaded=function(){
74 d._loadNotifying=true;
75 d._postLoad=true;
76 var _b=d._loaders;
77 d._loaders=[];
78 for(var x=0;x<_b.length;x++){
79 _b[x]();
80 }
81 d._loadNotifying=false;
82 if(d._postLoad&&d._inFlightCount==0&&_b.length){
83 d._callLoaded();
84 }
85 };
86 dojo.unloaded=function(){
87 var _c=d._unloaders;
88 while(_c.length){
89 (_c.pop())();
90 }
91 };
92 d._onto=function(_d,_e,fn){
93 if(!fn){
94 _d.push(_e);
95 }else{
96 if(fn){
97 var _f=(typeof fn=="string")?_e[fn]:fn;
98 _d.push(function(){
99 _f.call(_e);
100 });
101 }
102 }
103 };
104 dojo.ready=dojo.addOnLoad=function(obj,_10){
105 d._onto(d._loaders,obj,_10);
106 if(d._postLoad&&d._inFlightCount==0&&!d._loadNotifying){
107 d._callLoaded();
108 }
109 };
110 var dca=d.config.addOnLoad;
111 if(dca){
112 d.addOnLoad[(dca instanceof Array?"apply":"call")](d,dca);
113 }
114 dojo._modulesLoaded=function(){
115 if(d._postLoad){
116 return;
117 }
118 if(d._inFlightCount>0){
119 console.warn("files still in flight!");
120 return;
121 }
122 d._callLoaded();
123 };
124 dojo._callLoaded=function(){
125 if(typeof setTimeout=="object"||(d.config.useXDomain&&d.isOpera)){
126 setTimeout(d.isAIR?function(){
127 d.loaded();
128 }:d._scopeName+".loaded();",0);
129 }else{
130 d.loaded();
131 }
132 };
133 dojo._getModuleSymbols=function(_11){
134 var _12=_11.split(".");
135 for(var i=_12.length;i>0;i--){
136 var _13=_12.slice(0,i).join(".");
137 if(i==1&&!d._moduleHasPrefix(_13)){
138 _12[0]="../"+_12[0];
139 }else{
140 var _14=d._getModulePrefix(_13);
141 if(_14!=_13){
142 _12.splice(0,i,_14);
143 break;
144 }
145 }
146 }
147 return _12;
148 };
149 dojo._global_omit_module_check=false;
150 dojo.loadInit=function(_15){
151 _15();
152 };
153 dojo._loadModule=dojo.require=function(_16,_17){
154 _17=d._global_omit_module_check||_17;
155 var _18=d._loadedModules[_16];
156 if(_18){
157 return _18;
158 }
159 var _19=d._getModuleSymbols(_16).join("/")+".js";
160 var _1a=!_17?_16:null;
161 var ok=d._loadPath(_19,_1a);
162 if(!ok&&!_17){
163 throw new Error("Could not load '"+_16+"'; last tried '"+_19+"'");
164 }
165 if(!_17&&!d._isXDomain){
166 _18=d._loadedModules[_16];
167 if(!_18){
168 throw new Error("symbol '"+_16+"' is not defined after loading '"+_19+"'");
169 }
170 }
171 return _18;
172 };
173 dojo.provide=function(_1b){
174 _1b=_1b+"";
175 return (d._loadedModules[_1b]=d.getObject(_1b,true));
176 };
177 dojo.platformRequire=function(_1c){
178 var _1d=_1c.common||[];
179 var _1e=_1d.concat(_1c[d._name]||_1c["default"]||[]);
180 for(var x=0;x<_1e.length;x++){
181 var _1f=_1e[x];
182 if(_1f.constructor==Array){
183 d._loadModule.apply(d,_1f);
184 }else{
185 d._loadModule(_1f);
186 }
187 }
188 };
189 dojo.requireIf=function(_20,_21){
190 if(_20===true){
191 var _22=[];
192 for(var i=1;i<arguments.length;i++){
193 _22.push(arguments[i]);
194 }
195 d.require.apply(d,_22);
196 }
197 };
198 dojo.requireAfterIf=d.requireIf;
199 dojo.registerModulePath=function(_23,_24){
200 d._modulePrefixes[_23]={name:_23,value:_24};
201 };
202 dojo.requireLocalization=function(_25,_26,_27,_28){
203 d.require("dojo.i18n");
204 d.i18n._requireLocalization.apply(d.hostenv,arguments);
205 };
206 var ore=new RegExp("^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?$"),ire=new RegExp("^((([^\\[:]+):)?([^@]+)@)?(\\[([^\\]]+)\\]|([^\\[:]*))(:([0-9]+))?$");
207 dojo._Url=function(){
208 var n=null,_29=arguments,uri=[_29[0]];
209 for(var i=1;i<_29.length;i++){
210 if(!_29[i]){
211 continue;
212 }
213 var _2a=new d._Url(_29[i]+""),_2b=new d._Url(uri[0]+"");
214 if(_2a.path==""&&!_2a.scheme&&!_2a.authority&&!_2a.query){
215 if(_2a.fragment!=n){
216 _2b.fragment=_2a.fragment;
217 }
218 _2a=_2b;
219 }else{
220 if(!_2a.scheme){
221 _2a.scheme=_2b.scheme;
222 if(!_2a.authority){
223 _2a.authority=_2b.authority;
224 if(_2a.path.charAt(0)!="/"){
225 var _2c=_2b.path.substring(0,_2b.path.lastIndexOf("/")+1)+_2a.path;
226 var _2d=_2c.split("/");
227 for(var j=0;j<_2d.length;j++){
228 if(_2d[j]=="."){
229 if(j==_2d.length-1){
230 _2d[j]="";
231 }else{
232 _2d.splice(j,1);
233 j--;
234 }
235 }else{
236 if(j>0&&!(j==1&&_2d[0]=="")&&_2d[j]==".."&&_2d[j-1]!=".."){
237 if(j==(_2d.length-1)){
238 _2d.splice(j,1);
239 _2d[j-1]="";
240 }else{
241 _2d.splice(j-1,2);
242 j-=2;
243 }
244 }
245 }
246 }
247 _2a.path=_2d.join("/");
248 }
249 }
250 }
251 }
252 uri=[];
253 if(_2a.scheme){
254 uri.push(_2a.scheme,":");
255 }
256 if(_2a.authority){
257 uri.push("//",_2a.authority);
258 }
259 uri.push(_2a.path);
260 if(_2a.query){
261 uri.push("?",_2a.query);
262 }
263 if(_2a.fragment){
264 uri.push("#",_2a.fragment);
265 }
266 }
267 this.uri=uri.join("");
268 var r=this.uri.match(ore);
269 this.scheme=r[2]||(r[1]?"":n);
270 this.authority=r[4]||(r[3]?"":n);
271 this.path=r[5];
272 this.query=r[7]||(r[6]?"":n);
273 this.fragment=r[9]||(r[8]?"":n);
274 if(this.authority!=n){
275 r=this.authority.match(ire);
276 this.user=r[3]||n;
277 this.password=r[4]||n;
278 this.host=r[6]||r[7];
279 this.port=r[9]||n;
280 }
281 };
282 dojo._Url.prototype.toString=function(){
283 return this.uri;
284 };
285 dojo.moduleUrl=function(_2e,url){
286 var loc=d._getModuleSymbols(_2e).join("/");
287 if(!loc){
288 return null;
289 }
290 if(loc.lastIndexOf("/")!=loc.length-1){
291 loc+="/";
292 }
293 var _2f=loc.indexOf(":");
294 if(loc.charAt(0)!="/"&&(_2f==-1||_2f>loc.indexOf("/"))){
295 loc=d.baseUrl+loc;
296 }
297 return new d._Url(loc,url);
298 };
299 })();
300 }