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
8 if(!dojo
._hasResource
["dojo.foo"]){
9 dojo
._hasResource
["dojo.foo"]=true;
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
)){
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
;
25 return !_4
?d
._loadUri(_5
,cb
):d
._loadUriAndCheck(_5
,_4
,cb
);
32 dojo
._loadUri=function(_6
,cb
){
33 if(d
._loadedUrls
[_6
]){
37 var _7
=d
._getText(_6
,true);
39 d
._loadedUrls
[_6
]=true;
40 d
._loadedUrls
.push(_6
);
44 _7
=d
._scopePrefix
+_7
+d
._scopeSuffix
;
47 _7
+="\r\n//@ sourceURL="+_6
;
54 if(--d
._inFlightCount
==0&&d
._postLoad
&&d
._loaders
.length
){
55 setTimeout(function(){
56 if(d
._inFlightCount
==0){
63 dojo
._loadUriAndCheck=function(_9
,_a
,cb
){
69 console
.error("failed loading "+_9
+" with error: "+e
);
71 return !!(ok
&&d
._loadedModules
[_a
]);
73 dojo
.loaded=function(){
74 d
._loadNotifying
=true;
78 for(var x
=0;x
<_b
.length
;x
++){
81 d
._loadNotifying
=false;
82 if(d
._postLoad
&&d
._inFlightCount
==0&&_b
.length
){
86 dojo
.unloaded=function(){
92 d
._onto=function(_d
,_e
,fn
){
97 var _f
=(typeof fn
=="string")?_e
[fn
]:fn
;
104 dojo
.ready
=dojo
.addOnLoad=function(obj
,_10
){
105 d
._onto(d
._loaders
,obj
,_10
);
106 if(d
._postLoad
&&d
._inFlightCount
==0&&!d
._loadNotifying
){
110 var dca
=d
.config
.addOnLoad
;
112 d
.addOnLoad
[(dca
instanceof Array
?"apply":"call")](d
,dca
);
114 dojo
._modulesLoaded=function(){
118 if(d
._inFlightCount
>0){
119 console
.warn("files still in flight!");
124 dojo
._callLoaded=function(){
125 if(typeof setTimeout
=="object"||(d
.config
.useXDomain
&&d
.isOpera
)){
126 setTimeout(d
.isAIR
?function(){
128 }:d
._scopeName
+".loaded();",0);
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
)){
140 var _14
=d
._getModulePrefix(_13
);
149 dojo
._global_omit_module_check
=false;
150 dojo
.loadInit=function(_15
){
153 dojo
._loadModule
=dojo
.require=function(_16
,_17
){
154 _17
=d
._global_omit_module_check
||_17
;
155 var _18
=d
._loadedModules
[_16
];
159 var _19
=d
._getModuleSymbols(_16
).join("/")+".js";
160 var _1a
=!_17
?_16
:null;
161 var ok
=d
._loadPath(_19
,_1a
);
163 throw new Error("Could not load '"+_16
+"'; last tried '"+_19
+"'");
165 if(!_17
&&!d
._isXDomain
){
166 _18
=d
._loadedModules
[_16
];
168 throw new Error("symbol '"+_16
+"' is not defined after loading '"+_19
+"'");
173 dojo
.provide=function(_1b
){
175 return (d
._loadedModules
[_1b
]=d
.getObject(_1b
,true));
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
++){
182 if(_1f
.constructor==Array
){
183 d
._loadModule
.apply(d
,_1f
);
189 dojo
.requireIf=function(_20
,_21
){
192 for(var i
=1;i
<arguments
.length
;i
++){
193 _22
.push(arguments
[i
]);
195 d
.require
.apply(d
,_22
);
198 dojo
.requireAfterIf
=d
.requireIf
;
199 dojo
.registerModulePath=function(_23
,_24
){
200 d
._modulePrefixes
[_23
]={name
:_23
,value
:_24
};
202 dojo
.requireLocalization=function(_25
,_26
,_27
,_28
){
203 d
.require("dojo.i18n");
204 d
.i18n
._requireLocalization
.apply(d
.hostenv
,arguments
);
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
++){
213 var _2a
=new d
._Url(_29
[i
]+""),_2b
=new d
._Url(uri
[0]+"");
214 if(_2a
.path
==""&&!_2a
.scheme
&&!_2a
.authority
&&!_2a
.query
){
216 _2b
.fragment
=_2a
.fragment
;
221 _2a
.scheme
=_2b
.scheme
;
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
++){
236 if(j
>0&&!(j
==1&&_2d
[0]=="")&&_2d
[j
]==".."&&_2d
[j
-1]!=".."){
237 if(j
==(_2d
.length
-1)){
247 _2a
.path
=_2d
.join("/");
254 uri
.push(_2a
.scheme
,":");
257 uri
.push("//",_2a
.authority
);
261 uri
.push("?",_2a
.query
);
264 uri
.push("#",_2a
.fragment
);
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
);
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
);
277 this.password
=r
[4]||n
;
278 this.host
=r
[6]||r
[7];
282 dojo
._Url
.prototype.toString=function(){
285 dojo
.moduleUrl=function(_2e
,url
){
286 var loc
=d
._getModuleSymbols(_2e
).join("/");
290 if(loc
.lastIndexOf("/")!=loc
.length
-1){
293 var _2f
=loc
.indexOf(":");
294 if(loc
.charAt(0)!="/"&&(_2f
==-1||_2f
>loc
.indexOf("/"))){
297 return new d
._Url(loc
,url
);