Send message on enter
Docc - November 13, 2009 - 14:13
| Project: | Chat Room |
| Version: | 6.x-2.x-dev |
| Component: | User interface |
| Category: | feature request |
| Priority: | normal |
| Assigned: | justinrandell |
| Status: | closed |
Jump to:
Description
The module is coming along really well. Nice work.
Question though. How about binding a jquery listener to the textbox. So if the user press enter the message is send (and alt+enter for a new line)

#1
guess it could look something like this (shift + enter is new line)
$('#edit-chatroom-message-entry-box').keyup(function(e) {var messageText = $('#edit-chatroom-message-entry-box').val();
if (messageText && e.keyCode == 13 && !e.shiftKey) {
Drupal.chatroom.postMessage(messageText);
$('#edit-chatroom-message-entry-box').val('').focus();
};
});
#2
yes, i think this is fine. i use pidgin, and i notice that you can use both shift+enter or ctrl+enter to enter a new line, so perhaps we should support both as well?
#3
Yeah why not.
It might be a idea to look at the following jquery plugin http://code.google.com/p/js-hotkeys/
It allows easy binding of key combinations. Because i can image there will be some more shortcuts in the future? (maybe even variable) and its only 4.4kb in size.
#4
looks interesting, but will likely be after the first stable release.
i also want to bring back sound effects via a jquery plugin, so i'll be looking at how to handle adding jquery plugins as (possibly optional) dependencies at that point.
#5
oh yeah, got any opinions about #629400: make private chats controls easier to use ?
#6
committed, thanks! please reopen if you see any issues.
#7
Automatically closed -- issue fixed for 2 weeks with no activity.