Ext.define('Ext.overrides.dom.Element', (function() {
var Element,
WIN = window,
DOC = document,
HIDDEN = 'hidden',
ISCLIPPED = 'isClipped',
OVERFLOW = 'overflow',
OVERFLOWX = 'overflow-x',
OVERFLOWY = 'overflow-y',
ORIGINALCLIP = 'originalClip',
HEIGHT = 'height',
WIDTH = 'width',
VISIBILITY = 'visibility',
DISPLAY = 'display',
NONE = 'none',
OFFSETS = 'offsets',
CLIP = 'clip',
ORIGINALDISPLAY = 'originalDisplay',
VISMODE = 'visibilityMode',
ISVISIBLE = 'isVisible',
OFFSETCLASS = Ext.baseCSSPrefix + 'hidden-offsets',
CLIPCLASS = Ext.baseCSSPrefix + 'hidden-clip',
boxMarkup = [
'<div class="{0}-tl" role="presentation">',
'<div class="{0}-tr" role="presentation">',
'<div class="{0}-tc" role="presentation"></div>',
'</div>',
'</div>',
'<div class="{0}-ml" role="presentation">',
'<div class="{0}-mr" role="presentation">',
'<div class="{0}-mc" role="presentation"></div>',
'</div>',
'</div>',
'<div class="{0}-bl" role="presentation">',
'<div class="{0}-br" role="presentation">',
'<div class="{0}-bc" role="presentation"></div>',
'</div>',
'</div>'
].join(''),
scriptTagRe = /(?:<script([^>]*)?>)((\n|\r|.)*?)(?:<\/script>)/ig,
replaceScriptTagRe = /(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)/ig,
srcRe = /\ssrc=([\'\"])(.*?)\1/i,
nonSpaceRe = /\S/,
typeRe = /\stype=([\'\"])(.*?)\1/i,
adjustDirect2DTableRe = /table-row|table-.*-group/,
msRe = /^-ms-/,
camelRe = /(-[a-z])/gi,
camelReplaceFn = function(m, a) {
return a.charAt(1).toUpperCase();
},
XMASKED = Ext.baseCSSPrefix + "masked",
XMASKEDRELATIVE = Ext.baseCSSPrefix + "masked-relative",
EXTELMASKMSG = Ext.baseCSSPrefix + "mask-msg",
bodyRe = /^body/i,
propertyCache = {},
getVisMode = function(el){
var data = el.getData(),
visMode = data[VISMODE];
if (visMode === undefined) {
data[VISMODE] = visMode = Element.VISIBILITY;
}
return visMode;
},
syncContentFly,
emptyRange = DOC.createRange ? DOC.createRange() : null;
if (Ext.isIE8) {
var garbageBin = DOC.createElement('div'),
destroyQueue = [],
clearGarbage,
clearGarbageFn = function() {
var len = destroyQueue.length,
i;
for (i = 0; i < len; i++) {
garbageBin.appendChild(destroyQueue[i]);
}
garbageBin.innerHTML = '';
destroyQueue.length = 0;
};
clearGarbageFn.$skipTimerCheck = true;
clearGarbage = Ext.Function.createBuffered(clearGarbageFn, 10);
}
return {
override: 'Ext.dom.Element',
mixins: [
'Ext.util.Animate'
],
uses: [
'Ext.dom.GarbageCollector',
'Ext.dom.Fly',
'Ext.event.publisher.MouseEnterLeave',
'Ext.fx.Manager',
'Ext.fx.Anim'
],
skipGarbageCollection: false,
_init: function (E) {
Element = E;
if (WIN.__UNIT_TESTING__) {
E.destroyQueue = destroyQueue;
}
},
statics: {
normalize: function(prop) {
if (prop === 'float') {
prop = Ext.supports.Float ? 'cssFloat' : 'styleFloat';
}
return propertyCache[prop] || (propertyCache[prop] = prop.replace(msRe, 'ms-').replace(camelRe, camelReplaceFn));
}
},
addKeyListener: function(key, fn, scope){
var config;
if(typeof key !== 'object' || Ext.isArray(key)){
config = {
target: this,
key: key,
fn: fn,
scope: scope
};
} else {
config = {
target: this,
key : key.key,
shift : key.shift,
ctrl : key.ctrl,
alt : key.alt,
fn: fn,
scope: scope
};
}
return new Ext.util.KeyMap(config);
},
addKeyMap: function(config) {
return new Ext.util.KeyMap(Ext.apply({
target: this
}, config));
},
adjustDirect2DDimension: function(dimension) {
var me = this,
dom = me.dom,
display = me.getStyle('display'),
inlineDisplay = dom.style.display,
inlinePosition = dom.style.position,
originIndex = dimension === WIDTH ? 0 : 1,
currentStyle = dom.currentStyle,
floating;
if (display === 'inline') {
dom.style.display = 'inline-block';
}
dom.style.position = display.match(adjustDirect2DTableRe) ? 'absolute' : 'static';
floating = (parseFloat(currentStyle[dimension]) || parseFloat(currentStyle.msTransformOrigin.split(' ')[originIndex]) * 2) % 1;
dom.style.position = inlinePosition;
if (display === 'inline') {
dom.style.display = inlineDisplay;
}
return floating;
},
afterAnimate: function() {
var shadow = this.shadow;
if (shadow && !shadow.disabled && !shadow.animate) {
shadow.show();
}
},
anchorAnimX: function(anchor) {
var xName = (anchor === 'l') ? 'right' : 'left';
this.dom.style[xName] = '0px';
},
anim: function(config) {
if (!Ext.isObject(config)) {
return (config) ? {} : false;
}
var me = this,
duration = config.duration || Ext.fx.Anim.prototype.duration,
easing = config.easing || 'ease',
animConfig;
if (config.stopAnimation) {
me.stopAnimation();
}
Ext.applyIf(config, Ext.fx.Manager.getFxDefaults(me.id));
Ext.fx.Manager.setFxDefaults(me.id, {
delay: 0
});
animConfig = {
target: me.dom,
remove: config.remove,
alternate: config.alternate || false,
duration: duration,
easing: easing,
callback: config.callback,
listeners: config.listeners,
iterations: config.iterations || 1,
scope: config.scope,
block: config.block,
concurrent: config.concurrent,
delay: config.delay || 0,
paused: true,
keyframes: config.keyframes,
from: config.from || {},
to: Ext.apply({}, config),
userConfig: config
};
Ext.apply(animConfig.to, config.to);
delete animConfig.to.to;
delete animConfig.to.from;
delete animConfig.to.remove;
delete animConfig.to.alternate;
delete animConfig.to.keyframes;
delete animConfig.to.iterations;
delete animConfig.to.listeners;
delete animConfig.to.target;
delete animConfig.to.paused;
delete animConfig.to.callback;
delete animConfig.to.scope;
delete animConfig.to.duration;
delete animConfig.to.easing;
delete animConfig.to.concurrent;
delete animConfig.to.block;
delete animConfig.to.stopAnimation;
delete animConfig.to.delay;
return animConfig;
},
animate: function (config) {
this.addAnimation(config);
return this;
},
addAnimation: function (config) {
var me = this,
animId = me.dom.id || Ext.id(me.dom),
listeners, anim, end;
if (!Ext.fx.Manager.hasFxBlock(animId)) {
if (config.listeners) {
listeners = config.listeners;
delete config.listeners;
}
if (config.internalListeners) {
config.listeners = config.internalListeners;
delete config.internalListeners;
}
end = config.autoEnd;
delete config.autoEnd;
anim = new Ext.fx.Anim(me.anim(config));
anim.on({
afteranimate: 'afterAnimate',
beforeanimate: 'beforeAnimate',
scope: me,
single: true
});
if (listeners) {
anim.on(listeners);
}
Ext.fx.Manager.queueFx(anim);
if (end) {
anim.jumpToEnd();
}
}
return anim;
},
beforeAnimate: function() {
var shadow = this.shadow;
if (shadow && !shadow.disabled && !shadow.animate) {
shadow.hide();
}
},
boxWrap: function(cls) {
cls = cls || Ext.baseCSSPrefix + 'box';
var el = Ext.get(this.insertHtml("beforeBegin", "<div class='" + cls + "' role='presentation'>" + Ext.String.format(boxMarkup, cls) + "</div>"));
el.selectNode('.' + cls + '-mc').appendChild(this.dom);
return el;
},
clean: function(forceReclean) {
var me = this,
dom = me.dom,
data = me.getData(),
n = dom.firstChild,
ni = -1,
nx;
if (data.isCleaned && forceReclean !== true) {
return me;
}
while (n) {
nx = n.nextSibling;
if (n.nodeType === 3) {
if (!(nonSpaceRe.test(n.nodeValue))) {
dom.removeChild(n);
} else if (nx && nx.nodeType === 3) {
n.appendData(Ext.String.trim(nx.data));
dom.removeChild(nx);
nx = n.nextSibling;
n.nodeIndex = ++ni;
}
} else {
Ext.fly(n, '_clean').clean();
n.nodeIndex = ++ni;
}
n = nx;
}
data.isCleaned = true;
return me;
},
empty: emptyRange ? function() {
var dom = this.dom;
if (dom.firstChild) {
emptyRange.setStartBefore(dom.firstChild);
emptyRange.setEndAfter(dom.lastChild);
emptyRange.deleteContents();
}
} : function() {
var dom = this.dom;
while (dom.lastChild) {
dom.removeChild(dom.lastChild);
}
},
clearListeners: function() {
this.removeAnchor();
this.callParent();
},
clearPositioning: function(value) {
value = value || '';
return this.setStyle({
left : value,
right : value,
top : value,
bottom : value,
'z-index' : '',
position : 'static'
});
},
createProxy: function(config, renderTo, matchBox) {
config = (typeof config === 'object') ? config :
{ tag: "div", role: 'presentation', cls: config };
var me = this,
proxy = renderTo ? Ext.DomHelper.append(renderTo, config, true) :
Ext.DomHelper.insertBefore(me.dom, config, true);
proxy.setVisibilityMode(Element.DISPLAY);
proxy.hide();
if (matchBox && me.setBox && me.getBox) {
proxy.setBox(me.getBox());
}
return proxy;
},
clearOpacity: function() {
return this.setOpacity('');
},
clip: function() {
var me = this,
data = me.getData(),
style;
if (!data[ISCLIPPED]) {
data[ISCLIPPED] = true;
style = me.getStyle([OVERFLOW, OVERFLOWX, OVERFLOWY]);
data[ORIGINALCLIP] = {
o: style[OVERFLOW],
x: style[OVERFLOWX],
y: style[OVERFLOWY]
};
me.setStyle(OVERFLOW, HIDDEN);
me.setStyle(OVERFLOWX, HIDDEN);
me.setStyle(OVERFLOWY, HIDDEN);
}
return me;
},
destroy: function() {
var me = this,
dom = me.dom,
data = me.peekData(),
maskEl, maskMsg;
if (dom) {
if (me.isAnimate) {
me.stopAnimation(true);
}
me.removeAnchor();
}
if (me.deferredFocusTimer) {
clearTimeout(me.deferredFocusTimer);
me.deferredFocusTimer = null;
}
me.callParent();
if (dom && Ext.isIE8 && (dom.window != dom) && (dom.nodeType !== 9) &&
(dom.tagName !== 'BODY') && (dom.tagName !== 'HTML')) {
destroyQueue[destroyQueue.length] = dom;
clearGarbage();
}
if (data) {
maskEl = data.maskEl;
maskMsg = data.maskMsg;
if (maskEl) {
maskEl.destroy();
}
if (maskMsg) {
maskMsg.destroy();
}
}
},
enableDisplayMode : function(display) {
var me = this;
me.setVisibilityMode(Element.DISPLAY);
if (display !== undefined) {
me.getData()[ORIGINALDISPLAY] = display;
}
return me;
},
fadeIn: function(o) {
var me = this,
dom = me.dom,
animFly = new Ext.dom.Fly();
me.animate(Ext.apply({}, o, {
opacity: 1,
internalListeners: {
beforeanimate: function(anim) {
animFly.attach(dom);
if (animFly.isStyle('display', 'none')) {
animFly.setDisplayed('');
} else {
animFly.show();
}
}
}
}));
return this;
},
fadeOut: function(o) {
var me = this,
dom = me.dom,
animFly = new Ext.dom.Fly();
o = Ext.apply({
opacity: 0,
internalListeners: {
afteranimate: function(anim) {
if (anim.to.opacity === 0) {
animFly.attach(dom);
animFly.attach(dom);
if (o.useDisplay) {
animFly.setDisplayed(false);
} else {
animFly.hide();
}
}
}
}
}, o);
me.animate(o);
return me;
},
fixDisplay: function(){
var me = this;
if (me.isStyle(DISPLAY, NONE)) {
me.setStyle(VISIBILITY, HIDDEN);
me.setStyle(DISPLAY, me._getDisplay());
if (me.isStyle(DISPLAY, NONE)) {
me.setStyle(DISPLAY, "block");
}
}
},
frame: function(color, count, obj){
var me = this,
dom = me.dom,
animFly = new Ext.dom.Fly(),
beforeAnim;
color = color || '#C3DAF9';
count = count || 1;
obj = obj || {};
beforeAnim = function() {
var animScope = this,
box,
proxy, proxyAnim;
animFly.attach(dom);
animFly.show();
box = animFly.getBox();
proxy = Ext.getBody().createChild({
role: 'presentation',
id: animFly.dom.id + '-anim-proxy',
style: {
position : 'absolute',
'pointer-events': 'none',
'z-index': 35000,
border : '0px solid ' + color
}
});
proxyAnim = new Ext.fx.Anim({
target: proxy,
duration: obj.duration || 1000,
iterations: count,
from: {
top: box.y,
left: box.x,
borderWidth: 0,
opacity: 1,
height: box.height,
width: box.width
},
to: {
top: box.y - 20,
left: box.x - 20,
borderWidth: 10,
opacity: 0,
height: box.height + 40,
width: box.width + 40
}
});
proxyAnim.on('afteranimate', function() {
proxy.destroy();
animScope.end();
});
};
me.animate({
duration: (Math.max(obj.duration, 500) * 2) || 2000,
listeners: {
beforeanimate: {
fn: beforeAnim
}
},
callback: obj.callback,
scope: obj.scope
});
return me;
},
getColor: function(attr, defaultValue, prefix) {
var v = this.getStyle(attr),
color = prefix || prefix === '' ? prefix : '#',
h, len, i=0;
if (!v || (/transparent|inherit/.test(v))) {
return defaultValue;
}
if (/^r/.test(v)) {
v = v.slice(4, v.length - 1).split(',');
len = v.length;
for (; i<len; i++) {
h = parseInt(v[i], 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);
},
getLoader: function() {
var me = this,
data = me.getData(),
loader = data.loader;
if (!loader) {
data.loader = loader = new Ext.ElementLoader({
target: me
});
}
return loader;
},
getPositioning: function(autoPx){
var styles = this.getStyle(['left', 'top', 'position', 'z-index']),
dom = this.dom;
if(autoPx) {
if(styles.left === 'auto') {
styles.left = dom.offsetLeft + 'px';
}
if(styles.top === 'auto') {
styles.top = dom.offsetTop + 'px';
}
}
return styles;
},
ghost: function(anchor, obj) {
var me = this,
dom = me.dom,
animFly = new Ext.dom.Fly(),
beforeAnim;
anchor = anchor || "b";
beforeAnim = function() {
animFly.attach(dom);
var width = animFly.getWidth(),
height = animFly.getHeight(),
xy = animFly.getXY(),
position = animFly.getPositioning(),
to = {
opacity: 0
};
switch (anchor) {
case 't':
to.y = xy[1] - height;
break;
case 'l':
to.x = xy[0] - width;
break;
case 'r':
to.x = xy[0] + width;
break;
case 'b':
to.y = xy[1] + height;
break;
case 'tl':
to.x = xy[0] - width;
to.y = xy[1] - height;
break;
case 'bl':
to.x = xy[0] - width;
to.y = xy[1] + height;
break;
case 'br':
to.x = xy[0] + width;
to.y = xy[1] + height;
break;
case 'tr':
to.x = xy[0] + width;
to.y = xy[1] - height;
break;
}
this.to = to;
this.on('afteranimate', function () {
animFly.attach(dom);
if (animFly) {
animFly.hide();
animFly.clearOpacity();
animFly.setPositioning(position);
}
});
};
me.animate(Ext.applyIf(obj || {}, {
duration: 500,
easing: 'ease-out',
listeners: {
beforeanimate: beforeAnim
}
}));
return me;
},
getTextSelection: function () {
var ret = this.callParent();
if (typeof ret[0] !== 'number') {
var dom = this.dom;
var doc = dom.ownerDocument;
var range = doc.selection.createRange();
var textRange = dom.createTextRange();
textRange.setEndPoint('EndToStart', range);
ret[0] = textRange.text.length;
ret[1] = ret[0] + range.text.length;
}
return ret;
},
hide: function(animate){
if (typeof animate === 'string'){
this.setVisible(false, animate);
return this;
}
this.setVisible(false, this.anim(animate));
return this;
},
highlight: function(color, o) {
var me = this,
dom = me.dom,
from = {},
animFly = new Ext.dom.Fly(),
restore, to, attr, lns, event, fn;
o = o || {};
lns = o.listeners || {};
attr = o.attr || 'backgroundColor';
from[attr] = color || 'ffff9c';
if (!o.to) {
to = {};
to[attr] = o.endColor || me.getColor(attr, 'ffffff', '');
}
else {
to = o.to;
}
o.listeners = Ext.apply(Ext.apply({}, lns), {
beforeanimate: function() {
animFly.attach(dom);
restore = dom.style[attr];
animFly.clearOpacity();
animFly.show();
event = lns.beforeanimate;
if (event) {
fn = event.fn || event;
return fn.apply(event.scope || lns.scope || WIN, arguments);
}
},
afteranimate: function() {
if (dom) {
dom.style[attr] = restore;
}
event = lns.afteranimate;
if (event) {
fn = event.fn || event;
fn.apply(event.scope || lns.scope || WIN, arguments);
}
}
});
me.animate(Ext.apply({}, o, {
duration: 1000,
easing: 'ease-in',
from: from,
to: to
}));
return me;
},
initDD: function(group, config, overrides){
var dd = new Ext.dd.DD(Ext.id(this.dom), group, config);
return Ext.apply(dd, overrides);
},
initDDProxy: function(group, config, overrides){
var dd = new Ext.dd.DDProxy(Ext.id(this.dom), group, config);
return Ext.apply(dd, overrides);
},
initDDTarget: function(group, config, overrides){
var dd = new Ext.dd.DDTarget(Ext.id(this.dom), group, config);
return Ext.apply(dd, overrides);
},
isMasked: function(deep) {
var me = this,
data = me.getData(),
maskEl = data.maskEl,
maskMsg = data.maskMsg,
hasMask = false,
parent;
if (maskEl && maskEl.isVisible()) {
if (maskMsg) {
maskMsg.center(me);
}
hasMask = true;
}
else if (deep) {
parent = me.findParentNode();
if (parent) {
return Ext.fly(parent).isMasked(deep);
}
}
return hasMask;
},
load: function(options) {
this.getLoader().load(options);
return this;
},
mask: function (msg, msgCls , elHeight) {
var me = this,
dom = me.dom,
data = me.getData(),
maskEl = data.maskEl,
maskMsg;
if (!(bodyRe.test(dom.tagName) && me.getStyle('position') === 'static')) {
me.addCls(XMASKEDRELATIVE);
}
if (maskEl) {
maskEl.destroy();
}
maskEl = Ext.DomHelper.append(dom, {
role: 'presentation',
cls : Ext.baseCSSPrefix + "mask " + Ext.baseCSSPrefix + "border-box",
children: {
role: 'presentation',
cls : msgCls ? EXTELMASKMSG + " " + msgCls : EXTELMASKMSG,
cn : {
tag: 'div',
role: 'presentation',
cls: Ext.baseCSSPrefix + 'mask-msg-inner',
cn: {
tag: 'div',
role: 'presentation',
cls: Ext.baseCSSPrefix + 'mask-msg-text',
html: msg || ''
}
}
}
}, true);
maskMsg = Ext.fly(maskEl.dom.firstChild);
data.maskEl = maskEl;
me.addCls(XMASKED);
maskEl.setDisplayed(true);
if (typeof msg === 'string') {
maskMsg.setDisplayed(true);
maskMsg.center(me);
} else {
maskMsg.setDisplayed(false);
}
if (dom === DOC.body) {
maskEl.addCls(Ext.baseCSSPrefix + 'mask-fixed');
}
me.saveTabbableState({
skipSelf: dom === DOC.body
});
if (Ext.isIE9m && dom !== DOC.body && me.isStyle('height', 'auto')) {
maskEl.setSize(undefined, elHeight || me.getHeight());
}
return maskEl;
},
measure: function (dimension) {
var me = this,
dom = me.dom,
includeWidth = dimension !== 'h',
includeHeight = dimension !== 'w',
height, rect, width;
if (dom.nodeName === 'BODY') {
height = includeHeight && Element.getViewportHeight();
width = includeWidth && Element.getViewportWidth();
rect = dimension ? null : { width: width, height: height };
}
else {
rect = dom.getBoundingClientRect();
if (Ext.isIE8) {
rect = {
width: rect.right - rect.left,
height: rect.bottom - rect.top
};
}
height = rect.height;
width = rect.width;
if (Ext.supports.Direct2DBug) {
if (includeHeight) {
height += me.adjustDirect2DDimension(HEIGHT);
}
if (includeWidth) {
width += me.adjustDirect2DDimension(WIDTH);
}
rect = dimension ? null : { width: width, height: height };
}
}
return dimension ? (includeWidth ? width : height) : rect;
},
puff: function(obj) {
var me = this,
dom = me.dom,
animFly = new Ext.dom.Fly(),
beforeAnim,
box = me.getBox(),
originalStyles = me.getStyle(['width', 'height', 'left', 'right', 'top', 'bottom', 'position', 'z-index', 'font-size', 'opacity'], true);
obj = Ext.applyIf(obj || {}, {
easing: 'ease-out',
duration: 500,
useDisplay: false
});
beforeAnim = function() {
animFly.attach(dom);
animFly.clearOpacity();
animFly.show();
this.to = {
width: box.width * 2,
height: box.height * 2,
x: box.x - (box.width / 2),
y: box.y - (box.height /2),
opacity: 0,
fontSize: '200%'
};
this.on('afteranimate',function() {
animFly.attach(dom);
if (obj.useDisplay) {
animFly.setDisplayed(false);
} else {
animFly.hide();
}
animFly.setStyle(originalStyles);
Ext.callback(obj.callback, obj.scope);
});
};
me.animate({
duration: obj.duration,
easing: obj.easing,
listeners: {
beforeanimate: {
fn: beforeAnim
}
}
});
return me;
},
setCapture: function() {
var dom = this.dom;
if (Ext.isIE9m && dom.setCapture) {
dom.setCapture();
}
},
setHeight: function(height, animate) {
var me = this;
if (!animate || !me.anim) {
me.callParent(arguments);
}
else {
if (!Ext.isObject(animate)) {
animate = {};
}
me.animate(Ext.applyIf({
to: {
height: height
}
}, animate));
}
return me;
},
setHorizontal: function() {
var me = this,
cls = me.verticalCls;
delete me.vertical;
if (cls) {
delete me.verticalCls;
me.removeCls(cls);
}
delete me.setWidth;
delete me.setHeight;
if (!Ext.isIE8) {
delete me.getWidth;
delete me.getHeight;
}
delete me.styleHooks;
},
updateText: function(text) {
var me = this,
dom,
textNode;
if (dom) {
textNode = dom.firstChild;
if (!textNode || (textNode.nodeType !== 3 || textNode.nextSibling)) {
textNode = DOC.createTextNode();
me.empty();
dom.appendChild(textNode);
}
if (text) {
textNode.data = text;
}
}
},
setHtml: function(html, loadScripts, callback, scope) {
var me = this,
id,
dom,
interval;
if (!me.dom) {
return me;
}
html = html || '';
dom = me.dom;
if (loadScripts !== true) {
dom.innerHTML = html;
Ext.callback(callback, me);
return me;
}
id = Ext.id();
html += '<span id="' + id + '" role="presentation"></span>';
interval = Ext.interval(function() {
var hd,
match,
attrs,
srcMatch,
typeMatch,
el,
s;
if (!(el = DOC.getElementById(id))) {
return false;
}
clearInterval(interval);
Ext.removeNode(el);
hd = Ext.getHead().dom;
while ((match = scriptTagRe.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 (scope) {
Ext.functionFactory(match[2]).call(scope);
} else {
Ext.globalEval(match[2]);
}
}
}
Ext.callback(callback, scope || me);
}, 20);
dom.innerHTML = html.replace(replaceScriptTagRe, '');
return me;
},
setOpacity: function(opacity, animate) {
var me = this;
if (!me.dom) {
return me;
}
if (!animate || !me.anim) {
me.setStyle('opacity', opacity);
}
else {
if (typeof animate != 'object') {
animate = {
duration: 350,
easing: 'ease-in'
};
}
me.animate(Ext.applyIf({
to: {
opacity: opacity
}
}, animate));
}
return me;
},
setPositioning: function(pc) {
return this.setStyle(pc);
},
setVertical: function(angle, cls) {
var me = this,
proto = Element.prototype;
me.vertical = true;
if (cls) {
me.addCls(me.verticalCls = cls);
}
me.setWidth = proto.setHeight;
me.setHeight = proto.setWidth;
if (!Ext.isIE8) {
me.getWidth = proto.getHeight;
me.getHeight = proto.getWidth;
}
me.styleHooks = (angle === 270) ?
proto.verticalStyleHooks270 : proto.verticalStyleHooks90;
},
setSize: function(width, height, animate) {
var me = this;
if (Ext.isObject(width)) {
animate = height;
height = width.height;
width = width.width;
}
if (!animate || !me.anim) {
me.dom.style.width = Element.addUnits(width);
me.dom.style.height = Element.addUnits(height);
if (me.shadow || me.shim) {
me.syncUnderlays();
}
}
else {
if (animate === true) {
animate = {};
}
me.animate(Ext.applyIf({
to: {
width: width,
height: height
}
}, animate));
}
return me;
},
setVisible: function(visible, animate) {
var me = this,
dom = me.dom,
animFly,
visMode = getVisMode(me);
if (typeof animate === 'string') {
switch (animate) {
case DISPLAY:
visMode = Element.DISPLAY;
break;
case VISIBILITY:
visMode = Element.VISIBILITY;
break;
case OFFSETS:
visMode = Element.OFFSETS;
break;
case CLIP:
visMode = Element.CLIP;
break;
}
me.setVisibilityMode(visMode);
animate = false;
}
if (!animate || !me.anim) {
if (visMode === Element.DISPLAY) {
return me.setDisplayed(visible);
}
else if (visMode === Element.OFFSETS) {
me[visible ? 'removeCls' : 'addCls'](OFFSETCLASS);
}
else if (visMode === Element.CLIP) {
me[visible ? 'removeCls' : 'addCls'](CLIPCLASS);
}
else if (visMode === Element.VISIBILITY) {
me.fixDisplay();
dom.style.visibility = visible ? '' : HIDDEN;
}
} else {
if (visible) {
me.setOpacity(0.01);
me.setVisible(true);
}
if (!Ext.isObject(animate)) {
animate = {
duration: 350,
easing: 'ease-in'
};
}
animFly = new Ext.dom.Fly(),
me.animate(Ext.applyIf({
callback: function() {
if (!visible) {
animFly.attach(dom).setVisible(false).setOpacity(1);
}
},
to: {
opacity: (visible) ? 1 : 0
}
}, animate));
}
me.getData()[ISVISIBLE] = visible;
if (me.shadow || me.shim) {
me.setUnderlaysVisible(visible);
}
return me;
},
setWidth: function(width, animate) {
var me = this;
if (!animate || !me.anim) {
me.callParent(arguments);
}
else {
if (!Ext.isObject(animate)) {
animate = {};
}
me.animate(Ext.applyIf({
to: {
width: width
}
}, animate));
}
return me;
},
setX: function(x, animate) {
return this.setXY([x, this.getY()], animate);
},
setXY: function(xy, animate) {
var me = this;
if (!animate || !me.anim) {
me.callParent([xy]);
} else {
if (!Ext.isObject(animate)) {
animate = {};
}
me.animate(Ext.applyIf({ to: { x: xy[0], y: xy[1] } }, animate));
}
return this;
},
setY: function(y, animate) {
return this.setXY([this.getX(), y], animate);
},
show: function(animate){
if (typeof animate === 'string'){
this.setVisible(true, animate);
return this;
}
this.setVisible(true, this.anim(animate));
return this;
},
slideIn: function(anchor, obj, slideOut) {
var me = this,
dom = me.dom,
elStyle = dom.style,
animFly = new Ext.dom.Fly(),
beforeAnim,
wrapAnim,
restoreScroll,
wrapDomParentNode;
anchor = anchor || "t";
obj = obj || {};
beforeAnim = function() {
animFly.attach(dom);
var animScope = this,
listeners = obj.listeners,
box, originalStyles, anim, wrap;
if (!slideOut) {
animFly.fixDisplay();
}
box = animFly.getBox();
if ((anchor === 't' || anchor === 'b') && box.height === 0) {
box.height = dom.scrollHeight;
}
else if ((anchor === 'l' || anchor === 'r') && box.width === 0) {
box.width = dom.scrollWidth;
}
originalStyles = animFly.getStyle(['width', 'height', 'left', 'right', 'top', 'bottom', 'position', 'z-index'], true);
animFly.setSize(box.width, box.height);
if (obj.preserveScroll) {
restoreScroll = animFly.cacheScrollValues();
}
wrap = animFly.wrap({
role: 'presentation',
id: Ext.id() + '-anim-wrap-for-' + dom.id,
style: {
visibility: slideOut ? 'visible' : 'hidden'
}
});
wrapDomParentNode = wrap.dom.parentNode;
wrap.setPositioning(animFly.getPositioning());
if (wrap.isStyle('position', 'static')) {
wrap.position('relative');
}
animFly.clearPositioning('auto');
wrap.clip();
if (restoreScroll) {
restoreScroll();
}
animFly.setStyle({
visibility: '',
position: 'absolute'
});
if (slideOut) {
wrap.setSize(box.width, box.height);
}
switch (anchor) {
case 't':
anim = {
from: {
width: box.width + 'px',
height: '0px'
},
to: {
width: box.width + 'px',
height: box.height + 'px'
}
};
elStyle.bottom = '0px';
break;
case 'l':
anim = {
from: {
width: '0px',
height: box.height + 'px'
},
to: {
width: box.width + 'px',
height: box.height + 'px'
}
};
me.anchorAnimX(anchor);
break;
case 'r':
anim = {
from: {
x: box.x + box.width,
width: '0px',
height: box.height + 'px'
},
to: {
x: box.x,
width: box.width + 'px',
height: box.height + 'px'
}
};
me.anchorAnimX(anchor);
break;
case 'b':
anim = {
from: {
y: box.y + box.height,
width: box.width + 'px',
height: '0px'
},
to: {
y: box.y,
width: box.width + 'px',
height: box.height + 'px'
}
};
break;
case 'tl':
anim = {
from: {
x: box.x,
y: box.y,
width: '0px',
height: '0px'
},
to: {
width: box.width + 'px',
height: box.height + 'px'
}
};
elStyle.bottom = '0px';
me.anchorAnimX('l');
break;
case 'bl':
anim = {
from: {
y: box.y + box.height,
width: '0px',
height: '0px'
},
to: {
y: box.y,
width: box.width + 'px',
height: box.height + 'px'
}
};
me.anchorAnimX('l');
break;
case 'br':
anim = {
from: {
x: box.x + box.width,
y: box.y + box.height,
width: '0px',
height: '0px'
},
to: {
x: box.x,
y: box.y,
width: box.width + 'px',
height: box.height + 'px'
}
};
me.anchorAnimX('r');
break;
case 'tr':
anim = {
from: {
x: box.x + box.width,
width: '0px',
height: '0px'
},
to: {
x: box.x,
width: box.width + 'px',
height: box.height + 'px'
}
};
elStyle.bottom = '0px';
me.anchorAnimX('r');
break;
}
wrap.show();
wrapAnim = Ext.apply({}, obj);
delete wrapAnim.listeners;
wrapAnim = new Ext.fx.Anim(Ext.applyIf(wrapAnim, {
target: wrap,
duration: 500,
easing: 'ease-out',
from: slideOut ? anim.to : anim.from,
to: slideOut ? anim.from : anim.to
}));
wrapAnim.on('afteranimate', function() {
animFly.attach(dom);
animFly.setStyle(originalStyles);
if (slideOut) {
if (obj.useDisplay) {
animFly.setDisplayed(false);
} else {
animFly.hide();
}
}
if (wrap.dom) {
if (wrap.dom.parentNode) {
wrap.dom.parentNode.insertBefore(dom, wrap.dom);
} else {
wrapDomParentNode.appendChild(dom);
}
wrap.destroy();
}
if (restoreScroll) {
restoreScroll();
}
animScope.end();
});
if (listeners) {
wrapAnim.on(listeners);
}
};
me.animate({
duration: obj.duration ? Math.max(obj.duration, 500) * 2 : 1000,
listeners: {
beforeanimate: beforeAnim
}
});
return me;
},
slideOut: function(anchor, options) {
return this.slideIn(anchor, options, true);
},
switchOff: function(options) {
var me = this,
dom = me.dom,
animFly = new Ext.dom.Fly(),
beforeAnim;
options = Ext.applyIf(options || {}, {
easing: 'ease-in',
duration: 500,
remove: false,
useDisplay: false
});
beforeAnim = function() {
animFly.attach(dom);
var animScope = this,
size = animFly.getSize(),
xy = animFly.getXY(),
keyframe, position;
animFly.clearOpacity();
animFly.clip();
position = animFly.getPositioning();
keyframe = new Ext.fx.Animator({
target: dom,
duration: options.duration,
easing: options.easing,
keyframes: {
33: {
opacity: 0.3
},
66: {
height: 1,
y: xy[1] + size.height / 2
},
100: {
width: 1,
x: xy[0] + size.width / 2
}
}
});
keyframe.on('afteranimate', function() {
animFly.attach(dom);
if (options.useDisplay) {
animFly.setDisplayed(false);
} else {
animFly.hide();
}
animFly.clearOpacity();
animFly.setPositioning(position);
animFly.setSize(size);
animScope.end();
});
};
me.animate({
duration: (Math.max(options.duration, 500) * 2),
listeners: {
beforeanimate: {
fn: beforeAnim
}
},
callback: options.callback,
scope: options.scope
});
return me;
},
syncContent: function(source) {
source = Ext.getDom(source);
var sourceNodes = source.childNodes,
sourceLen = sourceNodes.length,
dest = this.dom,
destNodes = dest.childNodes,
destLen = destNodes.length,
i, destNode, sourceNode,
nodeType, newAttrs, attLen, attName, value,
elData = dest._extData;
if (!syncContentFly) {
syncContentFly = new Ext.dom.Fly();
}
newAttrs = source.attributes;
attLen = newAttrs.length;
for (i = 0; i < attLen; i++) {
attName = newAttrs[i].name;
value = newAttrs[i].value;
if (attName !== 'id' && dest.getAttribute(attName) !== value) {
dest.setAttribute(attName, newAttrs[i].value);
}
}
if (elData) {
elData.isSynchronized = false;
}
if (sourceLen !== destLen) {
dest.innerHTML = source.innerHTML;
return;
}
for (i = 0; i < sourceLen; i++) {
sourceNode = sourceNodes[i];
destNode = destNodes[i];
nodeType = sourceNode.nodeType;
if (nodeType !== destNode.nodeType || (nodeType === 1 && sourceNode.tagName !== destNode.tagName)) {
dest.innerHTML = source.innerHTML;
return;
}
if (nodeType === 3) {
destNode.data = sourceNode.data;
}
else {
if (sourceNode.id && destNode.id !== sourceNode.id) {
destNode.id = sourceNode.id;
}
destNode.style.cssText = sourceNode.style.cssText;
destNode.className = sourceNode.className;
syncContentFly.attach(destNode).syncContent(sourceNode);
}
}
},
toggle: function(animate){
var me = this;
me.setVisible(!me.isVisible(), me.anim(animate));
return me;
},
unmask: function() {
var me = this,
data = me.getData(),
maskEl = data.maskEl,
style;
if (maskEl) {
style = maskEl.dom.style;
if (style.clearExpression) {
style.clearExpression('width');
style.clearExpression('height');
}
if (maskEl) {
maskEl.destroy();
delete data.maskEl;
}
me.removeCls([XMASKED, XMASKEDRELATIVE]);
}
me.restoreTabbableState(me.dom === DOC.body);
},
unclip: function() {
var me = this,
data = me.getData(),
clip;
if (data[ISCLIPPED]) {
data[ISCLIPPED] = false;
clip = data[ORIGINALCLIP];
if (clip.o) {
me.setStyle(OVERFLOW, clip.o);
}
if (clip.x) {
me.setStyle(OVERFLOWX, clip.x);
}
if (clip.y) {
me.setStyle(OVERFLOWY, clip.y);
}
}
return me;
},
translate: function(x, y, z) {
if (Ext.supports.CssTransforms && !Ext.isIE9m) {
this.callParent(arguments);
} else {
if (x != null) {
this.dom.style.left = x + 'px';
}
if (y != null) {
this.dom.style.top = y + 'px';
}
}
},
deprecated: {
'4.0': {
methods: {
pause: function(ms) {
var me = this;
Ext.fx.Manager.setFxDefaults(me.id, {
delay: ms
});
return me;
},
scale: function(w, h, o) {
this.animate(Ext.apply({}, o, {
width: w,
height: h
}));
return this;
},
shift: function(config) {
this.animate(config);
return this;
}
}
},
'4.2': {
methods: {
moveTo: function(x, y, animate) {
return this.setXY([x, y], animate);
},
setBounds: function(x, y, width, height, animate) {
return this.setBox({
x: x,
y: y,
width: width,
height: height
}, animate);
},
setLeftTop: function(left, top) {
var me = this,
style = me.dom.style;
style.left = Element.addUnits(left);
style.top = Element.addUnits(top);
if (me.shadow || me.shim) {
me.syncUnderlays();
}
return me;
},
setLocation: function(x, y, animate) {
return this.setXY([x, y], animate);
}
}
},
'5.0': {
methods: {
getAttributeNS: function(namespace, name) {
return this.getAttribute(name, namespace);
},
getCenterXY: function(){
return this.getAlignToXY(DOC, 'c-c');
},
getComputedHeight: function() {
return Math.max(this.dom.offsetHeight, this.dom.clientHeight) ||
parseFloat(this.getStyle(HEIGHT)) || 0;
},
getComputedWidth: function() {
return Math.max(this.dom.offsetWidth, this.dom.clientWidth) ||
parseFloat(this.getStyle(WIDTH)) || 0;
},
getStyleSize: function() {
var me = this,
d = this.dom,
isDoc = (d === DOC || d === DOC.body),
s,
w, h;
if (isDoc) {
return {
width : Element.getViewportWidth(),
height : Element.getViewportHeight()
};
}
s = me.getStyle(['height', 'width'], true);
if (s.width && s.width !== 'auto') {
w = parseFloat(s.width);
}
if (s.height && s.height !== 'auto') {
h = parseFloat(s.height);
}
return {width: w || me.getWidth(true), height: h || me.getHeight(true)};
},
isBorderBox: function() {
return true;
},
isDisplayed: function() {
return !this.isStyle('display', 'none');
},
focusable: 'isFocusable'
}
}
}
};
})(), function() {
var Element = Ext.dom.Element,
proto = Element.prototype,
useDocForId = !Ext.isIE8,
DOC = document,
view = DOC.defaultView,
opacityRe = /alpha\(opacity=(.*)\)/i,
trimRe = /^\s+|\s+$/g,
styleHooks = proto.styleHooks,
supports = Ext.supports,
verticalStyleHooks90, verticalStyleHooks270, edges, k,
edge, borderWidth, getBorderWidth;
proto._init(Element);
delete proto._init;
Ext.plainTableCls = Ext.baseCSSPrefix + 'table-plain';
Ext.plainListCls = Ext.baseCSSPrefix + 'list-plain';
if (Ext.CompositeElementLite) {
Ext.CompositeElementLite.importElementMethods();
}
if (!supports.Opacity && Ext.isIE) {
Ext.apply(styleHooks.opacity, {
get: function (dom) {
var filter = dom.style.filter,
match, opacity;
if (filter.match) {
match = filter.match(opacityRe);
if (match) {
opacity = parseFloat(match[1]);
if (!isNaN(opacity)) {
return opacity ? opacity / 100 : 0;
}
}
}
return 1;
},
set: function (dom, value) {
var style = dom.style,
val = style.filter.replace(opacityRe, '').replace(trimRe, '');
style.zoom = 1;
if (typeof(value) === 'number' && value >= 0 && value < 1) {
value *= 100;
style.filter = val + (val.length ? ' ' : '') + 'alpha(opacity='+value+')';
} else {
style.filter = val;
}
}
});
}
if (!supports.matchesSelector) {
var simpleSelectorRe = /^([a-z]+|\*)?(?:\.([a-z][a-z\-_0-9]*))?$/i,
dashRe = /\-/g,
fragment,
classMatcher = function (tag, cls) {
var classRe = new RegExp('(?:^|\\s+)' +cls.replace(dashRe, '\\-') + '(?:\\s+|$)');
if (tag && tag !== '*') {
tag = tag.toUpperCase();
return function (el) {
return el.tagName === tag && classRe.test(el.className);
};
}
return function (el) {
return classRe.test(el.className);
};
},
tagMatcher = function (tag) {
tag = tag.toUpperCase();
return function (el) {
return el.tagName === tag;
};
},
cache = {};
proto.matcherCache = cache;
proto.is = function(selector) {
if (!selector) {
return true;
}
var dom = this.dom,
cls, match, testFn, root, isOrphan, is, tag;
if (dom.nodeType !== 1) {
return false;
}
if (!(testFn = Ext.isFunction(selector) ? selector : cache[selector])) {
if (!(match = selector.match(simpleSelectorRe))) {
root = dom.parentNode;
if (!root) {
isOrphan = true;
root = fragment || (fragment = DOC.createDocumentFragment());
fragment.appendChild(dom);
}
is = Ext.Array.indexOf(Ext.fly(root, '_is').query(selector), dom) !== -1;
if (isOrphan) {
fragment.removeChild(dom);
}
return is;
}
tag = match[1];
cls = match[2];
cache[selector] = testFn = cls ? classMatcher(tag, cls) : tagMatcher(tag);
}
return testFn(dom);
};
}
if (!view || !view.getComputedStyle) {
proto.getStyle = function (property, inline) {
var me = this,
dom = me.dom,
multiple = typeof property !== 'string',
prop = property,
props = prop,
len = 1,
isInline = inline,
styleHooks = me.styleHooks,
camel, domStyle, values, hook, out, style, i;
if (multiple) {
values = {};
prop = props[0];
i = 0;
if (!(len = props.length)) {
return values;
}
}
if (!dom || dom.documentElement) {
return values || '';
}
domStyle = dom.style;
if (inline) {
style = domStyle;
} else {
style = dom.currentStyle;
if (!style) {
isInline = true;
style = domStyle;
}
}
do {
hook = styleHooks[prop];
if (!hook) {
styleHooks[prop] = hook = { name: Element.normalize(prop) };
}
if (hook.get) {
out = hook.get(dom, me, isInline, style);
} else {
camel = hook.name;
out = style[camel];
}
if (!multiple) {
return out;
}
values[prop] = out;
prop = props[++i];
} while (i < len);
return values;
};
}
if (Ext.isIE8) {
getBorderWidth = function (dom, el, inline, style) {
if (style[this.styleName] === 'none') {
return '0px';
}
return style[this.name];
};
edges = ['Top','Right','Bottom','Left'];
k = edges.length;
while (k--) {
edge = edges[k];
borderWidth = 'border' + edge + 'Width';
styleHooks['border-'+edge.toLowerCase()+'-width'] = styleHooks[borderWidth] = {
name: borderWidth,
styleName: 'border' + edge + 'Style',
get: getBorderWidth
};
}
var syncRepaintCls = Ext.baseCSSPrefix + 'sync-repaint';
proto.syncRepaint = function() {
this.addCls(syncRepaintCls);
this.getWidth();
this.removeCls(syncRepaintCls);
};
}
if (Ext.isIE10m) {
Ext.override(Element, {
focus: function(defer, dom) {
var me = this,
ex;
dom = dom || me.dom;
if (me.deferredFocusTimer) {
clearTimeout(me.deferredFocusTimer);
}
me.deferredFocusTimer = null;
if (Number(defer)) {
me.deferredFocusTimer = Ext.defer(me.focus, defer, me, [null, dom]);
}
else {
Ext.GlobalEvents.fireEvent('beforefocus', dom);
if (dom && (dom.tagName === 'INPUT' || dom.tagname === 'TEXTAREA')) {
Ext.synchronouslyFocusing = document.activeElement;
}
try {
dom.focus();
}
catch (xcpt) {
ex = xcpt;
}
if (Ext.synchronouslyFocusing && document.activeElement !== dom && !ex) {
dom.focus();
}
Ext.synchronouslyFocusing = null;
}
return me;
}
});
}
Ext.apply(Ext, {
enableGarbageCollector: true,
isBorderBox: true,
useShims: false,
getElementById: function (id) {
var el = DOC.getElementById(id),
detachedBodyEl;
if (!el && (detachedBodyEl = Ext.detachedBodyEl)) {
el = detachedBodyEl.dom.querySelector(Ext.makeIdSelector(id));
}
return el;
},
addBehaviors: function(o){
if(!Ext.isReady){
Ext.onInternalReady(function(){
Ext.addBehaviors(o);
});
} else {
var cache = {},
parts,
b,
s;
for (b in o) {
if ((parts = b.split('@'))[1]) {
s = parts[0];
if(!cache[s]){
cache[s] = Ext.fly(document).select(s, true);
}
cache[s].on(parts[1], o[b]);
}
}
cache = null;
}
}
});
if (Ext.isIE9m) {
Ext.getElementById = function (id) {
var el = DOC.getElementById(id),
detachedBodyEl;
if (!el && (detachedBodyEl = Ext.detachedBodyEl)) {
el = detachedBodyEl.dom.all[id];
}
return el;
};
proto.getById = function (id, asDom) {
var dom = this.dom,
ret = null,
entry, el;
if (dom) {
el = (useDocForId && DOC.getElementById(id)) || dom.all[id];
if (el) {
if (asDom) {
ret = el;
} else {
entry = Ext.cache[id];
if (entry) {
if (entry.skipGarbageCollection || !Ext.isGarbage(entry.dom)) {
ret = entry;
} else {
Ext.raise("Stale Element with id '" + el.id +
"' found in Element cache. " +
"Make sure to clean up Element instances using destroy()" );
entry.destroy();
}
}
ret = ret || new Ext.Element(el);
}
}
}
return ret;
};
} else if (!DOC.querySelector) {
Ext.getDetachedBody = Ext.getBody;
Ext.getElementById = function (id) {
return DOC.getElementById(id);
};
proto.getById = function (id, asDom) {
var dom = DOC.getElementById(id);
return asDom ? dom : (dom ? Ext.get(dom) : null);
};
}
if (Ext.isIE && !(Ext.isIE9p && DOC.documentMode >= 9)) {
proto.getAttribute = function(name, ns) {
var d = this.dom,
type;
if (ns) {
type = typeof d[ns + ":" + name];
if (type !== 'undefined' && type !== 'unknown') {
return d[ns + ":" + name] || null;
}
return null;
}
if (name === "for") {
name = "htmlFor";
}
return d[name] || null;
};
}
Ext.onInternalReady(function () {
var transparentRe = /^(?:transparent|(?:rgba[(](?:\s*\d+\s*[,]){3}\s*0\s*[)]))$/i,
origSetWidth = proto.setWidth,
origSetHeight = proto.setHeight,
origSetSize = proto.setSize,
pxRe = /^\d+(?:\.\d*)?px$/i,
colorStyles, i, name, camel;
if (supports.FixedTableWidthBug) {
styleHooks.width = {
name: 'width',
set: function(dom, value, el) {
var style = dom.style,
needsFix = el._needsTableWidthFix,
origDisplay = style.display;
if (needsFix) {
style.display = 'none';
}
style.width = value;
if (needsFix) {
dom.scrollWidth;
style.display = origDisplay;
}
}
};
proto.setWidth = function(width, animate) {
var me = this,
dom = me.dom,
style = dom.style,
needsFix = me._needsTableWidthFix,
origDisplay = style.display;
if (needsFix && !animate) {
style.display = 'none';
}
origSetWidth.call(me, width, animate);
if (needsFix && !animate) {
dom.scrollWidth;
style.display = origDisplay;
}
return me;
};
proto.setSize = function(width, height, animate) {
var me = this,
dom = me.dom,
style = dom.style,
needsFix = me._needsTableWidthFix,
origDisplay = style.display;
if (needsFix && !animate) {
style.display = 'none';
}
origSetSize.call(me, width, height, animate);
if (needsFix && !animate) {
dom.scrollWidth;
style.display = origDisplay;
}
return me;
};
}
if (Ext.isIE8) {
styleHooks.height = {
name: 'height',
set: function(dom, value, el) {
var component = el.component,
frameInfo, frameBodyStyle;
if (component && component._syncFrameHeight && el === component.el) {
frameBodyStyle = component.frameBody.dom.style;
if (pxRe.test(value)) {
frameInfo = component.getFrameInfo();
if (frameInfo) {
frameBodyStyle.height = (parseInt(value, 10) - frameInfo.height) + 'px';
}
} else if (!value || value === 'auto') {
frameBodyStyle.height = '';
}
}
dom.style.height = value;
}
};
proto.setHeight = function(height, animate) {
var component = this.component,
frameInfo, frameBodyStyle;
if (component && component._syncFrameHeight && this === component.el) {
frameBodyStyle = component.frameBody.dom.style;
if (!height || height === 'auto') {
frameBodyStyle.height = '';
} else {
frameInfo = component.getFrameInfo();
if (frameInfo) {
frameBodyStyle.height = (height - frameInfo.height) + 'px';
}
}
}
return origSetHeight.call(this, height, animate);
};
proto.setSize = function(width, height, animate) {
var component = this.component,
frameInfo, frameBodyStyle;
if (component && component._syncFrameHeight && this === component.el) {
frameBodyStyle = component.frameBody.dom.style;
if (!height || height === 'auto') {
frameBodyStyle.height = '';
} else {
frameInfo = component.getFrameInfo();
if (frameInfo) {
frameBodyStyle.height = (height - frameInfo.height) + 'px';
}
}
}
return origSetSize.call(this, width, height, animate);
};
}
function fixTransparent (dom, el, inline, style) {
var value = style[this.name] || '';
return transparentRe.test(value) ? 'transparent' : value;
}
function makeSelectionRestoreFn (activeEl, start, end) {
return function () {
activeEl.selectionStart = start;
activeEl.selectionEnd = end;
};
}
function getRightMarginFixCleaner(target) {
var hasInputBug = supports.DisplayChangeInputSelectionBug,
hasTextAreaBug = supports.DisplayChangeTextAreaSelectionBug,
activeEl, tag, start, end;
if (hasInputBug || hasTextAreaBug) {
activeEl = Element.getActiveElement();
tag = activeEl && activeEl.tagName;
if ((hasTextAreaBug && tag === 'TEXTAREA') ||
(hasInputBug && tag === 'INPUT' && activeEl.type === 'text')) {
if (Ext.fly(target).isAncestor(activeEl)) {
start = activeEl.selectionStart;
end = activeEl.selectionEnd;
if (Ext.isNumber(start) && Ext.isNumber(end)) {
return makeSelectionRestoreFn(activeEl, start, end);
}
}
}
}
return Ext.emptyFn;
}
function fixRightMargin (dom, el, inline, style) {
var result = style.marginRight,
domStyle, display;
if (result !== '0px') {
domStyle = dom.style;
display = domStyle.display;
domStyle.display = 'inline-block';
result = (inline ? style : dom.ownerDocument.defaultView.getComputedStyle(dom, null)).marginRight;
domStyle.display = display;
}
return result;
}
function fixRightMarginAndInputFocus (dom, el, inline, style) {
var result = style.marginRight,
domStyle, cleaner, display;
if (result !== '0px') {
domStyle = dom.style;
cleaner = getRightMarginFixCleaner(dom);
display = domStyle.display;
domStyle.display = 'inline-block';
result = (inline ? style : dom.ownerDocument.defaultView.getComputedStyle(dom, '')).marginRight;
domStyle.display = display;
cleaner();
}
return result;
}
if (!supports.RightMargin) {
styleHooks.marginRight = styleHooks['margin-right'] = {
name: 'marginRight',
get: (supports.DisplayChangeInputSelectionBug || supports.DisplayChangeTextAreaSelectionBug) ?
fixRightMarginAndInputFocus : fixRightMargin
};
}
if (!supports.TransparentColor) {
colorStyles = ['background-color', 'border-color', 'color', 'outline-color'];
for (i = colorStyles.length; i--; ) {
name = colorStyles[i];
camel = Element.normalize(name);
styleHooks[name] = styleHooks[camel] = {
name: camel,
get: fixTransparent
};
}
}
proto.verticalStyleHooks90 = verticalStyleHooks90 = Ext.Object.chain(styleHooks);
proto.verticalStyleHooks270 = verticalStyleHooks270 = Ext.Object.chain(styleHooks);
verticalStyleHooks90.width = styleHooks.height || { name: 'height' };
verticalStyleHooks90.height = styleHooks.width || { name: 'width' };
verticalStyleHooks90['margin-top'] = { name: 'marginLeft' };
verticalStyleHooks90['margin-right'] = { name: 'marginTop' };
verticalStyleHooks90['margin-bottom'] = { name: 'marginRight' };
verticalStyleHooks90['margin-left'] = { name: 'marginBottom' };
verticalStyleHooks90['padding-top'] = { name: 'paddingLeft' };
verticalStyleHooks90['padding-right'] = { name: 'paddingTop' };
verticalStyleHooks90['padding-bottom'] = { name: 'paddingRight' };
verticalStyleHooks90['padding-left'] = { name: 'paddingBottom' };
verticalStyleHooks90['border-top'] = { name: 'borderLeft' };
verticalStyleHooks90['border-right'] = { name: 'borderTop' };
verticalStyleHooks90['border-bottom'] = { name: 'borderRight' };
verticalStyleHooks90['border-left'] = { name: 'borderBottom' };
verticalStyleHooks270.width = styleHooks.height || { name: 'height' };
verticalStyleHooks270.height = styleHooks.width || { name: 'width' };
verticalStyleHooks270['margin-top'] = { name: 'marginRight' };
verticalStyleHooks270['margin-right'] = { name: 'marginBottom' };
verticalStyleHooks270['margin-bottom'] = { name: 'marginLeft' };
verticalStyleHooks270['margin-left'] = { name: 'marginTop' };
verticalStyleHooks270['padding-top'] = { name: 'paddingRight' };
verticalStyleHooks270['padding-right'] = { name: 'paddingBottom' };
verticalStyleHooks270['padding-bottom'] = { name: 'paddingLeft' };
verticalStyleHooks270['padding-left'] = { name: 'paddingTop' };
verticalStyleHooks270['border-top'] = { name: 'borderRight' };
verticalStyleHooks270['border-right'] = { name: 'borderBottom' };
verticalStyleHooks270['border-bottom'] = { name: 'borderLeft' };
verticalStyleHooks270['border-left'] = { name: 'borderTop' };
if (!Ext.scopeCss) {
Ext.getBody().addCls(Ext.baseCSSPrefix + 'body');
}
}, null, { priority: 1500 });
});