[Phpfreechat-svn] SF.net SVN: phpfreechat: [1113] trunk/data/public/js/pfcclient.js
Status: Beta
Brought to you by:
kerphi
From: <gpi...@us...> - 2007-08-10 20:24:27
|
Revision: 1113 http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1113&view=rev Author: gpinzone Date: 2007-08-10 13:24:20 -0700 (Fri, 10 Aug 2007) Log Message: ----------- Simplification to Nickname Completion script. Modified Paths: -------------- trunk/data/public/js/pfcclient.js Modified: trunk/data/public/js/pfcclient.js =================================================================== --- trunk/data/public/js/pfcclient.js 2007-08-10 18:17:23 UTC (rev 1112) +++ trunk/data/public/js/pfcclient.js 2007-08-10 20:24:20 UTC (rev 1113) @@ -601,7 +601,7 @@ if (nick_src != '') { var tabid = this.gui.getTabId(); - var n_list = this.getChanMeta(tabid,'users')['nick']; + var n_list = this.getChanMeta(tabid, 'users')['nick']; var nick_match = false; for (var i = 0; i < n_list.length; i++) { @@ -616,21 +616,18 @@ else { // more than one possibility for completion - // return common characters only var nick_len = Math.min(nick_tmp.length, nick_replace.length); - for (var j = 0; j < nick_len; j++) - { + // only keep characters that are common to all matches + var j = 0; + for (j = 0; j < nick_len; j++) if (nick_tmp.charAt(j) != nick_replace.charAt(j)) - { - nick_replace = nick_replace.substr(0,j); break; - } - } - nick_replace = nick_replace.substr(0,nick_len); + + nick_replace = nick_replace.substr(0, j); } } } - if (nick_match == true) + if (nick_match) w.value = w.value.replace(nick_src, nick_replace); } }, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |