]> code.citadel.org Git - citadel.git/blobdiff - webcit/static/t/roomchat.html
* More tweaks to the room chat window. Now displays the list of users in chat.
[citadel.git] / webcit / static / t / roomchat.html
index 87eefe009408fb9869d4141d60c6a2c6151d4b1f..f5daf0a395133391a0372a4b8e915c3ecc6e4b09 100644 (file)
@@ -1,15 +1,16 @@
-<div id="chatrecv">
-This is the receiving side of the chat window, fee fie foe foo
+<div id="chatrecv_history" class="chatrecv_history">
 </div>
-<div id="chatsend">
+<div id="chatrecv" class="chatrecv">
+</div>
+<div id="chat_userlist" class="chat_userlist">
+</div>
+<div id="chatsend" class="chatsend">
 <form method="POST" onsubmit="return chatsendfunc()" action="chat_send" id="chatsendid" name="chatsendform">
 <input type="hidden" name="nonce" value="<?NONCE>">
-<input type="text" size="80" maxlength="1024" id="send_this_id" name="send_this">
-<br />
-<input type="submit" name="send_button" value="<?_("Send")>">
-<input type="submit" name="help_button" value="<?_("Help")>">
-<input type="submit" name="list_button" value="<?_("List users")>">
-<input type="submit" name="exit_button" value="<?_("Exit")>">
+<img src="static/citadelchat_32x.gif">
+<textarea maxlength="1024" id="send_this_id" name="send_this" wrap="soft" rows="5" cols="80"
+ onKeyPress="chat_enter(event);"></textarea>
+<input type="submit" value="<?_("Send")>">
 </div>
 
 <script type="text/javascript">
@@ -21,8 +22,25 @@ function chatsendfunc() {
        return false;
 }
 
+function chat_enter(evt) {
+       var charCode = (evt.which) ? evt.which : window.event.keyCode; 
+       if (charCode == 13) {
+               chatsendfunc();
+       }
+}
+
 new Ajax.PeriodicalUpdater('chatrecv', 'chat_recv', {
-       method: 'get', frequency: 2, insertion: 'bottom'
+       method: 'get', frequency: 2,
+               onSuccess: function(){ 
+                       $('chatrecv_history').innerHTML =
+                               $('chatrecv_history').innerHTML + $('chatrecv').innerHTML;
+                       $('chatrecv').innerHTML = '';
+                       $('chatrecv_history').scrollTop = 9999999;
+               }
+});
+
+new Ajax.PeriodicalUpdater('chat_userlist', 'chat_rwho', {
+       method: 'get', frequency: 15
 });
 
 </script>