mirror of
https://github.com/Mibew/tray.git
synced 2025-01-22 18:10:34 +03:00
[sound] play sound only on messages from remote
git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@142 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
parent
8b5dd8b097
commit
65a0ab4af8
@ -60,6 +60,8 @@ Class.inherit( Ajax.ChatThreadUpdater, Ajax.Base, {
|
|||||||
this.frequency = (this._options.frequency || 2);
|
this.frequency = (this._options.frequency || 2);
|
||||||
this.lastupdate = 0;
|
this.lastupdate = 0;
|
||||||
this.cansend = true;
|
this.cansend = true;
|
||||||
|
this.skipNextsound = true;
|
||||||
|
this.focused = true;
|
||||||
FrameUtils.initFrame(this._options.container);
|
FrameUtils.initFrame(this._options.container);
|
||||||
if( this._options.message ) {
|
if( this._options.message ) {
|
||||||
this._options.message.onkeydown = this.handleKeyDown.bind(this);
|
this._options.message.onkeydown = this.handleKeyDown.bind(this);
|
||||||
@ -120,6 +122,7 @@ Class.inherit( Ajax.ChatThreadUpdater, Ajax.Base, {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
|
this.skipNextsound = false;
|
||||||
this.timer = setTimeout(this.update.bind(this), this.frequency * 1000);
|
this.timer = setTimeout(this.update.bind(this), this.frequency * 1000);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -129,6 +132,7 @@ Class.inherit( Ajax.ChatThreadUpdater, Ajax.Base, {
|
|||||||
}
|
}
|
||||||
this.cansend = false;
|
this.cansend = false;
|
||||||
this.stopUpdate();
|
this.stopUpdate();
|
||||||
|
this.skipNextsound = true;
|
||||||
this.updateOptions("post");
|
this.updateOptions("post");
|
||||||
var postOptions = {}.extend(this._options);
|
var postOptions = {}.extend(this._options);
|
||||||
postOptions.parameters += "&message=" + encodeURIComponent(msg);
|
postOptions.parameters += "&message=" + encodeURIComponent(msg);
|
||||||
@ -225,8 +229,10 @@ Class.inherit( Ajax.ChatThreadUpdater, Ajax.Base, {
|
|||||||
}
|
}
|
||||||
if( haveMessage ) {
|
if( haveMessage ) {
|
||||||
FrameUtils.scrollDown(this._options.container);
|
FrameUtils.scrollDown(this._options.container);
|
||||||
if( !this.focused ) {
|
if(!this.skipNextsound) {
|
||||||
playSound(Chat.webimRoot+'/sounds/new_message.wav');
|
playSound(Chat.webimRoot+'/sounds/new_message.wav');
|
||||||
|
}
|
||||||
|
if( !this.focused ) {
|
||||||
window.focus();
|
window.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
var myAgent="";var mk=0;var myRealAgent="";function nk(){var qk=["\157p\u0065\u0072\u0061","\u006d\u0073\u0069e","\163\141f\141ri","fi\u0072\u0065f\157\170","\156\145\164\u0073\u0063\141p\u0065","\u006d\157\172\u0069\u006c\154a"];var ij=navigator.userAgent.toLowerCase();for(var i=0;i<qk.length;i++){var rk=qk[i];if(ij.indexOf(rk)!=-1){myAgent=rk;if(!window.RegExp)break;var sk=new RegExp(rk+"\u005b \/\135\u003f\u0028\133\u0030-\u0039]+\050\.[\u0030-\071\u005d+\051\077)");if(sk.exec(ij)!=null){mk=parseFloat(RegExp.$1);} break;} } myRealAgent=myAgent;if(navigator.product=="Ge\143k\157")myAgent="m\157z";} nk();function getEl(name){return document.getElementById(name);}
|
var myAgent="";var nk=0;var myRealAgent="";function qk(){var rk=["\157p\u0065\u0072\u0061","\u006d\u0073\u0069e","\163\141f\141ri","fi\u0072\u0065f\157\170","\156\145\164\u0073\u0063\141p\u0065","\u006d\157\172\u0069\u006c\154a"];var jj=navigator.userAgent.toLowerCase();for(var i=0;i<rk.length;i++){var sk=rk[i];if(jj.indexOf(sk)!=-1){myAgent=sk;if(!window.RegExp)break;var tk=new RegExp(sk+"\u005b \/\135\u003f\u0028\133\u0030-\u0039]+\050\.[\u0030-\071\u005d+\051\077)");if(tk.exec(jj)!=null){nk=parseFloat(RegExp.$1);} break;} } myRealAgent=myAgent;if(navigator.product=="Ge\143k\157")myAgent="m\157z";} qk();function getEl(name){return document.getElementById(name);}
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user