mirror of
https://github.com/darkwire/darkwire.io.git
synced 2025-07-18 18:54:52 +00:00
Take out autofocus on any key press and fix enter bug
This commit is contained in:
parent
197dbcdbd8
commit
a4326b65e5
@ -216,19 +216,16 @@ $(function() {
|
|||||||
// Keyboard events
|
// Keyboard events
|
||||||
|
|
||||||
$window.keydown(function (event) {
|
$window.keydown(function (event) {
|
||||||
// Auto-focus the current input when a key is typed
|
// When the client hits ENTER on their keyboard and chat message input is focused
|
||||||
if (!(event.ctrlKey || event.metaKey || event.altKey)) {
|
if (event.which === 13 && $('.inputMessage').is(':focus')) {
|
||||||
$currentInput.focus();
|
sendMessage();
|
||||||
|
socket.emit('stop typing');
|
||||||
|
typing = false;
|
||||||
}
|
}
|
||||||
// When the client hits ENTER on their keyboard
|
|
||||||
if (event.which === 13) {
|
// If enter is pressed on key input then close key modal
|
||||||
if (username) {
|
if (event.which === 13 && $('input#key').is(':focus')) {
|
||||||
sendMessage();
|
$('#key-modal').modal('hide');
|
||||||
socket.emit('stop typing');
|
|
||||||
typing = false;
|
|
||||||
} else {
|
|
||||||
setUsername();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user