window.undefined = window.undefined;
Ext = {
version :
'3.4.1.1'
,
versionDetail : {
major : 3,
minor : 4,
patch : 1.1
}
};
Ext.apply =
function
(o, c, defaults){
if
(defaults){
Ext.apply(o, defaults);
}
if
(o && c &&
typeof
c ==
'object'
){
for
(
var
p
in
c){
o[p] = c[p];
}
}
return
o;
};
(
function
(){
var
idSeed = 0,
toString = Object.prototype.toString,
ua = navigator.userAgent.toLowerCase(),
check =
function
(r){
return
r.test(ua);
},
DOC = document,
docMode = DOC.documentMode,
isStrict = DOC.compatMode ==
"CSS1Compat"
,
isOpera = check(/opera/),
isChrome = check(/\bchrome\b/),
isWebKit = check(/webkit/),
isSafari = !isChrome && check(/safari/),
isSafari2 = isSafari && check(/applewebkit\/4/),
isSafari3 = isSafari && check(/version\/3/),
isSafari4 = isSafari && check(/version\/4/),
isIE = !isOpera && check(/msie/),
isIE7 = isIE && ((check(/msie 7/) && docMode != 8 && docMode != 9 && docMode != 10) || docMode == 7),
isIE8 = isIE && ((check(/msie 8/) && docMode != 7 && docMode != 9 && docMode != 10) || docMode == 8),
isIE9 = isIE && ((check(/msie 9/) && docMode != 7 && docMode != 8 && docMode != 10) || docMode == 9),
isIE10 = isIE && ((check(/msie 10/) && docMode != 7 && docMode != 8 && docMode != 9) || docMode == 10),
isIE6 = isIE && check(/msie 6/),
isIE9m = isIE && (isIE6 || isIE7 || isIE8 || isIE9),
isGecko = !isWebKit && check(/gecko/),
isGecko2 = isGecko && check(/rv:1\.8/),
isGecko3 = isGecko && check(/rv:1\.9/),
isBorderBox = isIE9m && !isStrict,
isWindows = check(/windows|win32/),
isMac = check(/macintosh|mac os x/),
isAir = check(/adobeair/),
isLinux = check(/linux/),
isSecure = /^https/i.test(window.location.protocol),
noArgs = [],
nonEnumerables = [],
emptyFn = Ext.emptyFn,
t = Ext.apply({}, {
constructor: emptyFn,
toString: emptyFn,
valueOf: emptyFn
}),
callOverrideParent =
function
() {
var
method = callOverrideParent.caller.caller;
return
method.$owner.prototype[method.$name].apply(
this
, arguments);
};
if
(t.constructor !== emptyFn) {
nonEnumerables.push(
'constructor'
);
}
if
(t.toString !== emptyFn) {
nonEnumerables.push(
'toString'
);
}
if
(t.valueOf !== emptyFn) {
nonEnumerables.push(
'valueOf'
);
}
if
(!nonEnumerables.length) {
nonEnumerables =
null
;
}
function
Base () {
}
Ext.apply(Base, {
$isClass:
true
,
callParent:
function
(args) {
var
method;
return
(method =
this
.callParent.caller) && (method.$previous ||
((method = method.$owner ? method : method.caller) &&
method.$owner.superclass.self[method.$name])).apply(
this
, args || noArgs);
}
});
Base.prototype = {
constructor:
function
() {
},
callParent:
function
(args) {
var
method,
superMethod = (method =
this
.callParent.caller) && (method.$previous ||
((method = method.$owner ? method : method.caller) &&
method.$owner.superclass[method.$name]));
return
superMethod.apply(
this
, args || noArgs);
}
};
if
(isIE6){
try
{
DOC.execCommand(
"BackgroundImageCache"
,
false
,
true
);
}
catch
(e){}
}
Ext.apply(Ext, {
SSL_SECURE_URL : isSecure && isIE ?
'javascript:""'
:
'about:blank'
,
isStrict : isStrict,
isSecure : isSecure,
isReady :
false
,
enableForcedBoxModel :
false
,
enableGarbageCollector :
true
,
enableListenerCollection :
false
,
enableNestedListenerRemoval :
false
,
USE_NATIVE_JSON :
false
,
applyIf :
function
(o, c){
if
(o){
for
(
var
p
in
c){
if
(!Ext.isDefined(o[p])){
o[p] = c[p];
}
}
}
return
o;
},
id :
function
(el, prefix){
el = Ext.getDom(el,
true
) || {};
if
(!el.id) {
el.id = (prefix ||
"ext-gen"
) + (++idSeed);
}
return
el.id;
},
extend :
function
(){
var
io =
function
(o){
for
(
var
m
in
o){
this
[m] = o[m];
}
};
var
oc = Object.prototype.constructor;
return
function
(sb, sp, overrides){
if
(
typeof
sp == 'object
'){
overrides = sp;
sp = sb;
sb = overrides.constructor != oc ? overrides.constructor : function(){sp.apply(this, arguments);};
}
var F = function(){},
sbp,
spp = sp.prototype;
F.prototype = spp;
sbp = sb.prototype = new F();
sbp.constructor=sb;
sb.superclass=spp;
if(spp.constructor == oc){
spp.constructor=sp;
}
sb.override = function(o){
Ext.override(sb, o);
};
sbp.superclass = sbp.supr = (function(){
return spp;
});
sbp.override = io;
Ext.override(sb, overrides);
sb.extend = function(o){return Ext.extend(sb, o);};
return sb;
};
}(),
global: (function () {
return this;
})(),
Base: Base,
namespaceCache: {},
createNamespace: function (namespaceOrClass, isClass) {
var cache = Ext.namespaceCache,
namespace = isClass ? namespaceOrClass.substring(0, namespaceOrClass.lastIndexOf('
.
'))
: namespaceOrClass,
ns = cache[namespace],
i, n, part, parts, partials;
if (!ns) {
ns = Ext.global;
if (namespace) {
partials = [];
parts = namespace.split('
.
');
for (i = 0, n = parts.length; i < n; ++i) {
part = parts[i];
ns = ns[part] || (ns[part] = {});
partials.push(part);
cache[partials.join('
.
')] = ns; // build up prefixes as we go
}
}
}
return ns;
},
getClassByName: function (className) {
var parts = className.split('
.
'),
cls = Ext.global,
n = parts.length,
i;
for (i = 0; cls && i < n; ++i) {
cls = cls[parts[i]];
}
return cls || null;
},
addMembers: function (cls, target, members, handleNonEnumerables) {
var i, name, member;
for (name in members) {
if (members.hasOwnProperty(name)) {
member = members[name];
if (typeof member == '
function
') {
member.$owner = cls;
member.$name = name;
}
target[name] = member;
}
}
if (handleNonEnumerables && nonEnumerables) {
for (i = nonEnumerables.length; i-- > 0; ) {
name = nonEnumerables[i];
if (members.hasOwnProperty(name)) {
member = members[name];
if (typeof member == '
function
') {
member.$owner = cls;
member.$name = name;
}
target[name] = member;
}
}
}
},
/**
* @method
* Defines a class or override. A basic class is defined like this:
*
* Ext.define('
My.awesome.Class
', {
* someProperty: '
something
',
*
* someMethod: function(s) {
* alert(s + this.someProperty);
* }
*
* ...
* });
*
* var obj = new My.awesome.Class();
*
* obj.someMethod('
Say
'); // alerts '
Say something
'
*
* To create an anonymous class, pass `null` for the `className`:
*
* Ext.define(null, {
* constructor: function () {
* // ...
* }
* });
*
* In some cases, it is helpful to create a nested scope to contain some private
* properties. The best way to do this is to pass a function instead of an object
* as the second parameter. This function will be called to produce the class
* body:
*
* Ext.define('
MyApp.foo.Bar
', function () {
* var id = 0;
*
* return {
* nextId: function () {
* return ++id;
* }
* };
* });
*
* When using this form of `Ext.define`, the function is passed a reference to its
* class. This can be used as an efficient way to access any static properties you
* may have:
*
* Ext.define('
MyApp.foo.Bar
', function (Bar) {
* return {
* statics: {
* staticMethod: function () {
* // ...
* }
* },
*
* method: function () {
* return Bar.staticMethod();
* }
* };
* });
*
* To define an override, include the `override` property. The content of an
* override is aggregated with the specified class in order to extend or modify
* that class. This can be as simple as setting default property values or it can
* extend and/or replace methods. This can also extend the statics of the class.
*
* One use for an override is to break a large class into manageable pieces.
*
* // File: /src/app/Panel.js
*
* Ext.define('
My.app.Panel
', {
* extend: '
Ext.panel.Panel
',
*
* constructor: function (config) {
* this.callParent(arguments); // calls Ext.panel.Panel'
s constructor
*
* },
*
* statics: {
* method:
function
() {
*
return
'abc'
;
* }
* }
* });
*
*
* Ext.define(
'My.app.PanelPart2'
, {
* override:
'My.app.Panel'
,
*
* constructor:
function
(config) {
*
this
.callParent(arguments);
*
* }
* });
*
* Another use of overrides is to provide optional parts of classes that can be
* independently required. In
this
case
, the
class
may even be unaware of the
* override altogether.
*
* Ext.define('My.ux.CoolTip
', {
* override: '
Ext.tip.ToolTip
',
*
* constructor: function (config) {
* this.callParent(arguments); // calls Ext.tip.ToolTip'
s constructor
*
* }
* });
*
* Overrides can also contain statics:
*
* Ext.define(
'My.app.BarMod'
, {
* override:
'Ext.foo.Bar'
,
*
* statics: {
* method:
function
(x) {
*
return
this
.callParent([x * 2]);
* }
* }
* });
*
* @param {String} className The
class
name to create
in
string dot-namespaced format,
for
example:
*
'My.very.awesome.Class'
,
'FeedViewer.plugin.CoolPager'
* It is highly recommended to follow
this
simple convention:
* - The root and the
class
name are
'CamelCased'
* - Everything
else
is lower-cased
* Pass `
null
` to create an anonymous
class
.
* @param {Object} data The key - value pairs of properties to apply to
this
class
. Property names can be of any valid
* strings, except those
in
the reserved listed below:
* - `mixins`
* - `statics`
* - `config`
* - `alias`
* - `self`
* - `singleton`
* - `alternateClassName`
* - `override`
*
* @param {Function} createdFn Optional callback to execute after the
class
is created, the execution scope of which
* (`
this
`) will be the newly created
class
itself.
* @
return
{Ext.Base}
* @markdown
* @member Ext
* @method define
*/
define:
function
(className, body, createdFn) {
var
override = body.override,
cls, extend, name, namespace;
if
(override) {
delete
body.override;
cls = Ext.getClassByName(override);
Ext.override(cls, body);
}
else
{
if
(className) {
namespace = Ext.createNamespace(className,
true
);
name = className.substring(className.lastIndexOf(
'.'
)+1);
}
cls =
function
ctor () {
this
.constructor.apply(
this
, arguments);
}
if
(className) {
cls.displayName = className;
}
cls.$isClass =
true
;
cls.callParent = Ext.Base.callParent;
if
(
typeof
body ==
'function'
) {
body = body(cls);
}
extend = body.extend;
if
(extend) {
delete
body.extend;
if
(
typeof
extend ==
'string'
) {
extend = Ext.getClassByName(extend);
}
}
else
{
extend = Base;
}
Ext.extend(cls, extend, body);
if
(cls.prototype.constructor === cls) {
delete
cls.prototype.constructor;
}
if
(!cls.prototype.$isClass) {
Ext.applyIf(cls.prototype, Base.prototype);
}
cls.prototype.self = cls;
if
(body.xtype) {
Ext.reg(body.xtype, cls);
}
cls = body.singleton ?
new
cls() : cls;
if
(className) {
namespace[name] = cls;
}
}
if
(createdFn) {
createdFn.call(cls);
}
return
cls;
},
override:
function
(target, overrides) {
var
proto, statics;
if
(overrides) {
if
(target.$isClass) {
statics = overrides.statics;
if
(statics) {
delete
overrides.statics;
}
Ext.addMembers(target, target.prototype, overrides,
true
);
if
(statics) {
Ext.addMembers(target, target, statics);
}
}
else
if
(
typeof
target ==
'function'
) {
proto = target.prototype;
Ext.apply(proto, overrides);
if
(Ext.isIE && overrides.hasOwnProperty(
'toString'
)){
proto.toString = overrides.toString;
}
}
else
{
var
owner = target.self,
name, value;
if
(owner && owner.$isClass) {
for
(name
in
overrides) {
if
(overrides.hasOwnProperty(name)) {
value = overrides[name];
if
(
typeof
value ==
'function'
) {
if
(owner.$className) {
value.displayName = owner.$className +
'#'
+ name;
}
value.$name = name;
value.$owner = owner;
value.$previous = target.hasOwnProperty(name)
? target[name]
: callOverrideParent;
}
target[name] = value;
}
}
}
else
{
Ext.apply(target, overrides);
if
(!target.constructor.$isClass) {
target.constructor.prototype.callParent = Base.prototype.callParent;
target.constructor.callParent = Base.callParent;
}
}
}
}
},
namespace :
function
(){
var
len1 = arguments.length,
i = 0,
len2,
j,
main,
ns,
sub,
current;
for
(; i < len1; ++i) {
main = arguments[i];
ns = arguments[i].split(
'.'
);
current = window[ns[0]];
if
(current === undefined) {
current = window[ns[0]] = {};
}
sub = ns.slice(1);
len2 = sub.length;
for
(j = 0; j < len2; ++j) {
current = current[sub[j]] = current[sub[j]] || {};
}
}
return
current;
},
urlEncode :
function
(o, pre){
var
empty,
buf = [],
e = encodeURIComponent;
Ext.iterate(o,
function
(key, item){
empty = Ext.isEmpty(item);
Ext.each(empty ? key : item,
function
(val){
buf.push('&
', e(key), '
=
', (!Ext.isEmpty(val) && (val != key || !empty)) ? (Ext.isDate(val) ? Ext.encode(val).replace(/"/g, '
') : e(val)) : '
');
});
});
if(!pre){
buf.shift();
pre = '
';
}
return pre + buf.join('
');
},
/**
* Takes an encoded URL and and converts it to an object. Example: <pre><code>
Ext.urlDecode("foo=1&bar=2"); // returns {foo: "1", bar: "2"}
Ext.urlDecode("foo=1&bar=2&bar=3&bar=4", false); // returns {foo: "1", bar: ["2", "3", "4"]}
</code></pre>
* @param {String} string
* @param {Boolean} overwrite (optional) Items of the same name will overwrite previous values instead of creating an an array (Defaults to false).
* @return {Object} A literal with members
*/
urlDecode : function(string, overwrite){
if(Ext.isEmpty(string)){
return {};
}
var obj = {},
pairs = string.split('
&
'),
d = decodeURIComponent,
name,
value;
Ext.each(pairs, function(pair) {
pair = pair.split('
=
');
name = d(pair[0]);
value = d(pair[1]);
obj[name] = overwrite || !obj[name] ? value :
[].concat(obj[name]).concat(value);
});
return obj;
},
/**
* Appends content to the query string of a URL, handling logic for whether to place
* a question mark or ampersand.
* @param {String} url The URL to append to.
* @param {String} s The content to append to the URL.
* @return (String) The resulting URL
*/
urlAppend : function(url, s){
if(!Ext.isEmpty(s)){
return url + (url.indexOf('
?
') === -1 ? '
?
' : '
&
') + s;
}
return url;
},
/**
* Converts any iterable (numeric indices and a length property) into a true array
* Don'
t use
this
on strings. IE doesn
't support "abc"[0] which this implementation depends on.
* For strings, use this instead: "abc".match(/./g) => [a,b,c];
* @param {Iterable} the iterable object to be turned into a true Array.
* @return (Array) array
*/
toArray : function(){
return isIE ?
function(a, i, j, res){
res = [];
for(var x = 0, len = a.length; x < len; x++) {
res.push(a[x]);
}
return res.slice(i || 0, j || res.length);
} :
function(a, i, j){
return Array.prototype.slice.call(a, i || 0, j || a.length);
};
}(),
isIterable : function(v){
//check for array or arguments
if(Ext.isArray(v) || v.callee){
return true;
}
//check for node list type
if(/NodeList|HTMLCollection/.test(toString.call(v))){
return true;
}
//NodeList has an item and length property
//IXMLDOMNodeList has nextNode method, needs to be checked first.
return ((typeof v.nextNode != '
undefined
' || v.item) && Ext.isNumber(v.length));
},
/**
* Iterates an array calling the supplied function.
* @param {Array/NodeList/Mixed} array The array to be iterated. If this
* argument is not really an array, the supplied function is called once.
* @param {Function} fn The function to be called with each item. If the
* supplied function returns false, iteration stops and this method returns
* the current <code>index</code>. This function is called with
* the following arguments:
* <div class="mdetail-params"><ul>
* <li><code>item</code> : <i>Mixed</i>
* <div class="sub-desc">The item at the current <code>index</code>
* in the passed <code>array</code></div></li>
* <li><code>index</code> : <i>Number</i>
* <div class="sub-desc">The current index within the array</div></li>
* <li><code>allItems</code> : <i>Array</i>
* <div class="sub-desc">The <code>array</code> passed as the first
* argument to <code>Ext.each</code>.</div></li>
* </ul></div>
* @param {Object} scope The scope (<code>this</code> reference) in which the specified function is executed.
* Defaults to the <code>item</code> at the current <code>index</code>
* within the passed <code>array</code>.
* @return See description for the fn parameter.
*/
each : function(array, fn, scope){
if(Ext.isEmpty(array, true)){
return;
}
if(!Ext.isIterable(array) || Ext.isPrimitive(array)){
array = [array];
}
for(var i = 0, len = array.length; i < len; i++){
if(fn.call(scope || array[i], array[i], i, array) === false){
return i;
};
}
},
/**
* Iterates either the elements in an array, or each of the properties in an object.
* <b>Note</b>: If you are only iterating arrays, it is better to call {@link #each}.
* @param {Object/Array} object The object or array to be iterated
* @param {Function} fn The function to be called for each iteration.
* The iteration will stop if the supplied function returns false, or
* all array elements / object properties have been covered. The signature
* varies depending on the type of object being interated:
* <div class="mdetail-params"><ul>
* <li>Arrays : <tt>(Object item, Number index, Array allItems)</tt>
* <div class="sub-desc">
* When iterating an array, the supplied function is called with each item.</div></li>
* <li>Objects : <tt>(String key, Object value, Object)</tt>
* <div class="sub-desc">
* When iterating an object, the supplied function is called with each key-value pair in
* the object, and the iterated object</div></li>
* </ul></div>
* @param {Object} scope The scope (<code>this</code> reference) in which the specified function is executed. Defaults to
* the <code>object</code> being iterated.
*/
iterate : function(obj, fn, scope){
if(Ext.isEmpty(obj)){
return;
}
if(Ext.isIterable(obj)){
Ext.each(obj, fn, scope);
return;
}else if(typeof obj == '
object
'){
for(var prop in obj){
if(obj.hasOwnProperty(prop)){
if(fn.call(scope || obj, prop, obj[prop], obj) === false){
return;
};
}
}
}
},
/**
* Return the dom node for the passed String (id), dom node, or Ext.Element.
* Optional '
strict
' flag is needed for IE since it can return '
name
' and
* '
id
' elements by using getElementById.
* Here are some examples:
* <pre><code>
// gets dom node based on id
var elDom = Ext.getDom('
elId
');
// gets dom node based on the dom node
var elDom1 = Ext.getDom(elDom);
// If we don't know if we are working with an
// Ext.Element or a dom node use Ext.getDom
function(el){
var dom = Ext.getDom(el);
// do something with the dom node
}
* </code></pre>
* <b>Note</b>: the dom node to be found actually needs to exist (be rendered, etc)
* when this method is called to be successful.
* @param {Mixed} el
* @return HTMLElement
*/
getDom : function(el, strict){
if(!el || !DOC){
return null;
}
if (el.dom){
return el.dom;
} else {
if (typeof el == '
string
') {
var e = DOC.getElementById(el);
// IE returns elements with the '
name
' and '
id
' attribute.
// we do a strict check to return the element with only the id attribute
if (e && isIE && strict) {
if (el == e.getAttribute('
id
')) {
return e;
} else {
return null;
}
}
return e;
} else {
return el;
}
}
},
/**
* Returns the current document body as an {@link Ext.Element}.
* @return Ext.Element The document body
*/
getBody : function(){
return Ext.get(DOC.body || DOC.documentElement);
},
/**
* Returns the current document body as an {@link Ext.Element}.
* @return Ext.Element The document body
* @method
*/
getHead : function() {
var head;
return function() {
if (head == undefined) {
head = Ext.get(DOC.getElementsByTagName("head")[0]);
}
return head;
};
}(),
/**
* <p>Removes this element from the document, removes all DOM event listeners, and deletes the cache reference.
* All DOM event listeners are removed from this element. If {@link Ext#enableNestedListenerRemoval} is
* <code>true</code>, then DOM event listeners are also removed from all child nodes. The body node
* will be ignored if passed in.</p>
* @param {HTMLElement} node The node to remove
* @method
*/
removeNode : isIE && !isIE8 ? function(){
var d;
return function(n){
if(n && n.tagName != '
BODY
'){
(Ext.enableNestedListenerRemoval) ? Ext.EventManager.purgeElement(n, true) : Ext.EventManager.removeAll(n);
d = d || DOC.createElement('
div
');
d.appendChild(n);
d.innerHTML = '
';
delete Ext.elCache[n.id];
}
};
}() : function(n){
if(n && n.parentNode && n.tagName != '
BODY
'){
(Ext.enableNestedListenerRemoval) ? Ext.EventManager.purgeElement(n, true) : Ext.EventManager.removeAll(n);
n.parentNode.removeChild(n);
delete Ext.elCache[n.id];
}
},
/**
* <p>Returns true if the passed value is empty.</p>
* <p>The value is deemed to be empty if it is<div class="mdetail-params"><ul>
* <li>null</li>
* <li>undefined</li>
* <li>an empty array</li>
* <li>a zero length string (Unless the <tt>allowBlank</tt> parameter is <tt>true</tt>)</li>
* </ul></div>
* @param {Mixed} value The value to test
* @param {Boolean} allowBlank (optional) true to allow empty strings (defaults to false)
* @return {Boolean}
*/
isEmpty : function(v, allowBlank){
return v === null || v === undefined || ((Ext.isArray(v) && !v.length)) || (!allowBlank ? v === '
' : false);
},
/**
* Returns true if the passed value is a JavaScript array, otherwise false.
* @param {Mixed} value The value to test
* @return {Boolean}
*/
isArray : function(v){
return toString.apply(v) === '
[object Array]
';
},
/**
* Returns true if the passed object is a JavaScript date object, otherwise false.
* @param {Object} object The object to test
* @return {Boolean}
*/
isDate : function(v){
return toString.apply(v) === '
[object Date]
';
},
/**
* Returns true if the passed value is a JavaScript Object, otherwise false.
* @param {Mixed} value The value to test
* @return {Boolean}
*/
isObject : function(v){
return !!v && Object.prototype.toString.call(v) === '
[object Object]
';
},
/**
* Returns true if the passed value is a JavaScript '
primitive
', a string, number or boolean.
* @param {Mixed} value The value to test
* @return {Boolean}
*/
isPrimitive : function(v){
return Ext.isString(v) || Ext.isNumber(v) || Ext.isBoolean(v);
},
/**
* Returns true if the passed value is a JavaScript Function, otherwise false.
* @param {Mixed} value The value to test
* @return {Boolean}
*/
isFunction : function(v){
return toString.apply(v) === '
[object Function]
';
},
/**
* Returns true if the passed value is a number. Returns false for non-finite numbers.
* @param {Mixed} value The value to test
* @return {Boolean}
*/
isNumber : function(v){
return typeof v === '
number
' && isFinite(v);
},
/**
* Returns true if the passed value is a string.
* @param {Mixed} value The value to test
* @return {Boolean}
*/
isString : function(v){
return typeof v === '
string
';
},
/**
* Returns true if the passed value is a boolean.
* @param {Mixed} value The value to test
* @return {Boolean}
*/
isBoolean : function(v){
return typeof v === '
boolean
';
},
/**
* Returns true if the passed value is an HTMLElement
* @param {Mixed} value The value to test
* @return {Boolean}
*/
isElement : function(v) {
return v ? !!v.tagName : false;
},
/**
* Returns true if the passed value is not undefined.
* @param {Mixed} value The value to test
* @return {Boolean}
*/
isDefined : function(v){
return typeof v !== '
undefined
';
},
/**
* True if the detected browser is Opera.
* @type Boolean
*/
isOpera : isOpera,
/**
* True if the detected browser uses WebKit.
* @type Boolean
*/
isWebKit : isWebKit,
/**
* True if the detected browser is Chrome.
* @type Boolean
*/
isChrome : isChrome,
/**
* True if the detected browser is Safari.
* @type Boolean
*/
isSafari : isSafari,
/**
* True if the detected browser is Safari 3.x.
* @type Boolean
*/
isSafari3 : isSafari3,
/**
* True if the detected browser is Safari 4.x.
* @type Boolean
*/
isSafari4 : isSafari4,
/**
* True if the detected browser is Safari 2.x.
* @type Boolean
*/
isSafari2 : isSafari2,
/**
* True if the detected browser is Internet Explorer.
* @type Boolean
*/
isIE : isIE,
/**
* True if the detected browser is Internet Explorer 6.x.
* @type Boolean
*/
isIE6 : isIE6,
/**
* True if the detected browser is Internet Explorer 7.x.
* @type Boolean
*/
isIE7 : isIE7,
/**
* True if the detected browser is Internet Explorer 8.x.
* @type Boolean
*/
isIE8 : isIE8,
/**
* True if the detected browser is Internet Explorer 9.x.
* @type Boolean
*/
isIE9 : isIE9,
/**
* True if the detected browser is Internet Explorer 10.x
* @type Boolean
*/
isIE10 : isIE10,
/**
* True if the detected browser is Internet Explorer 9.x or lower
* @type Boolean
*/
isIE9m : isIE9m,
/**
* True if the detected browser is Internet Explorer 10.x or higher
* @type Boolean
*/
isIE10p : isIE && !(isIE6 || isIE7 || isIE8 || isIE9),
// IE10 quirks behaves like Gecko/WebKit quirks, so don'
t include it here
isIEQuirks: isIE && (!isStrict && (isIE6 || isIE7 || isIE8 || isIE9)),
isGecko : isGecko,
isGecko2 : isGecko2,
isGecko3 : isGecko3,
isBorderBox : isBorderBox,
isLinux : isLinux,
isWindows : isWindows,
isMac : isMac,
isAir : isAir
});
Ext.ns = Ext.namespace;
})();
Ext.ns(
'Ext.util'
,
'Ext.lib'
,
'Ext.data'
,
'Ext.supports'
);
Ext.elCache = {};
Ext.apply(Function.prototype, {
createInterceptor :
function
(fcn, scope){
var
method =
this
;
return
!Ext.isFunction(fcn) ?
this
:
function
() {
var
me =
this
,
args = arguments;
fcn.target = me;
fcn.method = method;
return
(fcn.apply(scope || me || window, args) !==
false
) ?
method.apply(me || window, args) :
null
;
};
},
createCallback :
function
(
){
var
args = arguments,
method =
this
;
return
function
() {
return
method.apply(window, args);
};
},
createDelegate :
function
(obj, args, appendArgs){
var
method =
this
;
return
function
() {
var
callArgs = args || arguments;
if
(appendArgs ===
true
){
callArgs = Array.prototype.slice.call(arguments, 0);
callArgs = callArgs.concat(args);
}
else
if
(Ext.isNumber(appendArgs)){
callArgs = Array.prototype.slice.call(arguments, 0);
var
applyArgs = [appendArgs, 0].concat(args);
Array.prototype.splice.apply(callArgs, applyArgs);
}
return
method.apply(obj || window, callArgs);
};
},
defer :
function
(millis, obj, args, appendArgs){
var
fn =
this
.createDelegate(obj, args, appendArgs);
if
(millis > 0){
return
setTimeout(fn, millis);
}
fn();
return
0;
}
});
Ext.applyIf(String, {
format :
function
(format){
var
args = Ext.toArray(arguments, 1);
return
format.replace(/\{(\d+)\}/g,
function
(m, i){
return
args[i];
});
}
});
Ext.applyIf(Array.prototype, {
indexOf :
function
(o,
from
){
var
len =
this
.length;
from
=
from
|| 0;
from
+= (
from
< 0) ? len : 0;
for
(;
from
< len; ++
from
){
if
(
this
[
from
] === o){
return
from
;
}
}
return
-1;
},
remove :
function
(o){
var
index =
this
.indexOf(o);
if
(index != -1){
this
.splice(index, 1);
}
return
this
;
}
});
Ext.util.TaskRunner =
function
(interval){
interval = interval || 10;
var
tasks = [],
removeQueue = [],
id = 0,
running =
false
,
stopThread =
function
(){
running =
false
;
clearInterval(id);
id = 0;
},
startThread =
function
(){
if
(!running){
running =
true
;
id = setInterval(runTasks, interval);
}
},
removeTask =
function
(t){
removeQueue.push(t);
if
(t.onStop){
t.onStop.apply(t.scope || t);
}
},
runTasks =
function
(){
var
rqLen = removeQueue.length,
now =
new
Date().getTime();
if
(rqLen > 0){
for
(
var
i = 0; i < rqLen; i++){
tasks.remove(removeQueue[i]);
}
removeQueue = [];
if
(tasks.length < 1){
stopThread();
return
;
}
}
for
(
var
i = 0, t, itime, rt, len = tasks.length; i < len; ++i){
t = tasks[i];
itime = now - t.taskRunTime;
if
(t.interval <= itime){
rt = t.run.apply(t.scope || t, t.args || [++t.taskRunCount]);
t.taskRunTime = now;
if
(rt ===
false
|| t.taskRunCount === t.repeat){
removeTask(t);
return
;
}
}
if
(t.duration && t.duration <= (now - t.taskStartTime)){
removeTask(t);
}
}
};
this
.start =
function
(task){
tasks.push(task);
task.taskStartTime =
new
Date().getTime();
task.taskRunTime = 0;
task.taskRunCount = 0;
startThread();
return
task;
};
this
.stop =
function
(task){
removeTask(task);
return
task;
};
this
.stopAll =
function
(){
stopThread();
for
(
var
i = 0, len = tasks.length; i < len; i++){
if
(tasks[i].onStop){
tasks[i].onStop();
}
}
tasks = [];
removeQueue = [];
};
};
Ext.TaskMgr =
new
Ext.util.TaskRunner();(
function
(){
var
libFlyweight,
version = Prototype.Version.split(
'.'
),
mouseEnterSupported = (parseInt(version[0], 10) >= 2) || (parseInt(version[1], 10) >= 7) || (parseInt(version[2], 10) >= 1),
mouseCache = {},
elContains =
function
(parent, child) {
if
(parent && parent.firstChild){
while
(child) {
if
(child === parent) {
return
true
;
}
child = child.parentNode;
if
(child && (child.nodeType != 1)) {
child =
null
;
}
}
}
return
false
;
},
checkRelatedTarget =
function
(e) {
return
!elContains(e.currentTarget, Ext.lib.Event.getRelatedTarget(e));
};
Ext.lib.Dom = {
getViewWidth :
function
(full){
return
full ?
this
.getDocumentWidth() :
this
.getViewportWidth();
},
getViewHeight :
function
(full){
return
full ?
this
.getDocumentHeight() :
this
.getViewportHeight();
},
getDocumentHeight:
function
() {
var
scrollHeight = (document.compatMode != "CSS1Compat
") ? document.body.scrollHeight : document.documentElement.scrollHeight;
return Math.max(scrollHeight, this.getViewportHeight());
},
getDocumentWidth: function() { // missing from prototype?
var scrollWidth = (document.compatMode != "
CSS1Compat
") ? document.body.scrollWidth : document.documentElement.scrollWidth;
return Math.max(scrollWidth, this.getViewportWidth());
},
getViewportHeight: function() { // missing from prototype?
var height = self.innerHeight;
var mode = document.compatMode;
if ( (mode || Ext.isIE) && !Ext.isOpera ) {
height = (mode == "
CSS1Compat
") ?
document.documentElement.clientHeight : // Standards
document.body.clientHeight; // Quirks
}
return height;
},
getViewportWidth: function() { // missing from prototype?
var width = self.innerWidth; // Safari
var mode = document.compatMode;
if (mode || Ext.isIE) { // IE, Gecko, Opera
width = (mode == "
CSS1Compat
") ?
document.documentElement.clientWidth : // Standards
document.body.clientWidth; // Quirks
}
return width;
},
isAncestor : function(p, c){ // missing from prototype?
var ret = false;
p = Ext.getDom(p);
c = Ext.getDom(c);
if (p && c) {
if (p.contains) {
return p.contains(c);
} else if (p.compareDocumentPosition) {
return !!(p.compareDocumentPosition(c) & 16);
} else {
while (c = c.parentNode) {
ret = c == p || ret;
}
}
}
return ret;
},
getRegion : function(el){
return Ext.lib.Region.getRegion(el);
},
getY : function(el){
return this.getXY(el)[1];
},
getX : function(el){
return this.getXY(el)[0];
},
getXY : function(el){ // this initially used Position.cumulativeOffset but it is not accurate enough
var p, pe, b, scroll, bd = (document.body || document.documentElement);
el = Ext.getDom(el);
if(el == bd){
return [0, 0];
}
if (el.getBoundingClientRect) {
b = el.getBoundingClientRect();
scroll = fly(document).getScroll();
return [Math.round(b.left + scroll.left), Math.round(b.top + scroll.top)];
}
var x = 0, y = 0;
p = el;
var hasAbsolute = fly(el).getStyle("
position
") == "
absolute
";
while (p) {
x += p.offsetLeft;
y += p.offsetTop;
if (!hasAbsolute && fly(p).getStyle("
position
") == "
absolute
") {
hasAbsolute = true;
}
if (Ext.isGecko) {
pe = fly(p);
var bt = parseInt(pe.getStyle("
borderTopWidth
"), 10) || 0;
var bl = parseInt(pe.getStyle("
borderLeftWidth
"), 10) || 0;
x += bl;
y += bt;
if (p != el && pe.getStyle('overflow') != 'visible') {
x += bl;
y += bt;
}
}
p = p.offsetParent;
}
if (Ext.isSafari && hasAbsolute) {
x -= bd.offsetLeft;
y -= bd.offsetTop;
}
if (Ext.isGecko && !hasAbsolute) {
var dbd = fly(bd);
x += parseInt(dbd.getStyle("
borderLeftWidth
"), 10) || 0;
y += parseInt(dbd.getStyle("
borderTopWidth
"), 10) || 0;
}
p = el.parentNode;
while (p && p != bd) {
if (!Ext.isOpera || (p.tagName != 'TR' && fly(p).getStyle("
display
") != "
inline
")) {
x -= p.scrollLeft;
y -= p.scrollTop;
}
p = p.parentNode;
}
return [x, y];
},
setXY : function(el, xy){ // this initially used Position.cumulativeOffset but it is not accurate enough
el = Ext.fly(el, '_setXY');
el.position();
var pts = el.translatePoints(xy);
if(xy[0] !== false){
el.dom.style.left = pts.left + "
px
";
}
if(xy[1] !== false){
el.dom.style.top = pts.top + "
px
";
}
},
setX : function(el, x){
this.setXY(el, [x, false]);
},
setY : function(el, y){
this.setXY(el, [false, y]);
}
};
Ext.lib.Event = {
getPageX : function(e){
return Event.pointerX(e.browserEvent || e);
},
getPageY : function(e){
return Event.pointerY(e.browserEvent || e);
},
getXY : function(e){
e = e.browserEvent || e;
return [Event.pointerX(e), Event.pointerY(e)];
},
getTarget : function(e){
return Event.element(e.browserEvent || e);
},
resolveTextNode: Ext.isGecko ? function(node){
if(!node){
return;
}
var s = HTMLElement.prototype.toString.call(node);
if(s == '[xpconnect wrapped native prototype]' || s == '[object XULElement]'){
return;
}
return node.nodeType == 3 ? node.parentNode : node;
} : function(node){
return node && node.nodeType == 3 ? node.parentNode : node;
},
getRelatedTarget: function(ev) { // missing from prototype?
ev = ev.browserEvent || ev;
var t = ev.relatedTarget;
if (!t) {
if (ev.type == "
mouseout
") {
t = ev.toElement;
} else if (ev.type == "
mouseover
") {
t = ev.fromElement;
}
}
return this.resolveTextNode(t);
},
on : function(el, eventName, fn){
if((eventName == 'mouseenter' || eventName == 'mouseleave') && !mouseEnterSupported){
var item = mouseCache[el.id] || (mouseCache[el.id] = {});
item[eventName] = fn;
fn = fn.createInterceptor(checkRelatedTarget);
eventName = (eventName == 'mouseenter') ? 'mouseover' : 'mouseout';
}
Event.observe(el, eventName, fn, false);
},
un : function(el, eventName, fn){
if((eventName == 'mouseenter' || eventName == 'mouseleave') && !mouseEnterSupported){
var item = mouseCache[el.id],
ev = item && item[eventName];
if(ev){
fn = ev.fn;
delete item[eventName];
eventName = (eventName == 'mouseenter') ? 'mouseover' : 'mouseout';
}
}
Event.stopObserving(el, eventName, fn, false);
},
purgeElement : function(el){
// no equiv?
},
preventDefault : function(e){ // missing from prototype?
e = e.browserEvent || e;
if(e.preventDefault) {
e.preventDefault();
} else {
e.returnValue = false;
}
},
stopPropagation : function(e){ // missing from prototype?
e = e.browserEvent || e;
if(e.stopPropagation) {
e.stopPropagation();
} else {
e.cancelBubble = true;
}
},
stopEvent : function(e){
Event.stop(e.browserEvent || e);
},
onAvailable : function(id, fn, scope){ // no equiv
var start = new Date(), iid;
var f = function(){
if(start.getElapsed() > 10000){
clearInterval(iid);
}
var el = document.getElementById(id);
if(el){
clearInterval(iid);
fn.call(scope||window, el);
}
};
iid = setInterval(f, 50);
}
};
Ext.lib.Ajax = function(){
var createSuccess = function(cb){
return cb.success ? function(xhr){
cb.success.call(cb.scope||window, createResponse(cb, xhr));
} : Ext.emptyFn;
};
var createFailure = function(cb){
return cb.failure ? function(xhr){
cb.failure.call(cb.scope||window, createResponse(cb, xhr));
} : Ext.emptyFn;
};
var createResponse = function(cb, xhr){
var headerObj = {},
headerStr,
t,
s;
try {
headerStr = xhr.getAllResponseHeaders();
Ext.each(headerStr.replace(/\r\n/g, '\n').split('\n'), function(v){
t = v.indexOf(':');
if(t >= 0){
s = v.substr(0, t).toLowerCase();
if(v.charAt(t + 1) == ' '){
++t;
}
headerObj[s] = v.substr(t + 1);
}
});
} catch(e) {}
return {
responseText: xhr.responseText,
responseXML : xhr.responseXML,
argument: cb.argument,
status: xhr.status,
statusText: xhr.statusText,
getResponseHeader : function(header){
return headerObj[header.toLowerCase()];
},
getAllResponseHeaders : function(){
return headerStr;
}
};
};
return {
request : function(method, uri, cb, data, options){
var o = {
method: method,
parameters: data || '',
timeout: cb.timeout,
onSuccess: createSuccess(cb),
onFailure: createFailure(cb)
};
if(options){
var hs = options.headers;
if(hs){
o.requestHeaders = hs;
}
if(options.xmlData){
method = (method ? method : (options.method ? options.method : 'POST'));
if (!hs || !hs['Content-Type']){
o.contentType = 'text/xml';
}
o.postBody = options.xmlData;
delete o.parameters;
}
if(options.jsonData){
method = (method ? method : (options.method ? options.method : 'POST'));
if (!hs || !hs['Content-Type']){
o.contentType = 'application/json';
}
o.postBody = typeof options.jsonData == 'object' ? Ext.encode(options.jsonData) : options.jsonData;
delete o.parameters;
}
}
new Ajax.Request(uri, o);
},
formRequest : function(form, uri, cb, data, isUpload, sslUri){
new Ajax.Request(uri, {
method: Ext.getDom(form).method ||'POST',
parameters: Form.serialize(form)+(data?'&'+data:''),
timeout: cb.timeout,
onSuccess: createSuccess(cb),
onFailure: createFailure(cb)
});
},
isCallInProgress : function(trans){
return false;
},
abort : function(trans){
return false;
},
serializeForm : function(form){
return Form.serialize(form.dom||form);
}
};
}();
Ext.lib.Anim = function(){
var easings = {
easeOut: function(pos) {
return 1-Math.pow(1-pos,2);
},
easeIn: function(pos) {
return 1-Math.pow(1-pos,2);
}
};
var createAnim = function(cb, scope){
return {
stop : function(skipToLast){
this.effect.cancel();
},
isAnimated : function(){
return this.effect.state == 'running';
},
proxyCallback : function(){
Ext.callback(cb, scope);
}
};
};
return {
scroll : function(el, args, duration, easing, cb, scope){
// not supported so scroll immediately?
var anim = createAnim(cb, scope);
el = Ext.getDom(el);
if(typeof args.scroll.to[0] == 'number'){
el.scrollLeft = args.scroll.to[0];
}
if(typeof args.scroll.to[1] == 'number'){
el.scrollTop = args.scroll.to[1];
}
anim.proxyCallback();
return anim;
},
motion : function(el, args, duration, easing, cb, scope){
return this.run(el, args, duration, easing, cb, scope);
},
color : function(el, args, duration, easing, cb, scope){
return this.run(el, args, duration, easing, cb, scope);
},
run : function(el, args, duration, easing, cb, scope, type){
var o = {};
for(var k in args){
switch(k){ // scriptaculous doesn't support, so convert these
case 'points':
var by, pts, e = Ext.fly(el, '_animrun');
e.position();
if(by = args.points.by){
var xy = e.getXY();
pts = e.translatePoints([xy[0]+by[0], xy[1]+by[1]]);
}else{
pts = e.translatePoints(args.points.to);
}
o.left = pts.left+'px';
o.top = pts.top+'px';
break;
case 'width':
o.width = args.width.to+'px';
break;
case 'height':
o.height = args.height.to+'px';
break;
case 'opacity':
o.opacity = String(args.opacity.to);
break;
default:
o[k] = String(args[k].to);
break;
}
}
var anim = createAnim(cb, scope);
anim.effect = new Effect.Morph(Ext.id(el), {
duration: duration,
afterFinish: anim.proxyCallback,
transition: easings[easing] || Effect.Transitions.linear,
style: o
});
return anim;
}
};
}();
// all lib flyweight calls use their own flyweight to prevent collisions with developer flyweights
function fly(el){
if(!libFlyweight){
libFlyweight = new Ext.Element.Flyweight();
}
libFlyweight.dom = el;
return libFlyweight;
}
Ext.lib.Region = function(t, r, b, l) {
this.top = t;
this[1] = t;
this.right = r;
this.bottom = b;
this.left = l;
this[0] = l;
};
Ext.lib.Region.prototype = {
contains : function(region) {
return ( region.left >= this.left &&
region.right <= this.right &&
region.top >= this.top &&
region.bottom <= this.bottom );
},
getArea : function() {
return ( (this.bottom - this.top) * (this.right - this.left) );
},
intersect : function(region) {
var t = Math.max( this.top, region.top );
var r = Math.min( this.right, region.right );
var b = Math.min( this.bottom, region.bottom );
var l = Math.max( this.left, region.left );
if (b >= t && r >= l) {
return new Ext.lib.Region(t, r, b, l);
} else {
return null;
}
},
union : function(region) {
var t = Math.min( this.top, region.top );
var r = Math.max( this.right, region.right );
var b = Math.max( this.bottom, region.bottom );
var l = Math.min( this.left, region.left );
return new Ext.lib.Region(t, r, b, l);
},
constrainTo : function(r) {
this.top = this.top.constrain(r.top, r.bottom);
this.bottom = this.bottom.constrain(r.top, r.bottom);
this.left = this.left.constrain(r.left, r.right);
this.right = this.right.constrain(r.left, r.right);
return this;
},
adjust : function(t, l, b, r){
this.top += t;
this.left += l;
this.right += r;
this.bottom += b;
return this;
}
};
Ext.lib.Region.getRegion = function(el) {
var p = Ext.lib.Dom.getXY(el);
var t = p[1];
var r = p[0] + el.offsetWidth;
var b = p[1] + el.offsetHeight;
var l = p[0];
return new Ext.lib.Region(t, r, b, l);
};
Ext.lib.Point = function(x, y) {
if (Ext.isArray(x)) {
y = x[1];
x = x[0];
}
this.x = this.right = this.left = this[0] = x;
this.y = this.top = this.bottom = this[1] = y;
};
Ext.lib.Point.prototype = new Ext.lib.Region();
// prevent IE leaks
if(Ext.isIE) {
function fnCleanUp() {
var p = Function.prototype;
delete p.createSequence;
delete p.defer;
delete p.createDelegate;
delete p.createCallback;
delete p.createInterceptor;
window.detachEvent("
onunload
", fnCleanUp);
}
window.attachEvent("
onunload", fnCleanUp);
}
})();