streams/view/tpl/chat.tpl

60 lines
1.4 KiB
Smarty
Raw Normal View History

<div id="chatContainer" style="height: 100%; width: 100%; position: absolute; right: 0; bottom: 0;">
2014-01-30 01:09:20 +00:00
<div id="chatTopBar" style="float: left; height: 80%;"></div>
2014-01-30 01:09:20 +00:00
<div id="chatLineHolder"></div>
<div id="chatUsers" style="float: right; width: 120px; height: 100%; border: 1px solid #000;" ></div>
2014-01-30 01:09:20 +00:00
<div class="clear"></div>
<div id="chatBottomBar" style="position: absolute; bottom: 0; height: 150px;">
2014-01-30 01:09:20 +00:00
<div class="tip"></div>
2014-01-30 04:14:18 +00:00
<form id="chat-form" method="post" action="#">
<input type="hidden" name="room_id" value="{{$room_id}}" />
<textarea id="chatText" name="chat_text" rows=3 cols=80></textarea><br />
<input type="submit" name="submit" value="{{$submit}}" />
2014-01-30 01:09:20 +00:00
</form>
</div>
2014-01-30 04:14:18 +00:00
</div>
<script>
var room_id = {{$room_id}};
var last_chat = 0;
var chat_timer = null;
2014-01-30 04:14:18 +00:00
$('#chat-form').submit(function(ev) {
$('body').css('cursor','wait');
$.post("chatsvc", $('#chat-form').serialize(),function(data) {
if(chat_timer) clearTimeout(chat_timer);
$('#chatText').val('');
load_chats();
2014-01-30 04:14:18 +00:00
$('body').css('cursor','auto');
},'json');
ev.preventDefault();
});
function load_chats() {
$.get("chatsvc?f=&room_id=" + room_id + '&last=' + last_chat,function(data) {
if(data.success) {
update_inroom(data.inroom);
update_chats(data.chats);
}
});
chat_timer = setTimeout(load_chats,10000);
}
function update_inroom(inroom) {
2014-01-30 04:14:18 +00:00
}
function update_chats(chats) {
}
2014-01-30 04:14:18 +00:00
</script>