/[drupal]/contributions/themes/civicspace/scripts/pngbehavior.htc
ViewVC logotype

Contents of /contributions/themes/civicspace/scripts/pngbehavior.htc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download)
Mon Aug 29 21:52:13 2005 UTC (4 years, 2 months ago) by robinmonks
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-6--2, DRUPAL-4-7
Changes since 1.2: +1 -0 lines
Add correct info strings to all files.
1 <public:component lightWeight="true">
2 <public:attach event="onpropertychange" onevent="propertyChanged()" />
3 <public:attach event="onbeforeprint" onevent="beforePrint()" for="window"/>
4 <public:attach event="onafterprint" onevent="afterPrint()" for="window"/>
5 <script>
6 /* $Id: Exp $ */
7
8 /*
9 * PNG Behavior
10 *
11 * This script was created by Erik Arvidsson (http://webfx.eae.net/contact.html#erik)
12 * for WebFX (http://webfx.eae.net)
13 * Copyright 2002-2004
14 *
15 * For usage see license at http://webfx.eae.net/license.html
16 *
17 * Version: 1.02
18 * Created: 2001-??-?? First working version
19 * Updated: 2002-03-28 Fixed issue when starting with a non png image and
20 * switching between non png images
21 * 2003-01-06 Fixed RegExp to correctly work with IE 5.0x
22 * 2004-05-09 When printing revert to original
23 *
24 */
25
26 var supported = /MSIE ((5\.5)|[6789])/.test(navigator.userAgent) &&
27 navigator.platform == "Win32";
28
29 var realSrc;
30 var blankSrc = "../images/blank.gif";
31 var isPrinting = false;
32
33 if (supported) fixImage();
34
35 function propertyChanged() {
36 if (!supported || isPrinting) return;
37
38 var pName = event.propertyName;
39 if (pName != "src") return;
40 // if not set to blank
41 if (!new RegExp(blankSrc).test(src))
42 fixImage();
43 };
44
45 function fixImage() {
46 // get src
47 var src = element.src;
48
49 // check for real change
50 if (src == realSrc && /\.png$/i.test(src)) {
51 element.src = blankSrc;
52 return;
53 }
54
55 if ( ! new RegExp(blankSrc).test(src)) {
56 // backup old src
57 realSrc = src;
58 }
59
60 // test for png
61 if (/\.png$/i.test(realSrc)) {
62 // set blank image
63 element.src = blankSrc;
64 // set filter
65 element.runtimeStyle.filter = "progid:DXImageTransform.Microsoft." +
66 "AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
67 }
68 else {
69 // remove filter
70 element.runtimeStyle.filter = "";
71 }
72 }
73
74 function beforePrint() {
75 isPrinting = true;
76 element.src = realSrc;
77 element.runtimeStyle.filter = "";
78 realSrc = null;
79 }
80
81 function afterPrint() {
82 isPrinting = false;
83 fixImage();
84 }
85
86 </script>
87 </public:component>

  ViewVC Help
Powered by ViewVC 1.1.2