Move around yuval's slides
[gitmo/moose-website.git] / hosted-presentations / 2008 / nothingmuch-YAPC-Asia / ui / moose / iepngfix.htc
diff --git a/hosted-presentations/2008/nothingmuch-YAPC-Asia/ui/moose/iepngfix.htc b/hosted-presentations/2008/nothingmuch-YAPC-Asia/ui/moose/iepngfix.htc
new file mode 100644 (file)
index 0000000..bba2db7
--- /dev/null
@@ -0,0 +1,42 @@
+<public:component>\r
+<public:attach event="onpropertychange" onevent="doFix()" />\r
+\r
+<script>\r
+\r
+// IE5.5+ PNG Alpha Fix v1.0 by Angus Turnbull http://www.twinhelix.com\r
+// Free usage permitted as long as this notice remains intact.\r
+\r
+// This must be a path to a blank image. That's all the configuration you need here.\r
+var blankImg = 'ui/default/blank.gif';\r
+\r
+var f = 'DXImageTransform.Microsoft.AlphaImageLoader';\r
+\r
+function filt(s, m) {\r
+ if (filters[f]) {\r
+  filters[f].enabled = s ? true : false;\r
+  if (s) with (filters[f]) { src = s; sizingMethod = m }\r
+ } else if (s) style.filter = 'progid:'+f+'(src="'+s+'",sizingMethod="'+m+'")';\r
+}\r
+\r
+function doFix() {\r
+ if ((parseFloat(navigator.userAgent.match(/MSIE (\S+)/)[1]) < 5.5) ||\r
+  (event && !/(background|src)/.test(event.propertyName))) return;\r
+\r
+ if (tagName == 'IMG') {\r
+  if ((/\.png$/i).test(src)) {\r
+   filt(src, 'image');  // was 'scale'\r
+   src = blankImg;\r
+  } else if (src.indexOf(blankImg) < 0) filt();\r
+ } else if (style.backgroundImage) {\r
+  if (style.backgroundImage.match(/^url[("']+(.*\.png)[)"']+$/i)) {\r
+   var s = RegExp.$1;\r
+   style.backgroundImage = '';\r
+   filt(s, 'crop');\r
+  } else filt();\r
+ }\r
+}\r
+\r
+doFix();\r
+\r
+</script>\r
+</public:component>
\ No newline at end of file