[2141253] Play sound when visitor appears in the queue

git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@130 c66351dc-e62f-0410-b875-e3a5c0b9693f
This commit is contained in:
Evgeny Gryaznov 2008-10-01 22:56:46 +00:00
parent dc955f55b7
commit 9ca2afb981
9 changed files with 18 additions and 4 deletions

View File

@ -226,6 +226,7 @@ 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.focused ) {
playSound(Chat.webimRoot+'/sounds/new_message.wav');
window.focus(); window.focus();
} }
} }

View File

@ -519,3 +519,15 @@ var CommonUtils = {
} }
}; };
function playSound(wav_file) {
var player = document.getElementById("player");
if (player) {
player.parentNode.removeChild(player);
}
player = document.body.appendChild(document.createElement("div"));
if(navigator.userAgent.indexOf('MSIE') != -1) {
player.innerHTML = '<bgsound src="'+wav_file+'">';
} else {
player.innerHTML = '<div style="position: static; width: 0px; height: 0px"><embed type="audio/mpeg" src="'+wav_file+'" hidden="true" loop="false" autostart="true"></div>';
}
}

View File

@ -298,6 +298,7 @@ Class.inherit( Ajax.ThreadListUpdater, Ajax.Base, {
this.updateTimers(); this.updateTimers();
this.setStatus( "Up to date" ); this.setStatus( "Up to date" );
if( newAdded ) { if( newAdded ) {
playSound(webimRoot+'/sounds/new_user.wav');
window.focus(); window.focus();
} }
} else if( root.tagName == 'error' ) { } else if( root.tagName == 'error' ) {

View File

@ -1 +1 @@
var myAgent="";var yj=0;var myRealAgent="";function zj(){var $j=["\u006f\u0070\145r\141","\155\u0073\u0069e","\u0073\141\146a\162i","fire\146\u006f\170","\u006eets\143\u0061\u0070\u0065","m\u006f\172illa"];var sj=navigator.userAgent.toLowerCase();for(var i=0;i<$j.length;i++){var _j=$j[i];if(sj.indexOf(_j)!=-1){myAgent=_j;if(!window.RegExp)break;var mk=new RegExp(_j+"\133\040\/\u005d?\050\1330\u002d9]+\u0028\.\1330-\u0039]+)?)");if(mk.exec(sj)!=null){yj=parseFloat(RegExp.$1);} break;} } myRealAgent=myAgent;if(navigator.product=="\107\145\u0063\153\u006f")myAgent="mo\u007a";} zj();function getEl(name){return document.getElementById(name);} var myAgent="";var _j=0;var myRealAgent="";function mk(){var nk=["\157\u0070e\u0072\u0061","msi\u0065","s\u0061\u0066\141\u0072\151","\u0066iref\157\u0078","\156et\u0073\143\141p\145","m\u006fz\u0069\u006cla"];var hj=navigator.userAgent.toLowerCase();for(var i=0;i<nk.length;i++){var qk=nk[i];if(hj.indexOf(qk)!=-1){myAgent=qk;if(!window.RegExp)break;var rk=new RegExp(qk+"[\040\/]?\u0028[0\0559\u005d\u002b\050\.\u005b\u0030\055\u0039\135+)\077\u0029");if(rk.exec(hj)!=null){_j=parseFloat(RegExp.$1);} break;} } myRealAgent=myAgent;if(navigator.product=="\107\145\u0063k\u006f")myAgent="\u006do\u007a";} mk();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

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.