X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/6e39d509471fe9b4e2660e0d1631b350d0c66f40..0494b8d9b9bb03ab6c22b34dae81261e3cd7e3e6:/ext-all-debug.js diff --git a/ext-all-debug.js b/ext-all-debug.js index 1b11a0e9..00231c85 100644 --- a/ext-all-debug.js +++ b/ext-all-debug.js @@ -1,14 +1,332 @@ -/* - * Ext JS Library 3.1.0 - * Copyright(c) 2006-2009 Ext JS, LLC - * licensing@extjs.com - * http://www.extjs.com/license - */ + +(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, + 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(), + args = Array.prototype.slice.call(arguments, 0); + if(!l.tasks) { + l.tasks = []; + } + l.tasks.push(task); + task.delay(o.delay || 10, function(){ + l.tasks.remove(task); + h.apply(scope, args); + }, scope); + }; +}; + +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.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', @@ -34,10 +352,9 @@ Ext.DomHelper = function(){ attr, val, key, - keyVal, cn; - if(Ext.isString(o)){ + if(typeof o == "string"){ b = o; } else if (Ext.isArray(o)) { for (var i=0; i < o.length; i++) { @@ -47,19 +364,20 @@ Ext.DomHelper = function(){ }; } else { b += '<' + (o.tag = o.tag || 'div'); - Ext.iterate(o, function(attr, val){ - if(!/tag|children|cn|html$/i.test(attr)){ - if (Ext.isObject(val)) { + for (attr in o) { + val = o[attr]; + if(!confRe.test(attr)){ + if (typeof val == "object") { b += ' ' + attr + '="'; - Ext.iterate(val, function(key, keyVal){ - b += key + ':' + keyVal + ';'; - }); + for (key in val) { + b += key + ':' + val[key] + ';'; + }; b += '"'; }else{ b += ' ' + ({cls : 'class', htmlFor : 'for'}[attr] || attr) + '="' + val + '"'; } } - }); + }; if (emptyTags.test(o.tag)) { b += '/>'; @@ -105,7 +423,7 @@ Ext.DomHelper = function(){ tempTableEl = tempTableEl || document.createElement('div'); if(tag == 'td' && (where == afterbegin || where == beforeend) || - !/td|tr|tbody/i.test(tag) && (where == beforebegin || where == afterend)) { + !tableElRe.test(tag) && (where == beforebegin || where == afterend)) { return; } before = where == beforebegin ? el : @@ -134,24 +452,23 @@ Ext.DomHelper = function(){ markup : function(o){ return createHtml(o); }, - + applyStyles : function(el, styles){ - if(styles){ - var i = 0, - len, - style; + if (styles) { + var matches; el = Ext.fly(el); - if(Ext.isFunction(styles)){ + if (typeof styles == "function") { styles = styles.call(); } - if(Ext.isString(styles)){ - styles = styles.trim().split(/\s*(?::|;)\s*/); - for(len = styles.length; i < len;){ - el.setStyle(styles[i++], styles[i++]); + if (typeof styles == "string") { + + cssRe.lastIndex = 0; + while ((matches = cssRe.exec(styles))) { + el.setStyle(matches[1], matches[2]); } - }else if (Ext.isObject(styles)){ + } else if (typeof styles == "object") { el.setStyle(styles); } } @@ -185,7 +502,7 @@ Ext.DomHelper = function(){ } } else { range = el.ownerDocument.createRange(); - setStart = 'setStart' + (/end/i.test(where) ? 'After' : 'Before'); + setStart = 'setStart' + (endRe.test(where) ? 'After' : 'Before'); if (hash[where]) { range[setStart](el); frag = range.createContextualFragment(html); @@ -241,128 +558,24 @@ Ext.DomHelper = function(){ }; return pub; }(); -Ext.apply(Ext.DomHelper, -function(){ - var pub, - afterbegin = 'afterbegin', - afterend = 'afterend', - beforebegin = 'beforebegin', - beforeend = 'beforeend'; - - - 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(); - Ext.each(o, function(v) { - createDom(v, el); - }); - } else if (Ext.isString(o)) { - el = doc.createTextNode(o); - } else { - el = doc.createElement( o.tag || 'div' ); - useSet = !!el.setAttribute; - Ext.iterate(o, function(attr, val){ - if(!/tag|children|cn|html|style/.test(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 = []; + a = arguments, + buf = [], + v; if (Ext.isArray(html)) { html = html.join(""); } else if (a.length > 1) { - Ext.each(a, function(v) { - if (Ext.isObject(v)) { + 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(''); } @@ -380,18 +593,18 @@ Ext.Template.prototype = { applyTemplate : function(values){ - var me = this; + var me = this; return me.compiled ? - me.compiled(values) : - me.html.replace(me.re, function(m, name){ - return values[name] !== undefined ? values[name] : ""; - }); - }, + me.compiled(values) : + me.html.replace(me.re, function(m, name){ + return values[name] !== undefined ? values[name] : ""; + }); + }, set : function(html, compile){ - var me = this; + var me = this; me.html = html; me.compiled = null; return compile ? me.compile() : me; @@ -400,13 +613,13 @@ Ext.Template.prototype = { compile : function(){ var me = this, - sep = Ext.isGecko ? "+" : ","; + sep = Ext.isGecko ? "+" : ","; - function fn(m, name){ - name = "values['" + name + "']"; - return "'"+ sep + '(' + name + " == undefined ? '' : " + name + ')' + sep + "'"; + 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('');};")); @@ -454,95 +667,7 @@ 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, - - - 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) { - - - - var re = /^\s*['"](.*)["']\s*$/; - 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); - }, - - - 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+"'"; - } - - - if(Ext.isGecko){ - body = "this.compiled = function(values){ return '" + - me.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn) + - "';};"; - }else{ - body = ["this.compiled = function(values){ return ['"]; - body.push(me.html.replace(/\\/g, '\\\\').replace(/(\r\n|\n)/g, '\\n').replace(/'/g, "\\'").replace(this.re, fn)); - body.push("'].join('');};"); - body = body.join(''); - } - eval(body); - return me; - }, - - - call : function(fnName, value, allValues){ - return this[fnName](value, allValues); - } -}); -Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate; Ext.DomQuery = function(){ var cache = {}, @@ -556,18 +681,20 @@ Ext.DomQuery = function(){ nthRe = /(\d*)n\+?(\d*)/, nthRe2 = /\D/, - - - isIE = window.ActiveXObject ? true : false, - key = 30803; - - - eval("var batch = 30803;"); + + isIE = window.ActiveXObject ? true : false, + key = 30803; + + + + eval("var batch = 30803;"); - function child(p, index){ + + + function child(parent, index){ var i = 0, - n = p.firstChild; + n = parent.firstChild; while(n){ if(n.nodeType == 1){ if(++i == index){ @@ -577,53 +704,65 @@ Ext.DomQuery = function(){ n = n.nextSibling; } return null; - }; + } - function next(n){ + + 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(d){ - var n = d.firstChild, ni = -1, - nx; - while(n){ - nx = n.nextSibling; - if(n.nodeType == 3 && !nonSpace.test(n.nodeValue)){ - d.removeChild(n); - }else{ - n.nodeIndex = ++ni; - } - n = nx; - } - return this; - }; - - function byClassName(c, a, v){ - if(!v){ - return c; + + + 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 r = [], ri = -1, cn; - for(var i = 0, ci; ci = c[i]; i++){ - if((' '+ci.className+' ').indexOf(v) != -1){ - r[++ri] = ci; + var result = [], ri = -1; + for(var i = 0, ci; ci = nodeSet[i]; i++){ + if((' '+ci.className+' ').indexOf(cls) != -1){ + result[++ri] = ci; } } - return r; + 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; } @@ -634,15 +773,23 @@ Ext.DomQuery = function(){ }; + + + + 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); @@ -650,7 +797,9 @@ Ext.DomQuery = function(){ result[++ri] = ci; } } - }else if(mode == "/" || mode == ">"){ + + + } else if(mode == "/" || mode == ">"){ var utag = tagName.toUpperCase(); for(var i = 0, ni, cn; ni = ns[i]; i++){ cn = ni.childNodes; @@ -660,6 +809,8 @@ Ext.DomQuery = function(){ } } } + + }else if(mode == "+"){ var utag = tagName.toUpperCase(); for(var i = 0, n; n = ns[i]; i++){ @@ -668,6 +819,8 @@ Ext.DomQuery = function(){ result[++ri] = n; } } + + }else if(mode == "~"){ var utag = tagName.toUpperCase(); for(var i = 0, n; n = ns[i]; i++){ @@ -679,7 +832,7 @@ Ext.DomQuery = function(){ } } return result; - }; + } function concat(a, b){ if(b.slice){ @@ -698,69 +851,87 @@ Ext.DomQuery = function(){ if(!tagName){ return cs; } - var r = [], ri = -1; + var result = [], ri = -1; tagName = tagName.toLowerCase(); for(var i = 0, ci; ci = cs[i]; i++){ - if(ci.nodeType == 1 && ci.tagName.toLowerCase()==tagName){ - r[++ri] = ci; + if(ci.nodeType == 1 && ci.tagName.toLowerCase() == tagName){ + result[++ri] = ci; } } - return r; - }; + return result; + } - function byId(cs, attr, id){ + function byId(cs, id){ if(cs.tagName || cs == document){ cs = [cs]; } if(!id){ return cs; } - var r = [], ri = -1; - for(var i = 0,ci; ci = cs[i]; i++){ + var result = [], ri = -1; + for(var i = 0, ci; ci = cs[i]; i++){ if(ci && ci.id == id){ - r[++ri] = ci; - return r; + result[++ri] = ci; + return result; } } - return r; - }; + return result; + } + + function byAttribute(cs, attr, value, op, custom){ - var r = [], - ri = -1, - st = custom=="{", - f = Ext.DomQuery.operators[op]; + var result = [], + ri = -1, + useGetStyle = custom == "{", + fn = Ext.DomQuery.operators[op], + a, + xml, + hasXml; + for(var i = 0, ci; ci = cs[i]; i++){ + if(ci.nodeType != 1){ continue; } - var a; - if(st){ - a = Ext.DomQuery.getStyle(ci, attr); + + if(!hasXml){ + xml = Ext.DomQuery.isXml(ci); + hasXml = true; } - 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); + + + if(!xml){ + 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((f && f(a, value)) || (!f && a)){ - r[++ri] = ci; + if((fn && fn(a, value)) || (!fn && a)){ + result[++ri] = ci; } } - return r; - }; + return result; + } function byPseudo(cs, name, value){ return Ext.DomQuery.pseudos[name](cs, value); - }; + } function nodupIEXml(cs){ var d = ++key, - r; + r; cs[0].setAttribute("_nodup", d); r = [cs[0]]; for(var i = 1, len = cs.length; i < len; i++){ @@ -811,7 +982,7 @@ Ext.DomQuery = function(){ function quickDiffIEXml(c1, c2){ var d = ++key, - r = []; + r = []; for(var i = 0, len = c1.length; i < len; i++){ c1[i].setAttribute("_qdiff", d); } @@ -853,7 +1024,7 @@ Ext.DomQuery = function(){ return d.getElementById(id); } ns = getNodes(ns, mode, "*"); - return byId(ns, null, id); + return byId(ns, id); } return { @@ -864,104 +1035,135 @@ Ext.DomQuery = function(){ compile : function(path, type){ type = type || "select"; + var fn = ["var f = function(root){\n var mode; ++batch; var n = root || document;\n"], - q = path, mode, lq, - tk = Ext.DomQuery.matchers, - tklen = tk.length, - mm, + mode, + lastPath, + matchers = Ext.DomQuery.matchers, + matchersLn = matchers.length, + modeMatch, - lmode = q.match(modeRe); + lmode = path.match(modeRe); if(lmode && lmode[1]){ fn[fn.length] = 'mode="'+lmode[1].replace(trimRe, "")+'";'; - q = q.replace(lmode[1], ""); + path = path.replace(lmode[1], ""); } + while(path.substr(0, 1)=="/"){ path = path.substr(1); } - while(q && lq != q){ - lq = q; - var tm = q.match(tagTokenRe); + while(path && lastPath != path){ + lastPath = path; + var tokenMatch = path.match(tagTokenRe); if(type == "select"){ - if(tm){ - if(tm[1] == "#"){ - fn[fn.length] = 'n = quickId(n, mode, root, "'+tm[2]+'");'; + if(tokenMatch){ + + if(tokenMatch[1] == "#"){ + fn[fn.length] = 'n = quickId(n, mode, root, "'+tokenMatch[2]+'");'; }else{ - fn[fn.length] = 'n = getNodes(n, mode, "'+tm[2]+'");'; + fn[fn.length] = 'n = getNodes(n, mode, "'+tokenMatch[2]+'");'; } - q = q.replace(tm[0], ""); - }else if(q.substr(0, 1) != '@'){ + path = path.replace(tokenMatch[0], ""); + }else if(path.substr(0, 1) != '@'){ fn[fn.length] = 'n = getNodes(n, mode, "*");'; } + }else{ - if(tm){ - if(tm[1] == "#"){ - fn[fn.length] = 'n = byId(n, null, "'+tm[2]+'");'; + if(tokenMatch){ + if(tokenMatch[1] == "#"){ + fn[fn.length] = 'n = byId(n, "'+tokenMatch[2]+'");'; }else{ - fn[fn.length] = 'n = byTag(n, "'+tm[2]+'");'; + fn[fn.length] = 'n = byTag(n, "'+tokenMatch[2]+'");'; } - q = q.replace(tm[0], ""); + path = path.replace(tokenMatch[0], ""); } } - while(!(mm = q.match(modeRe))){ + while(!(modeMatch = path.match(modeRe))){ var matched = false; - for(var j = 0; j < tklen; j++){ - var t = tk[j]; - var m = q.match(t.re); + 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]; - }); - q = q.replace(m[0], ""); + return m[i]; + }); + path = path.replace(m[0], ""); matched = true; break; } } if(!matched){ - throw 'Error parsing selector, parsing failed at "' + q + '"'; + throw 'Error parsing selector, parsing failed at "' + path + '"'; } } - if(mm[1]){ - fn[fn.length] = 'mode="'+mm[1].replace(trimRe, "")+'";'; - q = q.replace(mm[1], ""); + 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; }, - select : function(path, root, type){ - if(!root || root == document){ - root = document; - } + 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 p = paths[i].replace(trimRe, ""); - if(!cache[p]){ - cache[p] = Ext.DomQuery.compile(p); - if(!cache[p]){ - throw p + " is not a valid selector"; + + + 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[p](root); + 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){ @@ -976,7 +1178,11 @@ Ext.DomQuery = function(){ } 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); @@ -1012,7 +1218,7 @@ Ext.DomQuery = function(){ matchers : [{ re: /^\.([\w-]+)/, - select: 'n = byClassName(n, null, " {1} ");' + select: 'n = byClassName(n, " {1} ");' }, { re: /^\:([\w-]+)(?:\(((?:[^\s>\/]*|.*?))\))?/, select: 'n = byPseudo(n, "{1}", "{2}");' @@ -1021,7 +1227,7 @@ Ext.DomQuery = function(){ select: 'n = byAttribute(n, "{2}", "{4}", "{3}", "{1}");' }, { re: /^#([\w-]+)/, - select: 'n = byId(n, null, "{1}");' + select: 'n = byId(n, "{1}");' },{ re: /^@([\w-]+)/, select: 'return {firstChild:{nodeValue:attrValue(n, "{1}")}};' @@ -1269,8030 +1475,9886 @@ Ext.util.DelayedTask = function(fn, scope, args){ id = null; } }; -};(function(){ +}; +(function(){ +var DOC = document; -var EXTUTIL = Ext.util, - TOARRAY = Ext.toArray, - EACH = Ext.each, - ISOBJECT = Ext.isObject, - TRUE = true, - FALSE = false; +Ext.Element = function(element, forceNew){ + var dom = typeof element == "string" ? + DOC.getElementById(element) : element, + id; -EXTUTIL.Observable = function(){ - - var me = this, e = me.events; - if(me.listeners){ - me.on(me.listeners); - delete me.listeners; + if(!dom) return null; + + id = dom.id; + + if(!forceNew && id && Ext.elCache[id]){ + return Ext.elCache[id].el; } - me.events = e || {}; -}; -EXTUTIL.Observable.prototype = { - filterOptRe : /^(?:scope|delay|buffer|single)$/, + this.dom = dom; - fireEvent : function(){ - var a = TOARRAY(arguments), - ename = a[0].toLowerCase(), - me = this, - ret = TRUE, - ce = me.events[ename], - q, - c; - if (me.eventsSuspended === TRUE) { - if (q = me.eventQueue) { - q.push(a); - } - } - else if(ISOBJECT(ce) && ce.bubble){ - if(ce.fire.apply(ce, a.slice(1)) === FALSE) { - return FALSE; - } - c = me.getBubbleTarget && me.getBubbleTarget(); - if(c && c.enableBubble) { - if(!c.events[ename] || !Ext.isObject(c.events[ename]) || !c.events[ename].bubble) { - c.enableBubble(ename); + this.id = id || Ext.id(dom); +}; + +var DH = Ext.DomHelper, + 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 c.fireEvent.apply(c, a); - } - } - else { - if (ISOBJECT(ce)) { - a.shift(); - ret = ce.fire.apply(ce, a); } } - return ret; + return this; }, + - addListener : function(eventName, fn, scope, o){ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + defaultUnit : "px", + + + is : function(simpleSelector){ + return Ext.DomQuery.is(this.dom, simpleSelector); + }, + + + focus : function(defer, dom) { var me = this, - e, - oe, - isF, - ce; - if (ISOBJECT(eventName)) { - 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 (Ext.isBoolean(ce)) { - me.events[eventName] = ce = new EXTUTIL.Event(me, eventName); + dom = dom || me.dom; + try{ + if(Number(defer)){ + me.focus.defer(defer, null, [null, dom]); + }else{ + dom.focus(); } - ce.addListener(fn, scope, ISOBJECT(o) ? o : {}); - } + }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){ - var ce = this.events[eventName.toLowerCase()]; - if (ISOBJECT(ce)) { - ce.removeListener(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; }, - purgeListeners : function(){ - var events = this.events, - evt, - key; - for(key in events){ - evt = events[key]; - if(ISOBJECT(evt)){ - evt.clearListeners(); - } + 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 Ext.isBorderBox || Ext.isForcedBorderBox || noBoxAdjust[(this.dom.tagName || "").toLowerCase()]; + }, + + + remove : function(){ + var me = this, + dom = me.dom; + + if (dom) { + delete me.dom; + Ext.removeNode(dom); } }, - addEvents : function(o){ + hover : function(overFn, outFn, scope, options){ var me = this; - me.events = me.events || {}; - if (Ext.isString(o)) { - var a = arguments, - i = a.length; - while(i--) { - me.events[a[i]] = me.events[a[i]] || TRUE; - } - } else { - Ext.applyIf(me.events, o); - } + me.on('mouseenter', overFn, scope || me.dom, options); + me.on('mouseleave', outFn, scope || me.dom, options); + return me; }, - hasListener : function(eventName){ - var e = this.events[eventName]; - return ISOBJECT(e) && e.listeners.length > 0; + contains : function(el){ + return !el ? false : Ext.lib.Dom.isAncestor(this.dom, el.dom ? el.dom : el); }, - suspendEvents : function(queueSuspended){ - this.eventsSuspended = TRUE; - if(queueSuspended && !this.eventQueue){ - this.eventQueue = []; + 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]; }, - resumeEvents : function(){ - var me = this, - queued = me.eventQueue || []; - me.eventsSuspended = FALSE; - delete me.eventQueue; - EACH(queued, function(e) { - me.fireEvent.apply(me, e); - }); + update : function(html) { + if (this.dom) { + this.dom.innerHTML = html; + } + return this; } }; -var OBSERVABLE = EXTUTIL.Observable.prototype; +var ep = El.prototype; -OBSERVABLE.on = OBSERVABLE.addListener; +El.addMethods = function(o){ + Ext.apply(ep, o); +}; -OBSERVABLE.un = OBSERVABLE.removeListener; +ep.on = ep.addListener; -EXTUTIL.Observable.releaseCapture = function(o){ - o.fireEvent = OBSERVABLE.fireEvent; -}; -function createTargeted(h, o, scope){ - return function(){ - if(o.target == arguments[0]){ - h.apply(scope, TOARRAY(arguments)); - } - }; -}; +ep.un = ep.removeListener; -function createBuffered(h, o, fn, scope){ - fn.task = new EXTUTIL.DelayedTask(); - return function(){ - fn.task.delay(o.buffer, h, scope, TOARRAY(arguments)); - }; -} -function createSingle(h, e, fn, scope){ - return function(){ - e.removeListener(fn, scope); - return h.apply(scope, arguments); - }; -} +ep.autoBoxAdjust = true; -function createDelayed(h, o, fn, scope){ - return function(){ - var task = new EXTUTIL.DelayedTask(); - if(!fn.tasks) { - fn.tasks = []; - } - fn.tasks.push(task); - task.delay(o.delay || 10, h, scope, TOARRAY(arguments)); - }; -}; -EXTUTIL.Event = function(obj, name){ - this.name = name; - this.obj = obj; - this.listeners = []; -}; +var unitPattern = /\d+(px|em|%|en|ex|pt|in|cm|mm|pc)$/i, + docEl; -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); + + +El.get = function(el){ + var ex, + elm, + id; + if(!el){ return null; } + if (typeof el == "string") { + if (!(elm = DOC.getElementById(el))) { + return null; } - if(o.delay){ - h = createDelayed(h, o, fn, scope); + if (EC[el] && EC[el].el) { + ex = EC[el].el; + ex.dom = elm; + } else { + ex = El.addToCache(new El(elm)); } - if(o.single){ - h = createSingle(h, this, fn, scope); + return ex; + } else if (el.tagName) { + if(!(id = el.id)){ + id = Ext.id(el); } - if(o.buffer){ - h = createBuffered(h, o, fn, scope); + if (EC[id] && EC[id].el) { + ex = EC[id].el; + ex.dom = el; + } else { + ex = El.addToCache(new El(el)); } - l.fireFn = h; - return l; - }, + return ex; + } else if (el instanceof El) { + if(el != docEl){ + + - findListener : function(fn, scope){ - var list = this.listeners, - i = list.length, - l, - s; - while(i--) { - l = list[i]; - if(l) { - s = l.scope; - if(l.fn == fn && (s == scope || s == this.obj)){ - return i; - } + + if (Ext.isIE && (el.id == undefined || el.id == '')) { + el.dom = el.dom; + } else { + el.dom = DOC.getElementById(el.id) || el.dom; } } - return -1; - }, + 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; +}; - isListening : function(fn, scope){ - return this.findListener(fn, scope) != -1; - }, +El.addToCache = function(el, id){ + id = id || el.id; + EC[id] = { + el: el, + data: {}, + events: {} + }; + return el; +}; - 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); + +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; } - l = me.listeners[index].fn; + el = o.el; + d = el.dom; - if(l.task) { - l.task.cancel(); - delete l.task; - } - k = l.tasks && l.tasks.length; - if(k) { - while(k--) { - l.tasks[k].cancel(); + + + + + + + + + + + + + + + + if(!d || !d.parentNode || (!d.offsetParent && !DOC.getElementById(eid))){ + if(Ext.enableListenerCollection){ + Ext.EventManager.removeAll(d); } - delete l.tasks; + delete EC[eid]; } - 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); + + if (Ext.isIE) { + var t = {}; + for (eid in EC) { + t[eid] = EC[eid]; + } + EC = Ext.elCache = t; } - }, + } +} +El.collectorThreadId = setInterval(garbageCollect, 30000); - fire : function(){ - var me = this, - args = TOARRAY(arguments), - listeners = me.listeners, - len = listeners.length, - i = 0, - l; +var flyFn = function(){}; +flyFn.prototype = El.prototype; - if(len > 0){ - me.firing = TRUE; - 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; + +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.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 (!Ext.isEmpty(v = fn.apply(scope || obj, args))) { - if (Ext.isObject(v)) { - returnValue = !Ext.isEmpty(v.returnValue) ? v.returnValue : v; - cancel = !!v.cancel; - } - else - if (v === false) { - cancel = true; - } - else { - returnValue = v; - } - } - }; +Ext.get = El.get; - this[method] = function(){ - var args = Ext.toArray(arguments); - returnValue = v = undefined; - cancel = false; - Ext.each(e.before, function(b){ - makeCall(b.fn, b.scope, args); - if (cancel) { - return returnValue; - } - }); +Ext.fly = El.fly; - if (!Ext.isEmpty(v = e.originalFn.apply(obj, args))) { - returnValue = v; - } - Ext.each(e.after, function(a){ - makeCall(a.fn, a.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 - }); - }, +var noBoxAdjust = Ext.isStrict ? { + select:1 +} : { + input:1, select:1, textarea:1 +}; +if(Ext.isIE || Ext.isGecko){ + noBoxAdjust['button'] = 1; +} - - afterMethod : function(method, fn, scope){ - getMethodEvent.call(this, method).after.push({ - fn: fn, - scope: scope - }); - }, +})(); - removeMethodListener: function(method, fn, scope){ - var e = getMethodEvent.call(this, method), found = false; - Ext.each(e.before, function(b, i, arr){ - if (b.fn == fn && b.scope == scope) { - arr.splice(i, 1); - found = true; - return false; - } - }); - if (!found) { - Ext.each(e.after, function(a, i, arr){ - if (a.fn == fn && a.scope == scope) { - arr.splice(i, 1); - return false; - } - }); +Ext.Element.addMethods(function(){ + var PARENTNODE = 'parentNode', + NEXTSIBLING = 'nextSibling', + PREVIOUSSIBLING = 'previousSibling', + DQ = Ext.DomQuery, + GET = Ext.get; + + return { + + findParent : function(simpleSelector, maxDepth, returnEl){ + var p = this.dom, + b = document.body, + depth = 0, + stopEl; + if(Ext.isGecko && Object.prototype.toString.call(p) == '[object XULElement]') { + return null; + } + maxDepth = maxDepth || 50; + if (isNaN(maxDepth)) { + stopEl = Ext.getDom(maxDepth); + maxDepth = Number.MAX_VALUE; + } + while(p && p.nodeType == 1 && depth < maxDepth && p != b && p != stopEl){ + if(DQ.is(p, simpleSelector)){ + return returnEl ? GET(p) : p; + } + depth++; + p = p.parentNode; + } + return null; + }, + + + findParentNode : function(simpleSelector, maxDepth, returnEl){ + var p = Ext.fly(this.dom.parentNode, '_internal'); + return p ? p.findParent(simpleSelector, maxDepth, returnEl) : null; + }, + + + up : function(simpleSelector, maxDepth){ + return this.findParentNode(simpleSelector, maxDepth, true); + }, + + + select : function(selector){ + return Ext.Element.select(selector, this.dom); + }, + + + query : function(selector){ + return DQ.select(selector, this.dom); + }, + + + child : function(selector, returnDom){ + var n = DQ.selectNode(selector, this.dom); + return returnDom ? n : GET(n); + }, + + + down : function(selector, returnDom){ + var n = DQ.selectNode(" > " + selector, this.dom); + return returnDom ? n : GET(n); + }, + + + parent : function(selector, returnDom){ + return this.matchNode(PARENTNODE, PARENTNODE, selector, returnDom); + }, + + + next : function(selector, returnDom){ + return this.matchNode(NEXTSIBLING, NEXTSIBLING, selector, returnDom); + }, + + + prev : function(selector, returnDom){ + return this.matchNode(PREVIOUSSIBLING, PREVIOUSSIBLING, selector, returnDom); + }, + + + + first : function(selector, returnDom){ + return this.matchNode(NEXTSIBLING, 'firstChild', selector, returnDom); + }, + + + last : function(selector, returnDom){ + return this.matchNode(PREVIOUSSIBLING, 'lastChild', selector, returnDom); + }, + + matchNode : function(dir, start, selector, returnDom){ + var n = this.dom[start]; + while(n){ + if(n.nodeType == 1 && (!selector || DQ.is(n, selector))){ + return !returnDom ? GET(n) : n; + } + n = n[dir]; + } + return null; + } + }; +}()); +Ext.Element.addMethods( +function() { + var GETDOM = Ext.getDom, + GET = Ext.get, + DH = Ext.DomHelper; + + return { + + appendChild: function(el){ + return GET(el).appendTo(this); + }, + + + appendTo: function(el){ + GETDOM(el).appendChild(this.dom); + return this; + }, + + + insertBefore: function(el){ + (el = GETDOM(el)).parentNode.insertBefore(this.dom, el); + return this; + }, + + + insertAfter: function(el){ + (el = GETDOM(el)).parentNode.insertBefore(this.dom, el.nextSibling); + return this; + }, + + + insertFirst: function(el, returnDom){ + el = el || {}; + if(el.nodeType || el.dom || typeof el == 'string'){ + el = GETDOM(el); + this.dom.insertBefore(el, this.dom.firstChild); + return !returnDom ? GET(el) : el; + }else{ + return this.createChild(el, this.dom.firstChild, returnDom); } }, + + + replace: function(el){ + el = GET(el); + this.insertBefore(el); + el.remove(); + return this; + }, + + + replaceWith: function(el){ + var me = this; + + if(el.nodeType || el.dom || typeof el == 'string'){ + el = GETDOM(el); + me.dom.parentNode.insertBefore(el, me.dom); + }else{ + el = DH.insertBefore(me.dom, el); + } + + delete Ext.elCache[me.id]; + Ext.removeNode(me.dom); + me.id = Ext.id(me.dom = el); + Ext.Element.addToCache(me.isFlyweight ? new Ext.Element(me.dom) : me); + return me; + }, + + + createChild: function(config, insertBefore, returnDom){ + config = config || {tag:'div'}; + return insertBefore ? + DH.insertBefore(insertBefore, config, returnDom !== true) : + DH[!this.dom.firstChild ? 'overwrite' : 'append'](this.dom, config, returnDom !== true); + }, + + + wrap: function(config, returnDom){ + var newEl = DH.insertBefore(this.dom, config || {tag: "div"}, !returnDom); + newEl.dom ? newEl.dom.appendChild(this.dom) : newEl.appendChild(this.dom); + return newEl; + }, + + + insertHtml : function(where, html, returnEl){ + var el = DH.insertHtml(where, this.dom, html); + return returnEl ? Ext.get(el) : el; + } + }; +}()); +Ext.Element.addMethods(function(){ + + var supports = Ext.supports, + propCache = {}, + camelRe = /(-[a-z])/gi, + view = document.defaultView, + opacityRe = /alpha\(opacity=(.*)\)/i, + trimRe = /^\s+|\s+$/g, + EL = Ext.Element, + spacesRe = /\s+/, + wordsRe = /\w/g, + PADDING = "padding", + MARGIN = "margin", + BORDER = "border", + LEFT = "-left", + RIGHT = "-right", + TOP = "-top", + BOTTOM = "-bottom", + WIDTH = "-width", + MATH = Math, + HIDDEN = 'hidden', + ISCLIPPED = 'isClipped', + OVERFLOW = 'overflow', + OVERFLOWX = 'overflow-x', + OVERFLOWY = 'overflow-y', + ORIGINALCLIP = 'originalClip', + + borders = {l: BORDER + LEFT + WIDTH, r: BORDER + RIGHT + WIDTH, t: BORDER + TOP + WIDTH, b: BORDER + BOTTOM + WIDTH}, + paddings = {l: PADDING + LEFT, r: PADDING + RIGHT, t: PADDING + TOP, b: PADDING + BOTTOM}, + margins = {l: MARGIN + LEFT, r: MARGIN + RIGHT, t: MARGIN + TOP, b: MARGIN + BOTTOM}, + data = Ext.Element.data; + + + + function camelFn(m, a) { + return a.charAt(1).toUpperCase(); + } + + function chkCache(prop) { + return propCache[prop] || (propCache[prop] = prop == 'float' ? (supports.cssFloat ? 'cssFloat' : 'styleFloat') : prop.replace(camelRe, camelFn)); + } + return { - relayEvents : function(o, events){ + adjustWidth : function(width) { var me = this; - function createHandler(ename){ - return function(){ - return me.fireEvent.apply(me, [ename].concat(Ext.toArray(arguments))); - }; + var isNum = (typeof width == "number"); + if(isNum && me.autoBoxAdjust && !me.isBorderBox()){ + width -= (me.getBorderWidth("lr") + me.getPadding("lr")); } - Ext.each(events, function(ename){ - me.events[ename] = me.events[ename] || true; - o.on(ename, createHandler(ename), me); - }); + return (isNum && width < 0) ? 0 : width; }, - enableBubble : function(events){ + adjustHeight : function(height) { var me = this; - if(!Ext.isEmpty(events)){ - events = Ext.isArray(events) ? events : Ext.toArray(arguments); - Ext.each(events, function(ename){ - ename = ename.toLowerCase(); - var ce = me.events[ename] || true; - if (Ext.isBoolean(ce)) { - ce = new Ext.util.Event(me, ename); - me.events[ename] = ce; - } - ce.bubble = true; - }); + var isNum = (typeof height == "number"); + if(isNum && me.autoBoxAdjust && !me.isBorderBox()){ + height -= (me.getBorderWidth("tb") + me.getPadding("tb")); } - } - }; -}()); - - - -Ext.util.Observable.capture = function(o, fn, scope){ - o.fireEvent = o.fireEvent.createInterceptor(fn, scope); -}; - + return (isNum && height < 0) ? 0 : height; + }, -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(Ext.isObject(listeners)){ - c.on(listeners); - } - return c; - } -}; -Ext.EventManager = function(){ - var docReadyEvent, - docReadyProcId, - docReadyState = false, - E = Ext.lib.Event, - D = Ext.lib.Dom, - DOC = document, - WINDOW = window, - IEDEFERED = "ie-deferred-loader", - DOMCONTENTLOADED = "DOMContentLoaded", - 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; + addClass : function(className){ + var me = this, + i, + len, + v, + cls = []; + + if (!Ext.isArray(className)) { + if (typeof className == 'string' && !this.hasClass(className)) { + me.dom.className += " " + className; } - }else{ - id = Ext.id(el); } - if(!Ext.elCache[id]){ - Ext.Element.addToCache(new Ext.Element(el), id); - if(skip){ - Ext.elCache[id].skipGC = true; + else { + for (i = 0, len = className.length; i < len; i++) { + v = className[i]; + if (typeof v == 'string' && (' ' + me.dom.className + ' ').indexOf(' ' + v + ' ') == -1) { + cls.push(v); + } + } + if (cls.length) { + me.dom.className += " " + cls.join(" "); } } - } - return id; - }; - - - function addListener(el, ename, fn, 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]); + return me; + }, - - if(ename == "mousewheel" && el.addEventListener){ - var args = ["DOMMouseScroll", wrap, false]; - el.addEventListener.apply(el, args); - Ext.EventManager.addListener(WINDOW, 'unload', function(){ - el.removeEventListener.apply(el, args); - }); - } - if(ename == "mousedown" && el == document){ - Ext.EventManager.stoppedMouseDownEvent.addListener(wrap); - } - }; - - function fireDocReady(){ - if(!docReadyState){ - Ext.isReady = docReadyState = true; - if(docReadyProcId){ - clearInterval(docReadyProcId); - } - if(Ext.isGecko || Ext.isOpera) { - DOC.removeEventListener(DOMCONTENTLOADED, fireDocReady, false); + removeClass : function(className){ + var me = this, + i, + idx, + len, + cls, + elClasses; + if (!Ext.isArray(className)){ + className = [className]; } - if(Ext.isIE){ - var defer = DOC.getElementById(IEDEFERED); - if(defer){ - defer.onreadystatechange = null; - defer.parentNode.removeChild(defer); + if (me.dom && me.dom.className) { + elClasses = me.dom.className.replace(trimRe, '').split(spacesRe); + for (i = 0, len = className.length; i < len; i++) { + cls = className[i]; + if (typeof cls == 'string') { + cls = cls.replace(trimRe, ''); + idx = elClasses.indexOf(cls); + if (idx != -1) { + elClasses.splice(idx, 1); + } + } } + me.dom.className = elClasses.join(" "); } - if(docReadyEvent){ - docReadyEvent.fire(); - docReadyEvent.listeners = []; - } - } - }; - - function initDocReady(){ - var COMPLETE = "complete"; + return me; + }, - docReadyEvent = new Ext.util.Event(); - if (Ext.isGecko || Ext.isOpera) { - DOC.addEventListener(DOMCONTENTLOADED, fireDocReady, false); - } else if (Ext.isIE){ - DOC.write(""); - DOC.getElementById(IEDEFERED).onreadystatechange = function(){ - if(this.readyState == COMPLETE){ - fireDocReady(); + + radioClass : function(className){ + var cn = this.dom.parentNode.childNodes, + v, + i, + len; + className = Ext.isArray(className) ? className : [className]; + for (i = 0, len = cn.length; i < len; i++) { + v = cn[i]; + if (v && v.nodeType == 1) { + Ext.fly(v, '_internal').removeClass(className); } }; - } else if (Ext.isWebKit){ - docReadyProcId = setInterval(function(){ - if(DOC.readyState == COMPLETE) { - fireDocReady(); - } - }, 10); - } - - 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, fn){ - fn.task = new Ext.util.DelayedTask(h); - var w = function(e){ - - fn.task.delay(o.buffer, h, null, [new Ext.EventObjectImpl(e)]); - }; - return w; - }; - - 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 = !Ext.isObject(opt) ? {} : opt, - el = Ext.getDom(element); - - 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; - } + return this.addClass(className); + }, - 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){ - h = createBuffered(h, o, fn); - } + + toggleClass : function(className){ + return this.hasClass(className) ? this.removeClass(className) : this.addClass(className); + }, - addListener(el, ename, fn, h, scope); - return h; - }; + + hasClass : function(className){ + return className && (' '+this.dom.className+' ').indexOf(' '+className+' ') != -1; + }, - var pub = { - addListener : function(element, eventName, fn, scope, options){ - if(Ext.isObject(eventName)){ - 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); - } + replaceClass : function(oldClassName, newClassName){ + return this.removeClass(oldClassName).addClass(newClassName); + }, + + isStyle : function(style, val) { + return this.getStyle(style) == val; }, - 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, wf; + getStyle : function(){ + return view && view.getComputedStyle ? + function(prop){ + var el = this.dom, + v, + cs, + out, + display; - for (i = 0, len = f.length; i < len; i++) { - if (Ext.isArray(f[i]) && f[i][0] == fn && (!scope || f[i][2] == scope)) { - if(fn.task) { - fn.task.cancel(); - delete fn.task; - } - k = fn.tasks && fn.tasks.length; - if(k) { - while(k--) { - fn.tasks[k].cancel(); - } - delete fn.tasks; - } - wf = wrap = f[i][1]; - if (E.extAdapter) { - wf = f[i][3]; + if(el == document){ + return null; } - E.un(el, eventName, wf); - f.splice(i,1); - if (f.length === 0) { - delete Ext.elCache[id].events[eventName]; + prop = chkCache(prop); + out = (v = el.style[prop]) ? v : + (cs = view.getComputedStyle(el, "")) ? cs[prop] : null; + + + + if(prop == 'marginRight' && out != '0px' && !supports.correctRightMargin){ + display = el.style.display; + el.style.display = 'inline-block'; + out = view.getComputedStyle(el, '').marginRight; + el.style.display = display; } - for (k in Ext.elCache[id].events) { - return false; + + if(prop == 'backgroundColor' && out == 'rgba(0, 0, 0, 0)' && !supports.correctTransparentColor){ + out = 'transparent'; } - Ext.elCache[id].events = {}; - return false; - } - } - - - if(eventName == "mousewheel" && el.addEventListener && wrap){ - el.removeEventListener("DOMMouseScroll", wrap, false); - } - - if(eventName == "mousedown" && el == DOC && wrap){ - Ext.EventManager.stoppedMouseDownEvent.removeListener(wrap); - } - }, - - - removeAll : function(el){ - el = Ext.getDom(el); - var id = getId(el), - ec = Ext.elCache[id] || {}, - es = ec.events || {}, - f, i, len, ename, fn, k; + return out; + } : + function(prop){ + var el = this.dom, + m, + cs; - for(ename in es){ - if(es.hasOwnProperty(ename)){ - f = es[ename]; - for (i = 0, len = f.length; i < len; i++) { - fn = f[i][0]; - if(fn.task) { - fn.task.cancel(); - delete fn.task; - } - if(fn.tasks && (k = fn.tasks.length)) { - while(k--) { - fn.tasks[k].cancel(); + if(el == document) return null; + if (prop == 'opacity') { + if (el.style.filter.match) { + if(m = el.style.filter.match(opacityRe)){ + var fv = parseFloat(m[1]); + if(!isNaN(fv)){ + return fv ? fv / 100 : 0; + } } - delete fn.tasks; } - E.un(el, ename, E.extAdapter ? f[i][3] : f[i][1]); + return 1; } - } - } - if (Ext.elCache[id]) { - Ext.elCache[id].events = {}; - } - }, + prop = chkCache(prop); + return el.style[prop] || ((cs = el.currentStyle) ? cs[prop] : null); + }; + }(), - 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; - } - }, + + getColor : function(attr, defaultValue, prefix){ + var v = this.getStyle(attr), + color = (typeof prefix != 'undefined') ? prefix : '#', + h; - 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(!v || (/transparent|inherit/.test(v))) { + return defaultValue; } - if (recurse && el && el.childNodes) { - for (i = 0, len = el.childNodes.length; i < len; i++) { - Ext.EventManager.purgeElement(el.childNodes[i], recurse, eventName); - } + if(/^r/.test(v)){ + Ext.each(v.slice(4, v.length -1).split(','), function(s){ + h = parseInt(s, 10); + color += (h < 16 ? '0' : '') + h.toString(16); + }); + }else{ + v = v.replace('#', ''); + color += v.length == 3 ? v.replace(/^(\w)(\w)(\w)$/, '$1$1$2$2$3$3') : v; } + return(color.length > 5 ? color.toLowerCase() : defaultValue); }, - _unload : function() { - var el; - for (el in Ext.elCache) { - Ext.EventManager.removeAll(el); - } - }, - onDocumentReady : function(fn, scope, options){ - if(docReadyState){ - 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); + setStyle : function(prop, value){ + var tmp, style; + + if (typeof prop != 'object') { + tmp = {}; + tmp[prop] = value; + prop = tmp; } - } - }; - - 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'; + for (style in prop) { + value = prop[style]; + style == 'opacity' ? + this.setOpacity(value) : + this.dom.style[chkCache(style)] = value; } - } - 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 + return this; }, + - btnMap = Ext.isIE ? {1:0,4:1,2:2} : - (Ext.isWebKit ? {1:0,2:1,3:2} : {0:0,1:1,2:2}); + setOpacity : function(opacity, animate){ + var me = this, + s = me.dom.style; - Ext.EventObjectImpl = function(e){ - if(e){ - this.setEvent(e.browserEvent || e); - } - }; + if(!animate || !me.anim){ + if(Ext.isIE){ + var opac = opacity < 1 ? 'alpha(opacity=' + opacity * 100 + ')' : '', + val = s.filter.replace(opacityRe, '').replace(trimRe, ''); - 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; + s.zoom = 1; + s.filter = val + (val.length > 0 ? ' ' : '') + opac; + }else{ + s.opacity = opacity; } - 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]; + me.anim({opacity: {to: opacity}}, me.preanim(arguments, 1), null, .35, 'easeIn'); } return me; }, - stopEvent : function(){ - var me = this; - if(me.browserEvent){ - if(me.browserEvent.type == 'mousedown'){ - Ext.EventManager.stoppedMouseDownEvent.fire(me); + clearOpacity : function(){ + var style = this.dom.style; + if(Ext.isIE){ + if(!Ext.isEmpty(style.filter)){ + style.filter = style.filter.replace(opacityRe, '').replace(trimRe, ''); } - E.stopEvent(me.browserEvent); + }else{ + style.opacity = style['-moz-opacity'] = style['-khtml-opacity'] = ''; } + return this; }, - preventDefault : function(){ - if(this.browserEvent){ - E.preventDefault(this.browserEvent); - } - }, + getHeight : function(contentHeight){ + var me = this, + dom = me.dom, + hidden = Ext.isIE && me.isStyle('display', 'none'), + h = MATH.max(dom.offsetHeight, hidden ? 0 : dom.clientHeight) || 0; - - stopPropagation : function(){ - var me = this; - if(me.browserEvent){ - if(me.browserEvent.type == 'mousedown'){ - Ext.EventManager.stoppedMouseDownEvent.fire(me); - } - E.stopPropagation(me.browserEvent); - } + h = !contentHeight ? h : h - me.getBorderWidth("tb") - me.getPadding("tb"); + return h < 0 ? 0 : h; }, - getCharCode : function(){ - return this.charCode || this.keyCode; + getWidth : function(contentWidth){ + var me = this, + dom = me.dom, + hidden = Ext.isIE && me.isStyle('display', 'none'), + w = MATH.max(dom.offsetWidth, hidden ? 0 : dom.clientWidth) || 0; + w = !contentWidth ? w : w - me.getBorderWidth("lr") - me.getPadding("lr"); + return w < 0 ? 0 : w; }, - getKey : function(){ - return this.normalizeKey(this.keyCode || this.charCode) + setWidth : function(width, animate){ + var me = this; + width = me.adjustWidth(width); + !animate || !me.anim ? + me.dom.style.width = me.addUnits(width) : + me.anim({width : {to : width}}, me.preanim(arguments, 1)); + return me; }, - normalizeKey: function(k){ - return Ext.isSafari ? (safariKeys[k] || k) : k; + setHeight : function(height, animate){ + var me = this; + height = me.adjustHeight(height); + !animate || !me.anim ? + me.dom.style.height = me.addUnits(height) : + me.anim({height : {to : height}}, me.preanim(arguments, 1)); + return me; }, - getPageX : function(){ - return this.xy[0]; + getBorderWidth : function(side){ + return this.addStyles(side, borders); }, - getPageY : function(){ - return this.xy[1]; + getPadding : function(side){ + return this.addStyles(side, paddings); }, - getXY : function(){ - return this.xy; - }, + clip : function(){ + var me = this, + dom = me.dom; - - getTarget : function(selector, maxDepth, returnEl){ - return selector ? Ext.fly(this.target).findParent(selector, maxDepth, returnEl) : (returnEl ? Ext.get(this.target) : this.target); + if(!data(dom, ISCLIPPED)){ + data(dom, ISCLIPPED, true); + data(dom, ORIGINALCLIP, { + o: me.getStyle(OVERFLOW), + x: me.getStyle(OVERFLOWX), + y: me.getStyle(OVERFLOWY) + }); + me.setStyle(OVERFLOW, HIDDEN); + me.setStyle(OVERFLOWX, HIDDEN); + me.setStyle(OVERFLOWY, HIDDEN); + } + return me; }, - getRelatedTarget : function(){ - return this.browserEvent ? E.getRelatedTarget(this.browserEvent) : null; - }, + unclip : function(){ + var me = this, + dom = me.dom; - - getWheelDelta : function(){ - var e = this.browserEvent; - var delta = 0; - if(e.wheelDelta){ - delta = e.wheelDelta/120; - }else if(e.detail){ - delta = -e.detail/3; + if(data(dom, ISCLIPPED)){ + data(dom, ISCLIPPED, false); + var o = data(dom, ORIGINALCLIP); + if(o.o){ + me.setStyle(OVERFLOW, o.o); + } + if(o.x){ + me.setStyle(OVERFLOWX, o.x); + } + if(o.y){ + me.setStyle(OVERFLOWY, o.y); + } } - return delta; + return me; }, - 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)); + addStyles : function(sides, styles){ + var ttlSize = 0, + sidesArr = sides.match(wordsRe), + side, + size, + i, + len = sidesArr.length; + for (i = 0; i < len; i++) { + side = sidesArr[i]; + size = side && parseInt(this.getStyle(styles[side]), 10); + if (size) { + ttlSize += MATH.abs(size); + } } - return false; - } - }; - - return new Ext.EventObjectImpl(); -}(); - + return ttlSize; + }, -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){ - if((Ext.isIE||Ext.isAir) && resizeTask){ - resizeTask.delay(50); - }else{ - resizeEvent.fire(D.getViewWidth(), D.getViewHeight()); - } - } - }, - - - 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 <= 45); - }, - - getPoint : function(){ - return new Ext.lib.Point(this.xy[0], this.xy[1]); - }, + margins : margins + }; +}() +); - - 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; + LEFT = "left", + RIGHT = "right", + TOP = "top", + BOTTOM = "bottom", + POSITION = "position", + STATIC = "static", + RELATIVE = "relative", + AUTO = "auto", + ZINDEX = "z-index"; - 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; +Ext.Element.addMethods({ + + getX : function(){ + return D.getX(this.dom); }, - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - defaultUnit : "px", + getY : function(){ + return D.getY(this.dom); + }, - is : function(simpleSelector){ - return Ext.DomQuery.is(this.dom, simpleSelector); + getXY : function(){ + return D.getXY(this.dom); }, - 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; + getOffsetsTo : function(el){ + var o = this.getXY(), + e = Ext.fly(el, '_internal').getXY(); + return [o[0]-e[0],o[1]-e[1]]; }, - blur : function() { - try{ - this.dom.blur(); - }catch(e){} - return this; + setX : function(x, animate){ + return this.setXY([x, this.getY()], this.animTest(arguments, animate, 1)); }, - getValue : function(asNumber){ - var val = this.dom.value; - return asNumber ? parseInt(val, 10) : val; + setY : function(y, animate){ + return this.setXY([this.getX(), y], this.animTest(arguments, animate, 1)); }, - addListener : function(eventName, fn, scope, options){ - Ext.EventManager.on(this.dom, eventName, fn, scope || this, options); + setLeft : function(left){ + this.setStyle(LEFT, this.addUnits(left)); return this; }, - removeListener : function(eventName, fn, scope){ - Ext.EventManager.removeListener(this.dom, eventName, fn, scope || this); + setTop : function(top){ + this.setStyle(TOP, this.addUnits(top)); return this; }, - removeAllListeners : function(){ - Ext.EventManager.removeAll(this.dom); + setRight : function(right){ + this.setStyle(RIGHT, this.addUnits(right)); return this; }, - purgeAllListeners : function() { - Ext.EventManager.purgeElement(this, true); + setBottom : function(bottom){ + this.setStyle(BOTTOM, this.addUnits(bottom)); 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'); + setXY : function(pos, animate){ + var me = this; + if(!animate || !me.anim){ + D.setXY(me.dom, pos); + }else{ + me.anim({points: {to: pos}}, me.preanim(arguments, 1), 'motion'); } - return size; + return me; }, - 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; + setLocation : function(x, y, animate){ + return this.setXY([x, y], this.animTest(arguments, animate, 2)); }, - isBorderBox : function(){ - return noBoxAdjust[(this.dom.tagName || "").toLowerCase()] || Ext.isBorderBox; - }, - + moveTo : function(x, y, animate){ + return this.setXY([x, y], this.animTest(arguments, animate, 2)); + }, - remove : function(){ - var me = this, - dom = me.dom; - - if (dom) { - delete me.dom; - Ext.removeNode(dom); - } + + getLeft : function(local){ + return !local ? this.getX() : parseInt(this.getStyle(LEFT), 10) || 0; }, - 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; + getRight : function(local){ + var me = this; + return !local ? me.getX() + me.getWidth() : (me.getLeft(true) + me.getWidth()) || 0; }, - contains : function(el){ - return !el ? false : Ext.lib.Dom.isAncestor(this.dom, el.dom ? el.dom : el); + getTop : function(local) { + return !local ? this.getY() : parseInt(this.getStyle(TOP), 10) || 0; }, - getAttributeNS : function(ns, name){ - return this.getAttribute(name, ns); + getBottom : function(local){ + var me = this; + return !local ? me.getY() + me.getHeight() : (me.getTop(true) + me.getHeight()) || 0; }, - 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]; + position : function(pos, zIndex, x, y){ + var me = this; + + if(!pos && me.isStyle(POSITION, STATIC)){ + me.setStyle(POSITION, RELATIVE); + } else if(pos) { + me.setStyle(POSITION, pos); } - return d[name]; - } : function(name, ns){ - var d = this.dom; - return d.getAttributeNS(ns, name) || d.getAttribute(ns + ":" + name) || d.getAttribute(name) || d[name]; + if(zIndex){ + me.setStyle(ZINDEX, zIndex); + } + if(x || y) me.setXY([x || false, y || false]); }, - update : function(html) { - if (this.dom) { - this.dom.innerHTML = html; - } + clearPositioning : function(value){ + value = value || ''; + this.setStyle({ + left : value, + right : value, + top : value, + bottom : value, + "z-index" : "", + position : STATIC + }); 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)); + + getPositioning : function(){ + var l = this.getStyle(LEFT); + var t = this.getStyle(TOP); + return { + "position" : this.getStyle(POSITION), + "left" : l, + "right" : l ? "" : this.getStyle(RIGHT), + "top" : t, + "bottom" : t ? "" : this.getStyle(BOTTOM), + "z-index" : this.getStyle(ZINDEX) + }; + }, + + + setPositioning : function(pc){ + var me = this, + style = me.dom.style; + + me.setStyle(pc); + + if(pc.right == AUTO){ + style.right = ""; } - return ex; - } else if (el instanceof El) { - if(el != docEl){ - el.dom = DOC.getElementById(el.id) || el.dom; - + if(pc.bottom == AUTO){ + style.bottom = ""; } - 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; -}; - + return me; + }, + + + translatePoints : function(x, y){ + y = isNaN(x[1]) ? y : x[1]; + x = isNaN(x[0]) ? x : x[0]; + var me = this, + relative = me.isStyle(POSITION, RELATIVE), + o = me.getXY(), + l = parseInt(me.getStyle(LEFT), 10), + t = parseInt(me.getStyle(TOP), 10); + + l = !isNaN(l) ? l : (relative ? 0 : me.dom.offsetLeft); + t = !isNaN(t) ? t : (relative ? 0 : me.dom.offsetTop); -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); + return {left: (x - o[0] + l), top: (y - o[1] + t)}; + }, + + animTest : function(args, animate, i) { + return !!animate && this.preanim ? this.preanim(args, i) : false; } -}; - - +}); +})(); +Ext.Element.addMethods({ + + isScrollable : function(){ + var dom = this.dom; + return dom.scrollHeight > dom.clientHeight || dom.scrollWidth > dom.clientWidth; + }, + + scrollTo : function(side, value){ + this.dom["scroll" + (/top/i.test(side) ? "Top" : "Left")] = value; + return this; + }, -function garbageCollect(){ - if(!Ext.enableGarbageCollector){ - clearInterval(El.collectorThreadId); - } else { - var eid, - el, - d, - o; + + getScroll : function(){ + var d = this.dom, + doc = document, + body = doc.body, + docElement = doc.documentElement, + l, + t, + ret; - 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]; + if(d == doc || d == body){ + if(Ext.isIE && Ext.isStrict){ + l = docElement.scrollLeft; + t = docElement.scrollTop; + }else{ + l = window.pageXOffset; + t = window.pageYOffset; } - EC = Ext.elCache = t; + ret = {left: l || (body ? body.scrollLeft : 0), top: t || (body ? body.scrollTop : 0)}; + }else{ + ret = {left: d.scrollLeft, top: d.scrollTop}; } + return ret; } -} -El.collectorThreadId = setInterval(garbageCollect, 30000); +}); -var flyFn = function(){}; -flyFn.prototype = El.prototype; +Ext.Element.VISIBILITY = 1; +Ext.Element.DISPLAY = 2; -El.Flyweight = function(dom){ - this.dom = dom; -}; -El.Flyweight.prototype = new flyFn(); -El.Flyweight.prototype.isFlyweight = true; -El._flyweights = {}; +Ext.Element.OFFSETS = 3; -El.fly = function(el, named){ - var ret = null; - named = named || '_global'; +Ext.Element.ASCLASS = 4; - if (el = Ext.getDom(el)) { - (El._flyweights[named] = El._flyweights[named] || new El.Flyweight()).dom = el; - ret = El._flyweights[named]; - } - return ret; -}; +Ext.Element.visibilityCls = 'x-hide-nosize'; -Ext.get = El.get; +Ext.Element.addMethods(function(){ + var El = Ext.Element, + OPACITY = "opacity", + VISIBILITY = "visibility", + DISPLAY = "display", + HIDDEN = "hidden", + OFFSETS = "offsets", + ASCLASS = "asclass", + NONE = "none", + NOSIZE = 'nosize', + ORIGINALDISPLAY = 'originalDisplay', + VISMODE = 'visibilityMode', + ISVISIBLE = 'isVisible', + data = El.data, + getDisplay = function(dom){ + var d = data(dom, ORIGINALDISPLAY); + if(d === undefined){ + data(dom, ORIGINALDISPLAY, d = ''); + } + return d; + }, + getVisMode = function(dom){ + var m = data(dom, VISMODE); + if(m === undefined){ + data(dom, VISMODE, m = 1); + } + return m; + }; + return { + + originalDisplay : "", + visibilityMode : 1, -Ext.fly = El.fly; + + setVisibilityMode : function(visMode){ + data(this.dom, VISMODE, visMode); + return this; + }, + + animate : function(args, duration, onComplete, easing, animType){ + this.anim(args, {duration: duration, callback: onComplete, easing: easing}, animType); + return this; + }, -var noBoxAdjust = Ext.isStrict ? { - select:1 -} : { - input:1, select:1, textarea:1 -}; -if(Ext.isIE || Ext.isGecko){ - noBoxAdjust['button'] = 1; -} + + anim : function(args, opt, animType, defaultDur, defaultEase, cb){ + animType = animType || 'run'; + opt = opt || {}; + var me = this, + anim = Ext.lib.Anim[animType]( + me.dom, + args, + (opt.duration || defaultDur) || .35, + (opt.easing || defaultEase) || 'easeOut', + function(){ + if(cb) cb.call(me); + if(opt.callback) opt.callback.call(opt.scope || me, me, opt); + }, + me + ); + opt.anim = anim; + return anim; + }, + + preanim : function(a, i){ + return !a[i] ? false : (typeof a[i] == 'object' ? a[i]: {duration: a[i+1], callback: a[i+2], easing: a[i+3]}); + }, -Ext.EventManager.on(window, 'unload', function(){ - delete EC; - delete El._flyweights; -}); -})(); + + isVisible : function() { + var me = this, + dom = me.dom, + visible = data(dom, ISVISIBLE); -Ext.Element.addMethods({ - - swallowEvent : function(eventName, preventDefault){ - var me = this; - function fn(e){ - e.stopPropagation(); - if(preventDefault){ - e.preventDefault(); + if(typeof visible == 'boolean'){ + return visible; } - } - if(Ext.isArray(eventName)){ - Ext.each(eventName, function(e) { - me.on(e, fn); - }); - return me; - } - me.on(eventName, fn); - return me; - }, + + visible = !me.isStyle(VISIBILITY, HIDDEN) && + !me.isStyle(DISPLAY, NONE) && + !((getVisMode(dom) == El.ASCLASS) && me.hasClass(me.visibilityCls || El.visibilityCls)); - - relayEvent : function(eventName, observable){ - this.on(eventName, function(e){ - observable.fireEvent(eventName, e); - }); - }, + data(dom, ISVISIBLE, visible); + return visible; + }, - - clean : function(forceReclean){ - var me = this, - dom = me.dom, - n = dom.firstChild, - ni = -1; + + setVisible : function(visible, animate){ + var me = this, isDisplay, isVisibility, isOffsets, isNosize, + dom = me.dom, + visMode = getVisMode(dom); - 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; + + if (typeof animate == 'string'){ + switch (animate) { + case DISPLAY: + visMode = El.DISPLAY; + break; + case VISIBILITY: + visMode = El.VISIBILITY; + break; + case OFFSETS: + visMode = El.OFFSETS; + break; + case NOSIZE: + case ASCLASS: + visMode = El.ASCLASS; + break; + } + me.setVisibilityMode(visMode); + animate = false; } - 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 (!animate || !me.anim) { + if(visMode == El.ASCLASS ){ - if(loadScripts !== true){ - this.dom.innerHTML = html; - if(Ext.isFunction(callback)){ - callback(); - } - return this; - } + me[visible?'removeClass':'addClass'](me.visibilityCls || El.visibilityCls); - var id = Ext.id(), - dom = this.dom; + } else if (visMode == El.DISPLAY){ - html += ''; + return me.setDisplayed(visible); - Ext.lib.Event.onAvailable(id, function(){ - var DOC = document, - hd = DOC.getElementsByTagName("head")[0], - re = /(?:]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig, - srcRe = /\ssrc=([\'\"])(.*?)\1/i, - typeRe = /\stype=([\'\"])(.*?)\1/i, - match, - attrs, - srcMatch, - typeMatch, - el, - s; + } else if (visMode == El.OFFSETS){ - while((match = re.exec(html))){ - attrs = match[1]; - srcMatch = attrs ? attrs.match(srcRe) : false; - if(srcMatch && srcMatch[2]){ - s = DOC.createElement("script"); - s.src = srcMatch[2]; - typeMatch = attrs.match(typeRe); - if(typeMatch && typeMatch[2]){ - s.type = typeMatch[2]; - } - hd.appendChild(s); - }else if(match[2] && match[2].length > 0){ - if(window.execScript) { - window.execScript(match[2]); + if (!visible){ + me.hideModeStyles = { + position: me.getStyle('position'), + top: me.getStyle('top'), + left: me.getStyle('left') + }; + me.applyStyles({position: 'absolute', top: '-10000px', left: '-10000px'}); } else { - window.eval(match[2]); + me.applyStyles(me.hideModeStyles || {position: '', top: '', left: ''}); + delete me.hideModeStyles; } + + }else{ + me.fixDisplay(); + dom.style.visibility = visible ? "visible" : HIDDEN; } + }else{ + + if(visible){ + me.setOpacity(.01); + me.setVisible(true); + } + me.anim({opacity: { to: (visible?1:0) }}, + me.preanim(arguments, 1), + null, + .35, + 'easeIn', + function(){ + visible || me.setVisible(false).setOpacity(1); + }); } - el = DOC.getElementById(id); - if(el){Ext.removeNode(el);} - if(Ext.isFunction(callback)){ - callback(); - } - }); - dom.innerHTML = html.replace(/(?:)((\n|\r|.)*?)(?:<\/script>)/ig, ""); - return this; - }, - - - removeAllListeners : function(){ - this.removeAnchor(); - Ext.EventManager.removeAll(this.dom); - return this; - }, + data(dom, ISVISIBLE, visible); + return me; + }, - - createProxy : function(config, renderTo, matchBox){ - config = Ext.isObject(config) ? config : {tag : "div", cls: config}; - var me = this, - proxy = renderTo ? Ext.DomHelper.append(renderTo, config, true) : - Ext.DomHelper.insertBefore(me.dom, config, true); + + hasMetrics : function(){ + var dom = this.dom; + return this.isVisible() || (getVisMode(dom) == El.VISIBILITY); + }, - if(matchBox && me.setBox && me.getBox){ - proxy.setBox(me.getBox()); - } - return proxy; - } -}); + + toggle : function(animate){ + var me = this; + me.setVisible(!me.isVisible(), me.preanim(arguments, 0)); + return me; + }, -Ext.Element.prototype.getUpdateManager = Ext.Element.prototype.getUpdater; + + setDisplayed : function(value) { + if(typeof value == "boolean"){ + value = value ? getDisplay(this.dom) : NONE; + } + this.setStyle(DISPLAY, value); + return this; + }, -Ext.Element.addMethods({ - - getAnchorXY : function(anchor, local, s){ + fixDisplay : function(){ + var me = this; + if(me.isStyle(DISPLAY, NONE)){ + me.setStyle(VISIBILITY, HIDDEN); + me.setStyle(DISPLAY, getDisplay(this.dom)); + if(me.isStyle(DISPLAY, NONE)){ + me.setStyle(DISPLAY, "block"); + } + } + }, + - anchor = (anchor || "tl").toLowerCase(); - s = s || {}; + hide : function(animate){ + + if (typeof animate == 'string'){ + this.setVisible(false, animate); + return this; + } + this.setVisible(false, this.preanim(arguments, 0)); + return this; + }, + - var me = this, - vp = me.dom == document.body || me.dom == document, - w = s.width || vp ? Ext.lib.Dom.getViewWidth() : me.getWidth(), - h = s.height || vp ? Ext.lib.Dom.getViewHeight() : me.getHeight(), - xy, - r = Math.round, - o = me.getXY(), - scroll = me.getScroll(), - extraX = vp ? scroll.left : !local ? o[0] : 0, - extraY = vp ? scroll.top : !local ? o[1] : 0, - hash = { - c : [r(w * 0.5), r(h * 0.5)], - t : [r(w * 0.5), 0], - l : [0, r(h * 0.5)], - r : [w, r(h * 0.5)], - b : [r(w * 0.5), h], - tl : [0, 0], - bl : [0, h], - br : [w, h], - tr : [w, 0] - }; - - xy = hash[anchor]; - return [xy[0] + extraX, xy[1] + extraY]; - }, - - - anchorTo : function(el, alignment, offsets, animate, monitorScroll, callback){ - var me = this, - dom = me.dom, - scroll = !Ext.isEmpty(monitorScroll), - action = function(){ - Ext.fly(dom).alignTo(el, alignment, offsets, animate); - Ext.callback(callback, Ext.fly(dom)); - }, - anchor = this.getAnchor(); - - - this.removeAnchor(); - Ext.apply(anchor, { - fn: action, - scroll: scroll - }); - - Ext.EventManager.onWindowResize(action, null); - - if(scroll){ - Ext.EventManager.on(window, 'scroll', action, null, - {buffer: !isNaN(monitorScroll) ? monitorScroll : 50}); - } - action.call(me); - return me; - }, - - - removeAnchor : function(){ - var me = this, - anchor = this.getAnchor(); + show : function(animate){ - if(anchor && anchor.fn){ - Ext.EventManager.removeResizeListener(anchor.fn); - if(anchor.scroll){ - Ext.EventManager.un(window, 'scroll', anchor.fn); - } - delete anchor.fn; - } - return me; - }, - - - getAnchor : function(){ - var data = Ext.Element.data, - dom = this.dom; - if (!dom) { - return; + if (typeof animate == 'string'){ + this.setVisible(true, animate); + return this; } - var anchor = data(dom, '_anchor'); - - if(!anchor){ - anchor = data(dom, '_anchor', {}); + this.setVisible(true, this.preanim(arguments, 0)); + return this; } - return anchor; - }, - + }; +}());(function(){ - getAlignToXY : function(el, p, o){ - el = Ext.get(el); - - if(!el || !el.dom){ - throw "Element.alignToXY with an element that doesn't exist"; - } - - o = o || [0,0]; - p = (!p || p == "?" ? "tl-bl?" : (!/-/.test(p) && p !== "" ? "tl-" + p : p || "tl-bl")).toLowerCase(); - - var me = this, - d = me.dom, - a1, - a2, - x, - y, - - w, - h, - r, - dw = Ext.lib.Dom.getViewWidth() -10, - dh = Ext.lib.Dom.getViewHeight()-10, - p1y, - p1x, - p2y, - p2x, - swapY, - swapX, - doc = document, - docElement = doc.documentElement, - docBody = doc.body, - scrollX = (docElement.scrollLeft || docBody.scrollLeft || 0)+5, - scrollY = (docElement.scrollTop || docBody.scrollTop || 0)+5, - c = false, - p1 = "", - p2 = "", - m = p.match(/^([a-z]+)-([a-z]+)(\?)?$/); - - if(!m){ - throw "Element.alignTo with an invalid alignment " + p; - } + var NULL = null, + UNDEFINED = undefined, + TRUE = true, + FALSE = false, + SETX = "setX", + SETY = "setY", + SETXY = "setXY", + LEFT = "left", + BOTTOM = "bottom", + TOP = "top", + RIGHT = "right", + HEIGHT = "height", + WIDTH = "width", + POINTS = "points", + HIDDEN = "hidden", + ABSOLUTE = "absolute", + VISIBLE = "visible", + MOTION = "motion", + POSITION = "position", + EASEOUT = "easeOut", - p1 = m[1]; - p2 = m[2]; - c = !!m[3]; - + flyEl = new Ext.Element.Flyweight(), + queues = {}, + getObject = function(o){ + return o || {}; + }, + fly = function(dom){ + flyEl.dom = dom; + flyEl.id = Ext.id(dom); + return flyEl; + }, + getQueue = function(id){ + if(!queues[id]){ + queues[id] = []; + } + return queues[id]; + }, + setQueue = function(id, value){ + queues[id] = value; + }; - a1 = me.getAnchorXY(p1, true); - a2 = el.getAnchorXY(p2, false); - - x = a2[0] - a1[0] + o[0]; - y = a2[1] - a1[1] + o[1]; - if(c){ - w = me.getWidth(); - h = me.getHeight(); - r = el.getRegion(); - - - - p1y = p1.charAt(0); - p1x = p1.charAt(p1.length-1); - p2y = p2.charAt(0); - p2x = p2.charAt(p2.length-1); - swapY = ((p1y=="t" && p2y=="b") || (p1y=="b" && p2y=="t")); - swapX = ((p1x=="r" && p2x=="l") || (p1x=="l" && p2x=="r")); - +Ext.enableFx = TRUE; - if (x + w > dw + scrollX) { - x = swapX ? r.left-w : dw+scrollX-w; - } - if (x < scrollX) { - x = swapX ? r.right : scrollX; - } - if (y + h > dh + scrollY) { - y = swapY ? r.top-h : dh+scrollY-h; - } - if (y < scrollY){ - y = swapY ? r.bottom : scrollY; - } - } - return [x,y]; - }, +Ext.Fx = { - alignTo : function(element, position, offsets, animate){ - var me = this; - return me.setXY(me.getAlignToXY(element, position, offsets), - me.preanim && !!animate ? me.preanim(arguments, 3) : false); - }, - adjustForConstraints : function(xy, parent, offsets){ - return this.getConstrainToXY(parent || document, false, offsets, xy) || xy; + switchStatements : function(key, fn, argHash){ + return fn.apply(this, argHash[key]); }, - - getConstrainToXY : function(el, local, offsets, proposedXY){ - var os = {top:0, left:0, bottom:0, right: 0}; - - return function(el, local, offsets, proposedXY){ - el = Ext.get(el); - offsets = offsets ? Ext.applyIf(offsets, os) : os; - - var vw, vh, vx = 0, vy = 0; - if(el.dom == document.body || el.dom == document){ - vw =Ext.lib.Dom.getViewWidth(); - vh = Ext.lib.Dom.getViewHeight(); - }else{ - vw = el.dom.clientWidth; - vh = el.dom.clientHeight; - if(!local){ - var vxy = el.getXY(); - vx = vxy[0]; - vy = vxy[1]; - } - } - - var s = el.getScroll(); - - vx += offsets.left + s.left; - vy += offsets.top + s.top; - - vw -= offsets.right; - vh -= offsets.bottom; - - var vr = vx+vw; - var vb = vy+vh; - - var xy = proposedXY || (!local ? this.getXY() : [this.getLeft(true), this.getTop(true)]); - var x = xy[0], y = xy[1]; - var w = this.dom.offsetWidth, h = this.dom.offsetHeight; - + + slideIn : function(anchor, o){ + o = getObject(o); + var me = this, + dom = me.dom, + st = dom.style, + xy, + r, + b, + wrap, + after, + st, + args, + pt, + bw, + bh; - var moved = false; + anchor = anchor || "t"; + me.queueFx(o, function(){ + xy = fly(dom).getXY(); - if((x + w) > vr){ - x = vr - w; - moved = true; - } - if((y + h) > vb){ - y = vb - h; - moved = true; - } + fly(dom).fixDisplay(); - if(x < vx){ - x = vx; - moved = true; - } - if(y < vy){ - y = vy; - moved = true; + + r = fly(dom).getFxRestore(); + b = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: dom.offsetWidth, height: dom.offsetHeight}; + b.right = b.x + b.width; + b.bottom = b.y + b.height; + + + fly(dom).setWidth(b.width).setHeight(b.height); + + + wrap = fly(dom).fxWrap(r.pos, o, HIDDEN); + + st.visibility = VISIBLE; + st.position = ABSOLUTE; + + + function after(){ + fly(dom).fxUnwrap(wrap, r.pos, o); + st.width = r.width; + st.height = r.height; + fly(dom).afterFx(o); } - return moved ? [x, y] : false; - }; - }(), - - - - + + + pt = {to: [b.x, b.y]}; + bw = {to: b.width}; + bh = {to: b.height}; + + function argCalc(wrap, style, ww, wh, sXY, sXYval, s1, s2, w, h, p){ + var ret = {}; + fly(wrap).setWidth(ww).setHeight(wh); + if(fly(wrap)[sXY]){ + fly(wrap)[sXY](sXYval); + } + style[s1] = style[s2] = "0"; + if(w){ + ret.width = w; + } + if(h){ + ret.height = h; + } + if(p){ + ret.points = p; + } + return ret; + }; + args = fly(dom).switchStatements(anchor.toLowerCase(), argCalc, { + t : [wrap, st, b.width, 0, NULL, NULL, LEFT, BOTTOM, NULL, bh, NULL], + l : [wrap, st, 0, b.height, NULL, NULL, RIGHT, TOP, bw, NULL, NULL], + r : [wrap, st, b.width, b.height, SETX, b.right, LEFT, TOP, NULL, NULL, pt], + b : [wrap, st, b.width, b.height, SETY, b.bottom, LEFT, TOP, NULL, bh, pt], + tl : [wrap, st, 0, 0, NULL, NULL, RIGHT, BOTTOM, bw, bh, pt], + bl : [wrap, st, 0, 0, SETY, b.y + b.height, RIGHT, TOP, bw, bh, pt], + br : [wrap, st, 0, 0, SETXY, [b.right, b.bottom], LEFT, TOP, bw, bh, pt], + tr : [wrap, st, 0, 0, SETX, b.x + b.width, LEFT, BOTTOM, bw, bh, pt] + }); + + st.visibility = VISIBLE; + fly(wrap).show(); + arguments.callee.anim = fly(wrap).fxanim(args, + o, + MOTION, + .5, + EASEOUT, + after); + }); + return me; + }, + + + slideOut : function(anchor, o){ + o = getObject(o); + var me = this, + dom = me.dom, + st = dom.style, + xy = me.getXY(), + wrap, + r, + b, + a, + zero = {to: 0}; + + anchor = anchor || "t"; + me.queueFx(o, function(){ + + + r = fly(dom).getFxRestore(); + b = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: dom.offsetWidth, height: dom.offsetHeight}; + b.right = b.x + b.width; + b.bottom = b.y + b.height; + + + fly(dom).setWidth(b.width).setHeight(b.height); + + wrap = fly(dom).fxWrap(r.pos, o, VISIBLE); + + st.visibility = VISIBLE; + st.position = ABSOLUTE; + fly(wrap).setWidth(b.width).setHeight(b.height); + function after(){ + o.useDisplay ? fly(dom).setDisplayed(FALSE) : fly(dom).hide(); + fly(dom).fxUnwrap(wrap, r.pos, o); + st.width = r.width; + st.height = r.height; + fly(dom).afterFx(o); + } + + function argCalc(style, s1, s2, p1, v1, p2, v2, p3, v3){ + var ret = {}; + + style[s1] = style[s2] = "0"; + ret[p1] = v1; + if(p2){ + ret[p2] = v2; + } + if(p3){ + ret[p3] = v3; + } + + return ret; + }; + + a = fly(dom).switchStatements(anchor.toLowerCase(), argCalc, { + t : [st, LEFT, BOTTOM, HEIGHT, zero], + l : [st, RIGHT, TOP, WIDTH, zero], + r : [st, LEFT, TOP, WIDTH, zero, POINTS, {to : [b.right, b.y]}], + b : [st, LEFT, TOP, HEIGHT, zero, POINTS, {to : [b.x, b.bottom]}], + tl : [st, RIGHT, BOTTOM, WIDTH, zero, HEIGHT, zero], + bl : [st, RIGHT, TOP, WIDTH, zero, HEIGHT, zero, POINTS, {to : [b.x, b.bottom]}], + br : [st, LEFT, TOP, WIDTH, zero, HEIGHT, zero, POINTS, {to : [b.x + b.width, b.bottom]}], + tr : [st, LEFT, BOTTOM, WIDTH, zero, HEIGHT, zero, POINTS, {to : [b.right, b.y]}] + }); + + arguments.callee.anim = fly(wrap).fxanim(a, + o, + MOTION, + .5, + EASEOUT, + after); + }); + return me; + }, + + puff : function(o){ + o = getObject(o); + var me = this, + dom = me.dom, + st = dom.style, + width, + height, + r; + me.queueFx(o, function(){ + width = fly(dom).getWidth(); + height = fly(dom).getHeight(); + fly(dom).clearOpacity(); + fly(dom).show(); + + r = fly(dom).getFxRestore(); + + function after(){ + o.useDisplay ? fly(dom).setDisplayed(FALSE) : fly(dom).hide(); + fly(dom).clearOpacity(); + fly(dom).setPositioning(r.pos); + st.width = r.width; + st.height = r.height; + st.fontSize = ''; + fly(dom).afterFx(o); + } + arguments.callee.anim = fly(dom).fxanim({ + width : {to : fly(dom).adjustWidth(width * 2)}, + height : {to : fly(dom).adjustHeight(height * 2)}, + points : {by : [-width * .5, -height * .5]}, + opacity : {to : 0}, + fontSize: {to : 200, unit: "%"} + }, + o, + MOTION, + .5, + EASEOUT, + after); + }); + return me; + }, + + switchOff : function(o){ + o = getObject(o); + var me = this, + dom = me.dom, + st = dom.style, + r; + me.queueFx(o, function(){ + fly(dom).clearOpacity(); + fly(dom).clip(); + + r = fly(dom).getFxRestore(); + + function after(){ + o.useDisplay ? fly(dom).setDisplayed(FALSE) : fly(dom).hide(); + fly(dom).clearOpacity(); + fly(dom).setPositioning(r.pos); + st.width = r.width; + st.height = r.height; + fly(dom).afterFx(o); + }; + fly(dom).fxanim({opacity : {to : 0.3}}, + NULL, + NULL, + .1, + NULL, + function(){ + fly(dom).clearOpacity(); + (function(){ + fly(dom).fxanim({ + height : {to : 1}, + points : {by : [0, fly(dom).getHeight() * .5]} + }, + o, + MOTION, + 0.3, + 'easeIn', + after); + }).defer(100); + }); + }); + return me; + }, + + highlight : function(color, o){ + o = getObject(o); + var me = this, + dom = me.dom, + attr = o.attr || "backgroundColor", + a = {}, + restore; + me.queueFx(o, function(){ + fly(dom).clearOpacity(); + fly(dom).show(); + function after(){ + dom.style[attr] = restore; + fly(dom).afterFx(o); + } + restore = dom.style[attr]; + a[attr] = {from: color || "ffff9c", to: o.endColor || fly(dom).getColor(attr) || "ffffff"}; + arguments.callee.anim = fly(dom).fxanim(a, + o, + 'color', + 1, + 'easeIn', + after); + }); + return me; + }, + + frame : function(color, count, o){ + o = getObject(o); + var me = this, + dom = me.dom, + proxy, + active; + me.queueFx(o, function(){ + color = color || '#C3DAF9'; + if(color.length == 6){ + color = '#' + color; + } + count = count || 1; + fly(dom).show(); + var xy = fly(dom).getXY(), + b = {x: xy[0], y: xy[1], 0: xy[0], 1: xy[1], width: dom.offsetWidth, height: dom.offsetHeight}, + queue = function(){ + proxy = fly(document.body || document.documentElement).createChild({ + style:{ + position : ABSOLUTE, + 'z-index': 35000, + border : '0px solid ' + color + } + }); + return proxy.queueFx({}, animFn); + }; + + + arguments.callee.anim = { + isAnimated: true, + stop: function() { + count = 0; + proxy.stopFx(); + } + }; + + function animFn(){ + var scale = Ext.isBorderBox ? 2 : 1; + active = proxy.anim({ + top : {from : b.y, to : b.y - 20}, + left : {from : b.x, to : b.x - 20}, + borderWidth : {from : 0, to : 10}, + opacity : {from : 1, to : 0}, + height : {from : b.height, to : b.height + 20 * scale}, + width : {from : b.width, to : b.width + 20 * scale} + },{ + duration: o.duration || 1, + callback: function() { + proxy.remove(); + --count > 0 ? queue() : fly(dom).afterFx(o); + } + }); + arguments.callee.anim = { + isAnimated: true, + stop: function(){ + active.stop(); + } + }; + }; + queue(); + }); + return me; + }, + + pause : function(seconds){ + var dom = this.dom, + t; + this.queueFx({}, function(){ + t = setTimeout(function(){ + fly(dom).afterFx({}); + }, seconds * 1000); + arguments.callee.anim = { + isAnimated: true, + stop: function(){ + clearTimeout(t); + fly(dom).afterFx({}); + } + }; + }); + return this; + }, + + fadeIn : function(o){ + o = getObject(o); + var me = this, + dom = me.dom, + to = o.endOpacity || 1; + + me.queueFx(o, function(){ + fly(dom).setOpacity(0); + fly(dom).fixDisplay(); + dom.style.visibility = VISIBLE; + arguments.callee.anim = fly(dom).fxanim({opacity:{to:to}}, + o, NULL, .5, EASEOUT, function(){ + if(to == 1){ + fly(dom).clearOpacity(); + } + fly(dom).afterFx(o); + }); + }); + return me; + }, + + fadeOut : function(o){ + o = getObject(o); + var me = this, + dom = me.dom, + style = dom.style, + to = o.endOpacity || 0; + + me.queueFx(o, function(){ + arguments.callee.anim = fly(dom).fxanim({ + opacity : {to : to}}, + o, + NULL, + .5, + EASEOUT, + function(){ + if(to == 0){ + Ext.Element.data(dom, 'visibilityMode') == Ext.Element.DISPLAY || o.useDisplay ? + style.display = "none" : + style.visibility = HIDDEN; + + fly(dom).clearOpacity(); + } + fly(dom).afterFx(o); + }); + }); + return me; + }, + + scale : function(w, h, o){ + this.shift(Ext.apply({}, o, { + width: w, + height: h + })); + return this; + }, + + shift : function(o){ + o = getObject(o); + var dom = this.dom, + a = {}; + + this.queueFx(o, function(){ + for (var prop in o) { + if (o[prop] != UNDEFINED) { + a[prop] = {to : o[prop]}; + } + } + + a.width ? a.width.to = fly(dom).adjustWidth(o.width) : a; + a.height ? a.height.to = fly(dom).adjustWidth(o.height) : a; + + if (a.x || a.y || a.xy) { + a.points = a.xy || + {to : [ a.x ? a.x.to : fly(dom).getX(), + a.y ? a.y.to : fly(dom).getY()]}; + } + arguments.callee.anim = fly(dom).fxanim(a, + o, + MOTION, + .35, + EASEOUT, + function(){ + fly(dom).afterFx(o); + }); + }); + return this; + }, + + ghost : function(anchor, o){ + o = getObject(o); + var me = this, + dom = me.dom, + st = dom.style, + a = {opacity: {to: 0}, points: {}}, + pt = a.points, + r, + w, + h; + + anchor = anchor || "b"; + me.queueFx(o, function(){ + + r = fly(dom).getFxRestore(); + w = fly(dom).getWidth(); + h = fly(dom).getHeight(); + + function after(){ + o.useDisplay ? fly(dom).setDisplayed(FALSE) : fly(dom).hide(); + fly(dom).clearOpacity(); + fly(dom).setPositioning(r.pos); + st.width = r.width; + st.height = r.height; + fly(dom).afterFx(o); + } + + pt.by = fly(dom).switchStatements(anchor.toLowerCase(), function(v1,v2){ return [v1, v2];}, { + t : [0, -h], + l : [-w, 0], + r : [w, 0], + b : [0, h], + tl : [-w, -h], + bl : [-w, h], + br : [w, h], + tr : [w, -h] + }); + + arguments.callee.anim = fly(dom).fxanim(a, + o, + MOTION, + .5, + EASEOUT, after); + }); + return me; + }, + + syncFx : function(){ + var me = this; + me.fxDefaults = Ext.apply(me.fxDefaults || {}, { + block : FALSE, + concurrent : TRUE, + stopFx : FALSE + }); + return me; + }, + + sequenceFx : function(){ + var me = this; + me.fxDefaults = Ext.apply(me.fxDefaults || {}, { + block : FALSE, + concurrent : FALSE, + stopFx : FALSE + }); + return me; + }, + + nextFx : function(){ + var ef = getQueue(this.dom.id)[0]; + if(ef){ + ef.call(this); + } + }, + + hasActiveFx : function(){ + return getQueue(this.dom.id)[0]; + }, + + stopFx : function(finish){ + var me = this, + id = me.dom.id; + if(me.hasActiveFx()){ + var cur = getQueue(id)[0]; + if(cur && cur.anim){ + if(cur.anim.isAnimated){ + setQueue(id, [cur]); + cur.anim.stop(finish !== undefined ? finish : TRUE); + }else{ + setQueue(id, []); + } + } + } + return me; + }, + + beforeFx : function(o){ + if(this.hasActiveFx() && !o.concurrent){ + if(o.stopFx){ + this.stopFx(); + return TRUE; + } + return FALSE; + } + return TRUE; + }, + + hasFxBlock : function(){ + var q = getQueue(this.dom.id); + return q && q[0] && q[0].block; + }, + + queueFx : function(o, fn){ + var me = fly(this.dom); + if(!me.hasFxBlock()){ + Ext.applyIf(o, me.fxDefaults); + if(!o.concurrent){ + var run = me.beforeFx(o); + fn.block = o.block; + getQueue(me.dom.id).push(fn); + if(run){ + me.nextFx(); + } + }else{ + fn.call(me); + } + } + return me; + }, + + fxWrap : function(pos, o, vis){ + var dom = this.dom, + wrap, + wrapXY; + if(!o.wrap || !(wrap = Ext.getDom(o.wrap))){ + if(o.fixPosition){ + wrapXY = fly(dom).getXY(); + } + var div = document.createElement("div"); + div.style.visibility = vis; + wrap = dom.parentNode.insertBefore(div, dom); + fly(wrap).setPositioning(pos); + if(fly(wrap).isStyle(POSITION, "static")){ + fly(wrap).position("relative"); + } + fly(dom).clearPositioning('auto'); + fly(wrap).clip(); + wrap.appendChild(dom); + if(wrapXY){ + fly(wrap).setXY(wrapXY); + } + } + return wrap; + }, + + fxUnwrap : function(wrap, pos, o){ + var dom = this.dom; + fly(dom).clearPositioning(); + fly(dom).setPositioning(pos); + if(!o.wrap){ + var pn = fly(wrap).dom.parentNode; + pn.insertBefore(dom, wrap); + fly(wrap).remove(); + } + }, + + getFxRestore : function(){ + var st = this.dom.style; + return {pos: this.getPositioning(), width: st.width, height : st.height}; + }, + + afterFx : function(o){ + var dom = this.dom, + id = dom.id; + if(o.afterStyle){ + fly(dom).setStyle(o.afterStyle); + } + if(o.afterCls){ + fly(dom).addClass(o.afterCls); + } + if(o.remove == TRUE){ + fly(dom).remove(); + } + if(o.callback){ + o.callback.call(o.scope, fly(dom)); + } + if(!o.concurrent){ + getQueue(id).shift(); + fly(dom).nextFx(); + } + }, + + fxanim : function(args, opt, animType, defaultDur, defaultEase, cb){ + animType = animType || 'run'; + opt = opt || {}; + var anim = Ext.lib.Anim[animType]( + this.dom, + args, + (opt.duration || defaultDur) || .35, + (opt.easing || defaultEase) || EASEOUT, + cb, + this + ); + opt.anim = anim; + return anim; + } +}; +Ext.Fx.resize = Ext.Fx.scale; +Ext.Element.addMethods(Ext.Fx); +})(); +Ext.CompositeElementLite = function(els, root){ + + this.elements = []; + this.add(els, root); + this.el = new Ext.Element.Flyweight(); +}; +Ext.CompositeElementLite.prototype = { + isComposite: true, + + getElement : function(el){ + + var e = this.el; + e.dom = el; + e.id = el.id; + return e; + }, + + transformElement : function(el){ + return Ext.getDom(el); + }, + getCount : function(){ + return this.elements.length; + }, - getCenterXY : function(){ - return this.getAlignToXY(document, 'c-c'); + add : function(els, root){ + var me = this, + elements = me.elements; + if(!els){ + return this; + } + if(typeof els == "string"){ + els = Ext.Element.selectorFunction(els, root); + }else if(els.isComposite){ + els = els.elements; + }else if(!Ext.isIterable(els)){ + els = [els]; + } + + for(var i = 0, len = els.length; i < len; ++i){ + elements.push(me.transformElement(els[i])); + } + return me; }, + invoke : function(fn, args){ + var me = this, + els = me.elements, + len = els.length, + e, + i; + + for(i = 0; i < len; i++) { + e = els[i]; + if(e){ + Ext.Element.prototype[fn].apply(me.getElement(e), args); + } + } + return me; + }, - center : function(centerIn){ - return this.alignTo(centerIn || document, 'c-c'); - } -}); + item : function(index){ + var me = this, + el = me.elements[index], + out = null; -Ext.Element.addMethods(function(){ - var PARENTNODE = 'parentNode', - NEXTSIBLING = 'nextSibling', - PREVIOUSSIBLING = 'previousSibling', - DQ = Ext.DomQuery, - GET = Ext.get; - - return { - - findParent : function(simpleSelector, maxDepth, returnEl){ - var p = this.dom, - b = document.body, - depth = 0, - stopEl; - if(Ext.isGecko && Object.prototype.toString.call(p) == '[object XULElement]') { - return null; + if(el){ + out = me.getElement(el); + } + return out; + }, + + + addListener : function(eventName, handler, scope, opt){ + var els = this.elements, + len = els.length, + i, e; + + for(i = 0; i " + selector, this.dom); - return returnDom ? n : GET(n); - }, - - - parent : function(selector, returnDom){ - return this.matchNode(PARENTNODE, PARENTNODE, selector, returnDom); - }, - - - next : function(selector, returnDom){ - return this.matchNode(NEXTSIBLING, NEXTSIBLING, selector, returnDom); - }, - - - prev : function(selector, returnDom){ - return this.matchNode(PREVIOUSSIBLING, PREVIOUSSIBLING, selector, returnDom); - }, - - - - first : function(selector, returnDom){ - return this.matchNode(NEXTSIBLING, 'firstChild', selector, returnDom); - }, - - - last : function(selector, returnDom){ - return this.matchNode(PREVIOUSSIBLING, 'lastChild', selector, returnDom); - }, - - matchNode : function(dir, start, selector, returnDom){ - var n = this.dom[start]; - while(n){ - if(n.nodeType == 1 && (!selector || DQ.is(n, selector))){ - return !returnDom ? GET(n) : n; - } - n = n[dir]; - } - return null; - } - } -}()); -Ext.Element.addMethods({ + } + return this; + }, - select : function(selector, unique){ - return Ext.Element.select(selector, unique, this.dom); - } -}); -Ext.Element.addMethods( -function() { - var GETDOM = Ext.getDom, - GET = Ext.get, - DH = Ext.DomHelper; - - return { - - appendChild: function(el){ - return GET(el).appendTo(this); - }, - - - appendTo: function(el){ - GETDOM(el).appendChild(this.dom); - return this; - }, - - - insertBefore: function(el){ - (el = GETDOM(el)).parentNode.insertBefore(this.dom, el); - return this; - }, - - - insertAfter: function(el){ - (el = GETDOM(el)).parentNode.insertBefore(this.dom, el.nextSibling); - return this; - }, - - - insertFirst: function(el, returnDom){ - el = el || {}; - if(el.nodeType || el.dom || typeof el == 'string'){ - el = GETDOM(el); - this.dom.insertBefore(el, this.dom.firstChild); - return !returnDom ? GET(el) : el; - }else{ - return this.createChild(el, this.dom.firstChild, returnDom); - } - }, - - - replace: function(el){ - el = GET(el); - this.insertBefore(el); - el.remove(); - return this; - }, - - - replaceWith: function(el){ - var me = this; - - if(el.nodeType || el.dom || typeof el == 'string'){ - el = GETDOM(el); - me.dom.parentNode.insertBefore(el, me.dom); - }else{ - el = DH.insertBefore(me.dom, el); - } - - delete Ext.elCache[me.id]; - Ext.removeNode(me.dom); - me.id = Ext.id(me.dom = el); - Ext.Element.addToCache(me.isFlyweight ? new Ext.Element(me.dom) : me); - return me; - }, - - - createChild: function(config, insertBefore, returnDom){ - config = config || {tag:'div'}; - return insertBefore ? - DH.insertBefore(insertBefore, config, returnDom !== true) : - DH[!this.dom.firstChild ? 'overwrite' : 'append'](this.dom, config, returnDom !== true); - }, - - - wrap: function(config, returnDom){ - var newEl = DH.insertBefore(this.dom, config || {tag: "div"}, !returnDom); - newEl.dom ? newEl.dom.appendChild(this.dom) : newEl.appendChild(this.dom); - return newEl; - }, - - - insertHtml : function(where, html, returnEl){ - var el = DH.insertHtml(where, this.dom, html); - return returnEl ? Ext.get(el) : el; - } - } -}()); -Ext.apply(Ext.Element.prototype, function() { - var GETDOM = Ext.getDom, - GET = Ext.get, - DH = Ext.DomHelper; - - return { - - insertSibling: function(el, where, returnDom){ - var me = this, - rt, - isAfter = (where || 'before').toLowerCase() == 'after', - insertEl; - - if(Ext.isArray(el)){ - insertEl = me; - Ext.each(el, function(e) { - rt = Ext.fly(insertEl, '_internal').insertSibling(e, where, returnDom); - if(isAfter){ - insertEl = rt; - } - }); - return rt; - } - - el = el || {}; - - if(el.nodeType || el.dom){ - rt = me.dom.parentNode.insertBefore(GETDOM(el), isAfter ? me.dom.nextSibling : me.dom); - if (!returnDom) { - rt = GET(rt); - } - }else{ - if (isAfter && !me.dom.nextSibling) { - rt = DH.append(me.dom.parentNode, el, !returnDom); - } else { - rt = DH[isAfter ? 'insertAfter' : 'insertBefore'](me.dom, el, !returnDom); + each : function(fn, scope){ + var me = this, + els = me.elements, + len = els.length, + i, e; + + for(i = 0; i