]>
git.wh0rd.org - tt-rss.git/blob - pngfix.js
1 // stolen from http://homepage.ntlworld.com/bobosola/pngtestfixed.htm
3 function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
5 for(var i
=0; i
<document
.images
.length
; i
++)
7 var img
= document
.images
[i
]
8 var imgName
= img
.src
.toUpperCase()
9 if (imgName
.substring(imgName
.length
-3, imgName
.length
) == "PNG")
11 var imgID
= (img
.id
) ? "id='" + img
.id
+ "' " : ""
12 var imgClass
= (img
.className
) ? "class='" + img
.className
+ "' " : ""
13 var imgTitle
= (img
.title
) ? "title='" + img
.title
+ "' " : "title='" + img
.alt
+ "' "
14 var imgStyle
= "display:inline-block;" + img
.style
.cssText
15 if (img
.align
== "left") imgStyle
= "float:left;" + imgStyle
16 if (img
.align
== "right") imgStyle
= "float:right;" + imgStyle
17 if (img
.parentElement
.href
) imgStyle
= "cursor:hand;" + imgStyle
18 var strNewHTML
= "<span " + imgID
+ imgClass
+ imgTitle
19 + " style=\"" + "width:" + img
.width
+ "px; height:" + img
.height
+ "px;" + imgStyle
+ ";"
20 + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
21 + "(src=\'" + img
.src
+ "\', sizingMethod='scale');\"></span>"
22 img
.outerHTML
= strNewHTML
27 window
.attachEvent("onload", correctPNG
);