123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397 |
- if(!dojo._hasResource["dojo._base.lang"]){
- dojo._hasResource["dojo._base.lang"] = true;
- dojo.provide("dojo._base.lang");
- (function(){
- var d = dojo, opts = Object.prototype.toString;
-
- dojo.isString = function(/*anything*/ it){
-
-
- return (typeof it == "string" || it instanceof String);
- };
- dojo.isArray = function(/*anything*/ it){
-
-
-
- return it && (it instanceof Array || typeof it == "array");
- };
- dojo.isFunction = function(/*anything*/ it){
-
-
- return opts.call(it) === "[object Function]";
- };
- dojo.isObject = function(/*anything*/ it){
-
-
-
- return it !== undefined &&
- (it === null || typeof it == "object" || d.isArray(it) || d.isFunction(it));
- };
- dojo.isArrayLike = function(/*anything*/ it){
-
-
-
-
-
-
-
-
-
-
- return it && it !== undefined &&
-
-
- !d.isString(it) && !d.isFunction(it) &&
- !(it.tagName && it.tagName.toLowerCase() == 'form') &&
- (d.isArray(it) || isFinite(it.length));
- };
- dojo.isAlien = function(/*anything*/ it){
-
-
-
- return it && !d.isFunction(it) && /\{\s*\[native code\]\s*\}/.test(String(it));
- };
- dojo.extend = function(/*Object*/ constructor, /*Object...*/ props){
-
-
-
-
- for(var i=1, l=arguments.length; i<l; i++){
- d._mixin(constructor.prototype, arguments[i]);
- }
- return constructor; // Object
- };
- dojo._hitchArgs = function(scope, method /*,...*/){
- var pre = d._toArray(arguments, 2);
- var named = d.isString(method);
- return function(){
-
- var args = d._toArray(arguments);
-
- var f = named ? (scope||d.global)[method] : method;
-
- return f && f.apply(scope || this, pre.concat(args));
- };
- };
- dojo.hitch = function(/*Object*/scope, /*Function|String*/method /*,...*/){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if(arguments.length > 2){
- return d._hitchArgs.apply(d, arguments);
- }
- if(!method){
- method = scope;
- scope = null;
- }
- if(d.isString(method)){
- scope = scope || d.global;
- if(!scope[method]){ throw(['dojo.hitch: scope["', method, '"] is null (scope="', scope, '")'].join('')); }
- return function(){ return scope[method].apply(scope, arguments || []); };
- }
- return !scope ? method : function(){ return method.apply(scope, arguments || []); };
- };
-
- dojo.delegate = dojo._delegate = (function(){
-
- function TMP(){}
- return function(obj, props){
- TMP.prototype = obj;
- var tmp = new TMP();
- TMP.prototype = null;
- if(props){
- d._mixin(tmp, props);
- }
- return tmp;
- };
- })();
-
- var efficient = function(obj, offset, startWith){
- return (startWith||[]).concat(Array.prototype.slice.call(obj, offset||0));
- };
- var slow = function(obj, offset, startWith){
- var arr = startWith||[];
- for(var x = offset || 0; x < obj.length; x++){
- arr.push(obj[x]);
- }
- return arr;
- };
-
- dojo._toArray =
- d.isIE ? function(obj){
- return ((obj.item) ? slow : efficient).apply(this, arguments);
- } :
- efficient;
- dojo.partial = function(/*Function|String*/method /*, ...*/){
-
-
-
-
-
-
- var arr = [ null ];
- return d.hitch.apply(d, arr.concat(d._toArray(arguments)));
- };
- var extraNames = d._extraNames, extraLen = extraNames.length, empty = {};
- dojo.clone = function(/*anything*/ o){
-
-
-
- if(!o || typeof o != "object" || d.isFunction(o)){
-
- return o;
- }
- if(o.nodeType && "cloneNode" in o){
-
- return o.cloneNode(true);
- }
- if(o instanceof Date){
-
- return new Date(o.getTime());
- }
- if(o instanceof RegExp){
-
- return new RegExp(o);
- }
- var r, i, l, s, name;
- if(d.isArray(o)){
-
- r = [];
- for(i = 0, l = o.length; i < l; ++i){
- if(i in o){
- r.push(d.clone(o[i]));
- }
- }
- }else{
-
- r = o.constructor ? new o.constructor() : {};
- }
- for(name in o){
-
-
-
-
- s = o[name];
- if(!(name in r) || (r[name] !== s && (!(name in empty) || empty[name] !== s))){
- r[name] = d.clone(s);
- }
- }
-
- if(extraLen){
- for(i = 0; i < extraLen; ++i){
- name = extraNames[i];
- s = o[name];
- if(!(name in r) || (r[name] !== s && (!(name in empty) || empty[name] !== s))){
- r[name] = s;
- }
- }
- }
- return r;
- };
-
- dojo.trim = String.prototype.trim ?
- function(str){ return str.trim(); } :
- function(str){ return str.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); };
-
- var _pattern = /\{([^\}]+)\}/g;
- dojo.replace = function(tmpl, map, pattern){
- return tmpl.replace(pattern || _pattern, d.isFunction(map) ?
- map : function(_, k){ return d.getObject(k, false, map); });
- };
- })();
- }
|