[Phpfreechat-svn] SF.net SVN: phpfreechat: [1101] trunk/data/public/js/pfcclient.js
Status: Beta
Brought to you by:
kerphi
From: <gpi...@us...> - 2007-08-08 20:32:36
|
Revision: 1101 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1101&view=rev Author: gpinzone Date: 2007-08-08 13:32:35 -0700 (Wed, 08 Aug 2007) Log Message: ----------- Command history fix for IE. Changed keys to Arrow Up/Down to emulate functionality in most IRC clients. Explorer doesn't fire the "keypress" event for Page Up/Down. Moved code to "keydown" area since "keypress" detection is too unreliable for some browsers. Tested on FF 2, IE 6, IE 7, and Opera. Ref: http://www.quirksmode.org/js/keys.html Modified Paths: -------------- trunk/data/public/js/pfcclient.js Modified: trunk/data/public/js/pfcclient.js =================================================================== --- trunk/data/public/js/pfcclient.js 2007-08-08 07:17:57 UTC (rev 1100) +++ trunk/data/public/js/pfcclient.js 2007-08-08 20:32:35 UTC (rev 1101) @@ -25,9 +25,9 @@ this.chanmeta = $H(); this.nickwhoisbox = $H(); - // this array contains all the sent command - // used the up and down key to navigate in the history - // (doesn't work on IE6) + // this array contains all the sent commands + // use the up and down arrow key to navigate through the history + // may not work in Safari 1.3 this.cmdhistory = Array(); this.cmdhistoryid = -1; this.cmdhistoryissearching = false; @@ -627,8 +627,30 @@ { return this.doSendMessage(); } - else if (code == 33 && false) // page up key + else { + /* allow other keys */ + return true; + } + }, + /** + * Handle the pressed keys + * see also callbackWords_OnKeypress + */ + callbackWords_OnKeydown: function(evt) + { + if (!this.isconnected) return false; + this.clearError(Array(this.el_words)); + var code = (evt.which) ? evt.which : evt.keyCode + if (code == 9) /* tab key */ + { + /* IE workaround : ignore TAB key here */ + /* do the nickname completion work like on IRC */ + this.completeNick(); + return false; /* do not leave the tab key default behavior */ + } + else if (code == 38) // up arrow key + { // write the last command in the history if (this.cmdhistory.length>0) { @@ -641,7 +663,7 @@ w.value = this.cmdhistory[this.cmdhistoryid]; } } - else if (code == 34 && false) // page down key + else if (code == 40) // down arrow key { // write the next command in the history if (this.cmdhistory.length>0) @@ -657,31 +679,9 @@ } else { - /* allow other keys */ return true; } }, - /** - * Handle the pressed keys - * see also callbackWords_OnKeypress - */ - callbackWords_OnKeydown: function(evt) - { - if (!this.isconnected) return false; - this.clearError(Array(this.el_words)); - var code = (evt.which) ? evt.which : evt.keyCode - if (code == 9) /* tab key */ - { - /* IE workaround : ignore TAB key here */ - /* do the nickname completion work like on IRC */ - this.completeNick(); - return false; /* do not leave the tab key default behavior */ - } - else - { - return true; - } - }, callbackWords_OnFocus: function(evt) { // if (this.el_handle && this.el_handle.value == '' && !this.minmax_status) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |