iepngfix.htc 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <public:component>
  2. <public:attach event="onpropertychange" onevent="doFix()" />
  3. <script>
  4. // IE5.5+ PNG Alpha Fix v1.0 by Angus Turnbull http://www.twinhelix.com
  5. // Free usage permitted as long as this notice remains intact.
  6. // This must be a path to a blank image. That's all the configuration you need here.
  7. var blankImg = 'ui/default/blank.gif';
  8. var f = 'DXImageTransform.Microsoft.AlphaImageLoader';
  9. function filt(s, m) {
  10. if (filters[f]) {
  11. filters[f].enabled = s ? true : false;
  12. if (s) with (filters[f]) { src = s; sizingMethod = m }
  13. } else if (s) style.filter = 'progid:'+f+'(src="'+s+'",sizingMethod="'+m+'")';
  14. }
  15. function doFix() {
  16. if ((parseFloat(navigator.userAgent.match(/MSIE (\S+)/)[1]) < 5.5) ||
  17. (event && !/(background|src)/.test(event.propertyName))) return;
  18. if (tagName == 'IMG') {
  19. if ((/\.png$/i).test(src)) {
  20. filt(src, 'image'); // was 'scale'
  21. src = blankImg;
  22. } else if (src.indexOf(blankImg) < 0) filt();
  23. } else if (style.backgroundImage) {
  24. if (style.backgroundImage.match(/^url[("']+(.*\.png)[)"']+$/i)) {
  25. var s = RegExp.$1;
  26. style.backgroundImage = '';
  27. filt(s, 'crop');
  28. } else filt();
  29. }
  30. }
  31. doFix();
  32. </script>
  33. </public:component>