adhearsion 0.7.6 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. data/.version +1 -1
  2. data/CHANGELOG +43 -25
  3. data/Rakefile +0 -5
  4. data/TODO +51 -2
  5. data/ahn +2 -1
  6. data/apps/default/Rakefile +16 -7
  7. data/apps/default/config/adhearsion.yml +22 -1
  8. data/apps/default/config/helpers/manager_proxy.yml +1 -0
  9. data/apps/default/config/helpers/micromenus/images/arrow-off.gif +0 -0
  10. data/apps/default/config/helpers/micromenus/images/arrow-on.gif +0 -0
  11. data/apps/default/config/helpers/micromenus/images/error.gif +0 -0
  12. data/apps/default/config/helpers/micromenus/images/folder-off.gif +0 -0
  13. data/apps/default/config/helpers/micromenus/images/folder-on.gif +0 -0
  14. data/apps/default/config/helpers/micromenus/images/folder.png +0 -0
  15. data/apps/default/config/helpers/micromenus/images/ggbridge.jpg +0 -0
  16. data/apps/default/config/helpers/micromenus/images/green.png +0 -0
  17. data/apps/default/config/helpers/micromenus/images/microbrowser.bg.gif +0 -0
  18. data/apps/default/config/helpers/micromenus/images/red.png +0 -0
  19. data/apps/default/config/helpers/micromenus/images/url-off.gif +0 -0
  20. data/apps/default/config/helpers/micromenus/images/url-on.gif +0 -0
  21. data/apps/default/config/helpers/micromenus/images/yellow.png +0 -0
  22. data/apps/default/config/helpers/micromenus/javascripts/animation.js +1341 -0
  23. data/apps/default/config/helpers/micromenus/javascripts/carousel.js +1238 -0
  24. data/apps/default/config/helpers/micromenus/javascripts/columnav.js +306 -0
  25. data/apps/default/config/helpers/micromenus/javascripts/connection.js +965 -0
  26. data/apps/default/config/helpers/micromenus/javascripts/container.js +4727 -0
  27. data/apps/default/config/helpers/micromenus/javascripts/container_core.js +2915 -0
  28. data/apps/default/config/helpers/micromenus/javascripts/dom.js +892 -0
  29. data/apps/default/config/helpers/micromenus/javascripts/dragdrop.js +2921 -907
  30. data/apps/default/config/helpers/micromenus/javascripts/event.js +1771 -0
  31. data/apps/default/config/helpers/micromenus/javascripts/yahoo.js +433 -0
  32. data/apps/default/config/helpers/micromenus/stylesheets/carousel.css +78 -0
  33. data/apps/default/config/helpers/micromenus/stylesheets/columnav.css +135 -0
  34. data/apps/default/config/helpers/micromenus/stylesheets/microbrowsers.css +42 -0
  35. data/apps/default/config/helpers/multi_messenger.yml +5 -1
  36. data/apps/default/config/migration.rb +10 -0
  37. data/apps/default/extensions.rb +1 -1
  38. data/apps/default/helpers/factorial.alien.c +3 -3
  39. data/apps/default/helpers/lookup.rb +2 -1
  40. data/apps/default/helpers/manager_proxy.rb +67 -15
  41. data/apps/default/helpers/micromenus.rb +173 -31
  42. data/apps/default/helpers/multi_messenger.rb +20 -3
  43. data/lib/adhearsion.rb +218 -88
  44. data/lib/constants.rb +1 -0
  45. data/lib/core_extensions.rb +15 -9
  46. data/lib/phone_number.rb +85 -0
  47. data/lib/rami.rb +3 -2
  48. data/lib/servlet_container.rb +47 -24
  49. data/lib/sexy_migrations.rb +70 -0
  50. data/test/asterisk_module_test.rb +9 -9
  51. data/test/specs/numerical_string_spec.rb +53 -0
  52. metadata +31 -11
  53. data/apps/default/config/helpers/micromenus/javascripts/builder.js +0 -131
  54. data/apps/default/config/helpers/micromenus/javascripts/controls.js +0 -834
  55. data/apps/default/config/helpers/micromenus/javascripts/effects.js +0 -956
  56. data/apps/default/config/helpers/micromenus/javascripts/prototype.js +0 -2319
  57. data/apps/default/config/helpers/micromenus/javascripts/scriptaculous.js +0 -51
  58. data/apps/default/config/helpers/micromenus/javascripts/slider.js +0 -278
  59. data/apps/default/config/helpers/micromenus/javascripts/unittest.js +0 -557
  60. data/apps/default/config/helpers/micromenus/stylesheets/firefox.css +0 -10
  61. data/apps/default/config/helpers/micromenus/stylesheets/firefox.xul.css +0 -44
@@ -0,0 +1,2915 @@
1
+ /*
2
+ Copyright (c) 2006, Yahoo! Inc. All rights reserved.
3
+ Code licensed under the BSD License:
4
+ http://developer.yahoo.net/yui/license.txt
5
+ version: 0.12.2
6
+ */
7
+ /**
8
+ * Config is a utility used within an Object to allow the implementer to maintain a list of local configuration properties and listen for changes to those properties dynamically using CustomEvent. The initial values are also maintained so that the configuration can be reset at any given point to its initial state.
9
+ * @namespace YAHOO.util
10
+ * @class Config
11
+ * @constructor
12
+ * @param {Object} owner The owner Object to which this Config Object belongs
13
+ */
14
+ YAHOO.util.Config = function(owner) {
15
+ if (owner) {
16
+ this.init(owner);
17
+ }
18
+ };
19
+
20
+ YAHOO.util.Config.prototype = {
21
+
22
+ /**
23
+ * Object reference to the owner of this Config Object
24
+ * @property owner
25
+ * @type Object
26
+ */
27
+ owner : null,
28
+
29
+ /**
30
+ * Boolean flag that specifies whether a queue is currently being executed
31
+ * @property queueInProgress
32
+ * @type Boolean
33
+ */
34
+ queueInProgress : false,
35
+
36
+
37
+ /**
38
+ * Validates that the value passed in is a Boolean.
39
+ * @method checkBoolean
40
+ * @param {Object} val The value to validate
41
+ * @return {Boolean} true, if the value is valid
42
+ */
43
+ checkBoolean: function(val) {
44
+ if (typeof val == 'boolean') {
45
+ return true;
46
+ } else {
47
+ return false;
48
+ }
49
+ },
50
+
51
+ /**
52
+ * Validates that the value passed in is a number.
53
+ * @method checkNumber
54
+ * @param {Object} val The value to validate
55
+ * @return {Boolean} true, if the value is valid
56
+ */
57
+ checkNumber: function(val) {
58
+ if (isNaN(val)) {
59
+ return false;
60
+ } else {
61
+ return true;
62
+ }
63
+ }
64
+ };
65
+
66
+
67
+ /**
68
+ * Initializes the configuration Object and all of its local members.
69
+ * @method init
70
+ * @param {Object} owner The owner Object to which this Config Object belongs
71
+ */
72
+ YAHOO.util.Config.prototype.init = function(owner) {
73
+
74
+ this.owner = owner;
75
+
76
+ /**
77
+ * Object reference to the owner of this Config Object
78
+ * @event configChangedEvent
79
+ */
80
+ this.configChangedEvent = new YAHOO.util.CustomEvent("configChanged");
81
+
82
+ this.queueInProgress = false;
83
+
84
+ /* Private Members */
85
+
86
+ /**
87
+ * Maintains the local collection of configuration property objects and their specified values
88
+ * @property config
89
+ * @private
90
+ * @type Object
91
+ */
92
+ var config = {};
93
+
94
+ /**
95
+ * Maintains the local collection of configuration property objects as they were initially applied.
96
+ * This object is used when resetting a property.
97
+ * @property initialConfig
98
+ * @private
99
+ * @type Object
100
+ */
101
+ var initialConfig = {};
102
+
103
+ /**
104
+ * Maintains the local, normalized CustomEvent queue
105
+ * @property eventQueue
106
+ * @private
107
+ * @type Object
108
+ */
109
+ var eventQueue = [];
110
+
111
+ /**
112
+ * Fires a configuration property event using the specified value.
113
+ * @method fireEvent
114
+ * @private
115
+ * @param {String} key The configuration property's name
116
+ * @param {value} Object The value of the correct type for the property
117
+ */
118
+ var fireEvent = function( key, value ) {
119
+ key = key.toLowerCase();
120
+
121
+ var property = config[key];
122
+
123
+ if (typeof property != 'undefined' && property.event) {
124
+ property.event.fire(value);
125
+ }
126
+ };
127
+ /* End Private Members */
128
+
129
+ /**
130
+ * Adds a property to the Config Object's private config hash.
131
+ * @method addProperty
132
+ * @param {String} key The configuration property's name
133
+ * @param {Object} propertyObject The Object containing all of this property's arguments
134
+ */
135
+ this.addProperty = function( key, propertyObject ) {
136
+ key = key.toLowerCase();
137
+
138
+ config[key] = propertyObject;
139
+
140
+ propertyObject.event = new YAHOO.util.CustomEvent(key);
141
+ propertyObject.key = key;
142
+
143
+ if (propertyObject.handler) {
144
+ propertyObject.event.subscribe(propertyObject.handler, this.owner, true);
145
+ }
146
+
147
+ this.setProperty(key, propertyObject.value, true);
148
+
149
+ if (! propertyObject.suppressEvent) {
150
+ this.queueProperty(key, propertyObject.value);
151
+ }
152
+ };
153
+
154
+ /**
155
+ * Returns a key-value configuration map of the values currently set in the Config Object.
156
+ * @method getConfig
157
+ * @return {Object} The current config, represented in a key-value map
158
+ */
159
+ this.getConfig = function() {
160
+ var cfg = {};
161
+
162
+ for (var prop in config) {
163
+ var property = config[prop];
164
+ if (typeof property != 'undefined' && property.event) {
165
+ cfg[prop] = property.value;
166
+ }
167
+ }
168
+
169
+ return cfg;
170
+ };
171
+
172
+ /**
173
+ * Returns the value of specified property.
174
+ * @method getProperty
175
+ * @param {String} key The name of the property
176
+ * @return {Object} The value of the specified property
177
+ */
178
+ this.getProperty = function(key) {
179
+ key = key.toLowerCase();
180
+
181
+ var property = config[key];
182
+ if (typeof property != 'undefined' && property.event) {
183
+ return property.value;
184
+ } else {
185
+ return undefined;
186
+ }
187
+ };
188
+
189
+ /**
190
+ * Resets the specified property's value to its initial value.
191
+ * @method resetProperty
192
+ * @param {String} key The name of the property
193
+ * @return {Boolean} True is the property was reset, false if not
194
+ */
195
+ this.resetProperty = function(key) {
196
+ key = key.toLowerCase();
197
+
198
+ var property = config[key];
199
+ if (typeof property != 'undefined' && property.event) {
200
+ if (initialConfig[key] && initialConfig[key] != 'undefined') {
201
+ this.setProperty(key, initialConfig[key]);
202
+ }
203
+ return true;
204
+ } else {
205
+ return false;
206
+ }
207
+ };
208
+
209
+ /**
210
+ * Sets the value of a property. If the silent property is passed as true, the property's event will not be fired.
211
+ * @method setProperty
212
+ * @param {String} key The name of the property
213
+ * @param {String} value The value to set the property to
214
+ * @param {Boolean} silent Whether the value should be set silently, without firing the property event.
215
+ * @return {Boolean} True, if the set was successful, false if it failed.
216
+ */
217
+ this.setProperty = function(key, value, silent) {
218
+ key = key.toLowerCase();
219
+
220
+ if (this.queueInProgress && ! silent) {
221
+ this.queueProperty(key,value); // Currently running through a queue...
222
+ return true;
223
+ } else {
224
+ var property = config[key];
225
+ if (typeof property != 'undefined' && property.event) {
226
+ if (property.validator && ! property.validator(value)) { // validator
227
+ return false;
228
+ } else {
229
+ property.value = value;
230
+ if (! silent) {
231
+ fireEvent(key, value);
232
+ this.configChangedEvent.fire([key, value]);
233
+ }
234
+ return true;
235
+ }
236
+ } else {
237
+ return false;
238
+ }
239
+ }
240
+ };
241
+
242
+ /**
243
+ * Sets the value of a property and queues its event to execute. If the event is already scheduled to execute, it is
244
+ * moved from its current position to the end of the queue.
245
+ * @method queueProperty
246
+ * @param {String} key The name of the property
247
+ * @param {String} value The value to set the property to
248
+ * @return {Boolean} true, if the set was successful, false if it failed.
249
+ */
250
+ this.queueProperty = function(key, value) {
251
+ key = key.toLowerCase();
252
+
253
+ var property = config[key];
254
+
255
+ if (typeof property != 'undefined' && property.event) {
256
+ if (typeof value != 'undefined' && property.validator && ! property.validator(value)) { // validator
257
+ return false;
258
+ } else {
259
+
260
+ if (typeof value != 'undefined') {
261
+ property.value = value;
262
+ } else {
263
+ value = property.value;
264
+ }
265
+
266
+ var foundDuplicate = false;
267
+
268
+ for (var i=0;i<eventQueue.length;i++) {
269
+ var queueItem = eventQueue[i];
270
+
271
+ if (queueItem) {
272
+ var queueItemKey = queueItem[0];
273
+ var queueItemValue = queueItem[1];
274
+
275
+ if (queueItemKey.toLowerCase() == key) {
276
+ // found a dupe... push to end of queue, null current item, and break
277
+ eventQueue[i] = null;
278
+ eventQueue.push([key, (typeof value != 'undefined' ? value : queueItemValue)]);
279
+ foundDuplicate = true;
280
+ break;
281
+ }
282
+ }
283
+ }
284
+
285
+ if (! foundDuplicate && typeof value != 'undefined') { // this is a refire, or a new property in the queue
286
+ eventQueue.push([key, value]);
287
+ }
288
+ }
289
+
290
+ if (property.supercedes) {
291
+ for (var s=0;s<property.supercedes.length;s++) {
292
+ var supercedesCheck = property.supercedes[s];
293
+
294
+ for (var q=0;q<eventQueue.length;q++) {
295
+ var queueItemCheck = eventQueue[q];
296
+
297
+ if (queueItemCheck) {
298
+ var queueItemCheckKey = queueItemCheck[0];
299
+ var queueItemCheckValue = queueItemCheck[1];
300
+
301
+ if ( queueItemCheckKey.toLowerCase() == supercedesCheck.toLowerCase() ) {
302
+ eventQueue.push([queueItemCheckKey, queueItemCheckValue]);
303
+ eventQueue[q] = null;
304
+ break;
305
+ }
306
+ }
307
+ }
308
+ }
309
+ }
310
+
311
+ return true;
312
+ } else {
313
+ return false;
314
+ }
315
+ };
316
+
317
+ /**
318
+ * Fires the event for a property using the property's current value.
319
+ * @method refireEvent
320
+ * @param {String} key The name of the property
321
+ */
322
+ this.refireEvent = function(key) {
323
+ key = key.toLowerCase();
324
+
325
+ var property = config[key];
326
+ if (typeof property != 'undefined' && property.event && typeof property.value != 'undefined') {
327
+ if (this.queueInProgress) {
328
+ this.queueProperty(key);
329
+ } else {
330
+ fireEvent(key, property.value);
331
+ }
332
+ }
333
+ };
334
+
335
+ /**
336
+ * Applies a key-value Object literal to the configuration, replacing any existing values, and queueing the property events.
337
+ * Although the values will be set, fireQueue() must be called for their associated events to execute.
338
+ * @method applyConfig
339
+ * @param {Object} userConfig The configuration Object literal
340
+ * @param {Boolean} init When set to true, the initialConfig will be set to the userConfig passed in, so that calling a reset will reset the properties to the passed values.
341
+ */
342
+ this.applyConfig = function(userConfig, init) {
343
+ if (init) {
344
+ initialConfig = userConfig;
345
+ }
346
+ for (var prop in userConfig) {
347
+ this.queueProperty(prop, userConfig[prop]);
348
+ }
349
+ };
350
+
351
+ /**
352
+ * Refires the events for all configuration properties using their current values.
353
+ * @method refresh
354
+ */
355
+ this.refresh = function() {
356
+ for (var prop in config) {
357
+ this.refireEvent(prop);
358
+ }
359
+ };
360
+
361
+ /**
362
+ * Fires the normalized list of queued property change events
363
+ * @method fireQueue
364
+ */
365
+ this.fireQueue = function() {
366
+ this.queueInProgress = true;
367
+ for (var i=0;i<eventQueue.length;i++) {
368
+ var queueItem = eventQueue[i];
369
+ if (queueItem) {
370
+ var key = queueItem[0];
371
+ var value = queueItem[1];
372
+
373
+ var property = config[key];
374
+ property.value = value;
375
+
376
+ fireEvent(key,value);
377
+ }
378
+ }
379
+
380
+ this.queueInProgress = false;
381
+ eventQueue = [];
382
+ };
383
+
384
+ /**
385
+ * Subscribes an external handler to the change event for any given property.
386
+ * @method subscribeToConfigEvent
387
+ * @param {String} key The property name
388
+ * @param {Function} handler The handler function to use subscribe to the property's event
389
+ * @param {Object} obj The Object to use for scoping the event handler (see CustomEvent documentation)
390
+ * @param {Boolean} override Optional. If true, will override "this" within the handler to map to the scope Object passed into the method.
391
+ * @return {Boolean} True, if the subscription was successful, otherwise false.
392
+ */
393
+ this.subscribeToConfigEvent = function(key, handler, obj, override) {
394
+ key = key.toLowerCase();
395
+
396
+ var property = config[key];
397
+ if (typeof property != 'undefined' && property.event) {
398
+ if (! YAHOO.util.Config.alreadySubscribed(property.event, handler, obj)) {
399
+ property.event.subscribe(handler, obj, override);
400
+ }
401
+ return true;
402
+ } else {
403
+ return false;
404
+ }
405
+ };
406
+
407
+ /**
408
+ * Unsubscribes an external handler from the change event for any given property.
409
+ * @method unsubscribeFromConfigEvent
410
+ * @param {String} key The property name
411
+ * @param {Function} handler The handler function to use subscribe to the property's event
412
+ * @param {Object} obj The Object to use for scoping the event handler (see CustomEvent documentation)
413
+ * @return {Boolean} True, if the unsubscription was successful, otherwise false.
414
+ */
415
+ this.unsubscribeFromConfigEvent = function(key, handler, obj) {
416
+ key = key.toLowerCase();
417
+
418
+ var property = config[key];
419
+ if (typeof property != 'undefined' && property.event) {
420
+ return property.event.unsubscribe(handler, obj);
421
+ } else {
422
+ return false;
423
+ }
424
+ };
425
+
426
+ /**
427
+ * Returns a string representation of the Config object
428
+ * @method toString
429
+ * @return {String} The Config object in string format.
430
+ */
431
+ this.toString = function() {
432
+ var output = "Config";
433
+ if (this.owner) {
434
+ output += " [" + this.owner.toString() + "]";
435
+ }
436
+ return output;
437
+ };
438
+
439
+ /**
440
+ * Returns a string representation of the Config object's current CustomEvent queue
441
+ * @method outputEventQueue
442
+ * @return {String} The string list of CustomEvents currently queued for execution
443
+ */
444
+ this.outputEventQueue = function() {
445
+ var output = "";
446
+ for (var q=0;q<eventQueue.length;q++) {
447
+ var queueItem = eventQueue[q];
448
+ if (queueItem) {
449
+ output += queueItem[0] + "=" + queueItem[1] + ", ";
450
+ }
451
+ }
452
+ return output;
453
+ };
454
+ };
455
+
456
+ /**
457
+ * Checks to determine if a particular function/Object pair are already subscribed to the specified CustomEvent
458
+ * @method YAHOO.util.Config.alreadySubscribed
459
+ * @static
460
+ * @param {YAHOO.util.CustomEvent} evt The CustomEvent for which to check the subscriptions
461
+ * @param {Function} fn The function to look for in the subscribers list
462
+ * @param {Object} obj The execution scope Object for the subscription
463
+ * @return {Boolean} true, if the function/Object pair is already subscribed to the CustomEvent passed in
464
+ */
465
+ YAHOO.util.Config.alreadySubscribed = function(evt, fn, obj) {
466
+ for (var e=0;e<evt.subscribers.length;e++) {
467
+ var subsc = evt.subscribers[e];
468
+ if (subsc && subsc.obj == obj && subsc.fn == fn) {
469
+ return true;
470
+ }
471
+ }
472
+ return false;
473
+ };
474
+
475
+ /**
476
+ * The Container family of components is designed to enable developers to create different kinds of content-containing modules on the web. Module and Overlay are the most basic containers, and they can be used directly or extended to build custom containers. Also part of the Container family are four UI controls that extend Module and Overlay: Tooltip, Panel, Dialog, and SimpleDialog.
477
+ * @module container
478
+ * @title Container
479
+ * @requires yahoo,dom,event,dragdrop,animation
480
+ */
481
+
482
+ /**
483
+ * Module is a JavaScript representation of the Standard Module Format. Standard Module Format is a simple standard for markup containers where child nodes representing the header, body, and footer of the content are denoted using the CSS classes "hd", "bd", and "ft" respectively. Module is the base class for all other classes in the YUI Container package.
484
+ * @namespace YAHOO.widget
485
+ * @class Module
486
+ * @constructor
487
+ * @param {String} el The element ID representing the Module <em>OR</em>
488
+ * @param {HTMLElement} el The element representing the Module
489
+ * @param {Object} userConfig The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.
490
+ */
491
+ YAHOO.widget.Module = function(el, userConfig) {
492
+ if (el) {
493
+ this.init(el, userConfig);
494
+ }
495
+ };
496
+
497
+ /**
498
+ * Constant representing the prefix path to use for non-secure images
499
+ * @property YAHOO.widget.Module.IMG_ROOT
500
+ * @static
501
+ * @final
502
+ * @type String
503
+ */
504
+ YAHOO.widget.Module.IMG_ROOT = "http://us.i1.yimg.com/us.yimg.com/i/";
505
+
506
+ /**
507
+ * Constant representing the prefix path to use for securely served images
508
+ * @property YAHOO.widget.Module.IMG_ROOT_SSL
509
+ * @static
510
+ * @final
511
+ * @type String
512
+ */
513
+ YAHOO.widget.Module.IMG_ROOT_SSL = "https://a248.e.akamai.net/sec.yimg.com/i/";
514
+
515
+ /**
516
+ * Constant for the default CSS class name that represents a Module
517
+ * @property YAHOO.widget.Module.CSS_MODULE
518
+ * @static
519
+ * @final
520
+ * @type String
521
+ */
522
+ YAHOO.widget.Module.CSS_MODULE = "module";
523
+
524
+ /**
525
+ * Constant representing the module header
526
+ * @property YAHOO.widget.Module.CSS_HEADER
527
+ * @static
528
+ * @final
529
+ * @type String
530
+ */
531
+ YAHOO.widget.Module.CSS_HEADER = "hd";
532
+
533
+ /**
534
+ * Constant representing the module body
535
+ * @property YAHOO.widget.Module.CSS_BODY
536
+ * @static
537
+ * @final
538
+ * @type String
539
+ */
540
+ YAHOO.widget.Module.CSS_BODY = "bd";
541
+
542
+ /**
543
+ * Constant representing the module footer
544
+ * @property YAHOO.widget.Module.CSS_FOOTER
545
+ * @static
546
+ * @final
547
+ * @type String
548
+ */
549
+ YAHOO.widget.Module.CSS_FOOTER = "ft";
550
+
551
+ /**
552
+ * Constant representing the url for the "src" attribute of the iframe used to monitor changes to the browser's base font size
553
+ * @property YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL
554
+ * @static
555
+ * @final
556
+ * @type String
557
+ */
558
+ YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL = "javascript:false;";
559
+
560
+ /**
561
+ * Singleton CustomEvent fired when the font size is changed in the browser.
562
+ * Opera's "zoom" functionality currently does not support text size detection.
563
+ * @event YAHOO.widget.Module.textResizeEvent
564
+ */
565
+ YAHOO.widget.Module.textResizeEvent = new YAHOO.util.CustomEvent("textResize");
566
+
567
+ YAHOO.widget.Module.prototype = {
568
+ /**
569
+ * The class's constructor function
570
+ * @property contructor
571
+ * @type Function
572
+ */
573
+ constructor : YAHOO.widget.Module,
574
+
575
+ /**
576
+ * The main module element that contains the header, body, and footer
577
+ * @property element
578
+ * @type HTMLElement
579
+ */
580
+ element : null,
581
+
582
+ /**
583
+ * The header element, denoted with CSS class "hd"
584
+ * @property header
585
+ * @type HTMLElement
586
+ */
587
+ header : null,
588
+
589
+ /**
590
+ * The body element, denoted with CSS class "bd"
591
+ * @property body
592
+ * @type HTMLElement
593
+ */
594
+ body : null,
595
+
596
+ /**
597
+ * The footer element, denoted with CSS class "ft"
598
+ * @property footer
599
+ * @type HTMLElement
600
+ */
601
+ footer : null,
602
+
603
+ /**
604
+ * The id of the element
605
+ * @property id
606
+ * @type String
607
+ */
608
+ id : null,
609
+
610
+ /**
611
+ * The String representing the image root
612
+ * @property imageRoot
613
+ * @type String
614
+ */
615
+ imageRoot : YAHOO.widget.Module.IMG_ROOT,
616
+
617
+ /**
618
+ * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
619
+ * @method initEvents
620
+ */
621
+ initEvents : function() {
622
+
623
+ /**
624
+ * CustomEvent fired prior to class initalization.
625
+ * @event beforeInitEvent
626
+ * @param {class} classRef class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)
627
+ */
628
+ this.beforeInitEvent = new YAHOO.util.CustomEvent("beforeInit");
629
+
630
+ /**
631
+ * CustomEvent fired after class initalization.
632
+ * @event initEvent
633
+ * @param {class} classRef class reference of the initializing class, such as this.beforeInitEvent.fire(YAHOO.widget.Module)
634
+ */
635
+ this.initEvent = new YAHOO.util.CustomEvent("init");
636
+
637
+ /**
638
+ * CustomEvent fired when the Module is appended to the DOM
639
+ * @event appendEvent
640
+ */
641
+ this.appendEvent = new YAHOO.util.CustomEvent("append");
642
+
643
+ /**
644
+ * CustomEvent fired before the Module is rendered
645
+ * @event beforeRenderEvent
646
+ */
647
+ this.beforeRenderEvent = new YAHOO.util.CustomEvent("beforeRender");
648
+
649
+ /**
650
+ * CustomEvent fired after the Module is rendered
651
+ * @event renderEvent
652
+ */
653
+ this.renderEvent = new YAHOO.util.CustomEvent("render");
654
+
655
+ /**
656
+ * CustomEvent fired when the header content of the Module is modified
657
+ * @event changeHeaderEvent
658
+ * @param {String/HTMLElement} content String/element representing the new header content
659
+ */
660
+ this.changeHeaderEvent = new YAHOO.util.CustomEvent("changeHeader");
661
+
662
+ /**
663
+ * CustomEvent fired when the body content of the Module is modified
664
+ * @event changeBodyEvent
665
+ * @param {String/HTMLElement} content String/element representing the new body content
666
+ */
667
+ this.changeBodyEvent = new YAHOO.util.CustomEvent("changeBody");
668
+
669
+ /**
670
+ * CustomEvent fired when the footer content of the Module is modified
671
+ * @event changeFooterEvent
672
+ * @param {String/HTMLElement} content String/element representing the new footer content
673
+ */
674
+ this.changeFooterEvent = new YAHOO.util.CustomEvent("changeFooter");
675
+
676
+ /**
677
+ * CustomEvent fired when the content of the Module is modified
678
+ * @event changeContentEvent
679
+ */
680
+ this.changeContentEvent = new YAHOO.util.CustomEvent("changeContent");
681
+
682
+ /**
683
+ * CustomEvent fired when the Module is destroyed
684
+ * @event destroyEvent
685
+ */
686
+ this.destroyEvent = new YAHOO.util.CustomEvent("destroy");
687
+
688
+ /**
689
+ * CustomEvent fired before the Module is shown
690
+ * @event beforeShowEvent
691
+ */
692
+ this.beforeShowEvent = new YAHOO.util.CustomEvent("beforeShow");
693
+
694
+ /**
695
+ * CustomEvent fired after the Module is shown
696
+ * @event showEvent
697
+ */
698
+ this.showEvent = new YAHOO.util.CustomEvent("show");
699
+
700
+ /**
701
+ * CustomEvent fired before the Module is hidden
702
+ * @event beforeHideEvent
703
+ */
704
+ this.beforeHideEvent = new YAHOO.util.CustomEvent("beforeHide");
705
+
706
+ /**
707
+ * CustomEvent fired after the Module is hidden
708
+ * @event hideEvent
709
+ */
710
+ this.hideEvent = new YAHOO.util.CustomEvent("hide");
711
+ },
712
+
713
+ /**
714
+ * String representing the current user-agent platform
715
+ * @property platform
716
+ * @type String
717
+ */
718
+ platform : function() {
719
+ var ua = navigator.userAgent.toLowerCase();
720
+ if (ua.indexOf("windows") != -1 || ua.indexOf("win32") != -1) {
721
+ return "windows";
722
+ } else if (ua.indexOf("macintosh") != -1) {
723
+ return "mac";
724
+ } else {
725
+ return false;
726
+ }
727
+ }(),
728
+
729
+ /**
730
+ * String representing the current user-agent browser
731
+ * @property browser
732
+ * @type String
733
+ */
734
+ browser : function() {
735
+ var ua = navigator.userAgent.toLowerCase();
736
+ if (ua.indexOf('opera')!=-1) { // Opera (check first in case of spoof)
737
+ return 'opera';
738
+ } else if (ua.indexOf('msie 7')!=-1) { // IE7
739
+ return 'ie7';
740
+ } else if (ua.indexOf('msie') !=-1) { // IE
741
+ return 'ie';
742
+ } else if (ua.indexOf('safari')!=-1) { // Safari (check before Gecko because it includes "like Gecko")
743
+ return 'safari';
744
+ } else if (ua.indexOf('gecko') != -1) { // Gecko
745
+ return 'gecko';
746
+ } else {
747
+ return false;
748
+ }
749
+ }(),
750
+
751
+ /**
752
+ * Boolean representing whether or not the current browsing context is secure (https)
753
+ * @property isSecure
754
+ * @type Boolean
755
+ */
756
+ isSecure : function() {
757
+ if (window.location.href.toLowerCase().indexOf("https") === 0) {
758
+ return true;
759
+ } else {
760
+ return false;
761
+ }
762
+ }(),
763
+
764
+ /**
765
+ * Initializes the custom events for Module which are fired automatically at appropriate times by the Module class.
766
+ */
767
+ initDefaultConfig : function() {
768
+ // Add properties //
769
+
770
+ /**
771
+ * Specifies whether the Module is visible on the page.
772
+ * @config visible
773
+ * @type Boolean
774
+ * @default true
775
+ */
776
+ this.cfg.addProperty("visible", { value:true, handler:this.configVisible, validator:this.cfg.checkBoolean } );
777
+
778
+ /**
779
+ * Object or array of objects representing the ContainerEffect classes that are active for animating the container.
780
+ * @config effect
781
+ * @type Object
782
+ * @default null
783
+ */
784
+ this.cfg.addProperty("effect", { suppressEvent:true, supercedes:["visible"] } );
785
+
786
+ /**
787
+ * Specifies whether to create a special proxy iframe to monitor for user font resizing in the document
788
+ * @config monitorresize
789
+ * @type Boolean
790
+ * @default true
791
+ */
792
+ this.cfg.addProperty("monitorresize", { value:true, handler:this.configMonitorResize } );
793
+ },
794
+
795
+ /**
796
+ * The Module class's initialization method, which is executed for Module and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
797
+ * @method init
798
+ * @param {String} el The element ID representing the Module <em>OR</em>
799
+ * @param {HTMLElement} el The element representing the Module
800
+ * @param {Object} userConfig The configuration Object literal containing the configuration that should be set for this module. See configuration documentation for more details.
801
+ */
802
+ init : function(el, userConfig) {
803
+
804
+ this.initEvents();
805
+
806
+ this.beforeInitEvent.fire(YAHOO.widget.Module);
807
+
808
+ /**
809
+ * The Module's Config object used for monitoring configuration properties.
810
+ * @property cfg
811
+ * @type YAHOO.util.Config
812
+ */
813
+ this.cfg = new YAHOO.util.Config(this);
814
+
815
+ if (this.isSecure) {
816
+ this.imageRoot = YAHOO.widget.Module.IMG_ROOT_SSL;
817
+ }
818
+
819
+ if (typeof el == "string") {
820
+ var elId = el;
821
+
822
+ el = document.getElementById(el);
823
+ if (! el) {
824
+ el = document.createElement("DIV");
825
+ el.id = elId;
826
+ }
827
+ }
828
+
829
+ this.element = el;
830
+
831
+ if (el.id) {
832
+ this.id = el.id;
833
+ }
834
+
835
+ var childNodes = this.element.childNodes;
836
+
837
+ if (childNodes) {
838
+ for (var i=0;i<childNodes.length;i++) {
839
+ var child = childNodes[i];
840
+ switch (child.className) {
841
+ case YAHOO.widget.Module.CSS_HEADER:
842
+ this.header = child;
843
+ break;
844
+ case YAHOO.widget.Module.CSS_BODY:
845
+ this.body = child;
846
+ break;
847
+ case YAHOO.widget.Module.CSS_FOOTER:
848
+ this.footer = child;
849
+ break;
850
+ }
851
+ }
852
+ }
853
+
854
+ this.initDefaultConfig();
855
+
856
+ YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Module.CSS_MODULE);
857
+
858
+ if (userConfig) {
859
+ this.cfg.applyConfig(userConfig, true);
860
+ }
861
+
862
+ // Subscribe to the fireQueue() method of Config so that any queued configuration changes are
863
+ // excecuted upon render of the Module
864
+ if (! YAHOO.util.Config.alreadySubscribed(this.renderEvent, this.cfg.fireQueue, this.cfg)) {
865
+ this.renderEvent.subscribe(this.cfg.fireQueue, this.cfg, true);
866
+ }
867
+
868
+ this.initEvent.fire(YAHOO.widget.Module);
869
+ },
870
+
871
+ /**
872
+ * Initialized an empty IFRAME that is placed out of the visible area that can be used to detect text resize.
873
+ * @method initResizeMonitor
874
+ */
875
+ initResizeMonitor : function() {
876
+
877
+ if(this.browser != "opera") {
878
+
879
+ var resizeMonitor = document.getElementById("_yuiResizeMonitor");
880
+
881
+ if (! resizeMonitor) {
882
+
883
+ resizeMonitor = document.createElement("iframe");
884
+
885
+ var bIE = (this.browser.indexOf("ie") === 0);
886
+
887
+ if(this.isSecure &&
888
+ YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL &&
889
+ bIE) {
890
+
891
+ resizeMonitor.src =
892
+ YAHOO.widget.Module.RESIZE_MONITOR_SECURE_URL;
893
+
894
+ }
895
+
896
+ resizeMonitor.id = "_yuiResizeMonitor";
897
+ resizeMonitor.style.visibility = "hidden";
898
+
899
+ document.body.appendChild(resizeMonitor);
900
+
901
+ resizeMonitor.style.width = "10em";
902
+ resizeMonitor.style.height = "10em";
903
+ resizeMonitor.style.position = "absolute";
904
+
905
+ var nLeft = -1 * resizeMonitor.offsetWidth,
906
+ nTop = -1 * resizeMonitor.offsetHeight;
907
+
908
+ resizeMonitor.style.top = nTop + "px";
909
+ resizeMonitor.style.left = nLeft + "px";
910
+ resizeMonitor.style.borderStyle = "none";
911
+ resizeMonitor.style.borderWidth = "0";
912
+ YAHOO.util.Dom.setStyle(resizeMonitor, "opacity", "0");
913
+
914
+ resizeMonitor.style.visibility = "visible";
915
+
916
+ if(!bIE) {
917
+
918
+ var doc = resizeMonitor.contentWindow.document;
919
+
920
+ doc.open();
921
+ doc.close();
922
+
923
+ }
924
+ }
925
+
926
+ var fireTextResize = function() {
927
+ YAHOO.widget.Module.textResizeEvent.fire();
928
+ };
929
+
930
+ if(resizeMonitor && resizeMonitor.contentWindow) {
931
+ this.resizeMonitor = resizeMonitor;
932
+
933
+ YAHOO.widget.Module.textResizeEvent.subscribe(this.onDomResize, this, true);
934
+
935
+ if (! YAHOO.widget.Module.textResizeInitialized) {
936
+ if (! YAHOO.util.Event.addListener(this.resizeMonitor.contentWindow, "resize", fireTextResize)) {
937
+ // This will fail in IE if document.domain has changed, so we must change the listener to
938
+ // use the resizeMonitor element instead
939
+ YAHOO.util.Event.addListener(this.resizeMonitor, "resize", fireTextResize);
940
+ }
941
+ YAHOO.widget.Module.textResizeInitialized = true;
942
+ }
943
+ }
944
+
945
+ }
946
+
947
+ },
948
+
949
+ /**
950
+ * Event handler fired when the resize monitor element is resized.
951
+ * @method onDomResize
952
+ * @param {DOMEvent} e The DOM resize event
953
+ * @param {Object} obj The scope object passed to the handler
954
+ */
955
+ onDomResize : function(e, obj) {
956
+ var nLeft = -1 * this.resizeMonitor.offsetWidth,
957
+ nTop = -1 * this.resizeMonitor.offsetHeight;
958
+
959
+ this.resizeMonitor.style.top = nTop + "px";
960
+ this.resizeMonitor.style.left = nLeft + "px";
961
+
962
+ },
963
+
964
+ /**
965
+ * Sets the Module's header content to the HTML specified, or appends the passed element to the header. If no header is present, one will be automatically created.
966
+ * @method setHeader
967
+ * @param {String} headerContent The HTML used to set the header <em>OR</em>
968
+ * @param {HTMLElement} headerContent The HTMLElement to append to the header
969
+ */
970
+ setHeader : function(headerContent) {
971
+ if (! this.header) {
972
+ this.header = document.createElement("DIV");
973
+ this.header.className = YAHOO.widget.Module.CSS_HEADER;
974
+ }
975
+
976
+ if (typeof headerContent == "string") {
977
+ this.header.innerHTML = headerContent;
978
+ } else {
979
+ this.header.innerHTML = "";
980
+ this.header.appendChild(headerContent);
981
+ }
982
+
983
+ this.changeHeaderEvent.fire(headerContent);
984
+ this.changeContentEvent.fire();
985
+ },
986
+
987
+ /**
988
+ * Appends the passed element to the header. If no header is present, one will be automatically created.
989
+ * @method appendToHeader
990
+ * @param {HTMLElement} element The element to append to the header
991
+ */
992
+ appendToHeader : function(element) {
993
+ if (! this.header) {
994
+ this.header = document.createElement("DIV");
995
+ this.header.className = YAHOO.widget.Module.CSS_HEADER;
996
+ }
997
+
998
+ this.header.appendChild(element);
999
+ this.changeHeaderEvent.fire(element);
1000
+ this.changeContentEvent.fire();
1001
+ },
1002
+
1003
+ /**
1004
+ * Sets the Module's body content to the HTML specified, or appends the passed element to the body. If no body is present, one will be automatically created.
1005
+ * @method setBody
1006
+ * @param {String} bodyContent The HTML used to set the body <em>OR</em>
1007
+ * @param {HTMLElement} bodyContent The HTMLElement to append to the body
1008
+ */
1009
+ setBody : function(bodyContent) {
1010
+ if (! this.body) {
1011
+ this.body = document.createElement("DIV");
1012
+ this.body.className = YAHOO.widget.Module.CSS_BODY;
1013
+ }
1014
+
1015
+ if (typeof bodyContent == "string")
1016
+ {
1017
+ this.body.innerHTML = bodyContent;
1018
+ } else {
1019
+ this.body.innerHTML = "";
1020
+ this.body.appendChild(bodyContent);
1021
+ }
1022
+
1023
+ this.changeBodyEvent.fire(bodyContent);
1024
+ this.changeContentEvent.fire();
1025
+ },
1026
+
1027
+ /**
1028
+ * Appends the passed element to the body. If no body is present, one will be automatically created.
1029
+ * @method appendToBody
1030
+ * @param {HTMLElement} element The element to append to the body
1031
+ */
1032
+ appendToBody : function(element) {
1033
+ if (! this.body) {
1034
+ this.body = document.createElement("DIV");
1035
+ this.body.className = YAHOO.widget.Module.CSS_BODY;
1036
+ }
1037
+
1038
+ this.body.appendChild(element);
1039
+ this.changeBodyEvent.fire(element);
1040
+ this.changeContentEvent.fire();
1041
+ },
1042
+
1043
+ /**
1044
+ * Sets the Module's footer content to the HTML specified, or appends the passed element to the footer. If no footer is present, one will be automatically created.
1045
+ * @method setFooter
1046
+ * @param {String} footerContent The HTML used to set the footer <em>OR</em>
1047
+ * @param {HTMLElement} footerContent The HTMLElement to append to the footer
1048
+ */
1049
+ setFooter : function(footerContent) {
1050
+ if (! this.footer) {
1051
+ this.footer = document.createElement("DIV");
1052
+ this.footer.className = YAHOO.widget.Module.CSS_FOOTER;
1053
+ }
1054
+
1055
+ if (typeof footerContent == "string") {
1056
+ this.footer.innerHTML = footerContent;
1057
+ } else {
1058
+ this.footer.innerHTML = "";
1059
+ this.footer.appendChild(footerContent);
1060
+ }
1061
+
1062
+ this.changeFooterEvent.fire(footerContent);
1063
+ this.changeContentEvent.fire();
1064
+ },
1065
+
1066
+ /**
1067
+ * Appends the passed element to the footer. If no footer is present, one will be automatically created.
1068
+ * @method appendToFooter
1069
+ * @param {HTMLElement} element The element to append to the footer
1070
+ */
1071
+ appendToFooter : function(element) {
1072
+ if (! this.footer) {
1073
+ this.footer = document.createElement("DIV");
1074
+ this.footer.className = YAHOO.widget.Module.CSS_FOOTER;
1075
+ }
1076
+
1077
+ this.footer.appendChild(element);
1078
+ this.changeFooterEvent.fire(element);
1079
+ this.changeContentEvent.fire();
1080
+ },
1081
+
1082
+ /**
1083
+ * Renders the Module by inserting the elements that are not already in the main Module into their correct places. Optionally appends the Module to the specified node prior to the render's execution. NOTE: For Modules without existing markup, the appendToNode argument is REQUIRED. If this argument is ommitted and the current element is not present in the document, the function will return false, indicating that the render was a failure.
1084
+ * @method render
1085
+ * @param {String} appendToNode The element id to which the Module should be appended to prior to rendering <em>OR</em>
1086
+ * @param {HTMLElement} appendToNode The element to which the Module should be appended to prior to rendering
1087
+ * @param {HTMLElement} moduleElement OPTIONAL. The element that represents the actual Standard Module container.
1088
+ * @return {Boolean} Success or failure of the render
1089
+ */
1090
+ render : function(appendToNode, moduleElement) {
1091
+ this.beforeRenderEvent.fire();
1092
+
1093
+ if (! moduleElement) {
1094
+ moduleElement = this.element;
1095
+ }
1096
+
1097
+ var me = this;
1098
+ var appendTo = function(element) {
1099
+ if (typeof element == "string") {
1100
+ element = document.getElementById(element);
1101
+ }
1102
+
1103
+ if (element) {
1104
+ element.appendChild(me.element);
1105
+ me.appendEvent.fire();
1106
+ }
1107
+ };
1108
+
1109
+ if (appendToNode) {
1110
+ appendTo(appendToNode);
1111
+ } else { // No node was passed in. If the element is not pre-marked up, this fails
1112
+ if (! YAHOO.util.Dom.inDocument(this.element)) {
1113
+ return false;
1114
+ }
1115
+ }
1116
+
1117
+ // Need to get everything into the DOM if it isn't already
1118
+
1119
+ if (this.header && ! YAHOO.util.Dom.inDocument(this.header)) {
1120
+ // There is a header, but it's not in the DOM yet... need to add it
1121
+ var firstChild = moduleElement.firstChild;
1122
+ if (firstChild) { // Insert before first child if exists
1123
+ moduleElement.insertBefore(this.header, firstChild);
1124
+ } else { // Append to empty body because there are no children
1125
+ moduleElement.appendChild(this.header);
1126
+ }
1127
+ }
1128
+
1129
+ if (this.body && ! YAHOO.util.Dom.inDocument(this.body)) {
1130
+ // There is a body, but it's not in the DOM yet... need to add it
1131
+ if (this.footer && YAHOO.util.Dom.isAncestor(this.moduleElement, this.footer)) { // Insert before footer if exists in DOM
1132
+ moduleElement.insertBefore(this.body, this.footer);
1133
+ } else { // Append to element because there is no footer
1134
+ moduleElement.appendChild(this.body);
1135
+ }
1136
+ }
1137
+
1138
+ if (this.footer && ! YAHOO.util.Dom.inDocument(this.footer)) {
1139
+ // There is a footer, but it's not in the DOM yet... need to add it
1140
+ moduleElement.appendChild(this.footer);
1141
+ }
1142
+
1143
+ this.renderEvent.fire();
1144
+ return true;
1145
+ },
1146
+
1147
+ /**
1148
+ * Removes the Module element from the DOM and sets all child elements to null.
1149
+ * @method destroy
1150
+ */
1151
+ destroy : function() {
1152
+ var parent;
1153
+
1154
+ if (this.element) {
1155
+ YAHOO.util.Event.purgeElement(this.element, true);
1156
+ parent = this.element.parentNode;
1157
+ }
1158
+ if (parent) {
1159
+ parent.removeChild(this.element);
1160
+ }
1161
+
1162
+ this.element = null;
1163
+ this.header = null;
1164
+ this.body = null;
1165
+ this.footer = null;
1166
+
1167
+ for (var e in this) {
1168
+ if (e instanceof YAHOO.util.CustomEvent) {
1169
+ e.unsubscribeAll();
1170
+ }
1171
+ }
1172
+
1173
+ YAHOO.widget.Module.textResizeEvent.unsubscribe(this.onDomResize, this);
1174
+
1175
+ this.destroyEvent.fire();
1176
+ },
1177
+
1178
+ /**
1179
+ * Shows the Module element by setting the visible configuration property to true. Also fires two events: beforeShowEvent prior to the visibility change, and showEvent after.
1180
+ * @method show
1181
+ */
1182
+ show : function() {
1183
+ this.cfg.setProperty("visible", true);
1184
+ },
1185
+
1186
+ /**
1187
+ * Hides the Module element by setting the visible configuration property to false. Also fires two events: beforeHideEvent prior to the visibility change, and hideEvent after.
1188
+ * @method hide
1189
+ */
1190
+ hide : function() {
1191
+ this.cfg.setProperty("visible", false);
1192
+ },
1193
+
1194
+ // BUILT-IN EVENT HANDLERS FOR MODULE //
1195
+
1196
+ /**
1197
+ * Default event handler for changing the visibility property of a Module. By default, this is achieved by switching the "display" style between "block" and "none".
1198
+ * This method is responsible for firing showEvent and hideEvent.
1199
+ * @param {String} type The CustomEvent type (usually the property name)
1200
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
1201
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
1202
+ * @method configVisible
1203
+ */
1204
+ configVisible : function(type, args, obj) {
1205
+ var visible = args[0];
1206
+ if (visible) {
1207
+ this.beforeShowEvent.fire();
1208
+ YAHOO.util.Dom.setStyle(this.element, "display", "block");
1209
+ this.showEvent.fire();
1210
+ } else {
1211
+ this.beforeHideEvent.fire();
1212
+ YAHOO.util.Dom.setStyle(this.element, "display", "none");
1213
+ this.hideEvent.fire();
1214
+ }
1215
+ },
1216
+
1217
+ /**
1218
+ * Default event handler for the "monitorresize" configuration property
1219
+ * @param {String} type The CustomEvent type (usually the property name)
1220
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
1221
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
1222
+ * @method configMonitorResize
1223
+ */
1224
+ configMonitorResize : function(type, args, obj) {
1225
+ var monitor = args[0];
1226
+ if (monitor) {
1227
+ this.initResizeMonitor();
1228
+ } else {
1229
+ YAHOO.widget.Module.textResizeEvent.unsubscribe(this.onDomResize, this, true);
1230
+ this.resizeMonitor = null;
1231
+ }
1232
+ }
1233
+ };
1234
+
1235
+ /**
1236
+ * Returns a String representation of the Object.
1237
+ * @method toString
1238
+ * @return {String} The string representation of the Module
1239
+ */
1240
+ YAHOO.widget.Module.prototype.toString = function() {
1241
+ return "Module " + this.id;
1242
+ };
1243
+
1244
+ /**
1245
+ * Overlay is a Module that is absolutely positioned above the page flow. It has convenience methods for positioning and sizing, as well as options for controlling zIndex and constraining the Overlay's position to the current visible viewport. Overlay also contains a dynamicly generated IFRAME which is placed beneath it for Internet Explorer 6 and 5.x so that it will be properly rendered above SELECT elements.
1246
+ * @namespace YAHOO.widget
1247
+ * @class Overlay
1248
+ * @extends YAHOO.widget.Module
1249
+ * @param {String} el The element ID representing the Overlay <em>OR</em>
1250
+ * @param {HTMLElement} el The element representing the Overlay
1251
+ * @param {Object} userConfig The configuration object literal containing 10/23/2006the configuration that should be set for this Overlay. See configuration documentation for more details.
1252
+ * @constructor
1253
+ */
1254
+ YAHOO.widget.Overlay = function(el, userConfig) {
1255
+ YAHOO.widget.Overlay.superclass.constructor.call(this, el, userConfig);
1256
+ };
1257
+
1258
+ YAHOO.extend(YAHOO.widget.Overlay, YAHOO.widget.Module);
1259
+
1260
+ /**
1261
+ * The URL that will be placed in the iframe
1262
+ * @property YAHOO.widget.Overlay.IFRAME_SRC
1263
+ * @static
1264
+ * @final
1265
+ * @type String
1266
+ */
1267
+ YAHOO.widget.Overlay.IFRAME_SRC = "javascript:false;";
1268
+
1269
+ /**
1270
+ * Constant representing the top left corner of an element, used for configuring the context element alignment
1271
+ * @property YAHOO.widget.Overlay.TOP_LEFT
1272
+ * @static
1273
+ * @final
1274
+ * @type String
1275
+ */
1276
+ YAHOO.widget.Overlay.TOP_LEFT = "tl";
1277
+
1278
+ /**
1279
+ * Constant representing the top right corner of an element, used for configuring the context element alignment
1280
+ * @property YAHOO.widget.Overlay.TOP_RIGHT
1281
+ * @static
1282
+ * @final
1283
+ * @type String
1284
+ */
1285
+ YAHOO.widget.Overlay.TOP_RIGHT = "tr";
1286
+
1287
+ /**
1288
+ * Constant representing the top bottom left corner of an element, used for configuring the context element alignment
1289
+ * @property YAHOO.widget.Overlay.BOTTOM_LEFT
1290
+ * @static
1291
+ * @final
1292
+ * @type String
1293
+ */
1294
+ YAHOO.widget.Overlay.BOTTOM_LEFT = "bl";
1295
+
1296
+ /**
1297
+ * Constant representing the bottom right corner of an element, used for configuring the context element alignment
1298
+ * @property YAHOO.widget.Overlay.BOTTOM_RIGHT
1299
+ * @static
1300
+ * @final
1301
+ * @type String
1302
+ */
1303
+ YAHOO.widget.Overlay.BOTTOM_RIGHT = "br";
1304
+
1305
+ /**
1306
+ * Constant representing the default CSS class used for an Overlay
1307
+ * @property YAHOO.widget.Overlay.CSS_OVERLAY
1308
+ * @static
1309
+ * @final
1310
+ * @type String
1311
+ */
1312
+ YAHOO.widget.Overlay.CSS_OVERLAY = "overlay";
1313
+
1314
+ /**
1315
+ * The Overlay initialization method, which is executed for Overlay and all of its subclasses. This method is automatically called by the constructor, and sets up all DOM references for pre-existing markup, and creates required markup if it is not already present.
1316
+ * @method init
1317
+ * @param {String} el The element ID representing the Overlay <em>OR</em>
1318
+ * @param {HTMLElement} el The element representing the Overlay
1319
+ * @param {Object} userConfig The configuration object literal containing the configuration that should be set for this Overlay. See configuration documentation for more details.
1320
+ */
1321
+ YAHOO.widget.Overlay.prototype.init = function(el, userConfig) {
1322
+ YAHOO.widget.Overlay.superclass.init.call(this, el/*, userConfig*/); // Note that we don't pass the user config in here yet because we only want it executed once, at the lowest subclass level
1323
+
1324
+ this.beforeInitEvent.fire(YAHOO.widget.Overlay);
1325
+
1326
+ YAHOO.util.Dom.addClass(this.element, YAHOO.widget.Overlay.CSS_OVERLAY);
1327
+
1328
+ if (userConfig) {
1329
+ this.cfg.applyConfig(userConfig, true);
1330
+ }
1331
+
1332
+ if (this.platform == "mac" && this.browser == "gecko") {
1333
+ if (! YAHOO.util.Config.alreadySubscribed(this.showEvent,this.showMacGeckoScrollbars,this)) {
1334
+ this.showEvent.subscribe(this.showMacGeckoScrollbars,this,true);
1335
+ }
1336
+ if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent,this.hideMacGeckoScrollbars,this)) {
1337
+ this.hideEvent.subscribe(this.hideMacGeckoScrollbars,this,true);
1338
+ }
1339
+ }
1340
+
1341
+ this.initEvent.fire(YAHOO.widget.Overlay);
1342
+ };
1343
+
1344
+ /**
1345
+ * Initializes the custom events for Overlay which are fired automatically at appropriate times by the Overlay class.
1346
+ * @method initEvents
1347
+ */
1348
+ YAHOO.widget.Overlay.prototype.initEvents = function() {
1349
+ YAHOO.widget.Overlay.superclass.initEvents.call(this);
1350
+
1351
+ /**
1352
+ * CustomEvent fired before the Overlay is moved.
1353
+ * @event beforeMoveEvent
1354
+ * @param {Number} x x coordinate
1355
+ * @param {Number} y y coordinate
1356
+ */
1357
+ this.beforeMoveEvent = new YAHOO.util.CustomEvent("beforeMove", this);
1358
+
1359
+ /**
1360
+ * CustomEvent fired after the Overlay is moved.
1361
+ * @event moveEvent
1362
+ * @param {Number} x x coordinate
1363
+ * @param {Number} y y coordinate
1364
+ */
1365
+ this.moveEvent = new YAHOO.util.CustomEvent("move", this);
1366
+ };
1367
+
1368
+ /**
1369
+ * Initializes the class's configurable properties which can be changed using the Overlay's Config object (cfg).
1370
+ * @method initDefaultConfig
1371
+ */
1372
+ YAHOO.widget.Overlay.prototype.initDefaultConfig = function() {
1373
+ YAHOO.widget.Overlay.superclass.initDefaultConfig.call(this);
1374
+
1375
+ // Add overlay config properties //
1376
+
1377
+ /**
1378
+ * The absolute x-coordinate position of the Overlay
1379
+ * @config x
1380
+ * @type Number
1381
+ * @default null
1382
+ */
1383
+ this.cfg.addProperty("x", { handler:this.configX, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );
1384
+
1385
+ /**
1386
+ * The absolute y-coordinate position of the Overlay
1387
+ * @config y
1388
+ * @type Number
1389
+ * @default null
1390
+ */
1391
+ this.cfg.addProperty("y", { handler:this.configY, validator:this.cfg.checkNumber, suppressEvent:true, supercedes:["iframe"] } );
1392
+
1393
+ /**
1394
+ * An array with the absolute x and y positions of the Overlay
1395
+ * @config xy
1396
+ * @type Number[]
1397
+ * @default null
1398
+ */
1399
+ this.cfg.addProperty("xy",{ handler:this.configXY, suppressEvent:true, supercedes:["iframe"] } );
1400
+
1401
+ /**
1402
+ * The array of context arguments for context-sensitive positioning. The format is: [id or element, element corner, context corner]. For example, setting this property to ["img1", "tl", "bl"] would align the Overlay's top left corner to the context element's bottom left corner.
1403
+ * @config context
1404
+ * @type Array
1405
+ * @default null
1406
+ */
1407
+ this.cfg.addProperty("context", { handler:this.configContext, suppressEvent:true, supercedes:["iframe"] } );
1408
+
1409
+ /**
1410
+ * True if the Overlay should be anchored to the center of the viewport.
1411
+ * @config fixedcenter
1412
+ * @type Boolean
1413
+ * @default false
1414
+ */
1415
+ this.cfg.addProperty("fixedcenter", { value:false, handler:this.configFixedCenter, validator:this.cfg.checkBoolean, supercedes:["iframe","visible"] } );
1416
+
1417
+ /**
1418
+ * CSS width of the Overlay.
1419
+ * @config width
1420
+ * @type String
1421
+ * @default null
1422
+ */
1423
+ this.cfg.addProperty("width", { handler:this.configWidth, suppressEvent:true, supercedes:["iframe"] } );
1424
+
1425
+ /**
1426
+ * CSS height of the Overlay.
1427
+ * @config height
1428
+ * @type String
1429
+ * @default null
1430
+ */
1431
+ this.cfg.addProperty("height", { handler:this.configHeight, suppressEvent:true, supercedes:["iframe"] } );
1432
+
1433
+ /**
1434
+ * CSS z-index of the Overlay.
1435
+ * @config zIndex
1436
+ * @type Number
1437
+ * @default null
1438
+ */
1439
+ this.cfg.addProperty("zIndex", { value:null, handler:this.configzIndex } );
1440
+
1441
+ /**
1442
+ * True if the Overlay should be prevented from being positioned out of the viewport.
1443
+ * @config constraintoviewport
1444
+ * @type Boolean
1445
+ * @default false
1446
+ */
1447
+ this.cfg.addProperty("constraintoviewport", { value:false, handler:this.configConstrainToViewport, validator:this.cfg.checkBoolean, supercedes:["iframe","x","y","xy"] } );
1448
+
1449
+ /**
1450
+ * True if the Overlay should have an IFRAME shim (for correcting the select z-index bug in IE6 and below).
1451
+ * @config iframe
1452
+ * @type Boolean
1453
+ * @default true for IE6 and below, false for all others
1454
+ */
1455
+ this.cfg.addProperty("iframe", { value:(this.browser == "ie" ? true : false), handler:this.configIframe, validator:this.cfg.checkBoolean, supercedes:["zIndex"] } );
1456
+ };
1457
+
1458
+ /**
1459
+ * Moves the Overlay to the specified position. This function is identical to calling this.cfg.setProperty("xy", [x,y]);
1460
+ * @method moveTo
1461
+ * @param {Number} x The Overlay's new x position
1462
+ * @param {Number} y The Overlay's new y position
1463
+ */
1464
+ YAHOO.widget.Overlay.prototype.moveTo = function(x, y) {
1465
+ this.cfg.setProperty("xy",[x,y]);
1466
+ };
1467
+
1468
+ /**
1469
+ * Adds a special CSS class to the Overlay when Mac/Gecko is in use, to work around a Gecko bug where
1470
+ * scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
1471
+ * @method hideMacGeckoScrollbars
1472
+ */
1473
+ YAHOO.widget.Overlay.prototype.hideMacGeckoScrollbars = function() {
1474
+ YAHOO.util.Dom.removeClass(this.element, "show-scrollbars");
1475
+ YAHOO.util.Dom.addClass(this.element, "hide-scrollbars");
1476
+ };
1477
+
1478
+ /**
1479
+ * Removes a special CSS class from the Overlay when Mac/Gecko is in use, to work around a Gecko bug where
1480
+ * scrollbars cannot be hidden. See https://bugzilla.mozilla.org/show_bug.cgi?id=187435
1481
+ * @method showMacGeckoScrollbars
1482
+ */
1483
+ YAHOO.widget.Overlay.prototype.showMacGeckoScrollbars = function() {
1484
+ YAHOO.util.Dom.removeClass(this.element, "hide-scrollbars");
1485
+ YAHOO.util.Dom.addClass(this.element, "show-scrollbars");
1486
+ };
1487
+
1488
+ // BEGIN BUILT-IN PROPERTY EVENT HANDLERS //
1489
+
1490
+ /**
1491
+ * The default event handler fired when the "visible" property is changed. This method is responsible for firing showEvent and hideEvent.
1492
+ * @method configVisible
1493
+ * @param {String} type The CustomEvent type (usually the property name)
1494
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
1495
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
1496
+ */
1497
+ YAHOO.widget.Overlay.prototype.configVisible = function(type, args, obj) {
1498
+ var visible = args[0];
1499
+
1500
+ var currentVis = YAHOO.util.Dom.getStyle(this.element, "visibility");
1501
+
1502
+ if (currentVis == "inherit") {
1503
+ var e = this.element.parentNode;
1504
+ while (e.nodeType != 9 && e.nodeType != 11) {
1505
+ currentVis = YAHOO.util.Dom.getStyle(e, "visibility");
1506
+ if (currentVis != "inherit") { break; }
1507
+ e = e.parentNode;
1508
+ }
1509
+ if (currentVis == "inherit") {
1510
+ currentVis = "visible";
1511
+ }
1512
+ }
1513
+
1514
+ var effect = this.cfg.getProperty("effect");
1515
+
1516
+ var effectInstances = [];
1517
+ if (effect) {
1518
+ if (effect instanceof Array) {
1519
+ for (var i=0;i<effect.length;i++) {
1520
+ var eff = effect[i];
1521
+ effectInstances[effectInstances.length] = eff.effect(this, eff.duration);
1522
+ }
1523
+ } else {
1524
+ effectInstances[effectInstances.length] = effect.effect(this, effect.duration);
1525
+ }
1526
+ }
1527
+
1528
+ var isMacGecko = (this.platform == "mac" && this.browser == "gecko");
1529
+
1530
+ if (visible) { // Show
1531
+ if (isMacGecko) {
1532
+ this.showMacGeckoScrollbars();
1533
+ }
1534
+
1535
+ if (effect) { // Animate in
1536
+ if (visible) { // Animate in if not showing
1537
+ if (currentVis != "visible" || currentVis === "") {
1538
+ this.beforeShowEvent.fire();
1539
+ for (var j=0;j<effectInstances.length;j++) {
1540
+ var ei = effectInstances[j];
1541
+ if (j === 0 && ! YAHOO.util.Config.alreadySubscribed(ei.animateInCompleteEvent,this.showEvent.fire,this.showEvent)) {
1542
+ ei.animateInCompleteEvent.subscribe(this.showEvent.fire,this.showEvent,true); // Delegate showEvent until end of animateInComplete
1543
+ }
1544
+ ei.animateIn();
1545
+ }
1546
+ }
1547
+ }
1548
+ } else { // Show
1549
+ if (currentVis != "visible" || currentVis === "") {
1550
+ this.beforeShowEvent.fire();
1551
+ YAHOO.util.Dom.setStyle(this.element, "visibility", "visible");
1552
+ this.cfg.refireEvent("iframe");
1553
+ this.showEvent.fire();
1554
+ }
1555
+ }
1556
+
1557
+ } else { // Hide
1558
+ if (isMacGecko) {
1559
+ this.hideMacGeckoScrollbars();
1560
+ }
1561
+
1562
+ if (effect) { // Animate out if showing
1563
+ if (currentVis == "visible") {
1564
+ this.beforeHideEvent.fire();
1565
+ for (var k=0;k<effectInstances.length;k++) {
1566
+ var h = effectInstances[k];
1567
+ if (k === 0 && ! YAHOO.util.Config.alreadySubscribed(h.animateOutCompleteEvent,this.hideEvent.fire,this.hideEvent)) {
1568
+ h.animateOutCompleteEvent.subscribe(this.hideEvent.fire,this.hideEvent,true); // Delegate hideEvent until end of animateOutComplete
1569
+ }
1570
+ h.animateOut();
1571
+ }
1572
+ } else if (currentVis === "") {
1573
+ YAHOO.util.Dom.setStyle(this.element, "visibility", "hidden");
1574
+ }
1575
+ } else { // Simple hide
1576
+ if (currentVis == "visible" || currentVis === "") {
1577
+ this.beforeHideEvent.fire();
1578
+ YAHOO.util.Dom.setStyle(this.element, "visibility", "hidden");
1579
+ this.cfg.refireEvent("iframe");
1580
+ this.hideEvent.fire();
1581
+ }
1582
+ }
1583
+ }
1584
+ };
1585
+
1586
+ /**
1587
+ * Center event handler used for centering on scroll/resize, but only if the Overlay is visible
1588
+ * @method doCenterOnDOMEvent
1589
+ */
1590
+ YAHOO.widget.Overlay.prototype.doCenterOnDOMEvent = function() {
1591
+ if (this.cfg.getProperty("visible")) {
1592
+ this.center();
1593
+ }
1594
+ };
1595
+
1596
+ /**
1597
+ * The default event handler fired when the "fixedcenter" property is changed.
1598
+ * @method configFixedCenter
1599
+ * @param {String} type The CustomEvent type (usually the property name)
1600
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
1601
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
1602
+ */
1603
+ YAHOO.widget.Overlay.prototype.configFixedCenter = function(type, args, obj) {
1604
+ var val = args[0];
1605
+
1606
+ if (val) {
1607
+ this.center();
1608
+
1609
+ if (! YAHOO.util.Config.alreadySubscribed(this.beforeShowEvent, this.center, this)) {
1610
+ this.beforeShowEvent.subscribe(this.center, this, true);
1611
+ }
1612
+
1613
+ if (! YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowResizeEvent, this.doCenterOnDOMEvent, this)) {
1614
+ YAHOO.widget.Overlay.windowResizeEvent.subscribe(this.doCenterOnDOMEvent, this, true);
1615
+ }
1616
+
1617
+ if (! YAHOO.util.Config.alreadySubscribed(YAHOO.widget.Overlay.windowScrollEvent, this.doCenterOnDOMEvent, this)) {
1618
+ YAHOO.widget.Overlay.windowScrollEvent.subscribe( this.doCenterOnDOMEvent, this, true);
1619
+ }
1620
+ } else {
1621
+ YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent, this);
1622
+ YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent, this);
1623
+ }
1624
+ };
1625
+
1626
+ /**
1627
+ * The default event handler fired when the "height" property is changed.
1628
+ * @method configHeight
1629
+ * @param {String} type The CustomEvent type (usually the property name)
1630
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
1631
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
1632
+ */
1633
+ YAHOO.widget.Overlay.prototype.configHeight = function(type, args, obj) {
1634
+ var height = args[0];
1635
+ var el = this.element;
1636
+ YAHOO.util.Dom.setStyle(el, "height", height);
1637
+ this.cfg.refireEvent("iframe");
1638
+ };
1639
+
1640
+ /**
1641
+ * The default event handler fired when the "width" property is changed.
1642
+ * @method configWidth
1643
+ * @param {String} type The CustomEvent type (usually the property name)
1644
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
1645
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
1646
+ */
1647
+ YAHOO.widget.Overlay.prototype.configWidth = function(type, args, obj) {
1648
+ var width = args[0];
1649
+ var el = this.element;
1650
+ YAHOO.util.Dom.setStyle(el, "width", width);
1651
+ this.cfg.refireEvent("iframe");
1652
+ };
1653
+
1654
+ /**
1655
+ * The default event handler fired when the "zIndex" property is changed.
1656
+ * @method configzIndex
1657
+ * @param {String} type The CustomEvent type (usually the property name)
1658
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
1659
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
1660
+ */
1661
+ YAHOO.widget.Overlay.prototype.configzIndex = function(type, args, obj) {
1662
+ var zIndex = args[0];
1663
+
1664
+ var el = this.element;
1665
+
1666
+ if (! zIndex) {
1667
+ zIndex = YAHOO.util.Dom.getStyle(el, "zIndex");
1668
+ if (! zIndex || isNaN(zIndex)) {
1669
+ zIndex = 0;
1670
+ }
1671
+ }
1672
+
1673
+ if (this.iframe) {
1674
+ if (zIndex <= 0) {
1675
+ zIndex = 1;
1676
+ }
1677
+ YAHOO.util.Dom.setStyle(this.iframe, "zIndex", (zIndex-1));
1678
+ }
1679
+
1680
+ YAHOO.util.Dom.setStyle(el, "zIndex", zIndex);
1681
+ this.cfg.setProperty("zIndex", zIndex, true);
1682
+ };
1683
+
1684
+ /**
1685
+ * The default event handler fired when the "xy" property is changed.
1686
+ * @method configXY
1687
+ * @param {String} type The CustomEvent type (usually the property name)
1688
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
1689
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
1690
+ */
1691
+ YAHOO.widget.Overlay.prototype.configXY = function(type, args, obj) {
1692
+ var pos = args[0];
1693
+ var x = pos[0];
1694
+ var y = pos[1];
1695
+
1696
+ this.cfg.setProperty("x", x);
1697
+ this.cfg.setProperty("y", y);
1698
+
1699
+ this.beforeMoveEvent.fire([x,y]);
1700
+
1701
+ x = this.cfg.getProperty("x");
1702
+ y = this.cfg.getProperty("y");
1703
+
1704
+ this.cfg.refireEvent("iframe");
1705
+ this.moveEvent.fire([x,y]);
1706
+ };
1707
+
1708
+ /**
1709
+ * The default event handler fired when the "x" property is changed.
1710
+ * @method configX
1711
+ * @param {String} type The CustomEvent type (usually the property name)
1712
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
1713
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
1714
+ */
1715
+ YAHOO.widget.Overlay.prototype.configX = function(type, args, obj) {
1716
+ var x = args[0];
1717
+ var y = this.cfg.getProperty("y");
1718
+
1719
+ this.cfg.setProperty("x", x, true);
1720
+ this.cfg.setProperty("y", y, true);
1721
+
1722
+ this.beforeMoveEvent.fire([x,y]);
1723
+
1724
+ x = this.cfg.getProperty("x");
1725
+ y = this.cfg.getProperty("y");
1726
+
1727
+ YAHOO.util.Dom.setX(this.element, x, true);
1728
+
1729
+ this.cfg.setProperty("xy", [x, y], true);
1730
+
1731
+ this.cfg.refireEvent("iframe");
1732
+ this.moveEvent.fire([x, y]);
1733
+ };
1734
+
1735
+ /**
1736
+ * The default event handler fired when the "y" property is changed.
1737
+ * @method configY
1738
+ * @param {String} type The CustomEvent type (usually the property name)
1739
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
1740
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
1741
+ */
1742
+ YAHOO.widget.Overlay.prototype.configY = function(type, args, obj) {
1743
+ var x = this.cfg.getProperty("x");
1744
+ var y = args[0];
1745
+
1746
+ this.cfg.setProperty("x", x, true);
1747
+ this.cfg.setProperty("y", y, true);
1748
+
1749
+ this.beforeMoveEvent.fire([x,y]);
1750
+
1751
+ x = this.cfg.getProperty("x");
1752
+ y = this.cfg.getProperty("y");
1753
+
1754
+ YAHOO.util.Dom.setY(this.element, y, true);
1755
+
1756
+ this.cfg.setProperty("xy", [x, y], true);
1757
+
1758
+ this.cfg.refireEvent("iframe");
1759
+ this.moveEvent.fire([x, y]);
1760
+ };
1761
+
1762
+ /**
1763
+ * Shows the iframe shim, if it has been enabled
1764
+ * @method showIframe
1765
+ */
1766
+ YAHOO.widget.Overlay.prototype.showIframe = function() {
1767
+ if (this.iframe) {
1768
+ this.iframe.style.display = "block";
1769
+ }
1770
+ };
1771
+
1772
+ /**
1773
+ * Hides the iframe shim, if it has been enabled
1774
+ * @method hideIframe
1775
+ */
1776
+ YAHOO.widget.Overlay.prototype.hideIframe = function() {
1777
+ if (this.iframe) {
1778
+ this.iframe.style.display = "none";
1779
+ }
1780
+ };
1781
+
1782
+ /**
1783
+ * The default event handler fired when the "iframe" property is changed.
1784
+ * @method configIframe
1785
+ * @param {String} type The CustomEvent type (usually the property name)
1786
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
1787
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
1788
+ */
1789
+ YAHOO.widget.Overlay.prototype.configIframe = function(type, args, obj) {
1790
+
1791
+ var val = args[0];
1792
+
1793
+ if (val) { // IFRAME shim is enabled
1794
+
1795
+ if (! YAHOO.util.Config.alreadySubscribed(this.showEvent, this.showIframe, this)) {
1796
+ this.showEvent.subscribe(this.showIframe, this, true);
1797
+ }
1798
+ if (! YAHOO.util.Config.alreadySubscribed(this.hideEvent, this.hideIframe, this)) {
1799
+ this.hideEvent.subscribe(this.hideIframe, this, true);
1800
+ }
1801
+
1802
+ var x = this.cfg.getProperty("x");
1803
+ var y = this.cfg.getProperty("y");
1804
+
1805
+ if (! x || ! y) {
1806
+ this.syncPosition();
1807
+ x = this.cfg.getProperty("x");
1808
+ y = this.cfg.getProperty("y");
1809
+ }
1810
+
1811
+ if (! isNaN(x) && ! isNaN(y)) {
1812
+ if (! this.iframe) {
1813
+ this.iframe = document.createElement("iframe");
1814
+ if (this.isSecure) {
1815
+ this.iframe.src = YAHOO.widget.Overlay.IFRAME_SRC;
1816
+ }
1817
+
1818
+ var parent = this.element.parentNode;
1819
+ if (parent) {
1820
+ parent.appendChild(this.iframe);
1821
+ } else {
1822
+ document.body.appendChild(this.iframe);
1823
+ }
1824
+
1825
+ YAHOO.util.Dom.setStyle(this.iframe, "position", "absolute");
1826
+ YAHOO.util.Dom.setStyle(this.iframe, "border", "none");
1827
+ YAHOO.util.Dom.setStyle(this.iframe, "margin", "0");
1828
+ YAHOO.util.Dom.setStyle(this.iframe, "padding", "0");
1829
+ YAHOO.util.Dom.setStyle(this.iframe, "opacity", "0");
1830
+ if (this.cfg.getProperty("visible")) {
1831
+ this.showIframe();
1832
+ } else {
1833
+ this.hideIframe();
1834
+ }
1835
+ }
1836
+
1837
+ var iframeDisplay = YAHOO.util.Dom.getStyle(this.iframe, "display");
1838
+
1839
+ if (iframeDisplay == "none") {
1840
+ this.iframe.style.display = "block";
1841
+ }
1842
+
1843
+ YAHOO.util.Dom.setXY(this.iframe, [x,y]);
1844
+
1845
+ var width = this.element.clientWidth;
1846
+ var height = this.element.clientHeight;
1847
+
1848
+ YAHOO.util.Dom.setStyle(this.iframe, "width", (width+2) + "px");
1849
+ YAHOO.util.Dom.setStyle(this.iframe, "height", (height+2) + "px");
1850
+
1851
+ if (iframeDisplay == "none") {
1852
+ this.iframe.style.display = "none";
1853
+ }
1854
+ }
1855
+ } else {
1856
+ if (this.iframe) {
1857
+ this.iframe.style.display = "none";
1858
+ }
1859
+ this.showEvent.unsubscribe(this.showIframe, this);
1860
+ this.hideEvent.unsubscribe(this.hideIframe, this);
1861
+ }
1862
+ };
1863
+
1864
+
1865
+ /**
1866
+ * The default event handler fired when the "constraintoviewport" property is changed.
1867
+ * @method configConstrainToViewport
1868
+ * @param {String} type The CustomEvent type (usually the property name)
1869
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
1870
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
1871
+ */
1872
+ YAHOO.widget.Overlay.prototype.configConstrainToViewport = function(type, args, obj) {
1873
+ var val = args[0];
1874
+ if (val) {
1875
+ if (! YAHOO.util.Config.alreadySubscribed(this.beforeMoveEvent, this.enforceConstraints, this)) {
1876
+ this.beforeMoveEvent.subscribe(this.enforceConstraints, this, true);
1877
+ }
1878
+ } else {
1879
+ this.beforeMoveEvent.unsubscribe(this.enforceConstraints, this);
1880
+ }
1881
+ };
1882
+
1883
+ /**
1884
+ * The default event handler fired when the "context" property is changed.
1885
+ * @method configContext
1886
+ * @param {String} type The CustomEvent type (usually the property name)
1887
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
1888
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
1889
+ */
1890
+ YAHOO.widget.Overlay.prototype.configContext = function(type, args, obj) {
1891
+ var contextArgs = args[0];
1892
+
1893
+ if (contextArgs) {
1894
+ var contextEl = contextArgs[0];
1895
+ var elementMagnetCorner = contextArgs[1];
1896
+ var contextMagnetCorner = contextArgs[2];
1897
+
1898
+ if (contextEl) {
1899
+ if (typeof contextEl == "string") {
1900
+ this.cfg.setProperty("context", [document.getElementById(contextEl),elementMagnetCorner,contextMagnetCorner], true);
1901
+ }
1902
+
1903
+ if (elementMagnetCorner && contextMagnetCorner) {
1904
+ this.align(elementMagnetCorner, contextMagnetCorner);
1905
+ }
1906
+ }
1907
+ }
1908
+ };
1909
+
1910
+
1911
+ // END BUILT-IN PROPERTY EVENT HANDLERS //
1912
+
1913
+ /**
1914
+ * Aligns the Overlay to its context element using the specified corner points (represented by the constants TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, and BOTTOM_RIGHT.
1915
+ * @method align
1916
+ * @param {String} elementAlign The String representing the corner of the Overlay that should be aligned to the context element
1917
+ * @param {String} contextAlign The corner of the context element that the elementAlign corner should stick to.
1918
+ */
1919
+ YAHOO.widget.Overlay.prototype.align = function(elementAlign, contextAlign) {
1920
+ var contextArgs = this.cfg.getProperty("context");
1921
+ if (contextArgs) {
1922
+ var context = contextArgs[0];
1923
+
1924
+ var element = this.element;
1925
+ var me = this;
1926
+
1927
+ if (! elementAlign) {
1928
+ elementAlign = contextArgs[1];
1929
+ }
1930
+
1931
+ if (! contextAlign) {
1932
+ contextAlign = contextArgs[2];
1933
+ }
1934
+
1935
+ if (element && context) {
1936
+ var elementRegion = YAHOO.util.Dom.getRegion(element);
1937
+ var contextRegion = YAHOO.util.Dom.getRegion(context);
1938
+
1939
+ var doAlign = function(v,h) {
1940
+ switch (elementAlign) {
1941
+ case YAHOO.widget.Overlay.TOP_LEFT:
1942
+ me.moveTo(h,v);
1943
+ break;
1944
+ case YAHOO.widget.Overlay.TOP_RIGHT:
1945
+ me.moveTo(h-element.offsetWidth,v);
1946
+ break;
1947
+ case YAHOO.widget.Overlay.BOTTOM_LEFT:
1948
+ me.moveTo(h,v-element.offsetHeight);
1949
+ break;
1950
+ case YAHOO.widget.Overlay.BOTTOM_RIGHT:
1951
+ me.moveTo(h-element.offsetWidth,v-element.offsetHeight);
1952
+ break;
1953
+ }
1954
+ };
1955
+
1956
+ switch (contextAlign) {
1957
+ case YAHOO.widget.Overlay.TOP_LEFT:
1958
+ doAlign(contextRegion.top, contextRegion.left);
1959
+ break;
1960
+ case YAHOO.widget.Overlay.TOP_RIGHT:
1961
+ doAlign(contextRegion.top, contextRegion.right);
1962
+ break;
1963
+ case YAHOO.widget.Overlay.BOTTOM_LEFT:
1964
+ doAlign(contextRegion.bottom, contextRegion.left);
1965
+ break;
1966
+ case YAHOO.widget.Overlay.BOTTOM_RIGHT:
1967
+ doAlign(contextRegion.bottom, contextRegion.right);
1968
+ break;
1969
+ }
1970
+ }
1971
+ }
1972
+ };
1973
+
1974
+ /**
1975
+ * The default event handler executed when the moveEvent is fired, if the "constraintoviewport" is set to true.
1976
+ * @method enforceConstraints
1977
+ * @param {String} type The CustomEvent type (usually the property name)
1978
+ * @param {Object[]} args The CustomEvent arguments. For configuration handlers, args[0] will equal the newly applied value for the property.
1979
+ * @param {Object} obj The scope object. For configuration handlers, this will usually equal the owner.
1980
+ */
1981
+ YAHOO.widget.Overlay.prototype.enforceConstraints = function(type, args, obj) {
1982
+ var pos = args[0];
1983
+
1984
+ var x = pos[0];
1985
+ var y = pos[1];
1986
+
1987
+ var offsetHeight = this.element.offsetHeight;
1988
+ var offsetWidth = this.element.offsetWidth;
1989
+
1990
+ var viewPortWidth = YAHOO.util.Dom.getViewportWidth();
1991
+ var viewPortHeight = YAHOO.util.Dom.getViewportHeight();
1992
+
1993
+ var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
1994
+ var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
1995
+
1996
+ var topConstraint = scrollY + 10;
1997
+ var leftConstraint = scrollX + 10;
1998
+ var bottomConstraint = scrollY + viewPortHeight - offsetHeight - 10;
1999
+ var rightConstraint = scrollX + viewPortWidth - offsetWidth - 10;
2000
+
2001
+ if (x < leftConstraint) {
2002
+ x = leftConstraint;
2003
+ } else if (x > rightConstraint) {
2004
+ x = rightConstraint;
2005
+ }
2006
+
2007
+ if (y < topConstraint) {
2008
+ y = topConstraint;
2009
+ } else if (y > bottomConstraint) {
2010
+ y = bottomConstraint;
2011
+ }
2012
+
2013
+ this.cfg.setProperty("x", x, true);
2014
+ this.cfg.setProperty("y", y, true);
2015
+ this.cfg.setProperty("xy", [x,y], true);
2016
+ };
2017
+
2018
+ /**
2019
+ * Centers the container in the viewport.
2020
+ * @method center
2021
+ */
2022
+ YAHOO.widget.Overlay.prototype.center = function() {
2023
+ var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
2024
+ var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
2025
+
2026
+ var viewPortWidth = YAHOO.util.Dom.getClientWidth();
2027
+ var viewPortHeight = YAHOO.util.Dom.getClientHeight();
2028
+
2029
+ var elementWidth = this.element.offsetWidth;
2030
+ var elementHeight = this.element.offsetHeight;
2031
+
2032
+ var x = (viewPortWidth / 2) - (elementWidth / 2) + scrollX;
2033
+ var y = (viewPortHeight / 2) - (elementHeight / 2) + scrollY;
2034
+
2035
+ this.cfg.setProperty("xy", [parseInt(x, 10), parseInt(y, 10)]);
2036
+
2037
+ this.cfg.refireEvent("iframe");
2038
+ };
2039
+
2040
+ /**
2041
+ * Synchronizes the Panel's "xy", "x", and "y" properties with the Panel's position in the DOM. This is primarily used to update position information during drag & drop.
2042
+ * @method syncPosition
2043
+ */
2044
+ YAHOO.widget.Overlay.prototype.syncPosition = function() {
2045
+ var pos = YAHOO.util.Dom.getXY(this.element);
2046
+ this.cfg.setProperty("x", pos[0], true);
2047
+ this.cfg.setProperty("y", pos[1], true);
2048
+ this.cfg.setProperty("xy", pos, true);
2049
+ };
2050
+
2051
+ /**
2052
+ * Event handler fired when the resize monitor element is resized.
2053
+ * @method onDomResize
2054
+ * @param {DOMEvent} e The resize DOM event
2055
+ * @param {Object} obj The scope object
2056
+ */
2057
+ YAHOO.widget.Overlay.prototype.onDomResize = function(e, obj) {
2058
+ YAHOO.widget.Overlay.superclass.onDomResize.call(this, e, obj);
2059
+ var me = this;
2060
+ setTimeout(function() {
2061
+ me.syncPosition();
2062
+ me.cfg.refireEvent("iframe");
2063
+ me.cfg.refireEvent("context");
2064
+ }, 0);
2065
+ };
2066
+
2067
+ /**
2068
+ * Removes the Overlay element from the DOM and sets all child elements to null.
2069
+ * @method destroy
2070
+ */
2071
+ YAHOO.widget.Overlay.prototype.destroy = function() {
2072
+ if (this.iframe) {
2073
+ this.iframe.parentNode.removeChild(this.iframe);
2074
+ }
2075
+
2076
+ this.iframe = null;
2077
+
2078
+ YAHOO.widget.Overlay.windowResizeEvent.unsubscribe(this.doCenterOnDOMEvent, this);
2079
+ YAHOO.widget.Overlay.windowScrollEvent.unsubscribe(this.doCenterOnDOMEvent, this);
2080
+
2081
+ YAHOO.widget.Overlay.superclass.destroy.call(this);
2082
+ };
2083
+
2084
+ /**
2085
+ * Returns a String representation of the object.
2086
+ * @method toString
2087
+ * @return {String} The string representation of the Overlay.
2088
+ */
2089
+ YAHOO.widget.Overlay.prototype.toString = function() {
2090
+ return "Overlay " + this.id;
2091
+ };
2092
+
2093
+ /**
2094
+ * A singleton CustomEvent used for reacting to the DOM event for window scroll
2095
+ * @event YAHOO.widget.Overlay.windowScrollEvent
2096
+ */
2097
+ YAHOO.widget.Overlay.windowScrollEvent = new YAHOO.util.CustomEvent("windowScroll");
2098
+
2099
+ /**
2100
+ * A singleton CustomEvent used for reacting to the DOM event for window resize
2101
+ * @event YAHOO.widget.Overlay.windowResizeEvent
2102
+ */
2103
+ YAHOO.widget.Overlay.windowResizeEvent = new YAHOO.util.CustomEvent("windowResize");
2104
+
2105
+ /**
2106
+ * The DOM event handler used to fire the CustomEvent for window scroll
2107
+ * @method YAHOO.widget.Overlay.windowScrollHandler
2108
+ * @static
2109
+ * @param {DOMEvent} e The DOM scroll event
2110
+ */
2111
+ YAHOO.widget.Overlay.windowScrollHandler = function(e) {
2112
+ if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
2113
+ if (! window.scrollEnd) {
2114
+ window.scrollEnd = -1;
2115
+ }
2116
+ clearTimeout(window.scrollEnd);
2117
+ window.scrollEnd = setTimeout(function() { YAHOO.widget.Overlay.windowScrollEvent.fire(); }, 1);
2118
+ } else {
2119
+ YAHOO.widget.Overlay.windowScrollEvent.fire();
2120
+ }
2121
+ };
2122
+
2123
+ /**
2124
+ * The DOM event handler used to fire the CustomEvent for window resize
2125
+ * @method YAHOO.widget.Overlay.windowResizeHandler
2126
+ * @static
2127
+ * @param {DOMEvent} e The DOM resize event
2128
+ */
2129
+ YAHOO.widget.Overlay.windowResizeHandler = function(e) {
2130
+ if (YAHOO.widget.Module.prototype.browser == "ie" || YAHOO.widget.Module.prototype.browser == "ie7") {
2131
+ if (! window.resizeEnd) {
2132
+ window.resizeEnd = -1;
2133
+ }
2134
+ clearTimeout(window.resizeEnd);
2135
+ window.resizeEnd = setTimeout(function() { YAHOO.widget.Overlay.windowResizeEvent.fire(); }, 100);
2136
+ } else {
2137
+ YAHOO.widget.Overlay.windowResizeEvent.fire();
2138
+ }
2139
+ };
2140
+
2141
+ /**
2142
+ * A boolean that indicated whether the window resize and scroll events have already been subscribed to.
2143
+ * @property YAHOO.widget.Overlay._initialized
2144
+ * @private
2145
+ * @type Boolean
2146
+ */
2147
+ YAHOO.widget.Overlay._initialized = null;
2148
+
2149
+ if (YAHOO.widget.Overlay._initialized === null) {
2150
+ YAHOO.util.Event.addListener(window, "scroll", YAHOO.widget.Overlay.windowScrollHandler);
2151
+ YAHOO.util.Event.addListener(window, "resize", YAHOO.widget.Overlay.windowResizeHandler);
2152
+
2153
+ YAHOO.widget.Overlay._initialized = true;
2154
+ }
2155
+
2156
+ /**
2157
+ * OverlayManager is used for maintaining the focus status of multiple Overlays.* @namespace YAHOO.widget
2158
+ * @namespace YAHOO.widget
2159
+ * @class OverlayManager
2160
+ * @constructor
2161
+ * @param {Array} overlays Optional. A collection of Overlays to register with the manager.
2162
+ * @param {Object} userConfig The object literal representing the user configuration of the OverlayManager
2163
+ */
2164
+ YAHOO.widget.OverlayManager = function(userConfig) {
2165
+ this.init(userConfig);
2166
+ };
2167
+
2168
+ /**
2169
+ * The CSS class representing a focused Overlay
2170
+ * @property YAHOO.widget.OverlayManager.CSS_FOCUSED
2171
+ * @static
2172
+ * @final
2173
+ * @type String
2174
+ */
2175
+ YAHOO.widget.OverlayManager.CSS_FOCUSED = "focused";
2176
+
2177
+ YAHOO.widget.OverlayManager.prototype = {
2178
+ /**
2179
+ * The class's constructor function
2180
+ * @property contructor
2181
+ * @type Function
2182
+ */
2183
+ constructor : YAHOO.widget.OverlayManager,
2184
+
2185
+ /**
2186
+ * The array of Overlays that are currently registered
2187
+ * @property overlays
2188
+ * @type YAHOO.widget.Overlay[]
2189
+ */
2190
+ overlays : null,
2191
+
2192
+ /**
2193
+ * Initializes the default configuration of the OverlayManager
2194
+ * @method initDefaultConfig
2195
+ */
2196
+ initDefaultConfig : function() {
2197
+ /**
2198
+ * The collection of registered Overlays in use by the OverlayManager
2199
+ * @config overlays
2200
+ * @type YAHOO.widget.Overlay[]
2201
+ * @default null
2202
+ */
2203
+ this.cfg.addProperty("overlays", { suppressEvent:true } );
2204
+
2205
+ /**
2206
+ * The default DOM event that should be used to focus an Overlay
2207
+ * @config focusevent
2208
+ * @type String
2209
+ * @default "mousedown"
2210
+ */
2211
+ this.cfg.addProperty("focusevent", { value:"mousedown" } );
2212
+ },
2213
+
2214
+ /**
2215
+ * Initializes the OverlayManager
2216
+ * @method init
2217
+ * @param {YAHOO.widget.Overlay[]} overlays Optional. A collection of Overlays to register with the manager.
2218
+ * @param {Object} userConfig The object literal representing the user configuration of the OverlayManager
2219
+ */
2220
+ init : function(userConfig) {
2221
+ /**
2222
+ * The OverlayManager's Config object used for monitoring configuration properties.
2223
+ * @property cfg
2224
+ * @type YAHOO.util.Config
2225
+ */
2226
+ this.cfg = new YAHOO.util.Config(this);
2227
+
2228
+ this.initDefaultConfig();
2229
+
2230
+ if (userConfig) {
2231
+ this.cfg.applyConfig(userConfig, true);
2232
+ }
2233
+ this.cfg.fireQueue();
2234
+
2235
+ /**
2236
+ * The currently activated Overlay
2237
+ * @property activeOverlay
2238
+ * @private
2239
+ * @type YAHOO.widget.Overlay
2240
+ */
2241
+ var activeOverlay = null;
2242
+
2243
+ /**
2244
+ * Returns the currently focused Overlay
2245
+ * @method getActive
2246
+ * @return {YAHOO.widget.Overlay} The currently focused Overlay
2247
+ */
2248
+ this.getActive = function() {
2249
+ return activeOverlay;
2250
+ };
2251
+
2252
+ /**
2253
+ * Focuses the specified Overlay
2254
+ * @method focus
2255
+ * @param {YAHOO.widget.Overlay} overlay The Overlay to focus
2256
+ * @param {String} overlay The id of the Overlay to focus
2257
+ */
2258
+ this.focus = function(overlay) {
2259
+ var o = this.find(overlay);
2260
+ if (o) {
2261
+ this.blurAll();
2262
+ activeOverlay = o;
2263
+ YAHOO.util.Dom.addClass(activeOverlay.element, YAHOO.widget.OverlayManager.CSS_FOCUSED);
2264
+ this.overlays.sort(this.compareZIndexDesc);
2265
+ var topZIndex = YAHOO.util.Dom.getStyle(this.overlays[0].element, "zIndex");
2266
+ if (! isNaN(topZIndex) && this.overlays[0] != overlay) {
2267
+ activeOverlay.cfg.setProperty("zIndex", (parseInt(topZIndex, 10) + 2));
2268
+ }
2269
+ this.overlays.sort(this.compareZIndexDesc);
2270
+ }
2271
+ };
2272
+
2273
+ /**
2274
+ * Removes the specified Overlay from the manager
2275
+ * @method remove
2276
+ * @param {YAHOO.widget.Overlay} overlay The Overlay to remove
2277
+ * @param {String} overlay The id of the Overlay to remove
2278
+ */
2279
+ this.remove = function(overlay) {
2280
+ var o = this.find(overlay);
2281
+ if (o) {
2282
+ var originalZ = YAHOO.util.Dom.getStyle(o.element, "zIndex");
2283
+ o.cfg.setProperty("zIndex", -1000, true);
2284
+ this.overlays.sort(this.compareZIndexDesc);
2285
+ this.overlays = this.overlays.slice(0, this.overlays.length-1);
2286
+ o.cfg.setProperty("zIndex", originalZ, true);
2287
+
2288
+ o.cfg.setProperty("manager", null);
2289
+ o.focusEvent = null;
2290
+ o.blurEvent = null;
2291
+ o.focus = null;
2292
+ o.blur = null;
2293
+ }
2294
+ };
2295
+
2296
+ /**
2297
+ * Removes focus from all registered Overlays in the manager
2298
+ * @method blurAll
2299
+ */
2300
+ this.blurAll = function() {
2301
+ activeOverlay = null;
2302
+ for (var o=0;o<this.overlays.length;o++) {
2303
+ YAHOO.util.Dom.removeClass(this.overlays[o].element, YAHOO.widget.OverlayManager.CSS_FOCUSED);
2304
+ }
2305
+ };
2306
+
2307
+ var overlays = this.cfg.getProperty("overlays");
2308
+
2309
+ if (! this.overlays) {
2310
+ this.overlays = [];
2311
+ }
2312
+
2313
+ if (overlays) {
2314
+ this.register(overlays);
2315
+ this.overlays.sort(this.compareZIndexDesc);
2316
+ }
2317
+ },
2318
+
2319
+ /**
2320
+ * Registers an Overlay or an array of Overlays with the manager. Upon registration, the Overlay receives functions for focus and blur, along with CustomEvents for each.
2321
+ * @method register
2322
+ * @param {YAHOO.widget.Overlay} overlay An Overlay to register with the manager.
2323
+ * @param {YAHOO.widget.Overlay[]} overlay An array of Overlays to register with the manager.
2324
+ * @return {Boolean} True if any Overlays are registered.
2325
+ */
2326
+ register : function(overlay) {
2327
+ if (overlay instanceof YAHOO.widget.Overlay) {
2328
+ overlay.cfg.addProperty("manager", { value:this } );
2329
+
2330
+ overlay.focusEvent = new YAHOO.util.CustomEvent("focus");
2331
+ overlay.blurEvent = new YAHOO.util.CustomEvent("blur");
2332
+
2333
+ var mgr=this;
2334
+
2335
+ overlay.focus = function() {
2336
+ mgr.focus(this);
2337
+ this.focusEvent.fire();
2338
+ };
2339
+
2340
+ overlay.blur = function() {
2341
+ mgr.blurAll();
2342
+ this.blurEvent.fire();
2343
+ };
2344
+
2345
+ var focusOnDomEvent = function(e,obj) {
2346
+ overlay.focus();
2347
+ };
2348
+
2349
+ var focusevent = this.cfg.getProperty("focusevent");
2350
+ YAHOO.util.Event.addListener(overlay.element,focusevent,focusOnDomEvent,this,true);
2351
+
2352
+ var zIndex = YAHOO.util.Dom.getStyle(overlay.element, "zIndex");
2353
+ if (! isNaN(zIndex)) {
2354
+ overlay.cfg.setProperty("zIndex", parseInt(zIndex, 10));
2355
+ } else {
2356
+ overlay.cfg.setProperty("zIndex", 0);
2357
+ }
2358
+
2359
+ this.overlays.push(overlay);
2360
+ return true;
2361
+ } else if (overlay instanceof Array) {
2362
+ var regcount = 0;
2363
+ for (var i=0;i<overlay.length;i++) {
2364
+ if (this.register(overlay[i])) {
2365
+ regcount++;
2366
+ }
2367
+ }
2368
+ if (regcount > 0) {
2369
+ return true;
2370
+ }
2371
+ } else {
2372
+ return false;
2373
+ }
2374
+ },
2375
+
2376
+ /**
2377
+ * Attempts to locate an Overlay by instance or ID.
2378
+ * @method find
2379
+ * @param {YAHOO.widget.Overlay} overlay An Overlay to locate within the manager
2380
+ * @param {String} overlay An Overlay id to locate within the manager
2381
+ * @return {YAHOO.widget.Overlay} The requested Overlay, if found, or null if it cannot be located.
2382
+ */
2383
+ find : function(overlay) {
2384
+ if (overlay instanceof YAHOO.widget.Overlay) {
2385
+ for (var o=0;o<this.overlays.length;o++) {
2386
+ if (this.overlays[o] == overlay) {
2387
+ return this.overlays[o];
2388
+ }
2389
+ }
2390
+ } else if (typeof overlay == "string") {
2391
+ for (var p=0;p<this.overlays.length;p++) {
2392
+ if (this.overlays[p].id == overlay) {
2393
+ return this.overlays[p];
2394
+ }
2395
+ }
2396
+ }
2397
+ return null;
2398
+ },
2399
+
2400
+ /**
2401
+ * Used for sorting the manager's Overlays by z-index.
2402
+ * @method compareZIndexDesc
2403
+ * @private
2404
+ * @return {Number} 0, 1, or -1, depending on where the Overlay should fall in the stacking order.
2405
+ */
2406
+ compareZIndexDesc : function(o1, o2) {
2407
+ var zIndex1 = o1.cfg.getProperty("zIndex");
2408
+ var zIndex2 = o2.cfg.getProperty("zIndex");
2409
+
2410
+ if (zIndex1 > zIndex2) {
2411
+ return -1;
2412
+ } else if (zIndex1 < zIndex2) {
2413
+ return 1;
2414
+ } else {
2415
+ return 0;
2416
+ }
2417
+ },
2418
+
2419
+ /**
2420
+ * Shows all Overlays in the manager.
2421
+ * @method showAll
2422
+ */
2423
+ showAll : function() {
2424
+ for (var o=0;o<this.overlays.length;o++) {
2425
+ this.overlays[o].show();
2426
+ }
2427
+ },
2428
+
2429
+ /**
2430
+ * Hides all Overlays in the manager.
2431
+ * @method hideAll
2432
+ */
2433
+ hideAll : function() {
2434
+ for (var o=0;o<this.overlays.length;o++) {
2435
+ this.overlays[o].hide();
2436
+ }
2437
+ },
2438
+
2439
+
2440
+ /**
2441
+ * Returns a string representation of the object.
2442
+ * @method toString
2443
+ * @return {String} The string representation of the OverlayManager
2444
+ */
2445
+ toString : function() {
2446
+ return "OverlayManager";
2447
+ }
2448
+
2449
+ };
2450
+
2451
+ /**
2452
+ * KeyListener is a utility that provides an easy interface for listening for keydown/keyup events fired against DOM elements.
2453
+ * @namespace YAHOO.util
2454
+ * @class KeyListener
2455
+ * @constructor
2456
+ * @param {HTMLElement} attachTo The element or element ID to which the key event should be attached
2457
+ * @param {String} attachTo The element or element ID to which the key event should be attached
2458
+ * @param {Object} keyData The object literal representing the key(s) to detect. Possible attributes are shift(boolean), alt(boolean), ctrl(boolean) and keys(either an int or an array of ints representing keycodes).
2459
+ * @param {Function} handler The CustomEvent handler to fire when the key event is detected
2460
+ * @param {Object} handler An object literal representing the handler.
2461
+ * @param {String} event Optional. The event (keydown or keyup) to listen for. Defaults automatically to keydown.
2462
+ */
2463
+ YAHOO.util.KeyListener = function(attachTo, keyData, handler, event) {
2464
+ if (! event) {
2465
+ event = YAHOO.util.KeyListener.KEYDOWN;
2466
+ }
2467
+
2468
+ /**
2469
+ * The CustomEvent fired internally when a key is pressed
2470
+ * @event keyEvent
2471
+ * @private
2472
+ * @param {Object} keyData The object literal representing the key(s) to detect. Possible attributes are shift(boolean), alt(boolean), ctrl(boolean) and keys(either an int or an array of ints representing keycodes).
2473
+ */
2474
+ var keyEvent = new YAHOO.util.CustomEvent("keyPressed");
2475
+
2476
+ /**
2477
+ * The CustomEvent fired when the KeyListener is enabled via the enable() function
2478
+ * @event enabledEvent
2479
+ * @param {Object} keyData The object literal representing the key(s) to detect. Possible attributes are shift(boolean), alt(boolean), ctrl(boolean) and keys(either an int or an array of ints representing keycodes).
2480
+ */
2481
+ this.enabledEvent = new YAHOO.util.CustomEvent("enabled");
2482
+
2483
+ /**
2484
+ * The CustomEvent fired when the KeyListener is disabled via the disable() function
2485
+ * @event disabledEvent
2486
+ * @param {Object} keyData The object literal representing the key(s) to detect. Possible attributes are shift(boolean), alt(boolean), ctrl(boolean) and keys(either an int or an array of ints representing keycodes).
2487
+ */
2488
+ this.disabledEvent = new YAHOO.util.CustomEvent("disabled");
2489
+
2490
+ if (typeof attachTo == 'string') {
2491
+ attachTo = document.getElementById(attachTo);
2492
+ }
2493
+
2494
+ if (typeof handler == 'function') {
2495
+ keyEvent.subscribe(handler);
2496
+ } else {
2497
+ keyEvent.subscribe(handler.fn, handler.scope, handler.correctScope);
2498
+ }
2499
+
2500
+ /**
2501
+ * Handles the key event when a key is pressed.
2502
+ * @method handleKeyPress
2503
+ * @param {DOMEvent} e The keypress DOM event
2504
+ * @param {Object} obj The DOM event scope object
2505
+ * @private
2506
+ */
2507
+ function handleKeyPress(e, obj) {
2508
+ if (! keyData.shift) {
2509
+ keyData.shift = false;
2510
+ }
2511
+ if (! keyData.alt) {
2512
+ keyData.alt = false;
2513
+ }
2514
+ if (! keyData.ctrl) {
2515
+ keyData.ctrl = false;
2516
+ }
2517
+
2518
+ // check held down modifying keys first
2519
+ if (e.shiftKey == keyData.shift &&
2520
+ e.altKey == keyData.alt &&
2521
+ e.ctrlKey == keyData.ctrl) { // if we pass this, all modifiers match
2522
+
2523
+ var dataItem;
2524
+ var keyPressed;
2525
+
2526
+ if (keyData.keys instanceof Array) {
2527
+ for (var i=0;i<keyData.keys.length;i++) {
2528
+ dataItem = keyData.keys[i];
2529
+
2530
+ if (dataItem == e.charCode ) {
2531
+ keyEvent.fire(e.charCode, e);
2532
+ break;
2533
+ } else if (dataItem == e.keyCode) {
2534
+ keyEvent.fire(e.keyCode, e);
2535
+ break;
2536
+ }
2537
+ }
2538
+ } else {
2539
+ dataItem = keyData.keys;
2540
+
2541
+ if (dataItem == e.charCode ) {
2542
+ keyEvent.fire(e.charCode, e);
2543
+ } else if (dataItem == e.keyCode) {
2544
+ keyEvent.fire(e.keyCode, e);
2545
+ }
2546
+ }
2547
+ }
2548
+ }
2549
+
2550
+ /**
2551
+ * Enables the KeyListener by attaching the DOM event listeners to the target DOM element
2552
+ * @method enable
2553
+ */
2554
+ this.enable = function() {
2555
+ if (! this.enabled) {
2556
+ YAHOO.util.Event.addListener(attachTo, event, handleKeyPress);
2557
+ this.enabledEvent.fire(keyData);
2558
+ }
2559
+ /**
2560
+ * Boolean indicating the enabled/disabled state of the Tooltip
2561
+ * @property enabled
2562
+ * @type Boolean
2563
+ */
2564
+ this.enabled = true;
2565
+ };
2566
+
2567
+ /**
2568
+ * Disables the KeyListener by removing the DOM event listeners from the target DOM element
2569
+ * @method disable
2570
+ */
2571
+ this.disable = function() {
2572
+ if (this.enabled) {
2573
+ YAHOO.util.Event.removeListener(attachTo, event, handleKeyPress);
2574
+ this.disabledEvent.fire(keyData);
2575
+ }
2576
+ this.enabled = false;
2577
+ };
2578
+
2579
+ /**
2580
+ * Returns a String representation of the object.
2581
+ * @method toString
2582
+ * @return {String} The string representation of the KeyListener
2583
+ */
2584
+ this.toString = function() {
2585
+ return "KeyListener [" + keyData.keys + "] " + attachTo.tagName + (attachTo.id ? "[" + attachTo.id + "]" : "");
2586
+ };
2587
+
2588
+ };
2589
+
2590
+ /**
2591
+ * Constant representing the DOM "keydown" event.
2592
+ * @property YAHOO.util.KeyListener.KEYDOWN
2593
+ * @static
2594
+ * @final
2595
+ * @type String
2596
+ */
2597
+ YAHOO.util.KeyListener.KEYDOWN = "keydown";
2598
+
2599
+ /**
2600
+ * Constant representing the DOM "keyup" event.
2601
+ * @property YAHOO.util.KeyListener.KEYUP
2602
+ * @static
2603
+ * @final
2604
+ * @type String
2605
+ */
2606
+ YAHOO.util.KeyListener.KEYUP = "keyup";
2607
+
2608
+ /**
2609
+ * ContainerEffect encapsulates animation transitions that are executed when an Overlay is shown or hidden.
2610
+ * @namespace YAHOO.widget
2611
+ * @class ContainerEffect
2612
+ * @constructor
2613
+ * @param {YAHOO.widget.Overlay} overlay The Overlay that the animation should be associated with
2614
+ * @param {Object} attrIn The object literal representing the animation arguments to be used for the animate-in transition. The arguments for this literal are: attributes(object, see YAHOO.util.Anim for description), duration(Number), and method(i.e. YAHOO.util.Easing.easeIn).
2615
+ * @param {Object} attrOut The object literal representing the animation arguments to be used for the animate-out transition. The arguments for this literal are: attributes(object, see YAHOO.util.Anim for description), duration(Number), and method(i.e. YAHOO.util.Easing.easeIn).
2616
+ * @param {HTMLElement} targetElement Optional. The target element that should be animated during the transition. Defaults to overlay.element.
2617
+ * @param {class} Optional. The animation class to instantiate. Defaults to YAHOO.util.Anim. Other options include YAHOO.util.Motion.
2618
+ */
2619
+ YAHOO.widget.ContainerEffect = function(overlay, attrIn, attrOut, targetElement, animClass) {
2620
+ if (! animClass) {
2621
+ animClass = YAHOO.util.Anim;
2622
+ }
2623
+
2624
+ /**
2625
+ * The overlay to animate
2626
+ * @property overlay
2627
+ * @type YAHOO.widget.Overlay
2628
+ */
2629
+ this.overlay = overlay;
2630
+ /**
2631
+ * The animation attributes to use when transitioning into view
2632
+ * @property attrIn
2633
+ * @type Object
2634
+ */
2635
+ this.attrIn = attrIn;
2636
+ /**
2637
+ * The animation attributes to use when transitioning out of view
2638
+ * @property attrOut
2639
+ * @type Object
2640
+ */
2641
+ this.attrOut = attrOut;
2642
+ /**
2643
+ * The target element to be animated
2644
+ * @property targetElement
2645
+ * @type HTMLElement
2646
+ */
2647
+ this.targetElement = targetElement || overlay.element;
2648
+ /**
2649
+ * The animation class to use for animating the overlay
2650
+ * @property animClass
2651
+ * @type class
2652
+ */
2653
+ this.animClass = animClass;
2654
+ };
2655
+
2656
+ /**
2657
+ * Initializes the animation classes and events.
2658
+ * @method init
2659
+ */
2660
+ YAHOO.widget.ContainerEffect.prototype.init = function() {
2661
+ this.beforeAnimateInEvent = new YAHOO.util.CustomEvent("beforeAnimateIn");
2662
+ this.beforeAnimateOutEvent = new YAHOO.util.CustomEvent("beforeAnimateOut");
2663
+
2664
+ this.animateInCompleteEvent = new YAHOO.util.CustomEvent("animateInComplete");
2665
+ this.animateOutCompleteEvent = new YAHOO.util.CustomEvent("animateOutComplete");
2666
+
2667
+ this.animIn = new this.animClass(this.targetElement, this.attrIn.attributes, this.attrIn.duration, this.attrIn.method);
2668
+ this.animIn.onStart.subscribe(this.handleStartAnimateIn, this);
2669
+ this.animIn.onTween.subscribe(this.handleTweenAnimateIn, this);
2670
+ this.animIn.onComplete.subscribe(this.handleCompleteAnimateIn, this);
2671
+
2672
+ this.animOut = new this.animClass(this.targetElement, this.attrOut.attributes, this.attrOut.duration, this.attrOut.method);
2673
+ this.animOut.onStart.subscribe(this.handleStartAnimateOut, this);
2674
+ this.animOut.onTween.subscribe(this.handleTweenAnimateOut, this);
2675
+ this.animOut.onComplete.subscribe(this.handleCompleteAnimateOut, this);
2676
+ };
2677
+
2678
+ /**
2679
+ * Triggers the in-animation.
2680
+ * @method animateIn
2681
+ */
2682
+ YAHOO.widget.ContainerEffect.prototype.animateIn = function() {
2683
+ this.beforeAnimateInEvent.fire();
2684
+ this.animIn.animate();
2685
+ };
2686
+
2687
+ /**
2688
+ * Triggers the out-animation.
2689
+ * @method animateOut
2690
+ */
2691
+ YAHOO.widget.ContainerEffect.prototype.animateOut = function() {
2692
+ this.beforeAnimateOutEvent.fire();
2693
+ this.animOut.animate();
2694
+ };
2695
+
2696
+ /**
2697
+ * The default onStart handler for the in-animation.
2698
+ * @method handleStartAnimateIn
2699
+ * @param {String} type The CustomEvent type
2700
+ * @param {Object[]} args The CustomEvent arguments
2701
+ * @param {Object} obj The scope object
2702
+ */
2703
+ YAHOO.widget.ContainerEffect.prototype.handleStartAnimateIn = function(type, args, obj) { };
2704
+ /**
2705
+ * The default onTween handler for the in-animation.
2706
+ * @method handleTweenAnimateIn
2707
+ * @param {String} type The CustomEvent type
2708
+ * @param {Object[]} args The CustomEvent arguments
2709
+ * @param {Object} obj The scope object
2710
+ */
2711
+ YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateIn = function(type, args, obj) { };
2712
+ /**
2713
+ * The default onComplete handler for the in-animation.
2714
+ * @method handleCompleteAnimateIn
2715
+ * @param {String} type The CustomEvent type
2716
+ * @param {Object[]} args The CustomEvent arguments
2717
+ * @param {Object} obj The scope object
2718
+ */
2719
+ YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateIn = function(type, args, obj) { };
2720
+
2721
+ /**
2722
+ * The default onStart handler for the out-animation.
2723
+ * @method handleStartAnimateOut
2724
+ * @param {String} type The CustomEvent type
2725
+ * @param {Object[]} args The CustomEvent arguments
2726
+ * @param {Object} obj The scope object
2727
+ */
2728
+ YAHOO.widget.ContainerEffect.prototype.handleStartAnimateOut = function(type, args, obj) { };
2729
+ /**
2730
+ * The default onTween handler for the out-animation.
2731
+ * @method handleTweenAnimateOut
2732
+ * @param {String} type The CustomEvent type
2733
+ * @param {Object[]} args The CustomEvent arguments
2734
+ * @param {Object} obj The scope object
2735
+ */
2736
+ YAHOO.widget.ContainerEffect.prototype.handleTweenAnimateOut = function(type, args, obj) { };
2737
+ /**
2738
+ * The default onComplete handler for the out-animation.
2739
+ * @method handleCompleteAnimateOut
2740
+ * @param {String} type The CustomEvent type
2741
+ * @param {Object[]} args The CustomEvent arguments
2742
+ * @param {Object} obj The scope object
2743
+ */
2744
+ YAHOO.widget.ContainerEffect.prototype.handleCompleteAnimateOut = function(type, args, obj) { };
2745
+
2746
+ /**
2747
+ * Returns a string representation of the object.
2748
+ * @method toString
2749
+ * @return {String} The string representation of the ContainerEffect
2750
+ */
2751
+ YAHOO.widget.ContainerEffect.prototype.toString = function() {
2752
+ var output = "ContainerEffect";
2753
+ if (this.overlay) {
2754
+ output += " [" + this.overlay.toString() + "]";
2755
+ }
2756
+ return output;
2757
+ };
2758
+
2759
+ /**
2760
+ * A pre-configured ContainerEffect instance that can be used for fading an overlay in and out.
2761
+ * @method FADE
2762
+ * @static
2763
+ * @param {Overlay} overlay The Overlay object to animate
2764
+ * @param {Number} dur The duration of the animation
2765
+ * @return {ContainerEffect} The configured ContainerEffect object
2766
+ */
2767
+ YAHOO.widget.ContainerEffect.FADE = function(overlay, dur) {
2768
+ var fade = new YAHOO.widget.ContainerEffect(overlay, { attributes:{opacity: {from:0, to:1}}, duration:dur, method:YAHOO.util.Easing.easeIn }, { attributes:{opacity: {to:0}}, duration:dur, method:YAHOO.util.Easing.easeOut}, overlay.element );
2769
+
2770
+ fade.handleStartAnimateIn = function(type,args,obj) {
2771
+ YAHOO.util.Dom.addClass(obj.overlay.element, "hide-select");
2772
+
2773
+ if (! obj.overlay.underlay) {
2774
+ obj.overlay.cfg.refireEvent("underlay");
2775
+ }
2776
+
2777
+ if (obj.overlay.underlay) {
2778
+ obj.initialUnderlayOpacity = YAHOO.util.Dom.getStyle(obj.overlay.underlay, "opacity");
2779
+ obj.overlay.underlay.style.filter = null;
2780
+ }
2781
+
2782
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "visible");
2783
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "opacity", 0);
2784
+ };
2785
+
2786
+ fade.handleCompleteAnimateIn = function(type,args,obj) {
2787
+ YAHOO.util.Dom.removeClass(obj.overlay.element, "hide-select");
2788
+
2789
+ if (obj.overlay.element.style.filter) {
2790
+ obj.overlay.element.style.filter = null;
2791
+ }
2792
+
2793
+ if (obj.overlay.underlay) {
2794
+ YAHOO.util.Dom.setStyle(obj.overlay.underlay, "opacity", obj.initialUnderlayOpacity);
2795
+ }
2796
+
2797
+ obj.overlay.cfg.refireEvent("iframe");
2798
+ obj.animateInCompleteEvent.fire();
2799
+ };
2800
+
2801
+ fade.handleStartAnimateOut = function(type, args, obj) {
2802
+ YAHOO.util.Dom.addClass(obj.overlay.element, "hide-select");
2803
+
2804
+ if (obj.overlay.underlay) {
2805
+ obj.overlay.underlay.style.filter = null;
2806
+ }
2807
+ };
2808
+
2809
+ fade.handleCompleteAnimateOut = function(type, args, obj) {
2810
+ YAHOO.util.Dom.removeClass(obj.overlay.element, "hide-select");
2811
+ if (obj.overlay.element.style.filter) {
2812
+ obj.overlay.element.style.filter = null;
2813
+ }
2814
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "hidden");
2815
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "opacity", 1);
2816
+
2817
+ obj.overlay.cfg.refireEvent("iframe");
2818
+
2819
+ obj.animateOutCompleteEvent.fire();
2820
+ };
2821
+
2822
+ fade.init();
2823
+ return fade;
2824
+ };
2825
+
2826
+
2827
+ /**
2828
+ * A pre-configured ContainerEffect instance that can be used for sliding an overlay in and out.
2829
+ * @method SLIDE
2830
+ * @static
2831
+ * @param {Overlay} overlay The Overlay object to animate
2832
+ * @param {Number} dur The duration of the animation
2833
+ * @return {ContainerEffect} The configured ContainerEffect object
2834
+ */
2835
+ YAHOO.widget.ContainerEffect.SLIDE = function(overlay, dur) {
2836
+ var x = overlay.cfg.getProperty("x") || YAHOO.util.Dom.getX(overlay.element);
2837
+ var y = overlay.cfg.getProperty("y") || YAHOO.util.Dom.getY(overlay.element);
2838
+
2839
+ var clientWidth = YAHOO.util.Dom.getClientWidth();
2840
+ var offsetWidth = overlay.element.offsetWidth;
2841
+
2842
+ var slide = new YAHOO.widget.ContainerEffect(overlay, {
2843
+ attributes:{ points: { to:[x, y] } },
2844
+ duration:dur,
2845
+ method:YAHOO.util.Easing.easeIn
2846
+ },
2847
+ {
2848
+ attributes:{ points: { to:[(clientWidth+25), y] } },
2849
+ duration:dur,
2850
+ method:YAHOO.util.Easing.easeOut
2851
+ },
2852
+ overlay.element,
2853
+ YAHOO.util.Motion);
2854
+
2855
+
2856
+ slide.handleStartAnimateIn = function(type,args,obj) {
2857
+ obj.overlay.element.style.left = (-25-offsetWidth) + "px";
2858
+ obj.overlay.element.style.top = y + "px";
2859
+ };
2860
+
2861
+ slide.handleTweenAnimateIn = function(type, args, obj) {
2862
+
2863
+
2864
+ var pos = YAHOO.util.Dom.getXY(obj.overlay.element);
2865
+
2866
+ var currentX = pos[0];
2867
+ var currentY = pos[1];
2868
+
2869
+ if (YAHOO.util.Dom.getStyle(obj.overlay.element, "visibility") == "hidden" && currentX < x) {
2870
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "visible");
2871
+ }
2872
+
2873
+ obj.overlay.cfg.setProperty("xy", [currentX,currentY], true);
2874
+ obj.overlay.cfg.refireEvent("iframe");
2875
+ };
2876
+
2877
+ slide.handleCompleteAnimateIn = function(type, args, obj) {
2878
+ obj.overlay.cfg.setProperty("xy", [x,y], true);
2879
+ obj.startX = x;
2880
+ obj.startY = y;
2881
+ obj.overlay.cfg.refireEvent("iframe");
2882
+ obj.animateInCompleteEvent.fire();
2883
+ };
2884
+
2885
+ slide.handleStartAnimateOut = function(type, args, obj) {
2886
+ var vw = YAHOO.util.Dom.getViewportWidth();
2887
+
2888
+ var pos = YAHOO.util.Dom.getXY(obj.overlay.element);
2889
+
2890
+ var yso = pos[1];
2891
+
2892
+ var currentTo = obj.animOut.attributes.points.to;
2893
+ obj.animOut.attributes.points.to = [(vw+25), yso];
2894
+ };
2895
+
2896
+ slide.handleTweenAnimateOut = function(type, args, obj) {
2897
+ var pos = YAHOO.util.Dom.getXY(obj.overlay.element);
2898
+
2899
+ var xto = pos[0];
2900
+ var yto = pos[1];
2901
+
2902
+ obj.overlay.cfg.setProperty("xy", [xto,yto], true);
2903
+ obj.overlay.cfg.refireEvent("iframe");
2904
+ };
2905
+
2906
+ slide.handleCompleteAnimateOut = function(type, args, obj) {
2907
+ YAHOO.util.Dom.setStyle(obj.overlay.element, "visibility", "hidden");
2908
+
2909
+ obj.overlay.cfg.setProperty("xy", [x,y]);
2910
+ obj.animateOutCompleteEvent.fire();
2911
+ };
2912
+
2913
+ slide.init();
2914
+ return slide;
2915
+ };