[Phpfreechat-svn] SF.net SVN: phpfreechat: [1109] trunk/data/public/js/pfcclient.js
Status: Beta
Brought to you by:
kerphi
From: <gpi...@us...> - 2007-08-09 22:30:43
|
Revision: 1109 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1109&view=rev Author: gpinzone Date: 2007-08-09 15:30:42 -0700 (Thu, 09 Aug 2007) Log Message: ----------- Moved Safari function out of keypress. Misc cleanup. Modified Paths: -------------- trunk/data/public/js/pfcclient.js Modified: trunk/data/public/js/pfcclient.js =================================================================== --- trunk/data/public/js/pfcclient.js 2007-08-09 18:27:36 UTC (rev 1108) +++ trunk/data/public/js/pfcclient.js 2007-08-09 22:30:42 UTC (rev 1109) @@ -1,8 +1,8 @@ -var is_ie = window.attachEvent && !window.opera; +var is_ie = !!(window.attachEvent && !window.opera); var is_khtml = navigator.appName.match("Konqueror") || navigator.appVersion.match("KHTML"); var is_gecko = navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1; var is_ie7 = navigator.userAgent.indexOf('MSIE 7') > 0; -var is_opera = window.opera; +var is_opera = !!window.opera; var is_webkit = navigator.userAgent.indexOf('AppleWebKit/') > -1; /** @@ -614,11 +614,10 @@ /** * Cycle to older entry in history - * TODO: Fix up arrow issue in Opera */ historyUp: function() { - // write the previous command in the history + // write the previous command in the history if (this.cmdhistory.length > 0) { var w = this.el_words; @@ -626,7 +625,8 @@ this.cmdhistory.push(w.value); this.cmdhistoryissearching = true; this.cmdhistoryid = this.cmdhistoryid - 1; - if (this.cmdhistoryid < 0) this.cmdhistoryid = 0; // stop at oldest entry + if (this.cmdhistoryid < 0) + this.cmdhistoryid = 0; // stop at oldest entry w.value = this.cmdhistory[this.cmdhistoryid]; } }, @@ -673,18 +673,6 @@ { return this.doSendMessage(); } - else if (code == 63232 && is_webkit) // up arrow key - { - // write the previous command in the history - this.historyUp(); - return false; // do not leave the tab key default behavior - } - else if (code == 63233 && is_webkit) // down arrow key - { - // write the next command in the history - this.historyDown(); - return false; // do not leave the tab key default behavior - } else { /* allow other keys */ @@ -710,20 +698,24 @@ this.completeNick(); return false; /* do not leave the tab key default behavior */ } - else if (code == 38 && (is_gecko || is_ie || is_opera)) // up arrow key + else if (code == 38 && (is_gecko || is_ie || is_opera || is_webkit)) // up arrow key { + /* TODO: Fix up arrow issue in Opera */ + // Konqueror does not work due to keycode conflicts // write the previous command in the history this.historyUp(); return false; // do not leave the tab key default behavior } - else if (code == 40 && (is_gecko || is_ie || is_opera)) // down arrow key + else if (code == 40 && (is_gecko || is_ie || is_opera || is_webkit)) // down arrow key { + // Konqueror does not work due to keycode conflicts // write the next command in the history this.historyDown(); return false; // do not leave the tab key default behavior } else { + /* allow other keys */ return true; } }, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |