[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <public:component lightWeight="true"> 2 <public:attach event="onpropertychange" onevent="propertyChanged()" /> 3 <public:attach event="onbeforeprint" onevent="beforePrint()" for="window"/> 4 <public:attach event="onafterprint" onevent="afterPrint()" for="window"/> 5 <script> 6 7 /* 8 * PNG Behavior 9 * 10 * This script was created by Erik Arvidsson (http://webfx.eae.net/contact.html#erik) 11 * for WebFX (http://webfx.eae.net) 12 * Copyright 2002-2004 13 * 14 * For usage see license at http://webfx.eae.net/license.html 15 * 16 * Version: 1.02 17 * Created: 2001-??-?? First working version 18 * Updated: 2002-03-28 Fixed issue when starting with a non png image and 19 * switching between non png images 20 * 2003-01-06 Fixed RegExp to correctly work with IE 5.0x 21 * 2004-05-09 When printing revert to original 22 * 23 */ 24 25 var supported = /MSIE ((5\.5)|[6789])/.test(navigator.userAgent) && 26 navigator.platform == "Win32"; 27 28 var realSrc; 29 var blankSrc = "/sf/sf_default/images/trans.gif"; 30 var isPrinting = false; 31 32 if (supported) fixImage(); 33 34 function propertyChanged() { 35 if (!supported || isPrinting) return; 36 37 var pName = event.propertyName; 38 if (pName != "src") return; 39 // if not set to blank 40 if (!new RegExp(blankSrc).test(src)) 41 fixImage(); 42 }; 43 44 function fixImage() { 45 // get src 46 var src = element.src; 47 48 // check for real change 49 if (src == realSrc && /\.png$/i.test(src)) { 50 element.src = blankSrc; 51 return; 52 } 53 54 if ( ! new RegExp(blankSrc).test(src)) { 55 // backup old src 56 realSrc = src; 57 } 58 59 // test for png 60 if (/\.png$/i.test(realSrc)) { 61 // set blank image 62 element.src = blankSrc; 63 // set filter 64 element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft." + 65 "AlphaImageLoader(src='" + src + "',sizingMethod='scale')"; 66 } 67 else { 68 // remove filter 69 element.runtimeStyle.filter = ""; 70 } 71 } 72 73 function beforePrint() { 74 isPrinting = true; 75 element.src = realSrc; 76 element.runtimeStyle.filter = ""; 77 realSrc = null; 78 } 79 80 function afterPrint() { 81 isPrinting = false; 82 fixImage(); 83 } 84 85 </script> 86 </public:component>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |