Mercurial > cosocket
changeset 72:923709d7434f
We now work on the iphone, albeit not very well.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Thu, 30 Apr 2009 20:36:50 +0000 |
parents | 801c45a9063a |
children | 878871076cfa |
files | openwebchat.js |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/openwebchat.js Thu Apr 30 12:54:39 2009 -0700 +++ b/openwebchat.js Thu Apr 30 20:36:50 2009 +0000 @@ -115,6 +115,8 @@ $(window).ready( function() { var ENTER_KEYCODE = 13; + var RETURN_KEYCODE = 10; + var MAX_ANIMATING_MESSAGES = 3; var animatingMessages = 0; @@ -150,12 +152,12 @@ $('#outgoing-message').focus(); - $('#outgoing-message').keydown( - function(evt) { + function onKey(evt) { var self = this; var content = $(this).val(); var author = $('#name').val(); - if (evt.keyCode == ENTER_KEYCODE) { + if (evt.keyCode == ENTER_KEYCODE || + evt.keyCode == RETURN_KEYCODE) { if (content) { owStorage.set('lastMessage', content); $(this).val(''); @@ -172,7 +174,10 @@ } evt.preventDefault(); } - }); + } + + $('#outgoing-message').keydown(onKey); + $('#outgoing-message').keyup(onKey); function onMessage(msg) { var block = $('#templates .message').clone();