Author: jleroux
Date: Mon Oct 16 02:00:36 2006
New Revision: 464419

URL: http://svn.apache.org/viewvc?view=rev&rev=464419
Log:
This commit solves https://issues.apache.org/jira/browse/OFBIZ-210 (png 
transparency in IE < 7)
Thanks to Chris Howe for his help

Added:
    incubator/ofbiz/trunk/framework/images/webapp/images/blank.gif   (with 
props)
    incubator/ofbiz/trunk/framework/images/webapp/images/pngbehavior.htc
Modified:
    incubator/ofbiz/trunk/framework/images/webapp/images/ecommain.css

Added: incubator/ofbiz/trunk/framework/images/webapp/images/blank.gif
URL: 
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/images/webapp/images/blank.gif?view=auto&rev=464419
==============================================================================
Binary file - no diff available.

Propchange: incubator/ofbiz/trunk/framework/images/webapp/images/blank.gif
------------------------------------------------------------------------------
    svn:mime-type = image/gif

Modified: incubator/ofbiz/trunk/framework/images/webapp/images/ecommain.css
URL: 
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/images/webapp/images/ecommain.css?view=diff&rev=464419&r1=464418&r2=464419
==============================================================================
--- incubator/ofbiz/trunk/framework/images/webapp/images/ecommain.css (original)
+++ incubator/ofbiz/trunk/framework/images/webapp/images/ecommain.css Mon Oct 
16 02:00:36 2006
@@ -34,6 +34,10 @@
 margin-bottom: 0;
 }
 
+img {
+behavior: url("/images/pngbehavior.htc");
+}
+
 .endcolumns {
 clear: both;
 height: 0px;
@@ -941,4 +945,4 @@
 .bothclear{
 height:1%;
 clear: both;
-}
+}
\ No newline at end of file

Added: incubator/ofbiz/trunk/framework/images/webapp/images/pngbehavior.htc
URL: 
http://svn.apache.org/viewvc/incubator/ofbiz/trunk/framework/images/webapp/images/pngbehavior.htc?view=auto&rev=464419
==============================================================================
--- incubator/ofbiz/trunk/framework/images/webapp/images/pngbehavior.htc (added)
+++ incubator/ofbiz/trunk/framework/images/webapp/images/pngbehavior.htc Mon 
Oct 16 02:00:36 2006
@@ -0,0 +1,86 @@
+<public:component lightWeight="true">
+<public:attach event="onpropertychange" onevent="propertyChanged()" />
+<public:attach event="onbeforeprint" onevent="beforePrint()" for="window"/>
+<public:attach event="onafterprint" onevent="afterPrint()" for="window"/>
+<script>
+
+/*
+ * PNG Behavior
+ *
+ * This script was created by Erik Arvidsson 
(http://webfx.eae.net/contact.html#erik)
+ * for WebFX (http://webfx.eae.net)
+ * Copyright 2002-2004
+ *
+ * For usage see license at http://webfx.eae.net/license.html
+ *
+ * Version: 1.02
+ * Created: 2001-??-?? First working version
+ * Updated: 2002-03-28 Fixed issue when starting with a non png image and
+ *                      switching between non png images
+ *          2003-01-06 Fixed RegExp to correctly work with IE 5.0x
+ *          2004-05-09  When printing revert to original
+ *
+ */
+
+var supported = /MSIE ((5\.5)|[6789])/.test(navigator.userAgent) &&
+                               navigator.platform == "Win32";
+
+var realSrc;
+var blankSrc = "/images/blank.gif";
+var isPrinting = false;
+
+if (supported) fixImage();
+
+function propertyChanged() {
+       if (!supported || isPrinting) return;
+
+       var pName = event.propertyName;
+       if (pName != "src") return;
+       // if not set to blank
+       if (!new RegExp(blankSrc).test(src))
+               fixImage();
+};
+
+function fixImage() {
+       // get src
+       var src = element.src;
+
+       // check for real change
+       if (src == realSrc && /\.png$/i.test(src)) {
+               element.src = blankSrc;
+               return;
+       }
+
+       if ( ! new RegExp(blankSrc).test(src)) {
+               // backup old src
+               realSrc = src;
+       }
+
+       // test for png
+       if (/\.png$/i.test(realSrc)) {
+               // set blank image
+               element.src = blankSrc;
+               // set filter
+               element.runtimeStyle.filter = 
"progid:DXImageTransform.Microsoft." +
+                                       "AlphaImageLoader(src='" + src + 
"',sizingMethod='scale')";
+       }
+       else {
+               // remove filter
+               element.runtimeStyle.filter = "";
+       }
+}
+
+function beforePrint() {
+       isPrinting = true;
+       element.src = realSrc;
+       element.runtimeStyle.filter = "";
+       realSrc = null;
+}
+
+function afterPrint() {
+       isPrinting = false;
+       fixImage();
+}
+
+</script>
+</public:component>


Reply via email to