From: Richard B. <ric...@us...> - 2001-10-28 21:29:36
|
Update of /cvsroot/dynapi/dynapi/src/lib/dynapi/event In directory usw-pr-cvs1:/tmp/cvs-serv9787 Modified Files: keyboard.js Log Message: changed to return true, + added semi-colons Index: keyboard.js =================================================================== RCS file: /cvsroot/dynapi/dynapi/src/lib/dynapi/event/keyboard.js,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -r1.11 -r1.12 *** keyboard.js 2001/10/25 16:28:01 1.11 --- keyboard.js 2001/10/28 21:29:33 1.12 *************** *** 15,19 **** DynKeyEvent.prototype=new DynEvent(); DynKeyEvent.prototype.getKey=function() { ! return this.charKey }; DynKeyEvent.prototype.bubbleEvent=function() { --- 15,19 ---- DynKeyEvent.prototype=new DynEvent(); DynKeyEvent.prototype.getKey=function() { ! return this.charKey; }; DynKeyEvent.prototype.bubbleEvent=function() { *************** *** 33,39 **** if(is.def) var realsrc = Methods.getContainerLayerOf(is.ie?e.srcElement:e.target)||dynobject; else if(is.ns4) var realsrc=e.target.lyrobj; ! if (!realsrc) return; ! var evt=DynKeyEvent._e ! evt.type=e.type evt.src=realsrc; evt.browserReturn=true; --- 33,39 ---- if(is.def) var realsrc = Methods.getContainerLayerOf(is.ie?e.srcElement:e.target)||dynobject; else if(is.ns4) var realsrc=e.target.lyrobj; ! if (!realsrc) return true; ! var evt=DynKeyEvent._e; ! evt.type=e.type; evt.src=realsrc; evt.browserReturn=true; *************** *** 59,65 **** else { if (is.ns4) this.doc.captureEvents(Event.KEYPRESS | Event.KEYDOWN | Event.KEYUP); ! this.doc.onkeypress=this.doc.onkeydown=this.doc.onkeyup=DynKeyEvent.EventMethod ! } ! } DynDocument.prototype.releaseKeyEvents=function() { if(is.def&&!is.ie) { --- 59,65 ---- else { if (is.ns4) this.doc.captureEvents(Event.KEYPRESS | Event.KEYDOWN | Event.KEYUP); ! this.doc.onkeypress=this.doc.onkeydown=this.doc.onkeyup=DynKeyEvent.EventMethod; ! }; ! }; DynDocument.prototype.releaseKeyEvents=function() { if(is.def&&!is.ie) { *************** *** 70,78 **** else { if (is.ns4) this.doc.releaseEvents(Event.KEYPRESS | Event.KEYDOWN | Event.KEYUP); ! this.doc.onkeypress=this.doc.onkeydown=this.doc.onkeyup=null ! } ! } DynLayer.prototype.captureKeyEvents=function() { ! if(!this.elm) return if(is.def&&!is.ie) { this.elm.addEventListener("keydown",DynKeyEvent.EventMethod,false) --- 70,78 ---- else { if (is.ns4) this.doc.releaseEvents(Event.KEYPRESS | Event.KEYDOWN | Event.KEYUP); ! this.doc.onkeypress=this.doc.onkeydown=this.doc.onkeyup=null; ! }; ! }; DynLayer.prototype.captureKeyEvents=function() { ! if(!this.elm) return; if(is.def&&!is.ie) { this.elm.addEventListener("keydown",DynKeyEvent.EventMethod,false) *************** *** 82,90 **** else { if (is.ns4) this.elm.captureEvents(Event.KEYPRESS | Event.KEYDOWN | Event.KEYUP); ! this.elm.onkeypress=this.elm.onkeydown=this.elm.onkeyup=DynKeyEvent.EventMethod ! } ! } DynLayer.prototype.releaseKeyEvents=function() { ! if(!this.elm) return if(is.def&&!is.ie) { this.elm.removeEventListener("keydown",DynKeyEvent.EventMethod,false) --- 82,90 ---- else { if (is.ns4) this.elm.captureEvents(Event.KEYPRESS | Event.KEYDOWN | Event.KEYUP); ! this.elm.onkeypress=this.elm.onkeydown=this.elm.onkeyup=DynKeyEvent.EventMethod; ! }; ! }; DynLayer.prototype.releaseKeyEvents=function() { ! if(!this.elm) return; if(is.def&&!is.ie) { this.elm.removeEventListener("keydown",DynKeyEvent.EventMethod,false) *************** *** 94,135 **** else { if (is.ns4) this.elm.releaseEvents(Event.KEYPRESS | Event.KEYDOWN | Event.KEYUP); ! this.elm.onkeypress=this.elm.onkeydown=this.elm.onkeyup=null ! } ! } /* Overwrite methods to support key events. */ DynObject.prototype.assignKeyEvents = function() { ! if (this.hasEventListeners) this.captureKeyEvents() var l=this.children.length; ! for (var i=0; i<l; i++) this.children[i].assignKeyEvents() ! } ! DynObject.prototype._OldK_addEventListener = DynObject.prototype.addEventListener DynObject.prototype.addEventListener = function(l) { ! var r = this._OldK_addEventListener(l) ! if(this.hasEventListeners && this.created) this.captureKeyEvents() ! return r ! } ! DynObject.prototype._OldK_removeEventListener = DynObject.prototype.removeEventListener DynObject.prototype.removeEventListener = function(l) { ! var r = this._OldK_removeEventListener(l) ! if(!this.hasEventListeners) this.releaseKeyEvents() ! return r ! } ! DynObject.prototype._OldK_removeAllEventListeners = DynObject.prototype.removeAllEventListeners DynObject.prototype.removeAllEventListeners = function() { ! var r = this._OldK_removeAllEventListeners() ! this.releaseKeyEvents() ! return r ! } // DynLayer Specific ! DynLayer.prototype._OldK_specificCreate = DynLayer.prototype.specificCreate DynLayer.prototype.specificCreate = function() { ! this._OldK_specificCreate() ! this.assignKeyEvents() ! } // DynDocument specific ! DynDocument.prototype._OldK_specificCreate = DynDocument.prototype.specificCreate DynDocument.prototype.specificCreate = function() { ! this._OldK_specificCreate() ! this.assignKeyEvents() ! } --- 94,135 ---- else { if (is.ns4) this.elm.releaseEvents(Event.KEYPRESS | Event.KEYDOWN | Event.KEYUP); ! this.elm.onkeypress=this.elm.onkeydown=this.elm.onkeyup=null; ! }; ! }; /* Overwrite methods to support key events. */ DynObject.prototype.assignKeyEvents = function() { ! if (this.hasEventListeners) this.captureKeyEvents(); var l=this.children.length; ! for (var i=0; i<l; i++) this.children[i].assignKeyEvents(); ! }; ! DynObject.prototype._OldK_addEventListener = DynObject.prototype.addEventListener; DynObject.prototype.addEventListener = function(l) { ! var r = this._OldK_addEventListener(l); ! if(this.hasEventListeners && this.created) this.captureKeyEvents(); ! return r; ! }; ! DynObject.prototype._OldK_removeEventListener = DynObject.prototype.removeEventListener; DynObject.prototype.removeEventListener = function(l) { ! var r = this._OldK_removeEventListener(l); ! if(!this.hasEventListeners) this.releaseKeyEvents(); ! return r; ! }; ! DynObject.prototype._OldK_removeAllEventListeners = DynObject.prototype.removeAllEventListeners; DynObject.prototype.removeAllEventListeners = function() { ! var r = this._OldK_removeAllEventListeners(); ! this.releaseKeyEvents(); ! return r; ! }; // DynLayer Specific ! DynLayer.prototype._OldK_specificCreate = DynLayer.prototype.specificCreate; DynLayer.prototype.specificCreate = function() { ! this._OldK_specificCreate(); ! this.assignKeyEvents(); ! }; // DynDocument specific ! DynDocument.prototype._OldK_specificCreate = DynDocument.prototype.specificCreate; DynDocument.prototype.specificCreate = function() { ! this._OldK_specificCreate(); ! this.assignKeyEvents(); ! }; |