/* Copyright (c) 2009, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 3.0.0 build: 1549 */ (function() { var _instances = {}, _startTime = new Date().getTime(), p, i, add = function () { if (window.addEventListener) { return function(el, type, fn, capture) { el.addEventListener(type, fn, (!!capture)); }; } else if (window.attachEvent) { return function(el, type, fn) { el.attachEvent("on" + type, fn); }; } else { return function(){}; } }(), remove = function() { if (window.removeEventListener) { return function (el, type, fn, capture) { el.removeEventListener(type, fn, !!capture); }; } else if (window.detachEvent) { return function (el, type, fn) { el.detachEvent("on" + type, fn); }; } else { return function(){}; } }(), globalListener = function() { YUI.Env.windowLoaded = true; YUI.Env.DOMReady = true; remove(window, 'load', globalListener); }, // @TODO: this needs to be created at build time from module metadata _APPLY_TO_WHITE_LIST = { 'io.xdrReady': 1, 'io.start': 1, 'io.success': 1, 'io.failure': 1 }, SLICE = Array.prototype.slice; // reduce to one or the other if (typeof YUI === 'undefined' || !YUI) { /** * The YUI global namespace object. If YUI is already defined, the * existing YUI object will not be overwritten so that defined * namespaces are preserved. * * @class YUI * @constructor * @global * @uses EventTarget * @param o* Up to five optional configuration objects. This object is stored * in YUI.config. See config for the list of supported properties. */ /*global YUI*/ // Make a function, disallow direct instantiation YUI = function(o1, o2, o3, o4, o5) { var Y = this, a = arguments, i, l = a.length; // Allow instantiation without the new operator if (!(Y instanceof YUI)) { return new YUI(o1, o2, o3, o4, o5); } else { // set up the core environment Y._init(); for (i=0; i -1) { v = 'test'; } Y.version = v; Y.Env = { // @todo expand the new module metadata mods: {}, cdn: 'http://yui.yahooapis.com/' + v + '/build/', bootstrapped: false, _idx: 0, _used: {}, _attached: {}, _yidx: 0, _uidx: 0, _loaded: {} }; Y.Env._loaded[v] = {}; if (YUI.Env) { Y.Env._yidx = (++YUI.Env._yidx); Y.Env._guidp = ('yui_' + v + '-' + Y.Env._yidx + '-' + _startTime).replace(/\./g, '_'); Y.id = Y.stamp(Y); _instances[Y.id] = Y; } Y.constructor = YUI; // configuration defaults Y.config = { win: window || {}, doc: document, debug: true, useBrowserConsole: true, throwFail: true, base: function() { var b, nodes, i, match; // get from querystring nodes = document.getElementsByTagName('script'); for (i=0; i * YUI.namespace("property.package"); * YUI.namespace("YAHOO.property.package"); * * Either of the above would create YUI.property, then * YUI.property.package (YAHOO is scrubbed out, this is * to remain compatible with YUI2) * * Be careful when naming packages. Reserved words may work in some browsers * and not others. For instance, the following will fail in Safari: *
     * YUI.namespace("really.long.nested.namespace");
     * 
* This fails because "long" is a future reserved word in ECMAScript * * @method namespace * @param {string*} arguments 1-n namespaces to create * @return {object} A reference to the last namespace object created */ namespace: function() { var a=arguments, o=null, i, j, d; for (i=0; i *
DEBUG
*
Selects the debug versions of the library (e.g., event-debug.js). * This option will automatically include the Logger widget
*
RAW
*
Selects the non-minified version of the library (e.g., event.js).
* * You can also define a custom filter, which must be an object literal * containing a search expression and a replace string: *
 *  myFilter: { 
 *      'searchExp': "-min\\.js", 
 *      'replaceStr': "-debug.js"
 *  }
 * 
* * For dynamic loading. * * @property filter * @type string|object */ /** * Hash of per-component filter specification. If specified for a given component, * this overrides the filter config * * For dynamic loading. * * @property filters * @type object */ /** * Use the YUI combo service to reduce the number of http connections * required to load your dependencies. * * For dynamic loading. * * @property combine * @type boolean * @default true if 'base' is not supplied, false if it is. */ /** * A list of modules that should never be dynamically loaded * * @property ignore * @type string[] */ /** * A list of modules that should always be loaded when required, even if already * present on the page. * * @property force * @type string[] */ /** * Node or id for a node that should be used as the insertion point for new nodes * For dynamic loading. * * @property insertBefore * @type string */ /** * charset for dynamic nodes * * @property charset * @type string * @deprecated use jsAttributes cssAttributes */ /** * Object literal containing attributes to add to dynamically loaded script nodes. * * @property jsAttributes * @type string */ /** * Object literal containing attributes to add to dynamically loaded link nodes. * * @property cssAttributes * @type string */ /** * Number of milliseconds before a timeout occurs when dynamically * loading nodes. If not set, there is no timeout. * * @property timeout * @type int */ /** * Callback for the 'CSSComplete' event. When dynamically loading YUI * components with CSS, this property fires when the CSS is finished * loading but script loading is still ongoing. This provides an * opportunity to enhance the presentation of a loading page a little * bit before the entire loading process is done. * * @property onCSS * @type function */ /** * A list of module definitions to add to the list of YUI components. * These components can then be dynamically loaded side by side with * YUI via the use() method.See Loader.addModule for the supported * module metadata. * * @property modules * @type function */ /** * The loader 'path' attribute to the loader itself. This is combined * with the 'base' attribute to dynamically load the loader component * when boostrapping with the get utility alone. * * @property loaderPath * @default loader/loader-min.js */ YUI.add('yui-base', function(Y) { /* * YUI stub * @module yui * @submodule yui-base */ (function() { var INSTANCE = Y, LOGEVENT = 'yui:log', UNDEFINED = 'undefined', LEVELS = { debug: 1, info: 1, warn: 1, error: 1 }, _published; /** * If the 'debug' config is true, a 'yui:log' event will be * dispatched, which the Console widget and anything else * can consume. If the 'useBrowserConsole' config is true, it will * write to the browser console if available. YUI-specific log * messages will only be present in the -debug versions of the * JS files. The build system is supposed to remove log statements * from the raw and minified versions of the files. * * @method log * @for YUI * @param {String} msg The message to log. * @param {String} cat The log category for the message. Default * categories are "info", "warn", "error", time". * Custom categories can be used as well. (opt) * @param {String} src The source of the the message (opt) * @param {boolean} silent If true, the log event won't fire * @return {YUI} YUI instance */ INSTANCE.log = function(msg, cat, src, silent) { var Y = INSTANCE, c = Y.config, bail = false, excl, incl, m, f; // suppress log message if the config is off or the event stack // or the event call stack contains a consumer of the yui:log event if (c.debug) { // apply source filters if (src) { excl = c.logExclude; incl = c.logInclude; if (incl && !(src in incl)) { bail = 1; } else if (excl && (src in excl)) { bail = 1; } } if (!bail) { if (c.useBrowserConsole) { m = (src) ? src + ': ' + msg : msg; if (typeof console != UNDEFINED && console.log) { f = (cat && console[cat] && (cat in LEVELS)) ? cat : 'log'; console[f](m); } else if (typeof opera != UNDEFINED) { opera.postError(m); } } if (Y.fire && !bail && !silent) { if (!_published) { Y.publish(LOGEVENT, { broadcast: 2, emitFacade: 1 }); _published = 1; } Y.fire(LOGEVENT, { msg: msg, cat: cat, src: src }); } } } return Y; }; /** * Write a system message. This message will be preserved in the * minified and raw versions of the YUI files, unlike log statements. * @method message * @for YUI * @param {String} msg The message to log. * @param {String} cat The log category for the message. Default * categories are "info", "warn", "error", time". * Custom categories can be used as well. (opt) * @param {String} src The source of the the message (opt) * @param {boolean} silent If true, the log event won't fire * @return {YUI} YUI instance */ INSTANCE.message = function() { return INSTANCE.log.apply(INSTANCE, arguments); }; })(); (function() { /** * Provides the language utilites and extensions used by the library * @class Lang * @static */ Y.Lang = Y.Lang || {}; var L = Y.Lang, ARRAY = 'array', BOOLEAN = 'boolean', DATE = 'date', ERROR = 'error', FUNCTION = 'function', NUMBER = 'number', NULL = 'null', OBJECT = 'object', REGEX = 'regexp', STRING = 'string', TOSTRING = Object.prototype.toString, UNDEFINED = 'undefined', TYPES = { 'undefined' : UNDEFINED, 'number' : NUMBER, 'boolean' : BOOLEAN, 'string' : STRING, '[object Function]' : FUNCTION, '[object RegExp]' : REGEX, '[object Array]' : ARRAY, '[object Date]' : DATE, '[object Error]' : ERROR }, TRIMREGEX = /^\s+|\s+$/g, EMPTYSTRING = ''; /** * Determines whether or not the provided item is an array. * Returns false for array-like collections such as the * function arguments collection or HTMLElement collection * will return false. You can use @see Array.test if you * want to * @method isArray * @static * @param o The object to test * @return {boolean} true if o is an array */ L.isArray = function(o) { return L.type(o) === ARRAY; }; /** * Determines whether or not the provided item is a boolean * @method isBoolean * @static * @param o The object to test * @return {boolean} true if o is a boolean */ L.isBoolean = function(o) { return typeof o === BOOLEAN; }; /** * Determines whether or not the provided item is a function * Note: Internet Explorer thinks certain functions are objects: * * var obj = document.createElement("object"); * Y.Lang.isFunction(obj.getAttribute) // reports false in IE * * var input = document.createElement("input"); // append to body * Y.Lang.isFunction(input.focus) // reports false in IE * * You will have to implement additional tests if these functions * matter to you. * * @method isFunction * @static * @param o The object to test * @return {boolean} true if o is a function */ L.isFunction = function(o) { return L.type(o) === FUNCTION; }; /** * Determines whether or not the supplied item is a date instance * @method isDate * @static * @param o The object to test * @return {boolean} true if o is a date */ L.isDate = function(o) { // return o instanceof Date; return L.type(o) === DATE; }; /** * Determines whether or not the provided item is null * @method isNull * @static * @param o The object to test * @return {boolean} true if o is null */ L.isNull = function(o) { return o === null; }; /** * Determines whether or not the provided item is a legal number * @method isNumber * @static * @param o The object to test * @return {boolean} true if o is a number */ L.isNumber = function(o) { return typeof o === NUMBER && isFinite(o); }; /** * Determines whether or not the provided item is of type object * or function * @method isObject * @static * @param o The object to test * @param failfn {boolean} fail if the input is a function * @return {boolean} true if o is an object */ L.isObject = function(o, failfn) { return (o && (typeof o === OBJECT || (!failfn && L.isFunction(o)))) || false; }; /** * Determines whether or not the provided item is a string * @method isString * @static * @param o The object to test * @return {boolean} true if o is a string */ L.isString = function(o) { return typeof o === STRING; }; /** * Determines whether or not the provided item is undefined * @method isUndefined * @static * @param o The object to test * @return {boolean} true if o is undefined */ L.isUndefined = function(o) { return typeof o === UNDEFINED; }; /** * Returns a string without any leading or trailing whitespace. If * the input is not a string, the input will be returned untouched. * @method trim * @static * @param s {string} the string to trim * @return {string} the trimmed string */ L.trim = function(s){ try { return s.replace(TRIMREGEX, EMPTYSTRING); } catch(e) { return s; } }; /** * A convenience method for detecting a legitimate non-null value. * Returns false for null/undefined/NaN, true for other values, * including 0/false/'' * @method isValue * @static * @param o The item to test * @return {boolean} true if it is not null/undefined/NaN || false */ L.isValue = function(o) { var t = L.type(o); switch (t) { case NUMBER: return isFinite(o); case NULL: case UNDEFINED: return false; default: return !!(t); } }; /** * Returns a string representing the type of the item passed in. * @method type * @param o the item to test * @return {string} the detected type */ L.type = function (o) { return TYPES[typeof o] || TYPES[TOSTRING.call(o)] || (o ? OBJECT : NULL); }; })(); /* * Provides information about the environment hosting YUI * @module yui * @submodule Array */ (function() { var L = Y.Lang, Native = Array.prototype, /** * Adds the following array utilities to the YUI instance. Additional * array helpers can be found in the collection component. * @class Array */ /** * Y.Array(o) returns an array: * - Arrays are return unmodified unless the start position is specified. * - "Array-like" collections (@see Array.test) are converted to arrays * - For everything else, a new array is created with the input as the sole item * - The start position is used if the input is or is like an array to return * a subset of the collection. * * @TODO this will not automatically convert elements that are also collections * such as forms and selects. Passing true as the third param will * force a conversion. * * @method () * @static * @param o the item to arrayify * @param i {int} if an array or array-like, this is the start index * @param al {boolean} if true, it forces the array-like fork. This * can be used to avoid multiple array.test calls. * @return {Array} the resulting array */ YArray = function(o, startIdx, al) { var t = (al) ? 2 : Y.Array.test(o), i, l, a; // switch (t) { // case 1: // // return (startIdx) ? o.slice(startIdx) : o; // case 2: // return Native.slice.call(o, startIdx || 0); // default: // return [o]; // } if (t) { try { return Native.slice.call(o, startIdx || 0); // IE errors when trying to slice element collections } catch(e) { a=[]; for (i=0, l=o.length; i 1)) { r = 2; } } catch(e) {} } } return r; }; /** * Executes the supplied function on each item in the array. * @method each * @param a {Array} the array to iterate * @param f {Function} the function to execute on each item * @param o Optional context object * @static * @return {YUI} the YUI instance */ YArray.each = (Native.forEach) ? function (a, f, o) { Native.forEach.call(a || [], f, o || Y); return Y; } : function (a, f, o) { var l = (a && a.length) || 0, i; for (i = 0; i < l; i=i+1) { f.call(o || Y, a[i], i, a); } return Y; }; /** * Returns an object using the first array as keys, and * the second as values. If the second array is not * provided the value is set to true for each. * @method hash * @static * @param k {Array} keyset * @param v {Array} optional valueset * @return {object} the hash */ YArray.hash = function(k, v) { var o = {}, l = k.length, vl = v && v.length, i; for (i=0; i i) ? v[i] : true; } return o; }; /** * Returns the index of the first item in the array * that contains the specified value, -1 if the * value isn't found. * @method indexOf * @static * @param a {Array} the array to search * @param val the value to search for * @return {int} the index of the item that contains the value or -1 */ YArray.indexOf = (Native.indexOf) ? function(a, val) { return Native.indexOf.call(a, val); } : function(a, val) { for (var i=0; i -1); }; /** * Determines whether or not the property was added * to the object instance. Returns false if the property is not present * in the object, or was inherited from the prototype. * * @deprecated Safari 1.x support has been removed, so this is simply a * wrapper for the native implementation. Use the native implementation * directly instead. * * @TODO Remove in B1 * * @method owns * @static * @param o {any} The object being testing * @param p {string} the property to look for * @return {boolean} true if the object has the property on the instance */ O.owns = function(o, k) { return (o.hasOwnProperty(k)); }; /** * Executes a function on each item. The function * receives the value, the key, and the object * as paramters (in that order). * @method each * @static * @param o the object to iterate * @param f {function} the function to execute * @param c the execution context * @param proto {boolean} include proto * @return {YUI} the YUI instance */ O.each = function (o, f, c, proto) { var s = c || Y, i; for (i in o) { if (proto || o.hasOwnProperty(i)) { f.call(s, o[i], i, o); } } return Y; }; /** * Retrieves the sub value at the provided path, * from the value object provided. * * @method getValue * @param o The object from which to extract the property value * @param path {Array} A path array, specifying the object traversal path * from which to obtain the sub value. * @return {Any} The value stored in the path, undefined if not found. * Returns the source object if an empty path is provided. */ O.getValue = function (o, path) { var p=Y.Array(path), l=p.length, i; for (i=0; o !== UNDEFINED && i < l; i=i+1) { o = o[p[i]]; } return o; }; /** * Sets the sub-attribute value at the provided path on the * value object. Returns the modified value object, or * undefined if the path is invalid. * * @method setValue * @param o The object on which to set the sub value. * @param path {Array} A path array, specifying the object traversal path * at which to set the sub value. * @param val {Any} The new value for the sub-attribute. * @return {Object} The modified object, with the new sub value set, or * undefined, if the path was invalid. */ O.setValue = function(o, path, val) { var p=Y.Array(path), leafIdx=p.length-1, i, ref=o; if (leafIdx >= 0) { for (i=0; ref !== UNDEFINED && i < leafIdx; i=i+1) { ref = ref[p[i]]; } if (ref !== UNDEFINED) { ref[p[i]] = val; } else { return UNDEFINED; } } return o; }; })(); /* * Provides information about the environment hosting YUI * @module yui * @submodule UA */ /** * YUI user agent detection. * Do not fork for a browser if it can be avoided. Use feature detection when * you can. Use the user agent as a last resort. UA stores a version * number for the browser engine, 0 otherwise. This value may or may not map * to the version number of the browser using the engine. The value is * presented as a float so that it can easily be used for boolean evaluation * as well as for looking for a particular range of versions. Because of this, * some of the granularity of the version info may be lost (e.g., Gecko 1.8.0.9 * reports 1.8). * @class UA * @static */ Y.UA = function() { var numberfy = function(s) { var c = 0; return parseFloat(s.replace(/\./g, function() { return (c++ == 1) ? '' : '.'; })); }, nav = navigator, o = { /** * Internet Explorer version number or 0. Example: 6 * @property ie * @type float * @static */ ie: 0, /** * Opera version number or 0. Example: 9.2 * @property opera * @type float * @static */ opera: 0, /** * Gecko engine revision number. Will evaluate to 1 if Gecko * is detected but the revision could not be found. Other browsers * will be 0. Example: 1.8 *
         * Firefox 1.0.0.4: 1.7.8   <-- Reports 1.7
         * Firefox 1.5.0.9: 1.8.0.9 <-- Reports 1.8
         * Firefox 2.0.0.3: 1.8.1.3 <-- Reports 1.8
         * Firefox 3 alpha: 1.9a4   <-- Reports 1.9
         * 
* @property gecko * @type float * @static */ gecko: 0, /** * AppleWebKit version. KHTML browsers that are not WebKit browsers * will evaluate to 1, other browsers 0. Example: 418.9 *
         * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the 
         *                                   latest available for Mac OSX 10.3.
         * Safari 2.0.2:         416     <-- hasOwnProperty introduced
         * Safari 2.0.4:         418     <-- preventDefault fixed
         * Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run
         *                                   different versions of webkit
         * Safari 2.0.4 (419.3): 419     <-- Tiger installations that have been
         *                                   updated, but not updated
         *                                   to the latest patch.
         * Webkit 212 nightly:   522+    <-- Safari 3.0 precursor (with native SVG
         *                                   and many major issues fixed).
         * Safari 3.0.4 (523.12) 523.12  <-- First Tiger release - automatic update
         *                                   from 2.x via the 10.4.11 OS patch
         * Webkit nightly 1/2008:525+    <-- Supports DOMContentLoaded event.
         *                                   yahoo.com user agent hack removed.
         * 
* http://en.wikipedia.org/wiki/Safari_(web_browser)#Version_history * @property webkit * @type float * @static */ webkit: 0, /** * The mobile property will be set to a string containing any relevant * user agent information when a modern mobile browser is detected. * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series * devices with the WebKit-based browser, and Opera Mini. * @property mobile * @type string * @static */ mobile: null, /** * Adobe AIR version number or 0. Only populated if webkit is detected. * Example: 1.0 * @property air * @type float */ air: 0, /** * Google Caja version number or 0. * @property caja * @type float */ caja: nav.cajaVersion, /** * Set to true if the page appears to be in SSL * @property secure * @type boolean * @static */ secure: false, /** * The operating system. Currently only detecting windows or macintosh * @property os * @type string * @static */ os: null }, ua = nav && nav.userAgent, loc = Y.config.win.location, href = loc && loc.href, m; o.secure = href && (href.toLowerCase().indexOf("https") === 0); if (ua) { if ((/windows|win32/i).test(ua)) { o.os = 'windows'; } else if ((/macintosh/i).test(ua)) { o.os = 'macintosh'; } // Modern KHTML browsers should qualify as Safari X-Grade if ((/KHTML/).test(ua)) { o.webkit=1; } // Modern WebKit browsers are at least X-Grade m=ua.match(/AppleWebKit\/([^\s]*)/); if (m&&m[1]) { o.webkit=numberfy(m[1]); // Mobile browser check if (/ Mobile\//.test(ua)) { o.mobile = "Apple"; // iPhone or iPod Touch } else { m=ua.match(/NokiaN[^\/]*|Android \d\.\d|webOS\/\d\.\d/); if (m) { o.mobile = m[0]; // Nokia N-series, Android, webOS, ex: NokiaN95 } } m=ua.match(/AdobeAIR\/([^\s]*)/); if (m) { o.air = m[0]; // Adobe AIR 1.0 or better } } if (!o.webkit) { // not webkit // @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr) m=ua.match(/Opera[\s\/]([^\s]*)/); if (m&&m[1]) { o.opera=numberfy(m[1]); m=ua.match(/Opera Mini[^;]*/); if (m) { o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316 } } else { // not opera or webkit m=ua.match(/MSIE\s([^;]*)/); if (m&&m[1]) { o.ie=numberfy(m[1]); } else { // not opera, webkit, or ie m=ua.match(/Gecko\/([^\s]*)/); if (m) { o.gecko=1; // Gecko detected, look for revision m=ua.match(/rv:([^\s\)]*)/); if (m&&m[1]) { o.gecko=numberfy(m[1]); } } } } } } return o; }(); (function() { var L = Y.Lang, /** * Executes the supplied function in the context of the supplied * object 'when' milliseconds later. Executes the function a * single time unless periodic is set to true. * @method later * @for YUI * @param when {int} the number of milliseconds to wait until the fn * is executed. * @param o the context object. * @param fn {Function|String} the function to execute or the name of * the method in the 'o' object to execute. * @param data [Array] data that is provided to the function. This accepts * either a single item or an array. If an array is provided, the * function is executed with one parameter for each array item. If * you need to pass a single array parameter, it needs to be wrapped in * an array [myarray]. * @param periodic {boolean} if true, executes continuously at supplied * interval until canceled. * @return {object} a timer object. Call the cancel() method on this object to * stop the timer. */ later = function(when, o, fn, data, periodic) { when = when || 0; o = o || {}; var m=fn, d=data, f, r; if (L.isString(fn)) { m = o[fn]; } if (!m) { Y.error("method undefined"); } if (!L.isArray(d)) { d = [data]; } f = function() { m.apply(o, d); }; r = (periodic) ? setInterval(f, when) : setTimeout(f, when); return { id: r, interval: periodic, cancel: function() { if (this.interval) { clearInterval(r); } else { clearTimeout(r); } } }; }; Y.later = later; L.later = later; })(); (function() { var min = ['yui-base'], core, C = Y.config, LOADER='loader'; // apply the minimal required functionality Y.use.apply(Y, min); if (C.core) { core = C.core; } else { core = ['queue-base', 'get']; if (YUI.Env.mods[LOADER]) { core.push(LOADER); } } Y.use.apply(Y, core); })(); }, '3.0.0' );