[wp-forums] Recent Bugs

Jeremy Visser jeremy.visser at gmail.com
Wed Sep 13 06:48:35 GMT 2006


On Wed, 2006-09-13 at 01:47 -0500, spencer wrote:
> Jeremy wrote (From forum thread):
> "The PNG file at http://wordpress.org/style/v3-head/reply.png needs to be 
> alpha-blended as a quick fix to get it to have the proper grey background."

To do with IE6 compatibility...here's a thought from what Wikipedia (or
MediaWiki in general) does:

        // png alpha transparency fixes
        function fixalpha() {
            // bg
            if (isMSIE55 && !doneIEAlphaFix)
            {
                var plogo = document.getElementById('p-logo');
                if (!plogo) return;
        
                var logoa = plogo.getElementsByTagName('a')[0];
                if (!logoa) return;
        
                var bg = logoa.currentStyle.backgroundImage;
                var imageUrl = bg.substring(5, bg.length-2);
        
                doneIEAlphaFix = true;
        
                if (imageUrl.substr(imageUrl.length-4).toLowerCase() == '.png') {
                    var logospan = logoa.appendChild(document.createElement('span'));
                   
                    logoa.style.backgroundImage = 'none';
                    logospan.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' + imageUrl + ')';
                    logospan.style.height = '100%';
                    logospan.style.position = 'absolute';
                    logospan.style.width = logoa.currentStyle.width;
                    logospan.style.cursor = 'hand';
                    // Center image with hack for IE5.5
                    if (document.documentElement.dir == "rtl") 
                    {
                      logospan.style.right = '50%';
                      logospan.style.setExpression('marginRight', '"-" + (this.offsetWidth / 2) + "px"');
                    }
                    else
                    {
                      logospan.style.left = '50%';
                      logospan.style.setExpression('marginLeft', '"-" + (this.offsetWidth / 2) + "px"');
                    }
                    logospan.style.top = '50%';
                    logospan.style.setExpression('marginTop', '"-" + (this.offsetHeight / 2) + "px"');
         
                    var linkFix = logoa.appendChild(logoa.cloneNode());
                    linkFix.style.position = 'absolute';
                    linkFix.style.height = '100%';
                    linkFix.style.width = '100%';
                }
            }
        }
        
To load it, they do a
        <!--[if lt IE 7]><script type="text/javascript" src="/skins-1.5/common/IEFixes.js"></script>

Or, we could just not give a damn about IE6 compatibility seeing as
though IE7 is just around the corner.

-- 
Jeremy Visser 
Email: jeremy.visser at gmail.com
Website: http://narnia.bounceme.net/jeremy/



More information about the wp-forums mailing list