initial commit
[JIRC.git] / public / windows_js_1.3 / documentation / themes / iefix / iepngfix.htc
1 <public:component>
2 <public:attach event="onpropertychange" onevent="doFix()" />
3
4 <script type="text/javascript">
5
6 // IE5.5+ PNG Alpha Fix v1.0RC4
7 // (c) 2004-2005 Angus Turnbull http://www.twinhelix.com
8
9 // This is licensed under the CC-GNU LGPL, version 2.1 or later.
10 // For details, see: http://creativecommons.org/licenses/LGPL/2.1/
11
12 // Modified/Simplified on 04/23/2007 by Sebastien Gruhier (http://www.xilinus.com)
13 // To work only on background and to handle repeat bg
14
15 // This must be a path to a blank image. That's all the configuration you need.
16 if (typeof blankImg == 'undefined') var blankImg = 'blank.gif';
17
18 var f = 'DXImageTransform.Microsoft.AlphaImageLoader';
19
20 function filt(s, m)
21 {
22 if (filters[f])
23 {
24 filters[f].enabled = s ? true : false;
25 if (s) with (filters[f]) { src = s; sizingMethod = m }
26 }
27 else if (s) style.filter = 'progid:'+f+'(src="'+s+'",sizingMethod="'+m+'")';
28 }
29
30 function doFix()
31 {
32 // Assume IE7 is OK.
33 if (!/MSIE (5\.5|6\.)/.test(navigator.userAgent) ||
34 (event && !/(background|src)/.test(event.propertyName))) return;
35
36 var bgImg = currentStyle.backgroundImage || style.backgroundImage;
37 var bgRepeat = currentStyle.backgroundRepeat || style.backgroundRepeat;
38 if (bgImg && bgImg != 'none')
39 {
40 if (bgImg.match(/^url[("']+(.*\.png)[)"']+$/i))
41 {
42 var s = RegExp.$1;
43 if (currentStyle.width == 'auto' && currentStyle.height == 'auto')
44 style.width = offsetWidth + 'px';
45 style.backgroundImage = 'none';
46 filt(s, bgRepeat == "no-repeat" ? 'crop' : 'scale');
47 }
48 }
49 }
50
51 doFix();
52
53 </script>
54 </public:component>