Ext.DomHelper = function(){
var tempTableEl = null,
emptyTags = /^(?:br|frame|hr|img|input|link|meta|range|spacer|wbr|area|param|col)$/i,
tableRe = /^table|tbody|tr|td$/i,
confRe = /tag|children|cn|html$/i,
tableElRe = /td|tr|tbody/i,
cssRe = /([a-z0-9-]+)\s*:\s*([^;\s]+(?:\s*[^;\s]+)*);?/gi,
endRe = /end/i,
pub,
afterbegin = 'afterbegin',
afterend = 'afterend',
beforebegin = 'beforebegin',
beforeend = 'beforeend',
ts = '
',
tbs = ts+'',
tbe = ''+te,
trs = tbs + '',
tre = '
'+tbe;
function doInsert(el, o, returnElement, pos, sibling, append){
var newNode = pub.insertHtml(pos, Ext.getDom(el), createHtml(o));
return returnElement ? Ext.get(newNode, true) : newNode;
}
function createHtml(o){
var b = '',
attr,
val,
key,
keyVal,
cn;
if(typeof o == "string"){
b = o;
} else if (Ext.isArray(o)) {
for (var i=0; i < o.length; i++) {
if(o[i]) {
b += createHtml(o[i]);
}
};
} else {
b += '<' + (o.tag = o.tag || 'div');
for (attr in o) {
val = o[attr];
if(!confRe.test(attr)){
if (typeof val == "object") {
b += ' ' + attr + '="';
for (key in val) {
b += key + ':' + val[key] + ';';
};
b += '"';
}else{
b += ' ' + ({cls : 'class', htmlFor : 'for'}[attr] || attr) + '="' + val + '"';
}
}
};
if (emptyTags.test(o.tag)) {
b += '/>';
} else {
b += '>';
if ((cn = o.children || o.cn)) {
b += createHtml(cn);
} else if(o.html){
b += o.html;
}
b += '' + o.tag + '>';
}
}
return b;
}
function ieTable(depth, s, h, e){
tempTableEl.innerHTML = [s, h, e].join('');
var i = -1,
el = tempTableEl,
ns;
while(++i < depth){
el = el.firstChild;
}
if(ns = el.nextSibling){
var df = document.createDocumentFragment();
while(el){
ns = el.nextSibling;
df.appendChild(el);
el = ns;
}
el = df;
}
return el;
}
function insertIntoTable(tag, where, el, html) {
var node,
before;
tempTableEl = tempTableEl || document.createElement('div');
if(tag == 'td' && (where == afterbegin || where == beforeend) ||
!tableElRe.test(tag) && (where == beforebegin || where == afterend)) {
return;
}
before = where == beforebegin ? el :
where == afterend ? el.nextSibling :
where == afterbegin ? el.firstChild : null;
if (where == beforebegin || where == afterend) {
el = el.parentNode;
}
if (tag == 'td' || (tag == 'tr' && (where == beforeend || where == afterbegin))) {
node = ieTable(4, trs, html, tre);
} else if ((tag == 'tbody' && (where == beforeend || where == afterbegin)) ||
(tag == 'tr' && (where == beforebegin || where == afterend))) {
node = ieTable(3, tbs, html, tbe);
} else {
node = ieTable(2, ts, html, te);
}
el.insertBefore(node, before);
return node;
}
pub = {
markup : function(o){
return createHtml(o);
},
applyStyles : function(el, styles){
if(styles){
var i = 0,
len,
style,
matches;
el = Ext.fly(el);
if(typeof styles == "function"){
styles = styles.call();
}
if(typeof styles == "string"){
while((matches = cssRe.exec(styles))){
el.setStyle(matches[1], matches[2]);
}
}else if (typeof styles == "object"){
el.setStyle(styles);
}
}
},
insertHtml : function(where, el, html){
var hash = {},
hashVal,
setStart,
range,
frag,
rangeEl,
rs;
where = where.toLowerCase();
hash[beforebegin] = ['BeforeBegin', 'previousSibling'];
hash[afterend] = ['AfterEnd', 'nextSibling'];
if (el.insertAdjacentHTML) {
if(tableRe.test(el.tagName) && (rs = insertIntoTable(el.tagName.toLowerCase(), where, el, html))){
return rs;
}
hash[afterbegin] = ['AfterBegin', 'firstChild'];
hash[beforeend] = ['BeforeEnd', 'lastChild'];
if ((hashVal = hash[where])) {
el.insertAdjacentHTML(hashVal[0], html);
return el[hashVal[1]];
}
} else {
range = el.ownerDocument.createRange();
setStart = 'setStart' + (endRe.test(where) ? 'After' : 'Before');
if (hash[where]) {
range[setStart](el);
frag = range.createContextualFragment(html);
el.parentNode.insertBefore(frag, where == beforebegin ? el : el.nextSibling);
return el[(where == beforebegin ? 'previous' : 'next') + 'Sibling'];
} else {
rangeEl = (where == afterbegin ? 'first' : 'last') + 'Child';
if (el.firstChild) {
range[setStart](el[rangeEl]);
frag = range.createContextualFragment(html);
if(where == afterbegin){
el.insertBefore(frag, el.firstChild);
}else{
el.appendChild(frag);
}
} else {
el.innerHTML = html;
}
return el[rangeEl];
}
}
throw 'Illegal insertion point -> "' + where + '"';
},
insertBefore : function(el, o, returnElement){
return doInsert(el, o, returnElement, beforebegin);
},
insertAfter : function(el, o, returnElement){
return doInsert(el, o, returnElement, afterend, 'nextSibling');
},
insertFirst : function(el, o, returnElement){
return doInsert(el, o, returnElement, afterbegin, 'firstChild');
},
append : function(el, o, returnElement){
return doInsert(el, o, returnElement, beforeend, '', true);
},
overwrite : function(el, o, returnElement){
el = Ext.getDom(el);
el.innerHTML = createHtml(o);
return returnElement ? Ext.get(el.firstChild) : el.firstChild;
},
createHtml : createHtml
};
return pub;
}();
Ext.apply(Ext.DomHelper,
function(){
var pub,
afterbegin = 'afterbegin',
afterend = 'afterend',
beforebegin = 'beforebegin',
beforeend = 'beforeend',
confRe = /tag|children|cn|html$/i;
function doInsert(el, o, returnElement, pos, sibling, append){
el = Ext.getDom(el);
var newNode;
if (pub.useDom) {
newNode = createDom(o, null);
if (append) {
el.appendChild(newNode);
} else {
(sibling == 'firstChild' ? el : el.parentNode).insertBefore(newNode, el[sibling] || el);
}
} else {
newNode = Ext.DomHelper.insertHtml(pos, el, Ext.DomHelper.createHtml(o));
}
return returnElement ? Ext.get(newNode, true) : newNode;
}
function createDom(o, parentNode){
var el,
doc = document,
useSet,
attr,
val,
cn;
if (Ext.isArray(o)) {
el = doc.createDocumentFragment();
for (var i = 0, l = o.length; i < l; i++) {
createDom(o[i], el);
}
} else if (typeof o == 'string') {
el = doc.createTextNode(o);
} else {
el = doc.createElement( o.tag || 'div' );
useSet = !!el.setAttribute;
for (var attr in o) {
if(!confRe.test(attr)){
val = o[attr];
if(attr == 'cls'){
el.className = val;
}else{
if(useSet){
el.setAttribute(attr, val);
}else{
el[attr] = val;
}
}
}
}
Ext.DomHelper.applyStyles(el, o.style);
if ((cn = o.children || o.cn)) {
createDom(cn, el);
} else if (o.html) {
el.innerHTML = o.html;
}
}
if(parentNode){
parentNode.appendChild(el);
}
return el;
}
pub = {
createTemplate : function(o){
var html = Ext.DomHelper.createHtml(o);
return new Ext.Template(html);
},
useDom : false,
insertBefore : function(el, o, returnElement){
return doInsert(el, o, returnElement, beforebegin);
},
insertAfter : function(el, o, returnElement){
return doInsert(el, o, returnElement, afterend, 'nextSibling');
},
insertFirst : function(el, o, returnElement){
return doInsert(el, o, returnElement, afterbegin, 'firstChild');
},
append: function(el, o, returnElement){
return doInsert(el, o, returnElement, beforeend, '', true);
},
createDom: createDom
};
return pub;
}());
Ext.Template = function(html){
var me = this,
a = arguments,
buf = [],
v;
if (Ext.isArray(html)) {
html = html.join("");
} else if (a.length > 1) {
for(var i = 0, len = a.length; i < len; i++){
v = a[i];
if(typeof v == 'object'){
Ext.apply(me, v);
} else {
buf.push(v);
}
};
html = buf.join('');
}
me.html = html;
if (me.compiled) {
me.compile();
}
};
Ext.Template.prototype = {
re : /\{([\w-]+)\}/g,
applyTemplate : function(values){
var me = this;
return me.compiled ?
me.compiled(values) :
me.html.replace(me.re, function(m, name){
return values[name] !== undefined ? values[name] : "";
});
},
set : function(html, compile){
var me = this;
me.html = html;
me.compiled = null;
return compile ? me.compile() : me;
},
compile : function(){
var me = this,
sep = Ext.isGecko ? "+" : ",";
function fn(m, name){
name = "values['" + name + "']";
return "'"+ sep + '(' + name + " == undefined ? '' : " + name + ')' + sep + "'";
}
eval("this.compiled = function(values){ return " + (Ext.isGecko ? "'" : "['") +
me.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) +
(Ext.isGecko ? "';};" : "'].join('');};"));
return me;
},
insertFirst: function(el, values, returnElement){
return this.doInsert('afterBegin', el, values, returnElement);
},
insertBefore: function(el, values, returnElement){
return this.doInsert('beforeBegin', el, values, returnElement);
},
insertAfter : function(el, values, returnElement){
return this.doInsert('afterEnd', el, values, returnElement);
},
append : function(el, values, returnElement){
return this.doInsert('beforeEnd', el, values, returnElement);
},
doInsert : function(where, el, values, returnEl){
el = Ext.getDom(el);
var newNode = Ext.DomHelper.insertHtml(where, el, this.applyTemplate(values));
return returnEl ? Ext.get(newNode, true) : newNode;
},
overwrite : function(el, values, returnElement){
el = Ext.getDom(el);
el.innerHTML = this.applyTemplate(values);
return returnElement ? Ext.get(el.firstChild, true) : el.firstChild;
}
};
Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
Ext.Template.from = function(el, config){
el = Ext.getDom(el);
return new Ext.Template(el.value || el.innerHTML, config || '');
};
Ext.apply(Ext.Template.prototype, {
disableFormats : false,
re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
argsRe : /^\s*['"](.*)["']\s*$/,
compileARe : /\\/g,
compileBRe : /(\r\n|\n)/g,
compileCRe : /'/g,
/**
* Returns an HTML fragment of this template with the specified values applied.
* @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
* @return {String} The HTML fragment
* @hide repeat doc
*/
applyTemplate : function(values){
var me = this,
useF = me.disableFormats !== true,
fm = Ext.util.Format,
tpl = me;
if(me.compiled){
return me.compiled(values);
}
function fn(m, name, format, args){
if (format && useF) {
if (format.substr(0, 5) == "this.") {
return tpl.call(format.substr(5), values[name], values);
} else {
if (args) {
// quoted values are required for strings in compiled templates,
// but for non compiled we need to strip them
// quoted reversed for jsmin
var re = me.argsRe;
args = args.split(',');
for(var i = 0, len = args.length; i < len; i++){
args[i] = args[i].replace(re, "$1");
}
args = [values[name]].concat(args);
} else {
args = [values[name]];
}
return fm[format].apply(fm, args);
}
} else {
return values[name] !== undefined ? values[name] : "";
}
}
return me.html.replace(me.re, fn);
},
/**
* Compiles the template into an internal function, eliminating the RegEx overhead.
* @return {Ext.Template} this
* @hide repeat doc
*/
compile : function(){
var me = this,
fm = Ext.util.Format,
useF = me.disableFormats !== true,
sep = Ext.isGecko ? "+" : ",",
body;
function fn(m, name, format, args){
if(format && useF){
args = args ? ',' + args : "";
if(format.substr(0, 5) != "this."){
format = "fm." + format + '(';
}else{
format = 'this.call("'+ format.substr(5) + '", ';
args = ", values";
}
}else{
args= ''; format = "(values['" + name + "'] == undefined ? '' : ";
}
return "'"+ sep + format + "values['" + name + "']" + args + ")"+sep+"'";
}
// branched to use + in gecko and [].join() in others
if(Ext.isGecko){
body = "this.compiled = function(values){ return '" +
me.html.replace(me.compileARe, '\\\\').replace(me.compileBRe, '\\n').replace(me.compileCRe, "\\'").replace(me.re, fn) +
"';};";
}else{
body = ["this.compiled = function(values){ return ['"];
body.push(me.html.replace(me.compileARe, '\\\\').replace(me.compileBRe, '\\n').replace(me.compileCRe, "\\'").replace(me.re, fn));
body.push("'].join('');};");
body = body.join('');
}
eval(body);
return me;
},
// private function used to call members
call : function(fnName, value, allValues){
return this[fnName](value, allValues);
}
});
Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
/*
* This is code is also distributed under MIT license for use
* with jQuery and prototype JavaScript libraries.
*/
/**
* @class Ext.DomQuery
Provides high performance selector/xpath processing by compiling queries into reusable functions. New pseudo classes and matchers can be plugged. It works on HTML and XML documents (if a content node is passed in).
DomQuery supports most of the CSS3 selectors spec, along with some custom selectors and basic XPath.
All selectors, attribute filters and pseudos below can be combined infinitely in any order. For example "div.foo:nth-child(odd)[@foo=bar].bar:first" would be a perfectly valid selector. Node filters are processed in the order in which they appear, which allows you to optimize your queries for your document structure.
Element Selectors:
- * any element
- E an element with the tag E
- E F All descendent elements of E that have the tag F
- E > F or E/F all direct children elements of E that have the tag F
- E + F all elements with the tag F that are immediately preceded by an element with the tag E
- E ~ F all elements with the tag F that are preceded by a sibling element with the tag E
Attribute Selectors:
The use of @ and quotes are optional. For example, div[@foo='bar'] is also a valid attribute selector.
- E[foo] has an attribute "foo"
- E[foo=bar] has an attribute "foo" that equals "bar"
- E[foo^=bar] has an attribute "foo" that starts with "bar"
- E[foo$=bar] has an attribute "foo" that ends with "bar"
- E[foo*=bar] has an attribute "foo" that contains the substring "bar"
- E[foo%=2] has an attribute "foo" that is evenly divisible by 2
- E[foo!=bar] has an attribute "foo" that does not equal "bar"
Pseudo Classes:
- E:first-child E is the first child of its parent
- E:last-child E is the last child of its parent
- E:nth-child(n) E is the nth child of its parent (1 based as per the spec)
- E:nth-child(odd) E is an odd child of its parent
- E:nth-child(even) E is an even child of its parent
- E:only-child E is the only child of its parent
- E:checked E is an element that is has a checked attribute that is true (e.g. a radio or checkbox)
- E:first the first E in the resultset
- E:last the last E in the resultset
- E:nth(n) the nth E in the resultset (1 based)
- E:odd shortcut for :nth-child(odd)
- E:even shortcut for :nth-child(even)
- E:contains(foo) E's innerHTML contains the substring "foo"
- E:nodeValue(foo) E contains a textNode with a nodeValue that equals "foo"
- E:not(S) an E element that does not match simple selector S
- E:has(S) an E element that has a descendent that matches simple selector S
- E:next(S) an E element whose next sibling matches simple selector S
- E:prev(S) an E element whose previous sibling matches simple selector S
- E:any(S1|S2|S2) an E element which matches any of the simple selectors S1, S2 or S3
CSS Value Selectors:
- E{display=none} css value "display" that equals "none"
- E{display^=none} css value "display" that starts with "none"
- E{display$=none} css value "display" that ends with "none"
- E{display*=none} css value "display" that contains the substring "none"
- E{display%=2} css value "display" that is evenly divisible by 2
- E{display!=none} css value "display" that does not equal "none"
* @singleton
*/
Ext.DomQuery = function(){
var cache = {},
simpleCache = {},
valueCache = {},
nonSpace = /\S/,
trimRe = /^\s+|\s+$/g,
tplRe = /\{(\d+)\}/g,
modeRe = /^(\s?[\/>+~]\s?|\s|$)/,
tagTokenRe = /^(#)?([\w-\*]+)/,
nthRe = /(\d*)n\+?(\d*)/,
nthRe2 = /\D/,
isIE = window.ActiveXObject ? true : false,
key = 30803;
eval("var batch = 30803;");
function child(parent, index){
var i = 0,
n = parent.firstChild;
while(n){
if(n.nodeType == 1){
if(++i == index){
return n;
}
}
n = n.nextSibling;
}
return null;
}
function next(n){
while((n = n.nextSibling) && n.nodeType != 1);
return n;
}
function prev(n){
while((n = n.previousSibling) && n.nodeType != 1);
return n;
}
function children(parent){
var n = parent.firstChild,
nodeIndex = -1,
nextNode;
while(n){
nextNode = n.nextSibling;
if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){
parent.removeChild(n);
}else{
n.nodeIndex = ++nodeIndex;
}
n = nextNode;
}
return this;
}
function byClassName(nodeSet, cls){
if(!cls){
return nodeSet;
}
var result = [], ri = -1;
for(var i = 0, ci; ci = nodeSet[i]; i++){
if((' '+ci.className+' ').indexOf(cls) != -1){
result[++ri] = ci;
}
}
return result;
};
function attrValue(n, attr){
if(!n.tagName && typeof n.length != "undefined"){
n = n[0];
}
if(!n){
return null;
}
if(attr == "for"){
return n.htmlFor;
}
if(attr == "class" || attr == "className"){
return n.className;
}
return n.getAttribute(attr) || n[attr];
};
function getNodes(ns, mode, tagName){
var result = [], ri = -1, cs;
if(!ns){
return result;
}
tagName = tagName || "*";
if(typeof ns.getElementsByTagName != "undefined"){
ns = [ns];
}
if(!mode){
for(var i = 0, ni; ni = ns[i]; i++){
cs = ni.getElementsByTagName(tagName);
for(var j = 0, ci; ci = cs[j]; j++){
result[++ri] = ci;
}
}
} else if(mode == "/" || mode == ">"){
var utag = tagName.toUpperCase();
for(var i = 0, ni, cn; ni = ns[i]; i++){
cn = ni.childNodes;
for(var j = 0, cj; cj = cn[j]; j++){
if(cj.nodeName == utag || cj.nodeName == tagName || tagName == '*'){
result[++ri] = cj;
}
}
}
}else if(mode == "+"){
var utag = tagName.toUpperCase();
for(var i = 0, n; n = ns[i]; i++){
while((n = n.nextSibling) && n.nodeType != 1);
if(n && (n.nodeName == utag || n.nodeName == tagName || tagName == '*')){
result[++ri] = n;
}
}
}else if(mode == "~"){
var utag = tagName.toUpperCase();
for(var i = 0, n; n = ns[i]; i++){
while((n = n.nextSibling)){
if (n.nodeName == utag || n.nodeName == tagName || tagName == '*'){
result[++ri] = n;
}
}
}
}
return result;
}
function concat(a, b){
if(b.slice){
return a.concat(b);
}
for(var i = 0, l = b.length; i < l; i++){
a[a.length] = b[i];
}
return a;
}
function byTag(cs, tagName){
if(cs.tagName || cs == document){
cs = [cs];
}
if(!tagName){
return cs;
}
var result = [], ri = -1;
tagName = tagName.toLowerCase();
for(var i = 0, ci; ci = cs[i]; i++){
if(ci.nodeType == 1 && ci.tagName.toLowerCase() == tagName){
result[++ri] = ci;
}
}
return result;
}
function byId(cs, id){
if(cs.tagName || cs == document){
cs = [cs];
}
if(!id){
return cs;
}
var result = [], ri = -1;
for(var i = 0, ci; ci = cs[i]; i++){
if(ci && ci.id == id){
result[++ri] = ci;
return result;
}
}
return result;
}
function byAttribute(cs, attr, value, op, custom){
var result = [],
ri = -1,
useGetStyle = custom == "{",
fn = Ext.DomQuery.operators[op],
a,
innerHTML;
for(var i = 0, ci; ci = cs[i]; i++){
if(ci.nodeType != 1){
continue;
}
innerHTML = ci.innerHTML;
if(innerHTML !== null && innerHTML !== undefined){
if(useGetStyle){
a = Ext.DomQuery.getStyle(ci, attr);
} else if (attr == "class" || attr == "className"){
a = ci.className;
} else if (attr == "for"){
a = ci.htmlFor;
} else if (attr == "href"){
a = ci.getAttribute("href", 2);
} else{
a = ci.getAttribute(attr);
}
}else{
a = ci.getAttribute(attr);
}
if((fn && fn(a, value)) || (!fn && a)){
result[++ri] = ci;
}
}
return result;
}
function byPseudo(cs, name, value){
return Ext.DomQuery.pseudos[name](cs, value);
}
function nodupIEXml(cs){
var d = ++key,
r;
cs[0].setAttribute("_nodup", d);
r = [cs[0]];
for(var i = 1, len = cs.length; i < len; i++){
var c = cs[i];
if(!c.getAttribute("_nodup") != d){
c.setAttribute("_nodup", d);
r[r.length] = c;
}
}
for(var i = 0, len = cs.length; i < len; i++){
cs[i].removeAttribute("_nodup");
}
return r;
}
function nodup(cs){
if(!cs){
return [];
}
var len = cs.length, c, i, r = cs, cj, ri = -1;
if(!len || typeof cs.nodeType != "undefined" || len == 1){
return cs;
}
if(isIE && typeof cs[0].selectSingleNode != "undefined"){
return nodupIEXml(cs);
}
var d = ++key;
cs[0]._nodup = d;
for(i = 1; c = cs[i]; i++){
if(c._nodup != d){
c._nodup = d;
}else{
r = [];
for(var j = 0; j < i; j++){
r[++ri] = cs[j];
}
for(j = i+1; cj = cs[j]; j++){
if(cj._nodup != d){
cj._nodup = d;
r[++ri] = cj;
}
}
return r;
}
}
return r;
}
function quickDiffIEXml(c1, c2){
var d = ++key,
r = [];
for(var i = 0, len = c1.length; i < len; i++){
c1[i].setAttribute("_qdiff", d);
}
for(var i = 0, len = c2.length; i < len; i++){
if(c2[i].getAttribute("_qdiff") != d){
r[r.length] = c2[i];
}
}
for(var i = 0, len = c1.length; i < len; i++){
c1[i].removeAttribute("_qdiff");
}
return r;
}
function quickDiff(c1, c2){
var len1 = c1.length,
d = ++key,
r = [];
if(!len1){
return c2;
}
if(isIE && typeof c1[0].selectSingleNode != "undefined"){
return quickDiffIEXml(c1, c2);
}
for(var i = 0; i < len1; i++){
c1[i]._qdiff = d;
}
for(var i = 0, len = c2.length; i < len; i++){
if(c2[i]._qdiff != d){
r[r.length] = c2[i];
}
}
return r;
}
function quickId(ns, mode, root, id){
if(ns == root){
var d = root.ownerDocument || root;
return d.getElementById(id);
}
ns = getNodes(ns, mode, "*");
return byId(ns, id);
}
return {
getStyle : function(el, name){
return Ext.fly(el).getStyle(name);
},
compile : function(path, type){
type = type || "select";
var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"],
mode,
lastPath,
matchers = Ext.DomQuery.matchers,
matchersLn = matchers.length,
modeMatch,
lmode = path.match(modeRe);
if(lmode && lmode[1]){
fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";';
path = path.replace(lmode[1], "");
}
while(path.substr(0, 1)=="/"){
path = path.substr(1);
}
while(path && lastPath != path){
lastPath = path;
var tokenMatch = path.match(tagTokenRe);
if(type == "select"){
if(tokenMatch){
if(tokenMatch[1] == "#"){
fn[fn.length] = 'n = quickId(n, mode, root, "'+tokenMatch[2]+'");';
}else{
fn[fn.length] = 'n = getNodes(n, mode, "'+tokenMatch[2]+'");';
}
path = path.replace(tokenMatch[0], "");
}else if(path.substr(0, 1) != '@'){
fn[fn.length] = 'n = getNodes(n, mode, "*");';
}
}else{
if(tokenMatch){
if(tokenMatch[1] == "#"){
fn[fn.length] = 'n = byId(n, "'+tokenMatch[2]+'");';
}else{
fn[fn.length] = 'n = byTag(n, "'+tokenMatch[2]+'");';
}
path = path.replace(tokenMatch[0], "");
}
}
while(!(modeMatch = path.match(modeRe))){
var matched = false;
for(var j = 0; j < matchersLn; j++){
var t = matchers[j];
var m = path.match(t.re);
if(m){
fn[fn.length] = t.select.replace(tplRe, function(x, i){
return m[i];
});
path = path.replace(m[0], "");
matched = true;
break;
}
}
if(!matched){
throw 'Error parsing selector, parsing failed at "' + path + '"';
}
}
if(modeMatch[1]){
fn[fn.length] = 'mode="'+modeMatch[1].replace(trimRe, "")+'";';
path = path.replace(modeMatch[1], "");
}
}
fn[fn.length] = "return nodup(n);\n}";
eval(fn.join(""));
return f;
},
jsSelect: function(path, root, type){
root = root || document;
if(typeof root == "string"){
root = document.getElementById(root);
}
var paths = path.split(","),
results = [];
for(var i = 0, len = paths.length; i < len; i++){
var subPath = paths[i].replace(trimRe, "");
if(!cache[subPath]){
cache[subPath] = Ext.DomQuery.compile(subPath);
if(!cache[subPath]){
throw subPath + " is not a valid selector";
}
}
var result = cache[subPath](root);
if(result && result != document){
results = results.concat(result);
}
}
if(paths.length > 1){
return nodup(results);
}
return results;
},
isXml: function(el) {
var docEl = (el ? el.ownerDocument || el : 0).documentElement;
return docEl ? docEl.nodeName !== "HTML" : false;
},
select : document.querySelectorAll ? function(path, root, type) {
root = root || document;
if (!Ext.DomQuery.isXml(root)) {
try {
var cs = root.querySelectorAll(path);
return Ext.toArray(cs);
}
catch (ex) {}
}
return Ext.DomQuery.jsSelect.call(this, path, root, type);
} : function(path, root, type) {
return Ext.DomQuery.jsSelect.call(this, path, root, type);
},
selectNode : function(path, root){
return Ext.DomQuery.select(path, root)[0];
},
selectValue : function(path, root, defaultValue){
path = path.replace(trimRe, "");
if(!valueCache[path]){
valueCache[path] = Ext.DomQuery.compile(path, "select");
}
var n = valueCache[path](root), v;
n = n[0] ? n[0] : n;
if (typeof n.normalize == 'function') n.normalize();
v = (n && n.firstChild ? n.firstChild.nodeValue : null);
return ((v === null||v === undefined||v==='') ? defaultValue : v);
},
selectNumber : function(path, root, defaultValue){
var v = Ext.DomQuery.selectValue(path, root, defaultValue || 0);
return parseFloat(v);
},
is : function(el, ss){
if(typeof el == "string"){
el = document.getElementById(el);
}
var isArray = Ext.isArray(el),
result = Ext.DomQuery.filter(isArray ? el : [el], ss);
return isArray ? (result.length == el.length) : (result.length > 0);
},
filter : function(els, ss, nonMatches){
ss = ss.replace(trimRe, "");
if(!simpleCache[ss]){
simpleCache[ss] = Ext.DomQuery.compile(ss, "simple");
}
var result = simpleCache[ss](els);
return nonMatches ? quickDiff(result, els) : result;
},
matchers : [{
re: /^\.([\w-]+)/,
select: 'n = byClassName(n, " {1} ");'
}, {
re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/,
select: 'n = byPseudo(n, "{1}", "{2}");'
},{
re: /^(?:([\[\{])(?:@)?([\w-]+)\s?(?:(=|.=)\s?['"]?(.*?)["']?)?[\]\}])/,
select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");'
}, {
re: /^#([\w-]+)/,
select: 'n = byId(n, "{1}");'
},{
re: /^@([\w-]+)/,
select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};'
}
],
operators : {
"=" : function(a, v){
return a == v;
},
"!=" : function(a, v){
return a != v;
},
"^=" : function(a, v){
return a && a.substr(0, v.length) == v;
},
"$=" : function(a, v){
return a && a.substr(a.length-v.length) == v;
},
"*=" : function(a, v){
return a && a.indexOf(v) !== -1;
},
"%=" : function(a, v){
return (a % v) == 0;
},
"|=" : function(a, v){
return a && (a == v || a.substr(0, v.length+1) == v+'-');
},
"~=" : function(a, v){
return a && (' '+a+' ').indexOf(' '+v+' ') != -1;
}
},
pseudos : {
"first-child" : function(c){
var r = [], ri = -1, n;
for(var i = 0, ci; ci = n = c[i]; i++){
while((n = n.previousSibling) && n.nodeType != 1);
if(!n){
r[++ri] = ci;
}
}
return r;
},
"last-child" : function(c){
var r = [], ri = -1, n;
for(var i = 0, ci; ci = n = c[i]; i++){
while((n = n.nextSibling) && n.nodeType != 1);
if(!n){
r[++ri] = ci;
}
}
return r;
},
"nth-child" : function(c, a) {
var r = [], ri = -1,
m = nthRe.exec(a == "even" && "2n" || a == "odd" && "2n+1" || !nthRe2.test(a) && "n+" + a || a),
f = (m[1] || 1) - 0, l = m[2] - 0;
for(var i = 0, n; n = c[i]; i++){
var pn = n.parentNode;
if (batch != pn._batch) {
var j = 0;
for(var cn = pn.firstChild; cn; cn = cn.nextSibling){
if(cn.nodeType == 1){
cn.nodeIndex = ++j;
}
}
pn._batch = batch;
}
if (f == 1) {
if (l == 0 || n.nodeIndex == l){
r[++ri] = n;
}
} else if ((n.nodeIndex + l) % f == 0){
r[++ri] = n;
}
}
return r;
},
"only-child" : function(c){
var r = [], ri = -1;;
for(var i = 0, ci; ci = c[i]; i++){
if(!prev(ci) && !next(ci)){
r[++ri] = ci;
}
}
return r;
},
"empty" : function(c){
var r = [], ri = -1;
for(var i = 0, ci; ci = c[i]; i++){
var cns = ci.childNodes, j = 0, cn, empty = true;
while(cn = cns[j]){
++j;
if(cn.nodeType == 1 || cn.nodeType == 3){
empty = false;
break;
}
}
if(empty){
r[++ri] = ci;
}
}
return r;
},
"contains" : function(c, v){
var r = [], ri = -1;
for(var i = 0, ci; ci = c[i]; i++){
if((ci.textContent||ci.innerText||'').indexOf(v) != -1){
r[++ri] = ci;
}
}
return r;
},
"nodeValue" : function(c, v){
var r = [], ri = -1;
for(var i = 0, ci; ci = c[i]; i++){
if(ci.firstChild && ci.firstChild.nodeValue == v){
r[++ri] = ci;
}
}
return r;
},
"checked" : function(c){
var r = [], ri = -1;
for(var i = 0, ci; ci = c[i]; i++){
if(ci.checked == true){
r[++ri] = ci;
}
}
return r;
},
"not" : function(c, ss){
return Ext.DomQuery.filter(c, ss, true);
},
"any" : function(c, selectors){
var ss = selectors.split('|'),
r = [], ri = -1, s;
for(var i = 0, ci; ci = c[i]; i++){
for(var j = 0; s = ss[j]; j++){
if(Ext.DomQuery.is(ci, s)){
r[++ri] = ci;
break;
}
}
}
return r;
},
"odd" : function(c){
return this["nth-child"](c, "odd");
},
"even" : function(c){
return this["nth-child"](c, "even");
},
"nth" : function(c, a){
return c[a-1] || [];
},
"first" : function(c){
return c[0] || [];
},
"last" : function(c){
return c[c.length-1] || [];
},
"has" : function(c, ss){
var s = Ext.DomQuery.select,
r = [], ri = -1;
for(var i = 0, ci; ci = c[i]; i++){
if(s(ss, ci).length > 0){
r[++ri] = ci;
}
}
return r;
},
"next" : function(c, ss){
var is = Ext.DomQuery.is,
r = [], ri = -1;
for(var i = 0, ci; ci = c[i]; i++){
var n = next(ci);
if(n && is(n, ss)){
r[++ri] = ci;
}
}
return r;
},
"prev" : function(c, ss){
var is = Ext.DomQuery.is,
r = [], ri = -1;
for(var i = 0, ci; ci = c[i]; i++){
var n = prev(ci);
if(n && is(n, ss)){
r[++ri] = ci;
}
}
return r;
}
}
};
}();
Ext.query = Ext.DomQuery.select;
Ext.util.DelayedTask = function(fn, scope, args){
var me = this,
id,
call = function(){
clearInterval(id);
id = null;
fn.apply(scope, args || []);
};
me.delay = function(delay, newFn, newScope, newArgs){
me.cancel();
fn = newFn || fn;
scope = newScope || scope;
args = newArgs || args;
id = setInterval(call, delay);
};
me.cancel = function(){
if(id){
clearInterval(id);
id = null;
}
};
};(function(){
var EXTUTIL = Ext.util,
EACH = Ext.each,
TRUE = true,
FALSE = false;
EXTUTIL.Observable = function(){
var me = this, e = me.events;
if(me.listeners){
me.on(me.listeners);
delete me.listeners;
}
me.events = e || {};
};
EXTUTIL.Observable.prototype = {
filterOptRe : /^(?:scope|delay|buffer|single)$/,
fireEvent : function(){
var a = Array.prototype.slice.call(arguments, 0),
ename = a[0].toLowerCase(),
me = this,
ret = TRUE,
ce = me.events[ename],
cc,
q,
c;
if (me.eventsSuspended === TRUE) {
if (q = me.eventQueue) {
q.push(a);
}
}
else if(typeof ce == 'object') {
if (ce.bubble){
if(ce.fire.apply(ce, a.slice(1)) === FALSE) {
return FALSE;
}
c = me.getBubbleTarget && me.getBubbleTarget();
if(c && c.enableBubble) {
cc = c.events[ename];
if(!cc || typeof cc != 'object' || !cc.bubble) {
c.enableBubble(ename);
}
return c.fireEvent.apply(c, a);
}
}
else {
a.shift();
ret = ce.fire.apply(ce, a);
}
}
return ret;
},
addListener : function(eventName, fn, scope, o){
var me = this,
e,
oe,
isF,
ce;
if (typeof eventName == 'object') {
o = eventName;
for (e in o){
oe = o[e];
if (!me.filterOptRe.test(e)) {
me.addListener(e, oe.fn || oe, oe.scope || o.scope, oe.fn ? oe : o);
}
}
} else {
eventName = eventName.toLowerCase();
ce = me.events[eventName] || TRUE;
if (typeof ce == 'boolean') {
me.events[eventName] = ce = new EXTUTIL.Event(me, eventName);
}
ce.addListener(fn, scope, typeof o == 'object' ? o : {});
}
},
removeListener : function(eventName, fn, scope){
var ce = this.events[eventName.toLowerCase()];
if (typeof ce == 'object') {
ce.removeListener(fn, scope);
}
},
purgeListeners : function(){
var events = this.events,
evt,
key;
for(key in events){
evt = events[key];
if(typeof evt == 'object'){
evt.clearListeners();
}
}
},
addEvents : function(o){
var me = this;
me.events = me.events || {};
if (typeof o == 'string') {
var a = arguments,
i = a.length;
while(i--) {
me.events[a[i]] = me.events[a[i]] || TRUE;
}
} else {
Ext.applyIf(me.events, o);
}
},
hasListener : function(eventName){
var e = this.events[eventName.toLowerCase()];
return typeof e == 'object' && e.listeners.length > 0;
},
suspendEvents : function(queueSuspended){
this.eventsSuspended = TRUE;
if(queueSuspended && !this.eventQueue){
this.eventQueue = [];
}
},
resumeEvents : function(){
var me = this,
queued = me.eventQueue || [];
me.eventsSuspended = FALSE;
delete me.eventQueue;
EACH(queued, function(e) {
me.fireEvent.apply(me, e);
});
}
};
var OBSERVABLE = EXTUTIL.Observable.prototype;
OBSERVABLE.on = OBSERVABLE.addListener;
OBSERVABLE.un = OBSERVABLE.removeListener;
EXTUTIL.Observable.releaseCapture = function(o){
o.fireEvent = OBSERVABLE.fireEvent;
};
function createTargeted(h, o, scope){
return function(){
if(o.target == arguments[0]){
h.apply(scope, Array.prototype.slice.call(arguments, 0));
}
};
};
function createBuffered(h, o, l, scope){
l.task = new EXTUTIL.DelayedTask();
return function(){
l.task.delay(o.buffer, h, scope, Array.prototype.slice.call(arguments, 0));
};
};
function createSingle(h, e, fn, scope){
return function(){
e.removeListener(fn, scope);
return h.apply(scope, arguments);
};
};
function createDelayed(h, o, l, scope){
return function(){
var task = new EXTUTIL.DelayedTask();
if(!l.tasks) {
l.tasks = [];
}
l.tasks.push(task);
task.delay(o.delay || 10, h, scope, Array.prototype.slice.call(arguments, 0));
};
};
EXTUTIL.Event = function(obj, name){
this.name = name;
this.obj = obj;
this.listeners = [];
};
EXTUTIL.Event.prototype = {
addListener : function(fn, scope, options){
var me = this,
l;
scope = scope || me.obj;
if(!me.isListening(fn, scope)){
l = me.createListener(fn, scope, options);
if(me.firing){
me.listeners = me.listeners.slice(0);
}
me.listeners.push(l);
}
},
createListener: function(fn, scope, o){
o = o || {}, scope = scope || this.obj;
var l = {
fn: fn,
scope: scope,
options: o
}, h = fn;
if(o.target){
h = createTargeted(h, o, scope);
}
if(o.delay){
h = createDelayed(h, o, l, scope);
}
if(o.single){
h = createSingle(h, this, fn, scope);
}
if(o.buffer){
h = createBuffered(h, o, l, scope);
}
l.fireFn = h;
return l;
},
findListener : function(fn, scope){
var list = this.listeners,
i = list.length,
l;
scope = scope || this.obj;
while(i--){
l = list[i];
if(l){
if(l.fn == fn && l.scope == scope){
return i;
}
}
}
return -1;
},
isListening : function(fn, scope){
return this.findListener(fn, scope) != -1;
},
removeListener : function(fn, scope){
var index,
l,
k,
me = this,
ret = FALSE;
if((index = me.findListener(fn, scope)) != -1){
if (me.firing) {
me.listeners = me.listeners.slice(0);
}
l = me.listeners[index];
if(l.task) {
l.task.cancel();
delete l.task;
}
k = l.tasks && l.tasks.length;
if(k) {
while(k--) {
l.tasks[k].cancel();
}
delete l.tasks;
}
me.listeners.splice(index, 1);
ret = TRUE;
}
return ret;
},
clearListeners : function(){
var me = this,
l = me.listeners,
i = l.length;
while(i--) {
me.removeListener(l[i].fn, l[i].scope);
}
},
fire : function(){
var me = this,
listeners = me.listeners,
len = listeners.length,
i = 0,
l;
if(len > 0){
me.firing = TRUE;
var args = Array.prototype.slice.call(arguments, 0);
for (; i < len; i++) {
l = listeners[i];
if(l && l.fireFn.apply(l.scope || me.obj || window, args) === FALSE) {
return (me.firing = FALSE);
}
}
}
me.firing = FALSE;
return TRUE;
}
};
})();
Ext.apply(Ext.util.Observable.prototype, function(){
function getMethodEvent(method){
var e = (this.methodEvents = this.methodEvents ||
{})[method], returnValue, v, cancel, obj = this;
if (!e) {
this.methodEvents[method] = e = {};
e.originalFn = this[method];
e.methodName = method;
e.before = [];
e.after = [];
var makeCall = function(fn, scope, args){
if((v = fn.apply(scope || obj, args)) !== undefined){
if (typeof v == 'object') {
if(v.returnValue !== undefined){
returnValue = v.returnValue;
}else{
returnValue = v;
}
cancel = !!v.cancel;
}
else
if (v === false) {
cancel = true;
}
else {
returnValue = v;
}
}
};
this[method] = function(){
var args = Array.prototype.slice.call(arguments, 0),
b;
returnValue = v = undefined;
cancel = false;
for(var i = 0, len = e.before.length; i < len; i++){
b = e.before[i];
makeCall(b.fn, b.scope, args);
if (cancel) {
return returnValue;
}
}
if((v = e.originalFn.apply(obj, args)) !== undefined){
returnValue = v;
}
for(var i = 0, len = e.after.length; i < len; i++){
b = e.after[i];
makeCall(b.fn, b.scope, args);
if (cancel) {
return returnValue;
}
}
return returnValue;
};
}
return e;
}
return {
beforeMethod : function(method, fn, scope){
getMethodEvent.call(this, method).before.push({
fn: fn,
scope: scope
});
},
afterMethod : function(method, fn, scope){
getMethodEvent.call(this, method).after.push({
fn: fn,
scope: scope
});
},
removeMethodListener: function(method, fn, scope){
var e = this.getMethodEvent(method);
for(var i = 0, len = e.before.length; i < len; i++){
if(e.before[i].fn == fn && e.before[i].scope == scope){
e.before.splice(i, 1);
return;
}
}
for(var i = 0, len = e.after.length; i < len; i++){
if(e.after[i].fn == fn && e.after[i].scope == scope){
e.after.splice(i, 1);
return;
}
}
},
relayEvents : function(o, events){
var me = this;
function createHandler(ename){
return function(){
return me.fireEvent.apply(me, [ename].concat(Array.prototype.slice.call(arguments, 0)));
};
}
for(var i = 0, len = events.length; i < len; i++){
var ename = events[i];
me.events[ename] = me.events[ename] || true;
o.on(ename, createHandler(ename), me);
}
},
enableBubble : function(events){
var me = this;
if(!Ext.isEmpty(events)){
events = Ext.isArray(events) ? events : Array.prototype.slice.call(arguments, 0);
for(var i = 0, len = events.length; i < len; i++){
var ename = events[i];
ename = ename.toLowerCase();
var ce = me.events[ename] || true;
if (typeof ce == 'boolean') {
ce = new Ext.util.Event(me, ename);
me.events[ename] = ce;
}
ce.bubble = true;
}
}
}
};
}());
Ext.util.Observable.capture = function(o, fn, scope){
o.fireEvent = o.fireEvent.createInterceptor(fn, scope);
};
Ext.util.Observable.observeClass = function(c, listeners){
if(c){
if(!c.fireEvent){
Ext.apply(c, new Ext.util.Observable());
Ext.util.Observable.capture(c.prototype, c.fireEvent, c);
}
if(typeof listeners == 'object'){
c.on(listeners);
}
return c;
}
};
Ext.EventManager = function(){
var docReadyEvent,
docReadyProcId,
docReadyState = false,
DETECT_NATIVE = Ext.isGecko || Ext.isWebKit || Ext.isSafari,
E = Ext.lib.Event,
D = Ext.lib.Dom,
DOC = document,
WINDOW = window,
DOMCONTENTLOADED = "DOMContentLoaded",
COMPLETE = 'complete',
propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/,
specialElCache = [];
function getId(el){
var id = false,
i = 0,
len = specialElCache.length,
id = false,
skip = false,
o;
if(el){
if(el.getElementById || el.navigator){
for(; i < len; ++i){
o = specialElCache[i];
if(o.el === el){
id = o.id;
break;
}
}
if(!id){
id = Ext.id(el);
specialElCache.push({
id: id,
el: el
});
skip = true;
}
}else{
id = Ext.id(el);
}
if(!Ext.elCache[id]){
Ext.Element.addToCache(new Ext.Element(el), id);
if(skip){
Ext.elCache[id].skipGC = true;
}
}
}
return id;
};
function addListener(el, ename, fn, task, wrap, scope){
el = Ext.getDom(el);
var id = getId(el),
es = Ext.elCache[id].events,
wfn;
wfn = E.on(el, ename, wrap);
es[ename] = es[ename] || [];
es[ename].push([fn, wrap, scope, wfn, task]);
if(el.addEventListener && ename == "mousewheel"){
var args = ["DOMMouseScroll", wrap, false];
el.addEventListener.apply(el, args);
Ext.EventManager.addListener(WINDOW, 'unload', function(){
el.removeEventListener.apply(el, args);
});
}
if(el == DOC && ename == "mousedown"){
Ext.EventManager.stoppedMouseDownEvent.addListener(wrap);
}
};
function doScrollChk(){
if(window != top){
return false;
}
try{
DOC.documentElement.doScroll('left');
}catch(e){
return false;
}
fireDocReady();
return true;
}
function checkReadyState(e){
if(Ext.isIE && doScrollChk()){
return true;
}
if(DOC.readyState == COMPLETE){
fireDocReady();
return true;
}
docReadyState || (docReadyProcId = setTimeout(arguments.callee, 2));
return false;
}
var styles;
function checkStyleSheets(e){
styles || (styles = Ext.query('style, link[rel=stylesheet]'));
if(styles.length == DOC.styleSheets.length){
fireDocReady();
return true;
}
docReadyState || (docReadyProcId = setTimeout(arguments.callee, 2));
return false;
}
function OperaDOMContentLoaded(e){
DOC.removeEventListener(DOMCONTENTLOADED, arguments.callee, false);
checkStyleSheets();
}
function fireDocReady(e){
if(!docReadyState){
docReadyState = true;
if(docReadyProcId){
clearTimeout(docReadyProcId);
}
if(DETECT_NATIVE) {
DOC.removeEventListener(DOMCONTENTLOADED, fireDocReady, false);
}
if(Ext.isIE && checkReadyState.bindIE){
DOC.detachEvent('onreadystatechange', checkReadyState);
}
E.un(WINDOW, "load", arguments.callee);
}
if(docReadyEvent && !Ext.isReady){
Ext.isReady = true;
docReadyEvent.fire();
docReadyEvent.listeners = [];
}
};
function initDocReady(){
docReadyEvent || (docReadyEvent = new Ext.util.Event());
if (DETECT_NATIVE) {
DOC.addEventListener(DOMCONTENTLOADED, fireDocReady, false);
}
if (Ext.isIE){
if(!checkReadyState()){
checkReadyState.bindIE = true;
DOC.attachEvent('onreadystatechange', checkReadyState);
}
}else if(Ext.isOpera ){
(DOC.readyState == COMPLETE && checkStyleSheets()) ||
DOC.addEventListener(DOMCONTENTLOADED, OperaDOMContentLoaded, false);
}else if (Ext.isWebKit){
checkReadyState();
}
E.on(WINDOW, "load", fireDocReady);
};
function createTargeted(h, o){
return function(){
var args = Ext.toArray(arguments);
if(o.target == Ext.EventObject.setEvent(args[0]).target){
h.apply(this, args);
}
};
};
function createBuffered(h, o, task){
return function(e){
task.delay(o.buffer, h, null, [new Ext.EventObjectImpl(e)]);
};
};
function createSingle(h, el, ename, fn, scope){
return function(e){
Ext.EventManager.removeListener(el, ename, fn, scope);
h(e);
};
};
function createDelayed(h, o, fn){
return function(e){
var task = new Ext.util.DelayedTask(h);
if(!fn.tasks) {
fn.tasks = [];
}
fn.tasks.push(task);
task.delay(o.delay || 10, h, null, [new Ext.EventObjectImpl(e)]);
};
};
function listen(element, ename, opt, fn, scope){
var o = (!opt || typeof opt == "boolean") ? {} : opt,
el = Ext.getDom(element), task;
fn = fn || o.fn;
scope = scope || o.scope;
if(!el){
throw "Error listening for \"" + ename + '\". Element "' + element + '" doesn\'t exist.';
}
function h(e){
if(!Ext){
return;
}
e = Ext.EventObject.setEvent(e);
var t;
if (o.delegate) {
if(!(t = e.getTarget(o.delegate, el))){
return;
}
} else {
t = e.target;
}
if (o.stopEvent) {
e.stopEvent();
}
if (o.preventDefault) {
e.preventDefault();
}
if (o.stopPropagation) {
e.stopPropagation();
}
if (o.normalized) {
e = e.browserEvent;
}
fn.call(scope || el, e, t, o);
};
if(o.target){
h = createTargeted(h, o);
}
if(o.delay){
h = createDelayed(h, o, fn);
}
if(o.single){
h = createSingle(h, el, ename, fn, scope);
}
if(o.buffer){
task = new Ext.util.DelayedTask(h);
h = createBuffered(h, o, task);
}
addListener(el, ename, fn, task, h, scope);
return h;
};
var pub = {
addListener : function(element, eventName, fn, scope, options){
if(typeof eventName == 'object'){
var o = eventName, e, val;
for(e in o){
val = o[e];
if(!propRe.test(e)){
if(Ext.isFunction(val)){
listen(element, e, o, val, o.scope);
}else{
listen(element, e, val);
}
}
}
} else {
listen(element, eventName, options, fn, scope);
}
},
removeListener : function(el, eventName, fn, scope){
el = Ext.getDom(el);
var id = getId(el),
f = el && (Ext.elCache[id].events)[eventName] || [],
wrap, i, l, k, len, fnc;
for (i = 0, len = f.length; i < len; i++) {
if (Ext.isArray(fnc = f[i]) && fnc[0] == fn && (!scope || fnc[2] == scope)) {
if(fnc[4]) {
fnc[4].cancel();
}
k = fn.tasks && fn.tasks.length;
if(k) {
while(k--) {
fn.tasks[k].cancel();
}
delete fn.tasks;
}
wrap = fnc[1];
E.un(el, eventName, E.extAdapter ? fnc[3] : wrap);
if(wrap && el.addEventListener && eventName == "mousewheel"){
el.removeEventListener("DOMMouseScroll", wrap, false);
}
if(wrap && el == DOC && eventName == "mousedown"){
Ext.EventManager.stoppedMouseDownEvent.removeListener(wrap);
}
f.splice(i, 1);
if (f.length === 0) {
delete Ext.elCache[id].events[eventName];
}
for (k in Ext.elCache[id].events) {
return false;
}
Ext.elCache[id].events = {};
return false;
}
}
},
removeAll : function(el){
el = Ext.getDom(el);
var id = getId(el),
ec = Ext.elCache[id] || {},
es = ec.events || {},
f, i, len, ename, fn, k, wrap;
for(ename in es){
if(es.hasOwnProperty(ename)){
f = es[ename];
for (i = 0, len = f.length; i < len; i++) {
fn = f[i];
if(fn[4]) {
fn[4].cancel();
}
if(fn[0].tasks && (k = fn[0].tasks.length)) {
while(k--) {
fn[0].tasks[k].cancel();
}
delete fn.tasks;
}
wrap = fn[1];
E.un(el, ename, E.extAdapter ? fn[3] : wrap);
if(el.addEventListener && wrap && ename == "mousewheel"){
el.removeEventListener("DOMMouseScroll", wrap, false);
}
if(wrap && el == DOC && ename == "mousedown"){
Ext.EventManager.stoppedMouseDownEvent.removeListener(wrap);
}
}
}
}
if (Ext.elCache[id]) {
Ext.elCache[id].events = {};
}
},
getListeners : function(el, eventName) {
el = Ext.getDom(el);
var id = getId(el),
ec = Ext.elCache[id] || {},
es = ec.events || {},
results = [];
if (es && es[eventName]) {
return es[eventName];
} else {
return null;
}
},
purgeElement : function(el, recurse, eventName) {
el = Ext.getDom(el);
var id = getId(el),
ec = Ext.elCache[id] || {},
es = ec.events || {},
i, f, len;
if (eventName) {
if (es && es.hasOwnProperty(eventName)) {
f = es[eventName];
for (i = 0, len = f.length; i < len; i++) {
Ext.EventManager.removeListener(el, eventName, f[i][0]);
}
}
} else {
Ext.EventManager.removeAll(el);
}
if (recurse && el && el.childNodes) {
for (i = 0, len = el.childNodes.length; i < len; i++) {
Ext.EventManager.purgeElement(el.childNodes[i], recurse, eventName);
}
}
},
_unload : function() {
var el;
for (el in Ext.elCache) {
Ext.EventManager.removeAll(el);
}
delete Ext.elCache;
delete Ext.Element._flyweights;
var c,
conn,
tid,
ajax = Ext.lib.Ajax;
(typeof ajax.conn == 'object') ? conn = ajax.conn : conn = {};
for (tid in conn) {
c = conn[tid];
if (c) {
ajax.abort({conn: c, tId: tid});
}
}
},
onDocumentReady : function(fn, scope, options){
if(Ext.isReady){
docReadyEvent || (docReadyEvent = new Ext.util.Event());
docReadyEvent.addListener(fn, scope, options);
docReadyEvent.fire();
docReadyEvent.listeners = [];
}else{
if(!docReadyEvent){
initDocReady();
}
options = options || {};
options.delay = options.delay || 1;
docReadyEvent.addListener(fn, scope, options);
}
},
fireDocReady : fireDocReady
};
pub.on = pub.addListener;
pub.un = pub.removeListener;
pub.stoppedMouseDownEvent = new Ext.util.Event();
return pub;
}();
Ext.onReady = Ext.EventManager.onDocumentReady;
(function(){
var initExtCss = function(){
var bd = document.body || document.getElementsByTagName('body')[0];
if(!bd){ return false; }
var cls = [' ',
Ext.isIE ? "ext-ie " + (Ext.isIE6 ? 'ext-ie6' : (Ext.isIE7 ? 'ext-ie7' : 'ext-ie8'))
: Ext.isGecko ? "ext-gecko " + (Ext.isGecko2 ? 'ext-gecko2' : 'ext-gecko3')
: Ext.isOpera ? "ext-opera"
: Ext.isWebKit ? "ext-webkit" : ""];
if(Ext.isSafari){
cls.push("ext-safari " + (Ext.isSafari2 ? 'ext-safari2' : (Ext.isSafari3 ? 'ext-safari3' : 'ext-safari4')));
}else if(Ext.isChrome){
cls.push("ext-chrome");
}
if(Ext.isMac){
cls.push("ext-mac");
}
if(Ext.isLinux){
cls.push("ext-linux");
}
if(Ext.isStrict || Ext.isBorderBox){
var p = bd.parentNode;
if(p){
p.className += Ext.isStrict ? ' ext-strict' : ' ext-border-box';
}
}
bd.className += cls.join(' ');
return true;
}
if(!initExtCss()){
Ext.onReady(initExtCss);
}
})();
Ext.EventObject = function(){
var E = Ext.lib.Event,
safariKeys = {
3 : 13,
63234 : 37,
63235 : 39,
63232 : 38,
63233 : 40,
63276 : 33,
63277 : 34,
63272 : 46,
63273 : 36,
63275 : 35
},
btnMap = Ext.isIE ? {1:0,4:1,2:2} :
(Ext.isWebKit ? {1:0,2:1,3:2} : {0:0,1:1,2:2});
Ext.EventObjectImpl = function(e){
if(e){
this.setEvent(e.browserEvent || e);
}
};
Ext.EventObjectImpl.prototype = {
setEvent : function(e){
var me = this;
if(e == me || (e && e.browserEvent)){
return e;
}
me.browserEvent = e;
if(e){
me.button = e.button ? btnMap[e.button] : (e.which ? e.which - 1 : -1);
if(e.type == 'click' && me.button == -1){
me.button = 0;
}
me.type = e.type;
me.shiftKey = e.shiftKey;
me.ctrlKey = e.ctrlKey || e.metaKey || false;
me.altKey = e.altKey;
me.keyCode = e.keyCode;
me.charCode = e.charCode;
me.target = E.getTarget(e);
me.xy = E.getXY(e);
}else{
me.button = -1;
me.shiftKey = false;
me.ctrlKey = false;
me.altKey = false;
me.keyCode = 0;
me.charCode = 0;
me.target = null;
me.xy = [0, 0];
}
return me;
},
stopEvent : function(){
var me = this;
if(me.browserEvent){
if(me.browserEvent.type == 'mousedown'){
Ext.EventManager.stoppedMouseDownEvent.fire(me);
}
E.stopEvent(me.browserEvent);
}
},
preventDefault : function(){
if(this.browserEvent){
E.preventDefault(this.browserEvent);
}
},
stopPropagation : function(){
var me = this;
if(me.browserEvent){
if(me.browserEvent.type == 'mousedown'){
Ext.EventManager.stoppedMouseDownEvent.fire(me);
}
E.stopPropagation(me.browserEvent);
}
},
getCharCode : function(){
return this.charCode || this.keyCode;
},
getKey : function(){
return this.normalizeKey(this.keyCode || this.charCode)
},
normalizeKey: function(k){
return Ext.isSafari ? (safariKeys[k] || k) : k;
},
getPageX : function(){
return this.xy[0];
},
getPageY : function(){
return this.xy[1];
},
getXY : function(){
return this.xy;
},
getTarget : function(selector, maxDepth, returnEl){
return selector ? Ext.fly(this.target).findParent(selector, maxDepth, returnEl) : (returnEl ? Ext.get(this.target) : this.target);
},
getRelatedTarget : function(){
return this.browserEvent ? E.getRelatedTarget(this.browserEvent) : null;
},
getWheelDelta : function(){
var e = this.browserEvent;
var delta = 0;
if(e.wheelDelta){
delta = e.wheelDelta/120;
}else if(e.detail){
delta = -e.detail/3;
}
return delta;
},
within : function(el, related, allowEl){
if(el){
var t = this[related ? "getRelatedTarget" : "getTarget"]();
return t && ((allowEl ? (t == Ext.getDom(el)) : false) || Ext.fly(el).contains(t));
}
return false;
}
};
return new Ext.EventObjectImpl();
}();
Ext.apply(Ext.EventManager, function(){
var resizeEvent,
resizeTask,
textEvent,
textSize,
D = Ext.lib.Dom,
propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/,
curWidth = 0,
curHeight = 0,
useKeydown = Ext.isWebKit ?
Ext.num(navigator.userAgent.match(/AppleWebKit\/(\d+)/)[1]) >= 525 :
!((Ext.isGecko && !Ext.isWindows) || Ext.isOpera);
return {
doResizeEvent: function(){
var h = D.getViewHeight(),
w = D.getViewWidth();
if(curHeight != h || curWidth != w){
resizeEvent.fire(curWidth = w, curHeight = h);
}
},
onWindowResize : function(fn, scope, options){
if(!resizeEvent){
resizeEvent = new Ext.util.Event();
resizeTask = new Ext.util.DelayedTask(this.doResizeEvent);
Ext.EventManager.on(window, "resize", this.fireWindowResize, this);
}
resizeEvent.addListener(fn, scope, options);
},
fireWindowResize : function(){
if(resizeEvent){
resizeTask.delay(100);
}
},
onTextResize : function(fn, scope, options){
if(!textEvent){
textEvent = new Ext.util.Event();
var textEl = new Ext.Element(document.createElement('div'));
textEl.dom.className = 'x-text-resize';
textEl.dom.innerHTML = 'X';
textEl.appendTo(document.body);
textSize = textEl.dom.offsetHeight;
setInterval(function(){
if(textEl.dom.offsetHeight != textSize){
textEvent.fire(textSize, textSize = textEl.dom.offsetHeight);
}
}, this.textResizeInterval);
}
textEvent.addListener(fn, scope, options);
},
removeResizeListener : function(fn, scope){
if(resizeEvent){
resizeEvent.removeListener(fn, scope);
}
},
fireResize : function(){
if(resizeEvent){
resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
}
},
textResizeInterval : 50,
ieDeferSrc : false,
useKeydown: useKeydown
};
}());
Ext.EventManager.on = Ext.EventManager.addListener;
Ext.apply(Ext.EventObjectImpl.prototype, {
BACKSPACE: 8,
TAB: 9,
NUM_CENTER: 12,
ENTER: 13,
RETURN: 13,
SHIFT: 16,
CTRL: 17,
CONTROL : 17,
ALT: 18,
PAUSE: 19,
CAPS_LOCK: 20,
ESC: 27,
SPACE: 32,
PAGE_UP: 33,
PAGEUP : 33,
PAGE_DOWN: 34,
PAGEDOWN : 34,
END: 35,
HOME: 36,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40,
PRINT_SCREEN: 44,
INSERT: 45,
DELETE: 46,
ZERO: 48,
ONE: 49,
TWO: 50,
THREE: 51,
FOUR: 52,
FIVE: 53,
SIX: 54,
SEVEN: 55,
EIGHT: 56,
NINE: 57,
A: 65,
B: 66,
C: 67,
D: 68,
E: 69,
F: 70,
G: 71,
H: 72,
I: 73,
J: 74,
K: 75,
L: 76,
M: 77,
N: 78,
O: 79,
P: 80,
Q: 81,
R: 82,
S: 83,
T: 84,
U: 85,
V: 86,
W: 87,
X: 88,
Y: 89,
Z: 90,
CONTEXT_MENU: 93,
NUM_ZERO: 96,
NUM_ONE: 97,
NUM_TWO: 98,
NUM_THREE: 99,
NUM_FOUR: 100,
NUM_FIVE: 101,
NUM_SIX: 102,
NUM_SEVEN: 103,
NUM_EIGHT: 104,
NUM_NINE: 105,
NUM_MULTIPLY: 106,
NUM_PLUS: 107,
NUM_MINUS: 109,
NUM_PERIOD: 110,
NUM_DIVISION: 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,
isNavKeyPress : function(){
var me = this,
k = this.normalizeKey(me.keyCode);
return (k >= 33 && k <= 40) ||
k == me.RETURN ||
k == me.TAB ||
k == me.ESC;
},
isSpecialKey : function(){
var k = this.normalizeKey(this.keyCode);
return (this.type == 'keypress' && this.ctrlKey) ||
this.isNavKeyPress() ||
(k == this.BACKSPACE) ||
(k >= 16 && k <= 20) ||
(k >= 44 && k <= 46);
},
getPoint : function(){
return new Ext.lib.Point(this.xy[0], this.xy[1]);
},
hasModifier : function(){
return ((this.ctrlKey || this.altKey) || this.shiftKey);
}
});
(function(){
var DOC = document;
Ext.Element = function(element, forceNew){
var dom = typeof element == "string" ?
DOC.getElementById(element) : element,
id;
if(!dom) return null;
id = dom.id;
if(!forceNew && id && Ext.elCache[id]){
return Ext.elCache[id].el;
}
this.dom = dom;
this.id = id || Ext.id(dom);
};
var D = Ext.lib.Dom,
DH = Ext.DomHelper,
E = Ext.lib.Event,
A = Ext.lib.Anim,
El = Ext.Element,
EC = Ext.elCache;
El.prototype = {
set : function(o, useSet){
var el = this.dom,
attr,
val,
useSet = (useSet !== false) && !!el.setAttribute;
for(attr in o){
if (o.hasOwnProperty(attr)) {
val = o[attr];
if (attr == 'style') {
DH.applyStyles(el, val);
} else if (attr == 'cls') {
el.className = val;
} else if (useSet) {
el.setAttribute(attr, val);
} else {
el[attr] = val;
}
}
}
return this;
},
defaultUnit : "px",
is : function(simpleSelector){
return Ext.DomQuery.is(this.dom, simpleSelector);
},
focus : function(defer, dom) {
var me = this,
dom = dom || me.dom;
try{
if(Number(defer)){
me.focus.defer(defer, null, [null, dom]);
}else{
dom.focus();
}
}catch(e){}
return me;
},
blur : function() {
try{
this.dom.blur();
}catch(e){}
return this;
},
getValue : function(asNumber){
var val = this.dom.value;
return asNumber ? parseInt(val, 10) : val;
},
addListener : function(eventName, fn, scope, options){
Ext.EventManager.on(this.dom, eventName, fn, scope || this, options);
return this;
},
removeListener : function(eventName, fn, scope){
Ext.EventManager.removeListener(this.dom, eventName, fn, scope || this);
return this;
},
removeAllListeners : function(){
Ext.EventManager.removeAll(this.dom);
return this;
},
purgeAllListeners : function() {
Ext.EventManager.purgeElement(this, true);
return this;
},
addUnits : function(size){
if(size === "" || size == "auto" || size === undefined){
size = size || '';
} else if(!isNaN(size) || !unitPattern.test(size)){
size = size + (this.defaultUnit || 'px');
}
return size;
},
load : function(url, params, cb){
Ext.Ajax.request(Ext.apply({
params: params,
url: url.url || url,
callback: cb,
el: this.dom,
indicatorText: url.indicatorText || ''
}, Ext.isObject(url) ? url : {}));
return this;
},
isBorderBox : function(){
return noBoxAdjust[(this.dom.tagName || "").toLowerCase()] || Ext.isBorderBox;
},
remove : function(){
var me = this,
dom = me.dom;
if (dom) {
delete me.dom;
Ext.removeNode(dom);
}
},
hover : function(overFn, outFn, scope, options){
var me = this;
me.on('mouseenter', overFn, scope || me.dom, options);
me.on('mouseleave', outFn, scope || me.dom, options);
return me;
},
contains : function(el){
return !el ? false : Ext.lib.Dom.isAncestor(this.dom, el.dom ? el.dom : el);
},
getAttributeNS : function(ns, name){
return this.getAttribute(name, ns);
},
getAttribute : Ext.isIE ? function(name, ns){
var d = this.dom,
type = typeof d[ns + ":" + name];
if(['undefined', 'unknown'].indexOf(type) == -1){
return d[ns + ":" + name];
}
return d[name];
} : function(name, ns){
var d = this.dom;
return d.getAttributeNS(ns, name) || d.getAttribute(ns + ":" + name) || d.getAttribute(name) || d[name];
},
update : function(html) {
if (this.dom) {
this.dom.innerHTML = html;
}
return this;
}
};
var ep = El.prototype;
El.addMethods = function(o){
Ext.apply(ep, o);
};
ep.on = ep.addListener;
ep.un = ep.removeListener;
ep.autoBoxAdjust = true;
var unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i,
docEl;
El.get = function(el){
var ex,
elm,
id;
if(!el){ return null; }
if (typeof el == "string") {
if (!(elm = DOC.getElementById(el))) {
return null;
}
if (EC[el] && EC[el].el) {
ex = EC[el].el;
ex.dom = elm;
} else {
ex = El.addToCache(new El(elm));
}
return ex;
} else if (el.tagName) {
if(!(id = el.id)){
id = Ext.id(el);
}
if (EC[id] && EC[id].el) {
ex = EC[id].el;
ex.dom = el;
} else {
ex = El.addToCache(new El(el));
}
return ex;
} else if (el instanceof El) {
if(el != docEl){
if (Ext.isIE && (el.id == undefined || el.id == '')) {
el.dom = el.dom;
} else {
el.dom = DOC.getElementById(el.id) || el.dom;
}
}
return el;
} else if(el.isComposite) {
return el;
} else if(Ext.isArray(el)) {
return El.select(el);
} else if(el == DOC) {
if(!docEl){
var f = function(){};
f.prototype = El.prototype;
docEl = new f();
docEl.dom = DOC;
}
return docEl;
}
return null;
};
El.addToCache = function(el, id){
id = id || el.id;
EC[id] = {
el: el,
data: {},
events: {}
};
return el;
};
El.data = function(el, key, value){
el = El.get(el);
if (!el) {
return null;
}
var c = EC[el.id].data;
if(arguments.length == 2){
return c[key];
}else{
return (c[key] = value);
}
};
function garbageCollect(){
if(!Ext.enableGarbageCollector){
clearInterval(El.collectorThreadId);
} else {
var eid,
el,
d,
o;
for(eid in EC){
o = EC[eid];
if(o.skipGC){
continue;
}
el = o.el;
d = el.dom;
if(!d || !d.parentNode || (!d.offsetParent && !DOC.getElementById(eid))){
if(Ext.enableListenerCollection){
Ext.EventManager.removeAll(d);
}
delete EC[eid];
}
}
if (Ext.isIE) {
var t = {};
for (eid in EC) {
t[eid] = EC[eid];
}
EC = Ext.elCache = t;
}
}
}
El.collectorThreadId = setInterval(garbageCollect, 30000);
var flyFn = function(){};
flyFn.prototype = El.prototype;
El.Flyweight = function(dom){
this.dom = dom;
};
El.Flyweight.prototype = new flyFn();
El.Flyweight.prototype.isFlyweight = true;
El._flyweights = {};
El.fly = function(el, named){
var ret = null;
named = named || '_global';
if (el = Ext.getDom(el)) {
(El._flyweights[named] = El._flyweights[named] || new El.Flyweight()).dom = el;
ret = El._flyweights[named];
}
return ret;
};
Ext.get = El.get;
Ext.fly = El.fly;
var noBoxAdjust = Ext.isStrict ? {
select:1
} : {
input:1, select:1, textarea:1
};
if(Ext.isIE || Ext.isGecko){
noBoxAdjust['button'] = 1;
}
})();
Ext.Element.addMethods({
swallowEvent : function(eventName, preventDefault){
var me = this;
function fn(e){
e.stopPropagation();
if(preventDefault){
e.preventDefault();
}
}
if(Ext.isArray(eventName)){
Ext.each(eventName, function(e) {
me.on(e, fn);
});
return me;
}
me.on(eventName, fn);
return me;
},
relayEvent : function(eventName, observable){
this.on(eventName, function(e){
observable.fireEvent(eventName, e);
});
},
clean : function(forceReclean){
var me = this,
dom = me.dom,
n = dom.firstChild,
ni = -1;
if(Ext.Element.data(dom, 'isCleaned') && forceReclean !== true){
return me;
}
while(n){
var nx = n.nextSibling;
if(n.nodeType == 3 && !/\S/.test(n.nodeValue)){
dom.removeChild(n);
}else{
n.nodeIndex = ++ni;
}
n = nx;
}
Ext.Element.data(dom, 'isCleaned', true);
return me;
},
load : function(){
var um = this.getUpdater();
um.update.apply(um, arguments);
return this;
},
getUpdater : function(){
return this.updateManager || (this.updateManager = new Ext.Updater(this));
},
update : function(html, loadScripts, callback){
if (!this.dom) {
return this;
}
html = html || "";
if(loadScripts !== true){
this.dom.innerHTML = html;
if(typeof callback == 'function'){
callback();
}
return this;
}
var id = Ext.id(),
dom = this.dom;
html += '';
Ext.lib.Event.onAvailable(id, function(){
var DOC = document,
hd = DOC.getElementsByTagName("head")[0],
re = /(?: