js: opera related fixes, typing notifications

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@60 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Evgeny Gryaznov 2008-05-05 21:41:53 +00:00
parent 61314b133c
commit 354a89a16c

View File

@ -73,6 +73,8 @@ Class.inherit( Ajax.ChatThreadUpdater, Ajax.Base, {
'&lastid=' + (this._options.lastid || 0); '&lastid=' + (this._options.lastid || 0);
if( this._options.user ) if( this._options.user )
this._options.parameters += "&user=true"; this._options.parameters += "&user=true";
if( act == 'refresh' && this._options.message && this._options.message.value != '' )
this._options.parameters += "&typed=1";
}, },
enableInput: function(val) { enableInput: function(val) {
@ -116,6 +118,7 @@ Class.inherit( Ajax.ChatThreadUpdater, Ajax.Base, {
this._options.message.focus(); this._options.message.focus();
} }
}).bind(this); }).bind(this);
if( myRealAgent != 'opera' )
this.enableInput(false); this.enableInput(false);
this.updater = new Ajax.Request(this._options.servl, postOptions); this.updater = new Ajax.Request(this._options.servl, postOptions);
}, },
@ -166,11 +169,12 @@ Class.inherit( Ajax.ChatThreadUpdater, Ajax.Base, {
for( var i = 0; i < xmlRoot.childNodes.length; i++ ) { for( var i = 0; i < xmlRoot.childNodes.length; i++ ) {
var node = xmlRoot.childNodes[i]; var node = xmlRoot.childNodes[i];
if( node.tagName == 'message' ) {
haveMessage = true; haveMessage = true;
if( node.tagName == 'message' )
this.processMessage(result_div, node); this.processMessage(result_div, node);
else if( node.tagName == 'avatar' ) } else if( node.tagName == 'avatar' ) {
this.setupAvatar(node); this.setupAvatar(node);
}
// TODO thread events // TODO thread events
} }
if( haveMessage ) { if( haveMessage ) {
@ -182,8 +186,12 @@ Class.inherit( Ajax.ChatThreadUpdater, Ajax.Base, {
handleKeyDown: function(k) { handleKeyDown: function(k) {
if( k ){ ctrl=k.ctrlKey;k=k.which; } else { k=event.keyCode;ctrl=event.ctrlKey; } if( k ){ ctrl=k.ctrlKey;k=k.which; } else { k=event.keyCode;ctrl=event.ctrlKey; }
if( this._options.message && ((k==13 && ctrl) || (k==10)) ) { if( this._options.message && ((k==13 && (ctrl || myRealAgent == 'opera')) || (k==10)) ) {
this.postMessage( this._options.message.value ); var mmsg = this._options.message.value;
if( myRealAgent == 'opera' ) {
mmsg = mmsg.replace(/[\r\n]+$/,'');
}
this.postMessage( mmsg );
return false; return false;
} }
return true; return true;
@ -282,6 +290,11 @@ Behaviour.register({
Chat.threadUpdater.postMessage(message.value); Chat.threadUpdater.postMessage(message.value);
}; };
}, },
'a#sndmessagelnk' : function(el) {
if( myRealAgent == 'opera' ) {
el.innerHTML = el.innerHTML.replace('Ctrl-','');
}
},
'select#predefined' : function(el) { 'select#predefined' : function(el) {
el.onchange = function() { el.onchange = function() {
var message = $('msgwnd'); var message = $('msgwnd');