* Make the class names different from the div id's
[citadel.git] / webcit / static / t / roomchat.html
1 <div id="chatrecv_history" class="chatrecv_history_class">
2 </div>
3 <div id="chatrecv" class="chatrecv_class">
4 </div>
5 <div id="chat_userlist" class="chat_userlist_class">
6 </div>
7 <div id="chatsend" class="chatsend_class">
8 <form method="POST" onsubmit="return chatsendfunc()" action="chat_send" id="chatsendid" name="chatsendform">
9 <input type="hidden" name="nonce" value="<?NONCE>">
10 <img src="static/citadelchat_32x.gif">
11 <textarea maxlength="1024" id="send_this_id" name="send_this" wrap="soft" rows="5" cols="80"
12  onKeyPress="chat_enter(event);"></textarea>
13 <input type="submit" value="<?_("Send")>">
14 <iframe style="width:0px; height:0px; border: 0px" src="static/roomchat_unload.html"></iframe>
15 </div>
16
17 <script type="text/javascript">
18
19 function chatsendfunc() {
20         $('chatsendid').request({
21                 onComplete: function(){ $('send_this_id').value = '' }
22         })
23         return false;
24 }
25
26 function chat_enter(evt) {
27         var charCode = (evt.which) ? evt.which : window.event.keyCode; 
28         if (charCode == 13) {
29                 chatsendfunc();
30         }
31 }
32
33 new Ajax.PeriodicalUpdater('chatrecv', 'chat_recv', {
34         method: 'get', frequency: 2,
35                 onSuccess: function(){ 
36                         $('chatrecv_history').innerHTML =
37                                 $('chatrecv_history').innerHTML + $('chatrecv').innerHTML;
38                         $('chatrecv').innerHTML = '';
39                         $('chatrecv_history').scrollTop = 9999999;
40                 }
41 });
42
43 new Ajax.PeriodicalUpdater('chat_userlist', 'chat_rwho', {
44         method: 'get', frequency: 15
45 });
46
47 </script>