You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.0 KiB
Plaintext
85 lines
2.0 KiB
Plaintext
15 years ago
|
<public:component lightWeight="true">
|
||
19 years ago
|
<public:attach event="onpropertychange" onevent="propertyChanged()" />
|
||
15 years ago
|
<public:attach event="onbeforeprint" onevent="beforePrint()" for="window"/>
|
||
|
<public:attach event="onafterprint" onevent="afterPrint()" for="window"/>
|
||
19 years ago
|
<script>
|
||
|
|
||
17 years ago
|
/*
|
||
|
* PNG Behavior
|
||
|
*
|
||
15 years ago
|
* This script was created by Erik Arvidsson (http://webfx.eae.net/contact.html#erik)
|
||
17 years ago
|
* for WebFX (http://webfx.eae.net)
|
||
15 years ago
|
* Copyright 2002-2004
|
||
17 years ago
|
*
|
||
15 years ago
|
* For usage see license at http://webfx.eae.net/license.html
|
||
|
*
|
||
|
* Version: 1.02
|
||
|
* Created: 2001-??-?? First working version
|
||
|
* Updated: 2002-03-28 Fixed issue when starting with a non png image and
|
||
|
* switching between non png images
|
||
|
* 2003-01-06 Fixed RegExp to correctly work with IE 5.0x
|
||
|
* 2004-05-09 When printing revert to original
|
||
17 years ago
|
*
|
||
|
*/
|
||
15 years ago
|
|
||
|
var supported = /MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32",
|
||
|
realSrc,
|
||
12 years ago
|
blankSrc = "program/resources/blank.gif",
|
||
15 years ago
|
isPrinting = false;
|
||
|
|
||
19 years ago
|
if (supported) fixImage();
|
||
15 years ago
|
|
||
19 years ago
|
function propertyChanged() {
|
||
15 years ago
|
if (!supported || isPrinting) return;
|
||
|
|
||
|
var pName = event.propertyName;
|
||
|
if (pName != "src") return;
|
||
|
// if not set to blank
|
||
|
if (!new RegExp(blankSrc).test(src))
|
||
|
fixImage();
|
||
|
};
|
||
|
|
||
19 years ago
|
function fixImage() {
|
||
15 years ago
|
// get src
|
||
|
var src = element.src;
|
||
|
|
||
|
// check for real change
|
||
|
if (src == realSrc && /\.png$/i.test(src)) {
|
||
|
element.src = blankSrc;
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if ( ! new RegExp(blankSrc).test(src)) {
|
||
|
// backup old src
|
||
|
realSrc = src;
|
||
|
}
|
||
|
|
||
|
// test for png
|
||
|
if (/\.png$/i.test(realSrc)) {
|
||
|
// set blank image
|
||
|
element.src = blankSrc;
|
||
|
// set filter
|
||
|
element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft." +
|
||
|
"AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
|
||
|
}
|
||
|
else {
|
||
|
// remove filter
|
||
|
element.runtimeStyle.filter = "";
|
||
|
}
|
||
17 years ago
|
}
|
||
15 years ago
|
|
||
17 years ago
|
function beforePrint() {
|
||
15 years ago
|
isPrinting = true;
|
||
|
element.src = realSrc;
|
||
|
element.runtimeStyle.filter = "";
|
||
|
realSrc = null;
|
||
17 years ago
|
}
|
||
15 years ago
|
|
||
17 years ago
|
function afterPrint() {
|
||
15 years ago
|
isPrinting = false;
|
||
|
fixImage();
|
||
19 years ago
|
}
|
||
15 years ago
|
|
||
19 years ago
|
</script>
|
||
17 years ago
|
</public:component>
|