[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 /* 2 YUI 3.17.2 (build 9c3c78e) 3 Copyright 2014 Yahoo! Inc. All rights reserved. 4 Licensed under the BSD License. 5 http://yuilibrary.com/license/ 6 */ 7 8 /** 9 The YUI module contains the components required for building the YUI seed file. 10 This includes the script loading mechanism, a simple queue, and the core 11 utilities for the library. 12 13 @module yui 14 @main yui 15 @submodule yui-base 16 **/ 17 18 /*jshint eqeqeq: false*/ 19 if (typeof YUI != 'undefined') { 20 YUI._YUI = YUI; 21 } 22 23 /** 24 The YUI global namespace object. This is the constructor for all YUI instances. 25 26 This is a self-instantiable factory function, meaning you don't need to precede 27 it with the `new` operator. You can invoke it directly like this: 28 29 YUI().use('*', function (Y) { 30 // Y is a new YUI instance. 31 }); 32 33 But it also works like this: 34 35 var Y = YUI(); 36 37 The `YUI` constructor accepts an optional config object, like this: 38 39 YUI({ 40 debug: true, 41 combine: false 42 }).use('node', function (Y) { 43 // Y.Node is ready to use. 44 }); 45 46 See the API docs for the <a href="config.html">Config</a> class for the complete 47 list of supported configuration properties accepted by the YUI constuctor. 48 49 If a global `YUI` object is already defined, the existing YUI object will not be 50 overwritten, to ensure that defined namespaces are preserved. 51 52 Each YUI instance has full custom event support, but only if the event system is 53 available. 54 55 @class YUI 56 @uses EventTarget 57 @constructor 58 @global 59 @param {Object} [config]* Zero or more optional configuration objects. Config 60 values are stored in the `Y.config` property. See the 61 <a href="config.html">Config</a> docs for the list of supported properties. 62 **/ 63 64 /*global YUI*/ 65 /*global YUI_config*/ 66 var YUI = function() { 67 var i = 0, 68 Y = this, 69 args = arguments, 70 l = args.length, 71 instanceOf = function(o, type) { 72 return (o && o.hasOwnProperty && (o instanceof type)); 73 }, 74 gconf = (typeof YUI_config !== 'undefined') && YUI_config; 75 76 if (!(instanceOf(Y, YUI))) { 77 Y = new YUI(); 78 } else { 79 // set up the core environment 80 Y._init(); 81 82 /** 83 Master configuration that might span multiple contexts in a non- 84 browser environment. It is applied first to all instances in all 85 contexts. 86 87 @example 88 89 YUI.GlobalConfig = { 90 filter: 'debug' 91 }; 92 93 YUI().use('node', function (Y) { 94 // debug files used here 95 }); 96 97 YUI({ 98 filter: 'min' 99 }).use('node', function (Y) { 100 // min files used here 101 }); 102 103 @property {Object} GlobalConfig 104 @global 105 @static 106 **/ 107 if (YUI.GlobalConfig) { 108 Y.applyConfig(YUI.GlobalConfig); 109 } 110 111 /** 112 Page-level config applied to all YUI instances created on the 113 current page. This is applied after `YUI.GlobalConfig` and before 114 any instance-level configuration. 115 116 @example 117 118 // Single global var to include before YUI seed file 119 YUI_config = { 120 filter: 'debug' 121 }; 122 123 YUI().use('node', function (Y) { 124 // debug files used here 125 }); 126 127 YUI({ 128 filter: 'min' 129 }).use('node', function (Y) { 130 // min files used here 131 }); 132 133 @property {Object} YUI_config 134 @global 135 **/ 136 if (gconf) { 137 Y.applyConfig(gconf); 138 } 139 140 // bind the specified additional modules for this instance 141 if (!l) { 142 Y._setup(); 143 } 144 } 145 146 if (l) { 147 // Each instance can accept one or more configuration objects. 148 // These are applied after YUI.GlobalConfig and YUI_Config, 149 // overriding values set in those config files if there is a 150 // matching property. 151 for (; i < l; i++) { 152 Y.applyConfig(args[i]); 153 } 154 155 Y._setup(); 156 } 157 158 Y.instanceOf = instanceOf; 159 160 return Y; 161 }; 162 163 (function() { 164 165 var proto, prop, 166 VERSION = '3.17.2', 167 PERIOD = '.', 168 BASE = 'http://yui.yahooapis.com/', 169 /* 170 These CSS class names can't be generated by 171 getClassName since it is not available at the 172 time they are being used. 173 */ 174 DOC_LABEL = 'yui3-js-enabled', 175 CSS_STAMP_EL = 'yui3-css-stamp', 176 NOOP = function() {}, 177 SLICE = Array.prototype.slice, 178 APPLY_TO_AUTH = { 'io.xdrReady': 1, // the functions applyTo 179 'io.xdrResponse': 1, // can call. this should 180 'SWF.eventHandler': 1 }, // be done at build time 181 hasWin = (typeof window != 'undefined'), 182 win = (hasWin) ? window : null, 183 doc = (hasWin) ? win.document : null, 184 docEl = doc && doc.documentElement, 185 docClass = docEl && docEl.className, 186 instances = {}, 187 time = new Date().getTime(), 188 add = function(el, type, fn, capture) { 189 if (el && el.addEventListener) { 190 el.addEventListener(type, fn, capture); 191 } else if (el && el.attachEvent) { 192 el.attachEvent('on' + type, fn); 193 } 194 }, 195 remove = function(el, type, fn, capture) { 196 if (el && el.removeEventListener) { 197 // this can throw an uncaught exception in FF 198 try { 199 el.removeEventListener(type, fn, capture); 200 } catch (ex) {} 201 } else if (el && el.detachEvent) { 202 el.detachEvent('on' + type, fn); 203 } 204 }, 205 handleReady = function() { 206 YUI.Env.DOMReady = true; 207 if (hasWin) { 208 remove(doc, 'DOMContentLoaded', handleReady); 209 } 210 }, 211 handleLoad = function() { 212 YUI.Env.windowLoaded = true; 213 YUI.Env.DOMReady = true; 214 if (hasWin) { 215 remove(window, 'load', handleLoad); 216 } 217 }, 218 getLoader = function(Y, o) { 219 var loader = Y.Env._loader, 220 lCore = [ 'loader-base' ], 221 G_ENV = YUI.Env, 222 mods = G_ENV.mods; 223 224 if (loader) { 225 //loader._config(Y.config); 226 loader.ignoreRegistered = false; 227 loader.onEnd = null; 228 loader.data = null; 229 loader.required = []; 230 loader.loadType = null; 231 } else { 232 loader = new Y.Loader(Y.config); 233 Y.Env._loader = loader; 234 } 235 if (mods && mods.loader) { 236 lCore = [].concat(lCore, YUI.Env.loaderExtras); 237 } 238 YUI.Env.core = Y.Array.dedupe([].concat(YUI.Env.core, lCore)); 239 240 return loader; 241 }, 242 243 clobber = function(r, s) { 244 for (var i in s) { 245 if (s.hasOwnProperty(i)) { 246 r[i] = s[i]; 247 } 248 } 249 }, 250 251 ALREADY_DONE = { success: true }; 252 253 // Stamp the documentElement (HTML) with a class of "yui-loaded" to 254 // enable styles that need to key off of JS being enabled. 255 if (docEl && docClass.indexOf(DOC_LABEL) == -1) { 256 if (docClass) { 257 docClass += ' '; 258 } 259 docClass += DOC_LABEL; 260 docEl.className = docClass; 261 } 262 263 if (VERSION.indexOf('@') > -1) { 264 VERSION = '3.5.0'; // dev time hack for cdn test 265 } 266 267 proto = { 268 /** 269 Applies a new configuration object to the config of this YUI instance. This 270 will merge new group/module definitions, and will also update the loader 271 cache if necessary. Updating `Y.config` directly will not update the cache. 272 273 @method applyConfig 274 @param {Object} o the configuration object. 275 @since 3.2.0 276 **/ 277 applyConfig: function(o) { 278 279 o = o || NOOP; 280 281 var attr, 282 name, 283 // detail, 284 config = this.config, 285 mods = config.modules, 286 groups = config.groups, 287 aliases = config.aliases, 288 loader = this.Env._loader; 289 290 for (name in o) { 291 if (o.hasOwnProperty(name)) { 292 attr = o[name]; 293 if (mods && name == 'modules') { 294 clobber(mods, attr); 295 } else if (aliases && name == 'aliases') { 296 clobber(aliases, attr); 297 } else if (groups && name == 'groups') { 298 clobber(groups, attr); 299 } else if (name == 'win') { 300 config[name] = (attr && attr.contentWindow) || attr; 301 config.doc = config[name] ? config[name].document : null; 302 } else if (name == '_yuid') { 303 // preserve the guid 304 } else { 305 config[name] = attr; 306 } 307 } 308 } 309 310 if (loader) { 311 loader._config(o); 312 } 313 314 }, 315 316 /** 317 Old way to apply a config to this instance (calls `applyConfig` under the 318 hood). 319 320 @private 321 @method _config 322 @param {Object} o The config to apply 323 **/ 324 _config: function(o) { 325 this.applyConfig(o); 326 }, 327 328 /** 329 Initializes this YUI instance. 330 331 @private 332 @method _init 333 **/ 334 _init: function() { 335 var filter, el, 336 Y = this, 337 G_ENV = YUI.Env, 338 Env = Y.Env, 339 prop; 340 341 /** 342 The version number of this YUI instance. 343 344 This value is typically updated by a script when a YUI release is built, 345 so it may not reflect the correct version number when YUI is run from 346 the development source tree. 347 348 @property {String} version 349 **/ 350 Y.version = VERSION; 351 352 if (!Env) { 353 Y.Env = { 354 core: ['get', 'features', 'intl-base', 'yui-log', 'yui-log-nodejs', 'yui-later', 'loader-base', 'loader-rollup', 'loader-yui3'], 355 loaderExtras: ['loader-rollup', 'loader-yui3'], 356 mods: {}, // flat module map 357 versions: {}, // version module map 358 base: BASE, 359 cdn: BASE + VERSION + '/build/', 360 // bootstrapped: false, 361 _idx: 0, 362 _used: {}, 363 _attached: {}, 364 _exported: {}, 365 _missed: [], 366 _yidx: 0, 367 _uidx: 0, 368 _guidp: 'y', 369 _loaded: {}, 370 // serviced: {}, 371 // Regex in English: 372 // I'll start at the \b(yui). 373 // 1. Look in the test string for "yui" or 374 // "yui-base" or "yui-davglass" or "yui-foobar" that comes after a word break. That is, it 375 // can't match "foyui" or "i_heart_yui". This can be anywhere in the string. 376 // 2. After #1 must come a forward slash followed by the string matched in #1, so 377 // "yui-base/yui-base" or "yui-pants/yui-pants". 378 // 3. The second occurence of the #1 token can optionally be followed by "-debug" or "-min", 379 // so "yui/yui-min", "yui/yui-debug", "yui-base/yui-base-debug". NOT "yui/yui-tshirt". 380 // 4. This is followed by ".js", so "yui/yui.js". 381 // 0. Going back to the beginning, now. If all that stuff in 1-4 comes after a "?" in the string, 382 // then capture the junk between the LAST "&" and the string in 1-4. So 383 // "blah?foo/yui/yui.js" will capture "foo/" and "blah?some/thing.js&3.3.0/build/yui-davglass/yui-davglass.js" 384 // will capture "3.3.0/build/" 385 // 386 // Regex Exploded: 387 // (?:\? Find a ? 388 // (?:[^&]*&) followed by 0..n characters followed by an & 389 // * in fact, find as many sets of characters followed by a & as you can 390 // ([^&]*) capture the stuff after the last & in \1 391 // )? but it's ok if all this ?junk&more_junk stuff isn't even there 392 // \b( after a word break find either the string 393 // yui(?:-\w+)? "yui" optionally followed by a -, then more characters 394 // ) and store the yui-* string in \2 395 // \/\2 then comes a / followed by the yui-* string in \2 396 // (?:-(min|debug))? optionally followed by "-min" or "-debug" 397 // .js and ending in ".js" 398 _BASE_RE: /(?:\?(?:[^&]*&)*([^&]*))?\b(yui(?:-\w+)?)\/\2(?:-(min|debug))?\.js/, 399 parseBasePath: function(src, pattern) { 400 var match = src.match(pattern), 401 path, filter; 402 403 if (match) { 404 path = RegExp.leftContext || src.slice(0, src.indexOf(match[0])); 405 406 // this is to set up the path to the loader. The file 407 // filter for loader should match the yui include. 408 filter = match[3]; 409 410 // extract correct path for mixed combo urls 411 // http://yuilibrary.com/projects/yui3/ticket/2528423 412 if (match[1]) { 413 path += '?' + match[1]; 414 } 415 path = { 416 filter: filter, 417 path: path 418 }; 419 } 420 return path; 421 }, 422 getBase: G_ENV && G_ENV.getBase || 423 function(pattern) { 424 var nodes = (doc && doc.getElementsByTagName('script')) || [], 425 path = Env.cdn, parsed, 426 i, len, src; 427 428 for (i = 0, len = nodes.length; i < len; ++i) { 429 src = nodes[i].src; 430 if (src) { 431 parsed = Y.Env.parseBasePath(src, pattern); 432 if (parsed) { 433 filter = parsed.filter; 434 path = parsed.path; 435 break; 436 } 437 } 438 } 439 440 // use CDN default 441 return path; 442 } 443 444 }; 445 446 Env = Y.Env; 447 448 Env._loaded[VERSION] = {}; 449 450 if (G_ENV && Y !== YUI) { 451 Env._yidx = ++G_ENV._yidx; 452 Env._guidp = ('yui_' + VERSION + '_' + 453 Env._yidx + '_' + time).replace(/[^a-z0-9_]+/g, '_'); 454 } else if (YUI._YUI) { 455 456 G_ENV = YUI._YUI.Env; 457 Env._yidx += G_ENV._yidx; 458 Env._uidx += G_ENV._uidx; 459 460 for (prop in G_ENV) { 461 if (!(prop in Env)) { 462 Env[prop] = G_ENV[prop]; 463 } 464 } 465 466 delete YUI._YUI; 467 } 468 469 Y.id = Y.stamp(Y); 470 instances[Y.id] = Y; 471 472 } 473 474 Y.constructor = YUI; 475 476 // configuration defaults 477 Y.config = Y.config || { 478 bootstrap: true, 479 cacheUse: true, 480 debug: true, 481 doc: doc, 482 fetchCSS: true, 483 throwFail: true, 484 useBrowserConsole: true, 485 useNativeES5: true, 486 win: win, 487 global: Function('return this')() 488 }; 489 490 //Register the CSS stamp element 491 if (doc && !doc.getElementById(CSS_STAMP_EL)) { 492 el = doc.createElement('div'); 493 el.innerHTML = '<div id="' + CSS_STAMP_EL + '" style="position: absolute !important; visibility: hidden !important"></div>'; 494 YUI.Env.cssStampEl = el.firstChild; 495 if (doc.body) { 496 doc.body.appendChild(YUI.Env.cssStampEl); 497 } else { 498 docEl.insertBefore(YUI.Env.cssStampEl, docEl.firstChild); 499 } 500 } else if (doc && doc.getElementById(CSS_STAMP_EL) && !YUI.Env.cssStampEl) { 501 YUI.Env.cssStampEl = doc.getElementById(CSS_STAMP_EL); 502 } 503 504 Y.config.lang = Y.config.lang || 'en-US'; 505 506 Y.config.base = YUI.config.base || Y.Env.getBase(Y.Env._BASE_RE); 507 508 if (!filter || (!('mindebug').indexOf(filter))) { 509 filter = 'min'; 510 } 511 filter = (filter) ? '-' + filter : filter; 512 Y.config.loaderPath = YUI.config.loaderPath || 'loader/loader' + filter + '.js'; 513 514 }, 515 516 /** 517 Finishes the instance setup. Attaches whatever YUI modules were defined 518 at the time that this instance was created. 519 520 @method _setup 521 @private 522 **/ 523 _setup: function() { 524 var i, Y = this, 525 core = [], 526 mods = YUI.Env.mods, 527 extras = Y.config.core || [].concat(YUI.Env.core); //Clone it.. 528 529 for (i = 0; i < extras.length; i++) { 530 if (mods[extras[i]]) { 531 core.push(extras[i]); 532 } 533 } 534 535 Y._attach(['yui-base']); 536 Y._attach(core); 537 538 if (Y.Loader) { 539 getLoader(Y); 540 } 541 542 }, 543 544 /** 545 Executes the named method on the specified YUI instance if that method is 546 whitelisted. 547 548 @method applyTo 549 @param {String} id YUI instance id. 550 @param {String} method Name of the method to execute. For example: 551 'Object.keys'. 552 @param {Array} args Arguments to apply to the method. 553 @return {Mixed} Return value from the applied method, or `null` if the 554 specified instance was not found or the method was not whitelisted. 555 **/ 556 applyTo: function(id, method, args) { 557 if (!(method in APPLY_TO_AUTH)) { 558 this.log(method + ': applyTo not allowed', 'warn', 'yui'); 559 return null; 560 } 561 562 var instance = instances[id], nest, m, i; 563 if (instance) { 564 nest = method.split('.'); 565 m = instance; 566 for (i = 0; i < nest.length; i = i + 1) { 567 m = m[nest[i]]; 568 if (!m) { 569 this.log('applyTo not found: ' + method, 'warn', 'yui'); 570 } 571 } 572 return m && m.apply(instance, args); 573 } 574 575 return null; 576 }, 577 578 /** 579 Registers a YUI module and makes it available for use in a `YUI().use()` call or 580 as a dependency for other modules. 581 582 The easiest way to create a first-class YUI module is to use 583 <a href="http://yui.github.com/shifter/">Shifter</a>, the YUI component build 584 tool. 585 586 Shifter will automatically wrap your module code in a `YUI.add()` call along 587 with any configuration info required for the module. 588 589 @example 590 591 YUI.add('davglass', function (Y) { 592 Y.davglass = function () { 593 }; 594 }, '3.4.0', { 595 requires: ['harley-davidson', 'mt-dew'] 596 }); 597 598 @method add 599 @param {String} name Module name. 600 @param {Function} fn Function containing module code. This function will be 601 executed whenever the module is attached to a specific YUI instance. 602 603 @param {YUI} fn.Y The YUI instance to which this module is attached. 604 @param {String} fn.name Name of the module 605 606 @param {String} version Module version number. This is currently used only for 607 informational purposes, and is not used internally by YUI. 608 609 @param {Object} [details] Module config. 610 @param {Array} [details.requires] Array of other module names that must be 611 attached before this module can be attached. 612 @param {Array} [details.optional] Array of optional module names that should 613 be attached before this module is attached if they've already been 614 loaded. If the `loadOptional` YUI option is `true`, optional modules 615 that have not yet been loaded will be loaded just as if they were hard 616 requirements. 617 @param {Array} [details.use] Array of module names that are included within 618 or otherwise provided by this module, and which should be attached 619 automatically when this module is attached. This makes it possible to 620 create "virtual rollup" modules that simply attach a collection of other 621 modules or submodules. 622 623 @return {YUI} This YUI instance. 624 **/ 625 add: function(name, fn, version, details) { 626 details = details || {}; 627 var env = YUI.Env, 628 mod = { 629 name: name, 630 fn: fn, 631 version: version, 632 details: details 633 }, 634 //Instance hash so we don't apply it to the same instance twice 635 applied = {}, 636 loader, inst, modInfo, 637 i, versions = env.versions; 638 639 env.mods[name] = mod; 640 versions[version] = versions[version] || {}; 641 versions[version][name] = mod; 642 643 for (i in instances) { 644 if (instances.hasOwnProperty(i)) { 645 inst = instances[i]; 646 if (!applied[inst.id]) { 647 applied[inst.id] = true; 648 loader = inst.Env._loader; 649 if (loader) { 650 modInfo = loader.getModuleInfo(name); 651 if (!modInfo || modInfo.temp) { 652 loader.addModule(details, name); 653 } 654 } 655 } 656 } 657 } 658 659 return this; 660 }, 661 662 /** 663 Executes the callback function associated with each required module, 664 attaching the module to this YUI instance. 665 666 @method _attach 667 @param {Array} r The array of modules to attach 668 @param {Boolean} [moot=false] If `true`, don't throw a warning if the module 669 is not attached. 670 @private 671 **/ 672 _attach: function(r, moot) { 673 var i, name, mod, details, req, use, after, 674 mods = YUI.Env.mods, 675 aliases = YUI.Env.aliases, 676 Y = this, j, 677 cache = YUI.Env._renderedMods, 678 loader = Y.Env._loader, 679 done = Y.Env._attached, 680 exported = Y.Env._exported, 681 len = r.length, loader, def, go, 682 c = [], 683 modArgs, esCompat, reqlen, modInfo, 684 condition, 685 __exports__, __imports__; 686 687 //Check for conditional modules (in a second+ instance) and add their requirements 688 //TODO I hate this entire method, it needs to be fixed ASAP (3.5.0) ^davglass 689 for (i = 0; i < len; i++) { 690 name = r[i]; 691 mod = mods[name]; 692 c.push(name); 693 if (loader && loader.conditions[name]) { 694 for (j in loader.conditions[name]) { 695 if (loader.conditions[name].hasOwnProperty(j)) { 696 def = loader.conditions[name][j]; 697 go = def && ((def.ua && Y.UA[def.ua]) || (def.test && def.test(Y))); 698 if (go) { 699 c.push(def.name); 700 } 701 } 702 } 703 } 704 } 705 r = c; 706 len = r.length; 707 708 for (i = 0; i < len; i++) { 709 if (!done[r[i]]) { 710 name = r[i]; 711 mod = mods[name]; 712 713 if (aliases && aliases[name] && !mod) { 714 Y._attach(aliases[name]); 715 continue; 716 } 717 if (!mod) { 718 modInfo = loader && loader.getModuleInfo(name); 719 if (modInfo) { 720 mod = modInfo; 721 moot = true; 722 } 723 724 725 //if (!loader || !loader.moduleInfo[name]) { 726 //if ((!loader || !loader.moduleInfo[name]) && !moot) { 727 if (!moot && name) { 728 if ((name.indexOf('skin-') === -1) && (name.indexOf('css') === -1)) { 729 Y.Env._missed.push(name); 730 Y.Env._missed = Y.Array.dedupe(Y.Env._missed); 731 Y.message('NOT loaded: ' + name, 'warn', 'yui'); 732 } 733 } 734 } else { 735 done[name] = true; 736 //Don't like this, but in case a mod was asked for once, then we fetch it 737 //We need to remove it from the missed list ^davglass 738 for (j = 0; j < Y.Env._missed.length; j++) { 739 if (Y.Env._missed[j] === name) { 740 Y.message('Found: ' + name + ' (was reported as missing earlier)', 'warn', 'yui'); 741 Y.Env._missed.splice(j, 1); 742 } 743 } 744 745 // Optional dependencies normally work by modifying the 746 // dependency list of a module. If the dependency's test 747 // passes it is added to the list. If not, it's not loaded. 748 // This following check ensures that optional dependencies 749 // are not attached when they were already loaded into the 750 // page (when bundling for example) 751 if (loader && !loader._canBeAttached(name)) { 752 return true; 753 } 754 755 /* 756 If it's a temp module, we need to redo it's requirements if it's already loaded 757 since it may have been loaded by another instance and it's dependencies might 758 have been redefined inside the fetched file. 759 */ 760 if (loader && cache && cache[name] && cache[name].temp) { 761 loader.getRequires(cache[name]); 762 req = []; 763 modInfo = loader.getModuleInfo(name); 764 for (j in modInfo.expanded_map) { 765 if (modInfo.expanded_map.hasOwnProperty(j)) { 766 req.push(j); 767 } 768 } 769 Y._attach(req); 770 } 771 772 details = mod.details; 773 req = details.requires; 774 esCompat = details.es; 775 use = details.use; 776 after = details.after; 777 //Force Intl load if there is a language (Loader logic) @todo fix this shit 778 if (details.lang) { 779 req = req || []; 780 req.unshift('intl'); 781 } 782 783 if (req) { 784 reqlen = req.length; 785 for (j = 0; j < reqlen; j++) { 786 if (!done[req[j]]) { 787 if (!Y._attach(req)) { 788 return false; 789 } 790 break; 791 } 792 } 793 } 794 795 if (after) { 796 for (j = 0; j < after.length; j++) { 797 if (!done[after[j]]) { 798 if (!Y._attach(after, true)) { 799 return false; 800 } 801 break; 802 } 803 } 804 } 805 806 if (mod.fn) { 807 modArgs = [Y, name]; 808 if (esCompat) { 809 __imports__ = {}; 810 __exports__ = {}; 811 // passing `exports` and `imports` onto the module function 812 modArgs.push(__imports__, __exports__); 813 if (req) { 814 reqlen = req.length; 815 for (j = 0; j < reqlen; j++) { 816 __imports__[req[j]] = exported.hasOwnProperty(req[j]) ? exported[req[j]] : Y; 817 } 818 } 819 } 820 if (Y.config.throwFail) { 821 __exports__ = mod.fn.apply(esCompat ? undefined : mod, modArgs); 822 } else { 823 try { 824 __exports__ = mod.fn.apply(esCompat ? undefined : mod, modArgs); 825 } catch (e) { 826 Y.error('Attach error: ' + name, e, name); 827 return false; 828 } 829 } 830 if (esCompat) { 831 // store the `exports` in case others `es` modules requires it 832 exported[name] = __exports__; 833 834 // If an ES module is conditionally loaded and set 835 // to be used "instead" another module, replace the 836 // trigger module's content with the conditionally 837 // loaded one so the values returned by require() 838 // still makes sense 839 condition = mod.details.condition; 840 if (condition && condition.when === 'instead') { 841 exported[condition.trigger] = __exports__; 842 } 843 } 844 } 845 846 if (use) { 847 for (j = 0; j < use.length; j++) { 848 if (!done[use[j]]) { 849 if (!Y._attach(use)) { 850 return false; 851 } 852 break; 853 } 854 } 855 } 856 857 858 859 } 860 } 861 } 862 863 return true; 864 }, 865 866 /** 867 Delays the `use` callback until another event has taken place such as 868 `window.onload`, `domready`, `contentready`, or `available`. 869 870 @private 871 @method _delayCallback 872 @param {Function} cb The original `use` callback. 873 @param {String|Object} until Either an event name ('load', 'domready', etc.) 874 or an object containing event/args keys for contentready/available. 875 @return {Function} 876 **/ 877 _delayCallback: function(cb, until) { 878 879 var Y = this, 880 mod = ['event-base']; 881 882 until = (Y.Lang.isObject(until) ? until : { event: until }); 883 884 if (until.event === 'load') { 885 mod.push('event-synthetic'); 886 } 887 888 return function() { 889 var args = arguments; 890 Y._use(mod, function() { 891 Y.on(until.event, function() { 892 args[1].delayUntil = until.event; 893 cb.apply(Y, args); 894 }, until.args); 895 }); 896 }; 897 }, 898 899 /** 900 Attaches one or more modules to this YUI instance. When this is executed, 901 the requirements of the desired modules are analyzed, and one of several 902 things can happen: 903 904 905 * All required modules have already been loaded, and just need to be 906 attached to this YUI instance. In this case, the `use()` callback will 907 be executed synchronously after the modules are attached. 908 909 * One or more modules have not yet been loaded, or the Get utility is not 910 available, or the `bootstrap` config option is `false`. In this case, 911 a warning is issued indicating that modules are missing, but all 912 available modules will still be attached and the `use()` callback will 913 be executed synchronously. 914 915 * One or more modules are missing and the Loader is not available but the 916 Get utility is, and `bootstrap` is not `false`. In this case, the Get 917 utility will be used to load the Loader, and we will then proceed to 918 the following state: 919 920 * One or more modules are missing and the Loader is available. In this 921 case, the Loader will be used to resolve the dependency tree for the 922 missing modules and load them and their dependencies. When the Loader is 923 finished loading modules, the `use()` callback will be executed 924 asynchronously. 925 926 @example 927 928 // Loads and attaches dd and its dependencies. 929 YUI().use('dd', function (Y) { 930 // ... 931 }); 932 933 // Loads and attaches dd and node as well as all of their dependencies. 934 YUI().use(['dd', 'node'], function (Y) { 935 // ... 936 }); 937 938 // Attaches all modules that have already been loaded. 939 YUI().use('*', function (Y) { 940 // ... 941 }); 942 943 // Attaches a gallery module. 944 YUI().use('gallery-yql', function (Y) { 945 // ... 946 }); 947 948 // Attaches a YUI 2in3 module. 949 YUI().use('yui2-datatable', function (Y) { 950 // ... 951 }); 952 953 @method use 954 @param {String|Array} modules* One or more module names to attach. 955 @param {Function} [callback] Callback function to be executed once all 956 specified modules and their dependencies have been attached. 957 @param {YUI} callback.Y The YUI instance created for this sandbox. 958 @param {Object} callback.status Object containing `success`, `msg` and 959 `data` properties. 960 @chainable 961 **/ 962 use: function() { 963 var args = SLICE.call(arguments, 0), 964 callback = args[args.length - 1], 965 Y = this, 966 i = 0, 967 name, 968 Env = Y.Env, 969 provisioned = true; 970 971 // The last argument supplied to use can be a load complete callback 972 if (Y.Lang.isFunction(callback)) { 973 args.pop(); 974 if (Y.config.delayUntil) { 975 callback = Y._delayCallback(callback, Y.config.delayUntil); 976 } 977 } else { 978 callback = null; 979 } 980 if (Y.Lang.isArray(args[0])) { 981 args = args[0]; 982 } 983 984 if (Y.config.cacheUse) { 985 while ((name = args[i++])) { 986 if (!Env._attached[name]) { 987 provisioned = false; 988 break; 989 } 990 } 991 992 if (provisioned) { 993 if (args.length) { 994 } 995 Y._notify(callback, ALREADY_DONE, args); 996 return Y; 997 } 998 } 999 1000 if (Y._loading) { 1001 Y._useQueue = Y._useQueue || new Y.Queue(); 1002 Y._useQueue.add([args, callback]); 1003 } else { 1004 Y._use(args, function(Y, response) { 1005 Y._notify(callback, response, args); 1006 }); 1007 } 1008 1009 return Y; 1010 }, 1011 1012 /** 1013 Sugar for loading both legacy and ES6-based YUI modules. 1014 1015 @method require 1016 @param {String} [modules*] List of module names to import or a single 1017 module name. 1018 @param {Function} callback Callback that gets called once all the modules 1019 were loaded. Each parameter of the callback is the export value of the 1020 corresponding module in the list. If the module is a legacy YUI module, 1021 the YUI instance is used instead of the module exports. 1022 @example 1023 ``` 1024 YUI().require(['es6-set'], function (Y, imports) { 1025 var Set = imports.Set, 1026 set = new Set(); 1027 }); 1028 ``` 1029 **/ 1030 require: function () { 1031 var args = SLICE.call(arguments), 1032 callback; 1033 1034 if (typeof args[args.length - 1] === 'function') { 1035 callback = args.pop(); 1036 1037 // only add the callback if one was provided 1038 // YUI().require('foo'); is valid 1039 args.push(function (Y) { 1040 var i, length = args.length, 1041 exported = Y.Env._exported, 1042 __imports__ = {}; 1043 1044 // Get only the imports requested as arguments 1045 for (i = 0; i < length; i++) { 1046 if (exported.hasOwnProperty(args[i])) { 1047 __imports__[args[i]] = exported[args[i]]; 1048 } 1049 } 1050 1051 // Using `undefined` because: 1052 // - Using `Y.config.global` would force the value of `this` to be 1053 // the global object even in strict mode 1054 // - Using `Y` goes against the goal of moving away from a shared 1055 // object and start thinking in terms of imported and exported 1056 // objects 1057 callback.call(undefined, Y, __imports__); 1058 }); 1059 } 1060 // Do not return the Y object. This makes it hard to follow this 1061 // traditional pattern: 1062 // var Y = YUI().use(...); 1063 // This is a good idea in the light of ES6 modules, to avoid working 1064 // in the global scope. 1065 // This also leaves the door open for returning a promise, once the 1066 // YUI loader is based on the ES6 loader which uses 1067 // loader.import(...).then(...) 1068 this.use.apply(this, args); 1069 }, 1070 1071 /** 1072 Handles Loader notifications about attachment/load errors. 1073 1074 @method _notify 1075 @param {Function} callback Callback to pass to `Y.config.loadErrorFn`. 1076 @param {Object} response Response returned from Loader. 1077 @param {Array} args Arguments passed from Loader. 1078 @private 1079 **/ 1080 _notify: function(callback, response, args) { 1081 if (!response.success && this.config.loadErrorFn) { 1082 this.config.loadErrorFn.call(this, this, callback, response, args); 1083 } else if (callback) { 1084 if (this.Env._missed && this.Env._missed.length) { 1085 response.msg = 'Missing modules: ' + this.Env._missed.join(); 1086 response.success = false; 1087 } 1088 if (this.config.throwFail) { 1089 callback(this, response); 1090 } else { 1091 try { 1092 callback(this, response); 1093 } catch (e) { 1094 this.error('use callback error', e, args); 1095 } 1096 } 1097 } 1098 }, 1099 1100 /** 1101 Called from the `use` method queue to ensure that only one set of loading 1102 logic is performed at a time. 1103 1104 @method _use 1105 @param {String} args* One or more modules to attach. 1106 @param {Function} [callback] Function to call once all required modules have 1107 been attached. 1108 @private 1109 **/ 1110 _use: function(args, callback) { 1111 1112 if (!this.Array) { 1113 this._attach(['yui-base']); 1114 } 1115 1116 var len, loader, handleBoot, 1117 Y = this, 1118 G_ENV = YUI.Env, 1119 mods = G_ENV.mods, 1120 Env = Y.Env, 1121 used = Env._used, 1122 aliases = G_ENV.aliases, 1123 queue = G_ENV._loaderQueue, 1124 firstArg = args[0], 1125 YArray = Y.Array, 1126 config = Y.config, 1127 boot = config.bootstrap, 1128 missing = [], 1129 i, 1130 r = [], 1131 ret = true, 1132 fetchCSS = config.fetchCSS, 1133 process = function(names, skip) { 1134 1135 var i = 0, a = [], name, len, m, req, use; 1136 1137 if (!names.length) { 1138 return; 1139 } 1140 1141 if (aliases) { 1142 len = names.length; 1143 for (i = 0; i < len; i++) { 1144 if (aliases[names[i]] && !mods[names[i]]) { 1145 a = [].concat(a, aliases[names[i]]); 1146 } else { 1147 a.push(names[i]); 1148 } 1149 } 1150 names = a; 1151 } 1152 1153 len = names.length; 1154 1155 for (i = 0; i < len; i++) { 1156 name = names[i]; 1157 if (!skip) { 1158 r.push(name); 1159 } 1160 1161 // only attach a module once 1162 if (used[name]) { 1163 continue; 1164 } 1165 1166 m = mods[name]; 1167 req = null; 1168 use = null; 1169 1170 if (m) { 1171 used[name] = true; 1172 req = m.details.requires; 1173 use = m.details.use; 1174 } else { 1175 // CSS files don't register themselves, see if it has 1176 // been loaded 1177 if (!G_ENV._loaded[VERSION][name]) { 1178 missing.push(name); 1179 } else { 1180 used[name] = true; // probably css 1181 } 1182 } 1183 1184 // make sure requirements are attached 1185 if (req && req.length) { 1186 process(req); 1187 } 1188 1189 // make sure we grab the submodule dependencies too 1190 if (use && use.length) { 1191 process(use, 1); 1192 } 1193 } 1194 1195 }, 1196 1197 handleLoader = function(fromLoader) { 1198 var response = fromLoader || { 1199 success: true, 1200 msg: 'not dynamic' 1201 }, 1202 redo, origMissing, 1203 ret = true, 1204 data = response.data; 1205 1206 Y._loading = false; 1207 1208 if (data) { 1209 origMissing = missing; 1210 missing = []; 1211 r = []; 1212 process(data); 1213 redo = missing.length; 1214 if (redo) { 1215 if ([].concat(missing).sort().join() == 1216 origMissing.sort().join()) { 1217 redo = false; 1218 } 1219 } 1220 } 1221 1222 if (redo && data) { 1223 Y._loading = true; 1224 Y._use(missing, function() { 1225 if (Y._attach(data)) { 1226 Y._notify(callback, response, data); 1227 } 1228 }); 1229 } else { 1230 if (data) { 1231 ret = Y._attach(data); 1232 } 1233 if (ret) { 1234 Y._notify(callback, response, args); 1235 } 1236 } 1237 1238 if (Y._useQueue && Y._useQueue.size() && !Y._loading) { 1239 Y._use.apply(Y, Y._useQueue.next()); 1240 } 1241 1242 }; 1243 1244 1245 // YUI().use('*'); // bind everything available 1246 if (firstArg === '*') { 1247 args = []; 1248 for (i in mods) { 1249 if (mods.hasOwnProperty(i)) { 1250 args.push(i); 1251 } 1252 } 1253 ret = Y._attach(args); 1254 if (ret) { 1255 handleLoader(); 1256 } 1257 return Y; 1258 } 1259 1260 if ((mods.loader || mods['loader-base']) && !Y.Loader) { 1261 Y._attach(['loader' + ((!mods.loader) ? '-base' : '')]); 1262 } 1263 1264 1265 // use loader to expand dependencies and sort the 1266 // requirements if it is available. 1267 if (boot && Y.Loader && args.length) { 1268 loader = getLoader(Y); 1269 loader.require(args); 1270 loader.ignoreRegistered = true; 1271 loader._boot = true; 1272 loader.calculate(null, (fetchCSS) ? null : 'js'); 1273 args = loader.sorted; 1274 loader._boot = false; 1275 } 1276 1277 process(args); 1278 1279 len = missing.length; 1280 1281 1282 if (len) { 1283 missing = YArray.dedupe(missing); 1284 len = missing.length; 1285 } 1286 1287 1288 // dynamic load 1289 if (boot && len && Y.Loader) { 1290 Y._loading = true; 1291 loader = getLoader(Y); 1292 loader.onEnd = handleLoader; 1293 loader.context = Y; 1294 loader.data = args; 1295 loader.ignoreRegistered = false; 1296 loader.require(missing); 1297 loader.insert(null, (fetchCSS) ? null : 'js'); 1298 1299 } else if (boot && len && Y.Get && !Env.bootstrapped) { 1300 1301 Y._loading = true; 1302 1303 handleBoot = function() { 1304 Y._loading = false; 1305 queue.running = false; 1306 Env.bootstrapped = true; 1307 G_ENV._bootstrapping = false; 1308 if (Y._attach(['loader'])) { 1309 Y._use(args, callback); 1310 } 1311 }; 1312 1313 if (G_ENV._bootstrapping) { 1314 queue.add(handleBoot); 1315 } else { 1316 G_ENV._bootstrapping = true; 1317 Y.Get.script(config.base + config.loaderPath, { 1318 onEnd: handleBoot 1319 }); 1320 } 1321 1322 } else { 1323 ret = Y._attach(args); 1324 if (ret) { 1325 handleLoader(); 1326 } 1327 } 1328 1329 return Y; 1330 }, 1331 1332 1333 /** 1334 Utility method for safely creating namespaces if they don't already exist. 1335 May be called statically on the YUI global object or as a method on a YUI 1336 instance. 1337 1338 When called statically, a namespace will be created on the YUI global 1339 object: 1340 1341 // Create `YUI.your.namespace.here` as nested objects, preserving any 1342 // objects that already exist instead of overwriting them. 1343 YUI.namespace('your.namespace.here'); 1344 1345 When called as a method on a YUI instance, a namespace will be created on 1346 that instance: 1347 1348 // Creates `Y.property.package`. 1349 Y.namespace('property.package'); 1350 1351 Dots in the input string cause `namespace` to create nested objects for each 1352 token. If any part of the requested namespace already exists, the current 1353 object will be left in place and will not be overwritten. This allows 1354 multiple calls to `namespace` to preserve existing namespaced properties. 1355 1356 If the first token in the namespace string is "YAHOO", that token is 1357 discarded. This is legacy behavior for backwards compatibility with YUI 2. 1358 1359 Be careful with namespace tokens. Reserved words may work in some browsers 1360 and not others. For instance, the following will fail in some browsers 1361 because the supported version of JavaScript reserves the word "long": 1362 1363 Y.namespace('really.long.nested.namespace'); 1364 1365 Note: If you pass multiple arguments to create multiple namespaces, only the 1366 last one created is returned from this function. 1367 1368 @method namespace 1369 @param {String} namespace* One or more namespaces to create. 1370 @return {Object} Reference to the last namespace object created. 1371 **/ 1372 namespace: function() { 1373 var a = arguments, o, i = 0, j, d, arg; 1374 1375 for (; i < a.length; i++) { 1376 o = this; //Reset base object per argument or it will get reused from the last 1377 arg = a[i]; 1378 if (arg.indexOf(PERIOD) > -1) { //Skip this if no "." is present 1379 d = arg.split(PERIOD); 1380 for (j = (d[0] == 'YAHOO') ? 1 : 0; j < d.length; j++) { 1381 o[d[j]] = o[d[j]] || {}; 1382 o = o[d[j]]; 1383 } 1384 } else { 1385 o[arg] = o[arg] || {}; 1386 o = o[arg]; //Reset base object to the new object so it's returned 1387 } 1388 } 1389 return o; 1390 }, 1391 1392 // this is replaced if the log module is included 1393 log: NOOP, 1394 message: NOOP, 1395 // this is replaced if the dump module is included 1396 dump: function (o) { return ''+o; }, 1397 1398 /** 1399 Reports an error. 1400 1401 The reporting mechanism is controlled by the `throwFail` configuration 1402 attribute. If `throwFail` is falsy, the message is logged. If `throwFail` is 1403 truthy, a JS exception is thrown. 1404 1405 If an `errorFn` is specified in the config it must return `true` to indicate 1406 that the exception was handled and keep it from being thrown. 1407 1408 @method error 1409 @param {String} msg Error message. 1410 @param {Error|String} [e] JavaScript error object or an error string. 1411 @param {String} [src] Source of the error (such as the name of the module in 1412 which the error occurred). 1413 @chainable 1414 **/ 1415 error: function(msg, e, src) { 1416 //TODO Add check for window.onerror here 1417 1418 var Y = this, ret; 1419 1420 if (Y.config.errorFn) { 1421 ret = Y.config.errorFn.apply(Y, arguments); 1422 } 1423 1424 if (!ret) { 1425 throw (e || new Error(msg)); 1426 } else { 1427 Y.message(msg, 'error', ''+src); // don't scrub this one 1428 } 1429 1430 return Y; 1431 }, 1432 1433 /** 1434 Generates an id string that is unique among all YUI instances in this 1435 execution context. 1436 1437 @method guid 1438 @param {String} [pre] Prefix. 1439 @return {String} Unique id. 1440 **/ 1441 guid: function(pre) { 1442 var id = this.Env._guidp + '_' + (++this.Env._uidx); 1443 return (pre) ? (pre + id) : id; 1444 }, 1445 1446 /** 1447 Returns a unique id associated with the given object and (if *readOnly* is 1448 falsy) stamps the object with that id so it can be identified in the future. 1449 1450 Stamping an object involves adding a `_yuid` property to it that contains 1451 the object's id. One exception to this is that in Internet Explorer, DOM 1452 nodes have a `uniqueID` property that contains a browser-generated unique 1453 id, which will be used instead of a YUI-generated id when available. 1454 1455 @method stamp 1456 @param {Object} o Object to stamp. 1457 @param {Boolean} readOnly If truthy and the given object has not already 1458 been stamped, the object will not be modified and `null` will be 1459 returned. 1460 @return {String} Object's unique id, or `null` if *readOnly* was truthy and 1461 the given object was not already stamped. 1462 **/ 1463 stamp: function(o, readOnly) { 1464 var uid; 1465 if (!o) { 1466 return o; 1467 } 1468 1469 // IE generates its own unique ID for dom nodes 1470 // The uniqueID property of a document node returns a new ID 1471 if (o.uniqueID && o.nodeType && o.nodeType !== 9) { 1472 uid = o.uniqueID; 1473 } else { 1474 uid = (typeof o === 'string') ? o : o._yuid; 1475 } 1476 1477 if (!uid) { 1478 uid = this.guid(); 1479 if (!readOnly) { 1480 try { 1481 o._yuid = uid; 1482 } catch (e) { 1483 uid = null; 1484 } 1485 } 1486 } 1487 return uid; 1488 }, 1489 1490 /** 1491 Destroys this YUI instance. 1492 1493 @method destroy 1494 @since 3.3.0 1495 **/ 1496 destroy: function() { 1497 var Y = this; 1498 if (Y.Event) { 1499 Y.Event._unload(); 1500 } 1501 delete instances[Y.id]; 1502 delete Y.Env; 1503 delete Y.config; 1504 } 1505 1506 /** 1507 Safe `instanceof` wrapper that works around a memory leak in IE when the 1508 object being tested is `window` or `document`. 1509 1510 Unless you are testing objects that may be `window` or `document`, you 1511 should use the native `instanceof` operator instead of this method. 1512 1513 @method instanceOf 1514 @param {Object} o Object to check. 1515 @param {Object} type Class to check against. 1516 @since 3.3.0 1517 **/ 1518 }; 1519 1520 YUI.prototype = proto; 1521 1522 // inheritance utilities are not available yet 1523 for (prop in proto) { 1524 if (proto.hasOwnProperty(prop)) { 1525 YUI[prop] = proto[prop]; 1526 } 1527 } 1528 1529 /** 1530 Applies a configuration to all YUI instances in this execution context. 1531 1532 The main use case for this method is in "mashups" where several third-party 1533 scripts need to write to a global YUI config, but cannot share a single 1534 centrally-managed config object. This way they can all call 1535 `YUI.applyConfig({})` instead of overwriting the single global config. 1536 1537 @example 1538 1539 YUI.applyConfig({ 1540 modules: { 1541 davglass: { 1542 fullpath: './davglass.js' 1543 } 1544 } 1545 }); 1546 1547 YUI.applyConfig({ 1548 modules: { 1549 foo: { 1550 fullpath: './foo.js' 1551 } 1552 } 1553 }); 1554 1555 YUI().use('davglass', function (Y) { 1556 // Module davglass will be available here. 1557 }); 1558 1559 @method applyConfig 1560 @param {Object} o Configuration object to apply. 1561 @static 1562 @since 3.5.0 1563 **/ 1564 YUI.applyConfig = function(o) { 1565 if (!o) { 1566 return; 1567 } 1568 //If there is a GlobalConfig, apply it first to set the defaults 1569 if (YUI.GlobalConfig) { 1570 this.prototype.applyConfig.call(this, YUI.GlobalConfig); 1571 } 1572 //Apply this config to it 1573 this.prototype.applyConfig.call(this, o); 1574 //Reset GlobalConfig to the combined config 1575 YUI.GlobalConfig = this.config; 1576 }; 1577 1578 // set up the environment 1579 YUI._init(); 1580 1581 if (hasWin) { 1582 add(doc, 'DOMContentLoaded', handleReady); 1583 1584 // add a window load event at load time so we can capture 1585 // the case where it fires before dynamic loading is 1586 // complete. 1587 add(window, 'load', handleLoad); 1588 } else { 1589 handleReady(); 1590 handleLoad(); 1591 } 1592 1593 YUI.Env.add = add; 1594 YUI.Env.remove = remove; 1595 1596 /*global exports*/ 1597 // Support the CommonJS method for exporting our single global 1598 if (typeof exports == 'object') { 1599 exports.YUI = YUI; 1600 /** 1601 * Set a method to be called when `Get.script` is called in Node.js 1602 * `Get` will open the file, then pass it's content and it's path 1603 * to this method before attaching it. Commonly used for code coverage 1604 * instrumentation. <strong>Calling this multiple times will only 1605 * attach the last hook method</strong>. This method is only 1606 * available in Node.js. 1607 * @method setLoadHook 1608 * @static 1609 * @param {Function} fn The function to set 1610 * @param {String} fn.data The content of the file 1611 * @param {String} fn.path The file path of the file 1612 */ 1613 YUI.setLoadHook = function(fn) { 1614 YUI._getLoadHook = fn; 1615 }; 1616 /** 1617 * Load hook for `Y.Get.script` in Node.js, see `YUI.setLoadHook` 1618 * @method _getLoadHook 1619 * @private 1620 * @param {String} data The content of the file 1621 * @param {String} path The file path of the file 1622 */ 1623 YUI._getLoadHook = null; 1624 } 1625 1626 YUI.Env[VERSION] = {}; 1627 }()); 1628 1629 1630 /** 1631 Config object that contains all of the configuration options for 1632 this `YUI` instance. 1633 1634 This object is supplied by the implementer when instantiating YUI. Some 1635 properties have default values if they are not supplied by the implementer. 1636 1637 This object should not be updated directly because some values are cached. Use 1638 `applyConfig()` to update the config object on a YUI instance that has already 1639 been configured. 1640 1641 @class config 1642 @static 1643 **/ 1644 1645 /** 1646 If `true` (the default), YUI will "bootstrap" the YUI Loader and module metadata 1647 if they're needed to load additional dependencies and aren't already available. 1648 1649 Setting this to `false` will prevent YUI from automatically loading the Loader 1650 and module metadata, so you will need to manually ensure that they're available 1651 or handle dependency resolution yourself. 1652 1653 @property {Boolean} bootstrap 1654 @default true 1655 **/ 1656 1657 /** 1658 1659 @property {Object} filters 1660 **/ 1661 1662 /** 1663 If `true`, YUI will use a combo handler to load multiple modules in as few 1664 requests as possible. 1665 1666 The YUI CDN (which YUI uses by default) supports combo handling, but other 1667 servers may not. If the server from which you're loading YUI does not support 1668 combo handling, set this to `false`. 1669 1670 Providing a value for the `base` config property will cause `combine` to default 1671 to `false` instead of `true`. 1672 1673 @property {Boolean} combine 1674 @default true 1675 */ 1676 1677 /** 1678 Array of module names that should never be dynamically loaded. 1679 1680 @property {String[]} ignore 1681 **/ 1682 1683 /** 1684 Array of module names that should always be loaded when required, even if 1685 already present on the page. 1686 1687 @property {String[]} force 1688 **/ 1689 1690 /** 1691 DOM element or id that should be used as the insertion point for dynamically 1692 added `<script>` and `<link>` nodes. 1693 1694 @property {HTMLElement|String} insertBefore 1695 **/ 1696 1697 /** 1698 Object hash containing attributes to add to dynamically added `<script>` nodes. 1699 1700 @property {Object} jsAttributes 1701 **/ 1702 1703 /** 1704 Object hash containing attributes to add to dynamically added `<link>` nodes. 1705 1706 @property {Object} cssAttributes 1707 **/ 1708 1709 /** 1710 Timeout in milliseconds before a dynamic JS or CSS request will be considered a 1711 failure. If not set, no timeout will be enforced. 1712 1713 @property {Number} timeout 1714 **/ 1715 1716 /** 1717 A hash of module definitions to add to the list of available YUI modules. These 1718 modules can then be dynamically loaded via the `use()` method. 1719 1720 This is a hash in which keys are module names and values are objects containing 1721 module metadata. 1722 1723 See `Loader.addModule()` for the supported module metadata fields. Also see 1724 `groups`, which provides a way to configure the base and combo spec for a set of 1725 modules. 1726 1727 @example 1728 1729 modules: { 1730 mymod1: { 1731 requires: ['node'], 1732 fullpath: '/mymod1/mymod1.js' 1733 }, 1734 1735 mymod2: { 1736 requires: ['mymod1'], 1737 fullpath: '/mymod2/mymod2.js' 1738 }, 1739 1740 mymod3: '/js/mymod3.js', 1741 mycssmod: '/css/mycssmod.css' 1742 } 1743 1744 @property {Object} modules 1745 **/ 1746 1747 /** 1748 Aliases are dynamic groups of modules that can be used as shortcuts. 1749 1750 @example 1751 1752 YUI({ 1753 aliases: { 1754 davglass: [ 'node', 'yql', 'dd' ], 1755 mine: [ 'davglass', 'autocomplete'] 1756 } 1757 }).use('mine', function (Y) { 1758 // Node, YQL, DD & AutoComplete available here. 1759 }); 1760 1761 @property {Object} aliases 1762 **/ 1763 1764 /** 1765 A hash of module group definitions. 1766 1767 For each group you can specify a list of modules and the base path and 1768 combo spec to use when dynamically loading the modules. 1769 1770 @example 1771 1772 groups: { 1773 yui2: { 1774 // specify whether or not this group has a combo service 1775 combine: true, 1776 1777 // The comboSeperator to use with this group's combo handler 1778 comboSep: ';', 1779 1780 // The maxURLLength for this server 1781 maxURLLength: 500, 1782 1783 // the base path for non-combo paths 1784 base: 'http://yui.yahooapis.com/2.8.0r4/build/', 1785 1786 // the path to the combo service 1787 comboBase: 'http://yui.yahooapis.com/combo?', 1788 1789 // a fragment to prepend to the path attribute when 1790 // when building combo urls 1791 root: '2.8.0r4/build/', 1792 1793 // the module definitions 1794 modules: { 1795 yui2_yde: { 1796 path: "yahoo-dom-event/yahoo-dom-event.js" 1797 }, 1798 yui2_anim: { 1799 path: "animation/animation.js", 1800 requires: ['yui2_yde'] 1801 } 1802 } 1803 } 1804 } 1805 1806 @property {Object} groups 1807 **/ 1808 1809 /** 1810 Path to the Loader JS file, relative to the `base` path. 1811 1812 This is used to dynamically bootstrap the Loader when it's needed and isn't yet 1813 available. 1814 1815 @property {String} loaderPath 1816 @default "loader/loader-min.js" 1817 **/ 1818 1819 /** 1820 If `true`, YUI will attempt to load CSS dependencies and skins. Set this to 1821 `false` to prevent YUI from loading any CSS, or set it to the string `"force"` 1822 to force CSS dependencies to be loaded even if their associated JS modules are 1823 already loaded. 1824 1825 @property {Boolean|String} fetchCSS 1826 @default true 1827 **/ 1828 1829 /** 1830 Default gallery version used to build gallery module urls. 1831 1832 @property {String} gallery 1833 @since 3.1.0 1834 **/ 1835 1836 /** 1837 Default YUI 2 version used to build YUI 2 module urls. 1838 1839 This is used for intrinsic YUI 2 support via the 2in3 project. Also see the 1840 `2in3` config for pulling different revisions of the wrapped YUI 2 modules. 1841 1842 @property {String} yui2 1843 @default "2.9.0" 1844 @since 3.1.0 1845 **/ 1846 1847 /** 1848 Revision number of YUI 2in3 modules that should be used when loading YUI 2in3. 1849 1850 @property {String} 2in3 1851 @default "4" 1852 @since 3.1.0 1853 **/ 1854 1855 /** 1856 Alternate console log function that should be used in environments without a 1857 supported native console. This function is executed with the YUI instance as its 1858 `this` object. 1859 1860 @property {Function} logFn 1861 @since 3.1.0 1862 **/ 1863 1864 /** 1865 The minimum log level to log messages for. Log levels are defined 1866 incrementally. Messages greater than or equal to the level specified will 1867 be shown. All others will be discarded. The order of log levels in 1868 increasing priority is: 1869 1870 debug 1871 info 1872 warn 1873 error 1874 1875 @property {String} logLevel 1876 @default 'debug' 1877 @since 3.10.0 1878 **/ 1879 1880 /** 1881 Callback to execute when `Y.error()` is called. It receives the error message 1882 and a JavaScript error object if one was provided. 1883 1884 This function is executed with the YUI instance as its `this` object. 1885 1886 Returning `true` from this function will prevent an exception from being thrown. 1887 1888 @property {Function} errorFn 1889 @param {String} errorFn.msg Error message 1890 @param {Object} [errorFn.err] Error object (if one was provided). 1891 @since 3.2.0 1892 **/ 1893 1894 /** 1895 A callback to execute when Loader fails to load one or more resources. 1896 1897 This could be because of a script load failure. It could also be because a 1898 module fails to register itself when the `requireRegistration` config is `true`. 1899 1900 If this function is defined, the `use()` callback will only be called when the 1901 loader succeeds. Otherwise, `use()` will always executes unless there was a 1902 JavaScript error when attaching a module. 1903 1904 @property {Function} loadErrorFn 1905 @since 3.3.0 1906 **/ 1907 1908 /** 1909 If `true`, Loader will expect all loaded scripts to be first-class YUI modules 1910 that register themselves with the YUI global, and will trigger a failure if a 1911 loaded script does not register a YUI module. 1912 1913 @property {Boolean} requireRegistration 1914 @default false 1915 @since 3.3.0 1916 **/ 1917 1918 /** 1919 Cache serviced use() requests. 1920 1921 @property {Boolean} cacheUse 1922 @default true 1923 @since 3.3.0 1924 @deprecated No longer used. 1925 **/ 1926 1927 /** 1928 Whether or not YUI should use native ES5 functionality when available for 1929 features like `Y.Array.each()`, `Y.Object()`, etc. 1930 1931 When `false`, YUI will always use its own fallback implementations instead of 1932 relying on ES5 functionality, even when ES5 functionality is available. 1933 1934 @property {Boolean} useNativeES5 1935 @default true 1936 @since 3.5.0 1937 **/ 1938 1939 /** 1940 * Leverage native JSON stringify if the browser has a native 1941 * implementation. In general, this is a good idea. See the Known Issues 1942 * section in the JSON user guide for caveats. The default value is true 1943 * for browsers with native JSON support. 1944 * 1945 * @property useNativeJSONStringify 1946 * @type Boolean 1947 * @default true 1948 * @since 3.8.0 1949 */ 1950 1951 /** 1952 * Leverage native JSON parse if the browser has a native implementation. 1953 * In general, this is a good idea. See the Known Issues section in the 1954 * JSON user guide for caveats. The default value is true for browsers with 1955 * native JSON support. 1956 * 1957 * @property useNativeJSONParse 1958 * @type Boolean 1959 * @default true 1960 * @since 3.8.0 1961 */ 1962 1963 /** 1964 Delay the `use` callback until a specific event has passed (`load`, `domready`, `contentready` or `available`) 1965 1966 @property {Object|String} delayUntil 1967 @since 3.6.0 1968 @example 1969 1970 You can use `load` or `domready` strings by default: 1971 1972 YUI({ 1973 delayUntil: 'domready' 1974 }, function (Y) { 1975 // This will not execute until 'domeready' occurs. 1976 }); 1977 1978 Or you can delay until a node is available (with `available` or `contentready`): 1979 1980 YUI({ 1981 delayUntil: { 1982 event: 'available', 1983 args : '#foo' 1984 } 1985 }, function (Y) { 1986 // This will not execute until a node matching the selector "#foo" is 1987 // available in the DOM. 1988 }); 1989 1990 **/ 1991 YUI.add('yui-base', function (Y, NAME) { 1992 1993 /* 1994 * YUI stub 1995 * @module yui 1996 * @submodule yui-base 1997 */ 1998 /** 1999 * The YUI module contains the components required for building the YUI 2000 * seed file. This includes the script loading mechanism, a simple queue, 2001 * and the core utilities for the library. 2002 * @module yui 2003 * @submodule yui-base 2004 */ 2005 2006 /** 2007 * Provides core language utilites and extensions used throughout YUI. 2008 * 2009 * @class Lang 2010 * @static 2011 */ 2012 2013 var L = Y.Lang || (Y.Lang = {}), 2014 2015 STRING_PROTO = String.prototype, 2016 TOSTRING = Object.prototype.toString, 2017 2018 TYPES = { 2019 'undefined' : 'undefined', 2020 'number' : 'number', 2021 'boolean' : 'boolean', 2022 'string' : 'string', 2023 '[object Function]': 'function', 2024 '[object RegExp]' : 'regexp', 2025 '[object Array]' : 'array', 2026 '[object Date]' : 'date', 2027 '[object Error]' : 'error' 2028 }, 2029 2030 SUBREGEX = /\{\s*([^|}]+?)\s*(?:\|([^}]*))?\s*\}/g, 2031 2032 WHITESPACE = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF", 2033 WHITESPACE_CLASS = "[\x09-\x0D\x20\xA0\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]+", 2034 TRIM_LEFT_REGEX = new RegExp("^" + WHITESPACE_CLASS), 2035 TRIM_RIGHT_REGEX = new RegExp(WHITESPACE_CLASS + "$"), 2036 TRIMREGEX = new RegExp(TRIM_LEFT_REGEX.source + "|" + TRIM_RIGHT_REGEX.source, "g"), 2037 2038 NATIVE_FN_REGEX = /\{\s*\[(?:native code|function)\]\s*\}/i; 2039 2040 // -- Protected Methods -------------------------------------------------------- 2041 2042 /** 2043 Returns `true` if the given function appears to be implemented in native code, 2044 `false` otherwise. Will always return `false` -- even in ES5-capable browsers -- 2045 if the `useNativeES5` YUI config option is set to `false`. 2046 2047 This isn't guaranteed to be 100% accurate and won't work for anything other than 2048 functions, but it can be useful for determining whether a function like 2049 `Array.prototype.forEach` is native or a JS shim provided by another library. 2050 2051 There's a great article by @kangax discussing certain flaws with this technique: 2052 <http://perfectionkills.com/detecting-built-in-host-methods/> 2053 2054 While his points are valid, it's still possible to benefit from this function 2055 as long as it's used carefully and sparingly, and in such a way that false 2056 negatives have minimal consequences. It's used internally to avoid using 2057 potentially broken non-native ES5 shims that have been added to the page by 2058 other libraries. 2059 2060 @method _isNative 2061 @param {Function} fn Function to test. 2062 @return {Boolean} `true` if _fn_ appears to be native, `false` otherwise. 2063 @static 2064 @protected 2065 @since 3.5.0 2066 **/ 2067 L._isNative = function (fn) { 2068 return !!(Y.config.useNativeES5 && fn && NATIVE_FN_REGEX.test(fn)); 2069 }; 2070 2071 // -- Public Methods ----------------------------------------------------------- 2072 2073 /** 2074 * Determines whether or not the provided item is an array. 2075 * 2076 * Returns `false` for array-like collections such as the function `arguments` 2077 * collection or `HTMLElement` collections. Use `Y.Array.test()` if you want to 2078 * test for an array-like collection. 2079 * 2080 * @method isArray 2081 * @param o The object to test. 2082 * @return {boolean} true if o is an array. 2083 * @static 2084 */ 2085 L.isArray = L._isNative(Array.isArray) ? Array.isArray : function (o) { 2086 return L.type(o) === 'array'; 2087 }; 2088 2089 /** 2090 * Determines whether or not the provided item is a boolean. 2091 * @method isBoolean 2092 * @static 2093 * @param o The object to test. 2094 * @return {boolean} true if o is a boolean. 2095 */ 2096 L.isBoolean = function(o) { 2097 return typeof o === 'boolean'; 2098 }; 2099 2100 /** 2101 * Determines whether or not the supplied item is a date instance. 2102 * @method isDate 2103 * @static 2104 * @param o The object to test. 2105 * @return {boolean} true if o is a date. 2106 */ 2107 L.isDate = function(o) { 2108 return L.type(o) === 'date' && o.toString() !== 'Invalid Date' && !isNaN(o); 2109 }; 2110 2111 /** 2112 * <p> 2113 * Determines whether or not the provided item is a function. 2114 * Note: Internet Explorer thinks certain functions are objects: 2115 * </p> 2116 * 2117 * <pre> 2118 * var obj = document.createElement("object"); 2119 * Y.Lang.isFunction(obj.getAttribute) // reports false in IE 2120 * 2121 * var input = document.createElement("input"); // append to body 2122 * Y.Lang.isFunction(input.focus) // reports false in IE 2123 * </pre> 2124 * 2125 * <p> 2126 * You will have to implement additional tests if these functions 2127 * matter to you. 2128 * </p> 2129 * 2130 * @method isFunction 2131 * @static 2132 * @param o The object to test. 2133 * @return {boolean} true if o is a function. 2134 */ 2135 L.isFunction = function(o) { 2136 return L.type(o) === 'function'; 2137 }; 2138 2139 /** 2140 * Determines whether or not the provided item is null. 2141 * @method isNull 2142 * @static 2143 * @param o The object to test. 2144 * @return {boolean} true if o is null. 2145 */ 2146 L.isNull = function(o) { 2147 return o === null; 2148 }; 2149 2150 /** 2151 * Determines whether or not the provided item is a legal number. 2152 * @method isNumber 2153 * @static 2154 * @param o The object to test. 2155 * @return {boolean} true if o is a number. 2156 */ 2157 L.isNumber = function(o) { 2158 return typeof o === 'number' && isFinite(o); 2159 }; 2160 2161 /** 2162 * Determines whether or not the provided item is of type object 2163 * or function. Note that arrays are also objects, so 2164 * <code>Y.Lang.isObject([]) === true</code>. 2165 * @method isObject 2166 * @static 2167 * @param o The object to test. 2168 * @param failfn {boolean} fail if the input is a function. 2169 * @return {boolean} true if o is an object. 2170 * @see isPlainObject 2171 */ 2172 L.isObject = function(o, failfn) { 2173 var t = typeof o; 2174 return (o && (t === 'object' || 2175 (!failfn && (t === 'function' || L.isFunction(o))))) || false; 2176 }; 2177 2178 /** 2179 * Determines whether or not the provided value is a regexp. 2180 * @method isRegExp 2181 * @static 2182 * @param value The value or object to test. 2183 * @return {boolean} true if value is a regexp. 2184 */ 2185 L.isRegExp = function(value) { 2186 return L.type(value) === 'regexp'; 2187 }; 2188 2189 /** 2190 * Determines whether or not the provided item is a string. 2191 * @method isString 2192 * @static 2193 * @param o The object to test. 2194 * @return {boolean} true if o is a string. 2195 */ 2196 L.isString = function(o) { 2197 return typeof o === 'string'; 2198 }; 2199 2200 /** 2201 * Determines whether or not the provided item is undefined. 2202 * @method isUndefined 2203 * @static 2204 * @param o The object to test. 2205 * @return {boolean} true if o is undefined. 2206 */ 2207 L.isUndefined = function(o) { 2208 return typeof o === 'undefined'; 2209 }; 2210 2211 /** 2212 * A convenience method for detecting a legitimate non-null value. 2213 * Returns false for null/undefined/NaN, true for other values, 2214 * including 0/false/'' 2215 * @method isValue 2216 * @static 2217 * @param o The item to test. 2218 * @return {boolean} true if it is not null/undefined/NaN || false. 2219 */ 2220 L.isValue = function(o) { 2221 var t = L.type(o); 2222 2223 switch (t) { 2224 case 'number': 2225 return isFinite(o); 2226 2227 case 'null': // fallthru 2228 case 'undefined': 2229 return false; 2230 2231 default: 2232 return !!t; 2233 } 2234 }; 2235 2236 /** 2237 * Returns the current time in milliseconds. 2238 * 2239 * @method now 2240 * @return {Number} Current time in milliseconds. 2241 * @static 2242 * @since 3.3.0 2243 */ 2244 L.now = Date.now || function () { 2245 return new Date().getTime(); 2246 }; 2247 2248 /** 2249 * Performs `{placeholder}` substitution on a string. The object passed as the 2250 * second parameter provides values to replace the `{placeholder}`s. 2251 * `{placeholder}` token names must match property names of the object. For example, 2252 * 2253 *`var greeting = Y.Lang.sub("Hello, {who}!", { who: "World" });` 2254 * 2255 * `{placeholder}` tokens that are undefined on the object map will be left 2256 * in tact (leaving unsightly `{placeholder}`'s in the output string). 2257 * 2258 * @method sub 2259 * @param {string} s String to be modified. 2260 * @param {object} o Object containing replacement values. 2261 * @return {string} the substitute result. 2262 * @static 2263 * @since 3.2.0 2264 */ 2265 L.sub = function(s, o) { 2266 return s.replace ? s.replace(SUBREGEX, function (match, key) { 2267 return L.isUndefined(o[key]) ? match : o[key]; 2268 }) : s; 2269 }; 2270 2271 /** 2272 * Returns a string without any leading or trailing whitespace. If 2273 * the input is not a string, the input will be returned untouched. 2274 * @method trim 2275 * @static 2276 * @param s {string} the string to trim. 2277 * @return {string} the trimmed string. 2278 */ 2279 L.trim = L._isNative(STRING_PROTO.trim) && !WHITESPACE.trim() ? function(s) { 2280 return s && s.trim ? s.trim() : s; 2281 } : function (s) { 2282 try { 2283 return s.replace(TRIMREGEX, ''); 2284 } catch (e) { 2285 return s; 2286 } 2287 }; 2288 2289 /** 2290 * Returns a string without any leading whitespace. 2291 * @method trimLeft 2292 * @static 2293 * @param s {string} the string to trim. 2294 * @return {string} the trimmed string. 2295 */ 2296 L.trimLeft = L._isNative(STRING_PROTO.trimLeft) && !WHITESPACE.trimLeft() ? function (s) { 2297 return s.trimLeft(); 2298 } : function (s) { 2299 return s.replace(TRIM_LEFT_REGEX, ''); 2300 }; 2301 2302 /** 2303 * Returns a string without any trailing whitespace. 2304 * @method trimRight 2305 * @static 2306 * @param s {string} the string to trim. 2307 * @return {string} the trimmed string. 2308 */ 2309 L.trimRight = L._isNative(STRING_PROTO.trimRight) && !WHITESPACE.trimRight() ? function (s) { 2310 return s.trimRight(); 2311 } : function (s) { 2312 return s.replace(TRIM_RIGHT_REGEX, ''); 2313 }; 2314 2315 /** 2316 Returns one of the following strings, representing the type of the item passed 2317 in: 2318 2319 * "array" 2320 * "boolean" 2321 * "date" 2322 * "error" 2323 * "function" 2324 * "null" 2325 * "number" 2326 * "object" 2327 * "regexp" 2328 * "string" 2329 * "undefined" 2330 2331 Known issues: 2332 2333 * `typeof HTMLElementCollection` returns function in Safari, but 2334 `Y.Lang.type()` reports "object", which could be a good thing -- 2335 but it actually caused the logic in <code>Y.Lang.isObject</code> to fail. 2336 2337 @method type 2338 @param o the item to test. 2339 @return {string} the detected type. 2340 @static 2341 **/ 2342 L.type = function(o) { 2343 return TYPES[typeof o] || TYPES[TOSTRING.call(o)] || (o ? 'object' : 'null'); 2344 }; 2345 /** 2346 @module yui 2347 @submodule yui-base 2348 */ 2349 2350 var Lang = Y.Lang, 2351 Native = Array.prototype, 2352 2353 hasOwn = Object.prototype.hasOwnProperty; 2354 2355 /** 2356 Provides utility methods for working with arrays. Additional array helpers can 2357 be found in the `collection` and `array-extras` modules. 2358 2359 `Y.Array(thing)` returns a native array created from _thing_. Depending on 2360 _thing_'s type, one of the following will happen: 2361 2362 * Arrays are returned unmodified unless a non-zero _startIndex_ is 2363 specified. 2364 * Array-like collections (see `Array.test()`) are converted to arrays. 2365 * For everything else, a new array is created with _thing_ as the sole 2366 item. 2367 2368 Note: elements that are also collections, such as `<form>` and `<select>` 2369 elements, are not automatically converted to arrays. To force a conversion, 2370 pass `true` as the value of the _force_ parameter. 2371 2372 @class Array 2373 @constructor 2374 @param {Any} thing The thing to arrayify. 2375 @param {Number} [startIndex=0] If non-zero and _thing_ is an array or array-like 2376 collection, a subset of items starting at the specified index will be 2377 returned. 2378 @param {Boolean} [force=false] If `true`, _thing_ will be treated as an 2379 array-like collection no matter what. 2380 @return {Array} A native array created from _thing_, according to the rules 2381 described above. 2382 **/ 2383 function YArray(thing, startIndex, force) { 2384 var len, result; 2385 2386 /*jshint expr: true*/ 2387 startIndex || (startIndex = 0); 2388 2389 if (force || YArray.test(thing)) { 2390 // IE throws when trying to slice HTMLElement collections. 2391 try { 2392 return Native.slice.call(thing, startIndex); 2393 } catch (ex) { 2394 result = []; 2395 2396 for (len = thing.length; startIndex < len; ++startIndex) { 2397 result.push(thing[startIndex]); 2398 } 2399 2400 return result; 2401 } 2402 } 2403 2404 return [thing]; 2405 } 2406 2407 Y.Array = YArray; 2408 2409 /** 2410 Dedupes an array of strings, returning an array that's guaranteed to contain 2411 only one copy of a given string. 2412 2413 This method differs from `Array.unique()` in that it's optimized for use only 2414 with arrays consisting entirely of strings or entirely of numbers, whereas 2415 `unique` may be used with other value types (but is slower). 2416 2417 Using `dedupe()` with values other than strings or numbers, or with arrays 2418 containing a mix of strings and numbers, may result in unexpected behavior. 2419 2420 @method dedupe 2421 @param {String[]|Number[]} array Array of strings or numbers to dedupe. 2422 @return {Array} Copy of _array_ containing no duplicate values. 2423 @static 2424 @since 3.4.0 2425 **/ 2426 YArray.dedupe = Lang._isNative(Object.create) ? function (array) { 2427 var hash = Object.create(null), 2428 results = [], 2429 i, item, len; 2430 2431 for (i = 0, len = array.length; i < len; ++i) { 2432 item = array[i]; 2433 2434 if (!hash[item]) { 2435 hash[item] = 1; 2436 results.push(item); 2437 } 2438 } 2439 2440 return results; 2441 } : function (array) { 2442 var hash = {}, 2443 results = [], 2444 i, item, len; 2445 2446 for (i = 0, len = array.length; i < len; ++i) { 2447 item = array[i]; 2448 2449 if (!hasOwn.call(hash, item)) { 2450 hash[item] = 1; 2451 results.push(item); 2452 } 2453 } 2454 2455 return results; 2456 }; 2457 2458 /** 2459 Executes the supplied function on each item in the array. This method wraps 2460 the native ES5 `Array.forEach()` method if available. 2461 2462 @method each 2463 @param {Array} array Array to iterate. 2464 @param {Function} fn Function to execute on each item in the array. The function 2465 will receive the following arguments: 2466 @param {Any} fn.item Current array item. 2467 @param {Number} fn.index Current array index. 2468 @param {Array} fn.array Array being iterated. 2469 @param {Object} [thisObj] `this` object to use when calling _fn_. 2470 @return {YUI} The YUI instance. 2471 @static 2472 **/ 2473 YArray.each = YArray.forEach = Lang._isNative(Native.forEach) ? function (array, fn, thisObj) { 2474 Native.forEach.call(array || [], fn, thisObj || Y); 2475 return Y; 2476 } : function (array, fn, thisObj) { 2477 for (var i = 0, len = (array && array.length) || 0; i < len; ++i) { 2478 if (i in array) { 2479 fn.call(thisObj || Y, array[i], i, array); 2480 } 2481 } 2482 2483 return Y; 2484 }; 2485 2486 /** 2487 Alias for `each()`. 2488 2489 @method forEach 2490 @static 2491 **/ 2492 2493 /** 2494 Returns an object using the first array as keys and the second as values. If 2495 the second array is not provided, or if it doesn't contain the same number of 2496 values as the first array, then `true` will be used in place of the missing 2497 values. 2498 2499 @example 2500 2501 Y.Array.hash(['a', 'b', 'c'], ['foo', 'bar']); 2502 // => {a: 'foo', b: 'bar', c: true} 2503 2504 @method hash 2505 @param {String[]} keys Array of strings to use as keys. 2506 @param {Array} [values] Array to use as values. 2507 @return {Object} Hash using the first array as keys and the second as values. 2508 @static 2509 **/ 2510 YArray.hash = function (keys, values) { 2511 var hash = {}, 2512 vlen = (values && values.length) || 0, 2513 i, len; 2514 2515 for (i = 0, len = keys.length; i < len; ++i) { 2516 if (i in keys) { 2517 hash[keys[i]] = vlen > i && i in values ? values[i] : true; 2518 } 2519 } 2520 2521 return hash; 2522 }; 2523 2524 /** 2525 Returns the index of the first item in the array that's equal (using a strict 2526 equality check) to the specified _value_, or `-1` if the value isn't found. 2527 2528 This method wraps the native ES5 `Array.indexOf()` method if available. 2529 2530 @method indexOf 2531 @param {Array} array Array to search. 2532 @param {Any} value Value to search for. 2533 @param {Number} [from=0] The index at which to begin the search. 2534 @return {Number} Index of the item strictly equal to _value_, or `-1` if not 2535 found. 2536 @static 2537 **/ 2538 YArray.indexOf = Lang._isNative(Native.indexOf) ? function (array, value, from) { 2539 return Native.indexOf.call(array, value, from); 2540 } : function (array, value, from) { 2541 // http://es5.github.com/#x15.4.4.14 2542 var len = array.length; 2543 2544 from = +from || 0; 2545 from = (from > 0 || -1) * Math.floor(Math.abs(from)); 2546 2547 if (from < 0) { 2548 from += len; 2549 2550 if (from < 0) { 2551 from = 0; 2552 } 2553 } 2554 2555 for (; from < len; ++from) { 2556 if (from in array && array[from] === value) { 2557 return from; 2558 } 2559 } 2560 2561 return -1; 2562 }; 2563 2564 /** 2565 Numeric sort convenience function. 2566 2567 The native `Array.prototype.sort()` function converts values to strings and 2568 sorts them in lexicographic order, which is unsuitable for sorting numeric 2569 values. Provide `Array.numericSort` as a custom sort function when you want 2570 to sort values in numeric order. 2571 2572 @example 2573 2574 [42, 23, 8, 16, 4, 15].sort(Y.Array.numericSort); 2575 // => [4, 8, 15, 16, 23, 42] 2576 2577 @method numericSort 2578 @param {Number} a First value to compare. 2579 @param {Number} b Second value to compare. 2580 @return {Number} Difference between _a_ and _b_. 2581 @static 2582 **/ 2583 YArray.numericSort = function (a, b) { 2584 return a - b; 2585 }; 2586 2587 /** 2588 Executes the supplied function on each item in the array. Returning a truthy 2589 value from the function will stop the processing of remaining items. 2590 2591 @method some 2592 @param {Array} array Array to iterate over. 2593 @param {Function} fn Function to execute on each item. The function will receive 2594 the following arguments: 2595 @param {Any} fn.value Current array item. 2596 @param {Number} fn.index Current array index. 2597 @param {Array} fn.array Array being iterated over. 2598 @param {Object} [thisObj] `this` object to use when calling _fn_. 2599 @return {Boolean} `true` if the function returns a truthy value on any of the 2600 items in the array; `false` otherwise. 2601 @static 2602 **/ 2603 YArray.some = Lang._isNative(Native.some) ? function (array, fn, thisObj) { 2604 return Native.some.call(array, fn, thisObj); 2605 } : function (array, fn, thisObj) { 2606 for (var i = 0, len = array.length; i < len; ++i) { 2607 if (i in array && fn.call(thisObj, array[i], i, array)) { 2608 return true; 2609 } 2610 } 2611 2612 return false; 2613 }; 2614 2615 /** 2616 Evaluates _obj_ to determine if it's an array, an array-like collection, or 2617 something else. This is useful when working with the function `arguments` 2618 collection and `HTMLElement` collections. 2619 2620 Note: This implementation doesn't consider elements that are also 2621 collections, such as `<form>` and `<select>`, to be array-like. 2622 2623 @method test 2624 @param {Object} obj Object to test. 2625 @return {Number} A number indicating the results of the test: 2626 2627 * 0: Neither an array nor an array-like collection. 2628 * 1: Real array. 2629 * 2: Array-like collection. 2630 2631 @static 2632 **/ 2633 YArray.test = function (obj) { 2634 var result = 0; 2635 2636 if (Lang.isArray(obj)) { 2637 result = 1; 2638 } else if (Lang.isObject(obj)) { 2639 try { 2640 // indexed, but no tagName (element) or scrollTo/document (window. From DOM.isWindow test which we can't use here), 2641 // or functions without apply/call (Safari 2642 // HTMLElementCollection bug). 2643 if ('length' in obj && !obj.tagName && !(obj.scrollTo && obj.document) && !obj.apply) { 2644 result = 2; 2645 } 2646 } catch (ex) {} 2647 } 2648 2649 return result; 2650 }; 2651 /** 2652 * The YUI module contains the components required for building the YUI 2653 * seed file. This includes the script loading mechanism, a simple queue, 2654 * and the core utilities for the library. 2655 * @module yui 2656 * @submodule yui-base 2657 */ 2658 2659 /** 2660 * A simple FIFO queue. Items are added to the Queue with add(1..n items) and 2661 * removed using next(). 2662 * 2663 * @class Queue 2664 * @constructor 2665 * @param {MIXED} item* 0..n items to seed the queue. 2666 */ 2667 function Queue() { 2668 this._init(); 2669 this.add.apply(this, arguments); 2670 } 2671 2672 Queue.prototype = { 2673 /** 2674 * Initialize the queue 2675 * 2676 * @method _init 2677 * @protected 2678 */ 2679 _init: function() { 2680 /** 2681 * The collection of enqueued items 2682 * 2683 * @property _q 2684 * @type Array 2685 * @protected 2686 */ 2687 this._q = []; 2688 }, 2689 2690 /** 2691 * Get the next item in the queue. FIFO support 2692 * 2693 * @method next 2694 * @return {MIXED} the next item in the queue. 2695 */ 2696 next: function() { 2697 return this._q.shift(); 2698 }, 2699 2700 /** 2701 * Get the last in the queue. LIFO support. 2702 * 2703 * @method last 2704 * @return {MIXED} the last item in the queue. 2705 */ 2706 last: function() { 2707 return this._q.pop(); 2708 }, 2709 2710 /** 2711 * Add 0..n items to the end of the queue. 2712 * 2713 * @method add 2714 * @param {MIXED} item* 0..n items. 2715 * @return {object} this queue. 2716 */ 2717 add: function() { 2718 this._q.push.apply(this._q, arguments); 2719 2720 return this; 2721 }, 2722 2723 /** 2724 * Returns the current number of queued items. 2725 * 2726 * @method size 2727 * @return {Number} The size. 2728 */ 2729 size: function() { 2730 return this._q.length; 2731 } 2732 }; 2733 2734 Y.Queue = Queue; 2735 2736 YUI.Env._loaderQueue = YUI.Env._loaderQueue || new Queue(); 2737 2738 /** 2739 The YUI module contains the components required for building the YUI seed file. 2740 This includes the script loading mechanism, a simple queue, and the core 2741 utilities for the library. 2742 2743 @module yui 2744 @submodule yui-base 2745 **/ 2746 2747 var CACHED_DELIMITER = '__', 2748 2749 hasOwn = Object.prototype.hasOwnProperty, 2750 isObject = Y.Lang.isObject; 2751 2752 /** 2753 Returns a wrapper for a function which caches the return value of that function, 2754 keyed off of the combined string representation of the argument values provided 2755 when the wrapper is called. 2756 2757 Calling this function again with the same arguments will return the cached value 2758 rather than executing the wrapped function. 2759 2760 Note that since the cache is keyed off of the string representation of arguments 2761 passed to the wrapper function, arguments that aren't strings and don't provide 2762 a meaningful `toString()` method may result in unexpected caching behavior. For 2763 example, the objects `{}` and `{foo: 'bar'}` would both be converted to the 2764 string `[object Object]` when used as a cache key. 2765 2766 @method cached 2767 @param {Function} source The function to memoize. 2768 @param {Object} [cache={}] Object in which to store cached values. You may seed 2769 this object with pre-existing cached values if desired. 2770 @param {any} [refetch] If supplied, this value is compared with the cached value 2771 using a `==` comparison. If the values are equal, the wrapped function is 2772 executed again even though a cached value exists. 2773 @return {Function} Wrapped function. 2774 @for YUI 2775 **/ 2776 Y.cached = function (source, cache, refetch) { 2777 /*jshint expr: true*/ 2778 cache || (cache = {}); 2779 2780 return function (arg) { 2781 var key = arguments.length > 1 ? 2782 Array.prototype.join.call(arguments, CACHED_DELIMITER) : 2783 String(arg); 2784 2785 /*jshint eqeqeq: false*/ 2786 if (!(key in cache) || (refetch && cache[key] == refetch)) { 2787 cache[key] = source.apply(source, arguments); 2788 } 2789 2790 return cache[key]; 2791 }; 2792 }; 2793 2794 /** 2795 Returns the `location` object from the window/frame in which this YUI instance 2796 operates, or `undefined` when executing in a non-browser environment 2797 (e.g. Node.js). 2798 2799 It is _not_ recommended to hold references to the `window.location` object 2800 outside of the scope of a function in which its properties are being accessed or 2801 its methods are being called. This is because of a nasty bug/issue that exists 2802 in both Safari and MobileSafari browsers: 2803 [WebKit Bug 34679](https://bugs.webkit.org/show_bug.cgi?id=34679). 2804 2805 @method getLocation 2806 @return {location} The `location` object from the window/frame in which this YUI 2807 instance operates. 2808 @since 3.5.0 2809 **/ 2810 Y.getLocation = function () { 2811 // It is safer to look this up every time because yui-base is attached to a 2812 // YUI instance before a user's config is applied; i.e. `Y.config.win` does 2813 // not point the correct window object when this file is loaded. 2814 var win = Y.config.win; 2815 2816 // It is not safe to hold a reference to the `location` object outside the 2817 // scope in which it is being used. The WebKit engine used in Safari and 2818 // MobileSafari will "disconnect" the `location` object from the `window` 2819 // when a page is restored from back/forward history cache. 2820 return win && win.location; 2821 }; 2822 2823 /** 2824 Returns a new object containing all of the properties of all the supplied 2825 objects. The properties from later objects will overwrite those in earlier 2826 objects. 2827 2828 Passing in a single object will create a shallow copy of it. For a deep copy, 2829 use `clone()`. 2830 2831 @method merge 2832 @param {Object} objects* One or more objects to merge. 2833 @return {Object} A new merged object. 2834 **/ 2835 Y.merge = function () { 2836 var i = 0, 2837 len = arguments.length, 2838 result = {}, 2839 key, 2840 obj; 2841 2842 for (; i < len; ++i) { 2843 obj = arguments[i]; 2844 2845 for (key in obj) { 2846 if (hasOwn.call(obj, key)) { 2847 result[key] = obj[key]; 2848 } 2849 } 2850 } 2851 2852 return result; 2853 }; 2854 2855 /** 2856 Mixes _supplier_'s properties into _receiver_. 2857 2858 Properties on _receiver_ or _receiver_'s prototype will not be overwritten or 2859 shadowed unless the _overwrite_ parameter is `true`, and will not be merged 2860 unless the _merge_ parameter is `true`. 2861 2862 In the default mode (0), only properties the supplier owns are copied (prototype 2863 properties are not copied). The following copying modes are available: 2864 2865 * `0`: _Default_. Object to object. 2866 * `1`: Prototype to prototype. 2867 * `2`: Prototype to prototype and object to object. 2868 * `3`: Prototype to object. 2869 * `4`: Object to prototype. 2870 2871 @method mix 2872 @param {Function|Object} receiver The object or function to receive the mixed 2873 properties. 2874 @param {Function|Object} supplier The object or function supplying the 2875 properties to be mixed. 2876 @param {Boolean} [overwrite=false] If `true`, properties that already exist 2877 on the receiver will be overwritten with properties from the supplier. 2878 @param {String[]} [whitelist] An array of property names to copy. If 2879 specified, only the whitelisted properties will be copied, and all others 2880 will be ignored. 2881 @param {Number} [mode=0] Mix mode to use. See above for available modes. 2882 @param {Boolean} [merge=false] If `true`, objects and arrays that already 2883 exist on the receiver will have the corresponding object/array from the 2884 supplier merged into them, rather than being skipped or overwritten. When 2885 both _overwrite_ and _merge_ are `true`, _merge_ takes precedence. 2886 @return {Function|Object|YUI} The receiver, or the YUI instance if the 2887 specified receiver is falsy. 2888 **/ 2889 Y.mix = function(receiver, supplier, overwrite, whitelist, mode, merge) { 2890 var alwaysOverwrite, exists, from, i, key, len, to; 2891 2892 // If no supplier is given, we return the receiver. If no receiver is given, 2893 // we return Y. Returning Y doesn't make much sense to me, but it's 2894 // grandfathered in for backcompat reasons. 2895 if (!receiver || !supplier) { 2896 return receiver || Y; 2897 } 2898 2899 if (mode) { 2900 // In mode 2 (prototype to prototype and object to object), we recurse 2901 // once to do the proto to proto mix. The object to object mix will be 2902 // handled later on. 2903 if (mode === 2) { 2904 Y.mix(receiver.prototype, supplier.prototype, overwrite, 2905 whitelist, 0, merge); 2906 } 2907 2908 // Depending on which mode is specified, we may be copying from or to 2909 // the prototypes of the supplier and receiver. 2910 from = mode === 1 || mode === 3 ? supplier.prototype : supplier; 2911 to = mode === 1 || mode === 4 ? receiver.prototype : receiver; 2912 2913 // If either the supplier or receiver doesn't actually have a 2914 // prototype property, then we could end up with an undefined `from` 2915 // or `to`. If that happens, we abort and return the receiver. 2916 if (!from || !to) { 2917 return receiver; 2918 } 2919 } else { 2920 from = supplier; 2921 to = receiver; 2922 } 2923 2924 // If `overwrite` is truthy and `merge` is falsy, then we can skip a 2925 // property existence check on each iteration and save some time. 2926 alwaysOverwrite = overwrite && !merge; 2927 2928 if (whitelist) { 2929 for (i = 0, len = whitelist.length; i < len; ++i) { 2930 key = whitelist[i]; 2931 2932 // We call `Object.prototype.hasOwnProperty` instead of calling 2933 // `hasOwnProperty` on the object itself, since the object's 2934 // `hasOwnProperty` method may have been overridden or removed. 2935 // Also, some native objects don't implement a `hasOwnProperty` 2936 // method. 2937 if (!hasOwn.call(from, key)) { 2938 continue; 2939 } 2940 2941 // The `key in to` check here is (sadly) intentional for backwards 2942 // compatibility reasons. It prevents undesired shadowing of 2943 // prototype members on `to`. 2944 exists = alwaysOverwrite ? false : key in to; 2945 2946 if (merge && exists && isObject(to[key], true) 2947 && isObject(from[key], true)) { 2948 // If we're in merge mode, and the key is present on both 2949 // objects, and the value on both objects is either an object or 2950 // an array (but not a function), then we recurse to merge the 2951 // `from` value into the `to` value instead of overwriting it. 2952 // 2953 // Note: It's intentional that the whitelist isn't passed to the 2954 // recursive call here. This is legacy behavior that lots of 2955 // code still depends on. 2956 Y.mix(to[key], from[key], overwrite, null, 0, merge); 2957 } else if (overwrite || !exists) { 2958 // We're not in merge mode, so we'll only copy the `from` value 2959 // to the `to` value if we're in overwrite mode or if the 2960 // current key doesn't exist on the `to` object. 2961 to[key] = from[key]; 2962 } 2963 } 2964 } else { 2965 for (key in from) { 2966 // The code duplication here is for runtime performance reasons. 2967 // Combining whitelist and non-whitelist operations into a single 2968 // loop or breaking the shared logic out into a function both result 2969 // in worse performance, and Y.mix is critical enough that the byte 2970 // tradeoff is worth it. 2971 if (!hasOwn.call(from, key)) { 2972 continue; 2973 } 2974 2975 // The `key in to` check here is (sadly) intentional for backwards 2976 // compatibility reasons. It prevents undesired shadowing of 2977 // prototype members on `to`. 2978 exists = alwaysOverwrite ? false : key in to; 2979 2980 if (merge && exists && isObject(to[key], true) 2981 && isObject(from[key], true)) { 2982 Y.mix(to[key], from[key], overwrite, null, 0, merge); 2983 } else if (overwrite || !exists) { 2984 to[key] = from[key]; 2985 } 2986 } 2987 2988 // If this is an IE browser with the JScript enumeration bug, force 2989 // enumeration of the buggy properties by making a recursive call with 2990 // the buggy properties as the whitelist. 2991 if (Y.Object._hasEnumBug) { 2992 Y.mix(to, from, overwrite, Y.Object._forceEnum, mode, merge); 2993 } 2994 } 2995 2996 return receiver; 2997 }; 2998 /** 2999 * The YUI module contains the components required for building the YUI 3000 * seed file. This includes the script loading mechanism, a simple queue, 3001 * and the core utilities for the library. 3002 * @module yui 3003 * @submodule yui-base 3004 */ 3005 3006 /** 3007 * Adds utilities to the YUI instance for working with objects. 3008 * 3009 * @class Object 3010 */ 3011 3012 var Lang = Y.Lang, 3013 hasOwn = Object.prototype.hasOwnProperty, 3014 3015 UNDEFINED, // <-- Note the comma. We're still declaring vars. 3016 3017 /** 3018 * Returns a new object that uses _obj_ as its prototype. This method wraps the 3019 * native ES5 `Object.create()` method if available, but doesn't currently 3020 * pass through `Object.create()`'s second argument (properties) in order to 3021 * ensure compatibility with older browsers. 3022 * 3023 * @method () 3024 * @param {Object} obj Prototype object. 3025 * @return {Object} New object using _obj_ as its prototype. 3026 * @static 3027 */ 3028 O = Y.Object = Lang._isNative(Object.create) ? function (obj) { 3029 // We currently wrap the native Object.create instead of simply aliasing it 3030 // to ensure consistency with our fallback shim, which currently doesn't 3031 // support Object.create()'s second argument (properties). Once we have a 3032 // safe fallback for the properties arg, we can stop wrapping 3033 // Object.create(). 3034 return Object.create(obj); 3035 } : (function () { 3036 // Reusable constructor function for the Object.create() shim. 3037 function F() {} 3038 3039 // The actual shim. 3040 return function (obj) { 3041 F.prototype = obj; 3042 return new F(); 3043 }; 3044 }()), 3045 3046 /** 3047 * Property names that IE doesn't enumerate in for..in loops, even when they 3048 * should be enumerable. When `_hasEnumBug` is `true`, it's necessary to 3049 * manually enumerate these properties. 3050 * 3051 * @property _forceEnum 3052 * @type String[] 3053 * @protected 3054 * @static 3055 */ 3056 forceEnum = O._forceEnum = [ 3057 'hasOwnProperty', 3058 'isPrototypeOf', 3059 'propertyIsEnumerable', 3060 'toString', 3061 'toLocaleString', 3062 'valueOf' 3063 ], 3064 3065 /** 3066 * `true` if this browser has the JScript enumeration bug that prevents 3067 * enumeration of the properties named in the `_forceEnum` array, `false` 3068 * otherwise. 3069 * 3070 * See: 3071 * - <https://developer.mozilla.org/en/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug> 3072 * - <http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation> 3073 * 3074 * @property _hasEnumBug 3075 * @type Boolean 3076 * @protected 3077 * @static 3078 */ 3079 hasEnumBug = O._hasEnumBug = !{valueOf: 0}.propertyIsEnumerable('valueOf'), 3080 3081 /** 3082 * `true` if this browser incorrectly considers the `prototype` property of 3083 * functions to be enumerable. Currently known to affect Opera 11.50 and Android 2.3.x. 3084 * 3085 * @property _hasProtoEnumBug 3086 * @type Boolean 3087 * @protected 3088 * @static 3089 */ 3090 hasProtoEnumBug = O._hasProtoEnumBug = (function () {}).propertyIsEnumerable('prototype'), 3091 3092 /** 3093 * Returns `true` if _key_ exists on _obj_, `false` if _key_ doesn't exist or 3094 * exists only on _obj_'s prototype. This is essentially a safer version of 3095 * `obj.hasOwnProperty()`. 3096 * 3097 * @method owns 3098 * @param {Object} obj Object to test. 3099 * @param {String} key Property name to look for. 3100 * @return {Boolean} `true` if _key_ exists on _obj_, `false` otherwise. 3101 * @static 3102 */ 3103 owns = O.owns = function (obj, key) { 3104 return !!obj && hasOwn.call(obj, key); 3105 }; // <-- End of var declarations. 3106 3107 /** 3108 * Alias for `owns()`. 3109 * 3110 * @method hasKey 3111 * @param {Object} obj Object to test. 3112 * @param {String} key Property name to look for. 3113 * @return {Boolean} `true` if _key_ exists on _obj_, `false` otherwise. 3114 * @static 3115 */ 3116 O.hasKey = owns; 3117 3118 /** 3119 * Returns an array containing the object's enumerable keys. Does not include 3120 * prototype keys or non-enumerable keys. 3121 * 3122 * Note that keys are returned in enumeration order (that is, in the same order 3123 * that they would be enumerated by a `for-in` loop), which may not be the same 3124 * as the order in which they were defined. 3125 * 3126 * This method is an alias for the native ES5 `Object.keys()` method if 3127 * available and non-buggy. The Opera 11.50 and Android 2.3.x versions of 3128 * `Object.keys()` have an inconsistency as they consider `prototype` to be 3129 * enumerable, so a non-native shim is used to rectify the difference. 3130 * 3131 * @example 3132 * 3133 * Y.Object.keys({a: 'foo', b: 'bar', c: 'baz'}); 3134 * // => ['a', 'b', 'c'] 3135 * 3136 * @method keys 3137 * @param {Object} obj An object. 3138 * @return {String[]} Array of keys. 3139 * @static 3140 */ 3141 O.keys = Lang._isNative(Object.keys) && !hasProtoEnumBug ? Object.keys : function (obj) { 3142 if (!Lang.isObject(obj)) { 3143 throw new TypeError('Object.keys called on a non-object'); 3144 } 3145 3146 var keys = [], 3147 i, key, len; 3148 3149 if (hasProtoEnumBug && typeof obj === 'function') { 3150 for (key in obj) { 3151 if (owns(obj, key) && key !== 'prototype') { 3152 keys.push(key); 3153 } 3154 } 3155 } else { 3156 for (key in obj) { 3157 if (owns(obj, key)) { 3158 keys.push(key); 3159 } 3160 } 3161 } 3162 3163 if (hasEnumBug) { 3164 for (i = 0, len = forceEnum.length; i < len; ++i) { 3165 key = forceEnum[i]; 3166 3167 if (owns(obj, key)) { 3168 keys.push(key); 3169 } 3170 } 3171 } 3172 3173 return keys; 3174 }; 3175 3176 /** 3177 * Returns an array containing the values of the object's enumerable keys. 3178 * 3179 * Note that values are returned in enumeration order (that is, in the same 3180 * order that they would be enumerated by a `for-in` loop), which may not be the 3181 * same as the order in which they were defined. 3182 * 3183 * @example 3184 * 3185 * Y.Object.values({a: 'foo', b: 'bar', c: 'baz'}); 3186 * // => ['foo', 'bar', 'baz'] 3187 * 3188 * @method values 3189 * @param {Object} obj An object. 3190 * @return {Array} Array of values. 3191 * @static 3192 */ 3193 O.values = function (obj) { 3194 var keys = O.keys(obj), 3195 i = 0, 3196 len = keys.length, 3197 values = []; 3198 3199 for (; i < len; ++i) { 3200 values.push(obj[keys[i]]); 3201 } 3202 3203 return values; 3204 }; 3205 3206 /** 3207 * Returns the number of enumerable keys owned by an object. 3208 * 3209 * @method size 3210 * @param {Object} obj An object. 3211 * @return {Number} The object's size. 3212 * @static 3213 */ 3214 O.size = function (obj) { 3215 try { 3216 return O.keys(obj).length; 3217 } catch (ex) { 3218 return 0; // Legacy behavior for non-objects. 3219 } 3220 }; 3221 3222 /** 3223 * Returns `true` if the object owns an enumerable property with the specified 3224 * value. 3225 * 3226 * @method hasValue 3227 * @param {Object} obj An object. 3228 * @param {any} value The value to search for. 3229 * @return {Boolean} `true` if _obj_ contains _value_, `false` otherwise. 3230 * @static 3231 */ 3232 O.hasValue = function (obj, value) { 3233 return Y.Array.indexOf(O.values(obj), value) > -1; 3234 }; 3235 3236 /** 3237 * Executes a function on each enumerable property in _obj_. The function 3238 * receives the value, the key, and the object itself as parameters (in that 3239 * order). 3240 * 3241 * By default, only properties owned by _obj_ are enumerated. To include 3242 * prototype properties, set the _proto_ parameter to `true`. 3243 * 3244 * @method each 3245 * @param {Object} obj Object to enumerate. 3246 * @param {Function} fn Function to execute on each enumerable property. 3247 * @param {mixed} fn.value Value of the current property. 3248 * @param {String} fn.key Key of the current property. 3249 * @param {Object} fn.obj Object being enumerated. 3250 * @param {Object} [thisObj] `this` object to use when calling _fn_. 3251 * @param {Boolean} [proto=false] Include prototype properties. 3252 * @return {YUI} the YUI instance. 3253 * @chainable 3254 * @static 3255 */ 3256 O.each = function (obj, fn, thisObj, proto) { 3257 var key; 3258 3259 for (key in obj) { 3260 if (proto || owns(obj, key)) { 3261 fn.call(thisObj || Y, obj[key], key, obj); 3262 } 3263 } 3264 3265 return Y; 3266 }; 3267 3268 /** 3269 * Executes a function on each enumerable property in _obj_, but halts if the 3270 * function returns a truthy value. The function receives the value, the key, 3271 * and the object itself as paramters (in that order). 3272 * 3273 * By default, only properties owned by _obj_ are enumerated. To include 3274 * prototype properties, set the _proto_ parameter to `true`. 3275 * 3276 * @method some 3277 * @param {Object} obj Object to enumerate. 3278 * @param {Function} fn Function to execute on each enumerable property. 3279 * @param {mixed} fn.value Value of the current property. 3280 * @param {String} fn.key Key of the current property. 3281 * @param {Object} fn.obj Object being enumerated. 3282 * @param {Object} [thisObj] `this` object to use when calling _fn_. 3283 * @param {Boolean} [proto=false] Include prototype properties. 3284 * @return {Boolean} `true` if any execution of _fn_ returns a truthy value, 3285 * `false` otherwise. 3286 * @static 3287 */ 3288 O.some = function (obj, fn, thisObj, proto) { 3289 var key; 3290 3291 for (key in obj) { 3292 if (proto || owns(obj, key)) { 3293 if (fn.call(thisObj || Y, obj[key], key, obj)) { 3294 return true; 3295 } 3296 } 3297 } 3298 3299 return false; 3300 }; 3301 3302 /** 3303 * Retrieves the sub value at the provided path, 3304 * from the value object provided. 3305 * 3306 * @method getValue 3307 * @static 3308 * @param o The object from which to extract the property value. 3309 * @param path {Array} A path array, specifying the object traversal path 3310 * from which to obtain the sub value. 3311 * @return {Any} The value stored in the path, undefined if not found, 3312 * undefined if the source is not an object. Returns the source object 3313 * if an empty path is provided. 3314 */ 3315 O.getValue = function(o, path) { 3316 if (!Lang.isObject(o)) { 3317 return UNDEFINED; 3318 } 3319 3320 var i, 3321 p = Y.Array(path), 3322 l = p.length; 3323 3324 for (i = 0; o !== UNDEFINED && i < l; i++) { 3325 o = o[p[i]]; 3326 } 3327 3328 return o; 3329 }; 3330 3331 /** 3332 * Sets the sub-attribute value at the provided path on the 3333 * value object. Returns the modified value object, or 3334 * undefined if the path is invalid. 3335 * 3336 * @method setValue 3337 * @static 3338 * @param o The object on which to set the sub value. 3339 * @param path {Array} A path array, specifying the object traversal path 3340 * at which to set the sub value. 3341 * @param val {Any} The new value for the sub-attribute. 3342 * @return {Object} The modified object, with the new sub value set, or 3343 * undefined, if the path was invalid. 3344 */ 3345 O.setValue = function(o, path, val) { 3346 var i, 3347 p = Y.Array(path), 3348 leafIdx = p.length - 1, 3349 ref = o; 3350 3351 if (leafIdx >= 0) { 3352 for (i = 0; ref !== UNDEFINED && i < leafIdx; i++) { 3353 ref = ref[p[i]]; 3354 } 3355 3356 if (ref !== UNDEFINED) { 3357 ref[p[i]] = val; 3358 } else { 3359 return UNDEFINED; 3360 } 3361 } 3362 3363 return o; 3364 }; 3365 3366 /** 3367 * Returns `true` if the object has no enumerable properties of its own. 3368 * 3369 * @method isEmpty 3370 * @param {Object} obj An object. 3371 * @return {Boolean} `true` if the object is empty. 3372 * @static 3373 * @since 3.2.0 3374 */ 3375 O.isEmpty = function (obj) { 3376 return !O.keys(Object(obj)).length; 3377 }; 3378 /** 3379 * The YUI module contains the components required for building the YUI seed 3380 * file. This includes the script loading mechanism, a simple queue, and the 3381 * core utilities for the library. 3382 * @module yui 3383 * @submodule yui-base 3384 */ 3385 3386 /** 3387 * YUI user agent detection. 3388 * Do not fork for a browser if it can be avoided. Use feature detection when 3389 * you can. Use the user agent as a last resort. For all fields listed 3390 * as @type float, UA stores a version number for the browser engine, 3391 * 0 otherwise. This value may or may not map to the version number of 3392 * the browser using the engine. The value is presented as a float so 3393 * that it can easily be used for boolean evaluation as well as for 3394 * looking for a particular range of versions. Because of this, 3395 * some of the granularity of the version info may be lost. The fields that 3396 * are @type string default to null. The API docs list the values that 3397 * these fields can have. 3398 * @class UA 3399 * @static 3400 */ 3401 3402 /** 3403 * Static method on `YUI.Env` for parsing a UA string. Called at instantiation 3404 * to populate `Y.UA`. 3405 * 3406 * @static 3407 * @method parseUA 3408 * @param {String} [subUA=navigator.userAgent] UA string to parse 3409 * @return {Object} The Y.UA object 3410 */ 3411 YUI.Env.parseUA = function(subUA) { 3412 3413 var numberify = function(s) { 3414 var c = 0; 3415 return parseFloat(s.replace(/\./g, function() { 3416 return (c++ === 1) ? '' : '.'; 3417 })); 3418 }, 3419 3420 win = Y.config.win, 3421 3422 nav = win && win.navigator, 3423 3424 o = { 3425 3426 /** 3427 * Internet Explorer version number or 0. Example: 6 3428 * @property ie 3429 * @type float 3430 * @static 3431 */ 3432 ie: 0, 3433 3434 /** 3435 * Opera version number or 0. Example: 9.2 3436 * @property opera 3437 * @type float 3438 * @static 3439 */ 3440 opera: 0, 3441 3442 /** 3443 * Gecko engine revision number. Will evaluate to 1 if Gecko 3444 * is detected but the revision could not be found. Other browsers 3445 * will be 0. Example: 1.8 3446 * <pre> 3447 * Firefox 1.0.0.4: 1.7.8 <-- Reports 1.7 3448 * Firefox 1.5.0.9: 1.8.0.9 <-- 1.8 3449 * Firefox 2.0.0.3: 1.8.1.3 <-- 1.81 3450 * Firefox 3.0 <-- 1.9 3451 * Firefox 3.5 <-- 1.91 3452 * </pre> 3453 * @property gecko 3454 * @type float 3455 * @static 3456 */ 3457 gecko: 0, 3458 3459 /** 3460 * AppleWebKit version. KHTML browsers that are not WebKit browsers 3461 * will evaluate to 1, other browsers 0. Example: 418.9 3462 * <pre> 3463 * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the 3464 * latest available for Mac OSX 10.3. 3465 * Safari 2.0.2: 416 <-- hasOwnProperty introduced 3466 * Safari 2.0.4: 418 <-- preventDefault fixed 3467 * Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run 3468 * different versions of webkit 3469 * Safari 2.0.4 (419.3): 419 <-- Tiger installations that have been 3470 * updated, but not updated 3471 * to the latest patch. 3472 * Webkit 212 nightly: 522+ <-- Safari 3.0 precursor (with native 3473 * SVG and many major issues fixed). 3474 * Safari 3.0.4 (523.12) 523.12 <-- First Tiger release - automatic 3475 * update from 2.x via the 10.4.11 OS patch. 3476 * Webkit nightly 1/2008:525+ <-- Supports DOMContentLoaded event. 3477 * yahoo.com user agent hack removed. 3478 * </pre> 3479 * http://en.wikipedia.org/wiki/Safari_version_history 3480 * @property webkit 3481 * @type float 3482 * @static 3483 */ 3484 webkit: 0, 3485 3486 /** 3487 * Safari will be detected as webkit, but this property will also 3488 * be populated with the Safari version number 3489 * @property safari 3490 * @type float 3491 * @static 3492 */ 3493 safari: 0, 3494 3495 /** 3496 * Chrome will be detected as webkit, but this property will also 3497 * be populated with the Chrome version number 3498 * @property chrome 3499 * @type float 3500 * @static 3501 */ 3502 chrome: 0, 3503 3504 /** 3505 * The mobile property will be set to a string containing any relevant 3506 * user agent information when a modern mobile browser is detected. 3507 * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series 3508 * devices with the WebKit-based browser, and Opera Mini. 3509 * @property mobile 3510 * @type string 3511 * @default null 3512 * @static 3513 */ 3514 mobile: null, 3515 3516 /** 3517 * Adobe AIR version number or 0. Only populated if webkit is detected. 3518 * Example: 1.0 3519 * @property air 3520 * @type float 3521 */ 3522 air: 0, 3523 /** 3524 * PhantomJS version number or 0. Only populated if webkit is detected. 3525 * Example: 1.0 3526 * @property phantomjs 3527 * @type float 3528 */ 3529 phantomjs: 0, 3530 /** 3531 * Detects Apple iPad's OS version 3532 * @property ipad 3533 * @type float 3534 * @static 3535 */ 3536 ipad: 0, 3537 /** 3538 * Detects Apple iPhone's OS version 3539 * @property iphone 3540 * @type float 3541 * @static 3542 */ 3543 iphone: 0, 3544 /** 3545 * Detects Apples iPod's OS version 3546 * @property ipod 3547 * @type float 3548 * @static 3549 */ 3550 ipod: 0, 3551 /** 3552 * General truthy check for iPad, iPhone or iPod 3553 * @property ios 3554 * @type Boolean 3555 * @default null 3556 * @static 3557 */ 3558 ios: null, 3559 /** 3560 * Detects Googles Android OS version 3561 * @property android 3562 * @type float 3563 * @static 3564 */ 3565 android: 0, 3566 /** 3567 * Detects Kindle Silk 3568 * @property silk 3569 * @type float 3570 * @static 3571 */ 3572 silk: 0, 3573 /** 3574 * Detects Ubuntu version 3575 * @property ubuntu 3576 * @type float 3577 * @static 3578 */ 3579 ubuntu: 0, 3580 /** 3581 * Detects Kindle Silk Acceleration 3582 * @property accel 3583 * @type Boolean 3584 * @static 3585 */ 3586 accel: false, 3587 /** 3588 * Detects Palms WebOS version 3589 * @property webos 3590 * @type float 3591 * @static 3592 */ 3593 webos: 0, 3594 3595 /** 3596 * Google Caja version number or 0. 3597 * @property caja 3598 * @type float 3599 */ 3600 caja: nav && nav.cajaVersion, 3601 3602 /** 3603 * Set to true if the page appears to be in SSL 3604 * @property secure 3605 * @type boolean 3606 * @static 3607 */ 3608 secure: false, 3609 3610 /** 3611 * The operating system. Currently only detecting windows or macintosh 3612 * @property os 3613 * @type string 3614 * @default null 3615 * @static 3616 */ 3617 os: null, 3618 3619 /** 3620 * The Nodejs Version 3621 * @property nodejs 3622 * @type float 3623 * @default 0 3624 * @static 3625 */ 3626 nodejs: 0, 3627 /** 3628 * Window8/IE10 Application host environment 3629 * @property winjs 3630 * @type Boolean 3631 * @static 3632 */ 3633 winjs: !!((typeof Windows !== "undefined") && Windows.System), 3634 /** 3635 * Are touch/msPointer events available on this device 3636 * @property touchEnabled 3637 * @type Boolean 3638 * @static 3639 */ 3640 touchEnabled: false 3641 }, 3642 3643 ua = subUA || nav && nav.userAgent, 3644 3645 loc = win && win.location, 3646 3647 href = loc && loc.href, 3648 3649 m; 3650 3651 /** 3652 * The User Agent string that was parsed 3653 * @property userAgent 3654 * @type String 3655 * @static 3656 */ 3657 o.userAgent = ua; 3658 3659 3660 o.secure = href && (href.toLowerCase().indexOf('https') === 0); 3661 3662 if (ua) { 3663 3664 if ((/windows|win32/i).test(ua)) { 3665 o.os = 'windows'; 3666 } else if ((/macintosh|mac_powerpc/i).test(ua)) { 3667 o.os = 'macintosh'; 3668 } else if ((/android/i).test(ua)) { 3669 o.os = 'android'; 3670 } else if ((/symbos/i).test(ua)) { 3671 o.os = 'symbos'; 3672 } else if ((/linux/i).test(ua)) { 3673 o.os = 'linux'; 3674 } else if ((/rhino/i).test(ua)) { 3675 o.os = 'rhino'; 3676 } 3677 3678 // Modern KHTML browsers should qualify as Safari X-Grade 3679 if ((/KHTML/).test(ua)) { 3680 o.webkit = 1; 3681 } 3682 if ((/IEMobile|XBLWP7/).test(ua)) { 3683 o.mobile = 'windows'; 3684 } 3685 if ((/Fennec/).test(ua)) { 3686 o.mobile = 'gecko'; 3687 } 3688 // Modern WebKit browsers are at least X-Grade 3689 m = ua.match(/AppleWebKit\/([^\s]*)/); 3690 if (m && m[1]) { 3691 o.webkit = numberify(m[1]); 3692 o.safari = o.webkit; 3693 3694 if (/PhantomJS/.test(ua)) { 3695 m = ua.match(/PhantomJS\/([^\s]*)/); 3696 if (m && m[1]) { 3697 o.phantomjs = numberify(m[1]); 3698 } 3699 } 3700 3701 // Mobile browser check 3702 if (/ Mobile\//.test(ua) || (/iPad|iPod|iPhone/).test(ua)) { 3703 o.mobile = 'Apple'; // iPhone or iPod Touch 3704 3705 m = ua.match(/OS ([^\s]*)/); 3706 if (m && m[1]) { 3707 m = numberify(m[1].replace('_', '.')); 3708 } 3709 o.ios = m; 3710 o.os = 'ios'; 3711 o.ipad = o.ipod = o.iphone = 0; 3712 3713 m = ua.match(/iPad|iPod|iPhone/); 3714 if (m && m[0]) { 3715 o[m[0].toLowerCase()] = o.ios; 3716 } 3717 } else { 3718 m = ua.match(/NokiaN[^\/]*|webOS\/\d\.\d/); 3719 if (m) { 3720 // Nokia N-series, webOS, ex: NokiaN95 3721 o.mobile = m[0]; 3722 } 3723 if (/webOS/.test(ua)) { 3724 o.mobile = 'WebOS'; 3725 m = ua.match(/webOS\/([^\s]*);/); 3726 if (m && m[1]) { 3727 o.webos = numberify(m[1]); 3728 } 3729 } 3730 if (/ Android/.test(ua)) { 3731 if (/Mobile/.test(ua)) { 3732 o.mobile = 'Android'; 3733 } 3734 m = ua.match(/Android ([^\s]*);/); 3735 if (m && m[1]) { 3736 o.android = numberify(m[1]); 3737 } 3738 3739 } 3740 if (/Silk/.test(ua)) { 3741 m = ua.match(/Silk\/([^\s]*)/); 3742 if (m && m[1]) { 3743 o.silk = numberify(m[1]); 3744 } 3745 if (!o.android) { 3746 o.android = 2.34; //Hack for desktop mode in Kindle 3747 o.os = 'Android'; 3748 } 3749 if (/Accelerated=true/.test(ua)) { 3750 o.accel = true; 3751 } 3752 } 3753 } 3754 3755 m = ua.match(/OPR\/(\d+\.\d+)/); 3756 3757 if (m && m[1]) { 3758 // Opera 15+ with Blink (pretends to be both Chrome and Safari) 3759 o.opera = numberify(m[1]); 3760 } else { 3761 m = ua.match(/(Chrome|CrMo|CriOS)\/([^\s]*)/); 3762 3763 if (m && m[1] && m[2]) { 3764 o.chrome = numberify(m[2]); // Chrome 3765 o.safari = 0; //Reset safari back to 0 3766 if (m[1] === 'CrMo') { 3767 o.mobile = 'chrome'; 3768 } 3769 } else { 3770 m = ua.match(/AdobeAIR\/([^\s]*)/); 3771 if (m) { 3772 o.air = m[0]; // Adobe AIR 1.0 or better 3773 } 3774 } 3775 } 3776 } 3777 3778 m = ua.match(/Ubuntu\ (\d+\.\d+)/); 3779 if (m && m[1]) { 3780 3781 o.os = 'linux'; 3782 o.ubuntu = numberify(m[1]); 3783 3784 m = ua.match(/\ WebKit\/([^\s]*)/); 3785 if (m && m[1]) { 3786 o.webkit = numberify(m[1]); 3787 } 3788 m = ua.match(/\ Chromium\/([^\s]*)/); 3789 if (m && m[1]) { 3790 o.chrome = numberify(m[1]); 3791 } 3792 if (/ Mobile$/.test(ua)) { 3793 o.mobile = 'Ubuntu'; 3794 } 3795 } 3796 3797 if (!o.webkit) { // not webkit 3798 // @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr) 3799 if (/Opera/.test(ua)) { 3800 m = ua.match(/Opera[\s\/]([^\s]*)/); 3801 if (m && m[1]) { 3802 o.opera = numberify(m[1]); 3803 } 3804 m = ua.match(/Version\/([^\s]*)/); 3805 if (m && m[1]) { 3806 o.opera = numberify(m[1]); // opera 10+ 3807 } 3808 3809 if (/Opera Mobi/.test(ua)) { 3810 o.mobile = 'opera'; 3811 m = ua.replace('Opera Mobi', '').match(/Opera ([^\s]*)/); 3812 if (m && m[1]) { 3813 o.opera = numberify(m[1]); 3814 } 3815 } 3816 m = ua.match(/Opera Mini[^;]*/); 3817 3818 if (m) { 3819 o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316 3820 } 3821 } else { // not opera or webkit 3822 m = ua.match(/MSIE ([^;]*)|Trident.*; rv:([0-9.]+)/); 3823 3824 if (m && (m[1] || m[2])) { 3825 o.ie = numberify(m[1] || m[2]); 3826 } else { // not opera, webkit, or ie 3827 m = ua.match(/Gecko\/([^\s]*)/); 3828 3829 if (m) { 3830 o.gecko = 1; // Gecko detected, look for revision 3831 m = ua.match(/rv:([^\s\)]*)/); 3832 if (m && m[1]) { 3833 o.gecko = numberify(m[1]); 3834 if (/Mobile|Tablet/.test(ua)) { 3835 o.mobile = "ffos"; 3836 } 3837 } 3838 } 3839 } 3840 } 3841 } 3842 } 3843 3844 //Check for known properties to tell if touch events are enabled on this device or if 3845 //the number of MSPointer touchpoints on this device is greater than 0. 3846 if (win && nav && !(o.chrome && o.chrome < 6)) { 3847 o.touchEnabled = (("ontouchstart" in win) || (("msMaxTouchPoints" in nav) && (nav.msMaxTouchPoints > 0))); 3848 } 3849 3850 //It was a parsed UA, do not assign the global value. 3851 if (!subUA) { 3852 3853 if (typeof process === 'object') { 3854 3855 if (process.versions && process.versions.node) { 3856 //NodeJS 3857 o.os = process.platform; 3858 o.nodejs = numberify(process.versions.node); 3859 } 3860 } 3861 3862 YUI.Env.UA = o; 3863 3864 } 3865 3866 return o; 3867 }; 3868 3869 3870 Y.UA = YUI.Env.UA || YUI.Env.parseUA(); 3871 3872 /** 3873 Performs a simple comparison between two version numbers, accounting for 3874 standard versioning logic such as the fact that "535.8" is a lower version than 3875 "535.24", even though a simple numerical comparison would indicate that it's 3876 greater. Also accounts for cases such as "1.1" vs. "1.1.0", which are 3877 considered equivalent. 3878 3879 Returns -1 if version _a_ is lower than version _b_, 0 if they're equivalent, 3880 1 if _a_ is higher than _b_. 3881 3882 Versions may be numbers or strings containing numbers and dots. For example, 3883 both `535` and `"535.8.10"` are acceptable. A version string containing 3884 non-numeric characters, like `"535.8.beta"`, may produce unexpected results. 3885 3886 @method compareVersions 3887 @param {Number|String} a First version number to compare. 3888 @param {Number|String} b Second version number to compare. 3889 @return -1 if _a_ is lower than _b_, 0 if they're equivalent, 1 if _a_ is 3890 higher than _b_. 3891 **/ 3892 Y.UA.compareVersions = function (a, b) { 3893 var aPart, aParts, bPart, bParts, i, len; 3894 3895 if (a === b) { 3896 return 0; 3897 } 3898 3899 aParts = (a + '').split('.'); 3900 bParts = (b + '').split('.'); 3901 3902 for (i = 0, len = Math.max(aParts.length, bParts.length); i < len; ++i) { 3903 aPart = parseInt(aParts[i], 10); 3904 bPart = parseInt(bParts[i], 10); 3905 3906 /*jshint expr: true*/ 3907 isNaN(aPart) && (aPart = 0); 3908 isNaN(bPart) && (bPart = 0); 3909 3910 if (aPart < bPart) { 3911 return -1; 3912 } 3913 3914 if (aPart > bPart) { 3915 return 1; 3916 } 3917 } 3918 3919 return 0; 3920 }; 3921 YUI.Env.aliases = { 3922 "anim": ["anim-base","anim-color","anim-curve","anim-easing","anim-node-plugin","anim-scroll","anim-xy"], 3923 "anim-shape-transform": ["anim-shape"], 3924 "app": ["app-base","app-content","app-transitions","lazy-model-list","model","model-list","model-sync-rest","model-sync-local","router","view","view-node-map"], 3925 "attribute": ["attribute-base","attribute-complex"], 3926 "attribute-events": ["attribute-observable"], 3927 "autocomplete": ["autocomplete-base","autocomplete-sources","autocomplete-list","autocomplete-plugin"], 3928 "axes": ["axis-numeric","axis-category","axis-time","axis-stacked"], 3929 "axes-base": ["axis-numeric-base","axis-category-base","axis-time-base","axis-stacked-base"], 3930 "base": ["base-base","base-pluginhost","base-build"], 3931 "cache": ["cache-base","cache-offline","cache-plugin"], 3932 "charts": ["charts-base"], 3933 "collection": ["array-extras","arraylist","arraylist-add","arraylist-filter","array-invoke"], 3934 "color": ["color-base","color-hsl","color-harmony"], 3935 "controller": ["router"], 3936 "dataschema": ["dataschema-base","dataschema-json","dataschema-xml","dataschema-array","dataschema-text"], 3937 "datasource": ["datasource-local","datasource-io","datasource-get","datasource-function","datasource-cache","datasource-jsonschema","datasource-xmlschema","datasource-arrayschema","datasource-textschema","datasource-polling"], 3938 "datatable": ["datatable-core","datatable-table","datatable-head","datatable-body","datatable-base","datatable-column-widths","datatable-message","datatable-mutable","datatable-sort","datatable-datasource"], 3939 "datatype": ["datatype-date","datatype-number","datatype-xml"], 3940 "datatype-date": ["datatype-date-parse","datatype-date-format","datatype-date-math"], 3941 "datatype-number": ["datatype-number-parse","datatype-number-format"], 3942 "datatype-xml": ["datatype-xml-parse","datatype-xml-format"], 3943 "dd": ["dd-ddm-base","dd-ddm","dd-ddm-drop","dd-drag","dd-proxy","dd-constrain","dd-drop","dd-scroll","dd-delegate"], 3944 "dom": ["dom-base","dom-screen","dom-style","selector-native","selector"], 3945 "editor": ["frame","editor-selection","exec-command","editor-base","editor-para","editor-br","editor-bidi","editor-tab","createlink-base"], 3946 "event": ["event-base","event-delegate","event-synthetic","event-mousewheel","event-mouseenter","event-key","event-focus","event-resize","event-hover","event-outside","event-touch","event-move","event-flick","event-valuechange","event-tap"], 3947 "event-custom": ["event-custom-base","event-custom-complex"], 3948 "event-gestures": ["event-flick","event-move"], 3949 "handlebars": ["handlebars-compiler"], 3950 "highlight": ["highlight-base","highlight-accentfold"], 3951 "history": ["history-base","history-hash","history-html5"], 3952 "io": ["io-base","io-xdr","io-form","io-upload-iframe","io-queue"], 3953 "json": ["json-parse","json-stringify"], 3954 "loader": ["loader-base","loader-rollup","loader-yui3"], 3955 "node": ["node-base","node-event-delegate","node-pluginhost","node-screen","node-style"], 3956 "pluginhost": ["pluginhost-base","pluginhost-config"], 3957 "querystring": ["querystring-parse","querystring-stringify"], 3958 "recordset": ["recordset-base","recordset-sort","recordset-filter","recordset-indexer"], 3959 "resize": ["resize-base","resize-proxy","resize-constrain"], 3960 "slider": ["slider-base","slider-value-range","clickable-rail","range-slider"], 3961 "template": ["template-base","template-micro"], 3962 "text": ["text-accentfold","text-wordbreak"], 3963 "widget": ["widget-base","widget-htmlparser","widget-skin","widget-uievents"] 3964 }; 3965 3966 3967 }, '3.17.2', { 3968 "use": [ 3969 "yui-base", 3970 "get", 3971 "features", 3972 "intl-base", 3973 "yui-log", 3974 "yui-log-nodejs", 3975 "yui-later", 3976 "loader-base", 3977 "loader-rollup", 3978 "loader-yui3" 3979 ] 3980 }); 3981 YUI.add('get', function (Y, NAME) { 3982 3983 /** 3984 * NodeJS specific Get module used to load remote resources. 3985 * It contains the same signature as the default Get module so there is no code change needed. 3986 * @module get-nodejs 3987 * @class GetNodeJS 3988 */ 3989 3990 var Module = require('module'), 3991 3992 path = require('path'), 3993 fs = require('fs'), 3994 request = require('request'), 3995 end = function(cb, msg, result) { 3996 if (Y.Lang.isFunction(cb.onEnd)) { 3997 cb.onEnd.call(Y, msg, result); 3998 } 3999 }, pass = function(cb) { 4000 if (Y.Lang.isFunction(cb.onSuccess)) { 4001 cb.onSuccess.call(Y, cb); 4002 } 4003 end(cb, 'success', 'success'); 4004 }, fail = function(cb, er) { 4005 er.errors = [er]; 4006 if (Y.Lang.isFunction(cb.onFailure)) { 4007 cb.onFailure.call(Y, er, cb); 4008 } 4009 end(cb, er, 'fail'); 4010 }; 4011 4012 4013 Y.Get = function() { 4014 }; 4015 4016 //Setup the default config base path 4017 Y.config.base = path.join(__dirname, '../'); 4018 4019 YUI.require = require; 4020 YUI.process = process; 4021 4022 /** 4023 * Takes the raw JS files and wraps them to be executed in the YUI context so they can be loaded 4024 * into the YUI object 4025 * @method _exec 4026 * @private 4027 * @param {String} data The JS to execute 4028 * @param {String} url The path to the file that was parsed 4029 * @param {Function} cb The callback to execute when this is completed 4030 * @param {Error} cb.err=null Error object 4031 * @param {String} cb.url The URL that was just parsed 4032 */ 4033 4034 Y.Get._exec = function(data, url, cb) { 4035 if (data.charCodeAt(0) === 0xFEFF) { 4036 data = data.slice(1); 4037 } 4038 4039 var mod = new Module(url, module); 4040 mod.filename = url; 4041 mod.paths = Module._nodeModulePaths(path.dirname(url)); 4042 if (typeof YUI._getLoadHook === 'function') { 4043 data = YUI._getLoadHook(data, url); 4044 } 4045 mod._compile('module.exports = function (YUI) {' + 4046 'return (function () {'+ data + '\n;return YUI;}).apply(global);' + 4047 '};', url); 4048 4049 /*global YUI:true */ 4050 YUI = mod.exports(YUI); 4051 4052 mod.loaded = true; 4053 4054 cb(null, url); 4055 }; 4056 4057 /** 4058 * Fetches the content from a remote URL or a file from disc and passes the content 4059 * off to `_exec` for parsing 4060 * @method _include 4061 * @private 4062 * @param {String} url The URL/File path to fetch the content from 4063 * @param {Function} cb The callback to fire once the content has been executed via `_exec` 4064 */ 4065 Y.Get._include = function (url, cb) { 4066 var cfg, 4067 mod, 4068 self = this; 4069 4070 if (url.match(/^https?:\/\//)) { 4071 cfg = { 4072 url: url, 4073 timeout: self.timeout 4074 }; 4075 request(cfg, function (err, response, body) { 4076 if (err) { 4077 cb(err, url); 4078 } else { 4079 Y.Get._exec(body, url, cb); 4080 } 4081 }); 4082 } else { 4083 try { 4084 // Try to resolve paths relative to the module that required yui. 4085 url = Module._findPath(url, Module._resolveLookupPaths(url, module.parent.parent)[1]); 4086 4087 if (Y.config.useSync) { 4088 //Needs to be in useSync 4089 mod = fs.readFileSync(url,'utf8'); 4090 } else { 4091 fs.readFile(url, 'utf8', function (err, mod) { 4092 if (err) { 4093 cb(err, url); 4094 } else { 4095 Y.Get._exec(mod, url, cb); 4096 } 4097 }); 4098 return; 4099 } 4100 } catch (err) { 4101 cb(err, url); 4102 return; 4103 } 4104 4105 Y.Get._exec(mod, url, cb); 4106 } 4107 }; 4108 4109 4110 /** 4111 * Override for Get.script for loading local or remote YUI modules. 4112 * @method js 4113 * @param {Array|String} s The URL's to load into this context 4114 * @param {Object} options Transaction options 4115 */ 4116 Y.Get.js = function(s, options) { 4117 var urls = Y.Array(s), url, i, l = urls.length, c= 0, 4118 check = function() { 4119 if (c === l) { 4120 pass(options); 4121 } 4122 }; 4123 4124 4125 /*jshint loopfunc: true */ 4126 for (i=0; i<l; i++) { 4127 url = urls[i]; 4128 if (Y.Lang.isObject(url)) { 4129 url = url.url; 4130 } 4131 4132 url = url.replace(/'/g, '%27'); 4133 Y.Get._include(url, function(err, url) { 4134 if (!Y.config) { 4135 Y.config = { 4136 debug: true 4137 }; 4138 } 4139 if (options.onProgress) { 4140 options.onProgress.call(options.context || Y, url); 4141 } 4142 if (err) { 4143 fail(options, err); 4144 } else { 4145 c++; 4146 check(); 4147 } 4148 }); 4149 } 4150 4151 //Keeping Signature in the browser. 4152 return { 4153 execute: function() {} 4154 }; 4155 }; 4156 4157 /** 4158 * Alias for `Y.Get.js` 4159 * @method script 4160 */ 4161 Y.Get.script = Y.Get.js; 4162 4163 //Place holder for SS Dom access 4164 Y.Get.css = function(s, cb) { 4165 pass(cb); 4166 }; 4167 4168 4169 4170 }, '3.17.2'); 4171 YUI.add('features', function (Y, NAME) { 4172 4173 var feature_tests = {}; 4174 4175 /** 4176 Contains the core of YUI's feature test architecture. 4177 @module features 4178 */ 4179 4180 /** 4181 * Feature detection 4182 * @class Features 4183 * @static 4184 */ 4185 4186 Y.mix(Y.namespace('Features'), { 4187 4188 /** 4189 * Object hash of all registered feature tests 4190 * @property tests 4191 * @type Object 4192 */ 4193 tests: feature_tests, 4194 4195 /** 4196 * Add a test to the system 4197 * 4198 * ``` 4199 * Y.Features.add("load", "1", {}); 4200 * ``` 4201 * 4202 * @method add 4203 * @param {String} cat The category, right now only 'load' is supported 4204 * @param {String} name The number sequence of the test, how it's reported in the URL or config: 1, 2, 3 4205 * @param {Object} o Object containing test properties 4206 * @param {String} o.name The name of the test 4207 * @param {Function} o.test The test function to execute, the only argument to the function is the `Y` instance 4208 * @param {String} o.trigger The module that triggers this test. 4209 */ 4210 add: function(cat, name, o) { 4211 feature_tests[cat] = feature_tests[cat] || {}; 4212 feature_tests[cat][name] = o; 4213 }, 4214 /** 4215 * Execute all tests of a given category and return the serialized results 4216 * 4217 * ``` 4218 * caps=1:1;2:1;3:0 4219 * ``` 4220 * @method all 4221 * @param {String} cat The category to execute 4222 * @param {Array} args The arguments to pass to the test function 4223 * @return {String} A semi-colon separated string of tests and their success/failure: 1:1;2:1;3:0 4224 */ 4225 all: function(cat, args) { 4226 var cat_o = feature_tests[cat], 4227 // results = {}; 4228 result = []; 4229 if (cat_o) { 4230 Y.Object.each(cat_o, function(v, k) { 4231 result.push(k + ':' + (Y.Features.test(cat, k, args) ? 1 : 0)); 4232 }); 4233 } 4234 4235 return (result.length) ? result.join(';') : ''; 4236 }, 4237 /** 4238 * Run a specific test and return a Boolean response. 4239 * 4240 * ``` 4241 * Y.Features.test("load", "1"); 4242 * ``` 4243 * 4244 * @method test 4245 * @param {String} cat The category of the test to run 4246 * @param {String} name The name of the test to run 4247 * @param {Array} args The arguments to pass to the test function 4248 * @return {Boolean} True or false if the test passed/failed. 4249 */ 4250 test: function(cat, name, args) { 4251 args = args || []; 4252 var result, ua, test, 4253 cat_o = feature_tests[cat], 4254 feature = cat_o && cat_o[name]; 4255 4256 if (!feature) { 4257 } else { 4258 4259 result = feature.result; 4260 4261 if (Y.Lang.isUndefined(result)) { 4262 4263 ua = feature.ua; 4264 if (ua) { 4265 result = (Y.UA[ua]); 4266 } 4267 4268 test = feature.test; 4269 if (test && ((!ua) || result)) { 4270 result = test.apply(Y, args); 4271 } 4272 4273 feature.result = result; 4274 } 4275 } 4276 4277 return result; 4278 } 4279 }); 4280 4281 // Y.Features.add("load", "1", {}); 4282 // Y.Features.test("load", "1"); 4283 // caps=1:1;2:0;3:1; 4284 4285 /* This file is auto-generated by (yogi.js loader --mix --yes) */ 4286 /*jshint maxlen:900, eqeqeq: false */ 4287 var add = Y.Features.add; 4288 // app-transitions-native 4289 add('load', '0', { 4290 "name": "app-transitions-native", 4291 "test": function (Y) { 4292 var doc = Y.config.doc, 4293 node = doc ? doc.documentElement : null; 4294 4295 if (node && node.style) { 4296 return ('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); 4297 } 4298 4299 return false; 4300 }, 4301 "trigger": "app-transitions" 4302 }); 4303 // autocomplete-list-keys 4304 add('load', '1', { 4305 "name": "autocomplete-list-keys", 4306 "test": function (Y) { 4307 // Only add keyboard support to autocomplete-list if this doesn't appear to 4308 // be an iOS or Android-based mobile device. 4309 // 4310 // There's currently no feasible way to actually detect whether a device has 4311 // a hardware keyboard, so this sniff will have to do. It can easily be 4312 // overridden by manually loading the autocomplete-list-keys module. 4313 // 4314 // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari 4315 // doesn't fire the keyboard events used by AutoCompleteList, so there's 4316 // no point loading the -keys module even when a bluetooth keyboard may be 4317 // available. 4318 return !(Y.UA.ios || Y.UA.android); 4319 }, 4320 "trigger": "autocomplete-list" 4321 }); 4322 // dd-gestures 4323 add('load', '2', { 4324 "name": "dd-gestures", 4325 "trigger": "dd-drag", 4326 "ua": "touchEnabled" 4327 }); 4328 // dom-style-ie 4329 add('load', '3', { 4330 "name": "dom-style-ie", 4331 "test": function (Y) { 4332 4333 var testFeature = Y.Features.test, 4334 addFeature = Y.Features.add, 4335 WINDOW = Y.config.win, 4336 DOCUMENT = Y.config.doc, 4337 DOCUMENT_ELEMENT = 'documentElement', 4338 ret = false; 4339 4340 addFeature('style', 'computedStyle', { 4341 test: function() { 4342 return WINDOW && 'getComputedStyle' in WINDOW; 4343 } 4344 }); 4345 4346 addFeature('style', 'opacity', { 4347 test: function() { 4348 return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style; 4349 } 4350 }); 4351 4352 ret = (!testFeature('style', 'opacity') && 4353 !testFeature('style', 'computedStyle')); 4354 4355 return ret; 4356 }, 4357 "trigger": "dom-style" 4358 }); 4359 // editor-para-ie 4360 add('load', '4', { 4361 "name": "editor-para-ie", 4362 "trigger": "editor-para", 4363 "ua": "ie", 4364 "when": "instead" 4365 }); 4366 // event-base-ie 4367 add('load', '5', { 4368 "name": "event-base-ie", 4369 "test": function(Y) { 4370 var imp = Y.config.doc && Y.config.doc.implementation; 4371 return (imp && (!imp.hasFeature('Events', '2.0'))); 4372 }, 4373 "trigger": "node-base" 4374 }); 4375 // graphics-canvas 4376 add('load', '6', { 4377 "name": "graphics-canvas", 4378 "test": function(Y) { 4379 var DOCUMENT = Y.config.doc, 4380 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", 4381 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 4382 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 4383 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); 4384 }, 4385 "trigger": "graphics" 4386 }); 4387 // graphics-canvas-default 4388 add('load', '7', { 4389 "name": "graphics-canvas-default", 4390 "test": function(Y) { 4391 var DOCUMENT = Y.config.doc, 4392 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", 4393 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 4394 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 4395 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); 4396 }, 4397 "trigger": "graphics" 4398 }); 4399 // graphics-svg 4400 add('load', '8', { 4401 "name": "graphics-svg", 4402 "test": function(Y) { 4403 var DOCUMENT = Y.config.doc, 4404 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", 4405 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 4406 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 4407 4408 return svg && (useSVG || !canvas); 4409 }, 4410 "trigger": "graphics" 4411 }); 4412 // graphics-svg-default 4413 add('load', '9', { 4414 "name": "graphics-svg-default", 4415 "test": function(Y) { 4416 var DOCUMENT = Y.config.doc, 4417 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", 4418 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 4419 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 4420 4421 return svg && (useSVG || !canvas); 4422 }, 4423 "trigger": "graphics" 4424 }); 4425 // graphics-vml 4426 add('load', '10', { 4427 "name": "graphics-vml", 4428 "test": function(Y) { 4429 var DOCUMENT = Y.config.doc, 4430 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); 4431 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); 4432 }, 4433 "trigger": "graphics" 4434 }); 4435 // graphics-vml-default 4436 add('load', '11', { 4437 "name": "graphics-vml-default", 4438 "test": function(Y) { 4439 var DOCUMENT = Y.config.doc, 4440 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); 4441 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); 4442 }, 4443 "trigger": "graphics" 4444 }); 4445 // history-hash-ie 4446 add('load', '12', { 4447 "name": "history-hash-ie", 4448 "test": function (Y) { 4449 var docMode = Y.config.doc && Y.config.doc.documentMode; 4450 4451 return Y.UA.ie && (!('onhashchange' in Y.config.win) || 4452 !docMode || docMode < 8); 4453 }, 4454 "trigger": "history-hash" 4455 }); 4456 // io-nodejs 4457 add('load', '13', { 4458 "name": "io-nodejs", 4459 "trigger": "io-base", 4460 "ua": "nodejs" 4461 }); 4462 // json-parse-shim 4463 add('load', '14', { 4464 "name": "json-parse-shim", 4465 "test": function (Y) { 4466 var _JSON = Y.config.global.JSON, 4467 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, 4468 nativeSupport = Y.config.useNativeJSONParse !== false && !!Native; 4469 4470 function workingNative( k, v ) { 4471 return k === "ok" ? true : v; 4472 } 4473 4474 // Double check basic functionality. This is mainly to catch early broken 4475 // implementations of the JSON API in Firefox 3.1 beta1 and beta2 4476 if ( nativeSupport ) { 4477 try { 4478 nativeSupport = ( Native.parse( '{"ok":false}', workingNative ) ).ok; 4479 } 4480 catch ( e ) { 4481 nativeSupport = false; 4482 } 4483 } 4484 4485 return !nativeSupport; 4486 }, 4487 "trigger": "json-parse" 4488 }); 4489 // json-stringify-shim 4490 add('load', '15', { 4491 "name": "json-stringify-shim", 4492 "test": function (Y) { 4493 var _JSON = Y.config.global.JSON, 4494 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, 4495 nativeSupport = Y.config.useNativeJSONStringify !== false && !!Native; 4496 4497 // Double check basic native functionality. This is primarily to catch broken 4498 // early JSON API implementations in Firefox 3.1 beta1 and beta2. 4499 if ( nativeSupport ) { 4500 try { 4501 nativeSupport = ( '0' === Native.stringify(0) ); 4502 } catch ( e ) { 4503 nativeSupport = false; 4504 } 4505 } 4506 4507 4508 return !nativeSupport; 4509 }, 4510 "trigger": "json-stringify" 4511 }); 4512 // scrollview-base-ie 4513 add('load', '16', { 4514 "name": "scrollview-base-ie", 4515 "trigger": "scrollview-base", 4516 "ua": "ie" 4517 }); 4518 // selector-css2 4519 add('load', '17', { 4520 "name": "selector-css2", 4521 "test": function (Y) { 4522 var DOCUMENT = Y.config.doc, 4523 ret = DOCUMENT && !('querySelectorAll' in DOCUMENT); 4524 4525 return ret; 4526 }, 4527 "trigger": "selector" 4528 }); 4529 // transition-timer 4530 add('load', '18', { 4531 "name": "transition-timer", 4532 "test": function (Y) { 4533 var DOCUMENT = Y.config.doc, 4534 node = (DOCUMENT) ? DOCUMENT.documentElement: null, 4535 ret = true; 4536 4537 if (node && node.style) { 4538 ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); 4539 } 4540 4541 return ret; 4542 }, 4543 "trigger": "transition" 4544 }); 4545 // widget-base-ie 4546 add('load', '19', { 4547 "name": "widget-base-ie", 4548 "trigger": "widget-base", 4549 "ua": "ie" 4550 }); 4551 // yql-jsonp 4552 add('load', '20', { 4553 "name": "yql-jsonp", 4554 "test": function (Y) { 4555 /* Only load the JSONP module when not in nodejs or winjs 4556 TODO Make the winjs module a CORS module 4557 */ 4558 return (!Y.UA.nodejs && !Y.UA.winjs); 4559 }, 4560 "trigger": "yql" 4561 }); 4562 // yql-nodejs 4563 add('load', '21', { 4564 "name": "yql-nodejs", 4565 "trigger": "yql", 4566 "ua": "nodejs" 4567 }); 4568 // yql-winjs 4569 add('load', '22', { 4570 "name": "yql-winjs", 4571 "trigger": "yql", 4572 "ua": "winjs" 4573 }); 4574 4575 }, '3.17.2', {"requires": ["yui-base"]}); 4576 YUI.add('intl-base', function (Y, NAME) { 4577 4578 /** 4579 * The Intl utility provides a central location for managing sets of 4580 * localized resources (strings and formatting patterns). 4581 * 4582 * @class Intl 4583 * @uses EventTarget 4584 * @static 4585 */ 4586 4587 var SPLIT_REGEX = /[, ]/; 4588 4589 Y.mix(Y.namespace('Intl'), { 4590 4591 /** 4592 * Returns the language among those available that 4593 * best matches the preferred language list, using the Lookup 4594 * algorithm of BCP 47. 4595 * If none of the available languages meets the user's preferences, 4596 * then "" is returned. 4597 * Extended language ranges are not supported. 4598 * 4599 * @method lookupBestLang 4600 * @param {String[] | String} preferredLanguages The list of preferred 4601 * languages in descending preference order, represented as BCP 47 4602 * language tags. A string array or a comma-separated list. 4603 * @param {String[]} availableLanguages The list of languages 4604 * that the application supports, represented as BCP 47 language 4605 * tags. 4606 * 4607 * @return {String} The available language that best matches the 4608 * preferred language list, or "". 4609 * @since 3.1.0 4610 */ 4611 lookupBestLang: function(preferredLanguages, availableLanguages) { 4612 4613 var i, language, result, index; 4614 4615 // check whether the list of available languages contains language; 4616 // if so return it 4617 function scan(language) { 4618 var i; 4619 for (i = 0; i < availableLanguages.length; i += 1) { 4620 if (language.toLowerCase() === 4621 availableLanguages[i].toLowerCase()) { 4622 return availableLanguages[i]; 4623 } 4624 } 4625 } 4626 4627 if (Y.Lang.isString(preferredLanguages)) { 4628 preferredLanguages = preferredLanguages.split(SPLIT_REGEX); 4629 } 4630 4631 for (i = 0; i < preferredLanguages.length; i += 1) { 4632 language = preferredLanguages[i]; 4633 if (!language || language === '*') { 4634 continue; 4635 } 4636 // check the fallback sequence for one language 4637 while (language.length > 0) { 4638 result = scan(language); 4639 if (result) { 4640 return result; 4641 } else { 4642 index = language.lastIndexOf('-'); 4643 if (index >= 0) { 4644 language = language.substring(0, index); 4645 // one-character subtags get cut along with the 4646 // following subtag 4647 if (index >= 2 && language.charAt(index - 2) === '-') { 4648 language = language.substring(0, index - 2); 4649 } 4650 } else { 4651 // nothing available for this language 4652 break; 4653 } 4654 } 4655 } 4656 } 4657 4658 return ''; 4659 } 4660 }); 4661 4662 4663 }, '3.17.2', {"requires": ["yui-base"]}); 4664 YUI.add('yui-log', function (Y, NAME) { 4665 4666 /** 4667 * Provides console log capability and exposes a custom event for 4668 * console implementations. This module is a `core` YUI module, 4669 * <a href="../classes/YUI.html#method_log">it's documentation is located under the YUI class</a>. 4670 * 4671 * @module yui 4672 * @submodule yui-log 4673 */ 4674 4675 var INSTANCE = Y, 4676 LOGEVENT = 'yui:log', 4677 UNDEFINED = 'undefined', 4678 LEVELS = { debug: 1, 4679 info: 2, 4680 warn: 4, 4681 error: 8 }; 4682 4683 /** 4684 * If the 'debug' config is true, a 'yui:log' event will be 4685 * dispatched, which the Console widget and anything else 4686 * can consume. If the 'useBrowserConsole' config is true, it will 4687 * write to the browser console if available. YUI-specific log 4688 * messages will only be present in the -debug versions of the 4689 * JS files. The build system is supposed to remove log statements 4690 * from the raw and minified versions of the files. 4691 * 4692 * @method log 4693 * @for YUI 4694 * @param {String} msg The message to log. 4695 * @param {String} cat The log category for the message. Default 4696 * categories are "info", "warn", "error", "debug". 4697 * Custom categories can be used as well. (opt). 4698 * @param {String} src The source of the the message (opt). 4699 * @param {boolean} silent If true, the log event won't fire. 4700 * @return {YUI} YUI instance. 4701 */ 4702 INSTANCE.log = function(msg, cat, src, silent) { 4703 var bail, excl, incl, m, f, minlevel, 4704 Y = INSTANCE, 4705 c = Y.config, 4706 publisher = (Y.fire) ? Y : YUI.Env.globalEvents; 4707 // suppress log message if the config is off or the event stack 4708 // or the event call stack contains a consumer of the yui:log event 4709 if (c.debug) { 4710 // apply source filters 4711 src = src || ""; 4712 if (typeof src !== "undefined") { 4713 excl = c.logExclude; 4714 incl = c.logInclude; 4715 if (incl && !(src in incl)) { 4716 bail = 1; 4717 } else if (incl && (src in incl)) { 4718 bail = !incl[src]; 4719 } else if (excl && (src in excl)) { 4720 bail = excl[src]; 4721 } 4722 4723 // Set a default category of info if the category was not defined. 4724 if ((typeof cat === 'undefined')) { 4725 cat = 'info'; 4726 } 4727 4728 // Determine the current minlevel as defined in configuration 4729 Y.config.logLevel = Y.config.logLevel || 'debug'; 4730 minlevel = LEVELS[Y.config.logLevel.toLowerCase()]; 4731 4732 if (cat in LEVELS && LEVELS[cat] < minlevel) { 4733 // Skip this message if the we don't meet the defined minlevel 4734 bail = 1; 4735 } 4736 } 4737 if (!bail) { 4738 if (c.useBrowserConsole) { 4739 m = (src) ? src + ': ' + msg : msg; 4740 if (Y.Lang.isFunction(c.logFn)) { 4741 c.logFn.call(Y, msg, cat, src); 4742 } else if (typeof console !== UNDEFINED && console.log) { 4743 f = (cat && console[cat] && (cat in LEVELS)) ? cat : 'log'; 4744 console[f](m); 4745 } else if (typeof opera !== UNDEFINED) { 4746 opera.postError(m); 4747 } 4748 } 4749 4750 if (publisher && !silent) { 4751 4752 if (publisher === Y && (!publisher.getEvent(LOGEVENT))) { 4753 publisher.publish(LOGEVENT, { 4754 broadcast: 2 4755 }); 4756 } 4757 4758 publisher.fire(LOGEVENT, { 4759 msg: msg, 4760 cat: cat, 4761 src: src 4762 }); 4763 } 4764 } 4765 } 4766 4767 return Y; 4768 }; 4769 4770 /** 4771 * Write a system message. This message will be preserved in the 4772 * minified and raw versions of the YUI files, unlike log statements. 4773 * @method message 4774 * @for YUI 4775 * @param {String} msg The message to log. 4776 * @param {String} cat The log category for the message. Default 4777 * categories are "info", "warn", "error", "debug". 4778 * Custom categories can be used as well. (opt). 4779 * @param {String} src The source of the the message (opt). 4780 * @param {boolean} silent If true, the log event won't fire. 4781 * @return {YUI} YUI instance. 4782 */ 4783 INSTANCE.message = function() { 4784 return INSTANCE.log.apply(INSTANCE, arguments); 4785 }; 4786 4787 4788 }, '3.17.2', {"requires": ["yui-base"]}); 4789 YUI.add('yui-log-nodejs', function (Y, NAME) { 4790 4791 var sys = require(process.binding('natives').util ? 'util' : 'sys'), 4792 hasColor = false; 4793 4794 try { 4795 var stdio = require("stdio"); 4796 hasColor = stdio.isStderrATTY(); 4797 } catch (ex) { 4798 hasColor = true; 4799 } 4800 4801 Y.config.useColor = hasColor; 4802 4803 Y.consoleColor = function(str, num) { 4804 if (!this.config.useColor) { 4805 return str; 4806 } 4807 if (!num) { 4808 num = '32'; 4809 } 4810 return "\u001b[" + num +"m" + str + "\u001b[0m"; 4811 }; 4812 4813 4814 var logFn = function(str, t, m) { 4815 var id = '', lvl, mLvl; 4816 if (this.id) { 4817 id = '[' + this.id + ']:'; 4818 } 4819 t = t || 'info'; 4820 m = (m) ? this.consoleColor(' (' + m.toLowerCase() + '):', 35) : ''; 4821 4822 if (str === null) { 4823 str = 'null'; 4824 } 4825 4826 if ((typeof str === 'object') || str instanceof Array) { 4827 try { 4828 //Should we use this? 4829 if (str.tagName || str._yuid || str._query) { 4830 str = str.toString(); 4831 } else { 4832 str = sys.inspect(str); 4833 } 4834 } catch (e) { 4835 //Fail catcher 4836 } 4837 } 4838 4839 lvl = '37;40'; 4840 mLvl = ((str) ? '' : 31); 4841 t = t+''; //Force to a string.. 4842 switch (t.toLowerCase()) { 4843 case 'error': 4844 lvl = mLvl = 31; 4845 break; 4846 case 'warn': 4847 lvl = 33; 4848 break; 4849 case 'debug': 4850 lvl = 34; 4851 break; 4852 } 4853 if (typeof str === 'string') { 4854 if (str && str.indexOf("\n") !== -1) { 4855 str = "\n" + str; 4856 } 4857 } 4858 4859 // output log messages to stderr 4860 sys.error(this.consoleColor(t.toLowerCase() + ':', lvl) + m + ' ' + this.consoleColor(str, mLvl)); 4861 }; 4862 4863 if (!Y.config.logFn) { 4864 Y.config.logFn = logFn; 4865 } 4866 4867 4868 4869 }, '3.17.2'); 4870 YUI.add('yui-later', function (Y, NAME) { 4871 4872 /** 4873 * Provides a setTimeout/setInterval wrapper. This module is a `core` YUI module, 4874 * <a href="../classes/YUI.html#method_later">it's documentation is located under the YUI class</a>. 4875 * 4876 * @module yui 4877 * @submodule yui-later 4878 */ 4879 4880 var NO_ARGS = []; 4881 4882 /** 4883 * Executes the supplied function in the context of the supplied 4884 * object 'when' milliseconds later. Executes the function a 4885 * single time unless periodic is set to true. 4886 * @for YUI 4887 * @method later 4888 * @param when {Number} the number of milliseconds to wait until the fn 4889 * is executed. 4890 * @param o the context object. 4891 * @param fn {Function|String} the function to execute or the name of 4892 * the method in the 'o' object to execute. 4893 * @param data [Array] data that is provided to the function. This 4894 * accepts either a single item or an array. If an array is provided, 4895 * the function is executed with one parameter for each array item. 4896 * If you need to pass a single array parameter, it needs to be wrapped 4897 * in an array [myarray]. 4898 * 4899 * Note: native methods in IE may not have the call and apply methods. 4900 * In this case, it will work, but you are limited to four arguments. 4901 * 4902 * @param periodic {boolean} if true, executes continuously at supplied 4903 * interval until canceled. 4904 * @return {object} a timer object. Call the cancel() method on this 4905 * object to stop the timer. 4906 */ 4907 Y.later = function(when, o, fn, data, periodic) { 4908 when = when || 0; 4909 data = (!Y.Lang.isUndefined(data)) ? Y.Array(data) : NO_ARGS; 4910 o = o || Y.config.win || Y; 4911 4912 var cancelled = false, 4913 method = (o && Y.Lang.isString(fn)) ? o[fn] : fn, 4914 wrapper = function() { 4915 // IE 8- may execute a setInterval callback one last time 4916 // after clearInterval was called, so in order to preserve 4917 // the cancel() === no more runny-run, we have to jump through 4918 // an extra hoop. 4919 if (!cancelled) { 4920 if (!method.apply) { 4921 method(data[0], data[1], data[2], data[3]); 4922 } else { 4923 method.apply(o, data || NO_ARGS); 4924 } 4925 } 4926 }, 4927 id = (periodic) ? setInterval(wrapper, when) : setTimeout(wrapper, when); 4928 4929 return { 4930 id: id, 4931 interval: periodic, 4932 cancel: function() { 4933 cancelled = true; 4934 if (this.interval) { 4935 clearInterval(id); 4936 } else { 4937 clearTimeout(id); 4938 } 4939 } 4940 }; 4941 }; 4942 4943 Y.Lang.later = Y.later; 4944 4945 4946 4947 }, '3.17.2', {"requires": ["yui-base"]}); 4948 YUI.add('loader-base', function (Y, NAME) { 4949 4950 /** 4951 * The YUI loader core 4952 * @module loader 4953 * @submodule loader-base 4954 */ 4955 4956 (function() { 4957 var VERSION = Y.version, 4958 BUILD = '/build/', 4959 ROOT = VERSION + '/', 4960 CDN_BASE = Y.Env.base, 4961 GALLERY_VERSION = 'gallery-2014.05.29-15-46', 4962 TNT = '2in3', 4963 TNT_VERSION = '4', 4964 YUI2_VERSION = '2.9.0', 4965 COMBO_BASE = CDN_BASE + 'combo?', 4966 META = { 4967 version: VERSION, 4968 root: ROOT, 4969 base: Y.Env.base, 4970 comboBase: COMBO_BASE, 4971 skin: { 4972 defaultSkin: 'sam', 4973 base: 'assets/skins/', 4974 path: 'skin.css', 4975 after: [ 4976 'cssreset', 4977 'cssfonts', 4978 'cssgrids', 4979 'cssbase', 4980 'cssreset-context', 4981 'cssfonts-context' 4982 ] 4983 }, 4984 groups: {}, 4985 patterns: {} 4986 }, 4987 groups = META.groups, 4988 yui2Update = function(tnt, yui2, config) { 4989 var root = TNT + '.' + 4990 (tnt || TNT_VERSION) + '/' + 4991 (yui2 || YUI2_VERSION) + BUILD, 4992 base = (config && config.base) ? config.base : CDN_BASE, 4993 combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE; 4994 4995 groups.yui2.base = base + root; 4996 groups.yui2.root = root; 4997 groups.yui2.comboBase = combo; 4998 }, 4999 galleryUpdate = function(tag, config) { 5000 var root = (tag || GALLERY_VERSION) + BUILD, 5001 base = (config && config.base) ? config.base : CDN_BASE, 5002 combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE; 5003 5004 groups.gallery.base = base + root; 5005 groups.gallery.root = root; 5006 groups.gallery.comboBase = combo; 5007 }; 5008 5009 5010 groups[VERSION] = {}; 5011 5012 groups.gallery = { 5013 ext: false, 5014 combine: true, 5015 comboBase: COMBO_BASE, 5016 update: galleryUpdate, 5017 patterns: { 5018 'gallery-': {}, 5019 'lang/gallery-': {}, 5020 'gallerycss-': { 5021 type: 'css' 5022 } 5023 } 5024 }; 5025 5026 groups.yui2 = { 5027 combine: true, 5028 ext: false, 5029 comboBase: COMBO_BASE, 5030 update: yui2Update, 5031 patterns: { 5032 'yui2-': { 5033 configFn: function(me) { 5034 if (/-skin|reset|fonts|grids|base/.test(me.name)) { 5035 me.type = 'css'; 5036 me.path = me.path.replace(/\.js/, '.css'); 5037 // this makes skins in builds earlier than 5038 // 2.6.0 work as long as combine is false 5039 me.path = me.path.replace(/\/yui2-skin/, 5040 '/assets/skins/sam/yui2-skin'); 5041 } 5042 } 5043 } 5044 } 5045 }; 5046 5047 galleryUpdate(); 5048 yui2Update(); 5049 5050 if (YUI.Env[VERSION]) { 5051 Y.mix(META, YUI.Env[VERSION], false, [ 5052 'modules', 5053 'groups', 5054 'skin' 5055 ], 0, true); 5056 } 5057 5058 YUI.Env[VERSION] = META; 5059 }()); 5060 /*jslint forin: true, maxlen: 350 */ 5061 5062 /** 5063 * Loader dynamically loads script and css files. It includes the dependency 5064 * information for the version of the library in use, and will automatically pull in 5065 * dependencies for the modules requested. It can also load the 5066 * files from the Yahoo! CDN, and it can utilize the combo service provided on 5067 * this network to reduce the number of http connections required to download 5068 * YUI files. 5069 * 5070 * @module loader 5071 * @main loader 5072 * @submodule loader-base 5073 */ 5074 5075 var NOT_FOUND = {}, 5076 NO_REQUIREMENTS = [], 5077 MAX_URL_LENGTH = 1024, 5078 GLOBAL_ENV = YUI.Env, 5079 GLOBAL_LOADED = GLOBAL_ENV._loaded, 5080 CSS = 'css', 5081 JS = 'js', 5082 INTL = 'intl', 5083 DEFAULT_SKIN = 'sam', 5084 VERSION = Y.version, 5085 ROOT_LANG = '', 5086 YObject = Y.Object, 5087 oeach = YObject.each, 5088 yArray = Y.Array, 5089 _queue = GLOBAL_ENV._loaderQueue, 5090 META = GLOBAL_ENV[VERSION], 5091 SKIN_PREFIX = 'skin-', 5092 L = Y.Lang, 5093 ON_PAGE = GLOBAL_ENV.mods, 5094 modulekey, 5095 _path = function(dir, file, type, nomin) { 5096 var path = dir + '/' + file; 5097 if (!nomin) { 5098 path += '-min'; 5099 } 5100 path += '.' + (type || CSS); 5101 5102 return path; 5103 }; 5104 5105 5106 if (!YUI.Env._cssLoaded) { 5107 YUI.Env._cssLoaded = {}; 5108 } 5109 5110 5111 /** 5112 * The component metadata is stored in Y.Env.meta. 5113 * Part of the loader module. 5114 * @property meta 5115 * @for YUI 5116 */ 5117 Y.Env.meta = META; 5118 5119 /** 5120 * Loader dynamically loads script and css files. It includes the dependency 5121 * info for the version of the library in use, and will automatically pull in 5122 * dependencies for the modules requested. It can load the 5123 * files from the Yahoo! CDN, and it can utilize the combo service provided on 5124 * this network to reduce the number of http connections required to download 5125 * YUI files. You can also specify an external, custom combo service to host 5126 * your modules as well. 5127 5128 var Y = YUI(); 5129 var loader = new Y.Loader({ 5130 filter: 'debug', 5131 base: '../../', 5132 root: 'build/', 5133 combine: true, 5134 require: ['node', 'dd', 'console'] 5135 }); 5136 var out = loader.resolve(true); 5137 5138 * If the Loader needs to be patched before it is used for the first time, it 5139 * should be done through the `doBeforeLoader` hook. Simply make the patch 5140 * available via configuration before YUI is loaded: 5141 5142 YUI_config = YUI_config || {}; 5143 YUI_config.doBeforeLoader = function (config) { 5144 var resolve = this.context.Loader.prototype.resolve; 5145 this.context.Loader.prototype.resolve = function () { 5146 // do something here 5147 return resolve.apply(this, arguments); 5148 }; 5149 }; 5150 5151 * @constructor 5152 * @class Loader 5153 * @param {Object} config an optional set of configuration options. 5154 * @param {String} config.base The base dir which to fetch this module from 5155 * @param {String} config.comboBase The Combo service base path. Ex: `http://yui.yahooapis.com/combo?` 5156 * @param {String} config.root The root path to prepend to module names for the combo service. Ex: `2.5.2/build/` 5157 * @param {String|Object} config.filter A filter to apply to result urls. <a href="#property_filter">See filter property</a> 5158 * @param {Object} config.filters Per-component filter specification. If specified for a given component, this overrides the filter config. 5159 * @param {Boolean} config.combine Use a combo service to reduce the number of http connections required to load your dependencies 5160 * @param {Boolean} [config.async=true] Fetch files in async 5161 * @param {Array} config.ignore: A list of modules that should never be dynamically loaded 5162 * @param {Array} config.force A list of modules that should always be loaded when required, even if already present on the page 5163 * @param {HTMLElement|String} config.insertBefore Node or id for a node that should be used as the insertion point for new nodes 5164 * @param {Object} config.jsAttributes Object literal containing attributes to add to script nodes 5165 * @param {Object} config.cssAttributes Object literal containing attributes to add to link nodes 5166 * @param {Number} config.timeout The number of milliseconds before a timeout occurs when dynamically loading nodes. If not set, there is no timeout 5167 * @param {Object} config.context Execution context for all callbacks 5168 * @param {Function} config.onSuccess Callback for the 'success' event 5169 * @param {Function} config.onFailure Callback for the 'failure' event 5170 * @param {Function} config.onTimeout Callback for the 'timeout' event 5171 * @param {Function} config.onProgress Callback executed each time a script or css file is loaded 5172 * @param {Object} config.modules A list of module definitions. See <a href="#method_addModule">Loader.addModule</a> for the supported module metadata 5173 * @param {Object} config.groups A list of group definitions. Each group can contain specific definitions for `base`, `comboBase`, `combine`, and accepts a list of `modules`. 5174 * @param {String} config.2in3 The version of the YUI 2 in 3 wrapper to use. The intrinsic support for YUI 2 modules in YUI 3 relies on versions of the YUI 2 components inside YUI 3 module wrappers. These wrappers change over time to accomodate the issues that arise from running YUI 2 in a YUI 3 sandbox. 5175 * @param {String} config.yui2 When using the 2in3 project, you can select the version of YUI 2 to use. Valid values are `2.2.2`, `2.3.1`, `2.4.1`, `2.5.2`, `2.6.0`, `2.7.0`, `2.8.0`, `2.8.1` and `2.9.0` [default] -- plus all versions of YUI 2 going forward. 5176 * @param {Function} config.doBeforeLoader An optional hook that allows for the patching of the loader instance. The `Y` instance is available as `this.context` and the only argument to the function is the Loader configuration object. 5177 */ 5178 Y.Loader = function(o) { 5179 5180 var self = this; 5181 5182 //Catch no config passed. 5183 o = o || {}; 5184 5185 modulekey = META.md5; 5186 5187 /** 5188 * Internal callback to handle multiple internal insert() calls 5189 * so that css is inserted prior to js 5190 * @property _internalCallback 5191 * @private 5192 */ 5193 // self._internalCallback = null; 5194 5195 /** 5196 * Callback that will be executed when the loader is finished 5197 * with an insert 5198 * @method onSuccess 5199 * @type function 5200 */ 5201 // self.onSuccess = null; 5202 5203 /** 5204 * Callback that will be executed if there is a failure 5205 * @method onFailure 5206 * @type function 5207 */ 5208 // self.onFailure = null; 5209 5210 /** 5211 * Callback executed each time a script or css file is loaded 5212 * @method onProgress 5213 * @type function 5214 */ 5215 // self.onProgress = null; 5216 5217 /** 5218 * Callback that will be executed if a timeout occurs 5219 * @method onTimeout 5220 * @type function 5221 */ 5222 // self.onTimeout = null; 5223 5224 /** 5225 * The execution context for all callbacks 5226 * @property context 5227 * @default {YUI} the YUI instance 5228 */ 5229 self.context = Y; 5230 5231 // Hook that allows the patching of loader 5232 if (o.doBeforeLoader) { 5233 o.doBeforeLoader.apply(self, arguments); 5234 } 5235 5236 /** 5237 * Data that is passed to all callbacks 5238 * @property data 5239 */ 5240 // self.data = null; 5241 5242 /** 5243 * Node reference or id where new nodes should be inserted before 5244 * @property insertBefore 5245 * @type string|HTMLElement 5246 */ 5247 // self.insertBefore = null; 5248 5249 /** 5250 * The charset attribute for inserted nodes 5251 * @property charset 5252 * @type string 5253 * @deprecated , use cssAttributes or jsAttributes. 5254 */ 5255 // self.charset = null; 5256 5257 /** 5258 * An object literal containing attributes to add to link nodes 5259 * @property cssAttributes 5260 * @type object 5261 */ 5262 // self.cssAttributes = null; 5263 5264 /** 5265 * An object literal containing attributes to add to script nodes 5266 * @property jsAttributes 5267 * @type object 5268 */ 5269 // self.jsAttributes = null; 5270 5271 /** 5272 * The base directory. 5273 * @property base 5274 * @type string 5275 * @default http://yui.yahooapis.com/[YUI VERSION]/build/ 5276 */ 5277 self.base = Y.Env.meta.base + Y.Env.meta.root; 5278 5279 /** 5280 * Base path for the combo service 5281 * @property comboBase 5282 * @type string 5283 * @default http://yui.yahooapis.com/combo? 5284 */ 5285 self.comboBase = Y.Env.meta.comboBase; 5286 5287 /* 5288 * Base path for language packs. 5289 */ 5290 // self.langBase = Y.Env.meta.langBase; 5291 // self.lang = ""; 5292 5293 /** 5294 * If configured, the loader will attempt to use the combo 5295 * service for YUI resources and configured external resources. 5296 * @property combine 5297 * @type boolean 5298 * @default true if a base dir isn't in the config 5299 */ 5300 self.combine = o.base && 5301 (o.base.indexOf(self.comboBase.substr(0, 20)) > -1); 5302 5303 /** 5304 * The default seperator to use between files in a combo URL 5305 * @property comboSep 5306 * @type {String} 5307 * @default Ampersand 5308 */ 5309 self.comboSep = '&'; 5310 /** 5311 * Max url length for combo urls. The default is 1024. This is the URL 5312 * limit for the Yahoo! hosted combo servers. If consuming 5313 * a different combo service that has a different URL limit 5314 * it is possible to override this default by supplying 5315 * the maxURLLength config option. The config option will 5316 * only take effect if lower than the default. 5317 * 5318 * @property maxURLLength 5319 * @type int 5320 */ 5321 self.maxURLLength = MAX_URL_LENGTH; 5322 5323 /** 5324 * Ignore modules registered on the YUI global 5325 * @property ignoreRegistered 5326 * @default false 5327 */ 5328 self.ignoreRegistered = o.ignoreRegistered; 5329 5330 /** 5331 * Root path to prepend to module path for the combo 5332 * service 5333 * @property root 5334 * @type string 5335 * @default [YUI VERSION]/build/ 5336 */ 5337 self.root = Y.Env.meta.root; 5338 5339 /** 5340 * Timeout value in milliseconds. If set, self value will be used by 5341 * the get utility. the timeout event will fire if 5342 * a timeout occurs. 5343 * @property timeout 5344 * @type int 5345 */ 5346 self.timeout = 0; 5347 5348 /** 5349 * A list of modules that should not be loaded, even if 5350 * they turn up in the dependency tree 5351 * @property ignore 5352 * @type string[] 5353 */ 5354 // self.ignore = null; 5355 5356 /** 5357 * A list of modules that should always be loaded, even 5358 * if they have already been inserted into the page. 5359 * @property force 5360 * @type string[] 5361 */ 5362 // self.force = null; 5363 5364 self.forceMap = {}; 5365 5366 /** 5367 * Should we allow rollups 5368 * @property allowRollup 5369 * @type boolean 5370 * @default false 5371 */ 5372 self.allowRollup = false; 5373 5374 /** 5375 * A filter to apply to result urls. This filter will modify the default 5376 * path for all modules. The default path for the YUI library is the 5377 * minified version of the files (e.g., event-min.js). The filter property 5378 * can be a predefined filter or a custom filter. The valid predefined 5379 * filters are: 5380 * <dl> 5381 * <dt>DEBUG</dt> 5382 * <dd>Selects the debug versions of the library (e.g., event-debug.js). 5383 * This option will automatically include the Logger widget</dd> 5384 * <dt>RAW</dt> 5385 * <dd>Selects the non-minified version of the library (e.g., event.js). 5386 * </dd> 5387 * </dl> 5388 * You can also define a custom filter, which must be an object literal 5389 * containing a search expression and a replace string: 5390 * 5391 * myFilter: { 5392 * 'searchExp': "-min\\.js", 5393 * 'replaceStr': "-debug.js" 5394 * } 5395 * 5396 * @property filter 5397 * @type string| {searchExp: string, replaceStr: string} 5398 */ 5399 // self.filter = null; 5400 5401 /** 5402 * per-component filter specification. If specified for a given 5403 * component, this overrides the filter config. 5404 * @property filters 5405 * @type object 5406 */ 5407 self.filters = {}; 5408 5409 /** 5410 * The list of requested modules 5411 * @property required 5412 * @type {string: boolean} 5413 */ 5414 self.required = {}; 5415 5416 /** 5417 * If a module name is predefined when requested, it is checked againsts 5418 * the patterns provided in this property. If there is a match, the 5419 * module is added with the default configuration. 5420 * 5421 * At the moment only supporting module prefixes, but anticipate 5422 * supporting at least regular expressions. 5423 * @property patterns 5424 * @type Object 5425 */ 5426 // self.patterns = Y.merge(Y.Env.meta.patterns); 5427 self.patterns = {}; 5428 5429 /** 5430 * Internal loader instance metadata. Use accessor `getModuleInfo()` instead. 5431 */ 5432 self.moduleInfo = {}; 5433 5434 self.groups = Y.merge(Y.Env.meta.groups); 5435 5436 /** 5437 * Provides the information used to skin the skinnable components. 5438 * The following skin definition would result in 'skin1' and 'skin2' 5439 * being loaded for calendar (if calendar was requested), and 5440 * 'sam' for all other skinnable components: 5441 * 5442 * skin: { 5443 * // The default skin, which is automatically applied if not 5444 * // overriden by a component-specific skin definition. 5445 * // Change this in to apply a different skin globally 5446 * defaultSkin: 'sam', 5447 * 5448 * // This is combined with the loader base property to get 5449 * // the default root directory for a skin. ex: 5450 * // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/ 5451 * base: 'assets/skins/', 5452 * 5453 * // Any component-specific overrides can be specified here, 5454 * // making it possible to load different skins for different 5455 * // components. It is possible to load more than one skin 5456 * // for a given component as well. 5457 * overrides: { 5458 * calendar: ['skin1', 'skin2'] 5459 * } 5460 * } 5461 * @property skin 5462 * @type {Object} 5463 */ 5464 self.skin = Y.merge(Y.Env.meta.skin); 5465 5466 /* 5467 * Map of conditional modules 5468 * @since 3.2.0 5469 */ 5470 self.conditions = {}; 5471 5472 // map of modules with a hash of modules that meet the requirement 5473 // self.provides = {}; 5474 5475 self.config = o; 5476 self._internal = true; 5477 5478 self._populateConditionsCache(); 5479 5480 /** 5481 * Set when beginning to compute the dependency tree. 5482 * Composed of what YUI reports to be loaded combined 5483 * with what has been loaded by any instance on the page 5484 * with the version number specified in the metadata. 5485 * @property loaded 5486 * @type {string: boolean} 5487 */ 5488 self.loaded = GLOBAL_LOADED[VERSION]; 5489 5490 5491 /** 5492 * Should Loader fetch scripts in `async`, defaults to `true` 5493 * @property async 5494 */ 5495 5496 self.async = true; 5497 5498 self._inspectPage(); 5499 5500 self._internal = false; 5501 5502 self._config(o); 5503 5504 self.forceMap = (self.force) ? Y.Array.hash(self.force) : {}; 5505 5506 self.testresults = null; 5507 5508 if (Y.config.tests) { 5509 self.testresults = Y.config.tests; 5510 } 5511 5512 /** 5513 * List of rollup files found in the library metadata 5514 * @property rollups 5515 */ 5516 // self.rollups = null; 5517 5518 /** 5519 * Whether or not to load optional dependencies for 5520 * the requested modules 5521 * @property loadOptional 5522 * @type boolean 5523 * @default false 5524 */ 5525 // self.loadOptional = false; 5526 5527 /** 5528 * All of the derived dependencies in sorted order, which 5529 * will be populated when either calculate() or insert() 5530 * is called 5531 * @property sorted 5532 * @type string[] 5533 */ 5534 self.sorted = []; 5535 5536 /* 5537 * A list of modules to attach to the YUI instance when complete. 5538 * If not supplied, the sorted list of dependencies are applied. 5539 * @property attaching 5540 */ 5541 // self.attaching = null; 5542 5543 /** 5544 * Flag to indicate the dependency tree needs to be recomputed 5545 * if insert is called again. 5546 * @property dirty 5547 * @type boolean 5548 * @default true 5549 */ 5550 self.dirty = true; 5551 5552 /** 5553 * List of modules inserted by the utility 5554 * @property inserted 5555 * @type {string: boolean} 5556 */ 5557 self.inserted = {}; 5558 5559 /** 5560 * List of skipped modules during insert() because the module 5561 * was not defined 5562 * @property skipped 5563 */ 5564 self.skipped = {}; 5565 5566 // Y.on('yui:load', self.loadNext, self); 5567 5568 self.tested = {}; 5569 5570 /* 5571 * Cached sorted calculate results 5572 * @property results 5573 * @since 3.2.0 5574 */ 5575 //self.results = {}; 5576 5577 if (self.ignoreRegistered) { 5578 //Clear inpage already processed modules. 5579 self._resetModules(); 5580 } 5581 5582 }; 5583 5584 Y.Loader.prototype = { 5585 /** 5586 * Gets the module info from the local moduleInfo hash, or from the 5587 * default metadata and populate the local moduleInfo hash. 5588 * @method getModuleInfo 5589 * @param {string} name of the module 5590 * @public 5591 */ 5592 getModuleInfo: function(name) { 5593 5594 var m = this.moduleInfo[name], 5595 rawMetaModules, globalRenderedMods, internal, v; 5596 5597 if (m) { 5598 return m; 5599 } 5600 5601 rawMetaModules = META.modules; 5602 globalRenderedMods = GLOBAL_ENV._renderedMods; 5603 internal = this._internal; 5604 5605 /* 5606 The logic here is: 5607 5608 - if the `moduleInfo[name]` is avilable, 5609 then short circuit 5610 - otherwise, if the module is in the globalCache (cross Y instance), 5611 then port it from the global registry into `moduleInfo[name]` 5612 - otherwise, if the module has raw metadata (from meta modules) 5613 then add it to the global registry and to `moduleInfo[name]` 5614 5615 */ 5616 if (globalRenderedMods && globalRenderedMods.hasOwnProperty(name) && !this.ignoreRegistered) { 5617 this.moduleInfo[name] = Y.merge(globalRenderedMods[name]); 5618 } else { 5619 if (rawMetaModules.hasOwnProperty(name)) { 5620 this._internal = true; // making sure that modules from raw data are marked as internal 5621 v = this.addModule(rawMetaModules[name], name); 5622 // Inspect the page for the CSS module and mark it as loaded. 5623 if (v && v.type === CSS) { 5624 if (this.isCSSLoaded(v.name, true)) { 5625 this.loaded[v.name] = true; 5626 } 5627 } 5628 this._internal = internal; 5629 } 5630 } 5631 return this.moduleInfo[name]; 5632 }, 5633 /** 5634 * Expand the names that are aliases to other modules. 5635 * @method _expandAliases 5636 * @param {string[]} list a module name or a list of names to be expanded 5637 * @private 5638 * @return {array} 5639 */ 5640 _expandAliases: function(list) { 5641 var expanded = [], 5642 aliases = YUI.Env.aliases, 5643 i, name; 5644 list = Y.Array(list); 5645 for (i = 0; i < list.length; i += 1) { 5646 name = list[i]; 5647 expanded.push.apply(expanded, aliases[name] ? aliases[name] : [name]); 5648 } 5649 return expanded; 5650 }, 5651 /** 5652 * Populate the conditions cache from raw modules, this is necessary 5653 * because no other module will require a conditional module, instead 5654 * the condition has to be executed and then the module is analyzed 5655 * to be included in the final requirement list. Without this cache 5656 * conditional modules will be simply ignored. 5657 * @method _populateConditionsCache 5658 * @private 5659 */ 5660 _populateConditionsCache: function() { 5661 var rawMetaModules = META.modules, 5662 cache = GLOBAL_ENV._conditions, 5663 i, j, t, trigger; 5664 5665 // if we have conditions in cache and cache is enabled 5666 // we should port them to this loader instance 5667 if (cache && !this.ignoreRegistered) { 5668 for (i in cache) { 5669 if (cache.hasOwnProperty(i)) { 5670 this.conditions[i] = Y.merge(cache[i]); 5671 } 5672 } 5673 } else { 5674 for (i in rawMetaModules) { 5675 if (rawMetaModules.hasOwnProperty(i) && rawMetaModules[i].condition) { 5676 t = this._expandAliases(rawMetaModules[i].condition.trigger); 5677 for (j = 0; j < t.length; j += 1) { 5678 trigger = t[j]; 5679 this.conditions[trigger] = this.conditions[trigger] || {}; 5680 this.conditions[trigger][rawMetaModules[i].name || i] = rawMetaModules[i].condition; 5681 } 5682 } 5683 } 5684 GLOBAL_ENV._conditions = this.conditions; 5685 } 5686 }, 5687 /** 5688 * Reset modules in the module cache to a pre-processed state so additional 5689 * computations with a different skin or language will work as expected. 5690 * @method _resetModules 5691 * @private 5692 */ 5693 _resetModules: function() { 5694 var self = this, i, o, 5695 mod, name, details; 5696 for (i in self.moduleInfo) { 5697 if (self.moduleInfo.hasOwnProperty(i) && self.moduleInfo[i]) { 5698 mod = self.moduleInfo[i]; 5699 name = mod.name; 5700 details = (YUI.Env.mods[name] ? YUI.Env.mods[name].details : null); 5701 5702 if (details) { 5703 self.moduleInfo[name]._reset = true; 5704 self.moduleInfo[name].requires = details.requires || []; 5705 self.moduleInfo[name].optional = details.optional || []; 5706 self.moduleInfo[name].supersedes = details.supercedes || []; 5707 } 5708 5709 if (mod.defaults) { 5710 for (o in mod.defaults) { 5711 if (mod.defaults.hasOwnProperty(o)) { 5712 if (mod[o]) { 5713 mod[o] = mod.defaults[o]; 5714 } 5715 } 5716 } 5717 } 5718 mod.langCache = undefined; 5719 mod.skinCache = undefined; 5720 if (mod.skinnable) { 5721 self._addSkin(self.skin.defaultSkin, mod.name); 5722 } 5723 } 5724 } 5725 }, 5726 /** 5727 Regex that matches a CSS URL. Used to guess the file type when it's not 5728 specified. 5729 5730 @property REGEX_CSS 5731 @type RegExp 5732 @final 5733 @protected 5734 @since 3.5.0 5735 **/ 5736 REGEX_CSS: /\.css(?:[?;].*)?$/i, 5737 5738 /** 5739 * Default filters for raw and debug 5740 * @property FILTER_DEFS 5741 * @type Object 5742 * @final 5743 * @protected 5744 */ 5745 FILTER_DEFS: { 5746 RAW: { 5747 'searchExp': '-min\\.js', 5748 'replaceStr': '.js' 5749 }, 5750 DEBUG: { 5751 'searchExp': '-min\\.js', 5752 'replaceStr': '-debug.js' 5753 }, 5754 COVERAGE: { 5755 'searchExp': '-min\\.js', 5756 'replaceStr': '-coverage.js' 5757 } 5758 }, 5759 /* 5760 * Check the pages meta-data and cache the result. 5761 * @method _inspectPage 5762 * @private 5763 */ 5764 _inspectPage: function() { 5765 var self = this, v, m, req, mr, i; 5766 5767 for (i in ON_PAGE) { 5768 if (ON_PAGE.hasOwnProperty(i)) { 5769 v = ON_PAGE[i]; 5770 if (v.details) { 5771 m = self.getModuleInfo(v.name); 5772 req = v.details.requires; 5773 mr = m && m.requires; 5774 5775 if (m) { 5776 if (!m._inspected && req && mr.length !== req.length) { 5777 // console.log('deleting ' + m.name); 5778 delete m.expanded; 5779 } 5780 } else { 5781 m = self.addModule(v.details, i); 5782 } 5783 m._inspected = true; 5784 } 5785 } 5786 } 5787 }, 5788 /* 5789 * returns true if b is not loaded, and is required directly or by means of modules it supersedes. 5790 * @private 5791 * @method _requires 5792 * @param {String} mod1 The first module to compare 5793 * @param {String} mod2 The second module to compare 5794 */ 5795 _requires: function(mod1, mod2) { 5796 5797 var i, rm, after_map, s, 5798 m = this.getModuleInfo(mod1), 5799 other = this.getModuleInfo(mod2); 5800 5801 if (!m || !other) { 5802 return false; 5803 } 5804 5805 rm = m.expanded_map; 5806 after_map = m.after_map; 5807 5808 // check if this module should be sorted after the other 5809 // do this first to short circut circular deps 5810 if (after_map && (mod2 in after_map)) { 5811 return true; 5812 } 5813 5814 after_map = other.after_map; 5815 5816 // and vis-versa 5817 if (after_map && (mod1 in after_map)) { 5818 return false; 5819 } 5820 5821 // check if this module requires one the other supersedes 5822 s = other.supersedes; 5823 if (s) { 5824 for (i = 0; i < s.length; i++) { 5825 if (this._requires(mod1, s[i])) { 5826 return true; 5827 } 5828 } 5829 } 5830 5831 s = m.supersedes; 5832 if (s) { 5833 for (i = 0; i < s.length; i++) { 5834 if (this._requires(mod2, s[i])) { 5835 return false; 5836 } 5837 } 5838 } 5839 5840 // check if this module requires the other directly 5841 // if (r && yArray.indexOf(r, mod2) > -1) { 5842 if (rm && (mod2 in rm)) { 5843 return true; 5844 } 5845 5846 // external css files should be sorted below yui css 5847 if (m.ext && m.type === CSS && !other.ext && other.type === CSS) { 5848 return true; 5849 } 5850 5851 return false; 5852 }, 5853 /** 5854 * Apply a new config to the Loader instance 5855 * @method _config 5856 * @private 5857 * @param {Object} o The new configuration 5858 */ 5859 _config: function(o) { 5860 var i, j, val, a, f, group, groupName, self = this, 5861 mods = [], mod, modInfo; 5862 // apply config values 5863 if (o) { 5864 for (i in o) { 5865 if (o.hasOwnProperty(i)) { 5866 val = o[i]; 5867 //TODO This should be a case 5868 if (i === 'require') { 5869 self.require(val); 5870 } else if (i === 'skin') { 5871 //If the config.skin is a string, format to the expected object 5872 if (typeof val === 'string') { 5873 self.skin.defaultSkin = o.skin; 5874 val = { 5875 defaultSkin: val 5876 }; 5877 } 5878 5879 Y.mix(self.skin, val, true); 5880 } else if (i === 'groups') { 5881 for (j in val) { 5882 if (val.hasOwnProperty(j)) { 5883 groupName = j; 5884 group = val[j]; 5885 self.addGroup(group, groupName); 5886 if (group.aliases) { 5887 for (a in group.aliases) { 5888 if (group.aliases.hasOwnProperty(a)) { 5889 self.addAlias(group.aliases[a], a); 5890 } 5891 } 5892 } 5893 } 5894 } 5895 5896 } else if (i === 'modules') { 5897 // add a hash of module definitions 5898 for (j in val) { 5899 if (val.hasOwnProperty(j)) { 5900 self.addModule(val[j], j); 5901 } 5902 } 5903 } else if (i === 'aliases') { 5904 for (j in val) { 5905 if (val.hasOwnProperty(j)) { 5906 self.addAlias(val[j], j); 5907 } 5908 } 5909 } else if (i === 'gallery') { 5910 if (this.groups.gallery.update) { 5911 this.groups.gallery.update(val, o); 5912 } 5913 } else if (i === 'yui2' || i === '2in3') { 5914 if (this.groups.yui2.update) { 5915 this.groups.yui2.update(o['2in3'], o.yui2, o); 5916 } 5917 } else { 5918 self[i] = val; 5919 } 5920 } 5921 } 5922 } 5923 5924 // fix filter 5925 f = self.filter; 5926 5927 if (L.isString(f)) { 5928 f = f.toUpperCase(); 5929 self.filterName = f; 5930 self.filter = self.FILTER_DEFS[f]; 5931 if (f === 'DEBUG') { 5932 self.require('yui-log', 'dump'); 5933 } 5934 } 5935 5936 if (self.filterName && self.coverage) { 5937 if (self.filterName === 'COVERAGE' && L.isArray(self.coverage) && self.coverage.length) { 5938 for (i = 0; i < self.coverage.length; i++) { 5939 mod = self.coverage[i]; 5940 modInfo = self.getModuleInfo(mod); 5941 if (modInfo && modInfo.use) { 5942 mods = mods.concat(modInfo.use); 5943 } else { 5944 mods.push(mod); 5945 } 5946 } 5947 self.filters = self.filters || {}; 5948 Y.Array.each(mods, function(mod) { 5949 self.filters[mod] = self.FILTER_DEFS.COVERAGE; 5950 }); 5951 self.filterName = 'RAW'; 5952 self.filter = self.FILTER_DEFS[self.filterName]; 5953 } 5954 } 5955 5956 }, 5957 5958 /** 5959 * Returns the skin module name for the specified skin name. If a 5960 * module name is supplied, the returned skin module name is 5961 * specific to the module passed in. 5962 * @method formatSkin 5963 * @param {string} skin the name of the skin. 5964 * @param {string} mod optional: the name of a module to skin. 5965 * @return {string} the full skin module name. 5966 */ 5967 formatSkin: function(skin, mod) { 5968 var s = SKIN_PREFIX + skin; 5969 if (mod) { 5970 s = s + '-' + mod; 5971 } 5972 5973 return s; 5974 }, 5975 5976 /** 5977 * Adds the skin def to the module info 5978 * @method _addSkin 5979 * @param {string} skin the name of the skin. 5980 * @param {string} mod the name of the module. 5981 * @param {string} parent parent module if this is a skin of a 5982 * submodule or plugin. 5983 * @return {string} the module name for the skin. 5984 * @private 5985 */ 5986 _addSkin: function(skin, mod, parent) { 5987 var pkg, name, nmod, 5988 sinf = this.skin, 5989 mdef = mod && this.getModuleInfo(mod), 5990 ext = mdef && mdef.ext; 5991 5992 // Add a module definition for the module-specific skin css 5993 if (mod) { 5994 name = this.formatSkin(skin, mod); 5995 if (!this.getModuleInfo(name)) { 5996 pkg = mdef.pkg || mod; 5997 nmod = { 5998 skin: true, 5999 name: name, 6000 group: mdef.group, 6001 type: 'css', 6002 after: sinf.after, 6003 path: (parent || pkg) + '/' + sinf.base + skin + 6004 '/' + mod + '.css', 6005 ext: ext 6006 }; 6007 if (mdef.base) { 6008 nmod.base = mdef.base; 6009 } 6010 if (mdef.configFn) { 6011 nmod.configFn = mdef.configFn; 6012 } 6013 this.addModule(nmod, name); 6014 6015 } 6016 } 6017 6018 return name; 6019 }, 6020 /** 6021 * Adds an alias module to the system 6022 * @method addAlias 6023 * @param {Array} use An array of modules that makes up this alias 6024 * @param {String} name The name of the alias 6025 * @example 6026 * var loader = new Y.Loader({}); 6027 * loader.addAlias([ 'node', 'yql' ], 'davglass'); 6028 * loader.require(['davglass']); 6029 * var out = loader.resolve(true); 6030 * 6031 * //out.js will contain Node and YQL modules 6032 */ 6033 addAlias: function(use, name) { 6034 YUI.Env.aliases[name] = use; 6035 this.addModule({ 6036 name: name, 6037 use: use 6038 }); 6039 }, 6040 /** 6041 * Add a new module group 6042 * @method addGroup 6043 * @param {Object} config An object containing the group configuration data 6044 * @param {String} config.name required, the group name 6045 * @param {String} config.base The base directory for this module group 6046 * @param {String} config.root The root path to add to each combo resource path 6047 * @param {Boolean} config.combine Should the request be combined 6048 * @param {String} config.comboBase Combo service base path 6049 * @param {Object} config.modules The group of modules 6050 * @param {String} name the group name. 6051 * @example 6052 * var loader = new Y.Loader({}); 6053 * loader.addGroup({ 6054 * name: 'davglass', 6055 * combine: true, 6056 * comboBase: '/combo?', 6057 * root: '', 6058 * modules: { 6059 * //Module List here 6060 * } 6061 * }, 'davglass'); 6062 */ 6063 addGroup: function(o, name) { 6064 var mods = o.modules, 6065 self = this, i, v; 6066 6067 name = name || o.name; 6068 o.name = name; 6069 self.groups[name] = o; 6070 6071 if (o.patterns) { 6072 for (i in o.patterns) { 6073 if (o.patterns.hasOwnProperty(i)) { 6074 o.patterns[i].group = name; 6075 self.patterns[i] = o.patterns[i]; 6076 } 6077 } 6078 } 6079 6080 if (mods) { 6081 for (i in mods) { 6082 if (mods.hasOwnProperty(i)) { 6083 v = mods[i]; 6084 if (typeof v === 'string') { 6085 v = { name: i, fullpath: v }; 6086 } 6087 v.group = name; 6088 self.addModule(v, i); 6089 } 6090 } 6091 } 6092 }, 6093 6094 /** 6095 * Add a new module to the component metadata. 6096 * @method addModule 6097 * @param {Object} config An object containing the module data. 6098 * @param {String} config.name Required, the component name 6099 * @param {String} config.type Required, the component type (js or css) 6100 * @param {String} config.path Required, the path to the script from `base` 6101 * @param {Array} config.requires Array of modules required by this component 6102 * @param {Array} [config.optional] Array of optional modules for this component 6103 * @param {Array} [config.supersedes] Array of the modules this component replaces 6104 * @param {Array} [config.after] Array of modules the components which, if present, should be sorted above this one 6105 * @param {Object} [config.after_map] Faster alternative to 'after' -- supply a hash instead of an array 6106 * @param {Number} [config.rollup] The number of superseded modules required for automatic rollup 6107 * @param {String} [config.fullpath] If `fullpath` is specified, this is used instead of the configured `base + path` 6108 * @param {Boolean} [config.skinnable] Flag to determine if skin assets should automatically be pulled in 6109 * @param {Object} [config.submodules] Hash of submodules 6110 * @param {String} [config.group] The group the module belongs to -- this is set automatically when it is added as part of a group configuration. 6111 * @param {Array} [config.lang] Array of BCP 47 language tags of languages for which this module has localized resource bundles, e.g., `["en-GB", "zh-Hans-CN"]` 6112 * @param {Object} [config.condition] Specifies that the module should be loaded automatically if a condition is met. This is an object with up to four fields: 6113 * @param {String} [config.condition.trigger] The name of a module that can trigger the auto-load 6114 * @param {Function} [config.condition.test] A function that returns true when the module is to be loaded. 6115 * @param {String} [config.condition.ua] The UA name of <a href="UA.html">Y.UA</a> object that returns true when the module is to be loaded. e.g., `"ie"`, `"nodejs"`. 6116 * @param {String} [config.condition.when] Specifies the load order of the conditional module 6117 * with regard to the position of the trigger module. 6118 * This should be one of three values: `before`, `after`, or `instead`. The default is `after`. 6119 * @param {Object} [config.testresults] A hash of test results from `Y.Features.all()` 6120 * @param {Function} [config.configFn] A function to exectute when configuring this module 6121 * @param {Object} config.configFn.mod The module config, modifying this object will modify it's config. Returning false will delete the module's config. 6122 * @param {String[]} [config.optionalRequires] List of dependencies that 6123 may optionally be loaded by this loader. This is targeted mostly at 6124 polyfills, since they should not be in the list of requires because 6125 polyfills are assumed to be available in the global scope. 6126 * @param {Function} [config.test] Test to be called when this module is 6127 added as an optional dependency of another module. If the test function 6128 returns `false`, the module will be ignored and will not be attached to 6129 this YUI instance. 6130 * @param {String} [name] The module name, required if not in the module data. 6131 * @return {Object} the module definition or null if the object passed in did not provide all required attributes. 6132 */ 6133 addModule: function(o, name) { 6134 name = name || o.name; 6135 6136 if (typeof o === 'string') { 6137 o = { name: name, fullpath: o }; 6138 } 6139 6140 6141 var subs, i, l, t, sup, s, smod, plugins, plug, 6142 j, langs, packName, supName, flatSup, flatLang, lang, ret, 6143 overrides, skinname, when, g, p, 6144 modInfo = this.moduleInfo[name], 6145 conditions = this.conditions, trigger; 6146 6147 //Only merge this data if the temp flag is set 6148 //from an earlier pass from a pattern or else 6149 //an override module (YUI_config) can not be used to 6150 //replace a default module. 6151 if (modInfo && modInfo.temp) { 6152 //This catches temp modules loaded via a pattern 6153 // The module will be added twice, once from the pattern and 6154 // Once from the actual add call, this ensures that properties 6155 // that were added to the module the first time around (group: gallery) 6156 // are also added the second time around too. 6157 o = Y.merge(modInfo, o); 6158 } 6159 6160 o.name = name; 6161 6162 if (!o || !o.name) { 6163 return null; 6164 } 6165 6166 if (!o.type) { 6167 //Always assume it's javascript unless the CSS pattern is matched. 6168 o.type = JS; 6169 p = o.path || o.fullpath; 6170 if (p && this.REGEX_CSS.test(p)) { 6171 o.type = CSS; 6172 } 6173 } 6174 6175 if (!o.path && !o.fullpath) { 6176 o.path = _path(name, name, o.type); 6177 } 6178 o.supersedes = o.supersedes || o.use; 6179 6180 o.ext = ('ext' in o) ? o.ext : (this._internal) ? false : true; 6181 6182 // Handle submodule logic 6183 subs = o.submodules; 6184 6185 this.moduleInfo[name] = o; 6186 6187 o.requires = o.requires || []; 6188 6189 /* 6190 Only allowing the cascade of requires information, since 6191 optional and supersedes are far more fine grained than 6192 a blanket requires is. 6193 */ 6194 if (this.requires) { 6195 for (i = 0; i < this.requires.length; i++) { 6196 o.requires.push(this.requires[i]); 6197 } 6198 } 6199 if (o.group && this.groups && this.groups[o.group]) { 6200 g = this.groups[o.group]; 6201 if (g.requires) { 6202 for (i = 0; i < g.requires.length; i++) { 6203 o.requires.push(g.requires[i]); 6204 } 6205 } 6206 } 6207 6208 6209 if (!o.defaults) { 6210 o.defaults = { 6211 requires: o.requires ? [].concat(o.requires) : null, 6212 supersedes: o.supersedes ? [].concat(o.supersedes) : null, 6213 optional: o.optional ? [].concat(o.optional) : null 6214 }; 6215 } 6216 6217 if (o.skinnable && o.ext && o.temp) { 6218 skinname = this._addSkin(this.skin.defaultSkin, name); 6219 o.requires.unshift(skinname); 6220 } 6221 6222 if (o.requires.length) { 6223 o.requires = this.filterRequires(o.requires) || []; 6224 } 6225 6226 if (!o.langPack && o.lang) { 6227 langs = yArray(o.lang); 6228 for (j = 0; j < langs.length; j++) { 6229 lang = langs[j]; 6230 packName = this.getLangPackName(lang, name); 6231 smod = this.getModuleInfo(packName); 6232 if (!smod) { 6233 smod = this._addLangPack(lang, o, packName); 6234 } 6235 } 6236 } 6237 6238 6239 if (subs) { 6240 sup = o.supersedes || []; 6241 l = 0; 6242 6243 for (i in subs) { 6244 if (subs.hasOwnProperty(i)) { 6245 s = subs[i]; 6246 6247 s.path = s.path || _path(name, i, o.type); 6248 s.pkg = name; 6249 s.group = o.group; 6250 6251 if (s.supersedes) { 6252 sup = sup.concat(s.supersedes); 6253 } 6254 6255 smod = this.addModule(s, i); 6256 sup.push(i); 6257 6258 if (smod.skinnable) { 6259 o.skinnable = true; 6260 overrides = this.skin.overrides; 6261 if (overrides && overrides[i]) { 6262 for (j = 0; j < overrides[i].length; j++) { 6263 skinname = this._addSkin(overrides[i][j], 6264 i, name); 6265 sup.push(skinname); 6266 } 6267 } 6268 skinname = this._addSkin(this.skin.defaultSkin, 6269 i, name); 6270 sup.push(skinname); 6271 } 6272 6273 // looks like we are expected to work out the metadata 6274 // for the parent module language packs from what is 6275 // specified in the child modules. 6276 if (s.lang && s.lang.length) { 6277 6278 langs = yArray(s.lang); 6279 for (j = 0; j < langs.length; j++) { 6280 lang = langs[j]; 6281 packName = this.getLangPackName(lang, name); 6282 supName = this.getLangPackName(lang, i); 6283 smod = this.getModuleInfo(packName); 6284 6285 if (!smod) { 6286 smod = this._addLangPack(lang, o, packName); 6287 } 6288 6289 flatSup = flatSup || yArray.hash(smod.supersedes); 6290 6291 if (!(supName in flatSup)) { 6292 smod.supersedes.push(supName); 6293 } 6294 6295 o.lang = o.lang || []; 6296 6297 flatLang = flatLang || yArray.hash(o.lang); 6298 6299 if (!(lang in flatLang)) { 6300 o.lang.push(lang); 6301 } 6302 6303 // Add rollup file, need to add to supersedes list too 6304 6305 // default packages 6306 packName = this.getLangPackName(ROOT_LANG, name); 6307 supName = this.getLangPackName(ROOT_LANG, i); 6308 6309 smod = this.getModuleInfo(packName); 6310 6311 if (!smod) { 6312 smod = this._addLangPack(lang, o, packName); 6313 } 6314 6315 if (!(supName in flatSup)) { 6316 smod.supersedes.push(supName); 6317 } 6318 6319 // Add rollup file, need to add to supersedes list too 6320 6321 } 6322 } 6323 6324 l++; 6325 } 6326 } 6327 //o.supersedes = YObject.keys(yArray.hash(sup)); 6328 o.supersedes = yArray.dedupe(sup); 6329 if (this.allowRollup) { 6330 o.rollup = (l < 4) ? l : Math.min(l - 1, 4); 6331 } 6332 } 6333 6334 plugins = o.plugins; 6335 if (plugins) { 6336 for (i in plugins) { 6337 if (plugins.hasOwnProperty(i)) { 6338 plug = plugins[i]; 6339 plug.pkg = name; 6340 plug.path = plug.path || _path(name, i, o.type); 6341 plug.requires = plug.requires || []; 6342 plug.group = o.group; 6343 this.addModule(plug, i); 6344 if (o.skinnable) { 6345 this._addSkin(this.skin.defaultSkin, i, name); 6346 } 6347 6348 } 6349 } 6350 } 6351 6352 if (o.condition) { 6353 t = this._expandAliases(o.condition.trigger); 6354 for (i = 0; i < t.length; i++) { 6355 trigger = t[i]; 6356 when = o.condition.when; 6357 conditions[trigger] = conditions[trigger] || {}; 6358 conditions[trigger][name] = o.condition; 6359 // the 'when' attribute can be 'before', 'after', or 'instead' 6360 // the default is after. 6361 if (when && when !== 'after') { 6362 if (when === 'instead') { // replace the trigger 6363 o.supersedes = o.supersedes || []; 6364 o.supersedes.push(trigger); 6365 } 6366 // before the trigger 6367 // the trigger requires the conditional mod, 6368 // so it should appear before the conditional 6369 // mod if we do not intersede. 6370 } else { // after the trigger 6371 o.after = o.after || []; 6372 o.after.push(trigger); 6373 } 6374 } 6375 } 6376 6377 if (o.supersedes) { 6378 o.supersedes = this.filterRequires(o.supersedes); 6379 } 6380 6381 if (o.after) { 6382 o.after = this.filterRequires(o.after); 6383 o.after_map = yArray.hash(o.after); 6384 } 6385 6386 // this.dirty = true; 6387 6388 if (o.configFn) { 6389 ret = o.configFn(o); 6390 if (ret === false) { 6391 delete this.moduleInfo[name]; 6392 delete GLOBAL_ENV._renderedMods[name]; 6393 o = null; 6394 } 6395 } 6396 //Add to global cache 6397 if (o) { 6398 if (!GLOBAL_ENV._renderedMods) { 6399 GLOBAL_ENV._renderedMods = {}; 6400 } 6401 GLOBAL_ENV._renderedMods[name] = Y.mix(GLOBAL_ENV._renderedMods[name] || {}, o); 6402 GLOBAL_ENV._conditions = conditions; 6403 } 6404 6405 return o; 6406 }, 6407 6408 /** 6409 * Add a requirement for one or more module 6410 * @method require 6411 * @param {string[] | string*} what the modules to load. 6412 */ 6413 require: function(what) { 6414 var a = (typeof what === 'string') ? yArray(arguments) : what; 6415 this.dirty = true; 6416 this.required = Y.merge(this.required, yArray.hash(this.filterRequires(a))); 6417 6418 this._explodeRollups(); 6419 }, 6420 /** 6421 * Grab all the items that were asked for, check to see if the Loader 6422 * meta-data contains a "use" array. If it doesm remove the asked item and replace it with 6423 * the content of the "use". 6424 * This will make asking for: "dd" 6425 * Actually ask for: "dd-ddm-base,dd-ddm,dd-ddm-drop,dd-drag,dd-proxy,dd-constrain,dd-drop,dd-scroll,dd-drop-plugin" 6426 * @private 6427 * @method _explodeRollups 6428 */ 6429 _explodeRollups: function() { 6430 var self = this, m, m2, i, a, v, len, len2, 6431 r = self.required; 6432 6433 if (!self.allowRollup) { 6434 for (i in r) { 6435 if (r.hasOwnProperty(i)) { 6436 m = self.getModule(i); 6437 if (m && m.use) { 6438 len = m.use.length; 6439 for (a = 0; a < len; a++) { 6440 m2 = self.getModule(m.use[a]); 6441 if (m2 && m2.use) { 6442 len2 = m2.use.length; 6443 for (v = 0; v < len2; v++) { 6444 r[m2.use[v]] = true; 6445 } 6446 } else { 6447 r[m.use[a]] = true; 6448 } 6449 } 6450 } 6451 } 6452 } 6453 self.required = r; 6454 } 6455 6456 }, 6457 /** 6458 * Explodes the required array to remove aliases and replace them with real modules 6459 * @method filterRequires 6460 * @param {Array} r The original requires array 6461 * @return {Array} The new array of exploded requirements 6462 */ 6463 filterRequires: function(r) { 6464 if (r) { 6465 if (!Y.Lang.isArray(r)) { 6466 r = [r]; 6467 } 6468 r = Y.Array(r); 6469 var c = [], i, mod, o, m; 6470 6471 for (i = 0; i < r.length; i++) { 6472 mod = this.getModule(r[i]); 6473 if (mod && mod.use) { 6474 for (o = 0; o < mod.use.length; o++) { 6475 //Must walk the other modules in case a module is a rollup of rollups (datatype) 6476 m = this.getModule(mod.use[o]); 6477 if (m && m.use && (m.name !== mod.name)) { 6478 c = Y.Array.dedupe([].concat(c, this.filterRequires(m.use))); 6479 } else { 6480 c.push(mod.use[o]); 6481 } 6482 } 6483 } else { 6484 c.push(r[i]); 6485 } 6486 } 6487 r = c; 6488 } 6489 return r; 6490 }, 6491 6492 /** 6493 Returns `true` if the module can be attached to the YUI instance. Runs 6494 the module's test if there is one and caches its result. 6495 6496 @method _canBeAttached 6497 @param {String} module Name of the module to check. 6498 @return {Boolean} Result of the module's test if it has one, or `true`. 6499 **/ 6500 _canBeAttached: function (m) { 6501 m = this.getModule(m); 6502 if (m && m.test) { 6503 if (!m.hasOwnProperty('_testResult')) { 6504 m._testResult = m.test(Y); 6505 } 6506 return m._testResult; 6507 } 6508 // return `true` for modules not registered as Loader will know what 6509 // to do with them later on 6510 return true; 6511 }, 6512 6513 /** 6514 * Returns an object containing properties for all modules required 6515 * in order to load the requested module 6516 * @method getRequires 6517 * @param {object} mod The module definition from moduleInfo. 6518 * @return {array} the expanded requirement list. 6519 */ 6520 getRequires: function(mod) { 6521 6522 if (!mod) { 6523 //console.log('returning no reqs for ' + mod.name); 6524 return NO_REQUIREMENTS; 6525 } 6526 6527 if (mod._parsed) { 6528 //console.log('returning requires for ' + mod.name, mod.requires); 6529 return mod.expanded || NO_REQUIREMENTS; 6530 } 6531 6532 //TODO add modue cache here out of scope.. 6533 6534 var i, m, j, length, add, packName, lang, testresults = this.testresults, 6535 name = mod.name, cond, 6536 adddef = ON_PAGE[name] && ON_PAGE[name].details, 6537 optReqs = mod.optionalRequires, 6538 d, go, def, 6539 r, old_mod, 6540 o, skinmod, skindef, skinpar, skinname, 6541 intl = mod.lang || mod.intl, 6542 ftests = Y.Features && Y.Features.tests.load, 6543 hash, reparse; 6544 6545 // console.log(name); 6546 6547 // pattern match leaves module stub that needs to be filled out 6548 if (mod.temp && adddef) { 6549 old_mod = mod; 6550 mod = this.addModule(adddef, name); 6551 mod.group = old_mod.group; 6552 mod.pkg = old_mod.pkg; 6553 delete mod.expanded; 6554 } 6555 6556 // console.log('cache: ' + mod.langCache + ' == ' + this.lang); 6557 6558 //If a skin or a lang is different, reparse.. 6559 reparse = !((!this.lang || mod.langCache === this.lang) && (mod.skinCache === this.skin.defaultSkin)); 6560 6561 if (mod.expanded && !reparse) { 6562 return mod.expanded; 6563 } 6564 6565 // Optional dependencies are dependencies that may or may not be 6566 // available. 6567 // This feature was designed specifically to be used when transpiling 6568 // ES6 modules, in order to use polyfills and regular scripts that define 6569 // global variables without having to import them since they should be 6570 // available in the global scope. 6571 if (optReqs) { 6572 for (i = 0, length = optReqs.length; i < length; i++) { 6573 if (this._canBeAttached(optReqs[i])) { 6574 mod.requires.push(optReqs[i]); 6575 } 6576 } 6577 } 6578 6579 d = []; 6580 hash = {}; 6581 r = this.filterRequires(mod.requires); 6582 if (mod.lang) { 6583 //If a module has a lang attribute, auto add the intl requirement. 6584 d.unshift('intl'); 6585 r.unshift('intl'); 6586 intl = true; 6587 } 6588 o = this.filterRequires(mod.optional); 6589 6590 6591 mod._parsed = true; 6592 mod.langCache = this.lang; 6593 mod.skinCache = this.skin.defaultSkin; 6594 6595 for (i = 0; i < r.length; i++) { 6596 if (!hash[r[i]]) { 6597 d.push(r[i]); 6598 hash[r[i]] = true; 6599 m = this.getModule(r[i]); 6600 if (m) { 6601 add = this.getRequires(m); 6602 intl = intl || (m.expanded_map && 6603 (INTL in m.expanded_map)); 6604 for (j = 0; j < add.length; j++) { 6605 d.push(add[j]); 6606 } 6607 } 6608 } 6609 } 6610 6611 // get the requirements from superseded modules, if any 6612 r = this.filterRequires(mod.supersedes); 6613 if (r) { 6614 for (i = 0; i < r.length; i++) { 6615 if (!hash[r[i]]) { 6616 // if this module has submodules, the requirements list is 6617 // expanded to include the submodules. This is so we can 6618 // prevent dups when a submodule is already loaded and the 6619 // parent is requested. 6620 if (mod.submodules) { 6621 d.push(r[i]); 6622 } 6623 6624 hash[r[i]] = true; 6625 m = this.getModule(r[i]); 6626 6627 if (m) { 6628 add = this.getRequires(m); 6629 intl = intl || (m.expanded_map && 6630 (INTL in m.expanded_map)); 6631 for (j = 0; j < add.length; j++) { 6632 d.push(add[j]); 6633 } 6634 } 6635 } 6636 } 6637 } 6638 6639 if (o && this.loadOptional) { 6640 for (i = 0; i < o.length; i++) { 6641 if (!hash[o[i]]) { 6642 d.push(o[i]); 6643 hash[o[i]] = true; 6644 m = this.getModuleInfo(o[i]); 6645 if (m) { 6646 add = this.getRequires(m); 6647 intl = intl || (m.expanded_map && 6648 (INTL in m.expanded_map)); 6649 for (j = 0; j < add.length; j++) { 6650 d.push(add[j]); 6651 } 6652 } 6653 } 6654 } 6655 } 6656 6657 cond = this.conditions[name]; 6658 6659 if (cond) { 6660 //Set the module to not parsed since we have conditionals and this could change the dependency tree. 6661 mod._parsed = false; 6662 if (testresults && ftests) { 6663 oeach(testresults, function(result, id) { 6664 var condmod = ftests[id].name; 6665 if (!hash[condmod] && ftests[id].trigger === name) { 6666 if (result && ftests[id]) { 6667 hash[condmod] = true; 6668 d.push(condmod); 6669 } 6670 } 6671 }); 6672 } else { 6673 for (i in cond) { 6674 if (cond.hasOwnProperty(i)) { 6675 if (!hash[i]) { 6676 def = cond[i]; 6677 //first see if they've specfied a ua check 6678 //then see if they've got a test fn & if it returns true 6679 //otherwise just having a condition block is enough 6680 go = def && ((!def.ua && !def.test) || (def.ua && Y.UA[def.ua]) || 6681 (def.test && def.test(Y, r))); 6682 6683 if (go) { 6684 hash[i] = true; 6685 d.push(i); 6686 m = this.getModule(i); 6687 if (m) { 6688 add = this.getRequires(m); 6689 for (j = 0; j < add.length; j++) { 6690 d.push(add[j]); 6691 } 6692 6693 } 6694 } 6695 } 6696 } 6697 } 6698 } 6699 } 6700 6701 // Create skin modules 6702 if (mod.skinnable) { 6703 skindef = this.skin.overrides; 6704 for (i in YUI.Env.aliases) { 6705 if (YUI.Env.aliases.hasOwnProperty(i)) { 6706 if (Y.Array.indexOf(YUI.Env.aliases[i], name) > -1) { 6707 skinpar = i; 6708 } 6709 } 6710 } 6711 if (skindef && (skindef[name] || (skinpar && skindef[skinpar]))) { 6712 skinname = name; 6713 if (skindef[skinpar]) { 6714 skinname = skinpar; 6715 } 6716 for (i = 0; i < skindef[skinname].length; i++) { 6717 skinmod = this._addSkin(skindef[skinname][i], name); 6718 if (!this.isCSSLoaded(skinmod, this._boot)) { 6719 d.push(skinmod); 6720 } 6721 } 6722 } else { 6723 skinmod = this._addSkin(this.skin.defaultSkin, name); 6724 if (!this.isCSSLoaded(skinmod, this._boot)) { 6725 d.push(skinmod); 6726 } 6727 } 6728 } 6729 6730 mod._parsed = false; 6731 6732 if (intl) { 6733 6734 if (mod.lang && !mod.langPack && Y.Intl) { 6735 lang = Y.Intl.lookupBestLang(this.lang || ROOT_LANG, mod.lang); 6736 packName = this.getLangPackName(lang, name); 6737 if (packName) { 6738 d.unshift(packName); 6739 } 6740 } 6741 d.unshift(INTL); 6742 } 6743 6744 mod.expanded_map = yArray.hash(d); 6745 6746 mod.expanded = YObject.keys(mod.expanded_map); 6747 6748 return mod.expanded; 6749 }, 6750 /** 6751 * Check to see if named css module is already loaded on the page 6752 * @method isCSSLoaded 6753 * @param {String} name The name of the css file 6754 * @param {Boolean} skip To skip the short-circuit for ignoreRegister 6755 * @return Boolean 6756 */ 6757 isCSSLoaded: function(name, skip) { 6758 //TODO - Make this call a batching call with name being an array 6759 if (!name || !YUI.Env.cssStampEl || (!skip && this.ignoreRegistered)) { 6760 return false; 6761 } 6762 var el = YUI.Env.cssStampEl, 6763 ret = false, 6764 mod = YUI.Env._cssLoaded[name], 6765 style = el.currentStyle; //IE 6766 6767 6768 if (mod !== undefined) { 6769 return mod; 6770 } 6771 6772 //Add the classname to the element 6773 el.className = name; 6774 6775 if (!style) { 6776 style = Y.config.doc.defaultView.getComputedStyle(el, null); 6777 } 6778 6779 if (style && style.display === 'none') { 6780 ret = true; 6781 } 6782 6783 6784 el.className = ''; //Reset the classname to '' 6785 6786 YUI.Env._cssLoaded[name] = ret; 6787 6788 return ret; 6789 }, 6790 6791 /** 6792 * Returns a hash of module names the supplied module satisfies. 6793 * @method getProvides 6794 * @param {string} name The name of the module. 6795 * @return {object} what this module provides. 6796 */ 6797 getProvides: function(name) { 6798 var m = this.getModule(name), o, s; 6799 // supmap = this.provides; 6800 6801 if (!m) { 6802 return NOT_FOUND; 6803 } 6804 6805 if (m && !m.provides) { 6806 o = {}; 6807 s = m.supersedes; 6808 6809 if (s) { 6810 yArray.each(s, function(v) { 6811 Y.mix(o, this.getProvides(v)); 6812 }, this); 6813 } 6814 6815 o[name] = true; 6816 m.provides = o; 6817 6818 } 6819 6820 return m.provides; 6821 }, 6822 6823 /** 6824 * Calculates the dependency tree, the result is stored in the sorted 6825 * property. 6826 * @method calculate 6827 * @param {object} o optional options object. 6828 * @param {string} type optional argument to prune modules. 6829 */ 6830 calculate: function(o, type) { 6831 if (o || type || this.dirty) { 6832 6833 if (o) { 6834 this._config(o); 6835 } 6836 6837 if (!this._init) { 6838 this._setup(); 6839 } 6840 6841 this._explode(); 6842 6843 if (this.allowRollup) { 6844 this._rollup(); 6845 } else { 6846 this._explodeRollups(); 6847 } 6848 this._reduce(); 6849 this._sort(); 6850 } 6851 }, 6852 /** 6853 * Creates a "psuedo" package for languages provided in the lang array 6854 * @method _addLangPack 6855 * @private 6856 * @param {String} lang The language to create 6857 * @param {Object} m The module definition to create the language pack around 6858 * @param {String} packName The name of the package (e.g: lang/datatype-date-en-US) 6859 * @return {Object} The module definition 6860 */ 6861 _addLangPack: function(lang, m, packName) { 6862 var name = m.name, 6863 packPath, conf, 6864 existing = this.getModuleInfo(packName); 6865 6866 if (!existing) { 6867 6868 packPath = _path((m.pkg || name), packName, JS, true); 6869 6870 conf = { 6871 path: packPath, 6872 intl: true, 6873 langPack: true, 6874 ext: m.ext, 6875 group: m.group, 6876 supersedes: [] 6877 }; 6878 if (m.root) { 6879 conf.root = m.root; 6880 } 6881 if (m.base) { 6882 conf.base = m.base; 6883 } 6884 6885 if (m.configFn) { 6886 conf.configFn = m.configFn; 6887 } 6888 6889 this.addModule(conf, packName); 6890 6891 if (lang) { 6892 Y.Env.lang = Y.Env.lang || {}; 6893 Y.Env.lang[lang] = Y.Env.lang[lang] || {}; 6894 Y.Env.lang[lang][name] = true; 6895 } 6896 } 6897 6898 return this.getModuleInfo(packName); 6899 }, 6900 6901 /** 6902 * Investigates the current YUI configuration on the page. By default, 6903 * modules already detected will not be loaded again unless a force 6904 * option is encountered. Called by calculate() 6905 * @method _setup 6906 * @private 6907 */ 6908 _setup: function() { 6909 var info = this.moduleInfo, name, i, j, m, l, 6910 packName; 6911 6912 for (name in info) { 6913 if (info.hasOwnProperty(name)) { 6914 m = info[name]; 6915 if (m) { 6916 6917 // remove dups 6918 //m.requires = YObject.keys(yArray.hash(m.requires)); 6919 m.requires = yArray.dedupe(m.requires); 6920 6921 // Create lang pack modules 6922 //if (m.lang && m.lang.length) { 6923 if (m.lang) { 6924 // Setup root package if the module has lang defined, 6925 // it needs to provide a root language pack 6926 packName = this.getLangPackName(ROOT_LANG, name); 6927 this._addLangPack(null, m, packName); 6928 } 6929 6930 } 6931 } 6932 } 6933 6934 6935 //l = Y.merge(this.inserted); 6936 l = {}; 6937 6938 // available modules 6939 if (!this.ignoreRegistered) { 6940 Y.mix(l, GLOBAL_ENV.mods); 6941 } 6942 6943 // add the ignore list to the list of loaded packages 6944 if (this.ignore) { 6945 Y.mix(l, yArray.hash(this.ignore)); 6946 } 6947 6948 // expand the list to include superseded modules 6949 for (j in l) { 6950 if (l.hasOwnProperty(j)) { 6951 Y.mix(l, this.getProvides(j)); 6952 } 6953 } 6954 6955 // remove modules on the force list from the loaded list 6956 if (this.force) { 6957 for (i = 0; i < this.force.length; i++) { 6958 if (this.force[i] in l) { 6959 delete l[this.force[i]]; 6960 } 6961 } 6962 } 6963 6964 Y.mix(this.loaded, l); 6965 6966 this._init = true; 6967 }, 6968 6969 /** 6970 * Builds a module name for a language pack 6971 * @method getLangPackName 6972 * @param {string} lang the language code. 6973 * @param {string} mname the module to build it for. 6974 * @return {string} the language pack module name. 6975 */ 6976 getLangPackName: function(lang, mname) { 6977 return ('lang/' + mname + ((lang) ? '_' + lang : '')); 6978 }, 6979 /** 6980 * Inspects the required modules list looking for additional 6981 * dependencies. Expands the required list to include all 6982 * required modules. Called by calculate() 6983 * @method _explode 6984 * @private 6985 */ 6986 _explode: function() { 6987 //TODO Move done out of scope 6988 var r = this.required, m, reqs, done = {}, 6989 self = this, name, expound; 6990 6991 // the setup phase is over, all modules have been created 6992 self.dirty = false; 6993 6994 self._explodeRollups(); 6995 r = self.required; 6996 6997 for (name in r) { 6998 if (r.hasOwnProperty(name)) { 6999 if (!done[name]) { 7000 done[name] = true; 7001 m = self.getModule(name); 7002 if (m) { 7003 expound = m.expound; 7004 7005 if (expound) { 7006 r[expound] = self.getModule(expound); 7007 reqs = self.getRequires(r[expound]); 7008 Y.mix(r, yArray.hash(reqs)); 7009 } 7010 7011 reqs = self.getRequires(m); 7012 Y.mix(r, yArray.hash(reqs)); 7013 } 7014 } 7015 } 7016 } 7017 7018 }, 7019 /** 7020 * The default method used to test a module against a pattern 7021 * @method _patternTest 7022 * @private 7023 * @param {String} mname The module being tested 7024 * @param {String} pname The pattern to match 7025 */ 7026 _patternTest: function(mname, pname) { 7027 return (mname.indexOf(pname) > -1); 7028 }, 7029 /** 7030 * Get's the loader meta data for the requested module 7031 * @method getModule 7032 * @param {String} mname The module name to get 7033 * @return {Object} The module metadata 7034 */ 7035 getModule: function(mname) { 7036 //TODO: Remove name check - it's a quick hack to fix pattern WIP 7037 if (!mname) { 7038 return null; 7039 } 7040 7041 var p, found, pname, 7042 m = this.getModuleInfo(mname), 7043 patterns = this.patterns; 7044 7045 // check the patterns library to see if we should automatically add 7046 // the module with defaults 7047 if (!m || (m && m.ext)) { 7048 for (pname in patterns) { 7049 if (patterns.hasOwnProperty(pname)) { 7050 p = patterns[pname]; 7051 7052 //There is no test method, create a default one that tests 7053 // the pattern against the mod name 7054 if (!p.test) { 7055 p.test = this._patternTest; 7056 } 7057 7058 if (p.test(mname, pname)) { 7059 // use the metadata supplied for the pattern 7060 // as the module definition. 7061 found = p; 7062 break; 7063 } 7064 } 7065 } 7066 } 7067 7068 if (!m) { 7069 if (found) { 7070 if (p.action) { 7071 p.action.call(this, mname, pname); 7072 } else { 7073 // ext true or false? 7074 m = this.addModule(Y.merge(found, { 7075 test: void 0, 7076 temp: true 7077 }), mname); 7078 if (found.configFn) { 7079 m.configFn = found.configFn; 7080 } 7081 } 7082 } 7083 } else { 7084 if (found && m && found.configFn && !m.configFn) { 7085 m.configFn = found.configFn; 7086 m.configFn(m); 7087 } 7088 } 7089 7090 return m; 7091 }, 7092 7093 // impl in rollup submodule 7094 _rollup: function() { }, 7095 7096 /** 7097 * Remove superceded modules and loaded modules. Called by 7098 * calculate() after we have the mega list of all dependencies 7099 * @method _reduce 7100 * @return {object} the reduced dependency hash. 7101 * @private 7102 */ 7103 _reduce: function(r) { 7104 7105 r = r || this.required; 7106 7107 var i, j, s, m, type = this.loadType, 7108 ignore = this.ignore ? yArray.hash(this.ignore) : false; 7109 7110 for (i in r) { 7111 if (r.hasOwnProperty(i)) { 7112 m = this.getModule(i); 7113 // remove if already loaded 7114 if (((this.loaded[i] || ON_PAGE[i]) && 7115 !this.forceMap[i] && !this.ignoreRegistered) || 7116 (type && m && m.type !== type)) { 7117 delete r[i]; 7118 } 7119 if (ignore && ignore[i]) { 7120 delete r[i]; 7121 } 7122 // remove anything this module supersedes 7123 s = m && m.supersedes; 7124 if (s) { 7125 for (j = 0; j < s.length; j++) { 7126 if (s[j] in r) { 7127 delete r[s[j]]; 7128 } 7129 } 7130 } 7131 } 7132 } 7133 7134 return r; 7135 }, 7136 /** 7137 * Handles the queue when a module has been loaded for all cases 7138 * @method _finish 7139 * @private 7140 * @param {String} msg The message from Loader 7141 * @param {Boolean} success A boolean denoting success or failure 7142 */ 7143 _finish: function(msg, success) { 7144 7145 _queue.running = false; 7146 7147 var onEnd = this.onEnd; 7148 if (onEnd) { 7149 onEnd.call(this.context, { 7150 msg: msg, 7151 data: this.data, 7152 success: success 7153 }); 7154 } 7155 this._continue(); 7156 }, 7157 /** 7158 * The default Loader onSuccess handler, calls this.onSuccess with a payload 7159 * @method _onSuccess 7160 * @private 7161 */ 7162 _onSuccess: function() { 7163 var self = this, skipped = Y.merge(self.skipped), fn, 7164 failed = [], rreg = self.requireRegistration, 7165 success, msg, i, mod; 7166 7167 for (i in skipped) { 7168 if (skipped.hasOwnProperty(i)) { 7169 delete self.inserted[i]; 7170 } 7171 } 7172 7173 self.skipped = {}; 7174 7175 for (i in self.inserted) { 7176 if (self.inserted.hasOwnProperty(i)) { 7177 mod = self.getModule(i); 7178 if (mod && rreg && mod.type === JS && !(i in YUI.Env.mods)) { 7179 failed.push(i); 7180 } else { 7181 Y.mix(self.loaded, self.getProvides(i)); 7182 } 7183 } 7184 } 7185 7186 fn = self.onSuccess; 7187 msg = (failed.length) ? 'notregistered' : 'success'; 7188 success = !(failed.length); 7189 if (fn) { 7190 fn.call(self.context, { 7191 msg: msg, 7192 data: self.data, 7193 success: success, 7194 failed: failed, 7195 skipped: skipped 7196 }); 7197 } 7198 self._finish(msg, success); 7199 }, 7200 /** 7201 * The default Loader onProgress handler, calls this.onProgress with a payload 7202 * @method _onProgress 7203 * @private 7204 */ 7205 _onProgress: function(e) { 7206 var self = this, i; 7207 //set the internal cache to what just came in. 7208 if (e.data && e.data.length) { 7209 for (i = 0; i < e.data.length; i++) { 7210 e.data[i] = self.getModule(e.data[i].name); 7211 } 7212 } 7213 if (self.onProgress) { 7214 self.onProgress.call(self.context, { 7215 name: e.url, 7216 data: e.data 7217 }); 7218 } 7219 }, 7220 /** 7221 * The default Loader onFailure handler, calls this.onFailure with a payload 7222 * @method _onFailure 7223 * @private 7224 */ 7225 _onFailure: function(o) { 7226 var f = this.onFailure, msg = [], i = 0, len = o.errors.length; 7227 7228 for (i; i < len; i++) { 7229 msg.push(o.errors[i].error); 7230 } 7231 7232 msg = msg.join(','); 7233 7234 7235 if (f) { 7236 f.call(this.context, { 7237 msg: msg, 7238 data: this.data, 7239 success: false 7240 }); 7241 } 7242 7243 this._finish(msg, false); 7244 7245 }, 7246 7247 /** 7248 * The default Loader onTimeout handler, calls this.onTimeout with a payload 7249 * @method _onTimeout 7250 * @param {Get.Transaction} transaction The Transaction object from `Y.Get` 7251 * @private 7252 */ 7253 _onTimeout: function(transaction) { 7254 var f = this.onTimeout; 7255 if (f) { 7256 f.call(this.context, { 7257 msg: 'timeout', 7258 data: this.data, 7259 success: false, 7260 transaction: transaction 7261 }); 7262 } 7263 }, 7264 7265 /** 7266 * Sorts the dependency tree. The last step of calculate() 7267 * @method _sort 7268 * @private 7269 */ 7270 _sort: function() { 7271 var name, 7272 7273 // Object containing module names. 7274 required = this.required, 7275 7276 // Keep track of whether we've visited a module. 7277 visited = {}; 7278 7279 // Will contain modules names, in the correct order, 7280 // according to dependencies. 7281 this.sorted = []; 7282 7283 for (name in required) { 7284 if (!visited[name] && required.hasOwnProperty(name)) { 7285 this._visit(name, visited); 7286 } 7287 } 7288 }, 7289 7290 /** 7291 * Recursively visits the dependencies of the module name 7292 * passed in, and appends each module name to the `sorted` property. 7293 * @param {String} name The name of a module. 7294 * @param {Object} visited Keeps track of whether a module was visited. 7295 * @method _visit 7296 * @private 7297 */ 7298 _visit: function (name, visited) { 7299 var required, condition, moduleInfo, dependency, dependencies, 7300 trigger, isAfter, i, l; 7301 7302 visited[name] = true; 7303 required = this.required; 7304 moduleInfo = this.moduleInfo[name]; 7305 condition = this.conditions[name] || {}; 7306 7307 if (moduleInfo) { 7308 // Recurse on each dependency of this module, 7309 // figuring out its dependencies, and so on. 7310 dependencies = moduleInfo.expanded || moduleInfo.requires; 7311 7312 for (i = 0, l = dependencies.length; i < l; ++i) { 7313 dependency = dependencies[i]; 7314 trigger = condition[dependency]; 7315 7316 // We cannot process this dependency yet if it must 7317 // appear after our current module. 7318 isAfter = trigger && (!trigger.when || trigger.when === "after"); 7319 7320 // Is this module name in the required list of modules, 7321 // and have we not already visited it? 7322 if (required[dependency] && !visited[dependency] && !isAfter) { 7323 this._visit(dependency, visited); 7324 } 7325 } 7326 } 7327 7328 this.sorted.push(name); 7329 }, 7330 7331 /** 7332 * Handles the actual insertion of script/link tags 7333 * @method _insert 7334 * @private 7335 * @param {Object} source The YUI instance the request came from 7336 * @param {Object} o The metadata to include 7337 * @param {String} type JS or CSS 7338 * @param {Boolean} [skipcalc=false] Do a Loader.calculate on the meta 7339 */ 7340 _insert: function(source, o, type, skipcalc) { 7341 7342 7343 // restore the state at the time of the request 7344 if (source) { 7345 this._config(source); 7346 } 7347 7348 // build the dependency list 7349 // don't include type so we can process CSS and script in 7350 // one pass when the type is not specified. 7351 7352 var modules = this.resolve(!skipcalc), 7353 self = this, comp = 0, actions = 0, 7354 mods = {}, deps, complete; 7355 7356 self._refetch = []; 7357 7358 if (type) { 7359 //Filter out the opposite type and reset the array so the checks later work 7360 modules[((type === JS) ? CSS : JS)] = []; 7361 } 7362 if (!self.fetchCSS) { 7363 modules.css = []; 7364 } 7365 if (modules.js.length) { 7366 comp++; 7367 } 7368 if (modules.css.length) { 7369 comp++; 7370 } 7371 7372 //console.log('Resolved Modules: ', modules); 7373 7374 complete = function(d) { 7375 actions++; 7376 var errs = {}, i = 0, o = 0, u = '', fn, 7377 modName, resMods; 7378 7379 if (d && d.errors) { 7380 for (i = 0; i < d.errors.length; i++) { 7381 if (d.errors[i].request) { 7382 u = d.errors[i].request.url; 7383 } else { 7384 u = d.errors[i]; 7385 } 7386 errs[u] = u; 7387 } 7388 } 7389 7390 if (d && d.data && d.data.length && (d.type === 'success')) { 7391 for (i = 0; i < d.data.length; i++) { 7392 self.inserted[d.data[i].name] = true; 7393 //If the external module has a skin or a lang, reprocess it 7394 if (d.data[i].lang || d.data[i].skinnable) { 7395 delete self.inserted[d.data[i].name]; 7396 self._refetch.push(d.data[i].name); 7397 } 7398 } 7399 } 7400 7401 if (actions === comp) { 7402 self._loading = null; 7403 if (self._refetch.length) { 7404 //Get the deps for the new meta-data and reprocess 7405 for (i = 0; i < self._refetch.length; i++) { 7406 deps = self.getRequires(self.getModule(self._refetch[i])); 7407 for (o = 0; o < deps.length; o++) { 7408 if (!self.inserted[deps[o]]) { 7409 //We wouldn't be to this point without the module being here 7410 mods[deps[o]] = deps[o]; 7411 } 7412 } 7413 } 7414 mods = Y.Object.keys(mods); 7415 if (mods.length) { 7416 self.require(mods); 7417 resMods = self.resolve(true); 7418 if (resMods.cssMods.length) { 7419 for (i=0; i < resMods.cssMods.length; i++) { 7420 modName = resMods.cssMods[i].name; 7421 delete YUI.Env._cssLoaded[modName]; 7422 if (self.isCSSLoaded(modName)) { 7423 self.inserted[modName] = true; 7424 delete self.required[modName]; 7425 } 7426 } 7427 self.sorted = []; 7428 self._sort(); 7429 } 7430 d = null; //bail 7431 self._insert(); //insert the new deps 7432 } 7433 } 7434 if (d && d.fn) { 7435 fn = d.fn; 7436 delete d.fn; 7437 fn.call(self, d); 7438 } 7439 } 7440 }; 7441 7442 this._loading = true; 7443 7444 if (!modules.js.length && !modules.css.length) { 7445 actions = -1; 7446 complete({ 7447 fn: self._onSuccess 7448 }); 7449 return; 7450 } 7451 7452 7453 if (modules.css.length) { //Load CSS first 7454 Y.Get.css(modules.css, { 7455 data: modules.cssMods, 7456 attributes: self.cssAttributes, 7457 insertBefore: self.insertBefore, 7458 charset: self.charset, 7459 timeout: self.timeout, 7460 context: self, 7461 onProgress: function(e) { 7462 self._onProgress.call(self, e); 7463 }, 7464 onTimeout: function(d) { 7465 self._onTimeout.call(self, d); 7466 }, 7467 onSuccess: function(d) { 7468 d.type = 'success'; 7469 d.fn = self._onSuccess; 7470 complete.call(self, d); 7471 }, 7472 onFailure: function(d) { 7473 d.type = 'failure'; 7474 d.fn = self._onFailure; 7475 complete.call(self, d); 7476 } 7477 }); 7478 } 7479 7480 if (modules.js.length) { 7481 Y.Get.js(modules.js, { 7482 data: modules.jsMods, 7483 insertBefore: self.insertBefore, 7484 attributes: self.jsAttributes, 7485 charset: self.charset, 7486 timeout: self.timeout, 7487 autopurge: false, 7488 context: self, 7489 async: self.async, 7490 onProgress: function(e) { 7491 self._onProgress.call(self, e); 7492 }, 7493 onTimeout: function(d) { 7494 self._onTimeout.call(self, d); 7495 }, 7496 onSuccess: function(d) { 7497 d.type = 'success'; 7498 d.fn = self._onSuccess; 7499 complete.call(self, d); 7500 }, 7501 onFailure: function(d) { 7502 d.type = 'failure'; 7503 d.fn = self._onFailure; 7504 complete.call(self, d); 7505 } 7506 }); 7507 } 7508 }, 7509 /** 7510 * Once a loader operation is completely finished, process any additional queued items. 7511 * @method _continue 7512 * @private 7513 */ 7514 _continue: function() { 7515 if (!(_queue.running) && _queue.size() > 0) { 7516 _queue.running = true; 7517 _queue.next()(); 7518 } 7519 }, 7520 7521 /** 7522 * inserts the requested modules and their dependencies. 7523 * <code>type</code> can be "js" or "css". Both script and 7524 * css are inserted if type is not provided. 7525 * @method insert 7526 * @param {object} o optional options object. 7527 * @param {string} type the type of dependency to insert. 7528 */ 7529 insert: function(o, type, skipsort) { 7530 var self = this, copy = Y.merge(this); 7531 delete copy.require; 7532 delete copy.dirty; 7533 _queue.add(function() { 7534 self._insert(copy, o, type, skipsort); 7535 }); 7536 this._continue(); 7537 }, 7538 7539 /** 7540 * Executed every time a module is loaded, and if we are in a load 7541 * cycle, we attempt to load the next script. Public so that it 7542 * is possible to call this if using a method other than 7543 * Y.register to determine when scripts are fully loaded 7544 * @method loadNext 7545 * @deprecated 7546 * @param {string} mname optional the name of the module that has 7547 * been loaded (which is usually why it is time to load the next 7548 * one). 7549 */ 7550 loadNext: function() { 7551 return; 7552 }, 7553 7554 /** 7555 * Apply filter defined for this instance to a url/path 7556 * @method _filter 7557 * @param {string} u the string to filter. 7558 * @param {string} name the name of the module, if we are processing 7559 * a single module as opposed to a combined url. 7560 * @return {string} the filtered string. 7561 * @private 7562 */ 7563 _filter: function(u, name, group) { 7564 var f = this.filter, 7565 hasFilter = name && (name in this.filters), 7566 modFilter = hasFilter && this.filters[name], 7567 groupName = group || (this.getModuleInfo(name) || {}).group || null; 7568 7569 if (groupName && this.groups[groupName] && this.groups[groupName].filter) { 7570 modFilter = this.groups[groupName].filter; 7571 hasFilter = true; 7572 } 7573 7574 if (u) { 7575 if (hasFilter) { 7576 f = (L.isString(modFilter)) ? this.FILTER_DEFS[modFilter.toUpperCase()] || null : modFilter; 7577 } 7578 if (f) { 7579 u = u.replace(new RegExp(f.searchExp, 'g'), f.replaceStr); 7580 } 7581 } 7582 return u; 7583 }, 7584 7585 /** 7586 * Generates the full url for a module 7587 * @method _url 7588 * @param {string} path the path fragment. 7589 * @param {String} name The name of the module 7590 * @param {String} [base] The base url to use. Defaults to self.base 7591 * @return {string} the full url. 7592 * @private 7593 */ 7594 _url: function(path, name, base) { 7595 return this._filter((base || this.base || '') + path, name); 7596 }, 7597 /** 7598 * Returns an Object hash of file arrays built from `loader.sorted` or from an arbitrary list of sorted modules. 7599 * @method resolve 7600 * @param {Boolean} [calc=false] Perform a loader.calculate() before anything else 7601 * @param {Array} [sorted=loader.sorted] An override for the loader.sorted array 7602 * @return {Object} Object hash (js and css) of two arrays of file lists 7603 * @example This method can be used as an off-line dep calculator 7604 * 7605 * var Y = YUI(); 7606 * var loader = new Y.Loader({ 7607 * filter: 'debug', 7608 * base: '../../', 7609 * root: 'build/', 7610 * combine: true, 7611 * require: ['node', 'dd', 'console'] 7612 * }); 7613 * var out = loader.resolve(true); 7614 * 7615 */ 7616 resolve: function(calc, sorted) { 7617 var self = this, 7618 resolved = { js: [], jsMods: [], css: [], cssMods: [] }, 7619 addSingle; 7620 7621 if (self.skin.overrides || self.skin.defaultSkin !== DEFAULT_SKIN || self.ignoreRegistered) { 7622 self._resetModules(); 7623 } 7624 7625 if (calc) { 7626 self.calculate(); 7627 } 7628 sorted = sorted || self.sorted; 7629 7630 addSingle = function(mod) { 7631 if (mod) { 7632 var group = (mod.group && self.groups[mod.group]) || NOT_FOUND, 7633 url; 7634 7635 //Always assume it's async 7636 if (group.async === false) { 7637 mod.async = group.async; 7638 } 7639 7640 url = (mod.fullpath) ? self._filter(mod.fullpath, mod.name) : 7641 self._url(mod.path, mod.name, group.base || mod.base); 7642 7643 if (mod.attributes || mod.async === false) { 7644 url = { 7645 url: url, 7646 async: mod.async 7647 }; 7648 if (mod.attributes) { 7649 url.attributes = mod.attributes; 7650 } 7651 } 7652 resolved[mod.type].push(url); 7653 resolved[mod.type + 'Mods'].push(mod); 7654 } else { 7655 } 7656 7657 }; 7658 7659 /*jslint vars: true */ 7660 var inserted = (self.ignoreRegistered) ? {} : self.inserted, 7661 comboSources = {}, 7662 maxURLLength, 7663 comboMeta, 7664 comboBase, 7665 comboSep, 7666 group, 7667 mod, 7668 len, 7669 i; 7670 /*jslint vars: false */ 7671 7672 for (i = 0, len = sorted.length; i < len; i++) { 7673 mod = self.getModule(sorted[i]); 7674 if (!mod || inserted[mod.name]) { 7675 continue; 7676 } 7677 7678 group = self.groups[mod.group]; 7679 7680 comboBase = self.comboBase; 7681 7682 if (group) { 7683 if (!group.combine || mod.fullpath) { 7684 //This is not a combo module, skip it and load it singly later. 7685 addSingle(mod); 7686 continue; 7687 } 7688 mod.combine = true; 7689 7690 if (typeof group.root === 'string') { 7691 mod.root = group.root; 7692 } 7693 7694 comboBase = group.comboBase || comboBase; 7695 comboSep = group.comboSep; 7696 maxURLLength = group.maxURLLength; 7697 } else { 7698 if (!self.combine) { 7699 //This is not a combo module, skip it and load it singly later. 7700 addSingle(mod); 7701 continue; 7702 } 7703 } 7704 7705 if (!mod.combine && mod.ext) { 7706 addSingle(mod); 7707 continue; 7708 } 7709 7710 comboSources[comboBase] = comboSources[comboBase] || 7711 { js: [], jsMods: [], css: [], cssMods: [] }; 7712 7713 comboMeta = comboSources[comboBase]; 7714 comboMeta.group = mod.group; 7715 comboMeta.comboSep = comboSep || self.comboSep; 7716 comboMeta.maxURLLength = maxURLLength || self.maxURLLength; 7717 7718 comboMeta[mod.type + 'Mods'].push(mod); 7719 } 7720 7721 // TODO: Refactor the encoding logic below into its own method. 7722 7723 /*jslint vars: true */ 7724 var fragSubset, 7725 modules, 7726 tmpBase, 7727 baseLen, 7728 frags, 7729 frag, 7730 type; 7731 /*jslint vars: false */ 7732 7733 for (comboBase in comboSources) { 7734 if (comboSources.hasOwnProperty(comboBase)) { 7735 comboMeta = comboSources[comboBase]; 7736 comboSep = comboMeta.comboSep; 7737 maxURLLength = comboMeta.maxURLLength; 7738 for (type in comboMeta) { 7739 if (type === JS || type === CSS) { 7740 modules = comboMeta[type + 'Mods']; 7741 frags = []; 7742 for (i = 0, len = modules.length; i < len; i += 1) { 7743 mod = modules[i]; 7744 frag = ((typeof mod.root === 'string') ? mod.root : self.root) + (mod.path || mod.fullpath); 7745 frags.push( 7746 self._filter(frag, mod.name) 7747 ); 7748 } 7749 tmpBase = comboBase + frags.join(comboSep); 7750 baseLen = tmpBase.length; 7751 if (maxURLLength <= comboBase.length) { 7752 maxURLLength = MAX_URL_LENGTH; 7753 } 7754 7755 if (frags.length) { 7756 if (baseLen > maxURLLength) { 7757 fragSubset = []; 7758 for (i = 0, len = frags.length; i < len; i++) { 7759 fragSubset.push(frags[i]); 7760 tmpBase = comboBase + fragSubset.join(comboSep); 7761 7762 if (tmpBase.length > maxURLLength) { 7763 frag = fragSubset.pop(); 7764 tmpBase = comboBase + fragSubset.join(comboSep); 7765 resolved[type].push(self._filter(tmpBase, null, comboMeta.group)); 7766 fragSubset = []; 7767 if (frag) { 7768 fragSubset.push(frag); 7769 } 7770 } 7771 } 7772 if (fragSubset.length) { 7773 tmpBase = comboBase + fragSubset.join(comboSep); 7774 resolved[type].push(self._filter(tmpBase, null, comboMeta.group)); 7775 } 7776 } else { 7777 resolved[type].push(self._filter(tmpBase, null, comboMeta.group)); 7778 } 7779 } 7780 resolved[type + 'Mods'] = resolved[type + 'Mods'].concat(modules); 7781 } 7782 } 7783 } 7784 } 7785 7786 return resolved; 7787 }, 7788 7789 /** 7790 Shortcut to calculate, resolve and load all modules. 7791 7792 var loader = new Y.Loader({ 7793 ignoreRegistered: true, 7794 modules: { 7795 mod: { 7796 path: 'mod.js' 7797 } 7798 }, 7799 requires: [ 'mod' ] 7800 }); 7801 loader.load(function() { 7802 console.log('All modules have loaded..'); 7803 }); 7804 7805 7806 @method load 7807 @param {Function} cb Executed after all load operations are complete 7808 */ 7809 load: function(cb) { 7810 if (!cb) { 7811 return; 7812 } 7813 var self = this, 7814 out = self.resolve(true); 7815 7816 self.data = out; 7817 7818 self.onEnd = function() { 7819 cb.apply(self.context || self, arguments); 7820 }; 7821 7822 self.insert(); 7823 } 7824 }; 7825 7826 7827 7828 }, '3.17.2', {"requires": ["get", "features"]}); 7829 YUI.add('loader-rollup', function (Y, NAME) { 7830 7831 /** 7832 * Optional automatic rollup logic for reducing http connections 7833 * when not using a combo service. 7834 * @module loader 7835 * @submodule rollup 7836 */ 7837 7838 /** 7839 * Look for rollup packages to determine if all of the modules a 7840 * rollup supersedes are required. If so, include the rollup to 7841 * help reduce the total number of connections required. Called 7842 * by calculate(). This is an optional feature, and requires the 7843 * appropriate submodule to function. 7844 * @method _rollup 7845 * @for Loader 7846 * @private 7847 */ 7848 Y.Loader.prototype._rollup = function() { 7849 var i, j, m, s, r = this.required, roll, 7850 info = this.moduleInfo, rolled, c, smod; 7851 7852 // find and cache rollup modules 7853 if (this.dirty || !this.rollups) { 7854 this.rollups = {}; 7855 for (i in info) { 7856 if (info.hasOwnProperty(i)) { 7857 m = this.getModule(i); 7858 // if (m && m.rollup && m.supersedes) { 7859 if (m && m.rollup) { 7860 this.rollups[i] = m; 7861 } 7862 } 7863 } 7864 } 7865 7866 // make as many passes as needed to pick up rollup rollups 7867 for (;;) { 7868 rolled = false; 7869 7870 // go through the rollup candidates 7871 for (i in this.rollups) { 7872 if (this.rollups.hasOwnProperty(i)) { 7873 // there can be only one, unless forced 7874 if (!r[i] && ((!this.loaded[i]) || this.forceMap[i])) { 7875 m = this.getModule(i); 7876 s = m.supersedes || []; 7877 roll = false; 7878 7879 // @TODO remove continue 7880 if (!m.rollup) { 7881 continue; 7882 } 7883 7884 c = 0; 7885 7886 // check the threshold 7887 for (j = 0; j < s.length; j++) { 7888 smod = info[s[j]]; 7889 7890 // if the superseded module is loaded, we can't 7891 // load the rollup unless it has been forced. 7892 if (this.loaded[s[j]] && !this.forceMap[s[j]]) { 7893 roll = false; 7894 break; 7895 // increment the counter if this module is required. 7896 // if we are beyond the rollup threshold, we will 7897 // use the rollup module 7898 } else if (r[s[j]] && m.type === smod.type) { 7899 c++; 7900 roll = (c >= m.rollup); 7901 if (roll) { 7902 break; 7903 } 7904 } 7905 } 7906 7907 if (roll) { 7908 // add the rollup 7909 r[i] = true; 7910 rolled = true; 7911 7912 // expand the rollup's dependencies 7913 this.getRequires(m); 7914 } 7915 } 7916 } 7917 } 7918 7919 // if we made it here w/o rolling up something, we are done 7920 if (!rolled) { 7921 break; 7922 } 7923 } 7924 }; 7925 7926 7927 }, '3.17.2', {"requires": ["loader-base"]}); 7928 YUI.add('loader-yui3', function (Y, NAME) { 7929 7930 /* This file is auto-generated by (yogi.js loader --mix --yes) */ 7931 7932 /*jshint maxlen:900, eqeqeq: false */ 7933 7934 /** 7935 * YUI 3 module metadata 7936 * @module loader 7937 * @submodule loader-yui3 7938 */ 7939 YUI.Env[Y.version].modules = YUI.Env[Y.version].modules || {}; 7940 Y.mix(YUI.Env[Y.version].modules, { 7941 "align-plugin": { 7942 "requires": [ 7943 "node-screen", 7944 "node-pluginhost" 7945 ] 7946 }, 7947 "anim": { 7948 "use": [ 7949 "anim-base", 7950 "anim-color", 7951 "anim-curve", 7952 "anim-easing", 7953 "anim-node-plugin", 7954 "anim-scroll", 7955 "anim-xy" 7956 ] 7957 }, 7958 "anim-base": { 7959 "requires": [ 7960 "base-base", 7961 "node-style", 7962 "color-base" 7963 ] 7964 }, 7965 "anim-color": { 7966 "requires": [ 7967 "anim-base" 7968 ] 7969 }, 7970 "anim-curve": { 7971 "requires": [ 7972 "anim-xy" 7973 ] 7974 }, 7975 "anim-easing": { 7976 "requires": [ 7977 "anim-base" 7978 ] 7979 }, 7980 "anim-node-plugin": { 7981 "requires": [ 7982 "node-pluginhost", 7983 "anim-base" 7984 ] 7985 }, 7986 "anim-scroll": { 7987 "requires": [ 7988 "anim-base" 7989 ] 7990 }, 7991 "anim-shape": { 7992 "requires": [ 7993 "anim-base", 7994 "anim-easing", 7995 "anim-color", 7996 "matrix" 7997 ] 7998 }, 7999 "anim-shape-transform": { 8000 "use": [ 8001 "anim-shape" 8002 ] 8003 }, 8004 "anim-xy": { 8005 "requires": [ 8006 "anim-base", 8007 "node-screen" 8008 ] 8009 }, 8010 "app": { 8011 "use": [ 8012 "app-base", 8013 "app-content", 8014 "app-transitions", 8015 "lazy-model-list", 8016 "model", 8017 "model-list", 8018 "model-sync-rest", 8019 "model-sync-local", 8020 "router", 8021 "view", 8022 "view-node-map" 8023 ] 8024 }, 8025 "app-base": { 8026 "requires": [ 8027 "classnamemanager", 8028 "pjax-base", 8029 "router", 8030 "view" 8031 ] 8032 }, 8033 "app-content": { 8034 "requires": [ 8035 "app-base", 8036 "pjax-content" 8037 ] 8038 }, 8039 "app-transitions": { 8040 "requires": [ 8041 "app-base" 8042 ] 8043 }, 8044 "app-transitions-css": { 8045 "type": "css" 8046 }, 8047 "app-transitions-native": { 8048 "condition": { 8049 "name": "app-transitions-native", 8050 "test": function (Y) { 8051 var doc = Y.config.doc, 8052 node = doc ? doc.documentElement : null; 8053 8054 if (node && node.style) { 8055 return ('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); 8056 } 8057 8058 return false; 8059 }, 8060 "trigger": "app-transitions" 8061 }, 8062 "requires": [ 8063 "app-transitions", 8064 "app-transitions-css", 8065 "parallel", 8066 "transition" 8067 ] 8068 }, 8069 "array-extras": { 8070 "requires": [ 8071 "yui-base" 8072 ] 8073 }, 8074 "array-invoke": { 8075 "requires": [ 8076 "yui-base" 8077 ] 8078 }, 8079 "arraylist": { 8080 "requires": [ 8081 "yui-base" 8082 ] 8083 }, 8084 "arraylist-add": { 8085 "requires": [ 8086 "arraylist" 8087 ] 8088 }, 8089 "arraylist-filter": { 8090 "requires": [ 8091 "arraylist" 8092 ] 8093 }, 8094 "arraysort": { 8095 "requires": [ 8096 "yui-base" 8097 ] 8098 }, 8099 "async-queue": { 8100 "requires": [ 8101 "event-custom" 8102 ] 8103 }, 8104 "attribute": { 8105 "use": [ 8106 "attribute-base", 8107 "attribute-complex" 8108 ] 8109 }, 8110 "attribute-base": { 8111 "requires": [ 8112 "attribute-core", 8113 "attribute-observable", 8114 "attribute-extras" 8115 ] 8116 }, 8117 "attribute-complex": { 8118 "requires": [ 8119 "attribute-base" 8120 ] 8121 }, 8122 "attribute-core": { 8123 "requires": [ 8124 "oop" 8125 ] 8126 }, 8127 "attribute-events": { 8128 "use": [ 8129 "attribute-observable" 8130 ] 8131 }, 8132 "attribute-extras": { 8133 "requires": [ 8134 "oop" 8135 ] 8136 }, 8137 "attribute-observable": { 8138 "requires": [ 8139 "event-custom" 8140 ] 8141 }, 8142 "autocomplete": { 8143 "use": [ 8144 "autocomplete-base", 8145 "autocomplete-sources", 8146 "autocomplete-list", 8147 "autocomplete-plugin" 8148 ] 8149 }, 8150 "autocomplete-base": { 8151 "optional": [ 8152 "autocomplete-sources" 8153 ], 8154 "requires": [ 8155 "array-extras", 8156 "base-build", 8157 "escape", 8158 "event-valuechange", 8159 "node-base" 8160 ] 8161 }, 8162 "autocomplete-filters": { 8163 "requires": [ 8164 "array-extras", 8165 "text-wordbreak" 8166 ] 8167 }, 8168 "autocomplete-filters-accentfold": { 8169 "requires": [ 8170 "array-extras", 8171 "text-accentfold", 8172 "text-wordbreak" 8173 ] 8174 }, 8175 "autocomplete-highlighters": { 8176 "requires": [ 8177 "array-extras", 8178 "highlight-base" 8179 ] 8180 }, 8181 "autocomplete-highlighters-accentfold": { 8182 "requires": [ 8183 "array-extras", 8184 "highlight-accentfold" 8185 ] 8186 }, 8187 "autocomplete-list": { 8188 "after": [ 8189 "autocomplete-sources" 8190 ], 8191 "lang": [ 8192 "en", 8193 "es", 8194 "hu", 8195 "it" 8196 ], 8197 "requires": [ 8198 "autocomplete-base", 8199 "event-resize", 8200 "node-screen", 8201 "selector-css3", 8202 "shim-plugin", 8203 "widget", 8204 "widget-position", 8205 "widget-position-align" 8206 ], 8207 "skinnable": true 8208 }, 8209 "autocomplete-list-keys": { 8210 "condition": { 8211 "name": "autocomplete-list-keys", 8212 "test": function (Y) { 8213 // Only add keyboard support to autocomplete-list if this doesn't appear to 8214 // be an iOS or Android-based mobile device. 8215 // 8216 // There's currently no feasible way to actually detect whether a device has 8217 // a hardware keyboard, so this sniff will have to do. It can easily be 8218 // overridden by manually loading the autocomplete-list-keys module. 8219 // 8220 // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari 8221 // doesn't fire the keyboard events used by AutoCompleteList, so there's 8222 // no point loading the -keys module even when a bluetooth keyboard may be 8223 // available. 8224 return !(Y.UA.ios || Y.UA.android); 8225 }, 8226 "trigger": "autocomplete-list" 8227 }, 8228 "requires": [ 8229 "autocomplete-list", 8230 "base-build" 8231 ] 8232 }, 8233 "autocomplete-plugin": { 8234 "requires": [ 8235 "autocomplete-list", 8236 "node-pluginhost" 8237 ] 8238 }, 8239 "autocomplete-sources": { 8240 "optional": [ 8241 "io-base", 8242 "json-parse", 8243 "jsonp", 8244 "yql" 8245 ], 8246 "requires": [ 8247 "autocomplete-base" 8248 ] 8249 }, 8250 "axes": { 8251 "use": [ 8252 "axis-numeric", 8253 "axis-category", 8254 "axis-time", 8255 "axis-stacked" 8256 ] 8257 }, 8258 "axes-base": { 8259 "use": [ 8260 "axis-numeric-base", 8261 "axis-category-base", 8262 "axis-time-base", 8263 "axis-stacked-base" 8264 ] 8265 }, 8266 "axis": { 8267 "requires": [ 8268 "dom", 8269 "widget", 8270 "widget-position", 8271 "widget-stack", 8272 "graphics", 8273 "axis-base" 8274 ] 8275 }, 8276 "axis-base": { 8277 "requires": [ 8278 "classnamemanager", 8279 "datatype-number", 8280 "datatype-date", 8281 "base", 8282 "event-custom" 8283 ] 8284 }, 8285 "axis-category": { 8286 "requires": [ 8287 "axis", 8288 "axis-category-base" 8289 ] 8290 }, 8291 "axis-category-base": { 8292 "requires": [ 8293 "axis-base" 8294 ] 8295 }, 8296 "axis-numeric": { 8297 "requires": [ 8298 "axis", 8299 "axis-numeric-base" 8300 ] 8301 }, 8302 "axis-numeric-base": { 8303 "requires": [ 8304 "axis-base" 8305 ] 8306 }, 8307 "axis-stacked": { 8308 "requires": [ 8309 "axis-numeric", 8310 "axis-stacked-base" 8311 ] 8312 }, 8313 "axis-stacked-base": { 8314 "requires": [ 8315 "axis-numeric-base" 8316 ] 8317 }, 8318 "axis-time": { 8319 "requires": [ 8320 "axis", 8321 "axis-time-base" 8322 ] 8323 }, 8324 "axis-time-base": { 8325 "requires": [ 8326 "axis-base" 8327 ] 8328 }, 8329 "base": { 8330 "use": [ 8331 "base-base", 8332 "base-pluginhost", 8333 "base-build" 8334 ] 8335 }, 8336 "base-base": { 8337 "requires": [ 8338 "attribute-base", 8339 "base-core", 8340 "base-observable" 8341 ] 8342 }, 8343 "base-build": { 8344 "requires": [ 8345 "base-base" 8346 ] 8347 }, 8348 "base-core": { 8349 "requires": [ 8350 "attribute-core" 8351 ] 8352 }, 8353 "base-observable": { 8354 "requires": [ 8355 "attribute-observable", 8356 "base-core" 8357 ] 8358 }, 8359 "base-pluginhost": { 8360 "requires": [ 8361 "base-base", 8362 "pluginhost" 8363 ] 8364 }, 8365 "button": { 8366 "requires": [ 8367 "button-core", 8368 "cssbutton", 8369 "widget" 8370 ] 8371 }, 8372 "button-core": { 8373 "requires": [ 8374 "attribute-core", 8375 "classnamemanager", 8376 "node-base", 8377 "escape" 8378 ] 8379 }, 8380 "button-group": { 8381 "requires": [ 8382 "button-plugin", 8383 "cssbutton", 8384 "widget" 8385 ] 8386 }, 8387 "button-plugin": { 8388 "requires": [ 8389 "button-core", 8390 "cssbutton", 8391 "node-pluginhost" 8392 ] 8393 }, 8394 "cache": { 8395 "use": [ 8396 "cache-base", 8397 "cache-offline", 8398 "cache-plugin" 8399 ] 8400 }, 8401 "cache-base": { 8402 "requires": [ 8403 "base" 8404 ] 8405 }, 8406 "cache-offline": { 8407 "requires": [ 8408 "cache-base", 8409 "json" 8410 ] 8411 }, 8412 "cache-plugin": { 8413 "requires": [ 8414 "plugin", 8415 "cache-base" 8416 ] 8417 }, 8418 "calendar": { 8419 "requires": [ 8420 "calendar-base", 8421 "calendarnavigator" 8422 ], 8423 "skinnable": true 8424 }, 8425 "calendar-base": { 8426 "lang": [ 8427 "de", 8428 "en", 8429 "es", 8430 "es-AR", 8431 "fr", 8432 "hu", 8433 "it", 8434 "ja", 8435 "nb-NO", 8436 "nl", 8437 "pt-BR", 8438 "ru", 8439 "zh-Hans", 8440 "zh-Hans-CN", 8441 "zh-Hant", 8442 "zh-Hant-HK", 8443 "zh-HANT-TW" 8444 ], 8445 "requires": [ 8446 "widget", 8447 "datatype-date", 8448 "datatype-date-math", 8449 "cssgrids" 8450 ], 8451 "skinnable": true 8452 }, 8453 "calendarnavigator": { 8454 "requires": [ 8455 "plugin", 8456 "classnamemanager", 8457 "datatype-date", 8458 "node" 8459 ], 8460 "skinnable": true 8461 }, 8462 "charts": { 8463 "use": [ 8464 "charts-base" 8465 ] 8466 }, 8467 "charts-base": { 8468 "requires": [ 8469 "dom", 8470 "event-mouseenter", 8471 "event-touch", 8472 "graphics-group", 8473 "axes", 8474 "series-pie", 8475 "series-line", 8476 "series-marker", 8477 "series-area", 8478 "series-spline", 8479 "series-column", 8480 "series-bar", 8481 "series-areaspline", 8482 "series-combo", 8483 "series-combospline", 8484 "series-line-stacked", 8485 "series-marker-stacked", 8486 "series-area-stacked", 8487 "series-spline-stacked", 8488 "series-column-stacked", 8489 "series-bar-stacked", 8490 "series-areaspline-stacked", 8491 "series-combo-stacked", 8492 "series-combospline-stacked" 8493 ] 8494 }, 8495 "charts-legend": { 8496 "requires": [ 8497 "charts-base" 8498 ] 8499 }, 8500 "classnamemanager": { 8501 "requires": [ 8502 "yui-base" 8503 ] 8504 }, 8505 "clickable-rail": { 8506 "requires": [ 8507 "slider-base" 8508 ] 8509 }, 8510 "collection": { 8511 "use": [ 8512 "array-extras", 8513 "arraylist", 8514 "arraylist-add", 8515 "arraylist-filter", 8516 "array-invoke" 8517 ] 8518 }, 8519 "color": { 8520 "use": [ 8521 "color-base", 8522 "color-hsl", 8523 "color-harmony" 8524 ] 8525 }, 8526 "color-base": { 8527 "requires": [ 8528 "yui-base" 8529 ] 8530 }, 8531 "color-harmony": { 8532 "requires": [ 8533 "color-hsl" 8534 ] 8535 }, 8536 "color-hsl": { 8537 "requires": [ 8538 "color-base" 8539 ] 8540 }, 8541 "color-hsv": { 8542 "requires": [ 8543 "color-base" 8544 ] 8545 }, 8546 "console": { 8547 "lang": [ 8548 "en", 8549 "es", 8550 "hu", 8551 "it", 8552 "ja" 8553 ], 8554 "requires": [ 8555 "yui-log", 8556 "widget" 8557 ], 8558 "skinnable": true 8559 }, 8560 "console-filters": { 8561 "requires": [ 8562 "plugin", 8563 "console" 8564 ], 8565 "skinnable": true 8566 }, 8567 "content-editable": { 8568 "requires": [ 8569 "node-base", 8570 "editor-selection", 8571 "stylesheet", 8572 "plugin" 8573 ] 8574 }, 8575 "controller": { 8576 "use": [ 8577 "router" 8578 ] 8579 }, 8580 "cookie": { 8581 "requires": [ 8582 "yui-base" 8583 ] 8584 }, 8585 "createlink-base": { 8586 "requires": [ 8587 "editor-base" 8588 ] 8589 }, 8590 "cssbase": { 8591 "after": [ 8592 "cssreset", 8593 "cssfonts", 8594 "cssgrids", 8595 "cssreset-context", 8596 "cssfonts-context", 8597 "cssgrids-context" 8598 ], 8599 "type": "css" 8600 }, 8601 "cssbase-context": { 8602 "after": [ 8603 "cssreset", 8604 "cssfonts", 8605 "cssgrids", 8606 "cssreset-context", 8607 "cssfonts-context", 8608 "cssgrids-context" 8609 ], 8610 "type": "css" 8611 }, 8612 "cssbutton": { 8613 "type": "css" 8614 }, 8615 "cssfonts": { 8616 "type": "css" 8617 }, 8618 "cssfonts-context": { 8619 "type": "css" 8620 }, 8621 "cssgrids": { 8622 "optional": [ 8623 "cssnormalize" 8624 ], 8625 "type": "css" 8626 }, 8627 "cssgrids-base": { 8628 "optional": [ 8629 "cssnormalize" 8630 ], 8631 "type": "css" 8632 }, 8633 "cssgrids-responsive": { 8634 "optional": [ 8635 "cssnormalize" 8636 ], 8637 "requires": [ 8638 "cssgrids", 8639 "cssgrids-responsive-base" 8640 ], 8641 "type": "css" 8642 }, 8643 "cssgrids-units": { 8644 "optional": [ 8645 "cssnormalize" 8646 ], 8647 "requires": [ 8648 "cssgrids-base" 8649 ], 8650 "type": "css" 8651 }, 8652 "cssnormalize": { 8653 "type": "css" 8654 }, 8655 "cssnormalize-context": { 8656 "type": "css" 8657 }, 8658 "cssreset": { 8659 "type": "css" 8660 }, 8661 "cssreset-context": { 8662 "type": "css" 8663 }, 8664 "dataschema": { 8665 "use": [ 8666 "dataschema-base", 8667 "dataschema-json", 8668 "dataschema-xml", 8669 "dataschema-array", 8670 "dataschema-text" 8671 ] 8672 }, 8673 "dataschema-array": { 8674 "requires": [ 8675 "dataschema-base" 8676 ] 8677 }, 8678 "dataschema-base": { 8679 "requires": [ 8680 "base" 8681 ] 8682 }, 8683 "dataschema-json": { 8684 "requires": [ 8685 "dataschema-base", 8686 "json" 8687 ] 8688 }, 8689 "dataschema-text": { 8690 "requires": [ 8691 "dataschema-base" 8692 ] 8693 }, 8694 "dataschema-xml": { 8695 "requires": [ 8696 "dataschema-base" 8697 ] 8698 }, 8699 "datasource": { 8700 "use": [ 8701 "datasource-local", 8702 "datasource-io", 8703 "datasource-get", 8704 "datasource-function", 8705 "datasource-cache", 8706 "datasource-jsonschema", 8707 "datasource-xmlschema", 8708 "datasource-arrayschema", 8709 "datasource-textschema", 8710 "datasource-polling" 8711 ] 8712 }, 8713 "datasource-arrayschema": { 8714 "requires": [ 8715 "datasource-local", 8716 "plugin", 8717 "dataschema-array" 8718 ] 8719 }, 8720 "datasource-cache": { 8721 "requires": [ 8722 "datasource-local", 8723 "plugin", 8724 "cache-base" 8725 ] 8726 }, 8727 "datasource-function": { 8728 "requires": [ 8729 "datasource-local" 8730 ] 8731 }, 8732 "datasource-get": { 8733 "requires": [ 8734 "datasource-local", 8735 "get" 8736 ] 8737 }, 8738 "datasource-io": { 8739 "requires": [ 8740 "datasource-local", 8741 "io-base" 8742 ] 8743 }, 8744 "datasource-jsonschema": { 8745 "requires": [ 8746 "datasource-local", 8747 "plugin", 8748 "dataschema-json" 8749 ] 8750 }, 8751 "datasource-local": { 8752 "requires": [ 8753 "base" 8754 ] 8755 }, 8756 "datasource-polling": { 8757 "requires": [ 8758 "datasource-local" 8759 ] 8760 }, 8761 "datasource-textschema": { 8762 "requires": [ 8763 "datasource-local", 8764 "plugin", 8765 "dataschema-text" 8766 ] 8767 }, 8768 "datasource-xmlschema": { 8769 "requires": [ 8770 "datasource-local", 8771 "plugin", 8772 "datatype-xml", 8773 "dataschema-xml" 8774 ] 8775 }, 8776 "datatable": { 8777 "use": [ 8778 "datatable-core", 8779 "datatable-table", 8780 "datatable-head", 8781 "datatable-body", 8782 "datatable-base", 8783 "datatable-column-widths", 8784 "datatable-message", 8785 "datatable-mutable", 8786 "datatable-sort", 8787 "datatable-datasource" 8788 ] 8789 }, 8790 "datatable-base": { 8791 "requires": [ 8792 "datatable-core", 8793 "datatable-table", 8794 "datatable-head", 8795 "datatable-body", 8796 "base-build", 8797 "widget" 8798 ], 8799 "skinnable": true 8800 }, 8801 "datatable-body": { 8802 "requires": [ 8803 "datatable-core", 8804 "view", 8805 "classnamemanager" 8806 ] 8807 }, 8808 "datatable-column-widths": { 8809 "requires": [ 8810 "datatable-base" 8811 ] 8812 }, 8813 "datatable-core": { 8814 "requires": [ 8815 "escape", 8816 "model-list", 8817 "node-event-delegate" 8818 ] 8819 }, 8820 "datatable-datasource": { 8821 "requires": [ 8822 "datatable-base", 8823 "plugin", 8824 "datasource-local" 8825 ] 8826 }, 8827 "datatable-foot": { 8828 "requires": [ 8829 "datatable-core", 8830 "view" 8831 ] 8832 }, 8833 "datatable-formatters": { 8834 "requires": [ 8835 "datatable-body", 8836 "datatype-number-format", 8837 "datatype-date-format", 8838 "escape" 8839 ] 8840 }, 8841 "datatable-head": { 8842 "requires": [ 8843 "datatable-core", 8844 "view", 8845 "classnamemanager" 8846 ] 8847 }, 8848 "datatable-highlight": { 8849 "requires": [ 8850 "datatable-base", 8851 "event-hover" 8852 ], 8853 "skinnable": true 8854 }, 8855 "datatable-keynav": { 8856 "requires": [ 8857 "datatable-base" 8858 ] 8859 }, 8860 "datatable-message": { 8861 "lang": [ 8862 "en", 8863 "fr", 8864 "es", 8865 "hu", 8866 "it" 8867 ], 8868 "requires": [ 8869 "datatable-base" 8870 ], 8871 "skinnable": true 8872 }, 8873 "datatable-mutable": { 8874 "requires": [ 8875 "datatable-base" 8876 ] 8877 }, 8878 "datatable-paginator": { 8879 "lang": [ 8880 "en", 8881 "fr" 8882 ], 8883 "requires": [ 8884 "model", 8885 "view", 8886 "paginator-core", 8887 "datatable-foot", 8888 "datatable-paginator-templates" 8889 ], 8890 "skinnable": true 8891 }, 8892 "datatable-paginator-templates": { 8893 "requires": [ 8894 "template" 8895 ] 8896 }, 8897 "datatable-scroll": { 8898 "requires": [ 8899 "datatable-base", 8900 "datatable-column-widths", 8901 "dom-screen" 8902 ], 8903 "skinnable": true 8904 }, 8905 "datatable-sort": { 8906 "lang": [ 8907 "en", 8908 "fr", 8909 "es", 8910 "hu" 8911 ], 8912 "requires": [ 8913 "datatable-base" 8914 ], 8915 "skinnable": true 8916 }, 8917 "datatable-table": { 8918 "requires": [ 8919 "datatable-core", 8920 "datatable-head", 8921 "datatable-body", 8922 "view", 8923 "classnamemanager" 8924 ] 8925 }, 8926 "datatype": { 8927 "use": [ 8928 "datatype-date", 8929 "datatype-number", 8930 "datatype-xml" 8931 ] 8932 }, 8933 "datatype-date": { 8934 "use": [ 8935 "datatype-date-parse", 8936 "datatype-date-format", 8937 "datatype-date-math" 8938 ] 8939 }, 8940 "datatype-date-format": { 8941 "lang": [ 8942 "ar", 8943 "ar-JO", 8944 "ca", 8945 "ca-ES", 8946 "da", 8947 "da-DK", 8948 "de", 8949 "de-AT", 8950 "de-DE", 8951 "el", 8952 "el-GR", 8953 "en", 8954 "en-AU", 8955 "en-CA", 8956 "en-GB", 8957 "en-IE", 8958 "en-IN", 8959 "en-JO", 8960 "en-MY", 8961 "en-NZ", 8962 "en-PH", 8963 "en-SG", 8964 "en-US", 8965 "es", 8966 "es-AR", 8967 "es-BO", 8968 "es-CL", 8969 "es-CO", 8970 "es-EC", 8971 "es-ES", 8972 "es-MX", 8973 "es-PE", 8974 "es-PY", 8975 "es-US", 8976 "es-UY", 8977 "es-VE", 8978 "fi", 8979 "fi-FI", 8980 "fr", 8981 "fr-BE", 8982 "fr-CA", 8983 "fr-FR", 8984 "hi", 8985 "hi-IN", 8986 "hu", 8987 "id", 8988 "id-ID", 8989 "it", 8990 "it-IT", 8991 "ja", 8992 "ja-JP", 8993 "ko", 8994 "ko-KR", 8995 "ms", 8996 "ms-MY", 8997 "nb", 8998 "nb-NO", 8999 "nl", 9000 "nl-BE", 9001 "nl-NL", 9002 "pl", 9003 "pl-PL", 9004 "pt", 9005 "pt-BR", 9006 "ro", 9007 "ro-RO", 9008 "ru", 9009 "ru-RU", 9010 "sv", 9011 "sv-SE", 9012 "th", 9013 "th-TH", 9014 "tr", 9015 "tr-TR", 9016 "vi", 9017 "vi-VN", 9018 "zh-Hans", 9019 "zh-Hans-CN", 9020 "zh-Hant", 9021 "zh-Hant-HK", 9022 "zh-Hant-TW" 9023 ] 9024 }, 9025 "datatype-date-math": { 9026 "requires": [ 9027 "yui-base" 9028 ] 9029 }, 9030 "datatype-date-parse": {}, 9031 "datatype-number": { 9032 "use": [ 9033 "datatype-number-parse", 9034 "datatype-number-format" 9035 ] 9036 }, 9037 "datatype-number-format": {}, 9038 "datatype-number-parse": { 9039 "requires": [ 9040 "escape" 9041 ] 9042 }, 9043 "datatype-xml": { 9044 "use": [ 9045 "datatype-xml-parse", 9046 "datatype-xml-format" 9047 ] 9048 }, 9049 "datatype-xml-format": {}, 9050 "datatype-xml-parse": {}, 9051 "dd": { 9052 "use": [ 9053 "dd-ddm-base", 9054 "dd-ddm", 9055 "dd-ddm-drop", 9056 "dd-drag", 9057 "dd-proxy", 9058 "dd-constrain", 9059 "dd-drop", 9060 "dd-scroll", 9061 "dd-delegate" 9062 ] 9063 }, 9064 "dd-constrain": { 9065 "requires": [ 9066 "dd-drag" 9067 ] 9068 }, 9069 "dd-ddm": { 9070 "requires": [ 9071 "dd-ddm-base", 9072 "event-resize" 9073 ] 9074 }, 9075 "dd-ddm-base": { 9076 "requires": [ 9077 "node", 9078 "base", 9079 "yui-throttle", 9080 "classnamemanager" 9081 ] 9082 }, 9083 "dd-ddm-drop": { 9084 "requires": [ 9085 "dd-ddm" 9086 ] 9087 }, 9088 "dd-delegate": { 9089 "requires": [ 9090 "dd-drag", 9091 "dd-drop-plugin", 9092 "event-mouseenter" 9093 ] 9094 }, 9095 "dd-drag": { 9096 "requires": [ 9097 "dd-ddm-base" 9098 ] 9099 }, 9100 "dd-drop": { 9101 "requires": [ 9102 "dd-drag", 9103 "dd-ddm-drop" 9104 ] 9105 }, 9106 "dd-drop-plugin": { 9107 "requires": [ 9108 "dd-drop" 9109 ] 9110 }, 9111 "dd-gestures": { 9112 "condition": { 9113 "name": "dd-gestures", 9114 "trigger": "dd-drag", 9115 "ua": "touchEnabled" 9116 }, 9117 "requires": [ 9118 "dd-drag", 9119 "event-synthetic", 9120 "event-gestures" 9121 ] 9122 }, 9123 "dd-plugin": { 9124 "optional": [ 9125 "dd-constrain", 9126 "dd-proxy" 9127 ], 9128 "requires": [ 9129 "dd-drag" 9130 ] 9131 }, 9132 "dd-proxy": { 9133 "requires": [ 9134 "dd-drag" 9135 ] 9136 }, 9137 "dd-scroll": { 9138 "requires": [ 9139 "dd-drag" 9140 ] 9141 }, 9142 "dial": { 9143 "lang": [ 9144 "en", 9145 "es", 9146 "hu" 9147 ], 9148 "requires": [ 9149 "widget", 9150 "dd-drag", 9151 "event-mouseenter", 9152 "event-move", 9153 "event-key", 9154 "transition", 9155 "intl" 9156 ], 9157 "skinnable": true 9158 }, 9159 "dom": { 9160 "use": [ 9161 "dom-base", 9162 "dom-screen", 9163 "dom-style", 9164 "selector-native", 9165 "selector" 9166 ] 9167 }, 9168 "dom-base": { 9169 "requires": [ 9170 "dom-core" 9171 ] 9172 }, 9173 "dom-core": { 9174 "requires": [ 9175 "oop", 9176 "features" 9177 ] 9178 }, 9179 "dom-screen": { 9180 "requires": [ 9181 "dom-base", 9182 "dom-style" 9183 ] 9184 }, 9185 "dom-style": { 9186 "requires": [ 9187 "dom-base" 9188 ] 9189 }, 9190 "dom-style-ie": { 9191 "condition": { 9192 "name": "dom-style-ie", 9193 "test": function (Y) { 9194 9195 var testFeature = Y.Features.test, 9196 addFeature = Y.Features.add, 9197 WINDOW = Y.config.win, 9198 DOCUMENT = Y.config.doc, 9199 DOCUMENT_ELEMENT = 'documentElement', 9200 ret = false; 9201 9202 addFeature('style', 'computedStyle', { 9203 test: function() { 9204 return WINDOW && 'getComputedStyle' in WINDOW; 9205 } 9206 }); 9207 9208 addFeature('style', 'opacity', { 9209 test: function() { 9210 return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style; 9211 } 9212 }); 9213 9214 ret = (!testFeature('style', 'opacity') && 9215 !testFeature('style', 'computedStyle')); 9216 9217 return ret; 9218 }, 9219 "trigger": "dom-style" 9220 }, 9221 "requires": [ 9222 "dom-style", 9223 "color-base" 9224 ] 9225 }, 9226 "dump": { 9227 "requires": [ 9228 "yui-base" 9229 ] 9230 }, 9231 "editor": { 9232 "use": [ 9233 "frame", 9234 "editor-selection", 9235 "exec-command", 9236 "editor-base", 9237 "editor-para", 9238 "editor-br", 9239 "editor-bidi", 9240 "editor-tab", 9241 "createlink-base" 9242 ] 9243 }, 9244 "editor-base": { 9245 "requires": [ 9246 "base", 9247 "frame", 9248 "node", 9249 "exec-command", 9250 "editor-selection" 9251 ] 9252 }, 9253 "editor-bidi": { 9254 "requires": [ 9255 "editor-base" 9256 ] 9257 }, 9258 "editor-br": { 9259 "requires": [ 9260 "editor-base" 9261 ] 9262 }, 9263 "editor-inline": { 9264 "requires": [ 9265 "editor-base", 9266 "content-editable" 9267 ] 9268 }, 9269 "editor-lists": { 9270 "requires": [ 9271 "editor-base" 9272 ] 9273 }, 9274 "editor-para": { 9275 "requires": [ 9276 "editor-para-base" 9277 ] 9278 }, 9279 "editor-para-base": { 9280 "requires": [ 9281 "editor-base" 9282 ] 9283 }, 9284 "editor-para-ie": { 9285 "condition": { 9286 "name": "editor-para-ie", 9287 "trigger": "editor-para", 9288 "ua": "ie", 9289 "when": "instead" 9290 }, 9291 "requires": [ 9292 "editor-para-base" 9293 ] 9294 }, 9295 "editor-selection": { 9296 "requires": [ 9297 "node" 9298 ] 9299 }, 9300 "editor-tab": { 9301 "requires": [ 9302 "editor-base" 9303 ] 9304 }, 9305 "escape": { 9306 "requires": [ 9307 "yui-base" 9308 ] 9309 }, 9310 "event": { 9311 "after": [ 9312 "node-base" 9313 ], 9314 "use": [ 9315 "event-base", 9316 "event-delegate", 9317 "event-synthetic", 9318 "event-mousewheel", 9319 "event-mouseenter", 9320 "event-key", 9321 "event-focus", 9322 "event-resize", 9323 "event-hover", 9324 "event-outside", 9325 "event-touch", 9326 "event-move", 9327 "event-flick", 9328 "event-valuechange", 9329 "event-tap" 9330 ] 9331 }, 9332 "event-base": { 9333 "after": [ 9334 "node-base" 9335 ], 9336 "requires": [ 9337 "event-custom-base" 9338 ] 9339 }, 9340 "event-base-ie": { 9341 "after": [ 9342 "event-base" 9343 ], 9344 "condition": { 9345 "name": "event-base-ie", 9346 "test": function(Y) { 9347 var imp = Y.config.doc && Y.config.doc.implementation; 9348 return (imp && (!imp.hasFeature('Events', '2.0'))); 9349 }, 9350 "trigger": "node-base" 9351 }, 9352 "requires": [ 9353 "node-base" 9354 ] 9355 }, 9356 "event-contextmenu": { 9357 "requires": [ 9358 "event-synthetic", 9359 "dom-screen" 9360 ] 9361 }, 9362 "event-custom": { 9363 "use": [ 9364 "event-custom-base", 9365 "event-custom-complex" 9366 ] 9367 }, 9368 "event-custom-base": { 9369 "requires": [ 9370 "oop" 9371 ] 9372 }, 9373 "event-custom-complex": { 9374 "requires": [ 9375 "event-custom-base" 9376 ] 9377 }, 9378 "event-delegate": { 9379 "requires": [ 9380 "node-base" 9381 ] 9382 }, 9383 "event-flick": { 9384 "requires": [ 9385 "node-base", 9386 "event-touch", 9387 "event-synthetic" 9388 ] 9389 }, 9390 "event-focus": { 9391 "requires": [ 9392 "event-synthetic" 9393 ] 9394 }, 9395 "event-gestures": { 9396 "use": [ 9397 "event-flick", 9398 "event-move" 9399 ] 9400 }, 9401 "event-hover": { 9402 "requires": [ 9403 "event-mouseenter" 9404 ] 9405 }, 9406 "event-key": { 9407 "requires": [ 9408 "event-synthetic" 9409 ] 9410 }, 9411 "event-mouseenter": { 9412 "requires": [ 9413 "event-synthetic" 9414 ] 9415 }, 9416 "event-mousewheel": { 9417 "requires": [ 9418 "node-base" 9419 ] 9420 }, 9421 "event-move": { 9422 "requires": [ 9423 "node-base", 9424 "event-touch", 9425 "event-synthetic" 9426 ] 9427 }, 9428 "event-outside": { 9429 "requires": [ 9430 "event-synthetic" 9431 ] 9432 }, 9433 "event-resize": { 9434 "requires": [ 9435 "node-base", 9436 "event-synthetic" 9437 ] 9438 }, 9439 "event-simulate": { 9440 "requires": [ 9441 "event-base" 9442 ] 9443 }, 9444 "event-synthetic": { 9445 "requires": [ 9446 "node-base", 9447 "event-custom-complex" 9448 ] 9449 }, 9450 "event-tap": { 9451 "requires": [ 9452 "node-base", 9453 "event-base", 9454 "event-touch", 9455 "event-synthetic" 9456 ] 9457 }, 9458 "event-touch": { 9459 "requires": [ 9460 "node-base" 9461 ] 9462 }, 9463 "event-valuechange": { 9464 "requires": [ 9465 "event-focus", 9466 "event-synthetic" 9467 ] 9468 }, 9469 "exec-command": { 9470 "requires": [ 9471 "frame" 9472 ] 9473 }, 9474 "features": { 9475 "requires": [ 9476 "yui-base" 9477 ] 9478 }, 9479 "file": { 9480 "requires": [ 9481 "file-flash", 9482 "file-html5" 9483 ] 9484 }, 9485 "file-flash": { 9486 "requires": [ 9487 "base" 9488 ] 9489 }, 9490 "file-html5": { 9491 "requires": [ 9492 "base" 9493 ] 9494 }, 9495 "frame": { 9496 "requires": [ 9497 "base", 9498 "node", 9499 "plugin", 9500 "selector-css3", 9501 "yui-throttle" 9502 ] 9503 }, 9504 "gesture-simulate": { 9505 "requires": [ 9506 "async-queue", 9507 "event-simulate", 9508 "node-screen" 9509 ] 9510 }, 9511 "get": { 9512 "requires": [ 9513 "yui-base" 9514 ] 9515 }, 9516 "graphics": { 9517 "requires": [ 9518 "node", 9519 "event-custom", 9520 "pluginhost", 9521 "matrix", 9522 "classnamemanager" 9523 ] 9524 }, 9525 "graphics-canvas": { 9526 "condition": { 9527 "name": "graphics-canvas", 9528 "test": function(Y) { 9529 var DOCUMENT = Y.config.doc, 9530 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", 9531 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 9532 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 9533 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); 9534 }, 9535 "trigger": "graphics" 9536 }, 9537 "requires": [ 9538 "graphics", 9539 "color-base" 9540 ] 9541 }, 9542 "graphics-canvas-default": { 9543 "condition": { 9544 "name": "graphics-canvas-default", 9545 "test": function(Y) { 9546 var DOCUMENT = Y.config.doc, 9547 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", 9548 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 9549 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 9550 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); 9551 }, 9552 "trigger": "graphics" 9553 } 9554 }, 9555 "graphics-group": { 9556 "requires": [ 9557 "graphics" 9558 ] 9559 }, 9560 "graphics-svg": { 9561 "condition": { 9562 "name": "graphics-svg", 9563 "test": function(Y) { 9564 var DOCUMENT = Y.config.doc, 9565 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", 9566 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 9567 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 9568 9569 return svg && (useSVG || !canvas); 9570 }, 9571 "trigger": "graphics" 9572 }, 9573 "requires": [ 9574 "graphics" 9575 ] 9576 }, 9577 "graphics-svg-default": { 9578 "condition": { 9579 "name": "graphics-svg-default", 9580 "test": function(Y) { 9581 var DOCUMENT = Y.config.doc, 9582 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", 9583 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 9584 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 9585 9586 return svg && (useSVG || !canvas); 9587 }, 9588 "trigger": "graphics" 9589 } 9590 }, 9591 "graphics-vml": { 9592 "condition": { 9593 "name": "graphics-vml", 9594 "test": function(Y) { 9595 var DOCUMENT = Y.config.doc, 9596 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); 9597 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); 9598 }, 9599 "trigger": "graphics" 9600 }, 9601 "requires": [ 9602 "graphics", 9603 "color-base" 9604 ] 9605 }, 9606 "graphics-vml-default": { 9607 "condition": { 9608 "name": "graphics-vml-default", 9609 "test": function(Y) { 9610 var DOCUMENT = Y.config.doc, 9611 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); 9612 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); 9613 }, 9614 "trigger": "graphics" 9615 } 9616 }, 9617 "handlebars": { 9618 "use": [ 9619 "handlebars-compiler" 9620 ] 9621 }, 9622 "handlebars-base": { 9623 "requires": [] 9624 }, 9625 "handlebars-compiler": { 9626 "requires": [ 9627 "handlebars-base" 9628 ] 9629 }, 9630 "highlight": { 9631 "use": [ 9632 "highlight-base", 9633 "highlight-accentfold" 9634 ] 9635 }, 9636 "highlight-accentfold": { 9637 "requires": [ 9638 "highlight-base", 9639 "text-accentfold" 9640 ] 9641 }, 9642 "highlight-base": { 9643 "requires": [ 9644 "array-extras", 9645 "classnamemanager", 9646 "escape", 9647 "text-wordbreak" 9648 ] 9649 }, 9650 "history": { 9651 "use": [ 9652 "history-base", 9653 "history-hash", 9654 "history-html5" 9655 ] 9656 }, 9657 "history-base": { 9658 "requires": [ 9659 "event-custom-complex" 9660 ] 9661 }, 9662 "history-hash": { 9663 "after": [ 9664 "history-html5" 9665 ], 9666 "requires": [ 9667 "event-synthetic", 9668 "history-base", 9669 "yui-later" 9670 ] 9671 }, 9672 "history-hash-ie": { 9673 "condition": { 9674 "name": "history-hash-ie", 9675 "test": function (Y) { 9676 var docMode = Y.config.doc && Y.config.doc.documentMode; 9677 9678 return Y.UA.ie && (!('onhashchange' in Y.config.win) || 9679 !docMode || docMode < 8); 9680 }, 9681 "trigger": "history-hash" 9682 }, 9683 "requires": [ 9684 "history-hash", 9685 "node-base" 9686 ] 9687 }, 9688 "history-html5": { 9689 "optional": [ 9690 "json" 9691 ], 9692 "requires": [ 9693 "event-base", 9694 "history-base", 9695 "node-base" 9696 ] 9697 }, 9698 "imageloader": { 9699 "requires": [ 9700 "base-base", 9701 "node-style", 9702 "node-screen" 9703 ] 9704 }, 9705 "intl": { 9706 "requires": [ 9707 "intl-base", 9708 "event-custom" 9709 ] 9710 }, 9711 "intl-base": { 9712 "requires": [ 9713 "yui-base" 9714 ] 9715 }, 9716 "io": { 9717 "use": [ 9718 "io-base", 9719 "io-xdr", 9720 "io-form", 9721 "io-upload-iframe", 9722 "io-queue" 9723 ] 9724 }, 9725 "io-base": { 9726 "requires": [ 9727 "event-custom-base", 9728 "querystring-stringify-simple" 9729 ] 9730 }, 9731 "io-form": { 9732 "requires": [ 9733 "io-base", 9734 "node-base" 9735 ] 9736 }, 9737 "io-nodejs": { 9738 "condition": { 9739 "name": "io-nodejs", 9740 "trigger": "io-base", 9741 "ua": "nodejs" 9742 }, 9743 "requires": [ 9744 "io-base" 9745 ] 9746 }, 9747 "io-queue": { 9748 "requires": [ 9749 "io-base", 9750 "queue-promote" 9751 ] 9752 }, 9753 "io-upload-iframe": { 9754 "requires": [ 9755 "io-base", 9756 "node-base" 9757 ] 9758 }, 9759 "io-xdr": { 9760 "requires": [ 9761 "io-base", 9762 "datatype-xml-parse" 9763 ] 9764 }, 9765 "json": { 9766 "use": [ 9767 "json-parse", 9768 "json-stringify" 9769 ] 9770 }, 9771 "json-parse": { 9772 "requires": [ 9773 "yui-base" 9774 ] 9775 }, 9776 "json-parse-shim": { 9777 "condition": { 9778 "name": "json-parse-shim", 9779 "test": function (Y) { 9780 var _JSON = Y.config.global.JSON, 9781 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, 9782 nativeSupport = Y.config.useNativeJSONParse !== false && !!Native; 9783 9784 function workingNative( k, v ) { 9785 return k === "ok" ? true : v; 9786 } 9787 9788 // Double check basic functionality. This is mainly to catch early broken 9789 // implementations of the JSON API in Firefox 3.1 beta1 and beta2 9790 if ( nativeSupport ) { 9791 try { 9792 nativeSupport = ( Native.parse( '{"ok":false}', workingNative ) ).ok; 9793 } 9794 catch ( e ) { 9795 nativeSupport = false; 9796 } 9797 } 9798 9799 return !nativeSupport; 9800 }, 9801 "trigger": "json-parse" 9802 }, 9803 "requires": [ 9804 "json-parse" 9805 ] 9806 }, 9807 "json-stringify": { 9808 "requires": [ 9809 "yui-base" 9810 ] 9811 }, 9812 "json-stringify-shim": { 9813 "condition": { 9814 "name": "json-stringify-shim", 9815 "test": function (Y) { 9816 var _JSON = Y.config.global.JSON, 9817 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, 9818 nativeSupport = Y.config.useNativeJSONStringify !== false && !!Native; 9819 9820 // Double check basic native functionality. This is primarily to catch broken 9821 // early JSON API implementations in Firefox 3.1 beta1 and beta2. 9822 if ( nativeSupport ) { 9823 try { 9824 nativeSupport = ( '0' === Native.stringify(0) ); 9825 } catch ( e ) { 9826 nativeSupport = false; 9827 } 9828 } 9829 9830 9831 return !nativeSupport; 9832 }, 9833 "trigger": "json-stringify" 9834 }, 9835 "requires": [ 9836 "json-stringify" 9837 ] 9838 }, 9839 "jsonp": { 9840 "requires": [ 9841 "get", 9842 "oop" 9843 ] 9844 }, 9845 "jsonp-url": { 9846 "requires": [ 9847 "jsonp" 9848 ] 9849 }, 9850 "lazy-model-list": { 9851 "requires": [ 9852 "model-list" 9853 ] 9854 }, 9855 "loader": { 9856 "use": [ 9857 "loader-base", 9858 "loader-rollup", 9859 "loader-yui3" 9860 ] 9861 }, 9862 "loader-base": { 9863 "requires": [ 9864 "get", 9865 "features" 9866 ] 9867 }, 9868 "loader-rollup": { 9869 "requires": [ 9870 "loader-base" 9871 ] 9872 }, 9873 "loader-yui3": { 9874 "requires": [ 9875 "loader-base" 9876 ] 9877 }, 9878 "matrix": { 9879 "requires": [ 9880 "yui-base" 9881 ] 9882 }, 9883 "model": { 9884 "requires": [ 9885 "base-build", 9886 "escape", 9887 "json-parse" 9888 ] 9889 }, 9890 "model-list": { 9891 "requires": [ 9892 "array-extras", 9893 "array-invoke", 9894 "arraylist", 9895 "base-build", 9896 "escape", 9897 "json-parse", 9898 "model" 9899 ] 9900 }, 9901 "model-sync-local": { 9902 "requires": [ 9903 "model", 9904 "json-stringify" 9905 ] 9906 }, 9907 "model-sync-rest": { 9908 "requires": [ 9909 "model", 9910 "io-base", 9911 "json-stringify" 9912 ] 9913 }, 9914 "node": { 9915 "use": [ 9916 "node-base", 9917 "node-event-delegate", 9918 "node-pluginhost", 9919 "node-screen", 9920 "node-style" 9921 ] 9922 }, 9923 "node-base": { 9924 "requires": [ 9925 "event-base", 9926 "node-core", 9927 "dom-base", 9928 "dom-style" 9929 ] 9930 }, 9931 "node-core": { 9932 "requires": [ 9933 "dom-core", 9934 "selector" 9935 ] 9936 }, 9937 "node-event-delegate": { 9938 "requires": [ 9939 "node-base", 9940 "event-delegate" 9941 ] 9942 }, 9943 "node-event-html5": { 9944 "requires": [ 9945 "node-base" 9946 ] 9947 }, 9948 "node-event-simulate": { 9949 "requires": [ 9950 "node-base", 9951 "event-simulate", 9952 "gesture-simulate" 9953 ] 9954 }, 9955 "node-flick": { 9956 "requires": [ 9957 "classnamemanager", 9958 "transition", 9959 "event-flick", 9960 "plugin" 9961 ], 9962 "skinnable": true 9963 }, 9964 "node-focusmanager": { 9965 "requires": [ 9966 "attribute", 9967 "node", 9968 "plugin", 9969 "node-event-simulate", 9970 "event-key", 9971 "event-focus" 9972 ] 9973 }, 9974 "node-load": { 9975 "requires": [ 9976 "node-base", 9977 "io-base" 9978 ] 9979 }, 9980 "node-menunav": { 9981 "requires": [ 9982 "node", 9983 "classnamemanager", 9984 "plugin", 9985 "node-focusmanager" 9986 ], 9987 "skinnable": true 9988 }, 9989 "node-pluginhost": { 9990 "requires": [ 9991 "node-base", 9992 "pluginhost" 9993 ] 9994 }, 9995 "node-screen": { 9996 "requires": [ 9997 "dom-screen", 9998 "node-base" 9999 ] 10000 }, 10001 "node-scroll-info": { 10002 "requires": [ 10003 "array-extras", 10004 "base-build", 10005 "event-resize", 10006 "node-pluginhost", 10007 "plugin", 10008 "selector" 10009 ] 10010 }, 10011 "node-style": { 10012 "requires": [ 10013 "dom-style", 10014 "node-base" 10015 ] 10016 }, 10017 "oop": { 10018 "requires": [ 10019 "yui-base" 10020 ] 10021 }, 10022 "overlay": { 10023 "requires": [ 10024 "widget", 10025 "widget-stdmod", 10026 "widget-position", 10027 "widget-position-align", 10028 "widget-stack", 10029 "widget-position-constrain" 10030 ], 10031 "skinnable": true 10032 }, 10033 "paginator": { 10034 "requires": [ 10035 "paginator-core" 10036 ] 10037 }, 10038 "paginator-core": { 10039 "requires": [ 10040 "base" 10041 ] 10042 }, 10043 "paginator-url": { 10044 "requires": [ 10045 "paginator" 10046 ] 10047 }, 10048 "panel": { 10049 "requires": [ 10050 "widget", 10051 "widget-autohide", 10052 "widget-buttons", 10053 "widget-modality", 10054 "widget-position", 10055 "widget-position-align", 10056 "widget-position-constrain", 10057 "widget-stack", 10058 "widget-stdmod" 10059 ], 10060 "skinnable": true 10061 }, 10062 "parallel": { 10063 "requires": [ 10064 "yui-base" 10065 ] 10066 }, 10067 "pjax": { 10068 "requires": [ 10069 "pjax-base", 10070 "pjax-content" 10071 ] 10072 }, 10073 "pjax-base": { 10074 "requires": [ 10075 "classnamemanager", 10076 "node-event-delegate", 10077 "router" 10078 ] 10079 }, 10080 "pjax-content": { 10081 "requires": [ 10082 "io-base", 10083 "node-base", 10084 "router" 10085 ] 10086 }, 10087 "pjax-plugin": { 10088 "requires": [ 10089 "node-pluginhost", 10090 "pjax", 10091 "plugin" 10092 ] 10093 }, 10094 "plugin": { 10095 "requires": [ 10096 "base-base" 10097 ] 10098 }, 10099 "pluginhost": { 10100 "use": [ 10101 "pluginhost-base", 10102 "pluginhost-config" 10103 ] 10104 }, 10105 "pluginhost-base": { 10106 "requires": [ 10107 "yui-base" 10108 ] 10109 }, 10110 "pluginhost-config": { 10111 "requires": [ 10112 "pluginhost-base" 10113 ] 10114 }, 10115 "promise": { 10116 "requires": [ 10117 "timers" 10118 ] 10119 }, 10120 "querystring": { 10121 "use": [ 10122 "querystring-parse", 10123 "querystring-stringify" 10124 ] 10125 }, 10126 "querystring-parse": { 10127 "requires": [ 10128 "yui-base", 10129 "array-extras" 10130 ] 10131 }, 10132 "querystring-parse-simple": { 10133 "requires": [ 10134 "yui-base" 10135 ] 10136 }, 10137 "querystring-stringify": { 10138 "requires": [ 10139 "yui-base" 10140 ] 10141 }, 10142 "querystring-stringify-simple": { 10143 "requires": [ 10144 "yui-base" 10145 ] 10146 }, 10147 "queue-promote": { 10148 "requires": [ 10149 "yui-base" 10150 ] 10151 }, 10152 "range-slider": { 10153 "requires": [ 10154 "slider-base", 10155 "slider-value-range", 10156 "clickable-rail" 10157 ] 10158 }, 10159 "recordset": { 10160 "use": [ 10161 "recordset-base", 10162 "recordset-sort", 10163 "recordset-filter", 10164 "recordset-indexer" 10165 ] 10166 }, 10167 "recordset-base": { 10168 "requires": [ 10169 "base", 10170 "arraylist" 10171 ] 10172 }, 10173 "recordset-filter": { 10174 "requires": [ 10175 "recordset-base", 10176 "array-extras", 10177 "plugin" 10178 ] 10179 }, 10180 "recordset-indexer": { 10181 "requires": [ 10182 "recordset-base", 10183 "plugin" 10184 ] 10185 }, 10186 "recordset-sort": { 10187 "requires": [ 10188 "arraysort", 10189 "recordset-base", 10190 "plugin" 10191 ] 10192 }, 10193 "resize": { 10194 "use": [ 10195 "resize-base", 10196 "resize-proxy", 10197 "resize-constrain" 10198 ] 10199 }, 10200 "resize-base": { 10201 "requires": [ 10202 "base", 10203 "widget", 10204 "event", 10205 "oop", 10206 "dd-drag", 10207 "dd-delegate", 10208 "dd-drop" 10209 ], 10210 "skinnable": true 10211 }, 10212 "resize-constrain": { 10213 "requires": [ 10214 "plugin", 10215 "resize-base" 10216 ] 10217 }, 10218 "resize-plugin": { 10219 "optional": [ 10220 "resize-constrain" 10221 ], 10222 "requires": [ 10223 "resize-base", 10224 "plugin" 10225 ] 10226 }, 10227 "resize-proxy": { 10228 "requires": [ 10229 "plugin", 10230 "resize-base" 10231 ] 10232 }, 10233 "router": { 10234 "optional": [ 10235 "querystring-parse" 10236 ], 10237 "requires": [ 10238 "array-extras", 10239 "base-build", 10240 "history" 10241 ] 10242 }, 10243 "scrollview": { 10244 "requires": [ 10245 "scrollview-base", 10246 "scrollview-scrollbars" 10247 ] 10248 }, 10249 "scrollview-base": { 10250 "requires": [ 10251 "widget", 10252 "event-gestures", 10253 "event-mousewheel", 10254 "transition" 10255 ], 10256 "skinnable": true 10257 }, 10258 "scrollview-base-ie": { 10259 "condition": { 10260 "name": "scrollview-base-ie", 10261 "trigger": "scrollview-base", 10262 "ua": "ie" 10263 }, 10264 "requires": [ 10265 "scrollview-base" 10266 ] 10267 }, 10268 "scrollview-list": { 10269 "requires": [ 10270 "plugin", 10271 "classnamemanager" 10272 ], 10273 "skinnable": true 10274 }, 10275 "scrollview-paginator": { 10276 "requires": [ 10277 "plugin", 10278 "classnamemanager" 10279 ] 10280 }, 10281 "scrollview-scrollbars": { 10282 "requires": [ 10283 "classnamemanager", 10284 "transition", 10285 "plugin" 10286 ], 10287 "skinnable": true 10288 }, 10289 "selector": { 10290 "requires": [ 10291 "selector-native" 10292 ] 10293 }, 10294 "selector-css2": { 10295 "condition": { 10296 "name": "selector-css2", 10297 "test": function (Y) { 10298 var DOCUMENT = Y.config.doc, 10299 ret = DOCUMENT && !('querySelectorAll' in DOCUMENT); 10300 10301 return ret; 10302 }, 10303 "trigger": "selector" 10304 }, 10305 "requires": [ 10306 "selector-native" 10307 ] 10308 }, 10309 "selector-css3": { 10310 "requires": [ 10311 "selector-native", 10312 "selector-css2" 10313 ] 10314 }, 10315 "selector-native": { 10316 "requires": [ 10317 "dom-base" 10318 ] 10319 }, 10320 "series-area": { 10321 "requires": [ 10322 "series-cartesian", 10323 "series-fill-util" 10324 ] 10325 }, 10326 "series-area-stacked": { 10327 "requires": [ 10328 "series-stacked", 10329 "series-area" 10330 ] 10331 }, 10332 "series-areaspline": { 10333 "requires": [ 10334 "series-area", 10335 "series-curve-util" 10336 ] 10337 }, 10338 "series-areaspline-stacked": { 10339 "requires": [ 10340 "series-stacked", 10341 "series-areaspline" 10342 ] 10343 }, 10344 "series-bar": { 10345 "requires": [ 10346 "series-marker", 10347 "series-histogram-base" 10348 ] 10349 }, 10350 "series-bar-stacked": { 10351 "requires": [ 10352 "series-stacked", 10353 "series-bar" 10354 ] 10355 }, 10356 "series-base": { 10357 "requires": [ 10358 "graphics", 10359 "axis-base" 10360 ] 10361 }, 10362 "series-candlestick": { 10363 "requires": [ 10364 "series-range" 10365 ] 10366 }, 10367 "series-cartesian": { 10368 "requires": [ 10369 "series-base" 10370 ] 10371 }, 10372 "series-column": { 10373 "requires": [ 10374 "series-marker", 10375 "series-histogram-base" 10376 ] 10377 }, 10378 "series-column-stacked": { 10379 "requires": [ 10380 "series-stacked", 10381 "series-column" 10382 ] 10383 }, 10384 "series-combo": { 10385 "requires": [ 10386 "series-cartesian", 10387 "series-line-util", 10388 "series-plot-util", 10389 "series-fill-util" 10390 ] 10391 }, 10392 "series-combo-stacked": { 10393 "requires": [ 10394 "series-stacked", 10395 "series-combo" 10396 ] 10397 }, 10398 "series-combospline": { 10399 "requires": [ 10400 "series-combo", 10401 "series-curve-util" 10402 ] 10403 }, 10404 "series-combospline-stacked": { 10405 "requires": [ 10406 "series-combo-stacked", 10407 "series-curve-util" 10408 ] 10409 }, 10410 "series-curve-util": {}, 10411 "series-fill-util": {}, 10412 "series-histogram-base": { 10413 "requires": [ 10414 "series-cartesian", 10415 "series-plot-util" 10416 ] 10417 }, 10418 "series-line": { 10419 "requires": [ 10420 "series-cartesian", 10421 "series-line-util" 10422 ] 10423 }, 10424 "series-line-stacked": { 10425 "requires": [ 10426 "series-stacked", 10427 "series-line" 10428 ] 10429 }, 10430 "series-line-util": {}, 10431 "series-marker": { 10432 "requires": [ 10433 "series-cartesian", 10434 "series-plot-util" 10435 ] 10436 }, 10437 "series-marker-stacked": { 10438 "requires": [ 10439 "series-stacked", 10440 "series-marker" 10441 ] 10442 }, 10443 "series-ohlc": { 10444 "requires": [ 10445 "series-range" 10446 ] 10447 }, 10448 "series-pie": { 10449 "requires": [ 10450 "series-base", 10451 "series-plot-util" 10452 ] 10453 }, 10454 "series-plot-util": {}, 10455 "series-range": { 10456 "requires": [ 10457 "series-cartesian" 10458 ] 10459 }, 10460 "series-spline": { 10461 "requires": [ 10462 "series-line", 10463 "series-curve-util" 10464 ] 10465 }, 10466 "series-spline-stacked": { 10467 "requires": [ 10468 "series-stacked", 10469 "series-spline" 10470 ] 10471 }, 10472 "series-stacked": { 10473 "requires": [ 10474 "axis-stacked" 10475 ] 10476 }, 10477 "shim-plugin": { 10478 "requires": [ 10479 "node-style", 10480 "node-pluginhost" 10481 ] 10482 }, 10483 "slider": { 10484 "use": [ 10485 "slider-base", 10486 "slider-value-range", 10487 "clickable-rail", 10488 "range-slider" 10489 ] 10490 }, 10491 "slider-base": { 10492 "requires": [ 10493 "widget", 10494 "dd-constrain", 10495 "event-key" 10496 ], 10497 "skinnable": true 10498 }, 10499 "slider-value-range": { 10500 "requires": [ 10501 "slider-base" 10502 ] 10503 }, 10504 "sortable": { 10505 "requires": [ 10506 "dd-delegate", 10507 "dd-drop-plugin", 10508 "dd-proxy" 10509 ] 10510 }, 10511 "sortable-scroll": { 10512 "requires": [ 10513 "dd-scroll", 10514 "sortable" 10515 ] 10516 }, 10517 "stylesheet": { 10518 "requires": [ 10519 "yui-base" 10520 ] 10521 }, 10522 "substitute": { 10523 "optional": [ 10524 "dump" 10525 ], 10526 "requires": [ 10527 "yui-base" 10528 ] 10529 }, 10530 "swf": { 10531 "requires": [ 10532 "event-custom", 10533 "node", 10534 "swfdetect", 10535 "escape" 10536 ] 10537 }, 10538 "swfdetect": { 10539 "requires": [ 10540 "yui-base" 10541 ] 10542 }, 10543 "tabview": { 10544 "requires": [ 10545 "widget", 10546 "widget-parent", 10547 "widget-child", 10548 "tabview-base", 10549 "node-pluginhost", 10550 "node-focusmanager" 10551 ], 10552 "skinnable": true 10553 }, 10554 "tabview-base": { 10555 "requires": [ 10556 "node-event-delegate", 10557 "classnamemanager" 10558 ] 10559 }, 10560 "tabview-plugin": { 10561 "requires": [ 10562 "tabview-base" 10563 ] 10564 }, 10565 "template": { 10566 "use": [ 10567 "template-base", 10568 "template-micro" 10569 ] 10570 }, 10571 "template-base": { 10572 "requires": [ 10573 "yui-base" 10574 ] 10575 }, 10576 "template-micro": { 10577 "requires": [ 10578 "escape" 10579 ] 10580 }, 10581 "test": { 10582 "requires": [ 10583 "event-simulate", 10584 "event-custom", 10585 "json-stringify" 10586 ] 10587 }, 10588 "test-console": { 10589 "requires": [ 10590 "console-filters", 10591 "test", 10592 "array-extras" 10593 ], 10594 "skinnable": true 10595 }, 10596 "text": { 10597 "use": [ 10598 "text-accentfold", 10599 "text-wordbreak" 10600 ] 10601 }, 10602 "text-accentfold": { 10603 "requires": [ 10604 "array-extras", 10605 "text-data-accentfold" 10606 ] 10607 }, 10608 "text-data-accentfold": { 10609 "requires": [ 10610 "yui-base" 10611 ] 10612 }, 10613 "text-data-wordbreak": { 10614 "requires": [ 10615 "yui-base" 10616 ] 10617 }, 10618 "text-wordbreak": { 10619 "requires": [ 10620 "array-extras", 10621 "text-data-wordbreak" 10622 ] 10623 }, 10624 "timers": { 10625 "requires": [ 10626 "yui-base" 10627 ] 10628 }, 10629 "transition": { 10630 "requires": [ 10631 "node-style" 10632 ] 10633 }, 10634 "transition-timer": { 10635 "condition": { 10636 "name": "transition-timer", 10637 "test": function (Y) { 10638 var DOCUMENT = Y.config.doc, 10639 node = (DOCUMENT) ? DOCUMENT.documentElement: null, 10640 ret = true; 10641 10642 if (node && node.style) { 10643 ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); 10644 } 10645 10646 return ret; 10647 }, 10648 "trigger": "transition" 10649 }, 10650 "requires": [ 10651 "transition" 10652 ] 10653 }, 10654 "tree": { 10655 "requires": [ 10656 "base-build", 10657 "tree-node" 10658 ] 10659 }, 10660 "tree-labelable": { 10661 "requires": [ 10662 "tree" 10663 ] 10664 }, 10665 "tree-lazy": { 10666 "requires": [ 10667 "base-pluginhost", 10668 "plugin", 10669 "tree" 10670 ] 10671 }, 10672 "tree-node": {}, 10673 "tree-openable": { 10674 "requires": [ 10675 "tree" 10676 ] 10677 }, 10678 "tree-selectable": { 10679 "requires": [ 10680 "tree" 10681 ] 10682 }, 10683 "tree-sortable": { 10684 "requires": [ 10685 "tree" 10686 ] 10687 }, 10688 "uploader": { 10689 "requires": [ 10690 "uploader-html5", 10691 "uploader-flash" 10692 ] 10693 }, 10694 "uploader-flash": { 10695 "requires": [ 10696 "swfdetect", 10697 "escape", 10698 "widget", 10699 "base", 10700 "cssbutton", 10701 "node", 10702 "event-custom", 10703 "uploader-queue" 10704 ] 10705 }, 10706 "uploader-html5": { 10707 "requires": [ 10708 "widget", 10709 "node-event-simulate", 10710 "file-html5", 10711 "uploader-queue" 10712 ] 10713 }, 10714 "uploader-queue": { 10715 "requires": [ 10716 "base" 10717 ] 10718 }, 10719 "view": { 10720 "requires": [ 10721 "base-build", 10722 "node-event-delegate" 10723 ] 10724 }, 10725 "view-node-map": { 10726 "requires": [ 10727 "view" 10728 ] 10729 }, 10730 "widget": { 10731 "use": [ 10732 "widget-base", 10733 "widget-htmlparser", 10734 "widget-skin", 10735 "widget-uievents" 10736 ] 10737 }, 10738 "widget-anim": { 10739 "requires": [ 10740 "anim-base", 10741 "plugin", 10742 "widget" 10743 ] 10744 }, 10745 "widget-autohide": { 10746 "requires": [ 10747 "base-build", 10748 "event-key", 10749 "event-outside", 10750 "widget" 10751 ] 10752 }, 10753 "widget-base": { 10754 "requires": [ 10755 "attribute", 10756 "base-base", 10757 "base-pluginhost", 10758 "classnamemanager", 10759 "event-focus", 10760 "node-base", 10761 "node-style" 10762 ], 10763 "skinnable": true 10764 }, 10765 "widget-base-ie": { 10766 "condition": { 10767 "name": "widget-base-ie", 10768 "trigger": "widget-base", 10769 "ua": "ie" 10770 }, 10771 "requires": [ 10772 "widget-base" 10773 ] 10774 }, 10775 "widget-buttons": { 10776 "requires": [ 10777 "button-plugin", 10778 "cssbutton", 10779 "widget-stdmod" 10780 ] 10781 }, 10782 "widget-child": { 10783 "requires": [ 10784 "base-build", 10785 "widget" 10786 ] 10787 }, 10788 "widget-htmlparser": { 10789 "requires": [ 10790 "widget-base" 10791 ] 10792 }, 10793 "widget-modality": { 10794 "requires": [ 10795 "base-build", 10796 "event-outside", 10797 "widget" 10798 ], 10799 "skinnable": true 10800 }, 10801 "widget-parent": { 10802 "requires": [ 10803 "arraylist", 10804 "base-build", 10805 "widget" 10806 ] 10807 }, 10808 "widget-position": { 10809 "requires": [ 10810 "base-build", 10811 "node-screen", 10812 "widget" 10813 ] 10814 }, 10815 "widget-position-align": { 10816 "requires": [ 10817 "widget-position" 10818 ] 10819 }, 10820 "widget-position-constrain": { 10821 "requires": [ 10822 "widget-position" 10823 ] 10824 }, 10825 "widget-skin": { 10826 "requires": [ 10827 "widget-base" 10828 ] 10829 }, 10830 "widget-stack": { 10831 "requires": [ 10832 "base-build", 10833 "widget" 10834 ], 10835 "skinnable": true 10836 }, 10837 "widget-stdmod": { 10838 "requires": [ 10839 "base-build", 10840 "widget" 10841 ] 10842 }, 10843 "widget-uievents": { 10844 "requires": [ 10845 "node-event-delegate", 10846 "widget-base" 10847 ] 10848 }, 10849 "yql": { 10850 "requires": [ 10851 "oop" 10852 ] 10853 }, 10854 "yql-jsonp": { 10855 "condition": { 10856 "name": "yql-jsonp", 10857 "test": function (Y) { 10858 /* Only load the JSONP module when not in nodejs or winjs 10859 TODO Make the winjs module a CORS module 10860 */ 10861 return (!Y.UA.nodejs && !Y.UA.winjs); 10862 }, 10863 "trigger": "yql" 10864 }, 10865 "requires": [ 10866 "yql", 10867 "jsonp", 10868 "jsonp-url" 10869 ] 10870 }, 10871 "yql-nodejs": { 10872 "condition": { 10873 "name": "yql-nodejs", 10874 "trigger": "yql", 10875 "ua": "nodejs" 10876 }, 10877 "requires": [ 10878 "yql" 10879 ] 10880 }, 10881 "yql-winjs": { 10882 "condition": { 10883 "name": "yql-winjs", 10884 "trigger": "yql", 10885 "ua": "winjs" 10886 }, 10887 "requires": [ 10888 "yql" 10889 ] 10890 }, 10891 "yui": {}, 10892 "yui-base": {}, 10893 "yui-later": { 10894 "requires": [ 10895 "yui-base" 10896 ] 10897 }, 10898 "yui-log": { 10899 "requires": [ 10900 "yui-base" 10901 ] 10902 }, 10903 "yui-throttle": { 10904 "requires": [ 10905 "yui-base" 10906 ] 10907 } 10908 }); 10909 YUI.Env[Y.version].md5 = '45357bb11eddf7fd0a89c0b756599df2'; 10910 10911 10912 }, '3.17.2', {"requires": ["loader-base"]}); 10913 YUI.add('yui', function (Y, NAME) {}, '3.17.2', { 10914 "use": [ 10915 "get", 10916 "features", 10917 "intl-base", 10918 "yui-log", 10919 "yui-log-nodejs", 10920 "yui-later", 10921 "loader-base", 10922 "loader-rollup", 10923 "loader-yui3" 10924 ] 10925 });
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |