Originally posted by: mjuszczak
Originally posted by: PhatoseAlpha
I'd like that virus, please. If for no other reason then to get translucent .png support that isn't a thrice damned hack.
How does this hack work btw? I've read people doing this so called "hack".
As I recall, it involves a javascript that on the onload event of a page:
A) Tests to see if it's running in IE6
B) If it is, it looks through the entire DOM of the current page looking for images
C) If it finds an image that is a png, it replaces the png with a transparent 1x1 gif, sets the background of the image element to the png file it originally was, and then applies the DirectX filter to the background of that element.
The function below requires a global variable blankSrc, which is the string of the url to the 1x1 gif. If only fixes a png to display right - the searching is done easily enough with a DOM traversal.
function fixImage(element)
{
if (!element.runtimeStyle || (typeof document.body.style.maxHeight != "undefined")) return;
var src = element.src;
if ( /\.png$/.test( src.toLowerCase() ) )
{
element.src = blankSrc;
element.runtimeStyle.filter = "progidXImageTransform.Microsoft.AlphaImageLoader(src='" +
src + "',sizingMethod='scale')";
}
else
{
element.runtimeStyle.filter = "";
}
}
I'd give you the link to the source, but TBH, I've forgotten the source.