Fix message list selection + new pngbehavior + use strpos() instead of strstr()
parent
1094cda9a0
commit
0d1dd7c80c
@ -1,52 +1,74 @@
|
|||||||
<public:component>
|
<public:component>
|
||||||
<public:attach event="onpropertychange" onevent="propertyChanged()" />
|
<public:attach event="onpropertychange" onevent="propertyChanged()" />
|
||||||
|
<public:attach event="onbeforeprint" for="window" onevent="beforePrint()" />
|
||||||
|
<public:attach event="onafterprint" for="window" onevent="afterPrint()" />
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
var supported = /MSIE (5\.5)|[6789]/.test(navigator.userAgent) && navigator.platform == "Win32";
|
/*
|
||||||
var realSrc = null;
|
* PNG Behavior
|
||||||
var blankSrc = "skins/default/images/blank.gif";
|
*
|
||||||
|
* This script was created by Erik Arvidsson (erik(at)eae.net)
|
||||||
|
* for WebFX (http://webfx.eae.net)
|
||||||
|
* Copyright 2002
|
||||||
|
*
|
||||||
|
* For usage see license at http://webfx.eae.net/license.html
|
||||||
|
*
|
||||||
|
* Version: 1.01a
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
var IS_PNG = /\.png$/i;
|
||||||
|
var supported = /MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == 'Win32';
|
||||||
|
var realSrc, realHeight, realWidth;
|
||||||
|
var blankSrc = 'skins/default/images/blank.gif';
|
||||||
if (supported) fixImage();
|
if (supported) fixImage();
|
||||||
|
|
||||||
function propertyChanged() {
|
function propertyChanged() {
|
||||||
if (!supported) return;
|
if (supported && event.propertyName == 'src') {
|
||||||
|
var i = element.src.lastIndexOf(blankSrc);
|
||||||
var pName = event.propertyName;
|
if (i == -1 || i != element.src.length - blankSrc.length) {
|
||||||
if (pName != "src") return;
|
|
||||||
// if not set to blank
|
|
||||||
if ( ! new RegExp(blankSrc).test(src))
|
|
||||||
fixImage();
|
fixImage();
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
function fixImage() {
|
function fixImage() {
|
||||||
// get src
|
if (realSrc && element.src == realSrc) {
|
||||||
var src = element.src;
|
// this is an attempt to set the image to itself!
|
||||||
|
// pointless - leave the filter as-is, restore the blank image
|
||||||
// check for real change
|
element.src = blankSrc;
|
||||||
if (src == realSrc) {
|
} else {
|
||||||
|
// set the image to something different
|
||||||
|
if (IS_PNG.test(element.src)) {
|
||||||
|
// fixable PNG
|
||||||
|
realSrc = element.src;
|
||||||
|
realWidth = element.width;
|
||||||
|
realHeight = element.height;
|
||||||
element.src = blankSrc;
|
element.src = blankSrc;
|
||||||
return;
|
element.style.width = realWidth + 'px';
|
||||||
}
|
element.style.height = realHeight + 'px';
|
||||||
|
element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + encodeURI(realSrc) + "',sizingMethod='scale')";
|
||||||
if ( ! new RegExp(blankSrc).test(src)) {
|
} else {
|
||||||
// backup old src
|
// ordinary image - make sure the fix is removed
|
||||||
realSrc = src;
|
if (realSrc) {
|
||||||
element._original_src = realSrc;
|
realSrc = null;
|
||||||
}
|
element.runtimeStyle.filter = '';
|
||||||
|
}
|
||||||
// test for png
|
}
|
||||||
if ( realSrc && /\.png$/.test( realSrc.toLowerCase() ) ) {
|
}
|
||||||
// set blank image
|
}
|
||||||
element.src = blankSrc;
|
function beforePrint() {
|
||||||
// set filter
|
if (realSrc) {
|
||||||
element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" +
|
supported = false;
|
||||||
src + "',sizingMethod='crop')";
|
element.src = realSrc;
|
||||||
}
|
element.runtimeStyle.filter = '';
|
||||||
else {
|
supported = true;
|
||||||
// remove filter
|
}
|
||||||
element.runtimeStyle.filter = "";
|
}
|
||||||
}
|
function afterPrint() {
|
||||||
|
if (realSrc) {
|
||||||
|
var rs = realSrc;
|
||||||
|
realSrc = null;
|
||||||
|
element.src = rs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</public:component>
|
</public:component>
|
Loading…
Reference in New Issue