import moose website
[gitmo/moose-htdocs.git] / object_meta_programming_slides / slides / ui / iepngfix.htc
1 <public:component>
2
3 <public:attach event="onpropertychange" onevent="doFix()" />
4
5
6
7 <script>
8
9
10
11 // IE5.5+ PNG Alpha Fix v1.0 by Angus Turnbull http://www.twinhelix.com
12
13 // Free usage permitted as long as this notice remains intact.
14
15
16
17 // This must be a path to a blank image. That's all the configuration you need here.
18
19 var blankImg = 'blank.gif';
20
21
22
23 var f = 'DXImageTransform.Microsoft.AlphaImageLoader';
24
25
26
27 function filt(s, m) {
28
29  if (filters[f]) {
30
31   filters[f].enabled = s ? true : false;
32
33   if (s) with (filters[f]) { src = s; sizingMethod = m }
34
35  } else if (s) style.filter = 'progid:'+f+'(src="'+s+'",sizingMethod="'+m+'")';
36
37 }
38
39
40
41 function doFix() {
42
43  if ((parseFloat(navigator.userAgent.match(/MSIE (\S+)/)[1]) < 5.5) ||
44
45   (event && !/(background|src)/.test(event.propertyName))) return;
46
47
48
49  if (tagName == 'IMG') {
50
51   if ((/\.png$/i).test(src)) {
52
53    filt(src, 'image');  // was 'scale'
54
55    src = blankImg;
56
57   } else if (src.indexOf(blankImg) < 0) filt();
58
59  } else if (style.backgroundImage) {
60
61   if (style.backgroundImage.match(/^url[("']+(.*\.png)[)"']+$/i)) {
62
63    var s = RegExp.$1;
64
65    style.backgroundImage = '';
66
67    filt(s, 'crop');
68
69   } else filt();
70
71  }
72
73 }
74
75
76
77 doFix();
78
79
80
81 </script>
82
83 </public:component>