Various fixes
This commit is contained in:
parent
c0630dcffc
commit
0c4c096e26
|
@ -12,7 +12,9 @@ define('cryptalk', {
|
|||
room,
|
||||
hash,
|
||||
nick,
|
||||
|
||||
mute = false,
|
||||
|
||||
history = [],
|
||||
history_pos = -1,
|
||||
history_keep = 4,
|
||||
|
@ -154,7 +156,8 @@ define('cryptalk', {
|
|||
|
||||
// The Document object is bound to this element.
|
||||
// If the active element is not the input, focus on it and exit the function.
|
||||
if (components.input[0] !== $.activeElement()) {
|
||||
// Ignore this when ctrl and/or alt is pressed!
|
||||
if (components.input[0] !== $.activeElement() && !e.ctrlKey && !e.altKey) {
|
||||
return components.input.focus();
|
||||
}
|
||||
|
||||
|
@ -174,7 +177,13 @@ define('cryptalk', {
|
|||
if (e.keyCode == 38 ) { history_pos = (history_pos > history.length - 2) ? -1 : history_pos = history_pos + 1; }
|
||||
else { history_pos = (history_pos <= 0) ? -1 : history_pos = history_pos - 1; }
|
||||
|
||||
return components.input[0].value = (history_pos == -1) ? '' : history[history.length-1-history_pos];
|
||||
var input = components.input[0];
|
||||
input.value = (history_pos == -1) ? '' : history[history.length-1-history_pos];
|
||||
|
||||
// Wierd hack to move caret to end of input-box
|
||||
setTimeout(function() {if(input.setSelectionRange) input.setSelectionRange(input.value.length, input.value.length);}, 0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Return immediatly if the buffer is empty or if the hit key was not <enter>
|
||||
|
@ -248,7 +257,9 @@ define('cryptalk', {
|
|||
})
|
||||
|
||||
.on('room:generated', function (data) {
|
||||
socket.emit('room:join', data);
|
||||
var sanitized = $.escapeHtml(data);
|
||||
post('server', $.template(templates.server.room_generated, { payload: sanitized }));
|
||||
socket.emit('room:join', sanitized);
|
||||
})
|
||||
|
||||
.on('room:joined', function (data) {
|
||||
|
|
|
@ -85,6 +85,7 @@ define({
|
|||
server: {
|
||||
person_joined: 'A person joined this room.',
|
||||
person_left: 'A person left this room.',
|
||||
room_generated: 'Room {payload} generated.',
|
||||
person_count: 'There is {payload} person(s) in this room, including you.',
|
||||
command_failed: 'Server command failed, you\'re probably trying to du something bogus.',
|
||||
bogus: 'Received a bogus message from server.',
|
||||
|
|
Loading…
Reference in New Issue