summaryrefslogtreecommitdiff
path: root/skins/default/pngbehavior.htc
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2005-09-25 14:18:03 +0000
committerthomascube <thomas@roundcube.net>2005-09-25 14:18:03 +0000
commit4e17e6c9dbac8991ee8b302cb2581241247dc8bc (patch)
treed877546f6bd334b041734498e81f6299e005b01c /skins/default/pngbehavior.htc
Initial revision
Diffstat (limited to 'skins/default/pngbehavior.htc')
-rw-r--r--skins/default/pngbehavior.htc52
1 files changed, 52 insertions, 0 deletions
diff --git a/skins/default/pngbehavior.htc b/skins/default/pngbehavior.htc
new file mode 100644
index 000000000..553699a2f
--- /dev/null
+++ b/skins/default/pngbehavior.htc
@@ -0,0 +1,52 @@
+<public:component>
+<public:attach event="onpropertychange" onevent="propertyChanged()" />
+<script>
+
+var supported = /MSIE (5\.5)|[6789]/.test(navigator.userAgent) && navigator.platform == "Win32";
+var realSrc;
+var blankSrc = "skins/default/images/blank.gif";
+
+if (supported) fixImage();
+
+function propertyChanged() {
+ if (!supported) return;
+
+ var pName = event.propertyName;
+ if (pName != "src") return;
+ // if not set to blank
+ if ( ! new RegExp(blankSrc).test(src))
+ fixImage();
+};
+
+function fixImage() {
+ // get src
+ var src = element.src;
+
+ // check for real change
+ if (src == realSrc) {
+ element.src = blankSrc;
+ return;
+ }
+
+ if ( ! new RegExp(blankSrc).test(src)) {
+ // backup old src
+ realSrc = src;
+ element._original_src = realSrc;
+ }
+
+ // test for png
+ if ( /\.png$/.test( realSrc.toLowerCase() ) ) {
+ // 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 = "";
+ }
+}
+
+</script>
+</public:component> \ No newline at end of file