|
1 /* |
|
2 YUI 3.10.3 (build 2fb5187) |
|
3 Copyright 2013 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.10.3', |
|
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 handleLoad = function() { |
|
206 YUI.Env.windowLoaded = true; |
|
207 YUI.Env.DOMReady = true; |
|
208 if (hasWin) { |
|
209 remove(window, 'load', handleLoad); |
|
210 } |
|
211 }, |
|
212 getLoader = function(Y, o) { |
|
213 var loader = Y.Env._loader, |
|
214 lCore = [ 'loader-base' ], |
|
215 G_ENV = YUI.Env, |
|
216 mods = G_ENV.mods; |
|
217 |
|
218 if (loader) { |
|
219 //loader._config(Y.config); |
|
220 loader.ignoreRegistered = false; |
|
221 loader.onEnd = null; |
|
222 loader.data = null; |
|
223 loader.required = []; |
|
224 loader.loadType = null; |
|
225 } else { |
|
226 loader = new Y.Loader(Y.config); |
|
227 Y.Env._loader = loader; |
|
228 } |
|
229 if (mods && mods.loader) { |
|
230 lCore = [].concat(lCore, YUI.Env.loaderExtras); |
|
231 } |
|
232 YUI.Env.core = Y.Array.dedupe([].concat(YUI.Env.core, lCore)); |
|
233 |
|
234 return loader; |
|
235 }, |
|
236 |
|
237 clobber = function(r, s) { |
|
238 for (var i in s) { |
|
239 if (s.hasOwnProperty(i)) { |
|
240 r[i] = s[i]; |
|
241 } |
|
242 } |
|
243 }, |
|
244 |
|
245 ALREADY_DONE = { success: true }; |
|
246 |
|
247 // Stamp the documentElement (HTML) with a class of "yui-loaded" to |
|
248 // enable styles that need to key off of JS being enabled. |
|
249 if (docEl && docClass.indexOf(DOC_LABEL) == -1) { |
|
250 if (docClass) { |
|
251 docClass += ' '; |
|
252 } |
|
253 docClass += DOC_LABEL; |
|
254 docEl.className = docClass; |
|
255 } |
|
256 |
|
257 if (VERSION.indexOf('@') > -1) { |
|
258 VERSION = '3.5.0'; // dev time hack for cdn test |
|
259 } |
|
260 |
|
261 proto = { |
|
262 /** |
|
263 Applies a new configuration object to the config of this YUI instance. This |
|
264 will merge new group/module definitions, and will also update the loader |
|
265 cache if necessary. Updating `Y.config` directly will not update the cache. |
|
266 |
|
267 @method applyConfig |
|
268 @param {Object} o the configuration object. |
|
269 @since 3.2.0 |
|
270 **/ |
|
271 applyConfig: function(o) { |
|
272 |
|
273 o = o || NOOP; |
|
274 |
|
275 var attr, |
|
276 name, |
|
277 // detail, |
|
278 config = this.config, |
|
279 mods = config.modules, |
|
280 groups = config.groups, |
|
281 aliases = config.aliases, |
|
282 loader = this.Env._loader; |
|
283 |
|
284 for (name in o) { |
|
285 if (o.hasOwnProperty(name)) { |
|
286 attr = o[name]; |
|
287 if (mods && name == 'modules') { |
|
288 clobber(mods, attr); |
|
289 } else if (aliases && name == 'aliases') { |
|
290 clobber(aliases, attr); |
|
291 } else if (groups && name == 'groups') { |
|
292 clobber(groups, attr); |
|
293 } else if (name == 'win') { |
|
294 config[name] = (attr && attr.contentWindow) || attr; |
|
295 config.doc = config[name] ? config[name].document : null; |
|
296 } else if (name == '_yuid') { |
|
297 // preserve the guid |
|
298 } else { |
|
299 config[name] = attr; |
|
300 } |
|
301 } |
|
302 } |
|
303 |
|
304 if (loader) { |
|
305 loader._config(o); |
|
306 } |
|
307 |
|
308 }, |
|
309 |
|
310 /** |
|
311 Old way to apply a config to this instance (calls `applyConfig` under the |
|
312 hood). |
|
313 |
|
314 @private |
|
315 @method _config |
|
316 @param {Object} o The config to apply |
|
317 **/ |
|
318 _config: function(o) { |
|
319 this.applyConfig(o); |
|
320 }, |
|
321 |
|
322 /** |
|
323 Initializes this YUI instance. |
|
324 |
|
325 @private |
|
326 @method _init |
|
327 **/ |
|
328 _init: function() { |
|
329 var filter, el, |
|
330 Y = this, |
|
331 G_ENV = YUI.Env, |
|
332 Env = Y.Env, |
|
333 prop; |
|
334 |
|
335 /** |
|
336 The version number of this YUI instance. |
|
337 |
|
338 This value is typically updated by a script when a YUI release is built, |
|
339 so it may not reflect the correct version number when YUI is run from |
|
340 the development source tree. |
|
341 |
|
342 @property {String} version |
|
343 **/ |
|
344 Y.version = VERSION; |
|
345 |
|
346 if (!Env) { |
|
347 Y.Env = { |
|
348 core: ['get', 'features', 'intl-base', 'yui-log', 'yui-log-nodejs', 'yui-later', 'loader-base', 'loader-rollup', 'loader-yui3'], |
|
349 loaderExtras: ['loader-rollup', 'loader-yui3'], |
|
350 mods: {}, // flat module map |
|
351 versions: {}, // version module map |
|
352 base: BASE, |
|
353 cdn: BASE + VERSION + '/build/', |
|
354 // bootstrapped: false, |
|
355 _idx: 0, |
|
356 _used: {}, |
|
357 _attached: {}, |
|
358 _missed: [], |
|
359 _yidx: 0, |
|
360 _uidx: 0, |
|
361 _guidp: 'y', |
|
362 _loaded: {}, |
|
363 // serviced: {}, |
|
364 // Regex in English: |
|
365 // I'll start at the \b(simpleyui). |
|
366 // 1. Look in the test string for "simpleyui" or "yui" or |
|
367 // "yui-base" or "yui-davglass" or "yui-foobar" that comes after a word break. That is, it |
|
368 // can't match "foyui" or "i_heart_simpleyui". This can be anywhere in the string. |
|
369 // 2. After #1 must come a forward slash followed by the string matched in #1, so |
|
370 // "yui-base/yui-base" or "simpleyui/simpleyui" or "yui-pants/yui-pants". |
|
371 // 3. The second occurence of the #1 token can optionally be followed by "-debug" or "-min", |
|
372 // so "yui/yui-min", "yui/yui-debug", "yui-base/yui-base-debug". NOT "yui/yui-tshirt". |
|
373 // 4. This is followed by ".js", so "yui/yui.js", "simpleyui/simpleyui-min.js" |
|
374 // 0. Going back to the beginning, now. If all that stuff in 1-4 comes after a "?" in the string, |
|
375 // then capture the junk between the LAST "&" and the string in 1-4. So |
|
376 // "blah?foo/yui/yui.js" will capture "foo/" and "blah?some/thing.js&3.3.0/build/yui-davglass/yui-davglass.js" |
|
377 // will capture "3.3.0/build/" |
|
378 // |
|
379 // Regex Exploded: |
|
380 // (?:\? Find a ? |
|
381 // (?:[^&]*&) followed by 0..n characters followed by an & |
|
382 // * in fact, find as many sets of characters followed by a & as you can |
|
383 // ([^&]*) capture the stuff after the last & in \1 |
|
384 // )? but it's ok if all this ?junk&more_junk stuff isn't even there |
|
385 // \b(simpleyui| after a word break find either the string "simpleyui" or |
|
386 // yui(?:-\w+)? the string "yui" optionally followed by a -, then more characters |
|
387 // ) and store the simpleyui or yui-* string in \2 |
|
388 // \/\2 then comes a / followed by the simpleyui or yui-* string in \2 |
|
389 // (?:-(min|debug))? optionally followed by "-min" or "-debug" |
|
390 // .js and ending in ".js" |
|
391 _BASE_RE: /(?:\?(?:[^&]*&)*([^&]*))?\b(simpleyui|yui(?:-\w+)?)\/\2(?:-(min|debug))?\.js/, |
|
392 parseBasePath: function(src, pattern) { |
|
393 var match = src.match(pattern), |
|
394 path, filter; |
|
395 |
|
396 if (match) { |
|
397 path = RegExp.leftContext || src.slice(0, src.indexOf(match[0])); |
|
398 |
|
399 // this is to set up the path to the loader. The file |
|
400 // filter for loader should match the yui include. |
|
401 filter = match[3]; |
|
402 |
|
403 // extract correct path for mixed combo urls |
|
404 // http://yuilibrary.com/projects/yui3/ticket/2528423 |
|
405 if (match[1]) { |
|
406 path += '?' + match[1]; |
|
407 } |
|
408 path = { |
|
409 filter: filter, |
|
410 path: path |
|
411 }; |
|
412 } |
|
413 return path; |
|
414 }, |
|
415 getBase: G_ENV && G_ENV.getBase || |
|
416 function(pattern) { |
|
417 var nodes = (doc && doc.getElementsByTagName('script')) || [], |
|
418 path = Env.cdn, parsed, |
|
419 i, len, src; |
|
420 |
|
421 for (i = 0, len = nodes.length; i < len; ++i) { |
|
422 src = nodes[i].src; |
|
423 if (src) { |
|
424 parsed = Y.Env.parseBasePath(src, pattern); |
|
425 if (parsed) { |
|
426 filter = parsed.filter; |
|
427 path = parsed.path; |
|
428 break; |
|
429 } |
|
430 } |
|
431 } |
|
432 |
|
433 // use CDN default |
|
434 return path; |
|
435 } |
|
436 |
|
437 }; |
|
438 |
|
439 Env = Y.Env; |
|
440 |
|
441 Env._loaded[VERSION] = {}; |
|
442 |
|
443 if (G_ENV && Y !== YUI) { |
|
444 Env._yidx = ++G_ENV._yidx; |
|
445 Env._guidp = ('yui_' + VERSION + '_' + |
|
446 Env._yidx + '_' + time).replace(/[^a-z0-9_]+/g, '_'); |
|
447 } else if (YUI._YUI) { |
|
448 |
|
449 G_ENV = YUI._YUI.Env; |
|
450 Env._yidx += G_ENV._yidx; |
|
451 Env._uidx += G_ENV._uidx; |
|
452 |
|
453 for (prop in G_ENV) { |
|
454 if (!(prop in Env)) { |
|
455 Env[prop] = G_ENV[prop]; |
|
456 } |
|
457 } |
|
458 |
|
459 delete YUI._YUI; |
|
460 } |
|
461 |
|
462 Y.id = Y.stamp(Y); |
|
463 instances[Y.id] = Y; |
|
464 |
|
465 } |
|
466 |
|
467 Y.constructor = YUI; |
|
468 |
|
469 // configuration defaults |
|
470 Y.config = Y.config || { |
|
471 bootstrap: true, |
|
472 cacheUse: true, |
|
473 debug: true, |
|
474 doc: doc, |
|
475 fetchCSS: true, |
|
476 throwFail: true, |
|
477 useBrowserConsole: true, |
|
478 useNativeES5: true, |
|
479 win: win, |
|
480 global: Function('return this')() |
|
481 }; |
|
482 |
|
483 //Register the CSS stamp element |
|
484 if (doc && !doc.getElementById(CSS_STAMP_EL)) { |
|
485 el = doc.createElement('div'); |
|
486 el.innerHTML = '<div id="' + CSS_STAMP_EL + '" style="position: absolute !important; visibility: hidden !important"></div>'; |
|
487 YUI.Env.cssStampEl = el.firstChild; |
|
488 if (doc.body) { |
|
489 doc.body.appendChild(YUI.Env.cssStampEl); |
|
490 } else { |
|
491 docEl.insertBefore(YUI.Env.cssStampEl, docEl.firstChild); |
|
492 } |
|
493 } else if (doc && doc.getElementById(CSS_STAMP_EL) && !YUI.Env.cssStampEl) { |
|
494 YUI.Env.cssStampEl = doc.getElementById(CSS_STAMP_EL); |
|
495 } |
|
496 |
|
497 Y.config.lang = Y.config.lang || 'en-US'; |
|
498 |
|
499 Y.config.base = YUI.config.base || Y.Env.getBase(Y.Env._BASE_RE); |
|
500 |
|
501 if (!filter || (!('mindebug').indexOf(filter))) { |
|
502 filter = 'min'; |
|
503 } |
|
504 filter = (filter) ? '-' + filter : filter; |
|
505 Y.config.loaderPath = YUI.config.loaderPath || 'loader/loader' + filter + '.js'; |
|
506 |
|
507 }, |
|
508 |
|
509 /** |
|
510 Finishes the instance setup. Attaches whatever YUI modules were defined |
|
511 at the time that this instance was created. |
|
512 |
|
513 @method _setup |
|
514 @private |
|
515 **/ |
|
516 _setup: function() { |
|
517 var i, Y = this, |
|
518 core = [], |
|
519 mods = YUI.Env.mods, |
|
520 extras = Y.config.core || [].concat(YUI.Env.core); //Clone it.. |
|
521 |
|
522 for (i = 0; i < extras.length; i++) { |
|
523 if (mods[extras[i]]) { |
|
524 core.push(extras[i]); |
|
525 } |
|
526 } |
|
527 |
|
528 Y._attach(['yui-base']); |
|
529 Y._attach(core); |
|
530 |
|
531 if (Y.Loader) { |
|
532 getLoader(Y); |
|
533 } |
|
534 |
|
535 // Y.log(Y.id + ' initialized', 'info', 'yui'); |
|
536 }, |
|
537 |
|
538 /** |
|
539 Executes the named method on the specified YUI instance if that method is |
|
540 whitelisted. |
|
541 |
|
542 @method applyTo |
|
543 @param {String} id YUI instance id. |
|
544 @param {String} method Name of the method to execute. For example: |
|
545 'Object.keys'. |
|
546 @param {Array} args Arguments to apply to the method. |
|
547 @return {Mixed} Return value from the applied method, or `null` if the |
|
548 specified instance was not found or the method was not whitelisted. |
|
549 **/ |
|
550 applyTo: function(id, method, args) { |
|
551 if (!(method in APPLY_TO_AUTH)) { |
|
552 this.log(method + ': applyTo not allowed', 'warn', 'yui'); |
|
553 return null; |
|
554 } |
|
555 |
|
556 var instance = instances[id], nest, m, i; |
|
557 if (instance) { |
|
558 nest = method.split('.'); |
|
559 m = instance; |
|
560 for (i = 0; i < nest.length; i = i + 1) { |
|
561 m = m[nest[i]]; |
|
562 if (!m) { |
|
563 this.log('applyTo not found: ' + method, 'warn', 'yui'); |
|
564 } |
|
565 } |
|
566 return m && m.apply(instance, args); |
|
567 } |
|
568 |
|
569 return null; |
|
570 }, |
|
571 |
|
572 /** |
|
573 Registers a YUI module and makes it available for use in a `YUI().use()` call or |
|
574 as a dependency for other modules. |
|
575 |
|
576 The easiest way to create a first-class YUI module is to use |
|
577 <a href="http://yui.github.com/shifter/">Shifter</a>, the YUI component build |
|
578 tool. |
|
579 |
|
580 Shifter will automatically wrap your module code in a `YUI.add()` call along |
|
581 with any configuration info required for the module. |
|
582 |
|
583 @example |
|
584 |
|
585 YUI.add('davglass', function (Y) { |
|
586 Y.davglass = function () { |
|
587 Y.log('Dav was here!'); |
|
588 }; |
|
589 }, '3.4.0', { |
|
590 requires: ['harley-davidson', 'mt-dew'] |
|
591 }); |
|
592 |
|
593 @method add |
|
594 @param {String} name Module name. |
|
595 @param {Function} fn Function containing module code. This function will be |
|
596 executed whenever the module is attached to a specific YUI instance. |
|
597 |
|
598 @param {YUI} fn.Y The YUI instance to which this module is attached. |
|
599 @param {String} fn.name Name of the module |
|
600 |
|
601 @param {String} version Module version number. This is currently used only for |
|
602 informational purposes, and is not used internally by YUI. |
|
603 |
|
604 @param {Object} [config] Module config. |
|
605 @param {Array} [config.requires] Array of other module names that must be |
|
606 attached before this module can be attached. |
|
607 @param {Array} [config.optional] Array of optional module names that should |
|
608 be attached before this module is attached if they've already been |
|
609 loaded. If the `loadOptional` YUI option is `true`, optional modules |
|
610 that have not yet been loaded will be loaded just as if they were hard |
|
611 requirements. |
|
612 @param {Array} [config.use] Array of module names that are included within |
|
613 or otherwise provided by this module, and which should be attached |
|
614 automatically when this module is attached. This makes it possible to |
|
615 create "virtual rollup" modules that simply attach a collection of other |
|
616 modules or submodules. |
|
617 |
|
618 @return {YUI} This YUI instance. |
|
619 **/ |
|
620 add: function(name, fn, version, details) { |
|
621 details = details || {}; |
|
622 var env = YUI.Env, |
|
623 mod = { |
|
624 name: name, |
|
625 fn: fn, |
|
626 version: version, |
|
627 details: details |
|
628 }, |
|
629 //Instance hash so we don't apply it to the same instance twice |
|
630 applied = {}, |
|
631 loader, inst, |
|
632 i, versions = env.versions; |
|
633 |
|
634 env.mods[name] = mod; |
|
635 versions[version] = versions[version] || {}; |
|
636 versions[version][name] = mod; |
|
637 |
|
638 for (i in instances) { |
|
639 if (instances.hasOwnProperty(i)) { |
|
640 inst = instances[i]; |
|
641 if (!applied[inst.id]) { |
|
642 applied[inst.id] = true; |
|
643 loader = inst.Env._loader; |
|
644 if (loader) { |
|
645 if (!loader.moduleInfo[name] || loader.moduleInfo[name].temp) { |
|
646 loader.addModule(details, name); |
|
647 } |
|
648 } |
|
649 } |
|
650 } |
|
651 } |
|
652 |
|
653 return this; |
|
654 }, |
|
655 |
|
656 /** |
|
657 Executes the callback function associated with each required module, |
|
658 attaching the module to this YUI instance. |
|
659 |
|
660 @method _attach |
|
661 @param {Array} r The array of modules to attach |
|
662 @param {Boolean} [moot=false] If `true`, don't throw a warning if the module |
|
663 is not attached. |
|
664 @private |
|
665 **/ |
|
666 _attach: function(r, moot) { |
|
667 var i, name, mod, details, req, use, after, |
|
668 mods = YUI.Env.mods, |
|
669 aliases = YUI.Env.aliases, |
|
670 Y = this, j, |
|
671 cache = YUI.Env._renderedMods, |
|
672 loader = Y.Env._loader, |
|
673 done = Y.Env._attached, |
|
674 len = r.length, loader, def, go, |
|
675 c = []; |
|
676 |
|
677 //Check for conditional modules (in a second+ instance) and add their requirements |
|
678 //TODO I hate this entire method, it needs to be fixed ASAP (3.5.0) ^davglass |
|
679 for (i = 0; i < len; i++) { |
|
680 name = r[i]; |
|
681 mod = mods[name]; |
|
682 c.push(name); |
|
683 if (loader && loader.conditions[name]) { |
|
684 for (j in loader.conditions[name]) { |
|
685 if (loader.conditions[name].hasOwnProperty(j)) { |
|
686 def = loader.conditions[name][j]; |
|
687 go = def && ((def.ua && Y.UA[def.ua]) || (def.test && def.test(Y))); |
|
688 if (go) { |
|
689 c.push(def.name); |
|
690 } |
|
691 } |
|
692 } |
|
693 } |
|
694 } |
|
695 r = c; |
|
696 len = r.length; |
|
697 |
|
698 for (i = 0; i < len; i++) { |
|
699 if (!done[r[i]]) { |
|
700 name = r[i]; |
|
701 mod = mods[name]; |
|
702 |
|
703 if (aliases && aliases[name] && !mod) { |
|
704 Y._attach(aliases[name]); |
|
705 continue; |
|
706 } |
|
707 if (!mod) { |
|
708 if (loader && loader.moduleInfo[name]) { |
|
709 mod = loader.moduleInfo[name]; |
|
710 moot = true; |
|
711 } |
|
712 |
|
713 // Y.log('no js def for: ' + name, 'info', 'yui'); |
|
714 |
|
715 //if (!loader || !loader.moduleInfo[name]) { |
|
716 //if ((!loader || !loader.moduleInfo[name]) && !moot) { |
|
717 if (!moot && name) { |
|
718 if ((name.indexOf('skin-') === -1) && (name.indexOf('css') === -1)) { |
|
719 Y.Env._missed.push(name); |
|
720 Y.Env._missed = Y.Array.dedupe(Y.Env._missed); |
|
721 Y.message('NOT loaded: ' + name, 'warn', 'yui'); |
|
722 } |
|
723 } |
|
724 } else { |
|
725 done[name] = true; |
|
726 //Don't like this, but in case a mod was asked for once, then we fetch it |
|
727 //We need to remove it from the missed list ^davglass |
|
728 for (j = 0; j < Y.Env._missed.length; j++) { |
|
729 if (Y.Env._missed[j] === name) { |
|
730 Y.message('Found: ' + name + ' (was reported as missing earlier)', 'warn', 'yui'); |
|
731 Y.Env._missed.splice(j, 1); |
|
732 } |
|
733 } |
|
734 /* |
|
735 If it's a temp module, we need to redo it's requirements if it's already loaded |
|
736 since it may have been loaded by another instance and it's dependencies might |
|
737 have been redefined inside the fetched file. |
|
738 */ |
|
739 if (loader && cache && cache[name] && cache[name].temp) { |
|
740 loader.getRequires(cache[name]); |
|
741 req = []; |
|
742 for (j in loader.moduleInfo[name].expanded_map) { |
|
743 if (loader.moduleInfo[name].expanded_map.hasOwnProperty(j)) { |
|
744 req.push(j); |
|
745 } |
|
746 } |
|
747 Y._attach(req); |
|
748 } |
|
749 |
|
750 details = mod.details; |
|
751 req = details.requires; |
|
752 use = details.use; |
|
753 after = details.after; |
|
754 //Force Intl load if there is a language (Loader logic) @todo fix this shit |
|
755 if (details.lang) { |
|
756 req = req || []; |
|
757 req.unshift('intl'); |
|
758 } |
|
759 |
|
760 if (req) { |
|
761 for (j = 0; j < req.length; j++) { |
|
762 if (!done[req[j]]) { |
|
763 if (!Y._attach(req)) { |
|
764 return false; |
|
765 } |
|
766 break; |
|
767 } |
|
768 } |
|
769 } |
|
770 |
|
771 if (after) { |
|
772 for (j = 0; j < after.length; j++) { |
|
773 if (!done[after[j]]) { |
|
774 if (!Y._attach(after, true)) { |
|
775 return false; |
|
776 } |
|
777 break; |
|
778 } |
|
779 } |
|
780 } |
|
781 |
|
782 if (mod.fn) { |
|
783 if (Y.config.throwFail) { |
|
784 mod.fn(Y, name); |
|
785 } else { |
|
786 try { |
|
787 mod.fn(Y, name); |
|
788 } catch (e) { |
|
789 Y.error('Attach error: ' + name, e, name); |
|
790 return false; |
|
791 } |
|
792 } |
|
793 } |
|
794 |
|
795 if (use) { |
|
796 for (j = 0; j < use.length; j++) { |
|
797 if (!done[use[j]]) { |
|
798 if (!Y._attach(use)) { |
|
799 return false; |
|
800 } |
|
801 break; |
|
802 } |
|
803 } |
|
804 } |
|
805 |
|
806 |
|
807 |
|
808 } |
|
809 } |
|
810 } |
|
811 |
|
812 return true; |
|
813 }, |
|
814 |
|
815 /** |
|
816 Delays the `use` callback until another event has taken place such as |
|
817 `window.onload`, `domready`, `contentready`, or `available`. |
|
818 |
|
819 @private |
|
820 @method _delayCallback |
|
821 @param {Function} cb The original `use` callback. |
|
822 @param {String|Object} until Either an event name ('load', 'domready', etc.) |
|
823 or an object containing event/args keys for contentready/available. |
|
824 @return {Function} |
|
825 **/ |
|
826 _delayCallback: function(cb, until) { |
|
827 |
|
828 var Y = this, |
|
829 mod = ['event-base']; |
|
830 |
|
831 until = (Y.Lang.isObject(until) ? until : { event: until }); |
|
832 |
|
833 if (until.event === 'load') { |
|
834 mod.push('event-synthetic'); |
|
835 } |
|
836 |
|
837 Y.log('Delaying use callback until: ' + until.event, 'info', 'yui'); |
|
838 return function() { |
|
839 Y.log('Use callback fired, waiting on delay', 'info', 'yui'); |
|
840 var args = arguments; |
|
841 Y._use(mod, function() { |
|
842 Y.log('Delayed use wrapper callback after dependencies', 'info', 'yui'); |
|
843 Y.on(until.event, function() { |
|
844 args[1].delayUntil = until.event; |
|
845 Y.log('Delayed use callback done after ' + until.event, 'info', 'yui'); |
|
846 cb.apply(Y, args); |
|
847 }, until.args); |
|
848 }); |
|
849 }; |
|
850 }, |
|
851 |
|
852 /** |
|
853 Attaches one or more modules to this YUI instance. When this is executed, |
|
854 the requirements of the desired modules are analyzed, and one of several |
|
855 things can happen: |
|
856 |
|
857 |
|
858 * All required modules have already been loaded, and just need to be |
|
859 attached to this YUI instance. In this case, the `use()` callback will |
|
860 be executed synchronously after the modules are attached. |
|
861 |
|
862 * One or more modules have not yet been loaded, or the Get utility is not |
|
863 available, or the `bootstrap` config option is `false`. In this case, |
|
864 a warning is issued indicating that modules are missing, but all |
|
865 available modules will still be attached and the `use()` callback will |
|
866 be executed synchronously. |
|
867 |
|
868 * One or more modules are missing and the Loader is not available but the |
|
869 Get utility is, and `bootstrap` is not `false`. In this case, the Get |
|
870 utility will be used to load the Loader, and we will then proceed to |
|
871 the following state: |
|
872 |
|
873 * One or more modules are missing and the Loader is available. In this |
|
874 case, the Loader will be used to resolve the dependency tree for the |
|
875 missing modules and load them and their dependencies. When the Loader is |
|
876 finished loading modules, the `use()` callback will be executed |
|
877 asynchronously. |
|
878 |
|
879 @example |
|
880 |
|
881 // Loads and attaches dd and its dependencies. |
|
882 YUI().use('dd', function (Y) { |
|
883 // ... |
|
884 }); |
|
885 |
|
886 // Loads and attaches dd and node as well as all of their dependencies. |
|
887 YUI().use(['dd', 'node'], function (Y) { |
|
888 // ... |
|
889 }); |
|
890 |
|
891 // Attaches all modules that have already been loaded. |
|
892 YUI().use('*', function (Y) { |
|
893 // ... |
|
894 }); |
|
895 |
|
896 // Attaches a gallery module. |
|
897 YUI().use('gallery-yql', function (Y) { |
|
898 // ... |
|
899 }); |
|
900 |
|
901 // Attaches a YUI 2in3 module. |
|
902 YUI().use('yui2-datatable', function (Y) { |
|
903 // ... |
|
904 }); |
|
905 |
|
906 @method use |
|
907 @param {String|Array} modules* One or more module names to attach. |
|
908 @param {Function} [callback] Callback function to be executed once all |
|
909 specified modules and their dependencies have been attached. |
|
910 @param {YUI} callback.Y The YUI instance created for this sandbox. |
|
911 @param {Object} callback.status Object containing `success`, `msg` and |
|
912 `data` properties. |
|
913 @chainable |
|
914 **/ |
|
915 use: function() { |
|
916 var args = SLICE.call(arguments, 0), |
|
917 callback = args[args.length - 1], |
|
918 Y = this, |
|
919 i = 0, |
|
920 name, |
|
921 Env = Y.Env, |
|
922 provisioned = true; |
|
923 |
|
924 // The last argument supplied to use can be a load complete callback |
|
925 if (Y.Lang.isFunction(callback)) { |
|
926 args.pop(); |
|
927 if (Y.config.delayUntil) { |
|
928 callback = Y._delayCallback(callback, Y.config.delayUntil); |
|
929 } |
|
930 } else { |
|
931 callback = null; |
|
932 } |
|
933 if (Y.Lang.isArray(args[0])) { |
|
934 args = args[0]; |
|
935 } |
|
936 |
|
937 if (Y.config.cacheUse) { |
|
938 while ((name = args[i++])) { |
|
939 if (!Env._attached[name]) { |
|
940 provisioned = false; |
|
941 break; |
|
942 } |
|
943 } |
|
944 |
|
945 if (provisioned) { |
|
946 if (args.length) { |
|
947 Y.log('already provisioned: ' + args, 'info', 'yui'); |
|
948 } |
|
949 Y._notify(callback, ALREADY_DONE, args); |
|
950 return Y; |
|
951 } |
|
952 } |
|
953 |
|
954 if (Y._loading) { |
|
955 Y._useQueue = Y._useQueue || new Y.Queue(); |
|
956 Y._useQueue.add([args, callback]); |
|
957 } else { |
|
958 Y._use(args, function(Y, response) { |
|
959 Y._notify(callback, response, args); |
|
960 }); |
|
961 } |
|
962 |
|
963 return Y; |
|
964 }, |
|
965 |
|
966 /** |
|
967 Handles Loader notifications about attachment/load errors. |
|
968 |
|
969 @method _notify |
|
970 @param {Function} callback Callback to pass to `Y.config.loadErrorFn`. |
|
971 @param {Object} response Response returned from Loader. |
|
972 @param {Array} args Arguments passed from Loader. |
|
973 @private |
|
974 **/ |
|
975 _notify: function(callback, response, args) { |
|
976 if (!response.success && this.config.loadErrorFn) { |
|
977 this.config.loadErrorFn.call(this, this, callback, response, args); |
|
978 } else if (callback) { |
|
979 if (this.Env._missed && this.Env._missed.length) { |
|
980 response.msg = 'Missing modules: ' + this.Env._missed.join(); |
|
981 response.success = false; |
|
982 } |
|
983 if (this.config.throwFail) { |
|
984 callback(this, response); |
|
985 } else { |
|
986 try { |
|
987 callback(this, response); |
|
988 } catch (e) { |
|
989 this.error('use callback error', e, args); |
|
990 } |
|
991 } |
|
992 } |
|
993 }, |
|
994 |
|
995 /** |
|
996 Called from the `use` method queue to ensure that only one set of loading |
|
997 logic is performed at a time. |
|
998 |
|
999 @method _use |
|
1000 @param {String} args* One or more modules to attach. |
|
1001 @param {Function} [callback] Function to call once all required modules have |
|
1002 been attached. |
|
1003 @private |
|
1004 **/ |
|
1005 _use: function(args, callback) { |
|
1006 |
|
1007 if (!this.Array) { |
|
1008 this._attach(['yui-base']); |
|
1009 } |
|
1010 |
|
1011 var len, loader, handleBoot, |
|
1012 Y = this, |
|
1013 G_ENV = YUI.Env, |
|
1014 mods = G_ENV.mods, |
|
1015 Env = Y.Env, |
|
1016 used = Env._used, |
|
1017 aliases = G_ENV.aliases, |
|
1018 queue = G_ENV._loaderQueue, |
|
1019 firstArg = args[0], |
|
1020 YArray = Y.Array, |
|
1021 config = Y.config, |
|
1022 boot = config.bootstrap, |
|
1023 missing = [], |
|
1024 i, |
|
1025 r = [], |
|
1026 ret = true, |
|
1027 fetchCSS = config.fetchCSS, |
|
1028 process = function(names, skip) { |
|
1029 |
|
1030 var i = 0, a = [], name, len, m, req, use; |
|
1031 |
|
1032 if (!names.length) { |
|
1033 return; |
|
1034 } |
|
1035 |
|
1036 if (aliases) { |
|
1037 len = names.length; |
|
1038 for (i = 0; i < len; i++) { |
|
1039 if (aliases[names[i]] && !mods[names[i]]) { |
|
1040 a = [].concat(a, aliases[names[i]]); |
|
1041 } else { |
|
1042 a.push(names[i]); |
|
1043 } |
|
1044 } |
|
1045 names = a; |
|
1046 } |
|
1047 |
|
1048 len = names.length; |
|
1049 |
|
1050 for (i = 0; i < len; i++) { |
|
1051 name = names[i]; |
|
1052 if (!skip) { |
|
1053 r.push(name); |
|
1054 } |
|
1055 |
|
1056 // only attach a module once |
|
1057 if (used[name]) { |
|
1058 continue; |
|
1059 } |
|
1060 |
|
1061 m = mods[name]; |
|
1062 req = null; |
|
1063 use = null; |
|
1064 |
|
1065 if (m) { |
|
1066 used[name] = true; |
|
1067 req = m.details.requires; |
|
1068 use = m.details.use; |
|
1069 } else { |
|
1070 // CSS files don't register themselves, see if it has |
|
1071 // been loaded |
|
1072 if (!G_ENV._loaded[VERSION][name]) { |
|
1073 missing.push(name); |
|
1074 } else { |
|
1075 used[name] = true; // probably css |
|
1076 } |
|
1077 } |
|
1078 |
|
1079 // make sure requirements are attached |
|
1080 if (req && req.length) { |
|
1081 process(req); |
|
1082 } |
|
1083 |
|
1084 // make sure we grab the submodule dependencies too |
|
1085 if (use && use.length) { |
|
1086 process(use, 1); |
|
1087 } |
|
1088 } |
|
1089 |
|
1090 }, |
|
1091 |
|
1092 handleLoader = function(fromLoader) { |
|
1093 var response = fromLoader || { |
|
1094 success: true, |
|
1095 msg: 'not dynamic' |
|
1096 }, |
|
1097 redo, origMissing, |
|
1098 ret = true, |
|
1099 data = response.data; |
|
1100 |
|
1101 Y._loading = false; |
|
1102 |
|
1103 if (data) { |
|
1104 origMissing = missing; |
|
1105 missing = []; |
|
1106 r = []; |
|
1107 process(data); |
|
1108 redo = missing.length; |
|
1109 if (redo) { |
|
1110 if ([].concat(missing).sort().join() == |
|
1111 origMissing.sort().join()) { |
|
1112 redo = false; |
|
1113 } |
|
1114 } |
|
1115 } |
|
1116 |
|
1117 if (redo && data) { |
|
1118 Y._loading = true; |
|
1119 Y._use(missing, function() { |
|
1120 Y.log('Nested use callback: ' + data, 'info', 'yui'); |
|
1121 if (Y._attach(data)) { |
|
1122 Y._notify(callback, response, data); |
|
1123 } |
|
1124 }); |
|
1125 } else { |
|
1126 if (data) { |
|
1127 // Y.log('attaching from loader: ' + data, 'info', 'yui'); |
|
1128 ret = Y._attach(data); |
|
1129 } |
|
1130 if (ret) { |
|
1131 Y._notify(callback, response, args); |
|
1132 } |
|
1133 } |
|
1134 |
|
1135 if (Y._useQueue && Y._useQueue.size() && !Y._loading) { |
|
1136 Y._use.apply(Y, Y._useQueue.next()); |
|
1137 } |
|
1138 |
|
1139 }; |
|
1140 |
|
1141 // Y.log(Y.id + ': use called: ' + a + ' :: ' + callback, 'info', 'yui'); |
|
1142 |
|
1143 // YUI().use('*'); // bind everything available |
|
1144 if (firstArg === '*') { |
|
1145 args = []; |
|
1146 for (i in mods) { |
|
1147 if (mods.hasOwnProperty(i)) { |
|
1148 args.push(i); |
|
1149 } |
|
1150 } |
|
1151 ret = Y._attach(args); |
|
1152 if (ret) { |
|
1153 handleLoader(); |
|
1154 } |
|
1155 return Y; |
|
1156 } |
|
1157 |
|
1158 if ((mods.loader || mods['loader-base']) && !Y.Loader) { |
|
1159 Y.log('Loader was found in meta, but it is not attached. Attaching..', 'info', 'yui'); |
|
1160 Y._attach(['loader' + ((!mods.loader) ? '-base' : '')]); |
|
1161 } |
|
1162 |
|
1163 // Y.log('before loader requirements: ' + args, 'info', 'yui'); |
|
1164 |
|
1165 // use loader to expand dependencies and sort the |
|
1166 // requirements if it is available. |
|
1167 if (boot && Y.Loader && args.length) { |
|
1168 Y.log('Using loader to expand dependencies', 'info', 'yui'); |
|
1169 loader = getLoader(Y); |
|
1170 loader.require(args); |
|
1171 loader.ignoreRegistered = true; |
|
1172 loader._boot = true; |
|
1173 loader.calculate(null, (fetchCSS) ? null : 'js'); |
|
1174 args = loader.sorted; |
|
1175 loader._boot = false; |
|
1176 } |
|
1177 |
|
1178 process(args); |
|
1179 |
|
1180 len = missing.length; |
|
1181 |
|
1182 |
|
1183 if (len) { |
|
1184 missing = YArray.dedupe(missing); |
|
1185 len = missing.length; |
|
1186 Y.log('Modules missing: ' + missing + ', ' + missing.length, 'info', 'yui'); |
|
1187 } |
|
1188 |
|
1189 |
|
1190 // dynamic load |
|
1191 if (boot && len && Y.Loader) { |
|
1192 // Y.log('Using loader to fetch missing deps: ' + missing, 'info', 'yui'); |
|
1193 Y.log('Using Loader', 'info', 'yui'); |
|
1194 Y._loading = true; |
|
1195 loader = getLoader(Y); |
|
1196 loader.onEnd = handleLoader; |
|
1197 loader.context = Y; |
|
1198 loader.data = args; |
|
1199 loader.ignoreRegistered = false; |
|
1200 loader.require(missing); |
|
1201 loader.insert(null, (fetchCSS) ? null : 'js'); |
|
1202 |
|
1203 } else if (boot && len && Y.Get && !Env.bootstrapped) { |
|
1204 |
|
1205 Y._loading = true; |
|
1206 |
|
1207 handleBoot = function() { |
|
1208 Y._loading = false; |
|
1209 queue.running = false; |
|
1210 Env.bootstrapped = true; |
|
1211 G_ENV._bootstrapping = false; |
|
1212 if (Y._attach(['loader'])) { |
|
1213 Y._use(args, callback); |
|
1214 } |
|
1215 }; |
|
1216 |
|
1217 if (G_ENV._bootstrapping) { |
|
1218 Y.log('Waiting for loader', 'info', 'yui'); |
|
1219 queue.add(handleBoot); |
|
1220 } else { |
|
1221 G_ENV._bootstrapping = true; |
|
1222 Y.log('Fetching loader: ' + config.base + config.loaderPath, 'info', 'yui'); |
|
1223 Y.Get.script(config.base + config.loaderPath, { |
|
1224 onEnd: handleBoot |
|
1225 }); |
|
1226 } |
|
1227 |
|
1228 } else { |
|
1229 Y.log('Attaching available dependencies: ' + args, 'info', 'yui'); |
|
1230 ret = Y._attach(args); |
|
1231 if (ret) { |
|
1232 handleLoader(); |
|
1233 } |
|
1234 } |
|
1235 |
|
1236 return Y; |
|
1237 }, |
|
1238 |
|
1239 |
|
1240 /** |
|
1241 Utility method for safely creating namespaces if they don't already exist. |
|
1242 May be called statically on the YUI global object or as a method on a YUI |
|
1243 instance. |
|
1244 |
|
1245 When called statically, a namespace will be created on the YUI global |
|
1246 object: |
|
1247 |
|
1248 // Create `YUI.your.namespace.here` as nested objects, preserving any |
|
1249 // objects that already exist instead of overwriting them. |
|
1250 YUI.namespace('your.namespace.here'); |
|
1251 |
|
1252 When called as a method on a YUI instance, a namespace will be created on |
|
1253 that instance: |
|
1254 |
|
1255 // Creates `Y.property.package`. |
|
1256 Y.namespace('property.package'); |
|
1257 |
|
1258 Dots in the input string cause `namespace` to create nested objects for each |
|
1259 token. If any part of the requested namespace already exists, the current |
|
1260 object will be left in place and will not be overwritten. This allows |
|
1261 multiple calls to `namespace` to preserve existing namespaced properties. |
|
1262 |
|
1263 If the first token in the namespace string is "YAHOO", that token is |
|
1264 discarded. This is legacy behavior for backwards compatibility with YUI 2. |
|
1265 |
|
1266 Be careful with namespace tokens. Reserved words may work in some browsers |
|
1267 and not others. For instance, the following will fail in some browsers |
|
1268 because the supported version of JavaScript reserves the word "long": |
|
1269 |
|
1270 Y.namespace('really.long.nested.namespace'); |
|
1271 |
|
1272 Note: If you pass multiple arguments to create multiple namespaces, only the |
|
1273 last one created is returned from this function. |
|
1274 |
|
1275 @method namespace |
|
1276 @param {String} namespace* One or more namespaces to create. |
|
1277 @return {Object} Reference to the last namespace object created. |
|
1278 **/ |
|
1279 namespace: function() { |
|
1280 var a = arguments, o, i = 0, j, d, arg; |
|
1281 |
|
1282 for (; i < a.length; i++) { |
|
1283 o = this; //Reset base object per argument or it will get reused from the last |
|
1284 arg = a[i]; |
|
1285 if (arg.indexOf(PERIOD) > -1) { //Skip this if no "." is present |
|
1286 d = arg.split(PERIOD); |
|
1287 for (j = (d[0] == 'YAHOO') ? 1 : 0; j < d.length; j++) { |
|
1288 o[d[j]] = o[d[j]] || {}; |
|
1289 o = o[d[j]]; |
|
1290 } |
|
1291 } else { |
|
1292 o[arg] = o[arg] || {}; |
|
1293 o = o[arg]; //Reset base object to the new object so it's returned |
|
1294 } |
|
1295 } |
|
1296 return o; |
|
1297 }, |
|
1298 |
|
1299 // this is replaced if the log module is included |
|
1300 log: NOOP, |
|
1301 message: NOOP, |
|
1302 // this is replaced if the dump module is included |
|
1303 dump: function (o) { return ''+o; }, |
|
1304 |
|
1305 /** |
|
1306 Reports an error. |
|
1307 |
|
1308 The reporting mechanism is controlled by the `throwFail` configuration |
|
1309 attribute. If `throwFail` is falsy, the message is logged. If `throwFail` is |
|
1310 truthy, a JS exception is thrown. |
|
1311 |
|
1312 If an `errorFn` is specified in the config it must return `true` to indicate |
|
1313 that the exception was handled and keep it from being thrown. |
|
1314 |
|
1315 @method error |
|
1316 @param {String} msg Error message. |
|
1317 @param {Error|String} [e] JavaScript error object or an error string. |
|
1318 @param {String} [src] Source of the error (such as the name of the module in |
|
1319 which the error occurred). |
|
1320 @chainable |
|
1321 **/ |
|
1322 error: function(msg, e, src) { |
|
1323 //TODO Add check for window.onerror here |
|
1324 |
|
1325 var Y = this, ret; |
|
1326 |
|
1327 if (Y.config.errorFn) { |
|
1328 ret = Y.config.errorFn.apply(Y, arguments); |
|
1329 } |
|
1330 |
|
1331 if (!ret) { |
|
1332 throw (e || new Error(msg)); |
|
1333 } else { |
|
1334 Y.message(msg, 'error', ''+src); // don't scrub this one |
|
1335 } |
|
1336 |
|
1337 return Y; |
|
1338 }, |
|
1339 |
|
1340 /** |
|
1341 Generates an id string that is unique among all YUI instances in this |
|
1342 execution context. |
|
1343 |
|
1344 @method guid |
|
1345 @param {String} [pre] Prefix. |
|
1346 @return {String} Unique id. |
|
1347 **/ |
|
1348 guid: function(pre) { |
|
1349 var id = this.Env._guidp + '_' + (++this.Env._uidx); |
|
1350 return (pre) ? (pre + id) : id; |
|
1351 }, |
|
1352 |
|
1353 /** |
|
1354 Returns a unique id associated with the given object and (if *readOnly* is |
|
1355 falsy) stamps the object with that id so it can be identified in the future. |
|
1356 |
|
1357 Stamping an object involves adding a `_yuid` property to it that contains |
|
1358 the object's id. One exception to this is that in Internet Explorer, DOM |
|
1359 nodes have a `uniqueID` property that contains a browser-generated unique |
|
1360 id, which will be used instead of a YUI-generated id when available. |
|
1361 |
|
1362 @method stamp |
|
1363 @param {Object} o Object to stamp. |
|
1364 @param {Boolean} readOnly If truthy and the given object has not already |
|
1365 been stamped, the object will not be modified and `null` will be |
|
1366 returned. |
|
1367 @return {String} Object's unique id, or `null` if *readOnly* was truthy and |
|
1368 the given object was not already stamped. |
|
1369 **/ |
|
1370 stamp: function(o, readOnly) { |
|
1371 var uid; |
|
1372 if (!o) { |
|
1373 return o; |
|
1374 } |
|
1375 |
|
1376 // IE generates its own unique ID for dom nodes |
|
1377 // The uniqueID property of a document node returns a new ID |
|
1378 if (o.uniqueID && o.nodeType && o.nodeType !== 9) { |
|
1379 uid = o.uniqueID; |
|
1380 } else { |
|
1381 uid = (typeof o === 'string') ? o : o._yuid; |
|
1382 } |
|
1383 |
|
1384 if (!uid) { |
|
1385 uid = this.guid(); |
|
1386 if (!readOnly) { |
|
1387 try { |
|
1388 o._yuid = uid; |
|
1389 } catch (e) { |
|
1390 uid = null; |
|
1391 } |
|
1392 } |
|
1393 } |
|
1394 return uid; |
|
1395 }, |
|
1396 |
|
1397 /** |
|
1398 Destroys this YUI instance. |
|
1399 |
|
1400 @method destroy |
|
1401 @since 3.3.0 |
|
1402 **/ |
|
1403 destroy: function() { |
|
1404 var Y = this; |
|
1405 if (Y.Event) { |
|
1406 Y.Event._unload(); |
|
1407 } |
|
1408 delete instances[Y.id]; |
|
1409 delete Y.Env; |
|
1410 delete Y.config; |
|
1411 } |
|
1412 |
|
1413 /** |
|
1414 Safe `instanceof` wrapper that works around a memory leak in IE when the |
|
1415 object being tested is `window` or `document`. |
|
1416 |
|
1417 Unless you are testing objects that may be `window` or `document`, you |
|
1418 should use the native `instanceof` operator instead of this method. |
|
1419 |
|
1420 @method instanceOf |
|
1421 @param {Object} o Object to check. |
|
1422 @param {Object} type Class to check against. |
|
1423 @since 3.3.0 |
|
1424 **/ |
|
1425 }; |
|
1426 |
|
1427 YUI.prototype = proto; |
|
1428 |
|
1429 // inheritance utilities are not available yet |
|
1430 for (prop in proto) { |
|
1431 if (proto.hasOwnProperty(prop)) { |
|
1432 YUI[prop] = proto[prop]; |
|
1433 } |
|
1434 } |
|
1435 |
|
1436 /** |
|
1437 Applies a configuration to all YUI instances in this execution context. |
|
1438 |
|
1439 The main use case for this method is in "mashups" where several third-party |
|
1440 scripts need to write to a global YUI config, but cannot share a single |
|
1441 centrally-managed config object. This way they can all call |
|
1442 `YUI.applyConfig({})` instead of overwriting the single global config. |
|
1443 |
|
1444 @example |
|
1445 |
|
1446 YUI.applyConfig({ |
|
1447 modules: { |
|
1448 davglass: { |
|
1449 fullpath: './davglass.js' |
|
1450 } |
|
1451 } |
|
1452 }); |
|
1453 |
|
1454 YUI.applyConfig({ |
|
1455 modules: { |
|
1456 foo: { |
|
1457 fullpath: './foo.js' |
|
1458 } |
|
1459 } |
|
1460 }); |
|
1461 |
|
1462 YUI().use('davglass', function (Y) { |
|
1463 // Module davglass will be available here. |
|
1464 }); |
|
1465 |
|
1466 @method applyConfig |
|
1467 @param {Object} o Configuration object to apply. |
|
1468 @static |
|
1469 @since 3.5.0 |
|
1470 **/ |
|
1471 YUI.applyConfig = function(o) { |
|
1472 if (!o) { |
|
1473 return; |
|
1474 } |
|
1475 //If there is a GlobalConfig, apply it first to set the defaults |
|
1476 if (YUI.GlobalConfig) { |
|
1477 this.prototype.applyConfig.call(this, YUI.GlobalConfig); |
|
1478 } |
|
1479 //Apply this config to it |
|
1480 this.prototype.applyConfig.call(this, o); |
|
1481 //Reset GlobalConfig to the combined config |
|
1482 YUI.GlobalConfig = this.config; |
|
1483 }; |
|
1484 |
|
1485 // set up the environment |
|
1486 YUI._init(); |
|
1487 |
|
1488 if (hasWin) { |
|
1489 // add a window load event at load time so we can capture |
|
1490 // the case where it fires before dynamic loading is |
|
1491 // complete. |
|
1492 add(window, 'load', handleLoad); |
|
1493 } else { |
|
1494 handleLoad(); |
|
1495 } |
|
1496 |
|
1497 YUI.Env.add = add; |
|
1498 YUI.Env.remove = remove; |
|
1499 |
|
1500 /*global exports*/ |
|
1501 // Support the CommonJS method for exporting our single global |
|
1502 if (typeof exports == 'object') { |
|
1503 exports.YUI = YUI; |
|
1504 /** |
|
1505 * Set a method to be called when `Get.script` is called in Node.js |
|
1506 * `Get` will open the file, then pass it's content and it's path |
|
1507 * to this method before attaching it. Commonly used for code coverage |
|
1508 * instrumentation. <strong>Calling this multiple times will only |
|
1509 * attach the last hook method</strong>. This method is only |
|
1510 * available in Node.js. |
|
1511 * @method setLoadHook |
|
1512 * @static |
|
1513 * @param {Function} fn The function to set |
|
1514 * @param {String} fn.data The content of the file |
|
1515 * @param {String} fn.path The file path of the file |
|
1516 */ |
|
1517 YUI.setLoadHook = function(fn) { |
|
1518 YUI._getLoadHook = fn; |
|
1519 }; |
|
1520 /** |
|
1521 * Load hook for `Y.Get.script` in Node.js, see `YUI.setLoadHook` |
|
1522 * @method _getLoadHook |
|
1523 * @private |
|
1524 * @param {String} data The content of the file |
|
1525 * @param {String} path The file path of the file |
|
1526 */ |
|
1527 YUI._getLoadHook = null; |
|
1528 } |
|
1529 |
|
1530 }()); |
|
1531 |
|
1532 |
|
1533 /** |
|
1534 Config object that contains all of the configuration options for |
|
1535 this `YUI` instance. |
|
1536 |
|
1537 This object is supplied by the implementer when instantiating YUI. Some |
|
1538 properties have default values if they are not supplied by the implementer. |
|
1539 |
|
1540 This object should not be updated directly because some values are cached. Use |
|
1541 `applyConfig()` to update the config object on a YUI instance that has already |
|
1542 been configured. |
|
1543 |
|
1544 @class config |
|
1545 @static |
|
1546 **/ |
|
1547 |
|
1548 /** |
|
1549 If `true` (the default), YUI will "bootstrap" the YUI Loader and module metadata |
|
1550 if they're needed to load additional dependencies and aren't already available. |
|
1551 |
|
1552 Setting this to `false` will prevent YUI from automatically loading the Loader |
|
1553 and module metadata, so you will need to manually ensure that they're available |
|
1554 or handle dependency resolution yourself. |
|
1555 |
|
1556 @property {Boolean} bootstrap |
|
1557 @default true |
|
1558 **/ |
|
1559 |
|
1560 /** |
|
1561 If `true`, `Y.log()` messages will be written to the browser's debug console |
|
1562 when available and when `useBrowserConsole` is also `true`. |
|
1563 |
|
1564 @property {Boolean} debug |
|
1565 @default true |
|
1566 **/ |
|
1567 |
|
1568 /** |
|
1569 Log messages to the browser console if `debug` is `true` and the browser has a |
|
1570 supported console. |
|
1571 |
|
1572 @property {Boolean} useBrowserConsole |
|
1573 @default true |
|
1574 **/ |
|
1575 |
|
1576 /** |
|
1577 A hash of log sources that should be logged. If specified, only messages from |
|
1578 these sources will be logged. Others will be discarded. |
|
1579 |
|
1580 @property {Object} logInclude |
|
1581 @type object |
|
1582 **/ |
|
1583 |
|
1584 /** |
|
1585 A hash of log sources that should be not be logged. If specified, all sources |
|
1586 will be logged *except* those on this list. |
|
1587 |
|
1588 @property {Object} logExclude |
|
1589 **/ |
|
1590 |
|
1591 /** |
|
1592 When the YUI seed file is dynamically loaded after the `window.onload` event has |
|
1593 fired, set this to `true` to tell YUI that it shouldn't wait for `window.onload` |
|
1594 to occur. |
|
1595 |
|
1596 This ensures that components that rely on `window.onload` and the `domready` |
|
1597 custom event will work as expected even when YUI is dynamically injected. |
|
1598 |
|
1599 @property {Boolean} injected |
|
1600 @default false |
|
1601 **/ |
|
1602 |
|
1603 /** |
|
1604 If `true`, `Y.error()` will generate or re-throw a JavaScript error. Otherwise, |
|
1605 errors are merely logged silently. |
|
1606 |
|
1607 @property {Boolean} throwFail |
|
1608 @default true |
|
1609 **/ |
|
1610 |
|
1611 /** |
|
1612 Reference to the global object for this execution context. |
|
1613 |
|
1614 In a browser, this is the current `window` object. In Node.js, this is the |
|
1615 Node.js `global` object. |
|
1616 |
|
1617 @property {Object} global |
|
1618 **/ |
|
1619 |
|
1620 /** |
|
1621 The browser window or frame that this YUI instance should operate in. |
|
1622 |
|
1623 When running in Node.js, this property is `undefined`, since there is no |
|
1624 `window` object. Use `global` to get a reference to the global object that will |
|
1625 work in both browsers and Node.js. |
|
1626 |
|
1627 @property {Window} win |
|
1628 **/ |
|
1629 |
|
1630 /** |
|
1631 The browser `document` object associated with this YUI instance's `win` object. |
|
1632 |
|
1633 When running in Node.js, this property is `undefined`, since there is no |
|
1634 `document` object. |
|
1635 |
|
1636 @property {Document} doc |
|
1637 **/ |
|
1638 |
|
1639 /** |
|
1640 A list of modules that defines the YUI core (overrides the default list). |
|
1641 |
|
1642 @property {Array} core |
|
1643 @type Array |
|
1644 @default ['get', 'features', 'intl-base', 'yui-log', 'yui-later', 'loader-base', 'loader-rollup', 'loader-yui3'] |
|
1645 **/ |
|
1646 |
|
1647 /** |
|
1648 A list of languages to use in order of preference. |
|
1649 |
|
1650 This list is matched against the list of available languages in modules that the |
|
1651 YUI instance uses to determine the best possible localization of language |
|
1652 sensitive modules. |
|
1653 |
|
1654 Languages are represented using BCP 47 language tags, such as "en-GB" for |
|
1655 English as used in the United Kingdom, or "zh-Hans-CN" for simplified Chinese as |
|
1656 used in China. The list may be provided as a comma-separated string or as an |
|
1657 array. |
|
1658 |
|
1659 @property {String|String[]} lang |
|
1660 **/ |
|
1661 |
|
1662 /** |
|
1663 Default date format. |
|
1664 |
|
1665 @property {String} dateFormat |
|
1666 @deprecated Use configuration in `DataType.Date.format()` instead. |
|
1667 **/ |
|
1668 |
|
1669 /** |
|
1670 Default locale. |
|
1671 |
|
1672 @property {String} locale |
|
1673 @deprecated Use `config.lang` instead. |
|
1674 **/ |
|
1675 |
|
1676 /** |
|
1677 Default generic polling interval in milliseconds. |
|
1678 |
|
1679 @property {Number} pollInterval |
|
1680 @default 20 |
|
1681 **/ |
|
1682 |
|
1683 /** |
|
1684 The number of dynamic `<script>` nodes to insert by default before automatically |
|
1685 removing them when loading scripts. |
|
1686 |
|
1687 This applies only to script nodes because removing the node will not make the |
|
1688 evaluated script unavailable. Dynamic CSS nodes are not auto purged, because |
|
1689 removing a linked style sheet will also remove the style definitions. |
|
1690 |
|
1691 @property {Number} purgethreshold |
|
1692 @default 20 |
|
1693 **/ |
|
1694 |
|
1695 /** |
|
1696 Delay in milliseconds to wait after a window `resize` event before firing the |
|
1697 event. If another `resize` event occurs before this delay has elapsed, the |
|
1698 delay will start over to ensure that `resize` events are throttled. |
|
1699 |
|
1700 @property {Number} windowResizeDelay |
|
1701 @default 40 |
|
1702 **/ |
|
1703 |
|
1704 /** |
|
1705 Base directory for dynamic loading. |
|
1706 |
|
1707 @property {String} base |
|
1708 **/ |
|
1709 |
|
1710 /** |
|
1711 Base URL for a dynamic combo handler. This will be used to make combo-handled |
|
1712 module requests if `combine` is set to `true. |
|
1713 |
|
1714 @property {String} comboBase |
|
1715 @default "http://yui.yahooapis.com/combo?" |
|
1716 **/ |
|
1717 |
|
1718 /** |
|
1719 Root path to prepend to each module path when creating a combo-handled request. |
|
1720 |
|
1721 This is updated for each YUI release to point to a specific version of the |
|
1722 library; for example: "3.8.0/build/". |
|
1723 |
|
1724 @property {String} root |
|
1725 **/ |
|
1726 |
|
1727 /** |
|
1728 Filter to apply to module urls. This filter will modify the default path for all |
|
1729 modules. |
|
1730 |
|
1731 The default path for the YUI library is the minified version of the files (e.g., |
|
1732 event-min.js). The filter property can be a predefined filter or a custom |
|
1733 filter. The valid predefined filters are: |
|
1734 |
|
1735 - **debug**: Loads debug versions of modules (e.g., event-debug.js). |
|
1736 - **raw**: Loads raw, non-minified versions of modules without debug logging |
|
1737 (e.g., event.js). |
|
1738 |
|
1739 You can also define a custom filter, which must be an object literal containing |
|
1740 a search regular expression and a replacement string: |
|
1741 |
|
1742 myFilter: { |
|
1743 searchExp : "-min\\.js", |
|
1744 replaceStr: "-debug.js" |
|
1745 } |
|
1746 |
|
1747 @property {Object|String} filter |
|
1748 **/ |
|
1749 |
|
1750 /** |
|
1751 Skin configuration and customizations. |
|
1752 |
|
1753 @property {Object} skin |
|
1754 @param {String} [skin.defaultSkin='sam'] Default skin name. This skin will be |
|
1755 applied automatically to skinnable components if not overridden by a |
|
1756 component-specific skin name. |
|
1757 @param {String} [skin.base='assets/skins/'] Default base path for a skin, |
|
1758 relative to Loader's `base` path. |
|
1759 @param {Object} [skin.overrides] Component-specific skin name overrides. Specify |
|
1760 a component name as the key and, as the value, a string or array of strings |
|
1761 for a skin or skins that should be loaded for that component instead of the |
|
1762 `defaultSkin`. |
|
1763 **/ |
|
1764 |
|
1765 /** |
|
1766 Hash of per-component filter specifications. If specified for a given component, |
|
1767 this overrides the global `filter` config. |
|
1768 |
|
1769 @property {Object} filters |
|
1770 **/ |
|
1771 |
|
1772 /** |
|
1773 If `true`, YUI will use a combo handler to load multiple modules in as few |
|
1774 requests as possible. |
|
1775 |
|
1776 The YUI CDN (which YUI uses by default) supports combo handling, but other |
|
1777 servers may not. If the server from which you're loading YUI does not support |
|
1778 combo handling, set this to `false`. |
|
1779 |
|
1780 Providing a value for the `base` config property will cause `combine` to default |
|
1781 to `false` instead of `true`. |
|
1782 |
|
1783 @property {Boolean} combine |
|
1784 @default true |
|
1785 */ |
|
1786 |
|
1787 /** |
|
1788 Array of module names that should never be dynamically loaded. |
|
1789 |
|
1790 @property {String[]} ignore |
|
1791 **/ |
|
1792 |
|
1793 /** |
|
1794 Array of module names that should always be loaded when required, even if |
|
1795 already present on the page. |
|
1796 |
|
1797 @property {String[]} force |
|
1798 **/ |
|
1799 |
|
1800 /** |
|
1801 DOM element or id that should be used as the insertion point for dynamically |
|
1802 added `<script>` and `<link>` nodes. |
|
1803 |
|
1804 @property {HTMLElement|String} insertBefore |
|
1805 **/ |
|
1806 |
|
1807 /** |
|
1808 Object hash containing attributes to add to dynamically added `<script>` nodes. |
|
1809 |
|
1810 @property {Object} jsAttributes |
|
1811 **/ |
|
1812 |
|
1813 /** |
|
1814 Object hash containing attributes to add to dynamically added `<link>` nodes. |
|
1815 |
|
1816 @property {Object} cssAttributes |
|
1817 **/ |
|
1818 |
|
1819 /** |
|
1820 Timeout in milliseconds before a dynamic JS or CSS request will be considered a |
|
1821 failure. If not set, no timeout will be enforced. |
|
1822 |
|
1823 @property {Number} timeout |
|
1824 **/ |
|
1825 |
|
1826 /** |
|
1827 Callback for the 'CSSComplete' event. When dynamically loading YUI components |
|
1828 with CSS, this property fires when the CSS is finished loading. |
|
1829 |
|
1830 This provides an opportunity to enhance the presentation of a loading page a |
|
1831 little bit before the entire loading process is done. |
|
1832 |
|
1833 @property {Function} onCSS |
|
1834 **/ |
|
1835 |
|
1836 /** |
|
1837 A hash of module definitions to add to the list of available YUI modules. These |
|
1838 modules can then be dynamically loaded via the `use()` method. |
|
1839 |
|
1840 This is a hash in which keys are module names and values are objects containing |
|
1841 module metadata. |
|
1842 |
|
1843 See `Loader.addModule()` for the supported module metadata fields. Also see |
|
1844 `groups`, which provides a way to configure the base and combo spec for a set of |
|
1845 modules. |
|
1846 |
|
1847 @example |
|
1848 |
|
1849 modules: { |
|
1850 mymod1: { |
|
1851 requires: ['node'], |
|
1852 fullpath: '/mymod1/mymod1.js' |
|
1853 }, |
|
1854 |
|
1855 mymod2: { |
|
1856 requires: ['mymod1'], |
|
1857 fullpath: '/mymod2/mymod2.js' |
|
1858 }, |
|
1859 |
|
1860 mymod3: '/js/mymod3.js', |
|
1861 mycssmod: '/css/mycssmod.css' |
|
1862 } |
|
1863 |
|
1864 @property {Object} modules |
|
1865 **/ |
|
1866 |
|
1867 /** |
|
1868 Aliases are dynamic groups of modules that can be used as shortcuts. |
|
1869 |
|
1870 @example |
|
1871 |
|
1872 YUI({ |
|
1873 aliases: { |
|
1874 davglass: [ 'node', 'yql', 'dd' ], |
|
1875 mine: [ 'davglass', 'autocomplete'] |
|
1876 } |
|
1877 }).use('mine', function (Y) { |
|
1878 // Node, YQL, DD & AutoComplete available here. |
|
1879 }); |
|
1880 |
|
1881 @property {Object} aliases |
|
1882 **/ |
|
1883 |
|
1884 /** |
|
1885 A hash of module group definitions. |
|
1886 |
|
1887 For each group you can specify a list of modules and the base path and |
|
1888 combo spec to use when dynamically loading the modules. |
|
1889 |
|
1890 @example |
|
1891 |
|
1892 groups: { |
|
1893 yui2: { |
|
1894 // specify whether or not this group has a combo service |
|
1895 combine: true, |
|
1896 |
|
1897 // The comboSeperator to use with this group's combo handler |
|
1898 comboSep: ';', |
|
1899 |
|
1900 // The maxURLLength for this server |
|
1901 maxURLLength: 500, |
|
1902 |
|
1903 // the base path for non-combo paths |
|
1904 base: 'http://yui.yahooapis.com/2.8.0r4/build/', |
|
1905 |
|
1906 // the path to the combo service |
|
1907 comboBase: 'http://yui.yahooapis.com/combo?', |
|
1908 |
|
1909 // a fragment to prepend to the path attribute when |
|
1910 // when building combo urls |
|
1911 root: '2.8.0r4/build/', |
|
1912 |
|
1913 // the module definitions |
|
1914 modules: { |
|
1915 yui2_yde: { |
|
1916 path: "yahoo-dom-event/yahoo-dom-event.js" |
|
1917 }, |
|
1918 yui2_anim: { |
|
1919 path: "animation/animation.js", |
|
1920 requires: ['yui2_yde'] |
|
1921 } |
|
1922 } |
|
1923 } |
|
1924 } |
|
1925 |
|
1926 @property {Object} groups |
|
1927 **/ |
|
1928 |
|
1929 /** |
|
1930 Path to the Loader JS file, relative to the `base` path. |
|
1931 |
|
1932 This is used to dynamically bootstrap the Loader when it's needed and isn't yet |
|
1933 available. |
|
1934 |
|
1935 @property {String} loaderPath |
|
1936 @default "loader/loader-min.js" |
|
1937 **/ |
|
1938 |
|
1939 /** |
|
1940 If `true`, YUI will attempt to load CSS dependencies and skins. Set this to |
|
1941 `false` to prevent YUI from loading any CSS, or set it to the string `"force"` |
|
1942 to force CSS dependencies to be loaded even if their associated JS modules are |
|
1943 already loaded. |
|
1944 |
|
1945 @property {Boolean|String} fetchCSS |
|
1946 @default true |
|
1947 **/ |
|
1948 |
|
1949 /** |
|
1950 Default gallery version used to build gallery module urls. |
|
1951 |
|
1952 @property {String} gallery |
|
1953 @since 3.1.0 |
|
1954 **/ |
|
1955 |
|
1956 /** |
|
1957 Default YUI 2 version used to build YUI 2 module urls. |
|
1958 |
|
1959 This is used for intrinsic YUI 2 support via the 2in3 project. Also see the |
|
1960 `2in3` config for pulling different revisions of the wrapped YUI 2 modules. |
|
1961 |
|
1962 @property {String} yui2 |
|
1963 @default "2.9.0" |
|
1964 @since 3.1.0 |
|
1965 **/ |
|
1966 |
|
1967 /** |
|
1968 Revision number of YUI 2in3 modules that should be used when loading YUI 2in3. |
|
1969 |
|
1970 @property {String} 2in3 |
|
1971 @default "4" |
|
1972 @since 3.1.0 |
|
1973 **/ |
|
1974 |
|
1975 /** |
|
1976 Alternate console log function that should be used in environments without a |
|
1977 supported native console. This function is executed with the YUI instance as its |
|
1978 `this` object. |
|
1979 |
|
1980 @property {Function} logFn |
|
1981 @since 3.1.0 |
|
1982 **/ |
|
1983 |
|
1984 /** |
|
1985 The minimum log level to log messages for. Log levels are defined |
|
1986 incrementally. Messages greater than or equal to the level specified will |
|
1987 be shown. All others will be discarded. The order of log levels in |
|
1988 increasing priority is: |
|
1989 |
|
1990 debug |
|
1991 info |
|
1992 warn |
|
1993 error |
|
1994 |
|
1995 @property {String} logLevel |
|
1996 @default 'debug' |
|
1997 @since 3.10.0 |
|
1998 **/ |
|
1999 |
|
2000 /** |
|
2001 Callback to execute when `Y.error()` is called. It receives the error message |
|
2002 and a JavaScript error object if one was provided. |
|
2003 |
|
2004 This function is executed with the YUI instance as its `this` object. |
|
2005 |
|
2006 Returning `true` from this function will prevent an exception from being thrown. |
|
2007 |
|
2008 @property {Function} errorFn |
|
2009 @param {String} errorFn.msg Error message |
|
2010 @param {Object} [errorFn.err] Error object (if one was provided). |
|
2011 @since 3.2.0 |
|
2012 **/ |
|
2013 |
|
2014 /** |
|
2015 A callback to execute when Loader fails to load one or more resources. |
|
2016 |
|
2017 This could be because of a script load failure. It could also be because a |
|
2018 module fails to register itself when the `requireRegistration` config is `true`. |
|
2019 |
|
2020 If this function is defined, the `use()` callback will only be called when the |
|
2021 loader succeeds. Otherwise, `use()` will always executes unless there was a |
|
2022 JavaScript error when attaching a module. |
|
2023 |
|
2024 @property {Function} loadErrorFn |
|
2025 @since 3.3.0 |
|
2026 **/ |
|
2027 |
|
2028 /** |
|
2029 If `true`, Loader will expect all loaded scripts to be first-class YUI modules |
|
2030 that register themselves with the YUI global, and will trigger a failure if a |
|
2031 loaded script does not register a YUI module. |
|
2032 |
|
2033 @property {Boolean} requireRegistration |
|
2034 @default false |
|
2035 @since 3.3.0 |
|
2036 **/ |
|
2037 |
|
2038 /** |
|
2039 Cache serviced use() requests. |
|
2040 |
|
2041 @property {Boolean} cacheUse |
|
2042 @default true |
|
2043 @since 3.3.0 |
|
2044 @deprecated No longer used. |
|
2045 **/ |
|
2046 |
|
2047 /** |
|
2048 Whether or not YUI should use native ES5 functionality when available for |
|
2049 features like `Y.Array.each()`, `Y.Object()`, etc. |
|
2050 |
|
2051 When `false`, YUI will always use its own fallback implementations instead of |
|
2052 relying on ES5 functionality, even when ES5 functionality is available. |
|
2053 |
|
2054 @property {Boolean} useNativeES5 |
|
2055 @default true |
|
2056 @since 3.5.0 |
|
2057 **/ |
|
2058 |
|
2059 /** |
|
2060 * Leverage native JSON stringify if the browser has a native |
|
2061 * implementation. In general, this is a good idea. See the Known Issues |
|
2062 * section in the JSON user guide for caveats. The default value is true |
|
2063 * for browsers with native JSON support. |
|
2064 * |
|
2065 * @property useNativeJSONStringify |
|
2066 * @type Boolean |
|
2067 * @default true |
|
2068 * @since 3.8.0 |
|
2069 */ |
|
2070 |
|
2071 /** |
|
2072 * Leverage native JSON parse if the browser has a native implementation. |
|
2073 * In general, this is a good idea. See the Known Issues section in the |
|
2074 * JSON user guide for caveats. The default value is true for browsers with |
|
2075 * native JSON support. |
|
2076 * |
|
2077 * @property useNativeJSONParse |
|
2078 * @type Boolean |
|
2079 * @default true |
|
2080 * @since 3.8.0 |
|
2081 */ |
|
2082 |
|
2083 /** |
|
2084 Delay the `use` callback until a specific event has passed (`load`, `domready`, `contentready` or `available`) |
|
2085 |
|
2086 @property {Object|String} delayUntil |
|
2087 @since 3.6.0 |
|
2088 @example |
|
2089 |
|
2090 You can use `load` or `domready` strings by default: |
|
2091 |
|
2092 YUI({ |
|
2093 delayUntil: 'domready' |
|
2094 }, function (Y) { |
|
2095 // This will not execute until 'domeready' occurs. |
|
2096 }); |
|
2097 |
|
2098 Or you can delay until a node is available (with `available` or `contentready`): |
|
2099 |
|
2100 YUI({ |
|
2101 delayUntil: { |
|
2102 event: 'available', |
|
2103 args : '#foo' |
|
2104 } |
|
2105 }, function (Y) { |
|
2106 // This will not execute until a node matching the selector "#foo" is |
|
2107 // available in the DOM. |
|
2108 }); |
|
2109 |
|
2110 **/ |
|
2111 YUI.add('yui-base', function (Y, NAME) { |
|
2112 |
|
2113 /* |
|
2114 * YUI stub |
|
2115 * @module yui |
|
2116 * @submodule yui-base |
|
2117 */ |
|
2118 /** |
|
2119 * The YUI module contains the components required for building the YUI |
|
2120 * seed file. This includes the script loading mechanism, a simple queue, |
|
2121 * and the core utilities for the library. |
|
2122 * @module yui |
|
2123 * @submodule yui-base |
|
2124 */ |
|
2125 |
|
2126 /** |
|
2127 * Provides core language utilites and extensions used throughout YUI. |
|
2128 * |
|
2129 * @class Lang |
|
2130 * @static |
|
2131 */ |
|
2132 |
|
2133 var L = Y.Lang || (Y.Lang = {}), |
|
2134 |
|
2135 STRING_PROTO = String.prototype, |
|
2136 TOSTRING = Object.prototype.toString, |
|
2137 |
|
2138 TYPES = { |
|
2139 'undefined' : 'undefined', |
|
2140 'number' : 'number', |
|
2141 'boolean' : 'boolean', |
|
2142 'string' : 'string', |
|
2143 '[object Function]': 'function', |
|
2144 '[object RegExp]' : 'regexp', |
|
2145 '[object Array]' : 'array', |
|
2146 '[object Date]' : 'date', |
|
2147 '[object Error]' : 'error' |
|
2148 }, |
|
2149 |
|
2150 SUBREGEX = /\{\s*([^|}]+?)\s*(?:\|([^}]*))?\s*\}/g, |
|
2151 TRIMREGEX = /^\s+|\s+$/g, |
|
2152 NATIVE_FN_REGEX = /\{\s*\[(?:native code|function)\]\s*\}/i; |
|
2153 |
|
2154 // -- Protected Methods -------------------------------------------------------- |
|
2155 |
|
2156 /** |
|
2157 Returns `true` if the given function appears to be implemented in native code, |
|
2158 `false` otherwise. Will always return `false` -- even in ES5-capable browsers -- |
|
2159 if the `useNativeES5` YUI config option is set to `false`. |
|
2160 |
|
2161 This isn't guaranteed to be 100% accurate and won't work for anything other than |
|
2162 functions, but it can be useful for determining whether a function like |
|
2163 `Array.prototype.forEach` is native or a JS shim provided by another library. |
|
2164 |
|
2165 There's a great article by @kangax discussing certain flaws with this technique: |
|
2166 <http://perfectionkills.com/detecting-built-in-host-methods/> |
|
2167 |
|
2168 While his points are valid, it's still possible to benefit from this function |
|
2169 as long as it's used carefully and sparingly, and in such a way that false |
|
2170 negatives have minimal consequences. It's used internally to avoid using |
|
2171 potentially broken non-native ES5 shims that have been added to the page by |
|
2172 other libraries. |
|
2173 |
|
2174 @method _isNative |
|
2175 @param {Function} fn Function to test. |
|
2176 @return {Boolean} `true` if _fn_ appears to be native, `false` otherwise. |
|
2177 @static |
|
2178 @protected |
|
2179 @since 3.5.0 |
|
2180 **/ |
|
2181 L._isNative = function (fn) { |
|
2182 return !!(Y.config.useNativeES5 && fn && NATIVE_FN_REGEX.test(fn)); |
|
2183 }; |
|
2184 |
|
2185 // -- Public Methods ----------------------------------------------------------- |
|
2186 |
|
2187 /** |
|
2188 * Determines whether or not the provided item is an array. |
|
2189 * |
|
2190 * Returns `false` for array-like collections such as the function `arguments` |
|
2191 * collection or `HTMLElement` collections. Use `Y.Array.test()` if you want to |
|
2192 * test for an array-like collection. |
|
2193 * |
|
2194 * @method isArray |
|
2195 * @param o The object to test. |
|
2196 * @return {boolean} true if o is an array. |
|
2197 * @static |
|
2198 */ |
|
2199 L.isArray = L._isNative(Array.isArray) ? Array.isArray : function (o) { |
|
2200 return L.type(o) === 'array'; |
|
2201 }; |
|
2202 |
|
2203 /** |
|
2204 * Determines whether or not the provided item is a boolean. |
|
2205 * @method isBoolean |
|
2206 * @static |
|
2207 * @param o The object to test. |
|
2208 * @return {boolean} true if o is a boolean. |
|
2209 */ |
|
2210 L.isBoolean = function(o) { |
|
2211 return typeof o === 'boolean'; |
|
2212 }; |
|
2213 |
|
2214 /** |
|
2215 * Determines whether or not the supplied item is a date instance. |
|
2216 * @method isDate |
|
2217 * @static |
|
2218 * @param o The object to test. |
|
2219 * @return {boolean} true if o is a date. |
|
2220 */ |
|
2221 L.isDate = function(o) { |
|
2222 return L.type(o) === 'date' && o.toString() !== 'Invalid Date' && !isNaN(o); |
|
2223 }; |
|
2224 |
|
2225 /** |
|
2226 * <p> |
|
2227 * Determines whether or not the provided item is a function. |
|
2228 * Note: Internet Explorer thinks certain functions are objects: |
|
2229 * </p> |
|
2230 * |
|
2231 * <pre> |
|
2232 * var obj = document.createElement("object"); |
|
2233 * Y.Lang.isFunction(obj.getAttribute) // reports false in IE |
|
2234 * |
|
2235 * var input = document.createElement("input"); // append to body |
|
2236 * Y.Lang.isFunction(input.focus) // reports false in IE |
|
2237 * </pre> |
|
2238 * |
|
2239 * <p> |
|
2240 * You will have to implement additional tests if these functions |
|
2241 * matter to you. |
|
2242 * </p> |
|
2243 * |
|
2244 * @method isFunction |
|
2245 * @static |
|
2246 * @param o The object to test. |
|
2247 * @return {boolean} true if o is a function. |
|
2248 */ |
|
2249 L.isFunction = function(o) { |
|
2250 return L.type(o) === 'function'; |
|
2251 }; |
|
2252 |
|
2253 /** |
|
2254 * Determines whether or not the provided item is null. |
|
2255 * @method isNull |
|
2256 * @static |
|
2257 * @param o The object to test. |
|
2258 * @return {boolean} true if o is null. |
|
2259 */ |
|
2260 L.isNull = function(o) { |
|
2261 return o === null; |
|
2262 }; |
|
2263 |
|
2264 /** |
|
2265 * Determines whether or not the provided item is a legal number. |
|
2266 * @method isNumber |
|
2267 * @static |
|
2268 * @param o The object to test. |
|
2269 * @return {boolean} true if o is a number. |
|
2270 */ |
|
2271 L.isNumber = function(o) { |
|
2272 return typeof o === 'number' && isFinite(o); |
|
2273 }; |
|
2274 |
|
2275 /** |
|
2276 * Determines whether or not the provided item is of type object |
|
2277 * or function. Note that arrays are also objects, so |
|
2278 * <code>Y.Lang.isObject([]) === true</code>. |
|
2279 * @method isObject |
|
2280 * @static |
|
2281 * @param o The object to test. |
|
2282 * @param failfn {boolean} fail if the input is a function. |
|
2283 * @return {boolean} true if o is an object. |
|
2284 * @see isPlainObject |
|
2285 */ |
|
2286 L.isObject = function(o, failfn) { |
|
2287 var t = typeof o; |
|
2288 return (o && (t === 'object' || |
|
2289 (!failfn && (t === 'function' || L.isFunction(o))))) || false; |
|
2290 }; |
|
2291 |
|
2292 /** |
|
2293 * Determines whether or not the provided item is a string. |
|
2294 * @method isString |
|
2295 * @static |
|
2296 * @param o The object to test. |
|
2297 * @return {boolean} true if o is a string. |
|
2298 */ |
|
2299 L.isString = function(o) { |
|
2300 return typeof o === 'string'; |
|
2301 }; |
|
2302 |
|
2303 /** |
|
2304 * Determines whether or not the provided item is undefined. |
|
2305 * @method isUndefined |
|
2306 * @static |
|
2307 * @param o The object to test. |
|
2308 * @return {boolean} true if o is undefined. |
|
2309 */ |
|
2310 L.isUndefined = function(o) { |
|
2311 return typeof o === 'undefined'; |
|
2312 }; |
|
2313 |
|
2314 /** |
|
2315 * A convenience method for detecting a legitimate non-null value. |
|
2316 * Returns false for null/undefined/NaN, true for other values, |
|
2317 * including 0/false/'' |
|
2318 * @method isValue |
|
2319 * @static |
|
2320 * @param o The item to test. |
|
2321 * @return {boolean} true if it is not null/undefined/NaN || false. |
|
2322 */ |
|
2323 L.isValue = function(o) { |
|
2324 var t = L.type(o); |
|
2325 |
|
2326 switch (t) { |
|
2327 case 'number': |
|
2328 return isFinite(o); |
|
2329 |
|
2330 case 'null': // fallthru |
|
2331 case 'undefined': |
|
2332 return false; |
|
2333 |
|
2334 default: |
|
2335 return !!t; |
|
2336 } |
|
2337 }; |
|
2338 |
|
2339 /** |
|
2340 * Returns the current time in milliseconds. |
|
2341 * |
|
2342 * @method now |
|
2343 * @return {Number} Current time in milliseconds. |
|
2344 * @static |
|
2345 * @since 3.3.0 |
|
2346 */ |
|
2347 L.now = Date.now || function () { |
|
2348 return new Date().getTime(); |
|
2349 }; |
|
2350 |
|
2351 /** |
|
2352 * Lightweight version of <code>Y.substitute</code>. Uses the same template |
|
2353 * structure as <code>Y.substitute</code>, but doesn't support recursion, |
|
2354 * auto-object coersion, or formats. |
|
2355 * @method sub |
|
2356 * @param {string} s String to be modified. |
|
2357 * @param {object} o Object containing replacement values. |
|
2358 * @return {string} the substitute result. |
|
2359 * @static |
|
2360 * @since 3.2.0 |
|
2361 */ |
|
2362 L.sub = function(s, o) { |
|
2363 return s.replace ? s.replace(SUBREGEX, function (match, key) { |
|
2364 return L.isUndefined(o[key]) ? match : o[key]; |
|
2365 }) : s; |
|
2366 }; |
|
2367 |
|
2368 /** |
|
2369 * Returns a string without any leading or trailing whitespace. If |
|
2370 * the input is not a string, the input will be returned untouched. |
|
2371 * @method trim |
|
2372 * @static |
|
2373 * @param s {string} the string to trim. |
|
2374 * @return {string} the trimmed string. |
|
2375 */ |
|
2376 L.trim = STRING_PROTO.trim ? function(s) { |
|
2377 return s && s.trim ? s.trim() : s; |
|
2378 } : function (s) { |
|
2379 try { |
|
2380 return s.replace(TRIMREGEX, ''); |
|
2381 } catch (e) { |
|
2382 return s; |
|
2383 } |
|
2384 }; |
|
2385 |
|
2386 /** |
|
2387 * Returns a string without any leading whitespace. |
|
2388 * @method trimLeft |
|
2389 * @static |
|
2390 * @param s {string} the string to trim. |
|
2391 * @return {string} the trimmed string. |
|
2392 */ |
|
2393 L.trimLeft = STRING_PROTO.trimLeft ? function (s) { |
|
2394 return s.trimLeft(); |
|
2395 } : function (s) { |
|
2396 return s.replace(/^\s+/, ''); |
|
2397 }; |
|
2398 |
|
2399 /** |
|
2400 * Returns a string without any trailing whitespace. |
|
2401 * @method trimRight |
|
2402 * @static |
|
2403 * @param s {string} the string to trim. |
|
2404 * @return {string} the trimmed string. |
|
2405 */ |
|
2406 L.trimRight = STRING_PROTO.trimRight ? function (s) { |
|
2407 return s.trimRight(); |
|
2408 } : function (s) { |
|
2409 return s.replace(/\s+$/, ''); |
|
2410 }; |
|
2411 |
|
2412 /** |
|
2413 Returns one of the following strings, representing the type of the item passed |
|
2414 in: |
|
2415 |
|
2416 * "array" |
|
2417 * "boolean" |
|
2418 * "date" |
|
2419 * "error" |
|
2420 * "function" |
|
2421 * "null" |
|
2422 * "number" |
|
2423 * "object" |
|
2424 * "regexp" |
|
2425 * "string" |
|
2426 * "undefined" |
|
2427 |
|
2428 Known issues: |
|
2429 |
|
2430 * `typeof HTMLElementCollection` returns function in Safari, but |
|
2431 `Y.Lang.type()` reports "object", which could be a good thing -- |
|
2432 but it actually caused the logic in <code>Y.Lang.isObject</code> to fail. |
|
2433 |
|
2434 @method type |
|
2435 @param o the item to test. |
|
2436 @return {string} the detected type. |
|
2437 @static |
|
2438 **/ |
|
2439 L.type = function(o) { |
|
2440 return TYPES[typeof o] || TYPES[TOSTRING.call(o)] || (o ? 'object' : 'null'); |
|
2441 }; |
|
2442 /** |
|
2443 @module yui |
|
2444 @submodule yui-base |
|
2445 */ |
|
2446 |
|
2447 var Lang = Y.Lang, |
|
2448 Native = Array.prototype, |
|
2449 |
|
2450 hasOwn = Object.prototype.hasOwnProperty; |
|
2451 |
|
2452 /** |
|
2453 Provides utility methods for working with arrays. Additional array helpers can |
|
2454 be found in the `collection` and `array-extras` modules. |
|
2455 |
|
2456 `Y.Array(thing)` returns a native array created from _thing_. Depending on |
|
2457 _thing_'s type, one of the following will happen: |
|
2458 |
|
2459 * Arrays are returned unmodified unless a non-zero _startIndex_ is |
|
2460 specified. |
|
2461 * Array-like collections (see `Array.test()`) are converted to arrays. |
|
2462 * For everything else, a new array is created with _thing_ as the sole |
|
2463 item. |
|
2464 |
|
2465 Note: elements that are also collections, such as `<form>` and `<select>` |
|
2466 elements, are not automatically converted to arrays. To force a conversion, |
|
2467 pass `true` as the value of the _force_ parameter. |
|
2468 |
|
2469 @class Array |
|
2470 @constructor |
|
2471 @param {Any} thing The thing to arrayify. |
|
2472 @param {Number} [startIndex=0] If non-zero and _thing_ is an array or array-like |
|
2473 collection, a subset of items starting at the specified index will be |
|
2474 returned. |
|
2475 @param {Boolean} [force=false] If `true`, _thing_ will be treated as an |
|
2476 array-like collection no matter what. |
|
2477 @return {Array} A native array created from _thing_, according to the rules |
|
2478 described above. |
|
2479 **/ |
|
2480 function YArray(thing, startIndex, force) { |
|
2481 var len, result; |
|
2482 |
|
2483 /*jshint expr: true*/ |
|
2484 startIndex || (startIndex = 0); |
|
2485 |
|
2486 if (force || YArray.test(thing)) { |
|
2487 // IE throws when trying to slice HTMLElement collections. |
|
2488 try { |
|
2489 return Native.slice.call(thing, startIndex); |
|
2490 } catch (ex) { |
|
2491 result = []; |
|
2492 |
|
2493 for (len = thing.length; startIndex < len; ++startIndex) { |
|
2494 result.push(thing[startIndex]); |
|
2495 } |
|
2496 |
|
2497 return result; |
|
2498 } |
|
2499 } |
|
2500 |
|
2501 return [thing]; |
|
2502 } |
|
2503 |
|
2504 Y.Array = YArray; |
|
2505 |
|
2506 /** |
|
2507 Dedupes an array of strings, returning an array that's guaranteed to contain |
|
2508 only one copy of a given string. |
|
2509 |
|
2510 This method differs from `Array.unique()` in that it's optimized for use only |
|
2511 with strings, whereas `unique` may be used with other types (but is slower). |
|
2512 Using `dedupe()` with non-string values may result in unexpected behavior. |
|
2513 |
|
2514 @method dedupe |
|
2515 @param {String[]} array Array of strings to dedupe. |
|
2516 @return {Array} Deduped copy of _array_. |
|
2517 @static |
|
2518 @since 3.4.0 |
|
2519 **/ |
|
2520 YArray.dedupe = function (array) { |
|
2521 var hash = {}, |
|
2522 results = [], |
|
2523 i, item, len; |
|
2524 |
|
2525 for (i = 0, len = array.length; i < len; ++i) { |
|
2526 item = array[i]; |
|
2527 |
|
2528 if (!hasOwn.call(hash, item)) { |
|
2529 hash[item] = 1; |
|
2530 results.push(item); |
|
2531 } |
|
2532 } |
|
2533 |
|
2534 return results; |
|
2535 }; |
|
2536 |
|
2537 /** |
|
2538 Executes the supplied function on each item in the array. This method wraps |
|
2539 the native ES5 `Array.forEach()` method if available. |
|
2540 |
|
2541 @method each |
|
2542 @param {Array} array Array to iterate. |
|
2543 @param {Function} fn Function to execute on each item in the array. The function |
|
2544 will receive the following arguments: |
|
2545 @param {Any} fn.item Current array item. |
|
2546 @param {Number} fn.index Current array index. |
|
2547 @param {Array} fn.array Array being iterated. |
|
2548 @param {Object} [thisObj] `this` object to use when calling _fn_. |
|
2549 @return {YUI} The YUI instance. |
|
2550 @static |
|
2551 **/ |
|
2552 YArray.each = YArray.forEach = Lang._isNative(Native.forEach) ? function (array, fn, thisObj) { |
|
2553 Native.forEach.call(array || [], fn, thisObj || Y); |
|
2554 return Y; |
|
2555 } : function (array, fn, thisObj) { |
|
2556 for (var i = 0, len = (array && array.length) || 0; i < len; ++i) { |
|
2557 if (i in array) { |
|
2558 fn.call(thisObj || Y, array[i], i, array); |
|
2559 } |
|
2560 } |
|
2561 |
|
2562 return Y; |
|
2563 }; |
|
2564 |
|
2565 /** |
|
2566 Alias for `each()`. |
|
2567 |
|
2568 @method forEach |
|
2569 @static |
|
2570 **/ |
|
2571 |
|
2572 /** |
|
2573 Returns an object using the first array as keys and the second as values. If |
|
2574 the second array is not provided, or if it doesn't contain the same number of |
|
2575 values as the first array, then `true` will be used in place of the missing |
|
2576 values. |
|
2577 |
|
2578 @example |
|
2579 |
|
2580 Y.Array.hash(['a', 'b', 'c'], ['foo', 'bar']); |
|
2581 // => {a: 'foo', b: 'bar', c: true} |
|
2582 |
|
2583 @method hash |
|
2584 @param {String[]} keys Array of strings to use as keys. |
|
2585 @param {Array} [values] Array to use as values. |
|
2586 @return {Object} Hash using the first array as keys and the second as values. |
|
2587 @static |
|
2588 **/ |
|
2589 YArray.hash = function (keys, values) { |
|
2590 var hash = {}, |
|
2591 vlen = (values && values.length) || 0, |
|
2592 i, len; |
|
2593 |
|
2594 for (i = 0, len = keys.length; i < len; ++i) { |
|
2595 if (i in keys) { |
|
2596 hash[keys[i]] = vlen > i && i in values ? values[i] : true; |
|
2597 } |
|
2598 } |
|
2599 |
|
2600 return hash; |
|
2601 }; |
|
2602 |
|
2603 /** |
|
2604 Returns the index of the first item in the array that's equal (using a strict |
|
2605 equality check) to the specified _value_, or `-1` if the value isn't found. |
|
2606 |
|
2607 This method wraps the native ES5 `Array.indexOf()` method if available. |
|
2608 |
|
2609 @method indexOf |
|
2610 @param {Array} array Array to search. |
|
2611 @param {Any} value Value to search for. |
|
2612 @param {Number} [from=0] The index at which to begin the search. |
|
2613 @return {Number} Index of the item strictly equal to _value_, or `-1` if not |
|
2614 found. |
|
2615 @static |
|
2616 **/ |
|
2617 YArray.indexOf = Lang._isNative(Native.indexOf) ? function (array, value, from) { |
|
2618 return Native.indexOf.call(array, value, from); |
|
2619 } : function (array, value, from) { |
|
2620 // http://es5.github.com/#x15.4.4.14 |
|
2621 var len = array.length; |
|
2622 |
|
2623 from = +from || 0; |
|
2624 from = (from > 0 || -1) * Math.floor(Math.abs(from)); |
|
2625 |
|
2626 if (from < 0) { |
|
2627 from += len; |
|
2628 |
|
2629 if (from < 0) { |
|
2630 from = 0; |
|
2631 } |
|
2632 } |
|
2633 |
|
2634 for (; from < len; ++from) { |
|
2635 if (from in array && array[from] === value) { |
|
2636 return from; |
|
2637 } |
|
2638 } |
|
2639 |
|
2640 return -1; |
|
2641 }; |
|
2642 |
|
2643 /** |
|
2644 Numeric sort convenience function. |
|
2645 |
|
2646 The native `Array.prototype.sort()` function converts values to strings and |
|
2647 sorts them in lexicographic order, which is unsuitable for sorting numeric |
|
2648 values. Provide `Array.numericSort` as a custom sort function when you want |
|
2649 to sort values in numeric order. |
|
2650 |
|
2651 @example |
|
2652 |
|
2653 [42, 23, 8, 16, 4, 15].sort(Y.Array.numericSort); |
|
2654 // => [4, 8, 15, 16, 23, 42] |
|
2655 |
|
2656 @method numericSort |
|
2657 @param {Number} a First value to compare. |
|
2658 @param {Number} b Second value to compare. |
|
2659 @return {Number} Difference between _a_ and _b_. |
|
2660 @static |
|
2661 **/ |
|
2662 YArray.numericSort = function (a, b) { |
|
2663 return a - b; |
|
2664 }; |
|
2665 |
|
2666 /** |
|
2667 Executes the supplied function on each item in the array. Returning a truthy |
|
2668 value from the function will stop the processing of remaining items. |
|
2669 |
|
2670 @method some |
|
2671 @param {Array} array Array to iterate over. |
|
2672 @param {Function} fn Function to execute on each item. The function will receive |
|
2673 the following arguments: |
|
2674 @param {Any} fn.value Current array item. |
|
2675 @param {Number} fn.index Current array index. |
|
2676 @param {Array} fn.array Array being iterated over. |
|
2677 @param {Object} [thisObj] `this` object to use when calling _fn_. |
|
2678 @return {Boolean} `true` if the function returns a truthy value on any of the |
|
2679 items in the array; `false` otherwise. |
|
2680 @static |
|
2681 **/ |
|
2682 YArray.some = Lang._isNative(Native.some) ? function (array, fn, thisObj) { |
|
2683 return Native.some.call(array, fn, thisObj); |
|
2684 } : function (array, fn, thisObj) { |
|
2685 for (var i = 0, len = array.length; i < len; ++i) { |
|
2686 if (i in array && fn.call(thisObj, array[i], i, array)) { |
|
2687 return true; |
|
2688 } |
|
2689 } |
|
2690 |
|
2691 return false; |
|
2692 }; |
|
2693 |
|
2694 /** |
|
2695 Evaluates _obj_ to determine if it's an array, an array-like collection, or |
|
2696 something else. This is useful when working with the function `arguments` |
|
2697 collection and `HTMLElement` collections. |
|
2698 |
|
2699 Note: This implementation doesn't consider elements that are also |
|
2700 collections, such as `<form>` and `<select>`, to be array-like. |
|
2701 |
|
2702 @method test |
|
2703 @param {Object} obj Object to test. |
|
2704 @return {Number} A number indicating the results of the test: |
|
2705 |
|
2706 * 0: Neither an array nor an array-like collection. |
|
2707 * 1: Real array. |
|
2708 * 2: Array-like collection. |
|
2709 |
|
2710 @static |
|
2711 **/ |
|
2712 YArray.test = function (obj) { |
|
2713 var result = 0; |
|
2714 |
|
2715 if (Lang.isArray(obj)) { |
|
2716 result = 1; |
|
2717 } else if (Lang.isObject(obj)) { |
|
2718 try { |
|
2719 // indexed, but no tagName (element) or scrollTo/document (window. From DOM.isWindow test which we can't use here), |
|
2720 // or functions without apply/call (Safari |
|
2721 // HTMLElementCollection bug). |
|
2722 if ('length' in obj && !obj.tagName && !(obj.scrollTo && obj.document) && !obj.apply) { |
|
2723 result = 2; |
|
2724 } |
|
2725 } catch (ex) {} |
|
2726 } |
|
2727 |
|
2728 return result; |
|
2729 }; |
|
2730 /** |
|
2731 * The YUI module contains the components required for building the YUI |
|
2732 * seed file. This includes the script loading mechanism, a simple queue, |
|
2733 * and the core utilities for the library. |
|
2734 * @module yui |
|
2735 * @submodule yui-base |
|
2736 */ |
|
2737 |
|
2738 /** |
|
2739 * A simple FIFO queue. Items are added to the Queue with add(1..n items) and |
|
2740 * removed using next(). |
|
2741 * |
|
2742 * @class Queue |
|
2743 * @constructor |
|
2744 * @param {MIXED} item* 0..n items to seed the queue. |
|
2745 */ |
|
2746 function Queue() { |
|
2747 this._init(); |
|
2748 this.add.apply(this, arguments); |
|
2749 } |
|
2750 |
|
2751 Queue.prototype = { |
|
2752 /** |
|
2753 * Initialize the queue |
|
2754 * |
|
2755 * @method _init |
|
2756 * @protected |
|
2757 */ |
|
2758 _init: function() { |
|
2759 /** |
|
2760 * The collection of enqueued items |
|
2761 * |
|
2762 * @property _q |
|
2763 * @type Array |
|
2764 * @protected |
|
2765 */ |
|
2766 this._q = []; |
|
2767 }, |
|
2768 |
|
2769 /** |
|
2770 * Get the next item in the queue. FIFO support |
|
2771 * |
|
2772 * @method next |
|
2773 * @return {MIXED} the next item in the queue. |
|
2774 */ |
|
2775 next: function() { |
|
2776 return this._q.shift(); |
|
2777 }, |
|
2778 |
|
2779 /** |
|
2780 * Get the last in the queue. LIFO support. |
|
2781 * |
|
2782 * @method last |
|
2783 * @return {MIXED} the last item in the queue. |
|
2784 */ |
|
2785 last: function() { |
|
2786 return this._q.pop(); |
|
2787 }, |
|
2788 |
|
2789 /** |
|
2790 * Add 0..n items to the end of the queue. |
|
2791 * |
|
2792 * @method add |
|
2793 * @param {MIXED} item* 0..n items. |
|
2794 * @return {object} this queue. |
|
2795 */ |
|
2796 add: function() { |
|
2797 this._q.push.apply(this._q, arguments); |
|
2798 |
|
2799 return this; |
|
2800 }, |
|
2801 |
|
2802 /** |
|
2803 * Returns the current number of queued items. |
|
2804 * |
|
2805 * @method size |
|
2806 * @return {Number} The size. |
|
2807 */ |
|
2808 size: function() { |
|
2809 return this._q.length; |
|
2810 } |
|
2811 }; |
|
2812 |
|
2813 Y.Queue = Queue; |
|
2814 |
|
2815 YUI.Env._loaderQueue = YUI.Env._loaderQueue || new Queue(); |
|
2816 |
|
2817 /** |
|
2818 The YUI module contains the components required for building the YUI seed file. |
|
2819 This includes the script loading mechanism, a simple queue, and the core |
|
2820 utilities for the library. |
|
2821 |
|
2822 @module yui |
|
2823 @submodule yui-base |
|
2824 **/ |
|
2825 |
|
2826 var CACHED_DELIMITER = '__', |
|
2827 |
|
2828 hasOwn = Object.prototype.hasOwnProperty, |
|
2829 isObject = Y.Lang.isObject; |
|
2830 |
|
2831 /** |
|
2832 Returns a wrapper for a function which caches the return value of that function, |
|
2833 keyed off of the combined string representation of the argument values provided |
|
2834 when the wrapper is called. |
|
2835 |
|
2836 Calling this function again with the same arguments will return the cached value |
|
2837 rather than executing the wrapped function. |
|
2838 |
|
2839 Note that since the cache is keyed off of the string representation of arguments |
|
2840 passed to the wrapper function, arguments that aren't strings and don't provide |
|
2841 a meaningful `toString()` method may result in unexpected caching behavior. For |
|
2842 example, the objects `{}` and `{foo: 'bar'}` would both be converted to the |
|
2843 string `[object Object]` when used as a cache key. |
|
2844 |
|
2845 @method cached |
|
2846 @param {Function} source The function to memoize. |
|
2847 @param {Object} [cache={}] Object in which to store cached values. You may seed |
|
2848 this object with pre-existing cached values if desired. |
|
2849 @param {any} [refetch] If supplied, this value is compared with the cached value |
|
2850 using a `==` comparison. If the values are equal, the wrapped function is |
|
2851 executed again even though a cached value exists. |
|
2852 @return {Function} Wrapped function. |
|
2853 @for YUI |
|
2854 **/ |
|
2855 Y.cached = function (source, cache, refetch) { |
|
2856 /*jshint expr: true*/ |
|
2857 cache || (cache = {}); |
|
2858 |
|
2859 return function (arg) { |
|
2860 var key = arguments.length > 1 ? |
|
2861 Array.prototype.join.call(arguments, CACHED_DELIMITER) : |
|
2862 String(arg); |
|
2863 |
|
2864 /*jshint eqeqeq: false*/ |
|
2865 if (!(key in cache) || (refetch && cache[key] == refetch)) { |
|
2866 cache[key] = source.apply(source, arguments); |
|
2867 } |
|
2868 |
|
2869 return cache[key]; |
|
2870 }; |
|
2871 }; |
|
2872 |
|
2873 /** |
|
2874 Returns the `location` object from the window/frame in which this YUI instance |
|
2875 operates, or `undefined` when executing in a non-browser environment |
|
2876 (e.g. Node.js). |
|
2877 |
|
2878 It is _not_ recommended to hold references to the `window.location` object |
|
2879 outside of the scope of a function in which its properties are being accessed or |
|
2880 its methods are being called. This is because of a nasty bug/issue that exists |
|
2881 in both Safari and MobileSafari browsers: |
|
2882 [WebKit Bug 34679](https://bugs.webkit.org/show_bug.cgi?id=34679). |
|
2883 |
|
2884 @method getLocation |
|
2885 @return {location} The `location` object from the window/frame in which this YUI |
|
2886 instance operates. |
|
2887 @since 3.5.0 |
|
2888 **/ |
|
2889 Y.getLocation = function () { |
|
2890 // It is safer to look this up every time because yui-base is attached to a |
|
2891 // YUI instance before a user's config is applied; i.e. `Y.config.win` does |
|
2892 // not point the correct window object when this file is loaded. |
|
2893 var win = Y.config.win; |
|
2894 |
|
2895 // It is not safe to hold a reference to the `location` object outside the |
|
2896 // scope in which it is being used. The WebKit engine used in Safari and |
|
2897 // MobileSafari will "disconnect" the `location` object from the `window` |
|
2898 // when a page is restored from back/forward history cache. |
|
2899 return win && win.location; |
|
2900 }; |
|
2901 |
|
2902 /** |
|
2903 Returns a new object containing all of the properties of all the supplied |
|
2904 objects. The properties from later objects will overwrite those in earlier |
|
2905 objects. |
|
2906 |
|
2907 Passing in a single object will create a shallow copy of it. For a deep copy, |
|
2908 use `clone()`. |
|
2909 |
|
2910 @method merge |
|
2911 @param {Object} objects* One or more objects to merge. |
|
2912 @return {Object} A new merged object. |
|
2913 **/ |
|
2914 Y.merge = function () { |
|
2915 var i = 0, |
|
2916 len = arguments.length, |
|
2917 result = {}, |
|
2918 key, |
|
2919 obj; |
|
2920 |
|
2921 for (; i < len; ++i) { |
|
2922 obj = arguments[i]; |
|
2923 |
|
2924 for (key in obj) { |
|
2925 if (hasOwn.call(obj, key)) { |
|
2926 result[key] = obj[key]; |
|
2927 } |
|
2928 } |
|
2929 } |
|
2930 |
|
2931 return result; |
|
2932 }; |
|
2933 |
|
2934 /** |
|
2935 Mixes _supplier_'s properties into _receiver_. |
|
2936 |
|
2937 Properties on _receiver_ or _receiver_'s prototype will not be overwritten or |
|
2938 shadowed unless the _overwrite_ parameter is `true`, and will not be merged |
|
2939 unless the _merge_ parameter is `true`. |
|
2940 |
|
2941 In the default mode (0), only properties the supplier owns are copied (prototype |
|
2942 properties are not copied). The following copying modes are available: |
|
2943 |
|
2944 * `0`: _Default_. Object to object. |
|
2945 * `1`: Prototype to prototype. |
|
2946 * `2`: Prototype to prototype and object to object. |
|
2947 * `3`: Prototype to object. |
|
2948 * `4`: Object to prototype. |
|
2949 |
|
2950 @method mix |
|
2951 @param {Function|Object} receiver The object or function to receive the mixed |
|
2952 properties. |
|
2953 @param {Function|Object} supplier The object or function supplying the |
|
2954 properties to be mixed. |
|
2955 @param {Boolean} [overwrite=false] If `true`, properties that already exist |
|
2956 on the receiver will be overwritten with properties from the supplier. |
|
2957 @param {String[]} [whitelist] An array of property names to copy. If |
|
2958 specified, only the whitelisted properties will be copied, and all others |
|
2959 will be ignored. |
|
2960 @param {Number} [mode=0] Mix mode to use. See above for available modes. |
|
2961 @param {Boolean} [merge=false] If `true`, objects and arrays that already |
|
2962 exist on the receiver will have the corresponding object/array from the |
|
2963 supplier merged into them, rather than being skipped or overwritten. When |
|
2964 both _overwrite_ and _merge_ are `true`, _merge_ takes precedence. |
|
2965 @return {Function|Object|YUI} The receiver, or the YUI instance if the |
|
2966 specified receiver is falsy. |
|
2967 **/ |
|
2968 Y.mix = function(receiver, supplier, overwrite, whitelist, mode, merge) { |
|
2969 var alwaysOverwrite, exists, from, i, key, len, to; |
|
2970 |
|
2971 // If no supplier is given, we return the receiver. If no receiver is given, |
|
2972 // we return Y. Returning Y doesn't make much sense to me, but it's |
|
2973 // grandfathered in for backcompat reasons. |
|
2974 if (!receiver || !supplier) { |
|
2975 return receiver || Y; |
|
2976 } |
|
2977 |
|
2978 if (mode) { |
|
2979 // In mode 2 (prototype to prototype and object to object), we recurse |
|
2980 // once to do the proto to proto mix. The object to object mix will be |
|
2981 // handled later on. |
|
2982 if (mode === 2) { |
|
2983 Y.mix(receiver.prototype, supplier.prototype, overwrite, |
|
2984 whitelist, 0, merge); |
|
2985 } |
|
2986 |
|
2987 // Depending on which mode is specified, we may be copying from or to |
|
2988 // the prototypes of the supplier and receiver. |
|
2989 from = mode === 1 || mode === 3 ? supplier.prototype : supplier; |
|
2990 to = mode === 1 || mode === 4 ? receiver.prototype : receiver; |
|
2991 |
|
2992 // If either the supplier or receiver doesn't actually have a |
|
2993 // prototype property, then we could end up with an undefined `from` |
|
2994 // or `to`. If that happens, we abort and return the receiver. |
|
2995 if (!from || !to) { |
|
2996 return receiver; |
|
2997 } |
|
2998 } else { |
|
2999 from = supplier; |
|
3000 to = receiver; |
|
3001 } |
|
3002 |
|
3003 // If `overwrite` is truthy and `merge` is falsy, then we can skip a |
|
3004 // property existence check on each iteration and save some time. |
|
3005 alwaysOverwrite = overwrite && !merge; |
|
3006 |
|
3007 if (whitelist) { |
|
3008 for (i = 0, len = whitelist.length; i < len; ++i) { |
|
3009 key = whitelist[i]; |
|
3010 |
|
3011 // We call `Object.prototype.hasOwnProperty` instead of calling |
|
3012 // `hasOwnProperty` on the object itself, since the object's |
|
3013 // `hasOwnProperty` method may have been overridden or removed. |
|
3014 // Also, some native objects don't implement a `hasOwnProperty` |
|
3015 // method. |
|
3016 if (!hasOwn.call(from, key)) { |
|
3017 continue; |
|
3018 } |
|
3019 |
|
3020 // The `key in to` check here is (sadly) intentional for backwards |
|
3021 // compatibility reasons. It prevents undesired shadowing of |
|
3022 // prototype members on `to`. |
|
3023 exists = alwaysOverwrite ? false : key in to; |
|
3024 |
|
3025 if (merge && exists && isObject(to[key], true) |
|
3026 && isObject(from[key], true)) { |
|
3027 // If we're in merge mode, and the key is present on both |
|
3028 // objects, and the value on both objects is either an object or |
|
3029 // an array (but not a function), then we recurse to merge the |
|
3030 // `from` value into the `to` value instead of overwriting it. |
|
3031 // |
|
3032 // Note: It's intentional that the whitelist isn't passed to the |
|
3033 // recursive call here. This is legacy behavior that lots of |
|
3034 // code still depends on. |
|
3035 Y.mix(to[key], from[key], overwrite, null, 0, merge); |
|
3036 } else if (overwrite || !exists) { |
|
3037 // We're not in merge mode, so we'll only copy the `from` value |
|
3038 // to the `to` value if we're in overwrite mode or if the |
|
3039 // current key doesn't exist on the `to` object. |
|
3040 to[key] = from[key]; |
|
3041 } |
|
3042 } |
|
3043 } else { |
|
3044 for (key in from) { |
|
3045 // The code duplication here is for runtime performance reasons. |
|
3046 // Combining whitelist and non-whitelist operations into a single |
|
3047 // loop or breaking the shared logic out into a function both result |
|
3048 // in worse performance, and Y.mix is critical enough that the byte |
|
3049 // tradeoff is worth it. |
|
3050 if (!hasOwn.call(from, key)) { |
|
3051 continue; |
|
3052 } |
|
3053 |
|
3054 // The `key in to` check here is (sadly) intentional for backwards |
|
3055 // compatibility reasons. It prevents undesired shadowing of |
|
3056 // prototype members on `to`. |
|
3057 exists = alwaysOverwrite ? false : key in to; |
|
3058 |
|
3059 if (merge && exists && isObject(to[key], true) |
|
3060 && isObject(from[key], true)) { |
|
3061 Y.mix(to[key], from[key], overwrite, null, 0, merge); |
|
3062 } else if (overwrite || !exists) { |
|
3063 to[key] = from[key]; |
|
3064 } |
|
3065 } |
|
3066 |
|
3067 // If this is an IE browser with the JScript enumeration bug, force |
|
3068 // enumeration of the buggy properties by making a recursive call with |
|
3069 // the buggy properties as the whitelist. |
|
3070 if (Y.Object._hasEnumBug) { |
|
3071 Y.mix(to, from, overwrite, Y.Object._forceEnum, mode, merge); |
|
3072 } |
|
3073 } |
|
3074 |
|
3075 return receiver; |
|
3076 }; |
|
3077 /** |
|
3078 * The YUI module contains the components required for building the YUI |
|
3079 * seed file. This includes the script loading mechanism, a simple queue, |
|
3080 * and the core utilities for the library. |
|
3081 * @module yui |
|
3082 * @submodule yui-base |
|
3083 */ |
|
3084 |
|
3085 /** |
|
3086 * Adds utilities to the YUI instance for working with objects. |
|
3087 * |
|
3088 * @class Object |
|
3089 */ |
|
3090 |
|
3091 var Lang = Y.Lang, |
|
3092 hasOwn = Object.prototype.hasOwnProperty, |
|
3093 |
|
3094 UNDEFINED, // <-- Note the comma. We're still declaring vars. |
|
3095 |
|
3096 /** |
|
3097 * Returns a new object that uses _obj_ as its prototype. This method wraps the |
|
3098 * native ES5 `Object.create()` method if available, but doesn't currently |
|
3099 * pass through `Object.create()`'s second argument (properties) in order to |
|
3100 * ensure compatibility with older browsers. |
|
3101 * |
|
3102 * @method () |
|
3103 * @param {Object} obj Prototype object. |
|
3104 * @return {Object} New object using _obj_ as its prototype. |
|
3105 * @static |
|
3106 */ |
|
3107 O = Y.Object = Lang._isNative(Object.create) ? function (obj) { |
|
3108 // We currently wrap the native Object.create instead of simply aliasing it |
|
3109 // to ensure consistency with our fallback shim, which currently doesn't |
|
3110 // support Object.create()'s second argument (properties). Once we have a |
|
3111 // safe fallback for the properties arg, we can stop wrapping |
|
3112 // Object.create(). |
|
3113 return Object.create(obj); |
|
3114 } : (function () { |
|
3115 // Reusable constructor function for the Object.create() shim. |
|
3116 function F() {} |
|
3117 |
|
3118 // The actual shim. |
|
3119 return function (obj) { |
|
3120 F.prototype = obj; |
|
3121 return new F(); |
|
3122 }; |
|
3123 }()), |
|
3124 |
|
3125 /** |
|
3126 * Property names that IE doesn't enumerate in for..in loops, even when they |
|
3127 * should be enumerable. When `_hasEnumBug` is `true`, it's necessary to |
|
3128 * manually enumerate these properties. |
|
3129 * |
|
3130 * @property _forceEnum |
|
3131 * @type String[] |
|
3132 * @protected |
|
3133 * @static |
|
3134 */ |
|
3135 forceEnum = O._forceEnum = [ |
|
3136 'hasOwnProperty', |
|
3137 'isPrototypeOf', |
|
3138 'propertyIsEnumerable', |
|
3139 'toString', |
|
3140 'toLocaleString', |
|
3141 'valueOf' |
|
3142 ], |
|
3143 |
|
3144 /** |
|
3145 * `true` if this browser has the JScript enumeration bug that prevents |
|
3146 * enumeration of the properties named in the `_forceEnum` array, `false` |
|
3147 * otherwise. |
|
3148 * |
|
3149 * See: |
|
3150 * - <https://developer.mozilla.org/en/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug> |
|
3151 * - <http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation> |
|
3152 * |
|
3153 * @property _hasEnumBug |
|
3154 * @type Boolean |
|
3155 * @protected |
|
3156 * @static |
|
3157 */ |
|
3158 hasEnumBug = O._hasEnumBug = !{valueOf: 0}.propertyIsEnumerable('valueOf'), |
|
3159 |
|
3160 /** |
|
3161 * `true` if this browser incorrectly considers the `prototype` property of |
|
3162 * functions to be enumerable. Currently known to affect Opera 11.50. |
|
3163 * |
|
3164 * @property _hasProtoEnumBug |
|
3165 * @type Boolean |
|
3166 * @protected |
|
3167 * @static |
|
3168 */ |
|
3169 hasProtoEnumBug = O._hasProtoEnumBug = (function () {}).propertyIsEnumerable('prototype'), |
|
3170 |
|
3171 /** |
|
3172 * Returns `true` if _key_ exists on _obj_, `false` if _key_ doesn't exist or |
|
3173 * exists only on _obj_'s prototype. This is essentially a safer version of |
|
3174 * `obj.hasOwnProperty()`. |
|
3175 * |
|
3176 * @method owns |
|
3177 * @param {Object} obj Object to test. |
|
3178 * @param {String} key Property name to look for. |
|
3179 * @return {Boolean} `true` if _key_ exists on _obj_, `false` otherwise. |
|
3180 * @static |
|
3181 */ |
|
3182 owns = O.owns = function (obj, key) { |
|
3183 return !!obj && hasOwn.call(obj, key); |
|
3184 }; // <-- End of var declarations. |
|
3185 |
|
3186 /** |
|
3187 * Alias for `owns()`. |
|
3188 * |
|
3189 * @method hasKey |
|
3190 * @param {Object} obj Object to test. |
|
3191 * @param {String} key Property name to look for. |
|
3192 * @return {Boolean} `true` if _key_ exists on _obj_, `false` otherwise. |
|
3193 * @static |
|
3194 */ |
|
3195 O.hasKey = owns; |
|
3196 |
|
3197 /** |
|
3198 * Returns an array containing the object's enumerable keys. Does not include |
|
3199 * prototype keys or non-enumerable keys. |
|
3200 * |
|
3201 * Note that keys are returned in enumeration order (that is, in the same order |
|
3202 * that they would be enumerated by a `for-in` loop), which may not be the same |
|
3203 * as the order in which they were defined. |
|
3204 * |
|
3205 * This method is an alias for the native ES5 `Object.keys()` method if |
|
3206 * available. |
|
3207 * |
|
3208 * @example |
|
3209 * |
|
3210 * Y.Object.keys({a: 'foo', b: 'bar', c: 'baz'}); |
|
3211 * // => ['a', 'b', 'c'] |
|
3212 * |
|
3213 * @method keys |
|
3214 * @param {Object} obj An object. |
|
3215 * @return {String[]} Array of keys. |
|
3216 * @static |
|
3217 */ |
|
3218 O.keys = Lang._isNative(Object.keys) ? Object.keys : function (obj) { |
|
3219 if (!Lang.isObject(obj)) { |
|
3220 throw new TypeError('Object.keys called on a non-object'); |
|
3221 } |
|
3222 |
|
3223 var keys = [], |
|
3224 i, key, len; |
|
3225 |
|
3226 if (hasProtoEnumBug && typeof obj === 'function') { |
|
3227 for (key in obj) { |
|
3228 if (owns(obj, key) && key !== 'prototype') { |
|
3229 keys.push(key); |
|
3230 } |
|
3231 } |
|
3232 } else { |
|
3233 for (key in obj) { |
|
3234 if (owns(obj, key)) { |
|
3235 keys.push(key); |
|
3236 } |
|
3237 } |
|
3238 } |
|
3239 |
|
3240 if (hasEnumBug) { |
|
3241 for (i = 0, len = forceEnum.length; i < len; ++i) { |
|
3242 key = forceEnum[i]; |
|
3243 |
|
3244 if (owns(obj, key)) { |
|
3245 keys.push(key); |
|
3246 } |
|
3247 } |
|
3248 } |
|
3249 |
|
3250 return keys; |
|
3251 }; |
|
3252 |
|
3253 /** |
|
3254 * Returns an array containing the values of the object's enumerable keys. |
|
3255 * |
|
3256 * Note that values are returned in enumeration order (that is, in the same |
|
3257 * order that they would be enumerated by a `for-in` loop), which may not be the |
|
3258 * same as the order in which they were defined. |
|
3259 * |
|
3260 * @example |
|
3261 * |
|
3262 * Y.Object.values({a: 'foo', b: 'bar', c: 'baz'}); |
|
3263 * // => ['foo', 'bar', 'baz'] |
|
3264 * |
|
3265 * @method values |
|
3266 * @param {Object} obj An object. |
|
3267 * @return {Array} Array of values. |
|
3268 * @static |
|
3269 */ |
|
3270 O.values = function (obj) { |
|
3271 var keys = O.keys(obj), |
|
3272 i = 0, |
|
3273 len = keys.length, |
|
3274 values = []; |
|
3275 |
|
3276 for (; i < len; ++i) { |
|
3277 values.push(obj[keys[i]]); |
|
3278 } |
|
3279 |
|
3280 return values; |
|
3281 }; |
|
3282 |
|
3283 /** |
|
3284 * Returns the number of enumerable keys owned by an object. |
|
3285 * |
|
3286 * @method size |
|
3287 * @param {Object} obj An object. |
|
3288 * @return {Number} The object's size. |
|
3289 * @static |
|
3290 */ |
|
3291 O.size = function (obj) { |
|
3292 try { |
|
3293 return O.keys(obj).length; |
|
3294 } catch (ex) { |
|
3295 return 0; // Legacy behavior for non-objects. |
|
3296 } |
|
3297 }; |
|
3298 |
|
3299 /** |
|
3300 * Returns `true` if the object owns an enumerable property with the specified |
|
3301 * value. |
|
3302 * |
|
3303 * @method hasValue |
|
3304 * @param {Object} obj An object. |
|
3305 * @param {any} value The value to search for. |
|
3306 * @return {Boolean} `true` if _obj_ contains _value_, `false` otherwise. |
|
3307 * @static |
|
3308 */ |
|
3309 O.hasValue = function (obj, value) { |
|
3310 return Y.Array.indexOf(O.values(obj), value) > -1; |
|
3311 }; |
|
3312 |
|
3313 /** |
|
3314 * Executes a function on each enumerable property in _obj_. The function |
|
3315 * receives the value, the key, and the object itself as parameters (in that |
|
3316 * order). |
|
3317 * |
|
3318 * By default, only properties owned by _obj_ are enumerated. To include |
|
3319 * prototype properties, set the _proto_ parameter to `true`. |
|
3320 * |
|
3321 * @method each |
|
3322 * @param {Object} obj Object to enumerate. |
|
3323 * @param {Function} fn Function to execute on each enumerable property. |
|
3324 * @param {mixed} fn.value Value of the current property. |
|
3325 * @param {String} fn.key Key of the current property. |
|
3326 * @param {Object} fn.obj Object being enumerated. |
|
3327 * @param {Object} [thisObj] `this` object to use when calling _fn_. |
|
3328 * @param {Boolean} [proto=false] Include prototype properties. |
|
3329 * @return {YUI} the YUI instance. |
|
3330 * @chainable |
|
3331 * @static |
|
3332 */ |
|
3333 O.each = function (obj, fn, thisObj, proto) { |
|
3334 var key; |
|
3335 |
|
3336 for (key in obj) { |
|
3337 if (proto || owns(obj, key)) { |
|
3338 fn.call(thisObj || Y, obj[key], key, obj); |
|
3339 } |
|
3340 } |
|
3341 |
|
3342 return Y; |
|
3343 }; |
|
3344 |
|
3345 /** |
|
3346 * Executes a function on each enumerable property in _obj_, but halts if the |
|
3347 * function returns a truthy value. The function receives the value, the key, |
|
3348 * and the object itself as paramters (in that order). |
|
3349 * |
|
3350 * By default, only properties owned by _obj_ are enumerated. To include |
|
3351 * prototype properties, set the _proto_ parameter to `true`. |
|
3352 * |
|
3353 * @method some |
|
3354 * @param {Object} obj Object to enumerate. |
|
3355 * @param {Function} fn Function to execute on each enumerable property. |
|
3356 * @param {mixed} fn.value Value of the current property. |
|
3357 * @param {String} fn.key Key of the current property. |
|
3358 * @param {Object} fn.obj Object being enumerated. |
|
3359 * @param {Object} [thisObj] `this` object to use when calling _fn_. |
|
3360 * @param {Boolean} [proto=false] Include prototype properties. |
|
3361 * @return {Boolean} `true` if any execution of _fn_ returns a truthy value, |
|
3362 * `false` otherwise. |
|
3363 * @static |
|
3364 */ |
|
3365 O.some = function (obj, fn, thisObj, proto) { |
|
3366 var key; |
|
3367 |
|
3368 for (key in obj) { |
|
3369 if (proto || owns(obj, key)) { |
|
3370 if (fn.call(thisObj || Y, obj[key], key, obj)) { |
|
3371 return true; |
|
3372 } |
|
3373 } |
|
3374 } |
|
3375 |
|
3376 return false; |
|
3377 }; |
|
3378 |
|
3379 /** |
|
3380 * Retrieves the sub value at the provided path, |
|
3381 * from the value object provided. |
|
3382 * |
|
3383 * @method getValue |
|
3384 * @static |
|
3385 * @param o The object from which to extract the property value. |
|
3386 * @param path {Array} A path array, specifying the object traversal path |
|
3387 * from which to obtain the sub value. |
|
3388 * @return {Any} The value stored in the path, undefined if not found, |
|
3389 * undefined if the source is not an object. Returns the source object |
|
3390 * if an empty path is provided. |
|
3391 */ |
|
3392 O.getValue = function(o, path) { |
|
3393 if (!Lang.isObject(o)) { |
|
3394 return UNDEFINED; |
|
3395 } |
|
3396 |
|
3397 var i, |
|
3398 p = Y.Array(path), |
|
3399 l = p.length; |
|
3400 |
|
3401 for (i = 0; o !== UNDEFINED && i < l; i++) { |
|
3402 o = o[p[i]]; |
|
3403 } |
|
3404 |
|
3405 return o; |
|
3406 }; |
|
3407 |
|
3408 /** |
|
3409 * Sets the sub-attribute value at the provided path on the |
|
3410 * value object. Returns the modified value object, or |
|
3411 * undefined if the path is invalid. |
|
3412 * |
|
3413 * @method setValue |
|
3414 * @static |
|
3415 * @param o The object on which to set the sub value. |
|
3416 * @param path {Array} A path array, specifying the object traversal path |
|
3417 * at which to set the sub value. |
|
3418 * @param val {Any} The new value for the sub-attribute. |
|
3419 * @return {Object} The modified object, with the new sub value set, or |
|
3420 * undefined, if the path was invalid. |
|
3421 */ |
|
3422 O.setValue = function(o, path, val) { |
|
3423 var i, |
|
3424 p = Y.Array(path), |
|
3425 leafIdx = p.length - 1, |
|
3426 ref = o; |
|
3427 |
|
3428 if (leafIdx >= 0) { |
|
3429 for (i = 0; ref !== UNDEFINED && i < leafIdx; i++) { |
|
3430 ref = ref[p[i]]; |
|
3431 } |
|
3432 |
|
3433 if (ref !== UNDEFINED) { |
|
3434 ref[p[i]] = val; |
|
3435 } else { |
|
3436 return UNDEFINED; |
|
3437 } |
|
3438 } |
|
3439 |
|
3440 return o; |
|
3441 }; |
|
3442 |
|
3443 /** |
|
3444 * Returns `true` if the object has no enumerable properties of its own. |
|
3445 * |
|
3446 * @method isEmpty |
|
3447 * @param {Object} obj An object. |
|
3448 * @return {Boolean} `true` if the object is empty. |
|
3449 * @static |
|
3450 * @since 3.2.0 |
|
3451 */ |
|
3452 O.isEmpty = function (obj) { |
|
3453 return !O.keys(Object(obj)).length; |
|
3454 }; |
|
3455 /** |
|
3456 * The YUI module contains the components required for building the YUI seed |
|
3457 * file. This includes the script loading mechanism, a simple queue, and the |
|
3458 * core utilities for the library. |
|
3459 * @module yui |
|
3460 * @submodule yui-base |
|
3461 */ |
|
3462 |
|
3463 /** |
|
3464 * YUI user agent detection. |
|
3465 * Do not fork for a browser if it can be avoided. Use feature detection when |
|
3466 * you can. Use the user agent as a last resort. For all fields listed |
|
3467 * as @type float, UA stores a version number for the browser engine, |
|
3468 * 0 otherwise. This value may or may not map to the version number of |
|
3469 * the browser using the engine. The value is presented as a float so |
|
3470 * that it can easily be used for boolean evaluation as well as for |
|
3471 * looking for a particular range of versions. Because of this, |
|
3472 * some of the granularity of the version info may be lost. The fields that |
|
3473 * are @type string default to null. The API docs list the values that |
|
3474 * these fields can have. |
|
3475 * @class UA |
|
3476 * @static |
|
3477 */ |
|
3478 |
|
3479 /** |
|
3480 * Static method on `YUI.Env` for parsing a UA string. Called at instantiation |
|
3481 * to populate `Y.UA`. |
|
3482 * |
|
3483 * @static |
|
3484 * @method parseUA |
|
3485 * @param {String} [subUA=navigator.userAgent] UA string to parse |
|
3486 * @return {Object} The Y.UA object |
|
3487 */ |
|
3488 YUI.Env.parseUA = function(subUA) { |
|
3489 |
|
3490 var numberify = function(s) { |
|
3491 var c = 0; |
|
3492 return parseFloat(s.replace(/\./g, function() { |
|
3493 return (c++ === 1) ? '' : '.'; |
|
3494 })); |
|
3495 }, |
|
3496 |
|
3497 win = Y.config.win, |
|
3498 |
|
3499 nav = win && win.navigator, |
|
3500 |
|
3501 o = { |
|
3502 |
|
3503 /** |
|
3504 * Internet Explorer version number or 0. Example: 6 |
|
3505 * @property ie |
|
3506 * @type float |
|
3507 * @static |
|
3508 */ |
|
3509 ie: 0, |
|
3510 |
|
3511 /** |
|
3512 * Opera version number or 0. Example: 9.2 |
|
3513 * @property opera |
|
3514 * @type float |
|
3515 * @static |
|
3516 */ |
|
3517 opera: 0, |
|
3518 |
|
3519 /** |
|
3520 * Gecko engine revision number. Will evaluate to 1 if Gecko |
|
3521 * is detected but the revision could not be found. Other browsers |
|
3522 * will be 0. Example: 1.8 |
|
3523 * <pre> |
|
3524 * Firefox 1.0.0.4: 1.7.8 <-- Reports 1.7 |
|
3525 * Firefox 1.5.0.9: 1.8.0.9 <-- 1.8 |
|
3526 * Firefox 2.0.0.3: 1.8.1.3 <-- 1.81 |
|
3527 * Firefox 3.0 <-- 1.9 |
|
3528 * Firefox 3.5 <-- 1.91 |
|
3529 * </pre> |
|
3530 * @property gecko |
|
3531 * @type float |
|
3532 * @static |
|
3533 */ |
|
3534 gecko: 0, |
|
3535 |
|
3536 /** |
|
3537 * AppleWebKit version. KHTML browsers that are not WebKit browsers |
|
3538 * will evaluate to 1, other browsers 0. Example: 418.9 |
|
3539 * <pre> |
|
3540 * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the |
|
3541 * latest available for Mac OSX 10.3. |
|
3542 * Safari 2.0.2: 416 <-- hasOwnProperty introduced |
|
3543 * Safari 2.0.4: 418 <-- preventDefault fixed |
|
3544 * Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run |
|
3545 * different versions of webkit |
|
3546 * Safari 2.0.4 (419.3): 419 <-- Tiger installations that have been |
|
3547 * updated, but not updated |
|
3548 * to the latest patch. |
|
3549 * Webkit 212 nightly: 522+ <-- Safari 3.0 precursor (with native |
|
3550 * SVG and many major issues fixed). |
|
3551 * Safari 3.0.4 (523.12) 523.12 <-- First Tiger release - automatic |
|
3552 * update from 2.x via the 10.4.11 OS patch. |
|
3553 * Webkit nightly 1/2008:525+ <-- Supports DOMContentLoaded event. |
|
3554 * yahoo.com user agent hack removed. |
|
3555 * </pre> |
|
3556 * http://en.wikipedia.org/wiki/Safari_version_history |
|
3557 * @property webkit |
|
3558 * @type float |
|
3559 * @static |
|
3560 */ |
|
3561 webkit: 0, |
|
3562 |
|
3563 /** |
|
3564 * Safari will be detected as webkit, but this property will also |
|
3565 * be populated with the Safari version number |
|
3566 * @property safari |
|
3567 * @type float |
|
3568 * @static |
|
3569 */ |
|
3570 safari: 0, |
|
3571 |
|
3572 /** |
|
3573 * Chrome will be detected as webkit, but this property will also |
|
3574 * be populated with the Chrome version number |
|
3575 * @property chrome |
|
3576 * @type float |
|
3577 * @static |
|
3578 */ |
|
3579 chrome: 0, |
|
3580 |
|
3581 /** |
|
3582 * The mobile property will be set to a string containing any relevant |
|
3583 * user agent information when a modern mobile browser is detected. |
|
3584 * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series |
|
3585 * devices with the WebKit-based browser, and Opera Mini. |
|
3586 * @property mobile |
|
3587 * @type string |
|
3588 * @default null |
|
3589 * @static |
|
3590 */ |
|
3591 mobile: null, |
|
3592 |
|
3593 /** |
|
3594 * Adobe AIR version number or 0. Only populated if webkit is detected. |
|
3595 * Example: 1.0 |
|
3596 * @property air |
|
3597 * @type float |
|
3598 */ |
|
3599 air: 0, |
|
3600 /** |
|
3601 * PhantomJS version number or 0. Only populated if webkit is detected. |
|
3602 * Example: 1.0 |
|
3603 * @property phantomjs |
|
3604 * @type float |
|
3605 */ |
|
3606 phantomjs: 0, |
|
3607 /** |
|
3608 * Detects Apple iPad's OS version |
|
3609 * @property ipad |
|
3610 * @type float |
|
3611 * @static |
|
3612 */ |
|
3613 ipad: 0, |
|
3614 /** |
|
3615 * Detects Apple iPhone's OS version |
|
3616 * @property iphone |
|
3617 * @type float |
|
3618 * @static |
|
3619 */ |
|
3620 iphone: 0, |
|
3621 /** |
|
3622 * Detects Apples iPod's OS version |
|
3623 * @property ipod |
|
3624 * @type float |
|
3625 * @static |
|
3626 */ |
|
3627 ipod: 0, |
|
3628 /** |
|
3629 * General truthy check for iPad, iPhone or iPod |
|
3630 * @property ios |
|
3631 * @type Boolean |
|
3632 * @default null |
|
3633 * @static |
|
3634 */ |
|
3635 ios: null, |
|
3636 /** |
|
3637 * Detects Googles Android OS version |
|
3638 * @property android |
|
3639 * @type float |
|
3640 * @static |
|
3641 */ |
|
3642 android: 0, |
|
3643 /** |
|
3644 * Detects Kindle Silk |
|
3645 * @property silk |
|
3646 * @type float |
|
3647 * @static |
|
3648 */ |
|
3649 silk: 0, |
|
3650 /** |
|
3651 * Detects Kindle Silk Acceleration |
|
3652 * @property accel |
|
3653 * @type Boolean |
|
3654 * @static |
|
3655 */ |
|
3656 accel: false, |
|
3657 /** |
|
3658 * Detects Palms WebOS version |
|
3659 * @property webos |
|
3660 * @type float |
|
3661 * @static |
|
3662 */ |
|
3663 webos: 0, |
|
3664 |
|
3665 /** |
|
3666 * Google Caja version number or 0. |
|
3667 * @property caja |
|
3668 * @type float |
|
3669 */ |
|
3670 caja: nav && nav.cajaVersion, |
|
3671 |
|
3672 /** |
|
3673 * Set to true if the page appears to be in SSL |
|
3674 * @property secure |
|
3675 * @type boolean |
|
3676 * @static |
|
3677 */ |
|
3678 secure: false, |
|
3679 |
|
3680 /** |
|
3681 * The operating system. Currently only detecting windows or macintosh |
|
3682 * @property os |
|
3683 * @type string |
|
3684 * @default null |
|
3685 * @static |
|
3686 */ |
|
3687 os: null, |
|
3688 |
|
3689 /** |
|
3690 * The Nodejs Version |
|
3691 * @property nodejs |
|
3692 * @type float |
|
3693 * @default 0 |
|
3694 * @static |
|
3695 */ |
|
3696 nodejs: 0, |
|
3697 /** |
|
3698 * Window8/IE10 Application host environment |
|
3699 * @property winjs |
|
3700 * @type Boolean |
|
3701 * @static |
|
3702 */ |
|
3703 winjs: !!((typeof Windows !== "undefined") && Windows.System), |
|
3704 /** |
|
3705 * Are touch/msPointer events available on this device |
|
3706 * @property touchEnabled |
|
3707 * @type Boolean |
|
3708 * @static |
|
3709 */ |
|
3710 touchEnabled: false |
|
3711 }, |
|
3712 |
|
3713 ua = subUA || nav && nav.userAgent, |
|
3714 |
|
3715 loc = win && win.location, |
|
3716 |
|
3717 href = loc && loc.href, |
|
3718 |
|
3719 m; |
|
3720 |
|
3721 /** |
|
3722 * The User Agent string that was parsed |
|
3723 * @property userAgent |
|
3724 * @type String |
|
3725 * @static |
|
3726 */ |
|
3727 o.userAgent = ua; |
|
3728 |
|
3729 |
|
3730 o.secure = href && (href.toLowerCase().indexOf('https') === 0); |
|
3731 |
|
3732 if (ua) { |
|
3733 |
|
3734 if ((/windows|win32/i).test(ua)) { |
|
3735 o.os = 'windows'; |
|
3736 } else if ((/macintosh|mac_powerpc/i).test(ua)) { |
|
3737 o.os = 'macintosh'; |
|
3738 } else if ((/android/i).test(ua)) { |
|
3739 o.os = 'android'; |
|
3740 } else if ((/symbos/i).test(ua)) { |
|
3741 o.os = 'symbos'; |
|
3742 } else if ((/linux/i).test(ua)) { |
|
3743 o.os = 'linux'; |
|
3744 } else if ((/rhino/i).test(ua)) { |
|
3745 o.os = 'rhino'; |
|
3746 } |
|
3747 |
|
3748 // Modern KHTML browsers should qualify as Safari X-Grade |
|
3749 if ((/KHTML/).test(ua)) { |
|
3750 o.webkit = 1; |
|
3751 } |
|
3752 if ((/IEMobile|XBLWP7/).test(ua)) { |
|
3753 o.mobile = 'windows'; |
|
3754 } |
|
3755 if ((/Fennec/).test(ua)) { |
|
3756 o.mobile = 'gecko'; |
|
3757 } |
|
3758 // Modern WebKit browsers are at least X-Grade |
|
3759 m = ua.match(/AppleWebKit\/([^\s]*)/); |
|
3760 if (m && m[1]) { |
|
3761 o.webkit = numberify(m[1]); |
|
3762 o.safari = o.webkit; |
|
3763 |
|
3764 if (/PhantomJS/.test(ua)) { |
|
3765 m = ua.match(/PhantomJS\/([^\s]*)/); |
|
3766 if (m && m[1]) { |
|
3767 o.phantomjs = numberify(m[1]); |
|
3768 } |
|
3769 } |
|
3770 |
|
3771 // Mobile browser check |
|
3772 if (/ Mobile\//.test(ua) || (/iPad|iPod|iPhone/).test(ua)) { |
|
3773 o.mobile = 'Apple'; // iPhone or iPod Touch |
|
3774 |
|
3775 m = ua.match(/OS ([^\s]*)/); |
|
3776 if (m && m[1]) { |
|
3777 m = numberify(m[1].replace('_', '.')); |
|
3778 } |
|
3779 o.ios = m; |
|
3780 o.os = 'ios'; |
|
3781 o.ipad = o.ipod = o.iphone = 0; |
|
3782 |
|
3783 m = ua.match(/iPad|iPod|iPhone/); |
|
3784 if (m && m[0]) { |
|
3785 o[m[0].toLowerCase()] = o.ios; |
|
3786 } |
|
3787 } else { |
|
3788 m = ua.match(/NokiaN[^\/]*|webOS\/\d\.\d/); |
|
3789 if (m) { |
|
3790 // Nokia N-series, webOS, ex: NokiaN95 |
|
3791 o.mobile = m[0]; |
|
3792 } |
|
3793 if (/webOS/.test(ua)) { |
|
3794 o.mobile = 'WebOS'; |
|
3795 m = ua.match(/webOS\/([^\s]*);/); |
|
3796 if (m && m[1]) { |
|
3797 o.webos = numberify(m[1]); |
|
3798 } |
|
3799 } |
|
3800 if (/ Android/.test(ua)) { |
|
3801 if (/Mobile/.test(ua)) { |
|
3802 o.mobile = 'Android'; |
|
3803 } |
|
3804 m = ua.match(/Android ([^\s]*);/); |
|
3805 if (m && m[1]) { |
|
3806 o.android = numberify(m[1]); |
|
3807 } |
|
3808 |
|
3809 } |
|
3810 if (/Silk/.test(ua)) { |
|
3811 m = ua.match(/Silk\/([^\s]*)\)/); |
|
3812 if (m && m[1]) { |
|
3813 o.silk = numberify(m[1]); |
|
3814 } |
|
3815 if (!o.android) { |
|
3816 o.android = 2.34; //Hack for desktop mode in Kindle |
|
3817 o.os = 'Android'; |
|
3818 } |
|
3819 if (/Accelerated=true/.test(ua)) { |
|
3820 o.accel = true; |
|
3821 } |
|
3822 } |
|
3823 } |
|
3824 |
|
3825 m = ua.match(/(Chrome|CrMo|CriOS)\/([^\s]*)/); |
|
3826 if (m && m[1] && m[2]) { |
|
3827 o.chrome = numberify(m[2]); // Chrome |
|
3828 o.safari = 0; //Reset safari back to 0 |
|
3829 if (m[1] === 'CrMo') { |
|
3830 o.mobile = 'chrome'; |
|
3831 } |
|
3832 } else { |
|
3833 m = ua.match(/AdobeAIR\/([^\s]*)/); |
|
3834 if (m) { |
|
3835 o.air = m[0]; // Adobe AIR 1.0 or better |
|
3836 } |
|
3837 } |
|
3838 } |
|
3839 |
|
3840 if (!o.webkit) { // not webkit |
|
3841 // @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr) |
|
3842 if (/Opera/.test(ua)) { |
|
3843 m = ua.match(/Opera[\s\/]([^\s]*)/); |
|
3844 if (m && m[1]) { |
|
3845 o.opera = numberify(m[1]); |
|
3846 } |
|
3847 m = ua.match(/Version\/([^\s]*)/); |
|
3848 if (m && m[1]) { |
|
3849 o.opera = numberify(m[1]); // opera 10+ |
|
3850 } |
|
3851 |
|
3852 if (/Opera Mobi/.test(ua)) { |
|
3853 o.mobile = 'opera'; |
|
3854 m = ua.replace('Opera Mobi', '').match(/Opera ([^\s]*)/); |
|
3855 if (m && m[1]) { |
|
3856 o.opera = numberify(m[1]); |
|
3857 } |
|
3858 } |
|
3859 m = ua.match(/Opera Mini[^;]*/); |
|
3860 |
|
3861 if (m) { |
|
3862 o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316 |
|
3863 } |
|
3864 } else { // not opera or webkit |
|
3865 m = ua.match(/MSIE\s([^;]*)/); |
|
3866 if (m && m[1]) { |
|
3867 o.ie = numberify(m[1]); |
|
3868 } else { // not opera, webkit, or ie |
|
3869 m = ua.match(/Gecko\/([^\s]*)/); |
|
3870 if (m) { |
|
3871 o.gecko = 1; // Gecko detected, look for revision |
|
3872 m = ua.match(/rv:([^\s\)]*)/); |
|
3873 if (m && m[1]) { |
|
3874 o.gecko = numberify(m[1]); |
|
3875 if (/Mobile|Tablet/.test(ua)) { |
|
3876 o.mobile = "ffos"; |
|
3877 } |
|
3878 } |
|
3879 } |
|
3880 } |
|
3881 } |
|
3882 } |
|
3883 } |
|
3884 |
|
3885 //Check for known properties to tell if touch events are enabled on this device or if |
|
3886 //the number of MSPointer touchpoints on this device is greater than 0. |
|
3887 if (win && nav && !(o.chrome && o.chrome < 6)) { |
|
3888 o.touchEnabled = (("ontouchstart" in win) || (("msMaxTouchPoints" in nav) && (nav.msMaxTouchPoints > 0))); |
|
3889 } |
|
3890 |
|
3891 //It was a parsed UA, do not assign the global value. |
|
3892 if (!subUA) { |
|
3893 |
|
3894 if (typeof process === 'object') { |
|
3895 |
|
3896 if (process.versions && process.versions.node) { |
|
3897 //NodeJS |
|
3898 o.os = process.platform; |
|
3899 o.nodejs = numberify(process.versions.node); |
|
3900 } |
|
3901 } |
|
3902 |
|
3903 YUI.Env.UA = o; |
|
3904 |
|
3905 } |
|
3906 |
|
3907 return o; |
|
3908 }; |
|
3909 |
|
3910 |
|
3911 Y.UA = YUI.Env.UA || YUI.Env.parseUA(); |
|
3912 |
|
3913 /** |
|
3914 Performs a simple comparison between two version numbers, accounting for |
|
3915 standard versioning logic such as the fact that "535.8" is a lower version than |
|
3916 "535.24", even though a simple numerical comparison would indicate that it's |
|
3917 greater. Also accounts for cases such as "1.1" vs. "1.1.0", which are |
|
3918 considered equivalent. |
|
3919 |
|
3920 Returns -1 if version _a_ is lower than version _b_, 0 if they're equivalent, |
|
3921 1 if _a_ is higher than _b_. |
|
3922 |
|
3923 Versions may be numbers or strings containing numbers and dots. For example, |
|
3924 both `535` and `"535.8.10"` are acceptable. A version string containing |
|
3925 non-numeric characters, like `"535.8.beta"`, may produce unexpected results. |
|
3926 |
|
3927 @method compareVersions |
|
3928 @param {Number|String} a First version number to compare. |
|
3929 @param {Number|String} b Second version number to compare. |
|
3930 @return -1 if _a_ is lower than _b_, 0 if they're equivalent, 1 if _a_ is |
|
3931 higher than _b_. |
|
3932 **/ |
|
3933 Y.UA.compareVersions = function (a, b) { |
|
3934 var aPart, aParts, bPart, bParts, i, len; |
|
3935 |
|
3936 if (a === b) { |
|
3937 return 0; |
|
3938 } |
|
3939 |
|
3940 aParts = (a + '').split('.'); |
|
3941 bParts = (b + '').split('.'); |
|
3942 |
|
3943 for (i = 0, len = Math.max(aParts.length, bParts.length); i < len; ++i) { |
|
3944 aPart = parseInt(aParts[i], 10); |
|
3945 bPart = parseInt(bParts[i], 10); |
|
3946 |
|
3947 /*jshint expr: true*/ |
|
3948 isNaN(aPart) && (aPart = 0); |
|
3949 isNaN(bPart) && (bPart = 0); |
|
3950 |
|
3951 if (aPart < bPart) { |
|
3952 return -1; |
|
3953 } |
|
3954 |
|
3955 if (aPart > bPart) { |
|
3956 return 1; |
|
3957 } |
|
3958 } |
|
3959 |
|
3960 return 0; |
|
3961 }; |
|
3962 YUI.Env.aliases = { |
|
3963 "anim": ["anim-base","anim-color","anim-curve","anim-easing","anim-node-plugin","anim-scroll","anim-xy"], |
|
3964 "anim-shape-transform": ["anim-shape"], |
|
3965 "app": ["app-base","app-content","app-transitions","lazy-model-list","model","model-list","model-sync-rest","router","view","view-node-map"], |
|
3966 "attribute": ["attribute-base","attribute-complex"], |
|
3967 "attribute-events": ["attribute-observable"], |
|
3968 "autocomplete": ["autocomplete-base","autocomplete-sources","autocomplete-list","autocomplete-plugin"], |
|
3969 "axes": ["axis-numeric","axis-category","axis-time","axis-stacked"], |
|
3970 "axes-base": ["axis-numeric-base","axis-category-base","axis-time-base","axis-stacked-base"], |
|
3971 "base": ["base-base","base-pluginhost","base-build"], |
|
3972 "cache": ["cache-base","cache-offline","cache-plugin"], |
|
3973 "charts": ["charts-base"], |
|
3974 "collection": ["array-extras","arraylist","arraylist-add","arraylist-filter","array-invoke"], |
|
3975 "color": ["color-base","color-hsl","color-harmony"], |
|
3976 "controller": ["router"], |
|
3977 "dataschema": ["dataschema-base","dataschema-json","dataschema-xml","dataschema-array","dataschema-text"], |
|
3978 "datasource": ["datasource-local","datasource-io","datasource-get","datasource-function","datasource-cache","datasource-jsonschema","datasource-xmlschema","datasource-arrayschema","datasource-textschema","datasource-polling"], |
|
3979 "datatable": ["datatable-core","datatable-table","datatable-head","datatable-body","datatable-base","datatable-column-widths","datatable-message","datatable-mutable","datatable-sort","datatable-datasource"], |
|
3980 "datatype": ["datatype-date","datatype-number","datatype-xml"], |
|
3981 "datatype-date": ["datatype-date-parse","datatype-date-format","datatype-date-math"], |
|
3982 "datatype-number": ["datatype-number-parse","datatype-number-format"], |
|
3983 "datatype-xml": ["datatype-xml-parse","datatype-xml-format"], |
|
3984 "dd": ["dd-ddm-base","dd-ddm","dd-ddm-drop","dd-drag","dd-proxy","dd-constrain","dd-drop","dd-scroll","dd-delegate"], |
|
3985 "dom": ["dom-base","dom-screen","dom-style","selector-native","selector"], |
|
3986 "editor": ["frame","editor-selection","exec-command","editor-base","editor-para","editor-br","editor-bidi","editor-tab","createlink-base"], |
|
3987 "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"], |
|
3988 "event-custom": ["event-custom-base","event-custom-complex"], |
|
3989 "event-gestures": ["event-flick","event-move"], |
|
3990 "handlebars": ["handlebars-compiler"], |
|
3991 "highlight": ["highlight-base","highlight-accentfold"], |
|
3992 "history": ["history-base","history-hash","history-hash-ie","history-html5"], |
|
3993 "io": ["io-base","io-xdr","io-form","io-upload-iframe","io-queue"], |
|
3994 "json": ["json-parse","json-stringify"], |
|
3995 "loader": ["loader-base","loader-rollup","loader-yui3"], |
|
3996 "node": ["node-base","node-event-delegate","node-pluginhost","node-screen","node-style"], |
|
3997 "pluginhost": ["pluginhost-base","pluginhost-config"], |
|
3998 "querystring": ["querystring-parse","querystring-stringify"], |
|
3999 "recordset": ["recordset-base","recordset-sort","recordset-filter","recordset-indexer"], |
|
4000 "resize": ["resize-base","resize-proxy","resize-constrain"], |
|
4001 "slider": ["slider-base","slider-value-range","clickable-rail","range-slider"], |
|
4002 "template": ["template-base","template-micro"], |
|
4003 "text": ["text-accentfold","text-wordbreak"], |
|
4004 "widget": ["widget-base","widget-htmlparser","widget-skin","widget-uievents"] |
|
4005 }; |
|
4006 |
|
4007 |
|
4008 }, '3.10.3', { |
|
4009 "use": [ |
|
4010 "yui-base", |
|
4011 "get", |
|
4012 "features", |
|
4013 "intl-base", |
|
4014 "yui-log", |
|
4015 "yui-log-nodejs", |
|
4016 "yui-later", |
|
4017 "loader-base", |
|
4018 "loader-rollup", |
|
4019 "loader-yui3" |
|
4020 ] |
|
4021 }); |
|
4022 YUI.add('get', function (Y, NAME) { |
|
4023 |
|
4024 /** |
|
4025 * NodeJS specific Get module used to load remote resources. |
|
4026 * It contains the same signature as the default Get module so there is no code change needed. |
|
4027 * @module get-nodejs |
|
4028 * @class GetNodeJS |
|
4029 */ |
|
4030 |
|
4031 var Module = require('module'), |
|
4032 |
|
4033 path = require('path'), |
|
4034 fs = require('fs'), |
|
4035 request = require('request'), |
|
4036 end = function(cb, msg, result) { |
|
4037 //Y.log('Get end: ' + cb.onEnd); |
|
4038 if (Y.Lang.isFunction(cb.onEnd)) { |
|
4039 cb.onEnd.call(Y, msg, result); |
|
4040 } |
|
4041 }, pass = function(cb) { |
|
4042 //Y.log('Get pass: ' + cb.onSuccess); |
|
4043 if (Y.Lang.isFunction(cb.onSuccess)) { |
|
4044 cb.onSuccess.call(Y, cb); |
|
4045 } |
|
4046 end(cb, 'success', 'success'); |
|
4047 }, fail = function(cb, er) { |
|
4048 //Y.log('Get fail: ' + er); |
|
4049 er.errors = [er]; |
|
4050 if (Y.Lang.isFunction(cb.onFailure)) { |
|
4051 cb.onFailure.call(Y, er, cb); |
|
4052 } |
|
4053 end(cb, er, 'fail'); |
|
4054 }; |
|
4055 |
|
4056 |
|
4057 Y.Get = function() { |
|
4058 }; |
|
4059 |
|
4060 //Setup the default config base path |
|
4061 Y.config.base = path.join(__dirname, '../'); |
|
4062 |
|
4063 YUI.require = require; |
|
4064 YUI.process = process; |
|
4065 |
|
4066 /** |
|
4067 * Takes the raw JS files and wraps them to be executed in the YUI context so they can be loaded |
|
4068 * into the YUI object |
|
4069 * @method _exec |
|
4070 * @private |
|
4071 * @param {String} data The JS to execute |
|
4072 * @param {String} url The path to the file that was parsed |
|
4073 * @param {Callback} cb The callback to execute when this is completed |
|
4074 * @param {Error} cb.err=null Error object |
|
4075 * @param {String} cb.url The URL that was just parsed |
|
4076 */ |
|
4077 |
|
4078 Y.Get._exec = function(data, url, cb) { |
|
4079 if (data.charCodeAt(0) === 0xFEFF) { |
|
4080 data = data.slice(1); |
|
4081 } |
|
4082 |
|
4083 var mod = new Module(url, module); |
|
4084 mod.filename = url; |
|
4085 mod.paths = Module._nodeModulePaths(path.dirname(url)); |
|
4086 if (typeof YUI._getLoadHook === 'function') { |
|
4087 data = YUI._getLoadHook(data, url); |
|
4088 } |
|
4089 mod._compile('module.exports = function (YUI) {' + data + '\n;return YUI;};', url); |
|
4090 |
|
4091 /*global YUI:true */ |
|
4092 YUI = mod.exports(YUI); |
|
4093 |
|
4094 mod.loaded = true; |
|
4095 |
|
4096 cb(null, url); |
|
4097 }; |
|
4098 |
|
4099 /** |
|
4100 * Fetches the content from a remote URL or a file from disc and passes the content |
|
4101 * off to `_exec` for parsing |
|
4102 * @method _include |
|
4103 * @private |
|
4104 * @param {String} url The URL/File path to fetch the content from |
|
4105 * @param {Callback} cb The callback to fire once the content has been executed via `_exec` |
|
4106 */ |
|
4107 Y.Get._include = function (url, cb) { |
|
4108 var cfg, |
|
4109 mod, |
|
4110 self = this; |
|
4111 |
|
4112 if (url.match(/^https?:\/\//)) { |
|
4113 cfg = { |
|
4114 url: url, |
|
4115 timeout: self.timeout |
|
4116 }; |
|
4117 request(cfg, function (err, response, body) { |
|
4118 if (err) { |
|
4119 Y.log(err, 'error', 'get'); |
|
4120 cb(err, url); |
|
4121 } else { |
|
4122 Y.Get._exec(body, url, cb); |
|
4123 } |
|
4124 }); |
|
4125 } else { |
|
4126 try { |
|
4127 // Try to resolve paths relative to the module that required yui. |
|
4128 url = Module._findPath(url, Module._resolveLookupPaths(url, module.parent.parent)[1]); |
|
4129 |
|
4130 if (Y.config.useSync) { |
|
4131 //Needs to be in useSync |
|
4132 mod = fs.readFileSync(url,'utf8'); |
|
4133 } else { |
|
4134 fs.readFile(url, 'utf8', function (err, mod) { |
|
4135 if (err) { |
|
4136 cb(err, url); |
|
4137 } else { |
|
4138 Y.Get._exec(mod, url, cb); |
|
4139 } |
|
4140 }); |
|
4141 return; |
|
4142 } |
|
4143 } catch (err) { |
|
4144 cb(err, url); |
|
4145 return; |
|
4146 } |
|
4147 |
|
4148 Y.Get._exec(mod, url, cb); |
|
4149 } |
|
4150 }; |
|
4151 |
|
4152 |
|
4153 /** |
|
4154 * Override for Get.script for loading local or remote YUI modules. |
|
4155 * @method js |
|
4156 * @param {Array|String} s The URL's to load into this context |
|
4157 * @param {Object} options Transaction options |
|
4158 */ |
|
4159 Y.Get.js = function(s, options) { |
|
4160 var urls = Y.Array(s), url, i, l = urls.length, c= 0, |
|
4161 check = function() { |
|
4162 if (c === l) { |
|
4163 pass(options); |
|
4164 } |
|
4165 }; |
|
4166 |
|
4167 |
|
4168 /*jshint loopfunc: true */ |
|
4169 for (i=0; i<l; i++) { |
|
4170 url = urls[i]; |
|
4171 if (Y.Lang.isObject(url)) { |
|
4172 url = url.url; |
|
4173 } |
|
4174 |
|
4175 url = url.replace(/'/g, '%27'); |
|
4176 Y.log('URL: ' + url, 'info', 'get'); |
|
4177 Y.Get._include(url, function(err, url) { |
|
4178 if (!Y.config) { |
|
4179 Y.config = { |
|
4180 debug: true |
|
4181 }; |
|
4182 } |
|
4183 if (options.onProgress) { |
|
4184 options.onProgress.call(options.context || Y, url); |
|
4185 } |
|
4186 Y.log('After Load: ' + url, 'info', 'get'); |
|
4187 if (err) { |
|
4188 fail(options, err); |
|
4189 Y.log('----------------------------------------------------------', 'error', 'get'); |
|
4190 Y.log(err, 'error', 'get'); |
|
4191 Y.log('----------------------------------------------------------', 'error', 'get'); |
|
4192 } else { |
|
4193 c++; |
|
4194 check(); |
|
4195 } |
|
4196 }); |
|
4197 } |
|
4198 |
|
4199 //Keeping Signature in the browser. |
|
4200 return { |
|
4201 execute: function() {} |
|
4202 }; |
|
4203 }; |
|
4204 |
|
4205 /** |
|
4206 * Alias for `Y.Get.js` |
|
4207 * @method script |
|
4208 */ |
|
4209 Y.Get.script = Y.Get.js; |
|
4210 |
|
4211 //Place holder for SS Dom access |
|
4212 Y.Get.css = function(s, cb) { |
|
4213 Y.log('Y.Get.css is not supported, just reporting that it has loaded but not fetching.', 'warn', 'get'); |
|
4214 pass(cb); |
|
4215 }; |
|
4216 |
|
4217 |
|
4218 |
|
4219 }, '3.10.3'); |
|
4220 YUI.add('features', function (Y, NAME) { |
|
4221 |
|
4222 var feature_tests = {}; |
|
4223 |
|
4224 /** |
|
4225 Contains the core of YUI's feature test architecture. |
|
4226 @module features |
|
4227 */ |
|
4228 |
|
4229 /** |
|
4230 * Feature detection |
|
4231 * @class Features |
|
4232 * @static |
|
4233 */ |
|
4234 |
|
4235 Y.mix(Y.namespace('Features'), { |
|
4236 |
|
4237 /** |
|
4238 * Object hash of all registered feature tests |
|
4239 * @property tests |
|
4240 * @type Object |
|
4241 */ |
|
4242 tests: feature_tests, |
|
4243 |
|
4244 /** |
|
4245 * Add a test to the system |
|
4246 * |
|
4247 * ``` |
|
4248 * Y.Features.add("load", "1", {}); |
|
4249 * ``` |
|
4250 * |
|
4251 * @method add |
|
4252 * @param {String} cat The category, right now only 'load' is supported |
|
4253 * @param {String} name The number sequence of the test, how it's reported in the URL or config: 1, 2, 3 |
|
4254 * @param {Object} o Object containing test properties |
|
4255 * @param {String} o.name The name of the test |
|
4256 * @param {Function} o.test The test function to execute, the only argument to the function is the `Y` instance |
|
4257 * @param {String} o.trigger The module that triggers this test. |
|
4258 */ |
|
4259 add: function(cat, name, o) { |
|
4260 feature_tests[cat] = feature_tests[cat] || {}; |
|
4261 feature_tests[cat][name] = o; |
|
4262 }, |
|
4263 /** |
|
4264 * Execute all tests of a given category and return the serialized results |
|
4265 * |
|
4266 * ``` |
|
4267 * caps=1:1;2:1;3:0 |
|
4268 * ``` |
|
4269 * @method all |
|
4270 * @param {String} cat The category to execute |
|
4271 * @param {Array} args The arguments to pass to the test function |
|
4272 * @return {String} A semi-colon separated string of tests and their success/failure: 1:1;2:1;3:0 |
|
4273 */ |
|
4274 all: function(cat, args) { |
|
4275 var cat_o = feature_tests[cat], |
|
4276 // results = {}; |
|
4277 result = []; |
|
4278 if (cat_o) { |
|
4279 Y.Object.each(cat_o, function(v, k) { |
|
4280 result.push(k + ':' + (Y.Features.test(cat, k, args) ? 1 : 0)); |
|
4281 }); |
|
4282 } |
|
4283 |
|
4284 return (result.length) ? result.join(';') : ''; |
|
4285 }, |
|
4286 /** |
|
4287 * Run a sepecific test and return a Boolean response. |
|
4288 * |
|
4289 * ``` |
|
4290 * Y.Features.test("load", "1"); |
|
4291 * ``` |
|
4292 * |
|
4293 * @method test |
|
4294 * @param {String} cat The category of the test to run |
|
4295 * @param {String} name The name of the test to run |
|
4296 * @param {Array} args The arguments to pass to the test function |
|
4297 * @return {Boolean} True or false if the test passed/failed. |
|
4298 */ |
|
4299 test: function(cat, name, args) { |
|
4300 args = args || []; |
|
4301 var result, ua, test, |
|
4302 cat_o = feature_tests[cat], |
|
4303 feature = cat_o && cat_o[name]; |
|
4304 |
|
4305 if (!feature) { |
|
4306 Y.log('Feature test ' + cat + ', ' + name + ' not found'); |
|
4307 } else { |
|
4308 |
|
4309 result = feature.result; |
|
4310 |
|
4311 if (Y.Lang.isUndefined(result)) { |
|
4312 |
|
4313 ua = feature.ua; |
|
4314 if (ua) { |
|
4315 result = (Y.UA[ua]); |
|
4316 } |
|
4317 |
|
4318 test = feature.test; |
|
4319 if (test && ((!ua) || result)) { |
|
4320 result = test.apply(Y, args); |
|
4321 } |
|
4322 |
|
4323 feature.result = result; |
|
4324 } |
|
4325 } |
|
4326 |
|
4327 return result; |
|
4328 } |
|
4329 }); |
|
4330 |
|
4331 // Y.Features.add("load", "1", {}); |
|
4332 // Y.Features.test("load", "1"); |
|
4333 // caps=1:1;2:0;3:1; |
|
4334 |
|
4335 /* This file is auto-generated by (yogi loader --yes --mix --start ../) */ |
|
4336 /*jshint maxlen:900, eqeqeq: false */ |
|
4337 var add = Y.Features.add; |
|
4338 // app-transitions-native |
|
4339 add('load', '0', { |
|
4340 "name": "app-transitions-native", |
|
4341 "test": function (Y) { |
|
4342 var doc = Y.config.doc, |
|
4343 node = doc ? doc.documentElement : null; |
|
4344 |
|
4345 if (node && node.style) { |
|
4346 return ('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); |
|
4347 } |
|
4348 |
|
4349 return false; |
|
4350 }, |
|
4351 "trigger": "app-transitions" |
|
4352 }); |
|
4353 // autocomplete-list-keys |
|
4354 add('load', '1', { |
|
4355 "name": "autocomplete-list-keys", |
|
4356 "test": function (Y) { |
|
4357 // Only add keyboard support to autocomplete-list if this doesn't appear to |
|
4358 // be an iOS or Android-based mobile device. |
|
4359 // |
|
4360 // There's currently no feasible way to actually detect whether a device has |
|
4361 // a hardware keyboard, so this sniff will have to do. It can easily be |
|
4362 // overridden by manually loading the autocomplete-list-keys module. |
|
4363 // |
|
4364 // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari |
|
4365 // doesn't fire the keyboard events used by AutoCompleteList, so there's |
|
4366 // no point loading the -keys module even when a bluetooth keyboard may be |
|
4367 // available. |
|
4368 return !(Y.UA.ios || Y.UA.android); |
|
4369 }, |
|
4370 "trigger": "autocomplete-list" |
|
4371 }); |
|
4372 // dd-gestures |
|
4373 add('load', '2', { |
|
4374 "name": "dd-gestures", |
|
4375 "trigger": "dd-drag", |
|
4376 "ua": "touchEnabled" |
|
4377 }); |
|
4378 // dom-style-ie |
|
4379 add('load', '3', { |
|
4380 "name": "dom-style-ie", |
|
4381 "test": function (Y) { |
|
4382 |
|
4383 var testFeature = Y.Features.test, |
|
4384 addFeature = Y.Features.add, |
|
4385 WINDOW = Y.config.win, |
|
4386 DOCUMENT = Y.config.doc, |
|
4387 DOCUMENT_ELEMENT = 'documentElement', |
|
4388 ret = false; |
|
4389 |
|
4390 addFeature('style', 'computedStyle', { |
|
4391 test: function() { |
|
4392 return WINDOW && 'getComputedStyle' in WINDOW; |
|
4393 } |
|
4394 }); |
|
4395 |
|
4396 addFeature('style', 'opacity', { |
|
4397 test: function() { |
|
4398 return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style; |
|
4399 } |
|
4400 }); |
|
4401 |
|
4402 ret = (!testFeature('style', 'opacity') && |
|
4403 !testFeature('style', 'computedStyle')); |
|
4404 |
|
4405 return ret; |
|
4406 }, |
|
4407 "trigger": "dom-style" |
|
4408 }); |
|
4409 // editor-para-ie |
|
4410 add('load', '4', { |
|
4411 "name": "editor-para-ie", |
|
4412 "trigger": "editor-para", |
|
4413 "ua": "ie", |
|
4414 "when": "instead" |
|
4415 }); |
|
4416 // event-base-ie |
|
4417 add('load', '5', { |
|
4418 "name": "event-base-ie", |
|
4419 "test": function(Y) { |
|
4420 var imp = Y.config.doc && Y.config.doc.implementation; |
|
4421 return (imp && (!imp.hasFeature('Events', '2.0'))); |
|
4422 }, |
|
4423 "trigger": "node-base" |
|
4424 }); |
|
4425 // graphics-canvas |
|
4426 add('load', '6', { |
|
4427 "name": "graphics-canvas", |
|
4428 "test": function(Y) { |
|
4429 var DOCUMENT = Y.config.doc, |
|
4430 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", |
|
4431 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), |
|
4432 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); |
|
4433 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); |
|
4434 }, |
|
4435 "trigger": "graphics" |
|
4436 }); |
|
4437 // graphics-canvas-default |
|
4438 add('load', '7', { |
|
4439 "name": "graphics-canvas-default", |
|
4440 "test": function(Y) { |
|
4441 var DOCUMENT = Y.config.doc, |
|
4442 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", |
|
4443 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), |
|
4444 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); |
|
4445 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); |
|
4446 }, |
|
4447 "trigger": "graphics" |
|
4448 }); |
|
4449 // graphics-svg |
|
4450 add('load', '8', { |
|
4451 "name": "graphics-svg", |
|
4452 "test": function(Y) { |
|
4453 var DOCUMENT = Y.config.doc, |
|
4454 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", |
|
4455 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), |
|
4456 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); |
|
4457 |
|
4458 return svg && (useSVG || !canvas); |
|
4459 }, |
|
4460 "trigger": "graphics" |
|
4461 }); |
|
4462 // graphics-svg-default |
|
4463 add('load', '9', { |
|
4464 "name": "graphics-svg-default", |
|
4465 "test": function(Y) { |
|
4466 var DOCUMENT = Y.config.doc, |
|
4467 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", |
|
4468 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), |
|
4469 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); |
|
4470 |
|
4471 return svg && (useSVG || !canvas); |
|
4472 }, |
|
4473 "trigger": "graphics" |
|
4474 }); |
|
4475 // graphics-vml |
|
4476 add('load', '10', { |
|
4477 "name": "graphics-vml", |
|
4478 "test": function(Y) { |
|
4479 var DOCUMENT = Y.config.doc, |
|
4480 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); |
|
4481 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); |
|
4482 }, |
|
4483 "trigger": "graphics" |
|
4484 }); |
|
4485 // graphics-vml-default |
|
4486 add('load', '11', { |
|
4487 "name": "graphics-vml-default", |
|
4488 "test": function(Y) { |
|
4489 var DOCUMENT = Y.config.doc, |
|
4490 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); |
|
4491 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); |
|
4492 }, |
|
4493 "trigger": "graphics" |
|
4494 }); |
|
4495 // history-hash-ie |
|
4496 add('load', '12', { |
|
4497 "name": "history-hash-ie", |
|
4498 "test": function (Y) { |
|
4499 var docMode = Y.config.doc && Y.config.doc.documentMode; |
|
4500 |
|
4501 return Y.UA.ie && (!('onhashchange' in Y.config.win) || |
|
4502 !docMode || docMode < 8); |
|
4503 }, |
|
4504 "trigger": "history-hash" |
|
4505 }); |
|
4506 // io-nodejs |
|
4507 add('load', '13', { |
|
4508 "name": "io-nodejs", |
|
4509 "trigger": "io-base", |
|
4510 "ua": "nodejs" |
|
4511 }); |
|
4512 // json-parse-shim |
|
4513 add('load', '14', { |
|
4514 "name": "json-parse-shim", |
|
4515 "test": function (Y) { |
|
4516 var _JSON = Y.config.global.JSON, |
|
4517 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, |
|
4518 nativeSupport = Y.config.useNativeJSONParse !== false && !!Native; |
|
4519 |
|
4520 function workingNative( k, v ) { |
|
4521 return k === "ok" ? true : v; |
|
4522 } |
|
4523 |
|
4524 // Double check basic functionality. This is mainly to catch early broken |
|
4525 // implementations of the JSON API in Firefox 3.1 beta1 and beta2 |
|
4526 if ( nativeSupport ) { |
|
4527 try { |
|
4528 nativeSupport = ( Native.parse( '{"ok":false}', workingNative ) ).ok; |
|
4529 } |
|
4530 catch ( e ) { |
|
4531 nativeSupport = false; |
|
4532 } |
|
4533 } |
|
4534 |
|
4535 return !nativeSupport; |
|
4536 }, |
|
4537 "trigger": "json-parse" |
|
4538 }); |
|
4539 // json-stringify-shim |
|
4540 add('load', '15', { |
|
4541 "name": "json-stringify-shim", |
|
4542 "test": function (Y) { |
|
4543 var _JSON = Y.config.global.JSON, |
|
4544 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, |
|
4545 nativeSupport = Y.config.useNativeJSONStringify !== false && !!Native; |
|
4546 |
|
4547 // Double check basic native functionality. This is primarily to catch broken |
|
4548 // early JSON API implementations in Firefox 3.1 beta1 and beta2. |
|
4549 if ( nativeSupport ) { |
|
4550 try { |
|
4551 nativeSupport = ( '0' === Native.stringify(0) ); |
|
4552 } catch ( e ) { |
|
4553 nativeSupport = false; |
|
4554 } |
|
4555 } |
|
4556 |
|
4557 |
|
4558 return !nativeSupport; |
|
4559 }, |
|
4560 "trigger": "json-stringify" |
|
4561 }); |
|
4562 // scrollview-base-ie |
|
4563 add('load', '16', { |
|
4564 "name": "scrollview-base-ie", |
|
4565 "trigger": "scrollview-base", |
|
4566 "ua": "ie" |
|
4567 }); |
|
4568 // selector-css2 |
|
4569 add('load', '17', { |
|
4570 "name": "selector-css2", |
|
4571 "test": function (Y) { |
|
4572 var DOCUMENT = Y.config.doc, |
|
4573 ret = DOCUMENT && !('querySelectorAll' in DOCUMENT); |
|
4574 |
|
4575 return ret; |
|
4576 }, |
|
4577 "trigger": "selector" |
|
4578 }); |
|
4579 // transition-timer |
|
4580 add('load', '18', { |
|
4581 "name": "transition-timer", |
|
4582 "test": function (Y) { |
|
4583 var DOCUMENT = Y.config.doc, |
|
4584 node = (DOCUMENT) ? DOCUMENT.documentElement: null, |
|
4585 ret = true; |
|
4586 |
|
4587 if (node && node.style) { |
|
4588 ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); |
|
4589 } |
|
4590 |
|
4591 return ret; |
|
4592 }, |
|
4593 "trigger": "transition" |
|
4594 }); |
|
4595 // widget-base-ie |
|
4596 add('load', '19', { |
|
4597 "name": "widget-base-ie", |
|
4598 "trigger": "widget-base", |
|
4599 "ua": "ie" |
|
4600 }); |
|
4601 // yql-jsonp |
|
4602 add('load', '20', { |
|
4603 "name": "yql-jsonp", |
|
4604 "test": function (Y) { |
|
4605 /* Only load the JSONP module when not in nodejs or winjs |
|
4606 TODO Make the winjs module a CORS module |
|
4607 */ |
|
4608 return (!Y.UA.nodejs && !Y.UA.winjs); |
|
4609 }, |
|
4610 "trigger": "yql", |
|
4611 "when": "after" |
|
4612 }); |
|
4613 // yql-nodejs |
|
4614 add('load', '21', { |
|
4615 "name": "yql-nodejs", |
|
4616 "trigger": "yql", |
|
4617 "ua": "nodejs", |
|
4618 "when": "after" |
|
4619 }); |
|
4620 // yql-winjs |
|
4621 add('load', '22', { |
|
4622 "name": "yql-winjs", |
|
4623 "trigger": "yql", |
|
4624 "ua": "winjs", |
|
4625 "when": "after" |
|
4626 }); |
|
4627 |
|
4628 }, '3.10.3', {"requires": ["yui-base"]}); |
|
4629 YUI.add('intl-base', function (Y, NAME) { |
|
4630 |
|
4631 /** |
|
4632 * The Intl utility provides a central location for managing sets of |
|
4633 * localized resources (strings and formatting patterns). |
|
4634 * |
|
4635 * @class Intl |
|
4636 * @uses EventTarget |
|
4637 * @static |
|
4638 */ |
|
4639 |
|
4640 var SPLIT_REGEX = /[, ]/; |
|
4641 |
|
4642 Y.mix(Y.namespace('Intl'), { |
|
4643 |
|
4644 /** |
|
4645 * Returns the language among those available that |
|
4646 * best matches the preferred language list, using the Lookup |
|
4647 * algorithm of BCP 47. |
|
4648 * If none of the available languages meets the user's preferences, |
|
4649 * then "" is returned. |
|
4650 * Extended language ranges are not supported. |
|
4651 * |
|
4652 * @method lookupBestLang |
|
4653 * @param {String[] | String} preferredLanguages The list of preferred |
|
4654 * languages in descending preference order, represented as BCP 47 |
|
4655 * language tags. A string array or a comma-separated list. |
|
4656 * @param {String[]} availableLanguages The list of languages |
|
4657 * that the application supports, represented as BCP 47 language |
|
4658 * tags. |
|
4659 * |
|
4660 * @return {String} The available language that best matches the |
|
4661 * preferred language list, or "". |
|
4662 * @since 3.1.0 |
|
4663 */ |
|
4664 lookupBestLang: function(preferredLanguages, availableLanguages) { |
|
4665 |
|
4666 var i, language, result, index; |
|
4667 |
|
4668 // check whether the list of available languages contains language; |
|
4669 // if so return it |
|
4670 function scan(language) { |
|
4671 var i; |
|
4672 for (i = 0; i < availableLanguages.length; i += 1) { |
|
4673 if (language.toLowerCase() === |
|
4674 availableLanguages[i].toLowerCase()) { |
|
4675 return availableLanguages[i]; |
|
4676 } |
|
4677 } |
|
4678 } |
|
4679 |
|
4680 if (Y.Lang.isString(preferredLanguages)) { |
|
4681 preferredLanguages = preferredLanguages.split(SPLIT_REGEX); |
|
4682 } |
|
4683 |
|
4684 for (i = 0; i < preferredLanguages.length; i += 1) { |
|
4685 language = preferredLanguages[i]; |
|
4686 if (!language || language === '*') { |
|
4687 continue; |
|
4688 } |
|
4689 // check the fallback sequence for one language |
|
4690 while (language.length > 0) { |
|
4691 result = scan(language); |
|
4692 if (result) { |
|
4693 return result; |
|
4694 } else { |
|
4695 index = language.lastIndexOf('-'); |
|
4696 if (index >= 0) { |
|
4697 language = language.substring(0, index); |
|
4698 // one-character subtags get cut along with the |
|
4699 // following subtag |
|
4700 if (index >= 2 && language.charAt(index - 2) === '-') { |
|
4701 language = language.substring(0, index - 2); |
|
4702 } |
|
4703 } else { |
|
4704 // nothing available for this language |
|
4705 break; |
|
4706 } |
|
4707 } |
|
4708 } |
|
4709 } |
|
4710 |
|
4711 return ''; |
|
4712 } |
|
4713 }); |
|
4714 |
|
4715 |
|
4716 }, '3.10.3', {"requires": ["yui-base"]}); |
|
4717 YUI.add('yui-log', function (Y, NAME) { |
|
4718 |
|
4719 /** |
|
4720 * Provides console log capability and exposes a custom event for |
|
4721 * console implementations. This module is a `core` YUI module, |
|
4722 * <a href="../classes/YUI.html#method_log">it's documentation is located under the YUI class</a>. |
|
4723 * |
|
4724 * @module yui |
|
4725 * @submodule yui-log |
|
4726 */ |
|
4727 |
|
4728 var INSTANCE = Y, |
|
4729 LOGEVENT = 'yui:log', |
|
4730 UNDEFINED = 'undefined', |
|
4731 LEVELS = { debug: 1, |
|
4732 info: 2, |
|
4733 warn: 4, |
|
4734 error: 8 }; |
|
4735 |
|
4736 /** |
|
4737 * If the 'debug' config is true, a 'yui:log' event will be |
|
4738 * dispatched, which the Console widget and anything else |
|
4739 * can consume. If the 'useBrowserConsole' config is true, it will |
|
4740 * write to the browser console if available. YUI-specific log |
|
4741 * messages will only be present in the -debug versions of the |
|
4742 * JS files. The build system is supposed to remove log statements |
|
4743 * from the raw and minified versions of the files. |
|
4744 * |
|
4745 * @method log |
|
4746 * @for YUI |
|
4747 * @param {String} msg The message to log. |
|
4748 * @param {String} cat The log category for the message. Default |
|
4749 * categories are "info", "warn", "error", time". |
|
4750 * Custom categories can be used as well. (opt). |
|
4751 * @param {String} src The source of the the message (opt). |
|
4752 * @param {boolean} silent If true, the log event won't fire. |
|
4753 * @return {YUI} YUI instance. |
|
4754 */ |
|
4755 INSTANCE.log = function(msg, cat, src, silent) { |
|
4756 var bail, excl, incl, m, f, minlevel, |
|
4757 Y = INSTANCE, |
|
4758 c = Y.config, |
|
4759 publisher = (Y.fire) ? Y : YUI.Env.globalEvents; |
|
4760 // suppress log message if the config is off or the event stack |
|
4761 // or the event call stack contains a consumer of the yui:log event |
|
4762 if (c.debug) { |
|
4763 // apply source filters |
|
4764 src = src || ""; |
|
4765 if (typeof src !== "undefined") { |
|
4766 excl = c.logExclude; |
|
4767 incl = c.logInclude; |
|
4768 if (incl && !(src in incl)) { |
|
4769 bail = 1; |
|
4770 } else if (incl && (src in incl)) { |
|
4771 bail = !incl[src]; |
|
4772 } else if (excl && (src in excl)) { |
|
4773 bail = excl[src]; |
|
4774 } |
|
4775 |
|
4776 // Determine the current minlevel as defined in configuration |
|
4777 Y.config.logLevel = Y.config.logLevel || 'debug'; |
|
4778 minlevel = LEVELS[Y.config.logLevel.toLowerCase()]; |
|
4779 |
|
4780 if (cat in LEVELS && LEVELS[cat] < minlevel) { |
|
4781 // Skip this message if the we don't meet the defined minlevel |
|
4782 bail = 1; |
|
4783 } |
|
4784 } |
|
4785 if (!bail) { |
|
4786 if (c.useBrowserConsole) { |
|
4787 m = (src) ? src + ': ' + msg : msg; |
|
4788 if (Y.Lang.isFunction(c.logFn)) { |
|
4789 c.logFn.call(Y, msg, cat, src); |
|
4790 } else if (typeof console !== UNDEFINED && console.log) { |
|
4791 f = (cat && console[cat] && (cat in LEVELS)) ? cat : 'log'; |
|
4792 console[f](m); |
|
4793 } else if (typeof opera !== UNDEFINED) { |
|
4794 opera.postError(m); |
|
4795 } |
|
4796 } |
|
4797 |
|
4798 if (publisher && !silent) { |
|
4799 |
|
4800 if (publisher === Y && (!publisher.getEvent(LOGEVENT))) { |
|
4801 publisher.publish(LOGEVENT, { |
|
4802 broadcast: 2 |
|
4803 }); |
|
4804 } |
|
4805 |
|
4806 publisher.fire(LOGEVENT, { |
|
4807 msg: msg, |
|
4808 cat: cat, |
|
4809 src: src |
|
4810 }); |
|
4811 } |
|
4812 } |
|
4813 } |
|
4814 |
|
4815 return Y; |
|
4816 }; |
|
4817 |
|
4818 /** |
|
4819 * Write a system message. This message will be preserved in the |
|
4820 * minified and raw versions of the YUI files, unlike log statements. |
|
4821 * @method message |
|
4822 * @for YUI |
|
4823 * @param {String} msg The message to log. |
|
4824 * @param {String} cat The log category for the message. Default |
|
4825 * categories are "info", "warn", "error", time". |
|
4826 * Custom categories can be used as well. (opt). |
|
4827 * @param {String} src The source of the the message (opt). |
|
4828 * @param {boolean} silent If true, the log event won't fire. |
|
4829 * @return {YUI} YUI instance. |
|
4830 */ |
|
4831 INSTANCE.message = function() { |
|
4832 return INSTANCE.log.apply(INSTANCE, arguments); |
|
4833 }; |
|
4834 |
|
4835 |
|
4836 }, '3.10.3', {"requires": ["yui-base"]}); |
|
4837 YUI.add('yui-log-nodejs', function (Y, NAME) { |
|
4838 |
|
4839 var sys = require(process.binding('natives').util ? 'util' : 'sys'), |
|
4840 hasColor = false; |
|
4841 |
|
4842 try { |
|
4843 var stdio = require("stdio"); |
|
4844 hasColor = stdio.isStderrATTY(); |
|
4845 } catch (ex) { |
|
4846 hasColor = true; |
|
4847 } |
|
4848 |
|
4849 Y.config.useColor = hasColor; |
|
4850 |
|
4851 Y.consoleColor = function(str, num) { |
|
4852 if (!this.config.useColor) { |
|
4853 return str; |
|
4854 } |
|
4855 if (!num) { |
|
4856 num = '32'; |
|
4857 } |
|
4858 return "\u001b[" + num +"m" + str + "\u001b[0m"; |
|
4859 }; |
|
4860 |
|
4861 |
|
4862 var logFn = function(str, t, m) { |
|
4863 var id = '', lvl, mLvl; |
|
4864 if (this.id) { |
|
4865 id = '[' + this.id + ']:'; |
|
4866 } |
|
4867 t = t || 'info'; |
|
4868 m = (m) ? this.consoleColor(' (' + m.toLowerCase() + '):', 35) : ''; |
|
4869 |
|
4870 if (str === null) { |
|
4871 str = 'null'; |
|
4872 } |
|
4873 |
|
4874 if ((typeof str === 'object') || str instanceof Array) { |
|
4875 try { |
|
4876 //Should we use this? |
|
4877 if (str.tagName || str._yuid || str._query) { |
|
4878 str = str.toString(); |
|
4879 } else { |
|
4880 str = sys.inspect(str); |
|
4881 } |
|
4882 } catch (e) { |
|
4883 //Fail catcher |
|
4884 } |
|
4885 } |
|
4886 |
|
4887 lvl = '37;40'; |
|
4888 mLvl = ((str) ? '' : 31); |
|
4889 t = t+''; //Force to a string.. |
|
4890 switch (t.toLowerCase()) { |
|
4891 case 'error': |
|
4892 lvl = mLvl = 31; |
|
4893 break; |
|
4894 case 'warn': |
|
4895 lvl = 33; |
|
4896 break; |
|
4897 case 'debug': |
|
4898 lvl = 34; |
|
4899 break; |
|
4900 } |
|
4901 if (typeof str === 'string') { |
|
4902 if (str && str.indexOf("\n") !== -1) { |
|
4903 str = "\n" + str; |
|
4904 } |
|
4905 } |
|
4906 |
|
4907 // output log messages to stderr |
|
4908 sys.error(this.consoleColor(t.toLowerCase() + ':', lvl) + m + ' ' + this.consoleColor(str, mLvl)); |
|
4909 }; |
|
4910 |
|
4911 if (!Y.config.logFn) { |
|
4912 Y.config.logFn = logFn; |
|
4913 } |
|
4914 |
|
4915 |
|
4916 |
|
4917 }, '3.10.3'); |
|
4918 YUI.add('yui-later', function (Y, NAME) { |
|
4919 |
|
4920 /** |
|
4921 * Provides a setTimeout/setInterval wrapper. This module is a `core` YUI module, |
|
4922 * <a href="../classes/YUI.html#method_later">it's documentation is located under the YUI class</a>. |
|
4923 * |
|
4924 * @module yui |
|
4925 * @submodule yui-later |
|
4926 */ |
|
4927 |
|
4928 var NO_ARGS = []; |
|
4929 |
|
4930 /** |
|
4931 * Executes the supplied function in the context of the supplied |
|
4932 * object 'when' milliseconds later. Executes the function a |
|
4933 * single time unless periodic is set to true. |
|
4934 * @for YUI |
|
4935 * @method later |
|
4936 * @param when {int} the number of milliseconds to wait until the fn |
|
4937 * is executed. |
|
4938 * @param o the context object. |
|
4939 * @param fn {Function|String} the function to execute or the name of |
|
4940 * the method in the 'o' object to execute. |
|
4941 * @param data [Array] data that is provided to the function. This |
|
4942 * accepts either a single item or an array. If an array is provided, |
|
4943 * the function is executed with one parameter for each array item. |
|
4944 * If you need to pass a single array parameter, it needs to be wrapped |
|
4945 * in an array [myarray]. |
|
4946 * |
|
4947 * Note: native methods in IE may not have the call and apply methods. |
|
4948 * In this case, it will work, but you are limited to four arguments. |
|
4949 * |
|
4950 * @param periodic {boolean} if true, executes continuously at supplied |
|
4951 * interval until canceled. |
|
4952 * @return {object} a timer object. Call the cancel() method on this |
|
4953 * object to stop the timer. |
|
4954 */ |
|
4955 Y.later = function(when, o, fn, data, periodic) { |
|
4956 when = when || 0; |
|
4957 data = (!Y.Lang.isUndefined(data)) ? Y.Array(data) : NO_ARGS; |
|
4958 o = o || Y.config.win || Y; |
|
4959 |
|
4960 var cancelled = false, |
|
4961 method = (o && Y.Lang.isString(fn)) ? o[fn] : fn, |
|
4962 wrapper = function() { |
|
4963 // IE 8- may execute a setInterval callback one last time |
|
4964 // after clearInterval was called, so in order to preserve |
|
4965 // the cancel() === no more runny-run, we have to jump through |
|
4966 // an extra hoop. |
|
4967 if (!cancelled) { |
|
4968 if (!method.apply) { |
|
4969 method(data[0], data[1], data[2], data[3]); |
|
4970 } else { |
|
4971 method.apply(o, data || NO_ARGS); |
|
4972 } |
|
4973 } |
|
4974 }, |
|
4975 id = (periodic) ? setInterval(wrapper, when) : setTimeout(wrapper, when); |
|
4976 |
|
4977 return { |
|
4978 id: id, |
|
4979 interval: periodic, |
|
4980 cancel: function() { |
|
4981 cancelled = true; |
|
4982 if (this.interval) { |
|
4983 clearInterval(id); |
|
4984 } else { |
|
4985 clearTimeout(id); |
|
4986 } |
|
4987 } |
|
4988 }; |
|
4989 }; |
|
4990 |
|
4991 Y.Lang.later = Y.later; |
|
4992 |
|
4993 |
|
4994 |
|
4995 }, '3.10.3', {"requires": ["yui-base"]}); |
|
4996 YUI.add('loader-base', function (Y, NAME) { |
|
4997 |
|
4998 /** |
|
4999 * The YUI loader core |
|
5000 * @module loader |
|
5001 * @submodule loader-base |
|
5002 */ |
|
5003 |
|
5004 if (!YUI.Env[Y.version]) { |
|
5005 |
|
5006 (function() { |
|
5007 var VERSION = Y.version, |
|
5008 BUILD = '/build/', |
|
5009 ROOT = VERSION + '/', |
|
5010 CDN_BASE = Y.Env.base, |
|
5011 GALLERY_VERSION = 'gallery-2013.06.05-22-14', |
|
5012 TNT = '2in3', |
|
5013 TNT_VERSION = '4', |
|
5014 YUI2_VERSION = '2.9.0', |
|
5015 COMBO_BASE = CDN_BASE + 'combo?', |
|
5016 META = { version: VERSION, |
|
5017 root: ROOT, |
|
5018 base: Y.Env.base, |
|
5019 comboBase: COMBO_BASE, |
|
5020 skin: { defaultSkin: 'sam', |
|
5021 base: 'assets/skins/', |
|
5022 path: 'skin.css', |
|
5023 after: ['cssreset', |
|
5024 'cssfonts', |
|
5025 'cssgrids', |
|
5026 'cssbase', |
|
5027 'cssreset-context', |
|
5028 'cssfonts-context']}, |
|
5029 groups: {}, |
|
5030 patterns: {} }, |
|
5031 groups = META.groups, |
|
5032 yui2Update = function(tnt, yui2, config) { |
|
5033 |
|
5034 var root = TNT + '.' + |
|
5035 (tnt || TNT_VERSION) + '/' + |
|
5036 (yui2 || YUI2_VERSION) + BUILD, |
|
5037 base = (config && config.base) ? config.base : CDN_BASE, |
|
5038 combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE; |
|
5039 |
|
5040 groups.yui2.base = base + root; |
|
5041 groups.yui2.root = root; |
|
5042 groups.yui2.comboBase = combo; |
|
5043 }, |
|
5044 galleryUpdate = function(tag, config) { |
|
5045 var root = (tag || GALLERY_VERSION) + BUILD, |
|
5046 base = (config && config.base) ? config.base : CDN_BASE, |
|
5047 combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE; |
|
5048 |
|
5049 groups.gallery.base = base + root; |
|
5050 groups.gallery.root = root; |
|
5051 groups.gallery.comboBase = combo; |
|
5052 }; |
|
5053 |
|
5054 |
|
5055 groups[VERSION] = {}; |
|
5056 |
|
5057 groups.gallery = { |
|
5058 ext: false, |
|
5059 combine: true, |
|
5060 comboBase: COMBO_BASE, |
|
5061 update: galleryUpdate, |
|
5062 patterns: { 'gallery-': { }, |
|
5063 'lang/gallery-': {}, |
|
5064 'gallerycss-': { type: 'css' } } |
|
5065 }; |
|
5066 |
|
5067 groups.yui2 = { |
|
5068 combine: true, |
|
5069 ext: false, |
|
5070 comboBase: COMBO_BASE, |
|
5071 update: yui2Update, |
|
5072 patterns: { |
|
5073 'yui2-': { |
|
5074 configFn: function(me) { |
|
5075 if (/-skin|reset|fonts|grids|base/.test(me.name)) { |
|
5076 me.type = 'css'; |
|
5077 me.path = me.path.replace(/\.js/, '.css'); |
|
5078 // this makes skins in builds earlier than |
|
5079 // 2.6.0 work as long as combine is false |
|
5080 me.path = me.path.replace(/\/yui2-skin/, |
|
5081 '/assets/skins/sam/yui2-skin'); |
|
5082 } |
|
5083 } |
|
5084 } |
|
5085 } |
|
5086 }; |
|
5087 |
|
5088 galleryUpdate(); |
|
5089 yui2Update(); |
|
5090 |
|
5091 YUI.Env[VERSION] = META; |
|
5092 }()); |
|
5093 } |
|
5094 |
|
5095 |
|
5096 /*jslint forin: true, maxlen: 350 */ |
|
5097 |
|
5098 /** |
|
5099 * Loader dynamically loads script and css files. It includes the dependency |
|
5100 * information for the version of the library in use, and will automatically pull in |
|
5101 * dependencies for the modules requested. It can also load the |
|
5102 * files from the Yahoo! CDN, and it can utilize the combo service provided on |
|
5103 * this network to reduce the number of http connections required to download |
|
5104 * YUI files. |
|
5105 * |
|
5106 * @module loader |
|
5107 * @main loader |
|
5108 * @submodule loader-base |
|
5109 */ |
|
5110 |
|
5111 var NOT_FOUND = {}, |
|
5112 NO_REQUIREMENTS = [], |
|
5113 MAX_URL_LENGTH = 1024, |
|
5114 GLOBAL_ENV = YUI.Env, |
|
5115 GLOBAL_LOADED = GLOBAL_ENV._loaded, |
|
5116 CSS = 'css', |
|
5117 JS = 'js', |
|
5118 INTL = 'intl', |
|
5119 DEFAULT_SKIN = 'sam', |
|
5120 VERSION = Y.version, |
|
5121 ROOT_LANG = '', |
|
5122 YObject = Y.Object, |
|
5123 oeach = YObject.each, |
|
5124 yArray = Y.Array, |
|
5125 _queue = GLOBAL_ENV._loaderQueue, |
|
5126 META = GLOBAL_ENV[VERSION], |
|
5127 SKIN_PREFIX = 'skin-', |
|
5128 L = Y.Lang, |
|
5129 ON_PAGE = GLOBAL_ENV.mods, |
|
5130 modulekey, |
|
5131 _path = function(dir, file, type, nomin) { |
|
5132 var path = dir + '/' + file; |
|
5133 if (!nomin) { |
|
5134 path += '-min'; |
|
5135 } |
|
5136 path += '.' + (type || CSS); |
|
5137 |
|
5138 return path; |
|
5139 }; |
|
5140 |
|
5141 |
|
5142 if (!YUI.Env._cssLoaded) { |
|
5143 YUI.Env._cssLoaded = {}; |
|
5144 } |
|
5145 |
|
5146 |
|
5147 /** |
|
5148 * The component metadata is stored in Y.Env.meta. |
|
5149 * Part of the loader module. |
|
5150 * @property meta |
|
5151 * @for YUI |
|
5152 */ |
|
5153 Y.Env.meta = META; |
|
5154 |
|
5155 /** |
|
5156 * Loader dynamically loads script and css files. It includes the dependency |
|
5157 * info for the version of the library in use, and will automatically pull in |
|
5158 * dependencies for the modules requested. It can load the |
|
5159 * files from the Yahoo! CDN, and it can utilize the combo service provided on |
|
5160 * this network to reduce the number of http connections required to download |
|
5161 * YUI files. You can also specify an external, custom combo service to host |
|
5162 * your modules as well. |
|
5163 |
|
5164 var Y = YUI(); |
|
5165 var loader = new Y.Loader({ |
|
5166 filter: 'debug', |
|
5167 base: '../../', |
|
5168 root: 'build/', |
|
5169 combine: true, |
|
5170 require: ['node', 'dd', 'console'] |
|
5171 }); |
|
5172 var out = loader.resolve(true); |
|
5173 |
|
5174 * @constructor |
|
5175 * @class Loader |
|
5176 * @param {Object} config an optional set of configuration options. |
|
5177 * @param {String} config.base The base dir which to fetch this module from |
|
5178 * @param {String} config.comboBase The Combo service base path. Ex: `http://yui.yahooapis.com/combo?` |
|
5179 * @param {String} config.root The root path to prepend to module names for the combo service. Ex: `2.5.2/build/` |
|
5180 * @param {String|Object} config.filter A filter to apply to result urls. <a href="#property_filter">See filter property</a> |
|
5181 * @param {Object} config.filters Per-component filter specification. If specified for a given component, this overrides the filter config. |
|
5182 * @param {Boolean} config.combine Use a combo service to reduce the number of http connections required to load your dependencies |
|
5183 * @param {Boolean} [config.async=true] Fetch files in async |
|
5184 * @param {Array} config.ignore: A list of modules that should never be dynamically loaded |
|
5185 * @param {Array} config.force A list of modules that should always be loaded when required, even if already present on the page |
|
5186 * @param {HTMLElement|String} config.insertBefore Node or id for a node that should be used as the insertion point for new nodes |
|
5187 * @param {Object} config.jsAttributes Object literal containing attributes to add to script nodes |
|
5188 * @param {Object} config.cssAttributes Object literal containing attributes to add to link nodes |
|
5189 * @param {Number} config.timeout The number of milliseconds before a timeout occurs when dynamically loading nodes. If not set, there is no timeout |
|
5190 * @param {Object} config.context Execution context for all callbacks |
|
5191 * @param {Function} config.onSuccess Callback for the 'success' event |
|
5192 * @param {Function} config.onFailure Callback for the 'failure' event |
|
5193 * @param {Function} config.onCSS Callback for the 'CSSComplete' event. When loading YUI components with CSS the CSS is loaded first, then the script. This provides a moment you can tie into to improve the presentation of the page while the script is loading. |
|
5194 * @param {Function} config.onTimeout Callback for the 'timeout' event |
|
5195 * @param {Function} config.onProgress Callback executed each time a script or css file is loaded |
|
5196 * @param {Object} config.modules A list of module definitions. See <a href="#method_addModule">Loader.addModule</a> for the supported module metadata |
|
5197 * @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`. |
|
5198 * @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. |
|
5199 * @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. |
|
5200 */ |
|
5201 Y.Loader = function(o) { |
|
5202 |
|
5203 var self = this; |
|
5204 |
|
5205 //Catch no config passed. |
|
5206 o = o || {}; |
|
5207 |
|
5208 modulekey = META.md5; |
|
5209 |
|
5210 /** |
|
5211 * Internal callback to handle multiple internal insert() calls |
|
5212 * so that css is inserted prior to js |
|
5213 * @property _internalCallback |
|
5214 * @private |
|
5215 */ |
|
5216 // self._internalCallback = null; |
|
5217 |
|
5218 /** |
|
5219 * Callback that will be executed when the loader is finished |
|
5220 * with an insert |
|
5221 * @method onSuccess |
|
5222 * @type function |
|
5223 */ |
|
5224 // self.onSuccess = null; |
|
5225 |
|
5226 /** |
|
5227 * Callback that will be executed if there is a failure |
|
5228 * @method onFailure |
|
5229 * @type function |
|
5230 */ |
|
5231 // self.onFailure = null; |
|
5232 |
|
5233 /** |
|
5234 * Callback for the 'CSSComplete' event. When loading YUI components |
|
5235 * with CSS the CSS is loaded first, then the script. This provides |
|
5236 * a moment you can tie into to improve the presentation of the page |
|
5237 * while the script is loading. |
|
5238 * @method onCSS |
|
5239 * @type function |
|
5240 */ |
|
5241 // self.onCSS = null; |
|
5242 |
|
5243 /** |
|
5244 * Callback executed each time a script or css file is loaded |
|
5245 * @method onProgress |
|
5246 * @type function |
|
5247 */ |
|
5248 // self.onProgress = null; |
|
5249 |
|
5250 /** |
|
5251 * Callback that will be executed if a timeout occurs |
|
5252 * @method onTimeout |
|
5253 * @type function |
|
5254 */ |
|
5255 // self.onTimeout = null; |
|
5256 |
|
5257 /** |
|
5258 * The execution context for all callbacks |
|
5259 * @property context |
|
5260 * @default {YUI} the YUI instance |
|
5261 */ |
|
5262 self.context = Y; |
|
5263 |
|
5264 /** |
|
5265 * Data that is passed to all callbacks |
|
5266 * @property data |
|
5267 */ |
|
5268 // self.data = null; |
|
5269 |
|
5270 /** |
|
5271 * Node reference or id where new nodes should be inserted before |
|
5272 * @property insertBefore |
|
5273 * @type string|HTMLElement |
|
5274 */ |
|
5275 // self.insertBefore = null; |
|
5276 |
|
5277 /** |
|
5278 * The charset attribute for inserted nodes |
|
5279 * @property charset |
|
5280 * @type string |
|
5281 * @deprecated , use cssAttributes or jsAttributes. |
|
5282 */ |
|
5283 // self.charset = null; |
|
5284 |
|
5285 /** |
|
5286 * An object literal containing attributes to add to link nodes |
|
5287 * @property cssAttributes |
|
5288 * @type object |
|
5289 */ |
|
5290 // self.cssAttributes = null; |
|
5291 |
|
5292 /** |
|
5293 * An object literal containing attributes to add to script nodes |
|
5294 * @property jsAttributes |
|
5295 * @type object |
|
5296 */ |
|
5297 // self.jsAttributes = null; |
|
5298 |
|
5299 /** |
|
5300 * The base directory. |
|
5301 * @property base |
|
5302 * @type string |
|
5303 * @default http://yui.yahooapis.com/[YUI VERSION]/build/ |
|
5304 */ |
|
5305 self.base = Y.Env.meta.base + Y.Env.meta.root; |
|
5306 |
|
5307 /** |
|
5308 * Base path for the combo service |
|
5309 * @property comboBase |
|
5310 * @type string |
|
5311 * @default http://yui.yahooapis.com/combo? |
|
5312 */ |
|
5313 self.comboBase = Y.Env.meta.comboBase; |
|
5314 |
|
5315 /* |
|
5316 * Base path for language packs. |
|
5317 */ |
|
5318 // self.langBase = Y.Env.meta.langBase; |
|
5319 // self.lang = ""; |
|
5320 |
|
5321 /** |
|
5322 * If configured, the loader will attempt to use the combo |
|
5323 * service for YUI resources and configured external resources. |
|
5324 * @property combine |
|
5325 * @type boolean |
|
5326 * @default true if a base dir isn't in the config |
|
5327 */ |
|
5328 self.combine = o.base && |
|
5329 (o.base.indexOf(self.comboBase.substr(0, 20)) > -1); |
|
5330 |
|
5331 /** |
|
5332 * The default seperator to use between files in a combo URL |
|
5333 * @property comboSep |
|
5334 * @type {String} |
|
5335 * @default Ampersand |
|
5336 */ |
|
5337 self.comboSep = '&'; |
|
5338 /** |
|
5339 * Max url length for combo urls. The default is 1024. This is the URL |
|
5340 * limit for the Yahoo! hosted combo servers. If consuming |
|
5341 * a different combo service that has a different URL limit |
|
5342 * it is possible to override this default by supplying |
|
5343 * the maxURLLength config option. The config option will |
|
5344 * only take effect if lower than the default. |
|
5345 * |
|
5346 * @property maxURLLength |
|
5347 * @type int |
|
5348 */ |
|
5349 self.maxURLLength = MAX_URL_LENGTH; |
|
5350 |
|
5351 /** |
|
5352 * Ignore modules registered on the YUI global |
|
5353 * @property ignoreRegistered |
|
5354 * @default false |
|
5355 */ |
|
5356 self.ignoreRegistered = o.ignoreRegistered; |
|
5357 |
|
5358 /** |
|
5359 * Root path to prepend to module path for the combo |
|
5360 * service |
|
5361 * @property root |
|
5362 * @type string |
|
5363 * @default [YUI VERSION]/build/ |
|
5364 */ |
|
5365 self.root = Y.Env.meta.root; |
|
5366 |
|
5367 /** |
|
5368 * Timeout value in milliseconds. If set, self value will be used by |
|
5369 * the get utility. the timeout event will fire if |
|
5370 * a timeout occurs. |
|
5371 * @property timeout |
|
5372 * @type int |
|
5373 */ |
|
5374 self.timeout = 0; |
|
5375 |
|
5376 /** |
|
5377 * A list of modules that should not be loaded, even if |
|
5378 * they turn up in the dependency tree |
|
5379 * @property ignore |
|
5380 * @type string[] |
|
5381 */ |
|
5382 // self.ignore = null; |
|
5383 |
|
5384 /** |
|
5385 * A list of modules that should always be loaded, even |
|
5386 * if they have already been inserted into the page. |
|
5387 * @property force |
|
5388 * @type string[] |
|
5389 */ |
|
5390 // self.force = null; |
|
5391 |
|
5392 self.forceMap = {}; |
|
5393 |
|
5394 /** |
|
5395 * Should we allow rollups |
|
5396 * @property allowRollup |
|
5397 * @type boolean |
|
5398 * @default false |
|
5399 */ |
|
5400 self.allowRollup = false; |
|
5401 |
|
5402 /** |
|
5403 * A filter to apply to result urls. This filter will modify the default |
|
5404 * path for all modules. The default path for the YUI library is the |
|
5405 * minified version of the files (e.g., event-min.js). The filter property |
|
5406 * can be a predefined filter or a custom filter. The valid predefined |
|
5407 * filters are: |
|
5408 * <dl> |
|
5409 * <dt>DEBUG</dt> |
|
5410 * <dd>Selects the debug versions of the library (e.g., event-debug.js). |
|
5411 * This option will automatically include the Logger widget</dd> |
|
5412 * <dt>RAW</dt> |
|
5413 * <dd>Selects the non-minified version of the library (e.g., event.js). |
|
5414 * </dd> |
|
5415 * </dl> |
|
5416 * You can also define a custom filter, which must be an object literal |
|
5417 * containing a search expression and a replace string: |
|
5418 * |
|
5419 * myFilter: { |
|
5420 * 'searchExp': "-min\\.js", |
|
5421 * 'replaceStr': "-debug.js" |
|
5422 * } |
|
5423 * |
|
5424 * @property filter |
|
5425 * @type string| {searchExp: string, replaceStr: string} |
|
5426 */ |
|
5427 // self.filter = null; |
|
5428 |
|
5429 /** |
|
5430 * per-component filter specification. If specified for a given |
|
5431 * component, this overrides the filter config. |
|
5432 * @property filters |
|
5433 * @type object |
|
5434 */ |
|
5435 self.filters = {}; |
|
5436 |
|
5437 /** |
|
5438 * The list of requested modules |
|
5439 * @property required |
|
5440 * @type {string: boolean} |
|
5441 */ |
|
5442 self.required = {}; |
|
5443 |
|
5444 /** |
|
5445 * If a module name is predefined when requested, it is checked againsts |
|
5446 * the patterns provided in this property. If there is a match, the |
|
5447 * module is added with the default configuration. |
|
5448 * |
|
5449 * At the moment only supporting module prefixes, but anticipate |
|
5450 * supporting at least regular expressions. |
|
5451 * @property patterns |
|
5452 * @type Object |
|
5453 */ |
|
5454 // self.patterns = Y.merge(Y.Env.meta.patterns); |
|
5455 self.patterns = {}; |
|
5456 |
|
5457 /** |
|
5458 * The library metadata |
|
5459 * @property moduleInfo |
|
5460 */ |
|
5461 // self.moduleInfo = Y.merge(Y.Env.meta.moduleInfo); |
|
5462 self.moduleInfo = {}; |
|
5463 |
|
5464 self.groups = Y.merge(Y.Env.meta.groups); |
|
5465 |
|
5466 /** |
|
5467 * Provides the information used to skin the skinnable components. |
|
5468 * The following skin definition would result in 'skin1' and 'skin2' |
|
5469 * being loaded for calendar (if calendar was requested), and |
|
5470 * 'sam' for all other skinnable components: |
|
5471 * |
|
5472 * skin: { |
|
5473 * // The default skin, which is automatically applied if not |
|
5474 * // overriden by a component-specific skin definition. |
|
5475 * // Change this in to apply a different skin globally |
|
5476 * defaultSkin: 'sam', |
|
5477 * |
|
5478 * // This is combined with the loader base property to get |
|
5479 * // the default root directory for a skin. ex: |
|
5480 * // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/ |
|
5481 * base: 'assets/skins/', |
|
5482 * |
|
5483 * // Any component-specific overrides can be specified here, |
|
5484 * // making it possible to load different skins for different |
|
5485 * // components. It is possible to load more than one skin |
|
5486 * // for a given component as well. |
|
5487 * overrides: { |
|
5488 * calendar: ['skin1', 'skin2'] |
|
5489 * } |
|
5490 * } |
|
5491 * @property skin |
|
5492 * @type {Object} |
|
5493 */ |
|
5494 self.skin = Y.merge(Y.Env.meta.skin); |
|
5495 |
|
5496 /* |
|
5497 * Map of conditional modules |
|
5498 * @since 3.2.0 |
|
5499 */ |
|
5500 self.conditions = {}; |
|
5501 |
|
5502 // map of modules with a hash of modules that meet the requirement |
|
5503 // self.provides = {}; |
|
5504 |
|
5505 self.config = o; |
|
5506 self._internal = true; |
|
5507 |
|
5508 self._populateCache(); |
|
5509 |
|
5510 /** |
|
5511 * Set when beginning to compute the dependency tree. |
|
5512 * Composed of what YUI reports to be loaded combined |
|
5513 * with what has been loaded by any instance on the page |
|
5514 * with the version number specified in the metadata. |
|
5515 * @property loaded |
|
5516 * @type {string: boolean} |
|
5517 */ |
|
5518 self.loaded = GLOBAL_LOADED[VERSION]; |
|
5519 |
|
5520 |
|
5521 /** |
|
5522 * Should Loader fetch scripts in `async`, defaults to `true` |
|
5523 * @property async |
|
5524 */ |
|
5525 |
|
5526 self.async = true; |
|
5527 |
|
5528 self._inspectPage(); |
|
5529 |
|
5530 self._internal = false; |
|
5531 |
|
5532 self._config(o); |
|
5533 |
|
5534 self.forceMap = (self.force) ? Y.Array.hash(self.force) : {}; |
|
5535 |
|
5536 self.testresults = null; |
|
5537 |
|
5538 if (Y.config.tests) { |
|
5539 self.testresults = Y.config.tests; |
|
5540 } |
|
5541 |
|
5542 /** |
|
5543 * List of rollup files found in the library metadata |
|
5544 * @property rollups |
|
5545 */ |
|
5546 // self.rollups = null; |
|
5547 |
|
5548 /** |
|
5549 * Whether or not to load optional dependencies for |
|
5550 * the requested modules |
|
5551 * @property loadOptional |
|
5552 * @type boolean |
|
5553 * @default false |
|
5554 */ |
|
5555 // self.loadOptional = false; |
|
5556 |
|
5557 /** |
|
5558 * All of the derived dependencies in sorted order, which |
|
5559 * will be populated when either calculate() or insert() |
|
5560 * is called |
|
5561 * @property sorted |
|
5562 * @type string[] |
|
5563 */ |
|
5564 self.sorted = []; |
|
5565 |
|
5566 /* |
|
5567 * A list of modules to attach to the YUI instance when complete. |
|
5568 * If not supplied, the sorted list of dependencies are applied. |
|
5569 * @property attaching |
|
5570 */ |
|
5571 // self.attaching = null; |
|
5572 |
|
5573 /** |
|
5574 * Flag to indicate the dependency tree needs to be recomputed |
|
5575 * if insert is called again. |
|
5576 * @property dirty |
|
5577 * @type boolean |
|
5578 * @default true |
|
5579 */ |
|
5580 self.dirty = true; |
|
5581 |
|
5582 /** |
|
5583 * List of modules inserted by the utility |
|
5584 * @property inserted |
|
5585 * @type {string: boolean} |
|
5586 */ |
|
5587 self.inserted = {}; |
|
5588 |
|
5589 /** |
|
5590 * List of skipped modules during insert() because the module |
|
5591 * was not defined |
|
5592 * @property skipped |
|
5593 */ |
|
5594 self.skipped = {}; |
|
5595 |
|
5596 // Y.on('yui:load', self.loadNext, self); |
|
5597 |
|
5598 self.tested = {}; |
|
5599 |
|
5600 /* |
|
5601 * Cached sorted calculate results |
|
5602 * @property results |
|
5603 * @since 3.2.0 |
|
5604 */ |
|
5605 //self.results = {}; |
|
5606 |
|
5607 if (self.ignoreRegistered) { |
|
5608 //Clear inpage already processed modules. |
|
5609 self._resetModules(); |
|
5610 } |
|
5611 |
|
5612 }; |
|
5613 |
|
5614 Y.Loader.prototype = { |
|
5615 /** |
|
5616 * Checks the cache for modules and conditions, if they do not exist |
|
5617 * process the default metadata and populate the local moduleInfo hash. |
|
5618 * @method _populateCache |
|
5619 * @private |
|
5620 */ |
|
5621 _populateCache: function() { |
|
5622 var self = this, |
|
5623 defaults = META.modules, |
|
5624 cache = GLOBAL_ENV._renderedMods, |
|
5625 i; |
|
5626 |
|
5627 if (cache && !self.ignoreRegistered) { |
|
5628 for (i in cache) { |
|
5629 if (cache.hasOwnProperty(i)) { |
|
5630 self.moduleInfo[i] = Y.merge(cache[i]); |
|
5631 } |
|
5632 } |
|
5633 |
|
5634 cache = GLOBAL_ENV._conditions; |
|
5635 for (i in cache) { |
|
5636 if (cache.hasOwnProperty(i)) { |
|
5637 self.conditions[i] = Y.merge(cache[i]); |
|
5638 } |
|
5639 } |
|
5640 |
|
5641 } else { |
|
5642 for (i in defaults) { |
|
5643 if (defaults.hasOwnProperty(i)) { |
|
5644 self.addModule(defaults[i], i); |
|
5645 } |
|
5646 } |
|
5647 } |
|
5648 |
|
5649 }, |
|
5650 /** |
|
5651 * Reset modules in the module cache to a pre-processed state so additional |
|
5652 * computations with a different skin or language will work as expected. |
|
5653 * @method _resetModules |
|
5654 * @private |
|
5655 */ |
|
5656 _resetModules: function() { |
|
5657 var self = this, i, o, |
|
5658 mod, name, details; |
|
5659 for (i in self.moduleInfo) { |
|
5660 if (self.moduleInfo.hasOwnProperty(i)) { |
|
5661 mod = self.moduleInfo[i]; |
|
5662 name = mod.name; |
|
5663 details = (YUI.Env.mods[name] ? YUI.Env.mods[name].details : null); |
|
5664 |
|
5665 if (details) { |
|
5666 self.moduleInfo[name]._reset = true; |
|
5667 self.moduleInfo[name].requires = details.requires || []; |
|
5668 self.moduleInfo[name].optional = details.optional || []; |
|
5669 self.moduleInfo[name].supersedes = details.supercedes || []; |
|
5670 } |
|
5671 |
|
5672 if (mod.defaults) { |
|
5673 for (o in mod.defaults) { |
|
5674 if (mod.defaults.hasOwnProperty(o)) { |
|
5675 if (mod[o]) { |
|
5676 mod[o] = mod.defaults[o]; |
|
5677 } |
|
5678 } |
|
5679 } |
|
5680 } |
|
5681 delete mod.langCache; |
|
5682 delete mod.skinCache; |
|
5683 if (mod.skinnable) { |
|
5684 self._addSkin(self.skin.defaultSkin, mod.name); |
|
5685 } |
|
5686 } |
|
5687 } |
|
5688 }, |
|
5689 /** |
|
5690 Regex that matches a CSS URL. Used to guess the file type when it's not |
|
5691 specified. |
|
5692 |
|
5693 @property REGEX_CSS |
|
5694 @type RegExp |
|
5695 @final |
|
5696 @protected |
|
5697 @since 3.5.0 |
|
5698 **/ |
|
5699 REGEX_CSS: /\.css(?:[?;].*)?$/i, |
|
5700 |
|
5701 /** |
|
5702 * Default filters for raw and debug |
|
5703 * @property FILTER_DEFS |
|
5704 * @type Object |
|
5705 * @final |
|
5706 * @protected |
|
5707 */ |
|
5708 FILTER_DEFS: { |
|
5709 RAW: { |
|
5710 'searchExp': '-min\\.js', |
|
5711 'replaceStr': '.js' |
|
5712 }, |
|
5713 DEBUG: { |
|
5714 'searchExp': '-min\\.js', |
|
5715 'replaceStr': '-debug.js' |
|
5716 }, |
|
5717 COVERAGE: { |
|
5718 'searchExp': '-min\\.js', |
|
5719 'replaceStr': '-coverage.js' |
|
5720 } |
|
5721 }, |
|
5722 /* |
|
5723 * Check the pages meta-data and cache the result. |
|
5724 * @method _inspectPage |
|
5725 * @private |
|
5726 */ |
|
5727 _inspectPage: function() { |
|
5728 var self = this, v, m, req, mr, i; |
|
5729 |
|
5730 //Inspect the page for CSS only modules and mark them as loaded. |
|
5731 for (i in self.moduleInfo) { |
|
5732 if (self.moduleInfo.hasOwnProperty(i)) { |
|
5733 v = self.moduleInfo[i]; |
|
5734 if (v.type && v.type === CSS) { |
|
5735 if (self.isCSSLoaded(v.name)) { |
|
5736 Y.log('Found CSS module on page: ' + v.name, 'info', 'loader'); |
|
5737 self.loaded[i] = true; |
|
5738 } |
|
5739 } |
|
5740 } |
|
5741 } |
|
5742 for (i in ON_PAGE) { |
|
5743 if (ON_PAGE.hasOwnProperty(i)) { |
|
5744 v = ON_PAGE[i]; |
|
5745 if (v.details) { |
|
5746 m = self.moduleInfo[v.name]; |
|
5747 req = v.details.requires; |
|
5748 mr = m && m.requires; |
|
5749 |
|
5750 if (m) { |
|
5751 if (!m._inspected && req && mr.length !== req.length) { |
|
5752 // console.log('deleting ' + m.name); |
|
5753 delete m.expanded; |
|
5754 } |
|
5755 } else { |
|
5756 m = self.addModule(v.details, i); |
|
5757 } |
|
5758 m._inspected = true; |
|
5759 } |
|
5760 } |
|
5761 } |
|
5762 }, |
|
5763 /* |
|
5764 * returns true if b is not loaded, and is required directly or by means of modules it supersedes. |
|
5765 * @private |
|
5766 * @method _requires |
|
5767 * @param {String} mod1 The first module to compare |
|
5768 * @param {String} mod2 The second module to compare |
|
5769 */ |
|
5770 _requires: function(mod1, mod2) { |
|
5771 |
|
5772 var i, rm, after_map, s, |
|
5773 info = this.moduleInfo, |
|
5774 m = info[mod1], |
|
5775 other = info[mod2]; |
|
5776 |
|
5777 if (!m || !other) { |
|
5778 return false; |
|
5779 } |
|
5780 |
|
5781 rm = m.expanded_map; |
|
5782 after_map = m.after_map; |
|
5783 |
|
5784 // check if this module should be sorted after the other |
|
5785 // do this first to short circut circular deps |
|
5786 if (after_map && (mod2 in after_map)) { |
|
5787 return true; |
|
5788 } |
|
5789 |
|
5790 after_map = other.after_map; |
|
5791 |
|
5792 // and vis-versa |
|
5793 if (after_map && (mod1 in after_map)) { |
|
5794 return false; |
|
5795 } |
|
5796 |
|
5797 // check if this module requires one the other supersedes |
|
5798 s = info[mod2] && info[mod2].supersedes; |
|
5799 if (s) { |
|
5800 for (i = 0; i < s.length; i++) { |
|
5801 if (this._requires(mod1, s[i])) { |
|
5802 return true; |
|
5803 } |
|
5804 } |
|
5805 } |
|
5806 |
|
5807 s = info[mod1] && info[mod1].supersedes; |
|
5808 if (s) { |
|
5809 for (i = 0; i < s.length; i++) { |
|
5810 if (this._requires(mod2, s[i])) { |
|
5811 return false; |
|
5812 } |
|
5813 } |
|
5814 } |
|
5815 |
|
5816 // check if this module requires the other directly |
|
5817 // if (r && yArray.indexOf(r, mod2) > -1) { |
|
5818 if (rm && (mod2 in rm)) { |
|
5819 return true; |
|
5820 } |
|
5821 |
|
5822 // external css files should be sorted below yui css |
|
5823 if (m.ext && m.type === CSS && !other.ext && other.type === CSS) { |
|
5824 return true; |
|
5825 } |
|
5826 |
|
5827 return false; |
|
5828 }, |
|
5829 /** |
|
5830 * Apply a new config to the Loader instance |
|
5831 * @method _config |
|
5832 * @private |
|
5833 * @param {Object} o The new configuration |
|
5834 */ |
|
5835 _config: function(o) { |
|
5836 var i, j, val, a, f, group, groupName, self = this, |
|
5837 mods = [], mod; |
|
5838 // apply config values |
|
5839 if (o) { |
|
5840 for (i in o) { |
|
5841 if (o.hasOwnProperty(i)) { |
|
5842 val = o[i]; |
|
5843 //TODO This should be a case |
|
5844 if (i === 'require') { |
|
5845 self.require(val); |
|
5846 } else if (i === 'skin') { |
|
5847 //If the config.skin is a string, format to the expected object |
|
5848 if (typeof val === 'string') { |
|
5849 self.skin.defaultSkin = o.skin; |
|
5850 val = { |
|
5851 defaultSkin: val |
|
5852 }; |
|
5853 } |
|
5854 |
|
5855 Y.mix(self.skin, val, true); |
|
5856 } else if (i === 'groups') { |
|
5857 for (j in val) { |
|
5858 if (val.hasOwnProperty(j)) { |
|
5859 // Y.log('group: ' + j); |
|
5860 groupName = j; |
|
5861 group = val[j]; |
|
5862 self.addGroup(group, groupName); |
|
5863 if (group.aliases) { |
|
5864 for (a in group.aliases) { |
|
5865 if (group.aliases.hasOwnProperty(a)) { |
|
5866 self.addAlias(group.aliases[a], a); |
|
5867 } |
|
5868 } |
|
5869 } |
|
5870 } |
|
5871 } |
|
5872 |
|
5873 } else if (i === 'modules') { |
|
5874 // add a hash of module definitions |
|
5875 for (j in val) { |
|
5876 if (val.hasOwnProperty(j)) { |
|
5877 self.addModule(val[j], j); |
|
5878 } |
|
5879 } |
|
5880 } else if (i === 'aliases') { |
|
5881 for (j in val) { |
|
5882 if (val.hasOwnProperty(j)) { |
|
5883 self.addAlias(val[j], j); |
|
5884 } |
|
5885 } |
|
5886 } else if (i === 'gallery') { |
|
5887 if (this.groups.gallery.update) { |
|
5888 this.groups.gallery.update(val, o); |
|
5889 } |
|
5890 } else if (i === 'yui2' || i === '2in3') { |
|
5891 if (this.groups.yui2.update) { |
|
5892 this.groups.yui2.update(o['2in3'], o.yui2, o); |
|
5893 } |
|
5894 } else { |
|
5895 self[i] = val; |
|
5896 } |
|
5897 } |
|
5898 } |
|
5899 } |
|
5900 |
|
5901 // fix filter |
|
5902 f = self.filter; |
|
5903 |
|
5904 if (L.isString(f)) { |
|
5905 f = f.toUpperCase(); |
|
5906 self.filterName = f; |
|
5907 self.filter = self.FILTER_DEFS[f]; |
|
5908 if (f === 'DEBUG') { |
|
5909 self.require('yui-log', 'dump'); |
|
5910 } |
|
5911 } |
|
5912 |
|
5913 if (self.filterName && self.coverage) { |
|
5914 if (self.filterName === 'COVERAGE' && L.isArray(self.coverage) && self.coverage.length) { |
|
5915 for (i = 0; i < self.coverage.length; i++) { |
|
5916 mod = self.coverage[i]; |
|
5917 if (self.moduleInfo[mod] && self.moduleInfo[mod].use) { |
|
5918 mods = [].concat(mods, self.moduleInfo[mod].use); |
|
5919 } else { |
|
5920 mods.push(mod); |
|
5921 } |
|
5922 } |
|
5923 self.filters = self.filters || {}; |
|
5924 Y.Array.each(mods, function(mod) { |
|
5925 self.filters[mod] = self.FILTER_DEFS.COVERAGE; |
|
5926 }); |
|
5927 self.filterName = 'RAW'; |
|
5928 self.filter = self.FILTER_DEFS[self.filterName]; |
|
5929 } |
|
5930 } |
|
5931 |
|
5932 }, |
|
5933 |
|
5934 /** |
|
5935 * Returns the skin module name for the specified skin name. If a |
|
5936 * module name is supplied, the returned skin module name is |
|
5937 * specific to the module passed in. |
|
5938 * @method formatSkin |
|
5939 * @param {string} skin the name of the skin. |
|
5940 * @param {string} mod optional: the name of a module to skin. |
|
5941 * @return {string} the full skin module name. |
|
5942 */ |
|
5943 formatSkin: function(skin, mod) { |
|
5944 var s = SKIN_PREFIX + skin; |
|
5945 if (mod) { |
|
5946 s = s + '-' + mod; |
|
5947 } |
|
5948 |
|
5949 return s; |
|
5950 }, |
|
5951 |
|
5952 /** |
|
5953 * Adds the skin def to the module info |
|
5954 * @method _addSkin |
|
5955 * @param {string} skin the name of the skin. |
|
5956 * @param {string} mod the name of the module. |
|
5957 * @param {string} parent parent module if this is a skin of a |
|
5958 * submodule or plugin. |
|
5959 * @return {string} the module name for the skin. |
|
5960 * @private |
|
5961 */ |
|
5962 _addSkin: function(skin, mod, parent) { |
|
5963 var mdef, pkg, name, nmod, |
|
5964 info = this.moduleInfo, |
|
5965 sinf = this.skin, |
|
5966 ext = info[mod] && info[mod].ext; |
|
5967 |
|
5968 // Add a module definition for the module-specific skin css |
|
5969 if (mod) { |
|
5970 name = this.formatSkin(skin, mod); |
|
5971 if (!info[name]) { |
|
5972 mdef = info[mod]; |
|
5973 pkg = mdef.pkg || mod; |
|
5974 nmod = { |
|
5975 skin: true, |
|
5976 name: name, |
|
5977 group: mdef.group, |
|
5978 type: 'css', |
|
5979 after: sinf.after, |
|
5980 path: (parent || pkg) + '/' + sinf.base + skin + |
|
5981 '/' + mod + '.css', |
|
5982 ext: ext |
|
5983 }; |
|
5984 if (mdef.base) { |
|
5985 nmod.base = mdef.base; |
|
5986 } |
|
5987 if (mdef.configFn) { |
|
5988 nmod.configFn = mdef.configFn; |
|
5989 } |
|
5990 this.addModule(nmod, name); |
|
5991 |
|
5992 Y.log('Adding skin (' + name + '), ' + parent + ', ' + pkg + ', ' + info[name].path, 'info', 'loader'); |
|
5993 } |
|
5994 } |
|
5995 |
|
5996 return name; |
|
5997 }, |
|
5998 /** |
|
5999 * Adds an alias module to the system |
|
6000 * @method addAlias |
|
6001 * @param {Array} use An array of modules that makes up this alias |
|
6002 * @param {String} name The name of the alias |
|
6003 * @example |
|
6004 * var loader = new Y.Loader({}); |
|
6005 * loader.addAlias([ 'node', 'yql' ], 'davglass'); |
|
6006 * loader.require(['davglass']); |
|
6007 * var out = loader.resolve(true); |
|
6008 * |
|
6009 * //out.js will contain Node and YQL modules |
|
6010 */ |
|
6011 addAlias: function(use, name) { |
|
6012 YUI.Env.aliases[name] = use; |
|
6013 this.addModule({ |
|
6014 name: name, |
|
6015 use: use |
|
6016 }); |
|
6017 }, |
|
6018 /** |
|
6019 * Add a new module group |
|
6020 * @method addGroup |
|
6021 * @param {Object} config An object containing the group configuration data |
|
6022 * @param {String} config.name required, the group name |
|
6023 * @param {String} config.base The base directory for this module group |
|
6024 * @param {String} config.root The root path to add to each combo resource path |
|
6025 * @param {Boolean} config.combine Should the request be combined |
|
6026 * @param {String} config.comboBase Combo service base path |
|
6027 * @param {Object} config.modules The group of modules |
|
6028 * @param {String} name the group name. |
|
6029 * @example |
|
6030 * var loader = new Y.Loader({}); |
|
6031 * loader.addGroup({ |
|
6032 * name: 'davglass', |
|
6033 * combine: true, |
|
6034 * comboBase: '/combo?', |
|
6035 * root: '', |
|
6036 * modules: { |
|
6037 * //Module List here |
|
6038 * } |
|
6039 * }, 'davglass'); |
|
6040 */ |
|
6041 addGroup: function(o, name) { |
|
6042 var mods = o.modules, |
|
6043 self = this, i, v; |
|
6044 |
|
6045 name = name || o.name; |
|
6046 o.name = name; |
|
6047 self.groups[name] = o; |
|
6048 |
|
6049 if (o.patterns) { |
|
6050 for (i in o.patterns) { |
|
6051 if (o.patterns.hasOwnProperty(i)) { |
|
6052 o.patterns[i].group = name; |
|
6053 self.patterns[i] = o.patterns[i]; |
|
6054 } |
|
6055 } |
|
6056 } |
|
6057 |
|
6058 if (mods) { |
|
6059 for (i in mods) { |
|
6060 if (mods.hasOwnProperty(i)) { |
|
6061 v = mods[i]; |
|
6062 if (typeof v === 'string') { |
|
6063 v = { name: i, fullpath: v }; |
|
6064 } |
|
6065 v.group = name; |
|
6066 self.addModule(v, i); |
|
6067 } |
|
6068 } |
|
6069 } |
|
6070 }, |
|
6071 |
|
6072 /** |
|
6073 * Add a new module to the component metadata. |
|
6074 * @method addModule |
|
6075 * @param {Object} config An object containing the module data. |
|
6076 * @param {String} config.name Required, the component name |
|
6077 * @param {String} config.type Required, the component type (js or css) |
|
6078 * @param {String} config.path Required, the path to the script from `base` |
|
6079 * @param {Array} config.requires Array of modules required by this component |
|
6080 * @param {Array} [config.optional] Array of optional modules for this component |
|
6081 * @param {Array} [config.supersedes] Array of the modules this component replaces |
|
6082 * @param {Array} [config.after] Array of modules the components which, if present, should be sorted above this one |
|
6083 * @param {Object} [config.after_map] Faster alternative to 'after' -- supply a hash instead of an array |
|
6084 * @param {Number} [config.rollup] The number of superseded modules required for automatic rollup |
|
6085 * @param {String} [config.fullpath] If `fullpath` is specified, this is used instead of the configured `base + path` |
|
6086 * @param {Boolean} [config.skinnable] Flag to determine if skin assets should automatically be pulled in |
|
6087 * @param {Object} [config.submodules] Hash of submodules |
|
6088 * @param {String} [config.group] The group the module belongs to -- this is set automatically when it is added as part of a group configuration. |
|
6089 * @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"]` |
|
6090 * @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: |
|
6091 * @param {String} [config.condition.trigger] The name of a module that can trigger the auto-load |
|
6092 * @param {Function} [config.condition.test] A function that returns true when the module is to be loaded. |
|
6093 * @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"`. |
|
6094 * @param {String} [config.condition.when] Specifies the load order of the conditional module |
|
6095 * with regard to the position of the trigger module. |
|
6096 * This should be one of three values: `before`, `after`, or `instead`. The default is `after`. |
|
6097 * @param {Object} [config.testresults] A hash of test results from `Y.Features.all()` |
|
6098 * @param {Function} [config.configFn] A function to exectute when configuring this module |
|
6099 * @param {Object} config.configFn.mod The module config, modifying this object will modify it's config. Returning false will delete the module's config. |
|
6100 * @param {String} [name] The module name, required if not in the module data. |
|
6101 * @return {Object} the module definition or null if the object passed in did not provide all required attributes. |
|
6102 */ |
|
6103 addModule: function(o, name) { |
|
6104 name = name || o.name; |
|
6105 |
|
6106 if (typeof o === 'string') { |
|
6107 o = { name: name, fullpath: o }; |
|
6108 } |
|
6109 |
|
6110 |
|
6111 var subs, i, l, t, sup, s, smod, plugins, plug, |
|
6112 j, langs, packName, supName, flatSup, flatLang, lang, ret, |
|
6113 overrides, skinname, when, g, p, |
|
6114 conditions = this.conditions, trigger; |
|
6115 |
|
6116 //Only merge this data if the temp flag is set |
|
6117 //from an earlier pass from a pattern or else |
|
6118 //an override module (YUI_config) can not be used to |
|
6119 //replace a default module. |
|
6120 if (this.moduleInfo[name] && this.moduleInfo[name].temp) { |
|
6121 //This catches temp modules loaded via a pattern |
|
6122 // The module will be added twice, once from the pattern and |
|
6123 // Once from the actual add call, this ensures that properties |
|
6124 // that were added to the module the first time around (group: gallery) |
|
6125 // are also added the second time around too. |
|
6126 o = Y.merge(this.moduleInfo[name], o); |
|
6127 } |
|
6128 |
|
6129 o.name = name; |
|
6130 |
|
6131 if (!o || !o.name) { |
|
6132 return null; |
|
6133 } |
|
6134 |
|
6135 if (!o.type) { |
|
6136 //Always assume it's javascript unless the CSS pattern is matched. |
|
6137 o.type = JS; |
|
6138 p = o.path || o.fullpath; |
|
6139 if (p && this.REGEX_CSS.test(p)) { |
|
6140 Y.log('Auto determined module type as CSS', 'warn', 'loader'); |
|
6141 o.type = CSS; |
|
6142 } |
|
6143 } |
|
6144 |
|
6145 if (!o.path && !o.fullpath) { |
|
6146 o.path = _path(name, name, o.type); |
|
6147 } |
|
6148 o.supersedes = o.supersedes || o.use; |
|
6149 |
|
6150 o.ext = ('ext' in o) ? o.ext : (this._internal) ? false : true; |
|
6151 |
|
6152 // Handle submodule logic |
|
6153 subs = o.submodules; |
|
6154 |
|
6155 this.moduleInfo[name] = o; |
|
6156 |
|
6157 o.requires = o.requires || []; |
|
6158 |
|
6159 /* |
|
6160 Only allowing the cascade of requires information, since |
|
6161 optional and supersedes are far more fine grained than |
|
6162 a blanket requires is. |
|
6163 */ |
|
6164 if (this.requires) { |
|
6165 for (i = 0; i < this.requires.length; i++) { |
|
6166 o.requires.push(this.requires[i]); |
|
6167 } |
|
6168 } |
|
6169 if (o.group && this.groups && this.groups[o.group]) { |
|
6170 g = this.groups[o.group]; |
|
6171 if (g.requires) { |
|
6172 for (i = 0; i < g.requires.length; i++) { |
|
6173 o.requires.push(g.requires[i]); |
|
6174 } |
|
6175 } |
|
6176 } |
|
6177 |
|
6178 |
|
6179 if (!o.defaults) { |
|
6180 o.defaults = { |
|
6181 requires: o.requires ? [].concat(o.requires) : null, |
|
6182 supersedes: o.supersedes ? [].concat(o.supersedes) : null, |
|
6183 optional: o.optional ? [].concat(o.optional) : null |
|
6184 }; |
|
6185 } |
|
6186 |
|
6187 if (o.skinnable && o.ext && o.temp) { |
|
6188 skinname = this._addSkin(this.skin.defaultSkin, name); |
|
6189 o.requires.unshift(skinname); |
|
6190 } |
|
6191 |
|
6192 if (o.requires.length) { |
|
6193 o.requires = this.filterRequires(o.requires) || []; |
|
6194 } |
|
6195 |
|
6196 if (!o.langPack && o.lang) { |
|
6197 langs = yArray(o.lang); |
|
6198 for (j = 0; j < langs.length; j++) { |
|
6199 lang = langs[j]; |
|
6200 packName = this.getLangPackName(lang, name); |
|
6201 smod = this.moduleInfo[packName]; |
|
6202 if (!smod) { |
|
6203 smod = this._addLangPack(lang, o, packName); |
|
6204 } |
|
6205 } |
|
6206 } |
|
6207 |
|
6208 |
|
6209 if (subs) { |
|
6210 sup = o.supersedes || []; |
|
6211 l = 0; |
|
6212 |
|
6213 for (i in subs) { |
|
6214 if (subs.hasOwnProperty(i)) { |
|
6215 s = subs[i]; |
|
6216 |
|
6217 s.path = s.path || _path(name, i, o.type); |
|
6218 s.pkg = name; |
|
6219 s.group = o.group; |
|
6220 |
|
6221 if (s.supersedes) { |
|
6222 sup = sup.concat(s.supersedes); |
|
6223 } |
|
6224 |
|
6225 smod = this.addModule(s, i); |
|
6226 sup.push(i); |
|
6227 |
|
6228 if (smod.skinnable) { |
|
6229 o.skinnable = true; |
|
6230 overrides = this.skin.overrides; |
|
6231 if (overrides && overrides[i]) { |
|
6232 for (j = 0; j < overrides[i].length; j++) { |
|
6233 skinname = this._addSkin(overrides[i][j], |
|
6234 i, name); |
|
6235 sup.push(skinname); |
|
6236 } |
|
6237 } |
|
6238 skinname = this._addSkin(this.skin.defaultSkin, |
|
6239 i, name); |
|
6240 sup.push(skinname); |
|
6241 } |
|
6242 |
|
6243 // looks like we are expected to work out the metadata |
|
6244 // for the parent module language packs from what is |
|
6245 // specified in the child modules. |
|
6246 if (s.lang && s.lang.length) { |
|
6247 |
|
6248 langs = yArray(s.lang); |
|
6249 for (j = 0; j < langs.length; j++) { |
|
6250 lang = langs[j]; |
|
6251 packName = this.getLangPackName(lang, name); |
|
6252 supName = this.getLangPackName(lang, i); |
|
6253 smod = this.moduleInfo[packName]; |
|
6254 |
|
6255 if (!smod) { |
|
6256 smod = this._addLangPack(lang, o, packName); |
|
6257 } |
|
6258 |
|
6259 flatSup = flatSup || yArray.hash(smod.supersedes); |
|
6260 |
|
6261 if (!(supName in flatSup)) { |
|
6262 smod.supersedes.push(supName); |
|
6263 } |
|
6264 |
|
6265 o.lang = o.lang || []; |
|
6266 |
|
6267 flatLang = flatLang || yArray.hash(o.lang); |
|
6268 |
|
6269 if (!(lang in flatLang)) { |
|
6270 o.lang.push(lang); |
|
6271 } |
|
6272 |
|
6273 // Y.log('pack ' + packName + ' should supersede ' + supName); |
|
6274 // Add rollup file, need to add to supersedes list too |
|
6275 |
|
6276 // default packages |
|
6277 packName = this.getLangPackName(ROOT_LANG, name); |
|
6278 supName = this.getLangPackName(ROOT_LANG, i); |
|
6279 |
|
6280 smod = this.moduleInfo[packName]; |
|
6281 |
|
6282 if (!smod) { |
|
6283 smod = this._addLangPack(lang, o, packName); |
|
6284 } |
|
6285 |
|
6286 if (!(supName in flatSup)) { |
|
6287 smod.supersedes.push(supName); |
|
6288 } |
|
6289 |
|
6290 // Y.log('pack ' + packName + ' should supersede ' + supName); |
|
6291 // Add rollup file, need to add to supersedes list too |
|
6292 |
|
6293 } |
|
6294 } |
|
6295 |
|
6296 l++; |
|
6297 } |
|
6298 } |
|
6299 //o.supersedes = YObject.keys(yArray.hash(sup)); |
|
6300 o.supersedes = yArray.dedupe(sup); |
|
6301 if (this.allowRollup) { |
|
6302 o.rollup = (l < 4) ? l : Math.min(l - 1, 4); |
|
6303 } |
|
6304 } |
|
6305 |
|
6306 plugins = o.plugins; |
|
6307 if (plugins) { |
|
6308 for (i in plugins) { |
|
6309 if (plugins.hasOwnProperty(i)) { |
|
6310 plug = plugins[i]; |
|
6311 plug.pkg = name; |
|
6312 plug.path = plug.path || _path(name, i, o.type); |
|
6313 plug.requires = plug.requires || []; |
|
6314 plug.group = o.group; |
|
6315 this.addModule(plug, i); |
|
6316 if (o.skinnable) { |
|
6317 this._addSkin(this.skin.defaultSkin, i, name); |
|
6318 } |
|
6319 |
|
6320 } |
|
6321 } |
|
6322 } |
|
6323 |
|
6324 if (o.condition) { |
|
6325 t = o.condition.trigger; |
|
6326 if (YUI.Env.aliases[t]) { |
|
6327 t = YUI.Env.aliases[t]; |
|
6328 } |
|
6329 if (!Y.Lang.isArray(t)) { |
|
6330 t = [t]; |
|
6331 } |
|
6332 |
|
6333 for (i = 0; i < t.length; i++) { |
|
6334 trigger = t[i]; |
|
6335 when = o.condition.when; |
|
6336 conditions[trigger] = conditions[trigger] || {}; |
|
6337 conditions[trigger][name] = o.condition; |
|
6338 // the 'when' attribute can be 'before', 'after', or 'instead' |
|
6339 // the default is after. |
|
6340 if (when && when !== 'after') { |
|
6341 if (when === 'instead') { // replace the trigger |
|
6342 o.supersedes = o.supersedes || []; |
|
6343 o.supersedes.push(trigger); |
|
6344 } |
|
6345 // before the trigger |
|
6346 // the trigger requires the conditional mod, |
|
6347 // so it should appear before the conditional |
|
6348 // mod if we do not intersede. |
|
6349 } else { // after the trigger |
|
6350 o.after = o.after || []; |
|
6351 o.after.push(trigger); |
|
6352 } |
|
6353 } |
|
6354 } |
|
6355 |
|
6356 if (o.supersedes) { |
|
6357 o.supersedes = this.filterRequires(o.supersedes); |
|
6358 } |
|
6359 |
|
6360 if (o.after) { |
|
6361 o.after = this.filterRequires(o.after); |
|
6362 o.after_map = yArray.hash(o.after); |
|
6363 } |
|
6364 |
|
6365 // this.dirty = true; |
|
6366 |
|
6367 if (o.configFn) { |
|
6368 ret = o.configFn(o); |
|
6369 if (ret === false) { |
|
6370 Y.log('Config function returned false for ' + name + ', skipping.', 'info', 'loader'); |
|
6371 delete this.moduleInfo[name]; |
|
6372 delete GLOBAL_ENV._renderedMods[name]; |
|
6373 o = null; |
|
6374 } |
|
6375 } |
|
6376 //Add to global cache |
|
6377 if (o) { |
|
6378 if (!GLOBAL_ENV._renderedMods) { |
|
6379 GLOBAL_ENV._renderedMods = {}; |
|
6380 } |
|
6381 GLOBAL_ENV._renderedMods[name] = Y.mix(GLOBAL_ENV._renderedMods[name] || {}, o); |
|
6382 GLOBAL_ENV._conditions = conditions; |
|
6383 } |
|
6384 |
|
6385 return o; |
|
6386 }, |
|
6387 |
|
6388 /** |
|
6389 * Add a requirement for one or more module |
|
6390 * @method require |
|
6391 * @param {string[] | string*} what the modules to load. |
|
6392 */ |
|
6393 require: function(what) { |
|
6394 var a = (typeof what === 'string') ? yArray(arguments) : what; |
|
6395 this.dirty = true; |
|
6396 this.required = Y.merge(this.required, yArray.hash(this.filterRequires(a))); |
|
6397 |
|
6398 this._explodeRollups(); |
|
6399 }, |
|
6400 /** |
|
6401 * Grab all the items that were asked for, check to see if the Loader |
|
6402 * meta-data contains a "use" array. If it doesm remove the asked item and replace it with |
|
6403 * the content of the "use". |
|
6404 * This will make asking for: "dd" |
|
6405 * Actually ask for: "dd-ddm-base,dd-ddm,dd-ddm-drop,dd-drag,dd-proxy,dd-constrain,dd-drop,dd-scroll,dd-drop-plugin" |
|
6406 * @private |
|
6407 * @method _explodeRollups |
|
6408 */ |
|
6409 _explodeRollups: function() { |
|
6410 var self = this, m, m2, i, a, v, len, len2, |
|
6411 r = self.required; |
|
6412 |
|
6413 if (!self.allowRollup) { |
|
6414 for (i in r) { |
|
6415 if (r.hasOwnProperty(i)) { |
|
6416 m = self.getModule(i); |
|
6417 if (m && m.use) { |
|
6418 len = m.use.length; |
|
6419 for (a = 0; a < len; a++) { |
|
6420 m2 = self.getModule(m.use[a]); |
|
6421 if (m2 && m2.use) { |
|
6422 len2 = m2.use.length; |
|
6423 for (v = 0; v < len2; v++) { |
|
6424 r[m2.use[v]] = true; |
|
6425 } |
|
6426 } else { |
|
6427 r[m.use[a]] = true; |
|
6428 } |
|
6429 } |
|
6430 } |
|
6431 } |
|
6432 } |
|
6433 self.required = r; |
|
6434 } |
|
6435 |
|
6436 }, |
|
6437 /** |
|
6438 * Explodes the required array to remove aliases and replace them with real modules |
|
6439 * @method filterRequires |
|
6440 * @param {Array} r The original requires array |
|
6441 * @return {Array} The new array of exploded requirements |
|
6442 */ |
|
6443 filterRequires: function(r) { |
|
6444 if (r) { |
|
6445 if (!Y.Lang.isArray(r)) { |
|
6446 r = [r]; |
|
6447 } |
|
6448 r = Y.Array(r); |
|
6449 var c = [], i, mod, o, m; |
|
6450 |
|
6451 for (i = 0; i < r.length; i++) { |
|
6452 mod = this.getModule(r[i]); |
|
6453 if (mod && mod.use) { |
|
6454 for (o = 0; o < mod.use.length; o++) { |
|
6455 //Must walk the other modules in case a module is a rollup of rollups (datatype) |
|
6456 m = this.getModule(mod.use[o]); |
|
6457 if (m && m.use && (m.name !== mod.name)) { |
|
6458 c = Y.Array.dedupe([].concat(c, this.filterRequires(m.use))); |
|
6459 } else { |
|
6460 c.push(mod.use[o]); |
|
6461 } |
|
6462 } |
|
6463 } else { |
|
6464 c.push(r[i]); |
|
6465 } |
|
6466 } |
|
6467 r = c; |
|
6468 } |
|
6469 return r; |
|
6470 }, |
|
6471 /** |
|
6472 * Returns an object containing properties for all modules required |
|
6473 * in order to load the requested module |
|
6474 * @method getRequires |
|
6475 * @param {object} mod The module definition from moduleInfo. |
|
6476 * @return {array} the expanded requirement list. |
|
6477 */ |
|
6478 getRequires: function(mod) { |
|
6479 |
|
6480 if (!mod) { |
|
6481 //console.log('returning no reqs for ' + mod.name); |
|
6482 return NO_REQUIREMENTS; |
|
6483 } |
|
6484 |
|
6485 if (mod._parsed) { |
|
6486 //console.log('returning requires for ' + mod.name, mod.requires); |
|
6487 return mod.expanded || NO_REQUIREMENTS; |
|
6488 } |
|
6489 |
|
6490 //TODO add modue cache here out of scope.. |
|
6491 |
|
6492 var i, m, j, add, packName, lang, testresults = this.testresults, |
|
6493 name = mod.name, cond, |
|
6494 adddef = ON_PAGE[name] && ON_PAGE[name].details, |
|
6495 d, go, def, |
|
6496 r, old_mod, |
|
6497 o, skinmod, skindef, skinpar, skinname, |
|
6498 intl = mod.lang || mod.intl, |
|
6499 info = this.moduleInfo, |
|
6500 ftests = Y.Features && Y.Features.tests.load, |
|
6501 hash, reparse; |
|
6502 |
|
6503 // console.log(name); |
|
6504 |
|
6505 // pattern match leaves module stub that needs to be filled out |
|
6506 if (mod.temp && adddef) { |
|
6507 old_mod = mod; |
|
6508 mod = this.addModule(adddef, name); |
|
6509 mod.group = old_mod.group; |
|
6510 mod.pkg = old_mod.pkg; |
|
6511 delete mod.expanded; |
|
6512 } |
|
6513 |
|
6514 // console.log('cache: ' + mod.langCache + ' == ' + this.lang); |
|
6515 |
|
6516 //If a skin or a lang is different, reparse.. |
|
6517 reparse = !((!this.lang || mod.langCache === this.lang) && (mod.skinCache === this.skin.defaultSkin)); |
|
6518 |
|
6519 if (mod.expanded && !reparse) { |
|
6520 //Y.log('Already expanded ' + name + ', ' + mod.expanded); |
|
6521 return mod.expanded; |
|
6522 } |
|
6523 |
|
6524 |
|
6525 d = []; |
|
6526 hash = {}; |
|
6527 r = this.filterRequires(mod.requires); |
|
6528 if (mod.lang) { |
|
6529 //If a module has a lang attribute, auto add the intl requirement. |
|
6530 d.unshift('intl'); |
|
6531 r.unshift('intl'); |
|
6532 intl = true; |
|
6533 } |
|
6534 o = this.filterRequires(mod.optional); |
|
6535 |
|
6536 // Y.log("getRequires: " + name + " (dirty:" + this.dirty + |
|
6537 // ", expanded:" + mod.expanded + ")"); |
|
6538 |
|
6539 mod._parsed = true; |
|
6540 mod.langCache = this.lang; |
|
6541 mod.skinCache = this.skin.defaultSkin; |
|
6542 |
|
6543 for (i = 0; i < r.length; i++) { |
|
6544 //Y.log(name + ' requiring ' + r[i], 'info', 'loader'); |
|
6545 if (!hash[r[i]]) { |
|
6546 d.push(r[i]); |
|
6547 hash[r[i]] = true; |
|
6548 m = this.getModule(r[i]); |
|
6549 if (m) { |
|
6550 add = this.getRequires(m); |
|
6551 intl = intl || (m.expanded_map && |
|
6552 (INTL in m.expanded_map)); |
|
6553 for (j = 0; j < add.length; j++) { |
|
6554 d.push(add[j]); |
|
6555 } |
|
6556 } |
|
6557 } |
|
6558 } |
|
6559 |
|
6560 // get the requirements from superseded modules, if any |
|
6561 r = this.filterRequires(mod.supersedes); |
|
6562 if (r) { |
|
6563 for (i = 0; i < r.length; i++) { |
|
6564 if (!hash[r[i]]) { |
|
6565 // if this module has submodules, the requirements list is |
|
6566 // expanded to include the submodules. This is so we can |
|
6567 // prevent dups when a submodule is already loaded and the |
|
6568 // parent is requested. |
|
6569 if (mod.submodules) { |
|
6570 d.push(r[i]); |
|
6571 } |
|
6572 |
|
6573 hash[r[i]] = true; |
|
6574 m = this.getModule(r[i]); |
|
6575 |
|
6576 if (m) { |
|
6577 add = this.getRequires(m); |
|
6578 intl = intl || (m.expanded_map && |
|
6579 (INTL in m.expanded_map)); |
|
6580 for (j = 0; j < add.length; j++) { |
|
6581 d.push(add[j]); |
|
6582 } |
|
6583 } |
|
6584 } |
|
6585 } |
|
6586 } |
|
6587 |
|
6588 if (o && this.loadOptional) { |
|
6589 for (i = 0; i < o.length; i++) { |
|
6590 if (!hash[o[i]]) { |
|
6591 d.push(o[i]); |
|
6592 hash[o[i]] = true; |
|
6593 m = info[o[i]]; |
|
6594 if (m) { |
|
6595 add = this.getRequires(m); |
|
6596 intl = intl || (m.expanded_map && |
|
6597 (INTL in m.expanded_map)); |
|
6598 for (j = 0; j < add.length; j++) { |
|
6599 d.push(add[j]); |
|
6600 } |
|
6601 } |
|
6602 } |
|
6603 } |
|
6604 } |
|
6605 |
|
6606 cond = this.conditions[name]; |
|
6607 |
|
6608 if (cond) { |
|
6609 //Set the module to not parsed since we have conditionals and this could change the dependency tree. |
|
6610 mod._parsed = false; |
|
6611 if (testresults && ftests) { |
|
6612 oeach(testresults, function(result, id) { |
|
6613 var condmod = ftests[id].name; |
|
6614 if (!hash[condmod] && ftests[id].trigger === name) { |
|
6615 if (result && ftests[id]) { |
|
6616 hash[condmod] = true; |
|
6617 d.push(condmod); |
|
6618 } |
|
6619 } |
|
6620 }); |
|
6621 } else { |
|
6622 for (i in cond) { |
|
6623 if (cond.hasOwnProperty(i)) { |
|
6624 if (!hash[i]) { |
|
6625 def = cond[i]; |
|
6626 //first see if they've specfied a ua check |
|
6627 //then see if they've got a test fn & if it returns true |
|
6628 //otherwise just having a condition block is enough |
|
6629 go = def && ((!def.ua && !def.test) || (def.ua && Y.UA[def.ua]) || |
|
6630 (def.test && def.test(Y, r))); |
|
6631 |
|
6632 if (go) { |
|
6633 hash[i] = true; |
|
6634 d.push(i); |
|
6635 m = this.getModule(i); |
|
6636 if (m) { |
|
6637 add = this.getRequires(m); |
|
6638 for (j = 0; j < add.length; j++) { |
|
6639 d.push(add[j]); |
|
6640 } |
|
6641 |
|
6642 } |
|
6643 } |
|
6644 } |
|
6645 } |
|
6646 } |
|
6647 } |
|
6648 } |
|
6649 |
|
6650 // Create skin modules |
|
6651 if (mod.skinnable) { |
|
6652 skindef = this.skin.overrides; |
|
6653 for (i in YUI.Env.aliases) { |
|
6654 if (YUI.Env.aliases.hasOwnProperty(i)) { |
|
6655 if (Y.Array.indexOf(YUI.Env.aliases[i], name) > -1) { |
|
6656 skinpar = i; |
|
6657 } |
|
6658 } |
|
6659 } |
|
6660 if (skindef && (skindef[name] || (skinpar && skindef[skinpar]))) { |
|
6661 skinname = name; |
|
6662 if (skindef[skinpar]) { |
|
6663 skinname = skinpar; |
|
6664 } |
|
6665 for (i = 0; i < skindef[skinname].length; i++) { |
|
6666 skinmod = this._addSkin(skindef[skinname][i], name); |
|
6667 if (!this.isCSSLoaded(skinmod, this._boot)) { |
|
6668 d.push(skinmod); |
|
6669 } |
|
6670 } |
|
6671 } else { |
|
6672 skinmod = this._addSkin(this.skin.defaultSkin, name); |
|
6673 if (!this.isCSSLoaded(skinmod, this._boot)) { |
|
6674 d.push(skinmod); |
|
6675 } |
|
6676 } |
|
6677 } |
|
6678 |
|
6679 mod._parsed = false; |
|
6680 |
|
6681 if (intl) { |
|
6682 |
|
6683 if (mod.lang && !mod.langPack && Y.Intl) { |
|
6684 lang = Y.Intl.lookupBestLang(this.lang || ROOT_LANG, mod.lang); |
|
6685 //Y.log('Best lang: ' + lang + ', this.lang: ' + this.lang + ', mod.lang: ' + mod.lang); |
|
6686 packName = this.getLangPackName(lang, name); |
|
6687 if (packName) { |
|
6688 d.unshift(packName); |
|
6689 } |
|
6690 } |
|
6691 d.unshift(INTL); |
|
6692 } |
|
6693 |
|
6694 mod.expanded_map = yArray.hash(d); |
|
6695 |
|
6696 mod.expanded = YObject.keys(mod.expanded_map); |
|
6697 |
|
6698 return mod.expanded; |
|
6699 }, |
|
6700 /** |
|
6701 * Check to see if named css module is already loaded on the page |
|
6702 * @method isCSSLoaded |
|
6703 * @param {String} name The name of the css file |
|
6704 * @return Boolean |
|
6705 */ |
|
6706 isCSSLoaded: function(name, skip) { |
|
6707 //TODO - Make this call a batching call with name being an array |
|
6708 if (!name || !YUI.Env.cssStampEl || (!skip && this.ignoreRegistered)) { |
|
6709 Y.log('isCSSLoaded was skipped for ' + name, 'warn', 'loader'); |
|
6710 return false; |
|
6711 } |
|
6712 var el = YUI.Env.cssStampEl, |
|
6713 ret = false, |
|
6714 mod = YUI.Env._cssLoaded[name], |
|
6715 style = el.currentStyle; //IE |
|
6716 |
|
6717 |
|
6718 if (mod !== undefined) { |
|
6719 //Y.log('isCSSLoaded was cached for ' + name, 'warn', 'loader'); |
|
6720 return mod; |
|
6721 } |
|
6722 |
|
6723 //Add the classname to the element |
|
6724 el.className = name; |
|
6725 |
|
6726 if (!style) { |
|
6727 style = Y.config.doc.defaultView.getComputedStyle(el, null); |
|
6728 } |
|
6729 |
|
6730 if (style && style.display === 'none') { |
|
6731 ret = true; |
|
6732 } |
|
6733 |
|
6734 Y.log('Has Skin? ' + name + ' : ' + ret, 'info', 'loader'); |
|
6735 |
|
6736 el.className = ''; //Reset the classname to '' |
|
6737 |
|
6738 YUI.Env._cssLoaded[name] = ret; |
|
6739 |
|
6740 return ret; |
|
6741 }, |
|
6742 |
|
6743 /** |
|
6744 * Returns a hash of module names the supplied module satisfies. |
|
6745 * @method getProvides |
|
6746 * @param {string} name The name of the module. |
|
6747 * @return {object} what this module provides. |
|
6748 */ |
|
6749 getProvides: function(name) { |
|
6750 var m = this.getModule(name), o, s; |
|
6751 // supmap = this.provides; |
|
6752 |
|
6753 if (!m) { |
|
6754 return NOT_FOUND; |
|
6755 } |
|
6756 |
|
6757 if (m && !m.provides) { |
|
6758 o = {}; |
|
6759 s = m.supersedes; |
|
6760 |
|
6761 if (s) { |
|
6762 yArray.each(s, function(v) { |
|
6763 Y.mix(o, this.getProvides(v)); |
|
6764 }, this); |
|
6765 } |
|
6766 |
|
6767 o[name] = true; |
|
6768 m.provides = o; |
|
6769 |
|
6770 } |
|
6771 |
|
6772 return m.provides; |
|
6773 }, |
|
6774 |
|
6775 /** |
|
6776 * Calculates the dependency tree, the result is stored in the sorted |
|
6777 * property. |
|
6778 * @method calculate |
|
6779 * @param {object} o optional options object. |
|
6780 * @param {string} type optional argument to prune modules. |
|
6781 */ |
|
6782 calculate: function(o, type) { |
|
6783 if (o || type || this.dirty) { |
|
6784 |
|
6785 if (o) { |
|
6786 this._config(o); |
|
6787 } |
|
6788 |
|
6789 if (!this._init) { |
|
6790 this._setup(); |
|
6791 } |
|
6792 |
|
6793 this._explode(); |
|
6794 |
|
6795 if (this.allowRollup) { |
|
6796 this._rollup(); |
|
6797 } else { |
|
6798 this._explodeRollups(); |
|
6799 } |
|
6800 this._reduce(); |
|
6801 this._sort(); |
|
6802 } |
|
6803 }, |
|
6804 /** |
|
6805 * Creates a "psuedo" package for languages provided in the lang array |
|
6806 * @method _addLangPack |
|
6807 * @private |
|
6808 * @param {String} lang The language to create |
|
6809 * @param {Object} m The module definition to create the language pack around |
|
6810 * @param {String} packName The name of the package (e.g: lang/datatype-date-en-US) |
|
6811 * @return {Object} The module definition |
|
6812 */ |
|
6813 _addLangPack: function(lang, m, packName) { |
|
6814 var name = m.name, |
|
6815 packPath, conf, |
|
6816 existing = this.moduleInfo[packName]; |
|
6817 |
|
6818 if (!existing) { |
|
6819 |
|
6820 packPath = _path((m.pkg || name), packName, JS, true); |
|
6821 |
|
6822 conf = { |
|
6823 path: packPath, |
|
6824 intl: true, |
|
6825 langPack: true, |
|
6826 ext: m.ext, |
|
6827 group: m.group, |
|
6828 supersedes: [] |
|
6829 }; |
|
6830 if (m.root) { |
|
6831 conf.root = m.root; |
|
6832 } |
|
6833 if (m.base) { |
|
6834 conf.base = m.base; |
|
6835 } |
|
6836 |
|
6837 if (m.configFn) { |
|
6838 conf.configFn = m.configFn; |
|
6839 } |
|
6840 |
|
6841 this.addModule(conf, packName); |
|
6842 |
|
6843 if (lang) { |
|
6844 Y.Env.lang = Y.Env.lang || {}; |
|
6845 Y.Env.lang[lang] = Y.Env.lang[lang] || {}; |
|
6846 Y.Env.lang[lang][name] = true; |
|
6847 } |
|
6848 } |
|
6849 |
|
6850 return this.moduleInfo[packName]; |
|
6851 }, |
|
6852 |
|
6853 /** |
|
6854 * Investigates the current YUI configuration on the page. By default, |
|
6855 * modules already detected will not be loaded again unless a force |
|
6856 * option is encountered. Called by calculate() |
|
6857 * @method _setup |
|
6858 * @private |
|
6859 */ |
|
6860 _setup: function() { |
|
6861 var info = this.moduleInfo, name, i, j, m, l, |
|
6862 packName; |
|
6863 |
|
6864 for (name in info) { |
|
6865 if (info.hasOwnProperty(name)) { |
|
6866 m = info[name]; |
|
6867 if (m) { |
|
6868 |
|
6869 // remove dups |
|
6870 //m.requires = YObject.keys(yArray.hash(m.requires)); |
|
6871 m.requires = yArray.dedupe(m.requires); |
|
6872 |
|
6873 // Create lang pack modules |
|
6874 //if (m.lang && m.lang.length) { |
|
6875 if (m.lang) { |
|
6876 // Setup root package if the module has lang defined, |
|
6877 // it needs to provide a root language pack |
|
6878 packName = this.getLangPackName(ROOT_LANG, name); |
|
6879 this._addLangPack(null, m, packName); |
|
6880 } |
|
6881 |
|
6882 } |
|
6883 } |
|
6884 } |
|
6885 |
|
6886 |
|
6887 //l = Y.merge(this.inserted); |
|
6888 l = {}; |
|
6889 |
|
6890 // available modules |
|
6891 if (!this.ignoreRegistered) { |
|
6892 Y.mix(l, GLOBAL_ENV.mods); |
|
6893 } |
|
6894 |
|
6895 // add the ignore list to the list of loaded packages |
|
6896 if (this.ignore) { |
|
6897 Y.mix(l, yArray.hash(this.ignore)); |
|
6898 } |
|
6899 |
|
6900 // expand the list to include superseded modules |
|
6901 for (j in l) { |
|
6902 if (l.hasOwnProperty(j)) { |
|
6903 Y.mix(l, this.getProvides(j)); |
|
6904 } |
|
6905 } |
|
6906 |
|
6907 // remove modules on the force list from the loaded list |
|
6908 if (this.force) { |
|
6909 for (i = 0; i < this.force.length; i++) { |
|
6910 if (this.force[i] in l) { |
|
6911 delete l[this.force[i]]; |
|
6912 } |
|
6913 } |
|
6914 } |
|
6915 |
|
6916 Y.mix(this.loaded, l); |
|
6917 |
|
6918 this._init = true; |
|
6919 }, |
|
6920 |
|
6921 /** |
|
6922 * Builds a module name for a language pack |
|
6923 * @method getLangPackName |
|
6924 * @param {string} lang the language code. |
|
6925 * @param {string} mname the module to build it for. |
|
6926 * @return {string} the language pack module name. |
|
6927 */ |
|
6928 getLangPackName: function(lang, mname) { |
|
6929 return ('lang/' + mname + ((lang) ? '_' + lang : '')); |
|
6930 }, |
|
6931 /** |
|
6932 * Inspects the required modules list looking for additional |
|
6933 * dependencies. Expands the required list to include all |
|
6934 * required modules. Called by calculate() |
|
6935 * @method _explode |
|
6936 * @private |
|
6937 */ |
|
6938 _explode: function() { |
|
6939 //TODO Move done out of scope |
|
6940 var r = this.required, m, reqs, done = {}, |
|
6941 self = this, name, expound; |
|
6942 |
|
6943 // the setup phase is over, all modules have been created |
|
6944 self.dirty = false; |
|
6945 |
|
6946 self._explodeRollups(); |
|
6947 r = self.required; |
|
6948 |
|
6949 for (name in r) { |
|
6950 if (r.hasOwnProperty(name)) { |
|
6951 if (!done[name]) { |
|
6952 done[name] = true; |
|
6953 m = self.getModule(name); |
|
6954 if (m) { |
|
6955 expound = m.expound; |
|
6956 |
|
6957 if (expound) { |
|
6958 r[expound] = self.getModule(expound); |
|
6959 reqs = self.getRequires(r[expound]); |
|
6960 Y.mix(r, yArray.hash(reqs)); |
|
6961 } |
|
6962 |
|
6963 reqs = self.getRequires(m); |
|
6964 Y.mix(r, yArray.hash(reqs)); |
|
6965 } |
|
6966 } |
|
6967 } |
|
6968 } |
|
6969 |
|
6970 // Y.log('After explode: ' + YObject.keys(r)); |
|
6971 }, |
|
6972 /** |
|
6973 * The default method used to test a module against a pattern |
|
6974 * @method _patternTest |
|
6975 * @private |
|
6976 * @param {String} mname The module being tested |
|
6977 * @param {String} pname The pattern to match |
|
6978 */ |
|
6979 _patternTest: function(mname, pname) { |
|
6980 return (mname.indexOf(pname) > -1); |
|
6981 }, |
|
6982 /** |
|
6983 * Get's the loader meta data for the requested module |
|
6984 * @method getModule |
|
6985 * @param {String} mname The module name to get |
|
6986 * @return {Object} The module metadata |
|
6987 */ |
|
6988 getModule: function(mname) { |
|
6989 //TODO: Remove name check - it's a quick hack to fix pattern WIP |
|
6990 if (!mname) { |
|
6991 return null; |
|
6992 } |
|
6993 |
|
6994 var p, found, pname, |
|
6995 m = this.moduleInfo[mname], |
|
6996 patterns = this.patterns; |
|
6997 |
|
6998 // check the patterns library to see if we should automatically add |
|
6999 // the module with defaults |
|
7000 if (!m || (m && m.ext)) { |
|
7001 // Y.log('testing patterns ' + YObject.keys(patterns)); |
|
7002 for (pname in patterns) { |
|
7003 if (patterns.hasOwnProperty(pname)) { |
|
7004 // Y.log('testing pattern ' + i); |
|
7005 p = patterns[pname]; |
|
7006 |
|
7007 //There is no test method, create a default one that tests |
|
7008 // the pattern against the mod name |
|
7009 if (!p.test) { |
|
7010 p.test = this._patternTest; |
|
7011 } |
|
7012 |
|
7013 if (p.test(mname, pname)) { |
|
7014 // use the metadata supplied for the pattern |
|
7015 // as the module definition. |
|
7016 found = p; |
|
7017 break; |
|
7018 } |
|
7019 } |
|
7020 } |
|
7021 } |
|
7022 |
|
7023 if (!m) { |
|
7024 if (found) { |
|
7025 if (p.action) { |
|
7026 // Y.log('executing pattern action: ' + pname); |
|
7027 p.action.call(this, mname, pname); |
|
7028 } else { |
|
7029 Y.log('Undefined module: ' + mname + ', matched a pattern: ' + |
|
7030 pname, 'info', 'loader'); |
|
7031 // ext true or false? |
|
7032 m = this.addModule(Y.merge(found), mname); |
|
7033 if (found.configFn) { |
|
7034 m.configFn = found.configFn; |
|
7035 } |
|
7036 m.temp = true; |
|
7037 } |
|
7038 } |
|
7039 } else { |
|
7040 if (found && m && found.configFn && !m.configFn) { |
|
7041 m.configFn = found.configFn; |
|
7042 m.configFn(m); |
|
7043 } |
|
7044 } |
|
7045 |
|
7046 return m; |
|
7047 }, |
|
7048 |
|
7049 // impl in rollup submodule |
|
7050 _rollup: function() { }, |
|
7051 |
|
7052 /** |
|
7053 * Remove superceded modules and loaded modules. Called by |
|
7054 * calculate() after we have the mega list of all dependencies |
|
7055 * @method _reduce |
|
7056 * @return {object} the reduced dependency hash. |
|
7057 * @private |
|
7058 */ |
|
7059 _reduce: function(r) { |
|
7060 |
|
7061 r = r || this.required; |
|
7062 |
|
7063 var i, j, s, m, type = this.loadType, |
|
7064 ignore = this.ignore ? yArray.hash(this.ignore) : false; |
|
7065 |
|
7066 for (i in r) { |
|
7067 if (r.hasOwnProperty(i)) { |
|
7068 m = this.getModule(i); |
|
7069 // remove if already loaded |
|
7070 if (((this.loaded[i] || ON_PAGE[i]) && |
|
7071 !this.forceMap[i] && !this.ignoreRegistered) || |
|
7072 (type && m && m.type !== type)) { |
|
7073 delete r[i]; |
|
7074 } |
|
7075 if (ignore && ignore[i]) { |
|
7076 delete r[i]; |
|
7077 } |
|
7078 // remove anything this module supersedes |
|
7079 s = m && m.supersedes; |
|
7080 if (s) { |
|
7081 for (j = 0; j < s.length; j++) { |
|
7082 if (s[j] in r) { |
|
7083 delete r[s[j]]; |
|
7084 } |
|
7085 } |
|
7086 } |
|
7087 } |
|
7088 } |
|
7089 |
|
7090 return r; |
|
7091 }, |
|
7092 /** |
|
7093 * Handles the queue when a module has been loaded for all cases |
|
7094 * @method _finish |
|
7095 * @private |
|
7096 * @param {String} msg The message from Loader |
|
7097 * @param {Boolean} success A boolean denoting success or failure |
|
7098 */ |
|
7099 _finish: function(msg, success) { |
|
7100 Y.log('loader finishing: ' + msg + ', ' + Y.id + ', ' + |
|
7101 this.data, 'info', 'loader'); |
|
7102 |
|
7103 _queue.running = false; |
|
7104 |
|
7105 var onEnd = this.onEnd; |
|
7106 if (onEnd) { |
|
7107 onEnd.call(this.context, { |
|
7108 msg: msg, |
|
7109 data: this.data, |
|
7110 success: success |
|
7111 }); |
|
7112 } |
|
7113 this._continue(); |
|
7114 }, |
|
7115 /** |
|
7116 * The default Loader onSuccess handler, calls this.onSuccess with a payload |
|
7117 * @method _onSuccess |
|
7118 * @private |
|
7119 */ |
|
7120 _onSuccess: function() { |
|
7121 var self = this, skipped = Y.merge(self.skipped), fn, |
|
7122 failed = [], rreg = self.requireRegistration, |
|
7123 success, msg, i, mod; |
|
7124 |
|
7125 for (i in skipped) { |
|
7126 if (skipped.hasOwnProperty(i)) { |
|
7127 delete self.inserted[i]; |
|
7128 } |
|
7129 } |
|
7130 |
|
7131 self.skipped = {}; |
|
7132 |
|
7133 for (i in self.inserted) { |
|
7134 if (self.inserted.hasOwnProperty(i)) { |
|
7135 mod = self.getModule(i); |
|
7136 if (mod && rreg && mod.type === JS && !(i in YUI.Env.mods)) { |
|
7137 failed.push(i); |
|
7138 } else { |
|
7139 Y.mix(self.loaded, self.getProvides(i)); |
|
7140 } |
|
7141 } |
|
7142 } |
|
7143 |
|
7144 fn = self.onSuccess; |
|
7145 msg = (failed.length) ? 'notregistered' : 'success'; |
|
7146 success = !(failed.length); |
|
7147 if (fn) { |
|
7148 fn.call(self.context, { |
|
7149 msg: msg, |
|
7150 data: self.data, |
|
7151 success: success, |
|
7152 failed: failed, |
|
7153 skipped: skipped |
|
7154 }); |
|
7155 } |
|
7156 self._finish(msg, success); |
|
7157 }, |
|
7158 /** |
|
7159 * The default Loader onProgress handler, calls this.onProgress with a payload |
|
7160 * @method _onProgress |
|
7161 * @private |
|
7162 */ |
|
7163 _onProgress: function(e) { |
|
7164 var self = this, i; |
|
7165 //set the internal cache to what just came in. |
|
7166 if (e.data && e.data.length) { |
|
7167 for (i = 0; i < e.data.length; i++) { |
|
7168 e.data[i] = self.getModule(e.data[i].name); |
|
7169 } |
|
7170 } |
|
7171 if (self.onProgress) { |
|
7172 self.onProgress.call(self.context, { |
|
7173 name: e.url, |
|
7174 data: e.data |
|
7175 }); |
|
7176 } |
|
7177 }, |
|
7178 /** |
|
7179 * The default Loader onFailure handler, calls this.onFailure with a payload |
|
7180 * @method _onFailure |
|
7181 * @private |
|
7182 */ |
|
7183 _onFailure: function(o) { |
|
7184 var f = this.onFailure, msg = [], i = 0, len = o.errors.length; |
|
7185 |
|
7186 for (i; i < len; i++) { |
|
7187 msg.push(o.errors[i].error); |
|
7188 } |
|
7189 |
|
7190 msg = msg.join(','); |
|
7191 |
|
7192 Y.log('load error: ' + msg + ', ' + Y.id, 'error', 'loader'); |
|
7193 |
|
7194 if (f) { |
|
7195 f.call(this.context, { |
|
7196 msg: msg, |
|
7197 data: this.data, |
|
7198 success: false |
|
7199 }); |
|
7200 } |
|
7201 |
|
7202 this._finish(msg, false); |
|
7203 |
|
7204 }, |
|
7205 |
|
7206 /** |
|
7207 * The default Loader onTimeout handler, calls this.onTimeout with a payload |
|
7208 * @method _onTimeout |
|
7209 * @param {Get.Transaction} transaction The Transaction object from `Y.Get` |
|
7210 * @private |
|
7211 */ |
|
7212 _onTimeout: function(transaction) { |
|
7213 Y.log('loader timeout: ' + Y.id, 'error', 'loader'); |
|
7214 var f = this.onTimeout; |
|
7215 if (f) { |
|
7216 f.call(this.context, { |
|
7217 msg: 'timeout', |
|
7218 data: this.data, |
|
7219 success: false, |
|
7220 transaction: transaction |
|
7221 }); |
|
7222 } |
|
7223 }, |
|
7224 |
|
7225 /** |
|
7226 * Sorts the dependency tree. The last step of calculate() |
|
7227 * @method _sort |
|
7228 * @private |
|
7229 */ |
|
7230 _sort: function() { |
|
7231 |
|
7232 // create an indexed list |
|
7233 var s = YObject.keys(this.required), |
|
7234 // loaded = this.loaded, |
|
7235 //TODO Move this out of scope |
|
7236 done = {}, |
|
7237 p = 0, l, a, b, j, k, moved, doneKey; |
|
7238 |
|
7239 // keep going until we make a pass without moving anything |
|
7240 for (;;) { |
|
7241 |
|
7242 l = s.length; |
|
7243 moved = false; |
|
7244 |
|
7245 // start the loop after items that are already sorted |
|
7246 for (j = p; j < l; j++) { |
|
7247 |
|
7248 // check the next module on the list to see if its |
|
7249 // dependencies have been met |
|
7250 a = s[j]; |
|
7251 |
|
7252 // check everything below current item and move if we |
|
7253 // find a requirement for the current item |
|
7254 for (k = j + 1; k < l; k++) { |
|
7255 doneKey = a + s[k]; |
|
7256 |
|
7257 if (!done[doneKey] && this._requires(a, s[k])) { |
|
7258 |
|
7259 // extract the dependency so we can move it up |
|
7260 b = s.splice(k, 1); |
|
7261 |
|
7262 // insert the dependency above the item that |
|
7263 // requires it |
|
7264 s.splice(j, 0, b[0]); |
|
7265 |
|
7266 // only swap two dependencies once to short circut |
|
7267 // circular dependencies |
|
7268 done[doneKey] = true; |
|
7269 |
|
7270 // keep working |
|
7271 moved = true; |
|
7272 |
|
7273 break; |
|
7274 } |
|
7275 } |
|
7276 |
|
7277 // jump out of loop if we moved something |
|
7278 if (moved) { |
|
7279 break; |
|
7280 // this item is sorted, move our pointer and keep going |
|
7281 } else { |
|
7282 p++; |
|
7283 } |
|
7284 } |
|
7285 |
|
7286 // when we make it here and moved is false, we are |
|
7287 // finished sorting |
|
7288 if (!moved) { |
|
7289 break; |
|
7290 } |
|
7291 |
|
7292 } |
|
7293 |
|
7294 this.sorted = s; |
|
7295 }, |
|
7296 |
|
7297 /** |
|
7298 * Handles the actual insertion of script/link tags |
|
7299 * @method _insert |
|
7300 * @private |
|
7301 * @param {Object} source The YUI instance the request came from |
|
7302 * @param {Object} o The metadata to include |
|
7303 * @param {String} type JS or CSS |
|
7304 * @param {Boolean} [skipcalc=false] Do a Loader.calculate on the meta |
|
7305 */ |
|
7306 _insert: function(source, o, type, skipcalc) { |
|
7307 |
|
7308 Y.log('private _insert() ' + (type || '') + ', ' + Y.id, "info", "loader"); |
|
7309 |
|
7310 // restore the state at the time of the request |
|
7311 if (source) { |
|
7312 this._config(source); |
|
7313 } |
|
7314 |
|
7315 // build the dependency list |
|
7316 // don't include type so we can process CSS and script in |
|
7317 // one pass when the type is not specified. |
|
7318 |
|
7319 var modules = this.resolve(!skipcalc), |
|
7320 self = this, comp = 0, actions = 0, |
|
7321 mods = {}, deps, complete; |
|
7322 |
|
7323 self._refetch = []; |
|
7324 |
|
7325 if (type) { |
|
7326 //Filter out the opposite type and reset the array so the checks later work |
|
7327 modules[((type === JS) ? CSS : JS)] = []; |
|
7328 } |
|
7329 if (!self.fetchCSS) { |
|
7330 modules.css = []; |
|
7331 } |
|
7332 if (modules.js.length) { |
|
7333 comp++; |
|
7334 } |
|
7335 if (modules.css.length) { |
|
7336 comp++; |
|
7337 } |
|
7338 |
|
7339 //console.log('Resolved Modules: ', modules); |
|
7340 |
|
7341 complete = function(d) { |
|
7342 actions++; |
|
7343 var errs = {}, i = 0, o = 0, u = '', fn, |
|
7344 modName, resMods; |
|
7345 |
|
7346 if (d && d.errors) { |
|
7347 for (i = 0; i < d.errors.length; i++) { |
|
7348 if (d.errors[i].request) { |
|
7349 u = d.errors[i].request.url; |
|
7350 } else { |
|
7351 u = d.errors[i]; |
|
7352 } |
|
7353 errs[u] = u; |
|
7354 } |
|
7355 } |
|
7356 |
|
7357 if (d && d.data && d.data.length && (d.type === 'success')) { |
|
7358 for (i = 0; i < d.data.length; i++) { |
|
7359 self.inserted[d.data[i].name] = true; |
|
7360 //If the external module has a skin or a lang, reprocess it |
|
7361 if (d.data[i].lang || d.data[i].skinnable) { |
|
7362 delete self.inserted[d.data[i].name]; |
|
7363 self._refetch.push(d.data[i].name); |
|
7364 } |
|
7365 } |
|
7366 } |
|
7367 |
|
7368 if (actions === comp) { |
|
7369 self._loading = null; |
|
7370 Y.log('Loader actions complete!', 'info', 'loader'); |
|
7371 if (self._refetch.length) { |
|
7372 //Get the deps for the new meta-data and reprocess |
|
7373 Y.log('Found potential modules to refetch', 'info', 'loader'); |
|
7374 for (i = 0; i < self._refetch.length; i++) { |
|
7375 deps = self.getRequires(self.getModule(self._refetch[i])); |
|
7376 for (o = 0; o < deps.length; o++) { |
|
7377 if (!self.inserted[deps[o]]) { |
|
7378 //We wouldn't be to this point without the module being here |
|
7379 mods[deps[o]] = deps[o]; |
|
7380 } |
|
7381 } |
|
7382 } |
|
7383 mods = Y.Object.keys(mods); |
|
7384 if (mods.length) { |
|
7385 Y.log('Refetching modules with new meta-data', 'info', 'loader'); |
|
7386 self.require(mods); |
|
7387 resMods = self.resolve(true); |
|
7388 if (resMods.cssMods.length) { |
|
7389 for (i=0; i < resMods.cssMods.length; i++) { |
|
7390 modName = resMods.cssMods[i].name; |
|
7391 delete YUI.Env._cssLoaded[modName]; |
|
7392 if (self.isCSSLoaded(modName)) { |
|
7393 self.inserted[modName] = true; |
|
7394 delete self.required[modName]; |
|
7395 } |
|
7396 } |
|
7397 self.sorted = []; |
|
7398 self._sort(); |
|
7399 } |
|
7400 d = null; //bail |
|
7401 self._insert(); //insert the new deps |
|
7402 } |
|
7403 } |
|
7404 if (d && d.fn) { |
|
7405 Y.log('Firing final Loader callback!', 'info', 'loader'); |
|
7406 fn = d.fn; |
|
7407 delete d.fn; |
|
7408 fn.call(self, d); |
|
7409 } |
|
7410 } |
|
7411 }; |
|
7412 |
|
7413 this._loading = true; |
|
7414 |
|
7415 if (!modules.js.length && !modules.css.length) { |
|
7416 Y.log('No modules resolved..', 'warn', 'loader'); |
|
7417 actions = -1; |
|
7418 complete({ |
|
7419 fn: self._onSuccess |
|
7420 }); |
|
7421 return; |
|
7422 } |
|
7423 |
|
7424 |
|
7425 if (modules.css.length) { //Load CSS first |
|
7426 Y.log('Loading CSS modules', 'info', 'loader'); |
|
7427 Y.Get.css(modules.css, { |
|
7428 data: modules.cssMods, |
|
7429 attributes: self.cssAttributes, |
|
7430 insertBefore: self.insertBefore, |
|
7431 charset: self.charset, |
|
7432 timeout: self.timeout, |
|
7433 context: self, |
|
7434 onProgress: function(e) { |
|
7435 self._onProgress.call(self, e); |
|
7436 }, |
|
7437 onTimeout: function(d) { |
|
7438 self._onTimeout.call(self, d); |
|
7439 }, |
|
7440 onSuccess: function(d) { |
|
7441 d.type = 'success'; |
|
7442 d.fn = self._onSuccess; |
|
7443 complete.call(self, d); |
|
7444 }, |
|
7445 onFailure: function(d) { |
|
7446 d.type = 'failure'; |
|
7447 d.fn = self._onFailure; |
|
7448 complete.call(self, d); |
|
7449 } |
|
7450 }); |
|
7451 } |
|
7452 |
|
7453 if (modules.js.length) { |
|
7454 Y.log('Loading JS modules', 'info', 'loader'); |
|
7455 Y.Get.js(modules.js, { |
|
7456 data: modules.jsMods, |
|
7457 insertBefore: self.insertBefore, |
|
7458 attributes: self.jsAttributes, |
|
7459 charset: self.charset, |
|
7460 timeout: self.timeout, |
|
7461 autopurge: false, |
|
7462 context: self, |
|
7463 async: self.async, |
|
7464 onProgress: function(e) { |
|
7465 self._onProgress.call(self, e); |
|
7466 }, |
|
7467 onTimeout: function(d) { |
|
7468 self._onTimeout.call(self, d); |
|
7469 }, |
|
7470 onSuccess: function(d) { |
|
7471 d.type = 'success'; |
|
7472 d.fn = self._onSuccess; |
|
7473 complete.call(self, d); |
|
7474 }, |
|
7475 onFailure: function(d) { |
|
7476 d.type = 'failure'; |
|
7477 d.fn = self._onFailure; |
|
7478 complete.call(self, d); |
|
7479 } |
|
7480 }); |
|
7481 } |
|
7482 }, |
|
7483 /** |
|
7484 * Once a loader operation is completely finished, process any additional queued items. |
|
7485 * @method _continue |
|
7486 * @private |
|
7487 */ |
|
7488 _continue: function() { |
|
7489 if (!(_queue.running) && _queue.size() > 0) { |
|
7490 _queue.running = true; |
|
7491 _queue.next()(); |
|
7492 } |
|
7493 }, |
|
7494 |
|
7495 /** |
|
7496 * inserts the requested modules and their dependencies. |
|
7497 * <code>type</code> can be "js" or "css". Both script and |
|
7498 * css are inserted if type is not provided. |
|
7499 * @method insert |
|
7500 * @param {object} o optional options object. |
|
7501 * @param {string} type the type of dependency to insert. |
|
7502 */ |
|
7503 insert: function(o, type, skipsort) { |
|
7504 Y.log('public insert() ' + (type || '') + ', ' + |
|
7505 Y.Object.keys(this.required), "info", "loader"); |
|
7506 var self = this, copy = Y.merge(this); |
|
7507 delete copy.require; |
|
7508 delete copy.dirty; |
|
7509 _queue.add(function() { |
|
7510 self._insert(copy, o, type, skipsort); |
|
7511 }); |
|
7512 this._continue(); |
|
7513 }, |
|
7514 |
|
7515 /** |
|
7516 * Executed every time a module is loaded, and if we are in a load |
|
7517 * cycle, we attempt to load the next script. Public so that it |
|
7518 * is possible to call this if using a method other than |
|
7519 * Y.register to determine when scripts are fully loaded |
|
7520 * @method loadNext |
|
7521 * @deprecated |
|
7522 * @param {string} mname optional the name of the module that has |
|
7523 * been loaded (which is usually why it is time to load the next |
|
7524 * one). |
|
7525 */ |
|
7526 loadNext: function() { |
|
7527 Y.log('loadNext was called..', 'error', 'loader'); |
|
7528 return; |
|
7529 }, |
|
7530 |
|
7531 /** |
|
7532 * Apply filter defined for this instance to a url/path |
|
7533 * @method _filter |
|
7534 * @param {string} u the string to filter. |
|
7535 * @param {string} name the name of the module, if we are processing |
|
7536 * a single module as opposed to a combined url. |
|
7537 * @return {string} the filtered string. |
|
7538 * @private |
|
7539 */ |
|
7540 _filter: function(u, name, group) { |
|
7541 var f = this.filter, |
|
7542 hasFilter = name && (name in this.filters), |
|
7543 modFilter = hasFilter && this.filters[name], |
|
7544 groupName = group || (this.moduleInfo[name] ? this.moduleInfo[name].group : null); |
|
7545 |
|
7546 if (groupName && this.groups[groupName] && this.groups[groupName].filter) { |
|
7547 modFilter = this.groups[groupName].filter; |
|
7548 hasFilter = true; |
|
7549 } |
|
7550 |
|
7551 if (u) { |
|
7552 if (hasFilter) { |
|
7553 f = (L.isString(modFilter)) ? this.FILTER_DEFS[modFilter.toUpperCase()] || null : modFilter; |
|
7554 } |
|
7555 if (f) { |
|
7556 u = u.replace(new RegExp(f.searchExp, 'g'), f.replaceStr); |
|
7557 } |
|
7558 } |
|
7559 return u; |
|
7560 }, |
|
7561 |
|
7562 /** |
|
7563 * Generates the full url for a module |
|
7564 * @method _url |
|
7565 * @param {string} path the path fragment. |
|
7566 * @param {String} name The name of the module |
|
7567 * @param {String} [base=self.base] The base url to use |
|
7568 * @return {string} the full url. |
|
7569 * @private |
|
7570 */ |
|
7571 _url: function(path, name, base) { |
|
7572 return this._filter((base || this.base || '') + path, name); |
|
7573 }, |
|
7574 /** |
|
7575 * Returns an Object hash of file arrays built from `loader.sorted` or from an arbitrary list of sorted modules. |
|
7576 * @method resolve |
|
7577 * @param {Boolean} [calc=false] Perform a loader.calculate() before anything else |
|
7578 * @param {Array} [s=loader.sorted] An override for the loader.sorted array |
|
7579 * @return {Object} Object hash (js and css) of two arrays of file lists |
|
7580 * @example This method can be used as an off-line dep calculator |
|
7581 * |
|
7582 * var Y = YUI(); |
|
7583 * var loader = new Y.Loader({ |
|
7584 * filter: 'debug', |
|
7585 * base: '../../', |
|
7586 * root: 'build/', |
|
7587 * combine: true, |
|
7588 * require: ['node', 'dd', 'console'] |
|
7589 * }); |
|
7590 * var out = loader.resolve(true); |
|
7591 * |
|
7592 */ |
|
7593 resolve: function(calc, s) { |
|
7594 |
|
7595 var len, i, m, url, group, groupName, j, frag, |
|
7596 comboSource, comboSources, mods, comboBase, |
|
7597 base, urls, u = [], tmpBase, baseLen, resCombos = {}, |
|
7598 self = this, comboSep, maxURLLength, |
|
7599 inserted = (self.ignoreRegistered) ? {} : self.inserted, |
|
7600 resolved = { js: [], jsMods: [], css: [], cssMods: [] }, |
|
7601 type = self.loadType || 'js', addSingle; |
|
7602 |
|
7603 if (self.skin.overrides || self.skin.defaultSkin !== DEFAULT_SKIN || self.ignoreRegistered) { |
|
7604 self._resetModules(); |
|
7605 } |
|
7606 |
|
7607 if (calc) { |
|
7608 self.calculate(); |
|
7609 } |
|
7610 s = s || self.sorted; |
|
7611 |
|
7612 addSingle = function(m) { |
|
7613 |
|
7614 if (m) { |
|
7615 group = (m.group && self.groups[m.group]) || NOT_FOUND; |
|
7616 |
|
7617 //Always assume it's async |
|
7618 if (group.async === false) { |
|
7619 m.async = group.async; |
|
7620 } |
|
7621 |
|
7622 url = (m.fullpath) ? self._filter(m.fullpath, s[i]) : |
|
7623 self._url(m.path, s[i], group.base || m.base); |
|
7624 |
|
7625 if (m.attributes || m.async === false) { |
|
7626 url = { |
|
7627 url: url, |
|
7628 async: m.async |
|
7629 }; |
|
7630 if (m.attributes) { |
|
7631 url.attributes = m.attributes; |
|
7632 } |
|
7633 } |
|
7634 resolved[m.type].push(url); |
|
7635 resolved[m.type + 'Mods'].push(m); |
|
7636 } else { |
|
7637 Y.log('Undefined Module', 'warn', 'loader'); |
|
7638 } |
|
7639 |
|
7640 }; |
|
7641 |
|
7642 len = s.length; |
|
7643 |
|
7644 // the default combo base |
|
7645 comboBase = self.comboBase; |
|
7646 |
|
7647 url = comboBase; |
|
7648 |
|
7649 comboSources = {}; |
|
7650 |
|
7651 for (i = 0; i < len; i++) { |
|
7652 comboSource = comboBase; |
|
7653 m = self.getModule(s[i]); |
|
7654 groupName = m && m.group; |
|
7655 group = self.groups[groupName]; |
|
7656 if (groupName && group) { |
|
7657 |
|
7658 if (!group.combine || m.fullpath) { |
|
7659 //This is not a combo module, skip it and load it singly later. |
|
7660 addSingle(m); |
|
7661 continue; |
|
7662 } |
|
7663 m.combine = true; |
|
7664 if (group.comboBase) { |
|
7665 comboSource = group.comboBase; |
|
7666 } |
|
7667 |
|
7668 if ("root" in group && L.isValue(group.root)) { |
|
7669 m.root = group.root; |
|
7670 } |
|
7671 m.comboSep = group.comboSep || self.comboSep; |
|
7672 m.maxURLLength = group.maxURLLength || self.maxURLLength; |
|
7673 } else { |
|
7674 if (!self.combine) { |
|
7675 //This is not a combo module, skip it and load it singly later. |
|
7676 addSingle(m); |
|
7677 continue; |
|
7678 } |
|
7679 } |
|
7680 |
|
7681 comboSources[comboSource] = comboSources[comboSource] || []; |
|
7682 comboSources[comboSource].push(m); |
|
7683 } |
|
7684 |
|
7685 for (j in comboSources) { |
|
7686 if (comboSources.hasOwnProperty(j)) { |
|
7687 resCombos[j] = resCombos[j] || { js: [], jsMods: [], css: [], cssMods: [] }; |
|
7688 url = j; |
|
7689 mods = comboSources[j]; |
|
7690 len = mods.length; |
|
7691 |
|
7692 if (len) { |
|
7693 for (i = 0; i < len; i++) { |
|
7694 if (inserted[mods[i]]) { |
|
7695 continue; |
|
7696 } |
|
7697 m = mods[i]; |
|
7698 // Do not try to combine non-yui JS unless combo def |
|
7699 // is found |
|
7700 if (m && (m.combine || !m.ext)) { |
|
7701 resCombos[j].comboSep = m.comboSep; |
|
7702 resCombos[j].group = m.group; |
|
7703 resCombos[j].maxURLLength = m.maxURLLength; |
|
7704 frag = ((L.isValue(m.root)) ? m.root : self.root) + (m.path || m.fullpath); |
|
7705 frag = self._filter(frag, m.name); |
|
7706 resCombos[j][m.type].push(frag); |
|
7707 resCombos[j][m.type + 'Mods'].push(m); |
|
7708 } else { |
|
7709 //Add them to the next process.. |
|
7710 if (mods[i]) { |
|
7711 addSingle(mods[i]); |
|
7712 } |
|
7713 } |
|
7714 |
|
7715 } |
|
7716 } |
|
7717 } |
|
7718 } |
|
7719 |
|
7720 |
|
7721 for (j in resCombos) { |
|
7722 if (resCombos.hasOwnProperty(j)) { |
|
7723 base = j; |
|
7724 comboSep = resCombos[base].comboSep || self.comboSep; |
|
7725 maxURLLength = resCombos[base].maxURLLength || self.maxURLLength; |
|
7726 Y.log('Using maxURLLength of ' + maxURLLength, 'info', 'loader'); |
|
7727 for (type in resCombos[base]) { |
|
7728 if (type === JS || type === CSS) { |
|
7729 urls = resCombos[base][type]; |
|
7730 mods = resCombos[base][type + 'Mods']; |
|
7731 len = urls.length; |
|
7732 tmpBase = base + urls.join(comboSep); |
|
7733 baseLen = tmpBase.length; |
|
7734 if (maxURLLength <= base.length) { |
|
7735 Y.log('maxURLLength (' + maxURLLength + ') is lower than the comboBase length (' + base.length + '), resetting to default (' + MAX_URL_LENGTH + ')', 'error', 'loader'); |
|
7736 maxURLLength = MAX_URL_LENGTH; |
|
7737 } |
|
7738 |
|
7739 if (len) { |
|
7740 if (baseLen > maxURLLength) { |
|
7741 Y.log('Exceeded maxURLLength (' + maxURLLength + ') for ' + type + ', splitting', 'info', 'loader'); |
|
7742 u = []; |
|
7743 for (s = 0; s < len; s++) { |
|
7744 u.push(urls[s]); |
|
7745 tmpBase = base + u.join(comboSep); |
|
7746 |
|
7747 if (tmpBase.length > maxURLLength) { |
|
7748 m = u.pop(); |
|
7749 tmpBase = base + u.join(comboSep); |
|
7750 resolved[type].push(self._filter(tmpBase, null, resCombos[base].group)); |
|
7751 u = []; |
|
7752 if (m) { |
|
7753 u.push(m); |
|
7754 } |
|
7755 } |
|
7756 } |
|
7757 if (u.length) { |
|
7758 tmpBase = base + u.join(comboSep); |
|
7759 resolved[type].push(self._filter(tmpBase, null, resCombos[base].group)); |
|
7760 } |
|
7761 } else { |
|
7762 resolved[type].push(self._filter(tmpBase, null, resCombos[base].group)); |
|
7763 } |
|
7764 } |
|
7765 resolved[type + 'Mods'] = resolved[type + 'Mods'].concat(mods); |
|
7766 } |
|
7767 } |
|
7768 } |
|
7769 } |
|
7770 |
|
7771 resCombos = null; |
|
7772 |
|
7773 return resolved; |
|
7774 }, |
|
7775 /** |
|
7776 Shortcut to calculate, resolve and load all modules. |
|
7777 |
|
7778 var loader = new Y.Loader({ |
|
7779 ignoreRegistered: true, |
|
7780 modules: { |
|
7781 mod: { |
|
7782 path: 'mod.js' |
|
7783 } |
|
7784 }, |
|
7785 requires: [ 'mod' ] |
|
7786 }); |
|
7787 loader.load(function() { |
|
7788 console.log('All modules have loaded..'); |
|
7789 }); |
|
7790 |
|
7791 |
|
7792 @method load |
|
7793 @param {Callback} cb Executed after all load operations are complete |
|
7794 */ |
|
7795 load: function(cb) { |
|
7796 if (!cb) { |
|
7797 Y.log('No callback supplied to load()', 'error', 'loader'); |
|
7798 return; |
|
7799 } |
|
7800 var self = this, |
|
7801 out = self.resolve(true); |
|
7802 |
|
7803 self.data = out; |
|
7804 |
|
7805 self.onEnd = function() { |
|
7806 cb.apply(self.context || self, arguments); |
|
7807 }; |
|
7808 |
|
7809 self.insert(); |
|
7810 } |
|
7811 }; |
|
7812 |
|
7813 |
|
7814 |
|
7815 }, '3.10.3', {"requires": ["get", "features"]}); |
|
7816 YUI.add('loader-rollup', function (Y, NAME) { |
|
7817 |
|
7818 /** |
|
7819 * Optional automatic rollup logic for reducing http connections |
|
7820 * when not using a combo service. |
|
7821 * @module loader |
|
7822 * @submodule rollup |
|
7823 */ |
|
7824 |
|
7825 /** |
|
7826 * Look for rollup packages to determine if all of the modules a |
|
7827 * rollup supersedes are required. If so, include the rollup to |
|
7828 * help reduce the total number of connections required. Called |
|
7829 * by calculate(). This is an optional feature, and requires the |
|
7830 * appropriate submodule to function. |
|
7831 * @method _rollup |
|
7832 * @for Loader |
|
7833 * @private |
|
7834 */ |
|
7835 Y.Loader.prototype._rollup = function() { |
|
7836 var i, j, m, s, r = this.required, roll, |
|
7837 info = this.moduleInfo, rolled, c, smod; |
|
7838 |
|
7839 // find and cache rollup modules |
|
7840 if (this.dirty || !this.rollups) { |
|
7841 this.rollups = {}; |
|
7842 for (i in info) { |
|
7843 if (info.hasOwnProperty(i)) { |
|
7844 m = this.getModule(i); |
|
7845 // if (m && m.rollup && m.supersedes) { |
|
7846 if (m && m.rollup) { |
|
7847 this.rollups[i] = m; |
|
7848 } |
|
7849 } |
|
7850 } |
|
7851 } |
|
7852 |
|
7853 // make as many passes as needed to pick up rollup rollups |
|
7854 for (;;) { |
|
7855 rolled = false; |
|
7856 |
|
7857 // go through the rollup candidates |
|
7858 for (i in this.rollups) { |
|
7859 if (this.rollups.hasOwnProperty(i)) { |
|
7860 // there can be only one, unless forced |
|
7861 if (!r[i] && ((!this.loaded[i]) || this.forceMap[i])) { |
|
7862 m = this.getModule(i); |
|
7863 s = m.supersedes || []; |
|
7864 roll = false; |
|
7865 |
|
7866 // @TODO remove continue |
|
7867 if (!m.rollup) { |
|
7868 continue; |
|
7869 } |
|
7870 |
|
7871 c = 0; |
|
7872 |
|
7873 // check the threshold |
|
7874 for (j = 0; j < s.length; j++) { |
|
7875 smod = info[s[j]]; |
|
7876 |
|
7877 // if the superseded module is loaded, we can't |
|
7878 // load the rollup unless it has been forced. |
|
7879 if (this.loaded[s[j]] && !this.forceMap[s[j]]) { |
|
7880 roll = false; |
|
7881 break; |
|
7882 // increment the counter if this module is required. |
|
7883 // if we are beyond the rollup threshold, we will |
|
7884 // use the rollup module |
|
7885 } else if (r[s[j]] && m.type === smod.type) { |
|
7886 c++; |
|
7887 // Y.log("adding to thresh: " + c + ", " + s[j]); |
|
7888 roll = (c >= m.rollup); |
|
7889 if (roll) { |
|
7890 // Y.log("over thresh " + c + ", " + s[j]); |
|
7891 break; |
|
7892 } |
|
7893 } |
|
7894 } |
|
7895 |
|
7896 if (roll) { |
|
7897 // Y.log("adding rollup: " + i); |
|
7898 // add the rollup |
|
7899 r[i] = true; |
|
7900 rolled = true; |
|
7901 |
|
7902 // expand the rollup's dependencies |
|
7903 this.getRequires(m); |
|
7904 } |
|
7905 } |
|
7906 } |
|
7907 } |
|
7908 |
|
7909 // if we made it here w/o rolling up something, we are done |
|
7910 if (!rolled) { |
|
7911 break; |
|
7912 } |
|
7913 } |
|
7914 }; |
|
7915 |
|
7916 |
|
7917 }, '3.10.3', {"requires": ["loader-base"]}); |
|
7918 YUI.add('loader-yui3', function (Y, NAME) { |
|
7919 |
|
7920 /* This file is auto-generated by (yogi loader --yes --mix --start ../) */ |
|
7921 |
|
7922 /*jshint maxlen:900, eqeqeq: false */ |
|
7923 |
|
7924 /** |
|
7925 * YUI 3 module metadata |
|
7926 * @module loader |
|
7927 * @submodule loader-yui3 |
|
7928 */ |
|
7929 YUI.Env[Y.version].modules = YUI.Env[Y.version].modules || {}; |
|
7930 Y.mix(YUI.Env[Y.version].modules, { |
|
7931 "align-plugin": { |
|
7932 "requires": [ |
|
7933 "node-screen", |
|
7934 "node-pluginhost" |
|
7935 ] |
|
7936 }, |
|
7937 "anim": { |
|
7938 "use": [ |
|
7939 "anim-base", |
|
7940 "anim-color", |
|
7941 "anim-curve", |
|
7942 "anim-easing", |
|
7943 "anim-node-plugin", |
|
7944 "anim-scroll", |
|
7945 "anim-xy" |
|
7946 ] |
|
7947 }, |
|
7948 "anim-base": { |
|
7949 "requires": [ |
|
7950 "base-base", |
|
7951 "node-style" |
|
7952 ] |
|
7953 }, |
|
7954 "anim-color": { |
|
7955 "requires": [ |
|
7956 "anim-base" |
|
7957 ] |
|
7958 }, |
|
7959 "anim-curve": { |
|
7960 "requires": [ |
|
7961 "anim-xy" |
|
7962 ] |
|
7963 }, |
|
7964 "anim-easing": { |
|
7965 "requires": [ |
|
7966 "anim-base" |
|
7967 ] |
|
7968 }, |
|
7969 "anim-node-plugin": { |
|
7970 "requires": [ |
|
7971 "node-pluginhost", |
|
7972 "anim-base" |
|
7973 ] |
|
7974 }, |
|
7975 "anim-scroll": { |
|
7976 "requires": [ |
|
7977 "anim-base" |
|
7978 ] |
|
7979 }, |
|
7980 "anim-shape": { |
|
7981 "requires": [ |
|
7982 "anim-base", |
|
7983 "anim-easing", |
|
7984 "anim-color", |
|
7985 "matrix" |
|
7986 ] |
|
7987 }, |
|
7988 "anim-shape-transform": { |
|
7989 "use": [ |
|
7990 "anim-shape" |
|
7991 ] |
|
7992 }, |
|
7993 "anim-xy": { |
|
7994 "requires": [ |
|
7995 "anim-base", |
|
7996 "node-screen" |
|
7997 ] |
|
7998 }, |
|
7999 "app": { |
|
8000 "use": [ |
|
8001 "app-base", |
|
8002 "app-content", |
|
8003 "app-transitions", |
|
8004 "lazy-model-list", |
|
8005 "model", |
|
8006 "model-list", |
|
8007 "model-sync-rest", |
|
8008 "router", |
|
8009 "view", |
|
8010 "view-node-map" |
|
8011 ] |
|
8012 }, |
|
8013 "app-base": { |
|
8014 "requires": [ |
|
8015 "classnamemanager", |
|
8016 "pjax-base", |
|
8017 "router", |
|
8018 "view" |
|
8019 ] |
|
8020 }, |
|
8021 "app-content": { |
|
8022 "requires": [ |
|
8023 "app-base", |
|
8024 "pjax-content" |
|
8025 ] |
|
8026 }, |
|
8027 "app-transitions": { |
|
8028 "requires": [ |
|
8029 "app-base" |
|
8030 ] |
|
8031 }, |
|
8032 "app-transitions-css": { |
|
8033 "type": "css" |
|
8034 }, |
|
8035 "app-transitions-native": { |
|
8036 "condition": { |
|
8037 "name": "app-transitions-native", |
|
8038 "test": function (Y) { |
|
8039 var doc = Y.config.doc, |
|
8040 node = doc ? doc.documentElement : null; |
|
8041 |
|
8042 if (node && node.style) { |
|
8043 return ('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); |
|
8044 } |
|
8045 |
|
8046 return false; |
|
8047 }, |
|
8048 "trigger": "app-transitions" |
|
8049 }, |
|
8050 "requires": [ |
|
8051 "app-transitions", |
|
8052 "app-transitions-css", |
|
8053 "parallel", |
|
8054 "transition" |
|
8055 ] |
|
8056 }, |
|
8057 "array-extras": { |
|
8058 "requires": [ |
|
8059 "yui-base" |
|
8060 ] |
|
8061 }, |
|
8062 "array-invoke": { |
|
8063 "requires": [ |
|
8064 "yui-base" |
|
8065 ] |
|
8066 }, |
|
8067 "arraylist": { |
|
8068 "requires": [ |
|
8069 "yui-base" |
|
8070 ] |
|
8071 }, |
|
8072 "arraylist-add": { |
|
8073 "requires": [ |
|
8074 "arraylist" |
|
8075 ] |
|
8076 }, |
|
8077 "arraylist-filter": { |
|
8078 "requires": [ |
|
8079 "arraylist" |
|
8080 ] |
|
8081 }, |
|
8082 "arraysort": { |
|
8083 "requires": [ |
|
8084 "yui-base" |
|
8085 ] |
|
8086 }, |
|
8087 "async-queue": { |
|
8088 "requires": [ |
|
8089 "event-custom" |
|
8090 ] |
|
8091 }, |
|
8092 "attribute": { |
|
8093 "use": [ |
|
8094 "attribute-base", |
|
8095 "attribute-complex" |
|
8096 ] |
|
8097 }, |
|
8098 "attribute-base": { |
|
8099 "requires": [ |
|
8100 "attribute-core", |
|
8101 "attribute-observable", |
|
8102 "attribute-extras" |
|
8103 ] |
|
8104 }, |
|
8105 "attribute-complex": { |
|
8106 "requires": [ |
|
8107 "attribute-base" |
|
8108 ] |
|
8109 }, |
|
8110 "attribute-core": { |
|
8111 "requires": [ |
|
8112 "oop" |
|
8113 ] |
|
8114 }, |
|
8115 "attribute-events": { |
|
8116 "use": [ |
|
8117 "attribute-observable" |
|
8118 ] |
|
8119 }, |
|
8120 "attribute-extras": { |
|
8121 "requires": [ |
|
8122 "oop" |
|
8123 ] |
|
8124 }, |
|
8125 "attribute-observable": { |
|
8126 "requires": [ |
|
8127 "event-custom" |
|
8128 ] |
|
8129 }, |
|
8130 "autocomplete": { |
|
8131 "use": [ |
|
8132 "autocomplete-base", |
|
8133 "autocomplete-sources", |
|
8134 "autocomplete-list", |
|
8135 "autocomplete-plugin" |
|
8136 ] |
|
8137 }, |
|
8138 "autocomplete-base": { |
|
8139 "optional": [ |
|
8140 "autocomplete-sources" |
|
8141 ], |
|
8142 "requires": [ |
|
8143 "array-extras", |
|
8144 "base-build", |
|
8145 "escape", |
|
8146 "event-valuechange", |
|
8147 "node-base" |
|
8148 ] |
|
8149 }, |
|
8150 "autocomplete-filters": { |
|
8151 "requires": [ |
|
8152 "array-extras", |
|
8153 "text-wordbreak" |
|
8154 ] |
|
8155 }, |
|
8156 "autocomplete-filters-accentfold": { |
|
8157 "requires": [ |
|
8158 "array-extras", |
|
8159 "text-accentfold", |
|
8160 "text-wordbreak" |
|
8161 ] |
|
8162 }, |
|
8163 "autocomplete-highlighters": { |
|
8164 "requires": [ |
|
8165 "array-extras", |
|
8166 "highlight-base" |
|
8167 ] |
|
8168 }, |
|
8169 "autocomplete-highlighters-accentfold": { |
|
8170 "requires": [ |
|
8171 "array-extras", |
|
8172 "highlight-accentfold" |
|
8173 ] |
|
8174 }, |
|
8175 "autocomplete-list": { |
|
8176 "after": [ |
|
8177 "autocomplete-sources" |
|
8178 ], |
|
8179 "lang": [ |
|
8180 "en", |
|
8181 "es", |
|
8182 "it" |
|
8183 ], |
|
8184 "requires": [ |
|
8185 "autocomplete-base", |
|
8186 "event-resize", |
|
8187 "node-screen", |
|
8188 "selector-css3", |
|
8189 "shim-plugin", |
|
8190 "widget", |
|
8191 "widget-position", |
|
8192 "widget-position-align" |
|
8193 ], |
|
8194 "skinnable": true |
|
8195 }, |
|
8196 "autocomplete-list-keys": { |
|
8197 "condition": { |
|
8198 "name": "autocomplete-list-keys", |
|
8199 "test": function (Y) { |
|
8200 // Only add keyboard support to autocomplete-list if this doesn't appear to |
|
8201 // be an iOS or Android-based mobile device. |
|
8202 // |
|
8203 // There's currently no feasible way to actually detect whether a device has |
|
8204 // a hardware keyboard, so this sniff will have to do. It can easily be |
|
8205 // overridden by manually loading the autocomplete-list-keys module. |
|
8206 // |
|
8207 // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari |
|
8208 // doesn't fire the keyboard events used by AutoCompleteList, so there's |
|
8209 // no point loading the -keys module even when a bluetooth keyboard may be |
|
8210 // available. |
|
8211 return !(Y.UA.ios || Y.UA.android); |
|
8212 }, |
|
8213 "trigger": "autocomplete-list" |
|
8214 }, |
|
8215 "requires": [ |
|
8216 "autocomplete-list", |
|
8217 "base-build" |
|
8218 ] |
|
8219 }, |
|
8220 "autocomplete-plugin": { |
|
8221 "requires": [ |
|
8222 "autocomplete-list", |
|
8223 "node-pluginhost" |
|
8224 ] |
|
8225 }, |
|
8226 "autocomplete-sources": { |
|
8227 "optional": [ |
|
8228 "io-base", |
|
8229 "json-parse", |
|
8230 "jsonp", |
|
8231 "yql" |
|
8232 ], |
|
8233 "requires": [ |
|
8234 "autocomplete-base" |
|
8235 ] |
|
8236 }, |
|
8237 "axes": { |
|
8238 "use": [ |
|
8239 "axis-numeric", |
|
8240 "axis-category", |
|
8241 "axis-time", |
|
8242 "axis-stacked" |
|
8243 ] |
|
8244 }, |
|
8245 "axes-base": { |
|
8246 "use": [ |
|
8247 "axis-numeric-base", |
|
8248 "axis-category-base", |
|
8249 "axis-time-base", |
|
8250 "axis-stacked-base" |
|
8251 ] |
|
8252 }, |
|
8253 "axis": { |
|
8254 "requires": [ |
|
8255 "dom", |
|
8256 "widget", |
|
8257 "widget-position", |
|
8258 "widget-stack", |
|
8259 "graphics", |
|
8260 "axis-base" |
|
8261 ] |
|
8262 }, |
|
8263 "axis-base": { |
|
8264 "requires": [ |
|
8265 "classnamemanager", |
|
8266 "datatype-number", |
|
8267 "datatype-date", |
|
8268 "base", |
|
8269 "event-custom" |
|
8270 ] |
|
8271 }, |
|
8272 "axis-category": { |
|
8273 "requires": [ |
|
8274 "axis", |
|
8275 "axis-category-base" |
|
8276 ] |
|
8277 }, |
|
8278 "axis-category-base": { |
|
8279 "requires": [ |
|
8280 "axis-base" |
|
8281 ] |
|
8282 }, |
|
8283 "axis-numeric": { |
|
8284 "requires": [ |
|
8285 "axis", |
|
8286 "axis-numeric-base" |
|
8287 ] |
|
8288 }, |
|
8289 "axis-numeric-base": { |
|
8290 "requires": [ |
|
8291 "axis-base" |
|
8292 ] |
|
8293 }, |
|
8294 "axis-stacked": { |
|
8295 "requires": [ |
|
8296 "axis-numeric", |
|
8297 "axis-stacked-base" |
|
8298 ] |
|
8299 }, |
|
8300 "axis-stacked-base": { |
|
8301 "requires": [ |
|
8302 "axis-numeric-base" |
|
8303 ] |
|
8304 }, |
|
8305 "axis-time": { |
|
8306 "requires": [ |
|
8307 "axis", |
|
8308 "axis-time-base" |
|
8309 ] |
|
8310 }, |
|
8311 "axis-time-base": { |
|
8312 "requires": [ |
|
8313 "axis-base" |
|
8314 ] |
|
8315 }, |
|
8316 "base": { |
|
8317 "use": [ |
|
8318 "base-base", |
|
8319 "base-pluginhost", |
|
8320 "base-build" |
|
8321 ] |
|
8322 }, |
|
8323 "base-base": { |
|
8324 "requires": [ |
|
8325 "attribute-base", |
|
8326 "base-core", |
|
8327 "base-observable" |
|
8328 ] |
|
8329 }, |
|
8330 "base-build": { |
|
8331 "requires": [ |
|
8332 "base-base" |
|
8333 ] |
|
8334 }, |
|
8335 "base-core": { |
|
8336 "requires": [ |
|
8337 "attribute-core" |
|
8338 ] |
|
8339 }, |
|
8340 "base-observable": { |
|
8341 "requires": [ |
|
8342 "attribute-observable" |
|
8343 ] |
|
8344 }, |
|
8345 "base-pluginhost": { |
|
8346 "requires": [ |
|
8347 "base-base", |
|
8348 "pluginhost" |
|
8349 ] |
|
8350 }, |
|
8351 "button": { |
|
8352 "requires": [ |
|
8353 "button-core", |
|
8354 "cssbutton", |
|
8355 "widget" |
|
8356 ] |
|
8357 }, |
|
8358 "button-core": { |
|
8359 "requires": [ |
|
8360 "attribute-core", |
|
8361 "classnamemanager", |
|
8362 "node-base" |
|
8363 ] |
|
8364 }, |
|
8365 "button-group": { |
|
8366 "requires": [ |
|
8367 "button-plugin", |
|
8368 "cssbutton", |
|
8369 "widget" |
|
8370 ] |
|
8371 }, |
|
8372 "button-plugin": { |
|
8373 "requires": [ |
|
8374 "button-core", |
|
8375 "cssbutton", |
|
8376 "node-pluginhost" |
|
8377 ] |
|
8378 }, |
|
8379 "cache": { |
|
8380 "use": [ |
|
8381 "cache-base", |
|
8382 "cache-offline", |
|
8383 "cache-plugin" |
|
8384 ] |
|
8385 }, |
|
8386 "cache-base": { |
|
8387 "requires": [ |
|
8388 "base" |
|
8389 ] |
|
8390 }, |
|
8391 "cache-offline": { |
|
8392 "requires": [ |
|
8393 "cache-base", |
|
8394 "json" |
|
8395 ] |
|
8396 }, |
|
8397 "cache-plugin": { |
|
8398 "requires": [ |
|
8399 "plugin", |
|
8400 "cache-base" |
|
8401 ] |
|
8402 }, |
|
8403 "calendar": { |
|
8404 "lang": [ |
|
8405 "de", |
|
8406 "en", |
|
8407 "es", |
|
8408 "es-AR", |
|
8409 "fr", |
|
8410 "it", |
|
8411 "ja", |
|
8412 "nb-NO", |
|
8413 "nl", |
|
8414 "pt-BR", |
|
8415 "ru", |
|
8416 "zh-HANT-TW" |
|
8417 ], |
|
8418 "requires": [ |
|
8419 "calendar-base", |
|
8420 "calendarnavigator" |
|
8421 ], |
|
8422 "skinnable": true |
|
8423 }, |
|
8424 "calendar-base": { |
|
8425 "lang": [ |
|
8426 "de", |
|
8427 "en", |
|
8428 "es", |
|
8429 "es-AR", |
|
8430 "fr", |
|
8431 "it", |
|
8432 "ja", |
|
8433 "nb-NO", |
|
8434 "nl", |
|
8435 "pt-BR", |
|
8436 "ru", |
|
8437 "zh-HANT-TW" |
|
8438 ], |
|
8439 "requires": [ |
|
8440 "widget", |
|
8441 "datatype-date", |
|
8442 "datatype-date-math", |
|
8443 "cssgrids" |
|
8444 ], |
|
8445 "skinnable": true |
|
8446 }, |
|
8447 "calendarnavigator": { |
|
8448 "requires": [ |
|
8449 "plugin", |
|
8450 "classnamemanager", |
|
8451 "datatype-date", |
|
8452 "node" |
|
8453 ], |
|
8454 "skinnable": true |
|
8455 }, |
|
8456 "charts": { |
|
8457 "use": [ |
|
8458 "charts-base" |
|
8459 ] |
|
8460 }, |
|
8461 "charts-base": { |
|
8462 "requires": [ |
|
8463 "dom", |
|
8464 "event-mouseenter", |
|
8465 "event-touch", |
|
8466 "graphics-group", |
|
8467 "axes", |
|
8468 "series-pie", |
|
8469 "series-line", |
|
8470 "series-marker", |
|
8471 "series-area", |
|
8472 "series-spline", |
|
8473 "series-column", |
|
8474 "series-bar", |
|
8475 "series-areaspline", |
|
8476 "series-combo", |
|
8477 "series-combospline", |
|
8478 "series-line-stacked", |
|
8479 "series-marker-stacked", |
|
8480 "series-area-stacked", |
|
8481 "series-spline-stacked", |
|
8482 "series-column-stacked", |
|
8483 "series-bar-stacked", |
|
8484 "series-areaspline-stacked", |
|
8485 "series-combo-stacked", |
|
8486 "series-combospline-stacked" |
|
8487 ] |
|
8488 }, |
|
8489 "charts-legend": { |
|
8490 "requires": [ |
|
8491 "charts-base" |
|
8492 ] |
|
8493 }, |
|
8494 "classnamemanager": { |
|
8495 "requires": [ |
|
8496 "yui-base" |
|
8497 ] |
|
8498 }, |
|
8499 "clickable-rail": { |
|
8500 "requires": [ |
|
8501 "slider-base" |
|
8502 ] |
|
8503 }, |
|
8504 "collection": { |
|
8505 "use": [ |
|
8506 "array-extras", |
|
8507 "arraylist", |
|
8508 "arraylist-add", |
|
8509 "arraylist-filter", |
|
8510 "array-invoke" |
|
8511 ] |
|
8512 }, |
|
8513 "color": { |
|
8514 "use": [ |
|
8515 "color-base", |
|
8516 "color-hsl", |
|
8517 "color-harmony" |
|
8518 ] |
|
8519 }, |
|
8520 "color-base": { |
|
8521 "requires": [ |
|
8522 "yui-base" |
|
8523 ] |
|
8524 }, |
|
8525 "color-harmony": { |
|
8526 "requires": [ |
|
8527 "color-hsl" |
|
8528 ] |
|
8529 }, |
|
8530 "color-hsl": { |
|
8531 "requires": [ |
|
8532 "color-base" |
|
8533 ] |
|
8534 }, |
|
8535 "color-hsv": { |
|
8536 "requires": [ |
|
8537 "color-base" |
|
8538 ] |
|
8539 }, |
|
8540 "console": { |
|
8541 "lang": [ |
|
8542 "en", |
|
8543 "es", |
|
8544 "it", |
|
8545 "ja" |
|
8546 ], |
|
8547 "requires": [ |
|
8548 "yui-log", |
|
8549 "widget" |
|
8550 ], |
|
8551 "skinnable": true |
|
8552 }, |
|
8553 "console-filters": { |
|
8554 "requires": [ |
|
8555 "plugin", |
|
8556 "console" |
|
8557 ], |
|
8558 "skinnable": true |
|
8559 }, |
|
8560 "controller": { |
|
8561 "use": [ |
|
8562 "router" |
|
8563 ] |
|
8564 }, |
|
8565 "cookie": { |
|
8566 "requires": [ |
|
8567 "yui-base" |
|
8568 ] |
|
8569 }, |
|
8570 "createlink-base": { |
|
8571 "requires": [ |
|
8572 "editor-base" |
|
8573 ] |
|
8574 }, |
|
8575 "cssbase": { |
|
8576 "after": [ |
|
8577 "cssreset", |
|
8578 "cssfonts", |
|
8579 "cssgrids", |
|
8580 "cssreset-context", |
|
8581 "cssfonts-context", |
|
8582 "cssgrids-context" |
|
8583 ], |
|
8584 "type": "css" |
|
8585 }, |
|
8586 "cssbase-context": { |
|
8587 "after": [ |
|
8588 "cssreset", |
|
8589 "cssfonts", |
|
8590 "cssgrids", |
|
8591 "cssreset-context", |
|
8592 "cssfonts-context", |
|
8593 "cssgrids-context" |
|
8594 ], |
|
8595 "type": "css" |
|
8596 }, |
|
8597 "cssbutton": { |
|
8598 "type": "css" |
|
8599 }, |
|
8600 "cssfonts": { |
|
8601 "type": "css" |
|
8602 }, |
|
8603 "cssfonts-context": { |
|
8604 "type": "css" |
|
8605 }, |
|
8606 "cssgrids": { |
|
8607 "optional": [ |
|
8608 "cssreset", |
|
8609 "cssfonts" |
|
8610 ], |
|
8611 "type": "css" |
|
8612 }, |
|
8613 "cssgrids-base": { |
|
8614 "optional": [ |
|
8615 "cssreset", |
|
8616 "cssfonts" |
|
8617 ], |
|
8618 "type": "css" |
|
8619 }, |
|
8620 "cssgrids-responsive": { |
|
8621 "optional": [ |
|
8622 "cssreset", |
|
8623 "cssfonts" |
|
8624 ], |
|
8625 "requires": [ |
|
8626 "cssgrids", |
|
8627 "cssgrids-responsive-base" |
|
8628 ], |
|
8629 "type": "css" |
|
8630 }, |
|
8631 "cssgrids-units": { |
|
8632 "optional": [ |
|
8633 "cssreset", |
|
8634 "cssfonts" |
|
8635 ], |
|
8636 "requires": [ |
|
8637 "cssgrids-base" |
|
8638 ], |
|
8639 "type": "css" |
|
8640 }, |
|
8641 "cssnormalize": { |
|
8642 "type": "css" |
|
8643 }, |
|
8644 "cssnormalize-context": { |
|
8645 "type": "css" |
|
8646 }, |
|
8647 "cssreset": { |
|
8648 "type": "css" |
|
8649 }, |
|
8650 "cssreset-context": { |
|
8651 "type": "css" |
|
8652 }, |
|
8653 "dataschema": { |
|
8654 "use": [ |
|
8655 "dataschema-base", |
|
8656 "dataschema-json", |
|
8657 "dataschema-xml", |
|
8658 "dataschema-array", |
|
8659 "dataschema-text" |
|
8660 ] |
|
8661 }, |
|
8662 "dataschema-array": { |
|
8663 "requires": [ |
|
8664 "dataschema-base" |
|
8665 ] |
|
8666 }, |
|
8667 "dataschema-base": { |
|
8668 "requires": [ |
|
8669 "base" |
|
8670 ] |
|
8671 }, |
|
8672 "dataschema-json": { |
|
8673 "requires": [ |
|
8674 "dataschema-base", |
|
8675 "json" |
|
8676 ] |
|
8677 }, |
|
8678 "dataschema-text": { |
|
8679 "requires": [ |
|
8680 "dataschema-base" |
|
8681 ] |
|
8682 }, |
|
8683 "dataschema-xml": { |
|
8684 "requires": [ |
|
8685 "dataschema-base" |
|
8686 ] |
|
8687 }, |
|
8688 "datasource": { |
|
8689 "use": [ |
|
8690 "datasource-local", |
|
8691 "datasource-io", |
|
8692 "datasource-get", |
|
8693 "datasource-function", |
|
8694 "datasource-cache", |
|
8695 "datasource-jsonschema", |
|
8696 "datasource-xmlschema", |
|
8697 "datasource-arrayschema", |
|
8698 "datasource-textschema", |
|
8699 "datasource-polling" |
|
8700 ] |
|
8701 }, |
|
8702 "datasource-arrayschema": { |
|
8703 "requires": [ |
|
8704 "datasource-local", |
|
8705 "plugin", |
|
8706 "dataschema-array" |
|
8707 ] |
|
8708 }, |
|
8709 "datasource-cache": { |
|
8710 "requires": [ |
|
8711 "datasource-local", |
|
8712 "plugin", |
|
8713 "cache-base" |
|
8714 ] |
|
8715 }, |
|
8716 "datasource-function": { |
|
8717 "requires": [ |
|
8718 "datasource-local" |
|
8719 ] |
|
8720 }, |
|
8721 "datasource-get": { |
|
8722 "requires": [ |
|
8723 "datasource-local", |
|
8724 "get" |
|
8725 ] |
|
8726 }, |
|
8727 "datasource-io": { |
|
8728 "requires": [ |
|
8729 "datasource-local", |
|
8730 "io-base" |
|
8731 ] |
|
8732 }, |
|
8733 "datasource-jsonschema": { |
|
8734 "requires": [ |
|
8735 "datasource-local", |
|
8736 "plugin", |
|
8737 "dataschema-json" |
|
8738 ] |
|
8739 }, |
|
8740 "datasource-local": { |
|
8741 "requires": [ |
|
8742 "base" |
|
8743 ] |
|
8744 }, |
|
8745 "datasource-polling": { |
|
8746 "requires": [ |
|
8747 "datasource-local" |
|
8748 ] |
|
8749 }, |
|
8750 "datasource-textschema": { |
|
8751 "requires": [ |
|
8752 "datasource-local", |
|
8753 "plugin", |
|
8754 "dataschema-text" |
|
8755 ] |
|
8756 }, |
|
8757 "datasource-xmlschema": { |
|
8758 "requires": [ |
|
8759 "datasource-local", |
|
8760 "plugin", |
|
8761 "datatype-xml", |
|
8762 "dataschema-xml" |
|
8763 ] |
|
8764 }, |
|
8765 "datatable": { |
|
8766 "use": [ |
|
8767 "datatable-core", |
|
8768 "datatable-table", |
|
8769 "datatable-head", |
|
8770 "datatable-body", |
|
8771 "datatable-base", |
|
8772 "datatable-column-widths", |
|
8773 "datatable-message", |
|
8774 "datatable-mutable", |
|
8775 "datatable-sort", |
|
8776 "datatable-datasource" |
|
8777 ] |
|
8778 }, |
|
8779 "datatable-base": { |
|
8780 "requires": [ |
|
8781 "datatable-core", |
|
8782 "datatable-table", |
|
8783 "datatable-head", |
|
8784 "datatable-body", |
|
8785 "base-build", |
|
8786 "widget" |
|
8787 ], |
|
8788 "skinnable": true |
|
8789 }, |
|
8790 "datatable-body": { |
|
8791 "requires": [ |
|
8792 "datatable-core", |
|
8793 "view", |
|
8794 "classnamemanager" |
|
8795 ] |
|
8796 }, |
|
8797 "datatable-column-widths": { |
|
8798 "requires": [ |
|
8799 "datatable-base" |
|
8800 ] |
|
8801 }, |
|
8802 "datatable-core": { |
|
8803 "requires": [ |
|
8804 "escape", |
|
8805 "model-list", |
|
8806 "node-event-delegate" |
|
8807 ] |
|
8808 }, |
|
8809 "datatable-datasource": { |
|
8810 "requires": [ |
|
8811 "datatable-base", |
|
8812 "plugin", |
|
8813 "datasource-local" |
|
8814 ] |
|
8815 }, |
|
8816 "datatable-formatters": { |
|
8817 "requires": [ |
|
8818 "datatable-body", |
|
8819 "datatype-number-format", |
|
8820 "datatype-date-format", |
|
8821 "escape" |
|
8822 ] |
|
8823 }, |
|
8824 "datatable-head": { |
|
8825 "requires": [ |
|
8826 "datatable-core", |
|
8827 "view", |
|
8828 "classnamemanager" |
|
8829 ] |
|
8830 }, |
|
8831 "datatable-message": { |
|
8832 "lang": [ |
|
8833 "en", |
|
8834 "fr", |
|
8835 "es", |
|
8836 "it" |
|
8837 ], |
|
8838 "requires": [ |
|
8839 "datatable-base" |
|
8840 ], |
|
8841 "skinnable": true |
|
8842 }, |
|
8843 "datatable-mutable": { |
|
8844 "requires": [ |
|
8845 "datatable-base" |
|
8846 ] |
|
8847 }, |
|
8848 "datatable-scroll": { |
|
8849 "requires": [ |
|
8850 "datatable-base", |
|
8851 "datatable-column-widths", |
|
8852 "dom-screen" |
|
8853 ], |
|
8854 "skinnable": true |
|
8855 }, |
|
8856 "datatable-sort": { |
|
8857 "lang": [ |
|
8858 "en", |
|
8859 "fr", |
|
8860 "es" |
|
8861 ], |
|
8862 "requires": [ |
|
8863 "datatable-base" |
|
8864 ], |
|
8865 "skinnable": true |
|
8866 }, |
|
8867 "datatable-table": { |
|
8868 "requires": [ |
|
8869 "datatable-core", |
|
8870 "datatable-head", |
|
8871 "datatable-body", |
|
8872 "view", |
|
8873 "classnamemanager" |
|
8874 ] |
|
8875 }, |
|
8876 "datatype": { |
|
8877 "use": [ |
|
8878 "datatype-date", |
|
8879 "datatype-number", |
|
8880 "datatype-xml" |
|
8881 ] |
|
8882 }, |
|
8883 "datatype-date": { |
|
8884 "use": [ |
|
8885 "datatype-date-parse", |
|
8886 "datatype-date-format", |
|
8887 "datatype-date-math" |
|
8888 ] |
|
8889 }, |
|
8890 "datatype-date-format": { |
|
8891 "lang": [ |
|
8892 "ar", |
|
8893 "ar-JO", |
|
8894 "ca", |
|
8895 "ca-ES", |
|
8896 "da", |
|
8897 "da-DK", |
|
8898 "de", |
|
8899 "de-AT", |
|
8900 "de-DE", |
|
8901 "el", |
|
8902 "el-GR", |
|
8903 "en", |
|
8904 "en-AU", |
|
8905 "en-CA", |
|
8906 "en-GB", |
|
8907 "en-IE", |
|
8908 "en-IN", |
|
8909 "en-JO", |
|
8910 "en-MY", |
|
8911 "en-NZ", |
|
8912 "en-PH", |
|
8913 "en-SG", |
|
8914 "en-US", |
|
8915 "es", |
|
8916 "es-AR", |
|
8917 "es-BO", |
|
8918 "es-CL", |
|
8919 "es-CO", |
|
8920 "es-EC", |
|
8921 "es-ES", |
|
8922 "es-MX", |
|
8923 "es-PE", |
|
8924 "es-PY", |
|
8925 "es-US", |
|
8926 "es-UY", |
|
8927 "es-VE", |
|
8928 "fi", |
|
8929 "fi-FI", |
|
8930 "fr", |
|
8931 "fr-BE", |
|
8932 "fr-CA", |
|
8933 "fr-FR", |
|
8934 "hi", |
|
8935 "hi-IN", |
|
8936 "id", |
|
8937 "id-ID", |
|
8938 "it", |
|
8939 "it-IT", |
|
8940 "ja", |
|
8941 "ja-JP", |
|
8942 "ko", |
|
8943 "ko-KR", |
|
8944 "ms", |
|
8945 "ms-MY", |
|
8946 "nb", |
|
8947 "nb-NO", |
|
8948 "nl", |
|
8949 "nl-BE", |
|
8950 "nl-NL", |
|
8951 "pl", |
|
8952 "pl-PL", |
|
8953 "pt", |
|
8954 "pt-BR", |
|
8955 "ro", |
|
8956 "ro-RO", |
|
8957 "ru", |
|
8958 "ru-RU", |
|
8959 "sv", |
|
8960 "sv-SE", |
|
8961 "th", |
|
8962 "th-TH", |
|
8963 "tr", |
|
8964 "tr-TR", |
|
8965 "vi", |
|
8966 "vi-VN", |
|
8967 "zh-Hans", |
|
8968 "zh-Hans-CN", |
|
8969 "zh-Hant", |
|
8970 "zh-Hant-HK", |
|
8971 "zh-Hant-TW" |
|
8972 ] |
|
8973 }, |
|
8974 "datatype-date-math": { |
|
8975 "requires": [ |
|
8976 "yui-base" |
|
8977 ] |
|
8978 }, |
|
8979 "datatype-date-parse": {}, |
|
8980 "datatype-number": { |
|
8981 "use": [ |
|
8982 "datatype-number-parse", |
|
8983 "datatype-number-format" |
|
8984 ] |
|
8985 }, |
|
8986 "datatype-number-format": {}, |
|
8987 "datatype-number-parse": {}, |
|
8988 "datatype-xml": { |
|
8989 "use": [ |
|
8990 "datatype-xml-parse", |
|
8991 "datatype-xml-format" |
|
8992 ] |
|
8993 }, |
|
8994 "datatype-xml-format": {}, |
|
8995 "datatype-xml-parse": {}, |
|
8996 "dd": { |
|
8997 "use": [ |
|
8998 "dd-ddm-base", |
|
8999 "dd-ddm", |
|
9000 "dd-ddm-drop", |
|
9001 "dd-drag", |
|
9002 "dd-proxy", |
|
9003 "dd-constrain", |
|
9004 "dd-drop", |
|
9005 "dd-scroll", |
|
9006 "dd-delegate" |
|
9007 ] |
|
9008 }, |
|
9009 "dd-constrain": { |
|
9010 "requires": [ |
|
9011 "dd-drag" |
|
9012 ] |
|
9013 }, |
|
9014 "dd-ddm": { |
|
9015 "requires": [ |
|
9016 "dd-ddm-base", |
|
9017 "event-resize" |
|
9018 ] |
|
9019 }, |
|
9020 "dd-ddm-base": { |
|
9021 "requires": [ |
|
9022 "node", |
|
9023 "base", |
|
9024 "yui-throttle", |
|
9025 "classnamemanager" |
|
9026 ] |
|
9027 }, |
|
9028 "dd-ddm-drop": { |
|
9029 "requires": [ |
|
9030 "dd-ddm" |
|
9031 ] |
|
9032 }, |
|
9033 "dd-delegate": { |
|
9034 "requires": [ |
|
9035 "dd-drag", |
|
9036 "dd-drop-plugin", |
|
9037 "event-mouseenter" |
|
9038 ] |
|
9039 }, |
|
9040 "dd-drag": { |
|
9041 "requires": [ |
|
9042 "dd-ddm-base" |
|
9043 ] |
|
9044 }, |
|
9045 "dd-drop": { |
|
9046 "requires": [ |
|
9047 "dd-drag", |
|
9048 "dd-ddm-drop" |
|
9049 ] |
|
9050 }, |
|
9051 "dd-drop-plugin": { |
|
9052 "requires": [ |
|
9053 "dd-drop" |
|
9054 ] |
|
9055 }, |
|
9056 "dd-gestures": { |
|
9057 "condition": { |
|
9058 "name": "dd-gestures", |
|
9059 "trigger": "dd-drag", |
|
9060 "ua": "touchEnabled" |
|
9061 }, |
|
9062 "requires": [ |
|
9063 "dd-drag", |
|
9064 "event-synthetic", |
|
9065 "event-gestures" |
|
9066 ] |
|
9067 }, |
|
9068 "dd-plugin": { |
|
9069 "optional": [ |
|
9070 "dd-constrain", |
|
9071 "dd-proxy" |
|
9072 ], |
|
9073 "requires": [ |
|
9074 "dd-drag" |
|
9075 ] |
|
9076 }, |
|
9077 "dd-proxy": { |
|
9078 "requires": [ |
|
9079 "dd-drag" |
|
9080 ] |
|
9081 }, |
|
9082 "dd-scroll": { |
|
9083 "requires": [ |
|
9084 "dd-drag" |
|
9085 ] |
|
9086 }, |
|
9087 "dial": { |
|
9088 "lang": [ |
|
9089 "en", |
|
9090 "es" |
|
9091 ], |
|
9092 "requires": [ |
|
9093 "widget", |
|
9094 "dd-drag", |
|
9095 "event-mouseenter", |
|
9096 "event-move", |
|
9097 "event-key", |
|
9098 "transition", |
|
9099 "intl" |
|
9100 ], |
|
9101 "skinnable": true |
|
9102 }, |
|
9103 "dom": { |
|
9104 "use": [ |
|
9105 "dom-base", |
|
9106 "dom-screen", |
|
9107 "dom-style", |
|
9108 "selector-native", |
|
9109 "selector" |
|
9110 ] |
|
9111 }, |
|
9112 "dom-base": { |
|
9113 "requires": [ |
|
9114 "dom-core" |
|
9115 ] |
|
9116 }, |
|
9117 "dom-core": { |
|
9118 "requires": [ |
|
9119 "oop", |
|
9120 "features" |
|
9121 ] |
|
9122 }, |
|
9123 "dom-deprecated": { |
|
9124 "requires": [ |
|
9125 "dom-base" |
|
9126 ] |
|
9127 }, |
|
9128 "dom-screen": { |
|
9129 "requires": [ |
|
9130 "dom-base", |
|
9131 "dom-style" |
|
9132 ] |
|
9133 }, |
|
9134 "dom-style": { |
|
9135 "requires": [ |
|
9136 "dom-base", |
|
9137 "color-base" |
|
9138 ] |
|
9139 }, |
|
9140 "dom-style-ie": { |
|
9141 "condition": { |
|
9142 "name": "dom-style-ie", |
|
9143 "test": function (Y) { |
|
9144 |
|
9145 var testFeature = Y.Features.test, |
|
9146 addFeature = Y.Features.add, |
|
9147 WINDOW = Y.config.win, |
|
9148 DOCUMENT = Y.config.doc, |
|
9149 DOCUMENT_ELEMENT = 'documentElement', |
|
9150 ret = false; |
|
9151 |
|
9152 addFeature('style', 'computedStyle', { |
|
9153 test: function() { |
|
9154 return WINDOW && 'getComputedStyle' in WINDOW; |
|
9155 } |
|
9156 }); |
|
9157 |
|
9158 addFeature('style', 'opacity', { |
|
9159 test: function() { |
|
9160 return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style; |
|
9161 } |
|
9162 }); |
|
9163 |
|
9164 ret = (!testFeature('style', 'opacity') && |
|
9165 !testFeature('style', 'computedStyle')); |
|
9166 |
|
9167 return ret; |
|
9168 }, |
|
9169 "trigger": "dom-style" |
|
9170 }, |
|
9171 "requires": [ |
|
9172 "dom-style" |
|
9173 ] |
|
9174 }, |
|
9175 "dump": { |
|
9176 "requires": [ |
|
9177 "yui-base" |
|
9178 ] |
|
9179 }, |
|
9180 "editor": { |
|
9181 "use": [ |
|
9182 "frame", |
|
9183 "editor-selection", |
|
9184 "exec-command", |
|
9185 "editor-base", |
|
9186 "editor-para", |
|
9187 "editor-br", |
|
9188 "editor-bidi", |
|
9189 "editor-tab", |
|
9190 "createlink-base" |
|
9191 ] |
|
9192 }, |
|
9193 "editor-base": { |
|
9194 "requires": [ |
|
9195 "base", |
|
9196 "frame", |
|
9197 "node", |
|
9198 "exec-command", |
|
9199 "editor-selection" |
|
9200 ] |
|
9201 }, |
|
9202 "editor-bidi": { |
|
9203 "requires": [ |
|
9204 "editor-base" |
|
9205 ] |
|
9206 }, |
|
9207 "editor-br": { |
|
9208 "requires": [ |
|
9209 "editor-base" |
|
9210 ] |
|
9211 }, |
|
9212 "editor-lists": { |
|
9213 "requires": [ |
|
9214 "editor-base" |
|
9215 ] |
|
9216 }, |
|
9217 "editor-para": { |
|
9218 "requires": [ |
|
9219 "editor-para-base" |
|
9220 ] |
|
9221 }, |
|
9222 "editor-para-base": { |
|
9223 "requires": [ |
|
9224 "editor-base" |
|
9225 ] |
|
9226 }, |
|
9227 "editor-para-ie": { |
|
9228 "condition": { |
|
9229 "name": "editor-para-ie", |
|
9230 "trigger": "editor-para", |
|
9231 "ua": "ie", |
|
9232 "when": "instead" |
|
9233 }, |
|
9234 "requires": [ |
|
9235 "editor-para-base" |
|
9236 ] |
|
9237 }, |
|
9238 "editor-selection": { |
|
9239 "requires": [ |
|
9240 "node" |
|
9241 ] |
|
9242 }, |
|
9243 "editor-tab": { |
|
9244 "requires": [ |
|
9245 "editor-base" |
|
9246 ] |
|
9247 }, |
|
9248 "escape": { |
|
9249 "requires": [ |
|
9250 "yui-base" |
|
9251 ] |
|
9252 }, |
|
9253 "event": { |
|
9254 "after": [ |
|
9255 "node-base" |
|
9256 ], |
|
9257 "use": [ |
|
9258 "event-base", |
|
9259 "event-delegate", |
|
9260 "event-synthetic", |
|
9261 "event-mousewheel", |
|
9262 "event-mouseenter", |
|
9263 "event-key", |
|
9264 "event-focus", |
|
9265 "event-resize", |
|
9266 "event-hover", |
|
9267 "event-outside", |
|
9268 "event-touch", |
|
9269 "event-move", |
|
9270 "event-flick", |
|
9271 "event-valuechange", |
|
9272 "event-tap" |
|
9273 ] |
|
9274 }, |
|
9275 "event-base": { |
|
9276 "after": [ |
|
9277 "node-base" |
|
9278 ], |
|
9279 "requires": [ |
|
9280 "event-custom-base" |
|
9281 ] |
|
9282 }, |
|
9283 "event-base-ie": { |
|
9284 "after": [ |
|
9285 "event-base" |
|
9286 ], |
|
9287 "condition": { |
|
9288 "name": "event-base-ie", |
|
9289 "test": function(Y) { |
|
9290 var imp = Y.config.doc && Y.config.doc.implementation; |
|
9291 return (imp && (!imp.hasFeature('Events', '2.0'))); |
|
9292 }, |
|
9293 "trigger": "node-base" |
|
9294 }, |
|
9295 "requires": [ |
|
9296 "node-base" |
|
9297 ] |
|
9298 }, |
|
9299 "event-contextmenu": { |
|
9300 "requires": [ |
|
9301 "event-synthetic", |
|
9302 "dom-screen" |
|
9303 ] |
|
9304 }, |
|
9305 "event-custom": { |
|
9306 "use": [ |
|
9307 "event-custom-base", |
|
9308 "event-custom-complex" |
|
9309 ] |
|
9310 }, |
|
9311 "event-custom-base": { |
|
9312 "requires": [ |
|
9313 "oop" |
|
9314 ] |
|
9315 }, |
|
9316 "event-custom-complex": { |
|
9317 "requires": [ |
|
9318 "event-custom-base" |
|
9319 ] |
|
9320 }, |
|
9321 "event-delegate": { |
|
9322 "requires": [ |
|
9323 "node-base" |
|
9324 ] |
|
9325 }, |
|
9326 "event-flick": { |
|
9327 "requires": [ |
|
9328 "node-base", |
|
9329 "event-touch", |
|
9330 "event-synthetic" |
|
9331 ] |
|
9332 }, |
|
9333 "event-focus": { |
|
9334 "requires": [ |
|
9335 "event-synthetic" |
|
9336 ] |
|
9337 }, |
|
9338 "event-gestures": { |
|
9339 "use": [ |
|
9340 "event-flick", |
|
9341 "event-move" |
|
9342 ] |
|
9343 }, |
|
9344 "event-hover": { |
|
9345 "requires": [ |
|
9346 "event-mouseenter" |
|
9347 ] |
|
9348 }, |
|
9349 "event-key": { |
|
9350 "requires": [ |
|
9351 "event-synthetic" |
|
9352 ] |
|
9353 }, |
|
9354 "event-mouseenter": { |
|
9355 "requires": [ |
|
9356 "event-synthetic" |
|
9357 ] |
|
9358 }, |
|
9359 "event-mousewheel": { |
|
9360 "requires": [ |
|
9361 "node-base" |
|
9362 ] |
|
9363 }, |
|
9364 "event-move": { |
|
9365 "requires": [ |
|
9366 "node-base", |
|
9367 "event-touch", |
|
9368 "event-synthetic" |
|
9369 ] |
|
9370 }, |
|
9371 "event-outside": { |
|
9372 "requires": [ |
|
9373 "event-synthetic" |
|
9374 ] |
|
9375 }, |
|
9376 "event-resize": { |
|
9377 "requires": [ |
|
9378 "node-base", |
|
9379 "event-synthetic" |
|
9380 ] |
|
9381 }, |
|
9382 "event-simulate": { |
|
9383 "requires": [ |
|
9384 "event-base" |
|
9385 ] |
|
9386 }, |
|
9387 "event-synthetic": { |
|
9388 "requires": [ |
|
9389 "node-base", |
|
9390 "event-custom-complex" |
|
9391 ] |
|
9392 }, |
|
9393 "event-tap": { |
|
9394 "requires": [ |
|
9395 "node-base", |
|
9396 "event-base", |
|
9397 "event-touch", |
|
9398 "event-synthetic" |
|
9399 ] |
|
9400 }, |
|
9401 "event-touch": { |
|
9402 "requires": [ |
|
9403 "node-base" |
|
9404 ] |
|
9405 }, |
|
9406 "event-valuechange": { |
|
9407 "requires": [ |
|
9408 "event-focus", |
|
9409 "event-synthetic" |
|
9410 ] |
|
9411 }, |
|
9412 "exec-command": { |
|
9413 "requires": [ |
|
9414 "frame" |
|
9415 ] |
|
9416 }, |
|
9417 "features": { |
|
9418 "requires": [ |
|
9419 "yui-base" |
|
9420 ] |
|
9421 }, |
|
9422 "file": { |
|
9423 "requires": [ |
|
9424 "file-flash", |
|
9425 "file-html5" |
|
9426 ] |
|
9427 }, |
|
9428 "file-flash": { |
|
9429 "requires": [ |
|
9430 "base" |
|
9431 ] |
|
9432 }, |
|
9433 "file-html5": { |
|
9434 "requires": [ |
|
9435 "base" |
|
9436 ] |
|
9437 }, |
|
9438 "frame": { |
|
9439 "requires": [ |
|
9440 "base", |
|
9441 "node", |
|
9442 "selector-css3", |
|
9443 "yui-throttle" |
|
9444 ] |
|
9445 }, |
|
9446 "gesture-simulate": { |
|
9447 "requires": [ |
|
9448 "async-queue", |
|
9449 "event-simulate", |
|
9450 "node-screen" |
|
9451 ] |
|
9452 }, |
|
9453 "get": { |
|
9454 "requires": [ |
|
9455 "yui-base" |
|
9456 ] |
|
9457 }, |
|
9458 "graphics": { |
|
9459 "requires": [ |
|
9460 "node", |
|
9461 "event-custom", |
|
9462 "pluginhost", |
|
9463 "matrix", |
|
9464 "classnamemanager" |
|
9465 ] |
|
9466 }, |
|
9467 "graphics-canvas": { |
|
9468 "condition": { |
|
9469 "name": "graphics-canvas", |
|
9470 "test": function(Y) { |
|
9471 var DOCUMENT = Y.config.doc, |
|
9472 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", |
|
9473 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), |
|
9474 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); |
|
9475 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); |
|
9476 }, |
|
9477 "trigger": "graphics" |
|
9478 }, |
|
9479 "requires": [ |
|
9480 "graphics" |
|
9481 ] |
|
9482 }, |
|
9483 "graphics-canvas-default": { |
|
9484 "condition": { |
|
9485 "name": "graphics-canvas-default", |
|
9486 "test": function(Y) { |
|
9487 var DOCUMENT = Y.config.doc, |
|
9488 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", |
|
9489 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), |
|
9490 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); |
|
9491 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); |
|
9492 }, |
|
9493 "trigger": "graphics" |
|
9494 } |
|
9495 }, |
|
9496 "graphics-group": { |
|
9497 "requires": [ |
|
9498 "graphics" |
|
9499 ] |
|
9500 }, |
|
9501 "graphics-svg": { |
|
9502 "condition": { |
|
9503 "name": "graphics-svg", |
|
9504 "test": function(Y) { |
|
9505 var DOCUMENT = Y.config.doc, |
|
9506 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", |
|
9507 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), |
|
9508 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); |
|
9509 |
|
9510 return svg && (useSVG || !canvas); |
|
9511 }, |
|
9512 "trigger": "graphics" |
|
9513 }, |
|
9514 "requires": [ |
|
9515 "graphics" |
|
9516 ] |
|
9517 }, |
|
9518 "graphics-svg-default": { |
|
9519 "condition": { |
|
9520 "name": "graphics-svg-default", |
|
9521 "test": function(Y) { |
|
9522 var DOCUMENT = Y.config.doc, |
|
9523 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", |
|
9524 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), |
|
9525 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); |
|
9526 |
|
9527 return svg && (useSVG || !canvas); |
|
9528 }, |
|
9529 "trigger": "graphics" |
|
9530 } |
|
9531 }, |
|
9532 "graphics-vml": { |
|
9533 "condition": { |
|
9534 "name": "graphics-vml", |
|
9535 "test": function(Y) { |
|
9536 var DOCUMENT = Y.config.doc, |
|
9537 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); |
|
9538 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); |
|
9539 }, |
|
9540 "trigger": "graphics" |
|
9541 }, |
|
9542 "requires": [ |
|
9543 "graphics" |
|
9544 ] |
|
9545 }, |
|
9546 "graphics-vml-default": { |
|
9547 "condition": { |
|
9548 "name": "graphics-vml-default", |
|
9549 "test": function(Y) { |
|
9550 var DOCUMENT = Y.config.doc, |
|
9551 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); |
|
9552 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); |
|
9553 }, |
|
9554 "trigger": "graphics" |
|
9555 } |
|
9556 }, |
|
9557 "handlebars": { |
|
9558 "use": [ |
|
9559 "handlebars-compiler" |
|
9560 ] |
|
9561 }, |
|
9562 "handlebars-base": { |
|
9563 "requires": [] |
|
9564 }, |
|
9565 "handlebars-compiler": { |
|
9566 "requires": [ |
|
9567 "handlebars-base" |
|
9568 ] |
|
9569 }, |
|
9570 "highlight": { |
|
9571 "use": [ |
|
9572 "highlight-base", |
|
9573 "highlight-accentfold" |
|
9574 ] |
|
9575 }, |
|
9576 "highlight-accentfold": { |
|
9577 "requires": [ |
|
9578 "highlight-base", |
|
9579 "text-accentfold" |
|
9580 ] |
|
9581 }, |
|
9582 "highlight-base": { |
|
9583 "requires": [ |
|
9584 "array-extras", |
|
9585 "classnamemanager", |
|
9586 "escape", |
|
9587 "text-wordbreak" |
|
9588 ] |
|
9589 }, |
|
9590 "history": { |
|
9591 "use": [ |
|
9592 "history-base", |
|
9593 "history-hash", |
|
9594 "history-hash-ie", |
|
9595 "history-html5" |
|
9596 ] |
|
9597 }, |
|
9598 "history-base": { |
|
9599 "requires": [ |
|
9600 "event-custom-complex" |
|
9601 ] |
|
9602 }, |
|
9603 "history-hash": { |
|
9604 "after": [ |
|
9605 "history-html5" |
|
9606 ], |
|
9607 "requires": [ |
|
9608 "event-synthetic", |
|
9609 "history-base", |
|
9610 "yui-later" |
|
9611 ] |
|
9612 }, |
|
9613 "history-hash-ie": { |
|
9614 "condition": { |
|
9615 "name": "history-hash-ie", |
|
9616 "test": function (Y) { |
|
9617 var docMode = Y.config.doc && Y.config.doc.documentMode; |
|
9618 |
|
9619 return Y.UA.ie && (!('onhashchange' in Y.config.win) || |
|
9620 !docMode || docMode < 8); |
|
9621 }, |
|
9622 "trigger": "history-hash" |
|
9623 }, |
|
9624 "requires": [ |
|
9625 "history-hash", |
|
9626 "node-base" |
|
9627 ] |
|
9628 }, |
|
9629 "history-html5": { |
|
9630 "optional": [ |
|
9631 "json" |
|
9632 ], |
|
9633 "requires": [ |
|
9634 "event-base", |
|
9635 "history-base", |
|
9636 "node-base" |
|
9637 ] |
|
9638 }, |
|
9639 "imageloader": { |
|
9640 "requires": [ |
|
9641 "base-base", |
|
9642 "node-style", |
|
9643 "node-screen" |
|
9644 ] |
|
9645 }, |
|
9646 "intl": { |
|
9647 "requires": [ |
|
9648 "intl-base", |
|
9649 "event-custom" |
|
9650 ] |
|
9651 }, |
|
9652 "intl-base": { |
|
9653 "requires": [ |
|
9654 "yui-base" |
|
9655 ] |
|
9656 }, |
|
9657 "io": { |
|
9658 "use": [ |
|
9659 "io-base", |
|
9660 "io-xdr", |
|
9661 "io-form", |
|
9662 "io-upload-iframe", |
|
9663 "io-queue" |
|
9664 ] |
|
9665 }, |
|
9666 "io-base": { |
|
9667 "requires": [ |
|
9668 "event-custom-base", |
|
9669 "querystring-stringify-simple" |
|
9670 ] |
|
9671 }, |
|
9672 "io-form": { |
|
9673 "requires": [ |
|
9674 "io-base", |
|
9675 "node-base" |
|
9676 ] |
|
9677 }, |
|
9678 "io-nodejs": { |
|
9679 "condition": { |
|
9680 "name": "io-nodejs", |
|
9681 "trigger": "io-base", |
|
9682 "ua": "nodejs" |
|
9683 }, |
|
9684 "requires": [ |
|
9685 "io-base" |
|
9686 ] |
|
9687 }, |
|
9688 "io-queue": { |
|
9689 "requires": [ |
|
9690 "io-base", |
|
9691 "queue-promote" |
|
9692 ] |
|
9693 }, |
|
9694 "io-upload-iframe": { |
|
9695 "requires": [ |
|
9696 "io-base", |
|
9697 "node-base" |
|
9698 ] |
|
9699 }, |
|
9700 "io-xdr": { |
|
9701 "requires": [ |
|
9702 "io-base", |
|
9703 "datatype-xml-parse" |
|
9704 ] |
|
9705 }, |
|
9706 "json": { |
|
9707 "use": [ |
|
9708 "json-parse", |
|
9709 "json-stringify" |
|
9710 ] |
|
9711 }, |
|
9712 "json-parse": { |
|
9713 "requires": [ |
|
9714 "yui-base" |
|
9715 ] |
|
9716 }, |
|
9717 "json-parse-shim": { |
|
9718 "condition": { |
|
9719 "name": "json-parse-shim", |
|
9720 "test": function (Y) { |
|
9721 var _JSON = Y.config.global.JSON, |
|
9722 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, |
|
9723 nativeSupport = Y.config.useNativeJSONParse !== false && !!Native; |
|
9724 |
|
9725 function workingNative( k, v ) { |
|
9726 return k === "ok" ? true : v; |
|
9727 } |
|
9728 |
|
9729 // Double check basic functionality. This is mainly to catch early broken |
|
9730 // implementations of the JSON API in Firefox 3.1 beta1 and beta2 |
|
9731 if ( nativeSupport ) { |
|
9732 try { |
|
9733 nativeSupport = ( Native.parse( '{"ok":false}', workingNative ) ).ok; |
|
9734 } |
|
9735 catch ( e ) { |
|
9736 nativeSupport = false; |
|
9737 } |
|
9738 } |
|
9739 |
|
9740 return !nativeSupport; |
|
9741 }, |
|
9742 "trigger": "json-parse" |
|
9743 }, |
|
9744 "requires": [ |
|
9745 "json-parse" |
|
9746 ] |
|
9747 }, |
|
9748 "json-stringify": { |
|
9749 "requires": [ |
|
9750 "yui-base" |
|
9751 ] |
|
9752 }, |
|
9753 "json-stringify-shim": { |
|
9754 "condition": { |
|
9755 "name": "json-stringify-shim", |
|
9756 "test": function (Y) { |
|
9757 var _JSON = Y.config.global.JSON, |
|
9758 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, |
|
9759 nativeSupport = Y.config.useNativeJSONStringify !== false && !!Native; |
|
9760 |
|
9761 // Double check basic native functionality. This is primarily to catch broken |
|
9762 // early JSON API implementations in Firefox 3.1 beta1 and beta2. |
|
9763 if ( nativeSupport ) { |
|
9764 try { |
|
9765 nativeSupport = ( '0' === Native.stringify(0) ); |
|
9766 } catch ( e ) { |
|
9767 nativeSupport = false; |
|
9768 } |
|
9769 } |
|
9770 |
|
9771 |
|
9772 return !nativeSupport; |
|
9773 }, |
|
9774 "trigger": "json-stringify" |
|
9775 }, |
|
9776 "requires": [ |
|
9777 "json-stringify" |
|
9778 ] |
|
9779 }, |
|
9780 "jsonp": { |
|
9781 "requires": [ |
|
9782 "get", |
|
9783 "oop" |
|
9784 ] |
|
9785 }, |
|
9786 "jsonp-url": { |
|
9787 "requires": [ |
|
9788 "jsonp" |
|
9789 ] |
|
9790 }, |
|
9791 "lazy-model-list": { |
|
9792 "requires": [ |
|
9793 "model-list" |
|
9794 ] |
|
9795 }, |
|
9796 "loader": { |
|
9797 "use": [ |
|
9798 "loader-base", |
|
9799 "loader-rollup", |
|
9800 "loader-yui3" |
|
9801 ] |
|
9802 }, |
|
9803 "loader-base": { |
|
9804 "requires": [ |
|
9805 "get", |
|
9806 "features" |
|
9807 ] |
|
9808 }, |
|
9809 "loader-rollup": { |
|
9810 "requires": [ |
|
9811 "loader-base" |
|
9812 ] |
|
9813 }, |
|
9814 "loader-yui3": { |
|
9815 "requires": [ |
|
9816 "loader-base" |
|
9817 ] |
|
9818 }, |
|
9819 "matrix": { |
|
9820 "requires": [ |
|
9821 "yui-base" |
|
9822 ] |
|
9823 }, |
|
9824 "model": { |
|
9825 "requires": [ |
|
9826 "base-build", |
|
9827 "escape", |
|
9828 "json-parse" |
|
9829 ] |
|
9830 }, |
|
9831 "model-list": { |
|
9832 "requires": [ |
|
9833 "array-extras", |
|
9834 "array-invoke", |
|
9835 "arraylist", |
|
9836 "base-build", |
|
9837 "escape", |
|
9838 "json-parse", |
|
9839 "model" |
|
9840 ] |
|
9841 }, |
|
9842 "model-sync-rest": { |
|
9843 "requires": [ |
|
9844 "model", |
|
9845 "io-base", |
|
9846 "json-stringify" |
|
9847 ] |
|
9848 }, |
|
9849 "node": { |
|
9850 "use": [ |
|
9851 "node-base", |
|
9852 "node-event-delegate", |
|
9853 "node-pluginhost", |
|
9854 "node-screen", |
|
9855 "node-style" |
|
9856 ] |
|
9857 }, |
|
9858 "node-base": { |
|
9859 "requires": [ |
|
9860 "event-base", |
|
9861 "node-core", |
|
9862 "dom-base" |
|
9863 ] |
|
9864 }, |
|
9865 "node-core": { |
|
9866 "requires": [ |
|
9867 "dom-core", |
|
9868 "selector" |
|
9869 ] |
|
9870 }, |
|
9871 "node-deprecated": { |
|
9872 "requires": [ |
|
9873 "node-base" |
|
9874 ] |
|
9875 }, |
|
9876 "node-event-delegate": { |
|
9877 "requires": [ |
|
9878 "node-base", |
|
9879 "event-delegate" |
|
9880 ] |
|
9881 }, |
|
9882 "node-event-html5": { |
|
9883 "requires": [ |
|
9884 "node-base" |
|
9885 ] |
|
9886 }, |
|
9887 "node-event-simulate": { |
|
9888 "requires": [ |
|
9889 "node-base", |
|
9890 "event-simulate", |
|
9891 "gesture-simulate" |
|
9892 ] |
|
9893 }, |
|
9894 "node-flick": { |
|
9895 "requires": [ |
|
9896 "classnamemanager", |
|
9897 "transition", |
|
9898 "event-flick", |
|
9899 "plugin" |
|
9900 ], |
|
9901 "skinnable": true |
|
9902 }, |
|
9903 "node-focusmanager": { |
|
9904 "requires": [ |
|
9905 "attribute", |
|
9906 "node", |
|
9907 "plugin", |
|
9908 "node-event-simulate", |
|
9909 "event-key", |
|
9910 "event-focus" |
|
9911 ] |
|
9912 }, |
|
9913 "node-load": { |
|
9914 "requires": [ |
|
9915 "node-base", |
|
9916 "io-base" |
|
9917 ] |
|
9918 }, |
|
9919 "node-menunav": { |
|
9920 "requires": [ |
|
9921 "node", |
|
9922 "classnamemanager", |
|
9923 "plugin", |
|
9924 "node-focusmanager" |
|
9925 ], |
|
9926 "skinnable": true |
|
9927 }, |
|
9928 "node-pluginhost": { |
|
9929 "requires": [ |
|
9930 "node-base", |
|
9931 "pluginhost" |
|
9932 ] |
|
9933 }, |
|
9934 "node-screen": { |
|
9935 "requires": [ |
|
9936 "dom-screen", |
|
9937 "node-base" |
|
9938 ] |
|
9939 }, |
|
9940 "node-scroll-info": { |
|
9941 "requires": [ |
|
9942 "base-build", |
|
9943 "dom-screen", |
|
9944 "event-resize", |
|
9945 "node-pluginhost", |
|
9946 "plugin" |
|
9947 ] |
|
9948 }, |
|
9949 "node-style": { |
|
9950 "requires": [ |
|
9951 "dom-style", |
|
9952 "node-base" |
|
9953 ] |
|
9954 }, |
|
9955 "oop": { |
|
9956 "requires": [ |
|
9957 "yui-base" |
|
9958 ] |
|
9959 }, |
|
9960 "overlay": { |
|
9961 "requires": [ |
|
9962 "widget", |
|
9963 "widget-stdmod", |
|
9964 "widget-position", |
|
9965 "widget-position-align", |
|
9966 "widget-stack", |
|
9967 "widget-position-constrain" |
|
9968 ], |
|
9969 "skinnable": true |
|
9970 }, |
|
9971 "panel": { |
|
9972 "requires": [ |
|
9973 "widget", |
|
9974 "widget-autohide", |
|
9975 "widget-buttons", |
|
9976 "widget-modality", |
|
9977 "widget-position", |
|
9978 "widget-position-align", |
|
9979 "widget-position-constrain", |
|
9980 "widget-stack", |
|
9981 "widget-stdmod" |
|
9982 ], |
|
9983 "skinnable": true |
|
9984 }, |
|
9985 "parallel": { |
|
9986 "requires": [ |
|
9987 "yui-base" |
|
9988 ] |
|
9989 }, |
|
9990 "pjax": { |
|
9991 "requires": [ |
|
9992 "pjax-base", |
|
9993 "pjax-content" |
|
9994 ] |
|
9995 }, |
|
9996 "pjax-base": { |
|
9997 "requires": [ |
|
9998 "classnamemanager", |
|
9999 "node-event-delegate", |
|
10000 "router" |
|
10001 ] |
|
10002 }, |
|
10003 "pjax-content": { |
|
10004 "requires": [ |
|
10005 "io-base", |
|
10006 "node-base", |
|
10007 "router" |
|
10008 ] |
|
10009 }, |
|
10010 "pjax-plugin": { |
|
10011 "requires": [ |
|
10012 "node-pluginhost", |
|
10013 "pjax", |
|
10014 "plugin" |
|
10015 ] |
|
10016 }, |
|
10017 "plugin": { |
|
10018 "requires": [ |
|
10019 "base-base" |
|
10020 ] |
|
10021 }, |
|
10022 "pluginhost": { |
|
10023 "use": [ |
|
10024 "pluginhost-base", |
|
10025 "pluginhost-config" |
|
10026 ] |
|
10027 }, |
|
10028 "pluginhost-base": { |
|
10029 "requires": [ |
|
10030 "yui-base" |
|
10031 ] |
|
10032 }, |
|
10033 "pluginhost-config": { |
|
10034 "requires": [ |
|
10035 "pluginhost-base" |
|
10036 ] |
|
10037 }, |
|
10038 "promise": { |
|
10039 "requires": [ |
|
10040 "timers" |
|
10041 ] |
|
10042 }, |
|
10043 "querystring": { |
|
10044 "use": [ |
|
10045 "querystring-parse", |
|
10046 "querystring-stringify" |
|
10047 ] |
|
10048 }, |
|
10049 "querystring-parse": { |
|
10050 "requires": [ |
|
10051 "yui-base", |
|
10052 "array-extras" |
|
10053 ] |
|
10054 }, |
|
10055 "querystring-parse-simple": { |
|
10056 "requires": [ |
|
10057 "yui-base" |
|
10058 ] |
|
10059 }, |
|
10060 "querystring-stringify": { |
|
10061 "requires": [ |
|
10062 "yui-base" |
|
10063 ] |
|
10064 }, |
|
10065 "querystring-stringify-simple": { |
|
10066 "requires": [ |
|
10067 "yui-base" |
|
10068 ] |
|
10069 }, |
|
10070 "queue-promote": { |
|
10071 "requires": [ |
|
10072 "yui-base" |
|
10073 ] |
|
10074 }, |
|
10075 "range-slider": { |
|
10076 "requires": [ |
|
10077 "slider-base", |
|
10078 "slider-value-range", |
|
10079 "clickable-rail" |
|
10080 ] |
|
10081 }, |
|
10082 "recordset": { |
|
10083 "use": [ |
|
10084 "recordset-base", |
|
10085 "recordset-sort", |
|
10086 "recordset-filter", |
|
10087 "recordset-indexer" |
|
10088 ] |
|
10089 }, |
|
10090 "recordset-base": { |
|
10091 "requires": [ |
|
10092 "base", |
|
10093 "arraylist" |
|
10094 ] |
|
10095 }, |
|
10096 "recordset-filter": { |
|
10097 "requires": [ |
|
10098 "recordset-base", |
|
10099 "array-extras", |
|
10100 "plugin" |
|
10101 ] |
|
10102 }, |
|
10103 "recordset-indexer": { |
|
10104 "requires": [ |
|
10105 "recordset-base", |
|
10106 "plugin" |
|
10107 ] |
|
10108 }, |
|
10109 "recordset-sort": { |
|
10110 "requires": [ |
|
10111 "arraysort", |
|
10112 "recordset-base", |
|
10113 "plugin" |
|
10114 ] |
|
10115 }, |
|
10116 "resize": { |
|
10117 "use": [ |
|
10118 "resize-base", |
|
10119 "resize-proxy", |
|
10120 "resize-constrain" |
|
10121 ] |
|
10122 }, |
|
10123 "resize-base": { |
|
10124 "requires": [ |
|
10125 "base", |
|
10126 "widget", |
|
10127 "event", |
|
10128 "oop", |
|
10129 "dd-drag", |
|
10130 "dd-delegate", |
|
10131 "dd-drop" |
|
10132 ], |
|
10133 "skinnable": true |
|
10134 }, |
|
10135 "resize-constrain": { |
|
10136 "requires": [ |
|
10137 "plugin", |
|
10138 "resize-base" |
|
10139 ] |
|
10140 }, |
|
10141 "resize-plugin": { |
|
10142 "optional": [ |
|
10143 "resize-constrain" |
|
10144 ], |
|
10145 "requires": [ |
|
10146 "resize-base", |
|
10147 "plugin" |
|
10148 ] |
|
10149 }, |
|
10150 "resize-proxy": { |
|
10151 "requires": [ |
|
10152 "plugin", |
|
10153 "resize-base" |
|
10154 ] |
|
10155 }, |
|
10156 "router": { |
|
10157 "optional": [ |
|
10158 "querystring-parse" |
|
10159 ], |
|
10160 "requires": [ |
|
10161 "array-extras", |
|
10162 "base-build", |
|
10163 "history" |
|
10164 ] |
|
10165 }, |
|
10166 "scrollview": { |
|
10167 "requires": [ |
|
10168 "scrollview-base", |
|
10169 "scrollview-scrollbars" |
|
10170 ] |
|
10171 }, |
|
10172 "scrollview-base": { |
|
10173 "requires": [ |
|
10174 "widget", |
|
10175 "event-gestures", |
|
10176 "event-mousewheel", |
|
10177 "transition" |
|
10178 ], |
|
10179 "skinnable": true |
|
10180 }, |
|
10181 "scrollview-base-ie": { |
|
10182 "condition": { |
|
10183 "name": "scrollview-base-ie", |
|
10184 "trigger": "scrollview-base", |
|
10185 "ua": "ie" |
|
10186 }, |
|
10187 "requires": [ |
|
10188 "scrollview-base" |
|
10189 ] |
|
10190 }, |
|
10191 "scrollview-list": { |
|
10192 "requires": [ |
|
10193 "plugin", |
|
10194 "classnamemanager" |
|
10195 ], |
|
10196 "skinnable": true |
|
10197 }, |
|
10198 "scrollview-paginator": { |
|
10199 "requires": [ |
|
10200 "plugin", |
|
10201 "classnamemanager" |
|
10202 ] |
|
10203 }, |
|
10204 "scrollview-scrollbars": { |
|
10205 "requires": [ |
|
10206 "classnamemanager", |
|
10207 "transition", |
|
10208 "plugin" |
|
10209 ], |
|
10210 "skinnable": true |
|
10211 }, |
|
10212 "selector": { |
|
10213 "requires": [ |
|
10214 "selector-native" |
|
10215 ] |
|
10216 }, |
|
10217 "selector-css2": { |
|
10218 "condition": { |
|
10219 "name": "selector-css2", |
|
10220 "test": function (Y) { |
|
10221 var DOCUMENT = Y.config.doc, |
|
10222 ret = DOCUMENT && !('querySelectorAll' in DOCUMENT); |
|
10223 |
|
10224 return ret; |
|
10225 }, |
|
10226 "trigger": "selector" |
|
10227 }, |
|
10228 "requires": [ |
|
10229 "selector-native" |
|
10230 ] |
|
10231 }, |
|
10232 "selector-css3": { |
|
10233 "requires": [ |
|
10234 "selector-native", |
|
10235 "selector-css2" |
|
10236 ] |
|
10237 }, |
|
10238 "selector-native": { |
|
10239 "requires": [ |
|
10240 "dom-base" |
|
10241 ] |
|
10242 }, |
|
10243 "series-area": { |
|
10244 "requires": [ |
|
10245 "series-cartesian", |
|
10246 "series-fill-util" |
|
10247 ] |
|
10248 }, |
|
10249 "series-area-stacked": { |
|
10250 "requires": [ |
|
10251 "series-stacked", |
|
10252 "series-area" |
|
10253 ] |
|
10254 }, |
|
10255 "series-areaspline": { |
|
10256 "requires": [ |
|
10257 "series-area", |
|
10258 "series-curve-util" |
|
10259 ] |
|
10260 }, |
|
10261 "series-areaspline-stacked": { |
|
10262 "requires": [ |
|
10263 "series-stacked", |
|
10264 "series-areaspline" |
|
10265 ] |
|
10266 }, |
|
10267 "series-bar": { |
|
10268 "requires": [ |
|
10269 "series-marker", |
|
10270 "series-histogram-base" |
|
10271 ] |
|
10272 }, |
|
10273 "series-bar-stacked": { |
|
10274 "requires": [ |
|
10275 "series-stacked", |
|
10276 "series-bar" |
|
10277 ] |
|
10278 }, |
|
10279 "series-base": { |
|
10280 "requires": [ |
|
10281 "graphics", |
|
10282 "axis-base" |
|
10283 ] |
|
10284 }, |
|
10285 "series-candlestick": { |
|
10286 "requires": [ |
|
10287 "series-range" |
|
10288 ] |
|
10289 }, |
|
10290 "series-cartesian": { |
|
10291 "requires": [ |
|
10292 "series-base" |
|
10293 ] |
|
10294 }, |
|
10295 "series-column": { |
|
10296 "requires": [ |
|
10297 "series-marker", |
|
10298 "series-histogram-base" |
|
10299 ] |
|
10300 }, |
|
10301 "series-column-stacked": { |
|
10302 "requires": [ |
|
10303 "series-stacked", |
|
10304 "series-column" |
|
10305 ] |
|
10306 }, |
|
10307 "series-combo": { |
|
10308 "requires": [ |
|
10309 "series-cartesian", |
|
10310 "series-line-util", |
|
10311 "series-plot-util", |
|
10312 "series-fill-util" |
|
10313 ] |
|
10314 }, |
|
10315 "series-combo-stacked": { |
|
10316 "requires": [ |
|
10317 "series-stacked", |
|
10318 "series-combo" |
|
10319 ] |
|
10320 }, |
|
10321 "series-combospline": { |
|
10322 "requires": [ |
|
10323 "series-combo", |
|
10324 "series-curve-util" |
|
10325 ] |
|
10326 }, |
|
10327 "series-combospline-stacked": { |
|
10328 "requires": [ |
|
10329 "series-combo-stacked", |
|
10330 "series-curve-util" |
|
10331 ] |
|
10332 }, |
|
10333 "series-curve-util": {}, |
|
10334 "series-fill-util": {}, |
|
10335 "series-histogram-base": { |
|
10336 "requires": [ |
|
10337 "series-cartesian", |
|
10338 "series-plot-util" |
|
10339 ] |
|
10340 }, |
|
10341 "series-line": { |
|
10342 "requires": [ |
|
10343 "series-cartesian", |
|
10344 "series-line-util" |
|
10345 ] |
|
10346 }, |
|
10347 "series-line-stacked": { |
|
10348 "requires": [ |
|
10349 "series-stacked", |
|
10350 "series-line" |
|
10351 ] |
|
10352 }, |
|
10353 "series-line-util": {}, |
|
10354 "series-marker": { |
|
10355 "requires": [ |
|
10356 "series-cartesian", |
|
10357 "series-plot-util" |
|
10358 ] |
|
10359 }, |
|
10360 "series-marker-stacked": { |
|
10361 "requires": [ |
|
10362 "series-stacked", |
|
10363 "series-marker" |
|
10364 ] |
|
10365 }, |
|
10366 "series-ohlc": { |
|
10367 "requires": [ |
|
10368 "series-range" |
|
10369 ] |
|
10370 }, |
|
10371 "series-pie": { |
|
10372 "requires": [ |
|
10373 "series-base", |
|
10374 "series-plot-util" |
|
10375 ] |
|
10376 }, |
|
10377 "series-plot-util": {}, |
|
10378 "series-range": { |
|
10379 "requires": [ |
|
10380 "series-cartesian" |
|
10381 ] |
|
10382 }, |
|
10383 "series-spline": { |
|
10384 "requires": [ |
|
10385 "series-line", |
|
10386 "series-curve-util" |
|
10387 ] |
|
10388 }, |
|
10389 "series-spline-stacked": { |
|
10390 "requires": [ |
|
10391 "series-stacked", |
|
10392 "series-spline" |
|
10393 ] |
|
10394 }, |
|
10395 "series-stacked": { |
|
10396 "requires": [ |
|
10397 "axis-stacked" |
|
10398 ] |
|
10399 }, |
|
10400 "shim-plugin": { |
|
10401 "requires": [ |
|
10402 "node-style", |
|
10403 "node-pluginhost" |
|
10404 ] |
|
10405 }, |
|
10406 "slider": { |
|
10407 "use": [ |
|
10408 "slider-base", |
|
10409 "slider-value-range", |
|
10410 "clickable-rail", |
|
10411 "range-slider" |
|
10412 ] |
|
10413 }, |
|
10414 "slider-base": { |
|
10415 "requires": [ |
|
10416 "widget", |
|
10417 "dd-constrain", |
|
10418 "event-key" |
|
10419 ], |
|
10420 "skinnable": true |
|
10421 }, |
|
10422 "slider-value-range": { |
|
10423 "requires": [ |
|
10424 "slider-base" |
|
10425 ] |
|
10426 }, |
|
10427 "sortable": { |
|
10428 "requires": [ |
|
10429 "dd-delegate", |
|
10430 "dd-drop-plugin", |
|
10431 "dd-proxy" |
|
10432 ] |
|
10433 }, |
|
10434 "sortable-scroll": { |
|
10435 "requires": [ |
|
10436 "dd-scroll", |
|
10437 "sortable" |
|
10438 ] |
|
10439 }, |
|
10440 "stylesheet": { |
|
10441 "requires": [ |
|
10442 "yui-base" |
|
10443 ] |
|
10444 }, |
|
10445 "substitute": { |
|
10446 "optional": [ |
|
10447 "dump" |
|
10448 ], |
|
10449 "requires": [ |
|
10450 "yui-base" |
|
10451 ] |
|
10452 }, |
|
10453 "swf": { |
|
10454 "requires": [ |
|
10455 "event-custom", |
|
10456 "node", |
|
10457 "swfdetect", |
|
10458 "escape" |
|
10459 ] |
|
10460 }, |
|
10461 "swfdetect": { |
|
10462 "requires": [ |
|
10463 "yui-base" |
|
10464 ] |
|
10465 }, |
|
10466 "tabview": { |
|
10467 "requires": [ |
|
10468 "widget", |
|
10469 "widget-parent", |
|
10470 "widget-child", |
|
10471 "tabview-base", |
|
10472 "node-pluginhost", |
|
10473 "node-focusmanager" |
|
10474 ], |
|
10475 "skinnable": true |
|
10476 }, |
|
10477 "tabview-base": { |
|
10478 "requires": [ |
|
10479 "node-event-delegate", |
|
10480 "classnamemanager" |
|
10481 ] |
|
10482 }, |
|
10483 "tabview-plugin": { |
|
10484 "requires": [ |
|
10485 "tabview-base" |
|
10486 ] |
|
10487 }, |
|
10488 "template": { |
|
10489 "use": [ |
|
10490 "template-base", |
|
10491 "template-micro" |
|
10492 ] |
|
10493 }, |
|
10494 "template-base": { |
|
10495 "requires": [ |
|
10496 "yui-base" |
|
10497 ] |
|
10498 }, |
|
10499 "template-micro": { |
|
10500 "requires": [ |
|
10501 "escape" |
|
10502 ] |
|
10503 }, |
|
10504 "test": { |
|
10505 "requires": [ |
|
10506 "event-simulate", |
|
10507 "event-custom", |
|
10508 "json-stringify" |
|
10509 ] |
|
10510 }, |
|
10511 "test-console": { |
|
10512 "requires": [ |
|
10513 "console-filters", |
|
10514 "test", |
|
10515 "array-extras" |
|
10516 ], |
|
10517 "skinnable": true |
|
10518 }, |
|
10519 "text": { |
|
10520 "use": [ |
|
10521 "text-accentfold", |
|
10522 "text-wordbreak" |
|
10523 ] |
|
10524 }, |
|
10525 "text-accentfold": { |
|
10526 "requires": [ |
|
10527 "array-extras", |
|
10528 "text-data-accentfold" |
|
10529 ] |
|
10530 }, |
|
10531 "text-data-accentfold": { |
|
10532 "requires": [ |
|
10533 "yui-base" |
|
10534 ] |
|
10535 }, |
|
10536 "text-data-wordbreak": { |
|
10537 "requires": [ |
|
10538 "yui-base" |
|
10539 ] |
|
10540 }, |
|
10541 "text-wordbreak": { |
|
10542 "requires": [ |
|
10543 "array-extras", |
|
10544 "text-data-wordbreak" |
|
10545 ] |
|
10546 }, |
|
10547 "timers": { |
|
10548 "requires": [ |
|
10549 "yui-base" |
|
10550 ] |
|
10551 }, |
|
10552 "transition": { |
|
10553 "requires": [ |
|
10554 "node-style" |
|
10555 ] |
|
10556 }, |
|
10557 "transition-timer": { |
|
10558 "condition": { |
|
10559 "name": "transition-timer", |
|
10560 "test": function (Y) { |
|
10561 var DOCUMENT = Y.config.doc, |
|
10562 node = (DOCUMENT) ? DOCUMENT.documentElement: null, |
|
10563 ret = true; |
|
10564 |
|
10565 if (node && node.style) { |
|
10566 ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); |
|
10567 } |
|
10568 |
|
10569 return ret; |
|
10570 }, |
|
10571 "trigger": "transition" |
|
10572 }, |
|
10573 "requires": [ |
|
10574 "transition" |
|
10575 ] |
|
10576 }, |
|
10577 "tree": { |
|
10578 "requires": [ |
|
10579 "base-build", |
|
10580 "tree-node" |
|
10581 ] |
|
10582 }, |
|
10583 "tree-labelable": { |
|
10584 "requires": [ |
|
10585 "tree" |
|
10586 ] |
|
10587 }, |
|
10588 "tree-lazy": { |
|
10589 "requires": [ |
|
10590 "base-pluginhost", |
|
10591 "plugin", |
|
10592 "tree" |
|
10593 ] |
|
10594 }, |
|
10595 "tree-node": {}, |
|
10596 "tree-openable": { |
|
10597 "requires": [ |
|
10598 "tree" |
|
10599 ] |
|
10600 }, |
|
10601 "tree-selectable": { |
|
10602 "requires": [ |
|
10603 "tree" |
|
10604 ] |
|
10605 }, |
|
10606 "tree-sortable": { |
|
10607 "requires": [ |
|
10608 "tree" |
|
10609 ] |
|
10610 }, |
|
10611 "uploader": { |
|
10612 "requires": [ |
|
10613 "uploader-html5", |
|
10614 "uploader-flash" |
|
10615 ] |
|
10616 }, |
|
10617 "uploader-flash": { |
|
10618 "requires": [ |
|
10619 "swf", |
|
10620 "widget", |
|
10621 "base", |
|
10622 "cssbutton", |
|
10623 "node", |
|
10624 "event-custom", |
|
10625 "file-flash", |
|
10626 "uploader-queue" |
|
10627 ] |
|
10628 }, |
|
10629 "uploader-html5": { |
|
10630 "requires": [ |
|
10631 "widget", |
|
10632 "node-event-simulate", |
|
10633 "file-html5", |
|
10634 "uploader-queue" |
|
10635 ] |
|
10636 }, |
|
10637 "uploader-queue": { |
|
10638 "requires": [ |
|
10639 "base" |
|
10640 ] |
|
10641 }, |
|
10642 "view": { |
|
10643 "requires": [ |
|
10644 "base-build", |
|
10645 "node-event-delegate" |
|
10646 ] |
|
10647 }, |
|
10648 "view-node-map": { |
|
10649 "requires": [ |
|
10650 "view" |
|
10651 ] |
|
10652 }, |
|
10653 "widget": { |
|
10654 "use": [ |
|
10655 "widget-base", |
|
10656 "widget-htmlparser", |
|
10657 "widget-skin", |
|
10658 "widget-uievents" |
|
10659 ] |
|
10660 }, |
|
10661 "widget-anim": { |
|
10662 "requires": [ |
|
10663 "anim-base", |
|
10664 "plugin", |
|
10665 "widget" |
|
10666 ] |
|
10667 }, |
|
10668 "widget-autohide": { |
|
10669 "requires": [ |
|
10670 "base-build", |
|
10671 "event-key", |
|
10672 "event-outside", |
|
10673 "widget" |
|
10674 ] |
|
10675 }, |
|
10676 "widget-base": { |
|
10677 "requires": [ |
|
10678 "attribute", |
|
10679 "base-base", |
|
10680 "base-pluginhost", |
|
10681 "classnamemanager", |
|
10682 "event-focus", |
|
10683 "node-base", |
|
10684 "node-style" |
|
10685 ], |
|
10686 "skinnable": true |
|
10687 }, |
|
10688 "widget-base-ie": { |
|
10689 "condition": { |
|
10690 "name": "widget-base-ie", |
|
10691 "trigger": "widget-base", |
|
10692 "ua": "ie" |
|
10693 }, |
|
10694 "requires": [ |
|
10695 "widget-base" |
|
10696 ] |
|
10697 }, |
|
10698 "widget-buttons": { |
|
10699 "requires": [ |
|
10700 "button-plugin", |
|
10701 "cssbutton", |
|
10702 "widget-stdmod" |
|
10703 ] |
|
10704 }, |
|
10705 "widget-child": { |
|
10706 "requires": [ |
|
10707 "base-build", |
|
10708 "widget" |
|
10709 ] |
|
10710 }, |
|
10711 "widget-htmlparser": { |
|
10712 "requires": [ |
|
10713 "widget-base" |
|
10714 ] |
|
10715 }, |
|
10716 "widget-locale": { |
|
10717 "requires": [ |
|
10718 "widget-base" |
|
10719 ] |
|
10720 }, |
|
10721 "widget-modality": { |
|
10722 "requires": [ |
|
10723 "base-build", |
|
10724 "event-outside", |
|
10725 "widget" |
|
10726 ], |
|
10727 "skinnable": true |
|
10728 }, |
|
10729 "widget-parent": { |
|
10730 "requires": [ |
|
10731 "arraylist", |
|
10732 "base-build", |
|
10733 "widget" |
|
10734 ] |
|
10735 }, |
|
10736 "widget-position": { |
|
10737 "requires": [ |
|
10738 "base-build", |
|
10739 "node-screen", |
|
10740 "widget" |
|
10741 ] |
|
10742 }, |
|
10743 "widget-position-align": { |
|
10744 "requires": [ |
|
10745 "widget-position" |
|
10746 ] |
|
10747 }, |
|
10748 "widget-position-constrain": { |
|
10749 "requires": [ |
|
10750 "widget-position" |
|
10751 ] |
|
10752 }, |
|
10753 "widget-skin": { |
|
10754 "requires": [ |
|
10755 "widget-base" |
|
10756 ] |
|
10757 }, |
|
10758 "widget-stack": { |
|
10759 "requires": [ |
|
10760 "base-build", |
|
10761 "widget" |
|
10762 ], |
|
10763 "skinnable": true |
|
10764 }, |
|
10765 "widget-stdmod": { |
|
10766 "requires": [ |
|
10767 "base-build", |
|
10768 "widget" |
|
10769 ] |
|
10770 }, |
|
10771 "widget-uievents": { |
|
10772 "requires": [ |
|
10773 "node-event-delegate", |
|
10774 "widget-base" |
|
10775 ] |
|
10776 }, |
|
10777 "yql": { |
|
10778 "requires": [ |
|
10779 "oop" |
|
10780 ] |
|
10781 }, |
|
10782 "yql-jsonp": { |
|
10783 "condition": { |
|
10784 "name": "yql-jsonp", |
|
10785 "test": function (Y) { |
|
10786 /* Only load the JSONP module when not in nodejs or winjs |
|
10787 TODO Make the winjs module a CORS module |
|
10788 */ |
|
10789 return (!Y.UA.nodejs && !Y.UA.winjs); |
|
10790 }, |
|
10791 "trigger": "yql", |
|
10792 "when": "after" |
|
10793 }, |
|
10794 "requires": [ |
|
10795 "jsonp", |
|
10796 "jsonp-url" |
|
10797 ] |
|
10798 }, |
|
10799 "yql-nodejs": { |
|
10800 "condition": { |
|
10801 "name": "yql-nodejs", |
|
10802 "trigger": "yql", |
|
10803 "ua": "nodejs", |
|
10804 "when": "after" |
|
10805 } |
|
10806 }, |
|
10807 "yql-winjs": { |
|
10808 "condition": { |
|
10809 "name": "yql-winjs", |
|
10810 "trigger": "yql", |
|
10811 "ua": "winjs", |
|
10812 "when": "after" |
|
10813 } |
|
10814 }, |
|
10815 "yui": {}, |
|
10816 "yui-base": {}, |
|
10817 "yui-later": { |
|
10818 "requires": [ |
|
10819 "yui-base" |
|
10820 ] |
|
10821 }, |
|
10822 "yui-log": { |
|
10823 "requires": [ |
|
10824 "yui-base" |
|
10825 ] |
|
10826 }, |
|
10827 "yui-throttle": { |
|
10828 "requires": [ |
|
10829 "yui-base" |
|
10830 ] |
|
10831 } |
|
10832 }); |
|
10833 YUI.Env[Y.version].md5 = 'd7ced98e3907d3c3c0655a93c6ac6867'; |
|
10834 |
|
10835 |
|
10836 }, '3.10.3', {"requires": ["loader-base"]}); |
|
10837 YUI.add('yui', function (Y, NAME) {}, '3.10.3', { |
|
10838 "use": [ |
|
10839 "get", |
|
10840 "features", |
|
10841 "intl-base", |
|
10842 "yui-log", |
|
10843 "yui-log-nodejs", |
|
10844 "yui-later", |
|
10845 "loader-base", |
|
10846 "loader-rollup", |
|
10847 "loader-yui3" |
|
10848 ] |
|
10849 }); |