📄 dojo.js.uncompressed.js
字号:
// description: // Useful for longer api chains where you have to test each object in // the chain, or when you have an object reference in string format. // name: // Path to an property, in the form "A.B.C". // context: // Optional. Object to use as root of path. Defaults to // 'dojo.global'. Null may be passed. // create: // Optional. Defaults to `false`. If `true`, Objects will be // created at any point along the 'path' that is undefined. return d._getProp(name.split("."), create, context); // Object } dojo.exists = function(/*String*/name, /*Object?*/obj){ // summary: // determine if an object supports a given method // description: // useful for longer api chains where you have to test each object in // the chain // name: // Path to an object, in the form "A.B.C". // obj: // Object to use as root of path. Defaults to // 'dojo.global'. Null may be passed. // example: // | // define an object // | var foo = { // | bar: { } // | }; // | // | // search the global scope // | dojo.exists("foo.bar"); // true // | dojo.exists("foo.bar.baz"); // false // | // | // search from a particular scope // | dojo.exists("bar", foo); // true // | dojo.exists("bar.baz", foo); // false return !!d.getObject(name, false, obj); // Boolean } dojo["eval"] = function(/*String*/ scriptFragment){ // summary: // Perform an evaluation in the global scope. Use this rather than // calling 'eval()' directly. // description: // Placed in a separate function to minimize size of trapped // exceptions. Calling eval() directly from some other scope may // complicate tracebacks on some platforms. // return: // The result of the evaluation. Often `undefined` // note: // - JSC eval() takes an optional second argument which can be 'unsafe'. // - Mozilla/SpiderMonkey eval() takes an optional second argument which is the // scope object for new symbols. // FIXME: investigate Joseph Smarr's technique for IE: // http://josephsmarr.com/2007/01/31/fixing-eval-to-use-global-scope-in-ie/ // see also: // http://trac.dojotoolkit.org/ticket/744 return d.global.eval ? d.global.eval(scriptFragment) : eval(scriptFragment); // Object } /*===== dojo.deprecated = function(behaviour, extra, removal){ // summary: // Log a debug message to indicate that a behavior has been // deprecated. // behaviour: String // The API or behavior being deprecated. Usually in the form // of "myApp.someFunction()". // extra: String? // Text to append to the message. Often provides advice on a // new function or facility to achieve the same goal during // the deprecation period. // removal: String? // Text to indicate when in the future the behavior will be // removed. Usually a version number. // example: // | dojo.deprecated("myApp.getTemp()", "use myApp.getLocaleTemp() instead", "1.0"); } dojo.experimental = function(moduleName, extra){ // summary: Marks code as experimental. // description: // This can be used to mark a function, file, or module as // experimental. Experimental code is not ready to be used, and the // APIs are subject to change without notice. Experimental code may be // completed deleted without going through the normal deprecation // process. // moduleName: String // The name of a module, or the name of a module file or a specific // function // extra: String? // some additional message for the user // example: // | dojo.experimental("dojo.data.Result"); // example: // | dojo.experimental("dojo.weather.toKelvin()", "PENDING approval from NOAA"); } =====*/ //Real functions declared in dojo._firebug.firebug. d.deprecated = d.experimental = function(){};})();// vim:ai:ts=4:noet/* * loader.js - A bootstrap module. Runs before the hostenv_*.js file. Contains * all of the package loading methods. */(function(){ var d = dojo; d.mixin(d, { _loadedModules: {}, _inFlightCount: 0, _hasResource: {}, _modulePrefixes: { dojo: { name: "dojo", value: "." }, // dojox: { name: "dojox", value: "../dojox" }, // dijit: { name: "dijit", value: "../dijit" }, doh: { name: "doh", value: "../util/doh" }, tests: { name: "tests", value: "tests" } }, _moduleHasPrefix: function(/*String*/module){ // summary: checks to see if module has been established var mp = this._modulePrefixes; return !!(mp[module] && mp[module].value); // Boolean }, _getModulePrefix: function(/*String*/module){ // summary: gets the prefix associated with module var mp = this._modulePrefixes; if(this._moduleHasPrefix(module)){ return mp[module].value; // String } return module; // String }, _loadedUrls: [], //WARNING: // This variable is referenced by packages outside of bootstrap: // FloatingPane.js and undo/browser.js _postLoad: false, //Egad! Lots of test files push on this directly instead of using dojo.addOnLoad. _loaders: [], _unloaders: [], _loadNotifying: false }); dojo._loadPath = function(/*String*/relpath, /*String?*/module, /*Function?*/cb){ // summary: // Load a Javascript module given a relative path // // description: // Loads and interprets the script located at relpath, which is // relative to the script root directory. If the script is found but // its interpretation causes a runtime exception, that exception is // not caught by us, so the caller will see it. We return a true // value if and only if the script is found. // // relpath: // A relative path to a script (no leading '/', and typically ending // in '.js'). // module: // A module whose existance to check for after loading a path. Can be // used to determine success or failure of the load. // cb: // a callback function to pass the result of evaluating the script var uri = ((relpath.charAt(0) == '/' || relpath.match(/^\w+:/)) ? "" : this.baseUrl) + relpath; try{ return !module ? this._loadUri(uri, cb) : this._loadUriAndCheck(uri, module, cb); // Boolean }catch(e){ console.error(e); return false; // Boolean } } dojo._loadUri = function(/*String*/uri, /*Function?*/cb){ // summary: // Loads JavaScript from a URI // description: // Reads the contents of the URI, and evaluates the contents. This is // used to load modules as well as resource bundles. Returns true if // it succeeded. Returns false if the URI reading failed. Throws if // the evaluation throws. // uri: a uri which points at the script to be loaded // cb: // a callback function to process the result of evaluating the script // as an expression, typically used by the resource bundle loader to // load JSON-style resources if(this._loadedUrls[uri]){ return true; // Boolean } var contents = this._getText(uri, true); if(!contents){ return false; } // Boolean this._loadedUrls[uri] = true; this._loadedUrls.push(uri); if(cb){ contents = '('+contents+')'; }else{ //Only do the scoping if no callback. If a callback is specified, //it is most likely the i18n bundle stuff. contents = this._scopePrefix + contents + this._scopeSuffix; } if(d.isMoz){ contents += "\r\n//@ sourceURL=" + uri; } // debugging assist for Firebug var value = d["eval"](contents); if(cb){ cb(value); } return true; // Boolean } // FIXME: probably need to add logging to this method dojo._loadUriAndCheck = function(/*String*/uri, /*String*/moduleName, /*Function?*/cb){ // summary: calls loadUri then findModule and returns true if both succeed var ok = false; try{ ok = this._loadUri(uri, cb); }catch(e){ console.error("failed loading " + uri + " with error: " + e); } return !!(ok && this._loadedModules[moduleName]); // Boolean } dojo.loaded = function(){ // summary: // signal fired when initial environment and package loading is // complete. You may use dojo.addOnLoad() or dojo.connect() to // this method in order to handle initialization tasks that // require the environment to be initialized. In a browser host, // declarative widgets will be constructed when this function // finishes runing. this._loadNotifying = true; this._postLoad = true; var mll = d._loaders; //Clear listeners so new ones can be added //For other xdomain package loads after the initial load. this._loaders = []; for(var x = 0; x < mll.length; x++){ try{ mll[x](); }catch(e){ throw e; console.error("dojo.addOnLoad callback failed: " + e, e); /* let other load events fire, like the parser, but report the error */ } } this._loadNotifying = false; //Make sure nothing else got added to the onload queue //after this first run. If something did, and we are not waiting for any //more inflight resources, run again. if(d._postLoad && d._inFlightCount == 0 && mll.length){ d._callLoaded(); } } dojo.unloaded = function(){ // summary: // signal fired by impending environment destruction. You may use // dojo.addOnUnload() or dojo.connect() to this method to perform // page/application cleanup methods. var mll = this._unloaders; while(mll.length){ (mll.pop())(); } } var onto = function(arr, obj, fn){ if(!fn){ arr.push(obj); }else if(fn){ var func = (typeof fn == "string") ? obj[fn] : fn; arr.push(function(){ func.call(obj); }); } } dojo.addOnLoad = function(/*Object?*/obj, /*String|Function*/functionName){ // summary: // Registers a function to be triggered after the DOM has finished // loading and widgets declared in markup have been instantiated. // Images and CSS files may or may not have finished downloading when // the specified function is called. (Note that widgets' CSS and HTML // code is guaranteed to be downloaded before said widgets are // instantiated.) // example: // | dojo.addOnLoad(functionPointer); // | dojo.addOnLoad(object, "functionName"); // | dojo.addOnLoad(object, function(){ /* ... */}); onto(d._loaders, obj, functionName); //Added for xdomain loading. dojo.addOnLoad is used to //indicate callbacks after doing some dojo.require() statements. //In the xdomain case, if all the requires are loaded (after initial //page load), then immediately call any listeners. if(d._postLoad && d._inFlightCount == 0 && !d._loadNotifying){ d._callLoaded(); } } dojo.addOnUnload = function(/*Object?*/obj, /*String|Function?*/functionName){ // summary: // registers a function to be triggered when the page unloads // example: // | dojo.addOnUnload(functionPointer) // | dojo.addOnUnload(object, "functionName") // | dojo.addOnUnload(object, function(){ /* ... */}); onto(d._unloaders, obj, functionName); } dojo._modulesLoaded = function(){ if(d._postLoad){ return; } if(d._inFlightCount > 0){ console.warn("files still in flight!"); return; } d._callLoaded(); } dojo._callLoaded = function(){ // The "object" check is for IE, and the other opera check fixes an // issue in Opera where it could not find the body element in some // widget test cases. For 0.9, maybe route all browsers through the // setTimeout (need protection still for non-browser environments // though). This might also help the issue with FF 2.0 and freezing // issues where we try to do sync xhr while background css images are // being loaded (trac #2572)? Consider for 0.9. if(typeof setTimeout == "object" || (dojo.config.useXDomain && d.isOpera)){ if(dojo.isAIR){ setTimeout(function(){dojo.loaded();}, 0); }else{ setTimeout(dojo._scopeName + ".loaded();", 0); } }else{ d.loaded(); } } dojo._getModuleSymbols = function(/*String*/modulename){ // summary: // Converts a module name in dotted JS notation to an array // representing the path in the source tree var syms = modulename.split("."); for(var i = syms.length; i>0; i--){ var parentModule = syms.slice(0, i).join("."); if((i==1) && !this._moduleHasPrefix(parentModule)){ // Support default module directory (sibling of dojo) for top-level modules syms[0] = "../" + syms[0]; }else{ var parentModulePath = this._getModulePrefix(parentModule); if(parentModulePath != parentModule){ syms.splice(0, i, parentModulePath); break; } } } // console.debug(syms); return syms; // Array } dojo._global_omit_module_check = false; dojo._loadModule = dojo.require = function(/*String*/moduleName, /*Boolean?*/omitModuleCheck){ // summary: // loads a Javascript module from the appropriate URI // moduleName: // module name to load. Module paths are de-referenced by dojo's // internal mapping of locations to names and are disambiguated by
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -