commit | author | age
|
4e17e6
|
1 |
<public:component> |
T |
2 |
<public:attach event="onpropertychange" onevent="propertyChanged()" /> |
0d1dd7
|
3 |
<public:attach event="onbeforeprint" for="window" onevent="beforePrint()" /> |
T |
4 |
<public:attach event="onafterprint" for="window" onevent="afterPrint()" /> |
4e17e6
|
5 |
<script> |
T |
6 |
|
0d1dd7
|
7 |
/* |
T |
8 |
* PNG Behavior |
|
9 |
* |
|
10 |
* This script was created by Erik Arvidsson (erik(at)eae.net) |
|
11 |
* for WebFX (http://webfx.eae.net) |
|
12 |
* Copyright 2002 |
|
13 |
* |
|
14 |
* For usage see license at http://webfx.eae.net/license.html |
|
15 |
* |
|
16 |
* Version: 1.01a |
|
17 |
* |
|
18 |
*/ |
|
19 |
|
|
20 |
var IS_PNG = /\.png$/i; |
|
21 |
var supported = /MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == 'Win32'; |
|
22 |
var realSrc, realHeight, realWidth; |
|
23 |
var blankSrc = 'skins/default/images/blank.gif'; |
4e17e6
|
24 |
if (supported) fixImage(); |
T |
25 |
function propertyChanged() { |
0d1dd7
|
26 |
if (supported && event.propertyName == 'src') { |
T |
27 |
var i = element.src.lastIndexOf(blankSrc); |
|
28 |
if (i == -1 || i != element.src.length - blankSrc.length) { |
4e17e6
|
29 |
fixImage(); |
0d1dd7
|
30 |
} |
T |
31 |
} |
4e17e6
|
32 |
} |
0d1dd7
|
33 |
function fixImage() { |
T |
34 |
if (realSrc && element.src == realSrc) { |
|
35 |
// this is an attempt to set the image to itself! |
|
36 |
// pointless - leave the filter as-is, restore the blank image |
|
37 |
element.src = blankSrc; |
|
38 |
} else { |
|
39 |
// set the image to something different |
|
40 |
if (IS_PNG.test(element.src)) { |
|
41 |
// fixable PNG |
|
42 |
realSrc = element.src; |
|
43 |
realWidth = element.width; |
|
44 |
realHeight = element.height; |
|
45 |
element.src = blankSrc; |
|
46 |
element.style.width = realWidth + 'px'; |
|
47 |
element.style.height = realHeight + 'px'; |
|
48 |
element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + encodeURI(realSrc) + "',sizingMethod='scale')"; |
|
49 |
} else { |
|
50 |
// ordinary image - make sure the fix is removed |
|
51 |
if (realSrc) { |
|
52 |
realSrc = null; |
|
53 |
element.runtimeStyle.filter = ''; |
|
54 |
} |
|
55 |
} |
|
56 |
} |
|
57 |
} |
|
58 |
function beforePrint() { |
|
59 |
if (realSrc) { |
|
60 |
supported = false; |
|
61 |
element.src = realSrc; |
|
62 |
element.runtimeStyle.filter = ''; |
|
63 |
supported = true; |
|
64 |
} |
|
65 |
} |
|
66 |
function afterPrint() { |
|
67 |
if (realSrc) { |
|
68 |
var rs = realSrc; |
|
69 |
realSrc = null; |
|
70 |
element.src = rs; |
|
71 |
} |
|
72 |
} |
4e17e6
|
73 |
</script> |
0d1dd7
|
74 |
</public:component> |