home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2005 March
/
PCWorld_2005-03_cd.bin
/
komunikace
/
kmeleon
/
kmeleon09.exe
/
flashblock.jar
/
content
/
flashblock
/
flash.xml
< prev
next >
Wrap
Extensible Markup Language
|
2004-12-05
|
2KB
|
91 lines
<?xml version="1.0"?>
<bindings
xmlns="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml"
>
<binding id="flashblock">
<implementation>
<constructor>
<![CDATA[
// Check if the page that loaded the Flash site is whitelisted
// Thanks to Neil on #mozilla for suggesting this method, I would never have
// thought of it on my own. :-)
var event = document.createEvent("Events");
event.initEvent("flashblockCheckLoad", true, true);
document.dispatchEvent(event);
if(event.getPreventDefault() == true) {
// Whitelisted
return;
}
var current = this;
// Check parent too (case of working EMBED inside broken OBJECT)
if (current.overrideCTV || current.parentNode.overrideCTV) {
return;
}
current.overrideCTV = true;
var placeholder = document.createElement("img");
// Set size to minimum 32x32 px.
var wdth = parseInt(current.width || current.style.width);
var higt = parseInt(current.height || current.style.height);
if (!wdth || wdth < 32) {
wdth = 32;
}
if (!higt || higt < 32) {
higt = 32;
}
// Add styling rules to placeholder div.
placeholder.src = "chrome://flashblock/content/spacer.gif";
placeholder.style.width = wdth + "px";
placeholder.style.height = higt + "px";
placeholder.style.background = "url(chrome://flashblock/content/flash.png) no-repeat center";
placeholder.style.MozOutline = "1px solid #dfdfdf";
placeholder.style.cursor = "pointer";
placeholder.style.overflow = "hidden";
// Change the placeholder background when the mouse enters/exits the div.
placeholder.onmouseover = function()
{
this.style.background = "url(chrome://flashblock/content/flashplay.png) no-repeat center";
}
placeholder.onmouseout = function()
{
this.style.background = "url(chrome://flashblock/content/flash.png) no-repeat center";
}
var parent = current.parentNode;
// Replace the flash document with a placeholder.
// Timeout is to avoid unspecified bugginess mentioned in Jesse's origional code.
setTimeout ( function ()
{
parent.insertBefore(placeholder, current);
parent.removeChild(current);
}, 100);
// Replace the placeholder with the flash document.
placeholder.onclick = function()
{
parent.insertBefore(current, placeholder);
parent.removeChild(placeholder);
}
]]>
</constructor>
</implementation>
</binding>
</bindings>