diff options
Diffstat (limited to 'view/tpl')
-rw-r--r-- | view/tpl/chat.tpl | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/view/tpl/chat.tpl b/view/tpl/chat.tpl index 19b3425da..a0c18f8d6 100644 --- a/view/tpl/chat.tpl +++ b/view/tpl/chat.tpl @@ -1,3 +1,4 @@ +<h1>{{$room_name}}</h1> <div id="chatContainer" style="height: 100%; width: 100%;"> <div id="chatTopBar" style="float: left; height: 400px; width: 650px; overflow-y: auto;"> @@ -65,7 +66,7 @@ function update_inroom(inroom) { var count = inroom.length; $.each( inroom, function(index, item) { var newNode = document.createElement('div'); - $(newNode).html('<img style="height: 32px; width: 32px;" src="' + item.img + '" alt="' + item.name + '" />'); + $(newNode).html('<img style="height: 32px; width: 32px;" src="' + item.img + '" alt="' + item.name + '" /> ' + item.status + '<br />' + item.name + '<br/>'); html.appendChild(newNode); }); $('#chatUsers').html(html); @@ -77,8 +78,10 @@ function update_chats(chats) { $.each( chats, function(index, item) { last_chat = item.id; var newNode = document.createElement('div'); - $(newNode).html('<div style="margin-bottom: 5px; clear: both;"><img style="height: 32px; width: 32px; float: left;" src="' + item.img + '" alt="' + item.name + '" /><div class="chat-body; style="float: left; width: 80%;">' + item.text + '</div></div>'); + $(newNode).html('<div style="margin-bottom: 5px; clear: both;"><img style="height: 32px; width: 32px; float: left;" src="' + item.img + '" alt="' + item.name + '" /><div class="chat-body" style="float: left; width: 80%; margin-left: 15px; font-size: 14px;">' + item.name + ' <span class="autotime" title="' + item.isotime + '">' + item.localtime + '</span><br />' + item.text + '</div></div>'); $('#chatLineHolder').append(newNode); + $(".autotime").timeago(); + }); var elem = document.getElementById('chatTopBar'); elem.scrollTop = elem.scrollHeight; @@ -86,3 +89,20 @@ function update_chats(chats) { } </script> +<script> +function isMobile() { + try{ document.createEvent("TouchEvent"); return true; } + catch(e){ return false; } +} +$(function(){ + + $('#chatText').keypress(function(e){ + if (e.keyCode == 13 && e.shiftKey||isMobile()) { + } + else if (e.keyCode == 13) { + e.preventDefault(); + $(this).parent('form').trigger('submit'); + } + }); +}); +</script> |