annotate docs/pycon2010/ui/pycon/iepngfix.htc @ 380:de2306847251

replacing temporaryfile with an object seems good
author cat@eee
date Mon, 22 Feb 2010 21:26:40 -0500
parents bf314710e64b
children
rev   line source
372
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
1 <public:component>
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
2 <public:attach event="onpropertychange" onevent="doFix()" />
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
3
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
4 <script>
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
5
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
6 // IE5.5+ PNG Alpha Fix v1.0 by Angus Turnbull http://www.twinhelix.com
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
7 // Free usage permitted as long as this notice remains intact.
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
8
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
9 // This must be a path to a blank image. That's all the configuration you need here.
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
10 var blankImg = 'ui/default/blank.gif';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
11
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
12 var f = 'DXImageTransform.Microsoft.AlphaImageLoader';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
13
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
14 function filt(s, m) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
15 if (filters[f]) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
16 filters[f].enabled = s ? true : false;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
17 if (s) with (filters[f]) { src = s; sizingMethod = m }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
18 } else if (s) style.filter = 'progid:'+f+'(src="'+s+'",sizingMethod="'+m+'")';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
19 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
20
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
21 function doFix() {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
22 if ((parseFloat(navigator.userAgent.match(/MSIE (\S+)/)[1]) < 5.5) ||
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
23 (event && !/(background|src)/.test(event.propertyName))) return;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
24
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
25 if (tagName == 'IMG') {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
26 if ((/\.png$/i).test(src)) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
27 filt(src, 'image'); // was 'scale'
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
28 src = blankImg;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
29 } else if (src.indexOf(blankImg) < 0) filt();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
30 } else if (style.backgroundImage) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
31 if (style.backgroundImage.match(/^url[("']+(.*\.png)[)"']+$/i)) {
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
32 var s = RegExp.$1;
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
33 style.backgroundImage = '';
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
34 filt(s, 'crop');
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
35 } else filt();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
36 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
37 }
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
38
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
39 doFix();
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
40
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
41 </script>
bf314710e64b can't make theme work
cat@eee
parents:
diff changeset
42 </public:component>