+++ /dev/null
-/*\r
- * Ext JS Library 2.2.1\r
- * Copyright(c) 2006-2009, Ext JS, LLC.\r
- * licensing@extjs.com\r
- * \r
- * http://extjs.com/license\r
- */\r
-\r
-/**\r
- * @class Ext.EventManager\r
- * Registers event handlers that want to receive a normalized EventObject instead of the standard browser event and provides\r
- * several useful events directly.\r
- * See {@link Ext.EventObject} for more details on normalized event objects.\r
- * @singleton\r
- */\r
-Ext.EventManager = function(){\r
- var docReadyEvent, docReadyProcId, docReadyState = false;\r
- var resizeEvent, resizeTask, textEvent, textSize;\r
- var E = Ext.lib.Event;\r
- var D = Ext.lib.Dom;\r
- // fix parser confusion\r
- var xname = 'Ex' + 't';\r
-\r
- var elHash = {};\r
-\r
- var addListener = function(el, ename, fn, wrap, scope){\r
- var id = Ext.id(el);\r
- if(!elHash[id]){\r
- elHash[id] = {};\r
- }\r
- var es = elHash[id];\r
- if(!es[ename]){\r
- es[ename] = [];\r
- }\r
- var ls = es[ename];\r
- ls.push({\r
- id: id,\r
- ename: ename,\r
- fn: fn,\r
- wrap: wrap,\r
- scope: scope\r
- });\r
-\r
- E.on(el, ename, wrap);\r
-\r
- if(ename == "mousewheel" && el.addEventListener){ // workaround for jQuery\r
- el.addEventListener("DOMMouseScroll", wrap, false);\r
- E.on(window, 'unload', function(){\r
- el.removeEventListener("DOMMouseScroll", wrap, false);\r
- });\r
- }\r
- if(ename == "mousedown" && el == document){ // fix stopped mousedowns on the document\r
- Ext.EventManager.stoppedMouseDownEvent.addListener(wrap);\r
- }\r
- }\r
-\r
- var removeListener = function(el, ename, fn, scope){\r
- el = Ext.getDom(el);\r
-\r
- var id = Ext.id(el), es = elHash[id], wrap;\r
- if(es){\r
- var ls = es[ename], l;\r
- if(ls){\r
- for(var i = 0, len = ls.length; i < len; i++){\r
- l = ls[i];\r
- if(l.fn == fn && (!scope || l.scope == scope)){\r
- wrap = l.wrap;\r
- E.un(el, ename, wrap);\r
- ls.splice(i, 1);\r
- break;\r
- }\r
- }\r
- }\r
- }\r
- if(ename == "mousewheel" && el.addEventListener && wrap){\r
- el.removeEventListener("DOMMouseScroll", wrap, false);\r
- }\r
- if(ename == "mousedown" && el == document && wrap){ // fix stopped mousedowns on the document\r
- Ext.EventManager.stoppedMouseDownEvent.removeListener(wrap);\r
- }\r
- }\r
-\r
- var removeAll = function(el){\r
- el = Ext.getDom(el);\r
- var id = Ext.id(el), es = elHash[id], ls;\r
- if(es){\r
- for(var ename in es){\r
- if(es.hasOwnProperty(ename)){\r
- ls = es[ename];\r
- for(var i = 0, len = ls.length; i < len; i++){\r
- E.un(el, ename, ls[i].wrap);\r
- ls[i] = null;\r
- }\r
- }\r
- es[ename] = null;\r
- }\r
- delete elHash[id];\r
- }\r
- }\r
-\r
-\r
- var fireDocReady = function(){\r
- if(!docReadyState){\r
- docReadyState = true;\r
- Ext.isReady = true;\r
- if(docReadyProcId){\r
- clearInterval(docReadyProcId);\r
- }\r
- if(Ext.isGecko || Ext.isOpera) {\r
- document.removeEventListener("DOMContentLoaded", fireDocReady, false);\r
- }\r
- if(Ext.isIE){\r
- var defer = document.getElementById("ie-deferred-loader");\r
- if(defer){\r
- defer.onreadystatechange = null;\r
- defer.parentNode.removeChild(defer);\r
- }\r
- }\r
- if(docReadyEvent){\r
- docReadyEvent.fire();\r
- docReadyEvent.clearListeners();\r
- }\r
- }\r
- };\r
-\r
- var initDocReady = function(){\r
- docReadyEvent = new Ext.util.Event();\r
- if(Ext.isGecko || Ext.isOpera) {\r
- document.addEventListener("DOMContentLoaded", fireDocReady, false);\r
- }else if(Ext.isIE){\r
- document.write("<s"+'cript id="ie-deferred-loader" defer="defer" src="/'+'/:"></s'+"cript>");\r
- var defer = document.getElementById("ie-deferred-loader");\r
- defer.onreadystatechange = function(){\r
- if(this.readyState == "complete"){\r
- fireDocReady();\r
- }\r
- };\r
- }else if(Ext.isSafari){\r
- docReadyProcId = setInterval(function(){\r
- var rs = document.readyState;\r
- if(rs == "complete") {\r
- fireDocReady();\r
- }\r
- }, 10);\r
- }\r
- // no matter what, make sure it fires on load\r
- E.on(window, "load", fireDocReady);\r
- };\r
-\r
- var createBuffered = function(h, o){\r
- var task = new Ext.util.DelayedTask(h);\r
- return function(e){\r
- // create new event object impl so new events don't wipe out properties\r
- e = new Ext.EventObjectImpl(e);\r
- task.delay(o.buffer, h, null, [e]);\r
- };\r
- };\r
-\r
- var createSingle = function(h, el, ename, fn, scope){\r
- return function(e){\r
- Ext.EventManager.removeListener(el, ename, fn, scope);\r
- h(e);\r
- };\r
- };\r
-\r
- var createDelayed = function(h, o){\r
- return function(e){\r
- // create new event object impl so new events don't wipe out properties\r
- e = new Ext.EventObjectImpl(e);\r
- setTimeout(function(){\r
- h(e);\r
- }, o.delay || 10);\r
- };\r
- };\r
-\r
- var listen = function(element, ename, opt, fn, scope){\r
- var o = (!opt || typeof opt == "boolean") ? {} : opt;\r
- fn = fn || o.fn; scope = scope || o.scope;\r
- var el = Ext.getDom(element);\r
- if(!el){\r
- throw "Error listening for \"" + ename + '\". Element "' + element + '" doesn\'t exist.';\r
- }\r
- var h = function(e){\r
- // prevent errors while unload occurring\r
- if(!window[xname]){\r
- return;\r
- }\r
- e = Ext.EventObject.setEvent(e);\r
- var t;\r
- if(o.delegate){\r
- t = e.getTarget(o.delegate, el);\r
- if(!t){\r
- return;\r
- }\r
- }else{\r
- t = e.target;\r
- }\r
- if(o.stopEvent === true){\r
- e.stopEvent();\r
- }\r
- if(o.preventDefault === true){\r
- e.preventDefault();\r
- }\r
- if(o.stopPropagation === true){\r
- e.stopPropagation();\r
- }\r
-\r
- if(o.normalized === false){\r
- e = e.browserEvent;\r
- }\r
-\r
- fn.call(scope || el, e, t, o);\r
- };\r
- if(o.delay){\r
- h = createDelayed(h, o);\r
- }\r
- if(o.single){\r
- h = createSingle(h, el, ename, fn, scope);\r
- }\r
- if(o.buffer){\r
- h = createBuffered(h, o);\r
- }\r
-\r
- addListener(el, ename, fn, h, scope);\r
- return h;\r
- };\r
-\r
- var propRe = /^(?:scope|delay|buffer|single|stopEvent|preventDefault|stopPropagation|normalized|args|delegate)$/;\r
- var pub = {\r
-\r
- /**\r
- * Appends an event handler to an element. The shorthand version {@link #on} is equivalent. Typically you will\r
- * use {@link Ext.Element#addListener} directly on an Element in favor of calling this version.\r
- * @param {String/HTMLElement} el The html element or id to assign the event handler to\r
- * @param {String} eventName The type of event to listen for\r
- * @param {Function} handler The handler function the event invokes This function is passed\r
- * the following parameters:<ul>\r
- * <li>evt : EventObject<div class="sub-desc">The {@link Ext.EventObject EventObject} describing the event.</div></li>\r
- * <li>t : Element<div class="sub-desc">The {@link Ext.Element Element} which was the target of the event.\r
- * Note that this may be filtered by using the <tt>delegate</tt> option.</div></li>\r
- * <li>o : Object<div class="sub-desc">The options object from the addListener call.</div></li>\r
- * </ul>\r
- * @param {Object} scope (optional) The scope in which to execute the handler\r
- * function (the handler function's "this" context)\r
- * @param {Object} options (optional) An object containing handler configuration properties.\r
- * This may contain any of the following properties:<ul>\r
- * <li>scope {Object} : The scope in which to execute the handler function. The handler function's "this" context.</li>\r
- * <li>delegate {String} : A simple selector to filter the target or look for a descendant of the target</li>\r
- * <li>stopEvent {Boolean} : True to stop the event. That is stop propagation, and prevent the default action.</li>\r
- * <li>preventDefault {Boolean} : True to prevent the default action</li>\r
- * <li>stopPropagation {Boolean} : True to prevent event propagation</li>\r
- * <li>normalized {Boolean} : False to pass a browser event to the handler function instead of an Ext.EventObject</li>\r
- * <li>delay {Number} : The number of milliseconds to delay the invocation of the handler after te event fires.</li>\r
- * <li>single {Boolean} : True to add a handler to handle just the next firing of the event, and then remove itself.</li>\r
- * <li>buffer {Number} : Causes the handler to be scheduled to run in an {@link Ext.util.DelayedTask} delayed\r
- * by the specified number of milliseconds. If the event fires again within that time, the original\r
- * handler is <em>not</em> invoked, but the new handler is scheduled in its place.</li>\r
- * </ul><br>\r
- * <p>See {@link Ext.Element#addListener} for examples of how to use these options.</p>\r
- */\r
- addListener : function(element, eventName, fn, scope, options){\r
- if(typeof eventName == "object"){\r
- var o = eventName;\r
- for(var e in o){\r
- if(propRe.test(e)){\r
- continue;\r
- }\r
- if(typeof o[e] == "function"){\r
- // shared options\r
- listen(element, e, o, o[e], o.scope);\r
- }else{\r
- // individual options\r
- listen(element, e, o[e]);\r
- }\r
- }\r
- return;\r
- }\r
- return listen(element, eventName, options, fn, scope);\r
- },\r
-\r
- /**\r
- * Removes an event handler from an element. The shorthand version {@link #un} is equivalent. Typically\r
- * you will use {@link Ext.Element#removeListener} directly on an Element in favor of calling this version.\r
- * @param {String/HTMLElement} el The id or html element from which to remove the event\r
- * @param {String} eventName The type of event\r
- * @param {Function} fn The handler function to remove\r
- */\r
- removeListener : function(element, eventName, fn, scope){\r
- return removeListener(element, eventName, fn, scope);\r
- },\r
-\r
- /**\r
- * Removes all event handers from an element. Typically you will use {@link Ext.Element#removeAllListeners}\r
- * directly on an Element in favor of calling this version.\r
- * @param {String/HTMLElement} el The id or html element from which to remove the event\r
- */\r
- removeAll : function(element){\r
- return removeAll(element);\r
- },\r
-\r
- /**\r
- * Fires when the document is ready (before onload and before images are loaded). Can be\r
- * accessed shorthanded as Ext.onReady().\r
- * @param {Function} fn The method the event invokes\r
- * @param {Object} scope (optional) An object that becomes the scope of the handler\r
- * @param {boolean} options (optional) An object containing standard {@link #addListener} options\r
- */\r
- onDocumentReady : function(fn, scope, options){\r
- if(docReadyState){ // if it already fired\r
- docReadyEvent.addListener(fn, scope, options);\r
- docReadyEvent.fire();\r
- docReadyEvent.clearListeners();\r
- return;\r
- }\r
- if(!docReadyEvent){\r
- initDocReady();\r
- }\r
- options = options || {};\r
- if(!options.delay){\r
- options.delay = 1;\r
- }\r
- docReadyEvent.addListener(fn, scope, options);\r
- },\r
- \r
- // private\r
- doResizeEvent: function(){\r
- resizeEvent.fire(D.getViewWidth(), D.getViewHeight());\r
- },\r
-\r
- /**\r
- * Fires when the window is resized and provides resize event buffering (50 milliseconds), passes new viewport width and height to handlers.\r
- * @param {Function} fn The method the event invokes\r
- * @param {Object} scope An object that becomes the scope of the handler\r
- * @param {boolean} options\r
- */\r
- onWindowResize : function(fn, scope, options){\r
- if(!resizeEvent){\r
- resizeEvent = new Ext.util.Event();\r
- resizeTask = new Ext.util.DelayedTask(this.doResizeEvent);\r
- E.on(window, "resize", this.fireWindowResize, this);\r
- }\r
- resizeEvent.addListener(fn, scope, options);\r
- },\r
-\r
- // exposed only to allow manual firing\r
- fireWindowResize : function(){\r
- if(resizeEvent){\r
- if((Ext.isIE||Ext.isAir) && resizeTask){\r
- resizeTask.delay(50);\r
- }else{\r
- resizeEvent.fire(D.getViewWidth(), D.getViewHeight());\r
- }\r
- }\r
- },\r
-\r
- /**\r
- * Fires when the user changes the active text size. Handler gets called with 2 params, the old size and the new size.\r
- * @param {Function} fn The method the event invokes\r
- * @param {Object} scope An object that becomes the scope of the handler\r
- * @param {boolean} options\r
- */\r
- onTextResize : function(fn, scope, options){\r
- if(!textEvent){\r
- textEvent = new Ext.util.Event();\r
- var textEl = new Ext.Element(document.createElement('div'));\r
- textEl.dom.className = 'x-text-resize';\r
- textEl.dom.innerHTML = 'X';\r
- textEl.appendTo(document.body);\r
- textSize = textEl.dom.offsetHeight;\r
- setInterval(function(){\r
- if(textEl.dom.offsetHeight != textSize){\r
- textEvent.fire(textSize, textSize = textEl.dom.offsetHeight);\r
- }\r
- }, this.textResizeInterval);\r
- }\r
- textEvent.addListener(fn, scope, options);\r
- },\r
-\r
- /**\r
- * Removes the passed window resize listener.\r
- * @param {Function} fn The method the event invokes\r
- * @param {Object} scope The scope of handler\r
- */\r
- removeResizeListener : function(fn, scope){\r
- if(resizeEvent){\r
- resizeEvent.removeListener(fn, scope);\r
- }\r
- },\r
-\r
- // private\r
- fireResize : function(){\r
- if(resizeEvent){\r
- resizeEvent.fire(D.getViewWidth(), D.getViewHeight());\r
- }\r
- },\r
- /**\r
- * Url used for onDocumentReady with using SSL (defaults to Ext.SSL_SECURE_URL)\r
- */\r
- ieDeferSrc : false,\r
- /**\r
- * The frequency, in milliseconds, to check for text resize events (defaults to 50)\r
- */\r
- textResizeInterval : 50\r
- };\r
- /**\r
- * Appends an event handler to an element. Shorthand for {@link #addListener}.\r
- * @param {String/HTMLElement} el The html element or id to assign the event handler to\r
- * @param {String} eventName The type of event to listen for\r
- * @param {Function} handler The handler function the event invokes\r
- * @param {Object} scope (optional) The scope in which to execute the handler\r
- * function (the handler function's "this" context)\r
- * @param {Object} options (optional) An object containing standard {@link #addListener} options\r
- * @member Ext.EventManager\r
- * @method on\r
- */\r
- pub.on = pub.addListener;\r
- /**\r
- * Removes an event handler from an element. Shorthand for {@link #removeListener}.\r
- * @param {String/HTMLElement} el The id or html element from which to remove the event\r
- * @param {String} eventName The type of event\r
- * @param {Function} fn The handler function to remove\r
- * @return {Boolean} True if a listener was actually removed, else false\r
- * @member Ext.EventManager\r
- * @method un\r
- */\r
- pub.un = pub.removeListener;\r
-\r
- pub.stoppedMouseDownEvent = new Ext.util.Event();\r
- return pub;\r
-}();\r
-/**\r
- * Fires when the document is ready (before onload and before images are loaded). Shorthand of {@link Ext.EventManager#onDocumentReady}.\r
- * @param {Function} fn The method the event invokes\r
- * @param {Object} scope An object that becomes the scope of the handler\r
- * @param {boolean} options (optional) An object containing standard {@link #addListener} options\r
- * @member Ext\r
- * @method onReady\r
- */\r
-Ext.onReady = Ext.EventManager.onDocumentReady;\r
-\r
-\r
-// Initialize doc classes\r
-(function(){\r
- var initExtCss = function(){\r
- // find the body element\r
- var bd = document.body || document.getElementsByTagName('body')[0];\r
- if(!bd){ return false; }\r
- var cls = [' ',\r
- Ext.isIE ? "ext-ie " + (Ext.isIE6 ? 'ext-ie6' : (Ext.isIE7 ? 'ext-ie7' : 'ext-ie8'))\r
- : Ext.isGecko ? "ext-gecko " + (Ext.isGecko2 ? 'ext-gecko2' : 'ext-gecko3')\r
- : Ext.isOpera ? "ext-opera"\r
- : Ext.isSafari ? "ext-safari"\r
- : Ext.isChrome ? "ext-chrome" : ""];\r
-\r
- if(Ext.isMac){\r
- cls.push("ext-mac");\r
- }\r
- if(Ext.isLinux){\r
- cls.push("ext-linux");\r
- }\r
- if(Ext.isBorderBox){\r
- cls.push('ext-border-box');\r
- }\r
- if(Ext.isStrict){ // add to the parent to allow for selectors like ".ext-strict .ext-ie"\r
- var p = bd.parentNode;\r
- if(p){\r
- p.className += ' ext-strict';\r
- }\r
- }\r
- bd.className += cls.join(' ');\r
- return true;\r
- }\r
-\r
- if(!initExtCss()){\r
- Ext.onReady(initExtCss);\r
- }\r
-})();\r
-\r
-/**\r
- * @class Ext.EventObject\r
- * EventObject exposes the Yahoo! UI Event functionality directly on the object\r
- * passed to your event handler. It exists mostly for convenience. It also fixes the annoying null checks automatically to cleanup your code\r
- * Example:\r
- * <pre><code>\r
- function handleClick(e){ // e is not a standard event object, it is a Ext.EventObject\r
- e.preventDefault();\r
- var target = e.getTarget();\r
- ...\r
- }\r
- var myDiv = Ext.get("myDiv");\r
- myDiv.on("click", handleClick);\r
- //or\r
- Ext.EventManager.on("myDiv", 'click', handleClick);\r
- Ext.EventManager.addListener("myDiv", 'click', handleClick);\r
- </code></pre>\r
- * @singleton\r
- */\r
-Ext.EventObject = function(){\r
-\r
- var E = Ext.lib.Event;\r
-\r
- // safari keypress events for special keys return bad keycodes\r
- var safariKeys = {\r
- 3 : 13, // enter\r
- 63234 : 37, // left\r
- 63235 : 39, // right\r
- 63232 : 38, // up\r
- 63233 : 40, // down\r
- 63276 : 33, // page up\r
- 63277 : 34, // page down\r
- 63272 : 46, // delete\r
- 63273 : 36, // home\r
- 63275 : 35 // end\r
- };\r
-\r
- // normalize button clicks\r
- var btnMap = Ext.isIE ? {1:0,4:1,2:2} :\r
- (Ext.isSafari ? {1:0,2:1,3:2} : {0:0,1:1,2:2});\r
-\r
- Ext.EventObjectImpl = function(e){\r
- if(e){\r
- this.setEvent(e.browserEvent || e);\r
- }\r
- };\r
-\r
- Ext.EventObjectImpl.prototype = {\r
- /** The normal browser event */\r
- browserEvent : null,\r
- /** The button pressed in a mouse event */\r
- button : -1,\r
- /** True if the shift key was down during the event */\r
- shiftKey : false,\r
- /** True if the control key was down during the event */\r
- ctrlKey : false,\r
- /** True if the alt key was down during the event */\r
- altKey : false,\r
-\r
- /** Key constant @type Number */\r
- BACKSPACE: 8,\r
- /** Key constant @type Number */\r
- TAB: 9,\r
- /** Key constant @type Number */\r
- NUM_CENTER: 12,\r
- /** Key constant @type Number */\r
- ENTER: 13,\r
- /** Key constant @type Number */\r
- RETURN: 13,\r
- /** Key constant @type Number */\r
- SHIFT: 16,\r
- /** Key constant @type Number */\r
- CTRL: 17,\r
- CONTROL : 17, // legacy\r
- /** Key constant @type Number */\r
- ALT: 18,\r
- /** Key constant @type Number */\r
- PAUSE: 19,\r
- /** Key constant @type Number */\r
- CAPS_LOCK: 20,\r
- /** Key constant @type Number */\r
- ESC: 27,\r
- /** Key constant @type Number */\r
- SPACE: 32,\r
- /** Key constant @type Number */\r
- PAGE_UP: 33,\r
- PAGEUP : 33, // legacy\r
- /** Key constant @type Number */\r
- PAGE_DOWN: 34,\r
- PAGEDOWN : 34, // legacy\r
- /** Key constant @type Number */\r
- END: 35,\r
- /** Key constant @type Number */\r
- HOME: 36,\r
- /** Key constant @type Number */\r
- LEFT: 37,\r
- /** Key constant @type Number */\r
- UP: 38,\r
- /** Key constant @type Number */\r
- RIGHT: 39,\r
- /** Key constant @type Number */\r
- DOWN: 40,\r
- /** Key constant @type Number */\r
- PRINT_SCREEN: 44,\r
- /** Key constant @type Number */\r
- INSERT: 45,\r
- /** Key constant @type Number */\r
- DELETE: 46,\r
- /** Key constant @type Number */\r
- ZERO: 48,\r
- /** Key constant @type Number */\r
- ONE: 49,\r
- /** Key constant @type Number */\r
- TWO: 50,\r
- /** Key constant @type Number */\r
- THREE: 51,\r
- /** Key constant @type Number */\r
- FOUR: 52,\r
- /** Key constant @type Number */\r
- FIVE: 53,\r
- /** Key constant @type Number */\r
- SIX: 54,\r
- /** Key constant @type Number */\r
- SEVEN: 55,\r
- /** Key constant @type Number */\r
- EIGHT: 56,\r
- /** Key constant @type Number */\r
- NINE: 57,\r
- /** Key constant @type Number */\r
- A: 65,\r
- /** Key constant @type Number */\r
- B: 66,\r
- /** Key constant @type Number */\r
- C: 67,\r
- /** Key constant @type Number */\r
- D: 68,\r
- /** Key constant @type Number */\r
- E: 69,\r
- /** Key constant @type Number */\r
- F: 70,\r
- /** Key constant @type Number */\r
- G: 71,\r
- /** Key constant @type Number */\r
- H: 72,\r
- /** Key constant @type Number */\r
- I: 73,\r
- /** Key constant @type Number */\r
- J: 74,\r
- /** Key constant @type Number */\r
- K: 75,\r
- /** Key constant @type Number */\r
- L: 76,\r
- /** Key constant @type Number */\r
- M: 77,\r
- /** Key constant @type Number */\r
- N: 78,\r
- /** Key constant @type Number */\r
- O: 79,\r
- /** Key constant @type Number */\r
- P: 80,\r
- /** Key constant @type Number */\r
- Q: 81,\r
- /** Key constant @type Number */\r
- R: 82,\r
- /** Key constant @type Number */\r
- S: 83,\r
- /** Key constant @type Number */\r
- T: 84,\r
- /** Key constant @type Number */\r
- U: 85,\r
- /** Key constant @type Number */\r
- V: 86,\r
- /** Key constant @type Number */\r
- W: 87,\r
- /** Key constant @type Number */\r
- X: 88,\r
- /** Key constant @type Number */\r
- Y: 89,\r
- /** Key constant @type Number */\r
- Z: 90,\r
- /** Key constant @type Number */\r
- CONTEXT_MENU: 93,\r
- /** Key constant @type Number */\r
- NUM_ZERO: 96,\r
- /** Key constant @type Number */\r
- NUM_ONE: 97,\r
- /** Key constant @type Number */\r
- NUM_TWO: 98,\r
- /** Key constant @type Number */\r
- NUM_THREE: 99,\r
- /** Key constant @type Number */\r
- NUM_FOUR: 100,\r
- /** Key constant @type Number */\r
- NUM_FIVE: 101,\r
- /** Key constant @type Number */\r
- NUM_SIX: 102,\r
- /** Key constant @type Number */\r
- NUM_SEVEN: 103,\r
- /** Key constant @type Number */\r
- NUM_EIGHT: 104,\r
- /** Key constant @type Number */\r
- NUM_NINE: 105,\r
- /** Key constant @type Number */\r
- NUM_MULTIPLY: 106,\r
- /** Key constant @type Number */\r
- NUM_PLUS: 107,\r
- /** Key constant @type Number */\r
- NUM_MINUS: 109,\r
- /** Key constant @type Number */\r
- NUM_PERIOD: 110,\r
- /** Key constant @type Number */\r
- NUM_DIVISION: 111,\r
- /** Key constant @type Number */\r
- F1: 112,\r
- /** Key constant @type Number */\r
- F2: 113,\r
- /** Key constant @type Number */\r
- F3: 114,\r
- /** Key constant @type Number */\r
- F4: 115,\r
- /** Key constant @type Number */\r
- F5: 116,\r
- /** Key constant @type Number */\r
- F6: 117,\r
- /** Key constant @type Number */\r
- F7: 118,\r
- /** Key constant @type Number */\r
- F8: 119,\r
- /** Key constant @type Number */\r
- F9: 120,\r
- /** Key constant @type Number */\r
- F10: 121,\r
- /** Key constant @type Number */\r
- F11: 122,\r
- /** Key constant @type Number */\r
- F12: 123,\r
-\r
- /** @private */\r
- setEvent : function(e){\r
- if(e == this || (e && e.browserEvent)){ // already wrapped\r
- return e;\r
- }\r
- this.browserEvent = e;\r
- if(e){\r
- // normalize buttons\r
- this.button = e.button ? btnMap[e.button] : (e.which ? e.which-1 : -1);\r
- if(e.type == 'click' && this.button == -1){\r
- this.button = 0;\r
- }\r
- this.type = e.type;\r
- this.shiftKey = e.shiftKey;\r
- // mac metaKey behaves like ctrlKey\r
- this.ctrlKey = e.ctrlKey || e.metaKey;\r
- this.altKey = e.altKey;\r
- // in getKey these will be normalized for the mac\r
- this.keyCode = e.keyCode;\r
- this.charCode = e.charCode;\r
- // cache the target for the delayed and or buffered events\r
- this.target = E.getTarget(e);\r
- // same for XY\r
- this.xy = E.getXY(e);\r
- }else{\r
- this.button = -1;\r
- this.shiftKey = false;\r
- this.ctrlKey = false;\r
- this.altKey = false;\r
- this.keyCode = 0;\r
- this.charCode = 0;\r
- this.target = null;\r
- this.xy = [0, 0];\r
- }\r
- return this;\r
- },\r
-\r
- /**\r
- * Stop the event (preventDefault and stopPropagation)\r
- */\r
- stopEvent : function(){\r
- if(this.browserEvent){\r
- if(this.browserEvent.type == 'mousedown'){\r
- Ext.EventManager.stoppedMouseDownEvent.fire(this);\r
- }\r
- E.stopEvent(this.browserEvent);\r
- }\r
- },\r
-\r
- /**\r
- * Prevents the browsers default handling of the event.\r
- */\r
- preventDefault : function(){\r
- if(this.browserEvent){\r
- E.preventDefault(this.browserEvent);\r
- }\r
- },\r
-\r
- /** @private */\r
- isNavKeyPress : function(){\r
- var k = this.keyCode;\r
- k = Ext.isSafari ? (safariKeys[k] || k) : k;\r
- return (k >= 33 && k <= 40) || k == this.RETURN || k == this.TAB || k == this.ESC;\r
- },\r
-\r
- isSpecialKey : function(){\r
- var k = this.keyCode;\r
- return (this.type == 'keypress' && this.ctrlKey) || k == 9 || k == 13 || k == 40 || k == 27 ||\r
- (k == 16) || (k == 17) ||\r
- (k >= 18 && k <= 20) ||\r
- (k >= 33 && k <= 35) ||\r
- (k >= 36 && k <= 39) ||\r
- (k >= 44 && k <= 45);\r
- },\r
-\r
- /**\r
- * Cancels bubbling of the event.\r
- */\r
- stopPropagation : function(){\r
- if(this.browserEvent){\r
- if(this.browserEvent.type == 'mousedown'){\r
- Ext.EventManager.stoppedMouseDownEvent.fire(this);\r
- }\r
- E.stopPropagation(this.browserEvent);\r
- }\r
- },\r
-\r
- /**\r
- * Gets the character code for the event.\r
- * @return {Number}\r
- */\r
- getCharCode : function(){\r
- return this.charCode || this.keyCode;\r
- },\r
-\r
- /**\r
- * Returns a normalized keyCode for the event.\r
- * @return {Number} The key code\r
- */\r
- getKey : function(){\r
- var k = this.keyCode || this.charCode;\r
- return Ext.isSafari ? (safariKeys[k] || k) : k;\r
- },\r
-\r
- /**\r
- * Gets the x coordinate of the event.\r
- * @return {Number}\r
- */\r
- getPageX : function(){\r
- return this.xy[0];\r
- },\r
-\r
- /**\r
- * Gets the y coordinate of the event.\r
- * @return {Number}\r
- */\r
- getPageY : function(){\r
- return this.xy[1];\r
- },\r
-\r
- /**\r
- * Gets the time of the event.\r
- * @return {Number}\r
- */\r
- getTime : function(){\r
- if(this.browserEvent){\r
- return E.getTime(this.browserEvent);\r
- }\r
- return null;\r
- },\r
-\r
- /**\r
- * Gets the page coordinates of the event.\r
- * @return {Array} The xy values like [x, y]\r
- */\r
- getXY : function(){\r
- return this.xy;\r
- },\r
-\r
- /**\r
- * Gets the target for the event.\r
- * @param {String} selector (optional) A simple selector to filter the target or look for an ancestor of the target\r
- * @param {Number/Mixed} maxDepth (optional) The max depth to\r
- search as a number or element (defaults to 10 || document.body)\r
- * @param {Boolean} returnEl (optional) True to return a Ext.Element object instead of DOM node\r
- * @return {HTMLelement}\r
- */\r
- getTarget : function(selector, maxDepth, returnEl){\r
- return selector ? Ext.fly(this.target).findParent(selector, maxDepth, returnEl) : (returnEl ? Ext.get(this.target) : this.target);\r
- },\r
-\r
- /**\r
- * Gets the related target.\r
- * @return {HTMLElement}\r
- */\r
- getRelatedTarget : function(){\r
- if(this.browserEvent){\r
- return E.getRelatedTarget(this.browserEvent);\r
- }\r
- return null;\r
- },\r
-\r
- /**\r
- * Normalizes mouse wheel delta across browsers\r
- * @return {Number} The delta\r
- */\r
- getWheelDelta : function(){\r
- var e = this.browserEvent;\r
- var delta = 0;\r
- if(e.wheelDelta){ /* IE/Opera. */\r
- delta = e.wheelDelta/120;\r
- }else if(e.detail){ /* Mozilla case. */\r
- delta = -e.detail/3;\r
- }\r
- return delta;\r
- },\r
-\r
- /**\r
- * Returns true if the control, meta, shift or alt key was pressed during this event.\r
- * @return {Boolean}\r
- */\r
- hasModifier : function(){\r
- return ((this.ctrlKey || this.altKey) || this.shiftKey) ? true : false;\r
- },\r
-\r
- /**\r
- * 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.\r
- * Example usage:<pre><code>\r
-// Handle click on any child of an element\r
-Ext.getBody().on('click', function(e){\r
- if(e.within('some-el')){\r
- alert('Clicked on a child of some-el!');\r
- }\r
-});\r
-\r
-// Handle click directly on an element, ignoring clicks on child nodes\r
-Ext.getBody().on('click', function(e,t){\r
- if((t.id == 'some-el') && !e.within(t, true)){\r
- alert('Clicked directly on some-el!');\r
- }\r
-});\r
-</code></pre>\r
- * @param {Mixed} el The id, DOM element or Ext.Element to check\r
- * @param {Boolean} related (optional) true to test if the related target is within el instead of the target\r
- * @param {Boolean} allowEl {optional} true to also check if the passed element is the target or related target\r
- * @return {Boolean}\r
- */\r
- within : function(el, related, allowEl){\r
- var t = this[related ? "getRelatedTarget" : "getTarget"]();\r
- return t && ((allowEl ? (t === Ext.getDom(el)) : false) || Ext.fly(el).contains(t));\r
- },\r
-\r
- getPoint : function(){\r
- return new Ext.lib.Point(this.xy[0], this.xy[1]);\r
- }\r
- };\r
-\r
- return new Ext.EventObjectImpl();\r
-}();
\ No newline at end of file