source: trunk/spip/2.1/extensions/magusine-portage2.1/javascript/pngfix.js @ 756

Last change on this file since 756 was 756, checked in by guillermoacedo@…, 14 years ago

se agrego la correccion de magusine para 2.1 basica

  • Property svn:executable set to *
File size: 1.5 KB
Line 
1/*
2 
3Correctly handle PNG transparency in Win IE 5.5 & 6.
4http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.
5
6Use in <HEAD> with DEFER keyword wrapped in conditional comments:
7<!--[if lt IE 7]>
8<script defer type="text/javascript" src="pngfix.js"></script>
9<![endif]-->
10
11*/
12
13var arVersion = navigator.appVersion.split("MSIE")
14var version = parseFloat(arVersion[1])
15
16if ((version >= 5.5) && (document.body.filters)) 
17{
18   for(var i=0; i<document.images.length; i++)
19   {
20      var img = document.images[i]
21      var imgName = img.src.toUpperCase()
22      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
23      {
24         var imgID = (img.id) ? "id='" + img.id + "' " : ""
25         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
26         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
27         var imgStyle = "display:inline-block;" + img.style.cssText 
28         if (img.align == "left") imgStyle = "float:left;" + imgStyle
29         if (img.align == "right") imgStyle = "float:right;" + imgStyle
30         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
31         var strNewHTML = "<span " + imgID + imgClass + imgTitle
32         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
33         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
34         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
35         img.outerHTML = strNewHTML
36         i = i-1
37      }
38   }
39}
Note: See TracBrowser for help on using the repository browser.