cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject svn commit: r376004 - in /cocoon: branches/BRANCH_2_1_X/status.xml trunk/cocoon-ajax/cocoon-ajax-impl/src/main/java/org/apache/cocoon/ajax/resources/js/cocoon-ajax.js
Date Wed, 08 Feb 2006 17:38:04 GMT
Author: antonio
Date: Wed Feb  8 09:38:00 2006
New Revision: 376004

URL: http://svn.apache.org/viewcvs?rev=376004&view=rev
Log:
Fix COCOON-1771 - cocoon.ajax.Fader runtime error when style uses abreviated form #ccc in
IE6.0sp2. Thanks to Eric Meyer.

Modified:
    cocoon/branches/BRANCH_2_1_X/status.xml
    cocoon/trunk/cocoon-ajax/cocoon-ajax-impl/src/main/java/org/apache/cocoon/ajax/resources/js/cocoon-ajax.js

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/status.xml?rev=376004&r1=376003&r2=376004&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Wed Feb  8 09:38:00 2006
@@ -180,6 +180,9 @@
   <release version="@version@" date="@date@">
 -->
   <release version="2.1.9" date="TBD">
+    <action dev="AG" type="fix" fixes-bug="COCOON-1771" due-to="Eric Meyer" due-to-mail="eric.meyer@quoininc.com">
+      cocoon.ajax.Fader runtime error when style uses abreviated form #ccc in IE6.0sp2.
+    </action>
     <action dev="JBQ" type="add" fixes-bug="COCOON-1301" due-to="Niclas Hedhman" due-to-email="niclas@apache.org">
       Added the imageop block, an Image Operation Reader providing a fairly
       flexible and powerful Image Reader that is capable of performing a stack

Modified: cocoon/trunk/cocoon-ajax/cocoon-ajax-impl/src/main/java/org/apache/cocoon/ajax/resources/js/cocoon-ajax.js
URL: http://svn.apache.org/viewcvs/cocoon/trunk/cocoon-ajax/cocoon-ajax-impl/src/main/java/org/apache/cocoon/ajax/resources/js/cocoon-ajax.js?rev=376004&r1=376003&r2=376004&view=diff
==============================================================================
--- cocoon/trunk/cocoon-ajax/cocoon-ajax-impl/src/main/java/org/apache/cocoon/ajax/resources/js/cocoon-ajax.js
(original)
+++ cocoon/trunk/cocoon-ajax/cocoon-ajax-impl/src/main/java/org/apache/cocoon/ajax/resources/js/cocoon-ajax.js
Wed Feb  8 09:38:00 2006
@@ -57,6 +57,7 @@
         }
     }
 }
+
 cocoon.ajax.DOMUtils.ScriptRegexp = '(?:<script.*?>)((\n|.)*?)(?:<\/script>)';
 /**
  * Imports an element into a document, taking care of using the correct implementation
@@ -284,12 +285,31 @@
     this.element.style.backgroundColor = color;
 }
 
-/** Converts a "#RRGGBB" color as an array of 3 ints */
-cocoon.ajax.Fader.colorToRgb = function(hex) {
-    return [
-        parseInt(hex.substr(1,2),16),
-        parseInt(hex.substr(3,2),16),
-        parseInt(hex.substr(5,2),16) ];
+/**
+ * Converts a long hex "#RRGGBB" or short hex "#RGB" color as an array of 3 ints.
+ * If neither pattern matches, returns defaultValue or 255,255,255 if none specified.
+ */
+cocoon.ajax.Fader.colorToRgb = function(hex, defaultValues) {
+    var r = 255; // defaults if no match and no defaultValues specified
+    var g = 255;
+    var b = 255;
+
+    if (defaultValues) {
+        r = defaultValues[0];
+        g = defaultValues[1];
+        b = defaultValues[2];
+    }
+    var colors = hex.match(/^#(\d{2})(\d{2})(\d{2})$/);
+    if (colors) {
+        r = parseInt(colors[0]);
+        g = parseInt(colors[1]);
+        b = parseInt(colors[2]);
+    } else if (colors = hex.match(/^#(\d)(\d)(\d)$/)) {
+        r = parseInt(colors[0] + colors[0]);
+        g = parseInt(colors[1] + colors[1]);
+        b = parseInt(colors[2] + colors[2]);
+    }
+    return [r,g,b];
 }
 
 /** Converts rgb values to a "#RRGGBB" color */



Mime
View raw message