diff --git a/deluge/ui/web/css/deluge.css b/deluge/ui/web/css/deluge.css index 8bd74b6b2..988aa7ac4 100644 --- a/deluge/ui/web/css/deluge.css +++ b/deluge/ui/web/css/deluge.css @@ -201,7 +201,7 @@ dl.singleline dd { } .x-connected { - background-image: transparent !important; + background-image: none !important; } /* Styles for renderered progress bars */ diff --git a/deluge/ui/web/css/ext-all-notheme.css b/deluge/ui/web/css/ext-all-notheme.css index a0f6906a5..6bc676568 100644 --- a/deluge/ui/web/css/ext-all-notheme.css +++ b/deluge/ui/web/css/ext-all-notheme.css @@ -1,10 +1,17 @@ /*! - * Ext JS Library 3.1.0 - * Copyright(c) 2006-2009 Ext JS, LLC - * licensing@extjs.com - * http://www.extjs.com/license + * Ext JS Library 3.4.0 + * Copyright(c) 2006-2011 Sencha Inc. + * licensing@sencha.com + * http://www.sencha.com/license */ -html,body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,th,td{margin:0;padding:0;}img,body,html{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}ol,ul {list-style:none;}caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;}q:before,q:after{content:'';}.ext-el-mask { +html,body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,th,td{margin:0;padding:0;}img,body,html{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}ol,ul {list-style:none;}caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;}q:before,q:after{content:'';} + +.ext-forced-border-box, .ext-forced-border-box * { + -moz-box-sizing: border-box; + -ms-box-sizing: border-box; + -webkit-box-sizing: border-box; +} +.ext-el-mask { z-index: 100; position: absolute; top:0; @@ -68,6 +75,16 @@ html,body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,bloc display:none !important; } +.x-hide-nosize, +.x-hide-nosize * /* Emulate display:none for children */ + { + height:0px!important; + width:0px!important; + visibility:hidden!important; + border:none!important; + zoom:1; +} + .x-hide-visibility { visibility:hidden !important; } @@ -97,6 +114,7 @@ html,body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,bloc zoom: 1; background-color: transparent; -moz-outline: none; + outline: none; } .x-item-disabled { @@ -110,6 +128,10 @@ html,body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,bloc cursor: default !important; } +.x-form-radio-group .x-item-disabled { + filter: none; +} + .x-splitbar-proxy { position: absolute; visibility: hidden; @@ -219,7 +241,7 @@ html,body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,bloc .x-shadow .xsmc { float: left; height: 100%; - background: transparent; + background-color: transparent; } .x-shadow .xst, .x-shadow .xsb { @@ -637,9 +659,28 @@ ul.x-tab-strip li.x-tab-edge { /* * Horrible hack for IE8 in quirks mode */ -.ext-border-box .ext-ie8 .x-tab-strip .x-tab-right{ +.ext-ie8 .x-tab-strip li { + position: relative; +} +.ext-border-box .ext-ie8 .x-tab-strip-top .x-tab-right { top: 1px; } +.ext-ie8 .x-tab-strip-top { + padding-top: 1; +} +.ext-border-box .ext-ie8 .x-tab-strip-top { + padding-top: 0; +} +.ext-ie8 .x-tab-strip .x-tab-strip-closable a.x-tab-strip-close { + top:3px; +} +.ext-border-box .ext-ie8 .x-tab-strip .x-tab-strip-closable a.x-tab-strip-close { + top:4px; +} +.ext-ie8 .x-tab-strip-bottom .x-tab-right{ + top:0; +} + .x-tab-strip-top .x-tab-strip-active .x-tab-right span.x-tab-strip-text { padding-bottom:5px; @@ -700,14 +741,15 @@ ul.x-tab-strip li.x-tab-edge { } .x-tab-strip-bottom .x-tab-strip-active .x-tab-right { - background: no-repeat bottom left; -} - -.x-tab-strip-bottom .x-tab-strip-active .x-tab-left { background: no-repeat bottom right; } +.x-tab-strip-bottom .x-tab-strip-active .x-tab-left { + background: no-repeat bottom left; +} + .x-tab-strip-bottom .x-tab-left { + margin-right: 3px; padding:0 10px; } @@ -864,6 +906,26 @@ textarea.x-form-field { line-height:18px; } +.x-quirks .ext-ie9 .x-form-text { + height: 22px; + padding-top: 3px; + padding-bottom: 0px; +} + +/* Ugly hacks for the bogus 1px margin bug in IE9 quirks */ +.x-quirks .ext-ie9 .x-input-wrapper .x-form-text, +.x-quirks .ext-ie9 .x-form-field-trigger-wrap .x-form-text { + margin-top: -1px; + margin-bottom: -1px; +} +.x-quirks .ext-ie9 .x-input-wrapper .x-form-element { + margin-bottom: -1px; +} + +.ext-ie6 .x-form-field-wrap .x-form-file-btn, .ext-ie7 .x-form-field-wrap .x-form-file-btn { + top: -1px; /* because of all these margin hacks, these buttons are off by one pixel in IE6,7 */ +} + .ext-ie6 textarea.x-form-field, .ext-ie7 textarea.x-form-field { margin:-1px 0; /* ie bogus margin bug */ } @@ -876,15 +938,21 @@ textarea.x-form-field { margin-bottom:-2px; /* another bogus margin bug, safari/mac only */ } +/* .ext-strict .ext-ie8 .x-form-text, .ext-strict .ext-ie8 textarea.x-form-field { - margin-bottom: 1px; + margin-bottom: 1px; } +*/ .ext-gecko .x-form-text , .ext-ie8 .x-form-text { padding-top:2px; /* FF won't center the text vertically */ padding-bottom:0; } +.ext-ie6 .x-form-composite .x-form-text.x-box-item, .ext-ie7 .x-form-composite .x-form-text.x-box-item { + margin: 0 !important; /* clear ie bogus margin bug fix */ +} + textarea { resize: none; /* Disable browser resizable textarea */ } @@ -904,7 +972,7 @@ textarea { /* 2.0.2 style */ .x-form-check-wrap { line-height:18px; - height: 22px; + height: auto; } .ext-ie .x-form-check-wrap input { @@ -947,10 +1015,6 @@ textarea { cursor:pointer; } -.ext-webkit .x-form-field-wrap .x-form-trigger{ - right:0; -} - .x-form-field-wrap .x-form-twin-triggers .x-form-trigger{ position:static; top:auto; @@ -960,10 +1024,15 @@ textarea { .x-form-field-wrap { position:relative; left:0;top:0; + text-align: left; zoom:1; white-space: nowrap; } +.ext-strict .ext-ie8 .x-toolbar-cell .x-form-field-trigger-wrap .x-form-trigger { + right: 0; /* IE8 Strict mode trigger bug */ +} + .x-form-field-wrap .x-form-trigger-over{ background-position:-17px 0; } @@ -1004,21 +1073,17 @@ textarea { /* field focus style */ .x-form-focus, textarea.x-form-focus{ - border: 1px solid; + border: 1px solid; } /* invalid fields */ .x-form-invalid, textarea.x-form-invalid{ - background:repeat-x bottom; - border: 1px solid; -} - -.ext-webkit .x-form-invalid{ - border: 1px solid; + background:repeat-x bottom; + border: 1px solid; } .x-form-inner-invalid, textarea.x-form-inner-invalid{ - background:repeat-x bottom; + background:repeat-x bottom; } /* editors */ @@ -1030,11 +1095,11 @@ textarea { .x-form-grow-sizer { left: -10000px; - padding: 8px 3px; + padding: 8px 3px; position: absolute; visibility:hidden; top: -10000px; - white-space: pre-wrap; + white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; @@ -1149,6 +1214,10 @@ textarea { .ext-webkit .x-small-editor .x-form-text{padding-top:3px;font-size:100%;} +.ext-strict .ext-webkit .x-small-editor .x-form-text{ + height:14px !important; +} + .x-form-clear { clear:both; height:0; @@ -1165,7 +1234,7 @@ textarea { } .ext-ie6 .x-form-check-wrap input, .ext-border-box .x-form-check-wrap input{ - margin-top: 3px; + margin-top: 3px; } .x-form-cb-label { @@ -1209,59 +1278,59 @@ textarea { /* buttons */ .x-form .x-form-btns-ct .x-btn{ - float:right; - clear:none; + float:right; + clear:none; } .x-form .x-form-btns-ct .x-form-btns td { - border:0; - padding:0; + border:0; + padding:0; } .x-form .x-form-btns-ct .x-form-btns-right table{ - float:right; - clear:none; + float:right; + clear:none; } .x-form .x-form-btns-ct .x-form-btns-left table{ - float:left; - clear:none; + float:left; + clear:none; } .x-form .x-form-btns-ct .x-form-btns-center{ - text-align:center; /*ie*/ + text-align:center; /*ie*/ } .x-form .x-form-btns-ct .x-form-btns-center table{ - margin:0 auto; /*everyone else*/ + margin:0 auto; /*everyone else*/ } .x-form .x-form-btns-ct table td.x-form-btn-td{ - padding:3px; + padding:3px; } .x-form .x-form-btns-ct .x-btn-focus .x-btn-left{ - background-position:0 -147px; + background-position:0 -147px; } .x-form .x-form-btns-ct .x-btn-focus .x-btn-right{ - background-position:0 -168px; + background-position:0 -168px; } .x-form .x-form-btns-ct .x-btn-focus .x-btn-center{ - background-position:0 -189px; + background-position:0 -189px; } .x-form .x-form-btns-ct .x-btn-click .x-btn-center{ - background-position:0 -126px; + background-position:0 -126px; } .x-form .x-form-btns-ct .x-btn-click .x-btn-right{ - background-position:0 -84px; + background-position:0 -84px; } .x-form .x-form-btns-ct .x-btn-click .x-btn-left{ - background-position:0 -63px; + background-position:0 -63px; } .x-form-invalid-icon { @@ -1286,12 +1355,16 @@ textarea { /* make top of checkbox/tools visible in webkit */ .ext-webkit .x-fieldset-header { padding-top: 1px; -} +} .ext-ie .x-fieldset legend { margin-bottom:10px; } +.ext-strict .ext-ie9 .x-fieldset legend.x-fieldset-header { + padding-top: 1px; +} + .ext-ie .x-fieldset { padding-top: 0; padding-bottom:10px; @@ -1315,8 +1388,8 @@ fieldset.x-panel-collapsed { border-width: 1px 1px 0 1px !important; border-left-color: transparent; border-right-color: transparent; -} - +} + .ext-ie6 fieldset.x-panel-collapsed{ padding-bottom:0 !important; border-width: 1px 0 0 0 !important; @@ -1343,7 +1416,7 @@ fieldset.x-panel-collapsed .x-fieldset-bwrap { margin-left:-3px; } -/* IE legend positioing bug */ +/* IE legend positioning bug */ .ext-ie .x-fieldset-noborder legend { position: relative; margin-bottom:23px; @@ -1352,14 +1425,20 @@ fieldset.x-panel-collapsed .x-fieldset-bwrap { position: absolute; left:16px; } - + .ext-gecko .x-window-body .x-form-item { -moz-outline: none; + outline: none; overflow: auto; } +.ext-mac.ext-gecko .x-window-body .x-form-item { + overflow:hidden; +} + .ext-gecko .x-form-item { -moz-outline: none; + outline: none; } .x-hide-label label.x-form-item-label { @@ -1386,8 +1465,6 @@ fieldset.x-panel-collapsed .x-fieldset-bwrap { .x-fieldset-body { overflow:hidden; } - - .x-btn{ cursor:pointer; white-space: nowrap; @@ -1395,7 +1472,7 @@ fieldset.x-panel-collapsed .x-fieldset-bwrap { .x-btn button{ border:0 none; - background:transparent; + background-color:transparent; padding-left:3px; padding-right:3px; cursor:pointer; @@ -1410,7 +1487,7 @@ fieldset.x-panel-collapsed .x-fieldset-bwrap { width:1px; } -.ext-gecko .x-btn button { +.ext-gecko .x-btn button, .ext-webkit .x-btn button { padding-left:0; padding-right:0; } @@ -1727,7 +1804,7 @@ fieldset.x-panel-collapsed .x-fieldset-bwrap { /* height adjustment class */ .x-btn-as-arrow .x-btn-mc em { display:block; - background:transparent; + background-color:transparent; padding-bottom:14px; } @@ -1786,7 +1863,7 @@ fieldset.x-panel-collapsed .x-fieldset-bwrap { } .x-btn-group-mc .x-btn-group-body { - background:transparent; + background-color:transparent; border: 0 none; } @@ -2011,7 +2088,7 @@ fieldset.x-panel-collapsed .x-fieldset-bwrap { .x-toolbar-more em.x-btn-arrow { display:inline; - background:transparent; + background-color:transparent; padding-right:0; } @@ -2090,6 +2167,7 @@ div.x-toolbar-no-items { .x-grid3-hd-row td, .x-grid3-row td, .x-grid3-summary-row td{ -moz-outline: none; + outline: none; -moz-user-focus: normal; } @@ -2132,6 +2210,16 @@ div.x-toolbar-no-items { white-space: nowrap; } +/* ActionColumn, reduce padding to accommodate 16x16 icons in normal row height */ +.x-action-col-cell .x-grid3-cell-inner { + padding-top: 1px; + padding-bottom: 1px; +} + +.x-action-col-icon { + cursor: pointer; +} + .x-grid3-hd-inner { position:relative; cursor:inherit; @@ -2409,7 +2497,7 @@ td.x-grid3-hd-over .x-grid3-hd-inner, td.sort-desc .x-grid3-hd-inner, td.sort-as .x-grid3-col-dd { border:0 none; padding:0; - background:transparent; + background-color:transparent; } .x-dd-drag-ghost .x-grid3-dd-wrap { @@ -2502,10 +2590,18 @@ a.x-grid3-hd-btn:hover { } .x-grid3-hd-checker { + background-position:2px 1px; +} + +.ext-border-box .x-grid3-hd-checker { background-position:2px 3px; } .x-grid3-hd-checker-on .x-grid3-hd-checker { + background-position:-23px 1px; +} + +.ext-border-box .x-grid3-hd-checker-on .x-grid3-hd-checker { background-position:-23px 3px; } @@ -2611,17 +2707,83 @@ a.x-grid3-hd-btn:hover { position: static; } - .ext-ie6 .x-grid3-header { position: relative; } +/* Fix WebKit bug in Grids */ +.ext-webkit .x-grid-panel .x-panel-bwrap{ + -webkit-user-select:none; +} +.ext-webkit .x-tbar-page-number{ + -webkit-user-select:ignore; +} +/* end*/ + /* column lines */ .x-grid-with-col-lines .x-grid3-row td.x-grid3-cell { padding-right:0; border-right:1px solid; } -.x-dd-drag-proxy{ +.x-pivotgrid .x-grid3-header-offset table { + width: 100%; + border-collapse: collapse; +} + +.x-pivotgrid .x-grid3-header-offset table td { + padding: 4px 3px 4px 5px; + text-align: center; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + font-size: 11px; + line-height: 13px; + font-family: tahoma; +} + +.x-pivotgrid .x-grid3-row-headers { + display: block; + float: left; +} + +.x-pivotgrid .x-grid3-row-headers table { + height: 100%; + width: 100%; + border-collapse: collapse; +} + +.x-pivotgrid .x-grid3-row-headers table td { + height: 18px; + padding: 2px 7px 0 0; + text-align: right; + text-overflow: ellipsis; + font-size: 11px; + font-family: tahoma; +} + +.ext-gecko .x-pivotgrid .x-grid3-row-headers table td { + height: 21px; +} + +.x-grid3-header-title { + top: 0%; + left: 0%; + position: absolute; + text-align: center; + vertical-align: middle; + font-family: tahoma; + font-size: 11px; + padding: auto 1px; + display: table-cell; +} + +.x-grid3-header-title span { + position: absolute; + top: 50%; + left: 0%; + width: 100%; + margin-top: -6px; +}.x-dd-drag-proxy{ position:absolute; left:0; top:0; @@ -2746,20 +2908,20 @@ input.x-tree-node-cb { /* No line styles */ .x-tree-no-lines .x-tree-elbow{ - background:transparent; + background-color:transparent; } .x-tree-no-lines .x-tree-elbow-end{ - background:transparent; + background-color:transparent; } .x-tree-no-lines .x-tree-elbow-line{ - background:transparent; + background-color:transparent; } /* Arrows */ .x-tree-arrows .x-tree-elbow{ - background:transparent; + background-color:transparent; } .x-tree-arrows .x-tree-elbow-plus{ @@ -2771,7 +2933,7 @@ input.x-tree-node-cb { } .x-tree-arrows .x-tree-elbow-end{ - background:transparent; + background-color:transparent; } .x-tree-arrows .x-tree-elbow-end-plus{ @@ -2783,7 +2945,7 @@ input.x-tree-node-cb { } .x-tree-arrows .x-tree-elbow-line{ - background:transparent; + background-color:transparent; } .x-tree-arrows .x-tree-ec-over .x-tree-elbow-plus{ @@ -2844,7 +3006,7 @@ input.x-tree-node-cb { } .x-tree-node .x-tree-node-inline-icon{ - background:transparent; + background-color:transparent; } .x-tree-node a:hover, .x-dd-drag-ghost a:hover{ @@ -3156,7 +3318,7 @@ td.x-date-mp-sep { top: 0; left:0; visibility: hidden; - z-index: 20000; + z-index: 20002; border:0 none; } @@ -3318,7 +3480,7 @@ td.x-date-mp-sep { .x-menu-list{ padding: 2px; - background:transparent; + background-color:transparent; border:0 none; overflow:hidden; overflow-y: hidden; @@ -3440,7 +3602,7 @@ a.x-menu-item { } .x-menu-group-item .x-menu-item-icon{ - background: transparent; + background-color: transparent; } .x-menu-item-checked .x-menu-group-item .x-menu-item-icon{ @@ -3475,6 +3637,24 @@ a.x-menu-item { padding:0 !important; } +/* + * fixes separator visibility problem in IE 6 + */ +.ext-strict .ext-ie6 .x-menu-sep-li { + padding: 3px 4px; +} +.ext-strict .ext-ie6 .x-menu-sep { + margin: 0; + height: 1px; +} + +/* + * Fixes an issue with "fat" separators in webkit + */ +.ext-webkit .x-menu-sep{ + height: 1px; +} + /* * Ugly mess to remove the white border under the picker */ @@ -3517,8 +3697,7 @@ a.x-menu-item { .x-menu-list-item-indent{ padding-left: 27px; -} -/* +}/* Creates rounded, raised boxes like on the Ext website - the markup isn't pretty:
+Employee = Ext.extend(Ext.util.Observable, {
+ constructor: function(config){
+ this.name = config.name;
+ this.addEvents({
+ "fired" : true,
+ "quit" : true
+ });
+
+ // Copy configured listeners into *this* object so that the base class's
+ // constructor will add them.
+ this.listeners = config.listeners;
+
+ // Call our superclass constructor to complete construction process.
+ Employee.superclass.constructor.call(this, config)
+ }
+});
+
+ * This could then be used like this:
+var newEmployee = new Employee({
+ name: employeeName,
+ listeners: {
+ quit: function() {
+ // By default, "this" will be the object that fired the event.
+ alert(this.name + " has quit!");
+ }
+ }
+});
+
+ */
+EXTUTIL.Observable = function(){
+ /**
+ * @cfg {Object} listeners (optional) A config object containing one or more event handlers to be added to this + * object during initialization. This should be a valid listeners config object as specified in the + * {@link #addListener} example for attaching multiple handlers at once.
+ *DOM events from ExtJs {@link Ext.Component Components}
+ *While some ExtJs Component classes export selected DOM events (e.g. "click", "mouseover" etc), this
+ * is usually only done when extra value can be added. For example the {@link Ext.DataView DataView}'s
+ * {@link Ext.DataView#click click}
event passing the node clicked on. To access DOM
+ * events directly from a Component's HTMLElement, listeners must be added to the {@link Ext.Component#getEl Element} after the Component
+ * has been rendered. A plugin can simplify this step:
+// Plugin is configured with a listeners config object.
+// The Component is appended to the argument list of all handler functions.
+Ext.DomObserver = Ext.extend(Object, {
+ constructor: function(config) {
+ this.listeners = config.listeners ? config.listeners : config;
+ },
+
+ // Component passes itself into plugin's init method
+ init: function(c) {
+ var p, l = this.listeners;
+ for (p in l) {
+ if (Ext.isFunction(l[p])) {
+ l[p] = this.createHandler(l[p], c);
+ } else {
+ l[p].fn = this.createHandler(l[p].fn, c);
+ }
+ }
+
+ // Add the listeners to the Element immediately following the render call
+ c.render = c.render.{@link Function#createSequence createSequence}(function() {
+ var e = c.getEl();
+ if (e) {
+ e.on(l);
+ }
+ });
+ },
+
+ createHandler: function(fn, c) {
+ return function(e) {
+ fn.call(this, e, c);
+ };
+ }
+});
+
+var combo = new Ext.form.ComboBox({
+
+ // Collapse combo when its element is clicked on
+ plugins: [ new Ext.DomObserver({
+ click: function(evt, comp) {
+ comp.collapse();
+ }
+ })],
+ store: myStore,
+ typeAhead: true,
+ mode: 'local',
+ triggerAction: 'all'
+});
+ *
+ */
+ var me = this, e = me.events;
+ if(me.listeners){
+ me.on(me.listeners);
+ delete me.listeners;
+ }
+ me.events = e || {};
+};
+
+EXTUTIL.Observable.prototype = {
+ // private
+ filterOptRe : /^(?:scope|delay|buffer|single)$/,
+
+ /**
+ * Fires the specified event with the passed parameters (minus the event name).
+ *An event may be set to bubble up an Observable parent hierarchy (See {@link Ext.Component#getBubbleTarget}) + * by calling {@link #enableBubble}.
+ * @param {String} eventName The name of the event to fire. + * @param {Object...} args Variable number of parameters are passed to handlers. + * @return {Boolean} returns false if any of the handlers return false otherwise it returns true. + */ + 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; + }, + + /** + * Appends an event handler to this object. + * @param {String} eventName The name of the event to listen for. + * @param {Function} handler The method the event invokes. + * @param {Object} scope (optional) The scope (this
reference) in which the handler function is executed.
+ * If omitted, defaults to the object which fired the event.
+ * @param {Object} options (optional) An object containing handler configuration.
+ * properties. This may contain any of the following properties:this
reference) in which the handler function is executed.
+ * If omitted, defaults to the object which fired the event.
+ * Combining Options
+ * Using the options argument, it is possible to combine different types of listeners:
+ *
+ * A delayed, one-time listener.
+ *
+myDataView.on('click', this.onClick, this, {
+single: true,
+delay: 100
+});
+ *
+ * Attaching multiple handlers in 1 call
+ * The method also allows for a single argument to be passed which is a config object containing properties
+ * which specify multiple handlers.
+ *
+ *
+myGridPanel.on({
+'click' : {
+ fn: this.onClick,
+ scope: this,
+ delay: 100
+},
+'mouseover' : {
+ fn: this.onMouseOver,
+ scope: this
+},
+'mouseout' : {
+ fn: this.onMouseOut,
+ scope: this
+}
+});
+ *
+ * Or a shorthand syntax:
+ *
+myGridPanel.on({
+'click' : this.onClick,
+'mouseover' : this.onMouseOver,
+'mouseout' : this.onMouseOut,
+ scope: this
+});
+ */
+ 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 : {});
+ }
+ },
+
+ /**
+ * Removes an event handler.
+ * @param {String} eventName The type of event the handler was associated with.
+ * @param {Function} handler The handler to remove. This must be a reference to the function passed into the {@link #addListener} call.
+ * @param {Object} scope (optional) The scope originally specified for the handler.
+ */
+ removeListener : function(eventName, fn, scope){
+ var ce = this.events[eventName.toLowerCase()];
+ if (typeof ce == 'object') {
+ ce.removeListener(fn, scope);
+ }
+ },
+
+ /**
+ * Removes all listeners for this object
+ */
+ purgeListeners : function(){
+ var events = this.events,
+ evt,
+ key;
+ for(key in events){
+ evt = events[key];
+ if(typeof evt == 'object'){
+ evt.clearListeners();
+ }
+ }
+ },
+
+ /**
+ * Adds the specified events to the list of events which this Observable may fire.
+ * @param {Object|String} o Either an object with event names as properties with a value of true
+ * or the first event name string if multiple event names are being passed as separate parameters.
+ * @param {string} Optional. Event name if multiple event names are being passed as separate parameters.
+ * Usage:
+this.addEvents('storeloaded', 'storecleared');
+
+ */
+ 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);
+ }
+ },
+
+ /**
+ * Checks to see if this object has any listeners for a specified event
+ * @param {String} eventName The name of the event to check for
+ * @return {Boolean} True if the event is being listened for, else false
+ */
+ hasListener : function(eventName){
+ var e = this.events[eventName.toLowerCase()];
+ return typeof e == 'object' && e.listeners.length > 0;
+ },
+
+ /**
+ * Suspend the firing of all events. (see {@link #resumeEvents})
+ * @param {Boolean} queueSuspended Pass as true to queue up suspended events to be fired
+ * after the {@link #resumeEvents} call instead of discarding all suspended events;
+ */
+ suspendEvents : function(queueSuspended){
+ this.eventsSuspended = TRUE;
+ if(queueSuspended && !this.eventQueue){
+ this.eventQueue = [];
+ }
+ },
+
+ /**
+ * Resume firing events. (see {@link #suspendEvents})
+ * If events were suspended using the queueSuspended parameter, then all
+ * events fired during event suspension will be sent to any listeners now.
+ */
+ 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;
+/**
+ * Appends an event handler to this object (shorthand for {@link #addListener}.)
+ * @param {String} eventName The type of event to listen for
+ * @param {Function} handler The method the event invokes
+ * @param {Object} scope (optional) The scope (this
reference) in which the handler function is executed.
+ * If omitted, defaults to the object which fired the event.
+ * @param {Object} options (optional) An object containing handler configuration.
+ * @method
+ */
+OBSERVABLE.on = OBSERVABLE.addListener;
+/**
+ * Removes an event handler (shorthand for {@link #removeListener}.)
+ * @param {String} eventName The type of event the handler was associated with.
+ * @param {Function} handler The handler to remove. This must be a reference to the function passed into the {@link #addListener} call.
+ * @param {Object} scope (optional) The scope originally specified for the handler.
+ * @method
+ */
+OBSERVABLE.un = OBSERVABLE.removeListener;
+
+/**
+ * Removes all added captures from the Observable.
+ * @param {Observable} o The Observable to release
+ * @static
+ */
+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){ // if we are currently firing this event, don't disturb the listener loop
+ 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;
+ },
+
+ // Iterate to stop any buffered/delayed events
+ 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;
+ }
+
+};
+})();
/**
* @class Ext.DomHelper
* The DomHelper class provides a layer of abstraction from DOM and transparently supports creating @@ -136,6 +658,10 @@ 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, // kill repeat to save bytes afterbegin = 'afterbegin', @@ -161,10 +687,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++) { @@ -174,19 +699,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 + '"'; } } - }); + }; // Now either just close the tag or try to add children and close the tag. if (emptyTags.test(o.tag)) { b += '/>'; @@ -235,7 +761,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 : @@ -258,7 +784,27 @@ Ext.DomHelper = function(){ return node; } - + /** + * @ignore + * Fix for IE9 createContextualFragment missing method + */ + function createContextualFragment(html){ + var div = document.createElement("div"), + fragment = document.createDocumentFragment(), + i = 0, + length, childNodes; + + div.innerHTML = html; + childNodes = div.childNodes; + length = childNodes.length; + + for (; i < length; i++) { + fragment.appendChild(childNodes[i].cloneNode(true)); + } + + return fragment; + } + pub = { /** * Returns the markup for the passed Element(s) config. @@ -268,7 +814,7 @@ Ext.DomHelper = function(){ markup : function(o){ return createHtml(o); }, - + /** * Applies a style specification to an element. * @param {String/HTMLElement} el The element to apply styles to @@ -276,26 +822,29 @@ Ext.DomHelper = function(){ * a function which returns such a specification. */ 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") { + /** + * Since we're using the g flag on the regex, we need to set the lastIndex. + * This automatically happens on some implementations, but not others, see: + * http://stackoverflow.com/questions/2645273/javascript-regular-expression-literal-persists-between-function-calls + * http://blog.stevenlevithan.com/archives/fixing-javascript-regexp + */ + 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); } } }, - /** * Inserts an HTML fragment into the DOM. * @param {String} where Where to insert the html in relation to el - beforeBegin, afterBegin, beforeEnd, afterEnd. @@ -306,10 +855,10 @@ Ext.DomHelper = function(){ insertHtml : function(where, el, html){ var hash = {}, hashVal, - setStart, range, - frag, rangeEl, + setStart, + frag, rs; where = where.toLowerCase(); @@ -330,17 +879,27 @@ 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); + if (!range.createContextualFragment) { + frag = createContextualFragment(html); + } + else { + frag = range.createContextualFragment(html); + } el.parentNode.insertBefore(frag, where == beforebegin ? el : el.nextSibling); return el[(where == beforebegin ? 'previous' : 'next') + 'Sibling']; } else { rangeEl = (where == afterbegin ? 'first' : 'last') + 'Child'; if (el.firstChild) { range[setStart](el[rangeEl]); - frag = range.createContextualFragment(html); + if (!range.createContextualFragment) { + frag = createContextualFragment(html); + } + else { + frag = range.createContextualFragment(html); + } if(where == afterbegin){ el.insertBefore(frag, el.firstChild); }else{ @@ -415,157 +974,13 @@ Ext.DomHelper = function(){ createHtml : createHtml }; return pub; -}();/** - * @class Ext.DomHelper - */ -Ext.apply(Ext.DomHelper, -function(){ - var pub, - afterbegin = 'afterbegin', - afterend = 'afterend', - beforebegin = 'beforebegin', - beforeend = 'beforeend'; - - // private - 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; - } - - // build as dom - /** @ignore */ - function createDom(o, parentNode){ - var el, - doc = document, - useSet, - attr, - val, - cn; - - if (Ext.isArray(o)) { // Allow Arrays of siblings to be inserted - el = doc.createDocumentFragment(); // in one shot using a DocumentFragment - Ext.each(o, function(v) { - createDom(v, el); - }); - } else if (Ext.isString(o)) { // Allow a string as a child spec. - el = doc.createTextNode(o); - } else { - el = doc.createElement( o.tag || 'div' ); - useSet = !!el.setAttribute; // In IE some elements don't have 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 = { - /** - * Creates a new Ext.Template from the DOM object spec. - * @param {Object} o The DOM object spec (and children) - * @return {Ext.Template} The new template - */ - createTemplate : function(o){ - var html = Ext.DomHelper.createHtml(o); - return new Ext.Template(html); - }, - - /** True to force the use of DOM instead of html fragments @type Boolean */ - useDom : false, - - /** - * Creates new DOM element(s) and inserts them before el. - * @param {Mixed} el The context element - * @param {Object/String} o The DOM object spec (and children) or raw HTML blob - * @param {Boolean} returnElement (optional) true to return a Ext.Element - * @return {HTMLElement/Ext.Element} The new node - * @hide (repeat) - */ - insertBefore : function(el, o, returnElement){ - return doInsert(el, o, returnElement, beforebegin); - }, - - /** - * Creates new DOM element(s) and inserts them after el. - * @param {Mixed} el The context element - * @param {Object} o The DOM object spec (and children) - * @param {Boolean} returnElement (optional) true to return a Ext.Element - * @return {HTMLElement/Ext.Element} The new node - * @hide (repeat) - */ - insertAfter : function(el, o, returnElement){ - return doInsert(el, o, returnElement, afterend, 'nextSibling'); - }, - - /** - * Creates new DOM element(s) and inserts them as the first child of el. - * @param {Mixed} el The context element - * @param {Object/String} o The DOM object spec (and children) or raw HTML blob - * @param {Boolean} returnElement (optional) true to return a Ext.Element - * @return {HTMLElement/Ext.Element} The new node - * @hide (repeat) - */ - insertFirst : function(el, o, returnElement){ - return doInsert(el, o, returnElement, afterbegin, 'firstChild'); - }, - - /** - * Creates new DOM element(s) and appends them to el. - * @param {Mixed} el The context element - * @param {Object/String} o The DOM object spec (and children) or raw HTML blob - * @param {Boolean} returnElement (optional) true to return a Ext.Element - * @return {HTMLElement/Ext.Element} The new node - * @hide (repeat) - */ - append: function(el, o, returnElement){ - return doInsert(el, o, returnElement, beforeend, '', true); - }, - - /** - * Creates new DOM element(s) without inserting them to the document. - * @param {Object/String} o The DOM object spec (and children) or raw HTML blob - * @return {HTMLElement} The new uninserted node - */ - createDom: createDom - }; - return pub; -}());/** +}(); +/** * @class Ext.Template *
Represents an HTML fragment template. Templates may be {@link #compile precompiled} * for greater performance.
*For example usage {@link #Template see the constructor}.
- * + * * @constructor * An instance of this class may be created by passing to the constructor either * a single argument, or multiple arguments: @@ -601,7 +1016,7 @@ var t = new Ext.Template( { compiled: true, // {@link #compile} immediately disableFormats: true // See Notes below. - } + } ); * *Notes:
@@ -617,19 +1032,21 @@ var t = new Ext.Template( */ 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(''); } @@ -648,11 +1065,11 @@ Ext.Template.prototype = { /** * @cfg {RegExp} re The regular expression used to match template variables. * Defaults to:
- * re : /\{([\w-]+)\}/g // for Ext Core
- * re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g // for Ext JS
+ * re : /\{([\w\-]+)\}/g // for Ext Core
+ * re : /\{([\w\-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g // for Ext JS
*
*/
- re : /\{([\w-]+)\}/g,
+ re : /\{([\w\-]+)\}/g,
/**
* See {@link #re}
.
* @type RegExp
@@ -667,14 +1084,14 @@ Ext.Template.prototype = {
* @return {String} The HTML fragment
*/
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] : "";
+ });
+ },
/**
* Sets the HTML used as the template and optionally compiles it.
@@ -683,7 +1100,7 @@ Ext.Template.prototype = {
* @return {Ext.Template} this
*/
set : function(html, compile){
- var me = this;
+ var me = this;
me.html = html;
me.compiled = null;
return compile ? me.compile() : me;
@@ -695,13 +1112,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('');};"));
@@ -797,133 +1214,8 @@ Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate;
Ext.Template.from = function(el, config){
el = Ext.getDom(el);
return new Ext.Template(el.value || el.innerHTML, config || '');
-};/**
- * @class Ext.Template
- */
-Ext.apply(Ext.Template.prototype, {
- /**
- * @cfg {Boolean} disableFormats Specify true to disable format
- * functions in the template. If the template does not contain
- * {@link Ext.util.Format format functions}, setting disableFormats
- * to true will reduce {@link #apply}
time. Defaults to false.
- *
-var t = new Ext.Template(
- '<div name="{id}">',
- '<span class="{cls}">{name} {value}</span>',
- '</div>',
- {
- compiled: true, // {@link #compile} immediately
- disableFormats: true // reduce {@link #apply}
time since no formatting
- }
-);
- *
- * For a list of available format functions, see {@link Ext.util.Format}.
- */
- disableFormats : false,
- /**
- * See {@link #disableFormats}
.
- * @type Boolean
- * @property disableFormats
- */
-
- /**
- * The regular expression used to match template variables
- * @type RegExp
- * @property
- * @hide repeat doc
- */
- re : /\{([\w-]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
-
- /**
- * Returns an HTML fragment of this template with the specified values applied.
- * @param {Object/Array} values The template values. Can be an array if your params are numeric (i.e. {0}) or an object (i.e. {foo: 'bar'})
- * @return {String} The HTML fragment
- * @hide repeat doc
- */
- applyTemplate : function(values){
- var me = this,
- useF = me.disableFormats !== true,
- fm = Ext.util.Format,
- tpl = me;
-
- if(me.compiled){
- return me.compiled(values);
- }
- function fn(m, name, format, args){
- if (format && useF) {
- if (format.substr(0, 5) == "this.") {
- return tpl.call(format.substr(5), values[name], values);
- } else {
- if (args) {
- // quoted values are required for strings in compiled templates,
- // but for non compiled we need to strip them
- // quoted reversed for jsmin
- var re = /^\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);
- },
-
- /**
- * Compiles the template into an internal function, eliminating the RegEx overhead.
- * @return {Ext.Template} this
- * @hide repeat doc
- */
- compile : function(){
- var me = this,
- fm = Ext.util.Format,
- useF = me.disableFormats !== true,
- sep = Ext.isGecko ? "+" : ",",
- body;
-
- function fn(m, name, format, args){
- if(format && useF){
- args = args ? ',' + args : "";
- if(format.substr(0, 5) != "this."){
- format = "fm." + format + '(';
- }else{
- format = 'this.call("'+ format.substr(5) + '", ';
- args = ", values";
- }
- }else{
- args= ''; format = "(values['" + name + "'] == undefined ? '' : ";
- }
- return "'"+ sep + format + "values['" + name + "']" + args + ")"+sep+"'";
- }
-
- // branched to use + in gecko and [].join() in others
- if(Ext.isGecko){
- body = "this.compiled = function(values){ return '" +
- me.html.replace(/\\/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;
- },
-
- // private function used to call members
- call : function(fnName, value, allValues){
- return this[fnName](value, allValues);
- }
-});
-Ext.Template.prototype.apply = Ext.Template.prototype.applyTemplate; /*
+};
+/*
* This is code is also distributed under MIT license for use
* with jQuery and prototype JavaScript libraries.
*/
@@ -954,7 +1246,7 @@ All selectors, attribute filters and pseudos below can be combined infinitely in
-Employee = Ext.extend(Ext.util.Observable, {
- constructor: function(config){
- this.name = config.name;
- this.addEvents({
- "fired" : true,
- "quit" : true
- });
-
- // Copy configured listeners into *this* object so that the base class's
- // constructor will add them.
- this.listeners = config.listeners;
-
- // Call our superclass constructor to complete construction process.
- Employee.superclass.constructor.call(config)
- }
-});
-
- * This could then be used like this:
-var newEmployee = new Employee({
- name: employeeName,
- listeners: {
- quit: function() {
- // By default, "this" will be the object that fired the event.
- alert(this.name + " has quit!");
- }
- }
-});
-
- */
-EXTUTIL.Observable = function(){
- /**
- * @cfg {Object} listeners (optional) A config object containing one or more event handlers to be added to this - * object during initialization. This should be a valid listeners config object as specified in the - * {@link #addListener} example for attaching multiple handlers at once.
- *DOM events from ExtJs {@link Ext.Component Components}
- *While some ExtJs Component classes export selected DOM events (e.g. "click", "mouseover" etc), this
- * is usually only done when extra value can be added. For example the {@link Ext.DataView DataView}'s
- * {@link Ext.DataView#click click}
event passing the node clicked on. To access DOM
- * events directly from a Component's HTMLElement, listeners must be added to the {@link Ext.Component#getEl Element} after the Component
- * has been rendered. A plugin can simplify this step:
-// Plugin is configured with a listeners config object.
-// The Component is appended to the argument list of all handler functions.
-Ext.DomObserver = Ext.extend(Object, {
- constructor: function(config) {
- this.listeners = config.listeners ? config.listeners : config;
- },
-
- // Component passes itself into plugin's init method
- init: function(c) {
- var p, l = this.listeners;
- for (p in l) {
- if (Ext.isFunction(l[p])) {
- l[p] = this.createHandler(l[p], c);
- } else {
- l[p].fn = this.createHandler(l[p].fn, c);
- }
- }
-
- // Add the listeners to the Element immediately following the render call
- c.render = c.render.{@link Function#createSequence createSequence}(function() {
- var e = c.getEl();
- if (e) {
- e.on(l);
- }
- });
- },
-
- createHandler: function(fn, c) {
- return function(e) {
- fn.call(this, e, c);
- };
- }
-});
-
-var combo = new Ext.form.ComboBox({
-
- // Collapse combo when its element is clicked on
- plugins: [ new Ext.DomObserver({
- click: function(evt, comp) {
- comp.collapse();
- }
- })],
- store: myStore,
- typeAhead: true,
- mode: 'local',
- triggerAction: 'all'
-});
- *
- */
- var me = this, e = me.events;
- if(me.listeners){
- me.on(me.listeners);
- delete me.listeners;
- }
- me.events = e || {};
-};
-
-EXTUTIL.Observable.prototype = {
- // private
- filterOptRe : /^(?:scope|delay|buffer|single)$/,
-
- /**
- * Fires the specified event with the passed parameters (minus the event name).
- *An event may be set to bubble up an Observable parent hierarchy (See {@link Ext.Component#getBubbleTarget}) - * by calling {@link #enableBubble}.
- * @param {String} eventName The name of the event to fire. - * @param {Object...} args Variable number of parameters are passed to handlers. - * @return {Boolean} returns false if any of the handlers return false otherwise it returns true. - */ - 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); - } - return c.fireEvent.apply(c, a); - } - } - else { - if (ISOBJECT(ce)) { - a.shift(); - ret = ce.fire.apply(ce, a); - } - } - return ret; - }, - - /** - * Appends an event handler to this object. - * @param {String} eventName The name of the event to listen for. - * @param {Function} handler The method the event invokes. - * @param {Object} scope (optional) The scope (this
reference) in which the handler function is executed.
- * If omitted, defaults to the object which fired the event.
- * @param {Object} options (optional) An object containing handler configuration.
- * properties. This may contain any of the following properties:this
reference) in which the handler function is executed.
- * If omitted, defaults to the object which fired the event.
- * Combining Options
- * Using the options argument, it is possible to combine different types of listeners:
- *
- * A delayed, one-time listener.
- *
-myDataView.on('click', this.onClick, this, {
-single: true,
-delay: 100
-});
- *
- * Attaching multiple handlers in 1 call
- * The method also allows for a single argument to be passed which is a config object containing properties
- * which specify multiple handlers.
- *
- *
-myGridPanel.on({
-'click' : {
- fn: this.onClick,
- scope: this,
- delay: 100
-},
-'mouseover' : {
- fn: this.onMouseOver,
- scope: this
-},
-'mouseout' : {
- fn: this.onMouseOut,
- scope: this
-}
-});
- *
- * Or a shorthand syntax:
- *
-myGridPanel.on({
-'click' : this.onClick,
-'mouseover' : this.onMouseOver,
-'mouseout' : this.onMouseOut,
- scope: this
-});
- */
- addListener : function(eventName, fn, scope, o){
- 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);
- }
- ce.addListener(fn, scope, ISOBJECT(o) ? o : {});
- }
- },
-
- /**
- * Removes an event handler.
- * @param {String} eventName The type of event the handler was associated with.
- * @param {Function} handler The handler to remove. This must be a reference to the function passed into the {@link #addListener} call.
- * @param {Object} scope (optional) The scope originally specified for the handler.
- */
- removeListener : function(eventName, fn, scope){
- var ce = this.events[eventName.toLowerCase()];
- if (ISOBJECT(ce)) {
- ce.removeListener(fn, scope);
- }
- },
-
- /**
- * Removes all listeners for this object
- */
- purgeListeners : function(){
- var events = this.events,
- evt,
- key;
- for(key in events){
- evt = events[key];
- if(ISOBJECT(evt)){
- evt.clearListeners();
- }
- }
- },
-
- /**
- * Adds the specified events to the list of events which this Observable may fire.
- * @param {Object|String} o Either an object with event names as properties with a value of true
- * or the first event name string if multiple event names are being passed as separate parameters.
- * @param {string} Optional. Event name if multiple event names are being passed as separate parameters.
- * Usage:
-this.addEvents('storeloaded', 'storecleared');
-
- */
- addEvents : function(o){
- 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);
- }
- },
-
- /**
- * Checks to see if this object has any listeners for a specified event
- * @param {String} eventName The name of the event to check for
- * @return {Boolean} True if the event is being listened for, else false
- */
- hasListener : function(eventName){
- var e = this.events[eventName];
- return ISOBJECT(e) && e.listeners.length > 0;
- },
-
- /**
- * Suspend the firing of all events. (see {@link #resumeEvents})
- * @param {Boolean} queueSuspended Pass as true to queue up suspended events to be fired
- * after the {@link #resumeEvents} call instead of discarding all suspended events;
- */
- suspendEvents : function(queueSuspended){
- this.eventsSuspended = TRUE;
- if(queueSuspended && !this.eventQueue){
- this.eventQueue = [];
- }
- },
-
- /**
- * Resume firing events. (see {@link #suspendEvents})
- * If events were suspended using the queueSuspended parameter, then all
- * events fired during event suspension will be sent to any listeners now.
- */
- 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;
-/**
- * Appends an event handler to this object (shorthand for {@link #addListener}.)
- * @param {String} eventName The type of event to listen for
- * @param {Function} handler The method the event invokes
- * @param {Object} scope (optional) The scope (this
reference) in which the handler function is executed.
- * If omitted, defaults to the object which fired the event.
- * @param {Object} options (optional) An object containing handler configuration.
- * @method
- */
-OBSERVABLE.on = OBSERVABLE.addListener;
-/**
- * Removes an event handler (shorthand for {@link #removeListener}.)
- * @param {String} eventName The type of event the handler was associated with.
- * @param {Function} handler The handler to remove. This must be a reference to the function passed into the {@link #addListener} call.
- * @param {Object} scope (optional) The scope originally specified for the handler.
- * @method
- */
-OBSERVABLE.un = OBSERVABLE.removeListener;
-
-/**
- * Removes all added captures from the Observable.
- * @param {Observable} o The Observable to release
- * @static
- */
-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));
- }
- };
-};
-
-function createBuffered(h, o, l, scope){
- l.task = new EXTUTIL.DelayedTask();
- return function(){
- l.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);
- };
-};
-
-function createDelayed(h, o, l, scope){
- return function(){
- var task = new EXTUTIL.DelayedTask();
- if(!l.tasks) {
- l.tasks = [];
- }
- l.tasks.push(task);
- task.delay(o.delay || 10, h, scope, TOARRAY(arguments));
- };
-};
-
-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){ // if we are currently firing this event, don't disturb the listener loop
- 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,
- s;
- while(i--) {
- l = list[i];
- if(l) {
- s = l.scope;
- if(l.fn == fn && (s == scope || s == this.obj)){
- 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;
- },
-
- // Iterate to stop any buffered/delayed events
- 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,
- args = TOARRAY(arguments),
- listeners = me.listeners,
- len = listeners.length,
- i = 0,
- l;
-
- 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;
- }
-};
-})();/**
- * @class Ext.util.Observable
- */
-Ext.apply(Ext.util.Observable.prototype, function(){
- // this is considered experimental (along with beforeMethod, afterMethod, removeMethodListener?)
- // allows for easier interceptor and sequences, including cancelling and overwriting the return value of the call
- // private
- 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;
- }
- }
- };
-
- 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;
- }
- });
-
- 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 {
- // these are considered experimental
- // allows for easier interceptor and sequences, including cancelling and overwriting the return value of the call
- // adds an 'interceptor' called before the original method
- beforeMethod : function(method, fn, scope){
- getMethodEvent.call(this, method).before.push({
- fn: fn,
- scope: scope
- });
- },
-
- // adds a 'sequence' called after the original method
- 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;
- }
- });
- }
- },
-
- /**
- * Relays selected events from the specified Observable as if the events were fired by this.
- * @param {Object} o The Observable whose events this object is to relay.
- * @param {Array} events Array of event names to relay.
- */
- relayEvents : function(o, events){
- var me = this;
- function createHandler(ename){
- return function(){
- return me.fireEvent.apply(me, [ename].concat(Ext.toArray(arguments)));
- };
- }
- Ext.each(events, function(ename){
- me.events[ename] = me.events[ename] || true;
- o.on(ename, createHandler(ename), me);
- });
- },
-
- /**
- * Enables events fired by this Observable to bubble up an owner hierarchy by calling
- * this.getBubbleTarget()
if present. There is no implementation in the Observable base class.
This is commonly used by Ext.Components to bubble events to owner Containers. See {@link Ext.Component.getBubbleTarget}. The default - * implementation in Ext.Component returns the Component's immediate owner. But if a known target is required, this can be overridden to - * access the required target more quickly.
- *Example:
-Ext.override(Ext.form.Field, {
- // Add functionality to Field's initComponent to enable the change event to bubble
- initComponent : Ext.form.Field.prototype.initComponent.createSequence(function() {
- this.enableBubble('change');
- }),
-
- // We know that we want Field's events to bubble directly to the FormPanel.
- getBubbleTarget : function() {
- if (!this.formPanel) {
- this.formPanel = this.findParentByType('form');
- }
- return this.formPanel;
- }
-});
-
-var myForm = new Ext.formPanel({
- title: 'User Details',
- items: [{
- ...
- }],
- listeners: {
- change: function() {
- // Title goes red if form has been modified.
- myForm.header.setStyle('color', 'red');
- }
- }
-});
-
- * @param {String/Array} events The event name to bubble, or an Array of event names.
- */
- enableBubble : function(events){
- 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;
- });
- }
- }
- };
-}());
-
-
-/**
- * Starts capture on the specified Observable. All events will be passed
- * to the supplied function with the event name + standard signature of the event
- * before the event is fired. If the supplied function returns false,
- * the event will not fire.
- * @param {Observable} o The Observable to capture events from.
- * @param {Function} fn The function to call when an event is fired.
- * @param {Object} scope (optional) The scope (this
reference) in which the function is executed. Defaults to the Observable firing the event.
- * @static
- */
-Ext.util.Observable.capture = function(o, fn, scope){
- o.fireEvent = o.fireEvent.createInterceptor(fn, scope);
-};
-
-
-/**
- * Sets observability on the passed class constructor.- *
This makes any event fired on any instance of the passed class also fire a single event through - * the class allowing for central handling of events on many instances at once.
- *Usage:
-Ext.util.Observable.observeClass(Ext.data.Connection);
-Ext.data.Connection.on('beforerequest', function(con, options) {
- console.log('Ajax request made to ' + options.url);
-});
- * @param {Function} c The class constructor to make observable.
- * @param {Object} listeners An object containing a series of listeners to add. See {@link #addListener}.
- * @static
- */
-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;
- }
};/**
- * @class Ext.EventManager
- * Registers event handlers that want to receive a normalized EventObject instead of the standard browser event and provides
- * several useful events directly.
- * See {@link Ext.EventObject} for more details on normalized event objects.
- * @singleton
- */
-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)$/,
- /*
- * This cache is used to hold special js objects, the document and window, that don't have an id. We need to keep
- * a reference to them so we can look them up at a later point.
- */
- specialElCache = [];
-
- function getId(el){
- var id = false,
- i = 0,
- len = specialElCache.length,
- id = false,
- skip = false,
- o;
- if(el){
- if(el.getElementById || el.navigator){
- // look up the id
- for(; i < len; ++i){
- o = specialElCache[i];
- if(o.el === el){
- id = o.id;
- break;
- }
- }
- if(!id){
- // for browsers that support it, ensure that give the el the same id
- id = Ext.id(el);
- specialElCache.push({
- id: id,
- el: el
- });
- skip = true;
- }
- }else{
- id = Ext.id(el);
- }
- if(!Ext.elCache[id]){
- Ext.Element.addToCache(new Ext.Element(el), id);
- if(skip){
- Ext.elCache[id].skipGC = true;
- }
- }
- }
- return id;
- };
-
- /// There is some jquery work around stuff here that isn't needed in Ext Core.
- function addListener(el, ename, fn, task, wrap, scope){
- el = Ext.getDom(el);
- var id = getId(el),
- es = Ext.elCache[id].events,
- wfn;
-
- wfn = E.on(el, ename, wrap);
- es[ename] = es[ename] || [];
-
- /* 0 = Original Function,
- 1 = Event Manager Wrapped Function,
- 2 = Scope,
- 3 = Adapter Wrapped Function,
- 4 = Buffered Task
- */
- es[ename].push([fn, wrap, scope, wfn, task]);
-
- // this is a workaround for jQuery and should somehow be removed from Ext Core in the future
- // without breaking ExtJS.
-
- // workaround for jQuery
- if(el.addEventListener && ename == "mousewheel"){
- var args = ["DOMMouseScroll", wrap, false];
- el.addEventListener.apply(el, args);
- Ext.EventManager.addListener(WINDOW, 'unload', function(){
- el.removeEventListener.apply(el, args);
- });
- }
-
- // fix stopped mousedowns on the document
- if(el == DOC && ename == "mousedown"){
- 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);
- }
- if(Ext.isIE){
- var defer = DOC.getElementById(IEDEFERED);
- if(defer){
- defer.onreadystatechange = null;
- defer.parentNode.removeChild(defer);
- }
- }
- if(docReadyEvent){
- docReadyEvent.fire();
- docReadyEvent.listeners = []; // clearListeners no longer compatible. Force single: true?
- }
- }
- };
-
- function initDocReady(){
- var COMPLETE = "complete";
-
- docReadyEvent = new Ext.util.Event();
- if (Ext.isGecko || Ext.isOpera) {
- DOC.addEventListener(DOMCONTENTLOADED, fireDocReady, false);
- } else if (Ext.isIE){
- DOC.write("this
reference) in which the handler function is executed. Defaults to the Element.
- * @param {Object} options (optional) An object containing handler configuration properties.
- * This may contain any of the following properties:this
reference) in which the handler function is executed. Defaults to the Element.See {@link Ext.Element#addListener} for examples of how to use these options.
- */ - 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)){ - // shared options - listen(element, e, o, val, o.scope); - }else{ - // individual options - listen(element, e, val); - } - } - } - } else { - listen(element, eventName, options, fn, scope); - } - }, - - /** - * Removes an event handler from an element. The shorthand version {@link #un} is equivalent. Typically - * you will use {@link Ext.Element#removeListener} directly on an Element in favor of calling this version. - * @param {String/HTMLElement} el The id or html element from which to remove the listener. - * @param {String} eventName The name of the event. - * @param {Function} fn The handler function to remove. This must be a reference to the function passed into the {@link #addListener} call. - * @param {Object} scope If a scope (this
reference) was specified when the listener was added,
- * then this must refer to the same object.
- */
- removeListener : function(el, eventName, fn, scope){
- el = Ext.getDom(el);
- var id = getId(el),
- f = el && (Ext.elCache[id].events)[eventName] || [],
- wrap, i, l, k, len, fnc;
-
- for (i = 0, len = f.length; i < len; i++) {
-
- /* 0 = Original Function,
- 1 = Event Manager Wrapped Function,
- 2 = Scope,
- 3 = Adapter Wrapped Function,
- 4 = Buffered Task
- */
- if (Ext.isArray(fnc = f[i]) && fnc[0] == fn && (!scope || fnc[2] == scope)) {
- if(fnc[4]) {
- fnc[4].cancel();
- }
- k = fn.tasks && fn.tasks.length;
- if(k) {
- while(k--) {
- fn.tasks[k].cancel();
- }
- delete fn.tasks;
- }
- wrap = fnc[1];
- E.un(el, eventName, E.extAdapter ? fnc[3] : wrap);
-
- // jQuery workaround that should be removed from Ext Core
- if(wrap && el.addEventListener && eventName == "mousewheel"){
- el.removeEventListener("DOMMouseScroll", wrap, false);
- }
-
- // fix stopped mousedowns on the document
- if(wrap && el == DOC && eventName == "mousedown"){
- Ext.EventManager.stoppedMouseDownEvent.removeListener(wrap);
- }
-
- f.splice(i, 1);
- if (f.length === 0) {
- delete Ext.elCache[id].events[eventName];
- }
- for (k in Ext.elCache[id].events) {
- return false;
- }
- Ext.elCache[id].events = {};
- return false;
- }
- }
- },
-
- /**
- * Removes all event handers from an element. Typically you will use {@link Ext.Element#removeAllListeners}
- * directly on an Element in favor of calling this version.
- * @param {String/HTMLElement} el The id or html element from which to remove all event handlers.
- */
- removeAll : function(el){
- el = Ext.getDom(el);
- var id = getId(el),
- ec = Ext.elCache[id] || {},
- es = ec.events || {},
- f, i, len, ename, fn, k, wrap;
-
- for(ename in es){
- if(es.hasOwnProperty(ename)){
- f = es[ename];
- /* 0 = Original Function,
- 1 = Event Manager Wrapped Function,
- 2 = Scope,
- 3 = Adapter Wrapped Function,
- 4 = Buffered Task
- */
- for (i = 0, len = f.length; i < len; i++) {
- fn = f[i];
- if(fn[4]) {
- fn[4].cancel();
- }
- if(fn[0].tasks && (k = fn[0].tasks.length)) {
- while(k--) {
- fn[0].tasks[k].cancel();
- }
- delete fn.tasks;
- }
- wrap = fn[1];
- E.un(el, ename, E.extAdapter ? fn[3] : wrap);
-
- // jQuery workaround that should be removed from Ext Core
- if(el.addEventListener && wrap && ename == "mousewheel"){
- el.removeEventListener("DOMMouseScroll", wrap, false);
- }
-
- // fix stopped mousedowns on the document
- if(wrap && el == DOC && ename == "mousedown"){
- Ext.EventManager.stoppedMouseDownEvent.removeListener(wrap);
- }
- }
- }
- }
- if (Ext.elCache[id]) {
- Ext.elCache[id].events = {};
- }
- },
-
- getListeners : function(el, eventName) {
- el = Ext.getDom(el);
- var id = getId(el),
- ec = Ext.elCache[id] || {},
- es = ec.events || {},
- results = [];
- if (es && es[eventName]) {
- return es[eventName];
- } else {
- return null;
- }
- },
-
- purgeElement : function(el, recurse, eventName) {
- el = Ext.getDom(el);
- var id = getId(el),
- ec = Ext.elCache[id] || {},
- es = ec.events || {},
- i, f, len;
- if (eventName) {
- if (es && es.hasOwnProperty(eventName)) {
- f = es[eventName];
- for (i = 0, len = f.length; i < len; i++) {
- Ext.EventManager.removeListener(el, eventName, f[i][0]);
- }
- }
- } else {
- Ext.EventManager.removeAll(el);
- }
- if (recurse && el && el.childNodes) {
- for (i = 0, len = el.childNodes.length; i < len; i++) {
- Ext.EventManager.purgeElement(el.childNodes[i], recurse, eventName);
- }
- }
- },
-
- _unload : function() {
- var el;
- for (el in Ext.elCache) {
- Ext.EventManager.removeAll(el);
- }
- delete Ext.elCache;
- delete Ext.Element._flyweights;
- },
- /**
- * Adds a listener to be notified when the document is ready (before onload and before images are loaded). Can be
- * accessed shorthanded as Ext.onReady().
- * @param {Function} fn The method the event invokes.
- * @param {Object} scope (optional) The scope (this
reference) in which the handler function executes. Defaults to the browser window.
- * @param {boolean} options (optional) Options object as passed to {@link Ext.Element#addListener}. It is recommended that the options
- * {single: true}
be used so that the handler is removed on first invocation.
- */
- onDocumentReady : function(fn, scope, options){
- if(docReadyState){ // if it already fired
- docReadyEvent.addListener(fn, scope, options);
- docReadyEvent.fire();
- docReadyEvent.listeners = []; // clearListeners no longer compatible. Force single: true?
- } else {
- if(!docReadyEvent) initDocReady();
- options = options || {};
- options.delay = options.delay || 1;
- docReadyEvent.addListener(fn, scope, options);
- }
- }
- };
- /**
- * Appends an event handler to an element. Shorthand for {@link #addListener}.
- * @param {String/HTMLElement} el The html element or id to assign the event handler to
- * @param {String} eventName The name of the event to listen for.
- * @param {Function} handler The handler function the event invokes.
- * @param {Object} scope (optional) (this
reference) in which the handler function executes. Defaults to the Element.
- * @param {Object} options (optional) An object containing standard {@link #addListener} options
- * @member Ext.EventManager
- * @method on
- */
- pub.on = pub.addListener;
- /**
- * Removes an event handler from an element. Shorthand for {@link #removeListener}.
- * @param {String/HTMLElement} el The id or html element from which to remove the listener.
- * @param {String} eventName The name of the event.
- * @param {Function} fn The handler function to remove. This must be a reference to the function passed into the {@link #on} call.
- * @param {Object} scope If a scope (this
reference) was specified when the listener was added,
- * then this must refer to the same object.
- * @member Ext.EventManager
- * @method un
- */
- pub.un = pub.removeListener;
-
- pub.stoppedMouseDownEvent = new Ext.util.Event();
- return pub;
-}();
-/**
- * Adds a listener to be notified when the document is ready (before onload and before images are loaded). Shorthand of {@link Ext.EventManager#onDocumentReady}.
- * @param {Function} fn The method the event invokes.
- * @param {Object} scope (optional) The scope (this
reference) in which the handler function executes. Defaults to the browser window.
- * @param {boolean} options (optional) Options object as passed to {@link Ext.Element#addListener}. It is recommended that the options
- * {single: true}
be used so that the handler is removed on first invocation.
- * @member Ext
- * @method onReady
- */
-Ext.onReady = Ext.EventManager.onDocumentReady;
-
-
-//Initialize doc classes
-(function(){
-
- var initExtCss = function(){
- // find the body element
- 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){ // add to the parent to allow for selectors like ".ext-strict .ext-ie"
- var p = bd.parentNode;
- if(p){
- p.className += Ext.isStrict ? ' ext-strict' : ' ext-border-box';
- }
- }
- bd.className += cls.join(' ');
- return true;
- }
-
- if(!initExtCss()){
- Ext.onReady(initExtCss);
- }
-})();
-
-
-/**
- * @class Ext.EventObject
- * Just as {@link Ext.Element} wraps around a native DOM node, Ext.EventObject
- * wraps the browser's native event-object normalizing cross-browser differences,
- * such as which mouse button is clicked, keys pressed, mechanisms to stop
- * event-propagation along with a method to prevent default actions from taking place.
- * For example:
- *
-function handleClick(e, t){ // e is not a standard event object, it is a Ext.EventObject
- e.preventDefault();
- var target = e.getTarget(); // same as t (the target HTMLElement)
- ...
-}
-var myDiv = {@link Ext#get Ext.get}("myDiv"); // get reference to an {@link Ext.Element}
-myDiv.on( // 'on' is shorthand for addListener
- "click", // perform an action on click of myDiv
- handleClick // reference to the action handler
-);
-// other methods to do the same:
-Ext.EventManager.on("myDiv", 'click', handleClick);
-Ext.EventManager.addListener("myDiv", 'click', handleClick);
-
- * @singleton
- */
-Ext.EventObject = function(){
- var E = Ext.lib.Event,
- // safari keypress events for special keys return bad keycodes
- safariKeys = {
- 3 : 13, // enter
- 63234 : 37, // left
- 63235 : 39, // right
- 63232 : 38, // up
- 63233 : 40, // down
- 63276 : 33, // page up
- 63277 : 34, // page down
- 63272 : 46, // delete
- 63273 : 36, // home
- 63275 : 35 // end
- },
- // normalize button clicks
- btnMap = Ext.isIE ? {1:0,4:1,2:2} :
- (Ext.isWebKit ? {1:0,2:1,3:2} : {0:0,1:1,2:2});
-
- Ext.EventObjectImpl = function(e){
- if(e){
- this.setEvent(e.browserEvent || e);
- }
- };
-
- Ext.EventObjectImpl.prototype = {
- /** @private */
- setEvent : function(e){
- var me = this;
- if(e == me || (e && e.browserEvent)){ // already wrapped
- return e;
- }
- me.browserEvent = e;
- if(e){
- // normalize buttons
- me.button = e.button ? btnMap[e.button] : (e.which ? e.which - 1 : -1);
- if(e.type == 'click' && me.button == -1){
- me.button = 0;
- }
- me.type = e.type;
- me.shiftKey = e.shiftKey;
- // mac metaKey behaves like ctrlKey
- me.ctrlKey = e.ctrlKey || e.metaKey || false;
- me.altKey = e.altKey;
- // in getKey these will be normalized for the mac
- me.keyCode = e.keyCode;
- me.charCode = e.charCode;
- // cache the target for the delayed and or buffered events
- me.target = E.getTarget(e);
- // same for XY
- me.xy = E.getXY(e);
- }else{
- me.button = -1;
- me.shiftKey = false;
- me.ctrlKey = false;
- me.altKey = false;
- me.keyCode = 0;
- me.charCode = 0;
- me.target = null;
- me.xy = [0, 0];
- }
- return me;
- },
-
- /**
- * Stop the event (preventDefault and stopPropagation)
- */
- stopEvent : function(){
- var me = this;
- if(me.browserEvent){
- if(me.browserEvent.type == 'mousedown'){
- Ext.EventManager.stoppedMouseDownEvent.fire(me);
- }
- E.stopEvent(me.browserEvent);
- }
- },
-
- /**
- * Prevents the browsers default handling of the event.
- */
- preventDefault : function(){
- if(this.browserEvent){
- E.preventDefault(this.browserEvent);
- }
- },
-
- /**
- * Cancels bubbling of the event.
- */
- stopPropagation : function(){
- var me = this;
- if(me.browserEvent){
- if(me.browserEvent.type == 'mousedown'){
- Ext.EventManager.stoppedMouseDownEvent.fire(me);
- }
- E.stopPropagation(me.browserEvent);
- }
- },
-
- /**
- * Gets the character code for the event.
- * @return {Number}
- */
- getCharCode : function(){
- return this.charCode || this.keyCode;
- },
-
- /**
- * Returns a normalized keyCode for the event.
- * @return {Number} The key code
- */
- getKey : function(){
- return this.normalizeKey(this.keyCode || this.charCode)
- },
-
- // private
- normalizeKey: function(k){
- return Ext.isSafari ? (safariKeys[k] || k) : k;
- },
-
- /**
- * Gets the x coordinate of the event.
- * @return {Number}
- */
- getPageX : function(){
- return this.xy[0];
- },
-
- /**
- * Gets the y coordinate of the event.
- * @return {Number}
- */
- getPageY : function(){
- return this.xy[1];
- },
-
- /**
- * Gets the page coordinates of the event.
- * @return {Array} The xy values like [x, y]
- */
- getXY : function(){
- return this.xy;
- },
-
- /**
- * Gets the target for the event.
- * @param {String} selector (optional) A simple selector to filter the target or look for an ancestor of the target
- * @param {Number/Mixed} maxDepth (optional) The max depth to
- search as a number or element (defaults to 10 || document.body)
- * @param {Boolean} returnEl (optional) True to return a Ext.Element object instead of DOM node
- * @return {HTMLelement}
- */
- getTarget : function(selector, maxDepth, returnEl){
- return selector ? Ext.fly(this.target).findParent(selector, maxDepth, returnEl) : (returnEl ? Ext.get(this.target) : this.target);
- },
-
- /**
- * Gets the related target.
- * @return {HTMLElement}
- */
- getRelatedTarget : function(){
- return this.browserEvent ? E.getRelatedTarget(this.browserEvent) : null;
- },
-
- /**
- * Normalizes mouse wheel delta across browsers
- * @return {Number} The delta
- */
- getWheelDelta : function(){
- var e = this.browserEvent;
- var delta = 0;
- if(e.wheelDelta){ /* IE/Opera. */
- delta = e.wheelDelta/120;
- }else if(e.detail){ /* Mozilla case. */
- delta = -e.detail/3;
- }
- return delta;
- },
-
- /**
- * Returns true if the target of this event is a child of el. Unless the allowEl parameter is set, it will return false if if the target is el.
- * Example usage:
- // Handle click on any child of an element
- Ext.getBody().on('click', function(e){
- if(e.within('some-el')){
- alert('Clicked on a child of some-el!');
- }
- });
-
- // Handle click directly on an element, ignoring clicks on child nodes
- Ext.getBody().on('click', function(e,t){
- if((t.id == 'some-el') && !e.within(t, true)){
- alert('Clicked directly on some-el!');
- }
- });
-
- * @param {Mixed} el The id, DOM element or Ext.Element to check
- * @param {Boolean} related (optional) true to test if the related target is within el instead of the target
- * @param {Boolean} allowEl {optional} true to also check if the passed element is the target or related target
- * @return {Boolean}
- */
- within : function(el, related, allowEl){
- if(el){
- var t = this[related ? "getRelatedTarget" : "getTarget"]();
- return t && ((allowEl ? (t == Ext.getDom(el)) : false) || Ext.fly(el).contains(t));
- }
- return false;
- }
- };
-
- return new Ext.EventObjectImpl();
-}();
-/**
-* @class Ext.EventManager
-*/
-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,
- // note 1: IE fires ONLY the keydown event on specialkey autorepeat
- // note 2: Safari < 3.1, Gecko (Mac/Linux) & Opera fire only the keypress event on specialkey autorepeat
- // (research done by @Jan Wolter at http://unixpapa.com/js/key.html)
- useKeydown = Ext.isWebKit ?
- Ext.num(navigator.userAgent.match(/AppleWebKit\/(\d+)/)[1]) >= 525 :
- !((Ext.isGecko && !Ext.isWindows) || Ext.isOpera);
-
- return {
- // private
- doResizeEvent: function(){
- var h = D.getViewHeight(),
- w = D.getViewWidth();
-
- //whacky problem in IE where the resize event will fire even though the w/h are the same.
- if(curHeight != h || curWidth != w){
- resizeEvent.fire(curWidth = w, curHeight = h);
- }
- },
-
- /**
- * Adds a listener to be notified when the browser window is resized and provides resize event buffering (100 milliseconds),
- * passes new viewport width and height to handlers.
- * @param {Function} fn The handler function the window resize event invokes.
- * @param {Object} scope The scope (this
reference) in which the handler function executes. Defaults to the browser window.
- * @param {boolean} options Options object as passed to {@link Ext.Element#addListener}
- */
- 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);
- },
-
- // exposed only to allow manual firing
- fireWindowResize : function(){
- if(resizeEvent){
- resizeTask.delay(100);
- }
- },
-
- /**
- * Adds a listener to be notified when the user changes the active text size. Handler gets called with 2 params, the old size and the new size.
- * @param {Function} fn The function the event invokes.
- * @param {Object} scope The scope (this
reference) in which the handler function executes. Defaults to the browser window.
- * @param {boolean} options Options object as passed to {@link Ext.Element#addListener}
- */
- 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);
- },
-
- /**
- * Removes the passed window resize listener.
- * @param {Function} fn The method the event invokes
- * @param {Object} scope The scope of handler
- */
- removeResizeListener : function(fn, scope){
- if(resizeEvent){
- resizeEvent.removeListener(fn, scope);
- }
- },
-
- // private
- fireResize : function(){
- if(resizeEvent){
- resizeEvent.fire(D.getViewWidth(), D.getViewHeight());
- }
- },
-
- /**
- * The frequency, in milliseconds, to check for text resize events (defaults to 50)
- */
- textResizeInterval : 50,
-
- /**
- * Url used for onDocumentReady with using SSL (defaults to Ext.SSL_SECURE_URL)
- */
- ieDeferSrc : false,
-
- // protected for use inside the framework
- // detects whether we should use keydown or keypress based on the browser.
- useKeydown: useKeydown
- };
-}());
-
-Ext.EventManager.on = Ext.EventManager.addListener;
-
-
-Ext.apply(Ext.EventObjectImpl.prototype, {
- /** Key constant @type Number */
- BACKSPACE: 8,
- /** Key constant @type Number */
- TAB: 9,
- /** Key constant @type Number */
- NUM_CENTER: 12,
- /** Key constant @type Number */
- ENTER: 13,
- /** Key constant @type Number */
- RETURN: 13,
- /** Key constant @type Number */
- SHIFT: 16,
- /** Key constant @type Number */
- CTRL: 17,
- CONTROL : 17, // legacy
- /** Key constant @type Number */
- ALT: 18,
- /** Key constant @type Number */
- PAUSE: 19,
- /** Key constant @type Number */
- CAPS_LOCK: 20,
- /** Key constant @type Number */
- ESC: 27,
- /** Key constant @type Number */
- SPACE: 32,
- /** Key constant @type Number */
- PAGE_UP: 33,
- PAGEUP : 33, // legacy
- /** Key constant @type Number */
- PAGE_DOWN: 34,
- PAGEDOWN : 34, // legacy
- /** Key constant @type Number */
- END: 35,
- /** Key constant @type Number */
- HOME: 36,
- /** Key constant @type Number */
- LEFT: 37,
- /** Key constant @type Number */
- UP: 38,
- /** Key constant @type Number */
- RIGHT: 39,
- /** Key constant @type Number */
- DOWN: 40,
- /** Key constant @type Number */
- PRINT_SCREEN: 44,
- /** Key constant @type Number */
- INSERT: 45,
- /** Key constant @type Number */
- DELETE: 46,
- /** Key constant @type Number */
- ZERO: 48,
- /** Key constant @type Number */
- ONE: 49,
- /** Key constant @type Number */
- TWO: 50,
- /** Key constant @type Number */
- THREE: 51,
- /** Key constant @type Number */
- FOUR: 52,
- /** Key constant @type Number */
- FIVE: 53,
- /** Key constant @type Number */
- SIX: 54,
- /** Key constant @type Number */
- SEVEN: 55,
- /** Key constant @type Number */
- EIGHT: 56,
- /** Key constant @type Number */
- NINE: 57,
- /** Key constant @type Number */
- A: 65,
- /** Key constant @type Number */
- B: 66,
- /** Key constant @type Number */
- C: 67,
- /** Key constant @type Number */
- D: 68,
- /** Key constant @type Number */
- E: 69,
- /** Key constant @type Number */
- F: 70,
- /** Key constant @type Number */
- G: 71,
- /** Key constant @type Number */
- H: 72,
- /** Key constant @type Number */
- I: 73,
- /** Key constant @type Number */
- J: 74,
- /** Key constant @type Number */
- K: 75,
- /** Key constant @type Number */
- L: 76,
- /** Key constant @type Number */
- M: 77,
- /** Key constant @type Number */
- N: 78,
- /** Key constant @type Number */
- O: 79,
- /** Key constant @type Number */
- P: 80,
- /** Key constant @type Number */
- Q: 81,
- /** Key constant @type Number */
- R: 82,
- /** Key constant @type Number */
- S: 83,
- /** Key constant @type Number */
- T: 84,
- /** Key constant @type Number */
- U: 85,
- /** Key constant @type Number */
- V: 86,
- /** Key constant @type Number */
- W: 87,
- /** Key constant @type Number */
- X: 88,
- /** Key constant @type Number */
- Y: 89,
- /** Key constant @type Number */
- Z: 90,
- /** Key constant @type Number */
- CONTEXT_MENU: 93,
- /** Key constant @type Number */
- NUM_ZERO: 96,
- /** Key constant @type Number */
- NUM_ONE: 97,
- /** Key constant @type Number */
- NUM_TWO: 98,
- /** Key constant @type Number */
- NUM_THREE: 99,
- /** Key constant @type Number */
- NUM_FOUR: 100,
- /** Key constant @type Number */
- NUM_FIVE: 101,
- /** Key constant @type Number */
- NUM_SIX: 102,
- /** Key constant @type Number */
- NUM_SEVEN: 103,
- /** Key constant @type Number */
- NUM_EIGHT: 104,
- /** Key constant @type Number */
- NUM_NINE: 105,
- /** Key constant @type Number */
- NUM_MULTIPLY: 106,
- /** Key constant @type Number */
- NUM_PLUS: 107,
- /** Key constant @type Number */
- NUM_MINUS: 109,
- /** Key constant @type Number */
- NUM_PERIOD: 110,
- /** Key constant @type Number */
- NUM_DIVISION: 111,
- /** Key constant @type Number */
- F1: 112,
- /** Key constant @type Number */
- F2: 113,
- /** Key constant @type Number */
- F3: 114,
- /** Key constant @type Number */
- F4: 115,
- /** Key constant @type Number */
- F5: 116,
- /** Key constant @type Number */
- F6: 117,
- /** Key constant @type Number */
- F7: 118,
- /** Key constant @type Number */
- F8: 119,
- /** Key constant @type Number */
- F9: 120,
- /** Key constant @type Number */
- F10: 121,
- /** Key constant @type Number */
- F11: 122,
- /** Key constant @type Number */
- F12: 123,
-
- /** @private */
- isNavKeyPress : function(){
- var me = this,
- k = this.normalizeKey(me.keyCode);
- return (k >= 33 && k <= 40) || // Page Up/Down, End, Home, Left, Up, Right, Down
- 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) || // Backspace
- (k >= 16 && k <= 20) || // Shift, Ctrl, Alt, Pause, Caps Lock
- (k >= 44 && k <= 45); // Print Screen, Insert
- },
-
- getPoint : function(){
- return new Ext.lib.Point(this.xy[0], this.xy[1]);
- },
-
- /**
- * Returns true if the control, meta, shift or alt key was pressed during this event.
- * @return {Boolean}
- */
- hasModifier : function(){
- return ((this.ctrlKey || this.altKey) || this.shiftKey);
- }
-});/**
* @class Ext.Element
* Encapsulates a DOM element, adding simple DOM manipulation facilities, normalizing for browser differences.
*All instances of this class inherit the methods of {@link Ext.Fx} making visual effects easily available to all DOM elements.
@@ -3835,10 +2302,7 @@ Ext.Element = function(element, forceNew){ this.id = id || Ext.id(dom); }; -var D = Ext.lib.Dom, - DH = Ext.DomHelper, - E = Ext.lib.Event, - A = Ext.lib.Anim, +var DH = Ext.DomHelper, El = Ext.Element, EC = Ext.elCache; @@ -3855,7 +2319,7 @@ El.prototype = { val, useSet = (useSet !== false) && !!el.setAttribute; - for(attr in o){ + for (attr in o) { if (o.hasOwnProperty(attr)) { val = o[attr]; if (attr == 'style') { @@ -4368,7 +2832,7 @@ el.un('click', this.handlerFn); * @return {Boolean} */ isBorderBox : function(){ - return noBoxAdjust[(this.dom.tagName || "").toLowerCase()] || Ext.isBorderBox; + return Ext.isBorderBox || Ext.isForcedBorderBox || noBoxAdjust[(this.dom.tagName || "").toLowerCase()]; }, /** @@ -4425,19 +2889,63 @@ el.un('click', this.handlerFn); * @param {String} namespace (optional) The namespace in which to look for the attribute * @return {String} The attribute value */ - 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]; + getAttribute: (function(){ + var test = document.createElement('table'), + isBrokenOnTable = false, + hasGetAttribute = 'getAttribute' in test, + unknownRe = /undefined|unknown/; + + if (hasGetAttribute) { + + try { + test.getAttribute('ext:qtip'); + } catch (e) { + isBrokenOnTable = true; + } + + return function(name, ns) { + var el = this.dom, + value; + + if (el.getAttributeNS) { + value = el.getAttributeNS(ns, name) || null; + } + + if (value == null) { + if (ns) { + if (isBrokenOnTable && el.tagName.toUpperCase() == 'TABLE') { + try { + value = el.getAttribute(ns + ':' + name); + } catch (e) { + value = ''; + } + } else { + value = el.getAttribute(ns + ':' + name); + } + } else { + value = el.getAttribute(name) || el[name]; + } + } + return value || ''; + }; + } else { + return function(name, ns) { + var el = this.om, + value, + attribute; + + if (ns) { + attribute = el[ns + ':' + name]; + value = unknownRe.test(typeof attribute) ? undefined : attribute; + } else { + value = el[name]; + } + return value || ''; + }; } - return d[name]; - } : function(name, ns){ - var d = this.dom; - return d.getAttributeNS(ns, name) || d.getAttribute(ns + ":" + name) || d.getAttribute(name) || d[name]; - }, - + test = null; + })(), + /** * Update the innerHTML of this element * @param {String} html The new HTML @@ -4535,8 +3043,15 @@ El.get = function(el){ return ex; } else if (el instanceof El) { if(el != docEl){ - el.dom = DOC.getElementById(el.id) || el.dom; // refresh dom element in case no longer valid, - // catch case where it hasn't been appended + // refresh dom element in case no longer valid, + // catch case where it hasn't been appended + + // If an el instance is passed, don't pass to getElementById without some kind of id + if (Ext.isIE && (el.id == undefined || el.id == '')) { + el.dom = el.dom; + } else { + el.dom = DOC.getElementById(el.id) || el.dom; + } } return el; } else if(el.isComposite) { @@ -4712,598 +3227,6 @@ if(Ext.isIE || Ext.isGecko){ } })(); -/** - * @class Ext.Element - */ -Ext.Element.addMethods({ - /** - * Stops the specified event(s) from bubbling and optionally prevents the default action - * @param {String/Array} eventName an event / array of events to stop from bubbling - * @param {Boolean} preventDefault (optional) true to prevent the default action too - * @return {Ext.Element} this - */ - swallowEvent : function(eventName, preventDefault){ - var me = this; - function fn(e){ - e.stopPropagation(); - if(preventDefault){ - e.preventDefault(); - } - } - if(Ext.isArray(eventName)){ - Ext.each(eventName, function(e) { - me.on(e, fn); - }); - return me; - } - me.on(eventName, fn); - return me; - }, - - /** - * Create an event handler on this element such that when the event fires and is handled by this element, - * it will be relayed to another object (i.e., fired again as if it originated from that object instead). - * @param {String} eventName The type of event to relay - * @param {Object} object Any object that extends {@link Ext.util.Observable} that will provide the context - * for firing the relayed event - */ - relayEvent : function(eventName, observable){ - this.on(eventName, function(e){ - observable.fireEvent(eventName, e); - }); - }, - - /** - * Removes worthless text nodes - * @param {Boolean} forceReclean (optional) By default the element - * keeps track if it has been cleaned already so - * you can call this over and over. However, if you update the element and - * need to force a reclean, you can pass true. - */ - clean : function(forceReclean){ - var me = this, - dom = me.dom, - n = dom.firstChild, - ni = -1; - - if(Ext.Element.data(dom, 'isCleaned') && forceReclean !== true){ - return me; - } - - while(n){ - var nx = n.nextSibling; - if(n.nodeType == 3 && !/\S/.test(n.nodeValue)){ - dom.removeChild(n); - }else{ - n.nodeIndex = ++ni; - } - n = nx; - } - Ext.Element.data(dom, 'isCleaned', true); - return me; - }, - - /** - * Direct access to the Updater {@link Ext.Updater#update} method. The method takes the same object - * parameter as {@link Ext.Updater#update} - * @return {Ext.Element} this - */ - load : function(){ - var um = this.getUpdater(); - um.update.apply(um, arguments); - return this; - }, - - /** - * Gets this element's {@link Ext.Updater Updater} - * @return {Ext.Updater} The Updater - */ - getUpdater : function(){ - return this.updateManager || (this.updateManager = new Ext.Updater(this)); - }, - - /** - * Update the innerHTML of this element, optionally searching for and processing scripts - * @param {String} html The new HTML - * @param {Boolean} loadScripts (optional) True to look for and process scripts (defaults to false) - * @param {Function} callback (optional) For async script loading you can be notified when the update completes - * @return {Ext.Element} this - */ - update : function(html, loadScripts, callback){ - if (!this.dom) { - return this; - } - html = html || ""; - - if(loadScripts !== true){ - this.dom.innerHTML = html; - if(Ext.isFunction(callback)){ - callback(); - } - return this; - } - - var id = Ext.id(), - dom = this.dom; - - html += ''; - - Ext.lib.Event.onAvailable(id, function(){ - var DOC = document, - hd = DOC.getElementsByTagName("head")[0], - re = /(?: