Opera and firefox fixes

This commit is contained in:
Hexagon 2014-09-21 16:33:52 +02:00
parent 0c4c096e26
commit e13f5d18a1
3 changed files with 16 additions and 6 deletions

View File

@ -81,4 +81,5 @@ body, html {
color: #FFFFFF; color: #FFFFFF;
background-color:#141414; background-color:#141414;
height:30px;
} }

View File

@ -40,7 +40,7 @@ define('cryptalk', {
// Always clear the input after a post // Always clear the input after a post
if (clearBuffer) { if (clearBuffer) {
components.input[0].value = ''; clearInput();
} }
// Append the post to the chat DOM element // Append the post to the chat DOM element
@ -146,6 +146,11 @@ define('cryptalk', {
history_pos = -1; history_pos = -1;
}, },
// Clear input buffer
clearInput = function() {
setTimeout(function(){components.input[0].value = '';},0);
},
// Handler for the document`s keyDown-event. // Handler for the document`s keyDown-event.
onKeyDown = function (e) { onKeyDown = function (e) {
var buffer, var buffer,
@ -168,7 +173,9 @@ define('cryptalk', {
// Check for escape key, this does nothing but clear the input buffer and reset history position // Check for escape key, this does nothing but clear the input buffer and reset history position
if ( e.keyCode == 27 ) { if ( e.keyCode == 27 ) {
history_pos = -1; history_pos = -1;
components.input[0].value = ''; clearInput();
return;
} }
// Check for up or down-keys, they handle the history position // Check for up or down-keys, they handle the history position
@ -210,7 +217,7 @@ define('cryptalk', {
commands[command](payload); commands[command](payload);
// Clear input field // Clear input field
components.input[0].value = ''; clearInput();
// Save to history // Save to history
if(command !== 'key') { if(command !== 'key') {
@ -221,7 +228,7 @@ define('cryptalk', {
if (!room || !key) { if (!room || !key) {
// Push buffer to history and clear input field // Push buffer to history and clear input field
pushHistory(buffer); components.input[0].value = ''; pushHistory(buffer); clearInput();
// Make sure that the user has joined a room and the key is set // Make sure that the user has joined a room and the key is set
return (!room) ? post('error', templates.messages.msg_no_room) : post('error', templates.messages.msg_no_key); return (!room) ? post('error', templates.messages.msg_no_room) : post('error', templates.messages.msg_no_key);
@ -236,7 +243,7 @@ define('cryptalk', {
}); });
// And clear the the buffer // And clear the the buffer
components.input[0].value = ''; clearInput();
// Save to history // Save to history
pushHistory(buffer); pushHistory(buffer);

View File

@ -4,7 +4,9 @@ define('sound',{requires: ['queue']}, function (requires) {
var exports = { messages: {} }, var exports = { messages: {} },
queue = requires.queue, queue = requires.queue,
ac = new (window.AudioContext || window.webkitAudioContext || false); ac = false;
if( window.AudioContext || window.webkitAudioContext ) ac = new ( window.AudioContext || window.webkitAudioContext );
// Recursive function for playing tones, takes an array of [tone,start_ms,duration_ms] - entries // Recursive function for playing tones, takes an array of [tone,start_ms,duration_ms] - entries
// i is only used for recursion // i is only used for recursion