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