ryxeo-glpi-git / htdocs / css / win_png.htc @ 1c14bcc4
Historique | Voir | Annoter | Télécharger (1007 octets)
1 | 1c14bcc4 | Eric Seigne | <public:component> |
---|---|---|---|
2 | <public:attach event="onpropertychange" onevent="propertyChanged()" /> |
||
3 | <script> |
||
4 | |||
5 | var supported = /MSIE (5\.5)|[6789]/.test(navigator.userAgent) && navigator.platform == "Win32"; |
||
6 | var realSrc; |
||
7 | var blankSrc = "../css/nothing.gif"; |
||
8 | |||
9 | if (supported) fixImage(); |
||
10 | |||
11 | function propertyChanged() { |
||
12 | if (!supported) return; |
||
13 | |||
14 | var pName = event.propertyName; |
||
15 | if (pName != "src") return; |
||
16 | // if not set to blank |
||
17 | if ( ! new RegExp(blankSrc).test(src)) |
||
18 | fixImage(); |
||
19 | }; |
||
20 | |||
21 | function fixImage() { |
||
22 | // get src |
||
23 | var src = element.src; |
||
24 | |||
25 | // check for real change |
||
26 | if (src == realSrc) { |
||
27 | element.src = blankSrc; |
||
28 | return; |
||
29 | } |
||
30 | |||
31 | if ( ! new RegExp(blankSrc).test(src)) { |
||
32 | // backup old src |
||
33 | realSrc = src; |
||
34 | |||
35 | // test for png |
||
36 | if ( /\.png$/.test( realSrc.toLowerCase() ) ) { |
||
37 | // set blank image |
||
38 | element.src = blankSrc; |
||
39 | // set filter |
||
40 | element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + |
||
41 | src + "',sizingMethod='image')"; |
||
42 | } |
||
43 | } |
||
44 | } |
||
45 | |||
46 | </script> |
||
47 | </public:component> |