Commit d72cdc88febe7796f6385a836ac6e9729c55a9b5
1 parent
0e3f7609
Exists in
master
and in
7 other branches
--no commit message
Showing
16 changed files
with
1941 additions
and
0 deletions
Show diff stats
pacotes/balloon-tooltips/htdocs_depreciado/balloons.html
0 → 100755
... | ... | @@ -0,0 +1,130 @@ |
1 | +<html> | |
2 | +<head> | |
3 | + <title>Balloon tooltip demonstration</title> | |
4 | + <script type="text/javascript" src="js/balloon.config.js"></script> | |
5 | + <script type="text/javascript" src="js/balloon.js"></script> | |
6 | + <script type="text/javascript" src="js/yahoo-dom-event.js"></script> | |
7 | + <script> var balloon = new Balloon;</script> | |
8 | + <style> | |
9 | + a.tt { | |
10 | + background-color:lightsteelblue; | |
11 | + text-decoration:none; | |
12 | + } | |
13 | + .hidden { | |
14 | + display:none; | |
15 | + } | |
16 | + pre { | |
17 | + background-color:gainsboro; | |
18 | + padding:10px; | |
19 | + margin-left:20px; | |
20 | + margin-right:20px; | |
21 | + font-family:courier; | |
22 | + font-size:90%; | |
23 | + } | |
24 | + b.y { background-color:yellow } | |
25 | + </style> | |
26 | +</head> | |
27 | +<body> | |
28 | +<h1>Balloon tooltip demonstration</h1> | |
29 | +<div style="border:1px solid red;text-align:center;margin-bottom:5px"> | |
30 | +Javascript code: <a href="/js/balloon.js" target="_new" | |
31 | +onmouseover="balloon.showTooltip(event,'Get the javascript code!')"> | |
32 | +balloon.js</a> | |
33 | + | | |
34 | +Documentation: <a href="http://www.gmod.org/wiki/index.php/Popup_Balloons" | |
35 | +onmouseover="balloon.showTooltip(event,'Documentation for installation and usage')"; target="_new">Wiki</a> | |
36 | +</div> | |
37 | +<div style="border:1px solid blue;background:azure;padding:10px;font-family:arial, sans-serif"> | |
38 | +<a href="http://www.gmod.org/wiki/index.php/Popup_Balloons" target="_blank" | |
39 | + onmouseover="balloon.showTooltip(event,'Want to do this with your website? Click for documentation!')"> | |
40 | +<img src="/images/sample_balloon.png" style="float:right;border:2px solid black" /> | |
41 | +</a> | |
42 | +This page is a demonstration of balloon.js, written by <a href="http://www.gmod.org/wiki/index.php/Popup_Balloons">Sheldon McKay</a> | |
43 | +<ul> | |
44 | +<li>balloon.js is an object-oriented JavaScript class for highly configurable balloon tooltips (AKA popup balloons, bubbles, etc)</li> | |
45 | +<li>the balloon.js package is completely free and open source, so help yourself!</li> | |
46 | +<li>See <a href="http://www.gmod.org/wiki/index.php/Popup_Balloons">www.gmod.org/wiki/index.php/Popup_Balloons</a> for complete documentation</li> | |
47 | +<li>Please feel free to <a href="mailto:mckays@cshl.edu">Contact the Author<a> for help with installation and usage</li> | |
48 | +</ul> | |
49 | +</div> | |
50 | + | |
51 | +<p> | |
52 | +Page header with required components | |
53 | +</p> | |
54 | +<pre> | |
55 | +<head> | |
56 | + <title>balloon tooltip demonstration</title> | |
57 | + <script type="text/javascript" src="/js/balloon.config.js"></script> | |
58 | + <script type="text/javascript" src="/js/balloon.js"></script> | |
59 | + <script type="text/javascript" src="/js/yahoo-dom-event.js"></script> | |
60 | + <script type="text/javascript"> var balloon = new balloon;</script> | |
61 | +</head> | |
62 | +</pre> | |
63 | + | |
64 | +<div id="lorem1" class="hidden"> | |
65 | +Lorem ipsum dolor sit amet, <b><i>consectetuer adipiscing elit</b></i>. Vestibulum iaculis, | |
66 | +ligula quis fringilla volutpat, metus mi molestie lorem, <span style=\'color:red\'>quis accumsan pede | |
67 | +turpis nec metus.</span> Lorem ipsum dolor sit amet, consectetuer adipiscing elit.' | |
68 | +</div> | |
69 | + | |
70 | +<div id="lorem2" class="hidden"> | |
71 | +<a href="http://www.lipsum.com" target="_new" style="color:blue">What is <i>Lorem ipsum...</i>?</a> | |
72 | +Lorem ipsum dolor sit amet, <b><i>consectetuer adipiscing elit</b></i>. Vestibulum iaculis | |
73 | +, ligula quis fringilla volutpat, metus mi molestie lorem, quis accumsan pede | |
74 | +turpis nec metus. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. | |
75 | +</div> | |
76 | + | |
77 | +<p> | |
78 | +This is an example of a simple balloon <a href="javascript:void(0)" class=tt | |
79 | +onmouseover="balloon.showTooltip(event,'I am a simple message...')">message</a> | |
80 | + | |
81 | +<pre> | |
82 | + <a href="javascript:void(0)" onmouseover="balloon.showTooltip(event,'I am a simple message...')">message</a> | |
83 | +</pre> | |
84 | +</p> | |
85 | + | |
86 | +<p> | |
87 | +Roll over <a href="javascript:void(0)" class=tt onmouseover="balloon.showTooltip(event,'load:lorem1')"> | |
88 | +this text</a> for an example of HTML-formatted text loaded from a hidden <div> element. | |
89 | +<pre> | |
90 | + onmouseover="balloon.showTooltip(event,<b class=y>'load:lorem1'</b>)" | |
91 | +</pre> | |
92 | + | |
93 | +<span id=sticky> | |
94 | +Adding a third argument makes the tooltip <a href="javascript:void(0)" class=tt | |
95 | +onmouseover="balloon.showTooltip(event,'load:lorem2',1)">sticky</a>.</span> | |
96 | + | |
97 | +<pre> | |
98 | + onmouseover="balloon.showTooltip(event,'load:lorem2',<b class=y>1</b>)" | |
99 | +</pre> | |
100 | + | |
101 | +A fourth argument will set the width (Example:<a href="javascript:void(0)" class=tt | |
102 | +onmouseover="balloon.showTooltip(event,'load:lorem2',1,300)"> | |
103 | +300px sticky balloon</a>) | |
104 | +<pre> | |
105 | + onmouseover="balloon.showTooltip(event,'load:lorem2',1,<b class=y>300</b>)" | |
106 | +</pre> | |
107 | +</p> | |
108 | + | |
109 | +<p> | |
110 | +Here is an example of a tooltip balloon that is populated by an | |
111 | +<a href="javascript:void(0)" class=tt | |
112 | +onmouseover="balloon.showTooltip(event,'<img height=150 src=/images/balloons.png>')"> | |
113 | +image</a>. | |
114 | +<pre> | |
115 | + onmouseover="balloon.showTooltip(event,'<img src=/images/balloons.png>')" | |
116 | +</pre> | |
117 | +</p> | |
118 | + | |
119 | +<p> | |
120 | +This link will create a sticky balloon whose contents are from a remote URL. | |
121 | +<a href="javascript:void(0)" class=tt | |
122 | +onmouseover="balloon.showTooltip(event,'<iframe style=\'width:270;height:300\' frameborder=0 src=\'http://www.nypost.com/avantgo/avantnews/avantnews.htm\'></iframe>',1,300)"> | |
123 | +What's new?</a><br>This requires an embedded iframe. | |
124 | +<pre> | |
125 | + onmouseover="balloon.showTooltip(event,'\ | |
126 | + <iframe style=\'width:270;height:300;border:0\' \ | |
127 | + src=\'http://www.nypost.com/avantgo/avantnews/avantnews.htm\'></iframe>',1,300)" | |
128 | +</pre> | |
129 | +</p> | |
130 | +</body> | ... | ... |
pacotes/balloon-tooltips/htdocs_depreciado/balloons2.html
0 → 100755
... | ... | @@ -0,0 +1,313 @@ |
1 | +<html> | |
2 | +<head> | |
3 | + <title>Balloon and box tooltips demonstration</title> | |
4 | + <script type="text/javascript" src="/js/balloon.config.js"></script> | |
5 | + <script type="text/javascript" src="/js/balloon.js"></script> | |
6 | + <script type="text/javascript" src="/js/box.js"></script> | |
7 | + <script type="text/javascript" src="/js/yahoo-dom-event.js"></script> | |
8 | + <script type="text/javascript" src="/js/toggle.js"></script> | |
9 | + <style> | |
10 | + .tt { | |
11 | + background-color:lightsteelblue; | |
12 | + color:blue; | |
13 | + text-decoration:none; | |
14 | + cursor:pointer; | |
15 | + } | |
16 | + .hidden { | |
17 | + display:none; | |
18 | + } | |
19 | + pre { | |
20 | + background-color:gainsboro; | |
21 | + padding:10px; | |
22 | + margin-left:20px; | |
23 | + margin-right:20px; | |
24 | + font-family:courier; | |
25 | + font-size:90%; | |
26 | + } | |
27 | + b.y { background-color:yellow } | |
28 | + </style> | |
29 | + <script type="text/javascript"> | |
30 | + // white balloon with default configuration | |
31 | + // (see http://www.wormbase.org/wiki/index.php/Balloon_Tooltips) | |
32 | + var whiteBalloon = new Balloon; | |
33 | + | |
34 | + // stemless,shadowless blue balloon | |
35 | + var blueBalloon = new Balloon; | |
36 | + blueBalloon.balloonTextSize = '90%'; | |
37 | + blueBalloon.images = '/images/balloons'; | |
38 | + blueBalloon.balloonImage = 'blue_balloon.png'; | |
39 | + blueBalloon.vOffset = 15; | |
40 | + blueBalloon.shadow = 0; | |
41 | + blueBalloon.stem = false; | |
42 | + blueBalloon.ieImage = null; | |
43 | + | |
44 | + // a plainer popup box | |
45 | + var box = new Box; | |
46 | + box.bgcolor = 'ivory'; | |
47 | + box.fontColor = 'green'; | |
48 | + box.borderStyle = '4px ridge blue'; | |
49 | + | |
50 | + // a box that fades in/out | |
51 | + var fadeBox = new Box; | |
52 | + fadeBox.bgColor = 'black'; | |
53 | + fadeBox.fontColor = 'white'; | |
54 | + fadeBox.borderStyle = 'none'; | |
55 | + fadeBox.delayTime = 200; | |
56 | + fadeBox.allowFade = true; | |
57 | + fadeBox.fadeIn = 750; | |
58 | + fadeBox.fadeOut = 200; | |
59 | + | |
60 | + </script> | |
61 | +</head> | |
62 | +<body> | |
63 | +<div style="border:1px solid blue;background:azure;padding:10px;font-family:arial, sans-serif"> | |
64 | +<center><img src="/images/sample.png"></a> | |
65 | +</center> | |
66 | +</span> | |
67 | +<span id="sheldon" style="display:none"> | |
68 | +<center> | |
69 | +<img src="/images/sheldon.jpg"> | |
70 | +<br>mckays@cshl.edu | |
71 | +</center> | |
72 | +</span> | |
73 | +<br> | |
74 | +This page is a demonstration of balloon.js, written by <a href="http://www.gmod.org/wiki/index.php/Popup_Balloons" | |
75 | + onmouseover="whiteBalloon.showTooltip(event,'load:sheldon')">Sheldon McKay</a>. | |
76 | +<p> | |
77 | +The balloon.js package is written in object-oriented JavaScript and allows you to add configurable balloon tooltips | |
78 | +(AKA popup balloons, bubbles, rollover tooltips etc., etc.) to your website. It was written for scientific web applications, such as | |
79 | +<a href="http://gmod.org/wiki/Gbrowse" target="_blank">GBrowse</a> and <a href="http://www.wormbase.org" target="_blank">WormBase</a>, | |
80 | +but is generic and portable to most websites. | |
81 | +<br> | |
82 | +The balloons are dynamically sized in both the vertical and horizontal dimensions and the left/right/up/down orientation | |
83 | +is calculated automatically based on the position of the cursor. Balloon contents can be provided locally in your own HTML or remotely via AJAX. | |
84 | +This package is open source and free to all as long as the copyright notice is retained. See below for demonstrations and documentation. | |
85 | +<p> | |
86 | +Please feel free to <a href="mailto:mckays@cshl.edu">contact the author | |
87 | +<a> for help with installation and usage. | |
88 | +</p> | |
89 | +</p> | |
90 | +<div style="border:1px solid black;width:90%;margin:auto"> | |
91 | +<table cellpadding=3 style="width:100%"> | |
92 | +<tr> | |
93 | +<th width=10% align=left rowspan=2>Demonstration:</th> | |
94 | +<th width=30% class="tt" onmouseover="whiteBalloon.showTooltip(event,'Your message goes here',0,200)">plain hover</th> | |
95 | +<th width=30% class="tt"> | |
96 | +<span onmouseover="whiteBalloon.showTooltip(event,'Your are hovering, I said click me!')" | |
97 | + onclick="whiteBalloon.showTooltip(event,'Your sticky message goes here.',1)">click me</span> | |
98 | +</th> | |
99 | +<th width=30% class="tt"><span onmouseover="blueBalloon.showTooltip(event,'This is a stemless balloon.<br>Your message goes here!')">blue balloon</span></th> | |
100 | +</tr> | |
101 | +<tr> | |
102 | +<th class="tt"><span onmouseover="box.showTooltip(event,'Your message goes here!')">popup box</span></th> | |
103 | +<th class="tt"><span onmouseover="fadeBox.showTooltip(event,'Your message goes here!')">fading box</span></th> | |
104 | +<th class="tt"><span onmouseover="box.showTooltip(event,'Your sticky message goes here!<br><a href=\'http://www.google.com\'>Your link goes here...</a>',1,275)"> | |
105 | +sticky box</span></th> | |
106 | +</tr> | |
107 | +<tr> | |
108 | +<th align=left>Documentation:</th> | |
109 | +<th colspan=3 align=left class=tt> | |
110 | +<a class=tt href="http://gmod.org/wiki/Popup_Balloons" | |
111 | + onmouseover="whiteBalloon.showTooltip(event,'Click this link to go to documentation on the GMOD Wiki')"> | |
112 | +http://gmod.org/wiki/Popup_Balloons | |
113 | +</th> | |
114 | +</tr> | |
115 | +<tr> | |
116 | +<th align=left>Download:</th> | |
117 | +<th colspan=3 align=left class=tt> | |
118 | +<a class=tt href="http://gmod.cvs.sourceforge.net/*checkout*/gmod/balloon-tooltips/download/balloons.tar.gz" | |
119 | + onmouseover="box.showTooltip(event,'click to download the whole package, with all required scripts, images, etc',0,300)"> | |
120 | +balloons.tar.gz | |
121 | +</th> | |
122 | +</tr> | |
123 | +</table> | |
124 | +</div> | |
125 | +<br> | |
126 | +<div class="switch" id="source_code" title="source code for the above examples"> | |
127 | +<pre> | |
128 | +<head> | |
129 | + <title>Balloon tooltip demonstration</title> | |
130 | + <script type="text/javascript" src="/js/balloon.config.js"></script> | |
131 | + <script type="text/javascript" src="/js/balloon.js"></script> | |
132 | + <script type="text/javascript" src="/js/box.js"></script> | |
133 | + <script type="text/javascript" src="/js/yahoo-dom-event.js"></script> | |
134 | + <script type="text/javascript"> | |
135 | + // white balloon with default configuration | |
136 | + var whiteBalloon = new Balloon; | |
137 | + | |
138 | + // Stemless blue balloon | |
139 | + var blueBalloon = new Balloon; | |
140 | + blueBalloon.balloonTextSize = '90%'; | |
141 | + blueBalloon.images = '/images/balloons'; | |
142 | + blueBalloon.balloonImage = 'blue_balloon.png'; | |
143 | + blueBalloon.vOffset = 15; | |
144 | + blueBalloon.shadow = 0; | |
145 | + blueBalloon.stem = false; | |
146 | + blueBalloon.ieImage = null; | |
147 | + | |
148 | + // a plainer popup box | |
149 | + var box = new Box; | |
150 | + box.bgcolor = 'ivory'; | |
151 | + box.fontColor = 'blue'; | |
152 | + box.borderStyle = '4px ridge blue'; | |
153 | + | |
154 | + // a box that fades in/out | |
155 | + var fadeBox = new Box; | |
156 | + fadeBox.bgColor = 'black'; | |
157 | + fadeBox.fontColor = 'white'; | |
158 | + fadeBox.borderStyle = 'none'; | |
159 | + fadeBox.delayTime = 200; | |
160 | + fadeBox.allowFade = true; | |
161 | + fadeBox.fadeIn = 750; | |
162 | + fadeBox.fadeOut = 200; | |
163 | + | |
164 | + </script> | |
165 | +</head> | |
166 | + | |
167 | +<body> | |
168 | + | |
169 | +<table cellpadding=3> | |
170 | +<tr> | |
171 | +<th align=left rowspan=2>Demonstration:</th> | |
172 | +<th class="tt" onmouseover="whiteBalloon.showTooltip(event,'Your message goes here')">plain hover</th> | |
173 | +<th class="tt"> | |
174 | +<span onmouseover="whiteBalloon.showTooltip(event,'Your are hovering, I said click me!')" | |
175 | + onclick="whiteBalloon.showTooltip(event,'Your sticky message goes here.',1)">click me</span> | |
176 | +</th> | |
177 | +<th class="tt"><span onmouseover="blueBalloon.showTooltip(event,'This is a stemless balloon. Your message goes here!')"> | |
178 | +blue balloon | |
179 | +</span></th> | |
180 | +<th rowspan=4> | |
181 | +<a href="http://www.gmod.org/wiki/index.php/Popup_Balloons" target="_blank" | |
182 | + onmouseover="whiteBalloon.showTooltip(event,'Want to do this with your website? Click for documentation!')"> | |
183 | +<img src="/images/sample_balloon.png" style="border:2px solid black" /></a> | |
184 | +</th> | |
185 | +</tr> | |
186 | +<tr> | |
187 | +<th class="tt"><span onmouseover="box.showTooltip(event,'Your message goes here!')">popup box</span></th> | |
188 | +<th class="tt"><span onmouseover="fadeBox.showTooltip(event,'Your message goes here!')">fading box</span></th> | |
189 | +<th class="tt"><span onmouseover="box.showTooltip(event,'Your sticky message goes here!',1,275)">sticky box</span></th> | |
190 | +</tr> | |
191 | +<tr> | |
192 | +<th align=left>Documentation:</th> | |
193 | +<th colspan=3 align=left class=tt> | |
194 | +<a class=tt href="http://gmod.org/wiki/Popup_Balloons" | |
195 | + onmouseover="whiteBalloon.showTooltip(event,'Click this link to go to documentation on the GMOD Wiki')"> | |
196 | +http://gmod.org/wiki/Popup_Balloons | |
197 | +</th> | |
198 | +</tr> | |
199 | +<tr> | |
200 | +<th align=left>Download:</th> | |
201 | +<th colspan=3 align=left class=tt> | |
202 | +<a class=tt href="http://gmod.cvs.sourceforge.net/*checkout*/gmod/balloon-tooltips/download/balloons.tar.gz" | |
203 | + onmouseover="box.showTooltip(event,'click to download the whole package, with all required scripts, images, etc',0,300)"> | |
204 | +balloons.tar.gz | |
205 | +</th> | |
206 | +</tr> | |
207 | +</table> | |
208 | +</pre> | |
209 | +</div> | |
210 | +</div> | |
211 | +<div id="lorem1" class="hidden"> | |
212 | +Lorem ipsum dolor sit amet, <b><i>consectetuer adipiscing elit</b></i>. Vestibulum iaculis, | |
213 | +ligula quis fringilla volutpat, metus mi molestie lorem, <span style="color:red">quis accumsan pede | |
214 | +turpis nec metus.</span> Lorem ipsum dolor sit amet, consectetuer adipiscing elit.' | |
215 | +</div> | |
216 | + | |
217 | +<div id="lorem2" class="hidden"> | |
218 | +<a href="http://www.lipsum.com" target="_new" style="color:blue">What is <i>Lorem ipsum...</i>?</a> | |
219 | +Lorem ipsum dolor sit amet, <b><i>consectetuer adipiscing elit</b></i>. Vestibulum iaculis | |
220 | +, ligula quis fringilla volutpat, metus mi molestie lorem, quis accumsan pede | |
221 | +turpis nec metus. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. | |
222 | +</div> | |
223 | + | |
224 | +<p> | |
225 | +This is an example of a simple balloon <a href="javascript:void(0)" class=tt | |
226 | +onmouseover="whiteBalloon.showTooltip(event,'I am a simple message...')">message</a> | |
227 | + | |
228 | +<pre> | |
229 | + <a href="javascript:void(0)" onmouseover="<b class=y>whiteBalloon</b>.showTooltip(event,'I am a simple message...')">message</a> | |
230 | +</pre> | |
231 | + | |
232 | +This is an example of the same message with a different balloon <a href="javascript:void(0)" class=tt | |
233 | +onmouseover="blueBalloon.showTooltip(event,'I am a simple message...')">style</a> | |
234 | + | |
235 | +<pre> | |
236 | + onmouseover="<b class=y>blueBalloon</b>.showTooltip(event,'I am a simple message...')">message</a> | |
237 | +</pre> | |
238 | + | |
239 | +This is an example of the same message with a box <a href="javascript:void(0)" class=tt | |
240 | +onmouseover="box.showTooltip(event,'I am a simple message...')">style</a> | |
241 | + | |
242 | +<pre> | |
243 | + onmouseover="<b class=y>box</b>.showTooltip(event,'I am a simple message...')">message</a> | |
244 | +</pre> | |
245 | + | |
246 | +</p> | |
247 | + | |
248 | +<p> | |
249 | +Roll over <a href="javascript:void(0)" class=tt onmouseover="whiteBalloon.showTooltip(event,'load:lorem1')"> | |
250 | +this text</a> for an example of HTML-formatted text loaded from a hidden <div> element. | |
251 | +<pre> | |
252 | + onmouseover="whiteBalloon.showTooltip(event,<b class=y>'load:lorem1'</b>)" | |
253 | + ... | |
254 | + <div id="lorem1" style="display:none"> | |
255 | + Lorem ipsum dolor sit amet, <b><i>consectetuer adipiscing elit</b></i>. Vestibulum iaculis, | |
256 | + ligula quis fringilla volutpat, metus mi molestie lorem, <span style="color:red">quis accumsan pede | |
257 | + turpis nec metus.</span> Lorem ipsum dolor sit amet, consectetuer adipiscing elit.' | |
258 | + </div> | |
259 | + | |
260 | +</pre> | |
261 | + | |
262 | +<span id=sticky> | |
263 | +Adding a third argument makes the tooltip <a href="javascript:void(0)" class=tt | |
264 | +onmouseover="whiteBalloon.showTooltip(event,'load:lorem2',1)">sticky</a>.</span> | |
265 | +<pre> | |
266 | + onmouseover="whiteBalloon.showTooltip(event,'load:lorem2',<b class=y>1</b>)" | |
267 | +</pre> | |
268 | + | |
269 | +A fourth argument will set the width (Example:<a href="javascript:void(0)" class=tt | |
270 | +onmouseover="whiteBalloon.showTooltip(event,'load:lorem2',1,300)"> | |
271 | +300px sticky balloon</a>) | |
272 | + Try a <a href="javascript:void(0)" class=tt | |
273 | +onmouseover="blueBalloon.showTooltip(event,'load:lorem2',1,300)">blue version</a> | |
274 | + | |
275 | +<pre> | |
276 | + onmouseover="whiteBalloon.showTooltip(event,'load:lorem2',1,<b class=y>300</b>)" | |
277 | +</pre> | |
278 | + | |
279 | +Now let's try that with a <a href="javascript:void(0)" class=tt | |
280 | +onmouseover="box.showTooltip(event,'load:lorem2',1,300)"> | |
281 | +sticky box</a>. | |
282 | + | |
283 | +<pre> | |
284 | + onmouseover="box.showTooltip(event,'load:lorem2',1,<b class=y>300</b>)" | |
285 | +</pre> | |
286 | + | |
287 | +</p> | |
288 | + | |
289 | +<p> | |
290 | +Here is an example of a tooltip balloon that is populated by an | |
291 | +<a href="javascript:void(0)" class=tt | |
292 | +onmouseover="whiteBalloon.showTooltip(event,'<img height=150 src=/images/balloons.png>')"> | |
293 | +image</a>. | |
294 | +<pre> | |
295 | + onmouseover="whiteBalloon.showTooltip(event,'<img src=/images/balloons.png>')" | |
296 | +</pre> | |
297 | +</p> | |
298 | + | |
299 | +<p> | |
300 | +This link will create a sticky balloon whose contents are from a remote URL. | |
301 | +<a href="javascript:void(0)" class=tt | |
302 | +onmouseover="whiteBalloon.showTooltip(event,'<iframe style=\'width:300;height:300;padding-right:16px\' frameborder=0 src=\'http://www.nypost.com/avantgo/avantnews/avantnews.htm\'></iframe>',1)"> | |
303 | +What's new?</a><br>This requires an embedded iframe. | |
304 | +<pre> | |
305 | + onmouseover="whiteBalloon.showTooltip(event,'\ | |
306 | + <iframe style=\'width:300;height:300;border:0;padding-right:16px\' \ | |
307 | + src=\'http://www.nypost.com/avantgo/avantnews/avantnews.htm\'></iframe>',1)" | |
308 | +</pre> | |
309 | +<br> | |
310 | +Ajax methods are <a href="http://gmod.org/wiki/Popup_Balloons#Using_AJAX_to_get_balloon_contents">also available</a>. | |
311 | +</p> | |
312 | +</body> | |
313 | +</html> | ... | ... |
10.1 KB
13.5 KB
14.5 KB
304 Bytes
582 Bytes
578 Bytes
584 Bytes
588 Bytes
pacotes/balloon-tooltips/htdocs_depreciado/js/balloon.config.js
0 → 100755
... | ... | @@ -0,0 +1,209 @@ |
1 | +/*jslint plusplus:false,white:false,undef: false, rhino: true, onevar: true, evil: true */ | |
2 | + | |
3 | +/* | |
4 | +This file contains the default configuration options. | |
5 | +Default options can be edited in this file or changed after the Balloon object is | |
6 | +initiliazed as follows: | |
7 | + | |
8 | + var balloon = new Balloon; | |
9 | + balloon.fontColor = 'black'; | |
10 | + balloon.fontFamily = 'Arial, sans-serif'; | |
11 | + balloon.fontSize = '12pt'; | |
12 | + | |
13 | +*/ | |
14 | + | |
15 | +// Adds all the instance variables to the balloon object. | |
16 | +// Edit the values as required for your implementation. | |
17 | +BalloonConfig = function(balloon) { | |
18 | + | |
19 | + // ID of element to which balloon should be added | |
20 | + // default = none (document.body is used) | |
21 | + // This option may be required for mediawiki or other | |
22 | + // implementations with complex stylesheets | |
23 | + balloon.parentID = null; | |
24 | + | |
25 | + // properties of fonts contained in basic balloons (default black) | |
26 | + balloon.fontColor = 'black'; | |
27 | + balloon.fontFamily = 'Arial, sans-serif'; | |
28 | + balloon.fontSize = '12pt'; | |
29 | + | |
30 | + // minimum allowed balloon width (px) | |
31 | + balloon.minWidth = 150; | |
32 | + | |
33 | + // maximum allowed balloon width (px) | |
34 | + balloon.maxWidth = 600; | |
35 | + | |
36 | + // Delay before balloon is displayed (msec) | |
37 | + balloon.delayTime = 500; | |
38 | + | |
39 | + // If fade-in/out is allowed | |
40 | + balloon.allowFade = false; | |
41 | + | |
42 | + // time interval for fade-in (msec) | |
43 | + balloon.fadeIn = 300; | |
44 | + | |
45 | + // time interval for fade-out (msec) | |
46 | + balloon.fadeOut = 300; | |
47 | + | |
48 | + // Vertical Distance from cursor location (px) | |
49 | + balloon.vOffset = 0; | |
50 | + | |
51 | + // text-padding within the balloon (px) | |
52 | + balloon.padding = 10; | |
53 | + | |
54 | + // How long to display mousover balloons (msec) | |
55 | + // false = 'always on' | |
56 | + balloon.displayTime = 10000; | |
57 | + | |
58 | + // width of shadow (space aroung whole balloon; px) | |
59 | + // Balloon can be zero if there is no shadow and the | |
60 | + // edges of the balloon are also the edges of the image | |
61 | + balloon.shadow = 20; | |
62 | + | |
63 | + // images of balloon body. If the browser is IE < 7, png alpha | |
64 | + // channels will not work. An optional alternative image can be | |
65 | + // provided. It should have the same dimensions as the default png image | |
66 | + balloon.images = i3GEO.configura.locaplic+'/pacotes/balloon-tooltips/htdocs/images/'; | |
67 | + balloon.balloonImage = 'balloon.png'; // with alpha channels | |
68 | + balloon.ieImage = 'balloon_ie.png'; // indexed color, transparent background | |
69 | + | |
70 | + // whether the balloon should have a stem | |
71 | + balloon.stem = true; | |
72 | + | |
73 | + // The height (px) of the stem and the extent to which the | |
74 | + // stem image should overlaps the balloon image. | |
75 | + balloon.stemHeight = 32; | |
76 | + balloon.stemOverlap = 3; | |
77 | + | |
78 | + // A stem for each of the four orientations | |
79 | + balloon.upLeftStem = 'up_left.png'; | |
80 | + balloon.downLeftStem = 'down_left.png'; | |
81 | + balloon.upRightStem = 'up_right.png'; | |
82 | + balloon.downRightStem = 'down_right.png'; | |
83 | + | |
84 | + // A close button for sticky balloons | |
85 | + // specify the width of your button image | |
86 | + // if you do not use the default image provided | |
87 | + balloon.closeButton = 'close.png'; | |
88 | + balloon.closeButtonWidth = 16; | |
89 | + | |
90 | + | |
91 | + | |
92 | + /* | |
93 | + This section allows support for AJAX, iframes and JavaScript in balloons | |
94 | + If you have concerns about XSS vulnerabilities, set some or all of these | |
95 | + values to false; | |
96 | + */ | |
97 | + | |
98 | + /// URL for default AJAX request handler | |
99 | + balloon.helpUrl = false; | |
100 | + | |
101 | + // Should AJAX be allowed at all? | |
102 | + balloon.allowAJAX = true; | |
103 | + | |
104 | + // Allow iframe elements in balloons? | |
105 | + balloon.allowIframes = true; | |
106 | + | |
107 | + // Allow javascript event handlers in balloons? | |
108 | + balloon.allowEventHandlers = false; | |
109 | + | |
110 | + // Allow <script> elements in balloons? | |
111 | + balloon.allowScripts = false; | |
112 | + | |
113 | + // Escape all HTML characters -- this will be very | |
114 | + // unnattractive unless your AJAX request returns plain | |
115 | + // text. short of disallowing AJAX entirely, This is the safe | |
116 | + // way to go if you must have AJAX in an environment where | |
117 | + // outside users can send text to the browser/balloon | |
118 | + balloon.escapeHTML = false; | |
119 | +}; | |
120 | + | |
121 | +// simple Box alternative | |
122 | +BoxConfig = function(box) { | |
123 | + box.isBox = true; | |
124 | + | |
125 | + // ID of element to which box should be added | |
126 | + // default = none (document.body is used) | |
127 | + // This option may be required for mediawiki or other | |
128 | + // implementations with complex stylesheets | |
129 | + box.parentID = null; | |
130 | + | |
131 | + // properties of fonts contained in basic boxes (default black) | |
132 | + box.fontColor = 'black'; | |
133 | + box.fontFamily = 'Arial, sans-serif'; | |
134 | + box.fontSize = '12pt'; | |
135 | + | |
136 | + // border and bgcolor for plain box | |
137 | + box.bgColor = 'whitesmoke'; | |
138 | + box.borderStyle = '1px solid black'; | |
139 | + | |
140 | + // minimum allowed box width (px) | |
141 | + box.minWidth = 150; | |
142 | + | |
143 | + // maximum allowed box width (px) | |
144 | + box.maxWidth = 600; | |
145 | + | |
146 | + // Delay before box is displayed (msec) | |
147 | + box.delayTime = 500; | |
148 | + | |
149 | + // If fade-in/out is allowed | |
150 | + box.allowFade = false; | |
151 | + | |
152 | + // time interval for fade-in (msec) | |
153 | + box.fadeIn = 300; | |
154 | + | |
155 | + // time interval for fade-out (msec) | |
156 | + box.fadeOut = 300; | |
157 | + | |
158 | + // Vertical Distance from cursor location (px) | |
159 | + box.vOffset = 5; | |
160 | + | |
161 | + // text-padding within the box (px) | |
162 | + box.padding = 10; | |
163 | + | |
164 | + // How long to display mousover boxes (msec) | |
165 | + // false = 'always on' | |
166 | + box.displayTime = 10000; | |
167 | + | |
168 | + // no shadows for plain box | |
169 | + box.shadow = 0; | |
170 | + | |
171 | + // no stem for boxes | |
172 | + box.stem = false; | |
173 | + | |
174 | + // A close button for sticky boxes | |
175 | + // specify the width of your button image | |
176 | + // if you do not use the default image provided | |
177 | + box.images = '/images/balloons'; | |
178 | + box.closeButton = 'close.png'; | |
179 | + box.closeButtonWidth = 16; | |
180 | + | |
181 | + /* | |
182 | + This section allows support for AJAX, iframes and JavaScript in boxes | |
183 | + If you have concerns about XSS vulnerabilities, set some or all of these | |
184 | + values to false; | |
185 | + */ | |
186 | + | |
187 | + /// URL for default AJAX request handler | |
188 | + box.helpUrl = false; | |
189 | + | |
190 | + // Should AJAX be allowed at all? | |
191 | + box.allowAJAX = true; | |
192 | + | |
193 | + // Allow iframe elements in boxes? | |
194 | + box.allowIframes = true; | |
195 | + | |
196 | + // Allow javascript event handlers in boxes? | |
197 | + box.allowEventHandlers = false; | |
198 | + | |
199 | + // Allow <script> elements in boxes? | |
200 | + box.allowScripts = false; | |
201 | + | |
202 | + // Escape all HTML characters -- this will be very | |
203 | + // unnattractive unless your AJAX request returns plain | |
204 | + // text. short of disallowing AJAX entirely, This is the safe | |
205 | + // way to go if you must have AJAX in an environment where | |
206 | + // outside users can send text to the browser/box | |
207 | + box.escapeHTML = false; | |
208 | +}; | |
209 | + | ... | ... |
pacotes/balloon-tooltips/htdocs_depreciado/js/balloon.js
0 → 100755
... | ... | @@ -0,0 +1,922 @@ |
1 | +/*jslint plusplus:false,white:false,undef: false, rhino: false, onevar: false, evil: false */ | |
2 | + | |
3 | +/* | |
4 | + balloon.js -- a DHTML library for balloon tooltips | |
5 | + | |
6 | + $Id: balloon.js,v 1.41 2008/09/23 16:33:17 sheldon_mckay Exp $ | |
7 | + | |
8 | + See http://www.gmod.org/wiki/index.php/Popup_Balloons | |
9 | + for documentation. | |
10 | + | |
11 | + Copyright (c) 2007,2008 Sheldon McKay, Cold Spring Harbor Laboratory | |
12 | + | |
13 | + This balloon tooltip package and associated files not otherwise copyrighted are | |
14 | + distributed under the MIT-style license: | |
15 | + | |
16 | + http://opensource.org/licenses/mit-license.php | |
17 | + | |
18 | + Permission is hereby granted, free of charge, to any person obtaining a copy | |
19 | + of this software and associated documentation files (the "Software"), to deal | |
20 | + in the Software without restriction, including without limitation the rights | |
21 | + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
22 | + copies of the Software, and to permit persons to whom the Software is | |
23 | + furnished to do so, subject to the following conditions: | |
24 | + | |
25 | + The above copyright notice and this permission notice shall be included in | |
26 | + all copies or substantial portions of the Software. | |
27 | + | |
28 | + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
29 | + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
30 | + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
31 | + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
32 | + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
33 | + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |
34 | + THE SOFTWARE. | |
35 | + | |
36 | +*/ | |
37 | + | |
38 | +// These global variables are necessary to avoid losing scope when | |
39 | +//setting the balloon timeout and for inter-object communication | |
40 | +var currentBalloonClass; | |
41 | +var balloonIsVisible; | |
42 | +var balloonIsSticky; | |
43 | +var balloonInvisibleSelects; | |
44 | +var balloonIsSuppressed; | |
45 | +var tooltipIsSuppressed; | |
46 | + | |
47 | + | |
48 | +////////////////////////////////////////////////////////////////////////// | |
49 | +// This is constructor that is called to initialize the Balloon object // | |
50 | +////////////////////////////////////////////////////////////////////////// | |
51 | +var Balloon = function () { | |
52 | + | |
53 | + // Get default configuration from balloon.config.js | |
54 | + BalloonConfig(this); | |
55 | + | |
56 | + // Track the cursor every time the mouse moves | |
57 | + document.onmousemove = this.setActiveCoordinates; | |
58 | + | |
59 | + // scrolling aborts unsticky balloons | |
60 | + document.onscroll = Balloon.prototype.hideTooltip; | |
61 | + | |
62 | + // make balloons go away if the page is unloading or waiting | |
63 | + // to unload. | |
64 | + window.onbeforeunload = function(){ | |
65 | + Balloon.prototype.hideTooltip(1); | |
66 | + balloonIsSuppressed = true; | |
67 | + }; | |
68 | + | |
69 | + // for IE, the balloons can;t start until the page is finished loading | |
70 | + // set a flag that will get toggled when loading is finished | |
71 | + if (this.isIE()) { | |
72 | + this.suppress = true; | |
73 | + } | |
74 | + | |
75 | + return this; | |
76 | +}; | |
77 | + | |
78 | +////////////////////////////////////////////////////////////////////////// | |
79 | +// This is the function that is called on mouseover. It has a built-in // | |
80 | +// delay time to avoid balloons popping up on rapid mouseover events // | |
81 | +////////////////////////////////////////////////////////////////////////// | |
82 | +Balloon.prototype.showTooltip = function(evt,caption,sticky,width) { | |
83 | + // Awful IE bug, page load aborts if the balloon is fired | |
84 | + // before the page is fully loaded. | |
85 | + if (this.isIE() && document.readyState.match(/complete/i)) { | |
86 | + this.suppress = false; | |
87 | + } | |
88 | + | |
89 | + // All balloons have been suppressed, go no further | |
90 | + if (this.suppress || balloonIsSuppressed) { | |
91 | + return false; | |
92 | + } | |
93 | + | |
94 | + // Non-sticky balloons suppressed | |
95 | + if (tooltipIsSuppressed && !sticky) { | |
96 | + return false; | |
97 | + } | |
98 | + | |
99 | + // Sorry Konqueror, no fade-in for you! | |
100 | + if (this.isKonqueror()) this.allowFade = false; | |
101 | + | |
102 | + // Check for mouseover (vs. mousedown or click) | |
103 | + var mouseOver = true; | |
104 | + try{ | |
105 | + var mouseOver = evt.type.match('mouseover','i'); | |
106 | + }catch(e){} | |
107 | + | |
108 | + // if the firing event is a click, fade-in and a non-sticky balloon make no sense | |
109 | + if (!mouseOver) { | |
110 | + sticky = true; | |
111 | + this.fadeOK = false; | |
112 | + } | |
113 | + else { | |
114 | + this.fadeOK = this.allowFade; | |
115 | + } | |
116 | + | |
117 | + // Don't fire on mouseover if a non-sticky balloon is visible | |
118 | + if (balloonIsVisible && !balloonIsSticky && mouseOver) return false; | |
119 | + | |
120 | + // Don't start a non-sticky balloon if a sticky one is visible | |
121 | + if (balloonIsVisible && balloonIsSticky && !sticky) return false; | |
122 | + | |
123 | + // Ignore repeated firing of mouseover->mouseout events on | |
124 | + // the same element (Safari) | |
125 | + try{ | |
126 | + var el = this.getEventTarget(evt); | |
127 | + }catch(e){var el = evt;} | |
128 | + if (sticky && mouseOver && this.isSameElement(el,this.currentElement)) return false; | |
129 | + this.firingElement = el; | |
130 | + | |
131 | + // A new sticky balloon can erase an old one | |
132 | + if (sticky) this.hideTooltip(1); | |
133 | + | |
134 | + // attach a mouseout event handler to the target element | |
135 | + var closeBalloon = function() { | |
136 | + var override = balloonIsSticky && !balloonIsVisible; | |
137 | + Balloon.prototype.hideTooltip(override); | |
138 | + i3GEO.janela.excluiTips(); | |
139 | + }; | |
140 | + if (!mouseOver) el.onmouseup = function() {return false;}; | |
141 | + el.onmouseout = closeBalloon; | |
142 | + | |
143 | + balloonIsSticky = sticky; | |
144 | + | |
145 | + // force balloon width and/or height if requested | |
146 | + this.width = width; | |
147 | + | |
148 | + this.hideTooltip(); | |
149 | + | |
150 | + // request the contents synchronously (ie wait for result) | |
151 | + this.currentHelpText = this.getAndCheckContents(caption); | |
152 | + | |
153 | + // no contents? abort. | |
154 | + if (!this.currentHelpText) { | |
155 | + return false; | |
156 | + } | |
157 | + | |
158 | + // Put the balloon contents and images into a visible (but offscreen) | |
159 | + // element so they will be preloaded and have a layout to | |
160 | + // calculate the balloon dimensions | |
161 | + if (!this.container) { | |
162 | + this.container = document.createElement('div'); | |
163 | + document.body.appendChild(this.container); | |
164 | + this.setStyle(this.container,'position','absolute'); | |
165 | + this.setStyle(this.container,'top',-8888); | |
166 | + this.setStyle(this.container,'display','inline'); | |
167 | + this.setStyle(this.container,'z-index',2); | |
168 | + this.setStyle(this.container,'color',this.fontColor); | |
169 | + this.setStyle(this.container,'font-family',this.fontFamily); | |
170 | + this.setStyle(this.container,'font-size',this.fontSize); | |
171 | + } | |
172 | + else { | |
173 | + this.setStyle(this.container,'display','inline'); | |
174 | + } | |
175 | + | |
176 | + this.container.innerHTML = unescape(this.currentHelpText); | |
177 | + | |
178 | + // make sure balloon image path is complete | |
179 | + if (this.images) { | |
180 | + // main background image | |
181 | + this.balloonImage = this.balloonImage ? this.images +'/'+ this.balloonImage : false; | |
182 | + this.ieImage = this.ieImage ? this.images +'/'+ this.ieImage : false; | |
183 | + | |
184 | + // optional stems | |
185 | + this.upLeftStem = this.upLeftStem ? this.images +'/'+ this.upLeftStem : false; | |
186 | + this.upRightStem = this.upRightStem ? this.images +'/'+ this.upRightStem : false; | |
187 | + this.downLeftStem = this.downLeftStem ? this.images +'/'+ this.downLeftStem : false; | |
188 | + this.downRightStem = this.downRightStem ? this.images +'/'+ this.downRightStem : false; | |
189 | + | |
190 | + this.closeButton = this.closeButton ? this.images +'/'+ this.closeButton : false; | |
191 | + | |
192 | + this.images = false; | |
193 | + } | |
194 | + | |
195 | + // if this is IE < 7 use an alternative image (if provided) | |
196 | + if (this.isOldIE() && this.ieImage) { | |
197 | + this.balloonImage = this.ieImage; | |
198 | + } | |
199 | + | |
200 | + // preload balloon images | |
201 | + if (!this.preloadedImages) { | |
202 | + var images = new Array(this.balloonImage, this.closeButton); | |
203 | + if (this.ieImage) { | |
204 | + images.push(this.ieImage); | |
205 | + } | |
206 | + if (this.stem) { | |
207 | + images.push(this.upLeftStem,this.upRightStem,this.downLeftStem,this.downRightStem); | |
208 | + } | |
209 | + var len = images.length; | |
210 | + for (var i=0;i<len;i++) { | |
211 | + if ( images[i] ) { | |
212 | + this.preload(images[i]); | |
213 | + } | |
214 | + } | |
215 | + this.preloadedImages = true; | |
216 | + } | |
217 | + | |
218 | + currentBalloonClass = this; | |
219 | + | |
220 | + // Capture coordinates for mousedown or click | |
221 | + if (!mouseOver) this.setActiveCoordinates(evt); | |
222 | +this.setActiveCoordinates(evt); | |
223 | + // Remember which event started this | |
224 | + this.currentEvent = evt; | |
225 | + this.doShowTooltip(); // | |
226 | + | |
227 | + // Make delay time short for onmousedown | |
228 | + //var delay = mouseOver ? this.delayTime : 1; | |
229 | + //this.timeoutTooltip = window.setTimeout(this.doShowTooltip,1); | |
230 | +}; | |
231 | + | |
232 | + | |
233 | +// Preload the balloon background images | |
234 | +Balloon.prototype.preload = function(src) { | |
235 | + var i = new Image; | |
236 | + i.src = src; | |
237 | + | |
238 | + // append to the DOM tree so the images have a layout, | |
239 | + // then remove. | |
240 | + this.setStyle(i,'position','absolute'); | |
241 | + this.setStyle(i,'top',-8000); | |
242 | + document.body.appendChild(i); | |
243 | + document.body.removeChild(i); | |
244 | +}; | |
245 | + | |
246 | + | |
247 | +///////////////////////////////////////////////////////////////////// | |
248 | +// Tooltip rendering function | |
249 | +///////////////////////////////////////////////////////////////////// | |
250 | +Balloon.prototype.doShowTooltip = function() { | |
251 | + var self = currentBalloonClass; | |
252 | + | |
253 | + // Stop firing if a balloon is already being displayed | |
254 | + if (balloonIsVisible) return false; | |
255 | + | |
256 | + if (!self.parent) { | |
257 | + if (self.parentID) { | |
258 | + self.parent = document.getElementById(self.parentID); | |
259 | + } | |
260 | + else { | |
261 | + self.parent = document.body; | |
262 | + } | |
263 | + self.xOffset = self.getLoc(self.parent, 'x1'); | |
264 | + self.yOffset = self.getLoc(self.parent, 'y1'); | |
265 | + } | |
266 | + | |
267 | + // a short delay time might cause some intereference | |
268 | + // with fade-out | |
269 | + window.clearTimeout(self.timeoutFade); | |
270 | + self.setStyle('balloon','display','none'); | |
271 | + | |
272 | + // make sure user-configured numbers are not strings | |
273 | + self.parseIntAll(); | |
274 | + | |
275 | + // create the balloon object | |
276 | + var balloon = self.makeBalloon(); | |
277 | + | |
278 | + // window dimensions | |
279 | + var pageWidth = YAHOO.util.Dom.getViewportWidth(); | |
280 | + var pageCen = Math.round(pageWidth/2); | |
281 | + var pageHeight = YAHOO.util.Dom.getViewportHeight(); | |
282 | + var pageLeft = YAHOO.util.Dom.getDocumentScrollLeft(); | |
283 | + var pageTop = YAHOO.util.Dom.getDocumentScrollTop(); | |
284 | + var pageMid = pageTop + Math.round(pageHeight/2); | |
285 | + self.pageBottom = pageTop + pageHeight; | |
286 | + self.pageTop = pageTop; | |
287 | + | |
288 | + // do we have a cursor position? | |
289 | + if (!(self.activeTop && self.activeRight)) { | |
290 | + self.setActiveCoordinates(); | |
291 | + } | |
292 | + // balloon orientation | |
293 | + var vOrient = self.activeTop > pageMid ? 'up' : 'down'; | |
294 | + var hOrient = self.activeRight > pageCen ? 'left' : 'right'; | |
295 | + | |
296 | + // get the preloaded balloon contents | |
297 | + var helpText = self.container.innerHTML; | |
298 | + | |
299 | + self.contents.innerHTML = helpText; | |
300 | + // how and where to draw the balloon | |
301 | + self.setBalloonStyle(vOrient,hOrient,pageWidth,pageLeft); | |
302 | + | |
303 | + // close control for balloon or box | |
304 | + if (balloonIsSticky) { | |
305 | + self.addCloseButton(); | |
306 | + } | |
307 | + | |
308 | + balloonIsVisible = true; | |
309 | + | |
310 | + // in IE < 7, hide <select> elements | |
311 | + self.showHide(); | |
312 | + | |
313 | + self.fade(0,95,self.fadeIn); | |
314 | +}; | |
315 | + | |
316 | +Balloon.prototype.addCloseButton = function () { | |
317 | + var self = currentBalloonClass; | |
318 | + var margin = Math.round(self.padding/2); | |
319 | + var closeWidth = self.closeButtonWidth || 16; | |
320 | + var balloonTop = self.getLoc('balloon','y1') + margin + self.shadow; | |
321 | + var BalloonLeft = self.getLoc('topRight','x2') - self.closeButtonWidth - self.shadow - margin; | |
322 | + var closeButton = document.getElementById('closeButton'); | |
323 | + | |
324 | + if (!closeButton) { | |
325 | + closeButton = new Image; | |
326 | + closeButton.setAttribute('id','closeButton'); | |
327 | + closeButton.setAttribute('src',self.closeButton); | |
328 | + closeButton.onclick = function() { | |
329 | + Balloon.prototype.hideTooltip(1); | |
330 | + if($i("marcaIdentifica")) | |
331 | + {document.body.removeChild($i("marcaIdentifica"));} | |
332 | + }; | |
333 | + self.setStyle(closeButton,'position','absolute'); | |
334 | + document.body.appendChild(closeButton); | |
335 | + } | |
336 | + | |
337 | + self.setStyle(closeButton,'top',balloonTop); | |
338 | + self.setStyle(closeButton,'left',BalloonLeft); | |
339 | + self.setStyle(closeButton,'display','inline'); | |
340 | + self.setStyle(closeButton,'cursor','pointer'); | |
341 | + self.setStyle(closeButton,'z-index',999999999); | |
342 | +}; | |
343 | + | |
344 | +// use a fresh object every time to make sure style | |
345 | +// is not polluted | |
346 | +Balloon.prototype.makeBalloon = function() { | |
347 | + var self = currentBalloonClass; | |
348 | + | |
349 | + var balloon = document.getElementById('balloon'); | |
350 | + if (balloon) self.parent.removeChild(balloon); | |
351 | + | |
352 | + balloon = document.createElement('div'); | |
353 | + balloon.setAttribute('id','balloon'); | |
354 | + self.parent.appendChild(balloon); | |
355 | + self.activeBalloon = balloon; | |
356 | + | |
357 | + self.parts = new Array(balloon); | |
358 | + var parts = new Array('contents','topRight','bottomRight','bottomLeft'); | |
359 | + for (var i=0;i<parts.length;i++) { | |
360 | + var child = document.createElement('div'); | |
361 | + child.setAttribute('id',parts[i]); | |
362 | + balloon.appendChild(child); | |
363 | + if (parts[i] == 'contents') self.contents = child; | |
364 | + self.parts.push(child); | |
365 | + } | |
366 | + | |
367 | + self.setStyle('contents','z-index',2); | |
368 | + self.setStyle('contents','color',self.fontColor); | |
369 | + self.setStyle('contents','font-family',self.fontFamily); | |
370 | + self.setStyle('contents','font-size',self.fontSize); | |
371 | + | |
372 | + if (balloonIsSticky) { | |
373 | + self.setStyle('contents','margin-right',10); | |
374 | + } | |
375 | + else if (self.displayTime) { | |
376 | + self.timeoutAutoClose = window.setTimeout(this.hideTooltip,self.displayTime); | |
377 | + } | |
378 | + return balloon; | |
379 | +}; | |
380 | + | |
381 | + | |
382 | +Balloon.prototype.setBalloonStyle = function(vOrient,hOrient,pageWidth,pageLeft) { | |
383 | + var self = currentBalloonClass; | |
384 | + var balloon = self.activeBalloon; | |
385 | + | |
386 | + if (typeof(self.shadow) != 'number') self.shadow = 0; | |
387 | + if (!self.stem) self.stemHeight = 0; | |
388 | + | |
389 | + var fullPadding = self.padding + self.shadow; | |
390 | + var insidePadding = self.padding; | |
391 | + | |
392 | + self.setStyle(balloon,'background','url('+self.balloonImage+') top left no-repeat'); | |
393 | + self.setStyle(balloon,'position','absolute'); | |
394 | + self.setStyle(balloon,'padding-top',fullPadding); | |
395 | + self.setStyle(balloon,'padding-left',fullPadding); | |
396 | + self.setStyle(balloon,'top',-9999); | |
397 | + self.setStyle(balloon,'z-index',1000000); | |
398 | + | |
399 | + | |
400 | + self.setStyle('bottomRight','background','url('+self.balloonImage+') bottom right no-repeat'); | |
401 | + self.setStyle('bottomRight','position','absolute'); | |
402 | + self.setStyle('bottomRight','right',0-fullPadding); | |
403 | + self.setStyle('bottomRight','bottom',0-fullPadding); | |
404 | + self.setStyle('bottomRight','height',fullPadding); | |
405 | + self.setStyle('bottomRight','width',fullPadding); | |
406 | + self.setStyle('bottomRight','z-index',-1); | |
407 | + | |
408 | + self.setStyle('topRight','background','url('+self.balloonImage+') top right no-repeat'); | |
409 | + self.setStyle('topRight','position','absolute'); | |
410 | + self.setStyle('topRight','right',0-fullPadding); | |
411 | + self.setStyle('topRight','top',0); | |
412 | + self.setStyle('topRight','width',fullPadding); | |
413 | + | |
414 | + self.setStyle('bottomLeft','background','url('+self.balloonImage+') bottom left no-repeat'); | |
415 | + self.setStyle('bottomLeft','position','absolute'); | |
416 | + self.setStyle('bottomLeft','left',0); | |
417 | + self.setStyle('bottomLeft','bottom',0-fullPadding); | |
418 | + self.setStyle('bottomLeft','height',fullPadding); | |
419 | + self.setStyle('bottomLeft','z-index',-1); | |
420 | + | |
421 | + if (this.stem) { | |
422 | + var stem = document.createElement('img'); | |
423 | + self.setStyle(stem,'position','absolute'); | |
424 | + balloon.appendChild(stem); | |
425 | + | |
426 | + if (vOrient == 'up' && hOrient == 'left') { | |
427 | + stem.src = self.upLeftStem; | |
428 | + var height = self.stemHeight + insidePadding - self.stemOverlap; | |
429 | + self.setStyle(stem,'bottom',0-height); | |
430 | + self.setStyle(stem,'right',0); | |
431 | + } | |
432 | + else if (vOrient == 'down' && hOrient == 'left') { | |
433 | + stem.src = self.downLeftStem; | |
434 | + var height = self.stemHeight - (self.shadow + self.stemOverlap); | |
435 | + self.setStyle(stem,'top',0-height); | |
436 | + self.setStyle(stem,'right',0); | |
437 | + } | |
438 | + else if (vOrient == 'up' && hOrient == 'right') { | |
439 | + stem.src = self.upRightStem; | |
440 | + var height = self.stemHeight + insidePadding - self.stemOverlap; | |
441 | + self.setStyle(stem,'bottom',0-height); | |
442 | + self.setStyle(stem,'left',self.shadow); | |
443 | + } | |
444 | + else if (vOrient == 'down' && hOrient == 'right') { | |
445 | + stem.src = self.downRightStem; | |
446 | + var height = self.stemHeight - (self.shadow + self.stemOverlap); | |
447 | + self.setStyle(stem,'top',0-height); | |
448 | + self.setStyle(stem,'left',self.shadow); | |
449 | + } | |
450 | + | |
451 | + } | |
452 | +// | |
453 | + // flip left or right, as required | |
454 | + if (hOrient == 'left') { | |
455 | + var activeRight = pageWidth - self.activeLeft; | |
456 | + self.setStyle(balloon,'right',activeRight);// - self.xOffset); | |
457 | + } | |
458 | + else { | |
459 | + self.setStyle(balloon,'left',self.activeRight - self.xOffset); | |
460 | + } | |
461 | + | |
462 | + if (!self.width) { | |
463 | + var width = self.getLoc('contents','width'); | |
464 | + if (self.isIE()) width += 50; | |
465 | + if (width > self.maxWidth) width = self.maxWidth + 50; | |
466 | + if (width < self.minWidth) width = self.minWidth; | |
467 | + self.setStyle(balloon,'width',width); | |
468 | + } | |
469 | + else { | |
470 | + self.setStyle(balloon,'width',self.width); | |
471 | + } | |
472 | +// | |
473 | + // Make sure the balloon is not offscreen | |
474 | + var balloonPad = self.padding + self.shadow; | |
475 | + var balloonLeft = self.getLoc(balloon,'x1'); | |
476 | + var balloonRight = self.getLoc(balloon,'x2'); | |
477 | + if (hOrient == 'left') balloonLeft += balloonPad; | |
478 | + if (hOrient == 'right') balloonRight += balloonPad; | |
479 | + var pageRight = pageLeft + pageWidth; | |
480 | + | |
481 | + if (hOrient == 'right' && balloonRight > (pageRight-30)) { | |
482 | + self.setStyle(balloon,'width',(pageRight - balloonLeft) - 50); | |
483 | + } | |
484 | + else if (hOrient == 'left' && balloonLeft < (pageLeft+30)) { | |
485 | + self.setStyle(balloon,'width',(balloonRight - pageLeft) - 50); | |
486 | + } | |
487 | + | |
488 | + // Set the width/height for the right and bottom outlines | |
489 | + var lineWidth = self.getLoc(balloon,'width'); | |
490 | + var lineHeight = self.getLoc(balloon,'height'); | |
491 | + | |
492 | + self.setStyle('topRight','height',lineHeight); | |
493 | + self.setStyle('bottomLeft','width',lineWidth); | |
494 | + | |
495 | +// | |
496 | + | |
497 | + // IE7 quirk -- look for unwanted overlap cause by an off by 1px error | |
498 | + var vOverlap = self.isOverlap('topRight','bottomRight'); | |
499 | + var hOverlap = self.isOverlap('bottomLeft','bottomRight'); | |
500 | + if (vOverlap) self.setStyle('topRight','height',lineHeight-vOverlap[1]); | |
501 | + if (hOverlap) self.setStyle('bottomLeft','width',lineWidth-hOverlap[0]); | |
502 | + if (vOrient == 'up') { | |
503 | + var activeTop = self.activeTop - self.vOffset - self.stemHeight - lineHeight; | |
504 | + self.setStyle(balloon,'top',activeTop - self.yOffset); | |
505 | + self.setStyle(balloon,'display','inline'); | |
506 | + } | |
507 | + else { | |
508 | + var activeTop = self.activeTop + self.vOffset + self.stemHeight; | |
509 | + self.setStyle(balloon,'top',activeTop - self.yOffset); | |
510 | + } | |
511 | + self.setOpacity(1); | |
512 | +};; | |
513 | + | |
514 | +// Fade method adapted from an example on | |
515 | +// http://brainerror.net/scripts/javascript/blendtrans/ | |
516 | +Balloon.prototype.fade = function(opacStart, opacEnd, millisec) { | |
517 | + var self = currentBalloonClass || new Balloon; | |
518 | + | |
519 | + //speed for each frame | |
520 | + var speed = Math.round(millisec / 100); | |
521 | + var timer = 0; | |
522 | + if(opacStart > opacEnd) { | |
523 | + if (self.fadeOK) { | |
524 | + for(o = opacStart; o >= opacEnd; o--) { | |
525 | + self.timeoutFade = setTimeout('Balloon.prototype.setOpacity('+o+')',(timer*speed)); | |
526 | + timer++; | |
527 | + } | |
528 | + setTimeout("Balloon.prototype.setStyle('balloon','display','none')",millisec); | |
529 | + } | |
530 | + else { | |
531 | + self.setStyle('balloon','display','none'); | |
532 | + } | |
533 | + } | |
534 | + else if(opacStart < opacEnd && self.fadeOK) { | |
535 | + for(o = opacStart; o <= opacEnd; o++) { | |
536 | + self.timeoutFade = setTimeout('Balloon.prototype.setOpacity('+o+')',(timer*speed)); | |
537 | + timer++; | |
538 | + } | |
539 | + } | |
540 | +}; | |
541 | + | |
542 | +Balloon.prototype.setOpacity = function(opc) { | |
543 | + var self = currentBalloonClass; | |
544 | + if (!self || !self.fadeOK) return false; | |
545 | + | |
546 | + var o = parseFloat((opc||0)/100); | |
547 | + | |
548 | + ///////////////////////////////////////////////////////////// | |
549 | + // Very irritating IE deficiency: it can't handle changing // | |
550 | + // opacity of child elements. Just fade balloon contents // | |
551 | + // for IE and the whole balloon for less obtuse browsers. // | |
552 | + var el = self.isIE() ? 'contents' : 'balloon'; // | |
553 | + ///////////////////////////////////////////////////////////// | |
554 | + | |
555 | + var b = document.getElementById(el); | |
556 | + if (!b) return false; | |
557 | + | |
558 | + // CSS standards-compliant browsers! | |
559 | + self.setStyle(b,'opacity',o); | |
560 | + // old IE | |
561 | + self.setStyle(b,'filter','alpha(opacity= '+opc+')'); | |
562 | + // old Mozilla/NN | |
563 | + self.setStyle(b,'MozOpacity',o); | |
564 | + // old Safari | |
565 | + self.setStyle(b,'KhtmlOpacity',o); | |
566 | + | |
567 | +}; | |
568 | + | |
569 | +Balloon.prototype.hideTooltip = function(override) { | |
570 | + // some browsers pass the event object == we don't want it | |
571 | + if (override && typeof override == 'object') override = false; | |
572 | + if (balloonIsSticky && !override) return false; | |
573 | + | |
574 | + var self = currentBalloonClass; | |
575 | + | |
576 | + if (self) { | |
577 | + window.clearTimeout(self.timeoutTooltip); | |
578 | + window.clearTimeout(self.timeoutAutoClose); | |
579 | + } | |
580 | + | |
581 | + if (balloonIsSticky && self) self.currentElement = null; | |
582 | + | |
583 | + balloonIsVisible = false; | |
584 | + //botao de fechar ativo | |
585 | + balloonIsSticky = true; | |
586 | + | |
587 | + var closeButton = document.getElementById('closeButton'); | |
588 | + if (closeButton) { | |
589 | + YAHOO.util.Dom.setStyle(closeButton,'display','none'); | |
590 | + } | |
591 | + | |
592 | + if (!self) { | |
593 | + var hideBalloon = document.getElementById('balloon'); | |
594 | + if (hideBalloon) Balloon.prototype.setStyle(hideBalloon,'display','none'); | |
595 | + } | |
596 | + else if (self.activeBalloon) { | |
597 | + if (!override && self.fadeOK && !self.isIE()) self.fade(95,0,self.fadeOut); | |
598 | + else self.setStyle(self.activeBalloon,'display','none'); | |
599 | + } | |
600 | + Balloon.prototype.showHide(1); | |
601 | +}; | |
602 | + | |
603 | +// this function is meant to be called externally to clear | |
604 | +// any open balloons | |
605 | +hideAllTooltips = function() { | |
606 | + var self = currentBalloonClass; | |
607 | + if (!self) return; | |
608 | + window.clearTimeout(self.timeoutTooltip); | |
609 | + if (self.activeBalloon) self.setStyle(self.activeBalloon,'display','none'); | |
610 | + balloonIsVisible = false; | |
611 | + balloonIsSticky = false; | |
612 | + currentBalloonClass = null; | |
613 | +}; | |
614 | + | |
615 | + | |
616 | +// Track the active mouseover coordinates | |
617 | +Balloon.prototype.setActiveCoordinates = function(event) { | |
618 | + | |
619 | + var self = currentBalloonClass; | |
620 | + if (!self) return false; | |
621 | + var b = self.activeBalloon; | |
622 | +// | |
623 | +//modificado por edmar | |
624 | +// | |
625 | + try{ | |
626 | + if(typeof(event.id) == "string") | |
627 | + { | |
628 | + var pos = i3GEO.util.pegaPosicaoObjeto(event); | |
629 | + self.activeTop = pos[1] - 10; | |
630 | + self.activeLeft = pos[0] - 10; | |
631 | + self.activeRight = self.activeLeft + 20; | |
632 | + self.activeBottom = self.activeTop + 20; | |
633 | + return true; | |
634 | + } | |
635 | + }catch(e){} | |
636 | + var evt = event || window.event || self.currentEvent; | |
637 | + if (!evt) { | |
638 | + return false; | |
639 | + } | |
640 | + var XY = self.eventXY(evt); | |
641 | + self.activeTop = XY[1] - 10; | |
642 | + self.activeLeft = XY[0] - 10; | |
643 | + self.activeRight = self.activeLeft + 20; | |
644 | + self.activeBottom = self.activeTop + 20; | |
645 | + | |
646 | + return true; | |
647 | +}; | |
648 | + | |
649 | +//// | |
650 | +// event XY and getEventTarget Functions based on examples by Peter-Paul | |
651 | +// Koch http://www.quirksmode.org/js/events_properties.html | |
652 | +Balloon.prototype.eventXY = function(event) { | |
653 | + var XY = new Array(2); | |
654 | + var e = event || window.event; | |
655 | + | |
656 | + if (e.pageX || e.pageY) { | |
657 | + XY[0] = e.pageX; | |
658 | + XY[1] = e.pageY; | |
659 | + } | |
660 | + else if ( e.clientX || e.clientY ) { | |
661 | + XY[0] = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft; | |
662 | + XY[1] = e.clientY + document.body.scrollTop + document.documentElement.scrollTop; | |
663 | + } | |
664 | + //XY[0] = XY[0] + 10; | |
665 | + return XY; | |
666 | +}; | |
667 | + | |
668 | +Balloon.prototype.getEventTarget = function(event) { | |
669 | + var targ; | |
670 | + var e = event || window.event; | |
671 | + if (e.target) targ = e.target; | |
672 | + else if (e.srcElement) targ = e.srcElement; | |
673 | + if (targ.nodeType == 3) targ = targ.parentNode; // Safari | |
674 | + return targ; | |
675 | +}; | |
676 | +//// | |
677 | + | |
678 | + | |
679 | +Balloon.prototype.setStyle = function(el,att,val) { | |
680 | + if (!el) return false; | |
681 | + if (val && att.match(/left|top|bottom|right|width|height|padding|margin/)) val += 'px'; | |
682 | + if (typeof(el) != 'object') el = document.getElementById(el); | |
683 | + | |
684 | + // z-index does not work as expected | |
685 | + if (att == 'z-index') { | |
686 | + if (el.style) { | |
687 | + el.style.zIndex = parseInt(val); | |
688 | + } | |
689 | + } | |
690 | + else { | |
691 | + YAHOO.util.Dom.setStyle(el,att,val); | |
692 | + } | |
693 | +}; | |
694 | + | |
695 | +// Uses YAHOO's region class for element coordinates | |
696 | +Balloon.prototype.getLoc = function(el,request) { | |
697 | + var region = YAHOO.util.Dom.getRegion(el); | |
698 | + | |
699 | + switch(request) { | |
700 | + case ('y1') : return parseInt(region.top); | |
701 | + case ('y2') : return parseInt(region.bottom); | |
702 | + case ('x1') : return parseInt(region.left); | |
703 | + case ('x2') : return parseInt(region.right); | |
704 | + case ('width') : return (parseInt(region.right) - parseInt(region.left)); | |
705 | + case ('height') : return (parseInt(region.bottom) - parseInt(region.top)); | |
706 | + case ('region') : return region; | |
707 | + } | |
708 | +}; | |
709 | + | |
710 | +// We don't know if numbers are overridden with strings | |
711 | +// so play it safe | |
712 | +Balloon.prototype.parseIntAll = function() { | |
713 | + this.padding = parseInt(this.padding); | |
714 | + this.shadow = parseInt(this.shadow); | |
715 | + this.stemHeight = parseInt(this.stemHeight); | |
716 | + this.stemOverlap = parseInt(this.stemOverlap); | |
717 | + this.vOffset = parseInt(this.vOffset); | |
718 | + this.delayTime = parseInt(this.delayTime); | |
719 | + this.width = parseInt(this.width); | |
720 | + this.maxWidth = parseInt(this.maxWidth); | |
721 | + this.minWidth = parseInt(this.minWidth); | |
722 | + this.fadeIn = parseInt(this.fadeIn); | |
723 | + this.fadeOut = parseInt(this.fadeOut); | |
724 | +}; | |
725 | + | |
726 | + | |
727 | +// show/hide select elements in older IE | |
728 | +// plus user-defined elements | |
729 | +Balloon.prototype.showHide = function(visible) { | |
730 | + var self = currentBalloonClass || new Balloon; | |
731 | + | |
732 | + // IE z-index bug fix (courtesy of Lincoln Stein) | |
733 | + if (self.isOldIE()) { | |
734 | + if (!visible) { | |
735 | + var balloonSelects = document.getElementById('contents').getElementsByTagName('select'); | |
736 | + var myHash = new Object(); | |
737 | + for (var i=0; i<balloonSelects.length; i++) { | |
738 | + var id = balloonSelects[i].id || balloonSelects[i].name; | |
739 | + myHash[id] = 1; | |
740 | + } | |
741 | + balloonInvisibleSelects = new Array(); | |
742 | + var allSelects = document.getElementsByTagName('select'); | |
743 | + for (var i=0; i<allSelects.length; i++) { | |
744 | + var id = allSelects[i].id || allSelects[i].name; | |
745 | + if (self.isOverlap(allSelects[i],self.activeBalloon) && !myHash[id]) { | |
746 | + balloonInvisibleSelects.push(allSelects[i]); | |
747 | + self.setStyle(allSelects[i],'visibility','hidden'); | |
748 | + } | |
749 | + } | |
750 | + } | |
751 | + else if (balloonInvisibleSelects) { | |
752 | + for (var i=0; i < balloonInvisibleSelects.length; i++) { | |
753 | + var id = balloonInvisibleSelects[i].id || balloonInvisibleSelects[i].name; | |
754 | + self.setStyle(balloonInvisibleSelects[i],'visibility','visible'); | |
755 | + } | |
756 | + balloonInvisibleSelects = null; | |
757 | + } | |
758 | + } | |
759 | + | |
760 | + // show/hide any user-specified elements that overlap the balloon | |
761 | + if (self.hide) { | |
762 | + var display = visible ? 'inline' : 'none'; | |
763 | + for (var n=0;n<self.hide.length;n++) { | |
764 | + if (self.isOverlap(self.activeBalloon,self.hide[n])) { | |
765 | + self.setStyle(self.hide[n],'display',display); | |
766 | + } | |
767 | + } | |
768 | + } | |
769 | +}; | |
770 | + | |
771 | +// Try to find overlap | |
772 | +Balloon.prototype.isOverlap = function(el1,el2) { | |
773 | + if (!el1 || !el2) return false; | |
774 | + var R1 = this.getLoc(el1,'region'); | |
775 | + var R2 = this.getLoc(el2,'region'); | |
776 | + if (!R1 || !R2) return false; | |
777 | + var intersect = R1.intersect(R2); | |
778 | + if (intersect) { | |
779 | + // extent of overlap; | |
780 | + intersect = new Array((intersect.right - intersect.left),(intersect.bottom - intersect.top)); | |
781 | + } | |
782 | + return intersect; | |
783 | +}; | |
784 | + | |
785 | +// Coordinate-based test for the same element | |
786 | +Balloon.prototype.isSameElement = function(el1,el2) { | |
787 | + if (!el1 || !el2) return false; | |
788 | + var R1 = this.getLoc(el1,'region'); | |
789 | + var R2 = this.getLoc(el2,'region'); | |
790 | + var same = R1.contains(R2) && R2.contains(R1); | |
791 | + return same ? true : false; | |
792 | +}; | |
793 | + | |
794 | + | |
795 | +/////////////////////////////////////////////////////// | |
796 | +// Security -- get the balloon contents while checking | |
797 | +// for disallowed elements. | |
798 | +////////////////////////////////////////////////////// | |
799 | +Balloon.prototype.getAndCheckContents = function(caption) { | |
800 | + var originalCaption = caption; | |
801 | + var notAllowed = 'are not allowed in popup balloons in this web site.Please contact the site administrator for assistance.'; | |
802 | + var notSupported = 'AJAX is not supported for popup balloons in this web site. Please contact the site administrator for assistance.'; | |
803 | + | |
804 | + // no Help Url without AJAX | |
805 | + if (this.helpUrl && !this.allowAJAX) { | |
806 | + //alert('Sorry, you have specified help URL '+this.helpUrl+' but '+notSupported); | |
807 | + //return null; | |
808 | + } | |
809 | + | |
810 | + // look for a url in the balloon contents | |
811 | + if (caption.match(/^url:/)) { | |
812 | + this.activeUrl = caption.replace(/^url:/,''); | |
813 | + caption = ''; | |
814 | + } | |
815 | + // or if the text is a bare hyperlink | |
816 | + else if (caption.match(/^(https?:|\/|ftp:)\S+$/i)) { | |
817 | + this.activeUrl = caption; | |
818 | + caption = ''; | |
819 | + } | |
820 | + | |
821 | + // Make sure AJAX is allowed | |
822 | + if (this.activeUrl && !this.allowAJAX) { | |
823 | + //alert('Sorry, you asked for '+originalCaption+' but '+notSupported); | |
824 | + //return null; | |
825 | + } | |
826 | + | |
827 | + // check if the contents are to be retrieved from an element | |
828 | + if (caption.match(/^load:/)) { | |
829 | + var load = caption.split(':'); | |
830 | + if (!document.getElementById(load[1])) alert ('problem locating element '+load[1]); | |
831 | + caption = document.getElementById(load[1]).innerHTML; | |
832 | + this.loadedFromElement = true; | |
833 | + } | |
834 | + | |
835 | + // check if iframes are allowed | |
836 | + if (caption.match(/\<\s*iframe/i) && !this.allowIframes) { | |
837 | + //alert('Sorry: iframe elements '+notAllowed); | |
838 | + //return null; | |
839 | + } | |
840 | + | |
841 | + // check if event handlers are allowed | |
842 | + if (caption.match(/\bon(load|mouse|click|unload|before)[^=]*=/i) && !this.allowEventHandlers) { | |
843 | + //alert('Sorry: JavaScript event handlers '+notAllowed); | |
844 | + //return null; | |
845 | + } | |
846 | + | |
847 | + // check for script elements | |
848 | + if (caption.match(/\<\s*script/i) && !this.allowScripts) { | |
849 | + //alert('Sorry: <script> elements '+notAllowed); | |
850 | + //return null; | |
851 | + } | |
852 | + | |
853 | + // request the contents | |
854 | + this.currentHelpText = this.getContents(caption); | |
855 | + this.loadedFromElement = false; | |
856 | + | |
857 | + return this.currentHelpText;; | |
858 | +}; | |
859 | + | |
860 | + | |
861 | +/////////////////////////////////////////////////////// | |
862 | +// AJAX widget to fill the balloons | |
863 | +// requires prototype.js | |
864 | +/////////////////////////////////////////////////////// | |
865 | +Balloon.prototype.getContents = function(section) { | |
866 | + | |
867 | + // just pass it back if no AJAX handler is required. | |
868 | + if (!this.helpUrl && !this.activeUrl) return section; | |
869 | + | |
870 | + // or if the contents are already loaded from another element | |
871 | + if (this.loadedFromElement) return section; | |
872 | + | |
873 | + // inline URL takes precedence | |
874 | + var url = this.activeUrl || this.helpUrl; | |
875 | + url += this.activeUrl ? '' : '?section='+section; | |
876 | + | |
877 | + // activeUrl is meant to be single-use only | |
878 | + this.activeUrl = null; | |
879 | + | |
880 | + var ajax; | |
881 | + if (window.XMLHttpRequest) { | |
882 | + ajax = new XMLHttpRequest(); | |
883 | + } else { | |
884 | + ajax = new ActiveXObject("Microsoft.XMLHTTP"); | |
885 | + } | |
886 | + | |
887 | + if (ajax) { | |
888 | + ajax.open("GET", url, false); | |
889 | + ajax.onreadystatechange=function() { | |
890 | + //alert(ajax.readyState); | |
891 | + }; | |
892 | + try { | |
893 | + ajax.send(null); | |
894 | + } | |
895 | + catch (e) { | |
896 | + // alert(e); | |
897 | + } | |
898 | + var txt = this.escapeHTML ? escape(ajax.responseText) : ajax.responseText; | |
899 | + return txt || section; | |
900 | + } | |
901 | + else { | |
902 | + return section; | |
903 | + } | |
904 | +}; | |
905 | + | |
906 | + | |
907 | +// test for internet explorer | |
908 | +Balloon.prototype.isIE = function() { | |
909 | + return document.all && !window.opera; | |
910 | +}; | |
911 | + | |
912 | +// test for internet explorer (but not IE7) | |
913 | +Balloon.prototype.isOldIE = function() { | |
914 | + if (navigator.appVersion.indexOf("MSIE") == -1) return false; | |
915 | + var temp=navigator.appVersion.split("MSIE"); | |
916 | + return parseFloat(temp[1]) < 7; | |
917 | +}; | |
918 | + | |
919 | +// test for Konqueror | |
920 | +Balloon.prototype.isKonqueror = function() { | |
921 | + return navigator.userAgent.indexOf( 'Konqueror' ) != -1; | |
922 | +}; | ... | ... |
pacotes/balloon-tooltips/htdocs_depreciado/js/balloon_compacto.config.js
0 → 100755
... | ... | @@ -0,0 +1 @@ |
1 | +BalloonConfig=function(balloon){balloon.parentID=null;balloon.fontColor='black';balloon.fontFamily='Arial, sans-serif';balloon.fontSize='12pt';balloon.minWidth=150;balloon.maxWidth=600;balloon.delayTime=500;balloon.allowFade=false;balloon.fadeIn=300;balloon.fadeOut=300;balloon.vOffset=0;balloon.padding=10;balloon.displayTime=10000;balloon.shadow=20;balloon.images=i3GEO.configura.locaplic+'/pacotes/balloon-tooltips/htdocs/images/';balloon.balloonImage='balloon.png';balloon.ieImage='balloon_ie.png';balloon.stem=true;balloon.stemHeight=32;balloon.stemOverlap=3;balloon.upLeftStem='up_left.png';balloon.downLeftStem='down_left.png';balloon.upRightStem='up_right.png';balloon.downRightStem='down_right.png';balloon.closeButton='close.png';balloon.closeButtonWidth=16;balloon.helpUrl=false;balloon.allowAJAX=true;balloon.allowIframes=true;balloon.allowEventHandlers=false;balloon.allowScripts=false;balloon.escapeHTML=false};BoxConfig=function(box){box.isBox=true;box.parentID=null;box.fontColor='black';box.fontFamily='Arial, sans-serif';box.fontSize='12pt';box.bgColor='whitesmoke';box.borderStyle='1px solid black';box.minWidth=150;box.maxWidth=600;box.delayTime=500;box.allowFade=false;box.fadeIn=300;box.fadeOut=300;box.vOffset=5;box.padding=10;box.displayTime=10000;box.shadow=0;box.stem=false;box.images='/images/balloons';box.closeButton='close.png';box.closeButtonWidth=16;box.helpUrl=false;box.allowAJAX=true;box.allowIframes=true;box.allowEventHandlers=false;box.allowScripts=false;box.escapeHTML=false}; | |
0 | 2 | \ No newline at end of file | ... | ... |
pacotes/balloon-tooltips/htdocs_depreciado/js/balloon_compacto.js
0 → 100755
... | ... | @@ -0,0 +1 @@ |
1 | +var currentBalloonClass;var balloonIsVisible;var balloonIsSticky;var balloonInvisibleSelects;var balloonIsSuppressed;var tooltipIsSuppressed;var Balloon=function(){BalloonConfig(this);document.onmousemove=this.setActiveCoordinates;document.onscroll=Balloon.prototype.hideTooltip;window.onbeforeunload=function(){Balloon.prototype.hideTooltip(1);balloonIsSuppressed=true};if(this.isIE()){this.suppress=true}return this};Balloon.prototype.showTooltip=function(evt,caption,sticky,width){if(this.isIE()&&document.readyState.match(/complete/i)){this.suppress=false}if(this.suppress||balloonIsSuppressed){return false}if(tooltipIsSuppressed&&!sticky){return false}if(this.isKonqueror())this.allowFade=false;var mouseOver=true;try{var mouseOver=evt.type.match('mouseover','i')}catch(e){}if(!mouseOver){sticky=true;this.fadeOK=false}else{this.fadeOK=this.allowFade}if(balloonIsVisible&&!balloonIsSticky&&mouseOver)return false;if(balloonIsVisible&&balloonIsSticky&&!sticky)return false;try{var el=this.getEventTarget(evt)}catch(e){var el=evt}if(sticky&&mouseOver&&this.isSameElement(el,this.currentElement))return false;this.firingElement=el;if(sticky)this.hideTooltip(1);var closeBalloon=function(){var override=balloonIsSticky&&!balloonIsVisible;Balloon.prototype.hideTooltip(override);i3GEO.janela.excluiTips()};if(!mouseOver)el.onmouseup=function(){return false};el.onmouseout=closeBalloon;balloonIsSticky=sticky;this.width=width;this.hideTooltip();this.currentHelpText=this.getAndCheckContents(caption);if(!this.currentHelpText){return false}if(!this.container){this.container=document.createElement('div');document.body.appendChild(this.container);this.setStyle(this.container,'position','absolute');this.setStyle(this.container,'top',-8888);this.setStyle(this.container,'display','inline');this.setStyle(this.container,'z-index',2);this.setStyle(this.container,'color',this.fontColor);this.setStyle(this.container,'font-family',this.fontFamily);this.setStyle(this.container,'font-size',this.fontSize)}else{this.setStyle(this.container,'display','inline')}this.container.innerHTML=unescape(this.currentHelpText);if(this.images){this.balloonImage=this.balloonImage?this.images+'/'+this.balloonImage:false;this.ieImage=this.ieImage?this.images+'/'+this.ieImage:false;this.upLeftStem=this.upLeftStem?this.images+'/'+this.upLeftStem:false;this.upRightStem=this.upRightStem?this.images+'/'+this.upRightStem:false;this.downLeftStem=this.downLeftStem?this.images+'/'+this.downLeftStem:false;this.downRightStem=this.downRightStem?this.images+'/'+this.downRightStem:false;this.closeButton=this.closeButton?this.images+'/'+this.closeButton:false;this.images=false}if(this.isOldIE()&&this.ieImage){this.balloonImage=this.ieImage}if(!this.preloadedImages){var images=new Array(this.balloonImage,this.closeButton);if(this.ieImage){images.push(this.ieImage)}if(this.stem){images.push(this.upLeftStem,this.upRightStem,this.downLeftStem,this.downRightStem)}var len=images.length;for(var i=0;i<len;i++){if(images[i]){this.preload(images[i])}}this.preloadedImages=true}currentBalloonClass=this;if(!mouseOver)this.setActiveCoordinates(evt);this.setActiveCoordinates(evt);this.currentEvent=evt;this.doShowTooltip()};Balloon.prototype.preload=function(src){var i=new Image;i.src=src;this.setStyle(i,'position','absolute');this.setStyle(i,'top',-8000);document.body.appendChild(i);document.body.removeChild(i)};Balloon.prototype.doShowTooltip=function(){var self=currentBalloonClass;if(balloonIsVisible)return false;if(!self.parent){if(self.parentID){self.parent=document.getElementById(self.parentID)}else{self.parent=document.body}self.xOffset=self.getLoc(self.parent,'x1');self.yOffset=self.getLoc(self.parent,'y1')}window.clearTimeout(self.timeoutFade);self.setStyle('balloon','display','none');self.parseIntAll();var balloon=self.makeBalloon();var pageWidth=YAHOO.util.Dom.getViewportWidth();var pageCen=Math.round(pageWidth/2);var pageHeight=YAHOO.util.Dom.getViewportHeight();var pageLeft=YAHOO.util.Dom.getDocumentScrollLeft();var pageTop=YAHOO.util.Dom.getDocumentScrollTop();var pageMid=pageTop+Math.round(pageHeight/2);self.pageBottom=pageTop+pageHeight;self.pageTop=pageTop;if(!(self.activeTop&&self.activeRight)){self.setActiveCoordinates()}var vOrient=self.activeTop>pageMid?'up':'down';var hOrient=self.activeRight>pageCen?'left':'right';var helpText=self.container.innerHTML;self.contents.innerHTML=helpText;self.setBalloonStyle(vOrient,hOrient,pageWidth,pageLeft);if(balloonIsSticky){self.addCloseButton()}balloonIsVisible=true;self.showHide();self.fade(0,95,self.fadeIn)};Balloon.prototype.addCloseButton=function(){var self=currentBalloonClass;var margin=Math.round(self.padding/2);var closeWidth=self.closeButtonWidth||16;var balloonTop=self.getLoc('balloon','y1')+margin+self.shadow;var BalloonLeft=self.getLoc('topRight','x2')-self.closeButtonWidth-self.shadow-margin;var closeButton=document.getElementById('closeButton');if(!closeButton){closeButton=new Image;closeButton.setAttribute('id','closeButton');closeButton.setAttribute('src',self.closeButton);closeButton.onclick=function(){Balloon.prototype.hideTooltip(1);if($i("marcaIdentifica")){document.body.removeChild($i("marcaIdentifica"))}};self.setStyle(closeButton,'position','absolute');document.body.appendChild(closeButton)}self.setStyle(closeButton,'top',balloonTop);self.setStyle(closeButton,'left',BalloonLeft);self.setStyle(closeButton,'display','inline');self.setStyle(closeButton,'cursor','pointer');self.setStyle(closeButton,'z-index',999999999)};Balloon.prototype.makeBalloon=function(){var self=currentBalloonClass;var balloon=document.getElementById('balloon');if(balloon)self.parent.removeChild(balloon);balloon=document.createElement('div');balloon.setAttribute('id','balloon');self.parent.appendChild(balloon);self.activeBalloon=balloon;self.parts=new Array(balloon);var parts=new Array('contents','topRight','bottomRight','bottomLeft');for(var i=0;i<parts.length;i++){var child=document.createElement('div');child.setAttribute('id',parts[i]);balloon.appendChild(child);if(parts[i]=='contents')self.contents=child;self.parts.push(child)}self.setStyle('contents','z-index',2);self.setStyle('contents','color',self.fontColor);self.setStyle('contents','font-family',self.fontFamily);self.setStyle('contents','font-size',self.fontSize);if(balloonIsSticky){self.setStyle('contents','margin-right',10)}else if(self.displayTime){self.timeoutAutoClose=window.setTimeout(this.hideTooltip,self.displayTime)}return balloon};Balloon.prototype.setBalloonStyle=function(vOrient,hOrient,pageWidth,pageLeft){var self=currentBalloonClass;var balloon=self.activeBalloon;if(typeof(self.shadow)!='number')self.shadow=0;if(!self.stem)self.stemHeight=0;var fullPadding=self.padding+self.shadow;var insidePadding=self.padding;self.setStyle(balloon,'background','url('+self.balloonImage+') top left no-repeat');self.setStyle(balloon,'position','absolute');self.setStyle(balloon,'padding-top',fullPadding);self.setStyle(balloon,'padding-left',fullPadding);self.setStyle(balloon,'top',-9999);self.setStyle(balloon,'z-index',1000000);self.setStyle('bottomRight','background','url('+self.balloonImage+') bottom right no-repeat');self.setStyle('bottomRight','position','absolute');self.setStyle('bottomRight','right',0-fullPadding);self.setStyle('bottomRight','bottom',0-fullPadding);self.setStyle('bottomRight','height',fullPadding);self.setStyle('bottomRight','width',fullPadding);self.setStyle('bottomRight','z-index',-1);self.setStyle('topRight','background','url('+self.balloonImage+') top right no-repeat');self.setStyle('topRight','position','absolute');self.setStyle('topRight','right',0-fullPadding);self.setStyle('topRight','top',0);self.setStyle('topRight','width',fullPadding);self.setStyle('bottomLeft','background','url('+self.balloonImage+') bottom left no-repeat');self.setStyle('bottomLeft','position','absolute');self.setStyle('bottomLeft','left',0);self.setStyle('bottomLeft','bottom',0-fullPadding);self.setStyle('bottomLeft','height',fullPadding);self.setStyle('bottomLeft','z-index',-1);if(this.stem){var stem=document.createElement('img');self.setStyle(stem,'position','absolute');balloon.appendChild(stem);if(vOrient=='up'&&hOrient=='left'){stem.src=self.upLeftStem;var height=self.stemHeight+insidePadding-self.stemOverlap;self.setStyle(stem,'bottom',0-height);self.setStyle(stem,'right',0)}else if(vOrient=='down'&&hOrient=='left'){stem.src=self.downLeftStem;var height=self.stemHeight-(self.shadow+self.stemOverlap);self.setStyle(stem,'top',0-height);self.setStyle(stem,'right',0)}else if(vOrient=='up'&&hOrient=='right'){stem.src=self.upRightStem;var height=self.stemHeight+insidePadding-self.stemOverlap;self.setStyle(stem,'bottom',0-height);self.setStyle(stem,'left',self.shadow)}else if(vOrient=='down'&&hOrient=='right'){stem.src=self.downRightStem;var height=self.stemHeight-(self.shadow+self.stemOverlap);self.setStyle(stem,'top',0-height);self.setStyle(stem,'left',self.shadow)}}if(hOrient=='left'){var activeRight=pageWidth-self.activeLeft;self.setStyle(balloon,'right',activeRight)}else{self.setStyle(balloon,'left',self.activeRight-self.xOffset)}if(!self.width){var width=self.getLoc('contents','width');if(self.isIE())width+=50;if(width>self.maxWidth)width=self.maxWidth+50;if(width<self.minWidth)width=self.minWidth;self.setStyle(balloon,'width',width)}else{self.setStyle(balloon,'width',self.width)}var balloonPad=self.padding+self.shadow;var balloonLeft=self.getLoc(balloon,'x1');var balloonRight=self.getLoc(balloon,'x2');if(hOrient=='left')balloonLeft+=balloonPad;if(hOrient=='right')balloonRight+=balloonPad;var pageRight=pageLeft+pageWidth;if(hOrient=='right'&&balloonRight>(pageRight-30)){self.setStyle(balloon,'width',(pageRight-balloonLeft)-50)}else if(hOrient=='left'&&balloonLeft<(pageLeft+30)){self.setStyle(balloon,'width',(balloonRight-pageLeft)-50)}var lineWidth=self.getLoc(balloon,'width');var lineHeight=self.getLoc(balloon,'height');self.setStyle('topRight','height',lineHeight);self.setStyle('bottomLeft','width',lineWidth);var vOverlap=self.isOverlap('topRight','bottomRight');var hOverlap=self.isOverlap('bottomLeft','bottomRight');if(vOverlap)self.setStyle('topRight','height',lineHeight-vOverlap[1]);if(hOverlap)self.setStyle('bottomLeft','width',lineWidth-hOverlap[0]);if(vOrient=='up'){var activeTop=self.activeTop-self.vOffset-self.stemHeight-lineHeight;self.setStyle(balloon,'top',activeTop-self.yOffset);self.setStyle(balloon,'display','inline')}else{var activeTop=self.activeTop+self.vOffset+self.stemHeight;self.setStyle(balloon,'top',activeTop-self.yOffset)}self.setOpacity(1)};Balloon.prototype.fade=function(opacStart,opacEnd,millisec){var self=currentBalloonClass||new Balloon;var speed=Math.round(millisec/100);var timer=0;if(opacStart>opacEnd){if(self.fadeOK){for(o=opacStart;o>=opacEnd;o--){self.timeoutFade=setTimeout('Balloon.prototype.setOpacity('+o+')',(timer*speed));timer++}setTimeout("Balloon.prototype.setStyle('balloon','display','none')",millisec)}else{self.setStyle('balloon','display','none')}}else if(opacStart<opacEnd&&self.fadeOK){for(o=opacStart;o<=opacEnd;o++){self.timeoutFade=setTimeout('Balloon.prototype.setOpacity('+o+')',(timer*speed));timer++}}};Balloon.prototype.setOpacity=function(opc){var self=currentBalloonClass;if(!self||!self.fadeOK)return false;var o=parseFloat((opc||0)/100);var el=self.isIE()?'contents':'balloon';var b=document.getElementById(el);if(!b)return false;self.setStyle(b,'opacity',o);self.setStyle(b,'filter','alpha(opacity= '+opc+')');self.setStyle(b,'MozOpacity',o);self.setStyle(b,'KhtmlOpacity',o)};Balloon.prototype.hideTooltip=function(override){if(override&&typeof override=='object')override=false;if(balloonIsSticky&&!override)return false;var self=currentBalloonClass;if(self){window.clearTimeout(self.timeoutTooltip);window.clearTimeout(self.timeoutAutoClose)}if(balloonIsSticky&&self)self.currentElement=null;balloonIsVisible=false;balloonIsSticky=true;var closeButton=document.getElementById('closeButton');if(closeButton){YAHOO.util.Dom.setStyle(closeButton,'display','none')}if(!self){var hideBalloon=document.getElementById('balloon');if(hideBalloon)Balloon.prototype.setStyle(hideBalloon,'display','none')}else if(self.activeBalloon){if(!override&&self.fadeOK&&!self.isIE())self.fade(95,0,self.fadeOut);else self.setStyle(self.activeBalloon,'display','none')}Balloon.prototype.showHide(1)};hideAllTooltips=function(){var self=currentBalloonClass;if(!self)return;window.clearTimeout(self.timeoutTooltip);if(self.activeBalloon)self.setStyle(self.activeBalloon,'display','none');balloonIsVisible=false;balloonIsSticky=false;currentBalloonClass=null};Balloon.prototype.setActiveCoordinates=function(event){var self=currentBalloonClass;if(!self)return false;var b=self.activeBalloon;try{if(typeof(event.id)=="string"){var pos=i3GEO.util.pegaPosicaoObjeto(event);self.activeTop=pos[1]-10;self.activeLeft=pos[0]-10;self.activeRight=self.activeLeft+20;self.activeBottom=self.activeTop+20;return true}}catch(e){}var evt=event||window.event||self.currentEvent;if(!evt){return false}var XY=self.eventXY(evt);self.activeTop=XY[1]-10;self.activeLeft=XY[0]-10;self.activeRight=self.activeLeft+20;self.activeBottom=self.activeTop+20;return true};Balloon.prototype.eventXY=function(event){var XY=new Array(2);var e=event||window.event;if(e.pageX||e.pageY){XY[0]=e.pageX;XY[1]=e.pageY}else if(e.clientX||e.clientY){XY[0]=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft;XY[1]=e.clientY+document.body.scrollTop+document.documentElement.scrollTop}return XY};Balloon.prototype.getEventTarget=function(event){var targ;var e=event||window.event;if(e.target)targ=e.target;else if(e.srcElement)targ=e.srcElement;if(targ.nodeType==3)targ=targ.parentNode;return targ};Balloon.prototype.setStyle=function(el,att,val){if(!el)return false;if(val&&att.match(/left|top|bottom|right|width|height|padding|margin/))val+='px';if(typeof(el)!='object')el=document.getElementById(el);if(att=='z-index'){if(el.style){el.style.zIndex=parseInt(val)}}else{YAHOO.util.Dom.setStyle(el,att,val)}};Balloon.prototype.getLoc=function(el,request){var region=YAHOO.util.Dom.getRegion(el);switch(request){case('y1'):return parseInt(region.top);case('y2'):return parseInt(region.bottom);case('x1'):return parseInt(region.left);case('x2'):return parseInt(region.right);case('width'):return(parseInt(region.right)-parseInt(region.left));case('height'):return(parseInt(region.bottom)-parseInt(region.top));case('region'):return region}};Balloon.prototype.parseIntAll=function(){this.padding=parseInt(this.padding);this.shadow=parseInt(this.shadow);this.stemHeight=parseInt(this.stemHeight);this.stemOverlap=parseInt(this.stemOverlap);this.vOffset=parseInt(this.vOffset);this.delayTime=parseInt(this.delayTime);this.width=parseInt(this.width);this.maxWidth=parseInt(this.maxWidth);this.minWidth=parseInt(this.minWidth);this.fadeIn=parseInt(this.fadeIn);this.fadeOut=parseInt(this.fadeOut)};Balloon.prototype.showHide=function(visible){var self=currentBalloonClass||new Balloon;if(self.isOldIE()){if(!visible){var balloonSelects=document.getElementById('contents').getElementsByTagName('select');var myHash=new Object();for(var i=0;i<balloonSelects.length;i++){var id=balloonSelects[i].id||balloonSelects[i].name;myHash[id]=1}balloonInvisibleSelects=new Array();var allSelects=document.getElementsByTagName('select');for(var i=0;i<allSelects.length;i++){var id=allSelects[i].id||allSelects[i].name;if(self.isOverlap(allSelects[i],self.activeBalloon)&&!myHash[id]){balloonInvisibleSelects.push(allSelects[i]);self.setStyle(allSelects[i],'visibility','hidden')}}}else if(balloonInvisibleSelects){for(var i=0;i<balloonInvisibleSelects.length;i++){var id=balloonInvisibleSelects[i].id||balloonInvisibleSelects[i].name;self.setStyle(balloonInvisibleSelects[i],'visibility','visible')}balloonInvisibleSelects=null}}if(self.hide){var display=visible?'inline':'none';for(var n=0;n<self.hide.length;n++){if(self.isOverlap(self.activeBalloon,self.hide[n])){self.setStyle(self.hide[n],'display',display)}}}};Balloon.prototype.isOverlap=function(el1,el2){if(!el1||!el2)return false;var R1=this.getLoc(el1,'region');var R2=this.getLoc(el2,'region');if(!R1||!R2)return false;var intersect=R1.intersect(R2);if(intersect){intersect=new Array((intersect.right-intersect.left),(intersect.bottom-intersect.top))}return intersect};Balloon.prototype.isSameElement=function(el1,el2){if(!el1||!el2)return false;var R1=this.getLoc(el1,'region');var R2=this.getLoc(el2,'region');var same=R1.contains(R2)&&R2.contains(R1);return same?true:false};Balloon.prototype.getAndCheckContents=function(caption){var originalCaption=caption;var notAllowed='are not allowed in popup balloons in this web site.Please contact the site administrator for assistance.';var notSupported='AJAX is not supported for popup balloons in this web site. Please contact the site administrator for assistance.';if(this.helpUrl&&!this.allowAJAX){}if(caption.match(/^url:/)){this.activeUrl=caption.replace(/^url:/,'');caption=''}else if(caption.match(/^(https?:|\/|ftp:)\S+$/i)){this.activeUrl=caption;caption=''}if(this.activeUrl&&!this.allowAJAX){}if(caption.match(/^load:/)){var load=caption.split(':');if(!document.getElementById(load[1]))alert('problem locating element '+load[1]);caption=document.getElementById(load[1]).innerHTML;this.loadedFromElement=true}if(caption.match(/\<\s*iframe/i)&&!this.allowIframes){}if(caption.match(/\bon(load|mouse|click|unload|before)[^=]*=/i)&&!this.allowEventHandlers){}if(caption.match(/\<\s*script/i)&&!this.allowScripts){}this.currentHelpText=this.getContents(caption);this.loadedFromElement=false;return this.currentHelpText};Balloon.prototype.getContents=function(section){if(!this.helpUrl&&!this.activeUrl)return section;if(this.loadedFromElement)return section;var url=this.activeUrl||this.helpUrl;url+=this.activeUrl?'':'?section='+section;this.activeUrl=null;var ajax;if(window.XMLHttpRequest){ajax=new XMLHttpRequest()}else{ajax=new ActiveXObject("Microsoft.XMLHTTP")}if(ajax){ajax.open("GET",url,false);ajax.onreadystatechange=function(){};try{ajax.send(null)}catch(e){}var txt=this.escapeHTML?escape(ajax.responseText):ajax.responseText;return txt||section}else{return section}};Balloon.prototype.isIE=function(){return document.all&&!window.opera};Balloon.prototype.isOldIE=function(){if(navigator.appVersion.indexOf("MSIE")==-1)return false;var temp=navigator.appVersion.split("MSIE");return parseFloat(temp[1])<7};Balloon.prototype.isKonqueror=function(){return navigator.userAgent.indexOf('Konqueror')!=-1}; | |
0 | 2 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,168 @@ |
1 | +/* | |
2 | + This is a subclass of balloon.js -- uses a simple box rather than a | |
3 | + a balloon/bubble image. It can have a background image and a styled | |
4 | + bgcolor and border but is otherwise meant to be simple and lightweight. | |
5 | +*/ | |
6 | + | |
7 | +////////////////////////////////////////////////////////////////////////// | |
8 | +// This is constructor that is called to initialize the Balloon object // | |
9 | +////////////////////////////////////////////////////////////////////////// | |
10 | +var Box = function () { | |
11 | + | |
12 | + // Get default configuration from balloon.config.js | |
13 | + BoxConfig(this); | |
14 | + | |
15 | + // Track the cursor every time the mouse moves | |
16 | + document.onmousemove = this.setActiveCoordinates; | |
17 | + | |
18 | + // scrolling aborts unsticky balloons | |
19 | + document.onscroll = Balloon.prototype.hideTooltip; | |
20 | + | |
21 | + // make balloons go away if the page is unloading or waiting | |
22 | + // to unload. | |
23 | + window.onbeforeunload = function(){ | |
24 | + Balloon.prototype.hideTooltip(1); | |
25 | + balloonIsSuppressed = true; | |
26 | + }; | |
27 | + | |
28 | + // for IE, the box can't start until the page is finished loading | |
29 | + // set a flag that will get toggled when loading is finished | |
30 | + if (this.isIE()) { | |
31 | + this.suppress = true; | |
32 | + } | |
33 | + | |
34 | + return this; | |
35 | +} | |
36 | + | |
37 | +// Inherit from Balloon class | |
38 | +Box.prototype = new Balloon(); | |
39 | + | |
40 | + | |
41 | +// Make the box element -- this overrides the parent method | |
42 | +// for balloons | |
43 | +Box.prototype.makeBalloon = function() { | |
44 | + var self = currentBalloonClass; | |
45 | + | |
46 | + var box = document.getElementById('balloon'); | |
47 | + if (box) self.parent.removeChild(box); | |
48 | + | |
49 | + // use ID 'balloon' for consistency with parent class | |
50 | + box = document.createElement('div'); | |
51 | + box.setAttribute('id','balloon'); | |
52 | + self.parent.appendChild(box); | |
53 | + self.activeBalloon = box; | |
54 | + | |
55 | + var contents = document.createElement('div'); | |
56 | + contents.setAttribute('id','contents'); | |
57 | + box.appendChild(contents); | |
58 | + self.contents = contents; | |
59 | + | |
60 | + self.setStyle('contents','z-index',2); | |
61 | + self.setStyle('contents','color',self.fontColor); | |
62 | + self.setStyle('contents','font-family',self.fontFamily); | |
63 | + self.setStyle('contents','font-size',self.fontSize); | |
64 | + | |
65 | + if (balloonIsSticky) { | |
66 | + self.setStyle('contents','margin-right',10); | |
67 | + } | |
68 | + else if (self.displayTime) { | |
69 | + self.timeoutAutoClose = window.setTimeout(this.hideTooltip,self.displayTime); | |
70 | + } | |
71 | + return box; | |
72 | +} | |
73 | + | |
74 | +// Set the box style -- overrides the parent method for balloons | |
75 | +Box.prototype.setBalloonStyle = function(vOrient,hOrient,pageWidth,pageLeft) { | |
76 | + var self = currentBalloonClass; | |
77 | + var box = self.activeBalloon; | |
78 | + | |
79 | + var fullPadding = self.padding; | |
80 | + var insidePadding = self.padding; | |
81 | + | |
82 | + self.setStyle(box,'background',self.bgColor); | |
83 | + self.setStyle(box,'border',self.borderStyle); | |
84 | + self.setStyle(box,'position','absolute'); | |
85 | + self.setStyle(box,'padding',fullPadding); | |
86 | + self.setStyle(box,'top',-9999); | |
87 | + self.setStyle(box,'z-index',1000000); | |
88 | + if (self.width) { | |
89 | + self.setStyle(box,'width',self.width); | |
90 | + } | |
91 | + | |
92 | + // flip left or right, as required | |
93 | + if (hOrient == 'left') { | |
94 | + var activeRight = pageWidth - self.activeLeft; | |
95 | + self.setStyle(box,'right',activeRight);// - self.xOffset); | |
96 | + } | |
97 | + else { | |
98 | + self.setStyle(box,'left',self.activeRight - self.xOffset); | |
99 | + } | |
100 | + | |
101 | + // have to harden the width | |
102 | + if (!self.width) { | |
103 | + var width = self.getLoc('contents','width'); | |
104 | + if (self.isIE()) width += 50; | |
105 | + if (width > self.maxWidth) width = self.maxWidth + 50; | |
106 | + if (width < self.minWidth) width = self.minWidth; | |
107 | + self.setStyle(box,'width',width); | |
108 | + } | |
109 | + else { | |
110 | + self.setStyle(box,'width',self.width); | |
111 | + } | |
112 | + | |
113 | + // Make sure the box is not offscreen | |
114 | + var boxPad = self.padding; | |
115 | + var boxLeft = self.getLoc(box,'x1'); | |
116 | + var boxRight = self.getLoc(box,'x2'); | |
117 | + if (hOrient == 'left') boxLeft += boxPad; | |
118 | + if (hOrient == 'right') boxRight += boxPad; | |
119 | + var pageRight = pageLeft + pageWidth; | |
120 | + | |
121 | + if (hOrient == 'right' && boxRight > (pageRight-30)) { | |
122 | + self.setStyle(box,'width',(pageRight - boxLeft) - 50); | |
123 | + } | |
124 | + else if (hOrient == 'left' && boxLeft < (pageLeft+30)) { | |
125 | + self.setStyle(box,'width',(boxRight - pageLeft) - 50); | |
126 | + } | |
127 | + | |
128 | + if (vOrient == 'up') { | |
129 | + var boxHeight = self.getLoc(box,'height') + self.vOffset; | |
130 | + var activeTop = self.activeTop - boxHeight; | |
131 | + self.setStyle(box,'top',activeTop); | |
132 | + self.setStyle(box,'display','inline'); | |
133 | + } | |
134 | + else { | |
135 | + var activeTop = self.activeBottom - self.vOffset; | |
136 | + self.setStyle(box,'top',activeTop); | |
137 | + } | |
138 | + | |
139 | + self.setOpacity(1); | |
140 | +} | |
141 | + | |
142 | + | |
143 | +Box.prototype.addCloseButton = function () { | |
144 | + var self = currentBalloonClass; | |
145 | + var margin = Math.round(self.padding/2); | |
146 | + var closeWidth = self.closeButtonWidth || 16; | |
147 | + var balloonTop = self.getLoc('balloon','y1') + margin; | |
148 | + var balloonRight = self.getLoc('balloon','x2') - margin - self.closeButtonWidth; | |
149 | + var closeButton = document.getElementById('closeButton'); | |
150 | + | |
151 | + | |
152 | + if (!closeButton) { | |
153 | + closeButton = new Image; | |
154 | + closeButton.setAttribute('id','closeButton'); | |
155 | + closeButton.setAttribute('src',self.closeButton); | |
156 | + closeButton.onclick = function() { | |
157 | + Balloon.prototype.hideTooltip(1); | |
158 | + }; | |
159 | + self.setStyle(closeButton,'position','absolute'); | |
160 | + document.body.appendChild(closeButton); | |
161 | + } | |
162 | + | |
163 | + self.setStyle(closeButton,'top',balloonTop); | |
164 | + self.setStyle(closeButton,'left',balloonRight); | |
165 | + self.setStyle(closeButton,'display','inline'); | |
166 | + self.setStyle(closeButton,'cursor','pointer'); | |
167 | + self.setStyle(closeButton,'z-index',999999999); | |
168 | +} | ... | ... |
pacotes/balloon-tooltips/htdocs_depreciado/js/yahoo-dom-event.js
0 → 100755
... | ... | @@ -0,0 +1,197 @@ |
1 | +/* | |
2 | +Copyright (c) 2007, Yahoo! Inc. All rights reserved. | |
3 | +Code licensed under the BSD License: | |
4 | +http://developer.yahoo.net/yui/license.txt | |
5 | +version: 2.3.0 | |
6 | +*/ | |
7 | + | |
8 | +if(typeof YAHOO=="undefined"){var YAHOO={};} | |
9 | +YAHOO.namespace=function(){var a=arguments,o=null,i,j,d;for(i=0;i<a.length;i=i+1){d=a[i].split(".");o=YAHOO;for(j=(d[0]=="YAHOO")?1:0;j<d.length;j=j+1){o[d[j]]=o[d[j]]||{};o=o[d[j]];}} | |
10 | +return o;};YAHOO.log=function(msg,cat,src){var l=YAHOO.widget.Logger;if(l&&l.log){return l.log(msg,cat,src);}else{return false;}};YAHOO.register=function(name,mainClass,data){var mods=YAHOO.env.modules;if(!mods[name]){mods[name]={versions:[],builds:[]};} | |
11 | +var m=mods[name],v=data.version,b=data.build,ls=YAHOO.env.listeners;m.name=name;m.version=v;m.build=b;m.versions.push(v);m.builds.push(b);m.mainClass=mainClass;for(var i=0;i<ls.length;i=i+1){ls[i](m);} | |
12 | +if(mainClass){mainClass.VERSION=v;mainClass.BUILD=b;}else{YAHOO.log("mainClass is undefined for module "+name,"warn");}};YAHOO.env=YAHOO.env||{modules:[],listeners:[]};YAHOO.env.getVersion=function(name){return YAHOO.env.modules[name]||null;};YAHOO.env.ua=function(){var o={ie:0,opera:0,gecko:0,webkit:0};var ua=navigator.userAgent,m;if((/KHTML/).test(ua)){o.webkit=1;} | |
13 | +m=ua.match(/AppleWebKit\/([^\s]*)/);if(m&&m[1]){o.webkit=parseFloat(m[1]);} | |
14 | +if(!o.webkit){m=ua.match(/Opera[\s\/]([^\s]*)/);if(m&&m[1]){o.opera=parseFloat(m[1]);}else{m=ua.match(/MSIE\s([^;]*)/);if(m&&m[1]){o.ie=parseFloat(m[1]);}else{m=ua.match(/Gecko\/([^\s]*)/);if(m){o.gecko=1;m=ua.match(/rv:([^\s\)]*)/);if(m&&m[1]){o.gecko=parseFloat(m[1]);}}}}} | |
15 | +return o;}();(function(){YAHOO.namespace("util","widget","example");if(typeof YAHOO_config!="undefined"){var l=YAHOO_config.listener,ls=YAHOO.env.listeners,unique=true,i;if(l){for(i=0;i<ls.length;i=i+1){if(ls[i]==l){unique=false;break;}} | |
16 | +if(unique){ls.push(l);}}}})();YAHOO.lang={isArray:function(o){if(o){var l=YAHOO.lang;return l.isNumber(o.length)&&l.isFunction(o.splice)&&!l.hasOwnProperty(o.length);} | |
17 | +return false;},isBoolean:function(o){return typeof o==='boolean';},isFunction:function(o){return typeof o==='function';},isNull:function(o){return o===null;},isNumber:function(o){return typeof o==='number'&&isFinite(o);},isObject:function(o){return(o&&(typeof o==='object'||YAHOO.lang.isFunction(o)))||false;},isString:function(o){return typeof o==='string';},isUndefined:function(o){return typeof o==='undefined';},hasOwnProperty:function(o,prop){if(Object.prototype.hasOwnProperty){return o.hasOwnProperty(prop);} | |
18 | +return!YAHOO.lang.isUndefined(o[prop])&&o.constructor.prototype[prop]!==o[prop];},_IEEnumFix:function(r,s){if(YAHOO.env.ua.ie){var add=["toString","valueOf"];for(i=0;i<add.length;i=i+1){var fname=add[i],f=s[fname];if(YAHOO.lang.isFunction(f)&&f!=Object.prototype[fname]){r[fname]=f;}}}},extend:function(subc,superc,overrides){if(!superc||!subc){throw new Error("YAHOO.lang.extend failed, please check that "+"all dependencies are included.");} | |
19 | +var F=function(){};F.prototype=superc.prototype;subc.prototype=new F();subc.prototype.constructor=subc;subc.superclass=superc.prototype;if(superc.prototype.constructor==Object.prototype.constructor){superc.prototype.constructor=superc;} | |
20 | +if(overrides){for(var i in overrides){subc.prototype[i]=overrides[i];} | |
21 | +YAHOO.lang._IEEnumFix(subc.prototype,overrides);}},augmentObject:function(r,s){if(!s||!r){throw new Error("Absorb failed, verify dependencies.");} | |
22 | +var a=arguments,i,p,override=a[2];if(override&&override!==true){for(i=2;i<a.length;i=i+1){r[a[i]]=s[a[i]];}}else{for(p in s){if(override||!r[p]){r[p]=s[p];}} | |
23 | +YAHOO.lang._IEEnumFix(r,s);}},augmentProto:function(r,s){if(!s||!r){throw new Error("Augment failed, verify dependencies.");} | |
24 | +var a=[r.prototype,s.prototype];for(var i=2;i<arguments.length;i=i+1){a.push(arguments[i]);} | |
25 | +YAHOO.lang.augmentObject.apply(this,a);},dump:function(o,d){var l=YAHOO.lang,i,len,s=[],OBJ="{...}",FUN="f(){...}",COMMA=', ',ARROW=' => ';if(!l.isObject(o)||o instanceof Date||("nodeType"in o&&"tagName"in o)){return o;}else if(l.isFunction(o)){return FUN;} | |
26 | +d=(l.isNumber(d))?d:3;if(l.isArray(o)){s.push("[");for(i=0,len=o.length;i<len;i=i+1){if(l.isObject(o[i])){s.push((d>0)?l.dump(o[i],d-1):OBJ);}else{s.push(o[i]);} | |
27 | +s.push(COMMA);} | |
28 | +if(s.length>1){s.pop();} | |
29 | +s.push("]");}else{s.push("{");for(i in o){if(l.hasOwnProperty(o,i)){s.push(i+ARROW);if(l.isObject(o[i])){s.push((d>0)?l.dump(o[i],d-1):OBJ);}else{s.push(o[i]);} | |
30 | +s.push(COMMA);}} | |
31 | +if(s.length>1){s.pop();} | |
32 | +s.push("}");} | |
33 | +return s.join("");},substitute:function(s,o,f){var i,j,k,key,v,meta,l=YAHOO.lang,saved=[],token,DUMP='dump',SPACE=' ',LBRACE='{',RBRACE='}';for(;;){i=s.lastIndexOf(LBRACE);if(i<0){break;} | |
34 | +j=s.indexOf(RBRACE,i);if(i+1>=j){break;} | |
35 | +token=s.substring(i+1,j);key=token;meta=null;k=key.indexOf(SPACE);if(k>-1){meta=key.substring(k+1);key=key.substring(0,k);} | |
36 | +v=o[key];if(f){v=f(key,v,meta);} | |
37 | +if(l.isObject(v)){if(l.isArray(v)){v=l.dump(v,parseInt(meta,10));}else{meta=meta||"";var dump=meta.indexOf(DUMP);if(dump>-1){meta=meta.substring(4);} | |
38 | +if(v.toString===Object.prototype.toString||dump>-1){v=l.dump(v,parseInt(meta,10));}else{v=v.toString();}}}else if(!l.isString(v)&&!l.isNumber(v)){v="~-"+saved.length+"-~";saved[saved.length]=token;} | |
39 | +s=s.substring(0,i)+v+s.substring(j+1);} | |
40 | +for(i=saved.length-1;i>=0;i=i-1){s=s.replace(new RegExp("~-"+i+"-~"),"{"+saved[i]+"}","g");} | |
41 | +return s;},trim:function(s){try{return s.replace(/^\s+|\s+$/g,"");}catch(e){return s;}},merge:function(){var o={},a=arguments,i;for(i=0;i<a.length;i=i+1){YAHOO.lang.augmentObject(o,a[i],true);} | |
42 | +return o;},isValue:function(o){var l=YAHOO.lang;return(l.isObject(o)||l.isString(o)||l.isNumber(o)||l.isBoolean(o));}};YAHOO.util.Lang=YAHOO.lang;YAHOO.lang.augment=YAHOO.lang.augmentProto;YAHOO.augment=YAHOO.lang.augmentProto;YAHOO.extend=YAHOO.lang.extend;YAHOO.register("yahoo",YAHOO,{version:"2.3.0",build:"442"}); | |
43 | +(function(){var Y=YAHOO.util,getStyle,setStyle,id_counter=0,propertyCache={},reClassNameCache={};var isOpera=YAHOO.env.ua.opera,isSafari=YAHOO.env.ua.webkit,isGecko=YAHOO.env.ua.gecko,isIE=YAHOO.env.ua.ie;var patterns={HYPHEN:/(-[a-z])/i,ROOT_TAG:/^body|html$/i};var toCamel=function(property){if(!patterns.HYPHEN.test(property)){return property;} | |
44 | +if(propertyCache[property]){return propertyCache[property];} | |
45 | +var converted=property;while(patterns.HYPHEN.exec(converted)){converted=converted.replace(RegExp.$1,RegExp.$1.substr(1).toUpperCase());} | |
46 | +propertyCache[property]=converted;return converted;};var getClassRegEx=function(className){var re=reClassNameCache[className];if(!re){re=new RegExp('(?:^|\\s+)'+className+'(?:\\s+|$)');reClassNameCache[className]=re;} | |
47 | +return re;};if(document.defaultView&&document.defaultView.getComputedStyle){getStyle=function(el,property){var value=null;if(property=='float'){property='cssFloat';} | |
48 | +var computed=document.defaultView.getComputedStyle(el,'');if(computed){value=computed[toCamel(property)];} | |
49 | +return el.style[property]||value;};}else if(document.documentElement.currentStyle&&isIE){getStyle=function(el,property){switch(toCamel(property)){case'opacity':var val=100;try{val=el.filters['DXImageTransform.Microsoft.Alpha'].opacity;}catch(e){try{val=el.filters('alpha').opacity;}catch(e){}} | |
50 | +return val/100;case'float':property='styleFloat';default:var value=el.currentStyle?el.currentStyle[property]:null;return(el.style[property]||value);}};}else{getStyle=function(el,property){return el.style[property];};} | |
51 | +if(isIE){setStyle=function(el,property,val){switch(property){case'opacity':if(YAHOO.lang.isString(el.style.filter)){el.style.filter='alpha(opacity='+val*100+')';if(!el.currentStyle||!el.currentStyle.hasLayout){el.style.zoom=1;}} | |
52 | +break;case'float':property='styleFloat';default:el.style[property]=val;}};}else{setStyle=function(el,property,val){if(property=='float'){property='cssFloat';} | |
53 | +el.style[property]=val;};} | |
54 | +var testElement=function(node,method){return node&&node.nodeType==1&&(!method||method(node));};YAHOO.util.Dom={get:function(el){if(!el||el.tagName||el.item){return el;} | |
55 | +if(YAHOO.lang.isString(el)){return document.getElementById(el);} | |
56 | +if(el.splice){var c=[];for(var i=0,len=el.length;i<len;++i){c[c.length]=Y.Dom.get(el[i]);} | |
57 | +return c;} | |
58 | +return el;},getStyle:function(el,property){property=toCamel(property);var f=function(element){return getStyle(element,property);};return Y.Dom.batch(el,f,Y.Dom,true);},setStyle:function(el,property,val){property=toCamel(property);var f=function(element){setStyle(element,property,val);};Y.Dom.batch(el,f,Y.Dom,true);},getXY:function(el){var f=function(el){if((el.parentNode===null||el.offsetParent===null||this.getStyle(el,'display')=='none')&&el!=document.body){return false;} | |
59 | +var parentNode=null;var pos=[];var box;var doc=el.ownerDocument;if(el.getBoundingClientRect){box=el.getBoundingClientRect();return[box.left+Y.Dom.getDocumentScrollLeft(el.ownerDocument),box.top+Y.Dom.getDocumentScrollTop(el.ownerDocument)];} | |
60 | +else{pos=[el.offsetLeft,el.offsetTop];parentNode=el.offsetParent;var hasAbs=this.getStyle(el,'position')=='absolute';if(parentNode!=el){while(parentNode){pos[0]+=parentNode.offsetLeft;pos[1]+=parentNode.offsetTop;if(isSafari&&!hasAbs&&this.getStyle(parentNode,'position')=='absolute'){hasAbs=true;} | |
61 | +parentNode=parentNode.offsetParent;}} | |
62 | +if(isSafari&&hasAbs){pos[0]-=el.ownerDocument.body.offsetLeft;pos[1]-=el.ownerDocument.body.offsetTop;}} | |
63 | +parentNode=el.parentNode;while(parentNode.tagName&&!patterns.ROOT_TAG.test(parentNode.tagName)) | |
64 | +{if(Y.Dom.getStyle(parentNode,'display').search(/^inline|table-row.*$/i)){pos[0]-=parentNode.scrollLeft;pos[1]-=parentNode.scrollTop;} | |
65 | +parentNode=parentNode.parentNode;} | |
66 | +return pos;};return Y.Dom.batch(el,f,Y.Dom,true);},getX:function(el){var f=function(el){return Y.Dom.getXY(el)[0];};return Y.Dom.batch(el,f,Y.Dom,true);},getY:function(el){var f=function(el){return Y.Dom.getXY(el)[1];};return Y.Dom.batch(el,f,Y.Dom,true);},setXY:function(el,pos,noRetry){var f=function(el){var style_pos=this.getStyle(el,'position');if(style_pos=='static'){this.setStyle(el,'position','relative');style_pos='relative';} | |
67 | +var pageXY=this.getXY(el);if(pageXY===false){return false;} | |
68 | +var delta=[parseInt(this.getStyle(el,'left'),10),parseInt(this.getStyle(el,'top'),10)];if(isNaN(delta[0])){delta[0]=(style_pos=='relative')?0:el.offsetLeft;} | |
69 | +if(isNaN(delta[1])){delta[1]=(style_pos=='relative')?0:el.offsetTop;} | |
70 | +if(pos[0]!==null){el.style.left=pos[0]-pageXY[0]+delta[0]+'px';} | |
71 | +if(pos[1]!==null){el.style.top=pos[1]-pageXY[1]+delta[1]+'px';} | |
72 | +if(!noRetry){var newXY=this.getXY(el);if((pos[0]!==null&&newXY[0]!=pos[0])||(pos[1]!==null&&newXY[1]!=pos[1])){this.setXY(el,pos,true);}}};Y.Dom.batch(el,f,Y.Dom,true);},setX:function(el,x){Y.Dom.setXY(el,[x,null]);},setY:function(el,y){Y.Dom.setXY(el,[null,y]);},getRegion:function(el){var f=function(el){if((el.parentNode===null||el.offsetParent===null||this.getStyle(el,'display')=='none')&&el!=document.body){return false;} | |
73 | +var region=Y.Region.getRegion(el);return region;};return Y.Dom.batch(el,f,Y.Dom,true);},getClientWidth:function(){return Y.Dom.getViewportWidth();},getClientHeight:function(){return Y.Dom.getViewportHeight();},getElementsByClassName:function(className,tag,root,apply){tag=tag||'*';root=(root)?Y.Dom.get(root):null||document;if(!root){return[];} | |
74 | +var nodes=[],elements=root.getElementsByTagName(tag),re=getClassRegEx(className);for(var i=0,len=elements.length;i<len;++i){if(re.test(elements[i].className)){nodes[nodes.length]=elements[i];if(apply){apply.call(elements[i],elements[i]);}}} | |
75 | +return nodes;},hasClass:function(el,className){var re=getClassRegEx(className);var f=function(el){return re.test(el.className);};return Y.Dom.batch(el,f,Y.Dom,true);},addClass:function(el,className){var f=function(el){if(this.hasClass(el,className)){return false;} | |
76 | +el.className=YAHOO.lang.trim([el.className,className].join(' '));return true;};return Y.Dom.batch(el,f,Y.Dom,true);},removeClass:function(el,className){var re=getClassRegEx(className);var f=function(el){if(!this.hasClass(el,className)){return false;} | |
77 | +var c=el.className;el.className=c.replace(re,' ');if(this.hasClass(el,className)){this.removeClass(el,className);} | |
78 | +el.className=YAHOO.lang.trim(el.className);return true;};return Y.Dom.batch(el,f,Y.Dom,true);},replaceClass:function(el,oldClassName,newClassName){if(!newClassName||oldClassName===newClassName){return false;} | |
79 | +var re=getClassRegEx(oldClassName);var f=function(el){if(!this.hasClass(el,oldClassName)){this.addClass(el,newClassName);return true;} | |
80 | +el.className=el.className.replace(re,' '+newClassName+' ');if(this.hasClass(el,oldClassName)){this.replaceClass(el,oldClassName,newClassName);} | |
81 | +el.className=YAHOO.lang.trim(el.className);return true;};return Y.Dom.batch(el,f,Y.Dom,true);},generateId:function(el,prefix){prefix=prefix||'yui-gen';var f=function(el){if(el&&el.id){return el.id;} | |
82 | +var id=prefix+id_counter++;if(el){el.id=id;} | |
83 | +return id;};return Y.Dom.batch(el,f,Y.Dom,true)||f.apply(Y.Dom,arguments);},isAncestor:function(haystack,needle){haystack=Y.Dom.get(haystack);if(!haystack||!needle){return false;} | |
84 | +var f=function(node){if(haystack.contains&&node.nodeType&&!isSafari){return haystack.contains(node);} | |
85 | +else if(haystack.compareDocumentPosition&&node.nodeType){return!!(haystack.compareDocumentPosition(node)&16);}else if(node.nodeType){return!!this.getAncestorBy(node,function(el){return el==haystack;});} | |
86 | +return false;};return Y.Dom.batch(needle,f,Y.Dom,true);},inDocument:function(el){var f=function(el){if(isSafari){while(el=el.parentNode){if(el==document.documentElement){return true;}} | |
87 | +return false;} | |
88 | +return this.isAncestor(document.documentElement,el);};return Y.Dom.batch(el,f,Y.Dom,true);},getElementsBy:function(method,tag,root,apply){tag=tag||'*';root=(root)?Y.Dom.get(root):null||document;if(!root){return[];} | |
89 | +var nodes=[],elements=root.getElementsByTagName(tag);for(var i=0,len=elements.length;i<len;++i){if(method(elements[i])){nodes[nodes.length]=elements[i];if(apply){apply(elements[i]);}}} | |
90 | +return nodes;},batch:function(el,method,o,override){el=(el&&el.tagName)?el:Y.Dom.get(el);if(!el||!method){return false;} | |
91 | +var scope=(override)?o:window;if(el.tagName||(!el.item&&!el.slice)){return method.call(scope,el,o);} | |
92 | +var collection=[];for(var i=0,len=el.length;i<len;++i){collection[collection.length]=method.call(scope,el[i],o);} | |
93 | +return collection;},getDocumentHeight:function(){var scrollHeight=(document.compatMode!='CSS1Compat')?document.body.scrollHeight:document.documentElement.scrollHeight;var h=Math.max(scrollHeight,Y.Dom.getViewportHeight());return h;},getDocumentWidth:function(){var scrollWidth=(document.compatMode!='CSS1Compat')?document.body.scrollWidth:document.documentElement.scrollWidth;var w=Math.max(scrollWidth,Y.Dom.getViewportWidth());return w;},getViewportHeight:function(){var height=self.innerHeight;var mode=document.compatMode;if((mode||isIE)&&!isOpera){height=(mode=='CSS1Compat')?document.documentElement.clientHeight:document.body.clientHeight;} | |
94 | +return height;},getViewportWidth:function(){var width=self.innerWidth;var mode=document.compatMode;if(mode||isIE){width=(mode=='CSS1Compat')?document.documentElement.clientWidth:document.body.clientWidth;} | |
95 | +return width;},getAncestorBy:function(node,method){while(node=node.parentNode){if(testElement(node,method)){return node;}} | |
96 | +return null;},getAncestorByClassName:function(node,className){node=Y.Dom.get(node);if(!node){return null;} | |
97 | +var method=function(el){return Y.Dom.hasClass(el,className);};return Y.Dom.getAncestorBy(node,method);},getAncestorByTagName:function(node,tagName){node=Y.Dom.get(node);if(!node){return null;} | |
98 | +var method=function(el){return el.tagName&&el.tagName.toUpperCase()==tagName.toUpperCase();};return Y.Dom.getAncestorBy(node,method);},getPreviousSiblingBy:function(node,method){while(node){node=node.previousSibling;if(testElement(node,method)){return node;}} | |
99 | +return null;},getPreviousSibling:function(node){node=Y.Dom.get(node);if(!node){return null;} | |
100 | +return Y.Dom.getPreviousSiblingBy(node);},getNextSiblingBy:function(node,method){while(node){node=node.nextSibling;if(testElement(node,method)){return node;}} | |
101 | +return null;},getNextSibling:function(node){node=Y.Dom.get(node);if(!node){return null;} | |
102 | +return Y.Dom.getNextSiblingBy(node);},getFirstChildBy:function(node,method){var child=(testElement(node.firstChild,method))?node.firstChild:null;return child||Y.Dom.getNextSiblingBy(node.firstChild,method);},getFirstChild:function(node,method){node=Y.Dom.get(node);if(!node){return null;} | |
103 | +return Y.Dom.getFirstChildBy(node);},getLastChildBy:function(node,method){if(!node){return null;} | |
104 | +var child=(testElement(node.lastChild,method))?node.lastChild:null;return child||Y.Dom.getPreviousSiblingBy(node.lastChild,method);},getLastChild:function(node){node=Y.Dom.get(node);return Y.Dom.getLastChildBy(node);},getChildrenBy:function(node,method){var child=Y.Dom.getFirstChildBy(node,method);var children=child?[child]:[];Y.Dom.getNextSiblingBy(child,function(node){if(!method||method(node)){children[children.length]=node;} | |
105 | +return false;});return children;},getChildren:function(node){node=Y.Dom.get(node);if(!node){} | |
106 | +return Y.Dom.getChildrenBy(node);},getDocumentScrollLeft:function(doc){doc=doc||document;return Math.max(doc.documentElement.scrollLeft,doc.body.scrollLeft);},getDocumentScrollTop:function(doc){doc=doc||document;return Math.max(doc.documentElement.scrollTop,doc.body.scrollTop);},insertBefore:function(newNode,referenceNode){newNode=Y.Dom.get(newNode);referenceNode=Y.Dom.get(referenceNode);if(!newNode||!referenceNode||!referenceNode.parentNode){return null;} | |
107 | +return referenceNode.parentNode.insertBefore(newNode,referenceNode);},insertAfter:function(newNode,referenceNode){newNode=Y.Dom.get(newNode);referenceNode=Y.Dom.get(referenceNode);if(!newNode||!referenceNode||!referenceNode.parentNode){return null;} | |
108 | +if(referenceNode.nextSibling){return referenceNode.parentNode.insertBefore(newNode,referenceNode.nextSibling);}else{return referenceNode.parentNode.appendChild(newNode);}}};})();YAHOO.util.Region=function(t,r,b,l){this.top=t;this[1]=t;this.right=r;this.bottom=b;this.left=l;this[0]=l;};YAHOO.util.Region.prototype.contains=function(region){return(region.left>=this.left&®ion.right<=this.right&®ion.top>=this.top&®ion.bottom<=this.bottom);};YAHOO.util.Region.prototype.getArea=function(){return((this.bottom-this.top)*(this.right-this.left));};YAHOO.util.Region.prototype.intersect=function(region){var t=Math.max(this.top,region.top);var r=Math.min(this.right,region.right);var b=Math.min(this.bottom,region.bottom);var l=Math.max(this.left,region.left);if(b>=t&&r>=l){return new YAHOO.util.Region(t,r,b,l);}else{return null;}};YAHOO.util.Region.prototype.union=function(region){var t=Math.min(this.top,region.top);var r=Math.max(this.right,region.right);var b=Math.max(this.bottom,region.bottom);var l=Math.min(this.left,region.left);return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Region.prototype.toString=function(){return("Region {"+"top: "+this.top+", right: "+this.right+", bottom: "+this.bottom+", left: "+this.left+"}");};YAHOO.util.Region.getRegion=function(el){var p=YAHOO.util.Dom.getXY(el);var t=p[1];var r=p[0]+el.offsetWidth;var b=p[1]+el.offsetHeight;var l=p[0];return new YAHOO.util.Region(t,r,b,l);};YAHOO.util.Point=function(x,y){if(YAHOO.lang.isArray(x)){y=x[1];x=x[0];} | |
109 | +this.x=this.right=this.left=this[0]=x;this.y=this.top=this.bottom=this[1]=y;};YAHOO.util.Point.prototype=new YAHOO.util.Region();YAHOO.register("dom",YAHOO.util.Dom,{version:"2.3.0",build:"442"}); | |
110 | +YAHOO.util.CustomEvent=function(type,oScope,silent,signature){this.type=type;this.scope=oScope||window;this.silent=silent;this.signature=signature||YAHOO.util.CustomEvent.LIST;this.subscribers=[];if(!this.silent){} | |
111 | +var onsubscribeType="_YUICEOnSubscribe";if(type!==onsubscribeType){this.subscribeEvent=new YAHOO.util.CustomEvent(onsubscribeType,this,true);}};YAHOO.util.CustomEvent.LIST=0;YAHOO.util.CustomEvent.FLAT=1;YAHOO.util.CustomEvent.prototype={subscribe:function(fn,obj,override){if(!fn){throw new Error("Invalid callback for subscriber to '"+this.type+"'");} | |
112 | +if(this.subscribeEvent){this.subscribeEvent.fire(fn,obj,override);} | |
113 | +this.subscribers.push(new YAHOO.util.Subscriber(fn,obj,override));},unsubscribe:function(fn,obj){if(!fn){return this.unsubscribeAll();} | |
114 | +var found=false;for(var i=0,len=this.subscribers.length;i<len;++i){var s=this.subscribers[i];if(s&&s.contains(fn,obj)){this._delete(i);found=true;}} | |
115 | +return found;},fire:function(){var len=this.subscribers.length;if(!len&&this.silent){return true;} | |
116 | +var args=[],ret=true,i,rebuild=false;for(i=0;i<arguments.length;++i){args.push(arguments[i]);} | |
117 | +var argslength=args.length;if(!this.silent){} | |
118 | +for(i=0;i<len;++i){var s=this.subscribers[i];if(!s){rebuild=true;}else{if(!this.silent){} | |
119 | +var scope=s.getScope(this.scope);if(this.signature==YAHOO.util.CustomEvent.FLAT){var param=null;if(args.length>0){param=args[0];} | |
120 | +ret=s.fn.call(scope,param,s.obj);}else{ret=s.fn.call(scope,this.type,args,s.obj);} | |
121 | +if(false===ret){if(!this.silent){} | |
122 | +return false;}}} | |
123 | +if(rebuild){var newlist=[],subs=this.subscribers;for(i=0,len=subs.length;i<len;++i){s=subs[i];newlist.push(subs[i]);} | |
124 | +this.subscribers=newlist;} | |
125 | +return true;},unsubscribeAll:function(){for(var i=0,len=this.subscribers.length;i<len;++i){this._delete(len-1-i);} | |
126 | +this.subscribers=[];return i;},_delete:function(index){var s=this.subscribers[index];if(s){delete s.fn;delete s.obj;} | |
127 | +this.subscribers[index]=null;},toString:function(){return"CustomEvent: "+"'"+this.type+"', "+"scope: "+this.scope;}};YAHOO.util.Subscriber=function(fn,obj,override){this.fn=fn;this.obj=YAHOO.lang.isUndefined(obj)?null:obj;this.override=override;};YAHOO.util.Subscriber.prototype.getScope=function(defaultScope){if(this.override){if(this.override===true){return this.obj;}else{return this.override;}} | |
128 | +return defaultScope;};YAHOO.util.Subscriber.prototype.contains=function(fn,obj){if(obj){return(this.fn==fn&&this.obj==obj);}else{return(this.fn==fn);}};YAHOO.util.Subscriber.prototype.toString=function(){return"Subscriber { obj: "+this.obj+", override: "+(this.override||"no")+" }";};if(!YAHOO.util.Event){YAHOO.util.Event=function(){var loadComplete=false;var DOMReady=false;var listeners=[];var unloadListeners=[];var legacyEvents=[];var legacyHandlers=[];var retryCount=0;var onAvailStack=[];var legacyMap=[];var counter=0;var webkitKeymap={63232:38,63233:40,63234:37,63235:39};return{POLL_RETRYS:4000,POLL_INTERVAL:10,EL:0,TYPE:1,FN:2,WFN:3,OBJ:3,ADJ_SCOPE:4,lastError:null,isSafari:YAHOO.env.ua.webkit,webkit:YAHOO.env.ua.webkit,isIE:YAHOO.env.ua.ie,_interval:null,startInterval:function(){if(!this._interval){var self=this;var callback=function(){self._tryPreloadAttach();};this._interval=setInterval(callback,this.POLL_INTERVAL);}},onAvailable:function(p_id,p_fn,p_obj,p_override){onAvailStack.push({id:p_id,fn:p_fn,obj:p_obj,override:p_override,checkReady:false});retryCount=this.POLL_RETRYS;this.startInterval();},onDOMReady:function(p_fn,p_obj,p_override){if(DOMReady){setTimeout(function(){var s=window;if(p_override){if(p_override===true){s=p_obj;}else{s=p_override;}} | |
129 | +p_fn.call(s,"DOMReady",[],p_obj);},0);}else{this.DOMReadyEvent.subscribe(p_fn,p_obj,p_override);}},onContentReady:function(p_id,p_fn,p_obj,p_override){onAvailStack.push({id:p_id,fn:p_fn,obj:p_obj,override:p_override,checkReady:true});retryCount=this.POLL_RETRYS;this.startInterval();},addListener:function(el,sType,fn,obj,override){if(!fn||!fn.call){return false;} | |
130 | +if(this._isValidCollection(el)){var ok=true;for(var i=0,len=el.length;i<len;++i){ok=this.on(el[i],sType,fn,obj,override)&&ok;} | |
131 | +return ok;}else if(YAHOO.lang.isString(el)){var oEl=this.getEl(el);if(oEl){el=oEl;}else{this.onAvailable(el,function(){YAHOO.util.Event.on(el,sType,fn,obj,override);});return true;}} | |
132 | +if(!el){return false;} | |
133 | +if("unload"==sType&&obj!==this){unloadListeners[unloadListeners.length]=[el,sType,fn,obj,override];return true;} | |
134 | +var scope=el;if(override){if(override===true){scope=obj;}else{scope=override;}} | |
135 | +var wrappedFn=function(e){return fn.call(scope,YAHOO.util.Event.getEvent(e),obj);};var li=[el,sType,fn,wrappedFn,scope];var index=listeners.length;listeners[index]=li;if(this.useLegacyEvent(el,sType)){var legacyIndex=this.getLegacyIndex(el,sType);if(legacyIndex==-1||el!=legacyEvents[legacyIndex][0]){legacyIndex=legacyEvents.length;legacyMap[el.id+sType]=legacyIndex;legacyEvents[legacyIndex]=[el,sType,el["on"+sType]];legacyHandlers[legacyIndex]=[];el["on"+sType]=function(e){YAHOO.util.Event.fireLegacyEvent(YAHOO.util.Event.getEvent(e),legacyIndex);};} | |
136 | +legacyHandlers[legacyIndex].push(li);}else{try{this._simpleAdd(el,sType,wrappedFn,false);}catch(ex){this.lastError=ex;this.removeListener(el,sType,fn);return false;}} | |
137 | +return true;},fireLegacyEvent:function(e,legacyIndex){var ok=true,le,lh,li,scope,ret;lh=legacyHandlers[legacyIndex];for(var i=0,len=lh.length;i<len;++i){li=lh[i];if(li&&li[this.WFN]){scope=li[this.ADJ_SCOPE];ret=li[this.WFN].call(scope,e);ok=(ok&&ret);}} | |
138 | +le=legacyEvents[legacyIndex];if(le&&le[2]){le[2](e);} | |
139 | +return ok;},getLegacyIndex:function(el,sType){var key=this.generateId(el)+sType;if(typeof legacyMap[key]=="undefined"){return-1;}else{return legacyMap[key];}},useLegacyEvent:function(el,sType){if(this.webkit&&("click"==sType||"dblclick"==sType)){var v=parseInt(this.webkit,10);if(!isNaN(v)&&v<418){return true;}} | |
140 | +return false;},removeListener:function(el,sType,fn){var i,len;if(typeof el=="string"){el=this.getEl(el);}else if(this._isValidCollection(el)){var ok=true;for(i=0,len=el.length;i<len;++i){ok=(this.removeListener(el[i],sType,fn)&&ok);} | |
141 | +return ok;} | |
142 | +if(!fn||!fn.call){return this.purgeElement(el,false,sType);} | |
143 | +if("unload"==sType){for(i=0,len=unloadListeners.length;i<len;i++){var li=unloadListeners[i];if(li&&li[0]==el&&li[1]==sType&&li[2]==fn){unloadListeners[i]=null;return true;}} | |
144 | +return false;} | |
145 | +var cacheItem=null;var index=arguments[3];if("undefined"==typeof index){index=this._getCacheIndex(el,sType,fn);} | |
146 | +if(index>=0){cacheItem=listeners[index];} | |
147 | +if(!el||!cacheItem){return false;} | |
148 | +if(this.useLegacyEvent(el,sType)){var legacyIndex=this.getLegacyIndex(el,sType);var llist=legacyHandlers[legacyIndex];if(llist){for(i=0,len=llist.length;i<len;++i){li=llist[i];if(li&&li[this.EL]==el&&li[this.TYPE]==sType&&li[this.FN]==fn){llist[i]=null;break;}}}}else{try{this._simpleRemove(el,sType,cacheItem[this.WFN],false);}catch(ex){this.lastError=ex;return false;}} | |
149 | +delete listeners[index][this.WFN];delete listeners[index][this.FN];listeners[index]=null;return true;},getTarget:function(ev,resolveTextNode){var t=ev.target||ev.srcElement;return this.resolveTextNode(t);},resolveTextNode:function(node){if(node&&3==node.nodeType){return node.parentNode;}else{return node;}},getPageX:function(ev){var x=ev.pageX;if(!x&&0!==x){x=ev.clientX||0;if(this.isIE){x+=this._getScrollLeft();}} | |
150 | +return x;},getPageY:function(ev){var y=ev.pageY;if(!y&&0!==y){y=ev.clientY||0;if(this.isIE){y+=this._getScrollTop();}} | |
151 | +return y;},getXY:function(ev){return[this.getPageX(ev),this.getPageY(ev)];},getRelatedTarget:function(ev){var t=ev.relatedTarget;if(!t){if(ev.type=="mouseout"){t=ev.toElement;}else if(ev.type=="mouseover"){t=ev.fromElement;}} | |
152 | +return this.resolveTextNode(t);},getTime:function(ev){if(!ev.time){var t=new Date().getTime();try{ev.time=t;}catch(ex){this.lastError=ex;return t;}} | |
153 | +return ev.time;},stopEvent:function(ev){this.stopPropagation(ev);this.preventDefault(ev);},stopPropagation:function(ev){if(ev.stopPropagation){ev.stopPropagation();}else{ev.cancelBubble=true;}},preventDefault:function(ev){if(ev.preventDefault){ev.preventDefault();}else{ev.returnValue=false;}},getEvent:function(e){var ev=e||window.event;if(!ev){var c=this.getEvent.caller;while(c){ev=c.arguments[0];if(ev&&Event==ev.constructor){break;} | |
154 | +c=c.caller;}} | |
155 | +return ev;},getCharCode:function(ev){var code=ev.keyCode||ev.charCode||0;if(YAHOO.env.ua.webkit&&(code in webkitKeymap)){code=webkitKeymap[code];} | |
156 | +return code;},_getCacheIndex:function(el,sType,fn){for(var i=0,len=listeners.length;i<len;++i){var li=listeners[i];if(li&&li[this.FN]==fn&&li[this.EL]==el&&li[this.TYPE]==sType){return i;}} | |
157 | +return-1;},generateId:function(el){var id=el.id;if(!id){id="yuievtautoid-"+counter;++counter;el.id=id;} | |
158 | +return id;},_isValidCollection:function(o){try{return(o&&o.length&&typeof o!="string"&&!o.tagName&&!o.alert&&typeof o[0]!="undefined");}catch(e){return false;}},elCache:{},getEl:function(id){return document.getElementById(id);},clearCache:function(){},DOMReadyEvent:new YAHOO.util.CustomEvent("DOMReady",this),_load:function(e){if(!loadComplete){loadComplete=true;var EU=YAHOO.util.Event;EU._ready();EU._tryPreloadAttach();}},_ready:function(e){if(!DOMReady){DOMReady=true;var EU=YAHOO.util.Event;EU.DOMReadyEvent.fire();EU._simpleRemove(document,"DOMContentLoaded",EU._ready);}},_tryPreloadAttach:function(){if(this.locked){return false;} | |
159 | +if(this.isIE){if(!DOMReady){this.startInterval();return false;}} | |
160 | +this.locked=true;var tryAgain=!loadComplete;if(!tryAgain){tryAgain=(retryCount>0);} | |
161 | +var notAvail=[];var executeItem=function(el,item){var scope=el;if(item.override){if(item.override===true){scope=item.obj;}else{scope=item.override;}} | |
162 | +item.fn.call(scope,item.obj);};var i,len,item,el;for(i=0,len=onAvailStack.length;i<len;++i){item=onAvailStack[i];if(item&&!item.checkReady){el=this.getEl(item.id);if(el){executeItem(el,item);onAvailStack[i]=null;}else{notAvail.push(item);}}} | |
163 | +for(i=0,len=onAvailStack.length;i<len;++i){item=onAvailStack[i];if(item&&item.checkReady){el=this.getEl(item.id);if(el){if(loadComplete||el.nextSibling){executeItem(el,item);onAvailStack[i]=null;}}else{notAvail.push(item);}}} | |
164 | +retryCount=(notAvail.length===0)?0:retryCount-1;if(tryAgain){this.startInterval();}else{clearInterval(this._interval);this._interval=null;} | |
165 | +this.locked=false;return true;},purgeElement:function(el,recurse,sType){var elListeners=this.getListeners(el,sType);if(elListeners){for(var i=0,len=elListeners.length;i<len;++i){var l=elListeners[i];this.removeListener(el,l.type,l.fn,l.index);}} | |
166 | +if(recurse&&el&&el.childNodes){for(i=0,len=el.childNodes.length;i<len;++i){this.purgeElement(el.childNodes[i],recurse,sType);}}},getListeners:function(el,sType){var results=[],searchLists;if(!sType){searchLists=[listeners,unloadListeners];}else if(sType=="unload"){searchLists=[unloadListeners];}else{searchLists=[listeners];} | |
167 | +for(var j=0;j<searchLists.length;++j){var searchList=searchLists[j];if(searchList&&searchList.length>0){for(var i=0,len=searchList.length;i<len;++i){var l=searchList[i];if(l&&l[this.EL]===el&&(!sType||sType===l[this.TYPE])){results.push({type:l[this.TYPE],fn:l[this.FN],obj:l[this.OBJ],adjust:l[this.ADJ_SCOPE],index:i});}}}} | |
168 | +return(results.length)?results:null;},_unload:function(e){var EU=YAHOO.util.Event,i,j,l,len,index;for(i=0,len=unloadListeners.length;i<len;++i){l=unloadListeners[i];if(l){var scope=window;if(l[EU.ADJ_SCOPE]){if(l[EU.ADJ_SCOPE]===true){scope=l[EU.OBJ];}else{scope=l[EU.ADJ_SCOPE];}} | |
169 | +l[EU.FN].call(scope,EU.getEvent(e),l[EU.OBJ]);unloadListeners[i]=null;l=null;scope=null;}} | |
170 | +unloadListeners=null;if(listeners&&listeners.length>0){j=listeners.length;while(j){index=j-1;l=listeners[index];if(l){EU.removeListener(l[EU.EL],l[EU.TYPE],l[EU.FN],index);} | |
171 | +j=j-1;} | |
172 | +l=null;EU.clearCache();} | |
173 | +for(i=0,len=legacyEvents.length;i<len;++i){legacyEvents[i][0]=null;legacyEvents[i]=null;} | |
174 | +legacyEvents=null;EU._simpleRemove(window,"unload",EU._unload);},_getScrollLeft:function(){return this._getScroll()[1];},_getScrollTop:function(){return this._getScroll()[0];},_getScroll:function(){var dd=document.documentElement,db=document.body;if(dd&&(dd.scrollTop||dd.scrollLeft)){return[dd.scrollTop,dd.scrollLeft];}else if(db){return[db.scrollTop,db.scrollLeft];}else{return[0,0];}},regCE:function(){},_simpleAdd:function(){if(window.addEventListener){return function(el,sType,fn,capture){el.addEventListener(sType,fn,(capture));};}else if(window.attachEvent){return function(el,sType,fn,capture){el.attachEvent("on"+sType,fn);};}else{return function(){};}}(),_simpleRemove:function(){if(window.removeEventListener){return function(el,sType,fn,capture){el.removeEventListener(sType,fn,(capture));};}else if(window.detachEvent){return function(el,sType,fn){el.detachEvent("on"+sType,fn);};}else{return function(){};}}()};}();(function(){var EU=YAHOO.util.Event;EU.on=EU.addListener;if(EU.isIE){YAHOO.util.Event.onDOMReady(YAHOO.util.Event._tryPreloadAttach,YAHOO.util.Event,true);var el,d=document,b=d.body;if(("undefined"!==typeof YAHOO_config)&&YAHOO_config.injecting){el=document.createElement("script");var p=d.getElementsByTagName("head")[0]||b;p.insertBefore(el,p.firstChild);}else{d.write('<scr'+'ipt id="_yui_eu_dr" defer="true" src="//:"><'+'/script>');el=document.getElementById("_yui_eu_dr");} | |
175 | +if(el){el.onreadystatechange=function(){if("complete"===this.readyState){this.parentNode.removeChild(this);YAHOO.util.Event._ready();}};}else{} | |
176 | +el=null;}else if(EU.webkit){EU._drwatch=setInterval(function(){var rs=document.readyState;if("loaded"==rs||"complete"==rs){clearInterval(EU._drwatch);EU._drwatch=null;EU._ready();}},EU.POLL_INTERVAL);}else{EU._simpleAdd(document,"DOMContentLoaded",EU._ready);} | |
177 | +EU._simpleAdd(window,"load",EU._load);EU._simpleAdd(window,"unload",EU._unload);EU._tryPreloadAttach();})();} | |
178 | +YAHOO.util.EventProvider=function(){};YAHOO.util.EventProvider.prototype={__yui_events:null,__yui_subscribers:null,subscribe:function(p_type,p_fn,p_obj,p_override){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[p_type];if(ce){ce.subscribe(p_fn,p_obj,p_override);}else{this.__yui_subscribers=this.__yui_subscribers||{};var subs=this.__yui_subscribers;if(!subs[p_type]){subs[p_type]=[];} | |
179 | +subs[p_type].push({fn:p_fn,obj:p_obj,override:p_override});}},unsubscribe:function(p_type,p_fn,p_obj){this.__yui_events=this.__yui_events||{};var evts=this.__yui_events;if(p_type){var ce=evts[p_type];if(ce){return ce.unsubscribe(p_fn,p_obj);}}else{for(var i in evts){var ret=true;if(YAHOO.lang.hasOwnProperty(evts,i)){ret=ret&&evts[i].unsubscribe(p_fn,p_obj);}} | |
180 | +return ret;} | |
181 | +return false;},unsubscribeAll:function(p_type){return this.unsubscribe(p_type);},createEvent:function(p_type,p_config){this.__yui_events=this.__yui_events||{};var opts=p_config||{};var events=this.__yui_events;if(events[p_type]){}else{var scope=opts.scope||this;var silent=(opts.silent);var ce=new YAHOO.util.CustomEvent(p_type,scope,silent,YAHOO.util.CustomEvent.FLAT);events[p_type]=ce;if(opts.onSubscribeCallback){ce.subscribeEvent.subscribe(opts.onSubscribeCallback);} | |
182 | +this.__yui_subscribers=this.__yui_subscribers||{};var qs=this.__yui_subscribers[p_type];if(qs){for(var i=0;i<qs.length;++i){ce.subscribe(qs[i].fn,qs[i].obj,qs[i].override);}}} | |
183 | +return events[p_type];},fireEvent:function(p_type,arg1,arg2,etc){this.__yui_events=this.__yui_events||{};var ce=this.__yui_events[p_type];if(!ce){return null;} | |
184 | +var args=[];for(var i=1;i<arguments.length;++i){args.push(arguments[i]);} | |
185 | +return ce.fire.apply(ce,args);},hasEvent:function(type){if(this.__yui_events){if(this.__yui_events[type]){return true;}} | |
186 | +return false;}};YAHOO.util.KeyListener=function(attachTo,keyData,handler,event){if(!attachTo){}else if(!keyData){}else if(!handler){} | |
187 | +if(!event){event=YAHOO.util.KeyListener.KEYDOWN;} | |
188 | +var keyEvent=new YAHOO.util.CustomEvent("keyPressed");this.enabledEvent=new YAHOO.util.CustomEvent("enabled");this.disabledEvent=new YAHOO.util.CustomEvent("disabled");if(typeof attachTo=='string'){attachTo=document.getElementById(attachTo);} | |
189 | +if(typeof handler=='function'){keyEvent.subscribe(handler);}else{keyEvent.subscribe(handler.fn,handler.scope,handler.correctScope);} | |
190 | +function handleKeyPress(e,obj){if(!keyData.shift){keyData.shift=false;} | |
191 | +if(!keyData.alt){keyData.alt=false;} | |
192 | +if(!keyData.ctrl){keyData.ctrl=false;} | |
193 | +if(e.shiftKey==keyData.shift&&e.altKey==keyData.alt&&e.ctrlKey==keyData.ctrl){var dataItem;var keyPressed;if(keyData.keys instanceof Array){for(var i=0;i<keyData.keys.length;i++){dataItem=keyData.keys[i];if(dataItem==e.charCode){keyEvent.fire(e.charCode,e);break;}else if(dataItem==e.keyCode){keyEvent.fire(e.keyCode,e);break;}}}else{dataItem=keyData.keys;if(dataItem==e.charCode){keyEvent.fire(e.charCode,e);}else if(dataItem==e.keyCode){keyEvent.fire(e.keyCode,e);}}}} | |
194 | +this.enable=function(){if(!this.enabled){YAHOO.util.Event.addListener(attachTo,event,handleKeyPress);this.enabledEvent.fire(keyData);} | |
195 | +this.enabled=true;};this.disable=function(){if(this.enabled){YAHOO.util.Event.removeListener(attachTo,event,handleKeyPress);this.disabledEvent.fire(keyData);} | |
196 | +this.enabled=false;};this.toString=function(){return"KeyListener ["+keyData.keys+"] "+attachTo.tagName+ | |
197 | +(attachTo.id?"["+attachTo.id+"]":"");};};YAHOO.util.KeyListener.KEYDOWN="keydown";YAHOO.util.KeyListener.KEYUP="keyup";YAHOO.register("event",YAHOO.util.Event,{version:"2.3.0",build:"442"});YAHOO.register("yahoo-dom-event", YAHOO, {version: "2.3.0", build: "442"}); | ... | ... |