From: Lo?c C. <lo...@us...> - 2001-04-04 23:50:04
|
Update of /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs In directory usw-pr-cvs1:/tmp/cvs-serv23204 Modified Files: misc.lib.js Log Message: An addendum to handle the history command locally Index: misc.lib.js =================================================================== RCS file: /cvsroot/phpmychat/phpMyChat-0.15/chat/lib/index_libs/misc.lib.js,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** misc.lib.js 2001/04/04 16:23:13 1.2 --- misc.lib.js 2001/04/04 23:50:00 1.3 *************** *** 173,176 **** --- 173,178 ---- // RegExp used to validate commands var re = /^\/(!$|announce .+|ban .+|clear$|help$|\?$|ignore|invite .+|join .+|kick .+|me .+|msg .+|to .+|notify$|order$|profile$|promote .+|quit|exit|bye|refresh|save|show|last|timestamp$|whois .+)/i; + // RegExp for the history command + var reHist = /^\/!$/; // Ensure the message box isn't empty *************** *** 185,188 **** --- 187,200 ---- msgBox.select(); alert(jsInvalidCommandMsg); + return false; + } + // It's the history command -> do the work + else if (isCmd && reHist.test(msgBox.value)) + { + var prevMsg = pmcGetInputForm('prevMessage'); + if (prevMsg.value == '') + alert(jsInvalidCommandMsg); + else + msgBox.value = prevMsg.value; return false; } |