fix sound issues in windows

This commit is contained in:
Evgeny Gryaznov 2011-03-02 02:02:28 +01:00
parent 049def144e
commit 4257b6f87b
3 changed files with 8 additions and 24 deletions

View File

@ -11,6 +11,7 @@
[+] ability to override notification email for group
[!] various compatibility fixes: button image, captcha, check webimroot variable (installation)
[!] fix speed of history search, fix redirection to groups
[!] fix sound issues in windows
1.6.3
-----

View File

@ -22,6 +22,4 @@ document.getElementsBySelector=function(a){if(!document.getElementsByTagName)ret
if(g!=null)for(var o=0;o<g.length;o++)l[j++]=g[o]}b=[];for(j=e=0;j<l.length;j++)l[j].className&&l[j].className.match(RegExp("\\b"+d+"\\b"))&&(b[e++]=l[j])}else{if(!b[0])return;e=token;l=[];for(n=j=0;n<b.length;n++){g=b[n].getElementsByTagName(e);for(o=0;o<g.length;o++)l[j++]=g[o]}b=l}return b};
var NodeUtils={getNodeValue:function(a,b){var c=a.getElementsByTagName(b);if(c.length==0)return"";var c=c[0].childNodes,d="";for(i=0;i<c.length;i++)d+=c[i].nodeValue;return d},getNodeText:function(a){var a=a.childNodes,b="";for(i=0;i<a.length;i++)b+=a[i].nodeValue;return b},getAttrValue:function(a,b){for(k=0;k<a.attributes.length;k++)if(a.attributes[k].nodeName==b)return a.attributes[k].nodeValue;return null}},CommonUtils={getRow:function(a,b){var c=b.rows[a];if(c!=null)return c;if(b.rows.head!=null)return null;
for(k=0;k<b.rows.length;k++)if(b.rows[k].id==a)return b.rows[k];return null},getCell:function(a,b,c){var d=b.cells[a];if(d!=null)return d;if(c.rows.head!=null)return null;for(k=0;k<b.cells.length;k++)if(b.cells[k].id==a)return b.cells[k];return null},insertCell:function(a,b,c,d,e,l){a=a.insertCell(-1);a.id=b;if(d)a.align=d;a.className=c;if(e)a.height=e;a.innerHTML=l}};
function getWavMimeType(){var a="application/x-mplayer2",b=navigator.userAgent.toLowerCase();if(navigator.mimeTypes&&b.indexOf("windows")==-1&&(navigator.mimeTypes["audio/mpeg"].enabledPlugin||b.indexOf("opera")>=0))a="audio/mpeg";return a}
function playSound(a){var b=document.getElementById("player");b&&b.parentNode.removeChild(b);var b=document.body.appendChild(document.createElement("div")),c=navigator.userAgent.toLowerCase();b.innerHTML=c.indexOf("safari")==-1&&c.indexOf("windows")!=-1?'<embed type="'+getWavMimeType()+'" src="'+a+'" loop="0" autostart="1" width="0" height="0">':'<div style="position: static; width: 0px; height: 0px"><embed type="'+getWavMimeType()+'" src="'+a+'" hidden="true" loop="false" autostart="true"></div>'}
function htmlescape(a){return a.replace("&","&amp;").replace("<","&lt;").replace(">","&gt;").replace('"',"&quot;")};
function playSound(a){var b=document.createElement("div");if(navigator.userAgent.toLowerCase().indexOf("opera")!=-1)b.style="position: absolute; left: 0px; top: -200px;";document.body.appendChild(b);b.innerHTML='<embed src="'+a+'" hidden="true" autostart="true" loop="false">'}function htmlescape(a){return a.replace("&","&amp;").replace("<","&lt;").replace(">","&gt;").replace('"',"&quot;")};

27
src/messenger/webim/js/source/common.js Normal file → Executable file
View File

@ -506,29 +506,14 @@ var CommonUtils = {
}
};
function getWavMimeType() {
var mimeType = "application/x-mplayer2"; //default
var agt=navigator.userAgent.toLowerCase();
if (navigator.mimeTypes && agt.indexOf("windows")==-1) {
//non-IE, no-Windows
var plugin=navigator.mimeTypes["audio/mpeg"].enabledPlugin;
if (plugin || agt.indexOf("opera")>=0) mimeType="audio/mpeg";
}//end no-Windows
return mimeType;
}
function playSound(wav_file) {
var player = document.getElementById("player");
if (player) {
player.parentNode.removeChild(player);
}
player = document.body.appendChild(document.createElement("div"));
var agt=navigator.userAgent.toLowerCase();
if(agt.indexOf('safari') == -1 && agt.indexOf('windows') != -1) {
player.innerHTML = '<embed type="'+getWavMimeType()+'" src="'+wav_file+'" loop="0" autostart="1" width="0" height="0">';
} else {
player.innerHTML = '<div style="position: static; width: 0px; height: 0px"><embed type="'+getWavMimeType()+'" src="'+wav_file+'" hidden="true" loop="false" autostart="true"></div>';
var player = document.createElement("div");
var agt = navigator.userAgent.toLowerCase();
if(agt.indexOf('opera') != -1) {
player.style = "position: absolute; left: 0px; top: -200px;";
}
document.body.appendChild(player);
player.innerHTML = '<embed src="'+wav_file+'" hidden="true" autostart="true" loop="false">';
}
function htmlescape(str) {