summaryrefslogtreecommitdiff
path: root/skins/classic/pngbehavior.htc
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2012-07-30 14:26:41 +0200
committerThomas Bruederli <thomas@roundcube.net>2012-07-30 14:26:41 +0200
commit3185f3a52404baacaef29e4ace534c97e5ddc931 (patch)
tree1b36471f9f44a73f0b3708ec4ccbb0cbee6fb7bb /skins/classic/pngbehavior.htc
parentc2d19b7f2439c250b4f6d4edca4840df2982973a (diff)
Backported default -> classic skin renaming
Diffstat (limited to 'skins/classic/pngbehavior.htc')
-rw-r--r--skins/classic/pngbehavior.htc84
1 files changed, 84 insertions, 0 deletions
diff --git a/skins/classic/pngbehavior.htc b/skins/classic/pngbehavior.htc
new file mode 100644
index 000000000..fb5f1c8d4
--- /dev/null
+++ b/skins/classic/pngbehavior.htc
@@ -0,0 +1,84 @@
+<public:component lightWeight="true">
+<public:attach event="onpropertychange" onevent="propertyChanged()" />
+<public:attach event="onbeforeprint" onevent="beforePrint()" for="window"/>
+<public:attach event="onafterprint" onevent="afterPrint()" for="window"/>
+<script>
+
+/*
+ * PNG Behavior
+ *
+ * This script was created by Erik Arvidsson (http://webfx.eae.net/contact.html#erik)
+ * for WebFX (http://webfx.eae.net)
+ * Copyright 2002-2004
+ *
+ * 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
+ *
+ */
+
+var supported = /MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32",
+ realSrc,
+ blankSrc = "skins/default/images/blank.gif",
+ isPrinting = false;
+
+if (supported) fixImage();
+
+function propertyChanged() {
+ if (!supported || isPrinting) 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 && /\.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 = "";
+ }
+}
+
+function beforePrint() {
+ isPrinting = true;
+ element.src = realSrc;
+ element.runtimeStyle.filter = "";
+ realSrc = null;
+}
+
+function afterPrint() {
+ isPrinting = false;
+ fixImage();
+}
+
+</script>
+</public:component>