📄 dojo.js.uncompressed.js
字号:
/* Copyright (c) 2004-2008, The Dojo Foundation All Rights Reserved. Licensed under the Academic Free License version 2.1 or above OR the modified BSD license. For more information on Dojo licensing, see: http://dojotoolkit.org/book/dojo-book-0-9/introduction/licensing*//* This is a compiled version of Dojo, built for deployment and not for development. To get an editable version, please visit: http://dojotoolkit.org for documentation and information on getting the source.*/;(function(){ /* dojo, dijit, and dojox must always be the first three, and in that order. djConfig.scopeMap = [ ["dojo", "fojo"], ["dijit", "fijit"], ["dojox", "fojox"] ] */ /**Build will replace this comment with a scoped djConfig **/ //The null below can be relaced by a build-time value used instead of djConfig.scopeMap. var sMap = null; //See if new scopes need to be defined. if((sMap || (typeof djConfig != "undefined" && djConfig.scopeMap)) && (typeof window != "undefined")){ var scopeDef = "", scopePrefix = "", scopeSuffix = "", scopeMap = {}, scopeMapRev = {}; sMap = sMap || djConfig.scopeMap; for(var i = 0; i < sMap.length; i++){ //Make local variables, then global variables that use the locals. var newScope = sMap[i]; scopeDef += "var " + newScope[0] + " = {}; " + newScope[1] + " = " + newScope[0] + ";" + newScope[1] + "._scopeName = '" + newScope[1] + "';"; scopePrefix += (i == 0 ? "" : ",") + newScope[0]; scopeSuffix += (i == 0 ? "" : ",") + newScope[1]; scopeMap[newScope[0]] = newScope[1]; scopeMapRev[newScope[1]] = newScope[0]; } eval(scopeDef + "dojo._scopeArgs = [" + scopeSuffix + "];"); dojo._scopePrefixArgs = scopePrefix; dojo._scopePrefix = "(function(" + scopePrefix + "){"; dojo._scopeSuffix = "})(" + scopeSuffix + ")"; dojo._scopeMap = scopeMap; dojo._scopeMapRev = scopeMapRev; }/*=====// note:// 'djConfig' does not exist under 'dojo.*' so that it can be set before the// 'dojo' variable exists.// note:// Setting any of these variables *after* the library has loaded does// nothing at all.djConfig = { // summary: // Application code can set the global 'djConfig' prior to loading // the library to override certain global settings for how dojo works. // // isDebug: Boolean // Defaults to `false`. If set to `true`, ensures that Dojo provides // extende debugging feedback via Firebug. If Firebug is not available // on your platform, setting `isDebug` to `true` will force Dojo to // pull in (and display) the version of Firebug Lite which is // integrated into the Dojo distribution, thereby always providing a // debugging/logging console when `isDebug` is enabled. Note that // Firebug's `console.*` methods are ALWAYS defined by Dojo. If // `isDebug` is false and you are on a platform without Firebug, these // methods will be defined as no-ops. isDebug: false, // debugAtAllCosts: Boolean // Defaults to `false`. If set to `true`, this triggers an alternate // mode of the package system in which dependencies are detected and // only then are resources evaluated in dependency order via // `<script>` tag inclusion. This may double-request resources and // cause problems with scripts which expect `dojo.require()` to // preform synchronously. `debugAtAllCosts` can be an invaluable // debugging aid, but when using it, ensure that all code which // depends on Dojo modules is wrapped in `dojo.addOnLoad()` handlers. // Due to the somewhat unpredictable side-effects of using // `debugAtAllCosts`, it is strongly recommended that you enable this // flag as a last resort. `debugAtAllCosts` has no effect when loading // resources across domains. For usage information, see the // [Dojo Book](http://dojotoolkit.org/book/book-dojo/part-4-meta-dojo-making-your-dojo-code-run-faster-and-better/debugging-facilities/deb) debugAtAllCosts: false, // locale: String // The locale to assume for loading localized resources in this page, // specified according to [RFC 3066](http://www.ietf.org/rfc/rfc3066.txt). // Must be specified entirely in lowercase, e.g. `en-us` and `zh-cn`. // See the documentation for `dojo.i18n` and `dojo.requireLocalization` // for details on loading localized resources. If no locale is specified, // Dojo assumes the locale of the user agent, according to `navigator.userLanguage` // or `navigator.language` properties. locale: undefined, // extraLocale: Array // No default value. Specifies additional locales whose // resources should also be loaded alongside the default locale when // calls to `dojo.requireLocalization()` are processed. extraLocale: undefined, // baseUrl: String // The directory in which `dojo.js` is located. Under normal // conditions, Dojo auto-detects the correct location from which it // was loaded. You may need to manually configure `baseUrl` in cases // where you have renamed `dojo.js` or in which `<base>` tags confuse // some browsers (e.g., IE 6). The variable `dojo.baseUrl` is assigned // either the value of `djConfig.baseUrl` if one is provided or the // auto-detected root if not. Other modules are located relative to // this path. baseUrl: undefined, // modulePaths: Object // A map of module names to paths relative to `dojo.baseUrl`. The // key/value pairs correspond directly to the arguments which // `dojo.registerModulePath` accepts. Specifiying // `djConfig.modulePaths = { "foo": "../../bar" }` is the equivalent // of calling `dojo.registerModulePath("foo", "../../bar");`. Multiple // modules may be configured via `djConfig.modulePaths`. modulePaths: {},}=====*/(function(){ // firebug stubs // if((!this["console"])||(!console["firebug"])){ if(!this["console"]){ this.console = { log: function(){} // no-op }; } var cn = [ "assert", "count", "debug", "dir", "dirxml", "error", "group", "groupEnd", "info", "profile", "profileEnd", "time", "timeEnd", "trace", "warn", "log" ]; var i=0, tn; while((tn=cn[i++])){ if(!console[tn]){ (function(){ var tcn = tn+""; console[tcn] = function(){ var a = Array.apply({}, arguments); a.unshift(tcn+":"); console.log(a.join(" ")); } })(); } } //TODOC: HOW TO DOC THIS? // dojo is the root variable of (almost all) our public symbols -- make sure it is defined. if(typeof dojo == "undefined"){ this.dojo = { _scopeName: "dojo", _scopePrefix: "", _scopePrefixArgs: "", _scopeSuffix: "", _scopeMap: {}, _scopeMapRev: {} }; } var d = dojo; //Need placeholders for dijit and dojox for scoping code. if(typeof dijit == "undefined"){ this.dijit = {_scopeName: "dijit"}; } if(typeof dojox == "undefined"){ this.dojox = {_scopeName: "dojox"}; } if(!d._scopeArgs){ d._scopeArgs = [dojo, dijit, dojox]; }/*=====dojo.global = { // summary: // Alias for the global scope // (e.g. the window object in a browser). // description: // Refer to 'dojo.global' rather than referring to window to ensure your // code runs correctly in contexts other than web browsers (e.g. Rhino on a server).}=====*/ d.global = this; d.config =/*===== djConfig = =====*/{ isDebug: false, debugAtAllCosts: false }; if(typeof djConfig != "undefined"){ for(var opt in djConfig){ d.config[opt] = djConfig[opt]; } } var _platforms = ["Browser", "Rhino", "Spidermonkey", "Mobile"]; var t; while((t=_platforms.shift())){ d["is"+t] = false; }/*===== // Override locale setting, if specified dojo.locale = { // summary: the locale as defined by Dojo (read-only) };=====*/ dojo.locale = d.config.locale; var rev = "$Rev: 13707 $".match(/\d+/); dojo.version = { // summary: // version number of dojo // major: Integer // Major version. If total version is "1.2.0beta1", will be 1 // minor: Integer // Minor version. If total version is "1.2.0beta1", will be 2 // patch: Integer // Patch version. If total version is "1.2.0beta1", will be 0 // flag: String // Descriptor flag. If total version is "1.2.0beta1", will be "beta1" // revision: Number // The SVN rev from which dojo was pulled major: 1, minor: 1, patch: 1, flag: "", revision: rev ? +rev[0] : 999999, //FIXME: use NaN? toString: function(){ with(d.version){ return major + "." + minor + "." + patch + flag + " (" + revision + ")"; // String } } } // Register with the OpenAjax hub if(typeof OpenAjax != "undefined"){ OpenAjax.hub.registerLibrary(dojo._scopeName, "http://dojotoolkit.org", d.version.toString()); } dojo._mixin = function(/*Object*/ obj, /*Object*/ props){ // summary: // Adds all properties and methods of props to obj. This addition // is "prototype extension safe", so that instances of objects // will not pass along prototype defaults. var tobj = {}; for(var x in props){ // the "tobj" condition avoid copying properties in "props" // inherited from Object.prototype. For example, if obj has a custom // toString() method, don't overwrite it with the toString() method // that props inherited from Object.prototype if(tobj[x] === undefined || tobj[x] != props[x]){ obj[x] = props[x]; } } // IE doesn't recognize custom toStrings in for..in if(d["isIE"] && props){ var p = props.toString; if(typeof p == "function" && p != obj.toString && p != tobj.toString && p != "\nfunction toString() {\n [native code]\n}\n"){ obj.toString = props.toString; } } return obj; // Object } dojo.mixin = function(/*Object*/obj, /*Object...*/props){ // summary: // Adds all properties and methods of props to obj and returns the // (now modified) obj. // description: // `dojo.mixin` can mix multiple source objects into a // destionation object which is then returned. Unlike regular // `for...in` iteration, `dojo.mixin` is also smart about avoiding // extensions which other toolkits may unwisely add to the root // object prototype // obj: // The object to mix properties into. Also the return value. // props: // One or more objects whose values are successively copied into // obj. If more than one of these objects contain the same value, // the one specified last in the function call will "win". // example: // make a shallow copy of an object // | var copy = dojo.mixin({}, source); // example: // many class constructors often take an object which specifies // values to be configured on the object. In this case, it is // often simplest to call `dojo.mixin` on the `this` object: // | dojo.declare("acme.Base", null, { // | constructor: function(properties){ // | // property configuration: // | dojo.mixin(this, properties); // | // | console.debug(this.quip); // | // ... // | }, // | quip: "I wasn't born yesterday, you know - I've seen movies.", // | // ... // | }); // | // | // create an instance of the class and configure it // | var b = new acme.Base({quip: "That's what it does!" }); // example: // copy in properties from multiple objects // | var flattened = dojo.mixin( // | { // | name: "Frylock", // | braces: true, // | } // | { // | name: "Carl Brutanananadilewski" // | } // | ); // | // | // will print "Carl Brutanananadilewski" // | console.debug(flattened.name); // | // will print "true" // | console.debug(flattened.braces); for(var i=1, l=arguments.length; i<l; i++){ d._mixin(obj, arguments[i]); } return obj; // Object } dojo._getProp = function(/*Array*/parts, /*Boolean*/create, /*Object*/context){ var obj=context || d.global; for(var i=0, p; obj && (p=parts[i]); i++){ if(i == 0 && this._scopeMap[p]){ p = this._scopeMap[p]; } obj = (p in obj ? obj[p] : (create ? obj[p]={} : undefined)); } return obj; // mixed } dojo.setObject = function(/*String*/name, /*Object*/value, /*Object?*/context){ // summary: // Set a property from a dot-separated string, such as "A.B.C" // 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. // Objects are created as needed along `path`. Returns the passed // value if setting is successful or `undefined` if not. // name: // Path to a property, in the form "A.B.C". // context: // Optional. Object to use as root of path. Defaults to // `dojo.global`. // example: // set the value of `foo.bar.baz`, regardless of whether // intermediate objects already exist: // | dojo.setObject("foo.bar.baz", value); // example: // without `dojo.setObject`, we often see code like this: // | // ensure that intermediate objects are available // | if(!obj["parent"]){ obj.parent = {}; } // | if(!obj.parent["child"]){ obj.parent.child= {}; } // | // now we can safely set the property // | obj.parent.child.prop = "some value"; // wheras with `dojo.setObject`, we can shorten that to: // | dojo.setObject("parent.child.prop", "some value", obj); var parts=name.split("."), p=parts.pop(), obj=d._getProp(parts, true, context); return obj && p ? (obj[p]=value) : undefined; // Object } dojo.getObject = function(/*String*/name, /*Boolean*/create, /*Object*/context){ // summary: // Get a property from a dot-separated string, such as "A.B.C"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -