You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by we...@apache.org on 2006/09/08 11:06:00 UTC

svn commit: r441444 - /myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/script/tobago.js

Author: weber
Date: Fri Sep  8 02:05:55 2006
New Revision: 441444

URL: http://svn.apache.org/viewvc?view=rev&rev=441444
Log:
TOBAGO-122 ( pngfix deletes all images if no activeX is enabled)

Modified:
    myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/script/tobago.js

Modified: myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/script/tobago.js
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/script/tobago.js?view=diff&rev=441444&r1=441443&r2=441444
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/script/tobago.js (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/resources/org/apache/myfaces/tobago/renderkit/html/standard/msie/script/tobago.js Fri Sep  8 02:05:55 2006
@@ -1,8 +1,11 @@
 Tobago.loadPngFix= function() {
 
     var images = document.getElementsByTagName("img");
-    var supported = /MSIE (5\.5)|[6789]/.test(navigator.userAgent) && navigator.platform == "Win32";
+    var supported = /MSIE (5\.5)|[6789]/.test(navigator.userAgent)
+                    && navigator.platform == "Win32"
+                    && Tobago.isActiveXEnabled();
 
+  
     if (! supported)  {
       return;
     }
@@ -11,12 +14,21 @@
 
       var image = images[i];
 
-      fixImage(image);
-      Tobago.addEventListener(image, 'propertyChanged', propertyChanged);
+      Tobago.fixImage(image);
+      Tobago.addEventListener(image, 'propertyChanged', Tobago.propertyChanged);
     }
   }
 
-  function propertyChanged() {
+Tobago.isActiveXEnabled = function () {
+  try {
+    new ActiveXObject("Shell.UIHelper");
+  } catch(e) {
+    return false;
+  }
+  return true;
+}
+
+Tobago.propertyChanged = function() {
 
      var pName = event.propertyName;
      if (pName != "src") return;
@@ -26,7 +38,7 @@
      }
   }
 
-  function fixImage(element) {
+Tobago.fixImage(element) = function() {
      // get src
      var src = element.src;
      // check for real change