f5daf0a395133391a0372a4b8e915c3ecc6e4b09
[citadel.git] / webcit / static / t / roomchat.html
1 <div id="chatrecv_history" class="chatrecv_history">
2 </div>
3 <div id="chatrecv" class="chatrecv">
4 </div>
5 <div id="chat_userlist" class="chat_userlist">
6 </div>
7 <div id="chatsend" class="chatsend">
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 </div>
15
16 <script type="text/javascript">
17
18 function chatsendfunc() {
19         $('chatsendid').request({
20                 onComplete: function(){ $('send_this_id').value = '' }
21         })
22         return false;
23 }
24
25 function chat_enter(evt) {
26         var charCode = (evt.which) ? evt.which : window.event.keyCode; 
27         if (charCode == 13) {
28                 chatsendfunc();
29         }
30 }
31
32 new Ajax.PeriodicalUpdater('chatrecv', 'chat_recv', {
33         method: 'get', frequency: 2,
34                 onSuccess: function(){ 
35                         $('chatrecv_history').innerHTML =
36                                 $('chatrecv_history').innerHTML + $('chatrecv').innerHTML;
37                         $('chatrecv').innerHTML = '';
38                         $('chatrecv_history').scrollTop = 9999999;
39                 }
40 });
41
42 new Ajax.PeriodicalUpdater('chat_userlist', 'chat_rwho', {
43         method: 'get', frequency: 15
44 });
45
46 </script>