vendor: 11,221 bytes, lines 1-465
1/*! 2 * jQuery JavaScript Library v3.5.1 3 * https://jquery.com/ 4 * 5 * Includes Sizzle.js 6 * https://sizzlejs.com/ 7 * 8 * Copyright JS Foundation and other contributors 9 * Released under the MIT license 10 * https://jquery.org/license 11 * 12 * Date: 2020-05-04T22:49Z 13 */ 14( function( global, factory ) { 15 16 "use strict"; 17 18 if ( typeof module === "object" && typeof module.exports === "object" ) { 19 20 // For CommonJS and CommonJS-like environments where a proper `window` 21 // is present, execute the factory and get jQuery. 22 // For environments that do not have a `window` with a `document` 23 // (such as Node.js), expose a factory as module.exports. 24 // This accentuates the need for the creation of a real `window`. 25 // e.g. var jQuery = require("jquery")(window); 26 // See ticket #14549 for more info. 27 module.exports = global.document ? 28 factory( global, true ) : 29 function( w ) { 30 if ( !w.document ) { 31 throw new Error( "jQuery requires a window with a document" ); 32 } 33 return factory( w ); 34 }; 35 } else { 36 factory( global ); 37 } 38 39// Pass this if window is not defined yet 40} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 41 42// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 43// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 44// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 45// enough that all such attempts are guarded in a try block. 46"use strict"; 47 48var arr = []; 49 50var getProto = Object.getPrototypeOf; 51 52var slice = arr.slice; 53 54var flat = arr.flat ? function( array ) { 55 return arr.flat.call( array ); 56} : function( array ) { 57 return arr.concat.apply( [], array ); 58}; 59 60 61var push = arr.push; 62 63var indexOf = arr.indexOf; 64 65var class2type = {}; 66 67var toString = class2type.toString; 68 69var hasOwn = class2type.hasOwnProperty; 70 71var fnToString = hasOwn.toString; 72 73var ObjectFunctionString = fnToString.call( Object ); 74 75var support = {}; 76 77var isFunction = function isFunction( obj ) { 78 79 // Support: Chrome <=57, Firefox <=52 80 // In some browsers, typeof returns "function" for HTML <object> elements 81 // (i.e., `typeof document.createElement( "object" ) === "function"`). 82 // We don't want to classify *any* DOM node as a function. 83 return typeof obj === "function" && typeof obj.nodeType !== "number"; 84 }; 85 86 87var isWindow = function isWindow( obj ) { 88 return obj != null && obj === obj.window; 89 }; 90 91 92var document = window.document; 93 94 95 96 var preservedScriptAttributes = { 97 type: true, 98 src: true, 99 nonce: true, 100 noModule: true 101 }; 102 103 function DOMEval( code, node, doc ) { 104 doc = doc || document; 105 106 var i, val, 107 script = doc.createElement( "script" ); 108 109 script.text = code; 110 if ( node ) { 111 for ( i in preservedScriptAttributes ) { 112 113 // Support: Firefox 64+, Edge 18+ 114 // Some browsers don't support the "nonce" property on scripts. 115 // On the other hand, just using `getAttribute` is not enough as 116 // the `nonce` attribute is reset to an empty string whenever it 117 // becomes browsing-context connected. 118 // See https://github.com/whatwg/html/issues/2369 119 // See https://html.spec.whatwg.org/#nonce-attributes 120 // The `node.getAttribute` check was added for the sake of 121 // `jQuery.globalEval` so that it can fake a nonce-containing node 122 // via an object. 123 val = node[ i ] || node.getAttribute && node.getAttribute( i ); 124 if ( val ) { 125 script.setAttribute( i, val ); 126 } 127 } 128 } 129 doc.head.appendChild( script ).parentNode.removeChild( script ); 130 } 131 132 133function toType( obj ) { 134 if ( obj == null ) { 135 return obj + ""; 136 } 137 138 // Support: Android <=2.3 only (functionish RegExp) 139 return typeof obj === "object" || typeof obj === "function" ? 140 class2type[ toString.call( obj ) ] || "object" : 141 typeof obj; 142} 143/* global Symbol */ 144// Defining this global in .eslintrc.json would create a danger of using the global 145// unguarded in another place, it seems safer to define global only for this module 146 147 148 149var 150 version = "3.5.1", 151 152 // Define a local copy of jQuery 153 jQuery = function( selector, context ) { 154 155 // The jQuery object is actually just the init constructor 'enhanced' 156 // Need init if jQuery is called (just allow error to be thrown if not included) 157 return new jQuery.fn.init( selector, context ); 158 }; 159 160jQuery.fn = jQuery.prototype = { 161 162 // The current version of jQuery being used 163 jquery: version, 164 165 constructor: jQuery, 166 167 // The default length of a jQuery object is 0 168 length: 0, 169 170 toArray: function() { 171 return slice.call( this ); 172 }, 173 174 // Get the Nth element in the matched element set OR 175 // Get the whole matched element set as a clean array 176 get: function( num ) { 177 178 // Return all the elements in a clean array 179 if ( num == null ) { 180 return slice.call( this ); 181 } 182 183 // Return just the one element from the set 184 return num < 0 ? this[ num + this.length ] : this[ num ]; 185 }, 186 187 // Take an array of elements and push it onto the stack 188 // (returning the new matched element set) 189 pushStack: function( elems ) { 190 191 // Build a new jQuery matched element set 192 var ret = jQuery.merge( this.constructor(), elems ); 193 194 // Add the old object onto the stack (as a reference) 195 ret.prevObject = this; 196 197 // Return the newly-formed element set 198 return ret; 199 }, 200 201 // Execute a callback for every element in the matched set. 202 each: function( callback ) { 203 return jQuery.each( this, callback ); 204 }, 205 206 map: function( callback ) { 207 return this.pushStack( jQuery.map( this, function( elem, i ) { 208 return callback.call( elem, i, elem ); 209 } ) ); 210 }, 211 212 slice: function() { 213 return this.pushStack( slice.apply( this, arguments ) ); 214 }, 215 216 first: function() { 217 return this.eq( 0 ); 218 }, 219 220 last: function() { 221 return this.eq( -1 ); 222 }, 223 224 even: function() { 225 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 226 return ( i + 1 ) % 2; 227 } ) ); 228 }, 229 230 odd: function() { 231 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 232 return i % 2; 233 } ) ); 234 }, 235 236 eq: function( i ) { 237 var len = this.length, 238 j = +i + ( i < 0 ? len : 0 ); 239 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 240 }, 241 242 end: function() { 243 return this.prevObject || this.constructor(); 244 }, 245 246 // For internal use only. 247 // Behaves like an Array's method, not like a jQuery method. 248 push: push, 249 sort: arr.sort, 250 splice: arr.splice 251}; 252 253jQuery.extend = jQuery.fn.extend = function() { 254 var options, name, src, copy, copyIsArray, clone, 255 target = arguments[ 0 ] || {}, 256 i = 1, 257 length = arguments.length, 258 deep = false; 259 260 // Handle a deep copy situation 261 if ( typeof target === "boolean" ) { 262 deep = target; 263 264 // Skip the boolean and the target 265 target = arguments[ i ] || {}; 266 i++; 267 } 268 269 // Handle case when target is a string or something (possible in deep copy) 270 if ( typeof target !== "object" && !isFunction( target ) ) { 271 target = {}; 272 } 273 274 // Extend jQuery itself if only one argument is passed 275 if ( i === length ) { 276 target = this; 277 i--; 278 } 279 280 for ( ; i < length; i++ ) { 281 282 // Only deal with non-null/undefined values 283 if ( ( options = arguments[ i ] ) != null ) { 284 285 // Extend the base object 286 for ( name in options ) { 287 copy = options[ name ]; 288 289 // Prevent Object.prototype pollution 290 // Prevent never-ending loop 291 if ( name === "__proto__" || target === copy ) { 292 continue; 293 } 294 295 // Recurse if we're merging plain objects or arrays 296 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 297 ( copyIsArray = Array.isArray( copy ) ) ) ) { 298 src = target[ name ]; 299 300 // Ensure proper type for the source value 301 if ( copyIsArray && !Array.isArray( src ) ) { 302 clone = []; 303 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { 304 clone = {}; 305 } else { 306 clone = src; 307 } 308 copyIsArray = false; 309 310 // Never move original objects, clone them 311 target[ name ] = jQuery.extend( deep, clone, copy ); 312 313 // Don't bring in undefined values 314 } else if ( copy !== undefined ) { 315 target[ name ] = copy; 316 } 317 } 318 } 319 } 320 321 // Return the modified object 322 return target; 323}; 324 325jQuery.extend( { 326 327 // Unique for each copy of jQuery on the page 328 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 329 330 // Assume jQuery is ready without the ready module 331 isReady: true, 332 333 error: function( msg ) { 334 throw new Error( msg ); 335 }, 336 337 noop: function() {}, 338 339 isPlainObject: function( obj ) { 340 var proto, Ctor; 341 342 // Detect obvious negatives 343 // Use toString instead of jQuery.type to catch host objects 344 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 345 return false; 346 } 347 348 proto = getProto( obj ); 349 350 // Objects with no prototype (e.g., `Object.create( null )`) are plain 351 if ( !proto ) { 352 return true; 353 } 354 355 // Objects with prototype are plain iff they were constructed by a global Object function 356 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 357 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 358 }, 359 360 isEmptyObject: function( obj ) { 361 var name; 362 363 for ( name in obj ) { 364 return false; 365 } 366 return true; 367 }, 368 369 // Evaluates a script in a provided context; falls back to the global one 370 // if not specified. 371 globalEval: function( code, options, doc ) { 372 DOMEval( code, { nonce: options && options.nonce }, doc ); 373 }, 374 375 each: function( obj, callback ) { 376 var length, i = 0; 377 378 if ( isArrayLike( obj ) ) { 379 length = obj.length; 380 for ( ; i < length; i++ ) { 381 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 382 break; 383 } 384 } 385 } else { 386 for ( i in obj ) { 387 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 388 break; 389 } 390 } 391 } 392 393 return obj; 394 }, 395 396 // results is for internal usage only 397 makeArray: function( arr, results ) { 398 var ret = results || []; 399 400 if ( arr != null ) { 401 if ( isArrayLike( Object( arr ) ) ) { 402 jQuery.merge( ret, 403 typeof arr === "string" ? 404 [ arr ] : arr 405 ); 406 } else { 407 push.call( ret, arr ); 408 } 409 } 410 411 return ret; 412 }, 413 414 inArray: function( elem, arr, i ) { 415 return arr == null ? -1 : indexOf.call( arr, elem, i ); 416 }, 417 418 // Support: Android <=4.0 only, PhantomJS 1 only 419 // push.apply(_, arraylike) throws on ancient WebKit 420 merge: function( first, second ) { 421 var len = +second.length, 422 j = 0, 423 i = first.length; 424 425 for ( ; j < len; j++ ) { 426 first[ i++ ] = second[ j ]; 427 } 428 429 first.length = i; 430 431 return first; 432 }, 433 434 grep: function( elems, callback, invert ) { 435 var callbackInverse, 436 matches = [], 437 i = 0, 438 length = elems.length, 439 callbackExpect = !invert; 440 441 // Go through the array, only saving the items 442 // that pass the validator function 443 for ( ; i < length; i++ ) { 444 callbackInverse = !callback( elems[ i ], i ); 445 if ( callbackInverse !== callbackExpect ) { 446 matches.push( elems[ i ] ); 447 } 448 } 449 450 return matches; 451 }, 452 453 // arg is for internal usage only 454 map: function( elems, callback, arg ) { 455 var length, value, 456 i = 0, 457 ret = []; 458 459 // Go through the array, translating each of the items to their new values 460 if ( isArrayLike( elems ) ) { 461 length = elems.length; 462 for ( ; i < length; i++ ) { 463 value = callback( elems[ i ], i, arg ); 464 465 if ( value != null ) {
vendor: 4,198 bytes, lines 466-633
466 ret.push( value ); 467 } 468 } 469 470 // Go through every key on the object, 471 } else { 472 for ( i in elems ) { 473 value = callback( elems[ i ], i, arg ); 474 475 if ( value != null ) { 476 ret.push( value ); 477 } 478 } 479 } 480 481 // Flatten any nested arrays 482 return flat( ret ); 483 }, 484 485 // A global GUID counter for objects 486 guid: 1, 487 488 // jQuery.support is not used in Core but other projects attach their 489 // properties to it so it needs to exist. 490 support: support 491} ); 492 493if ( typeof Symbol === "function" ) { 494 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 495} 496 497// Populate the class2type map 498jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 499function( _i, name ) { 500 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 501} ); 502 503function isArrayLike( obj ) { 504 505 // Support: real iOS 8.2 only (not reproducible in simulator) 506 // `in` check used to prevent JIT error (gh-2145) 507 // hasOwn isn't used here due to false negatives 508 // regarding Nodelist length in IE 509 var length = !!obj && "length" in obj && obj.length, 510 type = toType( obj ); 511 512 if ( isFunction( obj ) || isWindow( obj ) ) { 513 return false; 514 } 515 516 return type === "array" || length === 0 || 517 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 518} 519var Sizzle = 520/*! 521 * Sizzle CSS Selector Engine v2.3.5 522 * https://sizzlejs.com/ 523 * 524 * Copyright JS Foundation and other contributors 525 * Released under the MIT license 526 * https://js.foundation/ 527 * 528 * Date: 2020-03-14 529 */ 530( function( window ) { 531var i, 532 support, 533 Expr, 534 getText, 535 isXML, 536 tokenize, 537 compile, 538 select, 539 outermostContext, 540 sortInput, 541 hasDuplicate, 542 543 // Local document vars 544 setDocument, 545 document, 546 docElem, 547 documentIsHTML, 548 rbuggyQSA, 549 rbuggyMatches, 550 matches, 551 contains, 552 553 // Instance-specific data 554 expando = "sizzle" + 1 * new Date(), 555 preferredDoc = window.document, 556 dirruns = 0, 557 done = 0, 558 classCache = createCache(), 559 tokenCache = createCache(), 560 compilerCache = createCache(), 561 nonnativeSelectorCache = createCache(), 562 sortOrder = function( a, b ) { 563 if ( a === b ) { 564 hasDuplicate = true; 565 } 566 return 0; 567 }, 568 569 // Instance methods 570 hasOwn = ( {} ).hasOwnProperty, 571 arr = [], 572 pop = arr.pop, 573 pushNative = arr.push, 574 push = arr.push, 575 slice = arr.slice, 576 577 // Use a stripped-down indexOf as it's faster than native 578 // https://jsperf.com/thor-indexof-vs-for/5 579 indexOf = function( list, elem ) { 580 var i = 0, 581 len = list.length; 582 for ( ; i < len; i++ ) { 583 if ( list[ i ] === elem ) { 584 return i; 585 } 586 } 587 return -1; 588 }, 589 590 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + 591 "ismap|loop|multiple|open|readonly|required|scoped", 592 593 // Regular expressions 594 595 // http://www.w3.org/TR/css3-selectors/#whitespace 596 whitespace = "[\\x20\\t\\r\\n\\f]", 597 598 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram 599 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + 600 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", 601 602 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 603 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 604 605 // Operator (capture 2) 606 "*([*^$|!~]?=)" + whitespace + 607 608 // "Attribute values must be CSS identifiers [capture 5] 609 // or strings [capture 3 or capture 4]" 610 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + 611 whitespace + "*\\]", 612 613 pseudos = ":(" + identifier + ")(?:\\((" + 614 615 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 616 // 1. quoted (capture 3; capture 4 or capture 5) 617 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 618 619 // 2. simple (capture 6) 620 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 621 622 // 3. anything else (capture 2) 623 ".*" + 624 ")\\)|)", 625 626 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 627 rwhitespace = new RegExp( whitespace + "+", "g" ), 628 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + 629 whitespace + "+$", "g" ), 630 631 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 632 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + 633 "*" ),
vendor: 4,651 bytes, lines 634-788
634 rdescend = new RegExp( whitespace + "|>" ), 635 636 rpseudo = new RegExp( pseudos ), 637 ridentifier = new RegExp( "^" + identifier + "$" ), 638 639 matchExpr = { 640 "ID": new RegExp( "^#(" + identifier + ")" ), 641 "CLASS": new RegExp( "^\\.(" + identifier + ")" ), 642 "TAG": new RegExp( "^(" + identifier + "|[*])" ), 643 "ATTR": new RegExp( "^" + attributes ), 644 "PSEUDO": new RegExp( "^" + pseudos ), 645 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + 646 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + 647 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 648 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), 649 650 // For use in libraries implementing .is() 651 // We use this for POS matching in `select` 652 "needsContext": new RegExp( "^" + whitespace + 653 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + 654 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 655 }, 656 657 rhtml = /HTML$/i, 658 rinputs = /^(?:input|select|textarea|button)$/i, 659 rheader = /^h\d$/i, 660 661 rnative = /^[^{]+\{\s*\[native \w/, 662 663 // Easily-parseable/retrievable ID or TAG or CLASS selectors 664 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 665 666 rsibling = /[+~]/, 667 668 // CSS escapes 669 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 670 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g" ), 671 funescape = function( escape, nonHex ) { 672 var high = "0x" + escape.slice( 1 ) - 0x10000; 673 674 return nonHex ? 675 676 // Strip the backslash prefix from a non-hex escape sequence 677 nonHex : 678 679 // Replace a hexadecimal escape sequence with the encoded Unicode code point 680 // Support: IE <=11+ 681 // For values outside the Basic Multilingual Plane (BMP), manually construct a 682 // surrogate pair 683 high < 0 ? 684 String.fromCharCode( high + 0x10000 ) : 685 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 686 }, 687 688 // CSS string/identifier serialization 689 // https://drafts.csswg.org/cssom/#common-serializing-idioms 690 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, 691 fcssescape = function( ch, asCodePoint ) { 692 if ( asCodePoint ) { 693 694 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 695 if ( ch === "\0" ) { 696 return "\uFFFD"; 697 } 698 699 // Control characters and (dependent upon position) numbers get escaped as code points 700 return ch.slice( 0, -1 ) + "\\" + 701 ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 702 } 703 704 // Other potentially-special ASCII characters get backslash-escaped 705 return "\\" + ch; 706 }, 707 708 // Used for iframes 709 // See setDocument() 710 // Removing the function wrapper causes a "Permission Denied" 711 // error in IE 712 unloadHandler = function() { 713 setDocument(); 714 }, 715 716 inDisabledFieldset = addCombinator( 717 function( elem ) { 718 return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; 719 }, 720 { dir: "parentNode", next: "legend" } 721 ); 722 723// Optimize for push.apply( _, NodeList ) 724try { 725 push.apply( 726 ( arr = slice.call( preferredDoc.childNodes ) ), 727 preferredDoc.childNodes 728 ); 729 730 // Support: Android<4.0 731 // Detect silently failing push.apply 732 // eslint-disable-next-line no-unused-expressions 733 arr[ preferredDoc.childNodes.length ].nodeType; 734} catch ( e ) { 735 push = { apply: arr.length ? 736 737 // Leverage slice if possible 738 function( target, els ) { 739 pushNative.apply( target, slice.call( els ) ); 740 } : 741 742 // Support: IE<9 743 // Otherwise append directly 744 function( target, els ) { 745 var j = target.length, 746 i = 0; 747 748 // Can't trust NodeList.length 749 while ( ( target[ j++ ] = els[ i++ ] ) ) {} 750 target.length = j - 1; 751 } 752 }; 753} 754 755function Sizzle( selector, context, results, seed ) { 756 var m, i, elem, nid, match, groups, newSelector, 757 newContext = context && context.ownerDocument, 758 759 // nodeType defaults to 9, since context defaults to document 760 nodeType = context ? context.nodeType : 9; 761 762 results = results || []; 763 764 // Return early from calls with invalid selector or context 765 if ( typeof selector !== "string" || !selector || 766 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 767 768 return results; 769 } 770 771 // Try to shortcut find operations (as opposed to filters) in HTML documents 772 if ( !seed ) { 773 setDocument( context ); 774 context = context || document; 775 776 if ( documentIsHTML ) { 777 778 // If the selector is sufficiently simple, try using a "get*By*" DOM method 779 // (excepting DocumentFragment context, where the methods don't exist) 780 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { 781 782 // ID selector 783 if ( ( m = match[ 1 ] ) ) { 784 785 // Document context 786 if ( nodeType === 9 ) { 787 if ( ( elem = context.getElementById( m ) ) ) { 788
789 // Support: IE, Opera, Webkit 790 // TODO: identify versions 791 // getElementById can match elements by name instead of ID 792 if ( elem.id === m ) { 793 results.push( elem ); 794 return results; 795 } 796 } else { 797 return results; 798 } 799 800 // Element context 801 } else { 802 803 // Support: IE, Opera, Webkit 804 // TODO: identify versions 805 // getElementById can match elements by name instead of ID 806 if ( newContext && ( elem = newContext.getElementById( m ) ) && 807 contains( context, elem ) && 808 elem.id === m ) { 809 810 results.push( elem ); 811 return results; 812 } 813 } 814 815 // Type selector 816 } else if ( match[ 2 ] ) { 817 push.apply( results, context.getElementsByTagName( selector ) ); 818 return results; 819 820 // Class selector 821 } else if ( ( m = match[ 3 ] ) && support.getElementsByClassName && 822 context.getElementsByClassName ) { 823 824 push.apply( results, context.getElementsByClassName( m ) ); 825 return results; 826 } 827 } 828 829 // Take advantage of querySelectorAll 830 if ( support.qsa && 831 !nonnativeSelectorCache[ selector + " " ] && 832 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) && 833 834 // Support: IE 8 only 835 // Exclude object elements 836 ( nodeType !== 1 || context.nodeName.toLowerCase() !== "object" ) ) { 837 838 newSelector = selector; 839 newContext = context; 840 841 // qSA considers elements outside a scoping root when evaluating child or 842 // descendant combinators, which is not what we want. 843 // In such cases, we work around the behavior by prefixing every selector in the 844 // list with an ID selector referencing the scope context. 845 // The technique has to be used as well when a leading combinator is used 846 // as such selectors are not recognized by querySelectorAll. 847 // Thanks to Andrew Dupont for this technique. 848 if ( nodeType === 1 && 849 ( rdescend.test( selector ) || rcombinators.test( selector ) ) ) { 850 851 // Expand context for sibling selectors 852 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 853 context; 854 855 // We can use :scope instead of the ID hack if the browser 856 // supports it & if we're not changing the context. 857 if ( newContext !== context || !support.scope ) { 858 859 // Capture the context ID, setting it first if necessary 860 if ( ( nid = context.getAttribute( "id" ) ) ) { 861 nid = nid.replace( rcssescape, fcssescape ); 862 } else { 863 context.setAttribute( "id", ( nid = expando ) ); 864 } 865 } 866 867 // Prefix every selector in the list 868 groups = tokenize( selector ); 869 i = groups.length; 870 while ( i-- ) { 871 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + 872 toSelector( groups[ i ] ); 873 } 874 newSelector = groups.join( "," ); 875 } 876 877 try { 878 push.apply( results, 879 newContext.querySelectorAll( newSelector ) 880 ); 881 return results; 882 } catch ( qsaError ) { 883 nonnativeSelectorCache( selector, true ); 884 } finally { 885 if ( nid === expando ) { 886 context.removeAttribute( "id" ); 887 } 888 } 889 } 890 } 891 } 892 893 // All others 894 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 895} 896 897/** 898 * Create key-value caches of limited size 899 * @returns {function(string, object)} Returns the Object data after storing it on itself with 900 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 901 * deleting the oldest entry 902 */ 903function createCache() { 904 var keys = []; 905 906 function cache( key, value ) { 907 908 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 909 if ( keys.push( key + " " ) > Expr.cacheLength ) { 910 911 // Only keep the most recent entries 912 delete cache[ keys.shift() ]; 913 } 914 return ( cache[ key + " " ] = value ); 915 } 916 return cache; 917} 918 919/** 920 * Mark a function for special use by Sizzle 921 * @param {Function} fn The function to mark 922 */ 923function markFunction( fn ) { 924 fn[ expando ] = true; 925 return fn; 926} 927 928/** 929 * Support testing using an element 930 * @param {Function} fn Passed the created element and returns a boolean result 931 */ 932function assert( fn ) { 933 var el = document.createElement( "fieldset" ); 934 935 try { 936 return !!fn( el ); 937 } catch ( e ) { 938 return false;
vendor: 4,247 bytes, lines 939-1094
939 } finally { 940 941 // Remove from its parent by default 942 if ( el.parentNode ) { 943 el.parentNode.removeChild( el ); 944 } 945 946 // release memory in IE 947 el = null; 948 } 949} 950 951/** 952 * Adds the same handler for all of the specified attrs 953 * @param {String} attrs Pipe-separated list of attributes 954 * @param {Function} handler The method that will be applied 955 */ 956function addHandle( attrs, handler ) { 957 var arr = attrs.split( "|" ), 958 i = arr.length; 959 960 while ( i-- ) { 961 Expr.attrHandle[ arr[ i ] ] = handler; 962 } 963} 964 965/** 966 * Checks document order of two siblings 967 * @param {Element} a 968 * @param {Element} b 969 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 970 */ 971function siblingCheck( a, b ) { 972 var cur = b && a, 973 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 974 a.sourceIndex - b.sourceIndex; 975 976 // Use IE sourceIndex if available on both nodes 977 if ( diff ) { 978 return diff; 979 } 980 981 // Check if b follows a 982 if ( cur ) { 983 while ( ( cur = cur.nextSibling ) ) { 984 if ( cur === b ) { 985 return -1; 986 } 987 } 988 } 989 990 return a ? 1 : -1; 991} 992 993/** 994 * Returns a function to use in pseudos for input types 995 * @param {String} type 996 */ 997function createInputPseudo( type ) { 998 return function( elem ) { 999 var name = elem.nodeName.toLowerCase(); 1000 return name === "input" && elem.type === type; 1001 }; 1002} 1003 1004/** 1005 * Returns a function to use in pseudos for buttons 1006 * @param {String} type 1007 */ 1008function createButtonPseudo( type ) { 1009 return function( elem ) { 1010 var name = elem.nodeName.toLowerCase(); 1011 return ( name === "input" || name === "button" ) && elem.type === type; 1012 }; 1013} 1014 1015/** 1016 * Returns a function to use in pseudos for :enabled/:disabled 1017 * @param {Boolean} disabled true for :disabled; false for :enabled 1018 */ 1019function createDisabledPseudo( disabled ) { 1020 1021 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 1022 return function( elem ) { 1023 1024 // Only certain elements can match :enabled or :disabled 1025 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 1026 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 1027 if ( "form" in elem ) { 1028 1029 // Check for inherited disabledness on relevant non-disabled elements: 1030 // * listed form-associated elements in a disabled fieldset 1031 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 1032 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 1033 // * option elements in a disabled optgroup 1034 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 1035 // All such elements have a "form" property. 1036 if ( elem.parentNode && elem.disabled === false ) { 1037 1038 // Option elements defer to a parent optgroup if present 1039 if ( "label" in elem ) { 1040 if ( "label" in elem.parentNode ) { 1041 return elem.parentNode.disabled === disabled; 1042 } else { 1043 return elem.disabled === disabled; 1044 } 1045 } 1046 1047 // Support: IE 6 - 11 1048 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 1049 return elem.isDisabled === disabled || 1050 1051 // Where there is no isDisabled, check manually 1052 /* jshint -W018 */ 1053 elem.isDisabled !== !disabled && 1054 inDisabledFieldset( elem ) === disabled; 1055 } 1056 1057 return elem.disabled === disabled; 1058 1059 // Try to winnow out elements that can't be disabled before trusting the disabled property. 1060 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 1061 // even exist on them, let alone have a boolean value. 1062 } else if ( "label" in elem ) { 1063 return elem.disabled === disabled; 1064 } 1065 1066 // Remaining elements are neither :enabled nor :disabled 1067 return false; 1068 }; 1069} 1070 1071/** 1072 * Returns a function to use in pseudos for positionals 1073 * @param {Function} fn 1074 */ 1075function createPositionalPseudo( fn ) { 1076 return markFunction( function( argument ) { 1077 argument = +argument; 1078 return markFunction( function( seed, matches ) { 1079 var j, 1080 matchIndexes = fn( [], seed.length, argument ), 1081 i = matchIndexes.length; 1082 1083 // Match elements found at the specified indexes 1084 while ( i-- ) { 1085 if ( seed[ ( j = matchIndexes[ i ] ) ] ) { 1086 seed[ j ] = !( matches[ j ] = seed[ j ] ); 1087 } 1088 } 1089 } ); 1090 } ); 1091} 1092 1093/** 1094 * Checks a node for validity as a Sizzle context
1095 * @param {Element|Object=} context 1096 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 1097 */ 1098function testContext( context ) { 1099 return context && typeof context.getElementsByTagName !== "undefined" && context; 1100} 1101 1102// Expose support vars for convenience 1103support = Sizzle.support = {}; 1104 1105/** 1106 * Detects XML nodes 1107 * @param {Element|Object} elem An element or a document 1108 * @returns {Boolean} True iff elem is a non-HTML XML node 1109 */ 1110isXML = Sizzle.isXML = function( elem ) { 1111 var namespace = elem.namespaceURI, 1112 docElem = ( elem.ownerDocument || elem ).documentElement; 1113 1114 // Support: IE <=8 1115 // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes 1116 // https://bugs.jquery.com/ticket/4833 1117 return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); 1118}; 1119 1120/** 1121 * Sets document-related variables once based on the current document 1122 * @param {Element|Object} [doc] An element or document object to use to set the document 1123 * @returns {Object} Returns the current document 1124 */ 1125setDocument = Sizzle.setDocument = function( node ) { 1126 var hasCompare, subWindow, 1127 doc = node ? node.ownerDocument || node : preferredDoc; 1128 1129 // Return early if doc is invalid or already selected 1130 // Support: IE 11+, Edge 17 - 18+ 1131 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1132 // two documents; shallow comparisons work. 1133 // eslint-disable-next-line eqeqeq 1134 if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { 1135 return document; 1136 } 1137 1138 // Update global variables 1139 document = doc; 1140 docElem = document.documentElement; 1141 documentIsHTML = !isXML( document ); 1142 1143 // Support: IE 9 - 11+, Edge 12 - 18+ 1144 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) 1145 // Support: IE 11+, Edge 17 - 18+ 1146 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1147 // two documents; shallow comparisons work. 1148 // eslint-disable-next-line eqeqeq 1149 if ( preferredDoc != document && 1150 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { 1151 1152 // Support: IE 11, Edge 1153 if ( subWindow.addEventListener ) { 1154 subWindow.addEventListener( "unload", unloadHandler, false ); 1155 1156 // Support: IE 9 - 10 only 1157 } else if ( subWindow.attachEvent ) { 1158 subWindow.attachEvent( "onunload", unloadHandler ); 1159 } 1160 } 1161 1162 // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, 1163 // Safari 4 - 5 only, Opera <=11.6 - 12.x only 1164 // IE/Edge & older browsers don't support the :scope pseudo-class. 1165 // Support: Safari 6.0 only 1166 // Safari 6.0 supports :scope but it's an alias of :root there. 1167 support.scope = assert( function( el ) { 1168 docElem.appendChild( el ).appendChild( document.createElement( "div" ) ); 1169 return typeof el.querySelectorAll !== "undefined" && 1170 !el.querySelectorAll( ":scope fieldset div" ).length; 1171 } ); 1172 1173 /* Attributes 1174 ---------------------------------------------------------------------- */ 1175 1176 // Support: IE<8 1177 // Verify that getAttribute really returns attributes and not properties 1178 // (excepting IE8 booleans) 1179 support.attributes = assert( function( el ) { 1180 el.className = "i"; 1181 return !el.getAttribute( "className" ); 1182 } ); 1183 1184 /* getElement(s)By* 1185 ---------------------------------------------------------------------- */ 1186 1187 // Check if getElementsByTagName("*") returns only elements 1188 support.getElementsByTagName = assert( function( el ) { 1189 el.appendChild( document.createComment( "" ) ); 1190 return !el.getElementsByTagName( "*" ).length; 1191 } ); 1192 1193 // Support: IE<9 1194 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); 1195 1196 // Support: IE<10 1197 // Check if getElementById returns elements by name 1198 // The broken getElementById methods don't pick up programmatically-set names, 1199 // so use a roundabout getElementsByName test 1200 support.getById = assert( function( el ) { 1201 docElem.appendChild( el ).id = expando; 1202 return !document.getElementsByName || !document.getElementsByName( expando ).length; 1203 } ); 1204 1205 // ID filter and find 1206 if ( support.getById ) { 1207 Expr.filter[ "ID" ] = function( id ) { 1208 var attrId = id.replace( runescape, funescape ); 1209 return function( elem ) { 1210 return elem.getAttribute( "id" ) === attrId; 1211 }; 1212 }; 1213 Expr.find[ "ID" ] = function( id, context ) { 1214 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1215 var elem = context.getElementById( id ); 1216 return elem ? [ elem ] : []; 1217 } 1218 }; 1219 } else { 1220 Expr.filter[ "ID" ] = function( id ) { 1221 var attrId = id.replace( runescape, funescape ); 1222 return function( elem ) { 1223 var node = typeof elem.getAttributeNode !== "undefined" && 1224 elem.getAttributeNode( "id" ); 1225 return node && node.value === attrId; 1226 }; 1227 }; 1228
vendor: 4,196 bytes, lines 1229-1360
1229 // Support: IE 6 - 7 only 1230 // getElementById is not reliable as a find shortcut 1231 Expr.find[ "ID" ] = function( id, context ) { 1232 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1233 var node, i, elems, 1234 elem = context.getElementById( id ); 1235 1236 if ( elem ) { 1237 1238 // Verify the id attribute 1239 node = elem.getAttributeNode( "id" ); 1240 if ( node && node.value === id ) { 1241 return [ elem ]; 1242 } 1243 1244 // Fall back on getElementsByName 1245 elems = context.getElementsByName( id ); 1246 i = 0; 1247 while ( ( elem = elems[ i++ ] ) ) { 1248 node = elem.getAttributeNode( "id" ); 1249 if ( node && node.value === id ) { 1250 return [ elem ]; 1251 } 1252 } 1253 } 1254 1255 return []; 1256 } 1257 }; 1258 } 1259 1260 // Tag 1261 Expr.find[ "TAG" ] = support.getElementsByTagName ? 1262 function( tag, context ) { 1263 if ( typeof context.getElementsByTagName !== "undefined" ) { 1264 return context.getElementsByTagName( tag ); 1265 1266 // DocumentFragment nodes don't have gEBTN 1267 } else if ( support.qsa ) { 1268 return context.querySelectorAll( tag ); 1269 } 1270 } : 1271 1272 function( tag, context ) { 1273 var elem, 1274 tmp = [], 1275 i = 0, 1276 1277 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too 1278 results = context.getElementsByTagName( tag ); 1279 1280 // Filter out possible comments 1281 if ( tag === "*" ) { 1282 while ( ( elem = results[ i++ ] ) ) { 1283 if ( elem.nodeType === 1 ) { 1284 tmp.push( elem ); 1285 } 1286 } 1287 1288 return tmp; 1289 } 1290 return results; 1291 }; 1292 1293 // Class 1294 Expr.find[ "CLASS" ] = support.getElementsByClassName && function( className, context ) { 1295 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 1296 return context.getElementsByClassName( className ); 1297 } 1298 }; 1299 1300 /* QSA/matchesSelector 1301 ---------------------------------------------------------------------- */ 1302 1303 // QSA and matchesSelector support 1304 1305 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 1306 rbuggyMatches = []; 1307 1308 // qSa(:focus) reports false when true (Chrome 21) 1309 // We allow this because of a bug in IE8/9 that throws an error 1310 // whenever `document.activeElement` is accessed on an iframe 1311 // So, we allow :focus to pass through QSA all the time to avoid the IE error 1312 // See https://bugs.jquery.com/ticket/13378 1313 rbuggyQSA = []; 1314 1315 if ( ( support.qsa = rnative.test( document.querySelectorAll ) ) ) { 1316 1317 // Build QSA regex 1318 // Regex strategy adopted from Diego Perini 1319 assert( function( el ) { 1320 1321 var input; 1322 1323 // Select is set to empty string on purpose 1324 // This is to test IE's treatment of not explicitly 1325 // setting a boolean content attribute, 1326 // since its presence should be enough 1327 // https://bugs.jquery.com/ticket/12359 1328 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + 1329 "<select id='" + expando + "-\r\\' msallowcapture=''>" + 1330 "<option selected=''></option></select>"; 1331 1332 // Support: IE8, Opera 11-12.16 1333 // Nothing should be selected when empty strings follow ^= or $= or *= 1334 // The test attribute must be unknown in Opera but "safe" for WinRT 1335 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 1336 if ( el.querySelectorAll( "[msallowcapture^='']" ).length ) { 1337 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); 1338 } 1339 1340 // Support: IE8 1341 // Boolean attributes and "value" are not treated correctly 1342 if ( !el.querySelectorAll( "[selected]" ).length ) { 1343 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 1344 } 1345 1346 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ 1347 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 1348 rbuggyQSA.push( "~=" ); 1349 } 1350 1351 // Support: IE 11+, Edge 15 - 18+ 1352 // IE 11/Edge don't find elements on a `[name='']` query in some cases. 1353 // Adding a temporary attribute to the document before the selection works 1354 // around the issue. 1355 // Interestingly, IE 10 & older don't seem to have the issue. 1356 input = document.createElement( "input" ); 1357 input.setAttribute( "name", "" ); 1358 el.appendChild( input ); 1359 if ( !el.querySelectorAll( "[name='']" ).length ) { 1360 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*="
vendor: 4,065 bytes, lines 1360-1489
1360+ 1361 whitespace + "*(?:''|\"\")" ); 1362 } 1363 1364 // Webkit/Opera - :checked should return selected option elements 1365 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1366 // IE8 throws error here and will not see later tests 1367 if ( !el.querySelectorAll( ":checked" ).length ) { 1368 rbuggyQSA.push( ":checked" ); 1369 } 1370 1371 // Support: Safari 8+, iOS 8+ 1372 // https://bugs.webkit.org/show_bug.cgi?id=136851 1373 // In-page `selector#id sibling-combinator selector` fails 1374 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 1375 rbuggyQSA.push( ".#.+[+~]" ); 1376 } 1377 1378 // Support: Firefox <=3.6 - 5 only 1379 // Old Firefox doesn't throw on a badly-escaped identifier. 1380 el.querySelectorAll( "\\\f" ); 1381 rbuggyQSA.push( "[\\r\\n\\f]" ); 1382 } ); 1383 1384 assert( function( el ) { 1385 el.innerHTML = "<a href='' disabled='disabled'></a>" + 1386 "<select disabled='disabled'><option/></select>"; 1387 1388 // Support: Windows 8 Native Apps 1389 // The type and name attributes are restricted during .innerHTML assignment 1390 var input = document.createElement( "input" ); 1391 input.setAttribute( "type", "hidden" ); 1392 el.appendChild( input ).setAttribute( "name", "D" ); 1393 1394 // Support: IE8 1395 // Enforce case-sensitivity of name attribute 1396 if ( el.querySelectorAll( "[name=d]" ).length ) { 1397 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); 1398 } 1399 1400 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 1401 // IE8 throws error here and will not see later tests 1402 if ( el.querySelectorAll( ":enabled" ).length !== 2 ) { 1403 rbuggyQSA.push( ":enabled", ":disabled" ); 1404 } 1405 1406 // Support: IE9-11+ 1407 // IE's :disabled selector does not pick up the children of disabled fieldsets 1408 docElem.appendChild( el ).disabled = true; 1409 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { 1410 rbuggyQSA.push( ":enabled", ":disabled" ); 1411 } 1412 1413 // Support: Opera 10 - 11 only 1414 // Opera 10-11 does not throw on post-comma invalid pseudos 1415 el.querySelectorAll( "*,:x" ); 1416 rbuggyQSA.push( ",.*:" ); 1417 } ); 1418 } 1419 1420 if ( ( support.matchesSelector = rnative.test( ( matches = docElem.matches || 1421 docElem.webkitMatchesSelector || 1422 docElem.mozMatchesSelector || 1423 docElem.oMatchesSelector || 1424 docElem.msMatchesSelector ) ) ) ) { 1425 1426 assert( function( el ) { 1427 1428 // Check to see if it's possible to do matchesSelector 1429 // on a disconnected node (IE 9) 1430 support.disconnectedMatch = matches.call( el, "*" ); 1431 1432 // This should fail with an exception 1433 // Gecko does not error, returns false instead 1434 matches.call( el, "[s!='']:x" ); 1435 rbuggyMatches.push( "!=", pseudos ); 1436 } ); 1437 } 1438 1439 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); 1440 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join( "|" ) ); 1441 1442 /* Contains 1443 ---------------------------------------------------------------------- */ 1444 hasCompare = rnative.test( docElem.compareDocumentPosition ); 1445 1446 // Element contains another 1447 // Purposefully self-exclusive 1448 // As in, an element does not contain itself 1449 contains = hasCompare || rnative.test( docElem.contains ) ? 1450 function( a, b ) { 1451 var adown = a.nodeType === 9 ? a.documentElement : a, 1452 bup = b && b.parentNode; 1453 return a === bup || !!( bup && bup.nodeType === 1 && ( 1454 adown.contains ? 1455 adown.contains( bup ) : 1456 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 1457 ) ); 1458 } : 1459 function( a, b ) { 1460 if ( b ) { 1461 while ( ( b = b.parentNode ) ) { 1462 if ( b === a ) { 1463 return true; 1464 } 1465 } 1466 } 1467 return false; 1468 }; 1469 1470 /* Sorting 1471 ---------------------------------------------------------------------- */ 1472 1473 // Document order sorting 1474 sortOrder = hasCompare ? 1475 function( a, b ) { 1476 1477 // Flag for duplicate removal 1478 if ( a === b ) { 1479 hasDuplicate = true; 1480 return 0; 1481 } 1482 1483 // Sort on method existence if only one input has compareDocumentPosition 1484 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 1485 if ( compare ) { 1486 return compare; 1487 } 1488 1489 // Calculate position if both inputs belong to the same document
1490 // Support: IE 11+, Edge 17 - 18+ 1491 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1492 // two documents; shallow comparisons work. 1493 // eslint-disable-next-line eqeqeq 1494 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? 1495 a.compareDocumentPosition( b ) : 1496 1497 // Otherwise we know they are disconnected 1498 1; 1499 1500 // Disconnected nodes 1501 if ( compare & 1 || 1502 ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { 1503 1504 // Choose the first element that is related to our preferred document 1505 // Support: IE 11+, Edge 17 - 18+ 1506 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1507 // two documents; shallow comparisons work. 1508 // eslint-disable-next-line eqeqeq 1509 if ( a == document || a.ownerDocument == preferredDoc && 1510 contains( preferredDoc, a ) ) { 1511 return -1; 1512 } 1513 1514 // Support: IE 11+, Edge 17 - 18+ 1515 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1516 // two documents; shallow comparisons work. 1517 // eslint-disable-next-line eqeqeq 1518 if ( b == document || b.ownerDocument == preferredDoc && 1519 contains( preferredDoc, b ) ) { 1520 return 1; 1521 } 1522 1523 // Maintain original order 1524 return sortInput ? 1525 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 1526 0; 1527 } 1528 1529 return compare & 4 ? -1 : 1; 1530 } : 1531 function( a, b ) { 1532 1533 // Exit early if the nodes are identical 1534 if ( a === b ) { 1535 hasDuplicate = true; 1536 return 0; 1537 } 1538 1539 var cur, 1540 i = 0, 1541 aup = a.parentNode, 1542 bup = b.parentNode, 1543 ap = [ a ], 1544 bp = [ b ]; 1545 1546 // Parentless nodes are either documents or disconnected 1547 if ( !aup || !bup ) { 1548 1549 // Support: IE 11+, Edge 17 - 18+ 1550 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1551 // two documents; shallow comparisons work. 1552 /* eslint-disable eqeqeq */ 1553 return a == document ? -1 : 1554 b == document ? 1 : 1555 /* eslint-enable eqeqeq */ 1556 aup ? -1 : 1557 bup ? 1 : 1558 sortInput ? 1559 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 1560 0; 1561 1562 // If the nodes are siblings, we can do a quick check 1563 } else if ( aup === bup ) { 1564 return siblingCheck( a, b ); 1565 } 1566 1567 // Otherwise we need full lists of their ancestors for comparison 1568 cur = a; 1569 while ( ( cur = cur.parentNode ) ) { 1570 ap.unshift( cur ); 1571 } 1572 cur = b; 1573 while ( ( cur = cur.parentNode ) ) { 1574 bp.unshift( cur ); 1575 } 1576 1577 // Walk down the tree looking for a discrepancy 1578 while ( ap[ i ] === bp[ i ] ) { 1579 i++; 1580 } 1581 1582 return i ? 1583 1584 // Do a sibling check if the nodes have a common ancestor 1585 siblingCheck( ap[ i ], bp[ i ] ) : 1586 1587 // Otherwise nodes in our document sort first 1588 // Support: IE 11+, Edge 17 - 18+ 1589 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1590 // two documents; shallow comparisons work. 1591 /* eslint-disable eqeqeq */ 1592 ap[ i ] == preferredDoc ? -1 : 1593 bp[ i ] == preferredDoc ? 1 : 1594 /* eslint-enable eqeqeq */ 1595 0; 1596 }; 1597 1598 return document; 1599}; 1600 1601Sizzle.matches = function( expr, elements ) { 1602 return Sizzle( expr, null, null, elements ); 1603}; 1604 1605Sizzle.matchesSelector = function( elem, expr ) { 1606 setDocument( elem ); 1607 1608 if ( support.matchesSelector && documentIsHTML && 1609 !nonnativeSelectorCache[ expr + " " ] && 1610 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 1611 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 1612 1613 try { 1614 var ret = matches.call( elem, expr ); 1615 1616 // IE 9's matchesSelector returns false on disconnected nodes 1617 if ( ret || support.disconnectedMatch || 1618 1619 // As well, disconnected nodes are said to be in a document 1620 // fragment in IE 9 1621 elem.document && elem.document.nodeType !== 11 ) { 1622 return ret; 1623 } 1624 } catch ( e ) { 1625 nonnativeSelectorCache( expr, true ); 1626 } 1627 } 1628 1629 return Sizzle( expr, document, null, [ elem ] ).length > 0; 1630}; 1631 1632Sizzle.contains = function( context, elem ) { 1633 1634 // Set document vars if needed 1635 // Support: IE 11+, Edge 17 - 18+ 1636 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1637 // two documents; shallow comparisons work. 1638 // eslint-disable-next-line eqeqeq 1639 if ( ( context.ownerDocument || context ) != document ) { 1640 setDocument( context ); 1641 } 1642 return contains( context, elem ); 1643}; 1644 1645Sizzle.attr = function( elem, name ) { 1646 1647 // Set document vars if needed
vendor: 16,419 bytes, lines 1648-2240
1648 // Support: IE 11+, Edge 17 - 18+ 1649 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1650 // two documents; shallow comparisons work. 1651 // eslint-disable-next-line eqeqeq 1652 if ( ( elem.ownerDocument || elem ) != document ) { 1653 setDocument( elem ); 1654 } 1655 1656 var fn = Expr.attrHandle[ name.toLowerCase() ], 1657 1658 // Don't get fooled by Object.prototype properties (jQuery #13807) 1659 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 1660 fn( elem, name, !documentIsHTML ) : 1661 undefined; 1662 1663 return val !== undefined ? 1664 val : 1665 support.attributes || !documentIsHTML ? 1666 elem.getAttribute( name ) : 1667 ( val = elem.getAttributeNode( name ) ) && val.specified ? 1668 val.value : 1669 null; 1670}; 1671 1672Sizzle.escape = function( sel ) { 1673 return ( sel + "" ).replace( rcssescape, fcssescape ); 1674}; 1675 1676Sizzle.error = function( msg ) { 1677 throw new Error( "Syntax error, unrecognized expression: " + msg ); 1678}; 1679 1680/** 1681 * Document sorting and removing duplicates 1682 * @param {ArrayLike} results 1683 */ 1684Sizzle.uniqueSort = function( results ) { 1685 var elem, 1686 duplicates = [], 1687 j = 0, 1688 i = 0; 1689 1690 // Unless we *know* we can detect duplicates, assume their presence 1691 hasDuplicate = !support.detectDuplicates; 1692 sortInput = !support.sortStable && results.slice( 0 ); 1693 results.sort( sortOrder ); 1694 1695 if ( hasDuplicate ) { 1696 while ( ( elem = results[ i++ ] ) ) { 1697 if ( elem === results[ i ] ) { 1698 j = duplicates.push( i ); 1699 } 1700 } 1701 while ( j-- ) { 1702 results.splice( duplicates[ j ], 1 ); 1703 } 1704 } 1705 1706 // Clear input after sorting to release objects 1707 // See https://github.com/jquery/sizzle/pull/225 1708 sortInput = null; 1709 1710 return results; 1711}; 1712 1713/** 1714 * Utility function for retrieving the text value of an array of DOM nodes 1715 * @param {Array|Element} elem 1716 */ 1717getText = Sizzle.getText = function( elem ) { 1718 var node, 1719 ret = "", 1720 i = 0, 1721 nodeType = elem.nodeType; 1722 1723 if ( !nodeType ) { 1724 1725 // If no nodeType, this is expected to be an array 1726 while ( ( node = elem[ i++ ] ) ) { 1727 1728 // Do not traverse comment nodes 1729 ret += getText( node ); 1730 } 1731 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 1732 1733 // Use textContent for elements 1734 // innerText usage removed for consistency of new lines (jQuery #11153) 1735 if ( typeof elem.textContent === "string" ) { 1736 return elem.textContent; 1737 } else { 1738 1739 // Traverse its children 1740 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 1741 ret += getText( elem ); 1742 } 1743 } 1744 } else if ( nodeType === 3 || nodeType === 4 ) { 1745 return elem.nodeValue; 1746 } 1747 1748 // Do not include comment or processing instruction nodes 1749 1750 return ret; 1751}; 1752 1753Expr = Sizzle.selectors = { 1754 1755 // Can be adjusted by the user 1756 cacheLength: 50, 1757 1758 createPseudo: markFunction, 1759 1760 match: matchExpr, 1761 1762 attrHandle: {}, 1763 1764 find: {}, 1765 1766 relative: { 1767 ">": { dir: "parentNode", first: true }, 1768 " ": { dir: "parentNode" }, 1769 "+": { dir: "previousSibling", first: true }, 1770 "~": { dir: "previousSibling" } 1771 }, 1772 1773 preFilter: { 1774 "ATTR": function( match ) { 1775 match[ 1 ] = match[ 1 ].replace( runescape, funescape ); 1776 1777 // Move the given value to match[3] whether quoted or unquoted 1778 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || 1779 match[ 5 ] || "" ).replace( runescape, funescape ); 1780 1781 if ( match[ 2 ] === "~=" ) { 1782 match[ 3 ] = " " + match[ 3 ] + " "; 1783 } 1784 1785 return match.slice( 0, 4 ); 1786 }, 1787 1788 "CHILD": function( match ) { 1789 1790 /* matches from matchExpr["CHILD"] 1791 1 type (only|nth|...) 1792 2 what (child|of-type) 1793 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 1794 4 xn-component of xn+y argument ([+-]?\d*n|) 1795 5 sign of xn-component 1796 6 x of xn-component 1797 7 sign of y-component 1798 8 y of y-component 1799 */ 1800 match[ 1 ] = match[ 1 ].toLowerCase(); 1801 1802 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { 1803 1804 // nth-* requires argument 1805 if ( !match[ 3 ] ) { 1806 Sizzle.error( match[ 0 ] ); 1807 } 1808 1809 // numeric x and y parameters for Expr.filter.CHILD 1810 // remember that false/true cast respectively to 0/1 1811 match[ 4 ] = +( match[ 4 ] ? 1812 match[ 5 ] + ( match[ 6 ] || 1 ) : 1813 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) ); 1814 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); 1815 1816 // other types prohibit arguments 1817 } else if ( match[ 3 ] ) { 1818 Sizzle.error( match[ 0 ] ); 1819 } 1820 1821 return match; 1822 }, 1823 1824 "PSEUDO": function( match ) { 1825 var excess, 1826 unquoted = !match[ 6 ] && match[ 2 ]; 1827 1828 if ( matchExpr[ "CHILD" ].test( match[ 0 ] ) ) { 1829 return null; 1830 } 1831 1832 // Accept quoted arguments as-is 1833 if ( match[ 3 ] ) { 1834 match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; 1835 1836 // Strip excess characters from unquoted arguments 1837 } else if ( unquoted && rpseudo.test( unquoted ) && 1838 1839 // Get excess from tokenize (recursively) 1840 ( excess = tokenize( unquoted, true ) ) && 1841 1842 // advance to the next closing parenthesis 1843 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { 1844 1845 // excess is a negative index 1846 match[ 0 ] = match[ 0 ].slice( 0, excess ); 1847 match[ 2 ] = unquoted.slice( 0, excess ); 1848 } 1849 1850 // Return only captures needed by the pseudo filter method (type and argument) 1851 return match.slice( 0, 3 ); 1852 } 1853 }, 1854 1855 filter: { 1856 1857 "TAG": function( nodeNameSelector ) { 1858 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 1859 return nodeNameSelector === "*" ? 1860 function() { 1861 return true; 1862 } : 1863 function( elem ) { 1864 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 1865 }; 1866 }, 1867 1868 "CLASS": function( className ) { 1869 var pattern = classCache[ className + " " ]; 1870 1871 return pattern || 1872 ( pattern = new RegExp( "(^|" + whitespace + 1873 ")" + className + "(" + whitespace + "|$)" ) ) && classCache( 1874 className, function( elem ) { 1875 return pattern.test( 1876 typeof elem.className === "string" && elem.className || 1877 typeof elem.getAttribute !== "undefined" && 1878 elem.getAttribute( "class" ) || 1879 "" 1880 ); 1881 } ); 1882 }, 1883 1884 "ATTR": function( name, operator, check ) { 1885 return function( elem ) { 1886 var result = Sizzle.attr( elem, name ); 1887 1888 if ( result == null ) { 1889 return operator === "!="; 1890 } 1891 if ( !operator ) { 1892 return true; 1893 } 1894 1895 result += ""; 1896 1897 /* eslint-disable max-len */ 1898 1899 return operator === "=" ? result === check : 1900 operator === "!=" ? result !== check : 1901 operator === "^=" ? check && result.indexOf( check ) === 0 : 1902 operator === "*=" ? check && result.indexOf( check ) > -1 : 1903 operator === "$=" ? check && result.slice( -check.length ) === check : 1904 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : 1905 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : 1906 false; 1907 /* eslint-enable max-len */ 1908 1909 }; 1910 }, 1911 1912 "CHILD": function( type, what, _argument, first, last ) { 1913 var simple = type.slice( 0, 3 ) !== "nth", 1914 forward = type.slice( -4 ) !== "last", 1915 ofType = what === "of-type"; 1916 1917 return first === 1 && last === 0 ? 1918 1919 // Shortcut for :nth-*(n) 1920 function( elem ) { 1921 return !!elem.parentNode; 1922 } : 1923 1924 function( elem, _context, xml ) { 1925 var cache, uniqueCache, outerCache, node, nodeIndex, start, 1926 dir = simple !== forward ? "nextSibling" : "previousSibling", 1927 parent = elem.parentNode, 1928 name = ofType && elem.nodeName.toLowerCase(), 1929 useCache = !xml && !ofType, 1930 diff = false; 1931 1932 if ( parent ) { 1933 1934 // :(first|last|only)-(child|of-type) 1935 if ( simple ) { 1936 while ( dir ) { 1937 node = elem; 1938 while ( ( node = node[ dir ] ) ) { 1939 if ( ofType ? 1940 node.nodeName.toLowerCase() === name : 1941 node.nodeType === 1 ) { 1942 1943 return false; 1944 } 1945 } 1946 1947 // Reverse direction for :only-* (if we haven't yet done so) 1948 start = dir = type === "only" && !start && "nextSibling"; 1949 } 1950 return true; 1951 } 1952 1953 start = [ forward ? parent.firstChild : parent.lastChild ]; 1954 1955 // non-xml :nth-child(...) stores cache data on `parent` 1956 if ( forward && useCache ) { 1957 1958 // Seek `elem` from a previously-cached index 1959 1960 // ...in a gzip-friendly way 1961 node = parent; 1962 outerCache = node[ expando ] || ( node[ expando ] = {} ); 1963 1964 // Support: IE <9 only 1965 // Defend against cloned attroperties (jQuery gh-1709) 1966 uniqueCache = outerCache[ node.uniqueID ] || 1967 ( outerCache[ node.uniqueID ] = {} ); 1968 1969 cache = uniqueCache[ type ] || []; 1970 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1971 diff = nodeIndex && cache[ 2 ]; 1972 node = nodeIndex && parent.childNodes[ nodeIndex ]; 1973 1974 while ( ( node = ++nodeIndex && node && node[ dir ] || 1975 1976 // Fallback to seeking `elem` from the start 1977 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 1978 1979 // When found, cache indexes on `parent` and break 1980 if ( node.nodeType === 1 && ++diff && node === elem ) { 1981 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; 1982 break; 1983 } 1984 } 1985 1986 } else { 1987 1988 // Use previously-cached element index if available 1989 if ( useCache ) { 1990 1991 // ...in a gzip-friendly way 1992 node = elem; 1993 outerCache = node[ expando ] || ( node[ expando ] = {} ); 1994 1995 // Support: IE <9 only 1996 // Defend against cloned attroperties (jQuery gh-1709) 1997 uniqueCache = outerCache[ node.uniqueID ] || 1998 ( outerCache[ node.uniqueID ] = {} ); 1999 2000 cache = uniqueCache[ type ] || []; 2001 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 2002 diff = nodeIndex; 2003 } 2004 2005 // xml :nth-child(...) 2006 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 2007 if ( diff === false ) { 2008 2009 // Use the same loop as above to seek `elem` from the start 2010 while ( ( node = ++nodeIndex && node && node[ dir ] || 2011 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 2012 2013 if ( ( ofType ? 2014 node.nodeName.toLowerCase() === name : 2015 node.nodeType === 1 ) && 2016 ++diff ) { 2017 2018 // Cache the index of each encountered element 2019 if ( useCache ) { 2020 outerCache = node[ expando ] || 2021 ( node[ expando ] = {} ); 2022 2023 // Support: IE <9 only 2024 // Defend against cloned attroperties (jQuery gh-1709) 2025 uniqueCache = outerCache[ node.uniqueID ] || 2026 ( outerCache[ node.uniqueID ] = {} ); 2027 2028 uniqueCache[ type ] = [ dirruns, diff ]; 2029 } 2030 2031 if ( node === elem ) { 2032 break; 2033 } 2034 } 2035 } 2036 } 2037 } 2038 2039 // Incorporate the offset, then check against cycle size 2040 diff -= last; 2041 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 2042 } 2043 }; 2044 }, 2045 2046 "PSEUDO": function( pseudo, argument ) { 2047 2048 // pseudo-class names are case-insensitive 2049 // http://www.w3.org/TR/selectors/#pseudo-classes 2050 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 2051 // Remember that setFilters inherits from pseudos 2052 var args, 2053 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 2054 Sizzle.error( "unsupported pseudo: " + pseudo ); 2055 2056 // The user may use createPseudo to indicate that 2057 // arguments are needed to create the filter function 2058 // just as Sizzle does 2059 if ( fn[ expando ] ) { 2060 return fn( argument ); 2061 } 2062 2063 // But maintain support for old signatures 2064 if ( fn.length > 1 ) { 2065 args = [ pseudo, pseudo, "", argument ]; 2066 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 2067 markFunction( function( seed, matches ) { 2068 var idx, 2069 matched = fn( seed, argument ), 2070 i = matched.length; 2071 while ( i-- ) { 2072 idx = indexOf( seed, matched[ i ] ); 2073 seed[ idx ] = !( matches[ idx ] = matched[ i ] ); 2074 } 2075 } ) : 2076 function( elem ) { 2077 return fn( elem, 0, args ); 2078 }; 2079 } 2080 2081 return fn; 2082 } 2083 }, 2084 2085 pseudos: { 2086 2087 // Potentially complex pseudos 2088 "not": markFunction( function( selector ) { 2089 2090 // Trim the selector passed to compile 2091 // to avoid treating leading and trailing 2092 // spaces as combinators 2093 var input = [], 2094 results = [], 2095 matcher = compile( selector.replace( rtrim, "$1" ) ); 2096 2097 return matcher[ expando ] ? 2098 markFunction( function( seed, matches, _context, xml ) { 2099 var elem, 2100 unmatched = matcher( seed, null, xml, [] ), 2101 i = seed.length; 2102 2103 // Match elements unmatched by `matcher` 2104 while ( i-- ) { 2105 if ( ( elem = unmatched[ i ] ) ) { 2106 seed[ i ] = !( matches[ i ] = elem ); 2107 } 2108 } 2109 } ) : 2110 function( elem, _context, xml ) { 2111 input[ 0 ] = elem; 2112 matcher( input, null, xml, results ); 2113 2114 // Don't keep the element (issue #299) 2115 input[ 0 ] = null; 2116 return !results.pop(); 2117 }; 2118 } ), 2119 2120 "has": markFunction( function( selector ) { 2121 return function( elem ) { 2122 return Sizzle( selector, elem ).length > 0; 2123 }; 2124 } ), 2125 2126 "contains": markFunction( function( text ) { 2127 text = text.replace( runescape, funescape ); 2128 return function( elem ) { 2129 return ( elem.textContent || getText( elem ) ).indexOf( text ) > -1; 2130 }; 2131 } ), 2132 2133 // "Whether an element is represented by a :lang() selector 2134 // is based solely on the element's language value 2135 // being equal to the identifier C, 2136 // or beginning with the identifier C immediately followed by "-". 2137 // The matching of C against the element's language value is performed case-insensitively. 2138 // The identifier C does not have to be a valid language name." 2139 // http://www.w3.org/TR/selectors/#lang-pseudo 2140 "lang": markFunction( function( lang ) { 2141 2142 // lang value must be a valid identifier 2143 if ( !ridentifier.test( lang || "" ) ) { 2144 Sizzle.error( "unsupported lang: " + lang ); 2145 } 2146 lang = lang.replace( runescape, funescape ).toLowerCase(); 2147 return function( elem ) { 2148 var elemLang; 2149 do { 2150 if ( ( elemLang = documentIsHTML ? 2151 elem.lang : 2152 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { 2153 2154 elemLang = elemLang.toLowerCase(); 2155 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 2156 } 2157 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); 2158 return false; 2159 }; 2160 } ), 2161 2162 // Miscellaneous 2163 "target": function( elem ) { 2164 var hash = window.location && window.location.hash; 2165 return hash && hash.slice( 1 ) === elem.id; 2166 }, 2167 2168 "root": function( elem ) { 2169 return elem === docElem; 2170 }, 2171 2172 "focus": function( elem ) { 2173 return elem === document.activeElement && 2174 ( !document.hasFocus || document.hasFocus() ) && 2175 !!( elem.type || elem.href || ~elem.tabIndex ); 2176 }, 2177 2178 // Boolean properties 2179 "enabled": createDisabledPseudo( false ), 2180 "disabled": createDisabledPseudo( true ), 2181 2182 "checked": function( elem ) { 2183 2184 // In CSS3, :checked should return both checked and selected elements 2185 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 2186 var nodeName = elem.nodeName.toLowerCase(); 2187 return ( nodeName === "input" && !!elem.checked ) || 2188 ( nodeName === "option" && !!elem.selected ); 2189 }, 2190 2191 "selected": function( elem ) { 2192 2193 // Accessing this property makes selected-by-default 2194 // options in Safari work properly 2195 if ( elem.parentNode ) { 2196 // eslint-disable-next-line no-unused-expressions 2197 elem.parentNode.selectedIndex; 2198 } 2199 2200 return elem.selected === true; 2201 }, 2202 2203 // Contents 2204 "empty": function( elem ) { 2205 2206 // http://www.w3.org/TR/selectors/#empty-pseudo 2207 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 2208 // but not by others (comment: 8; processing instruction: 7; etc.) 2209 // nodeType < 6 works because attributes (2) do not appear as children 2210 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 2211 if ( elem.nodeType < 6 ) { 2212 return false; 2213 } 2214 } 2215 return true; 2216 }, 2217 2218 "parent": function( elem ) { 2219 return !Expr.pseudos[ "empty" ]( elem ); 2220 }, 2221 2222 // Element/input types 2223 "header": function( elem ) { 2224 return rheader.test( elem.nodeName ); 2225 }, 2226 2227 "input": function( elem ) { 2228 return rinputs.test( elem.nodeName ); 2229 }, 2230 2231 "button": function( elem ) { 2232 var name = elem.nodeName.toLowerCase(); 2233 return name === "input" && elem.type === "button" || name === "button"; 2234 }, 2235 2236 "text": function( elem ) { 2237 var attr; 2238 return elem.nodeName.toLowerCase() === "input" && 2239 elem.type === "text" && 2240
vendor: 17,653 bytes, lines 2241-2877
2241 // Support: IE<8 2242 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 2243 ( ( attr = elem.getAttribute( "type" ) ) == null || 2244 attr.toLowerCase() === "text" ); 2245 }, 2246 2247 // Position-in-collection 2248 "first": createPositionalPseudo( function() { 2249 return [ 0 ]; 2250 } ), 2251 2252 "last": createPositionalPseudo( function( _matchIndexes, length ) { 2253 return [ length - 1 ]; 2254 } ), 2255 2256 "eq": createPositionalPseudo( function( _matchIndexes, length, argument ) { 2257 return [ argument < 0 ? argument + length : argument ]; 2258 } ), 2259 2260 "even": createPositionalPseudo( function( matchIndexes, length ) { 2261 var i = 0; 2262 for ( ; i < length; i += 2 ) { 2263 matchIndexes.push( i ); 2264 } 2265 return matchIndexes; 2266 } ), 2267 2268 "odd": createPositionalPseudo( function( matchIndexes, length ) { 2269 var i = 1; 2270 for ( ; i < length; i += 2 ) { 2271 matchIndexes.push( i ); 2272 } 2273 return matchIndexes; 2274 } ), 2275 2276 "lt": createPositionalPseudo( function( matchIndexes, length, argument ) { 2277 var i = argument < 0 ? 2278 argument + length : 2279 argument > length ? 2280 length : 2281 argument; 2282 for ( ; --i >= 0; ) { 2283 matchIndexes.push( i ); 2284 } 2285 return matchIndexes; 2286 } ), 2287 2288 "gt": createPositionalPseudo( function( matchIndexes, length, argument ) { 2289 var i = argument < 0 ? argument + length : argument; 2290 for ( ; ++i < length; ) { 2291 matchIndexes.push( i ); 2292 } 2293 return matchIndexes; 2294 } ) 2295 } 2296}; 2297 2298Expr.pseudos[ "nth" ] = Expr.pseudos[ "eq" ]; 2299 2300// Add button/input type pseudos 2301for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 2302 Expr.pseudos[ i ] = createInputPseudo( i ); 2303} 2304for ( i in { submit: true, reset: true } ) { 2305 Expr.pseudos[ i ] = createButtonPseudo( i ); 2306} 2307 2308// Easy API for creating new setFilters 2309function setFilters() {} 2310setFilters.prototype = Expr.filters = Expr.pseudos; 2311Expr.setFilters = new setFilters(); 2312 2313tokenize = Sizzle.tokenize = function( selector, parseOnly ) { 2314 var matched, match, tokens, type, 2315 soFar, groups, preFilters, 2316 cached = tokenCache[ selector + " " ]; 2317 2318 if ( cached ) { 2319 return parseOnly ? 0 : cached.slice( 0 ); 2320 } 2321 2322 soFar = selector; 2323 groups = []; 2324 preFilters = Expr.preFilter; 2325 2326 while ( soFar ) { 2327 2328 // Comma and first run 2329 if ( !matched || ( match = rcomma.exec( soFar ) ) ) { 2330 if ( match ) { 2331 2332 // Don't consume trailing commas as valid 2333 soFar = soFar.slice( match[ 0 ].length ) || soFar; 2334 } 2335 groups.push( ( tokens = [] ) ); 2336 } 2337 2338 matched = false; 2339 2340 // Combinators 2341 if ( ( match = rcombinators.exec( soFar ) ) ) { 2342 matched = match.shift(); 2343 tokens.push( { 2344 value: matched, 2345 2346 // Cast descendant combinators to space 2347 type: match[ 0 ].replace( rtrim, " " ) 2348 } ); 2349 soFar = soFar.slice( matched.length ); 2350 } 2351 2352 // Filters 2353 for ( type in Expr.filter ) { 2354 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || 2355 ( match = preFilters[ type ]( match ) ) ) ) { 2356 matched = match.shift(); 2357 tokens.push( { 2358 value: matched, 2359 type: type, 2360 matches: match 2361 } ); 2362 soFar = soFar.slice( matched.length ); 2363 } 2364 } 2365 2366 if ( !matched ) { 2367 break; 2368 } 2369 } 2370 2371 // Return the length of the invalid excess 2372 // if we're just parsing 2373 // Otherwise, throw an error or return tokens 2374 return parseOnly ? 2375 soFar.length : 2376 soFar ? 2377 Sizzle.error( selector ) : 2378 2379 // Cache the tokens 2380 tokenCache( selector, groups ).slice( 0 ); 2381}; 2382 2383function toSelector( tokens ) { 2384 var i = 0, 2385 len = tokens.length, 2386 selector = ""; 2387 for ( ; i < len; i++ ) { 2388 selector += tokens[ i ].value; 2389 } 2390 return selector; 2391} 2392 2393function addCombinator( matcher, combinator, base ) { 2394 var dir = combinator.dir, 2395 skip = combinator.next, 2396 key = skip || dir, 2397 checkNonElements = base && key === "parentNode", 2398 doneName = done++; 2399 2400 return combinator.first ? 2401 2402 // Check against closest ancestor/preceding element 2403 function( elem, context, xml ) { 2404 while ( ( elem = elem[ dir ] ) ) { 2405 if ( elem.nodeType === 1 || checkNonElements ) { 2406 return matcher( elem, context, xml ); 2407 } 2408 } 2409 return false; 2410 } : 2411 2412 // Check against all ancestor/preceding elements 2413 function( elem, context, xml ) { 2414 var oldCache, uniqueCache, outerCache, 2415 newCache = [ dirruns, doneName ]; 2416 2417 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 2418 if ( xml ) { 2419 while ( ( elem = elem[ dir ] ) ) { 2420 if ( elem.nodeType === 1 || checkNonElements ) { 2421 if ( matcher( elem, context, xml ) ) { 2422 return true; 2423 } 2424 } 2425 } 2426 } else { 2427 while ( ( elem = elem[ dir ] ) ) { 2428 if ( elem.nodeType === 1 || checkNonElements ) { 2429 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 2430 2431 // Support: IE <9 only 2432 // Defend against cloned attroperties (jQuery gh-1709) 2433 uniqueCache = outerCache[ elem.uniqueID ] || 2434 ( outerCache[ elem.uniqueID ] = {} ); 2435 2436 if ( skip && skip === elem.nodeName.toLowerCase() ) { 2437 elem = elem[ dir ] || elem; 2438 } else if ( ( oldCache = uniqueCache[ key ] ) && 2439 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 2440 2441 // Assign to newCache so results back-propagate to previous elements 2442 return ( newCache[ 2 ] = oldCache[ 2 ] ); 2443 } else { 2444 2445 // Reuse newcache so results back-propagate to previous elements 2446 uniqueCache[ key ] = newCache; 2447 2448 // A match means we're done; a fail means we have to keep checking 2449 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { 2450 return true; 2451 } 2452 } 2453 } 2454 } 2455 } 2456 return false; 2457 }; 2458} 2459 2460function elementMatcher( matchers ) { 2461 return matchers.length > 1 ? 2462 function( elem, context, xml ) { 2463 var i = matchers.length; 2464 while ( i-- ) { 2465 if ( !matchers[ i ]( elem, context, xml ) ) { 2466 return false; 2467 } 2468 } 2469 return true; 2470 } : 2471 matchers[ 0 ]; 2472} 2473 2474function multipleContexts( selector, contexts, results ) { 2475 var i = 0, 2476 len = contexts.length; 2477 for ( ; i < len; i++ ) { 2478 Sizzle( selector, contexts[ i ], results ); 2479 } 2480 return results; 2481} 2482 2483function condense( unmatched, map, filter, context, xml ) { 2484 var elem, 2485 newUnmatched = [], 2486 i = 0, 2487 len = unmatched.length, 2488 mapped = map != null; 2489 2490 for ( ; i < len; i++ ) { 2491 if ( ( elem = unmatched[ i ] ) ) { 2492 if ( !filter || filter( elem, context, xml ) ) { 2493 newUnmatched.push( elem ); 2494 if ( mapped ) { 2495 map.push( i ); 2496 } 2497 } 2498 } 2499 } 2500 2501 return newUnmatched; 2502} 2503 2504function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 2505 if ( postFilter && !postFilter[ expando ] ) { 2506 postFilter = setMatcher( postFilter ); 2507 } 2508 if ( postFinder && !postFinder[ expando ] ) { 2509 postFinder = setMatcher( postFinder, postSelector ); 2510 } 2511 return markFunction( function( seed, results, context, xml ) { 2512 var temp, i, elem, 2513 preMap = [], 2514 postMap = [], 2515 preexisting = results.length, 2516 2517 // Get initial elements from seed or context 2518 elems = seed || multipleContexts( 2519 selector || "*", 2520 context.nodeType ? [ context ] : context, 2521 [] 2522 ), 2523 2524 // Prefilter to get matcher input, preserving a map for seed-results synchronization 2525 matcherIn = preFilter && ( seed || !selector ) ? 2526 condense( elems, preMap, preFilter, context, xml ) : 2527 elems, 2528 2529 matcherOut = matcher ? 2530 2531 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 2532 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 2533 2534 // ...intermediate processing is necessary 2535 [] : 2536 2537 // ...otherwise use results directly 2538 results : 2539 matcherIn; 2540 2541 // Find primary matches 2542 if ( matcher ) { 2543 matcher( matcherIn, matcherOut, context, xml ); 2544 } 2545 2546 // Apply postFilter 2547 if ( postFilter ) { 2548 temp = condense( matcherOut, postMap ); 2549 postFilter( temp, [], context, xml ); 2550 2551 // Un-match failing elements by moving them back to matcherIn 2552 i = temp.length; 2553 while ( i-- ) { 2554 if ( ( elem = temp[ i ] ) ) { 2555 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); 2556 } 2557 } 2558 } 2559 2560 if ( seed ) { 2561 if ( postFinder || preFilter ) { 2562 if ( postFinder ) { 2563 2564 // Get the final matcherOut by condensing this intermediate into postFinder contexts 2565 temp = []; 2566 i = matcherOut.length; 2567 while ( i-- ) { 2568 if ( ( elem = matcherOut[ i ] ) ) { 2569 2570 // Restore matcherIn since elem is not yet a final match 2571 temp.push( ( matcherIn[ i ] = elem ) ); 2572 } 2573 } 2574 postFinder( null, ( matcherOut = [] ), temp, xml ); 2575 } 2576 2577 // Move matched elements from seed to results to keep them synchronized 2578 i = matcherOut.length; 2579 while ( i-- ) { 2580 if ( ( elem = matcherOut[ i ] ) && 2581 ( temp = postFinder ? indexOf( seed, elem ) : preMap[ i ] ) > -1 ) { 2582 2583 seed[ temp ] = !( results[ temp ] = elem ); 2584 } 2585 } 2586 } 2587 2588 // Add elements to results, through postFinder if defined 2589 } else { 2590 matcherOut = condense( 2591 matcherOut === results ? 2592 matcherOut.splice( preexisting, matcherOut.length ) : 2593 matcherOut 2594 ); 2595 if ( postFinder ) { 2596 postFinder( null, results, matcherOut, xml ); 2597 } else { 2598 push.apply( results, matcherOut ); 2599 } 2600 } 2601 } ); 2602} 2603 2604function matcherFromTokens( tokens ) { 2605 var checkContext, matcher, j, 2606 len = tokens.length, 2607 leadingRelative = Expr.relative[ tokens[ 0 ].type ], 2608 implicitRelative = leadingRelative || Expr.relative[ " " ], 2609 i = leadingRelative ? 1 : 0, 2610 2611 // The foundational matcher ensures that elements are reachable from top-level context(s) 2612 matchContext = addCombinator( function( elem ) { 2613 return elem === checkContext; 2614 }, implicitRelative, true ), 2615 matchAnyContext = addCombinator( function( elem ) { 2616 return indexOf( checkContext, elem ) > -1; 2617 }, implicitRelative, true ), 2618 matchers = [ function( elem, context, xml ) { 2619 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 2620 ( checkContext = context ).nodeType ? 2621 matchContext( elem, context, xml ) : 2622 matchAnyContext( elem, context, xml ) ); 2623 2624 // Avoid hanging onto element (issue #299) 2625 checkContext = null; 2626 return ret; 2627 } ]; 2628 2629 for ( ; i < len; i++ ) { 2630 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { 2631 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; 2632 } else { 2633 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); 2634 2635 // Return special upon seeing a positional matcher 2636 if ( matcher[ expando ] ) { 2637 2638 // Find the next relative operator (if any) for proper handling 2639 j = ++i; 2640 for ( ; j < len; j++ ) { 2641 if ( Expr.relative[ tokens[ j ].type ] ) { 2642 break; 2643 } 2644 } 2645 return setMatcher( 2646 i > 1 && elementMatcher( matchers ), 2647 i > 1 && toSelector( 2648 2649 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 2650 tokens 2651 .slice( 0, i - 1 ) 2652 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) 2653 ).replace( rtrim, "$1" ), 2654 matcher, 2655 i < j && matcherFromTokens( tokens.slice( i, j ) ), 2656 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), 2657 j < len && toSelector( tokens ) 2658 ); 2659 } 2660 matchers.push( matcher ); 2661 } 2662 } 2663 2664 return elementMatcher( matchers ); 2665} 2666 2667function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 2668 var bySet = setMatchers.length > 0, 2669 byElement = elementMatchers.length > 0, 2670 superMatcher = function( seed, context, xml, results, outermost ) { 2671 var elem, j, matcher, 2672 matchedCount = 0, 2673 i = "0", 2674 unmatched = seed && [], 2675 setMatched = [], 2676 contextBackup = outermostContext, 2677 2678 // We must always have either seed elements or outermost context 2679 elems = seed || byElement && Expr.find[ "TAG" ]( "*", outermost ), 2680 2681 // Use integer dirruns iff this is the outermost matcher 2682 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), 2683 len = elems.length; 2684 2685 if ( outermost ) { 2686 2687 // Support: IE 11+, Edge 17 - 18+ 2688 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2689 // two documents; shallow comparisons work. 2690 // eslint-disable-next-line eqeqeq 2691 outermostContext = context == document || context || outermost; 2692 } 2693 2694 // Add elements passing elementMatchers directly to results 2695 // Support: IE<9, Safari 2696 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 2697 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { 2698 if ( byElement && elem ) { 2699 j = 0; 2700 2701 // Support: IE 11+, Edge 17 - 18+ 2702 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2703 // two documents; shallow comparisons work. 2704 // eslint-disable-next-line eqeqeq 2705 if ( !context && elem.ownerDocument != document ) { 2706 setDocument( elem ); 2707 xml = !documentIsHTML; 2708 } 2709 while ( ( matcher = elementMatchers[ j++ ] ) ) { 2710 if ( matcher( elem, context || document, xml ) ) { 2711 results.push( elem ); 2712 break; 2713 } 2714 } 2715 if ( outermost ) { 2716 dirruns = dirrunsUnique; 2717 } 2718 } 2719 2720 // Track unmatched elements for set filters 2721 if ( bySet ) { 2722 2723 // They will have gone through all possible matchers 2724 if ( ( elem = !matcher && elem ) ) { 2725 matchedCount--; 2726 } 2727 2728 // Lengthen the array for every element, matched or not 2729 if ( seed ) { 2730 unmatched.push( elem ); 2731 } 2732 } 2733 } 2734 2735 // `i` is now the count of elements visited above, and adding it to `matchedCount` 2736 // makes the latter nonnegative. 2737 matchedCount += i; 2738 2739 // Apply set filters to unmatched elements 2740 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 2741 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 2742 // no element matchers and no seed. 2743 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 2744 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 2745 // numerically zero. 2746 if ( bySet && i !== matchedCount ) { 2747 j = 0; 2748 while ( ( matcher = setMatchers[ j++ ] ) ) { 2749 matcher( unmatched, setMatched, context, xml ); 2750 } 2751 2752 if ( seed ) { 2753 2754 // Reintegrate element matches to eliminate the need for sorting 2755 if ( matchedCount > 0 ) { 2756 while ( i-- ) { 2757 if ( !( unmatched[ i ] || setMatched[ i ] ) ) { 2758 setMatched[ i ] = pop.call( results ); 2759 } 2760 } 2761 } 2762 2763 // Discard index placeholder values to get only actual matches 2764 setMatched = condense( setMatched ); 2765 } 2766 2767 // Add matches to results 2768 push.apply( results, setMatched ); 2769 2770 // Seedless set matches succeeding multiple successful matchers stipulate sorting 2771 if ( outermost && !seed && setMatched.length > 0 && 2772 ( matchedCount + setMatchers.length ) > 1 ) { 2773 2774 Sizzle.uniqueSort( results ); 2775 } 2776 } 2777 2778 // Override manipulation of globals by nested matchers 2779 if ( outermost ) { 2780 dirruns = dirrunsUnique; 2781 outermostContext = contextBackup; 2782 } 2783 2784 return unmatched; 2785 }; 2786 2787 return bySet ? 2788 markFunction( superMatcher ) : 2789 superMatcher; 2790} 2791 2792compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 2793 var i, 2794 setMatchers = [], 2795 elementMatchers = [], 2796 cached = compilerCache[ selector + " " ]; 2797 2798 if ( !cached ) { 2799 2800 // Generate a function of recursive functions that can be used to check each element 2801 if ( !match ) { 2802 match = tokenize( selector ); 2803 } 2804 i = match.length; 2805 while ( i-- ) { 2806 cached = matcherFromTokens( match[ i ] ); 2807 if ( cached[ expando ] ) { 2808 setMatchers.push( cached ); 2809 } else { 2810 elementMatchers.push( cached ); 2811 } 2812 } 2813 2814 // Cache the compiled function 2815 cached = compilerCache( 2816 selector, 2817 matcherFromGroupMatchers( elementMatchers, setMatchers ) 2818 ); 2819 2820 // Save selector and tokenization 2821 cached.selector = selector; 2822 } 2823 return cached; 2824}; 2825 2826/** 2827 * A low-level selection function that works with Sizzle's compiled 2828 * selector functions 2829 * @param {String|Function} selector A selector or a pre-compiled 2830 * selector function built with Sizzle.compile 2831 * @param {Element} context 2832 * @param {Array} [results] 2833 * @param {Array} [seed] A set of elements to match against 2834 */ 2835select = Sizzle.select = function( selector, context, results, seed ) { 2836 var i, tokens, token, type, find, 2837 compiled = typeof selector === "function" && selector, 2838 match = !seed && tokenize( ( selector = compiled.selector || selector ) ); 2839 2840 results = results || []; 2841 2842 // Try to minimize operations if there is only one selector in the list and no seed 2843 // (the latter of which guarantees us context) 2844 if ( match.length === 1 ) { 2845 2846 // Reduce context if the leading compound selector is an ID 2847 tokens = match[ 0 ] = match[ 0 ].slice( 0 ); 2848 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && 2849 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { 2850 2851 context = ( Expr.find[ "ID" ]( token.matches[ 0 ] 2852 .replace( runescape, funescape ), context ) || [] )[ 0 ]; 2853 if ( !context ) { 2854 return results; 2855 2856 // Precompiled matchers will still verify ancestry, so step up a level 2857 } else if ( compiled ) { 2858 context = context.parentNode; 2859 } 2860 2861 selector = selector.slice( tokens.shift().value.length ); 2862 } 2863 2864 // Fetch a seed set for right-to-left matching 2865 i = matchExpr[ "needsContext" ].test( selector ) ? 0 : tokens.length; 2866 while ( i-- ) { 2867 token = tokens[ i ]; 2868 2869 // Abort if we hit a combinator 2870 if ( Expr.relative[ ( type = token.type ) ] ) { 2871 break; 2872 } 2873 if ( ( find = Expr.find[ type ] ) ) { 2874 2875 // Search, expanding context for leading sibling combinators 2876 if ( ( seed = find( 2877 token.matches[ 0 ].replace( runescape, funescape ),
vendor: 2,647 bytes, lines 2878-2974
2878 rsibling.test( tokens[ 0 ].type ) && testContext( context.parentNode ) || 2879 context 2880 ) ) ) { 2881 2882 // If seed is empty or no tokens remain, we can return early 2883 tokens.splice( i, 1 ); 2884 selector = seed.length && toSelector( tokens ); 2885 if ( !selector ) { 2886 push.apply( results, seed ); 2887 return results; 2888 } 2889 2890 break; 2891 } 2892 } 2893 } 2894 } 2895 2896 // Compile and execute a filtering function if one is not provided 2897 // Provide `match` to avoid retokenization if we modified the selector above 2898 ( compiled || compile( selector, match ) )( 2899 seed, 2900 context, 2901 !documentIsHTML, 2902 results, 2903 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 2904 ); 2905 return results; 2906}; 2907 2908// One-time assignments 2909 2910// Sort stability 2911support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; 2912 2913// Support: Chrome 14-35+ 2914// Always assume duplicates if they aren't passed to the comparison function 2915support.detectDuplicates = !!hasDuplicate; 2916 2917// Initialize against the default document 2918setDocument(); 2919 2920// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 2921// Detached nodes confoundingly follow *each other* 2922support.sortDetached = assert( function( el ) { 2923 2924 // Should return 1, but returns 4 (following) 2925 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; 2926} ); 2927 2928// Support: IE<8 2929// Prevent attribute/property "interpolation" 2930// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 2931if ( !assert( function( el ) { 2932 el.innerHTML = "<a href='#'></a>"; 2933 return el.firstChild.getAttribute( "href" ) === "#"; 2934} ) ) { 2935 addHandle( "type|href|height|width", function( elem, name, isXML ) { 2936 if ( !isXML ) { 2937 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); 2938 } 2939 } ); 2940} 2941 2942// Support: IE<9 2943// Use defaultValue in place of getAttribute("value") 2944if ( !support.attributes || !assert( function( el ) { 2945 el.innerHTML = "<input/>"; 2946 el.firstChild.setAttribute( "value", "" ); 2947 return el.firstChild.getAttribute( "value" ) === ""; 2948} ) ) { 2949 addHandle( "value", function( elem, _name, isXML ) { 2950 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { 2951 return elem.defaultValue; 2952 } 2953 } ); 2954} 2955 2956// Support: IE<9 2957// Use getAttributeNode to fetch booleans when getAttribute lies 2958if ( !assert( function( el ) { 2959 return el.getAttribute( "disabled" ) == null; 2960} ) ) { 2961 addHandle( booleans, function( elem, name, isXML ) { 2962 var val; 2963 if ( !isXML ) { 2964 return elem[ name ] === true ? name.toLowerCase() : 2965 ( val = elem.getAttributeNode( name ) ) && val.specified ? 2966 val.value : 2967 null; 2968 } 2969 } ); 2970} 2971 2972return Sizzle; 2973 2974}
vendor: 8,855 bytes, lines 2974-3343
2974)( window ); 2975 2976 2977 2978jQuery.find = Sizzle; 2979jQuery.expr = Sizzle.selectors; 2980 2981// Deprecated 2982jQuery.expr[ ":" ] = jQuery.expr.pseudos; 2983jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 2984jQuery.text = Sizzle.getText; 2985jQuery.isXMLDoc = Sizzle.isXML; 2986jQuery.contains = Sizzle.contains; 2987jQuery.escapeSelector = Sizzle.escape; 2988 2989 2990 2991 2992var dir = function( elem, dir, until ) { 2993 var matched = [], 2994 truncate = until !== undefined; 2995 2996 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 2997 if ( elem.nodeType === 1 ) { 2998 if ( truncate && jQuery( elem ).is( until ) ) { 2999 break; 3000 } 3001 matched.push( elem ); 3002 } 3003 } 3004 return matched; 3005}; 3006 3007 3008var siblings = function( n, elem ) { 3009 var matched = []; 3010 3011 for ( ; n; n = n.nextSibling ) { 3012 if ( n.nodeType === 1 && n !== elem ) { 3013 matched.push( n ); 3014 } 3015 } 3016 3017 return matched; 3018}; 3019 3020 3021var rneedsContext = jQuery.expr.match.needsContext; 3022 3023 3024 3025function nodeName( elem, name ) { 3026 3027 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 3028 3029}; 3030var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 3031 3032 3033 3034// Implement the identical functionality for filter and not 3035function winnow( elements, qualifier, not ) { 3036 if ( isFunction( qualifier ) ) { 3037 return jQuery.grep( elements, function( elem, i ) { 3038 return !!qualifier.call( elem, i, elem ) !== not; 3039 } ); 3040 } 3041 3042 // Single element 3043 if ( qualifier.nodeType ) { 3044 return jQuery.grep( elements, function( elem ) { 3045 return ( elem === qualifier ) !== not; 3046 } ); 3047 } 3048 3049 // Arraylike of elements (jQuery, arguments, Array) 3050 if ( typeof qualifier !== "string" ) { 3051 return jQuery.grep( elements, function( elem ) { 3052 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 3053 } ); 3054 } 3055 3056 // Filtered directly for both simple and complex selectors 3057 return jQuery.filter( qualifier, elements, not ); 3058} 3059 3060jQuery.filter = function( expr, elems, not ) { 3061 var elem = elems[ 0 ]; 3062 3063 if ( not ) { 3064 expr = ":not(" + expr + ")"; 3065 } 3066 3067 if ( elems.length === 1 && elem.nodeType === 1 ) { 3068 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 3069 } 3070 3071 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 3072 return elem.nodeType === 1; 3073 } ) ); 3074}; 3075 3076jQuery.fn.extend( { 3077 find: function( selector ) { 3078 var i, ret, 3079 len = this.length, 3080 self = this; 3081 3082 if ( typeof selector !== "string" ) { 3083 return this.pushStack( jQuery( selector ).filter( function() { 3084 for ( i = 0; i < len; i++ ) { 3085 if ( jQuery.contains( self[ i ], this ) ) { 3086 return true; 3087 } 3088 } 3089 } ) ); 3090 } 3091 3092 ret = this.pushStack( [] ); 3093 3094 for ( i = 0; i < len; i++ ) { 3095 jQuery.find( selector, self[ i ], ret ); 3096 } 3097 3098 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 3099 }, 3100 filter: function( selector ) { 3101 return this.pushStack( winnow( this, selector || [], false ) ); 3102 }, 3103 not: function( selector ) { 3104 return this.pushStack( winnow( this, selector || [], true ) ); 3105 }, 3106 is: function( selector ) { 3107 return !!winnow( 3108 this, 3109 3110 // If this is a positional/relative selector, check membership in the returned set 3111 // so $("p:first").is("p:last") won't return true for a doc with two "p". 3112 typeof selector === "string" && rneedsContext.test( selector ) ? 3113 jQuery( selector ) : 3114 selector || [], 3115 false 3116 ).length; 3117 } 3118} ); 3119 3120 3121// Initialize a jQuery object 3122 3123 3124// A central reference to the root jQuery(document) 3125var rootjQuery, 3126 3127 // A simple way to check for HTML strings 3128 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 3129 // Strict HTML recognition (#11290: must start with <) 3130 // Shortcut simple #id case for speed 3131 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 3132 3133 init = jQuery.fn.init = function( selector, context, root ) { 3134 var match, elem; 3135 3136 // HANDLE: $(""), $(null), $(undefined), $(false) 3137 if ( !selector ) { 3138 return this; 3139 } 3140 3141 // Method init() accepts an alternate rootjQuery 3142 // so migrate can support jQuery.sub (gh-2101) 3143 root = root || rootjQuery; 3144 3145 // Handle HTML strings 3146 if ( typeof selector === "string" ) { 3147 if ( selector[ 0 ] === "<" && 3148 selector[ selector.length - 1 ] === ">" && 3149 selector.length >= 3 ) { 3150 3151 // Assume that strings that start and end with <> are HTML and skip the regex check 3152 match = [ null, selector, null ]; 3153 3154 } else { 3155 match = rquickExpr.exec( selector ); 3156 } 3157 3158 // Match html or make sure no context is specified for #id 3159 if ( match && ( match[ 1 ] || !context ) ) { 3160 3161 // HANDLE: $(html) -> $(array) 3162 if ( match[ 1 ] ) { 3163 context = context instanceof jQuery ? context[ 0 ] : context; 3164 3165 // Option to run scripts is true for back-compat 3166 // Intentionally let the error be thrown if parseHTML is not present 3167 jQuery.merge( this, jQuery.parseHTML( 3168 match[ 1 ], 3169 context && context.nodeType ? context.ownerDocument || context : document, 3170 true 3171 ) ); 3172 3173 // HANDLE: $(html, props) 3174 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 3175 for ( match in context ) { 3176 3177 // Properties of context are called as methods if possible 3178 if ( isFunction( this[ match ] ) ) { 3179 this[ match ]( context[ match ] ); 3180 3181 // ...and otherwise set as attributes 3182 } else { 3183 this.attr( match, context[ match ] ); 3184 } 3185 } 3186 } 3187 3188 return this; 3189 3190 // HANDLE: $(#id) 3191 } else { 3192 elem = document.getElementById( match[ 2 ] ); 3193 3194 if ( elem ) { 3195 3196 // Inject the element directly into the jQuery object 3197 this[ 0 ] = elem; 3198 this.length = 1; 3199 } 3200 return this; 3201 } 3202 3203 // HANDLE: $(expr, $(...)) 3204 } else if ( !context || context.jquery ) { 3205 return ( context || root ).find( selector ); 3206 3207 // HANDLE: $(expr, context) 3208 // (which is just equivalent to: $(context).find(expr) 3209 } else { 3210 return this.constructor( context ).find( selector ); 3211 } 3212 3213 // HANDLE: $(DOMElement) 3214 } else if ( selector.nodeType ) { 3215 this[ 0 ] = selector; 3216 this.length = 1; 3217 return this; 3218 3219 // HANDLE: $(function) 3220 // Shortcut for document ready 3221 } else if ( isFunction( selector ) ) { 3222 return root.ready !== undefined ? 3223 root.ready( selector ) : 3224 3225 // Execute immediately if ready is not present 3226 selector( jQuery ); 3227 } 3228 3229 return jQuery.makeArray( selector, this ); 3230 }; 3231 3232// Give the init function the jQuery prototype for later instantiation 3233init.prototype = jQuery.fn; 3234 3235// Initialize central reference 3236rootjQuery = jQuery( document ); 3237 3238 3239var rparentsprev = /^(?:parents|prev(?:Until|All))/, 3240 3241 // Methods guaranteed to produce a unique set when starting from a unique set 3242 guaranteedUnique = { 3243 children: true, 3244 contents: true, 3245 next: true, 3246 prev: true 3247 }; 3248 3249jQuery.fn.extend( { 3250 has: function( target ) { 3251 var targets = jQuery( target, this ), 3252 l = targets.length; 3253 3254 return this.filter( function() { 3255 var i = 0; 3256 for ( ; i < l; i++ ) { 3257 if ( jQuery.contains( this, targets[ i ] ) ) { 3258 return true; 3259 } 3260 } 3261 } ); 3262 }, 3263 3264 closest: function( selectors, context ) { 3265 var cur, 3266 i = 0, 3267 l = this.length, 3268 matched = [], 3269 targets = typeof selectors !== "string" && jQuery( selectors ); 3270 3271 // Positional selectors never match, since there's no _selection_ context 3272 if ( !rneedsContext.test( selectors ) ) { 3273 for ( ; i < l; i++ ) { 3274 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 3275 3276 // Always skip document fragments 3277 if ( cur.nodeType < 11 && ( targets ? 3278 targets.index( cur ) > -1 : 3279 3280 // Don't pass non-elements to Sizzle 3281 cur.nodeType === 1 && 3282 jQuery.find.matchesSelector( cur, selectors ) ) ) { 3283 3284 matched.push( cur ); 3285 break; 3286 } 3287 } 3288 } 3289 } 3290 3291 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 3292 }, 3293 3294 // Determine the position of an element within the set 3295 index: function( elem ) { 3296 3297 // No argument, return index in parent 3298 if ( !elem ) { 3299 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 3300 } 3301 3302 // Index in selector 3303 if ( typeof elem === "string" ) { 3304 return indexOf.call( jQuery( elem ), this[ 0 ] ); 3305 } 3306 3307 // Locate the position of the desired element 3308 return indexOf.call( this, 3309 3310 // If it receives a jQuery object, the first element is used 3311 elem.jquery ? elem[ 0 ] : elem 3312 ); 3313 }, 3314 3315 add: function( selector, context ) { 3316 return this.pushStack( 3317 jQuery.uniqueSort( 3318 jQuery.merge( this.get(), jQuery( selector, context ) ) 3319 ) 3320 ); 3321 }, 3322 3323 addBack: function( selector ) { 3324 return this.add( selector == null ? 3325 this.prevObject : this.prevObject.filter( selector ) 3326 ); 3327 } 3328} ); 3329 3330function sibling( cur, dir ) { 3331 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 3332 return cur; 3333} 3334 3335jQuery.each( { 3336 parent: function( elem ) { 3337 var parent = elem.parentNode; 3338 return parent && parent.nodeType !== 11 ? parent : null; 3339 }, 3340 parents: function( elem ) { 3341 return dir( elem, "parentNode" ); 3342 }, 3343 parentsUntil: function( elem,
vendor: 13,141 bytes, lines 3343-3835
3343_i, until ) { 3344 return dir( elem, "parentNode", until ); 3345 }, 3346 next: function( elem ) { 3347 return sibling( elem, "nextSibling" ); 3348 }, 3349 prev: function( elem ) { 3350 return sibling( elem, "previousSibling" ); 3351 }, 3352 nextAll: function( elem ) { 3353 return dir( elem, "nextSibling" ); 3354 }, 3355 prevAll: function( elem ) { 3356 return dir( elem, "previousSibling" ); 3357 }, 3358 nextUntil: function( elem, _i, until ) { 3359 return dir( elem, "nextSibling", until ); 3360 }, 3361 prevUntil: function( elem, _i, until ) { 3362 return dir( elem, "previousSibling", until ); 3363 }, 3364 siblings: function( elem ) { 3365 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 3366 }, 3367 children: function( elem ) { 3368 return siblings( elem.firstChild ); 3369 }, 3370 contents: function( elem ) { 3371 if ( elem.contentDocument != null && 3372 3373 // Support: IE 11+ 3374 // <object> elements with no `data` attribute has an object 3375 // `contentDocument` with a `null` prototype. 3376 getProto( elem.contentDocument ) ) { 3377 3378 return elem.contentDocument; 3379 } 3380 3381 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 3382 // Treat the template element as a regular one in browsers that 3383 // don't support it. 3384 if ( nodeName( elem, "template" ) ) { 3385 elem = elem.content || elem; 3386 } 3387 3388 return jQuery.merge( [], elem.childNodes ); 3389 } 3390}, function( name, fn ) { 3391 jQuery.fn[ name ] = function( until, selector ) { 3392 var matched = jQuery.map( this, fn, until ); 3393 3394 if ( name.slice( -5 ) !== "Until" ) { 3395 selector = until; 3396 } 3397 3398 if ( selector && typeof selector === "string" ) { 3399 matched = jQuery.filter( selector, matched ); 3400 } 3401 3402 if ( this.length > 1 ) { 3403 3404 // Remove duplicates 3405 if ( !guaranteedUnique[ name ] ) { 3406 jQuery.uniqueSort( matched ); 3407 } 3408 3409 // Reverse order for parents* and prev-derivatives 3410 if ( rparentsprev.test( name ) ) { 3411 matched.reverse(); 3412 } 3413 } 3414 3415 return this.pushStack( matched ); 3416 }; 3417} ); 3418var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 3419 3420 3421 3422// Convert String-formatted options into Object-formatted ones 3423function createOptions( options ) { 3424 var object = {}; 3425 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 3426 object[ flag ] = true; 3427 } ); 3428 return object; 3429} 3430 3431/* 3432 * Create a callback list using the following parameters: 3433 * 3434 * options: an optional list of space-separated options that will change how 3435 * the callback list behaves or a more traditional option object 3436 * 3437 * By default a callback list will act like an event callback list and can be 3438 * "fired" multiple times. 3439 * 3440 * Possible options: 3441 * 3442 * once: will ensure the callback list can only be fired once (like a Deferred) 3443 * 3444 * memory: will keep track of previous values and will call any callback added 3445 * after the list has been fired right away with the latest "memorized" 3446 * values (like a Deferred) 3447 * 3448 * unique: will ensure a callback can only be added once (no duplicate in the list) 3449 * 3450 * stopOnFalse: interrupt callings when a callback returns false 3451 * 3452 */ 3453jQuery.Callbacks = function( options ) { 3454 3455 // Convert options from String-formatted to Object-formatted if needed 3456 // (we check in cache first) 3457 options = typeof options === "string" ? 3458 createOptions( options ) : 3459 jQuery.extend( {}, options ); 3460 3461 var // Flag to know if list is currently firing 3462 firing, 3463 3464 // Last fire value for non-forgettable lists 3465 memory, 3466 3467 // Flag to know if list was already fired 3468 fired, 3469 3470 // Flag to prevent firing 3471 locked, 3472 3473 // Actual callback list 3474 list = [], 3475 3476 // Queue of execution data for repeatable lists 3477 queue = [], 3478 3479 // Index of currently firing callback (modified by add/remove as needed) 3480 firingIndex = -1, 3481 3482 // Fire callbacks 3483 fire = function() { 3484 3485 // Enforce single-firing 3486 locked = locked || options.once; 3487 3488 // Execute callbacks for all pending executions, 3489 // respecting firingIndex overrides and runtime changes 3490 fired = firing = true; 3491 for ( ; queue.length; firingIndex = -1 ) { 3492 memory = queue.shift(); 3493 while ( ++firingIndex < list.length ) { 3494 3495 // Run callback and check for early termination 3496 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 3497 options.stopOnFalse ) { 3498 3499 // Jump to end and forget the data so .add doesn't re-fire 3500 firingIndex = list.length; 3501 memory = false; 3502 } 3503 } 3504 } 3505 3506 // Forget the data if we're done with it 3507 if ( !options.memory ) { 3508 memory = false; 3509 } 3510 3511 firing = false; 3512 3513 // Clean up if we're done firing for good 3514 if ( locked ) { 3515 3516 // Keep an empty list if we have data for future add calls 3517 if ( memory ) { 3518 list = []; 3519 3520 // Otherwise, this object is spent 3521 } else { 3522 list = ""; 3523 } 3524 } 3525 }, 3526 3527 // Actual Callbacks object 3528 self = { 3529 3530 // Add a callback or a collection of callbacks to the list 3531 add: function() { 3532 if ( list ) { 3533 3534 // If we have memory from a past run, we should fire after adding 3535 if ( memory && !firing ) { 3536 firingIndex = list.length - 1; 3537 queue.push( memory ); 3538 } 3539 3540 ( function add( args ) { 3541 jQuery.each( args, function( _, arg ) { 3542 if ( isFunction( arg ) ) { 3543 if ( !options.unique || !self.has( arg ) ) { 3544 list.push( arg ); 3545 } 3546 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 3547 3548 // Inspect recursively 3549 add( arg ); 3550 } 3551 } ); 3552 } )( arguments ); 3553 3554 if ( memory && !firing ) { 3555 fire(); 3556 } 3557 } 3558 return this; 3559 }, 3560 3561 // Remove a callback from the list 3562 remove: function() { 3563 jQuery.each( arguments, function( _, arg ) { 3564 var index; 3565 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 3566 list.splice( index, 1 ); 3567 3568 // Handle firing indexes 3569 if ( index <= firingIndex ) { 3570 firingIndex--; 3571 } 3572 } 3573 } ); 3574 return this; 3575 }, 3576 3577 // Check if a given callback is in the list. 3578 // If no argument is given, return whether or not list has callbacks attached. 3579 has: function( fn ) { 3580 return fn ? 3581 jQuery.inArray( fn, list ) > -1 : 3582 list.length > 0; 3583 }, 3584 3585 // Remove all callbacks from the list 3586 empty: function() { 3587 if ( list ) { 3588 list = []; 3589 } 3590 return this; 3591 }, 3592 3593 // Disable .fire and .add 3594 // Abort any current/pending executions 3595 // Clear all callbacks and values 3596 disable: function() { 3597 locked = queue = []; 3598 list = memory = ""; 3599 return this; 3600 }, 3601 disabled: function() { 3602 return !list; 3603 }, 3604 3605 // Disable .fire 3606 // Also disable .add unless we have memory (since it would have no effect) 3607 // Abort any pending executions 3608 lock: function() { 3609 locked = queue = []; 3610 if ( !memory && !firing ) { 3611 list = memory = ""; 3612 } 3613 return this; 3614 }, 3615 locked: function() { 3616 return !!locked; 3617 }, 3618 3619 // Call all callbacks with the given context and arguments 3620 fireWith: function( context, args ) { 3621 if ( !locked ) { 3622 args = args || []; 3623 args = [ context, args.slice ? args.slice() : args ]; 3624 queue.push( args ); 3625 if ( !firing ) { 3626 fire(); 3627 } 3628 } 3629 return this; 3630 }, 3631 3632 // Call all the callbacks with the given arguments 3633 fire: function() { 3634 self.fireWith( this, arguments ); 3635 return this; 3636 }, 3637 3638 // To know if the callbacks have already been called at least once 3639 fired: function() { 3640 return !!fired; 3641 } 3642 }; 3643 3644 return self; 3645}; 3646 3647 3648function Identity( v ) { 3649 return v; 3650} 3651function Thrower( ex ) { 3652 throw ex; 3653} 3654 3655function adoptValue( value, resolve, reject, noValue ) { 3656 var method; 3657 3658 try { 3659 3660 // Check for promise aspect first to privilege synchronous behavior 3661 if ( value && isFunction( ( method = value.promise ) ) ) { 3662 method.call( value ).done( resolve ).fail( reject ); 3663 3664 // Other thenables 3665 } else if ( value && isFunction( ( method = value.then ) ) ) { 3666 method.call( value, resolve, reject ); 3667 3668 // Other non-thenables 3669 } else { 3670 3671 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 3672 // * false: [ value ].slice( 0 ) => resolve( value ) 3673 // * true: [ value ].slice( 1 ) => resolve() 3674 resolve.apply( undefined, [ value ].slice( noValue ) ); 3675 } 3676 3677 // For Promises/A+, convert exceptions into rejections 3678 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 3679 // Deferred#then to conditionally suppress rejection. 3680 } catch ( value ) { 3681 3682 // Support: Android 4.0 only 3683 // Strict mode functions invoked without .call/.apply get global-object context 3684 reject.apply( undefined, [ value ] ); 3685 } 3686} 3687 3688jQuery.extend( { 3689 3690 Deferred: function( func ) { 3691 var tuples = [ 3692 3693 // action, add listener, callbacks, 3694 // ... .then handlers, argument index, [final state] 3695 [ "notify", "progress", jQuery.Callbacks( "memory" ), 3696 jQuery.Callbacks( "memory" ), 2 ], 3697 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 3698 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 3699 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 3700 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 3701 ], 3702 state = "pending", 3703 promise = { 3704 state: function() { 3705 return state; 3706 }, 3707 always: function() { 3708 deferred.done( arguments ).fail( arguments ); 3709 return this; 3710 }, 3711 "catch": function( fn ) { 3712 return promise.then( null, fn ); 3713 }, 3714 3715 // Keep pipe for back-compat 3716 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 3717 var fns = arguments; 3718 3719 return jQuery.Deferred( function( newDefer ) { 3720 jQuery.each( tuples, function( _i, tuple ) { 3721 3722 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 3723 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 3724 3725 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 3726 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 3727 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 3728 deferred[ tuple[ 1 ] ]( function() { 3729 var returned = fn && fn.apply( this, arguments ); 3730 if ( returned && isFunction( returned.promise ) ) { 3731 returned.promise() 3732 .progress( newDefer.notify ) 3733 .done( newDefer.resolve ) 3734 .fail( newDefer.reject ); 3735 } else { 3736 newDefer[ tuple[ 0 ] + "With" ]( 3737 this, 3738 fn ? [ returned ] : arguments 3739 ); 3740 } 3741 } ); 3742 } ); 3743 fns = null; 3744 } ).promise(); 3745 }, 3746 then: function( onFulfilled, onRejected, onProgress ) { 3747 var maxDepth = 0; 3748 function resolve( depth, deferred, handler, special ) { 3749 return function() { 3750 var that = this, 3751 args = arguments, 3752 mightThrow = function() { 3753 var returned, then; 3754 3755 // Support: Promises/A+ section 2.3.3.3.3 3756 // https://promisesaplus.com/#point-59 3757 // Ignore double-resolution attempts 3758 if ( depth < maxDepth ) { 3759 return; 3760 } 3761 3762 returned = handler.apply( that, args ); 3763 3764 // Support: Promises/A+ section 2.3.1 3765 // https://promisesaplus.com/#point-48 3766 if ( returned === deferred.promise() ) { 3767 throw new TypeError( "Thenable self-resolution" ); 3768 } 3769 3770 // Support: Promises/A+ sections 2.3.3.1, 3.5 3771 // https://promisesaplus.com/#point-54 3772 // https://promisesaplus.com/#point-75 3773 // Retrieve `then` only once 3774 then = returned && 3775 3776 // Support: Promises/A+ section 2.3.4 3777 // https://promisesaplus.com/#point-64 3778 // Only check objects and functions for thenability 3779 ( typeof returned === "object" || 3780 typeof returned === "function" ) && 3781 returned.then; 3782 3783 // Handle a returned thenable 3784 if ( isFunction( then ) ) { 3785 3786 // Special processors (notify) just wait for resolution 3787 if ( special ) { 3788 then.call( 3789 returned, 3790 resolve( maxDepth, deferred, Identity, special ), 3791 resolve( maxDepth, deferred, Thrower, special ) 3792 ); 3793 3794 // Normal processors (resolve) also hook into progress 3795 } else { 3796 3797 // ...and disregard older resolution values 3798 maxDepth++; 3799 3800 then.call( 3801 returned, 3802 resolve( maxDepth, deferred, Identity, special ), 3803 resolve( maxDepth, deferred, Thrower, special ), 3804 resolve( maxDepth, deferred, Identity, 3805 deferred.notifyWith ) 3806 ); 3807 } 3808 3809 // Handle all other returned values 3810 } else { 3811 3812 // Only substitute handlers pass on context 3813 // and multiple values (non-spec behavior) 3814 if ( handler !== Identity ) { 3815 that = undefined; 3816 args = [ returned ]; 3817 } 3818 3819 // Process the value(s) 3820 // Default process is resolve 3821 ( special || deferred.resolveWith )( that, args ); 3822 } 3823 }, 3824 3825 // Only normal processors (resolve) catch and reject exceptions 3826 process = special ? 3827 mightThrow : 3828 function() { 3829 try { 3830 mightThrow(); 3831 } catch ( e ) { 3832 3833 if ( jQuery.Deferred.exceptionHook ) { 3834 jQuery.Deferred.exceptionHook( e, 3835 process.
vendor: 8,399 bytes, lines 3835-4173
3835stackTrace ); 3836 } 3837 3838 // Support: Promises/A+ section 2.3.3.3.4.1 3839 // https://promisesaplus.com/#point-61 3840 // Ignore post-resolution exceptions 3841 if ( depth + 1 >= maxDepth ) { 3842 3843 // Only substitute handlers pass on context 3844 // and multiple values (non-spec behavior) 3845 if ( handler !== Thrower ) { 3846 that = undefined; 3847 args = [ e ]; 3848 } 3849 3850 deferred.rejectWith( that, args ); 3851 } 3852 } 3853 }; 3854 3855 // Support: Promises/A+ section 2.3.3.3.1 3856 // https://promisesaplus.com/#point-57 3857 // Re-resolve promises immediately to dodge false rejection from 3858 // subsequent errors 3859 if ( depth ) { 3860 process(); 3861 } else { 3862 3863 // Call an optional hook to record the stack, in case of exception 3864 // since it's otherwise lost when execution goes async 3865 if ( jQuery.Deferred.getStackHook ) { 3866 process.stackTrace = jQuery.Deferred.getStackHook(); 3867 } 3868 window.setTimeout( process ); 3869 } 3870 }; 3871 } 3872 3873 return jQuery.Deferred( function( newDefer ) { 3874 3875 // progress_handlers.add( ... ) 3876 tuples[ 0 ][ 3 ].add( 3877 resolve( 3878 0, 3879 newDefer, 3880 isFunction( onProgress ) ? 3881 onProgress : 3882 Identity, 3883 newDefer.notifyWith 3884 ) 3885 ); 3886 3887 // fulfilled_handlers.add( ... ) 3888 tuples[ 1 ][ 3 ].add( 3889 resolve( 3890 0, 3891 newDefer, 3892 isFunction( onFulfilled ) ? 3893 onFulfilled : 3894 Identity 3895 ) 3896 ); 3897 3898 // rejected_handlers.add( ... ) 3899 tuples[ 2 ][ 3 ].add( 3900 resolve( 3901 0, 3902 newDefer, 3903 isFunction( onRejected ) ? 3904 onRejected : 3905 Thrower 3906 ) 3907 ); 3908 } ).promise(); 3909 }, 3910 3911 // Get a promise for this deferred 3912 // If obj is provided, the promise aspect is added to the object 3913 promise: function( obj ) { 3914 return obj != null ? jQuery.extend( obj, promise ) : promise; 3915 } 3916 }, 3917 deferred = {}; 3918 3919 // Add list-specific methods 3920 jQuery.each( tuples, function( i, tuple ) { 3921 var list = tuple[ 2 ], 3922 stateString = tuple[ 5 ]; 3923 3924 // promise.progress = list.add 3925 // promise.done = list.add 3926 // promise.fail = list.add 3927 promise[ tuple[ 1 ] ] = list.add; 3928 3929 // Handle state 3930 if ( stateString ) { 3931 list.add( 3932 function() { 3933 3934 // state = "resolved" (i.e., fulfilled) 3935 // state = "rejected" 3936 state = stateString; 3937 }, 3938 3939 // rejected_callbacks.disable 3940 // fulfilled_callbacks.disable 3941 tuples[ 3 - i ][ 2 ].disable, 3942 3943 // rejected_handlers.disable 3944 // fulfilled_handlers.disable 3945 tuples[ 3 - i ][ 3 ].disable, 3946 3947 // progress_callbacks.lock 3948 tuples[ 0 ][ 2 ].lock, 3949 3950 // progress_handlers.lock 3951 tuples[ 0 ][ 3 ].lock 3952 ); 3953 } 3954 3955 // progress_handlers.fire 3956 // fulfilled_handlers.fire 3957 // rejected_handlers.fire 3958 list.add( tuple[ 3 ].fire ); 3959 3960 // deferred.notify = function() { deferred.notifyWith(...) } 3961 // deferred.resolve = function() { deferred.resolveWith(...) } 3962 // deferred.reject = function() { deferred.rejectWith(...) } 3963 deferred[ tuple[ 0 ] ] = function() { 3964 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 3965 return this; 3966 }; 3967 3968 // deferred.notifyWith = list.fireWith 3969 // deferred.resolveWith = list.fireWith 3970 // deferred.rejectWith = list.fireWith 3971 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 3972 } ); 3973 3974 // Make the deferred a promise 3975 promise.promise( deferred ); 3976 3977 // Call given func if any 3978 if ( func ) { 3979 func.call( deferred, deferred ); 3980 } 3981 3982 // All done! 3983 return deferred; 3984 }, 3985 3986 // Deferred helper 3987 when: function( singleValue ) { 3988 var 3989 3990 // count of uncompleted subordinates 3991 remaining = arguments.length, 3992 3993 // count of unprocessed arguments 3994 i = remaining, 3995 3996 // subordinate fulfillment data 3997 resolveContexts = Array( i ), 3998 resolveValues = slice.call( arguments ), 3999 4000 // the master Deferred 4001 master = jQuery.Deferred(), 4002 4003 // subordinate callback factory 4004 updateFunc = function( i ) { 4005 return function( value ) { 4006 resolveContexts[ i ] = this; 4007 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 4008 if ( !( --remaining ) ) { 4009 master.resolveWith( resolveContexts, resolveValues ); 4010 } 4011 }; 4012 }; 4013 4014 // Single- and empty arguments are adopted like Promise.resolve 4015 if ( remaining <= 1 ) { 4016 adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, 4017 !remaining ); 4018 4019 // Use .then() to unwrap secondary thenables (cf. gh-3000) 4020 if ( master.state() === "pending" || 4021 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 4022 4023 return master.then(); 4024 } 4025 } 4026 4027 // Multiple arguments are aggregated like Promise.all array elements 4028 while ( i-- ) { 4029 adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); 4030 } 4031 4032 return master.promise(); 4033 } 4034} ); 4035 4036 4037// These usually indicate a programmer mistake during development, 4038// warn about them ASAP rather than swallowing them by default. 4039var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 4040 4041jQuery.Deferred.exceptionHook = function( error, stack ) { 4042 4043 // Support: IE 8 - 9 only 4044 // Console exists when dev tools are open, which can happen at any time 4045 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 4046 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); 4047 } 4048}; 4049 4050 4051 4052 4053jQuery.readyException = function( error ) { 4054 window.setTimeout( function() { 4055 throw error; 4056 } ); 4057}; 4058 4059 4060 4061 4062// The deferred used on DOM ready 4063var readyList = jQuery.Deferred(); 4064 4065jQuery.fn.ready = function( fn ) { 4066 4067 readyList 4068 .then( fn ) 4069 4070 // Wrap jQuery.readyException in a function so that the lookup 4071 // happens at the time of error handling instead of callback 4072 // registration. 4073 .catch( function( error ) { 4074 jQuery.readyException( error ); 4075 } ); 4076 4077 return this; 4078}; 4079 4080jQuery.extend( { 4081 4082 // Is the DOM ready to be used? Set to true once it occurs. 4083 isReady: false, 4084 4085 // A counter to track how many items to wait for before 4086 // the ready event fires. See #6781 4087 readyWait: 1, 4088 4089 // Handle when the DOM is ready 4090 ready: function( wait ) { 4091 4092 // Abort if there are pending holds or we're already ready 4093 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 4094 return; 4095 } 4096 4097 // Remember that the DOM is ready 4098 jQuery.isReady = true; 4099 4100 // If a normal DOM Ready event fired, decrement, and wait if need be 4101 if ( wait !== true && --jQuery.readyWait > 0 ) { 4102 return; 4103 } 4104 4105 // If there are functions bound, to execute 4106 readyList.resolveWith( document, [ jQuery ] ); 4107 } 4108} ); 4109 4110jQuery.ready.then = readyList.then; 4111 4112// The ready event handler and self cleanup method 4113function completed() { 4114 document.removeEventListener( "DOMContentLoaded", completed ); 4115 window.removeEventListener( "load", completed ); 4116 jQuery.ready(); 4117} 4118 4119// Catch cases where $(document).ready() is called 4120// after the browser event has already occurred. 4121// Support: IE <=9 - 10 only 4122// Older IE sometimes signals "interactive" too soon 4123if ( document.readyState === "complete" || 4124 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 4125 4126 // Handle it asynchronously to allow scripts the opportunity to delay ready 4127 window.setTimeout( jQuery.ready ); 4128 4129} else { 4130 4131 // Use the handy event callback 4132 document.addEventListener( "DOMContentLoaded", completed ); 4133 4134 // A fallback to window.onload, that will always work 4135 window.addEventListener( "load", completed ); 4136} 4137 4138 4139 4140 4141// Multifunctional method to get and set values of a collection 4142// The value/s can optionally be executed if it's a function 4143var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 4144 var i = 0, 4145 len = elems.length, 4146 bulk = key == null; 4147 4148 // Sets many values 4149 if ( toType( key ) === "object" ) { 4150 chainable = true; 4151 for ( i in key ) { 4152 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 4153 } 4154 4155 // Sets one value 4156 } else if ( value !== undefined ) { 4157 chainable = true; 4158 4159 if ( !isFunction( value ) ) { 4160 raw = true; 4161 } 4162 4163 if ( bulk ) { 4164 4165 // Bulk operations run against the entire set 4166 if ( raw ) { 4167 fn.call( elems, value ); 4168 fn = null; 4169 4170 // ...except when executing function values 4171 } else { 4172 bulk = fn; 4173 fn = function( elem,
vendor: 557 bytes, lines 4173-4208
4173_key, value ) { 4174 return bulk.call( jQuery( elem ), value ); 4175 }; 4176 } 4177 } 4178 4179 if ( fn ) { 4180 for ( ; i < len; i++ ) { 4181 fn( 4182 elems[ i ], key, raw ? 4183 value : 4184 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 4185 ); 4186 } 4187 } 4188 } 4189 4190 if ( chainable ) { 4191 return elems; 4192 } 4193 4194 // Gets 4195 if ( bulk ) { 4196 return fn.call( elems ); 4197 } 4198 4199 return len ? fn( elems[ 0 ], key ) : emptyGet; 4200}; 4201 4202 4203// Matches dashed string for camelizing 4204var rmsPrefix = /^-ms-/, 4205 rdashAlpha = /-([a-z])/g; 4206 4207// Used by camelCase as callback to replace() 4208function fcamelCase( _
vendor: 11,636 bytes, lines 4208-4697
4208all, letter ) { 4209 return letter.toUpperCase(); 4210} 4211 4212// Convert dashed to camelCase; used by the css and data modules 4213// Support: IE <=9 - 11, Edge 12 - 15 4214// Microsoft forgot to hump their vendor prefix (#9572) 4215function camelCase( string ) { 4216 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 4217} 4218var acceptData = function( owner ) { 4219 4220 // Accepts only: 4221 // - Node 4222 // - Node.ELEMENT_NODE 4223 // - Node.DOCUMENT_NODE 4224 // - Object 4225 // - Any 4226 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 4227}; 4228 4229 4230 4231 4232function Data() { 4233 this.expando = jQuery.expando + Data.uid++; 4234} 4235 4236Data.uid = 1; 4237 4238Data.prototype = { 4239 4240 cache: function( owner ) { 4241 4242 // Check if the owner object already has a cache 4243 var value = owner[ this.expando ]; 4244 4245 // If not, create one 4246 if ( !value ) { 4247 value = {}; 4248 4249 // We can accept data for non-element nodes in modern browsers, 4250 // but we should not, see #8335. 4251 // Always return an empty object. 4252 if ( acceptData( owner ) ) { 4253 4254 // If it is a node unlikely to be stringify-ed or looped over 4255 // use plain assignment 4256 if ( owner.nodeType ) { 4257 owner[ this.expando ] = value; 4258 4259 // Otherwise secure it in a non-enumerable property 4260 // configurable must be true to allow the property to be 4261 // deleted when data is removed 4262 } else { 4263 Object.defineProperty( owner, this.expando, { 4264 value: value, 4265 configurable: true 4266 } ); 4267 } 4268 } 4269 } 4270 4271 return value; 4272 }, 4273 set: function( owner, data, value ) { 4274 var prop, 4275 cache = this.cache( owner ); 4276 4277 // Handle: [ owner, key, value ] args 4278 // Always use camelCase key (gh-2257) 4279 if ( typeof data === "string" ) { 4280 cache[ camelCase( data ) ] = value; 4281 4282 // Handle: [ owner, { properties } ] args 4283 } else { 4284 4285 // Copy the properties one-by-one to the cache object 4286 for ( prop in data ) { 4287 cache[ camelCase( prop ) ] = data[ prop ]; 4288 } 4289 } 4290 return cache; 4291 }, 4292 get: function( owner, key ) { 4293 return key === undefined ? 4294 this.cache( owner ) : 4295 4296 // Always use camelCase key (gh-2257) 4297 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 4298 }, 4299 access: function( owner, key, value ) { 4300 4301 // In cases where either: 4302 // 4303 // 1. No key was specified 4304 // 2. A string key was specified, but no value provided 4305 // 4306 // Take the "read" path and allow the get method to determine 4307 // which value to return, respectively either: 4308 // 4309 // 1. The entire cache object 4310 // 2. The data stored at the key 4311 // 4312 if ( key === undefined || 4313 ( ( key && typeof key === "string" ) && value === undefined ) ) { 4314 4315 return this.get( owner, key ); 4316 } 4317 4318 // When the key is not a string, or both a key and value 4319 // are specified, set or extend (existing objects) with either: 4320 // 4321 // 1. An object of properties 4322 // 2. A key and value 4323 // 4324 this.set( owner, key, value ); 4325 4326 // Since the "set" path can have two possible entry points 4327 // return the expected data based on which path was taken[*] 4328 return value !== undefined ? value : key; 4329 }, 4330 remove: function( owner, key ) { 4331 var i, 4332 cache = owner[ this.expando ]; 4333 4334 if ( cache === undefined ) { 4335 return; 4336 } 4337 4338 if ( key !== undefined ) { 4339 4340 // Support array or space separated string of keys 4341 if ( Array.isArray( key ) ) { 4342 4343 // If key is an array of keys... 4344 // We always set camelCase keys, so remove that. 4345 key = key.map( camelCase ); 4346 } else { 4347 key = camelCase( key ); 4348 4349 // If a key with the spaces exists, use it. 4350 // Otherwise, create an array by matching non-whitespace 4351 key = key in cache ? 4352 [ key ] : 4353 ( key.match( rnothtmlwhite ) || [] ); 4354 } 4355 4356 i = key.length; 4357 4358 while ( i-- ) { 4359 delete cache[ key[ i ] ]; 4360 } 4361 } 4362 4363 // Remove the expando if there's no more data 4364 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 4365 4366 // Support: Chrome <=35 - 45 4367 // Webkit & Blink performance suffers when deleting properties 4368 // from DOM nodes, so set to undefined instead 4369 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 4370 if ( owner.nodeType ) { 4371 owner[ this.expando ] = undefined; 4372 } else { 4373 delete owner[ this.expando ]; 4374 } 4375 } 4376 }, 4377 hasData: function( owner ) { 4378 var cache = owner[ this.expando ]; 4379 return cache !== undefined && !jQuery.isEmptyObject( cache ); 4380 } 4381}; 4382var dataPriv = new Data(); 4383 4384var dataUser = new Data(); 4385 4386 4387 4388// Implementation Summary 4389// 4390// 1. Enforce API surface and semantic compatibility with 1.9.x branch 4391// 2. Improve the module's maintainability by reducing the storage 4392// paths to a single mechanism. 4393// 3. Use the same single mechanism to support "private" and "user" data. 4394// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 4395// 5. Avoid exposing implementation details on user objects (eg. expando properties) 4396// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 4397 4398var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 4399 rmultiDash = /[A-Z]/g; 4400 4401function getData( data ) { 4402 if ( data === "true" ) { 4403 return true; 4404 } 4405 4406 if ( data === "false" ) { 4407 return false; 4408 } 4409 4410 if ( data === "null" ) { 4411 return null; 4412 } 4413 4414 // Only convert to a number if it doesn't change the string 4415 if ( data === +data + "" ) { 4416 return +data; 4417 } 4418 4419 if ( rbrace.test( data ) ) { 4420 return JSON.parse( data ); 4421 } 4422 4423 return data; 4424} 4425 4426function dataAttr( elem, key, data ) { 4427 var name; 4428 4429 // If nothing was found internally, try to fetch any 4430 // data from the HTML5 data-* attribute 4431 if ( data === undefined && elem.nodeType === 1 ) { 4432 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 4433 data = elem.getAttribute( name ); 4434 4435 if ( typeof data === "string" ) { 4436 try { 4437 data = getData( data ); 4438 } catch ( e ) {} 4439 4440 // Make sure we set the data so it isn't changed later 4441 dataUser.set( elem, key, data ); 4442 } else { 4443 data = undefined; 4444 } 4445 } 4446 return data; 4447} 4448 4449jQuery.extend( { 4450 hasData: function( elem ) { 4451 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 4452 }, 4453 4454 data: function( elem, name, data ) { 4455 return dataUser.access( elem, name, data ); 4456 }, 4457 4458 removeData: function( elem, name ) { 4459 dataUser.remove( elem, name ); 4460 }, 4461 4462 // TODO: Now that all calls to _data and _removeData have been replaced 4463 // with direct calls to dataPriv methods, these can be deprecated. 4464 _data: function( elem, name, data ) { 4465 return dataPriv.access( elem, name, data ); 4466 }, 4467 4468 _removeData: function( elem, name ) { 4469 dataPriv.remove( elem, name ); 4470 } 4471} ); 4472 4473jQuery.fn.extend( { 4474 data: function( key, value ) { 4475 var i, name, data, 4476 elem = this[ 0 ], 4477 attrs = elem && elem.attributes; 4478 4479 // Gets all values 4480 if ( key === undefined ) { 4481 if ( this.length ) { 4482 data = dataUser.get( elem ); 4483 4484 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 4485 i = attrs.length; 4486 while ( i-- ) { 4487 4488 // Support: IE 11 only 4489 // The attrs elements can be null (#14894) 4490 if ( attrs[ i ] ) { 4491 name = attrs[ i ].name; 4492 if ( name.indexOf( "data-" ) === 0 ) { 4493 name = camelCase( name.slice( 5 ) ); 4494 dataAttr( elem, name, data[ name ] ); 4495 } 4496 } 4497 } 4498 dataPriv.set( elem, "hasDataAttrs", true ); 4499 } 4500 } 4501 4502 return data; 4503 } 4504 4505 // Sets multiple values 4506 if ( typeof key === "object" ) { 4507 return this.each( function() { 4508 dataUser.set( this, key ); 4509 } ); 4510 } 4511 4512 return access( this, function( value ) { 4513 var data; 4514 4515 // The calling jQuery object (element matches) is not empty 4516 // (and therefore has an element appears at this[ 0 ]) and the 4517 // `value` parameter was not undefined. An empty jQuery object 4518 // will result in `undefined` for elem = this[ 0 ] which will 4519 // throw an exception if an attempt to read a data cache is made. 4520 if ( elem && value === undefined ) { 4521 4522 // Attempt to get data from the cache 4523 // The key will always be camelCased in Data 4524 data = dataUser.get( elem, key ); 4525 if ( data !== undefined ) { 4526 return data; 4527 } 4528 4529 // Attempt to "discover" the data in 4530 // HTML5 custom data-* attrs 4531 data = dataAttr( elem, key ); 4532 if ( data !== undefined ) { 4533 return data; 4534 } 4535 4536 // We tried really hard, but the data doesn't exist. 4537 return; 4538 } 4539 4540 // Set the data... 4541 this.each( function() { 4542 4543 // We always store the camelCased key 4544 dataUser.set( this, key, value ); 4545 } ); 4546 }, null, value, arguments.length > 1, null, true ); 4547 }, 4548 4549 removeData: function( key ) { 4550 return this.each( function() { 4551 dataUser.remove( this, key ); 4552 } ); 4553 } 4554} ); 4555 4556 4557jQuery.extend( { 4558 queue: function( elem, type, data ) { 4559 var queue; 4560 4561 if ( elem ) { 4562 type = ( type || "fx" ) + "queue"; 4563 queue = dataPriv.get( elem, type ); 4564 4565 // Speed up dequeue by getting out quickly if this is just a lookup 4566 if ( data ) { 4567 if ( !queue || Array.isArray( data ) ) { 4568 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 4569 } else { 4570 queue.push( data ); 4571 } 4572 } 4573 return queue || []; 4574 } 4575 }, 4576 4577 dequeue: function( elem, type ) { 4578 type = type || "fx"; 4579 4580 var queue = jQuery.queue( elem, type ), 4581 startLength = queue.length, 4582 fn = queue.shift(), 4583 hooks = jQuery._queueHooks( elem, type ), 4584 next = function() { 4585 jQuery.dequeue( elem, type ); 4586 }; 4587 4588 // If the fx queue is dequeued, always remove the progress sentinel 4589 if ( fn === "inprogress" ) { 4590 fn = queue.shift(); 4591 startLength--; 4592 } 4593 4594 if ( fn ) { 4595 4596 // Add a progress sentinel to prevent the fx queue from being 4597 // automatically dequeued 4598 if ( type === "fx" ) { 4599 queue.unshift( "inprogress" ); 4600 } 4601 4602 // Clear up the last queue stop function 4603 delete hooks.stop; 4604 fn.call( elem, next, hooks ); 4605 } 4606 4607 if ( !startLength && hooks ) { 4608 hooks.empty.fire(); 4609 } 4610 }, 4611 4612 // Not public - generate a queueHooks object, or return the current one 4613 _queueHooks: function( elem, type ) { 4614 var key = type + "queueHooks"; 4615 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 4616 empty: jQuery.Callbacks( "once memory" ).add( function() { 4617 dataPriv.remove( elem, [ type + "queue", key ] ); 4618 } ) 4619 } ); 4620 } 4621} ); 4622 4623jQuery.fn.extend( { 4624 queue: function( type, data ) { 4625 var setter = 2; 4626 4627 if ( typeof type !== "string" ) { 4628 data = type; 4629 type = "fx"; 4630 setter--; 4631 } 4632 4633 if ( arguments.length < setter ) { 4634 return jQuery.queue( this[ 0 ], type ); 4635 } 4636 4637 return data === undefined ? 4638 this : 4639 this.each( function() { 4640 var queue = jQuery.queue( this, type, data ); 4641 4642 // Ensure a hooks for this queue 4643 jQuery._queueHooks( this, type ); 4644 4645 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 4646 jQuery.dequeue( this, type ); 4647 } 4648 } ); 4649 }, 4650 dequeue: function( type ) { 4651 return this.each( function() { 4652 jQuery.dequeue( this, type ); 4653 } ); 4654 }, 4655 clearQueue: function( type ) { 4656 return this.queue( type || "fx", [] ); 4657 }, 4658 4659 // Get a promise resolved when queues of a certain type 4660 // are emptied (fx is the type by default) 4661 promise: function( type, obj ) { 4662 var tmp, 4663 count = 1, 4664 defer = jQuery.Deferred(), 4665 elements = this, 4666 i = this.length, 4667 resolve = function() { 4668 if ( !( --count ) ) { 4669 defer.resolveWith( elements, [ elements ] ); 4670 } 4671 }; 4672 4673 if ( typeof type !== "string" ) { 4674 obj = type; 4675 type = undefined; 4676 } 4677 type = type || "fx"; 4678 4679 while ( i-- ) { 4680 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 4681 if ( tmp && tmp.empty ) { 4682 count++; 4683 tmp.empty.add( resolve ); 4684 } 4685 } 4686 resolve(); 4687 return defer.promise( obj ); 4688 } 4689} ); 4690var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 4691 4692var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 4693 4694 4695var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 4696 4697var
vendor: 5,672 bytes, lines 4697-4912
4697documentElement = document.documentElement; 4698 4699 4700 4701 var isAttached = function( elem ) { 4702 return jQuery.contains( elem.ownerDocument, elem ); 4703 }, 4704 composed = { composed: true }; 4705 4706 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only 4707 // Check attachment across shadow DOM boundaries when possible (gh-3504) 4708 // Support: iOS 10.0-10.2 only 4709 // Early iOS 10 versions support `attachShadow` but not `getRootNode`, 4710 // leading to errors. We need to check for `getRootNode`. 4711 if ( documentElement.getRootNode ) { 4712 isAttached = function( elem ) { 4713 return jQuery.contains( elem.ownerDocument, elem ) || 4714 elem.getRootNode( composed ) === elem.ownerDocument; 4715 }; 4716 } 4717var isHiddenWithinTree = function( elem, el ) { 4718 4719 // isHiddenWithinTree might be called from jQuery#filter function; 4720 // in that case, element will be second argument 4721 elem = el || elem; 4722 4723 // Inline style trumps all 4724 return elem.style.display === "none" || 4725 elem.style.display === "" && 4726 4727 // Otherwise, check computed style 4728 // Support: Firefox <=43 - 45 4729 // Disconnected elements can have computed display: none, so first confirm that elem is 4730 // in the document. 4731 isAttached( elem ) && 4732 4733 jQuery.css( elem, "display" ) === "none"; 4734 }; 4735 4736 4737 4738function adjustCSS( elem, prop, valueParts, tween ) { 4739 var adjusted, scale, 4740 maxIterations = 20, 4741 currentValue = tween ? 4742 function() { 4743 return tween.cur(); 4744 } : 4745 function() { 4746 return jQuery.css( elem, prop, "" ); 4747 }, 4748 initial = currentValue(), 4749 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 4750 4751 // Starting value computation is required for potential unit mismatches 4752 initialInUnit = elem.nodeType && 4753 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 4754 rcssNum.exec( jQuery.css( elem, prop ) ); 4755 4756 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 4757 4758 // Support: Firefox <=54 4759 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 4760 initial = initial / 2; 4761 4762 // Trust units reported by jQuery.css 4763 unit = unit || initialInUnit[ 3 ]; 4764 4765 // Iteratively approximate from a nonzero starting point 4766 initialInUnit = +initial || 1; 4767 4768 while ( maxIterations-- ) { 4769 4770 // Evaluate and update our best guess (doubling guesses that zero out). 4771 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 4772 jQuery.style( elem, prop, initialInUnit + unit ); 4773 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 4774 maxIterations = 0; 4775 } 4776 initialInUnit = initialInUnit / scale; 4777 4778 } 4779 4780 initialInUnit = initialInUnit * 2; 4781 jQuery.style( elem, prop, initialInUnit + unit ); 4782 4783 // Make sure we update the tween properties later on 4784 valueParts = valueParts || []; 4785 } 4786 4787 if ( valueParts ) { 4788 initialInUnit = +initialInUnit || +initial || 0; 4789 4790 // Apply relative offset (+=/-=) if specified 4791 adjusted = valueParts[ 1 ] ? 4792 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 4793 +valueParts[ 2 ]; 4794 if ( tween ) { 4795 tween.unit = unit; 4796 tween.start = initialInUnit; 4797 tween.end = adjusted; 4798 } 4799 } 4800 return adjusted; 4801} 4802 4803 4804var defaultDisplayMap = {}; 4805 4806function getDefaultDisplay( elem ) { 4807 var temp, 4808 doc = elem.ownerDocument, 4809 nodeName = elem.nodeName, 4810 display = defaultDisplayMap[ nodeName ]; 4811 4812 if ( display ) { 4813 return display; 4814 } 4815 4816 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 4817 display = jQuery.css( temp, "display" ); 4818 4819 temp.parentNode.removeChild( temp ); 4820 4821 if ( display === "none" ) { 4822 display = "block"; 4823 } 4824 defaultDisplayMap[ nodeName ] = display; 4825 4826 return display; 4827} 4828 4829function showHide( elements, show ) { 4830 var display, elem, 4831 values = [], 4832 index = 0, 4833 length = elements.length; 4834 4835 // Determine new display value for elements that need to change 4836 for ( ; index < length; index++ ) { 4837 elem = elements[ index ]; 4838 if ( !elem.style ) { 4839 continue; 4840 } 4841 4842 display = elem.style.display; 4843 if ( show ) { 4844 4845 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 4846 // check is required in this first loop unless we have a nonempty display value (either 4847 // inline or about-to-be-restored) 4848 if ( display === "none" ) { 4849 values[ index ] = dataPriv.get( elem, "display" ) || null; 4850 if ( !values[ index ] ) { 4851 elem.style.display = ""; 4852 } 4853 } 4854 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 4855 values[ index ] = getDefaultDisplay( elem ); 4856 } 4857 } else { 4858 if ( display !== "none" ) { 4859 values[ index ] = "none"; 4860 4861 // Remember what we're overwriting 4862 dataPriv.set( elem, "display", display ); 4863 } 4864 } 4865 } 4866 4867 // Set the display of the elements in a second loop to avoid constant reflow 4868 for ( index = 0; index < length; index++ ) { 4869 if ( values[ index ] != null ) { 4870 elements[ index ].style.display = values[ index ]; 4871 } 4872 } 4873 4874 return elements; 4875} 4876 4877jQuery.fn.extend( { 4878 show: function() { 4879 return showHide( this, true ); 4880 }, 4881 hide: function() { 4882 return showHide( this ); 4883 }, 4884 toggle: function( state ) { 4885 if ( typeof state === "boolean" ) { 4886 return state ? this.show() : this.hide(); 4887 } 4888 4889 return this.each( function() { 4890 if ( isHiddenWithinTree( this ) ) { 4891 jQuery( this ).show(); 4892 } else { 4893 jQuery( this ).hide(); 4894 } 4895 } ); 4896 } 4897} ); 4898var rcheckableType = ( /^(?:checkbox|radio)$/i ); 4899 4900var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); 4901 4902var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 4903 4904 4905 4906( function() { 4907 var fragment = document.createDocumentFragment(), 4908 div = fragment.appendChild( document.createElement( "div" ) ), 4909 input = document.createElement( "input" ); 4910 4911 // Support: Android 4.0 - 4.3 only 4912 // Check state lost if the name is set (
vendor: 10,796 bytes, lines 4912-5318
4912#11217) 4913 // Support: Windows Web Apps (WWA) 4914 // `name` and `type` must use .setAttribute for WWA (#14901) 4915 input.setAttribute( "type", "radio" ); 4916 input.setAttribute( "checked", "checked" ); 4917 input.setAttribute( "name", "t" ); 4918 4919 div.appendChild( input ); 4920 4921 // Support: Android <=4.1 only 4922 // Older WebKit doesn't clone checked state correctly in fragments 4923 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 4924 4925 // Support: IE <=11 only 4926 // Make sure textarea (and checkbox) defaultValue is properly cloned 4927 div.innerHTML = "<textarea>x</textarea>"; 4928 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 4929 4930 // Support: IE <=9 only 4931 // IE <=9 replaces <option> tags with their contents when inserted outside of 4932 // the select element. 4933 div.innerHTML = "<option></option>"; 4934 support.option = !!div.lastChild; 4935} )(); 4936 4937 4938// We have to close these tags to support XHTML (#13200) 4939var wrapMap = { 4940 4941 // XHTML parsers do not magically insert elements in the 4942 // same way that tag soup parsers do. So we cannot shorten 4943 // this by omitting <tbody> or other required elements. 4944 thead: [ 1, "<table>", "</table>" ], 4945 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 4946 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 4947 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 4948 4949 _default: [ 0, "", "" ] 4950}; 4951 4952wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 4953wrapMap.th = wrapMap.td; 4954 4955// Support: IE <=9 only 4956if ( !support.option ) { 4957 wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ]; 4958} 4959 4960 4961function getAll( context, tag ) { 4962 4963 // Support: IE <=9 - 11 only 4964 // Use typeof to avoid zero-argument method invocation on host objects (#15151) 4965 var ret; 4966 4967 if ( typeof context.getElementsByTagName !== "undefined" ) { 4968 ret = context.getElementsByTagName( tag || "*" ); 4969 4970 } else if ( typeof context.querySelectorAll !== "undefined" ) { 4971 ret = context.querySelectorAll( tag || "*" ); 4972 4973 } else { 4974 ret = []; 4975 } 4976 4977 if ( tag === undefined || tag && nodeName( context, tag ) ) { 4978 return jQuery.merge( [ context ], ret ); 4979 } 4980 4981 return ret; 4982} 4983 4984 4985// Mark scripts as having already been evaluated 4986function setGlobalEval( elems, refElements ) { 4987 var i = 0, 4988 l = elems.length; 4989 4990 for ( ; i < l; i++ ) { 4991 dataPriv.set( 4992 elems[ i ], 4993 "globalEval", 4994 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 4995 ); 4996 } 4997} 4998 4999 5000var rhtml = /<|&#?\w+;/; 5001 5002function buildFragment( elems, context, scripts, selection, ignored ) { 5003 var elem, tmp, tag, wrap, attached, j, 5004 fragment = context.createDocumentFragment(), 5005 nodes = [], 5006 i = 0, 5007 l = elems.length; 5008 5009 for ( ; i < l; i++ ) { 5010 elem = elems[ i ]; 5011 5012 if ( elem || elem === 0 ) { 5013 5014 // Add nodes directly 5015 if ( toType( elem ) === "object" ) { 5016 5017 // Support: Android <=4.0 only, PhantomJS 1 only 5018 // push.apply(_, arraylike) throws on ancient WebKit 5019 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 5020 5021 // Convert non-html into a text node 5022 } else if ( !rhtml.test( elem ) ) { 5023 nodes.push( context.createTextNode( elem ) ); 5024 5025 // Convert html into DOM nodes 5026 } else { 5027 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 5028 5029 // Deserialize a standard representation 5030 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 5031 wrap = wrapMap[ tag ] || wrapMap._default; 5032 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 5033 5034 // Descend through wrappers to the right content 5035 j = wrap[ 0 ]; 5036 while ( j-- ) { 5037 tmp = tmp.lastChild; 5038 } 5039 5040 // Support: Android <=4.0 only, PhantomJS 1 only 5041 // push.apply(_, arraylike) throws on ancient WebKit 5042 jQuery.merge( nodes, tmp.childNodes ); 5043 5044 // Remember the top-level container 5045 tmp = fragment.firstChild; 5046 5047 // Ensure the created nodes are orphaned (#12392) 5048 tmp.textContent = ""; 5049 } 5050 } 5051 } 5052 5053 // Remove wrapper from fragment 5054 fragment.textContent = ""; 5055 5056 i = 0; 5057 while ( ( elem = nodes[ i++ ] ) ) { 5058 5059 // Skip elements already in the context collection (trac-4087) 5060 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 5061 if ( ignored ) { 5062 ignored.push( elem ); 5063 } 5064 continue; 5065 } 5066 5067 attached = isAttached( elem ); 5068 5069 // Append to fragment 5070 tmp = getAll( fragment.appendChild( elem ), "script" ); 5071 5072 // Preserve script evaluation history 5073 if ( attached ) { 5074 setGlobalEval( tmp ); 5075 } 5076 5077 // Capture executables 5078 if ( scripts ) { 5079 j = 0; 5080 while ( ( elem = tmp[ j++ ] ) ) { 5081 if ( rscriptType.test( elem.type || "" ) ) { 5082 scripts.push( elem ); 5083 } 5084 } 5085 } 5086 } 5087 5088 return fragment; 5089} 5090 5091 5092var 5093 rkeyEvent = /^key/, 5094 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, 5095 rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 5096 5097function returnTrue() { 5098 return true; 5099} 5100 5101function returnFalse() { 5102 return false; 5103} 5104 5105// Support: IE <=9 - 11+ 5106// focus() and blur() are asynchronous, except when they are no-op. 5107// So expect focus to be synchronous when the element is already active, 5108// and blur to be synchronous when the element is not already active. 5109// (focus and blur are always synchronous in other supported browsers, 5110// this just defines when we can count on it). 5111function expectSync( elem, type ) { 5112 return ( elem === safeActiveElement() ) === ( type === "focus" ); 5113} 5114 5115// Support: IE <=9 only 5116// Accessing document.activeElement can throw unexpectedly 5117// https://bugs.jquery.com/ticket/13393 5118function safeActiveElement() { 5119 try { 5120 return document.activeElement; 5121 } catch ( err ) { } 5122} 5123 5124function on( elem, types, selector, data, fn, one ) { 5125 var origFn, type; 5126 5127 // Types can be a map of types/handlers 5128 if ( typeof types === "object" ) { 5129 5130 // ( types-Object, selector, data ) 5131 if ( typeof selector !== "string" ) { 5132 5133 // ( types-Object, data ) 5134 data = data || selector; 5135 selector = undefined; 5136 } 5137 for ( type in types ) { 5138 on( elem, type, selector, data, types[ type ], one ); 5139 } 5140 return elem; 5141 } 5142 5143 if ( data == null && fn == null ) { 5144 5145 // ( types, fn ) 5146 fn = selector; 5147 data = selector = undefined; 5148 } else if ( fn == null ) { 5149 if ( typeof selector === "string" ) { 5150 5151 // ( types, selector, fn ) 5152 fn = data; 5153 data = undefined; 5154 } else { 5155 5156 // ( types, data, fn ) 5157 fn = data; 5158 data = selector; 5159 selector = undefined; 5160 } 5161 } 5162 if ( fn === false ) { 5163 fn = returnFalse; 5164 } else if ( !fn ) { 5165 return elem; 5166 } 5167 5168 if ( one === 1 ) { 5169 origFn = fn; 5170 fn = function( event ) { 5171 5172 // Can use an empty set, since event contains the info 5173 jQuery().off( event ); 5174 return origFn.apply( this, arguments ); 5175 }; 5176 5177 // Use same guid so caller can remove using origFn 5178 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 5179 } 5180 return elem.each( function() { 5181 jQuery.event.add( this, types, fn, data, selector ); 5182 } ); 5183} 5184 5185/* 5186 * Helper functions for managing events -- not part of the public interface. 5187 * Props to Dean Edwards' addEvent library for many of the ideas. 5188 */ 5189jQuery.event = { 5190 5191 global: {}, 5192 5193 add: function( elem, types, handler, data, selector ) { 5194 5195 var handleObjIn, eventHandle, tmp, 5196 events, t, handleObj, 5197 special, handlers, type, namespaces, origType, 5198 elemData = dataPriv.get( elem ); 5199 5200 // Only attach events to objects that accept data 5201 if ( !acceptData( elem ) ) { 5202 return; 5203 } 5204 5205 // Caller can pass in an object of custom data in lieu of the handler 5206 if ( handler.handler ) { 5207 handleObjIn = handler; 5208 handler = handleObjIn.handler; 5209 selector = handleObjIn.selector; 5210 } 5211 5212 // Ensure that invalid selectors throw exceptions at attach time 5213 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 5214 if ( selector ) { 5215 jQuery.find.matchesSelector( documentElement, selector ); 5216 } 5217 5218 // Make sure that the handler has a unique ID, used to find/remove it later 5219 if ( !handler.guid ) { 5220 handler.guid = jQuery.guid++; 5221 } 5222 5223 // Init the element's event structure and main handler, if this is the first 5224 if ( !( events = elemData.events ) ) { 5225 events = elemData.events = Object.create( null ); 5226 } 5227 if ( !( eventHandle = elemData.handle ) ) { 5228 eventHandle = elemData.handle = function( e ) { 5229 5230 // Discard the second event of a jQuery.event.trigger() and 5231 // when an event is called after a page has unloaded 5232 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 5233 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 5234 }; 5235 } 5236 5237 // Handle multiple events separated by a space 5238 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 5239 t = types.length; 5240 while ( t-- ) { 5241 tmp = rtypenamespace.exec( types[ t ] ) || []; 5242 type = origType = tmp[ 1 ]; 5243 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5244 5245 // There *must* be a type, no attaching namespace-only handlers 5246 if ( !type ) { 5247 continue; 5248 } 5249 5250 // If event changes its type, use the special event handlers for the changed type 5251 special = jQuery.event.special[ type ] || {}; 5252 5253 // If selector defined, determine special event api type, otherwise given type 5254 type = ( selector ? special.delegateType : special.bindType ) || type; 5255 5256 // Update special based on newly reset type 5257 special = jQuery.event.special[ type ] || {}; 5258 5259 // handleObj is passed to all event handlers 5260 handleObj = jQuery.extend( { 5261 type: type, 5262 origType: origType, 5263 data: data, 5264 handler: handler, 5265 guid: handler.guid, 5266 selector: selector, 5267 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 5268 namespace: namespaces.join( "." ) 5269 }, handleObjIn ); 5270 5271 // Init the event handler queue if we're the first 5272 if ( !( handlers = events[ type ] ) ) { 5273 handlers = events[ type ] = []; 5274 handlers.delegateCount = 0; 5275 5276 // Only use addEventListener if the special events handler returns false 5277 if ( !special.setup || 5278 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 5279 5280 if ( elem.addEventListener ) { 5281 elem.addEventListener( type, eventHandle ); 5282 } 5283 } 5284 } 5285 5286 if ( special.add ) { 5287 special.add.call( elem, handleObj ); 5288 5289 if ( !handleObj.handler.guid ) { 5290 handleObj.handler.guid = handler.guid; 5291 } 5292 } 5293 5294 // Add to the element's handler list, delegates in front 5295 if ( selector ) { 5296 handlers.splice( handlers.delegateCount++, 0, handleObj ); 5297 } else { 5298 handlers.push( handleObj ); 5299 } 5300 5301 // Keep track of which events have ever been used, for event optimization 5302 jQuery.event.global[ type ] = true; 5303 } 5304 5305 }, 5306 5307 // Detach an event or set of events from an element 5308 remove: function( elem, types, handler, selector, mappedTypes ) { 5309 5310 var j, origCount, tmp, 5311 events, t, handleObj, 5312 special, handlers, type, namespaces, origType, 5313 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 5314 5315 if ( !elemData || !( events = elemData.events ) ) { 5316 return; 5317 } 5318
vendor: 4,199 bytes, lines 5319-5457
5319 // Once for each type.namespace in types; type may be omitted 5320 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 5321 t = types.length; 5322 while ( t-- ) { 5323 tmp = rtypenamespace.exec( types[ t ] ) || []; 5324 type = origType = tmp[ 1 ]; 5325 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5326 5327 // Unbind all events (on this namespace, if provided) for the element 5328 if ( !type ) { 5329 for ( type in events ) { 5330 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 5331 } 5332 continue; 5333 } 5334 5335 special = jQuery.event.special[ type ] || {}; 5336 type = ( selector ? special.delegateType : special.bindType ) || type; 5337 handlers = events[ type ] || []; 5338 tmp = tmp[ 2 ] && 5339 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 5340 5341 // Remove matching events 5342 origCount = j = handlers.length; 5343 while ( j-- ) { 5344 handleObj = handlers[ j ]; 5345 5346 if ( ( mappedTypes || origType === handleObj.origType ) && 5347 ( !handler || handler.guid === handleObj.guid ) && 5348 ( !tmp || tmp.test( handleObj.namespace ) ) && 5349 ( !selector || selector === handleObj.selector || 5350 selector === "**" && handleObj.selector ) ) { 5351 handlers.splice( j, 1 ); 5352 5353 if ( handleObj.selector ) { 5354 handlers.delegateCount--; 5355 } 5356 if ( special.remove ) { 5357 special.remove.call( elem, handleObj ); 5358 } 5359 } 5360 } 5361 5362 // Remove generic event handler if we removed something and no more handlers exist 5363 // (avoids potential for endless recursion during removal of special event handlers) 5364 if ( origCount && !handlers.length ) { 5365 if ( !special.teardown || 5366 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 5367 5368 jQuery.removeEvent( elem, type, elemData.handle ); 5369 } 5370 5371 delete events[ type ]; 5372 } 5373 } 5374 5375 // Remove data and the expando if it's no longer used 5376 if ( jQuery.isEmptyObject( events ) ) { 5377 dataPriv.remove( elem, "handle events" ); 5378 } 5379 }, 5380 5381 dispatch: function( nativeEvent ) { 5382 5383 var i, j, ret, matched, handleObj, handlerQueue, 5384 args = new Array( arguments.length ), 5385 5386 // Make a writable jQuery.Event from the native event object 5387 event = jQuery.event.fix( nativeEvent ), 5388 5389 handlers = ( 5390 dataPriv.get( this, "events" ) || Object.create( null ) 5391 )[ event.type ] || [], 5392 special = jQuery.event.special[ event.type ] || {}; 5393 5394 // Use the fix-ed jQuery.Event rather than the (read-only) native event 5395 args[ 0 ] = event; 5396 5397 for ( i = 1; i < arguments.length; i++ ) { 5398 args[ i ] = arguments[ i ]; 5399 } 5400 5401 event.delegateTarget = this; 5402 5403 // Call the preDispatch hook for the mapped type, and let it bail if desired 5404 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 5405 return; 5406 } 5407 5408 // Determine handlers 5409 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 5410 5411 // Run delegates first; they may want to stop propagation beneath us 5412 i = 0; 5413 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 5414 event.currentTarget = matched.elem; 5415 5416 j = 0; 5417 while ( ( handleObj = matched.handlers[ j++ ] ) && 5418 !event.isImmediatePropagationStopped() ) { 5419 5420 // If the event is namespaced, then each handler is only invoked if it is 5421 // specially universal or its namespaces are a superset of the event's. 5422 if ( !event.rnamespace || handleObj.namespace === false || 5423 event.rnamespace.test( handleObj.namespace ) ) { 5424 5425 event.handleObj = handleObj; 5426 event.data = handleObj.data; 5427 5428 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 5429 handleObj.handler ).apply( matched.elem, args ); 5430 5431 if ( ret !== undefined ) { 5432 if ( ( event.result = ret ) === false ) { 5433 event.preventDefault(); 5434 event.stopPropagation(); 5435 } 5436 } 5437 } 5438 } 5439 } 5440 5441 // Call the postDispatch hook for the mapped type 5442 if ( special.postDispatch ) { 5443 special.postDispatch.call( this, event ); 5444 } 5445 5446 return event.result; 5447 }, 5448 5449 handlers: function( event, handlers ) { 5450 var i, handleObj, sel, matchedHandlers, matchedSelectors, 5451 handlerQueue = [], 5452 delegateCount = handlers.delegateCount, 5453 cur = event.target; 5454 5455 // Find delegate handlers 5456 if ( delegateCount && 5457
vendor: 5,718 bytes, lines 5458-5643
5458 // Support: IE <=9 5459 // Black-hole SVG <use> instance trees (trac-13180) 5460 cur.nodeType && 5461 5462 // Support: Firefox <=42 5463 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 5464 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 5465 // Support: IE 11 only 5466 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 5467 !( event.type === "click" && event.button >= 1 ) ) { 5468 5469 for ( ; cur !== this; cur = cur.parentNode || this ) { 5470 5471 // Don't check non-elements (#13208) 5472 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) 5473 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 5474 matchedHandlers = []; 5475 matchedSelectors = {}; 5476 for ( i = 0; i < delegateCount; i++ ) { 5477 handleObj = handlers[ i ]; 5478 5479 // Don't conflict with Object.prototype properties (#13203) 5480 sel = handleObj.selector + " "; 5481 5482 if ( matchedSelectors[ sel ] === undefined ) { 5483 matchedSelectors[ sel ] = handleObj.needsContext ? 5484 jQuery( sel, this ).index( cur ) > -1 : 5485 jQuery.find( sel, this, null, [ cur ] ).length; 5486 } 5487 if ( matchedSelectors[ sel ] ) { 5488 matchedHandlers.push( handleObj ); 5489 } 5490 } 5491 if ( matchedHandlers.length ) { 5492 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 5493 } 5494 } 5495 } 5496 } 5497 5498 // Add the remaining (directly-bound) handlers 5499 cur = this; 5500 if ( delegateCount < handlers.length ) { 5501 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 5502 } 5503 5504 return handlerQueue; 5505 }, 5506 5507 addProp: function( name, hook ) { 5508 Object.defineProperty( jQuery.Event.prototype, name, { 5509 enumerable: true, 5510 configurable: true, 5511 5512 get: isFunction( hook ) ? 5513 function() { 5514 if ( this.originalEvent ) { 5515 return hook( this.originalEvent ); 5516 } 5517 } : 5518 function() { 5519 if ( this.originalEvent ) { 5520 return this.originalEvent[ name ]; 5521 } 5522 }, 5523 5524 set: function( value ) { 5525 Object.defineProperty( this, name, { 5526 enumerable: true, 5527 configurable: true, 5528 writable: true, 5529 value: value 5530 } ); 5531 } 5532 } ); 5533 }, 5534 5535 fix: function( originalEvent ) { 5536 return originalEvent[ jQuery.expando ] ? 5537 originalEvent : 5538 new jQuery.Event( originalEvent ); 5539 }, 5540 5541 special: { 5542 load: { 5543 5544 // Prevent triggered image.load events from bubbling to window.load 5545 noBubble: true 5546 }, 5547 click: { 5548 5549 // Utilize native event to ensure correct state for checkable inputs 5550 setup: function( data ) { 5551 5552 // For mutual compressibility with _default, replace `this` access with a local var. 5553 // `|| data` is dead code meant only to preserve the variable through minification. 5554 var el = this || data; 5555 5556 // Claim the first handler 5557 if ( rcheckableType.test( el.type ) && 5558 el.click && nodeName( el, "input" ) ) { 5559 5560 // dataPriv.set( el, "click", ... ) 5561 leverageNative( el, "click", returnTrue ); 5562 } 5563 5564 // Return false to allow normal processing in the caller 5565 return false; 5566 }, 5567 trigger: function( data ) { 5568 5569 // For mutual compressibility with _default, replace `this` access with a local var. 5570 // `|| data` is dead code meant only to preserve the variable through minification. 5571 var el = this || data; 5572 5573 // Force setup before triggering a click 5574 if ( rcheckableType.test( el.type ) && 5575 el.click && nodeName( el, "input" ) ) { 5576 5577 leverageNative( el, "click" ); 5578 } 5579 5580 // Return non-false to allow normal event-path propagation 5581 return true; 5582 }, 5583 5584 // For cross-browser consistency, suppress native .click() on links 5585 // Also prevent it if we're currently inside a leveraged native-event stack 5586 _default: function( event ) { 5587 var target = event.target; 5588 return rcheckableType.test( target.type ) && 5589 target.click && nodeName( target, "input" ) && 5590 dataPriv.get( target, "click" ) || 5591 nodeName( target, "a" ); 5592 } 5593 }, 5594 5595 beforeunload: { 5596 postDispatch: function( event ) { 5597 5598 // Support: Firefox 20+ 5599 // Firefox doesn't alert if the returnValue field is not set. 5600 if ( event.result !== undefined && event.originalEvent ) { 5601 event.originalEvent.returnValue = event.result; 5602 } 5603 } 5604 } 5605 } 5606}; 5607 5608// Ensure the presence of an event listener that handles manually-triggered 5609// synthetic events by interrupting progress until reinvoked in response to 5610// *native* events that it fires directly, ensuring that state changes have 5611// already occurred before other listeners are invoked. 5612function leverageNative( el, type, expectSync ) { 5613 5614 // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add 5615 if ( !expectSync ) { 5616 if ( dataPriv.get( el, type ) === undefined ) { 5617 jQuery.event.add( el, type, returnTrue ); 5618 } 5619 return; 5620 } 5621 5622 // Register the controller as a special universal handler for all event namespaces 5623 dataPriv.set( el, type, false ); 5624 jQuery.event.add( el, type, { 5625 namespace: false, 5626 handler: function( event ) { 5627 var notAsync, result, 5628 saved = dataPriv.get( this, type ); 5629 5630 if ( ( event.isTrigger & 1 ) && this[ type ] ) { 5631 5632 // Interrupt processing of the outer synthetic .trigger()ed event 5633 // Saved data should be false in such cases, but might be a leftover capture object 5634 // from an async native handler (gh-4350) 5635 if ( !saved.length ) { 5636 5637 // Store arguments for use when handling the inner native event 5638 // There will always be at least one argument (an event object), so this array 5639 // will not be confused with a leftover capture object. 5640 saved = slice.call( arguments ); 5641 dataPriv.set( this, type, saved ); 5642 5643 // Trigger the native event and capture its result
5644 // Support: IE <=9 - 11+ 5645 // focus() and blur() are asynchronous 5646 notAsync = expectSync( this, type ); 5647 this[ type ](); 5648 result = dataPriv.get( this, type ); 5649 if ( saved !== result || notAsync ) { 5650 dataPriv.set( this, type, false ); 5651 } else { 5652 result = {}; 5653 } 5654 if ( saved !== result ) { 5655 5656 // Cancel the outer synthetic event 5657 event.stopImmediatePropagation(); 5658 event.preventDefault(); 5659 return result.value; 5660 } 5661 5662 // If this is an inner synthetic event for an event with a bubbling surrogate 5663 // (focus or blur), assume that the surrogate already propagated from triggering the 5664 // native event and prevent that from happening again here. 5665 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 5666 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 5667 // less bad than duplication. 5668 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { 5669 event.stopPropagation(); 5670 } 5671 5672 // If this is a native event triggered above, everything is now in order 5673 // Fire an inner synthetic event with the original arguments 5674 } else if ( saved.length ) { 5675 5676 // ...and capture the result 5677 dataPriv.set( this, type, { 5678 value: jQuery.event.trigger( 5679 5680 // Support: IE <=9 - 11+ 5681 // Extend with the prototype to reset the above stopImmediatePropagation() 5682 jQuery.extend( saved[ 0 ], jQuery.Event.prototype ), 5683 saved.slice( 1 ), 5684 this 5685 ) 5686 } ); 5687 5688 // Abort handling of the native event 5689 event.stopImmediatePropagation(); 5690 } 5691 } 5692 } ); 5693} 5694 5695jQuery.removeEvent = function( elem, type, handle ) { 5696 5697 // This "if" is needed for plain objects 5698 if ( elem.removeEventListener ) { 5699 elem.removeEventListener( type, handle ); 5700 } 5701}; 5702 5703jQuery.Event = function( src, props ) { 5704 5705 // Allow instantiation without the 'new' keyword 5706 if ( !( this instanceof jQuery.Event ) ) { 5707 return new jQuery.Event( src, props ); 5708 } 5709 5710 // Event object 5711 if ( src && src.type ) { 5712 this.originalEvent = src; 5713 this.type = src.type; 5714 5715 // Events bubbling up the document may have been marked as prevented 5716 // by a handler lower down the tree; reflect the correct value. 5717 this.isDefaultPrevented = src.defaultPrevented || 5718 src.defaultPrevented === undefined && 5719 5720 // Support: Android <=2.3 only 5721 src.returnValue === false ? 5722 returnTrue : 5723 returnFalse; 5724 5725 // Create target properties 5726 // Support: Safari <=6 - 7 only 5727 // Target should not be a text node (#504, #13143) 5728 this.target = ( src.target && src.target.nodeType === 3 ) ? 5729 src.target.parentNode : 5730 src.target; 5731 5732 this.currentTarget = src.currentTarget; 5733 this.relatedTarget = src.relatedTarget; 5734 5735 // Event type 5736 } else { 5737 this.type = src; 5738 } 5739 5740 // Put explicitly provided properties onto the event object 5741 if ( props ) { 5742 jQuery.extend( this, props ); 5743 } 5744 5745 // Create a timestamp if incoming event doesn't have one 5746 this.timeStamp = src && src.timeStamp || Date.now(); 5747 5748 // Mark it as fixed 5749 this[ jQuery.expando ] = true; 5750}; 5751 5752// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 5753// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 5754jQuery.Event.prototype = { 5755 constructor: jQuery.Event, 5756 isDefaultPrevented: returnFalse, 5757 isPropagationStopped: returnFalse, 5758 isImmediatePropagationStopped: returnFalse, 5759 isSimulated: false, 5760 5761 preventDefault: function() { 5762 var e = this.originalEvent; 5763 5764 this.isDefaultPrevented = returnTrue; 5765 5766 if ( e && !this.isSimulated ) { 5767 e.preventDefault(); 5768 } 5769 }, 5770 stopPropagation: function() { 5771 var e = this.originalEvent; 5772 5773 this.isPropagationStopped = returnTrue; 5774 5775 if ( e && !this.isSimulated ) { 5776 e.stopPropagation(); 5777 } 5778 }, 5779 stopImmediatePropagation: function() { 5780 var e = this.originalEvent; 5781 5782 this.isImmediatePropagationStopped = returnTrue; 5783 5784 if ( e && !this.isSimulated ) { 5785 e.stopImmediatePropagation(); 5786 } 5787 5788 this.stopPropagation(); 5789 } 5790}; 5791 5792// Includes all common event props including KeyEvent and MouseEvent specific props 5793jQuery.each( { 5794 altKey: true, 5795 bubbles: true, 5796 cancelable: true, 5797 changedTouches: true, 5798 ctrlKey: true, 5799 detail: true, 5800 eventPhase: true, 5801 metaKey: true, 5802 pageX: true, 5803 pageY: true, 5804 shiftKey: true, 5805 view: true, 5806 "char": true, 5807 code: true, 5808 charCode: true, 5809 key: true, 5810 keyCode: true, 5811 button: true, 5812 buttons: true, 5813 clientX: true, 5814 clientY: true, 5815 offsetX: true, 5816 offsetY: true, 5817 pointerId: true, 5818 pointerType: true, 5819 screenX: true, 5820 screenY: true, 5821 targetTouches: true, 5822 toElement: true, 5823 touches: true, 5824 5825 which: function( event ) { 5826 var button = event.button; 5827 5828 // Add which for key events 5829 if ( event.which == null && rkeyEvent.test( event.type ) ) { 5830 return event.charCode != null ? event.charCode : event.keyCode; 5831 } 5832 5833 // Add which for click: 1 === left; 2 === middle; 3 === right 5834 if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { 5835 if ( button & 1 ) { 5836 return 1; 5837 } 5838 5839 if ( button & 2 ) { 5840 return 3; 5841 } 5842 5843 if ( button & 4 ) { 5844 return 2; 5845 } 5846 5847 return 0; 5848 } 5849 5850 return event.which; 5851 } 5852}, jQuery.event.addProp ); 5853 5854jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { 5855 jQuery.event.special[ type ] = { 5856 5857 // Utilize native event if possible so blur/focus sequence is correct 5858 setup: function() { 5859 5860 // Claim the first handler 5861 // dataPriv.set( this, "focus", ... ) 5862 // dataPriv.set( this, "blur", ... ) 5863 leverageNative( this, type, expectSync ); 5864 5865 // Return false to allow normal processing in the caller 5866 return false;
vendor: 8,224 bytes, lines 5867-6174
5867 }, 5868 trigger: function() { 5869 5870 // Force setup before trigger 5871 leverageNative( this, type ); 5872 5873 // Return non-false to allow normal event-path propagation 5874 return true; 5875 }, 5876 5877 delegateType: delegateType 5878 }; 5879} ); 5880 5881// Create mouseenter/leave events using mouseover/out and event-time checks 5882// so that event delegation works in jQuery. 5883// Do the same for pointerenter/pointerleave and pointerover/pointerout 5884// 5885// Support: Safari 7 only 5886// Safari sends mouseenter too often; see: 5887// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 5888// for the description of the bug (it existed in older Chrome versions as well). 5889jQuery.each( { 5890 mouseenter: "mouseover", 5891 mouseleave: "mouseout", 5892 pointerenter: "pointerover", 5893 pointerleave: "pointerout" 5894}, function( orig, fix ) { 5895 jQuery.event.special[ orig ] = { 5896 delegateType: fix, 5897 bindType: fix, 5898 5899 handle: function( event ) { 5900 var ret, 5901 target = this, 5902 related = event.relatedTarget, 5903 handleObj = event.handleObj; 5904 5905 // For mouseenter/leave call the handler if related is outside the target. 5906 // NB: No relatedTarget if the mouse left/entered the browser window 5907 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 5908 event.type = handleObj.origType; 5909 ret = handleObj.handler.apply( this, arguments ); 5910 event.type = fix; 5911 } 5912 return ret; 5913 } 5914 }; 5915} ); 5916 5917jQuery.fn.extend( { 5918 5919 on: function( types, selector, data, fn ) { 5920 return on( this, types, selector, data, fn ); 5921 }, 5922 one: function( types, selector, data, fn ) { 5923 return on( this, types, selector, data, fn, 1 ); 5924 }, 5925 off: function( types, selector, fn ) { 5926 var handleObj, type; 5927 if ( types && types.preventDefault && types.handleObj ) { 5928 5929 // ( event ) dispatched jQuery.Event 5930 handleObj = types.handleObj; 5931 jQuery( types.delegateTarget ).off( 5932 handleObj.namespace ? 5933 handleObj.origType + "." + handleObj.namespace : 5934 handleObj.origType, 5935 handleObj.selector, 5936 handleObj.handler 5937 ); 5938 return this; 5939 } 5940 if ( typeof types === "object" ) { 5941 5942 // ( types-object [, selector] ) 5943 for ( type in types ) { 5944 this.off( type, selector, types[ type ] ); 5945 } 5946 return this; 5947 } 5948 if ( selector === false || typeof selector === "function" ) { 5949 5950 // ( types [, fn] ) 5951 fn = selector; 5952 selector = undefined; 5953 } 5954 if ( fn === false ) { 5955 fn = returnFalse; 5956 } 5957 return this.each( function() { 5958 jQuery.event.remove( this, types, fn, selector ); 5959 } ); 5960 } 5961} ); 5962 5963 5964var 5965 5966 // Support: IE <=10 - 11, Edge 12 - 13 only 5967 // In IE/Edge using regex groups here causes severe slowdowns. 5968 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 5969 rnoInnerhtml = /<script|<style|<link/i, 5970 5971 // checked="checked" or checked 5972 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 5973 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; 5974 5975// Prefer a tbody over its parent table for containing new rows 5976function manipulationTarget( elem, content ) { 5977 if ( nodeName( elem, "table" ) && 5978 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 5979 5980 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 5981 } 5982 5983 return elem; 5984} 5985 5986// Replace/restore the type attribute of script elements for safe DOM manipulation 5987function disableScript( elem ) { 5988 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 5989 return elem; 5990} 5991function restoreScript( elem ) { 5992 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 5993 elem.type = elem.type.slice( 5 ); 5994 } else { 5995 elem.removeAttribute( "type" ); 5996 } 5997 5998 return elem; 5999} 6000 6001function cloneCopyEvent( src, dest ) { 6002 var i, l, type, pdataOld, udataOld, udataCur, events; 6003 6004 if ( dest.nodeType !== 1 ) { 6005 return; 6006 } 6007 6008 // 1. Copy private data: events, handlers, etc. 6009 if ( dataPriv.hasData( src ) ) { 6010 pdataOld = dataPriv.get( src ); 6011 events = pdataOld.events; 6012 6013 if ( events ) { 6014 dataPriv.remove( dest, "handle events" ); 6015 6016 for ( type in events ) { 6017 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 6018 jQuery.event.add( dest, type, events[ type ][ i ] ); 6019 } 6020 } 6021 } 6022 } 6023 6024 // 2. Copy user data 6025 if ( dataUser.hasData( src ) ) { 6026 udataOld = dataUser.access( src ); 6027 udataCur = jQuery.extend( {}, udataOld ); 6028 6029 dataUser.set( dest, udataCur ); 6030 } 6031} 6032 6033// Fix IE bugs, see support tests 6034function fixInput( src, dest ) { 6035 var nodeName = dest.nodeName.toLowerCase(); 6036 6037 // Fails to persist the checked state of a cloned checkbox or radio button. 6038 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 6039 dest.checked = src.checked; 6040 6041 // Fails to return the selected option to the default selected state when cloning options 6042 } else if ( nodeName === "input" || nodeName === "textarea" ) { 6043 dest.defaultValue = src.defaultValue; 6044 } 6045} 6046 6047function domManip( collection, args, callback, ignored ) { 6048 6049 // Flatten any nested arrays 6050 args = flat( args ); 6051 6052 var fragment, first, scripts, hasScripts, node, doc, 6053 i = 0, 6054 l = collection.length, 6055 iNoClone = l - 1, 6056 value = args[ 0 ], 6057 valueIsFunction = isFunction( value ); 6058 6059 // We can't cloneNode fragments that contain checked, in WebKit 6060 if ( valueIsFunction || 6061 ( l > 1 && typeof value === "string" && 6062 !support.checkClone && rchecked.test( value ) ) ) { 6063 return collection.each( function( index ) { 6064 var self = collection.eq( index ); 6065 if ( valueIsFunction ) { 6066 args[ 0 ] = value.call( this, index, self.html() ); 6067 } 6068 domManip( self, args, callback, ignored ); 6069 } ); 6070 } 6071 6072 if ( l ) { 6073 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 6074 first = fragment.firstChild; 6075 6076 if ( fragment.childNodes.length === 1 ) { 6077 fragment = first; 6078 } 6079 6080 // Require either new content or an interest in ignored elements to invoke the callback 6081 if ( first || ignored ) { 6082 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 6083 hasScripts = scripts.length; 6084 6085 // Use the original fragment for the last item 6086 // instead of the first because it can end up 6087 // being emptied incorrectly in certain situations (#8070). 6088 for ( ; i < l; i++ ) { 6089 node = fragment; 6090 6091 if ( i !== iNoClone ) { 6092 node = jQuery.clone( node, true, true ); 6093 6094 // Keep references to cloned scripts for later restoration 6095 if ( hasScripts ) { 6096 6097 // Support: Android <=4.0 only, PhantomJS 1 only 6098 // push.apply(_, arraylike) throws on ancient WebKit 6099 jQuery.merge( scripts, getAll( node, "script" ) ); 6100 } 6101 } 6102 6103 callback.call( collection[ i ], node, i ); 6104 } 6105 6106 if ( hasScripts ) { 6107 doc = scripts[ scripts.length - 1 ].ownerDocument; 6108 6109 // Reenable scripts 6110 jQuery.map( scripts, restoreScript ); 6111 6112 // Evaluate executable scripts on first document insertion 6113 for ( i = 0; i < hasScripts; i++ ) { 6114 node = scripts[ i ]; 6115 if ( rscriptType.test( node.type || "" ) && 6116 !dataPriv.access( node, "globalEval" ) && 6117 jQuery.contains( doc, node ) ) { 6118 6119 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 6120 6121 // Optional AJAX dependency, but won't run scripts if not present 6122 if ( jQuery._evalUrl && !node.noModule ) { 6123 jQuery._evalUrl( node.src, { 6124 nonce: node.nonce || node.getAttribute( "nonce" ) 6125 }, doc ); 6126 } 6127 } else { 6128 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); 6129 } 6130 } 6131 } 6132 } 6133 } 6134 } 6135 6136 return collection; 6137} 6138 6139function remove( elem, selector, keepData ) { 6140 var node, 6141 nodes = selector ? jQuery.filter( selector, elem ) : elem, 6142 i = 0; 6143 6144 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 6145 if ( !keepData && node.nodeType === 1 ) { 6146 jQuery.cleanData( getAll( node ) ); 6147 } 6148 6149 if ( node.parentNode ) { 6150 if ( keepData && isAttached( node ) ) { 6151 setGlobalEval( getAll( node, "script" ) ); 6152 } 6153 node.parentNode.removeChild( node ); 6154 } 6155 } 6156 6157 return elem; 6158} 6159 6160jQuery.extend( { 6161 htmlPrefilter: function( html ) { 6162 return html; 6163 }, 6164 6165 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 6166 var i, l, srcElements, destElements, 6167 clone = elem.cloneNode( true ), 6168 inPage = isAttached( elem ); 6169 6170 // Fix IE cloning issues 6171 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 6172 !jQuery.isXMLDoc( elem ) ) { 6173 6174 // We eschew Sizzle here for performance reasons:
vendor: 5,848 bytes, lines 6174-6410
6174 https://jsperf.com/getall-vs-sizzle/2 6175 destElements = getAll( clone ); 6176 srcElements = getAll( elem ); 6177 6178 for ( i = 0, l = srcElements.length; i < l; i++ ) { 6179 fixInput( srcElements[ i ], destElements[ i ] ); 6180 } 6181 } 6182 6183 // Copy the events from the original to the clone 6184 if ( dataAndEvents ) { 6185 if ( deepDataAndEvents ) { 6186 srcElements = srcElements || getAll( elem ); 6187 destElements = destElements || getAll( clone ); 6188 6189 for ( i = 0, l = srcElements.length; i < l; i++ ) { 6190 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 6191 } 6192 } else { 6193 cloneCopyEvent( elem, clone ); 6194 } 6195 } 6196 6197 // Preserve script evaluation history 6198 destElements = getAll( clone, "script" ); 6199 if ( destElements.length > 0 ) { 6200 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 6201 } 6202 6203 // Return the cloned set 6204 return clone; 6205 }, 6206 6207 cleanData: function( elems ) { 6208 var data, elem, type, 6209 special = jQuery.event.special, 6210 i = 0; 6211 6212 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 6213 if ( acceptData( elem ) ) { 6214 if ( ( data = elem[ dataPriv.expando ] ) ) { 6215 if ( data.events ) { 6216 for ( type in data.events ) { 6217 if ( special[ type ] ) { 6218 jQuery.event.remove( elem, type ); 6219 6220 // This is a shortcut to avoid jQuery.event.remove's overhead 6221 } else { 6222 jQuery.removeEvent( elem, type, data.handle ); 6223 } 6224 } 6225 } 6226 6227 // Support: Chrome <=35 - 45+ 6228 // Assign undefined instead of using delete, see Data#remove 6229 elem[ dataPriv.expando ] = undefined; 6230 } 6231 if ( elem[ dataUser.expando ] ) { 6232 6233 // Support: Chrome <=35 - 45+ 6234 // Assign undefined instead of using delete, see Data#remove 6235 elem[ dataUser.expando ] = undefined; 6236 } 6237 } 6238 } 6239 } 6240} ); 6241 6242jQuery.fn.extend( { 6243 detach: function( selector ) { 6244 return remove( this, selector, true ); 6245 }, 6246 6247 remove: function( selector ) { 6248 return remove( this, selector ); 6249 }, 6250 6251 text: function( value ) { 6252 return access( this, function( value ) { 6253 return value === undefined ? 6254 jQuery.text( this ) : 6255 this.empty().each( function() { 6256 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6257 this.textContent = value; 6258 } 6259 } ); 6260 }, null, value, arguments.length ); 6261 }, 6262 6263 append: function() { 6264 return domManip( this, arguments, function( elem ) { 6265 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6266 var target = manipulationTarget( this, elem ); 6267 target.appendChild( elem ); 6268 } 6269 } ); 6270 }, 6271 6272 prepend: function() { 6273 return domManip( this, arguments, function( elem ) { 6274 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6275 var target = manipulationTarget( this, elem ); 6276 target.insertBefore( elem, target.firstChild ); 6277 } 6278 } ); 6279 }, 6280 6281 before: function() { 6282 return domManip( this, arguments, function( elem ) { 6283 if ( this.parentNode ) { 6284 this.parentNode.insertBefore( elem, this ); 6285 } 6286 } ); 6287 }, 6288 6289 after: function() { 6290 return domManip( this, arguments, function( elem ) { 6291 if ( this.parentNode ) { 6292 this.parentNode.insertBefore( elem, this.nextSibling ); 6293 } 6294 } ); 6295 }, 6296 6297 empty: function() { 6298 var elem, 6299 i = 0; 6300 6301 for ( ; ( elem = this[ i ] ) != null; i++ ) { 6302 if ( elem.nodeType === 1 ) { 6303 6304 // Prevent memory leaks 6305 jQuery.cleanData( getAll( elem, false ) ); 6306 6307 // Remove any remaining nodes 6308 elem.textContent = ""; 6309 } 6310 } 6311 6312 return this; 6313 }, 6314 6315 clone: function( dataAndEvents, deepDataAndEvents ) { 6316 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 6317 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 6318 6319 return this.map( function() { 6320 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 6321 } ); 6322 }, 6323 6324 html: function( value ) { 6325 return access( this, function( value ) { 6326 var elem = this[ 0 ] || {}, 6327 i = 0, 6328 l = this.length; 6329 6330 if ( value === undefined && elem.nodeType === 1 ) { 6331 return elem.innerHTML; 6332 } 6333 6334 // See if we can take a shortcut and just use innerHTML 6335 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 6336 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 6337 6338 value = jQuery.htmlPrefilter( value ); 6339 6340 try { 6341 for ( ; i < l; i++ ) { 6342 elem = this[ i ] || {}; 6343 6344 // Remove element nodes and prevent memory leaks 6345 if ( elem.nodeType === 1 ) { 6346 jQuery.cleanData( getAll( elem, false ) ); 6347 elem.innerHTML = value; 6348 } 6349 } 6350 6351 elem = 0; 6352 6353 // If using innerHTML throws an exception, use the fallback method 6354 } catch ( e ) {} 6355 } 6356 6357 if ( elem ) { 6358 this.empty().append( value ); 6359 } 6360 }, null, value, arguments.length ); 6361 }, 6362 6363 replaceWith: function() { 6364 var ignored = []; 6365 6366 // Make the changes, replacing each non-ignored context element with the new content 6367 return domManip( this, arguments, function( elem ) { 6368 var parent = this.parentNode; 6369 6370 if ( jQuery.inArray( this, ignored ) < 0 ) { 6371 jQuery.cleanData( getAll( this ) ); 6372 if ( parent ) { 6373 parent.replaceChild( elem, this ); 6374 } 6375 } 6376 6377 // Force callback invocation 6378 }, ignored ); 6379 } 6380} ); 6381 6382jQuery.each( { 6383 appendTo: "append", 6384 prependTo: "prepend", 6385 insertBefore: "before", 6386 insertAfter: "after", 6387 replaceAll: "replaceWith" 6388}, function( name, original ) { 6389 jQuery.fn[ name ] = function( selector ) { 6390 var elems, 6391 ret = [], 6392 insert = jQuery( selector ), 6393 last = insert.length - 1, 6394 i = 0; 6395 6396 for ( ; i <= last; i++ ) { 6397 elems = i === last ? this : this.clone( true ); 6398 jQuery( insert[ i ] )[ original ]( elems ); 6399 6400 // Support: Android <=4.0 only, PhantomJS 1 only 6401 // .get() because push.apply(_, arraylike) throws on ancient WebKit 6402 push.apply( ret, elems.get() ); 6403 } 6404 6405 return this.pushStack( ret ); 6406 }; 6407} ); 6408var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 6409 6410var
vendor: 23,484 bytes, lines 6410-7227
6410getStyles = function( elem ) { 6411 6412 // Support: IE <=11 only, Firefox <=30 (#15098, #14150) 6413 // IE throws on elements created in popups 6414 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 6415 var view = elem.ownerDocument.defaultView; 6416 6417 if ( !view || !view.opener ) { 6418 view = window; 6419 } 6420 6421 return view.getComputedStyle( elem ); 6422 }; 6423 6424var swap = function( elem, options, callback ) { 6425 var ret, name, 6426 old = {}; 6427 6428 // Remember the old values, and insert the new ones 6429 for ( name in options ) { 6430 old[ name ] = elem.style[ name ]; 6431 elem.style[ name ] = options[ name ]; 6432 } 6433 6434 ret = callback.call( elem ); 6435 6436 // Revert the old values 6437 for ( name in options ) { 6438 elem.style[ name ] = old[ name ]; 6439 } 6440 6441 return ret; 6442}; 6443 6444 6445var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 6446 6447 6448 6449( function() { 6450 6451 // Executing both pixelPosition & boxSizingReliable tests require only one layout 6452 // so they're executed at the same time to save the second computation. 6453 function computeStyleTests() { 6454 6455 // This is a singleton, we need to execute it only once 6456 if ( !div ) { 6457 return; 6458 } 6459 6460 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 6461 "margin-top:1px;padding:0;border:0"; 6462 div.style.cssText = 6463 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 6464 "margin:auto;border:1px;padding:1px;" + 6465 "width:60%;top:1%"; 6466 documentElement.appendChild( container ).appendChild( div ); 6467 6468 var divStyle = window.getComputedStyle( div ); 6469 pixelPositionVal = divStyle.top !== "1%"; 6470 6471 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 6472 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 6473 6474 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 6475 // Some styles come back with percentage values, even though they shouldn't 6476 div.style.right = "60%"; 6477 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 6478 6479 // Support: IE 9 - 11 only 6480 // Detect misreporting of content dimensions for box-sizing:border-box elements 6481 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 6482 6483 // Support: IE 9 only 6484 // Detect overflow:scroll screwiness (gh-3699) 6485 // Support: Chrome <=64 6486 // Don't get tricked when zoom affects offsetWidth (gh-4029) 6487 div.style.position = "absolute"; 6488 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; 6489 6490 documentElement.removeChild( container ); 6491 6492 // Nullify the div so it wouldn't be stored in the memory and 6493 // it will also be a sign that checks already performed 6494 div = null; 6495 } 6496 6497 function roundPixelMeasures( measure ) { 6498 return Math.round( parseFloat( measure ) ); 6499 } 6500 6501 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 6502 reliableTrDimensionsVal, reliableMarginLeftVal, 6503 container = document.createElement( "div" ), 6504 div = document.createElement( "div" ); 6505 6506 // Finish early in limited (non-browser) environments 6507 if ( !div.style ) { 6508 return; 6509 } 6510 6511 // Support: IE <=9 - 11 only 6512 // Style of cloned element affects source element cloned (#8908) 6513 div.style.backgroundClip = "content-box"; 6514 div.cloneNode( true ).style.backgroundClip = ""; 6515 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 6516 6517 jQuery.extend( support, { 6518 boxSizingReliable: function() { 6519 computeStyleTests(); 6520 return boxSizingReliableVal; 6521 }, 6522 pixelBoxStyles: function() { 6523 computeStyleTests(); 6524 return pixelBoxStylesVal; 6525 }, 6526 pixelPosition: function() { 6527 computeStyleTests(); 6528 return pixelPositionVal; 6529 }, 6530 reliableMarginLeft: function() { 6531 computeStyleTests(); 6532 return reliableMarginLeftVal; 6533 }, 6534 scrollboxSize: function() { 6535 computeStyleTests(); 6536 return scrollboxSizeVal; 6537 }, 6538 6539 // Support: IE 9 - 11+, Edge 15 - 18+ 6540 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6541 // set in CSS while `offset*` properties report correct values. 6542 // Behavior in IE 9 is more subtle than in newer versions & it passes 6543 // some versions of this test; make sure not to make it pass there! 6544 reliableTrDimensions: function() { 6545 var table, tr, trChild, trStyle; 6546 if ( reliableTrDimensionsVal == null ) { 6547 table = document.createElement( "table" ); 6548 tr = document.createElement( "tr" ); 6549 trChild = document.createElement( "div" ); 6550 6551 table.style.cssText = "position:absolute;left:-11111px"; 6552 tr.style.height = "1px"; 6553 trChild.style.height = "9px"; 6554 6555 documentElement 6556 .appendChild( table ) 6557 .appendChild( tr ) 6558 .appendChild( trChild ); 6559 6560 trStyle = window.getComputedStyle( tr ); 6561 reliableTrDimensionsVal = parseInt( trStyle.height ) > 3; 6562 6563 documentElement.removeChild( table ); 6564 } 6565 return reliableTrDimensionsVal; 6566 } 6567 } ); 6568} )(); 6569 6570 6571function curCSS( elem, name, computed ) { 6572 var width, minWidth, maxWidth, ret, 6573 6574 // Support: Firefox 51+ 6575 // Retrieving style before computed somehow 6576 // fixes an issue with getting wrong values 6577 // on detached elements 6578 style = elem.style; 6579 6580 computed = computed || getStyles( elem ); 6581 6582 // getPropertyValue is needed for: 6583 // .css('filter') (IE 9 only, #12537) 6584 // .css('--customProperty) (#3144) 6585 if ( computed ) { 6586 ret = computed.getPropertyValue( name ) || computed[ name ]; 6587 6588 if ( ret === "" && !isAttached( elem ) ) { 6589 ret = jQuery.style( elem, name ); 6590 } 6591 6592 // A tribute to the "awesome hack by Dean Edwards" 6593 // Android Browser returns percentage for some values, 6594 // but width seems to be reliably pixels. 6595 // This is against the CSSOM draft spec: 6596 // https://drafts.csswg.org/cssom/#resolved-values 6597 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 6598 6599 // Remember the original values 6600 width = style.width; 6601 minWidth = style.minWidth; 6602 maxWidth = style.maxWidth; 6603 6604 // Put in the new values to get a computed value out 6605 style.minWidth = style.maxWidth = style.width = ret; 6606 ret = computed.width; 6607 6608 // Revert the changed values 6609 style.width = width; 6610 style.minWidth = minWidth; 6611 style.maxWidth = maxWidth; 6612 } 6613 } 6614 6615 return ret !== undefined ? 6616 6617 // Support: IE <=9 - 11 only 6618 // IE returns zIndex value as an integer. 6619 ret + "" : 6620 ret; 6621} 6622 6623 6624function addGetHookIf( conditionFn, hookFn ) { 6625 6626 // Define the hook, we'll check on the first run if it's really needed. 6627 return { 6628 get: function() { 6629 if ( conditionFn() ) { 6630 6631 // Hook not needed (or it's not possible to use it due 6632 // to missing dependency), remove it. 6633 delete this.get; 6634 return; 6635 } 6636 6637 // Hook needed; redefine it so that the support test is not executed again. 6638 return ( this.get = hookFn ).apply( this, arguments ); 6639 } 6640 }; 6641} 6642 6643 6644var cssPrefixes = [ "Webkit", "Moz", "ms" ], 6645 emptyStyle = document.createElement( "div" ).style, 6646 vendorProps = {}; 6647 6648// Return a vendor-prefixed property or undefined 6649function vendorPropName( name ) { 6650 6651 // Check for vendor prefixed names 6652 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 6653 i = cssPrefixes.length; 6654 6655 while ( i-- ) { 6656 name = cssPrefixes[ i ] + capName; 6657 if ( name in emptyStyle ) { 6658 return name; 6659 } 6660 } 6661} 6662 6663// Return a potentially-mapped jQuery.cssProps or vendor prefixed property 6664function finalPropName( name ) { 6665 var final = jQuery.cssProps[ name ] || vendorProps[ name ]; 6666 6667 if ( final ) { 6668 return final; 6669 } 6670 if ( name in emptyStyle ) { 6671 return name; 6672 } 6673 return vendorProps[ name ] = vendorPropName( name ) || name; 6674} 6675 6676 6677var 6678 6679 // Swappable if display is none or starts with table 6680 // except "table", "table-cell", or "table-caption" 6681 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 6682 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 6683 rcustomProp = /^--/, 6684 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 6685 cssNormalTransform = { 6686 letterSpacing: "0", 6687 fontWeight: "400" 6688 }; 6689 6690function setPositiveNumber( _elem, value, subtract ) { 6691 6692 // Any relative (+/-) values have already been 6693 // normalized at this point 6694 var matches = rcssNum.exec( value ); 6695 return matches ? 6696 6697 // Guard against undefined "subtract", e.g., when used as in cssHooks 6698 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 6699 value; 6700} 6701 6702function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 6703 var i = dimension === "width" ? 1 : 0, 6704 extra = 0, 6705 delta = 0; 6706 6707 // Adjustment may not be necessary 6708 if ( box === ( isBorderBox ? "border" : "content" ) ) { 6709 return 0; 6710 } 6711 6712 for ( ; i < 4; i += 2 ) { 6713 6714 // Both box models exclude margin 6715 if ( box === "margin" ) { 6716 delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 6717 } 6718 6719 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 6720 if ( !isBorderBox ) { 6721 6722 // Add padding 6723 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6724 6725 // For "border" or "margin", add border 6726 if ( box !== "padding" ) { 6727 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6728 6729 // But still keep track of it otherwise 6730 } else { 6731 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6732 } 6733 6734 // If we get here with a border-box (content + padding + border), we're seeking "content" or 6735 // "padding" or "margin" 6736 } else { 6737 6738 // For "content", subtract padding 6739 if ( box === "content" ) { 6740 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6741 } 6742 6743 // For "content" or "padding", subtract border 6744 if ( box !== "margin" ) { 6745 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6746 } 6747 } 6748 } 6749 6750 // Account for positive content-box scroll gutter when requested by providing computedVal 6751 if ( !isBorderBox && computedVal >= 0 ) { 6752 6753 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 6754 // Assuming integer scroll gutter, subtract the rest and round down 6755 delta += Math.max( 0, Math.ceil( 6756 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 6757 computedVal - 6758 delta - 6759 extra - 6760 0.5 6761 6762 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 6763 // Use an explicit zero to avoid NaN (gh-3964) 6764 ) ) || 0; 6765 } 6766 6767 return delta; 6768} 6769 6770function getWidthOrHeight( elem, dimension, extra ) { 6771 6772 // Start with computed style 6773 var styles = getStyles( elem ), 6774 6775 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 6776 // Fake content-box until we know it's needed to know the true value. 6777 boxSizingNeeded = !support.boxSizingReliable() || extra, 6778 isBorderBox = boxSizingNeeded && 6779 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 6780 valueIsBorderBox = isBorderBox, 6781 6782 val = curCSS( elem, dimension, styles ), 6783 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); 6784 6785 // Support: Firefox <=54 6786 // Return a confounding non-pixel value or feign ignorance, as appropriate. 6787 if ( rnumnonpx.test( val ) ) { 6788 if ( !extra ) { 6789 return val; 6790 } 6791 val = "auto"; 6792 } 6793 6794 6795 // Support: IE 9 - 11 only 6796 // Use offsetWidth/offsetHeight for when box sizing is unreliable. 6797 // In those cases, the computed value can be trusted to be border-box. 6798 if ( ( !support.boxSizingReliable() && isBorderBox || 6799 6800 // Support: IE 10 - 11+, Edge 15 - 18+ 6801 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6802 // set in CSS while `offset*` properties report correct values. 6803 // Interestingly, in some cases IE 9 doesn't suffer from this issue. 6804 !support.reliableTrDimensions() && nodeName( elem, "tr" ) || 6805 6806 // Fall back to offsetWidth/offsetHeight when value is "auto" 6807 // This happens for inline elements with no explicit setting (gh-3571) 6808 val === "auto" || 6809 6810 // Support: Android <=4.1 - 4.3 only 6811 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 6812 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && 6813 6814 // Make sure the element is visible & connected 6815 elem.getClientRects().length ) { 6816 6817 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 6818 6819 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 6820 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 6821 // retrieved value as a content box dimension. 6822 valueIsBorderBox = offsetProp in elem; 6823 if ( valueIsBorderBox ) { 6824 val = elem[ offsetProp ]; 6825 } 6826 } 6827 6828 // Normalize "" and auto 6829 val = parseFloat( val ) || 0; 6830 6831 // Adjust for the element's box model 6832 return ( val + 6833 boxModelAdjustment( 6834 elem, 6835 dimension, 6836 extra || ( isBorderBox ? "border" : "content" ), 6837 valueIsBorderBox, 6838 styles, 6839 6840 // Provide the current computed size to request scroll gutter calculation (gh-3589) 6841 val 6842 ) 6843 ) + "px"; 6844} 6845 6846jQuery.extend( { 6847 6848 // Add in style property hooks for overriding the default 6849 // behavior of getting and setting a style property 6850 cssHooks: { 6851 opacity: { 6852 get: function( elem, computed ) { 6853 if ( computed ) { 6854 6855 // We should always get a number back from opacity 6856 var ret = curCSS( elem, "opacity" ); 6857 return ret === "" ? "1" : ret; 6858 } 6859 } 6860 } 6861 }, 6862 6863 // Don't automatically add "px" to these possibly-unitless properties 6864 cssNumber: { 6865 "animationIterationCount": true, 6866 "columnCount": true, 6867 "fillOpacity": true, 6868 "flexGrow": true, 6869 "flexShrink": true, 6870 "fontWeight": true, 6871 "gridArea": true, 6872 "gridColumn": true, 6873 "gridColumnEnd": true, 6874 "gridColumnStart": true, 6875 "gridRow": true, 6876 "gridRowEnd": true, 6877 "gridRowStart": true, 6878 "lineHeight": true, 6879 "opacity": true, 6880 "order": true, 6881 "orphans": true, 6882 "widows": true, 6883 "zIndex": true, 6884 "zoom": true 6885 }, 6886 6887 // Add in properties whose names you wish to fix before 6888 // setting or getting the value 6889 cssProps: {}, 6890 6891 // Get and set the style property on a DOM Node 6892 style: function( elem, name, value, extra ) { 6893 6894 // Don't set styles on text and comment nodes 6895 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 6896 return; 6897 } 6898 6899 // Make sure that we're working with the right name 6900 var ret, type, hooks, 6901 origName = camelCase( name ), 6902 isCustomProp = rcustomProp.test( name ), 6903 style = elem.style; 6904 6905 // Make sure that we're working with the right name. We don't 6906 // want to query the value if it is a CSS custom property 6907 // since they are user-defined. 6908 if ( !isCustomProp ) { 6909 name = finalPropName( origName ); 6910 } 6911 6912 // Gets hook for the prefixed version, then unprefixed version 6913 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6914 6915 // Check if we're setting a value 6916 if ( value !== undefined ) { 6917 type = typeof value; 6918 6919 // Convert "+=" or "-=" to relative numbers (#7345) 6920 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 6921 value = adjustCSS( elem, name, ret ); 6922 6923 // Fixes bug #9237 6924 type = "number"; 6925 } 6926 6927 // Make sure that null and NaN values aren't set (#7116) 6928 if ( value == null || value !== value ) { 6929 return; 6930 } 6931 6932 // If a number was passed in, add the unit (except for certain CSS properties) 6933 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 6934 // "px" to a few hardcoded values. 6935 if ( type === "number" && !isCustomProp ) { 6936 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 6937 } 6938 6939 // background-* props affect original clone's values 6940 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 6941 style[ name ] = "inherit"; 6942 } 6943 6944 // If a hook was provided, use that value, otherwise just set the specified value 6945 if ( !hooks || !( "set" in hooks ) || 6946 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 6947 6948 if ( isCustomProp ) { 6949 style.setProperty( name, value ); 6950 } else { 6951 style[ name ] = value; 6952 } 6953 } 6954 6955 } else { 6956 6957 // If a hook was provided get the non-computed value from there 6958 if ( hooks && "get" in hooks && 6959 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 6960 6961 return ret; 6962 } 6963 6964 // Otherwise just get the value from the style object 6965 return style[ name ]; 6966 } 6967 }, 6968 6969 css: function( elem, name, extra, styles ) { 6970 var val, num, hooks, 6971 origName = camelCase( name ), 6972 isCustomProp = rcustomProp.test( name ); 6973 6974 // Make sure that we're working with the right name. We don't 6975 // want to modify the value if it is a CSS custom property 6976 // since they are user-defined. 6977 if ( !isCustomProp ) { 6978 name = finalPropName( origName ); 6979 } 6980 6981 // Try prefixed name followed by the unprefixed name 6982 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6983 6984 // If a hook was provided get the computed value from there 6985 if ( hooks && "get" in hooks ) { 6986 val = hooks.get( elem, true, extra ); 6987 } 6988 6989 // Otherwise, if a way to get the computed value exists, use that 6990 if ( val === undefined ) { 6991 val = curCSS( elem, name, styles ); 6992 } 6993 6994 // Convert "normal" to computed value 6995 if ( val === "normal" && name in cssNormalTransform ) { 6996 val = cssNormalTransform[ name ]; 6997 } 6998 6999 // Make numeric if forced or a qualifier was provided and val looks numeric 7000 if ( extra === "" || extra ) { 7001 num = parseFloat( val ); 7002 return extra === true || isFinite( num ) ? num || 0 : val; 7003 } 7004 7005 return val; 7006 } 7007} ); 7008 7009jQuery.each( [ "height", "width" ], function( _i, dimension ) { 7010 jQuery.cssHooks[ dimension ] = { 7011 get: function( elem, computed, extra ) { 7012 if ( computed ) { 7013 7014 // Certain elements can have dimension info if we invisibly show them 7015 // but it must have a current display style that would benefit 7016 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 7017 7018 // Support: Safari 8+ 7019 // Table columns in Safari have non-zero offsetWidth & zero 7020 // getBoundingClientRect().width unless display is changed. 7021 // Support: IE <=11 only 7022 // Running getBoundingClientRect on a disconnected node 7023 // in IE throws an error. 7024 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 7025 swap( elem, cssShow, function() { 7026 return getWidthOrHeight( elem, dimension, extra ); 7027 } ) : 7028 getWidthOrHeight( elem, dimension, extra ); 7029 } 7030 }, 7031 7032 set: function( elem, value, extra ) { 7033 var matches, 7034 styles = getStyles( elem ), 7035 7036 // Only read styles.position if the test has a chance to fail 7037 // to avoid forcing a reflow. 7038 scrollboxSizeBuggy = !support.scrollboxSize() && 7039 styles.position === "absolute", 7040 7041 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 7042 boxSizingNeeded = scrollboxSizeBuggy || extra, 7043 isBorderBox = boxSizingNeeded && 7044 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 7045 subtract = extra ? 7046 boxModelAdjustment( 7047 elem, 7048 dimension, 7049 extra, 7050 isBorderBox, 7051 styles 7052 ) : 7053 0; 7054 7055 // Account for unreliable border-box dimensions by comparing offset* to computed and 7056 // faking a content-box to get border and padding (gh-3699) 7057 if ( isBorderBox && scrollboxSizeBuggy ) { 7058 subtract -= Math.ceil( 7059 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 7060 parseFloat( styles[ dimension ] ) - 7061 boxModelAdjustment( elem, dimension, "border", false, styles ) - 7062 0.5 7063 ); 7064 } 7065 7066 // Convert to pixels if value adjustment is needed 7067 if ( subtract && ( matches = rcssNum.exec( value ) ) && 7068 ( matches[ 3 ] || "px" ) !== "px" ) { 7069 7070 elem.style[ dimension ] = value; 7071 value = jQuery.css( elem, dimension ); 7072 } 7073 7074 return setPositiveNumber( elem, value, subtract ); 7075 } 7076 }; 7077} ); 7078 7079jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 7080 function( elem, computed ) { 7081 if ( computed ) { 7082 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 7083 elem.getBoundingClientRect().left - 7084 swap( elem, { marginLeft: 0 }, function() { 7085 return elem.getBoundingClientRect().left; 7086 } ) 7087 ) + "px"; 7088 } 7089 } 7090); 7091 7092// These hooks are used by animate to expand properties 7093jQuery.each( { 7094 margin: "", 7095 padding: "", 7096 border: "Width" 7097}, function( prefix, suffix ) { 7098 jQuery.cssHooks[ prefix + suffix ] = { 7099 expand: function( value ) { 7100 var i = 0, 7101 expanded = {}, 7102 7103 // Assumes a single number if not a string 7104 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 7105 7106 for ( ; i < 4; i++ ) { 7107 expanded[ prefix + cssExpand[ i ] + suffix ] = 7108 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 7109 } 7110 7111 return expanded; 7112 } 7113 }; 7114 7115 if ( prefix !== "margin" ) { 7116 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 7117 } 7118} ); 7119 7120jQuery.fn.extend( { 7121 css: function( name, value ) { 7122 return access( this, function( elem, name, value ) { 7123 var styles, len, 7124 map = {}, 7125 i = 0; 7126 7127 if ( Array.isArray( name ) ) { 7128 styles = getStyles( elem ); 7129 len = name.length; 7130 7131 for ( ; i < len; i++ ) { 7132 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 7133 } 7134 7135 return map; 7136 } 7137 7138 return value !== undefined ? 7139 jQuery.style( elem, name, value ) : 7140 jQuery.css( elem, name ); 7141 }, name, value, arguments.length > 1 ); 7142 } 7143} ); 7144 7145 7146function Tween( elem, options, prop, end, easing ) { 7147 return new Tween.prototype.init( elem, options, prop, end, easing ); 7148} 7149jQuery.Tween = Tween; 7150 7151Tween.prototype = { 7152 constructor: Tween, 7153 init: function( elem, options, prop, end, easing, unit ) { 7154 this.elem = elem; 7155 this.prop = prop; 7156 this.easing = easing || jQuery.easing._default; 7157 this.options = options; 7158 this.start = this.now = this.cur(); 7159 this.end = end; 7160 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 7161 }, 7162 cur: function() { 7163 var hooks = Tween.propHooks[ this.prop ]; 7164 7165 return hooks && hooks.get ? 7166 hooks.get( this ) : 7167 Tween.propHooks._default.get( this ); 7168 }, 7169 run: function( percent ) { 7170 var eased, 7171 hooks = Tween.propHooks[ this.prop ]; 7172 7173 if ( this.options.duration ) { 7174 this.pos = eased = jQuery.easing[ this.easing ]( 7175 percent, this.options.duration * percent, 0, 1, this.options.duration 7176 ); 7177 } else { 7178 this.pos = eased = percent; 7179 } 7180 this.now = ( this.end - this.start ) * eased + this.start; 7181 7182 if ( this.options.step ) { 7183 this.options.step.call( this.elem, this.now, this ); 7184 } 7185 7186 if ( hooks && hooks.set ) { 7187 hooks.set( this ); 7188 } else { 7189 Tween.propHooks._default.set( this ); 7190 } 7191 return this; 7192 } 7193}; 7194 7195Tween.prototype.init.prototype = Tween.prototype; 7196 7197Tween.propHooks = { 7198 _default: { 7199 get: function( tween ) { 7200 var result; 7201 7202 // Use a property on the element directly when it is not a DOM element, 7203 // or when there is no matching style property that exists. 7204 if ( tween.elem.nodeType !== 1 || 7205 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 7206 return tween.elem[ tween.prop ]; 7207 } 7208 7209 // Passing an empty string as a 3rd parameter to .css will automatically 7210 // attempt a parseFloat and fallback to a string if the parse fails. 7211 // Simple values such as "10px" are parsed to Float; 7212 // complex values such as "rotate(1rad)" are returned as-is. 7213 result = jQuery.css( tween.elem, tween.prop, "" ); 7214 7215 // Empty strings, null, undefined and "auto" are converted to 0. 7216 return !result || result === "auto" ? 0 : result; 7217 }, 7218 set: function( tween ) { 7219 7220 // Use step hook for back compat. 7221 // Use cssHook if its there. 7222 // Use .style if available and use plain properties where available. 7223 if ( jQuery.fx.step[ tween.prop ] ) { 7224 jQuery.fx.step[ tween.prop ]( tween ); 7225 } else if ( tween.elem.nodeType === 1 && ( 7226 jQuery.cssHooks[ tween.prop ] || 7227 tween.elem.style[ finalPropName( tween.prop ) ] != null
vendor: 14,002 bytes, lines 7227-7782
7227 ) ) { 7228 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 7229 } else { 7230 tween.elem[ tween.prop ] = tween.now; 7231 } 7232 } 7233 } 7234}; 7235 7236// Support: IE <=9 only 7237// Panic based approach to setting things on disconnected nodes 7238Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 7239 set: function( tween ) { 7240 if ( tween.elem.nodeType && tween.elem.parentNode ) { 7241 tween.elem[ tween.prop ] = tween.now; 7242 } 7243 } 7244}; 7245 7246jQuery.easing = { 7247 linear: function( p ) { 7248 return p; 7249 }, 7250 swing: function( p ) { 7251 return 0.5 - Math.cos( p * Math.PI ) / 2; 7252 }, 7253 _default: "swing" 7254}; 7255 7256jQuery.fx = Tween.prototype.init; 7257 7258// Back compat <1.8 extension point 7259jQuery.fx.step = {}; 7260 7261 7262 7263 7264var 7265 fxNow, inProgress, 7266 rfxtypes = /^(?:toggle|show|hide)$/, 7267 rrun = /queueHooks$/; 7268 7269function schedule() { 7270 if ( inProgress ) { 7271 if ( document.hidden === false && window.requestAnimationFrame ) { 7272 window.requestAnimationFrame( schedule ); 7273 } else { 7274 window.setTimeout( schedule, jQuery.fx.interval ); 7275 } 7276 7277 jQuery.fx.tick(); 7278 } 7279} 7280 7281// Animations created synchronously will run synchronously 7282function createFxNow() { 7283 window.setTimeout( function() { 7284 fxNow = undefined; 7285 } ); 7286 return ( fxNow = Date.now() ); 7287} 7288 7289// Generate parameters to create a standard animation 7290function genFx( type, includeWidth ) { 7291 var which, 7292 i = 0, 7293 attrs = { height: type }; 7294 7295 // If we include width, step value is 1 to do all cssExpand values, 7296 // otherwise step value is 2 to skip over Left and Right 7297 includeWidth = includeWidth ? 1 : 0; 7298 for ( ; i < 4; i += 2 - includeWidth ) { 7299 which = cssExpand[ i ]; 7300 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 7301 } 7302 7303 if ( includeWidth ) { 7304 attrs.opacity = attrs.width = type; 7305 } 7306 7307 return attrs; 7308} 7309 7310function createTween( value, prop, animation ) { 7311 var tween, 7312 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 7313 index = 0, 7314 length = collection.length; 7315 for ( ; index < length; index++ ) { 7316 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 7317 7318 // We're done with this property 7319 return tween; 7320 } 7321 } 7322} 7323 7324function defaultPrefilter( elem, props, opts ) { 7325 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 7326 isBox = "width" in props || "height" in props, 7327 anim = this, 7328 orig = {}, 7329 style = elem.style, 7330 hidden = elem.nodeType && isHiddenWithinTree( elem ), 7331 dataShow = dataPriv.get( elem, "fxshow" ); 7332 7333 // Queue-skipping animations hijack the fx hooks 7334 if ( !opts.queue ) { 7335 hooks = jQuery._queueHooks( elem, "fx" ); 7336 if ( hooks.unqueued == null ) { 7337 hooks.unqueued = 0; 7338 oldfire = hooks.empty.fire; 7339 hooks.empty.fire = function() { 7340 if ( !hooks.unqueued ) { 7341 oldfire(); 7342 } 7343 }; 7344 } 7345 hooks.unqueued++; 7346 7347 anim.always( function() { 7348 7349 // Ensure the complete handler is called before this completes 7350 anim.always( function() { 7351 hooks.unqueued--; 7352 if ( !jQuery.queue( elem, "fx" ).length ) { 7353 hooks.empty.fire(); 7354 } 7355 } ); 7356 } ); 7357 } 7358 7359 // Detect show/hide animations 7360 for ( prop in props ) { 7361 value = props[ prop ]; 7362 if ( rfxtypes.test( value ) ) { 7363 delete props[ prop ]; 7364 toggle = toggle || value === "toggle"; 7365 if ( value === ( hidden ? "hide" : "show" ) ) { 7366 7367 // Pretend to be hidden if this is a "show" and 7368 // there is still data from a stopped show/hide 7369 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 7370 hidden = true; 7371 7372 // Ignore all other no-op show/hide data 7373 } else { 7374 continue; 7375 } 7376 } 7377 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 7378 } 7379 } 7380 7381 // Bail out if this is a no-op like .hide().hide() 7382 propTween = !jQuery.isEmptyObject( props ); 7383 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 7384 return; 7385 } 7386 7387 // Restrict "overflow" and "display" styles during box animations 7388 if ( isBox && elem.nodeType === 1 ) { 7389 7390 // Support: IE <=9 - 11, Edge 12 - 15 7391 // Record all 3 overflow attributes because IE does not infer the shorthand 7392 // from identically-valued overflowX and overflowY and Edge just mirrors 7393 // the overflowX value there. 7394 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 7395 7396 // Identify a display type, preferring old show/hide data over the CSS cascade 7397 restoreDisplay = dataShow && dataShow.display; 7398 if ( restoreDisplay == null ) { 7399 restoreDisplay = dataPriv.get( elem, "display" ); 7400 } 7401 display = jQuery.css( elem, "display" ); 7402 if ( display === "none" ) { 7403 if ( restoreDisplay ) { 7404 display = restoreDisplay; 7405 } else { 7406 7407 // Get nonempty value(s) by temporarily forcing visibility 7408 showHide( [ elem ], true ); 7409 restoreDisplay = elem.style.display || restoreDisplay; 7410 display = jQuery.css( elem, "display" ); 7411 showHide( [ elem ] ); 7412 } 7413 } 7414 7415 // Animate inline elements as inline-block 7416 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 7417 if ( jQuery.css( elem, "float" ) === "none" ) { 7418 7419 // Restore the original display value at the end of pure show/hide animations 7420 if ( !propTween ) { 7421 anim.done( function() { 7422 style.display = restoreDisplay; 7423 } ); 7424 if ( restoreDisplay == null ) { 7425 display = style.display; 7426 restoreDisplay = display === "none" ? "" : display; 7427 } 7428 } 7429 style.display = "inline-block"; 7430 } 7431 } 7432 } 7433 7434 if ( opts.overflow ) { 7435 style.overflow = "hidden"; 7436 anim.always( function() { 7437 style.overflow = opts.overflow[ 0 ]; 7438 style.overflowX = opts.overflow[ 1 ]; 7439 style.overflowY = opts.overflow[ 2 ]; 7440 } ); 7441 } 7442 7443 // Implement show/hide animations 7444 propTween = false; 7445 for ( prop in orig ) { 7446 7447 // General show/hide setup for this element animation 7448 if ( !propTween ) { 7449 if ( dataShow ) { 7450 if ( "hidden" in dataShow ) { 7451 hidden = dataShow.hidden; 7452 } 7453 } else { 7454 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 7455 } 7456 7457 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 7458 if ( toggle ) { 7459 dataShow.hidden = !hidden; 7460 } 7461 7462 // Show elements before animating them 7463 if ( hidden ) { 7464 showHide( [ elem ], true ); 7465 } 7466 7467 /* eslint-disable no-loop-func */ 7468 7469 anim.done( function() { 7470 7471 /* eslint-enable no-loop-func */ 7472 7473 // The final step of a "hide" animation is actually hiding the element 7474 if ( !hidden ) { 7475 showHide( [ elem ] ); 7476 } 7477 dataPriv.remove( elem, "fxshow" ); 7478 for ( prop in orig ) { 7479 jQuery.style( elem, prop, orig[ prop ] ); 7480 } 7481 } ); 7482 } 7483 7484 // Per-property setup 7485 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 7486 if ( !( prop in dataShow ) ) { 7487 dataShow[ prop ] = propTween.start; 7488 if ( hidden ) { 7489 propTween.end = propTween.start; 7490 propTween.start = 0; 7491 } 7492 } 7493 } 7494} 7495 7496function propFilter( props, specialEasing ) { 7497 var index, name, easing, value, hooks; 7498 7499 // camelCase, specialEasing and expand cssHook pass 7500 for ( index in props ) { 7501 name = camelCase( index ); 7502 easing = specialEasing[ name ]; 7503 value = props[ index ]; 7504 if ( Array.isArray( value ) ) { 7505 easing = value[ 1 ]; 7506 value = props[ index ] = value[ 0 ]; 7507 } 7508 7509 if ( index !== name ) { 7510 props[ name ] = value; 7511 delete props[ index ]; 7512 } 7513 7514 hooks = jQuery.cssHooks[ name ]; 7515 if ( hooks && "expand" in hooks ) { 7516 value = hooks.expand( value ); 7517 delete props[ name ]; 7518 7519 // Not quite $.extend, this won't overwrite existing keys. 7520 // Reusing 'index' because we have the correct "name" 7521 for ( index in value ) { 7522 if ( !( index in props ) ) { 7523 props[ index ] = value[ index ]; 7524 specialEasing[ index ] = easing; 7525 } 7526 } 7527 } else { 7528 specialEasing[ name ] = easing; 7529 } 7530 } 7531} 7532 7533function Animation( elem, properties, options ) { 7534 var result, 7535 stopped, 7536 index = 0, 7537 length = Animation.prefilters.length, 7538 deferred = jQuery.Deferred().always( function() { 7539 7540 // Don't match elem in the :animated selector 7541 delete tick.elem; 7542 } ), 7543 tick = function() { 7544 if ( stopped ) { 7545 return false; 7546 } 7547 var currentTime = fxNow || createFxNow(), 7548 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 7549 7550 // Support: Android 2.3 only 7551 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) 7552 temp = remaining / animation.duration || 0, 7553 percent = 1 - temp, 7554 index = 0, 7555 length = animation.tweens.length; 7556 7557 for ( ; index < length; index++ ) { 7558 animation.tweens[ index ].run( percent ); 7559 } 7560 7561 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 7562 7563 // If there's more to do, yield 7564 if ( percent < 1 && length ) { 7565 return remaining; 7566 } 7567 7568 // If this was an empty animation, synthesize a final progress notification 7569 if ( !length ) { 7570 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7571 } 7572 7573 // Resolve the animation and report its conclusion 7574 deferred.resolveWith( elem, [ animation ] ); 7575 return false; 7576 }, 7577 animation = deferred.promise( { 7578 elem: elem, 7579 props: jQuery.extend( {}, properties ), 7580 opts: jQuery.extend( true, { 7581 specialEasing: {}, 7582 easing: jQuery.easing._default 7583 }, options ), 7584 originalProperties: properties, 7585 originalOptions: options, 7586 startTime: fxNow || createFxNow(), 7587 duration: options.duration, 7588 tweens: [], 7589 createTween: function( prop, end ) { 7590 var tween = jQuery.Tween( elem, animation.opts, prop, end, 7591 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 7592 animation.tweens.push( tween ); 7593 return tween; 7594 }, 7595 stop: function( gotoEnd ) { 7596 var index = 0, 7597 7598 // If we are going to the end, we want to run all the tweens 7599 // otherwise we skip this part 7600 length = gotoEnd ? animation.tweens.length : 0; 7601 if ( stopped ) { 7602 return this; 7603 } 7604 stopped = true; 7605 for ( ; index < length; index++ ) { 7606 animation.tweens[ index ].run( 1 ); 7607 } 7608 7609 // Resolve when we played the last frame; otherwise, reject 7610 if ( gotoEnd ) { 7611 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7612 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 7613 } else { 7614 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 7615 } 7616 return this; 7617 } 7618 } ), 7619 props = animation.props; 7620 7621 propFilter( props, animation.opts.specialEasing ); 7622 7623 for ( ; index < length; index++ ) { 7624 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 7625 if ( result ) { 7626 if ( isFunction( result.stop ) ) { 7627 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 7628 result.stop.bind( result ); 7629 } 7630 return result; 7631 } 7632 } 7633 7634 jQuery.map( props, createTween, animation ); 7635 7636 if ( isFunction( animation.opts.start ) ) { 7637 animation.opts.start.call( elem, animation ); 7638 } 7639 7640 // Attach callbacks from options 7641 animation 7642 .progress( animation.opts.progress ) 7643 .done( animation.opts.done, animation.opts.complete ) 7644 .fail( animation.opts.fail ) 7645 .always( animation.opts.always ); 7646 7647 jQuery.fx.timer( 7648 jQuery.extend( tick, { 7649 elem: elem, 7650 anim: animation, 7651 queue: animation.opts.queue 7652 } ) 7653 ); 7654 7655 return animation; 7656} 7657 7658jQuery.Animation = jQuery.extend( Animation, { 7659 7660 tweeners: { 7661 "*": [ function( prop, value ) { 7662 var tween = this.createTween( prop, value ); 7663 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 7664 return tween; 7665 } ] 7666 }, 7667 7668 tweener: function( props, callback ) { 7669 if ( isFunction( props ) ) { 7670 callback = props; 7671 props = [ "*" ]; 7672 } else { 7673 props = props.match( rnothtmlwhite ); 7674 } 7675 7676 var prop, 7677 index = 0, 7678 length = props.length; 7679 7680 for ( ; index < length; index++ ) { 7681 prop = props[ index ]; 7682 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 7683 Animation.tweeners[ prop ].unshift( callback ); 7684 } 7685 }, 7686 7687 prefilters: [ defaultPrefilter ], 7688 7689 prefilter: function( callback, prepend ) { 7690 if ( prepend ) { 7691 Animation.prefilters.unshift( callback ); 7692 } else { 7693 Animation.prefilters.push( callback ); 7694 } 7695 } 7696} ); 7697 7698jQuery.speed = function( speed, easing, fn ) { 7699 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 7700 complete: fn || !fn && easing || 7701 isFunction( speed ) && speed, 7702 duration: speed, 7703 easing: fn && easing || easing && !isFunction( easing ) && easing 7704 }; 7705 7706 // Go to the end state if fx are off 7707 if ( jQuery.fx.off ) { 7708 opt.duration = 0; 7709 7710 } else { 7711 if ( typeof opt.duration !== "number" ) { 7712 if ( opt.duration in jQuery.fx.speeds ) { 7713 opt.duration = jQuery.fx.speeds[ opt.duration ]; 7714 7715 } else { 7716 opt.duration = jQuery.fx.speeds._default; 7717 } 7718 } 7719 } 7720 7721 // Normalize opt.queue - true/undefined/null -> "fx" 7722 if ( opt.queue == null || opt.queue === true ) { 7723 opt.queue = "fx"; 7724 } 7725 7726 // Queueing 7727 opt.old = opt.complete; 7728 7729 opt.complete = function() { 7730 if ( isFunction( opt.old ) ) { 7731 opt.old.call( this ); 7732 } 7733 7734 if ( opt.queue ) { 7735 jQuery.dequeue( this, opt.queue ); 7736 } 7737 }; 7738 7739 return opt; 7740}; 7741 7742jQuery.fn.extend( { 7743 fadeTo: function( speed, to, easing, callback ) { 7744 7745 // Show any hidden elements after setting opacity to 0 7746 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 7747 7748 // Animate to the value specified 7749 .end().animate( { opacity: to }, speed, easing, callback ); 7750 }, 7751 animate: function( prop, speed, easing, callback ) { 7752 var empty = jQuery.isEmptyObject( prop ), 7753 optall = jQuery.speed( speed, easing, callback ), 7754 doAnimation = function() { 7755 7756 // Operate on a copy of prop so per-property easing won't be lost 7757 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 7758 7759 // Empty animations, or finishing resolves immediately 7760 if ( empty || dataPriv.get( this, "finish" ) ) { 7761 anim.stop( true ); 7762 } 7763 }; 7764 doAnimation.finish = doAnimation; 7765 7766 return empty || optall.queue === false ? 7767 this.each( doAnimation ) : 7768 this.queue( optall.queue, doAnimation ); 7769 }, 7770 stop: function( type, clearQueue, gotoEnd ) { 7771 var stopQueue = function( hooks ) { 7772 var stop = hooks.stop; 7773 delete hooks.stop; 7774 stop( gotoEnd ); 7775 }; 7776 7777 if ( typeof type !== "string" ) { 7778 gotoEnd = clearQueue; 7779 clearQueue = type; 7780 type = undefined; 7781 } 7782 if ( clearQueue
vendor: 695 bytes, lines 7782-7809
7782) { 7783 this.queue( type || "fx", [] ); 7784 } 7785 7786 return this.each( function() { 7787 var dequeue = true, 7788 index = type != null && type + "queueHooks", 7789 timers = jQuery.timers, 7790 data = dataPriv.get( this ); 7791 7792 if ( index ) { 7793 if ( data[ index ] && data[ index ].stop ) { 7794 stopQueue( data[ index ] ); 7795 } 7796 } else { 7797 for ( index in data ) { 7798 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 7799 stopQueue( data[ index ] ); 7800 } 7801 } 7802 } 7803 7804 for ( index = timers.length; index--; ) { 7805 if ( timers[ index ].elem === this && 7806 ( type == null || timers[ index ].queue === type ) ) { 7807 7808 timers[ index ].anim.stop( gotoEnd ); 7809 dequeue = false;
vendor: 3,023 bytes, lines 7810-7940
7810 timers.splice( index, 1 ); 7811 } 7812 } 7813 7814 // Start the next in the queue if the last step wasn't forced. 7815 // Timers currently will call their complete callbacks, which 7816 // will dequeue but only if they were gotoEnd. 7817 if ( dequeue || !gotoEnd ) { 7818 jQuery.dequeue( this, type ); 7819 } 7820 } ); 7821 }, 7822 finish: function( type ) { 7823 if ( type !== false ) { 7824 type = type || "fx"; 7825 } 7826 return this.each( function() { 7827 var index, 7828 data = dataPriv.get( this ), 7829 queue = data[ type + "queue" ], 7830 hooks = data[ type + "queueHooks" ], 7831 timers = jQuery.timers, 7832 length = queue ? queue.length : 0; 7833 7834 // Enable finishing flag on private data 7835 data.finish = true; 7836 7837 // Empty the queue first 7838 jQuery.queue( this, type, [] ); 7839 7840 if ( hooks && hooks.stop ) { 7841 hooks.stop.call( this, true ); 7842 } 7843 7844 // Look for any active animations, and finish them 7845 for ( index = timers.length; index--; ) { 7846 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 7847 timers[ index ].anim.stop( true ); 7848 timers.splice( index, 1 ); 7849 } 7850 } 7851 7852 // Look for any animations in the old queue and finish them 7853 for ( index = 0; index < length; index++ ) { 7854 if ( queue[ index ] && queue[ index ].finish ) { 7855 queue[ index ].finish.call( this ); 7856 } 7857 } 7858 7859 // Turn off finishing flag 7860 delete data.finish; 7861 } ); 7862 } 7863} ); 7864 7865jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { 7866 var cssFn = jQuery.fn[ name ]; 7867 jQuery.fn[ name ] = function( speed, easing, callback ) { 7868 return speed == null || typeof speed === "boolean" ? 7869 cssFn.apply( this, arguments ) : 7870 this.animate( genFx( name, true ), speed, easing, callback ); 7871 }; 7872} ); 7873 7874// Generate shortcuts for custom animations 7875jQuery.each( { 7876 slideDown: genFx( "show" ), 7877 slideUp: genFx( "hide" ), 7878 slideToggle: genFx( "toggle" ), 7879 fadeIn: { opacity: "show" }, 7880 fadeOut: { opacity: "hide" }, 7881 fadeToggle: { opacity: "toggle" } 7882}, function( name, props ) { 7883 jQuery.fn[ name ] = function( speed, easing, callback ) { 7884 return this.animate( props, speed, easing, callback ); 7885 }; 7886} ); 7887 7888jQuery.timers = []; 7889jQuery.fx.tick = function() { 7890 var timer, 7891 i = 0, 7892 timers = jQuery.timers; 7893 7894 fxNow = Date.now(); 7895 7896 for ( ; i < timers.length; i++ ) { 7897 timer = timers[ i ]; 7898 7899 // Run the timer and safely remove it when done (allowing for external removal) 7900 if ( !timer() && timers[ i ] === timer ) { 7901 timers.splice( i--, 1 ); 7902 } 7903 } 7904 7905 if ( !timers.length ) { 7906 jQuery.fx.stop(); 7907 } 7908 fxNow = undefined; 7909}; 7910 7911jQuery.fx.timer = function( timer ) { 7912 jQuery.timers.push( timer ); 7913 jQuery.fx.start(); 7914}; 7915 7916jQuery.fx.interval = 13; 7917jQuery.fx.start = function() { 7918 if ( inProgress ) { 7919 return; 7920 } 7921 7922 inProgress = true; 7923 schedule(); 7924}; 7925 7926jQuery.fx.stop = function() { 7927 inProgress = null; 7928}; 7929 7930jQuery.fx.speeds = { 7931 slow: 600, 7932 fast: 200, 7933 7934 // Default speed 7935 _default: 400 7936}; 7937 7938 7939// Based off of the plugin by Clint Helfers, with permission. 7940// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
vendor: 5,178 bytes, lines 7940-8161
7940 7941jQuery.fn.delay = function( time, type ) { 7942 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 7943 type = type || "fx"; 7944 7945 return this.queue( type, function( next, hooks ) { 7946 var timeout = window.setTimeout( next, time ); 7947 hooks.stop = function() { 7948 window.clearTimeout( timeout ); 7949 }; 7950 } ); 7951}; 7952 7953 7954( function() { 7955 var input = document.createElement( "input" ), 7956 select = document.createElement( "select" ), 7957 opt = select.appendChild( document.createElement( "option" ) ); 7958 7959 input.type = "checkbox"; 7960 7961 // Support: Android <=4.3 only 7962 // Default value for a checkbox should be "on" 7963 support.checkOn = input.value !== ""; 7964 7965 // Support: IE <=11 only 7966 // Must access selectedIndex to make default options select 7967 support.optSelected = opt.selected; 7968 7969 // Support: IE <=11 only 7970 // An input loses its value after becoming a radio 7971 input = document.createElement( "input" ); 7972 input.value = "t"; 7973 input.type = "radio"; 7974 support.radioValue = input.value === "t"; 7975} )(); 7976 7977 7978var boolHook, 7979 attrHandle = jQuery.expr.attrHandle; 7980 7981jQuery.fn.extend( { 7982 attr: function( name, value ) { 7983 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 7984 }, 7985 7986 removeAttr: function( name ) { 7987 return this.each( function() { 7988 jQuery.removeAttr( this, name ); 7989 } ); 7990 } 7991} ); 7992 7993jQuery.extend( { 7994 attr: function( elem, name, value ) { 7995 var ret, hooks, 7996 nType = elem.nodeType; 7997 7998 // Don't get/set attributes on text, comment and attribute nodes 7999 if ( nType === 3 || nType === 8 || nType === 2 ) { 8000 return; 8001 } 8002 8003 // Fallback to prop when attributes are not supported 8004 if ( typeof elem.getAttribute === "undefined" ) { 8005 return jQuery.prop( elem, name, value ); 8006 } 8007 8008 // Attribute hooks are determined by the lowercase version 8009 // Grab necessary hook if one is defined 8010 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8011 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 8012 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 8013 } 8014 8015 if ( value !== undefined ) { 8016 if ( value === null ) { 8017 jQuery.removeAttr( elem, name ); 8018 return; 8019 } 8020 8021 if ( hooks && "set" in hooks && 8022 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8023 return ret; 8024 } 8025 8026 elem.setAttribute( name, value + "" ); 8027 return value; 8028 } 8029 8030 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8031 return ret; 8032 } 8033 8034 ret = jQuery.find.attr( elem, name ); 8035 8036 // Non-existent attributes return null, we normalize to undefined 8037 return ret == null ? undefined : ret; 8038 }, 8039 8040 attrHooks: { 8041 type: { 8042 set: function( elem, value ) { 8043 if ( !support.radioValue && value === "radio" && 8044 nodeName( elem, "input" ) ) { 8045 var val = elem.value; 8046 elem.setAttribute( "type", value ); 8047 if ( val ) { 8048 elem.value = val; 8049 } 8050 return value; 8051 } 8052 } 8053 } 8054 }, 8055 8056 removeAttr: function( elem, value ) { 8057 var name, 8058 i = 0, 8059 8060 // Attribute names can contain non-HTML whitespace characters 8061 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 8062 attrNames = value && value.match( rnothtmlwhite ); 8063 8064 if ( attrNames && elem.nodeType === 1 ) { 8065 while ( ( name = attrNames[ i++ ] ) ) { 8066 elem.removeAttribute( name ); 8067 } 8068 } 8069 } 8070} ); 8071 8072// Hooks for boolean attributes 8073boolHook = { 8074 set: function( elem, value, name ) { 8075 if ( value === false ) { 8076 8077 // Remove boolean attributes when set to false 8078 jQuery.removeAttr( elem, name ); 8079 } else { 8080 elem.setAttribute( name, name ); 8081 } 8082 return name; 8083 } 8084}; 8085 8086jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { 8087 var getter = attrHandle[ name ] || jQuery.find.attr; 8088 8089 attrHandle[ name ] = function( elem, name, isXML ) { 8090 var ret, handle, 8091 lowercaseName = name.toLowerCase(); 8092 8093 if ( !isXML ) { 8094 8095 // Avoid an infinite loop by temporarily removing this function from the getter 8096 handle = attrHandle[ lowercaseName ]; 8097 attrHandle[ lowercaseName ] = ret; 8098 ret = getter( elem, name, isXML ) != null ? 8099 lowercaseName : 8100 null; 8101 attrHandle[ lowercaseName ] = handle; 8102 } 8103 return ret; 8104 }; 8105} ); 8106 8107 8108 8109 8110var rfocusable = /^(?:input|select|textarea|button)$/i, 8111 rclickable = /^(?:a|area)$/i; 8112 8113jQuery.fn.extend( { 8114 prop: function( name, value ) { 8115 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 8116 }, 8117 8118 removeProp: function( name ) { 8119 return this.each( function() { 8120 delete this[ jQuery.propFix[ name ] || name ]; 8121 } ); 8122 } 8123} ); 8124 8125jQuery.extend( { 8126 prop: function( elem, name, value ) { 8127 var ret, hooks, 8128 nType = elem.nodeType; 8129 8130 // Don't get/set properties on text, comment and attribute nodes 8131 if ( nType === 3 || nType === 8 || nType === 2 ) { 8132 return; 8133 } 8134 8135 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8136 8137 // Fix name and attach hooks 8138 name = jQuery.propFix[ name ] || name; 8139 hooks = jQuery.propHooks[ name ]; 8140 } 8141 8142 if ( value !== undefined ) { 8143 if ( hooks && "set" in hooks && 8144 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8145 return ret; 8146 } 8147 8148 return ( elem[ name ] = value ); 8149 } 8150 8151 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8152 return ret; 8153 } 8154 8155 return elem[ name ]; 8156 }, 8157 8158 propHooks: { 8159 tabIndex: { 8160 get: function( elem ) { 8161
vendor: 6,193 bytes, lines 8162-8424
8162 // Support: IE <=9 - 11 only 8163 // elem.tabIndex doesn't always return the 8164 // correct value when it hasn't been explicitly set 8165 // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 8166 // Use proper attribute retrieval(#12072) 8167 var tabindex = jQuery.find.attr( elem, "tabindex" ); 8168 8169 if ( tabindex ) { 8170 return parseInt( tabindex, 10 ); 8171 } 8172 8173 if ( 8174 rfocusable.test( elem.nodeName ) || 8175 rclickable.test( elem.nodeName ) && 8176 elem.href 8177 ) { 8178 return 0; 8179 } 8180 8181 return -1; 8182 } 8183 } 8184 }, 8185 8186 propFix: { 8187 "for": "htmlFor", 8188 "class": "className" 8189 } 8190} ); 8191 8192// Support: IE <=11 only 8193// Accessing the selectedIndex property 8194// forces the browser to respect setting selected 8195// on the option 8196// The getter ensures a default option is selected 8197// when in an optgroup 8198// eslint rule "no-unused-expressions" is disabled for this code 8199// since it considers such accessions noop 8200if ( !support.optSelected ) { 8201 jQuery.propHooks.selected = { 8202 get: function( elem ) { 8203 8204 /* eslint no-unused-expressions: "off" */ 8205 8206 var parent = elem.parentNode; 8207 if ( parent && parent.parentNode ) { 8208 parent.parentNode.selectedIndex; 8209 } 8210 return null; 8211 }, 8212 set: function( elem ) { 8213 8214 /* eslint no-unused-expressions: "off" */ 8215 8216 var parent = elem.parentNode; 8217 if ( parent ) { 8218 parent.selectedIndex; 8219 8220 if ( parent.parentNode ) { 8221 parent.parentNode.selectedIndex; 8222 } 8223 } 8224 } 8225 }; 8226} 8227 8228jQuery.each( [ 8229 "tabIndex", 8230 "readOnly", 8231 "maxLength", 8232 "cellSpacing", 8233 "cellPadding", 8234 "rowSpan", 8235 "colSpan", 8236 "useMap", 8237 "frameBorder", 8238 "contentEditable" 8239], function() { 8240 jQuery.propFix[ this.toLowerCase() ] = this; 8241} ); 8242 8243 8244 8245 8246 // Strip and collapse whitespace according to HTML spec 8247 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 8248 function stripAndCollapse( value ) { 8249 var tokens = value.match( rnothtmlwhite ) || []; 8250 return tokens.join( " " ); 8251 } 8252 8253 8254function getClass( elem ) { 8255 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 8256} 8257 8258function classesToArray( value ) { 8259 if ( Array.isArray( value ) ) { 8260 return value; 8261 } 8262 if ( typeof value === "string" ) { 8263 return value.match( rnothtmlwhite ) || []; 8264 } 8265 return []; 8266} 8267 8268jQuery.fn.extend( { 8269 addClass: function( value ) { 8270 var classes, elem, cur, curValue, clazz, j, finalValue, 8271 i = 0; 8272 8273 if ( isFunction( value ) ) { 8274 return this.each( function( j ) { 8275 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 8276 } ); 8277 } 8278 8279 classes = classesToArray( value ); 8280 8281 if ( classes.length ) { 8282 while ( ( elem = this[ i++ ] ) ) { 8283 curValue = getClass( elem ); 8284 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8285 8286 if ( cur ) { 8287 j = 0; 8288 while ( ( clazz = classes[ j++ ] ) ) { 8289 if ( cur.indexOf( " " + clazz + " " ) < 0 ) { 8290 cur += clazz + " "; 8291 } 8292 } 8293 8294 // Only assign if different to avoid unneeded rendering. 8295 finalValue = stripAndCollapse( cur ); 8296 if ( curValue !== finalValue ) { 8297 elem.setAttribute( "class", finalValue ); 8298 } 8299 } 8300 } 8301 } 8302 8303 return this; 8304 }, 8305 8306 removeClass: function( value ) { 8307 var classes, elem, cur, curValue, clazz, j, finalValue, 8308 i = 0; 8309 8310 if ( isFunction( value ) ) { 8311 return this.each( function( j ) { 8312 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 8313 } ); 8314 } 8315 8316 if ( !arguments.length ) { 8317 return this.attr( "class", "" ); 8318 } 8319 8320 classes = classesToArray( value ); 8321 8322 if ( classes.length ) { 8323 while ( ( elem = this[ i++ ] ) ) { 8324 curValue = getClass( elem ); 8325 8326 // This expression is here for better compressibility (see addClass) 8327 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8328 8329 if ( cur ) { 8330 j = 0; 8331 while ( ( clazz = classes[ j++ ] ) ) { 8332 8333 // Remove *all* instances 8334 while ( cur.indexOf( " " + clazz + " " ) > -1 ) { 8335 cur = cur.replace( " " + clazz + " ", " " ); 8336 } 8337 } 8338 8339 // Only assign if different to avoid unneeded rendering. 8340 finalValue = stripAndCollapse( cur ); 8341 if ( curValue !== finalValue ) { 8342 elem.setAttribute( "class", finalValue ); 8343 } 8344 } 8345 } 8346 } 8347 8348 return this; 8349 }, 8350 8351 toggleClass: function( value, stateVal ) { 8352 var type = typeof value, 8353 isValidValue = type === "string" || Array.isArray( value ); 8354 8355 if ( typeof stateVal === "boolean" && isValidValue ) { 8356 return stateVal ? this.addClass( value ) : this.removeClass( value ); 8357 } 8358 8359 if ( isFunction( value ) ) { 8360 return this.each( function( i ) { 8361 jQuery( this ).toggleClass( 8362 value.call( this, i, getClass( this ), stateVal ), 8363 stateVal 8364 ); 8365 } ); 8366 } 8367 8368 return this.each( function() { 8369 var className, i, self, classNames; 8370 8371 if ( isValidValue ) { 8372 8373 // Toggle individual class names 8374 i = 0; 8375 self = jQuery( this ); 8376 classNames = classesToArray( value ); 8377 8378 while ( ( className = classNames[ i++ ] ) ) { 8379 8380 // Check each className given, space separated list 8381 if ( self.hasClass( className ) ) { 8382 self.removeClass( className ); 8383 } else { 8384 self.addClass( className ); 8385 } 8386 } 8387 8388 // Toggle whole class name 8389 } else if ( value === undefined || type === "boolean" ) { 8390 className = getClass( this ); 8391 if ( className ) { 8392 8393 // Store className if set 8394 dataPriv.set( this, "__className__", className ); 8395 } 8396 8397 // If the element has a class name or if we're passed `false`, 8398 // then remove the whole classname (if there was one, the above saved it). 8399 // Otherwise bring back whatever was previously saved (if anything), 8400 // falling back to the empty string if nothing was stored. 8401 if ( this.setAttribute ) { 8402 this.setAttribute( "class", 8403 className || value === false ? 8404 "" : 8405 dataPriv.get( this, "__className__" ) || "" 8406 ); 8407 } 8408 } 8409 } ); 8410 }, 8411 8412 hasClass: function( selector ) { 8413 var className, elem, 8414 i = 0; 8415 8416 className = " " + selector + " "; 8417 while ( ( elem = this[ i++ ] ) ) { 8418 if ( elem.nodeType === 1 && 8419 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 8420 return true; 8421 } 8422 } 8423 8424 return false;
vendor: 1,385 bytes, lines 8425-8494
8425 } 8426} ); 8427 8428 8429 8430 8431var rreturn = /\r/g; 8432 8433jQuery.fn.extend( { 8434 val: function( value ) { 8435 var hooks, ret, valueIsFunction, 8436 elem = this[ 0 ]; 8437 8438 if ( !arguments.length ) { 8439 if ( elem ) { 8440 hooks = jQuery.valHooks[ elem.type ] || 8441 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 8442 8443 if ( hooks && 8444 "get" in hooks && 8445 ( ret = hooks.get( elem, "value" ) ) !== undefined 8446 ) { 8447 return ret; 8448 } 8449 8450 ret = elem.value; 8451 8452 // Handle most common string cases 8453 if ( typeof ret === "string" ) { 8454 return ret.replace( rreturn, "" ); 8455 } 8456 8457 // Handle cases where value is null/undef or number 8458 return ret == null ? "" : ret; 8459 } 8460 8461 return; 8462 } 8463 8464 valueIsFunction = isFunction( value ); 8465 8466 return this.each( function( i ) { 8467 var val; 8468 8469 if ( this.nodeType !== 1 ) { 8470 return; 8471 } 8472 8473 if ( valueIsFunction ) { 8474 val = value.call( this, i, jQuery( this ).val() ); 8475 } else { 8476 val = value; 8477 } 8478 8479 // Treat null/undefined as ""; convert numbers to string 8480 if ( val == null ) { 8481 val = ""; 8482 8483 } else if ( typeof val === "number" ) { 8484 val += ""; 8485 8486 } else if ( Array.isArray( val ) ) { 8487 val = jQuery.map( val, function( value ) { 8488 return value == null ? "" : value + ""; 8489 } ); 8490 } 8491 8492 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 8493 8494 // If set returns undefined, fall back to normal setting
vendor: 5,706 bytes, lines 8495-8710
8495 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 8496 this.value = val; 8497 } 8498 } ); 8499 } 8500} ); 8501 8502jQuery.extend( { 8503 valHooks: { 8504 option: { 8505 get: function( elem ) { 8506 8507 var val = jQuery.find.attr( elem, "value" ); 8508 return val != null ? 8509 val : 8510 8511 // Support: IE <=10 - 11 only 8512 // option.text throws exceptions (#14686, #14858) 8513 // Strip and collapse whitespace 8514 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 8515 stripAndCollapse( jQuery.text( elem ) ); 8516 } 8517 }, 8518 select: { 8519 get: function( elem ) { 8520 var value, option, i, 8521 options = elem.options, 8522 index = elem.selectedIndex, 8523 one = elem.type === "select-one", 8524 values = one ? null : [], 8525 max = one ? index + 1 : options.length; 8526 8527 if ( index < 0 ) { 8528 i = max; 8529 8530 } else { 8531 i = one ? index : 0; 8532 } 8533 8534 // Loop through all the selected options 8535 for ( ; i < max; i++ ) { 8536 option = options[ i ]; 8537 8538 // Support: IE <=9 only 8539 // IE8-9 doesn't update selected after form reset (#2551) 8540 if ( ( option.selected || i === index ) && 8541 8542 // Don't return options that are disabled or in a disabled optgroup 8543 !option.disabled && 8544 ( !option.parentNode.disabled || 8545 !nodeName( option.parentNode, "optgroup" ) ) ) { 8546 8547 // Get the specific value for the option 8548 value = jQuery( option ).val(); 8549 8550 // We don't need an array for one selects 8551 if ( one ) { 8552 return value; 8553 } 8554 8555 // Multi-Selects return an array 8556 values.push( value ); 8557 } 8558 } 8559 8560 return values; 8561 }, 8562 8563 set: function( elem, value ) { 8564 var optionSet, option, 8565 options = elem.options, 8566 values = jQuery.makeArray( value ), 8567 i = options.length; 8568 8569 while ( i-- ) { 8570 option = options[ i ]; 8571 8572 /* eslint-disable no-cond-assign */ 8573 8574 if ( option.selected = 8575 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 8576 ) { 8577 optionSet = true; 8578 } 8579 8580 /* eslint-enable no-cond-assign */ 8581 } 8582 8583 // Force browsers to behave consistently when non-matching value is set 8584 if ( !optionSet ) { 8585 elem.selectedIndex = -1; 8586 } 8587 return values; 8588 } 8589 } 8590 } 8591} ); 8592 8593// Radios and checkboxes getter/setter 8594jQuery.each( [ "radio", "checkbox" ], function() { 8595 jQuery.valHooks[ this ] = { 8596 set: function( elem, value ) { 8597 if ( Array.isArray( value ) ) { 8598 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 8599 } 8600 } 8601 }; 8602 if ( !support.checkOn ) { 8603 jQuery.valHooks[ this ].get = function( elem ) { 8604 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 8605 }; 8606 } 8607} ); 8608 8609 8610 8611 8612// Return jQuery for attributes-only inclusion 8613 8614 8615support.focusin = "onfocusin" in window; 8616 8617 8618var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 8619 stopPropagationCallback = function( e ) { 8620 e.stopPropagation(); 8621 }; 8622 8623jQuery.extend( jQuery.event, { 8624 8625 trigger: function( event, data, elem, onlyHandlers ) { 8626 8627 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 8628 eventPath = [ elem || document ], 8629 type = hasOwn.call( event, "type" ) ? event.type : event, 8630 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 8631 8632 cur = lastElement = tmp = elem = elem || document; 8633 8634 // Don't do events on text and comment nodes 8635 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 8636 return; 8637 } 8638 8639 // focus/blur morphs to focusin/out; ensure we're not firing them right now 8640 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 8641 return; 8642 } 8643 8644 if ( type.indexOf( "." ) > -1 ) { 8645 8646 // Namespaced trigger; create a regexp to match event type in handle() 8647 namespaces = type.split( "." ); 8648 type = namespaces.shift(); 8649 namespaces.sort(); 8650 } 8651 ontype = type.indexOf( ":" ) < 0 && "on" + type; 8652 8653 // Caller can pass in a jQuery.Event object, Object, or just an event type string 8654 event = event[ jQuery.expando ] ? 8655 event : 8656 new jQuery.Event( type, typeof event === "object" && event ); 8657 8658 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 8659 event.isTrigger = onlyHandlers ? 2 : 3; 8660 event.namespace = namespaces.join( "." ); 8661 event.rnamespace = event.namespace ? 8662 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 8663 null; 8664 8665 // Clean up the event in case it is being reused 8666 event.result = undefined; 8667 if ( !event.target ) { 8668 event.target = elem; 8669 } 8670 8671 // Clone any incoming data and prepend the event, creating the handler arg list 8672 data = data == null ? 8673 [ event ] : 8674 jQuery.makeArray( data, [ event ] ); 8675 8676 // Allow special events to draw outside the lines 8677 special = jQuery.event.special[ type ] || {}; 8678 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 8679 return; 8680 } 8681 8682 // Determine event propagation path in advance, per W3C events spec (#9951) 8683 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 8684 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 8685 8686 bubbleType = special.delegateType || type; 8687 if ( !rfocusMorph.test( bubbleType + type ) ) { 8688 cur = cur.parentNode; 8689 } 8690 for ( ; cur; cur = cur.parentNode ) { 8691 eventPath.push( cur ); 8692 tmp = cur; 8693 } 8694 8695 // Only add window if we got to document (e.g., not plain obj or detached DOM) 8696 if ( tmp === ( elem.ownerDocument || document ) ) { 8697 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 8698 } 8699 } 8700 8701 // Fire handlers on the event path 8702 i = 0; 8703 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 8704 lastElement = cur; 8705 event.type = i > 1 ? 8706 bubbleType : 8707 special.bindType || type; 8708 8709 // jQuery handler 8710 handle = (
vendor: 2,548 bytes, lines 8710-8811
8710 8711 dataPriv.get( cur, "events" ) || Object.create( null ) 8712 )[ event.type ] && 8713 dataPriv.get( cur, "handle" ); 8714 if ( handle ) { 8715 handle.apply( cur, data ); 8716 } 8717 8718 // Native handler 8719 handle = ontype && cur[ ontype ]; 8720 if ( handle && handle.apply && acceptData( cur ) ) { 8721 event.result = handle.apply( cur, data ); 8722 if ( event.result === false ) { 8723 event.preventDefault(); 8724 } 8725 } 8726 } 8727 event.type = type; 8728 8729 // If nobody prevented the default action, do it now 8730 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 8731 8732 if ( ( !special._default || 8733 special._default.apply( eventPath.pop(), data ) === false ) && 8734 acceptData( elem ) ) { 8735 8736 // Call a native DOM method on the target with the same name as the event. 8737 // Don't do default actions on window, that's where global variables be (#6170) 8738 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 8739 8740 // Don't re-trigger an onFOO event when we call its FOO() method 8741 tmp = elem[ ontype ]; 8742 8743 if ( tmp ) { 8744 elem[ ontype ] = null; 8745 } 8746 8747 // Prevent re-triggering of the same event, since we already bubbled it above 8748 jQuery.event.triggered = type; 8749 8750 if ( event.isPropagationStopped() ) { 8751 lastElement.addEventListener( type, stopPropagationCallback ); 8752 } 8753 8754 elem[ type ](); 8755 8756 if ( event.isPropagationStopped() ) { 8757 lastElement.removeEventListener( type, stopPropagationCallback ); 8758 } 8759 8760 jQuery.event.triggered = undefined; 8761 8762 if ( tmp ) { 8763 elem[ ontype ] = tmp; 8764 } 8765 } 8766 } 8767 } 8768 8769 return event.result; 8770 }, 8771 8772 // Piggyback on a donor event to simulate a different one 8773 // Used only for `focus(in | out)` events 8774 simulate: function( type, elem, event ) { 8775 var e = jQuery.extend( 8776 new jQuery.Event(), 8777 event, 8778 { 8779 type: type, 8780 isSimulated: true 8781 } 8782 ); 8783 8784 jQuery.event.trigger( e, null, elem ); 8785 } 8786 8787} ); 8788 8789jQuery.fn.extend( { 8790 8791 trigger: function( type, data ) { 8792 return this.each( function() { 8793 jQuery.event.trigger( type, data, this ); 8794 } ); 8795 }, 8796 triggerHandler: function( type, data ) { 8797 var elem = this[ 0 ]; 8798 if ( elem ) { 8799 return jQuery.event.trigger( type, data, elem, true ); 8800 } 8801 } 8802} ); 8803 8804 8805// Support: Firefox <=44 8806// Firefox doesn't have focus(in | out) events 8807// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 8808// 8809// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 8810// focus(in | out) events fire after focus & blur events, 8811// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
vendor: 4,078 bytes, lines 8812-8977
8812// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 8813if ( !support.focusin ) { 8814 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { 8815 8816 // Attach a single capturing handler on the document while someone wants focusin/focusout 8817 var handler = function( event ) { 8818 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); 8819 }; 8820 8821 jQuery.event.special[ fix ] = { 8822 setup: function() { 8823 8824 // Handle: regular nodes (via `this.ownerDocument`), window 8825 // (via `this.document`) & document (via `this`). 8826 var doc = this.ownerDocument || this.document || this, 8827 attaches = dataPriv.access( doc, fix ); 8828 8829 if ( !attaches ) { 8830 doc.addEventListener( orig, handler, true ); 8831 } 8832 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); 8833 }, 8834 teardown: function() { 8835 var doc = this.ownerDocument || this.document || this, 8836 attaches = dataPriv.access( doc, fix ) - 1; 8837 8838 if ( !attaches ) { 8839 doc.removeEventListener( orig, handler, true ); 8840 dataPriv.remove( doc, fix ); 8841 8842 } else { 8843 dataPriv.access( doc, fix, attaches ); 8844 } 8845 } 8846 }; 8847 } ); 8848} 8849var location = window.location; 8850 8851var nonce = { guid: Date.now() }; 8852 8853var rquery = ( /\?/ ); 8854 8855 8856 8857// Cross-browser xml parsing 8858jQuery.parseXML = function( data ) { 8859 var xml; 8860 if ( !data || typeof data !== "string" ) { 8861 return null; 8862 } 8863 8864 // Support: IE 9 - 11 only 8865 // IE throws on parseFromString with invalid input. 8866 try { 8867 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 8868 } catch ( e ) { 8869 xml = undefined; 8870 } 8871 8872 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { 8873 jQuery.error( "Invalid XML: " + data ); 8874 } 8875 return xml; 8876}; 8877 8878 8879var 8880 rbracket = /\[\]$/, 8881 rCRLF = /\r?\n/g, 8882 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 8883 rsubmittable = /^(?:input|select|textarea|keygen)/i; 8884 8885function buildParams( prefix, obj, traditional, add ) { 8886 var name; 8887 8888 if ( Array.isArray( obj ) ) { 8889 8890 // Serialize array item. 8891 jQuery.each( obj, function( i, v ) { 8892 if ( traditional || rbracket.test( prefix ) ) { 8893 8894 // Treat each array item as a scalar. 8895 add( prefix, v ); 8896 8897 } else { 8898 8899 // Item is non-scalar (array or object), encode its numeric index. 8900 buildParams( 8901 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 8902 v, 8903 traditional, 8904 add 8905 ); 8906 } 8907 } ); 8908 8909 } else if ( !traditional && toType( obj ) === "object" ) { 8910 8911 // Serialize object item. 8912 for ( name in obj ) { 8913 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 8914 } 8915 8916 } else { 8917 8918 // Serialize scalar item. 8919 add( prefix, obj ); 8920 } 8921} 8922 8923// Serialize an array of form elements or a set of 8924// key/values into a query string 8925jQuery.param = function( a, traditional ) { 8926 var prefix, 8927 s = [], 8928 add = function( key, valueOrFunction ) { 8929 8930 // If value is a function, invoke it and use its return value 8931 var value = isFunction( valueOrFunction ) ? 8932 valueOrFunction() : 8933 valueOrFunction; 8934 8935 s[ s.length ] = encodeURIComponent( key ) + "=" + 8936 encodeURIComponent( value == null ? "" : value ); 8937 }; 8938 8939 if ( a == null ) { 8940 return ""; 8941 } 8942 8943 // If an array was passed in, assume that it is an array of form elements. 8944 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 8945 8946 // Serialize the form elements 8947 jQuery.each( a, function() { 8948 add( this.name, this.value ); 8949 } ); 8950 8951 } else { 8952 8953 // If traditional, encode the "old" way (the way 1.3.2 or older 8954 // did it), otherwise encode params recursively. 8955 for ( prefix in a ) { 8956 buildParams( prefix, a[ prefix ], traditional, add ); 8957 } 8958 } 8959 8960 // Return the resulting serialization 8961 return s.join( "&" ); 8962}; 8963 8964jQuery.fn.extend( { 8965 serialize: function() { 8966 return jQuery.param( this.serializeArray() ); 8967 }, 8968 serializeArray: function() { 8969 return this.map( function() { 8970 8971 // Can add propHook for "elements" to filter or add form elements 8972 var elements = jQuery.prop( this, "elements" ); 8973 return elements ? jQuery.makeArray( elements ) : this; 8974 } ) 8975 .filter( function() { 8976 var type = this.type; 8977
vendor: 4,933 bytes, lines 8978-9150
8978 // Use .is( ":disabled" ) so that fieldset[disabled] works 8979 return this.name && !jQuery( this ).is( ":disabled" ) && 8980 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 8981 ( this.checked || !rcheckableType.test( type ) ); 8982 } ) 8983 .map( function( _i, elem ) { 8984 var val = jQuery( this ).val(); 8985 8986 if ( val == null ) { 8987 return null; 8988 } 8989 8990 if ( Array.isArray( val ) ) { 8991 return jQuery.map( val, function( val ) { 8992 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 8993 } ); 8994 } 8995 8996 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 8997 } ).get(); 8998 } 8999} ); 9000 9001 9002var 9003 r20 = /%20/g, 9004 rhash = /#.*$/, 9005 rantiCache = /([?&])_=[^&]*/, 9006 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 9007 9008 // #7653, #8125, #8152: local protocol detection 9009 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 9010 rnoContent = /^(?:GET|HEAD)$/, 9011 rprotocol = /^\/\//, 9012 9013 /* Prefilters 9014 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 9015 * 2) These are called: 9016 * - BEFORE asking for a transport 9017 * - AFTER param serialization (s.data is a string if s.processData is true) 9018 * 3) key is the dataType 9019 * 4) the catchall symbol "*" can be used 9020 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 9021 */ 9022 prefilters = {}, 9023 9024 /* Transports bindings 9025 * 1) key is the dataType 9026 * 2) the catchall symbol "*" can be used 9027 * 3) selection will start with transport dataType and THEN go to "*" if needed 9028 */ 9029 transports = {}, 9030 9031 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 9032 allTypes = "*/".concat( "*" ), 9033 9034 // Anchor tag for parsing the document origin 9035 originAnchor = document.createElement( "a" ); 9036 originAnchor.href = location.href; 9037 9038// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 9039function addToPrefiltersOrTransports( structure ) { 9040 9041 // dataTypeExpression is optional and defaults to "*" 9042 return function( dataTypeExpression, func ) { 9043 9044 if ( typeof dataTypeExpression !== "string" ) { 9045 func = dataTypeExpression; 9046 dataTypeExpression = "*"; 9047 } 9048 9049 var dataType, 9050 i = 0, 9051 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 9052 9053 if ( isFunction( func ) ) { 9054 9055 // For each dataType in the dataTypeExpression 9056 while ( ( dataType = dataTypes[ i++ ] ) ) { 9057 9058 // Prepend if requested 9059 if ( dataType[ 0 ] === "+" ) { 9060 dataType = dataType.slice( 1 ) || "*"; 9061 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 9062 9063 // Otherwise append 9064 } else { 9065 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 9066 } 9067 } 9068 } 9069 }; 9070} 9071 9072// Base inspection function for prefilters and transports 9073function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 9074 9075 var inspected = {}, 9076 seekingTransport = ( structure === transports ); 9077 9078 function inspect( dataType ) { 9079 var selected; 9080 inspected[ dataType ] = true; 9081 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 9082 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 9083 if ( typeof dataTypeOrTransport === "string" && 9084 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 9085 9086 options.dataTypes.unshift( dataTypeOrTransport ); 9087 inspect( dataTypeOrTransport ); 9088 return false; 9089 } else if ( seekingTransport ) { 9090 return !( selected = dataTypeOrTransport ); 9091 } 9092 } ); 9093 return selected; 9094 } 9095 9096 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 9097} 9098 9099// A special extend for ajax options 9100// that takes "flat" options (not to be deep extended) 9101// Fixes #9887 9102function ajaxExtend( target, src ) { 9103 var key, deep, 9104 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 9105 9106 for ( key in src ) { 9107 if ( src[ key ] !== undefined ) { 9108 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 9109 } 9110 } 9111 if ( deep ) { 9112 jQuery.extend( true, target, deep ); 9113 } 9114 9115 return target; 9116} 9117 9118/* Handles responses to an ajax request: 9119 * - finds the right dataType (mediates between content-type and expected dataType) 9120 * - returns the corresponding response 9121 */ 9122function ajaxHandleResponses( s, jqXHR, responses ) { 9123 9124 var ct, type, finalDataType, firstDataType, 9125 contents = s.contents, 9126 dataTypes = s.dataTypes; 9127 9128 // Remove auto dataType and get content-type in the process 9129 while ( dataTypes[ 0 ] === "*" ) { 9130 dataTypes.shift(); 9131 if ( ct === undefined ) { 9132 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 9133 } 9134 } 9135 9136 // Check if we're dealing with a known content-type 9137 if ( ct ) { 9138 for ( type in contents ) { 9139 if ( contents[ type ] && contents[ type ].test( ct ) ) { 9140 dataTypes.unshift( type ); 9141 break; 9142 } 9143 } 9144 } 9145 9146 // Check to see if we have a response for the expected dataType 9147 if ( dataTypes[ 0 ] in responses ) { 9148 finalDataType = dataTypes[ 0 ]; 9149 } else { 9150
vendor: 9,145 bytes, lines 9151-9526
9151 // Try convertible dataTypes 9152 for ( type in responses ) { 9153 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 9154 finalDataType = type; 9155 break; 9156 } 9157 if ( !firstDataType ) { 9158 firstDataType = type; 9159 } 9160 } 9161 9162 // Or just use first one 9163 finalDataType = finalDataType || firstDataType; 9164 } 9165 9166 // If we found a dataType 9167 // We add the dataType to the list if needed 9168 // and return the corresponding response 9169 if ( finalDataType ) { 9170 if ( finalDataType !== dataTypes[ 0 ] ) { 9171 dataTypes.unshift( finalDataType ); 9172 } 9173 return responses[ finalDataType ]; 9174 } 9175} 9176 9177/* Chain conversions given the request and the original response 9178 * Also sets the responseXXX fields on the jqXHR instance 9179 */ 9180function ajaxConvert( s, response, jqXHR, isSuccess ) { 9181 var conv2, current, conv, tmp, prev, 9182 converters = {}, 9183 9184 // Work with a copy of dataTypes in case we need to modify it for conversion 9185 dataTypes = s.dataTypes.slice(); 9186 9187 // Create converters map with lowercased keys 9188 if ( dataTypes[ 1 ] ) { 9189 for ( conv in s.converters ) { 9190 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 9191 } 9192 } 9193 9194 current = dataTypes.shift(); 9195 9196 // Convert to each sequential dataType 9197 while ( current ) { 9198 9199 if ( s.responseFields[ current ] ) { 9200 jqXHR[ s.responseFields[ current ] ] = response; 9201 } 9202 9203 // Apply the dataFilter if provided 9204 if ( !prev && isSuccess && s.dataFilter ) { 9205 response = s.dataFilter( response, s.dataType ); 9206 } 9207 9208 prev = current; 9209 current = dataTypes.shift(); 9210 9211 if ( current ) { 9212 9213 // There's only work to do if current dataType is non-auto 9214 if ( current === "*" ) { 9215 9216 current = prev; 9217 9218 // Convert response if prev dataType is non-auto and differs from current 9219 } else if ( prev !== "*" && prev !== current ) { 9220 9221 // Seek a direct converter 9222 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 9223 9224 // If none found, seek a pair 9225 if ( !conv ) { 9226 for ( conv2 in converters ) { 9227 9228 // If conv2 outputs current 9229 tmp = conv2.split( " " ); 9230 if ( tmp[ 1 ] === current ) { 9231 9232 // If prev can be converted to accepted input 9233 conv = converters[ prev + " " + tmp[ 0 ] ] || 9234 converters[ "* " + tmp[ 0 ] ]; 9235 if ( conv ) { 9236 9237 // Condense equivalence converters 9238 if ( conv === true ) { 9239 conv = converters[ conv2 ]; 9240 9241 // Otherwise, insert the intermediate dataType 9242 } else if ( converters[ conv2 ] !== true ) { 9243 current = tmp[ 0 ]; 9244 dataTypes.unshift( tmp[ 1 ] ); 9245 } 9246 break; 9247 } 9248 } 9249 } 9250 } 9251 9252 // Apply converter (if not an equivalence) 9253 if ( conv !== true ) { 9254 9255 // Unless errors are allowed to bubble, catch and return them 9256 if ( conv && s.throws ) { 9257 response = conv( response ); 9258 } else { 9259 try { 9260 response = conv( response ); 9261 } catch ( e ) { 9262 return { 9263 state: "parsererror", 9264 error: conv ? e : "No conversion from " + prev + " to " + current 9265 }; 9266 } 9267 } 9268 } 9269 } 9270 } 9271 } 9272 9273 return { state: "success", data: response }; 9274} 9275 9276jQuery.extend( { 9277 9278 // Counter for holding the number of active queries 9279 active: 0, 9280 9281 // Last-Modified header cache for next request 9282 lastModified: {}, 9283 etag: {}, 9284 9285 ajaxSettings: { 9286 url: location.href, 9287 type: "GET", 9288 isLocal: rlocalProtocol.test( location.protocol ), 9289 global: true, 9290 processData: true, 9291 async: true, 9292 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 9293 9294 /* 9295 timeout: 0, 9296 data: null, 9297 dataType: null, 9298 username: null, 9299 password: null, 9300 cache: null, 9301 throws: false, 9302 traditional: false, 9303 headers: {}, 9304 */ 9305 9306 accepts: { 9307 "*": allTypes, 9308 text: "text/plain", 9309 html: "text/html", 9310 xml: "application/xml, text/xml", 9311 json: "application/json, text/javascript" 9312 }, 9313 9314 contents: { 9315 xml: /\bxml\b/, 9316 html: /\bhtml/, 9317 json: /\bjson\b/ 9318 }, 9319 9320 responseFields: { 9321 xml: "responseXML", 9322 text: "responseText", 9323 json: "responseJSON" 9324 }, 9325 9326 // Data converters 9327 // Keys separate source (or catchall "*") and destination types with a single space 9328 converters: { 9329 9330 // Convert anything to text 9331 "* text": String, 9332 9333 // Text to html (true = no transformation) 9334 "text html": true, 9335 9336 // Evaluate text as a json expression 9337 "text json": JSON.parse, 9338 9339 // Parse text as xml 9340 "text xml": jQuery.parseXML 9341 }, 9342 9343 // For options that shouldn't be deep extended: 9344 // you can add your own custom options here if 9345 // and when you create one that shouldn't be 9346 // deep extended (see ajaxExtend) 9347 flatOptions: { 9348 url: true, 9349 context: true 9350 } 9351 }, 9352 9353 // Creates a full fledged settings object into target 9354 // with both ajaxSettings and settings fields. 9355 // If target is omitted, writes into ajaxSettings. 9356 ajaxSetup: function( target, settings ) { 9357 return settings ? 9358 9359 // Building a settings object 9360 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 9361 9362 // Extending ajaxSettings 9363 ajaxExtend( jQuery.ajaxSettings, target ); 9364 }, 9365 9366 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 9367 ajaxTransport: addToPrefiltersOrTransports( transports ), 9368 9369 // Main method 9370 ajax: function( url, options ) { 9371 9372 // If url is an object, simulate pre-1.5 signature 9373 if ( typeof url === "object" ) { 9374 options = url; 9375 url = undefined; 9376 } 9377 9378 // Force options to be an object 9379 options = options || {}; 9380 9381 var transport, 9382 9383 // URL without anti-cache param 9384 cacheURL, 9385 9386 // Response headers 9387 responseHeadersString, 9388 responseHeaders, 9389 9390 // timeout handle 9391 timeoutTimer, 9392 9393 // Url cleanup var 9394 urlAnchor, 9395 9396 // Request state (becomes false upon send and true upon completion) 9397 completed, 9398 9399 // To know if global events are to be dispatched 9400 fireGlobals, 9401 9402 // Loop variable 9403 i, 9404 9405 // uncached part of the url 9406 uncached, 9407 9408 // Create the final options object 9409 s = jQuery.ajaxSetup( {}, options ), 9410 9411 // Callbacks context 9412 callbackContext = s.context || s, 9413 9414 // Context for global events is callbackContext if it is a DOM node or jQuery collection 9415 globalEventContext = s.context && 9416 ( callbackContext.nodeType || callbackContext.jquery ) ? 9417 jQuery( callbackContext ) : 9418 jQuery.event, 9419 9420 // Deferreds 9421 deferred = jQuery.Deferred(), 9422 completeDeferred = jQuery.Callbacks( "once memory" ), 9423 9424 // Status-dependent callbacks 9425 statusCode = s.statusCode || {}, 9426 9427 // Headers (they are sent all at once) 9428 requestHeaders = {}, 9429 requestHeadersNames = {}, 9430 9431 // Default abort message 9432 strAbort = "canceled", 9433 9434 // Fake xhr 9435 jqXHR = { 9436 readyState: 0, 9437 9438 // Builds headers hashtable if needed 9439 getResponseHeader: function( key ) { 9440 var match; 9441 if ( completed ) { 9442 if ( !responseHeaders ) { 9443 responseHeaders = {}; 9444 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 9445 responseHeaders[ match[ 1 ].toLowerCase() + " " ] = 9446 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) 9447 .concat( match[ 2 ] ); 9448 } 9449 } 9450 match = responseHeaders[ key.toLowerCase() + " " ]; 9451 } 9452 return match == null ? null : match.join( ", " ); 9453 }, 9454 9455 // Raw string 9456 getAllResponseHeaders: function() { 9457 return completed ? responseHeadersString : null; 9458 }, 9459 9460 // Caches the header 9461 setRequestHeader: function( name, value ) { 9462 if ( completed == null ) { 9463 name = requestHeadersNames[ name.toLowerCase() ] = 9464 requestHeadersNames[ name.toLowerCase() ] || name; 9465 requestHeaders[ name ] = value; 9466 } 9467 return this; 9468 }, 9469 9470 // Overrides response content-type header 9471 overrideMimeType: function( type ) { 9472 if ( completed == null ) { 9473 s.mimeType = type; 9474 } 9475 return this; 9476 }, 9477 9478 // Status-dependent callbacks 9479 statusCode: function( map ) { 9480 var code; 9481 if ( map ) { 9482 if ( completed ) { 9483 9484 // Execute the appropriate callbacks 9485 jqXHR.always( map[ jqXHR.status ] ); 9486 } else { 9487 9488 // Lazy-add the new callbacks in a way that preserves old ones 9489 for ( code in map ) { 9490 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 9491 } 9492 } 9493 } 9494 return this; 9495 }, 9496 9497 // Cancel the request 9498 abort: function( statusText ) { 9499 var finalText = statusText || strAbort; 9500 if ( transport ) { 9501 transport.abort( finalText ); 9502 } 9503 done( 0, finalText ); 9504 return this; 9505 } 9506 }; 9507 9508 // Attach deferreds 9509 deferred.promise( jqXHR ); 9510 9511 // Add protocol if not provided (prefilters might expect it) 9512 // Handle falsy url in the settings object (#10093: consistency with old signature) 9513 // We also use the url parameter if available 9514 s.url = ( ( url || s.url || location.href ) + "" ) 9515 .replace( rprotocol, location.protocol + "//" ); 9516 9517 // Alias method option to type as per ticket #12004 9518 s.type = options.method || options.type || s.method || s.type; 9519 9520 // Extract dataTypes list 9521 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 9522 9523 // A cross-domain request is in order when the origin doesn't match the current origin. 9524 if ( s.crossDomain == null ) { 9525 urlAnchor = document.createElement( "a" ); 9526
vendor: 9,576 bytes, lines 9527-9875
9527 // Support: IE <=8 - 11, Edge 12 - 15 9528 // IE throws exception on accessing the href property if url is malformed, 9529 // e.g. http://example.com:80x/ 9530 try { 9531 urlAnchor.href = s.url; 9532 9533 // Support: IE <=8 - 11 only 9534 // Anchor's host property isn't correctly set when s.url is relative 9535 urlAnchor.href = urlAnchor.href; 9536 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 9537 urlAnchor.protocol + "//" + urlAnchor.host; 9538 } catch ( e ) { 9539 9540 // If there is an error parsing the URL, assume it is crossDomain, 9541 // it can be rejected by the transport if it is invalid 9542 s.crossDomain = true; 9543 } 9544 } 9545 9546 // Convert data if not already a string 9547 if ( s.data && s.processData && typeof s.data !== "string" ) { 9548 s.data = jQuery.param( s.data, s.traditional ); 9549 } 9550 9551 // Apply prefilters 9552 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 9553 9554 // If request was aborted inside a prefilter, stop there 9555 if ( completed ) { 9556 return jqXHR; 9557 } 9558 9559 // We can fire global events as of now if asked to 9560 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) 9561 fireGlobals = jQuery.event && s.global; 9562 9563 // Watch for a new set of requests 9564 if ( fireGlobals && jQuery.active++ === 0 ) { 9565 jQuery.event.trigger( "ajaxStart" ); 9566 } 9567 9568 // Uppercase the type 9569 s.type = s.type.toUpperCase(); 9570 9571 // Determine if request has content 9572 s.hasContent = !rnoContent.test( s.type ); 9573 9574 // Save the URL in case we're toying with the If-Modified-Since 9575 // and/or If-None-Match header later on 9576 // Remove hash to simplify url manipulation 9577 cacheURL = s.url.replace( rhash, "" ); 9578 9579 // More options handling for requests with no content 9580 if ( !s.hasContent ) { 9581 9582 // Remember the hash so we can put it back 9583 uncached = s.url.slice( cacheURL.length ); 9584 9585 // If data is available and should be processed, append data to url 9586 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 9587 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 9588 9589 // #9682: remove data so that it's not used in an eventual retry 9590 delete s.data; 9591 } 9592 9593 // Add or update anti-cache param if needed 9594 if ( s.cache === false ) { 9595 cacheURL = cacheURL.replace( rantiCache, "$1" ); 9596 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + 9597 uncached; 9598 } 9599 9600 // Put hash and anti-cache on the URL that will be requested (gh-1732) 9601 s.url = cacheURL + uncached; 9602 9603 // Change '%20' to '+' if this is encoded form body content (gh-2658) 9604 } else if ( s.data && s.processData && 9605 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 9606 s.data = s.data.replace( r20, "+" ); 9607 } 9608 9609 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9610 if ( s.ifModified ) { 9611 if ( jQuery.lastModified[ cacheURL ] ) { 9612 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 9613 } 9614 if ( jQuery.etag[ cacheURL ] ) { 9615 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 9616 } 9617 } 9618 9619 // Set the correct header, if data is being sent 9620 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 9621 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 9622 } 9623 9624 // Set the Accepts header for the server, depending on the dataType 9625 jqXHR.setRequestHeader( 9626 "Accept", 9627 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 9628 s.accepts[ s.dataTypes[ 0 ] ] + 9629 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 9630 s.accepts[ "*" ] 9631 ); 9632 9633 // Check for headers option 9634 for ( i in s.headers ) { 9635 jqXHR.setRequestHeader( i, s.headers[ i ] ); 9636 } 9637 9638 // Allow custom headers/mimetypes and early abort 9639 if ( s.beforeSend && 9640 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 9641 9642 // Abort if not done already and return 9643 return jqXHR.abort(); 9644 } 9645 9646 // Aborting is no longer a cancellation 9647 strAbort = "abort"; 9648 9649 // Install callbacks on deferreds 9650 completeDeferred.add( s.complete ); 9651 jqXHR.done( s.success ); 9652 jqXHR.fail( s.error ); 9653 9654 // Get transport 9655 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 9656 9657 // If no transport, we auto-abort 9658 if ( !transport ) { 9659 done( -1, "No Transport" ); 9660 } else { 9661 jqXHR.readyState = 1; 9662 9663 // Send global event 9664 if ( fireGlobals ) { 9665 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 9666 } 9667 9668 // If request was aborted inside ajaxSend, stop there 9669 if ( completed ) { 9670 return jqXHR; 9671 } 9672 9673 // Timeout 9674 if ( s.async && s.timeout > 0 ) { 9675 timeoutTimer = window.setTimeout( function() { 9676 jqXHR.abort( "timeout" ); 9677 }, s.timeout ); 9678 } 9679 9680 try { 9681 completed = false; 9682 transport.send( requestHeaders, done ); 9683 } catch ( e ) { 9684 9685 // Rethrow post-completion exceptions 9686 if ( completed ) { 9687 throw e; 9688 } 9689 9690 // Propagate others as results 9691 done( -1, e ); 9692 } 9693 } 9694 9695 // Callback for when everything is done 9696 function done( status, nativeStatusText, responses, headers ) { 9697 var isSuccess, success, error, response, modified, 9698 statusText = nativeStatusText; 9699 9700 // Ignore repeat invocations 9701 if ( completed ) { 9702 return; 9703 } 9704 9705 completed = true; 9706 9707 // Clear timeout if it exists 9708 if ( timeoutTimer ) { 9709 window.clearTimeout( timeoutTimer ); 9710 } 9711 9712 // Dereference transport for early garbage collection 9713 // (no matter how long the jqXHR object will be used) 9714 transport = undefined; 9715 9716 // Cache response headers 9717 responseHeadersString = headers || ""; 9718 9719 // Set readyState 9720 jqXHR.readyState = status > 0 ? 4 : 0; 9721 9722 // Determine if successful 9723 isSuccess = status >= 200 && status < 300 || status === 304; 9724 9725 // Get response data 9726 if ( responses ) { 9727 response = ajaxHandleResponses( s, jqXHR, responses ); 9728 } 9729 9730 // Use a noop converter for missing script 9731 if ( !isSuccess && jQuery.inArray( "script", s.dataTypes ) > -1 ) { 9732 s.converters[ "text script" ] = function() {}; 9733 } 9734 9735 // Convert no matter what (that way responseXXX fields are always set) 9736 response = ajaxConvert( s, response, jqXHR, isSuccess ); 9737 9738 // If successful, handle type chaining 9739 if ( isSuccess ) { 9740 9741 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9742 if ( s.ifModified ) { 9743 modified = jqXHR.getResponseHeader( "Last-Modified" ); 9744 if ( modified ) { 9745 jQuery.lastModified[ cacheURL ] = modified; 9746 } 9747 modified = jqXHR.getResponseHeader( "etag" ); 9748 if ( modified ) { 9749 jQuery.etag[ cacheURL ] = modified; 9750 } 9751 } 9752 9753 // if no content 9754 if ( status === 204 || s.type === "HEAD" ) { 9755 statusText = "nocontent"; 9756 9757 // if not modified 9758 } else if ( status === 304 ) { 9759 statusText = "notmodified"; 9760 9761 // If we have data, let's convert it 9762 } else { 9763 statusText = response.state; 9764 success = response.data; 9765 error = response.error; 9766 isSuccess = !error; 9767 } 9768 } else { 9769 9770 // Extract error from statusText and normalize for non-aborts 9771 error = statusText; 9772 if ( status || !statusText ) { 9773 statusText = "error"; 9774 if ( status < 0 ) { 9775 status = 0; 9776 } 9777 } 9778 } 9779 9780 // Set data for the fake xhr object 9781 jqXHR.status = status; 9782 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 9783 9784 // Success/Error 9785 if ( isSuccess ) { 9786 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 9787 } else { 9788 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 9789 } 9790 9791 // Status-dependent callbacks 9792 jqXHR.statusCode( statusCode ); 9793 statusCode = undefined; 9794 9795 if ( fireGlobals ) { 9796 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 9797 [ jqXHR, s, isSuccess ? success : error ] ); 9798 } 9799 9800 // Complete 9801 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 9802 9803 if ( fireGlobals ) { 9804 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 9805 9806 // Handle the global AJAX counter 9807 if ( !( --jQuery.active ) ) { 9808 jQuery.event.trigger( "ajaxStop" ); 9809 } 9810 } 9811 } 9812 9813 return jqXHR; 9814 }, 9815 9816 getJSON: function( url, data, callback ) { 9817 return jQuery.get( url, data, callback, "json" ); 9818 }, 9819 9820 getScript: function( url, callback ) { 9821 return jQuery.get( url, undefined, callback, "script" ); 9822 } 9823} ); 9824 9825jQuery.each( [ "get", "post" ], function( _i, method ) { 9826 jQuery[ method ] = function( url, data, callback, type ) { 9827 9828 // Shift arguments if data argument was omitted 9829 if ( isFunction( data ) ) { 9830 type = type || callback; 9831 callback = data; 9832 data = undefined; 9833 } 9834 9835 // The url can be an options object (which then must have .url) 9836 return jQuery.ajax( jQuery.extend( { 9837 url: url, 9838 type: method, 9839 dataType: type, 9840 data: data, 9841 success: callback 9842 }, jQuery.isPlainObject( url ) && url ) ); 9843 }; 9844} ); 9845 9846jQuery.ajaxPrefilter( function( s ) { 9847 var i; 9848 for ( i in s.headers ) { 9849 if ( i.toLowerCase() === "content-type" ) { 9850 s.contentType = s.headers[ i ] || ""; 9851 } 9852 } 9853} ); 9854 9855 9856jQuery._evalUrl = function( url, options, doc ) { 9857 return jQuery.ajax( { 9858 url: url, 9859 9860 // Make this explicit, since user can override this through ajaxSetup (#11264) 9861 type: "GET", 9862 dataType: "script", 9863 cache: true, 9864 async: false, 9865 global: false, 9866 9867 // Only evaluate the response if it is successful (gh-4126) 9868 // dataFilter is not invoked for failure responses, so using it instead 9869 // of the default converter is kludgy but it works. 9870 converters: { 9871 "text script": function() {} 9872 }, 9873 dataFilter: function( response ) { 9874 jQuery.globalEval( response, options, doc ); 9875 }
vendor: 6,627 bytes, lines 9875-10158
9875 9876 } ); 9877}; 9878 9879 9880jQuery.fn.extend( { 9881 wrapAll: function( html ) { 9882 var wrap; 9883 9884 if ( this[ 0 ] ) { 9885 if ( isFunction( html ) ) { 9886 html = html.call( this[ 0 ] ); 9887 } 9888 9889 // The elements to wrap the target around 9890 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 9891 9892 if ( this[ 0 ].parentNode ) { 9893 wrap.insertBefore( this[ 0 ] ); 9894 } 9895 9896 wrap.map( function() { 9897 var elem = this; 9898 9899 while ( elem.firstElementChild ) { 9900 elem = elem.firstElementChild; 9901 } 9902 9903 return elem; 9904 } ).append( this ); 9905 } 9906 9907 return this; 9908 }, 9909 9910 wrapInner: function( html ) { 9911 if ( isFunction( html ) ) { 9912 return this.each( function( i ) { 9913 jQuery( this ).wrapInner( html.call( this, i ) ); 9914 } ); 9915 } 9916 9917 return this.each( function() { 9918 var self = jQuery( this ), 9919 contents = self.contents(); 9920 9921 if ( contents.length ) { 9922 contents.wrapAll( html ); 9923 9924 } else { 9925 self.append( html ); 9926 } 9927 } ); 9928 }, 9929 9930 wrap: function( html ) { 9931 var htmlIsFunction = isFunction( html ); 9932 9933 return this.each( function( i ) { 9934 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 9935 } ); 9936 }, 9937 9938 unwrap: function( selector ) { 9939 this.parent( selector ).not( "body" ).each( function() { 9940 jQuery( this ).replaceWith( this.childNodes ); 9941 } ); 9942 return this; 9943 } 9944} ); 9945 9946 9947jQuery.expr.pseudos.hidden = function( elem ) { 9948 return !jQuery.expr.pseudos.visible( elem ); 9949}; 9950jQuery.expr.pseudos.visible = function( elem ) { 9951 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 9952}; 9953 9954 9955 9956 9957jQuery.ajaxSettings.xhr = function() { 9958 try { 9959 return new window.XMLHttpRequest(); 9960 } catch ( e ) {} 9961}; 9962 9963var xhrSuccessStatus = { 9964 9965 // File protocol always yields status code 0, assume 200 9966 0: 200, 9967 9968 // Support: IE <=9 only 9969 // #1450: sometimes IE returns 1223 when it should be 204 9970 1223: 204 9971 }, 9972 xhrSupported = jQuery.ajaxSettings.xhr(); 9973 9974support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 9975support.ajax = xhrSupported = !!xhrSupported; 9976 9977jQuery.ajaxTransport( function( options ) { 9978 var callback, errorCallback; 9979 9980 // Cross domain only allowed if supported through XMLHttpRequest 9981 if ( support.cors || xhrSupported && !options.crossDomain ) { 9982 return { 9983 send: function( headers, complete ) { 9984 var i, 9985 xhr = options.xhr(); 9986 9987 xhr.open( 9988 options.type, 9989 options.url, 9990 options.async, 9991 options.username, 9992 options.password 9993 ); 9994 9995 // Apply custom fields if provided 9996 if ( options.xhrFields ) { 9997 for ( i in options.xhrFields ) { 9998 xhr[ i ] = options.xhrFields[ i ]; 9999 } 10000 } 10001 10002 // Override mime type if needed 10003 if ( options.mimeType && xhr.overrideMimeType ) { 10004 xhr.overrideMimeType( options.mimeType ); 10005 } 10006 10007 // X-Requested-With header 10008 // For cross-domain requests, seeing as conditions for a preflight are 10009 // akin to a jigsaw puzzle, we simply never set it to be sure. 10010 // (it can always be set on a per-request basis or even using ajaxSetup) 10011 // For same-domain requests, won't change header if already provided. 10012 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 10013 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 10014 } 10015 10016 // Set headers 10017 for ( i in headers ) { 10018 xhr.setRequestHeader( i, headers[ i ] ); 10019 } 10020 10021 // Callback 10022 callback = function( type ) { 10023 return function() { 10024 if ( callback ) { 10025 callback = errorCallback = xhr.onload = 10026 xhr.onerror = xhr.onabort = xhr.ontimeout = 10027 xhr.onreadystatechange = null; 10028 10029 if ( type === "abort" ) { 10030 xhr.abort(); 10031 } else if ( type === "error" ) { 10032 10033 // Support: IE <=9 only 10034 // On a manual native abort, IE9 throws 10035 // errors on any property access that is not readyState 10036 if ( typeof xhr.status !== "number" ) { 10037 complete( 0, "error" ); 10038 } else { 10039 complete( 10040 10041 // File: protocol always yields status 0; see #8605, #14207 10042 xhr.status, 10043 xhr.statusText 10044 ); 10045 } 10046 } else { 10047 complete( 10048 xhrSuccessStatus[ xhr.status ] || xhr.status, 10049 xhr.statusText, 10050 10051 // Support: IE <=9 only 10052 // IE9 has no XHR2 but throws on binary (trac-11426) 10053 // For XHR2 non-text, let the caller handle it (gh-2498) 10054 ( xhr.responseType || "text" ) !== "text" || 10055 typeof xhr.responseText !== "string" ? 10056 { binary: xhr.response } : 10057 { text: xhr.responseText }, 10058 xhr.getAllResponseHeaders() 10059 ); 10060 } 10061 } 10062 }; 10063 }; 10064 10065 // Listen to events 10066 xhr.onload = callback(); 10067 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 10068 10069 // Support: IE 9 only 10070 // Use onreadystatechange to replace onabort 10071 // to handle uncaught aborts 10072 if ( xhr.onabort !== undefined ) { 10073 xhr.onabort = errorCallback; 10074 } else { 10075 xhr.onreadystatechange = function() { 10076 10077 // Check readyState before timeout as it changes 10078 if ( xhr.readyState === 4 ) { 10079 10080 // Allow onerror to be called first, 10081 // but that will not handle a native abort 10082 // Also, save errorCallback to a variable 10083 // as xhr.onerror cannot be accessed 10084 window.setTimeout( function() { 10085 if ( callback ) { 10086 errorCallback(); 10087 } 10088 } ); 10089 } 10090 }; 10091 } 10092 10093 // Create the abort callback 10094 callback = callback( "abort" ); 10095 10096 try { 10097 10098 // Do send the request (this may raise an exception) 10099 xhr.send( options.hasContent && options.data || null ); 10100 } catch ( e ) { 10101 10102 // #14683: Only rethrow if this hasn't been notified as an error yet 10103 if ( callback ) { 10104 throw e; 10105 } 10106 } 10107 }, 10108 10109 abort: function() { 10110 if ( callback ) { 10111 callback(); 10112 } 10113 } 10114 }; 10115 } 10116} ); 10117 10118 10119 10120 10121// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 10122jQuery.ajaxPrefilter( function( s ) { 10123 if ( s.crossDomain ) { 10124 s.contents.script = false; 10125 } 10126} ); 10127 10128// Install script dataType 10129jQuery.ajaxSetup( { 10130 accepts: { 10131 script: "text/javascript, application/javascript, " + 10132 "application/ecmascript, application/x-ecmascript" 10133 }, 10134 contents: { 10135 script: /\b(?:java|ecma)script\b/ 10136 }, 10137 converters: { 10138 "text script": function( text ) { 10139 jQuery.globalEval( text ); 10140 return text; 10141 } 10142 } 10143} ); 10144 10145// Handle cache's special case and crossDomain 10146jQuery.ajaxPrefilter( "script", function( s ) { 10147 if ( s.cache === undefined ) { 10148 s.cache = false; 10149 } 10150 if ( s.crossDomain ) { 10151 s.type = "GET"; 10152 } 10153} ); 10154 10155// Bind script tag hack transport 10156jQuery.ajaxTransport( "script", function( s ) { 10157 10158 // This transport only deals with cross domain
vendor: 8,379 bytes, lines 10158-10469
10158or forced-by-attrs requests 10159 if ( s.crossDomain || s.scriptAttrs ) { 10160 var script, callback; 10161 return { 10162 send: function( _, complete ) { 10163 script = jQuery( "<script>" ) 10164 .attr( s.scriptAttrs || {} ) 10165 .prop( { charset: s.scriptCharset, src: s.url } ) 10166 .on( "load error", callback = function( evt ) { 10167 script.remove(); 10168 callback = null; 10169 if ( evt ) { 10170 complete( evt.type === "error" ? 404 : 200, evt.type ); 10171 } 10172 } ); 10173 10174 // Use native DOM manipulation to avoid our domManip AJAX trickery 10175 document.head.appendChild( script[ 0 ] ); 10176 }, 10177 abort: function() { 10178 if ( callback ) { 10179 callback(); 10180 } 10181 } 10182 }; 10183 } 10184} ); 10185 10186 10187 10188 10189var oldCallbacks = [], 10190 rjsonp = /(=)\?(?=&|$)|\?\?/; 10191 10192// Default jsonp settings 10193jQuery.ajaxSetup( { 10194 jsonp: "callback", 10195 jsonpCallback: function() { 10196 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) ); 10197 this[ callback ] = true; 10198 return callback; 10199 } 10200} ); 10201 10202// Detect, normalize options and install callbacks for jsonp requests 10203jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 10204 10205 var callbackName, overwritten, responseContainer, 10206 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 10207 "url" : 10208 typeof s.data === "string" && 10209 ( s.contentType || "" ) 10210 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 10211 rjsonp.test( s.data ) && "data" 10212 ); 10213 10214 // Handle iff the expected data type is "jsonp" or we have a parameter to set 10215 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 10216 10217 // Get callback name, remembering preexisting value associated with it 10218 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 10219 s.jsonpCallback() : 10220 s.jsonpCallback; 10221 10222 // Insert callback into url or form data 10223 if ( jsonProp ) { 10224 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 10225 } else if ( s.jsonp !== false ) { 10226 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 10227 } 10228 10229 // Use data converter to retrieve json after script execution 10230 s.converters[ "script json" ] = function() { 10231 if ( !responseContainer ) { 10232 jQuery.error( callbackName + " was not called" ); 10233 } 10234 return responseContainer[ 0 ]; 10235 }; 10236 10237 // Force json dataType 10238 s.dataTypes[ 0 ] = "json"; 10239 10240 // Install callback 10241 overwritten = window[ callbackName ]; 10242 window[ callbackName ] = function() { 10243 responseContainer = arguments; 10244 }; 10245 10246 // Clean-up function (fires after converters) 10247 jqXHR.always( function() { 10248 10249 // If previous value didn't exist - remove it 10250 if ( overwritten === undefined ) { 10251 jQuery( window ).removeProp( callbackName ); 10252 10253 // Otherwise restore preexisting value 10254 } else { 10255 window[ callbackName ] = overwritten; 10256 } 10257 10258 // Save back as free 10259 if ( s[ callbackName ] ) { 10260 10261 // Make sure that re-using the options doesn't screw things around 10262 s.jsonpCallback = originalSettings.jsonpCallback; 10263 10264 // Save the callback name for future use 10265 oldCallbacks.push( callbackName ); 10266 } 10267 10268 // Call if it was a function and we have a response 10269 if ( responseContainer && isFunction( overwritten ) ) { 10270 overwritten( responseContainer[ 0 ] ); 10271 } 10272 10273 responseContainer = overwritten = undefined; 10274 } ); 10275 10276 // Delegate to script 10277 return "script"; 10278 } 10279} ); 10280 10281 10282 10283 10284// Support: Safari 8 only 10285// In Safari 8 documents created via document.implementation.createHTMLDocument 10286// collapse sibling forms: the second one becomes a child of the first one. 10287// Because of that, this security measure has to be disabled in Safari 8. 10288// https://bugs.webkit.org/show_bug.cgi?id=137337 10289support.createHTMLDocument = ( function() { 10290 var body = document.implementation.createHTMLDocument( "" ).body; 10291 body.innerHTML = "<form></form><form></form>"; 10292 return body.childNodes.length === 2; 10293} )(); 10294 10295 10296// Argument "data" should be string of html 10297// context (optional): If specified, the fragment will be created in this context, 10298// defaults to document 10299// keepScripts (optional): If true, will include scripts passed in the html string 10300jQuery.parseHTML = function( data, context, keepScripts ) { 10301 if ( typeof data !== "string" ) { 10302 return []; 10303 } 10304 if ( typeof context === "boolean" ) { 10305 keepScripts = context; 10306 context = false; 10307 } 10308 10309 var base, parsed, scripts; 10310 10311 if ( !context ) { 10312 10313 // Stop scripts or inline event handlers from being executed immediately 10314 // by using document.implementation 10315 if ( support.createHTMLDocument ) { 10316 context = document.implementation.createHTMLDocument( "" ); 10317 10318 // Set the base href for the created document 10319 // so any parsed elements with URLs 10320 // are based on the document's URL (gh-2965) 10321 base = context.createElement( "base" ); 10322 base.href = document.location.href; 10323 context.head.appendChild( base ); 10324 } else { 10325 context = document; 10326 } 10327 } 10328 10329 parsed = rsingleTag.exec( data ); 10330 scripts = !keepScripts && []; 10331 10332 // Single tag 10333 if ( parsed ) { 10334 return [ context.createElement( parsed[ 1 ] ) ]; 10335 } 10336 10337 parsed = buildFragment( [ data ], context, scripts ); 10338 10339 if ( scripts && scripts.length ) { 10340 jQuery( scripts ).remove(); 10341 } 10342 10343 return jQuery.merge( [], parsed.childNodes ); 10344}; 10345 10346 10347/** 10348 * Load a url into a page 10349 */ 10350jQuery.fn.load = function( url, params, callback ) { 10351 var selector, type, response, 10352 self = this, 10353 off = url.indexOf( " " ); 10354 10355 if ( off > -1 ) { 10356 selector = stripAndCollapse( url.slice( off ) ); 10357 url = url.slice( 0, off ); 10358 } 10359 10360 // If it's a function 10361 if ( isFunction( params ) ) { 10362 10363 // We assume that it's the callback 10364 callback = params; 10365 params = undefined; 10366 10367 // Otherwise, build a param string 10368 } else if ( params && typeof params === "object" ) { 10369 type = "POST"; 10370 } 10371 10372 // If we have elements to modify, make the request 10373 if ( self.length > 0 ) { 10374 jQuery.ajax( { 10375 url: url, 10376 10377 // If "type" variable is undefined, then "GET" method will be used. 10378 // Make value of this field explicit since 10379 // user can override it through ajaxSetup method 10380 type: type || "GET", 10381 dataType: "html", 10382 data: params 10383 } ).done( function( responseText ) { 10384 10385 // Save response for use in complete callback 10386 response = arguments; 10387 10388 self.html( selector ? 10389 10390 // If a selector was specified, locate the right elements in a dummy div 10391 // Exclude scripts to avoid IE 'Permission Denied' errors 10392 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 10393 10394 // Otherwise use the full result 10395 responseText ); 10396 10397 // If the request succeeds, this function gets "data", "status", "jqXHR" 10398 // but they are ignored because response was set above. 10399 // If it fails, this function gets "jqXHR", "status", "error" 10400 } ).always( callback && function( jqXHR, status ) { 10401 self.each( function() { 10402 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 10403 } ); 10404 } ); 10405 } 10406 10407 return this; 10408}; 10409 10410 10411 10412 10413jQuery.expr.pseudos.animated = function( elem ) { 10414 return jQuery.grep( jQuery.timers, function( fn ) { 10415 return elem === fn.elem; 10416 } ).length; 10417}; 10418 10419 10420 10421 10422jQuery.offset = { 10423 setOffset: function( elem, options, i ) { 10424 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 10425 position = jQuery.css( elem, "position" ), 10426 curElem = jQuery( elem ), 10427 props = {}; 10428 10429 // Set position first, in-case top/left are set even on static elem 10430 if ( position === "static" ) { 10431 elem.style.position = "relative"; 10432 } 10433 10434 curOffset = curElem.offset(); 10435 curCSSTop = jQuery.css( elem, "top" ); 10436 curCSSLeft = jQuery.css( elem, "left" ); 10437 calculatePosition = ( position === "absolute" || position === "fixed" ) && 10438 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 10439 10440 // Need to be able to calculate position if either 10441 // top or left is auto and position is either absolute or fixed 10442 if ( calculatePosition ) { 10443 curPosition = curElem.position(); 10444 curTop = curPosition.top; 10445 curLeft = curPosition.left; 10446 10447 } else { 10448 curTop = parseFloat( curCSSTop ) || 0; 10449 curLeft = parseFloat( curCSSLeft ) || 0; 10450 } 10451 10452 if ( isFunction( options ) ) { 10453 10454 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 10455 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 10456 } 10457 10458 if ( options.top != null ) { 10459 props.top = ( options.top - curOffset.top ) + curTop; 10460 } 10461 if ( options.left != null ) { 10462 props.left = ( options.left - curOffset.left ) + curLeft; 10463 } 10464 10465 if ( "using" in options ) { 10466 options.using.call( elem, props ); 10467 10468 } else { 10469
vendor: 9,879 bytes, lines 10469-10813
10469if ( typeof props.top === "number" ) { 10470 props.top += "px"; 10471 } 10472 if ( typeof props.left === "number" ) { 10473 props.left += "px"; 10474 } 10475 curElem.css( props ); 10476 } 10477 } 10478}; 10479 10480jQuery.fn.extend( { 10481 10482 // offset() relates an element's border box to the document origin 10483 offset: function( options ) { 10484 10485 // Preserve chaining for setter 10486 if ( arguments.length ) { 10487 return options === undefined ? 10488 this : 10489 this.each( function( i ) { 10490 jQuery.offset.setOffset( this, options, i ); 10491 } ); 10492 } 10493 10494 var rect, win, 10495 elem = this[ 0 ]; 10496 10497 if ( !elem ) { 10498 return; 10499 } 10500 10501 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 10502 // Support: IE <=11 only 10503 // Running getBoundingClientRect on a 10504 // disconnected node in IE throws an error 10505 if ( !elem.getClientRects().length ) { 10506 return { top: 0, left: 0 }; 10507 } 10508 10509 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 10510 rect = elem.getBoundingClientRect(); 10511 win = elem.ownerDocument.defaultView; 10512 return { 10513 top: rect.top + win.pageYOffset, 10514 left: rect.left + win.pageXOffset 10515 }; 10516 }, 10517 10518 // position() relates an element's margin box to its offset parent's padding box 10519 // This corresponds to the behavior of CSS absolute positioning 10520 position: function() { 10521 if ( !this[ 0 ] ) { 10522 return; 10523 } 10524 10525 var offsetParent, offset, doc, 10526 elem = this[ 0 ], 10527 parentOffset = { top: 0, left: 0 }; 10528 10529 // position:fixed elements are offset from the viewport, which itself always has zero offset 10530 if ( jQuery.css( elem, "position" ) === "fixed" ) { 10531 10532 // Assume position:fixed implies availability of getBoundingClientRect 10533 offset = elem.getBoundingClientRect(); 10534 10535 } else { 10536 offset = this.offset(); 10537 10538 // Account for the *real* offset parent, which can be the document or its root element 10539 // when a statically positioned element is identified 10540 doc = elem.ownerDocument; 10541 offsetParent = elem.offsetParent || doc.documentElement; 10542 while ( offsetParent && 10543 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 10544 jQuery.css( offsetParent, "position" ) === "static" ) { 10545 10546 offsetParent = offsetParent.parentNode; 10547 } 10548 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 10549 10550 // Incorporate borders into its offset, since they are outside its content origin 10551 parentOffset = jQuery( offsetParent ).offset(); 10552 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 10553 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 10554 } 10555 } 10556 10557 // Subtract parent offsets and element margins 10558 return { 10559 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 10560 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 10561 }; 10562 }, 10563 10564 // This method will return documentElement in the following cases: 10565 // 1) For the element inside the iframe without offsetParent, this method will return 10566 // documentElement of the parent window 10567 // 2) For the hidden or detached element 10568 // 3) For body or html element, i.e. in case of the html node - it will return itself 10569 // 10570 // but those exceptions were never presented as a real life use-cases 10571 // and might be considered as more preferable results. 10572 // 10573 // This logic, however, is not guaranteed and can change at any point in the future 10574 offsetParent: function() { 10575 return this.map( function() { 10576 var offsetParent = this.offsetParent; 10577 10578 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 10579 offsetParent = offsetParent.offsetParent; 10580 } 10581 10582 return offsetParent || documentElement; 10583 } ); 10584 } 10585} ); 10586 10587// Create scrollLeft and scrollTop methods 10588jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 10589 var top = "pageYOffset" === prop; 10590 10591 jQuery.fn[ method ] = function( val ) { 10592 return access( this, function( elem, method, val ) { 10593 10594 // Coalesce documents and windows 10595 var win; 10596 if ( isWindow( elem ) ) { 10597 win = elem; 10598 } else if ( elem.nodeType === 9 ) { 10599 win = elem.defaultView; 10600 } 10601 10602 if ( val === undefined ) { 10603 return win ? win[ prop ] : elem[ method ]; 10604 } 10605 10606 if ( win ) { 10607 win.scrollTo( 10608 !top ? val : win.pageXOffset, 10609 top ? val : win.pageYOffset 10610 ); 10611 10612 } else { 10613 elem[ method ] = val; 10614 } 10615 }, method, val, arguments.length ); 10616 }; 10617} ); 10618 10619// Support: Safari <=7 - 9.1, Chrome <=37 - 49 10620// Add the top/left cssHooks using jQuery.fn.position 10621// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 10622// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 10623// getComputedStyle returns percent when specified for top/left/bottom/right; 10624// rather than make the css module depend on the offset module, just check for it here 10625jQuery.each( [ "top", "left" ], function( _i, prop ) { 10626 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 10627 function( elem, computed ) { 10628 if ( computed ) { 10629 computed = curCSS( elem, prop ); 10630 10631 // If curCSS returns percentage, fallback to offset 10632 return rnumnonpx.test( computed ) ? 10633 jQuery( elem ).position()[ prop ] + "px" : 10634 computed; 10635 } 10636 } 10637 ); 10638} ); 10639 10640 10641// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 10642jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 10643 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, 10644 function( defaultExtra, funcName ) { 10645 10646 // Margin is only for outerHeight, outerWidth 10647 jQuery.fn[ funcName ] = function( margin, value ) { 10648 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 10649 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 10650 10651 return access( this, function( elem, type, value ) { 10652 var doc; 10653 10654 if ( isWindow( elem ) ) { 10655 10656 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 10657 return funcName.indexOf( "outer" ) === 0 ? 10658 elem[ "inner" + name ] : 10659 elem.document.documentElement[ "client" + name ]; 10660 } 10661 10662 // Get document width or height 10663 if ( elem.nodeType === 9 ) { 10664 doc = elem.documentElement; 10665 10666 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 10667 // whichever is greatest 10668 return Math.max( 10669 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 10670 elem.body[ "offset" + name ], doc[ "offset" + name ], 10671 doc[ "client" + name ] 10672 ); 10673 } 10674 10675 return value === undefined ? 10676 10677 // Get width or height on the element, requesting but not forcing parseFloat 10678 jQuery.css( elem, type, extra ) : 10679 10680 // Set width or height on the element 10681 jQuery.style( elem, type, value, extra ); 10682 }, type, chainable ? margin : undefined, chainable ); 10683 }; 10684 } ); 10685} ); 10686 10687 10688jQuery.each( [ 10689 "ajaxStart", 10690 "ajaxStop", 10691 "ajaxComplete", 10692 "ajaxError", 10693 "ajaxSuccess", 10694 "ajaxSend" 10695], function( _i, type ) { 10696 jQuery.fn[ type ] = function( fn ) { 10697 return this.on( type, fn ); 10698 }; 10699} ); 10700 10701 10702 10703 10704jQuery.fn.extend( { 10705 10706 bind: function( types, data, fn ) { 10707 return this.on( types, null, data, fn ); 10708 }, 10709 unbind: function( types, fn ) { 10710 return this.off( types, null, fn ); 10711 }, 10712 10713 delegate: function( selector, types, data, fn ) { 10714 return this.on( types, selector, data, fn ); 10715 }, 10716 undelegate: function( selector, types, fn ) { 10717 10718 // ( namespace ) or ( selector, types [, fn] ) 10719 return arguments.length === 1 ? 10720 this.off( selector, "**" ) : 10721 this.off( types, selector || "**", fn ); 10722 }, 10723 10724 hover: function( fnOver, fnOut ) { 10725 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 10726 } 10727} ); 10728 10729jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + 10730 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 10731 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 10732 function( _i, name ) { 10733 10734 // Handle event binding 10735 jQuery.fn[ name ] = function( data, fn ) { 10736 return arguments.length > 0 ? 10737 this.on( name, null, data, fn ) : 10738 this.trigger( name ); 10739 }; 10740 } ); 10741 10742 10743 10744 10745// Support: Android <=4.0 only 10746// Make sure we trim BOM and NBSP 10747var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; 10748 10749// Bind a function to a context, optionally partially applying any 10750// arguments. 10751// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 10752// However, it is not slated for removal any time soon 10753jQuery.proxy = function( fn, context ) { 10754 var tmp, args, proxy; 10755 10756 if ( typeof context === "string" ) { 10757 tmp = fn[ context ]; 10758 context = fn; 10759 fn = tmp; 10760 } 10761 10762 // Quick check to determine if target is callable, in the spec 10763 // this throws a TypeError, but we will just return undefined. 10764 if ( !isFunction( fn ) ) { 10765 return undefined; 10766 } 10767 10768 // Simulated bind 10769 args = slice.call( arguments, 2 ); 10770 proxy = function() { 10771 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 10772 }; 10773 10774 // Set the guid of unique handler to the same of original handler, so it can be removed 10775 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 10776 10777 return proxy; 10778}; 10779 10780jQuery.holdReady = function( hold ) { 10781 if ( hold ) { 10782 jQuery.readyWait++; 10783 } else { 10784 jQuery.ready( true ); 10785 } 10786}; 10787jQuery.isArray = Array.isArray; 10788jQuery.parseJSON = JSON.parse; 10789jQuery.nodeName = nodeName; 10790jQuery.isFunction = isFunction; 10791jQuery.isWindow = isWindow; 10792jQuery.camelCase = camelCase; 10793jQuery.type = toType; 10794 10795jQuery.now = Date.now; 10796 10797jQuery.isNumeric = function( obj ) { 10798 10799 // As of jQuery 3.0, isNumeric is limited to 10800 // strings and numbers (primitives or objects) 10801 // that can be coerced to finite numbers (gh-2662) 10802 var type = jQuery.type( obj ); 10803 return ( type === "number" || type === "string" ) && 10804 10805 // parseFloat NaNs numeric-cast false positives ("") 10806 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 10807 // subtraction forces infinities to NaN 10808 !isNaN( obj - parseFloat( obj ) ); 10809}; 10810 10811jQuery.trim = function( text ) { 10812 return text == null ? 10813 "" :
10814 ( text + "" ).replace( rtrim, "" ); 10815}; 10816 10817 10818 10819// Register as a named AMD module, since jQuery can be concatenated with other 10820// files that may use define, but not via a proper concatenation script that 10821// understands anonymous AMD modules. A named AMD is safest and most robust 10822// way to register. Lowercase jquery is used because AMD module names are 10823// derived from file names, and jQuery is normally delivered in a lowercase 10824// file name. Do this after creating the global so that if an AMD module wants 10825// to call noConflict to hide this version of jQuery, it will work. 10826 10827// Note that for maximum portability, libraries that are not jQuery should 10828// declare themselves as anonymous modules, and avoid setting a global if an 10829// AMD loader is present. jQuery is a special case. For more information, see 10830// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 10831 10832if ( typeof define === "function" && define.amd ) { 10833 define( "jquery", [], function() { 10834 return jQuery; 10835 } ); 10836} 10837 10838 10839 10840 10841var 10842 10843 // Map over jQuery in case of overwrite 10844 _jQuery = window.jQuery, 10845 10846 // Map over the $ in case of overwrite 10847 _$ = window.$; 10848 10849jQuery.noConflict = function( deep ) { 10850 if ( window.$ === jQuery ) { 10851 window.$ = _$; 10852 } 10853 10854 if ( deep && window.jQuery === jQuery ) { 10855 window.jQuery = _jQuery; 10856 } 10857 10858 return jQuery; 10859}; 10860 10861// Expose jQuery and $ identifiers, even in AMD 10862// (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 10863// and CommonJS for browser emulators (#13566) 10864if ( typeof noGlobal === "undefined" ) { 10865 window.jQuery = window.$ = jQuery; 10866} 10867 10868 10869 10870 10871return jQuery; 10872} ); 10873 10874/** 10875* Clay 2.14.2 10876* 10877* Copyright 2019, Liferay, Inc. 10878* All rights reserved. 10879* MIT license 10880*/ 10881/**! 10882 * @fileOverview Kickass library to create and place poppers near their reference elements. 10883 * @version 1.14.7 10884 * @license 10885 * Copyright (c) 2016 Federico Zivolo and contributors 10886 * 10887 * Permission is hereby granted, free of charge, to any person obtaining a copy 10888 * of this software and associated documentation files (the "Software"), to deal 10889 * in the Software without restriction, including without limitation the rights 10890 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10891 * copies of the Software, and to permit persons to whom the Software is 10892 * furnished to do so, subject to the following conditions: 10893 * 10894 * The above copyright notice and this permission notice shall be included in all 10895 * copies or substantial portions of the Software. 10896 * 10897 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10898 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10899 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10900 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 10901 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 10902 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 10903 * SOFTWARE. 10904 */ 10905(function (global, factory) { 10906 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 10907 typeof define === 'function' && define.amd ? define(factory) : 10908 (global.Popper = factory()); 10909}(this, (function () { 'use strict'; 10910 10911var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined'; 10912 10913var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox']; 10914var timeoutDuration = 0; 10915for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) { 10916 if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { 10917 timeoutDuration = 1; 10918 break; 10919 } 10920} 10921 10922function microtaskDebounce(fn) { 10923 var called = false; 10924 return function () { 10925 if (called) { 10926 return; 10927 } 10928 called = true; 10929 window.Promise.resolve().then(function () { 10930 called = false; 10931 fn(); 10932 }); 10933 }; 10934} 10935 10936function taskDebounce(fn) { 10937 var scheduled = false; 10938 return function () { 10939 if (!scheduled) { 10940 scheduled = true; 10941 setTimeout(function () { 10942 scheduled = false; 10943 fn(); 10944 }, timeoutDuration); 10945 } 10946 }; 10947} 10948 10949var supportsMicroTasks = isBrowser && window.Promise; 10950 10951/** 10952* Create a debounced version of a method, that's asynchronously deferred 10953* but called in the minimum time possible. 10954* 10955* @method 10956* @memberof Popper.Utils 10957* @argument {Function} fn 10958* @returns {Function} 10959*/ 10960var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce; 10961 10962/** 10963 * Check if the given variable is a function 10964 * @method 10965 * @memberof Popper.Utils 10966 * @argument {Any} functionToCheck - variable to check 10967 * @returns {Boolean} answer to: is a function? 10968 */ 10969function isFunction(functionToCheck) { 10970 var getType = {}; 10971 return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; 10972} 10973
vendor: 24,649 bytes, lines 10974-11760
10974/** 10975 * Get CSS computed property of the given element 10976 * @method 10977 * @memberof Popper.Utils 10978 * @argument {Eement} element 10979 * @argument {String} property 10980 */ 10981function getStyleComputedProperty(element, property) { 10982 if (element.nodeType !== 1) { 10983 return []; 10984 } 10985 // NOTE: 1 DOM access here 10986 var window = element.ownerDocument.defaultView; 10987 var css = window.getComputedStyle(element, null); 10988 return property ? css[property] : css; 10989} 10990 10991/** 10992 * Returns the parentNode or the host of the element 10993 * @method 10994 * @memberof Popper.Utils 10995 * @argument {Element} element 10996 * @returns {Element} parent 10997 */ 10998function getParentNode(element) { 10999 if (element.nodeName === 'HTML') { 11000 return element; 11001 } 11002 return element.parentNode || element.host; 11003} 11004 11005/** 11006 * Returns the scrolling parent of the given element 11007 * @method 11008 * @memberof Popper.Utils 11009 * @argument {Element} element 11010 * @returns {Element} scroll parent 11011 */ 11012function getScrollParent(element) { 11013 // Return body, `getScroll` will take care to get the correct `scrollTop` from it 11014 if (!element) { 11015 return document.body; 11016 } 11017 11018 switch (element.nodeName) { 11019 case 'HTML': 11020 case 'BODY': 11021 return element.ownerDocument.body; 11022 case '#document': 11023 return element.body; 11024 } 11025 11026 // Firefox want us to check `-x` and `-y` variations as well 11027 11028 var _getStyleComputedProp = getStyleComputedProperty(element), 11029 overflow = _getStyleComputedProp.overflow, 11030 overflowX = _getStyleComputedProp.overflowX, 11031 overflowY = _getStyleComputedProp.overflowY; 11032 11033 if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) { 11034 return element; 11035 } 11036 11037 return getScrollParent(getParentNode(element)); 11038} 11039 11040var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode); 11041var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent); 11042 11043/** 11044 * Determines if the browser is Internet Explorer 11045 * @method 11046 * @memberof Popper.Utils 11047 * @param {Number} version to check 11048 * @returns {Boolean} isIE 11049 */ 11050function isIE(version) { 11051 if (version === 11) { 11052 return isIE11; 11053 } 11054 if (version === 10) { 11055 return isIE10; 11056 } 11057 return isIE11 || isIE10; 11058} 11059 11060/** 11061 * Returns the offset parent of the given element 11062 * @method 11063 * @memberof Popper.Utils 11064 * @argument {Element} element 11065 * @returns {Element} offset parent 11066 */ 11067function getOffsetParent(element) { 11068 if (!element) { 11069 return document.documentElement; 11070 } 11071 11072 var noOffsetParent = isIE(10) ? document.body : null; 11073 11074 // NOTE: 1 DOM access here 11075 var offsetParent = element.offsetParent || null; 11076 // Skip hidden elements which don't have an offsetParent 11077 while (offsetParent === noOffsetParent && element.nextElementSibling) { 11078 offsetParent = (element = element.nextElementSibling).offsetParent; 11079 } 11080 11081 var nodeName = offsetParent && offsetParent.nodeName; 11082 11083 if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { 11084 return element ? element.ownerDocument.documentElement : document.documentElement; 11085 } 11086 11087 // .offsetParent will return the closest TH, TD or TABLE in case 11088 // no offsetParent is present, I hate this job... 11089 if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') { 11090 return getOffsetParent(offsetParent); 11091 } 11092 11093 return offsetParent; 11094} 11095 11096function isOffsetContainer(element) { 11097 var nodeName = element.nodeName; 11098 11099 if (nodeName === 'BODY') { 11100 return false; 11101 } 11102 return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element; 11103} 11104 11105/** 11106 * Finds the root node (document, shadowDOM root) of the given element 11107 * @method 11108 * @memberof Popper.Utils 11109 * @argument {Element} node 11110 * @returns {Element} root node 11111 */ 11112function getRoot(node) { 11113 if (node.parentNode !== null) { 11114 return getRoot(node.parentNode); 11115 } 11116 11117 return node; 11118} 11119 11120/** 11121 * Finds the offset parent common to the two provided nodes 11122 * @method 11123 * @memberof Popper.Utils 11124 * @argument {Element} element1 11125 * @argument {Element} element2 11126 * @returns {Element} common offset parent 11127 */ 11128function findCommonOffsetParent(element1, element2) { 11129 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 11130 if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { 11131 return document.documentElement; 11132 } 11133 11134 // Here we make sure to give as "start" the element that comes first in the DOM 11135 var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; 11136 var start = order ? element1 : element2; 11137 var end = order ? element2 : element1; 11138 11139 // Get common ancestor container 11140 var range = document.createRange(); 11141 range.setStart(start, 0); 11142 range.setEnd(end, 0); 11143 var commonAncestorContainer = range.commonAncestorContainer; 11144 11145 // Both nodes are inside #document 11146 11147 if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { 11148 if (isOffsetContainer(commonAncestorContainer)) { 11149 return commonAncestorContainer; 11150 } 11151 11152 return getOffsetParent(commonAncestorContainer); 11153 } 11154 11155 // one of the nodes is inside shadowDOM, find which one 11156 var element1root = getRoot(element1); 11157 if (element1root.host) { 11158 return findCommonOffsetParent(element1root.host, element2); 11159 } else { 11160 return findCommonOffsetParent(element1, getRoot(element2).host); 11161 } 11162} 11163 11164/** 11165 * Gets the scroll value of the given element in the given side (top and left) 11166 * @method 11167 * @memberof Popper.Utils 11168 * @argument {Element} element 11169 * @argument {String} side `top` or `left` 11170 * @returns {number} amount of scrolled pixels 11171 */ 11172function getScroll(element) { 11173 var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top'; 11174 11175 var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft'; 11176 var nodeName = element.nodeName; 11177 11178 if (nodeName === 'BODY' || nodeName === 'HTML') { 11179 var html = element.ownerDocument.documentElement; 11180 var scrollingElement = element.ownerDocument.scrollingElement || html; 11181 return scrollingElement[upperSide]; 11182 } 11183 11184 return element[upperSide]; 11185} 11186 11187/* 11188 * Sum or subtract the element scroll values (left and top) from a given rect object 11189 * @method 11190 * @memberof Popper.Utils 11191 * @param {Object} rect - Rect object you want to change 11192 * @param {HTMLElement} element - The element from the function reads the scroll values 11193 * @param {Boolean} subtract - set to true if you want to subtract the scroll values 11194 * @return {Object} rect - The modifier rect object 11195 */ 11196function includeScroll(rect, element) { 11197 var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 11198 11199 var scrollTop = getScroll(element, 'top'); 11200 var scrollLeft = getScroll(element, 'left'); 11201 var modifier = subtract ? -1 : 1; 11202 rect.top += scrollTop * modifier; 11203 rect.bottom += scrollTop * modifier; 11204 rect.left += scrollLeft * modifier; 11205 rect.right += scrollLeft * modifier; 11206 return rect; 11207} 11208 11209/* 11210 * Helper to detect borders of a given element 11211 * @method 11212 * @memberof Popper.Utils 11213 * @param {CSSStyleDeclaration} styles 11214 * Result of `getStyleComputedProperty` on the given element 11215 * @param {String} axis - `x` or `y` 11216 * @return {number} borders - The borders size of the given axis 11217 */ 11218 11219function getBordersSize(styles, axis) { 11220 var sideA = axis === 'x' ? 'Left' : 'Top'; 11221 var sideB = sideA === 'Left' ? 'Right' : 'Bottom'; 11222 11223 return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10); 11224} 11225 11226function getSize(axis, body, html, computedStyle) { 11227 return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0); 11228} 11229 11230function getWindowSizes(document) { 11231 var body = document.body; 11232 var html = document.documentElement; 11233 var computedStyle = isIE(10) && getComputedStyle(html); 11234 11235 return { 11236 height: getSize('Height', body, html, computedStyle), 11237 width: getSize('Width', body, html, computedStyle) 11238 }; 11239} 11240 11241var classCallCheck = function (instance, Constructor) { 11242 if (!(instance instanceof Constructor)) { 11243 throw new TypeError("Cannot call a class as a function"); 11244 } 11245}; 11246 11247var createClass = function () { 11248 function defineProperties(target, props) { 11249 for (var i = 0; i < props.length; i++) { 11250 var descriptor = props[i]; 11251 descriptor.enumerable = descriptor.enumerable || false; 11252 descriptor.configurable = true; 11253 if ("value" in descriptor) descriptor.writable = true; 11254 Object.defineProperty(target, descriptor.key, descriptor); 11255 } 11256 } 11257 11258 return function (Constructor, protoProps, staticProps) { 11259 if (protoProps) defineProperties(Constructor.prototype, protoProps); 11260 if (staticProps) defineProperties(Constructor, staticProps); 11261 return Constructor; 11262 }; 11263}(); 11264 11265 11266 11267 11268 11269var defineProperty = function (obj, key, value) { 11270 if (key in obj) { 11271 Object.defineProperty(obj, key, { 11272 value: value, 11273 enumerable: true, 11274 configurable: true, 11275 writable: true 11276 }); 11277 } else { 11278 obj[key] = value; 11279 } 11280 11281 return obj; 11282}; 11283 11284var _extends = Object.assign || function (target) { 11285 for (var i = 1; i < arguments.length; i++) { 11286 var source = arguments[i]; 11287 11288 for (var key in source) { 11289 if (Object.prototype.hasOwnProperty.call(source, key)) { 11290 target[key] = source[key]; 11291 } 11292 } 11293 } 11294 11295 return target; 11296}; 11297 11298/** 11299 * Given element offsets, generate an output similar to getBoundingClientRect 11300 * @method 11301 * @memberof Popper.Utils 11302 * @argument {Object} offsets 11303 * @returns {Object} ClientRect like output 11304 */ 11305function getClientRect(offsets) { 11306 return _extends({}, offsets, { 11307 right: offsets.left + offsets.width, 11308 bottom: offsets.top + offsets.height 11309 }); 11310} 11311 11312/** 11313 * Get bounding client rect of given element 11314 * @method 11315 * @memberof Popper.Utils 11316 * @param {HTMLElement} element 11317 * @return {Object} client rect 11318 */ 11319function getBoundingClientRect(element) { 11320 var rect = {}; 11321 11322 // IE10 10 FIX: Please, don't ask, the element isn't 11323 // considered in DOM in some circumstances... 11324 // This isn't reproducible in IE10 compatibility mode of IE11 11325 try { 11326 if (isIE(10)) { 11327 rect = element.getBoundingClientRect(); 11328 var scrollTop = getScroll(element, 'top'); 11329 var scrollLeft = getScroll(element, 'left'); 11330 rect.top += scrollTop; 11331 rect.left += scrollLeft; 11332 rect.bottom += scrollTop; 11333 rect.right += scrollLeft; 11334 } else { 11335 rect = element.getBoundingClientRect(); 11336 } 11337 } catch (e) {} 11338 11339 var result = { 11340 left: rect.left, 11341 top: rect.top, 11342 width: rect.right - rect.left, 11343 height: rect.bottom - rect.top 11344 }; 11345 11346 // subtract scrollbar size from sizes 11347 var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {}; 11348 var width = sizes.width || element.clientWidth || result.right - result.left; 11349 var height = sizes.height || element.clientHeight || result.bottom - result.top; 11350 11351 var horizScrollbar = element.offsetWidth - width; 11352 var vertScrollbar = element.offsetHeight - height; 11353 11354 // if an hypothetical scrollbar is detected, we must be sure it's not a `border` 11355 // we make this check conditional for performance reasons 11356 if (horizScrollbar || vertScrollbar) { 11357 var styles = getStyleComputedProperty(element); 11358 horizScrollbar -= getBordersSize(styles, 'x'); 11359 vertScrollbar -= getBordersSize(styles, 'y'); 11360 11361 result.width -= horizScrollbar; 11362 result.height -= vertScrollbar; 11363 } 11364 11365 return getClientRect(result); 11366} 11367 11368function getOffsetRectRelativeToArbitraryNode(children, parent) { 11369 var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 11370 11371 var isIE10 = isIE(10); 11372 var isHTML = parent.nodeName === 'HTML'; 11373 var childrenRect = getBoundingClientRect(children); 11374 var parentRect = getBoundingClientRect(parent); 11375 var scrollParent = getScrollParent(children); 11376 11377 var styles = getStyleComputedProperty(parent); 11378 var borderTopWidth = parseFloat(styles.borderTopWidth, 10); 11379 var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10); 11380 11381 // In cases where the parent is fixed, we must ignore negative scroll in offset calc 11382 if (fixedPosition && isHTML) { 11383 parentRect.top = Math.max(parentRect.top, 0); 11384 parentRect.left = Math.max(parentRect.left, 0); 11385 } 11386 var offsets = getClientRect({ 11387 top: childrenRect.top - parentRect.top - borderTopWidth, 11388 left: childrenRect.left - parentRect.left - borderLeftWidth, 11389 width: childrenRect.width, 11390 height: childrenRect.height 11391 }); 11392 offsets.marginTop = 0; 11393 offsets.marginLeft = 0; 11394 11395 // Subtract margins of documentElement in case it's being used as parent 11396 // we do this only on HTML because it's the only element that behaves 11397 // differently when margins are applied to it. The margins are included in 11398 // the box of the documentElement, in the other cases not. 11399 if (!isIE10 && isHTML) { 11400 var marginTop = parseFloat(styles.marginTop, 10); 11401 var marginLeft = parseFloat(styles.marginLeft, 10); 11402 11403 offsets.top -= borderTopWidth - marginTop; 11404 offsets.bottom -= borderTopWidth - marginTop; 11405 offsets.left -= borderLeftWidth - marginLeft; 11406 offsets.right -= borderLeftWidth - marginLeft; 11407 11408 // Attach marginTop and marginLeft because in some circumstances we may need them 11409 offsets.marginTop = marginTop; 11410 offsets.marginLeft = marginLeft; 11411 } 11412 11413 if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') { 11414 offsets = includeScroll(offsets, parent); 11415 } 11416 11417 return offsets; 11418} 11419 11420function getViewportOffsetRectRelativeToArtbitraryNode(element) { 11421 var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 11422 11423 var html = element.ownerDocument.documentElement; 11424 var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html); 11425 var width = Math.max(html.clientWidth, window.innerWidth || 0); 11426 var height = Math.max(html.clientHeight, window.innerHeight || 0); 11427 11428 var scrollTop = !excludeScroll ? getScroll(html) : 0; 11429 var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0; 11430 11431 var offset = { 11432 top: scrollTop - relativeOffset.top + relativeOffset.marginTop, 11433 left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, 11434 width: width, 11435 height: height 11436 }; 11437 11438 return getClientRect(offset); 11439} 11440 11441/** 11442 * Check if the given element is fixed or is inside a fixed parent 11443 * @method 11444 * @memberof Popper.Utils 11445 * @argument {Element} element 11446 * @argument {Element} customContainer 11447 * @returns {Boolean} answer to "isFixed?" 11448 */ 11449function isFixed(element) { 11450 var nodeName = element.nodeName; 11451 if (nodeName === 'BODY' || nodeName === 'HTML') { 11452 return false; 11453 } 11454 if (getStyleComputedProperty(element, 'position') === 'fixed') { 11455 return true; 11456 } 11457 var parentNode = getParentNode(element); 11458 if (!parentNode) { 11459 return false; 11460 } 11461 return isFixed(parentNode); 11462} 11463 11464/** 11465 * Finds the first parent of an element that has a transformed property defined 11466 * @method 11467 * @memberof Popper.Utils 11468 * @argument {Element} element 11469 * @returns {Element} first transformed parent or documentElement 11470 */ 11471 11472function getFixedPositionOffsetParent(element) { 11473 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 11474 if (!element || !element.parentElement || isIE()) { 11475 return document.documentElement; 11476 } 11477 var el = element.parentElement; 11478 while (el && getStyleComputedProperty(el, 'transform') === 'none') { 11479 el = el.parentElement; 11480 } 11481 return el || document.documentElement; 11482} 11483 11484/** 11485 * Computed the boundaries limits and return them 11486 * @method 11487 * @memberof Popper.Utils 11488 * @param {HTMLElement} popper 11489 * @param {HTMLElement} reference 11490 * @param {number} padding 11491 * @param {HTMLElement} boundariesElement - Element used to define the boundaries 11492 * @param {Boolean} fixedPosition - Is in fixed position mode 11493 * @returns {Object} Coordinates of the boundaries 11494 */ 11495function getBoundaries(popper, reference, padding, boundariesElement) { 11496 var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; 11497 11498 // NOTE: 1 DOM access here 11499 11500 var boundaries = { top: 0, left: 0 }; 11501 var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference); 11502 11503 // Handle viewport case 11504 if (boundariesElement === 'viewport') { 11505 boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition); 11506 } else { 11507 // Handle other cases based on DOM element used as boundaries 11508 var boundariesNode = void 0; 11509 if (boundariesElement === 'scrollParent') { 11510 boundariesNode = getScrollParent(getParentNode(reference)); 11511 if (boundariesNode.nodeName === 'BODY') { 11512 boundariesNode = popper.ownerDocument.documentElement; 11513 } 11514 } else if (boundariesElement === 'window') { 11515 boundariesNode = popper.ownerDocument.documentElement; 11516 } else { 11517 boundariesNode = boundariesElement; 11518 } 11519 11520 var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition); 11521 11522 // In case of HTML, we need a different computation 11523 if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) { 11524 var _getWindowSizes = getWindowSizes(popper.ownerDocument), 11525 height = _getWindowSizes.height, 11526 width = _getWindowSizes.width; 11527 11528 boundaries.top += offsets.top - offsets.marginTop; 11529 boundaries.bottom = height + offsets.top; 11530 boundaries.left += offsets.left - offsets.marginLeft; 11531 boundaries.right = width + offsets.left; 11532 } else { 11533 // for all the other DOM elements, this one is good 11534 boundaries = offsets; 11535 } 11536 } 11537 11538 // Add paddings 11539 padding = padding || 0; 11540 var isPaddingNumber = typeof padding === 'number'; 11541 boundaries.left += isPaddingNumber ? padding : padding.left || 0; 11542 boundaries.top += isPaddingNumber ? padding : padding.top || 0; 11543 boundaries.right -= isPaddingNumber ? padding : padding.right || 0; 11544 boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0; 11545 11546 return boundaries; 11547} 11548 11549function getArea(_ref) { 11550 var width = _ref.width, 11551 height = _ref.height; 11552 11553 return width * height; 11554} 11555 11556/** 11557 * Utility used to transform the `auto` placement to the placement with more 11558 * available space. 11559 * @method 11560 * @memberof Popper.Utils 11561 * @argument {Object} data - The data object generated by update method 11562 * @argument {Object} options - Modifiers configuration and options 11563 * @returns {Object} The data object, properly modified 11564 */ 11565function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { 11566 var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; 11567 11568 if (placement.indexOf('auto') === -1) { 11569 return placement; 11570 } 11571 11572 var boundaries = getBoundaries(popper, reference, padding, boundariesElement); 11573 11574 var rects = { 11575 top: { 11576 width: boundaries.width, 11577 height: refRect.top - boundaries.top 11578 }, 11579 right: { 11580 width: boundaries.right - refRect.right, 11581 height: boundaries.height 11582 }, 11583 bottom: { 11584 width: boundaries.width, 11585 height: boundaries.bottom - refRect.bottom 11586 }, 11587 left: { 11588 width: refRect.left - boundaries.left, 11589 height: boundaries.height 11590 } 11591 }; 11592 11593 var sortedAreas = Object.keys(rects).map(function (key) { 11594 return _extends({ 11595 key: key 11596 }, rects[key], { 11597 area: getArea(rects[key]) 11598 }); 11599 }).sort(function (a, b) { 11600 return b.area - a.area; 11601 }); 11602 11603 var filteredAreas = sortedAreas.filter(function (_ref2) { 11604 var width = _ref2.width, 11605 height = _ref2.height; 11606 return width >= popper.clientWidth && height >= popper.clientHeight; 11607 }); 11608 11609 var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; 11610 11611 var variation = placement.split('-')[1]; 11612 11613 return computedPlacement + (variation ? '-' + variation : ''); 11614} 11615 11616/** 11617 * Get offsets to the reference element 11618 * @method 11619 * @memberof Popper.Utils 11620 * @param {Object} state 11621 * @param {Element} popper - the popper element 11622 * @param {Element} reference - the reference element (the popper will be relative to this) 11623 * @param {Element} fixedPosition - is in fixed position mode 11624 * @returns {Object} An object containing the offsets which will be applied to the popper 11625 */ 11626function getReferenceOffsets(state, popper, reference) { 11627 var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 11628 11629 var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference); 11630 return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition); 11631} 11632 11633/** 11634 * Get the outer sizes of the given element (offset size + margins) 11635 * @method 11636 * @memberof Popper.Utils 11637 * @argument {Element} element 11638 * @returns {Object} object containing width and height properties 11639 */ 11640function getOuterSizes(element) { 11641 var window = element.ownerDocument.defaultView; 11642 var styles = window.getComputedStyle(element); 11643 var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0); 11644 var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0); 11645 var result = { 11646 width: element.offsetWidth + y, 11647 height: element.offsetHeight + x 11648 }; 11649 return result; 11650} 11651 11652/** 11653 * Get the opposite placement of the given one 11654 * @method 11655 * @memberof Popper.Utils 11656 * @argument {String} placement 11657 * @returns {String} flipped placement 11658 */ 11659function getOppositePlacement(placement) { 11660 var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; 11661 return placement.replace(/left|right|bottom|top/g, function (matched) { 11662 return hash[matched]; 11663 }); 11664} 11665 11666/** 11667 * Get offsets to the popper 11668 * @method 11669 * @memberof Popper.Utils 11670 * @param {Object} position - CSS position the Popper will get applied 11671 * @param {HTMLElement} popper - the popper element 11672 * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) 11673 * @param {String} placement - one of the valid placement options 11674 * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper 11675 */ 11676function getPopperOffsets(popper, referenceOffsets, placement) { 11677 placement = placement.split('-')[0]; 11678 11679 // Get popper node sizes 11680 var popperRect = getOuterSizes(popper); 11681 11682 // Add position, width and height to our offsets object 11683 var popperOffsets = { 11684 width: popperRect.width, 11685 height: popperRect.height 11686 }; 11687 11688 // depending by the popper placement we have to compute its offsets slightly differently 11689 var isHoriz = ['right', 'left'].indexOf(placement) !== -1; 11690 var mainSide = isHoriz ? 'top' : 'left'; 11691 var secondarySide = isHoriz ? 'left' : 'top'; 11692 var measurement = isHoriz ? 'height' : 'width'; 11693 var secondaryMeasurement = !isHoriz ? 'height' : 'width'; 11694 11695 popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; 11696 if (placement === secondarySide) { 11697 popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; 11698 } else { 11699 popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; 11700 } 11701 11702 return popperOffsets; 11703} 11704 11705/** 11706 * Mimics the `find` method of Array 11707 * @method 11708 * @memberof Popper.Utils 11709 * @argument {Array} arr 11710 * @argument prop 11711 * @argument value 11712 * @returns index or -1 11713 */ 11714function find(arr, check) { 11715 // use native find if supported 11716 if (Array.prototype.find) { 11717 return arr.find(check); 11718 } 11719 11720 // use `filter` to obtain the same behavior of `find` 11721 return arr.filter(check)[0]; 11722} 11723 11724/** 11725 * Return the index of the matching object 11726 * @method 11727 * @memberof Popper.Utils 11728 * @argument {Array} arr 11729 * @argument prop 11730 * @argument value 11731 * @returns index or -1 11732 */ 11733function findIndex(arr, prop, value) { 11734 // use native findIndex if supported 11735 if (Array.prototype.findIndex) { 11736 return arr.findIndex(function (cur) { 11737 return cur[prop] === value; 11738 }); 11739 } 11740 11741 // use `find` + `indexOf` if `findIndex` isn't supported 11742 var match = find(arr, function (obj) { 11743 return obj[prop] === value; 11744 }); 11745 return arr.indexOf(match); 11746} 11747 11748/** 11749 * Loop trough the list of modifiers and run them in order, 11750 * each of them will then edit the data object. 11751 * @method 11752 * @memberof Popper.Utils 11753 * @param {dataObject} data 11754 * @param {Array} modifiers 11755 * @param {String} ends - Optional modifier name used as stopper 11756 * @returns {dataObject} 11757 */ 11758function runModifiers(modifiers, data, ends) { 11759 var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends)); 11760
vendor: 4,062 bytes, lines 11761-11891
11761 modifiersToRun.forEach(function (modifier) { 11762 if (modifier['function']) { 11763 // eslint-disable-line dot-notation 11764 console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); 11765 } 11766 var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation 11767 if (modifier.enabled && isFunction(fn)) { 11768 // Add properties to offsets to make them a complete clientRect object 11769 // we do this before each modifier to make sure the previous one doesn't 11770 // mess with these values 11771 data.offsets.popper = getClientRect(data.offsets.popper); 11772 data.offsets.reference = getClientRect(data.offsets.reference); 11773 11774 data = fn(data, modifier); 11775 } 11776 }); 11777 11778 return data; 11779} 11780 11781/** 11782 * Updates the position of the popper, computing the new offsets and applying 11783 * the new style.<br /> 11784 * Prefer `scheduleUpdate` over `update` because of performance reasons. 11785 * @method 11786 * @memberof Popper 11787 */ 11788function update() { 11789 // if popper is destroyed, don't perform any further update 11790 if (this.state.isDestroyed) { 11791 return; 11792 } 11793 11794 var data = { 11795 instance: this, 11796 styles: {}, 11797 arrowStyles: {}, 11798 attributes: {}, 11799 flipped: false, 11800 offsets: {} 11801 }; 11802 11803 // compute reference element offsets 11804 data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); 11805 11806 // compute auto placement, store placement inside the data object, 11807 // modifiers will be able to edit `placement` if needed 11808 // and refer to originalPlacement to know the original value 11809 data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); 11810 11811 // store the computed placement inside `originalPlacement` 11812 data.originalPlacement = data.placement; 11813 11814 data.positionFixed = this.options.positionFixed; 11815 11816 // compute the popper offsets 11817 data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); 11818 11819 data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; 11820 11821 // run the modifiers 11822 data = runModifiers(this.modifiers, data); 11823 11824 // the first `update` will call `onCreate` callback 11825 // the other ones will call `onUpdate` callback 11826 if (!this.state.isCreated) { 11827 this.state.isCreated = true; 11828 this.options.onCreate(data); 11829 } else { 11830 this.options.onUpdate(data); 11831 } 11832} 11833 11834/** 11835 * Helper used to know if the given modifier is enabled. 11836 * @method 11837 * @memberof Popper.Utils 11838 * @returns {Boolean} 11839 */ 11840function isModifierEnabled(modifiers, modifierName) { 11841 return modifiers.some(function (_ref) { 11842 var name = _ref.name, 11843 enabled = _ref.enabled; 11844 return enabled && name === modifierName; 11845 }); 11846} 11847 11848/** 11849 * Get the prefixed supported property name 11850 * @method 11851 * @memberof Popper.Utils 11852 * @argument {String} property (camelCase) 11853 * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) 11854 */ 11855function getSupportedPropertyName(property) { 11856 var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; 11857 var upperProp = property.charAt(0).toUpperCase() + property.slice(1); 11858 11859 for (var i = 0; i < prefixes.length; i++) { 11860 var prefix = prefixes[i]; 11861 var toCheck = prefix ? '' + prefix + upperProp : property; 11862 if (typeof document.body.style[toCheck] !== 'undefined') { 11863 return toCheck; 11864 } 11865 } 11866 return null; 11867} 11868 11869/** 11870 * Destroys the popper. 11871 * @method 11872 * @memberof Popper 11873 */ 11874function destroy() { 11875 this.state.isDestroyed = true; 11876 11877 // touch DOM only if `applyStyle` modifier is enabled 11878 if (isModifierEnabled(this.modifiers, 'applyStyle')) { 11879 this.popper.removeAttribute('x-placement'); 11880 this.popper.style.position = ''; 11881 this.popper.style.top = ''; 11882 this.popper.style.left = ''; 11883 this.popper.style.right = ''; 11884 this.popper.style.bottom = ''; 11885 this.popper.style.willChange = ''; 11886 this.popper.style[getSupportedPropertyName('transform')] = ''; 11887 } 11888 11889 this.disableEventListeners(); 11890 11891 // remove the popper if user explicit
vendor: 15,762 bytes, lines 11891-12340
11891y asked for the deletion on destroy 11892 // do not use `remove` because IE11 doesn't support it 11893 if (this.options.removeOnDestroy) { 11894 this.popper.parentNode.removeChild(this.popper); 11895 } 11896 return this; 11897} 11898 11899/** 11900 * Get the window associated with the element 11901 * @argument {Element} element 11902 * @returns {Window} 11903 */ 11904function getWindow(element) { 11905 var ownerDocument = element.ownerDocument; 11906 return ownerDocument ? ownerDocument.defaultView : window; 11907} 11908 11909function attachToScrollParents(scrollParent, event, callback, scrollParents) { 11910 var isBody = scrollParent.nodeName === 'BODY'; 11911 var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent; 11912 target.addEventListener(event, callback, { passive: true }); 11913 11914 if (!isBody) { 11915 attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents); 11916 } 11917 scrollParents.push(target); 11918} 11919 11920/** 11921 * Setup needed event listeners used to update the popper position 11922 * @method 11923 * @memberof Popper.Utils 11924 * @private 11925 */ 11926function setupEventListeners(reference, options, state, updateBound) { 11927 // Resize event listener on window 11928 state.updateBound = updateBound; 11929 getWindow(reference).addEventListener('resize', state.updateBound, { passive: true }); 11930 11931 // Scroll event listener on scroll parents 11932 var scrollElement = getScrollParent(reference); 11933 attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); 11934 state.scrollElement = scrollElement; 11935 state.eventsEnabled = true; 11936 11937 return state; 11938} 11939 11940/** 11941 * It will add resize/scroll events and start recalculating 11942 * position of the popper element when they are triggered. 11943 * @method 11944 * @memberof Popper 11945 */ 11946function enableEventListeners() { 11947 if (!this.state.eventsEnabled) { 11948 this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); 11949 } 11950} 11951 11952/** 11953 * Remove event listeners used to update the popper position 11954 * @method 11955 * @memberof Popper.Utils 11956 * @private 11957 */ 11958function removeEventListeners(reference, state) { 11959 // Remove resize event listener on window 11960 getWindow(reference).removeEventListener('resize', state.updateBound); 11961 11962 // Remove scroll event listener on scroll parents 11963 state.scrollParents.forEach(function (target) { 11964 target.removeEventListener('scroll', state.updateBound); 11965 }); 11966 11967 // Reset state 11968 state.updateBound = null; 11969 state.scrollParents = []; 11970 state.scrollElement = null; 11971 state.eventsEnabled = false; 11972 return state; 11973} 11974 11975/** 11976 * It will remove resize/scroll events and won't recalculate popper position 11977 * when they are triggered. It also won't trigger `onUpdate` callback anymore, 11978 * unless you call `update` method manually. 11979 * @method 11980 * @memberof Popper 11981 */ 11982function disableEventListeners() { 11983 if (this.state.eventsEnabled) { 11984 cancelAnimationFrame(this.scheduleUpdate); 11985 this.state = removeEventListeners(this.reference, this.state); 11986 } 11987} 11988 11989/** 11990 * Tells if a given input is a number 11991 * @method 11992 * @memberof Popper.Utils 11993 * @param {*} input to check 11994 * @return {Boolean} 11995 */ 11996function isNumeric(n) { 11997 return n !== '' && !isNaN(parseFloat(n)) && isFinite(n); 11998} 11999 12000/** 12001 * Set the style to the given popper 12002 * @method 12003 * @memberof Popper.Utils 12004 * @argument {Element} element - Element to apply the style to 12005 * @argument {Object} styles 12006 * Object with a list of properties and values which will be applied to the element 12007 */ 12008function setStyles(element, styles) { 12009 Object.keys(styles).forEach(function (prop) { 12010 var unit = ''; 12011 // add unit if the value is numeric and is one of the following 12012 if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) { 12013 unit = 'px'; 12014 } 12015 element.style[prop] = styles[prop] + unit; 12016 }); 12017} 12018 12019/** 12020 * Set the attributes to the given popper 12021 * @method 12022 * @memberof Popper.Utils 12023 * @argument {Element} element - Element to apply the attributes to 12024 * @argument {Object} styles 12025 * Object with a list of properties and values which will be applied to the element 12026 */ 12027function setAttributes(element, attributes) { 12028 Object.keys(attributes).forEach(function (prop) { 12029 var value = attributes[prop]; 12030 if (value !== false) { 12031 element.setAttribute(prop, attributes[prop]); 12032 } else { 12033 element.removeAttribute(prop); 12034 } 12035 }); 12036} 12037 12038/** 12039 * @function 12040 * @memberof Modifiers 12041 * @argument {Object} data - The data object generated by `update` method 12042 * @argument {Object} data.styles - List of style properties - values to apply to popper element 12043 * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element 12044 * @argument {Object} options - Modifiers configuration and options 12045 * @returns {Object} The same data object 12046 */ 12047function applyStyle(data) { 12048 // any property present in `data.styles` will be applied to the popper, 12049 // in this way we can make the 3rd party modifiers add custom styles to it 12050 // Be aware, modifiers could override the properties defined in the previous 12051 // lines of this modifier! 12052 setStyles(data.instance.popper, data.styles); 12053 12054 // any property present in `data.attributes` will be applied to the popper, 12055 // they will be set as HTML attributes of the element 12056 setAttributes(data.instance.popper, data.attributes); 12057 12058 // if arrowElement is defined and arrowStyles has some properties 12059 if (data.arrowElement && Object.keys(data.arrowStyles).length) { 12060 setStyles(data.arrowElement, data.arrowStyles); 12061 } 12062 12063 return data; 12064} 12065 12066/** 12067 * Set the x-placement attribute before everything else because it could be used 12068 * to add margins to the popper margins needs to be calculated to get the 12069 * correct popper offsets. 12070 * @method 12071 * @memberof Popper.modifiers 12072 * @param {HTMLElement} reference - The reference element used to position the popper 12073 * @param {HTMLElement} popper - The HTML element used as popper 12074 * @param {Object} options - Popper.js options 12075 */ 12076function applyStyleOnLoad(reference, popper, options, modifierOptions, state) { 12077 // compute reference element offsets 12078 var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed); 12079 12080 // compute auto placement, store placement inside the data object, 12081 // modifiers will be able to edit `placement` if needed 12082 // and refer to originalPlacement to know the original value 12083 var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding); 12084 12085 popper.setAttribute('x-placement', placement); 12086 12087 // Apply `position` to popper before anything else because 12088 // without the position applied we can't guarantee correct computations 12089 setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' }); 12090 12091 return options; 12092} 12093 12094/** 12095 * @function 12096 * @memberof Popper.Utils 12097 * @argument {Object} data - The data object generated by `update` method 12098 * @argument {Boolean} shouldRound - If the offsets should be rounded at all 12099 * @returns {Object} The popper's position offsets rounded 12100 * 12101 * The tale of pixel-perfect positioning. It's still not 100% perfect, but as 12102 * good as it can be within reason. 12103 * Discussion here: https://github.com/FezVrasta/popper.js/pull/715 12104 * 12105 * Low DPI screens cause a popper to be blurry if not using full pixels (Safari 12106 * as well on High DPI screens). 12107 * 12108 * Firefox prefers no rounding for positioning and does not have blurriness on 12109 * high DPI screens. 12110 * 12111 * Only horizontal placement and left/right values need to be considered. 12112 */ 12113function getRoundedOffsets(data, shouldRound) { 12114 var _data$offsets = data.offsets, 12115 popper = _data$offsets.popper, 12116 reference = _data$offsets.reference; 12117 var round = Math.round, 12118 floor = Math.floor; 12119 12120 var noRound = function noRound(v) { 12121 return v; 12122 }; 12123 12124 var referenceWidth = round(reference.width); 12125 var popperWidth = round(popper.width); 12126 12127 var isVertical = ['left', 'right'].indexOf(data.placement) !== -1; 12128 var isVariation = data.placement.indexOf('-') !== -1; 12129 var sameWidthParity = referenceWidth % 2 === popperWidth % 2; 12130 var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1; 12131 12132 var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor; 12133 var verticalToInteger = !shouldRound ? noRound : round; 12134 12135 return { 12136 left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left), 12137 top: verticalToInteger(popper.top), 12138 bottom: verticalToInteger(popper.bottom), 12139 right: horizontalToInteger(popper.right) 12140 }; 12141} 12142 12143var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent); 12144 12145/** 12146 * @function 12147 * @memberof Modifiers 12148 * @argument {Object} data - The data object generated by `update` method 12149 * @argument {Object} options - Modifiers configuration and options 12150 * @returns {Object} The data object, properly modified 12151 */ 12152function computeStyle(data, options) { 12153 var x = options.x, 12154 y = options.y; 12155 var popper = data.offsets.popper; 12156 12157 // Remove this legacy support in Popper.js v2 12158 12159 var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) { 12160 return modifier.name === 'applyStyle'; 12161 }).gpuAcceleration; 12162 if (legacyGpuAccelerationOption !== undefined) { 12163 console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'); 12164 } 12165 var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration; 12166 12167 var offsetParent = getOffsetParent(data.instance.popper); 12168 var offsetParentRect = getBoundingClientRect(offsetParent); 12169 12170 // Styles 12171 var styles = { 12172 position: popper.position 12173 }; 12174 12175 var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox); 12176 12177 var sideA = x === 'bottom' ? 'top' : 'bottom'; 12178 var sideB = y === 'right' ? 'left' : 'right'; 12179 12180 // if gpuAcceleration is set to `true` and transform is supported, 12181 // we use `translate3d` to apply the position to the popper we 12182 // automatically use the supported prefixed version if needed 12183 var prefixedProperty = getSupportedPropertyName('transform'); 12184 12185 // now, let's make a step back and look at this code closely (wtf?) 12186 // If the content of the popper grows once it's been positioned, it 12187 // may happen that the popper gets misplaced because of the new content 12188 // overflowing its reference element 12189 // To avoid this problem, we provide two options (x and y), which allow 12190 // the consumer to define the offset origin. 12191 // If we position a popper on top of a reference element, we can set 12192 // `x` to `top` to make the popper grow towards its top instead of 12193 // its bottom. 12194 var left = void 0, 12195 top = void 0; 12196 if (sideA === 'bottom') { 12197 // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar) 12198 // and not the bottom of the html element 12199 if (offsetParent.nodeName === 'HTML') { 12200 top = -offsetParent.clientHeight + offsets.bottom; 12201 } else { 12202 top = -offsetParentRect.height + offsets.bottom; 12203 } 12204 } else { 12205 top = offsets.top; 12206 } 12207 if (sideB === 'right') { 12208 if (offsetParent.nodeName === 'HTML') { 12209 left = -offsetParent.clientWidth + offsets.right; 12210 } else { 12211 left = -offsetParentRect.width + offsets.right; 12212 } 12213 } else { 12214 left = offsets.left; 12215 } 12216 if (gpuAcceleration && prefixedProperty) { 12217 styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)'; 12218 styles[sideA] = 0; 12219 styles[sideB] = 0; 12220 styles.willChange = 'transform'; 12221 } else { 12222 // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties 12223 var invertTop = sideA === 'bottom' ? -1 : 1; 12224 var invertLeft = sideB === 'right' ? -1 : 1; 12225 styles[sideA] = top * invertTop; 12226 styles[sideB] = left * invertLeft; 12227 styles.willChange = sideA + ', ' + sideB; 12228 } 12229 12230 // Attributes 12231 var attributes = { 12232 'x-placement': data.placement 12233 }; 12234 12235 // Update `data` attributes, styles and arrowStyles 12236 data.attributes = _extends({}, attributes, data.attributes); 12237 data.styles = _extends({}, styles, data.styles); 12238 data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles); 12239 12240 return data; 12241} 12242 12243/** 12244 * Helper used to know if the given modifier depends from another one.<br /> 12245 * It checks if the needed modifier is listed and enabled. 12246 * @method 12247 * @memberof Popper.Utils 12248 * @param {Array} modifiers - list of modifiers 12249 * @param {String} requestingName - name of requesting modifier 12250 * @param {String} requestedName - name of requested modifier 12251 * @returns {Boolean} 12252 */ 12253function isModifierRequired(modifiers, requestingName, requestedName) { 12254 var requesting = find(modifiers, function (_ref) { 12255 var name = _ref.name; 12256 return name === requestingName; 12257 }); 12258 12259 var isRequired = !!requesting && modifiers.some(function (modifier) { 12260 return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; 12261 }); 12262 12263 if (!isRequired) { 12264 var _requesting = '`' + requestingName + '`'; 12265 var requested = '`' + requestedName + '`'; 12266 console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); 12267 } 12268 return isRequired; 12269} 12270 12271/** 12272 * @function 12273 * @memberof Modifiers 12274 * @argument {Object} data - The data object generated by update method 12275 * @argument {Object} options - Modifiers configuration and options 12276 * @returns {Object} The data object, properly modified 12277 */ 12278function arrow(data, options) { 12279 var _data$offsets$arrow; 12280 12281 // arrow depends on keepTogether in order to work 12282 if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) { 12283 return data; 12284 } 12285 12286 var arrowElement = options.element; 12287 12288 // if arrowElement is a string, suppose it's a CSS selector 12289 if (typeof arrowElement === 'string') { 12290 arrowElement = data.instance.popper.querySelector(arrowElement); 12291 12292 // if arrowElement is not found, don't run the modifier 12293 if (!arrowElement) { 12294 return data; 12295 } 12296 } else { 12297 // if the arrowElement isn't a query selector we must check that the 12298 // provided DOM node is child of its popper node 12299 if (!data.instance.popper.contains(arrowElement)) { 12300 console.warn('WARNING: `arrow.element` must be child of its popper element!'); 12301 return data; 12302 } 12303 } 12304 12305 var placement = data.placement.split('-')[0]; 12306 var _data$offsets = data.offsets, 12307 popper = _data$offsets.popper, 12308 reference = _data$offsets.reference; 12309 12310 var isVertical = ['left', 'right'].indexOf(placement) !== -1; 12311 12312 var len = isVertical ? 'height' : 'width'; 12313 var sideCapitalized = isVertical ? 'Top' : 'Left'; 12314 var side = sideCapitalized.toLowerCase(); 12315 var altSide = isVertical ? 'left' : 'top'; 12316 var opSide = isVertical ? 'bottom' : 'right'; 12317 var arrowElementSize = getOuterSizes(arrowElement)[len]; 12318 12319 // 12320 // extends keepTogether behavior making sure the popper and its 12321 // reference have enough pixels in conjunction 12322 // 12323 12324 // top/left side 12325 if (reference[opSide] - arrowElementSize < popper[side]) { 12326 data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); 12327 } 12328 // bottom/right side 12329 if (reference[side] + arrowElementSize > popper[opSide]) { 12330 data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; 12331 } 12332 data.offsets.popper = getClientRect(data.offsets.popper); 12333 12334 // compute center of the popper 12335 var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; 12336 12337 // Compute the sideValue using the updated popper offsets 12338 // take popper margin in account because we don't have this info available 12339 var css = getStyleComputedProperty(data.instance.popper); 12340 var popperMarginSide = parseFloat(css['margin' + sideCapitalized]
vendor: 4,637 bytes, lines 12340-12480
12340, 10); 12341 var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10); 12342 var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; 12343 12344 // prevent arrowElement from being placed not contiguously to its popper 12345 sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); 12346 12347 data.arrowElement = arrowElement; 12348 data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow); 12349 12350 return data; 12351} 12352 12353/** 12354 * Get the opposite placement variation of the given one 12355 * @method 12356 * @memberof Popper.Utils 12357 * @argument {String} placement variation 12358 * @returns {String} flipped placement variation 12359 */ 12360function getOppositeVariation(variation) { 12361 if (variation === 'end') { 12362 return 'start'; 12363 } else if (variation === 'start') { 12364 return 'end'; 12365 } 12366 return variation; 12367} 12368 12369/** 12370 * List of accepted placements to use as values of the `placement` option.<br /> 12371 * Valid placements are: 12372 * - `auto` 12373 * - `top` 12374 * - `right` 12375 * - `bottom` 12376 * - `left` 12377 * 12378 * Each placement can have a variation from this list: 12379 * - `-start` 12380 * - `-end` 12381 * 12382 * Variations are interpreted easily if you think of them as the left to right 12383 * written languages. Horizontally (`top` and `bottom`), `start` is left and `end` 12384 * is right.<br /> 12385 * Vertically (`left` and `right`), `start` is top and `end` is bottom. 12386 * 12387 * Some valid examples are: 12388 * - `top-end` (on top of reference, right aligned) 12389 * - `right-start` (on right of reference, top aligned) 12390 * - `bottom` (on bottom, centered) 12391 * - `auto-end` (on the side with more space available, alignment depends by placement) 12392 * 12393 * @static 12394 * @type {Array} 12395 * @enum {String} 12396 * @readonly 12397 * @method placements 12398 * @memberof Popper 12399 */ 12400var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start']; 12401 12402// Get rid of `auto` `auto-start` and `auto-end` 12403var validPlacements = placements.slice(3); 12404 12405/** 12406 * Given an initial placement, returns all the subsequent placements 12407 * clockwise (or counter-clockwise). 12408 * 12409 * @method 12410 * @memberof Popper.Utils 12411 * @argument {String} placement - A valid placement (it accepts variations) 12412 * @argument {Boolean} counter - Set to true to walk the placements counterclockwise 12413 * @returns {Array} placements including their variations 12414 */ 12415function clockwise(placement) { 12416 var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 12417 12418 var index = validPlacements.indexOf(placement); 12419 var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); 12420 return counter ? arr.reverse() : arr; 12421} 12422 12423var BEHAVIORS = { 12424 FLIP: 'flip', 12425 CLOCKWISE: 'clockwise', 12426 COUNTERCLOCKWISE: 'counterclockwise' 12427}; 12428 12429/** 12430 * @function 12431 * @memberof Modifiers 12432 * @argument {Object} data - The data object generated by update method 12433 * @argument {Object} options - Modifiers configuration and options 12434 * @returns {Object} The data object, properly modified 12435 */ 12436function flip(data, options) { 12437 // if `inner` modifier is enabled, we can't use the `flip` modifier 12438 if (isModifierEnabled(data.instance.modifiers, 'inner')) { 12439 return data; 12440 } 12441 12442 if (data.flipped && data.placement === data.originalPlacement) { 12443 // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides 12444 return data; 12445 } 12446 12447 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed); 12448 12449 var placement = data.placement.split('-')[0]; 12450 var placementOpposite = getOppositePlacement(placement); 12451 var variation = data.placement.split('-')[1] || ''; 12452 12453 var flipOrder = []; 12454 12455 switch (options.behavior) { 12456 case BEHAVIORS.FLIP: 12457 flipOrder = [placement, placementOpposite]; 12458 break; 12459 case BEHAVIORS.CLOCKWISE: 12460 flipOrder = clockwise(placement); 12461 break; 12462 case BEHAVIORS.COUNTERCLOCKWISE: 12463 flipOrder = clockwise(placement, true); 12464 break; 12465 default: 12466 flipOrder = options.behavior; 12467 } 12468 12469 flipOrder.forEach(function (step, index) { 12470 if (placement !== step || flipOrder.length === index + 1) { 12471 return data; 12472 } 12473 12474 placement = data.placement.split('-')[0]; 12475 placementOpposite = getOppositePlacement(placement); 12476 12477 var popperOffsets = data.offsets.popper; 12478 var refOffsets = data.offsets.reference; 12479 12480 // using floor because the reference offsets may contain decimals we are not going to consider here
vendor: 1,256 bytes, lines 12481-12493
12481 var floor = Math.floor; 12482 var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom); 12483 12484 var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); 12485 var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); 12486 var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); 12487 var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); 12488 12489 var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; 12490 12491 // flip the variation if required 12492 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 12493 var flippedVariation = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom)
vendor: 21,083 bytes, lines 12493-13100
12493; 12494 12495 if (overlapsRef || overflowsBoundaries || flippedVariation) { 12496 // this boolean to detect any flip loop 12497 data.flipped = true; 12498 12499 if (overlapsRef || overflowsBoundaries) { 12500 placement = flipOrder[index + 1]; 12501 } 12502 12503 if (flippedVariation) { 12504 variation = getOppositeVariation(variation); 12505 } 12506 12507 data.placement = placement + (variation ? '-' + variation : ''); 12508 12509 // this object contains `position`, we want to preserve it along with 12510 // any additional property we may add in the future 12511 data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); 12512 12513 data = runModifiers(data.instance.modifiers, data, 'flip'); 12514 } 12515 }); 12516 return data; 12517} 12518 12519/** 12520 * @function 12521 * @memberof Modifiers 12522 * @argument {Object} data - The data object generated by update method 12523 * @argument {Object} options - Modifiers configuration and options 12524 * @returns {Object} The data object, properly modified 12525 */ 12526function keepTogether(data) { 12527 var _data$offsets = data.offsets, 12528 popper = _data$offsets.popper, 12529 reference = _data$offsets.reference; 12530 12531 var placement = data.placement.split('-')[0]; 12532 var floor = Math.floor; 12533 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 12534 var side = isVertical ? 'right' : 'bottom'; 12535 var opSide = isVertical ? 'left' : 'top'; 12536 var measurement = isVertical ? 'width' : 'height'; 12537 12538 if (popper[side] < floor(reference[opSide])) { 12539 data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; 12540 } 12541 if (popper[opSide] > floor(reference[side])) { 12542 data.offsets.popper[opSide] = floor(reference[side]); 12543 } 12544 12545 return data; 12546} 12547 12548/** 12549 * Converts a string containing value + unit into a px value number 12550 * @function 12551 * @memberof {modifiers~offset} 12552 * @private 12553 * @argument {String} str - Value + unit string 12554 * @argument {String} measurement - `height` or `width` 12555 * @argument {Object} popperOffsets 12556 * @argument {Object} referenceOffsets 12557 * @returns {Number|String} 12558 * Value in pixels, or original string if no values were extracted 12559 */ 12560function toValue(str, measurement, popperOffsets, referenceOffsets) { 12561 // separate value from unit 12562 var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); 12563 var value = +split[1]; 12564 var unit = split[2]; 12565 12566 // If it's not a number it's an operator, I guess 12567 if (!value) { 12568 return str; 12569 } 12570 12571 if (unit.indexOf('%') === 0) { 12572 var element = void 0; 12573 switch (unit) { 12574 case '%p': 12575 element = popperOffsets; 12576 break; 12577 case '%': 12578 case '%r': 12579 default: 12580 element = referenceOffsets; 12581 } 12582 12583 var rect = getClientRect(element); 12584 return rect[measurement] / 100 * value; 12585 } else if (unit === 'vh' || unit === 'vw') { 12586 // if is a vh or vw, we calculate the size based on the viewport 12587 var size = void 0; 12588 if (unit === 'vh') { 12589 size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); 12590 } else { 12591 size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 12592 } 12593 return size / 100 * value; 12594 } else { 12595 // if is an explicit pixel unit, we get rid of the unit and keep the value 12596 // if is an implicit unit, it's px, and we return just the value 12597 return value; 12598 } 12599} 12600 12601/** 12602 * Parse an `offset` string to extrapolate `x` and `y` numeric offsets. 12603 * @function 12604 * @memberof {modifiers~offset} 12605 * @private 12606 * @argument {String} offset 12607 * @argument {Object} popperOffsets 12608 * @argument {Object} referenceOffsets 12609 * @argument {String} basePlacement 12610 * @returns {Array} a two cells array with x and y offsets in numbers 12611 */ 12612function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) { 12613 var offsets = [0, 0]; 12614 12615 // Use height if placement is left or right and index is 0 otherwise use width 12616 // in this way the first offset will use an axis and the second one 12617 // will use the other one 12618 var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; 12619 12620 // Split the offset string to obtain a list of values and operands 12621 // The regex addresses values with the plus or minus sign in front (+10, -20, etc) 12622 var fragments = offset.split(/(\+|\-)/).map(function (frag) { 12623 return frag.trim(); 12624 }); 12625 12626 // Detect if the offset string contains a pair of values or a single one 12627 // they could be separated by comma or space 12628 var divider = fragments.indexOf(find(fragments, function (frag) { 12629 return frag.search(/,|\s/) !== -1; 12630 })); 12631 12632 if (fragments[divider] && fragments[divider].indexOf(',') === -1) { 12633 console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.'); 12634 } 12635 12636 // If divider is found, we divide the list of values and operands to divide 12637 // them by ofset X and Y. 12638 var splitRegex = /\s*,\s*|\s+/; 12639 var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments]; 12640 12641 // Convert the values with units to absolute pixels to allow our computations 12642 ops = ops.map(function (op, index) { 12643 // Most of the units rely on the orientation of the popper 12644 var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width'; 12645 var mergeWithPrevious = false; 12646 return op 12647 // This aggregates any `+` or `-` sign that aren't considered operators 12648 // e.g.: 10 + +5 => [10, +, +5] 12649 .reduce(function (a, b) { 12650 if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) { 12651 a[a.length - 1] = b; 12652 mergeWithPrevious = true; 12653 return a; 12654 } else if (mergeWithPrevious) { 12655 a[a.length - 1] += b; 12656 mergeWithPrevious = false; 12657 return a; 12658 } else { 12659 return a.concat(b); 12660 } 12661 }, []) 12662 // Here we convert the string values into number values (in px) 12663 .map(function (str) { 12664 return toValue(str, measurement, popperOffsets, referenceOffsets); 12665 }); 12666 }); 12667 12668 // Loop trough the offsets arrays and execute the operations 12669 ops.forEach(function (op, index) { 12670 op.forEach(function (frag, index2) { 12671 if (isNumeric(frag)) { 12672 offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1); 12673 } 12674 }); 12675 }); 12676 return offsets; 12677} 12678 12679/** 12680 * @function 12681 * @memberof Modifiers 12682 * @argument {Object} data - The data object generated by update method 12683 * @argument {Object} options - Modifiers configuration and options 12684 * @argument {Number|String} options.offset=0 12685 * The offset value as described in the modifier description 12686 * @returns {Object} The data object, properly modified 12687 */ 12688function offset(data, _ref) { 12689 var offset = _ref.offset; 12690 var placement = data.placement, 12691 _data$offsets = data.offsets, 12692 popper = _data$offsets.popper, 12693 reference = _data$offsets.reference; 12694 12695 var basePlacement = placement.split('-')[0]; 12696 12697 var offsets = void 0; 12698 if (isNumeric(+offset)) { 12699 offsets = [+offset, 0]; 12700 } else { 12701 offsets = parseOffset(offset, popper, reference, basePlacement); 12702 } 12703 12704 if (basePlacement === 'left') { 12705 popper.top += offsets[0]; 12706 popper.left -= offsets[1]; 12707 } else if (basePlacement === 'right') { 12708 popper.top += offsets[0]; 12709 popper.left += offsets[1]; 12710 } else if (basePlacement === 'top') { 12711 popper.left += offsets[0]; 12712 popper.top -= offsets[1]; 12713 } else if (basePlacement === 'bottom') { 12714 popper.left += offsets[0]; 12715 popper.top += offsets[1]; 12716 } 12717 12718 data.popper = popper; 12719 return data; 12720} 12721 12722/** 12723 * @function 12724 * @memberof Modifiers 12725 * @argument {Object} data - The data object generated by `update` method 12726 * @argument {Object} options - Modifiers configuration and options 12727 * @returns {Object} The data object, properly modified 12728 */ 12729function preventOverflow(data, options) { 12730 var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper); 12731 12732 // If offsetParent is the reference element, we really want to 12733 // go one step up and use the next offsetParent as reference to 12734 // avoid to make this modifier completely useless and look like broken 12735 if (data.instance.reference === boundariesElement) { 12736 boundariesElement = getOffsetParent(boundariesElement); 12737 } 12738 12739 // NOTE: DOM access here 12740 // resets the popper's position so that the document size can be calculated excluding 12741 // the size of the popper element itself 12742 var transformProp = getSupportedPropertyName('transform'); 12743 var popperStyles = data.instance.popper.style; // assignment to help minification 12744 var top = popperStyles.top, 12745 left = popperStyles.left, 12746 transform = popperStyles[transformProp]; 12747 12748 popperStyles.top = ''; 12749 popperStyles.left = ''; 12750 popperStyles[transformProp] = ''; 12751 12752 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed); 12753 12754 // NOTE: DOM access here 12755 // restores the original style properties after the offsets have been computed 12756 popperStyles.top = top; 12757 popperStyles.left = left; 12758 popperStyles[transformProp] = transform; 12759 12760 options.boundaries = boundaries; 12761 12762 var order = options.priority; 12763 var popper = data.offsets.popper; 12764 12765 var check = { 12766 primary: function primary(placement) { 12767 var value = popper[placement]; 12768 if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { 12769 value = Math.max(popper[placement], boundaries[placement]); 12770 } 12771 return defineProperty({}, placement, value); 12772 }, 12773 secondary: function secondary(placement) { 12774 var mainSide = placement === 'right' ? 'left' : 'top'; 12775 var value = popper[mainSide]; 12776 if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { 12777 value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); 12778 } 12779 return defineProperty({}, mainSide, value); 12780 } 12781 }; 12782 12783 order.forEach(function (placement) { 12784 var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; 12785 popper = _extends({}, popper, check[side](placement)); 12786 }); 12787 12788 data.offsets.popper = popper; 12789 12790 return data; 12791} 12792 12793/** 12794 * @function 12795 * @memberof Modifiers 12796 * @argument {Object} data - The data object generated by `update` method 12797 * @argument {Object} options - Modifiers configuration and options 12798 * @returns {Object} The data object, properly modified 12799 */ 12800function shift(data) { 12801 var placement = data.placement; 12802 var basePlacement = placement.split('-')[0]; 12803 var shiftvariation = placement.split('-')[1]; 12804 12805 // if shift shiftvariation is specified, run the modifier 12806 if (shiftvariation) { 12807 var _data$offsets = data.offsets, 12808 reference = _data$offsets.reference, 12809 popper = _data$offsets.popper; 12810 12811 var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1; 12812 var side = isVertical ? 'left' : 'top'; 12813 var measurement = isVertical ? 'width' : 'height'; 12814 12815 var shiftOffsets = { 12816 start: defineProperty({}, side, reference[side]), 12817 end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) 12818 }; 12819 12820 data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]); 12821 } 12822 12823 return data; 12824} 12825 12826/** 12827 * @function 12828 * @memberof Modifiers 12829 * @argument {Object} data - The data object generated by update method 12830 * @argument {Object} options - Modifiers configuration and options 12831 * @returns {Object} The data object, properly modified 12832 */ 12833function hide(data) { 12834 if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) { 12835 return data; 12836 } 12837 12838 var refRect = data.offsets.reference; 12839 var bound = find(data.instance.modifiers, function (modifier) { 12840 return modifier.name === 'preventOverflow'; 12841 }).boundaries; 12842 12843 if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { 12844 // Avoid unnecessary DOM access if visibility hasn't changed 12845 if (data.hide === true) { 12846 return data; 12847 } 12848 12849 data.hide = true; 12850 data.attributes['x-out-of-boundaries'] = ''; 12851 } else { 12852 // Avoid unnecessary DOM access if visibility hasn't changed 12853 if (data.hide === false) { 12854 return data; 12855 } 12856 12857 data.hide = false; 12858 data.attributes['x-out-of-boundaries'] = false; 12859 } 12860 12861 return data; 12862} 12863 12864/** 12865 * @function 12866 * @memberof Modifiers 12867 * @argument {Object} data - The data object generated by `update` method 12868 * @argument {Object} options - Modifiers configuration and options 12869 * @returns {Object} The data object, properly modified 12870 */ 12871function inner(data) { 12872 var placement = data.placement; 12873 var basePlacement = placement.split('-')[0]; 12874 var _data$offsets = data.offsets, 12875 popper = _data$offsets.popper, 12876 reference = _data$offsets.reference; 12877 12878 var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1; 12879 12880 var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; 12881 12882 popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); 12883 12884 data.placement = getOppositePlacement(placement); 12885 data.offsets.popper = getClientRect(popper); 12886 12887 return data; 12888} 12889 12890/** 12891 * Modifier function, each modifier can have a function of this type assigned 12892 * to its `fn` property.<br /> 12893 * These functions will be called on each update, this means that you must 12894 * make sure they are performant enough to avoid performance bottlenecks. 12895 * 12896 * @function ModifierFn 12897 * @argument {dataObject} data - The data object generated by `update` method 12898 * @argument {Object} options - Modifiers configuration and options 12899 * @returns {dataObject} The data object, properly modified 12900 */ 12901 12902/** 12903 * Modifiers are plugins used to alter the behavior of your poppers.<br /> 12904 * Popper.js uses a set of 9 modifiers to provide all the basic functionalities 12905 * needed by the library. 12906 * 12907 * Usually you don't want to override the `order`, `fn` and `onLoad` props. 12908 * All the other properties are configurations that could be tweaked. 12909 * @namespace modifiers 12910 */ 12911var modifiers = { 12912 /** 12913 * Modifier used to shift the popper on the start or end of its reference 12914 * element.<br /> 12915 * It will read the variation of the `placement` property.<br /> 12916 * It can be one either `-end` or `-start`. 12917 * @memberof modifiers 12918 * @inner 12919 */ 12920 shift: { 12921 /** @prop {number} order=100 - Index used to define the order of execution */ 12922 order: 100, 12923 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 12924 enabled: true, 12925 /** @prop {ModifierFn} */ 12926 fn: shift 12927 }, 12928 12929 /** 12930 * The `offset` modifier can shift your popper on both its axis. 12931 * 12932 * It accepts the following units: 12933 * - `px` or unit-less, interpreted as pixels 12934 * - `%` or `%r`, percentage relative to the length of the reference element 12935 * - `%p`, percentage relative to the length of the popper element 12936 * - `vw`, CSS viewport width unit 12937 * - `vh`, CSS viewport height unit 12938 * 12939 * For length is intended the main axis relative to the placement of the popper.<br /> 12940 * This means that if the placement is `top` or `bottom`, the length will be the 12941 * `width`. In case of `left` or `right`, it will be the `height`. 12942 * 12943 * You can provide a single value (as `Number` or `String`), or a pair of values 12944 * as `String` divided by a comma or one (or more) white spaces.<br /> 12945 * The latter is a deprecated method because it leads to confusion and will be 12946 * removed in v2.<br /> 12947 * Additionally, it accepts additions and subtractions between different units. 12948 * Note that multiplications and divisions aren't supported. 12949 * 12950 * Valid examples are: 12951 * ``` 12952 * 10 12953 * '10%' 12954 * '10, 10' 12955 * '10%, 10' 12956 * '10 + 10%' 12957 * '10 - 5vh + 3%' 12958 * '-10px + 5vh, 5px - 6%' 12959 * ``` 12960 * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap 12961 * > with their reference element, unfortunately, you will have to disable the `flip` modifier. 12962 * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373). 12963 * 12964 * @memberof modifiers 12965 * @inner 12966 */ 12967 offset: { 12968 /** @prop {number} order=200 - Index used to define the order of execution */ 12969 order: 200, 12970 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 12971 enabled: true, 12972 /** @prop {ModifierFn} */ 12973 fn: offset, 12974 /** @prop {Number|String} offset=0 12975 * The offset value as described in the modifier description 12976 */ 12977 offset: 0 12978 }, 12979 12980 /** 12981 * Modifier used to prevent the popper from being positioned outside the boundary. 12982 * 12983 * A scenario exists where the reference itself is not within the boundaries.<br /> 12984 * We can say it has "escaped the boundaries" — or just "escaped".<br /> 12985 * In this case we need to decide whether the popper should either: 12986 * 12987 * - detach from the reference and remain "trapped" in the boundaries, or 12988 * - if it should ignore the boundary and "escape with its reference" 12989 * 12990 * When `escapeWithReference` is set to`true` and reference is completely 12991 * outside its boundaries, the popper will overflow (or completely leave) 12992 * the boundaries in order to remain attached to the edge of the reference. 12993 * 12994 * @memberof modifiers 12995 * @inner 12996 */ 12997 preventOverflow: { 12998 /** @prop {number} order=300 - Index used to define the order of execution */ 12999 order: 300, 13000 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13001 enabled: true, 13002 /** @prop {ModifierFn} */ 13003 fn: preventOverflow, 13004 /** 13005 * @prop {Array} [priority=['left','right','top','bottom']] 13006 * Popper will try to prevent overflow following these priorities by default, 13007 * then, it could overflow on the left and on top of the `boundariesElement` 13008 */ 13009 priority: ['left', 'right', 'top', 'bottom'], 13010 /** 13011 * @prop {number} padding=5 13012 * Amount of pixel used to define a minimum distance between the boundaries 13013 * and the popper. This makes sure the popper always has a little padding 13014 * between the edges of its container 13015 */ 13016 padding: 5, 13017 /** 13018 * @prop {String|HTMLElement} boundariesElement='scrollParent' 13019 * Boundaries used by the modifier. Can be `scrollParent`, `window`, 13020 * `viewport` or any DOM element. 13021 */ 13022 boundariesElement: 'scrollParent' 13023 }, 13024 13025 /** 13026 * Modifier used to make sure the reference and its popper stay near each other 13027 * without leaving any gap between the two. Especially useful when the arrow is 13028 * enabled and you want to ensure that it points to its reference element. 13029 * It cares only about the first axis. You can still have poppers with margin 13030 * between the popper and its reference element. 13031 * @memberof modifiers 13032 * @inner 13033 */ 13034 keepTogether: { 13035 /** @prop {number} order=400 - Index used to define the order of execution */ 13036 order: 400, 13037 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13038 enabled: true, 13039 /** @prop {ModifierFn} */ 13040 fn: keepTogether 13041 }, 13042 13043 /** 13044 * This modifier is used to move the `arrowElement` of the popper to make 13045 * sure it is positioned between the reference element and its popper element. 13046 * It will read the outer size of the `arrowElement` node to detect how many 13047 * pixels of conjunction are needed. 13048 * 13049 * It has no effect if no `arrowElement` is provided. 13050 * @memberof modifiers 13051 * @inner 13052 */ 13053 arrow: { 13054 /** @prop {number} order=500 - Index used to define the order of execution */ 13055 order: 500, 13056 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13057 enabled: true, 13058 /** @prop {ModifierFn} */ 13059 fn: arrow, 13060 /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ 13061 element: '[x-arrow]' 13062 }, 13063 13064 /** 13065 * Modifier used to flip the popper's placement when it starts to overlap its 13066 * reference element. 13067 * 13068 * Requires the `preventOverflow` modifier before it in order to work. 13069 * 13070 * **NOTE:** this modifier will interrupt the current update cycle and will 13071 * restart it if it detects the need to flip the placement. 13072 * @memberof modifiers 13073 * @inner 13074 */ 13075 flip: { 13076 /** @prop {number} order=600 - Index used to define the order of execution */ 13077 order: 600, 13078 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13079 enabled: true, 13080 /** @prop {ModifierFn} */ 13081 fn: flip, 13082 /** 13083 * @prop {String|Array} behavior='flip' 13084 * The behavior used to change the popper's placement. It can be one of 13085 * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid 13086 * placements (with optional variations) 13087 */ 13088 behavior: 'flip', 13089 /** 13090 * @prop {number} padding=5 13091 * The popper will flip if it hits the edges of the `boundariesElement` 13092 */ 13093 padding: 5, 13094 /** 13095 * @prop {String|HTMLElement} boundariesElement='viewport' 13096 * The element which will define the boundaries of the popper position. 13097 * The popper will never be placed outside of the defined boundaries 13098 * (except if `keepTogether` is enabled) 13099 */ 13100 boundariesElement: 'viewport'
13100 13101 }, 13102 13103 /** 13104 * Modifier used to make the popper flow toward the inner of the reference element. 13105 * By default, when this modifier is disabled, the popper will be placed outside 13106 * the reference element. 13107 * @memberof modifiers 13108 * @inner 13109 */ 13110 inner: { 13111 /** @prop {number} order=700 - Index used to define the order of execution */ 13112 order: 700, 13113 /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ 13114 enabled: false, 13115 /** @prop {ModifierFn} */ 13116 fn: inner 13117 }, 13118 13119 /** 13120 * Modifier used to hide the popper when its reference element is outside of the 13121 * popper boundaries. It will set a `x-out-of-boundaries` attribute which can 13122 * be used to hide with a CSS selector the popper when its reference is 13123 * out of boundaries. 13124 * 13125 * Requires the `preventOverflow` modifier before it in order to work. 13126 * @memberof modifiers 13127 * @inner 13128 */ 13129 hide: { 13130 /** @prop {number} order=800 - Index used to define the order of execution */ 13131 order: 800, 13132 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13133 enabled: true, 13134 /** @prop {ModifierFn} */ 13135 fn: hide 13136 }, 13137 13138 /** 13139 * Computes the style that will be applied to the popper element to gets 13140 * properly positioned. 13141 * 13142 * Note that this modifier will not touch the DOM, it just prepares the styles 13143 * so that `applyStyle` modifier can apply it. This separation is useful 13144 * in case you need to replace `applyStyle` with a custom implementation. 13145 * 13146 * This modifier has `850` as `order` value to maintain backward compatibility 13147 * with previous versions of Popper.js. Expect the modifiers ordering method 13148 * to change in future major versions of the library. 13149 * 13150 * @memberof modifiers 13151 * @inner 13152 */ 13153 computeStyle: { 13154 /** @prop {number} order=850 - Index used to define the order of execution */ 13155 order: 850, 13156 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13157 enabled: true, 13158 /** @prop {ModifierFn} */ 13159 fn: computeStyle, 13160 /** 13161 * @prop {Boolean} gpuAcceleration=true 13162 * If true, it uses the CSS 3D transformation to position the popper. 13163 * Otherwise, it will use the `top` and `left` properties 13164 */ 13165 gpuAcceleration: true, 13166 /** 13167 * @prop {string} [x='bottom'] 13168 * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. 13169 * Change this if your popper should grow in a direction different from `bottom` 13170 */ 13171 x: 'bottom', 13172 /** 13173 * @prop {string} [x='left'] 13174 * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. 13175 * Change this if your popper should grow in a direction different from `right` 13176 */ 13177 y: 'right' 13178 }, 13179 13180 /** 13181 * Applies the computed styles to the popper element. 13182 * 13183 * All the DOM manipulations are limited to this modifier. This is useful in case 13184 * you want to integrate Popper.js inside a framework or view library and you 13185 * want to delegate all the DOM manipulations to it. 13186 * 13187 * Note that if you disable this modifier, you must make sure the popper element 13188 * has its position set to `absolute` before Popper.js can do its work! 13189 * 13190 * Just disable this modifier and define your own to achieve the desired effect. 13191 * 13192 * @memberof modifiers 13193 * @inner 13194 */ 13195 applyStyle: { 13196 /** @prop {number} order=900 - Index used to define the order of execution */ 13197 order: 900, 13198 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 13199 enabled: true, 13200 /** @prop {ModifierFn} */
vendor: 4,830 bytes, lines 13201-13339
13201 fn: applyStyle, 13202 /** @prop {Function} */ 13203 onLoad: applyStyleOnLoad, 13204 /** 13205 * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier 13206 * @prop {Boolean} gpuAcceleration=true 13207 * If true, it uses the CSS 3D transformation to position the popper. 13208 * Otherwise, it will use the `top` and `left` properties 13209 */ 13210 gpuAcceleration: undefined 13211 } 13212}; 13213 13214/** 13215 * The `dataObject` is an object containing all the information used by Popper.js. 13216 * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks. 13217 * @name dataObject 13218 * @property {Object} data.instance The Popper.js instance 13219 * @property {String} data.placement Placement applied to popper 13220 * @property {String} data.originalPlacement Placement originally defined on init 13221 * @property {Boolean} data.flipped True if popper has been flipped by flip modifier 13222 * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper 13223 * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier 13224 * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`) 13225 * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`) 13226 * @property {Object} data.boundaries Offsets of the popper boundaries 13227 * @property {Object} data.offsets The measurements of popper, reference and arrow elements 13228 * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values 13229 * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values 13230 * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0 13231 */ 13232 13233/** 13234 * Default options provided to Popper.js constructor.<br /> 13235 * These can be overridden using the `options` argument of Popper.js.<br /> 13236 * To override an option, simply pass an object with the same 13237 * structure of the `options` object, as the 3rd argument. For example: 13238 * ``` 13239 * new Popper(ref, pop, { 13240 * modifiers: { 13241 * preventOverflow: { enabled: false } 13242 * } 13243 * }) 13244 * ``` 13245 * @type {Object} 13246 * @static 13247 * @memberof Popper 13248 */ 13249var Defaults = { 13250 /** 13251 * Popper's placement. 13252 * @prop {Popper.placements} placement='bottom' 13253 */ 13254 placement: 'bottom', 13255 13256 /** 13257 * Set this to true if you want popper to position it self in 'fixed' mode 13258 * @prop {Boolean} positionFixed=false 13259 */ 13260 positionFixed: false, 13261 13262 /** 13263 * Whether events (resize, scroll) are initially enabled. 13264 * @prop {Boolean} eventsEnabled=true 13265 */ 13266 eventsEnabled: true, 13267 13268 /** 13269 * Set to true if you want to automatically remove the popper when 13270 * you call the `destroy` method. 13271 * @prop {Boolean} removeOnDestroy=false 13272 */ 13273 removeOnDestroy: false, 13274 13275 /** 13276 * Callback called when the popper is created.<br /> 13277 * By default, it is set to no-op.<br /> 13278 * Access Popper.js instance with `data.instance`. 13279 * @prop {onCreate} 13280 */ 13281 onCreate: function onCreate() {}, 13282 13283 /** 13284 * Callback called when the popper is updated. This callback is not called 13285 * on the initialization/creation of the popper, but only on subsequent 13286 * updates.<br /> 13287 * By default, it is set to no-op.<br /> 13288 * Access Popper.js instance with `data.instance`. 13289 * @prop {onUpdate} 13290 */ 13291 onUpdate: function onUpdate() {}, 13292 13293 /** 13294 * List of modifiers used to modify the offsets before they are applied to the popper. 13295 * They provide most of the functionalities of Popper.js. 13296 * @prop {modifiers} 13297 */ 13298 modifiers: modifiers 13299}; 13300 13301/** 13302 * @callback onCreate 13303 * @param {dataObject} data 13304 */ 13305 13306/** 13307 * @callback onUpdate 13308 * @param {dataObject} data 13309 */ 13310 13311// Utils 13312// Methods 13313var Popper = function () { 13314 /** 13315 * Creates a new Popper.js instance. 13316 * @class Popper 13317 * @param {HTMLElement|referenceObject} reference - The reference element used to position the popper 13318 * @param {HTMLElement} popper - The HTML element used as the popper 13319 * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults) 13320 * @return {Object} instance - The generated Popper.js instance 13321 */ 13322 function Popper(reference, popper) { 13323 var _this = this; 13324 13325 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 13326 classCallCheck(this, Popper); 13327 13328 this.scheduleUpdate = function () { 13329 return requestAnimationFrame(_this.update); 13330 }; 13331 13332 // make update() debounced, so that it only runs at most once-per-tick 13333 this.update = debounce(this.update.bind(this)); 13334 13335 // with {} we create a new object with the options inside it 13336 this.options = _extends({}, Popper.Defaults, options); 13337 13338 // init state 13339 this.state = {
13340 isDestroyed: false, 13341 isCreated: false, 13342 scrollParents: [] 13343 }; 13344 13345 // get reference and popper elements (allow jQuery wrappers) 13346 this.reference = reference && reference.jquery ? reference[0] : reference; 13347 this.popper = popper && popper.jquery ? popper[0] : popper; 13348 13349 // Deep merge modifiers options 13350 this.options.modifiers = {}; 13351 Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) { 13352 _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {}); 13353 }); 13354 13355 // Refactoring modifiers' list (Object => Array) 13356 this.modifiers = Object.keys(this.options.modifiers).map(function (name) { 13357 return _extends({ 13358 name: name 13359 }, _this.options.modifiers[name]); 13360 }) 13361 // sort the modifiers by order 13362 .sort(function (a, b) { 13363 return a.order - b.order; 13364 }); 13365 13366 // modifiers have the ability to execute arbitrary code when Popper.js get inited 13367 // such code is executed in the same order of its modifier 13368 // they could add new properties to their options configuration 13369 // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`! 13370 this.modifiers.forEach(function (modifierOptions) { 13371 if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) { 13372 modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); 13373 } 13374 }); 13375 13376 // fire the first update to position the popper in the right place 13377 this.update(); 13378 13379 var eventsEnabled = this.options.eventsEnabled; 13380 if (eventsEnabled) { 13381 // setup event listeners, they will take care of update the position in specific situations 13382 this.enableEventListeners(); 13383 } 13384 13385 this.state.eventsEnabled = eventsEnabled; 13386 } 13387 13388 // We can't use class properties because they don't get listed in the 13389 // class prototype and break stuff like Sinon stubs 13390 13391 13392 createClass(Popper, [{ 13393 key: 'update', 13394 value: function update$$1() { 13395 return update.call(this); 13396 } 13397 }, { 13398 key: 'destroy', 13399 value: function destroy$$1() { 13400 return destroy.call(this); 13401 } 13402 }, { 13403 key: 'enableEventListeners', 13404 value: function enableEventListeners$$1() { 13405 return enableEventListeners.call(this); 13406 } 13407 }, { 13408 key: 'disableEventListeners', 13409 value: function disableEventListeners$$1() { 13410 return disableEventListeners.call(this); 13411 } 13412 13413 /** 13414 * Schedules an update. It will run on the next UI update available. 13415 * @method scheduleUpdate 13416 * @memberof Popper 13417 */ 13418 13419 13420 /** 13421 * Collection of utilities useful when writing custom modifiers. 13422 * Starting from version 1.7, this method is available only if you 13423 * include `popper-utils.js` before `popper.js`. 13424 * 13425 * **DEPRECATION**: This way to access PopperUtils is deprecated 13426 * and will be removed in v2! Use the PopperUtils module directly instead. 13427 * Due to the high instability of the methods contained in Utils, we can't 13428 * guarantee them to follow semver. Use them at your own risk! 13429 * @static 13430 * @private 13431 * @type {Object} 13432 * @deprecated since version 1.8 13433 * @member Utils 13434 * @memberof Popper 13435 */ 13436 13437 }]); 13438 return Popper; 13439}(); 13440 13441/** 13442 * The `referenceObject` is an object that provides an interface compatible with Popper.js 13443 * and lets you use it as replacement of a real DOM node.<br /> 13444 * You can use this method to position a popper relatively to a set of coordinates 13445 * in case you don't have a DOM node to use as reference. 13446 * 13447 * ``` 13448 * new Popper(referenceObject, popperNode); 13449 * ``` 13450 * 13451 * NB: This feature isn't supported in Internet Explorer 10. 13452 * @name referenceObject 13453 * @property {Function} data.getBoundingClientRect 13454 * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method. 13455 * @property {number} data.clientWidth 13456 * An ES6 getter that will return the width of the virtual reference element. 13457 * @property {number} data.clientHeight 13458 * An ES6 getter that will return the height of the virtual reference element. 13459 */ 13460 13461 13462Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils; 13463Popper.placements = placements; 13464Popper.Defaults = Defaults; 13465 13466return Popper; 13467 13468}))); 13469//# sourceMappingURL=popper.js.map 13470 13471/*! 13472 * Bootstrap v4.3.1 (https://getbootstrap.com/) 13473 * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 13474 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 13475 */ 13476(function (global, factory) { 13477 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery'), require('popper.js')) : 13478 typeof define === 'function' && define.amd ? define(['exports', 'jquery', 'popper.js'], factory) : 13479 (global = global || self, factory(global.bootstrap = {}, global.jQuery, global.Popper)); 13480}(this, function (exports, $, Popper) { 'use strict'; 13481 13482 $ = $ && $.hasOwnProperty('default') ? $['default'] : $; 13483 Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper; 13484 13485 function _defineProperties(target, props) { 13486 for (var i = 0; i < props.length; i++) { 13487 var descriptor = props[i]; 13488 descriptor.enumerable = descriptor.enumerable || false; 13489 descriptor.configurable = true; 13490 if ("value" in descriptor) descriptor.writable = true; 13491 Object.defineProperty(target, descriptor.key, descriptor); 13492 } 13493 } 13494 13495 function _createClass(Constructor, protoProps, staticProps) { 13496 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 13497 if (staticProps) _defineProperties(Constructor, staticProps); 13498 return Constructor; 13499 } 13500 13501 function _defineProperty(obj, key, value) { 13502 if (key in obj) { 13503 Object.defineProperty(obj, key, { 13504 value: value, 13505 enumerable: true, 13506 configurable: true, 13507 writable: true 13508 }); 13509 } else { 13510 obj[key] = value; 13511 } 13512 13513 return obj; 13514 } 13515 13516 function _objectSpread(target) { 13517 for (var i = 1; i < arguments.length; i++) { 13518 var source = arguments[i] != null ? arguments[i] : {}; 13519 var ownKeys = Object.keys(source); 13520 13521 if (typeof Object.getOwnPropertySymbols === 'function') { 13522 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { 13523 return Object.getOwnPropertyDescriptor(source, sym).enumerable; 13524 })); 13525 } 13526 13527 ownKeys.forEach(function (key) { 13528 _defineProperty(target, key, source[key]); 13529 }); 13530 } 13531 13532 return target; 13533 } 13534 13535 function _inheritsLoose(subClass, superClass) { 13536 subClass.prototype = Object.create(superClass.prototype); 13537 subClass.prototype.constructor = subClass; 13538 subClass.__proto__ = superClass; 13539 } 13540 13541 /** 13542 * -------------------------------------------------------------------------- 13543 * Bootstrap (v4.3.1): util.js 13544 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 13545 * -------------------------------------------------------------------------- 13546 */ 13547 /** 13548 * ------------------------------------------------------------------------ 13549 * Private TransitionEnd Helpers 13550 * ------------------------------------------------------------------------ 13551 */ 13552 13553 var TRANSITION_END = 'transitionend'; 13554 var MAX_UID = 1000000; 13555 var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp) 13556 13557 function toType(obj) { 13558 return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); 13559 } 13560 13561 function getSpecialTransitionEndEvent() { 13562 return { 13563 bindType: TRANSITION_END, 13564 delegateType: TRANSITION_END, 13565 handle: function handle(event) { 13566 if ($(event.target).is(this)) { 13567 return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params 13568 } 13569 13570 return undefined; // eslint-disable-line no-undefined 13571 } 13572 }; 13573 } 13574 13575 function transitionEndEmulator(duration) { 13576 var _this = this; 13577 13578 var called = false;
13579 $(this).one(Util.TRANSITION_END, function () { 13580 called = true; 13581 }); 13582 setTimeout(function () { 13583 if (!called) { 13584 Util.triggerTransitionEnd(_this); 13585 } 13586 }, duration); 13587 return this; 13588 } 13589 13590 function setTransitionEndSupport() { 13591 $.fn.emulateTransitionEnd = transitionEndEmulator; 13592 $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); 13593 } 13594 /** 13595 * -------------------------------------------------------------------------- 13596 * Public Util Api 13597 * -------------------------------------------------------------------------- 13598 */ 13599 13600 13601 var Util = { 13602 TRANSITION_END: 'bsTransitionEnd', 13603 getUID: function getUID(prefix) { 13604 do { 13605 // eslint-disable-next-line no-bitwise 13606 prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here 13607 } while (document.getElementById(prefix)); 13608 13609 return prefix; 13610 }, 13611 getSelectorFromElement: function getSelectorFromElement(element) { 13612 var selector = element.getAttribute('data-target'); 13613 13614 if (!selector || selector === '#') { 13615 var hrefAttr = element.getAttribute('href'); 13616 selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''; 13617 } 13618 13619 try { 13620 return document.querySelector(selector) ? selector : null; 13621 } catch (err) { 13622 return null; 13623 } 13624 }, 13625 getTransitionDurationFromElement: function getTransitionDurationFromElement(element) { 13626 if (!element) { 13627 return 0; 13628 } // Get transition-duration of the element 13629 13630 13631 var transitionDuration = $(element).css('transition-duration'); 13632 var transitionDelay = $(element).css('transition-delay'); 13633 var floatTransitionDuration = parseFloat(transitionDuration); 13634 var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found 13635 13636 if (!floatTransitionDuration && !floatTransitionDelay) { 13637 return 0; 13638 } // If multiple durations are defined, take the first 13639 13640 13641 transitionDuration = transitionDuration.split(',')[0]; 13642 transitionDelay = transitionDelay.split(',')[0]; 13643 return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; 13644 }, 13645 reflow: function reflow(element) { 13646 return element.offsetHeight; 13647 }, 13648 triggerTransitionEnd: function triggerTransitionEnd(element) { 13649 $(element).trigger(TRANSITION_END); 13650 }, 13651 // TODO: Remove in v5 13652 supportsTransitionEnd: function supportsTransitionEnd() { 13653 return Boolean(TRANSITION_END); 13654 }, 13655 isElement: function isElement(obj) { 13656 return (obj[0] || obj).nodeType; 13657 }, 13658 typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { 13659 for (var property in configTypes) { 13660 if (Object.prototype.hasOwnProperty.call(configTypes, property)) { 13661 var expectedTypes = configTypes[property]; 13662 var value = config[property]; 13663 var valueType = value && Util.isElement(value) ? 'element' : toType(value); 13664 13665 if (!new RegExp(expectedTypes).test(valueType)) { 13666 throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\".")); 13667 } 13668 } 13669 } 13670 }, 13671 findShadowRoot: function findShadowRoot(element) { 13672 if (!document.documentElement.attachShadow) { 13673 return null; 13674 } // Can find the shadow root otherwise it'll return the document 13675 13676 13677 if (typeof element.getRootNode === 'function') { 13678 var root = element.getRootNode(); 13679 return root instanceof ShadowRoot ? root : null; 13680 } 13681 13682 if (element instanceof ShadowRoot) { 13683 return element; 13684 } // when we don't find a shadow root 13685 13686 13687 if (!element.parentNode) { 13688 return null; 13689 } 13690 13691 return Util.findShadowRoot(element.parentNode); 13692 } 13693 }; 13694 setTransitionEndSupport(); 13695 13696 /** 13697 * ------------------------------------------------------------------------ 13698 * Constants 13699 * ------------------------------------------------------------------------ 13700 */ 13701 13702 var NAME = 'alert'; 13703 var VERSION = '4.3.1'; 13704 var DATA_KEY = 'bs.alert'; 13705 var EVENT_KEY = "." + DATA_KEY; 13706 var DATA_API_KEY = '.data-api'; 13707 var JQUERY_NO_CONFLICT = $.fn[NAME]; 13708 var Selector = { 13709 DISMISS: '[data-dismiss="alert"]' 13710 }; 13711 var Event = { 13712 CLOSE: "close" + EVENT_KEY, 13713 CLOSED: "closed" + EVENT_KEY, 13714 CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY 13715 }; 13716 var ClassName = { 13717 ALERT: 'alert', 13718 FADE: 'fade', 13719 SHOW: 'show' 13720 /** 13721 * ------------------------------------------------------------------------ 13722 * Class Definition 13723 * ------------------------------------------------------------------------ 13724 */ 13725 13726 }; 13727 13728 var Alert = 13729 /*#__PURE__*/ 13730 function () { 13731 function Alert(element) { 13732 this._element = element; 13733 } // Getters 13734 13735 13736 var _proto = Alert.prototype; 13737 13738 // Public 13739 _proto.close = function close(element) { 13740 var rootElement = this._element; 13741 13742 if (element) { 13743 rootElement = this._getRootElement(element); 13744 } 13745 13746 var customEvent = this._triggerCloseEvent(rootElement); 13747 13748 if (customEvent.isDefaultPrevented()) { 13749 return; 13750 } 13751 13752 this._removeElement(rootElement); 13753 }; 13754 13755 _proto.dispose = function dispose() { 13756 $.removeData(this._element, DATA_KEY); 13757 this._element = null; 13758 } // Private 13759 ; 13760 13761 _proto._getRootElement = function _getRootElement(element) { 13762 var selector = Util.getSelectorFromElement(element); 13763 var parent = false;
13764 13765 if (selector) { 13766 parent = document.querySelector(selector); 13767 } 13768 13769 if (!parent) { 13770 parent = $(element).closest("." + ClassName.ALERT)[0]; 13771 } 13772 13773 return parent; 13774 }; 13775 13776 _proto._triggerCloseEvent = function _triggerCloseEvent(element) { 13777 var closeEvent = $.Event(Event.CLOSE); 13778 $(element).trigger(closeEvent); 13779 return closeEvent; 13780 }; 13781 13782 _proto._removeElement = function _removeElement(element) { 13783 var _this = this; 13784 13785 $(element).removeClass(ClassName.SHOW); 13786 13787 if (!$(element).hasClass(ClassName.FADE)) { 13788 this._destroyElement(element); 13789 13790 return; 13791 } 13792 13793 var transitionDuration = Util.getTransitionDurationFromElement(element); 13794 $(element).one(Util.TRANSITION_END, function (event) { 13795 return _this._destroyElement(element, event); 13796 }).emulateTransitionEnd(transitionDuration); 13797 }; 13798 13799 _proto._destroyElement = function _destroyElement(element) { 13800 $(element).detach().trigger(Event.CLOSED).remove(); 13801 } // Static 13802 ; 13803 13804 Alert._jQueryInterface = function _jQueryInterface(config) { 13805 return this.each(function () { 13806 var $element = $(this); 13807 var data = $element.data(DATA_KEY); 13808 13809 if (!data) { 13810 data = new Alert(this); 13811 $element.data(DATA_KEY, data); 13812 } 13813 13814 if (config === 'close') { 13815 data[config](this); 13816 } 13817 }); 13818 }; 13819 13820 Alert._handleDismiss = function _handleDismiss(alertInstance) { 13821 return function (event) { 13822 if (event) { 13823 event.preventDefault(); 13824 } 13825 13826 alertInstance.close(this); 13827 }; 13828 }; 13829 13830 _createClass(Alert, null, [{ 13831 key: "VERSION", 13832 get: function get() { 13833 return VERSION; 13834 } 13835 }]); 13836 13837 return Alert; 13838 }(); 13839 /** 13840 * ------------------------------------------------------------------------ 13841 * Data Api implementation 13842 * ------------------------------------------------------------------------ 13843 */ 13844 13845 13846 $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert())); 13847 /** 13848 * ------------------------------------------------------------------------ 13849 * jQuery 13850 * ------------------------------------------------------------------------ 13851 */ 13852 13853 $.fn[NAME] = Alert._jQueryInterface; 13854 $.fn[NAME].Constructor = Alert; 13855 13856 $.fn[NAME].noConflict = function () { 13857 $.fn[NAME] = JQUERY_NO_CONFLICT; 13858 return Alert._jQueryInterface; 13859 }; 13860 13861 /** 13862 * ------------------------------------------------------------------------ 13863 * Constants 13864 * ------------------------------------------------------------------------ 13865 */ 13866 13867 var NAME$1 = 'button'; 13868 var VERSION$1 = '4.3.1'; 13869 var DATA_KEY$1 = 'bs.button'; 13870 var EVENT_KEY$1 = "." + DATA_KEY$1; 13871 var DATA_API_KEY$1 = '.data-api'; 13872 var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1]; 13873 var ClassName$1 = { 13874 ACTIVE: 'active', 13875 BUTTON: 'btn', 13876 FOCUS: 'focus' 13877 }; 13878 var Selector$1 = { 13879 DATA_TOGGLE_CARROT: '[data-toggle^="button"]', 13880 DATA_TOGGLE: '[data-toggle="buttons"]', 13881 INPUT: 'input:not([type="hidden"])', 13882 ACTIVE: '.active', 13883 BUTTON: '.btn' 13884 }; 13885 var Event$1 = { 13886 CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1, 13887 FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1) 13888 /** 13889 * ------------------------------------------------------------------------ 13890 * Class Definition 13891 * ------------------------------------------------------------------------ 13892 */ 13893 13894 }; 13895 13896 var Button = 13897 /*#__PURE__*/ 13898 function () { 13899 function Button(element) { 13900 this._element = element; 13901 } // Getters 13902 13903 13904 var _proto = Button.prototype; 13905 13906 // Public 13907 _proto.toggle = function toggle() { 13908 var triggerChangeEvent = true; 13909 var addAriaPressed = true; 13910 var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLE)[0]; 13911 13912 if (rootElement) { 13913 var input = this._element.querySelector(Selector$1.INPUT); 13914 13915 if (input) { 13916 if (input.type === 'radio') { 13917 if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) { 13918 triggerChangeEvent = false;
13919 } else { 13920 var activeElement = rootElement.querySelector(Selector$1.ACTIVE); 13921 13922 if (activeElement) { 13923 $(activeElement).removeClass(ClassName$1.ACTIVE); 13924 } 13925 } 13926 } 13927 13928 if (triggerChangeEvent) { 13929 if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) { 13930 return; 13931 } 13932 13933 input.checked = !this._element.classList.contains(ClassName$1.ACTIVE); 13934 $(input).trigger('change'); 13935 } 13936 13937 input.focus(); 13938 addAriaPressed = false; 13939 } 13940 } 13941 13942 if (addAriaPressed) { 13943 this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE)); 13944 } 13945 13946 if (triggerChangeEvent) { 13947 $(this._element).toggleClass(ClassName$1.ACTIVE); 13948 } 13949 }; 13950 13951 _proto.dispose = function dispose() { 13952 $.removeData(this._element, DATA_KEY$1); 13953 this._element = null; 13954 } // Static 13955 ; 13956 13957 Button._jQueryInterface = function _jQueryInterface(config) { 13958 return this.each(function () { 13959 var data = $(this).data(DATA_KEY$1); 13960 13961 if (!data) { 13962 data = new Button(this); 13963 $(this).data(DATA_KEY$1, data); 13964 } 13965 13966 if (config === 'toggle') { 13967 data[config](); 13968 } 13969 }); 13970 }; 13971 13972 _createClass(Button, null, [{ 13973 key: "VERSION", 13974 get: function get() { 13975 return VERSION$1; 13976 } 13977 }]); 13978 13979 return Button; 13980 }(); 13981 /** 13982 * ------------------------------------------------------------------------ 13983 * Data Api implementation 13984 * ------------------------------------------------------------------------ 13985 */ 13986 13987 13988 $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) { 13989 event.preventDefault(); 13990 var button = event.target; 13991 13992 if (!$(button).hasClass(ClassName$1.BUTTON)) { 13993 button = $(button).closest(Selector$1.BUTTON); 13994 } 13995 13996 Button._jQueryInterface.call($(button), 'toggle'); 13997 }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) { 13998 var button = $(event.target).closest(Selector$1.BUTTON)[0]; 13999 $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type)); 14000 }); 14001 /** 14002 * ------------------------------------------------------------------------ 14003 * jQuery 14004 * ------------------------------------------------------------------------ 14005 */ 14006 14007 $.fn[NAME$1] = Button._jQueryInterface; 14008 $.fn[NAME$1].Constructor = Button; 14009 14010 $.fn[NAME$1].noConflict = function () { 14011 $.fn[NAME$1] = JQUERY_NO_CONFLICT$1; 14012 return Button._jQueryInterface; 14013 }; 14014 14015 /** 14016 * ------------------------------------------------------------------------ 14017 * Constants 14018 * ------------------------------------------------------------------------ 14019 */ 14020 14021 var NAME$2 = 'carousel'; 14022 var VERSION$2 = '4.3.1'; 14023 var DATA_KEY$2 = 'bs.carousel'; 14024 var EVENT_KEY$2 = "." + DATA_KEY$2; 14025 var DATA_API_KEY$2 = '.data-api'; 14026 var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2]; 14027 var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key 14028 14029 var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key 14030 14031 var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch 14032 14033 var SWIPE_THRESHOLD = 40; 14034 var Default = { 14035 interval: 5000, 14036 keyboard: true, 14037 slide: false, 14038 pause: 'hover', 14039 wrap: true, 14040 touch: true 14041 }; 14042 var DefaultType = { 14043 interval: '(number|boolean)', 14044 keyboard: 'boolean', 14045 slide: '(boolean|string)', 14046 pause: '(string|boolean)', 14047 wrap: 'boolean', 14048 touch: 'boolean' 14049 }; 14050 var Direction = { 14051 NEXT: 'next', 14052 PREV: 'prev', 14053 LEFT: 'left', 14054 RIGHT: 'right' 14055 }; 14056 var Event$2 = { 14057 SLIDE: "slide" + EVENT_KEY$2, 14058 SLID: "slid" + EVENT_KEY$2, 14059 KEYDOWN: "keydown" + EVENT_KEY$2, 14060 MOUSEENTER: "mouseenter" + EVENT_KEY$2, 14061 MOUSELEAVE: "mouseleave" + EVENT_KEY$2, 14062 TOUCHSTART: "touchstart" + EVENT_KEY$2, 14063 TOUCHMOVE: "touchmove" + EVENT_KEY$2, 14064 TOUCHEND: "touchend" + EVENT_KEY$2, 14065 POINTERDOWN: "pointerdown" + EVENT_KEY$2, 14066 POINTERUP: "pointerup" + EVENT_KEY$2, 14067 DRAG_START: "dragstart" + EVENT_KEY$2, 14068 LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2, 14069 CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2 14070 }; 14071 var ClassName$2 = { 14072 CAROUSEL: 'carousel', 14073 ACTIVE: 'active', 14074 SLIDE: 'slide', 14075 RIGHT: 'carousel-item-right', 14076 LEFT: 'carousel-item-left', 14077 NEXT: 'carousel-item-next', 14078 PREV: 'carousel-item-prev', 14079 ITEM: 'carousel-item', 14080 POINTER_EVENT: 'pointer-event' 14081 }; 14082 var Selector$2 = { 14083 ACTIVE: '.active', 14084 ACTIVE_ITEM: '.active.carousel-item', 14085 ITEM: '.carousel-item', 14086 ITEM_IMG: '.carousel-item img', 14087 NEXT_PREV: '.carousel-item-next, .carousel-item-prev', 14088 INDICATORS: '.carousel-indicators',
14089 DATA_SLIDE: '[data-slide], [data-slide-to]', 14090 DATA_RIDE: '[data-ride="carousel"]' 14091 }; 14092 var PointerType = { 14093 TOUCH: 'touch', 14094 PEN: 'pen' 14095 /** 14096 * ------------------------------------------------------------------------ 14097 * Class Definition 14098 * ------------------------------------------------------------------------ 14099 */ 14100 14101 }; 14102 14103 var Carousel = 14104 /*#__PURE__*/ 14105 function () { 14106 function Carousel(element, config) { 14107 this._items = null; 14108 this._interval = null; 14109 this._activeElement = null; 14110 this._isPaused = false; 14111 this._isSliding = false; 14112 this.touchTimeout = null; 14113 this.touchStartX = 0; 14114 this.touchDeltaX = 0; 14115 this._config = this._getConfig(config); 14116 this._element = element; 14117 this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS); 14118 this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; 14119 this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent); 14120 14121 this._addEventListeners(); 14122 } // Getters 14123 14124 14125 var _proto = Carousel.prototype; 14126 14127 // Public 14128 _proto.next = function next() { 14129 if (!this._isSliding) { 14130 this._slide(Direction.NEXT); 14131 } 14132 }; 14133 14134 _proto.nextWhenVisible = function nextWhenVisible() { 14135 // Don't call next when the page isn't visible 14136 // or the carousel or its parent isn't visible 14137 if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') { 14138 this.next(); 14139 } 14140 }; 14141 14142 _proto.prev = function prev() { 14143 if (!this._isSliding) { 14144 this._slide(Direction.PREV); 14145 } 14146 }; 14147 14148 _proto.pause = function pause(event) { 14149 if (!event) { 14150 this._isPaused = true; 14151 } 14152 14153 if (this._element.querySelector(Selector$2.NEXT_PREV)) { 14154 Util.triggerTransitionEnd(this._element); 14155 this.cycle(true); 14156 } 14157 14158 clearInterval(this._interval); 14159 this._interval = null; 14160 }; 14161 14162 _proto.cycle = function cycle(event) { 14163 if (!event) { 14164 this._isPaused = false; 14165 } 14166 14167 if (this._interval) { 14168 clearInterval(this._interval); 14169 this._interval = null; 14170 } 14171 14172 if (this._config.interval && !this._isPaused) { 14173 this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); 14174 } 14175 }; 14176 14177 _proto.to = function to(index) { 14178 var _this = this; 14179 14180 this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM); 14181 14182 var activeIndex = this._getItemIndex(this._activeElement); 14183 14184 if (index > this._items.length - 1 || index < 0) { 14185 return; 14186 } 14187 14188 if (this._isSliding) { 14189 $(this._element).one(Event$2.SLID, function () { 14190 return _this.to(index); 14191 }); 14192 return; 14193 } 14194 14195 if (activeIndex === index) { 14196 this.pause(); 14197 this.cycle(); 14198 return; 14199 } 14200 14201 var direction = index > activeIndex ? Direction.NEXT : Direction.PREV; 14202 14203 this._slide(direction, this._items[index]); 14204 }; 14205 14206 _proto.dispose = function dispose() { 14207 $(this._element).off(EVENT_KEY$2); 14208 $.removeData(this._element, DATA_KEY$2); 14209 this._items = null; 14210 this._config = null; 14211 this._element = null; 14212 this._interval = null; 14213 this._isPaused = null; 14214 this._isSliding = null; 14215 this._activeElement = null; 14216 this._indicatorsElement = null; 14217 } // Private 14218 ; 14219 14220 _proto._getConfig = function _getConfig(config) { 14221 config = _objectSpread({}, Default, config); 14222 Util.typeCheckConfig(NAME$2, config, DefaultType); 14223 return config; 14224 }; 14225 14226 _proto._handleSwipe = function _handleSwipe() { 14227 var absDeltax = Math.abs(this.touchDeltaX); 14228 14229 if (absDeltax <= SWIPE_THRESHOLD) { 14230 return; 14231 } 14232 14233 var direction = absDeltax / this.touchDeltaX; // swipe left 14234 14235 if (direction > 0) { 14236 this.prev(); 14237 } // swipe right 14238 14239 14240 if (direction < 0) { 14241 this.next(); 14242 } 14243 }; 14244 14245 _proto._addEventListeners = function _addEventListeners() { 14246 var _this2 = this; 14247 14248 if (this._config.keyboard) { 14249 $(this._element).on(Event$2.KEYDOWN, function (event) { 14250 return _this2._keydown(event); 14251 }); 14252 } 14253 14254 if (this._config.pause === 'hover') { 14255 $(this._element).on(Event$2.MOUSEENTER, function (event) { 14256 return _this2.pause(event); 14257 }).on(Event$2.MOUSELEAVE, function (event) { 14258 return _this2.cycle(event); 14259 }); 14260 } 14261 14262 if (this._config.touch) { 14263 this._addTouchEventListeners(); 14264 } 14265 }; 14266 14267 _proto._addTouchEventListeners = function _addTouchEventListeners() { 14268 var _this3 = this; 14269 14270 if (!this._touchSupported) { 14271 return; 14272 } 14273 14274 var start = function start(event) { 14275 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 14276 _this3.touchStartX = event.originalEvent.clientX; 14277 } else if (!_this3._pointerEvent) { 14278 _this3.touchStartX = event.originalEvent.touches[0].clientX; 14279 } 14280 }; 14281 14282 var move = function move(event) { 14283 // ensure swiping with one touch and not pinching 14284 if (event.originalEvent.touches && event.originalEvent.touches.length > 1) { 14285 _this3.touchDeltaX = 0; 14286 } else { 14287 _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX; 14288 } 14289 }; 14290 14291 var end = function end(event) { 14292 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 14293 _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX; 14294 } 14295 14296 _this3._handleSwipe(); 14297 14298 if (_this3._config.pause === 'hover') {
14299 // If it's a touch-enabled device, mouseenter/leave are fired as 14300 // part of the mouse compatibility events on first tap - the carousel 14301 // would stop cycling until user tapped out of it; 14302 // here, we listen for touchend, explicitly pause the carousel 14303 // (as if it's the second time we tap on it, mouseenter compat event 14304 // is NOT fired) and after a timeout (to allow for mouse compatibility 14305 // events to fire) we explicitly restart cycling 14306 _this3.pause(); 14307 14308 if (_this3.touchTimeout) { 14309 clearTimeout(_this3.touchTimeout); 14310 } 14311 14312 _this3.touchTimeout = setTimeout(function (event) { 14313 return _this3.cycle(event); 14314 }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval); 14315 } 14316 }; 14317 14318 $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) { 14319 return e.preventDefault(); 14320 }); 14321 14322 if (this._pointerEvent) { 14323 $(this._element).on(Event$2.POINTERDOWN, function (event) { 14324 return start(event); 14325 }); 14326 $(this._element).on(Event$2.POINTERUP, function (event) { 14327 return end(event); 14328 }); 14329 14330 this._element.classList.add(ClassName$2.POINTER_EVENT); 14331 } else { 14332 $(this._element).on(Event$2.TOUCHSTART, function (event) { 14333 return start(event); 14334 }); 14335 $(this._element).on(Event$2.TOUCHMOVE, function (event) { 14336 return move(event); 14337 }); 14338 $(this._element).on(Event$2.TOUCHEND, function (event) { 14339 return end(event); 14340 }); 14341 } 14342 }; 14343 14344 _proto._keydown = function _keydown(event) { 14345 if (/input|textarea/i.test(event.target.tagName)) { 14346 return; 14347 } 14348 14349 switch (event.which) { 14350 case ARROW_LEFT_KEYCODE: 14351 event.preventDefault(); 14352 this.prev(); 14353 break; 14354 14355 case ARROW_RIGHT_KEYCODE: 14356 event.preventDefault(); 14357 this.next(); 14358 break; 14359 14360 default: 14361 } 14362 }; 14363 14364 _proto._getItemIndex = function _getItemIndex(element) { 14365 this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : []; 14366 return this._items.indexOf(element); 14367 }; 14368 14369 _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) { 14370 var isNextDirection = direction === Direction.NEXT; 14371 var isPrevDirection = direction === Direction.PREV; 14372 14373 var activeIndex = this._getItemIndex(activeElement); 14374 14375 var lastItemIndex = this._items.length - 1; 14376 var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; 14377 14378 if (isGoingToWrap && !this._config.wrap) { 14379 return activeElement; 14380 } 14381 14382 var delta = direction === Direction.PREV ? -1 : 1; 14383 var itemIndex = (activeIndex + delta) % this._items.length; 14384 return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; 14385 }; 14386 14387 _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { 14388 var targetIndex = this._getItemIndex(relatedTarget); 14389 14390 var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM)); 14391 14392 var slideEvent = $.Event(Event$2.SLIDE, { 14393 relatedTarget: relatedTarget, 14394 direction: eventDirectionName, 14395 from: fromIndex, 14396 to: targetIndex 14397 }); 14398 $(this._element).trigger(slideEvent); 14399 return slideEvent; 14400 }; 14401 14402 _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { 14403 if (this._indicatorsElement) { 14404 var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE)); 14405 $(indicators).removeClass(ClassName$2.ACTIVE); 14406 14407 var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; 14408 14409 if (nextIndicator) { 14410 $(nextIndicator).addClass(ClassName$2.ACTIVE); 14411 } 14412 } 14413 }; 14414 14415 _proto._slide = function _slide(direction, element) { 14416 var _this4 = this; 14417 14418 var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM); 14419 14420 var activeElementIndex = this._getItemIndex(activeElement); 14421 14422 var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); 14423 14424 var nextElementIndex = this._getItemIndex(nextElement); 14425 14426 var isCycling = Boolean(this._interval); 14427 var directionalClassName; 14428 var orderClassName; 14429 var eventDirectionName; 14430 14431 if (direction === Direction.NEXT) { 14432 directionalClassName = ClassName$2.LEFT; 14433 orderClassName = ClassName$2.NEXT; 14434 eventDirectionName = Direction.LEFT; 14435 } else { 14436 directionalClassName = ClassName$2.RIGHT; 14437 orderClassName = ClassName$2.PREV; 14438 eventDirectionName = Direction.RIGHT; 14439 } 14440 14441 if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) { 14442 this._isSliding = false;
14443 return; 14444 } 14445 14446 var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); 14447 14448 if (slideEvent.isDefaultPrevented()) { 14449 return; 14450 } 14451 14452 if (!activeElement || !nextElement) { 14453 // Some weirdness is happening, so we bail 14454 return; 14455 } 14456 14457 this._isSliding = true; 14458 14459 if (isCycling) { 14460 this.pause(); 14461 } 14462 14463 this._setActiveIndicatorElement(nextElement); 14464 14465 var slidEvent = $.Event(Event$2.SLID, { 14466 relatedTarget: nextElement, 14467 direction: eventDirectionName, 14468 from: activeElementIndex, 14469 to: nextElementIndex 14470 }); 14471 14472 if ($(this._element).hasClass(ClassName$2.SLIDE)) { 14473 $(nextElement).addClass(orderClassName); 14474 Util.reflow(nextElement); 14475 $(activeElement).addClass(directionalClassName); 14476 $(nextElement).addClass(directionalClassName); 14477 var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10); 14478 14479 if (nextElementInterval) { 14480 this._config.defaultInterval = this._config.defaultInterval || this._config.interval; 14481 this._config.interval = nextElementInterval; 14482 } else { 14483 this._config.interval = this._config.defaultInterval || this._config.interval; 14484 } 14485 14486 var transitionDuration = Util.getTransitionDurationFromElement(activeElement); 14487 $(activeElement).one(Util.TRANSITION_END, function () { 14488 $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE); 14489 $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName); 14490 _this4._isSliding = false; 14491 setTimeout(function () { 14492 return $(_this4._element).trigger(slidEvent); 14493 }, 0); 14494 }).emulateTransitionEnd(transitionDuration); 14495 } else { 14496 $(activeElement).removeClass(ClassName$2.ACTIVE); 14497 $(nextElement).addClass(ClassName$2.ACTIVE); 14498 this._isSliding = false; 14499 $(this._element).trigger(slidEvent); 14500 } 14501 14502 if (isCycling) { 14503 this.cycle(); 14504 } 14505 } // Static 14506 ; 14507 14508 Carousel._jQueryInterface = function _jQueryInterface(config) { 14509 return this.each(function () { 14510 var data = $(this).data(DATA_KEY$2); 14511 14512 var _config = _objectSpread({}, Default, $(this).data()); 14513 14514 if (typeof config === 'object') { 14515 _config = _objectSpread({}, _config, config); 14516 } 14517 14518 var action = typeof config === 'string' ? config : _config.slide; 14519 14520 if (!data) { 14521 data = new Carousel(this, _config); 14522 $(this).data(DATA_KEY$2, data); 14523 } 14524 14525 if (typeof config === 'number') { 14526 data.to(config); 14527 } else if (typeof action === 'string') { 14528 if (typeof data[action] === 'undefined') { 14529 throw new TypeError("No method named \"" + action + "\""); 14530 } 14531 14532 data[action](); 14533 } else if (_config.interval && _config.ride) { 14534 data.pause(); 14535 data.cycle(); 14536 } 14537 }); 14538 }; 14539 14540 Carousel._dataApiClickHandler = function _dataApiClickHandler(event) { 14541 var selector = Util.getSelectorFromElement(this); 14542 14543 if (!selector) { 14544 return; 14545 } 14546 14547 var target = $(selector)[0]; 14548 14549 if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) { 14550 return; 14551 } 14552 14553 var config = _objectSpread({}, $(target).data(), $(this).data()); 14554 14555 var slideIndex = this.getAttribute('data-slide-to'); 14556 14557 if (slideIndex) { 14558 config.interval = false; 14559 } 14560 14561 Carousel._jQueryInterface.call($(target), config); 14562 14563 if (slideIndex) { 14564 $(target).data(DATA_KEY$2).to(slideIndex); 14565 } 14566 14567 event.preventDefault(); 14568 }; 14569 14570 _createClass(Carousel, null, [{ 14571 key: "VERSION", 14572 get: function get() { 14573 return VERSION$2; 14574 } 14575 }, { 14576 key: "Default", 14577 get: function get() { 14578 return Default; 14579 } 14580 }]); 14581 14582 return Carousel; 14583 }(); 14584 /** 14585 * ------------------------------------------------------------------------ 14586 * Data Api implementation 14587 * ------------------------------------------------------------------------ 14588 */ 14589 14590 14591 $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler); 14592 $(window).on(Event$2.LOAD_DATA_API, function () { 14593 var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE)); 14594 14595 for (var i = 0, len = carousels.length; i < len; i++) {
14596 var $carousel = $(carousels[i]); 14597 14598 Carousel._jQueryInterface.call($carousel, $carousel.data()); 14599 } 14600 }); 14601 /** 14602 * ------------------------------------------------------------------------ 14603 * jQuery 14604 * ------------------------------------------------------------------------ 14605 */ 14606 14607 $.fn[NAME$2] = Carousel._jQueryInterface; 14608 $.fn[NAME$2].Constructor = Carousel; 14609 14610 $.fn[NAME$2].noConflict = function () { 14611 $.fn[NAME$2] = JQUERY_NO_CONFLICT$2; 14612 return Carousel._jQueryInterface; 14613 }; 14614 14615 /** 14616 * ------------------------------------------------------------------------ 14617 * Constants 14618 * ------------------------------------------------------------------------ 14619 */ 14620 14621 var NAME$3 = 'collapse'; 14622 var VERSION$3 = '4.3.1'; 14623 var DATA_KEY$3 = 'bs.collapse'; 14624 var EVENT_KEY$3 = "." + DATA_KEY$3; 14625 var DATA_API_KEY$3 = '.data-api'; 14626 var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3]; 14627 var Default$1 = { 14628 toggle: true, 14629 parent: '' 14630 }; 14631 var DefaultType$1 = { 14632 toggle: 'boolean', 14633 parent: '(string|element)' 14634 }; 14635 var Event$3 = { 14636 SHOW: "show" + EVENT_KEY$3, 14637 SHOWN: "shown" + EVENT_KEY$3, 14638 HIDE: "hide" + EVENT_KEY$3, 14639 HIDDEN: "hidden" + EVENT_KEY$3, 14640 CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3 14641 }; 14642 var ClassName$3 = { 14643 SHOW: 'show', 14644 COLLAPSE: 'collapse', 14645 COLLAPSING: 'collapsing', 14646 COLLAPSED: 'collapsed' 14647 }; 14648 var Dimension = { 14649 WIDTH: 'width', 14650 HEIGHT: 'height' 14651 }; 14652 var Selector$3 = { 14653 ACTIVES: '.show, .collapsing', 14654 DATA_TOGGLE: '[data-toggle="collapse"]' 14655 /** 14656 * ------------------------------------------------------------------------ 14657 * Class Definition 14658 * ------------------------------------------------------------------------ 14659 */ 14660 14661 }; 14662 14663 var Collapse = 14664 /*#__PURE__*/ 14665 function () { 14666 function Collapse(element, config) { 14667 this._isTransitioning = false; 14668 this._element = element; 14669 this._config = this._getConfig(config); 14670 this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]"))); 14671 var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE)); 14672 14673 for (var i = 0, len = toggleList.length; i < len; i++) { 14674 var elem = toggleList[i]; 14675 var selector = Util.getSelectorFromElement(elem); 14676 var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) { 14677 return foundElem === element; 14678 }); 14679 14680 if (selector !== null && filterElement.length > 0) { 14681 this._selector = selector; 14682 14683 this._triggerArray.push(elem); 14684 } 14685 } 14686 14687 this._parent = this._config.parent ? this._getParent() : null; 14688 14689 if (!this._config.parent) { 14690 this._addAriaAndCollapsedClass(this._element, this._triggerArray); 14691 } 14692 14693 if (this._config.toggle) { 14694 this.toggle(); 14695 } 14696 } // Getters 14697 14698 14699 var _proto = Collapse.prototype; 14700 14701 // Public 14702 _proto.toggle = function toggle() { 14703 if ($(this._element).hasClass(ClassName$3.SHOW)) { 14704 this.hide(); 14705 } else { 14706 this.show(); 14707 } 14708 }; 14709 14710 _proto.show = function show() { 14711 var _this = this; 14712 14713 if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) { 14714 return; 14715 } 14716 14717 var actives; 14718 var activesData; 14719 14720 if (this._parent) { 14721 actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) { 14722 if (typeof _this._config.parent === 'string') { 14723 return elem.getAttribute('data-parent') === _this._config.parent; 14724 } 14725 14726 return elem.classList.contains(ClassName$3.COLLAPSE); 14727 }); 14728 14729 if (actives.length === 0) { 14730 actives = null; 14731 } 14732 } 14733 14734 if (actives) { 14735 activesData = $(actives).not(this._selector).data(DATA_KEY$3); 14736 14737 if (activesData && activesData._isTransitioning) { 14738 return; 14739 } 14740 } 14741 14742 var startEvent = $.Event(Event$3.SHOW); 14743 $(this._element).trigger(startEvent); 14744 14745 if (startEvent.isDefaultPrevented()) { 14746 return; 14747 } 14748 14749 if (actives) { 14750 Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide'); 14751 14752 if (!activesData) { 14753 $(actives).data(DATA_KEY$3, null); 14754 } 14755 } 14756 14757 var dimension = this._getDimension(); 14758 14759 $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING); 14760 this._element.style[dimension] = 0; 14761 14762 if (this._triggerArray.length) { 14763 $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true); 14764 } 14765 14766 this.setTransitioning(true); 14767 14768 var complete = function complete() { 14769 $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW); 14770 _this._element.style[dimension] = ''; 14771 14772 _this.setTransitioning(false); 14773 14774 $(_this._element).trigger(Event$3.SHOWN); 14775 }; 14776 14777 var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 14778 var scrollSize = "scroll" + capitalizedDimension; 14779 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 14780 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 14781 this._element.style[dimension] = this._element[scrollSize] + "px"; 14782 }; 14783 14784 _proto.hide = function hide() { 14785 var _this2 = this; 14786 14787 if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) { 14788 return; 14789 } 14790 14791 var startEvent = $.Event(Event$3.HIDE); 14792 $(this._element).trigger(startEvent); 14793 14794 if (startEvent.isDefaultPrevented()) { 14795 return; 14796 } 14797 14798 var dimension = this._getDimension(); 14799 14800 this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; 14801 Util.reflow(this._element); 14802 $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW); 14803 var triggerArrayLength = this._triggerArray.length; 14804 14805 if (triggerArrayLength > 0) { 14806 for (var i = 0; i < triggerArrayLength; i++) { 14807 var trigger = this._triggerArray[i]; 14808 var selector = Util.getSelectorFromElement(trigger); 14809 14810 if (selector !== null) { 14811 var $elem = $([].slice.call(document.querySelectorAll(selector))); 14812 14813 if (!$elem.hasClass(ClassName$3.SHOW)) { 14814 $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false); 14815 } 14816 } 14817 } 14818 } 14819 14820 this.setTransitioning(true); 14821 14822 var complete = function complete() { 14823 _this2.setTransitioning(false); 14824 14825 $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN); 14826 }; 14827 14828 this._element.style[dimension] = ''; 14829 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 14830 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 14831 }; 14832 14833 _proto.setTransitioning = function setTransitioning(isTransitioning) { 14834 this._isTransitioning = isTransitioning; 14835 }; 14836 14837 _proto.dispose = function dispose() { 14838 $.removeData(this._element, DATA_KEY$3); 14839 this._config = null; 14840 this._parent = null; 14841 this._element = null; 14842 this._triggerArray = null; 14843 this._isTransitioning = null; 14844 } // Private 14845 ; 14846 14847 _proto._getConfig = function _getConfig(config) { 14848 config = _objectSpread({}, Default$1, config); 14849 config.toggle = Boolean(config.toggle); // Coerce string values 14850 14851 Util.typeCheckConfig(NAME$3, config, DefaultType$1); 14852 return config; 14853 }; 14854 14855 _proto._getDimension = function _getDimension() { 14856 var hasWidth = $(this._element).hasClass(Dimension.WIDTH); 14857 return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT; 14858 }; 14859 14860 _proto._getParent = function _getParent() { 14861 var _this3 = this; 14862 14863 var parent; 14864 14865 if (Util.isElement(this._config.parent)) { 14866 parent = this._config.parent; // It's a jQuery object 14867 14868 if (typeof this._config.parent.jquery !== 'undefined') { 14869 parent = this._config.parent[0]; 14870 } 14871 } else { 14872 parent = document.querySelector(this._config.parent); 14873 } 14874 14875 var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]"; 14876 var children = [].slice.call(parent.querySelectorAll(selector)); 14877 $(children).each(function (i, element) { 14878 _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); 14879 }); 14880 return parent; 14881 }; 14882 14883 _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { 14884 var isOpen = $(element).hasClass(ClassName$3.SHOW); 14885 14886 if (triggerArray.length) { 14887 $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen); 14888 } 14889 } // Static 14890 ; 14891 14892 Collapse._getTargetFromElement = function _getTargetFromElement(element) { 14893 var selector = Util.getSelectorFromElement(element); 14894 return selector ? document.querySelector(selector) : null; 14895 }; 14896 14897 Collapse._jQueryInterface = function _jQueryInterface(config) { 14898 return this.each(function () { 14899 var $this = $(this); 14900 var data = $this.data(DATA_KEY$3); 14901 14902 var _config = _objectSpread({}, Default$1, $this.data(), typeof config === 'object' && config ? config : {}); 14903 14904 if (!data && _config.toggle && /show|hide/.test(config)) { 14905 _config.toggle = false;
14906 } 14907 14908 if (!data) { 14909 data = new Collapse(this, _config); 14910 $this.data(DATA_KEY$3, data); 14911 } 14912 14913 if (typeof config === 'string') { 14914 if (typeof data[config] === 'undefined') { 14915 throw new TypeError("No method named \"" + config + "\""); 14916 } 14917 14918 data[config](); 14919 } 14920 }); 14921 }; 14922 14923 _createClass(Collapse, null, [{ 14924 key: "VERSION", 14925 get: function get() { 14926 return VERSION$3; 14927 } 14928 }, { 14929 key: "Default", 14930 get: function get() { 14931 return Default$1; 14932 } 14933 }]); 14934 14935 return Collapse; 14936 }(); 14937 /** 14938 * ------------------------------------------------------------------------ 14939 * Data Api implementation 14940 * ------------------------------------------------------------------------ 14941 */ 14942 14943 14944 $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) { 14945 // preventDefault only for <a> elements (which change the URL) not inside the collapsible element 14946 if (event.currentTarget.tagName === 'A') { 14947 event.preventDefault(); 14948 } 14949 14950 var $trigger = $(this); 14951 var selector = Util.getSelectorFromElement(this); 14952 var selectors = [].slice.call(document.querySelectorAll(selector)); 14953 $(selectors).each(function () { 14954 var $target = $(this); 14955 var data = $target.data(DATA_KEY$3); 14956 var config = data ? 'toggle' : $trigger.data(); 14957 14958 Collapse._jQueryInterface.call($target, config); 14959 }); 14960 }); 14961 /** 14962 * ------------------------------------------------------------------------ 14963 * jQuery 14964 * ------------------------------------------------------------------------ 14965 */ 14966 14967 $.fn[NAME$3] = Collapse._jQueryInterface; 14968 $.fn[NAME$3].Constructor = Collapse; 14969 14970 $.fn[NAME$3].noConflict = function () { 14971 $.fn[NAME$3] = JQUERY_NO_CONFLICT$3; 14972 return Collapse._jQueryInterface; 14973 }; 14974 14975 /** 14976 * ------------------------------------------------------------------------ 14977 * Constants 14978 * ------------------------------------------------------------------------ 14979 */ 14980 14981 var NAME$4 = 'dropdown'; 14982 var VERSION$4 = '4.3.1'; 14983 var DATA_KEY$4 = 'bs.dropdown'; 14984 var EVENT_KEY$4 = "." + DATA_KEY$4; 14985 var DATA_API_KEY$4 = '.data-api'; 14986 var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4]; 14987 var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key 14988 14989 var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key 14990 14991 var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key 14992 14993 var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key 14994 14995 var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key 14996 14997 var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse) 14998 14999 var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE); 15000 var Event$4 = { 15001 HIDE: "hide" + EVENT_KEY$4, 15002 HIDDEN: "hidden" + EVENT_KEY$4, 15003 SHOW: "show" + EVENT_KEY$4, 15004 SHOWN: "shown" + EVENT_KEY$4, 15005 CLICK: "click" + EVENT_KEY$4, 15006 CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4, 15007 KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4, 15008 KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4 15009 }; 15010 var ClassName$4 = { 15011 DISABLED: 'disabled', 15012 SHOW: 'show', 15013 DROPUP: 'dropup', 15014 DROPRIGHT: 'dropright', 15015 DROPLEFT: 'dropleft', 15016 MENURIGHT: 'dropdown-menu-right', 15017 MENULEFT: 'dropdown-menu-left', 15018 POSITION_STATIC: 'position-static' 15019 }; 15020 var Selector$4 = { 15021 DATA_TOGGLE: '[data-toggle="dropdown"]', 15022 FORM_CHILD: '.dropdown form', 15023 MENU: '.dropdown-menu', 15024 NAVBAR_NAV: '.navbar-nav', 15025 VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)' 15026 }; 15027 var AttachmentMap = { 15028 TOP: 'top-start', 15029 TOPEND: 'top-end', 15030 BOTTOM: 'bottom-start', 15031 BOTTOMEND: 'bottom-end', 15032 RIGHT: 'right-start', 15033 RIGHTEND: 'right-end', 15034 LEFT: 'left-start', 15035 LEFTEND: 'left-end' 15036 }; 15037 var Default$2 = { 15038 offset: 0, 15039 flip: true, 15040 boundary: 'scrollParent', 15041 reference: 'toggle', 15042 display: 'dynamic' 15043 }; 15044 var DefaultType$2 = { 15045 offset: '(number|string|function)', 15046 flip: 'boolean', 15047 boundary: '(string|element)', 15048 reference: '(string|element)', 15049 display: 'string' 15050 /** 15051 * ------------------------------------------------------------------------ 15052 * Class Definition 15053 * ------------------------------------------------------------------------ 15054 */ 15055 15056 }; 15057 15058 var Dropdown = 15059 /*#__PURE__*/ 15060 function () { 15061 function Dropdown(element, config) { 15062 this._element = element; 15063 this._popper = null; 15064 this._config = this._getConfig(config); 15065 this._menu = this._getMenuElement(); 15066 this._inNavbar = this._detectNavbar(); 15067 15068 this._addEventListeners(); 15069 } // Getters 15070 15071 15072 var _proto = Dropdown.prototype; 15073 15074 // Public
15075 _proto.toggle = function toggle() { 15076 if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) { 15077 return; 15078 } 15079 15080 var parent = Dropdown._getParentFromElement(this._element); 15081 15082 var isActive = $(this._menu).hasClass(ClassName$4.SHOW); 15083 15084 Dropdown._clearMenus(); 15085 15086 if (isActive) { 15087 return; 15088 } 15089 15090 var relatedTarget = { 15091 relatedTarget: this._element 15092 }; 15093 var showEvent = $.Event(Event$4.SHOW, relatedTarget); 15094 $(parent).trigger(showEvent); 15095 15096 if (showEvent.isDefaultPrevented()) { 15097 return; 15098 } // Disable totally Popper.js for Dropdown in Navbar 15099 15100 15101 if (!this._inNavbar) { 15102 /** 15103 * Check for Popper dependency 15104 * Popper - https://popper.js.org 15105 */ 15106 if (typeof Popper === 'undefined') { 15107 throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)'); 15108 } 15109 15110 var referenceElement = this._element; 15111 15112 if (this._config.reference === 'parent') { 15113 referenceElement = parent; 15114 } else if (Util.isElement(this._config.reference)) { 15115 referenceElement = this._config.reference; // Check if it's jQuery element 15116 15117 if (typeof this._config.reference.jquery !== 'undefined') { 15118 referenceElement = this._config.reference[0]; 15119 } 15120 } // If boundary is not `scrollParent`, then set position to `static` 15121 // to allow the menu to "escape" the scroll parent's boundaries 15122 // https://github.com/twbs/bootstrap/issues/24251 15123 15124 15125 if (this._config.boundary !== 'scrollParent') { 15126 $(parent).addClass(ClassName$4.POSITION_STATIC); 15127 } 15128 15129 this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig()); 15130 } // If this is a touch-enabled device we add extra 15131 // empty mouseover listeners to the body's immediate children; 15132 // only needed because of broken event delegation on iOS 15133 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 15134 15135 15136 if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) { 15137 $(document.body).children().on('mouseover', null, $.noop); 15138 } 15139 15140 this._element.focus(); 15141 15142 this._element.setAttribute('aria-expanded', true); 15143 15144 $(this._menu).toggleClass(ClassName$4.SHOW); 15145 $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget)); 15146 }; 15147 15148 _proto.show = function show() { 15149 if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) { 15150 return; 15151 } 15152 15153 var relatedTarget = { 15154 relatedTarget: this._element 15155 }; 15156 var showEvent = $.Event(Event$4.SHOW, relatedTarget); 15157 15158 var parent = Dropdown._getParentFromElement(this._element); 15159 15160 $(parent).trigger(showEvent); 15161 15162 if (showEvent.isDefaultPrevented()) { 15163 return; 15164 } 15165 15166 $(this._menu).toggleClass(ClassName$4.SHOW); 15167 $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget)); 15168 }; 15169 15170 _proto.hide = function hide() { 15171 if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) { 15172 return; 15173 } 15174 15175 var relatedTarget = { 15176 relatedTarget: this._element 15177 }; 15178 var hideEvent = $.Event(Event$4.HIDE, relatedTarget); 15179 15180 var parent = Dropdown._getParentFromElement(this._element); 15181 15182 $(parent).trigger(hideEvent); 15183 15184 if (hideEvent.isDefaultPrevented()) { 15185 return; 15186 } 15187 15188 $(this._menu).toggleClass(ClassName$4.SHOW); 15189 $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget)); 15190 }; 15191 15192 _proto.dispose = function dispose() { 15193 $.removeData(this._element, DATA_KEY$4); 15194 $(this._element).off(EVENT_KEY$4); 15195 this._element = null; 15196 this._menu = null; 15197 15198 if (this._popper !== null) { 15199 this._popper.destroy(); 15200 15201 this._popper = null; 15202 } 15203 }; 15204
15205 _proto.update = function update() { 15206 this._inNavbar = this._detectNavbar(); 15207 15208 if (this._popper !== null) { 15209 this._popper.scheduleUpdate(); 15210 } 15211 } // Private 15212 ; 15213 15214 _proto._addEventListeners = function _addEventListeners() { 15215 var _this = this; 15216 15217 $(this._element).on(Event$4.CLICK, function (event) { 15218 event.preventDefault(); 15219 event.stopPropagation(); 15220 15221 _this.toggle(); 15222 }); 15223 }; 15224 15225 _proto._getConfig = function _getConfig(config) { 15226 config = _objectSpread({}, this.constructor.Default, $(this._element).data(), config); 15227 Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType); 15228 return config; 15229 }; 15230 15231 _proto._getMenuElement = function _getMenuElement() { 15232 if (!this._menu) { 15233 var parent = Dropdown._getParentFromElement(this._element); 15234 15235 if (parent) { 15236 this._menu = parent.querySelector(Selector$4.MENU); 15237 } 15238 } 15239 15240 return this._menu; 15241 }; 15242 15243 _proto._getPlacement = function _getPlacement() { 15244 var $parentDropdown = $(this._element.parentNode); 15245 var placement = AttachmentMap.BOTTOM; // Handle dropup 15246 15247 if ($parentDropdown.hasClass(ClassName$4.DROPUP)) { 15248 placement = AttachmentMap.TOP; 15249 15250 if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) { 15251 placement = AttachmentMap.TOPEND; 15252 } 15253 } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) { 15254 placement = AttachmentMap.RIGHT; 15255 } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) { 15256 placement = AttachmentMap.LEFT; 15257 } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) { 15258 placement = AttachmentMap.BOTTOMEND; 15259 } 15260 15261 return placement; 15262 }; 15263 15264 _proto._detectNavbar = function _detectNavbar() { 15265 return $(this._element).closest('.navbar').length > 0; 15266 }; 15267 15268 _proto._getOffset = function _getOffset() { 15269 var _this2 = this; 15270 15271 var offset = {}; 15272 15273 if (typeof this._config.offset === 'function') { 15274 offset.fn = function (data) { 15275 data.offsets = _objectSpread({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {}); 15276 return data; 15277 }; 15278 } else { 15279 offset.offset = this._config.offset; 15280 } 15281 15282 return offset; 15283 }; 15284 15285 _proto._getPopperConfig = function _getPopperConfig() { 15286 var popperConfig = { 15287 placement: this._getPlacement(), 15288 modifiers: { 15289 offset: this._getOffset(), 15290 flip: { 15291 enabled: this._config.flip 15292 }, 15293 preventOverflow: { 15294 boundariesElement: this._config.boundary 15295 } 15296 } // Disable Popper.js if we have a static display 15297 15298 }; 15299 15300 if (this._config.display === 'static') { 15301 popperConfig.modifiers.applyStyle = { 15302 enabled: false 15303 }; 15304 } 15305 15306 return popperConfig; 15307 } // Static 15308 ; 15309 15310 Dropdown._jQueryInterface = function _jQueryInterface(config) { 15311 return this.each(function () { 15312 var data = $(this).data(DATA_KEY$4); 15313 15314 var _config = typeof config === 'object' ? config : null; 15315 15316 if (!data) { 15317 data = new Dropdown(this, _config); 15318 $(this).data(DATA_KEY$4, data); 15319 } 15320 15321 if (typeof config === 'string') { 15322 if (typeof data[config] === 'undefined') { 15323 throw new TypeError("No method named \"" + config + "\""); 15324 } 15325 15326 data[config](); 15327 } 15328 }); 15329 }; 15330 15331 Dropdown._clearMenus = function _clearMenus(event) { 15332 if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) { 15333 return; 15334 } 15335 15336 var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE)); 15337 15338 for (var i = 0, len = toggles.length; i < len; i++) { 15339 var parent = Dropdown._getParentFromElement(toggles[i]); 15340 15341 var context = $(toggles[i]).data(DATA_KEY$4); 15342 var relatedTarget = { 15343 relatedTarget: toggles[i] 15344 }; 15345 15346 if (event && event.type === 'click') { 15347 relatedTarget.clickEvent = event; 15348 } 15349 15350 if (!context) { 15351 continue; 15352 } 15353 15354 var dropdownMenu = context._menu; 15355 15356 if (!$(parent).hasClass(ClassName$4.SHOW)) { 15357 continue; 15358 } 15359 15360 if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) { 15361 continue; 15362 } 15363 15364 var hideEvent = $.Event(Event$4.HIDE, relatedTarget); 15365 $(parent).trigger(hideEvent); 15366 15367 if (hideEvent.isDefaultPrevented()) { 15368 continue; 15369 } // If this is a touch-enabled device we remove the extra 15370 // empty mouseover listeners we added for iOS support 15371 15372 15373 if ('ontouchstart' in document.documentElement) { 15374 $(document.body).children().off('mouseover', null, $.noop); 15375 } 15376 15377 toggles[i].setAttribute('aria-expanded', 'false'); 15378 $(dropdownMenu).removeClass(ClassName$4.SHOW); 15379 $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget)); 15380 } 15381 }; 15382 15383 Dropdown._getParentFromElement = function _getParentFromElement(element) { 15384 var parent; 15385 var selector = Util.getSelectorFromElement(element); 15386 15387 if (selector) { 15388 parent = document.querySelector(selector); 15389 } 15390 15391 return parent || element.parentNode; 15392 } // eslint-disable-next-line complexity 15393 ; 15394 15395 Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { 15396 // If not input/textarea: 15397 // - And not a key in REGEXP_KEYDOWN => not a dropdown command 15398 // If input/textarea: 15399 // - If space key => not a dropdown command 15400 // - If key is other than escape 15401 // - If key is not up or down => not a dropdown command 15402 // - If trigger inside the menu =>
15402 not a dropdown command 15403 if (/input|textarea/i.test(event.target.tagName) ? event.which === SPACE_KEYCODE || event.which !== ESCAPE_KEYCODE && (event.which !== ARROW_DOWN_KEYCODE && event.which !== ARROW_UP_KEYCODE || $(event.target).closest(Selector$4.MENU).length) : !REGEXP_KEYDOWN.test(event.which)) { 15404 return; 15405 } 15406 15407 event.preventDefault(); 15408 event.stopPropagation(); 15409 15410 if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) { 15411 return; 15412 } 15413 15414 var parent = Dropdown._getParentFromElement(this); 15415 15416 var isActive = $(parent).hasClass(ClassName$4.SHOW); 15417 15418 if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { 15419 if (event.which === ESCAPE_KEYCODE) { 15420 var toggle = parent.querySelector(Selector$4.DATA_TOGGLE); 15421 $(toggle).trigger('focus'); 15422 } 15423 15424 $(this).trigger('click'); 15425 return; 15426 } 15427 15428 var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)); 15429 15430 if (items.length === 0) { 15431 return; 15432 } 15433 15434 var index = items.indexOf(event.target); 15435 15436 if (event.which === ARROW_UP_KEYCODE && index > 0) { 15437 // Up 15438 index--; 15439 } 15440 15441 if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { 15442 // Down 15443 index++; 15444 } 15445 15446 if (index < 0) { 15447 index = 0; 15448 } 15449 15450 items[index].focus(); 15451 }; 15452 15453 _createClass(Dropdown, null, [{ 15454 key: "VERSION", 15455 get: function get() { 15456 return VERSION$4; 15457 } 15458 }, { 15459 key: "Default", 15460 get: function get() { 15461 return Default$2; 15462 } 15463 }, { 15464 key: "DefaultType", 15465 get: function get() { 15466 return DefaultType$2; 15467 } 15468 }]); 15469 15470 return Dropdown; 15471 }(); 15472 /** 15473 * ------------------------------------------------------------------------ 15474 * Data Api implementation 15475 * ------------------------------------------------------------------------ 15476 */ 15477 15478 15479 $(document).on(Event$4.KEYDOWN_DATA_API, Selector$4.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event$4.KEYDOWN_DATA_API, Selector$4.MENU, Dropdown._dataApiKeydownHandler).on(Event$4.CLICK_DATA_API + " " + Event$4.KEYUP_DATA_API, Dropdown._clearMenus).on(Event$4.CLICK_DATA_API, Selector$4.DATA_TOGGLE, function (event) { 15480 event.preventDefault(); 15481 event.stopPropagation(); 15482 15483 Dropdown._jQueryInterface.call($(this), 'toggle'); 15484 }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) { 15485 e.stopPropagation(); 15486 }); 15487 /** 15488 * ------------------------------------------------------------------------ 15489 * jQuery 15490 * ------------------------------------------------------------------------ 15491 */ 15492 15493 $.fn[NAME$4] = Dropdown._jQueryInterface; 15494 $.fn[NAME$4].Constructor = Dropdown; 15495 15496 $.fn[NAME$4].noConflict = function () { 15497 $.fn[NAME$4] = JQUERY_NO_CONFLICT$4; 15498 return Dropdown._jQueryInterface; 15499 }; 15500 15501 /** 15502 * ------------------------------------------------------------------------ 15503 * Constants 15504 * ------------------------------------------------------------------------ 15505 */ 15506 15507 var NAME$5 = 'modal'; 15508 var VERSION$5 = '4.3.1'; 15509 var DATA_KEY$5 = 'bs.modal'; 15510 var EVENT_KEY$5 = "." + DATA_KEY$5; 15511 var DATA_API_KEY$5 = '.data-api'; 15512 var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5]; 15513 var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key 15514 15515 var Default$3 = { 15516 backdrop: true, 15517 keyboard: true, 15518 focus: true, 15519 show: true 15520 }; 15521 var DefaultType$3 = { 15522 backdrop: '(boolean|string)', 15523 keyboard: 'boolean', 15524 focus: 'boolean', 15525 show: 'boolean' 15526 }; 15527 var Event$5 = { 15528 HIDE: "hide" + EVENT_KEY$5, 15529 HIDDEN: "hidden" + EVENT_KEY$5, 15530 SHOW: "show" + EVENT_KEY$5, 15531 SHOWN: "shown" + EVENT_KEY$5, 15532 FOCUSIN: "focusin" + EVENT_KEY$5, 15533 RESIZE: "resize" + EVENT_KEY$5, 15534 CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5, 15535 KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5, 15536 MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5, 15537 MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5, 15538 CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5 15539 }; 15540 var ClassName$5 = {
15541 SCROLLABLE: 'modal-dialog-scrollable', 15542 SCROLLBAR_MEASURER: 'modal-scrollbar-measure', 15543 BACKDROP: 'modal-backdrop', 15544 OPEN: 'modal-open', 15545 FADE: 'fade', 15546 SHOW: 'show' 15547 }; 15548 var Selector$5 = { 15549 DIALOG: '.modal-dialog', 15550 MODAL_BODY: '.modal-body', 15551 DATA_TOGGLE: '[data-toggle="modal"]', 15552 DATA_DISMISS: '[data-dismiss="modal"]', 15553 FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top', 15554 STICKY_CONTENT: '.sticky-top' 15555 /** 15556 * ------------------------------------------------------------------------ 15557 * Class Definition 15558 * ------------------------------------------------------------------------ 15559 */ 15560 15561 }; 15562 15563 var Modal = 15564 /*#__PURE__*/ 15565 function () { 15566 function Modal(element, config) { 15567 this._config = this._getConfig(config); 15568 this._element = element; 15569 this._dialog = element.querySelector(Selector$5.DIALOG); 15570 this._backdrop = null; 15571 this._isShown = false; 15572 this._isBodyOverflowing = false; 15573 this._ignoreBackdropClick = false; 15574 this._isTransitioning = false; 15575 this._scrollbarWidth = 0; 15576 } // Getters 15577 15578 15579 var _proto = Modal.prototype; 15580 15581 // Public 15582 _proto.toggle = function toggle(relatedTarget) { 15583 return this._isShown ? this.hide() : this.show(relatedTarget); 15584 }; 15585 15586 _proto.show = function show(relatedTarget) { 15587 var _this = this; 15588 15589 if (this._isShown || this._isTransitioning) { 15590 return; 15591 } 15592 15593 if ($(this._element).hasClass(ClassName$5.FADE)) { 15594 this._isTransitioning = true; 15595 } 15596 15597 var showEvent = $.Event(Event$5.SHOW, { 15598 relatedTarget: relatedTarget 15599 }); 15600 $(this._element).trigger(showEvent); 15601 15602 if (this._isShown || showEvent.isDefaultPrevented()) { 15603 return; 15604 } 15605 15606 this._isShown = true; 15607 15608 this._checkScrollbar(); 15609 15610 this._setScrollbar(); 15611 15612 this._adjustDialog(); 15613 15614 this._setEscapeEvent(); 15615 15616 this._setResizeEvent(); 15617 15618 $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) { 15619 return _this.hide(event); 15620 }); 15621 $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () { 15622 $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) { 15623 if ($(event.target).is(_this._element)) { 15624 _this._ignoreBackdropClick = true; 15625 } 15626 }); 15627 }); 15628 15629 this._showBackdrop(function () { 15630 return _this._showElement(relatedTarget); 15631 }); 15632 }; 15633 15634 _proto.hide = function hide(event) { 15635 var _this2 = this; 15636 15637 if (event) { 15638 event.preventDefault(); 15639 } 15640 15641 if (!this._isShown || this._isTransitioning) { 15642 return; 15643 } 15644 15645 var hideEvent = $.Event(Event$5.HIDE); 15646 $(this._element).trigger(hideEvent); 15647 15648 if (!this._isShown || hideEvent.isDefaultPrevented()) { 15649 return; 15650 } 15651 15652 this._isShown = false; 15653 var transition = $(this._element).hasClass(ClassName$5.FADE); 15654 15655 if (transition) { 15656 this._isTransitioning = true; 15657 } 15658 15659 this._setEscapeEvent(); 15660 15661 this._setResizeEvent(); 15662 15663 $(document).off(Event$5.FOCUSIN); 15664 $(this._element).removeClass(ClassName$5.SHOW); 15665 $(this._element).off(Event$5.CLICK_DISMISS); 15666 $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS); 15667 15668 if (transition) { 15669 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 15670 $(this._element).one(Util.TRANSITION_END, function (event) { 15671 return _this2._hideModal(event); 15672 }).emulateTransitionEnd(transitionDuration); 15673 } else { 15674 this._hideModal(); 15675 } 15676 }; 15677 15678 _proto.dispose = function dispose() { 15679 [window, this._element, this._dialog].forEach(function (htmlElement) { 15680 return $(htmlElement).off(EVENT_KEY$5); 15681 }); 15682 /** 15683 * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API` 15684 * Do not move `document` in `htmlElements` array 15685 * It will remove `Event.CLICK_DATA_API` event that should remain 15686 */ 15687 15688 $(document).off(Event$5.FOCUSIN); 15689 $.removeData(this._element, DATA_KEY$5); 15690 this._config = null; 15691 this._element = null; 15692 this._dialog = null; 15693 this._backdrop = null; 15694 this._isShown = null; 15695 this._isBodyOverflowing = null; 15696 this._ignoreBackdropClick = null; 15697 this._isTransitioning = null; 15698 this._scrollbarWidth = null; 15699 }; 15700 15701 _proto.handleUpdate = function handleUpdate() { 15702 this._adjustDialog(); 15703 } // Private 15704 ; 15705 15706 _proto._getConfig = function _getConfig(config) { 15707 config = _objectSpread({}, Default$3, config); 15708 Util.typeCheckConfig(NAME$5, config, DefaultType$3); 15709 return config; 15710 }; 15711 15712 _proto._showElement = function _showElement(relatedTarget) { 15713 var _this3 = this; 15714 15715 var transition = $(this._element).hasClass(ClassName$5.FADE); 15716 15717 if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { 15718 // Don't move modal's DOM position 15719 document.body.appendChild(this._element); 15720 } 15721 15722 this._element.style.display = 'block'; 15723 15724 this._element.removeAttribute('aria-hidden'); 15725 15726 this._element.setAttribute('aria-modal', true); 15727 15728 if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE)) { 15729 this._dialog.querySelector(Selector$5.MODAL_BODY).scrollTop = 0; 15730 } else { 15731 this._element.scrollTop = 0; 15732 } 15733 15734 if (transition) { 15735 Util.reflow(this._element); 15736 } 15737 15738 $(this._element).addClass(ClassName$5.SHOW); 15739 15740 if (this._config.focus) { 15741 this._enforceFocus(); 15742 } 15743 15744 var shownEvent = $.Event(Event$5.SHOWN, { 15745 relatedTarget: relatedTarget 15746 }); 15747 15748 var transitionComplete = function transitionComplete() { 15749 if (_this3._config.focus) { 15750 _this3._element.focus(); 15751 } 15752 15753 _this3._isTransitioning = false;
15754 $(_this3._element).trigger(shownEvent); 15755 }; 15756 15757 if (transition) { 15758 var transitionDuration = Util.getTransitionDurationFromElement(this._dialog); 15759 $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration); 15760 } else { 15761 transitionComplete(); 15762 } 15763 }; 15764 15765 _proto._enforceFocus = function _enforceFocus() { 15766 var _this4 = this; 15767 15768 $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop 15769 .on(Event$5.FOCUSIN, function (event) { 15770 if (document !== event.target && _this4._element !== event.target && $(_this4._element).has(event.target).length === 0) { 15771 _this4._element.focus(); 15772 } 15773 }); 15774 }; 15775 15776 _proto._setEscapeEvent = function _setEscapeEvent() { 15777 var _this5 = this; 15778 15779 if (this._isShown && this._config.keyboard) { 15780 $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) { 15781 if (event.which === ESCAPE_KEYCODE$1) { 15782 event.preventDefault(); 15783 15784 _this5.hide(); 15785 } 15786 }); 15787 } else if (!this._isShown) { 15788 $(this._element).off(Event$5.KEYDOWN_DISMISS); 15789 } 15790 }; 15791 15792 _proto._setResizeEvent = function _setResizeEvent() { 15793 var _this6 = this; 15794 15795 if (this._isShown) { 15796 $(window).on(Event$5.RESIZE, function (event) { 15797 return _this6.handleUpdate(event); 15798 }); 15799 } else { 15800 $(window).off(Event$5.RESIZE); 15801 } 15802 }; 15803 15804 _proto._hideModal = function _hideModal() { 15805 var _this7 = this; 15806 15807 this._element.style.display = 'none'; 15808 15809 this._element.setAttribute('aria-hidden', true); 15810 15811 this._element.removeAttribute('aria-modal'); 15812 15813 this._isTransitioning = false; 15814 15815 this._showBackdrop(function () { 15816 $(document.body).removeClass(ClassName$5.OPEN); 15817 15818 _this7._resetAdjustments(); 15819 15820 _this7._resetScrollbar(); 15821 15822 $(_this7._element).trigger(Event$5.HIDDEN); 15823 }); 15824 }; 15825 15826 _proto._removeBackdrop = function _removeBackdrop() { 15827 if (this._backdrop) { 15828 $(this._backdrop).remove(); 15829 this._backdrop = null; 15830 } 15831 }; 15832 15833 _proto._showBackdrop = function _showBackdrop(callback) { 15834 var _this8 = this; 15835 15836 var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : ''; 15837 15838 if (this._isShown && this._config.backdrop) { 15839 this._backdrop = document.createElement('div'); 15840 this._backdrop.className = ClassName$5.BACKDROP; 15841 15842 if (animate) { 15843 this._backdrop.classList.add(animate); 15844 } 15845 15846 $(this._backdrop).appendTo(document.body); 15847 $(this._element).on(Event$5.CLICK_DISMISS, function (event) { 15848 if (_this8._ignoreBackdropClick) { 15849 _this8._ignoreBackdropClick = false; 15850 return; 15851 } 15852 15853 if (event.target !== event.currentTarget) { 15854 return; 15855 } 15856 15857 if (_this8._config.backdrop === 'static') { 15858 _this8._element.focus(); 15859 } else { 15860 _this8.hide(); 15861 } 15862 }); 15863 15864 if (animate) { 15865 Util.reflow(this._backdrop); 15866 } 15867 15868 $(this._backdrop).addClass(ClassName$5.SHOW); 15869 15870 if (!callback) { 15871 return; 15872 } 15873 15874 if (!animate) { 15875 callback(); 15876 return; 15877 } 15878 15879 var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 15880 $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration); 15881 } else if (!this._isShown && this._backdrop) { 15882 $(this._backdrop).removeClass(ClassName$5.SHOW); 15883 15884 var callbackRemove = function callbackRemove() { 15885 _this8._removeBackdrop(); 15886 15887 if (callback) { 15888 callback(); 15889 } 15890 }; 15891 15892 if ($(this._element).hasClass(ClassName$5.FADE)) { 15893 var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 15894 15895 $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration); 15896 } else { 15897 callbackRemove(); 15898 } 15899 } else if (callback) { 15900 callback(); 15901 } 15902 } // ---------------------------------------------------------------------- 15903 // the following methods are used to handle overflowing modals 15904 // todo (fat): these should probably be refactored out of modal.js 15905 // ---------------------------------------------------------------------- 15906 ; 15907
15908 _proto._adjustDialog = function _adjustDialog() { 15909 var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 15910 15911 if (!this._isBodyOverflowing && isModalOverflowing) { 15912 this._element.style.paddingLeft = this._scrollbarWidth + "px"; 15913 } 15914 15915 if (this._isBodyOverflowing && !isModalOverflowing) { 15916 this._element.style.paddingRight = this._scrollbarWidth + "px"; 15917 } 15918 }; 15919 15920 _proto._resetAdjustments = function _resetAdjustments() { 15921 this._element.style.paddingLeft = ''; 15922 this._element.style.paddingRight = ''; 15923 }; 15924 15925 _proto._checkScrollbar = function _checkScrollbar() { 15926 var rect = document.body.getBoundingClientRect(); 15927 this._isBodyOverflowing = rect.left + rect.right < window.innerWidth; 15928 this._scrollbarWidth = this._getScrollbarWidth(); 15929 }; 15930 15931 _proto._setScrollbar = function _setScrollbar() { 15932 var _this9 = this; 15933 15934 if (this._isBodyOverflowing) { 15935 // Note: DOMNode.style.paddingRight returns the actual value or '' if not set 15936 // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set 15937 var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT)); 15938 var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding 15939 15940 $(fixedContent).each(function (index, element) { 15941 var actualPadding = element.style.paddingRight; 15942 var calculatedPadding = $(element).css('padding-right'); 15943 $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px"); 15944 }); // Adjust sticky content margin 15945 15946 $(stickyContent).each(function (index, element) { 15947 var actualMargin = element.style.marginRight; 15948 var calculatedMargin = $(element).css('margin-right'); 15949 $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px"); 15950 }); // Adjust body padding 15951 15952 var actualPadding = document.body.style.paddingRight; 15953 var calculatedPadding = $(document.body).css('padding-right'); 15954 $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px"); 15955 } 15956 15957 $(document.body).addClass(ClassName$5.OPEN); 15958 }; 15959 15960 _proto._resetScrollbar = function _resetScrollbar() { 15961 // Restore fixed content padding 15962 var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT)); 15963 $(fixedContent).each(function (index, element) { 15964 var padding = $(element).data('padding-right'); 15965 $(element).removeData('padding-right'); 15966 element.style.paddingRight = padding ? padding : ''; 15967 }); // Restore sticky content 15968 15969 var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT)); 15970 $(elements).each(function (index, element) { 15971 var margin = $(element).data('margin-right'); 15972 15973 if (typeof margin !== 'undefined') { 15974 $(element).css('margin-right', margin).removeData('margin-right'); 15975 } 15976 }); // Restore body padding 15977 15978 var padding = $(document.body).data('padding-right'); 15979 $(document.body).removeData('padding-right'); 15980 document.body.style.paddingRight = padding ? padding : ''; 15981 }; 15982 15983 _proto._getScrollbarWidth = function _getScrollbarWidth() { 15984 // thx d.walsh 15985 var scrollDiv = document.createElement('div'); 15986 scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER; 15987 document.body.appendChild(scrollDiv); 15988 var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; 15989 document.body.removeChild(scrollDiv); 15990 return scrollbarWidth; 15991 } // Static 15992 ; 15993 15994 Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { 15995 return this.each(function () { 15996 var data = $(this).data(DATA_KEY$5); 15997 15998 var _config = _objectSpread({}, Default$3, $(this).data(), typeof config === 'object' && config ? config : {}); 15999 16000 if (!data) { 16001 data = new Modal(this, _config); 16002 $(this).data(DATA_KEY$5, data); 16003 } 16004 16005 if (typeof config === 'string') { 16006 if (typeof data[config] === 'undefined') {
16007 throw new TypeError("No method named \"" + config + "\""); 16008 } 16009 16010 data[config](relatedTarget); 16011 } else if (_config.show) { 16012 data.show(relatedTarget); 16013 } 16014 }); 16015 }; 16016 16017 _createClass(Modal, null, [{ 16018 key: "VERSION", 16019 get: function get() { 16020 return VERSION$5; 16021 } 16022 }, { 16023 key: "Default", 16024 get: function get() { 16025 return Default$3; 16026 } 16027 }]); 16028 16029 return Modal; 16030 }(); 16031 /** 16032 * ------------------------------------------------------------------------ 16033 * Data Api implementation 16034 * ------------------------------------------------------------------------ 16035 */ 16036 16037 16038 $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) { 16039 var _this10 = this; 16040 16041 var target; 16042 var selector = Util.getSelectorFromElement(this); 16043 16044 if (selector) { 16045 target = document.querySelector(selector); 16046 } 16047 16048 var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread({}, $(target).data(), $(this).data()); 16049 16050 if (this.tagName === 'A' || this.tagName === 'AREA') { 16051 event.preventDefault(); 16052 } 16053 16054 var $target = $(target).one(Event$5.SHOW, function (showEvent) { 16055 if (showEvent.isDefaultPrevented()) { 16056 // Only register focus restorer if modal will actually get shown 16057 return; 16058 } 16059 16060 $target.one(Event$5.HIDDEN, function () { 16061 if ($(_this10).is(':visible')) { 16062 _this10.focus(); 16063 } 16064 }); 16065 }); 16066 16067 Modal._jQueryInterface.call($(target), config, this); 16068 }); 16069 /** 16070 * ------------------------------------------------------------------------ 16071 * jQuery 16072 * ------------------------------------------------------------------------ 16073 */ 16074 16075 $.fn[NAME$5] = Modal._jQueryInterface; 16076 $.fn[NAME$5].Constructor = Modal; 16077 16078 $.fn[NAME$5].noConflict = function () { 16079 $.fn[NAME$5] = JQUERY_NO_CONFLICT$5; 16080 return Modal._jQueryInterface; 16081 }; 16082 16083 /** 16084 * -------------------------------------------------------------------------- 16085 * Bootstrap (v4.3.1): tools/sanitizer.js 16086 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 16087 * -------------------------------------------------------------------------- 16088 */ 16089 var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']; 16090 var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; 16091 var DefaultWhitelist = { 16092 // Global attributes allowed on any supplied element below. 16093 '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], 16094 a: ['target', 'href', 'title', 'rel'], 16095 area: [], 16096 b: [], 16097 br: [], 16098 col: [], 16099 code: [], 16100 div: [], 16101 em: [], 16102 hr: [], 16103 h1: [], 16104 h2: [], 16105 h3: [], 16106 h4: [], 16107 h5: [], 16108 h6: [], 16109 i: [], 16110 img: ['src', 'alt', 'title', 'width', 'height'], 16111 li: [], 16112 ol: [], 16113 p: [], 16114 pre: [], 16115 s: [], 16116 small: [], 16117 span: [], 16118 sub: [], 16119 sup: [], 16120 strong: [], 16121 u: [], 16122 ul: [] 16123 /** 16124 * A pattern that recognizes a commonly useful subset of URLs that are safe. 16125 * 16126 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 16127 */ 16128 16129 }; 16130 var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi; 16131 /** 16132 * A pattern that matches safe data URLs. Only matches image, video and audio types. 16133 * 16134 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 16135 */ 16136 16137 var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i; 16138 16139 function allowedAttribute(attr, allowedAttributeList) { 16140 var attrName = attr.nodeName.toLowerCase(); 16141 16142 if (allowedAttributeList.indexOf(attrName) !== -1) { 16143 if (uriAttrs.indexOf(attrName) !== -1) { 16144 return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)); 16145 } 16146 16147 return true; 16148 } 16149 16150 var regExp = allowedAttributeList.filter(function (attrRegex) {
16151 return attrRegex instanceof RegExp; 16152 }); // Check if a regular expression validates the attribute. 16153 16154 for (var i = 0, l = regExp.length; i < l; i++) { 16155 if (attrName.match(regExp[i])) { 16156 return true; 16157 } 16158 } 16159 16160 return false; 16161 } 16162 16163 function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { 16164 if (unsafeHtml.length === 0) { 16165 return unsafeHtml; 16166 } 16167 16168 if (sanitizeFn && typeof sanitizeFn === 'function') { 16169 return sanitizeFn(unsafeHtml); 16170 } 16171 16172 var domParser = new window.DOMParser(); 16173 var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); 16174 var whitelistKeys = Object.keys(whiteList); 16175 var elements = [].slice.call(createdDocument.body.querySelectorAll('*')); 16176 16177 var _loop = function _loop(i, len) { 16178 var el = elements[i]; 16179 var elName = el.nodeName.toLowerCase(); 16180 16181 if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) { 16182 el.parentNode.removeChild(el); 16183 return "continue"; 16184 } 16185 16186 var attributeList = [].slice.call(el.attributes); 16187 var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []); 16188 attributeList.forEach(function (attr) { 16189 if (!allowedAttribute(attr, whitelistedAttributes)) { 16190 el.removeAttribute(attr.nodeName); 16191 } 16192 }); 16193 }; 16194 16195 for (var i = 0, len = elements.length; i < len; i++) { 16196 var _ret = _loop(i, len); 16197 16198 if (_ret === "continue") continue; 16199 } 16200 16201 return createdDocument.body.innerHTML; 16202 } 16203 16204 /** 16205 * ------------------------------------------------------------------------ 16206 * Constants 16207 * ------------------------------------------------------------------------ 16208 */ 16209 16210 var NAME$6 = 'tooltip'; 16211 var VERSION$6 = '4.3.1'; 16212 var DATA_KEY$6 = 'bs.tooltip'; 16213 var EVENT_KEY$6 = "." + DATA_KEY$6; 16214 var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6]; 16215 var CLASS_PREFIX = 'bs-tooltip'; 16216 var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); 16217 var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']; 16218 var DefaultType$4 = { 16219 animation: 'boolean', 16220 template: 'string', 16221 title: '(string|element|function)', 16222 trigger: 'string', 16223 delay: '(number|object)', 16224 html: 'boolean', 16225 selector: '(string|boolean)', 16226 placement: '(string|function)', 16227 offset: '(number|string|function)', 16228 container: '(string|element|boolean)', 16229 fallbackPlacement: '(string|array)', 16230 boundary: '(string|element)', 16231 sanitize: 'boolean', 16232 sanitizeFn: '(null|function)', 16233 whiteList: 'object' 16234 }; 16235 var AttachmentMap$1 = { 16236 AUTO: 'auto', 16237 TOP: 'top', 16238 RIGHT: 'right', 16239 BOTTOM: 'bottom', 16240 LEFT: 'left' 16241 }; 16242 var Default$4 = { 16243 animation: true, 16244 template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>', 16245 trigger: 'hover focus', 16246 title: '', 16247 delay: 0, 16248 html: false, 16249 selector: false, 16250 placement: 'top', 16251 offset: 0, 16252 container: false, 16253 fallbackPlacement: 'flip', 16254 boundary: 'scrollParent', 16255 sanitize: true, 16256 sanitizeFn: null, 16257 whiteList: DefaultWhitelist 16258 }; 16259 var HoverState = { 16260 SHOW: 'show', 16261 OUT: 'out' 16262 }; 16263 var Event$6 = { 16264 HIDE: "hide" + EVENT_KEY$6, 16265 HIDDEN: "hidden" + EVENT_KEY$6, 16266 SHOW: "show" + EVENT_KEY$6, 16267 SHOWN: "shown" + EVENT_KEY$6, 16268 INSERTED: "inserted" + EVENT_KEY$6, 16269 CLICK: "click" + EVENT_KEY$6, 16270 FOCUSIN: "focusin" + EVENT_KEY$6, 16271 FOCUSOUT: "focusout" + EVENT_KEY$6, 16272 MOUSEENTER: "mouseenter" + EVENT_KEY$6, 16273 MOUSELEAVE: "mouseleave" + EVENT_KEY$6 16274 }; 16275 var ClassName$6 = { 16276 FADE: 'fade', 16277 SHOW: 'show' 16278 }; 16279 var Selector$6 = { 16280 TOOLTIP: '.tooltip', 16281 TOOLTIP_INNER: '.tooltip-inner', 16282 ARROW: '.arrow' 16283 }; 16284 var Trigger = { 16285 HOVER: 'hover', 16286 FOCUS: 'focus', 16287 CLICK: 'click', 16288 MANUAL: 'manual' 16289 /** 16290 * ------------------------------------------------------------------------ 16291 * Class Definition 16292 * ------------------------------------------------------------------------ 16293 */ 16294 16295 }; 16296 16297 var Tooltip = 16298 /*#__PURE__*/ 16299 function () { 16300 function Tooltip(element, config) { 16301 /** 16302 * Check for Popper dependency 16303 * Popper - https://popper.js.org 16304 */ 16305 if (typeof Popper === 'undefined') { 16306 throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)'); 16307 } // private 16308 16309 16310 this._isEnabled = true; 16311 this._timeout = 0; 16312 this._hoverState = ''; 16313 this._activeTrigger = {}; 16314 this._popper = null; // Protected 16315 16316 this.element = element; 16317 this.config = this._getConfig(config); 16318 this.tip = null; 16319 16320 this._setListeners(); 16321 } // Getters 16322 16323 16324 var _proto = Tooltip.prototype; 16325 16326 // Public 16327 _proto.enable = function enable() { 16328 this._isEnabled = true; 16329 }; 16330 16331 _proto.disable = function disable() { 16332 this._isEnabled = false;
16333 }; 16334 16335 _proto.toggleEnabled = function toggleEnabled() { 16336 this._isEnabled = !this._isEnabled; 16337 }; 16338 16339 _proto.toggle = function toggle(event) { 16340 if (!this._isEnabled) { 16341 return; 16342 } 16343 16344 if (event) { 16345 var dataKey = this.constructor.DATA_KEY; 16346 var context = $(event.currentTarget).data(dataKey); 16347 16348 if (!context) { 16349 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 16350 $(event.currentTarget).data(dataKey, context); 16351 } 16352 16353 context._activeTrigger.click = !context._activeTrigger.click; 16354 16355 if (context._isWithActiveTrigger()) { 16356 context._enter(null, context); 16357 } else { 16358 context._leave(null, context); 16359 } 16360 } else { 16361 if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) { 16362 this._leave(null, this); 16363 16364 return; 16365 } 16366 16367 this._enter(null, this); 16368 } 16369 }; 16370 16371 _proto.dispose = function dispose() { 16372 clearTimeout(this._timeout); 16373 $.removeData(this.element, this.constructor.DATA_KEY); 16374 $(this.element).off(this.constructor.EVENT_KEY); 16375 $(this.element).closest('.modal').off('hide.bs.modal'); 16376 16377 if (this.tip) { 16378 $(this.tip).remove(); 16379 } 16380 16381 this._isEnabled = null; 16382 this._timeout = null; 16383 this._hoverState = null; 16384 this._activeTrigger = null; 16385 16386 if (this._popper !== null) { 16387 this._popper.destroy(); 16388 } 16389 16390 this._popper = null; 16391 this.element = null; 16392 this.config = null; 16393 this.tip = null; 16394 }; 16395 16396 _proto.show = function show() { 16397 var _this = this; 16398 16399 if ($(this.element).css('display') === 'none') { 16400 throw new Error('Please use show on visible elements'); 16401 } 16402 16403 var showEvent = $.Event(this.constructor.Event.SHOW); 16404 16405 if (this.isWithContent() && this._isEnabled) { 16406 $(this.element).trigger(showEvent); 16407 var shadowRoot = Util.findShadowRoot(this.element); 16408 var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element); 16409 16410 if (showEvent.isDefaultPrevented() || !isInTheDom) { 16411 return; 16412 } 16413 16414 var tip = this.getTipElement(); 16415 var tipId = Util.getUID(this.constructor.NAME);
16416 tip.setAttribute('id', tipId); 16417 this.element.setAttribute('aria-describedby', tipId); 16418 this.setContent(); 16419 16420 if (this.config.animation) { 16421 $(tip).addClass(ClassName$6.FADE); 16422 } 16423 16424 var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; 16425 16426 var attachment = this._getAttachment(placement); 16427 16428 this.addAttachmentClass(attachment); 16429 16430 var container = this._getContainer(); 16431 16432 $(tip).data(this.constructor.DATA_KEY, this); 16433 16434 if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) { 16435 $(tip).appendTo(container); 16436 } 16437 16438 $(this.element).trigger(this.constructor.Event.INSERTED); 16439 this._popper = new Popper(this.element, tip, { 16440 placement: attachment, 16441 modifiers: { 16442 offset: this._getOffset(), 16443 flip: { 16444 behavior: this.config.fallbackPlacement 16445 }, 16446 arrow: { 16447 element: Selector$6.ARROW 16448 }, 16449 preventOverflow: { 16450 boundariesElement: this.config.boundary 16451 } 16452 }, 16453 onCreate: function onCreate(data) { 16454 if (data.originalPlacement !== data.placement) { 16455 _this._handlePopperPlacementChange(data); 16456 } 16457 }, 16458 onUpdate: function onUpdate(data) { 16459 return _this._handlePopperPlacementChange(data); 16460 } 16461 }); 16462 $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra 16463 // empty mouseover listeners to the body's immediate children; 16464 // only needed because of broken event delegation on iOS 16465 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 16466 16467 if ('ontouchstart' in document.documentElement) { 16468 $(document.body).children().on('mouseover', null, $.noop); 16469 } 16470 16471 var complete = function complete() { 16472 if (_this.config.animation) { 16473 _this._fixTransition(); 16474 } 16475 16476 var prevHoverState = _this._hoverState; 16477 _this._hoverState = null; 16478 $(_this.element).trigger(_this.constructor.Event.SHOWN); 16479 16480 if (prevHoverState === HoverState.OUT) { 16481 _this._leave(null, _this); 16482 } 16483 }; 16484 16485 if ($(this.tip).hasClass(ClassName$6.FADE)) { 16486 var transitionDuration = Util.getTransitionDurationFromElement(this.tip); 16487 $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 16488 } else { 16489 complete(); 16490 } 16491 } 16492 }; 16493 16494 _proto.hide = function hide(callback) { 16495 var _this2 = this; 16496 16497 var tip = this.getTipElement(); 16498 var hideEvent = $.Event(this.constructor.Event.HIDE); 16499 16500 var complete = function complete() { 16501 if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) { 16502 tip.parentNode.removeChild(tip); 16503 } 16504 16505 _this2._cleanTipClass(); 16506 16507 _this2.element.removeAttribute('aria-describedby'); 16508 16509 $(_this2.element).trigger(_this2.constructor.Event.HIDDEN); 16510 16511 if (_this2._popper !== null) { 16512 _this2._popper.destroy(); 16513 } 16514 16515 if (callback) { 16516 callback(); 16517 } 16518 }; 16519 16520 $(this.element).trigger(hideEvent); 16521 16522 if (hideEvent.isDefaultPrevented()) { 16523 return; 16524 } 16525 16526 $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra 16527 // empty mouseover listeners we added for iOS support 16528 16529 if ('ontouchstart' in document.documentElement) { 16530 $(document.body).children().off('mouseover', null, $.noop); 16531 } 16532 16533 this._activeTrigger[Trigger.CLICK] = false; 16534 this._activeTrigger[Trigger.FOCUS] = false; 16535 this._activeTrigger[Trigger.HOVER] = false; 16536 16537 if ($(this.tip).hasClass(ClassName$6.FADE)) { 16538 var transitionDuration = Util.getTransitionDurationFromElement(tip); 16539 $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 16540 } else { 16541 complete(); 16542 } 16543 16544 this._hoverState = ''; 16545 }; 16546
16547 _proto.update = function update() { 16548 if (this._popper !== null) { 16549 this._popper.scheduleUpdate(); 16550 } 16551 } // Protected 16552 ; 16553 16554 _proto.isWithContent = function isWithContent() { 16555 return Boolean(this.getTitle()); 16556 }; 16557 16558 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 16559 $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); 16560 }; 16561 16562 _proto.getTipElement = function getTipElement() { 16563 this.tip = this.tip || $(this.config.template)[0]; 16564 return this.tip; 16565 }; 16566 16567 _proto.setContent = function setContent() { 16568 var tip = this.getTipElement(); 16569 this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle()); 16570 $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW); 16571 }; 16572 16573 _proto.setElementContent = function setElementContent($element, content) { 16574 if (typeof content === 'object' && (content.nodeType || content.jquery)) { 16575 // Content is a DOM node or a jQuery 16576 if (this.config.html) { 16577 if (!$(content).parent().is($element)) { 16578 $element.empty().append(content); 16579 } 16580 } else { 16581 $element.text($(content).text()); 16582 } 16583 16584 return; 16585 } 16586 16587 if (this.config.html) { 16588 if (this.config.sanitize) { 16589 content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn); 16590 } 16591 16592 $element.html(content); 16593 } else { 16594 $element.text(content); 16595 } 16596 }; 16597 16598 _proto.getTitle = function getTitle() { 16599 var title = this.element.getAttribute('data-original-title'); 16600 16601 if (!title) { 16602 title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title; 16603 } 16604 16605 return title; 16606 } // Private 16607 ; 16608 16609 _proto._getOffset = function _getOffset() { 16610 var _this3 = this; 16611 16612 var offset = {}; 16613 16614 if (typeof this.config.offset === 'function') { 16615 offset.fn = function (data) { 16616 data.offsets = _objectSpread({}, data.offsets, _this3.config.offset(data.offsets, _this3.element) || {}); 16617 return data; 16618 }; 16619 } else { 16620 offset.offset = this.config.offset; 16621 } 16622 16623 return offset; 16624 }; 16625 16626 _proto._getContainer = function _getContainer() { 16627 if (this.config.container === false) { 16628 return document.body; 16629 } 16630 16631 if (Util.isElement(this.config.container)) { 16632 return $(this.config.container); 16633 } 16634 16635 return $(document).find(this.config.container); 16636 }; 16637 16638 _proto._getAttachment = function _getAttachment(placement) { 16639 return AttachmentMap$1[placement.toUpperCase()]; 16640 }; 16641 16642 _proto._setListeners = function _setListeners() { 16643 var _this4 = this; 16644 16645 var triggers = this.config.trigger.split(' '); 16646 triggers.forEach(function (trigger) { 16647 if (trigger === 'click') { 16648 $(_this4.element).on(_this4.constructor.Event.CLICK, _this4.config.selector, function (event) { 16649 return _this4.toggle(event); 16650 }); 16651 } else if (trigger !== Trigger.MANUAL) { 16652 var eventIn = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN; 16653 var eventOut = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT; 16654 $(_this4.element).on(eventIn, _this4.config.selector, function (event) { 16655 return _this4._enter(event); 16656 }).on(eventOut, _this4.config.selector, function (event) { 16657 return _this4._leave(event); 16658 }); 16659 } 16660 }); 16661 $(this.element).closest('.modal').on('hide.bs.modal', function () { 16662 if (_this4.element) { 16663 _this4.hide(); 16664 } 16665 }); 16666 16667 if (this.config.selector) { 16668 this.config = _objectSpread({}, this.config, { 16669 trigger: 'manual', 16670 selector: '' 16671 }); 16672 } else { 16673 this._fixTitle(); 16674 } 16675 }; 16676 16677 _proto._fixTitle = function _fixTitle() { 16678 var titleType = typeof this.element.getAttribute('data-original-title'); 16679 16680 if (this.element.getAttribute('title') || titleType !== 'string') { 16681 this.element.setAttribute('data-original-title', this.element.getAttribute('title') || ''); 16682 this.element.setAttribute('title', ''); 16683 } 16684 }; 16685 16686 _proto._enter = function _enter(event, context) { 16687 var dataKey = this.constructor.DATA_KEY; 16688 context = context || $(event.currentTarget).data(dataKey); 16689 16690 if (!context) { 16691 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 16692 $(event.currentTarget).data(dataKey, context); 16693 } 16694 16695 if (event) { 16696 context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true; 16697 } 16698 16699 if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) { 16700 context._hoverState = HoverState.SHOW; 16701 return; 16702 } 16703 16704 clearTimeout(context._timeout); 16705 context._hoverState = HoverState.SHOW; 16706 16707 if (!context.config.delay || !context.config.delay.show) { 16708 context.show(); 16709 return; 16710 } 16711 16712 context._timeout = setTimeout(function () { 16713 if (context._hoverState === HoverState.SHOW) { 16714 context.show(); 16715 } 16716 }, context.config.delay.show); 16717 }; 16718 16719 _proto._leave = function _leave(event, context) { 16720 var dataKey = this.constructor.DATA_KEY; 16721 context = context || $(event.currentTarget).data(dataKey); 16722 16723 if (!context) { 16724 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 16725 $(event.currentTarget).data(dataKey, context); 16726 } 16727 16728 if (event) { 16729 context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
16730 } 16731 16732 if (context._isWithActiveTrigger()) { 16733 return; 16734 } 16735 16736 clearTimeout(context._timeout); 16737 context._hoverState = HoverState.OUT; 16738 16739 if (!context.config.delay || !context.config.delay.hide) { 16740 context.hide(); 16741 return; 16742 } 16743 16744 context._timeout = setTimeout(function () { 16745 if (context._hoverState === HoverState.OUT) { 16746 context.hide(); 16747 } 16748 }, context.config.delay.hide); 16749 }; 16750 16751 _proto._isWithActiveTrigger = function _isWithActiveTrigger() { 16752 for (var trigger in this._activeTrigger) { 16753 if (this._activeTrigger[trigger]) { 16754 return true; 16755 } 16756 } 16757 16758 return false; 16759 }; 16760 16761 _proto._getConfig = function _getConfig(config) { 16762 var dataAttributes = $(this.element).data(); 16763 Object.keys(dataAttributes).forEach(function (dataAttr) { 16764 if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) { 16765 delete dataAttributes[dataAttr]; 16766 } 16767 }); 16768 config = _objectSpread({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {}); 16769 16770 if (typeof config.delay === 'number') { 16771 config.delay = { 16772 show: config.delay, 16773 hide: config.delay 16774 }; 16775 } 16776 16777 if (typeof config.title === 'number') { 16778 config.title = config.title.toString(); 16779 } 16780 16781 if (typeof config.content === 'number') { 16782 config.content = config.content.toString(); 16783 } 16784 16785 Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType); 16786 16787 if (config.sanitize) { 16788 config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn); 16789 } 16790 16791 return config; 16792 }; 16793 16794 _proto._getDelegateConfig = function _getDelegateConfig() { 16795 var config = {}; 16796 16797 if (this.config) { 16798 for (var key in this.config) { 16799 if (this.constructor.Default[key] !== this.config[key]) { 16800 config[key] = this.config[key]; 16801 } 16802 } 16803 } 16804 16805 return config; 16806 }; 16807 16808 _proto._cleanTipClass = function _cleanTipClass() { 16809 var $tip = $(this.getTipElement()); 16810 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); 16811 16812 if (tabClass !== null && tabClass.length) { 16813 $tip.removeClass(tabClass.join('')); 16814 } 16815 }; 16816 16817 _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) { 16818 var popperInstance = popperData.instance; 16819 this.tip = popperInstance.popper; 16820 16821 this._cleanTipClass(); 16822 16823 this.addAttachmentClass(this._getAttachment(popperData.placement)); 16824 }; 16825 16826 _proto._fixTransition = function _fixTransition() { 16827 var tip = this.getTipElement(); 16828 var initConfigAnimation = this.config.animation; 16829 16830 if (tip.getAttribute('x-placement') !== null) { 16831 return; 16832 } 16833 16834 $(tip).removeClass(ClassName$6.FADE); 16835 this.config.animation = false; 16836 this.hide(); 16837 this.show(); 16838 this.config.animation = initConfigAnimation; 16839 } // Static 16840 ; 16841 16842 Tooltip._jQueryInterface = function _jQueryInterface(config) { 16843 return this.each(function () { 16844 var data = $(this).data(DATA_KEY$6); 16845 16846 var _config = typeof config === 'object' && config; 16847 16848 if (!data && /dispose|hide/.test(config)) { 16849 return; 16850 } 16851 16852 if (!data) { 16853 data = new Tooltip(this, _config); 16854 $(this).data(DATA_KEY$6, data); 16855 } 16856 16857 if (typeof config === 'string') { 16858 if (typeof data[config] === 'undefined') { 16859 throw new TypeError("No method named \"" + config + "\""); 16860 } 16861 16862 data[config](); 16863 } 16864 }); 16865 }; 16866 16867 _createClass(Tooltip, null, [{ 16868 key: "VERSION", 16869 get: function get() { 16870 return VERSION$6; 16871 } 16872 }, { 16873 key: "Default", 16874 get: function get() { 16875 return Default$4; 16876 } 16877 }, { 16878 key: "NAME", 16879 get: function get() { 16880 return NAME$6; 16881 } 16882 }, { 16883 key: "DATA_KEY", 16884 get: function get() { 16885 return DATA_KEY$6; 16886 } 16887 }, { 16888 key: "Event", 16889 get: function get() { 16890 return Event$6; 16891 } 16892 }, {
16893 key: "EVENT_KEY", 16894 get: function get() { 16895 return EVENT_KEY$6; 16896 } 16897 }, { 16898 key: "DefaultType", 16899 get: function get() { 16900 return DefaultType$4; 16901 } 16902 }]); 16903 16904 return Tooltip; 16905 }(); 16906 /** 16907 * ------------------------------------------------------------------------ 16908 * jQuery 16909 * ------------------------------------------------------------------------ 16910 */ 16911 16912 16913 $.fn[NAME$6] = Tooltip._jQueryInterface; 16914 $.fn[NAME$6].Constructor = Tooltip; 16915 16916 $.fn[NAME$6].noConflict = function () { 16917 $.fn[NAME$6] = JQUERY_NO_CONFLICT$6; 16918 return Tooltip._jQueryInterface; 16919 }; 16920 16921 /** 16922 * ------------------------------------------------------------------------ 16923 * Constants 16924 * ------------------------------------------------------------------------ 16925 */ 16926 16927 var NAME$7 = 'popover'; 16928 var VERSION$7 = '4.3.1'; 16929 var DATA_KEY$7 = 'bs.popover'; 16930 var EVENT_KEY$7 = "." + DATA_KEY$7; 16931 var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7]; 16932 var CLASS_PREFIX$1 = 'bs-popover'; 16933 var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g'); 16934 16935 var Default$5 = _objectSpread({}, Tooltip.Default, { 16936 placement: 'right', 16937 trigger: 'click', 16938 content: '', 16939 template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' 16940 }); 16941 16942 var DefaultType$5 = _objectSpread({}, Tooltip.DefaultType, { 16943 content: '(string|element|function)' 16944 }); 16945 16946 var ClassName$7 = { 16947 FADE: 'fade', 16948 SHOW: 'show' 16949 }; 16950 var Selector$7 = { 16951 TITLE: '.popover-header', 16952 CONTENT: '.popover-body' 16953 }; 16954 var Event$7 = { 16955 HIDE: "hide" + EVENT_KEY$7, 16956 HIDDEN: "hidden" + EVENT_KEY$7, 16957 SHOW: "show" + EVENT_KEY$7, 16958 SHOWN: "shown" + EVENT_KEY$7, 16959 INSERTED: "inserted" + EVENT_KEY$7, 16960 CLICK: "click" + EVENT_KEY$7, 16961 FOCUSIN: "focusin" + EVENT_KEY$7, 16962 FOCUSOUT: "focusout" + EVENT_KEY$7, 16963 MOUSEENTER: "mouseenter" + EVENT_KEY$7, 16964 MOUSELEAVE: "mouseleave" + EVENT_KEY$7 16965 /** 16966 * ------------------------------------------------------------------------ 16967 * Class Definition 16968 * ------------------------------------------------------------------------ 16969 */ 16970 16971 }; 16972 16973 var Popover = 16974 /*#__PURE__*/ 16975 function (_Tooltip) { 16976 _inheritsLoose(Popover, _Tooltip); 16977 16978 function Popover() { 16979 return _Tooltip.apply(this, arguments) || this; 16980 } 16981 16982 var _proto = Popover.prototype; 16983 16984 // Overrides 16985 _proto.isWithContent = function isWithContent() { 16986 return this.getTitle() || this._getContent(); 16987 }; 16988 16989 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 16990 $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment); 16991 }; 16992 16993 _proto.getTipElement = function getTipElement() { 16994 this.tip = this.tip || $(this.config.template)[0]; 16995 return this.tip; 16996 }; 16997 16998 _proto.setContent = function setContent() { 16999 var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events 17000 17001 this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle()); 17002 17003 var content = this._getContent(); 17004 17005 if (typeof content === 'function') { 17006 content = content.call(this.element); 17007 } 17008 17009 this.setElementContent($tip.find(Selector$7.CONTENT), content); 17010 $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW); 17011 } // Private 17012 ; 17013 17014 _proto._getContent = function _getContent() { 17015 return this.element.getAttribute('data-content') || this.config.content; 17016 }; 17017 17018 _proto._cleanTipClass = function _cleanTipClass() { 17019 var $tip = $(this.getTipElement()); 17020 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1); 17021 17022 if (tabClass !== null && tabClass.length > 0) { 17023 $tip.removeClass(tabClass.join('')); 17024 } 17025 } // Static 17026 ; 17027 17028 Popover._jQueryInterface = function _jQueryInterface(config) { 17029 return this.each(function () { 17030 var data = $(this).data(DATA_KEY$7); 17031 17032 var _config = typeof config === 'object' ? config : null; 17033 17034 if (!data && /dispose|hide/.test(config)) { 17035 return; 17036 } 17037 17038 if (!data) { 17039 data = new Popover(this, _config); 17040 $(this).data(DATA_KEY$7, data); 17041 } 17042 17043 if (typeof config === 'string') { 17044 if (typeof data[config] === 'undefined') {
17045 throw new TypeError("No method named \"" + config + "\""); 17046 } 17047 17048 data[config](); 17049 } 17050 }); 17051 }; 17052 17053 _createClass(Popover, null, [{ 17054 key: "VERSION", 17055 // Getters 17056 get: function get() { 17057 return VERSION$7; 17058 } 17059 }, { 17060 key: "Default", 17061 get: function get() { 17062 return Default$5; 17063 } 17064 }, { 17065 key: "NAME", 17066 get: function get() { 17067 return NAME$7; 17068 } 17069 }, { 17070 key: "DATA_KEY", 17071 get: function get() { 17072 return DATA_KEY$7; 17073 } 17074 }, { 17075 key: "Event", 17076 get: function get() { 17077 return Event$7; 17078 } 17079 }, { 17080 key: "EVENT_KEY", 17081 get: function get() { 17082 return EVENT_KEY$7; 17083 } 17084 }, { 17085 key: "DefaultType", 17086 get: function get() { 17087 return DefaultType$5; 17088 } 17089 }]); 17090 17091 return Popover; 17092 }(Tooltip); 17093 /** 17094 * ------------------------------------------------------------------------ 17095 * jQuery 17096 * ------------------------------------------------------------------------ 17097 */ 17098 17099 17100 $.fn[NAME$7] = Popover._jQueryInterface; 17101 $.fn[NAME$7].Constructor = Popover; 17102 17103 $.fn[NAME$7].noConflict = function () { 17104 $.fn[NAME$7] = JQUERY_NO_CONFLICT$7; 17105 return Popover._jQueryInterface; 17106 }; 17107 17108 /** 17109 * ------------------------------------------------------------------------ 17110 * Constants 17111 * ------------------------------------------------------------------------ 17112 */ 17113 17114 var NAME$8 = 'scrollspy'; 17115 var VERSION$8 = '4.3.1'; 17116 var DATA_KEY$8 = 'bs.scrollspy'; 17117 var EVENT_KEY$8 = "." + DATA_KEY$8; 17118 var DATA_API_KEY$6 = '.data-api'; 17119 var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8]; 17120 var Default$6 = { 17121 offset: 10, 17122 method: 'auto', 17123 target: '' 17124 }; 17125 var DefaultType$6 = { 17126 offset: 'number', 17127 method: 'string', 17128 target: '(string|element)' 17129 }; 17130 var Event$8 = { 17131 ACTIVATE: "activate" + EVENT_KEY$8, 17132 SCROLL: "scroll" + EVENT_KEY$8, 17133 LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6 17134 }; 17135 var ClassName$8 = { 17136 DROPDOWN_ITEM: 'dropdown-item', 17137 DROPDOWN_MENU: 'dropdown-menu', 17138 ACTIVE: 'active' 17139 }; 17140 var Selector$8 = { 17141 DATA_SPY: '[data-spy="scroll"]', 17142 ACTIVE: '.active', 17143 NAV_LIST_GROUP: '.nav, .list-group', 17144 NAV_LINKS: '.nav-link', 17145 NAV_ITEMS: '.nav-item', 17146 LIST_ITEMS: '.list-group-item', 17147 DROPDOWN: '.dropdown', 17148 DROPDOWN_ITEMS: '.dropdown-item', 17149 DROPDOWN_TOGGLE: '.dropdown-toggle' 17150 }; 17151 var OffsetMethod = { 17152 OFFSET: 'offset', 17153 POSITION: 'position' 17154 /** 17155 * ------------------------------------------------------------------------ 17156 * Class Definition 17157 * ------------------------------------------------------------------------ 17158 */ 17159 17160 }; 17161 17162 var ScrollSpy = 17163 /*#__PURE__*/ 17164 function () { 17165 function ScrollSpy(element, config) { 17166 var _this = this; 17167 17168 this._element = element; 17169 this._scrollElement = element.tagName === 'BODY' ? window : element; 17170 this._config = this._getConfig(config); 17171 this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS); 17172 this._offsets = []; 17173 this._targets = []; 17174 this._activeTarget = null; 17175 this._scrollHeight = 0; 17176 $(this._scrollElement).on(Event$8.SCROLL, function (event) { 17177 return _this._process(event); 17178 }); 17179 this.refresh(); 17180 17181 this._process(); 17182 } // Getters 17183 17184 17185 var _proto = ScrollSpy.prototype; 17186 17187 // Public 17188 _proto.refresh = function refresh() { 17189 var _this2 = this; 17190 17191 var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION; 17192 var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; 17193 var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0; 17194 this._offsets = []; 17195 this._targets = []; 17196 this._scrollHeight = this._getScrollHeight(); 17197 var targets = [].slice.call(document.querySelectorAll(this._selector)); 17198 targets.map(function (element) { 17199 var target; 17200 var targetSelector = Util.getSelectorFromElement(element); 17201
17202 if (targetSelector) { 17203 target = document.querySelector(targetSelector); 17204 } 17205 17206 if (target) { 17207 var targetBCR = target.getBoundingClientRect(); 17208 17209 if (targetBCR.width || targetBCR.height) { 17210 // TODO (fat): remove sketch reliance on jQuery position/offset 17211 return [$(target)[offsetMethod]().top + offsetBase, targetSelector]; 17212 } 17213 } 17214 17215 return null; 17216 }).filter(function (item) { 17217 return item; 17218 }).sort(function (a, b) { 17219 return a[0] - b[0]; 17220 }).forEach(function (item) { 17221 _this2._offsets.push(item[0]); 17222 17223 _this2._targets.push(item[1]); 17224 }); 17225 }; 17226 17227 _proto.dispose = function dispose() { 17228 $.removeData(this._element, DATA_KEY$8); 17229 $(this._scrollElement).off(EVENT_KEY$8); 17230 this._element = null; 17231 this._scrollElement = null; 17232 this._config = null; 17233 this._selector = null; 17234 this._offsets = null; 17235 this._targets = null; 17236 this._activeTarget = null; 17237 this._scrollHeight = null; 17238 } // Private 17239 ; 17240 17241 _proto._getConfig = function _getConfig(config) { 17242 config = _objectSpread({}, Default$6, typeof config === 'object' && config ? config : {}); 17243 17244 if (typeof config.target !== 'string') { 17245 var id = $(config.target).attr('id'); 17246 17247 if (!id) { 17248 id = Util.getUID(NAME$8); 17249 $(config.target).attr('id', id); 17250 } 17251 17252 config.target = "#" + id; 17253 } 17254 17255 Util.typeCheckConfig(NAME$8, config, DefaultType$6); 17256 return config; 17257 }; 17258 17259 _proto._getScrollTop = function _getScrollTop() { 17260 return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; 17261 }; 17262 17263 _proto._getScrollHeight = function _getScrollHeight() { 17264 return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); 17265 }; 17266 17267 _proto._getOffsetHeight = function _getOffsetHeight() { 17268 return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; 17269 }; 17270 17271 _proto._process = function _process() { 17272 var scrollTop = this._getScrollTop() + this._config.offset; 17273 17274 var scrollHeight = this._getScrollHeight(); 17275 17276 var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); 17277 17278 if (this._scrollHeight !== scrollHeight) { 17279 this.refresh(); 17280 } 17281 17282 if (scrollTop >= maxScroll) { 17283 var target = this._targets[this._targets.length - 1]; 17284 17285 if (this._activeTarget !== target) { 17286 this._activate(target); 17287 } 17288 17289 return; 17290 } 17291 17292 if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { 17293 this._activeTarget = null; 17294 17295 this._clear(); 17296 17297 return; 17298 } 17299 17300 var offsetLength = this._offsets.length; 17301 17302 for (var i = offsetLength; i--;) { 17303 var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); 17304 17305 if (isActiveTarget) { 17306 this._activate(this._targets[i]); 17307 } 17308 } 17309 }; 17310 17311 _proto._activate = function _activate(target) { 17312 this._activeTarget = target; 17313 17314 this._clear(); 17315 17316 var queries = this._selector.split(',').map(function (selector) { 17317 return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]"; 17318 }); 17319 17320 var $link = $([].slice.call(document.querySelectorAll(queries.join(',')))); 17321 17322 if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) { 17323 $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE); 17324 $link.addClass(ClassName$8.ACTIVE); 17325 } else { 17326 // Set triggered link as active 17327 $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active 17328 // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor 17329 17330 $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_LINKS + ", " + Selector$8.
17330LIST_ITEMS).addClass(ClassName$8.ACTIVE); // Handle special case when .nav-link is inside .nav-item 17331 17332 $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE); 17333 } 17334 17335 $(this._scrollElement).trigger(Event$8.ACTIVATE, { 17336 relatedTarget: target 17337 }); 17338 }; 17339 17340 _proto._clear = function _clear() { 17341 [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) { 17342 return node.classList.contains(ClassName$8.ACTIVE); 17343 }).forEach(function (node) { 17344 return node.classList.remove(ClassName$8.ACTIVE); 17345 }); 17346 } // Static 17347 ; 17348 17349 ScrollSpy._jQueryInterface = function _jQueryInterface(config) { 17350 return this.each(function () { 17351 var data = $(this).data(DATA_KEY$8); 17352 17353 var _config = typeof config === 'object' && config; 17354 17355 if (!data) { 17356 data = new ScrollSpy(this, _config); 17357 $(this).data(DATA_KEY$8, data); 17358 } 17359 17360 if (typeof config === 'string') { 17361 if (typeof data[config] === 'undefined') { 17362 throw new TypeError("No method named \"" + config + "\""); 17363 } 17364 17365 data[config](); 17366 } 17367 }); 17368 }; 17369 17370 _createClass(ScrollSpy, null, [{ 17371 key: "VERSION", 17372 get: function get() { 17373 return VERSION$8; 17374 } 17375 }, { 17376 key: "Default", 17377 get: function get() { 17378 return Default$6; 17379 } 17380 }]); 17381 17382 return ScrollSpy; 17383 }(); 17384 /** 17385 * ------------------------------------------------------------------------ 17386 * Data Api implementation 17387 * ------------------------------------------------------------------------ 17388 */ 17389 17390 17391 $(window).on(Event$8.LOAD_DATA_API, function () { 17392 var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY)); 17393 var scrollSpysLength = scrollSpys.length; 17394 17395 for (var i = scrollSpysLength; i--;) { 17396 var $spy = $(scrollSpys[i]); 17397 17398 ScrollSpy._jQueryInterface.call($spy, $spy.data()); 17399 } 17400 }); 17401 /** 17402 * ------------------------------------------------------------------------ 17403 * jQuery 17404 * ------------------------------------------------------------------------ 17405 */ 17406 17407 $.fn[NAME$8] = ScrollSpy._jQueryInterface; 17408 $.fn[NAME$8].Constructor = ScrollSpy; 17409 17410 $.fn[NAME$8].noConflict = function () { 17411 $.fn[NAME$8] = JQUERY_NO_CONFLICT$8; 17412 return ScrollSpy._jQueryInterface; 17413 }; 17414 17415 /** 17416 * ------------------------------------------------------------------------ 17417 * Constants 17418 * ------------------------------------------------------------------------ 17419 */ 17420 17421 var NAME$9 = 'tab'; 17422 var VERSION$9 = '4.3.1'; 17423 var DATA_KEY$9 = 'bs.tab'; 17424 var EVENT_KEY$9 = "." + DATA_KEY$9; 17425 var DATA_API_KEY$7 = '.data-api'; 17426 var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9]; 17427 var Event$9 = { 17428 HIDE: "hide" + EVENT_KEY$9, 17429 HIDDEN: "hidden" + EVENT_KEY$9, 17430 SHOW: "show" + EVENT_KEY$9, 17431 SHOWN: "shown" + EVENT_KEY$9, 17432 CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7 17433 }; 17434 var ClassName$9 = { 17435 DROPDOWN_MENU: 'dropdown-menu', 17436 ACTIVE: 'active', 17437 DISABLED: 'disabled', 17438 FADE: 'fade', 17439 SHOW: 'show' 17440 }; 17441 var Selector$9 = { 17442 DROPDOWN: '.dropdown', 17443 NAV_LIST_GROUP: '.nav, .list-group', 17444 ACTIVE: '.active', 17445 ACTIVE_UL: '> li > .active', 17446 DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]', 17447 DROPDOWN_TOGGLE: '.dropdown-toggle', 17448 DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active' 17449 /** 17450 * ------------------------------------------------------------------------ 17451 * Class Definition 17452 * ------------------------------------------------------------------------ 17453 */ 17454 17455 }; 17456 17457 var Tab = 17458 /*#__PURE__*/ 17459 function () { 17460 function Tab(element) { 17461 this._element = element; 17462 } // Getters 17463 17464 17465 var _proto = Tab.prototype; 17466 17467 // Public 17468 _proto.show = function show() { 17469 var _this = this; 17470 17471 if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) { 17472 return; 17473 } 17474 17475 var target; 17476 var previous; 17477 var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0]; 17478 var selector = Util.getSelectorFromElement(this._element); 17479 17480 if (listElement) { 17481 var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE; 17482 previous = $.makeArray($(listElement).find(itemSelector)); 17483 previous = previous[previous.length - 1]; 17484 } 17485 17486 var hideEvent = $.Event(Event$9.HIDE, { 17487 relatedTarget: this._element 17488 }); 17489 var showEvent = $.Event(Event$9.SHOW, { 17490 relatedTarget: previous 17491 }); 17492 17493 if (previous) { 17494 $(previous).trigger(hideEvent); 17495 } 17496 17497 $(this._element).trigger(showEvent); 17498 17499 if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { 17500 return; 17501 } 17502 17503 if (selector) { 17504 target = document.querySelector(selector); 17505 } 17506 17507 this._activate(this._element, listElement); 17508 17509 var complete = function complete() { 17510 var hiddenEvent = $.Event(Event$9.HIDDEN, { 17511 relatedTarget: _this._element 17512 }); 17513 var shownEvent = $.Event(Event$9.SHOWN, { 17514 relatedTarget: previous 17515 }); 17516 $(previous).trigger(hiddenEvent); 17517 $(_this._element).trigger(shownEvent); 17518 }; 17519 17520 if (target) { 17521 this._activate(target, target.parentNode, complete); 17522 } else { 17523 complete(); 17524 } 17525 }; 17526 17527 _proto.dispose = function dispose() { 17528 $.removeData(this._element, DATA_KEY$9); 17529 this._element = null; 17530 } // Private 17531 ; 17532 17533 _proto._activate = function _activate(element, container, callback) { 17534 var _this2 = this; 17535 17536 var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE); 17537 var active = activeElements[0]; 17538 var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE); 17539 17540 var complete = function complete() { 17541 return _this2._transitionComplete(element, active, callback); 17542 }; 17543 17544 if (active && isTransitioning) { 17545 var transitionDuration = Util.getTransitionDurationFromElement(active); 17546 $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 17547 } else { 17548 complete(); 17549 } 17550 }; 17551 17552 _proto._transitionComplete = function _transitionComplete(element, active, callback) { 17553 if (active) { 17554 $(active).removeClass(ClassName$9.ACTIVE);
17555 var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0]; 17556 17557 if (dropdownChild) { 17558 $(dropdownChild).removeClass(ClassName$9.ACTIVE); 17559 } 17560 17561 if (active.getAttribute('role') === 'tab') { 17562 active.setAttribute('aria-selected', false); 17563 } 17564 } 17565 17566 $(element).addClass(ClassName$9.ACTIVE); 17567 17568 if (element.getAttribute('role') === 'tab') { 17569 element.setAttribute('aria-selected', true); 17570 } 17571 17572 Util.reflow(element); 17573 17574 if (element.classList.contains(ClassName$9.FADE)) { 17575 element.classList.add(ClassName$9.SHOW); 17576 } 17577 17578 if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) { 17579 var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0]; 17580 17581 if (dropdownElement) { 17582 var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE)); 17583 $(dropdownToggleList).addClass(ClassName$9.ACTIVE); 17584 } 17585 17586 element.setAttribute('aria-expanded', true); 17587 } 17588 17589 if (callback) { 17590 callback(); 17591 } 17592 } // Static 17593 ; 17594 17595 Tab._jQueryInterface = function _jQueryInterface(config) { 17596 return this.each(function () { 17597 var $this = $(this); 17598 var data = $this.data(DATA_KEY$9); 17599 17600 if (!data) { 17601 data = new Tab(this); 17602 $this.data(DATA_KEY$9, data); 17603 } 17604 17605 if (typeof config === 'string') { 17606 if (typeof data[config] === 'undefined') { 17607 throw new TypeError("No method named \"" + config + "\""); 17608 } 17609 17610 data[config](); 17611 } 17612 }); 17613 }; 17614 17615 _createClass(Tab, null, [{ 17616 key: "VERSION", 17617 get: function get() { 17618 return VERSION$9; 17619 } 17620 }]); 17621 17622 return Tab; 17623 }(); 17624 /** 17625 * ------------------------------------------------------------------------ 17626 * Data Api implementation 17627 * ------------------------------------------------------------------------ 17628 */ 17629 17630 17631 $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) { 17632 event.preventDefault(); 17633 17634 Tab._jQueryInterface.call($(this), 'show'); 17635 }); 17636 /** 17637 * ------------------------------------------------------------------------ 17638 * jQuery 17639 * ------------------------------------------------------------------------ 17640 */ 17641 17642 $.fn[NAME$9] = Tab._jQueryInterface; 17643 $.fn[NAME$9].Constructor = Tab; 17644 17645 $.fn[NAME$9].noConflict = function () { 17646 $.fn[NAME$9] = JQUERY_NO_CONFLICT$9; 17647 return Tab._jQueryInterface; 17648 }; 17649 17650 /** 17651 * ------------------------------------------------------------------------ 17652 * Constants 17653 * ------------------------------------------------------------------------ 17654 */ 17655 17656 var NAME$a = 'toast'; 17657 var VERSION$a = '4.3.1'; 17658 var DATA_KEY$a = 'bs.toast'; 17659 var EVENT_KEY$a = "." + DATA_KEY$a; 17660 var JQUERY_NO_CONFLICT$a = $.fn[NAME$a]; 17661 var Event$a = { 17662 CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a, 17663 HIDE: "hide" + EVENT_KEY$a, 17664 HIDDEN: "hidden" + EVENT_KEY$a, 17665 SHOW: "show" + EVENT_KEY$a, 17666 SHOWN: "shown" + EVENT_KEY$a 17667 }; 17668 var ClassName$a = { 17669 FADE: 'fade', 17670 HIDE: 'hide', 17671 SHOW: 'show', 17672 SHOWING: 'showing' 17673 }; 17674 var DefaultType$7 = { 17675 animation: 'boolean', 17676 autohide: 'boolean', 17677 delay: 'number' 17678 }; 17679 var Default$7 = { 17680 animation: true, 17681 autohide: true, 17682 delay: 500 17683 }; 17684 var Selector$a = { 17685 DATA_DISMISS: '[data-dismiss="toast"]' 17686 /** 17687 * ------------------------------------------------------------------------ 17688 * Class Definition 17689 * ------------------------------------------------------------------------ 17690 */ 17691 17692 }; 17693 17694 var Toast = 17695 /*#__PURE__*/ 17696 function () { 17697 function Toast(element, config) { 17698 this._element = element; 17699 this._config = this._getConfig(config); 17700 this._timeout = null; 17701 17702 this._setListeners(); 17703 } // Getters 17704 17705 17706 var _proto = Toast.prototype; 17707 17708 // Public 17709 _proto.show = function show() { 17710 var _this = this; 17711 17712 $(this._element).trigger(Event$a.SHOW); 17713 17714 if (this._config.animation) { 17715 this._element.classList.add(ClassName$a.FADE); 17716 } 17717 17718 var complete = function complete() { 17719 _this._element.classList.remove(ClassName$a.SHOWING); 17720 17721 _this._element.classList.add(ClassName$a.SHOW); 17722 17723 $(_this._element).trigger(Event$a.SHOWN); 17724 17725 if (_this._config.autohide) { 17726 _this.hide(); 17727 } 17728 }; 17729 17730 this._element.classList.remove(ClassName$a.HIDE); 17731 17732 this._element.classList.add(ClassName$a.SHOWING); 17733 17734 if (this._config.animation) { 17735 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 17736 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 17737 } else { 17738 complete(); 17739 } 17740 }; 17741 17742 _proto.hide = function hide(withoutTimeout) { 17743 var _this2 = this; 17744 17745 if (!this._element.classList.contains(ClassName$a.SHOW)) { 17746 return; 17747 } 17748 17749 $(this._element).trigger(Event$a.HIDE); 17750 17751 if (withoutTimeout) { 17752 this._close(); 17753 } else { 17754 this._timeout = setTimeout(function () { 17755 _this2._close(); 17756 }, this._config.delay); 17757 } 17758 }; 17759 17760 _proto.dispose = function dispose() { 17761 clearTimeout(this._timeout); 17762 this._timeout = null; 17763 17764 if (this._element.classList.contains(ClassName$a.SHOW)) { 17765 this._element.classList.remove(ClassName$a.SHOW); 17766 } 17767 17768 $(this._element).off(Event$a.CLICK_DISMISS); 17769 $.removeData(this._element, DATA_KEY$a); 17770 this._element = null; 17771 this._config = null; 17772 } // Private 17773 ; 17774 17775 _proto._getConfig = function _getConfig(config) { 17776 config = _objectSpread({}, Default$7, $(this._element).data(), typeof config === 'object' && config ? config : {}); 17777 Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType); 17778 return config; 17779 }; 17780 17781 _proto._setListeners = function _setListeners() { 17782 var _this3 = this; 17783 17784 $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () { 17785 return _this3.hide(true); 17786 }); 17787 }; 17788 17789 _proto._close = function _close() { 17790 var _this4 = this; 17791 17792 var complete = function complete() { 17793 _this4._element.classList.add(ClassName$a.HIDE); 17794 17795 $(_this4._element).trigger(Event$a.HIDDEN); 17796 }; 17797 17798 this._element.classList.remove(ClassName$a.SHOW); 17799 17800 if (this._config.animation) { 17801 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 17802 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 17803 } else { 17804 complete(); 17805 } 17806 } // Static 17807 ; 17808 17809 Toast._jQueryInterface = function _jQueryInterface(config) { 17810 return this.each(function () { 17811 var $element = $(this); 17812 var data = $element.data(DATA_KEY$a); 17813 17814 var _config = typeof config === 'object' && config; 17815 17816 if (!data) { 17817 data = new Toast(this, _config); 17818 $element.data(DATA_KEY$a, data); 17819 } 17820 17821 if (typeof config === 'string') { 17822 if (typeof data[config] === 'undefined') {
17823 throw new TypeError("No method named \"" + config + "\""); 17824 } 17825 17826 data[config](this); 17827 } 17828 }); 17829 }; 17830 17831 _createClass(Toast, null, [{ 17832 key: "VERSION", 17833 get: function get() { 17834 return VERSION$a; 17835 } 17836 }, { 17837 key: "DefaultType", 17838 get: function get() { 17839 return DefaultType$7; 17840 } 17841 }, { 17842 key: "Default", 17843 get: function get() { 17844 return Default$7; 17845 } 17846 }]); 17847 17848 return Toast; 17849 }(); 17850 /** 17851 * ------------------------------------------------------------------------ 17852 * jQuery 17853 * ------------------------------------------------------------------------ 17854 */ 17855 17856 17857 $.fn[NAME$a] = Toast._jQueryInterface; 17858 $.fn[NAME$a].Constructor = Toast; 17859 17860 $.fn[NAME$a].noConflict = function () { 17861 $.fn[NAME$a] = JQUERY_NO_CONFLICT$a; 17862 return Toast._jQueryInterface; 17863 }; 17864 17865 /** 17866 * -------------------------------------------------------------------------- 17867 * Bootstrap (v4.3.1): index.js 17868 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 17869 * -------------------------------------------------------------------------- 17870 */ 17871 17872 (function () { 17873 if (typeof $ === 'undefined') { 17874 throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.'); 17875 } 17876 17877 var version = $.fn.jquery.split(' ')[0].split('.'); 17878 var minMajor = 1; 17879 var ltMajor = 2; 17880 var minMinor = 9; 17881 var minPatch = 1; 17882 var maxMajor = 4; 17883 17884 if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) { 17885 throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0'); 17886 } 17887 })(); 17888 17889 exports.Util = Util; 17890 exports.Alert = Alert; 17891 exports.Button = Button; 17892 exports.Carousel = Carousel; 17893 exports.Collapse = Collapse; 17894 exports.Dropdown = Dropdown; 17895 exports.Modal = Modal; 17896 exports.Popover = Popover; 17897 exports.Scrollspy = ScrollSpy; 17898 exports.Tab = Tab; 17899 exports.Toast = Toast; 17900 exports.Tooltip = Tooltip; 17901 17902 Object.defineProperty(exports, '__esModule', { value: true }); 17903 17904})); 17905//# sourceMappingURL=bootstrap.js.map 17906 17907/** 17908The YUI module contains the components required for building the YUI seed file. 17909This includes the script loading mechanism, a simple queue, and the core 17910utilities for the library. 17911 17912@module yui 17913@main yui 17914@submodule yui-base 17915**/ 17916 17917/*jshint eqeqeq: false*/ 17918if (typeof YUI != 'undefined') { 17919 YUI._YUI = YUI; 17920} 17921 17922/** 17923The YUI global namespace object. This is the constructor for all YUI instances. 17924 17925This is a self-instantiable factory function, meaning you don't need to precede 17926it with the `new` operator. You can invoke it directly like this: 17927 17928 YUI().use('*', function (Y) { 17929 // Y is a new YUI instance. 17930 }); 17931 17932But it also works like this: 17933 17934 var Y = YUI(); 17935 17936The `YUI` constructor accepts an optional config object, like this: 17937 17938 YUI({ 17939 debug: true, 17940 combine: false 17941 }).use('node', function (Y) { 17942 // Y.Node is ready to use. 17943 }); 17944 17945See the API docs for the <a href="config.html">Config</a> class for the complete 17946list of supported configuration properties accepted by the YUI constuctor. 17947 17948If a global `YUI` object is already defined, the existing YUI object will not be 17949overwritten, to ensure that defined namespaces are preserved. 17950 17951Each YUI instance has full custom event support, but only if the event system is 17952available. 17953 17954@class YUI 17955@uses EventTarget 17956@constructor 17957@global 17958@param {Object} [config]* Zero or more optional configuration objects. Config 17959 values are stored in the `Y.config` property. See the 17960 <a href="config.html">Config</a> docs for the list of supported properties. 17961**/ 17962 17963 /*global YUI*/ 17964 /*global YUI_config*/ 17965 var YUI = function() { 17966 var i = 0, 17967 Y = this, 17968 args = arguments, 17969 l = args.length, 17970 instanceOf = function(o, type) { 17971 return (o && o.hasOwnProperty && (o instanceof type)); 17972 }, 17973 gconf = (typeof YUI_config !== 'undefined') && YUI_config; 17974 17975 if (!(instanceOf(Y, YUI))) { 17976 Y = new YUI(); 17977 } else { 17978 // set up the core environment 17979 Y._init(); 17980 17981 /** 17982 Master configuration that might span multiple contexts in a non- 17983 browser environment. It is applied first to all instances in all 17984 contexts. 17985 17986 @example 17987 17988 YUI.GlobalConfig = { 17989 filter: 'debug' 17990 }; 17991 17992 YUI().use('node', function (Y) { 17993 // debug files used here 17994 }); 17995 17996 YUI({ 17997 filter: 'min' 17998 }).use('node', function (Y) { 17999 // min files used here 18000 }); 18001 18002 @property {Object} GlobalConfig 18003 @global 18004 @static 18005 **/ 18006 if (YUI.GlobalConfig) { 18007 Y.applyConfig(YUI.GlobalConfig); 18008 } 18009 18010 /** 18011 Page-level config applied to all YUI instances created on the 18012 current page. This is applied after `YUI.GlobalConfig` and before 18013 any instance-level configuration. 18014 18015 @example 18016 18017 // Single global var to include before YUI seed file 18018 YUI_config = { 18019 filter: 'debug' 18020 }; 18021 18022 YUI().use('node', function (Y) { 18023 // debug files used here 18024 }); 18025 18026 YUI({ 18027 filter: 'min' 18028 }).use('node', function (Y) { 18029 // min files used here 18030 }); 18031 18032 @property {Object} YUI_config 18033 @global 18034 **/ 18035 if (gconf) { 18036 Y.applyConfig(gconf); 18037 } 18038 18039 // bind the specified additional modules for this instance 18040 if (!l) { 18041 Y._afterConfig(); 18042 Y._setup(); 18043 } 18044 } 18045 18046 if (l) { 18047 // Each instance can accept one or more configuration objects. 18048 // These are applied after YUI.GlobalConfig and YUI_Config, 18049 // overriding values set in those config files if there is a 18050 // matching property. 18051 for (; i < l; i++) { 18052 Y.applyConfig(args[i]); 18053 } 18054 18055 Y._afterConfig(); 18056 Y._setup(); 18057 } 18058 18059 Y.instanceOf = instanceOf; 18060 18061 return Y; 18062 }; 18063 18064(function() { 18065 18066 var proto, prop, 18067 VERSION = 'patched-v3.18.3', 18068 PERIOD = '.', 18069 BASE = 'http://yui.yahooapis.com/', 18070 /* 18071 These CSS class names can't be generated by 18072 getClassName since it is not available at the 18073 time they are being used. 18074 */ 18075 DOC_LABEL = 'yui3-js-enabled', 18076 CSS_STAMP_EL = 'yui3-css-stamp', 18077 NOOP = function() {}, 18078 SLICE = Array.prototype.slice, 18079 APPLY_TO_AUTH = { 'io.xdrReady': 1, // the functions applyTo 18080 'io.xdrResponse': 1, // can call. this should 18081 'SWF.eventHandler': 1 }, // be done at build time 18082 hasWin = (typeof window != 'undefined'), 18083 win = (hasWin) ? window : null, 18084 doc = (hasWin) ? win.document : null, 18085 docEl = doc && doc.documentElement, 18086 docClass = docEl && docEl.className, 18087 instances = {}, 18088 time = new Date().getTime(), 18089 add = function(el, type, fn, capture) { 18090 if (el && el.addEventListener) { 18091 el.addEventListener(type, fn, capture); 18092 } else if (el && el.attachEvent) { 18093 el.attachEvent('on' + type, fn); 18094 } 18095 }, 18096 remove = function(el, type, fn, capture) { 18097 if (el && el.removeEventListener) { 18098 // this can throw an uncaught exception in FF 18099 try { 18100 el.removeEventListener(type, fn, capture); 18101 } catch (ex) {} 18102 } else if (el && el.detachEvent) { 18103 el.detachEvent('on' + type, fn); 18104 } 18105 }, 18106 handleReady = function() { 18107 YUI.Env.DOMReady = true; 18108 if (hasWin) { 18109 remove(doc, 'DOMContentLoaded', handleReady); 18110 } 18111 if (doc && doc.body && YUI.Env.cssStampEl && (!doc.body.contains(YUI.Env.cssStampEl))) { 18112 doc.body.appendChild(YUI.Env.cssStampEl); 18113 } 18114 }, 18115 handleLoad = function() { 18116 YUI.Env.windowLoaded = true; 18117 YUI.Env.DOMReady = true; 18118 if (hasWin) { 18119 remove(window, 'load', handleLoad); 18120 } 18121 }, 18122 getLoader = function(Y, o) { 18123 var loader = Y.Env._loader, 18124 lCore = [ 'loader-base' ], 18125 G_ENV = YUI.Env, 18126 mods = G_ENV.mods; 18127 18128 if (loader) { 18129 //loader._config(Y.config); 18130 loader.ignoreRegistered = false;
18131 loader.onEnd = null; 18132 loader.data = null; 18133 loader.required = []; 18134 loader.loadType = null; 18135 } else { 18136 loader = new Y.Loader(Y.config); 18137 Y.Env._loader = loader; 18138 } 18139 if (mods && mods.loader) { 18140 lCore = [].concat(lCore, YUI.Env.loaderExtras); 18141 } 18142 YUI.Env.core = Y.Array.dedupe([].concat(YUI.Env.core, lCore)); 18143 18144 return loader; 18145 }, 18146 18147 clobber = function(r, s) { 18148 for (var i in s) { 18149 if (s.hasOwnProperty(i)) { 18150 r[i] = s[i]; 18151 } 18152 } 18153 }, 18154 18155 ALREADY_DONE = { success: true }; 18156 18157// Stamp the documentElement (HTML) with a class of "yui-loaded" to 18158// enable styles that need to key off of JS being enabled. 18159if (docEl && docClass.indexOf(DOC_LABEL) == -1) { 18160 if (docClass) { 18161 docClass += ' '; 18162 } 18163 docClass += DOC_LABEL; 18164 docEl.className = docClass; 18165} 18166 18167if (VERSION.indexOf('@') > -1) { 18168 VERSION = '3.5.0'; // dev time hack for cdn test 18169} 18170 18171proto = { 18172 /** 18173 Applies a new configuration object to the config of this YUI instance. This 18174 will merge new group/module definitions, and will also update the loader 18175 cache if necessary. Updating `Y.config` directly will not update the cache. 18176 18177 @method applyConfig 18178 @param {Object} o the configuration object. 18179 @since 3.2.0 18180 **/ 18181 applyConfig: function(o) { 18182 18183 o = o || NOOP; 18184 18185 var attr, 18186 name, 18187 // detail, 18188 config = this.config, 18189 mods = config.modules, 18190 groups = config.groups, 18191 aliases = config.aliases, 18192 loader = this.Env._loader; 18193 18194 for (name in o) { 18195 if (o.hasOwnProperty(name)) { 18196 attr = o[name]; 18197 if (mods && name == 'modules') { 18198 clobber(mods, attr); 18199 } else if (aliases && name == 'aliases') { 18200 clobber(aliases, attr); 18201 } else if (groups && name == 'groups') { 18202 clobber(groups, attr); 18203 } else if (name == 'win') { 18204 config[name] = (attr && attr.contentWindow) || attr; 18205 config.doc = config[name] ? config[name].document : null; 18206 } else if (name == '_yuid') { 18207 // preserve the guid 18208 } else { 18209 config[name] = attr; 18210 } 18211 } 18212 } 18213 18214 if (loader) { 18215 loader._config(o); 18216 } 18217 18218 }, 18219 18220 /** 18221 Old way to apply a config to this instance (calls `applyConfig` under the 18222 hood). 18223 18224 @private 18225 @method _config 18226 @param {Object} o The config to apply 18227 **/ 18228 _config: function(o) { 18229 this.applyConfig(o); 18230 }, 18231 18232 /** 18233 Initializes this YUI instance. 18234 18235 @private 18236 @method _init 18237 **/ 18238 _init: function() { 18239 var filter, el, 18240 Y = this, 18241 G_ENV = YUI.Env, 18242 Env = Y.Env, 18243 prop; 18244 18245 /** 18246 The version number of this YUI instance. 18247 18248 This value is typically updated by a script when a YUI release is built, 18249 so it may not reflect the correct version number when YUI is run from 18250 the development source tree. 18251 18252 @property {String} version 18253 **/ 18254 Y.version = VERSION; 18255 18256 if (!Env) { 18257 Y.Env = { 18258 core: ['get', 'features', 'intl-base', 'yui-log', 'yui-later', 'loader-base', 'loader-rollup', 'loader-yui3'], 18259 loaderExtras: ['loader-rollup', 'loader-yui3'], 18260 mods: {}, // flat module map 18261 versions: {}, // version module map 18262 base: BASE, 18263 cdn: BASE + VERSION + '/', 18264 // bootstrapped: false, 18265 _idx: 0, 18266 _used: {}, 18267 _attached: {}, 18268 _exported: {}, 18269 _missed: [], 18270 _yidx: 0, 18271 _uidx: 0, 18272 _guidp: 'y', 18273 _loaded: {}, 18274 // serviced: {},
18275 // Regex in English: 18276 // I'll start at the \b(yui). 18277 // 1. Look in the test string for "yui" or 18278 // "yui-base" or "yui-davglass" or "yui-foobar" that comes after a word break. That is, it 18279 // can't match "foyui" or "i_heart_yui". This can be anywhere in the string. 18280 // 2. After #1 must come a forward slash followed by the string matched in #1, so 18281 // "yui-base/yui-base" or "yui-pants/yui-pants". 18282 // 3. The second occurence of the #1 token can optionally be followed by "-debug" or "-min", 18283 // so "yui/yui-min", "yui/yui-debug", "yui-base/yui-base-debug". NOT "yui/yui-tshirt". 18284 // 4. This is followed by ".js", so "yui/yui.js". 18285 // 0. Going back to the beginning, now. If all that stuff in 1-4 comes after a "?" in the string, 18286 // then capture the junk between the LAST "&" and the string in 1-4. So 18287 // "blah?foo/yui/yui.js" will capture "foo/" and "blah?some/thing.js&3.3.0/build/yui-davglass/yui-davglass.js" 18288 // will capture "3.3.0/build/" 18289 // 18290 // Regex Exploded: 18291 // (?:\? Find a ? 18292 // (?:[^&]*&) followed by 0..n characters followed by an & 18293 // * in fact, find as many sets of characters followed by a & as you can 18294 // ([^&]*) capture the stuff after the last & in \1 18295 // )? but it's ok if all this ?junk&more_junk stuff isn't even there 18296 // \b( after a word break find either the string 18297 // yui(?:-\w+)? "yui" optionally followed by a -, then more characters 18298 // ) and store the yui-* string in \2 18299 // \/\2 then comes a / followed by the yui-* string in \2 18300 // (?:-(min|debug))? optionally followed by "-min" or "-debug" 18301 // .js and ending in ".js" 18302 _BASE_RE: /(?:\?(?:[^&]*&)*([^&]*))?\b(aui|yui(?:-\w+)?)\/\2(?:-(min|debug))?\.js/, 18303 parseBasePath: function(src, pattern) { 18304 var match = src.match(pattern), 18305 path, filter; 18306 18307 if (match) { 18308 path = RegExp.leftContext || src.slice(0, src.indexOf(match[0])); 18309 18310 // this is to set up the path to the loader. The file 18311 // filter for loader should match the yui include. 18312 filter = match[3]; 18313 18314 // extract correct path for mixed combo urls 18315 // http://yuilibrary.com/projects/yui3/ticket/2528423 18316 if (match[1]) { 18317 path += '?' + match[1]; 18318 } 18319 path = { 18320 filter: filter, 18321 path: path 18322 }; 18323 } 18324 return path; 18325 }, 18326 getBase: G_ENV && G_ENV.getBase || 18327 function(pattern) { 18328 var nodes = (doc && doc.getElementsByTagName('script')) || [], 18329 path = Env.cdn, parsed, 18330 i, len, src; 18331 18332 for (i = 0, len = nodes.length; i < len; ++i) { 18333 src = nodes[i].src; 18334 if (src) { 18335 parsed = Y.Env.parseBasePath(src, pattern); 18336 if (parsed) { 18337 filter = parsed.filter; 18338 path = parsed.path; 18339 break; 18340 } 18341 } 18342 } 18343 18344 // use CDN default 18345 return path; 18346 } 18347 18348 }; 18349 18350 Env = Y.Env; 18351 18352 Env._loaded[VERSION] = {}; 18353 18354 if (G_ENV && Y !== YUI) { 18355 Env._yidx = ++G_ENV._yidx; 18356 Env._guidp = ('yui_' + VERSION + '_' + 18357 Env._yidx + '_' + time).replace(/[^a-z0-9_]+/g, '_'); 18358 } else if (YUI._YUI) { 18359 18360 G_ENV = YUI._YUI.Env; 18361 Env._yidx += G_ENV._yidx; 18362 Env._uidx += G_ENV._uidx; 18363 18364 for (prop in G_ENV) {
18365 if (!(prop in Env)) { 18366 Env[prop] = G_ENV[prop]; 18367 } 18368 } 18369 18370 delete YUI._YUI; 18371 } 18372 18373 Y.id = Y.stamp(Y); 18374 instances[Y.id] = Y; 18375 18376 } 18377 18378 Y.constructor = YUI; 18379 18380 // configuration defaults 18381 Y.config = Y.config || { 18382 bootstrap: true, 18383 cacheUse: true, 18384 debug: true, 18385 doc: doc, 18386 fetchCSS: true, 18387 throwFail: true, 18388 useBrowserConsole: true, 18389 useNativeES5: true, 18390 win: win 18391 }; 18392 18393 //Register the CSS stamp element 18394 if (doc && !doc.getElementById(CSS_STAMP_EL)) { 18395 el = doc.createElement('div'); 18396 el.innerHTML = '<div id="' + CSS_STAMP_EL + '" style="position: absolute !important; visibility: hidden !important"></div>'; 18397 YUI.Env.cssStampEl = el.firstChild; 18398 if (doc.body) { 18399 doc.body.appendChild(YUI.Env.cssStampEl); 18400 } else { 18401 docEl.insertBefore(YUI.Env.cssStampEl, docEl.firstChild); 18402 } 18403 } else if (doc && doc.getElementById(CSS_STAMP_EL) && !YUI.Env.cssStampEl) { 18404 YUI.Env.cssStampEl = doc.getElementById(CSS_STAMP_EL); 18405 } 18406 18407 Y.config.lang = Y.config.lang || 'en-US'; 18408 18409 Y.config.base = YUI.config.base || 18410 (YUI.config.defaultBase && YUI.config.root && YUI.config.defaultBase + YUI.config.root) || 18411 Y.Env.getBase(Y.Env._BASE_RE); 18412 18413 if (!filter || (!('mindebug').indexOf(filter))) { 18414 filter = 'min'; 18415 } 18416 filter = (filter) ? '-' + filter : filter; 18417 Y.config.loaderPath = YUI.config.loaderPath || 'loader/loader' + filter + '.js'; 18418 18419 }, 18420 18421 /** 18422 This method is called after all other configuration has been applied to 18423 the YUI instance. 18424 18425 @method _afterConfig 18426 @private 18427 **/ 18428 _afterConfig: function () { 18429 var Y = this; 18430 18431 // We need to set up Y.config.global after the rest of the configuration 18432 // so that setting it in user configuration prevents the library from 18433 // using eval(). This is critical for Content Security Policy enabled 18434 // sites and other environments like Chrome extensions 18435 if (!Y.config.hasOwnProperty('global')) { 18436 Y.config.global = Function('return this')(); 18437 } 18438 }, 18439 18440 /** 18441 Finishes the instance setup. Attaches whatever YUI modules were defined 18442 at the time that this instance was created. 18443 18444 @method _setup 18445 @private 18446 **/ 18447 _setup: function() { 18448 var i, Y = this, 18449 core = [], 18450 mods = YUI.Env.mods, 18451 extendedCore = Y.config.extendedCore || [], 18452 extras = Y.config.core || [].concat(YUI.Env.core).concat(extendedCore); //Clone it.. 18453 18454 for (i = 0; i < extras.length; i++) { 18455 if (mods[extras[i]]) { 18456 core.push(extras[i]); 18457 } 18458 } 18459 18460 Y._attach(['yui-base']); 18461 Y._attach(core); 18462 18463 if (Y.Loader) { 18464 getLoader(Y); 18465 } 18466 18467 }, 18468 18469 /** 18470 Executes the named method on the specified YUI instance if that method is 18471 whitelisted. 18472 18473 @method applyTo 18474 @param {String} id YUI instance id. 18475 @param {String} method Name of the method to execute. For example: 18476 'Object.keys'. 18477 @param {Array} args Arguments to apply to the method. 18478 @return {Mixed} Return value from the applied method, or `null` if the 18479 specified instance was not found or the method was not whitelisted. 18480 **/ 18481 applyTo: function(id, method, args) { 18482 if (!(method in APPLY_TO_AUTH)) { 18483 this.log(method + ': applyTo not allowed', 'warn', 'yui'); 18484 return null; 18485 } 18486 18487 var instance = instances[id], nest, m, i; 18488 if (instance) { 18489 nest = method.split('.'); 18490 m = instance; 18491 for (i = 0; i < nest.length; i = i + 1) { 18492 m = m[nest[i]]; 18493 if (!m) { 18494 this.log('applyTo not found: ' + method, 'warn', 'yui'); 18495 } 18496 } 18497 return m && m.apply(instance, args); 18498 } 18499 18500 return null; 18501 }, 18502 18503/** 18504Registers a YUI module and makes it available for use in a `YUI().use()` call or 18505as a dependency for other modules. 18506 18507The easiest way to create a first-class YUI module is to use 18508<a href="http://yui.github.com/shifter/">Shifter</a>, the YUI component build 18509tool. 18510 18511Shifter will automatically wrap your module code in a `YUI.add()` call along 18512with any configuration info required for the module. 18513 18514@example 18515 18516 YUI.add('davglass', function (Y) { 18517 Y.davglass = function () { 18518 }; 18519 }, '3.4.0', { 18520 requires: ['harley-davidson', 'mt-dew'] 18521 }); 18522 18523@method add 18524@param {String} name Module name. 18525@param {Function} fn Function containing module code. This function will be 18526 executed whenever the module is attached to a specific YUI instance. 18527 18528 @param {YUI} fn.Y The YUI instance to which this module is attached.
18529 @param {String} fn.name Name of the module 18530 18531@param {String} version Module version number. This is currently used only for 18532 informational purposes, and is not used internally by YUI. 18533 18534@param {Object} [details] Module config. 18535 @param {Array} [details.requires] Array of other module names that must be 18536 attached before this module can be attached. 18537 @param {Array} [details.optional] Array of optional module names that should 18538 be attached before this module is attached if they've already been 18539 loaded. If the `loadOptional` YUI option is `true`, optional modules 18540 that have not yet been loaded will be loaded just as if they were hard 18541 requirements. 18542 @param {Array} [details.use] Array of module names that are included within 18543 or otherwise provided by this module, and which should be attached 18544 automatically when this module is attached. This makes it possible to 18545 create "virtual rollup" modules that simply attach a collection of other 18546 modules or submodules. 18547 18548@return {YUI} This YUI instance. 18549**/ 18550 add: function(name, fn, version, details) { 18551 details = details || {}; 18552 var env = YUI.Env, 18553 mod = { 18554 name: name, 18555 fn: fn, 18556 version: version, 18557 details: details 18558 }, 18559 //Instance hash so we don't apply it to the same instance twice 18560 applied = {}, 18561 loader, inst, modInfo, 18562 i, versions = env.versions; 18563 18564 env.mods[name] = mod; 18565 versions[version] = versions[version] || {}; 18566 versions[version][name] = mod; 18567 18568 for (i in instances) { 18569 if (instances.hasOwnProperty(i)) { 18570 inst = instances[i]; 18571 if (!applied[inst.id]) { 18572 applied[inst.id] = true; 18573 loader = inst.Env._loader; 18574 if (loader) { 18575 modInfo = loader.getModuleInfo(name); 18576 if (!modInfo || modInfo.temp) { 18577 loader.addModule(details, name); 18578 } 18579 } 18580 } 18581 } 18582 } 18583 18584 return this; 18585 }, 18586 18587 /** 18588 Executes the callback function associated with each required module, 18589 attaching the module to this YUI instance. 18590 18591 @method _attach 18592 @param {Array} r The array of modules to attach 18593 @param {Boolean} [moot=false] If `true`, don't throw a warning if the module 18594 is not attached. 18595 @private 18596 **/ 18597 _attach: function(r, moot) { 18598 var i, name, mod, details, req, use, after, 18599 mods = YUI.Env.mods, 18600 aliases = YUI.Env.aliases, 18601 Y = this, j, 18602 cache = YUI.Env._renderedMods, 18603 loader = Y.Env._loader, 18604 done = Y.Env._attached, 18605 exported = Y.Env._exported, 18606 len = r.length, loader, def, go, 18607 c = [], 18608 modArgs, esCompat, reqlen, modInfo, 18609 condition, 18610 __exports__, __imports__; 18611 18612 //Check for conditional modules (in a second+ instance) and add their requirements 18613 //TODO I hate this entire method, it needs to be fixed ASAP (3.5.0) ^davglass 18614 for (i = 0; i < len; i++) { 18615 name = r[i]; 18616 mod = mods[name]; 18617 c.push(name); 18618 if (loader && loader.conditions[name]) { 18619 for (j in loader.conditions[name]) { 18620 if (loader.conditions[name].hasOwnProperty(j)) { 18621 def = loader.conditions[name][j]; 18622 go = def && ((def.ua && Y.UA[def.ua]) || (def.test && def.test(Y))); 18623 if (go) { 18624 c.push(def.name); 18625 } 18626 } 18627 } 18628 } 18629 } 18630 r = c; 18631 len = r.length; 18632 18633 for (i = 0; i < len; i++) { 18634 if (!done[r[i]]) { 18635 name = r[i]; 18636 mod = mods[name]; 18637 18638 if (aliases && aliases[name] && !mod) { 18639 Y._attach(aliases[name]); 18640 continue; 18641 } 18642 if (!mod) { 18643 modInfo = loader && loader.getModuleInfo(name); 18644 if (modInfo) { 18645 mod = modInfo; 18646 moot = true; 18647 } 18648 18649 18650 //if (!loader || !loader.moduleInfo[name]) { 18651 //if ((!loader || !loader.moduleInfo[name]) && !moot) { 18652 if (!moot && name) { 18653 if ((name.indexOf('skin-') === -1) && (name.indexOf('css') === -1)) { 18654 Y.Env._missed.push(name); 18655 Y.Env._missed = Y.Array.dedupe(Y.Env._missed); 18656 Y.message('NOT loaded: ' + name, 'warn', 'yui'); 18657 } 18658 } 18659 } else { 18660 done[name] = true; 18661 //Don't like this, but in case a mod was asked for once, then we fetch it 18662 //We need to remove it from the missed list ^davglass 18663 for (j = 0; j < Y.Env._missed.length; j++) { 18664 if (Y.Env._missed[j] === name) {
18665 Y.message('Found: ' + name + ' (was reported as missing earlier)', 'warn', 'yui'); 18666 Y.Env._missed.splice(j, 1); 18667 } 18668 } 18669 18670 // Optional dependencies normally work by modifying the 18671 // dependency list of a module. If the dependency's test 18672 // passes it is added to the list. If not, it's not loaded. 18673 // This following check ensures that optional dependencies 18674 // are not attached when they were already loaded into the 18675 // page (when bundling for example) 18676 if (loader && !loader._canBeAttached(name)) { 18677 return true; 18678 } 18679 18680 /* 18681 If it's a temp module, we need to redo it's requirements if it's already loaded 18682 since it may have been loaded by another instance and it's dependencies might 18683 have been redefined inside the fetched file. 18684 */ 18685 if (loader && cache && cache[name] && cache[name].temp) { 18686 loader.getRequires(cache[name]); 18687 req = []; 18688 modInfo = loader.getModuleInfo(name); 18689 for (j in modInfo.expanded_map) { 18690 if (modInfo.expanded_map.hasOwnProperty(j)) { 18691 req.push(j); 18692 } 18693 } 18694 Y._attach(req); 18695 } 18696 18697 details = mod.details; 18698 req = details.requires; 18699 esCompat = details.es; 18700 use = details.use; 18701 after = details.after; 18702 //Force Intl load if there is a language (Loader logic) @todo fix this shit 18703 if (details.lang) { 18704 req = req || []; 18705 req.unshift('intl'); 18706 } 18707 18708 if (req) { 18709 reqlen = req.length; 18710 for (j = 0; j < reqlen; j++) { 18711 if (!done[req[j]]) { 18712 if (!Y._attach(req)) { 18713 return false; 18714 } 18715 break; 18716 } 18717 } 18718 } 18719 18720 if (after) { 18721 for (j = 0; j < after.length; j++) { 18722 if (!done[after[j]]) { 18723 if (!Y._attach(after, true)) { 18724 return false; 18725 } 18726 break; 18727 } 18728 } 18729 } 18730 18731 if (mod.fn) { 18732 modArgs = [Y, name]; 18733 if (esCompat) { 18734 __imports__ = {}; 18735 __exports__ = {}; 18736 // passing `exports` and `imports` onto the module function 18737 modArgs.push(__imports__, __exports__); 18738 if (req) { 18739 reqlen = req.length; 18740 for (j = 0; j < reqlen; j++) { 18741 __imports__[req[j]] = exported.hasOwnProperty(req[j]) ? exported[req[j]] : Y; 18742 } 18743 } 18744 } 18745 if (Y.config.throwFail) { 18746 __exports__ = mod.fn.apply(esCompat ? undefined : mod, modArgs); 18747 } else { 18748 try { 18749 __exports__ = mod.fn.apply(esCompat ? undefined : mod, modArgs); 18750 } catch (e) { 18751 Y.error('Attach error: ' + name, e, name); 18752 return false;
18753 } 18754 } 18755 if (esCompat) { 18756 // store the `exports` in case others `es` modules requires it 18757 exported[name] = __exports__; 18758 18759 // If an ES module is conditionally loaded and set 18760 // to be used "instead" another module, replace the 18761 // trigger module's content with the conditionally 18762 // loaded one so the values returned by require() 18763 // still makes sense 18764 condition = mod.details.condition; 18765 if (condition && condition.when === 'instead') { 18766 exported[condition.trigger] = __exports__; 18767 } 18768 } 18769 } 18770 18771 if (use) { 18772 for (j = 0; j < use.length; j++) { 18773 if (!done[use[j]]) { 18774 if (!Y._attach(use)) { 18775 return false; 18776 } 18777 break; 18778 } 18779 } 18780 } 18781 18782 18783 18784 } 18785 } 18786 } 18787 18788 return true; 18789 }, 18790 18791 /** 18792 Delays the `use` callback until another event has taken place such as 18793 `window.onload`, `domready`, `contentready`, or `available`. 18794 18795 @private 18796 @method _delayCallback 18797 @param {Function} cb The original `use` callback. 18798 @param {String|Object} until Either an event name ('load', 'domready', etc.) 18799 or an object containing event/args keys for contentready/available. 18800 @return {Function} 18801 **/ 18802 _delayCallback: function(cb, until) { 18803 18804 var Y = this, 18805 mod = ['event-base']; 18806 18807 until = (Y.Lang.isObject(until) ? until : { event: until }); 18808 18809 if (until.event === 'load') { 18810 mod.push('event-synthetic'); 18811 } 18812 18813 return function() { 18814 var args = arguments; 18815 Y._use(mod, function() { 18816 Y.on(until.event, function() { 18817 args[1].delayUntil = until.event; 18818 cb.apply(Y, args); 18819 }, until.args); 18820 }); 18821 }; 18822 }, 18823 18824 /** 18825 Attaches one or more modules to this YUI instance. When this is executed, 18826 the requirements of the desired modules are analyzed, and one of several 18827 things can happen: 18828 18829 18830 * All required modules have already been loaded, and just need to be 18831 attached to this YUI instance. In this case, the `use()` callback will 18832 be executed synchronously after the modules are attached. 18833 18834 * One or more modules have not yet been loaded, or the Get utility is not 18835 available, or the `bootstrap` config option is `false`. In this case, 18836 a warning is issued indicating that modules are missing, but all 18837 available modules will still be attached and the `use()` callback will 18838 be executed synchronously. 18839 18840 * One or more modules are missing and the Loader is not available but the 18841 Get utility is, and `bootstrap` is not `false`. In this case, the Get 18842 utility will be used to load the Loader, and we will then proceed to 18843 the following state: 18844 18845 * One or more modules are missing and the Loader is available. In this 18846 case, the Loader will be used to resolve the dependency tree for the 18847 missing modules and load them and their dependencies. When the Loader is 18848 finished loading modules, the `use()` callback will be executed 18849 asynchronously. 18850 18851 @example 18852 18853 // Loads and attaches dd and its dependencies. 18854 YUI().use('dd', function (Y) { 18855 // ... 18856 }); 18857 18858 // Loads and attaches dd and node as well as all of their dependencies. 18859 YUI().use(['dd', 'node'], function (Y) { 18860 // ... 18861 }); 18862 18863 // Attaches all modules that have already been loaded. 18864 YUI().use('*', function (Y) { 18865 // ... 18866 }); 18867 18868 // Attaches a gallery module. 18869 YUI().use('gallery-yql', function (Y) { 18870 // ... 18871 }); 18872 18873 // Attaches a YUI 2in3 module. 18874 YUI().use('yui2-datatable', function (Y) { 18875 // ... 18876 }); 18877 18878 @method use 18879 @param {String|Array} modules* One or more module names to attach. 18880 @param {Function} [callback] Callback function to be executed once all 18881 specified modules and their dependencies have been attached.
18882 @param {YUI} callback.Y The YUI instance created for this sandbox. 18883 @param {Object} callback.status Object containing `success`, `msg` and 18884 `data` properties. 18885 @chainable 18886 **/ 18887 use: function() { 18888 var args = SLICE.call(arguments, 0), 18889 callback = args[args.length - 1], 18890 Y = this, 18891 i = 0, 18892 name, 18893 Env = Y.Env, 18894 provisioned = true; 18895 18896 // The last argument supplied to use can be a load complete callback 18897 if (Y.Lang.isFunction(callback)) { 18898 args.pop(); 18899 if (Y.config.delayUntil) { 18900 callback = Y._delayCallback(callback, Y.config.delayUntil); 18901 } 18902 } else { 18903 callback = null; 18904 } 18905 if (Y.Lang.isArray(args[0])) { 18906 args = args[0]; 18907 } 18908 18909 if (Y.config.cacheUse) { 18910 while ((name = args[i++])) { 18911 if (!Env._attached[name]) { 18912 provisioned = false; 18913 break; 18914 } 18915 } 18916 18917 if (provisioned) { 18918 if (args.length) { 18919 } 18920 Y._notify(callback, ALREADY_DONE, args); 18921 return Y; 18922 } 18923 } 18924 18925 if (Y._loading) { 18926 Y._useQueue = Y._useQueue || new Y.Queue(); 18927 Y._useQueue.add([args, callback]); 18928 } else { 18929 Y._use(args, function(Y, response) { 18930 Y._notify(callback, response, args); 18931 }); 18932 } 18933 18934 return Y; 18935 }, 18936 18937 /** 18938 Sugar for loading both legacy and ES6-based YUI modules. 18939 18940 @method require 18941 @param {String} [modules*] List of module names to import or a single 18942 module name. 18943 @param {Function} callback Callback that gets called once all the modules 18944 were loaded. Each parameter of the callback is the export value of the 18945 corresponding module in the list. If the module is a legacy YUI module, 18946 the YUI instance is used instead of the module exports. 18947 @example 18948 ``` 18949 YUI().require(['es6-set'], function (Y, imports) { 18950 var Set = imports.Set, 18951 set = new Set(); 18952 }); 18953 ``` 18954 **/ 18955 require: function () { 18956 var args = SLICE.call(arguments), 18957 callback; 18958 18959 if (typeof args[args.length - 1] === 'function') { 18960 callback = args.pop(); 18961 18962 // only add the callback if one was provided 18963 // YUI().require('foo'); is valid 18964 args.push(function (Y) { 18965 var i, length = args.length, 18966 exported = Y.Env._exported, 18967 __imports__ = {}; 18968 18969 // Get only the imports requested as arguments 18970 for (i = 0; i < length; i++) { 18971 if (exported.hasOwnProperty(args[i])) { 18972 __imports__[args[i]] = exported[args[i]]; 18973 } 18974 } 18975 18976 // Using `undefined` because: 18977 // - Using `Y.config.global` would force the value of `this` to be 18978 // the global object even in strict mode 18979 // - Using `Y` goes against the goal of moving away from a shared 18980 // object and start thinking in terms of imported and exported 18981 // objects 18982 callback.call(undefined, Y, __imports__); 18983 }); 18984 } 18985 // Do not return the Y object. This makes it hard to follow this 18986 // traditional pattern: 18987 // var Y = YUI().use(...); 18988 // This is a good idea in the light of ES6 modules, to avoid working 18989 // in the global scope. 18990 // This also leaves the door open for returning a promise, once the 18991 // YUI loader is based on the ES6 loader which uses 18992 // loader.import(...).then(...) 18993 this.use.apply(this, args); 18994 }, 18995 18996 /** 18997 Handles Loader notifications about attachment/load errors. 18998 18999 @method _notify 19000 @param {Function} callback Callback to pass to `Y.config.loadErrorFn`. 19001 @param {Object} response Response returned from Loader. 19002 @param {Array} args Arguments passed from Loader. 19003 @private 19004 **/ 19005 _notify: function(callback, response, args) { 19006 if (!response.success && this.config.loadErrorFn) { 19007 this.config.loadErrorFn.call(this, this, callback, response, args); 19008 } else if (callback) { 19009 if (this.Env._missed && this.Env._missed.length) { 19010 response.msg = 'Missing modules: ' + this.Env._missed.join(); 19011 response.success = false;
19012 } 19013 if (this.config.throwFail) { 19014 callback(this, response); 19015 } else { 19016 try { 19017 callback(this, response); 19018 } catch (e) { 19019 this.error('use callback error', e, args); 19020 } 19021 } 19022 } 19023 }, 19024 19025 /** 19026 Called from the `use` method queue to ensure that only one set of loading 19027 logic is performed at a time. 19028 19029 @method _use 19030 @param {String} args* One or more modules to attach. 19031 @param {Function} [callback] Function to call once all required modules have 19032 been attached. 19033 @private 19034 **/ 19035 _use: function(args, callback) { 19036 19037 if (!this.Array) { 19038 this._attach(['yui-base']); 19039 } 19040 19041 var len, loader, handleBoot, 19042 Y = this, 19043 G_ENV = YUI.Env, 19044 mods = G_ENV.mods, 19045 Env = Y.Env, 19046 used = Env._used, 19047 aliases = G_ENV.aliases, 19048 queue = G_ENV._loaderQueue, 19049 firstArg = args[0], 19050 YArray = Y.Array, 19051 config = Y.config, 19052 boot = config.bootstrap, 19053 missing = [], 19054 i, 19055 r = [], 19056 ret = true, 19057 fetchCSS = config.fetchCSS, 19058 process = function(names, skip) { 19059 19060 var i = 0, a = [], name, len, m, req, use; 19061 19062 if (!names.length) { 19063 return; 19064 } 19065 19066 if (aliases) { 19067 len = names.length; 19068 for (i = 0; i < len; i++) { 19069 if (aliases[names[i]] && !mods[names[i]]) { 19070 a = [].concat(a, aliases[names[i]]); 19071 } else { 19072 a.push(names[i]); 19073 } 19074 } 19075 names = a; 19076 } 19077 19078 len = names.length; 19079 19080 for (i = 0; i < len; i++) { 19081 name = names[i]; 19082 if (!skip) { 19083 r.push(name); 19084 } 19085 19086 // only attach a module once 19087 if (used[name]) { 19088 continue; 19089 } 19090 19091 m = mods[name]; 19092 req = null; 19093 use = null; 19094 19095 if (m) { 19096 used[name] = true; 19097 req = m.details.requires; 19098 use = m.details.use; 19099 } else { 19100 // CSS files don't register themselves, see if it has 19101 // been loaded 19102 if (!G_ENV._loaded[VERSION][name]) { 19103 missing.push(name); 19104 } else { 19105 used[name] = true; // probably css 19106 } 19107 } 19108 19109 // make sure requirements are attached 19110 if (req && req.length) { 19111 process(req); 19112 } 19113 19114 // make sure we grab the submodule dependencies too 19115 if (use && use.length) { 19116 process(use, 1); 19117 } 19118 } 19119 19120 }, 19121 19122 handleLoader = function(fromLoader) { 19123 var response = fromLoader || { 19124 success: true, 19125 msg: 'not dynamic' 19126 }, 19127 redo, origMissing, 19128 ret = true, 19129 data = response.data; 19130 19131 Y._loading = false; 19132 19133 if (data) { 19134 origMissing = missing; 19135 missing = []; 19136 r = []; 19137 process(data); 19138 redo = missing.length; 19139 if (redo) { 19140 if ([].concat(missing).sort().join() == 19141 origMissing.sort().join()) { 19142 redo = false; 19143 } 19144 } 19145 } 19146 19147 if (redo && data) { 19148 Y._loading = true; 19149 Y._use(missing, function() { 19150 if (Y._attach(data)) { 19151 Y._notify(callback, response, data); 19152 } 19153 }); 19154 } else { 19155 if (data) { 19156 ret = Y._attach(data); 19157 } 19158 if (ret) { 19159 Y._notify(callback, response, args); 19160 } 19161 } 19162 19163 if (Y._useQueue && Y._useQueue.size() && !Y._loading) { 19164 Y._use.apply(Y, Y._useQueue.next()); 19165 } 19166 19167 }; 19168 19169 19170 // YUI().use('*'); // bind everything available 19171 if (firstArg === '*') { 19172 args = []; 19173 for (i in mods) { 19174 if (mods.hasOwnProperty(i)) { 19175 args.push(i); 19176 } 19177 } 19178 ret = Y._attach(args); 19179 if (ret) { 19180 handleLoader(); 19181 } 19182 return Y; 19183 } 19184 19185 if ((mods.loader || mods['loader-base']) && !Y.Loader) { 19186 Y._attach(['loader' + ((!mods.loader) ? '-base' : '')]); 19187 } 19188 19189 19190 // use loader to expand dependencies and sort the 19191 // requirements if it is available.
19192 if (boot && Y.Loader && args.length) { 19193 loader = getLoader(Y); 19194 loader.require(args); 19195 loader.ignoreRegistered = true; 19196 loader._boot = true; 19197 loader.calculate(null, (fetchCSS) ? null : 'js'); 19198 args = loader.sorted; 19199 loader._boot = false; 19200 } 19201 19202 process(args); 19203 19204 len = missing.length; 19205 19206 19207 if (len) { 19208 missing = YArray.dedupe(missing); 19209 len = missing.length; 19210 } 19211 19212 19213 // dynamic load 19214 if (boot && len && Y.Loader) { 19215 Y._loading = true; 19216 loader = getLoader(Y); 19217 loader.onEnd = handleLoader; 19218 loader.context = Y; 19219 loader.data = args; 19220 loader.ignoreRegistered = false; 19221 loader.require(missing); 19222 loader.insert(null, (fetchCSS) ? null : 'js'); 19223 19224 } else if (boot && len && Y.Get && !Env.bootstrapped) { 19225 19226 Y._loading = true; 19227 19228 handleBoot = function() { 19229 Y._loading = false; 19230 queue.running = false; 19231 Env.bootstrapped = true; 19232 G_ENV._bootstrapping = false; 19233 if (Y._attach(['loader'])) { 19234 Y._use(args, callback); 19235 } 19236 }; 19237 19238 if (G_ENV._bootstrapping) { 19239 queue.add(handleBoot); 19240 } else { 19241 G_ENV._bootstrapping = true; 19242 Y.Get.script(config.base + config.loaderPath, { 19243 onEnd: handleBoot 19244 }); 19245 } 19246 19247 } else { 19248 ret = Y._attach(args); 19249 if (ret) { 19250 handleLoader(); 19251 } 19252 } 19253 19254 return Y; 19255 }, 19256 19257 19258 /** 19259 Utility method for safely creating namespaces if they don't already exist. 19260 May be called statically on the YUI global object or as a method on a YUI 19261 instance. 19262 19263 When called statically, a namespace will be created on the YUI global 19264 object: 19265 19266 // Create `YUI.your.namespace.here` as nested objects, preserving any 19267 // objects that already exist instead of overwriting them. 19268 YUI.namespace('your.namespace.here'); 19269 19270 When called as a method on a YUI instance, a namespace will be created on 19271 that instance: 19272 19273 // Creates `Y.property.package`. 19274 Y.namespace('property.package'); 19275 19276 Dots in the input string cause `namespace` to create nested objects for each 19277 token. If any part of the requested namespace already exists, the current 19278 object will be left in place and will not be overwritten. This allows 19279 multiple calls to `namespace` to preserve existing namespaced properties. 19280 19281 If the first token in the namespace string is "YAHOO", that token is 19282 discarded. This is legacy behavior for backwards compatibility with YUI 2. 19283 19284 Be careful with namespace tokens. Reserved words may work in some browsers 19285 and not others. For instance, the following will fail in some browsers 19286 because the supported version of JavaScript reserves the word "long": 19287 19288 Y.namespace('really.long.nested.namespace'); 19289 19290 Note: If you pass multiple arguments to create multiple namespaces, only the 19291 last one created is returned from this function. 19292
19293 @method namespace 19294 @param {String} namespace* One or more namespaces to create. 19295 @return {Object} Reference to the last namespace object created. 19296 **/ 19297 namespace: function() { 19298 var a = arguments, o, i = 0, j, d, arg; 19299 19300 for (; i < a.length; i++) { 19301 o = this; //Reset base object per argument or it will get reused from the last 19302 arg = a[i]; 19303 if (arg.indexOf(PERIOD) > -1) { //Skip this if no "." is present 19304 d = arg.split(PERIOD); 19305 for (j = (d[0] == 'YAHOO') ? 1 : 0; j < d.length; j++) { 19306 o[d[j]] = o[d[j]] || {}; 19307 o = o[d[j]]; 19308 } 19309 } else { 19310 o[arg] = o[arg] || {}; 19311 o = o[arg]; //Reset base object to the new object so it's returned 19312 } 19313 } 19314 return o; 19315 }, 19316 19317 // this is replaced if the log module is included 19318 log: NOOP, 19319 message: NOOP, 19320 // this is replaced if the dump module is included 19321 dump: function (o) { return ''+o; }, 19322 19323 /** 19324 Reports an error. 19325 19326 The reporting mechanism is controlled by the `throwFail` configuration 19327 attribute. If `throwFail` is falsy, the message is logged. If `throwFail` is 19328 truthy, a JS exception is thrown. 19329 19330 If an `errorFn` is specified in the config it must return `true` to indicate 19331 that the exception was handled and keep it from being thrown. 19332 19333 @method error 19334 @param {String} msg Error message. 19335 @param {Error|String} [e] JavaScript error object or an error string. 19336 @param {String} [src] Source of the error (such as the name of the module in 19337 which the error occurred). 19338 @chainable 19339 **/ 19340 error: function(msg, e, src) { 19341 //TODO Add check for window.onerror here 19342 19343 var Y = this, ret; 19344 19345 if (Y.config.errorFn) { 19346 ret = Y.config.errorFn.apply(Y, arguments); 19347 } 19348 19349 if (!ret) { 19350 throw (e || new Error(msg)); 19351 } else { 19352 Y.message(msg, 'error', ''+src); // don't scrub this one 19353 } 19354 19355 return Y; 19356 }, 19357 19358 /** 19359 Generates an id string that is unique among all YUI instances in this 19360 execution context. 19361 19362 @method guid 19363 @param {String} [pre] Prefix. 19364 @return {String} Unique id. 19365 **/ 19366 guid: function(pre) { 19367 var id = this.Env._guidp + '_' + (++this.Env._uidx); 19368 return (pre) ? (pre + id) : id; 19369 }, 19370 19371 /** 19372 Returns a unique id associated with the given object and (if *readOnly* is 19373 falsy) stamps the object with that id so it can be identified in the future. 19374 19375 Stamping an object involves adding a `_yuid` property to it that contains 19376 the object's id. One exception to this is that in Internet Explorer, DOM 19377 nodes have a `uniqueID` property that contains a browser-generated unique 19378 id, which will be used instead of a YUI-generated id when available. 19379 19380 @method stamp 19381 @param {Object} o Object to stamp. 19382 @param {Boolean} readOnly If truthy and the given object has not already 19383 been stamped, the object will not be modified and `null` will be 19384 returned. 19385 @return {String} Object's unique id, or `null` if *readOnly* was truthy and 19386 the given object was not already stamped. 19387 **/ 19388 stamp: function(o, readOnly) { 19389 var uid; 19390 if (!o) { 19391 return o; 19392 } 19393 19394 // IE generates its own unique ID for dom nodes 19395 // The uniqueID property of a document node returns a new ID 19396 if (o.uniqueID && o.nodeType && o.nodeType !== 9) { 19397 uid = o.uniqueID; 19398 } else { 19399 uid = (typeof o === 'string') ? o : o._yuid; 19400 } 19401 19402 if (!uid) { 19403 uid = this.guid(); 19404 if (!readOnly) { 19405 try { 19406 o._yuid = uid; 19407 } catch (e) { 19408 uid = null; 19409 } 19410 } 19411 } 19412 return uid; 19413 }, 19414 19415 /** 19416 Destroys this YUI instance. 19417 19418 @method destroy 19419 @since 3.3.0 19420 **/ 19421 destroy: function() { 19422 var Y = this; 19423 if (Y.Event) { 19424 Y.Event._unload(); 19425 } 19426 delete instances[Y.id]; 19427 delete Y.Env; 19428 delete Y.config; 19429 } 19430 19431 /** 19432 Safe `instanceof` wrapper that works around a memory leak in IE when the 19433 object being tested is `window` or `document`. 19434 19435 Unless you are testing objects that may be `window` or `document`, you 19436 should use the native `instanceof` operator instead of this method. 19437 19438 @method instanceOf 19439 @param {Object} o Object to check. 19440 @param {Object} type Class to check against. 19441 @since 3.3.0 19442 **/ 19443}; 19444 19445 YUI.prototype = proto; 19446 19447 // inheritance utilities are not available yet 19448 for (prop in proto) { 19449 if (proto.hasOwnProperty(prop)) { 19450 YUI[prop] = proto[prop]; 19451 } 19452 } 19453 19454 /** 19455 Applies a configuration to all YUI instances in this execution context. 19456 19457 The main use case for this method is in "mashups" where several third-party 19458 scripts need to write to a global YUI config, but cannot share a single 19459 centrally-managed config object. This way they can all call 19460 `YUI.applyConfig({})` instead of overwriting the single global config. 19461 19462 @example 19463 19464 YUI.applyConfig({ 19465 modules: { 19466 davglass: { 19467 fullpath: './davglass.js' 19468 } 19469 } 19470 }); 19471 19472 YUI.applyConfig({ 19473 modules: { 19474 foo: { 19475 fullpath: './foo.js' 19476 } 19477 } 19478 }); 19479 19480 YUI().use('davglass', function (Y) { 19481 // Module davglass will be available here. 19482 }); 19483 19484 @method applyConfig 19485 @param {Object} o Configuration object to apply. 19486 @static 19487 @since 3.5.0 19488 **/ 19489 YUI.applyConfig = function(o) { 19490 if (!o) { 19491 return; 19492 } 19493 //If there is a GlobalConfig, apply it first to set the defaults 19494 if (YUI.GlobalConfig) { 19495 this.prototype.applyConfig.call(this, YUI.GlobalConfig); 19496 } 19497 //Apply this config to it 19498 this.prototype.applyConfig.call(this, o); 19499 //Reset GlobalConfig to the combined config 19500 YUI.GlobalConfig = this.config; 19501 }; 19502 19503 // set up the environment 19504 YUI._init(); 19505 19506 if (hasWin) { 19507 add(doc, 'DOMContentLoaded', handleReady); 19508 19509 // add a window load event at load time so we can capture 19510 // the case where it fires before dynamic loading is 19511 // complete. 19512 add(window, 'load', handleLoad); 19513 } else { 19514 handleReady(); 19515 handleLoad(); 19516 } 19517 19518 YUI.Env.add = add; 19519 YUI.Env.remove = remove; 19520 19521 /*global exports*/
19522 // Support the CommonJS method for exporting our single global 19523 if (typeof exports == 'object') { 19524 exports.YUI = YUI; 19525 /** 19526 * Set a method to be called when `Get.script` is called in Node.js 19527 * `Get` will open the file, then pass it's content and it's path 19528 * to this method before attaching it. Commonly used for code coverage 19529 * instrumentation. <strong>Calling this multiple times will only 19530 * attach the last hook method</strong>. This method is only 19531 * available in Node.js. 19532 * @method setLoadHook 19533 * @static 19534 * @param {Function} fn The function to set 19535 * @param {String} fn.data The content of the file 19536 * @param {String} fn.path The file path of the file 19537 */ 19538 YUI.setLoadHook = function(fn) { 19539 YUI._getLoadHook = fn; 19540 }; 19541 /** 19542 * Load hook for `Y.Get.script` in Node.js, see `YUI.setLoadHook` 19543 * @method _getLoadHook 19544 * @private 19545 * @param {String} data The content of the file 19546 * @param {String} path The file path of the file 19547 */ 19548 YUI._getLoadHook = null; 19549 } 19550 19551 YUI.Env[VERSION] = {}; 19552}()); 19553 19554 19555/** 19556Config object that contains all of the configuration options for 19557this `YUI` instance. 19558 19559This object is supplied by the implementer when instantiating YUI. Some 19560properties have default values if they are not supplied by the implementer. 19561 19562This object should not be updated directly because some values are cached. Use 19563`applyConfig()` to update the config object on a YUI instance that has already 19564been configured. 19565 19566@class config 19567@static 19568**/ 19569 19570/** 19571If `true` (the default), YUI will "bootstrap" the YUI Loader and module metadata 19572if they're needed to load additional dependencies and aren't already available. 19573 19574Setting this to `false` will prevent YUI from automatically loading the Loader 19575and module metadata, so you will need to manually ensure that they're available 19576or handle dependency resolution yourself. 19577 19578@property {Boolean} bootstrap 19579@default true 19580**/ 19581 19582/** 19583 19584@property {Object} filters 19585**/ 19586 19587/** 19588If `true`, YUI will use a combo handler to load multiple modules in as few 19589requests as possible. 19590 19591The YUI CDN (which YUI uses by default) supports combo handling, but other 19592servers may not. If the server from which you're loading YUI does not support 19593combo handling, set this to `false`. 19594 19595Providing a value for the `base` config property will cause `combine` to default 19596to `false` instead of `true`. 19597 19598@property {Boolean} combine 19599@default true 19600*/ 19601 19602/** 19603Array of module names that should never be dynamically loaded. 19604 19605@property {String[]} ignore 19606**/ 19607 19608/** 19609Array of module names that should always be loaded when required, even if 19610already present on the page. 19611 19612@property {String[]} force
19613**/ 19614 19615/** 19616DOM element or id that should be used as the insertion point for dynamically 19617added `<script>` and `<link>` nodes. 19618 19619@property {HTMLElement|String} insertBefore 19620**/ 19621 19622/** 19623Object hash containing attributes to add to dynamically added `<script>` nodes. 19624 19625@property {Object} jsAttributes 19626**/ 19627 19628/** 19629Object hash containing attributes to add to dynamically added `<link>` nodes. 19630 19631@property {Object} cssAttributes 19632**/ 19633 19634/** 19635Timeout in milliseconds before a dynamic JS or CSS request will be considered a 19636failure. If not set, no timeout will be enforced. 19637 19638@property {Number} timeout 19639**/ 19640 19641/** 19642A hash of module definitions to add to the list of available YUI modules. These 19643modules can then be dynamically loaded via the `use()` method. 19644 19645This is a hash in which keys are module names and values are objects containing 19646module metadata. 19647 19648See `Loader.addModule()` for the supported module metadata fields. Also see 19649`groups`, which provides a way to configure the base and combo spec for a set of 19650modules. 19651 19652@example 19653 19654 modules: { 19655 mymod1: { 19656 requires: ['node'], 19657 fullpath: '/mymod1/mymod1.js' 19658 }, 19659 19660 mymod2: { 19661 requires: ['mymod1'], 19662 fullpath: '/mymod2/mymod2.js' 19663 }, 19664 19665 mymod3: '/js/mymod3.js', 19666 mycssmod: '/css/mycssmod.css' 19667 } 19668 19669@property {Object} modules 19670**/ 19671 19672/** 19673Aliases are dynamic groups of modules that can be used as shortcuts. 19674 19675@example 19676 19677 YUI({ 19678 aliases: { 19679 davglass: [ 'node', 'yql', 'dd' ], 19680 mine: [ 'davglass', 'autocomplete'] 19681 } 19682 }).use('mine', function (Y) { 19683 // Node, YQL, DD & AutoComplete available here. 19684 }); 19685 19686@property {Object} aliases 19687**/ 19688 19689/** 19690A hash of module group definitions. 19691 19692For each group you can specify a list of modules and the base path and 19693combo spec to use when dynamically loading the modules. 19694 19695@example 19696 19697 groups: { 19698 yui2: { 19699 // specify whether or not this group has a combo service 19700 combine: true, 19701 19702 // The comboSeperator to use with this group's combo handler 19703 comboSep: ';', 19704 19705 // The maxURLLength for this server 19706 maxURLLength: 500, 19707 19708 // the base path for non-combo paths 19709 base: 'http://yui.yahooapis.com/2.8.0r4/build/', 19710 19711 // the path to the combo service 19712 comboBase: 'http://yui.yahooapis.com/combo?', 19713 19714 // a fragment to prepend to the path attribute when 19715 // when building combo urls 19716 root: '2.8.0r4/build/', 19717 19718 // the module definitions 19719 modules: { 19720 yui2_yde: { 19721 path: "yahoo-dom-event/yahoo-dom-event.js" 19722 }, 19723 yui2_anim: { 19724 path: "animation/animation.js", 19725 requires: ['yui2_yde'] 19726 } 19727 } 19728 } 19729 } 19730 19731@property {Object} groups 19732**/ 19733 19734/** 19735Path to the Loader JS file, relative to the `base` path. 19736 19737This is used to dynamically bootstrap the Loader when it's needed and isn't yet 19738available. 19739 19740@property {String} loaderPath 19741@default "loader/loader-min.js" 19742**/ 19743 19744/** 19745If `true`, YUI will attempt to load CSS dependencies and skins. Set this to 19746`false` to prevent YUI from loading any CSS, or set it to the string `"force"` 19747to force CSS dependencies to be loaded even if their associated JS modules are 19748already loaded. 19749 19750@property {Boolean|String} fetchCSS 19751@default true 19752**/ 19753 19754/** 19755Default gallery version used to build gallery module urls. 19756 19757@property {String} gallery 19758@since 3.1.0 19759**/ 19760 19761/** 19762Default YUI 2 version used to build YUI 2 module urls. 19763 19764This is used for intrinsic YUI 2 support via the 2in3 project. Also see the 19765`2in3` config for pulling different revisions of the wrapped YUI 2 modules. 19766 19767@property {String} yui2 19768@default "2.9.0" 19769@since 3.1.0 19770**/ 19771 19772/** 19773Revision number of YUI 2in3 modules that should be used when loading YUI 2in3. 19774 19775@property {String} 2in3 19776@default "4" 19777@since 3.1.0 19778**/ 19779 19780/** 19781Alternate console log function that should be used in environments without a 19782supported native console. This function is executed with the YUI instance as its 19783`this` object. 19784 19785@property {Function} logFn 19786@since 3.1.0
19787**/ 19788 19789/** 19790The minimum log level to log messages for. Log levels are defined 19791incrementally. Messages greater than or equal to the level specified will 19792be shown. All others will be discarded. The order of log levels in 19793increasing priority is: 19794 19795 debug 19796 info 19797 warn 19798 error 19799 19800@property {String} logLevel 19801@default 'debug' 19802@since 3.10.0 19803**/ 19804 19805/** 19806Callback to execute when `Y.error()` is called. It receives the error message 19807and a JavaScript error object if one was provided. 19808 19809This function is executed with the YUI instance as its `this` object. 19810 19811Returning `true` from this function will prevent an exception from being thrown. 19812 19813@property {Function} errorFn 19814@param {String} errorFn.msg Error message 19815@param {Object} [errorFn.err] Error object (if one was provided). 19816@since 3.2.0 19817**/ 19818 19819/** 19820A callback to execute when Loader fails to load one or more resources. 19821 19822This could be because of a script load failure. It could also be because a 19823module fails to register itself when the `requireRegistration` config is `true`. 19824 19825If this function is defined, the `use()` callback will only be called when the 19826loader succeeds. Otherwise, `use()` will always executes unless there was a 19827JavaScript error when attaching a module. 19828 19829@property {Function} loadErrorFn 19830@since 3.3.0 19831**/ 19832 19833/** 19834If `true`, Loader will expect all loaded scripts to be first-class YUI modules 19835that register themselves with the YUI global, and will trigger a failure if a 19836loaded script does not register a YUI module. 19837 19838@property {Boolean} requireRegistration 19839@default false 19840@since 3.3.0 19841**/ 19842 19843/** 19844Cache serviced use() requests. 19845 19846@property {Boolean} cacheUse 19847@default true 19848@since 3.3.0 19849@deprecated No longer used. 19850**/ 19851 19852/** 19853Whether or not YUI should use native ES5 functionality when available for 19854features like `Y.Array.each()`, `Y.Object()`, etc. 19855 19856When `false`, YUI will always use its own fallback implementations instead of 19857relying on ES5 functionality, even when ES5 functionality is available. 19858 19859@property {Boolean} useNativeES5 19860@default true 19861@since 3.5.0 19862**/ 19863 19864/** 19865 * Leverage native JSON stringify if the browser has a native 19866 * implementation. In general, this is a good idea. See the Known Issues 19867 * section in the JSON user guide for caveats. The default value is true 19868 * for browsers with native JSON support. 19869 * 19870 * @property useNativeJSONStringify 19871 * @type Boolean 19872 * @default true 19873 * @since 3.8.0 19874 */ 19875 19876 /** 19877 * Leverage native JSON parse if the browser has a native implementation. 19878 * In general, this is a good idea. See the Known Issues section in the 19879 * JSON user guide for caveats. The default value is true for browsers with 19880 * native JSON support. 19881 * 19882 * @property useNativeJSONParse 19883 * @type Boolean 19884 * @default true 19885 * @since 3.8.0 19886 */ 19887 19888/** 19889Delay the `use` callback until a specific event has passed (`load`, `domready`, `contentready` or `available`) 19890 19891@property {Object|String} delayUntil 19892@since 3.6.0 19893@example 19894 19895You can use `load` or `domready` strings by default: 19896 19897 YUI({ 19898 delayUntil: 'domready' 19899 }, function (Y) { 19900 // This will not execute until 'domeready' occurs. 19901 }); 19902 19903Or you can delay until a node is available (with `available` or `contentready`): 19904 19905 YUI({ 19906 delayUntil: { 19907 event: 'available', 19908 args : '#foo' 19909 } 19910 }, function (Y) { 19911 // This will not execute until a node matching the selector "#foo" is 19912 // available in the DOM. 19913 }); 19914 19915**/ 19916YUI.add('yui-base', function (Y, NAME) { 19917 19918/* 19919 * YUI stub 19920 * @module yui 19921 * @submodule yui-base 19922 */ 19923/** 19924 * The YUI module contains the components required for building the YUI 19925 * seed file. This includes the script loading mechanism, a simple queue, 19926 * and the core utilities for the library. 19927 * @module yui 19928 * @submodule yui-base 19929 */ 19930 19931/** 19932 * Provides core language utilites and extensions used throughout YUI. 19933 * 19934 * @class Lang 19935 * @static 19936 */ 19937 19938var L = Y.Lang || (Y.Lang = {}), 19939 19940STRING_PROTO = String.prototype, 19941TOSTRING = Object.prototype.toString, 19942 19943TYPES = { 19944 'undefined' : 'undefined', 19945 'number' : 'number', 19946 'boolean' : 'boolean', 19947 'string' : 'string', 19948 '[object Function]': 'function', 19949 '[object RegExp]' : 'regexp', 19950 '[object Array]' : 'array', 19951 '[object Date]' : 'date', 19952 '[object Error]' : 'error' 19953}, 19954 19955SUBREGEX = /\{\s*([^|}]+?)\s*(?:\|([^}]*))?\s*\}/g, 19956 19957WHITESPACE = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF", 19958WHITESPACE_CLASS = "[\x09-\x0D\x20\xA0\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]+", 19959TRIM_LEFT_REGEX = new RegExp("^" + WHITESPACE_CLASS), 19960TRIM_RIGHT_REGEX = new RegExp(WHITESPACE_CLASS + "$"), 19961TRIMREGEX = new RegExp(TRIM_LEFT_REGEX.source + "|" + TRIM_RIGHT_REGEX.source, "g"), 19962 19963NATIVE_FN_REGEX = /\{\s*\[(?:native code|function)\]\s*\}/i; 19964 19965// -- Protected Methods -------------------------------------------------------- 19966 19967/** 19968Returns `true` if the given function appears to be implemented in native code, 19969`false` otherwise. Will always return `false` -- even in ES5-capable browsers -- 19970if the `useNativeES5` YUI config option is set to `false`. 19971 19972This isn't guaranteed to be 100% accurate and won't work for anything other than 19973functions, but it can be useful for determining whether a function like 19974`Array.prototype.forEach` is native or a JS shim provided by another library. 19975 19976There's a great article by @kangax discussing certain flaws with this technique: 19977<http://perfectionkills.com/detecting-built-in-host-methods/> 19978 19979While his points are valid, it's still possible to benefit from this function 19980as long as it's used carefully and sparingly, and in such a way that false 19981negatives have minimal consequences. It's used internally to avoid using 19982potentially broken non-native ES5 shims that have been added to the page b
19982y 19983other libraries. 19984 19985@method _isNative 19986@param {Function} fn Function to test. 19987@return {Boolean} `true` if _fn_ appears to be native, `false` otherwise. 19988@static 19989@protected 19990@since 3.5.0 19991**/ 19992L._isNative = function (fn) { 19993 return !!(Y.config.useNativeES5 && fn && NATIVE_FN_REGEX.test(fn)); 19994}; 19995 19996// -- Public Methods ----------------------------------------------------------- 19997 19998/** 19999 * Determines whether or not the provided item is an array. 20000 * 20001 * Returns `false` for array-like collections such as the function `arguments` 20002 * collection or `HTMLElement` collections. Use `Y.Array.test()` if you want to 20003 * test for an array-like collection. 20004 * 20005 * @method isArray 20006 * @param o The object to test. 20007 * @return {boolean} true if o is an array. 20008 * @static 20009 */ 20010L.isArray = L._isNative(Array.isArray) ? Array.isArray : function (o) { 20011 return L.type(o) === 'array'; 20012}; 20013 20014/** 20015 * Determines whether or not the provided item is a boolean. 20016 * @method isBoolean 20017 * @static 20018 * @param o The object to test. 20019 * @return {boolean} true if o is a boolean. 20020 */ 20021L.isBoolean = function(o) { 20022 return typeof o === 'boolean'; 20023}; 20024 20025/** 20026 * Determines whether or not the supplied item is a date instance. 20027 * @method isDate 20028 * @static 20029 * @param o The object to test. 20030 * @return {boolean} true if o is a date. 20031 */ 20032L.isDate = function(o) { 20033 return L.type(o) === 'date' && o.toString() !== 'Invalid Date' && !isNaN(o); 20034}; 20035 20036/** 20037 * <p> 20038 * Determines whether or not the provided item is a function. 20039 * Note: Internet Explorer thinks certain functions are objects: 20040 * </p> 20041 * 20042 * <pre> 20043 * var obj = document.createElement("object"); 20044 * Y.Lang.isFunction(obj.getAttribute) // reports false in IE 20045 * 20046 * var input = document.createElement("input"); // append to body 20047 * Y.Lang.isFunction(input.focus) // reports false in IE 20048 * </pre> 20049 * 20050 * <p> 20051 * You will have to implement additional tests if these functions 20052 * matter to you. 20053 * </p> 20054 * 20055 * @method isFunction 20056 * @static 20057 * @param o The object to test. 20058 * @return {boolean} true if o is a function. 20059 */ 20060L.isFunction = function(o) { 20061 return L.type(o) === 'function'; 20062}; 20063 20064/** 20065 * Determines whether or not the provided item is null. 20066 * @method isNull 20067 * @static 20068 * @param o The object to test. 20069 * @return {boolean} true if o is null. 20070 */ 20071L.isNull = function(o) { 20072 return o === null; 20073}; 20074 20075/** 20076 * Determines whether or not the provided item is a legal number. 20077 * @method isNumber 20078 * @static 20079 * @param o The object to test. 20080 * @return {boolean} true if o is a number. 20081 */ 20082L.isNumber = function(o) { 20083 return typeof o === 'number' && isFinite(o); 20084}; 20085 20086/** 20087 * Determines whether or not the provided item is of type object 20088 * or function. Note that arrays are also objects, so 20089 * <code>Y.Lang.isObject([]) === true</code>. 20090 * @method isObject 20091 * @static 20092 * @param o The object to test. 20093 * @param failfn {boolean} fail if the input is a function. 20094 * @return {boolean} true if o is an object. 20095 * @see isPlainObject 20096 */ 20097L.isObject = function(o, failfn) { 20098 var t = typeof o; 20099 return (o && (t === 'object' || 20100 (!failfn && (t === 'function' || L.isFunction(o))))) || false; 20101}; 20102 20103/** 20104 * Determines whether or not the provided value is a regexp. 20105 * @method isRegExp 20106 * @static 20107 * @param value The value or object to test. 20108 * @return {boolean} true if value is a regexp. 20109 */ 20110L.isRegExp = function(value) { 20111 return L.type(value) === 'regexp'; 20112}; 20113 20114/** 20115 * Determines whether or not the provided item is a string. 20116 * @method isString 20117 * @static 20118 * @param o The object to test. 20119 * @return {boolean} true if o is a string. 20120 */ 20121L.isString = function(o) { 20122 return typeof o === 'string'; 20123}; 20124 20125/** 20126 * Determines whether or not the provided item is undefined. 20127 * @method isUndefined 20128 * @static 20129 * @param o The object to test. 20130 * @return {boolean} true if o is undefined. 20131 */ 20132L.isUndefined = function(o) { 20133 return typeof o === 'undefined'; 20134}; 20135 20136/** 20137 * A convenience method for detecting a legitimate non-null value. 20138 * Returns false for null/undefined/NaN, true for other values, 20139 * including 0/false/'' 20140 * @method isValue 20141 * @static 20142 * @param o The item to test. 20143 * @return {boolean} true if it is not null/undefined/NaN || false. 20144 */ 20145L.isValue = function(o) { 20146 var t = L.type(o); 20147 20148 switch (t) { 20149 case 'number': 20150 return isFinite(o); 20151 20152 case 'null': // fallthru 20153 case 'undefined': 20154 return false;
20155 20156 default: 20157 return !!t; 20158 } 20159}; 20160 20161/** 20162 * Returns the current time in milliseconds. 20163 * 20164 * @method now 20165 * @return {Number} Current time in milliseconds. 20166 * @static 20167 * @since 3.3.0 20168 */ 20169L.now = Date.now || function () { 20170 return new Date().getTime(); 20171}; 20172 20173/** 20174 * Performs `{placeholder}` substitution on a string. The object passed as the 20175 * second parameter provides values to replace the `{placeholder}`s. 20176 * `{placeholder}` token names must match property names of the object. For example, 20177 * 20178 *`var greeting = Y.Lang.sub("Hello, {who}!", { who: "World" });` 20179 * 20180 * `{placeholder}` tokens that are undefined on the object map will be left 20181 * in tact (leaving unsightly `{placeholder}`'s in the output string). 20182 * 20183 * @method sub 20184 * @param {string} s String to be modified. 20185 * @param {object} o Object containing replacement values. 20186 * @return {string} the substitute result. 20187 * @static 20188 * @since 3.2.0 20189 */ 20190L.sub = function(s, o) { 20191 20192 /** 20193 Finds the value of `key` in given object. 20194 If the key has a 'dot' notation e.g. 'foo.bar.baz', the function will 20195 try to resolve this path if it doesn't exist as a property 20196 @example 20197 value({ 'a.b': 1, a: { b: 2 } }, 'a.b'); // 1 20198 value({ a: { b: 2 } } , 'a.b'); // 2 20199 @param {Object} obj A key/value pairs object 20200 @param {String} key 20201 @return {Any} 20202 @private 20203 **/ 20204 function value(obj, key) { 20205 20206 var subkey; 20207 20208 if ( typeof obj[key] !== 'undefined' ) { 20209 return obj[key]; 20210 } 20211 20212 key = key.split('.'); // given 'a.b.c' 20213 subkey = key.slice(1).join('.'); // 'b.c' 20214 key = key[0]; // 'a' 20215 20216 // special case for null as typeof returns object and we don't want that. 20217 if ( subkey && typeof obj[key] === 'object' && obj[key] !== null ) { 20218 return value(obj[key], subkey); 20219 } 20220 } 20221 20222 return s.replace ? s.replace(SUBREGEX, function (match, key) { 20223 var val = key.indexOf('.')>-1 ? value(o, key) : o[key]; 20224 return typeof val === 'undefined' ? match : val; 20225 }) : s; 20226}; 20227 20228/** 20229 * Returns a string without any leading or trailing whitespace. If 20230 * the input is not a string, the input will be returned untouched. 20231 * @method trim 20232 * @static 20233 * @param s {string} the string to trim. 20234 * @return {string} the trimmed string. 20235 */ 20236L.trim = L._isNative(STRING_PROTO.trim) && !WHITESPACE.trim() ? function(s) { 20237 return s && s.trim ? s.trim() : s; 20238} : function (s) { 20239 try { 20240 return s.replace(TRIMREGEX, ''); 20241 } catch (e) { 20242 return s; 20243 } 20244}; 20245 20246/** 20247 * Returns a string without any leading whitespace. 20248 * @method trimLeft 20249 * @static 20250 * @param s {string} the string to trim. 20251 * @return {string} the trimmed string. 20252 */ 20253L.trimLeft = L._isNative(STRING_PROTO.trimLeft) && !WHITESPACE.trimLeft() ? function (s) { 20254 return s.trimLeft(); 20255} : function (s) { 20256 return s.replace(TRIM_LEFT_REGEX, ''); 20257}; 20258 20259/** 20260 * Returns a string without any trailing whitespace. 20261 * @method trimRight 20262 * @static 20263 * @param s {string} the string to trim. 20264 * @return {string} the trimmed string. 20265 */ 20266L.trimRight = L._isNative(STRING_PROTO.trimRight) && !WHITESPACE.trimRight() ? function (s) { 20267 return s.trimRight(); 20268} : function (s) { 20269 return s.replace(TRIM_RIGHT_REGEX, ''); 20270}; 20271 20272/** 20273Returns one of the following strings, representing the type of the item passed 20274in: 20275 20276 * "array" 20277 * "boolean" 20278 * "date" 20279 * "error" 20280 * "function" 20281 * "null" 20282 * "number" 20283 * "object" 20284 * "regexp" 20285 * "string" 20286 * "undefined" 20287 20288Known issues: 20289 20290 * `typeof HTMLElementCollection` returns function in Safari, but 20291 `Y.Lang.type()` reports "object", which could be a good thing -- 20292 but it actually caused the logic in <code>Y.Lang.isObject</code> to fail. 20293 20294@method type 20295@param o the item to test. 20296@return {string} the detected type. 20297@static 20298**/ 20299L.type = function(o) { 20300 return TYPES[typeof o] || TYPES[TOSTRING.call(o)] || (o ? 'object' : 'null'); 20301}; 20302/** 20303@module yui 20304@submodule yui-base 20305*/ 20306 20307var Lang = Y.Lang, 20308 Native = Array.prototype, 20309 20310 hasOwn = Object.prototype.hasOwnProperty; 20311 20312/** 20313Provides utility methods for working with arrays. Additional array helpers can 20314be found in the `collection` and `array-extras` modules. 20315 20316`Y.Array(thing)` returns a native array created from _thing_. Depending on 20317_thing_'s type, one of the following will happen: 20318 20319 * Arrays are returned unmodified unless a non-zero _startIndex_ is 20320 specified. 20321 * Array-like collections (see `Array.test()`) are converted to arrays. 20322 * For everything else, a new array is created with _thing_ as the sole 20323 item. 20324 20325Note: elements that are also collections, such as `<form>` and `<select>` 20326elements, are not automatically converted to arrays. To force a conversion, 20327pass `true` as the value of the _force_ parameter. 20328 20329@class Array 20330@constructor 20331@param {Any} thing The thing to arrayify. 20332@param {Number} [startIndex=0] If non-zero and _thing_ is an array or array-like 20333 collection, a subset of items starting at the specified index will be 20334 returned. 20335@param {Boolean} [force=false] If `true`, _thing_ will be treated as an 20336 array-like collection no matter what. 20337@return {Array} A native array created from _thing_, according to the rules 20338 described above. 20339**/ 20340function YArray(thing, startIndex, force) { 20341 var len, result; 20342 20343 /*jshint expr: true*/ 20344 startIndex || (startIndex = 0); 20345 20346 if (force || YArray.test(thing)) { 20347 // IE throws when trying to slice HTMLElement collections. 20348 try { 20349 return Native.slice.call(thing, startIndex); 20350 } catch (ex) { 20351 result = []; 20352 20353 for (len = thing.length; startIndex < len; ++startIndex) { 20354 result.push(thing[startIndex]); 20355 } 20356 20357 return result; 20358 } 20359 } 20360 20361 return [thing]; 20362} 20363 20364Y.Array = YArray; 20365 20366/**
20367Dedupes an array of strings, returning an array that's guaranteed to contain 20368only one copy of a given string. 20369 20370This method differs from `Array.unique()` in that it's optimized for use only 20371with arrays consisting entirely of strings or entirely of numbers, whereas 20372`unique` may be used with other value types (but is slower). 20373 20374Using `dedupe()` with values other than strings or numbers, or with arrays 20375containing a mix of strings and numbers, may result in unexpected behavior. 20376 20377@method dedupe 20378@param {String[]|Number[]} array Array of strings or numbers to dedupe. 20379@return {Array} Copy of _array_ containing no duplicate values. 20380@static 20381@since 3.4.0 20382**/ 20383YArray.dedupe = Lang._isNative(Object.create) ? function (array) { 20384 var hash = Object.create(null), 20385 results = [], 20386 i, item, len; 20387 20388 for (i = 0, len = array.length; i < len; ++i) { 20389 item = array[i]; 20390 20391 if (!hash[item]) { 20392 hash[item] = 1; 20393 results.push(item); 20394 } 20395 } 20396 20397 return results; 20398} : function (array) { 20399 var hash = {}, 20400 results = [], 20401 i, item, len; 20402 20403 for (i = 0, len = array.length; i < len; ++i) { 20404 item = array[i]; 20405 20406 if (!hasOwn.call(hash, item)) { 20407 hash[item] = 1; 20408 results.push(item); 20409 } 20410 } 20411 20412 return results; 20413}; 20414 20415/** 20416Executes the supplied function on each item in the array. This method wraps 20417the native ES5 `Array.forEach()` method if available. 20418 20419@method each 20420@param {Array} array Array to iterate. 20421@param {Function} fn Function to execute on each item in the array. The function 20422 will receive the following arguments: 20423 @param {Any} fn.item Current array item. 20424 @param {Number} fn.index Current array index. 20425 @param {Array} fn.array Array being iterated. 20426@param {Object} [thisObj] `this` object to use when calling _fn_. 20427@return {YUI} The YUI instance. 20428@static 20429**/ 20430YArray.each = YArray.forEach = Lang._isNative(Native.forEach) ? function (array, fn, thisObj) { 20431 Native.forEach.call(array || [], fn, thisObj || Y); 20432 return Y; 20433} : function (array, fn, thisObj) { 20434 for (var i = 0, len = (array && array.length) || 0; i < len; ++i) { 20435 if (i in array) { 20436 fn.call(thisObj || Y, array[i], i, array); 20437 } 20438 } 20439 20440 return Y; 20441}; 20442 20443/** 20444Alias for `each()`. 20445 20446@method forEach 20447@static 20448**/ 20449 20450/** 20451Returns an object using the first array as keys and the second as values. If 20452the second array is not provided, or if it doesn't contain the same number of 20453values as the first array, then `true` will be used in place of the missing 20454values. 20455 20456@example 20457 20458 Y.Array.hash(['a', 'b', 'c'], ['foo', 'bar']); 20459 // => {a: 'foo', b: 'bar', c: true} 20460 20461@method hash 20462@param {String[]} keys Array of strings to use as keys. 20463@param {Array} [values] Array to use as values. 20464@return {Object} Hash using the first array as keys and the second as values. 20465@static 20466**/ 20467YArray.hash = function (keys, values) { 20468 var hash = {}, 20469 vlen = (values && values.length) || 0, 20470 i, len; 20471 20472 for (i = 0, len = keys.length; i < len; ++i) { 20473 if (i in keys) { 20474 hash[keys[i]] = vlen > i && i in values ? values[i] : true; 20475 } 20476 } 20477 20478 return hash; 20479}; 20480 20481/** 20482Returns the index of the first item in the array that's equal (using a strict 20483equality check) to the specified _value_, or `-1` if the value isn't found. 20484 20485This method wraps the native ES5 `Array.indexOf()` method if available. 20486 20487@method indexOf 20488@param {Array} array Array to search. 20489@param {Any} value Value to search for. 20490@param {Number} [from=0] The index at which to begin the search. 20491@return {Number} Index of the item strictly equal to _value_, or `-1` if not 20492 found. 20493@static 20494**/ 20495YArray.indexOf = Lang._isNative(Native.indexOf) ? function (array, value, from) { 20496 return Native.indexOf.call(array, value, from); 20497} : function (array, value, from) { 20498 // http://es5.github.com/#x15.4.4.14 20499 var len = array.length; 20500 20501 from = +from || 0; 20502 from = (from > 0 || -1) * Math.floor(Math.abs(from)); 20503 20504 if (from < 0) { 20505 from += len; 20506 20507 if (from < 0) { 20508 from = 0; 20509 } 20510 } 20511 20512 for (; from < len; ++from) { 20513 if (from in array && array[from] === value) { 20514 return from; 20515 } 20516 } 20517 20518 return -1; 20519}; 20520 20521/** 20522Numeric sort convenience function. 20523 20524The native `Array.prototype.sort()` function converts values to strings and 20525sorts them in lexicographic order, which is unsuitable for sorting numeric 20526values. Provide `Array.numericSort` as a custom sort function when you want 20527to sort values in numeric order. 20528 20529@example 20530 20531 [42, 23, 8, 16, 4, 15].sort(Y.Array.numericSort); 20532 // => [4, 8, 15, 16, 23, 42] 20533 20534@method numericSort 20535@param {Number} a First value to compare. 20536@param {Number} b Second value to compare. 20537@return {Number} Difference between _a_ and _b_. 20538@static 20539**/ 20540YArray.numericSort = function (a, b) { 20541 return a - b; 20542}; 20543 20544/** 20545Executes the supplied function on each item in the array. Returning a truthy 20546value from the function will stop the processing of remaining items. 20547 20548@method some 20549@param {Array} array Array to iterate over. 20550@param {Function} fn Function to execute on each item. The function will receive 20551 the following arguments: 20552 @param {Any} fn.value Current array item. 20553 @param {Number} fn.index Current array index. 20554 @param {Array} fn.array Array being iterated over. 20555@param {Object} [thisObj] `this` object to use when calling _fn_. 20556@return {Boolean} `true` if the function returns a truthy value on any of the 20557 items in the array; `false` otherwise. 20558@static 20559**/ 20560YArray.some = Lang._isNative(Native.some) ? function (array, fn, thisObj) { 20561 return Native.some.call(array, fn, thisObj); 20562} : function (array, fn, thisObj) { 20563 for (var i = 0, len = array.length; i < len; ++i) { 20564 if (i in array && fn.call(thisObj, array[i], i, array)) { 20565 return true; 20566 } 20567 } 20568 20569 return false;
20570}; 20571 20572/** 20573Evaluates _obj_ to determine if it's an array, an array-like collection, or 20574something else. This is useful when working with the function `arguments` 20575collection and `HTMLElement` collections. 20576 20577Note: This implementation doesn't consider elements that are also 20578collections, such as `<form>` and `<select>`, to be array-like. 20579 20580@method test 20581@param {Object} obj Object to test. 20582@return {Number} A number indicating the results of the test: 20583 20584 * 0: Neither an array nor an array-like collection. 20585 * 1: Real array. 20586 * 2: Array-like collection. 20587 20588@static 20589**/ 20590YArray.test = function (obj) { 20591 var result = 0; 20592 20593 if (Lang.isArray(obj)) { 20594 result = 1; 20595 } else if (Lang.isObject(obj)) { 20596 try { 20597 // indexed, but no tagName (element) or scrollTo/document (window. From DOM.isWindow test which we can't use here), 20598 // or functions without apply/call (Safari 20599 // HTMLElementCollection bug). 20600 if ('length' in obj && !obj.tagName && !(obj.scrollTo && obj.document) && !obj.apply) { 20601 result = 2; 20602 } 20603 } catch (ex) {} 20604 } 20605 20606 return result; 20607}; 20608/** 20609 * The YUI module contains the components required for building the YUI 20610 * seed file. This includes the script loading mechanism, a simple queue, 20611 * and the core utilities for the library. 20612 * @module yui 20613 * @submodule yui-base 20614 */ 20615 20616/** 20617 * A simple FIFO queue. Items are added to the Queue with add(1..n items) and 20618 * removed using next(). 20619 * 20620 * @class Queue 20621 * @constructor 20622 * @param {MIXED} item* 0..n items to seed the queue. 20623 */ 20624function Queue() { 20625 this._init(); 20626 this.add.apply(this, arguments); 20627} 20628 20629Queue.prototype = { 20630 /** 20631 * Initialize the queue 20632 * 20633 * @method _init 20634 * @protected 20635 */ 20636 _init: function() { 20637 /** 20638 * The collection of enqueued items 20639 * 20640 * @property _q 20641 * @type Array 20642 * @protected 20643 */ 20644 this._q = []; 20645 }, 20646 20647 /** 20648 * Get the next item in the queue. FIFO support 20649 * 20650 * @method next 20651 * @return {MIXED} the next item in the queue. 20652 */ 20653 next: function() { 20654 return this._q.shift(); 20655 }, 20656 20657 /** 20658 * Get the last in the queue. LIFO support. 20659 * 20660 * @method last 20661 * @return {MIXED} the last item in the queue. 20662 */ 20663 last: function() { 20664 return this._q.pop(); 20665 }, 20666 20667 /** 20668 * Add 0..n items to the end of the queue. 20669 * 20670 * @method add 20671 * @param {MIXED} item* 0..n items. 20672 * @return {object} this queue. 20673 */ 20674 add: function() { 20675 this._q.push.apply(this._q, arguments); 20676 20677 return this; 20678 }, 20679 20680 /** 20681 * Returns the current number of queued items. 20682 * 20683 * @method size 20684 * @return {Number} The size. 20685 */ 20686 size: function() { 20687 return this._q.length; 20688 } 20689}; 20690 20691Y.Queue = Queue; 20692 20693YUI.Env._loaderQueue = YUI.Env._loaderQueue || new Queue(); 20694 20695/** 20696The YUI module contains the components required for building the YUI seed file. 20697This includes the script loading mechanism, a simple queue, and the core 20698utilities for the library. 20699 20700@module yui 20701@submodule yui-base 20702**/ 20703 20704var CACHED_DELIMITER = '__', 20705 20706 hasOwn = Object.prototype.hasOwnProperty, 20707 isObject = Y.Lang.isObject; 20708 20709/** 20710Returns a wrapper for a function which caches the return value of that function, 20711keyed off of the combined string representation of the argument values provided 20712when the wrapper is called. 20713 20714Calling this function again with the same arguments will return the cached value 20715rather than executing the wrapped function. 20716 20717Note that since the cache is keyed off of the string representation of arguments 20718passed to the wrapper function, arguments that aren't strings and don't provide 20719a meaningful `toString()` method may result in unexpected caching behavior. For 20720example, the objects `{}` and `{foo: 'bar'}` would both be converted to the 20721string `[object Object]` when used as a cache key. 20722 20723@method cached 20724@param {Function} source The function to memoize. 20725@param {Object} [cache={}] Object in which to store cached values. You may seed 20726 this object with pre-existing cached values if desired. 20727@param {any} [refetch] If supplied, this value is compared with the cached value 20728 using a `==` comparison. If the values are equal, the wrapped function is 20729 executed again even though a cached value exists. 20730@return {Function} Wrapped function. 20731@for YUI
20732**/ 20733Y.cached = function (source, cache, refetch) { 20734 /*jshint expr: true*/ 20735 cache || (cache = {}); 20736 20737 return function (arg) { 20738 var key = arguments.length > 1 ? 20739 Array.prototype.join.call(arguments, CACHED_DELIMITER) : 20740 String(arg); 20741 20742 /*jshint eqeqeq: false*/ 20743 if (!(key in cache) || (refetch && cache[key] == refetch)) { 20744 cache[key] = source.apply(source, arguments); 20745 } 20746 20747 return cache[key]; 20748 }; 20749}; 20750 20751/** 20752Returns the `location` object from the window/frame in which this YUI instance 20753operates, or `undefined` when executing in a non-browser environment 20754(e.g. Node.js). 20755 20756It is _not_ recommended to hold references to the `window.location` object 20757outside of the scope of a function in which its properties are being accessed or 20758its methods are being called. This is because of a nasty bug/issue that exists 20759in both Safari and MobileSafari browsers: 20760[WebKit Bug 34679](https://bugs.webkit.org/show_bug.cgi?id=34679). 20761 20762@method getLocation 20763@return {location} The `location` object from the window/frame in which this YUI 20764 instance operates. 20765@since 3.5.0 20766**/ 20767Y.getLocation = function () { 20768 // It is safer to look this up every time because yui-base is attached to a 20769 // YUI instance before a user's config is applied; i.e. `Y.config.win` does 20770 // not point the correct window object when this file is loaded. 20771 var win = Y.config.win; 20772 20773 // It is not safe to hold a reference to the `location` object outside the 20774 // scope in which it is being used. The WebKit engine used in Safari and 20775 // MobileSafari will "disconnect" the `location` object from the `window` 20776 // when a page is restored from back/forward history cache. 20777 return win && win.location; 20778}; 20779 20780/** 20781Returns a new object containing all of the properties of all the supplied 20782objects. The properties from later objects will overwrite those in earlier 20783objects. 20784 20785Passing in a single object will create a shallow copy of it. For a deep copy, 20786use `clone()`. 20787 20788@method merge 20789@param {Object} objects* One or more objects to merge. 20790@return {Object} A new merged object. 20791**/ 20792Y.merge = function () { 20793 var i = 0, 20794 len = arguments.length, 20795 result = {}, 20796 key, 20797 obj; 20798 20799 for (; i < len; ++i) { 20800 obj = arguments[i]; 20801 20802 for (key in obj) { 20803 if (hasOwn.call(obj, key)) { 20804 result[key] = obj[key]; 20805 } 20806 } 20807 } 20808 20809 return result; 20810}; 20811 20812/** 20813Mixes _supplier_'s properties into _receiver_. 20814 20815Properties on _receiver_ or _receiver_'s prototype will not be overwritten or 20816shadowed unless the _overwrite_ parameter is `true`, and will not be merged 20817unless the _merge_ parameter is `true`. 20818 20819In the default mode (0), only properties the supplier owns are copied (prototype 20820properties are not copied). The following copying modes are available: 20821 20822 * `0`: _Default_. Object to object. 20823 * `1`: Prototype to prototype. 20824 * `2`: Prototype to prototype and object to object. 20825 * `3`: Prototype to object. 20826 * `4`: Object to prototype. 20827 20828@method mix 20829@param {Function|Object} receiver The object or function to receive the mixed 20830 properties. 20831@param {Function|Object} supplier The object or function supplying the 20832 properties to be mixed. 20833@param {Boolean} [overwrite=false] If `true`, properties that already exist 20834 on the receiver will be overwritten with properties from the supplier. 20835@param {String[]} [whitelist] An array of property names to copy. If 20836 specified, only the whitelisted properties will be copied, and all others 20837 will be ignored. 20838@param {Number} [mode=0] Mix mode to use. See above for available modes. 20839@param {Boolean} [merge=false] If `true`, objects and arrays that already 20840 exist on the receiver will have the corresponding object/array from the 20841 supplier merged into them, rather than being skipped or overwritten. When 20842 both _overwrite_ and _merge_ are `true`, _merge_ takes precedence. 20843@return {Function|Object|YUI} The receiver, or the YUI instance if the 20844 specified receiver is falsy. 20845**/ 20846Y.mix = function(receiver, supplier, overwrite, whitelist, mode, merge) { 20847 var alwaysOverwrite, exists, from, i, key, len, to; 20848 20849 // If no supplier is given, we return the receiver. If no receiver is given, 20850 // we return Y. Returning Y doesn't make much sense to me, but it's 20851 // grandfathered in for backcompat reasons. 20852 if (!receiver || !supplier) { 20853 return receiver || Y; 20854 } 20855 20856 if (mode) { 20857 // In mode 2 (prototype to prototype and object to object), we recurse 20858 // once to do the proto to proto mix. The object to object mix will be 20859 // handled later on. 20860 if (mode === 2) { 20861 Y.mix(receiver.prototype, supplier.prototype, overwrite, 20862 whitelist, 0, merge); 20863 } 20864 20865 // Depending on which mode is specified, we may be copying from or to 20866 // the prototypes of the supplier and receiver. 20867 from = mode === 1 || mode === 3 ? supplier.prototype : supplier; 20868 to = mode === 1 || mode === 4 ? receiver.prototype : receiver; 20869 20870 // If either the supplier or receiver doesn't actually have a 20871 // prototype property, then we could end up with an undefined `from` 20872 // or `to`. If that happens, we abort and return the receiver. 20873 if (!from || !to) { 20874 return receiver; 20875 } 20876 } else { 20877 from = supplier; 20878 to = receiver; 20879 } 20880 20881 // If `overwrite` is truthy and `merge` is falsy, then we can skip a 20882 // property existence check on each iteration and save some time. 20883 alwaysOverwrite = overwrite && !merge; 20884 20885 if (whitelist) { 20886 for (i = 0, len = whitelist.length; i < len; ++i) { 20887 key = whitelist[i]; 20888 20889 // We call `Object.prototype.hasOwnProperty` instead of calling 20890 // `hasOwnProperty` on the object itself, since the object's 20891 // `hasOwnProperty` method may have been overridden or removed. 20892 // Also, some native objects don't implement a `hasOwnProperty` 20893 // method. 20894 if (!hasOwn.call(from, key)) { 20895 continue; 20896 } 20897 20898 // The `key in to` check here is (sadly) intentional for backwards 20899 // compatibility reasons. It prevents undesired shadowing of 20900 // prototype members on `to`. 20901 exists = alwaysOverwrite ? false : key in to; 20902 20903 if (merge && exists && isObject(to[key], true) 20904 && isObject(from[key], true)) { 20905 // If we're in merge mode, and the key is present on both 20906 // objects, and the value on both objects is either an object or 20907 // an array (but not a function), then we recurse to merge the 20908 // `from` value into the `to` value instead of overwriting it. 20909 // 20910 // Note: It's intentional that the whitelist isn't passed to the 20911 // recursive call here. This is legacy behavior that lots of 20912 // code still depends on. 20913 Y.mix(to[key], from[key], overwrite, null, 0, merge); 20914 } else if (overwrite || !exists) { 20915 // We're not in merge mode, so we'll only copy the `from` value 20916 // to the `to` value if we're in overwrite mode or if the 20917 // current key doesn't exist on the `to` object. 20918 to[key] = from[key]; 20919 } 20920 } 20921 } else { 20922 for (key in from) { 20923 // The code duplication here is for runtime performance reasons. 20924 // Combining whitelist and non-whitelist operations into a single 20925 // loop or breaking the shared logic out into a function both result 20926 // in worse performance, and Y.mix is critical enough that the byte 20927 // tradeoff is worth it. 20928 if (!hasOwn.call(from, key)) { 20929 continue; 20930 } 20931 20932 // The `key in to` check here is (sadly) intentional for backwards 20933 // compatibility reasons. It prevents undesired shadowing of 20934 // prototype members on `to`. 20935 exists = alwaysOverwrite ? false : key in to; 20936 20937 if (merge && exists && isObject(to[key], true) 20938 && isObject(from[key], true)) { 20939 Y.mix(to[key], from[key], overwrite, null, 0, merge); 20940 } else if (overwrite || !exists) { 20941 to[key] = from[key]; 20942 } 20943 } 20944 20945 // If this is an IE browser with the JScript enumeration bug, force 20946 // enumeration of the buggy properties by making a recursive call with 20947 // the buggy properties as the whitelist. 20948 if (Y.Object._hasEnumBug) { 20949 Y.mix(to, from, overwrite, Y.Object._forceEnum, mode, merge); 20950 } 20951 } 20952 20953 return receiver; 20954}; 20955/** 20956 * The YUI module contains the components required for building the YUI 20957 * seed file. This includes the script loading mechanism, a simple queue, 20958 * and the core utilities for the library. 20959 * @module yui 20960 * @submodule yui-base 20961 */ 20962 20963/** 20964 * Adds utilities to the YUI instance for working with objects. 20965 * 20966 * @class Object 20967 */ 20968 20969var Lang = Y.Lang, 20970 hasOwn = Object.prototype.hasOwnProperty, 20971 20972 UNDEFINED, // <-- Note the comma. We're still declaring vars. 20973 20974/** 20975 * Returns a new object that uses _obj_ as its prototype. This method wraps the 20976 * native ES5 `Object.create()` method if available, but doesn't currently 20977 * pass through `Object.create()`'s second argument (properties) in order to 20978 * ensure compatibility with older browsers. 20979 * 20980 * @method () 20981 * @param {Object} obj Prototype object. 20982 * @return {Object} New object using _obj_ as its prototype. 20983 * @static 20984 */ 20985O = Y.Object = Lang._isNative(Object.create) ? function (obj) { 20986 // We currently wrap the native Object.create instead of simply aliasing it 20987 // to ensure consistency with our fallback shim, which currently doesn't 20988 // support Object.create()'s second argument (properties). Once we have a 20989 // safe fallback for the properties arg, we can stop wrapping 20990 // Object.create(). 20991 return Object.create(obj); 20992} : (function () { 20993 // Reusable constructor function for the Object.create() shim. 20994 function F() {} 20995 20996 // The actual shim. 20997 return function (obj) { 20998 F.prototype = obj; 20999 return new F(); 21000 }; 21001}()), 21002 21003/** 21004 * Property names that IE doesn't enumerate in for..in loops, even when they 21005 * should be enumerable. When `_hasEnumBug` is `true`, it's necessary to 21006 * manually enumerate these properties. 21007 * 21008 * @property _forceEnum
21009 * @type String[] 21010 * @protected 21011 * @static 21012 */ 21013forceEnum = O._forceEnum = [ 21014 'hasOwnProperty', 21015 'isPrototypeOf', 21016 'propertyIsEnumerable', 21017 'toString', 21018 'toLocaleString', 21019 'valueOf' 21020], 21021 21022/** 21023 * `true` if this browser has the JScript enumeration bug that prevents 21024 * enumeration of the properties named in the `_forceEnum` array, `false` 21025 * otherwise. 21026 * 21027 * See: 21028 * - <https://developer.mozilla.org/en/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug> 21029 * - <http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation> 21030 * 21031 * @property _hasEnumBug 21032 * @type Boolean 21033 * @protected 21034 * @static 21035 */ 21036hasEnumBug = O._hasEnumBug = !{valueOf: 0}.propertyIsEnumerable('valueOf'), 21037 21038/** 21039 * `true` if this browser incorrectly considers the `prototype` property of 21040 * functions to be enumerable. Currently known to affect Opera 11.50 and Android 2.3.x. 21041 * 21042 * @property _hasProtoEnumBug 21043 * @type Boolean 21044 * @protected 21045 * @static 21046 */ 21047hasProtoEnumBug = O._hasProtoEnumBug = (function () {}).propertyIsEnumerable('prototype'), 21048 21049/** 21050 * Returns `true` if _key_ exists on _obj_, `false` if _key_ doesn't exist or 21051 * exists only on _obj_'s prototype. This is essentially a safer version of 21052 * `obj.hasOwnProperty()`. 21053 * 21054 * @method owns 21055 * @param {Object} obj Object to test. 21056 * @param {String} key Property name to look for. 21057 * @return {Boolean} `true` if _key_ exists on _obj_, `false` otherwise. 21058 * @static 21059 */ 21060owns = O.owns = function (obj, key) { 21061 return !!obj && hasOwn.call(obj, key); 21062}; // <-- End of var declarations. 21063 21064/** 21065 * Alias for `owns()`. 21066 * 21067 * @method hasKey 21068 * @param {Object} obj Object to test. 21069 * @param {String} key Property name to look for. 21070 * @return {Boolean} `true` if _key_ exists on _obj_, `false` otherwise. 21071 * @static 21072 */ 21073O.hasKey = owns; 21074 21075/** 21076 * Returns an array containing the object's enumerable keys. Does not include 21077 * prototype keys or non-enumerable keys. 21078 * 21079 * Note that keys are returned in enumeration order (that is, in the same order 21080 * that they would be enumerated by a `for-in` loop), which may not be the same 21081 * as the order in which they were defined. 21082 * 21083 * This method is an alias for the native ES5 `Object.keys()` method if 21084 * available and non-buggy. The Opera 11.50 and Android 2.3.x versions of 21085 * `Object.keys()` have an inconsistency as they consider `prototype` to be 21086 * enumerable, so a non-native shim is used to rectify the difference. 21087 * 21088 * @example 21089 * 21090 * Y.Object.keys({a: 'foo', b: 'bar', c: 'baz'}); 21091 * // => ['a', 'b', 'c'] 21092 * 21093 * @method keys 21094 * @param {Object} obj An object. 21095 * @return {String[]} Array of keys. 21096 * @static 21097 */ 21098O.keys = Lang._isNative(Object.keys) && !hasProtoEnumBug ? Object.keys : function (obj) { 21099 if (!Lang.isObject(obj)) { 21100 throw new TypeError('Object.keys called on a non-object'); 21101 } 21102 21103 var keys = [], 21104 i, key, len; 21105 21106 if (hasProtoEnumBug && typeof obj === 'function') { 21107 for (key in obj) { 21108 if (owns(obj, key) && key !== 'prototype') { 21109 keys.push(key); 21110 } 21111 } 21112 } else { 21113 for (key in obj) { 21114 if (owns(obj, key)) { 21115 keys.push(key); 21116 } 21117 } 21118 } 21119 21120 if (hasEnumBug) { 21121 for (i = 0, len = forceEnum.length; i < len; ++i) { 21122 key = forceEnum[i]; 21123 21124 if (owns(obj, key)) { 21125 keys.push(key); 21126 } 21127 } 21128 } 21129 21130 return keys; 21131}; 21132 21133/** 21134 * Returns an array containing the values of the object's enumerable keys. 21135 * 21136 * Note that values are returned in enumeration order (that is, in the same 21137 * order that they would be enumerated by a `for-in` loop), which may not be the 21138 * same as the order in which they were defined. 21139 * 21140 * @example 21141 * 21142 * Y.Object.values({a: 'foo', b: 'bar', c: 'baz'}); 21143 * // => ['foo', 'bar', 'baz'] 21144 * 21145 * @method values 21146 * @param {Object} obj An object. 21147 * @return {Array} Array of values. 21148 * @static 21149 */ 21150O.values = function (obj) { 21151 var keys = O.keys(obj), 21152 i = 0, 21153 len = keys.length, 21154 values = []; 21155 21156 for (; i < len; ++i) { 21157 values.push(obj[keys[i]]); 21158 } 21159 21160 return values; 21161}; 21162 21163/** 21164 * Returns the number of enumerable keys owned by an object. 21165 * 21166 * @method size 21167 * @param {Object} obj An object. 21168 * @return {Number} The object's size. 21169 * @static 21170 */ 21171O.size = function (obj) { 21172 try { 21173 return O.keys(obj).length; 21174 } catch (ex) { 21175 return 0; // Legacy behavior for non-objects. 21176 } 21177}; 21178 21179/** 21180 * Returns `true` if the object owns an enumerable property with the specified 21181 * value. 21182 * 21183 * @method hasValue 21184 * @param {Object} obj An object. 21185 * @param {any} value The value to search for. 21186 * @return {Boolean} `true` if _obj_ contains _value_, `false` otherwise. 21187 * @static 21188 */ 21189O.hasValue = function (obj, value) { 21190 return Y.Array.indexOf(O.values(obj), value) > -1; 21191}; 21192 21193/** 21194 * Executes a function on each enumerable property in _obj_. The function 21195 * receives the value, the key, and the object itself as parameters (in that 21196 * order). 21197 * 21198 * By default, only properties owned by _obj_ are enumerated. To include 21199 * prototype properties, set the _proto_ parameter to `true`. 21200 * 21201 * @method each 21202 * @param {Object} obj Object to enumerate. 21203 * @param {Function} fn Function to execute on each enumerable property. 21204 * @param {mixed} fn.value Value of the current property. 21205 * @param {String} fn.key Key of the current property. 21206 * @param {Object} fn.obj Object being enumerated. 21207 * @param {Object} [thisObj] `this` object to use when calling _fn_. 21208 * @param {Boolean} [proto=false] Include prototype properties. 21209 * @return {YUI} the YUI instance. 21210 * @chainable
21211 * @static 21212 */ 21213O.each = function (obj, fn, thisObj, proto) { 21214 var key; 21215 21216 for (key in obj) { 21217 if (proto || owns(obj, key)) { 21218 fn.call(thisObj || Y, obj[key], key, obj); 21219 } 21220 } 21221 21222 return Y; 21223}; 21224 21225/** 21226 * Executes a function on each enumerable property in _obj_, but halts if the 21227 * function returns a truthy value. The function receives the value, the key, 21228 * and the object itself as paramters (in that order). 21229 * 21230 * By default, only properties owned by _obj_ are enumerated. To include 21231 * prototype properties, set the _proto_ parameter to `true`. 21232 * 21233 * @method some 21234 * @param {Object} obj Object to enumerate. 21235 * @param {Function} fn Function to execute on each enumerable property. 21236 * @param {mixed} fn.value Value of the current property. 21237 * @param {String} fn.key Key of the current property. 21238 * @param {Object} fn.obj Object being enumerated. 21239 * @param {Object} [thisObj] `this` object to use when calling _fn_. 21240 * @param {Boolean} [proto=false] Include prototype properties. 21241 * @return {Boolean} `true` if any execution of _fn_ returns a truthy value, 21242 * `false` otherwise. 21243 * @static 21244 */ 21245O.some = function (obj, fn, thisObj, proto) { 21246 var key; 21247 21248 for (key in obj) { 21249 if (proto || owns(obj, key)) { 21250 if (fn.call(thisObj || Y, obj[key], key, obj)) { 21251 return true; 21252 } 21253 } 21254 } 21255 21256 return false; 21257}; 21258 21259/** 21260 * Retrieves the sub value at the provided path, 21261 * from the value object provided. 21262 * 21263 * @method getValue 21264 * @static 21265 * @param o The object from which to extract the property value. 21266 * @param path {Array} A path array, specifying the object traversal path 21267 * from which to obtain the sub value. 21268 * @return {Any} The value stored in the path, undefined if not found, 21269 * undefined if the source is not an object. Returns the source object 21270 * if an empty path is provided. 21271 */ 21272O.getValue = function(o, path) { 21273 if (!Lang.isObject(o)) { 21274 return UNDEFINED; 21275 } 21276 21277 var i, 21278 p = Y.Array(path), 21279 l = p.length; 21280 21281 for (i = 0; o !== UNDEFINED && i < l; i++) { 21282 o = o[p[i]]; 21283 } 21284 21285 return o; 21286}; 21287 21288/** 21289 * Sets the sub-attribute value at the provided path on the 21290 * value object. Returns the modified value object, or 21291 * undefined if the path is invalid. 21292 * 21293 * @method setValue 21294 * @static 21295 * @param o The object on which to set the sub value. 21296 * @param path {Array} A path array, specifying the object traversal path 21297 * at which to set the sub value. 21298 * @param val {Any} The new value for the sub-attribute. 21299 * @return {Object} The modified object, with the new sub value set, or 21300 * undefined, if the path was invalid. 21301 */ 21302O.setValue = function(o, path, val) { 21303 var i, 21304 p = Y.Array(path), 21305 leafIdx = p.length - 1, 21306 ref = o; 21307 21308 if (leafIdx >= 0) { 21309 for (i = 0; ref !== UNDEFINED && i < leafIdx; i++) { 21310 ref = ref[p[i]]; 21311 } 21312 21313 if (ref !== UNDEFINED) { 21314 ref[p[i]] = val; 21315 } else { 21316 return UNDEFINED; 21317 } 21318 } 21319 21320 return o; 21321}; 21322 21323/** 21324 * Returns `true` if the object has no enumerable properties of its own. 21325 * 21326 * @method isEmpty 21327 * @param {Object} obj An object. 21328 * @return {Boolean} `true` if the object is empty. 21329 * @static 21330 * @since 3.2.0 21331 */ 21332O.isEmpty = function (obj) { 21333 return !O.keys(Object(obj)).length; 21334}; 21335/** 21336 * The YUI module contains the components required for building the YUI seed 21337 * file. This includes the script loading mechanism, a simple queue, and the 21338 * core utilities for the library. 21339 * @module yui 21340 * @submodule yui-base 21341 */ 21342 21343/** 21344 * YUI user agent detection. 21345 * Do not fork for a browser if it can be avoided. Use feature detection when 21346 * you can. Use the user agent as a last resort. For all fields listed 21347 * as @type float, UA stores a version number for the browser engine, 21348 * 0 otherwise. This value may or may not map to the version number of 21349 * the browser using the engine. The value is presented as a float so 21350 * that it can easily be used for boolean evaluation as well as for 21351 * looking for a particular range of versions. Because of this, 21352 * some of the granularity of the version info may be lost. The fields that 21353 * are @type string default to null. The API docs list the values that 21354 * these fields can have. 21355 * @class UA 21356 * @static 21357 */ 21358 21359/** 21360* Static method on `YUI.Env` for parsing a UA string. Called at instantiation 21361* to populate `Y.UA`. 21362* 21363* @static 21364* @method parseUA 21365* @param {String} [subUA=navigator.userAgent] UA string to parse 21366* @return {Object} The Y.UA object 21367*/ 21368YUI.Env.parseUA = function(subUA) { 21369 21370 var numberify = function(s) { 21371 var c = 0; 21372 return parseFloat(s.replace(/\./g, function() { 21373 return (c++ === 1) ? '' : '.'; 21374 })); 21375 }, 21376 21377 win = Y.config.win, 21378 21379 nav = win && win.navigator, 21380 21381 o = { 21382 21383 /** 21384 * Internet Explorer version number or 0. Example: 6 21385 * @property ie 21386 * @type float 21387 * @static 21388 */ 21389 ie: 0, 21390 21391 /** 21392 * Opera version number or 0. Example: 9.2 21393 * @property opera 21394 * @type float 21395 * @static 21396 */ 21397 opera: 0, 21398 21399 /** 21400 * Gecko engine revision number. Will evaluate to 1 if Gecko 21401 * is detected but the revision could not be found. Other browsers 21402 * will be 0. Example: 1.8 21403 * <pre> 21404 * Firefox 1.0.0.4: 1.7.8 <-- Reports 1.7 21405 * Firefox 1.5.0.9: 1.8.0.9 <-- 1.8 21406 * Firefox 2.0.0.3: 1.8.1.3 <-- 1.81 21407 * Firefox 3.0 <-- 1.9 21408 * Firefox 3.5 <-- 1.91 21409 * </pre> 21410 * @property gecko 21411 * @type float 21412 * @static 21413 */ 21414 gecko: 0, 21415 21416 /** 21417 * AppleWebKit version. KHTML browsers that are not WebKit browsers 21418 * will evaluate to 1, other browsers 0. Example: 418.9 21419 * <pre> 21420 * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the 21421 * latest available for Mac OSX 10.3. 21422 * Safari 2.0.2: 416 <-- hasOwnProperty introduced 21423 * Safari 2.0.4: 418 <-- preventDefault fixed 21424 * Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run 21425 * different versions of webkit 21426 * Safari 2.0.4 (419.3): 419 <-- Tiger installations that have been 21427 * updated, but not updated 21428 * to the latest patch. 21429 * Webkit 212 nightly: 522+ <-- Safari 3.0 precursor (with native 21430 * SVG and many major issues fixed). 21431 * Safari 3.0.4 (523.12) 523.12 <-- First Tiger release - automatic 21432 * update from 2.x via the 10.4.11 OS patch. 21433 * Webkit nightly 1/2008:525+ <-- Supports DOMContentLoaded event. 21434 * yahoo.com user agent hack removed. 21435 * </pre> 21436 * http://en.wikipedia.org/wiki/Safari_version_history 21437 * @property webkit 21438 * @type float 21439 * @static 21440 */ 21441 webkit: 0, 21442 21443 /** 21444 * Safari will be detected as webkit, but this property will also 21445 * be populated with the Safari version number 21446 * @property safari 21447 * @type float 21448 * @static 21449 */ 21450 safari: 0, 21451 21452 /** 21453 * Chrome will be detected as webkit, but this property will also 21454 * be populated with the Chrome version number 21455 * @property chrome 21456 * @type float 21457 * @static 21458 */ 21459 chrome: 0, 21460 21461 /** 21462 * The mobile property will be set to a string containing any relevant 21463 * user agent information when a modern mobile browser is detected. 21464 * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series 21465 * devices with the WebKit-based browser, and Opera Mini. 21466 * @property mobile 21467 * @type string 21468 * @default null 21469 * @static 21470 */ 21471 mobile: null, 21472 21473 /** 21474 * Adobe AIR version number or 0. Only populated if webkit is detected. 21475 * Example: 1.0 21476 * @property air 21477 * @type float 21478 */ 21479 air: 0, 21480 /** 21481 * PhantomJS version number or 0. Only populated if webkit is detected. 21482 * Example: 1.0 21483 * @property phantomjs 21484 * @type float 21485 */ 21486 phantomjs: 0, 21487 /** 21488 * Detects Apple iPad's OS version 21489 * @property ipad 21490 * @type float 21491 * @static 21492 */ 21493 ipad: 0, 21494 /** 21495 * Detects Apple iPhone's OS version 21496 * @property iphone 21497 * @type float 21498 * @static 21499 */ 21500 iphone: 0, 21501 /** 21502 * Detects Apples iPod's OS version 21503 * @property ipod 21504 * @type float 21505 * @static 21506 */ 21507 ipod: 0, 21508 /** 21509 * General truthy check for iPad, iPhone or iPod 21510 * @property ios 21511 * @type Boolean 21512 * @default null 21513 * @static 21514 */ 21515 ios: null, 21516 /** 21517 * Detects Googles Android OS version 21518 * @property android 21519 * @type float 21520 * @static 21521 */ 21522 android: 0, 21523 /** 21524 * Detects Kindle Silk 21525 * @property silk 21526 * @type float 21527 * @static 21528 */ 21529 silk: 0, 21530 /** 21531 * Detects Ubuntu version 21532 * @property ubuntu 21533 * @type float 21534 * @static 21535 */ 21536 ubuntu: 0, 21537 /** 21538 * Detects Kindle Silk Acceleration 21539 * @property accel 21540 * @type Boolean 21541 * @static 21542 */ 21543 accel: false, 21544 /** 21545 * Detects Palms WebOS version 21546 * @property webos 21547 * @type float 21548 * @static 21549 */ 21550 webos: 0, 21551 21552 /** 21553 * Google Caja version number or 0. 21554 * @property caja 21555 * @type float 21556 */ 21557 caja: nav && nav.cajaVersion, 21558 21559 /** 21560 * Set to true if the page appears to be in SSL 21561 * @property secure 21562 * @type boolean 21563 * @static 21564 */ 21565 secure: false, 21566 21567 /** 21568 * The operating system. 21569 * 21570 * Possible values are `windows`, `macintosh`, `android`, `symbos`, `linux`, `rhino` and `ios`. 21571 * 21572 * @property os 21573 * @type string 21574 * @default null 21575 * @static 21576 */ 21577 os: null, 21578 21579 /** 21580 * The Nodejs Version 21581 * @property nodejs 21582 * @type float 21583 * @default 0 21584 * @static 21585 */ 21586 nodejs: 0, 21587 /** 21588 * Window8/IE10 Application host environment 21589 * @property winjs 21590 * @type Boolean 21591 * @static 21592 */ 21593 winjs: !!((typeof Windows !== "undefined") && Windows.System), 21594 /** 21595 * Are touch/msPointer events available on this device 21596 * @property touchEnabled 21597 * @type Boolean 21598 * @static 21599 */ 21600 touchEnabled: false 21601 }, 21602 21603 ua = subUA || nav && nav.userAgent, 21604 21605 loc = win && win.location, 21606 21607 href = loc && loc.href, 21608 21609 m; 21610 21611 /** 21612 * The User Agent string that was parsed 21613 * @property userAgent
21614 * @type String 21615 * @static 21616 */ 21617 o.userAgent = ua; 21618 21619 21620 o.secure = href && (href.toLowerCase().indexOf('https') === 0); 21621 21622 if (ua) { 21623 21624 if ((/windows|win32/i).test(ua)) { 21625 o.os = 'windows'; 21626 } else if ((/macintosh|mac_powerpc/i).test(ua)) { 21627 o.os = 'macintosh'; 21628 } else if ((/android/i).test(ua)) { 21629 o.os = 'android'; 21630 } else if ((/symbos/i).test(ua)) { 21631 o.os = 'symbos'; 21632 } else if ((/linux/i).test(ua)) { 21633 o.os = 'linux'; 21634 } else if ((/rhino/i).test(ua)) { 21635 o.os = 'rhino'; 21636 } 21637 21638 // Modern KHTML browsers should qualify as Safari X-Grade 21639 if ((/KHTML/).test(ua)) { 21640 o.webkit = 1; 21641 } 21642 if ((/IEMobile|XBLWP7/).test(ua)) { 21643 o.mobile = 'windows'; 21644 } 21645 if ((/Fennec/).test(ua)) { 21646 o.mobile = 'gecko'; 21647 } 21648 // Modern WebKit browsers are at least X-Grade 21649 m = ua.match(/AppleWebKit\/([^\s]*)/); 21650 if (m && m[1]) { 21651 o.webkit = numberify(m[1]); 21652 o.safari = o.webkit; 21653 21654 if (/PhantomJS/.test(ua)) { 21655 m = ua.match(/PhantomJS\/([^\s]*)/); 21656 if (m && m[1]) { 21657 o.phantomjs = numberify(m[1]); 21658 } 21659 } 21660 21661 // Mobile browser check 21662 if (/ Mobile\//.test(ua) || (/iPad|iPod|iPhone/).test(ua)) { 21663 o.mobile = 'Apple'; // iPhone or iPod Touch 21664 21665 m = ua.match(/OS ([^\s]*)/); 21666 if (m && m[1]) { 21667 m = numberify(m[1].replace('_', '.')); 21668 } 21669 o.ios = m; 21670 o.os = 'ios'; 21671 o.ipad = o.ipod = o.iphone = 0; 21672 21673 m = ua.match(/iPad|iPod|iPhone/); 21674 if (m && m[0]) { 21675 o[m[0].toLowerCase()] = o.ios; 21676 } 21677 } else { 21678 m = ua.match(/NokiaN[^\/]*|webOS\/\d\.\d/); 21679 if (m) { 21680 // Nokia N-series, webOS, ex: NokiaN95 21681 o.mobile = m[0]; 21682 } 21683 if (/webOS/.test(ua)) { 21684 o.mobile = 'WebOS'; 21685 m = ua.match(/webOS\/([^\s]*);/); 21686 if (m && m[1]) { 21687 o.webos = numberify(m[1]); 21688 } 21689 } 21690 if (/ Android/.test(ua)) { 21691 o.mobile = 'Android'; 21692 m = ua.match(/Android ([^\s]*);/); 21693 if (m && m[1]) { 21694 o.android = numberify(m[1]); 21695 } 21696 21697 } 21698 if (/Silk/.test(ua)) { 21699 m = ua.match(/Silk\/([^\s]*)/); 21700 if (m && m[1]) { 21701 o.silk = numberify(m[1]); 21702 } 21703 if (!o.android) { 21704 o.android = 2.34; //Hack for desktop mode in Kindle 21705 o.os = 'Android'; 21706 } 21707 if (/Accelerated=true/.test(ua)) { 21708 o.accel = true; 21709 } 21710 } 21711 } 21712 21713 m = ua.match(/OPR\/(\d+\.\d+)/); 21714 21715 if (m && m[1]) { 21716 // Opera 15+ with Blink (pretends to be both Chrome and Safari) 21717 o.opera = numberify(m[1]); 21718 } else { 21719 m = ua.match(/(Chrome|CrMo|CriOS)\/([^\s]*)/); 21720 21721 if (m && m[1] && m[2]) { 21722 o.chrome = numberify(m[2]); // Chrome 21723 o.safari = 0; //Reset safari back to 0 21724 if (m[1] === 'CrMo') { 21725 o.mobile = 'chrome'; 21726 } 21727 } else { 21728 m = ua.match(/AdobeAIR\/([^\s]*)/); 21729 if (m) { 21730 o.air = m[0]; // Adobe AIR 1.0 or better 21731 } 21732 } 21733 } 21734 } 21735 21736 m = ua.match(/Ubuntu\ (\d+\.\d+)/); 21737 if (m && m[1]) { 21738 21739 o.os = 'linux'; 21740 o.ubuntu = numberify(m[1]); 21741 21742 m = ua.match(/\ WebKit\/([^\s]*)/); 21743 if (m && m[1]) { 21744 o.webkit = numberify(m[1]); 21745 } 21746 m = ua.match(/\ Chromium\/([^\s]*)/); 21747 if (m && m[1]) { 21748 o.chrome = numberify(m[1]); 21749 } 21750 if (/ Mobile$/.test(ua)) { 21751 o.mobile = 'Ubuntu'; 21752 } 21753 } 21754 21755 if (!o.webkit) { // not webkit 21756// @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr) 21757 if (/Opera/.test(ua)) { 21758 m = ua.match(/Opera[\s\/]([^\s]*)/); 21759 if (m && m[1]) { 21760 o.opera = numberify(m[1]); 21761 } 21762 m = ua.match(/Version\/([^\s]*)/); 21763 if (m && m[1]) { 21764 o.opera = numberify(m[1]); // opera 10+ 21765 } 21766 21767 if (/Opera Mobi/.test(ua)) { 21768 o.mobile = 'opera'; 21769 m = ua.replace('Opera Mobi', '').match(/Opera ([^\s]*)/); 21770 if (m && m[1]) { 21771 o.opera = numberify(m[1]); 21772 } 21773 } 21774 m = ua.match(/Opera Mini[^;]*/); 21775 21776 if (m) { 21777 o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316 21778 } 21779 } else { // not opera or webkit 21780 m = ua.match(/MSIE ([^;]*)|Trident.*; rv:([0-9.]+)/); 21781 21782 if (m && (m[1] || m[2])) { 21783 o.ie = numberify(m[1] || m[2]); 21784 } else { // not opera, webkit, or ie 21785 m = ua.match(/Gecko\/([^\s]*)/); 21786 21787 if (m) { 21788 o.gecko = 1; // Gecko detected, look for revision 21789 m = ua.match(/rv:([^\s\)]*)/); 21790 if (m && m[1]) { 21791 o.gecko = numberify(m[1]); 21792 if (/Mobile|Tablet/.test(ua)) { 21793 o.mobile = "ffos"; 21794 } 21795 } 21796 } 21797 } 21798 } 21799 } 21800 } 21801 21802 //Check for known properties to tell if touch events are enabled on this device or if 21803 //the number of MSPointer touchpoints on this device is greater than 0. 21804 if (win && nav && !(o.chrome && o.chrome < 6)) { 21805 o.touchEnabled = (("ontouchstart" in win) || (("msMaxTouchPoints" in nav) && (nav.msMaxTouchPoints > 0))); 21806 } 21807 21808 //It was a parsed UA, do not assign the global value. 21809 if (!subUA) { 21810 21811 if (typeof process === 'object') { 21812 21813 if (process.versions && process.versions.node) { 21814 //NodeJS 21815 o.os = process.platform; 21816 o.nodejs = numberify(process.versions.node); 21817 } 21818 } 21819 21820 YUI.Env.UA = o; 21821 21822 } 21823 21824 return o; 21825}; 21826 21827 21828Y.UA = YUI.Env.UA || YUI.Env.parseUA(); 21829 21830/**
21831Performs a simple comparison between two version numbers, accounting for 21832standard versioning logic such as the fact that "535.8" is a lower version than 21833"535.24", even though a simple numerical comparison would indicate that it's 21834greater. Also accounts for cases such as "1.1" vs. "1.1.0", which are 21835considered equivalent. 21836 21837Returns -1 if version _a_ is lower than version _b_, 0 if they're equivalent, 218381 if _a_ is higher than _b_. 21839 21840Versions may be numbers or strings containing numbers and dots. For example, 21841both `535` and `"535.8.10"` are acceptable. A version string containing 21842non-numeric characters, like `"535.8.beta"`, may produce unexpected results. 21843 21844@method compareVersions 21845@param {Number|String} a First version number to compare. 21846@param {Number|String} b Second version number to compare. 21847@return -1 if _a_ is lower than _b_, 0 if they're equivalent, 1 if _a_ is 21848 higher than _b_. 21849**/ 21850Y.UA.compareVersions = function (a, b) { 21851 var aPart, aParts, bPart, bParts, i, len; 21852 21853 if (a === b) { 21854 return 0; 21855 } 21856 21857 aParts = (a + '').split('.'); 21858 bParts = (b + '').split('.'); 21859 21860 for (i = 0, len = Math.max(aParts.length, bParts.length); i < len; ++i) { 21861 aPart = parseInt(aParts[i], 10); 21862 bPart = parseInt(bParts[i], 10); 21863 21864 /*jshint expr: true*/ 21865 isNaN(aPart) && (aPart = 0); 21866 isNaN(bPart) && (bPart = 0); 21867 21868 if (aPart < bPart) { 21869 return -1; 21870 } 21871 21872 if (aPart > bPart) { 21873 return 1; 21874 } 21875 } 21876 21877 return 0; 21878}; 21879YUI.Env.aliases = { 21880 "anim": ["anim-base","anim-color","anim-curve","anim-easing","anim-node-plugin","anim-scroll","anim-xy"], 21881 "anim-shape-transform": ["anim-shape"], 21882 "app": ["app-base","app-content","app-transitions","lazy-model-list","model","model-list","model-sync-rest","model-sync-local","router","view","view-node-map"], 21883 "attribute": ["attribute-base","attribute-complex"], 21884 "attribute-events": ["attribute-observable"], 21885 "autocomplete": ["autocomplete-base","autocomplete-sources","autocomplete-list","autocomplete-plugin"], 21886 "axes": ["axis-numeric","axis-category","axis-time","axis-stacked"], 21887 "axes-base": ["axis-numeric-base","axis-category-base","axis-time-base","axis-stacked-base"], 21888 "base": ["base-base","base-pluginhost","base-build"], 21889 "cache": ["cache-base","cache-offline","cache-plugin"], 21890 "charts": ["charts-base"], 21891 "collection": ["array-extras","arraylist","arraylist-add","arraylist-filter","array-invoke"], 21892 "color": ["color-base","color-hsl","color-harmony"], 21893 "controller": ["router"], 21894 "dataschema": ["dataschema-base","dataschema-json","dataschema-xml","dataschema-array","dataschema-text"], 21895 "datasource": ["datasource-local","datasource-io","datasource-get","datasource-function","datasource-cache","datasource-jsonschema","datasource-xmlschema","datasource-arrayschema","datasource-textschema","datasource-polling"], 21896 "datatable": ["datatable-core","datatable-table","datatable-head","datatable-body","datatable-base","datatable-column-widths","datatable-message","datatable-mutable","datatable-sort","datatable-datasource"], 21897 "datatype": ["datatype-date","datatype-number","datatype-xml"], 21898 "datatype-date": ["datatype-date-parse","datatype-date-format","datatype-date-math"], 21899 "datatype-number": ["datatype-number-parse","datatype-number-format"], 21900 "datatype-xml": ["datatype-xml-parse","datatype-xml-format"], 21901 "dd": ["dd-ddm-base","dd-ddm","dd-ddm-drop","dd-drag","dd-proxy","dd-constrain","dd-drop","dd-scroll","dd-delegate"], 21902 "dom": ["dom-base","dom-screen","dom-style","selector-native","selector"], 21903 "editor": ["frame","editor-selection","exec-command","editor-base","editor-para","editor-br","editor-bidi","editor-tab","createlink-base"], 21904 "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"], 21905 "event-custom": ["event-custom-base","event-custom-complex"], 21906 "event-gestures": ["event-flick","event-move"], 21907 "handlebars": ["handlebars-compiler"], 21908 "highlight": ["highlight-base","highlight-accentfold"], 21909 "history": ["history-base","history-hash","history-html5"], 21910 "io": ["io-base","io-xdr","io-form","io-upload-iframe","io-queue"], 21911 "json": ["json-parse","json-stringify"], 21912 "loader": ["loader-base","loader-rollup","loader-yui3"], 21913 "loader-pathogen-encoder": ["loader-base","loader-rollup","loader-yui3","loader-pathogen-combo
21913handler"], 21914 "node": ["node-base","node-event-delegate","node-pluginhost","node-screen","node-style"], 21915 "pluginhost": ["pluginhost-base","pluginhost-config"], 21916 "querystring": ["querystring-parse","querystring-stringify"], 21917 "recordset": ["recordset-base","recordset-sort","recordset-filter","recordset-indexer"], 21918 "resize": ["resize-base","resize-proxy","resize-constrain"], 21919 "slider": ["slider-base","slider-value-range","clickable-rail","range-slider"], 21920 "template": ["template-base","template-micro"], 21921 "text": ["text-accentfold","text-wordbreak"], 21922 "widget": ["widget-base","widget-htmlparser","widget-skin","widget-uievents"] 21923}; 21924 21925 21926}, 'patched-v3.18.3', { 21927 "use": [ 21928 "yui-base", 21929 "get", 21930 "features", 21931 "intl-base", 21932 "yui-log", 21933 "yui-later", 21934 "loader-base", 21935 "loader-rollup", 21936 "loader-yui3" 21937 ] 21938}); 21939YUI.add('get', function (Y, NAME) { 21940 21941/*jslint boss:true, expr:true, laxbreak: true */ 21942 21943/** 21944Provides dynamic loading of remote JavaScript and CSS resources. 21945 21946@module get 21947@class Get 21948@static 21949**/ 21950 21951var Lang = Y.Lang, 21952 21953 CUSTOM_ATTRS, // defined lazily in Y.Get.Transaction._createNode() 21954 21955 Get, Transaction; 21956 21957Y.Get = Get = { 21958 // -- Public Properties ---------------------------------------------------- 21959 21960 /** 21961 Default options for CSS requests. Options specified here will override 21962 global defaults for CSS requests. 21963 21964 See the `options` property for all available options. 21965 21966 @property cssOptions 21967 @type Object 21968 @static 21969 @since 3.5.0 21970 **/ 21971 cssOptions: { 21972 attributes: { 21973 rel: 'stylesheet' 21974 }, 21975 21976 doc : Y.config.linkDoc || Y.config.doc, 21977 pollInterval: 50 21978 }, 21979 21980 /** 21981 Default options for JS requests. Options specified here will override global 21982 defaults for JS requests. 21983 21984 See the `options` property for all available options. 21985 21986 @property jsOptions 21987 @type Object 21988 @static 21989 @since 3.5.0 21990 **/ 21991 jsOptions: { 21992 autopurge: true, 21993 doc : Y.config.scriptDoc || Y.config.doc 21994 }, 21995 21996 /** 21997 Default options to use for all requests. 21998 21999 Note that while all available options are documented here for ease of 22000 discovery, some options (like callback functions) only make sense at the 22001 transaction level. 22002 22003 Callback functions specified via the options object or the `options` 22004 parameter of the `css()`, `js()`, or `load()` methods will receive the 22005 transaction object as a parameter. See `Y.Get.Transaction` for details on 22006 the properties and methods available on transactions. 22007 22008 @static 22009 @since 3.5.0 22010 @property {Object} options 22011 22012 @property {Boolean} [options.async=false] Whether or not to load scripts 22013 asynchronously, meaning they're requested in parallel and execution 22014 order is not guaranteed. Has no effect on CSS, since CSS is always 22015 loaded asynchronously. 22016 22017 @property {Object} [options.attributes] HTML attribute name/value pairs that 22018 should be added to inserted nodes. By default, the `charset` attribute 22019 will be set to "utf-8" and nodes will be given an auto-generated `id` 22020 attribute, but you can override these with your own values if desired. 22021 22022 @property {Boolean} [options.autopurge] Whether or not to automatically 22023 purge inserted nodes after the purge threshold is reached. This is 22024 `true` by default for JavaScript, but `false` for CSS since purging a
22025 CSS node will also remove any styling applied by the referenced file. 22026 22027 @property {Object} [options.context] `this` object to use when calling 22028 callback functions. Defaults to the transaction object. 22029 22030 @property {Mixed} [options.data] Arbitrary data object to pass to "on*" 22031 callbacks. 22032 22033 @property {Document} [options.doc] Document into which nodes should be 22034 inserted. By default, the current document is used. 22035 22036 @property {HTMLElement|String} [options.insertBefore] HTML element or id 22037 string of an element before which all generated nodes should be 22038 inserted. If not specified, Get will automatically determine the best 22039 place to insert nodes for maximum compatibility. 22040 22041 @property {Function} [options.onEnd] Callback to execute after a transaction 22042 is complete, regardless of whether it succeeded or failed. 22043 22044 @property {Function} [options.onFailure] Callback to execute after a 22045 transaction fails, times out, or is aborted. 22046 22047 @property {Function} [options.onProgress] Callback to execute after each 22048 individual request in a transaction either succeeds or fails. 22049 22050 @property {Function} [options.onSuccess] Callback to execute after a 22051 transaction completes successfully with no errors. Note that in browsers 22052 that don't support the `error` event on CSS `<link>` nodes, a failed CSS 22053 request may still be reported as a success because in these browsers 22054 it can be difficult or impossible to distinguish between success and 22055 failure for CSS resources. 22056 22057 @property {Function} [options.onTimeout] Callback to execute after a 22058 transaction times out. 22059 22060 @property {Number} [options.pollInterval=50] Polling interval (in 22061 milliseconds) for detecting CSS load completion in browsers that don't 22062 support the `load` event on `<link>` nodes. This isn't used for 22063 JavaScript. 22064 22065 @property {Number} [options.purgethreshold=20] Number of nodes to insert 22066 before triggering an automatic purge when `autopurge` is `true`. 22067 22068 @property {Number} [options.timeout] Number of milliseconds to wait before 22069 aborting a transaction. When a timeout occurs, the `onTimeout` callback 22070 is called, followed by `onFailure` and finally `onEnd`. By default, 22071 there is no timeout. 22072 22073 @property {String} [options.type] Resource type ("css" or "js"). This option 22074 is set automatically by the `css()` and `js()` functions and will be 22075 ignored there, but may be useful when using the `load()` function. If 22076 not specified, the type will be inferred from the URL, defaulting to 22077 "js" if the URL doesn't contain a recognizable file extension. 22078 **/ 22079 options: { 22080 attributes: { 22081 charset: 'utf-8' 22082 }, 22083 22084 purgethreshold: 20 22085 }, 22086 22087 // -- Protected Properties ------------------------------------------------- 22088 22089 /** 22090 Regex that matches a CSS URL. Used to guess the file type when it's not 22091 specified. 22092 22093 @property REGEX_CSS 22094 @type RegExp 22095 @final 22096 @protected 22097 @static 22098 @since 3.5.0 22099 **/ 22100 REGEX_CSS: /\.css(?:[?;].*)?$/i, 22101 22102 /** 22103 Regex that matches a JS URL. Used to guess the file type when it's not 22104 specified. 22105 22106 @property REGEX_JS 22107 @type RegExp 22108 @final 22109 @protected 22110 @static 22111 @since 3.5.0 22112 **/ 22113 REGEX_JS : /\.js(?:[?;].*)?$/i, 22114 22115 /** 22116 Contains information about the current environment, such as what script and 22117 link injection features it supports. 22118 22119 This object is created and populated the first time the `_getEnv()` method 22120 is called. 22121 22122 @property _env 22123 @type Object 22124 @protected 22125 @static 22126 @since 3.5.0 22127 **/ 22128 22129 /** 22130 Mapping of document _yuid strings to <head> or <base> node references so we 22131 don't have to look the node up each time we want to insert a request node. 22132 22133 @property _insertCache 22134 @type Object 22135 @protected 22136 @static 22137 @since 3.5.0 22138 **/ 22139 _insertCache: {}, 22140 22141 /** 22142 Information about the currently pending transaction, if any. 22143 22144 This is actually an object with two properties: `callback`, containing the 22145 optional callback passed to `css()`, `load()`, or `js()`; and `transaction`, 22146 containing the actual transaction instance. 22147 22148 @property _pending 22149 @type Object 22150 @protected 22151 @static 22152 @since 3.5.0 22153 **/ 22154 _pending: null, 22155 22156 /** 22157 HTML nodes eligible to be purged next time autopurge is triggered. 22158 22159 @property _purgeNodes 22160 @type HTMLElement[] 22161 @protected 22162 @static 22163 @since 3.5.0 22164 **/ 22165 _purgeNodes: [], 22166 22167 /** 22168 Queued transactions and associated callbacks. 22169 22170 @property _queue 22171 @type Object[] 22172 @protected 22173 @static 22174 @since 3.5.0 22175 **/ 22176 _queue: [], 22177 22178 // -- Public Methods ------------------------------------------------------- 22179 22180 /** 22181 Aborts the specified transaction. 22182 22183 This will cause the transaction's `onFailure` callback to be called and 22184 will prevent any new script and link nodes from being added to the document, 22185 but any resources that have already been requested will continue loading 22186 (there's no safe way to prevent this, unfortunately). 22187 22188 *Note:* This method is deprecated as of 3.5.0, and will be removed in a 22189 future version of YUI. Use the transaction-level `abort()` method instead. 22190 22191 @method abort 22192 @param {Get.Transaction} transaction Transaction to abort. 22193 @deprecated Use the `abort()` method on the transaction instead. 22194 @static 22195 **/ 22196 abort: function (transaction) { 22197 var i, id, item, len, pending; 22198 22199 22200 if (!transaction.abort) { 22201 id = transaction; 22202 pending = this._pending; 22203 transaction = null; 22204 22205 if (pending && pending.transaction.id === id) { 22206 transaction = pending.transaction; 22207 this._pending = null; 22208 } else { 22209 for (i = 0, len = this._queue.length; i < len; ++i) { 22210 item = this._queue[i].transaction; 22211 22212 if (item.id === id) { 22213 transaction = item; 22214 this._queue.splice(i, 1); 22215 break; 22216 } 22217 } 22218 } 22219 } 22220 22221 transaction && transaction.abort(); 22222 }, 22223 22224 /** 22225 Loads one or more CSS files. 22226 22227 The _urls_ parameter may be provided as a URL string, a request object, 22228 or an array of URL strings and/or request objects. 22229 22230 A request object is just an object that contains a `url` property and zero 22231 or more options that should apply specifically to that request. 22232 Request-specific options take priority over transaction-level options and 22233 default options. 22234 22235 URLs may be relative or absolute, and do not have to have the same origin 22236 as the current page. 22237 22238 The `options` parameter may be omitted completely and a callback passed in 22239 its place, if desired. 22240 22241 @example 22242 22243 // Load a single CSS file and log a message on completion. 22244 Y.Get.css('foo.css', function (err) { 22245 if (err) { 22246 } else { 22247 } 22248 }); 22249 22250 // Load multiple CSS files and log a message when all have finished 22251 // loading. 22252 var urls = ['foo.css', 'http://example.com/bar.css', 'baz/quux.css']; 22253 22254 Y.Get.css(urls, function (err) { 22255 if (err) { 22256 } else { 22257 } 22258 }); 22259 22260 // Specify transaction-level options, which will apply to all requests 22261 // within the transaction. 22262 Y.Get.css(urls, { 22263 attributes: {'class': 'my-css'}, 22264 timeout : 5000 22265 }); 22266 22267 // Specify per-request options, which override transaction-level and 22268 // default options. 22269 Y.Get.css([ 22270 {url: 'foo.css', attributes: {id: 'foo'}}, 22271 {url: 'bar.css', attributes: {id: 'bar', charset: 'iso-8859-1'}} 22272 ]); 22273 22274 @method css 22275 @param {String|Object|Array}
22275 urls URL string, request object, or array 22276 of URLs and/or request objects to load. 22277 @param {Object} [options] Options for this transaction. See the 22278 `Y.Get.options` property for a complete list of available options. 22279 @param {Function} [callback] Callback function to be called on completion. 22280 This is a general callback and will be called before any more granular 22281 callbacks (`onSuccess`, `onFailure`, etc.) specified in the `options` 22282 object. 22283 22284 @param {Array|null} callback.err Array of errors that occurred during 22285 the transaction, or `null` on success. 22286 @param {Get.Transaction} callback.transaction Transaction object. 22287 22288 @return {Get.Transaction} Transaction object. 22289 @static 22290 **/ 22291 css: function (urls, options, callback) { 22292 return this._load('css', urls, options, callback); 22293 }, 22294 22295 /** 22296 Loads one or more JavaScript resources. 22297 22298 The _urls_ parameter may be provided as a URL string, a request object, 22299 or an array of URL strings and/or request objects. 22300 22301 A request object is just an object that contains a `url` property and zero 22302 or more options that should apply specifically to that request. 22303 Request-specific options take priority over transaction-level options and 22304 default options. 22305 22306 URLs may be relative or absolute, and do not have to have the same origin 22307 as the current page. 22308 22309 The `options` parameter may be omitted completely and a callback passed in 22310 its place, if desired. 22311 22312 Scripts will be executed in the order they're specified unless the `async` 22313 option is `true`, in which case they'll be loaded in parallel and executed 22314 in whatever order they finish loading. 22315 22316 @example 22317 22318 // Load a single JS file and log a message on completion. 22319 Y.Get.js('foo.js', function (err) { 22320 if (err) { 22321 } else { 22322 } 22323 }); 22324 22325 // Load multiple JS files, execute them in order, and log a message when 22326 // all have finished loading. 22327 var urls = ['foo.js', 'http://example.com/bar.js', 'baz/quux.js']; 22328 22329 Y.Get.js(urls, function (err) { 22330 if (err) { 22331 } else { 22332 } 22333 }); 22334 22335 // Specify transaction-level options, which will apply to all requests 22336 // within the transaction. 22337 Y.Get.js(urls, { 22338 attributes: {'class': 'my-js'}, 22339 timeout : 5000 22340 }); 22341 22342 // Specify per-request options, which override transaction-level and 22343 // default options. 22344 Y.Get.js([ 22345 {url: 'foo.js', attributes: {id: 'foo'}}, 22346 {url: 'bar.js', attributes: {id: 'bar', charset: 'iso-8859-1'}} 22347 ]); 22348 22349 @method js 22350 @param {String|Object|Array} urls URL string, request object, or array 22351 of URLs and/or request objects to load. 22352 @param {Object} [options] Options for this transaction. See the 22353 `Y.Get.options` property for a complete list of available options. 22354 @param {Function} [callback] Callback function to be called on completion. 22355 This is a general callback and will be called before any more granular 22356 callbacks (`onSuccess`, `onFailure`, etc.) specified in the `options` 22357 object. 22358 22359 @param {Array|null} callback.err Array of errors that occurred during 22360 the transaction, or `null` on success. 22361 @param {Get.Transaction} callback.transaction Transaction object. 22362 22363 @return {Get.Transaction} Transaction object. 22364 @since 3.5.0 22365 @static 22366 **/ 22367 js: function (urls, options, callback) { 22368 return this._load('js', urls, options, callback); 22369 }, 22370 22371 /** 22372 Loads one or more CSS and/or JavaScript resources in the same transaction. 22373 22374 Use this method when you want to load both CSS and JavaScript in a single 22375 transaction and be notified when all requested URLs have finished loading, 22376 regardless of type. 22377 22378 Behavior and options are the same as for the `css()` and `js()` methods. If 22379 a resource type isn't specified in per-request options or transaction-level 22380 options, Get will guess the file type based on the URL's extension (`.css` 22381 or `.js`, with or without a following query string). If the file type can't 22382 be guessed from the URL, a warning will be logged and Get will assume the 22383 URL is a JavaScript resource. 22384 22385 @example 22386 22387 // Load both CSS and JS files in a single transaction, and log a message 22388 // when all files have finished loading. 22389 Y.Get.load(['foo.css', 'bar.js', 'baz.css'], function (err) { 22390 if (err) { 22391 } else { 22392 } 22393 }); 22394 22395 @method load 22396 @param {String|Object|Array}
22396 urls URL string, request object, or array 22397 of URLs and/or request objects to load. 22398 @param {Object} [options] Options for this transaction. See the 22399 `Y.Get.options` property for a complete list of available options. 22400 @param {Function} [callback] Callback function to be called on completion. 22401 This is a general callback and will be called before any more granular 22402 callbacks (`onSuccess`, `onFailure`, etc.) specified in the `options` 22403 object. 22404 22405 @param {Array|null} err Array of errors that occurred during the 22406 transaction, or `null` on success. 22407 @param {Get.Transaction} Transaction object. 22408 22409 @return {Get.Transaction} Transaction object. 22410 @since 3.5.0 22411 @static 22412 **/ 22413 load: function (urls, options, callback) { 22414 return this._load(null, urls, options, callback); 22415 }, 22416 22417 // -- Protected Methods ---------------------------------------------------- 22418 22419 /** 22420 Triggers an automatic purge if the purge threshold has been reached. 22421 22422 @method _autoPurge 22423 @param {Number} threshold Purge threshold to use, in milliseconds. 22424 @protected 22425 @since 3.5.0 22426 @static 22427 **/ 22428 _autoPurge: function (threshold) { 22429 if (threshold && this._purgeNodes.length >= threshold) { 22430 this._purge(this._purgeNodes); 22431 } 22432 }, 22433 22434 /** 22435 Populates the `_env` property with information about the current 22436 environment. 22437 22438 @method _getEnv 22439 @return {Object} Environment information. 22440 @protected 22441 @since 3.5.0 22442 @static 22443 **/ 22444 _getEnv: function () { 22445 var doc = Y.config.doc, 22446 ua = Y.UA; 22447 22448 // Note: some of these checks require browser sniffs since it's not 22449 // feasible to load test files on every pageview just to perform a 22450 // feature test. I'm sorry if this makes you sad. 22451 return (this._env = { 22452 22453 // True if this is a browser that supports disabling async mode on 22454 // dynamically created script nodes. See 22455 // https://developer.mozilla.org/En/HTML/Element/Script#Attributes 22456 22457 // IE10 doesn't return true for the MDN feature test, so setting it explicitly, 22458 // because it is async by default, and allows you to disable async by setting it to false 22459 async: (doc && doc.createElement('script').async === true) || (ua.ie >= 10), 22460 22461 // True if this browser fires an event when a dynamically injected 22462 // link node fails to load. This is currently true for Firefox 9+ 22463 // and WebKit 535.24+ 22464 cssFail: ua.gecko >= 9 || ua.compareVersions(ua.webkit, 535.24) >= 0, 22465 22466 // True if this browser fires an event when a dynamically injected 22467 // link node finishes loading. This is currently true for IE, Opera, 22468 // Firefox 9+, and WebKit 535.24+. Note that IE versions <9 fire the 22469 // DOM 0 "onload" event, but not "load". All versions of IE fire 22470 // "onload". 22471 // davglass: Seems that Chrome on Android needs this to be false. 22472 cssLoad: ( 22473 (!ua.gecko && !ua.webkit) || ua.gecko >= 9 || 22474 ua.compareVersions(ua.webkit, 535.24) >= 0 22475 ) && !(ua.chrome && ua.chrome <= 18), 22476 22477 // True if this browser preserves script execution order while 22478 // loading scripts in parallel as long as the script node's `async` 22479 // attribute is set to false to explicitly disable async execution. 22480 preservesScriptOrder: !!(ua.gecko || ua.opera || (ua.ie && ua.ie >= 10)) 22481 }); 22482 }, 22483 22484 _getTransaction: function (urls, options) { 22485 var requests = [], 22486 i, len, req, url; 22487 22488 if (!Lang.isArray(urls)) { 22489 urls = [urls]; 22490 } 22491 22492 options = Y.merge(this.options, options); 22493 22494 // Clone the attributes object so we don't end up modifying it by ref. 22495 options.attributes = Y.merge(this.options.attributes, 22496 options.attributes); 22497 22498 for (i = 0, len = urls.length; i < len; ++i) { 22499 url = urls[i]; 22500 req = {attributes: {}}; 22501 22502 // If `url` is a string, we create a URL object for it, then mix in 22503 // global options and request-specific options. If it's an object 22504 // with a "url" property, we assume it's a request object c
22504ontaining 22505 // URL-specific options. 22506 if (typeof url === 'string') { 22507 req.url = url; 22508 } else if (url.url) { 22509 // URL-specific options override both global defaults and 22510 // request-specific options. 22511 Y.mix(req, url, false, null, 0, true); 22512 url = url.url; // Make url a string so we can use it later. 22513 } else { 22514 continue; 22515 } 22516 22517 Y.mix(req, options, false, null, 0, true); 22518 22519 // If we didn't get an explicit type for this URL either in the 22520 // request options or the URL-specific options, try to determine 22521 // one from the file extension. 22522 if (!req.type) { 22523 if (this.REGEX_CSS.test(url)) { 22524 req.type = 'css'; 22525 } else { 22526 if (!this.REGEX_JS.test(url)) { 22527 } 22528 22529 req.type = 'js'; 22530 } 22531 } 22532 22533 // Mix in type-specific default options, but don't overwrite any 22534 // options that have already been set. 22535 Y.mix(req, req.type === 'js' ? this.jsOptions : this.cssOptions, 22536 false, null, 0, true); 22537 22538 // Give the node an id attribute if it doesn't already have one. 22539 req.attributes.id || (req.attributes.id = Y.guid()); 22540 22541 // Backcompat for <3.5.0 behavior. 22542 if (req.win) { 22543 req.doc = req.win.document; 22544 } else { 22545 req.win = req.doc.defaultView || req.doc.parentWindow; 22546 } 22547 22548 if (req.charset) { 22549 req.attributes.charset = req.charset; 22550 } 22551 22552 requests.push(req); 22553 } 22554 22555 return new Transaction(requests, options); 22556 }, 22557 22558 _load: function (type, urls, options, callback) { 22559 var transaction; 22560 22561 // Allow callback as third param. 22562 if (typeof options === 'function') { 22563 callback = options; 22564 options = {}; 22565 } 22566 22567 options || (options = {}); 22568 options.type = type; 22569 22570 options._onFinish = Get._onTransactionFinish; 22571 22572 if (!this._env) { 22573 this._getEnv(); 22574 } 22575 22576 transaction = this._getTransaction(urls, options); 22577 22578 this._queue.push({ 22579 callback : callback, 22580 transaction: transaction 22581 }); 22582 22583 this._next(); 22584 22585 return transaction; 22586 }, 22587 22588 _onTransactionFinish : function() { 22589 Get._pending = null; 22590 Get._next(); 22591 }, 22592 22593 _next: function () { 22594 var item; 22595 22596 if (this._pending) { 22597 return; 22598 } 22599 22600 item = this._queue.shift(); 22601 22602 if (item) { 22603 this._pending = item; 22604 item.transaction.execute(item.callback); 22605 } 22606 }, 22607 22608 _purge: function (nodes) { 22609 var purgeNodes = this._purgeNodes, 22610 isTransaction = nodes !== purgeNodes, 22611 index, node; 22612 22613 while (node = nodes.pop()) { // assignment 22614 // Don't purge nodes that haven't finished loading (or errored out), 22615 // since this can hang the transaction. 22616 if (!node._yuiget_finished) { 22617 continue; 22618 } 22619 22620 node.parentNode && node.parentNode.removeChild(node); 22621 22622 // If this is a transaction-level purge and this node also exists in 22623 // the Get-level _purgeNodes array, we need to remove it from 22624 // _purgeNodes to avoid creating a memory leak. The indexOf lookup 22625 // sucks, but until we get WeakMaps, this is the least troublesome 22626 // way to do this (we can't just hold onto node ids because they may 22627 // not be in the same document). 22628 if (isTransaction) { 22629 index = Y.Array.indexOf(purgeNodes, node); 22630 22631 if (index > -1) { 22632 purgeNodes.splice(index, 1); 22633 } 22634 } 22635 } 22636 } 22637}; 22638 22639/** 22640Alias for `js()`. 22641 22642@method script 22643@static 22644**/ 22645Get.script = Get.js; 22646 22647/** 22648Represents a Get transaction, which may contain requests for one or more JS or 22649CSS files. 22650 22651This class should not be instantiated manually. Instances will be created and
22652returned as needed by Y.Get's `css()`, `js()`, and `load()` methods. 22653 22654@class Get.Transaction 22655@constructor 22656@since 3.5.0 22657**/ 22658Get.Transaction = Transaction = function (requests, options) { 22659 var self = this; 22660 22661 self.id = Transaction._lastId += 1; 22662 self.data = options.data; 22663 self.errors = []; 22664 self.nodes = []; 22665 self.options = options; 22666 self.requests = requests; 22667 22668 self._callbacks = []; // callbacks to call after execution finishes 22669 self._queue = []; 22670 self._reqsWaiting = 0; 22671 22672 // Deprecated pre-3.5.0 properties. 22673 self.tId = self.id; // Use `id` instead. 22674 self.win = options.win || Y.config.win; 22675}; 22676 22677/** 22678Arbitrary data object associated with this transaction. 22679 22680This object comes from the options passed to `Get.css()`, `Get.js()`, or 22681`Get.load()`, and will be `undefined` if no data object was specified. 22682 22683@property {Object} data 22684**/ 22685 22686/** 22687Array of errors that have occurred during this transaction, if any. Each error 22688object has the following properties: 22689`errors.error`: Error message. 22690`errors.request`: Request object related to the error. 22691 22692@since 3.5.0 22693@property {Object[]} errors 22694**/ 22695 22696/** 22697Numeric id for this transaction, unique among all transactions within the same 22698YUI sandbox in the current pageview. 22699 22700@property {Number} id 22701@since 3.5.0 22702**/ 22703 22704/**
22705HTMLElement nodes (native ones, not YUI Node instances) that have been inserted 22706during the current transaction. 22707 22708@property {HTMLElement[]} nodes 22709**/ 22710 22711/** 22712Options associated with this transaction. 22713 22714See `Get.options` for the full list of available options. 22715 22716@property {Object} options 22717@since 3.5.0 22718**/ 22719 22720/** 22721Request objects contained in this transaction. Each request object represents 22722one CSS or JS URL that will be (or has been) requested and loaded into the page. 22723 22724@property {Object} requests 22725@since 3.5.0 22726**/ 22727 22728/** 22729Id of the most recent transaction. 22730 22731@property _lastId 22732@type Number 22733@protected 22734@static 22735**/ 22736Transaction._lastId = 0; 22737 22738Transaction.prototype = { 22739 // -- Public Properties ---------------------------------------------------- 22740 22741 /** 22742 Current state of this transaction. One of "new", "executing", or "done". 22743 22744 @property _state 22745 @type String 22746 @protected 22747 **/ 22748 _state: 'new', // "new", "executing", or "done" 22749 22750 // -- Public Methods ------------------------------------------------------- 22751 22752 /** 22753 Aborts this transaction. 22754 22755 This will cause the transaction's `onFailure` callback to be called and 22756 will prevent any new script and link nodes from being added to the document, 22757 but any resources that have already been requested will continue loading 22758 (there's no safe way to prevent this, unfortunately). 22759 22760 @method abort 22761 @param {String} [msg="Aborted."] Optional message to use in the `errors` 22762 array describing why the transaction was aborted. 22763 **/ 22764 abort: function (msg) { 22765 this._pending = null; 22766 this._pendingCSS = null; 22767 this._pollTimer = clearTimeout(this._pollTimer); 22768 this._queue = []; 22769 this._reqsWaiting = 0; 22770 22771 this.errors.push({error: msg || 'Aborted'}); 22772 this._finish(); 22773 }, 22774 22775 /** 22776 Begins execting the transaction. 22777 22778 There's usually no reason to call this manually, since Get will call it 22779 automatically when other pending transactions have finished. If you really 22780 want to execute your transaction before Get does, you can, but be aware that 22781 this transaction's scripts may end up executing before the scripts in other 22782 pending transactions. 22783 22784 If the transaction is already executing, the specified callback (if any) 22785 will be queued and called after execution finishes. If the transaction has 22786 already finished, the callback will be called immediately (the transaction 22787 will not be executed again). 22788 22789 @method execute 22790 @param {Function} callback Callback function to execute after all requests 22791 in the transaction are complete, or after the transaction is aborted. 22792 **/ 22793 execute: function (callback) { 22794 var self = this, 22795 requests = self.requests, 22796 state = self._state, 22797 i, len, queue, req; 22798 22799 if (state === 'done') { 22800 callback && callback(self.errors.length ? self.errors : null, self); 22801 return; 22802 } else { 22803 callback && self._callbacks.push(callback); 22804 22805 if (state === 'executing') { 22806 return; 22807 } 22808 } 22809 22810 self._state = 'executing'; 22811 self._queue = queue = []; 22812 22813 if (self.options.timeout) { 22814 self._timeout = setTimeout(function () { 22815 self.abort('Timeout'); 22816 }, self.options.timeout); 22817 } 22818 22819 self._reqsWaiting = requests.length; 22820 22821 for (i = 0, len = requests.length; i < len; ++i) { 22822 req = requests[i]; 22823 22824 if (req.async || req.type === 'css') { 22825 // No need to queue CSS or fully async JS. 22826 self._insert(req); 22827 } else { 22828 queue.push(req); 22829 } 22830 } 22831 22832 self._next(); 22833 }, 22834 22835 /** 22836 Manually purges any `<script>` or `<link>` nodes this transaction has 22837 created. 22838 22839 Be careful when purging a transaction that contains CSS requests, since 22840 removing `<link>` nodes will also remove any styles they applied. 22841 22842 @method purge 22843 **/ 22844 purge: function () { 22845 Get._purge(this.nodes); 22846 }, 22847 22848 // -- Protected Methods ---------------------------------------------------- 22849 _createNode: function (name, attrs, doc) { 22850 var node = doc.createElement(name), 22851 attr, testEl; 22852 22853 if (!CUSTOM_ATTRS) { 22854 // IE6 and IE7 expect property names rather than attribute names for 22855 // certain attributes. Rather than sniffing, we do a quick feature 22856 // test the first time _createNode() runs to determine whether we 22857 // need to provide a workaround. 22858 testEl = doc.createElement('div'); 22859 testEl.setAttribute('class', 'a'); 22860 22861 CUSTOM_ATTRS = testEl.className === 'a' ? {} : { 22862 'for' : 'htmlFor', 22863 'class': 'className' 22864 }; 22865 } 22866 22867 for (attr in attrs) { 22868 if (attrs.hasOwnProperty(attr)) { 22869 node.setAttribute(CUSTOM_ATTRS[attr] || attr, attrs[attr]); 22870 } 22871 } 22872 22873 return node; 22874 }, 22875 22876 _finish: function () { 22877 var errors = this.errors.length ? this.errors : null, 22878 options = this.options, 22879 thisObj = options.context || this, 22880 data, i, len; 22881 22882 if (this._state === 'done') { 22883 return; 22884 } 22885 22886 this._state = 'done'; 22887 22888 for (i = 0, len = this._callbacks.length; i < len; ++i) { 22889 this._callbacks[i].call(thisObj, errors, this); 22890 } 22891 22892 data = this._getEventData(); 22893 22894 if (errors) {
22895 if (options.onTimeout && errors[errors.length - 1].error === 'Timeout') { 22896 options.onTimeout.call(thisObj, data); 22897 } 22898 22899 if (options.onFailure) { 22900 options.onFailure.call(thisObj, data); 22901 } 22902 } else if (options.onSuccess) { 22903 options.onSuccess.call(thisObj, data); 22904 } 22905 22906 if (options.onEnd) { 22907 options.onEnd.call(thisObj, data); 22908 } 22909 22910 if (options._onFinish) { 22911 options._onFinish(); 22912 } 22913 }, 22914 22915 _getEventData: function (req) { 22916 if (req) { 22917 // This merge is necessary for backcompat. I hate it. 22918 return Y.merge(this, { 22919 abort : this.abort, // have to copy these because the prototype isn't preserved 22920 purge : this.purge, 22921 request: req, 22922 url : req.url, 22923 win : req.win 22924 }); 22925 } else { 22926 return this; 22927 } 22928 }, 22929 22930 _getInsertBefore: function (req) { 22931 var doc = req.doc, 22932 el = req.insertBefore, 22933 cache, docStamp; 22934 22935 if (el) { 22936 return typeof el === 'string' ? doc.getElementById(el) : el; 22937 } 22938 22939 cache = Get._insertCache; 22940 docStamp = Y.stamp(doc); 22941 22942 if ((el = cache[docStamp])) { // assignment 22943 return el; 22944 } 22945 22946 // Inserting before a <base> tag apparently works around an IE bug 22947 // (according to a comment from pre-3.5.0 Y.Get), but I'm not sure what 22948 // bug that is, exactly. Better safe than sorry? 22949 if ((el = doc.getElementsByTagName('base')[0])) { // assignment 22950 return (cache[docStamp] = el); 22951 } 22952 22953 // Look for a <head> element. 22954 el = doc.head || doc.getElementsByTagName('head')[0]; 22955 22956 if (el) { 22957 // Create a marker node at the end of <head> to use as an insertion 22958 // point. Inserting before this node will ensure that all our CSS 22959 // gets inserted in the correct order, to maintain style precedence. 22960 el.appendChild(doc.createTextNode('')); 22961 return (cache[docStamp] = el.lastChild); 22962 } 22963 22964 // If all else fails, just insert before the first script node on the 22965 // page, which is virtually guaranteed to exist. 22966 return (cache[docStamp] = doc.getElementsByTagName('script')[0]); 22967 }, 22968 22969 _insert: function (req) { 22970 var env = Get._env, 22971 insertBefore = this._getInsertBefore(req), 22972 isScript = req.type === 'js', 22973 node = req.node, 22974 self = this, 22975 ua = Y.UA, 22976 cssTimeout, nodeType; 22977 22978 if (!node) { 22979 if (isScript) { 22980 nodeType = 'script'; 22981 } else if (!env.cssLoad && ua.gecko) { 22982 nodeType = 'style'; 22983 } else { 22984 nodeType = 'link'; 22985 delete req.attributes['charset']; 22986 } 22987 22988 node = req.node = this._createNode(nodeType, req.attributes, 22989 req.doc); 22990 } 22991 22992 function onError() { 22993 self._progress('Failed to load ' + req.url, req); 22994 } 22995 22996 function onLoad() { 22997 if (cssTimeout) { 22998 clearTimeout(cssTimeout); 22999 } 23000 23001 self._progress(null, req); 23002 } 23003 23004 // Deal with script asynchronicity. 23005 if (isScript) { 23006 node.setAttribute('src', req.url); 23007 23008 if (req.async) { 23009 // Explicitly indicate that we want the browser to execute this 23010 // script asynchronously. This is necessary for older browsers 23011 // like Firefox <4. 23012 node.async = true; 23013 } else { 23014 if (env.async) { 23015 // This browser treats injected scripts as async by default 23016 // (standard HTML5 behavior) but asynchronous loading isn't 23017 // desired, so tell the browser not to mark this script as 23018 // async. 23019 node.async = false;
23020 } 23021 23022 // If this browser doesn't preserve script execution order based 23023 // on insertion order, we'll need to avoid inserting other 23024 // scripts until this one finishes loading. 23025 if (!env.preservesScriptOrder) { 23026 this._pending = req; 23027 } 23028 } 23029 } else { 23030 if (!env.cssLoad && ua.gecko) { 23031 // In Firefox <9, we can import the requested URL into a <style> 23032 // node and poll for the existence of node.sheet.cssRules. This 23033 // gives us a reliable way to determine CSS load completion that 23034 // also works for cross-domain stylesheets. 23035 // 23036 // Props to Zach Leatherman for calling my attention to this 23037 // technique. 23038 node.innerHTML = (req.attributes.charset ? 23039 '@charset "' + req.attributes.charset + '";' : '') + 23040 '@import "' + req.url + '";'; 23041 } else { 23042 node.setAttribute('href', req.url); 23043 } 23044 } 23045 23046 // Inject the node. 23047 if (isScript && ua.ie && (ua.ie < 9 || (document.documentMode && document.documentMode < 9))) { 23048 // Script on IE < 9, and IE 9+ when in IE 8 or older modes, including quirks mode. 23049 node.onreadystatechange = function () { 23050 if (/loaded|complete/.test(node.readyState)) { 23051 node.onreadystatechange = null; 23052 onLoad(); 23053 } 23054 }; 23055 } else if (!isScript && !env.cssLoad) { 23056 // CSS on Firefox <9 or WebKit. 23057 this._poll(req); 23058 } else { 23059 // Script or CSS on everything else. Using DOM 0 events because that 23060 // evens the playing field with older IEs. 23061 23062 if (ua.ie >= 10) { 23063 23064 // We currently need to introduce a timeout for IE10, since it 23065 // calls onerror/onload synchronously for 304s - messing up existing 23066 // program flow. 23067 23068 // Remove this block if the following bug gets fixed by GA 23069 /*jshint maxlen: 1500 */ 23070 // https://connect.microsoft.com/IE/feedback/details/763871/dynamically-loaded-scripts-with-304s-responses-interrupt-the-currently-executing-js-thread-onload 23071 node.onerror = function() { setTimeout(onError, 0); }; 23072 node.onload = function() { setTimeout(onLoad, 0); }; 23073 } else { 23074 node.onerror = onError; 23075 node.onload = onLoad; 23076 } 23077 23078 // If this browser doesn't fire an event when CSS fails to load, 23079 // fail after a timeout to avoid blocking the transaction queue. 23080 if (!env.cssFail && !isScript) { 23081 cssTimeout = setTimeout(onError, req.timeout || 3000); 23082 } 23083 } 23084 23085 this.nodes.push(node); 23086 insertBefore.parentNode.insertBefore(node, insertBefore); 23087 }, 23088 23089 _next: function () { 23090 if (this._pending) { 23091 return; 23092 } 23093 23094 // If there are requests in the queue, insert the next queued request. 23095 // Otherwise, if we're waiting on already-inserted requests to finish, 23096 // wait longer. If there are no queued requests and we're not waiting 23097 // for anything to load, then we're done! 23098 if (this._queue.length) { 23099 this._insert(this._queue.shift()); 23100 } else if (!this._reqsWaiting) { 23101 this._finish(); 23102 } 23103 }, 23104 23105 _poll: function (newReq) { 23106 var self = this, 23107 pendingCSS = self._pendingCSS, 23108 isWebKit = Y.UA.webkit, 23109 i, hasRules, j, nodeHref, req, sheets; 23110 23111 if (newReq) { 23112 pendingCSS || (pendingCSS = self._pendingCSS = []); 23113 pendingCSS.push(newReq); 23114 23115 if (self._pollTimer) { 23116 // A poll timeout is already pending, so no need to create a 23117 // new one. 23118 return; 23119 } 23120 } 23121 23122 self._pollTimer = null; 23123 23124 // Note: in both the WebKit and Gecko hacks below, a CSS URL that 404s 23125 // will still be treated as a success. There's no good workaround for 23126 // this. 23127 23128 for (i = 0; i < pendingCSS.length; ++i) { 23129 req = pendingCSS[i]; 23130 23131 if (isWebKit) { 23132 // Look for a stylesheet matching the pending URL. 23133 sheets = req.doc.styleSheets; 23134 j = sheets.length; 23135 nodeHref = req.node.href; 23136 23137 while (--j >= 0) { 23138 if (sheets[j].href === nodeHref) { 23139 pendingCSS.splice(i, 1); 23140 i -= 1; 23141 self._progress(null, req); 23142 break; 23143 } 23144 } 23145 } else { 23146 // Many thanks to Zach Leatherman for calling my attention to 23147 // the @import-based cross-domain technique used here, and to 23148 // Oleg Slobodskoi for an earlier same-domain implementation. 23149 // 23150 // See Zach's blog for more details: 23151 // http://www.zachleat.com/web/2010/07/29/load-css-dynamically/ 23152 try { 23153 // We don't really need to store this value since we never 23154 // use it again, but if we don't store it, Closure Compiler 23155 // assumes the code is useless and removes it.
23156 hasRules = !!req.node.sheet.cssRules; 23157 23158 // If we get here, the stylesheet has loaded. 23159 pendingCSS.splice(i, 1); 23160 i -= 1; 23161 self._progress(null, req); 23162 } catch (ex) { 23163 // An exception means the stylesheet is still loading. 23164 } 23165 } 23166 } 23167 23168 if (pendingCSS.length) { 23169 self._pollTimer = setTimeout(function () { 23170 self._poll.call(self); 23171 }, self.options.pollInterval); 23172 } 23173 }, 23174 23175 _progress: function (err, req) { 23176 var options = this.options; 23177 23178 if (err) { 23179 req.error = err; 23180 23181 this.errors.push({ 23182 error : err, 23183 request: req 23184 }); 23185 23186 } 23187 23188 req.node._yuiget_finished = req.finished = true; 23189 23190 if (options.onProgress) { 23191 options.onProgress.call(options.context || this, 23192 this._getEventData(req)); 23193 } 23194 23195 if (req.autopurge) { 23196 // Pre-3.5.0 Get always excludes the most recent node from an 23197 // autopurge. I find this odd, but I'm keeping that behavior for 23198 // the sake of backcompat. 23199 Get._autoPurge(this.options.purgethreshold); 23200 Get._purgeNodes.push(req.node); 23201 } 23202 23203 if (this._pending === req) { 23204 this._pending = null; 23205 } 23206 23207 this._reqsWaiting -= 1; 23208 23209 this._next(); 23210 } 23211}; 23212 23213 23214}, 'patched-v3.18.3', {"requires": ["yui-base"]}); 23215YUI.add('features', function (Y, NAME) { 23216 23217var feature_tests = {}; 23218 23219/** 23220Contains the core of YUI's feature test architecture. 23221@module features 23222*/ 23223 23224/** 23225* Feature detection 23226* @class Features 23227* @static 23228*/ 23229 23230Y.mix(Y.namespace('Features'), { 23231 23232 /** 23233 * Object hash of all registered feature tests 23234 * @property tests 23235 * @type Object 23236 */ 23237 tests: feature_tests, 23238 23239 /** 23240 * Add a test to the system 23241 * 23242 * ``` 23243 * Y.Features.add("load", "1", {}); 23244 * ``` 23245 * 23246 * @method add 23247 * @param {String} cat The category, right now only 'load' is supported 23248 * @param {String} name The number sequence of the test, how it's reported in the URL or config: 1, 2, 3 23249 * @param {Object} o Object containing test properties 23250 * @param {String} o.name The name of the test 23251 * @param {Function} o.test The test function to execute, the only argument to the function is the `Y` instance 23252 * @param {String} o.trigger The module that triggers this test. 23253 */ 23254 add: function(cat, name, o) { 23255 feature_tests[cat] = feature_tests[cat] || {}; 23256 feature_tests[cat][name] = o; 23257 }, 23258 /** 23259 * Execute all tests of a given category and return the serialized results 23260 * 23261 * ``` 23262 * caps=1:1;2:1;3:0 23263 * ``` 23264 * @method all 23265 * @param {String} cat The category to execute 23266 * @param {Array} args The arguments to pass to the test function 23267 * @return {String} A semi-colon separated string of tests and their success/failure: 1:1;2:1;3:0 23268 */ 23269 all: function(cat, args) { 23270 var cat_o = feature_tests[cat], 23271 // results = {}; 23272 result = []; 23273 if (cat_o) { 23274 Y.Object.each(cat_o, function(v, k) { 23275 result.push(k + ':' + (Y.Features.test(cat, k, args) ? 1 : 0)); 23276 }); 23277 } 23278 23279 return (result.length) ? result.join(';') : ''; 23280 }, 23281 /** 23282 * Run a specific test and return a Boolean response. 23283 * 23284 * ``` 23285 * Y.Features.test("load", "1"); 23286 * ``` 23287 * 23288 * @method test 23289 * @param {String} cat The category of the test to run 23290 * @param {String} name The name of the test to run 23291 * @param {Array} args The arguments to pass to the test function 23292 * @return {Boolean} True or false if the test passed/failed. 23293 */ 23294 test: function(cat, name, args) { 23295 args = args || []; 23296 var result, ua, test, 23297 cat_o = feature_tests[cat], 23298 feature = cat_o && cat_o[name]; 23299 23300 if (!feature) { 23301 } else { 23302 23303 result = feature.result; 23304 23305 if (Y.Lang.isUndefined(result)) { 23306 23307 ua = feature.ua; 23308 if (ua) { 23309 result = (Y.UA[ua]); 23310 } 23311 23312 test = feature.test; 23313 if (test && ((!ua) || result)) { 23314 result = test.apply(Y, args); 23315 } 23316 23317 feature.result = result; 23318 } 23319 } 23320 23321 return result; 23322 } 23323}); 23324 23325// Y.Features.add("load", "1", {}); 23326// Y.Features.test("load", "1"); 23327// caps=1:1;2:0;3:1; 23328 23329/* This file is auto-generated by (yogi loader --yes --mix --start ../) */ 23330/*jshint maxlen:900, eqeqeq: false */ 23331var add = Y.Features.add; 23332// app-transitions-native 23333add('load', '0', { 23334 "name": "app-transitions-native", 23335 "test": function (Y) { 23336 var doc = Y.config.doc, 23337 node = doc ? doc.documentElement : null; 23338 23339 if (node && node.style) { 23340 return ('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); 23341 } 23342 23343 return false;
23344}, 23345 "trigger": "app-transitions" 23346}); 23347// autocomplete-list-keys 23348add('load', '1', { 23349 "name": "autocomplete-list-keys", 23350 "test": function (Y) { 23351 // Only add keyboard support to autocomplete-list if this doesn't appear to 23352 // be an iOS or Android-based mobile device. 23353 // 23354 // There's currently no feasible way to actually detect whether a device has 23355 // a hardware keyboard, so this sniff will have to do. It can easily be 23356 // overridden by manually loading the autocomplete-list-keys module. 23357 // 23358 // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari 23359 // doesn't fire the keyboard events used by AutoCompleteList, so there's 23360 // no point loading the -keys module even when a bluetooth keyboard may be 23361 // available. 23362 return !(Y.UA.ios || Y.UA.android); 23363}, 23364 "trigger": "autocomplete-list" 23365}); 23366// dd-gestures 23367add('load', '2', { 23368 "name": "dd-gestures", 23369 "trigger": "dd-drag", 23370 "ua": "touchEnabled" 23371}); 23372// dom-style-ie 23373add('load', '3', { 23374 "name": "dom-style-ie", 23375 "test": function (Y) { 23376 23377 var testFeature = Y.Features.test, 23378 addFeature = Y.Features.add, 23379 WINDOW = Y.config.win, 23380 DOCUMENT = Y.config.doc, 23381 DOCUMENT_ELEMENT = 'documentElement', 23382 ret = false;
23383 23384 addFeature('style', 'computedStyle', { 23385 test: function() { 23386 return WINDOW && 'getComputedStyle' in WINDOW; 23387 } 23388 }); 23389 23390 addFeature('style', 'opacity', { 23391 test: function() { 23392 return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style; 23393 } 23394 }); 23395 23396 ret = (!testFeature('style', 'opacity') && 23397 !testFeature('style', 'computedStyle')); 23398 23399 return ret; 23400}, 23401 "trigger": "dom-style" 23402}); 23403// editor-para-ie 23404add('load', '4', { 23405 "name": "editor-para-ie", 23406 "trigger": "editor-para", 23407 "ua": "ie", 23408 "when": "instead" 23409}); 23410// event-base-ie 23411add('load', '5', { 23412 "name": "event-base-ie", 23413 "test": function(Y) { 23414 var imp = Y.config.doc && Y.config.doc.implementation; 23415 return (imp && (!imp.hasFeature('Events', '2.0'))); 23416}, 23417 "trigger": "node-base" 23418}); 23419// graphics-canvas 23420add('load', '6', { 23421 "name": "graphics-canvas", 23422 "test": function(Y) { 23423 var DOCUMENT = Y.config.doc, 23424 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", 23425 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 23426 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 23427 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); 23428}, 23429 "trigger": "graphics" 23430}); 23431// graphics-canvas-default 23432add('load', '7', { 23433 "name": "graphics-canvas-default", 23434 "test": function(Y) { 23435 var DOCUMENT = Y.config.doc, 23436 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", 23437 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 23438 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 23439 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); 23440}, 23441 "trigger": "graphics" 23442}); 23443// graphics-svg 23444add('load', '8', { 23445 "name": "graphics-svg", 23446 "test": function(Y) { 23447 var DOCUMENT = Y.config.doc, 23448 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", 23449 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 23450 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 23451 23452 return svg && (useSVG || !canvas); 23453}, 23454 "trigger": "graphics" 23455}); 23456// graphics-svg-default 23457add('load', '9', { 23458 "name": "graphics-svg-default", 23459 "test": function(Y) { 23460 var DOCUMENT = Y.config.doc, 23461 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", 23462 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 23463 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 23464 23465 return svg && (useSVG || !canvas); 23466}, 23467 "trigger": "graphics" 23468}); 23469// graphics-vml 23470add('load', '10', { 23471 "name": "graphics-vml", 23472 "test": function(Y) { 23473 var DOCUMENT = Y.config.doc, 23474 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); 23475 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); 23476}, 23477 "trigger": "graphics" 23478}); 23479// graphics-vml-default 23480add('load', '11', { 23481 "name": "graphics-vml-default", 23482 "test": function(Y) { 23483 var DOCUMENT = Y.config.doc, 23484 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); 23485 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); 23486}, 23487 "trigger": "graphics" 23488}); 23489// history-hash-ie 23490add('load', '12', { 23491 "name": "history-hash-ie", 23492 "test": function (Y) { 23493 var docMode = Y.config.doc && Y.config.doc.documentMode; 23494 23495 return Y.UA.ie && (!('onhashchange' in Y.config.win) || 23496 !docMode || docMode < 8); 23497}, 23498 "trigger": "history-hash" 23499}); 23500// io-nodejs 23501add('load', '13', { 23502 "name": "io-nodejs", 23503 "trigger": "io-base", 23504 "ua": "nodejs" 23505}); 23506// json-parse-shim 23507add('load', '14', { 23508 "name": "json-parse-shim", 23509 "test": function (Y) { 23510 var _JSON = Y.config.global.JSON, 23511 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, 23512 nativeSupport = Y.config.useNativeJSONParse !== false && !!Native; 23513 23514 function workingNative( k, v ) { 23515 return k === "ok" ? true : v; 23516 } 23517 23518 // Double check basic functionality. This is mainly to catch early broken 23519 // implementations of the JSON API in Firefox 3.1 beta1 and beta2
23520 if ( nativeSupport ) { 23521 try { 23522 nativeSupport = ( Native.parse( '{"ok":false}', workingNative ) ).ok; 23523 } 23524 catch ( e ) { 23525 nativeSupport = false; 23526 } 23527 } 23528 23529 return !nativeSupport; 23530}, 23531 "trigger": "json-parse" 23532}); 23533// json-stringify-shim 23534add('load', '15', { 23535 "name": "json-stringify-shim", 23536 "test": function (Y) { 23537 var _JSON = Y.config.global.JSON, 23538 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, 23539 nativeSupport = Y.config.useNativeJSONStringify !== false && !!Native; 23540 23541 // Double check basic native functionality. This is primarily to catch broken 23542 // early JSON API implementations in Firefox 3.1 beta1 and beta2. 23543 if ( nativeSupport ) { 23544 try { 23545 nativeSupport = ( '0' === Native.stringify(0) ); 23546 } catch ( e ) { 23547 nativeSupport = false; 23548 } 23549 } 23550 23551 23552 return !nativeSupport; 23553}, 23554 "trigger": "json-stringify" 23555}); 23556// scrollview-base-ie 23557add('load', '16', { 23558 "name": "scrollview-base-ie", 23559 "trigger": "scrollview-base", 23560 "ua": "ie" 23561}); 23562// selector-css2 23563add('load', '17', { 23564 "name": "selector-css2", 23565 "test": function (Y) { 23566 var DOCUMENT = Y.config.doc, 23567 ret = DOCUMENT && !('querySelectorAll' in DOCUMENT); 23568 23569 return ret; 23570}, 23571 "trigger": "selector" 23572}); 23573// transition-timer 23574add('load', '18', { 23575 "name": "transition-timer", 23576 "test": function (Y) { 23577 var DOCUMENT = Y.config.doc, 23578 node = (DOCUMENT) ? DOCUMENT.documentElement: null, 23579 ret = true; 23580 23581 if (node && node.style) { 23582 ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); 23583 } 23584 23585 return ret; 23586}, 23587 "trigger": "transition" 23588}); 23589// widget-base-ie 23590add('load', '19', { 23591 "name": "widget-base-ie", 23592 "trigger": "widget-base", 23593 "ua": "ie" 23594}); 23595// yql-jsonp 23596add('load', '20', { 23597 "name": "yql-jsonp", 23598 "test": function (Y) { 23599 /* Only load the JSONP module when not in nodejs or winjs 23600 TODO Make the winjs module a CORS module 23601 */ 23602 return (!Y.UA.nodejs && !Y.UA.winjs); 23603}, 23604 "trigger": "yql" 23605}); 23606// yql-nodejs 23607add('load', '21', { 23608 "name": "yql-nodejs", 23609 "trigger": "yql", 23610 "ua": "nodejs" 23611}); 23612// yql-winjs 23613add('load', '22', { 23614 "name": "yql-winjs", 23615 "trigger": "yql", 23616 "ua": "winjs" 23617}); 23618 23619}, 'patched-v3.18.3', {"requires": ["yui-base"]}); 23620YUI.add('intl-base', function (Y, NAME) { 23621 23622/** 23623 * The Intl utility provides a central location for managing sets of 23624 * localized resources (strings and formatting patterns). 23625 * 23626 * @class Intl 23627 * @uses EventTarget 23628 * @static 23629 */ 23630 23631var SPLIT_REGEX = /[, ]/; 23632 23633Y.mix(Y.namespace('Intl'), { 23634 23635 /** 23636 * Returns the language among those available that 23637 * best matches the preferred language list, using the Lookup 23638 * algorithm of BCP 47. 23639 * If none of the available languages meets the user's preferences, 23640 * then "" is returned. 23641 * Extended language ranges are not supported. 23642 * 23643 * @method lookupBestLang 23644 * @param {String[] | String} preferredLanguages The list of preferred 23645 * languages in descending preference order, represented as BCP 47 23646 * language tags. A string array or a comma-separated list. 23647 * @param {String[]} availableLanguages The list of languages 23648 * that the application supports, represented as BCP 47 language 23649 * tags. 23650 * 23651 * @return {String} The available language that best matches the 23652 * preferred language list, or "". 23653 * @since 3.1.0 23654 */ 23655 lookupBestLang: function(preferredLanguages, availableLanguages) { 23656 23657 var i, language, result, index; 23658 23659 // check whether the list of available languages contains language; 23660 // if so return it 23661 function scan(language) { 23662 var i; 23663 for (i = 0; i < availableLanguages.length; i += 1) { 23664 if (language.toLowerCase() === 23665 availableLanguages[i].toLowerCase()) { 23666 return availableLanguages[i]; 23667 } 23668 } 23669 } 23670
23671 if (Y.Lang.isString(preferredLanguages)) { 23672 preferredLanguages = preferredLanguages.split(SPLIT_REGEX); 23673 } 23674 23675 for (i = 0; i < preferredLanguages.length; i += 1) { 23676 language = preferredLanguages[i]; 23677 if (!language || language === '*') { 23678 continue; 23679 } 23680 // check the fallback sequence for one language 23681 while (language.length > 0) { 23682 result = scan(language); 23683 if (result) { 23684 return result; 23685 } else { 23686 index = language.lastIndexOf('-'); 23687 if (index >= 0) { 23688 language = language.substring(0, index); 23689 // one-character subtags get cut along with the 23690 // following subtag 23691 if (index >= 2 && language.charAt(index - 2) === '-') { 23692 language = language.substring(0, index - 2); 23693 } 23694 } else { 23695 // nothing available for this language 23696 break; 23697 } 23698 } 23699 } 23700 } 23701 23702 return ''; 23703 } 23704}); 23705 23706 23707}, 'patched-v3.18.3', {"requires": ["yui-base"]}); 23708YUI.add('yui-log', function (Y, NAME) { 23709 23710/** 23711 * Provides console log capability and exposes a custom event for 23712 * console implementations. This module is a `core` YUI module, 23713 * <a href="../classes/YUI.html#method_log">it's documentation is located under the YUI class</a>. 23714 * 23715 * @module yui 23716 * @submodule yui-log 23717 */ 23718 23719var INSTANCE = Y, 23720 LOGEVENT = 'yui:log', 23721 UNDEFINED = 'undefined', 23722 LEVELS = { debug: 1, 23723 info: 2, 23724 warn: 4, 23725 error: 8 }; 23726 23727/** 23728 * If the 'debug' config is true, a 'yui:log' event will be 23729 * dispatched, which the Console widget and anything else 23730 * can consume. If the 'useBrowserConsole' config is true, it will 23731 * write to the browser console if available. YUI-specific log 23732 * messages will only be present in the -debug versions of the 23733 * JS files. The build system is supposed to remove log statements 23734 * from the raw and minified versions of the files. 23735 * 23736 * @method log 23737 * @for YUI 23738 * @param {String} msg The message to log. 23739 * @param {String} cat The log category for the message. Default 23740 * categories are "info", "warn", "error", "debug". 23741 * Custom categories can be used as well. (opt). 23742 * @param {String} src The source of the the message (opt). 23743 * @param {boolean} silent If true, the log event won't fire. 23744 * @return {YUI} YUI instance. 23745 */ 23746INSTANCE.log = function(msg, cat, src, silent) { 23747 var bail, excl, incl, m, f, minlevel, 23748 Y = INSTANCE, 23749 c = Y.config, 23750 publisher = (Y.fire) ? Y : YUI.Env.globalEvents; 23751 // suppress log message if the config is off or the event stack 23752 // or the event call stack contains a consumer of the yui:log event 23753 if (c.debug) { 23754 // apply source filters 23755 src = src || ""; 23756 if (typeof src !== "undefined") { 23757 excl = c.logExclude; 23758 incl = c.logInclude; 23759 if (incl && !(src in incl)) { 23760 bail = 1; 23761 } else if (incl && (src in incl)) { 23762 bail = !incl[src]; 23763 } else if (excl && (src in excl)) { 23764 bail = excl[src]; 23765 } 23766 23767 // Set a default category of info if the category was not defined. 23768 if ((typeof cat === 'undefined')) { 23769 cat = 'info'; 23770 } 23771 23772 // Determine the current minlevel as defined in configuration 23773 Y.config.logLevel = Y.config.logLevel || 'debug'; 23774 minlevel = LEVELS[Y.config.logLevel.toLowerCase()]; 23775 23776 if (cat in LEVELS && LEVELS[cat] < minlevel) { 23777 // Skip this message if the we don't meet the defined minlevel 23778 bail = 1; 23779 } 23780 } 23781 if (!bail) { 23782 if (c.useBrowserConsole) { 23783 m = (src) ? src + ': ' + msg : msg; 23784 if (Y.Lang.isFunction(c.logFn)) { 23785 c.logFn.call(Y, msg, cat, src); 23786 } else if (typeof console !== UNDEFINED && console.log) { 23787 f = (cat && console[cat] && (cat in LEVELS)) ? cat : 'log'; 23788 console[f](m); 23789 } else if (typeof opera !== UNDEFINED) { 23790 opera.postError(m); 23791 } 23792 } 23793 23794 if (publisher && !silent) { 23795 23796 if (publisher === Y && (!publisher.getEvent(LOGEVENT))) { 23797 publisher.publish(LOGEVENT, { 23798 broadcast: 2 23799 }); 23800 } 23801 23802 publisher.fire(LOGEVENT, { 23803 msg: msg, 23804 cat: cat, 23805 src: src 23806 }); 23807 } 23808 } 23809 } 23810 23811 return Y; 23812}; 23813 23814/** 23815 * Write a system message. This message will be preserved in the 23816 * minified and raw versions of the YUI files, unlike log statements. 23817 * @method message 23818 * @for YUI 23819 * @param {String} msg The message to log. 23820 * @param {String} cat The log category for the message. Default 23821 * categories are "info", "warn", "error", "debug". 23822 * Custom categories can be used as well. (opt). 23823 * @param {String} src The source of the the message (opt). 23824 * @param {boolean} silent If true, the log event won't fire. 23825 * @return {YUI} YUI instance. 23826 */ 23827INSTANCE.message = function() { 23828 return INSTANCE.log.apply(INSTANCE, arguments); 23829}; 23830 23831 23832}, 'patched-v3.18.3', {"requires": ["yui-base"]}); 23833YUI.add('yui-later', function (Y, NAME) { 23834 23835/** 23836 * Provides a setTimeout/setInterval wrapper. This module is a `core` YUI module, 23837 * <a href="../classes/YUI.html#method_later">
23837it's documentation is located under the YUI class</a>. 23838 * 23839 * @module yui 23840 * @submodule yui-later 23841 */ 23842 23843var NO_ARGS = []; 23844 23845/** 23846 * Executes the supplied function in the context of the supplied 23847 * object 'when' milliseconds later. Executes the function a 23848 * single time unless periodic is set to true. 23849 * @for YUI 23850 * @method later 23851 * @param when {Number} the number of milliseconds to wait until the fn 23852 * is executed. 23853 * @param o the context object. 23854 * @param fn {Function|String} the function to execute or the name of 23855 * the method in the 'o' object to execute. 23856 * @param data [Array] data that is provided to the function. This 23857 * accepts either a single item or an array. If an array is provided, 23858 * the function is executed with one parameter for each array item. 23859 * If you need to pass a single array parameter, it needs to be wrapped 23860 * in an array [myarray]. 23861 * 23862 * Note: native methods in IE may not have the call and apply methods. 23863 * In this case, it will work, but you are limited to four arguments. 23864 * 23865 * @param periodic {boolean} if true, executes continuously at supplied 23866 * interval until canceled. 23867 * @return {object} a timer object. Call the cancel() method on this 23868 * object to stop the timer. 23869 */ 23870Y.later = function(when, o, fn, data, periodic) { 23871 when = when || 0; 23872 data = (!Y.Lang.isUndefined(data)) ? Y.Array(data) : NO_ARGS; 23873 o = o || Y.config.win || Y; 23874 23875 var cancelled = false, 23876 method = (o && Y.Lang.isString(fn)) ? o[fn] : fn, 23877 wrapper = function() { 23878 // IE 8- may execute a setInterval callback one last time 23879 // after clearInterval was called, so in order to preserve 23880 // the cancel() === no more runny-run, we have to jump through 23881 // an extra hoop. 23882 if (!cancelled) { 23883 if (!method.apply) { 23884 method(data[0], data[1], data[2], data[3]); 23885 } else { 23886 method.apply(o, data || NO_ARGS); 23887 } 23888 } 23889 }, 23890 id = (periodic) ? setInterval(wrapper, when) : setTimeout(wrapper, when); 23891 23892 return { 23893 id: id, 23894 interval: periodic, 23895 cancel: function() { 23896 cancelled = true; 23897 if (this.interval) { 23898 clearInterval(id); 23899 } else { 23900 clearTimeout(id); 23901 } 23902 } 23903 }; 23904}; 23905 23906Y.Lang.later = Y.later; 23907 23908 23909 23910}, 'patched-v3.18.3', {"requires": ["yui-base"]}); 23911YUI.add('loader-base', function (Y, NAME) { 23912 23913/** 23914 * The YUI loader core 23915 * @module loader 23916 * @submodule loader-base 23917 */ 23918 23919(function() { 23920 var VERSION = Y.version, 23921 BUILD = '/build/', 23922 ROOT = VERSION + '/', 23923 CDN_BASE = Y.Env.base, 23924 GALLERY_VERSION = 'gallery-2014.06.04-21-38', 23925 TNT = '2in3', 23926 TNT_VERSION = '4', 23927 YUI2_VERSION = '2.9.0', 23928 COMBO_BASE = CDN_BASE + 'combo?', 23929 META = { 23930 version: VERSION, 23931 root: ROOT, 23932 base: Y.Env.base, 23933 comboBase: COMBO_BASE, 23934 skin: { 23935 defaultSkin: 'sam', 23936 base: 'assets/skins/', 23937 path: 'skin.css', 23938 after: [ 23939 'cssreset', 23940 'cssfonts', 23941 'cssgrids', 23942 'cssbase', 23943 'cssreset-context', 23944 'cssfonts-context' 23945 ] 23946 }, 23947 groups: {}, 23948 patterns: {} 23949 }, 23950 groups = META.groups, 23951 yui2Update = function(tnt, yui2, config) { 23952 var root = TNT + '.' + 23953 (tnt || TNT_VERSION) + '/' + 23954 (yui2 || YUI2_VERSION) + BUILD, 23955 base = (config && config.base) ? config.base : CDN_BASE, 23956 combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE; 23957 23958 groups.yui2.base = base + root; 23959 groups.yui2.root = root; 23960 groups.yui2.comboBase = combo; 23961 }, 23962 galleryUpdate = function(tag, config) { 23963 var root = (tag || GALLERY_VERSION) + BUILD, 23964 base = (config && config.base) ? config.base : CDN_BASE, 23965 combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE; 23966 23967 groups.gallery.base = base + root; 23968 groups.gallery.root = root; 23969 groups.gallery.comboBase = combo; 23970 }; 23971 23972 23973 groups[VERSION] = {}; 23974 23975 groups.gallery = { 23976 ext: false, 23977 combine: true, 23978 comboBase: COMBO_BASE, 23979 update: galleryUpdate, 23980 patterns: { 23981 'gallery-': {}, 23982 'lang/gallery-': {}, 23983 'gallerycss-': { 23984 type: 'css' 23985 } 23986 } 23987 }; 23988 23989 groups.yui2 = { 23990 combine: true, 23991 ext: false, 23992 comboBase: COMBO_BASE, 23993 update: yui2Update, 23994 patterns: { 23995 'yui2-': { 23996 configFn: function(me) { 23997 if (/-skin|reset|fonts|grids|base/.test(me.name)) { 23998 me.type = 'css'; 23999 me.path = me.path.replace(/\.js/, '.css'); 24000 // this makes skins in builds earlier than 24001 // 2.6.0 work as long as combine is false 24002 me.path = me.path.replace(/\/yui2-skin/, 24003 '/assets/skins/sam/yui2-skin'); 24004 } 24005 } 24006 } 24007 } 24008 }; 24009 24010 galleryUpdate(); 24011 yui2Update(); 24012 24013 if (YUI.Env[VERSION]) { 24014 Y.mix(META, YUI.Env[VERSION], false, [ 24015 'modules', 24016 'groups', 24017 'skin' 24018 ], 0, true); 24019 } 24020 24021 YUI.Env[VERSION] = META; 24022}()); 24023/*jslint forin: true, maxlen: 350 */ 24024 24025/** 24026 * Loader dynamically loads script and css files. It includes the dependency 24027 * information for the version of the library in use, and will automatically pull in 24028 * dependencies for the modules requested. It can also load the 24029 * files from the Yahoo! CDN, and it can utilize the combo service provided on 24030 * this network to reduce the number of http connections required to download 24031 * YUI files. 24032 * 24033 * @module loader 24034 * @main loader 24035 * @submodule loader-base 24036 */ 24037 24038var NOT_FOUND = {}, 24039 NO_REQUIREMENTS = [], 24040 MAX_URL_LENGTH = 1024, 24041 GLOBAL_ENV = YUI.Env, 24042 GLOBAL_LOADED = GLOBAL_ENV._loaded, 24043 CSS = 'css', 24044 JS = 'js', 24045 INTL = 'intl', 24046 DEFAULT_SKIN = 'sam',
24047 VERSION = Y.version, 24048 ROOT_LANG = '', 24049 YObject = Y.Object, 24050 oeach = YObject.each, 24051 yArray = Y.Array, 24052 _queue = GLOBAL_ENV._loaderQueue, 24053 META = GLOBAL_ENV[VERSION], 24054 SKIN_PREFIX = 'skin-', 24055 L = Y.Lang, 24056 ON_PAGE = GLOBAL_ENV.mods, 24057 modulekey, 24058 _path = function(dir, file, type, nomin) { 24059 var path = dir + '/' + file; 24060 if (!nomin) { 24061 path += '-min'; 24062 } 24063 path += '.' + (type || CSS); 24064 24065 return path; 24066 }; 24067 24068 24069 if (!YUI.Env._cssLoaded) { 24070 YUI.Env._cssLoaded = {}; 24071 } 24072 24073 24074/** 24075 * The component metadata is stored in Y.Env.meta. 24076 * Part of the loader module. 24077 * @property meta 24078 * @for YUI 24079 */ 24080Y.Env.meta = META; 24081 24082/** 24083 * Loader dynamically loads script and css files. It includes the dependency 24084 * info for the version of the library in use, and will automatically pull in 24085 * dependencies for the modules requested. It can load the 24086 * files from the Yahoo! CDN, and it can utilize the combo service provided on 24087 * this network to reduce the number of http connections required to download 24088 * YUI files. You can also specify an external, custom combo service to host 24089 * your modules as well. 24090 24091 var Y = YUI(); 24092 var loader = new Y.Loader({ 24093 filter: 'debug', 24094 base: '../../', 24095 root: 'build/', 24096 combine: true, 24097 require: ['node', 'dd', 'console'] 24098 }); 24099 var out = loader.resolve(true); 24100 24101 * If the Loader needs to be patched before it is used for the first time, it 24102 * should be done through the `doBeforeLoader` hook. Simply make the patch 24103 * available via configuration before YUI is loaded: 24104 24105 YUI_config = YUI_config || {}; 24106 YUI_config.doBeforeLoader = function (config) { 24107 var resolve = this.context.Loader.prototype.resolve; 24108 this.context.Loader.prototype.resolve = function () { 24109 // do something here 24110 return resolve.apply(this, arguments); 24111 }; 24112 }; 24113 24114 * @constructor 24115 * @class Loader 24116 * @param {Object} config an optional set of configuration options. 24117 * @param {String} config.base The base dir which to fetch this module from 24118 * @param {String} config.comboBase The Combo service base path. Ex: `http://yui.yahooapis.com/combo?` 24119 * @param {String} config.root The root path to prepend to module names for the combo service. Ex: `2.5.2/build/` 24120 * @param {String|Object} config.filter A filter to apply to result urls. <a href="#property_filter">See filter property</a> 24121 * @param {Object} config.filters Per-component filter specification. If specified for a given component, this overrides the filter config. 24122 * @param {Boolean} config.combine Use a combo service to reduce the number of http connections required to load your dependencies 24123 * @param {Boolean} [config.async=true] Fetch files in async 24124 * @param {Array} config.ignore: A list of modules that should never be dynamically loaded 24125 * @param {Array} config.force A list of modules that should always be loaded when required, even if already present on the page 24126 * @param {HTMLElement|String} config.insertBefore Node or id for a node that should be used as the insertion point for new nodes 24127 * @param {Object} config.jsAttributes Object literal containing attributes to add to script nodes 24128 * @param {Object} config.cssAttributes Object literal containing attributes to add to link nodes 24129 * @param {Number} config.timeout The number of milliseconds before a timeout occurs when dynamically loading nodes. If not set, there is no timeout 24130 * @param {Object} config.context Execution context for all callbacks 24131 * @param {Function} config.onSuccess Callback for the 'success' event 24132 * @param {Function} config.onFailure Callback for the 'failure' event 24133 * @param {Function} config.onTimeout Callback for the 'timeout' event 24134 * @param {Function} config.onProgress Callback executed each time a script or css file is loaded 24135 * @param {Object} config.modules A list of module definitions. See <a href="#method_addModule">Loader.addModule</a> for the supported module metadata 24136 * @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`. 24137 * @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. 24138 * @param {String} config.yui2 When using the 2in3 project, you can select the version of YUI 2 to use. V
24138alid 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. 24139 * @param {Function} config.doBeforeLoader An optional hook that allows for the patching of the loader instance. The `Y` instance is available as `this.context` and the only argument to the function is the Loader configuration object. 24140 */ 24141Y.Loader = function(o) { 24142 24143 var self = this; 24144 24145 //Catch no config passed. 24146 o = o || {}; 24147 24148 modulekey = META.md5; 24149 24150 /** 24151 * Internal callback to handle multiple internal insert() calls 24152 * so that css is inserted prior to js 24153 * @property _internalCallback 24154 * @private 24155 */ 24156 // self._internalCallback = null; 24157 24158 /** 24159 * Callback that will be executed when the loader is finished 24160 * with an insert 24161 * @method onSuccess 24162 * @type function 24163 */ 24164 // self.onSuccess = null; 24165 24166 /** 24167 * Callback that will be executed if there is a failure 24168 * @method onFailure 24169 * @type function 24170 */ 24171 // self.onFailure = null; 24172 24173 /** 24174 * Callback executed each time a script or css file is loaded 24175 * @method onProgress 24176 * @type function 24177 */ 24178 // self.onProgress = null; 24179 24180 /** 24181 * Callback that will be executed if a timeout occurs 24182 * @method onTimeout 24183 * @type function 24184 */ 24185 // self.onTimeout = null; 24186 24187 /** 24188 * The execution context for all callbacks 24189 * @property context 24190 * @default {YUI} the YUI instance 24191 */ 24192 self.context = Y; 24193 24194 // Hook that allows the patching of loader 24195 if (o.doBeforeLoader) { 24196 o.doBeforeLoader.apply(self, arguments); 24197 } 24198 24199 /** 24200 * Data that is passed to all callbacks 24201 * @property data 24202 */ 24203 // self.data = null; 24204 24205 /** 24206 * Node reference or id where new nodes should be inserted before 24207 * @property insertBefore 24208 * @type string|HTMLElement 24209 */ 24210 // self.insertBefore = null; 24211 24212 /** 24213 * The charset attribute for inserted nodes 24214 * @property charset 24215 * @type string 24216 * @deprecated , use cssAttributes or jsAttributes. 24217 */ 24218 // self.charset = null; 24219 24220 /** 24221 * An object literal containing attributes to add to link nodes 24222 * @property cssAttributes 24223 * @type object 24224 */ 24225 // self.cssAttributes = null; 24226 24227 /** 24228 * An object literal containing attributes to add to script nodes 24229 * @property jsAttributes 24230 * @type object 24231 */ 24232 // self.jsAttributes = null; 24233 24234 /** 24235 * The base directory. 24236 * @property base 24237 * @type string 24238 * @default http://yui.yahooapis.com/[YUI VERSION]/build/ 24239 */ 24240 self.base = Y.Env.meta.base + Y.Env.meta.root; 24241 24242 /** 24243 * Base path for the combo service 24244 * @property comboBase 24245 * @type string 24246 * @default http://yui.yahooapis.com/combo? 24247 */ 24248 self.comboBase = Y.Env.meta.comboBase; 24249 24250 /* 24251 * Base path for language packs. 24252 */ 24253 // self.langBase = Y.Env.meta.langBase; 24254 // self.lang = ""; 24255 24256 /** 24257 * If configured, the loader will attempt to use the combo 24258 * service for YUI resources and configured external resources. 24259 * @property combine 24260 * @type boolean 24261 * @default true if a base dir isn't in the config 24262 */ 24263 self.combine = o.base && 24264 (o.base.indexOf(self.comboBase.substr(0, 20)) > -1); 24265 24266 /** 24267 * The default seperator to use between files in a combo URL 24268 * @property comboSep 24269 * @type {String} 24270 * @default Ampersand 24271 */ 24272 self.comboSep = '&'; 24273 /** 24274 * Max url length for combo urls. The default is 1024. This is the URL 24275 * limit for the Yahoo! hosted combo servers. If consuming 24276 * a different combo service that has a different URL limit 24277 * it is possible to override this default by supplying 24278 * the maxURLLength config option. The config option will 24279 * only take effect if lower than the default. 24280 * 24281 * @property maxURLLength 24282 * @type int 24283 */ 24284 self.maxURLLength = MAX_URL_LENGTH; 24285 24286 /** 24287 * Ignore modules registered on the YUI global 24288 * @property ignoreRegistered 24289 * @default false 24290 */ 24291 self.ignoreRegistered = o.ignoreRegistered; 24292 24293 /**
24294 * Root path to prepend to module path for the combo 24295 * service 24296 * @property root 24297 * @type string 24298 * @default [YUI VERSION]/build/ 24299 */ 24300 self.root = Y.Env.meta.root; 24301 24302 /** 24303 * Timeout value in milliseconds. If set, self value will be used by 24304 * the get utility. the timeout event will fire if 24305 * a timeout occurs. 24306 * @property timeout 24307 * @type int 24308 */ 24309 self.timeout = 0; 24310 24311 /** 24312 * A list of modules that should not be loaded, even if 24313 * they turn up in the dependency tree 24314 * @property ignore 24315 * @type string[] 24316 */ 24317 // self.ignore = null; 24318 24319 /** 24320 * A list of modules that should always be loaded, even 24321 * if they have already been inserted into the page. 24322 * @property force 24323 * @type string[] 24324 */ 24325 // self.force = null; 24326 24327 self.forceMap = {}; 24328 24329 /** 24330 * Should we allow rollups 24331 * @property allowRollup 24332 * @type boolean 24333 * @default false 24334 */ 24335 self.allowRollup = false; 24336 24337 /** 24338 * A filter to apply to result urls. This filter will modify the default 24339 * path for all modules. The default path for the YUI library is the 24340 * minified version of the files (e.g., event-min.js). The filter property 24341 * can be a predefined filter or a custom filter. The valid predefined 24342 * filters are: 24343 * <dl> 24344 * <dt>DEBUG</dt> 24345 * <dd>Selects the debug versions of the library (e.g., event-debug.js). 24346 * This option will automatically include the Logger widget</dd> 24347 * <dt>RAW</dt> 24348 * <dd>Selects the non-minified version of the library (e.g., event.js). 24349 * </dd> 24350 * </dl> 24351 * You can also define a custom filter, which must be an object literal 24352 * containing a search expression and a replace string: 24353 * 24354 * myFilter: { 24355 * 'searchExp': "-min\\.js", 24356 * 'replaceStr': "-debug.js" 24357 * } 24358 * 24359 * @property filter 24360 * @type string| {searchExp: string, replaceStr: string} 24361 */ 24362 // self.filter = null; 24363 24364 /** 24365 * per-component filter specification. If specified for a given 24366 * component, this overrides the filter config. 24367 * @property filters 24368 * @type object 24369 */ 24370 self.filters = {}; 24371 24372 /** 24373 * The list of requested modules 24374 * @property required 24375 * @type {string: boolean} 24376 */ 24377 self.required = {}; 24378 24379 /** 24380 * If a module name is predefined when requested, it is checked againsts 24381 * the patterns provided in this property. If there is a match, the 24382 * module is added with the default configuration. 24383 * 24384 * At the moment only supporting module prefixes, but anticipate 24385 * supporting at least regular expressions. 24386 * @property patterns 24387 * @type Object 24388 */ 24389 // self.patterns = Y.merge(Y.Env.meta.patterns); 24390 self.patterns = {}; 24391 24392 /** 24393 * Internal loader instance metadata. Use accessor `getModuleInfo()` instead. 24394 */ 24395 self.moduleInfo = {}; 24396 24397 self.groups = Y.merge(Y.Env.meta.groups); 24398 24399 /** 24400 * Provides the information used to skin the skinnable components. 24401 * The following skin definition would result in 'skin1' and 'skin2' 24402 * being loaded for calendar (if calendar was requested), and 24403 * 'sam' for all other skinnable components: 24404 * 24405 * skin: { 24406 * // The default skin, which is automatically applied if not 24407 * // overriden by a component-specific skin definition. 24408 * // Change this in to apply a different skin globally 24409 * defaultSkin: 'sam', 24410 * 24411 * // This is combined with the loader base property to get 24412 * // the default root directory for a skin. ex: 24413 * // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/ 24414 * base: 'assets/skins/', 24415 * 24416 * // Any component-specific overrides can be specified here, 24417 * // making it possible to load different skins for different 24418 * // components. It is possible to load more than one skin 24419 * // for a given component as well. 24420 * overrides: { 24421 * calendar: ['skin1', 'skin2'] 24422 * } 24423 * } 24424 * @property skin 24425 * @type {Object} 24426 */ 24427 self.skin = Y.merge(Y.Env.meta.skin); 24428 24429 /* 24430 * Map of conditional modules 24431 * @since 3.2.0 24432 */ 24433 self.conditions = {}; 24434 24435 // map of modules with a hash of modules that meet the requirement 24436 // self.provides = {}; 24437 24438 self.config = o; 24439 self._internal = true; 24440 24441 self._populateConditionsCache(); 24442 24443 /** 24444 * Set when beginning to compute the dependency tree. 24445 * Composed of what YUI reports to be loaded combined 24446 * with what has been loaded by any instance on the page 24447 * with the version number specified in the metadata. 24448 * @property loaded 24449 * @type {string: boolean} 24450 */ 24451 self.loaded = GLOBAL_LOADED[VERSION]; 24452 24453 24454 /** 24455 * Should Loader fetch scripts in `async`, defaults to `true` 24456 * @property async 24457 */ 24458 24459 self.async = true; 24460 24461 self._inspectPage(); 24462 24463 self._internal = false;
24464 24465 self._config(o); 24466 24467 self.forceMap = (self.force) ? Y.Array.hash(self.force) : {}; 24468 24469 self.testresults = null; 24470 24471 if (Y.config.tests) { 24472 self.testresults = Y.config.tests; 24473 } 24474 24475 /** 24476 * List of rollup files found in the library metadata 24477 * @property rollups 24478 */ 24479 // self.rollups = null; 24480 24481 /** 24482 * Whether or not to load optional dependencies for 24483 * the requested modules 24484 * @property loadOptional 24485 * @type boolean 24486 * @default false 24487 */ 24488 // self.loadOptional = false; 24489 24490 /** 24491 * All of the derived dependencies in sorted order, which 24492 * will be populated when either calculate() or insert() 24493 * is called 24494 * @property sorted 24495 * @type string[] 24496 */ 24497 self.sorted = []; 24498 24499 /* 24500 * A list of modules to attach to the YUI instance when complete. 24501 * If not supplied, the sorted list of dependencies are applied. 24502 * @property attaching 24503 */ 24504 // self.attaching = null; 24505 24506 /** 24507 * Flag to indicate the dependency tree needs to be recomputed 24508 * if insert is called again. 24509 * @property dirty 24510 * @type boolean 24511 * @default true 24512 */ 24513 self.dirty = true; 24514 24515 /** 24516 * List of modules inserted by the utility 24517 * @property inserted 24518 * @type {string: boolean} 24519 */ 24520 self.inserted = {}; 24521 24522 /** 24523 * List of skipped modules during insert() because the module 24524 * was not defined 24525 * @property skipped 24526 */ 24527 self.skipped = {}; 24528 24529 // Y.on('yui:load', self.loadNext, self); 24530 24531 self.tested = {}; 24532 24533 /* 24534 * Cached sorted calculate results 24535 * @property results 24536 * @since 3.2.0 24537 */ 24538 //self.results = {}; 24539 24540 if (self.ignoreRegistered) { 24541 //Clear inpage already processed modules. 24542 self._resetModules(); 24543 } 24544 24545}; 24546 24547Y.Loader.prototype = { 24548 /** 24549 * Gets the module info from the local moduleInfo hash, or from the 24550 * default metadata and populate the local moduleInfo hash. 24551 * @method getModuleInfo 24552 * @param {string} name of the module 24553 * @public 24554 */ 24555 getModuleInfo: function(name) { 24556 24557 var m = this.moduleInfo[name], 24558 rawMetaModules, globalRenderedMods, internal, v; 24559 24560 if (m) { 24561 return m; 24562 } 24563 24564 rawMetaModules = META.modules; 24565 globalRenderedMods = GLOBAL_ENV._renderedMods; 24566 internal = this._internal; 24567 24568 /* 24569 The logic here is: 24570 24571 - if the `moduleInfo[name]` is avilable, 24572 then short circuit 24573 - otherwise, if the module is in the globalCache (cross Y instance), 24574 then port it from the global registry into `moduleInfo[name]` 24575 - otherwise, if the module has raw metadata (from meta modules) 24576 then add it to the global registry and to `moduleInfo[name]` 24577 24578 */ 24579 if (globalRenderedMods && globalRenderedMods.hasOwnProperty(name) && !this.ignoreRegistered) { 24580 this.moduleInfo[name] = Y.merge(globalRenderedMods[name]); 24581 } else { 24582 if (rawMetaModules.hasOwnProperty(name)) { 24583 this._internal = true; // making sure that modules from raw data are marked as internal 24584 v = this.addModule(rawMetaModules[name], name); 24585 // Inspect the page for the CSS module and mark it as loaded. 24586 if (v && v.type === CSS) { 24587 if (this.isCSSLoaded(v.name, true)) { 24588 this.loaded[v.name] = true; 24589 } 24590 } 24591 this._internal = internal; 24592 } 24593 } 24594 return this.moduleInfo[name]; 24595 }, 24596 /** 24597 * Expand the names that are aliases to other modules. 24598 * @method _expandAliases 24599 * @param {string[]} list a module name or a list of names to be expanded 24600 * @private 24601 * @return {array} 24602 */ 24603 _expandAliases: function(list) { 24604 var expanded = [], 24605 aliases = YUI.Env.aliases, 24606 i, name; 24607 list = Y.Array(list); 24608 for (i = 0; i < list.length; i += 1) { 24609 name = list[i]; 24610 expanded.push.apply(expanded, aliases[name] ? aliases[name] : [name]); 24611 } 24612 return expanded; 24613 }, 24614 /** 24615 * Populate the conditions cache from raw modules, this is necessary 24616 * because no other module will require a conditional module, instead 24617 * the condition has to be executed and then the module is analyzed 24618 * to be included in the final requirement list. Without this cache 24619 * conditional modules will be simply ignored. 24620 * @method _populateConditionsCache 24621 * @private 24622 */ 24623 _populateConditionsCache: function() { 24624 var rawMetaModules = META.modules,
24625 cache = GLOBAL_ENV._conditions, 24626 i, j, t, trigger; 24627 24628 // if we have conditions in cache and cache is enabled 24629 // we should port them to this loader instance 24630 if (cache && !this.ignoreRegistered) { 24631 for (i in cache) { 24632 if (cache.hasOwnProperty(i)) { 24633 this.conditions[i] = Y.merge(cache[i]); 24634 } 24635 } 24636 } else { 24637 for (i in rawMetaModules) { 24638 if (rawMetaModules.hasOwnProperty(i) && rawMetaModules[i].condition) { 24639 t = this._expandAliases(rawMetaModules[i].condition.trigger); 24640 for (j = 0; j < t.length; j += 1) { 24641 trigger = t[j]; 24642 this.conditions[trigger] = this.conditions[trigger] || {}; 24643 this.conditions[trigger][rawMetaModules[i].name || i] = rawMetaModules[i].condition; 24644 } 24645 } 24646 } 24647 GLOBAL_ENV._conditions = this.conditions; 24648 } 24649 }, 24650 /** 24651 * Reset modules in the module cache to a pre-processed state so additional 24652 * computations with a different skin or language will work as expected. 24653 * @method _resetModules 24654 * @private 24655 */ 24656 _resetModules: function() { 24657 var self = this, i, o, 24658 mod, name, details; 24659 for (i in self.moduleInfo) { 24660 if (self.moduleInfo.hasOwnProperty(i) && self.moduleInfo[i]) { 24661 mod = self.moduleInfo[i]; 24662 name = mod.name; 24663 details = (YUI.Env.mods[name] ? YUI.Env.mods[name].details : null); 24664 24665 if (details) { 24666 self.moduleInfo[name]._reset = true; 24667 self.moduleInfo[name].requires = details.requires || []; 24668 self.moduleInfo[name].optional = details.optional || []; 24669 self.moduleInfo[name].supersedes = details.supercedes || []; 24670 } 24671 24672 if (mod.defaults) { 24673 for (o in mod.defaults) { 24674 if (mod.defaults.hasOwnProperty(o)) { 24675 if (mod[o]) { 24676 mod[o] = mod.defaults[o]; 24677 } 24678 } 24679 } 24680 } 24681 mod.langCache = undefined; 24682 mod.skinCache = undefined; 24683 if (mod.skinnable) { 24684 self._addSkin(self.skin.defaultSkin, mod.name); 24685 } 24686 } 24687 } 24688 }, 24689 /** 24690 Regex that matches a CSS URL. Used to guess the file type when it's not 24691 specified. 24692 24693 @property REGEX_CSS 24694 @type RegExp 24695 @final 24696 @protected 24697 @since 3.5.0 24698 **/ 24699 REGEX_CSS: /\.css(?:[?;].*)?$/i, 24700 24701 /** 24702 * Default filters for raw and debug 24703 * @property FILTER_DEFS 24704 * @type Object 24705 * @final 24706 * @protected 24707 */ 24708 FILTER_DEFS: { 24709 RAW: { 24710 'searchExp': '-min\\.js', 24711 'replaceStr': '.js' 24712 }, 24713 DEBUG: { 24714 'searchExp': '-min\\.js', 24715 'replaceStr': '-debug.js' 24716 }, 24717 COVERAGE: { 24718 'searchExp': '-min\\.js', 24719 'replaceStr': '-coverage.js' 24720 } 24721 }, 24722 /* 24723 * Check the pages meta-data and cache the result. 24724 * @method _inspectPage 24725 * @private 24726 */ 24727 _inspectPage: function() { 24728 var self = this, v, m, req, mr, i; 24729 24730 for (i in ON_PAGE) { 24731 if (ON_PAGE.hasOwnProperty(i)) { 24732 v = ON_PAGE[i]; 24733 if (v.details) { 24734 m = self.getModuleInfo(v.name); 24735 req = v.details.requires; 24736 mr = m && m.requires; 24737 24738 if (m) { 24739 if (!m._inspected && req && mr.length !== req.length) { 24740 // console.log('deleting ' + m.name); 24741 delete m.expanded; 24742 } 24743 } else { 24744 m = self.addModule(v.details, i); 24745 } 24746 m._inspected = true; 24747 } 24748 } 24749 } 24750 }, 24751 /* 24752 * returns true if b is not loaded, and is required directly or by means of modules it supersedes. 24753 * @private 24754 * @method _requires 24755 * @param {String} mod1 The first module to compare 24756 * @param {String} mod2 The second module to compare 24757 */ 24758 _requires: function(mod1, mod2) { 24759 24760 var i, rm, after_map, s, 24761 m = this.getModuleInfo(mod1), 24762 other = this.getModuleInfo(mod2); 24763
24764 if (!m || !other) { 24765 return false; 24766 } 24767 24768 rm = m.expanded_map; 24769 after_map = m.after_map; 24770 24771 // check if this module should be sorted after the other 24772 // do this first to short circut circular deps 24773 if (after_map && (mod2 in after_map)) { 24774 return true; 24775 } 24776 24777 after_map = other.after_map; 24778 24779 // and vis-versa 24780 if (after_map && (mod1 in after_map)) { 24781 return false; 24782 } 24783 24784 // check if this module requires one the other supersedes 24785 s = other.supersedes; 24786 if (s) { 24787 for (i = 0; i < s.length; i++) { 24788 if (this._requires(mod1, s[i])) { 24789 return true; 24790 } 24791 } 24792 } 24793 24794 s = m.supersedes; 24795 if (s) { 24796 for (i = 0; i < s.length; i++) { 24797 if (this._requires(mod2, s[i])) { 24798 return false; 24799 } 24800 } 24801 } 24802 24803 // check if this module requires the other directly 24804 // if (r && yArray.indexOf(r, mod2) > -1) { 24805 if (rm && (mod2 in rm)) { 24806 return true; 24807 } 24808 24809 // external css files should be sorted below yui css 24810 if (m.ext && m.type === CSS && !other.ext && other.type === CSS) { 24811 return true; 24812 } 24813 24814 return false; 24815 }, 24816 /** 24817 * Apply a new config to the Loader instance 24818 * @method _config 24819 * @private 24820 * @param {Object} o The new configuration 24821 */ 24822 _config: function(o) { 24823 var i, j, val, a, f, group, groupName, self = this, 24824 mods = [], mod, modInfo; 24825 // apply config values 24826 if (o) { 24827 for (i in o) { 24828 if (o.hasOwnProperty(i)) { 24829 val = o[i]; 24830 //TODO This should be a case 24831 if (i === 'require') { 24832 self.require(val); 24833 } else if (i === 'skin') { 24834 //If the config.skin is a string, format to the expected object 24835 if (typeof val === 'string') { 24836 self.skin.defaultSkin = o.skin; 24837 val = { 24838 defaultSkin: val 24839 }; 24840 } 24841 24842 Y.mix(self.skin, val, true); 24843 } else if (i === 'groups') { 24844 for (j in val) { 24845 if (val.hasOwnProperty(j)) { 24846 groupName = j; 24847 group = val[j]; 24848 self.addGroup(group, groupName); 24849 if (group.aliases) { 24850 for (a in group.aliases) { 24851 if (group.aliases.hasOwnProperty(a)) { 24852 self.addAlias(group.aliases[a], a); 24853 } 24854 } 24855 } 24856 } 24857 } 24858 24859 } else if (i === 'modules') { 24860 // add a hash of module definitions 24861 for (j in val) { 24862 if (val.hasOwnProperty(j)) { 24863 self.addModule(val[j], j); 24864 } 24865 } 24866 } else if (i === 'aliases') { 24867 for (j in val) { 24868 if (val.hasOwnProperty(j)) { 24869 self.addAlias(val[j], j); 24870 } 24871 } 24872 } else if (i === 'gallery') { 24873 if (this.groups.gallery.update) { 24874 this.groups.gallery.update(val, o); 24875 } 24876 } else if (i === 'yui2' || i === '2in3') { 24877 if (this.groups.yui2.update) { 24878 this.groups.yui2.update(o['2in3'], o.yui2, o); 24879 } 24880 } else { 24881 self[i] = val; 24882 } 24883 } 24884 } 24885 } 24886 24887 // fix filter 24888 f = self.filter; 24889 24890 if (L.isString(f)) { 24891 f = f.toUpperCase(); 24892 self.filterName = f; 24893 self.filter = self.FILTER_DEFS[f]; 24894 if (f === 'DEBUG') { 24895 self.require('yui-log', 'dump'); 24896 } 24897 } 24898 24899 if (self.filterName && self.coverage) { 24900 if (self.filterName === 'COVERAGE' && L.isArray(self.coverage) && self.coverage.length) { 24901 for (i = 0; i < self.coverage.length; i++) { 24902 mod = self.coverage[i]; 24903 modInfo = self.getModuleInfo(mod); 24904 if (modInfo && modInfo.use) {
24905 mods = mods.concat(modInfo.use); 24906 } else { 24907 mods.push(mod); 24908 } 24909 } 24910 self.filters = self.filters || {}; 24911 Y.Array.each(mods, function(mod) { 24912 self.filters[mod] = self.FILTER_DEFS.COVERAGE; 24913 }); 24914 self.filterName = 'RAW'; 24915 self.filter = self.FILTER_DEFS[self.filterName]; 24916 } 24917 } 24918 24919 }, 24920 24921 /** 24922 * Returns the skin module name for the specified skin name. If a 24923 * module name is supplied, the returned skin module name is 24924 * specific to the module passed in. 24925 * @method formatSkin 24926 * @param {string} skin the name of the skin. 24927 * @param {string} mod optional: the name of a module to skin. 24928 * @return {string} the full skin module name. 24929 */ 24930 formatSkin: function(skin, mod) { 24931 var s = SKIN_PREFIX + skin; 24932 if (mod) { 24933 s = s + '-' + mod; 24934 } 24935 24936 return s; 24937 }, 24938 24939 /** 24940 * Adds the skin def to the module info 24941 * @method _addSkin 24942 * @param {string} skin the name of the skin. 24943 * @param {string} mod the name of the module. 24944 * @param {string} parent parent module if this is a skin of a 24945 * submodule or plugin. 24946 * @return {string} the module name for the skin. 24947 * @private 24948 */ 24949 _addSkin: function(skin, mod, parent) { 24950 var pkg, name, nmod, 24951 sinf = this.skin, 24952 mdef = mod && this.getModuleInfo(mod), 24953 ext = mdef && mdef.ext; 24954 24955 // Add a module definition for the module-specific skin css 24956 if (mod) { 24957 name = this.formatSkin(skin, mod); 24958 if (!this.getModuleInfo(name)) { 24959 pkg = mdef.pkg || mod; 24960 nmod = { 24961 skin: true, 24962 name: name, 24963 group: mdef.group, 24964 type: 'css', 24965 after: sinf.after, 24966 path: (parent || pkg) + '/' + sinf.base + skin + 24967 '/' + mod + '.css', 24968 ext: ext 24969 }; 24970 if (mdef.base) { 24971 nmod.base = mdef.base; 24972 } 24973 if (mdef.configFn) { 24974 nmod.configFn = mdef.configFn; 24975 } 24976 this.addModule(nmod, name); 24977 24978 } 24979 } 24980 24981 return name; 24982 }, 24983 /** 24984 * Adds an alias module to the system 24985 * @method addAlias 24986 * @param {Array} use An array of modules that makes up this alias 24987 * @param {String} name The name of the alias 24988 * @example 24989 * var loader = new Y.Loader({}); 24990 * loader.addAlias([ 'node', 'yql' ], 'davglass'); 24991 * loader.require(['davglass']); 24992 * var out = loader.resolve(true); 24993 * 24994 * //out.js will contain Node and YQL modules 24995 */ 24996 addAlias: function(use, name) { 24997 YUI.Env.aliases[name] = use; 24998 this.addModule({ 24999 name: name, 25000 use: use 25001 }); 25002 }, 25003 /** 25004 * Add a new module group 25005 * @method addGroup 25006 * @param {Object} config An object containing the group configuration data 25007 * @param {String} config.name required, the group name 25008 * @param {String} config.base The base directory for this module group 25009 * @param {String} config.root The root path to add to each combo resource path 25010 * @param {Boolean} config.combine Should the request be combined 25011 * @param {String} config.comboBase Combo service base path 25012 * @param {Object} config.modules The group of modules 25013 * @param {String} name the group name. 25014 * @example 25015 * var loader = new Y.Loader({}); 25016 * loader.addGroup({ 25017 * name: 'davglass', 25018 * combine: true, 25019 * comboBase: '/combo?', 25020 * root: '', 25021 * modules: { 25022 * //Module List here 25023 * } 25024 * }, 'davglass'); 25025 */ 25026 addGroup: function(o, name) { 25027 var mods = o.modules, 25028 self = this, 25029 defaultBase = o.defaultBase || Y.config.defaultBase, 25030 i, v; 25031 25032 name = name || o.name; 25033 o.name = name; 25034 self.groups[name] = o; 25035 25036 if (!o.base && defaultBase && o.root) { 25037 o.base = defaultBase + o.root; 25038 } 25039 25040 if (o.patterns) { 25041 for (i in o.patterns) { 25042 if (o.patterns.hasOwnProperty(i)) { 25043 o.patterns[i].group = name; 25044 self.patterns[i] = o.patterns[i]; 25045 } 25046 } 25047 } 25048 25049 if (mods) { 25050 for (i in mods) { 25051 if (mods.hasOwnProperty(i)) { 25052 v = mods[i]; 25053 if (typeof v === 'string') { 25054 v = { name: i, fullpath: v }; 25055 } 25056 v.group = name; 25057 self.addModule(v, i); 25058 } 25059 } 25060 } 25061 }, 25062 25063 /** 25064 * Add a new module to the component metadata. 25065 * @method addModule 25066 * @param {Object}
25066 config An object containing the module data. 25067 * @param {String} config.name Required, the component name 25068 * @param {String} config.type Required, the component type (js or css) 25069 * @param {String} config.path Required, the path to the script from `base` 25070 * @param {Array} config.requires Array of modules required by this component 25071 * @param {Array} [config.optional] Array of optional modules for this component 25072 * @param {Array} [config.supersedes] Array of the modules this component replaces 25073 * @param {Array} [config.after] Array of modules the components which, if present, should be sorted above this one 25074 * @param {Object} [config.after_map] Faster alternative to 'after' -- supply a hash instead of an array 25075 * @param {Number} [config.rollup] The number of superseded modules required for automatic rollup 25076 * @param {String} [config.fullpath] If `fullpath` is specified, this is used instead of the configured `base + path` 25077 * @param {Boolean} [config.skinnable] Flag to determine if skin assets should automatically be pulled in 25078 * @param {Object} [config.submodules] Hash of submodules 25079 * @param {String} [config.group] The group the module belongs to -- this is set automatically when it is added as part of a group configuration. 25080 * @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"]` 25081 * @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: 25082 * @param {String} [config.condition.trigger] The name of a module that can trigger the auto-load 25083 * @param {Function} [config.condition.test] A function that returns true when the module is to be loaded. 25084 * @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"`. 25085 * @param {String} [config.condition.when] Specifies the load order of the conditional module 25086 * with regard to the position of the trigger module. 25087 * This should be one of three values: `before`, `after`, or `instead`. The default is `after`. 25088 * @param {Object} [config.testresults] A hash of test results from `Y.Features.all()` 25089 * @param {Function} [config.configFn] A function to exectute when configuring this module 25090 * @param {Object} config.configFn.mod The module config, modifying this object will modify it's config. Returning false will delete the module's config. 25091 * @param {String[]} [config.optionalRequires] List of dependencies that 25092 may optionally be loaded by this loader. This is targeted mostly at 25093 polyfills, since they should not be in the list of requires because 25094 polyfills are assumed to be available in the global scope. 25095 * @param {Function} [config.test] Test to be called when this module is 25096 added as an optional dependency of another module. If the test function 25097 returns `false`, the module will be ignored and will not be attached to 25098 this YUI instance. 25099 * @param {String} [name] The module name, required if not in the module data. 25100 * @return {Object} the module definition or null if the object passed in did not provide all required attributes. 25101 */ 25102 addModule: function(o, name) { 25103 name = name || o.name; 25104 25105 if (typeof o === 'string') { 25106 o = { name: name, fullpath: o }; 25107 } 25108 25109 25110 var subs, i, l, t, sup, s, smod, plugins, plug, 25111 j, langs, packName, supName, flatSup, flatLang, lang, ret, 25112 overrides, skinname, when, g, p, 25113 modInfo = this.moduleInfo[name], 25114 conditions = this.conditions, trigger; 25115 25116 //Only merge this data if the temp flag is set 25117 //from an earlier pass from a pattern or else 25118 //an override module (YUI_config) can not be used to 25119 //replace a default module. 25120 if (modInfo && modInfo.temp) { 25121 //This catches temp modules loaded via a pattern 25122 // The module will be added twice, once from the pattern and 25123 // Once from the actual add call, this ensures that properties 25124 // that were added to the module the first time around (group: gallery) 25125 // are also added the second time around too. 25126 o = Y.merge(modInfo, o); 25127 } 25128 25129 o.name = name; 25130 25131 if (!o || !o.name) { 25132 return null; 25133 } 25134 25135 if (!o.type) { 25136 //Always assume it's javascript unless the CSS pattern is matched. 25137 o.type = JS; 25138 p = o.path || o.fullpath; 25139 if (p && this.REGEX_CSS.test(p)) { 25140 o.type = CSS; 25141 } 25142 } 25143 25144 if (!o.path && !o.fullpath) { 25145 o.path = _path(name, name, o.type); 25146 } 25147 o.supersedes = o.supersedes || o.use; 25148 25149 o.ext = ('ext' in o) ? o.ext : (this._internal) ? false : true; 25150 25151 // Handle submodule logic 25152 subs = o.submodules; 25153 25154 this.moduleInfo[name] = o; 25155 25156 o.requires = o.requires || []; 25157 25158 /* 25159 Only allowing the cascade of requires information, since 25160 optional and supersedes are far more fine grained than 25161 a blanket requires is. 25162 */ 25163 if (this.requires) { 25164 for (i = 0; i < this.requires.length; i++) { 25165 o.requires.push(this.requires[i]); 25166 } 25167 } 25168 if (o.group && this.groups && this.groups[o.group]) { 25169 g = this.groups[o.group]; 25170 if (g.requires) { 25171 for (i = 0; i < g.requires.length; i++) { 25172 o.requires.push(g.requires[i]); 25173 } 25174 } 25175 } 25176 25177 25178 if (!o.defaults) { 25179 o.defaults = { 25180 requires: o.requires ? [].concat(o.requires) : null, 25181 supersedes: o.supersedes ? [].concat(o.supersedes) : null, 25182 optional: o.optional ? [].concat(o.optional) : null 25183 }; 25184 } 25185 25186 if (o.skinnable && o.ext && o.temp) { 25187 skinname = this._addSkin(this.skin.defaultSkin, name); 25188 o.requires.unshift(skinname); 25189 } 25190 25191 if (o.requires.length) { 25192 o.requires = this.filterRequires(o.requires) || []; 25193 } 25194 25195 if (!o.langPack && o.lang) { 25196 // Setup root package by default as a fallback 25197 // for languages that are not defined 25198 packName = this.getLangPackName(ROOT_LANG, name); 25199 smod = this.getModuleInfo(packName); 25200 25201 if (!smod) { 25202 this._addLangPack(null, o, packName); 25203 } 25204 25205 langs = yArray(o.lang); 25206 25207 for (j = 0; j < langs.length; j++) { 25208 lang = langs[j]; 25209 packName = this.getLangPackName(lang, name); 25210 smod = this.getModuleInfo(packName); 25211 if (!smod) { 25212 smod = this._addLangPack(lang, o, packName); 25213 } 25214 } 25215 } 25216 25217 25218 if (subs) { 25219 sup = o.supersedes || []; 25220 l = 0; 25221 25222 for (i in subs) { 25223 if (subs.hasOwnProperty(i)) { 25224 s = subs[i]; 25225 25226 s.path = s.path || _path(name, i, o.type); 25227 s.pkg = name; 25228 s.group = o.group; 25229 25230 if (s.supersedes) { 25231 sup = sup.concat(s.supersedes); 25232 } 25233 25234 smod = this.addModule(s, i); 25235 sup.push(i); 25236 25237 if (smod.skinnable) { 25238 o.skinnable = true; 25239 overrides = this.skin.overrides; 25240 if (overrides && overrides[i]) { 25241 for (j = 0; j < overrides[i].length; j++) { 25242 skinname = this._addSkin(overrides[i][j], 25243 i, name); 25244 sup.push(skinname); 25245 } 25246 } 25247 skinname = this._addSkin(this.skin.defaultSkin, 25248 i, name); 25249 sup.push(skinname); 25250 } 25251 25252 // looks like we are expected to work out the metadata 25253 // for the parent module language packs from what is 25254 // specified in the child modules. 25255 if (s.lang && s.lang.length) { 25256 // Setup root package by default as a fallback 25257 // for languages that are not defined 25258 packName = this.getLangPackName(ROOT_LANG, name); 25259 smod = this.getModuleInfo(packName); 25260 25261 if (!smod) { 25262 this._addLangPack(null, o, packName); 25263 } 25264 25265 langs = yArray(s.lang); 25266 25267 for (j = 0; j < langs.length; j++) { 25268 lang = langs[j]; 25269 packName = this.getLangPackName(lang, name); 25270 supName = this.getLangPackName(lang, i); 25271 smod = this.getModuleInfo(packName); 25272 25273 if (!smod) { 25274 smod = this._addLangPack(lang, o, packName); 25275 } 25276 25277 flatSup = flatSup || yArray.hash(smod.supersedes); 25278 25279 if (!(supName in flatSup)) { 25280 smod.supersedes.push(supName); 25281 } 25282 25283 o.lang = o.lang || []; 25284 25285 flatLang = flatLang || yArray.hash(o.lang); 25286 25287 if (!(lang in flatLang)) { 25288 o.lang.push(lang); 25289 } 25290 25291// Add rollup file, need to add to supersedes list too 25292 25293 // default packages 25294 packName = this.getLangPackName(ROOT_LANG, name); 25295 supName = this.getLangPackName(ROOT_LANG, i); 25296 25297 smod = this.getModuleInfo(packName); 25298 25299 if (!smod) { 25300 smod = this._addLangPack(lang, o, packName); 25301 } 25302 25303 if (!(supName in flatSup)) { 25304 smod.supersedes.push(supName); 25305 } 25306 25307// Add rollup file, need to add to supersedes list too 25308 25309 } 25310 } 25311 25312 l++; 25313 } 25314 } 25315 //o.supersedes = YObject.keys(yArray.hash(sup)); 25316 o.supersedes = yArray.dedupe(sup); 25317 if (this.allowRollup) { 25318 o.rollup = (l < 4) ? l : Math.min(l - 1, 4); 25319 } 25320 } 25321 25322 plugins = o.plugins; 25323 if (plugins) { 25324 for (i in plugins) { 25325 if (plugins.hasOwnProperty(i)) { 25326 plug = plugins[i]; 25327 plug.pkg = name; 25328 plug.path = plug.path || _path(name, i, o.type); 25329 plug.requires = plug.requires || []; 25330 plug.group = o.group; 25331 this.addModule(plug, i); 25332 if (o.skinnable) { 25333 this._addSkin(this.skin.defaultSkin, i, name); 25334 } 25335 25336 } 25337 } 25338 } 25339 25340 if (o.condition) { 25341 t = this._expandAliases(o.condition.trigger); 25342 for (i = 0; i < t.length; i++) { 25343 trigger = t[i]; 25344 when = o.condition.when; 25345 conditions[trigger] = conditions[trigger] || {}; 25346 conditions[trigger][name] = o.condition; 25347 // the 'when' attribute can be 'before', 'after', or 'instead' 25348 // the default is after. 25349 if (when && when !== 'after') { 25350 if (when === 'instead') { // replace the trigger 25351 o.supersedes = o.supersedes || []; 25352 o.supersedes.push(trigger); 25353 } 25354 // before the trigger 25355 // the trigger requires the conditional mod, 25356 // so it should appear before the conditional 25357 // mod if we do not intersede. 25358 } else { // after the trigger 25359 o.after = o.after || []; 25360 o.after.push(trigger); 25361 } 25362 } 25363 } 25364 25365 if (o.supersedes) { 25366 o.supersedes = this.filterRequires(o.supersedes); 25367 } 25368 25369 if (o.after) { 25370 o.after = this.filterRequires(o.after); 25371 o.after_map = yArray.hash(o.after); 25372 } 25373 25374 // this.dirty = true; 25375 25376 if (o.configFn) { 25377 ret = o.configFn(o); 25378 if (ret === false) { 25379 delete this.moduleInfo[name]; 25380 delete GLOBAL_ENV._renderedMods[name]; 25381 o = null; 25382 } 25383 } 25384 //Add to global cache 25385 if (o) { 25386 if (!GLOBAL_ENV._renderedMods) { 25387 GLOBAL_ENV._renderedMods = {}; 25388 } 25389 GLOBAL_ENV._renderedMods[name] = Y.mix(GLOBAL_ENV._renderedMods[name] || {}, o);
25390 GLOBAL_ENV._conditions = conditions; 25391 } 25392 25393 return o; 25394 }, 25395 25396 /** 25397 * Add a requirement for one or more module 25398 * @method require 25399 * @param {string[] | string*} what the modules to load. 25400 */ 25401 require: function(what) { 25402 var a = (typeof what === 'string') ? yArray(arguments) : what; 25403 this.dirty = true; 25404 this.required = Y.merge(this.required, yArray.hash(this.filterRequires(a))); 25405 25406 this._explodeRollups(); 25407 }, 25408 /** 25409 * Grab all the items that were asked for, check to see if the Loader 25410 * meta-data contains a "use" array. If it doesm remove the asked item and replace it with 25411 * the content of the "use". 25412 * This will make asking for: "dd" 25413 * Actually ask for: "dd-ddm-base,dd-ddm,dd-ddm-drop,dd-drag,dd-proxy,dd-constrain,dd-drop,dd-scroll,dd-drop-plugin" 25414 * @private 25415 * @method _explodeRollups 25416 */ 25417 _explodeRollups: function() { 25418 var self = this, m, m2, i, a, v, len, len2, 25419 r = self.required; 25420 25421 if (!self.allowRollup) { 25422 for (i in r) { 25423 if (r.hasOwnProperty(i)) { 25424 m = self.getModule(i); 25425 if (m && m.use) { 25426 len = m.use.length; 25427 for (a = 0; a < len; a++) { 25428 m2 = self.getModule(m.use[a]); 25429 if (m2 && m2.use) { 25430 len2 = m2.use.length; 25431 for (v = 0; v < len2; v++) { 25432 r[m2.use[v]] = true; 25433 } 25434 } else { 25435 r[m.use[a]] = true; 25436 } 25437 } 25438 } 25439 } 25440 } 25441 self.required = r; 25442 } 25443 25444 }, 25445 /** 25446 * Explodes the required array to remove aliases and replace them with real modules 25447 * @method filterRequires 25448 * @param {Array} r The original requires array 25449 * @return {Array} The new array of exploded requirements 25450 */ 25451 filterRequires: function(r) { 25452 if (r) { 25453 if (!Y.Lang.isArray(r)) { 25454 r = [r]; 25455 } 25456 r = Y.Array(r); 25457 var c = [], i, mod, o, m; 25458 25459 for (i = 0; i < r.length; i++) { 25460 mod = this.getModule(r[i]); 25461 if (mod && mod.use) { 25462 for (o = 0; o < mod.use.length; o++) { 25463 //Must walk the other modules in case a module is a rollup of rollups (datatype) 25464 m = this.getModule(mod.use[o]); 25465 if (m && m.use && (m.name !== mod.name)) { 25466 c = Y.Array.dedupe([].concat(c, this.filterRequires(m.use))); 25467 } else { 25468 c.push(mod.use[o]); 25469 } 25470 } 25471 } else { 25472 c.push(r[i]); 25473 } 25474 } 25475 r = c; 25476 } 25477 return r; 25478 }, 25479 25480 /** 25481 Returns `true` if the module can be attached to the YUI instance. Runs 25482 the module's test if there is one and caches its result. 25483 25484 @method _canBeAttached 25485 @param {String} module Name of the module to check. 25486 @return {Boolean} Result of the module's test if it has one, or `true`. 25487 **/ 25488 _canBeAttached: function (m) { 25489 m = this.getModule(m); 25490 if (m && m.test) { 25491 if (!m.hasOwnProperty('_testResult')) { 25492 m._testResult = m.test(Y); 25493 } 25494 return m._testResult; 25495 } 25496 // return `true` for modules not registered as Loader will know what 25497 // to do with them later on 25498 return true; 25499 }, 25500 25501 /**
25502 * Returns an object containing properties for all modules required 25503 * in order to load the requested module 25504 * @method getRequires 25505 * @param {object} mod The module definition from moduleInfo. 25506 * @return {array} the expanded requirement list. 25507 */ 25508 getRequires: function(mod) { 25509 25510 if (!mod) { 25511 //console.log('returning no reqs for ' + mod.name); 25512 return NO_REQUIREMENTS; 25513 } 25514 25515 if (mod._parsed) { 25516 //console.log('returning requires for ' + mod.name, mod.requires); 25517 return mod.expanded || NO_REQUIREMENTS; 25518 } 25519 25520 //TODO add modue cache here out of scope.. 25521 25522 var i, m, j, length, add, packName, lang, testresults = this.testresults, 25523 name = mod.name, cond, 25524 adddef = ON_PAGE[name] && ON_PAGE[name].details, 25525 optReqs = mod.optionalRequires, 25526 d, go, def, 25527 r, old_mod, 25528 o, skinmod, skindef, skinpar, skinname, 25529 intl = mod.lang || mod.intl, 25530 ftests = Y.Features && Y.Features.tests.load, 25531 hash, reparse; 25532 25533 // console.log(name); 25534 25535 // pattern match leaves module stub that needs to be filled out 25536 if (mod.temp && adddef) { 25537 old_mod = mod; 25538 mod = this.addModule(adddef, name); 25539 mod.group = old_mod.group; 25540 mod.pkg = old_mod.pkg; 25541 delete mod.expanded; 25542 } 25543 25544 // console.log('cache: ' + mod.langCache + ' == ' + this.lang); 25545 25546 //If a skin or a lang is different, reparse.. 25547 reparse = !((!this.lang || mod.langCache === this.lang) && (mod.skinCache === this.skin.defaultSkin)); 25548 25549 if (mod.expanded && !reparse) { 25550 return mod.expanded; 25551 } 25552 25553 // Optional dependencies are dependencies that may or may not be 25554 // available. 25555 // This feature was designed specifically to be used when transpiling 25556 // ES6 modules, in order to use polyfills and regular scripts that define 25557 // global variables without having to import them since they should be 25558 // available in the global scope. 25559 if (optReqs) { 25560 for (i = 0, length = optReqs.length; i < length; i++) { 25561 if (this._canBeAttached(optReqs[i])) { 25562 mod.requires.push(optReqs[i]); 25563 } 25564 } 25565 } 25566 25567 d = []; 25568 hash = {}; 25569 r = this.filterRequires(mod.requires); 25570 if (mod.lang) { 25571 //If a module has a lang attribute, auto add the intl requirement. 25572 d.unshift('intl'); 25573 r.unshift('intl'); 25574 intl = true; 25575 } 25576 o = this.filterRequires(mod.optional); 25577 25578 25579 mod._parsed = true; 25580 mod.langCache = this.lang; 25581 mod.skinCache = this.skin.defaultSkin; 25582 25583 for (i = 0; i < r.length; i++) { 25584 if (!hash[r[i]]) { 25585 d.push(r[i]); 25586 hash[r[i]] = true; 25587 m = this.getModule(r[i]); 25588 if (m) { 25589 add = this.getRequires(m); 25590 intl = intl || (m.expanded_map && 25591 (INTL in m.expanded_map)); 25592 for (j = 0; j < add.length; j++) { 25593 d.push(add[j]); 25594 } 25595 } 25596 } 25597 } 25598 25599 // get the requirements from superseded modules, if any 25600 r = this.filterRequires(mod.supersedes); 25601 if (r) { 25602 for (i = 0; i < r.length; i++) { 25603 if (!hash[r[i]]) { 25604 // if this module has submodules, the requirements list is 25605 // expanded to include the submodules. This is so we can 25606 // prevent dups when a submodule is already loaded and the 25607 // parent is requested. 25608 if (mod.submodules) { 25609 d.push(r[i]); 25610 } 25611 25612 hash[r[i]] = true; 25613 m = this.getModule(r[i]); 25614 25615 if (m) { 25616 add = this.getRequires(m); 25617 intl = intl || (m.expanded_map && 25618 (INTL in m.expanded_map)); 25619 for (j = 0; j < add.length; j++) { 25620 d.push(add[j]); 25621 } 25622 } 25623 } 25624 } 25625 } 25626 25627 if (o && this.loadOptional) { 25628 for (i = 0; i < o.length; i++) { 25629 if (!hash[o[i]]) { 25630 d.push(o[i]); 25631 hash[o[i]] = true; 25632 m = this.getModuleInfo(o[i]); 25633 if (m) { 25634 add = this.getRequires(m); 25635 intl = intl || (m.expanded_map && 25636 (INTL in m.expanded_map)); 25637 for (j = 0; j < add.length; j++) { 25638 d.push(add[j]); 25639 } 25640 } 25641 } 25642 } 25643 } 25644 25645 cond = this.conditions[name]; 25646 25647 if (cond) { 25648 //Set the module to not parsed since we have conditionals and this could change the dependency tree. 25649 mod._parsed = false;
25650 if (testresults && ftests) { 25651 oeach(testresults, function(result, id) { 25652 var condmod = ftests[id].name; 25653 if (!hash[condmod] && ftests[id].trigger === name) { 25654 if (result && ftests[id]) { 25655 hash[condmod] = true; 25656 d.push(condmod); 25657 } 25658 } 25659 }); 25660 } else { 25661 for (i in cond) { 25662 if (cond.hasOwnProperty(i)) { 25663 if (!hash[i]) { 25664 def = cond[i]; 25665 //first see if they've specfied a ua check 25666 //then see if they've got a test fn & if it returns true 25667 //otherwise just having a condition block is enough 25668 go = def && ((!def.ua && !def.test) || (def.ua && Y.UA[def.ua]) || 25669 (def.test && def.test(Y, r))); 25670 25671 if (go) { 25672 hash[i] = true; 25673 d.push(i); 25674 m = this.getModule(i); 25675 if (m) { 25676 add = this.getRequires(m); 25677 for (j = 0; j < add.length; j++) { 25678 d.push(add[j]); 25679 } 25680 25681 } 25682 } 25683 } 25684 } 25685 } 25686 } 25687 } 25688 25689 // Create skin modules 25690 if (mod.skinnable) { 25691 skindef = this.skin.overrides; 25692 for (i in YUI.Env.aliases) { 25693 if (YUI.Env.aliases.hasOwnProperty(i)) { 25694 if (Y.Array.indexOf(YUI.Env.aliases[i], name) > -1) { 25695 skinpar = i; 25696 } 25697 } 25698 } 25699 if (skindef && (skindef[name] || (skinpar && skindef[skinpar]))) { 25700 skinname = name; 25701 if (skindef[skinpar]) { 25702 skinname = skinpar; 25703 } 25704 for (i = 0; i < skindef[skinname].length; i++) { 25705 skinmod = this._addSkin(skindef[skinname][i], name); 25706 if (!this.isCSSLoaded(skinmod, this._boot)) { 25707 d.push(skinmod); 25708 } 25709 } 25710 } else { 25711 skinmod = this._addSkin(this.skin.defaultSkin, name); 25712 if (!this.isCSSLoaded(skinmod, this._boot)) { 25713 d.push(skinmod); 25714 } 25715 } 25716 } 25717 25718 mod._parsed = false; 25719 25720 if (intl) { 25721 25722 if (mod.lang && !mod.langPack && Y.Intl) { 25723 lang = Y.Intl.lookupBestLang(this.lang || ROOT_LANG, mod.lang); 25724 packName = this.getLangPackName(lang, name); 25725 if (packName) { 25726 d.unshift(packName); 25727 } 25728 } 25729 d.unshift(INTL); 25730 } 25731 25732 mod.expanded_map = yArray.hash(d); 25733 25734 mod.expanded = YObject.keys(mod.expanded_map); 25735 25736 return mod.expanded; 25737 }, 25738 /** 25739 * Check to see if named css module is already loaded on the page 25740 * @method isCSSLoaded 25741 * @param {String} name The name of the css file 25742 * @param {Boolean} skip To skip the short-circuit for ignoreRegister 25743 * @return Boolean 25744 */ 25745 isCSSLoaded: function(name, skip) { 25746 //TODO - Make this call a batching call with name being an array 25747 if (!name || !YUI.Env.cssStampEl || (!skip && this.ignoreRegistered)) { 25748 return false; 25749 } 25750 var el = YUI.Env.cssStampEl, 25751 ret = false, 25752 mod = YUI.Env._cssLoaded[name], 25753 style = el.currentStyle; //IE 25754 25755 25756 if (mod !== undefined) { 25757 return mod; 25758 } 25759 25760 //Add the classname to the element 25761 el.className = name; 25762 25763 if (!style) { 25764 style = Y.config.doc.defaultView.getComputedStyle(el, null); 25765 } 25766 25767 if (style && style.display === 'none') { 25768 ret = true; 25769 } 25770 25771 25772 el.className = ''; //Reset the classname to '' 25773 25774 YUI.Env._cssLoaded[name] = ret; 25775 25776 return ret; 25777 }, 25778 25779 /** 25780 * Returns a hash of module names the supplied module satisfies. 25781 * @method getProvides 25782 * @param {string} name The name of the module. 25783 * @return {object} what this module provides. 25784 */ 25785 getProvides: function(name) { 25786 var m = this.getModule(name), o, s; 25787 // supmap = this.provides; 25788 25789 if (!m) { 25790 return NOT_FOUND; 25791 } 25792 25793 if (m && !m.provides) { 25794 o = {}; 25795 s = m.supersedes; 25796 25797 if (s) { 25798 yArray.each(s, function(v) { 25799 Y.mix(o, this.getProvides(v)); 25800 }, this); 25801 } 25802 25803 o[name] = true; 25804 m.provides = o; 25805 25806 } 25807 25808 return m.provides; 25809 }, 25810 25811 /** 25812 * Calculates the dependency tree, the result is stored in the sorted 25813 * property. 25814 * @method calculate 25815 * @param {object} o optional options object. 25816 * @param {string} type optional argument to prune modules. 25817 */ 25818 calculate: function(o, type) { 25819 if (o || type || this.dirty) { 25820 25821 if (o) { 25822 this._config(o); 25823 } 25824 25825 if (!this._init) { 25826 this._setup(); 25827 } 25828 25829 this._explode(); 25830 25831 if (this.allowRollup) { 25832 this._rollup(); 25833 } else { 25834 this._explodeRollups(); 25835 } 25836 this._reduce(); 25837 this._sort(); 25838 } 25839 }, 25840 /** 25841 * Creates a "psuedo" package for languages provided in the lang array 25842 * @method _addLangPack 25843 * @private 25844 * @param {String} lang The language to create 25845 * @param {Object} m The module definition to create the language pack around 25846 * @param {String} packName The name of the package (e.g: lang/datatype-date-en-US) 25847 * @return {Object} The module definition 25848 */ 25849 _addLangPack: function(lang, m, packName) { 25850 var name = m.name, 25851 packPath, conf, 25852 existing = this.getModuleInfo(packName); 25853 25854 if (!existing) { 25855 25856 packPath = _path((m.pkg || name), packName, JS, true); 25857 25858 conf = { 25859 path: packPath, 25860 intl: true, 25861 langPack: true, 25862 ext: m.ext, 25863 group: m.group, 25864 supersedes: [] 25865 }; 25866 if (m.root) { 25867 conf.root = m.root; 25868 } 25869 if (m.base) { 25870 conf.base = m.base; 25871 } 25872 25873 if (m.configFn) { 25874 conf.configFn = m.configFn; 25875 } 25876 25877 this.addModule(conf, packName); 25878 25879 if (lang) { 25880 Y.Env.lang = Y.Env.lang || {};
25881 Y.Env.lang[lang] = Y.Env.lang[lang] || {}; 25882 Y.Env.lang[lang][name] = true; 25883 } 25884 } 25885 25886 return this.getModuleInfo(packName); 25887 }, 25888 25889 /** 25890 * Investigates the current YUI configuration on the page. By default, 25891 * modules already detected will not be loaded again unless a force 25892 * option is encountered. Called by calculate() 25893 * @method _setup 25894 * @private 25895 */ 25896 _setup: function() { 25897 var info = this.moduleInfo, name, i, j, m, l, 25898 packName; 25899 25900 for (name in info) { 25901 if (info.hasOwnProperty(name)) { 25902 m = info[name]; 25903 if (m) { 25904 25905 // remove dups 25906 //m.requires = YObject.keys(yArray.hash(m.requires)); 25907 m.requires = yArray.dedupe(m.requires); 25908 25909 // Create lang pack modules 25910 //if (m.lang && m.lang.length) { 25911 if (m.lang) { 25912 // Setup root package if the module has lang defined, 25913 // it needs to provide a root language pack 25914 packName = this.getLangPackName(ROOT_LANG, name); 25915 this._addLangPack(null, m, packName); 25916 } 25917 25918 } 25919 } 25920 } 25921 25922 25923 //l = Y.merge(this.inserted); 25924 l = {}; 25925 25926 // available modules 25927 if (!this.ignoreRegistered) { 25928 Y.mix(l, GLOBAL_ENV.mods); 25929 } 25930 25931 // add the ignore list to the list of loaded packages 25932 if (this.ignore) { 25933 Y.mix(l, yArray.hash(this.ignore)); 25934 } 25935 25936 // expand the list to include superseded modules 25937 for (j in l) { 25938 if (l.hasOwnProperty(j)) { 25939 Y.mix(l, this.getProvides(j)); 25940 } 25941 } 25942 25943 // remove modules on the force list from the loaded list 25944 if (this.force) { 25945 for (i = 0; i < this.force.length; i++) { 25946 if (this.force[i] in l) { 25947 delete l[this.force[i]]; 25948 } 25949 } 25950 } 25951 25952 Y.mix(this.loaded, l); 25953 25954 this._init = true; 25955 }, 25956 25957 /** 25958 * Builds a module name for a language pack 25959 * @method getLangPackName 25960 * @param {string} lang the language code. 25961 * @param {string} mname the module to build it for. 25962 * @return {string} the language pack module name. 25963 */ 25964 getLangPackName: function(lang, mname) { 25965 return ('lang/' + mname + ((lang) ? '_' + lang : '')); 25966 }, 25967 /** 25968 * Inspects the required modules list looking for additional 25969 * dependencies. Expands the required list to include all 25970 * required modules. Called by calculate() 25971 * @method _explode 25972 * @private 25973 */ 25974 _explode: function() { 25975 //TODO Move done out of scope 25976 var r = this.required, m, reqs, done = {}, 25977 self = this, name, expound; 25978 25979 // the setup phase is over, all modules have been created 25980 self.dirty = false; 25981 25982 self._explodeRollups(); 25983 r = self.required; 25984 25985 for (name in r) { 25986 if (r.hasOwnProperty(name)) { 25987 if (!done[name]) { 25988 done[name] = true; 25989 m = self.getModule(name); 25990 if (m) { 25991 expound = m.expound; 25992 25993 if (expound) { 25994 r[expound] = self.getModule(expound); 25995 reqs = self.getRequires(r[expound]); 25996 Y.mix(r, yArray.hash(reqs)); 25997 } 25998 25999 reqs = self.getRequires(m); 26000 Y.mix(r, yArray.hash(reqs)); 26001 } 26002 } 26003 } 26004 } 26005 26006 }, 26007 /** 26008 * The default method used to test a module against a pattern 26009 * @method _patternTest 26010 * @private 26011 * @param {String} mname The module being tested 26012 * @param {String} pname The pattern to match 26013 */ 26014 _patternTest: function(mname, pname) { 26015 return (mname.indexOf(pname) > -1); 26016 }, 26017 /** 26018 * Get's the loader meta data for the requested module 26019 * @method getModule 26020 * @param {String} mname The module name to get 26021 * @return {Object} The module metadata 26022 */
26023 getModule: function(mname) { 26024 //TODO: Remove name check - it's a quick hack to fix pattern WIP 26025 if (!mname) { 26026 return null; 26027 } 26028 26029 var p, found, pname, 26030 m = this.getModuleInfo(mname), 26031 patterns = this.patterns; 26032 26033 // check the patterns library to see if we should automatically add 26034 // the module with defaults 26035 if (!m || (m && m.ext)) { 26036 for (pname in patterns) { 26037 if (patterns.hasOwnProperty(pname)) { 26038 p = patterns[pname]; 26039 26040 //There is no test method, create a default one that tests 26041 // the pattern against the mod name 26042 if (!p.test) { 26043 p.test = this._patternTest; 26044 } 26045 26046 if (p.test(mname, pname)) { 26047 // use the metadata supplied for the pattern 26048 // as the module definition. 26049 found = p; 26050 break; 26051 } 26052 } 26053 } 26054 } 26055 26056 if (!m) { 26057 if (found) { 26058 if (p.action) { 26059 p.action.call(this, mname, pname); 26060 } else { 26061 // ext true or false? 26062 m = this.addModule(Y.merge(found, { 26063 test: void 0, 26064 temp: true 26065 }), mname); 26066 if (m && found.configFn) { 26067 m.configFn = found.configFn; 26068 } 26069 } 26070 } 26071 } else { 26072 if (found && m && found.configFn && !m.configFn) { 26073 m.configFn = found.configFn; 26074 m.configFn(m); 26075 } 26076 } 26077 26078 return m; 26079 }, 26080 26081 // impl in rollup submodule 26082 _rollup: function() { }, 26083 26084 /** 26085 * Remove superceded modules and loaded modules. Called by 26086 * calculate() after we have the mega list of all dependencies 26087 * @method _reduce 26088 * @return {object} the reduced dependency hash. 26089 * @private 26090 */ 26091 _reduce: function(r) { 26092 26093 r = r || this.required; 26094 26095 var i, j, s, m, type = this.loadType, 26096 ignore = this.ignore ? yArray.hash(this.ignore) : false; 26097 26098 for (i in r) { 26099 if (r.hasOwnProperty(i)) { 26100 m = this.getModule(i); 26101 // remove if already loaded 26102 if (((this.loaded[i] || ON_PAGE[i]) && 26103 !this.forceMap[i] && !this.ignoreRegistered) || 26104 (type && m && m.type !== type)) { 26105 delete r[i]; 26106 } 26107 if (ignore && ignore[i]) { 26108 delete r[i]; 26109 } 26110 // remove anything this module supersedes 26111 s = m && m.supersedes; 26112 if (s) { 26113 for (j = 0; j < s.length; j++) { 26114 if (s[j] in r) { 26115 delete r[s[j]]; 26116 } 26117 } 26118 } 26119 } 26120 } 26121 26122 return r; 26123 }, 26124 /** 26125 * Handles the queue when a module has been loaded for all cases 26126 * @method _finish 26127 * @private 26128 * @param {String} msg The message from Loader 26129 * @param {Boolean} success A boolean denoting success or failure 26130 */ 26131 _finish: function(msg, success) { 26132 26133 _queue.running = false; 26134 26135 var onEnd = this.onEnd; 26136 if (onEnd) { 26137 onEnd.call(this.context, { 26138 msg: msg, 26139 data: this.data, 26140 success: success 26141 }); 26142 } 26143 this._continue(); 26144 }, 26145 /** 26146 * The default Loader onSuccess handler, calls this.onSuccess with a payload 26147 * @method _onSuccess 26148 * @private 26149 */ 26150 _onSuccess: function() { 26151 var self = this, skipped = Y.merge(self.skipped), fn, 26152 failed = [], rreg = self.requireRegistration, 26153 success, msg, i, mod; 26154 26155 for (i in skipped) { 26156 if (skipped.hasOwnProperty(i)) { 26157 delete self.inserted[i]; 26158 } 26159 } 26160 26161 self.skipped = {}; 26162 26163 for (i in self.inserted) { 26164 if (self.inserted.hasOwnProperty(i)) { 26165 mod = self.getModule(i); 26166 if (mod && rreg && mod.type === JS && !(i in YUI.Env.mods)) { 26167 failed.push(i); 26168 } else { 26169 Y.mix(self.loaded, self.getProvides(i)); 26170 } 26171 } 26172 } 26173 26174 fn = self.onSuccess; 26175 msg = (failed.length) ? 'notregistered' : 'success'; 26176 success = !(failed.length); 26177 if (fn) { 26178 fn.call(self.context, { 26179 msg: msg, 26180 data: self.data, 26181 success: success, 26182 failed: failed, 26183 skipped: skipped 26184 }); 26185 } 26186 self._finish(msg, success); 26187 }, 26188 /** 26189 * The default Loader onProgress handler, calls this.onProgress with a payload 26190 * @method _onProgress 26191 * @private 26192 */ 26193 _onProgress: function(e) { 26194 var self = this, i;
26195 //set the internal cache to what just came in. 26196 if (e.data && e.data.length) { 26197 for (i = 0; i < e.data.length; i++) { 26198 e.data[i] = self.getModule(e.data[i].name); 26199 } 26200 } 26201 if (self.onProgress) { 26202 self.onProgress.call(self.context, { 26203 name: e.url, 26204 data: e.data 26205 }); 26206 } 26207 }, 26208 /** 26209 * The default Loader onFailure handler, calls this.onFailure with a payload 26210 * @method _onFailure 26211 * @private 26212 */ 26213 _onFailure: function(o) { 26214 var f = this.onFailure, msg = [], i = 0, len = o.errors.length; 26215 26216 for (i; i < len; i++) { 26217 msg.push(o.errors[i].error); 26218 } 26219 26220 msg = msg.join(','); 26221 26222 26223 if (f) { 26224 f.call(this.context, { 26225 msg: msg, 26226 data: this.data, 26227 success: false 26228 }); 26229 } 26230 26231 this._finish(msg, false); 26232 26233 }, 26234 26235 /** 26236 * The default Loader onTimeout handler, calls this.onTimeout with a payload 26237 * @method _onTimeout 26238 * @param {Get.Transaction} transaction The Transaction object from `Y.Get` 26239 * @private 26240 */ 26241 _onTimeout: function(transaction) { 26242 var f = this.onTimeout; 26243 if (f) { 26244 f.call(this.context, { 26245 msg: 'timeout', 26246 data: this.data, 26247 success: false, 26248 transaction: transaction 26249 }); 26250 } 26251 }, 26252 26253 /** 26254 * Sorts the dependency tree. The last step of calculate() 26255 * @method _sort 26256 * @private 26257 */ 26258 _sort: function() { 26259 var name, 26260 26261 // Object containing module names. 26262 required = this.required, 26263 26264 // Keep track of whether we've visited a module. 26265 visited = {}; 26266 26267 // Will contain modules names, in the correct order, 26268 // according to dependencies. 26269 this.sorted = []; 26270 26271 for (name in required) { 26272 if (!visited[name] && required.hasOwnProperty(name)) { 26273 this._visit(name, visited); 26274 } 26275 } 26276 }, 26277 26278 /** 26279 * Recursively visits the dependencies of the module name 26280 * passed in, and appends each module name to the `sorted` property. 26281 * @param {String} name The name of a module. 26282 * @param {Object} visited Keeps track of whether a module was visited. 26283 * @method _visit 26284 * @private 26285 */ 26286 _visit: function (name, visited) { 26287 var required, condition, moduleInfo, dependency, dependencies, 26288 trigger, isAfter, i, l; 26289 26290 visited[name] = true; 26291 required = this.required; 26292 moduleInfo = this.moduleInfo[name]; 26293 condition = this.conditions[name] || {}; 26294 26295 if (moduleInfo) { 26296 // Recurse on each dependency of this module, 26297 // figuring out its dependencies, and so on. 26298 dependencies = moduleInfo.expanded || moduleInfo.requires; 26299 26300 for (i = 0, l = dependencies.length; i < l; ++i) { 26301 dependency = dependencies[i]; 26302 trigger = condition[dependency]; 26303 26304 // We cannot process this dependency yet if it must 26305 // appear after our current module. 26306 isAfter = trigger && (!trigger.when || trigger.when === "after"); 26307 26308 // Is this module name in the required list of modules, 26309 // and have we not already visited it? 26310 if (required[dependency] && !visited[dependency] && !isAfter) { 26311 this._visit(dependency, visited); 26312 } 26313 } 26314 } 26315 26316 this.sorted.push(name); 26317 }, 26318 26319 /** 26320 * Handles the actual insertion of script/link tags 26321 * @method _insert 26322 * @private 26323 * @param {Object} source The YUI instance the request came from 26324 * @param {Object} o The metadata to include 26325 * @param {String} type JS or CSS 26326 * @param {Boolean} [skipcalc=false] Do a Loader.calculate on the meta 26327 */ 26328 _insert: function(source, o, type, skipcalc) { 26329 26330 26331 // restore the state at the time of the request 26332 if (source) { 26333 this._config(source); 26334 } 26335 26336 // build the dependency list 26337 // don't include type so we can process CSS and script in 26338 // one pass when the type is not specified. 26339 26340 var modules = this.resolve(!skipcalc),
26341 self = this, comp = 0, actions = 0, 26342 mods = {}, deps, complete; 26343 26344 self._refetch = []; 26345 26346 if (type) { 26347 //Filter out the opposite type and reset the array so the checks later work 26348 modules[((type === JS) ? CSS : JS)] = []; 26349 } 26350 if (!self.fetchCSS) { 26351 modules.css = []; 26352 } 26353 if (modules.js.length) { 26354 comp++; 26355 } 26356 if (modules.css.length) { 26357 comp++; 26358 } 26359 26360 //console.log('Resolved Modules: ', modules); 26361 26362 complete = function(d) { 26363 actions++; 26364 var errs = {}, i = 0, o = 0, u = '', fn, 26365 modName, resMods; 26366 26367 if (d && d.errors) { 26368 for (i = 0; i < d.errors.length; i++) { 26369 if (d.errors[i].request) { 26370 u = d.errors[i].request.url; 26371 } else { 26372 u = d.errors[i]; 26373 } 26374 errs[u] = u; 26375 } 26376 } 26377 26378 if (d && d.data && d.data.length && (d.type === 'success')) { 26379 for (i = 0; i < d.data.length; i++) { 26380 self.inserted[d.data[i].name] = true; 26381 //If the external module has a skin or a lang, reprocess it 26382 if (d.data[i].lang || d.data[i].skinnable) { 26383 delete self.inserted[d.data[i].name]; 26384 self._refetch.push(d.data[i].name); 26385 } 26386 } 26387 } 26388 26389 if (actions === comp) { 26390 self._loading = null; 26391 if (self._refetch.length) { 26392 //Get the deps for the new meta-data and reprocess 26393 for (i = 0; i < self._refetch.length; i++) { 26394 deps = self.getRequires(self.getModule(self._refetch[i])); 26395 for (o = 0; o < deps.length; o++) { 26396 if (!self.inserted[deps[o]]) { 26397 //We wouldn't be to this point without the module being here 26398 mods[deps[o]] = deps[o]; 26399 } 26400 } 26401 } 26402 mods = Y.Object.keys(mods); 26403 if (mods.length) { 26404 self.require(mods); 26405 resMods = self.resolve(true);
26406 if (resMods.cssMods.length) { 26407 for (i=0; i < resMods.cssMods.length; i++) { 26408 modName = resMods.cssMods[i].name; 26409 delete YUI.Env._cssLoaded[modName]; 26410 if (self.isCSSLoaded(modName)) { 26411 self.inserted[modName] = true; 26412 delete self.required[modName]; 26413 } 26414 } 26415 self.sorted = []; 26416 self._sort(); 26417 } 26418 d = null; //bail 26419 self._insert(); //insert the new deps 26420 } 26421 } 26422 if (d && d.fn) { 26423 fn = d.fn; 26424 delete d.fn; 26425 fn.call(self, d); 26426 } 26427 } 26428 }; 26429 26430 this._loading = true; 26431 26432 if (!modules.js.length && !modules.css.length) { 26433 actions = -1; 26434 complete({ 26435 fn: self._onSuccess 26436 }); 26437 return; 26438 } 26439 26440 26441 if (modules.css.length) { //Load CSS first 26442 Y.Get.css(modules.css, { 26443 data: modules.cssMods, 26444 attributes: self.cssAttributes, 26445 insertBefore: self.insertBefore, 26446 charset: self.charset, 26447 timeout: self.timeout, 26448 context: self, 26449 onProgress: function(e) { 26450 self._onProgress.call(self, e); 26451 }, 26452 onTimeout: function(d) { 26453 self._onTimeout.call(self, d); 26454 }, 26455 onSuccess: function(d) { 26456 d.type = 'success'; 26457 d.fn = self._onSuccess; 26458 complete.call(self, d); 26459 }, 26460 onFailure: function(d) { 26461 d.type = 'failure'; 26462 d.fn = self._onFailure; 26463 complete.call(self, d); 26464 } 26465 }); 26466 } 26467 26468 if (modules.js.length) { 26469 Y.Get.js(modules.js, { 26470 data: modules.jsMods, 26471 insertBefore: self.insertBefore, 26472 attributes: self.jsAttributes, 26473 charset: self.charset, 26474 timeout: self.timeout, 26475 autopurge: false, 26476 context: self, 26477 async: self.async, 26478 onProgress: function(e) { 26479 self._onProgress.call(self, e); 26480 }, 26481 onTimeout: function(d) { 26482 self._onTimeout.call(self, d); 26483 }, 26484 onSuccess: function(d) { 26485 d.type = 'success'; 26486 d.fn = self._onSuccess; 26487 complete.call(self, d); 26488 }, 26489 onFailure: function(d) { 26490 d.type = 'failure'; 26491 d.fn = self._onFailure; 26492 complete.call(self, d); 26493 } 26494 }); 26495 } 26496 }, 26497 /** 26498 * Once a loader operation is completely finished, process any additional queued items. 26499 * @method _continue 26500 * @private 26501 */ 26502 _continue: function() { 26503 if (!(_queue.running) && _queue.size() > 0) { 26504 _queue.running = true; 26505 _queue.next()(); 26506 } 26507 }, 26508 26509 /** 26510 * inserts the requested modules and their dependencies. 26511 * <code>type</code> can be "js" or "css". Both script and 26512 * css are inserted if type is not provided. 26513 * @method insert 26514 * @param {object} o optional options object. 26515 * @param {string} type the type of dependency to insert. 26516 */ 26517 insert: function(o, type, skipsort) { 26518 var self = this, copy = Y.merge(this); 26519 delete copy.require; 26520 delete copy.dirty; 26521 _queue.add(function() { 26522 self._insert(copy, o, type, skipsort); 26523 }); 26524 this._continue(); 26525 }, 26526 26527 /** 26528 * Executed every time a module is loaded, and if we are in a load 26529 * cycle, we attempt to load the next script. Public so that it 26530 * is possible to call this if using a method other than 26531 * Y.register to determine when scripts are fully loaded 26532 * @method loadNext 26533 * @deprecated 26534 * @param {string} mname optional the name of the module that has 26535 * been loaded (which is usually why it is time to load the next 26536 * one). 26537 */ 26538 loadNext: function() { 26539 return; 26540 }, 26541 26542 /** 26543 * Apply filter defined for this instance to a url/path 26544 * @method _filter 26545 * @param {string} u the string to filter. 26546 * @param {string} name the name of the module, if we are processing 26547 * a single module as opposed to a combined url. 26548 * @return {string} the filtered string. 26549 * @private 26550 */ 26551 _filter: function(u, name, group) { 26552 var f = this.filter, 26553 hasFilter = name && (name in this.filters), 26554 modFilter = hasFilter && this.filters[name], 26555 groupName = group || (this.getModuleInfo(name) || {}).group || null; 26556 26557 if (groupName && this.groups[groupName] && this.groups[groupName].filter) { 26558 modFilter = this.groups[groupName].filter; 26559 hasFilter = true; 26560 } 26561 26562 if (u) { 26563 if (hasFilter) { 26564 f = (L.isString(modFilter)) ? this.FILTER_DEFS[modFilter.toUpperCase()] || null : modFilter; 26565 } 26566 if (f) { 26567 u = u.replace(new RegExp(f.searchExp, 'g'), f.replaceStr); 26568 } 26569 } 26570 return u; 26571 }, 26572 26573 /** 26574 * Generates the full url for a module 26575 * @method _url 26576 * @param {string} path the path fragment. 26577 * @param {String} name The name of the module 26578 * @param {String} [base] The base url to use. Defaults to self.base 26579 * @return {string} the full url. 26580 * @private 26581 */ 26582 _url: function(path, name, base) { 26583 return this._filter((base || this.base || '') + path, name); 26584 }, 26585 /** 26586 * Returns an Object hash of file arrays built from `loader.sorted` or from an arbitrary list of sorted modules. 26587 * @method resolve 26588 * @param {Boolean} [calc=false] Perform a loader.calculate() before anything else 26589 * @param {Array} [sorted=loader.sorted] An override for the loader.sorted array 26590 * @return {Object} Object hash (js and css) of two arrays of file lists 26591 * @example This method can be used as an off-line dep calculator 26592 * 26593 * var Y = YUI(); 26594 * var loader = new Y.Loader({ 26595 * filter: 'debug', 26596 * base: '../../', 26597 * root: 'build/', 26598 * combine: true, 26599 * require: ['node', 'dd', 'console'] 26600 * }); 26601 * var out = loader.resolve(true); 26602 * 26603 */ 26604 resolve: function(calc, sorted) { 26605 var self = this, 26606 resolved = { js: [], jsMods: [], css: [], cssMods: [] }, 26607 addSingle, 26608 usePathogen = Y.config.comboLoader && Y.config.customComboBase; 26609 26610 if (self.skin.overrides || self.skin.defaultSkin !== DEFAULT_SKIN || self.ignoreRegistered) { 26611 self._resetModules(); 26612 } 26613 26614 if (calc) { 26615 self.calculate(); 26616 } 26617 sorted = sorted || self.sorted; 26618 26619 addSingle = function(mod) { 26620 if (mod) { 26621 var group = (mod.group && self.groups[mod.group]) || NOT_FOUND, 26622 url; 26623 26624 //Always assume it's async 26625 if (group.async === false) { 26626 mod.async = group.async; 26627 } 26628 26629 url = (mod.fullpath) ? self._filter(mod.fullpath, mod.name) : 26630 self._url(mod.path, mod.name, group.base || mod.base); 26631 26632 if (mod.attributes || mod.async === false) { 26633 url = { 26634 url: url, 26635 async: mod.async 26636 }; 26637 if (mod.attributes) { 26638 url.attributes = mod.attributes; 26639 } 26640 } 26641 resolved[mod.type].push(url); 26642 resolved[mod.type + 'Mods'].push(mod); 26643 } else { 26644 } 26645 26646 }; 26647 26648 /*jslint vars: true */ 26649 var inserted = (self.ignoreRegistered) ? {}
26649 : self.inserted, 26650 comboSources, 26651 maxURLLength, 26652 comboMeta, 26653 comboBase, 26654 comboSep, 26655 group, 26656 mod, 26657 len, 26658 i, 26659 hasComboModule = false; 26660 26661 /*jslint vars: false */ 26662 26663 for (i = 0, len = sorted.length; i < len; i++) { 26664 mod = self.getModule(sorted[i]); 26665 if (!mod || inserted[mod.name]) { 26666 continue; 26667 } 26668 26669 group = self.groups[mod.group]; 26670 26671 comboBase = self.comboBase; 26672 26673 if (group) { 26674 if (!group.combine || mod.fullpath) { 26675 //This is not a combo module, skip it and load it singly later. 26676 addSingle(mod); 26677 continue; 26678 } 26679 mod.combine = true; 26680 26681 if (typeof group.root === 'string') { 26682 mod.root = group.root; 26683 } 26684 26685 comboBase = group.comboBase || comboBase; 26686 comboSep = group.comboSep; 26687 maxURLLength = group.maxURLLength; 26688 } else { 26689 if (!self.combine) { 26690 //This is not a combo module, skip it and load it singly later. 26691 addSingle(mod); 26692 continue; 26693 } 26694 } 26695 26696 if (!mod.combine && mod.ext) { 26697 addSingle(mod); 26698 continue; 26699 } 26700 hasComboModule = true; 26701 comboSources = comboSources || {}; 26702 comboSources[comboBase] = comboSources[comboBase] || 26703 { js: [], jsMods: [], css: [], cssMods: [] }; 26704 26705 comboMeta = comboSources[comboBase]; 26706 comboMeta.group = mod.group; 26707 comboMeta.comboSep = comboSep || self.comboSep; 26708 comboMeta.maxURLLength = maxURLLength || self.maxURLLength; 26709 26710 comboMeta[mod.type + 'Mods'].push(mod); 26711 if (mod.type === JS || mod.type === CSS) { 26712 resolved[mod.type + 'Mods'].push(mod); 26713 } 26714 } 26715 //only encode if we have something to encode 26716 if (hasComboModule) { 26717 if (usePathogen) { 26718 resolved = this._pathogenEncodeComboSources(resolved); 26719 } else { 26720 resolved = this._encodeComboSources(resolved, comboSources); 26721 } 26722 } 26723 return resolved; 26724 }, 26725 26726 /** 26727 * Encodes combo sources and appends them to an object hash of arrays from `loader.resolve`. 26728 * 26729 * @method _encodeComboSources 26730 * @param {Object} resolved The object hash of arrays in which to attach the encoded combo sources. 26731 * @param {Object} comboSources An object containing relevant data about modules. 26732 * @return Object 26733 * @private 26734 */ 26735 _encodeComboSources: function(resolved, comboSources) { 26736 var fragSubset, 26737 modules, 26738 tmpBase, 26739 baseLen, 26740 frags, 26741 frag, 26742 type, 26743 mod, 26744 maxURLLength, 26745 comboBase, 26746 comboMeta, 26747 comboSep, 26748 i, 26749 len, 26750 self = this; 26751 26752 for (comboBase in comboSources) { 26753 if (comboSources.hasOwnProperty(comboBase)) { 26754 comboMeta = comboSources[comboBase]; 26755 comboSep = comboMeta.comboSep; 26756 maxURLLength = comboMeta.maxURLLength; 26757 for (type in comboMeta) { 26758 if (type === JS || type === CSS) { 26759 modules = comboMeta[type + 'Mods']; 26760 frags = []; 26761 for (i = 0, len = modules.length; i < len; i += 1) { 26762 mod = modules[i]; 26763 frag = ((typeof mod.root === 'string') ? mod.root : self.root) + (mod.path || mod.fullpath); 26764 frags.push( 26765 self._filter(frag, mod.name) 26766 ); 26767 } 26768 tmpBase = comboBase + frags.join(comboSep); 26769 baseLen = tmpBase.length; 26770 if (maxURLLength <= comboBase.length) { 26771 maxURLLength = MAX_URL_LENGTH; 26772 } 26773 26774 if (frags.length) { 26775 if (baseLen > maxURLLength) { 26776 fragSubset = []; 26777 for (i = 0, len = frags.length; i < len; i++) { 26778 fragSubset.push(frags[i]); 26779 tmpBase = comboBase + fragSubset.join(comboSep); 26780 26781 if (tmpBase.length > maxURLLength) { 26782 frag = fragSubset.pop(); 26783 tmpBase = comboBase + fragSubset.join(comboSep); 26784 resolved[type].push(self._filter(tmpBase, null, comboMeta.group)); 26785 fragSubset = []; 26786 if (frag) { 26787 fragSubset.push(frag); 26788 } 26789 } 26790 } 26791 if (fragSubset.length) { 26792 tmpBase = comboBase + fragSubset.join(comboSep); 26793 resolved[type].push(self._filter(tmpBase, null, comboMeta.group)); 26794 } 26795 } else { 26796 resolved[type].push(self._filter(tmpBase, null, comboMeta.group)); 26797 } 26798 } 26799 } 26800 } 26801 } 26802 } 26803 return resolved; 26804 }, 26805 26806 /** 26807 Shortcut to calculate, resolve and load all modules. 26808 26809 var loader = new Y.Loader({ 26810 ignoreRegistered: true, 26811 modules: { 26812 mod: { 26813 path: 'mod.js' 26814 } 26815 }, 26816 requires: [ 'mod' ] 26817 }); 26818 loader.load(function() { 26819 console.log('All modules have loaded..'); 26820 }); 26821 26822 26823 @method load 26824 @param {Function} cb Executed after all load operations are complete 26825 */ 26826 load: function(cb) { 26827 if (!cb) { 26828 return; 26829 } 26830 var self = this, 26831 out = self.resolve(true); 26832 26833 self.data = out; 26834 26835 self.onEnd = function() { 26836 cb.apply(self.context || self, arguments); 26837 }; 26838 26839 self.insert(); 26840 } 26841}; 26842 26843 26844}, 'patched-v3.18.3', {"requires": ["get", "features"]}); 26845YUI.add('loader-rollup', function (Y, NAME) { 26846 26847/** 26848 * Optional automatic rollup logic for reducing http connections 26849 * when not using a combo service. 26850 * @module loader 26851 * @submodule rollup 26852 */ 26853 26854/** 26855 * Look for rollup packages to determine if all of the modules a 26856 * rollup supersedes are required. If so, include the rollup to 26857 * help reduce the total number of connections required. Called 26858 * by calculate(). This is an optional feature, and requires the 26859 * appropriate submodule to function. 26860 * @method _rollup 26861 * @for Loader 26862 * @private 26863 */ 26864Y.Loader.prototype._rollup = function() { 26865 var i, j, m, s, r = this.required, roll, 26866 info = this.moduleInfo, rolled, c, smod; 26867 26868 // find and cache rollup modules 26869 if (this.dirty || !this.rollups) { 26870 this.rollups = {}; 26871 for (i in info) { 26872 if (info.hasOwnProperty(i)) { 26873 m = this.getModule(i); 26874 // if (m && m.rollup && m.supersedes) { 26875 if (m && m.rollup) { 26876 this.rollups[i] = m; 26877 } 26878 } 26879 } 26880 } 26881 26882 // make as many passes as needed to pick up rollup rollups 26883 for (;;) { 26884 rolled = false;
26885 26886 // go through the rollup candidates 26887 for (i in this.rollups) { 26888 if (this.rollups.hasOwnProperty(i)) { 26889 // there can be only one, unless forced 26890 if (!r[i] && ((!this.loaded[i]) || this.forceMap[i])) { 26891 m = this.getModule(i); 26892 s = m.supersedes || []; 26893 roll = false; 26894 26895 // @TODO remove continue 26896 if (!m.rollup) { 26897 continue; 26898 } 26899 26900 c = 0; 26901 26902 // check the threshold 26903 for (j = 0; j < s.length; j++) { 26904 smod = info[s[j]]; 26905 26906 // if the superseded module is loaded, we can't 26907 // load the rollup unless it has been forced. 26908 if (this.loaded[s[j]] && !this.forceMap[s[j]]) { 26909 roll = false; 26910 break; 26911 // increment the counter if this module is required. 26912 // if we are beyond the rollup threshold, we will 26913 // use the rollup module 26914 } else if (r[s[j]] && m.type === smod.type) { 26915 c++; 26916 roll = (c >= m.rollup); 26917 if (roll) { 26918 break; 26919 } 26920 } 26921 } 26922 26923 if (roll) { 26924 // add the rollup 26925 r[i] = true; 26926 rolled = true; 26927 26928 // expand the rollup's dependencies 26929 this.getRequires(m); 26930 } 26931 } 26932 } 26933 } 26934 26935 // if we made it here w/o rolling up something, we are done 26936 if (!rolled) { 26937 break; 26938 } 26939 } 26940}; 26941 26942 26943}, 'patched-v3.18.3', {"requires": ["loader-base"]}); 26944YUI.add('loader-yui3', function (Y, NAME) { 26945 26946/* This file is auto-generated by (yogi loader --yes --mix --start ../) */ 26947 26948/*jshint maxlen:900, eqeqeq: false */ 26949 26950/** 26951 * YUI 3 module metadata 26952 * @module loader 26953 * @submodule loader-yui3 26954 */ 26955YUI.Env[Y.version].modules = YUI.Env[Y.version].modules || {}; 26956Y.mix(YUI.Env[Y.version].modules, { 26957 "align-plugin": { 26958 "requires": [ 26959 "node-screen", 26960 "node-pluginhost" 26961 ] 26962 }, 26963 "anim": { 26964 "use": [ 26965 "anim-base", 26966 "anim-color", 26967 "anim-curve", 26968 "anim-easing", 26969 "anim-node-plugin", 26970 "anim-scroll", 26971 "anim-xy" 26972 ] 26973 }, 26974 "anim-base": { 26975 "requires": [ 26976 "base-base", 26977 "node-style", 26978 "color-base" 26979 ] 26980 }, 26981 "anim-color": { 26982 "requires": [ 26983 "anim-base" 26984 ] 26985 }, 26986 "anim-curve": { 26987 "requires": [ 26988 "anim-xy" 26989 ] 26990 }, 26991 "anim-easing": { 26992 "requires": [ 26993 "anim-base" 26994 ] 26995 }, 26996 "anim-node-plugin": { 26997 "requires": [ 26998 "node-pluginhost", 26999 "anim-base" 27000 ] 27001 }, 27002 "anim-scroll": { 27003 "requires": [ 27004 "anim-base" 27005 ] 27006 }, 27007 "anim-shape": { 27008 "requires": [ 27009 "anim-base", 27010 "anim-easing", 27011 "anim-color", 27012 "matrix" 27013 ] 27014 }, 27015 "anim-shape-transform": { 27016 "use": [ 27017 "anim-shape" 27018 ] 27019 }, 27020 "anim-xy": { 27021 "requires": [ 27022 "anim-base", 27023 "node-screen" 27024 ] 27025 }, 27026 "app": { 27027 "use": [ 27028 "app-base", 27029 "app-content", 27030 "app-transitions", 27031 "lazy-model-list", 27032 "model", 27033 "model-list", 27034 "model-sync-rest", 27035 "model-sync-local", 27036 "router", 27037 "view", 27038 "view-node-map" 27039 ] 27040 }, 27041 "app-base": { 27042 "requires": [ 27043 "classnamemanager", 27044 "pjax-base", 27045 "router", 27046 "view" 27047 ] 27048 }, 27049 "app-content": { 27050 "requires": [ 27051 "app-base", 27052 "pjax-content" 27053 ] 27054 }, 27055 "app-transitions": { 27056 "requires": [ 27057 "app-base" 27058 ] 27059 }, 27060 "app-transitions-css": { 27061 "type": "css" 27062 }, 27063 "app-transitions-native": { 27064 "condition": { 27065 "name": "app-transitions-native", 27066 "test": function (Y) { 27067 var doc = Y.config.doc, 27068 node = doc ? doc.documentElement : null; 27069 27070 if (node && node.style) { 27071 return ('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); 27072 } 27073 27074 return false;
27075}, 27076 "trigger": "app-transitions" 27077 }, 27078 "requires": [ 27079 "app-transitions", 27080 "app-transitions-css", 27081 "parallel", 27082 "transition" 27083 ] 27084 }, 27085 "array-extras": { 27086 "requires": [ 27087 "yui-base" 27088 ] 27089 }, 27090 "array-invoke": { 27091 "requires": [ 27092 "yui-base" 27093 ] 27094 }, 27095 "arraylist": { 27096 "requires": [ 27097 "yui-base" 27098 ] 27099 }, 27100 "arraylist-add": { 27101 "requires": [ 27102 "arraylist" 27103 ] 27104 }, 27105 "arraylist-filter": { 27106 "requires": [ 27107 "arraylist" 27108 ] 27109 }, 27110 "arraysort": { 27111 "requires": [ 27112 "yui-base" 27113 ] 27114 }, 27115 "async-queue": { 27116 "requires": [ 27117 "event-custom" 27118 ] 27119 }, 27120 "attribute": { 27121 "use": [ 27122 "attribute-base", 27123 "attribute-complex" 27124 ] 27125 }, 27126 "attribute-base": { 27127 "requires": [ 27128 "attribute-core", 27129 "attribute-observable", 27130 "attribute-extras" 27131 ] 27132 }, 27133 "attribute-complex": { 27134 "requires": [ 27135 "attribute-base" 27136 ] 27137 }, 27138 "attribute-core": { 27139 "requires": [ 27140 "oop" 27141 ] 27142 }, 27143 "attribute-events": { 27144 "use": [ 27145 "attribute-observable" 27146 ] 27147 }, 27148 "attribute-extras": { 27149 "requires": [ 27150 "oop" 27151 ] 27152 }, 27153 "attribute-observable": { 27154 "requires": [ 27155 "event-custom" 27156 ] 27157 }, 27158 "autocomplete": { 27159 "use": [ 27160 "autocomplete-base", 27161 "autocomplete-sources", 27162 "autocomplete-list", 27163 "autocomplete-plugin" 27164 ] 27165 }, 27166 "autocomplete-base": { 27167 "optional": [ 27168 "autocomplete-sources" 27169 ], 27170 "requires": [ 27171 "array-extras", 27172 "base-build", 27173 "escape", 27174 "event-valuechange", 27175 "node-base" 27176 ] 27177 }, 27178 "autocomplete-filters": { 27179 "requires": [ 27180 "array-extras", 27181 "text-wordbreak" 27182 ] 27183 }, 27184 "autocomplete-filters-accentfold": { 27185 "requires": [ 27186 "array-extras", 27187 "text-accentfold", 27188 "text-wordbreak" 27189 ] 27190 }, 27191 "autocomplete-highlighters": { 27192 "requires": [ 27193 "array-extras", 27194 "highlight-base" 27195 ] 27196 }, 27197 "autocomplete-highlighters-accentfold": { 27198 "requires": [ 27199 "array-extras", 27200 "highlight-accentfold" 27201 ] 27202 }, 27203 "autocomplete-list": { 27204 "after": [ 27205 "autocomplete-sources" 27206 ], 27207 "lang": [ 27208 "en", 27209 "es", 27210 "hu", 27211 "it" 27212 ], 27213 "requires": [ 27214 "autocomplete-base", 27215 "event-resize", 27216 "node-screen", 27217 "selector-css3", 27218 "shim-plugin", 27219 "widget", 27220 "widget-position", 27221 "widget-position-align" 27222 ], 27223 "skinnable": true 27224 }, 27225 "autocomplete-list-keys": { 27226 "condition": { 27227 "name": "autocomplete-list-keys", 27228 "test": function (Y) { 27229 // Only add keyboard support to autocomplete-list if this doesn't appear to 27230 // be an iOS or Android-based mobile device. 27231 // 27232 // There's currently no feasible way to actually detect whether a device has 27233 // a hardware keyboard, so this sniff will have to do. It can easily be 27234 // overridden by manually loading the autocomplete-list-keys module. 27235 // 27236 // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari 27237 // doesn't fire the keyboard events used by AutoCompleteList, so there's 27238 // no point loading the -keys module even when a bluetooth keyboard may be 27239 // available. 27240 return !(Y.UA.ios || Y.UA.android); 27241}, 27242 "trigger": "autocomplete-list" 27243 }, 27244 "requires": [ 27245 "autocomplete-list", 27246 "base-build" 27247 ] 27248 }, 27249 "autocomplete-plugin": { 27250 "requires": [ 27251 "autocomplete-list", 27252 "node-pluginhost" 27253 ] 27254 }, 27255 "autocomplete-sources": { 27256 "optional": [ 27257 "io-base", 27258 "json-parse", 27259 "jsonp", 27260 "yql" 27261 ], 27262 "requires": [ 27263 "autocomplete-base" 27264 ] 27265 }, 27266 "axes": { 27267 "use": [ 27268 "axis-numeric", 27269 "axis-category", 27270 "axis-time", 27271 "axis-stacked" 27272 ] 27273 }, 27274 "axes-base": { 27275 "use": [ 27276 "axis-numeric-base", 27277 "axis-category-base", 27278 "axis-time-base", 27279 "axis-stacked-base" 27280 ] 27281 }, 27282 "axis": { 27283 "requires": [ 27284 "dom", 27285 "widget", 27286 "widget-position", 27287 "widget-stack", 27288 "graphics", 27289 "axis-base" 27290 ] 27291 }, 27292 "axis-base": { 27293 "requires": [ 27294 "classnamemanager", 27295 "datatype-number", 27296 "datatype-date", 27297 "base", 27298 "event-custom" 27299 ] 27300 }, 27301 "axis-category": { 27302 "requires": [ 27303 "axis", 27304 "axis-category-base" 27305 ] 27306 }, 27307 "axis-category-base": { 27308 "requires": [ 27309 "axis-base" 27310 ] 27311 }, 27312 "axis-numeric": { 27313 "requires": [ 27314 "axis", 27315 "axis-numeric-base" 27316 ] 27317 }, 27318 "axis-numeric-base": { 27319 "requires": [ 27320 "axis-base" 27321 ] 27322 }, 27323 "axis-stacked": { 27324 "requires": [ 27325 "axis-numeric", 27326 "axis-stacked-base" 27327 ] 27328 }, 27329 "axis-stacked-base": { 27330 "requires": [ 27331 "axis-numeric-base" 27332 ] 27333 }, 27334 "axis-time": { 27335 "requires": [ 27336 "axis", 27337 "axis-time-base" 27338 ] 27339 }, 27340 "axis-time-base": { 27341 "requires": [ 27342 "axis-base" 27343 ] 27344 }, 27345 "base": { 27346 "use": [ 27347 "base-base", 27348 "base-pluginhost", 27349 "base-build" 27350 ] 27351 }, 27352 "base-base": { 27353 "requires": [ 27354 "attribute-base", 27355 "base-core", 27356 "base-observable" 27357 ] 27358 }, 27359 "base-build": { 27360 "requires": [ 27361 "base-base" 27362 ] 27363 }, 27364 "base-core": { 27365 "requires": [ 27366 "attribute-core" 27367 ] 27368 }, 27369 "base-observable": { 27370 "requires": [ 27371 "attribute-observable", 27372 "base-core" 27373 ] 27374 }, 27375 "base-pluginhost": { 27376 "requires": [ 27377 "base-base", 27378 "pluginhost" 27379 ] 27380 }, 27381 "button": { 27382 "requires": [ 27383 "button-core", 27384 "cssbutton", 27385 "widget" 27386 ] 27387 }, 27388 "button-core": { 27389 "requires": [ 27390 "attribute-core", 27391 "classnamemanager", 27392 "node-base", 27393 "escape" 27394 ] 27395 }, 27396 "button-group": { 27397 "requires": [ 27398 "button-plugin", 27399 "cssbutton", 27400 "widget" 27401 ] 27402 }, 27403 "button-plugin": { 27404 "requires": [ 27405 "button-core", 27406 "cssbutton", 27407 "node-pluginhost" 27408 ] 27409 }, 27410 "cache": { 27411 "use": [ 27412 "cache-base", 27413 "cache-offline", 27414 "cache-plugin" 27415 ] 27416 }, 27417 "cache-base": { 27418 "requires": [ 27419 "base" 27420 ] 27421 }, 27422 "cache-offline": { 27423 "requires": [ 27424 "cache-base", 27425 "json" 27426 ] 27427 }, 27428 "cache-plugin": { 27429 "requires": [ 27430 "plugin", 27431 "cache-base" 27432 ] 27433 }, 27434 "calendar": { 27435 "requires": [ 27436 "calendar-base", 27437 "calendarnavigator" 27438 ], 27439 "skinnable": true 27440 }, 27441 "calendar-base": { 27442 "lang": [ 27443 "ar-SA", 27444 "bg-BG", 27445 "ca-AD", 27446 "ca-ES", 27447 "cs-CZ", 27448 "da-DK", 27449 "de", 27450 "el-GR", 27451 "en-AU", 27452 "en-GB", 27453 "en", 27454 "es-AR", 27455 "es", 27456 "et-EE", 27457 "eu-ES", 27458 "fa-IR", 27459 "fr-CA", 27460 "fr", 27461 "gl-ES", 27462 "hi-IN", 27463 "hr-HR", 27464 "hu", 27465 "in-ID", 27466 "it-IT", 27467 "it", 27468 "iw-IL", 27469 "ja", 27470 "ko-KR", 27471 "lo-LA", 27472 "lt-LT", 27473 "nb-NO", 27474 "nl-BE", 27475 "nl-NL", 27476 "nl", 27477 "pl-PL", 27478 "pt-BR", 27479 "pt-PT", 27480 "ro-RO", 27481 "ru-RU", 27482 "ru", 27483 "sk-SK", 27484 "sl-SL", 27485 "sr-RS-latin", 27486 "sr-RS", 27487 "sv-SE", 27488 "th-TH", 27489 "tr-TR", 27490 "uk-UA", 27491 "vi-VN", 27492 "zh-Hans-CN", 27493 "zh-Hans", 27494 "zh-Hant-HK", 27495 "zh-HANT-TW", 27496 "zh-Hant", 27497 "zh-TW" 27498 ], 27499 "requires": [ 27500 "widget", 27501 "datatype-date", 27502 "datatype-date-math", 27503 "cssgrids" 27504 ], 27505 "skinnable": true 27506 }, 27507 "calendarnavigator": { 27508 "lang": [ 27509 "en", 27510 "es", 27511 "es-AR", 27512 "eu-ES" 27513 ], 27514 "requires": [ 27515 "plugin", 27516 "classnamemanager", 27517 "datatype-date", 27518 "node" 27519 ], 27520 "skinnable": true 27521 }, 27522 "charts": { 27523 "use": [ 27524 "charts-base" 27525 ] 27526 }, 27527 "charts-base": { 27528 "requires": [ 27529 "dom", 27530 "event-mouseenter", 27531 "event-touch", 27532 "graphics-group", 27533 "axes", 27534 "series-pie", 27535 "series-line", 27536 "series-marker", 27537 "series-area", 27538 "series-spline", 27539 "series-column", 27540 "series-bar", 27541 "series-areaspline", 27542 "series-combo", 27543 "series-combospline", 27544 "series-line-stacked", 27545 "series-marker-stacked", 27546 "series-area-stacked", 27547 "series-spline-stacked", 27548 "series-column-stacked", 27549 "series-bar-stacked", 27550 "series-areaspline-stacked", 27551 "series-combo-stacked", 27552 "series-combospline-stacked" 27553 ] 27554 }, 27555 "charts-legend": { 27556 "requires": [ 27557 "charts-base" 27558 ] 27559 }, 27560 "classnamemanager": { 27561 "requires": [ 27562 "yui-base" 27563 ] 27564 }, 27565 "clickable-rail": { 27566 "requires": [ 27567 "slider-base" 27568 ] 27569 }, 27570 "collection": { 27571 "use": [ 27572 "array-extras", 27573 "arraylist", 27574 "arraylist-add", 27575 "arraylist-filter", 27576 "array-invoke" 27577 ] 27578 }, 27579 "color": { 27580 "use": [ 27581 "color-base", 27582 "color-hsl", 27583 "color-harmony" 27584 ] 27585 }, 27586 "color-base": { 27587 "requires": [ 27588 "yui-base" 27589 ] 27590 }, 27591 "color-harmony": { 27592 "requires": [ 27593 "color-hsl" 27594 ] 27595 }, 27596 "color-hsl": { 27597 "requires": [ 27598 "color-base" 27599 ] 27600 }, 27601 "color-hsv": { 27602 "requires": [ 27603 "color-base" 27604 ] 27605 }, 27606 "console": { 27607 "lang": [ 27608 "en", 27609 "es", 27610 "hu", 27611 "it", 27612 "ja" 27613 ], 27614 "requires": [ 27615 "yui-log", 27616 "widget" 27617 ], 27618 "skinnable": true 27619 }, 27620 "console-filters": { 27621 "requires": [ 27622 "plugin", 27623 "console" 27624 ], 27625 "skinnable": true 27626 }, 27627 "content-editable": { 27628 "requires": [ 27629 "node-base", 27630 "editor-selection", 27631 "stylesheet", 27632 "plugin" 27633 ] 27634 }, 27635 "controller": { 27636 "use": [ 27637 "router" 27638 ] 27639 }, 27640 "cookie": { 27641 "requires": [ 27642 "yui-base" 27643 ] 27644 }, 27645 "createlink-base": { 27646 "requires": [ 27647 "editor-base" 27648 ] 27649 }, 27650 "cssbase": { 27651 "after": [ 27652 "cssreset", 27653 "cssfonts", 27654 "cssgrids", 27655 "cssreset-context", 27656 "cssfonts-context", 27657 "cssgrids-context" 27658 ], 27659 "type": "css" 27660 }, 27661 "cssbase-context": { 27662 "after": [ 27663 "cssreset", 27664 "cssfonts", 27665 "cssgrids", 27666 "cssreset-context", 27667 "cssfonts-context", 27668 "cssgrids-context" 27669 ], 27670 "type": "css" 27671 }, 27672 "cssbutton": { 27673 "type": "css" 27674 }, 27675 "cssfonts": { 27676 "type": "css" 27677 }, 27678 "cssfonts-context": { 27679 "type": "css" 27680 }, 27681 "cssgrids": { 27682 "optional": [ 27683 "cssnormalize" 27684 ], 27685 "type": "css" 27686 }, 27687 "cssgrids-base": { 27688 "optional": [ 27689 "cssnormalize" 27690 ], 27691 "type": "css" 27692 }, 27693 "cssgrids-responsive": { 27694 "optional": [ 27695 "cssnormalize" 27696 ], 27697 "requires": [ 27698 "cssgrids", 27699 "cssgrids-responsive-base" 27700 ], 27701 "type": "css" 27702 }, 27703 "cssgrids-units": { 27704 "optional": [ 27705 "cssnormalize" 27706 ], 27707 "requires": [ 27708 "cssgrids-base" 27709 ], 27710 "type": "css" 27711 }, 27712 "cssnormalize": { 27713 "type": "css" 27714 }, 27715 "cssnormalize-context": { 27716 "type": "css" 27717 }, 27718 "cssreset": { 27719 "type": "css" 27720 }, 27721 "cssreset-context": { 27722 "type": "css" 27723 }, 27724 "dataschema": { 27725 "use": [ 27726 "dataschema-base", 27727 "dataschema-json", 27728 "dataschema-xml", 27729 "dataschema-array", 27730 "dataschema-text" 27731 ] 27732 }, 27733 "dataschema-array": { 27734 "requires": [ 27735 "dataschema-base" 27736 ] 27737 }, 27738 "dataschema-base": { 27739 "requires": [ 27740 "base" 27741 ] 27742 }, 27743 "dataschema-json": { 27744 "requires": [ 27745 "dataschema-base", 27746 "json" 27747 ] 27748 }, 27749 "dataschema-text": { 27750 "requires": [ 27751 "dataschema-base" 27752 ] 27753 }, 27754 "dataschema-xml": { 27755 "requires": [ 27756 "dataschema-base" 27757 ] 27758 }, 27759 "datasource": { 27760 "use": [ 27761 "datasource-local", 27762 "datasource-io", 27763 "datasource-get", 27764 "datasource-function", 27765 "datasource-cache", 27766 "datasource-jsonschema", 27767 "datasource-xmlschema", 27768 "datasource-arrayschema", 27769 "datasource-textschema", 27770 "datasource-polling" 27771 ] 27772 }, 27773 "datasource-arrayschema": { 27774 "requires": [ 27775 "datasource-local", 27776 "plugin", 27777 "dataschema-array" 27778 ] 27779 }, 27780 "datasource-cache": { 27781 "requires": [ 27782 "datasource-local", 27783 "plugin", 27784 "cache-base" 27785 ] 27786 }, 27787 "datasource-function": { 27788 "requires": [ 27789 "datasource-local" 27790 ] 27791 }, 27792 "datasource-get": { 27793 "requires": [ 27794 "datasource-local", 27795 "get" 27796 ] 27797 }, 27798 "datasource-io": { 27799 "requires": [ 27800 "datasource-local", 27801 "io-base" 27802 ] 27803 }, 27804 "datasource-jsonschema": { 27805 "requires": [ 27806 "datasource-local", 27807 "plugin", 27808 "dataschema-json" 27809 ] 27810 }, 27811 "datasource-local": { 27812 "requires": [ 27813 "base" 27814 ] 27815 }, 27816 "datasource-polling": { 27817 "requires": [ 27818 "datasource-local" 27819 ] 27820 }, 27821 "datasource-textschema": { 27822 "requires": [ 27823 "datasource-local", 27824 "plugin", 27825 "dataschema-text" 27826 ] 27827 }, 27828 "datasource-xmlschema": { 27829 "requires": [ 27830 "datasource-local", 27831 "plugin", 27832 "datatype-xml", 27833 "dataschema-xml" 27834 ] 27835 }, 27836 "datatable": { 27837 "use": [ 27838 "datatable-core", 27839 "datatable-table", 27840 "datatable-head", 27841 "datatable-body", 27842 "datatable-base", 27843 "datatable-column-widths", 27844 "datatable-message", 27845 "datatable-mutable", 27846 "datatable-sort", 27847 "datatable-datasource" 27848 ] 27849 }, 27850 "datatable-base": { 27851 "requires": [ 27852 "datatable-core", 27853 "datatable-table", 27854 "datatable-head", 27855
27855 "datatable-body", 27856 "base-build", 27857 "widget" 27858 ], 27859 "skinnable": true 27860 }, 27861 "datatable-body": { 27862 "requires": [ 27863 "datatable-core", 27864 "view", 27865 "classnamemanager" 27866 ] 27867 }, 27868 "datatable-column-widths": { 27869 "requires": [ 27870 "datatable-base" 27871 ] 27872 }, 27873 "datatable-core": { 27874 "requires": [ 27875 "escape", 27876 "model-list", 27877 "node-event-delegate" 27878 ] 27879 }, 27880 "datatable-datasource": { 27881 "requires": [ 27882 "datatable-base", 27883 "plugin", 27884 "datasource-local" 27885 ] 27886 }, 27887 "datatable-foot": { 27888 "requires": [ 27889 "datatable-core", 27890 "view" 27891 ] 27892 }, 27893 "datatable-formatters": { 27894 "requires": [ 27895 "datatable-body", 27896 "datatype-number-format", 27897 "datatype-date-format", 27898 "escape" 27899 ] 27900 }, 27901 "datatable-head": { 27902 "requires": [ 27903 "datatable-core", 27904 "view", 27905 "classnamemanager" 27906 ] 27907 }, 27908 "datatable-highlight": { 27909 "requires": [ 27910 "datatable-base", 27911 "event-hover" 27912 ], 27913 "skinnable": true 27914 }, 27915 "datatable-keynav": { 27916 "requires": [ 27917 "datatable-base" 27918 ] 27919 }, 27920 "datatable-message": { 27921 "lang": [ 27922 "en", 27923 "fr", 27924 "es", 27925 "hu", 27926 "it" 27927 ], 27928 "requires": [ 27929 "datatable-base" 27930 ], 27931 "skinnable": true 27932 }, 27933 "datatable-mutable": { 27934 "requires": [ 27935 "datatable-base" 27936 ] 27937 }, 27938 "datatable-paginator": { 27939 "lang": [ 27940 "en", 27941 "fr" 27942 ], 27943 "requires": [ 27944 "model", 27945 "view", 27946 "paginator-core", 27947 "datatable-foot", 27948 "datatable-paginator-templates" 27949 ], 27950 "skinnable": true 27951 }, 27952 "datatable-paginator-templates": { 27953 "requires": [ 27954 "template" 27955 ] 27956 }, 27957 "datatable-scroll": { 27958 "requires": [ 27959 "datatable-base", 27960 "datatable-column-widths", 27961 "dom-screen" 27962 ], 27963 "skinnable": true 27964 }, 27965 "datatable-sort": { 27966 "lang": [ 27967 "en", 27968 "fr", 27969 "es", 27970 "hu" 27971 ], 27972 "requires": [ 27973 "datatable-base" 27974 ], 27975 "skinnable": true 27976 }, 27977 "datatable-table": { 27978 "requires": [ 27979 "datatable-core", 27980 "datatable-head", 27981 "datatable-body", 27982 "view", 27983 "classnamemanager" 27984 ] 27985 }, 27986 "datatype": { 27987 "use": [ 27988 "datatype-date", 27989 "datatype-number", 27990 "datatype-xml" 27991 ] 27992 }, 27993 "datatype-date": { 27994 "use": [ 27995 "datatype-date-parse", 27996 "datatype-date-format", 27997 "datatype-date-math" 27998 ] 27999 }, 28000 "datatype-date-format": { 28001 "lang": [ 28002 "ar", 28003 "ar-JO", 28004 "ca", 28005 "ca-ES", 28006 "da", 28007 "da-DK", 28008 "de", 28009 "de-AT", 28010 "de-DE", 28011 "el", 28012 "el-GR", 28013 "en", 28014 "en-AU", 28015 "en-CA", 28016 "en-GB", 28017 "en-IE", 28018 "en-IN", 28019 "en-JO", 28020 "en-MY", 28021 "en-NZ", 28022 "en-PH", 28023 "en-SG", 28024 "en-US", 28025 "es", 28026 "es-AR", 28027 "es-BO", 28028 "es-CL", 28029 "es-CO", 28030 "es-EC", 28031 "es-ES", 28032 "es-MX", 28033 "es-PE", 28034 "es-PY", 28035 "es-US", 28036 "es-UY", 28037 "es-VE", 28038 "fi", 28039 "fi-FI", 28040 "fr", 28041 "fr-BE", 28042 "fr-CA", 28043 "fr-FR", 28044 "hi", 28045 "hi-IN", 28046 "hu", 28047 "id", 28048 "id-ID", 28049 "it", 28050 "it-IT", 28051 "ja", 28052 "ja-JP", 28053 "ko", 28054 "ko-KR", 28055 "ms", 28056 "ms-MY", 28057 "nb", 28058 "nb-NO", 28059 "nl", 28060 "nl-BE", 28061 "nl-NL", 28062 "pl", 28063 "pl-PL", 28064 "pt", 28065 "pt-BR", 28066 "ro", 28067 "ro-RO", 28068 "ru", 28069 "ru-RU", 28070 "sv", 28071 "sv-SE", 28072 "th", 28073 "th-TH", 28074 "tr", 28075 "tr-TR", 28076 "vi", 28077 "vi-VN", 28078 "zh-Hans", 28079 "zh-Hans-CN", 28080 "zh-Hant", 28081 "zh-Hant-HK", 28082 "zh-Hant-TW" 28083 ] 28084 }, 28085 "datatype-date-math": { 28086 "requires": [ 28087 "yui-base" 28088 ] 28089 }, 28090 "datatype-date-parse": {}, 28091 "datatype-number": { 28092 "use": [ 28093 "datatype-number-parse", 28094 "datatype-number-format" 28095 ] 28096 }, 28097 "datatype-number-format": {}, 28098 "datatype-number-parse": { 28099 "requires": [ 28100 "escape" 28101 ] 28102 }, 28103 "datatype-xml": { 28104 "use": [ 28105 "datatype-xml-parse", 28106 "datatype-xml-format" 28107 ] 28108 }, 28109 "datatype-xml-format": {}, 28110 "datatype-xml-parse": {}, 28111 "dd": { 28112 "use": [ 28113 "dd-ddm-base", 28114 "dd-ddm", 28115 "dd-ddm-drop", 28116 "dd-drag", 28117 "dd-proxy", 28118 "dd-constrain", 28119 "dd-drop", 28120 "dd-scroll", 28121 "dd-delegate" 28122 ] 28123 }, 28124 "dd-constrain": { 28125 "requires": [ 28126 "dd-drag" 28127 ] 28128 }, 28129 "dd-ddm": { 28130 "requires": [ 28131 "dd-ddm-base", 28132 "event-resize" 28133 ] 28134 }, 28135 "dd-ddm-base": { 28136 "requires": [ 28137 "node", 28138 "base", 28139 "yui-throttle", 28140 "classnamemanager" 28141 ] 28142 }, 28143 "dd-ddm-drop": { 28144 "requires": [ 28145 "dd-ddm" 28146 ] 28147 }, 28148 "dd-delegate": { 28149 "requires": [ 28150 "dd-drag", 28151 "dd-drop-plugin", 28152 "event-mouseenter" 28153 ] 28154 }, 28155 "dd-drag": { 28156 "requires": [ 28157 "dd-ddm-base", 28158 "selector-css2" 28159 ] 28160 }, 28161 "dd-drop": { 28162 "requires": [ 28163 "dd-drag", 28164 "dd-ddm-drop" 28165 ] 28166 }, 28167 "dd-drop-plugin": { 28168 "requires": [ 28169 "dd-drop" 28170 ] 28171 }, 28172 "dd-gestures": { 28173 "condition": { 28174 "name": "dd-gestures", 28175 "trigger": "dd-drag", 28176 "ua": "touchEnabled" 28177 }, 28178 "requires": [ 28179 "dd-drag", 28180 "event-synthetic", 28181 "event-gestures" 28182 ] 28183 }, 28184 "dd-plugin": { 28185 "optional": [ 28186 "dd-constrain", 28187 "dd-proxy" 28188 ], 28189 "requires": [ 28190 "dd-drag" 28191 ] 28192 }, 28193 "dd-proxy": { 28194 "requires": [ 28195 "dd-drag" 28196 ] 28197 }, 28198 "dd-scroll": { 28199 "requires": [ 28200 "dd-drag" 28201 ] 28202 }, 28203 "dial": { 28204 "lang": [ 28205 "en", 28206 "es", 28207 "hu" 28208 ], 28209 "requires": [ 28210 "widget", 28211 "dd-drag", 28212 "event-mouseenter", 28213 "event-move", 28214 "event-key", 28215 "transition", 28216 "intl" 28217 ], 28218 "skinnable": true 28219 }, 28220 "dom": { 28221 "use": [ 28222 "dom-base", 28223 "dom-screen", 28224 "dom-style", 28225 "selector-native", 28226 "selector" 28227 ] 28228 },
28229 "dom-base": { 28230 "requires": [ 28231 "dom-core" 28232 ] 28233 }, 28234 "dom-core": { 28235 "requires": [ 28236 "oop", 28237 "features" 28238 ] 28239 }, 28240 "dom-screen": { 28241 "requires": [ 28242 "dom-base", 28243 "dom-style" 28244 ] 28245 }, 28246 "dom-style": { 28247 "requires": [ 28248 "dom-base" 28249 ] 28250 }, 28251 "dom-style-ie": { 28252 "condition": { 28253 "name": "dom-style-ie", 28254 "test": function (Y) { 28255 28256 var testFeature = Y.Features.test, 28257 addFeature = Y.Features.add, 28258 WINDOW = Y.config.win, 28259 DOCUMENT = Y.config.doc, 28260 DOCUMENT_ELEMENT = 'documentElement', 28261 ret = false; 28262 28263 addFeature('style', 'computedStyle', { 28264 test: function() { 28265 return WINDOW && 'getComputedStyle' in WINDOW; 28266 } 28267 }); 28268 28269 addFeature('style', 'opacity', { 28270 test: function() { 28271 return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style; 28272 } 28273 }); 28274 28275 ret = (!testFeature('style', 'opacity') && 28276 !testFeature('style', 'computedStyle')); 28277 28278 return ret; 28279}, 28280 "trigger": "dom-style" 28281 }, 28282 "requires": [ 28283 "dom-style", 28284 "color-base" 28285 ] 28286 }, 28287 "dump": { 28288 "requires": [ 28289 "yui-base" 28290 ] 28291 }, 28292 "editor": { 28293 "use": [ 28294 "frame", 28295 "editor-selection", 28296 "exec-command", 28297 "editor-base", 28298 "editor-para", 28299 "editor-br", 28300 "editor-bidi", 28301 "editor-tab", 28302 "createlink-base" 28303 ] 28304 }, 28305 "editor-base": { 28306 "requires": [ 28307 "base", 28308 "frame", 28309 "node", 28310 "exec-command", 28311 "editor-selection" 28312 ] 28313 }, 28314 "editor-bidi": { 28315 "requires": [ 28316 "editor-base" 28317 ] 28318 }, 28319 "editor-br": { 28320 "requires": [ 28321 "editor-base" 28322 ] 28323 }, 28324 "editor-inline": { 28325 "requires": [ 28326 "editor-base", 28327 "content-editable" 28328 ] 28329 }, 28330 "editor-lists": { 28331 "requires": [ 28332 "editor-base" 28333 ] 28334 }, 28335 "editor-para": { 28336 "requires": [ 28337 "editor-para-base" 28338 ] 28339 }, 28340 "editor-para-base": { 28341 "requires": [ 28342 "editor-base" 28343 ] 28344 }, 28345 "editor-para-ie": { 28346 "condition": { 28347 "name": "editor-para-ie", 28348 "trigger": "editor-para", 28349 "ua": "ie", 28350 "when": "instead" 28351 }, 28352 "requires": [ 28353 "editor-para-base" 28354 ] 28355 }, 28356 "editor-selection": { 28357 "requires": [ 28358 "node" 28359 ] 28360 }, 28361 "editor-tab": { 28362 "requires": [ 28363 "editor-base" 28364 ] 28365 }, 28366 "escape": { 28367 "requires": [ 28368 "yui-base" 28369 ] 28370 }, 28371 "event": { 28372 "after": [ 28373 "node-base" 28374 ], 28375 "use": [ 28376 "event-base", 28377 "event-delegate", 28378 "event-synthetic", 28379 "event-mousewheel", 28380 "event-mouseenter", 28381 "event-key", 28382 "event-focus", 28383 "event-resize", 28384 "event-hover", 28385 "event-outside", 28386 "event-touch", 28387 "event-move", 28388 "event-flick", 28389 "event-valuechange", 28390 "event-tap" 28391 ] 28392 }, 28393 "event-base": { 28394 "after": [ 28395 "node-base" 28396 ], 28397 "requires": [ 28398 "event-custom-base" 28399 ] 28400 }, 28401 "event-base-ie": { 28402 "after": [ 28403 "event-base" 28404 ], 28405 "condition": { 28406 "name": "event-base-ie", 28407 "test": function(Y) { 28408 var imp = Y.config.doc && Y.config.doc.implementation; 28409 return (imp && (!imp.hasFeature('Events', '2.0'))); 28410}, 28411 "trigger": "node-base" 28412 }, 28413 "requires": [ 28414 "node-base" 28415 ] 28416 }, 28417 "event-contextmenu": { 28418 "requires": [ 28419 "event-synthetic", 28420 "dom-screen" 28421 ] 28422 }, 28423 "event-custom": { 28424 "use": [ 28425 "event-custom-base", 28426 "event-custom-complex" 28427 ] 28428 }, 28429 "event-custom-base": { 28430 "requires": [ 28431 "oop" 28432 ] 28433 }, 28434 "event-custom-complex": { 28435 "requires": [ 28436 "event-custom-base" 28437 ] 28438 }, 28439 "event-delegate": { 28440 "requires": [ 28441 "node-base" 28442 ] 28443 }, 28444 "event-flick": { 28445 "requires": [ 28446 "node-base", 28447 "event-touch", 28448 "event-synthetic" 28449 ] 28450 }, 28451 "event-focus": { 28452 "requires": [ 28453 "event-synthetic" 28454 ] 28455 }, 28456 "event-gestures": { 28457 "use": [ 28458 "event-flick", 28459 "event-move" 28460 ] 28461 }, 28462 "event-hover": { 28463 "requires": [ 28464 "event-mouseenter" 28465 ] 28466 }, 28467 "event-key": { 28468 "requires": [ 28469 "event-synthetic" 28470 ] 28471 }, 28472 "event-mouseenter": { 28473 "requires": [ 28474 "event-synthetic" 28475 ] 28476 }, 28477 "event-mousewheel": { 28478 "requires": [ 28479 "node-base" 28480 ] 28481 }, 28482 "event-move": { 28483 "requires": [ 28484 "node-base", 28485 "event-touch", 28486 "event-synthetic" 28487 ] 28488 }, 28489 "event-outside": { 28490 "requires": [ 28491 "event-synthetic" 28492 ] 28493 }, 28494 "event-resize": { 28495 "requires": [ 28496 "node-base", 28497 "event-synthetic" 28498 ] 28499 }, 28500 "event-simulate": { 28501 "requires": [ 28502 "event-base" 28503 ] 28504 }, 28505 "event-synthetic": { 28506 "requires": [ 28507 "node-base", 28508 "event-custom-complex" 28509 ] 28510 }, 28511 "event-tap": { 28512 "requires": [ 28513 "node-base", 28514 "event-base", 28515 "event-touch", 28516 "event-synthetic" 28517 ] 28518 }, 28519 "event-touch": { 28520 "requires": [ 28521 "node-base" 28522 ] 28523 }, 28524 "event-valuechange": { 28525 "requires": [ 28526 "event-focus", 28527 "event-synthetic" 28528 ] 28529 }, 28530 "exec-command": { 28531 "requires": [ 28532 "frame" 28533 ] 28534 }, 28535 "features": { 28536 "requires": [ 28537 "yui-base" 28538 ] 28539 }, 28540 "file": { 28541 "requires": [ 28542 "file-flash", 28543 "file-html5" 28544 ] 28545 }, 28546 "file-flash": { 28547 "requires": [ 28548 "base" 28549 ] 28550 }, 28551 "file-html5": { 28552 "requires": [ 28553 "base" 28554 ] 28555 }, 28556 "frame": { 28557 "requires": [ 28558 "base", 28559 "node", 28560 "plugin", 28561 "selector-css3", 28562 "yui-throttle" 28563 ] 28564 }, 28565 "gesture-simulate": { 28566 "requires": [ 28567 "async-queue", 28568 "event-simulate", 28569 "node-screen" 28570 ] 28571 }, 28572 "get": { 28573 "requires": [ 28574 "yui-base" 28575 ] 28576 }, 28577 "graphics": { 28578 "requires": [ 28579 "node", 28580 "event-custom", 28581 "pluginhost", 28582 "matrix", 28583 "classnamemanager" 28584 ] 28585 }, 28586 "graphics-canvas": { 28587 "condition": { 28588 "name": "graphics-canvas", 28589 "test": function(Y) { 28590 var DOCUMENT = Y.config.doc, 28591 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas",
28592 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 28593 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 28594 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); 28595}, 28596 "trigger": "graphics" 28597 }, 28598 "requires": [ 28599 "graphics", 28600 "color-base" 28601 ] 28602 }, 28603 "graphics-canvas-default": { 28604 "condition": { 28605 "name": "graphics-canvas-default", 28606 "test": function(Y) { 28607 var DOCUMENT = Y.config.doc, 28608 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", 28609 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 28610 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 28611 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); 28612}, 28613 "trigger": "graphics" 28614 } 28615 }, 28616 "graphics-group": { 28617 "requires": [ 28618 "graphics" 28619 ] 28620 }, 28621 "graphics-svg": { 28622 "condition": { 28623 "name": "graphics-svg", 28624 "test": function(Y) { 28625 var DOCUMENT = Y.config.doc, 28626 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", 28627 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 28628 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 28629 28630 return svg && (useSVG || !canvas); 28631}, 28632 "trigger": "graphics" 28633 }, 28634 "requires": [ 28635 "graphics" 28636 ] 28637 }, 28638 "graphics-svg-default": { 28639 "condition": { 28640 "name": "graphics-svg-default", 28641 "test": function(Y) { 28642 var DOCUMENT = Y.config.doc, 28643 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", 28644 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 28645 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 28646 28647 return svg && (useSVG || !canvas); 28648}, 28649 "trigger": "graphics" 28650 } 28651 }, 28652 "graphics-vml": { 28653 "condition": { 28654 "name": "graphics-vml", 28655 "test": function(Y) { 28656 var DOCUMENT = Y.config.doc, 28657 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); 28658 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); 28659}, 28660 "trigger": "graphics" 28661 }, 28662 "requires": [ 28663 "graphics", 28664 "color-base" 28665 ] 28666 }, 28667 "graphics-vml-default": { 28668 "condition": { 28669 "name": "graphics-vml-default", 28670 "test": function(Y) { 28671 var DOCUMENT = Y.config.doc, 28672 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); 28673 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); 28674}, 28675 "trigger": "graphics" 28676 } 28677 }, 28678 "handlebars": { 28679 "use": [ 28680 "handlebars-compiler" 28681 ] 28682 }, 28683 "handlebars-base": { 28684 "requires": [] 28685 }, 28686 "handlebars-compiler": { 28687 "requires": [ 28688 "handlebars-base" 28689 ] 28690 }, 28691 "highlight": { 28692 "use": [ 28693 "highlight-base", 28694 "highlight-accentfold" 28695 ] 28696 }, 28697 "highlight-accentfold": { 28698 "requires": [ 28699 "highlight-base", 28700 "text-accentfold" 28701 ] 28702 }, 28703 "highlight-base": { 28704 "requires": [ 28705 "array-extras", 28706 "classnamemanager", 28707 "escape", 28708 "text-wordbreak" 28709 ] 28710 }, 28711 "history": { 28712 "use": [ 28713 "history-base", 28714 "history-hash", 28715 "history-html5" 28716 ] 28717 }, 28718 "history-base": { 28719 "requires": [ 28720 "event-custom-complex" 28721 ] 28722 }, 28723 "history-hash": { 28724 "after": [ 28725 "history-html5" 28726 ], 28727 "requires": [ 28728 "event-synthetic", 28729 "history-base", 28730 "yui-later" 28731 ] 28732 }, 28733 "history-hash-ie": { 28734 "condition": { 28735 "name": "history-hash-ie", 28736 "test": function (Y) { 28737 var docMode = Y.config.doc && Y.config.doc.documentMode; 28738 28739 return Y.UA.ie && (!('onhashchange' in Y.config.win) || 28740 !docMode || docMode < 8); 28741}, 28742 "trigger": "history-hash" 28743 }, 28744 "requires": [ 28745 "history-hash", 28746 "node-base" 28747 ] 28748 }, 28749 "history-html5": { 28750 "optional": [ 28751 "json" 28752 ], 28753 "requires": [ 28754 "event-base", 28755 "history-base", 28756 "node-base" 28757 ] 28758 }, 28759 "imageloader": { 28760 "requires": [ 28761 "base-base", 28762 "node-style", 28763 "node-screen" 28764 ] 28765 }, 28766 "intl": { 28767 "requires": [ 28768 "intl-base", 28769 "event-custom" 28770 ] 28771 }, 28772 "intl-base": { 28773 "requires": [ 28774 "yui-base" 28775 ] 28776 }, 28777 "io": { 28778 "use": [ 28779 "io-base", 28780 "io-xdr", 28781 "io-form", 28782 "io-upload-iframe", 28783 "io-queue" 28784 ] 28785 }, 28786 "io-base": { 28787 "requires": [ 28788 "event-custom-base", 28789 "querystring-stringify-simple" 28790 ] 28791 }, 28792 "io-form": { 28793 "requires": [ 28794 "io-base", 28795 "node-base" 28796 ] 28797 }, 28798 "io-nodejs": { 28799 "condition": { 28800 "name": "io-nodejs", 28801 "trigger": "io-base", 28802 "ua": "nodejs" 28803 }, 28804 "requires": [ 28805 "io-base" 28806 ] 28807 }, 28808 "io-queue": { 28809 "requires": [ 28810 "io-base", 28811 "queue-promote" 28812 ] 28813 }, 28814 "io-upload-iframe": { 28815 "requires": [ 28816 "io-base", 28817 "node-base" 28818 ] 28819 }, 28820 "io-xdr": { 28821 "requires": [ 28822 "io-base", 28823 "datatype-xml-parse" 28824 ] 28825 }, 28826 "json": { 28827 "use": [ 28828 "json-parse", 28829 "json-stringify" 28830 ] 28831 }, 28832 "json-parse": { 28833 "requires": [ 28834 "yui-base" 28835 ] 28836 }, 28837 "json-parse-shim": { 28838 "condition": { 28839 "name": "json-parse-shim", 28840 "test": function (Y) { 28841 var _JSON = Y.config.global.JSON, 28842 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, 28843 nativeSupport = Y.config.useNativeJSONParse !== false && !!Native; 28844 28845 function workingNative( k, v ) { 28846 return k === "ok" ? true : v; 28847 } 28848 28849 // Double check basic functionality. This is mainly to catch early broken 28850 // implementations of the JSON API in Firefox 3.1 beta1 and beta2
28851 if ( nativeSupport ) { 28852 try { 28853 nativeSupport = ( Native.parse( '{"ok":false}', workingNative ) ).ok; 28854 } 28855 catch ( e ) { 28856 nativeSupport = false; 28857 } 28858 } 28859 28860 return !nativeSupport; 28861}, 28862 "trigger": "json-parse" 28863 }, 28864 "requires": [ 28865 "json-parse" 28866 ] 28867 }, 28868 "json-stringify": { 28869 "requires": [ 28870 "yui-base" 28871 ] 28872 }, 28873 "json-stringify-shim": { 28874 "condition": { 28875 "name": "json-stringify-shim", 28876 "test": function (Y) { 28877 var _JSON = Y.config.global.JSON, 28878 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, 28879 nativeSupport = Y.config.useNativeJSONStringify !== false && !!Native; 28880 28881 // Double check basic native functionality. This is primarily to catch broken 28882 // early JSON API implementations in Firefox 3.1 beta1 and beta2. 28883 if ( nativeSupport ) { 28884 try { 28885 nativeSupport = ( '0' === Native.stringify(0) ); 28886 } catch ( e ) { 28887 nativeSupport = false; 28888 } 28889 } 28890 28891 28892 return !nativeSupport; 28893}, 28894 "trigger": "json-stringify" 28895 }, 28896 "requires": [ 28897 "json-stringify" 28898 ] 28899 }, 28900 "jsonp": { 28901 "requires": [ 28902 "get", 28903 "oop" 28904 ] 28905 }, 28906 "jsonp-url": { 28907 "requires": [ 28908 "jsonp" 28909 ] 28910 }, 28911 "lazy-model-list": { 28912 "requires": [ 28913 "model-list" 28914 ] 28915 }, 28916 "loader": { 28917 "use": [ 28918 "loader-base", 28919 "loader-rollup", 28920 "loader-yui3" 28921 ] 28922 }, 28923 "loader-base": { 28924 "requires": [ 28925 "get", 28926 "features" 28927 ] 28928 }, 28929 "loader-pathogen-combohandler": {}, 28930 "loader-pathogen-encoder": { 28931 "use": [ 28932 "loader-base", 28933 "loader-rollup", 28934 "loader-yui3", 28935 "loader-pathogen-combohandler" 28936 ] 28937 }, 28938 "loader-rollup": { 28939 "requires": [ 28940 "loader-base" 28941 ] 28942 }, 28943 "loader-yui3": { 28944 "requires": [ 28945 "loader-base" 28946 ] 28947 }, 28948 "matrix": { 28949 "requires": [ 28950 "yui-base" 28951 ] 28952 }, 28953 "model": { 28954 "requires": [ 28955 "base-build", 28956 "escape", 28957 "json-parse" 28958 ] 28959 }, 28960 "model-list": { 28961 "requires": [ 28962 "array-extras", 28963 "array-invoke", 28964 "arraylist", 28965 "base-build", 28966 "escape", 28967 "json-parse", 28968 "model" 28969 ] 28970 }, 28971 "model-sync-local": { 28972 "requires": [ 28973 "model", 28974 "json-stringify" 28975 ] 28976 }, 28977 "model-sync-rest": { 28978 "requires": [ 28979 "model", 28980 "io-base", 28981 "json-stringify" 28982 ] 28983 }, 28984 "node": { 28985 "use": [ 28986 "node-base", 28987 "node-event-delegate", 28988 "node-pluginhost", 28989 "node-screen", 28990 "node-style" 28991 ] 28992 }, 28993 "node-base": { 28994 "requires": [ 28995 "event-base", 28996 "node-core", 28997 "dom-base", 28998 "dom-style" 28999 ] 29000 }, 29001 "node-core": { 29002 "requires": [ 29003 "dom-core", 29004 "selector" 29005 ] 29006 }, 29007 "node-event-delegate": { 29008 "requires": [ 29009 "node-base", 29010 "event-delegate" 29011 ] 29012 }, 29013 "node-event-html5": { 29014 "requires": [ 29015 "node-base" 29016 ] 29017 }, 29018 "node-event-simulate": { 29019 "requires": [ 29020 "node-base", 29021 "event-simulate", 29022 "gesture-simulate" 29023 ] 29024 }, 29025 "node-flick": { 29026 "requires": [ 29027 "classnamemanager", 29028 "transition", 29029 "event-flick", 29030 "plugin" 29031 ], 29032 "skinnable": true 29033 }, 29034 "node-focusmanager": { 29035 "requires": [ 29036 "attribute", 29037 "node", 29038 "plugin", 29039 "node-event-simulate", 29040 "event-key", 29041 "event-focus" 29042 ] 29043 }, 29044 "node-load": { 29045 "requires": [ 29046 "node-base", 29047 "io-base" 29048 ] 29049 }, 29050 "node-menunav": { 29051 "requires": [ 29052 "node", 29053 "classnamemanager", 29054 "plugin", 29055 "node-focusmanager" 29056 ], 29057 "skinnable": true 29058 }, 29059 "node-pluginhost": { 29060 "requires": [ 29061 "node-base", 29062 "pluginhost" 29063 ] 29064 }, 29065 "node-screen": { 29066 "requires": [ 29067 "dom-screen", 29068 "node-base" 29069 ] 29070 }, 29071 "node-scroll-info": { 29072 "requires": [ 29073 "array-extras", 29074 "base-build", 29075 "event-resize", 29076 "node-pluginhost", 29077 "plugin", 29078 "selector" 29079 ] 29080 }, 29081 "node-style": { 29082 "requires": [ 29083 "dom-style", 29084 "node-base" 29085 ] 29086 }, 29087 "oop": { 29088 "requires": [ 29089 "yui-base" 29090 ] 29091 }, 29092 "overlay": { 29093 "requires": [ 29094 "widget", 29095 "widget-stdmod", 29096 "widget-position", 29097 "widget-position-align", 29098 "widget-stack", 29099 "widget-position-constrain" 29100 ], 29101 "skinnable": true 29102 }, 29103 "paginator": { 29104 "requires": [ 29105 "paginator-core" 29106 ] 29107 }, 29108 "paginator-core": { 29109 "requires": [ 29110 "base" 29111 ] 29112 }, 29113 "paginator-url": { 29114 "requires": [ 29115 "paginator" 29116 ] 29117 }, 29118 "panel": { 29119 "requires": [ 29120 "widget", 29121 "widget-autohide", 29122 "widget-buttons", 29123 "widget-modality", 29124 "widget-position", 29125 "widget-position-align", 29126 "widget-position-constrain", 29127 "widget-stack", 29128 "widget-stdmod" 29129 ], 29130 "skinnable": true 29131 }, 29132 "parallel": { 29133 "requires": [ 29134 "yui-base" 29135 ] 29136 }, 29137 "pjax": { 29138 "requires": [ 29139 "pjax-base", 29140 "pjax-content" 29141 ] 29142 }, 29143 "pjax-base": { 29144 "requires": [ 29145 "classnamemanager", 29146 "node-event-delegate", 29147 "router" 29148 ] 29149 }, 29150 "pjax-content": { 29151 "requires": [ 29152 "io-base", 29153 "node-base", 29154 "router" 29155 ] 29156 }, 29157 "pjax-plugin": { 29158 "requires": [ 29159 "node-pluginhost", 29160 "pjax", 29161 "plugin" 29162 ] 29163 }, 29164 "plugin": { 29165 "requires": [ 29166 "base-base" 29167 ] 29168 }, 29169 "pluginhost": { 29170 "use": [ 29171 "pluginhost-base", 29172 "pluginhost-config" 29173 ] 29174 }, 29175 "pluginhost-base": { 29176 "requires": [ 29177 "yui-base" 29178 ] 29179 }, 29180 "pluginhost-config": { 29181 "requires": [ 29182 "pluginhost-base" 29183 ] 29184 }, 29185 "promise": { 29186 "requires": [ 29187 "timers" 29188 ] 29189 }, 29190 "querystring": { 29191 "use": [ 29192 "querystring-parse", 29193 "querystring-stringify" 29194 ] 29195 }, 29196 "querystring-parse": { 29197 "requires": [ 29198 "yui-base", 29199 "array-extras" 29200 ] 29201 }, 29202 "querystring-parse-simple": { 29203 "requires": [ 29204 "yui-base" 29205 ] 29206 }, 29207 "querystring-stringify": { 29208 "requires": [ 29209 "yui-base" 29210 ] 29211 }, 29212 "querystring-stringify-simple": { 29213 "requires": [ 29214 "yui-base" 29215 ] 29216 }, 29217 "queue-promote": { 29218 "requires": [ 29219 "yui-base" 29220 ] 29221 }, 29222 "range-slider": { 29223 "requires": [ 29224 "slider-base", 29225 "slider-value-range", 29226 "clickable-rail" 29227 ] 29228 }, 29229 "recordset": { 29230 "use": [ 29231 "recordset-base", 29232 "recordset-sort", 29233 "recordset-filter", 29234 "recordset-indexer" 29235 ] 29236 }, 29237 "recordset-base": { 29238 "requires": [ 29239 "base", 29240 "arraylist" 29241 ] 29242 }, 29243 "recordset-filter": { 29244 "requires": [ 29245 "recordset-base", 29246 "array-extras", 29247 "plugin" 29248 ] 29249 }, 29250 "recordset-indexer": { 29251 "requires": [ 29252 "recordset-base", 29253 "plugin" 29254 ] 29255 }, 29256 "recordset-sort": { 29257 "requires": [ 29258 "arraysort", 29259 "recordset-base", 29260 "plugin" 29261 ] 29262 }, 29263 "resize": { 29264 "use": [ 29265 "resize-base", 29266 "resize-proxy", 29267 "resize-constrain" 29268 ] 29269 }, 29270 "resize-base": { 29271 "requires": [ 29272 "base", 29273 "widget", 29274 "event", 29275 "oop", 29276 "dd-drag", 29277 "dd-delegate", 29278 "dd-drop" 29279 ], 29280 "skinnable": true 29281 }, 29282 "resize-constrain": { 29283 "requires": [ 29284 "plugin", 29285 "resize-base" 29286 ] 29287 }, 29288 "resize-plugin": { 29289 "optional": [ 29290 "resize-constrain" 29291 ], 29292 "requires": [ 29293 "resize-base", 29294 "plugin" 29295 ] 29296 }, 29297 "resize-proxy": { 29298 "requires": [ 29299 "plugin", 29300 "resize-base" 29301 ] 29302 }, 29303 "router": { 29304 "optional": [ 29305 "querystring-parse" 29306 ], 29307 "requires": [ 29308 "array-extras", 29309 "base-build", 29310 "history" 29311 ] 29312 }, 29313 "scrollview": { 29314 "requires": [ 29315 "scrollview-base", 29316 "scrollview-scrollbars" 29317 ] 29318 }, 29319 "scrollview-base": { 29320 "requires": [ 29321 "widget", 29322 "event-gestures", 29323 "event-mousewheel", 29324 "transition" 29325 ], 29326 "skinnable": true 29327 }, 29328 "scrollview-base-ie": { 29329 "condition": { 29330 "name": "scrollview-base-ie", 29331 "trigger": "scrollview-base", 29332 "ua": "ie" 29333 }, 29334 "requires": [ 29335 "scrollview-base" 29336 ] 29337 }, 29338 "scrollview-list": { 29339 "requires": [ 29340 "plugin", 29341 "classnamemanager" 29342 ], 29343 "skinnable": true 29344 }, 29345 "scrollview-paginator": { 29346 "requires": [ 29347 "plugin", 29348 "classnamemanager" 29349 ] 29350 }, 29351 "scrollview-scrollbars": { 29352 "requires": [ 29353 "classnamemanager", 29354 "transition", 29355 "plugin" 29356 ], 29357 "skinnable": true 29358 }, 29359 "selector": { 29360 "requires": [ 29361 "selector-native" 29362 ] 29363 }, 29364 "selector-css2": { 29365 "condition": { 29366 "name": "selector-css2", 29367 "test": function (Y) { 29368 var DOCUMENT = Y.config.doc, 29369 ret = DOCUMENT && !('querySelectorAll' in DOCUMENT); 29370 29371 return ret; 29372}, 29373 "trigger": "selector" 29374 }, 29375 "requires": [ 29376 "selector-native" 29377 ] 29378 }, 29379 "selector-css3": { 29380 "requires": [ 29381 "selector-native", 29382 "selector-css2" 29383 ] 29384 }, 29385 "selector-native": { 29386 "requires": [ 29387 "dom-base" 29388 ] 29389 }, 29390 "series-area": { 29391 "requires": [ 29392 "series-cartesian", 29393 "series-fill-util" 29394 ] 29395 }, 29396 "series-area-stacked": { 29397 "requires": [ 29398 "series-stacked", 29399 "series-area" 29400 ] 29401 }, 29402 "series-areaspline": { 29403 "requires": [ 29404 "series-area", 29405 "series-curve-util" 29406 ] 29407 }, 29408 "series-areaspline-stacked": { 29409 "requires": [ 29410 "series-stacked", 29411 "series-areaspline" 29412 ] 29413 }, 29414 "series-bar": { 29415 "requires": [ 29416 "series-marker", 29417 "series-histogram-base" 29418 ] 29419 }, 29420 "series-bar-stacked": { 29421 "requires": [ 29422 "series-stacked", 29423 "series-bar" 29424 ] 29425 }, 29426 "series-base": { 29427 "requires": [ 29428 "graphics", 29429 "axis-base" 29430 ] 29431 }, 29432 "series-candlestick": { 29433 "requires": [ 29434 "series-range" 29435 ] 29436 }, 29437 "series-cartesian": { 29438 "requires": [ 29439 "series-base" 29440 ] 29441 }, 29442 "series-column": { 29443 "requires": [ 29444 "series-marker", 29445 "series-histogram-base" 29446 ] 29447 }, 29448 "series-column-stacked": { 29449 "requires": [ 29450 "series-stacked", 29451 "series-column" 29452 ] 29453 }, 29454 "series-combo": { 29455 "requires": [ 29456 "series-cartesian", 29457 "series-line-util", 29458 "series-plot-util", 29459 "series-fill-util" 29460 ] 29461 }, 29462 "series-combo-stacked": { 29463 "requires": [ 29464 "series-stacked", 29465 "series-combo" 29466 ] 29467 }, 29468 "series-combospline": { 29469 "requires": [ 29470 "series-combo", 29471 "series-curve-util" 29472 ] 29473 }, 29474 "series-combospline-stacked": { 29475 "requires": [ 29476 "series-combo-stacked", 29477 "series-curve-util" 29478 ] 29479 }, 29480 "series-curve-util": {}, 29481 "series-fill-util": {}, 29482 "series-histogram-base": { 29483 "requires": [ 29484 "series-cartesian", 29485 "series-plot-util" 29486 ] 29487 }, 29488 "series-line": { 29489 "requires": [ 29490 "series-cartesian", 29491 "series-line-util" 29492 ] 29493 }, 29494 "series-line-stacked": { 29495 "requires": [ 29496 "series-stacked", 29497 "series-line" 29498 ] 29499 }, 29500 "series-line-util": {}, 29501 "series-marker": { 29502 "requires": [ 29503 "series-cartesian", 29504 "series-plot-util" 29505 ] 29506 }, 29507 "series-marker-stacked": { 29508 "requires": [ 29509 "series-stacked", 29510 "series-marker" 29511 ] 29512 }, 29513 "series-ohlc": { 29514 "requires": [ 29515 "series-range" 29516 ] 29517 }, 29518 "series-pie": { 29519 "requires": [ 29520 "series-base", 29521 "series-plot-util" 29522 ] 29523 }, 29524 "series-plot-util": {}, 29525 "series-range": { 29526 "requires": [ 29527 "series-cartesian" 29528 ] 29529 }, 29530 "series-spline": { 29531 "requires": [ 29532 "series-line", 29533 "series-curve-util" 29534 ] 29535 }, 29536 "series-spline-stacked": { 29537 "requires": [ 29538 "series-stacked", 29539 "series-spline" 29540 ] 29541 }, 29542 "series-stacked": { 29543 "requires": [ 29544 "axis-stacked" 29545 ] 29546 }, 29547 "shim-plugin": { 29548 "requires": [ 29549 "node-style", 29550 "node-pluginhost" 29551 ] 29552 }, 29553 "slider": { 29554 "use": [ 29555 "slider-base", 29556 "slider-value-range", 29557 "clickable-rail", 29558 "range-slider" 29559 ] 29560 }, 29561 "slider-base": { 29562 "requires": [ 29563 "widget", 29564 "dd-constrain", 29565 "event-key" 29566 ], 29567 "skinnable": true 29568 }, 29569 "slider-value-range": { 29570 "requires": [ 29571 "slider-base" 29572 ] 29573 }, 29574 "sortable": { 29575 "requires": [ 29576 "dd-delegate", 29577 "dd-drop-plugin", 29578 "dd-proxy" 29579 ] 29580 }, 29581 "sortable-scroll": { 29582 "requires": [ 29583 "dd-scroll", 29584 "sortable" 29585 ] 29586 }, 29587 "stylesheet": { 29588 "requires": [ 29589 "yui-base" 29590 ] 29591 }, 29592 "substitute": { 29593 "optional": [ 29594 "dump" 29595 ], 29596 "requires": [ 29597 "yui-base" 29598 ] 29599 }, 29600 "swf": { 29601 "requires": [ 29602 "event-custom", 29603 "node", 29604 "swfdetect", 29605 "escape" 29606 ] 29607 }, 29608 "swfdetect": { 29609 "requires": [ 29610 "yui-base" 29611 ] 29612 }, 29613 "tabview": { 29614 "requires": [ 29615 "widget", 29616 "widget-parent", 29617 "widget-child", 29618 "tabview-base", 29619 "node-pluginhost", 29620 "node-focusmanager" 29621 ], 29622 "skinnable": true 29623 }, 29624 "tabview-base": { 29625 "requires": [ 29626 "node-event-delegate", 29627 "classnamemanager" 29628 ] 29629 }, 29630 "tabview-plugin": { 29631 "requires": [ 29632 "tabview-base" 29633 ] 29634 }, 29635 "template": { 29636 "use": [ 29637 "template-base", 29638 "template-micro" 29639 ] 29640 }, 29641 "template-base": { 29642 "requires": [ 29643 "yui-base" 29644 ] 29645 }, 29646 "template-micro": { 29647 "requires": [ 29648 "escape" 29649 ] 29650 }, 29651 "test": { 29652 "requires": [ 29653 "event-simulate", 29654 "event-custom", 29655 "json-stringify" 29656 ] 29657 }, 29658
29658 "test-console": { 29659 "requires": [ 29660 "console-filters", 29661 "test", 29662 "array-extras" 29663 ], 29664 "skinnable": true 29665 }, 29666 "text": { 29667 "use": [ 29668 "text-accentfold", 29669 "text-wordbreak" 29670 ] 29671 }, 29672 "text-accentfold": { 29673 "requires": [ 29674 "array-extras", 29675 "text-data-accentfold" 29676 ] 29677 }, 29678 "text-data-accentfold": { 29679 "requires": [ 29680 "yui-base" 29681 ] 29682 }, 29683 "text-data-wordbreak": { 29684 "requires": [ 29685 "yui-base" 29686 ] 29687 }, 29688 "text-wordbreak": { 29689 "requires": [ 29690 "array-extras", 29691 "text-data-wordbreak" 29692 ] 29693 }, 29694 "timers": { 29695 "requires": [ 29696 "yui-base" 29697 ] 29698 }, 29699 "transition": { 29700 "requires": [ 29701 "node-style" 29702 ] 29703 }, 29704 "transition-timer": { 29705 "condition": { 29706 "name": "transition-timer", 29707 "test": function (Y) { 29708 var DOCUMENT = Y.config.doc, 29709 node = (DOCUMENT) ? DOCUMENT.documentElement: null, 29710 ret = true; 29711 29712 if (node && node.style) { 29713 ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); 29714 } 29715 29716 return ret; 29717}, 29718 "trigger": "transition" 29719 }, 29720 "requires": [ 29721 "transition" 29722 ] 29723 }, 29724 "tree": { 29725 "requires": [ 29726 "base-build", 29727 "tree-node" 29728 ] 29729 }, 29730 "tree-labelable": { 29731 "requires": [ 29732 "tree" 29733 ] 29734 }, 29735 "tree-lazy": { 29736 "requires": [ 29737 "base-pluginhost", 29738 "plugin", 29739 "tree" 29740 ] 29741 }, 29742 "tree-node": {}, 29743 "tree-openable": { 29744 "requires": [ 29745 "tree" 29746 ] 29747 }, 29748 "tree-selectable": { 29749 "requires": [ 29750 "tree" 29751 ] 29752 }, 29753 "tree-sortable": { 29754 "requires": [ 29755 "tree" 29756 ] 29757 }, 29758 "uploader": { 29759 "requires": [ 29760 "uploader-html5", 29761 "uploader-flash" 29762 ] 29763 }, 29764 "uploader-flash": { 29765 "requires": [ 29766 "swfdetect", 29767 "escape", 29768 "widget", 29769 "base", 29770 "cssbutton", 29771 "node", 29772 "event-custom", 29773 "uploader-queue" 29774 ] 29775 }, 29776 "uploader-html5": { 29777 "requires": [ 29778 "widget", 29779 "node-event-simulate", 29780 "file-html5", 29781 "uploader-queue" 29782 ] 29783 }, 29784 "uploader-queue": { 29785 "requires": [ 29786 "base" 29787 ] 29788 }, 29789 "view": { 29790 "requires": [ 29791 "base-build", 29792 "node-event-delegate" 29793 ] 29794 }, 29795 "view-node-map": { 29796 "requires": [ 29797 "view" 29798 ] 29799 }, 29800 "widget": { 29801 "use": [ 29802 "widget-base", 29803 "widget-htmlparser", 29804 "widget-skin", 29805 "widget-uievents" 29806 ] 29807 }, 29808 "widget-anim": { 29809 "requires": [ 29810 "anim-base", 29811 "plugin", 29812 "widget" 29813 ] 29814 }, 29815 "widget-autohide": { 29816 "requires": [ 29817 "base-build", 29818 "event-key", 29819 "event-outside", 29820 "widget" 29821 ] 29822 }, 29823 "widget-base": { 29824 "requires": [ 29825 "attribute", 29826 "base-base", 29827 "base-pluginhost", 29828 "classnamemanager", 29829 "event-focus", 29830 "node-base", 29831 "node-style" 29832 ], 29833 "skinnable": true 29834 }, 29835 "widget-base-ie": { 29836 "condition": { 29837 "name": "widget-base-ie", 29838 "trigger": "widget-base", 29839 "ua": "ie" 29840 }, 29841 "requires": [ 29842 "widget-base" 29843 ] 29844 }, 29845 "widget-buttons": { 29846 "requires": [ 29847 "button-plugin", 29848 "cssbutton", 29849 "widget-stdmod" 29850 ] 29851 }, 29852 "widget-child": { 29853 "requires": [ 29854 "base-build", 29855 "widget" 29856 ] 29857 }, 29858 "widget-htmlparser": { 29859 "requires": [ 29860 "widget-base" 29861 ] 29862 }, 29863 "widget-modality": { 29864 "requires": [ 29865 "base-build", 29866 "event-outside", 29867 "widget" 29868 ], 29869 "skinnable": true 29870 }, 29871 "widget-parent": { 29872 "requires": [ 29873 "arraylist", 29874 "base-build", 29875 "widget" 29876 ] 29877 }, 29878 "widget-position": { 29879 "requires": [ 29880 "base-build", 29881 "node-screen", 29882 "widget" 29883 ] 29884 }, 29885 "widget-position-align": { 29886 "requires": [ 29887 "widget-position" 29888 ] 29889 }, 29890 "widget-position-constrain": { 29891 "requires": [ 29892 "widget-position" 29893 ] 29894 }, 29895 "widget-skin": { 29896 "requires": [ 29897 "widget-base" 29898 ] 29899 }, 29900 "widget-stack": { 29901 "requires": [ 29902 "base-build", 29903 "widget" 29904 ], 29905 "skinnable": true 29906 }, 29907 "widget-stdmod": { 29908 "requires": [ 29909 "base-build", 29910 "widget" 29911 ] 29912 }, 29913 "widget-uievents": { 29914 "requires": [ 29915 "node-event-delegate", 29916 "widget-base" 29917 ] 29918 }, 29919 "yql": { 29920 "requires": [ 29921 "oop" 29922 ] 29923 }, 29924 "yql-jsonp": { 29925 "condition": { 29926 "name": "yql-jsonp", 29927 "test": function (Y) { 29928 /* Only load the JSONP module when not in nodejs or winjs 29929 TODO Make the winjs module a CORS module 29930 */ 29931 return (!Y.UA.nodejs && !Y.UA.winjs); 29932}, 29933 "trigger": "yql" 29934 }, 29935 "requires": [ 29936 "yql", 29937 "jsonp", 29938 "jsonp-url" 29939 ] 29940 }, 29941 "yql-nodejs": { 29942 "condition": { 29943 "name": "yql-nodejs", 29944 "trigger": "yql", 29945 "ua": "nodejs" 29946 }, 29947 "requires": [ 29948 "yql" 29949 ] 29950 }, 29951 "yql-winjs": { 29952 "condition": { 29953 "name": "yql-winjs", 29954 "trigger": "yql", 29955 "ua": "winjs" 29956 }, 29957 "requires": [ 29958 "yql" 29959 ] 29960 }, 29961 "yui": {}, 29962 "yui-base": {}, 29963 "yui-later": { 29964 "requires": [ 29965 "yui-base" 29966 ] 29967 }, 29968 "yui-log": { 29969 "requires": [ 29970 "yui-base" 29971 ] 29972 }, 29973 "yui-throttle": { 29974 "requires": [ 29975 "yui-base" 29976 ] 29977 } 29978}); 29979YUI.Env[Y.version].md5 = '95eb05a1b097773b5af03e0680e7dda4'; 29980 29981 29982}, 'patched-v3.18.3', {"requires": ["loader-base"]}); 29983YUI.add('yui', function (Y, NAME) {}, 'patched-v3.18.3', { 29984 "use": [ 29985 "yui-base", 29986 "get", 29987 "features", 29988 "intl-base", 29989 "yui-log", 29990 "yui-later", 29991 "loader-base", 29992 "loader-rollup", 29993 "loader-yui3" 29994 ] 29995}); 29996YUI.add('aui-base-core', function (A, NAME) { 29997 29998var Y = A; 29999YUI.Env.aliases = YUI.Env.aliases || {}; 30000Y.mix(YUI.Env.aliases, { 30001 "aui-autosize": ["aui-autosize-iframe"], 30002 "aui-base": ["oop","yui-throttle","aui-classnamemanager","aui-debounce","aui-base-core","aui-base-lang","aui-node-base"], 30003 "aui-base-deprecated": ["aui-base","aui-node","aui-component","aui-delayed-task-deprecated","aui-selector","aui-event-base"], 30004 "aui-button": ["aui-button-core"], 30005 "aui-collection": ["aui-map","aui-set","aui-linkedset"], 30006 "aui-color-picker-deprecated": ["aui-color-picker-base-deprecated","aui-color-picker-grid-plugin-deprecated"], 30007 "aui-datasource-control-deprecated": ["aui-datasource-control-base-deprecated","aui-input-text-control-deprecated"], 30008 "aui-datatable": ["aui-datatable-edit","aui-datatable-highlight","aui-datatable-selection","aui-datatable-property-list"], 30009 "aui-datatable-edit": ["datatable-base","calendar","overlay","sortable","aui-datatype","aui-toolbar","aui-form-validator","aui-datatable-base-cell-editor","aui-datatable-base-options-cell-editor","aui-datatable-cell-editor-support","aui-datatable-core","aui-datatable-checkbox-cell-editor","aui-datatable-date-cell-editor","aui-datatable-dropdown-cell-editor","aui-datatable-radio-cell-editor","aui-datatable-text-cell-editor","aui-datatable-text-area-cell-editor"], 30010 "aui-datepicker-deprecated": ["aui-datepicker-base-deprecated","aui-datepicker-select-deprecated"], 30011 "aui-event": ["aui-event-base"], 30012 "aui-form-deprecated": ["aui-form-base-deprecated","aui-form-combobox-deprecated","aui-form-field-deprecated","aui-form-select-deprecated","aui-form-textarea-deprecated","aui-form-textfield-deprecated"], 30013 "aui-io": ["aui-io-request"], 30014 "aui-io-deprecated": ["aui-io-request","aui-io-plugin-deprecated"], 30015 "aui-node": ["aui-node-base"], 30016 "aui-overlay-deprecated": ["aui-overlay-base-deprecated","aui-overlay-context-deprecated","aui-overlay-context-panel-deprecated","aui-overlay-manager-deprecated","aui-overlay-mask-deprecated"], 30017 "aui-rating": ["aui-rating-base","aui-rating-thumb"], 30018 "aui-resize-deprecated": ["aui-resize-base-deprecated","aui-resize-constrain-deprecated"], 30019 "aui-scheduler": ["event-gestures","aui-scheduler-base","aui-scheduler-event-recorder","aui-scheduler-view-agenda","aui-scheduler-view-day","aui-scheduler-view-month","aui-scheduler-view-table-dd","aui-scheduler-view-table","aui-scheduler-view-week","aui-viewport"], 30020 "aui-search": ["aui-search-tst"], 30021 "aui-sortable": ["aui-sortable-layout","aui-sortable-list"], 30022 "aui-surface": ["aui-surface-app","aui-surface-screen"], 30023 "aui-toggler": ["aui-toggler-base","aui-toggler-delegate"], 30024 "aui-tooltip": ["aui-tooltip-base","aui-tooltip-delegate"], 30025 "aui-tpl-snippets-deprecated": ["aui-tpl-snippets-base-deprecated","aui-tpl-snippets-checkbox-deprecated","aui-tpl-snippets-input-deprecated","aui-tpl-snippets-select-deprecated","aui-tpl-snippets-textarea-deprecated"], 30026 "aui-tree": ["aui-tree-data","aui-tree-io","aui-tree-node","aui-tree-paginator","aui-tree-view"], 30027 "aui-widget": ["aui-widget-cssclass","aui-widget-toolbars"], 30028 "aui-widget-core": ["aui-widget-cssclass"] 30029}); 30030/* This file is auto-generated by (yogi loader --yes --mix --js js/aui-loader.js --json js/aui-loader.json --start ../) */ 30031 30032/*jshint maxlen:900, eqeqeq: false */ 30033 30034/** 30035 * YUI 3 module metadata 30036 * @module loader 30037 * @submodule loader-yui3 30038 */ 30039YUI.Env[Y.version].modules = YUI.Env[Y.version].modules || {}; 30040Y.mix(YUI.Env[Y.version].modules, { 30041 "aui-ace-autocomplete-base": { 30042 "requires": [ 30043 "aui-ace-editor" 30044 ] 30045 }, 30046 "aui-ace-autocomplete-freemarker": { 30047 "requires": [ 30048 "aui-ace-autocomplete-templateprocessor" 30049 ] 30050 }, 30051 "aui-ace-autocomplete-list": { 30052 "requires": [ 30053 "aui-ace-autocomplete-base", 30054 "overlay", 30055 "widget-autohide" 30056 ], 30057 "skinnable": true 30058 }, 30059 "aui-ace-autocomplete-plugin": { 30060 "requires": [ 30061 "aui-ace-autocomplete-list", 30062 "plugin" 30063 ] 30064 }, 30065 "aui-ace-autocomplete-templateprocessor": { 30066 "requires": [ 30067 "aui-ace-autocomplete-base" 30068 ] 30069 }, 30070 "aui-ace-autocomplete-velocity": { 30071 "requires": [ 30072 "aui-ace-autocomplete-templateprocessor" 30073 ] 30074 }, 30075 "aui-ace-editor": { 30076 "requires": [ 30077 "aui-node", 30078 "aui-component" 30079 ] 30080 }, 30081 "aui-affix": { 30082 "requires": [ 30083 "base", 30084 "node-screen", 30085 "aui-node" 30086 ] 30087 }, 30088 "aui-alert": { 30089 "requires": [ 30090 "aui-aria", 30091 "aui-classnamemanager", 30092 "aui-widget-cssclass", 30093 "aui-widget-transition", 30094 "timers", 30095 "widget", 30096 "widget-stdmod" 30097 ], 30098 "skinnable": true 30099 }, 30100 "aui-aria": { 30101 "requires": [ 30102 "plugin", 30103 "aui-component" 30104 ] 30105 }, 30106 "aui-aria-table-sortable": { 30107 "requires": [ 30108 "aui-aria" 30109 ] 30110 }, 30111 "aui-arraysort": { 30112 "requires": [ 30113 "arraysort" 30114 ] 30115 }, 30116 "aui-audio": { 30117 "requires": [ 30118 "aui-aria", 30119 "aui-node", 30120 "aui-component", 30121 "node-event-html5", 30122 "querystring-stringify-simple" 30123 ], 30124 "skinnable": true 30125 }, 30126 "aui-autocomplete-deprecated": { 30127 "requires": [ 30128 "aui-base-deprecated", 30129 "aui-overlay-base-deprecated", 30130 "datasource", 30131 "dataschema", 30132 "aui-form-combobox-deprecated" 30133 ], 30134 "skinnable": true 30135 }, 30136 "aui-autosize": { 30137 "use": [ 30138 "aui-autosize-iframe" 30139 ] 30140 }, 30141 "aui-autosize-deprecated": { 30142 "requires": [ 30143 "event-valuechange", 30144 "plugin", 30145 "aui-base-deprecated" 30146 ], 30147 "skinnable": true 30148 }, 30149 "aui-autosize-iframe": { 30150 "requires": [ 30151 "plugin", 30152 "aui-component", 30153 "aui-timer", 30154 "aui-node-base" 30155 ] 30156 }, 30157 "aui-base": { 30158 "use": [ 30159 "oop", 30160 "yui-throttle", 30161 "aui-classnamemanager", 30162 "aui-debounce", 30163 "aui-base-core", 30164 "aui-base-lang", 30165 "aui-node-base" 30166 ] 30167 }, 30168 "aui-base-core": {}, 30169 "aui-base-deprecated": { 30170 "use": [ 30171 "aui-base", 30172 "aui-node", 30173 "aui-component", 30174 "aui-delayed-task-deprecated", 30175 "aui-selector", 30176 "aui-event-base" 30177 ] 30178 }, 30179 "aui-base-html5-shiv": { 30180 "condition": { 30181 "name": "aui-base-html5-shiv", 30182 "trigger": "node-base", 30183 "ua": "ie" 30184 } 30185 }, 30186 "aui-base-lang": {}, 30187 "aui-boolean-data-editor": { 30188 "requires": [ 30189 "aui-button-switch", 30190 "aui-data-editor" 30191 ] 30192 }, 30193 "aui-button": { 30194 "use": [ 30195 "aui-button-core" 30196 ] 30197 }, 30198 "aui-button-core": { 30199 "requires": [ 30200 "button", 30201 "button-group", 30202 "button-plugin", 30203 "aui-component", 30204 "aui-widget-cssclass", 30205 "aui-widget-toggle" 30206 ], 30207 "skinnable": true 30208 }, 30209 "aui-button-item-deprecated": { 30210 "requires": [ 30211 "aui-base-deprecated", 30212 "aui-state-interaction-deprecated", 30213 "widget-child" 30214 ], 30215 "skinnable": true 30216 }, 30217 "aui-button-search-cancel": { 30218 "requires": [ 30219 "array-invoke", 30220 "base", 30221 "base-build", 30222 "event-focus", 30223 "event-move", 30224 "event-resize", 30225 "node-screen", 30226 "node-event-delegate", 30227 "aui-node-base", 30228 "aui-classnamemanager", 30229 "aui-event-input" 30230 ] 30231 }, 30232 "aui-button-switch": { 30233 "requires": [ 30234 "aui-node-base", 30235 "base-build", 30236 "event-key", 30237 "transition", 30238 "widget" 30239 ], 30240 "skinnable": true 30241 }, 30242 "aui-carousel": { 30243 "requires": [ 30244 "anim", 30245 "aui-event", 30246 "aui-image-viewer-base", 30247 "aui-image-viewer-slideshow", 30248 "node-event-delegate", 30249 "node-focusmanager" 30250 ], 30251 "skinnable": true 30252 }, 30253 "aui-carousel-mobile-touch": { 30254 "condition": { 30255 "name": "aui-carousel-mobile-touch", 30256 "test": function(A) { 30257 return A.UA.mobile && A.UA.touchEnabled; 30258}, 30259 "trigger": "aui-carousel" 30260 }, 30261 "requires": [ 30262 "base-build", 30263 "aui-carousel" 30264 ] 30265 }, 30266 "aui-carousel-swipe": { 30267 "condition": { 30268 "name": "aui-carousel-swipe", 30269 "trigger": "aui-carousel", 30270 "ua": "touchEnabled" 30271 }, 30272 "requires": [ 30273 "aui-carousel", 30274 "aui-widget-swipe", 30275 "base-build" 30276 ], 30277 "skinnable": true 30278 },
30279 "aui-char-counter": { 30280 "requires": [ 30281 "aui-aria", 30282 "aui-node", 30283 "aui-event-input", 30284 "aui-component" 30285 ] 30286 }, 30287 "aui-chart-deprecated": { 30288 "requires": [ 30289 "datasource", 30290 "json", 30291 "aui-swf-deprecated" 30292 ] 30293 }, 30294 "aui-classnamemanager": { 30295 "requires": [ 30296 "classnamemanager" 30297 ] 30298 }, 30299 "aui-collection": { 30300 "use": [ 30301 "aui-map", 30302 "aui-set", 30303 "aui-linkedset" 30304 ] 30305 }, 30306 "aui-color-palette": { 30307 "requires": [ 30308 "array-extras", 30309 "aui-palette", 30310 "color-base", 30311 "node-core", 30312 "aui-widget-cssclass", 30313 "aui-widget-toggle" 30314 ], 30315 "skinnable": true 30316 }, 30317 "aui-color-picker-base": { 30318 "requires": [ 30319 "aui-color-palette", 30320 "aui-hsva-palette-modal", 30321 "event-outside" 30322 ], 30323 "skinnable": true 30324 }, 30325 "aui-color-picker-base-deprecated": { 30326 "requires": [ 30327 "dd-drag", 30328 "panel", 30329 "slider", 30330 "aui-button-item-deprecated", 30331 "aui-color-util-deprecated", 30332 "aui-form-base-deprecated", 30333 "aui-overlay-context-deprecated" 30334 ], 30335 "skinnable": true 30336 }, 30337 "aui-color-picker-deprecated": { 30338 "use": [ 30339 "aui-color-picker-base-deprecated", 30340 "aui-color-picker-grid-plugin-deprecated" 30341 ] 30342 }, 30343 "aui-color-picker-grid-plugin-deprecated": { 30344 "requires": [ 30345 "plugin", 30346 "aui-color-picker-base-deprecated" 30347 ], 30348 "skinnable": true 30349 }, 30350 "aui-color-picker-popover": { 30351 "requires": [ 30352 "aui-color-picker-base", 30353 "aui-popover", 30354 "aui-widget-cssclass", 30355 "aui-widget-toggle" 30356 ], 30357 "skinnable": true 30358 }, 30359 "aui-color-util-deprecated": { 30360 "requires": [] 30361 }, 30362 "aui-component": { 30363 "requires": [ 30364 "aui-classnamemanager", 30365 "aui-widget-cssclass", 30366 "aui-widget-toggle", 30367 "base-build", 30368 "widget-base" 30369 ] 30370 }, 30371 "aui-css": { 30372 "type": "css" 30373 }, 30374 "aui-data-editor": { 30375 "requires": [ 30376 "aui-classnamemanager", 30377 "base-build", 30378 "node-base" 30379 ], 30380 "skinnable": true 30381 }, 30382 "aui-data-set-deprecated": { 30383 "requires": [ 30384 "oop", 30385 "collection", 30386 "base" 30387 ] 30388 }, 30389 "aui-datasource-control-base-deprecated": { 30390 "requires": [ 30391 "datasource", 30392 "dataschema", 30393 "aui-base-deprecated" 30394 ] 30395 }, 30396 "aui-datasource-control-deprecated": { 30397 "use": [ 30398 "aui-datasource-control-base-deprecated", 30399 "aui-input-text-control-deprecated" 30400 ] 30401 }, 30402 "aui-datatable": { 30403 "use": [ 30404 "aui-datatable-edit", 30405 "aui-datatable-highlight", 30406 "aui-datatable-selection", 30407 "aui-datatable-property-list" 30408 ] 30409 }, 30410 "aui-datatable-base-cell-editor": { 30411 "requires": [ 30412 "datatable-base", 30413 "overlay" 30414 ], 30415 "skinnable": true 30416 }, 30417 "aui-datatable-base-options-cell-editor": { 30418 "requires": [ 30419 "aui-datatable-base-cell-editor", 30420 "escape" 30421 ], 30422 "skinnable": true 30423 }, 30424 "aui-datatable-body": { 30425 "requires": [ 30426 "aui-classnamemanager", 30427 "datatable-base", 30428 "event-key", 30429 "aui-event-base" 30430 ] 30431 }, 30432 "aui-datatable-cell-editor-support": { 30433 "requires": [ 30434 "datatable-base" 30435 ] 30436 }, 30437 "aui-datatable-checkbox-cell-editor": { 30438 "requires": [ 30439 "aui-datatable-base-options-cell-editor" 30440 ] 30441 }, 30442 "aui-datatable-core": { 30443 "requires": [ 30444 "aui-datatable-body", 30445 "datatable-base", 30446 "event-key", 30447 "aui-event-base" 30448 ], 30449 "skinnable": true 30450 }, 30451 "aui-datatable-date-cell-editor": { 30452 "requires": [ 30453 "aui-datatable-base-options-cell-editor" 30454 ] 30455 }, 30456 "aui-datatable-dropdown-cell-editor": { 30457 "requires": [ 30458 "aui-datatable-base-options-cell-editor" 30459 ] 30460 }, 30461 "aui-datatable-edit": { 30462 "use": [ 30463 "datatable-base", 30464 "calendar", 30465 "overlay", 30466 "sortable", 30467 "aui-datatype", 30468 "aui-toolbar", 30469 "aui-form-validator", 30470 "aui-datatable-base-cell-editor", 30471 "aui-datatable-base-options-cell-editor", 30472 "aui-datatable-cell-editor-support", 30473 "aui-datatable-core", 30474 "aui-datatable-checkbox-cell-editor", 30475 "aui-datatable-date-cell-editor", 30476 "aui-datatable-dropdown-cell-editor", 30477 "aui-datatable-radio-cell-editor", 30478 "aui-datatable-text-cell-editor", 30479 "aui-datatable-text-area-cell-editor" 30480 ] 30481 }, 30482 "aui-datatable-highlight": { 30483 "requires": [ 30484 "aui-datatable-selection" 30485 ], 30486 "skinnable": true 30487 }, 30488 "aui-datatable-property-list": { 30489 "requires": [ 30490 "datatable-scroll", 30491 "datatable-sort", 30492 "aui-datatable-core", 30493 "aui-datatable-edit", 30494 "aui-datatable-highlight", 30495 "aui-datatable-selection", 30496 "aui-widget-cssclass", 30497 "aui-widget-toggle" 30498 ], 30499 "skinnable": true 30500 }, 30501 "aui-datatable-radio-cell-editor": { 30502 "requires": [ 30503 "aui-datatable-base-options-cell-editor" 30504 ] 30505 }, 30506 "aui-datatable-selection": { 30507 "requires": [ 30508 "aui-datatable-core" 30509 ], 30510 "skinnable": true 30511 }, 30512 "aui-datatable-text-area-cell-editor": { 30513 "requires": [ 30514 "aui-datatable-base-options-cell-editor" 30515 ] 30516 }, 30517 "aui-datatable-text-cell-editor": { 30518 "requires": [ 30519 "aui-datatable-base-options-cell-editor" 30520 ] 30521 }, 30522 "aui-datatype": { 30523 "requires": [ 30524 "datatype", 30525 "aui-datatype-date-parse" 30526 ] 30527 }, 30528 "aui-datatype-date-parse": { 30529 "requires": [ 30530 "aui-base-lang", 30531 "datatype-date-format", 30532 "datatype-date-parse", 30533 "intl" 30534 ] 30535 }, 30536 "aui-datepicker": { 30537 "requires": [ 30538 "aui-aria", 30539 "aui-datepicker-delegate", 30540 "aui-datepicker-popover", 30541 "base", 30542 "base-build", 30543 "calendar" 30544 ], 30545 "skinnable": true 30546 }, 30547 "aui-datepicker-base-deprecated": { 30548 "requires": [ 30549 "calendar", 30550 "aui-datatype", 30551 "aui-overlay-context-deprecated" 30552 ], 30553 "skinnable": true 30554 }, 30555 "aui-datepicker-delegate": { 30556 "requires": [ 30557 "aui-datatype-date-parse", 30558 "aui-event-input", 30559 "event-focus", 30560 "node-event-delegate" 30561 ] 30562 }, 30563 "aui-datepicker-deprecated": { 30564 "skinnable": true, 30565 "use": [ 30566 "aui-datepicker-base-deprecated", 30567 "aui-datepicker-select-deprecated" 30568 ] 30569 }, 30570 "aui-datepicker-native": { 30571 "requires": [ 30572 "aui-datepicker-delegate", 30573 "aui-node-base", 30574 "base", 30575 "base-build" 30576 ] 30577 }, 30578 "aui-datepicker-popover": { 30579 "requires": [ 30580 "aui-classnamemanager", 30581 "aui-popover" 30582 ] 30583 }, 30584 "aui-datepicker-select-deprecated": { 30585 "requires": [ 30586 "aui-datepicker-base-deprecated", 30587 "aui-button-item-deprecated" 30588 ], 30589 "skinnable": true 30590 }, 30591 "aui-debounce": {}, 30592 "aui-delayed-task-deprecated": { 30593 "requires": [ 30594 "yui-base" 30595 ] 30596 }, 30597 "aui-diagram-builder": { 30598 "requires": [ 30599 "aui-aria", 30600 "aui-map", 30601 "aui-property-builder",
30602 "aui-diagram-builder-connector", 30603 "aui-property-builder-settings", 30604 "aui-diagram-node-condition", 30605 "aui-diagram-node-end", 30606 "aui-diagram-node-fork", 30607 "aui-diagram-node-join", 30608 "aui-diagram-node-start", 30609 "aui-diagram-node-state", 30610 "aui-diagram-node-task", 30611 "overlay" 30612 ], 30613 "skinnable": true 30614 }, 30615 "aui-diagram-builder-connector": { 30616 "requires": [ 30617 "arraylist-add", 30618 "arraylist-filter", 30619 "escape", 30620 "json", 30621 "graphics", 30622 "dd" 30623 ], 30624 "skinnable": true 30625 }, 30626 "aui-diagram-node": { 30627 "requires": [ 30628 "aui-aria", 30629 "aui-diagram-node-manager-base", 30630 "escape", 30631 "overlay" 30632 ] 30633 }, 30634 "aui-diagram-node-condition": { 30635 "requires": [ 30636 "aui-diagram-node-state" 30637 ] 30638 }, 30639 "aui-diagram-node-end": { 30640 "requires": [ 30641 "aui-diagram-node-state" 30642 ] 30643 }, 30644 "aui-diagram-node-fork": { 30645 "requires": [ 30646 "aui-diagram-node-state" 30647 ] 30648 }, 30649 "aui-diagram-node-join": { 30650 "requires": [ 30651 "aui-diagram-node-state" 30652 ] 30653 }, 30654 "aui-diagram-node-manager-base": { 30655 "requires": [ 30656 "base" 30657 ] 30658 }, 30659 "aui-diagram-node-start": { 30660 "requires": [ 30661 "aui-diagram-node-state" 30662 ] 30663 }, 30664 "aui-diagram-node-state": { 30665 "requires": [ 30666 "aui-diagram-node" 30667 ] 30668 }, 30669 "aui-diagram-node-task": { 30670 "requires": [ 30671 "aui-diagram-node-state" 30672 ] 30673 }, 30674 "aui-dialog-iframe-deprecated": { 30675 "requires": [ 30676 "plugin", 30677 "array-invoke", 30678 "aui-base-deprecated", 30679 "aui-loading-mask-deprecated" 30680 ], 30681 "skinnable": true 30682 }, 30683 "aui-dropdown": { 30684 "requires": [ 30685 "event-delegate", 30686 "event-key", 30687 "event-outside", 30688 "node-focusmanager", 30689 "widget", 30690 "widget-stack", 30691 "aui-classnamemanager", 30692 "aui-node", 30693 "aui-widget-cssclass", 30694 "aui-widget-toggle", 30695 "aui-widget-trigger" 30696 ], 30697 "skinnable": true 30698 }, 30699 "aui-editable-deprecated": { 30700 "requires": [ 30701 "aui-base-deprecated", 30702 "aui-form-combobox-deprecated", 30703 "escape", 30704 "event-resize" 30705 ], 30706 "skinnable": true 30707 }, 30708 "aui-event": { 30709 "use": [ 30710 "aui-event-base" 30711 ] 30712 }, 30713 "aui-event-base": { 30714 "requires": [ 30715 "event-base" 30716 ] 30717 }, 30718 "aui-event-delegate-change": { 30719 "condition": { 30720 "name": "aui-event-delegate-change", 30721 "trigger": "event-base-ie", 30722 "ua": "ie" 30723 }, 30724 "requires": [ 30725 "aui-event-base", 30726 "event-delegate", 30727 "event-synthetic" 30728 ] 30729 }, 30730 "aui-event-delegate-submit": { 30731 "condition": { 30732 "name": "aui-event-delegate-submit", 30733 "trigger": "event-base-ie", 30734 "ua": "ie" 30735 }, 30736 "requires": [ 30737 "aui-event-base", 30738 "event-delegate", 30739 "event-synthetic" 30740 ] 30741 }, 30742 "aui-event-input": { 30743 "condition": { 30744 "name": "aui-event-input", 30745 "test": function(A) { 30746 var supportsDOMEvent = A.supportsDOMEvent, 30747 testFeature = A.Features.test, 30748 addFeature = A.Features.add; 30749 30750 if (testFeature('event', 'input') === undefined) { 30751 addFeature('event', 'input', { 30752 test: function() { 30753 return supportsDOMEvent(document.createElement('textarea'), 'input') && (!A.UA.ie || A.UA.ie > 9); 30754 } 30755 }); 30756 } 30757 30758 return !testFeature('event', 'input'); 30759}, 30760 "trigger": "aui-event-base" 30761 }, 30762 "requires": [ 30763 "aui-event-base", 30764 "event-delegate", 30765 "event-synthetic", 30766 "timers" 30767 ] 30768 }, 30769 "aui-form-base-deprecated": { 30770 "requires": [ 30771 "io-form", 30772 "querystring-parse", 30773 "aui-base-deprecated", 30774 "aui-data-set-deprecated", 30775 "aui-form-field-deprecated" 30776 ] 30777 }, 30778 "aui-form-builder": { 30779 "requires": [ 30780 "aui-modal", 30781 "aui-layout",
30782 "aui-form-builder-field-list", 30783 "aui-form-builder-field-toolbar", 30784 "aui-form-builder-field-type", 30785 "aui-form-builder-field-types", 30786 "aui-form-builder-layout-builder", 30787 "aui-form-builder-page-manager", 30788 "aui-form-builder-settings-modal", 30789 "event-focus", 30790 "event-tap" 30791 ], 30792 "skinnable": true 30793 }, 30794 "aui-form-builder-available-field-deprecated": { 30795 "requires": [ 30796 "aui-property-builder-available-field" 30797 ] 30798 }, 30799 "aui-form-builder-deprecated": { 30800 "requires": [ 30801 "aui-button", 30802 "aui-collection", 30803 "aui-form-builder-available-field-deprecated", 30804 "aui-form-builder-field-deprecated", 30805 "aui-form-builder-field-button-deprecated", 30806 "aui-form-builder-field-checkbox-deprecated", 30807 "aui-form-builder-field-fieldset-deprecated", 30808 "aui-form-builder-field-file-upload-deprecated", 30809 "aui-form-builder-field-multiple-choice-deprecated", 30810 "aui-form-builder-field-radio-deprecated", 30811 "aui-form-builder-field-select-deprecated", 30812 "aui-form-builder-field-text-deprecated", 30813 "aui-form-builder-field-textarea-deprecated", 30814 "aui-property-builder", 30815 "aui-property-builder-settings", 30816 "aui-sortable-list", 30817 "aui-tabview", 30818 "aui-tooltip-base", 30819 "escape", 30820 "transition" 30821 ], 30822 "skinnable": true 30823 }, 30824 "aui-form-builder-field-base": { 30825 "requires": [ 30826 "aui-classnamemanager", 30827 "aui-node-base", 30828 "aui-text-data-editor", 30829 "aui-toggler", 30830 "base", 30831 "node-base" 30832 ], 30833 "skinnable": true 30834 }, 30835 "aui-form-builder-field-button-deprecated": { 30836 "requires": [ 30837 "aui-form-builder-field-deprecated" 30838 ] 30839 }, 30840 "aui-form-builder-field-checkbox-deprecated": { 30841 "requires": [ 30842 "aui-form-builder-field-deprecated" 30843 ] 30844 }, 30845 "aui-form-builder-field-choice": { 30846 "requires": [ 30847 "aui-boolean-data-editor", 30848 "aui-options-data-editor", 30849 "aui-tabs-data-editor", 30850 "aui-form-builder-field-base", 30851 "aui-form-field-choice" 30852 ] 30853 }, 30854 "aui-form-builder-field-deprecated": { 30855 "requires": [ 30856 "panel", 30857 "aui-datatype", 30858 "aui-datatable-edit", 30859 "aui-property-builder-field-support" 30860 ], 30861 "skinnable": true 30862 }, 30863 "aui-form-builder-field-fieldset-deprecated": { 30864 "requires": [ 30865 "aui-form-builder-field-deprecated" 30866 ] 30867 }, 30868 "aui-form-builder-field-file-upload-deprecated": { 30869 "requires": [ 30870 "aui-form-builder-field-deprecated" 30871 ] 30872 }, 30873 "aui-form-builder-field-list": { 30874 "requires": [ 30875 "aui-form-builder-field-type", 30876 "aui-form-builder-field-types", 30877 "aui-form-builder-layout-builder" 30878 ], 30879 "skinnable": true 30880 }, 30881 "aui-form-builder-field-multiple-choice-deprecated": { 30882 "requires": [ 30883 "aui-form-builder-field-deprecated" 30884 ] 30885 }, 30886 "aui-form-builder-field-radio-deprecated": { 30887 "requires": [ 30888 "aui-form-builder-field-deprecated" 30889 ] 30890 }, 30891 "aui-form-builder-field-select-deprecated": { 30892 "requires": [ 30893 "aui-form-builder-field-deprecated" 30894 ] 30895 }, 30896 "aui-form-builder-field-sentence": { 30897 "requires": [ 30898 "aui-form-builder-field-base", 30899 "aui-form-field" 30900 ] 30901 }, 30902 "aui-form-builder-field-text": { 30903 "requires": [ 30904 "aui-boolean-data-editor", 30905 "aui-radio-group-data-editor", 30906 "aui-form-builder-field-base", 30907 "aui-form-field-text" 30908 ] 30909 }, 30910 "aui-form-builder-field-text-deprecated": { 30911 "requires": [ 30912 "aui-form-builder-field-deprecated" 30913 ] 30914 },
30915 "aui-form-builder-field-textarea-deprecated": { 30916 "requires": [ 30917 "aui-form-builder-field-deprecated" 30918 ] 30919 }, 30920 "aui-form-builder-field-toolbar": { 30921 "requires": [ 30922 "aui-classnamemanager", 30923 "base", 30924 "node-base" 30925 ], 30926 "skinnable": true 30927 }, 30928 "aui-form-builder-field-type": { 30929 "requires": [ 30930 "base", 30931 "node-base" 30932 ], 30933 "skinnable": true 30934 }, 30935 "aui-form-builder-field-types": { 30936 "requires": [ 30937 "aui-classnamemanager", 30938 "aui-form-builder-field-types-modal", 30939 "base", 30940 "node-base" 30941 ], 30942 "skinnable": true 30943 }, 30944 "aui-form-builder-field-types-modal": { 30945 "requires": [ 30946 "aui-modal" 30947 ], 30948 "skinnable": true 30949 }, 30950 "aui-form-builder-layout-builder": { 30951 "requires": [ 30952 "aui-classnamemanager", 30953 "aui-layout-builder", 30954 "aui-modal", 30955 "base", 30956 "node-base" 30957 ], 30958 "skinnable": true 30959 }, 30960 "aui-form-builder-page-manager": { 30961 "requires": [ 30962 "aui-pagination", 30963 "aui-popover", 30964 "aui-tabview", 30965 "base", 30966 "event-valuechange", 30967 "node-base" 30968 ], 30969 "skinnable": true 30970 }, 30971 "aui-form-builder-settings-modal": { 30972 "requires": [ 30973 "aui-classnamemanager", 30974 "aui-modal", 30975 "base", 30976 "node-base" 30977 ], 30978 "skinnable": true 30979 }, 30980 "aui-form-combobox-deprecated": { 30981 "requires": [ 30982 "aui-form-textarea-deprecated", 30983 "aui-toolbar" 30984 ], 30985 "skinnable": true 30986 }, 30987 "aui-form-deprecated": { 30988 "use": [ 30989 "aui-form-base-deprecated", 30990 "aui-form-combobox-deprecated", 30991 "aui-form-field-deprecated", 30992 "aui-form-select-deprecated", 30993 "aui-form-textarea-deprecated", 30994 "aui-form-textfield-deprecated" 30995 ] 30996 }, 30997 "aui-form-field": { 30998 "requires": [ 30999 "aui-classnamemanager", 31000 "aui-node-base", 31001 "base-build" 31002 ], 31003 "skinnable": true 31004 }, 31005 "aui-form-field-choice": { 31006 "requires": [ 31007 "aui-form-field-required" 31008 ], 31009 "skinnable": true 31010 }, 31011 "aui-form-field-deprecated": { 31012 "requires": [ 31013 "aui-base-deprecated", 31014 "aui-component" 31015 ] 31016 }, 31017 "aui-form-field-required": { 31018 "requires": [ 31019 "aui-form-field" 31020 ] 31021 }, 31022 "aui-form-field-text": { 31023 "requires": [ 31024 "aui-form-field-required" 31025 ], 31026 "skinnable": true 31027 }, 31028 "aui-form-select-deprecated": { 31029 "requires": [ 31030 "aui-form-field-deprecated" 31031 ] 31032 }, 31033 "aui-form-textarea-deprecated": { 31034 "requires": [ 31035 "node-pluginhost", 31036 "aui-autosize-deprecated", 31037 "aui-form-textfield-deprecated" 31038 ] 31039 }, 31040 "aui-form-textfield-deprecated": { 31041 "requires": [ 31042 "aui-form-field-deprecated" 31043 ] 31044 }, 31045 "aui-form-validator": { 31046 "requires": [ 31047 "escape", 31048 "selector-css3", 31049 "node-event-delegate", 31050 "aui-node", 31051 "aui-component", 31052 "aui-event-input" 31053 ] 31054 }, 31055 "aui-hsv-palette": { 31056 "requires": [ 31057 "aui-classnamemanager", 31058 "aui-widget-cssclass", 31059 "aui-widget-toggle", 31060 "aui-event-input", 31061 "base-build", 31062 "clickable-rail", 31063 "color-hsv", 31064 "dd-constrain", 31065 "slider", 31066 "widget" 31067 ], 31068 "skinnable": true 31069 }, 31070 "aui-hsva-palette": { 31071 "requires": [ 31072 "aui-hsv-palette" 31073 ], 31074 "skinnable": true 31075 }, 31076 "aui-hsva-palette-modal": { 31077 "requires": [ 31078 "aui-hsva-palette", 31079 "aui-modal" 31080 ], 31081 "skinnable": true 31082 }, 31083 "aui-image-cropper": { 31084 "requires": [ 31085 "resize-base", 31086 "resize-constrain", 31087 "dd-constrain", 31088 "aui-node-base", 31089 "aui-component" 31090 ], 31091 "skinnable": true 31092 }, 31093 "aui-image-viewer": { 31094 "requires": [ 31095 "widget", 31096 "widget-modality", 31097 "widget-position", 31098 "widget-position-align", 31099 "widget-position-constrain", 31100 "widget-stack", 31101 "widget-stdmod", 31102 "aui-event", 31103 "aui-image-viewer-base", 31104 "aui-image-viewer-multiple", 31105 "aui-image-viewer-slideshow", 31106 "aui-node-base", 31107 "aui-widget-cssclass", 31108 "aui-widget-toggle" 31109 ], 31110 "skinnable": true 31111 }, 31112 "aui-image-viewer-base": { 31113 "requires": [ 31114 "anim", 31115 "aui-aria", 31116 "aui-classnamemanager", 31117 "aui-node", 31118 "aui-widget-responsive", 31119 "base-build", 31120 "imageloader", 31121 "node-base", 31122 "widget", 31123 "widget-stack" 31124 ], 31125 "skinnable": true 31126 }, 31127 "aui-image-viewer-media": { 31128 "requires": [ 31129 "plugin", 31130 "aui-component", 31131 "aui-image-viewer" 31132 ] 31133 }, 31134 "aui-image-viewer-multiple": { 31135 "requires": [ 31136 "base-build", 31137 "node-base", 31138 "aui-classnamemanager", 31139 "aui-image-viewer-base" 31140 ], 31141 "skinnable": true 31142 }, 31143 "aui-image-viewer-multiple-swipe": { 31144 "condition": { 31145 "name": "aui-image-viewer-multiple-swipe", 31146 "trigger": "aui-image-viewer-multiple", 31147 "ua": "touchEnabled" 31148 }, 31149 "requires": [ 31150 "aui-image-viewer-multiple",
31151 "aui-image-viewer-swipe" 31152 ] 31153 }, 31154 "aui-image-viewer-slideshow": { 31155 "requires": [ 31156 "node", 31157 "aui-classnamemanager" 31158 ] 31159 }, 31160 "aui-image-viewer-swipe": { 31161 "condition": { 31162 "name": "aui-image-viewer-swipe", 31163 "trigger": "aui-image-viewer-base", 31164 "ua": "touchEnabled" 31165 }, 31166 "requires": [ 31167 "event-resize", 31168 "aui-image-viewer-base", 31169 "aui-widget-swipe" 31170 ] 31171 }, 31172 "aui-input-text-control-deprecated": { 31173 "requires": [ 31174 "aui-base-deprecated", 31175 "aui-datasource-control-base-deprecated", 31176 "aui-form-combobox-deprecated" 31177 ] 31178 }, 31179 "aui-io": { 31180 "use": [ 31181 "aui-io-request" 31182 ] 31183 }, 31184 "aui-io-deprecated": { 31185 "use": [ 31186 "aui-io-request", 31187 "aui-io-plugin-deprecated" 31188 ] 31189 }, 31190 "aui-io-plugin-deprecated": { 31191 "requires": [ 31192 "aui-overlay-base-deprecated", 31193 "aui-parse-content", 31194 "aui-io-request", 31195 "aui-loading-mask-deprecated" 31196 ] 31197 }, 31198 "aui-io-request": { 31199 "requires": [ 31200 "io-base", 31201 "json", 31202 "plugin", 31203 "querystring-stringify", 31204 "aui-component" 31205 ] 31206 }, 31207 "aui-io-request-deprecated": { 31208 "requires": [ 31209 "io-base", 31210 "json", 31211 "plugin", 31212 "querystring-stringify", 31213 "aui-base-deprecated" 31214 ] 31215 }, 31216 "aui-layout": { 31217 "requires": [ 31218 "aui-layout-col", 31219 "aui-layout-row", 31220 "aui-node-base", 31221 "base-build", 31222 "datatype-number-parse", 31223 "event-resize" 31224 ] 31225 }, 31226 "aui-layout-builder": { 31227 "requires": [ 31228 "aui-classnamemanager", 31229 "aui-layout", 31230 "aui-layout-builder-add-col", 31231 "aui-layout-builder-add-row", 31232 "aui-layout-builder-move", 31233 "aui-layout-builder-remove-row", 31234 "aui-layout-builder-resize-col", 31235 "aui-node-base", 31236 "base-build", 31237 "node-event-delegate", 31238 "node-screen", 31239 "node-style" 31240 ] 31241 }, 31242 "aui-layout-builder-add-col": { 31243 "requires": [ 31244 "event-key", 31245 "node-base" 31246 ], 31247 "skinnable": true 31248 }, 31249 "aui-layout-builder-add-row": { 31250 "requires": [ 31251 "aui-node-base", 31252 "base-build", 31253 "node-scroll-info" 31254 ], 31255 "skinnable": true 31256 }, 31257 "aui-layout-builder-move": { 31258 "requires": [ 31259 "aui-node-base", 31260 "base-build" 31261 ], 31262 "skinnable": true 31263 }, 31264 "aui-layout-builder-remove-row": { 31265 "requires": [ 31266 "aui-node-base", 31267 "base-build" 31268 ], 31269 "skinnable": true 31270 }, 31271 "aui-layout-builder-resize-col": { 31272 "requires": [ 31273 "dd-constrain", 31274 "dd-delegate", 31275 "dd-drop-plugin", 31276 "dd-proxy", 31277 "event-mouseenter", 31278 "node-base" 31279 ], 31280 "skinnable": true 31281 }, 31282 "aui-layout-col": { 31283 "requires": [ 31284 "aui-classnamemanager", 31285 "aui-node-base", 31286 "base-build" 31287 ], 31288 "skinnable": true 31289 }, 31290 "aui-layout-row": { 31291 "requires": [ 31292 "array-invoke", 31293 "aui-node-base", 31294 "base-build" 31295 ], 31296 "skinnable": true 31297 }, 31298 "aui-linkedset": { 31299 "requires": [ 31300 "aui-set" 31301 ] 31302 }, 31303 "aui-live-search-deprecated": { 31304 "requires": [ 31305 "aui-base-deprecated" 31306 ] 31307 }, 31308 "aui-loading-mask-deprecated": { 31309 "requires": [ 31310 "plugin", 31311 "aui-overlay-mask-deprecated" 31312 ], 31313 "skinnable": true 31314 }, 31315 "aui-map": { 31316 "requires": [ 31317 "base-build" 31318 ] 31319 }, 31320 "aui-menu": { 31321 "requires": [ 31322 "base-build", 31323 "event-mouseenter", 31324 "event-resize", 31325 "widget", 31326 "widget-position", 31327 "widget-position-align", 31328 "widget-position-constrain", 31329 "widget-stack", 31330 "aui-classnamemanager", 31331 "aui-debounce", 31332 "aui-dropdown", 31333 "aui-menu-item" 31334 ], 31335 "skinnable": true 31336 }, 31337 "aui-menu-item": { 31338 "requires": [ 31339 "base-build", 31340 "node-base", 31341 "aui-classnamemanager", 31342 "aui-node", 31343 "aui-widget-shortcut" 31344 ] 31345 }, 31346 "aui-messaging": { 31347 "requires": [ 31348 "querystring", 31349 "aui-timer" 31350 ] 31351 }, 31352 "aui-modal": { 31353 "requires": [ 31354 "widget", 31355 "widget-autohide", 31356 "widget-buttons", 31357 "widget-modality", 31358 "widget-position", 31359 "widget-position-align", 31360 "widget-position-constrain", 31361 "widget-stack", 31362 "widget-stdmod", 31363 "dd-plugin", 31364 "dd-constrain", 31365 "timers", 31366 "aui-classnamemanager", 31367 "aui-widget-cssclass", 31368 "aui-widget-toggle", 31369 "aui-widget-toolbars" 31370 ], 31371 "skinnable": true 31372 }, 31373 "aui-modal-resize": { 31374 "condition": { 31375 "name": "aui-modal-resize", 31376 "test": function(A) { 31377 return !A.UA.mobile; 31378}, 31379 "trigger": "aui-modal" 31380 }, 31381 "requires": [ 31382 "aui-modal", 31383 "resize-plugin" 31384 ] 31385 }, 31386 "aui-node": { 31387 "use": [ 31388 "aui-node-base" 31389 ] 31390 }, 31391 "aui-node-accessible": { 31392 "requires": [ 31393 "aui-node-base", 31394 "event-custom-base" 31395 ] 31396 }, 31397 "aui-node-base": { 31398 "requires": [ 31399 "array-extras", 31400 "aui-base-lang", 31401 "aui-classnamemanager", 31402 "aui-debounce", 31403 "node" 31404 ] 31405 }, 31406 "aui-node-html5": { 31407 "condition": { 31408 "name": "aui-node-html5", 31409 "trigger": "aui-node", 31410 "ua": "ie" 31411 }, 31412 "requires": [ 31413 "collection", 31414 "aui-node-base" 31415 ] 31416 }, 31417 "aui-options-data-editor": { 31418 "requires": [ 31419 "aui-data-editor", 31420 "dd-constrain", 31421 "dd-delegate", 31422 "dd-drop-plugin", 31423 "dd-proxy", 31424 "event-valuechange", 31425 "node-event-delegate" 31426 ], 31427 "skinnable": true 31428 }, 31429 "aui-overlay-base-deprecated": { 31430 "requires": [ 31431 "widget-position", 31432 "widget-stack", 31433 "widget-position-align", 31434 "widget-position-constrain", 31435 "widget-stdmod", 31436 "aui-component" 31437 ] 31438 }, 31439 "aui-overlay-context-deprecated": { 31440 "requires": [ 31441 "aui-overlay-manager-deprecated", 31442 "aui-delayed-task-deprecated", 31443 "aui-aria" 31444 ] 31445 }, 31446 "aui-overlay-context-panel-deprecated": { 31447 "requires": [ 31448 "anim", 31449 "aui-overlay-context-deprecated" 31450 ], 31451 "skinnable": true 31452 }, 31453 "aui-overlay-deprecated": { 31454 "use": [ 31455 "aui-overlay-base-deprecated", 31456 "aui-overlay-context-deprecated", 31457 "aui-overlay-context-panel-deprecated", 31458 "aui-overlay-manager-deprecated", 31459 "aui-overlay-mask-deprecated" 31460 ] 31461 }, 31462 "aui-overlay-manager-deprecated": { 31463 "requires": [ 31464 "overlay", 31465 "plugin", 31466 "aui-base-deprecated", 31467 "aui-overlay-base-deprecated" 31468 ] 31469 }, 31470 "aui-overlay-mask-deprecated": { 31471 "requires": [ 31472 "event-resize", 31473 "aui-base-deprecated", 31474 "aui-overlay-base-deprecated" 31475 ], 31476 "skinnable": true 31477 }, 31478 "aui-pagination": { 31479 "requires": [ 31480 "node-event-delegate", 31481 "aui-node", 31482 "aui-component", 31483 "widget-htmlparser" 31484 ], 31485 "skinnable": true 31486 }, 31487 "aui-palette": { 31488 "requires": [ 31489 "base-build", 31490 "event-hover", 31491 "widget", 31492 "aui-classnamemanager", 31493 "aui-base", 31494 "aui-widget-cssclass", 31495 "aui-widget-toggle" 31496 ], 31497 "skinnable": true 31498 }, 31499 "aui-parse-content": { 31500 "requires": [ 31501 "async-queue", 31502 "plugin", 31503 "io-base", 31504 "aui-component", 31505 "aui-node-base" 31506 ] 31507 }, 31508 "aui-popover": { 31509 "requires": [ 31510 "event-resize", 31511 "widget", 31512 "widget-autohide", 31513 "widget-buttons", 31514 "widget-modality", 31515 "widget-position", 31516 "widget-position-align", 31517 "widget-position-constrain", 31518 "widget-stack", 31519 "widget-stdmod", 31520 "aui-classnamemanager", 31521 "aui-widget-cssclass", 31522 "aui-widget-toggle", 31523 "aui-widget-toolbars", 31524 "aui-widget-transition", 31525 "aui-widget-trigger", 31526 "aui-widget-position-align-suggestion", 31527 "aui-component", 31528 "aui-node-base" 31529 ], 31530 "skinnable": true 31531 }, 31532 "aui-progressbar": { 31533 "requires": [ 31534 "aui-node", 31535 "aui-component", 31536 "aui-aria" 31537 ], 31538 "skinnable": true 31539 }, 31540 "aui-promise": { 31541 "requires": [ 31542 "array-invoke", 31543 "promise", 31544 "oop" 31545 ] 31546 }, 31547 "aui-property-builder": { 31548 "requires": [ 31549 "dd", 31550 "collection", 31551 "aui-property-builder-available-field", 31552 "aui-property-builder-field-support", 31553 "aui-property-builder-settings", 31554 "aui-tabview" 31555 ], 31556 "skinnable": true 31557 }, 31558 "aui-property-builder-available-field": { 31559 "requires": [ 31560 "base", 31561 "aui-component", 31562 "aui-node" 31563 ] 31564 }, 31565 "aui-property-builder-field-support": {}, 31566 "aui-property-builder-settings": { 31567 "requires": [ 31568 "aui-tabview", 31569 "aui-datatable-property-list" 31570 ] 31571 }, 31572 "aui-radio-group-data-editor": { 31573 "requires": [ 31574 "aui-data-editor", 31575 "node-event-delegate" 31576 ], 31577 "skinnable": true 31578 }, 31579 "aui-rating": { 31580 "use": [ 31581 "aui-rating-base", 31582 "aui-rating-thumb" 31583 ] 31584 }, 31585 "aui-rating-base": { 31586 "requires": [ 31587 "aui-component", 31588 "aui-node-base", 31589 "widget-htmlparser", 31590 "widget-uievents" 31591 ], 31592 "skinnable": true 31593 }, 31594 "aui-rating-thumb": { 31595 "requires": [ 31596 "aui-rating-base" 31597 ] 31598 }, 31599 "aui-resize-base-deprecated": { 31600 "requires": [ 31601 "dd-drag", 31602 "dd-delegate", 31603 "dd-drop", 31604 "aui-base-deprecated" 31605 ], 31606 "skinnable": true 31607 }, 31608 "aui-resize-constrain-deprecated": { 31609 "requires": [ 31610 "dd-constrain", 31611 "plugin", 31612 "aui-resize-base-deprecated" 31613 ] 31614 }, 31615 "aui-resize-deprecated": { 31616 "skinnable": true, 31617 "use": [ 31618 "aui-resize-base-deprecated", 31619 "aui-resize-constrain-deprecated" 31620 ] 31621 }, 31622 "aui-scale-data-editor": { 31623 "requires": [ 31624 "aui-classnamemanager", 31625 "aui-data-editor", 31626 "event-valuechange" 31627 ] 31628 }, 31629 "aui-scheduler": { 31630 "use": [ 31631 "event-gestures", 31632 "aui-scheduler-base", 31633 "aui-scheduler-event-recorder", 31634 "aui-scheduler-view-agenda", 31635 "aui-scheduler-view-day", 31636 "aui-scheduler-view-month", 31637 "aui-scheduler-view-table-dd", 31638 "aui-scheduler-view-table", 31639 "aui-scheduler-view-week", 31640 "aui-viewport" 31641 ] 31642 }, 31643 "aui-scheduler-base": { 31644 "requires": [ 31645 "model", 31646 "model-list", 31647 "widget-stdmod", 31648 "color-hsl", 31649 "aui-event-base", 31650 "aui-node-base", 31651 "aui-component", 31652 "aui-datatype", 31653 "aui-button", 31654 "node-focusmanager" 31655 ], 31656 "skinnable": true 31657 }, 31658 "aui-scheduler-event-recorder": { 31659 "requires": [ 31660 "querystring", 31661 "io-form", 31662 "overlay", 31663 "aui-scheduler-base", 31664 "aui-popover" 31665 ], 31666 "skinnable": true 31667 }, 31668 "aui-scheduler-touch": { 31669 "condition": { 31670 "name": "aui-scheduler-touch", 31671 "trigger": "aui-scheduler", 31672 "ua": "touchEnabled" 31673 }, 31674 "requires": [ 31675 "base-build", 31676 "aui-scheduler" 31677 ], 31678 "skinnable": true 31679 }, 31680 "aui-scheduler-view-agenda": { 31681 "requires": [ 31682 "aui-scheduler-base" 31683 ], 31684 "skinnable": true 31685 }, 31686 "aui-scheduler-view-day": { 31687 "requires": [ 31688 "dd-drag", 31689 "dd-delegate", 31690 "dd-drop", 31691 "dd-constrain", 31692 "aui-scheduler-view-table" 31693 ], 31694 "skinnable": true 31695 }, 31696 "aui-scheduler-view-month": { 31697 "requires": [ 31698 "aui-scheduler-view-table" 31699 ], 31700 "skinnable": true 31701 }, 31702 "aui-scheduler-view-table": { 31703 "requires": [ 31704 "overlay", 31705 "aui-scheduler-base" 31706 ], 31707 "skinnable": true 31708 }, 31709 "aui-scheduler-view-table-dd": { 31710 "requires": [ 31711 "dd-drag", 31712 "dd-delegate", 31713 "dd-drop", 31714 "aui-scheduler-view-table" 31715 ] 31716 }, 31717 "aui-scheduler-view-week": { 31718 "requires": [ 31719 "aui-scheduler-view-day" 31720 ], 31721 "skinnable": true 31722 }, 31723 "aui-scroller-deprecated": { 31724 "requires": [ 31725 "event-mouseenter", 31726 "aui-base-deprecated", 31727 "aui-simple-anim-deprecated" 31728 ], 31729 "skinnable": true 31730 }, 31731 "aui-scrollspy": { 31732 "requires": [ 31733 "base-build", 31734 "node-screen", 31735 "aui-classnamemanager" 31736 ] 31737 }, 31738 "aui-search": { 31739 "use": [ 31740 "aui-search-tst" 31741 ] 31742 }, 31743 "aui-search-tst": { 31744 "requires": [ 31745 "aui-component" 31746 ] 31747 }, 31748 "aui-selector": { 31749 "requires": [ 31750 "selector-css3", 31751 "aui-classnamemanager" 31752 ] 31753 }, 31754 "aui-set": { 31755 "requires": [ 31756 "aui-map" 31757 ] 31758 }, 31759 "aui-simple-anim-deprecated": { 31760 "requires": [ 31761 "aui-base-deprecated" 31762 ] 31763 }, 31764 "aui-skin-deprecated": { 31765 "type": "css" 31766 }, 31767 "aui-sortable": { 31768 "use": [ 31769 "aui-sortable-layout", 31770 "aui-sortable-list" 31771 ] 31772 }, 31773 "aui-sortable-layout": { 31774 "requires": [ 31775 "dd-delegate", 31776 "dd-drag", 31777 "dd-drop", 31778 "dd-proxy", 31779 "aui-node", 31780 "aui-component" 31781 ], 31782 "skinnable": true 31783 }, 31784 "aui-sortable-list": { 31785 "requires": [ 31786 "dd-drag", 31787 "dd-drop", 31788 "dd-proxy", 31789 "dd-scroll", 31790 "aui-node", 31791 "aui-component" 31792 ] 31793 }, 31794 "aui-state-interaction-deprecated": { 31795 "requires": [ 31796 "aui-base-deprecated", 31797 "plugin" 31798 ] 31799 }, 31800 "aui-surface": { 31801 "use": [ 31802 "aui-surface-app", 31803 "aui-surface-screen" 31804 ] 31805 }, 31806 "aui-surface-app": { 31807 "requires": [ 31808 "event-delegate", 31809 "node-event-html5", 31810 "aui-surface-base", 31811 "aui-surface-screen", 31812 "aui-surface-screen-route" 31813 ] 31814 }, 31815 "aui-surface-base": { 31816 "requires": [ 31817 "base-build", 31818 "node-style", 31819 "timers", 31820 "aui-debounce", 31821 "aui-promise", 31822 "aui-parse-content" 31823 ] 31824 }, 31825 "aui-surface-screen": { 31826 "requires": [ 31827 "base-build" 31828 ] 31829 }, 31830 "aui-surface-screen-html": { 31831 "requires": [ 31832 "aui-base", 31833 "aui-io-request", 31834 "aui-promise", 31835
31835 "aui-surface-screen", 31836 "aui-url" 31837 ] 31838 }, 31839 "aui-surface-screen-route": { 31840 "requires": [ 31841 "base-build" 31842 ] 31843 }, 31844 "aui-swf-deprecated": { 31845 "requires": [ 31846 "querystring-parse-simple", 31847 "querystring-stringify-simple", 31848 "aui-base-deprecated" 31849 ] 31850 }, 31851 "aui-tabs-data-editor": { 31852 "requires": [ 31853 "aui-data-editor", 31854 "aui-tabview" 31855 ] 31856 }, 31857 "aui-tabview": { 31858 "requires": [ 31859 "selector-css3", 31860 "tabview", 31861 "aui-component", 31862 "aui-widget-css" 31863 ], 31864 "skinnable": true 31865 }, 31866 "aui-template-deprecated": { 31867 "requires": [ 31868 "aui-base-deprecated" 31869 ] 31870 }, 31871 "aui-text-data-editor": { 31872 "requires": [ 31873 "aui-data-editor", 31874 "event-valuechange" 31875 ], 31876 "skinnable": true 31877 }, 31878 "aui-text-data-unicode": { 31879 "requires": [ 31880 "text" 31881 ] 31882 }, 31883 "aui-text-unicode": { 31884 "requires": [ 31885 "aui-text-data-unicode" 31886 ] 31887 }, 31888 "aui-textboxlist-deprecated": { 31889 "requires": [ 31890 "anim-node-plugin", 31891 "aui-autocomplete-deprecated", 31892 "aui-button-item-deprecated", 31893 "aui-data-set-deprecated", 31894 "escape", 31895 "node-focusmanager" 31896 ], 31897 "skinnable": true 31898 }, 31899 "aui-timepicker": { 31900 "requires": [ 31901 "autocomplete", 31902 "aui-datepicker-delegate", 31903 "aui-datepicker-popover" 31904 ], 31905 "skinnable": true 31906 }, 31907 "aui-timepicker-native": { 31908 "requires": [ 31909 "base", 31910 "base-build", 31911 "aui-node-base", 31912 "aui-datepicker-delegate", 31913 "aui-datepicker-native" 31914 ] 31915 }, 31916 "aui-timer": { 31917 "requires": [ 31918 "oop" 31919 ] 31920 }, 31921 "aui-toggler": { 31922 "use": [ 31923 "aui-toggler-base", 31924 "aui-toggler-delegate" 31925 ] 31926 }, 31927 "aui-toggler-accessibility": { 31928 "requires": [ 31929 "aui-toggler-base" 31930 ] 31931 }, 31932 "aui-toggler-base": { 31933 "requires": [ 31934 "transition", 31935 "aui-selector", 31936 "aui-event-base", 31937 "aui-node", 31938 "aui-component", 31939 "event-tap" 31940 ], 31941 "skinnable": true 31942 }, 31943 "aui-toggler-delegate": { 31944 "requires": [ 31945 "array-invoke", 31946 "node-event-delegate", 31947 "aui-toggler-base" 31948 ] 31949 }, 31950 "aui-toolbar": { 31951 "requires": [ 31952 "arraylist", 31953 "arraylist-add", 31954 "aui-component", 31955 "aui-button-core" 31956 ] 31957 }, 31958 "aui-tooltip": { 31959 "use": [ 31960 "aui-tooltip-base", 31961 "aui-tooltip-delegate" 31962 ] 31963 }, 31964 "aui-tooltip-base": { 31965 "requires": [ 31966 "aui-aria", 31967 "aui-classnamemanager", 31968 "aui-component", 31969 "aui-debounce", 31970 "aui-node-base", 31971 "aui-widget-cssclass", 31972 "aui-widget-toggle", 31973 "aui-widget-transition", 31974 "aui-widget-trigger", 31975 "aui-widget-position-align-suggestion", 31976 "event-hover", 31977 "event-resize", 31978 "escape", 31979 "widget", 31980 "widget-autohide", 31981 "widget-position", 31982 "widget-position-align", 31983 "widget-position-constrain", 31984 "widget-stack", 31985 "widget-stdmod" 31986 ], 31987 "skinnable": true 31988 }, 31989 "aui-tooltip-delegate": { 31990 "requires": [ 31991 "aui-tooltip-base", 31992 "node-event-delegate" 31993 ] 31994 }, 31995 "aui-tooltip-deprecated": { 31996 "requires": [ 31997 "aui-overlay-context-panel-deprecated" 31998 ], 31999 "skinnable": true 32000 }, 32001 "aui-tpl-snippets-base-deprecated": { 32002 "requires": [ 32003 "aui-template-deprecated" 32004 ] 32005 }, 32006 "aui-tpl-snippets-checkbox-deprecated": { 32007 "requires": [ 32008 "aui-tpl-snippets-base-deprecated" 32009 ] 32010 }, 32011 "aui-tpl-snippets-deprecated": { 32012 "use": [ 32013 "aui-tpl-snippets-base-deprecated", 32014 "aui-tpl-snippets-checkbox-deprecated", 32015 "aui-tpl-snippets-input-deprecated", 32016 "aui-tpl-snippets-select-deprecated", 32017 "aui-tpl-snippets-textarea-deprecated" 32018 ] 32019 }, 32020 "aui-tpl-snippets-input-deprecated": { 32021 "requires": [ 32022 "aui-tpl-snippets-base-deprecated" 32023 ] 32024 }, 32025 "aui-tpl-snippets-select-deprecated": { 32026 "requires": [ 32027 "aui-tpl-snippets-base-deprecated" 32028 ] 32029 }, 32030 "aui-tpl-snippets-textarea-deprecated": { 32031 "requires": [ 32032 "aui-tpl-snippets-base-deprecated" 32033 ] 32034 }, 32035 "aui-tree": { 32036 "use": [ 32037 "aui-tree-data", 32038 "aui-tree-io", 32039 "aui-tree-node", 32040 "aui-tree-paginator", 32041 "aui-tree-view" 32042 ] 32043 }, 32044 "aui-tree-data": { 32045 "requires": [ 32046 "aui-base-core", 32047 "aui-base-lang", 32048 "aui-node-base", 32049 "aui-timer", 32050 "aui-component" 32051 ] 32052 }, 32053 "aui-tree-io": { 32054 "requires": [ 32055 "aui-component", 32056 "aui-io" 32057 ] 32058 }, 32059 "aui-tree-node": { 32060 "requires": [ 32061 "json", 32062 "querystring-stringify", 32063 "aui-tree-data", 32064 "aui-tree-io", 32065 "aui-tree-paginator", 32066 "event-key" 32067 ] 32068 }, 32069 "aui-tree-paginator": { 32070 "requires": [ 32071 "yui-base" 32072 ] 32073 }, 32074 "aui-tree-view": { 32075 "requires": [ 32076 "dd-delegate", 32077 "dd-proxy", 32078 "widget", 32079 "aui-tree-node", 32080 "aui-tree-paginator", 32081 "aui-tree-io" 32082 ], 32083 "skinnable": true 32084 }, 32085 "aui-undo-redo": { 32086 "requires": [ 32087 "aui-base", 32088 "base", 32089 "base-build", 32090 "event-key", 32091 "promise" 32092 ] 32093 }, 32094 "aui-url": { 32095 "requires": [ 32096 "oop", 32097 "querystring-parse", 32098 "querystring-stringify" 32099 ] 32100 }, 32101 "aui-video": { 32102 "requires": [ 32103 "event-resize", 32104 "node-event-html5", 32105 "querystring-stringify-simple", 32106 "aui-aria", 32107 "aui-node", 32108 "aui-component", 32109 "aui-debounce" 32110 ], 32111 "skinnable": true 32112 }, 32113 "aui-viewport": { 32114 "requires": [ 32115 "aui-node", 32116 "aui-component" 32117 ] 32118 }, 32119 "aui-widget": { 32120 "use": [ 32121 "aui-widget-cssclass", 32122 "aui-widget-toolbars" 32123 ] 32124 }, 32125 "aui-widget-core": { 32126 "use": [ 32127 "aui-widget-cssclass" 32128 ] 32129 }, 32130 "aui-widget-cssclass": { 32131 "requires": [ 32132 "widget-base" 32133 ] 32134 }, 32135 "aui-widget-position-align-suggestion": { 32136 "requires": [ 32137 "widget-position-align", 32138 "widget-stdmod" 32139 ] 32140 }, 32141 "aui-widget-responsive": { 32142 "requires": [ 32143 "event-resize", 32144 "widget-base" 32145 ] 32146 }, 32147 "aui-widget-shortcut": { 32148 "requires": [ 32149 "base" 32150 ] 32151 }, 32152 "aui-widget-swipe": { 32153 "requires": [ 32154 "classnamemanager", 32155 "scrollview-base", 32156 "scrollview-paginator", 32157 "timers" 32158 ] 32159 }, 32160 "aui-widget-toggle": {}, 32161 "aui-widget-toolbars": { 32162 "requires": [ 32163 "widget-stdmod", 32164 "aui-toolbar" 32165 ] 32166 }, 32167 "aui-widget-transition": { 32168 "requires": [ 32169 "transition" 32170 ] 32171 }, 32172 "aui-widget-trigger": { 32173 "requires": [ 32174 "node" 32175 ] 32176 } 32177}); 32178YUI.Env[Y.version].md5 = 'd7c627eb00edd6b6f054d8f6e7147480'; 32179/* 32180 * Alloy JavaScript Library 32181 * http://alloy.liferay.com/ 32182 * 32183 * Copyright (c) 2010 Liferay Inc. 32184 * http://alloy.liferay.com/LICENSE.txt 32185 * 32186 * Nate Cavanaugh ([email protected]) 32187 * Eduardo Lundgren ([email protected]) 32188 * 32189 * Attribution/Third-party licenses 32190 * http://alloy.liferay.com/ATTRIBUTION.txt 32191 */ 32192 32193// Simple version of 32194// http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ 32195 32196A.UA.edge = (function() { 32197 var edgeVersion = A.UA.userAgent.match(/Edge\/(.[0-9.]+)/); 32198 32199 if (edgeVersion) { 32200 return edgeVersion[1]; 32201 } 32202 32203 return 0; 32204})(); 32205 32206A.supportsDOMEvent = function(domNode, eventName) { 32207 eventName = 'on' + eventName; 32208 32209 if (!(eventName in domNode)) { 32210 if (!domNode.setAttribute) { 32211 domNode = A.config.doc.createElement('div'); 32212 } 32213 32214 if (domNode.setAttribute) { 32215 domNode.setAttribute(eventName, ''); 32216 return (typeof domNode[eventName] === 'function'); 32217 } 32218 } 32219 32220 domNode = null; 32221 32222 return true; 32223}; 32224(function() { 32225 var slice = Array.prototype.slice; 32226 32227 YUI.prototype.ready = function() { 32228 var instance = this, 32229 xargs = arguments, 32230 index = xargs.length - 1, 32231 modules = slice.call(arguments, 0, index); 32232 32233 modules.unshift('event-base'); 32234 modules.push(function(instance) { 32235 var args = arguments; 32236 32237 instance.on('domready', function() { 32238 xargs[index].apply(this, args); 32239 }); 32240 }); 32241 instance.use.apply(instance, modules); 32242 }; 32243}()); 32244 32245 32246}, '3.1.0-deprecated.95'); 32247YUI.add('aui', function (A, NAME) {}, '3.1.0-deprecated.95'); 32248YUI.Env.core.push.apply(YUI.Env.core, ["aui-base-core"]); 32249YUI.add('aui-base-html5-shiv', function (A, NAME) { 32250 32251A.HTML5_ELEMENTS = [ 32252 'abbr', 32253 'article', 32254 'aside', 32255 'audio', 32256 'canvas', 32257 'command', 32258 'datalist', 32259 'details', 32260 'figure', 32261 'figcaption', 32262 'footer', 32263 'header', 32264 'hgroup', 32265 'keygen', 32266 'mark', 32267 'meter',
32268 'nav', 32269 'output', 32270 'progress', 32271 'section', 32272 'source', 32273 'summary', 32274 'time', 32275 'video' 32276]; 32277 32278A.html5shiv = function(frag) { 32279 var DOC = frag || A.config.doc; 32280 32281 if (A.UA.ie && DOC && DOC.createElement) { 32282 var elements = A.HTML5_ELEMENTS, 32283 length = elements.length; 32284 32285 while (length--) { 32286 DOC.createElement(elements[length]); 32287 } 32288 } 32289 32290 return frag; 32291}; 32292 32293 32294}, '3.1.0-deprecated.95'); 32295 32296YUI.add( 32297 'liferay-browser-selectors', 32298 function(A) { 32299 var REGEX_VERSION_DOT = /\./g; 32300 32301 var YUI3_JS_ENABLED = 'yui3-js-enabled'; 32302 32303 var parseVersionNumber = function(str) { 32304 var count = 0; 32305 32306 return parseFloat( 32307 str.replace( 32308 REGEX_VERSION_DOT, 32309 function() { 32310 return (count++ == 1) ? '' : '.'; 32311 } 32312 ) 32313 ); 32314 }; 32315 32316 var DEFAULTS_VERSION = ['0', '0']; 32317 32318 var getVersion = function(regex, userAgent) { 32319 var version = (userAgent.match(regex) || DEFAULTS_VERSION)[1]; 32320 32321 return parseVersionNumber(version); 32322 }; 32323 32324 var BROWSERS = [ 32325 'ie', 32326 'opera', 32327 'chrome', 32328 'edge', 32329 'aol', 32330 'camino', 32331 'firefox', 32332 'flock', 32333 'mozilla', 32334 'netscape', 32335 'icab', 32336 'konqueror', 32337 'safari' 32338 ]; 32339 32340 var MAP_OS_SELECTORS = { 32341 macintosh: 'mac', 32342 windows: 'win' 32343 }; 32344 32345 var nav = navigator; 32346 32347 var CONFIG = A.config; 32348 32349 var DOC = CONFIG.doc; 32350 32351 var userAgent = nav.userAgent; 32352 32353 var UA = A.UA; 32354 32355 var OS = UA.os; 32356 32357 var UAX = { 32358 agent: userAgent, 32359 32360 aol: 0, 32361 browser: 0, 32362 camino: 0, 32363 firefox: 0, 32364 flock: 0, 32365 icab: 0, 32366 konqueror: 0, 32367 mozilla: 0, 32368 netscape: 0, 32369 safari: 0 32370 }; 32371 32372 UAX.mac = (OS == 'macintosh'); 32373 UAX.rhino = (OS == 'rhino'); 32374 UAX.win = (OS == 'windows'); 32375 32376 var BrowserSelectors = { 32377 getSelectors: function() { 32378 // The methods in this if block only run once across all instances 32379 32380 if (!UA.selectors) { 32381 if (userAgent.indexOf('Edge') !== -1) { 32382 UAX.edge = getVersion(/Edge\/([^\s]*)/, userAgent); 32383 } 32384 32385 if (UA.ie) { 32386 UAX.aol = getVersion(/America Online Browser ([^\s]*);/, userAgent); 32387 32388 var docMode = DOC.documentMode; 32389 32390 if (docMode) { 32391 UA.browser = UA.ie; 32392 UA.ie = docMode; 32393 } 32394 } 32395 else if (UA.gecko) { 32396 UAX.netscape = getVersion(/(Netscape|Navigator)\/([^\s]*)/, userAgent); 32397 UAX.flock = getVersion(/Flock\/([^\s]*)/, userAgent); 32398 UAX.camino = getVersion(/Camino\/([^\s]*)/, userAgent); 32399 UAX.firefox = getVersion(/Firefox\/([^\s]*)/, userAgent); 32400 } 32401 else if (UA.webkit) { 32402 UAX.safari = getVersion(/Version\/([^\s]*) Safari/, userAgent); 32403 } 32404 else { 32405 UAX.icab = getVersion(/iCab(?:\/|\s)?([^\s]*)/, userAgent); 32406 UAX.konqueror = getVersion(/Konqueror\/([^\s]*)/, userAgent); 32407 } 32408 32409 if (!UAX.win && !UAX.mac) { 32410 var linux = /Linux/.test(userAgent); 32411 var sun = /Solaris|SunOS/.test(userAgent); 32412 32413 if (linux) { 32414 UA.os = 'linux'; 32415 UAX.linux = linux; 32416 } 32417 else if (sun) { 32418 UA.os = 'sun'; 32419 UAX.sun = sun; 32420 } 32421 } 32422 32423 var touch = UA.touchEnabled; 32424 32425 UAX.touch = touch; 32426 UAX.touchMobile = touch && !!UA.mobile; 32427 32428 A.mix(UA, UAX); 32429 32430 var browserList = []; 32431 var versionMajor = 0; 32432 32433 var browser; 32434 var uaVersionMajor; 32435 var uaVersionMinor; 32436 var version; 32437 32438 var versionObj = { 32439 major: versionMajor, 32440 string: '' 32441 }; 32442 32443 var i = BROWSERS.length; 32444 32445 while (i--) { 32446 browser = BROWSERS[i]; 32447 version = UA[browser]; 32448 32449 if (version > 0) { 32450 versionMajor = parseInt(version, 10); 32451 uaVersionMajor = browser + versionMajor; 32452 32453 uaVersionMinor = (browser + version); 32454 32455 if (String(version).indexOf('.') > -1) { 32456 uaVersionMinor = uaVersionMinor.replace(/\.(\d).*/, '-$1'); 32457 } 32458 else { 32459 uaVersionMinor += '-0'; 32460 } 32461 32462 browserList.push(browser, uaVersionMajor, uaVersionMinor); 32463 32464 versionObj.string = browser + ''; 32465 versionObj.major = versionMajor; 32466 } 32467 } 32468 32469 UA.version = versionObj; 32470 32471 UA.renderer = ''; 32472 32473 if (UA.ie) { 32474 UA.renderer = 'trident'; 32475 } 32476 else if (UA.edge) { 32477 UA.renderer = 'edgeHTML' 32478 } 32479 else if (UA.gecko) { 32480 UA.renderer = 'gecko'; 32481 } 32482 else if (UA.webkit) { 32483 UA.renderer = 'webkit'; 32484 } 32485 else if (UA.opera) { 32486 UA.renderer = 'presto'; 32487 } 32488 32489 A.UA = UA; 32490 32491 /* 32492 * Browser selectors 32493 */ 32494 32495 var selectors = [ 32496 UA.renderer, 32497 'js' 32498 ].concat(browserList); 32499 32500 var osSelector = MAP_OS_SELECTORS[UA.os] || UA.os; 32501 32502 selectors.push(osSelector); 32503 32504 if (UA.mobile) { 32505 selectors.push('mobile'); 32506 } 32507 32508 if (UA.secure) { 32509 selectors.push('secure'); 32510 } 32511 32512 if (UA.touch) { 32513 selectors.push('touch'); 32514 } 32515 32516 UA.selectors = selectors.join(' '); 32517 32518 var svg; 32519 var vml; 32520 32521 vml = !(svg = !!(CONFIG.win.SVGAngle || DOC.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1'))); 32522 32523 if (vml) { 32524 var behaviorObj; 32525 var div = DOC.createElement('div'); 32526
32527 div.innerHTML = '<v:shape adj="1"/>'; 32528 32529 behaviorObj = div.firstChild; 32530 32531 behaviorObj.style.behavior = 'url(#default#VML)'; 32532 32533 if (!(behaviorObj && typeof behaviorObj.adj == 'object')) { 32534 vml = false; 32535 } 32536 32537 div = null; 32538 } 32539 32540 YUI._VML = vml; 32541 YUI._SVG = svg; 32542 32543 UA.vml = YUI._VML; 32544 UA.svg = YUI._SVG; 32545 } 32546 32547 return UA.selectors; 32548 }, 32549 32550 run: function() { 32551 var documentElement = DOC.documentElement; 32552 32553 var selectors = this.getSelectors(); 32554 32555 UA.dir = documentElement.getAttribute('dir') || 'ltr'; 32556 32557 if (documentElement.className.indexOf(UA.dir) === -1) { 32558 selectors += ' ' + UA.dir; 32559 } 32560 32561 if (documentElement.className.indexOf(YUI3_JS_ENABLED) === -1 && selectors.indexOf(YUI3_JS_ENABLED) === -1) { 32562 selectors += ' ' + YUI3_JS_ENABLED; 32563 } 32564 32565 documentElement.className += ' ' + selectors; 32566 } 32567 }; 32568 32569 Liferay.BrowserSelectors = BrowserSelectors; 32570 }, 32571 '', 32572 { 32573 requires: ['yui-base'] 32574 } 32575); 32576;(function() { 32577 var LiferayAUI = Liferay.AUI; 32578 32579 var COMBINE = LiferayAUI.getCombine(); 32580 32581 var CORE_MODULES = YUI.Env.core; 32582 32583 var INPUT_EL = document.createElement('input'); 32584 32585 var PATH_EDITOR_CKEDITOR = LiferayAUI.getEditorCKEditorPath(); 32586 32587 var PATH_JAVASCRIPT = LiferayAUI.getJavaScriptRootPath(); 32588 32589 var SUPPORTS_INPUT_SELECTION = typeof INPUT_EL.selectionStart === 'number' && typeof INPUT_EL.selectionEnd === 'number'; 32590 32591 var testHistory = function(A) { 32592 var WIN = A.config.win; 32593 32594 var HISTORY = WIN.history; 32595 32596 return HISTORY && 32597 HISTORY.pushState && 32598 HISTORY.replaceState && 32599 ('onpopstate' in WIN || A.UA.gecko >= 2); 32600 }; 32601 32602 window.YUI_config = { 32603 base: Liferay.ThemeDisplay.getCDNBaseURL() + PATH_JAVASCRIPT + '/aui/', 32604 combine: COMBINE, 32605 comboBase: LiferayAUI.getComboPath(), 32606 filter: Liferay.AUI.getFilter(), 32607 groups: { 32608 editor: { 32609 base: PATH_EDITOR_CKEDITOR, 32610 combine: COMBINE, 32611 modules: { 32612 'inline-editor-ckeditor': { 32613 path: 'ckeditor/main.js' 32614 } 32615 }, 32616 root: PATH_EDITOR_CKEDITOR 32617 }, 32618 32619 liferay: { 32620 base: Liferay.ThemeDisplay.getCDNBaseURL() + PATH_JAVASCRIPT + '/liferay/', 32621 combine: COMBINE, 32622 filter: Liferay.AUI.getFilterConfig(), 32623 modules: { 32624 'liferay-address': { 32625 path: 'address.js', 32626 requires: [] 32627 }, 32628 'liferay-alert': { 32629 path: 'alert.js', 32630 requires: [ 32631 'aui-alert', 32632 'aui-component', 32633 'event-mouseenter', 32634 'liferay-portlet-base', 32635 'timers' 32636 ] 32637 }, 32638 'liferay-asset-addon-entry-selector': { 32639 path: 'asset_addon_entry_selector.js', 32640 requires: [ 32641 'aui-component', 32642 'liferay-portlet-base', 32643 'liferay-util-window' 32644 ] 32645 }, 32646 'liferay-asset-categories-selector': { 32647 path: 'asset_categories_selector.js', 32648 requires: [ 32649 'aui-tree', 32650 'liferay-asset-tags-selector' 32651 ] 32652 }, 32653 'liferay-asset-tags-selector': { 32654 path: 'asset_tags_selector.js', 32655 requires: [ 32656 'array-extras', 32657 'async-queue', 32658 'aui-autocomplete-deprecated', 32659 'aui-io-plugin-deprecated', 32660 'aui-io-request', 32661 'aui-live-search-deprecated', 32662 'aui-modal', 32663 'aui-template-deprecated', 32664 'aui-textboxlist-deprecated', 32665 'datasource-cache', 32666 'liferay-service-datasource' 32667 ] 32668 }, 32669 'liferay-auto-fields': { 32670 path: 'auto_fields.js', 32671 requires: [ 32672 'aui-base', 32673 'aui-data-set-deprecated', 32674 'aui-io-request', 32675 'aui-parse-content', 32676 'base', 32677 'liferay-undo-manager', 32678 'sortable' 32679 ] 32680 }, 32681 'liferay-autocomplete-input': { 32682 path: 'autocomplete_input.js', 32683 requires: [ 32684 'aui-base', 32685 'autocomplete', 32686 'autocomplete-filters', 32687 'autocomplete-highlighters' 32688 ] 32689 }, 32690 'liferay-autocomplete-input-caretindex': { 32691 condition: { 32692 name: 'liferay-autocomplete-input-caretindex', 32693 test: function() { 32694 return SUPPORTS_INPUT_SELECTION; 32695 }, 32696 trigger: 'liferay-autocomplete-textarea' 32697 }, 32698 path: 'autocomplete_input_caretindex.js', 32699 requires: [ 32700 'liferay-autocomplete-textarea' 32701 ] 32702 }, 32703 'liferay-autocomplete-input-caretindex-sel': { 32704 condition: { 32705 name: 'liferay-autocomplete-input-caretindex-sel', 32706 test: function() { 32707 return !SUPPORTS_INPUT_SELECTION; 32708 }, 32709 trigger: 'liferay-autocomplete-textarea' 32710 }, 32711 path: 'autocomplete_input_caretindex_sel.js', 32712 requires: [ 32713 'liferay-autocomplete-textarea' 32714 ] 32715 }, 32716 'liferay-autocomplete-input-caretoffset': { 32717 condition: { 32718 name: 'liferay-autocomplete-input-caretoffset', 32719 test: function(A) { 32720 return !(A.UA.ie && A.UA.ie < 9); 32721 }, 32722 trigger: 'liferay-autocomplete-textarea' 32723 }, 32724 path: 'autocomplete_input_caretoffset.js', 32725 requires: [ 32726 'liferay-autocomplete-textarea' 32727 ] 32728 }, 32729 'liferay-autocomplete-input-caretoffset-sel': { 32730 condition: { 32731 name: 'liferay-autocomplete-input-caretoffset-sel', 32732 test: function(A) { 32733 return A.UA.ie && A.UA.ie < 9; 32734 }, 32735 trigger: 'liferay-autocomplete-textarea' 32736 }, 32737 path: 'autocomplete_input_caretoffset_sel.js', 32738 requires: [ 32739 'liferay-autocomplete-textarea' 32740 ] 32741 }, 32742 'liferay-autocomplete-textarea': { 32743 path: 'autocomplete_textarea.js', 32744 requires: [ 32745 'liferay-autocomplete-input' 32746 ] 32747 }, 32748 'liferay-browser-selectors': { 32749 path: 'browser_selectors.js', 32750 requires: ['yui-base'] 32751 }, 32752 'liferay-cover-cropper': { 32753 path: 'cover_cropper.js', 32754 requires: [ 32755 'aui-base', 32756 'dd-constrain', 32757 'dd-drag', 32758 'liferay-crop-region', 32759 'plugin' 32760 ] 32761 }, 32762 'liferay-crop-region': { 32763 path: 'crop_region.js', 32764 requires: [ 32765 'aui-base' 32766 ] 32767 }, 32768 'liferay-dd-proxy': { 32769 path: 'dd_proxy.js', 32770 requires: [ 32771 'dd-proxy' 32772 ] 32773 }, 32774 'liferay-dynamic-select': {
32775 path: 'dynamic_select.js', 32776 requires: [ 32777 'aui-base' 32778 ] 32779 }, 32780 'liferay-form': { 32781 path: 'form.js', 32782 requires: [ 32783 'aui-base', 32784 'aui-form-validator' 32785 ] 32786 }, 32787 'liferay-form-placeholders': { 32788 condition: { 32789 name: 'liferay-form-placeholders', 32790 test: function(A) { 32791 return !('placeholder' in INPUT_EL); 32792 }, 32793 trigger: 'liferay-form' 32794 }, 32795 path: 'form_placeholders.js', 32796 requires: [ 32797 'liferay-form', 32798 'plugin' 32799 ] 32800 }, 32801 'liferay-fullscreen-source-editor': { 32802 path: 'fullscreen_source_editor.js', 32803 requires: [ 32804 'liferay-source-editor' 32805 ] 32806 }, 32807 'liferay-history': { 32808 path: 'history.js', 32809 requires: [ 32810 'history-hash', 32811 'querystring-parse-simple' 32812 ] 32813 }, 32814 'liferay-history-html5': { 32815 condition: { 32816 name: 'liferay-history-html5', 32817 test: testHistory, 32818 trigger: 'liferay-history' 32819 }, 32820 path: 'history_html5.js', 32821 requires: [ 32822 'history-html5', 32823 'liferay-history', 32824 'querystring-stringify-simple' 32825 ] 32826 }, 32827 'liferay-history-manager': { 32828 path: 'history_manager.js', 32829 requires: [ 32830 'liferay-history' 32831 ] 32832 }, 32833 'liferay-hudcrumbs': { 32834 path: 'hudcrumbs.js', 32835 requires: [ 32836 'aui-base', 32837 'aui-debounce', 32838 'event-resize' 32839 ] 32840 }, 32841 'liferay-icon': { 32842 path: 'icon.js', 32843 requires: [ 32844 'aui-base' 32845 ] 32846 }, 32847 'liferay-inline-editor-base': { 32848 path: 'inline_editor_base.js', 32849 requires: [ 32850 'aui-base', 32851 'aui-overlay-base-deprecated' 32852 ] 32853 }, 32854 'liferay-input-localized': { 32855 path: 'input_localized.js', 32856 requires: [ 32857 'aui-base', 32858 'aui-component', 32859 'aui-event-input', 32860 'aui-palette', 32861 'aui-set', 32862 'portal-available-languages' 32863 ] 32864 }, 32865 'liferay-input-move-boxes': { 32866 path: 'input_move_boxes.js', 32867 plugins: { 32868 'liferay-input-move-boxes-touch': { 32869 condition: { 32870 name: 'liferay-input-move-boxes-touch', 32871 trigger: 'liferay-input-move-boxes', 32872 ua: 'touchMobile' 32873 } 32874 } 32875 }, 32876 requires: [ 32877 'aui-base', 32878 'aui-toolbar' 32879 ] 32880 }, 32881 'liferay-input-move-boxes-touch': { 32882 path: 'input_move_boxes_touch.js', 32883 requires: [ 32884 'aui-base', 32885 'aui-template-deprecated', 32886 'liferay-input-move-boxes', 32887 'sortable' 32888 ] 32889 }, 32890 'liferay-item-selector-dialog': { 32891 path: 'item_selector_dialog.js', 32892 requires: [ 32893 'aui-component' 32894 ] 32895 }, 32896 'liferay-item-selector-repository-entry-browser': { 32897 path: 'item_selector_repository_entry_browser.js', 32898 requires: [ 32899 'liferay-item-selector-uploader', 32900 'liferay-item-viewer', 32901 'liferay-notice', 32902 'liferay-portlet-base', 32903 'liferay-storage-formatter' 32904 ] 32905 }, 32906 'liferay-item-selector-uploader': { 32907 path: 'item_selector_uploader.js', 32908 requires: [ 32909 'aui-base', 32910 'aui-progressbar', 32911 'liferay-portlet-base', 32912 'uploader' 32913 ] 32914 }, 32915 'liferay-item-selector-url': { 32916 path: 'item_selector_url.js', 32917 requires: [ 32918 'aui-event-input', 32919 'liferay-item-viewer', 32920 'liferay-portlet-base' 32921 ] 32922 }, 32923 'liferay-item-viewer': { 32924 path: 'item_viewer.js', 32925 requires: [ 32926 'aui-component', 32927 'aui-image-viewer', 32928 'liferay-portlet-url' 32929 ] 32930 }, 32931 'liferay-language': { 32932 path: 'language.js' 32933 }, 32934 'liferay-layout': { 32935 path: 'layout.js' 32936 }, 32937 'liferay-layout-column': { 32938 path: 'layout_column.js', 32939 requires: [ 32940 'aui-sortable-layout', 32941 'dd' 32942 ] 32943 }, 32944 'liferay-layout-freeform': { 32945 path: 'layout_freeform.js', 32946 requires: [ 32947 'liferay-layout-column', 32948 'resize' 32949 ] 32950 }, 32951 'liferay-list-view': { 32952 path: 'list_view.js', 32953 requires: [ 32954 'aui-base', 32955 'transition' 32956 ] 32957 }, 32958 'liferay-logo-editor': { 32959 path: 'logo_editor.js', 32960 requires: [ 32961 'aui-image-cropper', 32962 'aui-io-request', 32963 'liferay-alert', 32964 'liferay-crop-region', 32965 'liferay-portlet-base', 32966 'liferay-storage-formatter' 32967 ] 32968 }, 32969 'liferay-logo-selector': { 32970 path: 'logo_selector.js', 32971 requires: [ 32972 'aui-base' 32973 ] 32974 }, 32975 'liferay-menu': { 32976 path: 'menu.js', 32977 requires: [ 32978 'aui-debounce', 32979 'aui-node' 32980 ] 32981 }, 32982 'liferay-menu-filter': { 32983 path: 'menu_filter.js', 32984 requires: [ 32985 'autocomplete-base', 32986 'autocomplete-filters', 32987 'autocomplete-highlighters' 32988 ] 32989 }, 32990 'liferay-menu-toggle': { 32991 path: 'menu_toggle.js', 32992 requires: [ 32993 'aui-node', 32994 'event-outside', 32995 'event-tap', 32996 'liferay-menu-filter', 32997 'liferay-store' 32998 ] 32999 }, 33000 'liferay-message': { 33001 path: 'message.js', 33002 requires: [ 33003 'aui-base', 33004 'liferay-store' 33005 ] 33006 }, 33007 'liferay-navigation': { 33008 path: 'navigation.js', 33009 requires: [ 33010 'aui-component', 33011 'event-mouseenter' 33012 ] 33013 }, 33014 'liferay-navigation-interaction': { 33015 path: 'navigation_interaction.js', 33016 plugins: { 33017 'liferay-navigation-interaction-touch': { 33018 condition: { 33019 name: 'liferay-navigation-interaction-touch', 33020 trigger: 'liferay-navigation-interaction', 33021 ua: 'touch' 33022 } 33023 } 33024 }, 33025 requires: [ 33026 'aui-base', 33027 'aui-component', 33028 'event-mouseenter', 33029 'node-focusmanager', 33030 'plugin' 33031 ] 33032 }, 33033 'liferay-navigation-interaction-touch': { 33034 path: 'navigation_interaction_touch.js', 33035 requires: [ 33036 'event-tap', 33037 'event-touch', 33038 'liferay-navigation-interaction' 33039 ] 33040 },
33041 'liferay-node': { 33042 path: 'node.js', 33043 requires: [ 33044 'dom-base' 33045 ] 33046 }, 33047 'liferay-notice': { 33048 path: 'notice.js', 33049 requires: [ 33050 'aui-base', 33051 'transition' 33052 ] 33053 }, 33054 'liferay-notification': { 33055 path: 'notification.js', 33056 requires: [ 33057 'liferay-alert' 33058 ] 33059 }, 33060 'liferay-pagination': { 33061 path: 'pagination.js', 33062 requires: [ 33063 'aui-pagination' 33064 ] 33065 }, 33066 'liferay-panel-search': { 33067 path: 'panel_search.js', 33068 requires: [ 33069 'aui-base', 33070 'liferay-search-filter' 33071 ] 33072 }, 33073 'liferay-poller': { 33074 path: 'poller.js', 33075 requires: [ 33076 'aui-base', 33077 'io', 33078 'json' 33079 ] 33080 }, 33081 'liferay-portlet-base': { 33082 path: 'portlet_base.js', 33083 requires: [ 33084 'aui-base', 33085 'liferay-node' 33086 ] 33087 }, 33088 'liferay-portlet-url': { 33089 path: 'portlet_url.js', 33090 requires: [ 33091 'aui-base', 33092 'aui-io-request', 33093 'querystring-stringify-simple' 33094 ] 33095 }, 33096 'liferay-preview': { 33097 path: 'preview.js', 33098 requires: [ 33099 'aui-base', 33100 'aui-overlay-mask-deprecated', 33101 'aui-toolbar', 33102 'liferay-widget-zindex' 33103 ] 33104 }, 33105 'liferay-progress': { 33106 path: 'progress.js', 33107 requires: [ 33108 'aui-progressbar' 33109 ] 33110 }, 33111 'liferay-ratings': { 33112 path: 'ratings.js', 33113 requires: [ 33114 'aui-io-request', 33115 'aui-rating' 33116 ] 33117 }, 33118 'liferay-resize-rtl': { 33119 condition: { 33120 test: function(A) { 33121 return document.documentElement.dir === 'rtl'; 33122 }, 33123 trigger: 'resize-base' 33124 }, 33125 path: 'resize_rtl.js' 33126 }, 33127 'liferay-restore-entry': { 33128 path: 'restore_entry.js', 33129 requires: [ 33130 'aui-io-plugin-deprecated', 33131 'aui-io-request', 33132 'aui-modal', 33133 'liferay-portlet-base' 33134 ] 33135 }, 33136 'liferay-search-container': { 33137 path: 'search_container.js', 33138 requires: [ 33139 'aui-base', 33140 'aui-datatable-core' 33141 ] 33142 }, 33143 'liferay-search-container-move': { 33144 path: 'search_container_move.js', 33145 requires: [ 33146 'aui-component', 33147 'dd-constrain', 33148 'dd-delegate', 33149 'dd-drag', 33150 'dd-drop', 33151 'dd-proxy', 33152 'plugin' 33153 ] 33154 }, 33155 'liferay-search-container-select': { 33156 path: 'search_container_select.js', 33157 requires: [ 33158 'aui-component', 33159 'aui-url', 33160 'plugin' 33161 ] 33162 }, 33163 'liferay-search-filter': { 33164 path: 'search_filter.js', 33165 requires: [ 33166 'aui-base', 33167 'autocomplete-base', 33168 'autocomplete-filters' 33169 ] 33170 }, 33171 'liferay-service-datasource': { 33172 path: 'service_datasource.js', 33173 requires: [ 33174 'aui-base', 33175 'datasource-local' 33176 ] 33177 }, 33178 'liferay-session': { 33179 path: 'session.js', 33180 requires: [ 33181 'aui-io-request', 33182 'aui-timer', 33183 'cookie', 33184 'liferay-notification' 33185 ] 33186 }, 33187 'liferay-sign-in-modal': { 33188 path: 'sign_in_modal.js', 33189 requires: [ 33190 'aui-base', 33191 'aui-component', 33192 'aui-io-request', 33193 'aui-parse-content', 33194 'liferay-form', 33195 'liferay-portlet-url', 33196 'liferay-util-window', 33197 'plugin' 33198 ] 33199 }, 33200 'liferay-social-bookmarks': { 33201 path: 'social_bookmarks.js', 33202 requires: [ 33203 'aui-component', 33204 'aui-node' 33205 ] 33206 }, 33207 'liferay-sortable': { 33208 path: 'sortable.js', 33209 requires: [ 33210 'liferay-dd-proxy', 33211 'sortable' 33212 ] 33213 }, 33214 'liferay-source-editor': { 33215 path: 'source_editor.js', 33216 requires: [ 33217 'aui-ace-editor' 33218 ] 33219 }, 33220 'liferay-storage-formatter': { 33221 path: 'storage_formatter.js', 33222 requires: [ 33223 'aui-base', 33224 'datatype-number-format' 33225 ] 33226 }, 33227 'liferay-store': { 33228 path: 'store.js', 33229 requires: [ 33230 'aui-io-request' 33231 ] 33232 }, 33233 'liferay-toggler-interaction': { 33234 path: 'toggler_interaction.js', 33235 requires: [ 33236 'liferay-toggler-key-filter' 33237 ] 33238 }, 33239 'liferay-toggler-key-filter': { 33240 path: 'toggler_key_filter.js', 33241 requires: [ 33242 'aui-event-base' 33243 ] 33244 }, 33245 'liferay-token-list': { 33246 path: 'token_list.js', 33247 requires: [ 33248 'aui-base', 33249 'aui-template-deprecated' 33250 ] 33251 }, 33252 'liferay-translation-manager': { 33253 path: 'translation_manager.js', 33254 requires: [ 33255 'aui-base' 33256 ] 33257 }, 33258 'liferay-undo-manager': { 33259 path: 'undo_manager.js', 33260 requires: [ 33261 'aui-data-set-deprecated', 33262 'base' 33263 ] 33264 }, 33265 'liferay-upload': { 33266 path: 'upload.js', 33267 requires: [ 33268 'aui-io-request', 33269 'aui-template-deprecated', 33270 'collection', 33271 'liferay-portlet-base', 33272 'liferay-storage-formatter', 33273 'uploader' 33274 ] 33275 }, 33276 'liferay-url-preview': { 33277 path: 'url_preview.js', 33278 requires: [ 33279 'aui-component', 33280 'liferay-util-window' 33281 ] 33282 }, 33283 'liferay-util-window': { 33284 path: 'util_window.js', 33285 requires: [ 33286 'aui-dialog-iframe-deprecated', 33287 'aui-modal', 33288 'aui-url', 33289 'event-resize', 33290 'liferay-widget-zindex' 33291 ] 33292 }, 33293 'liferay-widget-size-animation-plugin': { 33294 path: 'widget_size_animation_plugin.js', 33295 requires: [ 33296 'anim-easing', 33297 'plugin', 33298 'widget' 33299 ] 33300 }, 33301 'liferay-widget-zindex': { 33302 path: 'widget_zindex.js', 33303 requires: [ 33304 'aui-modal', 33305 'plugin' 33306 ] 33307 }, 33308 'liferay-xml-formatter': { 33309 path: 'xml_formatter.js', 33310 requires: [ 33311 'aui-base' 33312 ] 33313 } 33314 }, 33315 root: PATH_JAVASCRIPT + '/liferay/' 33316 }, 33317 33318 misc: { 33319 base: Liferay.ThemeDisplay.getCDNBaseURL() + PATH_JAVASCRIPT + '/misc/', 33320 combine: COMBINE, 33321 modules: { 33322 'swfobject': { 33323 path: 'swfobject.js' 33324 }, 33325 'swfupload': { 33326 path: 'swfupload/swfupload.js' 33327 } 33328 }, 33329 root: PATH_JAVASCRIPT + '/misc/' 33330 }, 33331 33332 portal: { 33333 base: Liferay.ThemeDisplay.getCDNBaseURL() + PATH_JAVASCRIPT + '/liferay/', 33334 combine: false, 33335 modules: { 33336 'portal-available-languages': { 33337 path: LiferayAUI.getAvailableLangPath(), 33338 requires: [ 33339 'liferay-language' 33340 ] 33341 } 33342 }, 33343 root: PATH_JAVASCRIPT + '/liferay/' 33344 } 33345 }, 33346 insertBefore: 'liferayPortalCSS', 33347 lang: themeDisplay.getBCP47LanguageId(), 33348 root: PATH_JAVASCRIPT + '/aui/', 33349 useBrowserConsole: false 33350 }; 33351 33352 CORE_MODULES.push('liferay-browser-selectors'); 33353})(); 33354;(function() { 33355 var ALLOY = YUI(); 33356 33357 if (ALLOY.html5shiv) { 33358 ALLOY.html5shiv(); 33359 } 33360 33361 var originalUse = ALLOY.use; 33362 33363 ALLOY.use = function() { 33364 var args = Array.prototype.slice.call(arguments, 0); 33365 33366 var currentURL = Liferay.currentURL; 33367 33368 var originalCallback = args[args.length - 1]; 33369 33370 if (typeof originalCallback === 'function') { 33371 args[args.length - 1] = function() { 33372 if (Liferay.currentURL === currentURL) { 33373 originalCallback.apply(this, arguments); 33374 } 33375 }; 33376 } 33377 33378 return originalUse.apply(this, args); 33379 }; 33380 33381 window.AUI = function() { 33382 return ALLOY; 33383 }; 33384 33385 ALLOY.mix(AUI, YUI); 33386 33387 AUI.$ = window.jQuery; 33388 AUI._ = window._; 33389})(); 33390/** 33391* Clay 2.14.2 33392* 33393* Copyright 2019, Liferay, Inc. 33394* All rights reserved. 33395* MIT license 33396*/ 33397+function($) { 33398 var CollapsibleSearch = function(element) { 33399 var instance = this; 33400 33401 instance.$element = $(element); 33402 instance.$close = instance.$element.find('.basic-search-close'); 33403 instance.$input = instance.$element.find('input[type="text"]'); 33404 instance.$submit = instance.$element.find('[type="submit"]'); 33405 33406 instance.$close.on('click.lexicon.close.collapsible-search', $.proxy(instance.close, instance)); 33407 instance.$input.on('blur.lexicon.collapsible-search', $.proxy(instance.blur, instance)); 33408 instance.$input.on('focus.lexicon.collapsible-search', $.proxy(instance.focus, instance)); 33409 instance.$submit.on('click.lexicon.submit.collapsible-search', $.proxy(instance.submit, instance)); 33410 }; 33411 33412 CollapsibleSearch.BREAKPOINT = 768; 33413 CollapsibleSearch.TRANSITION_DURATION = 500; 33414 33415 CollapsibleSearch.prototype = { 33416 blur: function(event) { 33417 var $input = $(event.currentTarget); 33418 33419 $input.closest('.basic-search').removeClass('focus'); 33420 }, 33421 33422 close: function(event) { 33423 var instance = this; 33424 33425 var basicSearch = $(event.currentTarget).closest('.basic-search'); 33426 33427 var basicSearchSlider = basicSearch.find('.basic-search-slider'); 33428 var basicSearchSubmit = basicSearch.find('[type="submit"]'); 33429 33430 var complete = function() { 33431 basicSearch.removeClass('basic-search-transition'); 33432 33433 basicSearch.trigger('closed.lexicon.collapsible.search'); 33434 }; 33435 33436 var supportsTransition = bootstrap.Util.supportsTransitionEnd(); 33437 33438 if (supportsTransition) { 33439 basicSearchSlider.one('bsTransitionEnd', $.proxy(complete, instance)) 33440 .emulateTransitionEnd(CollapsibleSearch.TRANSITION_DURATION); 33441 } 33442 33443 basicSearch.addClass('basic-search-transition').removeClass('open'); 33444 33445 if (!supportsTransition) { 33446 complete.call(instance); 33447 } 33448 else { 33449 basicSearchSubmit.focus(); 33450 } 33451 }, 33452 33453 destroy: function() { 33454 var instance = this; 33455 33456 instance.$close.off('click.lexicon.close.collapsible-search'); 33457 instance.$input.off('blur.lexicon.collapsible-search'); 33458 instance.$input.off('focus.lexicon.collapsible-search'); 33459 instance.$submit.off('click.lexicon.submit.collapsible-search'); 33460 }, 33461 33462 focus: function(event) { 33463 $(event.currentTarget).closest('.basic-search').addClass('focus'); 33464 }, 33465 33466 submit: function(event) { 33467 var instance = this; 33468 33469 if (window.innerWidth < CollapsibleSearch.BREAKPOINT) { 33470 var basicSearch = $(event.currentTarget).parents('.basic-search'); 33471 33472 var basicSearchInput = basicSearch.find('input[type="text"]'); 33473 var basicSearchSlider = basicSearch.find('.basic-search-slider'); 33474 33475 var complete = function() { 33476 basicSearch.removeClass('basic-search-transition'); 33477 basicSearchInput.focus(); 33478 33479 basicSearch.trigger('open.lexicon.collapsible.search'); 33480 }; 33481 33482 if (!basicSearch.hasClass('open')) { 33483 event.preventDefault(); 33484 33485 var supportsTransition = bootstrap.Util.supportsTransitionEnd(); 33486 33487 if (supportsTransition) { 33488 basicSearchSlider.one('bsTransitionEnd', $.proxy(complete, instance)) 33489 .emulateTransitionEnd(CollapsibleSearch.TRANSITION_DURATION); 33490 } 33491 33492 basicSearch.addClass('basic-search-transition').addClass('open'); 33493 33494 if (!supportsTransition) { 33495 complete.call(instance); 33496 } 33497 } 33498 } 33499 } 33500 }; 33501 33502 var Plugin = function(option) { 33503 return this.each( 33504 function() { 33505 var $this = $(this); 33506 33507 var data = $this.data('lexicon.collapsible-search'); 33508 33509 if (!data) { 33510 data = new CollapsibleSearch(this); 33511 33512 $this.data('lexicon.collapsible-search', data); 33513 } 33514 33515 if (typeof option == 'string') { 33516 data[option](); 33517 } 33518 } 33519 ); 33520 }; 33521 33522 var old = $.fn.collapsibleSearch; 33523 33524 $.fn.collapsibleSearch = Plugin; 33525 $.fn.collapsibleSearch.Constructor = CollapsibleSearch; 33526 33527 $.fn.collapsibleSearch.noConflict = function() { 33528 $.fn.collapsibleSearch = old; 33529 33530 return this; 33531 }; 33532 33533 var close = '[data-toggle="collapsible-search"] .basic-search-close'; 33534 var input = '[data-toggle="collapsible-search"] input[type="text"]'; 33535 var submit = '[data-toggle="collapsible-search"] [type="submit"]'; 33536 33537 $(document) 33538 .on('blur.lexicon.collapsible-search.data-api', input, $.proxy(CollapsibleSearch.prototype.blur, CollapsibleSearch)) 33539 .on('click.lexicon.close.collapsible-search.data-api', close, $.proxy(CollapsibleSearch.prototype.close, CollapsibleSearch)) 33540 .on('click.lexicon.submit.collapsible-search.data-api', submit, $.proxy(CollapsibleSearch.prototype.submit, CollapsibleSearch)) 33541 .on('focus.lexicon.collapsible-search.data-api', input, $.proxy(CollapsibleSearch.prototype.focu
33541s, CollapsibleSearch)); 33542}(jQuery); 33543/** 33544* Clay 2.14.2 33545* 33546* Copyright 2019, Liferay, Inc. 33547* All rights reserved. 33548* MIT license 33549*/ 33550+function($) { 33551 var doc = $(document); 33552 33553 var listenerAdded = false; 33554 33555 // Make sure we only add one resize listener to the page, 33556 // no matter how many components we have 33557 33558 var addResizeListener = function() { 33559 if (!listenerAdded) { 33560 $(window).on( 33561 'resize', 33562 debounce( 33563 function(event) { 33564 doc.trigger('screenChange.lexicon.sidenav'); 33565 }, 33566 150 33567 ) 33568 ); 33569 33570 listenerAdded = true; 33571 } 33572 }; 33573 33574 var debounce = function(fn, delay) { 33575 var id; 33576 33577 return function() { 33578 var instance = this; 33579 33580 var args = arguments; 33581 33582 var later = function() { 33583 id = null; 33584 33585 fn.apply(instance, args); 33586 }; 33587 33588 clearTimeout(id); 33589 33590 id = setTimeout(later, delay); 33591 }; 33592 }; 33593 33594 var getBreakpointRegion = function() { 33595 var screenXs = 480; 33596 var screenSm = 768; 33597 var screenMd = 992; 33598 var screenLg = 1200; 33599 33600 var windowWidth = window.innerWidth; 33601 var region = ''; 33602 33603 if (windowWidth >= screenLg) { 33604 region = 'lg'; 33605 } 33606 else if (windowWidth >= screenMd) { 33607 region = 'md'; 33608 } 33609 else if (windowWidth >= screenSm) { 33610 region = 'sm'; 33611 } 33612 else if (windowWidth >= screenXs) { 33613 region = 'xs'; 33614 } 33615 else { 33616 region = 'xxs'; 33617 } 33618 33619 return region; 33620 }; 33621 33622 var guid = (function() { 33623 var counter = 0; 33624 33625 return function(toggler, ns) { 33626 var strId = toggler.attr('id'); 33627 33628 if (!strId) { 33629 strId = (ns + counter++); 33630 33631 toggler.attr('id', strId); 33632 } 33633 33634 return strId; 33635 }; 33636 }()); 33637 33638 var toInt = function(str) { 33639 return parseInt(str, 10) || 0; 33640 }; 33641 33642 var SideNavigation = function(toggler, options) { 33643 this.init(toggler, options); 33644 }; 33645 33646 SideNavigation.TRANSITION_DURATION = 500; 33647 33648 SideNavigation.prototype = { 33649 init: function(toggler, options) { 33650 var instance = this; 33651 33652 var useDataAttribute = toggler.data('toggle') === 'sidenav'; 33653 33654 options = $.extend({}, $.fn.sideNavigation.defaults, options); 33655 33656 options.breakpoint = toInt(options.breakpoint); 33657 options.container = options.container || toggler.data('target') || toggler.attr('href'); 33658 options.gutter = toInt(options.gutter); 33659 options.heightType = options.heightType || (options.equalHeight ? 'equalHeight' : false); 33660 options.rtl = doc.attr('dir') === 'rtl'; 33661 options.width = toInt(options.width); 33662 options.widthOriginal = options.width; 33663 33664 // instantiate using data attribute 33665 33666 if (useDataAttribute) { 33667 options.closedClass = toggler.data('closed-class') || 'closed'; 33668 options.content = toggler.data('content'); 33669 options.equalHeight = false; // equalHeight option is deprecated 33670 options.loadingIndicatorTPL = toggler.data('loading-indicator-tpl') || options.loadingIndicatorTPL; 33671 options.openClass = toggler.data('open-class') || 'open'; 33672 options.toggler = toggler; 33673 options.type = toggler.data('type'); 33674 options.typeMobile = toggler.data('type-mobile'); 33675 options.url = toggler.data('url'); 33676 options.useDelegate = toggler.data('use-delegate'); 33677 options.width = ''; 33678 33679 if (options.useDelegate === undefined) { 33680 options.useDelegate = true; 33681 } 33682 } 33683 33684 instance.toggler = toggler; 33685 instance.options = options; 33686 instance.useDataAttribute = useDataAttribute; 33687 33688 instance._bindUI(); 33689 instance._renderUI(); 33690 }, 33691 33692 clearStyle: function(attribute) { 33693 var instance = this; 33694 33695 var options = instance.options; 33696 33697 var container = $(options.container); 33698 var content = container.find(options.content).first(); 33699 var navigation = container.find(options.navigation).first(); 33700 33701 var menu = container.find('.sidenav-menu').first(); 33702 33703 var els = content.add(navigation).add(menu); 33704 33705 if (Array.isArray(attribute)) { 33706 for (var i = 0; i < attribute.length; i++) { 33707 els.css(attribute[i], ''); 33708 } 33709 } 33710 else { 33711 els.css(attribute, ''); 33712 } 33713 }, 33714 33715 destroy: function() { 33716 var instance = this; 33717 33718 var options = instance.options; 33719 33720 var container = $(instance.options.container); 33721 33722 // Detach sidenav close 33723 33724 doc.off('click.close.lexicon.sidenav', instance.closeButtonSelector); 33725 doc.data(instance.dataCloseButtonSelector, null); 33726 33727 // Detach toggler 33728 33729 if (options.useDelegate) { 33730 doc.off('click.lexicon.sidenav', instance.togglerSelector); 33731 doc.data(instance.dataTogglerSelector, null); 33732 } 33733 else { 33734 container.off('click.lexicon.sidenav'); 33735 } 33736 33737 // Remove Side Navigation 33738 33739 container.data('lexicon.sidenav', null); 33740 }, 33741 33742 hide: function() { 33743 var instance = this; 33744 33745 if (instance.useDataAttribute) { 33746 instance.hideSimpleSidenav(); 33747 } 33748 else { 33749 instance.toggleNavigation(false); 33750 } 33751 }, 33752 33753 hideSidenav: function() { 33754 var instance = this; 33755 var options = instance.options; 33756 33757 var container = $(options.container); 33758 var content = container.find(options.content).first(); 33759 var navigation = container.find(options.navigation).first(); 33760 var menu = navigation.find('.sidenav-menu').first(); 33761 33762 var sidenavRight = instance._isSidenavRight(); 33763 33764 var positionDirection = options.rtl ? 'right' : 'left'; 33765 33766 if (sidenavRight) { 33767 positionDirection = options.rtl ? 'left' : 'right'; 33768 } 33769 33770 var paddingDirection = 'padding-' + positionDirection; 33771 33772 content.css(paddingDirection, '').css(positionDirection, ''); 33773 33774 navigation.css('width', ''); 33775 33776 if (sidenavRight) { 33777 menu.css(positionDirection, instance._getSidenavWidth()); 33778 } 33779 }, 33780 33781 hideSimpleSidenav: function() { 33782 var instance = this; 33783 33784 var options = instance.options; 33785 33786 var simpleSidenavClosed = instance._isSimpleSidenavClosed(); 33787 33788 if (!simpleSidenavClosed) { 33789 var content = $(options.content).first(); 33790 var sidenav = $(options.container); 33791 33792 var closedClass = options.closedClass; 33793 var openClass = options.openClass; 33794 33795 var toggler = instance.toggler; 33796 33797 var target = toggler.attr('href') || toggler.attr('data-target'); 33798 33799 sidenav.trigger({ 33800 toggler: $(instance.togglerSelector), 33801 type: 'closedStart.lexicon.sidenav' 33802 }); 33803 33804 instance._onSidenavTransitionEnd(content, function() { 33805 sidenav.removeClass('sidenav-transition'); 33806 toggler.removeClass('sidenav-transition'); 33807 33808 sidenav.trigger({ 33809 toggler: $(instance.togglerSelector), 33810 type: 'closed.lexicon.sidenav' 33811 }); 33812 }); 33813 33814 if (content.hasClass(openClass)) { 33815 content.addClass('sidenav-transition').addClass(closedClass).removeClass(openClass); 33816 } 33817 33818 sidenav.addClass('sidenav-transition'); 33819 toggler.addClass('sidenav-transition'); 33820 33821 sidenav.addClass(closedClass).removeClass(openClass); 33822 33823 $('[data-target="' + target + '"]').removeClass(openClass).removeClass('active'); 33824 $('[href="' + target + '"]').removeClass(openClass).removeClass('active'); 33825 } 33826 }, 33827 33828 setEqualHeight: function() { 33829 var instance = this; 33830 33831 var options = instance.options; 33832 33833 var container = $(options.container); 33834 var content = options.content; 33835 var navigation = options.navigation; 33836 33837 var type = instance.mobile ? options.typeMobile : options.type; 33838 33839 if (type !== 'fixed' && type !== 'fixed-push') { 33840 var contentNode = container.find(content).first(); 33841 var navNode = container.find(navigation).first(); 33842 var sideNavMenuNode = container.find('.sidenav-menu').first(); 33843 33844 var tallest = Math.max(contentNode.outerHeight(), navNode.outerHeight()); 33845 33846 contentNode.css('min-height', tallest); 33847 33848 navNode.css({ 33849 'min-height': tallest, 33850 'height': '100%' 33851 }); 33852 33853 sideNavMenuNode.css({ 33854 'min-height': tallest, 33855 'height': '100%' 33856 }); 33857 } 33858 }, 33859 33860 setFullHeight: function() { 33861 var instance = this; 33862 33863 var options = instance.options; 33864 33865 var container = $(options.container); 33866 var navigation = options.navigation; 33867 33868 var type = instance.mobile ? options.typeMobile : options.type; 33869 33870 if (type === 'relative') { 33871 var navNode = container.find(navigation).first(); 33872 var sidenavMenuNode = container.find('.sidenav-menu').first(); 33873 33874 var minHeight = doc.innerHeight() - navNode.offset().top; 33875
33876 if (sidenavMenuNode.innerHeight() + navNode.offset().top > doc.innerHeight()) { 33877 minHeight = sidenavMenuNode.innerHeight(); 33878 } 33879 33880 navNode.css({ 33881 'min-height': minHeight, 33882 'height': '100%' 33883 }); 33884 33885 sidenavMenuNode.css({ 33886 'min-height': minHeight, 33887 'height': '100%' 33888 }); 33889 } 33890 }, 33891 33892 setHeight: function() { 33893 var instance = this; 33894 33895 var options = instance.options; 33896 33897 if (options.heightType === 'equalHeight') { 33898 instance.setEqualHeight(); 33899 } 33900 else if (options.heightType === 'fullHeight') { 33901 instance.setFullHeight(); 33902 } 33903 }, 33904 33905 show: function() { 33906 var instance = this; 33907 33908 if (instance.useDataAttribute) { 33909 instance.showSimpleSidenav(); 33910 } 33911 else { 33912 instance.toggleNavigation(true); 33913 } 33914 }, 33915 33916 showSidenav: function() { 33917 var instance = this; 33918 var mobile = instance.mobile; 33919 var options = instance.options; 33920 33921 var container = $(options.container); 33922 var content = container.find(options.content).first(); 33923 var navigation = container.find(options.navigation).first(); 33924 var menu = navigation.find('.sidenav-menu').first(); 33925 33926 var sidenavRight = instance._isSidenavRight(); 33927 var width = instance._getSidenavWidth(); 33928 33929 var offset = width + options.gutter; 33930 33931 var url = options.url; 33932 33933 if (url) { 33934 container.one( 33935 'urlLoaded.lexicon.sidenav', 33936 function(event) { 33937 instance.setHeight(); 33938 } 33939 ); 33940 33941 instance._loadUrl(menu, url, container); 33942 } 33943 33944 navigation.css('width', width); 33945 menu.css('width', width); 33946 33947 var positionDirection = options.rtl ? 'right' : 'left'; 33948 33949 if (sidenavRight) { 33950 positionDirection = options.rtl ? 'left' : 'right'; 33951 } 33952 33953 var paddingDirection = 'padding-' + positionDirection; 33954 33955 var pushContentCssProperty = mobile ? positionDirection : paddingDirection; 33956 var type = mobile ? options.typeMobile : options.type; 33957 33958 if (type !== 'fixed') { 33959 var navigationStartX = container.hasClass('open') ? navigation.offset().left - options.gutter : navigation.offset().left - offset; 33960 33961 var contentStartX = content.offset().left; 33962 var contentWidth = content.innerWidth(); 33963 33964 var padding = ''; 33965 33966 if ((options.rtl && sidenavRight) || (!options.rtl && options.position === 'left')) { 33967 navigationStartX = navigation.offset().left + offset; 33968 33969 if (navigationStartX > contentStartX) { 33970 padding = navigationStartX - contentStartX; 33971 } 33972 } 33973 else if ((options.rtl && options.position === 'left') || (!options.rtl && sidenavRight)) { 33974 if (navigationStartX < contentStartX + contentWidth) { 33975 padding = (contentStartX + contentWidth) - navigationStartX; 33976 33977 if (padding >= offset) { 33978 padding = offset; 33979 } 33980 } 33981 } 33982 33983 content.css(pushContentCssProperty, padding); 33984 } 33985 }, 33986 33987 showSimpleSidenav: function() { 33988 var instance = this; 33989 33990 var options = instance.options; 33991 33992 var simpleSidenavClosed = instance._isSimpleSidenavClosed(); 33993 33994 if (simpleSidenavClosed) { 33995 var content = $(options.content).first(); 33996 var sidenav = $(options.container); 33997 33998 var closedClass = options.closedClass; 33999 var openClass = options.openClass; 34000 34001 var toggler = options.toggler; 34002 34003 var url = toggler.data('url'); 34004 34005 if (url) { 34006 instance._loadUrl(sidenav, url); 34007 } 34008 34009 sidenav.trigger({ 34010 toggler: $(instance.togglerSelector), 34011 type: 'openStart.lexicon.sidenav' 34012 }); 34013 34014 instance._onSidenavTransitionEnd(content, function() { 34015 sidenav.removeClass('sidenav-transition'); 34016 toggler.removeClass('sidenav-transition'); 34017 34018 sidenav.trigger({ 34019 toggler: $(instance.togglerSelector), 34020 type: 'open.lexicon.sidenav' 34021 }); 34022 }); 34023 34024 content.addClass('sidenav-transition').addClass(openClass).removeClass(closedClass); 34025 sidenav.addClass('sidenav-transition'); 34026 toggler.addClass('sidenav-transition'); 34027 34028 sidenav.addClass(openClass).removeClass(closedClass); 34029 toggler.addClass('active').addClass(openClass); 34030 } 34031 }, 34032 34033 toggle: function() { 34034 var instance = this; 34035 34036 if (instance.useDataAttribute) { 34037 instance.toggleSimpleSidenav(); 34038 } 34039 else { 34040 instance.toggleNavigation(); 34041 } 34042 }, 34043 34044 toggleNavigation: function(force) { 34045 var instance = this; 34046 var options = instance.options; 34047 34048 var container = $(options.container); 34049 var menu = container.find('.sidenav-menu').first(); 34050 var toggler = instance.toggler; 34051 34052 var width = options.width; 34053 34054 var closed = $.type(force) === 'boolean' ? force : container.hasClass('closed'); 34055 var sidenavRight = instance._isSidenavRight(); 34056 34057 var widthMethod = closed ? 'showSidenav' : 'hideSidenav'; 34058 34059 if (closed) { 34060 container.trigger({ 34061 toggler: toggler, 34062 type: 'openStart.lexicon.sidenav' 34063 }); 34064 } 34065 else { 34066 container.trigger({ 34067 toggler: toggler, 34068 type: 'closedStart.lexicon.sidenav' 34069 }); 34070 } 34071 34072 instance._onSidenavTransitionEnd(container, function() { 34073 var menu = container.find('.sidenav-menu').first(); 34074 34075 if (container.hasClass('closed')) { 34076 instance.clearStyle(['min-height', 'height']); 34077 34078 toggler.removeClass('open').removeClass('sidenav-transition'); 34079 34080 container.trigger({ 34081 toggler: toggler, 34082 type: 'closed.lexicon.sidenav' 34083 }); 34084 } 34085 else { 34086 toggler.addClass('open').removeClass('sidenav-transition'); 34087 34088 container.trigger({ 34089 toggler: toggler, 34090 type: 'open.lexicon.sidenav' 34091 }); 34092 } 34093 34094 if (instance.mobile) { 34095 instance._focusElement(menu); 34096 } 34097 }); 34098 34099 if (closed) { 34100 instance.setHeight(); 34101 34102 menu.css('width', width); 34103 34104 var positionDirection = options.rtl ? 'left' : 'right'; 34105 34106 if (sidenavRight) { 34107 menu.css(positionDirection, ''); 34108 } 34109 } 34110 34111 container.addClass('sidenav-transition'); 34112 toggler.addClass('sidenav-transition'); 34113 34114 instance[widthMethod](container); 34115 34116 container.toggleClass('closed', !closed).toggleClass('open', closed); 34117 toggler.toggleClass('active', closed).toggleClass('open', closed); 34118 }, 34119 34120 toggleSimpleSidenav: function() { 34121 var instance = this; 34122 34123 var simpleSidenavClosed = instance._isSimpleSidenavClosed(); 34124 34125 if (simpleSidenavClosed) { 34126 instance.showSimpleSidenav(); 34127 } 34128 else { 34129 instance.hideSimpleSidenav(); 34130 } 34131 }, 34132 34133 visible: function() { 34134 var instance = this; 34135 34136 var closed; 34137 34138 if (instance.useDataAttribute) { 34139 closed = instance._isSimpleSidenavClosed(); 34140 } 34141 else { 34142 var container = $(instance.options.container); 34143 34144 closed = container.hasClass('sidenav-transition') ? !container.hasClass('closed') : container.hasClass('closed'); 34145 } 34146 34147 return !closed; 34148 }, 34149 34150 _bindUI: function() { 34151 var instance = this; 34152 34153 if (!instance.useDataAttribute) { 34154 addResizeListener(); 34155 instance._onScreenChange(); 34156 } 34157 34158 if (instance.options.useDelegate) { 34159 instance._onDelegateClickTrigger(); 34160 } 34161 else { 34162 instance._onClickTrigger(); 34163 } 34164 34165 instance._onClickSidenavClose(); 34166 }, 34167 34168 _focusElement: function(el) { 34169 34170 // ios 8 fixed element disappears when trying to scroll 34171 34172 el.focus(); 34173 }, 34174 34175 _getSidenavWidth: function() { 34176 var instance = this; 34177 34178 var options = instance.options; 34179 34180 var widthOriginal = options.widthOriginal; 34181 34182 var width = widthOriginal; 34183 var winWidth = window.innerWidth; 34184 34185 if (winWidth < widthOriginal + 40) { 34186 width = winWidth - 40; 34187 } 34188 34189 return width; 34190 }, 34191 34192 _getSimpleSidenavType: function() { 34193 var instance = this; 34194 34195 var options = instance.options; 34196 34197 var desktop = instance._isDesktop(); 34198 var type = options.type; 34199 var typeMobile = options.typeMobile; 34200 34201 if (desktop && (type === 'fixed-push')) { 34202 return 'desktop-fixed-push'; 34203 } 34204 else if (!desktop && (typeMobile === 'fixed-push')) { 34205 return 'mobile-fixed-push'; 34206 } 34207 34208 return 'fixed'; 34209 }, 34210 34211 _isDesktop: function() { 34212 return window.innerWidth >= this.options.breakpoint; 34213 }, 34214 34215 _isSidenavRight: function() { 34216 var instance = this; 34217 var options = instance.options; 34218 34219 var container = $(options.container); 34220 var isSidenavRight = container.hasClass('sidenav-right'); 34221 34222 return isSidenavRight; 34223 }, 34224 34225 _isSimpleSidenavClosed: function() { 34226 var instance = this; 34227 var options = instance.options; 34228 34229 var openClass = options.openClass; 34230 34231 var container = $(options.container); 34232 34233 return !container.hasClass(openClass); 34234 }, 34235 34236 _loadUrl: function(sidenav, url, eventTarget) { 34237 var instance = this; 34238 34239 var urlLoaded = sidenav.data('url-loaded'); 34240 34241 var readyState = urlLoaded ? urlLoaded.readyState : 0; 34242 34243 eventTarget = eventTarget || sidenav; 34244 34245 var sidebarBody = sidenav.find('.sidebar-body').first(); 34246 34247 if (!readyState && sidebarBody.length && (typeof url === 'string' || $.isPlainObject(url))) { 34248 sidebarBody.append('<div class="sidenav-loading">' + instance.options.loadingIndicatorTPL + '</div>'); 34249 34250 urlLoaded = $.ajax(url).done( 34251 function(response) { 34252 sidebarBody.append(response); 34253 34254 eventTarget.trigger('urlLoaded.lexicon.sidenav'); 34255 34256 sidebarBody.find('.sidenav-loading').remove(); 34257 } 34258 ); 34259 34260 sidenav.data('url-loaded', urlLoaded); 34261 } 34262 34263 return urlLoaded; 34264 }, 34265 34266 _onClickSidenavClose: function() { 34267 var instance = this; 34268 34269 var options = instance.options; 34270 34271 var container = $(options.container); 34272 var containerSelector = options.container; 34273 34274 var closeButton = $(containerSelector).find('.sidenav-close').first(); 34275 var closeButtonSelector = '#' + guid(closeButton, 'generatedLexiconSidenavCloseId'); 34276 var dataCloseButtonSelector = 'lexicon.' + closeButtonSelector; 34277 34278 if (!doc.data(dataCloseButtonSelector)) { 34279 doc.data(dataCloseButtonSelector, 'true'); 34280 34281 doc.on('click.close.lexicon.sidenav', closeButtonSelector, function(event) { 34282 event.preventDefault(); 34283
34284 instance.toggle(); 34285 }); 34286 } 34287 34288 instance.closeButtonSelector = closeButtonSelector; 34289 instance.dataCloseButtonSelector = dataCloseButtonSelector; 34290 }, 34291 34292 _onClickTrigger: function() { 34293 var instance = this; 34294 34295 var el = instance.toggler; 34296 34297 el.on( 34298 'click.lexicon.sidenav', 34299 function(event) { 34300 instance.toggle(); 34301 } 34302 ); 34303 }, 34304 34305 _onDelegateClickTrigger: function() { 34306 var instance = this; 34307 34308 var toggler = instance.toggler; 34309 34310 var togglerSelector = '#' + guid(toggler, 'generatedLexiconSidenavTogglerId'); 34311 34312 var dataTogglerSelector = 'lexicon.' + togglerSelector; 34313 34314 if (!doc.data(dataTogglerSelector)) { 34315 doc.data(dataTogglerSelector, 'true'); 34316 34317 doc.on( 34318 'click.lexicon.sidenav', 34319 togglerSelector, 34320 function(event) { 34321 instance.toggle(); 34322 34323 event.preventDefault(); 34324 } 34325 ); 34326 } 34327 34328 instance.togglerSelector = togglerSelector; 34329 instance.dataTogglerSelector = dataTogglerSelector; 34330 }, 34331 34332 _onScreenChange: function() { 34333 var instance = this; 34334 var options = instance.options; 34335 34336 var container = $(options.container); 34337 var toggler = instance.toggler; 34338 34339 var screenStartDesktop = instance._setScreenSize(); 34340 34341 doc.on('screenChange.lexicon.sidenav', function(event) { 34342 var desktop = instance._setScreenSize(); 34343 var sidenavRight = instance._isSidenavRight(); 34344 var type = desktop ? options.type : options.typeMobile; 34345 34346 var fixedMenu = type === 'fixed' || type === 'fixed-push'; 34347 34348 var menu = container.find('.sidenav-menu').first(); 34349 var navigation = container.find(options.navigation).first(); 34350 34351 var menuWidth; 34352 34353 var originalMenuWidth = options.widthOriginal; 34354 34355 var positionDirection = options.rtl ? 'left' : 'right'; 34356 34357 container.toggleClass('sidenav-fixed', fixedMenu); 34358 34359 if ((!desktop && screenStartDesktop) || (desktop && !screenStartDesktop)) { 34360 instance.hideSidenav(); 34361 34362 instance.clearStyle([ 'min-height', 'height' ]); 34363 34364 container.addClass('closed').removeClass('open'); 34365 toggler.removeClass('active').removeClass('open'); 34366 34367 screenStartDesktop = false; 34368 34369 if (desktop) { 34370 if (sidenavRight) { 34371 menu.css(positionDirection, originalMenuWidth).css('width', originalMenuWidth); 34372 } 34373 34374 screenStartDesktop = true; 34375 } 34376 } 34377 34378 var closed = container.hasClass('closed'); 34379 34380 if (!desktop) { 34381 menuWidth = originalMenuWidth; 34382 34383 if (window.innerWidth <= originalMenuWidth) { 34384 menuWidth = window.innerWidth - options.gutter - 25; 34385 } 34386 34387 if (sidenavRight) { 34388 if (closed) { 34389 menu.css(positionDirection, menuWidth); 34390 } 34391 34392 menu.css('width', menuWidth); 34393 } 34394 34395 screenStartDesktop = false; 34396 } 34397 34398 if (!closed) { 34399 instance.clearStyle([ 'min-height', 'height' ]); 34400 34401 instance.showSidenav(); 34402 instance.setHeight(); 34403 } 34404 }); 34405 }, 34406 34407 _onSidenavTransitionEnd: function(el, fn) { 34408 var instance = this; 34409 34410 var transitionEnd = 'bsTransitionEnd'; 34411 34412 var complete = function() { 34413 el.removeClass('sidenav-transition'); 34414 34415 if (fn) { 34416 fn(); 34417 } 34418 }; 34419 34420 if (!bootstrap.Util.supportsTransitionEnd()) { 34421 complete.call(instance); 34422 } 34423 else { 34424 el.one(transitionEnd, function(event) { 34425 complete(); 34426 }) 34427 .emulateTransitionEnd(SideNavigation.TRANSITION_DURATION); 34428 } 34429 }, 34430 34431 _renderNav: function() { 34432 var instance = this; 34433 var options = instance.options; 34434 34435 var container = $(options.container); 34436 var slider = container.find(options.navigation).first(); 34437 var menu = slider.find('.sidenav-menu').first(); 34438 34439 var closed = container.hasClass('closed'); 34440 var sidenavRight = instance._isSidenavRight(); 34441 var width = instance._getSidenavWidth(); 34442 34443 if (closed) { 34444 menu.css('width', width); 34445 34446 if (sidenavRight) { 34447 var positionDirection = options.rtl ? 'left' : 'right'; 34448 34449 menu.css(positionDirection, width); 34450 } 34451 } 34452 else { 34453 instance.showSidenav(); 34454 instance.setHeight(); 34455 } 34456 34457 container.removeClass('sidenav-js-fouc'); 34458 }, 34459 34460 _renderUI: function() { 34461 var instance = this; 34462 var options = instance.options; 34463 34464 var container = $(options.container); 34465 var toggler = instance.toggler; 34466 34467 var mobile = instance.mobile; 34468 var type = mobile ? options.typeMobile : options.type; 34469 34470 if (!instance.useDataAttribute) { 34471 if (mobile) { 34472 container.addClass('closed').removeClass('open'); 34473 toggler.removeClass('active').removeClass('open'); 34474 } 34475 34476 if (options.position === 'right') { 34477 container.addClass('sidenav-right'); 34478 } 34479 34480 if (type !== 'relative') { 34481 container.addClass('sidenav-fixed'); 34482 } 34483 34484 instance._renderNav(); 34485 } 34486 34487 container.css('display', ''); // Force Reflow for IE11 Browser Bug 34488 }, 34489 34490 _setScreenSize: function() { 34491 var instance = this; 34492
34493 var screenSize = getBreakpointRegion(); 34494 34495 var desktop = screenSize === 'sm' || screenSize === 'md' || screenSize === 'lg'; 34496 34497 instance.mobile = !desktop; 34498 instance.desktop = desktop; 34499 34500 return desktop; 34501 } 34502 }; 34503 34504 var old = $.fn.sideNavigation; 34505 34506 var initialize = function(toggler, options, selector) { 34507 var data = toggler.data('lexicon.sidenav'); 34508 34509 if (!data) { 34510 if (!options) { 34511 options = {}; 34512 } 34513 34514 options.selector = selector; 34515 34516 data = new SideNavigation(toggler, options); 34517 34518 toggler.data('lexicon.sidenav', data); 34519 } 34520 34521 return data; 34522 }; 34523 34524 var Plugin = function(options) { 34525 var instance = this; 34526 34527 var selector = instance.selector; 34528 34529 var retVal = instance; 34530 var methodCall = typeof options === 'string'; 34531 var returnInstance = options === 'instance'; 34532 var args = $.makeArray(arguments).slice(1); 34533 34534 if (methodCall) { 34535 this.each( 34536 function() { 34537 var $this = $(this); 34538 34539 var data = $this.data('lexicon.sidenav'); 34540 34541 if (data) { 34542 if (returnInstance) { 34543 retVal = data; 34544 34545 return false; 34546 } 34547 34548 var methodRetVal; 34549 34550 if ($.isFunction(data[options]) && options.indexOf('_') !== 0) { 34551 methodRetVal = data[options].apply(data, args); 34552 } 34553 34554 if (methodRetVal !== data && methodRetVal !== undefined) { 34555 if (methodRetVal.jquery) { 34556 retVal = retVal.pushStack(methodRetVal.get()); 34557 } 34558 else { 34559 retVal = methodRetVal; 34560 } 34561 34562 return false; 34563 } 34564 } 34565 else if (returnInstance) { 34566 retVal = null; 34567 34568 return false; 34569 } 34570 } 34571 ); 34572 } 34573 else { 34574 this.each( 34575 function() { 34576 initialize($(this), options, selector); 34577 } 34578 ); 34579 } 34580 34581 return retVal; 34582 }; 34583 34584 Plugin.noConflict = function() { 34585 $.fn.sideNavigation = old; 34586 34587 return this; 34588 }; 34589 34590 /** 34591 * Plugin options 34592 * @property {String|Number} breakpoint The window width that defines the desktop size. 34593 * @property {String} content The class or ID of the content container. 34594 * @property {String} container The class or ID of the sidenav container. 34595 * @property {String|Number} gutter The space between the sidenav-slider and the sidenav-content. 34596 * @property {String|Boolean} equalHeight The height of content and navigation should be equal. This is deprecated. 34597 * @property {String} heightType Calculates the height of sidenav when type is relative. Possible values: `fullHeight`, `equalHeight` 34598 * @property {String} navigation The class or ID of the navigation container. 34599 * @property {String} position The position of the sidenav-slider. Possible values: left, right 34600 * @property {String} type The type of sidenav in desktop. Possible values: relative, fixed, fixed-push 34601 * @property {String} typeMobile The type of sidenav in mobile. Possible values: relative, fixed, fixed-push 34602 * @property {String|Boolean} useDelegate The type of reference to use on the toggler event handler. Value false, directly binds click to the toggler. 34603 * @property {String|Object} url The URL or $.ajax config object to fetch the content to inject into .sidebar-body 34604 * @property {String|Number} width The width of the side navigation. 34605 */ 34606 34607 Plugin.defaults = { 34608 breakpoint: 768, 34609 content: '.sidenav-content', 34610 equalHeight: true, // equalHeight option is deprecated, use heightType instead 34611 gutter: '15px', 34612 heightType: null, 34613 loadingIndicatorTPL: '<div class="loading-animation loading-animation-md"></div>', 34614 navigation: '.sidenav-menu-slider', 34615 position: 'left', 34616 type: 'relative', 34617 typeMobile: 'relative', 34618 url: null, 34619 useDelegate: true, 34620 width: '225px' 34621 }; 34622 34623 Plugin.Constructor = SideNavigation; 34624 34625 $.fn.sideNavigation = Plugin; 34626 34627 $(function() { 34628 var sidenav = $('[data-toggle="sidenav"]'); 34629 34630 Plugin.call(sidenav); 34631 }); 34632}(jQuery); 34633; 34634 34635(function ($) { 34636 /*! 34637 * jQuery fm Plugin 34638 * version: 0.1 34639 * Copyright (c) 2014 Nate Cavanaugh / Liferay Inc. 34640 * Dual licensed under the MIT and GPL licenses. 34641 */ 34642 $.fn.fm = function (name, value) { 34643 var instance = this; 34644 var retVal = instance; 34645 34646 if (arguments.length === 1) { 34647 var nodes = instance.map(function (index, item) { 34648 var formEl = item.form || item; 34649 34650 if (formEl && $.nodeName(formEl, 'form')) { 34651 var form = $(formEl); 34652 var ns = form.data('fm.namespace') || form.data('fm-namespace') || ''; 34653 var inputName = ns + name; 34654 var inputNode = formEl[inputName] || formEl.ownerDocument.getElementById(inputName); 34655 34656 if (inputNode && !inputNode.nodeName) { 34657 inputNode = $.makeArray(inputNode); 34658 } 34659 34660 return inputNode; 34661 } 34662 }); 34663 retVal = nodes; 34664 } else { 34665 if (typeof name === 'string') { 34666 instance.data('fm.' + name, value); 34667 } 34668 } 34669 34670 return retVal; 34671 }; 34672})(AUI.$); 34673//# sourceMappingURL=fm.js.map 34674/*! 34675 * jQuery Form Plugin 34676 * version: 3.51.0-2014.06.20 34677 * Requires jQuery v1.5 or later 34678 * Copyright (c) 2014 M. Alsup 34679 * Examples and documentation at: http://malsup.com/jquery/form/ 34680 * Project repository: https://github.com/malsup/form 34681 * Dual licensed under the MIT and GPL licenses.
34682 * https://github.com/malsup/form#copyright-and-license 34683 */ 34684/*global ActiveXObject */ 34685 34686(function (factory) { 34687 "use strict"; 34688 factory(window.$ || window.Zepto); 34689} 34690 34691(function($) { 34692"use strict"; 34693 34694/* 34695 Usage Note: 34696 ----------- 34697 Do not use both ajaxSubmit and ajaxForm on the same form. These 34698 functions are mutually exclusive. Use ajaxSubmit if you want 34699 to bind your own submit handler to the form. For example, 34700 34701 $(document).ready(function() { 34702 $('#myForm').on('submit', function(e) { 34703 e.preventDefault(); // <-- important 34704 $(this).ajaxSubmit({ 34705 target: '#output' 34706 }); 34707 }); 34708 }); 34709 34710 Use ajaxForm when you want the plugin to manage all the event binding 34711 for you. For example, 34712 34713 $(document).ready(function() { 34714 $('#myForm').ajaxForm({ 34715 target: '#output' 34716 }); 34717 }); 34718 34719 You can also use ajaxForm with delegation (requires jQuery v1.7+), so the 34720 form does not have to exist when you invoke ajaxForm: 34721 34722 $('#myForm').ajaxForm({ 34723 delegation: true, 34724 target: '#output' 34725 }); 34726 34727 When using ajaxForm, the ajaxSubmit function will be invoked for you 34728 at the appropriate time. 34729*/ 34730 34731/** 34732 * Feature detection 34733 */ 34734var feature = {}; 34735feature.fileapi = $("<input type='file'/>").get(0).files !== undefined; 34736feature.formdata = window.FormData !== undefined; 34737 34738var hasProp = !!$.fn.prop; 34739 34740// attr2 uses prop when it can but checks the return type for 34741// an expected string. this accounts for the case where a form 34742// contains inputs with names like "action" or "method"; in those 34743// cases "prop" returns the element 34744$.fn.attr2 = function() { 34745 if ( ! hasProp ) { 34746 return this.attr.apply(this, arguments); 34747 } 34748 var val = this.prop.apply(this, arguments); 34749 if ( ( val && val.jquery ) || typeof val === 'string' ) { 34750 return val; 34751 } 34752 return this.attr.apply(this, arguments); 34753}; 34754 34755/** 34756 * ajaxSubmit() provides a mechanism for immediately submitting 34757 * an HTML form using AJAX. 34758 */ 34759$.fn.ajaxSubmit = function(options) { 34760 /*jshint scripturl:true */ 34761 34762 // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) 34763 if (!this.length) { 34764 log('ajaxSubmit: skipping submit process - no element selected'); 34765 return this; 34766 } 34767 34768 var method, action, url, $form = this; 34769 34770 if (typeof options == 'function') { 34771 options = { success: options }; 34772 } 34773 else if ( options === undefined ) { 34774 options = {}; 34775 } 34776 34777 method = options.type || this.attr2('method'); 34778 action = options.url || this.attr2('action'); 34779 34780 url = (typeof action === 'string') ? $.trim(action) : ''; 34781 url = url || window.location.href || ''; 34782 if (url) { 34783 // clean url (don't include hash vaue) 34784 url = (url.match(/^([^#]+)/)||[])[1]; 34785 } 34786 34787 options = $.extend(true, { 34788 url: url, 34789 success: $.ajaxSettings.success, 34790 type: method || $.ajaxSettings.type, 34791 iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' 34792 }, options); 34793 34794 // hook for manipulating the form data before it is extracted; 34795 // convenient for use with rich editors like tinyMCE or FCKEditor 34796 var veto = {}; 34797 this.trigger('form-pre-serialize', [this, options, veto]); 34798 if (veto.veto) { 34799 log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); 34800 return this; 34801 } 34802 34803 // provide opportunity to alter form data before it is serialized 34804 if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { 34805 log('ajaxSubmit: submit aborted via beforeSerialize callback'); 34806 return this; 34807 } 34808 34809 var traditional = options.traditional; 34810 if ( traditional === undefined ) { 34811 traditional = $.ajaxSettings.traditional; 34812 } 34813 34814 var elements = []; 34815 var qx, a = this.formToArray(options.semantic, elements); 34816 if (options.data) { 34817 options.extraData = options.data; 34818 qx = $.param(options.data, traditional); 34819 } 34820 34821 // give pre-submit callback an opportunity to abort the submit 34822 if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { 34823 log('ajaxSubmit: submit aborted via beforeSubmit callback'); 34824 return this; 34825 } 34826 34827 // fire vetoable 'validate' event 34828 this.trigger('form-submit-validate', [a, this, options, veto]); 34829 if (veto.veto) { 34830 log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); 34831 return this; 34832 } 34833 34834 var q = $.param(a, traditional); 34835 if (qx) { 34836 q = ( q ? (q + '&' + qx) : qx ); 34837 } 34838 if (options.type.toUpperCase() == 'GET') { 34839 options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; 34840 options.data = null; // data is null for 'get' 34841 } 34842 else { 34843 options.data = q; // data is the query string for 'post' 34844 } 34845 34846 var callbacks = []; 34847 if (options.resetForm) { 34848 callbacks.push(function() { $form.resetForm(); }); 34849 } 34850 if (options.clearForm) { 34851 callbacks.push(function() { $form.clearForm(options.includeHidden); }); 34852 } 34853 34854 // perform a load on the target only if dataType is not provided 34855 if (!options.dataType && options.target) { 34856 var oldSuccess = options.success || function(){}; 34857 callbacks.push(function(data) { 34858 var fn = options.replaceTarget ? 'replaceWith' : 'html'; 34859 34860 // Validate `data` through `HTML encoding` when passed 34861 // `data` is passed to `html()`, as suggested in 34862 // https://github.com/jquery-form/form/issues/464 34863 34864 data = options.replaceTarget 34865 ? data 34866 : $.parseHTML($('<div>').text(data).html()); 34867 34868 $(options.target)[fn](data).each(oldSuccess, arguments); 34869 }); 34870 } 34871 else if (options.success) { 34872 callbacks.push(options.success); 34873 } 34874 34875 options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg 34876 var context = options.context || this ; // jQuery 1.4+ supports scope context 34877 for (var i=0, max=callbacks.length; i < max; i++) { 34878 callbacks[i].apply(context, [data, status, xhr || $form, $form]); 34879 } 34880 }; 34881 34882 if (options.error) { 34883 var oldError = options.error; 34884 options.error = function(xhr, status, error) { 34885 var context = options.context || this; 34886 oldError.apply(context, [xhr, status, error, $form]); 34887 }; 34888 } 34889 34890 if (options.complete) { 34891 var oldComplete = options.complete; 34892 options.complete = function(xhr, status) { 34893 var context = options.context || this; 34894 oldComplete.apply(context, [xhr, status, $form]); 34895 }; 34896 } 34897 34898 // are there files to upload? 34899 34900 // [value] (issue #113), also see comment: 34901 // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219 34902 var fileInputs = $('input[type=file]:enabled', this).filter(function() { return $(this).val() !== ''; }); 34903 34904 var hasFileInputs = fileInputs.length > 0; 34905 var mp = 'multipart/form-data'; 34906 var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp); 34907 34908 var fileAPI = feature.fileapi && feature.formdata; 34909 log("fileAPI :" + fileAPI); 34910 var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI; 34911 34912 var jqxhr; 34913 34914 // options.iframe allows user to force iframe mode 34915 // 06-NOV-09: now defaulting to iframe mode if file input is detected 34916 if (options.iframe !== false && (options.iframe || shouldUseFrame)) { 34917 // hack to fix Safari hang (thanks to Tim Molendijk for this) 34918 // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d 34919 if (options.closeKeepAlive) { 34920 $.get(options.closeKeepAlive, function() { 34921 jqxhr = fileUploadIframe(a); 34922 }); 34923 } 34924 else { 34925 jqxhr = fileUploadIframe(a); 34926 } 34927 } 34928 else if ((hasFileInputs || multipart) && fileAPI) { 34929 jqxhr = fileUploadXhr(a); 34930 } 34931 else { 34932 jqxhr = $.ajax(options); 34933 } 34934 34935 $form.removeData('jqxhr').data('jqxhr', jqxhr); 34936 34937 // clear element array 34938 for (var k=0; k < elements.length; k++) { 34939 elements[k] = null; 34940 } 34941 34942 // fire 'notify' event 34943 this.trigger('form-submit-notify', [this, options]); 34944 return this; 34945 34946 // utility fn for deep serialization 34947 function deepSerialize(extraData){ 34948 var serialized = $.param(extraData, options.traditional).split('&'); 34949 var len = serialized.length; 34950 var result = []; 34951 var i, part; 34952 for (i=0; i < len; i++) { 34953 // #252; undo param space replacement 34954 serialized[i] = serialized[i].replace(/\+/g,' '); 34955 part = serialized[i].split('='); 34956 // #278; use array instead of object storage, favoring array serializations 34957 result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]); 34958 } 34959 return result; 34960 } 34961 34962 // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz) 34963 function fileUploadXhr(a) { 34964 var formdata = new FormData(); 34965 34966 for (var i=0; i < a.length; i++) { 34967 formdata.append(a[i].name, a[i].value); 34968 } 34969 34970 if (options.extraData) { 34971 var serializedData = deepSerialize(options.extraData); 34972 for (i=0; i < serializedData.length; i++) { 34973 if (serializedData[i]) { 34974 formdata.append(serializedData[i][0], serializedData[i][1]); 34975 } 34976 } 34977 } 34978 34979 options.data = null; 34980 34981 var s = $.extend(true, {}, $.ajaxSettings, options, { 34982 contentType: false, 34983 processData: false, 34984 cache: false, 34985 type: method || 'POST' 34986 }); 34987 34988 if (options.uploadProgress) { 34989 // workaround because jqXHR does not expose upload property 34990 s.xhr = function() { 34991 var xhr = $.ajaxSettings.xhr(); 34992 if (xhr.upload) { 34993 xhr.upload.addEventListener('progress', function(event) { 34994 var percent = 0; 34995 var position = event.loaded || event.position; /*event.position is deprecated*/ 34996 var total = event.total; 34997 if (event.lengthComputable) {
34998 percent = Math.ceil(position / total * 100); 34999 } 35000 options.uploadProgress(event, position, total, percent); 35001 }, false); 35002 } 35003 return xhr; 35004 }; 35005 } 35006 35007 s.data = null; 35008 var beforeSend = s.beforeSend; 35009 s.beforeSend = function(xhr, o) { 35010 //Send FormData() provided by user 35011 if (options.formData) { 35012 o.data = options.formData; 35013 } 35014 else { 35015 o.data = formdata; 35016 } 35017 if(beforeSend) { 35018 beforeSend.call(this, xhr, o); 35019 } 35020 }; 35021 return $.ajax(s); 35022 } 35023 35024 // private function for handling file uploads (hat tip to YAHOO!) 35025 function fileUploadIframe(a) { 35026 var form = $form[0], el, i, s, g, id, $io, io, xhr, sub, n, timedOut, timeoutHandle; 35027 var deferred = $.Deferred(); 35028 35029 // #341 35030 deferred.abort = function(status) { 35031 xhr.abort(status); 35032 }; 35033 35034 if (a) { 35035 // ensure that every serialized input is still enabled 35036 for (i=0; i < elements.length; i++) { 35037 el = $(elements[i]); 35038 if ( hasProp ) { 35039 el.prop('disabled', false); 35040 } 35041 else { 35042 el.removeAttr('disabled'); 35043 } 35044 } 35045 } 35046 35047 s = $.extend(true, {}, $.ajaxSettings, options); 35048 s.context = s.context || s; 35049 id = 'jqFormIO' + (new Date().getTime()); 35050 if (s.iframeTarget) { 35051 $io = $(s.iframeTarget); 35052 n = $io.attr2('name'); 35053 if (!n) { 35054 $io.attr2('name', id); 35055 } 35056 else { 35057 id = n; 35058 } 35059 } 35060 else { 35061 $io = $('<iframe name="' + id + '" src="'+ s.iframeSrc +'" />'); 35062 $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' }); 35063 } 35064 io = $io[0]; 35065 35066 35067 xhr = { // mock object 35068 aborted: 0, 35069 responseText: null, 35070 responseXML: null, 35071 status: 0, 35072 statusText: 'n/a', 35073 getAllResponseHeaders: function() {}, 35074 getResponseHeader: function() {}, 35075 setRequestHeader: function() {}, 35076 abort: function(status) { 35077 var e = (status === 'timeout' ? 'timeout' : 'aborted'); 35078 log('aborting upload... ' + e); 35079 this.aborted = 1; 35080 35081 try { // #214, #257 35082 if (io.contentWindow.document.execCommand) { 35083 io.contentWindow.document.execCommand('Stop'); 35084 } 35085 } 35086 catch(ignore) {} 35087 35088 $io.attr('src', s.iframeSrc); // abort op in progress 35089 xhr.error = e; 35090 if (s.error) { 35091 s.error.call(s.context, xhr, e, status); 35092 } 35093 if (g) { 35094 $.event.trigger("ajaxError", [xhr, s, e]); 35095 } 35096 if (s.complete) { 35097 s.complete.call(s.context, xhr, e); 35098 } 35099 } 35100 }; 35101 35102 g = s.global; 35103 // trigger ajax global events so that activity/block indicators work like normal 35104 if (g && 0 === $.active++) { 35105 $.event.trigger("ajaxStart"); 35106 } 35107 if (g) { 35108 $.event.trigger("ajaxSend", [xhr, s]); 35109 } 35110 35111 if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) { 35112 if (s.global) { 35113 $.active--; 35114 } 35115 deferred.reject(); 35116 return deferred; 35117 } 35118 if (xhr.aborted) { 35119 deferred.reject(); 35120 return deferred; 35121 } 35122 35123 // add submitting element to data if we know it 35124 sub = form.clk; 35125 if (sub) { 35126 n = sub.name; 35127 if (n && !sub.disabled) { 35128 s.extraData = s.extraData || {}; 35129 s.extraData[n] = sub.value; 35130 if (sub.type == "image") { 35131 s.extraData[n+'.x'] = form.clk_x; 35132 s.extraData[n+'.y'] = form.clk_y; 35133 } 35134 } 35135 } 35136 35137 var CLIENT_TIMEOUT_ABORT = 1; 35138 var SERVER_ABORT = 2; 35139 35140 function getDoc(frame) { 35141 /* it looks like contentWindow or contentDocument do not 35142 * carry the protocol property in ie8, when running under ssl 35143 * frame.document is the only valid response document, since 35144 * the protocol is know but not on the other two objects. strange? 35145 * "Same origin policy" http://en.wikipedia.org/wiki/Same_origin_policy 35146 */ 35147 35148 var doc = null; 35149 35150 // IE8 cascading access check 35151 try { 35152 if (frame.contentWindow) { 35153 doc = frame.contentWindow.document; 35154 } 35155 } catch(err) { 35156 // IE8 access denied under ssl & missing protocol 35157 log('cannot get iframe.contentWindow document: ' + err); 35158 } 35159 35160 if (doc) { // successful getting content 35161 return doc; 35162 } 35163 35164 try { // simply checking may throw in ie8 under ssl or mismatched protocol 35165 doc = frame.contentDocument ? frame.contentDocument : frame.document; 35166 } catch(err) { 35167 // last attempt 35168 log('cannot get iframe.contentDocument: ' + err); 35169 doc = frame.document; 35170 } 35171 return doc; 35172 } 35173 35174 // Rails CSRF hack (thanks to Yvan Barthelemy) 35175 var csrf_token = $('meta[name=csrf-token]').attr('content'); 35176 var csrf_param = $('meta[name=csrf-param]').attr('content'); 35177 if (csrf_param && csrf_token) { 35178 s.extraData = s.extraData || {}; 35179 s.extraData[csrf_param] = csrf_token; 35180 } 35181 35182 // take a breath so that pending repaints get some cpu time before the upload starts 35183 function doSubmit() { 35184 // make sure form attrs are set 35185 var t = $form.attr2('target'), 35186 a = $form.attr2('action'),
35187 mp = 'multipart/form-data', 35188 et = $form.attr('enctype') || $form.attr('encoding') || mp; 35189 35190 // update form attrs in IE friendly way 35191 form.setAttribute('target',id); 35192 if (!method || /post/i.test(method) ) { 35193 form.setAttribute('method', 'POST'); 35194 } 35195 if (a != s.url) { 35196 form.setAttribute('action', s.url); 35197 } 35198 35199 // ie borks in some cases when setting encoding 35200 if (! s.skipEncodingOverride && (!method || /post/i.test(method))) { 35201 $form.attr({ 35202 encoding: 'multipart/form-data', 35203 enctype: 'multipart/form-data' 35204 }); 35205 } 35206 35207 // support timout 35208 if (s.timeout) { 35209 timeoutHandle = setTimeout(function() { timedOut = true; cb(CLIENT_TIMEOUT_ABORT); }, s.timeout); 35210 } 35211 35212 // look for server aborts 35213 function checkState() { 35214 try { 35215 var state = getDoc(io).readyState; 35216 log('state = ' + state); 35217 if (state && state.toLowerCase() == 'uninitialized') { 35218 setTimeout(checkState,50); 35219 } 35220 } 35221 catch(e) { 35222 log('Server abort: ' , e, ' (', e.name, ')'); 35223 cb(SERVER_ABORT); 35224 if (timeoutHandle) { 35225 clearTimeout(timeoutHandle); 35226 } 35227 timeoutHandle = undefined; 35228 } 35229 } 35230 35231 // add "extra" data to form if provided in options 35232 var extraInputs = []; 35233 try { 35234 if (s.extraData) { 35235 for (var n in s.extraData) { 35236 if (s.extraData.hasOwnProperty(n)) { 35237 // if using the $.param format that allows for multiple values with the same name 35238 if($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) { 35239 extraInputs.push( 35240 $('<input type="hidden" name="'+s.extraData[n].name+'">').val(s.extraData[n].value) 35241 .appendTo(form)[0]); 35242 } else { 35243 extraInputs.push( 35244 $('<input type="hidden" name="'+n+'">').val(s.extraData[n]) 35245 .appendTo(form)[0]); 35246 } 35247 } 35248 } 35249 } 35250 35251 if (!s.iframeTarget) { 35252 // add iframe to doc and submit the form 35253 $io.appendTo('body'); 35254 } 35255 if (io.attachEvent) { 35256 io.attachEvent('onload', cb); 35257 } 35258 else { 35259 io.addEventListener('load', cb, false); 35260 } 35261 setTimeout(checkState,15); 35262 35263 try { 35264 form.submit(); 35265 } catch(err) { 35266 // just in case form has element with name/id of 'submit' 35267 var submitFn = document.createElement('form').submit; 35268 submitFn.apply(form); 35269 } 35270 } 35271 finally { 35272 // reset attrs and remove "extra" input elements 35273 form.setAttribute('action',a); 35274 form.setAttribute('enctype', et); // #380 35275 if(t) { 35276 form.setAttribute('target', t); 35277 } else { 35278 $form.removeAttr('target'); 35279 } 35280 $(extraInputs).remove(); 35281 } 35282 } 35283 35284 if (s.forceSync) { 35285 doSubmit(); 35286 } 35287 else { 35288 setTimeout(doSubmit, 10); // this lets dom updates render 35289 } 35290 35291 var data, doc, domCheckCount = 50, callbackProcessed; 35292 35293 function cb(e) { 35294 if (xhr.aborted || callbackProcessed) { 35295 return; 35296 } 35297 35298 doc = getDoc(io); 35299 if(!doc) { 35300 log('cannot access response document'); 35301 e = SERVER_ABORT; 35302 } 35303 if (e === CLIENT_TIMEOUT_ABORT && xhr) { 35304 xhr.abort('timeout'); 35305 deferred.reject(xhr, 'timeout'); 35306 return; 35307 } 35308 else if (e == SERVER_ABORT && xhr) { 35309 xhr.abort('server abort'); 35310 deferred.reject(xhr, 'error', 'server abort'); 35311 return; 35312 } 35313 35314 if (!doc || doc.location.href == s.iframeSrc) { 35315 // response not received yet 35316 if (!timedOut) { 35317 return; 35318 } 35319 } 35320 if (io.detachEvent) { 35321 io.detachEvent('onload', cb); 35322 } 35323 else { 35324 io.removeEventListener('load', cb, false); 35325 } 35326 35327 var status = 'success', errMsg; 35328 try { 35329 if (timedOut) { 35330 throw 'timeout'; 35331 } 35332 35333 var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc); 35334 log('isXml='+isXml); 35335 if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) { 35336 if (--domCheckCount) { 35337 // in some browsers (Opera) the iframe DOM is not always traversable when 35338 // the onload callback fires, so we loop a bit to accommodate 35339 log('requeing onLoad callback, DOM not available'); 35340 setTimeout(cb, 250); 35341 return; 35342 } 35343 // let this fall through because server response could be an empty document 35344 //log('Could not access iframe DOM after mutiple tries.'); 35345 //throw 'DOMException: not available'; 35346 } 35347 35348 //log('response detected'); 35349 var docRoot = doc.body ? doc.body : doc.documentElement; 35350 xhr.responseText = docRoot ? docRoot.innerHTML : null; 35351 xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc; 35352 if (isXml) { 35353 s.dataType = 'xml'; 35354 } 35355 xhr.getResponseHeader = function(header){ 35356 var headers = {'content-type': s.dataType}; 35357 return headers[header.toLowerCase()]; 35358 }; 35359 // support for XHR 'status' & 'statusText' emulation : 35360 if (docRoot) { 35361 xhr.status = Number( docRoot.getAttribute('status') ) || xhr.status; 35362 xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText; 35363 } 35364 35365 var dt = (s.dataType || '').toLowerCase(); 35366 var scr = /(json|script|text)/.test(dt); 35367 if (scr || s.textarea) { 35368 // see if user embedded response in textarea 35369 var ta = doc.getElementsByTagName('textarea')[0]; 35370 if (ta) { 35371 xhr.responseText = ta.value; 35372 // support for XHR 'status' & 'statusText' emulation : 35373 xhr.status = Number( ta.getAttribute('status') ) || xhr.status; 35374 xhr.statusText = ta.getAttribute('statusText') || xhr.statusText; 35375 } 35376 else if (scr) { 35377 // account for browsers injecting pre around json response 35378 var pre = doc.getElementsByTagName('pre')[0]; 35379 var b = doc.getElementsByTagName('body')[0]; 35380 if (pre) { 35381 xhr.responseText = pre.textContent ? pre.textContent : pre.innerText; 35382 } 35383 else if (b) { 35384 xhr.responseText = b.textContent ? b.textContent : b.innerText; 35385 } 35386 } 35387 } 35388 else if (dt == 'xml' && !xhr.responseXML && xhr.responseText) { 35389 xhr.responseXML = toXml(xhr.responseText); 35390 } 35391 35392 try { 35393 data = httpData(xhr, dt, s); 35394 } 35395 catch (err) { 35396 status = 'parsererror'; 35397 xhr.error = errMsg = (err || status); 35398 } 35399 } 35400 catch (err) { 35401 log('error caught: ',err); 35402 status = 'error'; 35403 xhr.error = errMsg = (err || status); 35404 } 35405 35406 if (xhr.aborted) { 35407 log('upload aborted'); 35408 status = null; 35409 } 35410 35411 if (xhr.status) { // we've set xhr.status 35412 status = (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) ? 'success' : 'error'; 35413 } 35414 35415 // ordering of these callbacks/triggers is odd, but that's how $.ajax does it 35416 if (status === 'success') { 35417 if (s.success) { 35418 s.success.call(s.context, data, 'success', xhr); 35419 } 35420 deferred.resolve(xhr.responseText, 'success', xhr); 35421 if (g) { 35422 $.event.trigger("ajaxSuccess", [xhr, s]); 35423 } 35424 } 35425 else if (status) { 35426 if (errMsg === undefined) { 35427 errMsg = xhr.statusText; 35428 } 35429 if (s.error) { 35430 s.error.call(s.context, xhr, status, errMsg); 35431 } 35432 deferred.reject(xhr, 'error', errMsg); 35433 if (g) { 35434 $.event.trigger("ajaxError", [xhr, s, errMsg]); 35435 } 35436 } 35437 35438 if (g) {
35439 $.event.trigger("ajaxComplete", [xhr, s]); 35440 } 35441 35442 if (g && ! --$.active) { 35443 $.event.trigger("ajaxStop"); 35444 } 35445 35446 if (s.complete) { 35447 s.complete.call(s.context, xhr, status); 35448 } 35449 35450 callbackProcessed = true; 35451 if (s.timeout) { 35452 clearTimeout(timeoutHandle); 35453 } 35454 35455 // clean up 35456 setTimeout(function() { 35457 if (!s.iframeTarget) { 35458 $io.remove(); 35459 } 35460 else { //adding else to clean up existing iframe response. 35461 $io.attr('src', s.iframeSrc); 35462 } 35463 xhr.responseXML = null; 35464 }, 100); 35465 } 35466 35467 var toXml = $.parseXML || function(s, doc) { // use parseXML if available (jQuery 1.5+) 35468 if (window.ActiveXObject) { 35469 doc = new ActiveXObject('Microsoft.XMLDOM'); 35470 doc.async = 'false'; 35471 doc.loadXML(s); 35472 } 35473 else { 35474 doc = (new DOMParser()).parseFromString(s, 'text/xml'); 35475 } 35476 return (doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror') ? doc : null; 35477 }; 35478 var parseJSON = $.parseJSON || function(s) { 35479 // Throw an error instead of making a new function using 35480 // unsanitized inputs to avoid XSS attacks. 35481 35482 window.console.error('jquery.parseJSON is undefined'); 35483 35484 return null; 35485 }; 35486 35487 var httpData = function( xhr, type, s ) { // mostly lifted from jq1.4.4 35488 35489 var ct = xhr.getResponseHeader('content-type') || '', 35490 xml = type === 'xml' || !type && ct.indexOf('xml') >= 0, 35491 data = xml ? xhr.responseXML : xhr.responseText; 35492 35493 if (xml && data.documentElement.nodeName === 'parsererror') { 35494 if ($.error) { 35495 $.error('parsererror'); 35496 } 35497 } 35498 if (s && s.dataFilter) { 35499 data = s.dataFilter(data, type); 35500 } 35501 if (typeof data === 'string') { 35502 if (type === 'json' || !type && ct.indexOf('json') >= 0) { 35503 data = parseJSON(data); 35504 } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) { 35505 $.globalEval(data); 35506 } 35507 } 35508 return data; 35509 }; 35510 35511 return deferred; 35512 } 35513}; 35514 35515/** 35516 * ajaxForm() provides a mechanism for fully automating form submission. 35517 * 35518 * The advantages of using this method instead of ajaxSubmit() are: 35519 * 35520 * 1: This method will include coordinates for <input type="image" /> elements (if the element 35521 * is used to submit the form). 35522 * 2. This method will include the submit element's name/value data (for the element that was 35523 * used to submit the form). 35524 * 3. This method binds the submit() method to the form for you. 35525 * 35526 * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely 35527 * passes the options argument along after properly binding events for submit elements and 35528 * the form itself. 35529 */ 35530$.fn.ajaxForm = function(options) { 35531 options = options || {}; 35532 options.delegation = options.delegation && $.isFunction($.fn.on); 35533 35534 // in jQuery 1.3+ we can fix mistakes with the ready state 35535 if (!options.delegation && this.length === 0) { 35536 var o = { s: this.selector, c: this.context }; 35537 if (!$.isReady && o.s) { 35538 log('DOM not ready, queuing ajaxForm'); 35539 $(function() { 35540 $(o.s,o.c).ajaxForm(options); 35541 }); 35542 return this; 35543 } 35544 // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready() 35545 log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)')); 35546 return this; 35547 } 35548 35549 if ( options.delegation ) { 35550 $(document) 35551 .off('submit.form-plugin', this.selector, doAjaxSubmit) 35552 .off('click.form-plugin', this.selector, captureSubmittingElement) 35553 .on('submit.form-plugin', this.selector, options, doAjaxSubmit) 35554 .on('click.form-plugin', this.selector, options, captureSubmittingElement); 35555 return this; 35556 } 35557 35558 return this.ajaxFormUnbind() 35559 .bind('submit.form-plugin', options, doAjaxSubmit) 35560 .bind('click.form-plugin', options, captureSubmittingElement); 35561}; 35562 35563// private event handlers 35564function doAjaxSubmit(e) { 35565 /*jshint validthis:true */ 35566 var options = e.data; 35567 if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed 35568 e.preventDefault(); 35569 $(e.target).ajaxSubmit(options); // #365 35570 } 35571} 35572 35573function captureSubmittingElement(e) { 35574 /*jshint validthis:true */ 35575 var target = e.target; 35576 var $el = $(target); 35577 if (!($el.is("[type=submit],[type=image]"))) { 35578 // is this a child element of the submit el? (ex: a span within a button) 35579 var t = $el.closest('[type=submit]'); 35580 if (t.length === 0) { 35581 return; 35582 } 35583 target = t[0]; 35584 } 35585 var form = this; 35586 form.clk = target; 35587 if (target.type == 'image') { 35588 if (e.offsetX !== undefined) { 35589 form.clk_x = e.offsetX; 35590 form.clk_y = e.offsetY; 35591 } else if (typeof $.fn.offset == 'function') { 35592 var offset = $el.offset(); 35593 form.clk_x = e.pageX - offset.left; 35594 form.clk_y = e.pageY - offset.top; 35595 } else { 35596 form.clk_x = e.pageX - target.offsetLeft; 35597 form.clk_y = e.pageY - target.offsetTop; 35598 } 35599 } 35600 // clear form vars 35601 setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100); 35602} 35603 35604 35605// ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm 35606$.fn.ajaxFormUnbind = function() { 35607 return this.unbind('submit.form-plugin click.form-plugin'); 35608}; 35609 35610/** 35611 * formToArray() gathers form element data into an array of objects that can 35612 * be passed to any of the following ajax functions: $.get, $.post, or load. 35613 * Each object in the array has both a 'name' and 'value' property. An example of 35614 * an array for a simple login form might be: 35615 * 35616 * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ] 35617 * 35618 * It is this array that is passed to pre-submit callback functions provided to the 35619 * ajaxSubmit() and ajaxForm() methods. 35620 */ 35621$.fn.formToArray = function(semantic, elements) { 35622 var a = []; 35623 if (this.length === 0) { 35624 return a; 35625 } 35626 35627 var form = this[0]; 35628 var formId = this.attr('id'); 35629 var els = semantic ? form.getElementsByTagName('*') : form.elements; 35630 var els2; 35631 35632 if (els && !/MSIE [678]/.test(navigator.userAgent)) { // #390 35633 els = $(els).get(); // convert to standard array 35634 } 35635 35636 // #386; account for inputs outside the form which use the 'form' attribute 35637 if ( formId ) { 35638 els2 = $(':input[form="' + formId + '"]').get(); // hat tip @thet 35639 if ( els2.length ) { 35640 els = (els || []).concat(els2); 35641 } 35642 } 35643 35644 if (!els || !els.length) { 35645 return a; 35646 } 35647 35648 var i,j,n,v,el,max,jmax; 35649 for(i=0, max=els.length; i < max; i++) { 35650 el = els[i]; 35651 n = el.name; 35652 if (!n || el.disabled) { 35653 continue; 35654 } 35655 35656 if (semantic && form.clk && el.type == "image") { 35657 // handle image inputs on the fly when semantic == true 35658 if(form.clk == el) { 35659 a.push({name: n, value: $(el).val(), type: el.type }); 35660 a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); 35661 } 35662 continue; 35663 } 35664 35665 v = $.fieldValue(el, true); 35666 if (v && v.constructor == Array) { 35667 if (elements) { 35668 elements.push(el); 35669 } 35670 for(j=0, jmax=v.length; j < jmax; j++) { 35671 a.push({name: n, value: v[j]}); 35672 } 35673 } 35674 else if (feature.fileapi && el.type == 'file') { 35675 if (elements) { 35676 elements.push(el); 35677 } 35678 var files = el.files; 35679 if (files.length) { 35680 for (j=0; j < files.length; j++) { 35681 a.push({name: n, value: files[j], type: el.type}); 35682 } 35683 } 35684 else { 35685 // #180 35686 a.push({ name: n, value: '', type: el.type }); 35687 } 35688 } 35689 else if (v !== null && typeof v != 'undefined') { 35690 if (elements) { 35691 elements.push(el); 35692 } 35693 a.push({name: n, value: v, type: el.type, required: el.required}); 35694 } 35695 } 35696 35697 if (!semantic && form.clk) { 35698 // input type=='image' are not found in elements array! handle it here 35699 var $input = $(form.clk), input = $input[0]; 35700 n = input.name; 35701 if (n && !input.disabled && input.type == 'image') { 35702 a.push({name: n, value: $input.val()}); 35703 a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y}); 35704 } 35705 } 35706 return a; 35707}; 35708 35709/** 35710 * Serializes form data into a 'submittable' string. This method will return a string 35711 * in the format: name1=value1&name2=value2 35712 */
35713$.fn.formSerialize = function(semantic) { 35714 //hand off to jQuery.param for proper encoding 35715 return $.param(this.formToArray(semantic)); 35716}; 35717 35718/** 35719 * Serializes all field elements in the jQuery object into a query string. 35720 * This method will return a string in the format: name1=value1&name2=value2 35721 */ 35722$.fn.fieldSerialize = function(successful) { 35723 var a = []; 35724 this.each(function() { 35725 var n = this.name; 35726 if (!n) { 35727 return; 35728 } 35729 var v = $.fieldValue(this, successful); 35730 if (v && v.constructor == Array) { 35731 for (var i=0,max=v.length; i < max; i++) { 35732 a.push({name: n, value: v[i]}); 35733 } 35734 } 35735 else if (v !== null && typeof v != 'undefined') { 35736 a.push({name: this.name, value: v}); 35737 } 35738 }); 35739 //hand off to jQuery.param for proper encoding 35740 return $.param(a); 35741}; 35742 35743/** 35744 * Returns the value(s) of the element in the matched set. For example, consider the following form: 35745 * 35746 * <form><fieldset> 35747 * <input name="A" type="text" /> 35748 * <input name="A" type="text" /> 35749 * <input name="B" type="checkbox" value="B1" /> 35750 * <input name="B" type="checkbox" value="B2"/> 35751 * <input name="C" type="radio" value="C1" /> 35752 * <input name="C" type="radio" value="C2" /> 35753 * </fieldset></form> 35754 * 35755 * var v = $('input[type=text]').fieldValue(); 35756 * // if no values are entered into the text inputs 35757 * v == ['',''] 35758 * // if values entered into the text inputs are 'foo' and 'bar' 35759 * v == ['foo','bar'] 35760 * 35761 * var v = $('input[type=checkbox]').fieldValue(); 35762 * // if neither checkbox is checked 35763 * v === undefined 35764 * // if both checkboxes are checked 35765 * v == ['B1', 'B2'] 35766 * 35767 * var v = $('input[type=radio]').fieldValue(); 35768 * // if neither radio is checked 35769 * v === undefined 35770 * // if first radio is checked 35771 * v == ['C1'] 35772 * 35773 * The successful argument controls whether or not the field element must be 'successful' 35774 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls). 35775 * The default value of the successful argument is true. If this value is false the value(s) 35776 * for each element is returned. 35777 * 35778 * Note: This method *always* returns an array. If no valid value can be determined the 35779 * array will be empty, otherwise it will contain one or more values. 35780 */ 35781$.fn.fieldValue = function(successful) { 35782 for (var val=[], i=0, max=this.length; i < max; i++) { 35783 var el = this[i]; 35784 var v = $.fieldValue(el, successful); 35785 if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) { 35786 continue; 35787 } 35788 if (v.constructor == Array) { 35789 $.merge(val, v); 35790 } 35791 else { 35792 val.push(v); 35793 } 35794 } 35795 return val; 35796}; 35797 35798/** 35799 * Returns the value of the field element. 35800 */ 35801$.fieldValue = function(el, successful) { 35802 var n = el.name, t = el.type, tag = el.tagName.toLowerCase(); 35803 if (successful === undefined) { 35804 successful = true; 35805 } 35806 35807 if (successful && (!n || el.disabled || t == 'reset' || t == 'button' || 35808 (t == 'checkbox' || t == 'radio') && !el.checked || 35809 (t == 'submit' || t == 'image') && el.form && el.form.clk != el || 35810 tag == 'select' && el.selectedIndex == -1)) { 35811 return null; 35812 } 35813 35814 if (tag == 'select') { 35815 var index = el.selectedIndex; 35816 if (index < 0) { 35817 return null; 35818 } 35819 var a = [], ops = el.options; 35820 var one = (t == 'select-one'); 35821 var max = (one ? index+1 : ops.length); 35822 for(var i=(one ? index : 0); i < max; i++) { 35823 var op = ops[i]; 35824 if (op.selected) { 35825 var v = op.value; 35826 if (!v) { // extra pain for IE... 35827 v = (op.attributes && op.attributes.value && !(op.attributes.value.specified)) ? op.text : op.value; 35828 } 35829 if (one) { 35830 return v; 35831 } 35832 a.push(v); 35833 } 35834 } 35835 return a; 35836 } 35837 return $(el).val(); 35838}; 35839 35840/** 35841 * Clears the form data. Takes the following actions on the form's input fields: 35842 * - input text fields will have their 'value' property set to the empty string 35843 * - select elements will have their 'selectedIndex' property set to -1 35844 * - checkbox and radio inputs will have their 'checked' property set to false 35845 * - inputs of type submit, button, reset, and hidden will *not* be effected 35846 * - button elements will *not* be effected 35847 */ 35848$.fn.clearForm = function(includeHidden) { 35849 return this.each(function() { 35850 $('input,select,textarea', this).clearFields(includeHidden); 35851 }); 35852}; 35853 35854/** 35855 * Clears the selected form elements. 35856 */ 35857$.fn.clearFields = $.fn.clearInputs = function(includeHidden) { 35858 var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list 35859 return this.each(function() { 35860 var t = this.type, tag = this.tagName.toLowerCase(); 35861 if (re.test(t) || tag == 'textarea') { 35862 this.value = ''; 35863 } 35864 else if (t == 'checkbox' || t == 'radio') { 35865 this.checked = false;
35866 } 35867 else if (tag == 'select') { 35868 this.selectedIndex = -1; 35869 } 35870 else if (t == "file") { 35871 if (/MSIE/.test(navigator.userAgent)) { 35872 $(this).replaceWith($(this).clone(true)); 35873 } else { 35874 $(this).val(''); 35875 } 35876 } 35877 else if (includeHidden) { 35878 // includeHidden can be the value true, or it can be a selector string 35879 // indicating a special test; for example: 35880 // $('#myForm').clearForm('.special:hidden') 35881 // the above would clean hidden inputs that have the class of 'special' 35882 if ( (includeHidden === true && /hidden/.test(t)) || 35883 (typeof includeHidden == 'string' && $(this).is(includeHidden)) ) { 35884 this.value = ''; 35885 } 35886 } 35887 }); 35888}; 35889 35890/** 35891 * Resets the form data. Causes all form elements to be reset to their original value. 35892 */ 35893$.fn.resetForm = function() { 35894 return this.each(function() { 35895 // guard against an input with the name of 'reset' 35896 // note that IE reports the reset function as an 'object' 35897 if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) { 35898 this.reset(); 35899 } 35900 }); 35901}; 35902 35903/** 35904 * Enables or disables any matching elements. 35905 */ 35906$.fn.enable = function(b) { 35907 if (b === undefined) { 35908 b = true; 35909 } 35910 return this.each(function() { 35911 this.disabled = !b; 35912 }); 35913}; 35914 35915/** 35916 * Checks/unchecks any matching checkboxes or radio buttons and 35917 * selects/deselects and matching option elements. 35918 */ 35919$.fn.selected = function(select) { 35920 if (select === undefined) { 35921 select = true; 35922 } 35923 return this.each(function() { 35924 var t = this.type; 35925 if (t == 'checkbox' || t == 'radio') { 35926 this.checked = select; 35927 } 35928 else if (this.tagName.toLowerCase() == 'option') { 35929 var $sel = $(this).parent('select'); 35930 if (select && $sel[0] && $sel[0].type == 'select-one') { 35931 // deselect all other options 35932 $sel.find('option').selected(false); 35933 } 35934 this.selected = select; 35935 } 35936 }); 35937}; 35938 35939// expose debug var 35940$.fn.ajaxSubmit.debug = false; 35941 35942// helper fn for console logging 35943function log() { 35944 if (!$.fn.ajaxSubmit.debug) { 35945 return; 35946 } 35947 var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,''); 35948 if (window.console && window.console.log) { 35949 window.console.log(msg); 35950 } 35951 else if (window.opera && window.opera.postError) { 35952 window.opera.postError(msg); 35953 } 35954} 35955 35956})); 35957 35958!function(root, factory) { 35959 false && "function" == typeof define && define.amd ? // AMD. Register as an anonymous module unless amdModuleId is set 35960 define([], function() { 35961 return root.svg4everybody = factory(); 35962 }) : "object" == typeof module && module.exports ? // Node. Does not work with strict CommonJS, but 35963 // only CommonJS-like environments that support module.exports, 35964 // like Node. 35965 module.exports = factory() : root.svg4everybody = factory(); 35966}(this, function() { 35967 /*! svg4everybody v2.1.9 | github.com/jonathantneal/svg4everybody */ 35968 function embed(parent, svg, target) { 35969 // if the target exists 35970 if (target) { 35971 // create a document fragment to hold the contents of the target 35972 var fragment = document.createDocumentFragment(), viewBox = !svg.hasAttribute("viewBox") && target.getAttribute("viewBox"); 35973 // conditionally set the viewBox on the svg
vendor: 6,309 bytes, lines 35974-36104
35974 viewBox && svg.setAttribute("viewBox", viewBox); 35975 // copy the contents of the clone into the fragment 35976 for (// clone the target 35977 var clone = target.cloneNode(!0); clone.childNodes.length; ) { 35978 fragment.appendChild(clone.firstChild); 35979 } 35980 // append the fragment into the svg 35981 parent.appendChild(fragment); 35982 } 35983 } 35984 function loadreadystatechange(xhr) { 35985 // listen to changes in the request 35986 xhr.onreadystatechange = function() { 35987 // if the request is ready 35988 if (4 === xhr.readyState) { 35989 // get the cached html document 35990 var cachedDocument = xhr._cachedDocument; 35991 // ensure the cached html document based on the xhr response 35992 cachedDocument || (cachedDocument = xhr._cachedDocument = document.implementation.createHTMLDocument(""), 35993 cachedDocument.body.innerHTML = xhr.responseText, xhr._cachedTarget = {}), // clear the xhr embeds list and embed each item 35994 xhr._embeds.splice(0).map(function(item) { 35995 // get the cached target 35996 var target = xhr._cachedTarget[item.id]; 35997 // ensure the cached target 35998 target || (target = xhr._cachedTarget[item.id] = cachedDocument.getElementById(item.id)), 35999 // embed the target into the svg 36000 embed(item.parent, item.svg, target); 36001 }); 36002 } 36003 }, // test the ready state change immediately 36004 xhr.onreadystatechange(); 36005 } 36006 function svg4everybody(rawopts) { 36007 function oninterval() { 36008 // while the index exists in the live <use> collection 36009 for (// get the cached <use> index 36010 var index = 0; index < uses.length; ) { 36011 // get the current <use> 36012 var use = uses[index], parent = use.parentNode, svg = getSVGAncestor(parent), src = use.getAttribute("xlink:href") || use.getAttribute("href"); 36013 if (!src && opts.attributeName && (src = use.getAttribute(opts.attributeName)), 36014 svg && src) { 36015 if (polyfill) { 36016 if (!opts.validate || opts.validate(src, svg, use)) { 36017 // remove the <use> element 36018 parent.removeChild(use); 36019 // parse the src and get the url and id 36020 var srcSplit = src.split("#"), url = srcSplit.shift(), id = srcSplit.join("#"); 36021 // if the link is external 36022 if (url.length) { 36023 // get the cached xhr request 36024 var xhr = requests[url]; 36025 // ensure the xhr request exists 36026 xhr || (xhr = requests[url] = new XMLHttpRequest(), xhr.open("GET", url), xhr.send(), 36027 xhr._embeds = []), // add the svg and id as an item to the xhr embeds list 36028 xhr._embeds.push({ 36029 parent: parent, 36030 svg: svg, 36031 id: id 36032 }), // prepare the xhr ready state change event 36033 loadreadystatechange(xhr); 36034 } else { 36035 // embed the local id into the svg 36036 embed(parent, svg, document.getElementById(id)); 36037 } 36038 } else { 36039 // increase the index when the previous value was not "valid" 36040 ++index, ++numberOfSvgUseElementsToBypass; 36041 } 36042 } 36043 } else { 36044 // increase the index when the previous value was not "valid" 36045 ++index; 36046 } 36047 } 36048 // continue the interval 36049 (!uses.length || uses.length - numberOfSvgUseElementsToBypass > 0) && requestAnimationFrame(oninterval, 67); 36050 } 36051 var polyfill, opts = Object(rawopts), newerIEUA = /\bTrident\/[567]\b|\bMSIE (?:9|10)\.0\b/, webkitUA = /\bAppleWebKit\/(\d+)\b/, olderEdgeUA = /\bEdge\/12\.(\d+)\b/, edgeUA = /\bEdge\/.(\d+)\b/, inIframe = window.top !== window.self; 36052 polyfill = "polyfill" in opts ? opts.polyfill : newerIEUA.test(navigator.userAgent) || (navigator.userAgent.match(olderEdgeUA) || [])[1] < 10547 || (navigator.userAgent.match(webkitUA) || [])[1] < 537 || edgeUA.test(navigator.userAgent) && inIframe; 36053 // create xhr requests object 36054 var requests = {}, requestAnimationFrame = window.requestAnimationFrame || setTimeout, uses = document.getElementsByTagName("use"), numberOfSvgUseElementsToBypass = 0; 36055 // conditionally start the interval if the polyfill is active 36056 polyfill && oninterval(); 36057 } 36058 function getSVGAncestor(node) { 36059 for (var svg = node; "svg" !== svg.nodeName.toLowerCase() && (svg = svg.parentNode); ) {} 36060 return svg; 36061 } 36062 return svg4everybody; 36063}); 36064YUI.add('arraylist-add', function (Y, NAME) { 36065 36066/** 36067 * Collection utilities beyond what is provided in the YUI core 36068 * @module collection 36069 * @submodule arraylist-add 36070 * @deprecated Use ModelList or a custom ArrayList subclass 36071 */ 36072 36073/* 36074 * Adds methods add and remove to Y.ArrayList 36075 */ 36076Y.mix(Y.ArrayList.prototype, { 36077 36078 /** 36079 * Add a single item to the ArrayList. Does not prevent duplicates. 36080 * 36081 * @method add 36082 * @param { mixed } item Item presumably of the same type as others in the 36083 * ArrayList. 36084 * @param {Number} index (Optional.) Number representing the position at 36085 * which the item should be inserted. 36086 * @return {ArrayList} the instance. 36087 * @for ArrayList 36088 * @deprecated Use ModelList or a custom ArrayList subclass 36089 * @chainable 36090 */ 36091 add: function(item, index) { 36092 var items = this._items; 36093 36094 if (Y.Lang.isNumber(index)) { 36095 items.splice(index, 0, item); 36096 } 36097 else { 36098 items.push(item); 36099 } 36100 36101 return this; 36102 }, 36103 36104 /**
36105 * Removes first or all occurrences of an item to the ArrayList. If a 36106 * comparator is not provided, uses itemsAreEqual method to determine 36107 * matches. 36108 * 36109 * @method remove 36110 * @param { mixed } needle Item to find and remove from the list. 36111 * @param { Boolean } all If true, remove all occurrences. 36112 * @param { Function } comparator optional a/b function to test equivalence. 36113 * @return {ArrayList} the instance. 36114 * @for ArrayList 36115 * @deprecated Use ModelList or a custom ArrayList subclass 36116 * @chainable 36117 */ 36118 remove: function(needle, all, comparator) { 36119 comparator = comparator || this.itemsAreEqual; 36120 36121 for (var i = this._items.length - 1; i >= 0; --i) { 36122 if (comparator.call(this, needle, this.item(i))) { 36123 this._items.splice(i, 1); 36124 if (!all) { 36125 break; 36126 } 36127 } 36128 } 36129 36130 return this; 36131 }, 36132 36133 /** 36134 * Default comparator for items stored in this list. Used by remove(). 36135 * 36136 * @method itemsAreEqual 36137 * @param { mixed } a item to test equivalence with. 36138 * @param { mixed } b other item to test equivalance. 36139 * @return { Boolean } true if items are deemed equivalent. 36140 * @for ArrayList 36141 * @deprecated Use ModelList or a custom ArrayList subclass 36142 */ 36143 itemsAreEqual: function(a, b) { 36144 return a === b; 36145 } 36146 36147}); 36148 36149 36150}, 'patched-v3.18.3', {"requires": ["arraylist"]}); 36151 36152YUI.add('arraylist-filter', function (Y, NAME) { 36153 36154/** 36155 * Collection utilities beyond what is provided in the YUI core 36156 * @module collection 36157 * @submodule arraylist-filter 36158 * @deprecated Use ModelList or a custom subclass implementation 36159 */ 36160 36161/* 36162 * Adds filter method to ArrayList prototype 36163 */ 36164Y.mix(Y.ArrayList.prototype, { 36165 36166 /** 36167 * <p>Create a new ArrayList (or augmenting class instance) from a subset 36168 * of items as determined by the boolean function passed as the 36169 * argument. The original ArrayList is unchanged.</p> 36170 * 36171 * <p>The validator signature is <code>validator( item )</code>.</p> 36172 * 36173 * @method filter 36174 * @param { Function } validator Boolean function to determine in or out. 36175 * @return { ArrayList } New instance based on who passed the validator. 36176 * @for ArrayList 36177 * @deprecated Use ModelList or a custom subclass implementation 36178 */ 36179 filter: function(validator) { 36180 var items = []; 36181 36182 Y.Array.each(this._items, function(item, i) { 36183 item = this.item(i); 36184 36185 if (validator(item)) { 36186 items.push(item); 36187 } 36188 }, this); 36189 36190 return new this.constructor(items); 36191 } 36192 36193}); 36194 36195 36196}, 'patched-v3.18.3', {"requires": ["arraylist"]}); 36197 36198YUI.add('arraylist', function (Y, NAME) { 36199 36200/** 36201 * Collection utilities beyond what is provided in the YUI core 36202 * @module collection 36203 * @submodule arraylist 36204 */ 36205 36206var YArray = Y.Array, 36207 YArray_each = YArray.each, 36208 ArrayListProto; 36209 36210/** 36211 * Generic ArrayList class for managing lists of items and iterating operations 36212 * over them. The targeted use for this class is for augmentation onto a 36213 * class that is responsible for managing multiple instances of another class 36214 * (e.g. NodeList for Nodes). The recommended use is to augment your class with 36215 * ArrayList, then use ArrayList.addMethod to mirror the API of the constituent 36216 * items on the list's API. 36217 * 36218 * The default implementation creates immutable lists, but mutability can be 36219 * provided via the arraylist-add submodule or by implementing mutation methods 36220 * directly on the augmented class's prototype. 36221 * 36222 * @class ArrayList 36223 * @constructor 36224 * @param items { Array } array of items this list will be responsible for 36225 */ 36226function ArrayList( items ) { 36227 if ( items !== undefined ) { 36228 this._items = Y.Lang.isArray( items ) ? items : YArray( items ); 36229 } else { 36230 // ||= to support lazy initialization from augment 36231 this._items = this._items || []; 36232 } 36233} 36234 36235ArrayListProto = { 36236 /** 36237 * Get an item by index from the list. Override this method if managing a 36238 * list of objects that have a different public representation (e.g. Node 36239 * instances vs DOM nodes). The iteration methods that accept a user 36240 * function will use this method for access list items for operation. 36241 * 36242 * @method item 36243 * @param i { Integer } index to fetch 36244 * @return { mixed } the item at the requested index 36245 */ 36246 item: function ( i ) { 36247 return this._items[i]; 36248 }, 36249 36250 /** 36251 * <p>Execute a function on each item of the list, optionally providing a 36252 * custom execution context. Default context is the item.</p> 36253 * 36254 * <p>The callback signature is <code>callback( item, index )</code>.</p> 36255 * 36256 * @method each 36257 * @param fn { Function } the function to execute 36258 * @param context { mixed } optional override 'this' in the function 36259 * @return { ArrayList } this instance 36260 * @chainable 36261 */ 36262 each: function ( fn, context ) { 36263 YArray_each( this._items, function ( item, i ) { 36264 item = this.item( i ); 36265 36266 fn.call( context || item, item, i, this ); 36267 }, this); 36268 36269 return this; 36270 }, 36271 36272 /** 36273 * <p>Execute a function on each item of the list, optionally providing a 36274 * custom execution context. Default context is the item.</p> 36275 * 36276 * <p>The callback signature is <code>callback( item, index )</code>.</p> 36277 * 36278 * <p>Unlike <code>each</code>, if the callback returns true, the 36279 * iteration will stop.</p> 36280 * 36281 * @method some 36282 * @param fn { Function } the function to execute 36283 * @param context { mixed } optional override 'this' in the function 36284 * @return { Boolean } True if the function returned true on an item 36285 */ 36286 some: function ( fn, context ) { 36287 return YArray.some( this._items, function ( item, i ) { 36288 item = this.item( i ); 36289
36290 return fn.call( context || item, item, i, this ); 36291 }, this); 36292 }, 36293 36294 /** 36295 * Finds the first index of the needle in the managed array of items. 36296 * 36297 * @method indexOf 36298 * @param needle { mixed } The item to search for 36299 * @return { Integer } Array index if found. Otherwise -1 36300 */ 36301 indexOf: function ( needle ) { 36302 return YArray.indexOf( this._items, needle ); 36303 }, 36304 36305 /** 36306 * How many items are in this list? 36307 * 36308 * @method size 36309 * @return { Integer } Number of items in the list 36310 */ 36311 size: function () { 36312 return this._items.length; 36313 }, 36314 36315 /** 36316 * Is this instance managing any items? 36317 * 36318 * @method isEmpty 36319 * @return { Boolean } true if 1 or more items are being managed 36320 */ 36321 isEmpty: function () { 36322 return !this.size(); 36323 }, 36324 36325 /** 36326 * Provides an array-like representation for JSON.stringify. 36327 * 36328 * @method toJSON 36329 * @return { Array } an array representation of the ArrayList 36330 */ 36331 toJSON: function () { 36332 return this._items; 36333 } 36334}; 36335// Default implementation does not distinguish between public and private 36336// item getter 36337/** 36338 * Protected method for optimizations that may be appropriate for API 36339 * mirroring. Similar in functionality to <code>item</code>, but is used by 36340 * methods added with <code>ArrayList.addMethod()</code>. 36341 * 36342 * @method _item 36343 * @protected 36344 * @param i { Integer } Index of item to fetch 36345 * @return { mixed } The item appropriate for pass through API methods 36346 */ 36347ArrayListProto._item = ArrayListProto.item; 36348 36349// Mixed onto existing proto to preserve constructor NOT being an own property. 36350// This has bitten me when composing classes by enumerating, copying prototypes. 36351Y.mix(ArrayList.prototype, ArrayListProto); 36352 36353Y.mix( ArrayList, { 36354 36355 /** 36356 * <p>Adds a pass through method to dest (typically the prototype of a list 36357 * class) that calls the named method on each item in the list with 36358 * whatever parameters are passed in. Allows for API indirection via list 36359 * instances.</p> 36360 * 36361 * <p>Accepts a single string name or an array of string names.</p> 36362 * 36363 * <pre><code>list.each( function ( item ) { 36364 * item.methodName( 1, 2, 3 ); 36365 * } ); 36366 * // becomes 36367 * list.methodName( 1, 2, 3 );</code></pre> 36368 * 36369 * <p>Additionally, the pass through methods use the item retrieved by the 36370 * <code>_item</code> method in case there is any special behavior that is 36371 * appropriate for API mirroring.</p> 36372 * 36373 * <p>If the iterated method returns a value, the return value from the 36374 * added method will be an array of values with each value being at the 36375 * corresponding index for that item. If the iterated method does not 36376 * return a value, the added method will be chainable. 36377 * 36378 * @method addMethod 36379 * @static 36380 * @param dest {Object} Object or prototype to receive the iterator method 36381 * @param name {String|String[]} Name of method of methods to create 36382 */ 36383 addMethod: function ( dest, names ) { 36384 36385 names = YArray( names ); 36386 36387 YArray_each( names, function ( name ) { 36388 dest[ name ] = function () { 36389 var args = YArray( arguments, 0, true ), 36390 ret = []; 36391 36392 YArray_each( this._items, function ( item, i ) { 36393 item = this._item( i ); 36394 36395 var result = item[ name ].apply( item, args ); 36396 36397 if ( result !== undefined && result !== item ) { 36398 ret[i] = result; 36399 } 36400 }, this); 36401 36402 return ret.length ? ret : this; 36403 }; 36404 } ); 36405 } 36406} ); 36407 36408Y.ArrayList = ArrayList; 36409 36410 36411}, 'patched-v3.18.3', {"requires": ["yui-base"]}); 36412 36413YUI.add('array-extras', function (Y, NAME) { 36414 36415/** 36416Adds additional utility methods to the `Y.Array` class. 36417 36418@module collection 36419@submodule array-extras 36420**/ 36421 36422var A = Y.Array, 36423 L = Y.Lang, 36424 ArrayProto = Array.prototype; 36425 36426/** 36427Returns the index of the last item in the array that contains the specified 36428value, or `-1` if the value isn't found. 36429 36430@method lastIndexOf 36431@param {Array} a Array to search in. 36432@param {Any} val Value to search for. 36433@param {Number} [fromIndex] Index at which to start searching backwards. 36434 Defaults to the array's length - 1. If negative, it will be taken as an offset 36435 from the end of the array. If the calculated index is less than 0, the array 36436 will not be searched and `-1` will be returned. 36437@return {Number} Index of the item that contains the value, or `-1` if not 36438 found. 36439@static 36440@for Array 36441**/ 36442A.lastIndexOf = L._isNative(ArrayProto.lastIndexOf) ? 36443 function(a, val, fromIndex) {
36444 // An undefined fromIndex is still considered a value by some (all?) 36445 // native implementations, so we can't pass it unless it's actually 36446 // specified. 36447 return fromIndex || fromIndex === 0 ? a.lastIndexOf(val, fromIndex) : 36448 a.lastIndexOf(val); 36449 } : 36450 function(a, val, fromIndex) { 36451 var len = a.length, 36452 i = len - 1; 36453 36454 if (fromIndex || fromIndex === 0) { 36455 i = Math.min(fromIndex < 0 ? len + fromIndex : fromIndex, len); 36456 } 36457 36458 if (i > -1 && len > 0) { 36459 for (; i > -1; --i) { 36460 if (i in a && a[i] === val) { 36461 return i; 36462 } 36463 } 36464 } 36465 36466 return -1; 36467 }; 36468 36469/** 36470Returns a copy of the input array with duplicate items removed. 36471 36472Note: If the input array only contains strings, the `Y.Array.dedupe()` method is 36473a much faster alternative. 36474 36475@method unique 36476@param {Array} array Array to dedupe. 36477@param {Function} [testFn] Custom function to use to test the equality of two 36478 values. A truthy return value indicates that the values are equal. A falsy 36479 return value indicates that the values are not equal. 36480 36481 @param {Any} testFn.a First value to compare. 36482 @param {Any} testFn.b Second value to compare. 36483 @param {Number} testFn.index Index of the current item in the original 36484 array. 36485 @param {Array} testFn.array The original array. 36486 @return {Boolean} _true_ if the items are equal, _false_ otherwise. 36487 36488@return {Array} Copy of the input array with duplicate items removed. 36489@static 36490**/ 36491A.unique = function (array, testFn) { 36492 var i = 0, 36493 len = array.length, 36494 results = [], 36495 j, result, resultLen, value; 36496 36497 // Note the label here. It's used to jump out of the inner loop when a value 36498 // is not unique. 36499 outerLoop: for (; i < len; i++) { 36500 value = array[i]; 36501 36502 // For each value in the input array, iterate through the result array 36503 // and check for uniqueness against each result value. 36504 for (j = 0, resultLen = results.length; j < resultLen; j++) { 36505 result = results[j]; 36506 36507 // If the test function returns true or there's no test function and 36508 // the value equals the current result item, stop iterating over the 36509 // results and continue to the next value in the input array. 36510 if (testFn) { 36511 if (testFn.call(array, value, result, i, array)) { 36512 continue outerLoop; 36513 } 36514 } else if (value === result) { 36515 continue outerLoop; 36516 } 36517 } 36518 36519 // If we get this far, that means the current value is not already in 36520 // the result array, so add it. 36521 results.push(value); 36522 } 36523 36524 return results; 36525}; 36526 36527/** 36528Executes the supplied function on each item in the array. Returns a new array 36529containing the items for which the supplied function returned a truthy value. 36530 36531@method filter 36532@param {Array} a Array to filter. 36533@param {Function} f Function to execute on each item. 36534@param {Object} [o] Optional context object. 36535@return {Array} Array of items for which the supplied function returned a 36536 truthy value (empty if it never returned a truthy value). 36537@static 36538*/ 36539A.filter = L._isNative(ArrayProto.filter) ? 36540 function(a, f, o) { 36541 return ArrayProto.filter.call(a, f, o); 36542 } : 36543 function(a, f, o) { 36544 var i = 0, 36545 len = a.length, 36546 results = [], 36547 item; 36548 36549 for (; i < len; ++i) { 36550 if (i in a) { 36551 item = a[i]; 36552 36553 if (f.call(o, item, i, a)) { 36554 results.push(item); 36555 } 36556 } 36557 } 36558 36559 return results; 36560 }; 36561 36562/** 36563The inverse of `Array.filter()`. Executes the supplied function on each item. 36564Returns a new array containing the items for which the supplied function 36565returned `false`. 36566 36567@method reject 36568@param {Array} a the array to iterate. 36569@param {Function} f the function to execute on each item. 36570@param {object} [o] Optional context object. 36571@return {Array} The items for which the supplied function returned `false`. 36572@static 36573*/ 36574A.reject = function(a, f, o) { 36575 return A.filter(a, function(item, i, a) { 36576 return !f.call(o, item, i, a); 36577 }); 36578}; 36579 36580/** 36581Executes the supplied function on each item in the array. Iteration stops if the 36582supplied function does not return a truthy value. 36583 36584@method every 36585@param {Array} a the array to iterate. 36586@param {Function} f the function to execute on each item. 36587@param {Object} [o] Optional context object. 36588@return {Boolean} `true` if every item in the array returns `true` from the 36589 supplied function, `false` otherwise. 36590@static 36591*/ 36592A.every = L._isNative(ArrayProto.every) ? 36593 function(a, f, o) { 36594 return ArrayProto.every.call(a, f, o); 36595 } : 36596 function(a, f, o) { 36597 for (var i = 0, l = a.length; i < l; ++i) { 36598 if (i in a && !f.call(o, a[i], i, a)) { 36599 return false;
36600 } 36601 } 36602 36603 return true; 36604 }; 36605 36606/** 36607Executes the supplied function on each item in the array and returns a new array 36608containing all the values returned by the supplied function. 36609 36610@example 36611 36612 // Convert an array of numbers into an array of strings. 36613 Y.Array.map([1, 2, 3, 4], function (item) { 36614 return '' + item; 36615 }); 36616 // => ['1', '2', '3', '4'] 36617 36618@method map 36619@param {Array} a the array to iterate. 36620@param {Function} f the function to execute on each item. 36621@param {object} [o] Optional context object. 36622@return {Array} A new array containing the return value of the supplied function 36623 for each item in the original array. 36624@static 36625*/ 36626A.map = L._isNative(ArrayProto.map) ? 36627 function(a, f, o) { 36628 return ArrayProto.map.call(a, f, o); 36629 } : 36630 function(a, f, o) { 36631 var i = 0, 36632 len = a.length, 36633 results = ArrayProto.concat.call(a); 36634 36635 for (; i < len; ++i) { 36636 if (i in a) { 36637 results[i] = f.call(o, a[i], i, a); 36638 } 36639 } 36640 36641 return results; 36642 }; 36643 36644 36645/** 36646Executes the supplied function on each item in the array, "folding" the array 36647into a single value. 36648 36649@method reduce 36650@param {Array} a Array to iterate. 36651@param {Any} init Initial value to start with. 36652@param {Function} f Function to execute on each item. This function should 36653 update and return the value of the computation. It will receive the following 36654 arguments: 36655 @param {Any} f.previousValue Value returned from the previous iteration, 36656 or the initial value if this is the first iteration. 36657 @param {Any} f.currentValue Value of the current item being iterated. 36658 @param {Number} f.index Index of the current item. 36659 @param {Array} f.array Array being iterated. 36660@param {Object} [o] Optional context object. 36661@return {Any} Final result from iteratively applying the given function to each 36662 element in the array. 36663@static 36664*/ 36665A.reduce = L._isNative(ArrayProto.reduce) ? 36666 function(a, init, f, o) { 36667 // ES5 Array.reduce doesn't support a thisObject, so we need to 36668 // implement it manually. 36669 return ArrayProto.reduce.call(a, function(init, item, i, a) { 36670 return f.call(o, init, item, i, a); 36671 }, init); 36672 } : 36673 function(a, init, f, o) { 36674 var i = 0, 36675 len = a.length, 36676 result = init; 36677 36678 for (; i < len; ++i) { 36679 if (i in a) { 36680 result = f.call(o, result, a[i], i, a); 36681 } 36682 } 36683 36684 return result; 36685 }; 36686 36687/** 36688Executes the supplied function on each item in the array, searching for the 36689first item that matches the supplied function. 36690 36691@method find 36692@param {Array} a the array to search. 36693@param {Function} f the function to execute on each item. Iteration is stopped 36694 as soon as this function returns `true`. 36695@param {Object} [o] Optional context object. 36696@return {Object} the first item that the supplied function returns `true` for, 36697 or `null` if it never returns `true`. 36698@static 36699*/ 36700A.find = function(a, f, o) { 36701 for (var i = 0, l = a.length; i < l; i++) { 36702 if (i in a && f.call(o, a[i], i, a)) { 36703 return a[i]; 36704 } 36705 } 36706 return null; 36707}; 36708 36709/** 36710Iterates over an array, returning a new array of all the elements that match the 36711supplied regular expression. 36712 36713@method grep 36714@param {Array} a Array to iterate over. 36715@param {RegExp} pattern Regular expression to test against each item. 36716@return {Array} All the items in the array that produce a match against the 36717 supplied regular expression. If no items match, an empty array is returned. 36718@static 36719*/ 36720A.grep = function(a, pattern) { 36721 return A.filter(a, function(item, index) { 36722 return pattern.test(item); 36723 }); 36724}; 36725 36726/** 36727Partitions an array into two new arrays, one with the items for which the 36728supplied function returns `true`, and one with the items for which the function 36729returns `false`. 36730 36731@method partition 36732@param {Array} a Array to iterate over. 36733@param {Function} f Function to execute for each item in the array. It will 36734 receive the following arguments: 36735 @param {Any} f.item Current item. 36736 @param {Number} f.index Index of the current item. 36737 @param {Array} f.array The array being iterated. 36738@param {Object} [o] Optional execution context. 36739@return {Object} An object with two properties: `matches` and `rejects`. Each is 36740 an array containing the items that were selected or rejected by the test 36741 function (or an empty array if none). 36742@static 36743*/ 36744A.partition = function(a, f, o) { 36745 var results = { 36746 matches: [], 36747 rejects: [] 36748 }; 36749 36750 A.each(a, function(item, index) { 36751 var set = f.call(o, item, index, a) ? results.matches : results.rejects; 36752 set.push(item); 36753 }); 36754 36755 return results; 36756}; 36757 36758/** 36759Creates an array of arrays by pairing the corresponding elements of two arrays
36760together into a new array. 36761 36762@method zip 36763@param {Array} a Array to iterate over. 36764@param {Array} a2 Another array whose values will be paired with values of the 36765 first array. 36766@return {Array} An array of arrays formed by pairing each element of the first 36767 array with an item in the second array having the corresponding index. 36768@static 36769*/ 36770A.zip = function(a, a2) { 36771 var results = []; 36772 A.each(a, function(item, index) { 36773 results.push([item, a2[index]]); 36774 }); 36775 return results; 36776}; 36777 36778/** 36779Flattens an array of nested arrays at any abitrary depth into a single, flat 36780array. 36781 36782@method flatten 36783@param {Array} a Array with nested arrays to flatten. 36784@return {Array} An array whose nested arrays have been flattened. 36785@static 36786@since 3.7.0 36787**/ 36788A.flatten = function(a) { 36789 var result = [], 36790 i, len, val; 36791 36792 // Always return an array. 36793 if (!a) { 36794 return result; 36795 } 36796 36797 for (i = 0, len = a.length; i < len; ++i) { 36798 val = a[i]; 36799 36800 if (L.isArray(val)) { 36801 // Recusively flattens any nested arrays. 36802 result.push.apply(result, A.flatten(val)); 36803 } else { 36804 result.push(val); 36805 } 36806 } 36807 36808 return result; 36809}; 36810 36811 36812}, 'patched-v3.18.3', {"requires": ["yui-base"]}); 36813 36814YUI.add('array-invoke', function (Y, NAME) { 36815 36816/** 36817@module collection 36818@submodule array-invoke 36819*/ 36820 36821/** 36822Executes a named method on each item in an array of objects. Items in the array 36823that do not have a function by that name will be skipped. 36824 36825@example 36826 36827 Y.Array.invoke(arrayOfDrags, 'plug', Y.Plugin.DDProxy); 36828 36829@method invoke 36830@param {Array} items Array of objects supporting the named method. 36831@param {String} name the name of the method to execute on each item. 36832@param {Any} [args*] Any number of additional args are passed as parameters to 36833 the execution of the named method. 36834@return {Array} All return values, indexed according to the item index. 36835@static 36836@for Array 36837**/ 36838Y.Array.invoke = function(items, name) { 36839 var args = Y.Array(arguments, 2, true), 36840 isFunction = Y.Lang.isFunction, 36841 ret = []; 36842 36843 Y.Array.each(Y.Array(items), function(item, i) { 36844 if (item && isFunction(item[name])) { 36845 ret[i] = item[name].apply(item, args); 36846 } 36847 }); 36848 36849 return ret; 36850}; 36851 36852 36853}, 'patched-v3.18.3', {"requires": ["yui-base"]}); 36854 36855YUI.add('attribute-base', function (Y, NAME) { 36856 36857 /** 36858 * The attribute module provides an augmentable Attribute implementation, which 36859 * adds configurable attributes and attribute change events to the class being 36860 * augmented. It also provides a State class, which is used internally by Attribute, 36861 * but can also be used independently to provide a name/property/value data structure to 36862 * store state. 36863 * 36864 * @module attribute 36865 */ 36866 36867 /** 36868 * The attribute-base submodule provides core attribute handling support, with everything 36869 * aside from complex attribute handling in the provider's constructor. 36870 * 36871 * @module attribute 36872 * @submodule attribute-base 36873 */ 36874 36875 /** 36876 * <p> 36877 * Attribute provides configurable attribute support along with attribute change events. It is designed to be 36878 * augmented on to a host class, and provides the host with the ability to configure attributes to store and retrieve state, 36879 * along with attribute change events. 36880 * </p> 36881 * <p>For example, attributes added to the host can be configured:</p> 36882 * <ul> 36883 * <li>As read only.</li> 36884 * <li>As write once.</li> 36885 * <li>With a setter function, which can be used to manipulate 36886 * values passed to Attribute's <a href="#method_set">set</a> method, before they are stored.</li> 36887 * <li>With a getter function, which can be used to manipulate stored values, 36888 * before they are returned by Attribute's <a href="#method_get">get</a> method.</li> 36889 * <li>With a validator function, to validate values before they are stored.</li> 36890 * </ul> 36891 * 36892 * <p>See the <a href="#method_addAttr">addAttr</a> method, for the complete set of configuration 36893 * options available for attributes.</p> 36894 * 36895 * <p><strong>NOTE:</strong> Most implementations will be better off extending the <a href="Base.html">Base</a> class, 36896 * instead of augmenting Attribute directly. Base augments Attribute and will handle the initial configuration 36897 * of attributes for derived classes, accounting for values passed into the constructor.</p> 36898 * 36899 * @class Attribute 36900 * @param attrs {Object} The attributes to add during construction (passed through to <a href="#method_addAttrs">addAttrs</a>). 36901 * These can also be defined on the constructor being augmented with Attribute by defining the ATTRS property on the constructor. 36902 * @param values {Object} The initial attribute values to apply (passed through to <a href="#method_addAttrs">addAttrs</a>). 36903 * These are not merged/cloned. The caller is responsible for isolating user provided values if required. 36904 * @param lazy {boolean} Whether or not to add attributes lazily (passed through to <a href="#method_addAttrs">addAttrs</a>). 36905 * @uses AttributeCore 36906 * @uses AttributeObservable 36907 * @uses EventTarget 36908 * @uses AttributeExtras 36909 */ 36910 function Attribute() { 36911 Y.AttributeCore.apply(this, arguments); 36912 Y.AttributeObservable.apply(this, arguments); 36913 Y.AttributeExtras.apply(this, arguments); 36914 } 36915 36916 Y.mix(Attribute, Y.AttributeCore, false, null, 1); 36917 Y.mix(Attribute, Y.AttributeExtras, false, null, 1); 36918 36919 // Needs to be `true`, to overwrite methods from AttributeCore 36920 Y.mix(Attribute, Y.AttributeObservable, true, null, 1); 36921 36922 /** 36923 * <p>The value to return from an attribute setter in order to prevent the set from going through.</p> 36924 * 36925 * <p>You can return this value from your setter if you wish to combine validator and setter 36926 * functionality into a single setter function, which either returns the massaged value to be stored or 36927 * AttributeCore.INVALID_VALUE to prevent invalid values from being stored.</p> 36928 * 36929 * @property INVALID_VALUE 36930 * @type Object 36931 * @static 36932 * @final 36933 */ 36934 Attribute.INVALID_VALUE = Y.AttributeCore.INVALID_VALUE; 36935 36936 /** 36937 * The list of properties which can be configured for 36938 * each attribute (e.g. setter, getter, writeOnce etc.). 36939 * 36940 * This property is used internally as a whitelist for faster 36941 * Y.mix operations. 36942 * 36943 * @property _ATTR_CFG 36944 * @type Array 36945 * @static 36946 * @protected 36947 */ 36948 Attribute._ATTR_CFG = Y.AttributeCore._ATTR_CFG.concat(Y.AttributeObservable._ATTR_CFG); 36949 36950 /** 36951 * Utility method to protect an attribute configuration hash, by merging the 36952 * entire object and the individual attr config objects. 36953 * 36954 * @method protectAttrs 36955 * @static 36956 * @param {Object} attrs A hash of attribute to configuration object pairs. 36957 * @return {Object} A protected version of the `attrs` argument. 36958 */ 36959 Attribute.protectAttrs = Y.AttributeCore.protectAttrs; 36960 36961 Y.Attribute = Attribute; 36962 36963 36964}, 'patched-v3.18.3', {"requires": ["attribute-core", "attribute-observable", "attribute-extras"]}); 36965 36966YUI.add('attribute-complex', function (Y, NAME) { 36967 36968 /** 36969 * Adds support for attribute providers to handle complex attributes in the constructor 36970 * 36971 * @module attribute 36972 * @submodule attribute-complex 36973 * @for Attribute 36974 * @deprecated AttributeComplex's overrides are now part of AttributeCore. 36975 */ 36976 36977 var Attribute = Y.Attribute; 36978 36979 Attribute.Complex = function() {}; 36980 Attribute.Complex.prototype = { 36981 36982 /** 36983 * Utility method to split out simple attribute name/value pairs ("x") 36984 * from complex attribute name/value pairs ("x.y.z"), so that complex 36985 * attributes can be keyed by the top level attribute name. 36986 * 36987 * @method _normAttrVals 36988 * @param {Object} valueHash An object with attribute name/value pairs 36989 * 36990 * @return {Object} An object literal with 2 properties - "simple" and "complex", 36991 * containing simple and complex attribute values respectively keyed 36992 * by the top level attribute name, or null, if valueHash is falsey. 36993 * 36994 * @private 36995 */ 36996 _normAttrVals : Attribute.prototype._normAttrVals, 36997 36998 /** 36999 * Returns the initial value of the given attribute from 37000 * either the default configuration provided, or the 37001 * over-ridden value if it exists in the set of initValues 37002 * provided and the attribute is not read-only. 37003 * 37004 * @param {String} attr The name of the attribute 37005 * @param {Object} cfg The attribute configuration object 37006 * @param {Object}
37006 initValues The object with simple and complex attribute name/value pairs returned from _normAttrVals 37007 * 37008 * @return {Any} The initial value of the attribute. 37009 * 37010 * @method _getAttrInitVal 37011 * @private 37012 */ 37013 _getAttrInitVal : Attribute.prototype._getAttrInitVal 37014 37015 }; 37016 37017 // Consistency with the rest of the Attribute addons for now. 37018 Y.AttributeComplex = Attribute.Complex; 37019 37020 37021}, 'patched-v3.18.3', {"requires": ["attribute-base"]}); 37022 37023YUI.add('attribute-core', function (Y, NAME) { 37024 37025 /** 37026 * The State class maintains state for a collection of named items, with 37027 * a varying number of properties defined. 37028 * 37029 * It avoids the need to create a separate class for the item, and separate instances 37030 * of these classes for each item, by storing the state in a 2 level hash table, 37031 * improving performance when the number of items is likely to be large. 37032 * 37033 * @constructor 37034 * @class State 37035 */ 37036 Y.State = function() { 37037 /** 37038 * Hash of attributes 37039 * @property data 37040 */ 37041 this.data = {}; 37042 }; 37043 37044 Y.State.prototype = { 37045 37046 /** 37047 * Adds a property to an item. 37048 * 37049 * @method add 37050 * @param name {String} The name of the item. 37051 * @param key {String} The name of the property. 37052 * @param val {Any} The value of the property. 37053 */ 37054 add: function(name, key, val) { 37055 var item = this.data[name]; 37056 37057 if (!item) { 37058 item = this.data[name] = {}; 37059 } 37060 37061 item[key] = val; 37062 }, 37063 37064 /** 37065 * Adds multiple properties to an item. 37066 * 37067 * @method addAll 37068 * @param name {String} The name of the item. 37069 * @param obj {Object} A hash of property/value pairs. 37070 */ 37071 addAll: function(name, obj) { 37072 var item = this.data[name], 37073 key; 37074 37075 if (!item) { 37076 item = this.data[name] = {}; 37077 } 37078 37079 for (key in obj) { 37080 if (obj.hasOwnProperty(key)) { 37081 item[key] = obj[key]; 37082 } 37083 } 37084 }, 37085 37086 /** 37087 * Removes a property from an item. 37088 * 37089 * @method remove 37090 * @param name {String} The name of the item. 37091 * @param key {String} The property to remove. 37092 */ 37093 remove: function(name, key) { 37094 var item = this.data[name]; 37095 37096 if (item) { 37097 delete item[key]; 37098 } 37099 }, 37100 37101 /** 37102 * Removes multiple properties from an item, or removes the item completely. 37103 * 37104 * @method removeAll 37105 * @param name {String} The name of the item. 37106 * @param obj {Object|Array} Collection of properties to delete. If not provided, the entire item is removed. 37107 */ 37108 removeAll: function(name, obj) { 37109 var data; 37110 37111 if (!obj) { 37112 data = this.data; 37113 37114 if (name in data) { 37115 delete data[name]; 37116 } 37117 } else { 37118 Y.each(obj, function(value, key) { 37119 this.remove(name, typeof key === 'string' ? key : value); 37120 }, this); 37121 } 37122 }, 37123 37124 /** 37125 * For a given item, returns the value of the property requested, or undefined if not found. 37126 * 37127 * @method get 37128 * @param name {String} The name of the item 37129 * @param key {String} Optional. The property value to retrieve. 37130 * @return {Any} The value of the supplied property. 37131 */ 37132 get: function(name, key) { 37133 var item = this.data[name]; 37134 37135 if (item) { 37136 return item[key]; 37137 } 37138 }, 37139 37140 /** 37141 * For the given item, returns an object with all of the 37142 * item's property/value pairs. By default the object returned 37143 * is a shallow copy of the stored data, but passing in true 37144 * as the second parameter will return a reference to the stored 37145 * data. 37146 * 37147 * @method getAll 37148 * @param name {String} The name of the item 37149 * @param reference {boolean} true, if you want a reference to the stored 37150 * object 37151 * @return {Object} An object with property/value pairs for the item. 37152 */ 37153 getAll : function(name, reference) { 37154 var item = this.data[name], 37155 key, obj; 37156 37157 if (reference) { 37158 obj = item; 37159 } else if (item) { 37160 obj = {}; 37161 37162 for (key in item) { 37163 if (item.hasOwnProperty(key)) { 37164 obj[key] = item[key]; 37165 } 37166 } 37167 } 37168 37169 return obj; 37170 } 37171 }; 37172 /*For log lines*/ 37173 /*jshint maxlen:200*/ 37174 37175 /** 37176 * The attribute module provides an augmentable Attribute implementation, which 37177 * adds configurable attributes and attribute change events to the class being 37178 * augmented. It also provides a State class, which is used internally by Attribute, 37179 * but can also be used independently to provide a name/property/value data structure to 37180 * store state. 37181 * 37182 * @module attribute 37183 */ 37184 37185 /** 37186 * The attribute-core submodule provides the lightest level of attribute handling support 37187 * without Attribute change events, or lesser used methods such as reset(), modifyAttrs(), 37188 * and removeAttr(). 37189 * 37190 * @module attribute 37191 * @submodule attribute-core 37192 */ 37193 var O = Y.Object, 37194 Lang = Y.Lang, 37195 37196 DOT = ".", 37197 37198 // Externally configurable props 37199 GETTER = "getter", 37200 SETTER = "setter", 37201 READ_ONLY = "readOnly", 37202 WRITE_ONCE = "writeOnce", 37203 INIT_ONLY = "initOnly", 37204 VALIDATOR = "validator", 37205 VALUE = "value", 37206 VALUE_FN = "valueFn", 37207 LAZY_ADD = "lazyAdd", 37208 37209 // Used for internal state management 37210 ADDED = "added", 37211 BYPASS_PROXY = "_bypassProxy", 37212 INIT_VALUE = "initValue", 37213 LAZY = "lazy", 37214 37215 INVALID_VALUE; 37216 37217 /** 37218 * <p> 37219 * AttributeCore provides the lightest level of configurable attribute support. It is designed to be 37220 * augmented on to a host class, and provides the host with the ability to configure 37221 * attributes to store and retrieve state, <strong>but without support for attribute change events</strong>. 37222 * </p> 37223 * <p>For example, attributes added to the host can be configured:</p> 37224 * <ul> 37225 * <li>As read only.</li> 37226 * <li>As write once.</li> 37227 * <li>With a setter function, which can be used to manipulate 37228 * values passed to Attribute's <a href="#method_set">set</a> method, before they are stored.</li> 37229 * <li>With a getter function, which can be used to manipulate stored values, 37230 * before they are returned by Attribute's <a href="#method_get">get</a> method.</li> 37231 * <li>With a validator function, to validate values before they are stored.</li> 37232 * </ul> 37233 * 37234 * <p>See the <a href="#method_addAttr">addAttr</a> method, for the complete set of configuration 37235 * options available for attributes.</p> 37236 * 37237 * <p>Object/Classes based on AttributeCore can augment <a href="AttributeObservable.html">AttributeObservable</a>
37238 * (with true for overwrite) and <a href="AttributeExtras.html">AttributeExtras</a> to add attribute event and 37239 * additional, less commonly used attribute methods, such as `modifyAttr`, `removeAttr` and `reset`.</p> 37240 * 37241 * @class AttributeCore 37242 * @param attrs {Object} The attributes to add during construction (passed through to <a href="#method_addAttrs">addAttrs</a>). 37243 * These can also be defined on the constructor being augmented with Attribute by defining the ATTRS property on the constructor. 37244 * @param values {Object} The initial attribute values to apply (passed through to <a href="#method_addAttrs">addAttrs</a>). 37245 * These are not merged/cloned. The caller is responsible for isolating user provided values if required. 37246 * @param lazy {boolean} Whether or not to add attributes lazily (passed through to <a href="#method_addAttrs">addAttrs</a>). 37247 */ 37248 function AttributeCore(attrs, values, lazy) { 37249 // HACK: Fix #2531929 37250 // Complete hack, to make sure the first clone of a node value in IE doesn't doesn't hurt state - maintains 3.4.1 behavior. 37251 // Too late in the release cycle to do anything about the core problem. 37252 // The root issue is that cloning a Y.Node instance results in an object which barfs in IE, when you access it's properties (since 3.3.0). 37253 this._yuievt = null; 37254 37255 this._initAttrHost(attrs, values, lazy); 37256 } 37257 37258 /** 37259 * <p>The value to return from an attribute setter in order to prevent the set from going through.</p> 37260 * 37261 * <p>You can return this value from your setter if you wish to combine validator and setter 37262 * functionality into a single setter function, which either returns the massaged value to be stored or 37263 * AttributeCore.INVALID_VALUE to prevent invalid values from being stored.</p> 37264 * 37265 * @property INVALID_VALUE 37266 * @type Object 37267 * @static 37268 * @final 37269 */ 37270 AttributeCore.INVALID_VALUE = {}; 37271 INVALID_VALUE = AttributeCore.INVALID_VALUE; 37272 37273 /** 37274 * The list of properties which can be configured for 37275 * each attribute (e.g. setter, getter, writeOnce etc.). 37276 * 37277 * This property is used internally as a whitelist for faster 37278 * Y.mix operations. 37279 * 37280 * @property _ATTR_CFG 37281 * @type Array 37282 * @static 37283 * @protected 37284 */ 37285 AttributeCore._ATTR_CFG = [SETTER, GETTER, VALIDATOR, VALUE, VALUE_FN, WRITE_ONCE, READ_ONLY, LAZY_ADD, BYPASS_PROXY]; 37286 37287 /** 37288 * Utility method to protect an attribute configuration hash, by merging the 37289 * entire object and the individual attr config objects. 37290 * 37291 * @method protectAttrs 37292 * @static 37293 * @param {Object} attrs A hash of attribute to configuration object pairs. 37294 * @return {Object} A protected version of the `attrs` argument. 37295 */ 37296 AttributeCore.protectAttrs = function (attrs) { 37297 if (attrs) { 37298 attrs = Y.merge(attrs); 37299 for (var attr in attrs) { 37300 if (attrs.hasOwnProperty(attr)) { 37301 attrs[attr] = Y.merge(attrs[attr]); 37302 } 37303 } 37304 } 37305 37306 return attrs; 37307 }; 37308 37309 AttributeCore.prototype = { 37310 37311 /** 37312 * Constructor logic for attributes. Initializes the host state, and sets up the inital attributes passed to the 37313 * constructor. 37314 * 37315 * @method _initAttrHost 37316 * @param attrs {Object} The attributes to add during construction (passed through to <a href="#method_addAttrs">addAttrs</a>). 37317 * These can also be defined on the constructor being augmented with Attribute by defining the ATTRS property on the constructor. 37318 * @param values {Object} The initial attribute values to apply (passed through to <a href="#method_addAttrs">addAttrs</a>). 37319 * These are not merged/cloned. The caller is responsible for isolating user provided values if required. 37320 * @param lazy {boolean} Whether or not to add attributes lazily (passed through to <a href="#method_addAttrs">addAttrs</a>). 37321 * @private 37322 */ 37323 _initAttrHost : function(attrs, values, lazy) { 37324 this._state = new Y.State(); 37325 this._initAttrs(attrs, values, lazy); 37326 }, 37327 37328 /** 37329 * <p> 37330 * Adds an attribute with the provided configuration to the host object. 37331 * </p> 37332 * <p> 37333 * The config argument object supports the following properties: 37334 * </p> 37335 * 37336 * <dl> 37337 * <dt>value <Any></dt> 37338 * <dd>The initial value to set on the attribute</dd> 37339 * 37340 * <dt>valueFn <Function | String></dt> 37341 * <dd> 37342 * <p>A function, which will return the initial value to set on the attribute. This is useful 37343 * for cases where the attribute configuration is defined statically, but needs to 37344 * reference the host instance ("this") to obtain an initial value. If both the value and valueFn properties are defined, 37345 * the value returned by the valueFn has precedence over the value property, unless it returns undefined, in which 37346 * case the value property is used.</p> 37347 * 37348 * <p>valueFn can also be set to a string, representing the name of the instance method to be used to retrieve the value.</p> 37349 * </dd> 37350 * 37351 * <dt>readOnly <boolean></dt> 37352 * <dd>Whether or not the attribute is read only. Attributes having readOnly set to true 37353 * cannot be modified by invoking the set method.</dd> 37354 * 37355 * <dt>writeOnce <boolean> or <string></dt> 37356 * <dd> 37357 * Whether or not the attribute is "write once". Attributes having writeOnce set to true, 37358 * can only have their values set once, be it through the default configuration, 37359 * constructor configuration arguments, or by invoking set. 37360 * <p>The writeOnce attribute can also be set to the string "initOnly", 37361 * in which case the attribute can only be set during initialization 37362 * (when used with Base, this means it can only be set during construction)</p> 37363 * </dd> 37364 * 37365 * <dt>setter <Function | String></dt> 37366 * <dd> 37367 * <p>The setter function used to massage or normalize the value passed to the set method for the attribute. 37368 * The value returned by the setter will be the final stored value. Returning 37369 * <a href="#property_Attribute.INVALID_VALUE">Attribute.INVALID_VALUE</a>, from the setter will prevent 37370 * the value from being stored. 37371 * </p> 37372 * 37373 * <p>setter can also be set to a string, representing the name of the instance method to be used as the setter function.</p> 37374 * </dd> 37375 * 37376 * <dt>getter <Function | String></dt> 37377 * <dd> 37378 * <p> 37379 * The getter function used to massage or normalize the value returned by the get method for the attribute. 37380 * The value returned by the getter function is the value which will be returned to the user when they 37381 * invoke get. 37382 * </p> 37383 * 37384 * <p>getter can also be set to a string, representing the name of the instance method to be used as the getter function.</p> 37385 * </dd> 37386 * 37387 * <dt>validator <Function | String></dt> 37388 * <dd> 37389 * <p> 37390 * The validator function invoked prior to setting the stored value. Returning 37391 * false from the validator function will prevent the value from being stored. 37392 * </p> 37393 * 37394 * <p>validator can also be set to a string, representing the name of the instance method to be used as the validator function.</p> 37395 * </dd> 37396 * 37397 * <dt>lazyAdd <boolean></dt> 37398 * <dd>Whether or not to delay initialization of the attribute until the first call to get/set it. 37399 * This flag can be used to over-ride lazy initialization on a per attribute basis, when adding multiple attributes through 37400 * the <a href="#method_addAttrs">addAttrs</a> method.</dd> 37401 * 37402 * </dl> 37403 * 37404 * <p>The setter, getter and validator are invoked with the value and name passed in as the first and second arguments, and with 37405 * the context ("this") set to the host object.</p> 37406 * 37407 * <p>Configuration properties outside of the list mentioned above are considered private properties used internally by attribute, 37408 * and are not intended for public use.</p> 37409 * 37410 * @method addAttr 37411 * 37412 * @param {String} name The name of the attribute. 37413 * @param {Object} config An object with attribute configuration property/value pairs, specifying the configuration for the attribute. 37414 * 37415 * <p> 37416 * <strong>NOTE:</strong> The configuration object is modified when adding an attribute, so if you need 37417 * to protect the original values, you will need to merge the object. 37418 * </p> 37419 * 37420 * @param {boolean} lazy (optional) Whether or not to add this attribute lazily (on the first call to get/set). 37421 * 37422 * @return {Object} A reference to the host object. 37423 * 37424 * @chainable 37425 */ 37426 addAttr : function(name, config, lazy) { 37427 37428 37429 var host = this, // help compression 37430 state = host._state, 37431 data = state.data, 37432 value, 37433 added, 37434 hasValue; 37435 37436 config = config || {}; 37437 37438 if (LAZY_ADD in config) { 37439 lazy = config[LAZY_ADD]; 37440 } 37441 37442 added = state.get(name, ADDED); 37443 37444 if (lazy && !added) { 37445 state.data[name] = { 37446 lazy : config, 37447 added : true 37448 }; 37449 } else { 37450 37451 37452 if (!added || config.isLazyAdd) { 37453 37454 hasValue = (VALUE in config); 37455 37456 37457 if (hasValue) { 37458 37459 // We'll go through set, don't want to set value in config directly 37460 37461 // PERF TODO: VALIDATE: See if setting this to undefined is sufficient. We use to delete before. 37462 // In certain code paths/use cases, undefined may not be the same as not present. 37463 // If not, we can set it to some known fixed value (like INVALID_VALUE, say INITIALIZING_VALUE) for performance, 37464 // to avoid a delete which seems to help a lot. 37465 37466 value = config.value; 37467 config.value = undefined; 37468 } 37469 37470 config.added = true; 37471 config.initializing = true; 37472 37473 data[name] = config; 37474 37475 if (hasValue) { 37476 // Go through set, so that raw values get normalized/validated 37477 host.set(name, value); 37478 } 37479 37480 config.initializing = false;
37481 } 37482 } 37483 37484 return host; 37485 }, 37486 37487 /** 37488 * Checks if the given attribute has been added to the host 37489 * 37490 * @method attrAdded 37491 * @param {String} name The name of the attribute to check. 37492 * @return {boolean} true if an attribute with the given name has been added, false if it hasn't. 37493 * This method will return true for lazily added attributes. 37494 */ 37495 attrAdded: function(name) { 37496 return !!(this._state.get(name, ADDED)); 37497 }, 37498 37499 /** 37500 * Returns the current value of the attribute. If the attribute 37501 * has been configured with a 'getter' function, this method will delegate 37502 * to the 'getter' to obtain the value of the attribute. 37503 * 37504 * @method get 37505 * 37506 * @param {String} name The name of the attribute. If the value of the attribute is an Object, 37507 * dot notation can be used to obtain the value of a property of the object (e.g. <code>get("x.y.z")</code>) 37508 * 37509 * @return {Any} The value of the attribute 37510 */ 37511 get : function(name) { 37512 return this._getAttr(name); 37513 }, 37514 37515 /** 37516 * Checks whether or not the attribute is one which has been 37517 * added lazily and still requires initialization. 37518 * 37519 * @method _isLazyAttr 37520 * @private 37521 * @param {String} name The name of the attribute 37522 * @return {boolean} true if it's a lazily added attribute, false otherwise. 37523 */ 37524 _isLazyAttr: function(name) { 37525 return this._state.get(name, LAZY); 37526 }, 37527 37528 /** 37529 * Finishes initializing an attribute which has been lazily added. 37530 * 37531 * @method _addLazyAttr 37532 * @private 37533 * @param {Object} name The name of the attribute 37534 * @param {Object} [lazyCfg] Optional config hash for the attribute. This is added for performance 37535 * along the critical path, where the calling method has already obtained lazy config from state. 37536 */ 37537 _addLazyAttr: function(name, lazyCfg) { 37538 var state = this._state; 37539 37540 lazyCfg = lazyCfg || state.get(name, LAZY); 37541 37542 if (lazyCfg) { 37543 37544 // PERF TODO: For App's id override, otherwise wouldn't be 37545 // needed. It expects to find it in the cfg for it's 37546 // addAttr override. Would like to remove, once App override is 37547 // removed. 37548 state.data[name].lazy = undefined; 37549 37550 lazyCfg.isLazyAdd = true; 37551 37552 this.addAttr(name, lazyCfg); 37553 } 37554 }, 37555 37556 /** 37557 * Sets the value of an attribute. 37558 * 37559 * @method set 37560 * @chainable 37561 * 37562 * @param {String} name The name of the attribute. If the 37563 * current value of the attribute is an Object, dot notation can be used 37564 * to set the value of a property within the object (e.g. <code>set("x.y.z", 5)</code>). 37565 * @param {Any} value The value to set the attribute to. 37566 * @param {Object} [opts] Optional data providing the circumstances for the change. 37567 * @return {Object} A reference to the host object. 37568 */ 37569 set : function(name, val, opts) { 37570 return this._setAttr(name, val, opts); 37571 }, 37572 37573 /** 37574 * Allows setting of readOnly/writeOnce attributes. See <a href="#method_set">set</a> for argument details. 37575 * 37576 * @method _set 37577 * @protected 37578 * @chainable 37579 * 37580 * @param {String} name The name of the attribute. 37581 * @param {Any} val The value to set the attribute to. 37582 * @param {Object} [opts] Optional data providing the circumstances for the change. 37583 * @return {Object} A reference to the host object. 37584 */ 37585 _set : function(name, val, opts) { 37586 return this._setAttr(name, val, opts, true); 37587 }, 37588 37589 /** 37590 * Provides the common implementation for the public set and protected _set methods. 37591 * 37592 * See <a href="#method_set">set</a> for argument details. 37593 * 37594 * @method _setAttr 37595 * @protected 37596 * @chainable 37597 * 37598 * @param {String} name The name of the attribute. 37599 * @param {Any} value The value to set the attribute to. 37600 * @param {Object} [opts] Optional data providing the circumstances for the change. 37601 * @param {boolean} force If true, allows the caller to set values for 37602 * readOnly or writeOnce attributes which have already been set. 37603 * 37604 * @return {Object} A reference to the host object. 37605 */ 37606 _setAttr : function(name, val, opts, force) { 37607 var allowSet = true, 37608 state = this._state, 37609 stateProxy = this._stateProxy, 37610 tCfgs = this._tCfgs, 37611 cfg, 37612 initialSet, 37613 strPath, 37614 path, 37615 currVal, 37616 writeOnce, 37617 initializing; 37618 37619 if (name.indexOf(DOT) !== -1) { 37620 strPath = name; 37621 37622 path = name.split(DOT); 37623 name = path.shift(); 37624 } 37625 37626 // On Demand - Should be rare - handles out of order valueFn, setter, getter references 37627 if (tCfgs && tCfgs[name]) { 37628 this._addOutOfOrder(name, tCfgs[name]); 37629 } 37630 37631 cfg = state.data[name] || {}; 37632 37633 if (cfg.lazy) { 37634 cfg = cfg.lazy; 37635 this._addLazyAttr(name, cfg); 37636 } 37637 37638 initialSet = (cfg.value === undefined); 37639 37640 if (stateProxy && name in stateProxy && !cfg._bypassProxy) { 37641 // TODO: Value is always set for proxy. Can we do any better? Maybe take a snapshot as the initial value for the first call to set? 37642 initialSet = false;
37643 } 37644 37645 writeOnce = cfg.writeOnce; 37646 initializing = cfg.initializing; 37647 37648 if (!initialSet && !force) { 37649 37650 if (writeOnce) { 37651 allowSet = false; 37652 } 37653 37654 if (cfg.readOnly) { 37655 allowSet = false; 37656 } 37657 } 37658 37659 if (!initializing && !force && writeOnce === INIT_ONLY) { 37660 allowSet = false; 37661 } 37662 37663 if (allowSet) { 37664 // Don't need currVal if initialSet (might fail in custom getter if it always expects a non-undefined/non-null value) 37665 if (!initialSet) { 37666 currVal = this.get(name); 37667 } 37668 37669 if (path) { 37670 var copyVal = [currVal].reduce( 37671 function(retVal, currVal) { 37672 Object.keys(currVal).forEach( 37673 function(item) { 37674 retVal[item] = currVal[item]; 37675 } 37676 ); 37677 return retVal; 37678 }, 37679 {} 37680 ); 37681 37682 var pathNode = copyVal; 37683 var leafIdx = path.length - 1; 37684 37685 for (var i = 0; i < leafIdx && pathNode; i++) { 37686 pathNode = pathNode[path[i]]; 37687 } 37688 37689 if (pathNode) { 37690 delete pathNode[path[leafIdx]]; 37691 } 37692 37693 val = O.setValue(Y.clone(copyVal), path, val); 37694 37695 if (val === undefined) { 37696 allowSet = false; 37697 } 37698 } 37699 37700 if (allowSet) { 37701 if (!this._fireAttrChange || initializing) { 37702 this._setAttrVal(name, strPath, currVal, val, opts, cfg); 37703 } else { 37704 // HACK - no real reason core needs to know about _fireAttrChange, but 37705 // it adds fn hops if we want to break it out. Not sure it's worth it for this critical path 37706 this._fireAttrChange(name, strPath, currVal, val, opts, cfg); 37707 } 37708 } 37709 } 37710 37711 return this; 37712 }, 37713 37714 /** 37715 * Utility method used by get/set to add attributes 37716 * encountered out of order when calling addAttrs(). 37717 * 37718 * For example, if: 37719 * 37720 * this.addAttrs({ 37721 * foo: { 37722 * setter: function() { 37723 * // make sure this bar is available when foo is added 37724 * this.get("bar"); 37725 * } 37726 * }, 37727 * bar: { 37728 * value: ... 37729 * } 37730 * }); 37731 * 37732 * @method _addOutOfOrder 37733 * @private 37734 * @param name {String} attribute name 37735 * @param cfg {Object} attribute configuration 37736 */ 37737 _addOutOfOrder : function(name, cfg) { 37738 37739 var attrs = {}; 37740 attrs[name] = cfg; 37741 37742 delete this._tCfgs[name]; 37743 37744 // TODO: The original code went through addAttrs, so 37745 // sticking with it for this pass. Seems like we could 37746 // just jump straight to _addAttr() and get some perf 37747 // improvement. 37748 this._addAttrs(attrs, this._tVals); 37749 }, 37750 37751 /** 37752 * Provides the common implementation for the public get method, 37753 * allowing Attribute hosts to over-ride either method. 37754 * 37755 * See <a href="#method_get">get</a> for argument details. 37756 * 37757 * @method _getAttr 37758 * @protected 37759 * @chainable 37760 * 37761 * @param {String} name The name of the attribute. 37762 * @return {Any} The value of the attribute. 37763 */ 37764 _getAttr : function(name) { 37765 var fullName = name, 37766 tCfgs = this._tCfgs, 37767 path, 37768 getter, 37769 val, 37770 attrCfg; 37771 37772 if (name.indexOf(DOT) !== -1) { 37773 path = name.split(DOT); 37774 name = path.shift(); 37775 } 37776 37777 // On Demand - Should be rare - handles out of 37778 // order valueFn, setter, getter references 37779 if (tCfgs && tCfgs[name]) { 37780 this._addOutOfOrder(name, tCfgs[name]); 37781 } 37782 37783 attrCfg = this._state.data[name] || {}; 37784 37785 // Lazy Init 37786 if (attrCfg.lazy) { 37787 attrCfg = attrCfg.lazy; 37788 this._addLazyAttr(name, attrCfg); 37789 } 37790 37791 val = this._getStateVal(name, attrCfg); 37792 37793 getter = attrCfg.getter; 37794 37795 if (getter && !getter.call) { 37796 getter = this[getter]; 37797 } 37798 37799 val = (getter) ? getter.call(this, val, fullName) : val; 37800 val = (path) ? O.getValue(val, path) : val; 37801 37802 return val; 37803 }, 37804 37805 /** 37806 * Gets the stored value for the attribute, from either the 37807 * internal state object, or the state proxy if it exits 37808 * 37809 * @method _getStateVal 37810 * @private 37811 * @param {String} name The name of the attribute 37812 * @param {Object} [cfg] Optional config hash for the attribute. This is added for performance along the critical path, 37813 * where the calling method has already obtained the config from state. 37814 * 37815 * @return {Any} The stored value of the attribute 37816 */ 37817 _getStateVal : function(name, cfg) { 37818 var stateProxy = this._stateProxy; 37819 37820 if (!cfg) { 37821 cfg = this._state.getAll(name) || {}; 37822 } 37823 37824 return (stateProxy && (name in stateProxy) && !(cfg._bypassProxy)) ? stateProxy[name] : cfg.value; 37825 }, 37826 37827 /** 37828 * Sets the stored value for the attribute, in either the 37829 * internal state object, or the state proxy if it exits 37830 * 37831 * @method _setStateVal 37832 * @private 37833 * @param {String} name The name of the attribute 37834 * @param {Any} value The value of the attribute 37835 */ 37836 _setStateVal : function(name, value) { 37837 var stateProxy = this._stateProxy; 37838 if (stateProxy && (name in stateProxy) && !this._state.get(name, BYPASS_PROXY)) { 37839 stateProxy[name] = value; 37840 } else { 37841 this._state.add(name, VALUE, value); 37842 } 37843 }, 37844 37845 /** 37846 * Updates the stored value of the attribute in the privately held State object, 37847 * if validation and setter passes. 37848 * 37849 * @method _setAttrVal 37850 * @private 37851 * @param {String} attrName The attribute name. 37852 * @param {String} subAttrName The sub-attribute name, if setting a sub-attribute property ("x.y.z"). 37853 * @param {Any} prevVal The currently stored value of the attribute. 37854 * @param {Any} newVal The value which is going to be stored. 37855 * @param {Object} [opts] Optional data providing the circumstances for the change. 37856 * @param {Object} [attrCfg] Optional config hash for the attribute. This is added for performance along the critical path, 37857 * where the calling method has already obtained the config from state. 37858 * 37859 * @return {Boolean} true if the new attribute value was stored, false if not. 37860 */ 37861 _setAttrVal : function(attrName, subAttrName, prevVal, newVal, opts, attrCfg) { 37862 37863 var host = this, 37864 allowSet = true, 37865 cfg = attrCfg || this._state.data[attrName] || {}, 37866 validator = cfg.validator, 37867 setter = cfg.setter, 37868 initializing = cfg.initializing, 37869 prevRawVal = this._getStateVal(attrName, cfg), 37870 name = subAttrName || attrName, 37871 retVal, 37872 valid; 37873 37874 if (validator) { 37875 if (!validator.call) { 37876 // Assume string - trying to keep critical path tight, so avoiding Lang check 37877 validator = this[validator]; 37878 } 37879 if (validator) { 37880 valid = validator.call(host, newVal, name, opts); 37881 37882 if (!valid && initializing) { 37883 newVal = cfg.defaultValue; 37884 valid = true; // Assume it's valid, for perf. 37885 } 37886 } 37887 } 37888 37889 if (!validator || valid) { 37890 if (setter) { 37891 if (!setter.call) { 37892 // Assume string - trying to keep critical path tight, so avoiding Lang check 37893 setter = this[setter]; 37894 } 37895 if (setter) { 37896 retVal = setter.call(host, newVal, name, opts); 37897 37898 if (retVal === INVALID_VALUE) { 37899 if (initializing) { 37900 newVal = cfg.defaultValue; 37901 } else { 37902 allowSet = false;
37903 } 37904 } else if (retVal !== undefined){ 37905 newVal = retVal; 37906 } 37907 } 37908 } 37909 37910 if (allowSet) { 37911 if(!subAttrName && (newVal === prevRawVal) && !Lang.isObject(newVal)) { 37912 allowSet = false; 37913 } else { 37914 // Store value 37915 if (!(INIT_VALUE in cfg)) { 37916 cfg.initValue = newVal; 37917 } 37918 host._setStateVal(attrName, newVal); 37919 } 37920 } 37921 37922 } else { 37923 allowSet = false; 37924 } 37925 37926 return allowSet; 37927 }, 37928 37929 /** 37930 * Sets multiple attribute values. 37931 * 37932 * @method setAttrs 37933 * @param {Object} attrs An object with attributes name/value pairs. 37934 * @param {Object} [opts] Optional data providing the circumstances for the change. 37935 * @return {Object} A reference to the host object. 37936 * @chainable 37937 */ 37938 setAttrs : function(attrs, opts) { 37939 return this._setAttrs(attrs, opts); 37940 }, 37941 37942 /** 37943 * Implementation behind the public setAttrs method, to set multiple attribute values. 37944 * 37945 * @method _setAttrs 37946 * @protected 37947 * @param {Object} attrs An object with attributes name/value pairs. 37948 * @param {Object} [opts] Optional data providing the circumstances for the change 37949 * @return {Object} A reference to the host object. 37950 * @chainable 37951 */ 37952 _setAttrs : function(attrs, opts) { 37953 var attr; 37954 for (attr in attrs) { 37955 if ( attrs.hasOwnProperty(attr) ) { 37956 this.set(attr, attrs[attr], opts); 37957 } 37958 } 37959 return this; 37960 }, 37961 37962 /** 37963 * Gets multiple attribute values. 37964 * 37965 * @method getAttrs 37966 * @param {String[]|Boolean} attrs Optional. An array of attribute names. If omitted, all attribute values are 37967 * returned. If set to true, all attributes modified from their initial values are returned. 37968 * @return {Object} An object with attribute name/value pairs. 37969 */ 37970 getAttrs : function(attrs) { 37971 return this._getAttrs(attrs); 37972 }, 37973 37974 /** 37975 * Implementation behind the public getAttrs method, to get multiple attribute values. 37976 * 37977 * @method _getAttrs 37978 * @protected 37979 * @param {String[]|Boolean} attrs Optional. An array of attribute names. If omitted, all attribute values are 37980 * returned. If set to true, all attributes modified from their initial values are returned. 37981 * @return {Object} An object with attribute name/value pairs. 37982 */ 37983 _getAttrs : function(attrs) { 37984 var obj = {}, 37985 attr, i, len, 37986 modifiedOnly = (attrs === true); 37987 37988 // TODO - figure out how to get all "added" 37989 if (!attrs || modifiedOnly) { 37990 attrs = O.keys(this._state.data); 37991 } 37992 37993 for (i = 0, len = attrs.length; i < len; i++) { 37994 attr = attrs[i]; 37995 37996 if (!modifiedOnly || this._getStateVal(attr) != this._state.get(attr, INIT_VALUE)) { 37997 // Go through get, to honor cloning/normalization 37998 obj[attr] = this.get(attr); 37999 } 38000 } 38001 38002 return obj; 38003 }, 38004 38005 /** 38006 * Configures a group of attributes, and sets initial values. 38007 * 38008 * <p> 38009 * <strong>NOTE:</strong> This method does not isolate the configuration object by merging/cloning. 38010 * The caller is responsible for merging/cloning the configuration object if required. 38011 * </p> 38012 * 38013 * @method addAttrs 38014 * @chainable 38015 * 38016 * @param {Object} cfgs An object with attribute name/configuration pairs. 38017 * @param {Object} values An object with attribute name/value pairs, defining the initial values to apply. 38018 * Values defined in the cfgs argument will be over-written by values in this argument unless defined as read only. 38019 * @param {boolean} lazy Whether or not to delay the intialization of these attributes until the first call to get/set.
38020 * Individual attributes can over-ride this behavior by defining a lazyAdd configuration property in their configuration. 38021 * See <a href="#method_addAttr">addAttr</a>. 38022 * 38023 * @return {Object} A reference to the host object. 38024 */ 38025 addAttrs : function(cfgs, values, lazy) { 38026 if (cfgs) { 38027 this._tCfgs = cfgs; 38028 this._tVals = (values) ? this._normAttrVals(values) : null; 38029 this._addAttrs(cfgs, this._tVals, lazy); 38030 this._tCfgs = this._tVals = null; 38031 } 38032 38033 return this; 38034 }, 38035 38036 /** 38037 * Implementation behind the public addAttrs method. 38038 * 38039 * This method is invoked directly by get if it encounters a scenario 38040 * in which an attribute's valueFn attempts to obtain the 38041 * value an attribute in the same group of attributes, which has not yet 38042 * been added (on demand initialization). 38043 * 38044 * @method _addAttrs 38045 * @private 38046 * @param {Object} cfgs An object with attribute name/configuration pairs. 38047 * @param {Object} values An object with attribute name/value pairs, defining the initial values to apply. 38048 * Values defined in the cfgs argument will be over-written by values in this argument unless defined as read only. 38049 * @param {boolean} lazy Whether or not to delay the intialization of these attributes until the first call to get/set. 38050 * Individual attributes can over-ride this behavior by defining a lazyAdd configuration property in their configuration. 38051 * See <a href="#method_addAttr">addAttr</a>. 38052 */ 38053 _addAttrs : function(cfgs, values, lazy) { 38054 var tCfgs = this._tCfgs, 38055 tVals = this._tVals, 38056 attr, 38057 attrCfg, 38058 value; 38059 38060 for (attr in cfgs) { 38061 if (cfgs.hasOwnProperty(attr)) { 38062 38063 // Not Merging. Caller is responsible for isolating configs 38064 attrCfg = cfgs[attr]; 38065 attrCfg.defaultValue = attrCfg.value; 38066 38067 // Handle simple, complex and user values, accounting for read-only 38068 value = this._getAttrInitVal(attr, attrCfg, tVals); 38069 38070 if (value !== undefined) { 38071 attrCfg.value = value; 38072 } 38073 38074 if (tCfgs[attr]) { 38075 tCfgs[attr] = undefined; 38076 } 38077 38078 this.addAttr(attr, attrCfg, lazy); 38079 } 38080 } 38081 }, 38082 38083 /** 38084 * Utility method to protect an attribute configuration 38085 * hash, by merging the entire object and the individual 38086 * attr config objects. 38087 * 38088 * @method _protectAttrs 38089 * @protected 38090 * @param {Object} attrs A hash of attribute to configuration object pairs. 38091 * @return {Object} A protected version of the attrs argument. 38092 * @deprecated Use `AttributeCore.protectAttrs()` or 38093 * `Attribute.protectAttrs()` which are the same static utility method. 38094 */ 38095 _protectAttrs : AttributeCore.protectAttrs, 38096 38097 /** 38098 * Utility method to normalize attribute values. The base implementation 38099 * simply merges the hash to protect the original. 38100 * 38101 * @method _normAttrVals 38102 * @param {Object} valueHash An object with attribute name/value pairs 38103 * 38104 * @return {Object} An object literal with 2 properties - "simple" and "complex", 38105 * containing simple and complex attribute values respectively keyed 38106 * by the top level attribute name, or null, if valueHash is falsey. 38107 * 38108 * @private 38109 */ 38110 _normAttrVals : function(valueHash) { 38111 var vals, 38112 subvals, 38113 path, 38114 attr, 38115 v, k; 38116 38117 if (!valueHash) { 38118 return null; 38119 } 38120 38121 vals = {}; 38122 38123 for (k in valueHash) { 38124 if (valueHash.hasOwnProperty(k)) { 38125 if (k.indexOf(DOT) !== -1) { 38126 path = k.split(DOT); 38127 attr = path.shift(); 38128 38129 subvals = subvals || {}; 38130 38131 v = subvals[attr] = subvals[attr] || []; 38132 v[v.length] = { 38133 path : path, 38134 value: valueHash[k] 38135 }; 38136 } else { 38137 vals[k] = valueHash[k]; 38138 } 38139 } 38140 } 38141 38142 return { simple:vals, complex:subvals }; 38143 }, 38144 38145 /** 38146 * Returns the initial value of the given attribute from 38147 * either the default configuration provided, or the 38148 * over-ridden value if it exists in the set of initValues 38149 * provided and the attribute is not read-only. 38150 * 38151 * @param {String} attr The name of the attribute 38152 * @param {Object} cfg The attribute configuration object 38153 * @param {Object}
38153 initValues The object with simple and complex attribute name/value pairs returned from _normAttrVals 38154 * 38155 * @return {Any} The initial value of the attribute. 38156 * 38157 * @method _getAttrInitVal 38158 * @private 38159 */ 38160 _getAttrInitVal : function(attr, cfg, initValues) { 38161 var val = cfg.value, 38162 valFn = cfg.valueFn, 38163 tmpVal, 38164 initValSet = false, 38165 readOnly = cfg.readOnly, 38166 simple, 38167 complex, 38168 i, 38169 l, 38170 path, 38171 subval, 38172 subvals; 38173 38174 if (!readOnly && initValues) { 38175 // Simple Attributes 38176 simple = initValues.simple; 38177 if (simple && simple.hasOwnProperty(attr)) { 38178 val = simple[attr]; 38179 initValSet = true; 38180 } 38181 } 38182 38183 if (valFn && !initValSet) { 38184 if (!valFn.call) { 38185 valFn = this[valFn]; 38186 } 38187 if (valFn) { 38188 tmpVal = valFn.call(this, attr); 38189 val = tmpVal; 38190 } 38191 } 38192 38193 if (!readOnly && initValues) { 38194 38195 // Complex Attributes (complex values applied, after simple, in case both are set) 38196 complex = initValues.complex; 38197 38198 if (complex && complex.hasOwnProperty(attr) && (val !== undefined) && (val !== null)) { 38199 subvals = complex[attr]; 38200 for (i = 0, l = subvals.length; i < l; ++i) { 38201 path = subvals[i].path; 38202 subval = subvals[i].value; 38203 O.setValue(val, path, subval); 38204 } 38205 } 38206 } 38207 38208 return val; 38209 }, 38210 38211 /** 38212 * Utility method to set up initial attributes defined during construction, 38213 * either through the constructor.ATTRS property, or explicitly passed in. 38214 * 38215 * @method _initAttrs 38216 * @protected 38217 * @param attrs {Object} The attributes to add during construction (passed through to <a href="#method_addAttrs">addAttrs</a>). 38218 * These can also be defined on the constructor being augmented with Attribute by defining the ATTRS property on the constructor. 38219 * @param values {Object} The initial attribute values to apply (passed through to <a href="#method_addAttrs">addAttrs</a>). 38220 * These are not merged/cloned. The caller is responsible for isolating user provided values if required. 38221 * @param lazy {boolean} Whether or not to add attributes lazily (passed through to <a href="#method_addAttrs">addAttrs</a>). 38222 */ 38223 _initAttrs : function(attrs, values, lazy) { 38224 // ATTRS support for Node, which is not Base based 38225 attrs = attrs || this.constructor.ATTRS; 38226 38227 var Base = Y.Base, 38228 BaseCore = Y.BaseCore, 38229 baseInst = (Base && Y.instanceOf(this, Base)), 38230 baseCoreInst = (!baseInst && BaseCore && Y.instanceOf(this, BaseCore)); 38231 38232 if (attrs && !baseInst && !baseCoreInst) { 38233 this.addAttrs(Y.AttributeCore.protectAttrs(attrs), values, lazy); 38234 } 38235 } 38236 }; 38237 38238 Y.AttributeCore = AttributeCore; 38239 38240 38241}, 'patched-v3.18.3', {"requires": ["oop"]}); 38242 38243YUI.add('attribute-observable', function (Y, NAME) { 38244 38245 /*For log lines*/ 38246 /*jshint maxlen:200*/ 38247 38248 38249 /** 38250 * The attribute module provides an augmentable Attribute implementation, which 38251 * adds configurable attributes and attribute change events to the class being 38252 * augmented. It also provides a State class, which is used internally by Attribute, 38253 * but can also be used independently to provide a name/property/value data structure to 38254 * store state. 38255 * 38256 * @module attribute 38257 */ 38258 38259 /** 38260 * The `attribute-observable` submodule provides augmentable attribute change event support 38261 * for AttributeCore based implementations. 38262 * 38263 * @module attribute 38264 * @submodule attribute-observable 38265 */ 38266 var EventTarget = Y.EventTarget, 38267 38268 CHANGE = "Change", 38269 BROADCAST = "broadcast"; 38270 38271 /** 38272 * Provides an augmentable implementation of attribute change events for 38273 * AttributeCore. 38274 * 38275 * @class AttributeObservable 38276 * @extensionfor AttributeCore 38277 * @uses EventTarget 38278 */ 38279 function AttributeObservable() { 38280 // Perf tweak - avoid creating event literals if not required. 38281 this._ATTR_E_FACADE = {}; 38282 38283 EventTarget.call(this, {emitFacade:true}); 38284 } 38285 38286 AttributeObservable._ATTR_CFG = [BROADCAST]; 38287 38288 AttributeObservable.prototype = { 38289 38290 /** 38291 * Sets the value of an attribute. 38292 * 38293 * @method set 38294 * @chainable 38295 * 38296 * @param {String} name The name of the attribute. If the 38297 * current value of the attribute is an Object, dot notation can be used 38298 * to set the value of a property within the object (e.g. <code>set("x.y.z", 5)</code>). 38299 * 38300 * @param {Any} value The value to set the attribute to. 38301 * 38302 * @param {Object} opts (Optional) Optional event data to be mixed into 38303 * the event facade passed to subscribers of the attribute's change event. This 38304 * can be used as a flexible way to identify the source of a call to set, allowing 38305 * the developer to distinguish between set called internally by the host, vs. 38306 * set called externally by the application developer. 38307 * 38308 * @return {Object} A reference to the host object. 38309 */ 38310 set : function(name, val, opts) { 38311 return this._setAttr(name, val, opts); 38312 }, 38313 38314 /** 38315 * Allows setting of readOnly/writeOnce attributes. See <a href="#method_set">set</a> for argument details. 38316 * 38317 * @method _set 38318 * @protected 38319 * @chainable 38320 * 38321 * @param {String} name The name of the attribute. 38322 * @param {Any} val The value to set the attribute to. 38323 * @param {Object} opts (Optional) Optional event data to be mixed into 38324 * the event facade passed to subscribers of the attribute's change event. 38325 * @return {Object} A reference to the host object. 38326 */ 38327 _set : function(name, val, opts) { 38328 return this._setAttr(name, val, opts, true); 38329 }, 38330 38331 /** 38332 * Sets multiple attribute values. 38333 * 38334 * @method setAttrs 38335 * @param {Object} attrs An object with attributes name/value pairs. 38336 * @param {Object} opts Properties to mix into the event payload. These are shared and mixed into each set 38337 * @return {Object} A reference to the host object. 38338 * @chainable 38339 */ 38340 setAttrs : function(attrs, opts) { 38341 return this._setAttrs(attrs, opts); 38342 }, 38343 38344 /** 38345 * Implementation behind the public setAttrs method, to set multiple attribute values. 38346 * 38347 * @method _setAttrs 38348 * @protected 38349 * @param {Object} attrs An object with attributes name/value pairs. 38350 * @param {Object} opts Properties to mix into the event payload. These are shared and mixed into each set 38351 * @return {Object} A reference to the host object. 38352 * @chainable 38353 */ 38354 _setAttrs : function(attrs, opts) { 38355 var attr; 38356 for (attr in attrs) { 38357 if ( attrs.hasOwnProperty(attr) ) { 38358 this.set(attr, attrs[attr], opts); 38359 } 38360 } 38361 return this; 38362 }, 38363 38364 /** 38365 * Utility method to help setup the event payload and fire the attribute change event. 38366 * 38367 * @method _fireAttrChange 38368 * @private 38369 * @param {String} attrName The name of the attribute 38370 * @param {String} subAttrName The full path of the property being changed, 38371 * if this is a sub-attribute value being change. Otherwise null. 38372 * @param {Any} currVal The current value of the attribute 38373 * @param {Any} newVal The new value of the attribute 38374 * @param {Object} opts Any additional event data to mix into the attribute change event's event facade. 38375 * @param {Object} [cfg] The attribute config stored in State, if already available. 38376 */ 38377 _fireAttrChange : function(attrName, subAttrName, currVal, newVal, opts, cfg) { 38378 var host = this, 38379 eventName = this._getFullType(attrName + CHANGE), 38380 state = host._state, 38381 facade, 38382 broadcast, 38383 e; 38384 38385 if (!cfg) { 38386 cfg = state.data[attrName] || {}; 38387 } 38388 38389 if (!cfg.published) { 38390 38391 // PERF: Using lower level _publish() for 38392 // critical path performance 38393 e = host._publish(eventName); 38394 38395 e.emitFacade = true; 38396 e.defaultTargetOnly = true; 38397 e.defaultFn = host._defAttrChangeFn; 38398 38399 broadcast = cfg.broadcast; 38400 if (broadcast !== undefined) { 38401 e.broadcast = broadcast; 38402 } 38403 38404 cfg.published = true; 38405 } 38406 38407 if (opts) { 38408 facade = Y.merge(opts); 38409 facade._attrOpts = opts; 38410 } else { 38411 facade = host._ATTR_E_FACADE; 38412 } 38413 38414 // Not using the single object signature for fire({type:..., newVal:...}), since 38415 // we don't want to override type. Changed to the fire(type, {newVal:...}) signature. 38416 38417 facade.attrName = attrName; 38418 facade.subAttrName = subAttrName; 38419 facade.prevVal = currVal; 38420 facade.newVal = newVal; 38421 38422 if (host._hasPotentialSubscribers(eventName)) { 38423 host.fire(eventName, facade); 38424 } else { 38425 this._setAttrVal(attrName, subAttrName, currVal, newVal, opts, cfg); 38426 } 38427 }, 38428 38429 /** 38430 * Default function for attribute change events. 38431 * 38432 * @private 38433 * @method _defAttrChangeFn 38434 * @param {EventFacade} e The event object for attribute change events. 38435 * @param {boolean} eventFastPath Whether or not we're using this as a fast path in the case of no listeners or not 38436 */ 38437 _defAttrChangeFn : function(e, eventFastPath) { 38438 38439 var opts = e._attrOpts; 38440 if (opts) { 38441 delete e._attrOpts; 38442 } 38443 38444 if (!this._setAttrVal(e.attrName, e.subAttrName, e.prevVal, e.newVal, opts)) { 38445 38446 38447 if (!eventFastPath) { 38448 // Prevent "after" listeners from being invoked since nothing changed. 38449 e.stopImmediatePropagation(); 38450 } 38451 38452 } else { 38453 if (!eventFastPath) { 38454 e.newVal = this.get(e.attrName); 38455 } 38456 } 38457 } 38458 }; 38459 38460 // Basic prototype augment - no lazy constructor invocation. 38461 Y.mix(AttributeObservable, EventTarget, false, null, 1); 38462 38463 Y.AttributeObservable = AttributeObservable; 38464 38465 /**
38466 The `AttributeEvents` class extension was deprecated in YUI 3.8.0 and is now 38467 an alias for the `AttributeObservable` class extension. Use that class 38468 extnesion instead. This alias will be removed in a future version of YUI. 38469 38470 @class AttributeEvents 38471 @uses EventTarget 38472 @deprecated Use `AttributeObservable` instead. 38473 @see AttributeObservable 38474 **/ 38475 Y.AttributeEvents = AttributeObservable; 38476 38477 38478}, 'patched-v3.18.3', {"requires": ["event-custom"]}); 38479 38480YUI.add('attribute-extras', function (Y, NAME) { 38481 38482 /** 38483 * The attribute module provides an augmentable Attribute implementation, which 38484 * adds configurable attributes and attribute change events to the class being 38485 * augmented. It also provides a State class, which is used internally by Attribute, 38486 * but can also be used independently to provide a name/property/value data structure to 38487 * store state. 38488 * 38489 * @module attribute 38490 */ 38491 38492 /** 38493 * The attribute-extras submodule provides less commonly used attribute methods, and can 38494 * be augmented/mixed into an implemention which used attribute-core. 38495 * 38496 * @module attribute 38497 * @submodule attribute-extras 38498 */ 38499 var BROADCAST = "broadcast", 38500 PUBLISHED = "published", 38501 INIT_VALUE = "initValue", 38502 38503 MODIFIABLE = { 38504 readOnly:1, 38505 writeOnce:1, 38506 getter:1, 38507 broadcast:1 38508 }; 38509 38510 /** 38511 * A augmentable implementation for AttributeCore, providing less frequently used 38512 * methods for Attribute management such as modifyAttrs(), removeAttr and reset() 38513 * 38514 * @class AttributeExtras 38515 * @extensionfor AttributeCore 38516 */ 38517 function AttributeExtras() {} 38518 38519 AttributeExtras.prototype = { 38520 38521 /** 38522 * Updates the configuration of an attribute which has already been added. 38523 * <p> 38524 * The properties which can be modified through this interface are limited 38525 * to the following subset of attributes, which can be safely modified 38526 * after a value has already been set on the attribute: 38527 * </p> 38528 * <dl> 38529 * <dt>readOnly;</dt> 38530 * <dt>writeOnce;</dt> 38531 * <dt>broadcast; and</dt> 38532 * <dt>getter.</dt> 38533 * </dl> 38534 * <p> 38535 * Note: New attributes cannot be added using this interface. New attributes must be 38536 * added using {{#crossLink "AttributeCore/addAttr:method"}}addAttr{{/crossLink}}, or an 38537 * appropriate manner for a class which utilises Attributes (e.g. the 38538 * {{#crossLink "Base/ATTRS:property"}}ATTRS{{/crossLink}} property in 38539 * {{#crossLink "Base"}}Base{{/crossLink}}). 38540 * </p> 38541 * @method modifyAttr 38542 * @param {String} name The name of the attribute whose configuration is to be updated. 38543 * @param {Object} config An object with configuration property/value pairs, specifying the configuration properties to modify. 38544 */ 38545 modifyAttr: function(name, config) { 38546 var host = this, // help compression 38547 prop, state; 38548 38549 if (host.attrAdded(name)) { 38550 38551 if (host._isLazyAttr(name)) { 38552 host._addLazyAttr(name); 38553 } 38554 38555 state = host._state; 38556 for (prop in config) { 38557 if (MODIFIABLE[prop] && config.hasOwnProperty(prop)) { 38558 state.add(name, prop, config[prop]); 38559 38560 // If we reconfigured broadcast, need to republish 38561 if (prop === BROADCAST) { 38562 state.remove(name, PUBLISHED); 38563 } 38564 } 38565 } 38566 } else { 38567 } 38568 }, 38569 38570 /** 38571 * Removes an attribute from the host object 38572 * 38573 * @method removeAttr 38574 * @param {String} name The name of the attribute to be removed. 38575 */ 38576 removeAttr: function(name) { 38577 this._state.removeAll(name); 38578 }, 38579 38580 /** 38581 * Resets the attribute (or all attributes) to its initial value, as long as 38582 * the attribute is not readOnly, or writeOnce. 38583 * 38584 * @method reset 38585 * @param {String} name Optional. The name of the attribute to reset. If omitted, all attributes are reset. 38586 * @return {Object} A reference to the host object. 38587 * @chainable 38588 */ 38589 reset : function(name) { 38590 var host = this; // help compression 38591 38592 if (name) { 38593 if (host._isLazyAttr(name)) { 38594 host._addLazyAttr(name); 38595 } 38596 host.set(name, host._state.get(name, INIT_VALUE)); 38597 } else { 38598 Y.Object.each(host._state.data, function(v, n) { 38599 host.reset(n); 38600 }); 38601 } 38602 return host; 38603 }, 38604 38605 /** 38606 * Returns an object with the configuration properties (and value) 38607 * for the given attribute. If attrName is not provided, returns the 38608 * configuration properties for all attributes. 38609 * 38610 * @method _getAttrCfg 38611 * @protected 38612 * @param {String} name Optional. The attribute name. If not provided, the method will return the configuration for all attributes. 38613 * @return {Object} The configuration properties for the given attribute, or all attributes. 38614 */ 38615 _getAttrCfg : function(name) { 38616 var o, 38617 state = this._state; 38618 38619 if (name) { 38620 o = state.getAll(name) || {}; 38621 } else { 38622 o = {}; 38623 Y.each(state.data, function(v, n) { 38624 o[n] = state.getAll(n); 38625 }); 38626 } 38627 38628 return o; 38629 } 38630 }; 38631 38632 Y.AttributeExtras = AttributeExtras; 38633 38634 38635}, 'patched-v3.18.3', {"requires": ["oop"]}); 38636 38637YUI.add('base-base', function (Y, NAME) { 38638 38639 /** 38640 * The base module provides the Base class, which objects requiring attribute and custom event support can extend. 38641 * The module also provides two ways to reuse code - It augments Base with the Plugin.Host interface which provides 38642 * plugin support and also provides the BaseCore.build method which provides a way to build custom classes using extensions. 38643 * 38644 * @module base 38645 */ 38646 38647 /** 38648 * The base-base submodule provides the Base class without the Plugin support, provided by Plugin.Host, 38649 * and without the extension support provided by BaseCore.build. 38650 * 38651 * @module base 38652 * @submodule base-base 38653 */ 38654 38655 var AttributeCore = Y.AttributeCore, 38656 AttributeExtras = Y.AttributeExtras, 38657 BaseCore = Y.BaseCore, 38658 BaseObservable = Y.BaseObservable; 38659 38660 /** 38661 * <p> 38662 * A base class which objects requiring attributes and custom event support can 38663 * extend. Base also handles the chaining of initializer and destructor methods across
38664 * the hierarchy as part of object construction and destruction. Additionally, attributes configured 38665 * through the static <a href="#property_ATTRS">ATTRS</a> property for each class 38666 * in the hierarchy will be initialized by Base. 38667 * </p> 38668 * 38669 * <p> 38670 * **NOTE:** Prior to version 3.11.0, ATTRS would get added a class at a time. That is, 38671 * Base would loop through each class in the hierarchy, and add the class' ATTRS, and 38672 * then call it's initializer, and move on to the subclass' ATTRS and initializer. As of 38673 * 3.11.0, ATTRS from all classes in the hierarchy are added in one `addAttrs` call before 38674 * any initializers are called. This fixes subtle edge-case issues with subclass ATTRS overriding 38675 * superclass `setter`, `getter` or `valueFn` definitions and being unable to get/set attributes 38676 * defined by the subclass. This order of operation change may impact `setter`, `getter` or `valueFn` 38677 * code which expects a superclass' initializer to have run. This is expected to be rare, but to support 38678 * it, Base supports a `_preAddAttrs()`, method hook (same signature as `addAttrs`). Components can 38679 * implement this method on their prototype for edge cases which do require finer control over 38680 * the order in which attributes are added (see widget-htmlparser). 38681 * </p> 38682 * 38683 * <p> 38684 * The static <a href="#property_NAME">NAME</a> property of each class extending 38685 * from Base will be used as the identifier for the class, and is used by Base to prefix 38686 * all events fired by instances of that class. 38687 * </p> 38688 * 38689 * @class Base 38690 * @constructor 38691 * @uses BaseCore 38692 * @uses BaseObservable 38693 * @uses AttributeCore 38694 * @uses AttributeObservable 38695 * @uses AttributeExtras 38696 * @uses EventTarget 38697 * 38698 * @param {Object} config Object with configuration property name/value pairs. The object can be 38699 * used to provide default values for the objects published attributes. 38700 * 38701 * <p> 38702 * The config object can also contain the following non-attribute properties, providing a convenient 38703 * way to configure events listeners and plugins for the instance, as part of the constructor call: 38704 * </p> 38705 * 38706 * <dl> 38707 * <dt>on</dt> 38708 * <dd>An event name to listener function map, to register event listeners for the "on" moment of the event. 38709 * A constructor convenience property for the <a href="Base.html#method_on">on</a> method.</dd> 38710 * <dt>after</dt> 38711 * <dd>An event name to listener function map, to register event listeners for the "after" moment of the event. 38712 * A constructor convenience property for the <a href="Base.html#method_after">after</a> method.</dd> 38713 * <dt>bubbleTargets</dt> 38714 * <dd>An object, or array of objects, to register as bubble targets for bubbled events fired by this instance. 38715 * A constructor convenience property for the <a href="EventTarget.html#method_addTarget">addTarget</a> method.</dd> 38716 * <dt>plugins</dt> 38717 * <dd>A plugin, or array of plugins to be plugged into the instance (see PluginHost's plug method for signature details). 38718 * A constructor convenience property for the <a href="Plugin.Host.html#method_plug">plug</a> method.</dd> 38719 * </dl> 38720 */ 38721 function Base() { 38722 BaseCore.apply(this, arguments); 38723 BaseObservable.apply(this, arguments); 38724 AttributeExtras.apply(this, arguments); 38725 } 38726 38727 /** 38728 * The list of properties which can be configured for 38729 * each attribute (e.g. setter, getter, writeOnce, readOnly etc.) 38730 * 38731 * @property _ATTR_CFG 38732 * @type Array 38733 * @static 38734 * @private 38735 */ 38736 Base._ATTR_CFG = BaseCore._ATTR_CFG.concat(BaseObservable._ATTR_CFG); 38737 38738 /** 38739 * The array of non-attribute configuration properties supported by this class. 38740 * 38741 * `Base` supports "on", "after", "plugins" and "bubbleTargets" properties, 38742 * which are not set up as attributes. 38743 * 38744 * This property is primarily required so that when 38745 * <a href="#property__allowAdHocAttrs">`_allowAdHocAttrs`</a> is enabled by 38746 * a class, non-attribute configurations don't get added as ad-hoc attributes. 38747 * 38748 * @property _NON_ATTRS_CFG 38749 * @type Array 38750 * @static 38751 * @private 38752 */ 38753 Base._NON_ATTRS_CFG = BaseCore._NON_ATTRS_CFG.concat(BaseObservable._NON_ATTRS_CFG); 38754 38755 /** 38756 * <p> 38757 * The string to be used to identify instances of 38758 * this class, for example in prefixing events. 38759 * </p> 38760 * <p> 38761 * Classes extending Base, should define their own
38762 * static NAME property, which should be camelCase by 38763 * convention (e.g. MyClass.NAME = "myClass";). 38764 * </p> 38765 * @property NAME 38766 * @type String 38767 * @static 38768 */ 38769 Base.NAME = 'base'; 38770 38771 /** 38772 * The default set of attributes which will be available for instances of this class, and 38773 * their configuration. In addition to the configuration properties listed by 38774 * Attribute's <a href="Attribute.html#method_addAttr">addAttr</a> method, the attribute 38775 * can also be configured with a "cloneDefaultValue" property, which defines how the statically 38776 * defined value field should be protected ("shallow", "deep" and false are supported values). 38777 * 38778 * By default if the value is an object literal or an array it will be "shallow" cloned, to 38779 * protect the default value. 38780 * 38781 * @property ATTRS 38782 * @type Object 38783 * @static 38784 */ 38785 Base.ATTRS = AttributeCore.protectAttrs(BaseCore.ATTRS); 38786 38787 /** 38788 Provides a way to safely modify a `Y.Base` subclass' static `ATTRS` after 38789 the class has been defined or created. 38790 38791 Base-based classes cache information about the class hierarchy in order to 38792 efficiently create instances. This cache includes includes the aggregated 38793 `ATTRS` configs. If the static `ATTRS` configs need to be modified after the 38794 class has been defined or create, then use this method which will make sure 38795 to clear any cached data before making any modifications. 38796 38797 @method modifyAttrs 38798 @param {Function} [ctor] The constructor function whose `ATTRS` should be 38799 modified. If a `ctor` function is not specified, then `this` is assumed 38800 to be the constructor which hosts the `ATTRS`. 38801 @param {Object} configs The collection of `ATTRS` configs to mix with the 38802 existing attribute configurations. 38803 @static 38804 @since 3.10.0 38805 **/ 38806 Base.modifyAttrs = BaseCore.modifyAttrs; 38807 38808 Y.mix(Base, BaseCore, false, null, 1); 38809 Y.mix(Base, AttributeExtras, false, null, 1); 38810 38811 // Needs to be `true`, to overwrite methods from `BaseCore`. 38812 Y.mix(Base, BaseObservable, true, null, 1); 38813 38814 // Fix constructor 38815 Base.prototype.constructor = Base; 38816 38817 Y.Base = Base; 38818 38819 38820}, 'patched-v3.18.3', {"requires": ["attribute-base", "base-core", "base-observable"]}); 38821 38822YUI.add('base-pluginhost', function (Y, NAME) { 38823 38824 /** 38825 * The base-pluginhost submodule adds Plugin support to Base, by augmenting Base with 38826 * Plugin.Host and setting up static (class level) Base.plug and Base.unplug methods. 38827 * 38828 * @module base 38829 * @submodule base-pluginhost 38830 * @for Base 38831 */ 38832 38833 var Base = Y.Base, 38834 PluginHost = Y.Plugin.Host; 38835 38836 Y.mix(Base, PluginHost, false, null, 1); 38837 38838 /** 38839 * Alias for <a href="Plugin.Host.html#method_Plugin.Host.plug">Plugin.Host.plug</a>. See aliased 38840 * method for argument and return value details. 38841 * 38842 * @method plug 38843 * @static 38844 */ 38845 Base.plug = PluginHost.plug; 38846 38847 /** 38848 * Alias for <a href="Plugin.Host.html#method_Plugin.Host.unplug">Plugin.Host.unplug</a>. See the 38849 * aliased method for argument and return value details. 38850 * 38851 * @method unplug 38852 * @static 38853 */ 38854 Base.unplug = PluginHost.unplug; 38855 38856 38857}, 'patched-v3.18.3', {"requires": ["base-base", "pluginhost"]}); 38858 38859YUI.add('classnamemanager', function (Y, NAME) { 38860 38861/** 38862* Contains a singleton (ClassNameManager) that enables easy creation and caching of 38863* prefixed class names. 38864* @module classnamemanager 38865*/ 38866 38867/** 38868 * A singleton class providing: 38869 * 38870 * <ul> 38871 * <li>Easy creation of prefixed class names</li> 38872 * <li>Caching of previously created class names for improved performance.</li> 38873 * </ul> 38874 * 38875 * @class ClassNameManager 38876 * @static 38877 */ 38878 38879// String constants 38880var CLASS_NAME_PREFIX = 'classNamePrefix', 38881 CLASS_NAME_DELIMITER = 'classNameDelimiter', 38882 CONFIG = Y.config; 38883 38884// Global config 38885 38886/** 38887 * Configuration property indicating the prefix for all CSS class names in this YUI instance. 38888 * 38889 * @property classNamePrefix 38890 * @type {String} 38891 * @default "yui" 38892 * @static 38893 */ 38894CONFIG[CLASS_NAME_PREFIX] = CONFIG[CLASS_NAME_PREFIX] || 'yui3'; 38895 38896/** 38897 * Configuration property indicating the delimiter used to compose all CSS class names in 38898 * this YUI instance. 38899 * 38900 * @property classNameDelimiter 38901 * @type {String} 38902 * @default "-" 38903 * @static 38904 */ 38905CONFIG[CLASS_NAME_DELIMITER] = CONFIG[CLASS_NAME_DELIMITER] || '-'; 38906 38907Y.ClassNameManager = function () { 38908 38909 var sPrefix = CONFIG[CLASS_NAME_PREFIX], 38910 sDelimiter = CONFIG[CLASS_NAME_DELIMITER]; 38911 38912 return { 38913 38914 /** 38915 * Returns a class name prefixed with the value of the 38916 * <code>Y.config.classNamePrefix</code> attribute + the provided strings. 38917 * Uses the <code>Y.config.classNameDelimiter</code> attribute to delimit the 38918 * provided strings. E.g. Y.ClassNameManager.getClassName('foo','bar'); // yui-foo-bar 38919 * 38920 * @method getClassName 38921 * @param {String} [classnameSection*] one or more classname sections to be joined 38922 * @param {Boolean} skipPrefix If set to true, the classname will not be prefixed with the default Y.config.classNameDelimiter value. 38923 */ 38924 getClassName: Y.cached(function () { 38925 38926 var args = Y.Array(arguments); 38927 38928 if (args[args.length-1] !== true) { 38929 args.unshift(sPrefix); 38930 } else { 38931 args.pop(); 38932 } 38933 38934 return args.join(sDelimiter); 38935 }) 38936 38937 }; 38938 38939}(); 38940 38941 38942}, 'patched-v3.18.3', {"requires": ["yui-base"]}); 38943 38944YUI.add('datatype-xml-format', function (Y, NAME) { 38945 38946/** 38947 * The Number Utility provides type-conversion and string-formatting 38948 * convenience methods for Numbers. 38949 * 38950 * @module datatype-xml 38951 * @submodule datatype-xml-format 38952 */ 38953 38954/** 38955 * XML provides a set of utility functions to operate against XML documents. 38956 * 38957 * @class XML 38958 * @static 38959 */ 38960var LANG = Y.Lang; 38961 38962Y.mix(Y.namespace("XML"), { 38963 /** 38964 * Converts data to type XMLDocument. 38965 * 38966 * @method format 38967 * @param data {XMLDocument} Data to convert. 38968 * @return {String} String. 38969 */ 38970 format: function(data) { 38971 try { 38972 if(!LANG.isUndefined(data.getXml)) { 38973 return data.getXml(); 38974 } 38975 38976 if(!LANG.isUndefined(XMLSerializer)) { 38977 return (new XMLSerializer()).serializeToString(data); 38978 } 38979 } 38980 catch(e) { 38981 if(data && data.xml) { 38982 return data.xml; 38983 } 38984 else { 38985 return (LANG.isValue(data) && data.toString) ? data.toString() : ""; 38986 } 38987 } 38988 } 38989}); 38990 38991Y.namespace("DataType"); 38992Y.DataType.XML = Y.XML; 38993 38994 38995}, 'patched-v3.18.3'); 38996 38997YUI.add('datatype-xml-parse', function (Y, NAME) { 38998 38999/** 39000 * Parse XML submodule. 39001 * 39002 * @module datatype-xml 39003 * @submodule datatype-xml-parse 39004 * @for XML 39005 */ 39006 39007Y.mix(Y.namespace("XML"), { 39008 /** 39009 * Converts data to type XMLDocument. 39010 * 39011 * @method parse 39012 * @param data {String} Data to convert. 39013 * @return {XMLDocument} XML Document. 39014 */ 39015 parse: function(data) { 39016 var xmlDoc = null, win; 39017 if (typeof data === "string") { 39018 win = Y.config.win; 39019 if (win.ActiveXObject !== undefined) { 39020 xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); 39021 xmlDoc.async = false;
39022 xmlDoc.loadXML(data); 39023 } else if (win.DOMParser !== undefined) { 39024 xmlDoc = new DOMParser().parseFromString(data, "text/xml"); 39025 } else if (win.Windows !== undefined) { 39026 xmlDoc = new Windows.Data.Xml.Dom.XmlDocument(); 39027 xmlDoc.loadXml(data); 39028 } 39029 } 39030 39031 if (xmlDoc === null || xmlDoc.documentElement === null || xmlDoc.documentElement.nodeName === "parsererror") { 39032 } 39033 39034 return xmlDoc; 39035 } 39036}); 39037 39038// Add Parsers shortcut 39039Y.namespace("Parsers").xml = Y.XML.parse; 39040 39041Y.namespace("DataType"); 39042Y.DataType.XML = Y.XML; 39043 39044 39045}, 'patched-v3.18.3'); 39046 39047YUI.add('dom-base', function (Y, NAME) { 39048 39049/** 39050* @for DOM 39051* @module dom 39052*/ 39053var documentElement = Y.config.doc.documentElement, 39054 Y_DOM = Y.DOM, 39055 TAG_NAME = 'tagName', 39056 OWNER_DOCUMENT = 'ownerDocument', 39057 EMPTY_STRING = '', 39058 addFeature = Y.Features.add, 39059 testFeature = Y.Features.test; 39060 39061Y.mix(Y_DOM, { 39062 /** 39063 * Returns the text content of the HTMLElement. 39064 * @method getText 39065 * @param {HTMLElement} element The html element. 39066 * @return {String} The text content of the element (includes text of any descending elements). 39067 */ 39068 getText: (documentElement.textContent !== undefined) ? 39069 function(element) { 39070 var ret = ''; 39071 if (element) { 39072 ret = element.textContent; 39073 } 39074 return ret || ''; 39075 } : function(element) { 39076 var ret = ''; 39077 if (element) { 39078 ret = element.innerText || element.nodeValue; // might be a textNode 39079 } 39080 return ret || ''; 39081 }, 39082 39083 /** 39084 * Sets the text content of the HTMLElement. 39085 * @method setText 39086 * @param {HTMLElement} element The html element. 39087 * @param {String} content The content to add. 39088 */ 39089 setText: (documentElement.textContent !== undefined) ? 39090 function(element, content) { 39091 if (element) { 39092 element.textContent = content; 39093 } 39094 } : function(element, content) { 39095 if ('innerText' in element) { 39096 element.innerText = content; 39097 } else if ('nodeValue' in element) { 39098 element.nodeValue = content; 39099 } 39100 }, 39101 39102 CUSTOM_ATTRIBUTES: (!documentElement.hasAttribute) ? { // IE < 8 39103 'for': 'htmlFor', 39104 'class': 'className' 39105 } : { // w3c 39106 'htmlFor': 'for', 39107 'className': 'class' 39108 }, 39109 39110 /** 39111 * Provides a normalized attribute interface. 39112 * @method setAttribute 39113 * @param {HTMLElement} el The target element for the attribute. 39114 * @param {String} attr The attribute to set. 39115 * @param {String} val The value of the attribute. 39116 */ 39117 setAttribute: function(el, attr, val, ieAttr) { 39118 if (el && attr && el.setAttribute) { 39119 attr = Y_DOM.CUSTOM_ATTRIBUTES[attr] || attr; 39120 el.setAttribute(attr, val, ieAttr); 39121 } 39122 }, 39123 39124 39125 /** 39126 * Provides a normalized attribute interface. 39127 * @method getAttribute 39128 * @param {HTMLElement} el The target element for the attribute. 39129 * @param {String} attr The attribute to get. 39130 * @return {String} The current value of the attribute. 39131 */ 39132 getAttribute: function(el, attr, ieAttr) { 39133 ieAttr = (ieAttr !== undefined) ? ieAttr : 2; 39134 var ret = ''; 39135 if (el && attr && el.getAttribute) { 39136 attr = Y_DOM.CUSTOM_ATTRIBUTES[attr] || attr; 39137 // BUTTON value issue for IE < 8 39138 ret = (el.tagName === "BUTTON" && attr === 'value') ? Y_DOM.getValue(el) : el.getAttribute(attr, ieAttr); 39139 39140 if (ret === null) { 39141 ret = ''; // per DOM spec 39142 } 39143 } 39144 return ret; 39145 }, 39146 39147 VALUE_SETTERS: {}, 39148 39149 VALUE_GETTERS: {}, 39150 39151 getValue: function(node) { 39152 var ret = '', // TODO: return null? 39153 getter; 39154 39155 if (node && node[TAG_NAME]) { 39156 getter = Y_DOM.VALUE_GETTERS[node[TAG_NAME].toLowerCase()]; 39157 39158 if (getter) { 39159 ret = getter(node); 39160 } else { 39161 ret = node.value; 39162 } 39163 } 39164 39165 // workaround for IE8 JSON stringify bug 39166 // which converts empty string values to null 39167 if (ret === EMPTY_STRING) { 39168 ret = EMPTY_STRING; // for real 39169 } 39170 39171 return (typeof ret === 'string') ? ret : ''; 39172 }, 39173 39174 setValue: function(node, val) { 39175 var setter; 39176 39177 if (node && node[TAG_NAME]) { 39178 setter = Y_DOM.VALUE_SETTERS[node[TAG_NAME].toLowerCase()]; 39179 val = (val === null) ? '' : val; 39180 if (setter) { 39181 setter(node, val); 39182 } else { 39183 node.value = val; 39184 } 39185 } 39186 }, 39187 39188 creators: {} 39189}); 39190 39191addFeature('value-set', 'select', { 39192 test: function() { 39193 var node = Y.config.doc.createElement('select'); 39194 node.innerHTML = '<option>1</option><option>2</option>'; 39195 node.value = '2'; 39196 return (node.value && node.value === '2'); 39197 } 39198}); 39199
39200if (!testFeature('value-set', 'select')) { 39201 Y_DOM.VALUE_SETTERS.select = function(node, val) { 39202 for (var i = 0, options = node.getElementsByTagName('option'), option; 39203 option = options[i++];) { 39204 if (Y_DOM.getValue(option) === val) { 39205 option.selected = true; 39206 //Y_DOM.setAttribute(option, 'selected', 'selected'); 39207 break; 39208 } 39209 } 39210 }; 39211} 39212 39213Y.mix(Y_DOM.VALUE_GETTERS, { 39214 button: function(node) { 39215 return (node.attributes && node.attributes.value) ? node.attributes.value.value : ''; 39216 } 39217}); 39218 39219Y.mix(Y_DOM.VALUE_SETTERS, { 39220 // IE: node.value changes the button text, which should be handled via innerHTML 39221 button: function(node, val) { 39222 var attr = node.attributes.value; 39223 if (!attr) { 39224 attr = node[OWNER_DOCUMENT].createAttribute('value'); 39225 node.setAttributeNode(attr); 39226 } 39227 39228 attr.value = val; 39229 } 39230}); 39231 39232 39233Y.mix(Y_DOM.VALUE_GETTERS, { 39234 option: function(node) { 39235 var attrs = node.attributes; 39236 return (attrs.value && attrs.value.specified) ? node.value : node.text; 39237 }, 39238 39239 select: function(node) { 39240 var val = node.value, 39241 options = node.options; 39242 39243 if (options && options.length) { 39244 // TODO: implement multipe select 39245 if (node.multiple) { 39246 } else if (node.selectedIndex > -1) { 39247 val = Y_DOM.getValue(options[node.selectedIndex]); 39248 } 39249 } 39250 39251 return val; 39252 } 39253}); 39254var addClass, hasClass, removeClass; 39255 39256Y.mix(Y.DOM, { 39257 /** 39258 * Determines whether a DOM element has the given className. 39259 * @method hasClass 39260 * @for DOM 39261 * @param {HTMLElement} element The DOM element. 39262 * @param {String} className the class name to search for 39263 * @return {Boolean} Whether or not the element has the given class. 39264 */ 39265 hasClass: function(node, className) { 39266 var re = Y.DOM._getRegExp('(?:^|\\s+)' + className + '(?:\\s+|$)'); 39267 return re.test(node.className); 39268 }, 39269 39270 /** 39271 * Adds a class name to a given DOM element. 39272 * @method addClass 39273 * @for DOM 39274 * @param {HTMLElement} element The DOM element. 39275 * @param {String} className the class name to add to the class attribute 39276 */ 39277 addClass: function(node, className) { 39278 if (!Y.DOM.hasClass(node, className)) { // skip if already present 39279 node.className = Y.Lang.trim([node.className, className].join(' ')); 39280 } 39281 }, 39282 39283 /** 39284 * Removes a class name from a given element. 39285 * @method removeClass 39286 * @for DOM 39287 * @param {HTMLElement} element The DOM element. 39288 * @param {String} className the class name to remove from the class attribute 39289 */ 39290 removeClass: function(node, className) { 39291 if (className && hasClass(node, className)) { 39292 node.className = Y.Lang.trim(node.className.replace(Y.DOM._getRegExp('(?:^|\\s+)' + 39293 className + '(?:\\s+|$)'), ' ')); 39294 39295 if ( hasClass(node, className) ) { // in case of multiple adjacent 39296 removeClass(node, className); 39297 } 39298 } 39299 }, 39300 39301 /** 39302 * Replace a class with another class for a given element. 39303 * If no oldClassName is present, the newClassName is simply added. 39304 * @method replaceClass 39305 * @for DOM 39306 * @param {HTMLElement} element The DOM element 39307 * @param {String} oldClassName the class name to be replaced 39308 * @param {String} newClassName the class name that will be replacing the old class name 39309 */ 39310 replaceClass: function(node, oldC, newC) { 39311 removeClass(node, oldC); // remove first in case oldC === newC 39312 addClass(node, newC); 39313 }, 39314 39315 /** 39316 * If the className exists on the node it is removed, if it doesn't exist it is added. 39317 * @method toggleClass 39318 * @for DOM 39319 * @param {HTMLElement} element The DOM element 39320 * @param {String} className the class name to be toggled 39321 * @param {Boolean} addClass optional boolean to indicate whether class 39322 * should be added or removed regardless of current state 39323 */ 39324 toggleClass: function(node, className, force) { 39325 var add = (force !== undefined) ? force : 39326 !(hasClass(node, className)); 39327 39328 if (add) { 39329 addClass(node, className); 39330 } else { 39331 removeClass(node, className); 39332 } 39333 } 39334}); 39335 39336hasClass = Y.DOM.hasClass; 39337removeClass = Y.DOM.removeClass; 39338addClass = Y.DOM.addClass; 39339 39340var re_tag = /<([a-z]+)/i, 39341 39342 Y_DOM = Y.DOM, 39343 39344 addFeature = Y.Features.add, 39345 testFeature = Y.Features.test, 39346 39347 creators = {}, 39348 39349 createFromDIV = function(html, tag) { 39350 var div = Y.config.doc.createElement('div'), 39351 ret = true; 39352 39353 div.innerHTML = html; 39354 if (!div.firstChild || div.firstChild.tagName !== tag.toUpperCase()) { 39355 ret = false;
39356 } 39357 39358 return ret; 39359 }, 39360 39361 re_tbody = /(?:\/(?:thead|tfoot|tbody|caption|col|colgroup)>)+\s*<tbody/, 39362 39363 TABLE_OPEN = '<table>', 39364 TABLE_CLOSE = '</table>', 39365 39366 selectedIndex; 39367 39368Y.mix(Y.DOM, { 39369 _fragClones: {}, 39370 39371 _create: function(html, doc, tag) { 39372 tag = tag || 'div'; 39373 39374 var frag = Y_DOM._fragClones[tag]; 39375 if (frag) { 39376 frag = frag.cloneNode(false); 39377 } else { 39378 frag = Y_DOM._fragClones[tag] = doc.createElement(tag); 39379 } 39380 frag.innerHTML = html; 39381 return frag; 39382 }, 39383 39384 _children: function(node, tag) { 39385 var i = 0, 39386 children = node.children, 39387 childNodes, 39388 hasComments, 39389 child; 39390 39391 if (children && children.tags) { // use tags filter when possible 39392 if (tag) { 39393 children = node.children.tags(tag); 39394 } else { // IE leaks comments into children 39395 hasComments = children.tags('!').length; 39396 } 39397 } 39398 39399 if (!children || (!children.tags && tag) || hasComments) { 39400 childNodes = children || node.childNodes; 39401 children = []; 39402 while ((child = childNodes[i++])) { 39403 if (child.nodeType === 1) { 39404 if (!tag || tag === child.tagName) { 39405 children.push(child); 39406 } 39407 } 39408 } 39409 } 39410 39411 return children || []; 39412 }, 39413 39414 /** 39415 * Creates a new dom node using the provided markup string. 39416 * @method create 39417 * @param {String} html The markup used to create the element 39418 * @param {HTMLDocument} doc An optional document context 39419 * @return {HTMLElement|DocumentFragment} returns a single HTMLElement 39420 * when creating one node, and a documentFragment when creating 39421 * multiple nodes. 39422 */ 39423 create: function(html, doc) { 39424 if (typeof html === 'string') { 39425 html = Y.Lang.trim(html); // match IE which trims whitespace from innerHTML 39426 39427 } 39428 39429 doc = doc || Y.config.doc; 39430 var m = re_tag.exec(html), 39431 create = Y_DOM._create, 39432 custom = creators, 39433 ret = null, 39434 creator, tag, node, nodes; 39435 39436 if (html != undefined) { // not undefined or null 39437 if (m && m[1]) { 39438 creator = custom[m[1].toLowerCase()]; 39439 if (typeof creator === 'function') { 39440 create = creator; 39441 } else { 39442 tag = creator; 39443 } 39444 } 39445 39446 node = create(html, doc, tag); 39447 nodes = node.childNodes; 39448 39449 if (nodes.length === 1) { // return single node, breaking parentNode ref from "fragment" 39450 ret = node.removeChild(nodes[0]); 39451 } else if (nodes[0] && nodes[0].className === 'yui3-big-dummy') { // using dummy node to preserve some attributes (e.g. OPTION not selected) 39452 selectedIndex = node.selectedIndex; 39453 39454 if (nodes.length === 2) { 39455 ret = nodes[0].nextSibling; 39456 } else { 39457 node.removeChild(nodes[0]); 39458 ret = Y_DOM._nl2frag(nodes, doc); 39459 } 39460 } else { // return multiple nodes as a fragment 39461 ret = Y_DOM._nl2frag(nodes, doc); 39462 } 39463 39464 } 39465 39466 return ret; 39467 }, 39468 39469 _nl2frag: function(nodes, doc) { 39470 var ret = null, 39471 i, len; 39472 39473 if (nodes && (nodes.push || nodes.item) && nodes[0]) { 39474 doc = doc || nodes[0].ownerDocument; 39475 ret = doc.createDocumentFragment(); 39476 39477 if (nodes.item) { // convert live list to static array 39478 nodes = Y.Array(nodes, 0, true); 39479 } 39480 39481 for (i = 0, len = nodes.length; i < len; i++) { 39482 ret.appendChild(nodes[i]); 39483 } 39484 } // else inline with log for minification 39485 return ret; 39486 }, 39487 39488 /** 39489 * Inserts content in a node at the given location 39490 * @method addHTML 39491 * @param {HTMLElement} node The node to insert into 39492 * @param {HTMLElement | Array | HTMLCollection} content The content to be inserted 39493 * @param {HTMLElement} where Where to insert the content 39494 * If no "where" is given, content is appended to the node 39495 * Possible values for "where" 39496 * <dl> 39497 * <dt>HTMLElement</dt> 39498 * <dd>The element to insert before</dd> 39499 * <dt>"replace"</dt> 39500 * <dd>Replaces the existing HTML</dd> 39501 * <dt>"before"</dt> 39502 * <dd>Inserts before the existing HTML</dd> 39503 * <dt>"before"</dt> 39504 * <dd>Inserts content before the node</dd> 39505 * <dt>"after"</dt> 39506 * <dd>Inserts content after the node</dd> 39507 * </dl> 39508 */ 39509 addHTML: function(node, content, where) { 39510 var nodeParent = node.parentNode, 39511 i = 0, 39512 item, 39513 ret = content, 39514 newNode; 39515 39516 39517 if (content != undefined) { // not null or undefined (maybe 0) 39518 if (content.nodeType) { // DOM node, just add it 39519 newNode = content; 39520 } else if (typeof content == 'string' || typeof content == 'number') { 39521 ret = newNode = Y_DOM.create(content); 39522 } else if (content[0] && content[0].nodeType) { // array or collection 39523 newNode = Y.config.doc.createDocumentFragment(); 39524 while ((item = content[i++])) { 39525 newNode.appendChild(item); // append to fragment for insertion 39526 } 39527 } 39528 } 39529 39530 if (where) { 39531 if (newNode && where.parentNode) { // insert regardless of relationship to node 39532 where.parentNode.insertBefore(newNode, where); 39533 } else { 39534 switch (where) { 39535 case 'replace': 39536 while (node.firstChild) { 39537 node.removeChild(node.firstChild); 39538 } 39539 if (newNode) { // allow empty content to clear node 39540 node.appendChild(newNode); 39541 } 39542 break; 39543 case 'before': 39544 if (newNode) { 39545 nodeParent.insertBefore(newNode, node); 39546 } 39547 break; 39548 case 'after': 39549 if (newNode) { 39550 if (node.nextSibling) { // IE errors if refNo
39550de is null 39551 nodeParent.insertBefore(newNode, node.nextSibling); 39552 } else { 39553 nodeParent.appendChild(newNode); 39554 } 39555 } 39556 break; 39557 default: 39558 if (newNode) { 39559 node.appendChild(newNode); 39560 } 39561 } 39562 } 39563 } else if (newNode) { 39564 node.appendChild(newNode); 39565 } 39566 39567 // `select` elements are the only elements with `selectedIndex`. 39568 // Don't grab the dummy `option` element's `selectedIndex`. 39569 if (node.nodeName == "SELECT" && selectedIndex > 0) { 39570 node.selectedIndex = selectedIndex - 1; 39571 } 39572 39573 return ret; 39574 }, 39575 39576 wrap: function(node, html) { 39577 var parent = (html && html.nodeType) ? html : Y.DOM.create(html), 39578 nodes = parent.getElementsByTagName('*'); 39579 39580 if (nodes.length) { 39581 parent = nodes[nodes.length - 1]; 39582 } 39583 39584 if (node.parentNode) { 39585 node.parentNode.replaceChild(parent, node); 39586 } 39587 parent.appendChild(node); 39588 }, 39589 39590 unwrap: function(node) { 39591 var parent = node.parentNode, 39592 lastChild = parent.lastChild, 39593 next = node, 39594 grandparent; 39595 39596 if (parent) { 39597 grandparent = parent.parentNode; 39598 if (grandparent) { 39599 node = parent.firstChild; 39600 while (node !== lastChild) { 39601 next = node.nextSibling; 39602 grandparent.insertBefore(node, parent); 39603 node = next; 39604 } 39605 grandparent.replaceChild(lastChild, parent); 39606 } else { 39607 parent.removeChild(node); 39608 } 39609 } 39610 } 39611}); 39612 39613addFeature('innerhtml', 'table', { 39614 test: function() { 39615 var node = Y.config.doc.createElement('table'); 39616 try { 39617 node.innerHTML = '<tbody></tbody>'; 39618 } catch(e) { 39619 return false; 39620 } 39621 return (node.firstChild && node.firstChild.nodeName === 'TBODY'); 39622 } 39623}); 39624 39625addFeature('innerhtml-div', 'tr', { 39626 test: function() { 39627 return createFromDIV('<tr></tr>', 'tr'); 39628 } 39629}); 39630 39631addFeature('innerhtml-div', 'script', { 39632 test: function() { 39633 return createFromDIV('<script></script>', 'script'); 39634 } 39635}); 39636 39637if (!testFeature('innerhtml', 'table')) { 39638 // TODO: thead/tfoot with nested tbody 39639 // IE adds TBODY when creating TABLE elements (which may share this impl) 39640 creators.tbody = function(html, doc) { 39641 var frag = Y_DOM.create(TABLE_OPEN + html + TABLE_CLOSE, doc), 39642 tb = Y.DOM._children(frag, 'tbody')[0]; 39643 39644 if (frag.children.length > 1 && tb && !re_tbody.test(html)) { 39645 tb.parentNode.removeChild(tb); // strip extraneous tbody 39646 } 39647 return frag; 39648 }; 39649} 39650 39651if (!testFeature('innerhtml-div', 'script')) { 39652 creators.script = function(html, doc) { 39653 var frag = doc.createElement('div'); 39654 39655 frag.innerHTML = '-' + html; 39656 frag.removeChild(frag.firstChild); 39657 return frag; 39658 }; 39659 39660 creators.link = creators.style = creators.script; 39661} 39662 39663if (!testFeature('innerhtml-div', 'tr')) { 39664 Y.mix(creators, { 39665 option: function(html, doc) { 39666 return Y_DOM.create('<select><option class="yui3-big-dummy" selected></option>' + html + '</select>', doc); 39667 }, 39668 39669 tr: function(html, doc) { 39670 return Y_DOM.create('<tbody>' + html + '</tbody>', doc); 39671 }, 39672 39673 td: function(html, doc) { 39674 return Y_DOM.create('<tr>' + html + '</tr>', doc); 39675 }, 39676 39677 col: function(html, doc) { 39678 return Y_DOM.create('<colgroup>' + html + '</colgroup>', doc); 39679 }, 39680 39681 tbody: 'table' 39682 }); 39683 39684 Y.mix(creators, { 39685 legend: 'fieldset', 39686 th: creators.td, 39687 thead: creators.tbody, 39688 tfoot: creators.tbody, 39689 caption: creators.tbody, 39690 colgroup: creators.tbody, 39691 optgroup: creators.option 39692 }); 39693} 39694 39695Y_DOM.creators = creators; 39696Y.mix(Y.DOM, { 39697 /** 39698 * Sets the width of the element to the given size, regardless 39699 * of box model, border, padding, etc. 39700 * @method setWidth 39701 * @param {HTMLElement} element The DOM element. 39702 * @param {String|Number} size The pixel height to size to 39703 */ 39704 39705 setWidth: function(node, size) { 39706 Y.DOM._setSize(node, 'width', size); 39707 }, 39708 39709 /** 39710 * Sets the height of the element to the given size, regardless 39711 * of box model, border, padding, etc. 39712 * @method setHeight 39713 * @param {HTMLElement} element The DOM element. 39714 * @param {String|Number} size The pixel height to size to 39715 */ 39716 39717 setHeight: function(node, size) { 39718 Y.DOM._setSize(node, 'height', size); 39719 }, 39720 39721 _setSize: function(node, prop, val) { 39722 val = (val > 0) ? val : 0; 39723 var size = 0; 39724 39725 node.style[prop] = val + 'px'; 39726 size = (prop === 'height') ? node.offsetHeight : node.offsetWidth; 39727 39728 if (size > val) { 39729 val = val - (size - val); 39730 39731 if (val < 0) { 39732 val = 0; 39733 } 39734 39735 node.style[prop] = val + 'px'; 39736 } 39737 } 39738}); 39739 39740 39741}, 'patched-v3.18.3', {"requires": ["dom-core"]}); 39742 39743YUI.add('dom-core', function (Y, NAME) { 39744 39745var NODE_TYPE = 'nodeType', 39746 OWNER_DOCUMENT = 'ownerDocument', 39747 DOCUMENT_ELEMENT = 'documentElement', 39748 DEFAULT_VIEW = 'defaultView', 39749 PARENT_WINDOW = 'parentWindow', 39750 TAG_NAME = 'tagName', 39751 PARENT_NODE = 'parentNode', 39752 PREVIOUS_SIBLING = 'previousSibling', 39753 NEXT_SIBLING = 'nextSibling', 39754 CONTAINS = 'contains', 39755 COMPARE_DOCUMENT_POSITION = 'compareDocumentPosition', 39756 EMPTY_ARRAY = [], 39757 39758 // IE < 8 throws on node.contains(textNode) 39759 supportsContainsTextNode = (function() { 39760 var node = Y.config.doc.createElement('div'), 39761 textNode = node.appendChild(Y.config.doc.createTextNode('')), 39762 result = false;
39763 39764 try { 39765 result = node.contains(textNode); 39766 } catch(e) {} 39767 39768 return result; 39769 })(), 39770 39771/** 39772 * The DOM utility provides a cross-browser abtraction layer 39773 * normalizing DOM tasks, and adds extra helper functionality 39774 * for other common tasks. 39775 * @module dom 39776 * @main dom 39777 * @submodule dom-base 39778 * @for DOM 39779 * 39780 */ 39781 39782/** 39783 * Provides DOM helper methods. 39784 * @class DOM 39785 * 39786 */ 39787 39788Y_DOM = { 39789 /** 39790 * Returns the HTMLElement with the given ID (Wrapper for document.getElementById). 39791 * @method byId 39792 * @param {String} id the id attribute 39793 * @param {Object} doc optional The document to search. Defaults to current document 39794 * @return {HTMLElement | null} The HTMLElement with the id, or null if none found. 39795 */ 39796 byId: function(id, doc) { 39797 // handle dupe IDs and IE name collision 39798 return Y_DOM.allById(id, doc)[0] || null; 39799 }, 39800 39801 getId: function(node) { 39802 var id; 39803 // HTMLElement returned from FORM when INPUT name === "id" 39804 // IE < 8: HTMLCollection returned when INPUT id === "id" 39805 // via both getAttribute and form.id 39806 if (node.id && !node.id.tagName && !node.id.item) { 39807 id = node.id; 39808 } else if (node.attributes && node.attributes.id) { 39809 id = node.attributes.id.value; 39810 } 39811 39812 return id; 39813 }, 39814 39815 setId: function(node, id) { 39816 if (node.setAttribute) { 39817 node.setAttribute('id', id); 39818 } else { 39819 node.id = id; 39820 } 39821 }, 39822 39823 /* 39824 * Finds the ancestor of the element. 39825 * @method ancestor 39826 * @param {HTMLElement} element The html element. 39827 * @param {Function} fn optional An optional boolean test to apply. 39828 * The optional function is passed the current DOM node being tested as its only argument. 39829 * If no function is given, the parentNode is returned. 39830 * @param {Boolean} testSelf optional Whether or not to include the element in the scan 39831 * @return {HTMLElement | null} The matching DOM node or null if none found. 39832 */ 39833 ancestor: function(element, fn, testSelf, stopFn) { 39834 var ret = null; 39835 if (testSelf) { 39836 ret = (!fn || fn(element)) ? element : null; 39837 39838 } 39839 return ret || Y_DOM.elementByAxis(element, PARENT_NODE, fn, null, stopFn); 39840 }, 39841 39842 /* 39843 * Finds the ancestors of the element. 39844 * @method ancestors 39845 * @param {HTMLElement} element The html element. 39846 * @param {Function} fn optional An optional boolean test to apply. 39847 * The optional function is passed the current DOM node being tested as its only argument. 39848 * If no function is given, all ancestors are returned. 39849 * @param {Boolean} testSelf optional Whether or not to include the element in the scan 39850 * @return {Array} An array containing all matching DOM nodes. 39851 */ 39852 ancestors: function(element, fn, testSelf, stopFn) { 39853 var ancestor = element, 39854 ret = []; 39855 39856 while ((ancestor = Y_DOM.ancestor(ancestor, fn, testSelf, stopFn))) { 39857 testSelf = false; 39858 if (ancestor) { 39859 ret.unshift(ancestor); 39860 39861 if (stopFn && stopFn(ancestor)) { 39862 return ret; 39863 } 39864 } 39865 } 39866 39867 return ret; 39868 }, 39869 39870 /** 39871 * Searches the element by the given axis for the first matching element. 39872 * @method elementByAxis 39873 * @param {HTMLElement} element The html element. 39874 * @param {String} axis The axis to search (parentNode, nextSibling, previousSibling). 39875 * @param {Function} [fn] An optional boolean test to apply. 39876 * @param {Boolean} [all] Whether text nodes as well as element nodes should be returned, or 39877 * just element nodes will be returned(default) 39878 * The optional function is passed the current HTMLElement being tested as its only argument. 39879 * If no function is given, the first element is returned. 39880 * @return {HTMLElement | null} The matching element or null if none found. 39881 */ 39882 elementByAxis: function(element, axis, fn, all, stopAt) { 39883 while (element && (element = element[axis])) { // NOTE: assignment 39884 if ( (all || element[TAG_NAME]) && (!fn || fn(element)) ) { 39885 return element; 39886 } 39887 39888 if (stopAt && stopAt(element)) { 39889 return null; 39890 } 39891 } 39892 return null; 39893 }, 39894 39895 /** 39896 * Determines whether or not one HTMLElement is or contains another HTMLElement. 39897 * @method contains 39898 * @param {HTMLElement} element The containing html element. 39899 * @param {HTMLElement} needle The html element that may be contained. 39900 * @return {Boolean} Whether or not the element is or contains the needle. 39901 */ 39902 contains: function(element, needle) { 39903 var ret = false;
39904 39905 if ( !needle || !element || !needle[NODE_TYPE] || !element[NODE_TYPE]) { 39906 ret = false; 39907 } else if (element[CONTAINS] && 39908 // IE < 8 throws on node.contains(textNode) so fall back to brute. 39909 // Falling back for other nodeTypes as well. 39910 (needle[NODE_TYPE] === 1 || supportsContainsTextNode)) { 39911 ret = element[CONTAINS](needle); 39912 } else if (element[COMPARE_DOCUMENT_POSITION]) { 39913 // Match contains behavior (node.contains(node) === true). 39914 // Needed for Firefox < 4. 39915 if (element === needle || !!(element[COMPARE_DOCUMENT_POSITION](needle) & 16)) { 39916 ret = true; 39917 } 39918 } else { 39919 ret = Y_DOM._bruteContains(element, needle); 39920 } 39921 39922 return ret; 39923 }, 39924 39925 /** 39926 * Determines whether or not the HTMLElement is part of the document. 39927 * @method inDoc 39928 * @param {HTMLElement} element The containing html element. 39929 * @param {HTMLElement} doc optional The document to check. 39930 * @return {Boolean} Whether or not the element is attached to the document. 39931 */ 39932 inDoc: function(element, doc) { 39933 var ret = false, 39934 rootNode; 39935 39936 if (element && element.nodeType) { 39937 (doc) || (doc = element[OWNER_DOCUMENT]); 39938 39939 rootNode = doc[DOCUMENT_ELEMENT]; 39940 39941 // contains only works with HTML_ELEMENT 39942 if (rootNode && rootNode.contains && element.tagName) { 39943 ret = rootNode.contains(element); 39944 } else { 39945 ret = Y_DOM.contains(rootNode, element); 39946 } 39947 } 39948 39949 return ret; 39950 39951 }, 39952 39953 allById: function(id, root) { 39954 root = root || Y.config.doc; 39955 var nodes = [], 39956 ret = [], 39957 i, 39958 node; 39959 39960 if (root.querySelectorAll) { 39961 ret = root.querySelectorAll('[id="' + id + '"]'); 39962 } else if (root.all) { 39963 nodes = root.all(id); 39964 39965 if (nodes) { 39966 // root.all may return HTMLElement or HTMLCollection. 39967 // some elements are also HTMLCollection (FORM, SELECT). 39968 if (nodes.nodeName) { 39969 if (nodes.id === id) { // avoid false positive on name 39970 ret.push(nodes); 39971 nodes = EMPTY_ARRAY; // done, no need to filter 39972 } else { // prep for filtering 39973 nodes = [nodes]; 39974 } 39975 } 39976 39977 if (nodes.length) { 39978 // filter out matches on node.name 39979 // and element.id as reference to element with id === 'id' 39980 for (i = 0; node = nodes[i++];) { 39981 if (node.id === id || 39982 (node.attributes && node.attributes.id && 39983 node.attributes.id.value === id)) { 39984 ret.push(node); 39985 } 39986 } 39987 } 39988 } 39989 } else { 39990 ret = [Y_DOM._getDoc(root).getElementById(id)]; 39991 } 39992 39993 return ret; 39994 }, 39995 39996 39997 isWindow: function(obj) { 39998 return !!(obj && obj.scrollTo && obj.document); 39999 }, 40000 40001 _removeChildNodes: function(node) { 40002 while (node.firstChild) { 40003 node.removeChild(node.firstChild); 40004 } 40005 }, 40006 40007 siblings: function(node, fn) { 40008 var nodes = [], 40009 sibling = node; 40010 40011 while ((sibling = sibling[PREVIOUS_SIBLING])) { 40012 if (sibling[TAG_NAME] && (!fn || fn(sibling))) { 40013 nodes.unshift(sibling); 40014 } 40015 } 40016 40017 sibling = node; 40018 while ((sibling = sibling[NEXT_SIBLING])) { 40019 if (sibling[TAG_NAME] && (!fn || fn(sibling))) { 40020 nodes.push(sibling); 40021 } 40022 } 40023 40024 return nodes; 40025 }, 40026 40027 /** 40028 * Brute force version of contains. 40029 * Used for browsers without contains support for non-HTMLElement Nodes (textNodes, etc). 40030 * @method _bruteContains 40031 * @private 40032 * @param {HTMLElement} element The containing html element. 40033 * @param {HTMLElement} needle The html element that may be contained. 40034 * @return {Boolean} Whether or not the element is or contains the needle. 40035 */ 40036 _bruteContains: function(element, needle) { 40037 while (needle) { 40038 if (element === needle) { 40039 return true; 40040 } 40041 needle = needle.parentNode; 40042 } 40043 return false;
40044 }, 40045 40046// TODO: move to Lang? 40047 /** 40048 * Memoizes dynamic regular expressions to boost runtime performance. 40049 * @method _getRegExp 40050 * @private 40051 * @param {String} str The string to convert to a regular expression. 40052 * @param {String} flags optional An optinal string of flags. 40053 * @return {RegExp} An instance of RegExp 40054 */ 40055 _getRegExp: function(str, flags) { 40056 flags = flags || ''; 40057 Y_DOM._regexCache = Y_DOM._regexCache || {}; 40058 if (!Y_DOM._regexCache[str + flags]) { 40059 Y_DOM._regexCache[str + flags] = new RegExp(str, flags); 40060 } 40061 return Y_DOM._regexCache[str + flags]; 40062 }, 40063 40064// TODO: make getDoc/Win true privates? 40065 /** 40066 * returns the appropriate document. 40067 * @method _getDoc 40068 * @private 40069 * @param {HTMLElement} element optional Target element. 40070 * @return {Object} The document for the given element or the default document. 40071 */ 40072 _getDoc: function(element) { 40073 var doc = Y.config.doc; 40074 if (element) { 40075 doc = (element[NODE_TYPE] === 9) ? element : // element === document 40076 element[OWNER_DOCUMENT] || // element === DOM node 40077 element.document || // element === window 40078 Y.config.doc; // default 40079 } 40080 40081 return doc; 40082 }, 40083 40084 /** 40085 * returns the appropriate window. 40086 * @method _getWin 40087 * @private 40088 * @param {HTMLElement} element optional Target element. 40089 * @return {Object} The window for the given element or the default window. 40090 */ 40091 _getWin: function(element) { 40092 var doc = Y_DOM._getDoc(element); 40093 return doc[DEFAULT_VIEW] || doc[PARENT_WINDOW] || Y.config.win; 40094 }, 40095 40096 _batch: function(nodes, fn, arg1, arg2, arg3, etc) { 40097 fn = (typeof fn === 'string') ? Y_DOM[fn] : fn; 40098 var result, 40099 i = 0, 40100 node, 40101 ret; 40102 40103 if (fn && nodes) { 40104 while ((node = nodes[i++])) { 40105 result = result = fn.call(Y_DOM, node, arg1, arg2, arg3, etc); 40106 if (typeof result !== 'undefined') { 40107 (ret) || (ret = []); 40108 ret.push(result); 40109 } 40110 } 40111 } 40112 40113 return (typeof ret !== 'undefined') ? ret : nodes; 40114 }, 40115 40116 generateID: function(el) { 40117 var id = el.id; 40118 40119 if (!id) { 40120 id = Y.stamp(el); 40121 el.id = id; 40122 } 40123 40124 return id; 40125 } 40126}; 40127 40128 40129Y.DOM = Y_DOM; 40130 40131 40132}, 'patched-v3.18.3', {"requires": ["oop", "features"]}); 40133 40134YUI.add('dom-screen', function (Y, NAME) { 40135 40136(function(Y) { 40137 40138/** 40139 * Adds position and region management functionality to DOM. 40140 * @module dom 40141 * @submodule dom-screen 40142 * @for DOM 40143 */ 40144 40145var DOCUMENT_ELEMENT = 'documentElement', 40146 COMPAT_MODE = 'compatMode', 40147 POSITION = 'position', 40148 FIXED = 'fixed', 40149 RELATIVE = 'relative', 40150 LEFT = 'left', 40151 TOP = 'top', 40152 _BACK_COMPAT = 'BackCompat', 40153 MEDIUM = 'medium', 40154 BORDER_LEFT_WIDTH = 'borderLeftWidth', 40155 BORDER_TOP_WIDTH = 'borderTopWidth', 40156 GET_BOUNDING_CLIENT_RECT = 'getBoundingClientRect', 40157 GET_COMPUTED_STYLE = 'getComputedStyle', 40158 40159 Y_DOM = Y.DOM, 40160 40161 // TODO: how about thead/tbody/tfoot/tr? 40162 // TODO: does caption matter? 40163 RE_TABLE = /^t(?:able|d|h)$/i, 40164 40165 SCROLL_NODE; 40166 40167if (Y.UA.ie) { 40168 if (Y.config.doc[COMPAT_MODE] !== 'BackCompat') { 40169 SCROLL_NODE = DOCUMENT_ELEMENT; 40170 } else { 40171 SCROLL_NODE = 'body'; 40172 } 40173} 40174 40175Y.mix(Y_DOM, { 40176 /** 40177 * Returns the inner height of the viewport (exludes scrollbar). 40178 * @method winHeight 40179 * @return {Number} The current height of the viewport. 40180 */ 40181 winHeight: function(node) { 40182 var h = Y_DOM._getWinSize(node).height; 40183 return h; 40184 }, 40185 40186 /** 40187 * Returns the inner width of the viewport (exludes scrollbar). 40188 * @method winWidth 40189 * @return {Number} The current width of the viewport. 40190 */ 40191 winWidth: function(node) { 40192 var w = Y_DOM._getWinSize(node).width; 40193 return w; 40194 }, 40195 40196 /** 40197 * Document height 40198 * @method docHeight 40199 * @return {Number} The current height of the document. 40200 */ 40201 docHeight: function(node) { 40202 var h = Y_DOM._getDocSize(node).height; 40203 return Math.max(h, Y_DOM._getWinSize(node).height); 40204 }, 40205 40206 /** 40207 * Document width 40208 * @method docWidth 40209 * @return {Number} The current width of the document. 40210 */ 40211 docWidth: function(node) { 40212 var w = Y_DOM._getDocSize(node).width; 40213 return Math.max(w, Y_DOM._getWinSize(node).width); 40214 }, 40215 40216 /** 40217 * Amount page has been scroll horizontally 40218 * @method docScrollX 40219 * @return {Number} The current amount the screen is scrolled horizontally. 40220 */ 40221 docScrollX: function(node, doc) { 40222 doc = doc || (node) ? Y_DOM._getDoc(node) : Y.config.doc; // perf optimization 40223 var dv = doc.defaultView, 40224 pageOffset = (dv) ? dv.pageXOffset : 0; 40225 return Math.max(doc[DOCUMENT_ELEMENT].scrollLeft, doc.body.scrollLeft, pageOffset); 40226 }, 40227 40228 /** 40229 * Amount page has been scroll vertically 40230 * @method docScrollY 40231 * @return {Number} The current amount the screen is scrolled vertically. 40232 */ 40233 docScrollY: function(node, doc) { 40234 doc = doc || (node) ? Y_DOM._getDoc(node) : Y.config.doc; // perf optimization 40235 var dv = doc.defaultView, 40236 pageOffset = (dv) ? dv.pageYOffset : 0; 40237 return Math.max(doc[DOCUMENT_ELEMENT].scrollTop, doc.body.scrollTop, pageOffset); 40238 }, 40239 40240 /** 40241 * Gets the current position of an element based on page coordinates. 40242 * Element must be part of the DOM tree to have page coordinates 40243 * (display:none or elements not appended return false). 40244 * @method getXY 40245 * @param element The target element 40246 * @return {Array} The XY position of the element 40247 40248 TODO: test inDocument/display? 40249 */
40250 getXY: function() { 40251 if (Y.config.doc[DOCUMENT_ELEMENT][GET_BOUNDING_CLIENT_RECT]) { 40252 return function(node) { 40253 var xy = null, 40254 scrollLeft, 40255 scrollTop, 40256 mode, 40257 box, 40258 offX, 40259 offY, 40260 doc, 40261 win, 40262 inDoc, 40263 rootNode; 40264 40265 if (node && node.tagName) { 40266 doc = node.ownerDocument; 40267 mode = doc[COMPAT_MODE]; 40268 40269 if (mode !== _BACK_COMPAT) { 40270 rootNode = doc[DOCUMENT_ELEMENT]; 40271 } else { 40272 rootNode = doc.body; 40273 } 40274 40275 // inline inDoc check for perf 40276 if (rootNode.contains) { 40277 inDoc = rootNode.contains(node); 40278 } else { 40279 inDoc = Y.DOM.contains(rootNode, node); 40280 } 40281 40282 if (inDoc) { 40283 win = doc.defaultView; 40284 40285 // inline scroll calc for perf 40286 if (win && 'pageXOffset' in win) { 40287 scrollLeft = win.pageXOffset; 40288 scrollTop = win.pageYOffset; 40289 } else { 40290 scrollLeft = (SCROLL_NODE) ? doc[SCROLL_NODE].scrollLeft : Y_DOM.docScrollX(node, doc); 40291 scrollTop = (SCROLL_NODE) ? doc[SCROLL_NODE].scrollTop : Y_DOM.docScrollY(node, doc); 40292 } 40293 40294 if (Y.UA.ie) { // IE < 8, quirks, or compatMode 40295 if (!doc.documentMode || doc.documentMode < 8 || mode === _BACK_COMPAT) { 40296 offX = rootNode.clientLeft; 40297 offY = rootNode.clientTop; 40298 } 40299 } 40300 box = node[GET_BOUNDING_CLIENT_RECT](); 40301 xy = [box.left, box.top]; 40302 40303 if (offX || offY) { 40304 xy[0] -= offX; 40305 xy[1] -= offY; 40306 40307 } 40308 if ((scrollTop || scrollLeft)) { 40309 if (!Y.UA.ios || (Y.UA.ios >= 4.2)) { 40310 xy[0] += scrollLeft; 40311 xy[1] += scrollTop; 40312 } 40313 40314 } 40315 } else { 40316 xy = Y_DOM._getOffset(node); 40317 } 40318 } 40319 return xy; 40320 }; 40321 } else { 40322 return function(node) { // manually calculate by crawling up offsetParents 40323 //Calculate the Top and Left border sizes (assumes pixels) 40324 var xy = null, 40325 doc, 40326 parentNode, 40327 bCheck, 40328 scrollTop, 40329 scrollLeft; 40330 40331 if (node) { 40332 if (Y_DOM.inDoc(node)) { 40333 xy = [node.offsetLeft, node.offsetTop]; 40334 doc = node.ownerDocument; 40335 parentNode = node; 40336 // TODO: refactor with !! or just falsey 40337 bCheck = ((Y.UA.gecko || Y.UA.webkit > 519) ? true : false); 40338 40339 // TODO: worth refactoring for TOP/LEFT only? 40340 while ((parentNode = parentNode.offsetParent)) { 40341 xy[0] += parentNode.offsetLeft; 40342 xy[1] += parentNode.offsetTop; 40343 if (bCheck) { 40344 xy = Y_DOM._calcBorders(parentNode, xy); 40345 } 40346 } 40347 40348 // account for any scrolled ancestors 40349 if (Y_DOM.getStyle(node, POSITION) != FIXED) { 40350 parentNode = node; 40351 40352 while ((parentNode = parentNode.parentNode)) { 40353 scrollTop = parentNode.scrollTop; 40354 scrollLeft = parentNode.scrollLeft; 40355 40356 //Firefox does something funky with borders when overflow is not visible. 40357 if (Y.UA.gecko && (Y_DOM.getStyle(parentNode, 'overflow') !== 'visible')) { 40358 xy = Y_DOM._calcBorders(parentNode, xy); 40359 } 40360 40361 40362 if (scrollTop || scrollLeft) { 40363 xy[0] -= scrollLeft; 40364 xy[1] -= scrollTop; 40365 } 40366 } 40367 xy[0] += Y_DOM.docScrollX(node, doc); 40368 xy[1] += Y_DOM.docScrollY(node, doc); 40369 40370 } else { 40371 //Fix FIXED position -- add scrollbars 40372 xy[0] += Y_DOM.docScrollX(node, doc); 40373 xy[1] += Y_DOM.docScrollY(node, doc); 40374 } 40375 } else { 40376 xy = Y_DOM._getOffset(node); 40377 } 40378 } 40379 40380 return xy; 40381 }; 40382 } 40383 }(),// NOTE: Executing for loadtime branching 40384 40385 /** 40386 Gets the width of vertical scrollbars on overflowed containers in the body 40387 content. 40388 40389 @method getScrollbarWidth 40390 @return {Number} Pixel width of a scrollbar in the current browser 40391 **/ 40392 getScrollbarWidth: Y.cached(function () { 40393 var doc = Y.config.doc, 40394 testNode = doc.createElement('div'), 40395 body = doc.getElementsByTagName('body')[0], 40396 // 0.1 because cached doesn't support falsy refetch values 40397 width = 0.1; 40398 40399 if (body) { 40400 testNode.style.cssText = "position:absolute;visibility:hidden;overflow:scroll;width:20px;"; 40401 testNode.appendChild(doc.createElement('p')).style.height = '1px'; 40402 body.insertBefore(testNode, body.firstChild); 40403 width = testNode.offsetWidth - testNode.clientWidth; 40404 40405 body.removeChild(testNode); 40406 } 40407 40408 return width; 40409 }, null, 0.1), 40410 40411 /** 40412 * Gets the current X position of an element based on page coordinates. 40413 * Element must be part of the DOM tree to have page coordinates 40414 * (display:none or elements not appended return false). 40415 * @method getX 40416 * @param element The target element 40417 * @return {Number} The X position of the element 40418 */ 40419 40420 getX: function(node) { 40421 return Y_DOM.getXY(node)[0]; 40422 }, 40423 40424 /** 40425 * Gets the current Y position of an element based on page coordinates. 40426 * Element must be part of the DOM tree to have page coordinates 40427 * (display:none or elements not appended return false). 40428 * @method getY 40429 * @param element The target element 40430 * @return {Number} The Y position of the element 40431 */ 40432 40433 getY: function(node) { 40434 return Y_DOM.getXY(node)[1]; 40435 }, 40436 40437 /** 40438 * Set the position of an html element in page coordinates. 40439 * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). 40440 * @method setXY 40441 * @param element The target element 40442 * @param {Array} xy Contains X & Y values for new position (coordinates are page-based) 40443 * @param {Boolean} noRetry By default we try and set the position a second time if the first fails 40444 */ 40445 setXY: function(node, xy, noRetry) { 40446 var setStyle = Y_DOM.setStyle, 40447 pos, 40448 delta, 40449 newXY, 40450 currentXY, 40451 offsetDir, 40452 dir, 40453 x; 40454 40455 if (node && xy) { 40456 pos = Y_DOM.getStyle(node, POSITION); 40457 40458 offsetDir = Y_DOM.OFFSET_XY; 40459 40460 if (!offsetDir) { 40461 dir = Y_DOM.getComputedStyle(node, 'direction'); 40462 40463 offsetDir = (dir === 'rtl' ? 'right' : LEFT); 40464 } 40465 40466 delta = Y_DOM._getOffset(node, offsetDir); 40467 if (pos == 'static') { // default to relative 40468 pos = RELATIVE; 40469 setStyle(node, POSITION, pos); 40470 } 40471 currentXY = Y_DOM._getDirXY(node, offsetDir); 40472 40473 x = xy[0]; 40474 40475 if (offsetDir === 'right') { 40476 x = Y_DOM.winWidth() - (xy[0] + parseInt(Y_DOM.getComputedStyle(node, 'width'), 10)); 40477 40478 if (!delta[0] && !noRetry) { 40479 noRetry = false;
40480 } 40481 } 40482 40483 if (x !== null) { 40484 setStyle(node, offsetDir, x - currentXY[0] + delta[0] + 'px'); 40485 } 40486 40487 if (xy[1] !== null) { 40488 setStyle(node, TOP, xy[1] - currentXY[1] + delta[1] + 'px'); 40489 } 40490 40491 if (!noRetry) { 40492 newXY = Y_DOM.getXY(node); 40493 if (newXY[0] !== xy[0] || newXY[1] !== xy[1]) { 40494 Y_DOM.setXY(node, xy, true); 40495 } 40496 } 40497 40498 } else { 40499 } 40500 }, 40501 40502 /** 40503 * Set the X position of an html element in page coordinates, regardless of how the element is positioned. 40504 * The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). 40505 * @method setX 40506 * @param element The target element 40507 * @param {Number} x The X values for new position (coordinates are page-based) 40508 */ 40509 setX: function(node, x) { 40510 return Y_DOM.setXY(node, [x, null]); 40511 }, 40512 40513 /** 40514 * Set the Y position of an html element in page coordinates, regardless of how the element is positioned. 40515 * The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). 40516 * @method setY 40517 * @param element The target element 40518 * @param {Number} y The Y values for new position (coordinates are page-based) 40519 */ 40520 setY: function(node, y) { 40521 return Y_DOM.setXY(node, [null, y]); 40522 }, 40523 40524 /** 40525 * @method swapXY 40526 * @description Swap the xy position with another node 40527 * @param {Node} node The node to swap with 40528 * @param {Node} otherNode The other node to swap with 40529 * @return {Node} 40530 */ 40531 swapXY: function(node, otherNode) { 40532 var xy = Y_DOM.getXY(node); 40533 Y_DOM.setXY(node, Y_DOM.getXY(otherNode)); 40534 Y_DOM.setXY(otherNode, xy); 40535 }, 40536 40537 _calcBorders: function(node, xy2) { 40538 var t = parseInt(Y_DOM[GET_COMPUTED_STYLE](node, BORDER_TOP_WIDTH), 10) || 0, 40539 l = parseInt(Y_DOM[GET_COMPUTED_STYLE](node, BORDER_LEFT_WIDTH), 10) || 0; 40540 if (Y.UA.gecko) { 40541 if (RE_TABLE.test(node.tagName)) { 40542 t = 0; 40543 l = 0; 40544 } 40545 } 40546 xy2[0] += l; 40547 xy2[1] += t; 40548 return xy2; 40549 }, 40550 40551 _getWinSize: function(node, doc) { 40552 doc = doc || (node) ? Y_DOM._getDoc(node) : Y.config.doc; 40553 var win = doc.defaultView || doc.parentWindow, 40554 mode = doc[COMPAT_MODE], 40555 h = win.innerHeight, 40556 w = win.innerWidth, 40557 root = doc[DOCUMENT_ELEMENT]; 40558 40559 if ( mode && !Y.UA.opera ) { // IE, Gecko 40560 if (mode != 'CSS1Compat') { // Quirks 40561 root = doc.body; 40562 } 40563 h = root.clientHeight; 40564 w = root.clientWidth; 40565 } 40566 return { height: h, width: w }; 40567 }, 40568 40569 _getDocSize: function(node) { 40570 var doc = (node) ? Y_DOM._getDoc(node) : Y.config.doc, 40571 root = doc[DOCUMENT_ELEMENT]; 40572 40573 if (doc[COMPAT_MODE] != 'CSS1Compat') { 40574 root = doc.body; 40575 } 40576 40577 return { height: root.scrollHeight, width: root.scrollWidth }; 40578 }, 40579 40580 _getDirXY: function(node, dir) { 40581 var xy = Y_DOM.getXY(node); 40582 40583 if (dir === 'right') { 40584 xy[0] = (Y_DOM.winWidth() - (xy[0] + parseInt(Y_DOM.getComputedStyle(node, 'width'), 10))); 40585 } 40586 40587 return xy; 40588 } 40589}); 40590 40591})(Y); 40592(function(Y) { 40593var TOP = 'top', 40594 RIGHT = 'right', 40595 BOTTOM = 'bottom', 40596 LEFT = 'left', 40597 40598 getOffsets = function(r1, r2) { 40599 var t = Math.max(r1[TOP], r2[TOP]), 40600 r = Math.min(r1[RIGHT], r2[RIGHT]), 40601 b = Math.min(r1[BOTTOM], r2[BOTTOM]), 40602 l = Math.max(r1[LEFT], r2[LEFT]), 40603 ret = {}; 40604 40605 ret[TOP] = t; 40606 ret[RIGHT] = r; 40607 ret[BOTTOM] = b; 40608 ret[LEFT] = l; 40609 return ret; 40610 }, 40611 40612 DOM = Y.DOM; 40613 40614Y.mix(DOM, { 40615 /** 40616 * Returns an Object literal containing the following about this element: (top, right, bottom, left) 40617 * @for DOM 40618 * @method region 40619 * @param {HTMLElement} element The DOM element. 40620 * @return {Object} Object literal containing the following about this element: (top, right, bottom, left) 40621 */ 40622 region: function(node) { 40623 var xy = DOM.getXY(node), 40624 ret = false;
40625 40626 if (node && xy) { 40627 ret = DOM._getRegion( 40628 xy[1], // top 40629 xy[0] + node.offsetWidth, // right 40630 xy[1] + node.offsetHeight, // bottom 40631 xy[0] // left 40632 ); 40633 } 40634 40635 return ret; 40636 }, 40637 40638 /** 40639 * Find the intersect information for the passed nodes. 40640 * @method intersect 40641 * @for DOM 40642 * @param {HTMLElement} element The first element 40643 * @param {HTMLElement | Object} element2 The element or region to check the interect with 40644 * @param {Object} altRegion An object literal containing the region for the first element if we already have the data (for performance e.g. DragDrop) 40645 * @return {Object} Object literal containing the following intersection data: (top, right, bottom, left, area, yoff, xoff, inRegion) 40646 */ 40647 intersect: function(node, node2, altRegion) { 40648 var r = altRegion || DOM.region(node), region = {}, 40649 n = node2, 40650 off; 40651 40652 if (n.tagName) { 40653 region = DOM.region(n); 40654 } else if (Y.Lang.isObject(node2)) { 40655 region = node2; 40656 } else { 40657 return false; 40658 } 40659 40660 off = getOffsets(region, r); 40661 return { 40662 top: off[TOP], 40663 right: off[RIGHT], 40664 bottom: off[BOTTOM], 40665 left: off[LEFT], 40666 area: ((off[BOTTOM] - off[TOP]) * (off[RIGHT] - off[LEFT])), 40667 yoff: ((off[BOTTOM] - off[TOP])), 40668 xoff: (off[RIGHT] - off[LEFT]), 40669 inRegion: DOM.inRegion(node, node2, false, altRegion) 40670 }; 40671 40672 }, 40673 /** 40674 * Check if any part of this node is in the passed region 40675 * @method inRegion 40676 * @for DOM 40677 * @param {Object} node The node to get the region from 40678 * @param {Object} node2 The second node to get the region from or an Object literal of the region 40679 * @param {Boolean} all Should all of the node be inside the region 40680 * @param {Object} altRegion An object literal containing the region for this node if we already have the data (for performance e.g. DragDrop) 40681 * @return {Boolean} True if in region, false if not. 40682 */ 40683 inRegion: function(node, node2, all, altRegion) { 40684 var region = {}, 40685 r = altRegion || DOM.region(node), 40686 n = node2, 40687 off; 40688 40689 if (n.tagName) { 40690 region = DOM.region(n); 40691 } else if (Y.Lang.isObject(node2)) { 40692 region = node2; 40693 } else { 40694 return false; 40695 } 40696 40697 if (all) { 40698 return ( 40699 r[LEFT] >= region[LEFT] && 40700 r[RIGHT] <= region[RIGHT] && 40701 r[TOP] >= region[TOP] && 40702 r[BOTTOM] <= region[BOTTOM] ); 40703 } else { 40704 off = getOffsets(region, r); 40705 if (off[BOTTOM] >= off[TOP] && off[RIGHT] >= off[LEFT]) { 40706 return true; 40707 } else { 40708 return false; 40709 } 40710 40711 } 40712 }, 40713 40714 /** 40715 * Check if any part of this element is in the viewport 40716 * @method inViewportRegion 40717 * @for DOM 40718 * @param {HTMLElement} element The DOM element. 40719 * @param {Boolean} all Should all of the node be inside the region 40720 * @param {Object} altRegion An object literal containing the region for this node if we already have the data (for performance e.g. DragDrop) 40721 * @return {Boolean} True if in region, false if not. 40722 */ 40723 inViewportRegion: function(node, all, altRegion) { 40724 return DOM.inRegion(node, DOM.viewportRegion(node), all, altRegion); 40725 40726 }, 40727 40728 _getRegion: function(t, r, b, l) { 40729 var region = {}; 40730 40731 region[TOP] = region[1] = t; 40732 region[LEFT] = region[0] = l; 40733 region[BOTTOM] = b; 40734 region[RIGHT] = r; 40735 region.width = region[RIGHT] - region[LEFT]; 40736 region.height = region[BOTTOM] - region[TOP]; 40737 40738 return region; 40739 }, 40740 40741 /** 40742 * Returns an Object literal containing the following about the visible region of viewport: (top, right, bottom, left) 40743 * @method viewportRegion 40744 * @for DOM 40745 * @return {Object} Object literal containing the following about the visible region of the viewport: (top, right, bottom, left) 40746 */ 40747 viewportRegion: function(node) { 40748 node = node || Y.config.doc.documentElement; 40749 var ret = false, 40750 scrollX, 40751 scrollY; 40752 40753 if (node) { 40754 scrollX = DOM.docScrollX(node); 40755 scrollY = DOM.docScrollY(node); 40756 40757 ret = DOM._getRegion(scrollY, // top 40758 DOM.winWidth(node) + scrollX, // right 40759 scrollY + DOM.winHeight(node), // bottom 40760 scrollX); // left 40761 } 40762 40763 return ret; 40764 } 40765}); 40766})(Y); 40767 40768 40769}, 'patched-v3.18.3', {"requires": ["dom-base", "dom-style"]}); 40770 40771YUI.add('dom-style', function (Y, NAME) { 40772 40773/** 40774 * Add style management functionality to DOM. 40775 * @module dom 40776 * @submodule dom-style 40777 * @for DOM 40778 */ 40779 40780var DOCUMENT_ELEMENT = 'documentElement', 40781 DEFAULT_VIEW = 'defaultView', 40782 OWNER_DOCUMENT = 'ownerDocument', 40783 STYLE = 'style', 40784 FLOAT = 'float', 40785 CSS_FLOAT = 'cssFloat', 40786 STYLE_FLOAT = 'styleFloat', 40787 TRANSPARENT = 'transparent', 40788 GET_COMPUTED_STYLE = 'getComputedStyle', 40789 GET_BOUNDING_CLIENT_RECT = 'getBoundingClientRect', 40790 40791 DOCUMENT = Y.config.doc, 40792 40793 Y_DOM = Y.DOM, 40794 40795 TRANSFORM, 40796 TRANSFORMORIGIN, 40797 VENDOR_TRANSFORM = [ 40798 'WebkitTransform', 40799 'MozTransform', 40800 'OTransform', 40801 'msTransform', 40802 'transform' 40803 ], 40804 40805 re_unit = /width|height|top|left|right|bottom|margin|padding/i; 40806 40807Y.Array.each(VENDOR_TRANSFORM, function(val) { 40808 if (val in DOCUMENT[DOCUMENT_ELEMENT].style) { 40809 TRANSFORM = val;
40810 TRANSFORMORIGIN = val + "Origin"; 40811 } 40812}); 40813 40814Y.mix(Y_DOM, { 40815 DEFAULT_UNIT: 'px', 40816 40817 CUSTOM_STYLES: { 40818 }, 40819 40820 40821 /** 40822 * Sets a style property for a given element. 40823 * @method setStyle 40824 * @param {HTMLElement} node The HTMLElement to apply the style to. 40825 * @param {String} att The style property to set. 40826 * @param {String|Number} val The value. 40827 * @param {Object} [style] The style node. Defaults to `node.style`. 40828 */ 40829 setStyle: function(node, att, val, style) { 40830 style = style || node.style; 40831 var CUSTOM_STYLES = Y_DOM.CUSTOM_STYLES; 40832 40833 if (style) { 40834 if (val === null || val === '') { // normalize unsetting 40835 val = ''; 40836 } else if (!isNaN(Number(val)) && re_unit.test(att)) { // number values may need a unit 40837 val += Y_DOM.DEFAULT_UNIT; 40838 } 40839 40840 if (att in CUSTOM_STYLES) { 40841 if (CUSTOM_STYLES[att].set) { 40842 CUSTOM_STYLES[att].set(node, val, style); 40843 return; // NOTE: return 40844 } else if (typeof CUSTOM_STYLES[att] === 'string') { 40845 att = CUSTOM_STYLES[att]; 40846 } 40847 } else if (att === '') { // unset inline styles 40848 att = 'cssText'; 40849 val = ''; 40850 } 40851 style[att] = val; 40852 } 40853 }, 40854 40855 /** 40856 * Returns the current style value for the given property. 40857 * @method getStyle 40858 * @param {HTMLElement} node The HTMLElement to get the style from. 40859 * @param {String} att The style property to get. 40860 * @param {Object} [style] The style node. Defaults to `node.style`. 40861 */ 40862 getStyle: function(node, att, style) { 40863 style = style || node.style; 40864 var CUSTOM_STYLES = Y_DOM.CUSTOM_STYLES, 40865 val = ''; 40866 40867 if (style) { 40868 if (att in CUSTOM_STYLES) { 40869 if (CUSTOM_STYLES[att].get) { 40870 return CUSTOM_STYLES[att].get(node, att, style); // NOTE: return 40871 } else if (typeof CUSTOM_STYLES[att] === 'string') { 40872 att = CUSTOM_STYLES[att]; 40873 } 40874 } 40875 val = style[att]; 40876 if (val === '') { // TODO: is empty string sufficient? 40877 val = Y_DOM[GET_COMPUTED_STYLE](node, att); 40878 } 40879 } 40880 40881 return val; 40882 }, 40883 40884 /** 40885 * Sets multiple style properties. 40886 * @method setStyles 40887 * @param {HTMLElement} node The HTMLElement to apply the styles to. 40888 * @param {Object} hash An object literal of property:value pairs. 40889 */ 40890 setStyles: function(node, hash) { 40891 var style = node.style; 40892 Y.each(hash, function(v, n) { 40893 Y_DOM.setStyle(node, n, v, style); 40894 }, Y_DOM); 40895 }, 40896 40897 /** 40898 * Returns the computed style for the given node. 40899 * @method getComputedStyle 40900 * @param {HTMLElement} node The HTMLElement to get the style from. 40901 * @param {String} att The style property to get. 40902 * @return {String} The computed value of the style property. 40903 */ 40904 getComputedStyle: function(node, att) { 40905 var val = '', 40906 doc = node[OWNER_DOCUMENT], 40907 computed; 40908 40909 if (node[STYLE] && doc[DEFAULT_VIEW] && doc[DEFAULT_VIEW][GET_COMPUTED_STYLE]) { 40910 computed = doc[DEFAULT_VIEW][GET_COMPUTED_STYLE](node, null); 40911 if (computed) { // FF may be null in some cases (ticket #2530548) 40912 val = computed[att]; 40913 } 40914 } 40915 return val; 40916 } 40917}); 40918 40919// normalize reserved word float alternatives ("cssFloat" or "styleFloat") 40920if (DOCUMENT[DOCUMENT_ELEMENT][STYLE][CSS_FLOAT] !== undefined) { 40921 Y_DOM.CUSTOM_STYLES[FLOAT] = CSS_FLOAT; 40922} else if (DOCUMENT[DOCUMENT_ELEMENT][STYLE][STYLE_FLOAT] !== undefined) { 40923 Y_DOM.CUSTOM_STYLES[FLOAT] = STYLE_FLOAT; 40924} 40925 40926// safari converts transparent to rgba(), others use "transparent" 40927if (Y.UA.webkit) { 40928 Y_DOM[GET_COMPUTED_STYLE] = function(node, att) { 40929 var view = node[OWNER_DOCUMENT][DEFAULT_VIEW], 40930 val = view[GET_COMPUTED_STYLE](node, '')[att]; 40931 40932 if (val === 'rgba(0, 0, 0, 0)') { 40933 val = TRANSPARENT; 40934 } 40935 40936 return val; 40937 }; 40938 40939} 40940 40941Y.DOM._getAttrOffset = function(node, attr) { 40942 var val = Y.DOM[GET_COMPUTED_STYLE](node, attr), 40943 offsetParent = node.offsetParent, 40944 position, 40945 parentOffset, 40946 offset; 40947 40948 if (val === 'auto') { 40949 position = Y.DOM.getStyle(node, 'position'); 40950 if (position === 'static' || position === 'relative') { 40951 val = 0; 40952 } else if (offsetParent && offsetParent[GET_BOUNDING_CLIENT_RECT]) { 40953 parentOffset = offsetParent[GET_BOUNDING_CLIENT_RECT]()[attr]; 40954 offset = node[GET_BOUNDING_CLIENT_RECT]()[attr]; 40955 if (attr === 'left' || attr === 'top') { 40956 val = offset - parentOffset; 40957 } else { 40958 val = parentOffset - node[GET_BOUNDING_CLIENT_RECT]()[attr]; 40959 } 40960 } 40961 } 40962 40963 return val; 40964}; 40965 40966Y.DOM._getOffset = function(node, dir) { 40967 var pos,
40968 xy = null, 40969 offset = { 40970 left: 'offsetLeft', 40971 right: 'offsetRight' 40972 }, 40973 margins = { 40974 left: 'marginLeft', 40975 right: 'marginRight' 40976 }, 40977 margin; 40978 40979 dir = dir || 'left'; 40980 40981 if (node) { 40982 pos = Y_DOM.getStyle(node, 'position'); 40983 margin = parseInt(Y_DOM[GET_COMPUTED_STYLE](node, margins[dir]), 10); 40984 xy = [ 40985 parseInt(Y_DOM[GET_COMPUTED_STYLE](node, dir), 10), 40986 parseInt(Y_DOM[GET_COMPUTED_STYLE](node, 'top'), 10) 40987 ]; 40988 40989 if ( isNaN(xy[0]) ) { // in case of 'auto' 40990 xy[0] = parseInt(Y_DOM.getStyle(node, dir), 10); // try inline 40991 if ( isNaN(xy[0]) ) { // default to offset value 40992 xy[0] = (pos === 'relative') ? 0 : (node[offset[dir]] - margin) || 0; 40993 } 40994 } 40995 40996 if ( isNaN(xy[1]) ) { // in case of 'auto' 40997 xy[1] = parseInt(Y_DOM.getStyle(node, 'top'), 10); // try inline 40998 if ( isNaN(xy[1]) ) { // default to offset value 40999 xy[1] = (pos === 'relative') ? 0 : node.offsetTop || 0; 41000 } 41001 } 41002 } 41003 41004 return xy; 41005 41006}; 41007 41008if (TRANSFORM) { 41009 Y_DOM.CUSTOM_STYLES.transform = { 41010 set: function(node, val, style) { 41011 style[TRANSFORM] = val; 41012 }, 41013 41014 get: function(node) { 41015 return Y_DOM[GET_COMPUTED_STYLE](node, TRANSFORM); 41016 } 41017 }; 41018 41019 Y_DOM.CUSTOM_STYLES.transformOrigin = { 41020 set: function(node, val, style) { 41021 style[TRANSFORMORIGIN] = val; 41022 }, 41023 41024 get: function(node) { 41025 return Y_DOM[GET_COMPUTED_STYLE](node, TRANSFORMORIGIN); 41026 } 41027 }; 41028} 41029 41030 41031}, 'patched-v3.18.3', {"requires": ["dom-base"]}); 41032 41033YUI.add('event-base', function (Y, NAME) { 41034 41035/* 41036 * DOM event listener abstraction layer 41037 * @module event 41038 * @submodule event-base 41039 */ 41040 41041/** 41042 * The domready event fires at the moment the browser's DOM is 41043 * usable. In most cases, this is before images are fully 41044 * downloaded, allowing you to provide a more responsive user 41045 * interface. 41046 * 41047 * In YUI 3, domready subscribers will be notified immediately if 41048 * that moment has already passed when the subscription is created. 41049 * 41050 * One exception is if the yui.js file is dynamically injected into 41051 * the page. If this is done, you must tell the YUI instance that 41052 * you did this in order for DOMReady (and window load events) to 41053 * fire normally. That configuration option is 'injected' -- set 41054 * it to true if the yui.js script is not included inline. 41055 * 41056 * This method is part of the 'event-ready' module, which is a 41057 * submodule of 'event'. 41058 * 41059 * @event domready 41060 * @for YUI 41061 */ 41062Y.publish('domready', { 41063 fireOnce: true, 41064 async: true 41065}); 41066 41067if (YUI.Env.DOMReady) { 41068 Y.fire('domready'); 41069} else { 41070 Y.Do.before(function() { Y.fire('domready'); }, YUI.Env, '_ready'); 41071} 41072 41073/** 41074 * Custom event engine, DOM event listener abstraction layer, synthetic DOM 41075 * events. 41076 * @module event 41077 * @submodule event-base 41078 */ 41079 41080/** 41081 * Wraps a DOM event, properties requiring browser abstraction are 41082 * fixed here. Provids a security layer when required. 41083 * @class DOMEventFacade 41084 * @param ev {Event} the DOM event 41085 * @param currentTarget {HTMLElement} the element the listener was attached to 41086 * @param wrapper {CustomEvent} the custom event wrapper for this DOM event 41087 */ 41088 41089 var ua = Y.UA, 41090 41091 EMPTY = {}, 41092 41093 /** 41094 * webkit key remapping required for Safari < 3.1 41095 * @property webkitKeymap 41096 * @private 41097 */ 41098 webkitKeymap = { 41099 63232: 38, // up 41100 63233: 40, // down 41101 63234: 37, // left 41102 63235: 39, // right 41103 63276: 33, // page up 41104 63277: 34, // page down 41105 25: 9, // SHIFT-TAB (Safari provides a different key code in 41106 // this case, even though the shiftKey modifier is set) 41107 63272: 46, // delete 41108 63273: 36, // home 41109 63275: 35 // end 41110 }, 41111 41112 /** 41113 * Returns a wrapped node. Intended to be used on event targets, 41114 * so it will return the node's parent if the target is a text 41115 * node. 41116 * 41117 * If accessing a property of the node throws an error, this is 41118 * probably the anonymous div wrapper Gecko adds inside text 41119 * nodes. This likely will only occur when attempting to access 41120 * the relatedTarget. In this case, we now return null because 41121 * the anonymous div is completely useless and we do not know 41122 * what the related target was because we can't even get to 41123 * the element's parent node. 41124 * 41125 * @method resolve 41126 * @private 41127 */ 41128 resolve = function(n) { 41129 if (!n) { 41130 return n; 41131 } 41132 try { 41133 if (n && 3 == n.nodeType) { 41134 n = n.parentNode; 41135 } 41136 } catch(e) { 41137 return null; 41138 } 41139 41140 return Y.one(n); 41141 }, 41142 41143 DOMEventFacade = function(ev, currentTarget, wrapper) { 41144 this._event = ev; 41145 this._currentTarget = currentTarget; 41146 this._wrapper = wrapper || EMPTY; 41147 41148 // if not lazy init 41149 this.init(); 41150 }; 41151 41152Y.extend(DOMEventFacade, Object, { 41153 41154 init: function() { 41155 41156 var e = this._event, 41157 overrides = this._wrapper.overrides, 41158 x = e.pageX, 41159 y = e.pageY, 41160 c, 41161 currentTarget = this._currentTarget; 41162 41163 this.altKey = e.altKey; 41164 this.ctrlKey = e.ctrlKey; 41165 this.metaKey = e.metaKey; 41166 this.shiftKey = e.shiftKey; 41167 this.type = (overrides && overrides.type) || e.type; 41168 this.clientX = e.clientX; 41169 this.clientY = e.clientY; 41170 41171 this.pageX = x; 41172 this.pageY = y; 41173
41174 // charCode is unknown in keyup, keydown. keyCode is unknown in keypress. 41175 // FF 3.6 - 8+? pass 0 for keyCode in keypress events. 41176 // Webkit, FF 3.6-8+?, and IE9+? pass 0 for charCode in keydown, keyup. 41177 // Webkit and IE9+? duplicate charCode in keyCode. 41178 // Opera never sets charCode, always keyCode (though with the charCode). 41179 // IE6-8 don't set charCode or which. 41180 // All browsers other than IE6-8 set which=keyCode in keydown, keyup, and 41181 // which=charCode in keypress. 41182 // 41183 // Moral of the story: (e.which || e.keyCode) will always return the 41184 // known code for that key event phase. e.keyCode is often different in 41185 // keypress from keydown and keyup. 41186 c = e.keyCode || e.charCode; 41187 41188 if (ua.webkit && (c in webkitKeymap)) { 41189 c = webkitKeymap[c]; 41190 } 41191 41192 this.keyCode = c; 41193 this.charCode = c; 41194 // Fill in e.which for IE - implementers should always use this over 41195 // e.keyCode or e.charCode. 41196 this.which = e.which || e.charCode || c; 41197 // this.button = e.button; 41198 this.button = this.which; 41199 41200 this.target = resolve(e.target); 41201 this.currentTarget = resolve(currentTarget); 41202 this.relatedTarget = resolve(e.relatedTarget); 41203 41204 if (e.type == "mousewheel" || e.type == "DOMMouseScroll") { 41205 this.wheelDelta = (e.detail) ? (e.detail * -1) : Math.round(e.wheelDelta / 80) || ((e.wheelDelta < 0) ? -1 : 1); 41206 } 41207 41208 if (this._touch) { 41209 this._touch(e, currentTarget, this._wrapper); 41210 } 41211 }, 41212 41213 stopPropagation: function() { 41214 this._event.stopPropagation(); 41215 this._wrapper.stopped = 1; 41216 this.stopped = 1; 41217 }, 41218 41219 stopImmediatePropagation: function() { 41220 var e = this._event; 41221 if (e.stopImmediatePropagation) { 41222 e.stopImmediatePropagation(); 41223 } else { 41224 this.stopPropagation(); 41225 } 41226 this._wrapper.stopped = 2; 41227 this.stopped = 2; 41228 }, 41229 41230 preventDefault: function(returnValue) { 41231 var e = this._event; 41232 e.preventDefault(); 41233 if (returnValue) { 41234 e.returnValue = returnValue; 41235 } 41236 this._wrapper.prevented = 1; 41237 this.prevented = 1; 41238 }, 41239 41240 halt: function(immediate) { 41241 if (immediate) { 41242 this.stopImmediatePropagation(); 41243 } else { 41244 this.stopPropagation(); 41245 } 41246 41247 this.preventDefault(); 41248 } 41249 41250}); 41251 41252DOMEventFacade.resolve = resolve; 41253Y.DOM2EventFacade = DOMEventFacade; 41254Y.DOMEventFacade = DOMEventFacade; 41255 41256 /** 41257 * The native event 41258 * @property _event 41259 * @type {DOMEvent} 41260 * @private 41261 */ 41262 41263 /** 41264 The name of the event (e.g. "click") 41265 41266 @property type 41267 @type {String} 41268 **/ 41269 41270 /** 41271 `true` if the "alt" or "option" key is pressed. 41272 41273 @property altKey 41274 @type {Boolean} 41275 **/ 41276 41277 /** 41278 `true` if the shift key is pressed. 41279 41280 @property shiftKey 41281 @type {Boolean} 41282 **/ 41283 41284 /** 41285 `true` if the "Windows" key on a Windows keyboard, "command" key on an 41286 Apple keyboard, or "meta" key on other keyboards is pressed. 41287 41288 @property metaKey 41289 @type {Boolean} 41290 **/ 41291 41292 /** 41293 `true` if the "Ctrl" or "control" key is pressed. 41294 41295 @property ctrlKey 41296 @type {Boolean} 41297 **/ 41298 41299 /** 41300 * The X location of the event on the page (including scroll) 41301 * @property pageX 41302 * @type {Number} 41303 */ 41304 41305 /** 41306 * The Y location of the event on the page (including scroll) 41307 * @property pageY 41308 * @type {Number} 41309 */ 41310 41311 /** 41312 * The X location of the event in the viewport 41313 * @property clientX 41314 * @type {Number} 41315 */ 41316 41317 /** 41318 * The Y location of the event in the viewport 41319 * @property clientY 41320 * @type {Number} 41321 */ 41322 41323 /** 41324 * The keyCode for key events. Uses charCode if keyCode is not available 41325 * @property keyCode 41326 * @type {Number} 41327 */ 41328 41329 /** 41330 * The charCode for key events. Same as keyCode 41331 * @property charCode 41332 * @type {Number} 41333 */ 41334 41335 /** 41336 * The button that was pushed. 1 for left click, 2 for middle click, 3 for 41337 * right click. This is only reliably populated on `mouseup` events. 41338 * @property button 41339 * @type {Number} 41340 */ 41341 41342 /** 41343 * The button that was pushed. Same as button. 41344 * @property which 41345 * @type {Number} 41346 */ 41347 41348 /** 41349 * Node reference for the targeted element 41350 * @property target 41351 * @type {Node} 41352 */ 41353 41354 /** 41355 * Node reference for the element that the listener was attached to. 41356 * @property currentTarget 41357 * @type {Node} 41358 */ 41359 41360 /** 41361 * Node reference to the relatedTarget 41362 * @property relatedTarget 41363 * @type {Node} 41364 */ 41365 41366 /** 41367 * Number representing the direction and velocity of the movement of the mousewheel. 41368 * Negative is down, the higher the number, the faster. Applies to the mousewheel event. 41369 * @property wheelDelta 41370 * @type {Number} 41371 */ 41372 41373 /** 41374 * Stops the propagation to the next bubble target 41375 * @method stopPropagation 41376 */ 41377 41378 /** 41379 * Stops the propagation to the next bubble target and 41380 * prevents any additional listeners from being exectued 41381 * on the current target. 41382 * @method stopImmediatePropagation 41383 */ 41384 41385 /** 41386 * Prevents the event's default behavior 41387 * @method preventDefault 41388 * @param returnValue {string} sets the returnValue of the event to this value 41389 * (rather than the default false value). This can be used to add a customized 41390 * confirmation query to the beforeunload event). 41391 */ 41392 41393 /** 41394 * Stops the event propagation and prevents the default 41395 * event behavior. 41396 * @method halt 41397 * @param immediate {boolean} if true additional listeners 41398 * on the current target will not be executed 41399 */ 41400(function() { 41401 41402/** 41403 * The event utility provides functions to add and remove event listeners, 41404 * event cleansing. It also tries to automatically remove listeners it 41405 * registers during the unload event. 41406 * @module event 41407 * @main event 41408 * @submodule event-base 41409 */ 41410 41411/** 41412 * The event utility provides functions to add and remove event listeners, 41413 * event cleansing. It also tries to automatically remove listeners it 41414 * registers during the unload event. 41415 * 41416 * @class Event 41417 * @static 41418 */ 41419 41420Y.Env.evt.dom_wrappers = {}; 41421Y.Env.evt.dom_map = {}; 41422 41423var _eventenv = Y.Env.evt, 41424 config = Y.config, 41425 win = config.win, 41426 add = YUI.Env.add, 41427 remove = YUI.Env.remove, 41428 41429 onLoad = function() { 41430 YUI.Env.windowLoaded = true; 41431 Y.Event._load(); 41432 remove(win, "load", onLoad); 41433 }, 41434 41435 onUnload = function() { 41436 Y.Event._unload(); 41437 }, 41438 41439 EVENT_READY = 'domready', 41440 41441 COMPAT_ARG = '~yui|2|compat~', 41442 41443 shouldIterate = function(o) { 41444 try { 41445 // TODO: See if there's a more performant way to return true early on this, for the common case 41446 return (o && typeof o !== "string" && Y.Lang.isNumber(o.length) && !o.tagName && !Y.DOM.isWindow(o)); 41447 } catch(ex) { 41448 return false;
41449 } 41450 }, 41451 41452 // aliases to support DOM event subscription clean up when the last 41453 // subscriber is detached. deleteAndClean overrides the DOM event's wrapper 41454 // CustomEvent _delete method. 41455 _ceProtoDelete = Y.CustomEvent.prototype._delete, 41456 _deleteAndClean = function(s) { 41457 var ret = _ceProtoDelete.apply(this, arguments); 41458 41459 if (!this.hasSubs()) { 41460 Y.Event._clean(this); 41461 } 41462 41463 return ret; 41464 }, 41465 41466Event = function() { 41467 41468 /** 41469 * True after the onload event has fired 41470 * @property _loadComplete 41471 * @type boolean 41472 * @static 41473 * @private 41474 */ 41475 var _loadComplete = false, 41476 41477 /** 41478 * The number of times to poll after window.onload. This number is 41479 * increased if additional late-bound handlers are requested after 41480 * the page load. 41481 * @property _retryCount 41482 * @static 41483 * @private 41484 */ 41485 _retryCount = 0, 41486 41487 /** 41488 * onAvailable listeners 41489 * @property _avail 41490 * @static 41491 * @private 41492 */ 41493 _avail = [], 41494 41495 /** 41496 * Custom event wrappers for DOM events. Key is 41497 * 'event:' + Element uid stamp + event type 41498 * @property _wrappers 41499 * @type CustomEvent 41500 * @static 41501 * @private 41502 */ 41503 _wrappers = _eventenv.dom_wrappers, 41504 41505 _windowLoadKey = null, 41506 41507 /** 41508 * Custom event wrapper map DOM events. Key is 41509 * Element uid stamp. Each item is a hash of custom event 41510 * wrappers as provided in the _wrappers collection. This 41511 * provides the infrastructure for getListeners. 41512 * @property _el_events 41513 * @static 41514 * @private 41515 */ 41516 _el_events = _eventenv.dom_map; 41517 41518 return { 41519 41520 /** 41521 * The number of times we should look for elements that are not 41522 * in the DOM at the time the event is requested after the document 41523 * has been loaded. The default is 1000@amp;40 ms, so it will poll 41524 * for 40 seconds or until all outstanding handlers are bound 41525 * (whichever comes first). 41526 * @property POLL_RETRYS 41527 * @type int 41528 * @static 41529 * @final 41530 */ 41531 POLL_RETRYS: 1000, 41532 41533 /** 41534 * The poll interval in milliseconds 41535 * @property POLL_INTERVAL 41536 * @type int 41537 * @static 41538 * @final 41539 */ 41540 POLL_INTERVAL: 40, 41541 41542 /** 41543 * addListener/removeListener can throw errors in unexpected scenarios. 41544 * These errors are suppressed, the method returns false, and this property 41545 * is set 41546 * @property lastError 41547 * @static 41548 * @type Error 41549 */ 41550 lastError: null, 41551 41552 41553 /** 41554 * poll handle 41555 * @property _interval 41556 * @static 41557 * @private 41558 */ 41559 _interval: null, 41560 41561 /** 41562 * document readystate poll handle 41563 * @property _dri 41564 * @static 41565 * @private 41566 */ 41567 _dri: null, 41568 41569 /** 41570 * True when the document is initially usable 41571 * @property DOMReady 41572 * @type boolean 41573 * @static 41574 */ 41575 DOMReady: false, 41576 41577 /** 41578 * @method startInterval 41579 * @static 41580 * @private 41581 */ 41582 startInterval: function() { 41583 if (!Event._interval) { 41584Event._interval = setInterval(Event._poll, Event.POLL_INTERVAL); 41585 } 41586 }, 41587 41588 /** 41589 * Executes the supplied callback when the item with the supplied 41590 * id is found. This is meant to be used to execute behavior as 41591 * soon as possible as the page loads. If you use this after the 41592 * initial page load it will poll for a fixed time for the element. 41593 * The number of times it will poll and the frequency are 41594 * configurable. By default it will poll for 10 seconds. 41595 * 41596 * <p>The callback is executed with a single parameter: 41597 * the custom object parameter, if provided.</p> 41598 * 41599 * @method onAvailable 41600 * 41601 * @param {string||string[]} id the id of the element, or an array 41602 * of ids to look for. 41603 * @param {function} fn what to execute when the element is found. 41604 * @param {object} p_obj an optional object to be passed back as 41605 * a parameter to fn. 41606 * @param {boolean|object} p_override If set to true, fn will execute 41607 * in the context of p_obj, if set to an object it 41608 * will execute in the context of that object 41609 * @param checkContent {boolean} check child node readiness (onContentReady) 41610 * @static 41611 * @deprecated Use Y.on("available") 41612 */ 41613 // @TODO fix arguments 41614 onAvailable: function(id, fn, p_obj, p_override, checkContent, compat) { 41615 41616 var a = Y.Array(id), i, availHandle; 41617 41618 for (i=0; i<a.length; i=i+1) { 41619 _avail.push({ 41620 id: a[i], 41621 fn: fn, 41622 obj: p_obj, 41623 override: p_override, 41624 checkReady: checkContent, 41625 compat: compat 41626 }); 41627 } 41628 _retryCount = this.POLL_RETRYS; 41629 41630 // We want the first test to be immediate, but async 41631 setTimeout(Event._poll, 0); 41632 41633 availHandle = new Y.EventHandle({ 41634 41635 _delete: function() { 41636 // set by the event system for lazy DOM listeners 41637 if (availHandle.handle) { 41638 availHandle.handle.detach(); 41639 return; 41640 } 41641 41642 var i, j; 41643 41644 // otherwise try to remove the onAvailable listener(s) 41645 for (i = 0; i < a.length; i++) { 41646 for (j = 0; j < _avail.length; j++) { 41647 if (a[i] === _avail[j].id) { 41648 _avail.splice(j, 1); 41649 } 41650 } 41651 } 41652 } 41653 41654 }); 41655 41656 return availHandle; 41657 }, 41658 41659 /** 41660 * Works the same way as onAvailable, but additionally checks the 41661 * state of sibling elements to determine if the content of the 41662 * available element is safe to modify. 41663 * 41664 * <p>The callback is executed with a single parameter:
41665 * the custom object parameter, if provided.</p> 41666 * 41667 * @method onContentReady 41668 * 41669 * @param {string} id the id of the element to look for. 41670 * @param {function} fn what to execute when the element is ready. 41671 * @param {object} obj an optional object to be passed back as 41672 * a parameter to fn. 41673 * @param {boolean|object} override If set to true, fn will execute 41674 * in the context of p_obj. If an object, fn will 41675 * exectute in the context of that object 41676 * 41677 * @static 41678 * @deprecated Use Y.on("contentready") 41679 */ 41680 // @TODO fix arguments 41681 onContentReady: function(id, fn, obj, override, compat) { 41682 return Event.onAvailable(id, fn, obj, override, true, compat); 41683 }, 41684 41685 /** 41686 * Adds an event listener 41687 * 41688 * @method attach 41689 * 41690 * @param {String} type The type of event to append 41691 * @param {Function} fn The method the event invokes 41692 * @param {String|HTMLElement|Array|NodeList} el An id, an element 41693 * reference, or a collection of ids and/or elements to assign the 41694 * listener to. 41695 * @param {Object} context optional context object 41696 * @param {Boolean|object} args 0..n arguments to pass to the callback 41697 * @return {EventHandle} an object to that can be used to detach the listener 41698 * 41699 * @static 41700 */ 41701 41702 attach: function(type, fn, el, context) { 41703 return Event._attach(Y.Array(arguments, 0, true)); 41704 }, 41705 41706 _createWrapper: function (el, type, capture, compat, facade) { 41707 41708 var cewrapper, 41709 ek = Y.stamp(el), 41710 key = 'event:' + ek + type; 41711 41712 if (false === facade) { 41713 key += 'native'; 41714 } 41715 if (capture) { 41716 key += 'capture'; 41717 } 41718 41719 41720 cewrapper = _wrappers[key]; 41721 41722 41723 if (!cewrapper) { 41724 // create CE wrapper 41725 cewrapper = Y.publish(key, { 41726 silent: true, 41727 bubbles: false, 41728 emitFacade:false, 41729 contextFn: function() { 41730 if (compat) { 41731 return cewrapper.el; 41732 } else { 41733 cewrapper.nodeRef = cewrapper.nodeRef || Y.one(cewrapper.el); 41734 return cewrapper.nodeRef; 41735 } 41736 } 41737 }); 41738 41739 cewrapper.overrides = {}; 41740 41741 // for later removeListener calls 41742 cewrapper.el = el; 41743 cewrapper.key = key; 41744 cewrapper.domkey = ek; 41745 cewrapper.type = type; 41746 cewrapper.fn = function(e) { 41747 cewrapper.fire(Event.getEvent(e, el, (compat || (false === facade)))); 41748 }; 41749 cewrapper.capture = capture; 41750 41751 if (el == win && type == "load") { 41752 // window load happens once 41753 cewrapper.fireOnce = true; 41754 _windowLoadKey = key; 41755 } 41756 cewrapper._delete = _deleteAndClean; 41757 41758 _wrappers[key] = cewrapper; 41759 _el_events[ek] = _el_events[ek] || {}; 41760 _el_events[ek][key] = cewrapper; 41761 41762 add(el, type, cewrapper.fn, capture); 41763 } 41764 41765 return cewrapper; 41766 41767 }, 41768 41769 _attach: function(args, conf) { 41770 41771 var compat, 41772 handles, oEl, cewrapper, context, 41773 fireNow = false, ret, 41774 type = args[0], 41775 fn = args[1], 41776 el = args[2] || win, 41777 facade = conf && conf.facade, 41778 capture = conf && conf.capture, 41779 overrides = conf && conf.overrides; 41780 41781 if (args[args.length-1] === COMPAT_ARG) { 41782 compat = true; 41783 } 41784 41785 if (!fn || !fn.call) { 41786 return false;
41787 } 41788 41789 // The el argument can be an array of elements or element ids. 41790 if (shouldIterate(el)) { 41791 41792 handles=[]; 41793 41794 Y.each(el, function(v, k) { 41795 args[2] = v; 41796 handles.push(Event._attach(args.slice(), conf)); 41797 }); 41798 41799 // return (handles.length === 1) ? handles[0] : handles; 41800 return new Y.EventHandle(handles); 41801 41802 // If the el argument is a string, we assume it is 41803 // actually the id of the element. If the page is loaded 41804 // we convert el to the actual element, otherwise we 41805 // defer attaching the event until the element is 41806 // ready 41807 } else if (Y.Lang.isString(el)) { 41808 41809 // oEl = (compat) ? Y.DOM.byId(el) : Y.Selector.query(el); 41810 41811 if (compat) { 41812 oEl = Y.DOM.byId(el); 41813 } else { 41814 41815 oEl = Y.Selector.query(el); 41816 41817 switch (oEl.length) { 41818 case 0: 41819 oEl = null; 41820 break; 41821 case 1: 41822 oEl = oEl[0]; 41823 break; 41824 default: 41825 args[2] = oEl; 41826 return Event._attach(args, conf); 41827 } 41828 } 41829 41830 if (oEl) { 41831 41832 el = oEl; 41833 41834 // Not found = defer adding the event until the element is available 41835 } else { 41836 41837 ret = Event.onAvailable(el, function() { 41838 41839 ret.handle = Event._attach(args, conf); 41840 41841 }, Event, true, false, compat); 41842 41843 return ret; 41844 41845 } 41846 } 41847 41848 // Element should be an html element or node 41849 if (!el) { 41850 return false; 41851 } 41852 41853 if (Y.Node && Y.instanceOf(el, Y.Node)) { 41854 el = Y.Node.getDOMNode(el); 41855 } 41856 41857 cewrapper = Event._createWrapper(el, type, capture, compat, facade); 41858 if (overrides) { 41859 Y.mix(cewrapper.overrides, overrides); 41860 } 41861 41862 if (el == win && type == "load") { 41863 41864 // if the load is complete, fire immediately. 41865 // all subscribers, including the current one 41866 // will be notified. 41867 if (YUI.Env.windowLoaded) { 41868 fireNow = true; 41869 } 41870 } 41871 41872 if (compat) { 41873 args.pop(); 41874 } 41875 41876 context = args[3]; 41877 41878 // set context to the Node if not specified 41879 // ret = cewrapper.on.apply(cewrapper, trimmedArgs); 41880 ret = cewrapper._on(fn, context, (args.length > 4) ? args.slice(4) : null); 41881 41882 if (fireNow) { 41883 cewrapper.fire(); 41884 } 41885 41886 return ret; 41887 41888 }, 41889 41890 /** 41891 * Removes an event listener. Supports the signature the event was bound 41892 * with, but the preferred way to remove listeners is using the handle 41893 * that is returned when using Y.on 41894 * 41895 * @method detach 41896 * 41897 * @param {String} type the type of event to remove. 41898 * @param {Function} fn the method the event invokes. If fn is 41899 * undefined, then all event handlers for the type of event are 41900 * removed. 41901 * @param {String|HTMLElement|Array|NodeList|EventHandle} el An 41902 * event handle, an id, an element reference, or a collection 41903 * of ids and/or elements to remove the listener from. 41904 * @return {boolean} true if the unbind was successful, false otherwise. 41905 * @static 41906 */ 41907 detach: function(type, fn, el, obj) { 41908 41909 var args=Y.Array(arguments, 0, true), compat, l, ok, i, 41910 id, ce; 41911 41912 if (args[args.length-1] === COMPAT_ARG) { 41913 compat = true; 41914 // args.pop(); 41915 } 41916 41917 if (type && type.detach) { 41918 return type.detach(); 41919 } 41920 41921 // The el argument can be a string 41922 if (typeof el == "string") { 41923 41924 // el = (compat) ? Y.DOM.byId(el) : Y.all(el); 41925 if (compat) { 41926 el = Y.DOM.byId(el); 41927 } else { 41928 el = Y.Selector.query(el); 41929 l = el.length; 41930 if (l < 1) { 41931 el = null; 41932 } else if (l == 1) { 41933 el = el[0]; 41934 } 41935 } 41936 // return Event.detach.apply(Event, args); 41937 } 41938 41939 if (!el) { 41940 return false;
41941 } 41942 41943 if (el.detach) { 41944 args.splice(2, 1); 41945 return el.detach.apply(el, args); 41946 // The el argument can be an array of elements or element ids. 41947 } else if (shouldIterate(el)) { 41948 ok = true; 41949 for (i=0, l=el.length; i<l; ++i) { 41950 args[2] = el[i]; 41951 ok = ( Y.Event.detach.apply(Y.Event, args) && ok ); 41952 } 41953 41954 return ok; 41955 } 41956 41957 if (!type || !fn || !fn.call) { 41958 return Event.purgeElement(el, false, type); 41959 } 41960 41961 id = 'event:' + Y.stamp(el) + type; 41962 ce = _wrappers[id]; 41963 41964 if (ce) { 41965 return ce.detach(fn); 41966 } else { 41967 return false; 41968 } 41969 41970 }, 41971 41972 /** 41973 * Finds the event in the window object, the caller's arguments, or 41974 * in the arguments of another method in the callstack. This is 41975 * executed automatically for events registered through the event 41976 * manager, so the implementer should not normally need to execute 41977 * this function at all. 41978 * @method getEvent 41979 * @param {Event} e the event parameter from the handler 41980 * @param {HTMLElement} el the element the listener was attached to 41981 * @return {Event} the event 41982 * @static 41983 */ 41984 getEvent: function(e, el, noFacade) { 41985 var ev = e || win.event; 41986 41987 return (noFacade) ? ev : 41988 new Y.DOMEventFacade(ev, el, _wrappers['event:' + Y.stamp(el) + e.type]); 41989 }, 41990 41991 /** 41992 * Generates an unique ID for the element if it does not already 41993 * have one. 41994 * @method generateId 41995 * @param el the element to create the id for 41996 * @return {string} the resulting id of the element 41997 * @static 41998 */ 41999 generateId: function(el) { 42000 return Y.DOM.generateID(el); 42001 }, 42002 42003 /** 42004 * We want to be able to use getElementsByTagName as a collection 42005 * to attach a group of events to. Unfortunately, different 42006 * browsers return different types of collections. This function 42007 * tests to determine if the object is array-like. It will also 42008 * fail if the object is an array, but is empty. 42009 * @method _isValidCollection 42010 * @param o the object to test 42011 * @return {boolean} true if the object is array-like and populated 42012 * @deprecated was not meant to be used directly 42013 * @static 42014 * @private 42015 */ 42016 _isValidCollection: shouldIterate, 42017 42018 /** 42019 * hook up any deferred listeners 42020 * @method _load 42021 * @static 42022 * @private 42023 */ 42024 _load: function(e) { 42025 if (!_loadComplete) { 42026 _loadComplete = true; 42027 42028 // Just in case DOMReady did not go off for some reason 42029 // E._ready(); 42030 if (Y.fire) { 42031 Y.fire(EVENT_READY); 42032 } 42033 42034 // Available elements may not have been detected before the 42035 // window load event fires. Try to find them now so that the 42036 // the user is more likely to get the onAvailable notifications 42037 // before the window load notification 42038 Event._poll(); 42039 } 42040 }, 42041 42042 /** 42043 * Polling function that runs before the onload event fires, 42044 * attempting to attach to DOM Nodes as soon as they are 42045 * available 42046 * @method _poll 42047 * @static 42048 * @private 42049 */ 42050 _poll: function() { 42051 if (Event.locked) { 42052 return; 42053 } 42054 42055 if (Y.UA.ie && !YUI.Env.DOMReady) { 42056 // Hold off if DOMReady has not fired and check current 42057 // readyState to protect against the IE operation aborted 42058 // issue. 42059 Event.startInterval(); 42060 return; 42061 } 42062 42063 Event.locked = true; 42064 42065 // keep trying until after the page is loaded. We need to 42066 // check the page load state prior to trying to bind the 42067 // elements so that we can be certain all elements have been 42068 // tested appropriately 42069 var i, len, item, el, notAvail, executeItem, 42070 tryAgain = !_loadComplete; 42071 42072 if (!tryAgain) { 42073 tryAgain = (_retryCount > 0); 42074 } 42075 42076 // onAvailable 42077 notAvail = []; 42078 42079 executeItem = function (el, item) { 42080 var context, ov = item.override; 42081 try { 42082 if (item.compat) { 42083 if (item.override) { 42084 if (ov === true) { 42085 context = item.obj; 42086 } else { 42087 context = ov; 42088 } 42089 } else { 42090 context = el; 42091 } 42092 item.fn.call(context, item.obj); 42093 } else { 42094 context = item.obj || Y.one(el); 42095 item.fn.apply(context, (Y.Lang.isArray(ov)) ? ov : []); 42096 } 42097 } catch (e) { 42098 } 42099 }; 42100 42101 // onAvailable 42102 for (i=0,len=_avail.length; i<len; ++i) { 42103 item = _avail[i]; 42104 if (item && !item.checkReady) { 42105 42106 // el = (item.compat) ? Y.DOM.byId(item.id) : Y.one(item.id); 42107 el = (item.compat) ? Y.DOM.byId(item.id) : Y.Selector.query(item.id, null, true); 42108 42109 if (el) { 42110 executeItem(el, item); 42111 _avail[i] = null; 42112 } else { 42113 notAvail.push(item); 42114 } 42115 } 42116 } 42117 42118 // onContentReady 42119 for (i=0,len=_avail.length; i<len; ++i) { 42120 item = _avail[i]; 42121 if (item && item.checkReady) { 42122 42123 // el = (item.compat) ? Y.DOM.byId(item.id) : Y.one(item.id); 42124 el = (item.compat) ? Y.DOM.byId(item.id) : Y.Selector.query(item.id, null, true); 42125 42126 if (el) { 42127 // The element is available, but not necessarily ready 42128 // @todo should we test parentNode.nextSibling? 42129 if (_loadComplete || (el.get && el.get('nextSibling')) || el.nextSibling) { 42130 executeItem(el, item); 42131 _avail[i] = null; 42132 } 42133 } else { 42134 notAvail.push(item); 42135 } 42136 } 42137 } 42138 42139 _retryCount = (notAvail.length === 0) ? 0 : _retryCount - 1; 42140 42141 if (tryAgain) { 42142 // we may need to strip the nulled out items here 42143 Event.startInterval(); 42144 } else { 42145 clearInterval(Event._interval); 42146 Event._interval = null; 42147 } 42148 42149 Event.locked = false;
42150 42151 return; 42152 42153 }, 42154 42155 /** 42156 * Removes all listeners attached to the given element via addListener. 42157 * Optionally, the node's children can also be purged. 42158 * Optionally, you can specify a specific type of event to remove. 42159 * @method purgeElement 42160 * @param {HTMLElement} el the element to purge 42161 * @param {boolean} recurse recursively purge this element's children 42162 * as well. Use with caution. 42163 * @param {string} type optional type of listener to purge. If 42164 * left out, all listeners will be removed 42165 * @static 42166 */ 42167 purgeElement: function(el, recurse, type) { 42168 // var oEl = (Y.Lang.isString(el)) ? Y.one(el) : el, 42169 var oEl = (Y.Lang.isString(el)) ? Y.Selector.query(el, null, true) : el, 42170 lis = Event.getListeners(oEl, type), i, len, children, child; 42171 42172 if (recurse && oEl) { 42173 lis = lis || []; 42174 children = Y.Selector.query('*', oEl); 42175 len = children.length; 42176 for (i = 0; i < len; ++i) { 42177 child = Event.getListeners(children[i], type); 42178 if (child) { 42179 lis = lis.concat(child); 42180 } 42181 } 42182 } 42183 42184 if (lis) { 42185 for (i = 0, len = lis.length; i < len; ++i) { 42186 lis[i].detachAll(); 42187 } 42188 } 42189 42190 }, 42191 42192 /** 42193 * Removes all object references and the DOM proxy subscription for 42194 * a given event for a DOM node. 42195 * 42196 * @method _clean 42197 * @param wrapper {CustomEvent} Custom event proxy for the DOM 42198 * subscription 42199 * @private 42200 * @static 42201 * @since 3.4.0 42202 */ 42203 _clean: function (wrapper) { 42204 var key = wrapper.key, 42205 domkey = wrapper.domkey; 42206 42207 remove(wrapper.el, wrapper.type, wrapper.fn, wrapper.capture); 42208 delete _wrappers[key]; 42209 delete Y._yuievt.events[key]; 42210 if (_el_events[domkey]) { 42211 delete _el_events[domkey][key]; 42212 if (!Y.Object.size(_el_events[domkey])) { 42213 delete _el_events[domkey]; 42214 } 42215 } 42216 }, 42217 42218 /** 42219 * Returns all listeners attached to the given element via addListener. 42220 * Optionally, you can specify a specific type of event to return. 42221 * @method getListeners 42222 * @param el {HTMLElement|string} the element or element id to inspect 42223 * @param type {string} optional type of listener to return. If 42224 * left out, all listeners will be returned 42225 * @return {CustomEvent} the custom event wrapper for the DOM event(s) 42226 * @static 42227 */ 42228 getListeners: function(el, type) { 42229 var ek = Y.stamp(el, true), evts = _el_events[ek], 42230 results=[] , key = (type) ? 'event:' + ek + type : null, 42231 adapters = _eventenv.plugins; 42232 42233 if (!evts) { 42234 return null; 42235 } 42236 42237 if (key) { 42238 // look for synthetic events 42239 if (adapters[type] && adapters[type].eventDef) { 42240 key += '_synth'; 42241 } 42242 42243 if (evts[key]) { 42244 results.push(evts[key]); 42245 } 42246 42247 // get native events as well 42248 key += 'native'; 42249 if (evts[key]) { 42250 results.push(evts[key]); 42251 } 42252 42253 } else { 42254 Y.each(evts, function(v, k) { 42255 results.push(v); 42256 }); 42257 } 42258 42259 return (results.length) ? results : null; 42260 }, 42261 42262 /** 42263 * Removes all listeners registered by pe.event. Called 42264 * automatically during the unload event. 42265 * @method _unload 42266 * @static 42267 * @private 42268 */ 42269 _unload: function(e) { 42270 Y.each(_wrappers, function(v, k) { 42271 if (v.type == 'unload') { 42272 v.fire(e); 42273 } 42274 v.detachAll(); 42275 }); 42276 remove(win, "unload", onUnload); 42277 }, 42278 42279 /** 42280 * Adds a DOM event directly without the caching, cleanup, context adj, etc 42281 *
42282 * @method nativeAdd 42283 * @param {HTMLElement} el the element to bind the handler to 42284 * @param {string} type the type of event handler 42285 * @param {function} fn the callback to invoke 42286 * @param {Boolean} capture capture or bubble phase 42287 * @static 42288 * @private 42289 */ 42290 nativeAdd: add, 42291 42292 /** 42293 * Basic remove listener 42294 * 42295 * @method nativeRemove 42296 * @param {HTMLElement} el the element to bind the handler to 42297 * @param {string} type the type of event handler 42298 * @param {function} fn the callback to invoke 42299 * @param {Boolean} capture capture or bubble phase 42300 * @static 42301 * @private 42302 */ 42303 nativeRemove: remove 42304 }; 42305 42306}(); 42307 42308Y.Event = Event; 42309 42310if (config.injected || YUI.Env.windowLoaded) { 42311 onLoad(); 42312} else { 42313 add(win, "load", onLoad); 42314} 42315 42316// Process onAvailable/onContentReady items when when the DOM is ready in IE 42317if (Y.UA.ie) { 42318 Y.on(EVENT_READY, Event._poll); 42319 42320 // In IE6 and below, detach event handlers when the page is unloaded in 42321 // order to try and prevent cross-page memory leaks. This isn't done in 42322 // other browsers because a) it's not necessary, and b) it breaks the 42323 // back/forward cache. 42324 if (Y.UA.ie < 7) { 42325 try { 42326 add(win, "unload", onUnload); 42327 } catch(e) { 42328 } 42329 } 42330} 42331 42332Event.Custom = Y.CustomEvent; 42333Event.Subscriber = Y.Subscriber; 42334Event.Target = Y.EventTarget; 42335Event.Handle = Y.EventHandle; 42336Event.Facade = Y.EventFacade; 42337 42338Event._poll(); 42339 42340}()); 42341 42342/** 42343 * DOM event listener abstraction layer 42344 * @module event 42345 * @submodule event-base 42346 */ 42347 42348/** 42349 * Executes the callback as soon as the specified element 42350 * is detected in the DOM. This function expects a selector 42351 * string for the element(s) to detect. If you already have 42352 * an element reference, you don't need this event. 42353 * @event available 42354 * @param type {string} 'available' 42355 * @param fn {function} the callback function to execute. 42356 * @param el {string} an selector for the element(s) to attach 42357 * @param context optional argument that specifies what 'this' refers to. 42358 * @param args* 0..n additional arguments to pass on to the callback function. 42359 * These arguments will be added after the event object. 42360 * @return {EventHandle} the detach handle 42361 * @for YUI 42362 */ 42363Y.Env.evt.plugins.available = { 42364 on: function(type, fn, id, o) { 42365 var a = arguments.length > 4 ? Y.Array(arguments, 4, true) : null; 42366 return Y.Event.onAvailable.call(Y.Event, id, fn, o, a); 42367 } 42368}; 42369 42370/** 42371 * Executes the callback as soon as the specified element 42372 * is detected in the DOM with a nextSibling property 42373 * (indicating that the element's children are available). 42374 * This function expects a selector 42375 * string for the element(s) to detect. If you already have 42376 * an element reference, you don't need this event. 42377 * @event contentready 42378 * @param type {string} 'contentready' 42379 * @param fn {function} the callback function to execute. 42380 * @param el {string} an selector for the element(s) to attach. 42381 * @param context optional argument that specifies what 'this' refers to. 42382 * @param args* 0..n additional arguments to pass on to the callback function. 42383 * These arguments will be added after the event object. 42384 * @return {EventHandle} the detach handle 42385 * @for YUI 42386 */ 42387Y.Env.evt.plugins.contentready = { 42388 on: function(type, fn, id, o) { 42389 var a = arguments.length > 4 ? Y.Array(arguments, 4, true) : null; 42390 return Y.Event.onContentReady.call(Y.Event, id, fn, o, a); 42391 } 42392}; 42393 42394 42395}, 'patched-v3.18.3', {"requires": ["event-custom-base"]}); 42396 42397YUI.add('event-custom-base', function (Y, NAME) { 42398 42399/** 42400 * Custom event engine, DOM event listener abstraction layer, synthetic DOM 42401 * events. 42402 * @module event-custom 42403 */ 42404 42405Y.Env.evt = { 42406 handles: {}, 42407 plugins: {} 42408}; 42409 42410/** 42411 * Custom event engine, DOM event listener abstraction layer, synthetic DOM 42412 * events. 42413 * @module event-custom 42414 * @submodule event-custom-base 42415 */ 42416 42417/** 42418 * Allows for the insertion of methods that are executed before or after 42419 * a specified method 42420 * @class Do 42421 * @static 42422 */ 42423 42424var DO_BEFORE = 0, 42425 DO_AFTER = 1, 42426 42427DO = { 42428 42429 /** 42430 * Cache of objects touched by the utility 42431 * @property objs 42432 * @static 42433 * @deprecated Since 3.6.0. The `_yuiaop` property on the AOP'd object 42434 * replaces the role of this property, but is considered to be private, and 42435 * is only mentioned to provide a migration path. 42436 * 42437 * If you have a use case which warrants migration to the _yuiaop property,
42438 * please file a ticket to let us know what it's used for and we can see if 42439 * we need to expose hooks for that functionality more formally. 42440 */ 42441 objs: null, 42442 42443 /** 42444 * <p>Execute the supplied method before the specified function. Wrapping 42445 * function may optionally return an instance of the following classes to 42446 * further alter runtime behavior:</p> 42447 * <dl> 42448 * <dt></code>Y.Do.Halt(message, returnValue)</code></dt> 42449 * <dd>Immediatly stop execution and return 42450 * <code>returnValue</code>. No other wrapping functions will be 42451 * executed.</dd> 42452 * <dt></code>Y.Do.AlterArgs(message, newArgArray)</code></dt> 42453 * <dd>Replace the arguments that the original function will be 42454 * called with.</dd> 42455 * <dt></code>Y.Do.Prevent(message)</code></dt> 42456 * <dd>Don't execute the wrapped function. Other before phase 42457 * wrappers will be executed.</dd> 42458 * </dl> 42459 * 42460 * @method before 42461 * @param fn {Function} the function to execute 42462 * @param obj the object hosting the method to displace 42463 * @param sFn {string} the name of the method to displace 42464 * @param c The execution context for fn 42465 * @param arg* {mixed} 0..n additional arguments to supply to the subscriber 42466 * when the event fires. 42467 * @return {EventHandle} handle for the subscription 42468 * @static 42469 */ 42470 before: function(fn, obj, sFn, c) { 42471 var f = fn, a; 42472 if (c) { 42473 a = [fn, c].concat(Y.Array(arguments, 4, true)); 42474 f = Y.rbind.apply(Y, a); 42475 } 42476 42477 return this._inject(DO_BEFORE, f, obj, sFn); 42478 }, 42479 42480 /** 42481 * <p>Execute the supplied method after the specified function. Wrapping 42482 * function may optionally return an instance of the following classes to 42483 * further alter runtime behavior:</p> 42484 * <dl> 42485 * <dt></code>Y.Do.Halt(message, returnValue)</code></dt> 42486 * <dd>Immediatly stop execution and return 42487 * <code>returnValue</code>. No other wrapping functions will be 42488 * executed.</dd> 42489 * <dt></code>Y.Do.AlterReturn(message, returnValue)</code></dt> 42490 * <dd>Return <code>returnValue</code> instead of the wrapped 42491 * method's original return value. This can be further altered by 42492 * other after phase wrappers.</dd> 42493 * </dl> 42494 * 42495 * <p>The static properties <code>Y.Do.originalRetVal</code> and 42496 * <code>Y.Do.currentRetVal</code> will be populated for reference.</p> 42497 * 42498 * @method after 42499 * @param fn {Function} the function to execute 42500 * @param obj the object hosting the method to displace 42501 * @param sFn {string} the name of the method to displace 42502 * @param c The execution context for fn 42503 * @param arg* {mixed} 0..n additional arguments to supply to the subscriber 42504 * @return {EventHandle} handle for the subscription 42505 * @static 42506 */ 42507 after: function(fn, obj, sFn, c) { 42508 var f = fn, a; 42509 if (c) { 42510 a = [fn, c].concat(Y.Array(arguments, 4, true)); 42511 f = Y.rbind.apply(Y, a); 42512 } 42513 42514 return this._inject(DO_AFTER, f, obj, sFn); 42515 }, 42516 42517 /** 42518 * Execute the supplied method before or after the specified function. 42519 * Used by <code>before</code> and <code>after</code>. 42520 * 42521 * @method _inject 42522 * @param when {string} before or after 42523 * @param fn {Function} the function to execute 42524 * @param obj the object hosting the method to displace 42525 * @param sFn {string} the name of the method to displace 42526 * @param c The execution context for fn 42527 * @return {EventHandle} handle for the subscription 42528 * @private 42529 * @static 42530 */ 42531 _inject: function(when, fn, obj, sFn) { 42532 // object id 42533 var id = Y.stamp(obj), o, sid; 42534 42535 if (!obj._yuiaop) { 42536 // create a map entry for the obj if it doesn't exist, to hold overridden methods 42537 obj._yuiaop = {}; 42538 } 42539 42540 o = obj._yuiaop; 42541 42542 if (!o[sFn]) { 42543 // create a map entry for the method if it doesn't exist 42544 o[sFn] = new Y.Do.Method(obj, sFn); 42545 42546 // re-route the method to our wrapper 42547 obj[sFn] = function() { 42548 return o[sFn].exec.apply(o[sFn], arguments); 42549 }; 42550 } 42551 42552 // subscriber id 42553 sid = id + Y.stamp(fn) + sFn; 42554 42555 // register the callback 42556 o[sFn].register(sid, fn, when); 42557 42558 return new Y.EventHandle(o[sFn], sid); 42559 }, 42560 42561 /** 42562 * Detach a before or after subscription. 42563 * 42564 * @method detach 42565 * @param handle {EventHandle} the subscription handle 42566 * @static 42567 */ 42568 detach: function(handle) { 42569 if (handle.detach) { 42570 handle.detach(); 42571 } 42572 } 42573}; 42574 42575Y.Do = DO; 42576 42577////////////////////////////////////////////////////////////////////////// 42578 42579/** 42580 * Contains the return value from the wrapped method, accessible 42581 * by 'after' event listeners. 42582 * 42583 * @property originalRetVal 42584 * @static 42585 * @since 3.2.0 42586 */ 42587
42588/** 42589 * Contains the current state of the return value, consumable by 42590 * 'after' event listeners, and updated if an after subscriber 42591 * changes the return value generated by the wrapped function. 42592 * 42593 * @property currentRetVal 42594 * @static 42595 * @since 3.2.0 42596 */ 42597 42598////////////////////////////////////////////////////////////////////////// 42599 42600/** 42601 * Wrapper for a displaced method with aop enabled 42602 * @class Do.Method 42603 * @constructor 42604 * @param obj The object to operate on 42605 * @param sFn The name of the method to displace 42606 */ 42607DO.Method = function(obj, sFn) { 42608 this.obj = obj; 42609 this.methodName = sFn; 42610 this.method = obj[sFn]; 42611 this.before = {}; 42612 this.after = {}; 42613}; 42614 42615/** 42616 * Register a aop subscriber 42617 * @method register 42618 * @param sid {string} the subscriber id 42619 * @param fn {Function} the function to execute 42620 * @param when {string} when to execute the function 42621 */ 42622DO.Method.prototype.register = function (sid, fn, when) { 42623 if (when) { 42624 this.after[sid] = fn; 42625 } else { 42626 this.before[sid] = fn; 42627 } 42628}; 42629 42630/** 42631 * Unregister a aop subscriber 42632 * @method delete 42633 * @param sid {string} the subscriber id 42634 * @param fn {Function} the function to execute 42635 * @param when {string} when to execute the function 42636 */ 42637DO.Method.prototype._delete = function (sid) { 42638 delete this.before[sid]; 42639 delete this.after[sid]; 42640}; 42641 42642/** 42643 * <p>Execute the wrapped method. All arguments are passed into the wrapping 42644 * functions. If any of the before wrappers return an instance of 42645 * <code>Y.Do.Halt</code> or <code>Y.Do.Prevent</code>, neither the wrapped 42646 * function nor any after phase subscribers will be executed.</p> 42647 * 42648 * <p>The return value will be the return value of the wrapped function or one 42649 * provided by a wrapper function via an instance of <code>Y.Do.Halt</code> or 42650 * <code>Y.Do.AlterReturn</code>. 42651 * 42652 * @method exec 42653 * @param arg* {any} Arguments are passed to the wrapping and wrapped functions 42654 * @return {any} Return value of wrapped function unless overwritten (see above) 42655 */ 42656DO.Method.prototype.exec = function () { 42657 42658 var args = Y.Array(arguments, 0, true), 42659 i, ret, newRet, 42660 bf = this.before, 42661 af = this.after, 42662 prevented = false; 42663 42664 // execute before 42665 for (i in bf) { 42666 if (bf.hasOwnProperty(i)) { 42667 ret = bf[i].apply(this.obj, args); 42668 if (ret) { 42669 switch (ret.constructor) { 42670 case DO.Halt: 42671 return ret.retVal; 42672 case DO.AlterArgs: 42673 args = ret.newArgs; 42674 break; 42675 case DO.Prevent: 42676 prevented = true; 42677 break; 42678 default: 42679 } 42680 } 42681 } 42682 } 42683 42684 // execute method 42685 if (!prevented) { 42686 ret = this.method.apply(this.obj, args); 42687 } 42688 42689 DO.originalRetVal = ret; 42690 DO.currentRetVal = ret; 42691 42692 // execute after methods. 42693 for (i in af) { 42694 if (af.hasOwnProperty(i)) { 42695 newRet = af[i].apply(this.obj, args); 42696 // Stop processing if a Halt object is returned 42697 if (newRet && newRet.constructor === DO.Halt) { 42698 return newRet.retVal; 42699 // Check for a new return value 42700 } else if (newRet && newRet.constructor === DO.AlterReturn) { 42701 ret = newRet.newRetVal; 42702 // Update the static retval state 42703 DO.currentRetVal = ret; 42704 } 42705 } 42706 } 42707 42708 return ret; 42709}; 42710 42711////////////////////////////////////////////////////////////////////////// 42712 42713/** 42714 * Return an AlterArgs object when you want to change the arguments that 42715 * were passed into the function. Useful for Do.before subscribers. An 42716 * example would be a service that scrubs out illegal characters prior to 42717 * executing the core business logic. 42718 * @class Do.AlterArgs 42719 * @constructor 42720 * @param msg {String} (optional) Explanation of the altered return value 42721 * @param newArgs {Array} Call parameters to be used for the original method 42722 * instead of the arguments originally passed in. 42723 */ 42724DO.AlterArgs = function(msg, newArgs) { 42725 this.msg = msg; 42726 this.newArgs = newArgs; 42727}; 42728 42729/** 42730 * Return an AlterReturn object when you want to change the result returned 42731 * from the core method to the caller. Useful for Do.after subscribers. 42732 * @class Do.AlterReturn 42733 * @constructor 42734 * @param msg {String} (optional) Explanation of the altered return value 42735 * @param newRetVal {any} Return value passed to code that invoked the wrapped 42736 * function. 42737 */ 42738DO.AlterReturn = function(msg, newRetVal) { 42739 this.msg = msg; 42740 this.newRetVal = newRetVal; 42741}; 42742 42743/** 42744 * Return a Halt object when you want to terminate the execution 42745 * of all subsequent subscribers as well as the wrapped method 42746 * if it has not exectued yet. Useful for Do.before subscribers. 42747 * @class Do.Halt 42748 * @constructor 42749 * @param msg {String} (optional) Explanation of why the termination was done 42750 * @param retVal {any} Return value passed to code that invoked the wrapped 42751 * function. 42752 */ 42753DO.Halt = function(msg, retVal) { 42754 this.msg = msg; 42755 this.retVal = retVal; 42756}; 42757 42758/** 42759 * Return a Prevent object when you want to prevent the wrapped function 42760 * from executing, but want the remaining listeners to execute. Useful 42761 * for Do.before subscribers. 42762 * @class Do.Prevent 42763 * @constructor 42764 * @param msg {String} (optional) Explanation of why the termination was done 42765 */ 42766DO.Prevent = function(msg) { 42767 this.msg = msg; 42768}; 42769 42770/** 42771 * Return an Error object when you want to terminate the execution 42772 * of all subsequent method calls. 42773 * @class Do.Error 42774 * @constructor 42775 * @param msg {String} (optional) Explanation of the altered return value 42776 * @param retVal {any} Return value passed to code that invoked the wrapped 42777 * function. 42778 * @deprecated use Y.Do.Halt or Y.Do.Prevent 42779 */ 42780DO.Error = DO.Halt; 42781 42782
42783////////////////////////////////////////////////////////////////////////// 42784 42785/** 42786 * Custom event engine, DOM event listener abstraction layer, synthetic DOM 42787 * events. 42788 * @module event-custom 42789 * @submodule event-custom-base 42790 */ 42791 42792 42793// var onsubscribeType = "_event:onsub", 42794var YArray = Y.Array, 42795 42796 AFTER = 'after', 42797 CONFIGS = [ 42798 'broadcast', 42799 'monitored', 42800 'bubbles', 42801 'context', 42802 'contextFn', 42803 'currentTarget', 42804 'defaultFn', 42805 'defaultTargetOnly', 42806 'details', 42807 'emitFacade', 42808 'fireOnce', 42809 'async', 42810 'host', 42811 'preventable', 42812 'preventedFn', 42813 'queuable', 42814 'silent', 42815 'stoppedFn', 42816 'target', 42817 'type' 42818 ], 42819 42820 CONFIGS_HASH = YArray.hash(CONFIGS), 42821 42822 nativeSlice = Array.prototype.slice, 42823 42824 YUI3_SIGNATURE = 9, 42825 YUI_LOG = 'yui:log', 42826 42827 mixConfigs = function(r, s, ov) { 42828 var p; 42829 42830 for (p in s) { 42831 if (CONFIGS_HASH[p] && (ov || !(p in r))) { 42832 r[p] = s[p]; 42833 } 42834 } 42835 42836 return r; 42837 }; 42838 42839/** 42840 * The CustomEvent class lets you define events for your application 42841 * that can be subscribed to by one or more independent component. 42842 * 42843 * @param {String} type The type of event, which is passed to the callback 42844 * when the event fires. 42845 * @param {object} defaults configuration object. 42846 * @class CustomEvent 42847 * @constructor 42848 */ 42849 42850 /** 42851 * The type of event, returned to subscribers when the event fires 42852 * @property type 42853 * @type string 42854 */ 42855 42856/** 42857 * By default all custom events are logged in the debug build, set silent 42858 * to true to disable debug outpu for this event. 42859 * @property silent 42860 * @type boolean 42861 */ 42862 42863Y.CustomEvent = function(type, defaults) { 42864 42865 this._kds = Y.CustomEvent.keepDeprecatedSubs; 42866 42867 this.id = Y.guid(); 42868 42869 this.type = type; 42870 this.silent = this.logSystem = (type === YUI_LOG); 42871 42872 if (this._kds) { 42873 /** 42874 * The subscribers to this event 42875 * @property subscribers 42876 * @type Subscriber {} 42877 * @deprecated 42878 */ 42879 42880 /** 42881 * 'After' subscribers 42882 * @property afters 42883 * @type Subscriber {} 42884 * @deprecated 42885 */ 42886 this.subscribers = {}; 42887 this.afters = {}; 42888 } 42889 42890 if (defaults) { 42891 mixConfigs(this, defaults, true); 42892 } 42893}; 42894 42895/** 42896 * Static flag to enable population of the <a href="#property_subscribers">`subscribers`</a> 42897 * and <a href="#property_subscribers">`afters`</a> properties held on a `CustomEvent` instance. 42898 * 42899 * These properties were changed to private properties (`_subscribers` and `_afters`), and 42900 * converted from objects to arrays for performance reasons. 42901 * 42902 * Setting this property to true will populate the deprecated `subscribers` and `afters` 42903 * properties for people who may be using them (which is expected to be rare). There will 42904 * be a performance hit, compared to the new array based implementation. 42905 * 42906 * If you are using these deprecated properties for a use case which the public API 42907 * does not support, please file an enhancement request, and we can provide an alternate 42908 * public implementation which doesn't have the performance cost required to maintiain the 42909 * properties as objects. 42910 * 42911 * @property keepDeprecatedSubs 42912 * @static 42913 * @for CustomEvent 42914 * @type boolean 42915 * @default false 42916 * @deprecated 42917 */ 42918Y.CustomEvent.keepDeprecatedSubs = false; 42919 42920Y.CustomEvent.mixConfigs = mixConfigs; 42921 42922Y.CustomEvent.prototype = { 42923 42924 constructor: Y.CustomEvent, 42925 42926 /** 42927 * Monitor when an event is attached or detached. 42928 * 42929 * @property monitored 42930 * @type boolean 42931 */ 42932 42933 /** 42934 * If 0, this event does not broadcast. If 1, the YUI instance is notified 42935 * every time this event fires. If 2, the YUI instance and the YUI global 42936 * (if event is enabled on the global) are notified every time this event 42937 * fires. 42938 * @property broadcast 42939 * @type int 42940 */ 42941 42942 /** 42943 * Specifies whether this event should be queued when the host is actively 42944 * processing an event. This will effect exectution order of the callbacks 42945 * for the various events. 42946 * @property queuable 42947 * @type boolean 42948 * @default false 42949 */ 42950 42951 /** 42952 * This event has fired if true 42953 * 42954 * @property fired 42955 * @type boolean 42956 * @default false; 42957 */ 42958 42959 /** 42960 * An array containing the arguments the custom event 42961 * was last fired with. 42962 * @property firedWith 42963 * @type Array 42964 */ 42965 42966 /** 42967 * This event should only fire one time if true, and if 42968 * it has fired, any new subscribers should be notified 42969 * immediately. 42970 * 42971 * @property fireOnce 42972 * @type boolean 42973 * @default false; 42974 */ 42975 42976 /** 42977 * fireOnce listeners will fire syncronously unless async 42978 * is set to true 42979 * @property async 42980 * @type boolean 42981 * @default false 42982 */ 42983 42984 /** 42985 * Flag for stopPropagation that is modified during fire() 42986 * 1 means to stop propagation to bubble targets. 2 means
42987 * to also stop additional subscribers on this target. 42988 * @property stopped 42989 * @type int 42990 */ 42991 42992 /** 42993 * Flag for preventDefault that is modified during fire(). 42994 * if it is not 0, the default behavior for this event 42995 * @property prevented 42996 * @type int 42997 */ 42998 42999 /** 43000 * Specifies the host for this custom event. This is used 43001 * to enable event bubbling 43002 * @property host 43003 * @type EventTarget 43004 */ 43005 43006 /** 43007 * The default function to execute after event listeners 43008 * have fire, but only if the default action was not 43009 * prevented. 43010 * @property defaultFn 43011 * @type Function 43012 */ 43013 43014 /** 43015 * Flag for the default function to execute only if the 43016 * firing event is the current target. This happens only 43017 * when using custom event delegation and setting the 43018 * flag to `true` mimics the behavior of event delegation 43019 * in the DOM. 43020 * 43021 * @property defaultTargetOnly 43022 * @type Boolean 43023 * @default false 43024 */ 43025 43026 /** 43027 * The function to execute if a subscriber calls 43028 * stopPropagation or stopImmediatePropagation 43029 * @property stoppedFn 43030 * @type Function 43031 */ 43032 43033 /** 43034 * The function to execute if a subscriber calls 43035 * preventDefault 43036 * @property preventedFn 43037 * @type Function 43038 */ 43039 43040 /** 43041 * The subscribers to this event 43042 * @property _subscribers 43043 * @type Subscriber [] 43044 * @private 43045 */ 43046 43047 /** 43048 * 'After' subscribers 43049 * @property _afters 43050 * @type Subscriber [] 43051 * @private 43052 */ 43053 43054 /** 43055 * If set to true, the custom event will deliver an EventFacade object 43056 * that is similar to a DOM event object. 43057 * @property emitFacade 43058 * @type boolean 43059 * @default false 43060 */ 43061 43062 /** 43063 * Supports multiple options for listener signatures in order to 43064 * port YUI 2 apps. 43065 * @property signature 43066 * @type int 43067 * @default 9 43068 */ 43069 signature : YUI3_SIGNATURE, 43070 43071 /** 43072 * The context the the event will fire from by default. Defaults to the YUI 43073 * instance. 43074 * @property context 43075 * @type object 43076 */ 43077 context : Y, 43078 43079 /** 43080 * Specifies whether or not this event's default function 43081 * can be cancelled by a subscriber by executing preventDefault() 43082 * on the event facade 43083 * @property preventable 43084 * @type boolean 43085 * @default true 43086 */ 43087 preventable : true, 43088 43089 /** 43090 * Specifies whether or not a subscriber can stop the event propagation 43091 * via stopPropagation(), stopImmediatePropagation(), or halt() 43092 * 43093 * Events can only bubble if emitFacade is true. 43094 * 43095 * @property bubbles 43096 * @type boolean 43097 * @default true 43098 */ 43099 bubbles : true, 43100 43101 /** 43102 * Returns the number of subscribers for this event as the sum of the on() 43103 * subscribers and after() subscribers. 43104 * 43105 * @method hasSubs 43106 * @return Number 43107 */ 43108 hasSubs: function(when) { 43109 var s = 0, 43110 a = 0, 43111 subs = this._subscribers, 43112 afters = this._afters, 43113 sib = this.sibling; 43114 43115 if (subs) { 43116 s = subs.length; 43117 } 43118 43119 if (afters) { 43120 a = afters.length; 43121 } 43122 43123 if (sib) { 43124 subs = sib._subscribers; 43125 afters = sib._afters; 43126 43127 if (subs) { 43128 s += subs.length; 43129 } 43130 43131 if (afters) { 43132 a += afters.length; 43133 } 43134 } 43135 43136 if (when) { 43137 return (when === 'after') ? a : s; 43138 } 43139 43140 return (s + a); 43141 }, 43142 43143 /** 43144 * Monitor the event state for the subscribed event. The first parameter 43145 * is what should be monitored, the rest are the normal parameters when 43146 * subscribing to an event. 43147 * @method monitor 43148 * @param what {string} what to monitor ('detach', 'attach', 'publish'). 43149 * @return {EventHandle} return value from the monitor event subscription. 43150 */ 43151 monitor: function(what) { 43152 this.monitored = true; 43153 var type = this.id + '|' + this.type + '_' + what, 43154 args = nativeSlice.call(arguments, 0); 43155 args[0] = type;
43156 return this.host.on.apply(this.host, args); 43157 }, 43158 43159 /** 43160 * Get all of the subscribers to this event and any sibling event 43161 * @method getSubs 43162 * @return {Array} first item is the on subscribers, second the after. 43163 */ 43164 getSubs: function() { 43165 43166 var sibling = this.sibling, 43167 subs = this._subscribers, 43168 afters = this._afters, 43169 siblingSubs, 43170 siblingAfters; 43171 43172 if (sibling) { 43173 siblingSubs = sibling._subscribers; 43174 siblingAfters = sibling._afters; 43175 } 43176 43177 if (siblingSubs) { 43178 if (subs) { 43179 subs = subs.concat(siblingSubs); 43180 } else { 43181 subs = siblingSubs.concat(); 43182 } 43183 } else { 43184 if (subs) { 43185 subs = subs.concat(); 43186 } else { 43187 subs = []; 43188 } 43189 } 43190 43191 if (siblingAfters) { 43192 if (afters) { 43193 afters = afters.concat(siblingAfters); 43194 } else { 43195 afters = siblingAfters.concat(); 43196 } 43197 } else { 43198 if (afters) { 43199 afters = afters.concat(); 43200 } else { 43201 afters = []; 43202 } 43203 } 43204 43205 return [subs, afters]; 43206 }, 43207 43208 /** 43209 * Apply configuration properties. Only applies the CONFIG whitelist 43210 * @method applyConfig 43211 * @param o hash of properties to apply. 43212 * @param force {boolean} if true, properties that exist on the event 43213 * will be overwritten. 43214 */ 43215 applyConfig: function(o, force) { 43216 mixConfigs(this, o, force); 43217 }, 43218 43219 /** 43220 * Create the Subscription for subscribing function, context, and bound 43221 * arguments. If this is a fireOnce event, the subscriber is immediately 43222 * notified. 43223 * 43224 * @method _on 43225 * @param fn {Function} Subscription callback 43226 * @param [context] {Object} Override `this` in the callback 43227 * @param [args] {Array} bound arguments that will be passed to the callback after the arguments generated by fire() 43228 * @param [when] {String} "after" to slot into after subscribers 43229 * @return {EventHandle} 43230 * @protected 43231 */ 43232 _on: function(fn, context, args, when) { 43233 43234 43235 var s = new Y.Subscriber(fn, context, args, when), 43236 firedWith; 43237 43238 if (this.fireOnce && this.fired) { 43239 43240 firedWith = this.firedWith; 43241 43242 // It's a little ugly for this to know about facades, 43243 // but given the current breakup, not much choice without 43244 // moving a whole lot of stuff around. 43245 if (this.emitFacade && this._addFacadeToArgs) { 43246 this._addFacadeToArgs(firedWith); 43247 } 43248 43249 if (this.async) { 43250 setTimeout(Y.bind(this._notify, this, s, firedWith), 0); 43251 } else { 43252 this._notify(s, firedWith); 43253 } 43254 } 43255 43256 if (when === AFTER) { 43257 if (!this._afters) { 43258 this._afters = []; 43259 } 43260 this._afters.push(s); 43261 } else { 43262 if (!this._subscribers) { 43263 this._subscribers = []; 43264 } 43265 this._subscribers.push(s); 43266 } 43267 43268 if (this._kds) { 43269 if (when === AFTER) { 43270 this.afters[s.id] = s; 43271 } else { 43272 this.subscribers[s.id] = s; 43273 } 43274 } 43275 43276 return new Y.EventHandle(this, s); 43277 }, 43278 43279 /** 43280 * Listen for this event 43281 * @method subscribe 43282 * @param {Function} fn The function to execute. 43283 * @return {EventHandle} Unsubscribe handle. 43284 * @deprecated use on. 43285 */ 43286 subscribe: function(fn, context) { 43287 var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null; 43288 return this._on(fn, context, a, true); 43289 }, 43290 43291 /** 43292 * Listen for this event 43293 * @method on 43294 * @param {Function} fn The function to execute. 43295 * @param {object} context optional execution context. 43296 * @param {mixed} arg* 0..n additional arguments to supply to the subscriber 43297 * when the event fires. 43298 * @return {EventHandle} An object with a detach method to detch the handler(s). 43299 */ 43300 on: function(fn, context) { 43301 var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null; 43302 43303 if (this.monitored && this.host) { 43304 this.host._monitor('attach', this, { 43305 args: arguments 43306 }); 43307 } 43308 return this._on(fn, context, a, true); 43309 }, 43310 43311 /** 43312 * Listen for this event after the normal subscribers have been notified and 43313 * the default behavior has been applied. If a normal subscriber prevents the 43314 * default behavior, it also prevents after listeners from firing. 43315 * @method after 43316 * @param {Function} fn The function to execute. 43317 * @param {object} context optional execution context. 43318 * @param {mixed} arg* 0..n additional arguments to supply to the subscriber 43319 * when the event fires. 43320 * @return {EventHandle} handle Unsubscribe handle. 43321 */ 43322 after: function(fn, context) { 43323 var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null; 43324 return this._on(fn, context, a, AFTER); 43325 }, 43326 43327 /** 43328 * Detach listeners. 43329 * @method detach 43330 * @param {Function} fn The subscribed function to remove, if not supplied 43331 * all will be removed. 43332 * @param {Object} context The context object passed to subscribe. 43333 * @return {Number} returns the number of subscribers unsubscribed. 43334 */ 43335 detach: function(fn, context) { 43336 // unsubscribe handle 43337 if (fn && fn.detach) { 43338 return fn.detach(); 43339 } 43340 43341 var i, s, 43342 found = 0, 43343 subs = this._subscribers, 43344 afters = this._afters; 43345 43346 if (subs) { 43347 for (i = subs.length; i >= 0; i--) { 43348 s = subs[i]; 43349 if (s && (!fn || fn === s.fn)) { 43350 this._delete(s, subs, i); 43351 found++; 43352 } 43353 } 43354 } 43355 43356 if (afters) { 43357 for (i = afters.length; i >= 0; i--) { 43358 s = afters[i]; 43359 if (s && (!fn || fn === s.fn)) { 43360 this._delete(s, afters, i); 43361 found++; 43362 } 43363 } 43364 } 43365 43366 return found; 43367 }, 43368 43369 /** 43370 * Detach listeners. 43371 * @method unsubscribe 43372 * @param {Function} fn The subscribed function to remove, if not supplied 43373 * all will be removed. 43374 * @param {Object} context The context object passed to subscribe. 43375 * @return {int|undefined} returns the number of subscribers unsubscribed. 43376 * @deprecated use detach. 43377 */ 43378 unsubscribe: function() { 43379 return this.detach.apply(this, arguments); 43380 }, 43381 43382 /** 43383 * Notify a single subscriber 43384 * @method _notify 43385 * @param {Subscriber} s the subscriber. 43386 * @param {Array} args the arguments array to apply to the listener. 43387 * @protected 43388 */ 43389 _notify: function(s, args, ef) { 43390 43391 43392 var ret; 43393 43394 ret = s.notify(args, this); 43395 43396 if (false === ret || this.stopped > 1) { 43397 return false;
43398 } 43399 43400 return true; 43401 }, 43402 43403 /** 43404 * Logger abstraction to centralize the application of the silent flag 43405 * @method log 43406 * @param {string} msg message to log. 43407 * @param {string} cat log category. 43408 */ 43409 log: function(msg, cat) { 43410 }, 43411 43412 /** 43413 * Notifies the subscribers. The callback functions will be executed 43414 * from the context specified when the event was created, and with the 43415 * following parameters: 43416 * <ul> 43417 * <li>The type of event</li> 43418 * <li>All of the arguments fire() was executed with as an array</li> 43419 * <li>The custom object (if any) that was passed into the subscribe() 43420 * method</li> 43421 * </ul> 43422 * @method fire 43423 * @param {Object*} arguments an arbitrary set of parameters to pass to 43424 * the handler. 43425 * @return {boolean} false if one of the subscribers returned false, 43426 * true otherwise. 43427 * 43428 */ 43429 fire: function() { 43430 43431 // push is the fastest way to go from arguments to arrays 43432 // for most browsers currently 43433 // http://jsperf.com/push-vs-concat-vs-slice/2 43434 43435 var args = []; 43436 args.push.apply(args, arguments); 43437 43438 return this._fire(args); 43439 }, 43440 43441 /** 43442 * Private internal implementation for `fire`, which is can be used directly by 43443 * `EventTarget` and other event module classes which have already converted from 43444 * an `arguments` list to an array, to avoid the repeated overhead. 43445 * 43446 * @method _fire 43447 * @private 43448 * @param {Array} args The array of arguments passed to be passed to handlers. 43449 * @return {boolean} false if one of the subscribers returned false, true otherwise. 43450 */ 43451 _fire: function(args) { 43452 43453 if (this.fireOnce && this.fired) { 43454 return true; 43455 } else { 43456 43457 // this doesn't happen if the event isn't published 43458 // this.host._monitor('fire', this.type, args); 43459 43460 this.fired = true; 43461 43462 if (this.fireOnce) { 43463 this.firedWith = args; 43464 } 43465 43466 if (this.emitFacade) { 43467 return this.fireComplex(args); 43468 } else { 43469 return this.fireSimple(args); 43470 } 43471 } 43472 }, 43473 43474 /** 43475 * Set up for notifying subscribers of non-emitFacade events. 43476 * 43477 * @method fireSimple 43478 * @param args {Array} Arguments passed to fire() 43479 * @return Boolean false if a subscriber returned false 43480 * @protected 43481 */ 43482 fireSimple: function(args) { 43483 this.stopped = 0; 43484 this.prevented = 0; 43485 if (this.hasSubs()) { 43486 var subs = this.getSubs(); 43487 this._procSubs(subs[0], args); 43488 this._procSubs(subs[1], args); 43489 } 43490 if (this.broadcast) { 43491 this._broadcast(args); 43492 } 43493 return this.stopped ? false : true; 43494 }, 43495 43496 // Requires the event-custom-complex module for full funcitonality. 43497 fireComplex: function(args) { 43498 args[0] = args[0] || {}; 43499 return this.fireSimple(args); 43500 }, 43501 43502 /** 43503 * Notifies a list of subscribers. 43504 * 43505 * @method _procSubs 43506 * @param subs {Array} List of subscribers 43507 * @param args {Array} Arguments passed to fire() 43508 * @param ef {} 43509 * @return Boolean false if a subscriber returns false or stops the event 43510 * propagation via e.stopPropagation(), 43511 * e.stopImmediatePropagation(), or e.halt() 43512 * @private 43513 */ 43514 _procSubs: function(subs, args, ef) { 43515 var s, i, l; 43516 43517 for (i = 0, l = subs.length; i < l; i++) { 43518 s = subs[i]; 43519 if (s && s.fn) { 43520 if (false === this._notify(s, args, ef)) { 43521 this.stopped = 2; 43522 } 43523 if (this.stopped === 2) { 43524 return false; 43525 } 43526 } 43527 } 43528 43529 return true; 43530 }, 43531 43532 /** 43533 * Notifies the YUI instance if the event is configured with broadcast = 1, 43534 * and both the YUI instance and Y.Global if configured with broadcast = 2. 43535 * 43536 * @method _broadcast 43537 * @param args {Array} Arguments sent to fire() 43538 * @private 43539 */ 43540 _broadcast: function(args) { 43541 if (!this.stopped && this.broadcast) { 43542 43543 var a = args.concat(); 43544 a.unshift(this.type); 43545 43546 if (this.host !== Y) { 43547 Y.fire.apply(Y, a); 43548 } 43549 43550 if (this.broadcast === 2) { 43551 Y.Global.fire.apply(Y.Global, a); 43552 } 43553 } 43554 }, 43555 43556 /** 43557 * Removes all listeners 43558 * @method unsubscribeAll 43559 * @return {Number} The number of listeners unsubscribed. 43560 * @deprecated use detachAll. 43561 */ 43562 unsubscribeAll: function() { 43563 return this.detachAll.apply(this, arguments); 43564 }, 43565 43566 /** 43567 * Removes all listeners 43568 * @method detachAll 43569 * @return {Number} The number of listeners unsubscribed. 43570 */ 43571 detachAll: function() { 43572 return this.detach(); 43573 }, 43574 43575 /** 43576 * Deletes the subscriber from the internal store of on() and after() 43577 * subscribers. 43578 * 43579 * @method _delete 43580 * @param s subscriber object. 43581 * @param subs (optional) on or after subscriber array 43582 * @param index (optional) The index found. 43583 * @private 43584 */ 43585 _delete: function(s, subs, i) { 43586 var when = s._when; 43587 43588 if (!subs) { 43589 subs = (when === AFTER) ? this._afters : this._subscribers; 43590 } 43591 43592 if (subs) { 43593 i = YArray.indexOf(subs, s, 0); 43594 43595 if (s && subs[i] === s) { 43596 subs.splice(i, 1); 43597 } 43598 } 43599 43600 if (this._kds) { 43601 if (when === AFTER) { 43602 delete this.afters[s.id]; 43603 } else { 43604 delete this.subscribers[s.id]; 43605 } 43606 } 43607 43608 if (this.monitored && this.host) { 43609 this.host._monitor('detach', this, { 43610 ce: this, 43611 sub: s 43612 }); 43613 } 43614 43615 if (s) { 43616 s.deleted = true; 43617 } 43618 } 43619}; 43620/** 43621 * Stores the subscriber information to be used when the event fires. 43622 * @param {Function} fn The wrapped function to execute. 43623 * @param {Object} context The value of the keyword 'this' in the listener. 43624 * @param {Array} args* 0..n additional arguments to supply the listener. 43625 * 43626 * @class Subscriber 43627 * @constructor 43628 */ 43629Y.Subscriber = function(fn, context, args, when) { 43630 43631 /** 43632 * The callback that will be execute when the event fires 43633 * This is wrapped by Y.rbind if obj was supplied.
43634 * @property fn 43635 * @type Function 43636 */ 43637 this.fn = fn; 43638 43639 /** 43640 * Optional 'this' keyword for the listener 43641 * @property context 43642 * @type Object 43643 */ 43644 this.context = context; 43645 43646 /** 43647 * Unique subscriber id 43648 * @property id 43649 * @type String 43650 */ 43651 this.id = Y.guid(); 43652 43653 /** 43654 * Additional arguments to propagate to the subscriber 43655 * @property args 43656 * @type Array 43657 */ 43658 this.args = args; 43659 43660 this._when = when; 43661 43662 /** 43663 * Custom events for a given fire transaction. 43664 * @property events 43665 * @type {EventTarget} 43666 */ 43667 // this.events = null; 43668 43669 /** 43670 * This listener only reacts to the event once 43671 * @property once 43672 */ 43673 // this.once = false; 43674 43675}; 43676 43677Y.Subscriber.prototype = { 43678 constructor: Y.Subscriber, 43679 43680 _notify: function(c, args, ce) { 43681 if (this.deleted && !this.postponed) { 43682 if (this.postponed) { 43683 delete this.fn; 43684 delete this.context; 43685 } else { 43686 delete this.postponed; 43687 return null; 43688 } 43689 } 43690 var a = this.args, ret; 43691 switch (ce.signature) { 43692 case 0: 43693 ret = this.fn.call(c, ce.type, args, c); 43694 break; 43695 case 1: 43696 ret = this.fn.call(c, args[0] || null, c); 43697 break; 43698 default: 43699 if (a || args) { 43700 args = args || []; 43701 a = (a) ? args.concat(a) : args; 43702 ret = this.fn.apply(c, a); 43703 } else { 43704 ret = this.fn.call(c); 43705 } 43706 } 43707 43708 if (this.once) { 43709 ce._delete(this); 43710 } 43711 43712 return ret; 43713 }, 43714 43715 /** 43716 * Executes the subscriber. 43717 * @method notify 43718 * @param args {Array} Arguments array for the subscriber. 43719 * @param ce {CustomEvent} The custom event that sent the notification. 43720 */ 43721 notify: function(args, ce) { 43722 var c = this.context, 43723 ret = true; 43724 43725 if (!c) { 43726 c = (ce.contextFn) ? ce.contextFn() : ce.context; 43727 } 43728 43729 // only catch errors if we will not re-throw them. 43730 if (Y.config && Y.config.throwFail) { 43731 ret = this._notify(c, args, ce); 43732 } else { 43733 try { 43734 ret = this._notify(c, args, ce); 43735 } catch (e) { 43736 Y.error(this + ' failed: ' + e.message, e); 43737 } 43738 } 43739 43740 return ret; 43741 }, 43742 43743 /** 43744 * Returns true if the fn and obj match this objects properties. 43745 * Used by the unsubscribe method to match the right subscriber. 43746 * 43747 * @method contains 43748 * @param {Function} fn the function to execute. 43749 * @param {Object} context optional 'this' keyword for the listener. 43750 * @return {boolean} true if the supplied arguments match this 43751 * subscriber's signature. 43752 */ 43753 contains: function(fn, context) { 43754 if (context) { 43755 return ((this.fn === fn) && this.context === context); 43756 } else { 43757 return (this.fn === fn); 43758 } 43759 }, 43760 43761 valueOf : function() { 43762 return this.id; 43763 } 43764 43765}; 43766/** 43767 * Return value from all subscribe operations 43768 * @class EventHandle 43769 * @constructor 43770 * @param {CustomEvent} evt the custom event. 43771 * @param {Subscriber} sub the subscriber. 43772 */ 43773Y.EventHandle = function(evt, sub) { 43774 43775 /** 43776 * The custom event 43777 * 43778 * @property evt 43779 * @type CustomEvent 43780 */ 43781 this.evt = evt; 43782 43783 /** 43784 * The subscriber object 43785 * 43786 * @property sub 43787 * @type Subscriber 43788 */ 43789 this.sub = sub; 43790}; 43791 43792Y.EventHandle.prototype = { 43793 batch: function(f, c) { 43794 f.call(c || this, this); 43795 if (Y.Lang.isArray(this.evt)) { 43796 Y.Array.each(this.evt, function(h) { 43797 h.batch.call(c || h, f); 43798 }); 43799 } 43800 }, 43801 43802 /** 43803 * Detaches this subscriber 43804 * @method detach 43805 * @return {Number} the number of detached listeners 43806 */ 43807 detach: function() { 43808 var evt = this.evt, detached = 0, i; 43809 if (evt) { 43810 if (Y.Lang.isArray(evt)) { 43811 for (i = 0; i < evt.length; i++) { 43812 detached += evt[i].detach(); 43813 } 43814 } else { 43815 evt._delete(this.sub); 43816 detached = 1; 43817 } 43818 43819 } 43820 43821 return detached; 43822 }, 43823 43824 /** 43825 * Monitor the event state for the subscribed event. The first parameter 43826 * is what should be monitored, the rest are the normal parameters when 43827 * subscribing to an event. 43828 * @method monitor 43829 * @param what {string} what to monitor ('attach', 'detach', 'publish'). 43830 * @return {EventHandle} return value from the monitor event subscription. 43831 */ 43832 monitor: function(what) { 43833 return this.evt.monitor.apply(this.evt, arguments); 43834 } 43835}; 43836 43837/** 43838 * Custom event engine, DOM event listener abstraction layer, synthetic DOM 43839 * events. 43840 * @module event-custom 43841 * @submodule event-custom-base 43842 */ 43843 43844/** 43845 * EventTarget provides the implementation for any object to 43846 * publish, subscribe and fire to custom events, and also 43847 * alows other EventTargets to target the object with events 43848 * sourced from the other object. 43849 * EventTarget is designed to be used with Y.augment to wrap 43850 * EventCustom in an interface that allows events to be listened to
43851 * and fired by name. This makes it possible for implementing code to 43852 * subscribe to an event that either has not been created yet, or will 43853 * not be created at all. 43854 * @class EventTarget 43855 * @param opts a configuration object 43856 * @config emitFacade {boolean} if true, all events will emit event 43857 * facade payloads by default (default false) 43858 * @config prefix {String} the prefix to apply to non-prefixed event names 43859 */ 43860 43861var L = Y.Lang, 43862 PREFIX_DELIMITER = ':', 43863 CATEGORY_DELIMITER = '|', 43864 AFTER_PREFIX = '~AFTER~', 43865 WILD_TYPE_RE = /(.*?)(:)(.*?)/, 43866 43867 _wildType = Y.cached(function(type) { 43868 return type.replace(WILD_TYPE_RE, "*$2$3"); 43869 }), 43870 43871 /** 43872 * If the instance has a prefix attribute and the 43873 * event type is not prefixed, the instance prefix is 43874 * applied to the supplied type. 43875 * @method _getType 43876 * @private 43877 */ 43878 _getType = function(type, pre) { 43879 43880 if (!pre || (typeof type !== "string") || type.indexOf(PREFIX_DELIMITER) > -1) { 43881 return type; 43882 } 43883 43884 return pre + PREFIX_DELIMITER + type; 43885 }, 43886 43887 /** 43888 * Returns an array with the detach key (if provided), 43889 * and the prefixed event name from _getType 43890 * Y.on('detachcategory| menu:click', fn) 43891 * @method _parseType 43892 * @private 43893 */ 43894 _parseType = Y.cached(function(type, pre) { 43895 43896 var t = type, detachcategory, after, i; 43897 43898 if (!L.isString(t)) { 43899 return t; 43900 } 43901 43902 i = t.indexOf(AFTER_PREFIX); 43903 43904 if (i > -1) { 43905 after = true; 43906 t = t.substr(AFTER_PREFIX.length); 43907 } 43908 43909 i = t.indexOf(CATEGORY_DELIMITER); 43910 43911 if (i > -1) { 43912 detachcategory = t.substr(0, (i)); 43913 t = t.substr(i+1); 43914 if (t === '*') { 43915 t = null; 43916 } 43917 } 43918 43919 // detach category, full type with instance prefix, is this an after listener, short type 43920 return [detachcategory, (pre) ? _getType(t, pre) : t, after, t]; 43921 }), 43922 43923 ET = function(opts) { 43924 43925 var etState = this._yuievt, 43926 etConfig; 43927 43928 if (!etState) { 43929 etState = this._yuievt = { 43930 events: {}, // PERF: Not much point instantiating lazily. We're bound to have events 43931 targets: null, // PERF: Instantiate lazily, if user actually adds target, 43932 config: { 43933 host: this, 43934 context: this 43935 }, 43936 chain: Y.config.chain 43937 }; 43938 } 43939 43940 etConfig = etState.config; 43941 43942 if (opts) { 43943 mixConfigs(etConfig, opts, true); 43944 43945 if (opts.chain !== undefined) { 43946 etState.chain = opts.chain; 43947 } 43948 43949 if (opts.prefix) { 43950 etConfig.prefix = opts.prefix; 43951 } 43952 } 43953 }; 43954 43955ET.prototype = { 43956 43957 constructor: ET, 43958 43959 /** 43960 * Listen to a custom event hosted by this object one time. 43961 * This is the equivalent to <code>on</code> except the 43962 * listener is immediatelly detached when it is executed. 43963 * @method once 43964 * @param {String} type The name of the event 43965 * @param {Function} fn The callback to execute in response to the event 43966 * @param {Object} [context] Override `this` object in callback 43967 * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber 43968 * @return {EventHandle} A subscription handle capable of detaching the 43969 * subscription 43970 */ 43971 once: function() { 43972 var handle = this.on.apply(this, arguments); 43973 handle.batch(function(hand) { 43974 if (hand.sub) { 43975 hand.sub.once = true; 43976 } 43977 }); 43978 return handle; 43979 }, 43980 43981 /** 43982 * Listen to a custom event hosted by this object one time. 43983 * This is the equivalent to <code>after</code> except the 43984 * listener is immediatelly detached when it is executed. 43985 * @method onceAfter 43986 * @param {String} type The name of the event 43987 * @param {Function} fn The callback to execute in response to the event 43988 * @param {Object} [context] Override `this` object in callback 43989 * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber 43990 * @return {EventHandle} A subscription handle capable of detaching that 43991 * subscription 43992 */ 43993 onceAfter: function() { 43994 var handle = this.after.apply(this, arguments); 43995 handle.batch(function(hand) { 43996 if (hand.sub) { 43997 hand.sub.once = true; 43998 } 43999 }); 44000 return handle; 44001 }, 44002 44003 /** 44004 * Takes the type parameter passed to 'on' and parses out the 44005 * various pieces that could be included in the type. If the 44006 * event type is passed without a prefix, it will be expanded 44007 * to include the prefix one is supplied or the event target 44008 * is configured with a default prefix. 44009 * @method parseType 44010 * @param {String} type the type 44011 * @param {String} [pre] The prefix. Defaults to this._yuievt.config.prefix 44012 * @since 3.3.0 44013 * @return {Array} an array containing: 44014 * * the detach category, if supplied, 44015 * * the prefixed event type, 44016 * * whether or not this is an after listener, 44017 * * the supplied event type 44018 */ 44019 parseType: function(type, pre) { 44020 return _parseType(type, pre || this._yuievt.config.prefix); 44021 }, 44022 44023 /** 44024 * Subscribe a callback function to a custom event fired by this object or 44025 * from an object that bubbles its events to this object. 44026 * 44027 * this.on("change", this._onChange, this); 44028 * 44029 * Callback functions for events published with `emitFacade = true` will 44030 * receive an `EventFacade` as the first argument (typically named "e"). 44031 * These callbacks can then call `e.preventDefault()` to disable the 44032 * behavior published to that event's `defaultFn`. See the `EventFacade` 44033 * API for all available properties and methods. Subscribers to 44034 * non-`emitFacade` events will receive the arguments passed to `fire()` 44035 * after the event name. 44036 * 44037 * To subscribe to multiple events at once, pass an object as the first 44038 * argument, where the key:value pairs correspond to the eventName:callback. 44039 * 44040 * this.on({ 44041 * "attrChange" : this._onAttrChange, 44042 * "change" : this._onChange 44043 * }); 44044 * 44045 * You can also pass an array of event names as the first argument to 44046 * subscribe to all listed events with the same callback. 44047 * 44048 * this.on([ "change", "attrChange" ], this._onChange); 44049 * 44050 * Returning `false` from a callback is supported as an alternative to 44051 * calling `e.preventDefault(); e.stopPropagation();`. However, it is 44052 * recommended to use the event methods whenever possible. 44053 * 44054 * @method on 44055 * @param {String} type The name of the event 44056 * @param {Function} fn The callback to execute in response to the event 44057 * @param {Object} [context] Override `this` object in callback 44058 * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber 44059 * @return {EventHandle} A subscription handle capable of detaching that 44060 * subscription 44061 */ 44062 on: function(type, fn, context) { 44063 44064 var yuievt = this._yuievt, 44065 parts = _parseType(type, yuievt.config.prefix), f, c, args, ret, ce, 44066 detachcategory, handle, store = Y.Env.evt.handles, after, adapt, shorttype, 44067 Node = Y.Node, n, domevent, isArr; 44068 44069 // full name, args, detachcategory, after 44070 this._monitor('attach', parts[1], { 44071 args: arguments, 44072 category: parts[0], 44073 after: parts[2] 44074 }); 44075 44076 if (L.isObject(type)) { 44077 44078 if (L.isFunction(type)) { 44079 return Y.Do.before.apply(Y.Do, arguments); 44080 } 44081 44082 f = fn; 44083 c = context; 44084 args = nativeSlice.call(arguments, 0); 44085 ret = []; 44086 44087 if (L.isArray(type)) { 44088 isArr = true; 44089 } 44090 44091 after = type._after; 44092 delete type._after; 44093 44094 Y.each(type, function(v, k) { 44095 44096 if (L.isObject(v)) { 44097 f = v.fn || ((L.isFunction(v)) ? v : f); 44098 c = v.context || c; 44099 } 44100 44101 var nv = (after) ? AFTER_PREFIX : ''; 44102 44103 args[0] = nv + ((isArr) ? v : k); 44104 args[1] = f; 44105 args[2] = c; 44106
44107 ret.push(this.on.apply(this, args)); 44108 44109 }, this); 44110 44111 return (yuievt.chain) ? this : new Y.EventHandle(ret); 44112 } 44113 44114 detachcategory = parts[0]; 44115 after = parts[2]; 44116 shorttype = parts[3]; 44117 44118 // extra redirection so we catch adaptor events too. take a look at this. 44119 if (Node && Y.instanceOf(this, Node) && (shorttype in Node.DOM_EVENTS)) { 44120 args = nativeSlice.call(arguments, 0); 44121 args.splice(2, 0, Node.getDOMNode(this)); 44122 return Y.on.apply(Y, args); 44123 } 44124 44125 type = parts[1]; 44126 44127 if (Y.instanceOf(this, YUI)) { 44128 44129 adapt = Y.Env.evt.plugins[type]; 44130 args = nativeSlice.call(arguments, 0); 44131 args[0] = shorttype; 44132 44133 if (Node) { 44134 n = args[2]; 44135 44136 if (Y.instanceOf(n, Y.NodeList)) { 44137 n = Y.NodeList.getDOMNodes(n); 44138 } else if (Y.instanceOf(n, Node)) { 44139 n = Node.getDOMNode(n); 44140 } 44141 44142 domevent = (shorttype in Node.DOM_EVENTS); 44143 44144 // Captures both DOM events and event plugins. 44145 if (domevent) { 44146 args[2] = n; 44147 } 44148 } 44149 44150 // check for the existance of an event adaptor 44151 if (adapt) { 44152 handle = adapt.on.apply(Y, args); 44153 } else if ((!type) || domevent) { 44154 handle = Y.Event._attach(args); 44155 } 44156 44157 } 44158 44159 if (!handle) { 44160 ce = yuievt.events[type] || this.publish(type); 44161 handle = ce._on(fn, context, (arguments.length > 3) ? nativeSlice.call(arguments, 3) : null, (after) ? 'after' : true); 44162 44163 // TODO: More robust regex, accounting for category 44164 if (type.indexOf("*:") !== -1) { 44165 this._hasSiblings = true; 44166 } 44167 } 44168 44169 if (detachcategory) { 44170 store[detachcategory] = store[detachcategory] || {}; 44171 store[detachcategory][type] = store[detachcategory][type] || []; 44172 store[detachcategory][type].push(handle); 44173 } 44174 44175 return (yuievt.chain) ? this : handle; 44176 44177 }, 44178 44179 /** 44180 * subscribe to an event 44181 * @method subscribe 44182 * @deprecated use on 44183 */ 44184 subscribe: function() { 44185 return this.on.apply(this, arguments); 44186 }, 44187 44188 /** 44189 * Detach one or more listeners the from the specified event 44190 * @method detach 44191 * @param type {string|Object} Either the handle to the subscriber or the 44192 * type of event. If the type 44193 * is not specified, it will attempt to remove 44194 * the listener from all hosted events. 44195 * @param fn {Function} The subscribed function to unsubscribe, if not 44196 * supplied, all subscribers will be removed. 44197 * @param context {Object} The custom object passed to subscribe. This is 44198 * optional, but if supplied will be used to 44199 * disambiguate multiple listeners that are the same 44200 * (e.g., you subscribe many object using a function 44201 * that lives on the prototype) 44202 * @return {EventTarget} the host 44203 */ 44204 detach: function(type, fn, context) { 44205 44206 var evts = this._yuievt.events, 44207 i, 44208 Node = Y.Node, 44209 isNode = Node && (Y.instanceOf(this, Node)); 44210 44211 // detachAll disabled on the Y instance. 44212 if (!type && (this !== Y)) { 44213 for (i in evts) { 44214 if (evts.hasOwnProperty(i)) { 44215 evts[i].detach(fn, context); 44216 } 44217 } 44218 if (isNode) { 44219 Y.Event.purgeElement(Node.getDOMNode(this)); 44220 } 44221 44222 return this; 44223 } 44224 44225 var parts = _parseType(type, this._yuievt.config.prefix), 44226 detachcategory = L.isArray(parts) ? parts[0] : null, 44227 shorttype = (parts) ? parts[3] : null, 44228 adapt, store = Y.Env.evt.handles, detachhost, cat, args, 44229 ce, 44230 44231 keyDetacher = function(lcat, ltype, host) { 44232 var handles = lcat[ltype], ce, i; 44233 if (handles) { 44234 for (i = handles.length - 1; i >= 0; --i) { 44235 ce = handles[i].evt; 44236 if (ce.host === host || ce.el === host) { 44237 handles[i].detach(); 44238 } 44239 } 44240 } 44241 }; 44242 44243 if (detachcategory) { 44244 44245 cat = store[detachcategory]; 44246 type = parts[1]; 44247 detachhost = (isNode) ? Y.Node.getDOMNode(this) : this; 44248 44249 if (cat) { 44250 if (type) { 44251 keyDetacher(cat, type, detachhost); 44252 } else { 44253 for (i in cat) { 44254 if (cat.hasOwnProperty(i)) { 44255 keyDetacher(cat, i, detachhost); 44256 } 44257 } 44258 } 44259 44260 return this; 44261 } 44262 44263 // If this is an event handle, use it to detach 44264 } else if (L.isObject(type) && type.detach) { 44265 type.detach(); 44266 return this; 44267 // extra redirection so we catch adaptor events too. take a look at this. 44268 } else if (isNode && ((!shorttype) || (shorttype in Node.DOM_EVENTS))) { 44269 args = nativeSlice.call(arguments, 0); 44270 args[2] = Node.getDOMNode(this); 44271 Y.detach.apply(Y, args); 44272 return this; 44273 } 44274 44275 adapt = Y.Env.evt.plugins[shorttype]; 44276 44277 // The YUI instance handles DOM events and adaptors 44278 if (Y.instanceOf(this, YUI)) { 44279 args = nativeSlice.call(arguments, 0); 44280 // use the adaptor specific detach code if 44281 if (adapt && adapt.detach) { 44282 adapt.detach.apply(Y, args); 44283 return this; 44284 // DOM event fork 44285 } else if (!type || (!adapt && Node && (type in Node.DOM_EVENTS))) { 44286 args[0] = type; 44287 Y.Event.detach.apply(Y.Event, args); 44288 return this; 44289 } 44290 } 44291 44292 // ce = evts[type]; 44293 ce = evts[parts[1]]; 44294 if (ce) { 44295 ce.detach(fn, context); 44296 } 44297 44298 return this; 44299 }, 44300 44301 /** 44302 * detach a listener 44303 * @method unsubscribe 44304 * @deprecated use detach 44305 */ 44306 unsubscribe: function() { 44307 return this.detach.apply(this, arguments); 44308 }, 44309 44310 /** 44311 * Removes all listeners from the specified event. If the event type 44312 * is not specified, all listeners from all hosted custom events will 44313 * be removed. 44314 * @method detachAll 44315 * @param type {String} The type, or name of the event 44316 */ 44317 detachAll: function(type) { 44318 return this.detach(type); 44319 }, 44320 44321 /** 44322 * Removes all listeners from the specified event. If the event type 44323 * is not specified, all listeners from all hosted custom events will 44324 * be removed. 44325 * @method unsubscribeAll 44326 * @param type {String} The type, or name of the event 44327 * @deprecated use detachAll 44328 */ 44329 unsubscribeAll: function() { 44330 return this.detachAll.apply(this, arguments); 44331 }, 44332 44333 /** 44334 * Creates a new custom event of the specified type. If a custom event 44335 * by that name already exists, it will not be re-created. In either 44336 * case the custom event is returned. 44337 * 44338 * @method publish 44339 * 44340 * @param type {String} the type, or name of the event 44341 * @param opts {object} optional config params. Valid properties are: 44342 * @param [opts.broadcast=false] {Boolean} whether or not the YUI instance and YUI global 44343 * are notified when the event is fired. 44344 * @param [opts.bubbles=true] {Boolean} Whether or not this event bubbles. Events can 44345 * only bubble if `emitFacade` is true.
44346 * @param [opts.context=this] {Object} the default execution context for the listeners. 44347 * @param [opts.defaultFn] {Function} the default function to execute when this event 44348 * fires if preventDefault was not called. 44349 * @param [opts.emitFacade=false] {Boolean} whether or not this event emits a facade. 44350 * @param [opts.prefix] {String} the prefix for this targets events, e.g., 'menu' in 'menu:click'. 44351 * @param [opts.fireOnce=false] {Boolean} if an event is configured to fire once, 44352 * new subscribers after the fire will be notified immediately. 44353 * @param [opts.async=false] {Boolean} fireOnce event listeners will fire synchronously 44354 * if the event has already fired unless `async` is `true`. 44355 * @param [opts.preventable=true] {Boolean} whether or not `preventDefault()` has an effect. 44356 * @param [opts.preventedFn] {Function} a function that is executed when `preventDefault()` is called. 44357 * @param [opts.queuable=false] {Boolean} whether or not this event can be queued during bubbling. 44358 * @param [opts.silent] {Boolean} if silent is true, debug messages are not provided for this event. 44359 * @param [opts.stoppedFn] {Function} a function that is executed when stopPropagation is called. 44360 * @param [opts.monitored] {Boolean} specifies whether or not this event should send notifications about 44361 * when the event has been attached, detached, or published. 44362 * @param [opts.type] {String} the event type (valid option if not provided as the first parameter to publish). 44363 * 44364 * @return {CustomEvent} the custom event 44365 * 44366 */ 44367 publish: function(type, opts) { 44368 44369 var ret, 44370 etState = this._yuievt, 44371 etConfig = etState.config, 44372 pre = etConfig.prefix; 44373 44374 if (typeof type === "string") { 44375 if (pre) { 44376 type = _getType(type, pre); 44377 } 44378 ret = this._publish(type, etConfig, opts); 44379 } else { 44380 ret = {}; 44381 44382 Y.each(type, function(v, k) { 44383 if (pre) { 44384 k = _getType(k, pre); 44385 } 44386 ret[k] = this._publish(k, etConfig, v || opts); 44387 }, this); 44388 44389 } 44390 44391 return ret; 44392 }, 44393 44394 /** 44395 * Returns the fully qualified type, given a short type string. 44396 * That is, returns "foo:bar" when given "bar" if "foo" is the configured prefix. 44397 * 44398 * NOTE: This method, unlike _getType, does no checking of the value passed in, and 44399 * is designed to be used with the low level _publish() method, for critical path 44400 * implementations which need to fast-track publish for performance reasons. 44401 * 44402 * @method _getFullType 44403 * @private 44404 * @param {String} type The short type to prefix 44405 * @return {String} The prefixed type, if a prefix is set, otherwise the type passed in 44406 */ 44407 _getFullType : function(type) { 44408 44409 var pre = this._yuievt.config.prefix; 44410 44411 if (pre) { 44412 return pre + PREFIX_DELIMITER + type; 44413 } else { 44414 return type; 44415 } 44416 }, 44417 44418 /** 44419 * The low level event publish implementation. It expects all the massaging to have been done 44420 * outside of this method. e.g. the `type` to `fullType` conversion. It's designed to be a fast 44421 * path publish, which can be used by critical code paths to improve performance. 44422 * 44423 * @method _publish 44424 * @private 44425 * @param {String} fullType The prefixed type of the event to publish. 44426 * @param {Object} etOpts The EventTarget specific configuration to mix into the published event. 44427 * @param {Object} ceOpts The publish specific configuration to mix into the published event. 44428 * @return {CustomEvent} The published event. If called without `etOpts` or `ceOpts`, this will 44429 * be the default `CustomEvent` instance, and can be configured independently. 44430 */ 44431 _publish : function(fullType, etOpts, ceOpts) { 44432 44433 var ce, 44434 etState = this._yuievt, 44435 etConfig = etState.config, 44436 host = etConfig.host, 44437 context = etConfig.context, 44438 events = etState.events; 44439 44440 ce = events[fullType]; 44441 44442 // PERF: Hate to pull the check out of monitor, but trying to keep critical path tight. 44443 if ((etConfig.monitored && !ce) || (ce && ce.monitored)) { 44444 this._monitor('publish', fullType, { 44445 args: arguments 44446 }); 44447 } 44448 44449 if (!ce) { 44450 // Publish event 44451 ce = events[fullType] = new Y.CustomEvent(fullType, etOpts); 44452 44453 if (!etOpts) { 44454 ce.host = host; 44455 ce.context = context; 44456 } 44457 } 44458 44459 if (ceOpts) { 44460 mixConfigs(ce, ceOpts, true); 44461 } 44462 44463 return ce; 44464 }, 44465 44466 /** 44467 * This is the entry point for the event monitoring system. 44468 * You can monitor 'attach', 'detach', 'fire', and 'publish'. 44469 * When configured, these events generate an event. click -> 44470 * click_attach, click_detach, click_publish -- these can 44471 * be subscribed to like other events to monitor the event 44472 * system. Inividual published events can have monitoring 44473 * turned on or off (publish can't be turned off before it 44474 * it published) by setting the events 'monitor' config. 44475 * 44476 * @method _monitor 44477 * @param what {String} 'attach', 'detach', 'fire', or 'publish' 44478 * @param eventType {String|CustomEvent} The prefixed name of the event being monitored, or the CustomEvent object. 44479 * @param o {Object} Information about the event interaction, such as 44480 * fire() args, subscription category, publish config 44481 * @private 44482 */ 44483 _monitor: function(what, eventType, o) {
44484 var monitorevt, ce, type; 44485 44486 if (eventType) { 44487 if (typeof eventType === "string") { 44488 type = eventType; 44489 ce = this.getEvent(eventType, true); 44490 } else { 44491 ce = eventType; 44492 type = eventType.type; 44493 } 44494 44495 if ((this._yuievt.config.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) { 44496 monitorevt = type + '_' + what; 44497 o.monitored = what; 44498 this.fire.call(this, monitorevt, o); 44499 } 44500 } 44501 }, 44502 44503 /** 44504 * Fire a custom event by name. The callback functions will be executed 44505 * from the context specified when the event was created, and with the 44506 * following parameters. 44507 * 44508 * The first argument is the event type, and any additional arguments are 44509 * passed to the listeners as parameters. If the first of these is an 44510 * object literal, and the event is configured to emit an event facade, 44511 * that object is mixed into the event facade and the facade is provided 44512 * in place of the original object. 44513 * 44514 * If the custom event object hasn't been created, then the event hasn't 44515 * been published and it has no subscribers. For performance sake, we 44516 * immediate exit in this case. This means the event won't bubble, so 44517 * if the intention is that a bubble target be notified, the event must 44518 * be published on this object first. 44519 * 44520 * @method fire 44521 * @param type {String|Object} The type of the event, or an object that contains 44522 * a 'type' property. 44523 * @param arguments {Object*} an arbitrary set of parameters to pass to 44524 * the handler. If the first of these is an object literal and the event is 44525 * configured to emit an event facade, the event facade will replace that 44526 * parameter after the properties the object literal contains are copied to 44527 * the event facade. 44528 * @return {Boolean} True if the whole lifecycle of the event went through, 44529 * false if at any point the event propagation was halted. 44530 */ 44531 fire: function(type) { 44532 44533 var typeIncluded = (typeof type === "string"), 44534 argCount = arguments.length, 44535 t = type, 44536 yuievt = this._yuievt, 44537 etConfig = yuievt.config, 44538 pre = etConfig.prefix, 44539 ret, 44540 ce, 44541 ce2, 44542 args; 44543 44544 if (typeIncluded && argCount <= 3) { 44545 44546 // PERF: Try to avoid slice/iteration for the common signatures 44547 44548 // Most common 44549 if (argCount === 2) { 44550 args = [arguments[1]]; // fire("foo", {}) 44551 } else if (argCount === 3) { 44552 args = [arguments[1], arguments[2]]; // fire("foo", {}, opts) 44553 } else { 44554 args = []; // fire("foo") 44555 } 44556 44557 } else { 44558 args = nativeSlice.call(arguments, ((typeIncluded) ? 1 : 0)); 44559 } 44560 44561 if (!typeIncluded) { 44562 t = (type && type.type); 44563 } 44564 44565 if (pre) { 44566 t = _getType(t, pre); 44567 } 44568 44569 ce = yuievt.events[t]; 44570 44571 if (this._hasSiblings) { 44572 ce2 = this.getSibling(t, ce); 44573 44574 if (ce2 && !ce) { 44575 ce = this.publish(t); 44576 } 44577 } 44578 44579 // PERF: trying to avoid function call, since this is a critical path 44580 if ((etConfig.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) { 44581 this._monitor('fire', (ce || t), { 44582 args: args 44583 }); 44584 } 44585 44586 // this event has not been published or subscribed to 44587 if (!ce) { 44588 if (yuievt.hasTargets) { 44589 return this.bubble({ type: t }, args, this); 44590 } 44591 44592 // otherwise there is nothing to be done 44593 ret = true; 44594 } else { 44595 44596 if (ce2) { 44597 ce.sibling = ce2; 44598 } 44599 44600 ret = ce._fire(args); 44601 } 44602 44603 return (yuievt.chain) ? this : ret; 44604 }, 44605 44606 getSibling: function(type, ce) { 44607 var ce2; 44608 44609 // delegate to *:type events if there are subscribers 44610 if (type.indexOf(PREFIX_DELIMITER) > -1) { 44611 type = _wildType(type); 44612 ce2 = this.getEvent(type, true); 44613 if (ce2) { 44614 ce2.applyConfig(ce); 44615 ce2.bubbles = false;
44616 ce2.broadcast = 0; 44617 } 44618 } 44619 44620 return ce2; 44621 }, 44622 44623 /** 44624 * Returns the custom event of the provided type has been created, a 44625 * falsy value otherwise 44626 * @method getEvent 44627 * @param type {String} the type, or name of the event 44628 * @param prefixed {String} if true, the type is prefixed already 44629 * @return {CustomEvent} the custom event or null 44630 */ 44631 getEvent: function(type, prefixed) { 44632 var pre, e; 44633 44634 if (!prefixed) { 44635 pre = this._yuievt.config.prefix; 44636 type = (pre) ? _getType(type, pre) : type; 44637 } 44638 e = this._yuievt.events; 44639 return e[type] || null; 44640 }, 44641 44642 /** 44643 * Subscribe to a custom event hosted by this object. The 44644 * supplied callback will execute after any listeners add 44645 * via the subscribe method, and after the default function, 44646 * if configured for the event, has executed. 44647 * 44648 * @method after 44649 * @param {String} type The name of the event 44650 * @param {Function} fn The callback to execute in response to the event 44651 * @param {Object} [context] Override `this` object in callback 44652 * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber 44653 * @return {EventHandle} A subscription handle capable of detaching the 44654 * subscription 44655 */ 44656 after: function(type, fn) { 44657 44658 var a = nativeSlice.call(arguments, 0); 44659 44660 switch (L.type(type)) { 44661 case 'function': 44662 return Y.Do.after.apply(Y.Do, arguments); 44663 case 'array': 44664 // YArray.each(a[0], function(v) { 44665 // v = AFTER_PREFIX + v; 44666 // }); 44667 // break; 44668 case 'object': 44669 a[0]._after = true; 44670 break; 44671 default: 44672 a[0] = AFTER_PREFIX + type; 44673 } 44674 44675 return this.on.apply(this, a); 44676 44677 }, 44678 44679 /** 44680 * Executes the callback before a DOM event, custom event 44681 * or method. If the first argument is a function, it 44682 * is assumed the target is a method. For DOM and custom 44683 * events, this is an alias for Y.on. 44684 * 44685 * For DOM and custom events: 44686 * type, callback, context, 0-n arguments 44687 * 44688 * For methods: 44689 * callback, object (method host), methodName, context, 0-n arguments 44690 * 44691 * @method before 44692 * @return detach handle 44693 */ 44694 before: function() { 44695 return this.on.apply(this, arguments); 44696 } 44697 44698}; 44699 44700Y.EventTarget = ET; 44701 44702// make Y an event target 44703Y.mix(Y, ET.prototype); 44704ET.call(Y, { bubbles: false }); 44705 44706YUI.Env.globalEvents = YUI.Env.globalEvents || new ET(); 44707 44708/** 44709 * Hosts YUI page level events. This is where events bubble to 44710 * when the broadcast config is set to 2. This property is 44711 * only available if the custom event module is loaded. 44712 * @property Global 44713 * @type EventTarget 44714 * @for YUI 44715 */ 44716Y.Global = YUI.Env.globalEvents; 44717 44718// @TODO implement a global namespace function on Y.Global? 44719 44720/** 44721`Y.on()` can do many things: 44722 44723<ul> 44724 <li>Subscribe to custom events `publish`ed and `fire`d from Y</li> 44725 <li>Subscribe to custom events `publish`ed with `broadcast` 1 or 2 and 44726 `fire`d from any object in the YUI instance sandbox</li> 44727 <li>Subscribe to DOM events</li> 44728 <li>Subscribe to the execution of a method on any object, effectively 44729 treating that method as an event</li> 44730</ul> 44731 44732For custom event subscriptions, pass the custom event name as the first argument 44733and callback as the second. The `this` object in the callback will be `Y` unless 44734an override is passed as the third argument. 44735 44736 Y.on('io:complete', function () { 44737 Y.MyApp.updateStatus('Transaction complete'); 44738 }); 44739 44740To subscribe to DOM events, pass the name of a DOM event as the first argument 44741and a CSS selector string as the third argument after the callback function. 44742Alternately, the third argument can be a `Node`, `NodeList`, `HTMLElement`, 44743array, or simply omitted (the default is the `window` object). 44744 44745 Y.on('click', function (e) { 44746 e.preventDefault(); 44747 44748 // proceed with ajax form submission 44749 var url = this.get('action'); 44750 ... 44751 }, '#my-form'); 44752 44753The `this` object in DOM event callbacks will be the `Node` targeted by the CSS 44754selector or other identifier. 44755 44756`on()` subscribers for DOM events or custom events `publish`ed with a 44757`defaultFn` can prevent the default behavior with `e.preventDefault()` from the 44758event object passed as the first parameter to the subscription callback. 44759 44760To subscribe to the execution of an object method, pass arguments corresponding to the call signature for 44761<a href="../classes/Do.html#methods_before">`Y.Do.before(...)`</a>. 44762 44763NOTE: The formal parameter list below is for events, not for function 44764injection. See `Y.Do.before` for that signature. 44765 44766@method on 44767@param {String} type DOM or custom event name 44768@param {Function} fn The callback to execute in response to the event 44769@param {Object} [context] Override `this` object in callback 44770@param {Any} [arg*] 0..n additional arguments to supply to the subscriber 44771@return {EventHandle} A subscription handle capable of detaching the 44772 subscription 44773@see Do.before 44774@for YUI
44775**/ 44776 44777/** 44778Listen for an event one time. Equivalent to `on()`, except that 44779the listener is immediately detached when executed. 44780 44781See the <a href="#methods_on">`on()` method</a> for additional subscription 44782options. 44783 44784@see on 44785@method once 44786@param {String} type DOM or custom event name 44787@param {Function} fn The callback to execute in response to the event 44788@param {Object} [context] Override `this` object in callback 44789@param {Any} [arg*] 0..n additional arguments to supply to the subscriber 44790@return {EventHandle} A subscription handle capable of detaching the 44791 subscription 44792@for YUI 44793**/ 44794 44795/** 44796Listen for an event one time. Equivalent to `once()`, except, like `after()`, 44797the subscription callback executes after all `on()` subscribers and the event's 44798`defaultFn` (if configured) have executed. Like `after()` if any `on()` phase 44799subscriber calls `e.preventDefault()`, neither the `defaultFn` nor the `after()` 44800subscribers will execute. 44801 44802The listener is immediately detached when executed. 44803 44804See the <a href="#methods_on">`on()` method</a> for additional subscription 44805options. 44806 44807@see once 44808@method onceAfter 44809@param {String} type The custom event name 44810@param {Function} fn The callback to execute in response to the event 44811@param {Object} [context] Override `this` object in callback 44812@param {Any} [arg*] 0..n additional arguments to supply to the subscriber 44813@return {EventHandle} A subscription handle capable of detaching the 44814 subscription 44815@for YUI 44816**/ 44817 44818/** 44819Like `on()`, this method creates a subscription to a custom event or to the 44820execution of a method on an object. 44821 44822For events, `after()` subscribers are executed after the event's 44823`defaultFn` unless `e.preventDefault()` was called from an `on()` subscriber. 44824 44825See the <a href="#methods_on">`on()` method</a> for additional subscription 44826options. 44827 44828NOTE: The subscription signature shown is for events, not for function 44829injection. See <a href="../classes/Do.html#methods_after">`Y.Do.after`</a> 44830for that signature. 44831 44832@see on 44833@see Do.after 44834@method after 44835@param {String} type The custom event name 44836@param {Function} fn The callback to execute in response to the event 44837@param {Object} [context] Override `this` object in callback 44838@param {Any} [args*] 0..n additional arguments to supply to the subscriber 44839@return {EventHandle} A subscription handle capable of detaching the 44840 subscription 44841@for YUI 44842**/ 44843 44844 44845}, 'patched-v3.18.3', {"requires": ["oop"]}); 44846 44847YUI.add('event-custom-complex', function (Y, NAME) { 44848 44849 44850/** 44851 * Adds event facades, preventable default behavior, and bubbling. 44852 * events. 44853 * @module event-custom 44854 * @submodule event-custom-complex 44855 */ 44856 44857var FACADE, 44858 FACADE_KEYS, 44859 YObject = Y.Object, 44860 key, 44861 EMPTY = {}, 44862 CEProto = Y.CustomEvent.prototype, 44863 ETProto = Y.EventTarget.prototype, 44864 44865 mixFacadeProps = function(facade, payload) { 44866 var p; 44867 44868 for (p in payload) { 44869 if (!(FACADE_KEYS.hasOwnProperty(p))) { 44870 facade[p] = payload[p]; 44871 } 44872 } 44873 }; 44874 44875/** 44876 * Wraps and protects a custom event for use when emitFacade is set to true. 44877 * Requires the event-custom-complex module 44878 * @class EventFacade 44879 * @param e {Event} the custom event 44880 * @param currentTarget {HTMLElement} the element the listener was attached to 44881 */ 44882 44883Y.EventFacade = function(e, currentTarget) { 44884 44885 if (!e) { 44886 e = EMPTY; 44887 } 44888 44889 this._event = e; 44890 44891 /** 44892 * The arguments passed to fire 44893 * @property details 44894 * @type Array 44895 */ 44896 this.details = e.details; 44897 44898 /** 44899 * The event type, this can be overridden by the fire() payload 44900 * @property type 44901 * @type string 44902 */ 44903 this.type = e.type; 44904 44905 /** 44906 * The real event type 44907 * @property _type 44908 * @type string 44909 * @private 44910 */ 44911 this._type = e.type; 44912 44913 ////////////////////////////////////////////////////// 44914 44915 /** 44916 * Node reference for the targeted eventtarget 44917 * @property target 44918 * @type Node 44919 */ 44920 this.target = e.target; 44921 44922 /** 44923 * Node reference for the element that the listener was attached to. 44924 * @property currentTarget 44925 * @type Node 44926 */ 44927 this.currentTarget = currentTarget; 44928 44929 /** 44930 * Node reference to the relatedTarget 44931 * @property relatedTarget 44932 * @type Node 44933 */ 44934 this.relatedTarget = e.relatedTarget; 44935 44936}; 44937 44938Y.mix(Y.EventFacade.prototype, { 44939 44940 /** 44941 * Stops the propagation to the next bubble target 44942 * @method stopPropagation 44943 */ 44944 stopPropagation: function() { 44945 this._event.stopPropagation(); 44946 this.stopped = 1; 44947 }, 44948 44949 /** 44950 * Stops the propagation to the next bubble target and 44951 * prevents any additional listeners from being exectued 44952 * on the current target. 44953 * @method stopImmediatePropagation 44954 */ 44955 stopImmediatePropagation: function() { 44956 this._event.stopImmediatePropagation(); 44957 this.stopped = 2; 44958 }, 44959 44960 /** 44961 * Prevents the event's default behavior 44962 * @method preventDefault 44963 */ 44964 preventDefault: function() { 44965 this._event.preventDefault(); 44966 this.prevented = 1; 44967 }, 44968 44969 /** 44970 * Stops the event propagation and prevents the default 44971 * event behavior. 44972 * @method halt 44973 * @param immediate {boolean} if true additional listeners 44974 * on the current target will not be executed 44975 */ 44976 halt: function(immediate) { 44977 this._event.halt(immediate); 44978 this.prevented = 1; 44979 this.stopped = (immediate) ? 2 : 1; 44980 } 44981 44982}); 44983 44984CEProto.fireComplex = function(args) { 44985 44986 var es, 44987 ef, 44988 q, 44989 queue, 44990 ce, 44991 ret = true, 44992 events, 44993 subs, 44994 ons, 44995 afters, 44996 afterQueue, 44997 postponed, 44998 prevented, 44999 preventedFn, 45000 defaultFn, 45001 self = this, 45002 host = self.host || self, 45003 next, 45004 oldbubble, 45005 stack = self.stack, 45006 yuievt = host._yuievt, 45007 hasPotentialSubscribers; 45008 45009 if (stack) { 45010 45011 // queue this event if the current item in the queue bubbles 45012 if (self.queuable && self.type !== stack.next.type) { 45013 45014 if (!stack.queue) { 45015 stack.queue = []; 45016 } 45017 stack.queue.push([self, args]); 45018 45019 return true; 45020 } 45021 } 45022 45023 hasPotentialSubscribers = self.hasSubs() || yuievt.hasTargets || self.broadcast; 45024 45025 self.target = self.target || host; 45026 self.currentTarget = host; 45027 45028 self.details = args.concat(); 45029 45030 if (hasPotentialSubscribers) { 45031 45032 es = stack || { 45033 45034 id: self.id, // id of the first event in the stack 45035 next: self, 45036 silent: self.silent, 45037 stopped: 0, 45038 prevented: 0, 45039 bubbling: null, 45040 type: self.type, 45041 // defaultFnQueue: new Y.Queue(), 45042 defaultTargetOnly: self.defaultTargetOnly 45043 45044 }; 45045 45046 subs = self.getSubs(); 45047 ons = subs[0]; 45048 afters = subs[1]; 45049 45050 self.stopped = (self.type !== es.type) ? 0 : es.stopped; 45051 self.prevented = (self.type !== es.type) ? 0 : es.prevented; 45052 45053 if (self.stoppedFn) { 45054 // PERF TODO: Can we replace with callback, like preventedFn. Look into history 45055 events = new Y.EventTarget({
45056 fireOnce: true, 45057 context: host 45058 }); 45059 self.events = events; 45060 events.on('stopped', self.stoppedFn); 45061 } 45062 45063 45064 self._facade = null; // kill facade to eliminate stale properties 45065 45066 ef = self._createFacade(args); 45067 45068 if (ons) { 45069 self._procSubs(ons, args, ef); 45070 } 45071 45072 // bubble if this is hosted in an event target and propagation has not been stopped 45073 if (self.bubbles && host.bubble && !self.stopped) { 45074 oldbubble = es.bubbling; 45075 45076 es.bubbling = self.type; 45077 45078 if (es.type !== self.type) { 45079 es.stopped = 0; 45080 es.prevented = 0; 45081 } 45082 45083 ret = host.bubble(self, args, null, es); 45084 45085 self.stopped = Math.max(self.stopped, es.stopped); 45086 self.prevented = Math.max(self.prevented, es.prevented); 45087 45088 es.bubbling = oldbubble; 45089 } 45090 45091 prevented = self.prevented; 45092 45093 if (prevented) { 45094 preventedFn = self.preventedFn; 45095 if (preventedFn) {
45096 preventedFn.apply(host, args); 45097 } 45098 } else { 45099 defaultFn = self.defaultFn; 45100 45101 if (defaultFn && ((!self.defaultTargetOnly && !es.defaultTargetOnly) || host === ef.target)) { 45102 defaultFn.apply(host, args); 45103 } 45104 } 45105 45106 // broadcast listeners are fired as discreet events on the 45107 // YUI instance and potentially the YUI global. 45108 if (self.broadcast) { 45109 self._broadcast(args); 45110 } 45111 45112 if (afters && !self.prevented && self.stopped < 2) { 45113 45114 // Queue the after 45115 afterQueue = es.afterQueue; 45116 45117 if (es.id === self.id || self.type !== yuievt.bubbling) { 45118 45119 self._procSubs(afters, args, ef); 45120 45121 if (afterQueue) { 45122 while ((next = afterQueue.last())) { 45123 next(); 45124 } 45125 } 45126 } else { 45127 postponed = afters; 45128 45129 if (es.execDefaultCnt) { 45130 postponed = Y.merge(postponed); 45131 45132 Y.each(postponed, function(s) { 45133 s.postponed = true; 45134 }); 45135 } 45136 45137 if (!afterQueue) { 45138 es.afterQueue = new Y.Queue(); 45139 } 45140 45141 es.afterQueue.add(function() { 45142 self._procSubs(postponed, args, ef); 45143 }); 45144 } 45145 45146 } 45147 45148 self.target = null; 45149 45150 if (es.id === self.id) { 45151 45152 queue = es.queue; 45153 45154 if (queue) { 45155 while (queue.length) { 45156 q = queue.pop(); 45157 ce = q[0]; 45158 // set up stack to allow the next item to be processed 45159 es.next = ce; 45160 ce._fire(q[1]); 45161 } 45162 } 45163 45164 self.stack = null; 45165 } 45166 45167 ret = !(self.stopped); 45168 45169 if (self.type !== yuievt.bubbling) { 45170 es.stopped = 0; 45171 es.prevented = 0; 45172 self.stopped = 0; 45173 self.prevented = 0; 45174 } 45175 45176 } else { 45177 defaultFn = self.defaultFn; 45178 45179 if(defaultFn) { 45180 ef = self._createFacade(args); 45181 45182 if ((!self.defaultTargetOnly) || (host === ef.target)) {
45183 defaultFn.apply(host, args); 45184 } 45185 } 45186 } 45187 45188 // Kill the cached facade to free up memory. 45189 // Otherwise we have the facade from the last fire, sitting around forever. 45190 self._facade = null; 45191 45192 return ret; 45193}; 45194 45195/** 45196 * @method _hasPotentialSubscribers 45197 * @for CustomEvent 45198 * @private 45199 * @return {boolean} Whether the event has potential subscribers or not 45200 */ 45201CEProto._hasPotentialSubscribers = function() { 45202 return this.hasSubs() || this.host._yuievt.hasTargets || this.broadcast; 45203}; 45204 45205/** 45206 * Internal utility method to create a new facade instance and 45207 * insert it into the fire argument list, accounting for any payload 45208 * merging which needs to happen. 45209 * 45210 * This used to be called `_getFacade`, but the name seemed inappropriate 45211 * when it was used without a need for the return value. 45212 * 45213 * @method _createFacade 45214 * @private 45215 * @param fireArgs {Array} The arguments passed to "fire", which need to be 45216 * shifted (and potentially merged) when the facade is added. 45217 * @return {EventFacade} The event facade created. 45218 */ 45219 45220// TODO: Remove (private) _getFacade alias, once synthetic.js is updated. 45221CEProto._createFacade = CEProto._getFacade = function(fireArgs) { 45222 45223 var userArgs = this.details, 45224 firstArg = userArgs && userArgs[0], 45225 firstArgIsObj = (firstArg && (typeof firstArg === "object")), 45226 ef = this._facade; 45227 45228 if (!ef) { 45229 ef = new Y.EventFacade(this, this.currentTarget); 45230 } 45231 45232 if (firstArgIsObj) { 45233 // protect the event facade properties 45234 mixFacadeProps(ef, firstArg); 45235 45236 // Allow the event type to be faked http://yuilibrary.com/projects/yui3/ticket/2528376 45237 if (firstArg.type) { 45238 ef.type = firstArg.type; 45239 } 45240 45241 if (fireArgs) { 45242 fireArgs[0] = ef; 45243 } 45244 } else { 45245 if (fireArgs) { 45246 fireArgs.unshift(ef); 45247 } 45248 } 45249 45250 // update the details field with the arguments 45251 ef.details = this.details; 45252 45253 // use the original target when the event bubbled to this target 45254 ef.target = this.originalTarget || this.target; 45255 45256 ef.currentTarget = this.currentTarget; 45257 ef.stopped = 0; 45258 ef.prevented = 0; 45259 45260 this._facade = ef; 45261 45262 return this._facade; 45263}; 45264 45265/** 45266 * Utility method to manipulate the args array passed in, to add the event facade, 45267 * if it's not already the first arg. 45268 * 45269 * @method _addFacadeToArgs 45270 * @private 45271 * @param {Array} The arguments to manipulate 45272 */ 45273CEProto._addFacadeToArgs = function(args) { 45274 var e = args[0]; 45275 45276 // Trying not to use instanceof, just to avoid potential cross Y edge case issues. 45277 if (!(e && e.halt && e.stopImmediatePropagation && e.stopPropagation && e._event)) { 45278 this._createFacade(args); 45279 } 45280}; 45281 45282/** 45283 * Stop propagation to bubble targets 45284 * @for CustomEvent 45285 * @method stopPropagation 45286 */ 45287CEProto.stopPropagation = function() { 45288 this.stopped = 1; 45289 if (this.stack) { 45290 this.stack.stopped = 1; 45291 } 45292 if (this.events) { 45293 this.events.fire('stopped', this); 45294 } 45295}; 45296 45297/** 45298 * Stops propagation to bubble targets, and prevents any remaining 45299 * subscribers on the current target from executing. 45300 * @method stopImmediatePropagation 45301 */ 45302CEProto.stopImmediatePropagation = function() { 45303 this.stopped = 2; 45304 if (this.stack) { 45305 this.stack.stopped = 2; 45306 } 45307 if (this.events) { 45308 this.events.fire('stopped', this); 45309 } 45310}; 45311 45312/** 45313 * Prevents the execution of this event's defaultFn 45314 * @method preventDefault 45315 */ 45316CEProto.preventDefault = function() { 45317 if (this.preventable) { 45318 this.prevented = 1; 45319 if (this.stack) { 45320 this.stack.prevented = 1; 45321 } 45322 } 45323}; 45324 45325/** 45326 * Stops the event propagation and prevents the default 45327 * event behavior. 45328 * @method halt 45329 * @param immediate {boolean} if true additional listeners 45330 * on the current target will not be executed 45331 */ 45332CEProto.halt = function(immediate) { 45333 if (immediate) { 45334 this.stopImmediatePropagation(); 45335 } else { 45336 this.stopPropagation(); 45337 } 45338 this.preventDefault(); 45339}; 45340 45341/** 45342 * Registers another EventTarget as a bubble target. Bubble order 45343 * is determined by the order registered. Multiple targets can 45344 * be specified. 45345 * 45346 * Events can only bubble if emitFacade is true. 45347 * 45348 * Included in the event-custom-complex submodule. 45349 * 45350 * @method addTarget 45351 * @chainable 45352 * @param o {EventTarget} the target to add 45353 * @for EventTarget 45354 */ 45355ETProto.addTarget = function(o) { 45356 var etState = this._yuievt; 45357 45358 if (!etState.targets) { 45359 etState.targets = {}; 45360 } 45361 45362 etState.targets[Y.stamp(o)] = o; 45363 etState.hasTargets = true; 45364 45365 return this; 45366}; 45367 45368/** 45369 * Returns an array of bubble targets for this object. 45370 * @method getTargets 45371 * @return EventTarget[] 45372 */ 45373ETProto.getTargets = function() { 45374 var targets = this._yuievt.targets; 45375 return targets ? YObject.values(targets) : []; 45376}; 45377 45378/** 45379 * Removes a bubble target 45380 * @method removeTarget 45381 * @chainable 45382 * @param o {EventTarget} the target to remove 45383 * @for EventTarget 45384 */ 45385ETProto.removeTarget = function(o) { 45386 var targets = this._yuievt.targets; 45387 45388 if (targets) { 45389 delete targets[Y.stamp(o, true)]; 45390 45391 if (YObject.size(targets) === 0) { 45392 this._yuievt.hasTargets = false;
45393 } 45394 } 45395 45396 return this; 45397}; 45398 45399/** 45400 * Propagate an event. Requires the event-custom-complex module. 45401 * @method bubble 45402 * @param evt {CustomEvent} the custom event to propagate 45403 * @return {boolean} the aggregated return value from Event.Custom.fire 45404 * @for EventTarget 45405 */ 45406ETProto.bubble = function(evt, args, target, es) { 45407 45408 var targs = this._yuievt.targets, 45409 ret = true, 45410 t, 45411 ce, 45412 i, 45413 bc, 45414 ce2, 45415 type = evt && evt.type, 45416 originalTarget = target || (evt && evt.target) || this, 45417 oldbubble; 45418 45419 if (!evt || ((!evt.stopped) && targs)) { 45420 45421 for (i in targs) { 45422 if (targs.hasOwnProperty(i)) { 45423 45424 t = targs[i]; 45425 45426 ce = t._yuievt.events[type]; 45427 45428 if (t._hasSiblings) { 45429 ce2 = t.getSibling(type, ce); 45430 } 45431 45432 if (ce2 && !ce) { 45433 ce = t.publish(type); 45434 } 45435 45436 oldbubble = t._yuievt.bubbling; 45437 t._yuievt.bubbling = type; 45438 45439 // if this event was not published on the bubble target, 45440 // continue propagating the event. 45441 if (!ce) { 45442 if (t._yuievt.hasTargets) { 45443 t.bubble(evt, args, originalTarget, es); 45444 } 45445 } else { 45446 45447 if (ce2) { 45448 ce.sibling = ce2; 45449 } 45450 45451 // set the original target to that the target payload on the facade is correct. 45452 ce.target = originalTarget; 45453 ce.originalTarget = originalTarget; 45454 ce.currentTarget = t; 45455 bc = ce.broadcast; 45456 ce.broadcast = false; 45457 45458 // default publish may not have emitFacade true -- that 45459 // shouldn't be what the implementer meant to do 45460 ce.emitFacade = true; 45461 45462 ce.stack = es; 45463 45464 // TODO: See what's getting in the way of changing this to use 45465 // the more performant ce._fire(args || evt.details || []). 45466 45467 // Something in Widget Parent/Child tests is not happy if we 45468 // change it - maybe evt.details related? 45469 ret = ret && ce.fire.apply(ce, args || evt.details || []); 45470 45471 ce.broadcast = bc; 45472 ce.originalTarget = null; 45473 45474 // stopPropagation() was called 45475 if (ce.stopped) { 45476 break; 45477 } 45478 } 45479 45480 t._yuievt.bubbling = oldbubble; 45481 } 45482 } 45483 } 45484 45485 return ret; 45486}; 45487 45488/** 45489 * @method _hasPotentialSubscribers 45490 * @for EventTarget 45491 * @private 45492 * @param {String} fullType The fully prefixed type name 45493 * @return {boolean} Whether the event has potential subscribers or not 45494 */ 45495ETProto._hasPotentialSubscribers = function(fullType) { 45496 45497 var etState = this._yuievt, 45498 e = etState.events[fullType]; 45499 45500 if (e) { 45501 return e.hasSubs() || etState.hasTargets || e.broadcast; 45502 } else { 45503 return false; 45504 } 45505}; 45506 45507FACADE = new Y.EventFacade(); 45508FACADE_KEYS = {}; 45509 45510// Flatten whitelist 45511for (key in FACADE) { 45512 FACADE_KEYS[key] = true; 45513} 45514 45515 45516}, 'patched-v3.18.3', {"requires": ["event-custom-base"]}); 45517 45518YUI.add('event-delegate', function (Y, NAME) { 45519 45520/** 45521 * Adds event delegation support to the library. 45522 * 45523 * @module event 45524 * @submodule event-delegate 45525 */ 45526 45527var toArray = Y.Array, 45528 YLang = Y.Lang, 45529 isString = YLang.isString, 45530 isObject = YLang.isObject, 45531 isArray = YLang.isArray, 45532 selectorTest = Y.Selector.test, 45533 detachCategories = Y.Env.evt.handles; 45534 45535/** 45536 * <p>Sets up event delegation on a container element. The delegated event 45537 * will use a supplied selector or filtering function to test if the event 45538 * references at least one node that should trigger the subscription 45539 * callback.</p> 45540 * 45541 * <p>Selector string filters will trigger the callback if the event originated 45542 * from a node that matches it or is contained in a node that matches it. 45543 * Function filters are called for each Node up the parent axis to the 45544 * subscribing container node, and receive at each level the Node and the event 45545 * object. The function should return true (or a truthy value) if that Node 45546 * should trigger the subscription callback. Note, it is possible for filters 45547 * to match multiple Nodes for a single event. In this case, the delegate 45548 * callback will be executed for each matching Node.</p> 45549 * 45550 * <p>For each matching Node, the callback will be executed with its 'this' 45551 * object set to the Node matched by the filter (unless a specific context was 45552 * provided during subscription), and the provided event's 45553 * <code>currentTarget</code> will also be set to the matching Node. The 45554 * containing Node from which the subscription was originally made can be 45555 * referenced as <code>e.container</code>. 45556 * 45557 * @method delegate 45558 * @param type {String} the event type to delegate 45559 * @param fn {Function} the callback function to execute. This function 45560 * will be provided the event object for the delegated event. 45561 * @param el {String|node} the element that is the delegation container 45562 * @param filter {string|Function} a selector that must match the target of the 45563 * event or a function to test target and its parents for a match 45564 * @param context optional argument that specifies what 'this' refers to. 45565 * @param args* 0..n additional arguments to pass on to the callback function. 45566 * These arguments will be added after the event object. 45567 * @return {EventHandle} the detach handle 45568 * @static 45569 * @for Event 45570 */ 45571function delegate(type, fn, el, filter) { 45572 var args = toArray(arguments, 0, true), 45573 query = isString(el) ? el : null,
45574 typeBits, synth, container, categories, cat, i, len, handles, handle; 45575 45576 // Support Y.delegate({ click: fnA, key: fnB }, el, filter, ...); 45577 // and Y.delegate(['click', 'key'], fn, el, filter, ...); 45578 if (isObject(type)) { 45579 handles = []; 45580 45581 if (isArray(type)) { 45582 for (i = 0, len = type.length; i < len; ++i) { 45583 args[0] = type[i]; 45584 handles.push(Y.delegate.apply(Y, args)); 45585 } 45586 } else { 45587 // Y.delegate({'click', fn}, el, filter) => 45588 // Y.delegate('click', fn, el, filter) 45589 args.unshift(null); // one arg becomes two; need to make space 45590 45591 for (i in type) { 45592 if (type.hasOwnProperty(i)) { 45593 args[0] = i; 45594 args[1] = type[i]; 45595 handles.push(Y.delegate.apply(Y, args)); 45596 } 45597 } 45598 } 45599 45600 return new Y.EventHandle(handles); 45601 } 45602 45603 typeBits = type.split(/\|/); 45604 45605 if (typeBits.length > 1) { 45606 cat = typeBits.shift(); 45607 args[0] = type = typeBits.shift(); 45608 } 45609 45610 synth = Y.Node.DOM_EVENTS[type]; 45611 45612 if (isObject(synth) && synth.delegate) { 45613 handle = synth.delegate.apply(synth, arguments); 45614 } 45615 45616 if (!handle) { 45617 if (!type || !fn || !el || !filter) { 45618 return; 45619 } 45620 45621 container = (query) ? Y.Selector.query(query, null, true) : el; 45622 45623 if (!container && isString(el)) { 45624 handle = Y.on('available', function () { 45625 Y.mix(handle, Y.delegate.apply(Y, args), true); 45626 }, el); 45627 } 45628 45629 if (!handle && container) { 45630 args.splice(2, 2, container); // remove the filter 45631 45632 handle = Y.Event._attach(args, { facade: false }); 45633 handle.sub.filter = filter; 45634 handle.sub._notify = delegate.notifySub; 45635 } 45636 } 45637 45638 if (handle && cat) { 45639 categories = detachCategories[cat] || (detachCategories[cat] = {}); 45640 categories = categories[type] || (categories[type] = []); 45641 categories.push(handle); 45642 } 45643 45644 return handle; 45645} 45646
45647/** 45648Overrides the <code>_notify</code> method on the normal DOM subscription to 45649inject the filtering logic and only proceed in the case of a match. 45650 45651This method is hosted as a private property of the `delegate` method 45652(e.g. `Y.delegate.notifySub`) 45653 45654@method notifySub 45655@param thisObj {Object} default 'this' object for the callback 45656@param args {Array} arguments passed to the event's <code>fire()</code> 45657@param ce {CustomEvent} the custom event managing the DOM subscriptions for 45658 the subscribed event on the subscribing node. 45659@return {Boolean} false if the event was stopped 45660@private 45661@static 45662@since 3.2.0 45663**/ 45664delegate.notifySub = function (thisObj, args, ce) { 45665 // Preserve args for other subscribers 45666 args = args.slice(); 45667 if (this.args) { 45668 args.push.apply(args, this.args); 45669 } 45670 45671 // Only notify subs if the event occurred on a targeted element 45672 var currentTarget = delegate._applyFilter(this.filter, args, ce), 45673 //container = e.currentTarget, 45674 e, i, len, ret; 45675 45676 if (currentTarget) { 45677 // Support multiple matches up the the container subtree 45678 currentTarget = toArray(currentTarget); 45679 45680 // The second arg is the currentTarget, but we'll be reusing this 45681 // facade, replacing the currentTarget for each use, so it doesn't 45682 // matter what element we seed it with. 45683 e = args[0] = new Y.DOMEventFacade(args[0], ce.el, ce); 45684 45685 e.container = Y.one(ce.el); 45686 45687 for (i = 0, len = currentTarget.length; i < len && !e.stopped; ++i) { 45688 e.currentTarget = Y.one(currentTarget[i]); 45689 45690 ret = this.fn.apply(this.context || e.currentTarget, args); 45691 45692 if (ret === false) { // stop further notifications 45693 break; 45694 } 45695 } 45696 45697 return ret; 45698 } 45699}; 45700 45701/** 45702Compiles a selector string into a filter function to identify whether 45703Nodes along the parent axis of an event's target should trigger event 45704notification. 45705 45706This function is memoized, so previously compiled filter functions are 45707returned if the same selector string is provided. 45708 45709This function may be useful when defining synthetic events for delegate 45710handling. 45711 45712Hosted as a property of the `delegate` method (e.g. `Y.delegate.compileFilter`). 45713 45714@method compileFilter 45715@param selector {String} the selector string to base the filtration on 45716@return {Function} 45717@since 3.2.0 45718@static 45719**/ 45720delegate.compileFilter = Y.cached(function (selector) { 45721 return function (target, e) { 45722 return selectorTest(target._node, selector, 45723 (e.currentTarget === e.target) ? null : e.currentTarget._node); 45724 }; 45725}); 45726 45727/** 45728Regex to test for disabled elements during filtering. This is only relevant to 45729IE to normalize behavior with other browsers, which swallow events that occur 45730to disabled elements. IE fires the event from the parent element instead of the 45731original target, though it does preserve `event.srcElement` as the disabled 45732element. IE also supports disabled on `<a>`, but the event still bubbles, so it 45733acts more like `e.preventDefault()` plus styling. That issue is not handled here 45734because other browsers fire the event on the `<a>`, so delegate is supported in 45735both cases. 45736 45737@property _disabledRE 45738@type {RegExp} 45739@protected 45740@since 3.8.1 45741**/ 45742delegate._disabledRE = /^(?:button|input|select|textarea)$/i; 45743 45744/** 45745Walks up the parent axis of an event's target, and tests each element 45746against a supplied filter function. If any Nodes, including the container, 45747satisfy the filter, the delegated callback will be triggered for each. 45748 45749Hosted as a protected property of the `delegate` method (e.g. 45750`Y.delegate._applyFilter`). 45751 45752@method _applyFilter 45753@param filter {Function} boolean function to test for inclusion in event 45754 notification 45755@param args {Array} the arguments that would be passed to subscribers 45756@param ce {CustomEvent} the DOM event wrapper 45757@return {Node|Node[]|undefined} The Node or Nodes that satisfy the filter 45758@protected 45759**/ 45760delegate._applyFilter = function (filter, args, ce) { 45761 var e = args[0], 45762 container = ce.el, // facadeless events in IE, have no e.currentTarget 45763 target = e.target || e.srcElement, 45764 match = [], 45765 isContainer = false;
45766 45767 // Resolve text nodes to their containing element 45768 if (target.nodeType === 3) { 45769 target = target.parentNode; 45770 } 45771 45772 // For IE. IE propagates events from the parent element of disabled 45773 // elements, where other browsers swallow the event entirely. To normalize 45774 // this in IE, filtering for matching elements should abort if the target 45775 // is a disabled form control. 45776 if (target.disabled && delegate._disabledRE.test(target.nodeName)) { 45777 return match; 45778 } 45779 45780 // passing target as the first arg rather than leaving well enough alone 45781 // making 'this' in the filter function refer to the target. This is to 45782 // support bound filter functions. 45783 args.unshift(target); 45784 45785 if (isString(filter)) { 45786 while (target) { 45787 isContainer = (target === container); 45788 if (selectorTest(target, filter, (isContainer ? null: container))) { 45789 match.push(target); 45790 } 45791 45792 if (isContainer) { 45793 break; 45794 } 45795 45796 target = target.parentNode; 45797 } 45798 } else { 45799 // filter functions are implementer code and should receive wrappers 45800 args[0] = Y.one(target); 45801 args[1] = new Y.DOMEventFacade(e, container, ce); 45802 45803 while (target) { 45804 // filter(target, e, extra args...) - this === target 45805 if (filter.apply(args[0], args)) { 45806 match.push(target); 45807 } 45808 45809 if (target === container) { 45810 break; 45811 } 45812 45813 target = target.parentNode; 45814 args[0] = Y.one(target); 45815 } 45816 args[1] = e; // restore the raw DOM event 45817 } 45818 45819 if (match.length <= 1) { 45820 match = match[0]; // single match or undefined 45821 } 45822 45823 // remove the target 45824 args.shift(); 45825 45826 return match; 45827}; 45828 45829/** 45830 * Sets up event delegation on a container element. The delegated event 45831 * will use a supplied filter to test if the callback should be executed. 45832 * This filter can be either a selector string or a function that returns 45833 * a Node to use as the currentTarget for the event. 45834 * 45835 * The event object for the delegated event is supplied to the callback 45836 * function. It is modified slightly in order to support all properties 45837 * that may be needed for event delegation. 'currentTarget' is set to 45838 * the element that matched the selector string filter or the Node returned 45839 * from the filter function. 'container' is set to the element that the 45840 * listener is delegated from (this normally would be the 'currentTarget'). 45841 * 45842 * Filter functions will be called with the arguments that would be passed to 45843 * the callback function, including the event object as the first parameter. 45844 * The function should return false (or a falsey value) if the success criteria 45845 * aren't met, and the Node to use as the event's currentTarget and 'this' 45846 * object if they are. 45847 * 45848 * @method delegate 45849 * @param type {string} the event type to delegate 45850 * @param fn {function} the callback function to execute. This function 45851 * will be provided the event object for the delegated event. 45852 * @param el {string|node} the element that is the delegation container 45853 * @param filter {string|function} a selector that must match the target of the 45854 * event or a function that returns a Node or false. 45855 * @param context optional argument that specifies what 'this' refers to. 45856 * @param args* 0..n additional arguments to pass on to the callback function. 45857 * These arguments will be added after the event object. 45858 * @return {EventHandle} the detach handle 45859 * @for YUI 45860 */ 45861Y.delegate = Y.Event.delegate = delegate; 45862 45863 45864}, 'patched-v3.18.3', {"requires": ["node-base"]}); 45865 45866YUI.add('event-focus', function (Y, NAME) { 45867 45868/** 45869 * Adds bubbling and delegation support to DOM events focus and blur. 45870 * 45871 * @module event 45872 * @submodule event-focus 45873 */ 45874var Event = Y.Event, 45875 45876 YLang = Y.Lang, 45877 45878 isString = YLang.isString, 45879 45880 arrayIndex = Y.Array.indexOf, 45881 45882 useActivate = (function() { 45883 45884 // Changing the structure of this test, so that it doesn't use inline JS in HTML, 45885 // which throws an exception in Win8 packaged apps, due to additional security restrictions:
45886 // http://msdn.microsoft.com/en-us/library/windows/apps/hh465380.aspx#differences 45887 45888 var supported = false, 45889 doc = Y.config.doc, 45890 p; 45891 45892 if (doc) { 45893 45894 p = doc.createElement("p"); 45895 p.setAttribute("onbeforeactivate", ";"); 45896 45897 // onbeforeactivate is a function in IE8+. 45898 // onbeforeactivate is a string in IE6,7 (unfortunate, otherwise we could have just checked for function below). 45899 // onbeforeactivate is a function in IE10, in a Win8 App environment (no exception running the test). 45900 45901 // onbeforeactivate is undefined in Webkit/Gecko. 45902 // onbeforeactivate is a function in Webkit/Gecko if it's a supported event (e.g. onclick). 45903 45904 supported = (p.onbeforeactivate !== undefined); 45905 } 45906 45907 return supported; 45908 }()); 45909 45910function define(type, proxy, directEvent) { 45911 var nodeDataKey = '_' + type + 'Notifiers'; 45912 45913 Y.Event.define(type, { 45914 45915 _useActivate : useActivate, 45916 45917 _attach: function (el, notifier, delegate) { 45918 if (Y.DOM.isWindow(el)) { 45919 return Event._attach([type, function (e) { 45920 notifier.fire(e); 45921 }, el]); 45922 } else { 45923 return Event._attach( 45924 [proxy, this._proxy, el, this, notifier, delegate], 45925 { capture: true }); 45926 } 45927 }, 45928 45929 _proxy: function (e, notifier, delegate) { 45930 var target = e.target, 45931 currentTarget = e.currentTarget, 45932 notifiers = target.getData(nodeDataKey), 45933 yuid = Y.stamp(currentTarget._node), 45934 defer = (useActivate || target !== currentTarget), 45935 directSub; 45936 45937 notifier.currentTarget = (delegate) ? target : currentTarget; 45938 notifier.container = (delegate) ? currentTarget : null; 45939 45940 // Maintain a list to handle subscriptions from nested 45941 // containers div#a>div#b>input #a.on(focus..) #b.on(focus..), 45942 // use one focus or blur subscription that fires notifiers from 45943 // #b then #a to emulate bubble sequence. 45944 if (!notifiers) { 45945 notifiers = {}; 45946 target.setData(nodeDataKey, notifiers); 45947 45948 // only subscribe to the element's focus if the target is 45949 // not the current target ( 45950 if (defer) { 45951 directSub = Event._attach( 45952 [directEvent, this._notify, target._node]).sub; 45953 directSub.once = true; 45954 } 45955 } else { 45956 // In old IE, defer is always true. In capture-phase browsers, 45957 // The delegate subscriptions will be encountered first, which 45958 // will establish the notifiers data and direct subscription 45959 // on the node. If there is also a direct subscription to the 45960 // node's focus/blur, it should not call _notify because the 45961 // direct subscription from the delegate sub(s) exists, which 45962 // will call _notify. So this avoids _notify being called 45963 // twice, unnecessarily. 45964 defer = true; 45965 } 45966 45967 if (!notifiers[yuid]) { 45968 notifiers[yuid] = []; 45969 } 45970 45971 notifiers[yuid].push(notifier); 45972 45973 if (!defer) { 45974 this._notify(e); 45975 } 45976 }, 45977 45978 _notify: function (e, container) { 45979 var currentTarget = e.currentTarget, 45980 notifierData = currentTarget.getData(nodeDataKey), 45981 axisNodes = currentTarget.ancestors(), 45982 doc = currentTarget.get('ownerDocument'), 45983 delegates = [], 45984 // Used to escape loops when there are no more 45985 // notifiers to consider 45986 count = notifierData ? 45987 Y.Object.keys(notifierData).length : 45988 0, 45989 target, notifiers, notifier, yuid, match, tmp, i, len, sub, ret; 45990 45991 // clear the notifications list (mainly for delegation) 45992 currentTarget.clearData(nodeDataKey); 45993 45994 // Order the delegate subs by their placement in the parent axis 45995 axisNodes.push(currentTarget); 45996 // document.get('ownerDocument') returns null 45997 // which we'll use to prevent having duplicate Nodes in the list 45998 if (doc) { 45999 axisNodes.unshift(doc); 46000 } 46001 46002 // ancestors() returns the Nodes from top to bottom 46003 axisNodes._nodes.reverse(); 46004 46005 if (count) { 46006 // Store the count for step 2 46007 tmp = count; 46008 axisNodes.some(function (node) { 46009 var yuid = Y.stamp(node), 46010 notifiers = notifierData[yuid], 46011 i, len; 46012 46013 if (notifiers) { 46014 count--; 46015 for (i = 0, len = notifiers.length; i < len; ++i) { 46016 if (notifiers[i].handle.sub.filter) { 46017 delegates.push(notifiers[i]); 46018 } 46019 } 46020 } 46021 46022 return !count; 46023 }); 46024 count = tmp; 46025 } 46026 46027 // Walk up the parent axis, notifying direct subscriptions and 46028 // testing delegate filters. 46029 while (count && (target = axisNodes.shift())) { 46030 yuid = Y.stamp(target); 46031 46032 notifiers = notifierData[yuid]; 46033 46034 if (notifiers) { 46035 for (i = 0, len = notifiers.length; i < len; ++i) { 46036 notifier = notifiers[i]; 46037 sub = notifier.handle.sub; 46038 match = true; 46039 46040 e.currentTarget = target; 46041 46042 if (sub.filter) { 46043 match = sub.filter.apply(target, 46044 [target, e].concat(sub.args || [])); 46045 46046 // No longer necessary to test against this 46047 // delegate subscription for the nodes along 46048 // the parent axis. 46049 delegates.splice( 46050 arrayIndex(delegates, notifier), 1); 46051 } 46052 46053 if (match) { 46054 // undefined for direct subs 46055 e.container = notifier.container; 46056 ret = notifier.fire(e); 46057 } 46058 46059 if (ret === false || e.stopped === 2) { 46060 break; 46061 } 46062 } 46063 46064 delete notifiers[yuid]; 46065 count--; 46066 } 46067 46068 if (e.stopped !== 2) { 46069 // delegates come after subs targeting this specific node 46070 // because they would not normally report until they'd 46071 // bubbled to the container node. 46072 for (i = 0, len = delegates.length; i < len; ++i) { 46073 notifier = delegates[i]; 46074 sub = notifier.handle.sub; 46075 46076 if (sub.filter.apply(target, 46077 [target, e].concat(sub.args || []))) { 46078 46079 e.container = notifier.container; 46080 e.currentTarget = target; 46081 ret = notifier.fire(e); 46082 } 46083 46084 if (ret === false || e.stopped === 2 || 46085 // If e.stopPropagation() is called, notify any 46086 // delegate subs from the same container, but break 46087 // once the container changes. This emulates 46088 // delegate() behavior for events like 'click' which 46089 // won't notify delegates higher up the parent axis. 46090 (e.stopped && delegates[i+1] && 46091 delegates[i+1].container !== notifier.container)) { 46092 break; 46093 } 46094 } 46095 } 46096 46097 if (e.stopped) { 46098 break; 46099 } 46100 } 46101 }, 46102 46103 on: function (node, sub, notifier) { 46104 sub.handle = this._attach(node._node, notifier); 46105 }, 46106 46107 detach: function (node, sub) { 46108 sub.handle.detach(); 46109 }, 46110 46111 delegate: function (node, sub, notifier, filter) { 46112 if (isString(filter)) { 46113 sub.filter = function (target) { 46114 return Y.Selector.test(target._node, filter, 46115 node === target ? null : node._node); 46116 }; 46117 } 46118 46119 sub.handle = this._attach(node._node, notifier, true); 46120 }, 46121 46122 detachDelegate: function (node, sub) { 46123 sub.handle.detach(); 46124 } 46125 }, true); 46126} 46127 46128// For IE, we need to defer to focusin rather than focus because 46129// `el.focus(); doSomething();` executes el.onbeforeactivate, el.onactivate, 46130// el.onfocusin, doSomething, then el.onfocus. All others support capture 46131// phase focus, which executes before doSomething. To guarantee consistent 46132// behavior for this use case, IE's direct subscriptions are made against 46133// focusin so subscribers will be notified before js following el.focus() is 46134// executed. 46135if (useActivate) { 46136 // name capture phase direct subscription 46137 define("focus", "beforeactivate", "focusin");
46138 define("blur", "beforedeactivate", "focusout"); 46139} else { 46140 define("focus", "focus", "focus"); 46141 define("blur", "blur", "blur"); 46142} 46143 46144 46145}, 'patched-v3.18.3', {"requires": ["event-synthetic"]}); 46146 46147YUI.add('event-hover', function (Y, NAME) { 46148 46149/** 46150 * Adds support for a "hover" event. The event provides a convenience wrapper 46151 * for subscribing separately to mouseenter and mouseleave. The signature for 46152 * subscribing to the event is</p> 46153 * 46154 * <pre><code>node.on("hover", overFn, outFn); 46155 * node.delegate("hover", overFn, outFn, ".filterSelector"); 46156 * Y.on("hover", overFn, outFn, ".targetSelector"); 46157 * Y.delegate("hover", overFn, outFn, "#container", ".filterSelector"); 46158 * </code></pre> 46159 * 46160 * <p>Additionally, for compatibility with a more typical subscription 46161 * signature, the following are also supported:</p> 46162 * 46163 * <pre><code>Y.on("hover", overFn, ".targetSelector", outFn); 46164 * Y.delegate("hover", overFn, "#container", outFn, ".filterSelector"); 46165 * </code></pre> 46166 * 46167 * @module event 46168 * @submodule event-hover 46169 */ 46170var isFunction = Y.Lang.isFunction, 46171 noop = function () {}, 46172 conf = { 46173 processArgs: function (args) { 46174 // Y.delegate('hover', over, out, '#container', '.filter') 46175 // comes in as ['hover', over, out, '#container', '.filter'], but 46176 // node.delegate('hover', over, out, '.filter') 46177 // comes in as ['hover', over, containerEl, out, '.filter'] 46178 var i = isFunction(args[2]) ? 2 : 3; 46179 46180 return (isFunction(args[i])) ? args.splice(i,1)[0] : noop; 46181 }, 46182 46183 on: function (node, sub, notifier, filter) { 46184 var args = (sub.args) ? sub.args.slice() : []; 46185 46186 args.unshift(null); 46187 46188 sub._detach = node[(filter) ? "delegate" : "on"]({ 46189 mouseenter: function (e) { 46190 e.phase = 'over'; 46191 notifier.fire(e); 46192 }, 46193 mouseleave: function (e) { 46194 var thisObj = sub.context || this; 46195 46196 args[0] = e; 46197 46198 e.type = 'hover'; 46199 e.phase = 'out'; 46200 sub._extra.apply(thisObj, args); 46201 } 46202 }, filter); 46203 }, 46204 46205 detach: function (node, sub, notifier) { 46206 sub._detach.detach(); 46207 } 46208 }; 46209 46210conf.delegate = conf.on; 46211conf.detachDelegate = conf.detach; 46212 46213Y.Event.define("hover", conf); 46214 46215 46216}, 'patched-v3.18.3', {"requires": ["event-mouseenter"]}); 46217
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.