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// Since we need to know the full path inside DokuWiki, I moved this into main.php
13// if (typeof blankImg == 'undefined') var blankImg = 'blank.gif';
14
15var f = 'DXImageTransform.Microsoft.AlphaImageLoader';
16
17function filt(s, m)
18{
19 if (filters[f])
20 {
21  filters[f].enabled = s ? true : false;
22  if (s) with (filters[f]) { src = s; sizingMethod = m }
23 }
24 else if (s) style.filter = 'progid:'+f+'(src="'+s+'",sizingMethod="'+m+'")';
25}
26//else if (s) style.filter = 'progid:'+f+'(src="'+s+'",sizingMethod="scale ")';
27function doFix()
28{
29 // Assume IE7 is OK.
30 if (!/MSIE (5\.5|6\.)/.test(navigator.userAgent) ||
31  (event && !/(background|src)/.test(event.propertyName))) return;
32
33 var bgImg = currentStyle.backgroundImage || style.backgroundImage;
34
35 if (tagName == 'IMG')
36 {
37  if ((/\.png$/i).test(src))
38  {
39   if (currentStyle.width == 'auto' && currentStyle.height == 'auto')
40    style.width = offsetWidth + 'px';
41   filt(src, 'scale');
42   src = blankImg;
43  }
44  else if (src.indexOf(blankImg) < 0) filt();
45 }
46 else if (bgImg && bgImg != 'none')
47 {
48  if (bgImg.match(/^url[("']+(.*\.png)[)"']+$/i))
49  {
50   var s = RegExp.$1;
51   if (currentStyle.width == 'auto' && currentStyle.height == 'auto')
52    style.width = offsetWidth + 'px';
53   style.backgroundImage = 'none';
54   if(currentStyle.backgroundRepeat=="repeat")
55    filt(s, 'scale');
56   else
57    filt(s, 'crop');
58   // IE link fix.
59   for (var n = 0; n < childNodes.length; n++)
60    if (childNodes[n].style) childNodes[n].style.position = 'relative';
61  }
62  else filt();
63 }
64}
65
66doFix();
67
68</script>
69</public:component>
70