diff options
author | Michael Hanson <hansonorders@verison.net> | 2010-04-01 23:31:09 (GMT) |
---|---|---|
committer | Michael Hanson <hansonorders@verison.net> | 2010-04-01 23:31:09 (GMT) |
commit | f136e5741a33162b6d6f341d6cefadf9272fe33f (patch) | |
tree | 1f175f22af0bdf54fe6afd16920a81aede4c2405 /abs/core-testing/local-website/htdocs/linhes/js/pngbehavior.htc | |
parent | 71fef603911d15fd30b1033e565aecb01c4a1c11 (diff) | |
parent | ad6f3d9f722f3fd13b5960520023cd1d32628bbf (diff) | |
download | linhes_pkgbuild-f136e5741a33162b6d6f341d6cefadf9272fe33f.zip linhes_pkgbuild-f136e5741a33162b6d6f341d6cefadf9272fe33f.tar.gz linhes_pkgbuild-f136e5741a33162b6d6f341d6cefadf9272fe33f.tar.bz2 |
Merge branch 'master' of mihanson@knoppmyth.net:LinHES-PKGBUILD
Diffstat (limited to 'abs/core-testing/local-website/htdocs/linhes/js/pngbehavior.htc')
-rw-r--r-- | abs/core-testing/local-website/htdocs/linhes/js/pngbehavior.htc | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/abs/core-testing/local-website/htdocs/linhes/js/pngbehavior.htc b/abs/core-testing/local-website/htdocs/linhes/js/pngbehavior.htc new file mode 100644 index 0000000..4d664d9 --- /dev/null +++ b/abs/core-testing/local-website/htdocs/linhes/js/pngbehavior.htc @@ -0,0 +1,97 @@ +/** + * This is a slightly modified version of Eric Advidsson's pngbehavior.htc + * script at http://webfx.eae.net/dhtml/pngbehavior/pngbehavior.html + * + * For usage see license at http://webfx.eae.net/license.html + * + * It also includes some printing fixes from: + * http://www.scss.com.au/family/andrew/webdesign/pngbehavior/ + * + * As well as restricting the versions of IE that it will match, since IE 7 now + * deals properly with transparent PNGs. + * + * @url $URL$ + * @date $Date: 2006-11-13 18:57:43 +0000 (Mon, 13 Nov 2006) $ + * @version $Revision: 11730 $ + * @author $Author: xris $ + * +/**/ + +<public:component> +<public:attach event="onpropertychange" onevent="propertyChanged()" /> +<public:attach event="onbeforeprint" for="window" onevent="beforePrint()" /> +<public:attach event="onafterprint" for="window" onevent="afterPrint()" /> + +<script type="text/javascript"> + +// Set this to the URL of your 1x1 transparent gif + var blankSrc = "/skins/default/img/spacer.gif"; + +// Only interact with valid browsers. Everything after IE 6 supports +// transparent PNGs natively (yay!) + var supported = /MSIE (5\.5|6)/.test(navigator.userAgent) && navigator.platform == "Win32"; + +/******************************************************************************/ + + var realSrc; + + if (supported) + fixImage(); + + function propertyChanged() { + if (supported && event.propertyName == 'src') { + var i = element.src.lastIndexOf(blankSrc); + if (i == -1 || i != element.src.length - blankSrc.length) { + fixImage(); + } + } + } + + function fixImage() { + if (!supported) return; + // Don't set the image to itself (i.e. catch stupid web designer errors) + if (element.src == realSrc && element.runtimeStyle.filter != "") { + element.src = blankSrc; + return; + } + // Backup the old src + if ( ! new RegExp(blankSrc).test(element.src)) + realSrc = element.src; + // Test for png + if ( realSrc && /\.png$/.test( realSrc.toLowerCase() ) ) { + // Make sure that width and height are preserved + var width = element.width; + var height = element.height; + // Set blank image + element.src = blankSrc; + // Set filter + element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + + encodeURI(realSrc) + "',sizingMethod='scale')"; + // Restore width and height + element.width = width; + element.height = height; + } + // Otherwise, remove the filter + else + element.runtimeStyle.filter = ""; + } + + function beforePrint() { + if (realSrc) { + supported = false; + element.src = realSrc; + element.runtimeStyle.filter = ''; + supported = true; + } + } + + function afterPrint() { + if (realSrc) { + var rs = realSrc; + realSrc = null; + element.src = rs; + } + } + +</script> +</public:component> |