mirror of
https://git.tt-rss.org/git/tt-rss.git
synced 2025-12-23 05:51:28 +00:00
build custom layer of Dojo to speed up loading of tt-rss (refs #293)
This commit is contained in:
@@ -5,98 +5,223 @@
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dojo._base.Color"]){
|
||||
dojo._hasResource["dojo._base.Color"]=true;
|
||||
if(!dojo._hasResource["dojo._base.Color"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo._base.Color"] = true;
|
||||
dojo.provide("dojo._base.Color");
|
||||
dojo.require("dojo._base.array");
|
||||
dojo.require("dojo._base.lang");
|
||||
|
||||
(function(){
|
||||
var d=dojo;
|
||||
dojo.Color=function(_1){
|
||||
if(_1){
|
||||
this.setColor(_1);
|
||||
}
|
||||
};
|
||||
dojo.Color.named={black:[0,0,0],silver:[192,192,192],gray:[128,128,128],white:[255,255,255],maroon:[128,0,0],red:[255,0,0],purple:[128,0,128],fuchsia:[255,0,255],green:[0,128,0],lime:[0,255,0],olive:[128,128,0],yellow:[255,255,0],navy:[0,0,128],blue:[0,0,255],teal:[0,128,128],aqua:[0,255,255],transparent:d.config.transparentColor||[255,255,255]};
|
||||
dojo.extend(dojo.Color,{r:255,g:255,b:255,a:1,_set:function(r,g,b,a){
|
||||
var t=this;
|
||||
t.r=r;
|
||||
t.g=g;
|
||||
t.b=b;
|
||||
t.a=a;
|
||||
},setColor:function(_2){
|
||||
if(d.isString(_2)){
|
||||
d.colorFromString(_2,this);
|
||||
}else{
|
||||
if(d.isArray(_2)){
|
||||
d.colorFromArray(_2,this);
|
||||
}else{
|
||||
this._set(_2.r,_2.g,_2.b,_2.a);
|
||||
if(!(_2 instanceof d.Color)){
|
||||
this.sanitize();
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
},sanitize:function(){
|
||||
return this;
|
||||
},toRgb:function(){
|
||||
var t=this;
|
||||
return [t.r,t.g,t.b];
|
||||
},toRgba:function(){
|
||||
var t=this;
|
||||
return [t.r,t.g,t.b,t.a];
|
||||
},toHex:function(){
|
||||
var _3=d.map(["r","g","b"],function(x){
|
||||
var s=this[x].toString(16);
|
||||
return s.length<2?"0"+s:s;
|
||||
},this);
|
||||
return "#"+_3.join("");
|
||||
},toCss:function(_4){
|
||||
var t=this,_5=t.r+", "+t.g+", "+t.b;
|
||||
return (_4?"rgba("+_5+", "+t.a:"rgb("+_5)+")";
|
||||
},toString:function(){
|
||||
return this.toCss(true);
|
||||
}});
|
||||
dojo.blendColors=function(_6,_7,_8,_9){
|
||||
var t=_9||new d.Color();
|
||||
d.forEach(["r","g","b","a"],function(x){
|
||||
t[x]=_6[x]+(_7[x]-_6[x])*_8;
|
||||
if(x!="a"){
|
||||
t[x]=Math.round(t[x]);
|
||||
}
|
||||
});
|
||||
return t.sanitize();
|
||||
};
|
||||
dojo.colorFromRgb=function(_a,_b){
|
||||
var m=_a.toLowerCase().match(/^rgba?\(([\s\.,0-9]+)\)/);
|
||||
return m&&dojo.colorFromArray(m[1].split(/\s*,\s*/),_b);
|
||||
};
|
||||
dojo.colorFromHex=function(_c,_d){
|
||||
var t=_d||new d.Color(),_e=(_c.length==4)?4:8,_f=(1<<_e)-1;
|
||||
_c=Number("0x"+_c.substr(1));
|
||||
if(isNaN(_c)){
|
||||
return null;
|
||||
}
|
||||
d.forEach(["b","g","r"],function(x){
|
||||
var c=_c&_f;
|
||||
_c>>=_e;
|
||||
t[x]=_e==4?17*c:c;
|
||||
});
|
||||
t.a=1;
|
||||
return t;
|
||||
};
|
||||
dojo.colorFromArray=function(a,obj){
|
||||
var t=obj||new d.Color();
|
||||
t._set(Number(a[0]),Number(a[1]),Number(a[2]),Number(a[3]));
|
||||
if(isNaN(t.a)){
|
||||
t.a=1;
|
||||
}
|
||||
return t.sanitize();
|
||||
};
|
||||
dojo.colorFromString=function(str,obj){
|
||||
var a=d.Color.named[str];
|
||||
return a&&d.colorFromArray(a,obj)||d.colorFromRgb(str,obj)||d.colorFromHex(str,obj);
|
||||
};
|
||||
|
||||
var d = dojo;
|
||||
|
||||
dojo.Color = function(/*Array|String|Object*/ color){
|
||||
// summary:
|
||||
// Takes a named string, hex string, array of rgb or rgba values,
|
||||
// an object with r, g, b, and a properties, or another `dojo.Color` object
|
||||
// and creates a new Color instance to work from.
|
||||
//
|
||||
// example:
|
||||
// Work with a Color instance:
|
||||
// | var c = new dojo.Color();
|
||||
// | c.setColor([0,0,0]); // black
|
||||
// | var hex = c.toHex(); // #000000
|
||||
//
|
||||
// example:
|
||||
// Work with a node's color:
|
||||
// | var color = dojo.style("someNode", "backgroundColor");
|
||||
// | var n = new dojo.Color(color);
|
||||
// | // adjust the color some
|
||||
// | n.r *= .5;
|
||||
// | console.log(n.toString()); // rgb(128, 255, 255);
|
||||
if(color){ this.setColor(color); }
|
||||
};
|
||||
|
||||
// FIXME:
|
||||
// there's got to be a more space-efficient way to encode or discover
|
||||
// these!! Use hex?
|
||||
dojo.Color.named = {
|
||||
black: [0,0,0],
|
||||
silver: [192,192,192],
|
||||
gray: [128,128,128],
|
||||
white: [255,255,255],
|
||||
maroon: [128,0,0],
|
||||
red: [255,0,0],
|
||||
purple: [128,0,128],
|
||||
fuchsia: [255,0,255],
|
||||
green: [0,128,0],
|
||||
lime: [0,255,0],
|
||||
olive: [128,128,0],
|
||||
yellow: [255,255,0],
|
||||
navy: [0,0,128],
|
||||
blue: [0,0,255],
|
||||
teal: [0,128,128],
|
||||
aqua: [0,255,255],
|
||||
transparent: d.config.transparentColor || [255,255,255]
|
||||
};
|
||||
|
||||
dojo.extend(dojo.Color, {
|
||||
r: 255, g: 255, b: 255, a: 1,
|
||||
_set: function(r, g, b, a){
|
||||
var t = this; t.r = r; t.g = g; t.b = b; t.a = a;
|
||||
},
|
||||
setColor: function(/*Array|String|Object*/ color){
|
||||
// summary:
|
||||
// Takes a named string, hex string, array of rgb or rgba values,
|
||||
// an object with r, g, b, and a properties, or another `dojo.Color` object
|
||||
// and sets this color instance to that value.
|
||||
//
|
||||
// example:
|
||||
// | var c = new dojo.Color(); // no color
|
||||
// | c.setColor("#ededed"); // greyish
|
||||
if(d.isString(color)){
|
||||
d.colorFromString(color, this);
|
||||
}else if(d.isArray(color)){
|
||||
d.colorFromArray(color, this);
|
||||
}else{
|
||||
this._set(color.r, color.g, color.b, color.a);
|
||||
if(!(color instanceof d.Color)){ this.sanitize(); }
|
||||
}
|
||||
return this; // dojo.Color
|
||||
},
|
||||
sanitize: function(){
|
||||
// summary:
|
||||
// Ensures the object has correct attributes
|
||||
// description:
|
||||
// the default implementation does nothing, include dojo.colors to
|
||||
// augment it with real checks
|
||||
return this; // dojo.Color
|
||||
},
|
||||
toRgb: function(){
|
||||
// summary:
|
||||
// Returns 3 component array of rgb values
|
||||
// example:
|
||||
// | var c = new dojo.Color("#000000");
|
||||
// | console.log(c.toRgb()); // [0,0,0]
|
||||
var t = this;
|
||||
return [t.r, t.g, t.b]; // Array
|
||||
},
|
||||
toRgba: function(){
|
||||
// summary:
|
||||
// Returns a 4 component array of rgba values from the color
|
||||
// represented by this object.
|
||||
var t = this;
|
||||
return [t.r, t.g, t.b, t.a]; // Array
|
||||
},
|
||||
toHex: function(){
|
||||
// summary:
|
||||
// Returns a CSS color string in hexadecimal representation
|
||||
// example:
|
||||
// | console.log(new dojo.Color([0,0,0]).toHex()); // #000000
|
||||
var arr = d.map(["r", "g", "b"], function(x){
|
||||
var s = this[x].toString(16);
|
||||
return s.length < 2 ? "0" + s : s;
|
||||
}, this);
|
||||
return "#" + arr.join(""); // String
|
||||
},
|
||||
toCss: function(/*Boolean?*/ includeAlpha){
|
||||
// summary:
|
||||
// Returns a css color string in rgb(a) representation
|
||||
// example:
|
||||
// | var c = new dojo.Color("#FFF").toCss();
|
||||
// | console.log(c); // rgb('255','255','255')
|
||||
var t = this, rgb = t.r + ", " + t.g + ", " + t.b;
|
||||
return (includeAlpha ? "rgba(" + rgb + ", " + t.a : "rgb(" + rgb) + ")"; // String
|
||||
},
|
||||
toString: function(){
|
||||
// summary:
|
||||
// Returns a visual representation of the color
|
||||
return this.toCss(true); // String
|
||||
}
|
||||
});
|
||||
|
||||
dojo.blendColors = function(
|
||||
/*dojo.Color*/ start,
|
||||
/*dojo.Color*/ end,
|
||||
/*Number*/ weight,
|
||||
/*dojo.Color?*/ obj
|
||||
){
|
||||
// summary:
|
||||
// Blend colors end and start with weight from 0 to 1, 0.5 being a 50/50 blend,
|
||||
// can reuse a previously allocated dojo.Color object for the result
|
||||
var t = obj || new d.Color();
|
||||
d.forEach(["r", "g", "b", "a"], function(x){
|
||||
t[x] = start[x] + (end[x] - start[x]) * weight;
|
||||
if(x != "a"){ t[x] = Math.round(t[x]); }
|
||||
});
|
||||
return t.sanitize(); // dojo.Color
|
||||
};
|
||||
|
||||
dojo.colorFromRgb = function(/*String*/ color, /*dojo.Color?*/ obj){
|
||||
// summary:
|
||||
// Returns a `dojo.Color` instance from a string of the form
|
||||
// "rgb(...)" or "rgba(...)". Optionally accepts a `dojo.Color`
|
||||
// object to update with the parsed value and return instead of
|
||||
// creating a new object.
|
||||
// returns:
|
||||
// A dojo.Color object. If obj is passed, it will be the return value.
|
||||
var m = color.toLowerCase().match(/^rgba?\(([\s\.,0-9]+)\)/);
|
||||
return m && dojo.colorFromArray(m[1].split(/\s*,\s*/), obj); // dojo.Color
|
||||
};
|
||||
|
||||
dojo.colorFromHex = function(/*String*/ color, /*dojo.Color?*/ obj){
|
||||
// summary:
|
||||
// Converts a hex string with a '#' prefix to a color object.
|
||||
// Supports 12-bit #rgb shorthand. Optionally accepts a
|
||||
// `dojo.Color` object to update with the parsed value.
|
||||
//
|
||||
// returns:
|
||||
// A dojo.Color object. If obj is passed, it will be the return value.
|
||||
//
|
||||
// example:
|
||||
// | var thing = dojo.colorFromHex("#ededed"); // grey, longhand
|
||||
//
|
||||
// example:
|
||||
// | var thing = dojo.colorFromHex("#000"); // black, shorthand
|
||||
var t = obj || new d.Color(),
|
||||
bits = (color.length == 4) ? 4 : 8,
|
||||
mask = (1 << bits) - 1;
|
||||
color = Number("0x" + color.substr(1));
|
||||
if(isNaN(color)){
|
||||
return null; // dojo.Color
|
||||
}
|
||||
d.forEach(["b", "g", "r"], function(x){
|
||||
var c = color & mask;
|
||||
color >>= bits;
|
||||
t[x] = bits == 4 ? 17 * c : c;
|
||||
});
|
||||
t.a = 1;
|
||||
return t; // dojo.Color
|
||||
};
|
||||
|
||||
dojo.colorFromArray = function(/*Array*/ a, /*dojo.Color?*/ obj){
|
||||
// summary:
|
||||
// Builds a `dojo.Color` from a 3 or 4 element array, mapping each
|
||||
// element in sequence to the rgb(a) values of the color.
|
||||
// example:
|
||||
// | var myColor = dojo.colorFromArray([237,237,237,0.5]); // grey, 50% alpha
|
||||
// returns:
|
||||
// A dojo.Color object. If obj is passed, it will be the return value.
|
||||
var t = obj || new d.Color();
|
||||
t._set(Number(a[0]), Number(a[1]), Number(a[2]), Number(a[3]));
|
||||
if(isNaN(t.a)){ t.a = 1; }
|
||||
return t.sanitize(); // dojo.Color
|
||||
};
|
||||
|
||||
dojo.colorFromString = function(/*String*/ str, /*dojo.Color?*/ obj){
|
||||
// summary:
|
||||
// Parses `str` for a color value. Accepts hex, rgb, and rgba
|
||||
// style color values.
|
||||
// description:
|
||||
// Acceptable input values for str may include arrays of any form
|
||||
// accepted by dojo.colorFromArray, hex strings such as "#aaaaaa", or
|
||||
// rgb or rgba strings such as "rgb(133, 200, 16)" or "rgba(10, 10,
|
||||
// 10, 50)"
|
||||
// returns:
|
||||
// A dojo.Color object. If obj is passed, it will be the return value.
|
||||
var a = d.Color.named[str];
|
||||
return a && d.colorFromArray(a, obj) || d.colorFromRgb(str, obj) || d.colorFromHex(str, obj);
|
||||
};
|
||||
})();
|
||||
|
||||
}
|
||||
|
||||
@@ -5,126 +5,338 @@
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dojo._base.Deferred"]){
|
||||
dojo._hasResource["dojo._base.Deferred"]=true;
|
||||
if(!dojo._hasResource["dojo._base.Deferred"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo._base.Deferred"] = true;
|
||||
dojo.provide("dojo._base.Deferred");
|
||||
dojo.require("dojo._base.lang");
|
||||
|
||||
(function(){
|
||||
var _1=function(){
|
||||
};
|
||||
var _2=Object.freeze||function(){
|
||||
};
|
||||
dojo.Deferred=function(_3){
|
||||
var _4,_5,_6,_7,_8;
|
||||
var _9=this.promise={};
|
||||
function _a(_b){
|
||||
if(_5){
|
||||
throw new Error("This deferred has already been resolved");
|
||||
}
|
||||
_4=_b;
|
||||
_5=true;
|
||||
_c();
|
||||
};
|
||||
function _c(){
|
||||
var _d;
|
||||
while(!_d&&_8){
|
||||
var _e=_8;
|
||||
_8=_8.next;
|
||||
if(_d=(_e.progress==_1)){
|
||||
_5=false;
|
||||
}
|
||||
var _f=(_6?_e.error:_e.resolved);
|
||||
if(_f){
|
||||
try{
|
||||
var _10=_f(_4);
|
||||
if(_10&&typeof _10.then==="function"){
|
||||
_10.then(dojo.hitch(_e.deferred,"resolve"),dojo.hitch(_e.deferred,"reject"));
|
||||
continue;
|
||||
}
|
||||
var _11=_d&&_10===undefined;
|
||||
_e.deferred[_11&&_6?"reject":"resolve"](_11?_4:_10);
|
||||
}
|
||||
catch(e){
|
||||
_e.deferred.reject(e);
|
||||
}
|
||||
}else{
|
||||
if(_6){
|
||||
_e.deferred.reject(_4);
|
||||
}else{
|
||||
_e.deferred.resolve(_4);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
this.resolve=this.callback=function(_12){
|
||||
this.fired=0;
|
||||
this.results=[_12,null];
|
||||
_a(_12);
|
||||
};
|
||||
this.reject=this.errback=function(_13){
|
||||
_6=true;
|
||||
this.fired=1;
|
||||
_a(_13);
|
||||
this.results=[null,_13];
|
||||
if(!_13||_13.log!==false){
|
||||
(dojo.config.deferredOnError||function(x){
|
||||
console.error(x);
|
||||
})(_13);
|
||||
}
|
||||
};
|
||||
this.progress=function(_14){
|
||||
var _15=_8;
|
||||
while(_15){
|
||||
var _16=_15.progress;
|
||||
_16&&_16(_14);
|
||||
_15=_15.next;
|
||||
}
|
||||
};
|
||||
this.addCallbacks=function(_17,_18){
|
||||
this.then(_17,_18,_1);
|
||||
return this;
|
||||
};
|
||||
this.then=_9.then=function(_19,_1a,_1b){
|
||||
var _1c=_1b==_1?this:new dojo.Deferred(_9.cancel);
|
||||
var _1d={resolved:_19,error:_1a,progress:_1b,deferred:_1c};
|
||||
if(_8){
|
||||
_7=_7.next=_1d;
|
||||
}else{
|
||||
_8=_7=_1d;
|
||||
}
|
||||
if(_5){
|
||||
_c();
|
||||
}
|
||||
return _1c.promise;
|
||||
};
|
||||
var _1e=this;
|
||||
this.cancel=_9.cancel=function(){
|
||||
if(!_5){
|
||||
var _1f=_3&&_3(_1e);
|
||||
if(!_5){
|
||||
if(!(_1f instanceof Error)){
|
||||
_1f=new Error(_1f);
|
||||
}
|
||||
_1f.log=false;
|
||||
_1e.reject(_1f);
|
||||
}
|
||||
}
|
||||
};
|
||||
_2(_9);
|
||||
};
|
||||
dojo.extend(dojo.Deferred,{addCallback:function(_20){
|
||||
return this.addCallbacks(dojo.hitch.apply(dojo,arguments));
|
||||
},addErrback:function(_21){
|
||||
return this.addCallbacks(null,dojo.hitch.apply(dojo,arguments));
|
||||
},addBoth:function(_22){
|
||||
var _23=dojo.hitch.apply(dojo,arguments);
|
||||
return this.addCallbacks(_23,_23);
|
||||
},fired:-1});
|
||||
var mutator = function(){};
|
||||
var freeze = Object.freeze || function(){};
|
||||
// A deferred provides an API for creating and resolving a promise.
|
||||
dojo.Deferred = function(/*Function?*/canceller){
|
||||
// summary:
|
||||
// Deferreds provide a generic means for encapsulating an asynchronous
|
||||
// operation and notifying users of the completion and result of the operation.
|
||||
// description:
|
||||
// The dojo.Deferred API is based on the concept of promises that provide a
|
||||
// generic interface into the eventual completion of an asynchronous action.
|
||||
// The motivation for promises fundamentally is about creating a
|
||||
// separation of concerns that allows one to achieve the same type of
|
||||
// call patterns and logical data flow in asynchronous code as can be
|
||||
// achieved in synchronous code. Promises allows one
|
||||
// to be able to call a function purely with arguments needed for
|
||||
// execution, without conflating the call with concerns of whether it is
|
||||
// sync or async. One shouldn't need to alter a call's arguments if the
|
||||
// implementation switches from sync to async (or vice versa). By having
|
||||
// async functions return promises, the concerns of making the call are
|
||||
// separated from the concerns of asynchronous interaction (which are
|
||||
// handled by the promise).
|
||||
//
|
||||
// The dojo.Deferred is a type of promise that provides methods for fulfilling the
|
||||
// promise with a successful result or an error. The most important method for
|
||||
// working with Dojo's promises is the then() method, which follows the
|
||||
// CommonJS proposed promise API. An example of using a Dojo promise:
|
||||
//
|
||||
// | var resultingPromise = someAsyncOperation.then(function(result){
|
||||
// | ... handle result ...
|
||||
// | },
|
||||
// | function(error){
|
||||
// | ... handle error ...
|
||||
// | });
|
||||
//
|
||||
// The .then() call returns a new promise that represents the result of the
|
||||
// execution of the callback. The callbacks will never affect the original promises value.
|
||||
//
|
||||
// The dojo.Deferred instances also provide the following functions for backwards compatibility:
|
||||
//
|
||||
// * addCallback(handler)
|
||||
// * addErrback(handler)
|
||||
// * callback(result)
|
||||
// * errback(result)
|
||||
//
|
||||
// Callbacks are allowed to return promisesthemselves, so
|
||||
// you can build complicated sequences of events with ease.
|
||||
//
|
||||
// The creator of the Deferred may specify a canceller. The canceller
|
||||
// is a function that will be called if Deferred.cancel is called
|
||||
// before the Deferred fires. You can use this to implement clean
|
||||
// aborting of an XMLHttpRequest, etc. Note that cancel will fire the
|
||||
// deferred with a CancelledError (unless your canceller returns
|
||||
// another kind of error), so the errbacks should be prepared to
|
||||
// handle that error for cancellable Deferreds.
|
||||
// example:
|
||||
// | var deferred = new dojo.Deferred();
|
||||
// | setTimeout(function(){ deferred.callback({success: true}); }, 1000);
|
||||
// | return deferred;
|
||||
// example:
|
||||
// Deferred objects are often used when making code asynchronous. It
|
||||
// may be easiest to write functions in a synchronous manner and then
|
||||
// split code using a deferred to trigger a response to a long-lived
|
||||
// operation. For example, instead of register a callback function to
|
||||
// denote when a rendering operation completes, the function can
|
||||
// simply return a deferred:
|
||||
//
|
||||
// | // callback style:
|
||||
// | function renderLotsOfData(data, callback){
|
||||
// | var success = false
|
||||
// | try{
|
||||
// | for(var x in data){
|
||||
// | renderDataitem(data[x]);
|
||||
// | }
|
||||
// | success = true;
|
||||
// | }catch(e){ }
|
||||
// | if(callback){
|
||||
// | callback(success);
|
||||
// | }
|
||||
// | }
|
||||
//
|
||||
// | // using callback style
|
||||
// | renderLotsOfData(someDataObj, function(success){
|
||||
// | // handles success or failure
|
||||
// | if(!success){
|
||||
// | promptUserToRecover();
|
||||
// | }
|
||||
// | });
|
||||
// | // NOTE: no way to add another callback here!!
|
||||
// example:
|
||||
// Using a Deferred doesn't simplify the sending code any, but it
|
||||
// provides a standard interface for callers and senders alike,
|
||||
// providing both with a simple way to service multiple callbacks for
|
||||
// an operation and freeing both sides from worrying about details
|
||||
// such as "did this get called already?". With Deferreds, new
|
||||
// callbacks can be added at any time.
|
||||
//
|
||||
// | // Deferred style:
|
||||
// | function renderLotsOfData(data){
|
||||
// | var d = new dojo.Deferred();
|
||||
// | try{
|
||||
// | for(var x in data){
|
||||
// | renderDataitem(data[x]);
|
||||
// | }
|
||||
// | d.callback(true);
|
||||
// | }catch(e){
|
||||
// | d.errback(new Error("rendering failed"));
|
||||
// | }
|
||||
// | return d;
|
||||
// | }
|
||||
//
|
||||
// | // using Deferred style
|
||||
// | renderLotsOfData(someDataObj).then(null, function(){
|
||||
// | promptUserToRecover();
|
||||
// | });
|
||||
// | // NOTE: addErrback and addCallback both return the Deferred
|
||||
// | // again, so we could chain adding callbacks or save the
|
||||
// | // deferred for later should we need to be notified again.
|
||||
// example:
|
||||
// In this example, renderLotsOfData is syncrhonous and so both
|
||||
// versions are pretty artificial. Putting the data display on a
|
||||
// timeout helps show why Deferreds rock:
|
||||
//
|
||||
// | // Deferred style and async func
|
||||
// | function renderLotsOfData(data){
|
||||
// | var d = new dojo.Deferred();
|
||||
// | setTimeout(function(){
|
||||
// | try{
|
||||
// | for(var x in data){
|
||||
// | renderDataitem(data[x]);
|
||||
// | }
|
||||
// | d.callback(true);
|
||||
// | }catch(e){
|
||||
// | d.errback(new Error("rendering failed"));
|
||||
// | }
|
||||
// | }, 100);
|
||||
// | return d;
|
||||
// | }
|
||||
//
|
||||
// | // using Deferred style
|
||||
// | renderLotsOfData(someDataObj).then(null, function(){
|
||||
// | promptUserToRecover();
|
||||
// | });
|
||||
//
|
||||
// Note that the caller doesn't have to change his code at all to
|
||||
// handle the asynchronous case.
|
||||
var result, finished, isError, head, nextListener;
|
||||
var promise = this.promise = {};
|
||||
|
||||
function complete(value){
|
||||
if(finished){
|
||||
throw new Error("This deferred has already been resolved");
|
||||
}
|
||||
result = value;
|
||||
finished = true;
|
||||
notify();
|
||||
}
|
||||
function notify(){
|
||||
var mutated;
|
||||
while(!mutated && nextListener){
|
||||
var listener = nextListener;
|
||||
nextListener = nextListener.next;
|
||||
if(mutated = (listener.progress == mutator)){ // assignment and check
|
||||
finished = false;
|
||||
}
|
||||
var func = (isError ? listener.error : listener.resolved);
|
||||
if (func) {
|
||||
try {
|
||||
var newResult = func(result);
|
||||
if (newResult && typeof newResult.then === "function") {
|
||||
newResult.then(dojo.hitch(listener.deferred, "resolve"), dojo.hitch(listener.deferred, "reject"));
|
||||
continue;
|
||||
}
|
||||
var unchanged = mutated && newResult === undefined;
|
||||
listener.deferred[unchanged && isError ? "reject" : "resolve"](unchanged ? result : newResult);
|
||||
}
|
||||
catch (e) {
|
||||
listener.deferred.reject(e);
|
||||
}
|
||||
}else {
|
||||
if(isError){
|
||||
listener.deferred.reject(result);
|
||||
}else{
|
||||
listener.deferred.resolve(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// calling resolve will resolve the promise
|
||||
this.resolve = this.callback = function(value){
|
||||
// summary:
|
||||
// Fulfills the Deferred instance successfully with the provide value
|
||||
this.fired = 0;
|
||||
this.results = [value, null];
|
||||
complete(value);
|
||||
};
|
||||
|
||||
|
||||
// calling error will indicate that the promise failed
|
||||
this.reject = this.errback = function(error){
|
||||
// summary:
|
||||
// Fulfills the Deferred instance as an error with the provided error
|
||||
isError = true;
|
||||
this.fired = 1;
|
||||
complete(error);
|
||||
this.results = [null, error];
|
||||
if(!error || error.log !== false){
|
||||
(dojo.config.deferredOnError || function(x){ console.error(x); })(error);
|
||||
}
|
||||
};
|
||||
// call progress to provide updates on the progress on the completion of the promise
|
||||
this.progress = function(update){
|
||||
// summary
|
||||
// Send progress events to all listeners
|
||||
var listener = nextListener;
|
||||
while(listener){
|
||||
var progress = listener.progress;
|
||||
progress && progress(update);
|
||||
listener = listener.next;
|
||||
}
|
||||
};
|
||||
this.addCallbacks = function(/*Function?*/callback, /*Function?*/errback){
|
||||
this.then(callback, errback, mutator);
|
||||
return this;
|
||||
};
|
||||
// provide the implementation of the promise
|
||||
this.then = promise.then = function(/*Function?*/resolvedCallback, /*Function?*/errorCallback, /*Function?*/progressCallback){
|
||||
// summary
|
||||
// Adds a fulfilledHandler, errorHandler, and progressHandler to be called for
|
||||
// completion of a promise. The fulfilledHandler is called when the promise
|
||||
// is fulfilled. The errorHandler is called when a promise fails. The
|
||||
// progressHandler is called for progress events. All arguments are optional
|
||||
// and non-function values are ignored. The progressHandler is not only an
|
||||
// optional argument, but progress events are purely optional. Promise
|
||||
// providers are not required to ever create progress events.
|
||||
//
|
||||
// This function will return a new promise that is fulfilled when the given
|
||||
// fulfilledHandler or errorHandler callback is finished. This allows promise
|
||||
// operations to be chained together. The value returned from the callback
|
||||
// handler is the fulfillment value for the returned promise. If the callback
|
||||
// throws an error, the returned promise will be moved to failed state.
|
||||
//
|
||||
// example:
|
||||
// An example of using a CommonJS compliant promise:
|
||||
// | asyncComputeTheAnswerToEverything().
|
||||
// | then(addTwo).
|
||||
// | then(printResult, onError);
|
||||
// | >44
|
||||
//
|
||||
var returnDeferred = progressCallback == mutator ? this : new dojo.Deferred(promise.cancel);
|
||||
var listener = {
|
||||
resolved: resolvedCallback,
|
||||
error: errorCallback,
|
||||
progress: progressCallback,
|
||||
deferred: returnDeferred
|
||||
};
|
||||
if(nextListener){
|
||||
head = head.next = listener;
|
||||
}
|
||||
else{
|
||||
nextListener = head = listener;
|
||||
}
|
||||
if(finished){
|
||||
notify();
|
||||
}
|
||||
return returnDeferred.promise;
|
||||
};
|
||||
var deferred = this;
|
||||
this.cancel = promise.cancel = function () {
|
||||
// summary:
|
||||
// Cancels the asynchronous operation
|
||||
if(!finished){
|
||||
var error = canceller && canceller(deferred);
|
||||
if(!finished){
|
||||
if (!(error instanceof Error)) {
|
||||
error = new Error(error);
|
||||
}
|
||||
error.log = false;
|
||||
deferred.reject(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
freeze(promise);
|
||||
};
|
||||
dojo.extend(dojo.Deferred, {
|
||||
addCallback: function (/*Function*/callback) {
|
||||
return this.addCallbacks(dojo.hitch.apply(dojo, arguments));
|
||||
},
|
||||
|
||||
addErrback: function (/*Function*/errback) {
|
||||
return this.addCallbacks(null, dojo.hitch.apply(dojo, arguments));
|
||||
},
|
||||
|
||||
addBoth: function (/*Function*/callback) {
|
||||
var enclosed = dojo.hitch.apply(dojo, arguments);
|
||||
return this.addCallbacks(enclosed, enclosed);
|
||||
},
|
||||
fired: -1
|
||||
});
|
||||
})();
|
||||
dojo.when=function(_24,_25,_26,_27){
|
||||
if(_24&&typeof _24.then==="function"){
|
||||
return _24.then(_25,_26,_27);
|
||||
}
|
||||
return _25(_24);
|
||||
dojo.when = function(promiseOrValue, /*Function?*/callback, /*Function?*/errback, /*Function?*/progressHandler){
|
||||
// summary:
|
||||
// This provides normalization between normal synchronous values and
|
||||
// asynchronous promises, so you can interact with them in a common way
|
||||
// example:
|
||||
// | function printFirstAndList(items){
|
||||
// | dojo.when(findFirst(items), console.log);
|
||||
// | dojo.when(findLast(items), console.log);
|
||||
// | }
|
||||
// | function findFirst(items){
|
||||
// | return dojo.when(items, function(items){
|
||||
// | return items[0];
|
||||
// | });
|
||||
// | }
|
||||
// | function findLast(items){
|
||||
// | return dojo.when(items, function(items){
|
||||
// | return items[items.length];
|
||||
// | });
|
||||
// | }
|
||||
// And now all three of his functions can be used sync or async.
|
||||
// | printFirstAndLast([1,2,3,4]) will work just as well as
|
||||
// | printFirstAndLast(dojo.xhrGet(...));
|
||||
|
||||
if(promiseOrValue && typeof promiseOrValue.then === "function"){
|
||||
return promiseOrValue.then(callback, errback, progressHandler);
|
||||
}
|
||||
return callback(promiseOrValue);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
606
lib/dojo/_base/_loader/bootstrap.js
vendored
606
lib/dojo/_base/_loader/bootstrap.js
vendored
@@ -5,116 +5,500 @@
|
||||
*/
|
||||
|
||||
|
||||
/*=====
|
||||
// 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
|
||||
// extended 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. The path should end in a slash.
|
||||
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: {},
|
||||
// afterOnLoad: Boolean
|
||||
// Indicates Dojo was added to the page after the page load. In this case
|
||||
// Dojo will not wait for the page DOMContentLoad/load events and fire
|
||||
// its dojo.addOnLoad callbacks after making sure all outstanding
|
||||
// dojo.required modules have loaded. Only works with a built dojo.js,
|
||||
// it does not work the dojo.js directly from source control.
|
||||
afterOnLoad: false,
|
||||
// addOnLoad: Function or Array
|
||||
// Adds a callback via dojo.addOnLoad. Useful when Dojo is added after
|
||||
// the page loads and djConfig.afterOnLoad is true. Supports the same
|
||||
// arguments as dojo.addOnLoad. When using a function reference, use
|
||||
// `djConfig.addOnLoad = function(){};`. For object with function name use
|
||||
// `djConfig.addOnLoad = [myObject, "functionName"];` and for object with
|
||||
// function reference use
|
||||
// `djConfig.addOnLoad = [myObject, function(){}];`
|
||||
addOnLoad: null,
|
||||
// require: Array
|
||||
// An array of module names to be loaded immediately after dojo.js has been included
|
||||
// in a page.
|
||||
require: [],
|
||||
// defaultDuration: Array
|
||||
// Default duration, in milliseconds, for wipe and fade animations within dijits.
|
||||
// Assigned to dijit.defaultDuration.
|
||||
defaultDuration: 200,
|
||||
// dojoBlankHtmlUrl: String
|
||||
// Used by some modules to configure an empty iframe. Used by dojo.io.iframe and
|
||||
// dojo.back, and dijit popup support in IE where an iframe is needed to make sure native
|
||||
// controls do not bleed through the popups. Normally this configuration variable
|
||||
// does not need to be set, except when using cross-domain/CDN Dojo builds.
|
||||
// Save dojo/resources/blank.html to your domain and set `djConfig.dojoBlankHtmlUrl`
|
||||
// to the path on your domain your copy of blank.html.
|
||||
dojoBlankHtmlUrl: undefined,
|
||||
// ioPublish: Boolean?
|
||||
// Set this to true to enable publishing of topics for the different phases of
|
||||
// IO operations. Publishing is done via dojo.publish. See dojo.__IoPublish for a list
|
||||
// of topics that are published.
|
||||
ioPublish: false,
|
||||
// useCustomLogger: Anything?
|
||||
// If set to a value that evaluates to true such as a string or array and
|
||||
// isDebug is true and Firebug is not available or running, then it bypasses
|
||||
// the creation of Firebug Lite allowing you to define your own console object.
|
||||
useCustomLogger: undefined,
|
||||
// transparentColor: Array
|
||||
// Array containing the r, g, b components used as transparent color in dojo.Color;
|
||||
// if undefined, [255,255,255] (white) will be used.
|
||||
transparentColor: undefined,
|
||||
// skipIeDomLoaded: Boolean
|
||||
// For IE only, skip the DOMContentLoaded hack used. Sometimes it can cause an Operation
|
||||
// Aborted error if the rest of the page triggers script defers before the DOM is ready.
|
||||
// If this is config value is set to true, then dojo.addOnLoad callbacks will not be
|
||||
// triggered until the page load event, which is after images and iframes load. If you
|
||||
// want to trigger the callbacks sooner, you can put a script block in the bottom of
|
||||
// your HTML that calls dojo._loadInit();. If you are using multiversion support, change
|
||||
// "dojo." to the appropriate scope name for dojo.
|
||||
skipIeDomLoaded: false
|
||||
}
|
||||
=====*/
|
||||
|
||||
(function(){
|
||||
if(typeof this["loadFirebugConsole"]=="function"){
|
||||
this["loadFirebugConsole"]();
|
||||
}else{
|
||||
this.console=this.console||{};
|
||||
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 _1=tn+"";
|
||||
console[_1]=("log" in console)?function(){
|
||||
var a=Array.apply({},arguments);
|
||||
a.unshift(_1+":");
|
||||
console["log"](a.join(" "));
|
||||
}:function(){
|
||||
};
|
||||
console[_1]._fake=true;
|
||||
})();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(typeof dojo=="undefined"){
|
||||
dojo={_scopeName:"dojo",_scopePrefix:"",_scopePrefixArgs:"",_scopeSuffix:"",_scopeMap:{},_scopeMapRev:{}};
|
||||
}
|
||||
var d=dojo;
|
||||
if(typeof dijit=="undefined"){
|
||||
dijit={_scopeName:"dijit"};
|
||||
}
|
||||
if(typeof dojox=="undefined"){
|
||||
dojox={_scopeName:"dojox"};
|
||||
}
|
||||
if(!d._scopeArgs){
|
||||
d._scopeArgs=[dojo,dijit,dojox];
|
||||
}
|
||||
d.global=this;
|
||||
d.config={isDebug:false,debugAtAllCosts:false};
|
||||
if(typeof djConfig!="undefined"){
|
||||
for(var _2 in djConfig){
|
||||
d.config[_2]=djConfig[_2];
|
||||
}
|
||||
}
|
||||
dojo.locale=d.config.locale;
|
||||
var _3="$Rev: 22487 $".match(/\d+/);
|
||||
dojo.version={major:1,minor:5,patch:0,flag:"",revision:_3?+_3[0]:NaN,toString:function(){
|
||||
with(d.version){
|
||||
return major+"."+minor+"."+patch+flag+" ("+revision+")";
|
||||
}
|
||||
}};
|
||||
if(typeof OpenAjax!="undefined"){
|
||||
OpenAjax.hub.registerLibrary(dojo._scopeName,"http://dojotoolkit.org",d.version.toString());
|
||||
}
|
||||
var _4,_5,_6={};
|
||||
for(var i in {toString:1}){
|
||||
_4=[];
|
||||
break;
|
||||
}
|
||||
dojo._extraNames=_4=_4||["hasOwnProperty","valueOf","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","constructor"];
|
||||
_5=_4.length;
|
||||
dojo._mixin=function(_7,_8){
|
||||
var _9,s,i;
|
||||
for(_9 in _8){
|
||||
s=_8[_9];
|
||||
if(!(_9 in _7)||(_7[_9]!==s&&(!(_9 in _6)||_6[_9]!==s))){
|
||||
_7[_9]=s;
|
||||
}
|
||||
}
|
||||
if(_5&&_8){
|
||||
for(i=0;i<_5;++i){
|
||||
_9=_4[i];
|
||||
s=_8[_9];
|
||||
if(!(_9 in _7)||(_7[_9]!==s&&(!(_9 in _6)||_6[_9]!==s))){
|
||||
_7[_9]=s;
|
||||
}
|
||||
}
|
||||
}
|
||||
return _7;
|
||||
};
|
||||
dojo.mixin=function(_a,_b){
|
||||
if(!_a){
|
||||
_a={};
|
||||
}
|
||||
for(var i=1,l=arguments.length;i<l;i++){
|
||||
d._mixin(_a,arguments[i]);
|
||||
}
|
||||
return _a;
|
||||
};
|
||||
dojo._getProp=function(_c,_d,_e){
|
||||
var _f=_e||d.global;
|
||||
for(var i=0,p;_f&&(p=_c[i]);i++){
|
||||
if(i==0&&d._scopeMap[p]){
|
||||
p=d._scopeMap[p];
|
||||
}
|
||||
_f=(p in _f?_f[p]:(_d?_f[p]={}:undefined));
|
||||
}
|
||||
return _f;
|
||||
};
|
||||
dojo.setObject=function(_10,_11,_12){
|
||||
var _13=_10.split("."),p=_13.pop(),obj=d._getProp(_13,true,_12);
|
||||
return obj&&p?(obj[p]=_11):undefined;
|
||||
};
|
||||
dojo.getObject=function(_14,_15,_16){
|
||||
return d._getProp(_14.split("."),_15,_16);
|
||||
};
|
||||
dojo.exists=function(_17,obj){
|
||||
return !!d.getObject(_17,false,obj);
|
||||
};
|
||||
dojo["eval"]=function(_18){
|
||||
return d.global.eval?d.global.eval(_18):eval(_18);
|
||||
};
|
||||
d.deprecated=d.experimental=function(){
|
||||
};
|
||||
// firebug stubs
|
||||
|
||||
if(typeof this["loadFirebugConsole"] == "function"){
|
||||
// for Firebug 1.2
|
||||
this["loadFirebugConsole"]();
|
||||
}else{
|
||||
this.console = this.console || {};
|
||||
|
||||
// Be careful to leave 'log' always at the end
|
||||
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] = ('log' in console) ? function(){
|
||||
var a = Array.apply({}, arguments);
|
||||
a.unshift(tcn+":");
|
||||
console["log"](a.join(" "));
|
||||
} : function(){}
|
||||
console[tcn]._fake = true;
|
||||
})();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//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"){
|
||||
dojo = {
|
||||
_scopeName: "dojo",
|
||||
_scopePrefix: "",
|
||||
_scopePrefixArgs: "",
|
||||
_scopeSuffix: "",
|
||||
_scopeMap: {},
|
||||
_scopeMapRev: {}
|
||||
};
|
||||
}
|
||||
|
||||
var d = dojo;
|
||||
|
||||
//Need placeholders for dijit and dojox for scoping code.
|
||||
if(typeof dijit == "undefined"){
|
||||
dijit = {_scopeName: "dijit"};
|
||||
}
|
||||
if(typeof dojox == "undefined"){
|
||||
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];
|
||||
}
|
||||
}
|
||||
|
||||
/*=====
|
||||
// Override locale setting, if specified
|
||||
dojo.locale = {
|
||||
// summary: the locale as defined by Dojo (read-only)
|
||||
};
|
||||
=====*/
|
||||
dojo.locale = d.config.locale;
|
||||
|
||||
var rev = "$Rev: 22487 $".match(/\d+/);
|
||||
|
||||
/*=====
|
||||
dojo.version = function(){
|
||||
// summary:
|
||||
// Version number of the Dojo Toolkit
|
||||
// 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
|
||||
this.major = 0;
|
||||
this.minor = 0;
|
||||
this.patch = 0;
|
||||
this.flag = "";
|
||||
this.revision = 0;
|
||||
}
|
||||
=====*/
|
||||
dojo.version = {
|
||||
major: 1, minor: 5, patch: 0, flag: "",
|
||||
revision: rev ? +rev[0] : 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());
|
||||
}
|
||||
|
||||
var extraNames, extraLen, empty = {};
|
||||
for(var i in {toString: 1}){ extraNames = []; break; }
|
||||
dojo._extraNames = extraNames = extraNames || ["hasOwnProperty", "valueOf", "isPrototypeOf",
|
||||
"propertyIsEnumerable", "toLocaleString", "toString", "constructor"];
|
||||
extraLen = extraNames.length;
|
||||
|
||||
dojo._mixin = function(/*Object*/ target, /*Object*/ source){
|
||||
// summary:
|
||||
// Adds all properties and methods of source to target. This addition
|
||||
// is "prototype extension safe", so that instances of objects
|
||||
// will not pass along prototype defaults.
|
||||
var name, s, i;
|
||||
for(name in source){
|
||||
// the "tobj" condition avoid copying properties in "source"
|
||||
// inherited from Object.prototype. For example, if target has a custom
|
||||
// toString() method, don't overwrite it with the toString() method
|
||||
// that source inherited from Object.prototype
|
||||
s = source[name];
|
||||
if(!(name in target) || (target[name] !== s && (!(name in empty) || empty[name] !== s))){
|
||||
target[name] = s;
|
||||
}
|
||||
}
|
||||
// IE doesn't recognize some custom functions in for..in
|
||||
if(extraLen && source){
|
||||
for(i = 0; i < extraLen; ++i){
|
||||
name = extraNames[i];
|
||||
s = source[name];
|
||||
if(!(name in target) || (target[name] !== s && (!(name in empty) || empty[name] !== s))){
|
||||
target[name] = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
return target; // 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
|
||||
// destination 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.log(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.log(flattened.name);
|
||||
// | // will print "true"
|
||||
// | console.log(flattened.braces);
|
||||
if(!obj){ obj = {}; }
|
||||
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 && d._scopeMap[p]){
|
||||
p = d._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"
|
||||
// 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".
|
||||
// create:
|
||||
// Optional. Defaults to `false`. If `true`, Objects will be
|
||||
// created at any point along the 'path' that is undefined.
|
||||
// context:
|
||||
// Optional. Object to use as root of path. Defaults to
|
||||
// 'dojo.global'. Null may be passed.
|
||||
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. Useful only for object and method detection.
|
||||
// Not useful for testing generic properties on an object.
|
||||
// In particular, dojo.exists("foo.bar") when foo.bar = ""
|
||||
// will return false. Use ("bar" in foo) to test for those cases.
|
||||
// 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:
|
||||
// A legacy method created for use exclusively by internal Dojo methods. Do not use
|
||||
// this method directly, the behavior of this eval will differ from the normal
|
||||
// browser eval.
|
||||
// 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.
|
||||
// returns:
|
||||
// The result of the evaluation. Often `undefined`
|
||||
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
|
||||
|
||||
@@ -5,240 +5,470 @@
|
||||
*/
|
||||
|
||||
|
||||
if(typeof window!="undefined"){
|
||||
dojo.isBrowser=true;
|
||||
dojo._name="browser";
|
||||
/*=====
|
||||
dojo.isBrowser = {
|
||||
// example:
|
||||
// | if(dojo.isBrowser){ ... }
|
||||
};
|
||||
|
||||
dojo.isFF = {
|
||||
// example:
|
||||
// | if(dojo.isFF > 1){ ... }
|
||||
};
|
||||
|
||||
dojo.isIE = {
|
||||
// example:
|
||||
// | if(dojo.isIE > 6){
|
||||
// | // we are IE7
|
||||
// | }
|
||||
};
|
||||
|
||||
dojo.isSafari = {
|
||||
// example:
|
||||
// | if(dojo.isSafari){ ... }
|
||||
// example:
|
||||
// Detect iPhone:
|
||||
// | if(dojo.isSafari && navigator.userAgent.indexOf("iPhone") != -1){
|
||||
// | // we are iPhone. Note, iPod touch reports "iPod" above and fails this test.
|
||||
// | }
|
||||
};
|
||||
|
||||
dojo = {
|
||||
// isBrowser: Boolean
|
||||
// True if the client is a web-browser
|
||||
isBrowser: true,
|
||||
// isFF: Number | undefined
|
||||
// Version as a Number if client is FireFox. undefined otherwise. Corresponds to
|
||||
// major detected FireFox version (1.5, 2, 3, etc.)
|
||||
isFF: 2,
|
||||
// isIE: Number | undefined
|
||||
// Version as a Number if client is MSIE(PC). undefined otherwise. Corresponds to
|
||||
// major detected IE version (6, 7, 8, etc.)
|
||||
isIE: 6,
|
||||
// isKhtml: Number | undefined
|
||||
// Version as a Number if client is a KHTML browser. undefined otherwise. Corresponds to major
|
||||
// detected version.
|
||||
isKhtml: 0,
|
||||
// isWebKit: Number | undefined
|
||||
// Version as a Number if client is a WebKit-derived browser (Konqueror,
|
||||
// Safari, Chrome, etc.). undefined otherwise.
|
||||
isWebKit: 0,
|
||||
// isMozilla: Number | undefined
|
||||
// Version as a Number if client is a Mozilla-based browser (Firefox,
|
||||
// SeaMonkey). undefined otherwise. Corresponds to major detected version.
|
||||
isMozilla: 0,
|
||||
// isOpera: Number | undefined
|
||||
// Version as a Number if client is Opera. undefined otherwise. Corresponds to
|
||||
// major detected version.
|
||||
isOpera: 0,
|
||||
// isSafari: Number | undefined
|
||||
// Version as a Number if client is Safari or iPhone. undefined otherwise.
|
||||
isSafari: 0,
|
||||
// isChrome: Number | undefined
|
||||
// Version as a Number if client is Chrome browser. undefined otherwise.
|
||||
isChrome: 0
|
||||
// isMac: Boolean
|
||||
// True if the client runs on Mac
|
||||
}
|
||||
=====*/
|
||||
|
||||
if(typeof window != 'undefined'){
|
||||
dojo.isBrowser = true;
|
||||
dojo._name = "browser";
|
||||
|
||||
|
||||
// attempt to figure out the path to dojo if it isn't set in the config
|
||||
(function(){
|
||||
var d = dojo;
|
||||
|
||||
// this is a scope protection closure. We set browser versions and grab
|
||||
// the URL we were loaded from here.
|
||||
|
||||
// grab the node we were loaded from
|
||||
if(document && document.getElementsByTagName){
|
||||
var scripts = document.getElementsByTagName("script");
|
||||
var rePkg = /dojo(\.xd)?\.js(\W|$)/i;
|
||||
for(var i = 0; i < scripts.length; i++){
|
||||
var src = scripts[i].getAttribute("src");
|
||||
if(!src){ continue; }
|
||||
var m = src.match(rePkg);
|
||||
if(m){
|
||||
// find out where we came from
|
||||
if(!d.config.baseUrl){
|
||||
d.config.baseUrl = src.substring(0, m.index);
|
||||
}
|
||||
// and find out if we need to modify our behavior
|
||||
var cfg = scripts[i].getAttribute("djConfig");
|
||||
if(cfg){
|
||||
var cfgo = eval("({ "+cfg+" })");
|
||||
for(var x in cfgo){
|
||||
dojo.config[x] = cfgo[x];
|
||||
}
|
||||
}
|
||||
break; // "first Dojo wins"
|
||||
}
|
||||
}
|
||||
}
|
||||
d.baseUrl = d.config.baseUrl;
|
||||
|
||||
// fill in the rendering support information in dojo.render.*
|
||||
var n = navigator;
|
||||
var dua = n.userAgent,
|
||||
dav = n.appVersion,
|
||||
tv = parseFloat(dav);
|
||||
|
||||
if(dua.indexOf("Opera") >= 0){ d.isOpera = tv; }
|
||||
if(dua.indexOf("AdobeAIR") >= 0){ d.isAIR = 1; }
|
||||
d.isKhtml = (dav.indexOf("Konqueror") >= 0) ? tv : 0;
|
||||
d.isWebKit = parseFloat(dua.split("WebKit/")[1]) || undefined;
|
||||
d.isChrome = parseFloat(dua.split("Chrome/")[1]) || undefined;
|
||||
d.isMac = dav.indexOf("Macintosh") >= 0;
|
||||
|
||||
// safari detection derived from:
|
||||
// http://developer.apple.com/internet/safari/faq.html#anchor2
|
||||
// http://developer.apple.com/internet/safari/uamatrix.html
|
||||
var index = Math.max(dav.indexOf("WebKit"), dav.indexOf("Safari"), 0);
|
||||
if(index && !dojo.isChrome){
|
||||
// try to grab the explicit Safari version first. If we don't get
|
||||
// one, look for less than 419.3 as the indication that we're on something
|
||||
// "Safari 2-ish".
|
||||
d.isSafari = parseFloat(dav.split("Version/")[1]);
|
||||
if(!d.isSafari || parseFloat(dav.substr(index + 7)) <= 419.3){
|
||||
d.isSafari = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if(dua.indexOf("Gecko") >= 0 && !d.isKhtml && !d.isWebKit){ d.isMozilla = d.isMoz = tv; }
|
||||
if(d.isMoz){
|
||||
//We really need to get away from this. Consider a sane isGecko approach for the future.
|
||||
d.isFF = parseFloat(dua.split("Firefox/")[1] || dua.split("Minefield/")[1]) || undefined;
|
||||
}
|
||||
if(document.all && !d.isOpera){
|
||||
d.isIE = parseFloat(dav.split("MSIE ")[1]) || undefined;
|
||||
//In cases where the page has an HTTP header or META tag with
|
||||
//X-UA-Compatible, then it is in emulation mode.
|
||||
//Make sure isIE reflects the desired version.
|
||||
//document.documentMode of 5 means quirks mode.
|
||||
//Only switch the value if documentMode's major version
|
||||
//is different from isIE's major version.
|
||||
var mode = document.documentMode;
|
||||
if(mode && mode != 5 && Math.floor(d.isIE) != mode){
|
||||
d.isIE = mode;
|
||||
}
|
||||
}
|
||||
|
||||
//Workaround to get local file loads of dojo to work on IE 7
|
||||
//by forcing to not use native xhr.
|
||||
if(dojo.isIE && window.location.protocol === "file:"){
|
||||
dojo.config.ieForceActiveXXhr=true;
|
||||
}
|
||||
|
||||
d.isQuirks = document.compatMode == "BackCompat";
|
||||
|
||||
// TODO: is the HTML LANG attribute relevant?
|
||||
d.locale = dojo.config.locale || (d.isIE ? n.userLanguage : n.language).toLowerCase();
|
||||
|
||||
// These are in order of decreasing likelihood; this will change in time.
|
||||
d._XMLHTTP_PROGIDS = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];
|
||||
|
||||
d._xhrObj = function(){
|
||||
// summary:
|
||||
// does the work of portably generating a new XMLHTTPRequest object.
|
||||
var http, last_e;
|
||||
if(!dojo.isIE || !dojo.config.ieForceActiveXXhr){
|
||||
try{ http = new XMLHttpRequest(); }catch(e){}
|
||||
}
|
||||
if(!http){
|
||||
for(var i=0; i<3; ++i){
|
||||
var progid = d._XMLHTTP_PROGIDS[i];
|
||||
try{
|
||||
http = new ActiveXObject(progid);
|
||||
}catch(e){
|
||||
last_e = e;
|
||||
}
|
||||
|
||||
if(http){
|
||||
d._XMLHTTP_PROGIDS = [progid]; // so faster next time
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!http){
|
||||
throw new Error("XMLHTTP not available: "+last_e);
|
||||
}
|
||||
|
||||
return http; // XMLHTTPRequest instance
|
||||
}
|
||||
|
||||
d._isDocumentOk = function(http){
|
||||
var stat = http.status || 0,
|
||||
lp = location.protocol;
|
||||
return (stat >= 200 && stat < 300) || // Boolean
|
||||
stat == 304 || // allow any 2XX response code
|
||||
stat == 1223 || // get it out of the cache
|
||||
// Internet Explorer mangled the status code OR we're Titanium/browser chrome/chrome extension requesting a local file
|
||||
(!stat && (lp == "file:" || lp == "chrome:" || lp == "chrome-extension:" || lp == "app:") );
|
||||
}
|
||||
|
||||
//See if base tag is in use.
|
||||
//This is to fix http://trac.dojotoolkit.org/ticket/3973,
|
||||
//but really, we need to find out how to get rid of the dojo._Url reference
|
||||
//below and still have DOH work with the dojo.i18n test following some other
|
||||
//test that uses the test frame to load a document (trac #2757).
|
||||
//Opera still has problems, but perhaps a larger issue of base tag support
|
||||
//with XHR requests (hasBase is true, but the request is still made to document
|
||||
//path, not base path).
|
||||
var owloc = window.location+"";
|
||||
var base = document.getElementsByTagName("base");
|
||||
var hasBase = (base && base.length > 0);
|
||||
|
||||
d._getText = function(/*URI*/ uri, /*Boolean*/ fail_ok){
|
||||
// summary: Read the contents of the specified uri and return those contents.
|
||||
// uri:
|
||||
// A relative or absolute uri. If absolute, it still must be in
|
||||
// the same "domain" as we are.
|
||||
// fail_ok:
|
||||
// Default false. If fail_ok and loading fails, return null
|
||||
// instead of throwing.
|
||||
// returns: The response text. null is returned when there is a
|
||||
// failure and failure is okay (an exception otherwise)
|
||||
|
||||
// NOTE: must be declared before scope switches ie. this._xhrObj()
|
||||
var http = d._xhrObj();
|
||||
|
||||
if(!hasBase && dojo._Url){
|
||||
uri = (new dojo._Url(owloc, uri)).toString();
|
||||
}
|
||||
|
||||
if(d.config.cacheBust){
|
||||
//Make sure we have a string before string methods are used on uri
|
||||
uri += "";
|
||||
uri += (uri.indexOf("?") == -1 ? "?" : "&") + String(d.config.cacheBust).replace(/\W+/g,"");
|
||||
}
|
||||
|
||||
http.open('GET', uri, false);
|
||||
try{
|
||||
http.send(null);
|
||||
if(!d._isDocumentOk(http)){
|
||||
var err = Error("Unable to load "+uri+" status:"+ http.status);
|
||||
err.status = http.status;
|
||||
err.responseText = http.responseText;
|
||||
throw err;
|
||||
}
|
||||
}catch(e){
|
||||
if(fail_ok){ return null; } // null
|
||||
// rethrow the exception
|
||||
throw e;
|
||||
}
|
||||
return http.responseText; // String
|
||||
}
|
||||
|
||||
|
||||
var _w = window;
|
||||
var _handleNodeEvent = function(/*String*/evtName, /*Function*/fp){
|
||||
// summary:
|
||||
// non-destructively adds the specified function to the node's
|
||||
// evtName handler.
|
||||
// evtName: should be in the form "onclick" for "onclick" handlers.
|
||||
// Make sure you pass in the "on" part.
|
||||
var _a = _w.attachEvent || _w.addEventListener;
|
||||
evtName = _w.attachEvent ? evtName : evtName.substring(2);
|
||||
_a(evtName, function(){
|
||||
fp.apply(_w, arguments);
|
||||
}, false);
|
||||
};
|
||||
|
||||
|
||||
d._windowUnloaders = [];
|
||||
|
||||
d.windowUnloaded = function(){
|
||||
// summary:
|
||||
// signal fired by impending window destruction. You may use
|
||||
// dojo.addOnWindowUnload() to register a listener for this
|
||||
// event. NOTE: if you wish to dojo.connect() to this method
|
||||
// to perform page/application cleanup, be aware that this
|
||||
// event WILL NOT fire if no handler has been registered with
|
||||
// dojo.addOnWindowUnload. This behavior started in Dojo 1.3.
|
||||
// Previous versions always triggered dojo.windowUnloaded. See
|
||||
// dojo.addOnWindowUnload for more info.
|
||||
var mll = d._windowUnloaders;
|
||||
while(mll.length){
|
||||
(mll.pop())();
|
||||
}
|
||||
d = null;
|
||||
};
|
||||
|
||||
var _onWindowUnloadAttached = 0;
|
||||
d.addOnWindowUnload = function(/*Object?|Function?*/obj, /*String|Function?*/functionName){
|
||||
// summary:
|
||||
// registers a function to be triggered when window.onunload
|
||||
// fires.
|
||||
// description:
|
||||
// The first time that addOnWindowUnload is called Dojo
|
||||
// will register a page listener to trigger your unload
|
||||
// handler with. Note that registering these handlers may
|
||||
// destory "fastback" page caching in browsers that support
|
||||
// it. Be careful trying to modify the DOM or access
|
||||
// JavaScript properties during this phase of page unloading:
|
||||
// they may not always be available. Consider
|
||||
// dojo.addOnUnload() if you need to modify the DOM or do
|
||||
// heavy JavaScript work since it fires at the eqivalent of
|
||||
// the page's "onbeforeunload" event.
|
||||
// example:
|
||||
// | dojo.addOnWindowUnload(functionPointer)
|
||||
// | dojo.addOnWindowUnload(object, "functionName");
|
||||
// | dojo.addOnWindowUnload(object, function(){ /* ... */});
|
||||
|
||||
d._onto(d._windowUnloaders, obj, functionName);
|
||||
if(!_onWindowUnloadAttached){
|
||||
_onWindowUnloadAttached = 1;
|
||||
_handleNodeEvent("onunload", d.windowUnloaded);
|
||||
}
|
||||
};
|
||||
|
||||
var _onUnloadAttached = 0;
|
||||
d.addOnUnload = function(/*Object?|Function?*/obj, /*String|Function?*/functionName){
|
||||
// summary:
|
||||
// registers a function to be triggered when the page unloads.
|
||||
// description:
|
||||
// The first time that addOnUnload is called Dojo will
|
||||
// register a page listener to trigger your unload handler
|
||||
// with.
|
||||
//
|
||||
// In a browser enviroment, the functions will be triggered
|
||||
// during the window.onbeforeunload event. Be careful of doing
|
||||
// too much work in an unload handler. onbeforeunload can be
|
||||
// triggered if a link to download a file is clicked, or if
|
||||
// the link is a javascript: link. In these cases, the
|
||||
// onbeforeunload event fires, but the document is not
|
||||
// actually destroyed. So be careful about doing destructive
|
||||
// operations in a dojo.addOnUnload callback.
|
||||
//
|
||||
// Further note that calling dojo.addOnUnload will prevent
|
||||
// browsers from using a "fast back" cache to make page
|
||||
// loading via back button instantaneous.
|
||||
// example:
|
||||
// | dojo.addOnUnload(functionPointer)
|
||||
// | dojo.addOnUnload(object, "functionName")
|
||||
// | dojo.addOnUnload(object, function(){ /* ... */});
|
||||
|
||||
d._onto(d._unloaders, obj, functionName);
|
||||
if(!_onUnloadAttached){
|
||||
_onUnloadAttached = 1;
|
||||
_handleNodeEvent("onbeforeunload", dojo.unloaded);
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
//START DOMContentLoaded
|
||||
dojo._initFired = false;
|
||||
dojo._loadInit = function(e){
|
||||
if(dojo._scrollIntervalId){
|
||||
clearInterval(dojo._scrollIntervalId);
|
||||
dojo._scrollIntervalId = 0;
|
||||
}
|
||||
|
||||
if(!dojo._initFired){
|
||||
dojo._initFired = true;
|
||||
|
||||
//Help out IE to avoid memory leak.
|
||||
if(!dojo.config.afterOnLoad && window.detachEvent){
|
||||
window.detachEvent("onload", dojo._loadInit);
|
||||
}
|
||||
|
||||
if(dojo._inFlightCount == 0){
|
||||
dojo._modulesLoaded();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!dojo.config.afterOnLoad){
|
||||
if(document.addEventListener){
|
||||
//Standards. Hooray! Assumption here that if standards based,
|
||||
//it knows about DOMContentLoaded. It is OK if it does not, the fall through
|
||||
//to window onload should be good enough.
|
||||
document.addEventListener("DOMContentLoaded", dojo._loadInit, false);
|
||||
window.addEventListener("load", dojo._loadInit, false);
|
||||
}else if(window.attachEvent){
|
||||
window.attachEvent("onload", dojo._loadInit);
|
||||
|
||||
//DOMContentLoaded approximation. Diego Perini found this MSDN article
|
||||
//that indicates doScroll is available after DOM ready, so do a setTimeout
|
||||
//to check when it is available.
|
||||
//http://msdn.microsoft.com/en-us/library/ms531426.aspx
|
||||
if(!dojo.config.skipIeDomLoaded && self === self.top){
|
||||
dojo._scrollIntervalId = setInterval(function (){
|
||||
try{
|
||||
//When dojo is loaded into an iframe in an IE HTML Application
|
||||
//(HTA), such as in a selenium test, javascript in the iframe
|
||||
//can't see anything outside of it, so self===self.top is true,
|
||||
//but the iframe is not the top window and doScroll will be
|
||||
//available before document.body is set. Test document.body
|
||||
//before trying the doScroll trick
|
||||
if(document.body){
|
||||
document.documentElement.doScroll("left");
|
||||
dojo._loadInit();
|
||||
}
|
||||
}catch (e){}
|
||||
}, 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(dojo.isIE){
|
||||
try{
|
||||
(function(){
|
||||
document.namespaces.add("v", "urn:schemas-microsoft-com:vml");
|
||||
var vmlElems = ["*", "group", "roundrect", "oval", "shape", "rect", "imagedata", "path", "textpath", "text"],
|
||||
i = 0, l = 1, s = document.createStyleSheet();
|
||||
if(dojo.isIE >= 8){
|
||||
i = 1;
|
||||
l = vmlElems.length;
|
||||
}
|
||||
for(; i < l; ++i){
|
||||
s.addRule("v\\:" + vmlElems[i], "behavior:url(#default#VML); display:inline-block");
|
||||
}
|
||||
})();
|
||||
}catch(e){}
|
||||
}
|
||||
//END DOMContentLoaded
|
||||
|
||||
|
||||
/*
|
||||
OpenAjax.subscribe("OpenAjax", "onload", function(){
|
||||
if(dojo._inFlightCount == 0){
|
||||
dojo._modulesLoaded();
|
||||
}
|
||||
});
|
||||
|
||||
OpenAjax.subscribe("OpenAjax", "onunload", function(){
|
||||
dojo.unloaded();
|
||||
});
|
||||
*/
|
||||
} //if (typeof window != 'undefined')
|
||||
|
||||
//Register any module paths set up in djConfig. Need to do this
|
||||
//in the hostenvs since hostenv_browser can read djConfig from a
|
||||
//script tag's attribute.
|
||||
(function(){
|
||||
var d=dojo;
|
||||
if(document&&document.getElementsByTagName){
|
||||
var _1=document.getElementsByTagName("script");
|
||||
var _2=/dojo(\.xd)?\.js(\W|$)/i;
|
||||
for(var i=0;i<_1.length;i++){
|
||||
var _3=_1[i].getAttribute("src");
|
||||
if(!_3){
|
||||
continue;
|
||||
}
|
||||
var m=_3.match(_2);
|
||||
if(m){
|
||||
if(!d.config.baseUrl){
|
||||
d.config.baseUrl=_3.substring(0,m.index);
|
||||
}
|
||||
var _4=_1[i].getAttribute("djConfig");
|
||||
if(_4){
|
||||
var _5=eval("({ "+_4+" })");
|
||||
for(var x in _5){
|
||||
dojo.config[x]=_5[x];
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
d.baseUrl=d.config.baseUrl;
|
||||
var n=navigator;
|
||||
var _6=n.userAgent,_7=n.appVersion,tv=parseFloat(_7);
|
||||
if(_6.indexOf("Opera")>=0){
|
||||
d.isOpera=tv;
|
||||
}
|
||||
if(_6.indexOf("AdobeAIR")>=0){
|
||||
d.isAIR=1;
|
||||
}
|
||||
d.isKhtml=(_7.indexOf("Konqueror")>=0)?tv:0;
|
||||
d.isWebKit=parseFloat(_6.split("WebKit/")[1])||undefined;
|
||||
d.isChrome=parseFloat(_6.split("Chrome/")[1])||undefined;
|
||||
d.isMac=_7.indexOf("Macintosh")>=0;
|
||||
var _8=Math.max(_7.indexOf("WebKit"),_7.indexOf("Safari"),0);
|
||||
if(_8&&!dojo.isChrome){
|
||||
d.isSafari=parseFloat(_7.split("Version/")[1]);
|
||||
if(!d.isSafari||parseFloat(_7.substr(_8+7))<=419.3){
|
||||
d.isSafari=2;
|
||||
}
|
||||
}
|
||||
if(_6.indexOf("Gecko")>=0&&!d.isKhtml&&!d.isWebKit){
|
||||
d.isMozilla=d.isMoz=tv;
|
||||
}
|
||||
if(d.isMoz){
|
||||
d.isFF=parseFloat(_6.split("Firefox/")[1]||_6.split("Minefield/")[1])||undefined;
|
||||
}
|
||||
if(document.all&&!d.isOpera){
|
||||
d.isIE=parseFloat(_7.split("MSIE ")[1])||undefined;
|
||||
var _9=document.documentMode;
|
||||
if(_9&&_9!=5&&Math.floor(d.isIE)!=_9){
|
||||
d.isIE=_9;
|
||||
}
|
||||
}
|
||||
if(dojo.isIE&&window.location.protocol==="file:"){
|
||||
dojo.config.ieForceActiveXXhr=true;
|
||||
}
|
||||
d.isQuirks=document.compatMode=="BackCompat";
|
||||
d.locale=dojo.config.locale||(d.isIE?n.userLanguage:n.language).toLowerCase();
|
||||
d._XMLHTTP_PROGIDS=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"];
|
||||
d._xhrObj=function(){
|
||||
var _a,_b;
|
||||
if(!dojo.isIE||!dojo.config.ieForceActiveXXhr){
|
||||
try{
|
||||
_a=new XMLHttpRequest();
|
||||
}
|
||||
catch(e){
|
||||
}
|
||||
}
|
||||
if(!_a){
|
||||
for(var i=0;i<3;++i){
|
||||
var _c=d._XMLHTTP_PROGIDS[i];
|
||||
try{
|
||||
_a=new ActiveXObject(_c);
|
||||
}
|
||||
catch(e){
|
||||
_b=e;
|
||||
}
|
||||
if(_a){
|
||||
d._XMLHTTP_PROGIDS=[_c];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!_a){
|
||||
throw new Error("XMLHTTP not available: "+_b);
|
||||
}
|
||||
return _a;
|
||||
};
|
||||
d._isDocumentOk=function(_d){
|
||||
var _e=_d.status||0,lp=location.protocol;
|
||||
return (_e>=200&&_e<300)||_e==304||_e==1223||(!_e&&(lp=="file:"||lp=="chrome:"||lp=="chrome-extension:"||lp=="app:"));
|
||||
};
|
||||
var _f=window.location+"";
|
||||
var _10=document.getElementsByTagName("base");
|
||||
var _11=(_10&&_10.length>0);
|
||||
d._getText=function(uri,_12){
|
||||
var _13=d._xhrObj();
|
||||
if(!_11&&dojo._Url){
|
||||
uri=(new dojo._Url(_f,uri)).toString();
|
||||
}
|
||||
if(d.config.cacheBust){
|
||||
uri+="";
|
||||
uri+=(uri.indexOf("?")==-1?"?":"&")+String(d.config.cacheBust).replace(/\W+/g,"");
|
||||
}
|
||||
_13.open("GET",uri,false);
|
||||
try{
|
||||
_13.send(null);
|
||||
if(!d._isDocumentOk(_13)){
|
||||
var err=Error("Unable to load "+uri+" status:"+_13.status);
|
||||
err.status=_13.status;
|
||||
err.responseText=_13.responseText;
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
catch(e){
|
||||
if(_12){
|
||||
return null;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
return _13.responseText;
|
||||
};
|
||||
var _14=window;
|
||||
var _15=function(_16,fp){
|
||||
var _17=_14.attachEvent||_14.addEventListener;
|
||||
_16=_14.attachEvent?_16:_16.substring(2);
|
||||
_17(_16,function(){
|
||||
fp.apply(_14,arguments);
|
||||
},false);
|
||||
};
|
||||
d._windowUnloaders=[];
|
||||
d.windowUnloaded=function(){
|
||||
var mll=d._windowUnloaders;
|
||||
while(mll.length){
|
||||
(mll.pop())();
|
||||
}
|
||||
d=null;
|
||||
};
|
||||
var _18=0;
|
||||
d.addOnWindowUnload=function(obj,_19){
|
||||
d._onto(d._windowUnloaders,obj,_19);
|
||||
if(!_18){
|
||||
_18=1;
|
||||
_15("onunload",d.windowUnloaded);
|
||||
}
|
||||
};
|
||||
var _1a=0;
|
||||
d.addOnUnload=function(obj,_1b){
|
||||
d._onto(d._unloaders,obj,_1b);
|
||||
if(!_1a){
|
||||
_1a=1;
|
||||
_15("onbeforeunload",dojo.unloaded);
|
||||
}
|
||||
};
|
||||
})();
|
||||
dojo._initFired=false;
|
||||
dojo._loadInit=function(e){
|
||||
if(dojo._scrollIntervalId){
|
||||
clearInterval(dojo._scrollIntervalId);
|
||||
dojo._scrollIntervalId=0;
|
||||
}
|
||||
if(!dojo._initFired){
|
||||
dojo._initFired=true;
|
||||
if(!dojo.config.afterOnLoad&&window.detachEvent){
|
||||
window.detachEvent("onload",dojo._loadInit);
|
||||
}
|
||||
if(dojo._inFlightCount==0){
|
||||
dojo._modulesLoaded();
|
||||
}
|
||||
}
|
||||
};
|
||||
if(!dojo.config.afterOnLoad){
|
||||
if(document.addEventListener){
|
||||
document.addEventListener("DOMContentLoaded",dojo._loadInit,false);
|
||||
window.addEventListener("load",dojo._loadInit,false);
|
||||
}else{
|
||||
if(window.attachEvent){
|
||||
window.attachEvent("onload",dojo._loadInit);
|
||||
if(!dojo.config.skipIeDomLoaded&&self===self.top){
|
||||
dojo._scrollIntervalId=setInterval(function(){
|
||||
try{
|
||||
if(document.body){
|
||||
document.documentElement.doScroll("left");
|
||||
dojo._loadInit();
|
||||
}
|
||||
}
|
||||
catch(e){
|
||||
}
|
||||
},30);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(dojo.isIE){
|
||||
try{
|
||||
(function(){
|
||||
document.namespaces.add("v","urn:schemas-microsoft-com:vml");
|
||||
var _1c=["*","group","roundrect","oval","shape","rect","imagedata","path","textpath","text"],i=0,l=1,s=document.createStyleSheet();
|
||||
if(dojo.isIE>=8){
|
||||
i=1;
|
||||
l=_1c.length;
|
||||
}
|
||||
for(;i<l;++i){
|
||||
s.addRule("v\\:"+_1c[i],"behavior:url(#default#VML); display:inline-block");
|
||||
}
|
||||
})();
|
||||
}
|
||||
catch(e){
|
||||
}
|
||||
}
|
||||
}
|
||||
(function(){
|
||||
var mp=dojo.config["modulePaths"];
|
||||
if(mp){
|
||||
for(var _1d in mp){
|
||||
dojo.registerModulePath(_1d,mp[_1d]);
|
||||
}
|
||||
}
|
||||
var mp = dojo.config["modulePaths"];
|
||||
if(mp){
|
||||
for(var param in mp){
|
||||
dojo.registerModulePath(param, mp[param]);
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
//Load debug code if necessary.
|
||||
if(dojo.config.isDebug){
|
||||
dojo.require("dojo._firebug.firebug");
|
||||
dojo.require("dojo._firebug.firebug");
|
||||
}
|
||||
|
||||
if(dojo.config.debugAtAllCosts){
|
||||
dojo.config.useXDomain=true;
|
||||
dojo.require("dojo._base._loader.loader_xd");
|
||||
dojo.require("dojo._base._loader.loader_debug");
|
||||
dojo.require("dojo.i18n");
|
||||
dojo.config.useXDomain = true;
|
||||
dojo.require("dojo._base._loader.loader_xd");
|
||||
dojo.require("dojo._base._loader.loader_debug");
|
||||
dojo.require("dojo.i18n");
|
||||
}
|
||||
|
||||
@@ -5,171 +5,334 @@
|
||||
*/
|
||||
|
||||
|
||||
if(typeof window!="undefined"){
|
||||
dojo.isBrowser=true;
|
||||
dojo._name="browser";
|
||||
// a host environment specifically built for Mozilla extensions, but derived
|
||||
// from the browser host environment
|
||||
if(typeof window != 'undefined'){
|
||||
dojo.isBrowser = true;
|
||||
dojo._name = "browser";
|
||||
|
||||
|
||||
// FIXME: PORTME
|
||||
// http://developer.mozilla.org/en/mozIJSSubScriptLoader
|
||||
|
||||
|
||||
// attempt to figure out the path to dojo if it isn't set in the config
|
||||
(function(){
|
||||
var d = dojo;
|
||||
// this is a scope protection closure. We set browser versions and grab
|
||||
// the URL we were loaded from here.
|
||||
|
||||
// FIXME: need to probably use a different reference to "document" to get the hosting XUL environment
|
||||
|
||||
d.baseUrl = d.config.baseUrl;
|
||||
|
||||
// fill in the rendering support information in dojo.render.*
|
||||
var n = navigator;
|
||||
var dua = n.userAgent;
|
||||
var dav = n.appVersion;
|
||||
var tv = parseFloat(dav);
|
||||
|
||||
d.isMozilla = d.isMoz = tv;
|
||||
if(d.isMoz){
|
||||
d.isFF = parseFloat(dua.split("Firefox/")[1]) || undefined;
|
||||
}
|
||||
|
||||
// FIXME
|
||||
d.isQuirks = document.compatMode == "BackCompat";
|
||||
|
||||
// FIXME
|
||||
// TODO: is the HTML LANG attribute relevant?
|
||||
d.locale = dojo.config.locale || n.language.toLowerCase();
|
||||
|
||||
d._xhrObj = function(){
|
||||
return new XMLHttpRequest();
|
||||
}
|
||||
|
||||
// monkey-patch _loadUri to handle file://, chrome://, and resource:// url's
|
||||
var oldLoadUri = d._loadUri;
|
||||
d._loadUri = function(uri, cb){
|
||||
var handleLocal = ["file:", "chrome:", "resource:"].some(function(prefix){
|
||||
return String(uri).indexOf(prefix) == 0;
|
||||
});
|
||||
if(handleLocal){
|
||||
// see:
|
||||
// http://developer.mozilla.org/en/mozIJSSubScriptLoader
|
||||
var l = Components.classes["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Components.interfaces.mozIJSSubScriptLoader);
|
||||
var value = l.loadSubScript(uri, d.global)
|
||||
if(cb){ cb(value); }
|
||||
return true;
|
||||
}else{
|
||||
// otherwise, call the pre-existing version
|
||||
return oldLoadUri.apply(d, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: PORTME
|
||||
d._isDocumentOk = function(http){
|
||||
var stat = http.status || 0;
|
||||
return (stat >= 200 && stat < 300) || // Boolean
|
||||
stat == 304 || // allow any 2XX response code
|
||||
stat == 1223 || // get it out of the cache
|
||||
(!stat && (location.protocol=="file:" || location.protocol=="chrome:") );
|
||||
}
|
||||
|
||||
// FIXME: PORTME
|
||||
// var owloc = window.location+"";
|
||||
// var base = document.getElementsByTagName("base");
|
||||
// var hasBase = (base && base.length > 0);
|
||||
var hasBase = false;
|
||||
|
||||
d._getText = function(/*URI*/ uri, /*Boolean*/ fail_ok){
|
||||
// summary: Read the contents of the specified uri and return those contents.
|
||||
// uri:
|
||||
// A relative or absolute uri. If absolute, it still must be in
|
||||
// the same "domain" as we are.
|
||||
// fail_ok:
|
||||
// Default false. If fail_ok and loading fails, return null
|
||||
// instead of throwing.
|
||||
// returns: The response text. null is returned when there is a
|
||||
// failure and failure is okay (an exception otherwise)
|
||||
|
||||
// alert("_getText: " + uri);
|
||||
|
||||
// NOTE: must be declared before scope switches ie. this._xhrObj()
|
||||
var http = d._xhrObj();
|
||||
|
||||
if(!hasBase && dojo._Url){
|
||||
uri = (new dojo._Url(uri)).toString();
|
||||
}
|
||||
if(d.config.cacheBust){
|
||||
//Make sure we have a string before string methods are used on uri
|
||||
uri += "";
|
||||
uri += (uri.indexOf("?") == -1 ? "?" : "&") + String(d.config.cacheBust).replace(/\W+/g,"");
|
||||
}
|
||||
var handleLocal = ["file:", "chrome:", "resource:"].some(function(prefix){
|
||||
return String(uri).indexOf(prefix) == 0;
|
||||
});
|
||||
if(handleLocal){
|
||||
// see:
|
||||
// http://forums.mozillazine.org/viewtopic.php?p=921150#921150
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var scriptableStream=Components
|
||||
.classes["@mozilla.org/scriptableinputstream;1"]
|
||||
.getService(Components.interfaces.nsIScriptableInputStream);
|
||||
|
||||
var channel = ioService.newChannel(uri, null, null);
|
||||
var input = channel.open();
|
||||
scriptableStream.init(input);
|
||||
var str = scriptableStream.read(input.available());
|
||||
scriptableStream.close();
|
||||
input.close();
|
||||
return str;
|
||||
}else{
|
||||
http.open('GET', uri, false);
|
||||
try{
|
||||
http.send(null);
|
||||
// alert(http);
|
||||
if(!d._isDocumentOk(http)){
|
||||
var err = Error("Unable to load "+uri+" status:"+ http.status);
|
||||
err.status = http.status;
|
||||
err.responseText = http.responseText;
|
||||
throw err;
|
||||
}
|
||||
}catch(e){
|
||||
if(fail_ok){ return null; } // null
|
||||
// rethrow the exception
|
||||
throw e;
|
||||
}
|
||||
return http.responseText; // String
|
||||
}
|
||||
}
|
||||
|
||||
d._windowUnloaders = [];
|
||||
|
||||
// FIXME: PORTME
|
||||
d.windowUnloaded = function(){
|
||||
// summary:
|
||||
// signal fired by impending window destruction. You may use
|
||||
// dojo.addOnWIndowUnload() or dojo.connect() to this method to perform
|
||||
// page/application cleanup methods. See dojo.addOnWindowUnload for more info.
|
||||
var mll = d._windowUnloaders;
|
||||
while(mll.length){
|
||||
(mll.pop())();
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: PORTME
|
||||
d.addOnWindowUnload = function(/*Object?*/obj, /*String|Function?*/functionName){
|
||||
// summary:
|
||||
// registers a function to be triggered when window.onunload fires.
|
||||
// Be careful trying to modify the DOM or access JavaScript properties
|
||||
// during this phase of page unloading: they may not always be available.
|
||||
// Consider dojo.addOnUnload() if you need to modify the DOM or do heavy
|
||||
// JavaScript work.
|
||||
// example:
|
||||
// | dojo.addOnWindowUnload(functionPointer)
|
||||
// | dojo.addOnWindowUnload(object, "functionName")
|
||||
// | dojo.addOnWindowUnload(object, function(){ /* ... */});
|
||||
|
||||
d._onto(d._windowUnloaders, obj, functionName);
|
||||
}
|
||||
|
||||
// XUL specific APIs
|
||||
var contexts = [];
|
||||
var current = null;
|
||||
dojo._defaultContext = [ window, document ];
|
||||
|
||||
dojo.pushContext = function(/*Object|String?*/g, /*MDocumentElement?*/d){
|
||||
// summary:
|
||||
// causes subsequent calls to Dojo methods to assume the
|
||||
// passed object and, optionally, document as the default
|
||||
// scopes to use. A 2-element array of the previous global and
|
||||
// document are returned.
|
||||
// description:
|
||||
// dojo.pushContext treats contexts as a stack. The
|
||||
// auto-detected contexts which are initially provided using
|
||||
// dojo.setContext() require authors to keep state in order to
|
||||
// "return" to a previous context, whereas the
|
||||
// dojo.pushContext and dojo.popContext methods provide a more
|
||||
// natural way to augment blocks of code to ensure that they
|
||||
// execute in a different window or frame without issue. If
|
||||
// called without any arguments, the default context (the
|
||||
// context when Dojo is first loaded) is instead pushed into
|
||||
// the stack. If only a single string is passed, a node in the
|
||||
// intitial context's document is looked up and its
|
||||
// contextWindow and contextDocument properties are used as
|
||||
// the context to push. This means that iframes can be given
|
||||
// an ID and code can be executed in the scope of the iframe's
|
||||
// document in subsequent calls easily.
|
||||
// g:
|
||||
// The global context. If a string, the id of the frame to
|
||||
// search for a context and document.
|
||||
// d:
|
||||
// The document element to execute subsequent code with.
|
||||
var old = [dojo.global, dojo.doc];
|
||||
contexts.push(old);
|
||||
var n;
|
||||
if(!g && !d){
|
||||
n = dojo._defaultContext;
|
||||
}else{
|
||||
n = [ g, d ];
|
||||
if(!d && dojo.isString(g)){
|
||||
var t = document.getElementById(g);
|
||||
if(t.contentDocument){
|
||||
n = [t.contentWindow, t.contentDocument];
|
||||
}
|
||||
}
|
||||
}
|
||||
current = n;
|
||||
dojo.setContext.apply(dojo, n);
|
||||
return old; // Array
|
||||
};
|
||||
|
||||
dojo.popContext = function(){
|
||||
// summary:
|
||||
// If the context stack contains elements, ensure that
|
||||
// subsequent code executes in the *previous* context to the
|
||||
// current context. The current context set ([global,
|
||||
// document]) is returned.
|
||||
var oc = current;
|
||||
if(!contexts.length){
|
||||
return oc;
|
||||
}
|
||||
dojo.setContext.apply(dojo, contexts.pop());
|
||||
return oc;
|
||||
};
|
||||
|
||||
// FIXME:
|
||||
// don't really like the current arguments and order to
|
||||
// _inContext, so don't make it public until it's right!
|
||||
dojo._inContext = function(g, d, f){
|
||||
var a = dojo._toArray(arguments);
|
||||
f = a.pop();
|
||||
if(a.length == 1){
|
||||
d = null;
|
||||
}
|
||||
dojo.pushContext(g, d);
|
||||
var r = f();
|
||||
dojo.popContext();
|
||||
return r;
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
dojo._initFired = false;
|
||||
// BEGIN DOMContentLoaded, from Dean Edwards (http://dean.edwards.name/weblog/2006/06/again/)
|
||||
dojo._loadInit = function(e){
|
||||
dojo._initFired = true;
|
||||
// allow multiple calls, only first one will take effect
|
||||
// A bug in khtml calls events callbacks for document for event which isnt supported
|
||||
// for example a created contextmenu event calls DOMContentLoaded, workaround
|
||||
var type = (e && e.type) ? e.type.toLowerCase() : "load";
|
||||
if(arguments.callee.initialized || (type != "domcontentloaded" && type != "load")){ return; }
|
||||
arguments.callee.initialized = true;
|
||||
if(dojo._inFlightCount == 0){
|
||||
dojo._modulesLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
(function(){
|
||||
var _w = window;
|
||||
var _handleNodeEvent = function(evtName, fp){
|
||||
// summary:
|
||||
// non-destructively adds the specified function to the node's
|
||||
// evtName handler.
|
||||
// evtName: should be in the form "onclick" for "onclick" handlers.
|
||||
// Make sure you pass in the "on" part.
|
||||
var oldHandler = _w[evtName] || function(){};
|
||||
_w[evtName] = function(){
|
||||
fp.apply(_w, arguments);
|
||||
oldHandler.apply(_w, arguments);
|
||||
};
|
||||
};
|
||||
// FIXME: PORT
|
||||
// FIXME: dojo.unloaded requires dojo scope, so using anon function wrapper.
|
||||
_handleNodeEvent("onbeforeunload", function() { dojo.unloaded(); });
|
||||
_handleNodeEvent("onunload", function() { dojo.windowUnloaded(); });
|
||||
})();
|
||||
*/
|
||||
|
||||
|
||||
// FIXME: PORTME
|
||||
// this event fires a lot, namely for all plugin XUL overlays and for
|
||||
// all iframes (in addition to window navigations). We only want
|
||||
// Dojo's to fire once..but we might care if pages navigate. We'll
|
||||
// probably need an extension-specific API
|
||||
if(!dojo.config.afterOnLoad){
|
||||
window.addEventListener("DOMContentLoaded",function(e){
|
||||
dojo._loadInit(e);
|
||||
// console.log("DOM content loaded", e);
|
||||
}, false);
|
||||
}
|
||||
|
||||
} //if (typeof window != 'undefined')
|
||||
|
||||
//Register any module paths set up in djConfig. Need to do this
|
||||
//in the hostenvs since hostenv_browser can read djConfig from a
|
||||
//script tag's attribute.
|
||||
(function(){
|
||||
var d=dojo;
|
||||
d.baseUrl=d.config.baseUrl;
|
||||
var n=navigator;
|
||||
var _1=n.userAgent;
|
||||
var _2=n.appVersion;
|
||||
var tv=parseFloat(_2);
|
||||
d.isMozilla=d.isMoz=tv;
|
||||
if(d.isMoz){
|
||||
d.isFF=parseFloat(_1.split("Firefox/")[1])||undefined;
|
||||
}
|
||||
d.isQuirks=document.compatMode=="BackCompat";
|
||||
d.locale=dojo.config.locale||n.language.toLowerCase();
|
||||
d._xhrObj=function(){
|
||||
return new XMLHttpRequest();
|
||||
};
|
||||
var _3=d._loadUri;
|
||||
d._loadUri=function(_4,cb){
|
||||
var _5=["file:","chrome:","resource:"].some(function(_6){
|
||||
return String(_4).indexOf(_6)==0;
|
||||
});
|
||||
if(_5){
|
||||
var l=Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader);
|
||||
var _7=l.loadSubScript(_4,d.global);
|
||||
if(cb){
|
||||
cb(_7);
|
||||
}
|
||||
return true;
|
||||
}else{
|
||||
return _3.apply(d,arguments);
|
||||
}
|
||||
};
|
||||
d._isDocumentOk=function(_8){
|
||||
var _9=_8.status||0;
|
||||
return (_9>=200&&_9<300)||_9==304||_9==1223||(!_9&&(location.protocol=="file:"||location.protocol=="chrome:"));
|
||||
};
|
||||
var _a=false;
|
||||
d._getText=function(_b,_c){
|
||||
var _d=d._xhrObj();
|
||||
if(!_a&&dojo._Url){
|
||||
_b=(new dojo._Url(_b)).toString();
|
||||
}
|
||||
if(d.config.cacheBust){
|
||||
_b+="";
|
||||
_b+=(_b.indexOf("?")==-1?"?":"&")+String(d.config.cacheBust).replace(/\W+/g,"");
|
||||
}
|
||||
var _e=["file:","chrome:","resource:"].some(function(_f){
|
||||
return String(_b).indexOf(_f)==0;
|
||||
});
|
||||
if(_e){
|
||||
var _10=Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService);
|
||||
var _11=Components.classes["@mozilla.org/scriptableinputstream;1"].getService(Components.interfaces.nsIScriptableInputStream);
|
||||
var _12=_10.newChannel(_b,null,null);
|
||||
var _13=_12.open();
|
||||
_11.init(_13);
|
||||
var str=_11.read(_13.available());
|
||||
_11.close();
|
||||
_13.close();
|
||||
return str;
|
||||
}else{
|
||||
_d.open("GET",_b,false);
|
||||
try{
|
||||
_d.send(null);
|
||||
if(!d._isDocumentOk(_d)){
|
||||
var err=Error("Unable to load "+_b+" status:"+_d.status);
|
||||
err.status=_d.status;
|
||||
err.responseText=_d.responseText;
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
catch(e){
|
||||
if(_c){
|
||||
return null;
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
return _d.responseText;
|
||||
}
|
||||
};
|
||||
d._windowUnloaders=[];
|
||||
d.windowUnloaded=function(){
|
||||
var mll=d._windowUnloaders;
|
||||
while(mll.length){
|
||||
(mll.pop())();
|
||||
}
|
||||
};
|
||||
d.addOnWindowUnload=function(obj,_14){
|
||||
d._onto(d._windowUnloaders,obj,_14);
|
||||
};
|
||||
var _15=[];
|
||||
var _16=null;
|
||||
dojo._defaultContext=[window,document];
|
||||
dojo.pushContext=function(g,d){
|
||||
var old=[dojo.global,dojo.doc];
|
||||
_15.push(old);
|
||||
var n;
|
||||
if(!g&&!d){
|
||||
n=dojo._defaultContext;
|
||||
}else{
|
||||
n=[g,d];
|
||||
if(!d&&dojo.isString(g)){
|
||||
var t=document.getElementById(g);
|
||||
if(t.contentDocument){
|
||||
n=[t.contentWindow,t.contentDocument];
|
||||
}
|
||||
}
|
||||
}
|
||||
_16=n;
|
||||
dojo.setContext.apply(dojo,n);
|
||||
return old;
|
||||
};
|
||||
dojo.popContext=function(){
|
||||
var oc=_16;
|
||||
if(!_15.length){
|
||||
return oc;
|
||||
}
|
||||
dojo.setContext.apply(dojo,_15.pop());
|
||||
return oc;
|
||||
};
|
||||
dojo._inContext=function(g,d,f){
|
||||
var a=dojo._toArray(arguments);
|
||||
f=a.pop();
|
||||
if(a.length==1){
|
||||
d=null;
|
||||
}
|
||||
dojo.pushContext(g,d);
|
||||
var r=f();
|
||||
dojo.popContext();
|
||||
return r;
|
||||
};
|
||||
})();
|
||||
dojo._initFired=false;
|
||||
dojo._loadInit=function(e){
|
||||
dojo._initFired=true;
|
||||
var _17=(e&&e.type)?e.type.toLowerCase():"load";
|
||||
if(arguments.callee.initialized||(_17!="domcontentloaded"&&_17!="load")){
|
||||
return;
|
||||
}
|
||||
arguments.callee.initialized=true;
|
||||
if(dojo._inFlightCount==0){
|
||||
dojo._modulesLoaded();
|
||||
}
|
||||
};
|
||||
if(!dojo.config.afterOnLoad){
|
||||
window.addEventListener("DOMContentLoaded",function(e){
|
||||
dojo._loadInit(e);
|
||||
},false);
|
||||
}
|
||||
}
|
||||
(function(){
|
||||
var mp=dojo.config["modulePaths"];
|
||||
if(mp){
|
||||
for(var _18 in mp){
|
||||
dojo.registerModulePath(_18,mp[_18]);
|
||||
}
|
||||
}
|
||||
var mp = dojo.config["modulePaths"];
|
||||
if(mp){
|
||||
for(var param in mp){
|
||||
dojo.registerModulePath(param, mp[param]);
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
//Load debug code if necessary.
|
||||
if(dojo.config.isDebug){
|
||||
console.log=function(m){
|
||||
var s=Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
|
||||
s.logStringMessage(m);
|
||||
};
|
||||
console.debug=function(){
|
||||
};
|
||||
// logging stub for extension logging
|
||||
console.log = function(m){
|
||||
var s = Components.classes["@mozilla.org/consoleservice;1"].getService(
|
||||
Components.interfaces.nsIConsoleService
|
||||
);
|
||||
s.logStringMessage(m);
|
||||
}
|
||||
console.debug = function(){
|
||||
console.log(dojo._toArray(arguments).join(" "));
|
||||
}
|
||||
// FIXME: what about the rest of the console.* methods? And is there any way to reach into firebug and log into it directly?
|
||||
}
|
||||
|
||||
@@ -5,149 +5,204 @@
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Rhino host environment
|
||||
*/
|
||||
|
||||
if(dojo.config["baseUrl"]){
|
||||
dojo.baseUrl=dojo.config["baseUrl"];
|
||||
dojo.baseUrl = dojo.config["baseUrl"];
|
||||
}else{
|
||||
dojo.baseUrl="./";
|
||||
dojo.baseUrl = "./";
|
||||
}
|
||||
dojo.locale=dojo.locale||String(java.util.Locale.getDefault().toString().replace("_","-").toLowerCase());
|
||||
dojo._name="rhino";
|
||||
dojo.isRhino=true;
|
||||
if(typeof print=="function"){
|
||||
console.debug=print;
|
||||
|
||||
dojo.locale = dojo.locale || String(java.util.Locale.getDefault().toString().replace('_','-').toLowerCase());
|
||||
dojo._name = 'rhino';
|
||||
dojo.isRhino = true;
|
||||
|
||||
if(typeof print == "function"){
|
||||
console.debug = print;
|
||||
}
|
||||
|
||||
if(!("byId" in dojo)){
|
||||
dojo.byId=function(id,_1){
|
||||
if(id&&(typeof id=="string"||id instanceof String)){
|
||||
if(!_1){
|
||||
_1=document;
|
||||
dojo.byId = function(id, doc){
|
||||
if(id && (typeof id == "string" || id instanceof String)){
|
||||
if(!doc){ doc = document; }
|
||||
return doc.getElementById(id);
|
||||
}
|
||||
return id; // assume it's a node
|
||||
}
|
||||
}
|
||||
return _1.getElementById(id);
|
||||
|
||||
dojo._isLocalUrl = function(/*String*/ uri) {
|
||||
// summary:
|
||||
// determines if URI is local or not.
|
||||
|
||||
var local = (new java.io.File(uri)).exists();
|
||||
if(!local){
|
||||
var stream;
|
||||
//Try remote URL. Allow this method to throw,
|
||||
//but still do cleanup.
|
||||
try{
|
||||
// try it as a file first, URL second
|
||||
stream = (new java.net.URL(uri)).openStream();
|
||||
// close the stream so we don't leak resources
|
||||
stream.close();
|
||||
}finally{
|
||||
if(stream && stream.close){
|
||||
stream.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
return local;
|
||||
}
|
||||
return id;
|
||||
};
|
||||
|
||||
// see comments in spidermonkey loadUri
|
||||
dojo._loadUri = function(uri, cb){
|
||||
try{
|
||||
var local;
|
||||
try{
|
||||
local = dojo._isLocalUrl(uri);
|
||||
}catch(e){
|
||||
// no debug output; this failure just means the uri was not found.
|
||||
return false;
|
||||
}
|
||||
|
||||
//FIXME: Use Rhino 1.6 native readFile/readUrl if available?
|
||||
if(cb){
|
||||
var contents = (local ? readText : readUri)(uri, "UTF-8");
|
||||
|
||||
// patch up the input to eval until https://bugzilla.mozilla.org/show_bug.cgi?id=471005 is fixed.
|
||||
if(!eval("'\u200f'").length){
|
||||
contents = String(contents).replace(/[\u200E\u200F\u202A-\u202E]/g, function(match){
|
||||
return "\\u" + match.charCodeAt(0).toString(16);
|
||||
})
|
||||
}
|
||||
|
||||
cb(eval('('+contents+')'));
|
||||
}else{
|
||||
load(uri);
|
||||
}
|
||||
return true;
|
||||
}catch(e){
|
||||
console.debug("rhino load('" + uri + "') failed. Exception: " + e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
dojo._isLocalUrl=function(_2){
|
||||
var _3=(new java.io.File(_2)).exists();
|
||||
if(!_3){
|
||||
var _4;
|
||||
try{
|
||||
_4=(new java.net.URL(_2)).openStream();
|
||||
_4.close();
|
||||
|
||||
dojo.exit = function(exitcode){
|
||||
quit(exitcode);
|
||||
}
|
||||
finally{
|
||||
if(_4&&_4.close){
|
||||
_4.close();
|
||||
|
||||
// reading a file from disk in Java is a humiliating experience by any measure.
|
||||
// Lets avoid that and just get the freaking text
|
||||
function readText(path, encoding){
|
||||
encoding = encoding || "utf-8";
|
||||
// NOTE: we intentionally avoid handling exceptions, since the caller will
|
||||
// want to know
|
||||
var jf = new java.io.File(path);
|
||||
var is = new java.io.FileInputStream(jf);
|
||||
return dj_readInputStream(is, encoding);
|
||||
}
|
||||
|
||||
function readUri(uri, encoding){
|
||||
var conn = (new java.net.URL(uri)).openConnection();
|
||||
encoding = encoding || conn.getContentEncoding() || "utf-8";
|
||||
var is = conn.getInputStream();
|
||||
return dj_readInputStream(is, encoding);
|
||||
}
|
||||
|
||||
function dj_readInputStream(is, encoding){
|
||||
var input = new java.io.BufferedReader(new java.io.InputStreamReader(is, encoding));
|
||||
try {
|
||||
var sb = new java.lang.StringBuffer();
|
||||
var line = "";
|
||||
while((line = input.readLine()) !== null){
|
||||
sb.append(line);
|
||||
sb.append(java.lang.System.getProperty("line.separator"));
|
||||
}
|
||||
return sb.toString();
|
||||
} finally {
|
||||
input.close();
|
||||
}
|
||||
}
|
||||
return _3;
|
||||
};
|
||||
dojo._loadUri=function(_5,cb){
|
||||
try{
|
||||
var _6;
|
||||
try{
|
||||
_6=dojo._isLocalUrl(_5);
|
||||
|
||||
dojo._getText = function(/*URI*/ uri, /*Boolean*/ fail_ok){
|
||||
// summary: Read the contents of the specified uri and return those contents.
|
||||
// uri:
|
||||
// A relative or absolute uri.
|
||||
// fail_ok:
|
||||
// Default false. If fail_ok and loading fails, return null
|
||||
// instead of throwing.
|
||||
// returns: The response text. null is returned when there is a
|
||||
// failure and failure is okay (an exception otherwise)
|
||||
try{
|
||||
var local = dojo._isLocalUrl(uri);
|
||||
var text = (local ? readText : readUri)(uri, "UTF-8");
|
||||
if(text !== null){
|
||||
//Force JavaScript string.
|
||||
text += "";
|
||||
}
|
||||
return text;
|
||||
}catch(e){
|
||||
if(fail_ok){
|
||||
return null;
|
||||
}else{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(e){
|
||||
return false;
|
||||
|
||||
// summary:
|
||||
// return the document object associated with the dojo.global
|
||||
dojo.doc = typeof document != "undefined" ? document : null;
|
||||
|
||||
dojo.body = function(){
|
||||
return document.body;
|
||||
}
|
||||
if(cb){
|
||||
var _7=(_6?readText:readUri)(_5,"UTF-8");
|
||||
if(!eval("''").length){
|
||||
_7=String(_7).replace(/[\u200E\u200F\u202A-\u202E]/g,function(_8){
|
||||
return "\\u"+_8.charCodeAt(0).toString(16);
|
||||
});
|
||||
}
|
||||
cb(eval("("+_7+")"));
|
||||
}else{
|
||||
load(_5);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch(e){
|
||||
return false;
|
||||
}
|
||||
};
|
||||
dojo.exit=function(_9){
|
||||
quit(_9);
|
||||
};
|
||||
function readText(_a,_b){
|
||||
_b=_b||"utf-8";
|
||||
var jf=new java.io.File(_a);
|
||||
var is=new java.io.FileInputStream(jf);
|
||||
return dj_readInputStream(is,_b);
|
||||
};
|
||||
function readUri(_c,_d){
|
||||
var _e=(new java.net.URL(_c)).openConnection();
|
||||
_d=_d||_e.getContentEncoding()||"utf-8";
|
||||
var is=_e.getInputStream();
|
||||
return dj_readInputStream(is,_d);
|
||||
};
|
||||
function dj_readInputStream(is,_f){
|
||||
var _10=new java.io.BufferedReader(new java.io.InputStreamReader(is,_f));
|
||||
try{
|
||||
var sb=new java.lang.StringBuffer();
|
||||
var _11="";
|
||||
while((_11=_10.readLine())!==null){
|
||||
sb.append(_11);
|
||||
sb.append(java.lang.System.getProperty("line.separator"));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
finally{
|
||||
_10.close();
|
||||
}
|
||||
};
|
||||
dojo._getText=function(uri,_12){
|
||||
try{
|
||||
var _13=dojo._isLocalUrl(uri);
|
||||
var _14=(_13?readText:readUri)(uri,"UTF-8");
|
||||
if(_14!==null){
|
||||
_14+="";
|
||||
}
|
||||
return _14;
|
||||
}
|
||||
catch(e){
|
||||
if(_12){
|
||||
return null;
|
||||
}else{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
};
|
||||
dojo.doc=typeof document!="undefined"?document:null;
|
||||
dojo.body=function(){
|
||||
return document.body;
|
||||
};
|
||||
if(typeof setTimeout=="undefined"||typeof clearTimeout=="undefined"){
|
||||
dojo._timeouts=[];
|
||||
clearTimeout=function(idx){
|
||||
if(!dojo._timeouts[idx]){
|
||||
return;
|
||||
}
|
||||
dojo._timeouts[idx].stop();
|
||||
};
|
||||
setTimeout=function(_15,_16){
|
||||
var def={sleepTime:_16,hasSlept:false,run:function(){
|
||||
if(!this.hasSlept){
|
||||
this.hasSlept=true;
|
||||
java.lang.Thread.currentThread().sleep(this.sleepTime);
|
||||
}
|
||||
try{
|
||||
_15();
|
||||
}
|
||||
catch(e){
|
||||
}
|
||||
}};
|
||||
var _17=new java.lang.Runnable(def);
|
||||
var _18=new java.lang.Thread(_17);
|
||||
_18.start();
|
||||
return dojo._timeouts.push(_18)-1;
|
||||
};
|
||||
|
||||
// Supply setTimeout/clearTimeout implementations if they aren't already there
|
||||
// Note: this assumes that we define both if one is not provided... there might
|
||||
// be a better way to do this if there is a use case where one is defined but
|
||||
// not the other
|
||||
if(typeof setTimeout == "undefined" || typeof clearTimeout == "undefined"){
|
||||
dojo._timeouts = [];
|
||||
clearTimeout = function(idx){
|
||||
if(!dojo._timeouts[idx]){ return; }
|
||||
dojo._timeouts[idx].stop();
|
||||
}
|
||||
|
||||
setTimeout = function(func, delay){
|
||||
// summary: provides timed callbacks using Java threads
|
||||
|
||||
var def={
|
||||
sleepTime:delay,
|
||||
hasSlept:false,
|
||||
|
||||
run:function(){
|
||||
if(!this.hasSlept){
|
||||
this.hasSlept=true;
|
||||
java.lang.Thread.currentThread().sleep(this.sleepTime);
|
||||
}
|
||||
try{
|
||||
func();
|
||||
}catch(e){
|
||||
console.debug("Error running setTimeout thread:" + e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var runnable = new java.lang.Runnable(def);
|
||||
var thread = new java.lang.Thread(runnable);
|
||||
thread.start();
|
||||
return dojo._timeouts.push(thread)-1;
|
||||
}
|
||||
}
|
||||
|
||||
//Register any module paths set up in djConfig. Need to do this
|
||||
//in the hostenvs since hostenv_browser can read djConfig from a
|
||||
//script tag's attribute.
|
||||
if(dojo.config["modulePaths"]){
|
||||
for(var param in dojo.config["modulePaths"]){
|
||||
dojo.registerModulePath(param,dojo.config["modulePaths"][param]);
|
||||
}
|
||||
for(var param in dojo.config["modulePaths"]){
|
||||
dojo.registerModulePath(param, dojo.config["modulePaths"][param]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,46 +5,83 @@
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* SpiderMonkey host environment
|
||||
*/
|
||||
|
||||
if(dojo.config["baseUrl"]){
|
||||
dojo.baseUrl=dojo.config["baseUrl"];
|
||||
dojo.baseUrl = dojo.config["baseUrl"];
|
||||
}else{
|
||||
dojo.baseUrl="./";
|
||||
dojo.baseUrl = "./";
|
||||
}
|
||||
dojo._name="spidermonkey";
|
||||
dojo.isSpidermonkey=true;
|
||||
dojo.exit=function(_1){
|
||||
quit(_1);
|
||||
|
||||
dojo._name = 'spidermonkey';
|
||||
|
||||
/*=====
|
||||
dojo.isSpidermonkey = {
|
||||
// summary: Detect spidermonkey
|
||||
};
|
||||
if(typeof print=="function"){
|
||||
console.debug=print;
|
||||
=====*/
|
||||
|
||||
dojo.isSpidermonkey = true;
|
||||
dojo.exit = function(exitcode){
|
||||
quit(exitcode);
|
||||
}
|
||||
if(typeof line2pc=="undefined"){
|
||||
throw new Error("attempt to use SpiderMonkey host environment when no 'line2pc' global");
|
||||
|
||||
if(typeof print == "function"){
|
||||
console.debug = print;
|
||||
}
|
||||
dojo._spidermonkeyCurrentFile=function(_2){
|
||||
var s="";
|
||||
try{
|
||||
throw Error("whatever");
|
||||
|
||||
if(typeof line2pc == 'undefined'){
|
||||
throw new Error("attempt to use SpiderMonkey host environment when no 'line2pc' global");
|
||||
}
|
||||
catch(e){
|
||||
s=e.stack;
|
||||
|
||||
dojo._spidermonkeyCurrentFile = function(depth){
|
||||
//
|
||||
// This is a hack that determines the current script file by parsing a
|
||||
// generated stack trace (relying on the non-standard "stack" member variable
|
||||
// of the SpiderMonkey Error object).
|
||||
//
|
||||
// If param depth is passed in, it'll return the script file which is that far down
|
||||
// the stack, but that does require that you know how deep your stack is when you are
|
||||
// calling.
|
||||
//
|
||||
var s = '';
|
||||
try{
|
||||
throw Error("whatever");
|
||||
}catch(e){
|
||||
s = e.stack;
|
||||
}
|
||||
// lines are like: bu_getCurrentScriptURI_spidermonkey("ScriptLoader.js")@burst/Runtime.js:101
|
||||
var matches = s.match(/[^@]*\.js/gi);
|
||||
if(!matches){
|
||||
throw Error("could not parse stack string: '" + s + "'");
|
||||
}
|
||||
var fname = (typeof depth != 'undefined' && depth) ? matches[depth + 1] : matches[matches.length - 1];
|
||||
if(!fname){
|
||||
throw Error("could not find file name in stack string '" + s + "'");
|
||||
}
|
||||
//print("SpiderMonkeyRuntime got fname '" + fname + "' from stack string '" + s + "'");
|
||||
return fname;
|
||||
}
|
||||
var _3=s.match(/[^@]*\.js/gi);
|
||||
if(!_3){
|
||||
throw Error("could not parse stack string: '"+s+"'");
|
||||
|
||||
// print(dojo._spidermonkeyCurrentFile(0));
|
||||
|
||||
dojo._loadUri = function(uri){
|
||||
// spidermonkey load() evaluates the contents into the global scope (which
|
||||
// is what we want).
|
||||
// TODO: sigh, load() does not return a useful value.
|
||||
// Perhaps it is returning the value of the last thing evaluated?
|
||||
var ok = load(uri);
|
||||
// console.log("spidermonkey load(", uri, ") returned ", ok);
|
||||
return 1;
|
||||
}
|
||||
var _4=(typeof _2!="undefined"&&_2)?_3[_2+1]:_3[_3.length-1];
|
||||
if(!_4){
|
||||
throw Error("could not find file name in stack string '"+s+"'");
|
||||
}
|
||||
return _4;
|
||||
};
|
||||
dojo._loadUri=function(_5){
|
||||
var ok=load(_5);
|
||||
return 1;
|
||||
};
|
||||
|
||||
//Register any module paths set up in djConfig. Need to do this
|
||||
//in the hostenvs since hostenv_browser can read djConfig from a
|
||||
//script tag's attribute.
|
||||
if(dojo.config["modulePaths"]){
|
||||
for(var param in dojo.config["modulePaths"]){
|
||||
dojo.registerModulePath(param,dojo.config["modulePaths"][param]);
|
||||
}
|
||||
for(var param in dojo.config["modulePaths"]){
|
||||
dojo.registerModulePath(param, dojo.config["modulePaths"][param]);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,55 +5,82 @@
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dojo._base._loader.loader_debug"]){
|
||||
dojo._hasResource["dojo._base._loader.loader_debug"]=true;
|
||||
if(!dojo._hasResource["dojo._base._loader.loader_debug"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo._base._loader.loader_debug"] = true;
|
||||
dojo.provide("dojo._base._loader.loader_debug");
|
||||
dojo.nonDebugProvide=dojo.provide;
|
||||
dojo.provide=function(_1){
|
||||
var _2=dojo["_xdDebugQueue"];
|
||||
if(_2&&_2.length>0&&_1==_2["currentResourceName"]){
|
||||
if(dojo.isAIR){
|
||||
window.setTimeout(function(){
|
||||
dojo._xdDebugFileLoaded(_1);
|
||||
},1);
|
||||
}else{
|
||||
window.setTimeout(dojo._scopeName+"._xdDebugFileLoaded('"+_1+"')",1);
|
||||
|
||||
//Override dojo.provide, so we can trigger the next
|
||||
//script tag for the next local module. We can only add one
|
||||
//at a time because there are browsers that execute script tags
|
||||
//in the order that the code is received, and not in the DOM order.
|
||||
dojo.nonDebugProvide = dojo.provide;
|
||||
|
||||
dojo.provide = function(resourceName){
|
||||
var dbgQueue = dojo["_xdDebugQueue"];
|
||||
if(dbgQueue && dbgQueue.length > 0 && resourceName == dbgQueue["currentResourceName"]){
|
||||
//Set a timeout so the module can be executed into existence. Normally the
|
||||
//dojo.provide call in a module is the first line. Don't want to risk attaching
|
||||
//another script tag until the current one finishes executing.
|
||||
if(dojo.isAIR){
|
||||
window.setTimeout(function(){dojo._xdDebugFileLoaded(resourceName);}, 1);
|
||||
}else{
|
||||
window.setTimeout(dojo._scopeName + "._xdDebugFileLoaded('" + resourceName + "')", 1);
|
||||
}
|
||||
}
|
||||
|
||||
return dojo.nonDebugProvide.apply(dojo, arguments);
|
||||
}
|
||||
|
||||
dojo._xdDebugFileLoaded = function(resourceName){
|
||||
|
||||
if(!dojo._xdDebugScopeChecked){
|
||||
//If using a scoped dojo, we need to expose dojo as a real global
|
||||
//for the debugAtAllCosts stuff to work.
|
||||
if(dojo._scopeName != "dojo"){
|
||||
window.dojo = window[dojo.config.scopeMap[0][1]];
|
||||
window.dijit = window[dojo.config.scopeMap[1][1]];
|
||||
window.dojox = window[dojo.config.scopeMap[2][1]];
|
||||
}
|
||||
|
||||
dojo._xdDebugScopeChecked = true;
|
||||
}
|
||||
|
||||
var dbgQueue = dojo._xdDebugQueue;
|
||||
|
||||
if(resourceName && resourceName == dbgQueue.currentResourceName){
|
||||
dbgQueue.shift();
|
||||
}
|
||||
|
||||
if(dbgQueue.length == 0){
|
||||
//Check for more modules that need debug loading.
|
||||
//dojo._xdWatchInFlight will add more things to the debug
|
||||
//queue if they just recently loaded but it was not detected
|
||||
//between the dojo._xdWatchInFlight intervals.
|
||||
dojo._xdWatchInFlight();
|
||||
}
|
||||
|
||||
if(dbgQueue.length == 0){
|
||||
dbgQueue.currentResourceName = null;
|
||||
|
||||
//Make sure nothing else is in flight.
|
||||
//If something is still in flight, then it still
|
||||
//needs to be added to debug queue after it loads.
|
||||
for(var param in dojo._xdInFlight){
|
||||
if(dojo._xdInFlight[param] === true){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
dojo._xdNotifyLoaded();
|
||||
}else{
|
||||
if(resourceName == dbgQueue.currentResourceName){
|
||||
dbgQueue.currentResourceName = dbgQueue[0].resourceName;
|
||||
var element = document.createElement("script");
|
||||
element.type = "text/javascript";
|
||||
element.src = dbgQueue[0].resourcePath;
|
||||
document.getElementsByTagName("head")[0].appendChild(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
return dojo.nonDebugProvide.apply(dojo,arguments);
|
||||
};
|
||||
dojo._xdDebugFileLoaded=function(_3){
|
||||
if(!dojo._xdDebugScopeChecked){
|
||||
if(dojo._scopeName!="dojo"){
|
||||
window.dojo=window[dojo.config.scopeMap[0][1]];
|
||||
window.dijit=window[dojo.config.scopeMap[1][1]];
|
||||
window.dojox=window[dojo.config.scopeMap[2][1]];
|
||||
}
|
||||
dojo._xdDebugScopeChecked=true;
|
||||
}
|
||||
var _4=dojo._xdDebugQueue;
|
||||
if(_3&&_3==_4.currentResourceName){
|
||||
_4.shift();
|
||||
}
|
||||
if(_4.length==0){
|
||||
dojo._xdWatchInFlight();
|
||||
}
|
||||
if(_4.length==0){
|
||||
_4.currentResourceName=null;
|
||||
for(var _5 in dojo._xdInFlight){
|
||||
if(dojo._xdInFlight[_5]===true){
|
||||
return;
|
||||
}
|
||||
}
|
||||
dojo._xdNotifyLoaded();
|
||||
}else{
|
||||
if(_3==_4.currentResourceName){
|
||||
_4.currentResourceName=_4[0].resourceName;
|
||||
var _6=document.createElement("script");
|
||||
_6.type="text/javascript";
|
||||
_6.src=_4[0].resourcePath;
|
||||
document.getElementsByTagName("head")[0].appendChild(_6);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,75 +5,258 @@
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dojo._base.array"]){
|
||||
dojo._hasResource["dojo._base.array"]=true;
|
||||
if(!dojo._hasResource["dojo._base.array"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo._base.array"] = true;
|
||||
dojo.require("dojo._base.lang");
|
||||
dojo.provide("dojo._base.array");
|
||||
|
||||
(function(){
|
||||
var _1=function(_2,_3,cb){
|
||||
return [(typeof _2=="string")?_2.split(""):_2,_3||dojo.global,(typeof cb=="string")?new Function("item","index","array",cb):cb];
|
||||
};
|
||||
var _4=function(_5,_6,_7,_8){
|
||||
var _9=_1(_6,_8,_7);
|
||||
_6=_9[0];
|
||||
for(var i=0,l=_6.length;i<l;++i){
|
||||
var _a=!!_9[2].call(_9[1],_6[i],i,_6);
|
||||
if(_5^_a){
|
||||
return _a;
|
||||
}
|
||||
}
|
||||
return _5;
|
||||
};
|
||||
dojo.mixin(dojo,{indexOf:function(_b,_c,_d,_e){
|
||||
var _f=1,end=_b.length||0,i=0;
|
||||
if(_e){
|
||||
i=end-1;
|
||||
_f=end=-1;
|
||||
}
|
||||
if(_d!=undefined){
|
||||
i=_d;
|
||||
}
|
||||
if((_e&&i>end)||i<end){
|
||||
for(;i!=end;i+=_f){
|
||||
if(_b[i]==_c){
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
},lastIndexOf:function(_10,_11,_12){
|
||||
return dojo.indexOf(_10,_11,_12,true);
|
||||
},forEach:function(arr,_13,_14){
|
||||
if(!arr||!arr.length){
|
||||
return;
|
||||
}
|
||||
var _15=_1(arr,_14,_13);
|
||||
arr=_15[0];
|
||||
for(var i=0,l=arr.length;i<l;++i){
|
||||
_15[2].call(_15[1],arr[i],i,arr);
|
||||
}
|
||||
},every:function(arr,_16,_17){
|
||||
return _4(true,arr,_16,_17);
|
||||
},some:function(arr,_18,_19){
|
||||
return _4(false,arr,_18,_19);
|
||||
},map:function(arr,_1a,_1b){
|
||||
var _1c=_1(arr,_1b,_1a);
|
||||
arr=_1c[0];
|
||||
var _1d=(arguments[3]?(new arguments[3]()):[]);
|
||||
for(var i=0,l=arr.length;i<l;++i){
|
||||
_1d.push(_1c[2].call(_1c[1],arr[i],i,arr));
|
||||
}
|
||||
return _1d;
|
||||
},filter:function(arr,_1e,_1f){
|
||||
var _20=_1(arr,_1f,_1e);
|
||||
arr=_20[0];
|
||||
var _21=[];
|
||||
for(var i=0,l=arr.length;i<l;++i){
|
||||
if(_20[2].call(_20[1],arr[i],i,arr)){
|
||||
_21.push(arr[i]);
|
||||
}
|
||||
}
|
||||
return _21;
|
||||
}});
|
||||
var _getParts = function(arr, obj, cb){
|
||||
return [
|
||||
(typeof arr == "string") ? arr.split("") : arr,
|
||||
obj || dojo.global,
|
||||
// FIXME: cache the anonymous functions we create here?
|
||||
(typeof cb == "string") ? new Function("item", "index", "array", cb) : cb
|
||||
];
|
||||
};
|
||||
|
||||
var everyOrSome = function(/*Boolean*/every, /*Array|String*/arr, /*Function|String*/callback, /*Object?*/thisObject){
|
||||
var _p = _getParts(arr, thisObject, callback); arr = _p[0];
|
||||
for(var i=0,l=arr.length; i<l; ++i){
|
||||
var result = !!_p[2].call(_p[1], arr[i], i, arr);
|
||||
if(every ^ result){
|
||||
return result; // Boolean
|
||||
}
|
||||
}
|
||||
return every; // Boolean
|
||||
};
|
||||
|
||||
dojo.mixin(dojo, {
|
||||
indexOf: function( /*Array*/ array,
|
||||
/*Object*/ value,
|
||||
/*Integer?*/ fromIndex,
|
||||
/*Boolean?*/ findLast){
|
||||
// summary:
|
||||
// locates the first index of the provided value in the
|
||||
// passed array. If the value is not found, -1 is returned.
|
||||
// description:
|
||||
// This method corresponds to the JavaScript 1.6 Array.indexOf method, with one difference: when
|
||||
// run over sparse arrays, the Dojo function invokes the callback for every index whereas JavaScript
|
||||
// 1.6's indexOf skips the holes in the sparse array.
|
||||
// For details on this method, see:
|
||||
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/indexOf
|
||||
|
||||
var step = 1, end = array.length || 0, i = 0;
|
||||
if(findLast){
|
||||
i = end - 1;
|
||||
step = end = -1;
|
||||
}
|
||||
if(fromIndex != undefined){ i = fromIndex; }
|
||||
if((findLast && i > end) || i < end){
|
||||
for(; i != end; i += step){
|
||||
if(array[i] == value){ return i; }
|
||||
}
|
||||
}
|
||||
return -1; // Number
|
||||
},
|
||||
|
||||
lastIndexOf: function(/*Array*/array, /*Object*/value, /*Integer?*/fromIndex){
|
||||
// summary:
|
||||
// locates the last index of the provided value in the passed
|
||||
// array. If the value is not found, -1 is returned.
|
||||
// description:
|
||||
// This method corresponds to the JavaScript 1.6 Array.lastIndexOf method, with one difference: when
|
||||
// run over sparse arrays, the Dojo function invokes the callback for every index whereas JavaScript
|
||||
// 1.6's lastIndexOf skips the holes in the sparse array.
|
||||
// For details on this method, see:
|
||||
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/lastIndexOf
|
||||
return dojo.indexOf(array, value, fromIndex, true); // Number
|
||||
},
|
||||
|
||||
forEach: function(/*Array|String*/arr, /*Function|String*/callback, /*Object?*/thisObject){
|
||||
// summary:
|
||||
// for every item in arr, callback is invoked. Return values are ignored.
|
||||
// If you want to break out of the loop, consider using dojo.every() or dojo.some().
|
||||
// forEach does not allow breaking out of the loop over the items in arr.
|
||||
// arr:
|
||||
// the array to iterate over. If a string, operates on individual characters.
|
||||
// callback:
|
||||
// a function is invoked with three arguments: item, index, and array
|
||||
// thisObject:
|
||||
// may be used to scope the call to callback
|
||||
// description:
|
||||
// This function corresponds to the JavaScript 1.6 Array.forEach() method, with one difference: when
|
||||
// run over sparse arrays, this implemenation passes the "holes" in the sparse array to
|
||||
// the callback function with a value of undefined. JavaScript 1.6's forEach skips the holes in the sparse array.
|
||||
// For more details, see:
|
||||
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/forEach
|
||||
// example:
|
||||
// | // log out all members of the array:
|
||||
// | dojo.forEach(
|
||||
// | [ "thinger", "blah", "howdy", 10 ],
|
||||
// | function(item){
|
||||
// | console.log(item);
|
||||
// | }
|
||||
// | );
|
||||
// example:
|
||||
// | // log out the members and their indexes
|
||||
// | dojo.forEach(
|
||||
// | [ "thinger", "blah", "howdy", 10 ],
|
||||
// | function(item, idx, arr){
|
||||
// | console.log(item, "at index:", idx);
|
||||
// | }
|
||||
// | );
|
||||
// example:
|
||||
// | // use a scoped object member as the callback
|
||||
// |
|
||||
// | var obj = {
|
||||
// | prefix: "logged via obj.callback:",
|
||||
// | callback: function(item){
|
||||
// | console.log(this.prefix, item);
|
||||
// | }
|
||||
// | };
|
||||
// |
|
||||
// | // specifying the scope function executes the callback in that scope
|
||||
// | dojo.forEach(
|
||||
// | [ "thinger", "blah", "howdy", 10 ],
|
||||
// | obj.callback,
|
||||
// | obj
|
||||
// | );
|
||||
// |
|
||||
// | // alternately, we can accomplish the same thing with dojo.hitch()
|
||||
// | dojo.forEach(
|
||||
// | [ "thinger", "blah", "howdy", 10 ],
|
||||
// | dojo.hitch(obj, "callback")
|
||||
// | );
|
||||
|
||||
// match the behavior of the built-in forEach WRT empty arrs
|
||||
if(!arr || !arr.length){ return; }
|
||||
|
||||
// FIXME: there are several ways of handilng thisObject. Is
|
||||
// dojo.global always the default context?
|
||||
var _p = _getParts(arr, thisObject, callback); arr = _p[0];
|
||||
for(var i=0,l=arr.length; i<l; ++i){
|
||||
_p[2].call(_p[1], arr[i], i, arr);
|
||||
}
|
||||
},
|
||||
|
||||
every: function(/*Array|String*/arr, /*Function|String*/callback, /*Object?*/thisObject){
|
||||
// summary:
|
||||
// Determines whether or not every item in arr satisfies the
|
||||
// condition implemented by callback.
|
||||
// arr:
|
||||
// the array to iterate on. If a string, operates on individual characters.
|
||||
// callback:
|
||||
// a function is invoked with three arguments: item, index,
|
||||
// and array and returns true if the condition is met.
|
||||
// thisObject:
|
||||
// may be used to scope the call to callback
|
||||
// description:
|
||||
// This function corresponds to the JavaScript 1.6 Array.every() method, with one difference: when
|
||||
// run over sparse arrays, this implemenation passes the "holes" in the sparse array to
|
||||
// the callback function with a value of undefined. JavaScript 1.6's every skips the holes in the sparse array.
|
||||
// For more details, see:
|
||||
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/every
|
||||
// example:
|
||||
// | // returns false
|
||||
// | dojo.every([1, 2, 3, 4], function(item){ return item>1; });
|
||||
// example:
|
||||
// | // returns true
|
||||
// | dojo.every([1, 2, 3, 4], function(item){ return item>0; });
|
||||
return everyOrSome(true, arr, callback, thisObject); // Boolean
|
||||
},
|
||||
|
||||
some: function(/*Array|String*/arr, /*Function|String*/callback, /*Object?*/thisObject){
|
||||
// summary:
|
||||
// Determines whether or not any item in arr satisfies the
|
||||
// condition implemented by callback.
|
||||
// arr:
|
||||
// the array to iterate over. If a string, operates on individual characters.
|
||||
// callback:
|
||||
// a function is invoked with three arguments: item, index,
|
||||
// and array and returns true if the condition is met.
|
||||
// thisObject:
|
||||
// may be used to scope the call to callback
|
||||
// description:
|
||||
// This function corresponds to the JavaScript 1.6 Array.some() method, with one difference: when
|
||||
// run over sparse arrays, this implemenation passes the "holes" in the sparse array to
|
||||
// the callback function with a value of undefined. JavaScript 1.6's some skips the holes in the sparse array.
|
||||
// For more details, see:
|
||||
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/some
|
||||
// example:
|
||||
// | // is true
|
||||
// | dojo.some([1, 2, 3, 4], function(item){ return item>1; });
|
||||
// example:
|
||||
// | // is false
|
||||
// | dojo.some([1, 2, 3, 4], function(item){ return item<1; });
|
||||
return everyOrSome(false, arr, callback, thisObject); // Boolean
|
||||
},
|
||||
|
||||
map: function(/*Array|String*/arr, /*Function|String*/callback, /*Function?*/thisObject){
|
||||
// summary:
|
||||
// applies callback to each element of arr and returns
|
||||
// an Array with the results
|
||||
// arr:
|
||||
// the array to iterate on. If a string, operates on
|
||||
// individual characters.
|
||||
// callback:
|
||||
// a function is invoked with three arguments, (item, index,
|
||||
// array), and returns a value
|
||||
// thisObject:
|
||||
// may be used to scope the call to callback
|
||||
// description:
|
||||
// This function corresponds to the JavaScript 1.6 Array.map() method, with one difference: when
|
||||
// run over sparse arrays, this implemenation passes the "holes" in the sparse array to
|
||||
// the callback function with a value of undefined. JavaScript 1.6's map skips the holes in the sparse array.
|
||||
// For more details, see:
|
||||
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
|
||||
// example:
|
||||
// | // returns [2, 3, 4, 5]
|
||||
// | dojo.map([1, 2, 3, 4], function(item){ return item+1 });
|
||||
|
||||
var _p = _getParts(arr, thisObject, callback); arr = _p[0];
|
||||
var outArr = (arguments[3] ? (new arguments[3]()) : []);
|
||||
for(var i=0,l=arr.length; i<l; ++i){
|
||||
outArr.push(_p[2].call(_p[1], arr[i], i, arr));
|
||||
}
|
||||
return outArr; // Array
|
||||
},
|
||||
|
||||
filter: function(/*Array*/arr, /*Function|String*/callback, /*Object?*/thisObject){
|
||||
// summary:
|
||||
// Returns a new Array with those items from arr that match the
|
||||
// condition implemented by callback.
|
||||
// arr:
|
||||
// the array to iterate over.
|
||||
// callback:
|
||||
// a function that is invoked with three arguments (item,
|
||||
// index, array). The return of this function is expected to
|
||||
// be a boolean which determines whether the passed-in item
|
||||
// will be included in the returned array.
|
||||
// thisObject:
|
||||
// may be used to scope the call to callback
|
||||
// description:
|
||||
// This function corresponds to the JavaScript 1.6 Array.filter() method, with one difference: when
|
||||
// run over sparse arrays, this implemenation passes the "holes" in the sparse array to
|
||||
// the callback function with a value of undefined. JavaScript 1.6's filter skips the holes in the sparse array.
|
||||
// For more details, see:
|
||||
// https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter
|
||||
// example:
|
||||
// | // returns [2, 3, 4]
|
||||
// | dojo.filter([1, 2, 3, 4], function(item){ return item>1; });
|
||||
|
||||
var _p = _getParts(arr, thisObject, callback); arr = _p[0];
|
||||
var outArr = [];
|
||||
for(var i=0,l=arr.length; i<l; ++i){
|
||||
if(_p[2].call(_p[1], arr[i], i, arr)){
|
||||
outArr.push(arr[i]);
|
||||
}
|
||||
}
|
||||
return outArr; // Array
|
||||
}
|
||||
});
|
||||
})();
|
||||
/*
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dojo._base.browser"]){
|
||||
dojo._hasResource["dojo._base.browser"]=true;
|
||||
if(!dojo._hasResource["dojo._base.browser"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo._base.browser"] = true;
|
||||
dojo.provide("dojo._base.browser");
|
||||
|
||||
dojo.require("dojo._base.window");
|
||||
dojo.require("dojo._base.connect");
|
||||
dojo.require("dojo._base.event");
|
||||
@@ -16,7 +17,13 @@ dojo.require("dojo._base.NodeList");
|
||||
dojo.require("dojo._base.query");
|
||||
dojo.require("dojo._base.xhr");
|
||||
dojo.require("dojo._base.fx");
|
||||
dojo.forEach(dojo.config.require,function(i){
|
||||
dojo["require"](i);
|
||||
|
||||
//Need this to be the last code segment in base, so do not place any
|
||||
//dojo.requireIf calls in this file. Otherwise, due to how the build system
|
||||
//puts all requireIf dependencies after the current file, the require calls
|
||||
//could be called before all of base is defined.
|
||||
dojo.forEach(dojo.config.require, function(i){
|
||||
dojo["require"](i);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@@ -5,81 +5,306 @@
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dojo._base.connect"]){
|
||||
dojo._hasResource["dojo._base.connect"]=true;
|
||||
if(!dojo._hasResource["dojo._base.connect"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo._base.connect"] = true;
|
||||
dojo.provide("dojo._base.connect");
|
||||
dojo.require("dojo._base.lang");
|
||||
dojo._listener={getDispatcher:function(){
|
||||
return function(){
|
||||
var ap=Array.prototype,c=arguments.callee,ls=c._listeners,t=c.target;
|
||||
var r=t&&t.apply(this,arguments);
|
||||
var i,_1;
|
||||
_1=[].concat(ls);
|
||||
for(i in _1){
|
||||
if(!(i in ap)){
|
||||
_1[i].apply(this,arguments);
|
||||
|
||||
// this file courtesy of the TurboAjax Group, licensed under a Dojo CLA
|
||||
|
||||
// low-level delegation machinery
|
||||
dojo._listener = {
|
||||
// create a dispatcher function
|
||||
getDispatcher: function(){
|
||||
// following comments pulled out-of-line to prevent cloning them
|
||||
// in the returned function.
|
||||
// - indices (i) that are really in the array of listeners (ls) will
|
||||
// not be in Array.prototype. This is the 'sparse array' trick
|
||||
// that keeps us safe from libs that take liberties with built-in
|
||||
// objects
|
||||
// - listener is invoked with current scope (this)
|
||||
return function(){
|
||||
var ap=Array.prototype, c=arguments.callee, ls=c._listeners, t=c.target;
|
||||
// return value comes from original target function
|
||||
var r = t && t.apply(this, arguments);
|
||||
// make local copy of listener array so it is immutable during processing
|
||||
var i, lls;
|
||||
lls = [].concat(ls);
|
||||
|
||||
// invoke listeners after target function
|
||||
for(i in lls){
|
||||
if(!(i in ap)){
|
||||
lls[i].apply(this, arguments);
|
||||
}
|
||||
}
|
||||
// return value comes from original target function
|
||||
return r;
|
||||
};
|
||||
},
|
||||
// add a listener to an object
|
||||
add: function(/*Object*/ source, /*String*/ method, /*Function*/ listener){
|
||||
// Whenever 'method' is invoked, 'listener' will have the same scope.
|
||||
// Trying to supporting a context object for the listener led to
|
||||
// complexity.
|
||||
// Non trivial to provide 'once' functionality here
|
||||
// because listener could be the result of a dojo.hitch call,
|
||||
// in which case two references to the same hitch target would not
|
||||
// be equivalent.
|
||||
source = source || dojo.global;
|
||||
// The source method is either null, a dispatcher, or some other function
|
||||
var f = source[method];
|
||||
// Ensure a dispatcher
|
||||
if(!f || !f._listeners){
|
||||
var d = dojo._listener.getDispatcher();
|
||||
// original target function is special
|
||||
d.target = f;
|
||||
// dispatcher holds a list of listeners
|
||||
d._listeners = [];
|
||||
// redirect source to dispatcher
|
||||
f = source[method] = d;
|
||||
}
|
||||
// The contract is that a handle is returned that can
|
||||
// identify this listener for disconnect.
|
||||
//
|
||||
// The type of the handle is private. Here is it implemented as Integer.
|
||||
// DOM event code has this same contract but handle is Function
|
||||
// in non-IE browsers.
|
||||
//
|
||||
// We could have separate lists of before and after listeners.
|
||||
return f._listeners.push(listener); /*Handle*/
|
||||
},
|
||||
// remove a listener from an object
|
||||
remove: function(/*Object*/ source, /*String*/ method, /*Handle*/ handle){
|
||||
var f = (source || dojo.global)[method];
|
||||
// remember that handle is the index+1 (0 is not a valid handle)
|
||||
if(f && f._listeners && handle--){
|
||||
delete f._listeners[handle];
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// Multiple delegation for arbitrary methods.
|
||||
|
||||
// This unit knows nothing about DOM, but we include DOM aware documentation
|
||||
// and dontFix argument here to help the autodocs. Actual DOM aware code is in
|
||||
// event.js.
|
||||
|
||||
dojo.connect = function(/*Object|null*/ obj,
|
||||
/*String*/ event,
|
||||
/*Object|null*/ context,
|
||||
/*String|Function*/ method,
|
||||
/*Boolean?*/ dontFix){
|
||||
// summary:
|
||||
// `dojo.connect` is the core event handling and delegation method in
|
||||
// Dojo. It allows one function to "listen in" on the execution of
|
||||
// any other, triggering the second whenever the first is called. Many
|
||||
// listeners may be attached to a function, and source functions may
|
||||
// be either regular function calls or DOM events.
|
||||
//
|
||||
// description:
|
||||
// Connects listeners to actions, so that after event fires, a
|
||||
// listener is called with the same arguments passed to the original
|
||||
// function.
|
||||
//
|
||||
// Since `dojo.connect` allows the source of events to be either a
|
||||
// "regular" JavaScript function or a DOM event, it provides a uniform
|
||||
// interface for listening to all the types of events that an
|
||||
// application is likely to deal with though a single, unified
|
||||
// interface. DOM programmers may want to think of it as
|
||||
// "addEventListener for everything and anything".
|
||||
//
|
||||
// When setting up a connection, the `event` parameter must be a
|
||||
// string that is the name of the method/event to be listened for. If
|
||||
// `obj` is null, `dojo.global` is assumed, meaning that connections
|
||||
// to global methods are supported but also that you may inadvertently
|
||||
// connect to a global by passing an incorrect object name or invalid
|
||||
// reference.
|
||||
//
|
||||
// `dojo.connect` generally is forgiving. If you pass the name of a
|
||||
// function or method that does not yet exist on `obj`, connect will
|
||||
// not fail, but will instead set up a stub method. Similarly, null
|
||||
// arguments may simply be omitted such that fewer than 4 arguments
|
||||
// may be required to set up a connection See the examples for details.
|
||||
//
|
||||
// The return value is a handle that is needed to
|
||||
// remove this connection with `dojo.disconnect`.
|
||||
//
|
||||
// obj:
|
||||
// The source object for the event function.
|
||||
// Defaults to `dojo.global` if null.
|
||||
// If obj is a DOM node, the connection is delegated
|
||||
// to the DOM event manager (unless dontFix is true).
|
||||
//
|
||||
// event:
|
||||
// String name of the event function in obj.
|
||||
// I.e. identifies a property `obj[event]`.
|
||||
//
|
||||
// context:
|
||||
// The object that method will receive as "this".
|
||||
//
|
||||
// If context is null and method is a function, then method
|
||||
// inherits the context of event.
|
||||
//
|
||||
// If method is a string then context must be the source
|
||||
// object object for method (context[method]). If context is null,
|
||||
// dojo.global is used.
|
||||
//
|
||||
// method:
|
||||
// A function reference, or name of a function in context.
|
||||
// The function identified by method fires after event does.
|
||||
// method receives the same arguments as the event.
|
||||
// See context argument comments for information on method's scope.
|
||||
//
|
||||
// dontFix:
|
||||
// If obj is a DOM node, set dontFix to true to prevent delegation
|
||||
// of this connection to the DOM event manager.
|
||||
//
|
||||
// example:
|
||||
// When obj.onchange(), do ui.update():
|
||||
// | dojo.connect(obj, "onchange", ui, "update");
|
||||
// | dojo.connect(obj, "onchange", ui, ui.update); // same
|
||||
//
|
||||
// example:
|
||||
// Using return value for disconnect:
|
||||
// | var link = dojo.connect(obj, "onchange", ui, "update");
|
||||
// | ...
|
||||
// | dojo.disconnect(link);
|
||||
//
|
||||
// example:
|
||||
// When onglobalevent executes, watcher.handler is invoked:
|
||||
// | dojo.connect(null, "onglobalevent", watcher, "handler");
|
||||
//
|
||||
// example:
|
||||
// When ob.onCustomEvent executes, customEventHandler is invoked:
|
||||
// | dojo.connect(ob, "onCustomEvent", null, "customEventHandler");
|
||||
// | dojo.connect(ob, "onCustomEvent", "customEventHandler"); // same
|
||||
//
|
||||
// example:
|
||||
// When ob.onCustomEvent executes, customEventHandler is invoked
|
||||
// with the same scope (this):
|
||||
// | dojo.connect(ob, "onCustomEvent", null, customEventHandler);
|
||||
// | dojo.connect(ob, "onCustomEvent", customEventHandler); // same
|
||||
//
|
||||
// example:
|
||||
// When globalEvent executes, globalHandler is invoked
|
||||
// with the same scope (this):
|
||||
// | dojo.connect(null, "globalEvent", null, globalHandler);
|
||||
// | dojo.connect("globalEvent", globalHandler); // same
|
||||
|
||||
// normalize arguments
|
||||
var a=arguments, args=[], i=0;
|
||||
// if a[0] is a String, obj was omitted
|
||||
args.push(dojo.isString(a[0]) ? null : a[i++], a[i++]);
|
||||
// if the arg-after-next is a String or Function, context was NOT omitted
|
||||
var a1 = a[i+1];
|
||||
args.push(dojo.isString(a1)||dojo.isFunction(a1) ? a[i++] : null, a[i++]);
|
||||
// absorb any additional arguments
|
||||
for(var l=a.length; i<l; i++){ args.push(a[i]); }
|
||||
// do the actual work
|
||||
return dojo._connect.apply(this, args); /*Handle*/
|
||||
}
|
||||
|
||||
// used by non-browser hostenvs. always overriden by event.js
|
||||
dojo._connect = function(obj, event, context, method){
|
||||
var l=dojo._listener, h=l.add(obj, event, dojo.hitch(context, method));
|
||||
return [obj, event, h, l]; // Handle
|
||||
}
|
||||
return r;
|
||||
};
|
||||
},add:function(_2,_3,_4){
|
||||
_2=_2||dojo.global;
|
||||
var f=_2[_3];
|
||||
if(!f||!f._listeners){
|
||||
var d=dojo._listener.getDispatcher();
|
||||
d.target=f;
|
||||
d._listeners=[];
|
||||
f=_2[_3]=d;
|
||||
|
||||
dojo.disconnect = function(/*Handle*/ handle){
|
||||
// summary:
|
||||
// Remove a link created by dojo.connect.
|
||||
// description:
|
||||
// Removes the connection between event and the method referenced by handle.
|
||||
// handle:
|
||||
// the return value of the dojo.connect call that created the connection.
|
||||
if(handle && handle[0] !== undefined){
|
||||
dojo._disconnect.apply(this, handle);
|
||||
// let's not keep this reference
|
||||
delete handle[0];
|
||||
}
|
||||
}
|
||||
return f._listeners.push(_4);
|
||||
},remove:function(_5,_6,_7){
|
||||
var f=(_5||dojo.global)[_6];
|
||||
if(f&&f._listeners&&_7--){
|
||||
delete f._listeners[_7];
|
||||
|
||||
dojo._disconnect = function(obj, event, handle, listener){
|
||||
listener.remove(obj, event, handle);
|
||||
}
|
||||
}};
|
||||
dojo.connect=function(_8,_9,_a,_b,_c){
|
||||
var a=arguments,_d=[],i=0;
|
||||
_d.push(dojo.isString(a[0])?null:a[i++],a[i++]);
|
||||
var a1=a[i+1];
|
||||
_d.push(dojo.isString(a1)||dojo.isFunction(a1)?a[i++]:null,a[i++]);
|
||||
for(var l=a.length;i<l;i++){
|
||||
_d.push(a[i]);
|
||||
|
||||
// topic publish/subscribe
|
||||
|
||||
dojo._topics = {};
|
||||
|
||||
dojo.subscribe = function(/*String*/ topic, /*Object|null*/ context, /*String|Function*/ method){
|
||||
// summary:
|
||||
// Attach a listener to a named topic. The listener function is invoked whenever the
|
||||
// named topic is published (see: dojo.publish).
|
||||
// Returns a handle which is needed to unsubscribe this listener.
|
||||
// context:
|
||||
// Scope in which method will be invoked, or null for default scope.
|
||||
// method:
|
||||
// The name of a function in context, or a function reference. This is the function that
|
||||
// is invoked when topic is published.
|
||||
// example:
|
||||
// | dojo.subscribe("alerts", null, function(caption, message){ alert(caption + "\n" + message); });
|
||||
// | dojo.publish("alerts", [ "read this", "hello world" ]);
|
||||
|
||||
// support for 2 argument invocation (omitting context) depends on hitch
|
||||
return [topic, dojo._listener.add(dojo._topics, topic, dojo.hitch(context, method))]; /*Handle*/
|
||||
}
|
||||
return dojo._connect.apply(this,_d);
|
||||
};
|
||||
dojo._connect=function(_e,_f,_10,_11){
|
||||
var l=dojo._listener,h=l.add(_e,_f,dojo.hitch(_10,_11));
|
||||
return [_e,_f,h,l];
|
||||
};
|
||||
dojo.disconnect=function(_12){
|
||||
if(_12&&_12[0]!==undefined){
|
||||
dojo._disconnect.apply(this,_12);
|
||||
delete _12[0];
|
||||
|
||||
dojo.unsubscribe = function(/*Handle*/ handle){
|
||||
// summary:
|
||||
// Remove a topic listener.
|
||||
// handle:
|
||||
// The handle returned from a call to subscribe.
|
||||
// example:
|
||||
// | var alerter = dojo.subscribe("alerts", null, function(caption, message){ alert(caption + "\n" + message); };
|
||||
// | ...
|
||||
// | dojo.unsubscribe(alerter);
|
||||
if(handle){
|
||||
dojo._listener.remove(dojo._topics, handle[0], handle[1]);
|
||||
}
|
||||
}
|
||||
};
|
||||
dojo._disconnect=function(obj,_13,_14,_15){
|
||||
_15.remove(obj,_13,_14);
|
||||
};
|
||||
dojo._topics={};
|
||||
dojo.subscribe=function(_16,_17,_18){
|
||||
return [_16,dojo._listener.add(dojo._topics,_16,dojo.hitch(_17,_18))];
|
||||
};
|
||||
dojo.unsubscribe=function(_19){
|
||||
if(_19){
|
||||
dojo._listener.remove(dojo._topics,_19[0],_19[1]);
|
||||
|
||||
dojo.publish = function(/*String*/ topic, /*Array*/ args){
|
||||
// summary:
|
||||
// Invoke all listener method subscribed to topic.
|
||||
// topic:
|
||||
// The name of the topic to publish.
|
||||
// args:
|
||||
// An array of arguments. The arguments will be applied
|
||||
// to each topic subscriber (as first class parameters, via apply).
|
||||
// example:
|
||||
// | dojo.subscribe("alerts", null, function(caption, message){ alert(caption + "\n" + message); };
|
||||
// | dojo.publish("alerts", [ "read this", "hello world" ]);
|
||||
|
||||
// Note that args is an array, which is more efficient vs variable length
|
||||
// argument list. Ideally, var args would be implemented via Array
|
||||
// throughout the APIs.
|
||||
var f = dojo._topics[topic];
|
||||
if(f){
|
||||
f.apply(this, args||[]);
|
||||
}
|
||||
}
|
||||
|
||||
dojo.connectPublisher = function( /*String*/ topic,
|
||||
/*Object|null*/ obj,
|
||||
/*String*/ event){
|
||||
// summary:
|
||||
// Ensure that every time obj.event() is called, a message is published
|
||||
// on the topic. Returns a handle which can be passed to
|
||||
// dojo.disconnect() to disable subsequent automatic publication on
|
||||
// the topic.
|
||||
// topic:
|
||||
// The name of the topic to publish.
|
||||
// obj:
|
||||
// The source object for the event function. Defaults to dojo.global
|
||||
// if null.
|
||||
// event:
|
||||
// The name of the event function in obj.
|
||||
// I.e. identifies a property obj[event].
|
||||
// example:
|
||||
// | dojo.connectPublisher("/ajax/start", dojo, "xhrGet");
|
||||
var pf = function(){ dojo.publish(topic, arguments); }
|
||||
return event ? dojo.connect(obj, event, pf) : dojo.connect(obj, pf); //Handle
|
||||
};
|
||||
dojo.publish=function(_1a,_1b){
|
||||
var f=dojo._topics[_1a];
|
||||
if(f){
|
||||
f.apply(this,_1b||[]);
|
||||
}
|
||||
};
|
||||
dojo.connectPublisher=function(_1c,obj,_1d){
|
||||
var pf=function(){
|
||||
dojo.publish(_1c,arguments);
|
||||
};
|
||||
return _1d?dojo.connect(obj,_1d,pf):dojo.connect(obj,pf);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,355 +5,641 @@
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dojo._base.event"]){
|
||||
dojo._hasResource["dojo._base.event"]=true;
|
||||
if(!dojo._hasResource["dojo._base.event"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo._base.event"] = true;
|
||||
dojo.provide("dojo._base.event");
|
||||
dojo.require("dojo._base.connect");
|
||||
|
||||
// this file courtesy of the TurboAjax Group, licensed under a Dojo CLA
|
||||
|
||||
(function(){
|
||||
var _1=(dojo._event_listener={add:function(_2,_3,fp){
|
||||
if(!_2){
|
||||
return;
|
||||
}
|
||||
_3=_1._normalizeEventName(_3);
|
||||
fp=_1._fixCallback(_3,fp);
|
||||
var _4=_3;
|
||||
if(!dojo.isIE&&(_3=="mouseenter"||_3=="mouseleave")){
|
||||
var _5=fp;
|
||||
_3=(_3=="mouseenter")?"mouseover":"mouseout";
|
||||
fp=function(e){
|
||||
if(!dojo.isDescendant(e.relatedTarget,_2)){
|
||||
return _5.call(this,e);
|
||||
}
|
||||
};
|
||||
}
|
||||
_2.addEventListener(_3,fp,false);
|
||||
return fp;
|
||||
},remove:function(_6,_7,_8){
|
||||
if(_6){
|
||||
_7=_1._normalizeEventName(_7);
|
||||
if(!dojo.isIE&&(_7=="mouseenter"||_7=="mouseleave")){
|
||||
_7=(_7=="mouseenter")?"mouseover":"mouseout";
|
||||
}
|
||||
_6.removeEventListener(_7,_8,false);
|
||||
}
|
||||
},_normalizeEventName:function(_9){
|
||||
return _9.slice(0,2)=="on"?_9.slice(2):_9;
|
||||
},_fixCallback:function(_a,fp){
|
||||
return _a!="keypress"?fp:function(e){
|
||||
return fp.call(this,_1._fixEvent(e,this));
|
||||
};
|
||||
},_fixEvent:function(_b,_c){
|
||||
switch(_b.type){
|
||||
case "keypress":
|
||||
_1._setKeyChar(_b);
|
||||
break;
|
||||
}
|
||||
return _b;
|
||||
},_setKeyChar:function(_d){
|
||||
_d.keyChar=_d.charCode?String.fromCharCode(_d.charCode):"";
|
||||
_d.charOrCode=_d.keyChar||_d.keyCode;
|
||||
},_punctMap:{106:42,111:47,186:59,187:43,188:44,189:45,190:46,191:47,192:96,219:91,220:92,221:93,222:39}});
|
||||
dojo.fixEvent=function(_e,_f){
|
||||
return _1._fixEvent(_e,_f);
|
||||
};
|
||||
dojo.stopEvent=function(evt){
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
};
|
||||
var _10=dojo._listener;
|
||||
dojo._connect=function(obj,_11,_12,_13,_14){
|
||||
var _15=obj&&(obj.nodeType||obj.attachEvent||obj.addEventListener);
|
||||
var lid=_15?(_14?2:1):0,l=[dojo._listener,_1,_10][lid];
|
||||
var h=l.add(obj,_11,dojo.hitch(_12,_13));
|
||||
return [obj,_11,h,lid];
|
||||
};
|
||||
dojo._disconnect=function(obj,_16,_17,_18){
|
||||
([dojo._listener,_1,_10][_18]).remove(obj,_16,_17);
|
||||
};
|
||||
dojo.keys={BACKSPACE:8,TAB:9,CLEAR:12,ENTER:13,SHIFT:16,CTRL:17,ALT:18,META:dojo.isSafari?91:224,PAUSE:19,CAPS_LOCK:20,ESCAPE:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT_ARROW:37,UP_ARROW:38,RIGHT_ARROW:39,DOWN_ARROW:40,INSERT:45,DELETE:46,HELP:47,LEFT_WINDOW:91,RIGHT_WINDOW:92,SELECT:93,NUMPAD_0:96,NUMPAD_1:97,NUMPAD_2:98,NUMPAD_3:99,NUMPAD_4:100,NUMPAD_5:101,NUMPAD_6:102,NUMPAD_7:103,NUMPAD_8:104,NUMPAD_9:105,NUMPAD_MULTIPLY:106,NUMPAD_PLUS:107,NUMPAD_ENTER:108,NUMPAD_MINUS:109,NUMPAD_PERIOD:110,NUMPAD_DIVIDE:111,F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,F13:124,F14:125,F15:126,NUM_LOCK:144,SCROLL_LOCK:145,copyKey:dojo.isMac&&!dojo.isAIR?(dojo.isSafari?91:224):17};
|
||||
var _19=dojo.isMac?"metaKey":"ctrlKey";
|
||||
dojo.isCopyKey=function(e){
|
||||
return e[_19];
|
||||
};
|
||||
// DOM event listener machinery
|
||||
var del = (dojo._event_listener = {
|
||||
add: function(/*DOMNode*/ node, /*String*/ name, /*Function*/ fp){
|
||||
if(!node){return;}
|
||||
name = del._normalizeEventName(name);
|
||||
fp = del._fixCallback(name, fp);
|
||||
var oname = name;
|
||||
if(
|
||||
!dojo.isIE &&
|
||||
(name == "mouseenter" || name == "mouseleave")
|
||||
){
|
||||
var ofp = fp;
|
||||
//oname = name;
|
||||
name = (name == "mouseenter") ? "mouseover" : "mouseout";
|
||||
fp = function(e){
|
||||
if(!dojo.isDescendant(e.relatedTarget, node)){
|
||||
// e.type = oname; // FIXME: doesn't take? SJM: event.type is generally immutable.
|
||||
return ofp.call(this, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
node.addEventListener(name, fp, false);
|
||||
return fp; /*Handle*/
|
||||
},
|
||||
remove: function(/*DOMNode*/ node, /*String*/ event, /*Handle*/ handle){
|
||||
// summary:
|
||||
// clobbers the listener from the node
|
||||
// node:
|
||||
// DOM node to attach the event to
|
||||
// event:
|
||||
// the name of the handler to remove the function from
|
||||
// handle:
|
||||
// the handle returned from add
|
||||
if(node){
|
||||
event = del._normalizeEventName(event);
|
||||
if(!dojo.isIE && (event == "mouseenter" || event == "mouseleave")){
|
||||
event = (event == "mouseenter") ? "mouseover" : "mouseout";
|
||||
}
|
||||
|
||||
node.removeEventListener(event, handle, false);
|
||||
}
|
||||
},
|
||||
_normalizeEventName: function(/*String*/ name){
|
||||
// Generally, name should be lower case, unless it is special
|
||||
// somehow (e.g. a Mozilla DOM event).
|
||||
// Remove 'on'.
|
||||
return name.slice(0,2) =="on" ? name.slice(2) : name;
|
||||
},
|
||||
_fixCallback: function(/*String*/ name, fp){
|
||||
// By default, we only invoke _fixEvent for 'keypress'
|
||||
// If code is added to _fixEvent for other events, we have
|
||||
// to revisit this optimization.
|
||||
// This also applies to _fixEvent overrides for Safari and Opera
|
||||
// below.
|
||||
return name != "keypress" ? fp : function(e){ return fp.call(this, del._fixEvent(e, this)); };
|
||||
},
|
||||
_fixEvent: function(evt, sender){
|
||||
// _fixCallback only attaches us to keypress.
|
||||
// Switch on evt.type anyway because we might
|
||||
// be called directly from dojo.fixEvent.
|
||||
switch(evt.type){
|
||||
case "keypress":
|
||||
del._setKeyChar(evt);
|
||||
break;
|
||||
}
|
||||
return evt;
|
||||
},
|
||||
_setKeyChar: function(evt){
|
||||
evt.keyChar = evt.charCode ? String.fromCharCode(evt.charCode) : '';
|
||||
evt.charOrCode = evt.keyChar || evt.keyCode;
|
||||
},
|
||||
// For IE and Safari: some ctrl-key combinations (mostly w/punctuation) do not emit a char code in IE
|
||||
// we map those virtual key codes to ascii here
|
||||
// not valid for all (non-US) keyboards, so maybe we shouldn't bother
|
||||
_punctMap: {
|
||||
106:42,
|
||||
111:47,
|
||||
186:59,
|
||||
187:43,
|
||||
188:44,
|
||||
189:45,
|
||||
190:46,
|
||||
191:47,
|
||||
192:96,
|
||||
219:91,
|
||||
220:92,
|
||||
221:93,
|
||||
222:39
|
||||
}
|
||||
});
|
||||
|
||||
// DOM events
|
||||
|
||||
dojo.fixEvent = function(/*Event*/ evt, /*DOMNode*/ sender){
|
||||
// summary:
|
||||
// normalizes properties on the event object including event
|
||||
// bubbling methods, keystroke normalization, and x/y positions
|
||||
// evt: Event
|
||||
// native event object
|
||||
// sender: DOMNode
|
||||
// node to treat as "currentTarget"
|
||||
return del._fixEvent(evt, sender);
|
||||
}
|
||||
|
||||
dojo.stopEvent = function(/*Event*/ evt){
|
||||
// summary:
|
||||
// prevents propagation and clobbers the default action of the
|
||||
// passed event
|
||||
// evt: Event
|
||||
// The event object. If omitted, window.event is used on IE.
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
// NOTE: below, this method is overridden for IE
|
||||
}
|
||||
|
||||
// the default listener to use on dontFix nodes, overriden for IE
|
||||
var node_listener = dojo._listener;
|
||||
|
||||
// Unify connect and event listeners
|
||||
dojo._connect = function(obj, event, context, method, dontFix){
|
||||
// FIXME: need a more strict test
|
||||
var isNode = obj && (obj.nodeType||obj.attachEvent||obj.addEventListener);
|
||||
// choose one of three listener options: raw (connect.js), DOM event on a Node, custom event on a Node
|
||||
// we need the third option to provide leak prevention on broken browsers (IE)
|
||||
var lid = isNode ? (dontFix ? 2 : 1) : 0, l = [dojo._listener, del, node_listener][lid];
|
||||
// create a listener
|
||||
var h = l.add(obj, event, dojo.hitch(context, method));
|
||||
// formerly, the disconnect package contained "l" directly, but if client code
|
||||
// leaks the disconnect package (by connecting it to a node), referencing "l"
|
||||
// compounds the problem.
|
||||
// instead we return a listener id, which requires custom _disconnect below.
|
||||
// return disconnect package
|
||||
return [ obj, event, h, lid ];
|
||||
}
|
||||
|
||||
dojo._disconnect = function(obj, event, handle, listener){
|
||||
([dojo._listener, del, node_listener][listener]).remove(obj, event, handle);
|
||||
}
|
||||
|
||||
// Constants
|
||||
|
||||
// Public: client code should test
|
||||
// keyCode against these named constants, as the
|
||||
// actual codes can vary by browser.
|
||||
dojo.keys = {
|
||||
// summary:
|
||||
// Definitions for common key values
|
||||
BACKSPACE: 8,
|
||||
TAB: 9,
|
||||
CLEAR: 12,
|
||||
ENTER: 13,
|
||||
SHIFT: 16,
|
||||
CTRL: 17,
|
||||
ALT: 18,
|
||||
META: dojo.isSafari ? 91 : 224, // the apple key on macs
|
||||
PAUSE: 19,
|
||||
CAPS_LOCK: 20,
|
||||
ESCAPE: 27,
|
||||
SPACE: 32,
|
||||
PAGE_UP: 33,
|
||||
PAGE_DOWN: 34,
|
||||
END: 35,
|
||||
HOME: 36,
|
||||
LEFT_ARROW: 37,
|
||||
UP_ARROW: 38,
|
||||
RIGHT_ARROW: 39,
|
||||
DOWN_ARROW: 40,
|
||||
INSERT: 45,
|
||||
DELETE: 46,
|
||||
HELP: 47,
|
||||
LEFT_WINDOW: 91,
|
||||
RIGHT_WINDOW: 92,
|
||||
SELECT: 93,
|
||||
NUMPAD_0: 96,
|
||||
NUMPAD_1: 97,
|
||||
NUMPAD_2: 98,
|
||||
NUMPAD_3: 99,
|
||||
NUMPAD_4: 100,
|
||||
NUMPAD_5: 101,
|
||||
NUMPAD_6: 102,
|
||||
NUMPAD_7: 103,
|
||||
NUMPAD_8: 104,
|
||||
NUMPAD_9: 105,
|
||||
NUMPAD_MULTIPLY: 106,
|
||||
NUMPAD_PLUS: 107,
|
||||
NUMPAD_ENTER: 108,
|
||||
NUMPAD_MINUS: 109,
|
||||
NUMPAD_PERIOD: 110,
|
||||
NUMPAD_DIVIDE: 111,
|
||||
F1: 112,
|
||||
F2: 113,
|
||||
F3: 114,
|
||||
F4: 115,
|
||||
F5: 116,
|
||||
F6: 117,
|
||||
F7: 118,
|
||||
F8: 119,
|
||||
F9: 120,
|
||||
F10: 121,
|
||||
F11: 122,
|
||||
F12: 123,
|
||||
F13: 124,
|
||||
F14: 125,
|
||||
F15: 126,
|
||||
NUM_LOCK: 144,
|
||||
SCROLL_LOCK: 145,
|
||||
// virtual key mapping
|
||||
copyKey: dojo.isMac && !dojo.isAIR ? (dojo.isSafari ? 91 : 224 ) : 17
|
||||
};
|
||||
|
||||
var evtCopyKey = dojo.isMac ? "metaKey" : "ctrlKey";
|
||||
|
||||
dojo.isCopyKey = function(e){
|
||||
// summary:
|
||||
// Checks an event for the copy key (meta on Mac, and ctrl anywhere else)
|
||||
// e: Event
|
||||
// Event object to examine
|
||||
return e[evtCopyKey]; // Boolean
|
||||
};
|
||||
|
||||
// Public: decoding mouse buttons from events
|
||||
|
||||
/*=====
|
||||
dojo.mouseButtons = {
|
||||
// LEFT: Number
|
||||
// Numeric value of the left mouse button for the platform.
|
||||
LEFT: 0,
|
||||
// MIDDLE: Number
|
||||
// Numeric value of the middle mouse button for the platform.
|
||||
MIDDLE: 1,
|
||||
// RIGHT: Number
|
||||
// Numeric value of the right mouse button for the platform.
|
||||
RIGHT: 2,
|
||||
|
||||
isButton: function(e, button){
|
||||
// summary:
|
||||
// Checks an event object for a pressed button
|
||||
// e: Event
|
||||
// Event object to examine
|
||||
// button: Number
|
||||
// The button value (example: dojo.mouseButton.LEFT)
|
||||
return e.button == button; // Boolean
|
||||
},
|
||||
isLeft: function(e){
|
||||
// summary:
|
||||
// Checks an event object for the pressed left button
|
||||
// e: Event
|
||||
// Event object to examine
|
||||
return e.button == 0; // Boolean
|
||||
},
|
||||
isMiddle: function(e){
|
||||
// summary:
|
||||
// Checks an event object for the pressed middle button
|
||||
// e: Event
|
||||
// Event object to examine
|
||||
return e.button == 1; // Boolean
|
||||
},
|
||||
isRight: function(e){
|
||||
// summary:
|
||||
// Checks an event object for the pressed right button
|
||||
// e: Event
|
||||
// Event object to examine
|
||||
return e.button == 2; // Boolean
|
||||
}
|
||||
};
|
||||
=====*/
|
||||
|
||||
if(dojo.isIE){
|
||||
dojo.mouseButtons = {
|
||||
LEFT: 1,
|
||||
MIDDLE: 4,
|
||||
RIGHT: 2,
|
||||
// helper functions
|
||||
isButton: function(e, button){ return e.button & button; },
|
||||
isLeft: function(e){ return e.button & 1; },
|
||||
isMiddle: function(e){ return e.button & 4; },
|
||||
isRight: function(e){ return e.button & 2; }
|
||||
};
|
||||
}else{
|
||||
dojo.mouseButtons = {
|
||||
LEFT: 0,
|
||||
MIDDLE: 1,
|
||||
RIGHT: 2,
|
||||
// helper functions
|
||||
isButton: function(e, button){ return e.button == button; },
|
||||
isLeft: function(e){ return e.button == 0; },
|
||||
isMiddle: function(e){ return e.button == 1; },
|
||||
isRight: function(e){ return e.button == 2; }
|
||||
};
|
||||
}
|
||||
|
||||
// IE event normalization
|
||||
if(dojo.isIE){
|
||||
var _trySetKeyCode = function(e, code){
|
||||
try{
|
||||
// squelch errors when keyCode is read-only
|
||||
// (e.g. if keyCode is ctrl or shift)
|
||||
return (e.keyCode = code);
|
||||
}catch(e){
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// by default, use the standard listener
|
||||
var iel = dojo._listener;
|
||||
var listenersName = (dojo._ieListenersName = "_" + dojo._scopeName + "_listeners");
|
||||
// dispatcher tracking property
|
||||
if(!dojo.config._allow_leaks){
|
||||
// custom listener that handles leak protection for DOM events
|
||||
node_listener = iel = dojo._ie_listener = {
|
||||
// support handler indirection: event handler functions are
|
||||
// referenced here. Event dispatchers hold only indices.
|
||||
handlers: [],
|
||||
// add a listener to an object
|
||||
add: function(/*Object*/ source, /*String*/ method, /*Function*/ listener){
|
||||
source = source || dojo.global;
|
||||
var f = source[method];
|
||||
if(!f||!f[listenersName]){
|
||||
var d = dojo._getIeDispatcher();
|
||||
// original target function is special
|
||||
d.target = f && (ieh.push(f) - 1);
|
||||
// dispatcher holds a list of indices into handlers table
|
||||
d[listenersName] = [];
|
||||
// redirect source to dispatcher
|
||||
f = source[method] = d;
|
||||
}
|
||||
return f[listenersName].push(ieh.push(listener) - 1) ; /*Handle*/
|
||||
},
|
||||
// remove a listener from an object
|
||||
remove: function(/*Object*/ source, /*String*/ method, /*Handle*/ handle){
|
||||
var f = (source||dojo.global)[method], l = f && f[listenersName];
|
||||
if(f && l && handle--){
|
||||
delete ieh[l[handle]];
|
||||
delete l[handle];
|
||||
}
|
||||
}
|
||||
};
|
||||
// alias used above
|
||||
var ieh = iel.handlers;
|
||||
}
|
||||
|
||||
dojo.mixin(del, {
|
||||
add: function(/*DOMNode*/ node, /*String*/ event, /*Function*/ fp){
|
||||
if(!node){return;} // undefined
|
||||
event = del._normalizeEventName(event);
|
||||
if(event=="onkeypress"){
|
||||
// we need to listen to onkeydown to synthesize
|
||||
// keypress events that otherwise won't fire
|
||||
// on IE
|
||||
var kd = node.onkeydown;
|
||||
if(!kd || !kd[listenersName] || !kd._stealthKeydownHandle){
|
||||
var h = del.add(node, "onkeydown", del._stealthKeyDown);
|
||||
kd = node.onkeydown;
|
||||
kd._stealthKeydownHandle = h;
|
||||
kd._stealthKeydownRefs = 1;
|
||||
}else{
|
||||
kd._stealthKeydownRefs++;
|
||||
}
|
||||
}
|
||||
return iel.add(node, event, del._fixCallback(fp));
|
||||
},
|
||||
remove: function(/*DOMNode*/ node, /*String*/ event, /*Handle*/ handle){
|
||||
event = del._normalizeEventName(event);
|
||||
iel.remove(node, event, handle);
|
||||
if(event=="onkeypress"){
|
||||
var kd = node.onkeydown;
|
||||
if(--kd._stealthKeydownRefs <= 0){
|
||||
iel.remove(node, "onkeydown", kd._stealthKeydownHandle);
|
||||
delete kd._stealthKeydownHandle;
|
||||
}
|
||||
}
|
||||
},
|
||||
_normalizeEventName: function(/*String*/ eventName){
|
||||
// Generally, eventName should be lower case, unless it is
|
||||
// special somehow (e.g. a Mozilla event)
|
||||
// ensure 'on'
|
||||
return eventName.slice(0,2) != "on" ? "on" + eventName : eventName;
|
||||
},
|
||||
_nop: function(){},
|
||||
_fixEvent: function(/*Event*/ evt, /*DOMNode*/ sender){
|
||||
// summary:
|
||||
// normalizes properties on the event object including event
|
||||
// bubbling methods, keystroke normalization, and x/y positions
|
||||
// evt:
|
||||
// native event object
|
||||
// sender:
|
||||
// node to treat as "currentTarget"
|
||||
if(!evt){
|
||||
var w = sender && (sender.ownerDocument || sender.document || sender).parentWindow || window;
|
||||
evt = w.event;
|
||||
}
|
||||
if(!evt){return(evt);}
|
||||
evt.target = evt.srcElement;
|
||||
evt.currentTarget = (sender || evt.srcElement);
|
||||
evt.layerX = evt.offsetX;
|
||||
evt.layerY = evt.offsetY;
|
||||
// FIXME: scroll position query is duped from dojo.html to
|
||||
// avoid dependency on that entire module. Now that HTML is in
|
||||
// Base, we should convert back to something similar there.
|
||||
var se = evt.srcElement, doc = (se && se.ownerDocument) || document;
|
||||
// DO NOT replace the following to use dojo.body(), in IE, document.documentElement should be used
|
||||
// here rather than document.body
|
||||
var docBody = ((dojo.isIE < 6) || (doc["compatMode"] == "BackCompat")) ? doc.body : doc.documentElement;
|
||||
var offset = dojo._getIeDocumentElementOffset();
|
||||
evt.pageX = evt.clientX + dojo._fixIeBiDiScrollLeft(docBody.scrollLeft || 0) - offset.x;
|
||||
evt.pageY = evt.clientY + (docBody.scrollTop || 0) - offset.y;
|
||||
if(evt.type == "mouseover"){
|
||||
evt.relatedTarget = evt.fromElement;
|
||||
}
|
||||
if(evt.type == "mouseout"){
|
||||
evt.relatedTarget = evt.toElement;
|
||||
}
|
||||
evt.stopPropagation = del._stopPropagation;
|
||||
evt.preventDefault = del._preventDefault;
|
||||
return del._fixKeys(evt);
|
||||
},
|
||||
_fixKeys: function(evt){
|
||||
switch(evt.type){
|
||||
case "keypress":
|
||||
var c = ("charCode" in evt ? evt.charCode : evt.keyCode);
|
||||
if (c==10){
|
||||
// CTRL-ENTER is CTRL-ASCII(10) on IE, but CTRL-ENTER on Mozilla
|
||||
c=0;
|
||||
evt.keyCode = 13;
|
||||
}else if(c==13||c==27){
|
||||
c=0; // Mozilla considers ENTER and ESC non-printable
|
||||
}else if(c==3){
|
||||
c=99; // Mozilla maps CTRL-BREAK to CTRL-c
|
||||
}
|
||||
// Mozilla sets keyCode to 0 when there is a charCode
|
||||
// but that stops the event on IE.
|
||||
evt.charCode = c;
|
||||
del._setKeyChar(evt);
|
||||
break;
|
||||
}
|
||||
return evt;
|
||||
},
|
||||
_stealthKeyDown: function(evt){
|
||||
// IE doesn't fire keypress for most non-printable characters.
|
||||
// other browsers do, we simulate it here.
|
||||
var kp = evt.currentTarget.onkeypress;
|
||||
// only works if kp exists and is a dispatcher
|
||||
if(!kp || !kp[listenersName]){ return; }
|
||||
// munge key/charCode
|
||||
var k=evt.keyCode;
|
||||
// These are Windows Virtual Key Codes
|
||||
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/VirtualKeyCodes.asp
|
||||
var unprintable = k!=13 && k!=32 && k!=27 && (k<48||k>90) && (k<96||k>111) && (k<186||k>192) && (k<219||k>222);
|
||||
// synthesize keypress for most unprintables and CTRL-keys
|
||||
if(unprintable||evt.ctrlKey){
|
||||
var c = unprintable ? 0 : k;
|
||||
if(evt.ctrlKey){
|
||||
if(k==3 || k==13){
|
||||
return; // IE will post CTRL-BREAK, CTRL-ENTER as keypress natively
|
||||
}else if(c>95 && c<106){
|
||||
c -= 48; // map CTRL-[numpad 0-9] to ASCII
|
||||
}else if((!evt.shiftKey)&&(c>=65&&c<=90)){
|
||||
c += 32; // map CTRL-[A-Z] to lowercase
|
||||
}else{
|
||||
c = del._punctMap[c] || c; // map other problematic CTRL combinations to ASCII
|
||||
}
|
||||
}
|
||||
// simulate a keypress event
|
||||
var faux = del._synthesizeEvent(evt, {type: 'keypress', faux: true, charCode: c});
|
||||
kp.call(evt.currentTarget, faux);
|
||||
evt.cancelBubble = faux.cancelBubble;
|
||||
evt.returnValue = faux.returnValue;
|
||||
_trySetKeyCode(evt, faux.keyCode);
|
||||
}
|
||||
},
|
||||
// Called in Event scope
|
||||
_stopPropagation: function(){
|
||||
this.cancelBubble = true;
|
||||
},
|
||||
_preventDefault: function(){
|
||||
// Setting keyCode to 0 is the only way to prevent certain keypresses (namely
|
||||
// ctrl-combinations that correspond to menu accelerator keys).
|
||||
// Otoh, it prevents upstream listeners from getting this information
|
||||
// Try to split the difference here by clobbering keyCode only for ctrl
|
||||
// combinations. If you still need to access the key upstream, bubbledKeyCode is
|
||||
// provided as a workaround.
|
||||
this.bubbledKeyCode = this.keyCode;
|
||||
if(this.ctrlKey){_trySetKeyCode(this, 0);}
|
||||
this.returnValue = false;
|
||||
}
|
||||
});
|
||||
|
||||
// override stopEvent for IE
|
||||
dojo.stopEvent = function(evt){
|
||||
evt = evt || window.event;
|
||||
del._stopPropagation.call(evt);
|
||||
del._preventDefault.call(evt);
|
||||
}
|
||||
}
|
||||
|
||||
del._synthesizeEvent = function(evt, props){
|
||||
var faux = dojo.mixin({}, evt, props);
|
||||
del._setKeyChar(faux);
|
||||
// FIXME: would prefer to use dojo.hitch: dojo.hitch(evt, evt.preventDefault);
|
||||
// but it throws an error when preventDefault is invoked on Safari
|
||||
// does Event.preventDefault not support "apply" on Safari?
|
||||
faux.preventDefault = function(){ evt.preventDefault(); };
|
||||
faux.stopPropagation = function(){ evt.stopPropagation(); };
|
||||
return faux;
|
||||
}
|
||||
|
||||
// Opera event normalization
|
||||
if(dojo.isOpera){
|
||||
dojo.mixin(del, {
|
||||
_fixEvent: function(evt, sender){
|
||||
switch(evt.type){
|
||||
case "keypress":
|
||||
var c = evt.which;
|
||||
if(c==3){
|
||||
c=99; // Mozilla maps CTRL-BREAK to CTRL-c
|
||||
}
|
||||
// can't trap some keys at all, like INSERT and DELETE
|
||||
// there is no differentiating info between DELETE and ".", or INSERT and "-"
|
||||
c = c<41 && !evt.shiftKey ? 0 : c;
|
||||
if(evt.ctrlKey && !evt.shiftKey && c>=65 && c<=90){
|
||||
// lowercase CTRL-[A-Z] keys
|
||||
c += 32;
|
||||
}
|
||||
return del._synthesizeEvent(evt, { charCode: c });
|
||||
}
|
||||
return evt;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Webkit event normalization
|
||||
if(dojo.isWebKit){
|
||||
del._add = del.add;
|
||||
del._remove = del.remove;
|
||||
|
||||
dojo.mixin(del, {
|
||||
add: function(/*DOMNode*/ node, /*String*/ event, /*Function*/ fp){
|
||||
if(!node){return;} // undefined
|
||||
var handle = del._add(node, event, fp);
|
||||
if(del._normalizeEventName(event) == "keypress"){
|
||||
// we need to listen to onkeydown to synthesize
|
||||
// keypress events that otherwise won't fire
|
||||
// in Safari 3.1+: https://lists.webkit.org/pipermail/webkit-dev/2007-December/002992.html
|
||||
handle._stealthKeyDownHandle = del._add(node, "keydown", function(evt){
|
||||
//A variation on the IE _stealthKeydown function
|
||||
//Synthesize an onkeypress event, but only for unprintable characters.
|
||||
var k=evt.keyCode;
|
||||
// These are Windows Virtual Key Codes
|
||||
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/VirtualKeyCodes.asp
|
||||
var unprintable = k!=13 && k!=32 && (k<48 || k>90) && (k<96 || k>111) && (k<186 || k>192) && (k<219 || k>222);
|
||||
// synthesize keypress for most unprintables and CTRL-keys
|
||||
if(unprintable || evt.ctrlKey){
|
||||
var c = unprintable ? 0 : k;
|
||||
if(evt.ctrlKey){
|
||||
if(k==3 || k==13){
|
||||
return; // IE will post CTRL-BREAK, CTRL-ENTER as keypress natively
|
||||
}else if(c>95 && c<106){
|
||||
c -= 48; // map CTRL-[numpad 0-9] to ASCII
|
||||
}else if(!evt.shiftKey && c>=65 && c<=90){
|
||||
c += 32; // map CTRL-[A-Z] to lowercase
|
||||
}else{
|
||||
c = del._punctMap[c] || c; // map other problematic CTRL combinations to ASCII
|
||||
}
|
||||
}
|
||||
// simulate a keypress event
|
||||
var faux = del._synthesizeEvent(evt, {type: 'keypress', faux: true, charCode: c});
|
||||
fp.call(evt.currentTarget, faux);
|
||||
}
|
||||
});
|
||||
}
|
||||
return handle; /*Handle*/
|
||||
},
|
||||
|
||||
remove: function(/*DOMNode*/ node, /*String*/ event, /*Handle*/ handle){
|
||||
if(node){
|
||||
if(handle._stealthKeyDownHandle){
|
||||
del._remove(node, "keydown", handle._stealthKeyDownHandle);
|
||||
}
|
||||
del._remove(node, event, handle);
|
||||
}
|
||||
},
|
||||
_fixEvent: function(evt, sender){
|
||||
switch(evt.type){
|
||||
case "keypress":
|
||||
if(evt.faux){ return evt; }
|
||||
var c = evt.charCode;
|
||||
c = c>=32 ? c : 0;
|
||||
return del._synthesizeEvent(evt, {charCode: c, faux: true});
|
||||
}
|
||||
return evt;
|
||||
}
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
if(dojo.isIE){
|
||||
dojo.mouseButtons={LEFT:1,MIDDLE:4,RIGHT:2,isButton:function(e,_1a){
|
||||
return e.button&_1a;
|
||||
},isLeft:function(e){
|
||||
return e.button&1;
|
||||
},isMiddle:function(e){
|
||||
return e.button&4;
|
||||
},isRight:function(e){
|
||||
return e.button&2;
|
||||
}};
|
||||
}else{
|
||||
dojo.mouseButtons={LEFT:0,MIDDLE:1,RIGHT:2,isButton:function(e,_1b){
|
||||
return e.button==_1b;
|
||||
},isLeft:function(e){
|
||||
return e.button==0;
|
||||
},isMiddle:function(e){
|
||||
return e.button==1;
|
||||
},isRight:function(e){
|
||||
return e.button==2;
|
||||
}};
|
||||
}
|
||||
if(dojo.isIE){
|
||||
var _1c=function(e,_1d){
|
||||
try{
|
||||
return (e.keyCode=_1d);
|
||||
}
|
||||
catch(e){
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
var iel=dojo._listener;
|
||||
var _1e=(dojo._ieListenersName="_"+dojo._scopeName+"_listeners");
|
||||
if(!dojo.config._allow_leaks){
|
||||
_10=iel=dojo._ie_listener={handlers:[],add:function(_1f,_20,_21){
|
||||
_1f=_1f||dojo.global;
|
||||
var f=_1f[_20];
|
||||
if(!f||!f[_1e]){
|
||||
var d=dojo._getIeDispatcher();
|
||||
d.target=f&&(ieh.push(f)-1);
|
||||
d[_1e]=[];
|
||||
f=_1f[_20]=d;
|
||||
}
|
||||
return f[_1e].push(ieh.push(_21)-1);
|
||||
},remove:function(_22,_23,_24){
|
||||
var f=(_22||dojo.global)[_23],l=f&&f[_1e];
|
||||
if(f&&l&&_24--){
|
||||
delete ieh[l[_24]];
|
||||
delete l[_24];
|
||||
}
|
||||
}};
|
||||
var ieh=iel.handlers;
|
||||
}
|
||||
dojo.mixin(_1,{add:function(_25,_26,fp){
|
||||
if(!_25){
|
||||
return;
|
||||
}
|
||||
_26=_1._normalizeEventName(_26);
|
||||
if(_26=="onkeypress"){
|
||||
var kd=_25.onkeydown;
|
||||
if(!kd||!kd[_1e]||!kd._stealthKeydownHandle){
|
||||
var h=_1.add(_25,"onkeydown",_1._stealthKeyDown);
|
||||
kd=_25.onkeydown;
|
||||
kd._stealthKeydownHandle=h;
|
||||
kd._stealthKeydownRefs=1;
|
||||
}else{
|
||||
kd._stealthKeydownRefs++;
|
||||
}
|
||||
}
|
||||
return iel.add(_25,_26,_1._fixCallback(fp));
|
||||
},remove:function(_27,_28,_29){
|
||||
_28=_1._normalizeEventName(_28);
|
||||
iel.remove(_27,_28,_29);
|
||||
if(_28=="onkeypress"){
|
||||
var kd=_27.onkeydown;
|
||||
if(--kd._stealthKeydownRefs<=0){
|
||||
iel.remove(_27,"onkeydown",kd._stealthKeydownHandle);
|
||||
delete kd._stealthKeydownHandle;
|
||||
}
|
||||
}
|
||||
},_normalizeEventName:function(_2a){
|
||||
return _2a.slice(0,2)!="on"?"on"+_2a:_2a;
|
||||
},_nop:function(){
|
||||
},_fixEvent:function(evt,_2b){
|
||||
if(!evt){
|
||||
var w=_2b&&(_2b.ownerDocument||_2b.document||_2b).parentWindow||window;
|
||||
evt=w.event;
|
||||
}
|
||||
if(!evt){
|
||||
return (evt);
|
||||
}
|
||||
evt.target=evt.srcElement;
|
||||
evt.currentTarget=(_2b||evt.srcElement);
|
||||
evt.layerX=evt.offsetX;
|
||||
evt.layerY=evt.offsetY;
|
||||
var se=evt.srcElement,doc=(se&&se.ownerDocument)||document;
|
||||
var _2c=((dojo.isIE<6)||(doc["compatMode"]=="BackCompat"))?doc.body:doc.documentElement;
|
||||
var _2d=dojo._getIeDocumentElementOffset();
|
||||
evt.pageX=evt.clientX+dojo._fixIeBiDiScrollLeft(_2c.scrollLeft||0)-_2d.x;
|
||||
evt.pageY=evt.clientY+(_2c.scrollTop||0)-_2d.y;
|
||||
if(evt.type=="mouseover"){
|
||||
evt.relatedTarget=evt.fromElement;
|
||||
}
|
||||
if(evt.type=="mouseout"){
|
||||
evt.relatedTarget=evt.toElement;
|
||||
}
|
||||
evt.stopPropagation=_1._stopPropagation;
|
||||
evt.preventDefault=_1._preventDefault;
|
||||
return _1._fixKeys(evt);
|
||||
},_fixKeys:function(evt){
|
||||
switch(evt.type){
|
||||
case "keypress":
|
||||
var c=("charCode" in evt?evt.charCode:evt.keyCode);
|
||||
if(c==10){
|
||||
c=0;
|
||||
evt.keyCode=13;
|
||||
}else{
|
||||
if(c==13||c==27){
|
||||
c=0;
|
||||
}else{
|
||||
if(c==3){
|
||||
c=99;
|
||||
}
|
||||
}
|
||||
}
|
||||
evt.charCode=c;
|
||||
_1._setKeyChar(evt);
|
||||
break;
|
||||
}
|
||||
return evt;
|
||||
},_stealthKeyDown:function(evt){
|
||||
var kp=evt.currentTarget.onkeypress;
|
||||
if(!kp||!kp[_1e]){
|
||||
return;
|
||||
}
|
||||
var k=evt.keyCode;
|
||||
var _2e=k!=13&&k!=32&&k!=27&&(k<48||k>90)&&(k<96||k>111)&&(k<186||k>192)&&(k<219||k>222);
|
||||
if(_2e||evt.ctrlKey){
|
||||
var c=_2e?0:k;
|
||||
if(evt.ctrlKey){
|
||||
if(k==3||k==13){
|
||||
return;
|
||||
}else{
|
||||
if(c>95&&c<106){
|
||||
c-=48;
|
||||
}else{
|
||||
if((!evt.shiftKey)&&(c>=65&&c<=90)){
|
||||
c+=32;
|
||||
}else{
|
||||
c=_1._punctMap[c]||c;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var _2f=_1._synthesizeEvent(evt,{type:"keypress",faux:true,charCode:c});
|
||||
kp.call(evt.currentTarget,_2f);
|
||||
evt.cancelBubble=_2f.cancelBubble;
|
||||
evt.returnValue=_2f.returnValue;
|
||||
_1c(evt,_2f.keyCode);
|
||||
}
|
||||
},_stopPropagation:function(){
|
||||
this.cancelBubble=true;
|
||||
},_preventDefault:function(){
|
||||
this.bubbledKeyCode=this.keyCode;
|
||||
if(this.ctrlKey){
|
||||
_1c(this,0);
|
||||
}
|
||||
this.returnValue=false;
|
||||
}});
|
||||
dojo.stopEvent=function(evt){
|
||||
evt=evt||window.event;
|
||||
_1._stopPropagation.call(evt);
|
||||
_1._preventDefault.call(evt);
|
||||
};
|
||||
}
|
||||
_1._synthesizeEvent=function(evt,_30){
|
||||
var _31=dojo.mixin({},evt,_30);
|
||||
_1._setKeyChar(_31);
|
||||
_31.preventDefault=function(){
|
||||
evt.preventDefault();
|
||||
};
|
||||
_31.stopPropagation=function(){
|
||||
evt.stopPropagation();
|
||||
};
|
||||
return _31;
|
||||
};
|
||||
if(dojo.isOpera){
|
||||
dojo.mixin(_1,{_fixEvent:function(evt,_32){
|
||||
switch(evt.type){
|
||||
case "keypress":
|
||||
var c=evt.which;
|
||||
if(c==3){
|
||||
c=99;
|
||||
}
|
||||
c=c<41&&!evt.shiftKey?0:c;
|
||||
if(evt.ctrlKey&&!evt.shiftKey&&c>=65&&c<=90){
|
||||
c+=32;
|
||||
}
|
||||
return _1._synthesizeEvent(evt,{charCode:c});
|
||||
}
|
||||
return evt;
|
||||
}});
|
||||
}
|
||||
if(dojo.isWebKit){
|
||||
_1._add=_1.add;
|
||||
_1._remove=_1.remove;
|
||||
dojo.mixin(_1,{add:function(_33,_34,fp){
|
||||
if(!_33){
|
||||
return;
|
||||
}
|
||||
var _35=_1._add(_33,_34,fp);
|
||||
if(_1._normalizeEventName(_34)=="keypress"){
|
||||
_35._stealthKeyDownHandle=_1._add(_33,"keydown",function(evt){
|
||||
var k=evt.keyCode;
|
||||
var _36=k!=13&&k!=32&&(k<48||k>90)&&(k<96||k>111)&&(k<186||k>192)&&(k<219||k>222);
|
||||
if(_36||evt.ctrlKey){
|
||||
var c=_36?0:k;
|
||||
if(evt.ctrlKey){
|
||||
if(k==3||k==13){
|
||||
return;
|
||||
}else{
|
||||
if(c>95&&c<106){
|
||||
c-=48;
|
||||
}else{
|
||||
if(!evt.shiftKey&&c>=65&&c<=90){
|
||||
c+=32;
|
||||
}else{
|
||||
c=_1._punctMap[c]||c;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var _37=_1._synthesizeEvent(evt,{type:"keypress",faux:true,charCode:c});
|
||||
fp.call(evt.currentTarget,_37);
|
||||
}
|
||||
});
|
||||
}
|
||||
return _35;
|
||||
},remove:function(_38,_39,_3a){
|
||||
if(_38){
|
||||
if(_3a._stealthKeyDownHandle){
|
||||
_1._remove(_38,"keydown",_3a._stealthKeyDownHandle);
|
||||
}
|
||||
_1._remove(_38,_39,_3a);
|
||||
}
|
||||
},_fixEvent:function(evt,_3b){
|
||||
switch(evt.type){
|
||||
case "keypress":
|
||||
if(evt.faux){
|
||||
return evt;
|
||||
}
|
||||
var c=evt.charCode;
|
||||
c=c>=32?c:0;
|
||||
return _1._synthesizeEvent(evt,{charCode:c,faux:true});
|
||||
}
|
||||
return evt;
|
||||
}});
|
||||
}
|
||||
})();
|
||||
if(dojo.isIE){
|
||||
dojo._ieDispatcher=function(_3c,_3d){
|
||||
var ap=Array.prototype,h=dojo._ie_listener.handlers,c=_3c.callee,ls=c[dojo._ieListenersName],t=h[c.target];
|
||||
var r=t&&t.apply(_3d,_3c);
|
||||
var lls=[].concat(ls);
|
||||
for(var i in lls){
|
||||
var f=h[lls[i]];
|
||||
if(!(i in ap)&&f){
|
||||
f.apply(_3d,_3c);
|
||||
}
|
||||
}
|
||||
return r;
|
||||
};
|
||||
dojo._getIeDispatcher=function(){
|
||||
return new Function(dojo._scopeName+"._ieDispatcher(arguments, this)");
|
||||
};
|
||||
dojo._event_listener._fixCallback=function(fp){
|
||||
var f=dojo._event_listener._fixEvent;
|
||||
return function(e){
|
||||
return fp.call(this,f(e,this));
|
||||
};
|
||||
};
|
||||
// keep this out of the closure
|
||||
// closing over 'iel' or 'ieh' b0rks leak prevention
|
||||
// ls[i] is an index into the master handler array
|
||||
dojo._ieDispatcher = function(args, sender){
|
||||
var ap = Array.prototype,
|
||||
h = dojo._ie_listener.handlers,
|
||||
c = args.callee,
|
||||
ls = c[dojo._ieListenersName],
|
||||
t = h[c.target];
|
||||
// return value comes from original target function
|
||||
var r = t && t.apply(sender, args);
|
||||
// make local copy of listener array so it's immutable during processing
|
||||
var lls = [].concat(ls);
|
||||
// invoke listeners after target function
|
||||
for(var i in lls){
|
||||
var f = h[lls[i]];
|
||||
if(!(i in ap) && f){
|
||||
f.apply(sender, args);
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
dojo._getIeDispatcher = function(){
|
||||
// ensure the returned function closes over nothing ("new Function" apparently doesn't close)
|
||||
return new Function(dojo._scopeName + "._ieDispatcher(arguments, this)"); // function
|
||||
}
|
||||
// keep this out of the closure to reduce RAM allocation
|
||||
dojo._event_listener._fixCallback = function(fp){
|
||||
var f = dojo._event_listener._fixEvent;
|
||||
return function(e){ return fp.call(this, f(e, this)); };
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,298 +5,665 @@
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dojo._base.fx"]){
|
||||
dojo._hasResource["dojo._base.fx"]=true;
|
||||
if(!dojo._hasResource["dojo._base.fx"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo._base.fx"] = true;
|
||||
dojo.provide("dojo._base.fx");
|
||||
dojo.require("dojo._base.Color");
|
||||
dojo.require("dojo._base.connect");
|
||||
dojo.require("dojo._base.lang");
|
||||
dojo.require("dojo._base.html");
|
||||
|
||||
/*
|
||||
Animation loosely package based on Dan Pupius' work, contributed under CLA:
|
||||
http://pupius.co.uk/js/Toolkit.Drawing.js
|
||||
*/
|
||||
(function(){
|
||||
var d=dojo;
|
||||
var _1=d._mixin;
|
||||
dojo._Line=function(_2,_3){
|
||||
this.start=_2;
|
||||
this.end=_3;
|
||||
};
|
||||
dojo._Line.prototype.getValue=function(n){
|
||||
return ((this.end-this.start)*n)+this.start;
|
||||
};
|
||||
dojo.Animation=function(_4){
|
||||
_1(this,_4);
|
||||
if(d.isArray(this.curve)){
|
||||
this.curve=new d._Line(this.curve[0],this.curve[1]);
|
||||
}
|
||||
};
|
||||
d._Animation=d.Animation;
|
||||
d.extend(dojo.Animation,{duration:350,repeat:0,rate:20,_percent:0,_startRepeatCount:0,_getStep:function(){
|
||||
var _5=this._percent,_6=this.easing;
|
||||
return _6?_6(_5):_5;
|
||||
},_fire:function(_7,_8){
|
||||
var a=_8||[];
|
||||
if(this[_7]){
|
||||
if(d.config.debugAtAllCosts){
|
||||
this[_7].apply(this,a);
|
||||
}else{
|
||||
try{
|
||||
this[_7].apply(this,a);
|
||||
}
|
||||
catch(e){
|
||||
console.error("exception in animation handler for:",_7);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
},play:function(_9,_a){
|
||||
var _b=this;
|
||||
if(_b._delayTimer){
|
||||
_b._clearTimer();
|
||||
}
|
||||
if(_a){
|
||||
_b._stopTimer();
|
||||
_b._active=_b._paused=false;
|
||||
_b._percent=0;
|
||||
}else{
|
||||
if(_b._active&&!_b._paused){
|
||||
return _b;
|
||||
}
|
||||
}
|
||||
_b._fire("beforeBegin",[_b.node]);
|
||||
var de=_9||_b.delay,_c=dojo.hitch(_b,"_play",_a);
|
||||
if(de>0){
|
||||
_b._delayTimer=setTimeout(_c,de);
|
||||
return _b;
|
||||
}
|
||||
_c();
|
||||
return _b;
|
||||
},_play:function(_d){
|
||||
var _e=this;
|
||||
if(_e._delayTimer){
|
||||
_e._clearTimer();
|
||||
}
|
||||
_e._startTime=new Date().valueOf();
|
||||
if(_e._paused){
|
||||
_e._startTime-=_e.duration*_e._percent;
|
||||
}
|
||||
_e._active=true;
|
||||
_e._paused=false;
|
||||
var _f=_e.curve.getValue(_e._getStep());
|
||||
if(!_e._percent){
|
||||
if(!_e._startRepeatCount){
|
||||
_e._startRepeatCount=_e.repeat;
|
||||
}
|
||||
_e._fire("onBegin",[_f]);
|
||||
}
|
||||
_e._fire("onPlay",[_f]);
|
||||
_e._cycle();
|
||||
return _e;
|
||||
},pause:function(){
|
||||
var _10=this;
|
||||
if(_10._delayTimer){
|
||||
_10._clearTimer();
|
||||
}
|
||||
_10._stopTimer();
|
||||
if(!_10._active){
|
||||
return _10;
|
||||
}
|
||||
_10._paused=true;
|
||||
_10._fire("onPause",[_10.curve.getValue(_10._getStep())]);
|
||||
return _10;
|
||||
},gotoPercent:function(_11,_12){
|
||||
var _13=this;
|
||||
_13._stopTimer();
|
||||
_13._active=_13._paused=true;
|
||||
_13._percent=_11;
|
||||
if(_12){
|
||||
_13.play();
|
||||
}
|
||||
return _13;
|
||||
},stop:function(_14){
|
||||
var _15=this;
|
||||
if(_15._delayTimer){
|
||||
_15._clearTimer();
|
||||
}
|
||||
if(!_15._timer){
|
||||
return _15;
|
||||
}
|
||||
_15._stopTimer();
|
||||
if(_14){
|
||||
_15._percent=1;
|
||||
}
|
||||
_15._fire("onStop",[_15.curve.getValue(_15._getStep())]);
|
||||
_15._active=_15._paused=false;
|
||||
return _15;
|
||||
},status:function(){
|
||||
if(this._active){
|
||||
return this._paused?"paused":"playing";
|
||||
}
|
||||
return "stopped";
|
||||
},_cycle:function(){
|
||||
var _16=this;
|
||||
if(_16._active){
|
||||
var _17=new Date().valueOf();
|
||||
var _18=(_17-_16._startTime)/(_16.duration);
|
||||
if(_18>=1){
|
||||
_18=1;
|
||||
}
|
||||
_16._percent=_18;
|
||||
if(_16.easing){
|
||||
_18=_16.easing(_18);
|
||||
}
|
||||
_16._fire("onAnimate",[_16.curve.getValue(_18)]);
|
||||
if(_16._percent<1){
|
||||
_16._startTimer();
|
||||
}else{
|
||||
_16._active=false;
|
||||
if(_16.repeat>0){
|
||||
_16.repeat--;
|
||||
_16.play(null,true);
|
||||
}else{
|
||||
if(_16.repeat==-1){
|
||||
_16.play(null,true);
|
||||
}else{
|
||||
if(_16._startRepeatCount){
|
||||
_16.repeat=_16._startRepeatCount;
|
||||
_16._startRepeatCount=0;
|
||||
}
|
||||
}
|
||||
}
|
||||
_16._percent=0;
|
||||
_16._fire("onEnd",[_16.node]);
|
||||
!_16.repeat&&_16._stopTimer();
|
||||
}
|
||||
}
|
||||
return _16;
|
||||
},_clearTimer:function(){
|
||||
clearTimeout(this._delayTimer);
|
||||
delete this._delayTimer;
|
||||
}});
|
||||
var ctr=0,_19=null,_1a={run:function(){
|
||||
}};
|
||||
d.extend(d.Animation,{_startTimer:function(){
|
||||
if(!this._timer){
|
||||
this._timer=d.connect(_1a,"run",this,"_cycle");
|
||||
ctr++;
|
||||
}
|
||||
if(!_19){
|
||||
_19=setInterval(d.hitch(_1a,"run"),this.rate);
|
||||
}
|
||||
},_stopTimer:function(){
|
||||
if(this._timer){
|
||||
d.disconnect(this._timer);
|
||||
this._timer=null;
|
||||
ctr--;
|
||||
}
|
||||
if(ctr<=0){
|
||||
clearInterval(_19);
|
||||
_19=null;
|
||||
ctr=0;
|
||||
}
|
||||
}});
|
||||
var _1b=d.isIE?function(_1c){
|
||||
var ns=_1c.style;
|
||||
if(!ns.width.length&&d.style(_1c,"width")=="auto"){
|
||||
ns.width="auto";
|
||||
}
|
||||
}:function(){
|
||||
};
|
||||
dojo._fade=function(_1d){
|
||||
_1d.node=d.byId(_1d.node);
|
||||
var _1e=_1({properties:{}},_1d),_1f=(_1e.properties.opacity={});
|
||||
_1f.start=!("start" in _1e)?function(){
|
||||
return +d.style(_1e.node,"opacity")||0;
|
||||
}:_1e.start;
|
||||
_1f.end=_1e.end;
|
||||
var _20=d.animateProperty(_1e);
|
||||
d.connect(_20,"beforeBegin",d.partial(_1b,_1e.node));
|
||||
return _20;
|
||||
};
|
||||
dojo.fadeIn=function(_21){
|
||||
return d._fade(_1({end:1},_21));
|
||||
};
|
||||
dojo.fadeOut=function(_22){
|
||||
return d._fade(_1({end:0},_22));
|
||||
};
|
||||
dojo._defaultEasing=function(n){
|
||||
return 0.5+((Math.sin((n+1.5)*Math.PI))/2);
|
||||
};
|
||||
var _23=function(_24){
|
||||
this._properties=_24;
|
||||
for(var p in _24){
|
||||
var _25=_24[p];
|
||||
if(_25.start instanceof d.Color){
|
||||
_25.tempColor=new d.Color();
|
||||
}
|
||||
}
|
||||
};
|
||||
_23.prototype.getValue=function(r){
|
||||
var ret={};
|
||||
for(var p in this._properties){
|
||||
var _26=this._properties[p],_27=_26.start;
|
||||
if(_27 instanceof d.Color){
|
||||
ret[p]=d.blendColors(_27,_26.end,r,_26.tempColor).toCss();
|
||||
}else{
|
||||
if(!d.isArray(_27)){
|
||||
ret[p]=((_26.end-_27)*r)+_27+(p!="opacity"?_26.units||"px":0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
dojo.animateProperty=function(_28){
|
||||
var n=_28.node=d.byId(_28.node);
|
||||
if(!_28.easing){
|
||||
_28.easing=d._defaultEasing;
|
||||
}
|
||||
var _29=new d.Animation(_28);
|
||||
d.connect(_29,"beforeBegin",_29,function(){
|
||||
var pm={};
|
||||
for(var p in this.properties){
|
||||
if(p=="width"||p=="height"){
|
||||
this.node.display="block";
|
||||
}
|
||||
var _2a=this.properties[p];
|
||||
if(d.isFunction(_2a)){
|
||||
_2a=_2a(n);
|
||||
}
|
||||
_2a=pm[p]=_1({},(d.isObject(_2a)?_2a:{end:_2a}));
|
||||
if(d.isFunction(_2a.start)){
|
||||
_2a.start=_2a.start(n);
|
||||
}
|
||||
if(d.isFunction(_2a.end)){
|
||||
_2a.end=_2a.end(n);
|
||||
}
|
||||
var _2b=(p.toLowerCase().indexOf("color")>=0);
|
||||
function _2c(_2d,p){
|
||||
var v={height:_2d.offsetHeight,width:_2d.offsetWidth}[p];
|
||||
if(v!==undefined){
|
||||
return v;
|
||||
}
|
||||
v=d.style(_2d,p);
|
||||
return (p=="opacity")?+v:(_2b?v:parseFloat(v));
|
||||
};
|
||||
if(!("end" in _2a)){
|
||||
_2a.end=_2c(n,p);
|
||||
}else{
|
||||
if(!("start" in _2a)){
|
||||
_2a.start=_2c(n,p);
|
||||
}
|
||||
}
|
||||
if(_2b){
|
||||
_2a.start=new d.Color(_2a.start);
|
||||
_2a.end=new d.Color(_2a.end);
|
||||
}else{
|
||||
_2a.start=(p=="opacity")?+_2a.start:parseFloat(_2a.start);
|
||||
}
|
||||
}
|
||||
this.curve=new _23(pm);
|
||||
});
|
||||
d.connect(_29,"onAnimate",d.hitch(d,"style",_29.node));
|
||||
return _29;
|
||||
};
|
||||
dojo.anim=function(_2e,_2f,_30,_31,_32,_33){
|
||||
return d.animateProperty({node:_2e,duration:_30||d.Animation.prototype.duration,properties:_2f,easing:_31,onEnd:_32}).play(_33||0);
|
||||
};
|
||||
var d = dojo;
|
||||
var _mixin = d._mixin;
|
||||
|
||||
dojo._Line = function(/*int*/ start, /*int*/ end){
|
||||
// summary:
|
||||
// dojo._Line is the object used to generate values from a start value
|
||||
// to an end value
|
||||
// start: int
|
||||
// Beginning value for range
|
||||
// end: int
|
||||
// Ending value for range
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
};
|
||||
|
||||
dojo._Line.prototype.getValue = function(/*float*/ n){
|
||||
// summary: Returns the point on the line
|
||||
// n: a floating point number greater than 0 and less than 1
|
||||
return ((this.end - this.start) * n) + this.start; // Decimal
|
||||
};
|
||||
|
||||
dojo.Animation = function(args){
|
||||
// summary:
|
||||
// A generic animation class that fires callbacks into its handlers
|
||||
// object at various states.
|
||||
// description:
|
||||
// A generic animation class that fires callbacks into its handlers
|
||||
// object at various states. Nearly all dojo animation functions
|
||||
// return an instance of this method, usually without calling the
|
||||
// .play() method beforehand. Therefore, you will likely need to
|
||||
// call .play() on instances of `dojo.Animation` when one is
|
||||
// returned.
|
||||
// args: Object
|
||||
// The 'magic argument', mixing all the properties into this
|
||||
// animation instance.
|
||||
|
||||
_mixin(this, args);
|
||||
if(d.isArray(this.curve)){
|
||||
this.curve = new d._Line(this.curve[0], this.curve[1]);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Alias to drop come 2.0:
|
||||
d._Animation = d.Animation;
|
||||
|
||||
d.extend(dojo.Animation, {
|
||||
// duration: Integer
|
||||
// The time in milliseonds the animation will take to run
|
||||
duration: 350,
|
||||
|
||||
/*=====
|
||||
// curve: dojo._Line|Array
|
||||
// A two element array of start and end values, or a `dojo._Line` instance to be
|
||||
// used in the Animation.
|
||||
curve: null,
|
||||
|
||||
// easing: Function?
|
||||
// A Function to adjust the acceleration (or deceleration) of the progress
|
||||
// across a dojo._Line
|
||||
easing: null,
|
||||
=====*/
|
||||
|
||||
// repeat: Integer?
|
||||
// The number of times to loop the animation
|
||||
repeat: 0,
|
||||
|
||||
// rate: Integer?
|
||||
// the time in milliseconds to wait before advancing to next frame
|
||||
// (used as a fps timer: 1000/rate = fps)
|
||||
rate: 20 /* 50 fps */,
|
||||
|
||||
/*=====
|
||||
// delay: Integer?
|
||||
// The time in milliseconds to wait before starting animation after it
|
||||
// has been .play()'ed
|
||||
delay: null,
|
||||
|
||||
// beforeBegin: Event?
|
||||
// Synthetic event fired before a dojo.Animation begins playing (synchronous)
|
||||
beforeBegin: null,
|
||||
|
||||
// onBegin: Event?
|
||||
// Synthetic event fired as a dojo.Animation begins playing (useful?)
|
||||
onBegin: null,
|
||||
|
||||
// onAnimate: Event?
|
||||
// Synthetic event fired at each interval of a `dojo.Animation`
|
||||
onAnimate: null,
|
||||
|
||||
// onEnd: Event?
|
||||
// Synthetic event fired after the final frame of a `dojo.Animation`
|
||||
onEnd: null,
|
||||
|
||||
// onPlay: Event?
|
||||
// Synthetic event fired any time a `dojo.Animation` is play()'ed
|
||||
onPlay: null,
|
||||
|
||||
// onPause: Event?
|
||||
// Synthetic event fired when a `dojo.Animation` is paused
|
||||
onPause: null,
|
||||
|
||||
// onStop: Event
|
||||
// Synthetic event fires when a `dojo.Animation` is stopped
|
||||
onStop: null,
|
||||
|
||||
=====*/
|
||||
|
||||
_percent: 0,
|
||||
_startRepeatCount: 0,
|
||||
|
||||
_getStep: function(){
|
||||
var _p = this._percent,
|
||||
_e = this.easing
|
||||
;
|
||||
return _e ? _e(_p) : _p;
|
||||
},
|
||||
_fire: function(/*Event*/ evt, /*Array?*/ args){
|
||||
// summary:
|
||||
// Convenience function. Fire event "evt" and pass it the
|
||||
// arguments specified in "args".
|
||||
// description:
|
||||
// Convenience function. Fire event "evt" and pass it the
|
||||
// arguments specified in "args".
|
||||
// Fires the callback in the scope of the `dojo.Animation`
|
||||
// instance.
|
||||
// evt:
|
||||
// The event to fire.
|
||||
// args:
|
||||
// The arguments to pass to the event.
|
||||
var a = args||[];
|
||||
if(this[evt]){
|
||||
if(d.config.debugAtAllCosts){
|
||||
this[evt].apply(this, a);
|
||||
}else{
|
||||
try{
|
||||
this[evt].apply(this, a);
|
||||
}catch(e){
|
||||
// squelch and log because we shouldn't allow exceptions in
|
||||
// synthetic event handlers to cause the internal timer to run
|
||||
// amuck, potentially pegging the CPU. I'm not a fan of this
|
||||
// squelch, but hopefully logging will make it clear what's
|
||||
// going on
|
||||
console.error("exception in animation handler for:", evt);
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this; // dojo.Animation
|
||||
},
|
||||
|
||||
play: function(/*int?*/ delay, /*Boolean?*/ gotoStart){
|
||||
// summary:
|
||||
// Start the animation.
|
||||
// delay:
|
||||
// How many milliseconds to delay before starting.
|
||||
// gotoStart:
|
||||
// If true, starts the animation from the beginning; otherwise,
|
||||
// starts it from its current position.
|
||||
// returns: dojo.Animation
|
||||
// The instance to allow chaining.
|
||||
|
||||
var _t = this;
|
||||
if(_t._delayTimer){ _t._clearTimer(); }
|
||||
if(gotoStart){
|
||||
_t._stopTimer();
|
||||
_t._active = _t._paused = false;
|
||||
_t._percent = 0;
|
||||
}else if(_t._active && !_t._paused){
|
||||
return _t;
|
||||
}
|
||||
|
||||
_t._fire("beforeBegin", [_t.node]);
|
||||
|
||||
var de = delay || _t.delay,
|
||||
_p = dojo.hitch(_t, "_play", gotoStart);
|
||||
|
||||
if(de > 0){
|
||||
_t._delayTimer = setTimeout(_p, de);
|
||||
return _t;
|
||||
}
|
||||
_p();
|
||||
return _t;
|
||||
},
|
||||
|
||||
_play: function(gotoStart){
|
||||
var _t = this;
|
||||
if(_t._delayTimer){ _t._clearTimer(); }
|
||||
_t._startTime = new Date().valueOf();
|
||||
if(_t._paused){
|
||||
_t._startTime -= _t.duration * _t._percent;
|
||||
}
|
||||
|
||||
_t._active = true;
|
||||
_t._paused = false;
|
||||
var value = _t.curve.getValue(_t._getStep());
|
||||
if(!_t._percent){
|
||||
if(!_t._startRepeatCount){
|
||||
_t._startRepeatCount = _t.repeat;
|
||||
}
|
||||
_t._fire("onBegin", [value]);
|
||||
}
|
||||
|
||||
_t._fire("onPlay", [value]);
|
||||
|
||||
_t._cycle();
|
||||
return _t; // dojo.Animation
|
||||
},
|
||||
|
||||
pause: function(){
|
||||
// summary: Pauses a running animation.
|
||||
var _t = this;
|
||||
if(_t._delayTimer){ _t._clearTimer(); }
|
||||
_t._stopTimer();
|
||||
if(!_t._active){ return _t; /*dojo.Animation*/ }
|
||||
_t._paused = true;
|
||||
_t._fire("onPause", [_t.curve.getValue(_t._getStep())]);
|
||||
return _t; // dojo.Animation
|
||||
},
|
||||
|
||||
gotoPercent: function(/*Decimal*/ percent, /*Boolean?*/ andPlay){
|
||||
// summary:
|
||||
// Sets the progress of the animation.
|
||||
// percent:
|
||||
// A percentage in decimal notation (between and including 0.0 and 1.0).
|
||||
// andPlay:
|
||||
// If true, play the animation after setting the progress.
|
||||
var _t = this;
|
||||
_t._stopTimer();
|
||||
_t._active = _t._paused = true;
|
||||
_t._percent = percent;
|
||||
if(andPlay){ _t.play(); }
|
||||
return _t; // dojo.Animation
|
||||
},
|
||||
|
||||
stop: function(/*boolean?*/ gotoEnd){
|
||||
// summary: Stops a running animation.
|
||||
// gotoEnd: If true, the animation will end.
|
||||
var _t = this;
|
||||
if(_t._delayTimer){ _t._clearTimer(); }
|
||||
if(!_t._timer){ return _t; /* dojo.Animation */ }
|
||||
_t._stopTimer();
|
||||
if(gotoEnd){
|
||||
_t._percent = 1;
|
||||
}
|
||||
_t._fire("onStop", [_t.curve.getValue(_t._getStep())]);
|
||||
_t._active = _t._paused = false;
|
||||
return _t; // dojo.Animation
|
||||
},
|
||||
|
||||
status: function(){
|
||||
// summary:
|
||||
// Returns a string token representation of the status of
|
||||
// the animation, one of: "paused", "playing", "stopped"
|
||||
if(this._active){
|
||||
return this._paused ? "paused" : "playing"; // String
|
||||
}
|
||||
return "stopped"; // String
|
||||
},
|
||||
|
||||
_cycle: function(){
|
||||
var _t = this;
|
||||
if(_t._active){
|
||||
var curr = new Date().valueOf();
|
||||
var step = (curr - _t._startTime) / (_t.duration);
|
||||
|
||||
if(step >= 1){
|
||||
step = 1;
|
||||
}
|
||||
_t._percent = step;
|
||||
|
||||
// Perform easing
|
||||
if(_t.easing){
|
||||
step = _t.easing(step);
|
||||
}
|
||||
|
||||
_t._fire("onAnimate", [_t.curve.getValue(step)]);
|
||||
|
||||
if(_t._percent < 1){
|
||||
_t._startTimer();
|
||||
}else{
|
||||
_t._active = false;
|
||||
|
||||
if(_t.repeat > 0){
|
||||
_t.repeat--;
|
||||
_t.play(null, true);
|
||||
}else if(_t.repeat == -1){
|
||||
_t.play(null, true);
|
||||
}else{
|
||||
if(_t._startRepeatCount){
|
||||
_t.repeat = _t._startRepeatCount;
|
||||
_t._startRepeatCount = 0;
|
||||
}
|
||||
}
|
||||
_t._percent = 0;
|
||||
_t._fire("onEnd", [_t.node]);
|
||||
!_t.repeat && _t._stopTimer();
|
||||
}
|
||||
}
|
||||
return _t; // dojo.Animation
|
||||
},
|
||||
|
||||
_clearTimer: function(){
|
||||
// summary: Clear the play delay timer
|
||||
clearTimeout(this._delayTimer);
|
||||
delete this._delayTimer;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// the local timer, stubbed into all Animation instances
|
||||
var ctr = 0,
|
||||
timer = null,
|
||||
runner = {
|
||||
run: function(){}
|
||||
};
|
||||
|
||||
d.extend(d.Animation, {
|
||||
|
||||
_startTimer: function(){
|
||||
if(!this._timer){
|
||||
this._timer = d.connect(runner, "run", this, "_cycle");
|
||||
ctr++;
|
||||
}
|
||||
if(!timer){
|
||||
timer = setInterval(d.hitch(runner, "run"), this.rate);
|
||||
}
|
||||
},
|
||||
|
||||
_stopTimer: function(){
|
||||
if(this._timer){
|
||||
d.disconnect(this._timer);
|
||||
this._timer = null;
|
||||
ctr--;
|
||||
}
|
||||
if(ctr <= 0){
|
||||
clearInterval(timer);
|
||||
timer = null;
|
||||
ctr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var _makeFadeable =
|
||||
d.isIE ? function(node){
|
||||
// only set the zoom if the "tickle" value would be the same as the
|
||||
// default
|
||||
var ns = node.style;
|
||||
// don't set the width to auto if it didn't already cascade that way.
|
||||
// We don't want to f anyones designs
|
||||
if(!ns.width.length && d.style(node, "width") == "auto"){
|
||||
ns.width = "auto";
|
||||
}
|
||||
} :
|
||||
function(){};
|
||||
|
||||
dojo._fade = function(/*Object*/ args){
|
||||
// summary:
|
||||
// Returns an animation that will fade the node defined by
|
||||
// args.node from the start to end values passed (args.start
|
||||
// args.end) (end is mandatory, start is optional)
|
||||
|
||||
args.node = d.byId(args.node);
|
||||
var fArgs = _mixin({ properties: {} }, args),
|
||||
props = (fArgs.properties.opacity = {});
|
||||
|
||||
props.start = !("start" in fArgs) ?
|
||||
function(){
|
||||
return +d.style(fArgs.node, "opacity")||0;
|
||||
} : fArgs.start;
|
||||
props.end = fArgs.end;
|
||||
|
||||
var anim = d.animateProperty(fArgs);
|
||||
d.connect(anim, "beforeBegin", d.partial(_makeFadeable, fArgs.node));
|
||||
|
||||
return anim; // dojo.Animation
|
||||
};
|
||||
|
||||
/*=====
|
||||
dojo.__FadeArgs = function(node, duration, easing){
|
||||
// node: DOMNode|String
|
||||
// The node referenced in the animation
|
||||
// duration: Integer?
|
||||
// Duration of the animation in milliseconds.
|
||||
// easing: Function?
|
||||
// An easing function.
|
||||
this.node = node;
|
||||
this.duration = duration;
|
||||
this.easing = easing;
|
||||
}
|
||||
=====*/
|
||||
|
||||
dojo.fadeIn = function(/*dojo.__FadeArgs*/ args){
|
||||
// summary:
|
||||
// Returns an animation that will fade node defined in 'args' from
|
||||
// its current opacity to fully opaque.
|
||||
return d._fade(_mixin({ end: 1 }, args)); // dojo.Animation
|
||||
};
|
||||
|
||||
dojo.fadeOut = function(/*dojo.__FadeArgs*/ args){
|
||||
// summary:
|
||||
// Returns an animation that will fade node defined in 'args'
|
||||
// from its current opacity to fully transparent.
|
||||
return d._fade(_mixin({ end: 0 }, args)); // dojo.Animation
|
||||
};
|
||||
|
||||
dojo._defaultEasing = function(/*Decimal?*/ n){
|
||||
// summary: The default easing function for dojo.Animation(s)
|
||||
return 0.5 + ((Math.sin((n + 1.5) * Math.PI)) / 2);
|
||||
};
|
||||
|
||||
var PropLine = function(properties){
|
||||
// PropLine is an internal class which is used to model the values of
|
||||
// an a group of CSS properties across an animation lifecycle. In
|
||||
// particular, the "getValue" function handles getting interpolated
|
||||
// values between start and end for a particular CSS value.
|
||||
this._properties = properties;
|
||||
for(var p in properties){
|
||||
var prop = properties[p];
|
||||
if(prop.start instanceof d.Color){
|
||||
// create a reusable temp color object to keep intermediate results
|
||||
prop.tempColor = new d.Color();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
PropLine.prototype.getValue = function(r){
|
||||
var ret = {};
|
||||
for(var p in this._properties){
|
||||
var prop = this._properties[p],
|
||||
start = prop.start;
|
||||
if(start instanceof d.Color){
|
||||
ret[p] = d.blendColors(start, prop.end, r, prop.tempColor).toCss();
|
||||
}else if(!d.isArray(start)){
|
||||
ret[p] = ((prop.end - start) * r) + start + (p != "opacity" ? prop.units || "px" : 0);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
/*=====
|
||||
dojo.declare("dojo.__AnimArgs", [dojo.__FadeArgs], {
|
||||
// Properties: Object?
|
||||
// A hash map of style properties to Objects describing the transition,
|
||||
// such as the properties of dojo._Line with an additional 'units' property
|
||||
properties: {}
|
||||
|
||||
//TODOC: add event callbacks
|
||||
});
|
||||
=====*/
|
||||
|
||||
dojo.animateProperty = function(/*dojo.__AnimArgs*/ args){
|
||||
// summary:
|
||||
// Returns an animation that will transition the properties of
|
||||
// node defined in `args` depending how they are defined in
|
||||
// `args.properties`
|
||||
//
|
||||
// description:
|
||||
// `dojo.animateProperty` is the foundation of most `dojo.fx`
|
||||
// animations. It takes an object of "properties" corresponding to
|
||||
// style properties, and animates them in parallel over a set
|
||||
// duration.
|
||||
//
|
||||
// example:
|
||||
// A simple animation that changes the width of the specified node.
|
||||
// | dojo.animateProperty({
|
||||
// | node: "nodeId",
|
||||
// | properties: { width: 400 },
|
||||
// | }).play();
|
||||
// Dojo figures out the start value for the width and converts the
|
||||
// integer specified for the width to the more expressive but
|
||||
// verbose form `{ width: { end: '400', units: 'px' } }` which you
|
||||
// can also specify directly. Defaults to 'px' if ommitted.
|
||||
//
|
||||
// example:
|
||||
// Animate width, height, and padding over 2 seconds... the
|
||||
// pedantic way:
|
||||
// | dojo.animateProperty({ node: node, duration:2000,
|
||||
// | properties: {
|
||||
// | width: { start: '200', end: '400', units:"px" },
|
||||
// | height: { start:'200', end: '400', units:"px" },
|
||||
// | paddingTop: { start:'5', end:'50', units:"px" }
|
||||
// | }
|
||||
// | }).play();
|
||||
// Note 'paddingTop' is used over 'padding-top'. Multi-name CSS properties
|
||||
// are written using "mixed case", as the hyphen is illegal as an object key.
|
||||
//
|
||||
// example:
|
||||
// Plug in a different easing function and register a callback for
|
||||
// when the animation ends. Easing functions accept values between
|
||||
// zero and one and return a value on that basis. In this case, an
|
||||
// exponential-in curve.
|
||||
// | dojo.animateProperty({
|
||||
// | node: "nodeId",
|
||||
// | // dojo figures out the start value
|
||||
// | properties: { width: { end: 400 } },
|
||||
// | easing: function(n){
|
||||
// | return (n==0) ? 0 : Math.pow(2, 10 * (n - 1));
|
||||
// | },
|
||||
// | onEnd: function(node){
|
||||
// | // called when the animation finishes. The animation
|
||||
// | // target is passed to this function
|
||||
// | }
|
||||
// | }).play(500); // delay playing half a second
|
||||
//
|
||||
// example:
|
||||
// Like all `dojo.Animation`s, animateProperty returns a handle to the
|
||||
// Animation instance, which fires the events common to Dojo FX. Use `dojo.connect`
|
||||
// to access these events outside of the Animation definiton:
|
||||
// | var anim = dojo.animateProperty({
|
||||
// | node:"someId",
|
||||
// | properties:{
|
||||
// | width:400, height:500
|
||||
// | }
|
||||
// | });
|
||||
// | dojo.connect(anim,"onEnd", function(){
|
||||
// | console.log("animation ended");
|
||||
// | });
|
||||
// | // play the animation now:
|
||||
// | anim.play();
|
||||
//
|
||||
// example:
|
||||
// Each property can be a function whose return value is substituted along.
|
||||
// Additionally, each measurement (eg: start, end) can be a function. The node
|
||||
// reference is passed direcly to callbacks.
|
||||
// | dojo.animateProperty({
|
||||
// | node:"mine",
|
||||
// | properties:{
|
||||
// | height:function(node){
|
||||
// | // shrink this node by 50%
|
||||
// | return dojo.position(node).h / 2
|
||||
// | },
|
||||
// | width:{
|
||||
// | start:function(node){ return 100; },
|
||||
// | end:function(node){ return 200; }
|
||||
// | }
|
||||
// | }
|
||||
// | }).play();
|
||||
//
|
||||
|
||||
var n = args.node = d.byId(args.node);
|
||||
if(!args.easing){ args.easing = d._defaultEasing; }
|
||||
|
||||
var anim = new d.Animation(args);
|
||||
d.connect(anim, "beforeBegin", anim, function(){
|
||||
var pm = {};
|
||||
for(var p in this.properties){
|
||||
// Make shallow copy of properties into pm because we overwrite
|
||||
// some values below. In particular if start/end are functions
|
||||
// we don't want to overwrite them or the functions won't be
|
||||
// called if the animation is reused.
|
||||
if(p == "width" || p == "height"){
|
||||
this.node.display = "block";
|
||||
}
|
||||
var prop = this.properties[p];
|
||||
if(d.isFunction(prop)){
|
||||
prop = prop(n);
|
||||
}
|
||||
prop = pm[p] = _mixin({}, (d.isObject(prop) ? prop: { end: prop }));
|
||||
|
||||
if(d.isFunction(prop.start)){
|
||||
prop.start = prop.start(n);
|
||||
}
|
||||
if(d.isFunction(prop.end)){
|
||||
prop.end = prop.end(n);
|
||||
}
|
||||
var isColor = (p.toLowerCase().indexOf("color") >= 0);
|
||||
function getStyle(node, p){
|
||||
// dojo.style(node, "height") can return "auto" or "" on IE; this is more reliable:
|
||||
var v = { height: node.offsetHeight, width: node.offsetWidth }[p];
|
||||
if(v !== undefined){ return v; }
|
||||
v = d.style(node, p);
|
||||
return (p == "opacity") ? +v : (isColor ? v : parseFloat(v));
|
||||
}
|
||||
if(!("end" in prop)){
|
||||
prop.end = getStyle(n, p);
|
||||
}else if(!("start" in prop)){
|
||||
prop.start = getStyle(n, p);
|
||||
}
|
||||
|
||||
if(isColor){
|
||||
prop.start = new d.Color(prop.start);
|
||||
prop.end = new d.Color(prop.end);
|
||||
}else{
|
||||
prop.start = (p == "opacity") ? +prop.start : parseFloat(prop.start);
|
||||
}
|
||||
}
|
||||
this.curve = new PropLine(pm);
|
||||
});
|
||||
d.connect(anim, "onAnimate", d.hitch(d, "style", anim.node));
|
||||
return anim; // dojo.Animation
|
||||
};
|
||||
|
||||
dojo.anim = function( /*DOMNode|String*/ node,
|
||||
/*Object*/ properties,
|
||||
/*Integer?*/ duration,
|
||||
/*Function?*/ easing,
|
||||
/*Function?*/ onEnd,
|
||||
/*Integer?*/ delay){
|
||||
// summary:
|
||||
// A simpler interface to `dojo.animateProperty()`, also returns
|
||||
// an instance of `dojo.Animation` but begins the animation
|
||||
// immediately, unlike nearly every other Dojo animation API.
|
||||
// description:
|
||||
// `dojo.anim` is a simpler (but somewhat less powerful) version
|
||||
// of `dojo.animateProperty`. It uses defaults for many basic properties
|
||||
// and allows for positional parameters to be used in place of the
|
||||
// packed "property bag" which is used for other Dojo animation
|
||||
// methods.
|
||||
//
|
||||
// The `dojo.Animation` object returned from `dojo.anim` will be
|
||||
// already playing when it is returned from this function, so
|
||||
// calling play() on it again is (usually) a no-op.
|
||||
// node:
|
||||
// a DOM node or the id of a node to animate CSS properties on
|
||||
// duration:
|
||||
// The number of milliseconds over which the animation
|
||||
// should run. Defaults to the global animation default duration
|
||||
// (350ms).
|
||||
// easing:
|
||||
// An easing function over which to calculate acceleration
|
||||
// and deceleration of the animation through its duration.
|
||||
// A default easing algorithm is provided, but you may
|
||||
// plug in any you wish. A large selection of easing algorithms
|
||||
// are available in `dojo.fx.easing`.
|
||||
// onEnd:
|
||||
// A function to be called when the animation finishes
|
||||
// running.
|
||||
// delay:
|
||||
// The number of milliseconds to delay beginning the
|
||||
// animation by. The default is 0.
|
||||
// example:
|
||||
// Fade out a node
|
||||
// | dojo.anim("id", { opacity: 0 });
|
||||
// example:
|
||||
// Fade out a node over a full second
|
||||
// | dojo.anim("id", { opacity: 0 }, 1000);
|
||||
return d.animateProperty({ // dojo.Animation
|
||||
node: node,
|
||||
duration: duration || d.Animation.prototype.duration,
|
||||
properties: properties,
|
||||
easing: easing,
|
||||
onEnd: onEnd
|
||||
}).play(delay || 0);
|
||||
};
|
||||
})();
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,77 +5,150 @@
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dojo._base.json"]){
|
||||
dojo._hasResource["dojo._base.json"]=true;
|
||||
if(!dojo._hasResource["dojo._base.json"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo._base.json"] = true;
|
||||
dojo.provide("dojo._base.json");
|
||||
dojo.fromJson=function(_1){
|
||||
return eval("("+_1+")");
|
||||
};
|
||||
dojo._escapeString=function(_2){
|
||||
return ("\""+_2.replace(/(["\\])/g,"\\$1")+"\"").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r");
|
||||
};
|
||||
dojo.toJsonIndentStr="\t";
|
||||
dojo.toJson=function(it,_3,_4){
|
||||
if(it===undefined){
|
||||
return "undefined";
|
||||
|
||||
dojo.fromJson = function(/*String*/ json){
|
||||
// summary:
|
||||
// Parses a [JSON](http://json.org) string to return a JavaScript object.
|
||||
// description:
|
||||
// Throws for invalid JSON strings, but it does not use a strict JSON parser. It
|
||||
// delegates to eval(). The content passed to this method must therefore come
|
||||
// from a trusted source.
|
||||
// json:
|
||||
// a string literal of a JSON item, for instance:
|
||||
// `'{ "foo": [ "bar", 1, { "baz": "thud" } ] }'`
|
||||
|
||||
return eval("(" + json + ")"); // Object
|
||||
}
|
||||
var _5=typeof it;
|
||||
if(_5=="number"||_5=="boolean"){
|
||||
return it+"";
|
||||
|
||||
dojo._escapeString = function(/*String*/str){
|
||||
//summary:
|
||||
// Adds escape sequences for non-visual characters, double quote and
|
||||
// backslash and surrounds with double quotes to form a valid string
|
||||
// literal.
|
||||
return ('"' + str.replace(/(["\\])/g, '\\$1') + '"').
|
||||
replace(/[\f]/g, "\\f").replace(/[\b]/g, "\\b").replace(/[\n]/g, "\\n").
|
||||
replace(/[\t]/g, "\\t").replace(/[\r]/g, "\\r"); // string
|
||||
}
|
||||
if(it===null){
|
||||
return "null";
|
||||
|
||||
dojo.toJsonIndentStr = "\t";
|
||||
dojo.toJson = function(/*Object*/ it, /*Boolean?*/ prettyPrint, /*String?*/ _indentStr){
|
||||
// summary:
|
||||
// Returns a [JSON](http://json.org) serialization of an object.
|
||||
// description:
|
||||
// Returns a [JSON](http://json.org) serialization of an object.
|
||||
// Note that this doesn't check for infinite recursion, so don't do that!
|
||||
// it:
|
||||
// an object to be serialized. Objects may define their own
|
||||
// serialization via a special "__json__" or "json" function
|
||||
// property. If a specialized serializer has been defined, it will
|
||||
// be used as a fallback.
|
||||
// prettyPrint:
|
||||
// if true, we indent objects and arrays to make the output prettier.
|
||||
// The variable `dojo.toJsonIndentStr` is used as the indent string --
|
||||
// to use something other than the default (tab), change that variable
|
||||
// before calling dojo.toJson().
|
||||
// _indentStr:
|
||||
// private variable for recursive calls when pretty printing, do not use.
|
||||
// example:
|
||||
// simple serialization of a trivial object
|
||||
// | var jsonStr = dojo.toJson({ howdy: "stranger!", isStrange: true });
|
||||
// | doh.is('{"howdy":"stranger!","isStrange":true}', jsonStr);
|
||||
// example:
|
||||
// a custom serializer for an objects of a particular class:
|
||||
// | dojo.declare("Furby", null, {
|
||||
// | furbies: "are strange",
|
||||
// | furbyCount: 10,
|
||||
// | __json__: function(){
|
||||
// | },
|
||||
// | });
|
||||
|
||||
if(it === undefined){
|
||||
return "undefined";
|
||||
}
|
||||
var objtype = typeof it;
|
||||
if(objtype == "number" || objtype == "boolean"){
|
||||
return it + "";
|
||||
}
|
||||
if(it === null){
|
||||
return "null";
|
||||
}
|
||||
if(dojo.isString(it)){
|
||||
return dojo._escapeString(it);
|
||||
}
|
||||
// recurse
|
||||
var recurse = arguments.callee;
|
||||
// short-circuit for objects that support "json" serialization
|
||||
// if they return "self" then just pass-through...
|
||||
var newObj;
|
||||
_indentStr = _indentStr || "";
|
||||
var nextIndent = prettyPrint ? _indentStr + dojo.toJsonIndentStr : "";
|
||||
var tf = it.__json__||it.json;
|
||||
if(dojo.isFunction(tf)){
|
||||
newObj = tf.call(it);
|
||||
if(it !== newObj){
|
||||
return recurse(newObj, prettyPrint, nextIndent);
|
||||
}
|
||||
}
|
||||
if(it.nodeType && it.cloneNode){ // isNode
|
||||
// we can't seriailize DOM nodes as regular objects because they have cycles
|
||||
// DOM nodes could be serialized with something like outerHTML, but
|
||||
// that can be provided by users in the form of .json or .__json__ function.
|
||||
throw new Error("Can't serialize DOM nodes");
|
||||
}
|
||||
|
||||
var sep = prettyPrint ? " " : "";
|
||||
var newLine = prettyPrint ? "\n" : "";
|
||||
|
||||
// array
|
||||
if(dojo.isArray(it)){
|
||||
var res = dojo.map(it, function(obj){
|
||||
var val = recurse(obj, prettyPrint, nextIndent);
|
||||
if(typeof val != "string"){
|
||||
val = "undefined";
|
||||
}
|
||||
return newLine + nextIndent + val;
|
||||
});
|
||||
return "[" + res.join("," + sep) + newLine + _indentStr + "]";
|
||||
}
|
||||
/*
|
||||
// look in the registry
|
||||
try {
|
||||
window.o = it;
|
||||
newObj = dojo.json.jsonRegistry.match(it);
|
||||
return recurse(newObj, prettyPrint, nextIndent);
|
||||
}catch(e){
|
||||
// console.log(e);
|
||||
}
|
||||
// it's a function with no adapter, skip it
|
||||
*/
|
||||
if(objtype == "function"){
|
||||
return null; // null
|
||||
}
|
||||
// generic object code path
|
||||
var output = [], key;
|
||||
for(key in it){
|
||||
var keyStr, val;
|
||||
if(typeof key == "number"){
|
||||
keyStr = '"' + key + '"';
|
||||
}else if(typeof key == "string"){
|
||||
keyStr = dojo._escapeString(key);
|
||||
}else{
|
||||
// skip non-string or number keys
|
||||
continue;
|
||||
}
|
||||
val = recurse(it[key], prettyPrint, nextIndent);
|
||||
if(typeof val != "string"){
|
||||
// skip non-serializable values
|
||||
continue;
|
||||
}
|
||||
// FIXME: use += on Moz!!
|
||||
// MOW NOTE: using += is a pain because you have to account for the dangling comma...
|
||||
output.push(newLine + nextIndent + keyStr + ":" + sep + val);
|
||||
}
|
||||
return "{" + output.join("," + sep) + newLine + _indentStr + "}"; // String
|
||||
}
|
||||
if(dojo.isString(it)){
|
||||
return dojo._escapeString(it);
|
||||
}
|
||||
var _6=arguments.callee;
|
||||
var _7;
|
||||
_4=_4||"";
|
||||
var _8=_3?_4+dojo.toJsonIndentStr:"";
|
||||
var tf=it.__json__||it.json;
|
||||
if(dojo.isFunction(tf)){
|
||||
_7=tf.call(it);
|
||||
if(it!==_7){
|
||||
return _6(_7,_3,_8);
|
||||
}
|
||||
}
|
||||
if(it.nodeType&&it.cloneNode){
|
||||
throw new Error("Can't serialize DOM nodes");
|
||||
}
|
||||
var _9=_3?" ":"";
|
||||
var _a=_3?"\n":"";
|
||||
if(dojo.isArray(it)){
|
||||
var _b=dojo.map(it,function(_c){
|
||||
var _d=_6(_c,_3,_8);
|
||||
if(typeof _d!="string"){
|
||||
_d="undefined";
|
||||
}
|
||||
return _a+_8+_d;
|
||||
});
|
||||
return "["+_b.join(","+_9)+_a+_4+"]";
|
||||
}
|
||||
if(_5=="function"){
|
||||
return null;
|
||||
}
|
||||
var _e=[],_f;
|
||||
for(_f in it){
|
||||
var _10,val;
|
||||
if(typeof _f=="number"){
|
||||
_10="\""+_f+"\"";
|
||||
}else{
|
||||
if(typeof _f=="string"){
|
||||
_10=dojo._escapeString(_f);
|
||||
}else{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
val=_6(it[_f],_3,_8);
|
||||
if(typeof val!="string"){
|
||||
continue;
|
||||
}
|
||||
_e.push(_a+_8+_10+":"+_9+val);
|
||||
}
|
||||
return "{"+_e.join(","+_9)+_a+_4+"}";
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -5,144 +5,388 @@
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dojo._base.lang"]){
|
||||
dojo._hasResource["dojo._base.lang"]=true;
|
||||
if(!dojo._hasResource["dojo._base.lang"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo._base.lang"] = true;
|
||||
dojo.provide("dojo._base.lang");
|
||||
|
||||
(function(){
|
||||
var d=dojo,_1=Object.prototype.toString;
|
||||
dojo.isString=function(it){
|
||||
return (typeof it=="string"||it instanceof String);
|
||||
};
|
||||
dojo.isArray=function(it){
|
||||
return it&&(it instanceof Array||typeof it=="array");
|
||||
};
|
||||
dojo.isFunction=function(it){
|
||||
return _1.call(it)==="[object Function]";
|
||||
};
|
||||
dojo.isObject=function(it){
|
||||
return it!==undefined&&(it===null||typeof it=="object"||d.isArray(it)||d.isFunction(it));
|
||||
};
|
||||
dojo.isArrayLike=function(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(it){
|
||||
return it&&!d.isFunction(it)&&/\{\s*\[native code\]\s*\}/.test(String(it));
|
||||
};
|
||||
dojo.extend=function(_2,_3){
|
||||
for(var i=1,l=arguments.length;i<l;i++){
|
||||
d._mixin(_2.prototype,arguments[i]);
|
||||
}
|
||||
return _2;
|
||||
};
|
||||
dojo._hitchArgs=function(_4,_5){
|
||||
var _6=d._toArray(arguments,2);
|
||||
var _7=d.isString(_5);
|
||||
return function(){
|
||||
var _8=d._toArray(arguments);
|
||||
var f=_7?(_4||d.global)[_5]:_5;
|
||||
return f&&f.apply(_4||this,_6.concat(_8));
|
||||
};
|
||||
};
|
||||
dojo.hitch=function(_9,_a){
|
||||
if(arguments.length>2){
|
||||
return d._hitchArgs.apply(d,arguments);
|
||||
}
|
||||
if(!_a){
|
||||
_a=_9;
|
||||
_9=null;
|
||||
}
|
||||
if(d.isString(_a)){
|
||||
_9=_9||d.global;
|
||||
if(!_9[_a]){
|
||||
throw (["dojo.hitch: scope[\"",_a,"\"] is null (scope=\"",_9,"\")"].join(""));
|
||||
}
|
||||
return function(){
|
||||
return _9[_a].apply(_9,arguments||[]);
|
||||
};
|
||||
}
|
||||
return !_9?_a:function(){
|
||||
return _a.apply(_9,arguments||[]);
|
||||
};
|
||||
};
|
||||
dojo.delegate=dojo._delegate=(function(){
|
||||
function _b(){
|
||||
};
|
||||
return function(_c,_d){
|
||||
_b.prototype=_c;
|
||||
var _e=new _b();
|
||||
_b.prototype=null;
|
||||
if(_d){
|
||||
d._mixin(_e,_d);
|
||||
}
|
||||
return _e;
|
||||
};
|
||||
})();
|
||||
var _f=function(obj,_10,_11){
|
||||
return (_11||[]).concat(Array.prototype.slice.call(obj,_10||0));
|
||||
};
|
||||
var _12=function(obj,_13,_14){
|
||||
var arr=_14||[];
|
||||
for(var x=_13||0;x<obj.length;x++){
|
||||
arr.push(obj[x]);
|
||||
}
|
||||
return arr;
|
||||
};
|
||||
dojo._toArray=d.isIE?function(obj){
|
||||
return ((obj.item)?_12:_f).apply(this,arguments);
|
||||
}:_f;
|
||||
dojo.partial=function(_15){
|
||||
var arr=[null];
|
||||
return d.hitch.apply(d,arr.concat(d._toArray(arguments)));
|
||||
};
|
||||
var _16=d._extraNames,_17=_16.length,_18={};
|
||||
dojo.clone=function(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());
|
||||
}
|
||||
var r,i,l,s,_19;
|
||||
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(_19 in o){
|
||||
s=o[_19];
|
||||
if(!(_19 in r)||(r[_19]!==s&&(!(_19 in _18)||_18[_19]!==s))){
|
||||
r[_19]=d.clone(s);
|
||||
}
|
||||
}
|
||||
if(_17){
|
||||
for(i=0;i<_17;++i){
|
||||
_19=_16[i];
|
||||
s=o[_19];
|
||||
if(!(_19 in r)||(r[_19]!==s&&(!(_19 in _18)||_18[_19]!==s))){
|
||||
r[_19]=s;
|
||||
}
|
||||
}
|
||||
}
|
||||
return r;
|
||||
};
|
||||
dojo.trim=String.prototype.trim?function(str){
|
||||
return str.trim();
|
||||
}:function(str){
|
||||
return str.replace(/^\s\s*/,"").replace(/\s\s*$/,"");
|
||||
};
|
||||
var _1a=/\{([^\}]+)\}/g;
|
||||
dojo.replace=function(_1b,map,_1c){
|
||||
return _1b.replace(_1c||_1a,d.isFunction(map)?map:function(_1d,k){
|
||||
return d.getObject(k,false,map);
|
||||
});
|
||||
};
|
||||
var d = dojo, opts = Object.prototype.toString;
|
||||
|
||||
// Crockford (ish) functions
|
||||
|
||||
dojo.isString = function(/*anything*/ it){
|
||||
// summary:
|
||||
// Return true if it is a String
|
||||
return (typeof it == "string" || it instanceof String); // Boolean
|
||||
}
|
||||
|
||||
dojo.isArray = function(/*anything*/ it){
|
||||
// summary:
|
||||
// Return true if it is an Array.
|
||||
// Does not work on Arrays created in other windows.
|
||||
return it && (it instanceof Array || typeof it == "array"); // Boolean
|
||||
}
|
||||
|
||||
dojo.isFunction = function(/*anything*/ it){
|
||||
// summary:
|
||||
// Return true if it is a Function
|
||||
return opts.call(it) === "[object Function]";
|
||||
};
|
||||
|
||||
dojo.isObject = function(/*anything*/ it){
|
||||
// summary:
|
||||
// Returns true if it is a JavaScript object (or an Array, a Function
|
||||
// or null)
|
||||
return it !== undefined &&
|
||||
(it === null || typeof it == "object" || d.isArray(it) || d.isFunction(it)); // Boolean
|
||||
}
|
||||
|
||||
dojo.isArrayLike = function(/*anything*/ it){
|
||||
// summary:
|
||||
// similar to dojo.isArray() but more permissive
|
||||
// description:
|
||||
// Doesn't strongly test for "arrayness". Instead, settles for "isn't
|
||||
// a string or number and has a length property". Arguments objects
|
||||
// and DOM collections will return true when passed to
|
||||
// dojo.isArrayLike(), but will return false when passed to
|
||||
// dojo.isArray().
|
||||
// returns:
|
||||
// If it walks like a duck and quacks like a duck, return `true`
|
||||
return it && it !== undefined && // Boolean
|
||||
// keep out built-in constructors (Number, String, ...) which have length
|
||||
// properties
|
||||
!d.isString(it) && !d.isFunction(it) &&
|
||||
!(it.tagName && it.tagName.toLowerCase() == 'form') &&
|
||||
(d.isArray(it) || isFinite(it.length));
|
||||
}
|
||||
|
||||
dojo.isAlien = function(/*anything*/ it){
|
||||
// summary:
|
||||
// Returns true if it is a built-in function or some other kind of
|
||||
// oddball that *should* report as a function but doesn't
|
||||
return it && !d.isFunction(it) && /\{\s*\[native code\]\s*\}/.test(String(it)); // Boolean
|
||||
}
|
||||
|
||||
dojo.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++){
|
||||
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(){
|
||||
// arrayify arguments
|
||||
var args = d._toArray(arguments);
|
||||
// locate our method
|
||||
var f = named ? (scope||d.global)[method] : method;
|
||||
// invoke with collected args
|
||||
return f && f.apply(scope || this, pre.concat(args)); // mixed
|
||||
} // Function
|
||||
}
|
||||
|
||||
dojo.hitch = function(/*Object*/scope, /*Function|String*/method /*,...*/){
|
||||
// summary:
|
||||
// Returns a function that will only ever execute in the a given scope.
|
||||
// This allows for easy use of object member functions
|
||||
// in callbacks and other places in which the "this" keyword may
|
||||
// otherwise not reference the expected scope.
|
||||
// Any number of default positional arguments may be passed as parameters
|
||||
// beyond "method".
|
||||
// Each of these values will be used to "placehold" (similar to curry)
|
||||
// for the hitched function.
|
||||
// scope:
|
||||
// The scope to use when method executes. If method is a string,
|
||||
// scope is also the object containing method.
|
||||
// method:
|
||||
// A function to be hitched to scope, or the name of the method in
|
||||
// scope to be hitched.
|
||||
// example:
|
||||
// | dojo.hitch(foo, "bar")();
|
||||
// runs foo.bar() in the scope of foo
|
||||
// example:
|
||||
// | dojo.hitch(foo, myFunction);
|
||||
// returns a function that runs myFunction in the scope of foo
|
||||
// example:
|
||||
// Expansion on the default positional arguments passed along from
|
||||
// hitch. Passed args are mixed first, additional args after.
|
||||
// | var foo = { bar: function(a, b, c){ console.log(a, b, c); } };
|
||||
// | var fn = dojo.hitch(foo, "bar", 1, 2);
|
||||
// | fn(3); // logs "1, 2, 3"
|
||||
// example:
|
||||
// | var foo = { bar: 2 };
|
||||
// | dojo.hitch(foo, function(){ this.bar = 10; })();
|
||||
// execute an anonymous function in scope of foo
|
||||
|
||||
if(arguments.length > 2){
|
||||
return d._hitchArgs.apply(d, arguments); // Function
|
||||
}
|
||||
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 || []); }; // Function
|
||||
}
|
||||
return !scope ? method : function(){ return method.apply(scope, arguments || []); }; // Function
|
||||
}
|
||||
|
||||
/*=====
|
||||
dojo.delegate = function(obj, props){
|
||||
// summary:
|
||||
// Returns a new object which "looks" to obj for properties which it
|
||||
// does not have a value for. Optionally takes a bag of properties to
|
||||
// seed the returned object with initially.
|
||||
// description:
|
||||
// This is a small implementaton of the Boodman/Crockford delegation
|
||||
// pattern in JavaScript. An intermediate object constructor mediates
|
||||
// the prototype chain for the returned object, using it to delegate
|
||||
// down to obj for property lookup when object-local lookup fails.
|
||||
// This can be thought of similarly to ES4's "wrap", save that it does
|
||||
// not act on types but rather on pure objects.
|
||||
// obj:
|
||||
// The object to delegate to for properties not found directly on the
|
||||
// return object or in props.
|
||||
// props:
|
||||
// an object containing properties to assign to the returned object
|
||||
// returns:
|
||||
// an Object of anonymous type
|
||||
// example:
|
||||
// | var foo = { bar: "baz" };
|
||||
// | var thinger = dojo.delegate(foo, { thud: "xyzzy"});
|
||||
// | thinger.bar == "baz"; // delegated to foo
|
||||
// | foo.thud == undefined; // by definition
|
||||
// | thinger.thud == "xyzzy"; // mixed in from props
|
||||
// | foo.bar = "thonk";
|
||||
// | thinger.bar == "thonk"; // still delegated to foo's bar
|
||||
}
|
||||
=====*/
|
||||
|
||||
dojo.delegate = dojo._delegate = (function(){
|
||||
// boodman/crockford delegation w/ cornford optimization
|
||||
function TMP(){}
|
||||
return function(obj, props){
|
||||
TMP.prototype = obj;
|
||||
var tmp = new TMP();
|
||||
TMP.prototype = null;
|
||||
if(props){
|
||||
d._mixin(tmp, props);
|
||||
}
|
||||
return tmp; // Object
|
||||
}
|
||||
})();
|
||||
|
||||
/*=====
|
||||
dojo._toArray = function(obj, offset, startWith){
|
||||
// summary:
|
||||
// Converts an array-like object (i.e. arguments, DOMCollection) to an
|
||||
// array. Returns a new Array with the elements of obj.
|
||||
// obj: Object
|
||||
// the object to "arrayify". We expect the object to have, at a
|
||||
// minimum, a length property which corresponds to integer-indexed
|
||||
// properties.
|
||||
// offset: Number?
|
||||
// the location in obj to start iterating from. Defaults to 0.
|
||||
// Optional.
|
||||
// startWith: Array?
|
||||
// An array to pack with the properties of obj. If provided,
|
||||
// properties in obj are appended at the end of startWith and
|
||||
// startWith is the returned array.
|
||||
}
|
||||
=====*/
|
||||
|
||||
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 /*, ...*/){
|
||||
// summary:
|
||||
// similar to hitch() except that the scope object is left to be
|
||||
// whatever the execution context eventually becomes.
|
||||
// description:
|
||||
// Calling dojo.partial is the functional equivalent of calling:
|
||||
// | dojo.hitch(null, funcName, ...);
|
||||
var arr = [ null ];
|
||||
return d.hitch.apply(d, arr.concat(d._toArray(arguments))); // Function
|
||||
}
|
||||
|
||||
var extraNames = d._extraNames, extraLen = extraNames.length, empty = {};
|
||||
|
||||
dojo.clone = function(/*anything*/ o){
|
||||
// summary:
|
||||
// Clones objects (including DOM nodes) and all children.
|
||||
// Warning: do not clone cyclic structures.
|
||||
if(!o || typeof o != "object" || d.isFunction(o)){
|
||||
// null, undefined, any non-object, or function
|
||||
return o; // anything
|
||||
}
|
||||
if(o.nodeType && "cloneNode" in o){
|
||||
// DOM Node
|
||||
return o.cloneNode(true); // Node
|
||||
}
|
||||
if(o instanceof Date){
|
||||
// Date
|
||||
return new Date(o.getTime()); // Date
|
||||
}
|
||||
var r, i, l, s, name;
|
||||
if(d.isArray(o)){
|
||||
// array
|
||||
r = [];
|
||||
for(i = 0, l = o.length; i < l; ++i){
|
||||
if(i in o){
|
||||
r.push(d.clone(o[i]));
|
||||
}
|
||||
}
|
||||
// we don't clone functions for performance reasons
|
||||
// }else if(d.isFunction(o)){
|
||||
// // function
|
||||
// r = function(){ return o.apply(this, arguments); };
|
||||
}else{
|
||||
// generic objects
|
||||
r = o.constructor ? new o.constructor() : {};
|
||||
}
|
||||
for(name in o){
|
||||
// the "tobj" condition avoid copying properties in "source"
|
||||
// inherited from Object.prototype. For example, if target has a custom
|
||||
// toString() method, don't overwrite it with the toString() method
|
||||
// that source inherited from Object.prototype
|
||||
s = o[name];
|
||||
if(!(name in r) || (r[name] !== s && (!(name in empty) || empty[name] !== s))){
|
||||
r[name] = d.clone(s);
|
||||
}
|
||||
}
|
||||
// IE doesn't recognize some custom functions in for..in
|
||||
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; // functions only, we don't clone them
|
||||
}
|
||||
}
|
||||
}
|
||||
return r; // Object
|
||||
}
|
||||
|
||||
/*=====
|
||||
dojo.trim = function(str){
|
||||
// summary:
|
||||
// Trims whitespace from both sides of the string
|
||||
// str: String
|
||||
// String to be trimmed
|
||||
// returns: String
|
||||
// Returns the trimmed string
|
||||
// description:
|
||||
// This version of trim() was selected for inclusion into the base due
|
||||
// to its compact size and relatively good performance
|
||||
// (see [Steven Levithan's blog](http://blog.stevenlevithan.com/archives/faster-trim-javascript)
|
||||
// Uses String.prototype.trim instead, if available.
|
||||
// The fastest but longest version of this function is located at
|
||||
// dojo.string.trim()
|
||||
return ""; // String
|
||||
}
|
||||
=====*/
|
||||
|
||||
dojo.trim = String.prototype.trim ?
|
||||
function(str){ return str.trim(); } :
|
||||
function(str){ return str.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); };
|
||||
|
||||
/*=====
|
||||
dojo.replace = function(tmpl, map, pattern){
|
||||
// summary:
|
||||
// Performs parameterized substitutions on a string. Throws an
|
||||
// exception if any parameter is unmatched.
|
||||
// tmpl: String
|
||||
// String to be used as a template.
|
||||
// map: Object|Function
|
||||
// If an object, it is used as a dictionary to look up substitutions.
|
||||
// If a function, it is called for every substitution with following
|
||||
// parameters: a whole match, a name, an offset, and the whole template
|
||||
// string (see https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String/replace
|
||||
// for more details).
|
||||
// pattern: RegEx?
|
||||
// Optional regular expression objects that overrides the default pattern.
|
||||
// Must be global and match one item. The default is: /\{([^\}]+)\}/g,
|
||||
// which matches patterns like that: "{xxx}", where "xxx" is any sequence
|
||||
// of characters, which doesn't include "}".
|
||||
// returns: String
|
||||
// Returns the substituted string.
|
||||
// example:
|
||||
// | // uses a dictionary for substitutions:
|
||||
// | dojo.replace("Hello, {name.first} {name.last} AKA {nick}!",
|
||||
// | {
|
||||
// | nick: "Bob",
|
||||
// | name: {
|
||||
// | first: "Robert",
|
||||
// | middle: "X",
|
||||
// | last: "Cringely"
|
||||
// | }
|
||||
// | });
|
||||
// | // returns: Hello, Robert Cringely AKA Bob!
|
||||
// example:
|
||||
// | // uses an array for substitutions:
|
||||
// | dojo.replace("Hello, {0} {2}!",
|
||||
// | ["Robert", "X", "Cringely"]);
|
||||
// | // returns: Hello, Robert Cringely!
|
||||
// example:
|
||||
// | // uses a function for substitutions:
|
||||
// | function sum(a){
|
||||
// | var t = 0;
|
||||
// | dojo.forEach(a, function(x){ t += x; });
|
||||
// | return t;
|
||||
// | }
|
||||
// | dojo.replace(
|
||||
// | "{count} payments averaging {avg} USD per payment.",
|
||||
// | dojo.hitch(
|
||||
// | { payments: [11, 16, 12] },
|
||||
// | function(_, key){
|
||||
// | switch(key){
|
||||
// | case "count": return this.payments.length;
|
||||
// | case "min": return Math.min.apply(Math, this.payments);
|
||||
// | case "max": return Math.max.apply(Math, this.payments);
|
||||
// | case "sum": return sum(this.payments);
|
||||
// | case "avg": return sum(this.payments) / this.payments.length;
|
||||
// | }
|
||||
// | }
|
||||
// | )
|
||||
// | );
|
||||
// | // prints: 3 payments averaging 13 USD per payment.
|
||||
// example:
|
||||
// | // uses an alternative PHP-like pattern for substitutions:
|
||||
// | dojo.replace("Hello, ${0} ${2}!",
|
||||
// | ["Robert", "X", "Cringely"], /\$\{([^\}]+)\}/g);
|
||||
// | // returns: Hello, Robert Cringely!
|
||||
return ""; // String
|
||||
}
|
||||
=====*/
|
||||
|
||||
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); });
|
||||
};
|
||||
})();
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -5,45 +5,104 @@
|
||||
*/
|
||||
|
||||
|
||||
if(!dojo._hasResource["dojo._base.window"]){
|
||||
dojo._hasResource["dojo._base.window"]=true;
|
||||
if(!dojo._hasResource["dojo._base.window"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code.
|
||||
dojo._hasResource["dojo._base.window"] = true;
|
||||
dojo.provide("dojo._base.window");
|
||||
dojo.doc=window["document"]||null;
|
||||
dojo.body=function(){
|
||||
return dojo.doc.body||dojo.doc.getElementsByTagName("body")[0];
|
||||
|
||||
/*=====
|
||||
dojo.doc = {
|
||||
// summary:
|
||||
// Alias for the current document. 'dojo.doc' can be modified
|
||||
// for temporary context shifting. Also see dojo.withDoc().
|
||||
// description:
|
||||
// Refer to dojo.doc rather
|
||||
// than referring to 'window.document' to ensure your code runs
|
||||
// correctly in managed contexts.
|
||||
// example:
|
||||
// | n.appendChild(dojo.doc.createElement('div'));
|
||||
}
|
||||
=====*/
|
||||
dojo.doc = window["document"] || null;
|
||||
|
||||
dojo.body = function(){
|
||||
// summary:
|
||||
// Return the body element of the document
|
||||
// return the body object associated with dojo.doc
|
||||
// example:
|
||||
// | dojo.body().appendChild(dojo.doc.createElement('div'));
|
||||
|
||||
// Note: document.body is not defined for a strict xhtml document
|
||||
// Would like to memoize this, but dojo.doc can change vi dojo.withDoc().
|
||||
return dojo.doc.body || dojo.doc.getElementsByTagName("body")[0]; // Node
|
||||
}
|
||||
|
||||
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 (e.g., an iframe). The varibles dojo.global and dojo.doc
|
||||
// are modified as a result of calling this function and the result of
|
||||
// `dojo.body()` likewise differs.
|
||||
dojo.global = globalObject;
|
||||
dojo.doc = globalDocument;
|
||||
};
|
||||
dojo.setContext=function(_1,_2){
|
||||
dojo.global=_1;
|
||||
dojo.doc=_2;
|
||||
};
|
||||
dojo.withGlobal=function(_3,_4,_5,_6){
|
||||
var _7=dojo.global;
|
||||
try{
|
||||
dojo.global=_3;
|
||||
return dojo.withDoc.call(null,_3.document,_4,_5,_6);
|
||||
}
|
||||
finally{
|
||||
dojo.global=_7;
|
||||
}
|
||||
};
|
||||
dojo.withDoc=function(_8,_9,_a,_b){
|
||||
var _c=dojo.doc,_d=dojo._bodyLtr,_e=dojo.isQuirks;
|
||||
try{
|
||||
dojo.doc=_8;
|
||||
delete dojo._bodyLtr;
|
||||
dojo.isQuirks=dojo.doc.compatMode=="BackCompat";
|
||||
if(_a&&typeof _9=="string"){
|
||||
_9=_a[_9];
|
||||
}
|
||||
return _9.apply(_a,_b||[]);
|
||||
}
|
||||
finally{
|
||||
dojo.doc=_c;
|
||||
delete dojo._bodyLtr;
|
||||
if(_d!==undefined){
|
||||
dojo._bodyLtr=_d;
|
||||
}
|
||||
dojo.isQuirks=_e;
|
||||
}
|
||||
|
||||
dojo.withGlobal = function( /*Object*/globalObject,
|
||||
/*Function*/callback,
|
||||
/*Object?*/thisObject,
|
||||
/*Array?*/cbArguments){
|
||||
// summary:
|
||||
// Invoke callback with globalObject as dojo.global and
|
||||
// globalObject.document as dojo.doc.
|
||||
// description:
|
||||
// Invoke callback with globalObject as dojo.global and
|
||||
// globalObject.document as dojo.doc. If provided, globalObject
|
||||
// will be executed in the context of object thisObject
|
||||
// When callback() returns or throws an error, the dojo.global
|
||||
// and dojo.doc will be restored to its previous state.
|
||||
|
||||
var oldGlob = dojo.global;
|
||||
try{
|
||||
dojo.global = globalObject;
|
||||
return dojo.withDoc.call(null, globalObject.document, callback, thisObject, cbArguments);
|
||||
}finally{
|
||||
dojo.global = oldGlob;
|
||||
}
|
||||
}
|
||||
|
||||
dojo.withDoc = function( /*DocumentElement*/documentObject,
|
||||
/*Function*/callback,
|
||||
/*Object?*/thisObject,
|
||||
/*Array?*/cbArguments){
|
||||
// summary:
|
||||
// Invoke callback with documentObject as dojo.doc.
|
||||
// description:
|
||||
// Invoke callback with documentObject as dojo.doc. If provided,
|
||||
// callback will be executed in the context of object thisObject
|
||||
// When callback() returns or throws an error, the dojo.doc will
|
||||
// be restored to its previous state.
|
||||
|
||||
var oldDoc = dojo.doc,
|
||||
oldLtr = dojo._bodyLtr,
|
||||
oldQ = dojo.isQuirks;
|
||||
|
||||
try{
|
||||
dojo.doc = documentObject;
|
||||
delete dojo._bodyLtr; // uncache
|
||||
dojo.isQuirks = dojo.doc.compatMode == "BackCompat"; // no need to check for QuirksMode which was Opera 7 only
|
||||
|
||||
if(thisObject && typeof callback == "string"){
|
||||
callback = thisObject[callback];
|
||||
}
|
||||
|
||||
return callback.apply(thisObject, cbArguments || []);
|
||||
}finally{
|
||||
dojo.doc = oldDoc;
|
||||
delete dojo._bodyLtr; // in case it was undefined originally, and set to true/false by the alternate document
|
||||
if(oldLtr !== undefined){ dojo._bodyLtr = oldLtr; }
|
||||
dojo.isQuirks = oldQ;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user