File: roomchat.html

package info (click to toggle)
webcit 902-dfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 8,888 kB
  • ctags: 3,854
  • sloc: ansic: 34,145; sh: 4,455; makefile: 352; xml: 91; sed: 9
file content (44 lines) | stat: -rw-r--r-- 1,406 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<div id="chatrecv_history" class="chatrecv_history_class"></div>
<div id="chatrecv" class="chatrecv_class"></div>
<div id="chat_userlist" class="chat_userlist_class"></div>
<div id="chatsend" class="chatsend_class">
	<form method="POST" onsubmit="return chatsendfunc()" action="chat_send" id="chatsendid" name="chatsendform">
	<input type="hidden" name="nonce" value="<?NONCE>">
	<img src="static/webcit_icons/essen/32x32/chat.png" alt="">
	<textarea id="send_this_id" name="send_this" rows="4" cols="78"
 		onKeyPress="chat_enter(event);"></textarea>
	<input type="submit" value="<?_("Send")>">
	<iframe style="width:0px; height:0px; border: 0px" src="static/roomchat_unload.html"></iframe>
</div>

<script type="text/javascript">

function chatsendfunc() {
	$('chatsendid').request({
		onComplete: function(){ $('send_this_id').value = '' }
	})
	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,
		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>