Here is the way I did it:
first of all,
you need : SWFObject.js file (you can download id from here :
code.google.com/p/swfobject/
.
open mod_uddeim.php
find (line ~ 921): [code:1]echo "</div>\n";[/code:1]
change it to :
[code:1] echo "</div><div id='yougotmailCont'><div id='yougotmail'></div></div>\n";[/code:1]
find : [code:1]function uddstart()[/code:1]
add right above it an new function :
[code:1]function playSound() {
/* assuming you have mootools in your template if not change below code to var myElement = document.getElementById("yougotmail"«»); */
var myElement = $("yougotmail"«»);
var flashvars = {};
var params = {
allowScriptAccess: "sameDomain"
};
var attributes = {};
swfobject.embedSWF("path/to/your/sound/file/gotmail.swf", "yougotmail", "0", "0", "9.0.0","", flashvars, params, attributes);
}[/code:1]
within the function [code:1]function uddstart()[/code:1]
at the very end, right above or below [code:1]uddfloatIn();[/code:1] add [code:1]playSound();[/code:1]
so now whole function looks something like this :
[code:1]function uddstart() {
if (document.getElementById) {
obj = document.getElementById("floaterDiv"«»);
obj.style["left"] = "-450px";
obj.style.visibility = "visible";
}
uddfloatIn();
playSound();
}[/code:1]
locate [code:1]function uddfloatOut()[/code:1]
within that function (important) and withing else block where it says something like this :
[code:1]} else {
obj.style.visibility = "hidden";
}[/code:1]
add [code:1]
var myElement1 = $("yougotmailCont"«»);
var myElement2 = $("yougotmail"«»);
myElement1.removeChild(myElement2);
var newdiv = document.createElement("div"«»);
newdiv.setAttribute("id","yougotmail"«»);
myElement1.appendChild(newdiv);[/code:1]
so now whole function looks like this :
[code:1]function uddfloatOut() {
if (document.getElementById) {
if (parseInt(obj.style["left"]) > -450) {
obj.style["left"] = parseInt(obj.style["left"]) - 20 + "px";
setTimeout("uddfloatOut()", '.$udd_leftspeed.');
} else {
obj.style.visibility = "hidden";
/* assuming you have mootools in your template if not change below code to var myElement1 =
document.getElementById("yougotmailCont"); and
var myElement2 =
document.getElementById("yougotmail"); */
var myElement1 = $("yougotmailCont"«»);
var myElement2 = $("yougotmail"«»);
myElement1.removeChild(myElement2);
var newdiv = document.createElement("div"«»);
newdiv.setAttribute("id","yougotmail"«»);
myElement1.appendChild(newdiv);
}
}
}[/code:1]
and that it, now you have you-got-mail sound playing whenever this popup comes up,
I was not able to test it when it comes up again without refresh because that feature does not work for me, but it should work, thats what this last chunk is doing removing a swl and putting back emtpy div so that on next pop loop repeats again.
P.s make sure to change the path to your swf file that plays the sound.
hth
Regards
Levan
Post edited by: dlevancho, at: 2009/10/08 06:23
Post edited by: dlevancho, at: 2009/10/08 06:37