/loggerhead/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/loggerhead/trunk

« back to all changes in this revision

Viewing changes to loggerhead/static/javascript/yui/build/yui-base/yui-base.js

  • Committer: Matt Nordhoff
  • Date: 2010-02-26 04:37:13 UTC
  • mfrom: (400 trunk)
  • mto: This revision was merged to the branch mainline in revision 401.
  • Revision ID: mnordhoff@mattnordhoff.com-20100226043713-7mw3r6dr9qowutmi
Merge trunk for NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
 
3
Code licensed under the BSD License:
 
4
http://developer.yahoo.net/yui/license.txt
 
5
version: 3.0.0pr2
 
6
*/
 
7
/**
 
8
 * YUI core
 
9
 * @module yui
 
10
 */
 
11
(function() {
 
12
 
 
13
    var _instances = {},
 
14
 
 
15
// @TODO: this needs to be created at build time from module metadata
 
16
 
 
17
        _APPLY_TO_WHITE_LIST = {
 
18
            'io.xdrReady': 1,
 
19
            'io.start': 1,
 
20
            'io.success': 1,
 
21
            'io.failure': 1,
 
22
            'io.abort': 1
 
23
        };
 
24
        
 
25
 
 
26
if (typeof YUI === 'undefined' || !YUI) {
 
27
 
 
28
    /**
 
29
     * The YUI global namespace object.  If YUI is already defined, the
 
30
     * existing YUI object will not be overwritten so that defined
 
31
     * namespaces are preserved.  
 
32
     *
 
33
     * @class YUI
 
34
     * @constructor
 
35
     * @global
 
36
     * @uses Event.Target
 
37
     * @param o Optional configuration object.  Options:
 
38
     * <ul>
 
39
     *  <li>------------------------------------------------------------------------</li>
 
40
     *  <li>Global:</li>
 
41
     *  <li>------------------------------------------------------------------------</li>
 
42
     *  <li>debug:
 
43
     *  Turn debug statements on or off</li>
 
44
     *  <li>useBrowserConsole:
 
45
     *  Log to the browser console if debug is on and the console is available</li>
 
46
     *  <li>logInclude:
 
47
     *  A hash of log sources that should be logged.  If specified, only log messages from these sources will be logged.
 
48
     *  
 
49
     *  </li>
 
50
     *  <li>logExclude:
 
51
     *  A hash of log sources that should be not be logged.  If specified, all sources are logged if not on this list.</li>
 
52
     *  <li>throwFail:
 
53
     *  If throwFail is set, Y.fail will generate or re-throw a JS error.  Otherwise the failure is logged.
 
54
     *  <li>win:
 
55
     *  The target window/frame</li>
 
56
     *  <li>core:
 
57
     *  A list of modules that defines the YUI core (overrides the default)</li>
 
58
     *  <li>------------------------------------------------------------------------</li>
 
59
     *  <li>For event and get:</li>
 
60
     *  <li>------------------------------------------------------------------------</li>
 
61
     *  <li>pollInterval:
 
62
     *  The default poll interval</li>
 
63
     *  <li>-------------------------------------------------------------------------</li>
 
64
     *  <li>For loader:</li>
 
65
     *  <li>-------------------------------------------------------------------------</li>
 
66
     *  <li>base:
 
67
     *  The base dir</li>
 
68
     *  <li>secureBase:
 
69
     *  The secure base dir (not implemented)</li>
 
70
     *  <li>comboBase:
 
71
     *  The YUI combo service base dir. Ex: http://yui.yahooapis.com/combo?</li>
 
72
     *  <li>root:
 
73
     *  The root path to prepend to module names for the combo service. Ex: 2.5.2/build/</li>
 
74
     *  <li>filter:
 
75
     *  
 
76
     * A filter to apply to result urls.  This filter will modify the default
 
77
     * path for all modules.  The default path for the YUI library is the
 
78
     * minified version of the files (e.g., event-min.js).  The filter property
 
79
     * can be a predefined filter or a custom filter.  The valid predefined 
 
80
     * filters are:
 
81
     * <dl>
 
82
     *  <dt>DEBUG</dt>
 
83
     *  <dd>Selects the debug versions of the library (e.g., event-debug.js).
 
84
     *      This option will automatically include the logger widget</dd>
 
85
     *  <dt>RAW</dt>
 
86
     *  <dd>Selects the non-minified version of the library (e.g., event.js).</dd>
 
87
     * </dl>
 
88
     * You can also define a custom filter, which must be an object literal 
 
89
     * containing a search expression and a replace string:
 
90
     * <pre>
 
91
     *  myFilter: &#123; 
 
92
     *      'searchExp': "-min\\.js", 
 
93
     *      'replaceStr': "-debug.js"
 
94
     *  &#125;
 
95
     * </pre>
 
96
     *
 
97
     *  </li>
 
98
     *  <li>combine:
 
99
     *  Use the YUI combo service to reduce the number of http connections required to load your dependencies</li>
 
100
     *  <li>ignore:
 
101
     *  A list of modules that should never be dynamically loaded</li>
 
102
     *  <li>force:
 
103
     *  A list of modules that should always be loaded when required, even if already present on the page</li>
 
104
     *  <li>insertBefore:
 
105
     *  Node or id for a node that should be used as the insertion point for new nodes</li>
 
106
     *  <li>charset:
 
107
     *  charset for dynamic nodes</li>
 
108
     *  <li>timeout:
 
109
     *  number of milliseconds before a timeout occurs when dynamically loading nodes.  in not set, there is no timeout</li>
 
110
     *  <li>context:
 
111
     *  execution context for all callbacks</li>
 
112
     *  <li>onSuccess:
 
113
     *  callback for the 'success' event</li>
 
114
     *  <li>onFailure:
 
115
     *  callback for the 'failure' event</li>
 
116
     *  <li>onTimeout:
 
117
     *  callback for the 'timeout' event</li>
 
118
     *  <li>onProgress:
 
119
     *  callback executed each time a script or css file is loaded</li>
 
120
     *  <li>modules:
 
121
     *  A list of module definitions.  See Loader.addModule for the supported module metadata</li>
 
122
     * </ul>
 
123
     */
 
124
 
 
125
    /*global YUI*/
 
126
    YUI = function(o) {
 
127
        var Y = this;
 
128
 
 
129
        // Allow instantiation without the new operator
 
130
        if (!(Y instanceof YUI)) {
 
131
            return new YUI(o);
 
132
        } else {
 
133
            // set up the core environment
 
134
            Y._init(o);
 
135
 
 
136
            // bind the specified additional modules for this instance
 
137
            Y._setup();
 
138
 
 
139
            return Y;
 
140
        }
 
141
    };
 
142
}
 
143
 
 
144
// The prototype contains the functions that are required to allow the external
 
145
// modules to be registered and for the instance to be initialized.
 
146
YUI.prototype = {
 
147
 
 
148
    /**
 
149
     * Initialize this YUI instance
 
150
     * @param o config options
 
151
     * @private
 
152
     */
 
153
    _init: function(o) {
 
154
        
 
155
 
 
156
        o = o || {};
 
157
 
 
158
        // find targeted window and @TODO create facades
 
159
        var w = (o.win) ? (o.win.contentWindow) : o.win  || window;
 
160
        o.win = w;
 
161
        o.doc = w.document;
 
162
        o.debug = ('debug' in o) ? o.debug : true;
 
163
        o.useBrowserConsole = ('useBrowserConsole' in o) ? o.useBrowserConsole : true;
 
164
        o.throwFail = ('throwFail' in o) ? o.throwFail : true;
 
165
    
 
166
        // add a reference to o for anything that needs it
 
167
        // before _setup is called.
 
168
        this.config = o;
 
169
 
 
170
        this.Env = {
 
171
            // @todo expand the new module metadata
 
172
            mods: {},
 
173
            _idx: 0,
 
174
            _pre: 'yuid',
 
175
            _used: {},
 
176
            _attached: {},
 
177
            _yidx: 0,
 
178
            _uidx: 0
 
179
        };
 
180
 
 
181
        if (YUI.Env) {
 
182
            this.Env._yidx = ++YUI.Env._idx;
 
183
            this.id = this.stamp(this);
 
184
            _instances[this.id] = this;
 
185
        }
 
186
 
 
187
        this.constructor = YUI;
 
188
 
 
189
    },
 
190
    
 
191
    /**
 
192
     * Finishes the instance setup. Attaches whatever modules were defined
 
193
     * when the yui modules was registered.
 
194
     * @method _setup
 
195
     * @private
 
196
     */
 
197
    _setup: function(o) {
 
198
        this.use("yui");
 
199
        // @TODO eval the need to copy the config
 
200
        this.config = this.merge(this.config);
 
201
    },
 
202
 
 
203
    /**
 
204
     * Executes a method on a YUI instance with
 
205
     * the specified id if the specified method is whitelisted.
 
206
     * @method applyTo
 
207
     * @param id {string} the YUI instance id
 
208
     * @param method {string} the name of the method to exectute.
 
209
     * Ex: 'Object.keys'
 
210
     * @param args {Array} the arguments to apply to the method
 
211
     * @return {object} the return value from the applied method or null
 
212
     */
 
213
    applyTo: function(id, method, args) {
 
214
 
 
215
        if (!(method in _APPLY_TO_WHITE_LIST)) {
 
216
            this.fail(method + ': applyTo not allowed');
 
217
            return null;
 
218
        }
 
219
 
 
220
        var instance = _instances[id];
 
221
 
 
222
        if (instance) {
 
223
 
 
224
            var nest = method.split('.'), m = instance;
 
225
 
 
226
            for (var i=0; i<nest.length; i=i+1) {
 
227
 
 
228
                m = m[nest[i]];
 
229
 
 
230
                if (!m) {
 
231
                    this.fail('applyTo not found: ' + method);
 
232
                }
 
233
            }
 
234
 
 
235
            return m.apply(instance, args);
 
236
        }
 
237
 
 
238
        return null;
 
239
    }, 
 
240
 
 
241
    /**
 
242
     * Register a module
 
243
     * @method add
 
244
     * @param name {string} module name
 
245
     * @param fn {Function} entry point into the module that
 
246
     * is used to bind module to the YUI instance
 
247
     * @param version {string} version string
 
248
     * @return {YUI} the YUI instance
 
249
     *
 
250
     * requires   - features that should be present before loading
 
251
     * optional   - optional features that should be present if load optional defined
 
252
     * use  - features that should be attached automatically
 
253
     * skinnable  -
 
254
     * rollup
 
255
     * omit - features that should not be loaded if this module is present
 
256
     */
 
257
    add: function(name, fn, version, details) {
 
258
 
 
259
 
 
260
        // @todo expand this to include version mapping
 
261
        
 
262
        // @todo allow requires/supersedes
 
263
 
 
264
        // @todo may want to restore the build property
 
265
        
 
266
        // @todo fire moduleAvailable event
 
267
        
 
268
        var m = {
 
269
            name: name, 
 
270
            fn: fn,
 
271
            version: version,
 
272
            details: details || {}
 
273
        };
 
274
 
 
275
        YUI.Env.mods[name] = m;
 
276
 
 
277
        return this; // chain support
 
278
    },
 
279
 
 
280
    _attach: function(r, fromLoader) {
 
281
 
 
282
        var mods = YUI.Env.mods,
 
283
            attached = this.Env._attached;
 
284
 
 
285
        for (var i=0, l=r.length; i<l; i=i+1) {
 
286
            var name = r[i], m = mods[name], mm;
 
287
            if (!attached[name] && m) {
 
288
 
 
289
                attached[name] = true;
 
290
 
 
291
                var d = m.details, req = d.requires, use = d.use;
 
292
 
 
293
                if (req) {
 
294
                    this._attach(this.Array(req));
 
295
                }
 
296
 
 
297
 
 
298
                if (m.fn) {
 
299
                    m.fn(this);
 
300
                }
 
301
 
 
302
                if (use) {
 
303
                    this._attach(this.Array(use));
 
304
                }
 
305
            }
 
306
        }
 
307
 
 
308
    },
 
309
 
 
310
    /**
 
311
     * Bind a module to a YUI instance
 
312
     * @param modules* {string} 1-n modules to bind (uses arguments array)
 
313
     * @param *callback {function} callback function executed when 
 
314
     * the instance has the required functionality.  If included, it
 
315
     * must be the last parameter.
 
316
     *
 
317
     * @TODO 
 
318
     * Implement versioning?  loader can load different versions?
 
319
     * Should sub-modules/plugins be normal modules, or do
 
320
     * we add syntax for specifying these?
 
321
     *
 
322
     * YUI().use('dragdrop')
 
323
     * YUI().use('dragdrop:2.4.0'); // specific version
 
324
     * YUI().use('dragdrop:2.4.0-'); // at least this version
 
325
     * YUI().use('dragdrop:2.4.0-2.9999.9999'); // version range
 
326
     * YUI().use('*'); // use all available modules
 
327
     * YUI().use('lang+dump+substitute'); // use lang and some plugins
 
328
     * YUI().use('lang+*'); // use lang and all known plugins
 
329
     *
 
330
     *
 
331
     * @return {YUI} the YUI instance
 
332
     */
 
333
    use: function() {
 
334
 
 
335
        var Y = this, 
 
336
            a=Array.prototype.slice.call(arguments, 0), 
 
337
            mods = YUI.Env.mods, 
 
338
            used = Y.Env._used,
 
339
            loader, 
 
340
            firstArg = a[0], 
 
341
            dynamic = false,
 
342
            callback = a[a.length-1];
 
343
 
 
344
 
 
345
        // The last argument supplied to use can be a load complete callback
 
346
        if (typeof callback === 'function') {
 
347
            a.pop();
 
348
            Y.Env._callback = callback;
 
349
        } else {
 
350
            callback = null;
 
351
        }
 
352
 
 
353
        // YUI().use('*'); // bind everything available
 
354
        if (firstArg === "*") {
 
355
            a = [];
 
356
            for (var k in mods) {
 
357
                if (mods.hasOwnProperty(k)) {
 
358
                    a.push(k);
 
359
                }
 
360
            }
 
361
 
 
362
            return Y.use.apply(Y, a);
 
363
 
 
364
        }
 
365
       
 
366
 
 
367
        // use loader to expand dependencies and sort the 
 
368
        // requirements if it is available.
 
369
        if (Y.Loader) {
 
370
            dynamic = true;
 
371
            loader = new Y.Loader(Y.config);
 
372
            loader.require(a);
 
373
            loader.ignoreRegistered = true;
 
374
            loader.allowRollup = false;
 
375
            loader.calculate();
 
376
            a = loader.sorted;
 
377
        }
 
378
 
 
379
 
 
380
        var missing = [], r = [], f = function(name) {
 
381
 
 
382
            // only attach a module once
 
383
            if (used[name]) {
 
384
                return;
 
385
            }
 
386
 
 
387
            var m = mods[name], j, req, use;
 
388
 
 
389
            if (m) {
 
390
                used[name] = true;
 
391
 
 
392
                req = m.details.requires;
 
393
                use = m.details.use;
 
394
            } else {
 
395
                missing.push(name);
 
396
            }
 
397
 
 
398
            // make sure requirements are attached
 
399
            if (req) {
 
400
                if (Y.Lang.isString(req)) {
 
401
                    f(req);
 
402
                } else {
 
403
                    for (j = 0; j < req.length; j = j + 1) {
 
404
                        f(req[j]);
 
405
                    }
 
406
                }
 
407
            }
 
408
 
 
409
            // add this module to full list of things to attach
 
410
            r.push(name);
 
411
 
 
412
        };
 
413
 
 
414
        // process each requirement and any additional requirements 
 
415
        // the module metadata specifies
 
416
        for (var i=0, l=a.length; i<l; i=i+1) {
 
417
            f(a[i]);
 
418
        }
 
419
 
 
420
 
 
421
        var onComplete = function(fromLoader) {
 
422
 
 
423
 
 
424
            fromLoader = fromLoader || {
 
425
                success: true,
 
426
                msg: 'not dynamic'
 
427
            };
 
428
 
 
429
            if (Y.Env._callback) {
 
430
 
 
431
                var cb = Y.Env._callback;
 
432
                Y.Env._callback = null;
 
433
                cb(Y, fromLoader);
 
434
            }
 
435
 
 
436
            if (Y.fire) {
 
437
                Y.fire('yui:load', Y, fromLoader);
 
438
            }
 
439
        };
 
440
 
 
441
 
 
442
        // dynamic load
 
443
        if (Y.Loader && missing.length) {
 
444
            loader = new Y.Loader(Y.config);
 
445
            loader.onSuccess = onComplete;
 
446
            loader.onFailure = onComplete;
 
447
            loader.onTimeout = onComplete;
 
448
            loader.attaching = a;
 
449
            loader.require(missing);
 
450
            loader.insert();
 
451
        } else {
 
452
            Y._attach(r);
 
453
            onComplete();
 
454
        }
 
455
 
 
456
        return Y; // chain support var yui = YUI().use('dragdrop');
 
457
    },
 
458
 
 
459
 
 
460
    /**
 
461
     * Returns the namespace specified and creates it if it doesn't exist
 
462
     * <pre>
 
463
     * YUI.namespace("property.package");
 
464
     * YUI.namespace("YAHOO.property.package");
 
465
     * </pre>
 
466
     * Either of the above would create YAHOO.property, then
 
467
     * YUI.property.package
 
468
     *
 
469
     * Be careful when naming packages. Reserved words may work in some browsers
 
470
     * and not others. For instance, the following will fail in Safari:
 
471
     * <pre>
 
472
     * YUI.namespace("really.long.nested.namespace");
 
473
     * </pre>
 
474
     * This fails because "long" is a future reserved word in ECMAScript
 
475
     *
 
476
     * @method namespace
 
477
     * @param  {string*} arguments 1-n namespaces to create 
 
478
     * @return {object}  A reference to the last namespace object created
 
479
     */
 
480
    namespace: function() {
 
481
        var a=arguments, o=null, i, j, d;
 
482
        for (i=0; i<a.length; i=i+1) {
 
483
            d = a[i].split(".");
 
484
            o = this;
 
485
            for (j=(d[0] == "YAHOO") ? 1 : 0; j<d.length; j=j+1) {
 
486
                o[d[j]] = o[d[j]] || {};
 
487
                o = o[d[j]];
 
488
            }
 
489
        }
 
490
        return o;
 
491
    },
 
492
 
 
493
    // this is replaced if the log module is included
 
494
    log: function() {
 
495
 
 
496
    },
 
497
 
 
498
    /**
 
499
     * Report an error.  The reporting mechanism is controled by
 
500
     * the 'throwFail' configuration attribute.  If throwFail is
 
501
     * not specified, the message is written to the logger, otherwise
 
502
     * a JS error is thrown
 
503
     * @method fail
 
504
     * @param msg {string} the failure message
 
505
     * @param e {Error} Optional JS error that was caught.  If supplied
 
506
     * and throwFail is specified, this error will be re-thrown.
 
507
     * @return {YUI} this YUI instance
 
508
     */
 
509
    fail: function(msg, e) {
 
510
        if (this.config.throwFail) {
 
511
            throw (e || new Error(msg)); 
 
512
        } else {
 
513
            var instance = this;
 
514
            instance.log(msg, "error"); // don't scrub this one
 
515
        }
 
516
 
 
517
        return this;
 
518
    },
 
519
 
 
520
    /**
 
521
     * Generate an id that is unique among all YUI instances
 
522
     * @method guid
 
523
     * @param pre {string} optional guid prefix
 
524
     * @return {string} the guid
 
525
     */
 
526
    guid: function(pre) {
 
527
        var e = this.Env, p = (pre) || e._pre;
 
528
        return p +'-' + e._yidx + '-' + e._uidx++;
 
529
    },
 
530
 
 
531
    /**
 
532
     * Stamps an object with a guid.  If the object already
 
533
     * has one, a new one is not created
 
534
     * @method stamp
 
535
     * @param o The object to stamp
 
536
     * @return {string} The object's guid
 
537
     */
 
538
    stamp: function(o) {
 
539
 
 
540
        if (!o) {
 
541
            return o;
 
542
        }
 
543
 
 
544
        var uid = (typeof o === 'string') ? o : o._yuid;
 
545
 
 
546
        if (!uid) {
 
547
            uid = this.guid();
 
548
            o._yuid = uid;
 
549
        }
 
550
 
 
551
        return uid;
 
552
    }
 
553
};
 
554
 
 
555
// Give the YUI global the same properties as an instance.
 
556
// This makes it so that the YUI global can be used like the YAHOO
 
557
// global was used prior to 3.x.  More importantly, the YUI global
 
558
// provides global metadata, so env needs to be configured.
 
559
// @TODO review
 
560
 
 
561
    var Y = YUI, p = Y.prototype, i;
 
562
 
 
563
    // inheritance utilities are not available yet
 
564
    for (i in p) {
 
565
        if (true) {
 
566
            Y[i] = p[i];
 
567
        }
 
568
    }
 
569
 
 
570
    // set up the environment
 
571
    Y._init();
 
572
 
 
573
 
 
574
})();
 
575
/**
 
576
 * YUI stub
 
577
 * @module yui
 
578
 * @submodule yui-base
 
579
 */
 
580
// This is just a stub to for dependency processing
 
581
YUI.add("yui-base", null, "3.0.0pr2");
 
582
/*
 
583
 * YUI console logger
 
584
 * @module yui
 
585
 * @submodule log
 
586
 */
 
587
YUI.add("log", function(instance) {
 
588
 
 
589
    /**
 
590
     * If the 'debug' config is true, a 'yui:log' event will be
 
591
     * dispatched, which the logger widget and anything else
 
592
     * can consume.  If the 'useBrowserConsole' config is true, it will
 
593
     * write to the browser console if available.
 
594
     *
 
595
     * @method log
 
596
     * @for YUI
 
597
     * @param  {String}  msg  The message to log.
 
598
     * @param  {String}  cat  The log category for the message.  Default
 
599
     *                        categories are "info", "warn", "error", time".
 
600
     *                        Custom categories can be used as well. (opt)
 
601
     * @param  {String}  src  The source of the the message (opt)
 
602
     * @param  {boolean} silent If true, the log event won't fire
 
603
     * @return {YUI}      YUI instance
 
604
     */
 
605
    instance.log = function(msg, cat, src, silent) {
 
606
 
 
607
        var Y = instance, c = Y.config, es = Y.Env._eventstack,
 
608
            // bail = (es && es.logging);
 
609
            bail = false; 
 
610
 
 
611
        // suppress log message if the config is off or the event stack
 
612
        // or the event call stack contains a consumer of the yui:log event
 
613
        if (c.debug && !bail) {
 
614
 
 
615
            // apply source filters
 
616
            if (src) {
 
617
 
 
618
                var exc = c.logExclude, inc = c.logInclude;
 
619
 
 
620
                // console.log('checking src filter: ' + src + ', inc: ' + inc + ', exc: ' + exc);
 
621
 
 
622
                if (inc && !(src in inc)) {
 
623
                    // console.log('bail: inc list found, but src is not in list: ' + src);
 
624
                    bail = true;
 
625
                } else if (exc && (src in exc)) {
 
626
                    // console.log('bail: exc list found, and src is in it: ' + src);
 
627
                    bail = true;
 
628
                }
 
629
            }
 
630
 
 
631
            if (!bail) {
 
632
 
 
633
                if (c.useBrowserConsole) {
 
634
                    var m = (src) ? src + ': ' + msg : msg;
 
635
                    if (typeof console != 'undefined') {
 
636
                        var f = (cat && console[cat]) ? cat : 'log';
 
637
                        console[f](m);
 
638
                    } else if (typeof opera != 'undefined') {
 
639
                        opera.postError(m);
 
640
                    }
 
641
                }
 
642
 
 
643
                if (Y.fire && !bail && !silent) {
 
644
                    Y.fire('yui:log', msg, cat, src);
 
645
                }
 
646
            }
 
647
        }
 
648
 
 
649
        return Y;
 
650
    };
 
651
 
 
652
}, "3.0.0pr2");
 
653
/*
 
654
 * YUI lang utils
 
655
 * @module yui
 
656
 * @submodule lang
 
657
 */
 
658
YUI.add("lang", function(Y) {
 
659
 
 
660
    /**
 
661
     * Provides the language utilites and extensions used by the library
 
662
     * @class Lang
 
663
     * @static
 
664
     */
 
665
    Y.Lang = Y.Lang || {};
 
666
 
 
667
    var L = Y.Lang, 
 
668
 
 
669
    ARRAY_TOSTRING = '[object Array]',
 
670
    FUNCTION_TOSTRING = '[object Function]',
 
671
    STRING = 'string',
 
672
    OBJECT = 'object',
 
673
    BOOLEAN = 'boolean',
 
674
    UNDEFINED = 'undefined',
 
675
    OP = Object.prototype;
 
676
 
 
677
    /**
 
678
     * Determines whether or not the provided object is an array.
 
679
     * Testing typeof/instanceof/constructor of arrays across frame 
 
680
     * boundaries isn't possible in Safari unless you have a reference
 
681
     * to the other frame to test against its Array prototype.  To
 
682
     * handle this case, we test well-known array properties instead.
 
683
     * properties.
 
684
     * @TODO can we kill this cross frame hack?
 
685
     * @method isArray
 
686
     * @static
 
687
     * @param o The object to test
 
688
     * @return {boolean} true if o is an array
 
689
     */
 
690
    L.isArray = function(o) { 
 
691
        return OP.toString.apply(o) === ARRAY_TOSTRING;
 
692
    };
 
693
 
 
694
    /**
 
695
     * Determines whether or not the provided object is a boolean
 
696
     * @method isBoolean
 
697
     * @static
 
698
     * @param o The object to test
 
699
     * @return {boolean} true if o is a boolean
 
700
     */
 
701
    L.isBoolean = function(o) {
 
702
        return typeof o === BOOLEAN;
 
703
    };
 
704
    
 
705
    /**
 
706
     * Determines whether or not the provided object is a function
 
707
     * Note: Internet Explorer thinks certain functions are objects:
 
708
     *
 
709
     * var obj = document.createElement("object");
 
710
     * Y.Lang.isFunction(obj.getAttribute) // reports false in IE
 
711
     *
 
712
     * var input = document.createElement("input"); // append to body
 
713
     * Y.Lang.isFunction(input.focus) // reports false in IE
 
714
     *
 
715
     * You will have to implement additional tests if these functions
 
716
     * matter to you.
 
717
     *
 
718
     * @method isFunction
 
719
     * @static
 
720
     * @param o The object to test
 
721
     * @return {boolean} true if o is a function
 
722
     */
 
723
    L.isFunction = function(o) {
 
724
        return OP.toString.apply(o) === FUNCTION_TOSTRING;
 
725
    };
 
726
        
 
727
    /**
 
728
     * Determines whether or not the supplied object is a date instance
 
729
     * @method isDate
 
730
     * @static
 
731
     * @param o The object to test
 
732
     * @return {boolean} true if o is a date
 
733
     */
 
734
    L.isDate = function(o) {
 
735
        return o instanceof Date;
 
736
    };
 
737
 
 
738
    /**
 
739
     * Determines whether or not the provided object is null
 
740
     * @method isNull
 
741
     * @static
 
742
     * @param o The object to test
 
743
     * @return {boolean} true if o is null
 
744
     */
 
745
    L.isNull = function(o) {
 
746
        return o === null;
 
747
    };
 
748
        
 
749
    /**
 
750
     * Determines whether or not the provided object is a legal number
 
751
     * @method isNumber
 
752
     * @static
 
753
     * @param o The object to test
 
754
     * @return {boolean} true if o is a number
 
755
     */
 
756
    L.isNumber = function(o) {
 
757
        return typeof o === 'number' && isFinite(o);
 
758
    };
 
759
      
 
760
    /**
 
761
     * Determines whether or not the provided object is of type object
 
762
     * or function
 
763
     * @method isObject
 
764
     * @static
 
765
     * @param o The object to test
 
766
     * @param failfn {boolean} fail if the input is a function
 
767
     * @return {boolean} true if o is an object
 
768
     */  
 
769
    L.isObject = function(o, failfn) {
 
770
return (o && (typeof o === OBJECT || (!failfn && L.isFunction(o)))) || false;
 
771
    };
 
772
        
 
773
    /**
 
774
     * Determines whether or not the provided object is a string
 
775
     * @method isString
 
776
     * @static
 
777
     * @param o The object to test
 
778
     * @return {boolean} true if o is a string
 
779
     */
 
780
    L.isString = function(o) {
 
781
        return typeof o === STRING;
 
782
    };
 
783
        
 
784
    /**
 
785
     * Determines whether or not the provided object is undefined
 
786
     * @method isUndefined
 
787
     * @static
 
788
     * @param o The object to test
 
789
     * @return {boolean} true if o is undefined
 
790
     */
 
791
    L.isUndefined = function(o) {
 
792
        return typeof o === UNDEFINED;
 
793
    };
 
794
    
 
795
    /**
 
796
     * Returns a string without any leading or trailing whitespace.  If 
 
797
     * the input is not a string, the input will be returned untouched.
 
798
     * @method trim
 
799
     * @static
 
800
     * @param s {string} the string to trim
 
801
     * @return {string} the trimmed string
 
802
     */
 
803
    L.trim = function(s){
 
804
        try {
 
805
            return s.replace(/^\s+|\s+$/g, "");
 
806
        } catch(e) {
 
807
            return s;
 
808
        }
 
809
    };
 
810
 
 
811
    /**
 
812
     * A convenience method for detecting a legitimate non-null value.
 
813
     * Returns false for null/undefined/NaN, true for other values, 
 
814
     * including 0/false/''
 
815
     * @method isValue
 
816
     * @static
 
817
     * @param o The item to test
 
818
     * @return {boolean} true if it is not null/undefined/NaN || false
 
819
     */
 
820
    L.isValue = function(o) {
 
821
// return (o || o === false || o === 0 || o === ''); // Infinity fails
 
822
return (L.isObject(o) || L.isString(o) || L.isNumber(o) || L.isBoolean(o));
 
823
    };
 
824
 
 
825
}, "3.0.0pr2");
 
826
 
 
827
 
 
828
/*
 
829
 * Array utilities
 
830
 * @module yui
 
831
 * @submodule array
 
832
 */
 
833
 
 
834
/**
 
835
 * YUI core
 
836
 * @module yui
 
837
 */
 
838
 
 
839
YUI.add("array", function(Y) {
 
840
 
 
841
    var L = Y.Lang, Native = Array.prototype;
 
842
 
 
843
    /**
 
844
     * Adds the following array utilities to the YUI instance
 
845
     * @class YUI~array
 
846
     */
 
847
 
 
848
    /** 
 
849
     * Y.Array(o) returns an array:
 
850
     * - Arrays are return unmodified unless the start position is specified.
 
851
     * - "Array-like" collections (@see Array.test) are converted to arrays
 
852
     * - For everything else, a new array is created with the input as the sole item
 
853
     * - The start position is used if the input is or is like an array to return
 
854
     *   a subset of the collection.
 
855
     *
 
856
     *   @TODO this will not automatically convert elements that are also collections
 
857
     *   such as forms and selects.  Passing true as the third param will
 
858
     *   force a conversion.
 
859
     *
 
860
     * @method Array
 
861
     * @static
 
862
     *   @param o the item to arrayify
 
863
     *   @param i {int} if an array or array-like, this is the start index
 
864
     *   @param al {boolean} if true, it forces the array-like fork.  This
 
865
     *   can be used to avoid multiple array.test calls.
 
866
     *   @return {Array} the resulting array
 
867
     */
 
868
    Y.Array = function(o, i, al) {
 
869
        var t = (al) ? 2 : Y.Array.test(o);
 
870
 
 
871
        // switch (t) {
 
872
        //     case 1:
 
873
        //         // return (i) ? o.slice(i) : o;
 
874
        //     case 2:
 
875
        //         return Native.slice.call(o, i || 0);
 
876
        //     default:
 
877
        //         return [o];
 
878
        // }
 
879
 
 
880
        if (t) {
 
881
            return Native.slice.call(o, i || 0);
 
882
        } else {
 
883
            return [o];
 
884
        }
 
885
 
 
886
    };
 
887
 
 
888
    var A = Y.Array;
 
889
    
 
890
    /** 
 
891
     * Evaluates the input to determine if it is an array, array-like, or 
 
892
     * something else.  This is used to handle the arguments collection 
 
893
     * available within functions, and HTMLElement collections
 
894
     *
 
895
     * @method Array.test
 
896
     * @static
 
897
     *
 
898
     * @todo current implementation (intenionally) will not implicitly 
 
899
     * handle html elements that are array-like (forms, selects, etc).  
 
900
     *
 
901
     * @return {int} a number indicating the results:
 
902
     * 0: Not an array or an array-like collection
 
903
     * 1: A real array. 
 
904
     * 2: array-like collection.
 
905
     */
 
906
    A.test = function(o) {
 
907
        var r = 0;
 
908
        if (L.isObject(o, true)) {
 
909
            if (L.isArray(o)) {
 
910
                r = 1; 
 
911
            } else {
 
912
                try {
 
913
                    // indexed, but no tagName (element) or alert (window)
 
914
                    if ("length" in o && 
 
915
                        !("tagName" in o) && 
 
916
                        !("alert" in o) && 
 
917
                        (!Y.Lang.isFunction(o.size) || o.size() > 1)) {
 
918
                            r = 2;
 
919
                    }
 
920
                        
 
921
                } catch(ex) {}
 
922
            }
 
923
        }
 
924
        return r;
 
925
    };
 
926
 
 
927
    /**
 
928
     * Executes the supplied function on each item in the array.
 
929
     * @method Array.each
 
930
     * @param a {Array} the array to iterate
 
931
     * @param f {Function} the function to execute on each item
 
932
     * @param o Optional context object
 
933
     * @static
 
934
     * @return {YUI} the YUI instance
 
935
     */
 
936
    A.each = (Native.forEach) ?
 
937
        function (a, f, o) { 
 
938
            Native.forEach.call(a, f, o || Y);
 
939
            return Y;
 
940
        } :
 
941
        function (a, f, o) { 
 
942
            var l = a.length, i;
 
943
            for (i = 0; i < l; i=i+1) {
 
944
                f.call(o || Y, a[i], i, a);
 
945
            }
 
946
            return Y;
 
947
        };
 
948
 
 
949
    /**
 
950
     * Executes the supplied function on each item in the array.
 
951
     * Returning true from the processing function will stop the 
 
952
     * processing of the remaining
 
953
     * items.
 
954
     * @method Array.some
 
955
     * @param a {Array} the array to iterate
 
956
     * @param f {Function} the function to execute on each item
 
957
     * @param o Optional context object
 
958
     * @static
 
959
     * @return {boolean} true if the 
 
960
     */
 
961
     A.some = (Native.forEach) ?
 
962
        function (a, f, o) { 
 
963
            Native.some.call(a, f, o || Y);
 
964
            return Y;
 
965
        } :
 
966
        function (a, f, o) {
 
967
            var l = a.length;
 
968
            for (var i = 0; i < l; i=i+1) {
 
969
                if (f.call(o, a[i], i, a)) {
 
970
                    return true;
 
971
                }
 
972
            }
 
973
            return false;
 
974
        };
 
975
 
 
976
    /**
 
977
     * Returns an object using the first array as keys, and
 
978
     * the second as values.  If the second array is not
 
979
     * provided the value is set to true for each.
 
980
     * @method Array.hash
 
981
     * @static
 
982
     * @param k {Array} keyset
 
983
     * @param v {Array} optional valueset
 
984
     * @return {object} the hash
 
985
     */
 
986
    A.hash = function(k, v) {
 
987
        var o = {}, l = k.length, vl = v && v.length, i;
 
988
        for (i=0; i<l; i=i+1) {
 
989
            o[k[i]] = (vl && vl > i) ? v[i] : true;
 
990
        }
 
991
 
 
992
        return o;
 
993
    };
 
994
 
 
995
 
 
996
    /**
 
997
     * Returns the index of the first item in the array
 
998
     * that contains the specified value, -1 if the
 
999
     * value isn't found.
 
1000
     * @TODO use native method if avail
 
1001
     * @method Array.indexOf
 
1002
     * @static
 
1003
     * @param a {Array} the array to search
 
1004
     * @param val the value to search for
 
1005
     * @return {int} the index of the item that contains the value or -1
 
1006
     */
 
1007
    A.indexOf = function(a, val) {
 
1008
        for (var i=0; i<a.length; i=i+1) {
 
1009
            if (a[i] === val) {
 
1010
                return i;
 
1011
            }
 
1012
        }
 
1013
 
 
1014
        return -1;
 
1015
    };
 
1016
 
 
1017
}, "3.0.0pr2");
 
1018
/*
 
1019
 * YUI core utilities
 
1020
 * @module yui
 
1021
 * @submodule core
 
1022
 */
 
1023
// requires lang
 
1024
YUI.add("core", function(Y) {
 
1025
 
 
1026
    var L = Y.Lang, 
 
1027
    A = Y.Array,
 
1028
    OP = Object.prototype, 
 
1029
    IEF = ["toString", "valueOf"], 
 
1030
    PROTO = 'prototype',
 
1031
 
 
1032
    /**
 
1033
     * IE will not enumerate native functions in a derived object even if the
 
1034
     * function was overridden.  This is a workaround for specific functions 
 
1035
     * we care about on the Object prototype. 
 
1036
     * @property _iefix
 
1037
     * @param {Function} r  the object to receive the augmentation
 
1038
     * @param {Function} s  the object that supplies the properties to augment
 
1039
     * @param w a whitelist object (the keys are the valid items to reference)
 
1040
     * @private
 
1041
     * @for YUI
 
1042
     */
 
1043
    _iefix = (Y.UA && Y.UA.ie) ?
 
1044
        function(r, s, w) {
 
1045
            for (var i=0, a=IEF; i<a.length; i=i+1) {
 
1046
                var n = a[i], f = s[n];
 
1047
                if (L.isFunction(f) && f != OP[n]) {
 
1048
                    if (!w || (n in w)) {
 
1049
                        r[n]=f;
 
1050
                    }
 
1051
                }
 
1052
            }
 
1053
        } : function() {};
 
1054
   
 
1055
 
 
1056
    /**
 
1057
     * Returns a new object containing all of the properties of
 
1058
     * all the supplied objects.  The properties from later objects
 
1059
     * will overwrite those in earlier objects.  Passing in a
 
1060
     * single object will create a shallow copy of it.  For a deep
 
1061
     * copy, use clone.
 
1062
     * @method merge
 
1063
     * @param arguments {Object*} the objects to merge
 
1064
     * @return {object} the new merged object
 
1065
     */
 
1066
    Y.merge = function() {
 
1067
        // var o={}, a=arguments;
 
1068
        // for (var i=0, l=a.length; i<l; i=i+1) {
 
1069
        //var a=arguments, o=Y.Object(a[0]);
 
1070
        var a=arguments, o={};
 
1071
        for (var i=0, l=a.length; i<l; i=i+1) {
 
1072
            Y.mix(o, a[i], true);
 
1073
        }
 
1074
        return o;
 
1075
    };
 
1076
       
 
1077
    /**
 
1078
     * Applies the supplier's properties to the receiver.  By default
 
1079
     * all prototype and static propertes on the supplier are applied
 
1080
     * to the corresponding spot on the receiver.  By default all
 
1081
     * properties are applied, and a property that is already on the
 
1082
     * reciever will not be overwritten.  The default behavior can
 
1083
     * be modified by supplying the appropriate parameters.
 
1084
     *
 
1085
     * @TODO add constants for the modes
 
1086
     *
 
1087
     * @method mix
 
1088
     * @param {Function} r  the object to receive the augmentation
 
1089
     * @param {Function} s  the object that supplies the properties to augment
 
1090
     * @param ov {boolean} if true, properties already on the receiver
 
1091
     * will be overwritten if found on the supplier.
 
1092
     * @param wl {string[]} a whitelist.  If supplied, only properties in 
 
1093
     * this list will be applied to the receiver.
 
1094
     * @param {int} mode what should be copies, and to where
 
1095
     *        default(0): object to object
 
1096
     *        1: prototype to prototype (old augment)
 
1097
     *        2: prototype to prototype and object props (new augment)
 
1098
     *        3: prototype to object
 
1099
     *        4: object to prototype
 
1100
     * @param merge {boolean} merge objects instead of overwriting/ignoring
 
1101
     * Used by Y.aggregate
 
1102
     * @return {object} the augmented object
 
1103
     * @TODO review for PR2
 
1104
     */
 
1105
    Y.mix = function(r, s, ov, wl, mode, merge) {
 
1106
 
 
1107
        if (!s||!r) {
 
1108
            return Y;
 
1109
        }
 
1110
 
 
1111
        var w = (wl && wl.length) ? A.hash(wl) : null, m = merge,
 
1112
 
 
1113
            f = function(fr, fs, proto, iwl) {
 
1114
 
 
1115
                var arr = m && L.isArray(fr);
 
1116
 
 
1117
                for (var i in fs) { 
 
1118
 
 
1119
                    if (fs.hasOwnProperty(i)) {
 
1120
 
 
1121
                        // We never want to overwrite the prototype
 
1122
                        // if (PROTO === i) {
 
1123
                        if (PROTO === i || '_yuid' === i) {
 
1124
                            continue;
 
1125
                        }
 
1126
 
 
1127
                        // @TODO deal with the hasownprop issue
 
1128
 
 
1129
                        // check white list if it was supplied
 
1130
                        if (!w || iwl || (i in w)) {
 
1131
                            // if the receiver has this property, it is an object,
 
1132
                            // and merge is specified, merge the two objects.
 
1133
                            if (m && L.isObject(fr[i], true)) {
 
1134
                                // console.log('aggregate RECURSE: ' + i);
 
1135
                                // @TODO recursive or no?
 
1136
                                // Y.mix(fr[i], fs[i]); // not recursive
 
1137
                                f(fr[i], fs[i], proto, true); // recursive
 
1138
                            // otherwise apply the property only if overwrite
 
1139
                            // is specified or the receiver doesn't have one.
 
1140
                            // @TODO make sure the 'arr' check isn't desructive
 
1141
                            } else if (!arr && (ov || !(i in fr))) {
 
1142
                                // console.log('hash: ' + i);
 
1143
                                fr[i] = fs[i];
 
1144
                            // if merge is specified and the receiver is an array,
 
1145
                            // append the array item
 
1146
                            } else if (arr) {
 
1147
                                // console.log('array: ' + i);
 
1148
                                // @TODO probably will need to remove dups
 
1149
                                fr.push(fs[i]);
 
1150
                            }
 
1151
                        }
 
1152
                    }
 
1153
                }
 
1154
 
 
1155
                _iefix(fr, fs, w);
 
1156
            };
 
1157
 
 
1158
        var rp = r.prototype, sp = s.prototype;
 
1159
 
 
1160
        switch (mode) {
 
1161
            case 1: // proto to proto
 
1162
                f(rp, sp, true);
 
1163
                break;
 
1164
            case 2: // object to object and proto to proto
 
1165
                f(r, s);
 
1166
                f(rp, sp, true);
 
1167
                break;
 
1168
            case 3: // proto to static
 
1169
                f(r, sp, true);
 
1170
                break;
 
1171
            case 4: // static to proto
 
1172
                f(rp, s);
 
1173
                break;
 
1174
            default:  // object to object
 
1175
                f(r, s);
 
1176
        }
 
1177
 
 
1178
        return r;
 
1179
    };
 
1180
 
 
1181
    
 
1182
 
 
1183
}, "3.0.0pr2");
 
1184
/*
 
1185
 * YUI object utilities
 
1186
 * @module yui
 
1187
 * @submodule object
 
1188
 */
 
1189
YUI.add("object", function(Y) {
 
1190
 
 
1191
    /**
 
1192
     * Adds the following Object utilities to the YUI instance
 
1193
     * @class YUI~object
 
1194
     */
 
1195
 
 
1196
    /**
 
1197
     * Y.Object(o) returns a new object based upon the supplied object.  
 
1198
     * @method Object
 
1199
     * @static
 
1200
     * @param o the supplier object
 
1201
     * @return {object} the new object
 
1202
     */
 
1203
    Y.Object = function(o) {
 
1204
        var F = function() {};
 
1205
        F.prototype = o;
 
1206
        return new F();
 
1207
    }; 
 
1208
 
 
1209
    var O = Y.Object, L = Y.Lang;
 
1210
 
 
1211
    /**
 
1212
     * Determines whether or not the property was added
 
1213
     * to the object instance.  Returns false if the property is not present
 
1214
     * in the object, or was inherited from the prototype.
 
1215
     *
 
1216
     * @deprecated Safari 1.x support has been removed, so this is simply a 
 
1217
     * wrapper for the native implementation.  Use the native implementation
 
1218
     * directly instead.
 
1219
     *
 
1220
     * @TODO Remove in PR2
 
1221
     *
 
1222
     * @method Object.owns
 
1223
     * @static
 
1224
     * @param o {any} The object being testing
 
1225
     * @param p {string} the property to look for
 
1226
     * @return {boolean} true if the object has the property on the instance
 
1227
     */
 
1228
    O.owns = function(o, p) {
 
1229
        return (o && o.hasOwnProperty) ? o.hasOwnProperty(p) : false;
 
1230
    };
 
1231
 
 
1232
    /**
 
1233
     * Returns an array containing the object's keys
 
1234
     * @method Object.keys
 
1235
     * @static
 
1236
     * @param o an object
 
1237
     * @return {string[]} the keys
 
1238
     */
 
1239
    O.keys = function(o) {
 
1240
        var a=[], i;
 
1241
        for (i in o) {
 
1242
            if (o.hasOwnProperty(i)) {
 
1243
                a.push(i);
 
1244
            }
 
1245
        }
 
1246
 
 
1247
        return a;
 
1248
    };
 
1249
 
 
1250
    /**
 
1251
     * Executes a function on each item. The function
 
1252
     * receives the value, the key, and the object
 
1253
     * as paramters (in that order).
 
1254
     * @method Object.each
 
1255
     * @static
 
1256
     * @param o the object to iterate
 
1257
     * @param f {function} the function to execute
 
1258
     * @param c the execution context
 
1259
     * @param proto {boolean} include proto
 
1260
     * @return {YUI} the YUI instance
 
1261
     */
 
1262
    O.each = function (o, f, c, proto) {
 
1263
        var s = c || Y;
 
1264
 
 
1265
        for (var i in o) {
 
1266
            if (proto || o.hasOwnProperty(i)) {
 
1267
                f.call(s, o[i], i, o);
 
1268
            }
 
1269
        }
 
1270
        return Y;
 
1271
    };
 
1272
}, "3.0.0pr2");
 
1273
/*
 
1274
 * YUI user agent detection
 
1275
 * @module yui
 
1276
 * @submodule ua
 
1277
 */
 
1278
YUI.add("ua", function(Y) {
 
1279
 
 
1280
    /**
 
1281
     * Browser/platform detection
 
1282
     * @class UA
 
1283
     * @static
 
1284
     */
 
1285
    Y.UA = function() {
 
1286
 
 
1287
        var o={
 
1288
 
 
1289
            /**
 
1290
             * Internet Explorer version number or 0.  Example: 6
 
1291
             * @property ie
 
1292
             * @type float
 
1293
             * @static
 
1294
             */
 
1295
            ie:0,
 
1296
 
 
1297
            /**
 
1298
             * Opera version number or 0.  Example: 9.2
 
1299
             * @property opera
 
1300
             * @type float
 
1301
             * @static
 
1302
             */
 
1303
            opera:0,
 
1304
 
 
1305
            /**
 
1306
             * Gecko engine revision number.  Will evaluate to 1 if Gecko 
 
1307
             * is detected but the revision could not be found. Other browsers
 
1308
             * will be 0.  Example: 1.8
 
1309
             * <pre>
 
1310
             * Firefox 1.0.0.4: 1.7.8   <-- Reports 1.7
 
1311
             * Firefox 1.5.0.9: 1.8.0.9 <-- Reports 1.8
 
1312
             * Firefox 2.0.0.3: 1.8.1.3 <-- Reports 1.8
 
1313
             * Firefox 3 alpha: 1.9a4   <-- Reports 1.9
 
1314
             * </pre>
 
1315
             * @property gecko
 
1316
             * @type float
 
1317
             * @static
 
1318
             */
 
1319
            gecko:0,
 
1320
 
 
1321
            /**
 
1322
             * AppleWebKit version.  KHTML browsers that are not WebKit browsers 
 
1323
             * will evaluate to 1, other browsers 0.  Example: 418.9.1
 
1324
             * <pre>
 
1325
             * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the 
 
1326
             *                                   latest available for Mac OSX 10.3.
 
1327
             * Safari 2.0.2:         416     <-- hasOwnProperty introduced
 
1328
             * Safari 2.0.4:         418     <-- preventDefault fixed
 
1329
             * Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run
 
1330
             *                                   different versions of webkit
 
1331
             * Safari 2.0.4 (419.3): 419     <-- Tiger installations that have been
 
1332
             *                                   updated, but not updated
 
1333
             *                                   to the latest patch.
 
1334
             * Webkit 212 nightly:   522+    <-- Safari 3.0 precursor (with native SVG
 
1335
             *                                   and many major issues fixed).
 
1336
             * Safari 3.0.4 (523.12) 523.12  <-- First Tiger release - automatic update
 
1337
             *                                   from 2.x via the 10.4.11 OS patch
 
1338
             *                                   
 
1339
             * </pre>
 
1340
             * http://developer.apple.com/internet/safari/uamatrix.html
 
1341
             * @property webkit
 
1342
             * @type float
 
1343
             * @static
 
1344
             */
 
1345
            webkit:0,
 
1346
 
 
1347
            /**
 
1348
             * The mobile property will be set to a string containing any relevant
 
1349
             * user agent information when a modern mobile browser is detected.
 
1350
             * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series
 
1351
             * devices with the WebKit-based browser, and Opera Mini.  
 
1352
             * @property mobile 
 
1353
             * @type string
 
1354
             * @static
 
1355
             */
 
1356
            mobile: null 
 
1357
        };
 
1358
 
 
1359
        var ua=navigator.userAgent, m;
 
1360
 
 
1361
        // Modern KHTML browsers should qualify as Safari X-Grade
 
1362
        if ((/KHTML/).test(ua)) {
 
1363
            o.webkit=1;
 
1364
        }
 
1365
        // Modern WebKit browsers are at least X-Grade
 
1366
        m=ua.match(/AppleWebKit\/([^\s]*)/);
 
1367
        if (m&&m[1]) {
 
1368
            o.webkit=parseFloat(m[1]);
 
1369
 
 
1370
            // Mobile browser check
 
1371
            if (/ Mobile\//.test(ua)) {
 
1372
                o.mobile = "Apple"; // iPhone or iPod Touch
 
1373
            } else {
 
1374
                m=ua.match(/NokiaN[^\/]*/);
 
1375
                if (m) {
 
1376
                    o.mobile = m[0]; // Nokia N-series, ex: NokiaN95
 
1377
                }
 
1378
            }
 
1379
 
 
1380
        }
 
1381
 
 
1382
        if (!o.webkit) { // not webkit
 
1383
            // @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr)
 
1384
            m=ua.match(/Opera[\s\/]([^\s]*)/);
 
1385
            if (m&&m[1]) {
 
1386
                o.opera=parseFloat(m[1]);
 
1387
                m=ua.match(/Opera Mini[^;]*/);
 
1388
                if (m) {
 
1389
                    o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316
 
1390
                }
 
1391
            } else { // not opera or webkit
 
1392
                m=ua.match(/MSIE\s([^;]*)/);
 
1393
                if (m&&m[1]) {
 
1394
                    o.ie=parseFloat(m[1]);
 
1395
                } else { // not opera, webkit, or ie
 
1396
                    m=ua.match(/Gecko\/([^\s]*)/);
 
1397
                    if (m) {
 
1398
                        o.gecko=1; // Gecko detected, look for revision
 
1399
                        m=ua.match(/rv:([^\s\)]*)/);
 
1400
                        if (m&&m[1]) {
 
1401
                            o.gecko=parseFloat(m[1]);
 
1402
                        }
 
1403
                    }
 
1404
                }
 
1405
            }
 
1406
        }
 
1407
        
 
1408
        return o;
 
1409
    }();
 
1410
}, "3.0.0pr2");
 
1411
/*
 
1412
 * YUI setTimeout/setInterval abstraction
 
1413
 * @module yui
 
1414
 * @submodule later
 
1415
 */
 
1416
YUI.add("later", function(Y) {
 
1417
 
 
1418
    var L = Y.Lang;
 
1419
 
 
1420
    /**
 
1421
     * Executes the supplied function in the context of the supplied 
 
1422
     * object 'when' milliseconds later.  Executes the function a 
 
1423
     * single time unless periodic is set to true.
 
1424
     * @method later
 
1425
     * @for YUI
 
1426
     * @param when {int} the number of milliseconds to wait until the fn 
 
1427
     * is executed.
 
1428
     * @param o the context object.
 
1429
     * @param fn {Function|String} the function to execute or the name of 
 
1430
     * the method in the 'o' object to execute.
 
1431
     * @param data [Array] data that is provided to the function.  This accepts
 
1432
     * either a single item or an array.  If an array is provided, the
 
1433
     * function is executed with one parameter for each array item.  If
 
1434
     * you need to pass a single array parameter, it needs to be wrapped in
 
1435
     * an array [myarray].
 
1436
     * @param periodic {boolean} if true, executes continuously at supplied 
 
1437
     * interval until canceled.
 
1438
     * @return {object} a timer object. Call the cancel() method on this object to 
 
1439
     * stop the timer.
 
1440
     */
 
1441
    var later = function(when, o, fn, data, periodic) {
 
1442
        when = when || 0; 
 
1443
        o = o || {};
 
1444
        var m=fn, d=data, f, r;
 
1445
 
 
1446
        if (L.isString(fn)) {
 
1447
            m = o[fn];
 
1448
        }
 
1449
 
 
1450
        if (!m) {
 
1451
            Y.fail("method undefined");
 
1452
        }
 
1453
 
 
1454
        if (!L.isArray(d)) {
 
1455
            d = [data];
 
1456
        }
 
1457
 
 
1458
        f = function() {
 
1459
            m.apply(o, d);
 
1460
        };
 
1461
 
 
1462
        r = (periodic) ? setInterval(f, when) : setTimeout(f, when);
 
1463
 
 
1464
        return {
 
1465
            interval: periodic,
 
1466
            cancel: function() {
 
1467
                if (this.interval) {
 
1468
                    clearInterval(r);
 
1469
                } else {
 
1470
                    clearTimeout(r);
 
1471
                }
 
1472
            }
 
1473
        };
 
1474
    };
 
1475
 
 
1476
    Y.later = later;
 
1477
    L.later = later;
 
1478
 
 
1479
}, "3.0.0pr2");
 
1480
/*
 
1481
 * YUI initializer
 
1482
 * @module yui
 
1483
 * @submodule init
 
1484
 */
 
1485
(function() {
 
1486
 
 
1487
    var min = ['yui-base', 'log', 'lang', 'array', 'core'], core,
 
1488
 
 
1489
    M = function(Y) {
 
1490
 
 
1491
        var C = Y.config;
 
1492
 
 
1493
        // apply the minimal required functionality
 
1494
        Y.use.apply(Y, min);
 
1495
 
 
1496
 
 
1497
        if (C.core) {
 
1498
 
 
1499
            core = C.core;
 
1500
 
 
1501
        } else {
 
1502
 
 
1503
            core = ["object", "ua", "later"];
 
1504
 
 
1505
            core.push(
 
1506
              "get", 
 
1507
              "loader");
 
1508
        }
 
1509
 
 
1510
        Y.use.apply(Y, core);
 
1511
 
 
1512
    };
 
1513
     
 
1514
    YUI.add("yui", M, "3.0.0pr2");
 
1515
    
 
1516
    // {
 
1517
        // the following will be bound automatically when this code is loaded
 
1518
      //   use: core
 
1519
    // });
 
1520
 
 
1521
})();