📄 dojo.js.uncompressed.js
字号:
// similar to other library's "$" function, takes a string // representing a DOM id or a DomNode and returns the // corresponding DomNode. If a Node is passed, this function is a // no-op. Returns a single DOM node or null, working around // several browser-specific bugs to do so. // id: DOM id or DOM Node // doc: // optional, defaults to the current value of dj_currentDocument. // Can be used to retreive node references from other documents. if((id)&&((typeof id == "string")||(id instanceof String))){ if(!doc){ doc = dj_currentDocument; } var ele = doc.getElementById(id); // workaround bug in IE and Opera 8.2 where getElementById returns wrong element if(ele && (ele.id != id) && doc.all){ ele = null; // get all matching elements with this id eles = doc.all[id]; if(eles){ // if more than 1, choose first with the correct id if(eles.length){ for(var i=0; i<eles.length; i++){ if(eles[i].id == id){ ele = eles[i]; break; } } // return 1 and only element }else{ ele = eles; } } } return ele; // DomNode } return id; // DomNode } dojo.setContext = function(/*Object*/globalObject, /*DocumentElement*/globalDocument){ // summary: // changes the behavior of many core Dojo functions that deal with // namespace and DOM lookup, changing them to work in a new global // context. The varibles dj_currentContext and dj_currentDocument // are modified as a result of calling this function. dj_currentContext = globalObject; dj_currentDocument = globalDocument; }; dojo._fireCallback = function(callback, context, cbArguments){ if((context)&&((typeof callback == "string")||(callback instanceof String))){ callback=context[callback]; } return (context ? callback.apply(context, cbArguments || [ ]) : callback()); } dojo.withGlobal = function(/*Object*/globalObject, /*Function*/callback, /*Object?*/thisObject, /*Array?*/cbArguments){ // summary: // Call callback with globalObject as dojo.global() and globalObject.document // as dojo.doc(). If provided, globalObject will be executed in the context of // object thisObject // description: // When callback() returns or throws an error, the dojo.global() and dojo.doc() will // be restored to its previous state. var rval; var oldGlob = dj_currentContext; var oldDoc = dj_currentDocument; try{ dojo.setContext(globalObject, globalObject.document); rval = dojo._fireCallback(callback, thisObject, cbArguments); }finally{ dojo.setContext(oldGlob, oldDoc); } return rval; } dojo.withDoc = function (/*Object*/documentObject, /*Function*/callback, /*Object?*/thisObject, /*Array?*/cbArguments) { // summary: // Call callback with documentObject as dojo.doc(). If provided, callback will be executed // in the context of object thisObject // description: // When callback() returns or throws an error, the dojo.doc() will // be restored to its previous state. var rval; var oldDoc = dj_currentDocument; try{ dj_currentDocument = documentObject; rval = dojo._fireCallback(callback, thisObject, cbArguments); }finally{ dj_currentDocument = oldDoc; } return rval; }} //if (typeof window != 'undefined')//Semicolon is for when this file is integrated with a custom build on one line//with some other file's contents. Sometimes that makes things not get defined//properly, particularly with the using the closure below to do all the work.;(function(){ //Don't do this work if dojo.js has already done it. if(typeof dj_usingBootstrap != "undefined"){ return; } var isRhino = false; var isSpidermonkey = false; var isDashboard = false; if((typeof this["load"] == "function")&&((typeof this["Packages"] == "function")||(typeof this["Packages"] == "object"))){ isRhino = true; }else if(typeof this["load"] == "function"){ isSpidermonkey = true; }else if(window.widget){ isDashboard = true; } var tmps = []; if((this["djConfig"])&&((djConfig["isDebug"])||(djConfig["debugAtAllCosts"]))){ tmps.push("debug.js"); } if((this["djConfig"])&&(djConfig["debugAtAllCosts"])&&(!isRhino)&&(!isDashboard)){ tmps.push("browser_debug.js"); } var loaderRoot = djConfig["baseScriptUri"]; if((this["djConfig"])&&(djConfig["baseLoaderUri"])){ loaderRoot = djConfig["baseLoaderUri"]; } for(var x=0; x < tmps.length; x++){ var spath = loaderRoot+"src/"+tmps[x]; if(isRhino||isSpidermonkey){ load(spath); } else { try { document.write("<scr"+"ipt type='text/javascript' src='"+spath+"'></scr"+"ipt>"); } catch (e) { var script = document.createElement("script"); script.src = spath; document.getElementsByTagName("head")[0].appendChild(script); } } }})();dojo.provide("dojo.string.common");dojo.string.trim = function(/* string */str, /* integer? */wh){ // summary // Trim whitespace from str. If wh > 0, trim from start, if wh < 0, trim from end, else both if(!str.replace){ return str; } if(!str.length){ return str; } var re = (wh > 0) ? (/^\s+/) : (wh < 0) ? (/\s+$/) : (/^\s+|\s+$/g); return str.replace(re, ""); // string}dojo.string.trimStart = function(/* string */str) { // summary // Trim whitespace at the beginning of 'str' return dojo.string.trim(str, 1); // string}dojo.string.trimEnd = function(/* string */str) { // summary // Trim whitespace at the end of 'str' return dojo.string.trim(str, -1);}dojo.string.repeat = function(/* string */str, /* integer */count, /* string? */separator) { // summary // Return 'str' repeated 'count' times, optionally placing 'separator' between each rep var out = ""; for(var i = 0; i < count; i++) { out += str; if(separator && i < count - 1) { out += separator; } } return out; // string}dojo.string.pad = function(/* string */str, /* integer */len/*=2*/, /* string */ c/*='0'*/, /* integer */dir/*=1*/) { // summary // Pad 'str' to guarantee that it is at least 'len' length with the character 'c' at either the // start (dir=1) or end (dir=-1) of the string var out = String(str); if(!c) { c = '0'; } if(!dir) { dir = 1; } while(out.length < len) { if(dir > 0) { out = c + out; } else { out += c; } } return out; // string}dojo.string.padLeft = function(/* string */str, /* integer */len, /* string */c) { // summary // same as dojo.string.pad(str, len, c, 1) return dojo.string.pad(str, len, c, 1); // string}dojo.string.padRight = function(/* string */str, /* integer */len, /* string */c) { // summary // same as dojo.string.pad(str, len, c, -1) return dojo.string.pad(str, len, c, -1); // string}dojo.provide("dojo.string");dojo.provide("dojo.lang.common");dojo.lang.inherits = function(/*Function*/subclass, /*Function*/superclass){ // summary: Set up inheritance between two classes. if(!dojo.lang.isFunction(superclass)){ dojo.raise("dojo.inherits: superclass argument ["+superclass+"] must be a function (subclass: ["+subclass+"']"); } subclass.prototype = new superclass(); subclass.prototype.constructor = subclass; subclass.superclass = superclass.prototype; // DEPRECATED: super is a reserved word, use 'superclass' subclass['super'] = superclass.prototype;}dojo.lang._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.protoype if((typeof tobj[x] == "undefined") || (tobj[x] != props[x])){ obj[x] = props[x]; } } // IE doesn't recognize custom toStrings in for..in if(dojo.render.html.ie && (typeof(props["toString"]) == "function") && (props["toString"] != obj["toString"]) && (props["toString"] != tobj["toString"])) { obj.toString = props.toString; } return obj; // Object}dojo.lang.mixin = function(/*Object*/obj, /*Object...*/props){ // summary: Adds all properties and methods of props to obj. for(var i=1, l=arguments.length; i<l; i++){ dojo.lang._mixin(obj, arguments[i]); } return obj; // Object}dojo.lang.extend = function(/*Object*/ constructor, /*Object...*/ props){ // summary: // Adds all properties and methods of props to constructor's // prototype, making them available to all instances created with // constructor. for(var i=1, l=arguments.length; i<l; i++){ dojo.lang._mixin(constructor.prototype, arguments[i]); } return constructor; // Object}// Promote to dojo moduledojo.inherits = dojo.lang.inherits;//dojo.lang._mixin = dojo.lang._mixin;dojo.mixin = dojo.lang.mixin;dojo.extend = dojo.lang.extend;dojo.lang.find = function( /*Array*/ array, /*Object*/ value, /*Boolean?*/ identity, /*Boolean?*/ findLast){ // summary: // Return the index of value in array, returning -1 if not found. // array: just what you think // value: the value to locate // identity: // If true, matches with identity comparison (===). If false, uses // normal comparison (==). // findLast: // If true, returns index of last instance of value. // examples: // find(array, value[, identity [findLast]]) // recommended // find(value, array[, identity [findLast]]) // deprecated // support both (array, value) and (value, array) if(!dojo.lang.isArrayLike(array) && dojo.lang.isArrayLike(value)) { dojo.deprecated('dojo.lang.find(value, array)', 'use dojo.lang.find(array, value) instead', "0.5"); var temp = array; array = value; value = temp; } var isString = dojo.lang.isString(array); if(isString) { array = array.split(""); } if(findLast) { var step = -1; var i = array.length - 1; var end = -1; } else { var step = 1; var i = 0; var end = array.length; } if(identity){ while(i != end) { if(array[i] === value){ return i; } i += step; } }else{ while(i != end) { if(array[i] == value){ return i; } i += step; } } return -1; // number}dojo.lang.indexOf = dojo.lang.find;dojo.lang.findLast = function(/*Array*/array, /*Object*/value, /*boolean?*/identity){ // summary: // Return index of last occurance of value in array, returning -1 if // not found. This is a shortcut for dojo.lang.find() with a true // value for its "findLast" parameter. // identity: // If true, matches with identity comparison (===). If false, uses // normal comparison (==). return dojo.lang.find(array, value, identity, true); // number}dojo.lang.lastIndexOf = dojo.lang.findLast;dojo.lang.inArray = function(array /*Array*/, value /*Object*/){ // summary: Return true if value is present in array. return dojo.lang.find(array, value) > -1; // boolean}/** * Partial implmentation of is* functions from * http://www.crockford.com/javascript/recommend.html * NOTE: some of these may not be the best thing to use in all situations * as they aren't part of core JS and therefore can't work in every case. * See WARNING messages inline for tips. * * The following is* functions are fairly "safe" */dojo.lang.isObject = function(/*anything*/ it){ // summary: Return true if it is an Object, Array or Function. if(typeof it == "undefined"){ return false; } return (typeof it == "object" || it === null || dojo.lang.isArray(it) || dojo.lang.isFunction(it)); // Boolean}dojo.lang.isArray = function(/*anything*/ it){ // summary: Return true if it is an Array. return (it && it instanceof Array || typeof it == "array"); // Boolean}dojo.lang.isArrayLike = function(/*anything*/ it){ // summary: // Return true if it can be used as an array (i.e. is an object with // an integer length property). if((!it)||(dojo.lang.isUndefined(it))){ return false; } if(dojo.lang.isString(it)){ return false; } if(dojo.lang.isFunction(it)){ return false; } // keeps out built-in constructors (Number, String, ...) which have length properties if(dojo.lang.isArray(it)){ return true; } // form node itself is ArrayLike, but not always iterable. Use form.elements instead. if((it.tagName)&&(it.tagName.toLowerCase()=='form')){ return false; } if(dojo.lang.isNumber(it.len
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -