File: iepngfix.htc

package info (click to toggle)
python-docutils 0.12%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 8,108 kB
  • ctags: 7,367
  • sloc: python: 41,778; lisp: 8,644; sh: 164; makefile: 148; xml: 34
file content (42 lines) | stat: -rw-r--r-- 1,190 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<public:component>
<public:attach event="onpropertychange" onevent="doFix()" />

<script>

// IE5.5+ PNG Alpha Fix v1.0 by Angus Turnbull http://www.twinhelix.com
// This is licensed under the GNU LGPL, version 2.1 or later. 

// This must be a path to a blank image. That's all the configuration you need here.
var blankImg = 'ui/default/blank.gif';

var f = 'DXImageTransform.Microsoft.AlphaImageLoader';

function filt(s, m) {
 if (filters[f]) {
  filters[f].enabled = s ? true : false;
  if (s) with (filters[f]) { src = s; sizingMethod = m }
 } else if (s) style.filter = 'progid:'+f+'(src="'+s+'",sizingMethod="'+m+'")';
}

function doFix() {
 if ((parseFloat(navigator.userAgent.match(/MSIE (\S+)/)[1]) < 5.5) ||
  (event && !/(background|src)/.test(event.propertyName))) return;

 if (tagName == 'IMG') {
  if ((/\.png$/i).test(src)) {
   filt(src, 'image');  // was 'scale'
   src = blankImg;
  } else if (src.indexOf(blankImg) < 0) filt();
 } else if (style.backgroundImage) {
  if (style.backgroundImage.match(/^url[("']+(.*\.png)[)"']+$/i)) {
   var s = RegExp.$1;
   style.backgroundImage = '';
   filt(s, 'crop');
  } else filt();
 }
}

doFix();

</script>
</public:component>