vendor: 9,492 bytes, lines 1-385
1/*! 2 * jQuery JavaScript Library v3.4.0 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: 2019-04-10T19:48Z 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 document = window.document; 51 52var getProto = Object.getPrototypeOf; 53 54var slice = arr.slice; 55 56var concat = arr.concat; 57 58var push = arr.push; 59 60var indexOf = arr.indexOf; 61 62var class2type = {}; 63 64var toString = class2type.toString; 65 66var hasOwn = class2type.hasOwnProperty; 67 68var fnToString = hasOwn.toString; 69 70var ObjectFunctionString = fnToString.call( Object ); 71 72var support = {}; 73 74var isFunction = function isFunction( obj ) { 75 76 // Support: Chrome <=57, Firefox <=52 77 // In some browsers, typeof returns "function" for HTML <object> elements 78 // (i.e., `typeof document.createElement( "object" ) === "function"`). 79 // We don't want to classify *any* DOM node as a function. 80 return typeof obj === "function" && typeof obj.nodeType !== "number"; 81 }; 82 83 84var isWindow = function isWindow( obj ) { 85 return obj != null && obj === obj.window; 86 }; 87 88 89 90 91 var preservedScriptAttributes = { 92 type: true, 93 src: true, 94 nonce: true, 95 noModule: true 96 }; 97 98 function DOMEval( code, node, doc ) { 99 doc = doc || document; 100 101 var i, val, 102 script = doc.createElement( "script" ); 103 104 script.text = code; 105 if ( node ) { 106 for ( i in preservedScriptAttributes ) { 107 108 // Support: Firefox 64+, Edge 18+ 109 // Some browsers don't support the "nonce" property on scripts. 110 // On the other hand, just using `getAttribute` is not enough as 111 // the `nonce` attribute is reset to an empty string whenever it 112 // becomes browsing-context connected. 113 // See https://github.com/whatwg/html/issues/2369 114 // See https://html.spec.whatwg.org/#nonce-attributes 115 // The `node.getAttribute` check was added for the sake of 116 // `jQuery.globalEval` so that it can fake a nonce-containing node 117 // via an object. 118 val = node[ i ] || node.getAttribute && node.getAttribute( i ); 119 if ( val ) { 120 script.setAttribute( i, val ); 121 } 122 } 123 } 124 doc.head.appendChild( script ).parentNode.removeChild( script ); 125 } 126 127 128function toType( obj ) { 129 if ( obj == null ) { 130 return obj + ""; 131 } 132 133 // Support: Android <=2.3 only (functionish RegExp) 134 return typeof obj === "object" || typeof obj === "function" ? 135 class2type[ toString.call( obj ) ] || "object" : 136 typeof obj; 137} 138/* global Symbol */ 139// Defining this global in .eslintrc.json would create a danger of using the global 140// unguarded in another place, it seems safer to define global only for this module 141 142 143 144var 145 version = "3.4.0", 146 147 // Define a local copy of jQuery 148 jQuery = function( selector, context ) { 149 150 // The jQuery object is actually just the init constructor 'enhanced' 151 // Need init if jQuery is called (just allow error to be thrown if not included) 152 return new jQuery.fn.init( selector, context ); 153 }, 154 155 // Support: Android <=4.0 only 156 // Make sure we trim BOM and NBSP 157 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; 158 159jQuery.fn = jQuery.prototype = { 160 161 // The current version of jQuery being used 162 jquery: version, 163 164 constructor: jQuery, 165 166 // The default length of a jQuery object is 0 167 length: 0, 168 169 toArray: function() { 170 return slice.call( this ); 171 }, 172 173 // Get the Nth element in the matched element set OR 174 // Get the whole matched element set as a clean array 175 get: function( num ) { 176 177 // Return all the elements in a clean array 178 if ( num == null ) { 179 return slice.call( this ); 180 } 181 182 // Return just the one element from the set 183 return num < 0 ? this[ num + this.length ] : this[ num ]; 184 }, 185 186 // Take an array of elements and push it onto the stack 187 // (returning the new matched element set) 188 pushStack: function( elems ) { 189 190 // Build a new jQuery matched element set 191 var ret = jQuery.merge( this.constructor(), elems ); 192 193 // Add the old object onto the stack (as a reference) 194 ret.prevObject = this; 195 196 // Return the newly-formed element set 197 return ret; 198 }, 199 200 // Execute a callback for every element in the matched set. 201 each: function( callback ) { 202 return jQuery.each( this, callback ); 203 }, 204 205 map: function( callback ) { 206 return this.pushStack( jQuery.map( this, function( elem, i ) { 207 return callback.call( elem, i, elem ); 208 } ) ); 209 }, 210 211 slice: function() { 212 return this.pushStack( slice.apply( this, arguments ) ); 213 }, 214 215 first: function() { 216 return this.eq( 0 ); 217 }, 218 219 last: function() { 220 return this.eq( -1 ); 221 }, 222 223 eq: function( i ) { 224 var len = this.length, 225 j = +i + ( i < 0 ? len : 0 ); 226 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 227 }, 228 229 end: function() { 230 return this.prevObject || this.constructor(); 231 }, 232 233 // For internal use only. 234 // Behaves like an Array's method, not like a jQuery method. 235 push: push, 236 sort: arr.sort, 237 splice: arr.splice 238}; 239 240jQuery.extend = jQuery.fn.extend = function() { 241 var options, name, src, copy, copyIsArray, clone, 242 target = arguments[ 0 ] || {}, 243 i = 1, 244 length = arguments.length, 245 deep = false; 246 247 // Handle a deep copy situation 248 if ( typeof target === "boolean" ) { 249 deep = target; 250 251 // Skip the boolean and the target 252 target = arguments[ i ] || {}; 253 i++; 254 } 255 256 // Handle case when target is a string or something (possible in deep copy) 257 if ( typeof target !== "object" && !isFunction( target ) ) { 258 target = {}; 259 } 260 261 // Extend jQuery itself if only one argument is passed 262 if ( i === length ) { 263 target = this; 264 i--; 265 } 266 267 for ( ; i < length; i++ ) { 268 269 // Only deal with non-null/undefined values 270 if ( ( options = arguments[ i ] ) != null ) { 271 272 // Extend the base object 273 for ( name in options ) { 274 copy = options[ name ]; 275 276 // Prevent Object.prototype pollution 277 // Prevent never-ending loop 278 if ( name === "__proto__" || target === copy ) { 279 continue; 280 } 281 282 // Recurse if we're merging plain objects or arrays 283 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 284 ( copyIsArray = Array.isArray( copy ) ) ) ) { 285 src = target[ name ]; 286 287 // Ensure proper type for the source value 288 if ( copyIsArray && !Array.isArray( src ) ) { 289 clone = []; 290 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { 291 clone = {}; 292 } else { 293 clone = src; 294 } 295 copyIsArray = false; 296 297 // Never move original objects, clone them 298 target[ name ] = jQuery.extend( deep, clone, copy ); 299 300 // Don't bring in undefined values 301 } else if ( copy !== undefined ) { 302 target[ name ] = copy; 303 } 304 } 305 } 306 } 307 308 // Return the modified object 309 return target; 310}; 311 312jQuery.extend( { 313 314 // Unique for each copy of jQuery on the page 315 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 316 317 // Assume jQuery is ready without the ready module 318 isReady: true, 319 320 error: function( msg ) { 321 throw new Error( msg ); 322 }, 323 324 noop: function() {}, 325 326 isPlainObject: function( obj ) { 327 var proto, Ctor; 328 329 // Detect obvious negatives 330 // Use toString instead of jQuery.type to catch host objects 331 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 332 return false; 333 } 334 335 proto = getProto( obj ); 336 337 // Objects with no prototype (e.g., `Object.create( null )`) are plain 338 if ( !proto ) { 339 return true; 340 } 341 342 // Objects with prototype are plain iff they were constructed by a global Object function 343 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 344 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 345 }, 346 347 isEmptyObject: function( obj ) { 348 var name; 349 350 for ( name in obj ) { 351 return false; 352 } 353 return true; 354 }, 355 356 // Evaluates a script in a global context 357 globalEval: function( code, options ) { 358 DOMEval( code, { nonce: options && options.nonce } ); 359 }, 360 361 each: function( obj, callback ) { 362 var length, i = 0; 363 364 if ( isArrayLike( obj ) ) { 365 length = obj.length; 366 for ( ; i < length; i++ ) { 367 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 368 break; 369 } 370 } 371 } else { 372 for ( i in obj ) { 373 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 374 break; 375 } 376 } 377 } 378 379 return obj; 380 }, 381 382 // Support: Android <=4.0 only 383 trim: function( text ) { 384 return text == null ? 385 "" :
vendor: 14,126 bytes, lines 386-904
386 ( text + "" ).replace( rtrim, "" ); 387 }, 388 389 // results is for internal usage only 390 makeArray: function( arr, results ) { 391 var ret = results || []; 392 393 if ( arr != null ) { 394 if ( isArrayLike( Object( arr ) ) ) { 395 jQuery.merge( ret, 396 typeof arr === "string" ? 397 [ arr ] : arr 398 ); 399 } else { 400 push.call( ret, arr ); 401 } 402 } 403 404 return ret; 405 }, 406 407 inArray: function( elem, arr, i ) { 408 return arr == null ? -1 : indexOf.call( arr, elem, i ); 409 }, 410 411 // Support: Android <=4.0 only, PhantomJS 1 only 412 // push.apply(_, arraylike) throws on ancient WebKit 413 merge: function( first, second ) { 414 var len = +second.length, 415 j = 0, 416 i = first.length; 417 418 for ( ; j < len; j++ ) { 419 first[ i++ ] = second[ j ]; 420 } 421 422 first.length = i; 423 424 return first; 425 }, 426 427 grep: function( elems, callback, invert ) { 428 var callbackInverse, 429 matches = [], 430 i = 0, 431 length = elems.length, 432 callbackExpect = !invert; 433 434 // Go through the array, only saving the items 435 // that pass the validator function 436 for ( ; i < length; i++ ) { 437 callbackInverse = !callback( elems[ i ], i ); 438 if ( callbackInverse !== callbackExpect ) { 439 matches.push( elems[ i ] ); 440 } 441 } 442 443 return matches; 444 }, 445 446 // arg is for internal usage only 447 map: function( elems, callback, arg ) { 448 var length, value, 449 i = 0, 450 ret = []; 451 452 // Go through the array, translating each of the items to their new values 453 if ( isArrayLike( elems ) ) { 454 length = elems.length; 455 for ( ; i < length; i++ ) { 456 value = callback( elems[ i ], i, arg ); 457 458 if ( value != null ) { 459 ret.push( value ); 460 } 461 } 462 463 // Go through every key on the object, 464 } else { 465 for ( i in elems ) { 466 value = callback( elems[ i ], i, arg ); 467 468 if ( value != null ) { 469 ret.push( value ); 470 } 471 } 472 } 473 474 // Flatten any nested arrays 475 return concat.apply( [], ret ); 476 }, 477 478 // A global GUID counter for objects 479 guid: 1, 480 481 // jQuery.support is not used in Core but other projects attach their 482 // properties to it so it needs to exist. 483 support: support 484} ); 485 486if ( typeof Symbol === "function" ) { 487 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 488} 489 490// Populate the class2type map 491jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 492function( i, name ) { 493 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 494} ); 495 496function isArrayLike( obj ) { 497 498 // Support: real iOS 8.2 only (not reproducible in simulator) 499 // `in` check used to prevent JIT error (gh-2145) 500 // hasOwn isn't used here due to false negatives 501 // regarding Nodelist length in IE 502 var length = !!obj && "length" in obj && obj.length, 503 type = toType( obj ); 504 505 if ( isFunction( obj ) || isWindow( obj ) ) { 506 return false; 507 } 508 509 return type === "array" || length === 0 || 510 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 511} 512var Sizzle = 513/*! 514 * Sizzle CSS Selector Engine v2.3.4 515 * https://sizzlejs.com/ 516 * 517 * Copyright JS Foundation and other contributors 518 * Released under the MIT license 519 * https://js.foundation/ 520 * 521 * Date: 2019-04-08 522 */ 523(function( window ) { 524 525var i, 526 support, 527 Expr, 528 getText, 529 isXML, 530 tokenize, 531 compile, 532 select, 533 outermostContext, 534 sortInput, 535 hasDuplicate, 536 537 // Local document vars 538 setDocument, 539 document, 540 docElem, 541 documentIsHTML, 542 rbuggyQSA, 543 rbuggyMatches, 544 matches, 545 contains, 546 547 // Instance-specific data 548 expando = "sizzle" + 1 * new Date(), 549 preferredDoc = window.document, 550 dirruns = 0, 551 done = 0, 552 classCache = createCache(), 553 tokenCache = createCache(), 554 compilerCache = createCache(), 555 nonnativeSelectorCache = createCache(), 556 sortOrder = function( a, b ) { 557 if ( a === b ) { 558 hasDuplicate = true; 559 } 560 return 0; 561 }, 562 563 // Instance methods 564 hasOwn = ({}).hasOwnProperty, 565 arr = [], 566 pop = arr.pop, 567 push_native = arr.push, 568 push = arr.push, 569 slice = arr.slice, 570 // Use a stripped-down indexOf as it's faster than native 571 // https://jsperf.com/thor-indexof-vs-for/5 572 indexOf = function( list, elem ) { 573 var i = 0, 574 len = list.length; 575 for ( ; i < len; i++ ) { 576 if ( list[i] === elem ) { 577 return i; 578 } 579 } 580 return -1; 581 }, 582 583 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", 584 585 // Regular expressions 586 587 // http://www.w3.org/TR/css3-selectors/#whitespace 588 whitespace = "[\\x20\\t\\r\\n\\f]", 589 590 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier 591 identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+", 592 593 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 594 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 595 // Operator (capture 2) 596 "*([*^$|!~]?=)" + whitespace + 597 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 598 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + 599 "*\\]", 600 601 pseudos = ":(" + identifier + ")(?:\\((" + 602 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 603 // 1. quoted (capture 3; capture 4 or capture 5) 604 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 605 // 2. simple (capture 6) 606 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 607 // 3. anything else (capture 2) 608 ".*" + 609 ")\\)|)", 610 611 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 612 rwhitespace = new RegExp( whitespace + "+", "g" ), 613 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), 614 615 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 616 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), 617 rdescend = new RegExp( whitespace + "|>" ), 618 619 rpseudo = new RegExp( pseudos ), 620 ridentifier = new RegExp( "^" + identifier + "$" ), 621 622 matchExpr = { 623 "ID": new RegExp( "^#(" + identifier + ")" ), 624 "CLASS": new RegExp( "^\\.(" + identifier + ")" ), 625 "TAG": new RegExp( "^(" + identifier + "|[*])" ), 626 "ATTR": new RegExp( "^" + attributes ), 627 "PSEUDO": new RegExp( "^" + pseudos ), 628 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + 629 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + 630 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 631 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), 632 // For use in libraries implementing .is() 633 // We use this for POS matching in `select` 634 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + 635 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 636 }, 637 638 rhtml = /HTML$/i, 639 rinputs = /^(?:input|select|textarea|button)$/i, 640 rheader = /^h\d$/i, 641 642 rnative = /^[^{]+\{\s*\[native \w/, 643 644 // Easily-parseable/retrievable ID or TAG or CLASS selectors 645 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 646 647 rsibling = /[+~]/, 648 649 // CSS escapes 650 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 651 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), 652 funescape = function( _, escaped, escapedWhitespace ) { 653 var high = "0x" + escaped - 0x10000; 654 // NaN means non-codepoint 655 // Support: Firefox<24 656 // Workaround erroneous numeric interpretation of +"0x" 657 return high !== high || escapedWhitespace ? 658 escaped : 659 high < 0 ? 660 // BMP codepoint 661 String.fromCharCode( high + 0x10000 ) : 662 // Supplemental Plane codepoint (surrogate pair) 663 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 664 }, 665 666 // CSS string/identifier serialization 667 // https://drafts.csswg.org/cssom/#common-serializing-idioms 668 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, 669 fcssescape = function( ch, asCodePoint ) { 670 if ( asCodePoint ) { 671 672 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 673 if ( ch === "\0" ) { 674 return "\uFFFD"; 675 } 676 677 // Control characters and (dependent upon position) numbers get escaped as code points 678 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 679 } 680 681 // Other potentially-special ASCII characters get backslash-escaped 682 return "\\" + ch; 683 }, 684 685 // Used for iframes 686 // See setDocument() 687 // Removing the function wrapper causes a "Permission Denied" 688 // error in IE 689 unloadHandler = function() { 690 setDocument(); 691 }, 692 693 inDisabledFieldset = addCombinator( 694 function( elem ) { 695 return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; 696 }, 697 { dir: "parentNode", next: "legend" } 698 ); 699 700// Optimize for push.apply( _, NodeList ) 701try { 702 push.apply( 703 (arr = slice.call( preferredDoc.childNodes )), 704 preferredDoc.childNodes 705 ); 706 // Support: Android<4.0 707 // Detect silently failing push.apply 708 arr[ preferredDoc.childNodes.length ].nodeType; 709} catch ( e ) { 710 push = { apply: arr.length ? 711 712 // Leverage slice if possible 713 function( target, els ) { 714 push_native.apply( target, slice.call(els) ); 715 } : 716 717 // Support: IE<9 718 // Otherwise append directly 719 function( target, els ) { 720 var j = target.length, 721 i = 0; 722 // Can't trust NodeList.length 723 while ( (target[j++] = els[i++]) ) {} 724 target.length = j - 1; 725 } 726 }; 727} 728 729function Sizzle( selector, context, results, seed ) { 730 var m, i, elem, nid, match, groups, newSelector, 731 newContext = context && context.ownerDocument, 732 733 // nodeType defaults to 9, since context defaults to document 734 nodeType = context ? context.nodeType : 9; 735 736 results = results || []; 737 738 // Return early from calls with invalid selector or context 739 if ( typeof selector !== "string" || !selector || 740 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 741 742 return results; 743 } 744 745 // Try to shortcut find operations (as opposed to filters) in HTML documents 746 if ( !seed ) { 747 748 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { 749 setDocument( context ); 750 } 751 context = context || document; 752 753 if ( documentIsHTML ) { 754 755 // If the selector is sufficiently simple, try using a "get*By*" DOM method 756 // (excepting DocumentFragment context, where the methods don't exist) 757 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { 758 759 // ID selector 760 if ( (m = match[1]) ) { 761 762 // Document context 763 if ( nodeType === 9 ) { 764 if ( (elem = context.getElementById( m )) ) { 765 766 // Support: IE, Opera, Webkit 767 // TODO: identify versions 768 // getElementById can match elements by name instead of ID 769 if ( elem.id === m ) { 770 results.push( elem ); 771 return results; 772 } 773 } else { 774 return results; 775 } 776 777 // Element context 778 } else { 779 780 // Support: IE, Opera, Webkit 781 // TODO: identify versions 782 // getElementById can match elements by name instead of ID 783 if ( newContext && (elem = newContext.getElementById( m )) && 784 contains( context, elem ) && 785 elem.id === m ) { 786 787 results.push( elem ); 788 return results; 789 } 790 } 791 792 // Type selector 793 } else if ( match[2] ) { 794 push.apply( results, context.getElementsByTagName( selector ) ); 795 return results; 796 797 // Class selector 798 } else if ( (m = match[3]) && support.getElementsByClassName && 799 context.getElementsByClassName ) { 800 801 push.apply( results, context.getElementsByClassName( m ) ); 802 return results; 803 } 804 } 805 806 // Take advantage of querySelectorAll 807 if ( support.qsa && 808 !nonnativeSelectorCache[ selector + " " ] && 809 (!rbuggyQSA || !rbuggyQSA.test( selector )) && 810 811 // Support: IE 8 only 812 // Exclude object elements 813 (nodeType !== 1 || context.nodeName.toLowerCase() !== "object") ) { 814 815 newSelector = selector; 816 newContext = context; 817 818 // qSA considers elements outside a scoping root when evaluating child or 819 // descendant combinators, which is not what we want. 820 // In such cases, we work around the behavior by prefixing every selector in the 821 // list with an ID selector referencing the scope context. 822 // Thanks to Andrew Dupont for this technique. 823 if ( nodeType === 1 && rdescend.test( selector ) ) { 824 825 // Capture the context ID, setting it first if necessary 826 if ( (nid = context.getAttribute( "id" )) ) { 827 nid = nid.replace( rcssescape, fcssescape ); 828 } else { 829 context.setAttribute( "id", (nid = expando) ); 830 } 831 832 // Prefix every selector in the list 833 groups = tokenize( selector ); 834 i = groups.length; 835 while ( i-- ) { 836 groups[i] = "#" + nid + " " + toSelector( groups[i] ); 837 } 838 newSelector = groups.join( "," ); 839 840 // Expand context for sibling selectors 841 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 842 context; 843 } 844 845 try { 846 push.apply( results, 847 newContext.querySelectorAll( newSelector ) 848 ); 849 return results; 850 } catch ( qsaError ) { 851 nonnativeSelectorCache( selector, true ); 852 } finally { 853 if ( nid === expando ) { 854 context.removeAttribute( "id" ); 855 } 856 } 857 } 858 } 859 } 860 861 // All others 862 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 863} 864 865/** 866 * Create key-value caches of limited size 867 * @returns {function(string, object)} Returns the Object data after storing it on itself with 868 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 869 * deleting the oldest entry 870 */ 871function createCache() { 872 var keys = []; 873 874 function cache( key, value ) { 875 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 876 if ( keys.push( key + " " ) > Expr.cacheLength ) { 877 // Only keep the most recent entries 878 delete cache[ keys.shift() ]; 879 } 880 return (cache[ key + " " ] = value); 881 } 882 return cache; 883} 884 885/** 886 * Mark a function for special use by Sizzle 887 * @param {Function} fn The function to mark 888 */ 889function markFunction( fn ) { 890 fn[ expando ] = true; 891 return fn; 892} 893 894/** 895 * Support testing using an element 896 * @param {Function} fn Passed the created element and returns a boolean result 897 */ 898function assert( fn ) { 899 var el = document.createElement("fieldset"); 900 901 try { 902 return !!fn( el ); 903 } catch (e) { 904 return false;
905 } finally { 906 // Remove from its parent by default 907 if ( el.parentNode ) { 908 el.parentNode.removeChild( el ); 909 } 910 // release memory in IE 911 el = null; 912 } 913} 914 915/** 916 * Adds the same handler for all of the specified attrs 917 * @param {String} attrs Pipe-separated list of attributes 918 * @param {Function} handler The method that will be applied 919 */ 920function addHandle( attrs, handler ) { 921 var arr = attrs.split("|"), 922 i = arr.length; 923 924 while ( i-- ) { 925 Expr.attrHandle[ arr[i] ] = handler; 926 } 927} 928 929/** 930 * Checks document order of two siblings 931 * @param {Element} a 932 * @param {Element} b 933 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 934 */ 935function siblingCheck( a, b ) { 936 var cur = b && a, 937 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 938 a.sourceIndex - b.sourceIndex; 939 940 // Use IE sourceIndex if available on both nodes 941 if ( diff ) { 942 return diff; 943 } 944 945 // Check if b follows a 946 if ( cur ) { 947 while ( (cur = cur.nextSibling) ) { 948 if ( cur === b ) { 949 return -1; 950 } 951 } 952 } 953 954 return a ? 1 : -1; 955} 956 957/** 958 * Returns a function to use in pseudos for input types 959 * @param {String} type 960 */ 961function createInputPseudo( type ) { 962 return function( elem ) { 963 var name = elem.nodeName.toLowerCase(); 964 return name === "input" && elem.type === type; 965 }; 966} 967 968/** 969 * Returns a function to use in pseudos for buttons 970 * @param {String} type 971 */ 972function createButtonPseudo( type ) { 973 return function( elem ) { 974 var name = elem.nodeName.toLowerCase(); 975 return (name === "input" || name === "button") && elem.type === type; 976 }; 977} 978 979/** 980 * Returns a function to use in pseudos for :enabled/:disabled 981 * @param {Boolean} disabled true for :disabled; false for :enabled 982 */ 983function createDisabledPseudo( disabled ) { 984 985 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 986 return function( elem ) { 987 988 // Only certain elements can match :enabled or :disabled 989 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 990 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 991 if ( "form" in elem ) { 992 993 // Check for inherited disabledness on relevant non-disabled elements: 994 // * listed form-associated elements in a disabled fieldset 995 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 996 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 997 // * option elements in a disabled optgroup 998 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 999 // All such elements have a "form" property. 1000 if ( elem.parentNode && elem.disabled === false ) { 1001 1002 // Option elements defer to a parent optgroup if present 1003 if ( "label" in elem ) { 1004 if ( "label" in elem.parentNode ) { 1005 return elem.parentNode.disabled === disabled; 1006 } else { 1007 return elem.disabled === disabled; 1008 } 1009 } 1010 1011 // Support: IE 6 - 11 1012 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 1013 return elem.isDisabled === disabled || 1014 1015 // Where there is no isDisabled, check manually 1016 /* jshint -W018 */ 1017 elem.isDisabled !== !disabled && 1018 inDisabledFieldset( elem ) === disabled; 1019 } 1020 1021 return elem.disabled === disabled; 1022 1023 // Try to winnow out elements that can't be disabled before trusting the disabled property. 1024 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 1025 // even exist on them, let alone have a boolean value. 1026 } else if ( "label" in elem ) { 1027 return elem.disabled === disabled; 1028 } 1029 1030 // Remaining elements are neither :enabled nor :disabled 1031 return false; 1032 }; 1033} 1034 1035/** 1036 * Returns a function to use in pseudos for positionals 1037 * @param {Function} fn 1038 */ 1039function createPositionalPseudo( fn ) { 1040 return markFunction(function( argument ) { 1041 argument = +argument; 1042 return markFunction(function( seed, matches ) { 1043 var j, 1044 matchIndexes = fn( [], seed.length, argument ), 1045 i = matchIndexes.length; 1046 1047 // Match elements found at the specified indexes 1048 while ( i-- ) { 1049 if ( seed[ (j = matchIndexes[i]) ] ) { 1050 seed[j] = !(matches[j] = seed[j]); 1051 } 1052 } 1053 }); 1054 }); 1055} 1056 1057/** 1058 * Checks a node for validity as a Sizzle context
1059 * @param {Element|Object=} context 1060 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 1061 */ 1062function testContext( context ) { 1063 return context && typeof context.getElementsByTagName !== "undefined" && context; 1064} 1065 1066// Expose support vars for convenience 1067support = Sizzle.support = {}; 1068 1069/** 1070 * Detects XML nodes 1071 * @param {Element|Object} elem An element or a document 1072 * @returns {Boolean} True iff elem is a non-HTML XML node 1073 */ 1074isXML = Sizzle.isXML = function( elem ) { 1075 var namespace = elem.namespaceURI, 1076 docElem = (elem.ownerDocument || elem).documentElement; 1077 1078 // Support: IE <=8 1079 // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes 1080 // https://bugs.jquery.com/ticket/4833 1081 return !rhtml.test( namespace || docElem && docElem.nodeName || "HTML" ); 1082}; 1083 1084/** 1085 * Sets document-related variables once based on the current document 1086 * @param {Element|Object} [doc] An element or document object to use to set the document 1087 * @returns {Object} Returns the current document 1088 */ 1089setDocument = Sizzle.setDocument = function( node ) { 1090 var hasCompare, subWindow, 1091 doc = node ? node.ownerDocument || node : preferredDoc; 1092 1093 // Return early if doc is invalid or already selected 1094 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { 1095 return document; 1096 } 1097 1098 // Update global variables 1099 document = doc; 1100 docElem = document.documentElement; 1101 documentIsHTML = !isXML( document ); 1102 1103 // Support: IE 9-11, Edge 1104 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) 1105 if ( preferredDoc !== document && 1106 (subWindow = document.defaultView) && subWindow.top !== subWindow ) { 1107 1108 // Support: IE 11, Edge 1109 if ( subWindow.addEventListener ) { 1110 subWindow.addEventListener( "unload", unloadHandler, false ); 1111 1112 // Support: IE 9 - 10 only 1113 } else if ( subWindow.attachEvent ) { 1114 subWindow.attachEvent( "onunload", unloadHandler ); 1115 } 1116 } 1117 1118 /* Attributes 1119 ---------------------------------------------------------------------- */ 1120 1121 // Support: IE<8 1122 // Verify that getAttribute really returns attributes and not properties 1123 // (excepting IE8 booleans) 1124 support.attributes = assert(function( el ) { 1125 el.className = "i"; 1126 return !el.getAttribute("className"); 1127 }); 1128 1129 /* getElement(s)By* 1130 ---------------------------------------------------------------------- */ 1131 1132 // Check if getElementsByTagName("*") returns only elements 1133 support.getElementsByTagName = assert(function( el ) { 1134 el.appendChild( document.createComment("") ); 1135 return !el.getElementsByTagName("*").length; 1136 }); 1137 1138 // Support: IE<9 1139 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); 1140 1141 // Support: IE<10 1142 // Check if getElementById returns elements by name 1143 // The broken getElementById methods don't pick up programmatically-set names, 1144 // so use a roundabout getElementsByName test 1145 support.getById = assert(function( el ) { 1146 docElem.appendChild( el ).id = expando; 1147 return !document.getElementsByName || !document.getElementsByName( expando ).length; 1148 }); 1149 1150 // ID filter and find 1151 if ( support.getById ) { 1152 Expr.filter["ID"] = function( id ) { 1153 var attrId = id.replace( runescape, funescape ); 1154 return function( elem ) { 1155 return elem.getAttribute("id") === attrId; 1156 }; 1157 }; 1158 Expr.find["ID"] = function( id, context ) { 1159 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1160 var elem = context.getElementById( id ); 1161 return elem ? [ elem ] : []; 1162 } 1163 }; 1164 } else { 1165 Expr.filter["ID"] = function( id ) { 1166 var attrId = id.replace( runescape, funescape ); 1167 return function( elem ) { 1168 var node = typeof elem.getAttributeNode !== "undefined" && 1169 elem.getAttributeNode("id"); 1170 return node && node.value === attrId; 1171 }; 1172 }; 1173 1174 // Support: IE 6 - 7 only 1175 // getElementById is not reliable as a find shortcut 1176 Expr.find["ID"] = function( id, context ) { 1177 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1178 var node, i, elems, 1179 elem = context.getElementById( id ); 1180 1181 if ( elem ) { 1182 1183 // Verify the id attribute 1184 node = elem.getAttributeNode("id"); 1185 if ( node && node.value === id ) { 1186 return [ elem ]; 1187 } 1188 1189 // Fall back on getElementsByName 1190 elems = context.getElementsByName( id ); 1191 i = 0; 1192 while ( (elem = elems[i++]) ) { 1193 node = elem.getAttributeNode("id"); 1194 if ( node && node.value === id ) { 1195 return [ elem ]; 1196 } 1197 } 1198 } 1199 1200 return []; 1201 } 1202 }; 1203 } 1204 1205 // Tag 1206 Expr.find["TAG"] = support.getElementsByTagName ? 1207 function( tag, context ) { 1208 if ( typeof context.getElementsByTagName !== "undefined" ) { 1209 return context.getElementsByTagName( tag ); 1210 1211 // DocumentFragment nodes don't have gEBTN 1212 } else if ( support.qsa ) { 1213 return context.querySelectorAll( tag ); 1214 } 1215 } : 1216 1217 function( tag, context ) { 1218 var elem, 1219 tmp = [], 1220 i = 0, 1221 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too 1222 results = context.getElementsByTagName( tag ); 1223 1224 // Filter out possible comments 1225 if ( tag === "*" ) { 1226 while ( (elem = results[i++]) ) { 1227 if ( elem.nodeType === 1 ) { 1228 tmp.push( elem ); 1229 } 1230 } 1231 1232 return tmp; 1233 } 1234 return results; 1235 }; 1236 1237 // Class 1238 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { 1239 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 1240 return context.getElementsByClassName( className ); 1241 } 1242 }; 1243 1244 /* QSA/matchesSelector 1245 ---------------------------------------------------------------------- */ 1246 1247 // QSA and matchesSelector support 1248 1249 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 1250 rbuggyMatches = []; 1251 1252 // qSa(:focus) reports false when true (Chrome 21) 1253 // We allow this because of a bug in IE8/9 that throws an error 1254 // whenever `document.activeElement` is accessed on an iframe 1255 // So, we allow :focus to pass through QSA all the time to avoid the IE error 1256 // See https://bugs.jquery.com/ticket/13378 1257 rbuggyQSA = []; 1258 1259 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { 1260 // Build QSA regex 1261 // Regex strategy adopted from Diego Perini 1262 assert(function( el ) { 1263 // Select is set to empty string on purpose 1264 // This is to test IE's treatment of not explicitly 1265 // setting a boolean content attribute, 1266 // since its presence should be enough 1267 // https://bugs.jquery.com/ticket/12359 1268 docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" + 1269 "<select id='" + expando + "-\r\\' msallowcapture=''>" + 1270 "<option selected=''></option></select>"; 1271
vendor: 7,317 bytes, lines 1272-1520
1272 // Support: IE8, Opera 11-12.16 1273 // Nothing should be selected when empty strings follow ^= or $= or *= 1274 // The test attribute must be unknown in Opera but "safe" for WinRT 1275 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 1276 if ( el.querySelectorAll("[msallowcapture^='']").length ) { 1277 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); 1278 } 1279 1280 // Support: IE8 1281 // Boolean attributes and "value" are not treated correctly 1282 if ( !el.querySelectorAll("[selected]").length ) { 1283 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 1284 } 1285 1286 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ 1287 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 1288 rbuggyQSA.push("~="); 1289 } 1290 1291 // Webkit/Opera - :checked should return selected option elements 1292 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1293 // IE8 throws error here and will not see later tests 1294 if ( !el.querySelectorAll(":checked").length ) { 1295 rbuggyQSA.push(":checked"); 1296 } 1297 1298 // Support: Safari 8+, iOS 8+ 1299 // https://bugs.webkit.org/show_bug.cgi?id=136851 1300 // In-page `selector#id sibling-combinator selector` fails 1301 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 1302 rbuggyQSA.push(".#.+[+~]"); 1303 } 1304 }); 1305 1306 assert(function( el ) { 1307 el.innerHTML = "<a href='' disabled='disabled'></a>" + 1308 "<select disabled='disabled'><option/></select>"; 1309 1310 // Support: Windows 8 Native Apps 1311 // The type and name attributes are restricted during .innerHTML assignment 1312 var input = document.createElement("input"); 1313 input.setAttribute( "type", "hidden" ); 1314 el.appendChild( input ).setAttribute( "name", "D" ); 1315 1316 // Support: IE8 1317 // Enforce case-sensitivity of name attribute 1318 if ( el.querySelectorAll("[name=d]").length ) { 1319 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); 1320 } 1321 1322 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 1323 // IE8 throws error here and will not see later tests 1324 if ( el.querySelectorAll(":enabled").length !== 2 ) { 1325 rbuggyQSA.push( ":enabled", ":disabled" ); 1326 } 1327 1328 // Support: IE9-11+ 1329 // IE's :disabled selector does not pick up the children of disabled fieldsets 1330 docElem.appendChild( el ).disabled = true; 1331 if ( el.querySelectorAll(":disabled").length !== 2 ) { 1332 rbuggyQSA.push( ":enabled", ":disabled" ); 1333 } 1334 1335 // Opera 10-11 does not throw on post-comma invalid pseudos 1336 el.querySelectorAll("*,:x"); 1337 rbuggyQSA.push(",.*:"); 1338 }); 1339 } 1340 1341 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || 1342 docElem.webkitMatchesSelector || 1343 docElem.mozMatchesSelector || 1344 docElem.oMatchesSelector || 1345 docElem.msMatchesSelector) )) ) { 1346 1347 assert(function( el ) { 1348 // Check to see if it's possible to do matchesSelector 1349 // on a disconnected node (IE 9) 1350 support.disconnectedMatch = matches.call( el, "*" ); 1351 1352 // This should fail with an exception 1353 // Gecko does not error, returns false instead 1354 matches.call( el, "[s!='']:x" ); 1355 rbuggyMatches.push( "!=", pseudos ); 1356 }); 1357 } 1358 1359 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); 1360 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); 1361 1362 /* Contains 1363 ---------------------------------------------------------------------- */ 1364 hasCompare = rnative.test( docElem.compareDocumentPosition ); 1365 1366 // Element contains another 1367 // Purposefully self-exclusive 1368 // As in, an element does not contain itself 1369 contains = hasCompare || rnative.test( docElem.contains ) ? 1370 function( a, b ) { 1371 var adown = a.nodeType === 9 ? a.documentElement : a, 1372 bup = b && b.parentNode; 1373 return a === bup || !!( bup && bup.nodeType === 1 && ( 1374 adown.contains ? 1375 adown.contains( bup ) : 1376 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 1377 )); 1378 } : 1379 function( a, b ) { 1380 if ( b ) { 1381 while ( (b = b.parentNode) ) { 1382 if ( b === a ) { 1383 return true; 1384 } 1385 } 1386 } 1387 return false; 1388 }; 1389 1390 /* Sorting 1391 ---------------------------------------------------------------------- */ 1392 1393 // Document order sorting 1394 sortOrder = hasCompare ? 1395 function( a, b ) { 1396 1397 // Flag for duplicate removal 1398 if ( a === b ) { 1399 hasDuplicate = true; 1400 return 0; 1401 } 1402 1403 // Sort on method existence if only one input has compareDocumentPosition 1404 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 1405 if ( compare ) { 1406 return compare; 1407 } 1408 1409 // Calculate position if both inputs belong to the same document 1410 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? 1411 a.compareDocumentPosition( b ) : 1412 1413 // Otherwise we know they are disconnected 1414 1; 1415 1416 // Disconnected nodes 1417 if ( compare & 1 || 1418 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { 1419 1420 // Choose the first element that is related to our preferred document 1421 if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { 1422 return -1; 1423 } 1424 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { 1425 return 1; 1426 } 1427 1428 // Maintain original order 1429 return sortInput ? 1430 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 1431 0; 1432 } 1433 1434 return compare & 4 ? -1 : 1; 1435 } : 1436 function( a, b ) { 1437 // Exit early if the nodes are identical 1438 if ( a === b ) { 1439 hasDuplicate = true; 1440 return 0; 1441 } 1442 1443 var cur, 1444 i = 0, 1445 aup = a.parentNode, 1446 bup = b.parentNode, 1447 ap = [ a ], 1448 bp = [ b ]; 1449 1450 // Parentless nodes are either documents or disconnected 1451 if ( !aup || !bup ) { 1452 return a === document ? -1 : 1453 b === document ? 1 : 1454 aup ? -1 : 1455 bup ? 1 : 1456 sortInput ? 1457 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 1458 0; 1459 1460 // If the nodes are siblings, we can do a quick check 1461 } else if ( aup === bup ) { 1462 return siblingCheck( a, b ); 1463 } 1464 1465 // Otherwise we need full lists of their ancestors for comparison 1466 cur = a; 1467 while ( (cur = cur.parentNode) ) { 1468 ap.unshift( cur ); 1469 } 1470 cur = b; 1471 while ( (cur = cur.parentNode) ) { 1472 bp.unshift( cur ); 1473 } 1474 1475 // Walk down the tree looking for a discrepancy 1476 while ( ap[i] === bp[i] ) { 1477 i++; 1478 } 1479 1480 return i ? 1481 // Do a sibling check if the nodes have a common ancestor 1482 siblingCheck( ap[i], bp[i] ) : 1483 1484 // Otherwise nodes in our document sort first 1485 ap[i] === preferredDoc ? -1 : 1486 bp[i] === preferredDoc ? 1 : 1487 0; 1488 }; 1489 1490 return document; 1491}; 1492 1493Sizzle.matches = function( expr, elements ) { 1494 return Sizzle( expr, null, null, elements ); 1495}; 1496 1497Sizzle.matchesSelector = function( elem, expr ) { 1498 // Set document vars if needed 1499 if ( ( elem.ownerDocument || elem ) !== document ) { 1500 setDocument( elem ); 1501 } 1502 1503 if ( support.matchesSelector && documentIsHTML && 1504 !nonnativeSelectorCache[ expr + " " ] && 1505 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 1506 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 1507 1508 try { 1509 var ret = matches.call( elem, expr ); 1510 1511 // IE 9's matchesSelector returns false on disconnected nodes 1512 if ( ret || support.disconnectedMatch || 1513 // As well, disconnected nodes are said to be in a document 1514 // fragment in IE 9 1515 elem.document && elem.document.nodeType !== 11 ) { 1516 return ret; 1517 } 1518 } catch (e) { 1519 nonnativeSelectorCache( expr, true ); 1520
vendor: 12,942 bytes, lines 1520-1979
1520} 1521 } 1522 1523 return Sizzle( expr, document, null, [ elem ] ).length > 0; 1524}; 1525 1526Sizzle.contains = function( context, elem ) { 1527 // Set document vars if needed 1528 if ( ( context.ownerDocument || context ) !== document ) { 1529 setDocument( context ); 1530 } 1531 return contains( context, elem ); 1532}; 1533 1534Sizzle.attr = function( elem, name ) { 1535 // Set document vars if needed 1536 if ( ( elem.ownerDocument || elem ) !== document ) { 1537 setDocument( elem ); 1538 } 1539 1540 var fn = Expr.attrHandle[ name.toLowerCase() ], 1541 // Don't get fooled by Object.prototype properties (jQuery #13807) 1542 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 1543 fn( elem, name, !documentIsHTML ) : 1544 undefined; 1545 1546 return val !== undefined ? 1547 val : 1548 support.attributes || !documentIsHTML ? 1549 elem.getAttribute( name ) : 1550 (val = elem.getAttributeNode(name)) && val.specified ? 1551 val.value : 1552 null; 1553}; 1554 1555Sizzle.escape = function( sel ) { 1556 return (sel + "").replace( rcssescape, fcssescape ); 1557}; 1558 1559Sizzle.error = function( msg ) { 1560 throw new Error( "Syntax error, unrecognized expression: " + msg ); 1561}; 1562 1563/** 1564 * Document sorting and removing duplicates 1565 * @param {ArrayLike} results 1566 */ 1567Sizzle.uniqueSort = function( results ) { 1568 var elem, 1569 duplicates = [], 1570 j = 0, 1571 i = 0; 1572 1573 // Unless we *know* we can detect duplicates, assume their presence 1574 hasDuplicate = !support.detectDuplicates; 1575 sortInput = !support.sortStable && results.slice( 0 ); 1576 results.sort( sortOrder ); 1577 1578 if ( hasDuplicate ) { 1579 while ( (elem = results[i++]) ) { 1580 if ( elem === results[ i ] ) { 1581 j = duplicates.push( i ); 1582 } 1583 } 1584 while ( j-- ) { 1585 results.splice( duplicates[ j ], 1 ); 1586 } 1587 } 1588 1589 // Clear input after sorting to release objects 1590 // See https://github.com/jquery/sizzle/pull/225 1591 sortInput = null; 1592 1593 return results; 1594}; 1595 1596/** 1597 * Utility function for retrieving the text value of an array of DOM nodes 1598 * @param {Array|Element} elem 1599 */ 1600getText = Sizzle.getText = function( elem ) { 1601 var node, 1602 ret = "", 1603 i = 0, 1604 nodeType = elem.nodeType; 1605 1606 if ( !nodeType ) { 1607 // If no nodeType, this is expected to be an array 1608 while ( (node = elem[i++]) ) { 1609 // Do not traverse comment nodes 1610 ret += getText( node ); 1611 } 1612 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 1613 // Use textContent for elements 1614 // innerText usage removed for consistency of new lines (jQuery #11153) 1615 if ( typeof elem.textContent === "string" ) { 1616 return elem.textContent; 1617 } else { 1618 // Traverse its children 1619 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 1620 ret += getText( elem ); 1621 } 1622 } 1623 } else if ( nodeType === 3 || nodeType === 4 ) { 1624 return elem.nodeValue; 1625 } 1626 // Do not include comment or processing instruction nodes 1627 1628 return ret; 1629}; 1630 1631Expr = Sizzle.selectors = { 1632 1633 // Can be adjusted by the user 1634 cacheLength: 50, 1635 1636 createPseudo: markFunction, 1637 1638 match: matchExpr, 1639 1640 attrHandle: {}, 1641 1642 find: {}, 1643 1644 relative: { 1645 ">": { dir: "parentNode", first: true }, 1646 " ": { dir: "parentNode" }, 1647 "+": { dir: "previousSibling", first: true }, 1648 "~": { dir: "previousSibling" } 1649 }, 1650 1651 preFilter: { 1652 "ATTR": function( match ) { 1653 match[1] = match[1].replace( runescape, funescape ); 1654 1655 // Move the given value to match[3] whether quoted or unquoted 1656 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); 1657 1658 if ( match[2] === "~=" ) { 1659 match[3] = " " + match[3] + " "; 1660 } 1661 1662 return match.slice( 0, 4 ); 1663 }, 1664 1665 "CHILD": function( match ) { 1666 /* matches from matchExpr["CHILD"] 1667 1 type (only|nth|...) 1668 2 what (child|of-type) 1669 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 1670 4 xn-component of xn+y argument ([+-]?\d*n|) 1671 5 sign of xn-component 1672 6 x of xn-component 1673 7 sign of y-component 1674 8 y of y-component 1675 */ 1676 match[1] = match[1].toLowerCase(); 1677 1678 if ( match[1].slice( 0, 3 ) === "nth" ) { 1679 // nth-* requires argument 1680 if ( !match[3] ) { 1681 Sizzle.error( match[0] ); 1682 } 1683 1684 // numeric x and y parameters for Expr.filter.CHILD 1685 // remember that false/true cast respectively to 0/1 1686 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); 1687 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); 1688 1689 // other types prohibit arguments 1690 } else if ( match[3] ) { 1691 Sizzle.error( match[0] ); 1692 } 1693 1694 return match; 1695 }, 1696 1697 "PSEUDO": function( match ) { 1698 var excess, 1699 unquoted = !match[6] && match[2]; 1700 1701 if ( matchExpr["CHILD"].test( match[0] ) ) { 1702 return null; 1703 } 1704 1705 // Accept quoted arguments as-is 1706 if ( match[3] ) { 1707 match[2] = match[4] || match[5] || ""; 1708 1709 // Strip excess characters from unquoted arguments 1710 } else if ( unquoted && rpseudo.test( unquoted ) && 1711 // Get excess from tokenize (recursively) 1712 (excess = tokenize( unquoted, true )) && 1713 // advance to the next closing parenthesis 1714 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { 1715 1716 // excess is a negative index 1717 match[0] = match[0].slice( 0, excess ); 1718 match[2] = unquoted.slice( 0, excess ); 1719 } 1720 1721 // Return only captures needed by the pseudo filter method (type and argument) 1722 return match.slice( 0, 3 ); 1723 } 1724 }, 1725 1726 filter: { 1727 1728 "TAG": function( nodeNameSelector ) { 1729 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 1730 return nodeNameSelector === "*" ? 1731 function() { return true; } : 1732 function( elem ) { 1733 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 1734 }; 1735 }, 1736 1737 "CLASS": function( className ) { 1738 var pattern = classCache[ className + " " ]; 1739 1740 return pattern || 1741 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && 1742 classCache( className, function( elem ) { 1743 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); 1744 }); 1745 }, 1746 1747 "ATTR": function( name, operator, check ) { 1748 return function( elem ) { 1749 var result = Sizzle.attr( elem, name ); 1750 1751 if ( result == null ) { 1752 return operator === "!="; 1753 } 1754 if ( !operator ) { 1755 return true; 1756 } 1757 1758 result += ""; 1759 1760 return operator === "=" ? result === check : 1761 operator === "!=" ? result !== check : 1762 operator === "^=" ? check && result.indexOf( check ) === 0 : 1763 operator === "*=" ? check && result.indexOf( check ) > -1 : 1764 operator === "$=" ? check && result.slice( -check.length ) === check : 1765 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : 1766 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : 1767 false; 1768 }; 1769 }, 1770 1771 "CHILD": function( type, what, argument, first, last ) { 1772 var simple = type.slice( 0, 3 ) !== "nth", 1773 forward = type.slice( -4 ) !== "last", 1774 ofType = what === "of-type"; 1775 1776 return first === 1 && last === 0 ? 1777 1778 // Shortcut for :nth-*(n) 1779 function( elem ) { 1780 return !!elem.parentNode; 1781 } : 1782 1783 function( elem, context, xml ) { 1784 var cache, uniqueCache, outerCache, node, nodeIndex, start, 1785 dir = simple !== forward ? "nextSibling" : "previousSibling", 1786 parent = elem.parentNode, 1787 name = ofType && elem.nodeName.toLowerCase(), 1788 useCache = !xml && !ofType, 1789 diff = false; 1790 1791 if ( parent ) { 1792 1793 // :(first|last|only)-(child|of-type) 1794 if ( simple ) { 1795 while ( dir ) { 1796 node = elem; 1797 while ( (node = node[ dir ]) ) { 1798 if ( ofType ? 1799 node.nodeName.toLowerCase() === name : 1800 node.nodeType === 1 ) { 1801 1802 return false; 1803 } 1804 } 1805 // Reverse direction for :only-* (if we haven't yet done so) 1806 start = dir = type === "only" && !start && "nextSibling"; 1807 } 1808 return true; 1809 } 1810 1811 start = [ forward ? parent.firstChild : parent.lastChild ]; 1812 1813 // non-xml :nth-child(...) stores cache data on `parent` 1814 if ( forward && useCache ) { 1815 1816 // Seek `elem` from a previously-cached index 1817 1818 // ...in a gzip-friendly way 1819 node = parent; 1820 outerCache = node[ expando ] || (node[ expando ] = {}); 1821 1822 // Support: IE <9 only 1823 // Defend against cloned attroperties (jQuery gh-1709) 1824 uniqueCache = outerCache[ node.uniqueID ] || 1825 (outerCache[ node.uniqueID ] = {}); 1826 1827 cache = uniqueCache[ type ] || []; 1828 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1829 diff = nodeIndex && cache[ 2 ]; 1830 node = nodeIndex && parent.childNodes[ nodeIndex ]; 1831 1832 while ( (node = ++nodeIndex && node && node[ dir ] || 1833 1834 // Fallback to seeking `elem` from the start 1835 (diff = nodeIndex = 0) || start.pop()) ) { 1836 1837 // When found, cache indexes on `parent` and break 1838 if ( node.nodeType === 1 && ++diff && node === elem ) { 1839 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; 1840 break; 1841 } 1842 } 1843 1844 } else { 1845 // Use previously-cached element index if available 1846 if ( useCache ) { 1847 // ...in a gzip-friendly way 1848 node = elem; 1849 outerCache = node[ expando ] || (node[ expando ] = {}); 1850 1851 // Support: IE <9 only 1852 // Defend against cloned attroperties (jQuery gh-1709) 1853 uniqueCache = outerCache[ node.uniqueID ] || 1854 (outerCache[ node.uniqueID ] = {}); 1855 1856 cache = uniqueCache[ type ] || []; 1857 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1858 diff = nodeIndex; 1859 } 1860 1861 // xml :nth-child(...) 1862 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 1863 if ( diff === false ) { 1864 // Use the same loop as above to seek `elem` from the start 1865 while ( (node = ++nodeIndex && node && node[ dir ] || 1866 (diff = nodeIndex = 0) || start.pop()) ) { 1867 1868 if ( ( ofType ? 1869 node.nodeName.toLowerCase() === name : 1870 node.nodeType === 1 ) && 1871 ++diff ) { 1872 1873 // Cache the index of each encountered element 1874 if ( useCache ) { 1875 outerCache = node[ expando ] || (node[ expando ] = {}); 1876 1877 // Support: IE <9 only 1878 // Defend against cloned attroperties (jQuery gh-1709) 1879 uniqueCache = outerCache[ node.uniqueID ] || 1880 (outerCache[ node.uniqueID ] = {}); 1881 1882 uniqueCache[ type ] = [ dirruns, diff ]; 1883 } 1884 1885 if ( node === elem ) { 1886 break; 1887 } 1888 } 1889 } 1890 } 1891 } 1892 1893 // Incorporate the offset, then check against cycle size 1894 diff -= last; 1895 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 1896 } 1897 }; 1898 }, 1899 1900 "PSEUDO": function( pseudo, argument ) { 1901 // pseudo-class names are case-insensitive 1902 // http://www.w3.org/TR/selectors/#pseudo-classes 1903 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 1904 // Remember that setFilters inherits from pseudos 1905 var args, 1906 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 1907 Sizzle.error( "unsupported pseudo: " + pseudo ); 1908 1909 // The user may use createPseudo to indicate that 1910 // arguments are needed to create the filter function 1911 // just as Sizzle does 1912 if ( fn[ expando ] ) { 1913 return fn( argument ); 1914 } 1915 1916 // But maintain support for old signatures 1917 if ( fn.length > 1 ) { 1918 args = [ pseudo, pseudo, "", argument ]; 1919 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 1920 markFunction(function( seed, matches ) { 1921 var idx, 1922 matched = fn( seed, argument ), 1923 i = matched.length; 1924 while ( i-- ) { 1925 idx = indexOf( seed, matched[i] ); 1926 seed[ idx ] = !( matches[ idx ] = matched[i] ); 1927 } 1928 }) : 1929 function( elem ) { 1930 return fn( elem, 0, args ); 1931 }; 1932 } 1933 1934 return fn; 1935 } 1936 }, 1937 1938 pseudos: { 1939 // Potentially complex pseudos 1940 "not": markFunction(function( selector ) { 1941 // Trim the selector passed to compile 1942 // to avoid treating leading and trailing 1943 // spaces as combinators 1944 var input = [], 1945 results = [], 1946 matcher = compile( selector.replace( rtrim, "$1" ) ); 1947 1948 return matcher[ expando ] ? 1949 markFunction(function( seed, matches, context, xml ) { 1950 var elem, 1951 unmatched = matcher( seed, null, xml, [] ), 1952 i = seed.length; 1953 1954 // Match elements unmatched by `matcher` 1955 while ( i-- ) { 1956 if ( (elem = unmatched[i]) ) { 1957 seed[i] = !(matches[i] = elem); 1958 } 1959 } 1960 }) : 1961 function( elem, context, xml ) { 1962 input[0] = elem; 1963 matcher( input, null, xml, results ); 1964 // Don't keep the element (issue #299) 1965 input[0] = null; 1966 return !results.pop(); 1967 }; 1968 }), 1969 1970 "has": markFunction(function( selector ) { 1971 return function( elem ) { 1972 return Sizzle( selector, elem ).length > 0; 1973 }; 1974 }), 1975 1976 "contains": markFunction(function( text ) { 1977 text = text.replace( runescape, funescape ); 1978 return function( elem ) { 1979 return ( elem.textContent ||
vendor: 25,129 bytes, lines 1979-2883
1979getText( elem ) ).indexOf( text ) > -1; 1980 }; 1981 }), 1982 1983 // "Whether an element is represented by a :lang() selector 1984 // is based solely on the element's language value 1985 // being equal to the identifier C, 1986 // or beginning with the identifier C immediately followed by "-". 1987 // The matching of C against the element's language value is performed case-insensitively. 1988 // The identifier C does not have to be a valid language name." 1989 // http://www.w3.org/TR/selectors/#lang-pseudo 1990 "lang": markFunction( function( lang ) { 1991 // lang value must be a valid identifier 1992 if ( !ridentifier.test(lang || "") ) { 1993 Sizzle.error( "unsupported lang: " + lang ); 1994 } 1995 lang = lang.replace( runescape, funescape ).toLowerCase(); 1996 return function( elem ) { 1997 var elemLang; 1998 do { 1999 if ( (elemLang = documentIsHTML ? 2000 elem.lang : 2001 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { 2002 2003 elemLang = elemLang.toLowerCase(); 2004 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 2005 } 2006 } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); 2007 return false; 2008 }; 2009 }), 2010 2011 // Miscellaneous 2012 "target": function( elem ) { 2013 var hash = window.location && window.location.hash; 2014 return hash && hash.slice( 1 ) === elem.id; 2015 }, 2016 2017 "root": function( elem ) { 2018 return elem === docElem; 2019 }, 2020 2021 "focus": function( elem ) { 2022 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); 2023 }, 2024 2025 // Boolean properties 2026 "enabled": createDisabledPseudo( false ), 2027 "disabled": createDisabledPseudo( true ), 2028 2029 "checked": function( elem ) { 2030 // In CSS3, :checked should return both checked and selected elements 2031 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 2032 var nodeName = elem.nodeName.toLowerCase(); 2033 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); 2034 }, 2035 2036 "selected": function( elem ) { 2037 // Accessing this property makes selected-by-default 2038 // options in Safari work properly 2039 if ( elem.parentNode ) { 2040 elem.parentNode.selectedIndex; 2041 } 2042 2043 return elem.selected === true; 2044 }, 2045 2046 // Contents 2047 "empty": function( elem ) { 2048 // http://www.w3.org/TR/selectors/#empty-pseudo 2049 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 2050 // but not by others (comment: 8; processing instruction: 7; etc.) 2051 // nodeType < 6 works because attributes (2) do not appear as children 2052 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 2053 if ( elem.nodeType < 6 ) { 2054 return false; 2055 } 2056 } 2057 return true; 2058 }, 2059 2060 "parent": function( elem ) { 2061 return !Expr.pseudos["empty"]( elem ); 2062 }, 2063 2064 // Element/input types 2065 "header": function( elem ) { 2066 return rheader.test( elem.nodeName ); 2067 }, 2068 2069 "input": function( elem ) { 2070 return rinputs.test( elem.nodeName ); 2071 }, 2072 2073 "button": function( elem ) { 2074 var name = elem.nodeName.toLowerCase(); 2075 return name === "input" && elem.type === "button" || name === "button"; 2076 }, 2077 2078 "text": function( elem ) { 2079 var attr; 2080 return elem.nodeName.toLowerCase() === "input" && 2081 elem.type === "text" && 2082 2083 // Support: IE<8 2084 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 2085 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); 2086 }, 2087 2088 // Position-in-collection 2089 "first": createPositionalPseudo(function() { 2090 return [ 0 ]; 2091 }), 2092 2093 "last": createPositionalPseudo(function( matchIndexes, length ) { 2094 return [ length - 1 ]; 2095 }), 2096 2097 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { 2098 return [ argument < 0 ? argument + length : argument ]; 2099 }), 2100 2101 "even": createPositionalPseudo(function( matchIndexes, length ) { 2102 var i = 0; 2103 for ( ; i < length; i += 2 ) { 2104 matchIndexes.push( i ); 2105 } 2106 return matchIndexes; 2107 }), 2108 2109 "odd": createPositionalPseudo(function( matchIndexes, length ) { 2110 var i = 1; 2111 for ( ; i < length; i += 2 ) { 2112 matchIndexes.push( i ); 2113 } 2114 return matchIndexes; 2115 }), 2116 2117 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { 2118 var i = argument < 0 ? 2119 argument + length : 2120 argument > length ? 2121 length : 2122 argument; 2123 for ( ; --i >= 0; ) { 2124 matchIndexes.push( i ); 2125 } 2126 return matchIndexes; 2127 }), 2128 2129 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { 2130 var i = argument < 0 ? argument + length : argument; 2131 for ( ; ++i < length; ) { 2132 matchIndexes.push( i ); 2133 } 2134 return matchIndexes; 2135 }) 2136 } 2137}; 2138 2139Expr.pseudos["nth"] = Expr.pseudos["eq"]; 2140 2141// Add button/input type pseudos 2142for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 2143 Expr.pseudos[ i ] = createInputPseudo( i ); 2144} 2145for ( i in { submit: true, reset: true } ) { 2146 Expr.pseudos[ i ] = createButtonPseudo( i ); 2147} 2148 2149// Easy API for creating new setFilters 2150function setFilters() {} 2151setFilters.prototype = Expr.filters = Expr.pseudos; 2152Expr.setFilters = new setFilters(); 2153 2154tokenize = Sizzle.tokenize = function( selector, parseOnly ) { 2155 var matched, match, tokens, type, 2156 soFar, groups, preFilters, 2157 cached = tokenCache[ selector + " " ]; 2158 2159 if ( cached ) { 2160 return parseOnly ? 0 : cached.slice( 0 ); 2161 } 2162 2163 soFar = selector; 2164 groups = []; 2165 preFilters = Expr.preFilter; 2166 2167 while ( soFar ) { 2168 2169 // Comma and first run 2170 if ( !matched || (match = rcomma.exec( soFar )) ) { 2171 if ( match ) { 2172 // Don't consume trailing commas as valid 2173 soFar = soFar.slice( match[0].length ) || soFar; 2174 } 2175 groups.push( (tokens = []) ); 2176 } 2177 2178 matched = false; 2179 2180 // Combinators 2181 if ( (match = rcombinators.exec( soFar )) ) { 2182 matched = match.shift(); 2183 tokens.push({ 2184 value: matched, 2185 // Cast descendant combinators to space 2186 type: match[0].replace( rtrim, " " ) 2187 }); 2188 soFar = soFar.slice( matched.length ); 2189 } 2190 2191 // Filters 2192 for ( type in Expr.filter ) { 2193 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || 2194 (match = preFilters[ type ]( match ))) ) { 2195 matched = match.shift(); 2196 tokens.push({ 2197 value: matched, 2198 type: type, 2199 matches: match 2200 }); 2201 soFar = soFar.slice( matched.length ); 2202 } 2203 } 2204 2205 if ( !matched ) { 2206 break; 2207 } 2208 } 2209 2210 // Return the length of the invalid excess 2211 // if we're just parsing 2212 // Otherwise, throw an error or return tokens 2213 return parseOnly ? 2214 soFar.length : 2215 soFar ? 2216 Sizzle.error( selector ) : 2217 // Cache the tokens 2218 tokenCache( selector, groups ).slice( 0 ); 2219}; 2220 2221function toSelector( tokens ) { 2222 var i = 0, 2223 len = tokens.length, 2224 selector = ""; 2225 for ( ; i < len; i++ ) { 2226 selector += tokens[i].value; 2227 } 2228 return selector; 2229} 2230 2231function addCombinator( matcher, combinator, base ) { 2232 var dir = combinator.dir, 2233 skip = combinator.next, 2234 key = skip || dir, 2235 checkNonElements = base && key === "parentNode", 2236 doneName = done++; 2237 2238 return combinator.first ? 2239 // Check against closest ancestor/preceding element 2240 function( elem, context, xml ) { 2241 while ( (elem = elem[ dir ]) ) { 2242 if ( elem.nodeType === 1 || checkNonElements ) { 2243 return matcher( elem, context, xml ); 2244 } 2245 } 2246 return false; 2247 } : 2248 2249 // Check against all ancestor/preceding elements 2250 function( elem, context, xml ) { 2251 var oldCache, uniqueCache, outerCache, 2252 newCache = [ dirruns, doneName ]; 2253 2254 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 2255 if ( xml ) { 2256 while ( (elem = elem[ dir ]) ) { 2257 if ( elem.nodeType === 1 || checkNonElements ) { 2258 if ( matcher( elem, context, xml ) ) { 2259 return true; 2260 } 2261 } 2262 } 2263 } else { 2264 while ( (elem = elem[ dir ]) ) { 2265 if ( elem.nodeType === 1 || checkNonElements ) { 2266 outerCache = elem[ expando ] || (elem[ expando ] = {}); 2267 2268 // Support: IE <9 only 2269 // Defend against cloned attroperties (jQuery gh-1709) 2270 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); 2271 2272 if ( skip && skip === elem.nodeName.toLowerCase() ) { 2273 elem = elem[ dir ] || elem; 2274 } else if ( (oldCache = uniqueCache[ key ]) && 2275 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 2276 2277 // Assign to newCache so results back-propagate to previous elements 2278 return (newCache[ 2 ] = oldCache[ 2 ]); 2279 } else { 2280 // Reuse newcache so results back-propagate to previous elements 2281 uniqueCache[ key ] = newCache; 2282 2283 // A match means we're done; a fail means we have to keep checking 2284 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { 2285 return true; 2286 } 2287 } 2288 } 2289 } 2290 } 2291 return false; 2292 }; 2293} 2294 2295function elementMatcher( matchers ) { 2296 return matchers.length > 1 ? 2297 function( elem, context, xml ) { 2298 var i = matchers.length; 2299 while ( i-- ) { 2300 if ( !matchers[i]( elem, context, xml ) ) { 2301 return false; 2302 } 2303 } 2304 return true; 2305 } : 2306 matchers[0]; 2307} 2308 2309function multipleContexts( selector, contexts, results ) { 2310 var i = 0, 2311 len = contexts.length; 2312 for ( ; i < len; i++ ) { 2313 Sizzle( selector, contexts[i], results ); 2314 } 2315 return results; 2316} 2317 2318function condense( unmatched, map, filter, context, xml ) { 2319 var elem, 2320 newUnmatched = [], 2321 i = 0, 2322 len = unmatched.length, 2323 mapped = map != null; 2324 2325 for ( ; i < len; i++ ) { 2326 if ( (elem = unmatched[i]) ) { 2327 if ( !filter || filter( elem, context, xml ) ) { 2328 newUnmatched.push( elem ); 2329 if ( mapped ) { 2330 map.push( i ); 2331 } 2332 } 2333 } 2334 } 2335 2336 return newUnmatched; 2337} 2338 2339function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 2340 if ( postFilter && !postFilter[ expando ] ) { 2341 postFilter = setMatcher( postFilter ); 2342 } 2343 if ( postFinder && !postFinder[ expando ] ) { 2344 postFinder = setMatcher( postFinder, postSelector ); 2345 } 2346 return markFunction(function( seed, results, context, xml ) { 2347 var temp, i, elem, 2348 preMap = [], 2349 postMap = [], 2350 preexisting = results.length, 2351 2352 // Get initial elements from seed or context 2353 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), 2354 2355 // Prefilter to get matcher input, preserving a map for seed-results synchronization 2356 matcherIn = preFilter && ( seed || !selector ) ? 2357 condense( elems, preMap, preFilter, context, xml ) : 2358 elems, 2359 2360 matcherOut = matcher ? 2361 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 2362 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 2363 2364 // ...intermediate processing is necessary 2365 [] : 2366 2367 // ...otherwise use results directly 2368 results : 2369 matcherIn; 2370 2371 // Find primary matches 2372 if ( matcher ) { 2373 matcher( matcherIn, matcherOut, context, xml ); 2374 } 2375 2376 // Apply postFilter 2377 if ( postFilter ) { 2378 temp = condense( matcherOut, postMap ); 2379 postFilter( temp, [], context, xml ); 2380 2381 // Un-match failing elements by moving them back to matcherIn 2382 i = temp.length; 2383 while ( i-- ) { 2384 if ( (elem = temp[i]) ) { 2385 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); 2386 } 2387 } 2388 } 2389 2390 if ( seed ) { 2391 if ( postFinder || preFilter ) { 2392 if ( postFinder ) { 2393 // Get the final matcherOut by condensing this intermediate into postFinder contexts 2394 temp = []; 2395 i = matcherOut.length; 2396 while ( i-- ) { 2397 if ( (elem = matcherOut[i]) ) { 2398 // Restore matcherIn since elem is not yet a final match 2399 temp.push( (matcherIn[i] = elem) ); 2400 } 2401 } 2402 postFinder( null, (matcherOut = []), temp, xml ); 2403 } 2404 2405 // Move matched elements from seed to results to keep them synchronized 2406 i = matcherOut.length; 2407 while ( i-- ) { 2408 if ( (elem = matcherOut[i]) && 2409 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { 2410 2411 seed[temp] = !(results[temp] = elem); 2412 } 2413 } 2414 } 2415 2416 // Add elements to results, through postFinder if defined 2417 } else { 2418 matcherOut = condense( 2419 matcherOut === results ? 2420 matcherOut.splice( preexisting, matcherOut.length ) : 2421 matcherOut 2422 ); 2423 if ( postFinder ) { 2424 postFinder( null, results, matcherOut, xml ); 2425 } else { 2426 push.apply( results, matcherOut ); 2427 } 2428 } 2429 }); 2430} 2431 2432function matcherFromTokens( tokens ) { 2433 var checkContext, matcher, j, 2434 len = tokens.length, 2435 leadingRelative = Expr.relative[ tokens[0].type ], 2436 implicitRelative = leadingRelative || Expr.relative[" "], 2437 i = leadingRelative ? 1 : 0, 2438 2439 // The foundational matcher ensures that elements are reachable from top-level context(s) 2440 matchContext = addCombinator( function( elem ) { 2441 return elem === checkContext; 2442 }, implicitRelative, true ), 2443 matchAnyContext = addCombinator( function( elem ) { 2444 return indexOf( checkContext, elem ) > -1; 2445 }, implicitRelative, true ), 2446 matchers = [ function( elem, context, xml ) { 2447 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 2448 (checkContext = context).nodeType ? 2449 matchContext( elem, context, xml ) : 2450 matchAnyContext( elem, context, xml ) ); 2451 // Avoid hanging onto element (issue #299) 2452 checkContext = null; 2453 return ret; 2454 } ]; 2455 2456 for ( ; i < len; i++ ) { 2457 if ( (matcher = Expr.relative[ tokens[i].type ]) ) { 2458 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; 2459 } else { 2460 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); 2461 2462 // Return special upon seeing a positional matcher 2463 if ( matcher[ expando ] ) { 2464 // Find the next relative operator (if any) for proper handling 2465 j = ++i; 2466 for ( ; j < len; j++ ) { 2467 if ( Expr.relative[ tokens[j].type ] ) { 2468 break; 2469 } 2470 } 2471 return setMatcher( 2472 i > 1 && elementMatcher( matchers ), 2473 i > 1 && toSelector( 2474 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 2475 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) 2476 ).replace( rtrim, "$1" ), 2477 matcher, 2478 i < j && matcherFromTokens( tokens.slice( i, j ) ), 2479 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), 2480 j < len && toSelector( tokens ) 2481 ); 2482 } 2483 matchers.push( matcher ); 2484 } 2485 } 2486 2487 return elementMatcher( matchers ); 2488} 2489 2490function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 2491 var bySet = setMatchers.length > 0, 2492 byElement = elementMatchers.length > 0, 2493 superMatcher = function( seed, context, xml, results, outermost ) { 2494 var elem, j, matcher, 2495 matchedCount = 0, 2496 i = "0", 2497 unmatched = seed && [], 2498 setMatched = [], 2499 contextBackup = outermostContext, 2500 // We must always have either seed elements or outermost context 2501 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), 2502 // Use integer dirruns iff this is the outermost matcher 2503 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), 2504 len = elems.length; 2505 2506 if ( outermost ) { 2507 outermostContext = context === document || context || outermost; 2508 } 2509 2510 // Add elements passing elementMatchers directly to results 2511 // Support: IE<9, Safari 2512 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 2513 for ( ; i !== len && (elem = elems[i]) != null; i++ ) { 2514 if ( byElement && elem ) { 2515 j = 0; 2516 if ( !context && elem.ownerDocument !== document ) { 2517 setDocument( elem ); 2518 xml = !documentIsHTML; 2519 } 2520 while ( (matcher = elementMatchers[j++]) ) { 2521 if ( matcher( elem, context || document, xml) ) { 2522 results.push( elem ); 2523 break; 2524 } 2525 } 2526 if ( outermost ) { 2527 dirruns = dirrunsUnique; 2528 } 2529 } 2530 2531 // Track unmatched elements for set filters 2532 if ( bySet ) { 2533 // They will have gone through all possible matchers 2534 if ( (elem = !matcher && elem) ) { 2535 matchedCount--; 2536 } 2537 2538 // Lengthen the array for every element, matched or not 2539 if ( seed ) { 2540 unmatched.push( elem ); 2541 } 2542 } 2543 } 2544 2545 // `i` is now the count of elements visited above, and adding it to `matchedCount` 2546 // makes the latter nonnegative. 2547 matchedCount += i; 2548 2549 // Apply set filters to unmatched elements 2550 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 2551 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 2552 // no element matchers and no seed. 2553 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 2554 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 2555 // numerically zero. 2556 if ( bySet && i !== matchedCount ) { 2557 j = 0; 2558 while ( (matcher = setMatchers[j++]) ) { 2559 matcher( unmatched, setMatched, context, xml ); 2560 } 2561 2562 if ( seed ) { 2563 // Reintegrate element matches to eliminate the need for sorting 2564 if ( matchedCount > 0 ) { 2565 while ( i-- ) { 2566 if ( !(unmatched[i] || setMatched[i]) ) { 2567 setMatched[i] = pop.call( results ); 2568 } 2569 } 2570 } 2571 2572 // Discard index placeholder values to get only actual matches 2573 setMatched = condense( setMatched ); 2574 } 2575 2576 // Add matches to results 2577 push.apply( results, setMatched ); 2578 2579 // Seedless set matches succeeding multiple successful matchers stipulate sorting 2580 if ( outermost && !seed && setMatched.length > 0 && 2581 ( matchedCount + setMatchers.length ) > 1 ) { 2582 2583 Sizzle.uniqueSort( results ); 2584 } 2585 } 2586 2587 // Override manipulation of globals by nested matchers 2588 if ( outermost ) { 2589 dirruns = dirrunsUnique; 2590 outermostContext = contextBackup; 2591 } 2592 2593 return unmatched; 2594 }; 2595 2596 return bySet ? 2597 markFunction( superMatcher ) : 2598 superMatcher; 2599} 2600 2601compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 2602 var i, 2603 setMatchers = [], 2604 elementMatchers = [], 2605 cached = compilerCache[ selector + " " ]; 2606 2607 if ( !cached ) { 2608 // Generate a function of recursive functions that can be used to check each element 2609 if ( !match ) { 2610 match = tokenize( selector ); 2611 } 2612 i = match.length; 2613 while ( i-- ) { 2614 cached = matcherFromTokens( match[i] ); 2615 if ( cached[ expando ] ) { 2616 setMatchers.push( cached ); 2617 } else { 2618 elementMatchers.push( cached ); 2619 } 2620 } 2621 2622 // Cache the compiled function 2623 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 2624 2625 // Save selector and tokenization 2626 cached.selector = selector; 2627 } 2628 return cached; 2629}; 2630 2631/** 2632 * A low-level selection function that works with Sizzle's compiled 2633 * selector functions 2634 * @param {String|Function} selector A selector or a pre-compiled 2635 * selector function built with Sizzle.compile 2636 * @param {Element} context 2637 * @param {Array} [results] 2638 * @param {Array} [seed] A set of elements to match against 2639 */ 2640select = Sizzle.select = function( selector, context, results, seed ) { 2641 var i, tokens, token, type, find, 2642 compiled = typeof selector === "function" && selector, 2643 match = !seed && tokenize( (selector = compiled.selector || selector) ); 2644 2645 results = results || []; 2646 2647 // Try to minimize operations if there is only one selector in the list and no seed 2648 // (the latter of which guarantees us context) 2649 if ( match.length === 1 ) { 2650 2651 // Reduce context if the leading compound selector is an ID 2652 tokens = match[0] = match[0].slice( 0 ); 2653 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && 2654 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) { 2655 2656 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; 2657 if ( !context ) { 2658 return results; 2659 2660 // Precompiled matchers will still verify ancestry, so step up a level 2661 } else if ( compiled ) { 2662 context = context.parentNode; 2663 } 2664 2665 selector = selector.slice( tokens.shift().value.length ); 2666 } 2667 2668 // Fetch a seed set for right-to-left matching 2669 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; 2670 while ( i-- ) { 2671 token = tokens[i]; 2672 2673 // Abort if we hit a combinator 2674 if ( Expr.relative[ (type = token.type) ] ) { 2675 break; 2676 } 2677 if ( (find = Expr.find[ type ]) ) { 2678 // Search, expanding context for leading sibling combinators 2679 if ( (seed = find( 2680 token.matches[0].replace( runescape, funescape ), 2681 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context 2682 )) ) { 2683 2684 // If seed is empty or no tokens remain, we can return early 2685 tokens.splice( i, 1 ); 2686 selector = seed.length && toSelector( tokens ); 2687 if ( !selector ) { 2688 push.apply( results, seed ); 2689 return results; 2690 } 2691 2692 break; 2693 } 2694 } 2695 } 2696 } 2697 2698 // Compile and execute a filtering function if one is not provided 2699 // Provide `match` to avoid retokenization if we modified the selector above 2700 ( compiled || compile( selector, match ) )( 2701 seed, 2702 context, 2703 !documentIsHTML, 2704 results, 2705 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 2706 ); 2707 return results; 2708}; 2709 2710// One-time assignments 2711 2712// Sort stability 2713support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; 2714 2715// Support: Chrome 14-35+ 2716// Always assume duplicates if they aren't passed to the comparison function 2717support.detectDuplicates = !!hasDuplicate; 2718 2719// Initialize against the default document 2720setDocument(); 2721 2722// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 2723// Detached nodes confoundingly follow *each other* 2724support.sortDetached = assert(function( el ) { 2725 // Should return 1, but returns 4 (following) 2726 return el.compareDocumentPosition( document.createElement("fieldset") ) & 1; 2727}); 2728 2729// Support: IE<8 2730// Prevent attribute/property "interpolation" 2731// https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 2732if ( !assert(function( el ) { 2733 el.innerHTML = "<a href='#'></a>"; 2734 return el.firstChild.getAttribute("href") === "#" ; 2735}) ) { 2736 addHandle( "type|href|height|width", function( elem, name, isXML ) { 2737 if ( !isXML ) { 2738 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); 2739 } 2740 }); 2741} 2742 2743// Support: IE<9 2744// Use defaultValue in place of getAttribute("value") 2745if ( !support.attributes || !assert(function( el ) { 2746 el.innerHTML = "<input/>"; 2747 el.firstChild.setAttribute( "value", "" ); 2748 return el.firstChild.getAttribute( "value" ) === ""; 2749}) ) { 2750 addHandle( "value", function( elem, name, isXML ) { 2751 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { 2752 return elem.defaultValue; 2753 } 2754 }); 2755} 2756 2757// Support: IE<9 2758// Use getAttributeNode to fetch booleans when getAttribute lies 2759if ( !assert(function( el ) { 2760 return el.getAttribute("disabled") == null; 2761}) ) { 2762 addHandle( booleans, function( elem, name, isXML ) { 2763 var val; 2764 if ( !isXML ) { 2765 return elem[ name ] === true ? name.toLowerCase() : 2766 (val = elem.getAttributeNode( name )) && val.specified ? 2767 val.value : 2768 null; 2769 } 2770 }); 2771} 2772 2773return Sizzle; 2774 2775})( window ); 2776 2777 2778 2779jQuery.find = Sizzle; 2780jQuery.expr = Sizzle.selectors; 2781 2782// Deprecated 2783jQuery.expr[ ":" ] = jQuery.expr.pseudos; 2784jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 2785jQuery.text = Sizzle.getText; 2786jQuery.isXMLDoc = Sizzle.isXML; 2787jQuery.contains = Sizzle.contains; 2788jQuery.escapeSelector = Sizzle.escape; 2789 2790 2791 2792 2793var dir = function( elem, dir, until ) { 2794 var matched = [], 2795 truncate = until !== undefined; 2796 2797 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 2798 if ( elem.nodeType === 1 ) { 2799 if ( truncate && jQuery( elem ).is( until ) ) { 2800 break; 2801 } 2802 matched.push( elem ); 2803 } 2804 } 2805 return matched; 2806}; 2807 2808 2809var siblings = function( n, elem ) { 2810 var matched = []; 2811 2812 for ( ; n; n = n.nextSibling ) { 2813 if ( n.nodeType === 1 && n !== elem ) { 2814 matched.push( n ); 2815 } 2816 } 2817 2818 return matched; 2819}; 2820 2821 2822var rneedsContext = jQuery.expr.match.needsContext; 2823 2824 2825 2826function nodeName( elem, name ) { 2827 2828 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 2829 2830}; 2831var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 2832 2833 2834 2835// Implement the identical functionality for filter and not 2836function winnow( elements, qualifier, not ) { 2837 if ( isFunction( qualifier ) ) { 2838 return jQuery.grep( elements, function( elem, i ) { 2839 return !!qualifier.call( elem, i, elem ) !== not; 2840 } ); 2841 } 2842 2843 // Single element 2844 if ( qualifier.nodeType ) { 2845 return jQuery.grep( elements, function( elem ) { 2846 return ( elem === qualifier ) !== not; 2847 } ); 2848 } 2849 2850 // Arraylike of elements (jQuery, arguments, Array) 2851 if ( typeof qualifier !== "string" ) { 2852 return jQuery.grep( elements, function( elem ) { 2853 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 2854 } ); 2855 } 2856 2857 // Filtered directly for both simple and complex selectors 2858 return jQuery.filter( qualifier, elements, not ); 2859} 2860 2861jQuery.filter = function( expr, elems, not ) { 2862 var elem = elems[ 0 ]; 2863 2864 if ( not ) { 2865 expr = ":not(" + expr + ")"; 2866 } 2867 2868 if ( elems.length === 1 && elem.nodeType === 1 ) { 2869 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 2870 } 2871 2872 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 2873 return elem.nodeType === 1; 2874 } ) ); 2875}; 2876 2877jQuery.fn.extend( { 2878 find: function( selector ) { 2879 var i, ret, 2880 len = this.length, 2881 self = this; 2882 2883 if ( typeof selector !== "string" ) {
vendor: 4,662 bytes, lines 2884-3069
2884 return this.pushStack( jQuery( selector ).filter( function() { 2885 for ( i = 0; i < len; i++ ) { 2886 if ( jQuery.contains( self[ i ], this ) ) { 2887 return true; 2888 } 2889 } 2890 } ) ); 2891 } 2892 2893 ret = this.pushStack( [] ); 2894 2895 for ( i = 0; i < len; i++ ) { 2896 jQuery.find( selector, self[ i ], ret ); 2897 } 2898 2899 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 2900 }, 2901 filter: function( selector ) { 2902 return this.pushStack( winnow( this, selector || [], false ) ); 2903 }, 2904 not: function( selector ) { 2905 return this.pushStack( winnow( this, selector || [], true ) ); 2906 }, 2907 is: function( selector ) { 2908 return !!winnow( 2909 this, 2910 2911 // If this is a positional/relative selector, check membership in the returned set 2912 // so $("p:first").is("p:last") won't return true for a doc with two "p". 2913 typeof selector === "string" && rneedsContext.test( selector ) ? 2914 jQuery( selector ) : 2915 selector || [], 2916 false 2917 ).length; 2918 } 2919} ); 2920 2921 2922// Initialize a jQuery object 2923 2924 2925// A central reference to the root jQuery(document) 2926var rootjQuery, 2927 2928 // A simple way to check for HTML strings 2929 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 2930 // Strict HTML recognition (#11290: must start with <) 2931 // Shortcut simple #id case for speed 2932 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 2933 2934 init = jQuery.fn.init = function( selector, context, root ) { 2935 var match, elem; 2936 2937 // HANDLE: $(""), $(null), $(undefined), $(false) 2938 if ( !selector ) { 2939 return this; 2940 } 2941 2942 // Method init() accepts an alternate rootjQuery 2943 // so migrate can support jQuery.sub (gh-2101) 2944 root = root || rootjQuery; 2945 2946 // Handle HTML strings 2947 if ( typeof selector === "string" ) { 2948 if ( selector[ 0 ] === "<" && 2949 selector[ selector.length - 1 ] === ">" && 2950 selector.length >= 3 ) { 2951 2952 // Assume that strings that start and end with <> are HTML and skip the regex check 2953 match = [ null, selector, null ]; 2954 2955 } else { 2956 match = rquickExpr.exec( selector ); 2957 } 2958 2959 // Match html or make sure no context is specified for #id 2960 if ( match && ( match[ 1 ] || !context ) ) { 2961 2962 // HANDLE: $(html) -> $(array) 2963 if ( match[ 1 ] ) { 2964 context = context instanceof jQuery ? context[ 0 ] : context; 2965 2966 // Option to run scripts is true for back-compat 2967 // Intentionally let the error be thrown if parseHTML is not present 2968 jQuery.merge( this, jQuery.parseHTML( 2969 match[ 1 ], 2970 context && context.nodeType ? context.ownerDocument || context : document, 2971 true 2972 ) ); 2973 2974 // HANDLE: $(html, props) 2975 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 2976 for ( match in context ) { 2977 2978 // Properties of context are called as methods if possible 2979 if ( isFunction( this[ match ] ) ) { 2980 this[ match ]( context[ match ] ); 2981 2982 // ...and otherwise set as attributes 2983 } else { 2984 this.attr( match, context[ match ] ); 2985 } 2986 } 2987 } 2988 2989 return this; 2990 2991 // HANDLE: $(#id) 2992 } else { 2993 elem = document.getElementById( match[ 2 ] ); 2994 2995 if ( elem ) { 2996 2997 // Inject the element directly into the jQuery object 2998 this[ 0 ] = elem; 2999 this.length = 1; 3000 } 3001 return this; 3002 } 3003 3004 // HANDLE: $(expr, $(...)) 3005 } else if ( !context || context.jquery ) { 3006 return ( context || root ).find( selector ); 3007 3008 // HANDLE: $(expr, context) 3009 // (which is just equivalent to: $(context).find(expr) 3010 } else { 3011 return this.constructor( context ).find( selector ); 3012 } 3013 3014 // HANDLE: $(DOMElement) 3015 } else if ( selector.nodeType ) { 3016 this[ 0 ] = selector; 3017 this.length = 1; 3018 return this; 3019 3020 // HANDLE: $(function) 3021 // Shortcut for document ready 3022 } else if ( isFunction( selector ) ) { 3023 return root.ready !== undefined ? 3024 root.ready( selector ) : 3025 3026 // Execute immediately if ready is not present 3027 selector( jQuery ); 3028 } 3029 3030 return jQuery.makeArray( selector, this ); 3031 }; 3032 3033// Give the init function the jQuery prototype for later instantiation 3034init.prototype = jQuery.fn; 3035 3036// Initialize central reference 3037rootjQuery = jQuery( document ); 3038 3039 3040var rparentsprev = /^(?:parents|prev(?:Until|All))/, 3041 3042 // Methods guaranteed to produce a unique set when starting from a unique set 3043 guaranteedUnique = { 3044 children: true, 3045 contents: true, 3046 next: true, 3047 prev: true 3048 }; 3049 3050jQuery.fn.extend( { 3051 has: function( target ) { 3052 var targets = jQuery( target, this ), 3053 l = targets.length; 3054 3055 return this.filter( function() { 3056 var i = 0; 3057 for ( ; i < l; i++ ) { 3058 if ( jQuery.contains( this, targets[ i ] ) ) { 3059 return true; 3060 } 3061 } 3062 } ); 3063 }, 3064 3065 closest: function( selectors, context ) { 3066 var cur, 3067 i = 0, 3068 l = this.length, 3069 matched = [],
vendor: 2,936 bytes, lines 3070-3183
3070 targets = typeof selectors !== "string" && jQuery( selectors ); 3071 3072 // Positional selectors never match, since there's no _selection_ context 3073 if ( !rneedsContext.test( selectors ) ) { 3074 for ( ; i < l; i++ ) { 3075 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 3076 3077 // Always skip document fragments 3078 if ( cur.nodeType < 11 && ( targets ? 3079 targets.index( cur ) > -1 : 3080 3081 // Don't pass non-elements to Sizzle 3082 cur.nodeType === 1 && 3083 jQuery.find.matchesSelector( cur, selectors ) ) ) { 3084 3085 matched.push( cur ); 3086 break; 3087 } 3088 } 3089 } 3090 } 3091 3092 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 3093 }, 3094 3095 // Determine the position of an element within the set 3096 index: function( elem ) { 3097 3098 // No argument, return index in parent 3099 if ( !elem ) { 3100 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 3101 } 3102 3103 // Index in selector 3104 if ( typeof elem === "string" ) { 3105 return indexOf.call( jQuery( elem ), this[ 0 ] ); 3106 } 3107 3108 // Locate the position of the desired element 3109 return indexOf.call( this, 3110 3111 // If it receives a jQuery object, the first element is used 3112 elem.jquery ? elem[ 0 ] : elem 3113 ); 3114 }, 3115 3116 add: function( selector, context ) { 3117 return this.pushStack( 3118 jQuery.uniqueSort( 3119 jQuery.merge( this.get(), jQuery( selector, context ) ) 3120 ) 3121 ); 3122 }, 3123 3124 addBack: function( selector ) { 3125 return this.add( selector == null ? 3126 this.prevObject : this.prevObject.filter( selector ) 3127 ); 3128 } 3129} ); 3130 3131function sibling( cur, dir ) { 3132 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 3133 return cur; 3134} 3135 3136jQuery.each( { 3137 parent: function( elem ) { 3138 var parent = elem.parentNode; 3139 return parent && parent.nodeType !== 11 ? parent : null; 3140 }, 3141 parents: function( elem ) { 3142 return dir( elem, "parentNode" ); 3143 }, 3144 parentsUntil: function( elem, i, until ) { 3145 return dir( elem, "parentNode", until ); 3146 }, 3147 next: function( elem ) { 3148 return sibling( elem, "nextSibling" ); 3149 }, 3150 prev: function( elem ) { 3151 return sibling( elem, "previousSibling" ); 3152 }, 3153 nextAll: function( elem ) { 3154 return dir( elem, "nextSibling" ); 3155 }, 3156 prevAll: function( elem ) { 3157 return dir( elem, "previousSibling" ); 3158 }, 3159 nextUntil: function( elem, i, until ) { 3160 return dir( elem, "nextSibling", until ); 3161 }, 3162 prevUntil: function( elem, i, until ) { 3163 return dir( elem, "previousSibling", until ); 3164 }, 3165 siblings: function( elem ) { 3166 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 3167 }, 3168 children: function( elem ) { 3169 return siblings( elem.firstChild ); 3170 }, 3171 contents: function( elem ) { 3172 if ( typeof elem.contentDocument !== "undefined" ) { 3173 return elem.contentDocument; 3174 } 3175 3176 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 3177 // Treat the template element as a regular one in browsers that 3178 // don't support it. 3179 if ( nodeName( elem, "template" ) ) { 3180 elem = elem.content || elem; 3181 } 3182 3183
vendor: 32,505 bytes, lines 3183-4492
3183return jQuery.merge( [], elem.childNodes ); 3184 } 3185}, function( name, fn ) { 3186 jQuery.fn[ name ] = function( until, selector ) { 3187 var matched = jQuery.map( this, fn, until ); 3188 3189 if ( name.slice( -5 ) !== "Until" ) { 3190 selector = until; 3191 } 3192 3193 if ( selector && typeof selector === "string" ) { 3194 matched = jQuery.filter( selector, matched ); 3195 } 3196 3197 if ( this.length > 1 ) { 3198 3199 // Remove duplicates 3200 if ( !guaranteedUnique[ name ] ) { 3201 jQuery.uniqueSort( matched ); 3202 } 3203 3204 // Reverse order for parents* and prev-derivatives 3205 if ( rparentsprev.test( name ) ) { 3206 matched.reverse(); 3207 } 3208 } 3209 3210 return this.pushStack( matched ); 3211 }; 3212} ); 3213var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 3214 3215 3216 3217// Convert String-formatted options into Object-formatted ones 3218function createOptions( options ) { 3219 var object = {}; 3220 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 3221 object[ flag ] = true; 3222 } ); 3223 return object; 3224} 3225 3226/* 3227 * Create a callback list using the following parameters: 3228 * 3229 * options: an optional list of space-separated options that will change how 3230 * the callback list behaves or a more traditional option object 3231 * 3232 * By default a callback list will act like an event callback list and can be 3233 * "fired" multiple times. 3234 * 3235 * Possible options: 3236 * 3237 * once: will ensure the callback list can only be fired once (like a Deferred) 3238 * 3239 * memory: will keep track of previous values and will call any callback added 3240 * after the list has been fired right away with the latest "memorized" 3241 * values (like a Deferred) 3242 * 3243 * unique: will ensure a callback can only be added once (no duplicate in the list) 3244 * 3245 * stopOnFalse: interrupt callings when a callback returns false 3246 * 3247 */ 3248jQuery.Callbacks = function( options ) { 3249 3250 // Convert options from String-formatted to Object-formatted if needed 3251 // (we check in cache first) 3252 options = typeof options === "string" ? 3253 createOptions( options ) : 3254 jQuery.extend( {}, options ); 3255 3256 var // Flag to know if list is currently firing 3257 firing, 3258 3259 // Last fire value for non-forgettable lists 3260 memory, 3261 3262 // Flag to know if list was already fired 3263 fired, 3264 3265 // Flag to prevent firing 3266 locked, 3267 3268 // Actual callback list 3269 list = [], 3270 3271 // Queue of execution data for repeatable lists 3272 queue = [], 3273 3274 // Index of currently firing callback (modified by add/remove as needed) 3275 firingIndex = -1, 3276 3277 // Fire callbacks 3278 fire = function() { 3279 3280 // Enforce single-firing 3281 locked = locked || options.once; 3282 3283 // Execute callbacks for all pending executions, 3284 // respecting firingIndex overrides and runtime changes 3285 fired = firing = true; 3286 for ( ; queue.length; firingIndex = -1 ) { 3287 memory = queue.shift(); 3288 while ( ++firingIndex < list.length ) { 3289 3290 // Run callback and check for early termination 3291 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 3292 options.stopOnFalse ) { 3293 3294 // Jump to end and forget the data so .add doesn't re-fire 3295 firingIndex = list.length; 3296 memory = false; 3297 } 3298 } 3299 } 3300 3301 // Forget the data if we're done with it 3302 if ( !options.memory ) { 3303 memory = false; 3304 } 3305 3306 firing = false; 3307 3308 // Clean up if we're done firing for good 3309 if ( locked ) { 3310 3311 // Keep an empty list if we have data for future add calls 3312 if ( memory ) { 3313 list = []; 3314 3315 // Otherwise, this object is spent 3316 } else { 3317 list = ""; 3318 } 3319 } 3320 }, 3321 3322 // Actual Callbacks object 3323 self = { 3324 3325 // Add a callback or a collection of callbacks to the list 3326 add: function() { 3327 if ( list ) { 3328 3329 // If we have memory from a past run, we should fire after adding 3330 if ( memory && !firing ) { 3331 firingIndex = list.length - 1; 3332 queue.push( memory ); 3333 } 3334 3335 ( function add( args ) { 3336 jQuery.each( args, function( _, arg ) { 3337 if ( isFunction( arg ) ) { 3338 if ( !options.unique || !self.has( arg ) ) { 3339 list.push( arg ); 3340 } 3341 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 3342 3343 // Inspect recursively 3344 add( arg ); 3345 } 3346 } ); 3347 } )( arguments ); 3348 3349 if ( memory && !firing ) { 3350 fire(); 3351 } 3352 } 3353 return this; 3354 }, 3355 3356 // Remove a callback from the list 3357 remove: function() { 3358 jQuery.each( arguments, function( _, arg ) { 3359 var index; 3360 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 3361 list.splice( index, 1 ); 3362 3363 // Handle firing indexes 3364 if ( index <= firingIndex ) { 3365 firingIndex--; 3366 } 3367 } 3368 } ); 3369 return this; 3370 }, 3371 3372 // Check if a given callback is in the list. 3373 // If no argument is given, return whether or not list has callbacks attached. 3374 has: function( fn ) { 3375 return fn ? 3376 jQuery.inArray( fn, list ) > -1 : 3377 list.length > 0; 3378 }, 3379 3380 // Remove all callbacks from the list 3381 empty: function() { 3382 if ( list ) { 3383 list = []; 3384 } 3385 return this; 3386 }, 3387 3388 // Disable .fire and .add 3389 // Abort any current/pending executions 3390 // Clear all callbacks and values 3391 disable: function() { 3392 locked = queue = []; 3393 list = memory = ""; 3394 return this; 3395 }, 3396 disabled: function() { 3397 return !list; 3398 }, 3399 3400 // Disable .fire 3401 // Also disable .add unless we have memory (since it would have no effect) 3402 // Abort any pending executions 3403 lock: function() { 3404 locked = queue = []; 3405 if ( !memory && !firing ) { 3406 list = memory = ""; 3407 } 3408 return this; 3409 }, 3410 locked: function() { 3411 return !!locked; 3412 }, 3413 3414 // Call all callbacks with the given context and arguments 3415 fireWith: function( context, args ) { 3416 if ( !locked ) { 3417 args = args || []; 3418 args = [ context, args.slice ? args.slice() : args ]; 3419 queue.push( args ); 3420 if ( !firing ) { 3421 fire(); 3422 } 3423 } 3424 return this; 3425 }, 3426 3427 // Call all the callbacks with the given arguments 3428 fire: function() { 3429 self.fireWith( this, arguments ); 3430 return this; 3431 }, 3432 3433 // To know if the callbacks have already been called at least once 3434 fired: function() { 3435 return !!fired; 3436 } 3437 }; 3438 3439 return self; 3440}; 3441 3442 3443function Identity( v ) { 3444 return v; 3445} 3446function Thrower( ex ) { 3447 throw ex; 3448} 3449 3450function adoptValue( value, resolve, reject, noValue ) { 3451 var method; 3452 3453 try { 3454 3455 // Check for promise aspect first to privilege synchronous behavior 3456 if ( value && isFunction( ( method = value.promise ) ) ) { 3457 method.call( value ).done( resolve ).fail( reject ); 3458 3459 // Other thenables 3460 } else if ( value && isFunction( ( method = value.then ) ) ) { 3461 method.call( value, resolve, reject ); 3462 3463 // Other non-thenables 3464 } else { 3465 3466 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 3467 // * false: [ value ].slice( 0 ) => resolve( value ) 3468 // * true: [ value ].slice( 1 ) => resolve() 3469 resolve.apply( undefined, [ value ].slice( noValue ) ); 3470 } 3471 3472 // For Promises/A+, convert exceptions into rejections 3473 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 3474 // Deferred#then to conditionally suppress rejection. 3475 } catch ( value ) { 3476 3477 // Support: Android 4.0 only 3478 // Strict mode functions invoked without .call/.apply get global-object context 3479 reject.apply( undefined, [ value ] ); 3480 } 3481} 3482 3483jQuery.extend( { 3484 3485 Deferred: function( func ) { 3486 var tuples = [ 3487 3488 // action, add listener, callbacks, 3489 // ... .then handlers, argument index, [final state] 3490 [ "notify", "progress", jQuery.Callbacks( "memory" ), 3491 jQuery.Callbacks( "memory" ), 2 ], 3492 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 3493 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 3494 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 3495 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 3496 ], 3497 state = "pending", 3498 promise = { 3499 state: function() { 3500 return state; 3501 }, 3502 always: function() { 3503 deferred.done( arguments ).fail( arguments ); 3504 return this; 3505 }, 3506 "catch": function( fn ) { 3507 return promise.then( null, fn ); 3508 }, 3509 3510 // Keep pipe for back-compat 3511 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 3512 var fns = arguments; 3513 3514 return jQuery.Deferred( function( newDefer ) { 3515 jQuery.each( tuples, function( i, tuple ) { 3516 3517 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 3518 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 3519 3520 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 3521 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 3522 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 3523 deferred[ tuple[ 1 ] ]( function() { 3524 var returned = fn && fn.apply( this, arguments ); 3525 if ( returned && isFunction( returned.promise ) ) { 3526 returned.promise() 3527 .progress( newDefer.notify ) 3528 .done( newDefer.resolve ) 3529 .fail( newDefer.reject ); 3530 } else { 3531 newDefer[ tuple[ 0 ] + "With" ]( 3532 this, 3533 fn ? [ returned ] : arguments 3534 ); 3535 } 3536 } ); 3537 } ); 3538 fns = null; 3539 } ).promise(); 3540 }, 3541 then: function( onFulfilled, onRejected, onProgress ) { 3542 var maxDepth = 0; 3543 function resolve( depth, deferred, handler, special ) { 3544 return function() { 3545 var that = this, 3546 args = arguments, 3547 mightThrow = function() { 3548 var returned, then; 3549 3550 // Support: Promises/A+ section 2.3.3.3.3 3551 // https://promisesaplus.com/#point-59 3552 // Ignore double-resolution attempts 3553 if ( depth < maxDepth ) { 3554 return; 3555 } 3556 3557 returned = handler.apply( that, args ); 3558 3559 // Support: Promises/A+ section 2.3.1 3560 // https://promisesaplus.com/#point-48 3561 if ( returned === deferred.promise() ) { 3562 throw new TypeError( "Thenable self-resolution" ); 3563 } 3564 3565 // Support: Promises/A+ sections 2.3.3.1, 3.5 3566 // https://promisesaplus.com/#point-54 3567 // https://promisesaplus.com/#point-75 3568 // Retrieve `then` only once 3569 then = returned && 3570 3571 // Support: Promises/A+ section 2.3.4 3572 // https://promisesaplus.com/#point-64 3573 // Only check objects and functions for thenability 3574 ( typeof returned === "object" || 3575 typeof returned === "function" ) && 3576 returned.then; 3577 3578 // Handle a returned thenable 3579 if ( isFunction( then ) ) { 3580 3581 // Special processors (notify) just wait for resolution 3582 if ( special ) { 3583 then.call( 3584 returned, 3585 resolve( maxDepth, deferred, Identity, special ), 3586 resolve( maxDepth, deferred, Thrower, special ) 3587 ); 3588 3589 // Normal processors (resolve) also hook into progress 3590 } else { 3591 3592 // ...and disregard older resolution values 3593 maxDepth++; 3594 3595 then.call( 3596 returned, 3597 resolve( maxDepth, deferred, Identity, special ), 3598 resolve( maxDepth, deferred, Thrower, special ), 3599 resolve( maxDepth, deferred, Identity, 3600 deferred.notifyWith ) 3601 ); 3602 } 3603 3604 // Handle all other returned values 3605 } else { 3606 3607 // Only substitute handlers pass on context 3608 // and multiple values (non-spec behavior) 3609 if ( handler !== Identity ) { 3610 that = undefined; 3611 args = [ returned ]; 3612 } 3613 3614 // Process the value(s) 3615 // Default process is resolve 3616 ( special || deferred.resolveWith )( that, args ); 3617 } 3618 }, 3619 3620 // Only normal processors (resolve) catch and reject exceptions 3621 process = special ? 3622 mightThrow : 3623 function() { 3624 try { 3625 mightThrow(); 3626 } catch ( e ) { 3627 3628 if ( jQuery.Deferred.exceptionHook ) { 3629 jQuery.Deferred.exceptionHook( e, 3630 process.stackTrace ); 3631 } 3632 3633 // Support: Promises/A+ section 2.3.3.3.4.1 3634 // https://promisesaplus.com/#point-61 3635 // Ignore post-resolution exceptions 3636 if ( depth + 1 >= maxDepth ) { 3637 3638 // Only substitute handlers pass on context 3639 // and multiple values (non-spec behavior) 3640 if ( handler !== Thrower ) { 3641 that = undefined; 3642 args = [ e ]; 3643 } 3644 3645 deferred.rejectWith( that, args ); 3646 } 3647 } 3648 }; 3649 3650 // Support: Promises/A+ section 2.3.3.3.1 3651 // https://promisesaplus.com/#point-57 3652 // Re-resolve promises immediately to dodge false rejection from 3653 // subsequent errors 3654 if ( depth ) { 3655 process(); 3656 } else { 3657 3658 // Call an optional hook to record the stack, in case of exception 3659 // since it's otherwise lost when execution goes async 3660 if ( jQuery.Deferred.getStackHook ) { 3661 process.stackTrace = jQuery.Deferred.getStackHook(); 3662 } 3663 window.setTimeout( process ); 3664 } 3665 }; 3666 } 3667 3668 return jQuery.Deferred( function( newDefer ) { 3669 3670 // progress_handlers.add( ... ) 3671 tuples[ 0 ][ 3 ].add( 3672 resolve( 3673 0, 3674 newDefer, 3675 isFunction( onProgress ) ? 3676 onProgress : 3677 Identity, 3678 newDefer.notifyWith 3679 ) 3680 ); 3681 3682 // fulfilled_handlers.add( ... ) 3683 tuples[ 1 ][ 3 ].add( 3684 resolve( 3685 0, 3686 newDefer, 3687 isFunction( onFulfilled ) ? 3688 onFulfilled : 3689 Identity 3690 ) 3691 ); 3692 3693 // rejected_handlers.add( ... ) 3694 tuples[ 2 ][ 3 ].add( 3695 resolve( 3696 0, 3697 newDefer, 3698 isFunction( onRejected ) ? 3699 onRejected : 3700 Thrower 3701 ) 3702 ); 3703 } ).promise(); 3704 }, 3705 3706 // Get a promise for this deferred 3707 // If obj is provided, the promise aspect is added to the object 3708 promise: function( obj ) { 3709 return obj != null ? jQuery.extend( obj, promise ) : promise; 3710 } 3711 }, 3712 deferred = {}; 3713 3714 // Add list-specific methods 3715 jQuery.each( tuples, function( i, tuple ) { 3716 var list = tuple[ 2 ], 3717 stateString = tuple[ 5 ]; 3718 3719 // promise.progress = list.add 3720 // promise.done = list.add 3721 // promise.fail = list.add 3722 promise[ tuple[ 1 ] ] = list.add; 3723 3724 // Handle state 3725 if ( stateString ) { 3726 list.add( 3727 function() { 3728 3729 // state = "resolved" (i.e., fulfilled) 3730 // state = "rejected" 3731 state = stateString; 3732 }, 3733 3734 // rejected_callbacks.disable 3735 // fulfilled_callbacks.disable 3736 tuples[ 3 - i ][ 2 ].disable, 3737 3738 // rejected_handlers.disable 3739 // fulfilled_handlers.disable 3740 tuples[ 3 - i ][ 3 ].disable, 3741 3742 // progress_callbacks.lock 3743 tuples[ 0 ][ 2 ].lock, 3744 3745 // progress_handlers.lock 3746 tuples[ 0 ][ 3 ].lock 3747 ); 3748 } 3749 3750 // progress_handlers.fire 3751 // fulfilled_handlers.fire 3752 // rejected_handlers.fire 3753 list.add( tuple[ 3 ].fire ); 3754 3755 // deferred.notify = function() { deferred.notifyWith(...) } 3756 // deferred.resolve = function() { deferred.resolveWith(...) } 3757 // deferred.reject = function() { deferred.rejectWith(...) } 3758 deferred[ tuple[ 0 ] ] = function() { 3759 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 3760 return this; 3761 }; 3762 3763 // deferred.notifyWith = list.fireWith 3764 // deferred.resolveWith = list.fireWith 3765 // deferred.rejectWith = list.fireWith 3766 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 3767 } ); 3768 3769 // Make the deferred a promise 3770 promise.promise( deferred ); 3771 3772 // Call given func if any 3773 if ( func ) { 3774 func.call( deferred, deferred ); 3775 } 3776 3777 // All done! 3778 return deferred; 3779 }, 3780 3781 // Deferred helper 3782 when: function( singleValue ) { 3783 var 3784 3785 // count of uncompleted subordinates 3786 remaining = arguments.length, 3787 3788 // count of unprocessed arguments 3789 i = remaining, 3790 3791 // subordinate fulfillment data 3792 resolveContexts = Array( i ), 3793 resolveValues = slice.call( arguments ), 3794 3795 // the master Deferred 3796 master = jQuery.Deferred(), 3797 3798 // subordinate callback factory 3799 updateFunc = function( i ) { 3800 return function( value ) { 3801 resolveContexts[ i ] = this; 3802 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 3803 if ( !( --remaining ) ) { 3804 master.resolveWith( resolveContexts, resolveValues ); 3805 } 3806 }; 3807 }; 3808 3809 // Single- and empty arguments are adopted like Promise.resolve 3810 if ( remaining <= 1 ) { 3811 adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject, 3812 !remaining ); 3813 3814 // Use .then() to unwrap secondary thenables (cf. gh-3000) 3815 if ( master.state() === "pending" || 3816 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 3817 3818 return master.then(); 3819 } 3820 } 3821 3822 // Multiple arguments are aggregated like Promise.all array elements 3823 while ( i-- ) { 3824 adoptValue( resolveValues[ i ], updateFunc( i ), master.reject ); 3825 } 3826 3827 return master.promise(); 3828 } 3829} ); 3830 3831 3832// These usually indicate a programmer mistake during development, 3833// warn about them ASAP rather than swallowing them by default. 3834var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 3835 3836jQuery.Deferred.exceptionHook = function( error, stack ) { 3837 3838 // Support: IE 8 - 9 only 3839 // Console exists when dev tools are open, which can happen at any time 3840 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 3841 window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack ); 3842 } 3843}; 3844 3845 3846 3847 3848jQuery.readyException = function( error ) { 3849 window.setTimeout( function() { 3850 throw error; 3851 } ); 3852}; 3853 3854 3855 3856 3857// The deferred used on DOM ready 3858var readyList = jQuery.Deferred(); 3859 3860jQuery.fn.ready = function( fn ) { 3861 3862 readyList 3863 .then( fn ) 3864 3865 // Wrap jQuery.readyException in a function so that the lookup 3866 // happens at the time of error handling instead of callback 3867 // registration. 3868 .catch( function( error ) { 3869 jQuery.readyException( error ); 3870 } ); 3871 3872 return this; 3873}; 3874 3875jQuery.extend( { 3876 3877 // Is the DOM ready to be used? Set to true once it occurs. 3878 isReady: false, 3879 3880 // A counter to track how many items to wait for before 3881 // the ready event fires. See #6781 3882 readyWait: 1, 3883 3884 // Handle when the DOM is ready 3885 ready: function( wait ) { 3886 3887 // Abort if there are pending holds or we're already ready 3888 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 3889 return; 3890 } 3891 3892 // Remember that the DOM is ready 3893 jQuery.isReady = true; 3894 3895 // If a normal DOM Ready event fired, decrement, and wait if need be 3896 if ( wait !== true && --jQuery.readyWait > 0 ) { 3897 return; 3898 } 3899 3900 // If there are functions bound, to execute 3901 readyList.resolveWith( document, [ jQuery ] ); 3902 } 3903} ); 3904 3905jQuery.ready.then = readyList.then; 3906 3907// The ready event handler and self cleanup method 3908function completed() { 3909 document.removeEventListener( "DOMContentLoaded", completed ); 3910 window.removeEventListener( "load", completed ); 3911 jQuery.ready(); 3912} 3913 3914// Catch cases where $(document).ready() is called 3915// after the browser event has already occurred. 3916// Support: IE <=9 - 10 only 3917// Older IE sometimes signals "interactive" too soon 3918if ( document.readyState === "complete" || 3919 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 3920 3921 // Handle it asynchronously to allow scripts the opportunity to delay ready 3922 window.setTimeout( jQuery.ready ); 3923 3924} else { 3925 3926 // Use the handy event callback 3927 document.addEventListener( "DOMContentLoaded", completed ); 3928 3929 // A fallback to window.onload, that will always work 3930 window.addEventListener( "load", completed ); 3931} 3932 3933 3934 3935 3936// Multifunctional method to get and set values of a collection 3937// The value/s can optionally be executed if it's a function 3938var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 3939 var i = 0, 3940 len = elems.length, 3941 bulk = key == null; 3942 3943 // Sets many values 3944 if ( toType( key ) === "object" ) { 3945 chainable = true; 3946 for ( i in key ) { 3947 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 3948 } 3949 3950 // Sets one value 3951 } else if ( value !== undefined ) { 3952 chainable = true; 3953 3954 if ( !isFunction( value ) ) { 3955 raw = true; 3956 } 3957 3958 if ( bulk ) { 3959 3960 // Bulk operations run against the entire set 3961 if ( raw ) { 3962 fn.call( elems, value ); 3963 fn = null; 3964 3965 // ...except when executing function values 3966 } else { 3967 bulk = fn; 3968 fn = function( elem, key, value ) { 3969 return bulk.call( jQuery( elem ), value ); 3970 }; 3971 } 3972 } 3973 3974 if ( fn ) { 3975 for ( ; i < len; i++ ) { 3976 fn( 3977 elems[ i ], key, raw ? 3978 value : 3979 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 3980 ); 3981 } 3982 } 3983 } 3984 3985 if ( chainable ) { 3986 return elems; 3987 } 3988 3989 // Gets 3990 if ( bulk ) { 3991 return fn.call( elems ); 3992 } 3993 3994 return len ? fn( elems[ 0 ], key ) : emptyGet; 3995}; 3996 3997 3998// Matches dashed string for camelizing 3999var rmsPrefix = /^-ms-/, 4000 rdashAlpha = /-([a-z])/g; 4001 4002// Used by camelCase as callback to replace() 4003function fcamelCase( all, letter ) { 4004 return letter.toUpperCase(); 4005} 4006 4007// Convert dashed to camelCase; used by the css and data modules 4008// Support: IE <=9 - 11, Edge 12 - 15 4009// Microsoft forgot to hump their vendor prefix (#9572) 4010function camelCase( string ) { 4011 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 4012} 4013var acceptData = function( owner ) { 4014 4015 // Accepts only: 4016 // - Node 4017 // - Node.ELEMENT_NODE 4018 // - Node.DOCUMENT_NODE 4019 // - Object 4020 // - Any 4021 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 4022}; 4023 4024 4025 4026 4027function Data() { 4028 this.expando = jQuery.expando + Data.uid++; 4029} 4030 4031Data.uid = 1; 4032 4033Data.prototype = { 4034 4035 cache: function( owner ) { 4036 4037 // Check if the owner object already has a cache 4038 var value = owner[ this.expando ]; 4039 4040 // If not, create one 4041 if ( !value ) { 4042 value = {}; 4043 4044 // We can accept data for non-element nodes in modern browsers, 4045 // but we should not, see #8335. 4046 // Always return an empty object. 4047 if ( acceptData( owner ) ) { 4048 4049 // If it is a node unlikely to be stringify-ed or looped over 4050 // use plain assignment 4051 if ( owner.nodeType ) { 4052 owner[ this.expando ] = value; 4053 4054 // Otherwise secure it in a non-enumerable property 4055 // configurable must be true to allow the property to be 4056 // deleted when data is removed 4057 } else { 4058 Object.defineProperty( owner, this.expando, { 4059 value: value, 4060 configurable: true 4061 } ); 4062 } 4063 } 4064 } 4065 4066 return value; 4067 }, 4068 set: function( owner, data, value ) { 4069 var prop, 4070 cache = this.cache( owner ); 4071 4072 // Handle: [ owner, key, value ] args 4073 // Always use camelCase key (gh-2257) 4074 if ( typeof data === "string" ) { 4075 cache[ camelCase( data ) ] = value; 4076 4077 // Handle: [ owner, { properties } ] args 4078 } else { 4079 4080 // Copy the properties one-by-one to the cache object 4081 for ( prop in data ) { 4082 cache[ camelCase( prop ) ] = data[ prop ]; 4083 } 4084 } 4085 return cache; 4086 }, 4087 get: function( owner, key ) { 4088 return key === undefined ? 4089 this.cache( owner ) : 4090 4091 // Always use camelCase key (gh-2257) 4092 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 4093 }, 4094 access: function( owner, key, value ) { 4095 4096 // In cases where either: 4097 // 4098 // 1. No key was specified 4099 // 2. A string key was specified, but no value provided 4100 // 4101 // Take the "read" path and allow the get method to determine 4102 // which value to return, respectively either: 4103 // 4104 // 1. The entire cache object 4105 // 2. The data stored at the key 4106 // 4107 if ( key === undefined || 4108 ( ( key && typeof key === "string" ) && value === undefined ) ) { 4109 4110 return this.get( owner, key ); 4111 } 4112 4113 // When the key is not a string, or both a key and value 4114 // are specified, set or extend (existing objects) with either: 4115 // 4116 // 1. An object of properties 4117 // 2. A key and value 4118 // 4119 this.set( owner, key, value ); 4120 4121 // Since the "set" path can have two possible entry points 4122 // return the expected data based on which path was taken[*] 4123 return value !== undefined ? value : key; 4124 }, 4125 remove: function( owner, key ) { 4126 var i, 4127 cache = owner[ this.expando ]; 4128 4129 if ( cache === undefined ) { 4130 return; 4131 } 4132 4133 if ( key !== undefined ) { 4134 4135 // Support array or space separated string of keys 4136 if ( Array.isArray( key ) ) { 4137 4138 // If key is an array of keys... 4139 // We always set camelCase keys, so remove that. 4140 key = key.map( camelCase ); 4141 } else { 4142 key = camelCase( key ); 4143 4144 // If a key with the spaces exists, use it. 4145 // Otherwise, create an array by matching non-whitespace 4146 key = key in cache ? 4147 [ key ] : 4148 ( key.match( rnothtmlwhite ) || [] ); 4149 } 4150 4151 i = key.length; 4152 4153 while ( i-- ) { 4154 delete cache[ key[ i ] ]; 4155 } 4156 } 4157 4158 // Remove the expando if there's no more data 4159 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 4160 4161 // Support: Chrome <=35 - 45 4162 // Webkit & Blink performance suffers when deleting properties 4163 // from DOM nodes, so set to undefined instead 4164 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 4165 if ( owner.nodeType ) { 4166 owner[ this.expando ] = undefined; 4167 } else { 4168 delete owner[ this.expando ]; 4169 } 4170 } 4171 }, 4172 hasData: function( owner ) { 4173 var cache = owner[ this.expando ]; 4174 return cache !== undefined && !jQuery.isEmptyObject( cache ); 4175 } 4176}; 4177var dataPriv = new Data(); 4178 4179var dataUser = new Data(); 4180 4181 4182 4183// Implementation Summary 4184// 4185// 1. Enforce API surface and semantic compatibility with 1.9.x branch 4186// 2. Improve the module's maintainability by reducing the storage 4187// paths to a single mechanism. 4188// 3. Use the same single mechanism to support "private" and "user" data. 4189// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 4190// 5. Avoid exposing implementation details on user objects (eg. expando properties) 4191// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 4192 4193var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 4194 rmultiDash = /[A-Z]/g; 4195 4196function getData( data ) { 4197 if ( data === "true" ) { 4198 return true; 4199 } 4200 4201 if ( data === "false" ) { 4202 return false; 4203 } 4204 4205 if ( data === "null" ) { 4206 return null; 4207 } 4208 4209 // Only convert to a number if it doesn't change the string 4210 if ( data === +data + "" ) { 4211 return +data; 4212 } 4213 4214 if ( rbrace.test( data ) ) { 4215 return JSON.parse( data ); 4216 } 4217 4218 return data; 4219} 4220 4221function dataAttr( elem, key, data ) { 4222 var name; 4223 4224 // If nothing was found internally, try to fetch any 4225 // data from the HTML5 data-* attribute 4226 if ( data === undefined && elem.nodeType === 1 ) { 4227 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 4228 data = elem.getAttribute( name ); 4229 4230 if ( typeof data === "string" ) { 4231 try { 4232 data = getData( data ); 4233 } catch ( e ) {} 4234 4235 // Make sure we set the data so it isn't changed later 4236 dataUser.set( elem, key, data ); 4237 } else { 4238 data = undefined; 4239 } 4240 } 4241 return data; 4242} 4243 4244jQuery.extend( { 4245 hasData: function( elem ) { 4246 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 4247 }, 4248 4249 data: function( elem, name, data ) { 4250 return dataUser.access( elem, name, data ); 4251 }, 4252 4253 removeData: function( elem, name ) { 4254 dataUser.remove( elem, name ); 4255 }, 4256 4257 // TODO: Now that all calls to _data and _removeData have been replaced 4258 // with direct calls to dataPriv methods, these can be deprecated. 4259 _data: function( elem, name, data ) { 4260 return dataPriv.access( elem, name, data ); 4261 }, 4262 4263 _removeData: function( elem, name ) { 4264 dataPriv.remove( elem, name ); 4265 } 4266} ); 4267 4268jQuery.fn.extend( { 4269 data: function( key, value ) { 4270 var i, name, data, 4271 elem = this[ 0 ], 4272 attrs = elem && elem.attributes; 4273 4274 // Gets all values 4275 if ( key === undefined ) { 4276 if ( this.length ) { 4277 data = dataUser.get( elem ); 4278 4279 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 4280 i = attrs.length; 4281 while ( i-- ) { 4282 4283 // Support: IE 11 only 4284 // The attrs elements can be null (#14894) 4285 if ( attrs[ i ] ) { 4286 name = attrs[ i ].name; 4287 if ( name.indexOf( "data-" ) === 0 ) { 4288 name = camelCase( name.slice( 5 ) ); 4289 dataAttr( elem, name, data[ name ] ); 4290 } 4291 } 4292 } 4293 dataPriv.set( elem, "hasDataAttrs", true ); 4294 } 4295 } 4296 4297 return data; 4298 } 4299 4300 // Sets multiple values 4301 if ( typeof key === "object" ) { 4302 return this.each( function() { 4303 dataUser.set( this, key ); 4304 } ); 4305 } 4306 4307 return access( this, function( value ) { 4308 var data; 4309 4310 // The calling jQuery object (element matches) is not empty 4311 // (and therefore has an element appears at this[ 0 ]) and the 4312 // `value` parameter was not undefined. An empty jQuery object 4313 // will result in `undefined` for elem = this[ 0 ] which will 4314 // throw an exception if an attempt to read a data cache is made. 4315 if ( elem && value === undefined ) { 4316 4317 // Attempt to get data from the cache 4318 // The key will always be camelCased in Data 4319 data = dataUser.get( elem, key ); 4320 if ( data !== undefined ) { 4321 return data; 4322 } 4323 4324 // Attempt to "discover" the data in 4325 // HTML5 custom data-* attrs 4326 data = dataAttr( elem, key ); 4327 if ( data !== undefined ) { 4328 return data; 4329 } 4330 4331 // We tried really hard, but the data doesn't exist. 4332 return; 4333 } 4334 4335 // Set the data... 4336 this.each( function() { 4337 4338 // We always store the camelCased key 4339 dataUser.set( this, key, value ); 4340 } ); 4341 }, null, value, arguments.length > 1, null, true ); 4342 }, 4343 4344 removeData: function( key ) { 4345 return this.each( function() { 4346 dataUser.remove( this, key ); 4347 } ); 4348 } 4349} ); 4350 4351 4352jQuery.extend( { 4353 queue: function( elem, type, data ) { 4354 var queue; 4355 4356 if ( elem ) { 4357 type = ( type || "fx" ) + "queue"; 4358 queue = dataPriv.get( elem, type ); 4359 4360 // Speed up dequeue by getting out quickly if this is just a lookup 4361 if ( data ) { 4362 if ( !queue || Array.isArray( data ) ) { 4363 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 4364 } else { 4365 queue.push( data ); 4366 } 4367 } 4368 return queue || []; 4369 } 4370 }, 4371 4372 dequeue: function( elem, type ) { 4373 type = type || "fx"; 4374 4375 var queue = jQuery.queue( elem, type ), 4376 startLength = queue.length, 4377 fn = queue.shift(), 4378 hooks = jQuery._queueHooks( elem, type ), 4379 next = function() { 4380 jQuery.dequeue( elem, type ); 4381 }; 4382 4383 // If the fx queue is dequeued, always remove the progress sentinel 4384 if ( fn === "inprogress" ) { 4385 fn = queue.shift(); 4386 startLength--; 4387 } 4388 4389 if ( fn ) { 4390 4391 // Add a progress sentinel to prevent the fx queue from being 4392 // automatically dequeued 4393 if ( type === "fx" ) { 4394 queue.unshift( "inprogress" ); 4395 } 4396 4397 // Clear up the last queue stop function 4398 delete hooks.stop; 4399 fn.call( elem, next, hooks ); 4400 } 4401 4402 if ( !startLength && hooks ) { 4403 hooks.empty.fire(); 4404 } 4405 }, 4406 4407 // Not public - generate a queueHooks object, or return the current one 4408 _queueHooks: function( elem, type ) { 4409 var key = type + "queueHooks"; 4410 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 4411 empty: jQuery.Callbacks( "once memory" ).add( function() { 4412 dataPriv.remove( elem, [ type + "queue", key ] ); 4413 } ) 4414 } ); 4415 } 4416} ); 4417 4418jQuery.fn.extend( { 4419 queue: function( type, data ) { 4420 var setter = 2; 4421 4422 if ( typeof type !== "string" ) { 4423 data = type; 4424 type = "fx"; 4425 setter--; 4426 } 4427 4428 if ( arguments.length < setter ) { 4429 return jQuery.queue( this[ 0 ], type ); 4430 } 4431 4432 return data === undefined ? 4433 this : 4434 this.each( function() { 4435 var queue = jQuery.queue( this, type, data ); 4436 4437 // Ensure a hooks for this queue 4438 jQuery._queueHooks( this, type ); 4439 4440 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 4441 jQuery.dequeue( this, type ); 4442 } 4443 } ); 4444 }, 4445 dequeue: function( type ) { 4446 return this.each( function() { 4447 jQuery.dequeue( this, type ); 4448 } ); 4449 }, 4450 clearQueue: function( type ) { 4451 return this.queue( type || "fx", [] ); 4452 }, 4453 4454 // Get a promise resolved when queues of a certain type 4455 // are emptied (fx is the type by default) 4456 promise: function( type, obj ) { 4457 var tmp, 4458 count = 1, 4459 defer = jQuery.Deferred(), 4460 elements = this, 4461 i = this.length, 4462 resolve = function() { 4463 if ( !( --count ) ) { 4464 defer.resolveWith( elements, [ elements ] ); 4465 } 4466 }; 4467 4468 if ( typeof type !== "string" ) { 4469 obj = type; 4470 type = undefined; 4471 } 4472 type = type || "fx"; 4473 4474 while ( i-- ) { 4475 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 4476 if ( tmp && tmp.empty ) { 4477 count++; 4478 tmp.empty.add( resolve ); 4479 } 4480 } 4481 resolve(); 4482 return defer.promise( obj ); 4483 } 4484} ); 4485var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 4486 4487var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 4488 4489 4490var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 4491 4492var
vendor: 9,560 bytes, lines 4492-4878
4492documentElement = document.documentElement; 4493 4494 4495 4496 var isAttached = function( elem ) { 4497 return jQuery.contains( elem.ownerDocument, elem ); 4498 }, 4499 composed = { composed: true }; 4500 4501 // Check attachment across shadow DOM boundaries when possible (gh-3504) 4502 if ( documentElement.attachShadow ) { 4503 isAttached = function( elem ) { 4504 return jQuery.contains( elem.ownerDocument, elem ) || 4505 elem.getRootNode( composed ) === elem.ownerDocument; 4506 }; 4507 } 4508var isHiddenWithinTree = function( elem, el ) { 4509 4510 // isHiddenWithinTree might be called from jQuery#filter function; 4511 // in that case, element will be second argument 4512 elem = el || elem; 4513 4514 // Inline style trumps all 4515 return elem.style.display === "none" || 4516 elem.style.display === "" && 4517 4518 // Otherwise, check computed style 4519 // Support: Firefox <=43 - 45 4520 // Disconnected elements can have computed display: none, so first confirm that elem is 4521 // in the document. 4522 isAttached( elem ) && 4523 4524 jQuery.css( elem, "display" ) === "none"; 4525 }; 4526 4527var swap = function( elem, options, callback, args ) { 4528 var ret, name, 4529 old = {}; 4530 4531 // Remember the old values, and insert the new ones 4532 for ( name in options ) { 4533 old[ name ] = elem.style[ name ]; 4534 elem.style[ name ] = options[ name ]; 4535 } 4536 4537 ret = callback.apply( elem, args || [] ); 4538 4539 // Revert the old values 4540 for ( name in options ) { 4541 elem.style[ name ] = old[ name ]; 4542 } 4543 4544 return ret; 4545}; 4546 4547 4548 4549 4550function adjustCSS( elem, prop, valueParts, tween ) { 4551 var adjusted, scale, 4552 maxIterations = 20, 4553 currentValue = tween ? 4554 function() { 4555 return tween.cur(); 4556 } : 4557 function() { 4558 return jQuery.css( elem, prop, "" ); 4559 }, 4560 initial = currentValue(), 4561 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 4562 4563 // Starting value computation is required for potential unit mismatches 4564 initialInUnit = elem.nodeType && 4565 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 4566 rcssNum.exec( jQuery.css( elem, prop ) ); 4567 4568 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 4569 4570 // Support: Firefox <=54 4571 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 4572 initial = initial / 2; 4573 4574 // Trust units reported by jQuery.css 4575 unit = unit || initialInUnit[ 3 ]; 4576 4577 // Iteratively approximate from a nonzero starting point 4578 initialInUnit = +initial || 1; 4579 4580 while ( maxIterations-- ) { 4581 4582 // Evaluate and update our best guess (doubling guesses that zero out). 4583 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 4584 jQuery.style( elem, prop, initialInUnit + unit ); 4585 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 4586 maxIterations = 0; 4587 } 4588 initialInUnit = initialInUnit / scale; 4589 4590 } 4591 4592 initialInUnit = initialInUnit * 2; 4593 jQuery.style( elem, prop, initialInUnit + unit ); 4594 4595 // Make sure we update the tween properties later on 4596 valueParts = valueParts || []; 4597 } 4598 4599 if ( valueParts ) { 4600 initialInUnit = +initialInUnit || +initial || 0; 4601 4602 // Apply relative offset (+=/-=) if specified 4603 adjusted = valueParts[ 1 ] ? 4604 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 4605 +valueParts[ 2 ]; 4606 if ( tween ) { 4607 tween.unit = unit; 4608 tween.start = initialInUnit; 4609 tween.end = adjusted; 4610 } 4611 } 4612 return adjusted; 4613} 4614 4615 4616var defaultDisplayMap = {}; 4617 4618function getDefaultDisplay( elem ) { 4619 var temp, 4620 doc = elem.ownerDocument, 4621 nodeName = elem.nodeName, 4622 display = defaultDisplayMap[ nodeName ]; 4623 4624 if ( display ) { 4625 return display; 4626 } 4627 4628 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 4629 display = jQuery.css( temp, "display" ); 4630 4631 temp.parentNode.removeChild( temp ); 4632 4633 if ( display === "none" ) { 4634 display = "block"; 4635 } 4636 defaultDisplayMap[ nodeName ] = display; 4637 4638 return display; 4639} 4640 4641function showHide( elements, show ) { 4642 var display, elem, 4643 values = [], 4644 index = 0, 4645 length = elements.length; 4646 4647 // Determine new display value for elements that need to change 4648 for ( ; index < length; index++ ) { 4649 elem = elements[ index ]; 4650 if ( !elem.style ) { 4651 continue; 4652 } 4653 4654 display = elem.style.display; 4655 if ( show ) { 4656 4657 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 4658 // check is required in this first loop unless we have a nonempty display value (either 4659 // inline or about-to-be-restored) 4660 if ( display === "none" ) { 4661 values[ index ] = dataPriv.get( elem, "display" ) || null; 4662 if ( !values[ index ] ) { 4663 elem.style.display = ""; 4664 } 4665 } 4666 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 4667 values[ index ] = getDefaultDisplay( elem ); 4668 } 4669 } else { 4670 if ( display !== "none" ) { 4671 values[ index ] = "none"; 4672 4673 // Remember what we're overwriting 4674 dataPriv.set( elem, "display", display ); 4675 } 4676 } 4677 } 4678 4679 // Set the display of the elements in a second loop to avoid constant reflow 4680 for ( index = 0; index < length; index++ ) { 4681 if ( values[ index ] != null ) { 4682 elements[ index ].style.display = values[ index ]; 4683 } 4684 } 4685 4686 return elements; 4687} 4688 4689jQuery.fn.extend( { 4690 show: function() { 4691 return showHide( this, true ); 4692 }, 4693 hide: function() { 4694 return showHide( this ); 4695 }, 4696 toggle: function( state ) { 4697 if ( typeof state === "boolean" ) { 4698 return state ? this.show() : this.hide(); 4699 } 4700 4701 return this.each( function() { 4702 if ( isHiddenWithinTree( this ) ) { 4703 jQuery( this ).show(); 4704 } else { 4705 jQuery( this ).hide(); 4706 } 4707 } ); 4708 } 4709} ); 4710var rcheckableType = ( /^(?:checkbox|radio)$/i ); 4711 4712var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); 4713 4714var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 4715 4716 4717 4718// We have to close these tags to support XHTML (#13200) 4719var wrapMap = { 4720 4721 // Support: IE <=9 only 4722 option: [ 1, "<select multiple='multiple'>", "</select>" ], 4723 4724 // XHTML parsers do not magically insert elements in the 4725 // same way that tag soup parsers do. So we cannot shorten 4726 // this by omitting <tbody> or other required elements. 4727 thead: [ 1, "<table>", "</table>" ], 4728 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 4729 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 4730 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 4731 4732 _default: [ 0, "", "" ] 4733}; 4734 4735// Support: IE <=9 only 4736wrapMap.optgroup = wrapMap.option; 4737 4738wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 4739wrapMap.th = wrapMap.td; 4740 4741 4742function getAll( context, tag ) { 4743 4744 // Support: IE <=9 - 11 only 4745 // Use typeof to avoid zero-argument method invocation on host objects (#15151) 4746 var ret; 4747 4748 if ( typeof context.getElementsByTagName !== "undefined" ) { 4749 ret = context.getElementsByTagName( tag || "*" ); 4750 4751 } else if ( typeof context.querySelectorAll !== "undefined" ) { 4752 ret = context.querySelectorAll( tag || "*" ); 4753 4754 } else { 4755 ret = []; 4756 } 4757 4758 if ( tag === undefined || tag && nodeName( context, tag ) ) { 4759 return jQuery.merge( [ context ], ret ); 4760 } 4761 4762 return ret; 4763} 4764 4765 4766// Mark scripts as having already been evaluated 4767function setGlobalEval( elems, refElements ) { 4768 var i = 0, 4769 l = elems.length; 4770 4771 for ( ; i < l; i++ ) { 4772 dataPriv.set( 4773 elems[ i ], 4774 "globalEval", 4775 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 4776 ); 4777 } 4778} 4779 4780 4781var rhtml = /<|&#?\w+;/; 4782 4783function buildFragment( elems, context, scripts, selection, ignored ) { 4784 var elem, tmp, tag, wrap, attached, j, 4785 fragment = context.createDocumentFragment(), 4786 nodes = [], 4787 i = 0, 4788 l = elems.length; 4789 4790 for ( ; i < l; i++ ) { 4791 elem = elems[ i ]; 4792 4793 if ( elem || elem === 0 ) { 4794 4795 // Add nodes directly 4796 if ( toType( elem ) === "object" ) { 4797 4798 // Support: Android <=4.0 only, PhantomJS 1 only 4799 // push.apply(_, arraylike) throws on ancient WebKit 4800 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 4801 4802 // Convert non-html into a text node 4803 } else if ( !rhtml.test( elem ) ) { 4804 nodes.push( context.createTextNode( elem ) ); 4805 4806 // Convert html into DOM nodes 4807 } else { 4808 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 4809 4810 // Deserialize a standard representation 4811 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 4812 wrap = wrapMap[ tag ] || wrapMap._default; 4813 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 4814 4815 // Descend through wrappers to the right content 4816 j = wrap[ 0 ]; 4817 while ( j-- ) { 4818 tmp = tmp.lastChild; 4819 } 4820 4821 // Support: Android <=4.0 only, PhantomJS 1 only 4822 // push.apply(_, arraylike) throws on ancient WebKit 4823 jQuery.merge( nodes, tmp.childNodes ); 4824 4825 // Remember the top-level container 4826 tmp = fragment.firstChild; 4827 4828 // Ensure the created nodes are orphaned (#12392) 4829 tmp.textContent = ""; 4830 } 4831 } 4832 } 4833 4834 // Remove wrapper from fragment 4835 fragment.textContent = ""; 4836 4837 i = 0; 4838 while ( ( elem = nodes[ i++ ] ) ) { 4839 4840 // Skip elements already in the context collection (trac-4087) 4841 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 4842 if ( ignored ) { 4843 ignored.push( elem ); 4844 } 4845 continue; 4846 } 4847 4848 attached = isAttached( elem ); 4849 4850 // Append to fragment 4851 tmp = getAll( fragment.appendChild( elem ), "script" ); 4852 4853 // Preserve script evaluation history 4854 if ( attached ) { 4855 setGlobalEval( tmp ); 4856 } 4857 4858 // Capture executables 4859 if ( scripts ) { 4860 j = 0; 4861 while ( ( elem = tmp[ j++ ] ) ) { 4862 if ( rscriptType.test( elem.type || "" ) ) { 4863 scripts.push( elem ); 4864 } 4865 } 4866 } 4867 } 4868 4869 return fragment; 4870} 4871 4872 4873( function() { 4874 var fragment = document.createDocumentFragment(), 4875 div = fragment.appendChild( document.createElement( "div" ) ), 4876 input = document.createElement( "input" ); 4877 4878 // Support: Android 4.0 - 4.3 only
vendor: 11,062 bytes, lines 4879-5261
4879 // Check state lost if the name is set (#11217) 4880 // Support: Windows Web Apps (WWA) 4881 // `name` and `type` must use .setAttribute for WWA (#14901) 4882 input.setAttribute( "type", "radio" ); 4883 input.setAttribute( "checked", "checked" ); 4884 input.setAttribute( "name", "t" ); 4885 4886 div.appendChild( input ); 4887 4888 // Support: Android <=4.1 only 4889 // Older WebKit doesn't clone checked state correctly in fragments 4890 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 4891 4892 // Support: IE <=11 only 4893 // Make sure textarea (and checkbox) defaultValue is properly cloned 4894 div.innerHTML = "<textarea>x</textarea>"; 4895 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 4896} )(); 4897 4898 4899var 4900 rkeyEvent = /^key/, 4901 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, 4902 rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 4903 4904function returnTrue() { 4905 return true; 4906} 4907 4908function returnFalse() { 4909 return false; 4910} 4911 4912// Support: IE <=9 - 11+ 4913// focus() and blur() are asynchronous, except when they are no-op. 4914// So expect focus to be synchronous when the element is already active, 4915// and blur to be synchronous when the element is not already active. 4916// (focus and blur are always synchronous in other supported browsers, 4917// this just defines when we can count on it). 4918function expectSync( elem, type ) { 4919 return ( elem === safeActiveElement() ) === ( type === "focus" ); 4920} 4921 4922// Support: IE <=9 only 4923// Accessing document.activeElement can throw unexpectedly 4924// https://bugs.jquery.com/ticket/13393 4925function safeActiveElement() { 4926 try { 4927 return document.activeElement; 4928 } catch ( err ) { } 4929} 4930 4931function on( elem, types, selector, data, fn, one ) { 4932 var origFn, type; 4933 4934 // Types can be a map of types/handlers 4935 if ( typeof types === "object" ) { 4936 4937 // ( types-Object, selector, data ) 4938 if ( typeof selector !== "string" ) { 4939 4940 // ( types-Object, data ) 4941 data = data || selector; 4942 selector = undefined; 4943 } 4944 for ( type in types ) { 4945 on( elem, type, selector, data, types[ type ], one ); 4946 } 4947 return elem; 4948 } 4949 4950 if ( data == null && fn == null ) { 4951 4952 // ( types, fn ) 4953 fn = selector; 4954 data = selector = undefined; 4955 } else if ( fn == null ) { 4956 if ( typeof selector === "string" ) { 4957 4958 // ( types, selector, fn ) 4959 fn = data; 4960 data = undefined; 4961 } else { 4962 4963 // ( types, data, fn ) 4964 fn = data; 4965 data = selector; 4966 selector = undefined; 4967 } 4968 } 4969 if ( fn === false ) { 4970 fn = returnFalse; 4971 } else if ( !fn ) { 4972 return elem; 4973 } 4974 4975 if ( one === 1 ) { 4976 origFn = fn; 4977 fn = function( event ) { 4978 4979 // Can use an empty set, since event contains the info 4980 jQuery().off( event ); 4981 return origFn.apply( this, arguments ); 4982 }; 4983 4984 // Use same guid so caller can remove using origFn 4985 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 4986 } 4987 return elem.each( function() { 4988 jQuery.event.add( this, types, fn, data, selector ); 4989 } ); 4990} 4991 4992/* 4993 * Helper functions for managing events -- not part of the public interface. 4994 * Props to Dean Edwards' addEvent library for many of the ideas. 4995 */ 4996jQuery.event = { 4997 4998 global: {}, 4999 5000 add: function( elem, types, handler, data, selector ) { 5001 5002 var handleObjIn, eventHandle, tmp, 5003 events, t, handleObj, 5004 special, handlers, type, namespaces, origType, 5005 elemData = dataPriv.get( elem ); 5006 5007 // Don't attach events to noData or text/comment nodes (but allow plain objects) 5008 if ( !elemData ) { 5009 return; 5010 } 5011 5012 // Caller can pass in an object of custom data in lieu of the handler 5013 if ( handler.handler ) { 5014 handleObjIn = handler; 5015 handler = handleObjIn.handler; 5016 selector = handleObjIn.selector; 5017 } 5018 5019 // Ensure that invalid selectors throw exceptions at attach time 5020 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 5021 if ( selector ) { 5022 jQuery.find.matchesSelector( documentElement, selector ); 5023 } 5024 5025 // Make sure that the handler has a unique ID, used to find/remove it later 5026 if ( !handler.guid ) { 5027 handler.guid = jQuery.guid++; 5028 } 5029 5030 // Init the element's event structure and main handler, if this is the first 5031 if ( !( events = elemData.events ) ) { 5032 events = elemData.events = {}; 5033 } 5034 if ( !( eventHandle = elemData.handle ) ) { 5035 eventHandle = elemData.handle = function( e ) { 5036 5037 // Discard the second event of a jQuery.event.trigger() and 5038 // when an event is called after a page has unloaded 5039 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 5040 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 5041 }; 5042 } 5043 5044 // Handle multiple events separated by a space 5045 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 5046 t = types.length; 5047 while ( t-- ) { 5048 tmp = rtypenamespace.exec( types[ t ] ) || []; 5049 type = origType = tmp[ 1 ]; 5050 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5051 5052 // There *must* be a type, no attaching namespace-only handlers 5053 if ( !type ) { 5054 continue; 5055 } 5056 5057 // If event changes its type, use the special event handlers for the changed type 5058 special = jQuery.event.special[ type ] || {}; 5059 5060 // If selector defined, determine special event api type, otherwise given type 5061 type = ( selector ? special.delegateType : special.bindType ) || type; 5062 5063 // Update special based on newly reset type 5064 special = jQuery.event.special[ type ] || {}; 5065 5066 // handleObj is passed to all event handlers 5067 handleObj = jQuery.extend( { 5068 type: type, 5069 origType: origType, 5070 data: data, 5071 handler: handler, 5072 guid: handler.guid, 5073 selector: selector, 5074 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 5075 namespace: namespaces.join( "." ) 5076 }, handleObjIn ); 5077 5078 // Init the event handler queue if we're the first 5079 if ( !( handlers = events[ type ] ) ) { 5080 handlers = events[ type ] = []; 5081 handlers.delegateCount = 0; 5082 5083 // Only use addEventListener if the special events handler returns false 5084 if ( !special.setup || 5085 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 5086 5087 if ( elem.addEventListener ) { 5088 elem.addEventListener( type, eventHandle ); 5089 } 5090 } 5091 } 5092 5093 if ( special.add ) { 5094 special.add.call( elem, handleObj ); 5095 5096 if ( !handleObj.handler.guid ) { 5097 handleObj.handler.guid = handler.guid; 5098 } 5099 } 5100 5101 // Add to the element's handler list, delegates in front 5102 if ( selector ) { 5103 handlers.splice( handlers.delegateCount++, 0, handleObj ); 5104 } else { 5105 handlers.push( handleObj ); 5106 } 5107 5108 // Keep track of which events have ever been used, for event optimization 5109 jQuery.event.global[ type ] = true; 5110 } 5111 5112 }, 5113 5114 // Detach an event or set of events from an element 5115 remove: function( elem, types, handler, selector, mappedTypes ) { 5116 5117 var j, origCount, tmp, 5118 events, t, handleObj, 5119 special, handlers, type, namespaces, origType, 5120 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 5121 5122 if ( !elemData || !( events = elemData.events ) ) { 5123 return; 5124 } 5125 5126 // Once for each type.namespace in types; type may be omitted 5127 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 5128 t = types.length; 5129 while ( t-- ) { 5130 tmp = rtypenamespace.exec( types[ t ] ) || []; 5131 type = origType = tmp[ 1 ]; 5132 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5133 5134 // Unbind all events (on this namespace, if provided) for the element 5135 if ( !type ) { 5136 for ( type in events ) { 5137 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 5138 } 5139 continue; 5140 } 5141 5142 special = jQuery.event.special[ type ] || {}; 5143 type = ( selector ? special.delegateType : special.bindType ) || type; 5144 handlers = events[ type ] || []; 5145 tmp = tmp[ 2 ] && 5146 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 5147 5148 // Remove matching events 5149 origCount = j = handlers.length; 5150 while ( j-- ) { 5151 handleObj = handlers[ j ]; 5152 5153 if ( ( mappedTypes || origType === handleObj.origType ) && 5154 ( !handler || handler.guid === handleObj.guid ) && 5155 ( !tmp || tmp.test( handleObj.namespace ) ) && 5156 ( !selector || selector === handleObj.selector || 5157 selector === "**" && handleObj.selector ) ) { 5158 handlers.splice( j, 1 ); 5159 5160 if ( handleObj.selector ) { 5161 handlers.delegateCount--; 5162 } 5163 if ( special.remove ) { 5164 special.remove.call( elem, handleObj ); 5165 } 5166 } 5167 } 5168 5169 // Remove generic event handler if we removed something and no more handlers exist 5170 // (avoids potential for endless recursion during removal of special event handlers) 5171 if ( origCount && !handlers.length ) { 5172 if ( !special.teardown || 5173 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 5174 5175 jQuery.removeEvent( elem, type, elemData.handle ); 5176 } 5177 5178 delete events[ type ]; 5179 } 5180 } 5181 5182 // Remove data and the expando if it's no longer used 5183 if ( jQuery.isEmptyObject( events ) ) { 5184 dataPriv.remove( elem, "handle events" ); 5185 } 5186 }, 5187 5188 dispatch: function( nativeEvent ) { 5189 5190 // Make a writable jQuery.Event from the native event object 5191 var event = jQuery.event.fix( nativeEvent ); 5192 5193 var i, j, ret, matched, handleObj, handlerQueue, 5194 args = new Array( arguments.length ), 5195 handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [], 5196 special = jQuery.event.special[ event.type ] || {}; 5197 5198 // Use the fix-ed jQuery.Event rather than the (read-only) native event 5199 args[ 0 ] = event; 5200 5201 for ( i = 1; i < arguments.length; i++ ) { 5202 args[ i ] = arguments[ i ]; 5203 } 5204 5205 event.delegateTarget = this; 5206 5207 // Call the preDispatch hook for the mapped type, and let it bail if desired 5208 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 5209 return; 5210 } 5211 5212 // Determine handlers 5213 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 5214 5215 // Run delegates first; they may want to stop propagation beneath us 5216 i = 0; 5217 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 5218 event.currentTarget = matched.elem; 5219 5220 j = 0; 5221 while ( ( handleObj = matched.handlers[ j++ ] ) && 5222 !event.isImmediatePropagationStopped() ) { 5223 5224 // If the event is namespaced, then each handler is only invoked if it is 5225 // specially universal or its namespaces are a superset of the event's. 5226 if ( !event.rnamespace || handleObj.namespace === false || 5227 event.rnamespace.test( handleObj.namespace ) ) { 5228 5229 event.handleObj = handleObj; 5230 event.data = handleObj.data; 5231 5232 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 5233 handleObj.handler ).apply( matched.elem, args ); 5234 5235 if ( ret !== undefined ) { 5236 if ( ( event.result = ret ) === false ) { 5237 event.preventDefault(); 5238 event.stopPropagation(); 5239 } 5240 } 5241 } 5242 } 5243 } 5244 5245 // Call the postDispatch hook for the mapped type 5246 if ( special.postDispatch ) { 5247 special.postDispatch.call( this, event ); 5248 } 5249 5250 return event.result; 5251 }, 5252 5253 handlers: function( event, handlers ) { 5254 var i, handleObj, sel, matchedHandlers, matchedSelectors, 5255 handlerQueue = [], 5256 delegateCount = handlers.delegateCount, 5257 cur = event.target; 5258 5259 // Find delegate handlers 5260 if ( delegateCount && 5261
vendor: 4,119 bytes, lines 5262-5403
5262 // Support: IE <=9 5263 // Black-hole SVG <use> instance trees (trac-13180) 5264 cur.nodeType && 5265 5266 // Support: Firefox <=42 5267 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 5268 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 5269 // Support: IE 11 only 5270 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 5271 !( event.type === "click" && event.button >= 1 ) ) { 5272 5273 for ( ; cur !== this; cur = cur.parentNode || this ) { 5274 5275 // Don't check non-elements (#13208) 5276 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) 5277 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 5278 matchedHandlers = []; 5279 matchedSelectors = {}; 5280 for ( i = 0; i < delegateCount; i++ ) { 5281 handleObj = handlers[ i ]; 5282 5283 // Don't conflict with Object.prototype properties (#13203) 5284 sel = handleObj.selector + " "; 5285 5286 if ( matchedSelectors[ sel ] === undefined ) { 5287 matchedSelectors[ sel ] = handleObj.needsContext ? 5288 jQuery( sel, this ).index( cur ) > -1 : 5289 jQuery.find( sel, this, null, [ cur ] ).length; 5290 } 5291 if ( matchedSelectors[ sel ] ) { 5292 matchedHandlers.push( handleObj ); 5293 } 5294 } 5295 if ( matchedHandlers.length ) { 5296 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 5297 } 5298 } 5299 } 5300 } 5301 5302 // Add the remaining (directly-bound) handlers 5303 cur = this; 5304 if ( delegateCount < handlers.length ) { 5305 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 5306 } 5307 5308 return handlerQueue; 5309 }, 5310 5311 addProp: function( name, hook ) { 5312 Object.defineProperty( jQuery.Event.prototype, name, { 5313 enumerable: true, 5314 configurable: true, 5315 5316 get: isFunction( hook ) ? 5317 function() { 5318 if ( this.originalEvent ) { 5319 return hook( this.originalEvent ); 5320 } 5321 } : 5322 function() { 5323 if ( this.originalEvent ) { 5324 return this.originalEvent[ name ]; 5325 } 5326 }, 5327 5328 set: function( value ) { 5329 Object.defineProperty( this, name, { 5330 enumerable: true, 5331 configurable: true, 5332 writable: true, 5333 value: value 5334 } ); 5335 } 5336 } ); 5337 }, 5338 5339 fix: function( originalEvent ) { 5340 return originalEvent[ jQuery.expando ] ? 5341 originalEvent : 5342 new jQuery.Event( originalEvent ); 5343 }, 5344 5345 special: { 5346 load: { 5347 5348 // Prevent triggered image.load events from bubbling to window.load 5349 noBubble: true 5350 }, 5351 click: { 5352 5353 // Utilize native event to ensure correct state for checkable inputs 5354 setup: function( data ) { 5355 5356 // For mutual compressibility with _default, replace `this` access with a local var. 5357 // `|| data` is dead code meant only to preserve the variable through minification. 5358 var el = this || data; 5359 5360 // Claim the first handler 5361 if ( rcheckableType.test( el.type ) && 5362 el.click && nodeName( el, "input" ) && 5363 dataPriv.get( el, "click" ) === undefined ) { 5364 5365 // dataPriv.set( el, "click", ... ) 5366 leverageNative( el, "click", returnTrue ); 5367 } 5368 5369 // Return false to allow normal processing in the caller 5370 return false; 5371 }, 5372 trigger: function( data ) { 5373 5374 // For mutual compressibility with _default, replace `this` access with a local var. 5375 // `|| data` is dead code meant only to preserve the variable through minification. 5376 var el = this || data; 5377 5378 // Force setup before triggering a click 5379 if ( rcheckableType.test( el.type ) && 5380 el.click && nodeName( el, "input" ) && 5381 dataPriv.get( el, "click" ) === undefined ) { 5382 5383 leverageNative( el, "click" ); 5384 } 5385 5386 // Return non-false to allow normal event-path propagation 5387 return true; 5388 }, 5389 5390 // For cross-browser consistency, suppress native .click() on links 5391 // Also prevent it if we're currently inside a leveraged native-event stack 5392 _default: function( event ) { 5393 var target = event.target; 5394 return rcheckableType.test( target.type ) && 5395 target.click && nodeName( target, "input" ) && 5396 dataPriv.get( target, "click" ) || 5397 nodeName( target, "a" ); 5398 } 5399 }, 5400 5401 beforeunload: { 5402 postDispatch: function( event ) { 5403
5404 // Support: Firefox 20+ 5405 // Firefox doesn't alert if the returnValue field is not set. 5406 if ( event.result !== undefined && event.originalEvent ) { 5407 event.originalEvent.returnValue = event.result; 5408 } 5409 } 5410 } 5411 } 5412}; 5413 5414// Ensure the presence of an event listener that handles manually-triggered 5415// synthetic events by interrupting progress until reinvoked in response to 5416// *native* events that it fires directly, ensuring that state changes have 5417// already occurred before other listeners are invoked. 5418function leverageNative( el, type, expectSync ) { 5419 5420 // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add 5421 if ( !expectSync ) { 5422 jQuery.event.add( el, type, returnTrue ); 5423 return; 5424 } 5425 5426 // Register the controller as a special universal handler for all event namespaces 5427 dataPriv.set( el, type, false ); 5428 jQuery.event.add( el, type, { 5429 namespace: false, 5430 handler: function( event ) { 5431 var notAsync, result, 5432 saved = dataPriv.get( this, type ); 5433 5434 if ( ( event.isTrigger & 1 ) && this[ type ] ) { 5435 5436 // Interrupt processing of the outer synthetic .trigger()ed event 5437 if ( !saved ) { 5438 5439 // Store arguments for use when handling the inner native event 5440 saved = slice.call( arguments ); 5441 dataPriv.set( this, type, saved ); 5442 5443 // Trigger the native event and capture its result 5444 // Support: IE <=9 - 11+ 5445 // focus() and blur() are asynchronous 5446 notAsync = expectSync( this, type ); 5447 this[ type ](); 5448 result = dataPriv.get( this, type ); 5449 if ( saved !== result || notAsync ) { 5450 dataPriv.set( this, type, false ); 5451 } else { 5452 result = undefined; 5453 } 5454 if ( saved !== result ) { 5455 5456 // Cancel the outer synthetic event 5457 event.stopImmediatePropagation(); 5458 event.preventDefault(); 5459 return result; 5460 } 5461 5462 // If this is an inner synthetic event for an event with a bubbling surrogate 5463 // (focus or blur), assume that the surrogate already propagated from triggering the 5464 // native event and prevent that from happening again here. 5465 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 5466 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 5467 // less bad than duplication. 5468 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { 5469 event.stopPropagation(); 5470 } 5471 5472 // If this is a native event triggered above, everything is now in order 5473 // Fire an inner synthetic event with the original arguments 5474 } else if ( saved ) { 5475 5476 // ...and capture the result 5477 dataPriv.set( this, type, jQuery.event.trigger( 5478 5479 // Support: IE <=9 - 11+ 5480 // Extend with the prototype to reset the above stopImmediatePropagation() 5481 jQuery.extend( saved.shift(), jQuery.Event.prototype ), 5482 saved, 5483 this 5484 ) ); 5485 5486 // Abort handling of the native event 5487 event.stopImmediatePropagation(); 5488 } 5489 } 5490 } ); 5491} 5492 5493jQuery.removeEvent = function( elem, type, handle ) { 5494 5495 // This "if" is needed for plain objects 5496 if ( elem.removeEventListener ) { 5497 elem.removeEventListener( type, handle ); 5498 } 5499}; 5500 5501jQuery.Event = function( src, props ) { 5502 5503 // Allow instantiation without the 'new' keyword 5504 if ( !( this instanceof jQuery.Event ) ) { 5505 return new jQuery.Event( src, props ); 5506 } 5507 5508 // Event object 5509 if ( src && src.type ) { 5510 this.originalEvent = src; 5511 this.type = src.type; 5512 5513 // Events bubbling up the document may have been marked as prevented 5514 // by a handler lower down the tree; reflect the correct value. 5515 this.isDefaultPrevented = src.defaultPrevented || 5516 src.defaultPrevented === undefined && 5517 5518 // Support: Android <=2.3 only 5519 src.returnValue === false ? 5520 returnTrue : 5521 returnFalse; 5522 5523 // Create target properties 5524 // Support: Safari <=6 - 7 only 5525 // Target should not be a text node (#504, #13143) 5526 this.target = ( src.target && src.target.nodeType === 3 ) ? 5527 src.target.parentNode : 5528 src.target; 5529 5530 this.currentTarget = src.currentTarget; 5531 this.relatedTarget = src.relatedTarget; 5532 5533 // Event type 5534 } else { 5535 this.type = src; 5536 } 5537 5538 // Put explicitly provided properties onto the event object 5539 if ( props ) { 5540 jQuery.extend( this, props ); 5541 } 5542 5543 // Create a timestamp if incoming event doesn't have one 5544 this.timeStamp = src && src.timeStamp || Date.now(); 5545 5546 // Mark it as fixed 5547 this[ jQuery.expando ] = true; 5548}; 5549 5550// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 5551// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 5552jQuery.Event.prototype = { 5553 constructor: jQuery.Event, 5554 isDefaultPrevented: returnFalse, 5555 isPropagationStopped: returnFalse, 5556 isImmediatePropagationStopped: returnFalse, 5557 isSimulated: false, 5558 5559 preventDefault: function() { 5560 var e = this.originalEvent; 5561 5562 this.isDefaultPrevented = returnTrue; 5563 5564 if ( e && !this.isSimulated ) { 5565 e.preventDefault(); 5566 } 5567 }, 5568 stopPropagation: function() { 5569 var e = this.originalEvent; 5570 5571 this.isPropagationStopped = returnTrue; 5572 5573 if ( e && !this.isSimulated ) { 5574 e.stopPropagation(); 5575 } 5576 }, 5577 stopImmediatePropagation: function() { 5578 var e = this.originalEvent; 5579 5580 this.isImmediatePropagationStopped = returnTrue; 5581 5582 if ( e && !this.isSimulated ) { 5583 e.stopImmediatePropagation(); 5584 } 5585 5586 this.stopPropagation(); 5587 } 5588}; 5589 5590// Includes all common event props including KeyEvent and MouseEvent specific props 5591jQuery.each( { 5592 altKey: true, 5593 bubbles: true, 5594 cancelable: true, 5595 changedTouches: true, 5596 ctrlKey: true, 5597 detail: true, 5598 eventPhase: true, 5599 metaKey: true, 5600 pageX: true, 5601 pageY: true, 5602 shiftKey: true, 5603 view: true, 5604 "char": true, 5605 code: true, 5606 charCode: true, 5607 key: true, 5608 keyCode: true, 5609 button: true, 5610 buttons: true, 5611 clientX: true, 5612 clientY: true, 5613 offsetX: true, 5614 offsetY: true, 5615 pointerId: true, 5616 pointerType: true, 5617 screenX: true, 5618 screenY: true, 5619 targetTouches: true, 5620 toElement: true, 5621 touches: true, 5622 5623 which: function( event ) { 5624 var button = event.button; 5625 5626 // Add which for key events 5627 if ( event.which == null && rkeyEvent.test( event.type ) ) { 5628 return event.charCode != null ? event.charCode : event.keyCode; 5629 } 5630 5631 // Add which for click: 1 === left; 2 === middle; 3 === right 5632 if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) { 5633 if ( button & 1 ) { 5634 return 1; 5635 } 5636 5637 if ( button & 2 ) { 5638 return 3; 5639 } 5640 5641 if ( button & 4 ) { 5642 return 2; 5643 } 5644 5645 return 0; 5646 } 5647 5648 return event.which; 5649 } 5650}, jQuery.event.addProp ); 5651 5652jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { 5653 jQuery.event.special[ type ] = { 5654 5655 // Utilize native event if possible so blur/focus sequence is correct 5656 setup: function() { 5657 5658 // Claim the first handler 5659 // dataPriv.set( this, "focus", ... ) 5660 // dataPriv.set( this, "blur", ... ) 5661 leverageNative( this, type, expectSync ); 5662 5663 // Return false to allow normal processing in the caller 5664 return false;
vendor: 8,337 bytes, lines 5665-5975
5665 }, 5666 trigger: function() { 5667 5668 // Force setup before trigger 5669 leverageNative( this, type ); 5670 5671 // Return non-false to allow normal event-path propagation 5672 return true; 5673 }, 5674 5675 delegateType: delegateType 5676 }; 5677} ); 5678 5679// Create mouseenter/leave events using mouseover/out and event-time checks 5680// so that event delegation works in jQuery. 5681// Do the same for pointerenter/pointerleave and pointerover/pointerout 5682// 5683// Support: Safari 7 only 5684// Safari sends mouseenter too often; see: 5685// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 5686// for the description of the bug (it existed in older Chrome versions as well). 5687jQuery.each( { 5688 mouseenter: "mouseover", 5689 mouseleave: "mouseout", 5690 pointerenter: "pointerover", 5691 pointerleave: "pointerout" 5692}, function( orig, fix ) { 5693 jQuery.event.special[ orig ] = { 5694 delegateType: fix, 5695 bindType: fix, 5696 5697 handle: function( event ) { 5698 var ret, 5699 target = this, 5700 related = event.relatedTarget, 5701 handleObj = event.handleObj; 5702 5703 // For mouseenter/leave call the handler if related is outside the target. 5704 // NB: No relatedTarget if the mouse left/entered the browser window 5705 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 5706 event.type = handleObj.origType; 5707 ret = handleObj.handler.apply( this, arguments ); 5708 event.type = fix; 5709 } 5710 return ret; 5711 } 5712 }; 5713} ); 5714 5715jQuery.fn.extend( { 5716 5717 on: function( types, selector, data, fn ) { 5718 return on( this, types, selector, data, fn ); 5719 }, 5720 one: function( types, selector, data, fn ) { 5721 return on( this, types, selector, data, fn, 1 ); 5722 }, 5723 off: function( types, selector, fn ) { 5724 var handleObj, type; 5725 if ( types && types.preventDefault && types.handleObj ) { 5726 5727 // ( event ) dispatched jQuery.Event 5728 handleObj = types.handleObj; 5729 jQuery( types.delegateTarget ).off( 5730 handleObj.namespace ? 5731 handleObj.origType + "." + handleObj.namespace : 5732 handleObj.origType, 5733 handleObj.selector, 5734 handleObj.handler 5735 ); 5736 return this; 5737 } 5738 if ( typeof types === "object" ) { 5739 5740 // ( types-object [, selector] ) 5741 for ( type in types ) { 5742 this.off( type, selector, types[ type ] ); 5743 } 5744 return this; 5745 } 5746 if ( selector === false || typeof selector === "function" ) { 5747 5748 // ( types [, fn] ) 5749 fn = selector; 5750 selector = undefined; 5751 } 5752 if ( fn === false ) { 5753 fn = returnFalse; 5754 } 5755 return this.each( function() { 5756 jQuery.event.remove( this, types, fn, selector ); 5757 } ); 5758 } 5759} ); 5760 5761 5762var 5763 5764 /* eslint-disable max-len */ 5765 5766 // See https://github.com/eslint/eslint/issues/3229 5767 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi, 5768 5769 /* eslint-enable */ 5770 5771 // Support: IE <=10 - 11, Edge 12 - 13 only 5772 // In IE/Edge using regex groups here causes severe slowdowns. 5773 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 5774 rnoInnerhtml = /<script|<style|<link/i, 5775 5776 // checked="checked" or checked 5777 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 5778 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; 5779 5780// Prefer a tbody over its parent table for containing new rows 5781function manipulationTarget( elem, content ) { 5782 if ( nodeName( elem, "table" ) && 5783 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 5784 5785 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 5786 } 5787 5788 return elem; 5789} 5790 5791// Replace/restore the type attribute of script elements for safe DOM manipulation 5792function disableScript( elem ) { 5793 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 5794 return elem; 5795} 5796function restoreScript( elem ) { 5797 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 5798 elem.type = elem.type.slice( 5 ); 5799 } else { 5800 elem.removeAttribute( "type" ); 5801 } 5802 5803 return elem; 5804} 5805 5806function cloneCopyEvent( src, dest ) { 5807 var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events; 5808 5809 if ( dest.nodeType !== 1 ) { 5810 return; 5811 } 5812 5813 // 1. Copy private data: events, handlers, etc. 5814 if ( dataPriv.hasData( src ) ) { 5815 pdataOld = dataPriv.access( src ); 5816 pdataCur = dataPriv.set( dest, pdataOld ); 5817 events = pdataOld.events; 5818 5819 if ( events ) { 5820 delete pdataCur.handle; 5821 pdataCur.events = {}; 5822 5823 for ( type in events ) { 5824 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 5825 jQuery.event.add( dest, type, events[ type ][ i ] ); 5826 } 5827 } 5828 } 5829 } 5830 5831 // 2. Copy user data 5832 if ( dataUser.hasData( src ) ) { 5833 udataOld = dataUser.access( src ); 5834 udataCur = jQuery.extend( {}, udataOld ); 5835 5836 dataUser.set( dest, udataCur ); 5837 } 5838} 5839 5840// Fix IE bugs, see support tests 5841function fixInput( src, dest ) { 5842 var nodeName = dest.nodeName.toLowerCase(); 5843 5844 // Fails to persist the checked state of a cloned checkbox or radio button. 5845 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 5846 dest.checked = src.checked; 5847 5848 // Fails to return the selected option to the default selected state when cloning options 5849 } else if ( nodeName === "input" || nodeName === "textarea" ) { 5850 dest.defaultValue = src.defaultValue; 5851 } 5852} 5853 5854function domManip( collection, args, callback, ignored ) { 5855 5856 // Flatten any nested arrays 5857 args = concat.apply( [], args ); 5858 5859 var fragment, first, scripts, hasScripts, node, doc, 5860 i = 0, 5861 l = collection.length, 5862 iNoClone = l - 1, 5863 value = args[ 0 ], 5864 valueIsFunction = isFunction( value ); 5865 5866 // We can't cloneNode fragments that contain checked, in WebKit 5867 if ( valueIsFunction || 5868 ( l > 1 && typeof value === "string" && 5869 !support.checkClone && rchecked.test( value ) ) ) { 5870 return collection.each( function( index ) { 5871 var self = collection.eq( index ); 5872 if ( valueIsFunction ) { 5873 args[ 0 ] = value.call( this, index, self.html() ); 5874 } 5875 domManip( self, args, callback, ignored ); 5876 } ); 5877 } 5878 5879 if ( l ) { 5880 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 5881 first = fragment.firstChild; 5882 5883 if ( fragment.childNodes.length === 1 ) { 5884 fragment = first; 5885 } 5886 5887 // Require either new content or an interest in ignored elements to invoke the callback 5888 if ( first || ignored ) { 5889 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 5890 hasScripts = scripts.length; 5891 5892 // Use the original fragment for the last item 5893 // instead of the first because it can end up 5894 // being emptied incorrectly in certain situations (#8070). 5895 for ( ; i < l; i++ ) { 5896 node = fragment; 5897 5898 if ( i !== iNoClone ) { 5899 node = jQuery.clone( node, true, true ); 5900 5901 // Keep references to cloned scripts for later restoration 5902 if ( hasScripts ) { 5903 5904 // Support: Android <=4.0 only, PhantomJS 1 only 5905 // push.apply(_, arraylike) throws on ancient WebKit 5906 jQuery.merge( scripts, getAll( node, "script" ) ); 5907 } 5908 } 5909 5910 callback.call( collection[ i ], node, i ); 5911 } 5912 5913 if ( hasScripts ) { 5914 doc = scripts[ scripts.length - 1 ].ownerDocument; 5915 5916 // Reenable scripts 5917 jQuery.map( scripts, restoreScript ); 5918 5919 // Evaluate executable scripts on first document insertion 5920 for ( i = 0; i < hasScripts; i++ ) { 5921 node = scripts[ i ]; 5922 if ( rscriptType.test( node.type || "" ) && 5923 !dataPriv.access( node, "globalEval" ) && 5924 jQuery.contains( doc, node ) ) { 5925 5926 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 5927 5928 // Optional AJAX dependency, but won't run scripts if not present 5929 if ( jQuery._evalUrl && !node.noModule ) { 5930 jQuery._evalUrl( node.src, { 5931 nonce: node.nonce || node.getAttribute( "nonce" ) 5932 } ); 5933 } 5934 } else { 5935 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); 5936 } 5937 } 5938 } 5939 } 5940 } 5941 } 5942 5943 return collection; 5944} 5945 5946function remove( elem, selector, keepData ) { 5947 var node, 5948 nodes = selector ? jQuery.filter( selector, elem ) : elem, 5949 i = 0; 5950 5951 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 5952 if ( !keepData && node.nodeType === 1 ) { 5953 jQuery.cleanData( getAll( node ) ); 5954 } 5955 5956 if ( node.parentNode ) { 5957 if ( keepData && isAttached( node ) ) { 5958 setGlobalEval( getAll( node, "script" ) ); 5959 } 5960 node.parentNode.removeChild( node ); 5961 } 5962 } 5963 5964 return elem; 5965} 5966 5967jQuery.extend( { 5968 htmlPrefilter: function( html ) { 5969 return html.replace( rxhtmlTag, "<$1></$2>" ); 5970 }, 5971 5972 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 5973 var i, l, srcElements, destElements, 5974 clone = elem.cloneNode( true ), 5975 inPage = isAttached(
vendor: 7,853 bytes, lines 5975-6271
5975 elem ); 5976 5977 // Fix IE cloning issues 5978 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 5979 !jQuery.isXMLDoc( elem ) ) { 5980 5981 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 5982 destElements = getAll( clone ); 5983 srcElements = getAll( elem ); 5984 5985 for ( i = 0, l = srcElements.length; i < l; i++ ) { 5986 fixInput( srcElements[ i ], destElements[ i ] ); 5987 } 5988 } 5989 5990 // Copy the events from the original to the clone 5991 if ( dataAndEvents ) { 5992 if ( deepDataAndEvents ) { 5993 srcElements = srcElements || getAll( elem ); 5994 destElements = destElements || getAll( clone ); 5995 5996 for ( i = 0, l = srcElements.length; i < l; i++ ) { 5997 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 5998 } 5999 } else { 6000 cloneCopyEvent( elem, clone ); 6001 } 6002 } 6003 6004 // Preserve script evaluation history 6005 destElements = getAll( clone, "script" ); 6006 if ( destElements.length > 0 ) { 6007 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 6008 } 6009 6010 // Return the cloned set 6011 return clone; 6012 }, 6013 6014 cleanData: function( elems ) { 6015 var data, elem, type, 6016 special = jQuery.event.special, 6017 i = 0; 6018 6019 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 6020 if ( acceptData( elem ) ) { 6021 if ( ( data = elem[ dataPriv.expando ] ) ) { 6022 if ( data.events ) { 6023 for ( type in data.events ) { 6024 if ( special[ type ] ) { 6025 jQuery.event.remove( elem, type ); 6026 6027 // This is a shortcut to avoid jQuery.event.remove's overhead 6028 } else { 6029 jQuery.removeEvent( elem, type, data.handle ); 6030 } 6031 } 6032 } 6033 6034 // Support: Chrome <=35 - 45+ 6035 // Assign undefined instead of using delete, see Data#remove 6036 elem[ dataPriv.expando ] = undefined; 6037 } 6038 if ( elem[ dataUser.expando ] ) { 6039 6040 // Support: Chrome <=35 - 45+ 6041 // Assign undefined instead of using delete, see Data#remove 6042 elem[ dataUser.expando ] = undefined; 6043 } 6044 } 6045 } 6046 } 6047} ); 6048 6049jQuery.fn.extend( { 6050 detach: function( selector ) { 6051 return remove( this, selector, true ); 6052 }, 6053 6054 remove: function( selector ) { 6055 return remove( this, selector ); 6056 }, 6057 6058 text: function( value ) { 6059 return access( this, function( value ) { 6060 return value === undefined ? 6061 jQuery.text( this ) : 6062 this.empty().each( function() { 6063 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6064 this.textContent = value; 6065 } 6066 } ); 6067 }, null, value, arguments.length ); 6068 }, 6069 6070 append: function() { 6071 return domManip( this, arguments, function( elem ) { 6072 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6073 var target = manipulationTarget( this, elem ); 6074 target.appendChild( elem ); 6075 } 6076 } ); 6077 }, 6078 6079 prepend: function() { 6080 return domManip( this, arguments, function( elem ) { 6081 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6082 var target = manipulationTarget( this, elem ); 6083 target.insertBefore( elem, target.firstChild ); 6084 } 6085 } ); 6086 }, 6087 6088 before: function() { 6089 return domManip( this, arguments, function( elem ) { 6090 if ( this.parentNode ) { 6091 this.parentNode.insertBefore( elem, this ); 6092 } 6093 } ); 6094 }, 6095 6096 after: function() { 6097 return domManip( this, arguments, function( elem ) { 6098 if ( this.parentNode ) { 6099 this.parentNode.insertBefore( elem, this.nextSibling ); 6100 } 6101 } ); 6102 }, 6103 6104 empty: function() { 6105 var elem, 6106 i = 0; 6107 6108 for ( ; ( elem = this[ i ] ) != null; i++ ) { 6109 if ( elem.nodeType === 1 ) { 6110 6111 // Prevent memory leaks 6112 jQuery.cleanData( getAll( elem, false ) ); 6113 6114 // Remove any remaining nodes 6115 elem.textContent = ""; 6116 } 6117 } 6118 6119 return this; 6120 }, 6121 6122 clone: function( dataAndEvents, deepDataAndEvents ) { 6123 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 6124 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 6125 6126 return this.map( function() { 6127 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 6128 } ); 6129 }, 6130 6131 html: function( value ) { 6132 return access( this, function( value ) { 6133 var elem = this[ 0 ] || {}, 6134 i = 0, 6135 l = this.length; 6136 6137 if ( value === undefined && elem.nodeType === 1 ) { 6138 return elem.innerHTML; 6139 } 6140 6141 // See if we can take a shortcut and just use innerHTML 6142 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 6143 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 6144 6145 value = jQuery.htmlPrefilter( value ); 6146 6147 try { 6148 for ( ; i < l; i++ ) { 6149 elem = this[ i ] || {}; 6150 6151 // Remove element nodes and prevent memory leaks 6152 if ( elem.nodeType === 1 ) { 6153 jQuery.cleanData( getAll( elem, false ) ); 6154 elem.innerHTML = value; 6155 } 6156 } 6157 6158 elem = 0; 6159 6160 // If using innerHTML throws an exception, use the fallback method 6161 } catch ( e ) {} 6162 } 6163 6164 if ( elem ) { 6165 this.empty().append( value ); 6166 } 6167 }, null, value, arguments.length ); 6168 }, 6169 6170 replaceWith: function() { 6171 var ignored = []; 6172 6173 // Make the changes, replacing each non-ignored context element with the new content 6174 return domManip( this, arguments, function( elem ) { 6175 var parent = this.parentNode; 6176 6177 if ( jQuery.inArray( this, ignored ) < 0 ) { 6178 jQuery.cleanData( getAll( this ) ); 6179 if ( parent ) { 6180 parent.replaceChild( elem, this ); 6181 } 6182 } 6183 6184 // Force callback invocation 6185 }, ignored ); 6186 } 6187} ); 6188 6189jQuery.each( { 6190 appendTo: "append", 6191 prependTo: "prepend", 6192 insertBefore: "before", 6193 insertAfter: "after", 6194 replaceAll: "replaceWith" 6195}, function( name, original ) { 6196 jQuery.fn[ name ] = function( selector ) { 6197 var elems, 6198 ret = [], 6199 insert = jQuery( selector ), 6200 last = insert.length - 1, 6201 i = 0; 6202 6203 for ( ; i <= last; i++ ) { 6204 elems = i === last ? this : this.clone( true ); 6205 jQuery( insert[ i ] )[ original ]( elems ); 6206 6207 // Support: Android <=4.0 only, PhantomJS 1 only 6208 // .get() because push.apply(_, arraylike) throws on ancient WebKit 6209 push.apply( ret, elems.get() ); 6210 } 6211 6212 return this.pushStack( ret ); 6213 }; 6214} ); 6215var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 6216 6217var getStyles = function( elem ) { 6218 6219 // Support: IE <=11 only, Firefox <=30 (#15098, #14150) 6220 // IE throws on elements created in popups 6221 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 6222 var view = elem.ownerDocument.defaultView; 6223 6224 if ( !view || !view.opener ) { 6225 view = window; 6226 } 6227 6228 return view.getComputedStyle( elem ); 6229 }; 6230 6231var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 6232 6233 6234 6235( function() { 6236 6237 // Executing both pixelPosition & boxSizingReliable tests require only one layout 6238 // so they're executed at the same time to save the second computation. 6239 function computeStyleTests() { 6240 6241 // This is a singleton, we need to execute it only once 6242 if ( !div ) { 6243 return; 6244 } 6245 6246 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 6247 "margin-top:1px;padding:0;border:0"; 6248 div.style.cssText = 6249 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 6250 "margin:auto;border:1px;padding:1px;" + 6251 "width:60%;top:1%"; 6252 documentElement.appendChild( container ).appendChild( div ); 6253 6254 var divStyle = window.getComputedStyle( div ); 6255 pixelPositionVal = divStyle.top !== "1%"; 6256 6257 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 6258 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 6259 6260 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 6261 // Some styles come back with percentage values, even though they shouldn't 6262 div.style.right = "60%"; 6263 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 6264 6265 // Support: IE 9 - 11 only 6266 // Detect misreporting of content dimensions for box-sizing:border-box elements 6267 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 6268 6269 // Support: IE 9 only 6270 // Detect overflow:scroll screwiness (gh-3699) 6271
vendor: 19,972 bytes, lines 6271-6975
6271// Support: Chrome <=64 6272 // Don't get tricked when zoom affects offsetWidth (gh-4029) 6273 div.style.position = "absolute"; 6274 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; 6275 6276 documentElement.removeChild( container ); 6277 6278 // Nullify the div so it wouldn't be stored in the memory and 6279 // it will also be a sign that checks already performed 6280 div = null; 6281 } 6282 6283 function roundPixelMeasures( measure ) { 6284 return Math.round( parseFloat( measure ) ); 6285 } 6286 6287 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 6288 reliableMarginLeftVal, 6289 container = document.createElement( "div" ), 6290 div = document.createElement( "div" ); 6291 6292 // Finish early in limited (non-browser) environments 6293 if ( !div.style ) { 6294 return; 6295 } 6296 6297 // Support: IE <=9 - 11 only 6298 // Style of cloned element affects source element cloned (#8908) 6299 div.style.backgroundClip = "content-box"; 6300 div.cloneNode( true ).style.backgroundClip = ""; 6301 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 6302 6303 jQuery.extend( support, { 6304 boxSizingReliable: function() { 6305 computeStyleTests(); 6306 return boxSizingReliableVal; 6307 }, 6308 pixelBoxStyles: function() { 6309 computeStyleTests(); 6310 return pixelBoxStylesVal; 6311 }, 6312 pixelPosition: function() { 6313 computeStyleTests(); 6314 return pixelPositionVal; 6315 }, 6316 reliableMarginLeft: function() { 6317 computeStyleTests(); 6318 return reliableMarginLeftVal; 6319 }, 6320 scrollboxSize: function() { 6321 computeStyleTests(); 6322 return scrollboxSizeVal; 6323 } 6324 } ); 6325} )(); 6326 6327 6328function curCSS( elem, name, computed ) { 6329 var width, minWidth, maxWidth, ret, 6330 6331 // Support: Firefox 51+ 6332 // Retrieving style before computed somehow 6333 // fixes an issue with getting wrong values 6334 // on detached elements 6335 style = elem.style; 6336 6337 computed = computed || getStyles( elem ); 6338 6339 // getPropertyValue is needed for: 6340 // .css('filter') (IE 9 only, #12537) 6341 // .css('--customProperty) (#3144) 6342 if ( computed ) { 6343 ret = computed.getPropertyValue( name ) || computed[ name ]; 6344 6345 if ( ret === "" && !isAttached( elem ) ) { 6346 ret = jQuery.style( elem, name ); 6347 } 6348 6349 // A tribute to the "awesome hack by Dean Edwards" 6350 // Android Browser returns percentage for some values, 6351 // but width seems to be reliably pixels. 6352 // This is against the CSSOM draft spec: 6353 // https://drafts.csswg.org/cssom/#resolved-values 6354 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 6355 6356 // Remember the original values 6357 width = style.width; 6358 minWidth = style.minWidth; 6359 maxWidth = style.maxWidth; 6360 6361 // Put in the new values to get a computed value out 6362 style.minWidth = style.maxWidth = style.width = ret; 6363 ret = computed.width; 6364 6365 // Revert the changed values 6366 style.width = width; 6367 style.minWidth = minWidth; 6368 style.maxWidth = maxWidth; 6369 } 6370 } 6371 6372 return ret !== undefined ? 6373 6374 // Support: IE <=9 - 11 only 6375 // IE returns zIndex value as an integer. 6376 ret + "" : 6377 ret; 6378} 6379 6380 6381function addGetHookIf( conditionFn, hookFn ) { 6382 6383 // Define the hook, we'll check on the first run if it's really needed. 6384 return { 6385 get: function() { 6386 if ( conditionFn() ) { 6387 6388 // Hook not needed (or it's not possible to use it due 6389 // to missing dependency), remove it. 6390 delete this.get; 6391 return; 6392 } 6393 6394 // Hook needed; redefine it so that the support test is not executed again. 6395 return ( this.get = hookFn ).apply( this, arguments ); 6396 } 6397 }; 6398} 6399 6400 6401var cssPrefixes = [ "Webkit", "Moz", "ms" ], 6402 emptyStyle = document.createElement( "div" ).style, 6403 vendorProps = {}; 6404 6405// Return a vendor-prefixed property or undefined 6406function vendorPropName( name ) { 6407 6408 // Check for vendor prefixed names 6409 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 6410 i = cssPrefixes.length; 6411 6412 while ( i-- ) { 6413 name = cssPrefixes[ i ] + capName; 6414 if ( name in emptyStyle ) { 6415 return name; 6416 } 6417 } 6418} 6419 6420// Return a potentially-mapped jQuery.cssProps or vendor prefixed property 6421function finalPropName( name ) { 6422 var final = jQuery.cssProps[ name ] || vendorProps[ name ]; 6423 6424 if ( final ) { 6425 return final; 6426 } 6427 if ( name in emptyStyle ) { 6428 return name; 6429 } 6430 return vendorProps[ name ] = vendorPropName( name ) || name; 6431} 6432 6433 6434var 6435 6436 // Swappable if display is none or starts with table 6437 // except "table", "table-cell", or "table-caption" 6438 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 6439 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 6440 rcustomProp = /^--/, 6441 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 6442 cssNormalTransform = { 6443 letterSpacing: "0", 6444 fontWeight: "400" 6445 }; 6446 6447function setPositiveNumber( elem, value, subtract ) { 6448 6449 // Any relative (+/-) values have already been 6450 // normalized at this point 6451 var matches = rcssNum.exec( value ); 6452 return matches ? 6453 6454 // Guard against undefined "subtract", e.g., when used as in cssHooks 6455 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 6456 value; 6457} 6458 6459function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 6460 var i = dimension === "width" ? 1 : 0, 6461 extra = 0, 6462 delta = 0; 6463 6464 // Adjustment may not be necessary 6465 if ( box === ( isBorderBox ? "border" : "content" ) ) { 6466 return 0; 6467 } 6468 6469 for ( ; i < 4; i += 2 ) { 6470 6471 // Both box models exclude margin 6472 if ( box === "margin" ) { 6473 delta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 6474 } 6475 6476 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 6477 if ( !isBorderBox ) { 6478 6479 // Add padding 6480 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6481 6482 // For "border" or "margin", add border 6483 if ( box !== "padding" ) { 6484 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6485 6486 // But still keep track of it otherwise 6487 } else { 6488 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6489 } 6490 6491 // If we get here with a border-box (content + padding + border), we're seeking "content" or 6492 // "padding" or "margin" 6493 } else { 6494 6495 // For "content", subtract padding 6496 if ( box === "content" ) { 6497 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6498 } 6499 6500 // For "content" or "padding", subtract border 6501 if ( box !== "margin" ) { 6502 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6503 } 6504 } 6505 } 6506 6507 // Account for positive content-box scroll gutter when requested by providing computedVal 6508 if ( !isBorderBox && computedVal >= 0 ) { 6509 6510 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 6511 // Assuming integer scroll gutter, subtract the rest and round down 6512 delta += Math.max( 0, Math.ceil( 6513 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 6514 computedVal - 6515 delta - 6516 extra - 6517 0.5 6518 6519 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 6520 // Use an explicit zero to avoid NaN (gh-3964) 6521 ) ) || 0; 6522 } 6523 6524 return delta; 6525} 6526 6527function getWidthOrHeight( elem, dimension, extra ) { 6528 6529 // Start with computed style 6530 var styles = getStyles( elem ), 6531 6532 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 6533 // Fake content-box until we know it's needed to know the true value. 6534 boxSizingNeeded = !support.boxSizingReliable() || extra, 6535 isBorderBox = boxSizingNeeded && 6536 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 6537 valueIsBorderBox = isBorderBox, 6538 6539 val = curCSS( elem, dimension, styles ), 6540 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); 6541 6542 // Support: Firefox <=54 6543 // Return a confounding non-pixel value or feign ignorance, as appropriate. 6544 if ( rnumnonpx.test( val ) ) { 6545 if ( !extra ) { 6546 return val; 6547 } 6548 val = "auto"; 6549 } 6550 6551 6552 // Fall back to offsetWidth/offsetHeight when value is "auto" 6553 // This happens for inline elements with no explicit setting (gh-3571) 6554 // Support: Android <=4.1 - 4.3 only 6555 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 6556 // Support: IE 9-11 only 6557 // Also use offsetWidth/offsetHeight for when box sizing is unreliable 6558 // We use getClientRects() to check for hidden/disconnected. 6559 // In those cases, the computed value can be trusted to be border-box 6560 if ( ( !support.boxSizingReliable() && isBorderBox || 6561 val === "auto" || 6562 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && 6563 elem.getClientRects().length ) { 6564 6565 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 6566 6567 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 6568 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 6569 // retrieved value as a content box dimension. 6570 valueIsBorderBox = offsetProp in elem; 6571 if ( valueIsBorderBox ) { 6572 val = elem[ offsetProp ]; 6573 } 6574 } 6575 6576 // Normalize "" and auto 6577 val = parseFloat( val ) || 0; 6578 6579 // Adjust for the element's box model 6580 return ( val + 6581 boxModelAdjustment( 6582 elem, 6583 dimension, 6584 extra || ( isBorderBox ? "border" : "content" ), 6585 valueIsBorderBox, 6586 styles, 6587 6588 // Provide the current computed size to request scroll gutter calculation (gh-3589) 6589 val 6590 ) 6591 ) + "px"; 6592} 6593 6594jQuery.extend( { 6595 6596 // Add in style property hooks for overriding the default 6597 // behavior of getting and setting a style property 6598 cssHooks: { 6599 opacity: { 6600 get: function( elem, computed ) { 6601 if ( computed ) { 6602 6603 // We should always get a number back from opacity 6604 var ret = curCSS( elem, "opacity" ); 6605 return ret === "" ? "1" : ret; 6606 } 6607 } 6608 } 6609 }, 6610 6611 // Don't automatically add "px" to these possibly-unitless properties 6612 cssNumber: { 6613 "animationIterationCount": true, 6614 "columnCount": true, 6615 "fillOpacity": true, 6616 "flexGrow": true, 6617 "flexShrink": true, 6618 "fontWeight": true, 6619 "gridArea": true, 6620 "gridColumn": true, 6621 "gridColumnEnd": true, 6622 "gridColumnStart": true, 6623 "gridRow": true, 6624 "gridRowEnd": true, 6625 "gridRowStart": true, 6626 "lineHeight": true, 6627 "opacity": true, 6628 "order": true, 6629 "orphans": true, 6630 "widows": true, 6631 "zIndex": true, 6632 "zoom": true 6633 }, 6634 6635 // Add in properties whose names you wish to fix before 6636 // setting or getting the value 6637 cssProps: {}, 6638 6639 // Get and set the style property on a DOM Node 6640 style: function( elem, name, value, extra ) { 6641 6642 // Don't set styles on text and comment nodes 6643 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 6644 return; 6645 } 6646 6647 // Make sure that we're working with the right name 6648 var ret, type, hooks, 6649 origName = camelCase( name ), 6650 isCustomProp = rcustomProp.test( name ), 6651 style = elem.style; 6652 6653 // Make sure that we're working with the right name. We don't 6654 // want to query the value if it is a CSS custom property 6655 // since they are user-defined. 6656 if ( !isCustomProp ) { 6657 name = finalPropName( origName ); 6658 } 6659 6660 // Gets hook for the prefixed version, then unprefixed version 6661 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6662 6663 // Check if we're setting a value 6664 if ( value !== undefined ) { 6665 type = typeof value; 6666 6667 // Convert "+=" or "-=" to relative numbers (#7345) 6668 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 6669 value = adjustCSS( elem, name, ret ); 6670 6671 // Fixes bug #9237 6672 type = "number"; 6673 } 6674 6675 // Make sure that null and NaN values aren't set (#7116) 6676 if ( value == null || value !== value ) { 6677 return; 6678 } 6679 6680 // If a number was passed in, add the unit (except for certain CSS properties) 6681 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 6682 // "px" to a few hardcoded values. 6683 if ( type === "number" && !isCustomProp ) { 6684 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 6685 } 6686 6687 // background-* props affect original clone's values 6688 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 6689 style[ name ] = "inherit"; 6690 } 6691 6692 // If a hook was provided, use that value, otherwise just set the specified value 6693 if ( !hooks || !( "set" in hooks ) || 6694 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 6695 6696 if ( isCustomProp ) { 6697 style.setProperty( name, value ); 6698 } else { 6699 style[ name ] = value; 6700 } 6701 } 6702 6703 } else { 6704 6705 // If a hook was provided get the non-computed value from there 6706 if ( hooks && "get" in hooks && 6707 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 6708 6709 return ret; 6710 } 6711 6712 // Otherwise just get the value from the style object 6713 return style[ name ]; 6714 } 6715 }, 6716 6717 css: function( elem, name, extra, styles ) { 6718 var val, num, hooks, 6719 origName = camelCase( name ), 6720 isCustomProp = rcustomProp.test( name ); 6721 6722 // Make sure that we're working with the right name. We don't 6723 // want to modify the value if it is a CSS custom property 6724 // since they are user-defined. 6725 if ( !isCustomProp ) { 6726 name = finalPropName( origName ); 6727 } 6728 6729 // Try prefixed name followed by the unprefixed name 6730 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6731 6732 // If a hook was provided get the computed value from there 6733 if ( hooks && "get" in hooks ) { 6734 val = hooks.get( elem, true, extra ); 6735 } 6736 6737 // Otherwise, if a way to get the computed value exists, use that 6738 if ( val === undefined ) { 6739 val = curCSS( elem, name, styles ); 6740 } 6741 6742 // Convert "normal" to computed value 6743 if ( val === "normal" && name in cssNormalTransform ) { 6744 val = cssNormalTransform[ name ]; 6745 } 6746 6747 // Make numeric if forced or a qualifier was provided and val looks numeric 6748 if ( extra === "" || extra ) { 6749 num = parseFloat( val ); 6750 return extra === true || isFinite( num ) ? num || 0 : val; 6751 } 6752 6753 return val; 6754 } 6755} ); 6756 6757jQuery.each( [ "height", "width" ], function( i, dimension ) { 6758 jQuery.cssHooks[ dimension ] = { 6759 get: function( elem, computed, extra ) { 6760 if ( computed ) { 6761 6762 // Certain elements can have dimension info if we invisibly show them 6763 // but it must have a current display style that would benefit 6764 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 6765 6766 // Support: Safari 8+ 6767 // Table columns in Safari have non-zero offsetWidth & zero 6768 // getBoundingClientRect().width unless display is changed. 6769 // Support: IE <=11 only 6770 // Running getBoundingClientRect on a disconnected node 6771 // in IE throws an error. 6772 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 6773 swap( elem, cssShow, function() { 6774 return getWidthOrHeight( elem, dimension, extra ); 6775 } ) : 6776 getWidthOrHeight( elem, dimension, extra ); 6777 } 6778 }, 6779 6780 set: function( elem, value, extra ) { 6781 var matches, 6782 styles = getStyles( elem ), 6783 6784 // Only read styles.position if the test has a chance to fail 6785 // to avoid forcing a reflow. 6786 scrollboxSizeBuggy = !support.scrollboxSize() && 6787 styles.position === "absolute", 6788 6789 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 6790 boxSizingNeeded = scrollboxSizeBuggy || extra, 6791 isBorderBox = boxSizingNeeded && 6792 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 6793 subtract = extra ? 6794 boxModelAdjustment( 6795 elem, 6796 dimension, 6797 extra, 6798 isBorderBox, 6799 styles 6800 ) : 6801 0; 6802 6803 // Account for unreliable border-box dimensions by comparing offset* to computed and 6804 // faking a content-box to get border and padding (gh-3699) 6805 if ( isBorderBox && scrollboxSizeBuggy ) { 6806 subtract -= Math.ceil( 6807 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 6808 parseFloat( styles[ dimension ] ) - 6809 boxModelAdjustment( elem, dimension, "border", false, styles ) - 6810 0.5 6811 ); 6812 } 6813 6814 // Convert to pixels if value adjustment is needed 6815 if ( subtract && ( matches = rcssNum.exec( value ) ) && 6816 ( matches[ 3 ] || "px" ) !== "px" ) { 6817 6818 elem.style[ dimension ] = value; 6819 value = jQuery.css( elem, dimension ); 6820 } 6821 6822 return setPositiveNumber( elem, value, subtract ); 6823 } 6824 }; 6825} ); 6826 6827jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 6828 function( elem, computed ) { 6829 if ( computed ) { 6830 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 6831 elem.getBoundingClientRect().left - 6832 swap( elem, { marginLeft: 0 }, function() { 6833 return elem.getBoundingClientRect().left; 6834 } ) 6835 ) + "px"; 6836 } 6837 } 6838); 6839 6840// These hooks are used by animate to expand properties 6841jQuery.each( { 6842 margin: "", 6843 padding: "", 6844 border: "Width" 6845}, function( prefix, suffix ) { 6846 jQuery.cssHooks[ prefix + suffix ] = { 6847 expand: function( value ) { 6848 var i = 0, 6849 expanded = {}, 6850 6851 // Assumes a single number if not a string 6852 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 6853 6854 for ( ; i < 4; i++ ) { 6855 expanded[ prefix + cssExpand[ i ] + suffix ] = 6856 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 6857 } 6858 6859 return expanded; 6860 } 6861 }; 6862 6863 if ( prefix !== "margin" ) { 6864 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 6865 } 6866} ); 6867 6868jQuery.fn.extend( { 6869 css: function( name, value ) { 6870 return access( this, function( elem, name, value ) { 6871 var styles, len, 6872 map = {}, 6873 i = 0; 6874 6875 if ( Array.isArray( name ) ) { 6876 styles = getStyles( elem ); 6877 len = name.length; 6878 6879 for ( ; i < len; i++ ) { 6880 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 6881 } 6882 6883 return map; 6884 } 6885 6886 return value !== undefined ? 6887 jQuery.style( elem, name, value ) : 6888 jQuery.css( elem, name ); 6889 }, name, value, arguments.length > 1 ); 6890 } 6891} ); 6892 6893 6894function Tween( elem, options, prop, end, easing ) { 6895 return new Tween.prototype.init( elem, options, prop, end, easing ); 6896} 6897jQuery.Tween = Tween; 6898 6899Tween.prototype = { 6900 constructor: Tween, 6901 init: function( elem, options, prop, end, easing, unit ) { 6902 this.elem = elem; 6903 this.prop = prop; 6904 this.easing = easing || jQuery.easing._default; 6905 this.options = options; 6906 this.start = this.now = this.cur(); 6907 this.end = end; 6908 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 6909 }, 6910 cur: function() { 6911 var hooks = Tween.propHooks[ this.prop ]; 6912 6913 return hooks && hooks.get ? 6914 hooks.get( this ) : 6915 Tween.propHooks._default.get( this ); 6916 }, 6917 run: function( percent ) { 6918 var eased, 6919 hooks = Tween.propHooks[ this.prop ]; 6920 6921 if ( this.options.duration ) { 6922 this.pos = eased = jQuery.easing[ this.easing ]( 6923 percent, this.options.duration * percent, 0, 1, this.options.duration 6924 ); 6925 } else { 6926 this.pos = eased = percent; 6927 } 6928 this.now = ( this.end - this.start ) * eased + this.start; 6929 6930 if ( this.options.step ) { 6931 this.options.step.call( this.elem, this.now, this ); 6932 } 6933 6934 if ( hooks && hooks.set ) { 6935 hooks.set( this ); 6936 } else { 6937 Tween.propHooks._default.set( this ); 6938 } 6939 return this; 6940 } 6941}; 6942 6943Tween.prototype.init.prototype = Tween.prototype; 6944 6945Tween.propHooks = { 6946 _default: { 6947 get: function( tween ) { 6948 var result; 6949 6950 // Use a property on the element directly when it is not a DOM element, 6951 // or when there is no matching style property that exists. 6952 if ( tween.elem.nodeType !== 1 || 6953 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 6954 return tween.elem[ tween.prop ]; 6955 } 6956 6957 // Passing an empty string as a 3rd parameter to .css will automatically 6958 // attempt a parseFloat and fallback to a string if the parse fails. 6959 // Simple values such as "10px" are parsed to Float; 6960 // complex values such as "rotate(1rad)" are returned as-is. 6961 result = jQuery.css( tween.elem, tween.prop, "" ); 6962 6963 // Empty strings, null, undefined and "auto" are converted to 0. 6964 return !result || result === "auto" ? 0 : result; 6965 }, 6966 set: function( tween ) { 6967 6968 // Use step hook for back compat. 6969 // Use cssHook if its there. 6970 // Use .style if available and use plain properties where available. 6971 if ( jQuery.fx.step[ tween.prop ] ) { 6972 jQuery.fx.step[ tween.prop ]( tween ); 6973 } else if ( tween.elem.nodeType === 1 && ( 6974 jQuery.cssHooks[ tween.prop ] || 6975 tween.elem.style[ finalPropName( tween.prop ) ] != null
vendor: 41,663 bytes, lines 6975-8682
6975 ) ) { 6976 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 6977 } else { 6978 tween.elem[ tween.prop ] = tween.now; 6979 } 6980 } 6981 } 6982}; 6983 6984// Support: IE <=9 only 6985// Panic based approach to setting things on disconnected nodes 6986Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 6987 set: function( tween ) { 6988 if ( tween.elem.nodeType && tween.elem.parentNode ) { 6989 tween.elem[ tween.prop ] = tween.now; 6990 } 6991 } 6992}; 6993 6994jQuery.easing = { 6995 linear: function( p ) { 6996 return p; 6997 }, 6998 swing: function( p ) { 6999 return 0.5 - Math.cos( p * Math.PI ) / 2; 7000 }, 7001 _default: "swing" 7002}; 7003 7004jQuery.fx = Tween.prototype.init; 7005 7006// Back compat <1.8 extension point 7007jQuery.fx.step = {}; 7008 7009 7010 7011 7012var 7013 fxNow, inProgress, 7014 rfxtypes = /^(?:toggle|show|hide)$/, 7015 rrun = /queueHooks$/; 7016 7017function schedule() { 7018 if ( inProgress ) { 7019 if ( document.hidden === false && window.requestAnimationFrame ) { 7020 window.requestAnimationFrame( schedule ); 7021 } else { 7022 window.setTimeout( schedule, jQuery.fx.interval ); 7023 } 7024 7025 jQuery.fx.tick(); 7026 } 7027} 7028 7029// Animations created synchronously will run synchronously 7030function createFxNow() { 7031 window.setTimeout( function() { 7032 fxNow = undefined; 7033 } ); 7034 return ( fxNow = Date.now() ); 7035} 7036 7037// Generate parameters to create a standard animation 7038function genFx( type, includeWidth ) { 7039 var which, 7040 i = 0, 7041 attrs = { height: type }; 7042 7043 // If we include width, step value is 1 to do all cssExpand values, 7044 // otherwise step value is 2 to skip over Left and Right 7045 includeWidth = includeWidth ? 1 : 0; 7046 for ( ; i < 4; i += 2 - includeWidth ) { 7047 which = cssExpand[ i ]; 7048 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 7049 } 7050 7051 if ( includeWidth ) { 7052 attrs.opacity = attrs.width = type; 7053 } 7054 7055 return attrs; 7056} 7057 7058function createTween( value, prop, animation ) { 7059 var tween, 7060 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 7061 index = 0, 7062 length = collection.length; 7063 for ( ; index < length; index++ ) { 7064 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 7065 7066 // We're done with this property 7067 return tween; 7068 } 7069 } 7070} 7071 7072function defaultPrefilter( elem, props, opts ) { 7073 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 7074 isBox = "width" in props || "height" in props, 7075 anim = this, 7076 orig = {}, 7077 style = elem.style, 7078 hidden = elem.nodeType && isHiddenWithinTree( elem ), 7079 dataShow = dataPriv.get( elem, "fxshow" ); 7080 7081 // Queue-skipping animations hijack the fx hooks 7082 if ( !opts.queue ) { 7083 hooks = jQuery._queueHooks( elem, "fx" ); 7084 if ( hooks.unqueued == null ) { 7085 hooks.unqueued = 0; 7086 oldfire = hooks.empty.fire; 7087 hooks.empty.fire = function() { 7088 if ( !hooks.unqueued ) { 7089 oldfire(); 7090 } 7091 }; 7092 } 7093 hooks.unqueued++; 7094 7095 anim.always( function() { 7096 7097 // Ensure the complete handler is called before this completes 7098 anim.always( function() { 7099 hooks.unqueued--; 7100 if ( !jQuery.queue( elem, "fx" ).length ) { 7101 hooks.empty.fire(); 7102 } 7103 } ); 7104 } ); 7105 } 7106 7107 // Detect show/hide animations 7108 for ( prop in props ) { 7109 value = props[ prop ]; 7110 if ( rfxtypes.test( value ) ) { 7111 delete props[ prop ]; 7112 toggle = toggle || value === "toggle"; 7113 if ( value === ( hidden ? "hide" : "show" ) ) { 7114 7115 // Pretend to be hidden if this is a "show" and 7116 // there is still data from a stopped show/hide 7117 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 7118 hidden = true; 7119 7120 // Ignore all other no-op show/hide data 7121 } else { 7122 continue; 7123 } 7124 } 7125 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 7126 } 7127 } 7128 7129 // Bail out if this is a no-op like .hide().hide() 7130 propTween = !jQuery.isEmptyObject( props ); 7131 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 7132 return; 7133 } 7134 7135 // Restrict "overflow" and "display" styles during box animations 7136 if ( isBox && elem.nodeType === 1 ) { 7137 7138 // Support: IE <=9 - 11, Edge 12 - 15 7139 // Record all 3 overflow attributes because IE does not infer the shorthand 7140 // from identically-valued overflowX and overflowY and Edge just mirrors 7141 // the overflowX value there. 7142 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 7143 7144 // Identify a display type, preferring old show/hide data over the CSS cascade 7145 restoreDisplay = dataShow && dataShow.display; 7146 if ( restoreDisplay == null ) { 7147 restoreDisplay = dataPriv.get( elem, "display" ); 7148 } 7149 display = jQuery.css( elem, "display" ); 7150 if ( display === "none" ) { 7151 if ( restoreDisplay ) { 7152 display = restoreDisplay; 7153 } else { 7154 7155 // Get nonempty value(s) by temporarily forcing visibility 7156 showHide( [ elem ], true ); 7157 restoreDisplay = elem.style.display || restoreDisplay; 7158 display = jQuery.css( elem, "display" ); 7159 showHide( [ elem ] ); 7160 } 7161 } 7162 7163 // Animate inline elements as inline-block 7164 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 7165 if ( jQuery.css( elem, "float" ) === "none" ) { 7166 7167 // Restore the original display value at the end of pure show/hide animations 7168 if ( !propTween ) { 7169 anim.done( function() { 7170 style.display = restoreDisplay; 7171 } ); 7172 if ( restoreDisplay == null ) { 7173 display = style.display; 7174 restoreDisplay = display === "none" ? "" : display; 7175 } 7176 } 7177 style.display = "inline-block"; 7178 } 7179 } 7180 } 7181 7182 if ( opts.overflow ) { 7183 style.overflow = "hidden"; 7184 anim.always( function() { 7185 style.overflow = opts.overflow[ 0 ]; 7186 style.overflowX = opts.overflow[ 1 ]; 7187 style.overflowY = opts.overflow[ 2 ]; 7188 } ); 7189 } 7190 7191 // Implement show/hide animations 7192 propTween = false; 7193 for ( prop in orig ) { 7194 7195 // General show/hide setup for this element animation 7196 if ( !propTween ) { 7197 if ( dataShow ) { 7198 if ( "hidden" in dataShow ) { 7199 hidden = dataShow.hidden; 7200 } 7201 } else { 7202 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 7203 } 7204 7205 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 7206 if ( toggle ) { 7207 dataShow.hidden = !hidden; 7208 } 7209 7210 // Show elements before animating them 7211 if ( hidden ) { 7212 showHide( [ elem ], true ); 7213 } 7214 7215 /* eslint-disable no-loop-func */ 7216 7217 anim.done( function() { 7218 7219 /* eslint-enable no-loop-func */ 7220 7221 // The final step of a "hide" animation is actually hiding the element 7222 if ( !hidden ) { 7223 showHide( [ elem ] ); 7224 } 7225 dataPriv.remove( elem, "fxshow" ); 7226 for ( prop in orig ) { 7227 jQuery.style( elem, prop, orig[ prop ] ); 7228 } 7229 } ); 7230 } 7231 7232 // Per-property setup 7233 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 7234 if ( !( prop in dataShow ) ) { 7235 dataShow[ prop ] = propTween.start; 7236 if ( hidden ) { 7237 propTween.end = propTween.start; 7238 propTween.start = 0; 7239 } 7240 } 7241 } 7242} 7243 7244function propFilter( props, specialEasing ) { 7245 var index, name, easing, value, hooks; 7246 7247 // camelCase, specialEasing and expand cssHook pass 7248 for ( index in props ) { 7249 name = camelCase( index ); 7250 easing = specialEasing[ name ]; 7251 value = props[ index ]; 7252 if ( Array.isArray( value ) ) { 7253 easing = value[ 1 ]; 7254 value = props[ index ] = value[ 0 ]; 7255 } 7256 7257 if ( index !== name ) { 7258 props[ name ] = value; 7259 delete props[ index ]; 7260 } 7261 7262 hooks = jQuery.cssHooks[ name ]; 7263 if ( hooks && "expand" in hooks ) { 7264 value = hooks.expand( value ); 7265 delete props[ name ]; 7266 7267 // Not quite $.extend, this won't overwrite existing keys. 7268 // Reusing 'index' because we have the correct "name" 7269 for ( index in value ) { 7270 if ( !( index in props ) ) { 7271 props[ index ] = value[ index ]; 7272 specialEasing[ index ] = easing; 7273 } 7274 } 7275 } else { 7276 specialEasing[ name ] = easing; 7277 } 7278 } 7279} 7280 7281function Animation( elem, properties, options ) { 7282 var result, 7283 stopped, 7284 index = 0, 7285 length = Animation.prefilters.length, 7286 deferred = jQuery.Deferred().always( function() { 7287 7288 // Don't match elem in the :animated selector 7289 delete tick.elem; 7290 } ), 7291 tick = function() { 7292 if ( stopped ) { 7293 return false; 7294 } 7295 var currentTime = fxNow || createFxNow(), 7296 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 7297 7298 // Support: Android 2.3 only 7299 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) 7300 temp = remaining / animation.duration || 0, 7301 percent = 1 - temp, 7302 index = 0, 7303 length = animation.tweens.length; 7304 7305 for ( ; index < length; index++ ) { 7306 animation.tweens[ index ].run( percent ); 7307 } 7308 7309 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 7310 7311 // If there's more to do, yield 7312 if ( percent < 1 && length ) { 7313 return remaining; 7314 } 7315 7316 // If this was an empty animation, synthesize a final progress notification 7317 if ( !length ) { 7318 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7319 } 7320 7321 // Resolve the animation and report its conclusion 7322 deferred.resolveWith( elem, [ animation ] ); 7323 return false; 7324 }, 7325 animation = deferred.promise( { 7326 elem: elem, 7327 props: jQuery.extend( {}, properties ), 7328 opts: jQuery.extend( true, { 7329 specialEasing: {}, 7330 easing: jQuery.easing._default 7331 }, options ), 7332 originalProperties: properties, 7333 originalOptions: options, 7334 startTime: fxNow || createFxNow(), 7335 duration: options.duration, 7336 tweens: [], 7337 createTween: function( prop, end ) { 7338 var tween = jQuery.Tween( elem, animation.opts, prop, end, 7339 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 7340 animation.tweens.push( tween ); 7341 return tween; 7342 }, 7343 stop: function( gotoEnd ) { 7344 var index = 0, 7345 7346 // If we are going to the end, we want to run all the tweens 7347 // otherwise we skip this part 7348 length = gotoEnd ? animation.tweens.length : 0; 7349 if ( stopped ) { 7350 return this; 7351 } 7352 stopped = true; 7353 for ( ; index < length; index++ ) { 7354 animation.tweens[ index ].run( 1 ); 7355 } 7356 7357 // Resolve when we played the last frame; otherwise, reject 7358 if ( gotoEnd ) { 7359 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7360 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 7361 } else { 7362 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 7363 } 7364 return this; 7365 } 7366 } ), 7367 props = animation.props; 7368 7369 propFilter( props, animation.opts.specialEasing ); 7370 7371 for ( ; index < length; index++ ) { 7372 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 7373 if ( result ) { 7374 if ( isFunction( result.stop ) ) { 7375 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 7376 result.stop.bind( result ); 7377 } 7378 return result; 7379 } 7380 } 7381 7382 jQuery.map( props, createTween, animation ); 7383 7384 if ( isFunction( animation.opts.start ) ) { 7385 animation.opts.start.call( elem, animation ); 7386 } 7387 7388 // Attach callbacks from options 7389 animation 7390 .progress( animation.opts.progress ) 7391 .done( animation.opts.done, animation.opts.complete ) 7392 .fail( animation.opts.fail ) 7393 .always( animation.opts.always ); 7394 7395 jQuery.fx.timer( 7396 jQuery.extend( tick, { 7397 elem: elem, 7398 anim: animation, 7399 queue: animation.opts.queue 7400 } ) 7401 ); 7402 7403 return animation; 7404} 7405 7406jQuery.Animation = jQuery.extend( Animation, { 7407 7408 tweeners: { 7409 "*": [ function( prop, value ) { 7410 var tween = this.createTween( prop, value ); 7411 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 7412 return tween; 7413 } ] 7414 }, 7415 7416 tweener: function( props, callback ) { 7417 if ( isFunction( props ) ) { 7418 callback = props; 7419 props = [ "*" ]; 7420 } else { 7421 props = props.match( rnothtmlwhite ); 7422 } 7423 7424 var prop, 7425 index = 0, 7426 length = props.length; 7427 7428 for ( ; index < length; index++ ) { 7429 prop = props[ index ]; 7430 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 7431 Animation.tweeners[ prop ].unshift( callback ); 7432 } 7433 }, 7434 7435 prefilters: [ defaultPrefilter ], 7436 7437 prefilter: function( callback, prepend ) { 7438 if ( prepend ) { 7439 Animation.prefilters.unshift( callback ); 7440 } else { 7441 Animation.prefilters.push( callback ); 7442 } 7443 } 7444} ); 7445 7446jQuery.speed = function( speed, easing, fn ) { 7447 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 7448 complete: fn || !fn && easing || 7449 isFunction( speed ) && speed, 7450 duration: speed, 7451 easing: fn && easing || easing && !isFunction( easing ) && easing 7452 }; 7453 7454 // Go to the end state if fx are off 7455 if ( jQuery.fx.off ) { 7456 opt.duration = 0; 7457 7458 } else { 7459 if ( typeof opt.duration !== "number" ) { 7460 if ( opt.duration in jQuery.fx.speeds ) { 7461 opt.duration = jQuery.fx.speeds[ opt.duration ]; 7462 7463 } else { 7464 opt.duration = jQuery.fx.speeds._default; 7465 } 7466 } 7467 } 7468 7469 // Normalize opt.queue - true/undefined/null -> "fx" 7470 if ( opt.queue == null || opt.queue === true ) { 7471 opt.queue = "fx"; 7472 } 7473 7474 // Queueing 7475 opt.old = opt.complete; 7476 7477 opt.complete = function() { 7478 if ( isFunction( opt.old ) ) { 7479 opt.old.call( this ); 7480 } 7481 7482 if ( opt.queue ) { 7483 jQuery.dequeue( this, opt.queue ); 7484 } 7485 }; 7486 7487 return opt; 7488}; 7489 7490jQuery.fn.extend( { 7491 fadeTo: function( speed, to, easing, callback ) { 7492 7493 // Show any hidden elements after setting opacity to 0 7494 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 7495 7496 // Animate to the value specified 7497 .end().animate( { opacity: to }, speed, easing, callback ); 7498 }, 7499 animate: function( prop, speed, easing, callback ) { 7500 var empty = jQuery.isEmptyObject( prop ), 7501 optall = jQuery.speed( speed, easing, callback ), 7502 doAnimation = function() { 7503 7504 // Operate on a copy of prop so per-property easing won't be lost 7505 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 7506 7507 // Empty animations, or finishing resolves immediately 7508 if ( empty || dataPriv.get( this, "finish" ) ) { 7509 anim.stop( true ); 7510 } 7511 }; 7512 doAnimation.finish = doAnimation; 7513 7514 return empty || optall.queue === false ? 7515 this.each( doAnimation ) : 7516 this.queue( optall.queue, doAnimation ); 7517 }, 7518 stop: function( type, clearQueue, gotoEnd ) { 7519 var stopQueue = function( hooks ) { 7520 var stop = hooks.stop; 7521 delete hooks.stop; 7522 stop( gotoEnd ); 7523 }; 7524 7525 if ( typeof type !== "string" ) { 7526 gotoEnd = clearQueue; 7527 clearQueue = type; 7528 type = undefined; 7529 } 7530 if ( clearQueue && type !== false ) { 7531 this.queue( type || "fx", [] ); 7532 } 7533 7534 return this.each( function() { 7535 var dequeue = true, 7536 index = type != null && type + "queueHooks", 7537 timers = jQuery.timers, 7538 data = dataPriv.get( this ); 7539 7540 if ( index ) { 7541 if ( data[ index ] && data[ index ].stop ) { 7542 stopQueue( data[ index ] ); 7543 } 7544 } else { 7545 for ( index in data ) { 7546 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 7547 stopQueue( data[ index ] ); 7548 } 7549 } 7550 } 7551 7552 for ( index = timers.length; index--; ) { 7553 if ( timers[ index ].elem === this && 7554 ( type == null || timers[ index ].queue === type ) ) { 7555 7556 timers[ index ].anim.stop( gotoEnd ); 7557 dequeue = false; 7558 timers.splice( index, 1 ); 7559 } 7560 } 7561 7562 // Start the next in the queue if the last step wasn't forced. 7563 // Timers currently will call their complete callbacks, which 7564 // will dequeue but only if they were gotoEnd. 7565 if ( dequeue || !gotoEnd ) { 7566 jQuery.dequeue( this, type ); 7567 } 7568 } ); 7569 }, 7570 finish: function( type ) { 7571 if ( type !== false ) { 7572 type = type || "fx"; 7573 } 7574 return this.each( function() { 7575 var index, 7576 data = dataPriv.get( this ), 7577 queue = data[ type + "queue" ], 7578 hooks = data[ type + "queueHooks" ], 7579 timers = jQuery.timers, 7580 length = queue ? queue.length : 0; 7581 7582 // Enable finishing flag on private data 7583 data.finish = true; 7584 7585 // Empty the queue first 7586 jQuery.queue( this, type, [] ); 7587 7588 if ( hooks && hooks.stop ) { 7589 hooks.stop.call( this, true ); 7590 } 7591 7592 // Look for any active animations, and finish them 7593 for ( index = timers.length; index--; ) { 7594 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 7595 timers[ index ].anim.stop( true ); 7596 timers.splice( index, 1 ); 7597 } 7598 } 7599 7600 // Look for any animations in the old queue and finish them 7601 for ( index = 0; index < length; index++ ) { 7602 if ( queue[ index ] && queue[ index ].finish ) { 7603 queue[ index ].finish.call( this ); 7604 } 7605 } 7606 7607 // Turn off finishing flag 7608 delete data.finish; 7609 } ); 7610 } 7611} ); 7612 7613jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { 7614 var cssFn = jQuery.fn[ name ]; 7615 jQuery.fn[ name ] = function( speed, easing, callback ) { 7616 return speed == null || typeof speed === "boolean" ? 7617 cssFn.apply( this, arguments ) : 7618 this.animate( genFx( name, true ), speed, easing, callback ); 7619 }; 7620} ); 7621 7622// Generate shortcuts for custom animations 7623jQuery.each( { 7624 slideDown: genFx( "show" ), 7625 slideUp: genFx( "hide" ), 7626 slideToggle: genFx( "toggle" ), 7627 fadeIn: { opacity: "show" }, 7628 fadeOut: { opacity: "hide" }, 7629 fadeToggle: { opacity: "toggle" } 7630}, function( name, props ) { 7631 jQuery.fn[ name ] = function( speed, easing, callback ) { 7632 return this.animate( props, speed, easing, callback ); 7633 }; 7634} ); 7635 7636jQuery.timers = []; 7637jQuery.fx.tick = function() { 7638 var timer, 7639 i = 0, 7640 timers = jQuery.timers; 7641 7642 fxNow = Date.now(); 7643 7644 for ( ; i < timers.length; i++ ) { 7645 timer = timers[ i ]; 7646 7647 // Run the timer and safely remove it when done (allowing for external removal) 7648 if ( !timer() && timers[ i ] === timer ) { 7649 timers.splice( i--, 1 ); 7650 } 7651 } 7652 7653 if ( !timers.length ) { 7654 jQuery.fx.stop(); 7655 } 7656 fxNow = undefined; 7657}; 7658 7659jQuery.fx.timer = function( timer ) { 7660 jQuery.timers.push( timer ); 7661 jQuery.fx.start(); 7662}; 7663 7664jQuery.fx.interval = 13; 7665jQuery.fx.start = function() { 7666 if ( inProgress ) { 7667 return; 7668 } 7669 7670 inProgress = true; 7671 schedule(); 7672}; 7673 7674jQuery.fx.stop = function() { 7675 inProgress = null; 7676}; 7677 7678jQuery.fx.speeds = { 7679 slow: 600, 7680 fast: 200, 7681 7682 // Default speed 7683 _default: 400 7684}; 7685 7686 7687// Based off of the plugin by Clint Helfers, with permission. 7688// https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ 7689jQuery.fn.delay = function( time, type ) { 7690 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 7691 type = type || "fx"; 7692 7693 return this.queue( type, function( next, hooks ) { 7694 var timeout = window.setTimeout( next, time ); 7695 hooks.stop = function() { 7696 window.clearTimeout( timeout ); 7697 }; 7698 } ); 7699}; 7700 7701 7702( function() { 7703 var input = document.createElement( "input" ), 7704 select = document.createElement( "select" ), 7705 opt = select.appendChild( document.createElement( "option" ) ); 7706 7707 input.type = "checkbox"; 7708 7709 // Support: Android <=4.3 only 7710 // Default value for a checkbox should be "on" 7711 support.checkOn = input.value !== ""; 7712 7713 // Support: IE <=11 only 7714 // Must access selectedIndex to make default options select 7715 support.optSelected = opt.selected; 7716 7717 // Support: IE <=11 only 7718 // An input loses its value after becoming a radio 7719 input = document.createElement( "input" ); 7720 input.value = "t"; 7721 input.type = "radio"; 7722 support.radioValue = input.value === "t"; 7723} )(); 7724 7725 7726var boolHook, 7727 attrHandle = jQuery.expr.attrHandle; 7728 7729jQuery.fn.extend( { 7730 attr: function( name, value ) { 7731 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 7732 }, 7733 7734 removeAttr: function( name ) { 7735 return this.each( function() { 7736 jQuery.removeAttr( this, name ); 7737 } ); 7738 } 7739} ); 7740 7741jQuery.extend( { 7742 attr: function( elem, name, value ) { 7743 var ret, hooks, 7744 nType = elem.nodeType; 7745 7746 // Don't get/set attributes on text, comment and attribute nodes 7747 if ( nType === 3 || nType === 8 || nType === 2 ) { 7748 return; 7749 } 7750 7751 // Fallback to prop when attributes are not supported 7752 if ( typeof elem.getAttribute === "undefined" ) { 7753 return jQuery.prop( elem, name, value ); 7754 } 7755 7756 // Attribute hooks are determined by the lowercase version 7757 // Grab necessary hook if one is defined 7758 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 7759 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 7760 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 7761 } 7762 7763 if ( value !== undefined ) { 7764 if ( value === null ) { 7765 jQuery.removeAttr( elem, name ); 7766 return; 7767 } 7768 7769 if ( hooks && "set" in hooks && 7770 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 7771 return ret; 7772 } 7773 7774 elem.setAttribute( name, value + "" ); 7775 return value; 7776 } 7777 7778 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 7779 return ret; 7780 } 7781 7782 ret = jQuery.find.attr( elem, name ); 7783 7784 // Non-existent attributes return null, we normalize to undefined 7785 return ret == null ? undefined : ret; 7786 }, 7787 7788 attrHooks: { 7789 type: { 7790 set: function( elem, value ) { 7791 if ( !support.radioValue && value === "radio" && 7792 nodeName( elem, "input" ) ) { 7793 var val = elem.value; 7794 elem.setAttribute( "type", value ); 7795 if ( val ) { 7796 elem.value = val; 7797 } 7798 return value; 7799 } 7800 } 7801 } 7802 }, 7803 7804 removeAttr: function( elem, value ) { 7805 var name, 7806 i = 0, 7807 7808 // Attribute names can contain non-HTML whitespace characters 7809 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 7810 attrNames = value && value.match( rnothtmlwhite ); 7811 7812 if ( attrNames && elem.nodeType === 1 ) { 7813 while ( ( name = attrNames[ i++ ] ) ) { 7814 elem.removeAttribute( name ); 7815 } 7816 } 7817 } 7818} ); 7819 7820// Hooks for boolean attributes 7821boolHook = { 7822 set: function( elem, value, name ) { 7823 if ( value === false ) { 7824 7825 // Remove boolean attributes when set to false 7826 jQuery.removeAttr( elem, name ); 7827 } else { 7828 elem.setAttribute( name, name ); 7829 } 7830 return name; 7831 } 7832}; 7833 7834jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { 7835 var getter = attrHandle[ name ] || jQuery.find.attr; 7836 7837 attrHandle[ name ] = function( elem, name, isXML ) { 7838 var ret, handle, 7839 lowercaseName = name.toLowerCase(); 7840 7841 if ( !isXML ) { 7842 7843 // Avoid an infinite loop by temporarily removing this function from the getter 7844 handle = attrHandle[ lowercaseName ]; 7845 attrHandle[ lowercaseName ] = ret; 7846 ret = getter( elem, name, isXML ) != null ? 7847 lowercaseName : 7848 null; 7849 attrHandle[ lowercaseName ] = handle; 7850 } 7851 return ret; 7852 }; 7853} ); 7854 7855 7856 7857 7858var rfocusable = /^(?:input|select|textarea|button)$/i, 7859 rclickable = /^(?:a|area)$/i; 7860 7861jQuery.fn.extend( { 7862 prop: function( name, value ) { 7863 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 7864 }, 7865 7866 removeProp: function( name ) { 7867 return this.each( function() { 7868 delete this[ jQuery.propFix[ name ] || name ]; 7869 } ); 7870 } 7871} ); 7872 7873jQuery.extend( { 7874 prop: function( elem, name, value ) { 7875 var ret, hooks, 7876 nType = elem.nodeType; 7877 7878 // Don't get/set properties on text, comment and attribute nodes 7879 if ( nType === 3 || nType === 8 || nType === 2 ) { 7880 return; 7881 } 7882 7883 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 7884 7885 // Fix name and attach hooks 7886 name = jQuery.propFix[ name ] || name; 7887 hooks = jQuery.propHooks[ name ]; 7888 } 7889 7890 if ( value !== undefined ) { 7891 if ( hooks && "set" in hooks && 7892 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 7893 return ret; 7894 } 7895 7896 return ( elem[ name ] = value ); 7897 } 7898 7899 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 7900 return ret; 7901 } 7902 7903 return elem[ name ]; 7904 }, 7905 7906 propHooks: { 7907 tabIndex: { 7908 get: function( elem ) { 7909 7910 // Support: IE <=9 - 11 only 7911 // elem.tabIndex doesn't always return the 7912 // correct value when it hasn't been explicitly set 7913 // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 7914 // Use proper attribute retrieval(#12072) 7915 var tabindex = jQuery.find.attr( elem, "tabindex" ); 7916 7917 if ( tabindex ) { 7918 return parseInt( tabindex, 10 ); 7919 } 7920 7921 if ( 7922 rfocusable.test( elem.nodeName ) || 7923 rclickable.test( elem.nodeName ) && 7924 elem.href 7925 ) { 7926 return 0; 7927 } 7928 7929 return -1; 7930 } 7931 } 7932 }, 7933 7934 propFix: { 7935 "for": "htmlFor", 7936 "class": "className" 7937 } 7938} ); 7939 7940// Support: IE <=11 only 7941// Accessing the selectedIndex property 7942// forces the browser to respect setting selected 7943// on the option 7944// The getter ensures a default option is selected 7945// when in an optgroup 7946// eslint rule "no-unused-expressions" is disabled for this code 7947// since it considers such accessions noop 7948if ( !support.optSelected ) { 7949 jQuery.propHooks.selected = { 7950 get: function( elem ) { 7951 7952 /* eslint no-unused-expressions: "off" */ 7953 7954 var parent = elem.parentNode; 7955 if ( parent && parent.parentNode ) { 7956 parent.parentNode.selectedIndex; 7957 } 7958 return null; 7959 }, 7960 set: function( elem ) { 7961 7962 /* eslint no-unused-expressions: "off" */ 7963 7964 var parent = elem.parentNode; 7965 if ( parent ) { 7966 parent.selectedIndex; 7967 7968 if ( parent.parentNode ) { 7969 parent.parentNode.selectedIndex; 7970 } 7971 } 7972 } 7973 }; 7974} 7975 7976jQuery.each( [ 7977 "tabIndex", 7978 "readOnly", 7979 "maxLength", 7980 "cellSpacing", 7981 "cellPadding", 7982 "rowSpan", 7983 "colSpan", 7984 "useMap", 7985 "frameBorder", 7986 "contentEditable" 7987], function() { 7988 jQuery.propFix[ this.toLowerCase() ] = this; 7989} ); 7990 7991 7992 7993 7994 // Strip and collapse whitespace according to HTML spec 7995 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 7996 function stripAndCollapse( value ) { 7997 var tokens = value.match( rnothtmlwhite ) || []; 7998 return tokens.join( " " ); 7999 } 8000 8001 8002function getClass( elem ) { 8003 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 8004} 8005 8006function classesToArray( value ) { 8007 if ( Array.isArray( value ) ) { 8008 return value; 8009 } 8010 if ( typeof value === "string" ) { 8011 return value.match( rnothtmlwhite ) || []; 8012 } 8013 return []; 8014} 8015 8016jQuery.fn.extend( { 8017 addClass: function( value ) { 8018 var classes, elem, cur, curValue, clazz, j, finalValue, 8019 i = 0; 8020 8021 if ( isFunction( value ) ) { 8022 return this.each( function( j ) { 8023 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 8024 } ); 8025 } 8026 8027 classes = classesToArray( value ); 8028 8029 if ( classes.length ) { 8030 while ( ( elem = this[ i++ ] ) ) { 8031 curValue = getClass( elem ); 8032 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8033 8034 if ( cur ) { 8035 j = 0; 8036 while ( ( clazz = classes[ j++ ] ) ) { 8037 if ( cur.indexOf( " " + clazz + " " ) < 0 ) { 8038 cur += clazz + " "; 8039 } 8040 } 8041 8042 // Only assign if different to avoid unneeded rendering. 8043 finalValue = stripAndCollapse( cur ); 8044 if ( curValue !== finalValue ) { 8045 elem.setAttribute( "class", finalValue ); 8046 } 8047 } 8048 } 8049 } 8050 8051 return this; 8052 }, 8053 8054 removeClass: function( value ) { 8055 var classes, elem, cur, curValue, clazz, j, finalValue, 8056 i = 0; 8057 8058 if ( isFunction( value ) ) { 8059 return this.each( function( j ) { 8060 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 8061 } ); 8062 } 8063 8064 if ( !arguments.length ) { 8065 return this.attr( "class", "" ); 8066 } 8067 8068 classes = classesToArray( value ); 8069 8070 if ( classes.length ) { 8071 while ( ( elem = this[ i++ ] ) ) { 8072 curValue = getClass( elem ); 8073 8074 // This expression is here for better compressibility (see addClass) 8075 cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8076 8077 if ( cur ) { 8078 j = 0; 8079 while ( ( clazz = classes[ j++ ] ) ) { 8080 8081 // Remove *all* instances 8082 while ( cur.indexOf( " " + clazz + " " ) > -1 ) { 8083 cur = cur.replace( " " + clazz + " ", " " ); 8084 } 8085 } 8086 8087 // Only assign if different to avoid unneeded rendering. 8088 finalValue = stripAndCollapse( cur ); 8089 if ( curValue !== finalValue ) { 8090 elem.setAttribute( "class", finalValue ); 8091 } 8092 } 8093 } 8094 } 8095 8096 return this; 8097 }, 8098 8099 toggleClass: function( value, stateVal ) { 8100 var type = typeof value, 8101 isValidValue = type === "string" || Array.isArray( value ); 8102 8103 if ( typeof stateVal === "boolean" && isValidValue ) { 8104 return stateVal ? this.addClass( value ) : this.removeClass( value ); 8105 } 8106 8107 if ( isFunction( value ) ) { 8108 return this.each( function( i ) { 8109 jQuery( this ).toggleClass( 8110 value.call( this, i, getClass( this ), stateVal ), 8111 stateVal 8112 ); 8113 } ); 8114 } 8115 8116 return this.each( function() { 8117 var className, i, self, classNames; 8118 8119 if ( isValidValue ) { 8120 8121 // Toggle individual class names 8122 i = 0; 8123 self = jQuery( this ); 8124 classNames = classesToArray( value ); 8125 8126 while ( ( className = classNames[ i++ ] ) ) { 8127 8128 // Check each className given, space separated list 8129 if ( self.hasClass( className ) ) { 8130 self.removeClass( className ); 8131 } else { 8132 self.addClass( className ); 8133 } 8134 } 8135 8136 // Toggle whole class name 8137 } else if ( value === undefined || type === "boolean" ) { 8138 className = getClass( this ); 8139 if ( className ) { 8140 8141 // Store className if set 8142 dataPriv.set( this, "__className__", className ); 8143 } 8144 8145 // If the element has a class name or if we're passed `false`, 8146 // then remove the whole classname (if there was one, the above saved it). 8147 // Otherwise bring back whatever was previously saved (if anything), 8148 // falling back to the empty string if nothing was stored. 8149 if ( this.setAttribute ) { 8150 this.setAttribute( "class", 8151 className || value === false ? 8152 "" : 8153 dataPriv.get( this, "__className__" ) || "" 8154 ); 8155 } 8156 } 8157 } ); 8158 }, 8159 8160 hasClass: function( selector ) { 8161 var className, elem, 8162 i = 0; 8163 8164 className = " " + selector + " "; 8165 while ( ( elem = this[ i++ ] ) ) { 8166 if ( elem.nodeType === 1 && 8167 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 8168 return true; 8169 } 8170 } 8171 8172 return false; 8173 } 8174} ); 8175 8176 8177 8178 8179var rreturn = /\r/g; 8180 8181jQuery.fn.extend( { 8182 val: function( value ) { 8183 var hooks, ret, valueIsFunction, 8184 elem = this[ 0 ]; 8185 8186 if ( !arguments.length ) { 8187 if ( elem ) { 8188 hooks = jQuery.valHooks[ elem.type ] || 8189 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 8190 8191 if ( hooks && 8192 "get" in hooks && 8193 ( ret = hooks.get( elem, "value" ) ) !== undefined 8194 ) { 8195 return ret; 8196 } 8197 8198 ret = elem.value; 8199 8200 // Handle most common string cases 8201 if ( typeof ret === "string" ) { 8202 return ret.replace( rreturn, "" ); 8203 } 8204 8205 // Handle cases where value is null/undef or number 8206 return ret == null ? "" : ret; 8207 } 8208 8209 return; 8210 } 8211 8212 valueIsFunction = isFunction( value ); 8213 8214 return this.each( function( i ) { 8215 var val; 8216 8217 if ( this.nodeType !== 1 ) { 8218 return; 8219 } 8220 8221 if ( valueIsFunction ) { 8222 val = value.call( this, i, jQuery( this ).val() ); 8223 } else { 8224 val = value; 8225 } 8226 8227 // Treat null/undefined as ""; convert numbers to string 8228 if ( val == null ) { 8229 val = ""; 8230 8231 } else if ( typeof val === "number" ) { 8232 val += ""; 8233 8234 } else if ( Array.isArray( val ) ) { 8235 val = jQuery.map( val, function( value ) { 8236 return value == null ? "" : value + ""; 8237 } ); 8238 } 8239 8240 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 8241 8242 // If set returns undefined, fall back to normal setting 8243 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 8244 this.value = val; 8245 } 8246 } ); 8247 } 8248} ); 8249 8250jQuery.extend( { 8251 valHooks: { 8252 option: { 8253 get: function( elem ) { 8254 8255 var val = jQuery.find.attr( elem, "value" ); 8256 return val != null ? 8257 val : 8258 8259 // Support: IE <=10 - 11 only 8260 // option.text throws exceptions (#14686, #14858) 8261 // Strip and collapse whitespace 8262 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 8263 stripAndCollapse( jQuery.text( elem ) ); 8264 } 8265 }, 8266 select: { 8267 get: function( elem ) { 8268 var value, option, i, 8269 options = elem.options, 8270 index = elem.selectedIndex, 8271 one = elem.type === "select-one", 8272 values = one ? null : [], 8273 max = one ? index + 1 : options.length; 8274 8275 if ( index < 0 ) { 8276 i = max; 8277 8278 } else { 8279 i = one ? index : 0; 8280 } 8281 8282 // Loop through all the selected options 8283 for ( ; i < max; i++ ) { 8284 option = options[ i ]; 8285 8286 // Support: IE <=9 only 8287 // IE8-9 doesn't update selected after form reset (#2551) 8288 if ( ( option.selected || i === index ) && 8289 8290 // Don't return options that are disabled or in a disabled optgroup 8291 !option.disabled && 8292 ( !option.parentNode.disabled || 8293 !nodeName( option.parentNode, "optgroup" ) ) ) { 8294 8295 // Get the specific value for the option 8296 value = jQuery( option ).val(); 8297 8298 // We don't need an array for one selects 8299 if ( one ) { 8300 return value; 8301 } 8302 8303 // Multi-Selects return an array 8304 values.push( value ); 8305 } 8306 } 8307 8308 return values; 8309 }, 8310 8311 set: function( elem, value ) { 8312 var optionSet, option, 8313 options = elem.options, 8314 values = jQuery.makeArray( value ), 8315 i = options.length; 8316 8317 while ( i-- ) { 8318 option = options[ i ]; 8319 8320 /* eslint-disable no-cond-assign */ 8321 8322 if ( option.selected = 8323 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 8324 ) { 8325 optionSet = true; 8326 } 8327 8328 /* eslint-enable no-cond-assign */ 8329 } 8330 8331 // Force browsers to behave consistently when non-matching value is set 8332 if ( !optionSet ) { 8333 elem.selectedIndex = -1; 8334 } 8335 return values; 8336 } 8337 } 8338 } 8339} ); 8340 8341// Radios and checkboxes getter/setter 8342jQuery.each( [ "radio", "checkbox" ], function() { 8343 jQuery.valHooks[ this ] = { 8344 set: function( elem, value ) { 8345 if ( Array.isArray( value ) ) { 8346 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 8347 } 8348 } 8349 }; 8350 if ( !support.checkOn ) { 8351 jQuery.valHooks[ this ].get = function( elem ) { 8352 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 8353 }; 8354 } 8355} ); 8356 8357 8358 8359 8360// Return jQuery for attributes-only inclusion 8361 8362 8363support.focusin = "onfocusin" in window; 8364 8365 8366var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 8367 stopPropagationCallback = function( e ) { 8368 e.stopPropagation(); 8369 }; 8370 8371jQuery.extend( jQuery.event, { 8372 8373 trigger: function( event, data, elem, onlyHandlers ) { 8374 8375 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 8376 eventPath = [ elem || document ], 8377 type = hasOwn.call( event, "type" ) ? event.type : event, 8378 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 8379 8380 cur = lastElement = tmp = elem = elem || document; 8381 8382 // Don't do events on text and comment nodes 8383 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 8384 return; 8385 } 8386 8387 // focus/blur morphs to focusin/out; ensure we're not firing them right now 8388 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 8389 return; 8390 } 8391 8392 if ( type.indexOf( "." ) > -1 ) { 8393 8394 // Namespaced trigger; create a regexp to match event type in handle() 8395 namespaces = type.split( "." ); 8396 type = namespaces.shift(); 8397 namespaces.sort(); 8398 } 8399 ontype = type.indexOf( ":" ) < 0 && "on" + type; 8400 8401 // Caller can pass in a jQuery.Event object, Object, or just an event type string 8402 event = event[ jQuery.expando ] ? 8403 event : 8404 new jQuery.Event( type, typeof event === "object" && event ); 8405 8406 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 8407 event.isTrigger = onlyHandlers ? 2 : 3; 8408 event.namespace = namespaces.join( "." ); 8409 event.rnamespace = event.namespace ? 8410 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 8411 null; 8412 8413 // Clean up the event in case it is being reused 8414 event.result = undefined; 8415 if ( !event.target ) { 8416 event.target = elem; 8417 } 8418 8419 // Clone any incoming data and prepend the event, creating the handler arg list 8420 data = data == null ? 8421 [ event ] : 8422 jQuery.makeArray( data, [ event ] ); 8423 8424 // Allow special events to draw outside the lines 8425 special = jQuery.event.special[ type ] || {}; 8426 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 8427 return; 8428 } 8429 8430 // Determine event propagation path in advance, per W3C events spec (#9951) 8431 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 8432 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 8433 8434 bubbleType = special.delegateType || type; 8435 if ( !rfocusMorph.test( bubbleType + type ) ) { 8436 cur = cur.parentNode; 8437 } 8438 for ( ; cur; cur = cur.parentNode ) { 8439 eventPath.push( cur ); 8440 tmp = cur; 8441 } 8442 8443 // Only add window if we got to document (e.g., not plain obj or detached DOM) 8444 if ( tmp === ( elem.ownerDocument || document ) ) { 8445 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 8446 } 8447 } 8448 8449 // Fire handlers on the event path 8450 i = 0; 8451 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 8452 lastElement = cur; 8453 event.type = i > 1 ? 8454 bubbleType : 8455 special.bindType || type; 8456 8457 // jQuery handler 8458 handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] && 8459 dataPriv.get( cur, "handle" ); 8460 if ( handle ) { 8461 handle.apply( cur, data ); 8462 } 8463 8464 // Native handler 8465 handle = ontype && cur[ ontype ]; 8466 if ( handle && handle.apply && acceptData( cur ) ) { 8467 event.result = handle.apply( cur, data ); 8468 if ( event.result === false ) { 8469 event.preventDefault(); 8470 } 8471 } 8472 } 8473 event.type = type; 8474 8475 // If nobody prevented the default action, do it now 8476 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 8477 8478 if ( ( !special._default || 8479 special._default.apply( eventPath.pop(), data ) === false ) && 8480 acceptData( elem ) ) { 8481 8482 // Call a native DOM method on the target with the same name as the event. 8483 // Don't do default actions on window, that's where global variables be (#6170) 8484 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 8485 8486 // Don't re-trigger an onFOO event when we call its FOO() method 8487 tmp = elem[ ontype ]; 8488 8489 if ( tmp ) { 8490 elem[ ontype ] = null; 8491 } 8492 8493 // Prevent re-triggering of the same event, since we already bubbled it above 8494 jQuery.event.triggered = type; 8495 8496 if ( event.isPropagationStopped() ) { 8497 lastElement.addEventListener( type, stopPropagationCallback ); 8498 } 8499 8500 elem[ type ](); 8501 8502 if ( event.isPropagationStopped() ) { 8503 lastElement.removeEventListener( type, stopPropagationCallback ); 8504 } 8505 8506 jQuery.event.triggered = undefined; 8507 8508 if ( tmp ) { 8509 elem[ ontype ] = tmp; 8510 } 8511 } 8512 } 8513 } 8514 8515 return event.result; 8516 }, 8517 8518 // Piggyback on a donor event to simulate a different one 8519 // Used only for `focus(in | out)` events 8520 simulate: function( type, elem, event ) { 8521 var e = jQuery.extend( 8522 new jQuery.Event(), 8523 event, 8524 { 8525 type: type, 8526 isSimulated: true 8527 } 8528 ); 8529 8530 jQuery.event.trigger( e, null, elem ); 8531 } 8532 8533} ); 8534 8535jQuery.fn.extend( { 8536 8537 trigger: function( type, data ) { 8538 return this.each( function() { 8539 jQuery.event.trigger( type, data, this ); 8540 } ); 8541 }, 8542 triggerHandler: function( type, data ) { 8543 var elem = this[ 0 ]; 8544 if ( elem ) { 8545 return jQuery.event.trigger( type, data, elem, true ); 8546 } 8547 } 8548} ); 8549 8550 8551// Support: Firefox <=44 8552// Firefox doesn't have focus(in | out) events 8553// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 8554// 8555// Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 8556// focus(in | out) events fire after focus & blur events, 8557// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 8558// Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 8559if ( !support.focusin ) { 8560 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { 8561 8562 // Attach a single capturing handler on the document while someone wants focusin/focusout 8563 var handler = function( event ) { 8564 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); 8565 }; 8566 8567 jQuery.event.special[ fix ] = { 8568 setup: function() { 8569 var doc = this.ownerDocument || this, 8570 attaches = dataPriv.access( doc, fix ); 8571 8572 if ( !attaches ) { 8573 doc.addEventListener( orig, handler, true ); 8574 } 8575 dataPriv.access( doc, fix, ( attaches || 0 ) + 1 ); 8576 }, 8577 teardown: function() { 8578 var doc = this.ownerDocument || this, 8579 attaches = dataPriv.access( doc, fix ) - 1; 8580 8581 if ( !attaches ) { 8582 doc.removeEventListener( orig, handler, true ); 8583 dataPriv.remove( doc, fix ); 8584 8585 } else { 8586 dataPriv.access( doc, fix, attaches ); 8587 } 8588 } 8589 }; 8590 } ); 8591} 8592var location = window.location; 8593 8594var nonce = Date.now(); 8595 8596var rquery = ( /\?/ ); 8597 8598 8599 8600// Cross-browser xml parsing 8601jQuery.parseXML = function( data ) { 8602 var xml; 8603 if ( !data || typeof data !== "string" ) { 8604 return null; 8605 } 8606 8607 // Support: IE 9 - 11 only 8608 // IE throws on parseFromString with invalid input. 8609 try { 8610 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 8611 } catch ( e ) { 8612 xml = undefined; 8613 } 8614 8615 if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) { 8616 jQuery.error( "Invalid XML: " + data ); 8617 } 8618 return xml; 8619}; 8620 8621 8622var 8623 rbracket = /\[\]$/, 8624 rCRLF = /\r?\n/g, 8625 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 8626 rsubmittable = /^(?:input|select|textarea|keygen)/i; 8627 8628function buildParams( prefix, obj, traditional, add ) { 8629 var name; 8630 8631 if ( Array.isArray( obj ) ) { 8632 8633 // Serialize array item. 8634 jQuery.each( obj, function( i, v ) { 8635 if ( traditional || rbracket.test( prefix ) ) { 8636 8637 // Treat each array item as a scalar. 8638 add( prefix, v ); 8639 8640 } else { 8641 8642 // Item is non-scalar (array or object), encode its numeric index. 8643 buildParams( 8644 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 8645 v, 8646 traditional, 8647 add 8648 ); 8649 } 8650 } ); 8651 8652 } else if ( !traditional && toType( obj ) === "object" ) { 8653 8654 // Serialize object item. 8655 for ( name in obj ) { 8656 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 8657 } 8658 8659 } else { 8660 8661 // Serialize scalar item. 8662 add( prefix, obj ); 8663 } 8664} 8665 8666// Serialize an array of form elements or a set of 8667// key/values into a query string 8668jQuery.param = function( a, traditional ) { 8669 var prefix, 8670 s = [], 8671 add = function( key, valueOrFunction ) { 8672 8673 // If value is a function, invoke it and use its return value 8674 var value = isFunction( valueOrFunction ) ? 8675 valueOrFunction() : 8676 valueOrFunction; 8677 8678 s[ s.length ] = encodeURIComponent( key ) + "=" + 8679 encodeURIComponent( value == null ? "" : value ); 8680 }; 8681 8682
vendor: 4,357 bytes, lines 8682-8831
8682if ( a == null ) { 8683 return ""; 8684 } 8685 8686 // If an array was passed in, assume that it is an array of form elements. 8687 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 8688 8689 // Serialize the form elements 8690 jQuery.each( a, function() { 8691 add( this.name, this.value ); 8692 } ); 8693 8694 } else { 8695 8696 // If traditional, encode the "old" way (the way 1.3.2 or older 8697 // did it), otherwise encode params recursively. 8698 for ( prefix in a ) { 8699 buildParams( prefix, a[ prefix ], traditional, add ); 8700 } 8701 } 8702 8703 // Return the resulting serialization 8704 return s.join( "&" ); 8705}; 8706 8707jQuery.fn.extend( { 8708 serialize: function() { 8709 return jQuery.param( this.serializeArray() ); 8710 }, 8711 serializeArray: function() { 8712 return this.map( function() { 8713 8714 // Can add propHook for "elements" to filter or add form elements 8715 var elements = jQuery.prop( this, "elements" ); 8716 return elements ? jQuery.makeArray( elements ) : this; 8717 } ) 8718 .filter( function() { 8719 var type = this.type; 8720 8721 // Use .is( ":disabled" ) so that fieldset[disabled] works 8722 return this.name && !jQuery( this ).is( ":disabled" ) && 8723 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 8724 ( this.checked || !rcheckableType.test( type ) ); 8725 } ) 8726 .map( function( i, elem ) { 8727 var val = jQuery( this ).val(); 8728 8729 if ( val == null ) { 8730 return null; 8731 } 8732 8733 if ( Array.isArray( val ) ) { 8734 return jQuery.map( val, function( val ) { 8735 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 8736 } ); 8737 } 8738 8739 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 8740 } ).get(); 8741 } 8742} ); 8743 8744 8745var 8746 r20 = /%20/g, 8747 rhash = /#.*$/, 8748 rantiCache = /([?&])_=[^&]*/, 8749 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 8750 8751 // #7653, #8125, #8152: local protocol detection 8752 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 8753 rnoContent = /^(?:GET|HEAD)$/, 8754 rprotocol = /^\/\//, 8755 8756 /* Prefilters 8757 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 8758 * 2) These are called: 8759 * - BEFORE asking for a transport 8760 * - AFTER param serialization (s.data is a string if s.processData is true) 8761 * 3) key is the dataType 8762 * 4) the catchall symbol "*" can be used 8763 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 8764 */ 8765 prefilters = {}, 8766 8767 /* Transports bindings 8768 * 1) key is the dataType 8769 * 2) the catchall symbol "*" can be used 8770 * 3) selection will start with transport dataType and THEN go to "*" if needed 8771 */ 8772 transports = {}, 8773 8774 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 8775 allTypes = "*/".concat( "*" ), 8776 8777 // Anchor tag for parsing the document origin 8778 originAnchor = document.createElement( "a" ); 8779 originAnchor.href = location.href; 8780 8781// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 8782function addToPrefiltersOrTransports( structure ) { 8783 8784 // dataTypeExpression is optional and defaults to "*" 8785 return function( dataTypeExpression, func ) { 8786 8787 if ( typeof dataTypeExpression !== "string" ) { 8788 func = dataTypeExpression; 8789 dataTypeExpression = "*"; 8790 } 8791 8792 var dataType, 8793 i = 0, 8794 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 8795 8796 if ( isFunction( func ) ) { 8797 8798 // For each dataType in the dataTypeExpression 8799 while ( ( dataType = dataTypes[ i++ ] ) ) { 8800 8801 // Prepend if requested 8802 if ( dataType[ 0 ] === "+" ) { 8803 dataType = dataType.slice( 1 ) || "*"; 8804 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 8805 8806 // Otherwise append 8807 } else { 8808 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 8809 } 8810 } 8811 } 8812 }; 8813} 8814 8815// Base inspection function for prefilters and transports 8816function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 8817 8818 var inspected = {}, 8819 seekingTransport = ( structure === transports ); 8820 8821 function inspect( dataType ) { 8822 var selected; 8823 inspected[ dataType ] = true; 8824 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 8825 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 8826 if ( typeof dataTypeOrTransport === "string" && 8827 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 8828 8829 options.dataTypes.unshift( dataTypeOrTransport ); 8830 inspect( dataTypeOrTransport ); 8831 return false;
vendor: 10,690 bytes, lines 8832-9269
8832 } else if ( seekingTransport ) { 8833 return !( selected = dataTypeOrTransport ); 8834 } 8835 } ); 8836 return selected; 8837 } 8838 8839 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 8840} 8841 8842// A special extend for ajax options 8843// that takes "flat" options (not to be deep extended) 8844// Fixes #9887 8845function ajaxExtend( target, src ) { 8846 var key, deep, 8847 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 8848 8849 for ( key in src ) { 8850 if ( src[ key ] !== undefined ) { 8851 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 8852 } 8853 } 8854 if ( deep ) { 8855 jQuery.extend( true, target, deep ); 8856 } 8857 8858 return target; 8859} 8860 8861/* Handles responses to an ajax request: 8862 * - finds the right dataType (mediates between content-type and expected dataType) 8863 * - returns the corresponding response 8864 */ 8865function ajaxHandleResponses( s, jqXHR, responses ) { 8866 8867 var ct, type, finalDataType, firstDataType, 8868 contents = s.contents, 8869 dataTypes = s.dataTypes; 8870 8871 // Remove auto dataType and get content-type in the process 8872 while ( dataTypes[ 0 ] === "*" ) { 8873 dataTypes.shift(); 8874 if ( ct === undefined ) { 8875 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 8876 } 8877 } 8878 8879 // Check if we're dealing with a known content-type 8880 if ( ct ) { 8881 for ( type in contents ) { 8882 if ( contents[ type ] && contents[ type ].test( ct ) ) { 8883 dataTypes.unshift( type ); 8884 break; 8885 } 8886 } 8887 } 8888 8889 // Check to see if we have a response for the expected dataType 8890 if ( dataTypes[ 0 ] in responses ) { 8891 finalDataType = dataTypes[ 0 ]; 8892 } else { 8893 8894 // Try convertible dataTypes 8895 for ( type in responses ) { 8896 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 8897 finalDataType = type; 8898 break; 8899 } 8900 if ( !firstDataType ) { 8901 firstDataType = type; 8902 } 8903 } 8904 8905 // Or just use first one 8906 finalDataType = finalDataType || firstDataType; 8907 } 8908 8909 // If we found a dataType 8910 // We add the dataType to the list if needed 8911 // and return the corresponding response 8912 if ( finalDataType ) { 8913 if ( finalDataType !== dataTypes[ 0 ] ) { 8914 dataTypes.unshift( finalDataType ); 8915 } 8916 return responses[ finalDataType ]; 8917 } 8918} 8919 8920/* Chain conversions given the request and the original response 8921 * Also sets the responseXXX fields on the jqXHR instance 8922 */ 8923function ajaxConvert( s, response, jqXHR, isSuccess ) { 8924 var conv2, current, conv, tmp, prev, 8925 converters = {}, 8926 8927 // Work with a copy of dataTypes in case we need to modify it for conversion 8928 dataTypes = s.dataTypes.slice(); 8929 8930 // Create converters map with lowercased keys 8931 if ( dataTypes[ 1 ] ) { 8932 for ( conv in s.converters ) { 8933 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 8934 } 8935 } 8936 8937 current = dataTypes.shift(); 8938 8939 // Convert to each sequential dataType 8940 while ( current ) { 8941 8942 if ( s.responseFields[ current ] ) { 8943 jqXHR[ s.responseFields[ current ] ] = response; 8944 } 8945 8946 // Apply the dataFilter if provided 8947 if ( !prev && isSuccess && s.dataFilter ) { 8948 response = s.dataFilter( response, s.dataType ); 8949 } 8950 8951 prev = current; 8952 current = dataTypes.shift(); 8953 8954 if ( current ) { 8955 8956 // There's only work to do if current dataType is non-auto 8957 if ( current === "*" ) { 8958 8959 current = prev; 8960 8961 // Convert response if prev dataType is non-auto and differs from current 8962 } else if ( prev !== "*" && prev !== current ) { 8963 8964 // Seek a direct converter 8965 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 8966 8967 // If none found, seek a pair 8968 if ( !conv ) { 8969 for ( conv2 in converters ) { 8970 8971 // If conv2 outputs current 8972 tmp = conv2.split( " " ); 8973 if ( tmp[ 1 ] === current ) { 8974 8975 // If prev can be converted to accepted input 8976 conv = converters[ prev + " " + tmp[ 0 ] ] || 8977 converters[ "* " + tmp[ 0 ] ]; 8978 if ( conv ) { 8979 8980 // Condense equivalence converters 8981 if ( conv === true ) { 8982 conv = converters[ conv2 ]; 8983 8984 // Otherwise, insert the intermediate dataType 8985 } else if ( converters[ conv2 ] !== true ) { 8986 current = tmp[ 0 ]; 8987 dataTypes.unshift( tmp[ 1 ] ); 8988 } 8989 break; 8990 } 8991 } 8992 } 8993 } 8994 8995 // Apply converter (if not an equivalence) 8996 if ( conv !== true ) { 8997 8998 // Unless errors are allowed to bubble, catch and return them 8999 if ( conv && s.throws ) { 9000 response = conv( response ); 9001 } else { 9002 try { 9003 response = conv( response ); 9004 } catch ( e ) { 9005 return { 9006 state: "parsererror", 9007 error: conv ? e : "No conversion from " + prev + " to " + current 9008 }; 9009 } 9010 } 9011 } 9012 } 9013 } 9014 } 9015 9016 return { state: "success", data: response }; 9017} 9018 9019jQuery.extend( { 9020 9021 // Counter for holding the number of active queries 9022 active: 0, 9023 9024 // Last-Modified header cache for next request 9025 lastModified: {}, 9026 etag: {}, 9027 9028 ajaxSettings: { 9029 url: location.href, 9030 type: "GET", 9031 isLocal: rlocalProtocol.test( location.protocol ), 9032 global: true, 9033 processData: true, 9034 async: true, 9035 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 9036 9037 /* 9038 timeout: 0, 9039 data: null, 9040 dataType: null, 9041 username: null, 9042 password: null, 9043 cache: null, 9044 throws: false, 9045 traditional: false, 9046 headers: {}, 9047 */ 9048 9049 accepts: { 9050 "*": allTypes, 9051 text: "text/plain", 9052 html: "text/html", 9053 xml: "application/xml, text/xml", 9054 json: "application/json, text/javascript" 9055 }, 9056 9057 contents: { 9058 xml: /\bxml\b/, 9059 html: /\bhtml/, 9060 json: /\bjson\b/ 9061 }, 9062 9063 responseFields: { 9064 xml: "responseXML", 9065 text: "responseText", 9066 json: "responseJSON" 9067 }, 9068 9069 // Data converters 9070 // Keys separate source (or catchall "*") and destination types with a single space 9071 converters: { 9072 9073 // Convert anything to text 9074 "* text": String, 9075 9076 // Text to html (true = no transformation) 9077 "text html": true, 9078 9079 // Evaluate text as a json expression 9080 "text json": JSON.parse, 9081 9082 // Parse text as xml 9083 "text xml": jQuery.parseXML 9084 }, 9085 9086 // For options that shouldn't be deep extended: 9087 // you can add your own custom options here if 9088 // and when you create one that shouldn't be 9089 // deep extended (see ajaxExtend) 9090 flatOptions: { 9091 url: true, 9092 context: true 9093 } 9094 }, 9095 9096 // Creates a full fledged settings object into target 9097 // with both ajaxSettings and settings fields. 9098 // If target is omitted, writes into ajaxSettings. 9099 ajaxSetup: function( target, settings ) { 9100 return settings ? 9101 9102 // Building a settings object 9103 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 9104 9105 // Extending ajaxSettings 9106 ajaxExtend( jQuery.ajaxSettings, target ); 9107 }, 9108 9109 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 9110 ajaxTransport: addToPrefiltersOrTransports( transports ), 9111 9112 // Main method 9113 ajax: function( url, options ) { 9114 9115 // If url is an object, simulate pre-1.5 signature 9116 if ( typeof url === "object" ) { 9117 options = url; 9118 url = undefined; 9119 } 9120 9121 // Force options to be an object 9122 options = options || {}; 9123 9124 var transport, 9125 9126 // URL without anti-cache param 9127 cacheURL, 9128 9129 // Response headers 9130 responseHeadersString, 9131 responseHeaders, 9132 9133 // timeout handle 9134 timeoutTimer, 9135 9136 // Url cleanup var 9137 urlAnchor, 9138 9139 // Request state (becomes false upon send and true upon completion) 9140 completed, 9141 9142 // To know if global events are to be dispatched 9143 fireGlobals, 9144 9145 // Loop variable 9146 i, 9147 9148 // uncached part of the url 9149 uncached, 9150 9151 // Create the final options object 9152 s = jQuery.ajaxSetup( {}, options ), 9153 9154 // Callbacks context 9155 callbackContext = s.context || s, 9156 9157 // Context for global events is callbackContext if it is a DOM node or jQuery collection 9158 globalEventContext = s.context && 9159 ( callbackContext.nodeType || callbackContext.jquery ) ? 9160 jQuery( callbackContext ) : 9161 jQuery.event, 9162 9163 // Deferreds 9164 deferred = jQuery.Deferred(), 9165 completeDeferred = jQuery.Callbacks( "once memory" ), 9166 9167 // Status-dependent callbacks 9168 statusCode = s.statusCode || {}, 9169 9170 // Headers (they are sent all at once) 9171 requestHeaders = {}, 9172 requestHeadersNames = {}, 9173 9174 // Default abort message 9175 strAbort = "canceled", 9176 9177 // Fake xhr 9178 jqXHR = { 9179 readyState: 0, 9180 9181 // Builds headers hashtable if needed 9182 getResponseHeader: function( key ) { 9183 var match; 9184 if ( completed ) { 9185 if ( !responseHeaders ) { 9186 responseHeaders = {}; 9187 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 9188 responseHeaders[ match[ 1 ].toLowerCase() + " " ] = 9189 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) 9190 .concat( match[ 2 ] ); 9191 } 9192 } 9193 match = responseHeaders[ key.toLowerCase() + " " ]; 9194 } 9195 return match == null ? null : match.join( ", " ); 9196 }, 9197 9198 // Raw string 9199 getAllResponseHeaders: function() { 9200 return completed ? responseHeadersString : null; 9201 }, 9202 9203 // Caches the header 9204 setRequestHeader: function( name, value ) { 9205 if ( completed == null ) { 9206 name = requestHeadersNames[ name.toLowerCase() ] = 9207 requestHeadersNames[ name.toLowerCase() ] || name; 9208 requestHeaders[ name ] = value; 9209 } 9210 return this; 9211 }, 9212 9213 // Overrides response content-type header 9214 overrideMimeType: function( type ) { 9215 if ( completed == null ) { 9216 s.mimeType = type; 9217 } 9218 return this; 9219 }, 9220 9221 // Status-dependent callbacks 9222 statusCode: function( map ) { 9223 var code; 9224 if ( map ) { 9225 if ( completed ) { 9226 9227 // Execute the appropriate callbacks 9228 jqXHR.always( map[ jqXHR.status ] ); 9229 } else { 9230 9231 // Lazy-add the new callbacks in a way that preserves old ones 9232 for ( code in map ) { 9233 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 9234 } 9235 } 9236 } 9237 return this; 9238 }, 9239 9240 // Cancel the request 9241 abort: function( statusText ) { 9242 var finalText = statusText || strAbort; 9243 if ( transport ) { 9244 transport.abort( finalText ); 9245 } 9246 done( 0, finalText ); 9247 return this; 9248 } 9249 }; 9250 9251 // Attach deferreds 9252 deferred.promise( jqXHR ); 9253 9254 // Add protocol if not provided (prefilters might expect it) 9255 // Handle falsy url in the settings object (#10093: consistency with old signature) 9256 // We also use the url parameter if available 9257 s.url = ( ( url || s.url || location.href ) + "" ) 9258 .replace( rprotocol, location.protocol + "//" ); 9259 9260 // Alias method option to type as per ticket #12004 9261 s.type = options.method || options.type || s.method || s.type; 9262 9263 // Extract dataTypes list 9264 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 9265 9266 // A cross-domain request is in order when the origin doesn't match the current origin. 9267 if ( s.crossDomain == null ) { 9268 urlAnchor = document.createElement( "a" ); 9269
vendor: 16,294 bytes, lines 9270-9900
9270 // Support: IE <=8 - 11, Edge 12 - 15 9271 // IE throws exception on accessing the href property if url is malformed, 9272 // e.g. http://example.com:80x/ 9273 try { 9274 urlAnchor.href = s.url; 9275 9276 // Support: IE <=8 - 11 only 9277 // Anchor's host property isn't correctly set when s.url is relative 9278 urlAnchor.href = urlAnchor.href; 9279 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 9280 urlAnchor.protocol + "//" + urlAnchor.host; 9281 } catch ( e ) { 9282 9283 // If there is an error parsing the URL, assume it is crossDomain, 9284 // it can be rejected by the transport if it is invalid 9285 s.crossDomain = true; 9286 } 9287 } 9288 9289 // Convert data if not already a string 9290 if ( s.data && s.processData && typeof s.data !== "string" ) { 9291 s.data = jQuery.param( s.data, s.traditional ); 9292 } 9293 9294 // Apply prefilters 9295 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 9296 9297 // If request was aborted inside a prefilter, stop there 9298 if ( completed ) { 9299 return jqXHR; 9300 } 9301 9302 // We can fire global events as of now if asked to 9303 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) 9304 fireGlobals = jQuery.event && s.global; 9305 9306 // Watch for a new set of requests 9307 if ( fireGlobals && jQuery.active++ === 0 ) { 9308 jQuery.event.trigger( "ajaxStart" ); 9309 } 9310 9311 // Uppercase the type 9312 s.type = s.type.toUpperCase(); 9313 9314 // Determine if request has content 9315 s.hasContent = !rnoContent.test( s.type ); 9316 9317 // Save the URL in case we're toying with the If-Modified-Since 9318 // and/or If-None-Match header later on 9319 // Remove hash to simplify url manipulation 9320 cacheURL = s.url.replace( rhash, "" ); 9321 9322 // More options handling for requests with no content 9323 if ( !s.hasContent ) { 9324 9325 // Remember the hash so we can put it back 9326 uncached = s.url.slice( cacheURL.length ); 9327 9328 // If data is available and should be processed, append data to url 9329 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 9330 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 9331 9332 // #9682: remove data so that it's not used in an eventual retry 9333 delete s.data; 9334 } 9335 9336 // Add or update anti-cache param if needed 9337 if ( s.cache === false ) { 9338 cacheURL = cacheURL.replace( rantiCache, "$1" ); 9339 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached; 9340 } 9341 9342 // Put hash and anti-cache on the URL that will be requested (gh-1732) 9343 s.url = cacheURL + uncached; 9344 9345 // Change '%20' to '+' if this is encoded form body content (gh-2658) 9346 } else if ( s.data && s.processData && 9347 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 9348 s.data = s.data.replace( r20, "+" ); 9349 } 9350 9351 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9352 if ( s.ifModified ) { 9353 if ( jQuery.lastModified[ cacheURL ] ) { 9354 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 9355 } 9356 if ( jQuery.etag[ cacheURL ] ) { 9357 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 9358 } 9359 } 9360 9361 // Set the correct header, if data is being sent 9362 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 9363 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 9364 } 9365 9366 // Set the Accepts header for the server, depending on the dataType 9367 jqXHR.setRequestHeader( 9368 "Accept", 9369 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 9370 s.accepts[ s.dataTypes[ 0 ] ] + 9371 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 9372 s.accepts[ "*" ] 9373 ); 9374 9375 // Check for headers option 9376 for ( i in s.headers ) { 9377 jqXHR.setRequestHeader( i, s.headers[ i ] ); 9378 } 9379 9380 // Allow custom headers/mimetypes and early abort 9381 if ( s.beforeSend && 9382 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 9383 9384 // Abort if not done already and return 9385 return jqXHR.abort(); 9386 } 9387 9388 // Aborting is no longer a cancellation 9389 strAbort = "abort"; 9390 9391 // Install callbacks on deferreds 9392 completeDeferred.add( s.complete ); 9393 jqXHR.done( s.success ); 9394 jqXHR.fail( s.error ); 9395 9396 // Get transport 9397 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 9398 9399 // If no transport, we auto-abort 9400 if ( !transport ) { 9401 done( -1, "No Transport" ); 9402 } else { 9403 jqXHR.readyState = 1; 9404 9405 // Send global event 9406 if ( fireGlobals ) { 9407 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 9408 } 9409 9410 // If request was aborted inside ajaxSend, stop there 9411 if ( completed ) { 9412 return jqXHR; 9413 } 9414 9415 // Timeout 9416 if ( s.async && s.timeout > 0 ) { 9417 timeoutTimer = window.setTimeout( function() { 9418 jqXHR.abort( "timeout" ); 9419 }, s.timeout ); 9420 } 9421 9422 try { 9423 completed = false; 9424 transport.send( requestHeaders, done ); 9425 } catch ( e ) { 9426 9427 // Rethrow post-completion exceptions 9428 if ( completed ) { 9429 throw e; 9430 } 9431 9432 // Propagate others as results 9433 done( -1, e ); 9434 } 9435 } 9436 9437 // Callback for when everything is done 9438 function done( status, nativeStatusText, responses, headers ) { 9439 var isSuccess, success, error, response, modified, 9440 statusText = nativeStatusText; 9441 9442 // Ignore repeat invocations 9443 if ( completed ) { 9444 return; 9445 } 9446 9447 completed = true; 9448 9449 // Clear timeout if it exists 9450 if ( timeoutTimer ) { 9451 window.clearTimeout( timeoutTimer ); 9452 } 9453 9454 // Dereference transport for early garbage collection 9455 // (no matter how long the jqXHR object will be used) 9456 transport = undefined; 9457 9458 // Cache response headers 9459 responseHeadersString = headers || ""; 9460 9461 // Set readyState 9462 jqXHR.readyState = status > 0 ? 4 : 0; 9463 9464 // Determine if successful 9465 isSuccess = status >= 200 && status < 300 || status === 304; 9466 9467 // Get response data 9468 if ( responses ) { 9469 response = ajaxHandleResponses( s, jqXHR, responses ); 9470 } 9471 9472 // Convert no matter what (that way responseXXX fields are always set) 9473 response = ajaxConvert( s, response, jqXHR, isSuccess ); 9474 9475 // If successful, handle type chaining 9476 if ( isSuccess ) { 9477 9478 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9479 if ( s.ifModified ) { 9480 modified = jqXHR.getResponseHeader( "Last-Modified" ); 9481 if ( modified ) { 9482 jQuery.lastModified[ cacheURL ] = modified; 9483 } 9484 modified = jqXHR.getResponseHeader( "etag" ); 9485 if ( modified ) { 9486 jQuery.etag[ cacheURL ] = modified; 9487 } 9488 } 9489 9490 // if no content 9491 if ( status === 204 || s.type === "HEAD" ) { 9492 statusText = "nocontent"; 9493 9494 // if not modified 9495 } else if ( status === 304 ) { 9496 statusText = "notmodified"; 9497 9498 // If we have data, let's convert it 9499 } else { 9500 statusText = response.state; 9501 success = response.data; 9502 error = response.error; 9503 isSuccess = !error; 9504 } 9505 } else { 9506 9507 // Extract error from statusText and normalize for non-aborts 9508 error = statusText; 9509 if ( status || !statusText ) { 9510 statusText = "error"; 9511 if ( status < 0 ) { 9512 status = 0; 9513 } 9514 } 9515 } 9516 9517 // Set data for the fake xhr object 9518 jqXHR.status = status; 9519 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 9520 9521 // Success/Error 9522 if ( isSuccess ) { 9523 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 9524 } else { 9525 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 9526 } 9527 9528 // Status-dependent callbacks 9529 jqXHR.statusCode( statusCode ); 9530 statusCode = undefined; 9531 9532 if ( fireGlobals ) { 9533 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 9534 [ jqXHR, s, isSuccess ? success : error ] ); 9535 } 9536 9537 // Complete 9538 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 9539 9540 if ( fireGlobals ) { 9541 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 9542 9543 // Handle the global AJAX counter 9544 if ( !( --jQuery.active ) ) { 9545 jQuery.event.trigger( "ajaxStop" ); 9546 } 9547 } 9548 } 9549 9550 return jqXHR; 9551 }, 9552 9553 getJSON: function( url, data, callback ) { 9554 return jQuery.get( url, data, callback, "json" ); 9555 }, 9556 9557 getScript: function( url, callback ) { 9558 return jQuery.get( url, undefined, callback, "script" ); 9559 } 9560} ); 9561 9562jQuery.each( [ "get", "post" ], function( i, method ) { 9563 jQuery[ method ] = function( url, data, callback, type ) { 9564 9565 // Shift arguments if data argument was omitted 9566 if ( isFunction( data ) ) { 9567 type = type || callback; 9568 callback = data; 9569 data = undefined; 9570 } 9571 9572 // The url can be an options object (which then must have .url) 9573 return jQuery.ajax( jQuery.extend( { 9574 url: url, 9575 type: method, 9576 dataType: type, 9577 data: data, 9578 success: callback 9579 }, jQuery.isPlainObject( url ) && url ) ); 9580 }; 9581} ); 9582 9583 9584jQuery._evalUrl = function( url, options ) { 9585 return jQuery.ajax( { 9586 url: url, 9587 9588 // Make this explicit, since user can override this through ajaxSetup (#11264) 9589 type: "GET", 9590 dataType: "script", 9591 cache: true, 9592 async: false, 9593 global: false, 9594 9595 // Only evaluate the response if it is successful (gh-4126) 9596 // dataFilter is not invoked for failure responses, so using it instead 9597 // of the default converter is kludgy but it works. 9598 converters: { 9599 "text script": function() {} 9600 }, 9601 dataFilter: function( response ) { 9602 jQuery.globalEval( response, options ); 9603 } 9604 } ); 9605}; 9606 9607 9608jQuery.fn.extend( { 9609 wrapAll: function( html ) { 9610 var wrap; 9611 9612 if ( this[ 0 ] ) { 9613 if ( isFunction( html ) ) { 9614 html = html.call( this[ 0 ] ); 9615 } 9616 9617 // The elements to wrap the target around 9618 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 9619 9620 if ( this[ 0 ].parentNode ) { 9621 wrap.insertBefore( this[ 0 ] ); 9622 } 9623 9624 wrap.map( function() { 9625 var elem = this; 9626 9627 while ( elem.firstElementChild ) { 9628 elem = elem.firstElementChild; 9629 } 9630 9631 return elem; 9632 } ).append( this ); 9633 } 9634 9635 return this; 9636 }, 9637 9638 wrapInner: function( html ) { 9639 if ( isFunction( html ) ) { 9640 return this.each( function( i ) { 9641 jQuery( this ).wrapInner( html.call( this, i ) ); 9642 } ); 9643 } 9644 9645 return this.each( function() { 9646 var self = jQuery( this ), 9647 contents = self.contents(); 9648 9649 if ( contents.length ) { 9650 contents.wrapAll( html ); 9651 9652 } else { 9653 self.append( html ); 9654 } 9655 } ); 9656 }, 9657 9658 wrap: function( html ) { 9659 var htmlIsFunction = isFunction( html ); 9660 9661 return this.each( function( i ) { 9662 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 9663 } ); 9664 }, 9665 9666 unwrap: function( selector ) { 9667 this.parent( selector ).not( "body" ).each( function() { 9668 jQuery( this ).replaceWith( this.childNodes ); 9669 } ); 9670 return this; 9671 } 9672} ); 9673 9674 9675jQuery.expr.pseudos.hidden = function( elem ) { 9676 return !jQuery.expr.pseudos.visible( elem ); 9677}; 9678jQuery.expr.pseudos.visible = function( elem ) { 9679 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 9680}; 9681 9682 9683 9684 9685jQuery.ajaxSettings.xhr = function() { 9686 try { 9687 return new window.XMLHttpRequest(); 9688 } catch ( e ) {} 9689}; 9690 9691var xhrSuccessStatus = { 9692 9693 // File protocol always yields status code 0, assume 200 9694 0: 200, 9695 9696 // Support: IE <=9 only 9697 // #1450: sometimes IE returns 1223 when it should be 204 9698 1223: 204 9699 }, 9700 xhrSupported = jQuery.ajaxSettings.xhr(); 9701 9702support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 9703support.ajax = xhrSupported = !!xhrSupported; 9704 9705jQuery.ajaxTransport( function( options ) { 9706 var callback, errorCallback; 9707 9708 // Cross domain only allowed if supported through XMLHttpRequest 9709 if ( support.cors || xhrSupported && !options.crossDomain ) { 9710 return { 9711 send: function( headers, complete ) { 9712 var i, 9713 xhr = options.xhr(); 9714 9715 xhr.open( 9716 options.type, 9717 options.url, 9718 options.async, 9719 options.username, 9720 options.password 9721 ); 9722 9723 // Apply custom fields if provided 9724 if ( options.xhrFields ) { 9725 for ( i in options.xhrFields ) { 9726 xhr[ i ] = options.xhrFields[ i ]; 9727 } 9728 } 9729 9730 // Override mime type if needed 9731 if ( options.mimeType && xhr.overrideMimeType ) { 9732 xhr.overrideMimeType( options.mimeType ); 9733 } 9734 9735 // X-Requested-With header 9736 // For cross-domain requests, seeing as conditions for a preflight are 9737 // akin to a jigsaw puzzle, we simply never set it to be sure. 9738 // (it can always be set on a per-request basis or even using ajaxSetup) 9739 // For same-domain requests, won't change header if already provided. 9740 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 9741 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 9742 } 9743 9744 // Set headers 9745 for ( i in headers ) { 9746 xhr.setRequestHeader( i, headers[ i ] ); 9747 } 9748 9749 // Callback 9750 callback = function( type ) { 9751 return function() { 9752 if ( callback ) { 9753 callback = errorCallback = xhr.onload = 9754 xhr.onerror = xhr.onabort = xhr.ontimeout = 9755 xhr.onreadystatechange = null; 9756 9757 if ( type === "abort" ) { 9758 xhr.abort(); 9759 } else if ( type === "error" ) { 9760 9761 // Support: IE <=9 only 9762 // On a manual native abort, IE9 throws 9763 // errors on any property access that is not readyState 9764 if ( typeof xhr.status !== "number" ) { 9765 complete( 0, "error" ); 9766 } else { 9767 complete( 9768 9769 // File: protocol always yields status 0; see #8605, #14207 9770 xhr.status, 9771 xhr.statusText 9772 ); 9773 } 9774 } else { 9775 complete( 9776 xhrSuccessStatus[ xhr.status ] || xhr.status, 9777 xhr.statusText, 9778 9779 // Support: IE <=9 only 9780 // IE9 has no XHR2 but throws on binary (trac-11426) 9781 // For XHR2 non-text, let the caller handle it (gh-2498) 9782 ( xhr.responseType || "text" ) !== "text" || 9783 typeof xhr.responseText !== "string" ? 9784 { binary: xhr.response } : 9785 { text: xhr.responseText }, 9786 xhr.getAllResponseHeaders() 9787 ); 9788 } 9789 } 9790 }; 9791 }; 9792 9793 // Listen to events 9794 xhr.onload = callback(); 9795 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 9796 9797 // Support: IE 9 only 9798 // Use onreadystatechange to replace onabort 9799 // to handle uncaught aborts 9800 if ( xhr.onabort !== undefined ) { 9801 xhr.onabort = errorCallback; 9802 } else { 9803 xhr.onreadystatechange = function() { 9804 9805 // Check readyState before timeout as it changes 9806 if ( xhr.readyState === 4 ) { 9807 9808 // Allow onerror to be called first, 9809 // but that will not handle a native abort 9810 // Also, save errorCallback to a variable 9811 // as xhr.onerror cannot be accessed 9812 window.setTimeout( function() { 9813 if ( callback ) { 9814 errorCallback(); 9815 } 9816 } ); 9817 } 9818 }; 9819 } 9820 9821 // Create the abort callback 9822 callback = callback( "abort" ); 9823 9824 try { 9825 9826 // Do send the request (this may raise an exception) 9827 xhr.send( options.hasContent && options.data || null ); 9828 } catch ( e ) { 9829 9830 // #14683: Only rethrow if this hasn't been notified as an error yet 9831 if ( callback ) { 9832 throw e; 9833 } 9834 } 9835 }, 9836 9837 abort: function() { 9838 if ( callback ) { 9839 callback(); 9840 } 9841 } 9842 }; 9843 } 9844} ); 9845 9846 9847 9848 9849// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 9850jQuery.ajaxPrefilter( function( s ) { 9851 if ( s.crossDomain ) { 9852 s.contents.script = false; 9853 } 9854} ); 9855 9856// Install script dataType 9857jQuery.ajaxSetup( { 9858 accepts: { 9859 script: "text/javascript, application/javascript, " + 9860 "application/ecmascript, application/x-ecmascript" 9861 }, 9862 contents: { 9863 script: /\b(?:java|ecma)script\b/ 9864 }, 9865 converters: { 9866 "text script": function( text ) { 9867 jQuery.globalEval( text ); 9868 return text; 9869 } 9870 } 9871} ); 9872 9873// Handle cache's special case and crossDomain 9874jQuery.ajaxPrefilter( "script", function( s ) { 9875 if ( s.cache === undefined ) { 9876 s.cache = false; 9877 } 9878 if ( s.crossDomain ) { 9879 s.type = "GET"; 9880 } 9881} ); 9882 9883// Bind script tag hack transport 9884jQuery.ajaxTransport( "script", function( s ) { 9885 9886 // This transport only deals with cross domain or forced-by-attrs requests 9887 if ( s.crossDomain || s.scriptAttrs ) { 9888 var script, callback; 9889 return { 9890 send: function( _, complete ) { 9891 script = jQuery( "<script>" ) 9892 .attr( s.scriptAttrs || {} ) 9893 .prop( { charset: s.scriptCharset, src: s.url } ) 9894 .on( "load error", callback = function( evt ) { 9895 script.remove(); 9896 callback = null; 9897 if ( evt ) { 9898 complete( evt.type === "error" ? 404 : 200, evt.type ); 9899 } 9900 }
vendor: 19,070 bytes, lines 9900-10588
9900); 9901 9902 // Use native DOM manipulation to avoid our domManip AJAX trickery 9903 document.head.appendChild( script[ 0 ] ); 9904 }, 9905 abort: function() { 9906 if ( callback ) { 9907 callback(); 9908 } 9909 } 9910 }; 9911 } 9912} ); 9913 9914 9915 9916 9917var oldCallbacks = [], 9918 rjsonp = /(=)\?(?=&|$)|\?\?/; 9919 9920// Default jsonp settings 9921jQuery.ajaxSetup( { 9922 jsonp: "callback", 9923 jsonpCallback: function() { 9924 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); 9925 this[ callback ] = true; 9926 return callback; 9927 } 9928} ); 9929 9930// Detect, normalize options and install callbacks for jsonp requests 9931jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 9932 9933 var callbackName, overwritten, responseContainer, 9934 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 9935 "url" : 9936 typeof s.data === "string" && 9937 ( s.contentType || "" ) 9938 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 9939 rjsonp.test( s.data ) && "data" 9940 ); 9941 9942 // Handle iff the expected data type is "jsonp" or we have a parameter to set 9943 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 9944 9945 // Get callback name, remembering preexisting value associated with it 9946 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 9947 s.jsonpCallback() : 9948 s.jsonpCallback; 9949 9950 // Insert callback into url or form data 9951 if ( jsonProp ) { 9952 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 9953 } else if ( s.jsonp !== false ) { 9954 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 9955 } 9956 9957 // Use data converter to retrieve json after script execution 9958 s.converters[ "script json" ] = function() { 9959 if ( !responseContainer ) { 9960 jQuery.error( callbackName + " was not called" ); 9961 } 9962 return responseContainer[ 0 ]; 9963 }; 9964 9965 // Force json dataType 9966 s.dataTypes[ 0 ] = "json"; 9967 9968 // Install callback 9969 overwritten = window[ callbackName ]; 9970 window[ callbackName ] = function() { 9971 responseContainer = arguments; 9972 }; 9973 9974 // Clean-up function (fires after converters) 9975 jqXHR.always( function() { 9976 9977 // If previous value didn't exist - remove it 9978 if ( overwritten === undefined ) { 9979 jQuery( window ).removeProp( callbackName ); 9980 9981 // Otherwise restore preexisting value 9982 } else { 9983 window[ callbackName ] = overwritten; 9984 } 9985 9986 // Save back as free 9987 if ( s[ callbackName ] ) { 9988 9989 // Make sure that re-using the options doesn't screw things around 9990 s.jsonpCallback = originalSettings.jsonpCallback; 9991 9992 // Save the callback name for future use 9993 oldCallbacks.push( callbackName ); 9994 } 9995 9996 // Call if it was a function and we have a response 9997 if ( responseContainer && isFunction( overwritten ) ) { 9998 overwritten( responseContainer[ 0 ] ); 9999 } 10000 10001 responseContainer = overwritten = undefined; 10002 } ); 10003 10004 // Delegate to script 10005 return "script"; 10006 } 10007} ); 10008 10009 10010 10011 10012// Support: Safari 8 only 10013// In Safari 8 documents created via document.implementation.createHTMLDocument 10014// collapse sibling forms: the second one becomes a child of the first one. 10015// Because of that, this security measure has to be disabled in Safari 8. 10016// https://bugs.webkit.org/show_bug.cgi?id=137337 10017support.createHTMLDocument = ( function() { 10018 var body = document.implementation.createHTMLDocument( "" ).body; 10019 body.innerHTML = "<form></form><form></form>"; 10020 return body.childNodes.length === 2; 10021} )(); 10022 10023 10024// Argument "data" should be string of html 10025// context (optional): If specified, the fragment will be created in this context, 10026// defaults to document 10027// keepScripts (optional): If true, will include scripts passed in the html string 10028jQuery.parseHTML = function( data, context, keepScripts ) { 10029 if ( typeof data !== "string" ) { 10030 return []; 10031 } 10032 if ( typeof context === "boolean" ) { 10033 keepScripts = context; 10034 context = false; 10035 } 10036 10037 var base, parsed, scripts; 10038 10039 if ( !context ) { 10040 10041 // Stop scripts or inline event handlers from being executed immediately 10042 // by using document.implementation 10043 if ( support.createHTMLDocument ) { 10044 context = document.implementation.createHTMLDocument( "" ); 10045 10046 // Set the base href for the created document 10047 // so any parsed elements with URLs 10048 // are based on the document's URL (gh-2965) 10049 base = context.createElement( "base" ); 10050 base.href = document.location.href; 10051 context.head.appendChild( base ); 10052 } else { 10053 context = document; 10054 } 10055 } 10056 10057 parsed = rsingleTag.exec( data ); 10058 scripts = !keepScripts && []; 10059 10060 // Single tag 10061 if ( parsed ) { 10062 return [ context.createElement( parsed[ 1 ] ) ]; 10063 } 10064 10065 parsed = buildFragment( [ data ], context, scripts ); 10066 10067 if ( scripts && scripts.length ) { 10068 jQuery( scripts ).remove(); 10069 } 10070 10071 return jQuery.merge( [], parsed.childNodes ); 10072}; 10073 10074 10075/** 10076 * Load a url into a page 10077 */ 10078jQuery.fn.load = function( url, params, callback ) { 10079 var selector, type, response, 10080 self = this, 10081 off = url.indexOf( " " ); 10082 10083 if ( off > -1 ) { 10084 selector = stripAndCollapse( url.slice( off ) ); 10085 url = url.slice( 0, off ); 10086 } 10087 10088 // If it's a function 10089 if ( isFunction( params ) ) { 10090 10091 // We assume that it's the callback 10092 callback = params; 10093 params = undefined; 10094 10095 // Otherwise, build a param string 10096 } else if ( params && typeof params === "object" ) { 10097 type = "POST"; 10098 } 10099 10100 // If we have elements to modify, make the request 10101 if ( self.length > 0 ) { 10102 jQuery.ajax( { 10103 url: url, 10104 10105 // If "type" variable is undefined, then "GET" method will be used. 10106 // Make value of this field explicit since 10107 // user can override it through ajaxSetup method 10108 type: type || "GET", 10109 dataType: "html", 10110 data: params 10111 } ).done( function( responseText ) { 10112 10113 // Save response for use in complete callback 10114 response = arguments; 10115 10116 self.html( selector ? 10117 10118 // If a selector was specified, locate the right elements in a dummy div 10119 // Exclude scripts to avoid IE 'Permission Denied' errors 10120 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 10121 10122 // Otherwise use the full result 10123 responseText ); 10124 10125 // If the request succeeds, this function gets "data", "status", "jqXHR" 10126 // but they are ignored because response was set above. 10127 // If it fails, this function gets "jqXHR", "status", "error" 10128 } ).always( callback && function( jqXHR, status ) { 10129 self.each( function() { 10130 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 10131 } ); 10132 } ); 10133 } 10134 10135 return this; 10136}; 10137 10138 10139 10140 10141// Attach a bunch of functions for handling common AJAX events 10142jQuery.each( [ 10143 "ajaxStart", 10144 "ajaxStop", 10145 "ajaxComplete", 10146 "ajaxError", 10147 "ajaxSuccess", 10148 "ajaxSend" 10149], function( i, type ) { 10150 jQuery.fn[ type ] = function( fn ) { 10151 return this.on( type, fn ); 10152 }; 10153} ); 10154 10155 10156 10157 10158jQuery.expr.pseudos.animated = function( elem ) { 10159 return jQuery.grep( jQuery.timers, function( fn ) { 10160 return elem === fn.elem; 10161 } ).length; 10162}; 10163 10164 10165 10166 10167jQuery.offset = { 10168 setOffset: function( elem, options, i ) { 10169 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 10170 position = jQuery.css( elem, "position" ), 10171 curElem = jQuery( elem ), 10172 props = {}; 10173 10174 // Set position first, in-case top/left are set even on static elem 10175 if ( position === "static" ) { 10176 elem.style.position = "relative"; 10177 } 10178 10179 curOffset = curElem.offset(); 10180 curCSSTop = jQuery.css( elem, "top" ); 10181 curCSSLeft = jQuery.css( elem, "left" ); 10182 calculatePosition = ( position === "absolute" || position === "fixed" ) && 10183 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 10184 10185 // Need to be able to calculate position if either 10186 // top or left is auto and position is either absolute or fixed 10187 if ( calculatePosition ) { 10188 curPosition = curElem.position(); 10189 curTop = curPosition.top; 10190 curLeft = curPosition.left; 10191 10192 } else { 10193 curTop = parseFloat( curCSSTop ) || 0; 10194 curLeft = parseFloat( curCSSLeft ) || 0; 10195 } 10196 10197 if ( isFunction( options ) ) { 10198 10199 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 10200 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 10201 } 10202 10203 if ( options.top != null ) { 10204 props.top = ( options.top - curOffset.top ) + curTop; 10205 } 10206 if ( options.left != null ) { 10207 props.left = ( options.left - curOffset.left ) + curLeft; 10208 } 10209 10210 if ( "using" in options ) { 10211 options.using.call( elem, props ); 10212 10213 } else { 10214 curElem.css( props ); 10215 } 10216 } 10217}; 10218 10219jQuery.fn.extend( { 10220 10221 // offset() relates an element's border box to the document origin 10222 offset: function( options ) { 10223 10224 // Preserve chaining for setter 10225 if ( arguments.length ) { 10226 return options === undefined ? 10227 this : 10228 this.each( function( i ) { 10229 jQuery.offset.setOffset( this, options, i ); 10230 } ); 10231 } 10232 10233 var rect, win, 10234 elem = this[ 0 ]; 10235 10236 if ( !elem ) { 10237 return; 10238 } 10239 10240 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 10241 // Support: IE <=11 only 10242 // Running getBoundingClientRect on a 10243 // disconnected node in IE throws an error 10244 if ( !elem.getClientRects().length ) { 10245 return { top: 0, left: 0 }; 10246 } 10247 10248 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 10249 rect = elem.getBoundingClientRect(); 10250 win = elem.ownerDocument.defaultView; 10251 return { 10252 top: rect.top + win.pageYOffset, 10253 left: rect.left + win.pageXOffset 10254 }; 10255 }, 10256 10257 // position() relates an element's margin box to its offset parent's padding box 10258 // This corresponds to the behavior of CSS absolute positioning 10259 position: function() { 10260 if ( !this[ 0 ] ) { 10261 return; 10262 } 10263 10264 var offsetParent, offset, doc, 10265 elem = this[ 0 ], 10266 parentOffset = { top: 0, left: 0 }; 10267 10268 // position:fixed elements are offset from the viewport, which itself always has zero offset 10269 if ( jQuery.css( elem, "position" ) === "fixed" ) { 10270 10271 // Assume position:fixed implies availability of getBoundingClientRect 10272 offset = elem.getBoundingClientRect(); 10273 10274 } else { 10275 offset = this.offset(); 10276 10277 // Account for the *real* offset parent, which can be the document or its root element 10278 // when a statically positioned element is identified 10279 doc = elem.ownerDocument; 10280 offsetParent = elem.offsetParent || doc.documentElement; 10281 while ( offsetParent && 10282 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 10283 jQuery.css( offsetParent, "position" ) === "static" ) { 10284 10285 offsetParent = offsetParent.parentNode; 10286 } 10287 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 10288 10289 // Incorporate borders into its offset, since they are outside its content origin 10290 parentOffset = jQuery( offsetParent ).offset(); 10291 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 10292 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 10293 } 10294 } 10295 10296 // Subtract parent offsets and element margins 10297 return { 10298 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 10299 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 10300 }; 10301 }, 10302 10303 // This method will return documentElement in the following cases: 10304 // 1) For the element inside the iframe without offsetParent, this method will return 10305 // documentElement of the parent window 10306 // 2) For the hidden or detached element 10307 // 3) For body or html element, i.e. in case of the html node - it will return itself 10308 // 10309 // but those exceptions were never presented as a real life use-cases 10310 // and might be considered as more preferable results. 10311 // 10312 // This logic, however, is not guaranteed and can change at any point in the future 10313 offsetParent: function() { 10314 return this.map( function() { 10315 var offsetParent = this.offsetParent; 10316 10317 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 10318 offsetParent = offsetParent.offsetParent; 10319 } 10320 10321 return offsetParent || documentElement; 10322 } ); 10323 } 10324} ); 10325 10326// Create scrollLeft and scrollTop methods 10327jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 10328 var top = "pageYOffset" === prop; 10329 10330 jQuery.fn[ method ] = function( val ) { 10331 return access( this, function( elem, method, val ) { 10332 10333 // Coalesce documents and windows 10334 var win; 10335 if ( isWindow( elem ) ) { 10336 win = elem; 10337 } else if ( elem.nodeType === 9 ) { 10338 win = elem.defaultView; 10339 } 10340 10341 if ( val === undefined ) { 10342 return win ? win[ prop ] : elem[ method ]; 10343 } 10344 10345 if ( win ) { 10346 win.scrollTo( 10347 !top ? val : win.pageXOffset, 10348 top ? val : win.pageYOffset 10349 ); 10350 10351 } else { 10352 elem[ method ] = val; 10353 } 10354 }, method, val, arguments.length ); 10355 }; 10356} ); 10357 10358// Support: Safari <=7 - 9.1, Chrome <=37 - 49 10359// Add the top/left cssHooks using jQuery.fn.position 10360// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 10361// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 10362// getComputedStyle returns percent when specified for top/left/bottom/right; 10363// rather than make the css module depend on the offset module, just check for it here 10364jQuery.each( [ "top", "left" ], function( i, prop ) { 10365 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 10366 function( elem, computed ) { 10367 if ( computed ) { 10368 computed = curCSS( elem, prop ); 10369 10370 // If curCSS returns percentage, fallback to offset 10371 return rnumnonpx.test( computed ) ? 10372 jQuery( elem ).position()[ prop ] + "px" : 10373 computed; 10374 } 10375 } 10376 ); 10377} ); 10378 10379 10380// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 10381jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 10382 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, 10383 function( defaultExtra, funcName ) { 10384 10385 // Margin is only for outerHeight, outerWidth 10386 jQuery.fn[ funcName ] = function( margin, value ) { 10387 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 10388 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 10389 10390 return access( this, function( elem, type, value ) { 10391 var doc; 10392 10393 if ( isWindow( elem ) ) { 10394 10395 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 10396 return funcName.indexOf( "outer" ) === 0 ? 10397 elem[ "inner" + name ] : 10398 elem.document.documentElement[ "client" + name ]; 10399 } 10400 10401 // Get document width or height 10402 if ( elem.nodeType === 9 ) { 10403 doc = elem.documentElement; 10404 10405 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 10406 // whichever is greatest 10407 return Math.max( 10408 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 10409 elem.body[ "offset" + name ], doc[ "offset" + name ], 10410 doc[ "client" + name ] 10411 ); 10412 } 10413 10414 return value === undefined ? 10415 10416 // Get width or height on the element, requesting but not forcing parseFloat 10417 jQuery.css( elem, type, extra ) : 10418 10419 // Set width or height on the element 10420 jQuery.style( elem, type, value, extra ); 10421 }, type, chainable ? margin : undefined, chainable ); 10422 }; 10423 } ); 10424} ); 10425 10426 10427jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " + 10428 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 10429 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 10430 function( i, name ) { 10431 10432 // Handle event binding 10433 jQuery.fn[ name ] = function( data, fn ) { 10434 return arguments.length > 0 ? 10435 this.on( name, null, data, fn ) : 10436 this.trigger( name ); 10437 }; 10438} ); 10439 10440jQuery.fn.extend( { 10441 hover: function( fnOver, fnOut ) { 10442 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 10443 } 10444} ); 10445 10446 10447 10448 10449jQuery.fn.extend( { 10450 10451 bind: function( types, data, fn ) { 10452 return this.on( types, null, data, fn ); 10453 }, 10454 unbind: function( types, fn ) { 10455 return this.off( types, null, fn ); 10456 }, 10457 10458 delegate: function( selector, types, data, fn ) { 10459 return this.on( types, selector, data, fn ); 10460 }, 10461 undelegate: function( selector, types, fn ) { 10462 10463 // ( namespace ) or ( selector, types [, fn] ) 10464 return arguments.length === 1 ? 10465 this.off( selector, "**" ) : 10466 this.off( types, selector || "**", fn ); 10467 } 10468} ); 10469 10470// Bind a function to a context, optionally partially applying any 10471// arguments. 10472// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 10473// However, it is not slated for removal any time soon 10474jQuery.proxy = function( fn, context ) { 10475 var tmp, args, proxy; 10476 10477 if ( typeof context === "string" ) { 10478 tmp = fn[ context ]; 10479 context = fn; 10480 fn = tmp; 10481 } 10482 10483 // Quick check to determine if target is callable, in the spec 10484 // this throws a TypeError, but we will just return undefined. 10485 if ( !isFunction( fn ) ) { 10486 return undefined; 10487 } 10488 10489 // Simulated bind 10490 args = slice.call( arguments, 2 ); 10491 proxy = function() { 10492 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 10493 }; 10494 10495 // Set the guid of unique handler to the same of original handler, so it can be removed 10496 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 10497 10498 return proxy; 10499}; 10500 10501jQuery.holdReady = function( hold ) { 10502 if ( hold ) { 10503 jQuery.readyWait++; 10504 } else { 10505 jQuery.ready( true ); 10506 } 10507}; 10508jQuery.isArray = Array.isArray; 10509jQuery.parseJSON = JSON.parse; 10510jQuery.nodeName = nodeName; 10511jQuery.isFunction = isFunction; 10512jQuery.isWindow = isWindow; 10513jQuery.camelCase = camelCase; 10514jQuery.type = toType; 10515 10516jQuery.now = Date.now; 10517 10518jQuery.isNumeric = function( obj ) { 10519 10520 // As of jQuery 3.0, isNumeric is limited to 10521 // strings and numbers (primitives or objects) 10522 // that can be coerced to finite numbers (gh-2662) 10523 var type = jQuery.type( obj ); 10524 return ( type === "number" || type === "string" ) && 10525 10526 // parseFloat NaNs numeric-cast false positives ("") 10527 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 10528 // subtraction forces infinities to NaN 10529 !isNaN( obj - parseFloat( obj ) ); 10530}; 10531 10532 10533 10534 10535// Register as a named AMD module, since jQuery can be concatenated with other 10536// files that may use define, but not via a proper concatenation script that 10537// understands anonymous AMD modules. A named AMD is safest and most robust 10538// way to register. Lowercase jquery is used because AMD module names are 10539// derived from file names, and jQuery is normally delivered in a lowercase 10540// file name. Do this after creating the global so that if an AMD module wants 10541// to call noConflict to hide this version of jQuery, it will work. 10542 10543// Note that for maximum portability, libraries that are not jQuery should 10544// declare themselves as anonymous modules, and avoid setting a global if an 10545// AMD loader is present. jQuery is a special case. For more information, see 10546// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 10547 10548if ( typeof define === "function" && define.amd ) { 10549 define( "jquery", [], function() { 10550 return jQuery; 10551 } ); 10552} 10553 10554 10555 10556 10557var 10558 10559 // Map over jQuery in case of overwrite 10560 _jQuery = window.jQuery, 10561 10562 // Map over the $ in case of overwrite 10563 _$ = window.$; 10564 10565jQuery.noConflict = function( deep ) { 10566 if ( window.$ === jQuery ) { 10567 window.$ = _$; 10568 } 10569 10570 if ( deep && window.jQuery === jQuery ) { 10571 window.jQuery = _jQuery; 10572 } 10573 10574 return jQuery; 10575}; 10576 10577// Expose jQuery and $ identifiers, even in AMD 10578// (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 10579// and CommonJS for browser emulators (#13566) 10580if ( !noGlobal ) { 10581 window.jQuery = window.$ = jQuery; 10582} 10583 10584 10585 10586 10587return jQuery; 10588} );
vendor: 4,771 bytes, lines 10589-10754
10589 10590/** 10591* Clay 2.14.2 10592* 10593* Copyright 2019, Liferay, Inc. 10594* All rights reserved. 10595* MIT license 10596*/ 10597/**! 10598 * @fileOverview Kickass library to create and place poppers near their reference elements. 10599 * @version 1.14.7 10600 * @license 10601 * Copyright (c) 2016 Federico Zivolo and contributors 10602 * 10603 * Permission is hereby granted, free of charge, to any person obtaining a copy 10604 * of this software and associated documentation files (the "Software"), to deal 10605 * in the Software without restriction, including without limitation the rights 10606 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10607 * copies of the Software, and to permit persons to whom the Software is 10608 * furnished to do so, subject to the following conditions: 10609 * 10610 * The above copyright notice and this permission notice shall be included in all 10611 * copies or substantial portions of the Software. 10612 * 10613 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 10614 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 10615 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10616 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 10617 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 10618 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 10619 * SOFTWARE. 10620 */ 10621(function (global, factory) { 10622 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 10623 typeof define === 'function' && define.amd ? define(factory) : 10624 (global.Popper = factory()); 10625}(this, (function () { 'use strict'; 10626 10627var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined'; 10628 10629var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox']; 10630var timeoutDuration = 0; 10631for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) { 10632 if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) { 10633 timeoutDuration = 1; 10634 break; 10635 } 10636} 10637 10638function microtaskDebounce(fn) { 10639 var called = false; 10640 return function () { 10641 if (called) { 10642 return; 10643 } 10644 called = true; 10645 window.Promise.resolve().then(function () { 10646 called = false; 10647 fn(); 10648 }); 10649 }; 10650} 10651 10652function taskDebounce(fn) { 10653 var scheduled = false; 10654 return function () { 10655 if (!scheduled) { 10656 scheduled = true; 10657 setTimeout(function () { 10658 scheduled = false; 10659 fn(); 10660 }, timeoutDuration); 10661 } 10662 }; 10663} 10664 10665var supportsMicroTasks = isBrowser && window.Promise; 10666 10667/** 10668* Create a debounced version of a method, that's asynchronously deferred 10669* but called in the minimum time possible. 10670* 10671* @method 10672* @memberof Popper.Utils 10673* @argument {Function} fn 10674* @returns {Function} 10675*/ 10676var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce; 10677 10678/** 10679 * Check if the given variable is a function 10680 * @method 10681 * @memberof Popper.Utils 10682 * @argument {Any} functionToCheck - variable to check 10683 * @returns {Boolean} answer to: is a function? 10684 */ 10685function isFunction(functionToCheck) { 10686 var getType = {}; 10687 return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]'; 10688} 10689 10690/** 10691 * Get CSS computed property of the given element 10692 * @method 10693 * @memberof Popper.Utils 10694 * @argument {Eement} element 10695 * @argument {String} property 10696 */ 10697function getStyleComputedProperty(element, property) { 10698 if (element.nodeType !== 1) { 10699 return []; 10700 } 10701 // NOTE: 1 DOM access here 10702 var window = element.ownerDocument.defaultView; 10703 var css = window.getComputedStyle(element, null); 10704 return property ? css[property] : css; 10705} 10706 10707/** 10708 * Returns the parentNode or the host of the element 10709 * @method 10710 * @memberof Popper.Utils 10711 * @argument {Element} element 10712 * @returns {Element} parent 10713 */ 10714function getParentNode(element) { 10715 if (element.nodeName === 'HTML') { 10716 return element; 10717 } 10718 return element.parentNode || element.host; 10719} 10720 10721/** 10722 * Returns the scrolling parent of the given element 10723 * @method 10724 * @memberof Popper.Utils 10725 * @argument {Element} element 10726 * @returns {Element} scroll parent 10727 */ 10728function getScrollParent(element) { 10729 // Return body, `getScroll` will take care to get the correct `scrollTop` from it 10730 if (!element) { 10731 return document.body; 10732 } 10733 10734 switch (element.nodeName) { 10735 case 'HTML': 10736 case 'BODY': 10737 return element.ownerDocument.body; 10738 case '#document': 10739 return element.body; 10740 } 10741 10742 // Firefox want us to check `-x` and `-y` variations as well 10743 10744 var _getStyleComputedProp = getStyleComputedProperty(element), 10745 overflow = _getStyleComputedProp.overflow, 10746 overflowX = _getStyleComputedProp.overflowX, 10747 overflowY = _getStyleComputedProp.overflowY; 10748 10749 if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) { 10750 return element; 10751 } 10752 10753 return getScrollParent(getParentNode(element)); 10754}
vendor: 5,677 bytes, lines 10754-10939
10754 10755 10756var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode); 10757var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent); 10758 10759/** 10760 * Determines if the browser is Internet Explorer 10761 * @method 10762 * @memberof Popper.Utils 10763 * @param {Number} version to check 10764 * @returns {Boolean} isIE 10765 */ 10766function isIE(version) { 10767 if (version === 11) { 10768 return isIE11; 10769 } 10770 if (version === 10) { 10771 return isIE10; 10772 } 10773 return isIE11 || isIE10; 10774} 10775 10776/** 10777 * Returns the offset parent of the given element 10778 * @method 10779 * @memberof Popper.Utils 10780 * @argument {Element} element 10781 * @returns {Element} offset parent 10782 */ 10783function getOffsetParent(element) { 10784 if (!element) { 10785 return document.documentElement; 10786 } 10787 10788 var noOffsetParent = isIE(10) ? document.body : null; 10789 10790 // NOTE: 1 DOM access here 10791 var offsetParent = element.offsetParent || null; 10792 // Skip hidden elements which don't have an offsetParent 10793 while (offsetParent === noOffsetParent && element.nextElementSibling) { 10794 offsetParent = (element = element.nextElementSibling).offsetParent; 10795 } 10796 10797 var nodeName = offsetParent && offsetParent.nodeName; 10798 10799 if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') { 10800 return element ? element.ownerDocument.documentElement : document.documentElement; 10801 } 10802 10803 // .offsetParent will return the closest TH, TD or TABLE in case 10804 // no offsetParent is present, I hate this job... 10805 if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') { 10806 return getOffsetParent(offsetParent); 10807 } 10808 10809 return offsetParent; 10810} 10811 10812function isOffsetContainer(element) { 10813 var nodeName = element.nodeName; 10814 10815 if (nodeName === 'BODY') { 10816 return false; 10817 } 10818 return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element; 10819} 10820 10821/** 10822 * Finds the root node (document, shadowDOM root) of the given element 10823 * @method 10824 * @memberof Popper.Utils 10825 * @argument {Element} node 10826 * @returns {Element} root node 10827 */ 10828function getRoot(node) { 10829 if (node.parentNode !== null) { 10830 return getRoot(node.parentNode); 10831 } 10832 10833 return node; 10834} 10835 10836/** 10837 * Finds the offset parent common to the two provided nodes 10838 * @method 10839 * @memberof Popper.Utils 10840 * @argument {Element} element1 10841 * @argument {Element} element2 10842 * @returns {Element} common offset parent 10843 */ 10844function findCommonOffsetParent(element1, element2) { 10845 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 10846 if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) { 10847 return document.documentElement; 10848 } 10849 10850 // Here we make sure to give as "start" the element that comes first in the DOM 10851 var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING; 10852 var start = order ? element1 : element2; 10853 var end = order ? element2 : element1; 10854 10855 // Get common ancestor container 10856 var range = document.createRange(); 10857 range.setStart(start, 0); 10858 range.setEnd(end, 0); 10859 var commonAncestorContainer = range.commonAncestorContainer; 10860 10861 // Both nodes are inside #document 10862 10863 if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) { 10864 if (isOffsetContainer(commonAncestorContainer)) { 10865 return commonAncestorContainer; 10866 } 10867 10868 return getOffsetParent(commonAncestorContainer); 10869 } 10870 10871 // one of the nodes is inside shadowDOM, find which one 10872 var element1root = getRoot(element1); 10873 if (element1root.host) { 10874 return findCommonOffsetParent(element1root.host, element2); 10875 } else { 10876 return findCommonOffsetParent(element1, getRoot(element2).host); 10877 } 10878} 10879 10880/** 10881 * Gets the scroll value of the given element in the given side (top and left) 10882 * @method 10883 * @memberof Popper.Utils 10884 * @argument {Element} element 10885 * @argument {String} side `top` or `left` 10886 * @returns {number} amount of scrolled pixels 10887 */ 10888function getScroll(element) { 10889 var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top'; 10890 10891 var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft'; 10892 var nodeName = element.nodeName; 10893 10894 if (nodeName === 'BODY' || nodeName === 'HTML') { 10895 var html = element.ownerDocument.documentElement; 10896 var scrollingElement = element.ownerDocument.scrollingElement || html; 10897 return scrollingElement[upperSide]; 10898 } 10899 10900 return element[upperSide]; 10901} 10902 10903/* 10904 * Sum or subtract the element scroll values (left and top) from a given rect object 10905 * @method 10906 * @memberof Popper.Utils 10907 * @param {Object} rect - Rect object you want to change 10908 * @param {HTMLElement} element - The element from the function reads the scroll values 10909 * @param {Boolean} subtract - set to true if you want to subtract the scroll values 10910 * @return {Object} rect - The modifier rect object 10911 */ 10912function includeScroll(rect, element) { 10913 var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 10914 10915 var scrollTop = getScroll(element, 'top'); 10916 var scrollLeft = getScroll(element, 'left'); 10917 var modifier = subtract ? -1 : 1; 10918 rect.top += scrollTop * modifier; 10919 rect.bottom += scrollTop * modifier; 10920 rect.left += scrollLeft * modifier; 10921 rect.right += scrollLeft * modifier; 10922 return rect; 10923} 10924 10925/* 10926 * Helper to detect borders of a given element 10927 * @method 10928 * @memberof Popper.Utils 10929 * @param {CSSStyleDeclaration} styles 10930 * Result of `getStyleComputedProperty` on the given element 10931 * @param {String} axis - `x` or `y` 10932 * @return {number} borders - The borders size of the given axis 10933 */ 10934 10935function getBordersSize(styles, axis) { 10936 var sideA = axis === 'x' ? 'Left' : 'Top'; 10937 var sideB = sideA === 'Left' ? 'Right' : 'Bottom'; 10938 10939 return parseFloat(styles['border' + sideA + 'Width']
vendor: 2,732 bytes, lines 10939-11038
10939, 10) + parseFloat(styles['border' + sideB + 'Width'], 10); 10940} 10941 10942function getSize(axis, body, html, computedStyle) { 10943 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); 10944} 10945 10946function getWindowSizes(document) { 10947 var body = document.body; 10948 var html = document.documentElement; 10949 var computedStyle = isIE(10) && getComputedStyle(html); 10950 10951 return { 10952 height: getSize('Height', body, html, computedStyle), 10953 width: getSize('Width', body, html, computedStyle) 10954 }; 10955} 10956 10957var classCallCheck = function (instance, Constructor) { 10958 if (!(instance instanceof Constructor)) { 10959 throw new TypeError("Cannot call a class as a function"); 10960 } 10961}; 10962 10963var createClass = function () { 10964 function defineProperties(target, props) { 10965 for (var i = 0; i < props.length; i++) { 10966 var descriptor = props[i]; 10967 descriptor.enumerable = descriptor.enumerable || false; 10968 descriptor.configurable = true; 10969 if ("value" in descriptor) descriptor.writable = true; 10970 Object.defineProperty(target, descriptor.key, descriptor); 10971 } 10972 } 10973 10974 return function (Constructor, protoProps, staticProps) { 10975 if (protoProps) defineProperties(Constructor.prototype, protoProps); 10976 if (staticProps) defineProperties(Constructor, staticProps); 10977 return Constructor; 10978 }; 10979}(); 10980 10981 10982 10983 10984 10985var defineProperty = function (obj, key, value) { 10986 if (key in obj) { 10987 Object.defineProperty(obj, key, { 10988 value: value, 10989 enumerable: true, 10990 configurable: true, 10991 writable: true 10992 }); 10993 } else { 10994 obj[key] = value; 10995 } 10996 10997 return obj; 10998}; 10999 11000var _extends = Object.assign || function (target) { 11001 for (var i = 1; i < arguments.length; i++) { 11002 var source = arguments[i]; 11003 11004 for (var key in source) { 11005 if (Object.prototype.hasOwnProperty.call(source, key)) { 11006 target[key] = source[key]; 11007 } 11008 } 11009 } 11010 11011 return target; 11012}; 11013 11014/** 11015 * Given element offsets, generate an output similar to getBoundingClientRect 11016 * @method 11017 * @memberof Popper.Utils 11018 * @argument {Object} offsets 11019 * @returns {Object} ClientRect like output 11020 */ 11021function getClientRect(offsets) { 11022 return _extends({}, offsets, { 11023 right: offsets.left + offsets.width, 11024 bottom: offsets.top + offsets.height 11025 }); 11026} 11027 11028/** 11029 * Get bounding client rect of given element 11030 * @method 11031 * @memberof Popper.Utils 11032 * @param {HTMLElement} element 11033 * @return {Object} client rect 11034 */ 11035function getBoundingClientRect(element) { 11036 var rect = {}; 11037 11038 // IE10 10 FIX: Please, don't ask, the element isn't
vendor: 4,668 bytes, lines 11039-11168
11039 // considered in DOM in some circumstances... 11040 // This isn't reproducible in IE10 compatibility mode of IE11 11041 try { 11042 if (isIE(10)) { 11043 rect = element.getBoundingClientRect(); 11044 var scrollTop = getScroll(element, 'top'); 11045 var scrollLeft = getScroll(element, 'left'); 11046 rect.top += scrollTop; 11047 rect.left += scrollLeft; 11048 rect.bottom += scrollTop; 11049 rect.right += scrollLeft; 11050 } else { 11051 rect = element.getBoundingClientRect(); 11052 } 11053 } catch (e) {} 11054 11055 var result = { 11056 left: rect.left, 11057 top: rect.top, 11058 width: rect.right - rect.left, 11059 height: rect.bottom - rect.top 11060 }; 11061 11062 // subtract scrollbar size from sizes 11063 var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {}; 11064 var width = sizes.width || element.clientWidth || result.right - result.left; 11065 var height = sizes.height || element.clientHeight || result.bottom - result.top; 11066 11067 var horizScrollbar = element.offsetWidth - width; 11068 var vertScrollbar = element.offsetHeight - height; 11069 11070 // if an hypothetical scrollbar is detected, we must be sure it's not a `border` 11071 // we make this check conditional for performance reasons 11072 if (horizScrollbar || vertScrollbar) { 11073 var styles = getStyleComputedProperty(element); 11074 horizScrollbar -= getBordersSize(styles, 'x'); 11075 vertScrollbar -= getBordersSize(styles, 'y'); 11076 11077 result.width -= horizScrollbar; 11078 result.height -= vertScrollbar; 11079 } 11080 11081 return getClientRect(result); 11082} 11083 11084function getOffsetRectRelativeToArbitraryNode(children, parent) { 11085 var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 11086 11087 var isIE10 = isIE(10); 11088 var isHTML = parent.nodeName === 'HTML'; 11089 var childrenRect = getBoundingClientRect(children); 11090 var parentRect = getBoundingClientRect(parent); 11091 var scrollParent = getScrollParent(children); 11092 11093 var styles = getStyleComputedProperty(parent); 11094 var borderTopWidth = parseFloat(styles.borderTopWidth, 10); 11095 var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10); 11096 11097 // In cases where the parent is fixed, we must ignore negative scroll in offset calc 11098 if (fixedPosition && isHTML) { 11099 parentRect.top = Math.max(parentRect.top, 0); 11100 parentRect.left = Math.max(parentRect.left, 0); 11101 } 11102 var offsets = getClientRect({ 11103 top: childrenRect.top - parentRect.top - borderTopWidth, 11104 left: childrenRect.left - parentRect.left - borderLeftWidth, 11105 width: childrenRect.width, 11106 height: childrenRect.height 11107 }); 11108 offsets.marginTop = 0; 11109 offsets.marginLeft = 0; 11110 11111 // Subtract margins of documentElement in case it's being used as parent 11112 // we do this only on HTML because it's the only element that behaves 11113 // differently when margins are applied to it. The margins are included in 11114 // the box of the documentElement, in the other cases not. 11115 if (!isIE10 && isHTML) { 11116 var marginTop = parseFloat(styles.marginTop, 10); 11117 var marginLeft = parseFloat(styles.marginLeft, 10); 11118 11119 offsets.top -= borderTopWidth - marginTop; 11120 offsets.bottom -= borderTopWidth - marginTop; 11121 offsets.left -= borderLeftWidth - marginLeft; 11122 offsets.right -= borderLeftWidth - marginLeft; 11123 11124 // Attach marginTop and marginLeft because in some circumstances we may need them 11125 offsets.marginTop = marginTop; 11126 offsets.marginLeft = marginLeft; 11127 } 11128 11129 if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') { 11130 offsets = includeScroll(offsets, parent); 11131 } 11132 11133 return offsets; 11134} 11135 11136function getViewportOffsetRectRelativeToArtbitraryNode(element) { 11137 var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 11138 11139 var html = element.ownerDocument.documentElement; 11140 var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html); 11141 var width = Math.max(html.clientWidth, window.innerWidth || 0); 11142 var height = Math.max(html.clientHeight, window.innerHeight || 0); 11143 11144 var scrollTop = !excludeScroll ? getScroll(html) : 0; 11145 var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0; 11146 11147 var offset = { 11148 top: scrollTop - relativeOffset.top + relativeOffset.marginTop, 11149 left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft, 11150 width: width, 11151 height: height 11152 }; 11153 11154 return getClientRect(offset); 11155} 11156 11157/** 11158 * Check if the given element is fixed or is inside a fixed parent 11159 * @method 11160 * @memberof Popper.Utils 11161 * @argument {Element} element 11162 * @argument {Element} customContainer 11163 * @returns {Boolean} answer to "isFixed?" 11164 */ 11165function isFixed(element) { 11166 var nodeName = element.nodeName; 11167 if (nodeName === 'BODY' || nodeName === 'HTML') { 11168 return false;
vendor: 9,912 bytes, lines 11169-11476
11169 } 11170 if (getStyleComputedProperty(element, 'position') === 'fixed') { 11171 return true; 11172 } 11173 var parentNode = getParentNode(element); 11174 if (!parentNode) { 11175 return false; 11176 } 11177 return isFixed(parentNode); 11178} 11179 11180/** 11181 * Finds the first parent of an element that has a transformed property defined 11182 * @method 11183 * @memberof Popper.Utils 11184 * @argument {Element} element 11185 * @returns {Element} first transformed parent or documentElement 11186 */ 11187 11188function getFixedPositionOffsetParent(element) { 11189 // This check is needed to avoid errors in case one of the elements isn't defined for any reason 11190 if (!element || !element.parentElement || isIE()) { 11191 return document.documentElement; 11192 } 11193 var el = element.parentElement; 11194 while (el && getStyleComputedProperty(el, 'transform') === 'none') { 11195 el = el.parentElement; 11196 } 11197 return el || document.documentElement; 11198} 11199 11200/** 11201 * Computed the boundaries limits and return them 11202 * @method 11203 * @memberof Popper.Utils 11204 * @param {HTMLElement} popper 11205 * @param {HTMLElement} reference 11206 * @param {number} padding 11207 * @param {HTMLElement} boundariesElement - Element used to define the boundaries 11208 * @param {Boolean} fixedPosition - Is in fixed position mode 11209 * @returns {Object} Coordinates of the boundaries 11210 */ 11211function getBoundaries(popper, reference, padding, boundariesElement) { 11212 var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; 11213 11214 // NOTE: 1 DOM access here 11215 11216 var boundaries = { top: 0, left: 0 }; 11217 var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference); 11218 11219 // Handle viewport case 11220 if (boundariesElement === 'viewport') { 11221 boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition); 11222 } else { 11223 // Handle other cases based on DOM element used as boundaries 11224 var boundariesNode = void 0; 11225 if (boundariesElement === 'scrollParent') { 11226 boundariesNode = getScrollParent(getParentNode(reference)); 11227 if (boundariesNode.nodeName === 'BODY') { 11228 boundariesNode = popper.ownerDocument.documentElement; 11229 } 11230 } else if (boundariesElement === 'window') { 11231 boundariesNode = popper.ownerDocument.documentElement; 11232 } else { 11233 boundariesNode = boundariesElement; 11234 } 11235 11236 var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition); 11237 11238 // In case of HTML, we need a different computation 11239 if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) { 11240 var _getWindowSizes = getWindowSizes(popper.ownerDocument), 11241 height = _getWindowSizes.height, 11242 width = _getWindowSizes.width; 11243 11244 boundaries.top += offsets.top - offsets.marginTop; 11245 boundaries.bottom = height + offsets.top; 11246 boundaries.left += offsets.left - offsets.marginLeft; 11247 boundaries.right = width + offsets.left; 11248 } else { 11249 // for all the other DOM elements, this one is good 11250 boundaries = offsets; 11251 } 11252 } 11253 11254 // Add paddings 11255 padding = padding || 0; 11256 var isPaddingNumber = typeof padding === 'number'; 11257 boundaries.left += isPaddingNumber ? padding : padding.left || 0; 11258 boundaries.top += isPaddingNumber ? padding : padding.top || 0; 11259 boundaries.right -= isPaddingNumber ? padding : padding.right || 0; 11260 boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0; 11261 11262 return boundaries; 11263} 11264 11265function getArea(_ref) { 11266 var width = _ref.width, 11267 height = _ref.height; 11268 11269 return width * height; 11270} 11271 11272/** 11273 * Utility used to transform the `auto` placement to the placement with more 11274 * available space. 11275 * @method 11276 * @memberof Popper.Utils 11277 * @argument {Object} data - The data object generated by update method 11278 * @argument {Object} options - Modifiers configuration and options 11279 * @returns {Object} The data object, properly modified 11280 */ 11281function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) { 11282 var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0; 11283 11284 if (placement.indexOf('auto') === -1) { 11285 return placement; 11286 } 11287 11288 var boundaries = getBoundaries(popper, reference, padding, boundariesElement); 11289 11290 var rects = { 11291 top: { 11292 width: boundaries.width, 11293 height: refRect.top - boundaries.top 11294 }, 11295 right: { 11296 width: boundaries.right - refRect.right, 11297 height: boundaries.height 11298 }, 11299 bottom: { 11300 width: boundaries.width, 11301 height: boundaries.bottom - refRect.bottom 11302 }, 11303 left: { 11304 width: refRect.left - boundaries.left, 11305 height: boundaries.height 11306 } 11307 }; 11308 11309 var sortedAreas = Object.keys(rects).map(function (key) { 11310 return _extends({ 11311 key: key 11312 }, rects[key], { 11313 area: getArea(rects[key]) 11314 }); 11315 }).sort(function (a, b) { 11316 return b.area - a.area; 11317 }); 11318 11319 var filteredAreas = sortedAreas.filter(function (_ref2) { 11320 var width = _ref2.width, 11321 height = _ref2.height; 11322 return width >= popper.clientWidth && height >= popper.clientHeight; 11323 }); 11324 11325 var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key; 11326 11327 var variation = placement.split('-')[1]; 11328 11329 return computedPlacement + (variation ? '-' + variation : ''); 11330} 11331 11332/** 11333 * Get offsets to the reference element 11334 * @method 11335 * @memberof Popper.Utils 11336 * @param {Object} state 11337 * @param {Element} popper - the popper element 11338 * @param {Element} reference - the reference element (the popper will be relative to this) 11339 * @param {Element} fixedPosition - is in fixed position mode 11340 * @returns {Object} An object containing the offsets which will be applied to the popper 11341 */ 11342function getReferenceOffsets(state, popper, reference) { 11343 var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 11344 11345 var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference); 11346 return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition); 11347} 11348 11349/** 11350 * Get the outer sizes of the given element (offset size + margins) 11351 * @method 11352 * @memberof Popper.Utils 11353 * @argument {Element} element 11354 * @returns {Object} object containing width and height properties 11355 */ 11356function getOuterSizes(element) { 11357 var window = element.ownerDocument.defaultView; 11358 var styles = window.getComputedStyle(element); 11359 var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0); 11360 var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0); 11361 var result = { 11362 width: element.offsetWidth + y, 11363 height: element.offsetHeight + x 11364 }; 11365 return result; 11366} 11367 11368/** 11369 * Get the opposite placement of the given one 11370 * @method 11371 * @memberof Popper.Utils 11372 * @argument {String} placement 11373 * @returns {String} flipped placement 11374 */ 11375function getOppositePlacement(placement) { 11376 var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' }; 11377 return placement.replace(/left|right|bottom|top/g, function (matched) { 11378 return hash[matched]; 11379 }); 11380} 11381 11382/** 11383 * Get offsets to the popper 11384 * @method 11385 * @memberof Popper.Utils 11386 * @param {Object} position - CSS position the Popper will get applied 11387 * @param {HTMLElement} popper - the popper element 11388 * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this) 11389 * @param {String} placement - one of the valid placement options 11390 * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper 11391 */ 11392function getPopperOffsets(popper, referenceOffsets, placement) { 11393 placement = placement.split('-')[0]; 11394 11395 // Get popper node sizes 11396 var popperRect = getOuterSizes(popper); 11397 11398 // Add position, width and height to our offsets object 11399 var popperOffsets = { 11400 width: popperRect.width, 11401 height: popperRect.height 11402 }; 11403 11404 // depending by the popper placement we have to compute its offsets slightly differently 11405 var isHoriz = ['right', 'left'].indexOf(placement) !== -1; 11406 var mainSide = isHoriz ? 'top' : 'left'; 11407 var secondarySide = isHoriz ? 'left' : 'top'; 11408 var measurement = isHoriz ? 'height' : 'width'; 11409 var secondaryMeasurement = !isHoriz ? 'height' : 'width'; 11410 11411 popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2; 11412 if (placement === secondarySide) { 11413 popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement]; 11414 } else { 11415 popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)]; 11416 } 11417 11418 return popperOffsets; 11419} 11420 11421/** 11422 * Mimics the `find` method of Array 11423 * @method 11424 * @memberof Popper.Utils 11425 * @argument {Array} arr 11426 * @argument prop 11427 * @argument value 11428 * @returns index or -1 11429 */ 11430function find(arr, check) { 11431 // use native find if supported 11432 if (Array.prototype.find) { 11433 return arr.find(check); 11434 } 11435 11436 // use `filter` to obtain the same behavior of `find` 11437 return arr.filter(check)[0]; 11438} 11439 11440/** 11441 * Return the index of the matching object 11442 * @method 11443 * @memberof Popper.Utils 11444 * @argument {Array} arr 11445 * @argument prop 11446 * @argument value 11447 * @returns index or -1 11448 */ 11449function findIndex(arr, prop, value) { 11450 // use native findIndex if supported 11451 if (Array.prototype.findIndex) { 11452 return arr.findIndex(function (cur) { 11453 return cur[prop] === value; 11454 }); 11455 } 11456 11457 // use `find` + `indexOf` if `findIndex` isn't supported 11458 var match = find(arr, function (obj) { 11459 return obj[prop] === value; 11460 }); 11461 return arr.indexOf(match); 11462} 11463 11464/** 11465 * Loop trough the list of modifiers and run them in order, 11466 * each of them will then edit the data object. 11467 * @method 11468 * @memberof Popper.Utils 11469 * @param {dataObject} data 11470 * @param {Array} modifiers 11471 * @param {String} ends - Optional modifier name used as stopper 11472 * @returns {dataObject} 11473 */ 11474function runModifiers(modifiers, data, ends) { 11475 var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends)); 11476
vendor: 4,062 bytes, lines 11477-11607
11477 modifiersToRun.forEach(function (modifier) { 11478 if (modifier['function']) { 11479 // eslint-disable-line dot-notation 11480 console.warn('`modifier.function` is deprecated, use `modifier.fn`!'); 11481 } 11482 var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation 11483 if (modifier.enabled && isFunction(fn)) { 11484 // Add properties to offsets to make them a complete clientRect object 11485 // we do this before each modifier to make sure the previous one doesn't 11486 // mess with these values 11487 data.offsets.popper = getClientRect(data.offsets.popper); 11488 data.offsets.reference = getClientRect(data.offsets.reference); 11489 11490 data = fn(data, modifier); 11491 } 11492 }); 11493 11494 return data; 11495} 11496 11497/** 11498 * Updates the position of the popper, computing the new offsets and applying 11499 * the new style.<br /> 11500 * Prefer `scheduleUpdate` over `update` because of performance reasons. 11501 * @method 11502 * @memberof Popper 11503 */ 11504function update() { 11505 // if popper is destroyed, don't perform any further update 11506 if (this.state.isDestroyed) { 11507 return; 11508 } 11509 11510 var data = { 11511 instance: this, 11512 styles: {}, 11513 arrowStyles: {}, 11514 attributes: {}, 11515 flipped: false, 11516 offsets: {} 11517 }; 11518 11519 // compute reference element offsets 11520 data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed); 11521 11522 // compute auto placement, store placement inside the data object, 11523 // modifiers will be able to edit `placement` if needed 11524 // and refer to originalPlacement to know the original value 11525 data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding); 11526 11527 // store the computed placement inside `originalPlacement` 11528 data.originalPlacement = data.placement; 11529 11530 data.positionFixed = this.options.positionFixed; 11531 11532 // compute the popper offsets 11533 data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement); 11534 11535 data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute'; 11536 11537 // run the modifiers 11538 data = runModifiers(this.modifiers, data); 11539 11540 // the first `update` will call `onCreate` callback 11541 // the other ones will call `onUpdate` callback 11542 if (!this.state.isCreated) { 11543 this.state.isCreated = true; 11544 this.options.onCreate(data); 11545 } else { 11546 this.options.onUpdate(data); 11547 } 11548} 11549 11550/** 11551 * Helper used to know if the given modifier is enabled. 11552 * @method 11553 * @memberof Popper.Utils 11554 * @returns {Boolean} 11555 */ 11556function isModifierEnabled(modifiers, modifierName) { 11557 return modifiers.some(function (_ref) { 11558 var name = _ref.name, 11559 enabled = _ref.enabled; 11560 return enabled && name === modifierName; 11561 }); 11562} 11563 11564/** 11565 * Get the prefixed supported property name 11566 * @method 11567 * @memberof Popper.Utils 11568 * @argument {String} property (camelCase) 11569 * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix) 11570 */ 11571function getSupportedPropertyName(property) { 11572 var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O']; 11573 var upperProp = property.charAt(0).toUpperCase() + property.slice(1); 11574 11575 for (var i = 0; i < prefixes.length; i++) { 11576 var prefix = prefixes[i]; 11577 var toCheck = prefix ? '' + prefix + upperProp : property; 11578 if (typeof document.body.style[toCheck] !== 'undefined') { 11579 return toCheck; 11580 } 11581 } 11582 return null; 11583} 11584 11585/** 11586 * Destroys the popper. 11587 * @method 11588 * @memberof Popper 11589 */ 11590function destroy() { 11591 this.state.isDestroyed = true; 11592 11593 // touch DOM only if `applyStyle` modifier is enabled 11594 if (isModifierEnabled(this.modifiers, 'applyStyle')) { 11595 this.popper.removeAttribute('x-placement'); 11596 this.popper.style.position = ''; 11597 this.popper.style.top = ''; 11598 this.popper.style.left = ''; 11599 this.popper.style.right = ''; 11600 this.popper.style.bottom = ''; 11601 this.popper.style.willChange = ''; 11602 this.popper.style[getSupportedPropertyName('transform')] = ''; 11603 } 11604 11605 this.disableEventListeners(); 11606 11607 // remove the popper if user explicit
vendor: 15,762 bytes, lines 11607-12056
11607y asked for the deletion on destroy 11608 // do not use `remove` because IE11 doesn't support it 11609 if (this.options.removeOnDestroy) { 11610 this.popper.parentNode.removeChild(this.popper); 11611 } 11612 return this; 11613} 11614 11615/** 11616 * Get the window associated with the element 11617 * @argument {Element} element 11618 * @returns {Window} 11619 */ 11620function getWindow(element) { 11621 var ownerDocument = element.ownerDocument; 11622 return ownerDocument ? ownerDocument.defaultView : window; 11623} 11624 11625function attachToScrollParents(scrollParent, event, callback, scrollParents) { 11626 var isBody = scrollParent.nodeName === 'BODY'; 11627 var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent; 11628 target.addEventListener(event, callback, { passive: true }); 11629 11630 if (!isBody) { 11631 attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents); 11632 } 11633 scrollParents.push(target); 11634} 11635 11636/** 11637 * Setup needed event listeners used to update the popper position 11638 * @method 11639 * @memberof Popper.Utils 11640 * @private 11641 */ 11642function setupEventListeners(reference, options, state, updateBound) { 11643 // Resize event listener on window 11644 state.updateBound = updateBound; 11645 getWindow(reference).addEventListener('resize', state.updateBound, { passive: true }); 11646 11647 // Scroll event listener on scroll parents 11648 var scrollElement = getScrollParent(reference); 11649 attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents); 11650 state.scrollElement = scrollElement; 11651 state.eventsEnabled = true; 11652 11653 return state; 11654} 11655 11656/** 11657 * It will add resize/scroll events and start recalculating 11658 * position of the popper element when they are triggered. 11659 * @method 11660 * @memberof Popper 11661 */ 11662function enableEventListeners() { 11663 if (!this.state.eventsEnabled) { 11664 this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate); 11665 } 11666} 11667 11668/** 11669 * Remove event listeners used to update the popper position 11670 * @method 11671 * @memberof Popper.Utils 11672 * @private 11673 */ 11674function removeEventListeners(reference, state) { 11675 // Remove resize event listener on window 11676 getWindow(reference).removeEventListener('resize', state.updateBound); 11677 11678 // Remove scroll event listener on scroll parents 11679 state.scrollParents.forEach(function (target) { 11680 target.removeEventListener('scroll', state.updateBound); 11681 }); 11682 11683 // Reset state 11684 state.updateBound = null; 11685 state.scrollParents = []; 11686 state.scrollElement = null; 11687 state.eventsEnabled = false; 11688 return state; 11689} 11690 11691/** 11692 * It will remove resize/scroll events and won't recalculate popper position 11693 * when they are triggered. It also won't trigger `onUpdate` callback anymore, 11694 * unless you call `update` method manually. 11695 * @method 11696 * @memberof Popper 11697 */ 11698function disableEventListeners() { 11699 if (this.state.eventsEnabled) { 11700 cancelAnimationFrame(this.scheduleUpdate); 11701 this.state = removeEventListeners(this.reference, this.state); 11702 } 11703} 11704 11705/** 11706 * Tells if a given input is a number 11707 * @method 11708 * @memberof Popper.Utils 11709 * @param {*} input to check 11710 * @return {Boolean} 11711 */ 11712function isNumeric(n) { 11713 return n !== '' && !isNaN(parseFloat(n)) && isFinite(n); 11714} 11715 11716/** 11717 * Set the style to the given popper 11718 * @method 11719 * @memberof Popper.Utils 11720 * @argument {Element} element - Element to apply the style to 11721 * @argument {Object} styles 11722 * Object with a list of properties and values which will be applied to the element 11723 */ 11724function setStyles(element, styles) { 11725 Object.keys(styles).forEach(function (prop) { 11726 var unit = ''; 11727 // add unit if the value is numeric and is one of the following 11728 if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) { 11729 unit = 'px'; 11730 } 11731 element.style[prop] = styles[prop] + unit; 11732 }); 11733} 11734 11735/** 11736 * Set the attributes to the given popper 11737 * @method 11738 * @memberof Popper.Utils 11739 * @argument {Element} element - Element to apply the attributes to 11740 * @argument {Object} styles 11741 * Object with a list of properties and values which will be applied to the element 11742 */ 11743function setAttributes(element, attributes) { 11744 Object.keys(attributes).forEach(function (prop) { 11745 var value = attributes[prop]; 11746 if (value !== false) { 11747 element.setAttribute(prop, attributes[prop]); 11748 } else { 11749 element.removeAttribute(prop); 11750 } 11751 }); 11752} 11753 11754/** 11755 * @function 11756 * @memberof Modifiers 11757 * @argument {Object} data - The data object generated by `update` method 11758 * @argument {Object} data.styles - List of style properties - values to apply to popper element 11759 * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element 11760 * @argument {Object} options - Modifiers configuration and options 11761 * @returns {Object} The same data object 11762 */ 11763function applyStyle(data) { 11764 // any property present in `data.styles` will be applied to the popper, 11765 // in this way we can make the 3rd party modifiers add custom styles to it 11766 // Be aware, modifiers could override the properties defined in the previous 11767 // lines of this modifier! 11768 setStyles(data.instance.popper, data.styles); 11769 11770 // any property present in `data.attributes` will be applied to the popper, 11771 // they will be set as HTML attributes of the element 11772 setAttributes(data.instance.popper, data.attributes); 11773 11774 // if arrowElement is defined and arrowStyles has some properties 11775 if (data.arrowElement && Object.keys(data.arrowStyles).length) { 11776 setStyles(data.arrowElement, data.arrowStyles); 11777 } 11778 11779 return data; 11780} 11781 11782/** 11783 * Set the x-placement attribute before everything else because it could be used 11784 * to add margins to the popper margins needs to be calculated to get the 11785 * correct popper offsets. 11786 * @method 11787 * @memberof Popper.modifiers 11788 * @param {HTMLElement} reference - The reference element used to position the popper 11789 * @param {HTMLElement} popper - The HTML element used as popper 11790 * @param {Object} options - Popper.js options 11791 */ 11792function applyStyleOnLoad(reference, popper, options, modifierOptions, state) { 11793 // compute reference element offsets 11794 var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed); 11795 11796 // compute auto placement, store placement inside the data object, 11797 // modifiers will be able to edit `placement` if needed 11798 // and refer to originalPlacement to know the original value 11799 var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding); 11800 11801 popper.setAttribute('x-placement', placement); 11802 11803 // Apply `position` to popper before anything else because 11804 // without the position applied we can't guarantee correct computations 11805 setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' }); 11806 11807 return options; 11808} 11809 11810/** 11811 * @function 11812 * @memberof Popper.Utils 11813 * @argument {Object} data - The data object generated by `update` method 11814 * @argument {Boolean} shouldRound - If the offsets should be rounded at all 11815 * @returns {Object} The popper's position offsets rounded 11816 * 11817 * The tale of pixel-perfect positioning. It's still not 100% perfect, but as 11818 * good as it can be within reason. 11819 * Discussion here: https://github.com/FezVrasta/popper.js/pull/715 11820 * 11821 * Low DPI screens cause a popper to be blurry if not using full pixels (Safari 11822 * as well on High DPI screens). 11823 * 11824 * Firefox prefers no rounding for positioning and does not have blurriness on 11825 * high DPI screens. 11826 * 11827 * Only horizontal placement and left/right values need to be considered. 11828 */ 11829function getRoundedOffsets(data, shouldRound) { 11830 var _data$offsets = data.offsets, 11831 popper = _data$offsets.popper, 11832 reference = _data$offsets.reference; 11833 var round = Math.round, 11834 floor = Math.floor; 11835 11836 var noRound = function noRound(v) { 11837 return v; 11838 }; 11839 11840 var referenceWidth = round(reference.width); 11841 var popperWidth = round(popper.width); 11842 11843 var isVertical = ['left', 'right'].indexOf(data.placement) !== -1; 11844 var isVariation = data.placement.indexOf('-') !== -1; 11845 var sameWidthParity = referenceWidth % 2 === popperWidth % 2; 11846 var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1; 11847 11848 var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor; 11849 var verticalToInteger = !shouldRound ? noRound : round; 11850 11851 return { 11852 left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left), 11853 top: verticalToInteger(popper.top), 11854 bottom: verticalToInteger(popper.bottom), 11855 right: horizontalToInteger(popper.right) 11856 }; 11857} 11858 11859var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent); 11860 11861/** 11862 * @function 11863 * @memberof Modifiers 11864 * @argument {Object} data - The data object generated by `update` method 11865 * @argument {Object} options - Modifiers configuration and options 11866 * @returns {Object} The data object, properly modified 11867 */ 11868function computeStyle(data, options) { 11869 var x = options.x, 11870 y = options.y; 11871 var popper = data.offsets.popper; 11872 11873 // Remove this legacy support in Popper.js v2 11874 11875 var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) { 11876 return modifier.name === 'applyStyle'; 11877 }).gpuAcceleration; 11878 if (legacyGpuAccelerationOption !== undefined) { 11879 console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!'); 11880 } 11881 var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration; 11882 11883 var offsetParent = getOffsetParent(data.instance.popper); 11884 var offsetParentRect = getBoundingClientRect(offsetParent); 11885 11886 // Styles 11887 var styles = { 11888 position: popper.position 11889 }; 11890 11891 var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox); 11892 11893 var sideA = x === 'bottom' ? 'top' : 'bottom'; 11894 var sideB = y === 'right' ? 'left' : 'right'; 11895 11896 // if gpuAcceleration is set to `true` and transform is supported, 11897 // we use `translate3d` to apply the position to the popper we 11898 // automatically use the supported prefixed version if needed 11899 var prefixedProperty = getSupportedPropertyName('transform'); 11900 11901 // now, let's make a step back and look at this code closely (wtf?) 11902 // If the content of the popper grows once it's been positioned, it 11903 // may happen that the popper gets misplaced because of the new content 11904 // overflowing its reference element 11905 // To avoid this problem, we provide two options (x and y), which allow 11906 // the consumer to define the offset origin. 11907 // If we position a popper on top of a reference element, we can set 11908 // `x` to `top` to make the popper grow towards its top instead of 11909 // its bottom. 11910 var left = void 0, 11911 top = void 0; 11912 if (sideA === 'bottom') { 11913 // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar) 11914 // and not the bottom of the html element 11915 if (offsetParent.nodeName === 'HTML') { 11916 top = -offsetParent.clientHeight + offsets.bottom; 11917 } else { 11918 top = -offsetParentRect.height + offsets.bottom; 11919 } 11920 } else { 11921 top = offsets.top; 11922 } 11923 if (sideB === 'right') { 11924 if (offsetParent.nodeName === 'HTML') { 11925 left = -offsetParent.clientWidth + offsets.right; 11926 } else { 11927 left = -offsetParentRect.width + offsets.right; 11928 } 11929 } else { 11930 left = offsets.left; 11931 } 11932 if (gpuAcceleration && prefixedProperty) { 11933 styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)'; 11934 styles[sideA] = 0; 11935 styles[sideB] = 0; 11936 styles.willChange = 'transform'; 11937 } else { 11938 // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties 11939 var invertTop = sideA === 'bottom' ? -1 : 1; 11940 var invertLeft = sideB === 'right' ? -1 : 1; 11941 styles[sideA] = top * invertTop; 11942 styles[sideB] = left * invertLeft; 11943 styles.willChange = sideA + ', ' + sideB; 11944 } 11945 11946 // Attributes 11947 var attributes = { 11948 'x-placement': data.placement 11949 }; 11950 11951 // Update `data` attributes, styles and arrowStyles 11952 data.attributes = _extends({}, attributes, data.attributes); 11953 data.styles = _extends({}, styles, data.styles); 11954 data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles); 11955 11956 return data; 11957} 11958 11959/** 11960 * Helper used to know if the given modifier depends from another one.<br /> 11961 * It checks if the needed modifier is listed and enabled. 11962 * @method 11963 * @memberof Popper.Utils 11964 * @param {Array} modifiers - list of modifiers 11965 * @param {String} requestingName - name of requesting modifier 11966 * @param {String} requestedName - name of requested modifier 11967 * @returns {Boolean} 11968 */ 11969function isModifierRequired(modifiers, requestingName, requestedName) { 11970 var requesting = find(modifiers, function (_ref) { 11971 var name = _ref.name; 11972 return name === requestingName; 11973 }); 11974 11975 var isRequired = !!requesting && modifiers.some(function (modifier) { 11976 return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order; 11977 }); 11978 11979 if (!isRequired) { 11980 var _requesting = '`' + requestingName + '`'; 11981 var requested = '`' + requestedName + '`'; 11982 console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!'); 11983 } 11984 return isRequired; 11985} 11986 11987/** 11988 * @function 11989 * @memberof Modifiers 11990 * @argument {Object} data - The data object generated by update method 11991 * @argument {Object} options - Modifiers configuration and options 11992 * @returns {Object} The data object, properly modified 11993 */ 11994function arrow(data, options) { 11995 var _data$offsets$arrow; 11996 11997 // arrow depends on keepTogether in order to work 11998 if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) { 11999 return data; 12000 } 12001 12002 var arrowElement = options.element; 12003 12004 // if arrowElement is a string, suppose it's a CSS selector 12005 if (typeof arrowElement === 'string') { 12006 arrowElement = data.instance.popper.querySelector(arrowElement); 12007 12008 // if arrowElement is not found, don't run the modifier 12009 if (!arrowElement) { 12010 return data; 12011 } 12012 } else { 12013 // if the arrowElement isn't a query selector we must check that the 12014 // provided DOM node is child of its popper node 12015 if (!data.instance.popper.contains(arrowElement)) { 12016 console.warn('WARNING: `arrow.element` must be child of its popper element!'); 12017 return data; 12018 } 12019 } 12020 12021 var placement = data.placement.split('-')[0]; 12022 var _data$offsets = data.offsets, 12023 popper = _data$offsets.popper, 12024 reference = _data$offsets.reference; 12025 12026 var isVertical = ['left', 'right'].indexOf(placement) !== -1; 12027 12028 var len = isVertical ? 'height' : 'width'; 12029 var sideCapitalized = isVertical ? 'Top' : 'Left'; 12030 var side = sideCapitalized.toLowerCase(); 12031 var altSide = isVertical ? 'left' : 'top'; 12032 var opSide = isVertical ? 'bottom' : 'right'; 12033 var arrowElementSize = getOuterSizes(arrowElement)[len]; 12034 12035 // 12036 // extends keepTogether behavior making sure the popper and its 12037 // reference have enough pixels in conjunction 12038 // 12039 12040 // top/left side 12041 if (reference[opSide] - arrowElementSize < popper[side]) { 12042 data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize); 12043 } 12044 // bottom/right side 12045 if (reference[side] + arrowElementSize > popper[opSide]) { 12046 data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide]; 12047 } 12048 data.offsets.popper = getClientRect(data.offsets.popper); 12049 12050 // compute center of the popper 12051 var center = reference[side] + reference[len] / 2 - arrowElementSize / 2; 12052 12053 // Compute the sideValue using the updated popper offsets 12054 // take popper margin in account because we don't have this info available 12055 var css = getStyleComputedProperty(data.instance.popper); 12056 var popperMarginSide = parseFloat(css['margin' + sideCapitalized]
vendor: 5,893 bytes, lines 12056-12209
12056, 10); 12057 var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10); 12058 var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide; 12059 12060 // prevent arrowElement from being placed not contiguously to its popper 12061 sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0); 12062 12063 data.arrowElement = arrowElement; 12064 data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow); 12065 12066 return data; 12067} 12068 12069/** 12070 * Get the opposite placement variation of the given one 12071 * @method 12072 * @memberof Popper.Utils 12073 * @argument {String} placement variation 12074 * @returns {String} flipped placement variation 12075 */ 12076function getOppositeVariation(variation) { 12077 if (variation === 'end') { 12078 return 'start'; 12079 } else if (variation === 'start') { 12080 return 'end'; 12081 } 12082 return variation; 12083} 12084 12085/** 12086 * List of accepted placements to use as values of the `placement` option.<br /> 12087 * Valid placements are: 12088 * - `auto` 12089 * - `top` 12090 * - `right` 12091 * - `bottom` 12092 * - `left` 12093 * 12094 * Each placement can have a variation from this list: 12095 * - `-start` 12096 * - `-end` 12097 * 12098 * Variations are interpreted easily if you think of them as the left to right 12099 * written languages. Horizontally (`top` and `bottom`), `start` is left and `end` 12100 * is right.<br /> 12101 * Vertically (`left` and `right`), `start` is top and `end` is bottom. 12102 * 12103 * Some valid examples are: 12104 * - `top-end` (on top of reference, right aligned) 12105 * - `right-start` (on right of reference, top aligned) 12106 * - `bottom` (on bottom, centered) 12107 * - `auto-end` (on the side with more space available, alignment depends by placement) 12108 * 12109 * @static 12110 * @type {Array} 12111 * @enum {String} 12112 * @readonly 12113 * @method placements 12114 * @memberof Popper 12115 */ 12116var 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']; 12117 12118// Get rid of `auto` `auto-start` and `auto-end` 12119var validPlacements = placements.slice(3); 12120 12121/** 12122 * Given an initial placement, returns all the subsequent placements 12123 * clockwise (or counter-clockwise). 12124 * 12125 * @method 12126 * @memberof Popper.Utils 12127 * @argument {String} placement - A valid placement (it accepts variations) 12128 * @argument {Boolean} counter - Set to true to walk the placements counterclockwise 12129 * @returns {Array} placements including their variations 12130 */ 12131function clockwise(placement) { 12132 var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; 12133 12134 var index = validPlacements.indexOf(placement); 12135 var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index)); 12136 return counter ? arr.reverse() : arr; 12137} 12138 12139var BEHAVIORS = { 12140 FLIP: 'flip', 12141 CLOCKWISE: 'clockwise', 12142 COUNTERCLOCKWISE: 'counterclockwise' 12143}; 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 flip(data, options) { 12153 // if `inner` modifier is enabled, we can't use the `flip` modifier 12154 if (isModifierEnabled(data.instance.modifiers, 'inner')) { 12155 return data; 12156 } 12157 12158 if (data.flipped && data.placement === data.originalPlacement) { 12159 // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides 12160 return data; 12161 } 12162 12163 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed); 12164 12165 var placement = data.placement.split('-')[0]; 12166 var placementOpposite = getOppositePlacement(placement); 12167 var variation = data.placement.split('-')[1] || ''; 12168 12169 var flipOrder = []; 12170 12171 switch (options.behavior) { 12172 case BEHAVIORS.FLIP: 12173 flipOrder = [placement, placementOpposite]; 12174 break; 12175 case BEHAVIORS.CLOCKWISE: 12176 flipOrder = clockwise(placement); 12177 break; 12178 case BEHAVIORS.COUNTERCLOCKWISE: 12179 flipOrder = clockwise(placement, true); 12180 break; 12181 default: 12182 flipOrder = options.behavior; 12183 } 12184 12185 flipOrder.forEach(function (step, index) { 12186 if (placement !== step || flipOrder.length === index + 1) { 12187 return data; 12188 } 12189 12190 placement = data.placement.split('-')[0]; 12191 placementOpposite = getOppositePlacement(placement); 12192 12193 var popperOffsets = data.offsets.popper; 12194 var refOffsets = data.offsets.reference; 12195 12196 // using floor because the reference offsets may contain decimals we are not going to consider here 12197 var floor = Math.floor; 12198 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); 12199 12200 var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left); 12201 var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right); 12202 var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top); 12203 var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom); 12204 12205 var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom; 12206 12207 // flip the variation if required 12208 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 12209 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 12209-12816
12209; 12210 12211 if (overlapsRef || overflowsBoundaries || flippedVariation) { 12212 // this boolean to detect any flip loop 12213 data.flipped = true; 12214 12215 if (overlapsRef || overflowsBoundaries) { 12216 placement = flipOrder[index + 1]; 12217 } 12218 12219 if (flippedVariation) { 12220 variation = getOppositeVariation(variation); 12221 } 12222 12223 data.placement = placement + (variation ? '-' + variation : ''); 12224 12225 // this object contains `position`, we want to preserve it along with 12226 // any additional property we may add in the future 12227 data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement)); 12228 12229 data = runModifiers(data.instance.modifiers, data, 'flip'); 12230 } 12231 }); 12232 return data; 12233} 12234 12235/** 12236 * @function 12237 * @memberof Modifiers 12238 * @argument {Object} data - The data object generated by update method 12239 * @argument {Object} options - Modifiers configuration and options 12240 * @returns {Object} The data object, properly modified 12241 */ 12242function keepTogether(data) { 12243 var _data$offsets = data.offsets, 12244 popper = _data$offsets.popper, 12245 reference = _data$offsets.reference; 12246 12247 var placement = data.placement.split('-')[0]; 12248 var floor = Math.floor; 12249 var isVertical = ['top', 'bottom'].indexOf(placement) !== -1; 12250 var side = isVertical ? 'right' : 'bottom'; 12251 var opSide = isVertical ? 'left' : 'top'; 12252 var measurement = isVertical ? 'width' : 'height'; 12253 12254 if (popper[side] < floor(reference[opSide])) { 12255 data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement]; 12256 } 12257 if (popper[opSide] > floor(reference[side])) { 12258 data.offsets.popper[opSide] = floor(reference[side]); 12259 } 12260 12261 return data; 12262} 12263 12264/** 12265 * Converts a string containing value + unit into a px value number 12266 * @function 12267 * @memberof {modifiers~offset} 12268 * @private 12269 * @argument {String} str - Value + unit string 12270 * @argument {String} measurement - `height` or `width` 12271 * @argument {Object} popperOffsets 12272 * @argument {Object} referenceOffsets 12273 * @returns {Number|String} 12274 * Value in pixels, or original string if no values were extracted 12275 */ 12276function toValue(str, measurement, popperOffsets, referenceOffsets) { 12277 // separate value from unit 12278 var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/); 12279 var value = +split[1]; 12280 var unit = split[2]; 12281 12282 // If it's not a number it's an operator, I guess 12283 if (!value) { 12284 return str; 12285 } 12286 12287 if (unit.indexOf('%') === 0) { 12288 var element = void 0; 12289 switch (unit) { 12290 case '%p': 12291 element = popperOffsets; 12292 break; 12293 case '%': 12294 case '%r': 12295 default: 12296 element = referenceOffsets; 12297 } 12298 12299 var rect = getClientRect(element); 12300 return rect[measurement] / 100 * value; 12301 } else if (unit === 'vh' || unit === 'vw') { 12302 // if is a vh or vw, we calculate the size based on the viewport 12303 var size = void 0; 12304 if (unit === 'vh') { 12305 size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); 12306 } else { 12307 size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); 12308 } 12309 return size / 100 * value; 12310 } else { 12311 // if is an explicit pixel unit, we get rid of the unit and keep the value 12312 // if is an implicit unit, it's px, and we return just the value 12313 return value; 12314 } 12315} 12316 12317/** 12318 * Parse an `offset` string to extrapolate `x` and `y` numeric offsets. 12319 * @function 12320 * @memberof {modifiers~offset} 12321 * @private 12322 * @argument {String} offset 12323 * @argument {Object} popperOffsets 12324 * @argument {Object} referenceOffsets 12325 * @argument {String} basePlacement 12326 * @returns {Array} a two cells array with x and y offsets in numbers 12327 */ 12328function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) { 12329 var offsets = [0, 0]; 12330 12331 // Use height if placement is left or right and index is 0 otherwise use width 12332 // in this way the first offset will use an axis and the second one 12333 // will use the other one 12334 var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1; 12335 12336 // Split the offset string to obtain a list of values and operands 12337 // The regex addresses values with the plus or minus sign in front (+10, -20, etc) 12338 var fragments = offset.split(/(\+|\-)/).map(function (frag) { 12339 return frag.trim(); 12340 }); 12341 12342 // Detect if the offset string contains a pair of values or a single one 12343 // they could be separated by comma or space 12344 var divider = fragments.indexOf(find(fragments, function (frag) { 12345 return frag.search(/,|\s/) !== -1; 12346 })); 12347 12348 if (fragments[divider] && fragments[divider].indexOf(',') === -1) { 12349 console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.'); 12350 } 12351 12352 // If divider is found, we divide the list of values and operands to divide 12353 // them by ofset X and Y. 12354 var splitRegex = /\s*,\s*|\s+/; 12355 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]; 12356 12357 // Convert the values with units to absolute pixels to allow our computations 12358 ops = ops.map(function (op, index) { 12359 // Most of the units rely on the orientation of the popper 12360 var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width'; 12361 var mergeWithPrevious = false; 12362 return op 12363 // This aggregates any `+` or `-` sign that aren't considered operators 12364 // e.g.: 10 + +5 => [10, +, +5] 12365 .reduce(function (a, b) { 12366 if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) { 12367 a[a.length - 1] = b; 12368 mergeWithPrevious = true; 12369 return a; 12370 } else if (mergeWithPrevious) { 12371 a[a.length - 1] += b; 12372 mergeWithPrevious = false; 12373 return a; 12374 } else { 12375 return a.concat(b); 12376 } 12377 }, []) 12378 // Here we convert the string values into number values (in px) 12379 .map(function (str) { 12380 return toValue(str, measurement, popperOffsets, referenceOffsets); 12381 }); 12382 }); 12383 12384 // Loop trough the offsets arrays and execute the operations 12385 ops.forEach(function (op, index) { 12386 op.forEach(function (frag, index2) { 12387 if (isNumeric(frag)) { 12388 offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1); 12389 } 12390 }); 12391 }); 12392 return offsets; 12393} 12394 12395/** 12396 * @function 12397 * @memberof Modifiers 12398 * @argument {Object} data - The data object generated by update method 12399 * @argument {Object} options - Modifiers configuration and options 12400 * @argument {Number|String} options.offset=0 12401 * The offset value as described in the modifier description 12402 * @returns {Object} The data object, properly modified 12403 */ 12404function offset(data, _ref) { 12405 var offset = _ref.offset; 12406 var placement = data.placement, 12407 _data$offsets = data.offsets, 12408 popper = _data$offsets.popper, 12409 reference = _data$offsets.reference; 12410 12411 var basePlacement = placement.split('-')[0]; 12412 12413 var offsets = void 0; 12414 if (isNumeric(+offset)) { 12415 offsets = [+offset, 0]; 12416 } else { 12417 offsets = parseOffset(offset, popper, reference, basePlacement); 12418 } 12419 12420 if (basePlacement === 'left') { 12421 popper.top += offsets[0]; 12422 popper.left -= offsets[1]; 12423 } else if (basePlacement === 'right') { 12424 popper.top += offsets[0]; 12425 popper.left += offsets[1]; 12426 } else if (basePlacement === 'top') { 12427 popper.left += offsets[0]; 12428 popper.top -= offsets[1]; 12429 } else if (basePlacement === 'bottom') { 12430 popper.left += offsets[0]; 12431 popper.top += offsets[1]; 12432 } 12433 12434 data.popper = popper; 12435 return data; 12436} 12437 12438/** 12439 * @function 12440 * @memberof Modifiers 12441 * @argument {Object} data - The data object generated by `update` method 12442 * @argument {Object} options - Modifiers configuration and options 12443 * @returns {Object} The data object, properly modified 12444 */ 12445function preventOverflow(data, options) { 12446 var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper); 12447 12448 // If offsetParent is the reference element, we really want to 12449 // go one step up and use the next offsetParent as reference to 12450 // avoid to make this modifier completely useless and look like broken 12451 if (data.instance.reference === boundariesElement) { 12452 boundariesElement = getOffsetParent(boundariesElement); 12453 } 12454 12455 // NOTE: DOM access here 12456 // resets the popper's position so that the document size can be calculated excluding 12457 // the size of the popper element itself 12458 var transformProp = getSupportedPropertyName('transform'); 12459 var popperStyles = data.instance.popper.style; // assignment to help minification 12460 var top = popperStyles.top, 12461 left = popperStyles.left, 12462 transform = popperStyles[transformProp]; 12463 12464 popperStyles.top = ''; 12465 popperStyles.left = ''; 12466 popperStyles[transformProp] = ''; 12467 12468 var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed); 12469 12470 // NOTE: DOM access here 12471 // restores the original style properties after the offsets have been computed 12472 popperStyles.top = top; 12473 popperStyles.left = left; 12474 popperStyles[transformProp] = transform; 12475 12476 options.boundaries = boundaries; 12477 12478 var order = options.priority; 12479 var popper = data.offsets.popper; 12480 12481 var check = { 12482 primary: function primary(placement) { 12483 var value = popper[placement]; 12484 if (popper[placement] < boundaries[placement] && !options.escapeWithReference) { 12485 value = Math.max(popper[placement], boundaries[placement]); 12486 } 12487 return defineProperty({}, placement, value); 12488 }, 12489 secondary: function secondary(placement) { 12490 var mainSide = placement === 'right' ? 'left' : 'top'; 12491 var value = popper[mainSide]; 12492 if (popper[placement] > boundaries[placement] && !options.escapeWithReference) { 12493 value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height)); 12494 } 12495 return defineProperty({}, mainSide, value); 12496 } 12497 }; 12498 12499 order.forEach(function (placement) { 12500 var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary'; 12501 popper = _extends({}, popper, check[side](placement)); 12502 }); 12503 12504 data.offsets.popper = popper; 12505 12506 return data; 12507} 12508 12509/** 12510 * @function 12511 * @memberof Modifiers 12512 * @argument {Object} data - The data object generated by `update` method 12513 * @argument {Object} options - Modifiers configuration and options 12514 * @returns {Object} The data object, properly modified 12515 */ 12516function shift(data) { 12517 var placement = data.placement; 12518 var basePlacement = placement.split('-')[0]; 12519 var shiftvariation = placement.split('-')[1]; 12520 12521 // if shift shiftvariation is specified, run the modifier 12522 if (shiftvariation) { 12523 var _data$offsets = data.offsets, 12524 reference = _data$offsets.reference, 12525 popper = _data$offsets.popper; 12526 12527 var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1; 12528 var side = isVertical ? 'left' : 'top'; 12529 var measurement = isVertical ? 'width' : 'height'; 12530 12531 var shiftOffsets = { 12532 start: defineProperty({}, side, reference[side]), 12533 end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement]) 12534 }; 12535 12536 data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]); 12537 } 12538 12539 return data; 12540} 12541 12542/** 12543 * @function 12544 * @memberof Modifiers 12545 * @argument {Object} data - The data object generated by update method 12546 * @argument {Object} options - Modifiers configuration and options 12547 * @returns {Object} The data object, properly modified 12548 */ 12549function hide(data) { 12550 if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) { 12551 return data; 12552 } 12553 12554 var refRect = data.offsets.reference; 12555 var bound = find(data.instance.modifiers, function (modifier) { 12556 return modifier.name === 'preventOverflow'; 12557 }).boundaries; 12558 12559 if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) { 12560 // Avoid unnecessary DOM access if visibility hasn't changed 12561 if (data.hide === true) { 12562 return data; 12563 } 12564 12565 data.hide = true; 12566 data.attributes['x-out-of-boundaries'] = ''; 12567 } else { 12568 // Avoid unnecessary DOM access if visibility hasn't changed 12569 if (data.hide === false) { 12570 return data; 12571 } 12572 12573 data.hide = false; 12574 data.attributes['x-out-of-boundaries'] = false; 12575 } 12576 12577 return data; 12578} 12579 12580/** 12581 * @function 12582 * @memberof Modifiers 12583 * @argument {Object} data - The data object generated by `update` method 12584 * @argument {Object} options - Modifiers configuration and options 12585 * @returns {Object} The data object, properly modified 12586 */ 12587function inner(data) { 12588 var placement = data.placement; 12589 var basePlacement = placement.split('-')[0]; 12590 var _data$offsets = data.offsets, 12591 popper = _data$offsets.popper, 12592 reference = _data$offsets.reference; 12593 12594 var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1; 12595 12596 var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1; 12597 12598 popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0); 12599 12600 data.placement = getOppositePlacement(placement); 12601 data.offsets.popper = getClientRect(popper); 12602 12603 return data; 12604} 12605 12606/** 12607 * Modifier function, each modifier can have a function of this type assigned 12608 * to its `fn` property.<br /> 12609 * These functions will be called on each update, this means that you must 12610 * make sure they are performant enough to avoid performance bottlenecks. 12611 * 12612 * @function ModifierFn 12613 * @argument {dataObject} data - The data object generated by `update` method 12614 * @argument {Object} options - Modifiers configuration and options 12615 * @returns {dataObject} The data object, properly modified 12616 */ 12617 12618/** 12619 * Modifiers are plugins used to alter the behavior of your poppers.<br /> 12620 * Popper.js uses a set of 9 modifiers to provide all the basic functionalities 12621 * needed by the library. 12622 * 12623 * Usually you don't want to override the `order`, `fn` and `onLoad` props. 12624 * All the other properties are configurations that could be tweaked. 12625 * @namespace modifiers 12626 */ 12627var modifiers = { 12628 /** 12629 * Modifier used to shift the popper on the start or end of its reference 12630 * element.<br /> 12631 * It will read the variation of the `placement` property.<br /> 12632 * It can be one either `-end` or `-start`. 12633 * @memberof modifiers 12634 * @inner 12635 */ 12636 shift: { 12637 /** @prop {number} order=100 - Index used to define the order of execution */ 12638 order: 100, 12639 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 12640 enabled: true, 12641 /** @prop {ModifierFn} */ 12642 fn: shift 12643 }, 12644 12645 /** 12646 * The `offset` modifier can shift your popper on both its axis. 12647 * 12648 * It accepts the following units: 12649 * - `px` or unit-less, interpreted as pixels 12650 * - `%` or `%r`, percentage relative to the length of the reference element 12651 * - `%p`, percentage relative to the length of the popper element 12652 * - `vw`, CSS viewport width unit 12653 * - `vh`, CSS viewport height unit 12654 * 12655 * For length is intended the main axis relative to the placement of the popper.<br /> 12656 * This means that if the placement is `top` or `bottom`, the length will be the 12657 * `width`. In case of `left` or `right`, it will be the `height`. 12658 * 12659 * You can provide a single value (as `Number` or `String`), or a pair of values 12660 * as `String` divided by a comma or one (or more) white spaces.<br /> 12661 * The latter is a deprecated method because it leads to confusion and will be 12662 * removed in v2.<br /> 12663 * Additionally, it accepts additions and subtractions between different units. 12664 * Note that multiplications and divisions aren't supported. 12665 * 12666 * Valid examples are: 12667 * ``` 12668 * 10 12669 * '10%' 12670 * '10, 10' 12671 * '10%, 10' 12672 * '10 + 10%' 12673 * '10 - 5vh + 3%' 12674 * '-10px + 5vh, 5px - 6%' 12675 * ``` 12676 * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap 12677 * > with their reference element, unfortunately, you will have to disable the `flip` modifier. 12678 * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373). 12679 * 12680 * @memberof modifiers 12681 * @inner 12682 */ 12683 offset: { 12684 /** @prop {number} order=200 - Index used to define the order of execution */ 12685 order: 200, 12686 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 12687 enabled: true, 12688 /** @prop {ModifierFn} */ 12689 fn: offset, 12690 /** @prop {Number|String} offset=0 12691 * The offset value as described in the modifier description 12692 */ 12693 offset: 0 12694 }, 12695 12696 /** 12697 * Modifier used to prevent the popper from being positioned outside the boundary. 12698 * 12699 * A scenario exists where the reference itself is not within the boundaries.<br /> 12700 * We can say it has "escaped the boundaries" — or just "escaped".<br /> 12701 * In this case we need to decide whether the popper should either: 12702 * 12703 * - detach from the reference and remain "trapped" in the boundaries, or 12704 * - if it should ignore the boundary and "escape with its reference" 12705 * 12706 * When `escapeWithReference` is set to`true` and reference is completely 12707 * outside its boundaries, the popper will overflow (or completely leave) 12708 * the boundaries in order to remain attached to the edge of the reference. 12709 * 12710 * @memberof modifiers 12711 * @inner 12712 */ 12713 preventOverflow: { 12714 /** @prop {number} order=300 - Index used to define the order of execution */ 12715 order: 300, 12716 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 12717 enabled: true, 12718 /** @prop {ModifierFn} */ 12719 fn: preventOverflow, 12720 /** 12721 * @prop {Array} [priority=['left','right','top','bottom']] 12722 * Popper will try to prevent overflow following these priorities by default, 12723 * then, it could overflow on the left and on top of the `boundariesElement` 12724 */ 12725 priority: ['left', 'right', 'top', 'bottom'], 12726 /** 12727 * @prop {number} padding=5 12728 * Amount of pixel used to define a minimum distance between the boundaries 12729 * and the popper. This makes sure the popper always has a little padding 12730 * between the edges of its container 12731 */ 12732 padding: 5, 12733 /** 12734 * @prop {String|HTMLElement} boundariesElement='scrollParent' 12735 * Boundaries used by the modifier. Can be `scrollParent`, `window`, 12736 * `viewport` or any DOM element. 12737 */ 12738 boundariesElement: 'scrollParent' 12739 }, 12740 12741 /** 12742 * Modifier used to make sure the reference and its popper stay near each other 12743 * without leaving any gap between the two. Especially useful when the arrow is 12744 * enabled and you want to ensure that it points to its reference element. 12745 * It cares only about the first axis. You can still have poppers with margin 12746 * between the popper and its reference element. 12747 * @memberof modifiers 12748 * @inner 12749 */ 12750 keepTogether: { 12751 /** @prop {number} order=400 - Index used to define the order of execution */ 12752 order: 400, 12753 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 12754 enabled: true, 12755 /** @prop {ModifierFn} */ 12756 fn: keepTogether 12757 }, 12758 12759 /** 12760 * This modifier is used to move the `arrowElement` of the popper to make 12761 * sure it is positioned between the reference element and its popper element. 12762 * It will read the outer size of the `arrowElement` node to detect how many 12763 * pixels of conjunction are needed. 12764 * 12765 * It has no effect if no `arrowElement` is provided. 12766 * @memberof modifiers 12767 * @inner 12768 */ 12769 arrow: { 12770 /** @prop {number} order=500 - Index used to define the order of execution */ 12771 order: 500, 12772 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 12773 enabled: true, 12774 /** @prop {ModifierFn} */ 12775 fn: arrow, 12776 /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */ 12777 element: '[x-arrow]' 12778 }, 12779 12780 /** 12781 * Modifier used to flip the popper's placement when it starts to overlap its 12782 * reference element. 12783 * 12784 * Requires the `preventOverflow` modifier before it in order to work. 12785 * 12786 * **NOTE:** this modifier will interrupt the current update cycle and will 12787 * restart it if it detects the need to flip the placement. 12788 * @memberof modifiers 12789 * @inner 12790 */ 12791 flip: { 12792 /** @prop {number} order=600 - Index used to define the order of execution */ 12793 order: 600, 12794 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 12795 enabled: true, 12796 /** @prop {ModifierFn} */ 12797 fn: flip, 12798 /** 12799 * @prop {String|Array} behavior='flip' 12800 * The behavior used to change the popper's placement. It can be one of 12801 * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid 12802 * placements (with optional variations) 12803 */ 12804 behavior: 'flip', 12805 /** 12806 * @prop {number} padding=5 12807 * The popper will flip if it hits the edges of the `boundariesElement` 12808 */ 12809 padding: 5, 12810 /** 12811 * @prop {String|HTMLElement} boundariesElement='viewport' 12812 * The element which will define the boundaries of the popper position. 12813 * The popper will never be placed outside of the defined boundaries 12814 * (except if `keepTogether` is enabled) 12815 */ 12816 boundariesElement: 'viewport'
12816 12817 }, 12818 12819 /** 12820 * Modifier used to make the popper flow toward the inner of the reference element. 12821 * By default, when this modifier is disabled, the popper will be placed outside 12822 * the reference element. 12823 * @memberof modifiers 12824 * @inner 12825 */ 12826 inner: { 12827 /** @prop {number} order=700 - Index used to define the order of execution */ 12828 order: 700, 12829 /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */ 12830 enabled: false, 12831 /** @prop {ModifierFn} */ 12832 fn: inner 12833 }, 12834 12835 /** 12836 * Modifier used to hide the popper when its reference element is outside of the 12837 * popper boundaries. It will set a `x-out-of-boundaries` attribute which can 12838 * be used to hide with a CSS selector the popper when its reference is 12839 * out of boundaries. 12840 * 12841 * Requires the `preventOverflow` modifier before it in order to work. 12842 * @memberof modifiers 12843 * @inner 12844 */ 12845 hide: { 12846 /** @prop {number} order=800 - Index used to define the order of execution */ 12847 order: 800, 12848 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 12849 enabled: true, 12850 /** @prop {ModifierFn} */ 12851 fn: hide 12852 }, 12853 12854 /** 12855 * Computes the style that will be applied to the popper element to gets 12856 * properly positioned. 12857 * 12858 * Note that this modifier will not touch the DOM, it just prepares the styles 12859 * so that `applyStyle` modifier can apply it. This separation is useful 12860 * in case you need to replace `applyStyle` with a custom implementation. 12861 * 12862 * This modifier has `850` as `order` value to maintain backward compatibility 12863 * with previous versions of Popper.js. Expect the modifiers ordering method 12864 * to change in future major versions of the library. 12865 * 12866 * @memberof modifiers 12867 * @inner 12868 */ 12869 computeStyle: { 12870 /** @prop {number} order=850 - Index used to define the order of execution */ 12871 order: 850, 12872 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 12873 enabled: true, 12874 /** @prop {ModifierFn} */ 12875 fn: computeStyle, 12876 /** 12877 * @prop {Boolean} gpuAcceleration=true 12878 * If true, it uses the CSS 3D transformation to position the popper. 12879 * Otherwise, it will use the `top` and `left` properties 12880 */ 12881 gpuAcceleration: true, 12882 /** 12883 * @prop {string} [x='bottom'] 12884 * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin. 12885 * Change this if your popper should grow in a direction different from `bottom` 12886 */ 12887 x: 'bottom', 12888 /** 12889 * @prop {string} [x='left'] 12890 * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin. 12891 * Change this if your popper should grow in a direction different from `right` 12892 */ 12893 y: 'right' 12894 }, 12895 12896 /** 12897 * Applies the computed styles to the popper element. 12898 * 12899 * All the DOM manipulations are limited to this modifier. This is useful in case 12900 * you want to integrate Popper.js inside a framework or view library and you 12901 * want to delegate all the DOM manipulations to it. 12902 * 12903 * Note that if you disable this modifier, you must make sure the popper element 12904 * has its position set to `absolute` before Popper.js can do its work! 12905 * 12906 * Just disable this modifier and define your own to achieve the desired effect. 12907 * 12908 * @memberof modifiers 12909 * @inner 12910 */ 12911 applyStyle: { 12912 /** @prop {number} order=900 - Index used to define the order of execution */ 12913 order: 900, 12914 /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */ 12915 enabled: true, 12916 /** @prop {ModifierFn} */
vendor: 4,830 bytes, lines 12917-13055
12917 fn: applyStyle, 12918 /** @prop {Function} */ 12919 onLoad: applyStyleOnLoad, 12920 /** 12921 * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier 12922 * @prop {Boolean} gpuAcceleration=true 12923 * If true, it uses the CSS 3D transformation to position the popper. 12924 * Otherwise, it will use the `top` and `left` properties 12925 */ 12926 gpuAcceleration: undefined 12927 } 12928}; 12929 12930/** 12931 * The `dataObject` is an object containing all the information used by Popper.js. 12932 * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks. 12933 * @name dataObject 12934 * @property {Object} data.instance The Popper.js instance 12935 * @property {String} data.placement Placement applied to popper 12936 * @property {String} data.originalPlacement Placement originally defined on init 12937 * @property {Boolean} data.flipped True if popper has been flipped by flip modifier 12938 * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper 12939 * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier 12940 * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`) 12941 * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`) 12942 * @property {Object} data.boundaries Offsets of the popper boundaries 12943 * @property {Object} data.offsets The measurements of popper, reference and arrow elements 12944 * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values 12945 * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values 12946 * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0 12947 */ 12948 12949/** 12950 * Default options provided to Popper.js constructor.<br /> 12951 * These can be overridden using the `options` argument of Popper.js.<br /> 12952 * To override an option, simply pass an object with the same 12953 * structure of the `options` object, as the 3rd argument. For example: 12954 * ``` 12955 * new Popper(ref, pop, { 12956 * modifiers: { 12957 * preventOverflow: { enabled: false } 12958 * } 12959 * }) 12960 * ``` 12961 * @type {Object} 12962 * @static 12963 * @memberof Popper 12964 */ 12965var Defaults = { 12966 /** 12967 * Popper's placement. 12968 * @prop {Popper.placements} placement='bottom' 12969 */ 12970 placement: 'bottom', 12971 12972 /** 12973 * Set this to true if you want popper to position it self in 'fixed' mode 12974 * @prop {Boolean} positionFixed=false 12975 */ 12976 positionFixed: false, 12977 12978 /** 12979 * Whether events (resize, scroll) are initially enabled. 12980 * @prop {Boolean} eventsEnabled=true 12981 */ 12982 eventsEnabled: true, 12983 12984 /** 12985 * Set to true if you want to automatically remove the popper when 12986 * you call the `destroy` method. 12987 * @prop {Boolean} removeOnDestroy=false 12988 */ 12989 removeOnDestroy: false, 12990 12991 /** 12992 * Callback called when the popper is created.<br /> 12993 * By default, it is set to no-op.<br /> 12994 * Access Popper.js instance with `data.instance`. 12995 * @prop {onCreate} 12996 */ 12997 onCreate: function onCreate() {}, 12998 12999 /** 13000 * Callback called when the popper is updated. This callback is not called 13001 * on the initialization/creation of the popper, but only on subsequent 13002 * updates.<br /> 13003 * By default, it is set to no-op.<br /> 13004 * Access Popper.js instance with `data.instance`. 13005 * @prop {onUpdate} 13006 */ 13007 onUpdate: function onUpdate() {}, 13008 13009 /** 13010 * List of modifiers used to modify the offsets before they are applied to the popper. 13011 * They provide most of the functionalities of Popper.js. 13012 * @prop {modifiers} 13013 */ 13014 modifiers: modifiers 13015}; 13016 13017/** 13018 * @callback onCreate 13019 * @param {dataObject} data 13020 */ 13021 13022/** 13023 * @callback onUpdate 13024 * @param {dataObject} data 13025 */ 13026 13027// Utils 13028// Methods 13029var Popper = function () { 13030 /** 13031 * Creates a new Popper.js instance. 13032 * @class Popper 13033 * @param {HTMLElement|referenceObject} reference - The reference element used to position the popper 13034 * @param {HTMLElement} popper - The HTML element used as the popper 13035 * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults) 13036 * @return {Object} instance - The generated Popper.js instance 13037 */ 13038 function Popper(reference, popper) { 13039 var _this = this; 13040 13041 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 13042 classCallCheck(this, Popper); 13043 13044 this.scheduleUpdate = function () { 13045 return requestAnimationFrame(_this.update); 13046 }; 13047 13048 // make update() debounced, so that it only runs at most once-per-tick 13049 this.update = debounce(this.update.bind(this)); 13050 13051 // with {} we create a new object with the options inside it 13052 this.options = _extends({}, Popper.Defaults, options); 13053 13054 // init state 13055 this.state = {
13056 isDestroyed: false, 13057 isCreated: false, 13058 scrollParents: [] 13059 }; 13060 13061 // get reference and popper elements (allow jQuery wrappers) 13062 this.reference = reference && reference.jquery ? reference[0] : reference; 13063 this.popper = popper && popper.jquery ? popper[0] : popper; 13064 13065 // Deep merge modifiers options 13066 this.options.modifiers = {}; 13067 Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) { 13068 _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {}); 13069 }); 13070 13071 // Refactoring modifiers' list (Object => Array) 13072 this.modifiers = Object.keys(this.options.modifiers).map(function (name) { 13073 return _extends({ 13074 name: name 13075 }, _this.options.modifiers[name]); 13076 }) 13077 // sort the modifiers by order 13078 .sort(function (a, b) { 13079 return a.order - b.order; 13080 }); 13081 13082 // modifiers have the ability to execute arbitrary code when Popper.js get inited 13083 // such code is executed in the same order of its modifier 13084 // they could add new properties to their options configuration 13085 // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`! 13086 this.modifiers.forEach(function (modifierOptions) { 13087 if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) { 13088 modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state); 13089 } 13090 }); 13091 13092 // fire the first update to position the popper in the right place 13093 this.update(); 13094 13095 var eventsEnabled = this.options.eventsEnabled; 13096 if (eventsEnabled) { 13097 // setup event listeners, they will take care of update the position in specific situations 13098 this.enableEventListeners(); 13099 } 13100 13101 this.state.eventsEnabled = eventsEnabled; 13102 } 13103 13104 // We can't use class properties because they don't get listed in the 13105 // class prototype and break stuff like Sinon stubs 13106 13107 13108 createClass(Popper, [{ 13109 key: 'update', 13110 value: function update$$1() { 13111 return update.call(this); 13112 } 13113 }, { 13114 key: 'destroy', 13115 value: function destroy$$1() { 13116 return destroy.call(this); 13117 } 13118 }, { 13119 key: 'enableEventListeners', 13120 value: function enableEventListeners$$1() { 13121 return enableEventListeners.call(this); 13122 } 13123 }, { 13124 key: 'disableEventListeners', 13125 value: function disableEventListeners$$1() { 13126 return disableEventListeners.call(this); 13127 } 13128 13129 /** 13130 * Schedules an update. It will run on the next UI update available. 13131 * @method scheduleUpdate 13132 * @memberof Popper 13133 */ 13134 13135 13136 /** 13137 * Collection of utilities useful when writing custom modifiers. 13138 * Starting from version 1.7, this method is available only if you 13139 * include `popper-utils.js` before `popper.js`. 13140 * 13141 * **DEPRECATION**: This way to access PopperUtils is deprecated 13142 * and will be removed in v2! Use the PopperUtils module directly instead. 13143 * Due to the high instability of the methods contained in Utils, we can't 13144 * guarantee them to follow semver. Use them at your own risk! 13145 * @static 13146 * @private 13147 * @type {Object} 13148 * @deprecated since version 1.8 13149 * @member Utils 13150 * @memberof Popper 13151 */ 13152 13153 }]); 13154 return Popper; 13155}(); 13156 13157/** 13158 * The `referenceObject` is an object that provides an interface compatible with Popper.js 13159 * and lets you use it as replacement of a real DOM node.<br /> 13160 * You can use this method to position a popper relatively to a set of coordinates 13161 * in case you don't have a DOM node to use as reference. 13162 * 13163 * ``` 13164 * new Popper(referenceObject, popperNode); 13165 * ``` 13166 * 13167 * NB: This feature isn't supported in Internet Explorer 10. 13168 * @name referenceObject 13169 * @property {Function} data.getBoundingClientRect 13170 * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method. 13171 * @property {number} data.clientWidth 13172 * An ES6 getter that will return the width of the virtual reference element. 13173 * @property {number} data.clientHeight 13174 * An ES6 getter that will return the height of the virtual reference element. 13175 */ 13176 13177 13178Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils; 13179Popper.placements = placements; 13180Popper.Defaults = Defaults; 13181 13182return Popper; 13183 13184}))); 13185//# sourceMappingURL=popper.js.map 13186 13187/*! 13188 * Bootstrap v4.3.1 (https://getbootstrap.com/) 13189 * Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 13190 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 13191 */ 13192(function (global, factory) { 13193 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('jquery'), require('popper.js')) : 13194 typeof define === 'function' && define.amd ? define(['exports', 'jquery', 'popper.js'], factory) : 13195 (global = global || self, factory(global.bootstrap = {}, global.jQuery, global.Popper)); 13196}(this, function (exports, $, Popper) { 'use strict'; 13197 13198 $ = $ && $.hasOwnProperty('default') ? $['default'] : $; 13199 Popper = Popper && Popper.hasOwnProperty('default') ? Popper['default'] : Popper; 13200 13201 function _defineProperties(target, props) { 13202 for (var i = 0; i < props.length; i++) { 13203 var descriptor = props[i]; 13204 descriptor.enumerable = descriptor.enumerable || false; 13205 descriptor.configurable = true; 13206 if ("value" in descriptor) descriptor.writable = true; 13207 Object.defineProperty(target, descriptor.key, descriptor); 13208 } 13209 } 13210 13211 function _createClass(Constructor, protoProps, staticProps) { 13212 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 13213 if (staticProps) _defineProperties(Constructor, staticProps); 13214 return Constructor; 13215 } 13216 13217 function _defineProperty(obj, key, value) { 13218 if (key in obj) { 13219 Object.defineProperty(obj, key, { 13220 value: value, 13221 enumerable: true, 13222 configurable: true, 13223 writable: true 13224 }); 13225 } else { 13226 obj[key] = value; 13227 } 13228 13229 return obj; 13230 } 13231 13232 function _objectSpread(target) { 13233 for (var i = 1; i < arguments.length; i++) { 13234 var source = arguments[i] != null ? arguments[i] : {}; 13235 var ownKeys = Object.keys(source); 13236 13237 if (typeof Object.getOwnPropertySymbols === 'function') { 13238 ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { 13239 return Object.getOwnPropertyDescriptor(source, sym).enumerable; 13240 })); 13241 } 13242 13243 ownKeys.forEach(function (key) { 13244 _defineProperty(target, key, source[key]); 13245 }); 13246 } 13247 13248 return target; 13249 } 13250 13251 function _inheritsLoose(subClass, superClass) { 13252 subClass.prototype = Object.create(superClass.prototype); 13253 subClass.prototype.constructor = subClass; 13254 subClass.__proto__ = superClass; 13255 } 13256 13257 /** 13258 * -------------------------------------------------------------------------- 13259 * Bootstrap (v4.3.1): util.js 13260 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 13261 * -------------------------------------------------------------------------- 13262 */ 13263 /** 13264 * ------------------------------------------------------------------------ 13265 * Private TransitionEnd Helpers 13266 * ------------------------------------------------------------------------ 13267 */ 13268 13269 var TRANSITION_END = 'transitionend'; 13270 var MAX_UID = 1000000; 13271 var MILLISECONDS_MULTIPLIER = 1000; // Shoutout AngusCroll (https://goo.gl/pxwQGp) 13272 13273 function toType(obj) { 13274 return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); 13275 } 13276 13277 function getSpecialTransitionEndEvent() { 13278 return { 13279 bindType: TRANSITION_END, 13280 delegateType: TRANSITION_END, 13281 handle: function handle(event) { 13282 if ($(event.target).is(this)) { 13283 return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params 13284 } 13285 13286 return undefined; // eslint-disable-line no-undefined 13287 } 13288 }; 13289 } 13290 13291 function transitionEndEmulator(duration) { 13292 var _this = this; 13293 13294 var called = false;
13295 $(this).one(Util.TRANSITION_END, function () { 13296 called = true; 13297 }); 13298 setTimeout(function () { 13299 if (!called) { 13300 Util.triggerTransitionEnd(_this); 13301 } 13302 }, duration); 13303 return this; 13304 } 13305 13306 function setTransitionEndSupport() { 13307 $.fn.emulateTransitionEnd = transitionEndEmulator; 13308 $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); 13309 } 13310 /** 13311 * -------------------------------------------------------------------------- 13312 * Public Util Api 13313 * -------------------------------------------------------------------------- 13314 */ 13315 13316 13317 var Util = { 13318 TRANSITION_END: 'bsTransitionEnd', 13319 getUID: function getUID(prefix) { 13320 do { 13321 // eslint-disable-next-line no-bitwise 13322 prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here 13323 } while (document.getElementById(prefix)); 13324 13325 return prefix; 13326 }, 13327 getSelectorFromElement: function getSelectorFromElement(element) { 13328 var selector = element.getAttribute('data-target'); 13329 13330 if (!selector || selector === '#') { 13331 var hrefAttr = element.getAttribute('href'); 13332 selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : ''; 13333 } 13334 13335 try { 13336 return document.querySelector(selector) ? selector : null; 13337 } catch (err) { 13338 return null; 13339 } 13340 }, 13341 getTransitionDurationFromElement: function getTransitionDurationFromElement(element) { 13342 if (!element) { 13343 return 0; 13344 } // Get transition-duration of the element 13345 13346 13347 var transitionDuration = $(element).css('transition-duration'); 13348 var transitionDelay = $(element).css('transition-delay'); 13349 var floatTransitionDuration = parseFloat(transitionDuration); 13350 var floatTransitionDelay = parseFloat(transitionDelay); // Return 0 if element or transition duration is not found 13351 13352 if (!floatTransitionDuration && !floatTransitionDelay) { 13353 return 0; 13354 } // If multiple durations are defined, take the first 13355 13356 13357 transitionDuration = transitionDuration.split(',')[0]; 13358 transitionDelay = transitionDelay.split(',')[0]; 13359 return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; 13360 }, 13361 reflow: function reflow(element) { 13362 return element.offsetHeight; 13363 }, 13364 triggerTransitionEnd: function triggerTransitionEnd(element) { 13365 $(element).trigger(TRANSITION_END); 13366 }, 13367 // TODO: Remove in v5 13368 supportsTransitionEnd: function supportsTransitionEnd() { 13369 return Boolean(TRANSITION_END); 13370 }, 13371 isElement: function isElement(obj) { 13372 return (obj[0] || obj).nodeType; 13373 }, 13374 typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { 13375 for (var property in configTypes) { 13376 if (Object.prototype.hasOwnProperty.call(configTypes, property)) { 13377 var expectedTypes = configTypes[property]; 13378 var value = config[property]; 13379 var valueType = value && Util.isElement(value) ? 'element' : toType(value); 13380 13381 if (!new RegExp(expectedTypes).test(valueType)) { 13382 throw new Error(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\".")); 13383 } 13384 } 13385 } 13386 }, 13387 findShadowRoot: function findShadowRoot(element) { 13388 if (!document.documentElement.attachShadow) { 13389 return null; 13390 } // Can find the shadow root otherwise it'll return the document 13391 13392 13393 if (typeof element.getRootNode === 'function') { 13394 var root = element.getRootNode(); 13395 return root instanceof ShadowRoot ? root : null; 13396 } 13397 13398 if (element instanceof ShadowRoot) { 13399 return element; 13400 } // when we don't find a shadow root 13401 13402 13403 if (!element.parentNode) { 13404 return null; 13405 } 13406 13407 return Util.findShadowRoot(element.parentNode); 13408 } 13409 }; 13410 setTransitionEndSupport(); 13411 13412 /** 13413 * ------------------------------------------------------------------------ 13414 * Constants 13415 * ------------------------------------------------------------------------ 13416 */ 13417 13418 var NAME = 'alert'; 13419 var VERSION = '4.3.1'; 13420 var DATA_KEY = 'bs.alert'; 13421 var EVENT_KEY = "." + DATA_KEY; 13422 var DATA_API_KEY = '.data-api'; 13423 var JQUERY_NO_CONFLICT = $.fn[NAME]; 13424 var Selector = { 13425 DISMISS: '[data-dismiss="alert"]' 13426 }; 13427 var Event = { 13428 CLOSE: "close" + EVENT_KEY, 13429 CLOSED: "closed" + EVENT_KEY, 13430 CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY 13431 }; 13432 var ClassName = { 13433 ALERT: 'alert', 13434 FADE: 'fade', 13435 SHOW: 'show' 13436 /** 13437 * ------------------------------------------------------------------------ 13438 * Class Definition 13439 * ------------------------------------------------------------------------ 13440 */ 13441 13442 }; 13443 13444 var Alert = 13445 /*#__PURE__*/ 13446 function () { 13447 function Alert(element) { 13448 this._element = element; 13449 } // Getters 13450 13451 13452 var _proto = Alert.prototype; 13453 13454 // Public 13455 _proto.close = function close(element) { 13456 var rootElement = this._element; 13457 13458 if (element) { 13459 rootElement = this._getRootElement(element); 13460 } 13461 13462 var customEvent = this._triggerCloseEvent(rootElement); 13463 13464 if (customEvent.isDefaultPrevented()) { 13465 return; 13466 } 13467 13468 this._removeElement(rootElement); 13469 }; 13470 13471 _proto.dispose = function dispose() { 13472 $.removeData(this._element, DATA_KEY); 13473 this._element = null; 13474 } // Private 13475 ; 13476 13477 _proto._getRootElement = function _getRootElement(element) { 13478 var selector = Util.getSelectorFromElement(element); 13479 var parent = false;
13480 13481 if (selector) { 13482 parent = document.querySelector(selector); 13483 } 13484 13485 if (!parent) { 13486 parent = $(element).closest("." + ClassName.ALERT)[0]; 13487 } 13488 13489 return parent; 13490 }; 13491 13492 _proto._triggerCloseEvent = function _triggerCloseEvent(element) { 13493 var closeEvent = $.Event(Event.CLOSE); 13494 $(element).trigger(closeEvent); 13495 return closeEvent; 13496 }; 13497 13498 _proto._removeElement = function _removeElement(element) { 13499 var _this = this; 13500 13501 $(element).removeClass(ClassName.SHOW); 13502 13503 if (!$(element).hasClass(ClassName.FADE)) { 13504 this._destroyElement(element); 13505 13506 return; 13507 } 13508 13509 var transitionDuration = Util.getTransitionDurationFromElement(element); 13510 $(element).one(Util.TRANSITION_END, function (event) { 13511 return _this._destroyElement(element, event); 13512 }).emulateTransitionEnd(transitionDuration); 13513 }; 13514 13515 _proto._destroyElement = function _destroyElement(element) { 13516 $(element).detach().trigger(Event.CLOSED).remove(); 13517 } // Static 13518 ; 13519 13520 Alert._jQueryInterface = function _jQueryInterface(config) { 13521 return this.each(function () { 13522 var $element = $(this); 13523 var data = $element.data(DATA_KEY); 13524 13525 if (!data) { 13526 data = new Alert(this); 13527 $element.data(DATA_KEY, data); 13528 } 13529 13530 if (config === 'close') { 13531 data[config](this); 13532 } 13533 }); 13534 }; 13535 13536 Alert._handleDismiss = function _handleDismiss(alertInstance) { 13537 return function (event) { 13538 if (event) { 13539 event.preventDefault(); 13540 } 13541 13542 alertInstance.close(this); 13543 }; 13544 }; 13545 13546 _createClass(Alert, null, [{ 13547 key: "VERSION", 13548 get: function get() { 13549 return VERSION; 13550 } 13551 }]); 13552 13553 return Alert; 13554 }(); 13555 /** 13556 * ------------------------------------------------------------------------ 13557 * Data Api implementation 13558 * ------------------------------------------------------------------------ 13559 */ 13560 13561 13562 $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert())); 13563 /** 13564 * ------------------------------------------------------------------------ 13565 * jQuery 13566 * ------------------------------------------------------------------------ 13567 */ 13568 13569 $.fn[NAME] = Alert._jQueryInterface; 13570 $.fn[NAME].Constructor = Alert; 13571 13572 $.fn[NAME].noConflict = function () { 13573 $.fn[NAME] = JQUERY_NO_CONFLICT; 13574 return Alert._jQueryInterface; 13575 }; 13576 13577 /** 13578 * ------------------------------------------------------------------------ 13579 * Constants 13580 * ------------------------------------------------------------------------ 13581 */ 13582 13583 var NAME$1 = 'button'; 13584 var VERSION$1 = '4.3.1'; 13585 var DATA_KEY$1 = 'bs.button'; 13586 var EVENT_KEY$1 = "." + DATA_KEY$1; 13587 var DATA_API_KEY$1 = '.data-api'; 13588 var JQUERY_NO_CONFLICT$1 = $.fn[NAME$1]; 13589 var ClassName$1 = { 13590 ACTIVE: 'active', 13591 BUTTON: 'btn', 13592 FOCUS: 'focus' 13593 }; 13594 var Selector$1 = { 13595 DATA_TOGGLE_CARROT: '[data-toggle^="button"]', 13596 DATA_TOGGLE: '[data-toggle="buttons"]', 13597 INPUT: 'input:not([type="hidden"])', 13598 ACTIVE: '.active', 13599 BUTTON: '.btn' 13600 }; 13601 var Event$1 = { 13602 CLICK_DATA_API: "click" + EVENT_KEY$1 + DATA_API_KEY$1, 13603 FOCUS_BLUR_DATA_API: "focus" + EVENT_KEY$1 + DATA_API_KEY$1 + " " + ("blur" + EVENT_KEY$1 + DATA_API_KEY$1) 13604 /** 13605 * ------------------------------------------------------------------------ 13606 * Class Definition 13607 * ------------------------------------------------------------------------ 13608 */ 13609 13610 }; 13611 13612 var Button = 13613 /*#__PURE__*/ 13614 function () { 13615 function Button(element) { 13616 this._element = element; 13617 } // Getters 13618 13619 13620 var _proto = Button.prototype; 13621 13622 // Public 13623 _proto.toggle = function toggle() { 13624 var triggerChangeEvent = true; 13625 var addAriaPressed = true; 13626 var rootElement = $(this._element).closest(Selector$1.DATA_TOGGLE)[0]; 13627 13628 if (rootElement) { 13629 var input = this._element.querySelector(Selector$1.INPUT); 13630 13631 if (input) { 13632 if (input.type === 'radio') { 13633 if (input.checked && this._element.classList.contains(ClassName$1.ACTIVE)) { 13634 triggerChangeEvent = false;
13635 } else { 13636 var activeElement = rootElement.querySelector(Selector$1.ACTIVE); 13637 13638 if (activeElement) { 13639 $(activeElement).removeClass(ClassName$1.ACTIVE); 13640 } 13641 } 13642 } 13643 13644 if (triggerChangeEvent) { 13645 if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) { 13646 return; 13647 } 13648 13649 input.checked = !this._element.classList.contains(ClassName$1.ACTIVE); 13650 $(input).trigger('change'); 13651 } 13652 13653 input.focus(); 13654 addAriaPressed = false; 13655 } 13656 } 13657 13658 if (addAriaPressed) { 13659 this._element.setAttribute('aria-pressed', !this._element.classList.contains(ClassName$1.ACTIVE)); 13660 } 13661 13662 if (triggerChangeEvent) { 13663 $(this._element).toggleClass(ClassName$1.ACTIVE); 13664 } 13665 }; 13666 13667 _proto.dispose = function dispose() { 13668 $.removeData(this._element, DATA_KEY$1); 13669 this._element = null; 13670 } // Static 13671 ; 13672 13673 Button._jQueryInterface = function _jQueryInterface(config) { 13674 return this.each(function () { 13675 var data = $(this).data(DATA_KEY$1); 13676 13677 if (!data) { 13678 data = new Button(this); 13679 $(this).data(DATA_KEY$1, data); 13680 } 13681 13682 if (config === 'toggle') { 13683 data[config](); 13684 } 13685 }); 13686 }; 13687 13688 _createClass(Button, null, [{ 13689 key: "VERSION", 13690 get: function get() { 13691 return VERSION$1; 13692 } 13693 }]); 13694 13695 return Button; 13696 }(); 13697 /** 13698 * ------------------------------------------------------------------------ 13699 * Data Api implementation 13700 * ------------------------------------------------------------------------ 13701 */ 13702 13703 13704 $(document).on(Event$1.CLICK_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) { 13705 event.preventDefault(); 13706 var button = event.target; 13707 13708 if (!$(button).hasClass(ClassName$1.BUTTON)) { 13709 button = $(button).closest(Selector$1.BUTTON); 13710 } 13711 13712 Button._jQueryInterface.call($(button), 'toggle'); 13713 }).on(Event$1.FOCUS_BLUR_DATA_API, Selector$1.DATA_TOGGLE_CARROT, function (event) { 13714 var button = $(event.target).closest(Selector$1.BUTTON)[0]; 13715 $(button).toggleClass(ClassName$1.FOCUS, /^focus(in)?$/.test(event.type)); 13716 }); 13717 /** 13718 * ------------------------------------------------------------------------ 13719 * jQuery 13720 * ------------------------------------------------------------------------ 13721 */ 13722 13723 $.fn[NAME$1] = Button._jQueryInterface; 13724 $.fn[NAME$1].Constructor = Button; 13725 13726 $.fn[NAME$1].noConflict = function () { 13727 $.fn[NAME$1] = JQUERY_NO_CONFLICT$1; 13728 return Button._jQueryInterface; 13729 }; 13730 13731 /** 13732 * ------------------------------------------------------------------------ 13733 * Constants 13734 * ------------------------------------------------------------------------ 13735 */ 13736 13737 var NAME$2 = 'carousel'; 13738 var VERSION$2 = '4.3.1'; 13739 var DATA_KEY$2 = 'bs.carousel'; 13740 var EVENT_KEY$2 = "." + DATA_KEY$2; 13741 var DATA_API_KEY$2 = '.data-api'; 13742 var JQUERY_NO_CONFLICT$2 = $.fn[NAME$2]; 13743 var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key 13744 13745 var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key 13746 13747 var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch 13748 13749 var SWIPE_THRESHOLD = 40; 13750 var Default = { 13751 interval: 5000, 13752 keyboard: true, 13753 slide: false, 13754 pause: 'hover', 13755 wrap: true, 13756 touch: true 13757 }; 13758 var DefaultType = { 13759 interval: '(number|boolean)', 13760 keyboard: 'boolean', 13761 slide: '(boolean|string)', 13762 pause: '(string|boolean)', 13763 wrap: 'boolean', 13764 touch: 'boolean' 13765 }; 13766 var Direction = { 13767 NEXT: 'next', 13768 PREV: 'prev', 13769 LEFT: 'left', 13770 RIGHT: 'right' 13771 }; 13772 var Event$2 = { 13773 SLIDE: "slide" + EVENT_KEY$2, 13774 SLID: "slid" + EVENT_KEY$2, 13775 KEYDOWN: "keydown" + EVENT_KEY$2, 13776 MOUSEENTER: "mouseenter" + EVENT_KEY$2, 13777 MOUSELEAVE: "mouseleave" + EVENT_KEY$2, 13778 TOUCHSTART: "touchstart" + EVENT_KEY$2, 13779 TOUCHMOVE: "touchmove" + EVENT_KEY$2, 13780 TOUCHEND: "touchend" + EVENT_KEY$2, 13781 POINTERDOWN: "pointerdown" + EVENT_KEY$2, 13782 POINTERUP: "pointerup" + EVENT_KEY$2, 13783 DRAG_START: "dragstart" + EVENT_KEY$2, 13784 LOAD_DATA_API: "load" + EVENT_KEY$2 + DATA_API_KEY$2, 13785 CLICK_DATA_API: "click" + EVENT_KEY$2 + DATA_API_KEY$2 13786 }; 13787 var ClassName$2 = { 13788 CAROUSEL: 'carousel', 13789 ACTIVE: 'active', 13790 SLIDE: 'slide', 13791 RIGHT: 'carousel-item-right', 13792 LEFT: 'carousel-item-left', 13793 NEXT: 'carousel-item-next', 13794 PREV: 'carousel-item-prev', 13795 ITEM: 'carousel-item', 13796 POINTER_EVENT: 'pointer-event' 13797 }; 13798 var Selector$2 = { 13799 ACTIVE: '.active', 13800 ACTIVE_ITEM: '.active.carousel-item', 13801 ITEM: '.carousel-item', 13802 ITEM_IMG: '.carousel-item img', 13803 NEXT_PREV: '.carousel-item-next, .carousel-item-prev', 13804 INDICATORS: '.carousel-indicators',
13805 DATA_SLIDE: '[data-slide], [data-slide-to]', 13806 DATA_RIDE: '[data-ride="carousel"]' 13807 }; 13808 var PointerType = { 13809 TOUCH: 'touch', 13810 PEN: 'pen' 13811 /** 13812 * ------------------------------------------------------------------------ 13813 * Class Definition 13814 * ------------------------------------------------------------------------ 13815 */ 13816 13817 }; 13818 13819 var Carousel = 13820 /*#__PURE__*/ 13821 function () { 13822 function Carousel(element, config) { 13823 this._items = null; 13824 this._interval = null; 13825 this._activeElement = null; 13826 this._isPaused = false; 13827 this._isSliding = false; 13828 this.touchTimeout = null; 13829 this.touchStartX = 0; 13830 this.touchDeltaX = 0; 13831 this._config = this._getConfig(config); 13832 this._element = element; 13833 this._indicatorsElement = this._element.querySelector(Selector$2.INDICATORS); 13834 this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; 13835 this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent); 13836 13837 this._addEventListeners(); 13838 } // Getters 13839 13840 13841 var _proto = Carousel.prototype; 13842 13843 // Public 13844 _proto.next = function next() { 13845 if (!this._isSliding) { 13846 this._slide(Direction.NEXT); 13847 } 13848 }; 13849 13850 _proto.nextWhenVisible = function nextWhenVisible() { 13851 // Don't call next when the page isn't visible 13852 // or the carousel or its parent isn't visible 13853 if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') { 13854 this.next(); 13855 } 13856 }; 13857 13858 _proto.prev = function prev() { 13859 if (!this._isSliding) { 13860 this._slide(Direction.PREV); 13861 } 13862 }; 13863 13864 _proto.pause = function pause(event) { 13865 if (!event) { 13866 this._isPaused = true; 13867 } 13868 13869 if (this._element.querySelector(Selector$2.NEXT_PREV)) { 13870 Util.triggerTransitionEnd(this._element); 13871 this.cycle(true); 13872 } 13873 13874 clearInterval(this._interval); 13875 this._interval = null; 13876 }; 13877 13878 _proto.cycle = function cycle(event) { 13879 if (!event) { 13880 this._isPaused = false; 13881 } 13882 13883 if (this._interval) { 13884 clearInterval(this._interval); 13885 this._interval = null; 13886 } 13887 13888 if (this._config.interval && !this._isPaused) { 13889 this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); 13890 } 13891 }; 13892 13893 _proto.to = function to(index) { 13894 var _this = this; 13895 13896 this._activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM); 13897 13898 var activeIndex = this._getItemIndex(this._activeElement); 13899 13900 if (index > this._items.length - 1 || index < 0) { 13901 return; 13902 } 13903 13904 if (this._isSliding) { 13905 $(this._element).one(Event$2.SLID, function () { 13906 return _this.to(index); 13907 }); 13908 return; 13909 } 13910 13911 if (activeIndex === index) { 13912 this.pause(); 13913 this.cycle(); 13914 return; 13915 } 13916 13917 var direction = index > activeIndex ? Direction.NEXT : Direction.PREV; 13918 13919 this._slide(direction, this._items[index]); 13920 }; 13921 13922 _proto.dispose = function dispose() { 13923 $(this._element).off(EVENT_KEY$2); 13924 $.removeData(this._element, DATA_KEY$2); 13925 this._items = null; 13926 this._config = null; 13927 this._element = null; 13928 this._interval = null; 13929 this._isPaused = null; 13930 this._isSliding = null; 13931 this._activeElement = null; 13932 this._indicatorsElement = null; 13933 } // Private 13934 ; 13935 13936 _proto._getConfig = function _getConfig(config) { 13937 config = _objectSpread({}, Default, config); 13938 Util.typeCheckConfig(NAME$2, config, DefaultType); 13939 return config; 13940 }; 13941 13942 _proto._handleSwipe = function _handleSwipe() { 13943 var absDeltax = Math.abs(this.touchDeltaX); 13944 13945 if (absDeltax <= SWIPE_THRESHOLD) { 13946 return; 13947 } 13948 13949 var direction = absDeltax / this.touchDeltaX; // swipe left 13950 13951 if (direction > 0) { 13952 this.prev(); 13953 } // swipe right 13954 13955 13956 if (direction < 0) { 13957 this.next(); 13958 } 13959 }; 13960 13961 _proto._addEventListeners = function _addEventListeners() { 13962 var _this2 = this; 13963 13964 if (this._config.keyboard) { 13965 $(this._element).on(Event$2.KEYDOWN, function (event) { 13966 return _this2._keydown(event); 13967 }); 13968 } 13969 13970 if (this._config.pause === 'hover') { 13971 $(this._element).on(Event$2.MOUSEENTER, function (event) { 13972 return _this2.pause(event); 13973 }).on(Event$2.MOUSELEAVE, function (event) { 13974 return _this2.cycle(event); 13975 }); 13976 } 13977 13978 if (this._config.touch) { 13979 this._addTouchEventListeners(); 13980 } 13981 }; 13982 13983 _proto._addTouchEventListeners = function _addTouchEventListeners() { 13984 var _this3 = this; 13985 13986 if (!this._touchSupported) { 13987 return; 13988 } 13989 13990 var start = function start(event) { 13991 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 13992 _this3.touchStartX = event.originalEvent.clientX; 13993 } else if (!_this3._pointerEvent) { 13994 _this3.touchStartX = event.originalEvent.touches[0].clientX; 13995 } 13996 }; 13997 13998 var move = function move(event) { 13999 // ensure swiping with one touch and not pinching 14000 if (event.originalEvent.touches && event.originalEvent.touches.length > 1) { 14001 _this3.touchDeltaX = 0; 14002 } else { 14003 _this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX; 14004 } 14005 }; 14006 14007 var end = function end(event) { 14008 if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 14009 _this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX; 14010 } 14011 14012 _this3._handleSwipe(); 14013 14014 if (_this3._config.pause === 'hover') {
14015 // If it's a touch-enabled device, mouseenter/leave are fired as 14016 // part of the mouse compatibility events on first tap - the carousel 14017 // would stop cycling until user tapped out of it; 14018 // here, we listen for touchend, explicitly pause the carousel 14019 // (as if it's the second time we tap on it, mouseenter compat event 14020 // is NOT fired) and after a timeout (to allow for mouse compatibility 14021 // events to fire) we explicitly restart cycling 14022 _this3.pause(); 14023 14024 if (_this3.touchTimeout) { 14025 clearTimeout(_this3.touchTimeout); 14026 } 14027 14028 _this3.touchTimeout = setTimeout(function (event) { 14029 return _this3.cycle(event); 14030 }, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval); 14031 } 14032 }; 14033 14034 $(this._element.querySelectorAll(Selector$2.ITEM_IMG)).on(Event$2.DRAG_START, function (e) { 14035 return e.preventDefault(); 14036 }); 14037 14038 if (this._pointerEvent) { 14039 $(this._element).on(Event$2.POINTERDOWN, function (event) { 14040 return start(event); 14041 }); 14042 $(this._element).on(Event$2.POINTERUP, function (event) { 14043 return end(event); 14044 }); 14045 14046 this._element.classList.add(ClassName$2.POINTER_EVENT); 14047 } else { 14048 $(this._element).on(Event$2.TOUCHSTART, function (event) { 14049 return start(event); 14050 }); 14051 $(this._element).on(Event$2.TOUCHMOVE, function (event) { 14052 return move(event); 14053 }); 14054 $(this._element).on(Event$2.TOUCHEND, function (event) { 14055 return end(event); 14056 }); 14057 } 14058 }; 14059 14060 _proto._keydown = function _keydown(event) { 14061 if (/input|textarea/i.test(event.target.tagName)) { 14062 return; 14063 } 14064 14065 switch (event.which) { 14066 case ARROW_LEFT_KEYCODE: 14067 event.preventDefault(); 14068 this.prev(); 14069 break; 14070 14071 case ARROW_RIGHT_KEYCODE: 14072 event.preventDefault(); 14073 this.next(); 14074 break; 14075 14076 default: 14077 } 14078 }; 14079 14080 _proto._getItemIndex = function _getItemIndex(element) { 14081 this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector$2.ITEM)) : []; 14082 return this._items.indexOf(element); 14083 }; 14084 14085 _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) { 14086 var isNextDirection = direction === Direction.NEXT; 14087 var isPrevDirection = direction === Direction.PREV; 14088 14089 var activeIndex = this._getItemIndex(activeElement); 14090 14091 var lastItemIndex = this._items.length - 1; 14092 var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; 14093 14094 if (isGoingToWrap && !this._config.wrap) { 14095 return activeElement; 14096 } 14097 14098 var delta = direction === Direction.PREV ? -1 : 1; 14099 var itemIndex = (activeIndex + delta) % this._items.length; 14100 return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; 14101 }; 14102 14103 _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { 14104 var targetIndex = this._getItemIndex(relatedTarget); 14105 14106 var fromIndex = this._getItemIndex(this._element.querySelector(Selector$2.ACTIVE_ITEM)); 14107 14108 var slideEvent = $.Event(Event$2.SLIDE, { 14109 relatedTarget: relatedTarget, 14110 direction: eventDirectionName, 14111 from: fromIndex, 14112 to: targetIndex 14113 }); 14114 $(this._element).trigger(slideEvent); 14115 return slideEvent; 14116 }; 14117 14118 _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { 14119 if (this._indicatorsElement) { 14120 var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector$2.ACTIVE)); 14121 $(indicators).removeClass(ClassName$2.ACTIVE); 14122 14123 var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; 14124 14125 if (nextIndicator) { 14126 $(nextIndicator).addClass(ClassName$2.ACTIVE); 14127 } 14128 } 14129 }; 14130 14131 _proto._slide = function _slide(direction, element) { 14132 var _this4 = this; 14133 14134 var activeElement = this._element.querySelector(Selector$2.ACTIVE_ITEM); 14135 14136 var activeElementIndex = this._getItemIndex(activeElement); 14137 14138 var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); 14139 14140 var nextElementIndex = this._getItemIndex(nextElement); 14141 14142 var isCycling = Boolean(this._interval); 14143 var directionalClassName; 14144 var orderClassName; 14145 var eventDirectionName; 14146 14147 if (direction === Direction.NEXT) { 14148 directionalClassName = ClassName$2.LEFT; 14149 orderClassName = ClassName$2.NEXT; 14150 eventDirectionName = Direction.LEFT; 14151 } else { 14152 directionalClassName = ClassName$2.RIGHT; 14153 orderClassName = ClassName$2.PREV; 14154 eventDirectionName = Direction.RIGHT; 14155 } 14156 14157 if (nextElement && $(nextElement).hasClass(ClassName$2.ACTIVE)) { 14158 this._isSliding = false;
14159 return; 14160 } 14161 14162 var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); 14163 14164 if (slideEvent.isDefaultPrevented()) { 14165 return; 14166 } 14167 14168 if (!activeElement || !nextElement) { 14169 // Some weirdness is happening, so we bail 14170 return; 14171 } 14172 14173 this._isSliding = true; 14174 14175 if (isCycling) { 14176 this.pause(); 14177 } 14178 14179 this._setActiveIndicatorElement(nextElement); 14180 14181 var slidEvent = $.Event(Event$2.SLID, { 14182 relatedTarget: nextElement, 14183 direction: eventDirectionName, 14184 from: activeElementIndex, 14185 to: nextElementIndex 14186 }); 14187 14188 if ($(this._element).hasClass(ClassName$2.SLIDE)) { 14189 $(nextElement).addClass(orderClassName); 14190 Util.reflow(nextElement); 14191 $(activeElement).addClass(directionalClassName); 14192 $(nextElement).addClass(directionalClassName); 14193 var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10); 14194 14195 if (nextElementInterval) { 14196 this._config.defaultInterval = this._config.defaultInterval || this._config.interval; 14197 this._config.interval = nextElementInterval; 14198 } else { 14199 this._config.interval = this._config.defaultInterval || this._config.interval; 14200 } 14201 14202 var transitionDuration = Util.getTransitionDurationFromElement(activeElement); 14203 $(activeElement).one(Util.TRANSITION_END, function () { 14204 $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName$2.ACTIVE); 14205 $(activeElement).removeClass(ClassName$2.ACTIVE + " " + orderClassName + " " + directionalClassName); 14206 _this4._isSliding = false; 14207 setTimeout(function () { 14208 return $(_this4._element).trigger(slidEvent); 14209 }, 0); 14210 }).emulateTransitionEnd(transitionDuration); 14211 } else { 14212 $(activeElement).removeClass(ClassName$2.ACTIVE); 14213 $(nextElement).addClass(ClassName$2.ACTIVE); 14214 this._isSliding = false; 14215 $(this._element).trigger(slidEvent); 14216 } 14217 14218 if (isCycling) { 14219 this.cycle(); 14220 } 14221 } // Static 14222 ; 14223 14224 Carousel._jQueryInterface = function _jQueryInterface(config) { 14225 return this.each(function () { 14226 var data = $(this).data(DATA_KEY$2); 14227 14228 var _config = _objectSpread({}, Default, $(this).data()); 14229 14230 if (typeof config === 'object') { 14231 _config = _objectSpread({}, _config, config); 14232 } 14233 14234 var action = typeof config === 'string' ? config : _config.slide; 14235 14236 if (!data) { 14237 data = new Carousel(this, _config); 14238 $(this).data(DATA_KEY$2, data); 14239 } 14240 14241 if (typeof config === 'number') { 14242 data.to(config); 14243 } else if (typeof action === 'string') { 14244 if (typeof data[action] === 'undefined') { 14245 throw new TypeError("No method named \"" + action + "\""); 14246 } 14247 14248 data[action](); 14249 } else if (_config.interval && _config.ride) { 14250 data.pause(); 14251 data.cycle(); 14252 } 14253 }); 14254 }; 14255 14256 Carousel._dataApiClickHandler = function _dataApiClickHandler(event) { 14257 var selector = Util.getSelectorFromElement(this); 14258 14259 if (!selector) { 14260 return; 14261 } 14262 14263 var target = $(selector)[0]; 14264 14265 if (!target || !$(target).hasClass(ClassName$2.CAROUSEL)) { 14266 return; 14267 } 14268 14269 var config = _objectSpread({}, $(target).data(), $(this).data()); 14270 14271 var slideIndex = this.getAttribute('data-slide-to'); 14272 14273 if (slideIndex) { 14274 config.interval = false; 14275 } 14276 14277 Carousel._jQueryInterface.call($(target), config); 14278 14279 if (slideIndex) { 14280 $(target).data(DATA_KEY$2).to(slideIndex); 14281 } 14282 14283 event.preventDefault(); 14284 }; 14285 14286 _createClass(Carousel, null, [{ 14287 key: "VERSION", 14288 get: function get() { 14289 return VERSION$2; 14290 } 14291 }, { 14292 key: "Default", 14293 get: function get() { 14294 return Default; 14295 } 14296 }]); 14297 14298 return Carousel; 14299 }(); 14300 /** 14301 * ------------------------------------------------------------------------ 14302 * Data Api implementation 14303 * ------------------------------------------------------------------------ 14304 */ 14305 14306 14307 $(document).on(Event$2.CLICK_DATA_API, Selector$2.DATA_SLIDE, Carousel._dataApiClickHandler); 14308 $(window).on(Event$2.LOAD_DATA_API, function () { 14309 var carousels = [].slice.call(document.querySelectorAll(Selector$2.DATA_RIDE)); 14310 14311 for (var i = 0, len = carousels.length; i < len; i++) {
14312 var $carousel = $(carousels[i]); 14313 14314 Carousel._jQueryInterface.call($carousel, $carousel.data()); 14315 } 14316 }); 14317 /** 14318 * ------------------------------------------------------------------------ 14319 * jQuery 14320 * ------------------------------------------------------------------------ 14321 */ 14322 14323 $.fn[NAME$2] = Carousel._jQueryInterface; 14324 $.fn[NAME$2].Constructor = Carousel; 14325 14326 $.fn[NAME$2].noConflict = function () { 14327 $.fn[NAME$2] = JQUERY_NO_CONFLICT$2; 14328 return Carousel._jQueryInterface; 14329 }; 14330 14331 /** 14332 * ------------------------------------------------------------------------ 14333 * Constants 14334 * ------------------------------------------------------------------------ 14335 */ 14336 14337 var NAME$3 = 'collapse'; 14338 var VERSION$3 = '4.3.1'; 14339 var DATA_KEY$3 = 'bs.collapse'; 14340 var EVENT_KEY$3 = "." + DATA_KEY$3; 14341 var DATA_API_KEY$3 = '.data-api'; 14342 var JQUERY_NO_CONFLICT$3 = $.fn[NAME$3]; 14343 var Default$1 = { 14344 toggle: true, 14345 parent: '' 14346 }; 14347 var DefaultType$1 = { 14348 toggle: 'boolean', 14349 parent: '(string|element)' 14350 }; 14351 var Event$3 = { 14352 SHOW: "show" + EVENT_KEY$3, 14353 SHOWN: "shown" + EVENT_KEY$3, 14354 HIDE: "hide" + EVENT_KEY$3, 14355 HIDDEN: "hidden" + EVENT_KEY$3, 14356 CLICK_DATA_API: "click" + EVENT_KEY$3 + DATA_API_KEY$3 14357 }; 14358 var ClassName$3 = { 14359 SHOW: 'show', 14360 COLLAPSE: 'collapse', 14361 COLLAPSING: 'collapsing', 14362 COLLAPSED: 'collapsed' 14363 }; 14364 var Dimension = { 14365 WIDTH: 'width', 14366 HEIGHT: 'height' 14367 }; 14368 var Selector$3 = { 14369 ACTIVES: '.show, .collapsing', 14370 DATA_TOGGLE: '[data-toggle="collapse"]' 14371 /** 14372 * ------------------------------------------------------------------------ 14373 * Class Definition 14374 * ------------------------------------------------------------------------ 14375 */ 14376 14377 }; 14378 14379 var Collapse = 14380 /*#__PURE__*/ 14381 function () { 14382 function Collapse(element, config) { 14383 this._isTransitioning = false; 14384 this._element = element; 14385 this._config = this._getConfig(config); 14386 this._triggerArray = [].slice.call(document.querySelectorAll("[data-toggle=\"collapse\"][href=\"#" + element.id + "\"]," + ("[data-toggle=\"collapse\"][data-target=\"#" + element.id + "\"]"))); 14387 var toggleList = [].slice.call(document.querySelectorAll(Selector$3.DATA_TOGGLE)); 14388 14389 for (var i = 0, len = toggleList.length; i < len; i++) { 14390 var elem = toggleList[i]; 14391 var selector = Util.getSelectorFromElement(elem); 14392 var filterElement = [].slice.call(document.querySelectorAll(selector)).filter(function (foundElem) { 14393 return foundElem === element; 14394 }); 14395 14396 if (selector !== null && filterElement.length > 0) { 14397 this._selector = selector; 14398 14399 this._triggerArray.push(elem); 14400 } 14401 } 14402 14403 this._parent = this._config.parent ? this._getParent() : null; 14404 14405 if (!this._config.parent) { 14406 this._addAriaAndCollapsedClass(this._element, this._triggerArray); 14407 } 14408 14409 if (this._config.toggle) { 14410 this.toggle(); 14411 } 14412 } // Getters 14413 14414 14415 var _proto = Collapse.prototype; 14416 14417 // Public 14418 _proto.toggle = function toggle() { 14419 if ($(this._element).hasClass(ClassName$3.SHOW)) { 14420 this.hide(); 14421 } else { 14422 this.show(); 14423 } 14424 }; 14425 14426 _proto.show = function show() { 14427 var _this = this; 14428 14429 if (this._isTransitioning || $(this._element).hasClass(ClassName$3.SHOW)) { 14430 return; 14431 } 14432 14433 var actives; 14434 var activesData; 14435 14436 if (this._parent) { 14437 actives = [].slice.call(this._parent.querySelectorAll(Selector$3.ACTIVES)).filter(function (elem) { 14438 if (typeof _this._config.parent === 'string') { 14439 return elem.getAttribute('data-parent') === _this._config.parent; 14440 } 14441 14442 return elem.classList.contains(ClassName$3.COLLAPSE); 14443 }); 14444 14445 if (actives.length === 0) { 14446 actives = null; 14447 } 14448 } 14449 14450 if (actives) { 14451 activesData = $(actives).not(this._selector).data(DATA_KEY$3); 14452 14453 if (activesData && activesData._isTransitioning) { 14454 return; 14455 } 14456 } 14457 14458 var startEvent = $.Event(Event$3.SHOW); 14459 $(this._element).trigger(startEvent); 14460 14461 if (startEvent.isDefaultPrevented()) { 14462 return; 14463 } 14464 14465 if (actives) { 14466 Collapse._jQueryInterface.call($(actives).not(this._selector), 'hide'); 14467 14468 if (!activesData) { 14469 $(actives).data(DATA_KEY$3, null); 14470 } 14471 } 14472 14473 var dimension = this._getDimension(); 14474 14475 $(this._element).removeClass(ClassName$3.COLLAPSE).addClass(ClassName$3.COLLAPSING); 14476 this._element.style[dimension] = 0; 14477 14478 if (this._triggerArray.length) { 14479 $(this._triggerArray).removeClass(ClassName$3.COLLAPSED).attr('aria-expanded', true); 14480 } 14481 14482 this.setTransitioning(true); 14483 14484 var complete = function complete() { 14485 $(_this._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).addClass(ClassName$3.SHOW); 14486 _this._element.style[dimension] = ''; 14487 14488 _this.setTransitioning(false); 14489 14490 $(_this._element).trigger(Event$3.SHOWN); 14491 }; 14492 14493 var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 14494 var scrollSize = "scroll" + capitalizedDimension; 14495 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 14496 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 14497 this._element.style[dimension] = this._element[scrollSize] + "px"; 14498 }; 14499 14500 _proto.hide = function hide() { 14501 var _this2 = this; 14502 14503 if (this._isTransitioning || !$(this._element).hasClass(ClassName$3.SHOW)) { 14504 return; 14505 } 14506 14507 var startEvent = $.Event(Event$3.HIDE); 14508 $(this._element).trigger(startEvent); 14509 14510 if (startEvent.isDefaultPrevented()) { 14511 return; 14512 } 14513 14514 var dimension = this._getDimension(); 14515 14516 this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; 14517 Util.reflow(this._element); 14518 $(this._element).addClass(ClassName$3.COLLAPSING).removeClass(ClassName$3.COLLAPSE).removeClass(ClassName$3.SHOW); 14519 var triggerArrayLength = this._triggerArray.length; 14520 14521 if (triggerArrayLength > 0) { 14522 for (var i = 0; i < triggerArrayLength; i++) { 14523 var trigger = this._triggerArray[i]; 14524 var selector = Util.getSelectorFromElement(trigger); 14525 14526 if (selector !== null) { 14527 var $elem = $([].slice.call(document.querySelectorAll(selector))); 14528 14529 if (!$elem.hasClass(ClassName$3.SHOW)) { 14530 $(trigger).addClass(ClassName$3.COLLAPSED).attr('aria-expanded', false); 14531 } 14532 } 14533 } 14534 } 14535 14536 this.setTransitioning(true); 14537 14538 var complete = function complete() { 14539 _this2.setTransitioning(false); 14540 14541 $(_this2._element).removeClass(ClassName$3.COLLAPSING).addClass(ClassName$3.COLLAPSE).trigger(Event$3.HIDDEN); 14542 }; 14543 14544 this._element.style[dimension] = ''; 14545 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 14546 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 14547 }; 14548 14549 _proto.setTransitioning = function setTransitioning(isTransitioning) { 14550 this._isTransitioning = isTransitioning; 14551 }; 14552 14553 _proto.dispose = function dispose() { 14554 $.removeData(this._element, DATA_KEY$3); 14555 this._config = null; 14556 this._parent = null; 14557 this._element = null; 14558 this._triggerArray = null; 14559 this._isTransitioning = null; 14560 } // Private 14561 ; 14562 14563 _proto._getConfig = function _getConfig(config) { 14564 config = _objectSpread({}, Default$1, config); 14565 config.toggle = Boolean(config.toggle); // Coerce string values 14566 14567 Util.typeCheckConfig(NAME$3, config, DefaultType$1); 14568 return config; 14569 }; 14570 14571 _proto._getDimension = function _getDimension() { 14572 var hasWidth = $(this._element).hasClass(Dimension.WIDTH); 14573 return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT; 14574 }; 14575 14576 _proto._getParent = function _getParent() { 14577 var _this3 = this; 14578 14579 var parent; 14580 14581 if (Util.isElement(this._config.parent)) { 14582 parent = this._config.parent; // It's a jQuery object 14583 14584 if (typeof this._config.parent.jquery !== 'undefined') { 14585 parent = this._config.parent[0]; 14586 } 14587 } else { 14588 parent = document.querySelector(this._config.parent); 14589 } 14590 14591 var selector = "[data-toggle=\"collapse\"][data-parent=\"" + this._config.parent + "\"]"; 14592 var children = [].slice.call(parent.querySelectorAll(selector)); 14593 $(children).each(function (i, element) { 14594 _this3._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); 14595 }); 14596 return parent; 14597 }; 14598 14599 _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { 14600 var isOpen = $(element).hasClass(ClassName$3.SHOW); 14601 14602 if (triggerArray.length) { 14603 $(triggerArray).toggleClass(ClassName$3.COLLAPSED, !isOpen).attr('aria-expanded', isOpen); 14604 } 14605 } // Static 14606 ; 14607 14608 Collapse._getTargetFromElement = function _getTargetFromElement(element) { 14609 var selector = Util.getSelectorFromElement(element); 14610 return selector ? document.querySelector(selector) : null; 14611 }; 14612 14613 Collapse._jQueryInterface = function _jQueryInterface(config) { 14614 return this.each(function () { 14615 var $this = $(this); 14616 var data = $this.data(DATA_KEY$3); 14617 14618 var _config = _objectSpread({}, Default$1, $this.data(), typeof config === 'object' && config ? config : {}); 14619 14620 if (!data && _config.toggle && /show|hide/.test(config)) { 14621 _config.toggle = false;
14622 } 14623 14624 if (!data) { 14625 data = new Collapse(this, _config); 14626 $this.data(DATA_KEY$3, data); 14627 } 14628 14629 if (typeof config === 'string') { 14630 if (typeof data[config] === 'undefined') { 14631 throw new TypeError("No method named \"" + config + "\""); 14632 } 14633 14634 data[config](); 14635 } 14636 }); 14637 }; 14638 14639 _createClass(Collapse, null, [{ 14640 key: "VERSION", 14641 get: function get() { 14642 return VERSION$3; 14643 } 14644 }, { 14645 key: "Default", 14646 get: function get() { 14647 return Default$1; 14648 } 14649 }]); 14650 14651 return Collapse; 14652 }(); 14653 /** 14654 * ------------------------------------------------------------------------ 14655 * Data Api implementation 14656 * ------------------------------------------------------------------------ 14657 */ 14658 14659 14660 $(document).on(Event$3.CLICK_DATA_API, Selector$3.DATA_TOGGLE, function (event) { 14661 // preventDefault only for <a> elements (which change the URL) not inside the collapsible element 14662 if (event.currentTarget.tagName === 'A') { 14663 event.preventDefault(); 14664 } 14665 14666 var $trigger = $(this); 14667 var selector = Util.getSelectorFromElement(this); 14668 var selectors = [].slice.call(document.querySelectorAll(selector)); 14669 $(selectors).each(function () { 14670 var $target = $(this); 14671 var data = $target.data(DATA_KEY$3); 14672 var config = data ? 'toggle' : $trigger.data(); 14673 14674 Collapse._jQueryInterface.call($target, config); 14675 }); 14676 }); 14677 /** 14678 * ------------------------------------------------------------------------ 14679 * jQuery 14680 * ------------------------------------------------------------------------ 14681 */ 14682 14683 $.fn[NAME$3] = Collapse._jQueryInterface; 14684 $.fn[NAME$3].Constructor = Collapse; 14685 14686 $.fn[NAME$3].noConflict = function () { 14687 $.fn[NAME$3] = JQUERY_NO_CONFLICT$3; 14688 return Collapse._jQueryInterface; 14689 }; 14690 14691 /** 14692 * ------------------------------------------------------------------------ 14693 * Constants 14694 * ------------------------------------------------------------------------ 14695 */ 14696 14697 var NAME$4 = 'dropdown'; 14698 var VERSION$4 = '4.3.1'; 14699 var DATA_KEY$4 = 'bs.dropdown'; 14700 var EVENT_KEY$4 = "." + DATA_KEY$4; 14701 var DATA_API_KEY$4 = '.data-api'; 14702 var JQUERY_NO_CONFLICT$4 = $.fn[NAME$4]; 14703 var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key 14704 14705 var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key 14706 14707 var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key 14708 14709 var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key 14710 14711 var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key 14712 14713 var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse) 14714 14715 var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + "|" + ARROW_DOWN_KEYCODE + "|" + ESCAPE_KEYCODE); 14716 var Event$4 = { 14717 HIDE: "hide" + EVENT_KEY$4, 14718 HIDDEN: "hidden" + EVENT_KEY$4, 14719 SHOW: "show" + EVENT_KEY$4, 14720 SHOWN: "shown" + EVENT_KEY$4, 14721 CLICK: "click" + EVENT_KEY$4, 14722 CLICK_DATA_API: "click" + EVENT_KEY$4 + DATA_API_KEY$4, 14723 KEYDOWN_DATA_API: "keydown" + EVENT_KEY$4 + DATA_API_KEY$4, 14724 KEYUP_DATA_API: "keyup" + EVENT_KEY$4 + DATA_API_KEY$4 14725 }; 14726 var ClassName$4 = { 14727 DISABLED: 'disabled', 14728 SHOW: 'show', 14729 DROPUP: 'dropup', 14730 DROPRIGHT: 'dropright', 14731 DROPLEFT: 'dropleft', 14732 MENURIGHT: 'dropdown-menu-right', 14733 MENULEFT: 'dropdown-menu-left', 14734 POSITION_STATIC: 'position-static' 14735 }; 14736 var Selector$4 = { 14737 DATA_TOGGLE: '[data-toggle="dropdown"]', 14738 FORM_CHILD: '.dropdown form', 14739 MENU: '.dropdown-menu', 14740 NAVBAR_NAV: '.navbar-nav', 14741 VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)' 14742 }; 14743 var AttachmentMap = { 14744 TOP: 'top-start', 14745 TOPEND: 'top-end', 14746 BOTTOM: 'bottom-start', 14747 BOTTOMEND: 'bottom-end', 14748 RIGHT: 'right-start', 14749 RIGHTEND: 'right-end', 14750 LEFT: 'left-start', 14751 LEFTEND: 'left-end' 14752 }; 14753 var Default$2 = { 14754 offset: 0, 14755 flip: true, 14756 boundary: 'scrollParent', 14757 reference: 'toggle', 14758 display: 'dynamic' 14759 }; 14760 var DefaultType$2 = { 14761 offset: '(number|string|function)', 14762 flip: 'boolean', 14763 boundary: '(string|element)', 14764 reference: '(string|element)', 14765 display: 'string' 14766 /** 14767 * ------------------------------------------------------------------------ 14768 * Class Definition 14769 * ------------------------------------------------------------------------ 14770 */ 14771 14772 }; 14773 14774 var Dropdown = 14775 /*#__PURE__*/ 14776 function () { 14777 function Dropdown(element, config) { 14778 this._element = element; 14779 this._popper = null; 14780 this._config = this._getConfig(config); 14781 this._menu = this._getMenuElement(); 14782 this._inNavbar = this._detectNavbar(); 14783 14784 this._addEventListeners(); 14785 } // Getters 14786 14787 14788 var _proto = Dropdown.prototype; 14789 14790 // Public
14791 _proto.toggle = function toggle() { 14792 if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED)) { 14793 return; 14794 } 14795 14796 var parent = Dropdown._getParentFromElement(this._element); 14797 14798 var isActive = $(this._menu).hasClass(ClassName$4.SHOW); 14799 14800 Dropdown._clearMenus(); 14801 14802 if (isActive) { 14803 return; 14804 } 14805 14806 var relatedTarget = { 14807 relatedTarget: this._element 14808 }; 14809 var showEvent = $.Event(Event$4.SHOW, relatedTarget); 14810 $(parent).trigger(showEvent); 14811 14812 if (showEvent.isDefaultPrevented()) { 14813 return; 14814 } // Disable totally Popper.js for Dropdown in Navbar 14815 14816 14817 if (!this._inNavbar) { 14818 /** 14819 * Check for Popper dependency 14820 * Popper - https://popper.js.org 14821 */ 14822 if (typeof Popper === 'undefined') { 14823 throw new TypeError('Bootstrap\'s dropdowns require Popper.js (https://popper.js.org/)'); 14824 } 14825 14826 var referenceElement = this._element; 14827 14828 if (this._config.reference === 'parent') { 14829 referenceElement = parent; 14830 } else if (Util.isElement(this._config.reference)) { 14831 referenceElement = this._config.reference; // Check if it's jQuery element 14832 14833 if (typeof this._config.reference.jquery !== 'undefined') { 14834 referenceElement = this._config.reference[0]; 14835 } 14836 } // If boundary is not `scrollParent`, then set position to `static` 14837 // to allow the menu to "escape" the scroll parent's boundaries 14838 // https://github.com/twbs/bootstrap/issues/24251 14839 14840 14841 if (this._config.boundary !== 'scrollParent') { 14842 $(parent).addClass(ClassName$4.POSITION_STATIC); 14843 } 14844 14845 this._popper = new Popper(referenceElement, this._menu, this._getPopperConfig()); 14846 } // If this is a touch-enabled device we add extra 14847 // empty mouseover listeners to the body's immediate children; 14848 // only needed because of broken event delegation on iOS 14849 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 14850 14851 14852 if ('ontouchstart' in document.documentElement && $(parent).closest(Selector$4.NAVBAR_NAV).length === 0) { 14853 $(document.body).children().on('mouseover', null, $.noop); 14854 } 14855 14856 this._element.focus(); 14857 14858 this._element.setAttribute('aria-expanded', true); 14859 14860 $(this._menu).toggleClass(ClassName$4.SHOW); 14861 $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget)); 14862 }; 14863 14864 _proto.show = function show() { 14865 if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || $(this._menu).hasClass(ClassName$4.SHOW)) { 14866 return; 14867 } 14868 14869 var relatedTarget = { 14870 relatedTarget: this._element 14871 }; 14872 var showEvent = $.Event(Event$4.SHOW, relatedTarget); 14873 14874 var parent = Dropdown._getParentFromElement(this._element); 14875 14876 $(parent).trigger(showEvent); 14877 14878 if (showEvent.isDefaultPrevented()) { 14879 return; 14880 } 14881 14882 $(this._menu).toggleClass(ClassName$4.SHOW); 14883 $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.SHOWN, relatedTarget)); 14884 }; 14885 14886 _proto.hide = function hide() { 14887 if (this._element.disabled || $(this._element).hasClass(ClassName$4.DISABLED) || !$(this._menu).hasClass(ClassName$4.SHOW)) { 14888 return; 14889 } 14890 14891 var relatedTarget = { 14892 relatedTarget: this._element 14893 }; 14894 var hideEvent = $.Event(Event$4.HIDE, relatedTarget); 14895 14896 var parent = Dropdown._getParentFromElement(this._element); 14897 14898 $(parent).trigger(hideEvent); 14899 14900 if (hideEvent.isDefaultPrevented()) { 14901 return; 14902 } 14903 14904 $(this._menu).toggleClass(ClassName$4.SHOW); 14905 $(parent).toggleClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget)); 14906 }; 14907 14908 _proto.dispose = function dispose() { 14909 $.removeData(this._element, DATA_KEY$4); 14910 $(this._element).off(EVENT_KEY$4); 14911 this._element = null; 14912 this._menu = null; 14913 14914 if (this._popper !== null) { 14915 this._popper.destroy(); 14916 14917 this._popper = null; 14918 } 14919 }; 14920
14921 _proto.update = function update() { 14922 this._inNavbar = this._detectNavbar(); 14923 14924 if (this._popper !== null) { 14925 this._popper.scheduleUpdate(); 14926 } 14927 } // Private 14928 ; 14929 14930 _proto._addEventListeners = function _addEventListeners() { 14931 var _this = this; 14932 14933 $(this._element).on(Event$4.CLICK, function (event) { 14934 event.preventDefault(); 14935 event.stopPropagation(); 14936 14937 _this.toggle(); 14938 }); 14939 }; 14940 14941 _proto._getConfig = function _getConfig(config) { 14942 config = _objectSpread({}, this.constructor.Default, $(this._element).data(), config); 14943 Util.typeCheckConfig(NAME$4, config, this.constructor.DefaultType); 14944 return config; 14945 }; 14946 14947 _proto._getMenuElement = function _getMenuElement() { 14948 if (!this._menu) { 14949 var parent = Dropdown._getParentFromElement(this._element); 14950 14951 if (parent) { 14952 this._menu = parent.querySelector(Selector$4.MENU); 14953 } 14954 } 14955 14956 return this._menu; 14957 }; 14958 14959 _proto._getPlacement = function _getPlacement() { 14960 var $parentDropdown = $(this._element.parentNode); 14961 var placement = AttachmentMap.BOTTOM; // Handle dropup 14962 14963 if ($parentDropdown.hasClass(ClassName$4.DROPUP)) { 14964 placement = AttachmentMap.TOP; 14965 14966 if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) { 14967 placement = AttachmentMap.TOPEND; 14968 } 14969 } else if ($parentDropdown.hasClass(ClassName$4.DROPRIGHT)) { 14970 placement = AttachmentMap.RIGHT; 14971 } else if ($parentDropdown.hasClass(ClassName$4.DROPLEFT)) { 14972 placement = AttachmentMap.LEFT; 14973 } else if ($(this._menu).hasClass(ClassName$4.MENURIGHT)) { 14974 placement = AttachmentMap.BOTTOMEND; 14975 } 14976 14977 return placement; 14978 }; 14979 14980 _proto._detectNavbar = function _detectNavbar() { 14981 return $(this._element).closest('.navbar').length > 0; 14982 }; 14983 14984 _proto._getOffset = function _getOffset() { 14985 var _this2 = this; 14986 14987 var offset = {}; 14988 14989 if (typeof this._config.offset === 'function') { 14990 offset.fn = function (data) { 14991 data.offsets = _objectSpread({}, data.offsets, _this2._config.offset(data.offsets, _this2._element) || {}); 14992 return data; 14993 }; 14994 } else { 14995 offset.offset = this._config.offset; 14996 } 14997 14998 return offset; 14999 }; 15000 15001 _proto._getPopperConfig = function _getPopperConfig() { 15002 var popperConfig = { 15003 placement: this._getPlacement(), 15004 modifiers: { 15005 offset: this._getOffset(), 15006 flip: { 15007 enabled: this._config.flip 15008 }, 15009 preventOverflow: { 15010 boundariesElement: this._config.boundary 15011 } 15012 } // Disable Popper.js if we have a static display 15013 15014 }; 15015 15016 if (this._config.display === 'static') { 15017 popperConfig.modifiers.applyStyle = { 15018 enabled: false 15019 }; 15020 } 15021 15022 return popperConfig; 15023 } // Static 15024 ; 15025 15026 Dropdown._jQueryInterface = function _jQueryInterface(config) { 15027 return this.each(function () { 15028 var data = $(this).data(DATA_KEY$4); 15029 15030 var _config = typeof config === 'object' ? config : null; 15031 15032 if (!data) { 15033 data = new Dropdown(this, _config); 15034 $(this).data(DATA_KEY$4, data); 15035 } 15036 15037 if (typeof config === 'string') { 15038 if (typeof data[config] === 'undefined') { 15039 throw new TypeError("No method named \"" + config + "\""); 15040 } 15041 15042 data[config](); 15043 } 15044 }); 15045 }; 15046 15047 Dropdown._clearMenus = function _clearMenus(event) { 15048 if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) { 15049 return; 15050 } 15051 15052 var toggles = [].slice.call(document.querySelectorAll(Selector$4.DATA_TOGGLE)); 15053 15054 for (var i = 0, len = toggles.length; i < len; i++) { 15055 var parent = Dropdown._getParentFromElement(toggles[i]); 15056 15057 var context = $(toggles[i]).data(DATA_KEY$4); 15058 var relatedTarget = { 15059 relatedTarget: toggles[i] 15060 }; 15061 15062 if (event && event.type === 'click') { 15063 relatedTarget.clickEvent = event; 15064 } 15065 15066 if (!context) { 15067 continue; 15068 } 15069 15070 var dropdownMenu = context._menu; 15071 15072 if (!$(parent).hasClass(ClassName$4.SHOW)) { 15073 continue; 15074 } 15075 15076 if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) { 15077 continue; 15078 } 15079 15080 var hideEvent = $.Event(Event$4.HIDE, relatedTarget); 15081 $(parent).trigger(hideEvent); 15082 15083 if (hideEvent.isDefaultPrevented()) { 15084 continue; 15085 } // If this is a touch-enabled device we remove the extra 15086 // empty mouseover listeners we added for iOS support 15087 15088 15089 if ('ontouchstart' in document.documentElement) { 15090 $(document.body).children().off('mouseover', null, $.noop); 15091 } 15092 15093 toggles[i].setAttribute('aria-expanded', 'false'); 15094 $(dropdownMenu).removeClass(ClassName$4.SHOW); 15095 $(parent).removeClass(ClassName$4.SHOW).trigger($.Event(Event$4.HIDDEN, relatedTarget)); 15096 } 15097 }; 15098 15099 Dropdown._getParentFromElement = function _getParentFromElement(element) { 15100 var parent; 15101 var selector = Util.getSelectorFromElement(element); 15102 15103 if (selector) { 15104 parent = document.querySelector(selector); 15105 } 15106 15107 return parent || element.parentNode; 15108 } // eslint-disable-next-line complexity 15109 ; 15110 15111 Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { 15112 // If not input/textarea: 15113 // - And not a key in REGEXP_KEYDOWN => not a dropdown command 15114 // If input/textarea: 15115 // - If space key => not a dropdown command 15116 // - If key is other than escape 15117 // - If key is not up or down => not a dropdown command 15118 // - If trigger inside the menu =>
15118 not a dropdown command 15119 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)) { 15120 return; 15121 } 15122 15123 event.preventDefault(); 15124 event.stopPropagation(); 15125 15126 if (this.disabled || $(this).hasClass(ClassName$4.DISABLED)) { 15127 return; 15128 } 15129 15130 var parent = Dropdown._getParentFromElement(this); 15131 15132 var isActive = $(parent).hasClass(ClassName$4.SHOW); 15133 15134 if (!isActive || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { 15135 if (event.which === ESCAPE_KEYCODE) { 15136 var toggle = parent.querySelector(Selector$4.DATA_TOGGLE); 15137 $(toggle).trigger('focus'); 15138 } 15139 15140 $(this).trigger('click'); 15141 return; 15142 } 15143 15144 var items = [].slice.call(parent.querySelectorAll(Selector$4.VISIBLE_ITEMS)); 15145 15146 if (items.length === 0) { 15147 return; 15148 } 15149 15150 var index = items.indexOf(event.target); 15151 15152 if (event.which === ARROW_UP_KEYCODE && index > 0) { 15153 // Up 15154 index--; 15155 } 15156 15157 if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { 15158 // Down 15159 index++; 15160 } 15161 15162 if (index < 0) { 15163 index = 0; 15164 } 15165 15166 items[index].focus(); 15167 }; 15168 15169 _createClass(Dropdown, null, [{ 15170 key: "VERSION", 15171 get: function get() { 15172 return VERSION$4; 15173 } 15174 }, { 15175 key: "Default", 15176 get: function get() { 15177 return Default$2; 15178 } 15179 }, { 15180 key: "DefaultType", 15181 get: function get() { 15182 return DefaultType$2; 15183 } 15184 }]); 15185 15186 return Dropdown; 15187 }(); 15188 /** 15189 * ------------------------------------------------------------------------ 15190 * Data Api implementation 15191 * ------------------------------------------------------------------------ 15192 */ 15193 15194 15195 $(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) { 15196 event.preventDefault(); 15197 event.stopPropagation(); 15198 15199 Dropdown._jQueryInterface.call($(this), 'toggle'); 15200 }).on(Event$4.CLICK_DATA_API, Selector$4.FORM_CHILD, function (e) { 15201 e.stopPropagation(); 15202 }); 15203 /** 15204 * ------------------------------------------------------------------------ 15205 * jQuery 15206 * ------------------------------------------------------------------------ 15207 */ 15208 15209 $.fn[NAME$4] = Dropdown._jQueryInterface; 15210 $.fn[NAME$4].Constructor = Dropdown; 15211 15212 $.fn[NAME$4].noConflict = function () { 15213 $.fn[NAME$4] = JQUERY_NO_CONFLICT$4; 15214 return Dropdown._jQueryInterface; 15215 }; 15216 15217 /** 15218 * ------------------------------------------------------------------------ 15219 * Constants 15220 * ------------------------------------------------------------------------ 15221 */ 15222 15223 var NAME$5 = 'modal'; 15224 var VERSION$5 = '4.3.1'; 15225 var DATA_KEY$5 = 'bs.modal'; 15226 var EVENT_KEY$5 = "." + DATA_KEY$5; 15227 var DATA_API_KEY$5 = '.data-api'; 15228 var JQUERY_NO_CONFLICT$5 = $.fn[NAME$5]; 15229 var ESCAPE_KEYCODE$1 = 27; // KeyboardEvent.which value for Escape (Esc) key 15230 15231 var Default$3 = { 15232 backdrop: true, 15233 keyboard: true, 15234 focus: true, 15235 show: true 15236 }; 15237 var DefaultType$3 = { 15238 backdrop: '(boolean|string)', 15239 keyboard: 'boolean', 15240 focus: 'boolean', 15241 show: 'boolean' 15242 }; 15243 var Event$5 = { 15244 HIDE: "hide" + EVENT_KEY$5, 15245 HIDDEN: "hidden" + EVENT_KEY$5, 15246 SHOW: "show" + EVENT_KEY$5, 15247 SHOWN: "shown" + EVENT_KEY$5, 15248 FOCUSIN: "focusin" + EVENT_KEY$5, 15249 RESIZE: "resize" + EVENT_KEY$5, 15250 CLICK_DISMISS: "click.dismiss" + EVENT_KEY$5, 15251 KEYDOWN_DISMISS: "keydown.dismiss" + EVENT_KEY$5, 15252 MOUSEUP_DISMISS: "mouseup.dismiss" + EVENT_KEY$5, 15253 MOUSEDOWN_DISMISS: "mousedown.dismiss" + EVENT_KEY$5, 15254 CLICK_DATA_API: "click" + EVENT_KEY$5 + DATA_API_KEY$5 15255 }; 15256 var ClassName$5 = {
15257 SCROLLABLE: 'modal-dialog-scrollable', 15258 SCROLLBAR_MEASURER: 'modal-scrollbar-measure', 15259 BACKDROP: 'modal-backdrop', 15260 OPEN: 'modal-open', 15261 FADE: 'fade', 15262 SHOW: 'show' 15263 }; 15264 var Selector$5 = { 15265 DIALOG: '.modal-dialog', 15266 MODAL_BODY: '.modal-body', 15267 DATA_TOGGLE: '[data-toggle="modal"]', 15268 DATA_DISMISS: '[data-dismiss="modal"]', 15269 FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top', 15270 STICKY_CONTENT: '.sticky-top' 15271 /** 15272 * ------------------------------------------------------------------------ 15273 * Class Definition 15274 * ------------------------------------------------------------------------ 15275 */ 15276 15277 }; 15278 15279 var Modal = 15280 /*#__PURE__*/ 15281 function () { 15282 function Modal(element, config) { 15283 this._config = this._getConfig(config); 15284 this._element = element; 15285 this._dialog = element.querySelector(Selector$5.DIALOG); 15286 this._backdrop = null; 15287 this._isShown = false; 15288 this._isBodyOverflowing = false; 15289 this._ignoreBackdropClick = false; 15290 this._isTransitioning = false; 15291 this._scrollbarWidth = 0; 15292 } // Getters 15293 15294 15295 var _proto = Modal.prototype; 15296 15297 // Public 15298 _proto.toggle = function toggle(relatedTarget) { 15299 return this._isShown ? this.hide() : this.show(relatedTarget); 15300 }; 15301 15302 _proto.show = function show(relatedTarget) { 15303 var _this = this; 15304 15305 if (this._isShown || this._isTransitioning) { 15306 return; 15307 } 15308 15309 if ($(this._element).hasClass(ClassName$5.FADE)) { 15310 this._isTransitioning = true; 15311 } 15312 15313 var showEvent = $.Event(Event$5.SHOW, { 15314 relatedTarget: relatedTarget 15315 }); 15316 $(this._element).trigger(showEvent); 15317 15318 if (this._isShown || showEvent.isDefaultPrevented()) { 15319 return; 15320 } 15321 15322 this._isShown = true; 15323 15324 this._checkScrollbar(); 15325 15326 this._setScrollbar(); 15327 15328 this._adjustDialog(); 15329 15330 this._setEscapeEvent(); 15331 15332 this._setResizeEvent(); 15333 15334 $(this._element).on(Event$5.CLICK_DISMISS, Selector$5.DATA_DISMISS, function (event) { 15335 return _this.hide(event); 15336 }); 15337 $(this._dialog).on(Event$5.MOUSEDOWN_DISMISS, function () { 15338 $(_this._element).one(Event$5.MOUSEUP_DISMISS, function (event) { 15339 if ($(event.target).is(_this._element)) { 15340 _this._ignoreBackdropClick = true; 15341 } 15342 }); 15343 }); 15344 15345 this._showBackdrop(function () { 15346 return _this._showElement(relatedTarget); 15347 }); 15348 }; 15349 15350 _proto.hide = function hide(event) { 15351 var _this2 = this; 15352 15353 if (event) { 15354 event.preventDefault(); 15355 } 15356 15357 if (!this._isShown || this._isTransitioning) { 15358 return; 15359 } 15360 15361 var hideEvent = $.Event(Event$5.HIDE); 15362 $(this._element).trigger(hideEvent); 15363 15364 if (!this._isShown || hideEvent.isDefaultPrevented()) { 15365 return; 15366 } 15367 15368 this._isShown = false; 15369 var transition = $(this._element).hasClass(ClassName$5.FADE); 15370 15371 if (transition) { 15372 this._isTransitioning = true; 15373 } 15374 15375 this._setEscapeEvent(); 15376 15377 this._setResizeEvent(); 15378 15379 $(document).off(Event$5.FOCUSIN); 15380 $(this._element).removeClass(ClassName$5.SHOW); 15381 $(this._element).off(Event$5.CLICK_DISMISS); 15382 $(this._dialog).off(Event$5.MOUSEDOWN_DISMISS); 15383 15384 if (transition) { 15385 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 15386 $(this._element).one(Util.TRANSITION_END, function (event) { 15387 return _this2._hideModal(event); 15388 }).emulateTransitionEnd(transitionDuration); 15389 } else { 15390 this._hideModal(); 15391 } 15392 }; 15393 15394 _proto.dispose = function dispose() { 15395 [window, this._element, this._dialog].forEach(function (htmlElement) { 15396 return $(htmlElement).off(EVENT_KEY$5); 15397 }); 15398 /** 15399 * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API` 15400 * Do not move `document` in `htmlElements` array 15401 * It will remove `Event.CLICK_DATA_API` event that should remain 15402 */ 15403 15404 $(document).off(Event$5.FOCUSIN); 15405 $.removeData(this._element, DATA_KEY$5); 15406 this._config = null; 15407 this._element = null; 15408 this._dialog = null; 15409 this._backdrop = null; 15410 this._isShown = null; 15411 this._isBodyOverflowing = null; 15412 this._ignoreBackdropClick = null; 15413 this._isTransitioning = null; 15414 this._scrollbarWidth = null; 15415 }; 15416 15417 _proto.handleUpdate = function handleUpdate() { 15418 this._adjustDialog(); 15419 } // Private 15420 ; 15421 15422 _proto._getConfig = function _getConfig(config) { 15423 config = _objectSpread({}, Default$3, config); 15424 Util.typeCheckConfig(NAME$5, config, DefaultType$3); 15425 return config; 15426 }; 15427 15428 _proto._showElement = function _showElement(relatedTarget) { 15429 var _this3 = this; 15430 15431 var transition = $(this._element).hasClass(ClassName$5.FADE); 15432 15433 if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { 15434 // Don't move modal's DOM position 15435 document.body.appendChild(this._element); 15436 } 15437 15438 this._element.style.display = 'block'; 15439 15440 this._element.removeAttribute('aria-hidden'); 15441 15442 this._element.setAttribute('aria-modal', true); 15443 15444 if ($(this._dialog).hasClass(ClassName$5.SCROLLABLE)) { 15445 this._dialog.querySelector(Selector$5.MODAL_BODY).scrollTop = 0; 15446 } else { 15447 this._element.scrollTop = 0; 15448 } 15449 15450 if (transition) { 15451 Util.reflow(this._element); 15452 } 15453 15454 $(this._element).addClass(ClassName$5.SHOW); 15455 15456 if (this._config.focus) { 15457 this._enforceFocus(); 15458 } 15459 15460 var shownEvent = $.Event(Event$5.SHOWN, { 15461 relatedTarget: relatedTarget 15462 }); 15463 15464 var transitionComplete = function transitionComplete() { 15465 if (_this3._config.focus) { 15466 _this3._element.focus(); 15467 } 15468 15469 _this3._isTransitioning = false;
15470 $(_this3._element).trigger(shownEvent); 15471 }; 15472 15473 if (transition) { 15474 var transitionDuration = Util.getTransitionDurationFromElement(this._dialog); 15475 $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration); 15476 } else { 15477 transitionComplete(); 15478 } 15479 }; 15480 15481 _proto._enforceFocus = function _enforceFocus() { 15482 var _this4 = this; 15483 15484 $(document).off(Event$5.FOCUSIN) // Guard against infinite focus loop 15485 .on(Event$5.FOCUSIN, function (event) { 15486 if (document !== event.target && _this4._element !== event.target && $(_this4._element).has(event.target).length === 0) { 15487 _this4._element.focus(); 15488 } 15489 }); 15490 }; 15491 15492 _proto._setEscapeEvent = function _setEscapeEvent() { 15493 var _this5 = this; 15494 15495 if (this._isShown && this._config.keyboard) { 15496 $(this._element).on(Event$5.KEYDOWN_DISMISS, function (event) { 15497 if (event.which === ESCAPE_KEYCODE$1) { 15498 event.preventDefault(); 15499 15500 _this5.hide(); 15501 } 15502 }); 15503 } else if (!this._isShown) { 15504 $(this._element).off(Event$5.KEYDOWN_DISMISS); 15505 } 15506 }; 15507 15508 _proto._setResizeEvent = function _setResizeEvent() { 15509 var _this6 = this; 15510 15511 if (this._isShown) { 15512 $(window).on(Event$5.RESIZE, function (event) { 15513 return _this6.handleUpdate(event); 15514 }); 15515 } else { 15516 $(window).off(Event$5.RESIZE); 15517 } 15518 }; 15519 15520 _proto._hideModal = function _hideModal() { 15521 var _this7 = this; 15522 15523 this._element.style.display = 'none'; 15524 15525 this._element.setAttribute('aria-hidden', true); 15526 15527 this._element.removeAttribute('aria-modal'); 15528 15529 this._isTransitioning = false; 15530 15531 this._showBackdrop(function () { 15532 $(document.body).removeClass(ClassName$5.OPEN); 15533 15534 _this7._resetAdjustments(); 15535 15536 _this7._resetScrollbar(); 15537 15538 $(_this7._element).trigger(Event$5.HIDDEN); 15539 }); 15540 }; 15541 15542 _proto._removeBackdrop = function _removeBackdrop() { 15543 if (this._backdrop) { 15544 $(this._backdrop).remove(); 15545 this._backdrop = null; 15546 } 15547 }; 15548 15549 _proto._showBackdrop = function _showBackdrop(callback) { 15550 var _this8 = this; 15551 15552 var animate = $(this._element).hasClass(ClassName$5.FADE) ? ClassName$5.FADE : ''; 15553 15554 if (this._isShown && this._config.backdrop) { 15555 this._backdrop = document.createElement('div'); 15556 this._backdrop.className = ClassName$5.BACKDROP; 15557 15558 if (animate) { 15559 this._backdrop.classList.add(animate); 15560 } 15561 15562 $(this._backdrop).appendTo(document.body); 15563 $(this._element).on(Event$5.CLICK_DISMISS, function (event) { 15564 if (_this8._ignoreBackdropClick) { 15565 _this8._ignoreBackdropClick = false; 15566 return; 15567 } 15568 15569 if (event.target !== event.currentTarget) { 15570 return; 15571 } 15572 15573 if (_this8._config.backdrop === 'static') { 15574 _this8._element.focus(); 15575 } else { 15576 _this8.hide(); 15577 } 15578 }); 15579 15580 if (animate) { 15581 Util.reflow(this._backdrop); 15582 } 15583 15584 $(this._backdrop).addClass(ClassName$5.SHOW); 15585 15586 if (!callback) { 15587 return; 15588 } 15589 15590 if (!animate) { 15591 callback(); 15592 return; 15593 } 15594 15595 var backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 15596 $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration); 15597 } else if (!this._isShown && this._backdrop) { 15598 $(this._backdrop).removeClass(ClassName$5.SHOW); 15599 15600 var callbackRemove = function callbackRemove() { 15601 _this8._removeBackdrop(); 15602 15603 if (callback) { 15604 callback(); 15605 } 15606 }; 15607 15608 if ($(this._element).hasClass(ClassName$5.FADE)) { 15609 var _backdropTransitionDuration = Util.getTransitionDurationFromElement(this._backdrop); 15610 15611 $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration); 15612 } else { 15613 callbackRemove(); 15614 } 15615 } else if (callback) { 15616 callback(); 15617 } 15618 } // ---------------------------------------------------------------------- 15619 // the following methods are used to handle overflowing modals 15620 // todo (fat): these should probably be refactored out of modal.js 15621 // ---------------------------------------------------------------------- 15622 ; 15623
15624 _proto._adjustDialog = function _adjustDialog() { 15625 var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 15626 15627 if (!this._isBodyOverflowing && isModalOverflowing) { 15628 this._element.style.paddingLeft = this._scrollbarWidth + "px"; 15629 } 15630 15631 if (this._isBodyOverflowing && !isModalOverflowing) { 15632 this._element.style.paddingRight = this._scrollbarWidth + "px"; 15633 } 15634 }; 15635 15636 _proto._resetAdjustments = function _resetAdjustments() { 15637 this._element.style.paddingLeft = ''; 15638 this._element.style.paddingRight = ''; 15639 }; 15640 15641 _proto._checkScrollbar = function _checkScrollbar() { 15642 var rect = document.body.getBoundingClientRect(); 15643 this._isBodyOverflowing = rect.left + rect.right < window.innerWidth; 15644 this._scrollbarWidth = this._getScrollbarWidth(); 15645 }; 15646 15647 _proto._setScrollbar = function _setScrollbar() { 15648 var _this9 = this; 15649 15650 if (this._isBodyOverflowing) { 15651 // Note: DOMNode.style.paddingRight returns the actual value or '' if not set 15652 // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set 15653 var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT)); 15654 var stickyContent = [].slice.call(document.querySelectorAll(Selector$5.STICKY_CONTENT)); // Adjust fixed content padding 15655 15656 $(fixedContent).each(function (index, element) { 15657 var actualPadding = element.style.paddingRight; 15658 var calculatedPadding = $(element).css('padding-right'); 15659 $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this9._scrollbarWidth + "px"); 15660 }); // Adjust sticky content margin 15661 15662 $(stickyContent).each(function (index, element) { 15663 var actualMargin = element.style.marginRight; 15664 var calculatedMargin = $(element).css('margin-right'); 15665 $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this9._scrollbarWidth + "px"); 15666 }); // Adjust body padding 15667 15668 var actualPadding = document.body.style.paddingRight; 15669 var calculatedPadding = $(document.body).css('padding-right'); 15670 $(document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px"); 15671 } 15672 15673 $(document.body).addClass(ClassName$5.OPEN); 15674 }; 15675 15676 _proto._resetScrollbar = function _resetScrollbar() { 15677 // Restore fixed content padding 15678 var fixedContent = [].slice.call(document.querySelectorAll(Selector$5.FIXED_CONTENT)); 15679 $(fixedContent).each(function (index, element) { 15680 var padding = $(element).data('padding-right'); 15681 $(element).removeData('padding-right'); 15682 element.style.paddingRight = padding ? padding : ''; 15683 }); // Restore sticky content 15684 15685 var elements = [].slice.call(document.querySelectorAll("" + Selector$5.STICKY_CONTENT)); 15686 $(elements).each(function (index, element) { 15687 var margin = $(element).data('margin-right'); 15688 15689 if (typeof margin !== 'undefined') { 15690 $(element).css('margin-right', margin).removeData('margin-right'); 15691 } 15692 }); // Restore body padding 15693 15694 var padding = $(document.body).data('padding-right'); 15695 $(document.body).removeData('padding-right'); 15696 document.body.style.paddingRight = padding ? padding : ''; 15697 }; 15698 15699 _proto._getScrollbarWidth = function _getScrollbarWidth() { 15700 // thx d.walsh 15701 var scrollDiv = document.createElement('div'); 15702 scrollDiv.className = ClassName$5.SCROLLBAR_MEASURER; 15703 document.body.appendChild(scrollDiv); 15704 var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; 15705 document.body.removeChild(scrollDiv); 15706 return scrollbarWidth; 15707 } // Static 15708 ; 15709 15710 Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { 15711 return this.each(function () { 15712 var data = $(this).data(DATA_KEY$5); 15713 15714 var _config = _objectSpread({}, Default$3, $(this).data(), typeof config === 'object' && config ? config : {}); 15715 15716 if (!data) { 15717 data = new Modal(this, _config); 15718 $(this).data(DATA_KEY$5, data); 15719 } 15720 15721 if (typeof config === 'string') { 15722 if (typeof data[config] === 'undefined') {
15723 throw new TypeError("No method named \"" + config + "\""); 15724 } 15725 15726 data[config](relatedTarget); 15727 } else if (_config.show) { 15728 data.show(relatedTarget); 15729 } 15730 }); 15731 }; 15732 15733 _createClass(Modal, null, [{ 15734 key: "VERSION", 15735 get: function get() { 15736 return VERSION$5; 15737 } 15738 }, { 15739 key: "Default", 15740 get: function get() { 15741 return Default$3; 15742 } 15743 }]); 15744 15745 return Modal; 15746 }(); 15747 /** 15748 * ------------------------------------------------------------------------ 15749 * Data Api implementation 15750 * ------------------------------------------------------------------------ 15751 */ 15752 15753 15754 $(document).on(Event$5.CLICK_DATA_API, Selector$5.DATA_TOGGLE, function (event) { 15755 var _this10 = this; 15756 15757 var target; 15758 var selector = Util.getSelectorFromElement(this); 15759 15760 if (selector) { 15761 target = document.querySelector(selector); 15762 } 15763 15764 var config = $(target).data(DATA_KEY$5) ? 'toggle' : _objectSpread({}, $(target).data(), $(this).data()); 15765 15766 if (this.tagName === 'A' || this.tagName === 'AREA') { 15767 event.preventDefault(); 15768 } 15769 15770 var $target = $(target).one(Event$5.SHOW, function (showEvent) { 15771 if (showEvent.isDefaultPrevented()) { 15772 // Only register focus restorer if modal will actually get shown 15773 return; 15774 } 15775 15776 $target.one(Event$5.HIDDEN, function () { 15777 if ($(_this10).is(':visible')) { 15778 _this10.focus(); 15779 } 15780 }); 15781 }); 15782 15783 Modal._jQueryInterface.call($(target), config, this); 15784 }); 15785 /** 15786 * ------------------------------------------------------------------------ 15787 * jQuery 15788 * ------------------------------------------------------------------------ 15789 */ 15790 15791 $.fn[NAME$5] = Modal._jQueryInterface; 15792 $.fn[NAME$5].Constructor = Modal; 15793 15794 $.fn[NAME$5].noConflict = function () { 15795 $.fn[NAME$5] = JQUERY_NO_CONFLICT$5; 15796 return Modal._jQueryInterface; 15797 }; 15798 15799 /** 15800 * -------------------------------------------------------------------------- 15801 * Bootstrap (v4.3.1): tools/sanitizer.js 15802 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 15803 * -------------------------------------------------------------------------- 15804 */ 15805 var uriAttrs = ['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']; 15806 var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; 15807 var DefaultWhitelist = { 15808 // Global attributes allowed on any supplied element below. 15809 '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], 15810 a: ['target', 'href', 'title', 'rel'], 15811 area: [], 15812 b: [], 15813 br: [], 15814 col: [], 15815 code: [], 15816 div: [], 15817 em: [], 15818 hr: [], 15819 h1: [], 15820 h2: [], 15821 h3: [], 15822 h4: [], 15823 h5: [], 15824 h6: [], 15825 i: [], 15826 img: ['src', 'alt', 'title', 'width', 'height'], 15827 li: [], 15828 ol: [], 15829 p: [], 15830 pre: [], 15831 s: [], 15832 small: [], 15833 span: [], 15834 sub: [], 15835 sup: [], 15836 strong: [], 15837 u: [], 15838 ul: [] 15839 /** 15840 * A pattern that recognizes a commonly useful subset of URLs that are safe. 15841 * 15842 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 15843 */ 15844 15845 }; 15846 var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi; 15847 /** 15848 * A pattern that matches safe data URLs. Only matches image, video and audio types. 15849 * 15850 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 15851 */ 15852 15853 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; 15854 15855 function allowedAttribute(attr, allowedAttributeList) { 15856 var attrName = attr.nodeName.toLowerCase(); 15857 15858 if (allowedAttributeList.indexOf(attrName) !== -1) { 15859 if (uriAttrs.indexOf(attrName) !== -1) { 15860 return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)); 15861 } 15862 15863 return true; 15864 } 15865 15866 var regExp = allowedAttributeList.filter(function (attrRegex) {
15867 return attrRegex instanceof RegExp; 15868 }); // Check if a regular expression validates the attribute. 15869 15870 for (var i = 0, l = regExp.length; i < l; i++) { 15871 if (attrName.match(regExp[i])) { 15872 return true; 15873 } 15874 } 15875 15876 return false; 15877 } 15878 15879 function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { 15880 if (unsafeHtml.length === 0) { 15881 return unsafeHtml; 15882 } 15883 15884 if (sanitizeFn && typeof sanitizeFn === 'function') { 15885 return sanitizeFn(unsafeHtml); 15886 } 15887 15888 var domParser = new window.DOMParser(); 15889 var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); 15890 var whitelistKeys = Object.keys(whiteList); 15891 var elements = [].slice.call(createdDocument.body.querySelectorAll('*')); 15892 15893 var _loop = function _loop(i, len) { 15894 var el = elements[i]; 15895 var elName = el.nodeName.toLowerCase(); 15896 15897 if (whitelistKeys.indexOf(el.nodeName.toLowerCase()) === -1) { 15898 el.parentNode.removeChild(el); 15899 return "continue"; 15900 } 15901 15902 var attributeList = [].slice.call(el.attributes); 15903 var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []); 15904 attributeList.forEach(function (attr) { 15905 if (!allowedAttribute(attr, whitelistedAttributes)) { 15906 el.removeAttribute(attr.nodeName); 15907 } 15908 }); 15909 }; 15910 15911 for (var i = 0, len = elements.length; i < len; i++) { 15912 var _ret = _loop(i, len); 15913 15914 if (_ret === "continue") continue; 15915 } 15916 15917 return createdDocument.body.innerHTML; 15918 } 15919 15920 /** 15921 * ------------------------------------------------------------------------ 15922 * Constants 15923 * ------------------------------------------------------------------------ 15924 */ 15925 15926 var NAME$6 = 'tooltip'; 15927 var VERSION$6 = '4.3.1'; 15928 var DATA_KEY$6 = 'bs.tooltip'; 15929 var EVENT_KEY$6 = "." + DATA_KEY$6; 15930 var JQUERY_NO_CONFLICT$6 = $.fn[NAME$6]; 15931 var CLASS_PREFIX = 'bs-tooltip'; 15932 var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); 15933 var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn']; 15934 var DefaultType$4 = { 15935 animation: 'boolean', 15936 template: 'string', 15937 title: '(string|element|function)', 15938 trigger: 'string', 15939 delay: '(number|object)', 15940 html: 'boolean', 15941 selector: '(string|boolean)', 15942 placement: '(string|function)', 15943 offset: '(number|string|function)', 15944 container: '(string|element|boolean)', 15945 fallbackPlacement: '(string|array)', 15946 boundary: '(string|element)', 15947 sanitize: 'boolean', 15948 sanitizeFn: '(null|function)', 15949 whiteList: 'object' 15950 }; 15951 var AttachmentMap$1 = { 15952 AUTO: 'auto', 15953 TOP: 'top', 15954 RIGHT: 'right', 15955 BOTTOM: 'bottom', 15956 LEFT: 'left' 15957 }; 15958 var Default$4 = { 15959 animation: true, 15960 template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>', 15961 trigger: 'hover focus', 15962 title: '', 15963 delay: 0, 15964 html: false, 15965 selector: false, 15966 placement: 'top', 15967 offset: 0, 15968 container: false, 15969 fallbackPlacement: 'flip', 15970 boundary: 'scrollParent', 15971 sanitize: true, 15972 sanitizeFn: null, 15973 whiteList: DefaultWhitelist 15974 }; 15975 var HoverState = { 15976 SHOW: 'show', 15977 OUT: 'out' 15978 }; 15979 var Event$6 = { 15980 HIDE: "hide" + EVENT_KEY$6, 15981 HIDDEN: "hidden" + EVENT_KEY$6, 15982 SHOW: "show" + EVENT_KEY$6, 15983 SHOWN: "shown" + EVENT_KEY$6, 15984 INSERTED: "inserted" + EVENT_KEY$6, 15985 CLICK: "click" + EVENT_KEY$6, 15986 FOCUSIN: "focusin" + EVENT_KEY$6, 15987 FOCUSOUT: "focusout" + EVENT_KEY$6, 15988 MOUSEENTER: "mouseenter" + EVENT_KEY$6, 15989 MOUSELEAVE: "mouseleave" + EVENT_KEY$6 15990 }; 15991 var ClassName$6 = { 15992 FADE: 'fade', 15993 SHOW: 'show' 15994 }; 15995 var Selector$6 = { 15996 TOOLTIP: '.tooltip', 15997 TOOLTIP_INNER: '.tooltip-inner', 15998 ARROW: '.arrow' 15999 }; 16000 var Trigger = { 16001 HOVER: 'hover', 16002 FOCUS: 'focus', 16003 CLICK: 'click', 16004 MANUAL: 'manual' 16005 /** 16006 * ------------------------------------------------------------------------ 16007 * Class Definition 16008 * ------------------------------------------------------------------------ 16009 */ 16010 16011 }; 16012 16013 var Tooltip = 16014 /*#__PURE__*/ 16015 function () { 16016 function Tooltip(element, config) { 16017 /** 16018 * Check for Popper dependency 16019 * Popper - https://popper.js.org 16020 */ 16021 if (typeof Popper === 'undefined') { 16022 throw new TypeError('Bootstrap\'s tooltips require Popper.js (https://popper.js.org/)'); 16023 } // private 16024 16025 16026 this._isEnabled = true; 16027 this._timeout = 0; 16028 this._hoverState = ''; 16029 this._activeTrigger = {}; 16030 this._popper = null; // Protected 16031 16032 this.element = element; 16033 this.config = this._getConfig(config); 16034 this.tip = null; 16035 16036 this._setListeners(); 16037 } // Getters 16038 16039 16040 var _proto = Tooltip.prototype; 16041 16042 // Public 16043 _proto.enable = function enable() { 16044 this._isEnabled = true; 16045 }; 16046 16047 _proto.disable = function disable() { 16048 this._isEnabled = false;
16049 }; 16050 16051 _proto.toggleEnabled = function toggleEnabled() { 16052 this._isEnabled = !this._isEnabled; 16053 }; 16054 16055 _proto.toggle = function toggle(event) { 16056 if (!this._isEnabled) { 16057 return; 16058 } 16059 16060 if (event) { 16061 var dataKey = this.constructor.DATA_KEY; 16062 var context = $(event.currentTarget).data(dataKey); 16063 16064 if (!context) { 16065 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 16066 $(event.currentTarget).data(dataKey, context); 16067 } 16068 16069 context._activeTrigger.click = !context._activeTrigger.click; 16070 16071 if (context._isWithActiveTrigger()) { 16072 context._enter(null, context); 16073 } else { 16074 context._leave(null, context); 16075 } 16076 } else { 16077 if ($(this.getTipElement()).hasClass(ClassName$6.SHOW)) { 16078 this._leave(null, this); 16079 16080 return; 16081 } 16082 16083 this._enter(null, this); 16084 } 16085 }; 16086 16087 _proto.dispose = function dispose() { 16088 clearTimeout(this._timeout); 16089 $.removeData(this.element, this.constructor.DATA_KEY); 16090 $(this.element).off(this.constructor.EVENT_KEY); 16091 $(this.element).closest('.modal').off('hide.bs.modal'); 16092 16093 if (this.tip) { 16094 $(this.tip).remove(); 16095 } 16096 16097 this._isEnabled = null; 16098 this._timeout = null; 16099 this._hoverState = null; 16100 this._activeTrigger = null; 16101 16102 if (this._popper !== null) { 16103 this._popper.destroy(); 16104 } 16105 16106 this._popper = null; 16107 this.element = null; 16108 this.config = null; 16109 this.tip = null; 16110 }; 16111 16112 _proto.show = function show() { 16113 var _this = this; 16114 16115 if ($(this.element).css('display') === 'none') { 16116 throw new Error('Please use show on visible elements'); 16117 } 16118 16119 var showEvent = $.Event(this.constructor.Event.SHOW); 16120 16121 if (this.isWithContent() && this._isEnabled) { 16122 $(this.element).trigger(showEvent); 16123 var shadowRoot = Util.findShadowRoot(this.element); 16124 var isInTheDom = $.contains(shadowRoot !== null ? shadowRoot : this.element.ownerDocument.documentElement, this.element); 16125 16126 if (showEvent.isDefaultPrevented() || !isInTheDom) { 16127 return; 16128 } 16129 16130 var tip = this.getTipElement(); 16131 var tipId = Util.getUID(this.constructor.NAME);
16132 tip.setAttribute('id', tipId); 16133 this.element.setAttribute('aria-describedby', tipId); 16134 this.setContent(); 16135 16136 if (this.config.animation) { 16137 $(tip).addClass(ClassName$6.FADE); 16138 } 16139 16140 var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; 16141 16142 var attachment = this._getAttachment(placement); 16143 16144 this.addAttachmentClass(attachment); 16145 16146 var container = this._getContainer(); 16147 16148 $(tip).data(this.constructor.DATA_KEY, this); 16149 16150 if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) { 16151 $(tip).appendTo(container); 16152 } 16153 16154 $(this.element).trigger(this.constructor.Event.INSERTED); 16155 this._popper = new Popper(this.element, tip, { 16156 placement: attachment, 16157 modifiers: { 16158 offset: this._getOffset(), 16159 flip: { 16160 behavior: this.config.fallbackPlacement 16161 }, 16162 arrow: { 16163 element: Selector$6.ARROW 16164 }, 16165 preventOverflow: { 16166 boundariesElement: this.config.boundary 16167 } 16168 }, 16169 onCreate: function onCreate(data) { 16170 if (data.originalPlacement !== data.placement) { 16171 _this._handlePopperPlacementChange(data); 16172 } 16173 }, 16174 onUpdate: function onUpdate(data) { 16175 return _this._handlePopperPlacementChange(data); 16176 } 16177 }); 16178 $(tip).addClass(ClassName$6.SHOW); // If this is a touch-enabled device we add extra 16179 // empty mouseover listeners to the body's immediate children; 16180 // only needed because of broken event delegation on iOS 16181 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 16182 16183 if ('ontouchstart' in document.documentElement) { 16184 $(document.body).children().on('mouseover', null, $.noop); 16185 } 16186 16187 var complete = function complete() { 16188 if (_this.config.animation) { 16189 _this._fixTransition(); 16190 } 16191 16192 var prevHoverState = _this._hoverState; 16193 _this._hoverState = null; 16194 $(_this.element).trigger(_this.constructor.Event.SHOWN); 16195 16196 if (prevHoverState === HoverState.OUT) { 16197 _this._leave(null, _this); 16198 } 16199 }; 16200 16201 if ($(this.tip).hasClass(ClassName$6.FADE)) { 16202 var transitionDuration = Util.getTransitionDurationFromElement(this.tip); 16203 $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 16204 } else { 16205 complete(); 16206 } 16207 } 16208 }; 16209 16210 _proto.hide = function hide(callback) { 16211 var _this2 = this; 16212 16213 var tip = this.getTipElement(); 16214 var hideEvent = $.Event(this.constructor.Event.HIDE); 16215 16216 var complete = function complete() { 16217 if (_this2._hoverState !== HoverState.SHOW && tip.parentNode) { 16218 tip.parentNode.removeChild(tip); 16219 } 16220 16221 _this2._cleanTipClass(); 16222 16223 _this2.element.removeAttribute('aria-describedby'); 16224 16225 $(_this2.element).trigger(_this2.constructor.Event.HIDDEN); 16226 16227 if (_this2._popper !== null) { 16228 _this2._popper.destroy(); 16229 } 16230 16231 if (callback) { 16232 callback(); 16233 } 16234 }; 16235 16236 $(this.element).trigger(hideEvent); 16237 16238 if (hideEvent.isDefaultPrevented()) { 16239 return; 16240 } 16241 16242 $(tip).removeClass(ClassName$6.SHOW); // If this is a touch-enabled device we remove the extra 16243 // empty mouseover listeners we added for iOS support 16244 16245 if ('ontouchstart' in document.documentElement) { 16246 $(document.body).children().off('mouseover', null, $.noop); 16247 } 16248 16249 this._activeTrigger[Trigger.CLICK] = false; 16250 this._activeTrigger[Trigger.FOCUS] = false; 16251 this._activeTrigger[Trigger.HOVER] = false; 16252 16253 if ($(this.tip).hasClass(ClassName$6.FADE)) { 16254 var transitionDuration = Util.getTransitionDurationFromElement(tip); 16255 $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 16256 } else { 16257 complete(); 16258 } 16259 16260 this._hoverState = ''; 16261 }; 16262
16263 _proto.update = function update() { 16264 if (this._popper !== null) { 16265 this._popper.scheduleUpdate(); 16266 } 16267 } // Protected 16268 ; 16269 16270 _proto.isWithContent = function isWithContent() { 16271 return Boolean(this.getTitle()); 16272 }; 16273 16274 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 16275 $(this.getTipElement()).addClass(CLASS_PREFIX + "-" + attachment); 16276 }; 16277 16278 _proto.getTipElement = function getTipElement() { 16279 this.tip = this.tip || $(this.config.template)[0]; 16280 return this.tip; 16281 }; 16282 16283 _proto.setContent = function setContent() { 16284 var tip = this.getTipElement(); 16285 this.setElementContent($(tip.querySelectorAll(Selector$6.TOOLTIP_INNER)), this.getTitle()); 16286 $(tip).removeClass(ClassName$6.FADE + " " + ClassName$6.SHOW); 16287 }; 16288 16289 _proto.setElementContent = function setElementContent($element, content) { 16290 if (typeof content === 'object' && (content.nodeType || content.jquery)) { 16291 // Content is a DOM node or a jQuery 16292 if (this.config.html) { 16293 if (!$(content).parent().is($element)) { 16294 $element.empty().append(content); 16295 } 16296 } else { 16297 $element.text($(content).text()); 16298 } 16299 16300 return; 16301 } 16302 16303 if (this.config.html) { 16304 if (this.config.sanitize) { 16305 content = sanitizeHtml(content, this.config.whiteList, this.config.sanitizeFn); 16306 } 16307 16308 $element.html(content); 16309 } else { 16310 $element.text(content); 16311 } 16312 }; 16313 16314 _proto.getTitle = function getTitle() { 16315 var title = this.element.getAttribute('data-original-title'); 16316 16317 if (!title) { 16318 title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title; 16319 } 16320 16321 return title; 16322 } // Private 16323 ; 16324 16325 _proto._getOffset = function _getOffset() { 16326 var _this3 = this; 16327 16328 var offset = {}; 16329 16330 if (typeof this.config.offset === 'function') { 16331 offset.fn = function (data) { 16332 data.offsets = _objectSpread({}, data.offsets, _this3.config.offset(data.offsets, _this3.element) || {}); 16333 return data; 16334 }; 16335 } else { 16336 offset.offset = this.config.offset; 16337 } 16338 16339 return offset; 16340 }; 16341 16342 _proto._getContainer = function _getContainer() { 16343 if (this.config.container === false) { 16344 return document.body; 16345 } 16346 16347 if (Util.isElement(this.config.container)) { 16348 return $(this.config.container); 16349 } 16350 16351 return $(document).find(this.config.container); 16352 }; 16353 16354 _proto._getAttachment = function _getAttachment(placement) { 16355 return AttachmentMap$1[placement.toUpperCase()]; 16356 }; 16357 16358 _proto._setListeners = function _setListeners() { 16359 var _this4 = this; 16360 16361 var triggers = this.config.trigger.split(' '); 16362 triggers.forEach(function (trigger) { 16363 if (trigger === 'click') { 16364 $(_this4.element).on(_this4.constructor.Event.CLICK, _this4.config.selector, function (event) { 16365 return _this4.toggle(event); 16366 }); 16367 } else if (trigger !== Trigger.MANUAL) { 16368 var eventIn = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSEENTER : _this4.constructor.Event.FOCUSIN; 16369 var eventOut = trigger === Trigger.HOVER ? _this4.constructor.Event.MOUSELEAVE : _this4.constructor.Event.FOCUSOUT; 16370 $(_this4.element).on(eventIn, _this4.config.selector, function (event) { 16371 return _this4._enter(event); 16372 }).on(eventOut, _this4.config.selector, function (event) { 16373 return _this4._leave(event); 16374 }); 16375 } 16376 }); 16377 $(this.element).closest('.modal').on('hide.bs.modal', function () { 16378 if (_this4.element) { 16379 _this4.hide(); 16380 } 16381 }); 16382 16383 if (this.config.selector) { 16384 this.config = _objectSpread({}, this.config, { 16385 trigger: 'manual', 16386 selector: '' 16387 }); 16388 } else { 16389 this._fixTitle(); 16390 } 16391 }; 16392 16393 _proto._fixTitle = function _fixTitle() { 16394 var titleType = typeof this.element.getAttribute('data-original-title'); 16395 16396 if (this.element.getAttribute('title') || titleType !== 'string') { 16397 this.element.setAttribute('data-original-title', this.element.getAttribute('title') || ''); 16398 this.element.setAttribute('title', ''); 16399 } 16400 }; 16401 16402 _proto._enter = function _enter(event, context) { 16403 var dataKey = this.constructor.DATA_KEY; 16404 context = context || $(event.currentTarget).data(dataKey); 16405 16406 if (!context) { 16407 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 16408 $(event.currentTarget).data(dataKey, context); 16409 } 16410 16411 if (event) { 16412 context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true; 16413 } 16414 16415 if ($(context.getTipElement()).hasClass(ClassName$6.SHOW) || context._hoverState === HoverState.SHOW) { 16416 context._hoverState = HoverState.SHOW; 16417 return; 16418 } 16419 16420 clearTimeout(context._timeout); 16421 context._hoverState = HoverState.SHOW; 16422 16423 if (!context.config.delay || !context.config.delay.show) { 16424 context.show(); 16425 return; 16426 } 16427 16428 context._timeout = setTimeout(function () { 16429 if (context._hoverState === HoverState.SHOW) { 16430 context.show(); 16431 } 16432 }, context.config.delay.show); 16433 }; 16434 16435 _proto._leave = function _leave(event, context) { 16436 var dataKey = this.constructor.DATA_KEY; 16437 context = context || $(event.currentTarget).data(dataKey); 16438 16439 if (!context) { 16440 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 16441 $(event.currentTarget).data(dataKey, context); 16442 } 16443 16444 if (event) { 16445 context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
16446 } 16447 16448 if (context._isWithActiveTrigger()) { 16449 return; 16450 } 16451 16452 clearTimeout(context._timeout); 16453 context._hoverState = HoverState.OUT; 16454 16455 if (!context.config.delay || !context.config.delay.hide) { 16456 context.hide(); 16457 return; 16458 } 16459 16460 context._timeout = setTimeout(function () { 16461 if (context._hoverState === HoverState.OUT) { 16462 context.hide(); 16463 } 16464 }, context.config.delay.hide); 16465 }; 16466 16467 _proto._isWithActiveTrigger = function _isWithActiveTrigger() { 16468 for (var trigger in this._activeTrigger) { 16469 if (this._activeTrigger[trigger]) { 16470 return true; 16471 } 16472 } 16473 16474 return false; 16475 }; 16476 16477 _proto._getConfig = function _getConfig(config) { 16478 var dataAttributes = $(this.element).data(); 16479 Object.keys(dataAttributes).forEach(function (dataAttr) { 16480 if (DISALLOWED_ATTRIBUTES.indexOf(dataAttr) !== -1) { 16481 delete dataAttributes[dataAttr]; 16482 } 16483 }); 16484 config = _objectSpread({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {}); 16485 16486 if (typeof config.delay === 'number') { 16487 config.delay = { 16488 show: config.delay, 16489 hide: config.delay 16490 }; 16491 } 16492 16493 if (typeof config.title === 'number') { 16494 config.title = config.title.toString(); 16495 } 16496 16497 if (typeof config.content === 'number') { 16498 config.content = config.content.toString(); 16499 } 16500 16501 Util.typeCheckConfig(NAME$6, config, this.constructor.DefaultType); 16502 16503 if (config.sanitize) { 16504 config.template = sanitizeHtml(config.template, config.whiteList, config.sanitizeFn); 16505 } 16506 16507 return config; 16508 }; 16509 16510 _proto._getDelegateConfig = function _getDelegateConfig() { 16511 var config = {}; 16512 16513 if (this.config) { 16514 for (var key in this.config) { 16515 if (this.constructor.Default[key] !== this.config[key]) { 16516 config[key] = this.config[key]; 16517 } 16518 } 16519 } 16520 16521 return config; 16522 }; 16523 16524 _proto._cleanTipClass = function _cleanTipClass() { 16525 var $tip = $(this.getTipElement()); 16526 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); 16527 16528 if (tabClass !== null && tabClass.length) { 16529 $tip.removeClass(tabClass.join('')); 16530 } 16531 }; 16532 16533 _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) { 16534 var popperInstance = popperData.instance; 16535 this.tip = popperInstance.popper; 16536 16537 this._cleanTipClass(); 16538 16539 this.addAttachmentClass(this._getAttachment(popperData.placement)); 16540 }; 16541 16542 _proto._fixTransition = function _fixTransition() { 16543 var tip = this.getTipElement(); 16544 var initConfigAnimation = this.config.animation; 16545 16546 if (tip.getAttribute('x-placement') !== null) { 16547 return; 16548 } 16549 16550 $(tip).removeClass(ClassName$6.FADE); 16551 this.config.animation = false; 16552 this.hide(); 16553 this.show(); 16554 this.config.animation = initConfigAnimation; 16555 } // Static 16556 ; 16557 16558 Tooltip._jQueryInterface = function _jQueryInterface(config) { 16559 return this.each(function () { 16560 var data = $(this).data(DATA_KEY$6); 16561 16562 var _config = typeof config === 'object' && config; 16563 16564 if (!data && /dispose|hide/.test(config)) { 16565 return; 16566 } 16567 16568 if (!data) { 16569 data = new Tooltip(this, _config); 16570 $(this).data(DATA_KEY$6, data); 16571 } 16572 16573 if (typeof config === 'string') { 16574 if (typeof data[config] === 'undefined') { 16575 throw new TypeError("No method named \"" + config + "\""); 16576 } 16577 16578 data[config](); 16579 } 16580 }); 16581 }; 16582 16583 _createClass(Tooltip, null, [{ 16584 key: "VERSION", 16585 get: function get() { 16586 return VERSION$6; 16587 } 16588 }, { 16589 key: "Default", 16590 get: function get() { 16591 return Default$4; 16592 } 16593 }, { 16594 key: "NAME", 16595 get: function get() { 16596 return NAME$6; 16597 } 16598 }, { 16599 key: "DATA_KEY", 16600 get: function get() { 16601 return DATA_KEY$6; 16602 } 16603 }, { 16604 key: "Event", 16605 get: function get() { 16606 return Event$6; 16607 } 16608 }, {
16609 key: "EVENT_KEY", 16610 get: function get() { 16611 return EVENT_KEY$6; 16612 } 16613 }, { 16614 key: "DefaultType", 16615 get: function get() { 16616 return DefaultType$4; 16617 } 16618 }]); 16619 16620 return Tooltip; 16621 }(); 16622 /** 16623 * ------------------------------------------------------------------------ 16624 * jQuery 16625 * ------------------------------------------------------------------------ 16626 */ 16627 16628 16629 $.fn[NAME$6] = Tooltip._jQueryInterface; 16630 $.fn[NAME$6].Constructor = Tooltip; 16631 16632 $.fn[NAME$6].noConflict = function () { 16633 $.fn[NAME$6] = JQUERY_NO_CONFLICT$6; 16634 return Tooltip._jQueryInterface; 16635 }; 16636 16637 /** 16638 * ------------------------------------------------------------------------ 16639 * Constants 16640 * ------------------------------------------------------------------------ 16641 */ 16642 16643 var NAME$7 = 'popover'; 16644 var VERSION$7 = '4.3.1'; 16645 var DATA_KEY$7 = 'bs.popover'; 16646 var EVENT_KEY$7 = "." + DATA_KEY$7; 16647 var JQUERY_NO_CONFLICT$7 = $.fn[NAME$7]; 16648 var CLASS_PREFIX$1 = 'bs-popover'; 16649 var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g'); 16650 16651 var Default$5 = _objectSpread({}, Tooltip.Default, { 16652 placement: 'right', 16653 trigger: 'click', 16654 content: '', 16655 template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' 16656 }); 16657 16658 var DefaultType$5 = _objectSpread({}, Tooltip.DefaultType, { 16659 content: '(string|element|function)' 16660 }); 16661 16662 var ClassName$7 = { 16663 FADE: 'fade', 16664 SHOW: 'show' 16665 }; 16666 var Selector$7 = { 16667 TITLE: '.popover-header', 16668 CONTENT: '.popover-body' 16669 }; 16670 var Event$7 = { 16671 HIDE: "hide" + EVENT_KEY$7, 16672 HIDDEN: "hidden" + EVENT_KEY$7, 16673 SHOW: "show" + EVENT_KEY$7, 16674 SHOWN: "shown" + EVENT_KEY$7, 16675 INSERTED: "inserted" + EVENT_KEY$7, 16676 CLICK: "click" + EVENT_KEY$7, 16677 FOCUSIN: "focusin" + EVENT_KEY$7, 16678 FOCUSOUT: "focusout" + EVENT_KEY$7, 16679 MOUSEENTER: "mouseenter" + EVENT_KEY$7, 16680 MOUSELEAVE: "mouseleave" + EVENT_KEY$7 16681 /** 16682 * ------------------------------------------------------------------------ 16683 * Class Definition 16684 * ------------------------------------------------------------------------ 16685 */ 16686 16687 }; 16688 16689 var Popover = 16690 /*#__PURE__*/ 16691 function (_Tooltip) { 16692 _inheritsLoose(Popover, _Tooltip); 16693 16694 function Popover() { 16695 return _Tooltip.apply(this, arguments) || this; 16696 } 16697 16698 var _proto = Popover.prototype; 16699 16700 // Overrides 16701 _proto.isWithContent = function isWithContent() { 16702 return this.getTitle() || this._getContent(); 16703 }; 16704 16705 _proto.addAttachmentClass = function addAttachmentClass(attachment) { 16706 $(this.getTipElement()).addClass(CLASS_PREFIX$1 + "-" + attachment); 16707 }; 16708 16709 _proto.getTipElement = function getTipElement() { 16710 this.tip = this.tip || $(this.config.template)[0]; 16711 return this.tip; 16712 }; 16713 16714 _proto.setContent = function setContent() { 16715 var $tip = $(this.getTipElement()); // We use append for html objects to maintain js events 16716 16717 this.setElementContent($tip.find(Selector$7.TITLE), this.getTitle()); 16718 16719 var content = this._getContent(); 16720 16721 if (typeof content === 'function') { 16722 content = content.call(this.element); 16723 } 16724 16725 this.setElementContent($tip.find(Selector$7.CONTENT), content); 16726 $tip.removeClass(ClassName$7.FADE + " " + ClassName$7.SHOW); 16727 } // Private 16728 ; 16729 16730 _proto._getContent = function _getContent() { 16731 return this.element.getAttribute('data-content') || this.config.content; 16732 }; 16733 16734 _proto._cleanTipClass = function _cleanTipClass() { 16735 var $tip = $(this.getTipElement()); 16736 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX$1); 16737 16738 if (tabClass !== null && tabClass.length > 0) { 16739 $tip.removeClass(tabClass.join('')); 16740 } 16741 } // Static 16742 ; 16743 16744 Popover._jQueryInterface = function _jQueryInterface(config) { 16745 return this.each(function () { 16746 var data = $(this).data(DATA_KEY$7); 16747 16748 var _config = typeof config === 'object' ? config : null; 16749 16750 if (!data && /dispose|hide/.test(config)) { 16751 return; 16752 } 16753 16754 if (!data) { 16755 data = new Popover(this, _config); 16756 $(this).data(DATA_KEY$7, data); 16757 } 16758 16759 if (typeof config === 'string') { 16760 if (typeof data[config] === 'undefined') {
16761 throw new TypeError("No method named \"" + config + "\""); 16762 } 16763 16764 data[config](); 16765 } 16766 }); 16767 }; 16768 16769 _createClass(Popover, null, [{ 16770 key: "VERSION", 16771 // Getters 16772 get: function get() { 16773 return VERSION$7; 16774 } 16775 }, { 16776 key: "Default", 16777 get: function get() { 16778 return Default$5; 16779 } 16780 }, { 16781 key: "NAME", 16782 get: function get() { 16783 return NAME$7; 16784 } 16785 }, { 16786 key: "DATA_KEY", 16787 get: function get() { 16788 return DATA_KEY$7; 16789 } 16790 }, { 16791 key: "Event", 16792 get: function get() { 16793 return Event$7; 16794 } 16795 }, { 16796 key: "EVENT_KEY", 16797 get: function get() { 16798 return EVENT_KEY$7; 16799 } 16800 }, { 16801 key: "DefaultType", 16802 get: function get() { 16803 return DefaultType$5; 16804 } 16805 }]); 16806 16807 return Popover; 16808 }(Tooltip); 16809 /** 16810 * ------------------------------------------------------------------------ 16811 * jQuery 16812 * ------------------------------------------------------------------------ 16813 */ 16814 16815 16816 $.fn[NAME$7] = Popover._jQueryInterface; 16817 $.fn[NAME$7].Constructor = Popover; 16818 16819 $.fn[NAME$7].noConflict = function () { 16820 $.fn[NAME$7] = JQUERY_NO_CONFLICT$7; 16821 return Popover._jQueryInterface; 16822 }; 16823 16824 /** 16825 * ------------------------------------------------------------------------ 16826 * Constants 16827 * ------------------------------------------------------------------------ 16828 */ 16829 16830 var NAME$8 = 'scrollspy'; 16831 var VERSION$8 = '4.3.1'; 16832 var DATA_KEY$8 = 'bs.scrollspy'; 16833 var EVENT_KEY$8 = "." + DATA_KEY$8; 16834 var DATA_API_KEY$6 = '.data-api'; 16835 var JQUERY_NO_CONFLICT$8 = $.fn[NAME$8]; 16836 var Default$6 = { 16837 offset: 10, 16838 method: 'auto', 16839 target: '' 16840 }; 16841 var DefaultType$6 = { 16842 offset: 'number', 16843 method: 'string', 16844 target: '(string|element)' 16845 }; 16846 var Event$8 = { 16847 ACTIVATE: "activate" + EVENT_KEY$8, 16848 SCROLL: "scroll" + EVENT_KEY$8, 16849 LOAD_DATA_API: "load" + EVENT_KEY$8 + DATA_API_KEY$6 16850 }; 16851 var ClassName$8 = { 16852 DROPDOWN_ITEM: 'dropdown-item', 16853 DROPDOWN_MENU: 'dropdown-menu', 16854 ACTIVE: 'active' 16855 }; 16856 var Selector$8 = { 16857 DATA_SPY: '[data-spy="scroll"]', 16858 ACTIVE: '.active', 16859 NAV_LIST_GROUP: '.nav, .list-group', 16860 NAV_LINKS: '.nav-link', 16861 NAV_ITEMS: '.nav-item', 16862 LIST_ITEMS: '.list-group-item', 16863 DROPDOWN: '.dropdown', 16864 DROPDOWN_ITEMS: '.dropdown-item', 16865 DROPDOWN_TOGGLE: '.dropdown-toggle' 16866 }; 16867 var OffsetMethod = { 16868 OFFSET: 'offset', 16869 POSITION: 'position' 16870 /** 16871 * ------------------------------------------------------------------------ 16872 * Class Definition 16873 * ------------------------------------------------------------------------ 16874 */ 16875 16876 }; 16877 16878 var ScrollSpy = 16879 /*#__PURE__*/ 16880 function () { 16881 function ScrollSpy(element, config) { 16882 var _this = this; 16883 16884 this._element = element; 16885 this._scrollElement = element.tagName === 'BODY' ? window : element; 16886 this._config = this._getConfig(config); 16887 this._selector = this._config.target + " " + Selector$8.NAV_LINKS + "," + (this._config.target + " " + Selector$8.LIST_ITEMS + ",") + (this._config.target + " " + Selector$8.DROPDOWN_ITEMS); 16888 this._offsets = []; 16889 this._targets = []; 16890 this._activeTarget = null; 16891 this._scrollHeight = 0; 16892 $(this._scrollElement).on(Event$8.SCROLL, function (event) { 16893 return _this._process(event); 16894 }); 16895 this.refresh(); 16896 16897 this._process(); 16898 } // Getters 16899 16900 16901 var _proto = ScrollSpy.prototype; 16902 16903 // Public 16904 _proto.refresh = function refresh() { 16905 var _this2 = this; 16906 16907 var autoMethod = this._scrollElement === this._scrollElement.window ? OffsetMethod.OFFSET : OffsetMethod.POSITION; 16908 var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; 16909 var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0; 16910 this._offsets = []; 16911 this._targets = []; 16912 this._scrollHeight = this._getScrollHeight(); 16913 var targets = [].slice.call(document.querySelectorAll(this._selector)); 16914 targets.map(function (element) { 16915 var target; 16916 var targetSelector = Util.getSelectorFromElement(element); 16917
16918 if (targetSelector) { 16919 target = document.querySelector(targetSelector); 16920 } 16921 16922 if (target) { 16923 var targetBCR = target.getBoundingClientRect(); 16924 16925 if (targetBCR.width || targetBCR.height) { 16926 // TODO (fat): remove sketch reliance on jQuery position/offset 16927 return [$(target)[offsetMethod]().top + offsetBase, targetSelector]; 16928 } 16929 } 16930 16931 return null; 16932 }).filter(function (item) { 16933 return item; 16934 }).sort(function (a, b) { 16935 return a[0] - b[0]; 16936 }).forEach(function (item) { 16937 _this2._offsets.push(item[0]); 16938 16939 _this2._targets.push(item[1]); 16940 }); 16941 }; 16942 16943 _proto.dispose = function dispose() { 16944 $.removeData(this._element, DATA_KEY$8); 16945 $(this._scrollElement).off(EVENT_KEY$8); 16946 this._element = null; 16947 this._scrollElement = null; 16948 this._config = null; 16949 this._selector = null; 16950 this._offsets = null; 16951 this._targets = null; 16952 this._activeTarget = null; 16953 this._scrollHeight = null; 16954 } // Private 16955 ; 16956 16957 _proto._getConfig = function _getConfig(config) { 16958 config = _objectSpread({}, Default$6, typeof config === 'object' && config ? config : {}); 16959 16960 if (typeof config.target !== 'string') { 16961 var id = $(config.target).attr('id'); 16962 16963 if (!id) { 16964 id = Util.getUID(NAME$8); 16965 $(config.target).attr('id', id); 16966 } 16967 16968 config.target = "#" + id; 16969 } 16970 16971 Util.typeCheckConfig(NAME$8, config, DefaultType$6); 16972 return config; 16973 }; 16974 16975 _proto._getScrollTop = function _getScrollTop() { 16976 return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; 16977 }; 16978 16979 _proto._getScrollHeight = function _getScrollHeight() { 16980 return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); 16981 }; 16982 16983 _proto._getOffsetHeight = function _getOffsetHeight() { 16984 return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; 16985 }; 16986 16987 _proto._process = function _process() { 16988 var scrollTop = this._getScrollTop() + this._config.offset; 16989 16990 var scrollHeight = this._getScrollHeight(); 16991 16992 var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); 16993 16994 if (this._scrollHeight !== scrollHeight) { 16995 this.refresh(); 16996 } 16997 16998 if (scrollTop >= maxScroll) { 16999 var target = this._targets[this._targets.length - 1]; 17000 17001 if (this._activeTarget !== target) { 17002 this._activate(target); 17003 } 17004 17005 return; 17006 } 17007 17008 if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { 17009 this._activeTarget = null; 17010 17011 this._clear(); 17012 17013 return; 17014 } 17015 17016 var offsetLength = this._offsets.length; 17017 17018 for (var i = offsetLength; i--;) { 17019 var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); 17020 17021 if (isActiveTarget) { 17022 this._activate(this._targets[i]); 17023 } 17024 } 17025 }; 17026 17027 _proto._activate = function _activate(target) { 17028 this._activeTarget = target; 17029 17030 this._clear(); 17031 17032 var queries = this._selector.split(',').map(function (selector) { 17033 return selector + "[data-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]"; 17034 }); 17035 17036 var $link = $([].slice.call(document.querySelectorAll(queries.join(',')))); 17037 17038 if ($link.hasClass(ClassName$8.DROPDOWN_ITEM)) { 17039 $link.closest(Selector$8.DROPDOWN).find(Selector$8.DROPDOWN_TOGGLE).addClass(ClassName$8.ACTIVE); 17040 $link.addClass(ClassName$8.ACTIVE); 17041 } else { 17042 // Set triggered link as active 17043 $link.addClass(ClassName$8.ACTIVE); // Set triggered links parents as active 17044 // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor 17045 17046 $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_LINKS + ", " + Selector$8.
17046LIST_ITEMS).addClass(ClassName$8.ACTIVE); // Handle special case when .nav-link is inside .nav-item 17047 17048 $link.parents(Selector$8.NAV_LIST_GROUP).prev(Selector$8.NAV_ITEMS).children(Selector$8.NAV_LINKS).addClass(ClassName$8.ACTIVE); 17049 } 17050 17051 $(this._scrollElement).trigger(Event$8.ACTIVATE, { 17052 relatedTarget: target 17053 }); 17054 }; 17055 17056 _proto._clear = function _clear() { 17057 [].slice.call(document.querySelectorAll(this._selector)).filter(function (node) { 17058 return node.classList.contains(ClassName$8.ACTIVE); 17059 }).forEach(function (node) { 17060 return node.classList.remove(ClassName$8.ACTIVE); 17061 }); 17062 } // Static 17063 ; 17064 17065 ScrollSpy._jQueryInterface = function _jQueryInterface(config) { 17066 return this.each(function () { 17067 var data = $(this).data(DATA_KEY$8); 17068 17069 var _config = typeof config === 'object' && config; 17070 17071 if (!data) { 17072 data = new ScrollSpy(this, _config); 17073 $(this).data(DATA_KEY$8, data); 17074 } 17075 17076 if (typeof config === 'string') { 17077 if (typeof data[config] === 'undefined') { 17078 throw new TypeError("No method named \"" + config + "\""); 17079 } 17080 17081 data[config](); 17082 } 17083 }); 17084 }; 17085 17086 _createClass(ScrollSpy, null, [{ 17087 key: "VERSION", 17088 get: function get() { 17089 return VERSION$8; 17090 } 17091 }, { 17092 key: "Default", 17093 get: function get() { 17094 return Default$6; 17095 } 17096 }]); 17097 17098 return ScrollSpy; 17099 }(); 17100 /** 17101 * ------------------------------------------------------------------------ 17102 * Data Api implementation 17103 * ------------------------------------------------------------------------ 17104 */ 17105 17106 17107 $(window).on(Event$8.LOAD_DATA_API, function () { 17108 var scrollSpys = [].slice.call(document.querySelectorAll(Selector$8.DATA_SPY)); 17109 var scrollSpysLength = scrollSpys.length; 17110 17111 for (var i = scrollSpysLength; i--;) { 17112 var $spy = $(scrollSpys[i]); 17113 17114 ScrollSpy._jQueryInterface.call($spy, $spy.data()); 17115 } 17116 }); 17117 /** 17118 * ------------------------------------------------------------------------ 17119 * jQuery 17120 * ------------------------------------------------------------------------ 17121 */ 17122 17123 $.fn[NAME$8] = ScrollSpy._jQueryInterface; 17124 $.fn[NAME$8].Constructor = ScrollSpy; 17125 17126 $.fn[NAME$8].noConflict = function () { 17127 $.fn[NAME$8] = JQUERY_NO_CONFLICT$8; 17128 return ScrollSpy._jQueryInterface; 17129 }; 17130 17131 /** 17132 * ------------------------------------------------------------------------ 17133 * Constants 17134 * ------------------------------------------------------------------------ 17135 */ 17136 17137 var NAME$9 = 'tab'; 17138 var VERSION$9 = '4.3.1'; 17139 var DATA_KEY$9 = 'bs.tab'; 17140 var EVENT_KEY$9 = "." + DATA_KEY$9; 17141 var DATA_API_KEY$7 = '.data-api'; 17142 var JQUERY_NO_CONFLICT$9 = $.fn[NAME$9]; 17143 var Event$9 = { 17144 HIDE: "hide" + EVENT_KEY$9, 17145 HIDDEN: "hidden" + EVENT_KEY$9, 17146 SHOW: "show" + EVENT_KEY$9, 17147 SHOWN: "shown" + EVENT_KEY$9, 17148 CLICK_DATA_API: "click" + EVENT_KEY$9 + DATA_API_KEY$7 17149 }; 17150 var ClassName$9 = { 17151 DROPDOWN_MENU: 'dropdown-menu', 17152 ACTIVE: 'active', 17153 DISABLED: 'disabled', 17154 FADE: 'fade', 17155 SHOW: 'show' 17156 }; 17157 var Selector$9 = { 17158 DROPDOWN: '.dropdown', 17159 NAV_LIST_GROUP: '.nav, .list-group', 17160 ACTIVE: '.active', 17161 ACTIVE_UL: '> li > .active', 17162 DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]', 17163 DROPDOWN_TOGGLE: '.dropdown-toggle', 17164 DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active' 17165 /** 17166 * ------------------------------------------------------------------------ 17167 * Class Definition 17168 * ------------------------------------------------------------------------ 17169 */ 17170 17171 }; 17172 17173 var Tab = 17174 /*#__PURE__*/ 17175 function () { 17176 function Tab(element) { 17177 this._element = element; 17178 } // Getters 17179 17180 17181 var _proto = Tab.prototype; 17182 17183 // Public 17184 _proto.show = function show() { 17185 var _this = this; 17186 17187 if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName$9.ACTIVE) || $(this._element).hasClass(ClassName$9.DISABLED)) { 17188 return; 17189 } 17190 17191 var target; 17192 var previous; 17193 var listElement = $(this._element).closest(Selector$9.NAV_LIST_GROUP)[0]; 17194 var selector = Util.getSelectorFromElement(this._element); 17195 17196 if (listElement) { 17197 var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector$9.ACTIVE_UL : Selector$9.ACTIVE; 17198 previous = $.makeArray($(listElement).find(itemSelector)); 17199 previous = previous[previous.length - 1]; 17200 } 17201 17202 var hideEvent = $.Event(Event$9.HIDE, { 17203 relatedTarget: this._element 17204 }); 17205 var showEvent = $.Event(Event$9.SHOW, { 17206 relatedTarget: previous 17207 }); 17208 17209 if (previous) { 17210 $(previous).trigger(hideEvent); 17211 } 17212 17213 $(this._element).trigger(showEvent); 17214 17215 if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { 17216 return; 17217 } 17218 17219 if (selector) { 17220 target = document.querySelector(selector); 17221 } 17222 17223 this._activate(this._element, listElement); 17224 17225 var complete = function complete() { 17226 var hiddenEvent = $.Event(Event$9.HIDDEN, { 17227 relatedTarget: _this._element 17228 }); 17229 var shownEvent = $.Event(Event$9.SHOWN, { 17230 relatedTarget: previous 17231 }); 17232 $(previous).trigger(hiddenEvent); 17233 $(_this._element).trigger(shownEvent); 17234 }; 17235 17236 if (target) { 17237 this._activate(target, target.parentNode, complete); 17238 } else { 17239 complete(); 17240 } 17241 }; 17242 17243 _proto.dispose = function dispose() { 17244 $.removeData(this._element, DATA_KEY$9); 17245 this._element = null; 17246 } // Private 17247 ; 17248 17249 _proto._activate = function _activate(element, container, callback) { 17250 var _this2 = this; 17251 17252 var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? $(container).find(Selector$9.ACTIVE_UL) : $(container).children(Selector$9.ACTIVE); 17253 var active = activeElements[0]; 17254 var isTransitioning = callback && active && $(active).hasClass(ClassName$9.FADE); 17255 17256 var complete = function complete() { 17257 return _this2._transitionComplete(element, active, callback); 17258 }; 17259 17260 if (active && isTransitioning) { 17261 var transitionDuration = Util.getTransitionDurationFromElement(active); 17262 $(active).removeClass(ClassName$9.SHOW).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 17263 } else { 17264 complete(); 17265 } 17266 }; 17267 17268 _proto._transitionComplete = function _transitionComplete(element, active, callback) { 17269 if (active) { 17270 $(active).removeClass(ClassName$9.ACTIVE);
17271 var dropdownChild = $(active.parentNode).find(Selector$9.DROPDOWN_ACTIVE_CHILD)[0]; 17272 17273 if (dropdownChild) { 17274 $(dropdownChild).removeClass(ClassName$9.ACTIVE); 17275 } 17276 17277 if (active.getAttribute('role') === 'tab') { 17278 active.setAttribute('aria-selected', false); 17279 } 17280 } 17281 17282 $(element).addClass(ClassName$9.ACTIVE); 17283 17284 if (element.getAttribute('role') === 'tab') { 17285 element.setAttribute('aria-selected', true); 17286 } 17287 17288 Util.reflow(element); 17289 17290 if (element.classList.contains(ClassName$9.FADE)) { 17291 element.classList.add(ClassName$9.SHOW); 17292 } 17293 17294 if (element.parentNode && $(element.parentNode).hasClass(ClassName$9.DROPDOWN_MENU)) { 17295 var dropdownElement = $(element).closest(Selector$9.DROPDOWN)[0]; 17296 17297 if (dropdownElement) { 17298 var dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector$9.DROPDOWN_TOGGLE)); 17299 $(dropdownToggleList).addClass(ClassName$9.ACTIVE); 17300 } 17301 17302 element.setAttribute('aria-expanded', true); 17303 } 17304 17305 if (callback) { 17306 callback(); 17307 } 17308 } // Static 17309 ; 17310 17311 Tab._jQueryInterface = function _jQueryInterface(config) { 17312 return this.each(function () { 17313 var $this = $(this); 17314 var data = $this.data(DATA_KEY$9); 17315 17316 if (!data) { 17317 data = new Tab(this); 17318 $this.data(DATA_KEY$9, data); 17319 } 17320 17321 if (typeof config === 'string') { 17322 if (typeof data[config] === 'undefined') { 17323 throw new TypeError("No method named \"" + config + "\""); 17324 } 17325 17326 data[config](); 17327 } 17328 }); 17329 }; 17330 17331 _createClass(Tab, null, [{ 17332 key: "VERSION", 17333 get: function get() { 17334 return VERSION$9; 17335 } 17336 }]); 17337 17338 return Tab; 17339 }(); 17340 /** 17341 * ------------------------------------------------------------------------ 17342 * Data Api implementation 17343 * ------------------------------------------------------------------------ 17344 */ 17345 17346 17347 $(document).on(Event$9.CLICK_DATA_API, Selector$9.DATA_TOGGLE, function (event) { 17348 event.preventDefault(); 17349 17350 Tab._jQueryInterface.call($(this), 'show'); 17351 }); 17352 /** 17353 * ------------------------------------------------------------------------ 17354 * jQuery 17355 * ------------------------------------------------------------------------ 17356 */ 17357 17358 $.fn[NAME$9] = Tab._jQueryInterface; 17359 $.fn[NAME$9].Constructor = Tab; 17360 17361 $.fn[NAME$9].noConflict = function () { 17362 $.fn[NAME$9] = JQUERY_NO_CONFLICT$9; 17363 return Tab._jQueryInterface; 17364 }; 17365 17366 /** 17367 * ------------------------------------------------------------------------ 17368 * Constants 17369 * ------------------------------------------------------------------------ 17370 */ 17371 17372 var NAME$a = 'toast'; 17373 var VERSION$a = '4.3.1'; 17374 var DATA_KEY$a = 'bs.toast'; 17375 var EVENT_KEY$a = "." + DATA_KEY$a; 17376 var JQUERY_NO_CONFLICT$a = $.fn[NAME$a]; 17377 var Event$a = { 17378 CLICK_DISMISS: "click.dismiss" + EVENT_KEY$a, 17379 HIDE: "hide" + EVENT_KEY$a, 17380 HIDDEN: "hidden" + EVENT_KEY$a, 17381 SHOW: "show" + EVENT_KEY$a, 17382 SHOWN: "shown" + EVENT_KEY$a 17383 }; 17384 var ClassName$a = { 17385 FADE: 'fade', 17386 HIDE: 'hide', 17387 SHOW: 'show', 17388 SHOWING: 'showing' 17389 }; 17390 var DefaultType$7 = { 17391 animation: 'boolean', 17392 autohide: 'boolean', 17393 delay: 'number' 17394 }; 17395 var Default$7 = { 17396 animation: true, 17397 autohide: true, 17398 delay: 500 17399 }; 17400 var Selector$a = { 17401 DATA_DISMISS: '[data-dismiss="toast"]' 17402 /** 17403 * ------------------------------------------------------------------------ 17404 * Class Definition 17405 * ------------------------------------------------------------------------ 17406 */ 17407 17408 }; 17409 17410 var Toast = 17411 /*#__PURE__*/ 17412 function () { 17413 function Toast(element, config) { 17414 this._element = element; 17415 this._config = this._getConfig(config); 17416 this._timeout = null; 17417 17418 this._setListeners(); 17419 } // Getters 17420 17421 17422 var _proto = Toast.prototype; 17423 17424 // Public 17425 _proto.show = function show() { 17426 var _this = this; 17427 17428 $(this._element).trigger(Event$a.SHOW); 17429 17430 if (this._config.animation) { 17431 this._element.classList.add(ClassName$a.FADE); 17432 } 17433 17434 var complete = function complete() { 17435 _this._element.classList.remove(ClassName$a.SHOWING); 17436 17437 _this._element.classList.add(ClassName$a.SHOW); 17438 17439 $(_this._element).trigger(Event$a.SHOWN); 17440 17441 if (_this._config.autohide) { 17442 _this.hide(); 17443 } 17444 }; 17445 17446 this._element.classList.remove(ClassName$a.HIDE); 17447 17448 this._element.classList.add(ClassName$a.SHOWING); 17449 17450 if (this._config.animation) { 17451 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 17452 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 17453 } else { 17454 complete(); 17455 } 17456 }; 17457 17458 _proto.hide = function hide(withoutTimeout) { 17459 var _this2 = this; 17460 17461 if (!this._element.classList.contains(ClassName$a.SHOW)) { 17462 return; 17463 } 17464 17465 $(this._element).trigger(Event$a.HIDE); 17466 17467 if (withoutTimeout) { 17468 this._close(); 17469 } else { 17470 this._timeout = setTimeout(function () { 17471 _this2._close(); 17472 }, this._config.delay); 17473 } 17474 }; 17475 17476 _proto.dispose = function dispose() { 17477 clearTimeout(this._timeout); 17478 this._timeout = null; 17479 17480 if (this._element.classList.contains(ClassName$a.SHOW)) { 17481 this._element.classList.remove(ClassName$a.SHOW); 17482 } 17483 17484 $(this._element).off(Event$a.CLICK_DISMISS); 17485 $.removeData(this._element, DATA_KEY$a); 17486 this._element = null; 17487 this._config = null; 17488 } // Private 17489 ; 17490 17491 _proto._getConfig = function _getConfig(config) { 17492 config = _objectSpread({}, Default$7, $(this._element).data(), typeof config === 'object' && config ? config : {}); 17493 Util.typeCheckConfig(NAME$a, config, this.constructor.DefaultType); 17494 return config; 17495 }; 17496 17497 _proto._setListeners = function _setListeners() { 17498 var _this3 = this; 17499 17500 $(this._element).on(Event$a.CLICK_DISMISS, Selector$a.DATA_DISMISS, function () { 17501 return _this3.hide(true); 17502 }); 17503 }; 17504 17505 _proto._close = function _close() { 17506 var _this4 = this; 17507 17508 var complete = function complete() { 17509 _this4._element.classList.add(ClassName$a.HIDE); 17510 17511 $(_this4._element).trigger(Event$a.HIDDEN); 17512 }; 17513 17514 this._element.classList.remove(ClassName$a.SHOW); 17515 17516 if (this._config.animation) { 17517 var transitionDuration = Util.getTransitionDurationFromElement(this._element); 17518 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(transitionDuration); 17519 } else { 17520 complete(); 17521 } 17522 } // Static 17523 ; 17524 17525 Toast._jQueryInterface = function _jQueryInterface(config) { 17526 return this.each(function () { 17527 var $element = $(this); 17528 var data = $element.data(DATA_KEY$a); 17529 17530 var _config = typeof config === 'object' && config; 17531 17532 if (!data) { 17533 data = new Toast(this, _config); 17534 $element.data(DATA_KEY$a, data); 17535 } 17536 17537 if (typeof config === 'string') { 17538 if (typeof data[config] === 'undefined') {
17539 throw new TypeError("No method named \"" + config + "\""); 17540 } 17541 17542 data[config](this); 17543 } 17544 }); 17545 }; 17546 17547 _createClass(Toast, null, [{ 17548 key: "VERSION", 17549 get: function get() { 17550 return VERSION$a; 17551 } 17552 }, { 17553 key: "DefaultType", 17554 get: function get() { 17555 return DefaultType$7; 17556 } 17557 }, { 17558 key: "Default", 17559 get: function get() { 17560 return Default$7; 17561 } 17562 }]); 17563 17564 return Toast; 17565 }(); 17566 /** 17567 * ------------------------------------------------------------------------ 17568 * jQuery 17569 * ------------------------------------------------------------------------ 17570 */ 17571 17572 17573 $.fn[NAME$a] = Toast._jQueryInterface; 17574 $.fn[NAME$a].Constructor = Toast; 17575 17576 $.fn[NAME$a].noConflict = function () { 17577 $.fn[NAME$a] = JQUERY_NO_CONFLICT$a; 17578 return Toast._jQueryInterface; 17579 }; 17580 17581 /** 17582 * -------------------------------------------------------------------------- 17583 * Bootstrap (v4.3.1): index.js 17584 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 17585 * -------------------------------------------------------------------------- 17586 */ 17587 17588 (function () { 17589 if (typeof $ === 'undefined') { 17590 throw new TypeError('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.'); 17591 } 17592 17593 var version = $.fn.jquery.split(' ')[0].split('.'); 17594 var minMajor = 1; 17595 var ltMajor = 2; 17596 var minMinor = 9; 17597 var minPatch = 1; 17598 var maxMajor = 4; 17599 17600 if (version[0] < ltMajor && version[1] < minMinor || version[0] === minMajor && version[1] === minMinor && version[2] < minPatch || version[0] >= maxMajor) { 17601 throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0'); 17602 } 17603 })(); 17604 17605 exports.Util = Util; 17606 exports.Alert = Alert; 17607 exports.Button = Button; 17608 exports.Carousel = Carousel; 17609 exports.Collapse = Collapse; 17610 exports.Dropdown = Dropdown; 17611 exports.Modal = Modal; 17612 exports.Popover = Popover; 17613 exports.Scrollspy = ScrollSpy; 17614 exports.Tab = Tab; 17615 exports.Toast = Toast; 17616 exports.Tooltip = Tooltip; 17617 17618 Object.defineProperty(exports, '__esModule', { value: true }); 17619 17620})); 17621//# sourceMappingURL=bootstrap.js.map 17622 17623/** 17624The YUI module contains the components required for building the YUI seed file. 17625This includes the script loading mechanism, a simple queue, and the core 17626utilities for the library. 17627 17628@module yui 17629@main yui 17630@submodule yui-base 17631**/ 17632 17633/*jshint eqeqeq: false*/ 17634if (typeof YUI != 'undefined') { 17635 YUI._YUI = YUI; 17636} 17637 17638/** 17639The YUI global namespace object. This is the constructor for all YUI instances. 17640 17641This is a self-instantiable factory function, meaning you don't need to precede 17642it with the `new` operator. You can invoke it directly like this: 17643 17644 YUI().use('*', function (Y) { 17645 // Y is a new YUI instance. 17646 }); 17647 17648But it also works like this: 17649 17650 var Y = YUI(); 17651 17652The `YUI` constructor accepts an optional config object, like this: 17653 17654 YUI({ 17655 debug: true, 17656 combine: false 17657 }).use('node', function (Y) { 17658 // Y.Node is ready to use. 17659 }); 17660 17661See the API docs for the <a href="config.html">Config</a> class for the complete 17662list of supported configuration properties accepted by the YUI constuctor. 17663 17664If a global `YUI` object is already defined, the existing YUI object will not be 17665overwritten, to ensure that defined namespaces are preserved. 17666 17667Each YUI instance has full custom event support, but only if the event system is 17668available. 17669 17670@class YUI 17671@uses EventTarget 17672@constructor 17673@global 17674@param {Object} [config]* Zero or more optional configuration objects. Config 17675 values are stored in the `Y.config` property. See the 17676 <a href="config.html">Config</a> docs for the list of supported properties. 17677**/ 17678 17679 /*global YUI*/ 17680 /*global YUI_config*/ 17681 var YUI = function() { 17682 var i = 0, 17683 Y = this, 17684 args = arguments, 17685 l = args.length, 17686 instanceOf = function(o, type) { 17687 return (o && o.hasOwnProperty && (o instanceof type)); 17688 }, 17689 gconf = (typeof YUI_config !== 'undefined') && YUI_config; 17690 17691 if (!(instanceOf(Y, YUI))) { 17692 Y = new YUI(); 17693 } else { 17694 // set up the core environment 17695 Y._init(); 17696 17697 /** 17698 Master configuration that might span multiple contexts in a non- 17699 browser environment. It is applied first to all instances in all 17700 contexts. 17701 17702 @example 17703 17704 YUI.GlobalConfig = { 17705 filter: 'debug' 17706 }; 17707 17708 YUI().use('node', function (Y) { 17709 // debug files used here 17710 }); 17711 17712 YUI({ 17713 filter: 'min' 17714 }).use('node', function (Y) { 17715 // min files used here 17716 }); 17717 17718 @property {Object} GlobalConfig 17719 @global 17720 @static 17721 **/ 17722 if (YUI.GlobalConfig) { 17723 Y.applyConfig(YUI.GlobalConfig); 17724 } 17725 17726 /** 17727 Page-level config applied to all YUI instances created on the 17728 current page. This is applied after `YUI.GlobalConfig` and before 17729 any instance-level configuration. 17730 17731 @example 17732 17733 // Single global var to include before YUI seed file 17734 YUI_config = { 17735 filter: 'debug' 17736 }; 17737 17738 YUI().use('node', function (Y) { 17739 // debug files used here 17740 }); 17741 17742 YUI({ 17743 filter: 'min' 17744 }).use('node', function (Y) { 17745 // min files used here 17746 }); 17747 17748 @property {Object} YUI_config 17749 @global 17750 **/ 17751 if (gconf) { 17752 Y.applyConfig(gconf); 17753 } 17754 17755 // bind the specified additional modules for this instance 17756 if (!l) { 17757 Y._afterConfig(); 17758 Y._setup(); 17759 } 17760 } 17761 17762 if (l) { 17763 // Each instance can accept one or more configuration objects. 17764 // These are applied after YUI.GlobalConfig and YUI_Config, 17765 // overriding values set in those config files if there is a 17766 // matching property. 17767 for (; i < l; i++) { 17768 Y.applyConfig(args[i]); 17769 } 17770 17771 Y._afterConfig(); 17772 Y._setup(); 17773 } 17774 17775 Y.instanceOf = instanceOf; 17776 17777 return Y; 17778 }; 17779 17780(function() { 17781 17782 var proto, prop, 17783 VERSION = 'patched-v3.18.1', 17784 PERIOD = '.', 17785 BASE = 'http://yui.yahooapis.com/', 17786 /* 17787 These CSS class names can't be generated by 17788 getClassName since it is not available at the 17789 time they are being used. 17790 */ 17791 DOC_LABEL = 'yui3-js-enabled', 17792 CSS_STAMP_EL = 'yui3-css-stamp', 17793 NOOP = function() {}, 17794 SLICE = Array.prototype.slice, 17795 APPLY_TO_AUTH = { 'io.xdrReady': 1, // the functions applyTo 17796 'io.xdrResponse': 1, // can call. this should 17797 'SWF.eventHandler': 1 }, // be done at build time 17798 hasWin = (typeof window != 'undefined'), 17799 win = (hasWin) ? window : null, 17800 doc = (hasWin) ? win.document : null, 17801 docEl = doc && doc.documentElement, 17802 docClass = docEl && docEl.className, 17803 instances = {}, 17804 time = new Date().getTime(), 17805 add = function(el, type, fn, capture) { 17806 if (el && el.addEventListener) { 17807 el.addEventListener(type, fn, capture); 17808 } else if (el && el.attachEvent) { 17809 el.attachEvent('on' + type, fn); 17810 } 17811 }, 17812 remove = function(el, type, fn, capture) { 17813 if (el && el.removeEventListener) { 17814 // this can throw an uncaught exception in FF 17815 try { 17816 el.removeEventListener(type, fn, capture); 17817 } catch (ex) {} 17818 } else if (el && el.detachEvent) { 17819 el.detachEvent('on' + type, fn); 17820 } 17821 }, 17822 handleReady = function() { 17823 YUI.Env.DOMReady = true; 17824 if (hasWin) { 17825 remove(doc, 'DOMContentLoaded', handleReady); 17826 } 17827 }, 17828 handleLoad = function() { 17829 YUI.Env.windowLoaded = true; 17830 YUI.Env.DOMReady = true; 17831 if (hasWin) { 17832 remove(window, 'load', handleLoad); 17833 } 17834 }, 17835 getLoader = function(Y, o) { 17836 var loader = Y.Env._loader, 17837 lCore = [ 'loader-base' ], 17838 G_ENV = YUI.Env, 17839 mods = G_ENV.mods; 17840 17841 if (loader) { 17842 //loader._config(Y.config); 17843 loader.ignoreRegistered = false;
17844 loader.onEnd = null; 17845 loader.data = null; 17846 loader.required = []; 17847 loader.loadType = null; 17848 } else { 17849 loader = new Y.Loader(Y.config); 17850 Y.Env._loader = loader; 17851 } 17852 if (mods && mods.loader) { 17853 lCore = [].concat(lCore, YUI.Env.loaderExtras); 17854 } 17855 YUI.Env.core = Y.Array.dedupe([].concat(YUI.Env.core, lCore)); 17856 17857 return loader; 17858 }, 17859 17860 clobber = function(r, s) { 17861 for (var i in s) { 17862 if (s.hasOwnProperty(i)) { 17863 r[i] = s[i]; 17864 } 17865 } 17866 }, 17867 17868 ALREADY_DONE = { success: true }; 17869 17870// Stamp the documentElement (HTML) with a class of "yui-loaded" to 17871// enable styles that need to key off of JS being enabled. 17872if (docEl && docClass.indexOf(DOC_LABEL) == -1) { 17873 if (docClass) { 17874 docClass += ' '; 17875 } 17876 docClass += DOC_LABEL; 17877 docEl.className = docClass; 17878} 17879 17880if (VERSION.indexOf('@') > -1) { 17881 VERSION = '3.5.0'; // dev time hack for cdn test 17882} 17883 17884proto = { 17885 /** 17886 Applies a new configuration object to the config of this YUI instance. This 17887 will merge new group/module definitions, and will also update the loader 17888 cache if necessary. Updating `Y.config` directly will not update the cache. 17889 17890 @method applyConfig 17891 @param {Object} o the configuration object. 17892 @since 3.2.0 17893 **/ 17894 applyConfig: function(o) { 17895 17896 o = o || NOOP; 17897 17898 var attr, 17899 name, 17900 // detail, 17901 config = this.config, 17902 mods = config.modules, 17903 groups = config.groups, 17904 aliases = config.aliases, 17905 loader = this.Env._loader; 17906 17907 for (name in o) { 17908 if (o.hasOwnProperty(name)) { 17909 attr = o[name]; 17910 if (mods && name == 'modules') { 17911 clobber(mods, attr); 17912 } else if (aliases && name == 'aliases') { 17913 clobber(aliases, attr); 17914 } else if (groups && name == 'groups') { 17915 clobber(groups, attr); 17916 } else if (name == 'win') { 17917 config[name] = (attr && attr.contentWindow) || attr; 17918 config.doc = config[name] ? config[name].document : null; 17919 } else if (name == '_yuid') { 17920 // preserve the guid 17921 } else { 17922 config[name] = attr; 17923 } 17924 } 17925 } 17926 17927 if (loader) { 17928 loader._config(o); 17929 } 17930 17931 }, 17932 17933 /** 17934 Old way to apply a config to this instance (calls `applyConfig` under the 17935 hood). 17936 17937 @private 17938 @method _config 17939 @param {Object} o The config to apply 17940 **/ 17941 _config: function(o) { 17942 this.applyConfig(o); 17943 }, 17944 17945 /** 17946 Initializes this YUI instance. 17947 17948 @private 17949 @method _init 17950 **/ 17951 _init: function() { 17952 var filter, el, 17953 Y = this, 17954 G_ENV = YUI.Env, 17955 Env = Y.Env, 17956 prop; 17957 17958 /** 17959 The version number of this YUI instance. 17960 17961 This value is typically updated by a script when a YUI release is built, 17962 so it may not reflect the correct version number when YUI is run from 17963 the development source tree. 17964 17965 @property {String} version 17966 **/ 17967 Y.version = VERSION; 17968 17969 if (!Env) { 17970 Y.Env = { 17971 core: ['get', 'features', 'intl-base', 'yui-log', 'yui-later', 'loader-base', 'loader-rollup', 'loader-yui3'], 17972 loaderExtras: ['loader-rollup', 'loader-yui3'], 17973 mods: {}, // flat module map 17974 versions: {}, // version module map 17975 base: BASE, 17976 cdn: BASE + VERSION + '/', 17977 // bootstrapped: false, 17978 _idx: 0, 17979 _used: {}, 17980 _attached: {}, 17981 _exported: {}, 17982 _missed: [], 17983 _yidx: 0, 17984 _uidx: 0, 17985 _guidp: 'y', 17986 _loaded: {}, 17987 // serviced: {},
17988 // Regex in English: 17989 // I'll start at the \b(yui). 17990 // 1. Look in the test string for "yui" or 17991 // "yui-base" or "yui-davglass" or "yui-foobar" that comes after a word break. That is, it 17992 // can't match "foyui" or "i_heart_yui". This can be anywhere in the string. 17993 // 2. After #1 must come a forward slash followed by the string matched in #1, so 17994 // "yui-base/yui-base" or "yui-pants/yui-pants". 17995 // 3. The second occurence of the #1 token can optionally be followed by "-debug" or "-min", 17996 // so "yui/yui-min", "yui/yui-debug", "yui-base/yui-base-debug". NOT "yui/yui-tshirt". 17997 // 4. This is followed by ".js", so "yui/yui.js". 17998 // 0. Going back to the beginning, now. If all that stuff in 1-4 comes after a "?" in the string, 17999 // then capture the junk between the LAST "&" and the string in 1-4. So 18000 // "blah?foo/yui/yui.js" will capture "foo/" and "blah?some/thing.js&3.3.0/build/yui-davglass/yui-davglass.js" 18001 // will capture "3.3.0/build/" 18002 // 18003 // Regex Exploded: 18004 // (?:\? Find a ? 18005 // (?:[^&]*&) followed by 0..n characters followed by an & 18006 // * in fact, find as many sets of characters followed by a & as you can 18007 // ([^&]*) capture the stuff after the last & in \1 18008 // )? but it's ok if all this ?junk&more_junk stuff isn't even there 18009 // \b( after a word break find either the string 18010 // yui(?:-\w+)? "yui" optionally followed by a -, then more characters 18011 // ) and store the yui-* string in \2 18012 // \/\2 then comes a / followed by the yui-* string in \2 18013 // (?:-(min|debug))? optionally followed by "-min" or "-debug" 18014 // .js and ending in ".js" 18015 _BASE_RE: /(?:\?(?:[^&]*&)*([^&]*))?\b(aui|yui(?:-\w+)?)\/\2(?:-(min|debug))?\.js/, 18016 parseBasePath: function(src, pattern) { 18017 var match = src.match(pattern), 18018 path, filter; 18019 18020 if (match) { 18021 path = RegExp.leftContext || src.slice(0, src.indexOf(match[0])); 18022 18023 // this is to set up the path to the loader. The file 18024 // filter for loader should match the yui include. 18025 filter = match[3]; 18026 18027 // extract correct path for mixed combo urls 18028 // http://yuilibrary.com/projects/yui3/ticket/2528423 18029 if (match[1]) { 18030 path += '?' + match[1]; 18031 } 18032 path = { 18033 filter: filter, 18034 path: path 18035 }; 18036 } 18037 return path; 18038 }, 18039 getBase: G_ENV && G_ENV.getBase || 18040 function(pattern) { 18041 var nodes = (doc && doc.getElementsByTagName('script')) || [], 18042 path = Env.cdn, parsed, 18043 i, len, src; 18044 18045 for (i = 0, len = nodes.length; i < len; ++i) { 18046 src = nodes[i].src; 18047 if (src) { 18048 parsed = Y.Env.parseBasePath(src, pattern); 18049 if (parsed) { 18050 filter = parsed.filter; 18051 path = parsed.path; 18052 break; 18053 } 18054 } 18055 } 18056 18057 // use CDN default 18058 return path; 18059 } 18060 18061 }; 18062 18063 Env = Y.Env; 18064 18065 Env._loaded[VERSION] = {}; 18066 18067 if (G_ENV && Y !== YUI) { 18068 Env._yidx = ++G_ENV._yidx; 18069 Env._guidp = ('yui_' + VERSION + '_' + 18070 Env._yidx + '_' + time).replace(/[^a-z0-9_]+/g, '_'); 18071 } else if (YUI._YUI) { 18072 18073 G_ENV = YUI._YUI.Env; 18074 Env._yidx += G_ENV._yidx; 18075 Env._uidx += G_ENV._uidx; 18076 18077 for (prop in G_ENV) {
18078 if (!(prop in Env)) { 18079 Env[prop] = G_ENV[prop]; 18080 } 18081 } 18082 18083 delete YUI._YUI; 18084 } 18085 18086 Y.id = Y.stamp(Y); 18087 instances[Y.id] = Y; 18088 18089 } 18090 18091 Y.constructor = YUI; 18092 18093 // configuration defaults 18094 Y.config = Y.config || { 18095 bootstrap: true, 18096 cacheUse: true, 18097 debug: true, 18098 doc: doc, 18099 fetchCSS: true, 18100 throwFail: true, 18101 useBrowserConsole: true, 18102 useNativeES5: true, 18103 win: win 18104 }; 18105 18106 //Register the CSS stamp element 18107 if (doc && !doc.getElementById(CSS_STAMP_EL)) { 18108 el = doc.createElement('div'); 18109 el.innerHTML = '<div id="' + CSS_STAMP_EL + '" style="position: absolute !important; visibility: hidden !important"></div>'; 18110 YUI.Env.cssStampEl = el.firstChild; 18111 if (doc.body) { 18112 doc.body.appendChild(YUI.Env.cssStampEl); 18113 } else { 18114 docEl.insertBefore(YUI.Env.cssStampEl, docEl.firstChild); 18115 } 18116 } else if (doc && doc.getElementById(CSS_STAMP_EL) && !YUI.Env.cssStampEl) { 18117 YUI.Env.cssStampEl = doc.getElementById(CSS_STAMP_EL); 18118 } 18119 18120 Y.config.lang = Y.config.lang || 'en-US'; 18121 18122 Y.config.base = YUI.config.base || 18123 (YUI.config.defaultBase && YUI.config.root && YUI.config.defaultBase + YUI.config.root) || 18124 Y.Env.getBase(Y.Env._BASE_RE); 18125 18126 if (!filter || (!('mindebug').indexOf(filter))) { 18127 filter = 'min'; 18128 } 18129 filter = (filter) ? '-' + filter : filter; 18130 Y.config.loaderPath = YUI.config.loaderPath || 'loader/loader' + filter + '.js'; 18131 18132 }, 18133 18134 /** 18135 This method is called after all other configuration has been applied to 18136 the YUI instance. 18137 18138 @method _afterConfig 18139 @private 18140 **/ 18141 _afterConfig: function () { 18142 var Y = this; 18143 18144 // We need to set up Y.config.global after the rest of the configuration 18145 // so that setting it in user configuration prevents the library from 18146 // using eval(). This is critical for Content Security Policy enabled 18147 // sites and other environments like Chrome extensions 18148 if (!Y.config.hasOwnProperty('global')) { 18149 Y.config.global = Function('return this')(); 18150 } 18151 }, 18152 18153 /** 18154 Finishes the instance setup. Attaches whatever YUI modules were defined 18155 at the time that this instance was created. 18156 18157 @method _setup 18158 @private 18159 **/ 18160 _setup: function() { 18161 var i, Y = this, 18162 core = [], 18163 mods = YUI.Env.mods, 18164 extendedCore = Y.config.extendedCore || [], 18165 extras = Y.config.core || [].concat(YUI.Env.core).concat(extendedCore); //Clone it.. 18166 18167 for (i = 0; i < extras.length; i++) { 18168 if (mods[extras[i]]) { 18169 core.push(extras[i]); 18170 } 18171 } 18172 18173 Y._attach(['yui-base']); 18174 Y._attach(core); 18175 18176 if (Y.Loader) { 18177 getLoader(Y); 18178 } 18179 18180 }, 18181 18182 /** 18183 Executes the named method on the specified YUI instance if that method is 18184 whitelisted. 18185 18186 @method applyTo 18187 @param {String} id YUI instance id. 18188 @param {String} method Name of the method to execute. For example: 18189 'Object.keys'. 18190 @param {Array} args Arguments to apply to the method. 18191 @return {Mixed} Return value from the applied method, or `null` if the 18192 specified instance was not found or the method was not whitelisted. 18193 **/ 18194 applyTo: function(id, method, args) { 18195 if (!(method in APPLY_TO_AUTH)) { 18196 this.log(method + ': applyTo not allowed', 'warn', 'yui'); 18197 return null; 18198 } 18199 18200 var instance = instances[id], nest, m, i; 18201 if (instance) { 18202 nest = method.split('.'); 18203 m = instance; 18204 for (i = 0; i < nest.length; i = i + 1) { 18205 m = m[nest[i]]; 18206 if (!m) { 18207 this.log('applyTo not found: ' + method, 'warn', 'yui'); 18208 } 18209 } 18210 return m && m.apply(instance, args); 18211 } 18212 18213 return null; 18214 }, 18215 18216/** 18217Registers a YUI module and makes it available for use in a `YUI().use()` call or 18218as a dependency for other modules. 18219 18220The easiest way to create a first-class YUI module is to use 18221<a href="http://yui.github.com/shifter/">Shifter</a>, the YUI component build 18222tool. 18223 18224Shifter will automatically wrap your module code in a `YUI.add()` call along 18225with any configuration info required for the module. 18226 18227@example 18228 18229 YUI.add('davglass', function (Y) { 18230 Y.davglass = function () { 18231 }; 18232 }, '3.4.0', { 18233 requires: ['harley-davidson', 'mt-dew'] 18234 }); 18235 18236@method add 18237@param {String} name Module name. 18238@param {Function} fn Function containing module code. This function will be 18239 executed whenever the module is attached to a specific YUI instance. 18240 18241 @param {YUI} fn.Y The YUI instance to which this module is attached.
18242 @param {String} fn.name Name of the module 18243 18244@param {String} version Module version number. This is currently used only for 18245 informational purposes, and is not used internally by YUI. 18246 18247@param {Object} [details] Module config. 18248 @param {Array} [details.requires] Array of other module names that must be 18249 attached before this module can be attached. 18250 @param {Array} [details.optional] Array of optional module names that should 18251 be attached before this module is attached if they've already been 18252 loaded. If the `loadOptional` YUI option is `true`, optional modules 18253 that have not yet been loaded will be loaded just as if they were hard 18254 requirements. 18255 @param {Array} [details.use] Array of module names that are included within 18256 or otherwise provided by this module, and which should be attached 18257 automatically when this module is attached. This makes it possible to 18258 create "virtual rollup" modules that simply attach a collection of other 18259 modules or submodules. 18260 18261@return {YUI} This YUI instance. 18262**/ 18263 add: function(name, fn, version, details) { 18264 details = details || {}; 18265 var env = YUI.Env, 18266 mod = { 18267 name: name, 18268 fn: fn, 18269 version: version, 18270 details: details 18271 }, 18272 //Instance hash so we don't apply it to the same instance twice 18273 applied = {}, 18274 loader, inst, modInfo, 18275 i, versions = env.versions; 18276 18277 env.mods[name] = mod; 18278 versions[version] = versions[version] || {}; 18279 versions[version][name] = mod; 18280 18281 for (i in instances) { 18282 if (instances.hasOwnProperty(i)) { 18283 inst = instances[i]; 18284 if (!applied[inst.id]) { 18285 applied[inst.id] = true; 18286 loader = inst.Env._loader; 18287 if (loader) { 18288 modInfo = loader.getModuleInfo(name); 18289 if (!modInfo || modInfo.temp) { 18290 loader.addModule(details, name); 18291 } 18292 } 18293 } 18294 } 18295 } 18296 18297 return this; 18298 }, 18299 18300 /** 18301 Executes the callback function associated with each required module, 18302 attaching the module to this YUI instance. 18303 18304 @method _attach 18305 @param {Array} r The array of modules to attach 18306 @param {Boolean} [moot=false] If `true`, don't throw a warning if the module 18307 is not attached. 18308 @private 18309 **/ 18310 _attach: function(r, moot) { 18311 var i, name, mod, details, req, use, after, 18312 mods = YUI.Env.mods, 18313 aliases = YUI.Env.aliases, 18314 Y = this, j, 18315 cache = YUI.Env._renderedMods, 18316 loader = Y.Env._loader, 18317 done = Y.Env._attached, 18318 exported = Y.Env._exported, 18319 len = r.length, loader, def, go, 18320 c = [], 18321 modArgs, esCompat, reqlen, modInfo, 18322 condition, 18323 __exports__, __imports__; 18324 18325 //Check for conditional modules (in a second+ instance) and add their requirements 18326 //TODO I hate this entire method, it needs to be fixed ASAP (3.5.0) ^davglass 18327 for (i = 0; i < len; i++) { 18328 name = r[i]; 18329 mod = mods[name]; 18330 c.push(name); 18331 if (loader && loader.conditions[name]) { 18332 for (j in loader.conditions[name]) { 18333 if (loader.conditions[name].hasOwnProperty(j)) { 18334 def = loader.conditions[name][j]; 18335 go = def && ((def.ua && Y.UA[def.ua]) || (def.test && def.test(Y))); 18336 if (go) { 18337 c.push(def.name); 18338 } 18339 } 18340 } 18341 } 18342 } 18343 r = c; 18344 len = r.length; 18345 18346 for (i = 0; i < len; i++) { 18347 if (!done[r[i]]) { 18348 name = r[i]; 18349 mod = mods[name]; 18350 18351 if (aliases && aliases[name] && !mod) { 18352 Y._attach(aliases[name]); 18353 continue; 18354 } 18355 if (!mod) { 18356 modInfo = loader && loader.getModuleInfo(name); 18357 if (modInfo) { 18358 mod = modInfo; 18359 moot = true; 18360 } 18361 18362 18363 //if (!loader || !loader.moduleInfo[name]) { 18364 //if ((!loader || !loader.moduleInfo[name]) && !moot) { 18365 if (!moot && name) { 18366 if ((name.indexOf('skin-') === -1) && (name.indexOf('css') === -1)) { 18367 Y.Env._missed.push(name); 18368 Y.Env._missed = Y.Array.dedupe(Y.Env._missed); 18369 Y.message('NOT loaded: ' + name, 'warn', 'yui'); 18370 } 18371 } 18372 } else { 18373 done[name] = true; 18374 //Don't like this, but in case a mod was asked for once, then we fetch it 18375 //We need to remove it from the missed list ^davglass 18376 for (j = 0; j < Y.Env._missed.length; j++) { 18377 if (Y.Env._missed[j] === name) {
18378 Y.message('Found: ' + name + ' (was reported as missing earlier)', 'warn', 'yui'); 18379 Y.Env._missed.splice(j, 1); 18380 } 18381 } 18382 18383 // Optional dependencies normally work by modifying the 18384 // dependency list of a module. If the dependency's test 18385 // passes it is added to the list. If not, it's not loaded. 18386 // This following check ensures that optional dependencies 18387 // are not attached when they were already loaded into the 18388 // page (when bundling for example) 18389 if (loader && !loader._canBeAttached(name)) { 18390 return true; 18391 } 18392 18393 /* 18394 If it's a temp module, we need to redo it's requirements if it's already loaded 18395 since it may have been loaded by another instance and it's dependencies might 18396 have been redefined inside the fetched file. 18397 */ 18398 if (loader && cache && cache[name] && cache[name].temp) { 18399 loader.getRequires(cache[name]); 18400 req = []; 18401 modInfo = loader.getModuleInfo(name); 18402 for (j in modInfo.expanded_map) { 18403 if (modInfo.expanded_map.hasOwnProperty(j)) { 18404 req.push(j); 18405 } 18406 } 18407 Y._attach(req); 18408 } 18409 18410 details = mod.details; 18411 req = details.requires; 18412 esCompat = details.es; 18413 use = details.use; 18414 after = details.after; 18415 //Force Intl load if there is a language (Loader logic) @todo fix this shit 18416 if (details.lang) { 18417 req = req || []; 18418 req.unshift('intl'); 18419 } 18420 18421 if (req) { 18422 reqlen = req.length; 18423 for (j = 0; j < reqlen; j++) { 18424 if (!done[req[j]]) { 18425 if (!Y._attach(req)) { 18426 return false; 18427 } 18428 break; 18429 } 18430 } 18431 } 18432 18433 if (after) { 18434 for (j = 0; j < after.length; j++) { 18435 if (!done[after[j]]) { 18436 if (!Y._attach(after, true)) { 18437 return false; 18438 } 18439 break; 18440 } 18441 } 18442 } 18443 18444 if (mod.fn) { 18445 modArgs = [Y, name]; 18446 if (esCompat) { 18447 __imports__ = {}; 18448 __exports__ = {}; 18449 // passing `exports` and `imports` onto the module function 18450 modArgs.push(__imports__, __exports__); 18451 if (req) { 18452 reqlen = req.length; 18453 for (j = 0; j < reqlen; j++) { 18454 __imports__[req[j]] = exported.hasOwnProperty(req[j]) ? exported[req[j]] : Y; 18455 } 18456 } 18457 } 18458 if (Y.config.throwFail) { 18459 __exports__ = mod.fn.apply(esCompat ? undefined : mod, modArgs); 18460 } else { 18461 try { 18462 __exports__ = mod.fn.apply(esCompat ? undefined : mod, modArgs); 18463 } catch (e) { 18464 Y.error('Attach error: ' + name, e, name); 18465 return false;
18466 } 18467 } 18468 if (esCompat) { 18469 // store the `exports` in case others `es` modules requires it 18470 exported[name] = __exports__; 18471 18472 // If an ES module is conditionally loaded and set 18473 // to be used "instead" another module, replace the 18474 // trigger module's content with the conditionally 18475 // loaded one so the values returned by require() 18476 // still makes sense 18477 condition = mod.details.condition; 18478 if (condition && condition.when === 'instead') { 18479 exported[condition.trigger] = __exports__; 18480 } 18481 } 18482 } 18483 18484 if (use) { 18485 for (j = 0; j < use.length; j++) { 18486 if (!done[use[j]]) { 18487 if (!Y._attach(use)) { 18488 return false; 18489 } 18490 break; 18491 } 18492 } 18493 } 18494 18495 18496 18497 } 18498 } 18499 } 18500 18501 return true; 18502 }, 18503 18504 /** 18505 Delays the `use` callback until another event has taken place such as 18506 `window.onload`, `domready`, `contentready`, or `available`. 18507 18508 @private 18509 @method _delayCallback 18510 @param {Function} cb The original `use` callback. 18511 @param {String|Object} until Either an event name ('load', 'domready', etc.) 18512 or an object containing event/args keys for contentready/available. 18513 @return {Function} 18514 **/ 18515 _delayCallback: function(cb, until) { 18516 18517 var Y = this, 18518 mod = ['event-base']; 18519 18520 until = (Y.Lang.isObject(until) ? until : { event: until }); 18521 18522 if (until.event === 'load') { 18523 mod.push('event-synthetic'); 18524 } 18525 18526 return function() { 18527 var args = arguments; 18528 Y._use(mod, function() { 18529 Y.on(until.event, function() { 18530 args[1].delayUntil = until.event; 18531 cb.apply(Y, args); 18532 }, until.args); 18533 }); 18534 }; 18535 }, 18536 18537 /** 18538 Attaches one or more modules to this YUI instance. When this is executed, 18539 the requirements of the desired modules are analyzed, and one of several 18540 things can happen: 18541 18542 18543 * All required modules have already been loaded, and just need to be 18544 attached to this YUI instance. In this case, the `use()` callback will 18545 be executed synchronously after the modules are attached. 18546 18547 * One or more modules have not yet been loaded, or the Get utility is not 18548 available, or the `bootstrap` config option is `false`. In this case, 18549 a warning is issued indicating that modules are missing, but all 18550 available modules will still be attached and the `use()` callback will 18551 be executed synchronously. 18552 18553 * One or more modules are missing and the Loader is not available but the 18554 Get utility is, and `bootstrap` is not `false`. In this case, the Get 18555 utility will be used to load the Loader, and we will then proceed to 18556 the following state: 18557 18558 * One or more modules are missing and the Loader is available. In this 18559 case, the Loader will be used to resolve the dependency tree for the 18560 missing modules and load them and their dependencies. When the Loader is 18561 finished loading modules, the `use()` callback will be executed 18562 asynchronously. 18563 18564 @example 18565 18566 // Loads and attaches dd and its dependencies. 18567 YUI().use('dd', function (Y) { 18568 // ... 18569 }); 18570 18571 // Loads and attaches dd and node as well as all of their dependencies. 18572 YUI().use(['dd', 'node'], function (Y) { 18573 // ... 18574 }); 18575 18576 // Attaches all modules that have already been loaded. 18577 YUI().use('*', function (Y) { 18578 // ... 18579 }); 18580 18581 // Attaches a gallery module. 18582 YUI().use('gallery-yql', function (Y) { 18583 // ... 18584 }); 18585 18586 // Attaches a YUI 2in3 module. 18587 YUI().use('yui2-datatable', function (Y) { 18588 // ... 18589 }); 18590 18591 @method use 18592 @param {String|Array} modules* One or more module names to attach. 18593 @param {Function} [callback] Callback function to be executed once all 18594 specified modules and their dependencies have been attached.
18595 @param {YUI} callback.Y The YUI instance created for this sandbox. 18596 @param {Object} callback.status Object containing `success`, `msg` and 18597 `data` properties. 18598 @chainable 18599 **/ 18600 use: function() { 18601 var args = SLICE.call(arguments, 0), 18602 callback = args[args.length - 1], 18603 Y = this, 18604 i = 0, 18605 name, 18606 Env = Y.Env, 18607 provisioned = true; 18608 18609 // The last argument supplied to use can be a load complete callback 18610 if (Y.Lang.isFunction(callback)) { 18611 args.pop(); 18612 if (Y.config.delayUntil) { 18613 callback = Y._delayCallback(callback, Y.config.delayUntil); 18614 } 18615 } else { 18616 callback = null; 18617 } 18618 if (Y.Lang.isArray(args[0])) { 18619 args = args[0]; 18620 } 18621 18622 if (Y.config.cacheUse) { 18623 while ((name = args[i++])) { 18624 if (!Env._attached[name]) { 18625 provisioned = false; 18626 break; 18627 } 18628 } 18629 18630 if (provisioned) { 18631 if (args.length) { 18632 } 18633 Y._notify(callback, ALREADY_DONE, args); 18634 return Y; 18635 } 18636 } 18637 18638 if (Y._loading) { 18639 Y._useQueue = Y._useQueue || new Y.Queue(); 18640 Y._useQueue.add([args, callback]); 18641 } else { 18642 Y._use(args, function(Y, response) { 18643 Y._notify(callback, response, args); 18644 }); 18645 } 18646 18647 return Y; 18648 }, 18649 18650 /** 18651 Sugar for loading both legacy and ES6-based YUI modules. 18652 18653 @method require 18654 @param {String} [modules*] List of module names to import or a single 18655 module name. 18656 @param {Function} callback Callback that gets called once all the modules 18657 were loaded. Each parameter of the callback is the export value of the 18658 corresponding module in the list. If the module is a legacy YUI module, 18659 the YUI instance is used instead of the module exports. 18660 @example 18661 ``` 18662 YUI().require(['es6-set'], function (Y, imports) { 18663 var Set = imports.Set, 18664 set = new Set(); 18665 }); 18666 ``` 18667 **/ 18668 require: function () { 18669 var args = SLICE.call(arguments), 18670 callback; 18671 18672 if (typeof args[args.length - 1] === 'function') { 18673 callback = args.pop(); 18674 18675 // only add the callback if one was provided 18676 // YUI().require('foo'); is valid 18677 args.push(function (Y) { 18678 var i, length = args.length, 18679 exported = Y.Env._exported, 18680 __imports__ = {}; 18681 18682 // Get only the imports requested as arguments 18683 for (i = 0; i < length; i++) { 18684 if (exported.hasOwnProperty(args[i])) { 18685 __imports__[args[i]] = exported[args[i]]; 18686 } 18687 } 18688 18689 // Using `undefined` because: 18690 // - Using `Y.config.global` would force the value of `this` to be 18691 // the global object even in strict mode 18692 // - Using `Y` goes against the goal of moving away from a shared 18693 // object and start thinking in terms of imported and exported 18694 // objects 18695 callback.call(undefined, Y, __imports__); 18696 }); 18697 } 18698 // Do not return the Y object. This makes it hard to follow this 18699 // traditional pattern: 18700 // var Y = YUI().use(...); 18701 // This is a good idea in the light of ES6 modules, to avoid working 18702 // in the global scope. 18703 // This also leaves the door open for returning a promise, once the 18704 // YUI loader is based on the ES6 loader which uses 18705 // loader.import(...).then(...) 18706 this.use.apply(this, args); 18707 }, 18708 18709 /** 18710 Handles Loader notifications about attachment/load errors. 18711 18712 @method _notify 18713 @param {Function} callback Callback to pass to `Y.config.loadErrorFn`. 18714 @param {Object} response Response returned from Loader. 18715 @param {Array} args Arguments passed from Loader. 18716 @private 18717 **/ 18718 _notify: function(callback, response, args) { 18719 if (!response.success && this.config.loadErrorFn) { 18720 this.config.loadErrorFn.call(this, this, callback, response, args); 18721 } else if (callback) { 18722 if (this.Env._missed && this.Env._missed.length) { 18723 response.msg = 'Missing modules: ' + this.Env._missed.join(); 18724 response.success = false;
18725 } 18726 if (this.config.throwFail) { 18727 callback(this, response); 18728 } else { 18729 try { 18730 callback(this, response); 18731 } catch (e) { 18732 this.error('use callback error', e, args); 18733 } 18734 } 18735 } 18736 }, 18737 18738 /** 18739 Called from the `use` method queue to ensure that only one set of loading 18740 logic is performed at a time. 18741 18742 @method _use 18743 @param {String} args* One or more modules to attach. 18744 @param {Function} [callback] Function to call once all required modules have 18745 been attached. 18746 @private 18747 **/ 18748 _use: function(args, callback) { 18749 18750 if (!this.Array) { 18751 this._attach(['yui-base']); 18752 } 18753 18754 var len, loader, handleBoot, 18755 Y = this, 18756 G_ENV = YUI.Env, 18757 mods = G_ENV.mods, 18758 Env = Y.Env, 18759 used = Env._used, 18760 aliases = G_ENV.aliases, 18761 queue = G_ENV._loaderQueue, 18762 firstArg = args[0], 18763 YArray = Y.Array, 18764 config = Y.config, 18765 boot = config.bootstrap, 18766 missing = [], 18767 i, 18768 r = [], 18769 ret = true, 18770 fetchCSS = config.fetchCSS, 18771 process = function(names, skip) { 18772 18773 var i = 0, a = [], name, len, m, req, use; 18774 18775 if (!names.length) { 18776 return; 18777 } 18778 18779 if (aliases) { 18780 len = names.length; 18781 for (i = 0; i < len; i++) { 18782 if (aliases[names[i]] && !mods[names[i]]) { 18783 a = [].concat(a, aliases[names[i]]); 18784 } else { 18785 a.push(names[i]); 18786 } 18787 } 18788 names = a; 18789 } 18790 18791 len = names.length; 18792 18793 for (i = 0; i < len; i++) { 18794 name = names[i]; 18795 if (!skip) { 18796 r.push(name); 18797 } 18798 18799 // only attach a module once 18800 if (used[name]) { 18801 continue; 18802 } 18803 18804 m = mods[name]; 18805 req = null; 18806 use = null; 18807 18808 if (m) { 18809 used[name] = true; 18810 req = m.details.requires; 18811 use = m.details.use; 18812 } else { 18813 // CSS files don't register themselves, see if it has 18814 // been loaded 18815 if (!G_ENV._loaded[VERSION][name]) { 18816 missing.push(name); 18817 } else { 18818 used[name] = true; // probably css 18819 } 18820 } 18821 18822 // make sure requirements are attached 18823 if (req && req.length) { 18824 process(req); 18825 } 18826 18827 // make sure we grab the submodule dependencies too 18828 if (use && use.length) { 18829 process(use, 1); 18830 } 18831 } 18832 18833 }, 18834 18835 handleLoader = function(fromLoader) { 18836 var response = fromLoader || { 18837 success: true, 18838 msg: 'not dynamic' 18839 }, 18840 redo, origMissing, 18841 ret = true, 18842 data = response.data; 18843 18844 Y._loading = false; 18845 18846 if (data) { 18847 origMissing = missing; 18848 missing = []; 18849 r = []; 18850 process(data); 18851 redo = missing.length; 18852 if (redo) { 18853 if ([].concat(missing).sort().join() == 18854 origMissing.sort().join()) { 18855 redo = false; 18856 } 18857 } 18858 } 18859 18860 if (redo && data) { 18861 Y._loading = true; 18862 Y._use(missing, function() { 18863 if (Y._attach(data)) { 18864 Y._notify(callback, response, data); 18865 } 18866 }); 18867 } else { 18868 if (data) { 18869 ret = Y._attach(data); 18870 } 18871 if (ret) { 18872 Y._notify(callback, response, args); 18873 } 18874 } 18875 18876 if (Y._useQueue && Y._useQueue.size() && !Y._loading) { 18877 Y._use.apply(Y, Y._useQueue.next()); 18878 } 18879 18880 }; 18881 18882 18883 // YUI().use('*'); // bind everything available 18884 if (firstArg === '*') { 18885 args = []; 18886 for (i in mods) { 18887 if (mods.hasOwnProperty(i)) { 18888 args.push(i); 18889 } 18890 } 18891 ret = Y._attach(args); 18892 if (ret) { 18893 handleLoader(); 18894 } 18895 return Y; 18896 } 18897 18898 if ((mods.loader || mods['loader-base']) && !Y.Loader) { 18899 Y._attach(['loader' + ((!mods.loader) ? '-base' : '')]); 18900 } 18901 18902 18903 // use loader to expand dependencies and sort the 18904 // requirements if it is available.
18905 if (boot && Y.Loader && args.length) { 18906 loader = getLoader(Y); 18907 loader.require(args); 18908 loader.ignoreRegistered = true; 18909 loader._boot = true; 18910 loader.calculate(null, (fetchCSS) ? null : 'js'); 18911 args = loader.sorted; 18912 loader._boot = false; 18913 } 18914 18915 process(args); 18916 18917 len = missing.length; 18918 18919 18920 if (len) { 18921 missing = YArray.dedupe(missing); 18922 len = missing.length; 18923 } 18924 18925 18926 // dynamic load 18927 if (boot && len && Y.Loader) { 18928 Y._loading = true; 18929 loader = getLoader(Y); 18930 loader.onEnd = handleLoader; 18931 loader.context = Y; 18932 loader.data = args; 18933 loader.ignoreRegistered = false; 18934 loader.require(missing); 18935 loader.insert(null, (fetchCSS) ? null : 'js'); 18936 18937 } else if (boot && len && Y.Get && !Env.bootstrapped) { 18938 18939 Y._loading = true; 18940 18941 handleBoot = function() { 18942 Y._loading = false; 18943 queue.running = false; 18944 Env.bootstrapped = true; 18945 G_ENV._bootstrapping = false; 18946 if (Y._attach(['loader'])) { 18947 Y._use(args, callback); 18948 } 18949 }; 18950 18951 if (G_ENV._bootstrapping) { 18952 queue.add(handleBoot); 18953 } else { 18954 G_ENV._bootstrapping = true; 18955 Y.Get.script(config.base + config.loaderPath, { 18956 onEnd: handleBoot 18957 }); 18958 } 18959 18960 } else { 18961 ret = Y._attach(args); 18962 if (ret) { 18963 handleLoader(); 18964 } 18965 } 18966 18967 return Y; 18968 }, 18969 18970 18971 /** 18972 Utility method for safely creating namespaces if they don't already exist. 18973 May be called statically on the YUI global object or as a method on a YUI 18974 instance. 18975 18976 When called statically, a namespace will be created on the YUI global 18977 object: 18978 18979 // Create `YUI.your.namespace.here` as nested objects, preserving any 18980 // objects that already exist instead of overwriting them. 18981 YUI.namespace('your.namespace.here'); 18982 18983 When called as a method on a YUI instance, a namespace will be created on 18984 that instance: 18985 18986 // Creates `Y.property.package`. 18987 Y.namespace('property.package'); 18988 18989 Dots in the input string cause `namespace` to create nested objects for each 18990 token. If any part of the requested namespace already exists, the current 18991 object will be left in place and will not be overwritten. This allows 18992 multiple calls to `namespace` to preserve existing namespaced properties. 18993 18994 If the first token in the namespace string is "YAHOO", that token is 18995 discarded. This is legacy behavior for backwards compatibility with YUI 2. 18996 18997 Be careful with namespace tokens. Reserved words may work in some browsers 18998 and not others. For instance, the following will fail in some browsers 18999 because the supported version of JavaScript reserves the word "long": 19000 19001 Y.namespace('really.long.nested.namespace'); 19002 19003 Note: If you pass multiple arguments to create multiple namespaces, only the 19004 last one created is returned from this function. 19005
19006 @method namespace 19007 @param {String} namespace* One or more namespaces to create. 19008 @return {Object} Reference to the last namespace object created. 19009 **/ 19010 namespace: function() { 19011 var a = arguments, o, i = 0, j, d, arg; 19012 19013 for (; i < a.length; i++) { 19014 o = this; //Reset base object per argument or it will get reused from the last 19015 arg = a[i]; 19016 if (arg.indexOf(PERIOD) > -1) { //Skip this if no "." is present 19017 d = arg.split(PERIOD); 19018 for (j = (d[0] == 'YAHOO') ? 1 : 0; j < d.length; j++) { 19019 o[d[j]] = o[d[j]] || {}; 19020 o = o[d[j]]; 19021 } 19022 } else { 19023 o[arg] = o[arg] || {}; 19024 o = o[arg]; //Reset base object to the new object so it's returned 19025 } 19026 } 19027 return o; 19028 }, 19029 19030 // this is replaced if the log module is included 19031 log: NOOP, 19032 message: NOOP, 19033 // this is replaced if the dump module is included 19034 dump: function (o) { return ''+o; }, 19035 19036 /** 19037 Reports an error. 19038 19039 The reporting mechanism is controlled by the `throwFail` configuration 19040 attribute. If `throwFail` is falsy, the message is logged. If `throwFail` is 19041 truthy, a JS exception is thrown. 19042 19043 If an `errorFn` is specified in the config it must return `true` to indicate 19044 that the exception was handled and keep it from being thrown. 19045 19046 @method error 19047 @param {String} msg Error message. 19048 @param {Error|String} [e] JavaScript error object or an error string. 19049 @param {String} [src] Source of the error (such as the name of the module in 19050 which the error occurred). 19051 @chainable 19052 **/ 19053 error: function(msg, e, src) { 19054 //TODO Add check for window.onerror here 19055 19056 var Y = this, ret; 19057 19058 if (Y.config.errorFn) { 19059 ret = Y.config.errorFn.apply(Y, arguments); 19060 } 19061 19062 if (!ret) { 19063 throw (e || new Error(msg)); 19064 } else { 19065 Y.message(msg, 'error', ''+src); // don't scrub this one 19066 } 19067 19068 return Y; 19069 }, 19070 19071 /** 19072 Generates an id string that is unique among all YUI instances in this 19073 execution context. 19074 19075 @method guid 19076 @param {String} [pre] Prefix. 19077 @return {String} Unique id. 19078 **/ 19079 guid: function(pre) { 19080 var id = this.Env._guidp + '_' + (++this.Env._uidx); 19081 return (pre) ? (pre + id) : id; 19082 }, 19083 19084 /** 19085 Returns a unique id associated with the given object and (if *readOnly* is 19086 falsy) stamps the object with that id so it can be identified in the future. 19087 19088 Stamping an object involves adding a `_yuid` property to it that contains 19089 the object's id. One exception to this is that in Internet Explorer, DOM 19090 nodes have a `uniqueID` property that contains a browser-generated unique 19091 id, which will be used instead of a YUI-generated id when available. 19092 19093 @method stamp 19094 @param {Object} o Object to stamp. 19095 @param {Boolean} readOnly If truthy and the given object has not already 19096 been stamped, the object will not be modified and `null` will be 19097 returned. 19098 @return {String} Object's unique id, or `null` if *readOnly* was truthy and 19099 the given object was not already stamped. 19100 **/ 19101 stamp: function(o, readOnly) { 19102 var uid; 19103 if (!o) { 19104 return o; 19105 } 19106 19107 // IE generates its own unique ID for dom nodes 19108 // The uniqueID property of a document node returns a new ID 19109 if (o.uniqueID && o.nodeType && o.nodeType !== 9) { 19110 uid = o.uniqueID; 19111 } else { 19112 uid = (typeof o === 'string') ? o : o._yuid; 19113 } 19114 19115 if (!uid) { 19116 uid = this.guid(); 19117 if (!readOnly) { 19118 try { 19119 o._yuid = uid; 19120 } catch (e) { 19121 uid = null; 19122 } 19123 } 19124 } 19125 return uid; 19126 }, 19127 19128 /** 19129 Destroys this YUI instance. 19130 19131 @method destroy 19132 @since 3.3.0 19133 **/ 19134 destroy: function() { 19135 var Y = this; 19136 if (Y.Event) { 19137 Y.Event._unload(); 19138 } 19139 delete instances[Y.id]; 19140 delete Y.Env; 19141 delete Y.config; 19142 } 19143 19144 /** 19145 Safe `instanceof` wrapper that works around a memory leak in IE when the 19146 object being tested is `window` or `document`. 19147 19148 Unless you are testing objects that may be `window` or `document`, you 19149 should use the native `instanceof` operator instead of this method. 19150 19151 @method instanceOf 19152 @param {Object} o Object to check. 19153 @param {Object} type Class to check against. 19154 @since 3.3.0 19155 **/ 19156}; 19157 19158 YUI.prototype = proto; 19159 19160 // inheritance utilities are not available yet 19161 for (prop in proto) { 19162 if (proto.hasOwnProperty(prop)) { 19163 YUI[prop] = proto[prop]; 19164 } 19165 } 19166 19167 /** 19168 Applies a configuration to all YUI instances in this execution context. 19169 19170 The main use case for this method is in "mashups" where several third-party 19171 scripts need to write to a global YUI config, but cannot share a single 19172 centrally-managed config object. This way they can all call 19173 `YUI.applyConfig({})` instead of overwriting the single global config. 19174 19175 @example 19176 19177 YUI.applyConfig({ 19178 modules: { 19179 davglass: { 19180 fullpath: './davglass.js' 19181 } 19182 } 19183 }); 19184 19185 YUI.applyConfig({ 19186 modules: { 19187 foo: { 19188 fullpath: './foo.js' 19189 } 19190 } 19191 }); 19192 19193 YUI().use('davglass', function (Y) { 19194 // Module davglass will be available here. 19195 }); 19196 19197 @method applyConfig 19198 @param {Object} o Configuration object to apply. 19199 @static 19200 @since 3.5.0 19201 **/ 19202 YUI.applyConfig = function(o) { 19203 if (!o) { 19204 return; 19205 } 19206 //If there is a GlobalConfig, apply it first to set the defaults 19207 if (YUI.GlobalConfig) { 19208 this.prototype.applyConfig.call(this, YUI.GlobalConfig); 19209 } 19210 //Apply this config to it 19211 this.prototype.applyConfig.call(this, o); 19212 //Reset GlobalConfig to the combined config 19213 YUI.GlobalConfig = this.config; 19214 }; 19215 19216 // set up the environment 19217 YUI._init(); 19218 19219 if (hasWin) { 19220 add(doc, 'DOMContentLoaded', handleReady); 19221 19222 // add a window load event at load time so we can capture 19223 // the case where it fires before dynamic loading is 19224 // complete. 19225 add(window, 'load', handleLoad); 19226 } else { 19227 handleReady(); 19228 handleLoad(); 19229 } 19230 19231 YUI.Env.add = add; 19232 YUI.Env.remove = remove; 19233 19234 /*global exports*/
19235 // Support the CommonJS method for exporting our single global 19236 if (typeof exports == 'object') { 19237 exports.YUI = YUI; 19238 /** 19239 * Set a method to be called when `Get.script` is called in Node.js 19240 * `Get` will open the file, then pass it's content and it's path 19241 * to this method before attaching it. Commonly used for code coverage 19242 * instrumentation. <strong>Calling this multiple times will only 19243 * attach the last hook method</strong>. This method is only 19244 * available in Node.js. 19245 * @method setLoadHook 19246 * @static 19247 * @param {Function} fn The function to set 19248 * @param {String} fn.data The content of the file 19249 * @param {String} fn.path The file path of the file 19250 */ 19251 YUI.setLoadHook = function(fn) { 19252 YUI._getLoadHook = fn; 19253 }; 19254 /** 19255 * Load hook for `Y.Get.script` in Node.js, see `YUI.setLoadHook` 19256 * @method _getLoadHook 19257 * @private 19258 * @param {String} data The content of the file 19259 * @param {String} path The file path of the file 19260 */ 19261 YUI._getLoadHook = null; 19262 } 19263 19264 YUI.Env[VERSION] = {}; 19265}()); 19266 19267 19268/** 19269Config object that contains all of the configuration options for 19270this `YUI` instance. 19271 19272This object is supplied by the implementer when instantiating YUI. Some 19273properties have default values if they are not supplied by the implementer. 19274 19275This object should not be updated directly because some values are cached. Use 19276`applyConfig()` to update the config object on a YUI instance that has already 19277been configured. 19278 19279@class config 19280@static 19281**/ 19282 19283/** 19284If `true` (the default), YUI will "bootstrap" the YUI Loader and module metadata 19285if they're needed to load additional dependencies and aren't already available. 19286 19287Setting this to `false` will prevent YUI from automatically loading the Loader 19288and module metadata, so you will need to manually ensure that they're available 19289or handle dependency resolution yourself. 19290 19291@property {Boolean} bootstrap 19292@default true 19293**/ 19294 19295/** 19296 19297@property {Object} filters 19298**/ 19299 19300/** 19301If `true`, YUI will use a combo handler to load multiple modules in as few 19302requests as possible. 19303 19304The YUI CDN (which YUI uses by default) supports combo handling, but other 19305servers may not. If the server from which you're loading YUI does not support 19306combo handling, set this to `false`. 19307 19308Providing a value for the `base` config property will cause `combine` to default 19309to `false` instead of `true`. 19310 19311@property {Boolean} combine 19312@default true 19313*/ 19314 19315/** 19316Array of module names that should never be dynamically loaded. 19317 19318@property {String[]} ignore 19319**/ 19320 19321/** 19322Array of module names that should always be loaded when required, even if 19323already present on the page. 19324 19325@property {String[]} force
19326**/ 19327 19328/** 19329DOM element or id that should be used as the insertion point for dynamically 19330added `<script>` and `<link>` nodes. 19331 19332@property {HTMLElement|String} insertBefore 19333**/ 19334 19335/** 19336Object hash containing attributes to add to dynamically added `<script>` nodes. 19337 19338@property {Object} jsAttributes 19339**/ 19340 19341/** 19342Object hash containing attributes to add to dynamically added `<link>` nodes. 19343 19344@property {Object} cssAttributes 19345**/ 19346 19347/** 19348Timeout in milliseconds before a dynamic JS or CSS request will be considered a 19349failure. If not set, no timeout will be enforced. 19350 19351@property {Number} timeout 19352**/ 19353 19354/** 19355A hash of module definitions to add to the list of available YUI modules. These 19356modules can then be dynamically loaded via the `use()` method. 19357 19358This is a hash in which keys are module names and values are objects containing 19359module metadata. 19360 19361See `Loader.addModule()` for the supported module metadata fields. Also see 19362`groups`, which provides a way to configure the base and combo spec for a set of 19363modules. 19364 19365@example 19366 19367 modules: { 19368 mymod1: { 19369 requires: ['node'], 19370 fullpath: '/mymod1/mymod1.js' 19371 }, 19372 19373 mymod2: { 19374 requires: ['mymod1'], 19375 fullpath: '/mymod2/mymod2.js' 19376 }, 19377 19378 mymod3: '/js/mymod3.js', 19379 mycssmod: '/css/mycssmod.css' 19380 } 19381 19382@property {Object} modules 19383**/ 19384 19385/** 19386Aliases are dynamic groups of modules that can be used as shortcuts. 19387 19388@example 19389 19390 YUI({ 19391 aliases: { 19392 davglass: [ 'node', 'yql', 'dd' ], 19393 mine: [ 'davglass', 'autocomplete'] 19394 } 19395 }).use('mine', function (Y) { 19396 // Node, YQL, DD & AutoComplete available here. 19397 }); 19398 19399@property {Object} aliases 19400**/ 19401 19402/** 19403A hash of module group definitions. 19404 19405For each group you can specify a list of modules and the base path and 19406combo spec to use when dynamically loading the modules. 19407 19408@example 19409 19410 groups: { 19411 yui2: { 19412 // specify whether or not this group has a combo service 19413 combine: true, 19414 19415 // The comboSeperator to use with this group's combo handler 19416 comboSep: ';', 19417 19418 // The maxURLLength for this server 19419 maxURLLength: 500, 19420 19421 // the base path for non-combo paths 19422 base: 'http://yui.yahooapis.com/2.8.0r4/build/', 19423 19424 // the path to the combo service 19425 comboBase: 'http://yui.yahooapis.com/combo?', 19426 19427 // a fragment to prepend to the path attribute when 19428 // when building combo urls 19429 root: '2.8.0r4/build/', 19430 19431 // the module definitions 19432 modules: { 19433 yui2_yde: { 19434 path: "yahoo-dom-event/yahoo-dom-event.js" 19435 }, 19436 yui2_anim: { 19437 path: "animation/animation.js", 19438 requires: ['yui2_yde'] 19439 } 19440 } 19441 } 19442 } 19443 19444@property {Object} groups 19445**/ 19446 19447/** 19448Path to the Loader JS file, relative to the `base` path. 19449 19450This is used to dynamically bootstrap the Loader when it's needed and isn't yet 19451available. 19452 19453@property {String} loaderPath 19454@default "loader/loader-min.js" 19455**/ 19456 19457/** 19458If `true`, YUI will attempt to load CSS dependencies and skins. Set this to 19459`false` to prevent YUI from loading any CSS, or set it to the string `"force"` 19460to force CSS dependencies to be loaded even if their associated JS modules are 19461already loaded. 19462 19463@property {Boolean|String} fetchCSS 19464@default true 19465**/ 19466 19467/** 19468Default gallery version used to build gallery module urls. 19469 19470@property {String} gallery 19471@since 3.1.0 19472**/ 19473 19474/** 19475Default YUI 2 version used to build YUI 2 module urls. 19476 19477This is used for intrinsic YUI 2 support via the 2in3 project. Also see the 19478`2in3` config for pulling different revisions of the wrapped YUI 2 modules. 19479 19480@property {String} yui2 19481@default "2.9.0" 19482@since 3.1.0 19483**/ 19484 19485/** 19486Revision number of YUI 2in3 modules that should be used when loading YUI 2in3. 19487 19488@property {String} 2in3 19489@default "4" 19490@since 3.1.0 19491**/ 19492 19493/** 19494Alternate console log function that should be used in environments without a 19495supported native console. This function is executed with the YUI instance as its 19496`this` object. 19497 19498@property {Function} logFn 19499@since 3.1.0
19500**/ 19501 19502/** 19503The minimum log level to log messages for. Log levels are defined 19504incrementally. Messages greater than or equal to the level specified will 19505be shown. All others will be discarded. The order of log levels in 19506increasing priority is: 19507 19508 debug 19509 info 19510 warn 19511 error 19512 19513@property {String} logLevel 19514@default 'debug' 19515@since 3.10.0 19516**/ 19517 19518/** 19519Callback to execute when `Y.error()` is called. It receives the error message 19520and a JavaScript error object if one was provided. 19521 19522This function is executed with the YUI instance as its `this` object. 19523 19524Returning `true` from this function will prevent an exception from being thrown. 19525 19526@property {Function} errorFn 19527@param {String} errorFn.msg Error message 19528@param {Object} [errorFn.err] Error object (if one was provided). 19529@since 3.2.0 19530**/ 19531 19532/** 19533A callback to execute when Loader fails to load one or more resources. 19534 19535This could be because of a script load failure. It could also be because a 19536module fails to register itself when the `requireRegistration` config is `true`. 19537 19538If this function is defined, the `use()` callback will only be called when the 19539loader succeeds. Otherwise, `use()` will always executes unless there was a 19540JavaScript error when attaching a module. 19541 19542@property {Function} loadErrorFn 19543@since 3.3.0 19544**/ 19545 19546/** 19547If `true`, Loader will expect all loaded scripts to be first-class YUI modules 19548that register themselves with the YUI global, and will trigger a failure if a 19549loaded script does not register a YUI module. 19550 19551@property {Boolean} requireRegistration 19552@default false 19553@since 3.3.0 19554**/ 19555 19556/** 19557Cache serviced use() requests. 19558 19559@property {Boolean} cacheUse 19560@default true 19561@since 3.3.0 19562@deprecated No longer used. 19563**/ 19564 19565/** 19566Whether or not YUI should use native ES5 functionality when available for 19567features like `Y.Array.each()`, `Y.Object()`, etc. 19568 19569When `false`, YUI will always use its own fallback implementations instead of 19570relying on ES5 functionality, even when ES5 functionality is available. 19571 19572@property {Boolean} useNativeES5 19573@default true 19574@since 3.5.0 19575**/ 19576 19577/** 19578 * Leverage native JSON stringify if the browser has a native 19579 * implementation. In general, this is a good idea. See the Known Issues 19580 * section in the JSON user guide for caveats. The default value is true 19581 * for browsers with native JSON support. 19582 * 19583 * @property useNativeJSONStringify 19584 * @type Boolean 19585 * @default true 19586 * @since 3.8.0 19587 */ 19588 19589 /** 19590 * Leverage native JSON parse if the browser has a native implementation. 19591 * In general, this is a good idea. See the Known Issues section in the 19592 * JSON user guide for caveats. The default value is true for browsers with 19593 * native JSON support. 19594 * 19595 * @property useNativeJSONParse 19596 * @type Boolean 19597 * @default true 19598 * @since 3.8.0 19599 */ 19600 19601/** 19602Delay the `use` callback until a specific event has passed (`load`, `domready`, `contentready` or `available`) 19603 19604@property {Object|String} delayUntil 19605@since 3.6.0 19606@example 19607 19608You can use `load` or `domready` strings by default: 19609 19610 YUI({ 19611 delayUntil: 'domready' 19612 }, function (Y) { 19613 // This will not execute until 'domeready' occurs. 19614 }); 19615 19616Or you can delay until a node is available (with `available` or `contentready`): 19617 19618 YUI({ 19619 delayUntil: { 19620 event: 'available', 19621 args : '#foo' 19622 } 19623 }, function (Y) { 19624 // This will not execute until a node matching the selector "#foo" is 19625 // available in the DOM. 19626 }); 19627 19628**/ 19629YUI.add('yui-base', function (Y, NAME) { 19630 19631/* 19632 * YUI stub 19633 * @module yui 19634 * @submodule yui-base 19635 */ 19636/** 19637 * The YUI module contains the components required for building the YUI 19638 * seed file. This includes the script loading mechanism, a simple queue, 19639 * and the core utilities for the library. 19640 * @module yui 19641 * @submodule yui-base 19642 */ 19643 19644/** 19645 * Provides core language utilites and extensions used throughout YUI. 19646 * 19647 * @class Lang 19648 * @static 19649 */ 19650 19651var L = Y.Lang || (Y.Lang = {}), 19652 19653STRING_PROTO = String.prototype, 19654TOSTRING = Object.prototype.toString, 19655 19656TYPES = { 19657 'undefined' : 'undefined', 19658 'number' : 'number', 19659 'boolean' : 'boolean', 19660 'string' : 'string', 19661 '[object Function]': 'function', 19662 '[object RegExp]' : 'regexp', 19663 '[object Array]' : 'array', 19664 '[object Date]' : 'date', 19665 '[object Error]' : 'error' 19666}, 19667 19668SUBREGEX = /\{\s*([^|}]+?)\s*(?:\|([^}]*))?\s*\}/g, 19669 19670WHITESPACE = "\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", 19671WHITESPACE_CLASS = "[\x09-\x0D\x20\xA0\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]+", 19672TRIM_LEFT_REGEX = new RegExp("^" + WHITESPACE_CLASS), 19673TRIM_RIGHT_REGEX = new RegExp(WHITESPACE_CLASS + "$"), 19674TRIMREGEX = new RegExp(TRIM_LEFT_REGEX.source + "|" + TRIM_RIGHT_REGEX.source, "g"), 19675 19676NATIVE_FN_REGEX = /\{\s*\[(?:native code|function)\]\s*\}/i; 19677 19678// -- Protected Methods -------------------------------------------------------- 19679 19680/** 19681Returns `true` if the given function appears to be implemented in native code, 19682`false` otherwise. Will always return `false` -- even in ES5-capable browsers -- 19683if the `useNativeES5` YUI config option is set to `false`. 19684 19685This isn't guaranteed to be 100% accurate and won't work for anything other than 19686functions, but it can be useful for determining whether a function like 19687`Array.prototype.forEach` is native or a JS shim provided by another library. 19688 19689There's a great article by @kangax discussing certain flaws with this technique: 19690<http://perfectionkills.com/detecting-built-in-host-methods/> 19691 19692While his points are valid, it's still possible to benefit from this function 19693as long as it's used carefully and sparingly, and in such a way that false 19694negatives have minimal consequences. It's used internally to avoid using 19695potentially broken non-native ES5 shims that have been added to the page b
19695y 19696other libraries. 19697 19698@method _isNative 19699@param {Function} fn Function to test. 19700@return {Boolean} `true` if _fn_ appears to be native, `false` otherwise. 19701@static 19702@protected 19703@since 3.5.0 19704**/ 19705L._isNative = function (fn) { 19706 return !!(Y.config.useNativeES5 && fn && NATIVE_FN_REGEX.test(fn)); 19707}; 19708 19709// -- Public Methods ----------------------------------------------------------- 19710 19711/** 19712 * Determines whether or not the provided item is an array. 19713 * 19714 * Returns `false` for array-like collections such as the function `arguments` 19715 * collection or `HTMLElement` collections. Use `Y.Array.test()` if you want to 19716 * test for an array-like collection. 19717 * 19718 * @method isArray 19719 * @param o The object to test. 19720 * @return {boolean} true if o is an array. 19721 * @static 19722 */ 19723L.isArray = L._isNative(Array.isArray) ? Array.isArray : function (o) { 19724 return L.type(o) === 'array'; 19725}; 19726 19727/** 19728 * Determines whether or not the provided item is a boolean. 19729 * @method isBoolean 19730 * @static 19731 * @param o The object to test. 19732 * @return {boolean} true if o is a boolean. 19733 */ 19734L.isBoolean = function(o) { 19735 return typeof o === 'boolean'; 19736}; 19737 19738/** 19739 * Determines whether or not the supplied item is a date instance. 19740 * @method isDate 19741 * @static 19742 * @param o The object to test. 19743 * @return {boolean} true if o is a date. 19744 */ 19745L.isDate = function(o) { 19746 return L.type(o) === 'date' && o.toString() !== 'Invalid Date' && !isNaN(o); 19747}; 19748 19749/** 19750 * <p> 19751 * Determines whether or not the provided item is a function. 19752 * Note: Internet Explorer thinks certain functions are objects: 19753 * </p> 19754 * 19755 * <pre> 19756 * var obj = document.createElement("object"); 19757 * Y.Lang.isFunction(obj.getAttribute) // reports false in IE 19758 * 19759 * var input = document.createElement("input"); // append to body 19760 * Y.Lang.isFunction(input.focus) // reports false in IE 19761 * </pre> 19762 * 19763 * <p> 19764 * You will have to implement additional tests if these functions 19765 * matter to you. 19766 * </p> 19767 * 19768 * @method isFunction 19769 * @static 19770 * @param o The object to test. 19771 * @return {boolean} true if o is a function. 19772 */ 19773L.isFunction = function(o) { 19774 return L.type(o) === 'function'; 19775}; 19776 19777/** 19778 * Determines whether or not the provided item is null. 19779 * @method isNull 19780 * @static 19781 * @param o The object to test. 19782 * @return {boolean} true if o is null. 19783 */ 19784L.isNull = function(o) { 19785 return o === null; 19786}; 19787 19788/** 19789 * Determines whether or not the provided item is a legal number. 19790 * @method isNumber 19791 * @static 19792 * @param o The object to test. 19793 * @return {boolean} true if o is a number. 19794 */ 19795L.isNumber = function(o) { 19796 return typeof o === 'number' && isFinite(o); 19797}; 19798 19799/** 19800 * Determines whether or not the provided item is of type object 19801 * or function. Note that arrays are also objects, so 19802 * <code>Y.Lang.isObject([]) === true</code>. 19803 * @method isObject 19804 * @static 19805 * @param o The object to test. 19806 * @param failfn {boolean} fail if the input is a function. 19807 * @return {boolean} true if o is an object. 19808 * @see isPlainObject 19809 */ 19810L.isObject = function(o, failfn) { 19811 var t = typeof o; 19812 return (o && (t === 'object' || 19813 (!failfn && (t === 'function' || L.isFunction(o))))) || false; 19814}; 19815 19816/** 19817 * Determines whether or not the provided value is a regexp. 19818 * @method isRegExp 19819 * @static 19820 * @param value The value or object to test. 19821 * @return {boolean} true if value is a regexp. 19822 */ 19823L.isRegExp = function(value) { 19824 return L.type(value) === 'regexp'; 19825}; 19826 19827/** 19828 * Determines whether or not the provided item is a string. 19829 * @method isString 19830 * @static 19831 * @param o The object to test. 19832 * @return {boolean} true if o is a string. 19833 */ 19834L.isString = function(o) { 19835 return typeof o === 'string'; 19836}; 19837 19838/** 19839 * Determines whether or not the provided item is undefined. 19840 * @method isUndefined 19841 * @static 19842 * @param o The object to test. 19843 * @return {boolean} true if o is undefined. 19844 */ 19845L.isUndefined = function(o) { 19846 return typeof o === 'undefined'; 19847}; 19848 19849/** 19850 * A convenience method for detecting a legitimate non-null value. 19851 * Returns false for null/undefined/NaN, true for other values, 19852 * including 0/false/'' 19853 * @method isValue 19854 * @static 19855 * @param o The item to test. 19856 * @return {boolean} true if it is not null/undefined/NaN || false. 19857 */ 19858L.isValue = function(o) { 19859 var t = L.type(o); 19860 19861 switch (t) { 19862 case 'number': 19863 return isFinite(o); 19864 19865 case 'null': // fallthru 19866 case 'undefined': 19867 return false;
19868 19869 default: 19870 return !!t; 19871 } 19872}; 19873 19874/** 19875 * Returns the current time in milliseconds. 19876 * 19877 * @method now 19878 * @return {Number} Current time in milliseconds. 19879 * @static 19880 * @since 3.3.0 19881 */ 19882L.now = Date.now || function () { 19883 return new Date().getTime(); 19884}; 19885 19886/** 19887 * Performs `{placeholder}` substitution on a string. The object passed as the 19888 * second parameter provides values to replace the `{placeholder}`s. 19889 * `{placeholder}` token names must match property names of the object. For example, 19890 * 19891 *`var greeting = Y.Lang.sub("Hello, {who}!", { who: "World" });` 19892 * 19893 * `{placeholder}` tokens that are undefined on the object map will be left 19894 * in tact (leaving unsightly `{placeholder}`'s in the output string). 19895 * 19896 * @method sub 19897 * @param {string} s String to be modified. 19898 * @param {object} o Object containing replacement values. 19899 * @return {string} the substitute result. 19900 * @static 19901 * @since 3.2.0 19902 */ 19903L.sub = function(s, o) { 19904 19905 /** 19906 Finds the value of `key` in given object. 19907 If the key has a 'dot' notation e.g. 'foo.bar.baz', the function will 19908 try to resolve this path if it doesn't exist as a property 19909 @example 19910 value({ 'a.b': 1, a: { b: 2 } }, 'a.b'); // 1 19911 value({ a: { b: 2 } } , 'a.b'); // 2 19912 @param {Object} obj A key/value pairs object 19913 @param {String} key 19914 @return {Any} 19915 @private 19916 **/ 19917 function value(obj, key) { 19918 19919 var subkey; 19920 19921 if ( typeof obj[key] !== 'undefined' ) { 19922 return obj[key]; 19923 } 19924 19925 key = key.split('.'); // given 'a.b.c' 19926 subkey = key.slice(1).join('.'); // 'b.c' 19927 key = key[0]; // 'a' 19928 19929 // special case for null as typeof returns object and we don't want that. 19930 if ( subkey && typeof obj[key] === 'object' && obj[key] !== null ) { 19931 return value(obj[key], subkey); 19932 } 19933 } 19934 19935 return s.replace ? s.replace(SUBREGEX, function (match, key) { 19936 var val = key.indexOf('.')>-1 ? value(o, key) : o[key]; 19937 return typeof val === 'undefined' ? match : val; 19938 }) : s; 19939}; 19940 19941/** 19942 * Returns a string without any leading or trailing whitespace. If 19943 * the input is not a string, the input will be returned untouched. 19944 * @method trim 19945 * @static 19946 * @param s {string} the string to trim. 19947 * @return {string} the trimmed string. 19948 */ 19949L.trim = L._isNative(STRING_PROTO.trim) && !WHITESPACE.trim() ? function(s) { 19950 return s && s.trim ? s.trim() : s; 19951} : function (s) { 19952 try { 19953 return s.replace(TRIMREGEX, ''); 19954 } catch (e) { 19955 return s; 19956 } 19957}; 19958 19959/** 19960 * Returns a string without any leading whitespace. 19961 * @method trimLeft 19962 * @static 19963 * @param s {string} the string to trim. 19964 * @return {string} the trimmed string. 19965 */ 19966L.trimLeft = L._isNative(STRING_PROTO.trimLeft) && !WHITESPACE.trimLeft() ? function (s) { 19967 return s.trimLeft(); 19968} : function (s) { 19969 return s.replace(TRIM_LEFT_REGEX, ''); 19970}; 19971 19972/** 19973 * Returns a string without any trailing whitespace. 19974 * @method trimRight 19975 * @static 19976 * @param s {string} the string to trim. 19977 * @return {string} the trimmed string. 19978 */ 19979L.trimRight = L._isNative(STRING_PROTO.trimRight) && !WHITESPACE.trimRight() ? function (s) { 19980 return s.trimRight(); 19981} : function (s) { 19982 return s.replace(TRIM_RIGHT_REGEX, ''); 19983}; 19984 19985/** 19986Returns one of the following strings, representing the type of the item passed 19987in: 19988 19989 * "array" 19990 * "boolean" 19991 * "date" 19992 * "error" 19993 * "function" 19994 * "null" 19995 * "number" 19996 * "object" 19997 * "regexp" 19998 * "string" 19999 * "undefined" 20000 20001Known issues: 20002 20003 * `typeof HTMLElementCollection` returns function in Safari, but 20004 `Y.Lang.type()` reports "object", which could be a good thing -- 20005 but it actually caused the logic in <code>Y.Lang.isObject</code> to fail. 20006 20007@method type 20008@param o the item to test. 20009@return {string} the detected type. 20010@static 20011**/ 20012L.type = function(o) { 20013 return TYPES[typeof o] || TYPES[TOSTRING.call(o)] || (o ? 'object' : 'null'); 20014}; 20015/** 20016@module yui 20017@submodule yui-base 20018*/ 20019 20020var Lang = Y.Lang, 20021 Native = Array.prototype, 20022 20023 hasOwn = Object.prototype.hasOwnProperty; 20024 20025/** 20026Provides utility methods for working with arrays. Additional array helpers can 20027be found in the `collection` and `array-extras` modules. 20028 20029`Y.Array(thing)` returns a native array created from _thing_. Depending on 20030_thing_'s type, one of the following will happen: 20031 20032 * Arrays are returned unmodified unless a non-zero _startIndex_ is 20033 specified. 20034 * Array-like collections (see `Array.test()`) are converted to arrays. 20035 * For everything else, a new array is created with _thing_ as the sole 20036 item. 20037 20038Note: elements that are also collections, such as `<form>` and `<select>` 20039elements, are not automatically converted to arrays. To force a conversion, 20040pass `true` as the value of the _force_ parameter. 20041 20042@class Array 20043@constructor 20044@param {Any} thing The thing to arrayify. 20045@param {Number} [startIndex=0] If non-zero and _thing_ is an array or array-like 20046 collection, a subset of items starting at the specified index will be 20047 returned. 20048@param {Boolean} [force=false] If `true`, _thing_ will be treated as an 20049 array-like collection no matter what. 20050@return {Array} A native array created from _thing_, according to the rules 20051 described above. 20052**/ 20053function YArray(thing, startIndex, force) { 20054 var len, result; 20055 20056 /*jshint expr: true*/ 20057 startIndex || (startIndex = 0); 20058 20059 if (force || YArray.test(thing)) { 20060 // IE throws when trying to slice HTMLElement collections. 20061 try { 20062 return Native.slice.call(thing, startIndex); 20063 } catch (ex) { 20064 result = []; 20065 20066 for (len = thing.length; startIndex < len; ++startIndex) { 20067 result.push(thing[startIndex]); 20068 } 20069 20070 return result; 20071 } 20072 } 20073 20074 return [thing]; 20075} 20076 20077Y.Array = YArray; 20078 20079/**
20080Dedupes an array of strings, returning an array that's guaranteed to contain 20081only one copy of a given string. 20082 20083This method differs from `Array.unique()` in that it's optimized for use only 20084with arrays consisting entirely of strings or entirely of numbers, whereas 20085`unique` may be used with other value types (but is slower). 20086 20087Using `dedupe()` with values other than strings or numbers, or with arrays 20088containing a mix of strings and numbers, may result in unexpected behavior. 20089 20090@method dedupe 20091@param {String[]|Number[]} array Array of strings or numbers to dedupe. 20092@return {Array} Copy of _array_ containing no duplicate values. 20093@static 20094@since 3.4.0 20095**/ 20096YArray.dedupe = Lang._isNative(Object.create) ? function (array) { 20097 var hash = Object.create(null), 20098 results = [], 20099 i, item, len; 20100 20101 for (i = 0, len = array.length; i < len; ++i) { 20102 item = array[i]; 20103 20104 if (!hash[item]) { 20105 hash[item] = 1; 20106 results.push(item); 20107 } 20108 } 20109 20110 return results; 20111} : function (array) { 20112 var hash = {}, 20113 results = [], 20114 i, item, len; 20115 20116 for (i = 0, len = array.length; i < len; ++i) { 20117 item = array[i]; 20118 20119 if (!hasOwn.call(hash, item)) { 20120 hash[item] = 1; 20121 results.push(item); 20122 } 20123 } 20124 20125 return results; 20126}; 20127 20128/** 20129Executes the supplied function on each item in the array. This method wraps 20130the native ES5 `Array.forEach()` method if available. 20131 20132@method each 20133@param {Array} array Array to iterate. 20134@param {Function} fn Function to execute on each item in the array. The function 20135 will receive the following arguments: 20136 @param {Any} fn.item Current array item. 20137 @param {Number} fn.index Current array index. 20138 @param {Array} fn.array Array being iterated. 20139@param {Object} [thisObj] `this` object to use when calling _fn_. 20140@return {YUI} The YUI instance. 20141@static 20142**/ 20143YArray.each = YArray.forEach = Lang._isNative(Native.forEach) ? function (array, fn, thisObj) { 20144 Native.forEach.call(array || [], fn, thisObj || Y); 20145 return Y; 20146} : function (array, fn, thisObj) { 20147 for (var i = 0, len = (array && array.length) || 0; i < len; ++i) { 20148 if (i in array) { 20149 fn.call(thisObj || Y, array[i], i, array); 20150 } 20151 } 20152 20153 return Y; 20154}; 20155 20156/** 20157Alias for `each()`. 20158 20159@method forEach 20160@static 20161**/ 20162 20163/** 20164Returns an object using the first array as keys and the second as values. If 20165the second array is not provided, or if it doesn't contain the same number of 20166values as the first array, then `true` will be used in place of the missing 20167values. 20168 20169@example 20170 20171 Y.Array.hash(['a', 'b', 'c'], ['foo', 'bar']); 20172 // => {a: 'foo', b: 'bar', c: true} 20173 20174@method hash 20175@param {String[]} keys Array of strings to use as keys. 20176@param {Array} [values] Array to use as values. 20177@return {Object} Hash using the first array as keys and the second as values. 20178@static 20179**/ 20180YArray.hash = function (keys, values) { 20181 var hash = {}, 20182 vlen = (values && values.length) || 0, 20183 i, len; 20184 20185 for (i = 0, len = keys.length; i < len; ++i) { 20186 if (i in keys) { 20187 hash[keys[i]] = vlen > i && i in values ? values[i] : true; 20188 } 20189 } 20190 20191 return hash; 20192}; 20193 20194/** 20195Returns the index of the first item in the array that's equal (using a strict 20196equality check) to the specified _value_, or `-1` if the value isn't found. 20197 20198This method wraps the native ES5 `Array.indexOf()` method if available. 20199 20200@method indexOf 20201@param {Array} array Array to search. 20202@param {Any} value Value to search for. 20203@param {Number} [from=0] The index at which to begin the search. 20204@return {Number} Index of the item strictly equal to _value_, or `-1` if not 20205 found. 20206@static 20207**/ 20208YArray.indexOf = Lang._isNative(Native.indexOf) ? function (array, value, from) { 20209 return Native.indexOf.call(array, value, from); 20210} : function (array, value, from) { 20211 // http://es5.github.com/#x15.4.4.14 20212 var len = array.length; 20213 20214 from = +from || 0; 20215 from = (from > 0 || -1) * Math.floor(Math.abs(from)); 20216 20217 if (from < 0) { 20218 from += len; 20219 20220 if (from < 0) { 20221 from = 0; 20222 } 20223 } 20224 20225 for (; from < len; ++from) { 20226 if (from in array && array[from] === value) { 20227 return from; 20228 } 20229 } 20230 20231 return -1; 20232}; 20233 20234/** 20235Numeric sort convenience function. 20236 20237The native `Array.prototype.sort()` function converts values to strings and 20238sorts them in lexicographic order, which is unsuitable for sorting numeric 20239values. Provide `Array.numericSort` as a custom sort function when you want 20240to sort values in numeric order. 20241 20242@example 20243 20244 [42, 23, 8, 16, 4, 15].sort(Y.Array.numericSort); 20245 // => [4, 8, 15, 16, 23, 42] 20246 20247@method numericSort 20248@param {Number} a First value to compare. 20249@param {Number} b Second value to compare. 20250@return {Number} Difference between _a_ and _b_. 20251@static 20252**/ 20253YArray.numericSort = function (a, b) { 20254 return a - b; 20255}; 20256 20257/** 20258Executes the supplied function on each item in the array. Returning a truthy 20259value from the function will stop the processing of remaining items. 20260 20261@method some 20262@param {Array} array Array to iterate over. 20263@param {Function} fn Function to execute on each item. The function will receive 20264 the following arguments: 20265 @param {Any} fn.value Current array item. 20266 @param {Number} fn.index Current array index. 20267 @param {Array} fn.array Array being iterated over. 20268@param {Object} [thisObj] `this` object to use when calling _fn_. 20269@return {Boolean} `true` if the function returns a truthy value on any of the 20270 items in the array; `false` otherwise. 20271@static 20272**/ 20273YArray.some = Lang._isNative(Native.some) ? function (array, fn, thisObj) { 20274 return Native.some.call(array, fn, thisObj); 20275} : function (array, fn, thisObj) { 20276 for (var i = 0, len = array.length; i < len; ++i) { 20277 if (i in array && fn.call(thisObj, array[i], i, array)) { 20278 return true; 20279 } 20280 } 20281 20282 return false;
20283}; 20284 20285/** 20286Evaluates _obj_ to determine if it's an array, an array-like collection, or 20287something else. This is useful when working with the function `arguments` 20288collection and `HTMLElement` collections. 20289 20290Note: This implementation doesn't consider elements that are also 20291collections, such as `<form>` and `<select>`, to be array-like. 20292 20293@method test 20294@param {Object} obj Object to test. 20295@return {Number} A number indicating the results of the test: 20296 20297 * 0: Neither an array nor an array-like collection. 20298 * 1: Real array. 20299 * 2: Array-like collection. 20300 20301@static 20302**/ 20303YArray.test = function (obj) { 20304 var result = 0; 20305 20306 if (Lang.isArray(obj)) { 20307 result = 1; 20308 } else if (Lang.isObject(obj)) { 20309 try { 20310 // indexed, but no tagName (element) or scrollTo/document (window. From DOM.isWindow test which we can't use here), 20311 // or functions without apply/call (Safari 20312 // HTMLElementCollection bug). 20313 if ('length' in obj && !obj.tagName && !(obj.scrollTo && obj.document) && !obj.apply) { 20314 result = 2; 20315 } 20316 } catch (ex) {} 20317 } 20318 20319 return result; 20320}; 20321/** 20322 * The YUI module contains the components required for building the YUI 20323 * seed file. This includes the script loading mechanism, a simple queue, 20324 * and the core utilities for the library. 20325 * @module yui 20326 * @submodule yui-base 20327 */ 20328 20329/** 20330 * A simple FIFO queue. Items are added to the Queue with add(1..n items) and 20331 * removed using next(). 20332 * 20333 * @class Queue 20334 * @constructor 20335 * @param {MIXED} item* 0..n items to seed the queue. 20336 */ 20337function Queue() { 20338 this._init(); 20339 this.add.apply(this, arguments); 20340} 20341 20342Queue.prototype = { 20343 /** 20344 * Initialize the queue 20345 * 20346 * @method _init 20347 * @protected 20348 */ 20349 _init: function() { 20350 /** 20351 * The collection of enqueued items 20352 * 20353 * @property _q 20354 * @type Array 20355 * @protected 20356 */ 20357 this._q = []; 20358 }, 20359 20360 /** 20361 * Get the next item in the queue. FIFO support 20362 * 20363 * @method next 20364 * @return {MIXED} the next item in the queue. 20365 */ 20366 next: function() { 20367 return this._q.shift(); 20368 }, 20369 20370 /** 20371 * Get the last in the queue. LIFO support. 20372 * 20373 * @method last 20374 * @return {MIXED} the last item in the queue. 20375 */ 20376 last: function() { 20377 return this._q.pop(); 20378 }, 20379 20380 /** 20381 * Add 0..n items to the end of the queue. 20382 * 20383 * @method add 20384 * @param {MIXED} item* 0..n items. 20385 * @return {object} this queue. 20386 */ 20387 add: function() { 20388 this._q.push.apply(this._q, arguments); 20389 20390 return this; 20391 }, 20392 20393 /** 20394 * Returns the current number of queued items. 20395 * 20396 * @method size 20397 * @return {Number} The size. 20398 */ 20399 size: function() { 20400 return this._q.length; 20401 } 20402}; 20403 20404Y.Queue = Queue; 20405 20406YUI.Env._loaderQueue = YUI.Env._loaderQueue || new Queue(); 20407 20408/** 20409The YUI module contains the components required for building the YUI seed file. 20410This includes the script loading mechanism, a simple queue, and the core 20411utilities for the library. 20412 20413@module yui 20414@submodule yui-base 20415**/ 20416 20417var CACHED_DELIMITER = '__', 20418 20419 hasOwn = Object.prototype.hasOwnProperty, 20420 isObject = Y.Lang.isObject; 20421 20422/** 20423Returns a wrapper for a function which caches the return value of that function, 20424keyed off of the combined string representation of the argument values provided 20425when the wrapper is called. 20426 20427Calling this function again with the same arguments will return the cached value 20428rather than executing the wrapped function. 20429 20430Note that since the cache is keyed off of the string representation of arguments 20431passed to the wrapper function, arguments that aren't strings and don't provide 20432a meaningful `toString()` method may result in unexpected caching behavior. For 20433example, the objects `{}` and `{foo: 'bar'}` would both be converted to the 20434string `[object Object]` when used as a cache key. 20435 20436@method cached 20437@param {Function} source The function to memoize. 20438@param {Object} [cache={}] Object in which to store cached values. You may seed 20439 this object with pre-existing cached values if desired. 20440@param {any} [refetch] If supplied, this value is compared with the cached value 20441 using a `==` comparison. If the values are equal, the wrapped function is 20442 executed again even though a cached value exists. 20443@return {Function} Wrapped function. 20444@for YUI
20445**/ 20446Y.cached = function (source, cache, refetch) { 20447 /*jshint expr: true*/ 20448 cache || (cache = {}); 20449 20450 return function (arg) { 20451 var key = arguments.length > 1 ? 20452 Array.prototype.join.call(arguments, CACHED_DELIMITER) : 20453 String(arg); 20454 20455 /*jshint eqeqeq: false*/ 20456 if (!(key in cache) || (refetch && cache[key] == refetch)) { 20457 cache[key] = source.apply(source, arguments); 20458 } 20459 20460 return cache[key]; 20461 }; 20462}; 20463 20464/** 20465Returns the `location` object from the window/frame in which this YUI instance 20466operates, or `undefined` when executing in a non-browser environment 20467(e.g. Node.js). 20468 20469It is _not_ recommended to hold references to the `window.location` object 20470outside of the scope of a function in which its properties are being accessed or 20471its methods are being called. This is because of a nasty bug/issue that exists 20472in both Safari and MobileSafari browsers: 20473[WebKit Bug 34679](https://bugs.webkit.org/show_bug.cgi?id=34679). 20474 20475@method getLocation 20476@return {location} The `location` object from the window/frame in which this YUI 20477 instance operates. 20478@since 3.5.0 20479**/ 20480Y.getLocation = function () { 20481 // It is safer to look this up every time because yui-base is attached to a 20482 // YUI instance before a user's config is applied; i.e. `Y.config.win` does 20483 // not point the correct window object when this file is loaded. 20484 var win = Y.config.win; 20485 20486 // It is not safe to hold a reference to the `location` object outside the 20487 // scope in which it is being used. The WebKit engine used in Safari and 20488 // MobileSafari will "disconnect" the `location` object from the `window` 20489 // when a page is restored from back/forward history cache. 20490 return win && win.location; 20491}; 20492 20493/** 20494Returns a new object containing all of the properties of all the supplied 20495objects. The properties from later objects will overwrite those in earlier 20496objects. 20497 20498Passing in a single object will create a shallow copy of it. For a deep copy, 20499use `clone()`. 20500 20501@method merge 20502@param {Object} objects* One or more objects to merge. 20503@return {Object} A new merged object. 20504**/ 20505Y.merge = function () { 20506 var i = 0, 20507 len = arguments.length, 20508 result = {}, 20509 key, 20510 obj; 20511 20512 for (; i < len; ++i) { 20513 obj = arguments[i]; 20514 20515 for (key in obj) { 20516 if (hasOwn.call(obj, key)) { 20517 result[key] = obj[key]; 20518 } 20519 } 20520 } 20521 20522 return result; 20523}; 20524 20525/** 20526Mixes _supplier_'s properties into _receiver_. 20527 20528Properties on _receiver_ or _receiver_'s prototype will not be overwritten or 20529shadowed unless the _overwrite_ parameter is `true`, and will not be merged 20530unless the _merge_ parameter is `true`. 20531 20532In the default mode (0), only properties the supplier owns are copied (prototype 20533properties are not copied). The following copying modes are available: 20534 20535 * `0`: _Default_. Object to object. 20536 * `1`: Prototype to prototype. 20537 * `2`: Prototype to prototype and object to object. 20538 * `3`: Prototype to object. 20539 * `4`: Object to prototype. 20540 20541@method mix 20542@param {Function|Object} receiver The object or function to receive the mixed 20543 properties. 20544@param {Function|Object} supplier The object or function supplying the 20545 properties to be mixed. 20546@param {Boolean} [overwrite=false] If `true`, properties that already exist 20547 on the receiver will be overwritten with properties from the supplier. 20548@param {String[]} [whitelist] An array of property names to copy. If 20549 specified, only the whitelisted properties will be copied, and all others 20550 will be ignored. 20551@param {Number} [mode=0] Mix mode to use. See above for available modes. 20552@param {Boolean} [merge=false] If `true`, objects and arrays that already 20553 exist on the receiver will have the corresponding object/array from the 20554 supplier merged into them, rather than being skipped or overwritten. When 20555 both _overwrite_ and _merge_ are `true`, _merge_ takes precedence. 20556@return {Function|Object|YUI} The receiver, or the YUI instance if the 20557 specified receiver is falsy. 20558**/ 20559Y.mix = function(receiver, supplier, overwrite, whitelist, mode, merge) { 20560 var alwaysOverwrite, exists, from, i, key, len, to; 20561 20562 // If no supplier is given, we return the receiver. If no receiver is given, 20563 // we return Y. Returning Y doesn't make much sense to me, but it's 20564 // grandfathered in for backcompat reasons. 20565 if (!receiver || !supplier) { 20566 return receiver || Y; 20567 } 20568 20569 if (mode) { 20570 // In mode 2 (prototype to prototype and object to object), we recurse 20571 // once to do the proto to proto mix. The object to object mix will be 20572 // handled later on. 20573 if (mode === 2) { 20574 Y.mix(receiver.prototype, supplier.prototype, overwrite, 20575 whitelist, 0, merge); 20576 } 20577 20578 // Depending on which mode is specified, we may be copying from or to 20579 // the prototypes of the supplier and receiver. 20580 from = mode === 1 || mode === 3 ? supplier.prototype : supplier; 20581 to = mode === 1 || mode === 4 ? receiver.prototype : receiver; 20582 20583 // If either the supplier or receiver doesn't actually have a 20584 // prototype property, then we could end up with an undefined `from` 20585 // or `to`. If that happens, we abort and return the receiver. 20586 if (!from || !to) { 20587 return receiver; 20588 } 20589 } else { 20590 from = supplier; 20591 to = receiver; 20592 } 20593 20594 // If `overwrite` is truthy and `merge` is falsy, then we can skip a 20595 // property existence check on each iteration and save some time. 20596 alwaysOverwrite = overwrite && !merge; 20597 20598 if (whitelist) { 20599 for (i = 0, len = whitelist.length; i < len; ++i) { 20600 key = whitelist[i]; 20601 20602 // We call `Object.prototype.hasOwnProperty` instead of calling 20603 // `hasOwnProperty` on the object itself, since the object's 20604 // `hasOwnProperty` method may have been overridden or removed. 20605 // Also, some native objects don't implement a `hasOwnProperty` 20606 // method. 20607 if (!hasOwn.call(from, key)) { 20608 continue; 20609 } 20610 20611 // The `key in to` check here is (sadly) intentional for backwards 20612 // compatibility reasons. It prevents undesired shadowing of 20613 // prototype members on `to`. 20614 exists = alwaysOverwrite ? false : key in to; 20615 20616 if (merge && exists && isObject(to[key], true) 20617 && isObject(from[key], true)) { 20618 // If we're in merge mode, and the key is present on both 20619 // objects, and the value on both objects is either an object or 20620 // an array (but not a function), then we recurse to merge the 20621 // `from` value into the `to` value instead of overwriting it. 20622 // 20623 // Note: It's intentional that the whitelist isn't passed to the 20624 // recursive call here. This is legacy behavior that lots of 20625 // code still depends on. 20626 Y.mix(to[key], from[key], overwrite, null, 0, merge); 20627 } else if (overwrite || !exists) { 20628 // We're not in merge mode, so we'll only copy the `from` value 20629 // to the `to` value if we're in overwrite mode or if the 20630 // current key doesn't exist on the `to` object. 20631 to[key] = from[key]; 20632 } 20633 } 20634 } else { 20635 for (key in from) { 20636 // The code duplication here is for runtime performance reasons. 20637 // Combining whitelist and non-whitelist operations into a single 20638 // loop or breaking the shared logic out into a function both result 20639 // in worse performance, and Y.mix is critical enough that the byte 20640 // tradeoff is worth it. 20641 if (!hasOwn.call(from, key)) { 20642 continue; 20643 } 20644 20645 // The `key in to` check here is (sadly) intentional for backwards 20646 // compatibility reasons. It prevents undesired shadowing of 20647 // prototype members on `to`. 20648 exists = alwaysOverwrite ? false : key in to; 20649 20650 if (merge && exists && isObject(to[key], true) 20651 && isObject(from[key], true)) { 20652 Y.mix(to[key], from[key], overwrite, null, 0, merge); 20653 } else if (overwrite || !exists) { 20654 to[key] = from[key]; 20655 } 20656 } 20657 20658 // If this is an IE browser with the JScript enumeration bug, force 20659 // enumeration of the buggy properties by making a recursive call with 20660 // the buggy properties as the whitelist. 20661 if (Y.Object._hasEnumBug) { 20662 Y.mix(to, from, overwrite, Y.Object._forceEnum, mode, merge); 20663 } 20664 } 20665 20666 return receiver; 20667}; 20668/** 20669 * The YUI module contains the components required for building the YUI 20670 * seed file. This includes the script loading mechanism, a simple queue, 20671 * and the core utilities for the library. 20672 * @module yui 20673 * @submodule yui-base 20674 */ 20675 20676/** 20677 * Adds utilities to the YUI instance for working with objects. 20678 * 20679 * @class Object 20680 */ 20681 20682var Lang = Y.Lang, 20683 hasOwn = Object.prototype.hasOwnProperty, 20684 20685 UNDEFINED, // <-- Note the comma. We're still declaring vars. 20686 20687/** 20688 * Returns a new object that uses _obj_ as its prototype. This method wraps the 20689 * native ES5 `Object.create()` method if available, but doesn't currently 20690 * pass through `Object.create()`'s second argument (properties) in order to 20691 * ensure compatibility with older browsers. 20692 * 20693 * @method () 20694 * @param {Object} obj Prototype object. 20695 * @return {Object} New object using _obj_ as its prototype. 20696 * @static 20697 */ 20698O = Y.Object = Lang._isNative(Object.create) ? function (obj) { 20699 // We currently wrap the native Object.create instead of simply aliasing it 20700 // to ensure consistency with our fallback shim, which currently doesn't 20701 // support Object.create()'s second argument (properties). Once we have a 20702 // safe fallback for the properties arg, we can stop wrapping 20703 // Object.create(). 20704 return Object.create(obj); 20705} : (function () { 20706 // Reusable constructor function for the Object.create() shim. 20707 function F() {} 20708 20709 // The actual shim. 20710 return function (obj) { 20711 F.prototype = obj; 20712 return new F(); 20713 }; 20714}()), 20715 20716/** 20717 * Property names that IE doesn't enumerate in for..in loops, even when they 20718 * should be enumerable. When `_hasEnumBug` is `true`, it's necessary to 20719 * manually enumerate these properties. 20720 * 20721 * @property _forceEnum
20722 * @type String[] 20723 * @protected 20724 * @static 20725 */ 20726forceEnum = O._forceEnum = [ 20727 'hasOwnProperty', 20728 'isPrototypeOf', 20729 'propertyIsEnumerable', 20730 'toString', 20731 'toLocaleString', 20732 'valueOf' 20733], 20734 20735/** 20736 * `true` if this browser has the JScript enumeration bug that prevents 20737 * enumeration of the properties named in the `_forceEnum` array, `false` 20738 * otherwise. 20739 * 20740 * See: 20741 * - <https://developer.mozilla.org/en/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug> 20742 * - <http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation> 20743 * 20744 * @property _hasEnumBug 20745 * @type Boolean 20746 * @protected 20747 * @static 20748 */ 20749hasEnumBug = O._hasEnumBug = !{valueOf: 0}.propertyIsEnumerable('valueOf'), 20750 20751/** 20752 * `true` if this browser incorrectly considers the `prototype` property of 20753 * functions to be enumerable. Currently known to affect Opera 11.50 and Android 2.3.x. 20754 * 20755 * @property _hasProtoEnumBug 20756 * @type Boolean 20757 * @protected 20758 * @static 20759 */ 20760hasProtoEnumBug = O._hasProtoEnumBug = (function () {}).propertyIsEnumerable('prototype'), 20761 20762/** 20763 * Returns `true` if _key_ exists on _obj_, `false` if _key_ doesn't exist or 20764 * exists only on _obj_'s prototype. This is essentially a safer version of 20765 * `obj.hasOwnProperty()`. 20766 * 20767 * @method owns 20768 * @param {Object} obj Object to test. 20769 * @param {String} key Property name to look for. 20770 * @return {Boolean} `true` if _key_ exists on _obj_, `false` otherwise. 20771 * @static 20772 */ 20773owns = O.owns = function (obj, key) { 20774 return !!obj && hasOwn.call(obj, key); 20775}; // <-- End of var declarations. 20776 20777/** 20778 * Alias for `owns()`. 20779 * 20780 * @method hasKey 20781 * @param {Object} obj Object to test. 20782 * @param {String} key Property name to look for. 20783 * @return {Boolean} `true` if _key_ exists on _obj_, `false` otherwise. 20784 * @static 20785 */ 20786O.hasKey = owns; 20787 20788/** 20789 * Returns an array containing the object's enumerable keys. Does not include 20790 * prototype keys or non-enumerable keys. 20791 * 20792 * Note that keys are returned in enumeration order (that is, in the same order 20793 * that they would be enumerated by a `for-in` loop), which may not be the same 20794 * as the order in which they were defined. 20795 * 20796 * This method is an alias for the native ES5 `Object.keys()` method if 20797 * available and non-buggy. The Opera 11.50 and Android 2.3.x versions of 20798 * `Object.keys()` have an inconsistency as they consider `prototype` to be 20799 * enumerable, so a non-native shim is used to rectify the difference. 20800 * 20801 * @example 20802 * 20803 * Y.Object.keys({a: 'foo', b: 'bar', c: 'baz'}); 20804 * // => ['a', 'b', 'c'] 20805 * 20806 * @method keys 20807 * @param {Object} obj An object. 20808 * @return {String[]} Array of keys. 20809 * @static 20810 */ 20811O.keys = Lang._isNative(Object.keys) && !hasProtoEnumBug ? Object.keys : function (obj) { 20812 if (!Lang.isObject(obj)) { 20813 throw new TypeError('Object.keys called on a non-object'); 20814 } 20815 20816 var keys = [], 20817 i, key, len; 20818 20819 if (hasProtoEnumBug && typeof obj === 'function') { 20820 for (key in obj) { 20821 if (owns(obj, key) && key !== 'prototype') { 20822 keys.push(key); 20823 } 20824 } 20825 } else { 20826 for (key in obj) { 20827 if (owns(obj, key)) { 20828 keys.push(key); 20829 } 20830 } 20831 } 20832 20833 if (hasEnumBug) { 20834 for (i = 0, len = forceEnum.length; i < len; ++i) { 20835 key = forceEnum[i]; 20836 20837 if (owns(obj, key)) { 20838 keys.push(key); 20839 } 20840 } 20841 } 20842 20843 return keys; 20844}; 20845 20846/** 20847 * Returns an array containing the values of the object's enumerable keys. 20848 * 20849 * Note that values are returned in enumeration order (that is, in the same 20850 * order that they would be enumerated by a `for-in` loop), which may not be the 20851 * same as the order in which they were defined. 20852 * 20853 * @example 20854 * 20855 * Y.Object.values({a: 'foo', b: 'bar', c: 'baz'}); 20856 * // => ['foo', 'bar', 'baz'] 20857 * 20858 * @method values 20859 * @param {Object} obj An object. 20860 * @return {Array} Array of values. 20861 * @static 20862 */ 20863O.values = function (obj) { 20864 var keys = O.keys(obj), 20865 i = 0, 20866 len = keys.length, 20867 values = []; 20868 20869 for (; i < len; ++i) { 20870 values.push(obj[keys[i]]); 20871 } 20872 20873 return values; 20874}; 20875 20876/** 20877 * Returns the number of enumerable keys owned by an object. 20878 * 20879 * @method size 20880 * @param {Object} obj An object. 20881 * @return {Number} The object's size. 20882 * @static 20883 */ 20884O.size = function (obj) { 20885 try { 20886 return O.keys(obj).length; 20887 } catch (ex) { 20888 return 0; // Legacy behavior for non-objects. 20889 } 20890}; 20891 20892/** 20893 * Returns `true` if the object owns an enumerable property with the specified 20894 * value. 20895 * 20896 * @method hasValue 20897 * @param {Object} obj An object. 20898 * @param {any} value The value to search for. 20899 * @return {Boolean} `true` if _obj_ contains _value_, `false` otherwise. 20900 * @static 20901 */ 20902O.hasValue = function (obj, value) { 20903 return Y.Array.indexOf(O.values(obj), value) > -1; 20904}; 20905 20906/** 20907 * Executes a function on each enumerable property in _obj_. The function 20908 * receives the value, the key, and the object itself as parameters (in that 20909 * order). 20910 * 20911 * By default, only properties owned by _obj_ are enumerated. To include 20912 * prototype properties, set the _proto_ parameter to `true`. 20913 * 20914 * @method each 20915 * @param {Object} obj Object to enumerate. 20916 * @param {Function} fn Function to execute on each enumerable property. 20917 * @param {mixed} fn.value Value of the current property. 20918 * @param {String} fn.key Key of the current property. 20919 * @param {Object} fn.obj Object being enumerated. 20920 * @param {Object} [thisObj] `this` object to use when calling _fn_. 20921 * @param {Boolean} [proto=false] Include prototype properties. 20922 * @return {YUI} the YUI instance. 20923 * @chainable
20924 * @static 20925 */ 20926O.each = function (obj, fn, thisObj, proto) { 20927 var key; 20928 20929 for (key in obj) { 20930 if (proto || owns(obj, key)) { 20931 fn.call(thisObj || Y, obj[key], key, obj); 20932 } 20933 } 20934 20935 return Y; 20936}; 20937 20938/** 20939 * Executes a function on each enumerable property in _obj_, but halts if the 20940 * function returns a truthy value. The function receives the value, the key, 20941 * and the object itself as paramters (in that order). 20942 * 20943 * By default, only properties owned by _obj_ are enumerated. To include 20944 * prototype properties, set the _proto_ parameter to `true`. 20945 * 20946 * @method some 20947 * @param {Object} obj Object to enumerate. 20948 * @param {Function} fn Function to execute on each enumerable property. 20949 * @param {mixed} fn.value Value of the current property. 20950 * @param {String} fn.key Key of the current property. 20951 * @param {Object} fn.obj Object being enumerated. 20952 * @param {Object} [thisObj] `this` object to use when calling _fn_. 20953 * @param {Boolean} [proto=false] Include prototype properties. 20954 * @return {Boolean} `true` if any execution of _fn_ returns a truthy value, 20955 * `false` otherwise. 20956 * @static 20957 */ 20958O.some = function (obj, fn, thisObj, proto) { 20959 var key; 20960 20961 for (key in obj) { 20962 if (proto || owns(obj, key)) { 20963 if (fn.call(thisObj || Y, obj[key], key, obj)) { 20964 return true; 20965 } 20966 } 20967 } 20968 20969 return false; 20970}; 20971 20972/** 20973 * Retrieves the sub value at the provided path, 20974 * from the value object provided. 20975 * 20976 * @method getValue 20977 * @static 20978 * @param o The object from which to extract the property value. 20979 * @param path {Array} A path array, specifying the object traversal path 20980 * from which to obtain the sub value. 20981 * @return {Any} The value stored in the path, undefined if not found, 20982 * undefined if the source is not an object. Returns the source object 20983 * if an empty path is provided. 20984 */ 20985O.getValue = function(o, path) { 20986 if (!Lang.isObject(o)) { 20987 return UNDEFINED; 20988 } 20989 20990 var i, 20991 p = Y.Array(path), 20992 l = p.length; 20993 20994 for (i = 0; o !== UNDEFINED && i < l; i++) { 20995 o = o[p[i]]; 20996 } 20997 20998 return o; 20999}; 21000 21001/** 21002 * Sets the sub-attribute value at the provided path on the 21003 * value object. Returns the modified value object, or 21004 * undefined if the path is invalid. 21005 * 21006 * @method setValue 21007 * @static 21008 * @param o The object on which to set the sub value. 21009 * @param path {Array} A path array, specifying the object traversal path 21010 * at which to set the sub value. 21011 * @param val {Any} The new value for the sub-attribute. 21012 * @return {Object} The modified object, with the new sub value set, or 21013 * undefined, if the path was invalid. 21014 */ 21015O.setValue = function(o, path, val) { 21016 var i, 21017 p = Y.Array(path), 21018 leafIdx = p.length - 1, 21019 ref = o; 21020 21021 if (leafIdx >= 0) { 21022 for (i = 0; ref !== UNDEFINED && i < leafIdx; i++) { 21023 ref = ref[p[i]]; 21024 } 21025 21026 if (ref !== UNDEFINED) { 21027 ref[p[i]] = val; 21028 } else { 21029 return UNDEFINED; 21030 } 21031 } 21032 21033 return o; 21034}; 21035 21036/** 21037 * Returns `true` if the object has no enumerable properties of its own. 21038 * 21039 * @method isEmpty 21040 * @param {Object} obj An object. 21041 * @return {Boolean} `true` if the object is empty. 21042 * @static 21043 * @since 3.2.0 21044 */ 21045O.isEmpty = function (obj) { 21046 return !O.keys(Object(obj)).length; 21047}; 21048/** 21049 * The YUI module contains the components required for building the YUI seed 21050 * file. This includes the script loading mechanism, a simple queue, and the 21051 * core utilities for the library. 21052 * @module yui 21053 * @submodule yui-base 21054 */ 21055 21056/** 21057 * YUI user agent detection. 21058 * Do not fork for a browser if it can be avoided. Use feature detection when 21059 * you can. Use the user agent as a last resort. For all fields listed 21060 * as @type float, UA stores a version number for the browser engine, 21061 * 0 otherwise. This value may or may not map to the version number of 21062 * the browser using the engine. The value is presented as a float so 21063 * that it can easily be used for boolean evaluation as well as for 21064 * looking for a particular range of versions. Because of this, 21065 * some of the granularity of the version info may be lost. The fields that 21066 * are @type string default to null. The API docs list the values that 21067 * these fields can have. 21068 * @class UA 21069 * @static 21070 */ 21071 21072/** 21073* Static method on `YUI.Env` for parsing a UA string. Called at instantiation 21074* to populate `Y.UA`. 21075* 21076* @static 21077* @method parseUA 21078* @param {String} [subUA=navigator.userAgent] UA string to parse 21079* @return {Object} The Y.UA object 21080*/ 21081YUI.Env.parseUA = function(subUA) { 21082 21083 var numberify = function(s) { 21084 var c = 0; 21085 return parseFloat(s.replace(/\./g, function() { 21086 return (c++ === 1) ? '' : '.'; 21087 })); 21088 }, 21089 21090 win = Y.config.win, 21091 21092 nav = win && win.navigator, 21093 21094 o = { 21095 21096 /** 21097 * Internet Explorer version number or 0. Example: 6 21098 * @property ie 21099 * @type float 21100 * @static 21101 */ 21102 ie: 0, 21103 21104 /** 21105 * Opera version number or 0. Example: 9.2 21106 * @property opera 21107 * @type float 21108 * @static 21109 */ 21110 opera: 0, 21111 21112 /** 21113 * Gecko engine revision number. Will evaluate to 1 if Gecko 21114 * is detected but the revision could not be found. Other browsers 21115 * will be 0. Example: 1.8 21116 * <pre> 21117 * Firefox 1.0.0.4: 1.7.8 <-- Reports 1.7 21118 * Firefox 1.5.0.9: 1.8.0.9 <-- 1.8 21119 * Firefox 2.0.0.3: 1.8.1.3 <-- 1.81 21120 * Firefox 3.0 <-- 1.9 21121 * Firefox 3.5 <-- 1.91 21122 * </pre> 21123 * @property gecko 21124 * @type float 21125 * @static 21126 */ 21127 gecko: 0, 21128 21129 /** 21130 * AppleWebKit version. KHTML browsers that are not WebKit browsers 21131 * will evaluate to 1, other browsers 0. Example: 418.9 21132 * <pre> 21133 * Safari 1.3.2 (312.6): 312.8.1 <-- Reports 312.8 -- currently the 21134 * latest available for Mac OSX 10.3. 21135 * Safari 2.0.2: 416 <-- hasOwnProperty introduced 21136 * Safari 2.0.4: 418 <-- preventDefault fixed 21137 * Safari 2.0.4 (419.3): 418.9.1 <-- One version of Safari may run 21138 * different versions of webkit 21139 * Safari 2.0.4 (419.3): 419 <-- Tiger installations that have been 21140 * updated, but not updated 21141 * to the latest patch. 21142 * Webkit 212 nightly: 522+ <-- Safari 3.0 precursor (with native 21143 * SVG and many major issues fixed). 21144 * Safari 3.0.4 (523.12) 523.12 <-- First Tiger release - automatic 21145 * update from 2.x via the 10.4.11 OS patch. 21146 * Webkit nightly 1/2008:525+ <-- Supports DOMContentLoaded event. 21147 * yahoo.com user agent hack removed. 21148 * </pre> 21149 * http://en.wikipedia.org/wiki/Safari_version_history 21150 * @property webkit 21151 * @type float 21152 * @static 21153 */ 21154 webkit: 0, 21155 21156 /** 21157 * Safari will be detected as webkit, but this property will also 21158 * be populated with the Safari version number 21159 * @property safari 21160 * @type float 21161 * @static 21162 */ 21163 safari: 0, 21164 21165 /** 21166 * Chrome will be detected as webkit, but this property will also 21167 * be populated with the Chrome version number 21168 * @property chrome 21169 * @type float 21170 * @static 21171 */ 21172 chrome: 0, 21173 21174 /** 21175 * The mobile property will be set to a string containing any relevant 21176 * user agent information when a modern mobile browser is detected. 21177 * Currently limited to Safari on the iPhone/iPod Touch, Nokia N-series 21178 * devices with the WebKit-based browser, and Opera Mini. 21179 * @property mobile 21180 * @type string 21181 * @default null 21182 * @static 21183 */ 21184 mobile: null, 21185 21186 /** 21187 * Adobe AIR version number or 0. Only populated if webkit is detected. 21188 * Example: 1.0 21189 * @property air 21190 * @type float 21191 */ 21192 air: 0, 21193 /** 21194 * PhantomJS version number or 0. Only populated if webkit is detected. 21195 * Example: 1.0 21196 * @property phantomjs 21197 * @type float 21198 */ 21199 phantomjs: 0, 21200 /** 21201 * Detects Apple iPad's OS version 21202 * @property ipad 21203 * @type float 21204 * @static 21205 */ 21206 ipad: 0, 21207 /** 21208 * Detects Apple iPhone's OS version 21209 * @property iphone 21210 * @type float 21211 * @static 21212 */ 21213 iphone: 0, 21214 /** 21215 * Detects Apples iPod's OS version 21216 * @property ipod 21217 * @type float 21218 * @static 21219 */ 21220 ipod: 0, 21221 /** 21222 * General truthy check for iPad, iPhone or iPod 21223 * @property ios 21224 * @type Boolean 21225 * @default null 21226 * @static 21227 */ 21228 ios: null, 21229 /** 21230 * Detects Googles Android OS version 21231 * @property android 21232 * @type float 21233 * @static 21234 */ 21235 android: 0, 21236 /** 21237 * Detects Kindle Silk 21238 * @property silk 21239 * @type float 21240 * @static 21241 */ 21242 silk: 0, 21243 /** 21244 * Detects Ubuntu version 21245 * @property ubuntu 21246 * @type float 21247 * @static 21248 */ 21249 ubuntu: 0, 21250 /** 21251 * Detects Kindle Silk Acceleration 21252 * @property accel 21253 * @type Boolean 21254 * @static 21255 */ 21256 accel: false, 21257 /** 21258 * Detects Palms WebOS version 21259 * @property webos 21260 * @type float 21261 * @static 21262 */ 21263 webos: 0, 21264 21265 /** 21266 * Google Caja version number or 0. 21267 * @property caja 21268 * @type float 21269 */ 21270 caja: nav && nav.cajaVersion, 21271 21272 /** 21273 * Set to true if the page appears to be in SSL 21274 * @property secure 21275 * @type boolean 21276 * @static 21277 */ 21278 secure: false, 21279 21280 /** 21281 * The operating system. 21282 * 21283 * Possible values are `windows`, `macintosh`, `android`, `symbos`, `linux`, `rhino` and `ios`. 21284 * 21285 * @property os 21286 * @type string 21287 * @default null 21288 * @static 21289 */ 21290 os: null, 21291 21292 /** 21293 * The Nodejs Version 21294 * @property nodejs 21295 * @type float 21296 * @default 0 21297 * @static 21298 */ 21299 nodejs: 0, 21300 /** 21301 * Window8/IE10 Application host environment 21302 * @property winjs 21303 * @type Boolean 21304 * @static 21305 */ 21306 winjs: !!((typeof Windows !== "undefined") && Windows.System), 21307 /** 21308 * Are touch/msPointer events available on this device 21309 * @property touchEnabled 21310 * @type Boolean 21311 * @static 21312 */ 21313 touchEnabled: false 21314 }, 21315 21316 ua = subUA || nav && nav.userAgent, 21317 21318 loc = win && win.location, 21319 21320 href = loc && loc.href, 21321 21322 m; 21323 21324 /** 21325 * The User Agent string that was parsed 21326 * @property userAgent
21327 * @type String 21328 * @static 21329 */ 21330 o.userAgent = ua; 21331 21332 21333 o.secure = href && (href.toLowerCase().indexOf('https') === 0); 21334 21335 if (ua) { 21336 21337 if ((/windows|win32/i).test(ua)) { 21338 o.os = 'windows'; 21339 } else if ((/macintosh|mac_powerpc/i).test(ua)) { 21340 o.os = 'macintosh'; 21341 } else if ((/android/i).test(ua)) { 21342 o.os = 'android'; 21343 } else if ((/symbos/i).test(ua)) { 21344 o.os = 'symbos'; 21345 } else if ((/linux/i).test(ua)) { 21346 o.os = 'linux'; 21347 } else if ((/rhino/i).test(ua)) { 21348 o.os = 'rhino'; 21349 } 21350 21351 // Modern KHTML browsers should qualify as Safari X-Grade 21352 if ((/KHTML/).test(ua)) { 21353 o.webkit = 1; 21354 } 21355 if ((/IEMobile|XBLWP7/).test(ua)) { 21356 o.mobile = 'windows'; 21357 } 21358 if ((/Fennec/).test(ua)) { 21359 o.mobile = 'gecko'; 21360 } 21361 // Modern WebKit browsers are at least X-Grade 21362 m = ua.match(/AppleWebKit\/([^\s]*)/); 21363 if (m && m[1]) { 21364 o.webkit = numberify(m[1]); 21365 o.safari = o.webkit; 21366 21367 if (/PhantomJS/.test(ua)) { 21368 m = ua.match(/PhantomJS\/([^\s]*)/); 21369 if (m && m[1]) { 21370 o.phantomjs = numberify(m[1]); 21371 } 21372 } 21373 21374 // Mobile browser check 21375 if (/ Mobile\//.test(ua) || (/iPad|iPod|iPhone/).test(ua)) { 21376 o.mobile = 'Apple'; // iPhone or iPod Touch 21377 21378 m = ua.match(/OS ([^\s]*)/); 21379 if (m && m[1]) { 21380 m = numberify(m[1].replace('_', '.')); 21381 } 21382 o.ios = m; 21383 o.os = 'ios'; 21384 o.ipad = o.ipod = o.iphone = 0; 21385 21386 m = ua.match(/iPad|iPod|iPhone/); 21387 if (m && m[0]) { 21388 o[m[0].toLowerCase()] = o.ios; 21389 } 21390 } else { 21391 m = ua.match(/NokiaN[^\/]*|webOS\/\d\.\d/); 21392 if (m) { 21393 // Nokia N-series, webOS, ex: NokiaN95 21394 o.mobile = m[0]; 21395 } 21396 if (/webOS/.test(ua)) { 21397 o.mobile = 'WebOS'; 21398 m = ua.match(/webOS\/([^\s]*);/); 21399 if (m && m[1]) { 21400 o.webos = numberify(m[1]); 21401 } 21402 } 21403 if (/ Android/.test(ua)) { 21404 o.mobile = 'Android'; 21405 m = ua.match(/Android ([^\s]*);/); 21406 if (m && m[1]) { 21407 o.android = numberify(m[1]); 21408 } 21409 21410 } 21411 if (/Silk/.test(ua)) { 21412 m = ua.match(/Silk\/([^\s]*)/); 21413 if (m && m[1]) { 21414 o.silk = numberify(m[1]); 21415 } 21416 if (!o.android) { 21417 o.android = 2.34; //Hack for desktop mode in Kindle 21418 o.os = 'Android'; 21419 } 21420 if (/Accelerated=true/.test(ua)) { 21421 o.accel = true; 21422 } 21423 } 21424 } 21425 21426 m = ua.match(/OPR\/(\d+\.\d+)/); 21427 21428 if (m && m[1]) { 21429 // Opera 15+ with Blink (pretends to be both Chrome and Safari) 21430 o.opera = numberify(m[1]); 21431 } else { 21432 m = ua.match(/(Chrome|CrMo|CriOS)\/([^\s]*)/); 21433 21434 if (m && m[1] && m[2]) { 21435 o.chrome = numberify(m[2]); // Chrome 21436 o.safari = 0; //Reset safari back to 0 21437 if (m[1] === 'CrMo') { 21438 o.mobile = 'chrome'; 21439 } 21440 } else { 21441 m = ua.match(/AdobeAIR\/([^\s]*)/); 21442 if (m) { 21443 o.air = m[0]; // Adobe AIR 1.0 or better 21444 } 21445 } 21446 } 21447 } 21448 21449 m = ua.match(/Ubuntu\ (\d+\.\d+)/); 21450 if (m && m[1]) { 21451 21452 o.os = 'linux'; 21453 o.ubuntu = numberify(m[1]); 21454 21455 m = ua.match(/\ WebKit\/([^\s]*)/); 21456 if (m && m[1]) { 21457 o.webkit = numberify(m[1]); 21458 } 21459 m = ua.match(/\ Chromium\/([^\s]*)/); 21460 if (m && m[1]) { 21461 o.chrome = numberify(m[1]); 21462 } 21463 if (/ Mobile$/.test(ua)) { 21464 o.mobile = 'Ubuntu'; 21465 } 21466 } 21467 21468 if (!o.webkit) { // not webkit 21469// @todo check Opera/8.01 (J2ME/MIDP; Opera Mini/2.0.4509/1316; fi; U; ssr) 21470 if (/Opera/.test(ua)) { 21471 m = ua.match(/Opera[\s\/]([^\s]*)/); 21472 if (m && m[1]) { 21473 o.opera = numberify(m[1]); 21474 } 21475 m = ua.match(/Version\/([^\s]*)/); 21476 if (m && m[1]) { 21477 o.opera = numberify(m[1]); // opera 10+ 21478 } 21479 21480 if (/Opera Mobi/.test(ua)) { 21481 o.mobile = 'opera'; 21482 m = ua.replace('Opera Mobi', '').match(/Opera ([^\s]*)/); 21483 if (m && m[1]) { 21484 o.opera = numberify(m[1]); 21485 } 21486 } 21487 m = ua.match(/Opera Mini[^;]*/); 21488 21489 if (m) { 21490 o.mobile = m[0]; // ex: Opera Mini/2.0.4509/1316 21491 } 21492 } else { // not opera or webkit 21493 m = ua.match(/MSIE ([^;]*)|Trident.*; rv:([0-9.]+)/); 21494 21495 if (m && (m[1] || m[2])) { 21496 o.ie = numberify(m[1] || m[2]); 21497 } else { // not opera, webkit, or ie 21498 m = ua.match(/Gecko\/([^\s]*)/); 21499 21500 if (m) { 21501 o.gecko = 1; // Gecko detected, look for revision 21502 m = ua.match(/rv:([^\s\)]*)/); 21503 if (m && m[1]) { 21504 o.gecko = numberify(m[1]); 21505 if (/Mobile|Tablet/.test(ua)) { 21506 o.mobile = "ffos"; 21507 } 21508 } 21509 } 21510 } 21511 } 21512 } 21513 } 21514 21515 //Check for known properties to tell if touch events are enabled on this device or if 21516 //the number of MSPointer touchpoints on this device is greater than 0. 21517 if (win && nav && !(o.chrome && o.chrome < 6)) { 21518 o.touchEnabled = (("ontouchstart" in win) || (("msMaxTouchPoints" in nav) && (nav.msMaxTouchPoints > 0))); 21519 } 21520 21521 //It was a parsed UA, do not assign the global value. 21522 if (!subUA) { 21523 21524 if (typeof process === 'object') { 21525 21526 if (process.versions && process.versions.node) { 21527 //NodeJS 21528 o.os = process.platform; 21529 o.nodejs = numberify(process.versions.node); 21530 } 21531 } 21532 21533 YUI.Env.UA = o; 21534 21535 } 21536 21537 return o; 21538}; 21539 21540 21541Y.UA = YUI.Env.UA || YUI.Env.parseUA(); 21542 21543/**
21544Performs a simple comparison between two version numbers, accounting for 21545standard versioning logic such as the fact that "535.8" is a lower version than 21546"535.24", even though a simple numerical comparison would indicate that it's 21547greater. Also accounts for cases such as "1.1" vs. "1.1.0", which are 21548considered equivalent. 21549 21550Returns -1 if version _a_ is lower than version _b_, 0 if they're equivalent, 215511 if _a_ is higher than _b_. 21552 21553Versions may be numbers or strings containing numbers and dots. For example, 21554both `535` and `"535.8.10"` are acceptable. A version string containing 21555non-numeric characters, like `"535.8.beta"`, may produce unexpected results. 21556 21557@method compareVersions 21558@param {Number|String} a First version number to compare. 21559@param {Number|String} b Second version number to compare. 21560@return -1 if _a_ is lower than _b_, 0 if they're equivalent, 1 if _a_ is 21561 higher than _b_. 21562**/ 21563Y.UA.compareVersions = function (a, b) { 21564 var aPart, aParts, bPart, bParts, i, len; 21565 21566 if (a === b) { 21567 return 0; 21568 } 21569 21570 aParts = (a + '').split('.'); 21571 bParts = (b + '').split('.'); 21572 21573 for (i = 0, len = Math.max(aParts.length, bParts.length); i < len; ++i) { 21574 aPart = parseInt(aParts[i], 10); 21575 bPart = parseInt(bParts[i], 10); 21576 21577 /*jshint expr: true*/ 21578 isNaN(aPart) && (aPart = 0); 21579 isNaN(bPart) && (bPart = 0); 21580 21581 if (aPart < bPart) { 21582 return -1; 21583 } 21584 21585 if (aPart > bPart) { 21586 return 1; 21587 } 21588 } 21589 21590 return 0; 21591}; 21592YUI.Env.aliases = { 21593 "anim": ["anim-base","anim-color","anim-curve","anim-easing","anim-node-plugin","anim-scroll","anim-xy"], 21594 "anim-shape-transform": ["anim-shape"], 21595 "app": ["app-base","app-content","app-transitions","lazy-model-list","model","model-list","model-sync-rest","model-sync-local","router","view","view-node-map"], 21596 "attribute": ["attribute-base","attribute-complex"], 21597 "attribute-events": ["attribute-observable"], 21598 "autocomplete": ["autocomplete-base","autocomplete-sources","autocomplete-list","autocomplete-plugin"], 21599 "axes": ["axis-numeric","axis-category","axis-time","axis-stacked"], 21600 "axes-base": ["axis-numeric-base","axis-category-base","axis-time-base","axis-stacked-base"], 21601 "base": ["base-base","base-pluginhost","base-build"], 21602 "cache": ["cache-base","cache-offline","cache-plugin"], 21603 "charts": ["charts-base"], 21604 "collection": ["array-extras","arraylist","arraylist-add","arraylist-filter","array-invoke"], 21605 "color": ["color-base","color-hsl","color-harmony"], 21606 "controller": ["router"], 21607 "dataschema": ["dataschema-base","dataschema-json","dataschema-xml","dataschema-array","dataschema-text"], 21608 "datasource": ["datasource-local","datasource-io","datasource-get","datasource-function","datasource-cache","datasource-jsonschema","datasource-xmlschema","datasource-arrayschema","datasource-textschema","datasource-polling"], 21609 "datatable": ["datatable-core","datatable-table","datatable-head","datatable-body","datatable-base","datatable-column-widths","datatable-message","datatable-mutable","datatable-sort","datatable-datasource"], 21610 "datatype": ["datatype-date","datatype-number","datatype-xml"], 21611 "datatype-date": ["datatype-date-parse","datatype-date-format","datatype-date-math"], 21612 "datatype-number": ["datatype-number-parse","datatype-number-format"], 21613 "datatype-xml": ["datatype-xml-parse","datatype-xml-format"], 21614 "dd": ["dd-ddm-base","dd-ddm","dd-ddm-drop","dd-drag","dd-proxy","dd-constrain","dd-drop","dd-scroll","dd-delegate"], 21615 "dom": ["dom-base","dom-screen","dom-style","selector-native","selector"], 21616 "editor": ["frame","editor-selection","exec-command","editor-base","editor-para","editor-br","editor-bidi","editor-tab","createlink-base"], 21617 "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"], 21618 "event-custom": ["event-custom-base","event-custom-complex"], 21619 "event-gestures": ["event-flick","event-move"], 21620 "handlebars": ["handlebars-compiler"], 21621 "highlight": ["highlight-base","highlight-accentfold"], 21622 "history": ["history-base","history-hash","history-html5"], 21623 "io": ["io-base","io-xdr","io-form","io-upload-iframe","io-queue"], 21624 "json": ["json-parse","json-stringify"], 21625 "loader": ["loader-base","loader-rollup","loader-yui3"], 21626 "loader-pathogen-encoder": ["loader-base","loader-rollup","loader-yui3","loader-pathogen-combo
21626handler"], 21627 "node": ["node-base","node-event-delegate","node-pluginhost","node-screen","node-style"], 21628 "pluginhost": ["pluginhost-base","pluginhost-config"], 21629 "querystring": ["querystring-parse","querystring-stringify"], 21630 "recordset": ["recordset-base","recordset-sort","recordset-filter","recordset-indexer"], 21631 "resize": ["resize-base","resize-proxy","resize-constrain"], 21632 "slider": ["slider-base","slider-value-range","clickable-rail","range-slider"], 21633 "template": ["template-base","template-micro"], 21634 "text": ["text-accentfold","text-wordbreak"], 21635 "widget": ["widget-base","widget-htmlparser","widget-skin","widget-uievents"] 21636}; 21637 21638 21639}, 'patched-v3.18.1', { 21640 "use": [ 21641 "yui-base", 21642 "get", 21643 "features", 21644 "intl-base", 21645 "yui-log", 21646 "yui-later", 21647 "loader-base", 21648 "loader-rollup", 21649 "loader-yui3" 21650 ] 21651}); 21652YUI.add('get', function (Y, NAME) { 21653 21654/*jslint boss:true, expr:true, laxbreak: true */ 21655 21656/** 21657Provides dynamic loading of remote JavaScript and CSS resources. 21658 21659@module get 21660@class Get 21661@static 21662**/ 21663 21664var Lang = Y.Lang, 21665 21666 CUSTOM_ATTRS, // defined lazily in Y.Get.Transaction._createNode() 21667 21668 Get, Transaction; 21669 21670Y.Get = Get = { 21671 // -- Public Properties ---------------------------------------------------- 21672 21673 /** 21674 Default options for CSS requests. Options specified here will override 21675 global defaults for CSS requests. 21676 21677 See the `options` property for all available options. 21678 21679 @property cssOptions 21680 @type Object 21681 @static 21682 @since 3.5.0 21683 **/ 21684 cssOptions: { 21685 attributes: { 21686 rel: 'stylesheet' 21687 }, 21688 21689 doc : Y.config.linkDoc || Y.config.doc, 21690 pollInterval: 50 21691 }, 21692 21693 /** 21694 Default options for JS requests. Options specified here will override global 21695 defaults for JS requests. 21696 21697 See the `options` property for all available options. 21698 21699 @property jsOptions 21700 @type Object 21701 @static 21702 @since 3.5.0 21703 **/ 21704 jsOptions: { 21705 autopurge: true, 21706 doc : Y.config.scriptDoc || Y.config.doc 21707 }, 21708 21709 /** 21710 Default options to use for all requests. 21711 21712 Note that while all available options are documented here for ease of 21713 discovery, some options (like callback functions) only make sense at the 21714 transaction level. 21715 21716 Callback functions specified via the options object or the `options` 21717 parameter of the `css()`, `js()`, or `load()` methods will receive the 21718 transaction object as a parameter. See `Y.Get.Transaction` for details on 21719 the properties and methods available on transactions. 21720 21721 @static 21722 @since 3.5.0 21723 @property {Object} options 21724 21725 @property {Boolean} [options.async=false] Whether or not to load scripts 21726 asynchronously, meaning they're requested in parallel and execution 21727 order is not guaranteed. Has no effect on CSS, since CSS is always 21728 loaded asynchronously. 21729 21730 @property {Object} [options.attributes] HTML attribute name/value pairs that 21731 should be added to inserted nodes. By default, the `charset` attribute 21732 will be set to "utf-8" and nodes will be given an auto-generated `id` 21733 attribute, but you can override these with your own values if desired. 21734 21735 @property {Boolean} [options.autopurge] Whether or not to automatically 21736 purge inserted nodes after the purge threshold is reached. This is 21737 `true` by default for JavaScript, but `false` for CSS since purging a
21738 CSS node will also remove any styling applied by the referenced file. 21739 21740 @property {Object} [options.context] `this` object to use when calling 21741 callback functions. Defaults to the transaction object. 21742 21743 @property {Mixed} [options.data] Arbitrary data object to pass to "on*" 21744 callbacks. 21745 21746 @property {Document} [options.doc] Document into which nodes should be 21747 inserted. By default, the current document is used. 21748 21749 @property {HTMLElement|String} [options.insertBefore] HTML element or id 21750 string of an element before which all generated nodes should be 21751 inserted. If not specified, Get will automatically determine the best 21752 place to insert nodes for maximum compatibility. 21753 21754 @property {Function} [options.onEnd] Callback to execute after a transaction 21755 is complete, regardless of whether it succeeded or failed. 21756 21757 @property {Function} [options.onFailure] Callback to execute after a 21758 transaction fails, times out, or is aborted. 21759 21760 @property {Function} [options.onProgress] Callback to execute after each 21761 individual request in a transaction either succeeds or fails. 21762 21763 @property {Function} [options.onSuccess] Callback to execute after a 21764 transaction completes successfully with no errors. Note that in browsers 21765 that don't support the `error` event on CSS `<link>` nodes, a failed CSS 21766 request may still be reported as a success because in these browsers 21767 it can be difficult or impossible to distinguish between success and 21768 failure for CSS resources. 21769 21770 @property {Function} [options.onTimeout] Callback to execute after a 21771 transaction times out. 21772 21773 @property {Number} [options.pollInterval=50] Polling interval (in 21774 milliseconds) for detecting CSS load completion in browsers that don't 21775 support the `load` event on `<link>` nodes. This isn't used for 21776 JavaScript. 21777 21778 @property {Number} [options.purgethreshold=20] Number of nodes to insert 21779 before triggering an automatic purge when `autopurge` is `true`. 21780 21781 @property {Number} [options.timeout] Number of milliseconds to wait before 21782 aborting a transaction. When a timeout occurs, the `onTimeout` callback 21783 is called, followed by `onFailure` and finally `onEnd`. By default, 21784 there is no timeout. 21785 21786 @property {String} [options.type] Resource type ("css" or "js"). This option 21787 is set automatically by the `css()` and `js()` functions and will be 21788 ignored there, but may be useful when using the `load()` function. If 21789 not specified, the type will be inferred from the URL, defaulting to 21790 "js" if the URL doesn't contain a recognizable file extension. 21791 **/ 21792 options: { 21793 attributes: { 21794 charset: 'utf-8' 21795 }, 21796 21797 purgethreshold: 20 21798 }, 21799 21800 // -- Protected Properties ------------------------------------------------- 21801 21802 /** 21803 Regex that matches a CSS URL. Used to guess the file type when it's not 21804 specified. 21805 21806 @property REGEX_CSS 21807 @type RegExp 21808 @final 21809 @protected 21810 @static 21811 @since 3.5.0 21812 **/ 21813 REGEX_CSS: /\.css(?:[?;].*)?$/i, 21814 21815 /** 21816 Regex that matches a JS URL. Used to guess the file type when it's not 21817 specified. 21818 21819 @property REGEX_JS 21820 @type RegExp 21821 @final 21822 @protected 21823 @static 21824 @since 3.5.0 21825 **/ 21826 REGEX_JS : /\.js(?:[?;].*)?$/i, 21827 21828 /** 21829 Contains information about the current environment, such as what script and 21830 link injection features it supports. 21831 21832 This object is created and populated the first time the `_getEnv()` method 21833 is called. 21834 21835 @property _env 21836 @type Object 21837 @protected 21838 @static 21839 @since 3.5.0 21840 **/ 21841 21842 /** 21843 Mapping of document _yuid strings to <head> or <base> node references so we 21844 don't have to look the node up each time we want to insert a request node. 21845 21846 @property _insertCache 21847 @type Object 21848 @protected 21849 @static 21850 @since 3.5.0 21851 **/ 21852 _insertCache: {}, 21853 21854 /** 21855 Information about the currently pending transaction, if any. 21856 21857 This is actually an object with two properties: `callback`, containing the 21858 optional callback passed to `css()`, `load()`, or `js()`; and `transaction`, 21859 containing the actual transaction instance. 21860 21861 @property _pending 21862 @type Object 21863 @protected 21864 @static 21865 @since 3.5.0 21866 **/ 21867 _pending: null, 21868 21869 /** 21870 HTML nodes eligible to be purged next time autopurge is triggered. 21871 21872 @property _purgeNodes 21873 @type HTMLElement[] 21874 @protected 21875 @static 21876 @since 3.5.0 21877 **/ 21878 _purgeNodes: [], 21879 21880 /** 21881 Queued transactions and associated callbacks. 21882 21883 @property _queue 21884 @type Object[] 21885 @protected 21886 @static 21887 @since 3.5.0 21888 **/ 21889 _queue: [], 21890 21891 // -- Public Methods ------------------------------------------------------- 21892 21893 /** 21894 Aborts the specified transaction. 21895 21896 This will cause the transaction's `onFailure` callback to be called and 21897 will prevent any new script and link nodes from being added to the document, 21898 but any resources that have already been requested will continue loading 21899 (there's no safe way to prevent this, unfortunately). 21900 21901 *Note:* This method is deprecated as of 3.5.0, and will be removed in a 21902 future version of YUI. Use the transaction-level `abort()` method instead. 21903 21904 @method abort 21905 @param {Get.Transaction} transaction Transaction to abort. 21906 @deprecated Use the `abort()` method on the transaction instead. 21907 @static 21908 **/ 21909 abort: function (transaction) { 21910 var i, id, item, len, pending; 21911 21912 21913 if (!transaction.abort) { 21914 id = transaction; 21915 pending = this._pending; 21916 transaction = null; 21917 21918 if (pending && pending.transaction.id === id) { 21919 transaction = pending.transaction; 21920 this._pending = null; 21921 } else { 21922 for (i = 0, len = this._queue.length; i < len; ++i) { 21923 item = this._queue[i].transaction; 21924 21925 if (item.id === id) { 21926 transaction = item; 21927 this._queue.splice(i, 1); 21928 break; 21929 } 21930 } 21931 } 21932 } 21933 21934 transaction && transaction.abort(); 21935 }, 21936 21937 /** 21938 Loads one or more CSS files. 21939 21940 The _urls_ parameter may be provided as a URL string, a request object, 21941 or an array of URL strings and/or request objects. 21942 21943 A request object is just an object that contains a `url` property and zero 21944 or more options that should apply specifically to that request. 21945 Request-specific options take priority over transaction-level options and 21946 default options. 21947 21948 URLs may be relative or absolute, and do not have to have the same origin 21949 as the current page. 21950 21951 The `options` parameter may be omitted completely and a callback passed in 21952 its place, if desired. 21953 21954 @example 21955 21956 // Load a single CSS file and log a message on completion. 21957 Y.Get.css('foo.css', function (err) { 21958 if (err) { 21959 } else { 21960 } 21961 }); 21962 21963 // Load multiple CSS files and log a message when all have finished 21964 // loading. 21965 var urls = ['foo.css', 'http://example.com/bar.css', 'baz/quux.css']; 21966 21967 Y.Get.css(urls, function (err) { 21968 if (err) { 21969 } else { 21970 } 21971 }); 21972 21973 // Specify transaction-level options, which will apply to all requests 21974 // within the transaction. 21975 Y.Get.css(urls, { 21976 attributes: {'class': 'my-css'}, 21977 timeout : 5000 21978 }); 21979 21980 // Specify per-request options, which override transaction-level and 21981 // default options. 21982 Y.Get.css([ 21983 {url: 'foo.css', attributes: {id: 'foo'}}, 21984 {url: 'bar.css', attributes: {id: 'bar', charset: 'iso-8859-1'}} 21985 ]); 21986 21987 @method css 21988 @param {String|Object|Array}
21988 urls URL string, request object, or array 21989 of URLs and/or request objects to load. 21990 @param {Object} [options] Options for this transaction. See the 21991 `Y.Get.options` property for a complete list of available options. 21992 @param {Function} [callback] Callback function to be called on completion. 21993 This is a general callback and will be called before any more granular 21994 callbacks (`onSuccess`, `onFailure`, etc.) specified in the `options` 21995 object. 21996 21997 @param {Array|null} callback.err Array of errors that occurred during 21998 the transaction, or `null` on success. 21999 @param {Get.Transaction} callback.transaction Transaction object. 22000 22001 @return {Get.Transaction} Transaction object. 22002 @static 22003 **/ 22004 css: function (urls, options, callback) { 22005 return this._load('css', urls, options, callback); 22006 }, 22007 22008 /** 22009 Loads one or more JavaScript resources. 22010 22011 The _urls_ parameter may be provided as a URL string, a request object, 22012 or an array of URL strings and/or request objects. 22013 22014 A request object is just an object that contains a `url` property and zero 22015 or more options that should apply specifically to that request. 22016 Request-specific options take priority over transaction-level options and 22017 default options. 22018 22019 URLs may be relative or absolute, and do not have to have the same origin 22020 as the current page. 22021 22022 The `options` parameter may be omitted completely and a callback passed in 22023 its place, if desired. 22024 22025 Scripts will be executed in the order they're specified unless the `async` 22026 option is `true`, in which case they'll be loaded in parallel and executed 22027 in whatever order they finish loading. 22028 22029 @example 22030 22031 // Load a single JS file and log a message on completion. 22032 Y.Get.js('foo.js', function (err) { 22033 if (err) { 22034 } else { 22035 } 22036 }); 22037 22038 // Load multiple JS files, execute them in order, and log a message when 22039 // all have finished loading. 22040 var urls = ['foo.js', 'http://example.com/bar.js', 'baz/quux.js']; 22041 22042 Y.Get.js(urls, function (err) { 22043 if (err) { 22044 } else { 22045 } 22046 }); 22047 22048 // Specify transaction-level options, which will apply to all requests 22049 // within the transaction. 22050 Y.Get.js(urls, { 22051 attributes: {'class': 'my-js'}, 22052 timeout : 5000 22053 }); 22054 22055 // Specify per-request options, which override transaction-level and 22056 // default options. 22057 Y.Get.js([ 22058 {url: 'foo.js', attributes: {id: 'foo'}}, 22059 {url: 'bar.js', attributes: {id: 'bar', charset: 'iso-8859-1'}} 22060 ]); 22061 22062 @method js 22063 @param {String|Object|Array} urls URL string, request object, or array 22064 of URLs and/or request objects to load. 22065 @param {Object} [options] Options for this transaction. See the 22066 `Y.Get.options` property for a complete list of available options. 22067 @param {Function} [callback] Callback function to be called on completion. 22068 This is a general callback and will be called before any more granular 22069 callbacks (`onSuccess`, `onFailure`, etc.) specified in the `options` 22070 object. 22071 22072 @param {Array|null} callback.err Array of errors that occurred during 22073 the transaction, or `null` on success. 22074 @param {Get.Transaction} callback.transaction Transaction object. 22075 22076 @return {Get.Transaction} Transaction object. 22077 @since 3.5.0 22078 @static 22079 **/ 22080 js: function (urls, options, callback) { 22081 return this._load('js', urls, options, callback); 22082 }, 22083 22084 /** 22085 Loads one or more CSS and/or JavaScript resources in the same transaction. 22086 22087 Use this method when you want to load both CSS and JavaScript in a single 22088 transaction and be notified when all requested URLs have finished loading, 22089 regardless of type. 22090 22091 Behavior and options are the same as for the `css()` and `js()` methods. If 22092 a resource type isn't specified in per-request options or transaction-level 22093 options, Get will guess the file type based on the URL's extension (`.css` 22094 or `.js`, with or without a following query string). If the file type can't 22095 be guessed from the URL, a warning will be logged and Get will assume the 22096 URL is a JavaScript resource. 22097 22098 @example 22099 22100 // Load both CSS and JS files in a single transaction, and log a message 22101 // when all files have finished loading. 22102 Y.Get.load(['foo.css', 'bar.js', 'baz.css'], function (err) { 22103 if (err) { 22104 } else { 22105 } 22106 }); 22107 22108 @method load 22109 @param {String|Object|Array}
22109 urls URL string, request object, or array 22110 of URLs and/or request objects to load. 22111 @param {Object} [options] Options for this transaction. See the 22112 `Y.Get.options` property for a complete list of available options. 22113 @param {Function} [callback] Callback function to be called on completion. 22114 This is a general callback and will be called before any more granular 22115 callbacks (`onSuccess`, `onFailure`, etc.) specified in the `options` 22116 object. 22117 22118 @param {Array|null} err Array of errors that occurred during the 22119 transaction, or `null` on success. 22120 @param {Get.Transaction} Transaction object. 22121 22122 @return {Get.Transaction} Transaction object. 22123 @since 3.5.0 22124 @static 22125 **/ 22126 load: function (urls, options, callback) { 22127 return this._load(null, urls, options, callback); 22128 }, 22129 22130 // -- Protected Methods ---------------------------------------------------- 22131 22132 /** 22133 Triggers an automatic purge if the purge threshold has been reached. 22134 22135 @method _autoPurge 22136 @param {Number} threshold Purge threshold to use, in milliseconds. 22137 @protected 22138 @since 3.5.0 22139 @static 22140 **/ 22141 _autoPurge: function (threshold) { 22142 if (threshold && this._purgeNodes.length >= threshold) { 22143 this._purge(this._purgeNodes); 22144 } 22145 }, 22146 22147 /** 22148 Populates the `_env` property with information about the current 22149 environment. 22150 22151 @method _getEnv 22152 @return {Object} Environment information. 22153 @protected 22154 @since 3.5.0 22155 @static 22156 **/ 22157 _getEnv: function () { 22158 var doc = Y.config.doc, 22159 ua = Y.UA; 22160 22161 // Note: some of these checks require browser sniffs since it's not 22162 // feasible to load test files on every pageview just to perform a 22163 // feature test. I'm sorry if this makes you sad. 22164 return (this._env = { 22165 22166 // True if this is a browser that supports disabling async mode on 22167 // dynamically created script nodes. See 22168 // https://developer.mozilla.org/En/HTML/Element/Script#Attributes 22169 22170 // IE10 doesn't return true for the MDN feature test, so setting it explicitly, 22171 // because it is async by default, and allows you to disable async by setting it to false 22172 async: (doc && doc.createElement('script').async === true) || (ua.ie >= 10), 22173 22174 // True if this browser fires an event when a dynamically injected 22175 // link node fails to load. This is currently true for Firefox 9+ 22176 // and WebKit 535.24+ 22177 cssFail: ua.gecko >= 9 || ua.compareVersions(ua.webkit, 535.24) >= 0, 22178 22179 // True if this browser fires an event when a dynamically injected 22180 // link node finishes loading. This is currently true for IE, Opera, 22181 // Firefox 9+, and WebKit 535.24+. Note that IE versions <9 fire the 22182 // DOM 0 "onload" event, but not "load". All versions of IE fire 22183 // "onload". 22184 // davglass: Seems that Chrome on Android needs this to be false. 22185 cssLoad: ( 22186 (!ua.gecko && !ua.webkit) || ua.gecko >= 9 || 22187 ua.compareVersions(ua.webkit, 535.24) >= 0 22188 ) && !(ua.chrome && ua.chrome <= 18), 22189 22190 // True if this browser preserves script execution order while 22191 // loading scripts in parallel as long as the script node's `async` 22192 // attribute is set to false to explicitly disable async execution. 22193 preservesScriptOrder: !!(ua.gecko || ua.opera || (ua.ie && ua.ie >= 10)) 22194 }); 22195 }, 22196 22197 _getTransaction: function (urls, options) { 22198 var requests = [], 22199 i, len, req, url; 22200 22201 if (!Lang.isArray(urls)) { 22202 urls = [urls]; 22203 } 22204 22205 options = Y.merge(this.options, options); 22206 22207 // Clone the attributes object so we don't end up modifying it by ref. 22208 options.attributes = Y.merge(this.options.attributes, 22209 options.attributes); 22210 22211 for (i = 0, len = urls.length; i < len; ++i) { 22212 url = urls[i]; 22213 req = {attributes: {}}; 22214 22215 // If `url` is a string, we create a URL object for it, then mix in 22216 // global options and request-specific options. If it's an object 22217 // with a "url" property, we assume it's a request object c
22217ontaining 22218 // URL-specific options. 22219 if (typeof url === 'string') { 22220 req.url = url; 22221 } else if (url.url) { 22222 // URL-specific options override both global defaults and 22223 // request-specific options. 22224 Y.mix(req, url, false, null, 0, true); 22225 url = url.url; // Make url a string so we can use it later. 22226 } else { 22227 continue; 22228 } 22229 22230 Y.mix(req, options, false, null, 0, true); 22231 22232 // If we didn't get an explicit type for this URL either in the 22233 // request options or the URL-specific options, try to determine 22234 // one from the file extension. 22235 if (!req.type) { 22236 if (this.REGEX_CSS.test(url)) { 22237 req.type = 'css'; 22238 } else { 22239 if (!this.REGEX_JS.test(url)) { 22240 } 22241 22242 req.type = 'js'; 22243 } 22244 } 22245 22246 // Mix in type-specific default options, but don't overwrite any 22247 // options that have already been set. 22248 Y.mix(req, req.type === 'js' ? this.jsOptions : this.cssOptions, 22249 false, null, 0, true); 22250 22251 // Give the node an id attribute if it doesn't already have one. 22252 req.attributes.id || (req.attributes.id = Y.guid()); 22253 22254 // Backcompat for <3.5.0 behavior. 22255 if (req.win) { 22256 req.doc = req.win.document; 22257 } else { 22258 req.win = req.doc.defaultView || req.doc.parentWindow; 22259 } 22260 22261 if (req.charset) { 22262 req.attributes.charset = req.charset; 22263 } 22264 22265 requests.push(req); 22266 } 22267 22268 return new Transaction(requests, options); 22269 }, 22270 22271 _load: function (type, urls, options, callback) { 22272 var transaction; 22273 22274 // Allow callback as third param. 22275 if (typeof options === 'function') { 22276 callback = options; 22277 options = {}; 22278 } 22279 22280 options || (options = {}); 22281 options.type = type; 22282 22283 options._onFinish = Get._onTransactionFinish; 22284 22285 if (!this._env) { 22286 this._getEnv(); 22287 } 22288 22289 transaction = this._getTransaction(urls, options); 22290 22291 this._queue.push({ 22292 callback : callback, 22293 transaction: transaction 22294 }); 22295 22296 this._next(); 22297 22298 return transaction; 22299 }, 22300 22301 _onTransactionFinish : function() { 22302 Get._pending = null; 22303 Get._next(); 22304 }, 22305 22306 _next: function () { 22307 var item; 22308 22309 if (this._pending) { 22310 return; 22311 } 22312 22313 item = this._queue.shift(); 22314 22315 if (item) { 22316 this._pending = item; 22317 item.transaction.execute(item.callback); 22318 } 22319 }, 22320 22321 _purge: function (nodes) { 22322 var purgeNodes = this._purgeNodes, 22323 isTransaction = nodes !== purgeNodes, 22324 index, node; 22325 22326 while (node = nodes.pop()) { // assignment 22327 // Don't purge nodes that haven't finished loading (or errored out), 22328 // since this can hang the transaction. 22329 if (!node._yuiget_finished) { 22330 continue; 22331 } 22332 22333 node.parentNode && node.parentNode.removeChild(node); 22334 22335 // If this is a transaction-level purge and this node also exists in 22336 // the Get-level _purgeNodes array, we need to remove it from 22337 // _purgeNodes to avoid creating a memory leak. The indexOf lookup 22338 // sucks, but until we get WeakMaps, this is the least troublesome 22339 // way to do this (we can't just hold onto node ids because they may 22340 // not be in the same document). 22341 if (isTransaction) { 22342 index = Y.Array.indexOf(purgeNodes, node); 22343 22344 if (index > -1) { 22345 purgeNodes.splice(index, 1); 22346 } 22347 } 22348 } 22349 } 22350}; 22351 22352/** 22353Alias for `js()`. 22354 22355@method script 22356@static 22357**/ 22358Get.script = Get.js; 22359 22360/** 22361Represents a Get transaction, which may contain requests for one or more JS or 22362CSS files. 22363 22364This class should not be instantiated manually. Instances will be created and
22365returned as needed by Y.Get's `css()`, `js()`, and `load()` methods. 22366 22367@class Get.Transaction 22368@constructor 22369@since 3.5.0 22370**/ 22371Get.Transaction = Transaction = function (requests, options) { 22372 var self = this; 22373 22374 self.id = Transaction._lastId += 1; 22375 self.data = options.data; 22376 self.errors = []; 22377 self.nodes = []; 22378 self.options = options; 22379 self.requests = requests; 22380 22381 self._callbacks = []; // callbacks to call after execution finishes 22382 self._queue = []; 22383 self._reqsWaiting = 0; 22384 22385 // Deprecated pre-3.5.0 properties. 22386 self.tId = self.id; // Use `id` instead. 22387 self.win = options.win || Y.config.win; 22388}; 22389 22390/** 22391Arbitrary data object associated with this transaction. 22392 22393This object comes from the options passed to `Get.css()`, `Get.js()`, or 22394`Get.load()`, and will be `undefined` if no data object was specified. 22395 22396@property {Object} data 22397**/ 22398 22399/** 22400Array of errors that have occurred during this transaction, if any. Each error 22401object has the following properties: 22402`errors.error`: Error message. 22403`errors.request`: Request object related to the error. 22404 22405@since 3.5.0 22406@property {Object[]} errors 22407**/ 22408 22409/** 22410Numeric id for this transaction, unique among all transactions within the same 22411YUI sandbox in the current pageview. 22412 22413@property {Number} id 22414@since 3.5.0 22415**/ 22416 22417/**
22418HTMLElement nodes (native ones, not YUI Node instances) that have been inserted 22419during the current transaction. 22420 22421@property {HTMLElement[]} nodes 22422**/ 22423 22424/** 22425Options associated with this transaction. 22426 22427See `Get.options` for the full list of available options. 22428 22429@property {Object} options 22430@since 3.5.0 22431**/ 22432 22433/** 22434Request objects contained in this transaction. Each request object represents 22435one CSS or JS URL that will be (or has been) requested and loaded into the page. 22436 22437@property {Object} requests 22438@since 3.5.0 22439**/ 22440 22441/** 22442Id of the most recent transaction. 22443 22444@property _lastId 22445@type Number 22446@protected 22447@static 22448**/ 22449Transaction._lastId = 0; 22450 22451Transaction.prototype = { 22452 // -- Public Properties ---------------------------------------------------- 22453 22454 /** 22455 Current state of this transaction. One of "new", "executing", or "done". 22456 22457 @property _state 22458 @type String 22459 @protected 22460 **/ 22461 _state: 'new', // "new", "executing", or "done" 22462 22463 // -- Public Methods ------------------------------------------------------- 22464 22465 /** 22466 Aborts this transaction. 22467 22468 This will cause the transaction's `onFailure` callback to be called and 22469 will prevent any new script and link nodes from being added to the document, 22470 but any resources that have already been requested will continue loading 22471 (there's no safe way to prevent this, unfortunately). 22472 22473 @method abort 22474 @param {String} [msg="Aborted."] Optional message to use in the `errors` 22475 array describing why the transaction was aborted. 22476 **/ 22477 abort: function (msg) { 22478 this._pending = null; 22479 this._pendingCSS = null; 22480 this._pollTimer = clearTimeout(this._pollTimer); 22481 this._queue = []; 22482 this._reqsWaiting = 0; 22483 22484 this.errors.push({error: msg || 'Aborted'}); 22485 this._finish(); 22486 }, 22487 22488 /** 22489 Begins execting the transaction. 22490 22491 There's usually no reason to call this manually, since Get will call it 22492 automatically when other pending transactions have finished. If you really 22493 want to execute your transaction before Get does, you can, but be aware that 22494 this transaction's scripts may end up executing before the scripts in other 22495 pending transactions. 22496 22497 If the transaction is already executing, the specified callback (if any) 22498 will be queued and called after execution finishes. If the transaction has 22499 already finished, the callback will be called immediately (the transaction 22500 will not be executed again). 22501 22502 @method execute 22503 @param {Function} callback Callback function to execute after all requests 22504 in the transaction are complete, or after the transaction is aborted. 22505 **/ 22506 execute: function (callback) { 22507 var self = this, 22508 requests = self.requests, 22509 state = self._state, 22510 i, len, queue, req; 22511 22512 if (state === 'done') { 22513 callback && callback(self.errors.length ? self.errors : null, self); 22514 return; 22515 } else { 22516 callback && self._callbacks.push(callback); 22517 22518 if (state === 'executing') { 22519 return; 22520 } 22521 } 22522 22523 self._state = 'executing'; 22524 self._queue = queue = []; 22525 22526 if (self.options.timeout) { 22527 self._timeout = setTimeout(function () { 22528 self.abort('Timeout'); 22529 }, self.options.timeout); 22530 } 22531 22532 self._reqsWaiting = requests.length; 22533 22534 for (i = 0, len = requests.length; i < len; ++i) { 22535 req = requests[i]; 22536 22537 if (req.async || req.type === 'css') { 22538 // No need to queue CSS or fully async JS. 22539 self._insert(req); 22540 } else { 22541 queue.push(req); 22542 } 22543 } 22544 22545 self._next(); 22546 }, 22547 22548 /** 22549 Manually purges any `<script>` or `<link>` nodes this transaction has 22550 created. 22551 22552 Be careful when purging a transaction that contains CSS requests, since 22553 removing `<link>` nodes will also remove any styles they applied. 22554 22555 @method purge 22556 **/ 22557 purge: function () { 22558 Get._purge(this.nodes); 22559 }, 22560 22561 // -- Protected Methods ---------------------------------------------------- 22562 _createNode: function (name, attrs, doc) { 22563 var node = doc.createElement(name), 22564 attr, testEl; 22565 22566 if (!CUSTOM_ATTRS) { 22567 // IE6 and IE7 expect property names rather than attribute names for 22568 // certain attributes. Rather than sniffing, we do a quick feature 22569 // test the first time _createNode() runs to determine whether we 22570 // need to provide a workaround. 22571 testEl = doc.createElement('div'); 22572 testEl.setAttribute('class', 'a'); 22573 22574 CUSTOM_ATTRS = testEl.className === 'a' ? {} : { 22575 'for' : 'htmlFor', 22576 'class': 'className' 22577 }; 22578 } 22579 22580 for (attr in attrs) { 22581 if (attrs.hasOwnProperty(attr)) { 22582 node.setAttribute(CUSTOM_ATTRS[attr] || attr, attrs[attr]); 22583 } 22584 } 22585 22586 return node; 22587 }, 22588 22589 _finish: function () { 22590 var errors = this.errors.length ? this.errors : null, 22591 options = this.options, 22592 thisObj = options.context || this, 22593 data, i, len; 22594 22595 if (this._state === 'done') { 22596 return; 22597 } 22598 22599 this._state = 'done'; 22600 22601 for (i = 0, len = this._callbacks.length; i < len; ++i) { 22602 this._callbacks[i].call(thisObj, errors, this); 22603 } 22604 22605 data = this._getEventData(); 22606 22607 if (errors) {
22608 if (options.onTimeout && errors[errors.length - 1].error === 'Timeout') { 22609 options.onTimeout.call(thisObj, data); 22610 } 22611 22612 if (options.onFailure) { 22613 options.onFailure.call(thisObj, data); 22614 } 22615 } else if (options.onSuccess) { 22616 options.onSuccess.call(thisObj, data); 22617 } 22618 22619 if (options.onEnd) { 22620 options.onEnd.call(thisObj, data); 22621 } 22622 22623 if (options._onFinish) { 22624 options._onFinish(); 22625 } 22626 }, 22627 22628 _getEventData: function (req) { 22629 if (req) { 22630 // This merge is necessary for backcompat. I hate it. 22631 return Y.merge(this, { 22632 abort : this.abort, // have to copy these because the prototype isn't preserved 22633 purge : this.purge, 22634 request: req, 22635 url : req.url, 22636 win : req.win 22637 }); 22638 } else { 22639 return this; 22640 } 22641 }, 22642 22643 _getInsertBefore: function (req) { 22644 var doc = req.doc, 22645 el = req.insertBefore, 22646 cache, docStamp; 22647 22648 if (el) { 22649 return typeof el === 'string' ? doc.getElementById(el) : el; 22650 } 22651 22652 cache = Get._insertCache; 22653 docStamp = Y.stamp(doc); 22654 22655 if ((el = cache[docStamp])) { // assignment 22656 return el; 22657 } 22658 22659 // Inserting before a <base> tag apparently works around an IE bug 22660 // (according to a comment from pre-3.5.0 Y.Get), but I'm not sure what 22661 // bug that is, exactly. Better safe than sorry? 22662 if ((el = doc.getElementsByTagName('base')[0])) { // assignment 22663 return (cache[docStamp] = el); 22664 } 22665 22666 // Look for a <head> element. 22667 el = doc.head || doc.getElementsByTagName('head')[0]; 22668 22669 if (el) { 22670 // Create a marker node at the end of <head> to use as an insertion 22671 // point. Inserting before this node will ensure that all our CSS 22672 // gets inserted in the correct order, to maintain style precedence. 22673 el.appendChild(doc.createTextNode('')); 22674 return (cache[docStamp] = el.lastChild); 22675 } 22676 22677 // If all else fails, just insert before the first script node on the 22678 // page, which is virtually guaranteed to exist. 22679 return (cache[docStamp] = doc.getElementsByTagName('script')[0]); 22680 }, 22681 22682 _insert: function (req) { 22683 var env = Get._env, 22684 insertBefore = this._getInsertBefore(req), 22685 isScript = req.type === 'js', 22686 node = req.node, 22687 self = this, 22688 ua = Y.UA, 22689 cssTimeout, nodeType; 22690 22691 if (!node) { 22692 if (isScript) { 22693 nodeType = 'script'; 22694 } else if (!env.cssLoad && ua.gecko) { 22695 nodeType = 'style'; 22696 } else { 22697 nodeType = 'link'; 22698 } 22699 22700 node = req.node = this._createNode(nodeType, req.attributes, 22701 req.doc); 22702 } 22703 22704 function onError() { 22705 self._progress('Failed to load ' + req.url, req); 22706 } 22707 22708 function onLoad() { 22709 if (cssTimeout) { 22710 clearTimeout(cssTimeout); 22711 } 22712 22713 self._progress(null, req); 22714 } 22715 22716 // Deal with script asynchronicity. 22717 if (isScript) { 22718 node.setAttribute('src', req.url); 22719 22720 if (req.async) { 22721 // Explicitly indicate that we want the browser to execute this 22722 // script asynchronously. This is necessary for older browsers 22723 // like Firefox <4. 22724 node.async = true; 22725 } else { 22726 if (env.async) { 22727 // This browser treats injected scripts as async by default 22728 // (standard HTML5 behavior) but asynchronous loading isn't 22729 // desired, so tell the browser not to mark this script as 22730 // async. 22731 node.async = false; 22732 } 22733 22734 // If this browser doesn't preserve script execution order based 22735 // on insertion order, we'll need to avoid inserting other 22736 // scripts until this one finishes loading. 22737 if (!env.preservesScriptOrder) { 22738 this._pending = req; 22739 } 22740 } 22741 } else { 22742 if (!env.cssLoad && ua.gecko) { 22743 // In Firefox <9, we can import the requested URL into a <style> 22744 // node and poll for the existence of node.sheet.cssRules. This 22745 // gives us a reliable way to determine CSS load completion that 22746 // also works for cross-domain stylesheets. 22747 // 22748 // Props to Zach Leatherman for calling my attention to this 22749 // technique. 22750 node.innerHTML = (req.attributes.charset ? 22751 '@charset "' + req.attributes.charset + '";' : '') + 22752 '@import "' + req.url + '";'; 22753 } else { 22754 node.setAttribute('href', req.url); 22755 } 22756 } 22757 22758 // Inject the node. 22759 if (isScript && ua.ie && (ua.ie < 9 || (document.documentMode && document.documentMode < 9))) { 22760 // Script on IE < 9, and IE 9+ when in IE 8 or older modes, including quirks mode. 22761 node.onreadystatechange = function () { 22762 if (/loaded|complete/.test(node.readyState)) { 22763 node.onreadystatechange = null; 22764 onLoad(); 22765 } 22766 }; 22767 } else if (!isScript && !env.cssLoad) { 22768 // CSS on Firefox <9 or WebKit. 22769 this._poll(req); 22770 } else { 22771 // Script or CSS on everything else. Using DOM 0 events because that 22772 // evens the playing field with older IEs. 22773 22774 if (ua.ie >= 10) { 22775 22776 // We currently need to introduce a timeout for IE10, since it 22777 // calls onerror/onload synchronously for 304s - messing up existing 22778 // program flow. 22779 22780 // Remove this block if the following bug gets fixed by GA 22781 /*jshint maxlen: 1500 */ 22782 // https://connect.microsoft.com/IE/feedback/details/763871/dynamically-loaded-scripts-with-304s-responses-interrupt-the-currently-executing-js-thread-onload 22783 node.onerror = function() { setTimeout(onError, 0); }; 22784 node.onload = function() { setTimeout(onLoad, 0); }; 22785 } else { 22786 node.onerror = onError; 22787 node.onload = onLoad; 22788 } 22789 22790 // If this browser doesn't fire an event when CSS fails to load, 22791 // fail after a timeout to avoid blocking the transaction queue. 22792 if (!env.cssFail && !isScript) { 22793 cssTimeout = setTimeout(onError, req.timeout || 3000); 22794 } 22795 } 22796 22797 this.nodes.push(node); 22798 insertBefore.parentNode.insertBefore(node, insertBefore); 22799 }, 22800 22801 _next: function () {
22802 if (this._pending) { 22803 return; 22804 } 22805 22806 // If there are requests in the queue, insert the next queued request. 22807 // Otherwise, if we're waiting on already-inserted requests to finish, 22808 // wait longer. If there are no queued requests and we're not waiting 22809 // for anything to load, then we're done! 22810 if (this._queue.length) { 22811 this._insert(this._queue.shift()); 22812 } else if (!this._reqsWaiting) { 22813 this._finish(); 22814 } 22815 }, 22816 22817 _poll: function (newReq) { 22818 var self = this, 22819 pendingCSS = self._pendingCSS, 22820 isWebKit = Y.UA.webkit, 22821 i, hasRules, j, nodeHref, req, sheets; 22822 22823 if (newReq) { 22824 pendingCSS || (pendingCSS = self._pendingCSS = []); 22825 pendingCSS.push(newReq); 22826 22827 if (self._pollTimer) { 22828 // A poll timeout is already pending, so no need to create a 22829 // new one. 22830 return; 22831 } 22832 } 22833 22834 self._pollTimer = null; 22835 22836 // Note: in both the WebKit and Gecko hacks below, a CSS URL that 404s 22837 // will still be treated as a success. There's no good workaround for 22838 // this. 22839 22840 for (i = 0; i < pendingCSS.length; ++i) { 22841 req = pendingCSS[i]; 22842 22843 if (isWebKit) { 22844 // Look for a stylesheet matching the pending URL. 22845 sheets = req.doc.styleSheets; 22846 j = sheets.length; 22847 nodeHref = req.node.href; 22848 22849 while (--j >= 0) { 22850 if (sheets[j].href === nodeHref) { 22851 pendingCSS.splice(i, 1); 22852 i -= 1; 22853 self._progress(null, req); 22854 break; 22855 } 22856 } 22857 } else { 22858 // Many thanks to Zach Leatherman for calling my attention to 22859 // the @import-based cross-domain technique used here, and to 22860 // Oleg Slobodskoi for an earlier same-domain implementation. 22861 // 22862 // See Zach's blog for more details: 22863 // http://www.zachleat.com/web/2010/07/29/load-css-dynamically/ 22864 try { 22865 // We don't really need to store this value since we never 22866 // use it again, but if we don't store it, Closure Compiler 22867 // assumes the code is useless and removes it. 22868 hasRules = !!req.node.sheet.cssRules; 22869 22870 // If we get here, the stylesheet has loaded. 22871 pendingCSS.splice(i, 1); 22872 i -= 1; 22873 self._progress(null, req); 22874 } catch (ex) { 22875 // An exception means the stylesheet is still loading. 22876 } 22877 } 22878 } 22879 22880 if (pendingCSS.length) { 22881 self._pollTimer = setTimeout(function () { 22882 self._poll.call(self); 22883 }, self.options.pollInterval); 22884 } 22885 }, 22886 22887 _progress: function (err, req) { 22888 var options = this.options; 22889 22890 if (err) { 22891 req.error = err; 22892 22893 this.errors.push({ 22894 error : err, 22895 request: req 22896 }); 22897 22898 } 22899 22900 req.node._yuiget_finished = req.finished = true; 22901 22902 if (options.onProgress) { 22903 options.onProgress.call(options.context || this, 22904 this._getEventData(req)); 22905 } 22906 22907 if (req.autopurge) { 22908 // Pre-3.5.0 Get always excludes the most recent node from an 22909 // autopurge. I find this odd, but I'm keeping that behavior for 22910 // the sake of backcompat. 22911 Get._autoPurge(this.options.purgethreshold); 22912 Get._purgeNodes.push(req.node); 22913 } 22914 22915 if (this._pending === req) { 22916 this._pending = null; 22917 } 22918 22919 this._reqsWaiting -= 1; 22920 22921 this._next(); 22922 } 22923}; 22924 22925 22926}, 'patched-v3.18.1', {"requires": ["yui-base"]}); 22927YUI.add('features', function (Y, NAME) { 22928 22929var feature_tests = {}; 22930 22931/** 22932Contains the core of YUI's feature test architecture. 22933@module features 22934*/ 22935 22936/** 22937* Feature detection 22938* @class Features 22939* @static 22940*/ 22941 22942Y.mix(Y.namespace('Features'), { 22943 22944 /** 22945 * Object hash of all registered feature tests 22946 * @property tests 22947 * @type Object 22948 */ 22949 tests: feature_tests, 22950 22951 /** 22952 * Add a test to the system 22953 * 22954 * ``` 22955 * Y.Features.add("load", "1", {}); 22956 * ``` 22957 * 22958 * @method add 22959 * @param {String} cat The category, right now only 'load' is supported 22960 * @param {String}
22960 name The number sequence of the test, how it's reported in the URL or config: 1, 2, 3 22961 * @param {Object} o Object containing test properties 22962 * @param {String} o.name The name of the test 22963 * @param {Function} o.test The test function to execute, the only argument to the function is the `Y` instance 22964 * @param {String} o.trigger The module that triggers this test. 22965 */ 22966 add: function(cat, name, o) { 22967 feature_tests[cat] = feature_tests[cat] || {}; 22968 feature_tests[cat][name] = o; 22969 }, 22970 /** 22971 * Execute all tests of a given category and return the serialized results 22972 * 22973 * ``` 22974 * caps=1:1;2:1;3:0 22975 * ``` 22976 * @method all 22977 * @param {String} cat The category to execute 22978 * @param {Array} args The arguments to pass to the test function 22979 * @return {String} A semi-colon separated string of tests and their success/failure: 1:1;2:1;3:0 22980 */ 22981 all: function(cat, args) { 22982 var cat_o = feature_tests[cat], 22983 // results = {}; 22984 result = []; 22985 if (cat_o) { 22986 Y.Object.each(cat_o, function(v, k) { 22987 result.push(k + ':' + (Y.Features.test(cat, k, args) ? 1 : 0)); 22988 }); 22989 } 22990 22991 return (result.length) ? result.join(';') : ''; 22992 }, 22993 /** 22994 * Run a specific test and return a Boolean response. 22995 * 22996 * ``` 22997 * Y.Features.test("load", "1"); 22998 * ``` 22999 * 23000 * @method test 23001 * @param {String} cat The category of the test to run 23002 * @param {String} name The name of the test to run 23003 * @param {Array} args The arguments to pass to the test function 23004 * @return {Boolean} True or false if the test passed/failed. 23005 */ 23006 test: function(cat, name, args) { 23007 args = args || []; 23008 var result, ua, test, 23009 cat_o = feature_tests[cat], 23010 feature = cat_o && cat_o[name]; 23011 23012 if (!feature) { 23013 } else { 23014 23015 result = feature.result; 23016 23017 if (Y.Lang.isUndefined(result)) { 23018 23019 ua = feature.ua; 23020 if (ua) { 23021 result = (Y.UA[ua]); 23022 } 23023 23024 test = feature.test; 23025 if (test && ((!ua) || result)) { 23026 result = test.apply(Y, args); 23027 } 23028 23029 feature.result = result; 23030 } 23031 } 23032 23033 return result; 23034 } 23035}); 23036 23037// Y.Features.add("load", "1", {}); 23038// Y.Features.test("load", "1"); 23039// caps=1:1;2:0;3:1; 23040 23041/* This file is auto-generated by (yogi loader --yes --mix --start ../) */ 23042/*jshint maxlen:900, eqeqeq: false */ 23043var add = Y.Features.add; 23044// app-transitions-native 23045add('load', '0', { 23046 "name": "app-transitions-native", 23047 "test": function (Y) { 23048 var doc = Y.config.doc, 23049 node = doc ? doc.documentElement : null; 23050 23051 if (node && node.style) { 23052 return ('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); 23053 } 23054 23055 return false; 23056}, 23057 "trigger": "app-transitions" 23058}); 23059// autocomplete-list-keys 23060add('load', '1', { 23061 "name": "autocomplete-list-keys", 23062 "test": function (Y) { 23063 // Only add keyboard support to autocomplete-list if this doesn't appear to 23064 // be an iOS or Android-based mobile device. 23065 // 23066 // There's currently no feasible way to actually detect whether a device has 23067 // a hardware keyboard, so this sniff will have to do. It can easily be 23068 // overridden by manually loading the autocomplete-list-keys module. 23069 // 23070 // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari 23071 // doesn't fire the keyboard events used by AutoCompleteList, so there's 23072 // no point loading the -keys module even when a bluetooth keyboard may be 23073 // available. 23074 return !(Y.UA.ios || Y.UA.android); 23075}, 23076 "trigger": "autocomplete-list" 23077}); 23078// dd-gestures 23079add('load', '2', { 23080 "name": "dd-gestures", 23081 "trigger": "dd-drag", 23082 "ua": "touchEnabled" 23083}); 23084// dom-style-ie 23085add('load', '3', { 23086 "name": "dom-style-ie", 23087 "test": function (Y) { 23088 23089 var testFeature = Y.Features.test, 23090 addFeature = Y.Features.add, 23091 WINDOW = Y.config.win, 23092 DOCUMENT = Y.config.doc, 23093 DOCUMENT_ELEMENT = 'documentElement', 23094 ret = false;
23095 23096 addFeature('style', 'computedStyle', { 23097 test: function() { 23098 return WINDOW && 'getComputedStyle' in WINDOW; 23099 } 23100 }); 23101 23102 addFeature('style', 'opacity', { 23103 test: function() { 23104 return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style; 23105 } 23106 }); 23107 23108 ret = (!testFeature('style', 'opacity') && 23109 !testFeature('style', 'computedStyle')); 23110 23111 return ret; 23112}, 23113 "trigger": "dom-style" 23114}); 23115// editor-para-ie 23116add('load', '4', { 23117 "name": "editor-para-ie", 23118 "trigger": "editor-para", 23119 "ua": "ie", 23120 "when": "instead" 23121}); 23122// event-base-ie 23123add('load', '5', { 23124 "name": "event-base-ie", 23125 "test": function(Y) { 23126 var imp = Y.config.doc && Y.config.doc.implementation; 23127 return (imp && (!imp.hasFeature('Events', '2.0'))); 23128}, 23129 "trigger": "node-base" 23130}); 23131// graphics-canvas 23132add('load', '6', { 23133 "name": "graphics-canvas", 23134 "test": function(Y) { 23135 var DOCUMENT = Y.config.doc, 23136 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", 23137 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 23138 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 23139 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); 23140}, 23141 "trigger": "graphics" 23142}); 23143// graphics-canvas-default 23144add('load', '7', { 23145 "name": "graphics-canvas-default", 23146 "test": function(Y) { 23147 var DOCUMENT = Y.config.doc, 23148 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", 23149 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 23150 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 23151 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); 23152}, 23153 "trigger": "graphics" 23154}); 23155// graphics-svg 23156add('load', '8', { 23157 "name": "graphics-svg", 23158 "test": function(Y) { 23159 var DOCUMENT = Y.config.doc, 23160 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", 23161 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 23162 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 23163 23164 return svg && (useSVG || !canvas); 23165}, 23166 "trigger": "graphics" 23167}); 23168// graphics-svg-default 23169add('load', '9', { 23170 "name": "graphics-svg-default", 23171 "test": function(Y) { 23172 var DOCUMENT = Y.config.doc, 23173 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", 23174 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 23175 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 23176 23177 return svg && (useSVG || !canvas); 23178}, 23179 "trigger": "graphics" 23180}); 23181// graphics-vml 23182add('load', '10', { 23183 "name": "graphics-vml", 23184 "test": function(Y) { 23185 var DOCUMENT = Y.config.doc, 23186 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); 23187 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); 23188}, 23189 "trigger": "graphics" 23190}); 23191// graphics-vml-default 23192add('load', '11', { 23193 "name": "graphics-vml-default", 23194 "test": function(Y) { 23195 var DOCUMENT = Y.config.doc, 23196 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); 23197 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); 23198}, 23199 "trigger": "graphics" 23200}); 23201// history-hash-ie 23202add('load', '12', { 23203 "name": "history-hash-ie", 23204 "test": function (Y) { 23205 var docMode = Y.config.doc && Y.config.doc.documentMode; 23206 23207 return Y.UA.ie && (!('onhashchange' in Y.config.win) || 23208 !docMode || docMode < 8); 23209}, 23210 "trigger": "history-hash" 23211}); 23212// io-nodejs 23213add('load', '13', { 23214 "name": "io-nodejs", 23215 "trigger": "io-base", 23216 "ua": "nodejs" 23217}); 23218// json-parse-shim 23219add('load', '14', { 23220 "name": "json-parse-shim", 23221 "test": function (Y) { 23222 var _JSON = Y.config.global.JSON, 23223 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, 23224 nativeSupport = Y.config.useNativeJSONParse !== false && !!Native; 23225 23226 function workingNative( k, v ) { 23227 return k === "ok" ? true : v; 23228 } 23229 23230 // Double check basic functionality. This is mainly to catch early broken 23231 // implementations of the JSON API in Firefox 3.1 beta1 and beta2
23232 if ( nativeSupport ) { 23233 try { 23234 nativeSupport = ( Native.parse( '{"ok":false}', workingNative ) ).ok; 23235 } 23236 catch ( e ) { 23237 nativeSupport = false; 23238 } 23239 } 23240 23241 return !nativeSupport; 23242}, 23243 "trigger": "json-parse" 23244}); 23245// json-stringify-shim 23246add('load', '15', { 23247 "name": "json-stringify-shim", 23248 "test": function (Y) { 23249 var _JSON = Y.config.global.JSON, 23250 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, 23251 nativeSupport = Y.config.useNativeJSONStringify !== false && !!Native; 23252 23253 // Double check basic native functionality. This is primarily to catch broken 23254 // early JSON API implementations in Firefox 3.1 beta1 and beta2. 23255 if ( nativeSupport ) { 23256 try { 23257 nativeSupport = ( '0' === Native.stringify(0) ); 23258 } catch ( e ) { 23259 nativeSupport = false; 23260 } 23261 } 23262 23263 23264 return !nativeSupport; 23265}, 23266 "trigger": "json-stringify" 23267}); 23268// scrollview-base-ie 23269add('load', '16', { 23270 "name": "scrollview-base-ie", 23271 "trigger": "scrollview-base", 23272 "ua": "ie" 23273}); 23274// selector-css2 23275add('load', '17', { 23276 "name": "selector-css2", 23277 "test": function (Y) { 23278 var DOCUMENT = Y.config.doc, 23279 ret = DOCUMENT && !('querySelectorAll' in DOCUMENT); 23280 23281 return ret; 23282}, 23283 "trigger": "selector" 23284}); 23285// transition-timer 23286add('load', '18', { 23287 "name": "transition-timer", 23288 "test": function (Y) { 23289 var DOCUMENT = Y.config.doc, 23290 node = (DOCUMENT) ? DOCUMENT.documentElement: null, 23291 ret = true; 23292 23293 if (node && node.style) { 23294 ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); 23295 } 23296 23297 return ret; 23298}, 23299 "trigger": "transition" 23300}); 23301// widget-base-ie 23302add('load', '19', { 23303 "name": "widget-base-ie", 23304 "trigger": "widget-base", 23305 "ua": "ie" 23306}); 23307// yql-jsonp 23308add('load', '20', { 23309 "name": "yql-jsonp", 23310 "test": function (Y) { 23311 /* Only load the JSONP module when not in nodejs or winjs 23312 TODO Make the winjs module a CORS module 23313 */ 23314 return (!Y.UA.nodejs && !Y.UA.winjs); 23315}, 23316 "trigger": "yql" 23317}); 23318// yql-nodejs 23319add('load', '21', { 23320 "name": "yql-nodejs", 23321 "trigger": "yql", 23322 "ua": "nodejs" 23323}); 23324// yql-winjs 23325add('load', '22', { 23326 "name": "yql-winjs", 23327 "trigger": "yql", 23328 "ua": "winjs" 23329}); 23330 23331}, 'patched-v3.18.1', {"requires": ["yui-base"]}); 23332YUI.add('intl-base', function (Y, NAME) { 23333 23334/** 23335 * The Intl utility provides a central location for managing sets of 23336 * localized resources (strings and formatting patterns). 23337 * 23338 * @class Intl 23339 * @uses EventTarget 23340 * @static 23341 */ 23342 23343var SPLIT_REGEX = /[, ]/; 23344 23345Y.mix(Y.namespace('Intl'), { 23346 23347 /** 23348 * Returns the language among those available that 23349 * best matches the preferred language list, using the Lookup 23350 * algorithm of BCP 47. 23351 * If none of the available languages meets the user's preferences, 23352 * then "" is returned. 23353 * Extended language ranges are not supported. 23354 * 23355 * @method lookupBestLang 23356 * @param {String[] | String} preferredLanguages The list of preferred 23357 * languages in descending preference order, represented as BCP 47 23358 * language tags. A string array or a comma-separated list. 23359 * @param {String[]} availableLanguages The list of languages 23360 * that the application supports, represented as BCP 47 language 23361 * tags. 23362 * 23363 * @return {String} The available language that best matches the 23364 * preferred language list, or "". 23365 * @since 3.1.0 23366 */ 23367 lookupBestLang: function(preferredLanguages, availableLanguages) { 23368 23369 var i, language, result, index; 23370 23371 // check whether the list of available languages contains language; 23372 // if so return it 23373 function scan(language) { 23374 var i; 23375 for (i = 0; i < availableLanguages.length; i += 1) { 23376 if (language.toLowerCase() === 23377 availableLanguages[i].toLowerCase()) { 23378 return availableLanguages[i]; 23379 } 23380 } 23381 } 23382
23383 if (Y.Lang.isString(preferredLanguages)) { 23384 preferredLanguages = preferredLanguages.split(SPLIT_REGEX); 23385 } 23386 23387 for (i = 0; i < preferredLanguages.length; i += 1) { 23388 language = preferredLanguages[i]; 23389 if (!language || language === '*') { 23390 continue; 23391 } 23392 // check the fallback sequence for one language 23393 while (language.length > 0) { 23394 result = scan(language); 23395 if (result) { 23396 return result; 23397 } else { 23398 index = language.lastIndexOf('-'); 23399 if (index >= 0) { 23400 language = language.substring(0, index); 23401 // one-character subtags get cut along with the 23402 // following subtag 23403 if (index >= 2 && language.charAt(index - 2) === '-') { 23404 language = language.substring(0, index - 2); 23405 } 23406 } else { 23407 // nothing available for this language 23408 break; 23409 } 23410 } 23411 } 23412 } 23413 23414 return ''; 23415 } 23416}); 23417 23418 23419}, 'patched-v3.18.1', {"requires": ["yui-base"]}); 23420YUI.add('yui-log', function (Y, NAME) { 23421 23422/** 23423 * Provides console log capability and exposes a custom event for 23424 * console implementations. This module is a `core` YUI module, 23425 * <a href="../classes/YUI.html#method_log">it's documentation is located under the YUI class</a>. 23426 * 23427 * @module yui 23428 * @submodule yui-log 23429 */ 23430 23431var INSTANCE = Y, 23432 LOGEVENT = 'yui:log', 23433 UNDEFINED = 'undefined', 23434 LEVELS = { debug: 1, 23435 info: 2, 23436 warn: 4, 23437 error: 8 }; 23438 23439/** 23440 * If the 'debug' config is true, a 'yui:log' event will be 23441 * dispatched, which the Console widget and anything else 23442 * can consume. If the 'useBrowserConsole' config is true, it will 23443 * write to the browser console if available. YUI-specific log 23444 * messages will only be present in the -debug versions of the 23445 * JS files. The build system is supposed to remove log statements 23446 * from the raw and minified versions of the files. 23447 * 23448 * @method log 23449 * @for YUI 23450 * @param {String} msg The message to log. 23451 * @param {String} cat The log category for the message. Default 23452 * categories are "info", "warn", "error", "debug". 23453 * Custom categories can be used as well. (opt). 23454 * @param {String} src The source of the the message (opt). 23455 * @param {boolean} silent If true, the log event won't fire. 23456 * @return {YUI} YUI instance. 23457 */ 23458INSTANCE.log = function(msg, cat, src, silent) { 23459 var bail, excl, incl, m, f, minlevel, 23460 Y = INSTANCE, 23461 c = Y.config, 23462 publisher = (Y.fire) ? Y : YUI.Env.globalEvents; 23463 // suppress log message if the config is off or the event stack 23464 // or the event call stack contains a consumer of the yui:log event 23465 if (c.debug) { 23466 // apply source filters 23467 src = src || ""; 23468 if (typeof src !== "undefined") { 23469 excl = c.logExclude; 23470 incl = c.logInclude; 23471 if (incl && !(src in incl)) { 23472 bail = 1; 23473 } else if (incl && (src in incl)) { 23474 bail = !incl[src]; 23475 } else if (excl && (src in excl)) { 23476 bail = excl[src]; 23477 } 23478 23479 // Set a default category of info if the category was not defined. 23480 if ((typeof cat === 'undefined')) { 23481 cat = 'info'; 23482 } 23483 23484 // Determine the current minlevel as defined in configuration 23485 Y.config.logLevel = Y.config.logLevel || 'debug'; 23486 minlevel = LEVELS[Y.config.logLevel.toLowerCase()]; 23487 23488 if (cat in LEVELS && LEVELS[cat] < minlevel) { 23489 // Skip this message if the we don't meet the defined minlevel 23490 bail = 1; 23491 } 23492 } 23493 if (!bail) { 23494 if (c.useBrowserConsole) { 23495 m = (src) ? src + ': ' + msg : msg; 23496 if (Y.Lang.isFunction(c.logFn)) { 23497 c.logFn.call(Y, msg, cat, src); 23498 } else if (typeof console !== UNDEFINED && console.log) { 23499 f = (cat && console[cat] && (cat in LEVELS)) ? cat : 'log'; 23500 console[f](m); 23501 } else if (typeof opera !== UNDEFINED) { 23502 opera.postError(m); 23503 } 23504 } 23505 23506 if (publisher && !silent) { 23507 23508 if (publisher === Y && (!publisher.getEvent(LOGEVENT))) { 23509 publisher.publish(LOGEVENT, { 23510 broadcast: 2 23511 }); 23512 } 23513 23514 publisher.fire(LOGEVENT, { 23515 msg: msg, 23516 cat: cat, 23517 src: src 23518 }); 23519 } 23520 } 23521 } 23522 23523 return Y; 23524}; 23525 23526/** 23527 * Write a system message. This message will be preserved in the 23528 * minified and raw versions of the YUI files, unlike log statements. 23529 * @method message 23530 * @for YUI 23531 * @param {String} msg The message to log. 23532 * @param {String} cat The log category for the message. Default 23533 * categories are "info", "warn", "error", "debug". 23534 * Custom categories can be used as well. (opt). 23535 * @param {String} src The source of the the message (opt). 23536 * @param {boolean} silent If true, the log event won't fire. 23537 * @return {YUI} YUI instance. 23538 */ 23539INSTANCE.message = function() { 23540 return INSTANCE.log.apply(INSTANCE, arguments); 23541}; 23542 23543 23544}, 'patched-v3.18.1', {"requires": ["yui-base"]}); 23545YUI.add('yui-later', function (Y, NAME) { 23546 23547/** 23548 * Provides a setTimeout/setInterval wrapper. This module is a `core` YUI module, 23549 * <a href="../classes/YUI.html#method_later">
23549it's documentation is located under the YUI class</a>. 23550 * 23551 * @module yui 23552 * @submodule yui-later 23553 */ 23554 23555var NO_ARGS = []; 23556 23557/** 23558 * Executes the supplied function in the context of the supplied 23559 * object 'when' milliseconds later. Executes the function a 23560 * single time unless periodic is set to true. 23561 * @for YUI 23562 * @method later 23563 * @param when {Number} the number of milliseconds to wait until the fn 23564 * is executed. 23565 * @param o the context object. 23566 * @param fn {Function|String} the function to execute or the name of 23567 * the method in the 'o' object to execute. 23568 * @param data [Array] data that is provided to the function. This 23569 * accepts either a single item or an array. If an array is provided, 23570 * the function is executed with one parameter for each array item. 23571 * If you need to pass a single array parameter, it needs to be wrapped 23572 * in an array [myarray]. 23573 * 23574 * Note: native methods in IE may not have the call and apply methods. 23575 * In this case, it will work, but you are limited to four arguments. 23576 * 23577 * @param periodic {boolean} if true, executes continuously at supplied 23578 * interval until canceled. 23579 * @return {object} a timer object. Call the cancel() method on this 23580 * object to stop the timer. 23581 */ 23582Y.later = function(when, o, fn, data, periodic) { 23583 when = when || 0; 23584 data = (!Y.Lang.isUndefined(data)) ? Y.Array(data) : NO_ARGS; 23585 o = o || Y.config.win || Y; 23586 23587 var cancelled = false, 23588 method = (o && Y.Lang.isString(fn)) ? o[fn] : fn, 23589 wrapper = function() { 23590 // IE 8- may execute a setInterval callback one last time 23591 // after clearInterval was called, so in order to preserve 23592 // the cancel() === no more runny-run, we have to jump through 23593 // an extra hoop. 23594 if (!cancelled) { 23595 if (!method.apply) { 23596 method(data[0], data[1], data[2], data[3]); 23597 } else { 23598 method.apply(o, data || NO_ARGS); 23599 } 23600 } 23601 }, 23602 id = (periodic) ? setInterval(wrapper, when) : setTimeout(wrapper, when); 23603 23604 return { 23605 id: id, 23606 interval: periodic, 23607 cancel: function() { 23608 cancelled = true; 23609 if (this.interval) { 23610 clearInterval(id); 23611 } else { 23612 clearTimeout(id); 23613 } 23614 } 23615 }; 23616}; 23617 23618Y.Lang.later = Y.later; 23619 23620 23621 23622}, 'patched-v3.18.1', {"requires": ["yui-base"]}); 23623YUI.add('loader-base', function (Y, NAME) { 23624 23625/** 23626 * The YUI loader core 23627 * @module loader 23628 * @submodule loader-base 23629 */ 23630 23631(function() { 23632 var VERSION = Y.version, 23633 BUILD = '/build/', 23634 ROOT = VERSION + '/', 23635 CDN_BASE = Y.Env.base, 23636 GALLERY_VERSION = 'gallery-2014.06.04-21-38', 23637 TNT = '2in3', 23638 TNT_VERSION = '4', 23639 YUI2_VERSION = '2.9.0', 23640 COMBO_BASE = CDN_BASE + 'combo?', 23641 META = { 23642 version: VERSION, 23643 root: ROOT, 23644 base: Y.Env.base, 23645 comboBase: COMBO_BASE, 23646 skin: { 23647 defaultSkin: 'sam', 23648 base: 'assets/skins/', 23649 path: 'skin.css', 23650 after: [ 23651 'cssreset', 23652 'cssfonts', 23653 'cssgrids', 23654 'cssbase', 23655 'cssreset-context', 23656 'cssfonts-context' 23657 ] 23658 }, 23659 groups: {}, 23660 patterns: {} 23661 }, 23662 groups = META.groups, 23663 yui2Update = function(tnt, yui2, config) { 23664 var root = TNT + '.' + 23665 (tnt || TNT_VERSION) + '/' + 23666 (yui2 || YUI2_VERSION) + BUILD, 23667 base = (config && config.base) ? config.base : CDN_BASE, 23668 combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE; 23669 23670 groups.yui2.base = base + root; 23671 groups.yui2.root = root; 23672 groups.yui2.comboBase = combo; 23673 }, 23674 galleryUpdate = function(tag, config) { 23675 var root = (tag || GALLERY_VERSION) + BUILD, 23676 base = (config && config.base) ? config.base : CDN_BASE, 23677 combo = (config && config.comboBase) ? config.comboBase : COMBO_BASE; 23678 23679 groups.gallery.base = base + root; 23680 groups.gallery.root = root; 23681 groups.gallery.comboBase = combo; 23682 }; 23683 23684 23685 groups[VERSION] = {}; 23686 23687 groups.gallery = { 23688 ext: false, 23689 combine: true, 23690 comboBase: COMBO_BASE, 23691 update: galleryUpdate, 23692 patterns: { 23693 'gallery-': {}, 23694 'lang/gallery-': {}, 23695 'gallerycss-': { 23696 type: 'css' 23697 } 23698 } 23699 }; 23700 23701 groups.yui2 = { 23702 combine: true, 23703 ext: false, 23704 comboBase: COMBO_BASE, 23705 update: yui2Update, 23706 patterns: { 23707 'yui2-': { 23708 configFn: function(me) { 23709 if (/-skin|reset|fonts|grids|base/.test(me.name)) { 23710 me.type = 'css'; 23711 me.path = me.path.replace(/\.js/, '.css'); 23712 // this makes skins in builds earlier than 23713 // 2.6.0 work as long as combine is false 23714 me.path = me.path.replace(/\/yui2-skin/, 23715 '/assets/skins/sam/yui2-skin'); 23716 } 23717 } 23718 } 23719 } 23720 }; 23721 23722 galleryUpdate(); 23723 yui2Update(); 23724 23725 if (YUI.Env[VERSION]) { 23726 Y.mix(META, YUI.Env[VERSION], false, [ 23727 'modules', 23728 'groups', 23729 'skin' 23730 ], 0, true); 23731 } 23732 23733 YUI.Env[VERSION] = META; 23734}()); 23735/*jslint forin: true, maxlen: 350 */ 23736 23737/** 23738 * Loader dynamically loads script and css files. It includes the dependency 23739 * information for the version of the library in use, and will automatically pull in 23740 * dependencies for the modules requested. It can also load the 23741 * files from the Yahoo! CDN, and it can utilize the combo service provided on 23742 * this network to reduce the number of http connections required to download 23743 * YUI files. 23744 * 23745 * @module loader 23746 * @main loader 23747 * @submodule loader-base 23748 */ 23749 23750var NOT_FOUND = {}, 23751 NO_REQUIREMENTS = [], 23752 MAX_URL_LENGTH = 1024, 23753 GLOBAL_ENV = YUI.Env, 23754 GLOBAL_LOADED = GLOBAL_ENV._loaded, 23755 CSS = 'css', 23756 JS = 'js', 23757 INTL = 'intl', 23758 DEFAULT_SKIN = 'sam',
23759 VERSION = Y.version, 23760 ROOT_LANG = '', 23761 YObject = Y.Object, 23762 oeach = YObject.each, 23763 yArray = Y.Array, 23764 _queue = GLOBAL_ENV._loaderQueue, 23765 META = GLOBAL_ENV[VERSION], 23766 SKIN_PREFIX = 'skin-', 23767 L = Y.Lang, 23768 ON_PAGE = GLOBAL_ENV.mods, 23769 modulekey, 23770 _path = function(dir, file, type, nomin) { 23771 var path = dir + '/' + file; 23772 if (!nomin) { 23773 path += '-min'; 23774 } 23775 path += '.' + (type || CSS); 23776 23777 return path; 23778 }; 23779 23780 23781 if (!YUI.Env._cssLoaded) { 23782 YUI.Env._cssLoaded = {}; 23783 } 23784 23785 23786/** 23787 * The component metadata is stored in Y.Env.meta. 23788 * Part of the loader module. 23789 * @property meta 23790 * @for YUI 23791 */ 23792Y.Env.meta = META; 23793 23794/** 23795 * Loader dynamically loads script and css files. It includes the dependency 23796 * info for the version of the library in use, and will automatically pull in 23797 * dependencies for the modules requested. It can load the 23798 * files from the Yahoo! CDN, and it can utilize the combo service provided on 23799 * this network to reduce the number of http connections required to download 23800 * YUI files. You can also specify an external, custom combo service to host 23801 * your modules as well. 23802 23803 var Y = YUI(); 23804 var loader = new Y.Loader({ 23805 filter: 'debug', 23806 base: '../../', 23807 root: 'build/', 23808 combine: true, 23809 require: ['node', 'dd', 'console'] 23810 }); 23811 var out = loader.resolve(true); 23812 23813 * If the Loader needs to be patched before it is used for the first time, it 23814 * should be done through the `doBeforeLoader` hook. Simply make the patch 23815 * available via configuration before YUI is loaded: 23816 23817 YUI_config = YUI_config || {}; 23818 YUI_config.doBeforeLoader = function (config) { 23819 var resolve = this.context.Loader.prototype.resolve; 23820 this.context.Loader.prototype.resolve = function () { 23821 // do something here 23822 return resolve.apply(this, arguments); 23823 }; 23824 }; 23825 23826 * @constructor 23827 * @class Loader 23828 * @param {Object} config an optional set of configuration options. 23829 * @param {String} config.base The base dir which to fetch this module from 23830 * @param {String} config.comboBase The Combo service base path. Ex: `http://yui.yahooapis.com/combo?` 23831 * @param {String} config.root The root path to prepend to module names for the combo service. Ex: `2.5.2/build/` 23832 * @param {String|Object} config.filter A filter to apply to result urls. <a href="#property_filter">See filter property</a> 23833 * @param {Object} config.filters Per-component filter specification. If specified for a given component, this overrides the filter config. 23834 * @param {Boolean} config.combine Use a combo service to reduce the number of http connections required to load your dependencies 23835 * @param {Boolean} [config.async=true] Fetch files in async 23836 * @param {Array} config.ignore: A list of modules that should never be dynamically loaded 23837 * @param {Array} config.force A list of modules that should always be loaded when required, even if already present on the page 23838 * @param {HTMLElement|String} config.insertBefore Node or id for a node that should be used as the insertion point for new nodes 23839 * @param {Object} config.jsAttributes Object literal containing attributes to add to script nodes 23840 * @param {Object} config.cssAttributes Object literal containing attributes to add to link nodes 23841 * @param {Number} config.timeout The number of milliseconds before a timeout occurs when dynamically loading nodes. If not set, there is no timeout 23842 * @param {Object} config.context Execution context for all callbacks 23843 * @param {Function} config.onSuccess Callback for the 'success' event 23844 * @param {Function} config.onFailure Callback for the 'failure' event 23845 * @param {Function} config.onTimeout Callback for the 'timeout' event 23846 * @param {Function} config.onProgress Callback executed each time a script or css file is loaded 23847 * @param {Object} config.modules A list of module definitions. See <a href="#method_addModule">Loader.addModule</a> for the supported module metadata 23848 * @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`. 23849 * @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. 23850 * @param {String} config.yui2 When using the 2in3 project, you can select the version of YUI 2 to use. V
23850alid 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. 23851 * @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. 23852 */ 23853Y.Loader = function(o) { 23854 23855 var self = this; 23856 23857 //Catch no config passed. 23858 o = o || {}; 23859 23860 modulekey = META.md5; 23861 23862 /** 23863 * Internal callback to handle multiple internal insert() calls 23864 * so that css is inserted prior to js 23865 * @property _internalCallback 23866 * @private 23867 */ 23868 // self._internalCallback = null; 23869 23870 /** 23871 * Callback that will be executed when the loader is finished 23872 * with an insert 23873 * @method onSuccess 23874 * @type function 23875 */ 23876 // self.onSuccess = null; 23877 23878 /** 23879 * Callback that will be executed if there is a failure 23880 * @method onFailure 23881 * @type function 23882 */ 23883 // self.onFailure = null; 23884 23885 /** 23886 * Callback executed each time a script or css file is loaded 23887 * @method onProgress 23888 * @type function 23889 */ 23890 // self.onProgress = null; 23891 23892 /** 23893 * Callback that will be executed if a timeout occurs 23894 * @method onTimeout 23895 * @type function 23896 */ 23897 // self.onTimeout = null; 23898 23899 /** 23900 * The execution context for all callbacks 23901 * @property context 23902 * @default {YUI} the YUI instance 23903 */ 23904 self.context = Y; 23905 23906 // Hook that allows the patching of loader 23907 if (o.doBeforeLoader) { 23908 o.doBeforeLoader.apply(self, arguments); 23909 } 23910 23911 /** 23912 * Data that is passed to all callbacks 23913 * @property data 23914 */ 23915 // self.data = null; 23916 23917 /** 23918 * Node reference or id where new nodes should be inserted before 23919 * @property insertBefore 23920 * @type string|HTMLElement 23921 */ 23922 // self.insertBefore = null; 23923 23924 /** 23925 * The charset attribute for inserted nodes 23926 * @property charset 23927 * @type string 23928 * @deprecated , use cssAttributes or jsAttributes. 23929 */ 23930 // self.charset = null; 23931 23932 /** 23933 * An object literal containing attributes to add to link nodes 23934 * @property cssAttributes 23935 * @type object 23936 */ 23937 // self.cssAttributes = null; 23938 23939 /** 23940 * An object literal containing attributes to add to script nodes 23941 * @property jsAttributes 23942 * @type object 23943 */ 23944 // self.jsAttributes = null; 23945 23946 /** 23947 * The base directory. 23948 * @property base 23949 * @type string 23950 * @default http://yui.yahooapis.com/[YUI VERSION]/build/ 23951 */ 23952 self.base = Y.Env.meta.base + Y.Env.meta.root; 23953 23954 /** 23955 * Base path for the combo service 23956 * @property comboBase 23957 * @type string 23958 * @default http://yui.yahooapis.com/combo? 23959 */ 23960 self.comboBase = Y.Env.meta.comboBase; 23961 23962 /* 23963 * Base path for language packs. 23964 */ 23965 // self.langBase = Y.Env.meta.langBase; 23966 // self.lang = ""; 23967 23968 /** 23969 * If configured, the loader will attempt to use the combo 23970 * service for YUI resources and configured external resources. 23971 * @property combine 23972 * @type boolean 23973 * @default true if a base dir isn't in the config 23974 */ 23975 self.combine = o.base && 23976 (o.base.indexOf(self.comboBase.substr(0, 20)) > -1); 23977 23978 /** 23979 * The default seperator to use between files in a combo URL 23980 * @property comboSep 23981 * @type {String} 23982 * @default Ampersand 23983 */ 23984 self.comboSep = '&'; 23985 /** 23986 * Max url length for combo urls. The default is 1024. This is the URL 23987 * limit for the Yahoo! hosted combo servers. If consuming 23988 * a different combo service that has a different URL limit 23989 * it is possible to override this default by supplying 23990 * the maxURLLength config option. The config option will 23991 * only take effect if lower than the default. 23992 * 23993 * @property maxURLLength 23994 * @type int 23995 */ 23996 self.maxURLLength = MAX_URL_LENGTH; 23997 23998 /** 23999 * Ignore modules registered on the YUI global 24000 * @property ignoreRegistered 24001 * @default false 24002 */ 24003 self.ignoreRegistered = o.ignoreRegistered; 24004 24005 /**
24006 * Root path to prepend to module path for the combo 24007 * service 24008 * @property root 24009 * @type string 24010 * @default [YUI VERSION]/build/ 24011 */ 24012 self.root = Y.Env.meta.root; 24013 24014 /** 24015 * Timeout value in milliseconds. If set, self value will be used by 24016 * the get utility. the timeout event will fire if 24017 * a timeout occurs. 24018 * @property timeout 24019 * @type int 24020 */ 24021 self.timeout = 0; 24022 24023 /** 24024 * A list of modules that should not be loaded, even if 24025 * they turn up in the dependency tree 24026 * @property ignore 24027 * @type string[] 24028 */ 24029 // self.ignore = null; 24030 24031 /** 24032 * A list of modules that should always be loaded, even 24033 * if they have already been inserted into the page. 24034 * @property force 24035 * @type string[] 24036 */ 24037 // self.force = null; 24038 24039 self.forceMap = {}; 24040 24041 /** 24042 * Should we allow rollups 24043 * @property allowRollup 24044 * @type boolean 24045 * @default false 24046 */ 24047 self.allowRollup = false; 24048 24049 /** 24050 * A filter to apply to result urls. This filter will modify the default 24051 * path for all modules. The default path for the YUI library is the 24052 * minified version of the files (e.g., event-min.js). The filter property 24053 * can be a predefined filter or a custom filter. The valid predefined 24054 * filters are: 24055 * <dl> 24056 * <dt>DEBUG</dt> 24057 * <dd>Selects the debug versions of the library (e.g., event-debug.js). 24058 * This option will automatically include the Logger widget</dd> 24059 * <dt>RAW</dt> 24060 * <dd>Selects the non-minified version of the library (e.g., event.js). 24061 * </dd> 24062 * </dl> 24063 * You can also define a custom filter, which must be an object literal 24064 * containing a search expression and a replace string: 24065 * 24066 * myFilter: { 24067 * 'searchExp': "-min\\.js", 24068 * 'replaceStr': "-debug.js" 24069 * } 24070 * 24071 * @property filter 24072 * @type string| {searchExp: string, replaceStr: string} 24073 */ 24074 // self.filter = null; 24075 24076 /** 24077 * per-component filter specification. If specified for a given 24078 * component, this overrides the filter config. 24079 * @property filters 24080 * @type object 24081 */ 24082 self.filters = {}; 24083 24084 /** 24085 * The list of requested modules 24086 * @property required 24087 * @type {string: boolean} 24088 */ 24089 self.required = {}; 24090 24091 /** 24092 * If a module name is predefined when requested, it is checked againsts 24093 * the patterns provided in this property. If there is a match, the 24094 * module is added with the default configuration. 24095 * 24096 * At the moment only supporting module prefixes, but anticipate 24097 * supporting at least regular expressions. 24098 * @property patterns 24099 * @type Object 24100 */ 24101 // self.patterns = Y.merge(Y.Env.meta.patterns); 24102 self.patterns = {}; 24103 24104 /** 24105 * Internal loader instance metadata. Use accessor `getModuleInfo()` instead. 24106 */ 24107 self.moduleInfo = {}; 24108 24109 self.groups = Y.merge(Y.Env.meta.groups); 24110 24111 /** 24112 * Provides the information used to skin the skinnable components. 24113 * The following skin definition would result in 'skin1' and 'skin2' 24114 * being loaded for calendar (if calendar was requested), and 24115 * 'sam' for all other skinnable components: 24116 * 24117 * skin: { 24118 * // The default skin, which is automatically applied if not 24119 * // overriden by a component-specific skin definition. 24120 * // Change this in to apply a different skin globally 24121 * defaultSkin: 'sam', 24122 * 24123 * // This is combined with the loader base property to get 24124 * // the default root directory for a skin. ex: 24125 * // http://yui.yahooapis.com/2.3.0/build/assets/skins/sam/ 24126 * base: 'assets/skins/', 24127 * 24128 * // Any component-specific overrides can be specified here, 24129 * // making it possible to load different skins for different 24130 * // components. It is possible to load more than one skin 24131 * // for a given component as well. 24132 * overrides: { 24133 * calendar: ['skin1', 'skin2'] 24134 * } 24135 * } 24136 * @property skin 24137 * @type {Object} 24138 */ 24139 self.skin = Y.merge(Y.Env.meta.skin); 24140 24141 /* 24142 * Map of conditional modules 24143 * @since 3.2.0 24144 */ 24145 self.conditions = {}; 24146 24147 // map of modules with a hash of modules that meet the requirement 24148 // self.provides = {}; 24149 24150 self.config = o; 24151 self._internal = true; 24152 24153 self._populateConditionsCache(); 24154 24155 /** 24156 * Set when beginning to compute the dependency tree. 24157 * Composed of what YUI reports to be loaded combined 24158 * with what has been loaded by any instance on the page 24159 * with the version number specified in the metadata. 24160 * @property loaded 24161 * @type {string: boolean} 24162 */ 24163 self.loaded = GLOBAL_LOADED[VERSION]; 24164 24165 24166 /** 24167 * Should Loader fetch scripts in `async`, defaults to `true` 24168 * @property async 24169 */ 24170 24171 self.async = true; 24172 24173 self._inspectPage(); 24174 24175 self._internal = false;
24176 24177 self._config(o); 24178 24179 self.forceMap = (self.force) ? Y.Array.hash(self.force) : {}; 24180 24181 self.testresults = null; 24182 24183 if (Y.config.tests) { 24184 self.testresults = Y.config.tests; 24185 } 24186 24187 /** 24188 * List of rollup files found in the library metadata 24189 * @property rollups 24190 */ 24191 // self.rollups = null; 24192 24193 /** 24194 * Whether or not to load optional dependencies for 24195 * the requested modules 24196 * @property loadOptional 24197 * @type boolean 24198 * @default false 24199 */ 24200 // self.loadOptional = false; 24201 24202 /** 24203 * All of the derived dependencies in sorted order, which 24204 * will be populated when either calculate() or insert() 24205 * is called 24206 * @property sorted 24207 * @type string[] 24208 */ 24209 self.sorted = []; 24210 24211 /* 24212 * A list of modules to attach to the YUI instance when complete. 24213 * If not supplied, the sorted list of dependencies are applied. 24214 * @property attaching 24215 */ 24216 // self.attaching = null; 24217 24218 /** 24219 * Flag to indicate the dependency tree needs to be recomputed 24220 * if insert is called again. 24221 * @property dirty 24222 * @type boolean 24223 * @default true 24224 */ 24225 self.dirty = true; 24226 24227 /** 24228 * List of modules inserted by the utility 24229 * @property inserted 24230 * @type {string: boolean} 24231 */ 24232 self.inserted = {}; 24233 24234 /** 24235 * List of skipped modules during insert() because the module 24236 * was not defined 24237 * @property skipped 24238 */ 24239 self.skipped = {}; 24240 24241 // Y.on('yui:load', self.loadNext, self); 24242 24243 self.tested = {}; 24244 24245 /* 24246 * Cached sorted calculate results 24247 * @property results 24248 * @since 3.2.0 24249 */ 24250 //self.results = {}; 24251 24252 if (self.ignoreRegistered) { 24253 //Clear inpage already processed modules. 24254 self._resetModules(); 24255 } 24256 24257}; 24258 24259Y.Loader.prototype = { 24260 /** 24261 * Gets the module info from the local moduleInfo hash, or from the 24262 * default metadata and populate the local moduleInfo hash. 24263 * @method getModuleInfo 24264 * @param {string} name of the module 24265 * @public 24266 */ 24267 getModuleInfo: function(name) { 24268 24269 var m = this.moduleInfo[name], 24270 rawMetaModules, globalRenderedMods, internal, v; 24271 24272 if (m) { 24273 return m; 24274 } 24275 24276 rawMetaModules = META.modules; 24277 globalRenderedMods = GLOBAL_ENV._renderedMods; 24278 internal = this._internal; 24279 24280 /* 24281 The logic here is: 24282 24283 - if the `moduleInfo[name]` is avilable, 24284 then short circuit 24285 - otherwise, if the module is in the globalCache (cross Y instance), 24286 then port it from the global registry into `moduleInfo[name]` 24287 - otherwise, if the module has raw metadata (from meta modules) 24288 then add it to the global registry and to `moduleInfo[name]` 24289 24290 */ 24291 if (globalRenderedMods && globalRenderedMods.hasOwnProperty(name) && !this.ignoreRegistered) { 24292 this.moduleInfo[name] = Y.merge(globalRenderedMods[name]); 24293 } else { 24294 if (rawMetaModules.hasOwnProperty(name)) { 24295 this._internal = true; // making sure that modules from raw data are marked as internal 24296 v = this.addModule(rawMetaModules[name], name); 24297 // Inspect the page for the CSS module and mark it as loaded. 24298 if (v && v.type === CSS) { 24299 if (this.isCSSLoaded(v.name, true)) { 24300 this.loaded[v.name] = true; 24301 } 24302 } 24303 this._internal = internal; 24304 } 24305 } 24306 return this.moduleInfo[name]; 24307 }, 24308 /** 24309 * Expand the names that are aliases to other modules. 24310 * @method _expandAliases 24311 * @param {string[]} list a module name or a list of names to be expanded 24312 * @private 24313 * @return {array} 24314 */ 24315 _expandAliases: function(list) { 24316 var expanded = [], 24317 aliases = YUI.Env.aliases, 24318 i, name; 24319 list = Y.Array(list); 24320 for (i = 0; i < list.length; i += 1) { 24321 name = list[i]; 24322 expanded.push.apply(expanded, aliases[name] ? aliases[name] : [name]); 24323 } 24324 return expanded; 24325 }, 24326 /** 24327 * Populate the conditions cache from raw modules, this is necessary 24328 * because no other module will require a conditional module, instead 24329 * the condition has to be executed and then the module is analyzed 24330 * to be included in the final requirement list. Without this cache 24331 * conditional modules will be simply ignored. 24332 * @method _populateConditionsCache 24333 * @private 24334 */ 24335 _populateConditionsCache: function() { 24336 var rawMetaModules = META.modules,
24337 cache = GLOBAL_ENV._conditions, 24338 i, j, t, trigger; 24339 24340 // if we have conditions in cache and cache is enabled 24341 // we should port them to this loader instance 24342 if (cache && !this.ignoreRegistered) { 24343 for (i in cache) { 24344 if (cache.hasOwnProperty(i)) { 24345 this.conditions[i] = Y.merge(cache[i]); 24346 } 24347 } 24348 } else { 24349 for (i in rawMetaModules) { 24350 if (rawMetaModules.hasOwnProperty(i) && rawMetaModules[i].condition) { 24351 t = this._expandAliases(rawMetaModules[i].condition.trigger); 24352 for (j = 0; j < t.length; j += 1) { 24353 trigger = t[j]; 24354 this.conditions[trigger] = this.conditions[trigger] || {}; 24355 this.conditions[trigger][rawMetaModules[i].name || i] = rawMetaModules[i].condition; 24356 } 24357 } 24358 } 24359 GLOBAL_ENV._conditions = this.conditions; 24360 } 24361 }, 24362 /** 24363 * Reset modules in the module cache to a pre-processed state so additional 24364 * computations with a different skin or language will work as expected. 24365 * @method _resetModules 24366 * @private 24367 */ 24368 _resetModules: function() { 24369 var self = this, i, o, 24370 mod, name, details; 24371 for (i in self.moduleInfo) { 24372 if (self.moduleInfo.hasOwnProperty(i) && self.moduleInfo[i]) { 24373 mod = self.moduleInfo[i]; 24374 name = mod.name; 24375 details = (YUI.Env.mods[name] ? YUI.Env.mods[name].details : null); 24376 24377 if (details) { 24378 self.moduleInfo[name]._reset = true; 24379 self.moduleInfo[name].requires = details.requires || []; 24380 self.moduleInfo[name].optional = details.optional || []; 24381 self.moduleInfo[name].supersedes = details.supercedes || []; 24382 } 24383 24384 if (mod.defaults) { 24385 for (o in mod.defaults) { 24386 if (mod.defaults.hasOwnProperty(o)) { 24387 if (mod[o]) { 24388 mod[o] = mod.defaults[o]; 24389 } 24390 } 24391 } 24392 } 24393 mod.langCache = undefined; 24394 mod.skinCache = undefined; 24395 if (mod.skinnable) { 24396 self._addSkin(self.skin.defaultSkin, mod.name); 24397 } 24398 } 24399 } 24400 }, 24401 /** 24402 Regex that matches a CSS URL. Used to guess the file type when it's not 24403 specified. 24404 24405 @property REGEX_CSS 24406 @type RegExp 24407 @final 24408 @protected 24409 @since 3.5.0 24410 **/ 24411 REGEX_CSS: /\.css(?:[?;].*)?$/i, 24412 24413 /** 24414 * Default filters for raw and debug 24415 * @property FILTER_DEFS 24416 * @type Object 24417 * @final 24418 * @protected 24419 */ 24420 FILTER_DEFS: { 24421 RAW: { 24422 'searchExp': '-min\\.js', 24423 'replaceStr': '.js' 24424 }, 24425 DEBUG: { 24426 'searchExp': '-min\\.js', 24427 'replaceStr': '-debug.js' 24428 }, 24429 COVERAGE: { 24430 'searchExp': '-min\\.js', 24431 'replaceStr': '-coverage.js' 24432 } 24433 }, 24434 /* 24435 * Check the pages meta-data and cache the result. 24436 * @method _inspectPage 24437 * @private 24438 */ 24439 _inspectPage: function() { 24440 var self = this, v, m, req, mr, i; 24441 24442 for (i in ON_PAGE) { 24443 if (ON_PAGE.hasOwnProperty(i)) { 24444 v = ON_PAGE[i]; 24445 if (v.details) { 24446 m = self.getModuleInfo(v.name); 24447 req = v.details.requires; 24448 mr = m && m.requires; 24449 24450 if (m) { 24451 if (!m._inspected && req && mr.length !== req.length) { 24452 // console.log('deleting ' + m.name); 24453 delete m.expanded; 24454 } 24455 } else { 24456 m = self.addModule(v.details, i); 24457 } 24458 m._inspected = true; 24459 } 24460 } 24461 } 24462 }, 24463 /* 24464 * returns true if b is not loaded, and is required directly or by means of modules it supersedes. 24465 * @private 24466 * @method _requires 24467 * @param {String} mod1 The first module to compare 24468 * @param {String} mod2 The second module to compare 24469 */ 24470 _requires: function(mod1, mod2) { 24471 24472 var i, rm, after_map, s, 24473 m = this.getModuleInfo(mod1), 24474 other = this.getModuleInfo(mod2); 24475
24476 if (!m || !other) { 24477 return false; 24478 } 24479 24480 rm = m.expanded_map; 24481 after_map = m.after_map; 24482 24483 // check if this module should be sorted after the other 24484 // do this first to short circut circular deps 24485 if (after_map && (mod2 in after_map)) { 24486 return true; 24487 } 24488 24489 after_map = other.after_map; 24490 24491 // and vis-versa 24492 if (after_map && (mod1 in after_map)) { 24493 return false; 24494 } 24495 24496 // check if this module requires one the other supersedes 24497 s = other.supersedes; 24498 if (s) { 24499 for (i = 0; i < s.length; i++) { 24500 if (this._requires(mod1, s[i])) { 24501 return true; 24502 } 24503 } 24504 } 24505 24506 s = m.supersedes; 24507 if (s) { 24508 for (i = 0; i < s.length; i++) { 24509 if (this._requires(mod2, s[i])) { 24510 return false; 24511 } 24512 } 24513 } 24514 24515 // check if this module requires the other directly 24516 // if (r && yArray.indexOf(r, mod2) > -1) { 24517 if (rm && (mod2 in rm)) { 24518 return true; 24519 } 24520 24521 // external css files should be sorted below yui css 24522 if (m.ext && m.type === CSS && !other.ext && other.type === CSS) { 24523 return true; 24524 } 24525 24526 return false; 24527 }, 24528 /** 24529 * Apply a new config to the Loader instance 24530 * @method _config 24531 * @private 24532 * @param {Object} o The new configuration 24533 */ 24534 _config: function(o) { 24535 var i, j, val, a, f, group, groupName, self = this, 24536 mods = [], mod, modInfo; 24537 // apply config values 24538 if (o) { 24539 for (i in o) { 24540 if (o.hasOwnProperty(i)) { 24541 val = o[i]; 24542 //TODO This should be a case 24543 if (i === 'require') { 24544 self.require(val); 24545 } else if (i === 'skin') { 24546 //If the config.skin is a string, format to the expected object 24547 if (typeof val === 'string') { 24548 self.skin.defaultSkin = o.skin; 24549 val = { 24550 defaultSkin: val 24551 }; 24552 } 24553 24554 Y.mix(self.skin, val, true); 24555 } else if (i === 'groups') { 24556 for (j in val) { 24557 if (val.hasOwnProperty(j)) { 24558 groupName = j; 24559 group = val[j]; 24560 self.addGroup(group, groupName); 24561 if (group.aliases) { 24562 for (a in group.aliases) { 24563 if (group.aliases.hasOwnProperty(a)) { 24564 self.addAlias(group.aliases[a], a); 24565 } 24566 } 24567 } 24568 } 24569 } 24570 24571 } else if (i === 'modules') { 24572 // add a hash of module definitions 24573 for (j in val) { 24574 if (val.hasOwnProperty(j)) { 24575 self.addModule(val[j], j); 24576 } 24577 } 24578 } else if (i === 'aliases') { 24579 for (j in val) { 24580 if (val.hasOwnProperty(j)) { 24581 self.addAlias(val[j], j); 24582 } 24583 } 24584 } else if (i === 'gallery') { 24585 if (this.groups.gallery.update) { 24586 this.groups.gallery.update(val, o); 24587 } 24588 } else if (i === 'yui2' || i === '2in3') { 24589 if (this.groups.yui2.update) { 24590 this.groups.yui2.update(o['2in3'], o.yui2, o); 24591 } 24592 } else { 24593 self[i] = val; 24594 } 24595 } 24596 } 24597 } 24598 24599 // fix filter 24600 f = self.filter; 24601 24602 if (L.isString(f)) { 24603 f = f.toUpperCase(); 24604 self.filterName = f; 24605 self.filter = self.FILTER_DEFS[f]; 24606 if (f === 'DEBUG') { 24607 self.require('yui-log', 'dump'); 24608 } 24609 } 24610 24611 if (self.filterName && self.coverage) { 24612 if (self.filterName === 'COVERAGE' && L.isArray(self.coverage) && self.coverage.length) { 24613 for (i = 0; i < self.coverage.length; i++) { 24614 mod = self.coverage[i]; 24615 modInfo = self.getModuleInfo(mod); 24616 if (modInfo && modInfo.use) {
24617 mods = mods.concat(modInfo.use); 24618 } else { 24619 mods.push(mod); 24620 } 24621 } 24622 self.filters = self.filters || {}; 24623 Y.Array.each(mods, function(mod) { 24624 self.filters[mod] = self.FILTER_DEFS.COVERAGE; 24625 }); 24626 self.filterName = 'RAW'; 24627 self.filter = self.FILTER_DEFS[self.filterName]; 24628 } 24629 } 24630 24631 }, 24632 24633 /** 24634 * Returns the skin module name for the specified skin name. If a 24635 * module name is supplied, the returned skin module name is 24636 * specific to the module passed in. 24637 * @method formatSkin 24638 * @param {string} skin the name of the skin. 24639 * @param {string} mod optional: the name of a module to skin. 24640 * @return {string} the full skin module name. 24641 */ 24642 formatSkin: function(skin, mod) { 24643 var s = SKIN_PREFIX + skin; 24644 if (mod) { 24645 s = s + '-' + mod; 24646 } 24647 24648 return s; 24649 }, 24650 24651 /** 24652 * Adds the skin def to the module info 24653 * @method _addSkin 24654 * @param {string} skin the name of the skin. 24655 * @param {string} mod the name of the module. 24656 * @param {string} parent parent module if this is a skin of a 24657 * submodule or plugin. 24658 * @return {string} the module name for the skin. 24659 * @private 24660 */ 24661 _addSkin: function(skin, mod, parent) { 24662 var pkg, name, nmod, 24663 sinf = this.skin, 24664 mdef = mod && this.getModuleInfo(mod), 24665 ext = mdef && mdef.ext; 24666 24667 // Add a module definition for the module-specific skin css 24668 if (mod) { 24669 name = this.formatSkin(skin, mod); 24670 if (!this.getModuleInfo(name)) { 24671 pkg = mdef.pkg || mod; 24672 nmod = { 24673 skin: true, 24674 name: name, 24675 group: mdef.group, 24676 type: 'css', 24677 after: sinf.after, 24678 path: (parent || pkg) + '/' + sinf.base + skin + 24679 '/' + mod + '.css', 24680 ext: ext 24681 }; 24682 if (mdef.base) { 24683 nmod.base = mdef.base; 24684 } 24685 if (mdef.configFn) { 24686 nmod.configFn = mdef.configFn; 24687 } 24688 this.addModule(nmod, name); 24689 24690 } 24691 } 24692 24693 return name; 24694 }, 24695 /** 24696 * Adds an alias module to the system 24697 * @method addAlias 24698 * @param {Array} use An array of modules that makes up this alias 24699 * @param {String} name The name of the alias 24700 * @example 24701 * var loader = new Y.Loader({}); 24702 * loader.addAlias([ 'node', 'yql' ], 'davglass'); 24703 * loader.require(['davglass']); 24704 * var out = loader.resolve(true); 24705 * 24706 * //out.js will contain Node and YQL modules 24707 */ 24708 addAlias: function(use, name) { 24709 YUI.Env.aliases[name] = use; 24710 this.addModule({ 24711 name: name, 24712 use: use 24713 }); 24714 }, 24715 /** 24716 * Add a new module group 24717 * @method addGroup 24718 * @param {Object} config An object containing the group configuration data 24719 * @param {String} config.name required, the group name 24720 * @param {String} config.base The base directory for this module group 24721 * @param {String} config.root The root path to add to each combo resource path 24722 * @param {Boolean} config.combine Should the request be combined 24723 * @param {String} config.comboBase Combo service base path 24724 * @param {Object} config.modules The group of modules 24725 * @param {String} name the group name. 24726 * @example 24727 * var loader = new Y.Loader({}); 24728 * loader.addGroup({ 24729 * name: 'davglass', 24730 * combine: true, 24731 * comboBase: '/combo?', 24732 * root: '', 24733 * modules: { 24734 * //Module List here 24735 * } 24736 * }, 'davglass'); 24737 */ 24738 addGroup: function(o, name) { 24739 var mods = o.modules, 24740 self = this, 24741 defaultBase = o.defaultBase || Y.config.defaultBase, 24742 i, v; 24743 24744 name = name || o.name; 24745 o.name = name; 24746 self.groups[name] = o; 24747 24748 if (!o.base && defaultBase && o.root) { 24749 o.base = defaultBase + o.root; 24750 } 24751 24752 if (o.patterns) { 24753 for (i in o.patterns) { 24754 if (o.patterns.hasOwnProperty(i)) { 24755 o.patterns[i].group = name; 24756 self.patterns[i] = o.patterns[i]; 24757 } 24758 } 24759 } 24760 24761 if (mods) { 24762 for (i in mods) { 24763 if (mods.hasOwnProperty(i)) { 24764 v = mods[i]; 24765 if (typeof v === 'string') { 24766 v = { name: i, fullpath: v }; 24767 } 24768 v.group = name; 24769 self.addModule(v, i); 24770 } 24771 } 24772 } 24773 }, 24774 24775 /** 24776 * Add a new module to the component metadata. 24777 * @method addModule 24778 * @param {Object}
24778 config An object containing the module data. 24779 * @param {String} config.name Required, the component name 24780 * @param {String} config.type Required, the component type (js or css) 24781 * @param {String} config.path Required, the path to the script from `base` 24782 * @param {Array} config.requires Array of modules required by this component 24783 * @param {Array} [config.optional] Array of optional modules for this component 24784 * @param {Array} [config.supersedes] Array of the modules this component replaces 24785 * @param {Array} [config.after] Array of modules the components which, if present, should be sorted above this one 24786 * @param {Object} [config.after_map] Faster alternative to 'after' -- supply a hash instead of an array 24787 * @param {Number} [config.rollup] The number of superseded modules required for automatic rollup 24788 * @param {String} [config.fullpath] If `fullpath` is specified, this is used instead of the configured `base + path` 24789 * @param {Boolean} [config.skinnable] Flag to determine if skin assets should automatically be pulled in 24790 * @param {Object} [config.submodules] Hash of submodules 24791 * @param {String} [config.group] The group the module belongs to -- this is set automatically when it is added as part of a group configuration. 24792 * @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"]` 24793 * @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: 24794 * @param {String} [config.condition.trigger] The name of a module that can trigger the auto-load 24795 * @param {Function} [config.condition.test] A function that returns true when the module is to be loaded. 24796 * @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"`. 24797 * @param {String} [config.condition.when] Specifies the load order of the conditional module 24798 * with regard to the position of the trigger module. 24799 * This should be one of three values: `before`, `after`, or `instead`. The default is `after`. 24800 * @param {Object} [config.testresults] A hash of test results from `Y.Features.all()` 24801 * @param {Function} [config.configFn] A function to exectute when configuring this module 24802 * @param {Object} config.configFn.mod The module config, modifying this object will modify it's config. Returning false will delete the module's config. 24803 * @param {String[]} [config.optionalRequires] List of dependencies that 24804 may optionally be loaded by this loader. This is targeted mostly at 24805 polyfills, since they should not be in the list of requires because 24806 polyfills are assumed to be available in the global scope. 24807 * @param {Function} [config.test] Test to be called when this module is 24808 added as an optional dependency of another module. If the test function 24809 returns `false`, the module will be ignored and will not be attached to 24810 this YUI instance. 24811 * @param {String} [name] The module name, required if not in the module data. 24812 * @return {Object} the module definition or null if the object passed in did not provide all required attributes. 24813 */ 24814 addModule: function(o, name) { 24815 name = name || o.name; 24816 24817 if (typeof o === 'string') { 24818 o = { name: name, fullpath: o }; 24819 } 24820 24821 24822 var subs, i, l, t, sup, s, smod, plugins, plug, 24823 j, langs, packName, supName, flatSup, flatLang, lang, ret, 24824 overrides, skinname, when, g, p, 24825 modInfo = this.moduleInfo[name], 24826 conditions = this.conditions, trigger; 24827 24828 //Only merge this data if the temp flag is set 24829 //from an earlier pass from a pattern or else 24830 //an override module (YUI_config) can not be used to 24831 //replace a default module. 24832 if (modInfo && modInfo.temp) { 24833 //This catches temp modules loaded via a pattern 24834 // The module will be added twice, once from the pattern and 24835 // Once from the actual add call, this ensures that properties 24836 // that were added to the module the first time around (group: gallery) 24837 // are also added the second time around too. 24838 o = Y.merge(modInfo, o); 24839 } 24840 24841 o.name = name; 24842 24843 if (!o || !o.name) { 24844 return null; 24845 } 24846 24847 if (!o.type) { 24848 //Always assume it's javascript unless the CSS pattern is matched. 24849 o.type = JS; 24850 p = o.path || o.fullpath; 24851 if (p && this.REGEX_CSS.test(p)) { 24852 o.type = CSS; 24853 } 24854 } 24855 24856 if (!o.path && !o.fullpath) { 24857 o.path = _path(name, name, o.type); 24858 } 24859 o.supersedes = o.supersedes || o.use; 24860 24861 o.ext = ('ext' in o) ? o.ext : (this._internal) ? false : true; 24862 24863 // Handle submodule logic 24864 subs = o.submodules; 24865 24866 this.moduleInfo[name] = o; 24867 24868 o.requires = o.requires || []; 24869 24870 /* 24871 Only allowing the cascade of requires information, since 24872 optional and supersedes are far more fine grained than 24873 a blanket requires is. 24874 */ 24875 if (this.requires) { 24876 for (i = 0; i < this.requires.length; i++) { 24877 o.requires.push(this.requires[i]); 24878 } 24879 } 24880 if (o.group && this.groups && this.groups[o.group]) { 24881 g = this.groups[o.group]; 24882 if (g.requires) { 24883 for (i = 0; i < g.requires.length; i++) { 24884 o.requires.push(g.requires[i]); 24885 } 24886 } 24887 } 24888 24889 24890 if (!o.defaults) { 24891 o.defaults = { 24892 requires: o.requires ? [].concat(o.requires) : null, 24893 supersedes: o.supersedes ? [].concat(o.supersedes) : null, 24894 optional: o.optional ? [].concat(o.optional) : null 24895 }; 24896 } 24897 24898 if (o.skinnable && o.ext && o.temp) { 24899 skinname = this._addSkin(this.skin.defaultSkin, name); 24900 o.requires.unshift(skinname); 24901 } 24902 24903 if (o.requires.length) { 24904 o.requires = this.filterRequires(o.requires) || []; 24905 } 24906 24907 if (!o.langPack && o.lang) { 24908 // Setup root package by default as a fallback 24909 // for languages that are not defined 24910 packName = this.getLangPackName(ROOT_LANG, name); 24911 smod = this.getModuleInfo(packName); 24912 24913 if (!smod) { 24914 this._addLangPack(null, o, packName); 24915 } 24916 24917 langs = yArray(o.lang); 24918 24919 for (j = 0; j < langs.length; j++) { 24920 lang = langs[j]; 24921 packName = this.getLangPackName(lang, name); 24922 smod = this.getModuleInfo(packName); 24923 if (!smod) { 24924 smod = this._addLangPack(lang, o, packName); 24925 } 24926 } 24927 } 24928 24929 24930 if (subs) { 24931 sup = o.supersedes || []; 24932 l = 0; 24933 24934 for (i in subs) { 24935 if (subs.hasOwnProperty(i)) { 24936 s = subs[i]; 24937 24938 s.path = s.path || _path(name, i, o.type); 24939 s.pkg = name; 24940 s.group = o.group; 24941 24942 if (s.supersedes) { 24943 sup = sup.concat(s.supersedes); 24944 } 24945 24946 smod = this.addModule(s, i); 24947 sup.push(i); 24948 24949 if (smod.skinnable) { 24950 o.skinnable = true; 24951 overrides = this.skin.overrides; 24952 if (overrides && overrides[i]) { 24953 for (j = 0; j < overrides[i].length; j++) { 24954 skinname = this._addSkin(overrides[i][j], 24955 i, name); 24956 sup.push(skinname); 24957 } 24958 } 24959 skinname = this._addSkin(this.skin.defaultSkin, 24960 i, name); 24961 sup.push(skinname); 24962 } 24963 24964 // looks like we are expected to work out the metadata 24965 // for the parent module language packs from what is 24966 // specified in the child modules. 24967 if (s.lang && s.lang.length) { 24968 // Setup root package by default as a fallback 24969 // for languages that are not defined 24970 packName = this.getLangPackName(ROOT_LANG, name); 24971 smod = this.getModuleInfo(packName); 24972 24973 if (!smod) { 24974 this._addLangPack(null, o, packName); 24975 } 24976 24977 langs = yArray(s.lang); 24978 24979 for (j = 0; j < langs.length; j++) { 24980 lang = langs[j]; 24981 packName = this.getLangPackName(lang, name); 24982 supName = this.getLangPackName(lang, i); 24983 smod = this.getModuleInfo(packName); 24984 24985 if (!smod) { 24986 smod = this._addLangPack(lang, o, packName); 24987 } 24988 24989 flatSup = flatSup || yArray.hash(smod.supersedes); 24990 24991 if (!(supName in flatSup)) { 24992 smod.supersedes.push(supName); 24993 } 24994 24995 o.lang = o.lang || []; 24996 24997 flatLang = flatLang || yArray.hash(o.lang); 24998 24999 if (!(lang in flatLang)) { 25000 o.lang.push(lang); 25001 } 25002 25003// Add rollup file, need to add to supersedes list too 25004 25005 // default packages 25006 packName = this.getLangPackName(ROOT_LANG, name); 25007 supName = this.getLangPackName(ROOT_LANG, i); 25008 25009 smod = this.getModuleInfo(packName); 25010 25011 if (!smod) { 25012 smod = this._addLangPack(lang, o, packName); 25013 } 25014 25015 if (!(supName in flatSup)) { 25016 smod.supersedes.push(supName); 25017 } 25018 25019// Add rollup file, need to add to supersedes list too 25020 25021 } 25022 } 25023 25024 l++; 25025 } 25026 } 25027 //o.supersedes = YObject.keys(yArray.hash(sup)); 25028 o.supersedes = yArray.dedupe(sup); 25029 if (this.allowRollup) { 25030 o.rollup = (l < 4) ? l : Math.min(l - 1, 4); 25031 } 25032 } 25033 25034 plugins = o.plugins; 25035 if (plugins) { 25036 for (i in plugins) { 25037 if (plugins.hasOwnProperty(i)) { 25038 plug = plugins[i]; 25039 plug.pkg = name; 25040 plug.path = plug.path || _path(name, i, o.type); 25041 plug.requires = plug.requires || []; 25042 plug.group = o.group; 25043 this.addModule(plug, i); 25044 if (o.skinnable) { 25045 this._addSkin(this.skin.defaultSkin, i, name); 25046 } 25047 25048 } 25049 } 25050 } 25051 25052 if (o.condition) { 25053 t = this._expandAliases(o.condition.trigger); 25054 for (i = 0; i < t.length; i++) { 25055 trigger = t[i]; 25056 when = o.condition.when; 25057 conditions[trigger] = conditions[trigger] || {}; 25058 conditions[trigger][name] = o.condition; 25059 // the 'when' attribute can be 'before', 'after', or 'instead' 25060 // the default is after. 25061 if (when && when !== 'after') { 25062 if (when === 'instead') { // replace the trigger 25063 o.supersedes = o.supersedes || []; 25064 o.supersedes.push(trigger); 25065 } 25066 // before the trigger 25067 // the trigger requires the conditional mod, 25068 // so it should appear before the conditional 25069 // mod if we do not intersede. 25070 } else { // after the trigger 25071 o.after = o.after || []; 25072 o.after.push(trigger); 25073 } 25074 } 25075 } 25076 25077 if (o.supersedes) { 25078 o.supersedes = this.filterRequires(o.supersedes); 25079 } 25080 25081 if (o.after) { 25082 o.after = this.filterRequires(o.after); 25083 o.after_map = yArray.hash(o.after); 25084 } 25085 25086 // this.dirty = true; 25087 25088 if (o.configFn) { 25089 ret = o.configFn(o); 25090 if (ret === false) { 25091 delete this.moduleInfo[name]; 25092 delete GLOBAL_ENV._renderedMods[name]; 25093 o = null; 25094 } 25095 } 25096 //Add to global cache 25097 if (o) { 25098 if (!GLOBAL_ENV._renderedMods) { 25099 GLOBAL_ENV._renderedMods = {}; 25100 } 25101 GLOBAL_ENV._renderedMods[name] = Y.mix(GLOBAL_ENV._renderedMods[name] || {}, o);
25102 GLOBAL_ENV._conditions = conditions; 25103 } 25104 25105 return o; 25106 }, 25107 25108 /** 25109 * Add a requirement for one or more module 25110 * @method require 25111 * @param {string[] | string*} what the modules to load. 25112 */ 25113 require: function(what) { 25114 var a = (typeof what === 'string') ? yArray(arguments) : what; 25115 this.dirty = true; 25116 this.required = Y.merge(this.required, yArray.hash(this.filterRequires(a))); 25117 25118 this._explodeRollups(); 25119 }, 25120 /** 25121 * Grab all the items that were asked for, check to see if the Loader 25122 * meta-data contains a "use" array. If it doesm remove the asked item and replace it with 25123 * the content of the "use". 25124 * This will make asking for: "dd" 25125 * Actually ask for: "dd-ddm-base,dd-ddm,dd-ddm-drop,dd-drag,dd-proxy,dd-constrain,dd-drop,dd-scroll,dd-drop-plugin" 25126 * @private 25127 * @method _explodeRollups 25128 */ 25129 _explodeRollups: function() { 25130 var self = this, m, m2, i, a, v, len, len2, 25131 r = self.required; 25132 25133 if (!self.allowRollup) { 25134 for (i in r) { 25135 if (r.hasOwnProperty(i)) { 25136 m = self.getModule(i); 25137 if (m && m.use) { 25138 len = m.use.length; 25139 for (a = 0; a < len; a++) { 25140 m2 = self.getModule(m.use[a]); 25141 if (m2 && m2.use) { 25142 len2 = m2.use.length; 25143 for (v = 0; v < len2; v++) { 25144 r[m2.use[v]] = true; 25145 } 25146 } else { 25147 r[m.use[a]] = true; 25148 } 25149 } 25150 } 25151 } 25152 } 25153 self.required = r; 25154 } 25155 25156 }, 25157 /** 25158 * Explodes the required array to remove aliases and replace them with real modules 25159 * @method filterRequires 25160 * @param {Array} r The original requires array 25161 * @return {Array} The new array of exploded requirements 25162 */ 25163 filterRequires: function(r) { 25164 if (r) { 25165 if (!Y.Lang.isArray(r)) { 25166 r = [r]; 25167 } 25168 r = Y.Array(r); 25169 var c = [], i, mod, o, m; 25170 25171 for (i = 0; i < r.length; i++) { 25172 mod = this.getModule(r[i]); 25173 if (mod && mod.use) { 25174 for (o = 0; o < mod.use.length; o++) { 25175 //Must walk the other modules in case a module is a rollup of rollups (datatype) 25176 m = this.getModule(mod.use[o]); 25177 if (m && m.use && (m.name !== mod.name)) { 25178 c = Y.Array.dedupe([].concat(c, this.filterRequires(m.use))); 25179 } else { 25180 c.push(mod.use[o]); 25181 } 25182 } 25183 } else { 25184 c.push(r[i]); 25185 } 25186 } 25187 r = c; 25188 } 25189 return r; 25190 }, 25191 25192 /** 25193 Returns `true` if the module can be attached to the YUI instance. Runs 25194 the module's test if there is one and caches its result. 25195 25196 @method _canBeAttached 25197 @param {String} module Name of the module to check. 25198 @return {Boolean} Result of the module's test if it has one, or `true`. 25199 **/ 25200 _canBeAttached: function (m) { 25201 m = this.getModule(m); 25202 if (m && m.test) { 25203 if (!m.hasOwnProperty('_testResult')) { 25204 m._testResult = m.test(Y); 25205 } 25206 return m._testResult; 25207 } 25208 // return `true` for modules not registered as Loader will know what 25209 // to do with them later on 25210 return true; 25211 }, 25212 25213 /**
25214 * Returns an object containing properties for all modules required 25215 * in order to load the requested module 25216 * @method getRequires 25217 * @param {object} mod The module definition from moduleInfo. 25218 * @return {array} the expanded requirement list. 25219 */ 25220 getRequires: function(mod) { 25221 25222 if (!mod) { 25223 //console.log('returning no reqs for ' + mod.name); 25224 return NO_REQUIREMENTS; 25225 } 25226 25227 if (mod._parsed) { 25228 //console.log('returning requires for ' + mod.name, mod.requires); 25229 return mod.expanded || NO_REQUIREMENTS; 25230 } 25231 25232 //TODO add modue cache here out of scope.. 25233 25234 var i, m, j, length, add, packName, lang, testresults = this.testresults, 25235 name = mod.name, cond, 25236 adddef = ON_PAGE[name] && ON_PAGE[name].details, 25237 optReqs = mod.optionalRequires, 25238 d, go, def, 25239 r, old_mod, 25240 o, skinmod, skindef, skinpar, skinname, 25241 intl = mod.lang || mod.intl, 25242 ftests = Y.Features && Y.Features.tests.load, 25243 hash, reparse; 25244 25245 // console.log(name); 25246 25247 // pattern match leaves module stub that needs to be filled out 25248 if (mod.temp && adddef) { 25249 old_mod = mod; 25250 mod = this.addModule(adddef, name); 25251 mod.group = old_mod.group; 25252 mod.pkg = old_mod.pkg; 25253 delete mod.expanded; 25254 } 25255 25256 // console.log('cache: ' + mod.langCache + ' == ' + this.lang); 25257 25258 //If a skin or a lang is different, reparse.. 25259 reparse = !((!this.lang || mod.langCache === this.lang) && (mod.skinCache === this.skin.defaultSkin)); 25260 25261 if (mod.expanded && !reparse) { 25262 return mod.expanded; 25263 } 25264 25265 // Optional dependencies are dependencies that may or may not be 25266 // available. 25267 // This feature was designed specifically to be used when transpiling 25268 // ES6 modules, in order to use polyfills and regular scripts that define 25269 // global variables without having to import them since they should be 25270 // available in the global scope. 25271 if (optReqs) { 25272 for (i = 0, length = optReqs.length; i < length; i++) { 25273 if (this._canBeAttached(optReqs[i])) { 25274 mod.requires.push(optReqs[i]); 25275 } 25276 } 25277 } 25278 25279 d = []; 25280 hash = {}; 25281 r = this.filterRequires(mod.requires); 25282 if (mod.lang) { 25283 //If a module has a lang attribute, auto add the intl requirement. 25284 d.unshift('intl'); 25285 r.unshift('intl'); 25286 intl = true; 25287 } 25288 o = this.filterRequires(mod.optional); 25289 25290 25291 mod._parsed = true; 25292 mod.langCache = this.lang; 25293 mod.skinCache = this.skin.defaultSkin; 25294 25295 for (i = 0; i < r.length; i++) { 25296 if (!hash[r[i]]) { 25297 d.push(r[i]); 25298 hash[r[i]] = true; 25299 m = this.getModule(r[i]); 25300 if (m) { 25301 add = this.getRequires(m); 25302 intl = intl || (m.expanded_map && 25303 (INTL in m.expanded_map)); 25304 for (j = 0; j < add.length; j++) { 25305 d.push(add[j]); 25306 } 25307 } 25308 } 25309 } 25310 25311 // get the requirements from superseded modules, if any 25312 r = this.filterRequires(mod.supersedes); 25313 if (r) { 25314 for (i = 0; i < r.length; i++) { 25315 if (!hash[r[i]]) { 25316 // if this module has submodules, the requirements list is 25317 // expanded to include the submodules. This is so we can 25318 // prevent dups when a submodule is already loaded and the 25319 // parent is requested. 25320 if (mod.submodules) { 25321 d.push(r[i]); 25322 } 25323 25324 hash[r[i]] = true; 25325 m = this.getModule(r[i]); 25326 25327 if (m) { 25328 add = this.getRequires(m); 25329 intl = intl || (m.expanded_map && 25330 (INTL in m.expanded_map)); 25331 for (j = 0; j < add.length; j++) { 25332 d.push(add[j]); 25333 } 25334 } 25335 } 25336 } 25337 } 25338 25339 if (o && this.loadOptional) { 25340 for (i = 0; i < o.length; i++) { 25341 if (!hash[o[i]]) { 25342 d.push(o[i]); 25343 hash[o[i]] = true; 25344 m = this.getModuleInfo(o[i]); 25345 if (m) { 25346 add = this.getRequires(m); 25347 intl = intl || (m.expanded_map && 25348 (INTL in m.expanded_map)); 25349 for (j = 0; j < add.length; j++) { 25350 d.push(add[j]); 25351 } 25352 } 25353 } 25354 } 25355 } 25356 25357 cond = this.conditions[name]; 25358 25359 if (cond) { 25360 //Set the module to not parsed since we have conditionals and this could change the dependency tree. 25361 mod._parsed = false;
25362 if (testresults && ftests) { 25363 oeach(testresults, function(result, id) { 25364 var condmod = ftests[id].name; 25365 if (!hash[condmod] && ftests[id].trigger === name) { 25366 if (result && ftests[id]) { 25367 hash[condmod] = true; 25368 d.push(condmod); 25369 } 25370 } 25371 }); 25372 } else { 25373 for (i in cond) { 25374 if (cond.hasOwnProperty(i)) { 25375 if (!hash[i]) { 25376 def = cond[i]; 25377 //first see if they've specfied a ua check 25378 //then see if they've got a test fn & if it returns true 25379 //otherwise just having a condition block is enough 25380 go = def && ((!def.ua && !def.test) || (def.ua && Y.UA[def.ua]) || 25381 (def.test && def.test(Y, r))); 25382 25383 if (go) { 25384 hash[i] = true; 25385 d.push(i); 25386 m = this.getModule(i); 25387 if (m) { 25388 add = this.getRequires(m); 25389 for (j = 0; j < add.length; j++) { 25390 d.push(add[j]); 25391 } 25392 25393 } 25394 } 25395 } 25396 } 25397 } 25398 } 25399 } 25400 25401 // Create skin modules 25402 if (mod.skinnable) { 25403 skindef = this.skin.overrides; 25404 for (i in YUI.Env.aliases) { 25405 if (YUI.Env.aliases.hasOwnProperty(i)) { 25406 if (Y.Array.indexOf(YUI.Env.aliases[i], name) > -1) { 25407 skinpar = i; 25408 } 25409 } 25410 } 25411 if (skindef && (skindef[name] || (skinpar && skindef[skinpar]))) { 25412 skinname = name; 25413 if (skindef[skinpar]) { 25414 skinname = skinpar; 25415 } 25416 for (i = 0; i < skindef[skinname].length; i++) { 25417 skinmod = this._addSkin(skindef[skinname][i], name); 25418 if (!this.isCSSLoaded(skinmod, this._boot)) { 25419 d.push(skinmod); 25420 } 25421 } 25422 } else { 25423 skinmod = this._addSkin(this.skin.defaultSkin, name); 25424 if (!this.isCSSLoaded(skinmod, this._boot)) { 25425 d.push(skinmod); 25426 } 25427 } 25428 } 25429 25430 mod._parsed = false; 25431 25432 if (intl) { 25433 25434 if (mod.lang && !mod.langPack && Y.Intl) { 25435 lang = Y.Intl.lookupBestLang(this.lang || ROOT_LANG, mod.lang); 25436 packName = this.getLangPackName(lang, name); 25437 if (packName) { 25438 d.unshift(packName); 25439 } 25440 } 25441 d.unshift(INTL); 25442 } 25443 25444 mod.expanded_map = yArray.hash(d); 25445 25446 mod.expanded = YObject.keys(mod.expanded_map); 25447 25448 return mod.expanded; 25449 }, 25450 /** 25451 * Check to see if named css module is already loaded on the page 25452 * @method isCSSLoaded 25453 * @param {String} name The name of the css file 25454 * @param {Boolean} skip To skip the short-circuit for ignoreRegister 25455 * @return Boolean 25456 */ 25457 isCSSLoaded: function(name, skip) { 25458 //TODO - Make this call a batching call with name being an array 25459 if (!name || !YUI.Env.cssStampEl || (!skip && this.ignoreRegistered)) { 25460 return false; 25461 } 25462 var el = YUI.Env.cssStampEl, 25463 ret = false, 25464 mod = YUI.Env._cssLoaded[name], 25465 style = el.currentStyle; //IE 25466 25467 25468 if (mod !== undefined) { 25469 return mod; 25470 } 25471 25472 //Add the classname to the element 25473 el.className = name; 25474 25475 if (!style) { 25476 style = Y.config.doc.defaultView.getComputedStyle(el, null); 25477 } 25478 25479 if (style && style.display === 'none') { 25480 ret = true; 25481 } 25482 25483 25484 el.className = ''; //Reset the classname to '' 25485 25486 YUI.Env._cssLoaded[name] = ret; 25487 25488 return ret; 25489 }, 25490 25491 /** 25492 * Returns a hash of module names the supplied module satisfies. 25493 * @method getProvides 25494 * @param {string} name The name of the module. 25495 * @return {object} what this module provides. 25496 */ 25497 getProvides: function(name) { 25498 var m = this.getModule(name), o, s; 25499 // supmap = this.provides; 25500 25501 if (!m) { 25502 return NOT_FOUND; 25503 } 25504 25505 if (m && !m.provides) { 25506 o = {}; 25507 s = m.supersedes; 25508 25509 if (s) { 25510 yArray.each(s, function(v) { 25511 Y.mix(o, this.getProvides(v)); 25512 }, this); 25513 } 25514 25515 o[name] = true; 25516 m.provides = o; 25517 25518 } 25519 25520 return m.provides; 25521 }, 25522 25523 /** 25524 * Calculates the dependency tree, the result is stored in the sorted 25525 * property. 25526 * @method calculate 25527 * @param {object} o optional options object. 25528 * @param {string} type optional argument to prune modules. 25529 */ 25530 calculate: function(o, type) { 25531 if (o || type || this.dirty) { 25532 25533 if (o) { 25534 this._config(o); 25535 } 25536 25537 if (!this._init) { 25538 this._setup(); 25539 } 25540 25541 this._explode(); 25542 25543 if (this.allowRollup) { 25544 this._rollup(); 25545 } else { 25546 this._explodeRollups(); 25547 } 25548 this._reduce(); 25549 this._sort(); 25550 } 25551 }, 25552 /** 25553 * Creates a "psuedo" package for languages provided in the lang array 25554 * @method _addLangPack 25555 * @private 25556 * @param {String} lang The language to create 25557 * @param {Object} m The module definition to create the language pack around 25558 * @param {String} packName The name of the package (e.g: lang/datatype-date-en-US) 25559 * @return {Object} The module definition 25560 */ 25561 _addLangPack: function(lang, m, packName) { 25562 var name = m.name, 25563 packPath, conf, 25564 existing = this.getModuleInfo(packName); 25565 25566 if (!existing) { 25567 25568 packPath = _path((m.pkg || name), packName, JS, true); 25569 25570 conf = { 25571 path: packPath, 25572 intl: true, 25573 langPack: true, 25574 ext: m.ext, 25575 group: m.group, 25576 supersedes: [] 25577 }; 25578 if (m.root) { 25579 conf.root = m.root; 25580 } 25581 if (m.base) { 25582 conf.base = m.base; 25583 } 25584 25585 if (m.configFn) { 25586 conf.configFn = m.configFn; 25587 } 25588 25589 this.addModule(conf, packName); 25590 25591 if (lang) { 25592 Y.Env.lang = Y.Env.lang || {};
25593 Y.Env.lang[lang] = Y.Env.lang[lang] || {}; 25594 Y.Env.lang[lang][name] = true; 25595 } 25596 } 25597 25598 return this.getModuleInfo(packName); 25599 }, 25600 25601 /** 25602 * Investigates the current YUI configuration on the page. By default, 25603 * modules already detected will not be loaded again unless a force 25604 * option is encountered. Called by calculate() 25605 * @method _setup 25606 * @private 25607 */ 25608 _setup: function() { 25609 var info = this.moduleInfo, name, i, j, m, l, 25610 packName; 25611 25612 for (name in info) { 25613 if (info.hasOwnProperty(name)) { 25614 m = info[name]; 25615 if (m) { 25616 25617 // remove dups 25618 //m.requires = YObject.keys(yArray.hash(m.requires)); 25619 m.requires = yArray.dedupe(m.requires); 25620 25621 // Create lang pack modules 25622 //if (m.lang && m.lang.length) { 25623 if (m.lang) { 25624 // Setup root package if the module has lang defined, 25625 // it needs to provide a root language pack 25626 packName = this.getLangPackName(ROOT_LANG, name); 25627 this._addLangPack(null, m, packName); 25628 } 25629 25630 } 25631 } 25632 } 25633 25634 25635 //l = Y.merge(this.inserted); 25636 l = {}; 25637 25638 // available modules 25639 if (!this.ignoreRegistered) { 25640 Y.mix(l, GLOBAL_ENV.mods); 25641 } 25642 25643 // add the ignore list to the list of loaded packages 25644 if (this.ignore) { 25645 Y.mix(l, yArray.hash(this.ignore)); 25646 } 25647 25648 // expand the list to include superseded modules 25649 for (j in l) { 25650 if (l.hasOwnProperty(j)) { 25651 Y.mix(l, this.getProvides(j)); 25652 } 25653 } 25654 25655 // remove modules on the force list from the loaded list 25656 if (this.force) { 25657 for (i = 0; i < this.force.length; i++) { 25658 if (this.force[i] in l) { 25659 delete l[this.force[i]]; 25660 } 25661 } 25662 } 25663 25664 Y.mix(this.loaded, l); 25665 25666 this._init = true; 25667 }, 25668 25669 /** 25670 * Builds a module name for a language pack 25671 * @method getLangPackName 25672 * @param {string} lang the language code. 25673 * @param {string} mname the module to build it for. 25674 * @return {string} the language pack module name. 25675 */ 25676 getLangPackName: function(lang, mname) { 25677 return ('lang/' + mname + ((lang) ? '_' + lang : '')); 25678 }, 25679 /** 25680 * Inspects the required modules list looking for additional 25681 * dependencies. Expands the required list to include all 25682 * required modules. Called by calculate() 25683 * @method _explode 25684 * @private 25685 */ 25686 _explode: function() { 25687 //TODO Move done out of scope 25688 var r = this.required, m, reqs, done = {}, 25689 self = this, name, expound; 25690 25691 // the setup phase is over, all modules have been created 25692 self.dirty = false; 25693 25694 self._explodeRollups(); 25695 r = self.required; 25696 25697 for (name in r) { 25698 if (r.hasOwnProperty(name)) { 25699 if (!done[name]) { 25700 done[name] = true; 25701 m = self.getModule(name); 25702 if (m) { 25703 expound = m.expound; 25704 25705 if (expound) { 25706 r[expound] = self.getModule(expound); 25707 reqs = self.getRequires(r[expound]); 25708 Y.mix(r, yArray.hash(reqs)); 25709 } 25710 25711 reqs = self.getRequires(m); 25712 Y.mix(r, yArray.hash(reqs)); 25713 } 25714 } 25715 } 25716 } 25717 25718 }, 25719 /** 25720 * The default method used to test a module against a pattern 25721 * @method _patternTest 25722 * @private 25723 * @param {String} mname The module being tested 25724 * @param {String} pname The pattern to match 25725 */ 25726 _patternTest: function(mname, pname) { 25727 return (mname.indexOf(pname) > -1); 25728 }, 25729 /** 25730 * Get's the loader meta data for the requested module 25731 * @method getModule 25732 * @param {String} mname The module name to get 25733 * @return {Object} The module metadata 25734 */
25735 getModule: function(mname) { 25736 //TODO: Remove name check - it's a quick hack to fix pattern WIP 25737 if (!mname) { 25738 return null; 25739 } 25740 25741 var p, found, pname, 25742 m = this.getModuleInfo(mname), 25743 patterns = this.patterns; 25744 25745 // check the patterns library to see if we should automatically add 25746 // the module with defaults 25747 if (!m || (m && m.ext)) { 25748 for (pname in patterns) { 25749 if (patterns.hasOwnProperty(pname)) { 25750 p = patterns[pname]; 25751 25752 //There is no test method, create a default one that tests 25753 // the pattern against the mod name 25754 if (!p.test) { 25755 p.test = this._patternTest; 25756 } 25757 25758 if (p.test(mname, pname)) { 25759 // use the metadata supplied for the pattern 25760 // as the module definition. 25761 found = p; 25762 break; 25763 } 25764 } 25765 } 25766 } 25767 25768 if (!m) { 25769 if (found) { 25770 if (p.action) { 25771 p.action.call(this, mname, pname); 25772 } else { 25773 // ext true or false? 25774 m = this.addModule(Y.merge(found, { 25775 test: void 0, 25776 temp: true 25777 }), mname); 25778 if (m && found.configFn) { 25779 m.configFn = found.configFn; 25780 } 25781 } 25782 } 25783 } else { 25784 if (found && m && found.configFn && !m.configFn) { 25785 m.configFn = found.configFn; 25786 m.configFn(m); 25787 } 25788 } 25789 25790 return m; 25791 }, 25792 25793 // impl in rollup submodule 25794 _rollup: function() { }, 25795 25796 /** 25797 * Remove superceded modules and loaded modules. Called by 25798 * calculate() after we have the mega list of all dependencies 25799 * @method _reduce 25800 * @return {object} the reduced dependency hash. 25801 * @private 25802 */ 25803 _reduce: function(r) { 25804 25805 r = r || this.required; 25806 25807 var i, j, s, m, type = this.loadType, 25808 ignore = this.ignore ? yArray.hash(this.ignore) : false; 25809 25810 for (i in r) { 25811 if (r.hasOwnProperty(i)) { 25812 m = this.getModule(i); 25813 // remove if already loaded 25814 if (((this.loaded[i] || ON_PAGE[i]) && 25815 !this.forceMap[i] && !this.ignoreRegistered) || 25816 (type && m && m.type !== type)) { 25817 delete r[i]; 25818 } 25819 if (ignore && ignore[i]) { 25820 delete r[i]; 25821 } 25822 // remove anything this module supersedes 25823 s = m && m.supersedes; 25824 if (s) { 25825 for (j = 0; j < s.length; j++) { 25826 if (s[j] in r) { 25827 delete r[s[j]]; 25828 } 25829 } 25830 } 25831 } 25832 } 25833 25834 return r; 25835 }, 25836 /** 25837 * Handles the queue when a module has been loaded for all cases 25838 * @method _finish 25839 * @private 25840 * @param {String} msg The message from Loader 25841 * @param {Boolean} success A boolean denoting success or failure 25842 */ 25843 _finish: function(msg, success) { 25844 25845 _queue.running = false; 25846 25847 var onEnd = this.onEnd; 25848 if (onEnd) { 25849 onEnd.call(this.context, { 25850 msg: msg, 25851 data: this.data, 25852 success: success 25853 }); 25854 } 25855 this._continue(); 25856 }, 25857 /** 25858 * The default Loader onSuccess handler, calls this.onSuccess with a payload 25859 * @method _onSuccess 25860 * @private 25861 */ 25862 _onSuccess: function() { 25863 var self = this, skipped = Y.merge(self.skipped), fn, 25864 failed = [], rreg = self.requireRegistration, 25865 success, msg, i, mod; 25866 25867 for (i in skipped) { 25868 if (skipped.hasOwnProperty(i)) { 25869 delete self.inserted[i]; 25870 } 25871 } 25872 25873 self.skipped = {}; 25874 25875 for (i in self.inserted) { 25876 if (self.inserted.hasOwnProperty(i)) { 25877 mod = self.getModule(i); 25878 if (mod && rreg && mod.type === JS && !(i in YUI.Env.mods)) { 25879 failed.push(i); 25880 } else { 25881 Y.mix(self.loaded, self.getProvides(i)); 25882 } 25883 } 25884 } 25885 25886 fn = self.onSuccess; 25887 msg = (failed.length) ? 'notregistered' : 'success'; 25888 success = !(failed.length); 25889 if (fn) { 25890 fn.call(self.context, { 25891 msg: msg, 25892 data: self.data, 25893 success: success, 25894 failed: failed, 25895 skipped: skipped 25896 }); 25897 } 25898 self._finish(msg, success); 25899 }, 25900 /** 25901 * The default Loader onProgress handler, calls this.onProgress with a payload 25902 * @method _onProgress 25903 * @private 25904 */ 25905 _onProgress: function(e) { 25906 var self = this, i;
25907 //set the internal cache to what just came in. 25908 if (e.data && e.data.length) { 25909 for (i = 0; i < e.data.length; i++) { 25910 e.data[i] = self.getModule(e.data[i].name); 25911 } 25912 } 25913 if (self.onProgress) { 25914 self.onProgress.call(self.context, { 25915 name: e.url, 25916 data: e.data 25917 }); 25918 } 25919 }, 25920 /** 25921 * The default Loader onFailure handler, calls this.onFailure with a payload 25922 * @method _onFailure 25923 * @private 25924 */ 25925 _onFailure: function(o) { 25926 var f = this.onFailure, msg = [], i = 0, len = o.errors.length; 25927 25928 for (i; i < len; i++) { 25929 msg.push(o.errors[i].error); 25930 } 25931 25932 msg = msg.join(','); 25933 25934 25935 if (f) { 25936 f.call(this.context, { 25937 msg: msg, 25938 data: this.data, 25939 success: false 25940 }); 25941 } 25942 25943 this._finish(msg, false); 25944 25945 }, 25946 25947 /** 25948 * The default Loader onTimeout handler, calls this.onTimeout with a payload 25949 * @method _onTimeout 25950 * @param {Get.Transaction} transaction The Transaction object from `Y.Get` 25951 * @private 25952 */ 25953 _onTimeout: function(transaction) { 25954 var f = this.onTimeout; 25955 if (f) { 25956 f.call(this.context, { 25957 msg: 'timeout', 25958 data: this.data, 25959 success: false, 25960 transaction: transaction 25961 }); 25962 } 25963 }, 25964 25965 /** 25966 * Sorts the dependency tree. The last step of calculate() 25967 * @method _sort 25968 * @private 25969 */ 25970 _sort: function() { 25971 var name, 25972 25973 // Object containing module names. 25974 required = this.required, 25975 25976 // Keep track of whether we've visited a module. 25977 visited = {}; 25978 25979 // Will contain modules names, in the correct order, 25980 // according to dependencies. 25981 this.sorted = []; 25982 25983 for (name in required) { 25984 if (!visited[name] && required.hasOwnProperty(name)) { 25985 this._visit(name, visited); 25986 } 25987 } 25988 }, 25989 25990 /** 25991 * Recursively visits the dependencies of the module name 25992 * passed in, and appends each module name to the `sorted` property. 25993 * @param {String} name The name of a module. 25994 * @param {Object} visited Keeps track of whether a module was visited. 25995 * @method _visit 25996 * @private 25997 */ 25998 _visit: function (name, visited) { 25999 var required, condition, moduleInfo, dependency, dependencies, 26000 trigger, isAfter, i, l; 26001 26002 visited[name] = true; 26003 required = this.required; 26004 moduleInfo = this.moduleInfo[name]; 26005 condition = this.conditions[name] || {}; 26006 26007 if (moduleInfo) { 26008 // Recurse on each dependency of this module, 26009 // figuring out its dependencies, and so on. 26010 dependencies = moduleInfo.expanded || moduleInfo.requires; 26011 26012 for (i = 0, l = dependencies.length; i < l; ++i) { 26013 dependency = dependencies[i]; 26014 trigger = condition[dependency]; 26015 26016 // We cannot process this dependency yet if it must 26017 // appear after our current module. 26018 isAfter = trigger && (!trigger.when || trigger.when === "after"); 26019 26020 // Is this module name in the required list of modules, 26021 // and have we not already visited it? 26022 if (required[dependency] && !visited[dependency] && !isAfter) { 26023 this._visit(dependency, visited); 26024 } 26025 } 26026 } 26027 26028 this.sorted.push(name); 26029 }, 26030 26031 /** 26032 * Handles the actual insertion of script/link tags 26033 * @method _insert 26034 * @private 26035 * @param {Object} source The YUI instance the request came from 26036 * @param {Object} o The metadata to include 26037 * @param {String} type JS or CSS 26038 * @param {Boolean} [skipcalc=false] Do a Loader.calculate on the meta 26039 */ 26040 _insert: function(source, o, type, skipcalc) { 26041 26042 26043 // restore the state at the time of the request 26044 if (source) { 26045 this._config(source); 26046 } 26047 26048 // build the dependency list 26049 // don't include type so we can process CSS and script in 26050 // one pass when the type is not specified. 26051 26052 var modules = this.resolve(!skipcalc),
26053 self = this, comp = 0, actions = 0, 26054 mods = {}, deps, complete; 26055 26056 self._refetch = []; 26057 26058 if (type) { 26059 //Filter out the opposite type and reset the array so the checks later work 26060 modules[((type === JS) ? CSS : JS)] = []; 26061 } 26062 if (!self.fetchCSS) { 26063 modules.css = []; 26064 } 26065 if (modules.js.length) { 26066 comp++; 26067 } 26068 if (modules.css.length) { 26069 comp++; 26070 } 26071 26072 //console.log('Resolved Modules: ', modules); 26073 26074 complete = function(d) { 26075 actions++; 26076 var errs = {}, i = 0, o = 0, u = '', fn, 26077 modName, resMods; 26078 26079 if (d && d.errors) { 26080 for (i = 0; i < d.errors.length; i++) { 26081 if (d.errors[i].request) { 26082 u = d.errors[i].request.url; 26083 } else { 26084 u = d.errors[i]; 26085 } 26086 errs[u] = u; 26087 } 26088 } 26089 26090 if (d && d.data && d.data.length && (d.type === 'success')) { 26091 for (i = 0; i < d.data.length; i++) { 26092 self.inserted[d.data[i].name] = true; 26093 //If the external module has a skin or a lang, reprocess it 26094 if (d.data[i].lang || d.data[i].skinnable) { 26095 delete self.inserted[d.data[i].name]; 26096 self._refetch.push(d.data[i].name); 26097 } 26098 } 26099 } 26100 26101 if (actions === comp) { 26102 self._loading = null; 26103 if (self._refetch.length) { 26104 //Get the deps for the new meta-data and reprocess 26105 for (i = 0; i < self._refetch.length; i++) { 26106 deps = self.getRequires(self.getModule(self._refetch[i])); 26107 for (o = 0; o < deps.length; o++) { 26108 if (!self.inserted[deps[o]]) { 26109 //We wouldn't be to this point without the module being here 26110 mods[deps[o]] = deps[o]; 26111 } 26112 } 26113 } 26114 mods = Y.Object.keys(mods); 26115 if (mods.length) { 26116 self.require(mods); 26117 resMods = self.resolve(true);
26118 if (resMods.cssMods.length) { 26119 for (i=0; i < resMods.cssMods.length; i++) { 26120 modName = resMods.cssMods[i].name; 26121 delete YUI.Env._cssLoaded[modName]; 26122 if (self.isCSSLoaded(modName)) { 26123 self.inserted[modName] = true; 26124 delete self.required[modName]; 26125 } 26126 } 26127 self.sorted = []; 26128 self._sort(); 26129 } 26130 d = null; //bail 26131 self._insert(); //insert the new deps 26132 } 26133 } 26134 if (d && d.fn) { 26135 fn = d.fn; 26136 delete d.fn; 26137 fn.call(self, d); 26138 } 26139 } 26140 }; 26141 26142 this._loading = true; 26143 26144 if (!modules.js.length && !modules.css.length) { 26145 actions = -1; 26146 complete({ 26147 fn: self._onSuccess 26148 }); 26149 return; 26150 } 26151 26152 26153 if (modules.css.length) { //Load CSS first 26154 Y.Get.css(modules.css, { 26155 data: modules.cssMods, 26156 attributes: self.cssAttributes, 26157 insertBefore: self.insertBefore, 26158 charset: self.charset, 26159 timeout: self.timeout, 26160 context: self, 26161 onProgress: function(e) { 26162 self._onProgress.call(self, e); 26163 }, 26164 onTimeout: function(d) { 26165 self._onTimeout.call(self, d); 26166 }, 26167 onSuccess: function(d) { 26168 d.type = 'success'; 26169 d.fn = self._onSuccess; 26170 complete.call(self, d); 26171 }, 26172 onFailure: function(d) { 26173 d.type = 'failure'; 26174 d.fn = self._onFailure; 26175 complete.call(self, d); 26176 } 26177 }); 26178 } 26179 26180 if (modules.js.length) { 26181 Y.Get.js(modules.js, { 26182 data: modules.jsMods, 26183 insertBefore: self.insertBefore, 26184 attributes: self.jsAttributes, 26185 charset: self.charset, 26186 timeout: self.timeout, 26187 autopurge: false, 26188 context: self, 26189 async: self.async, 26190 onProgress: function(e) { 26191 self._onProgress.call(self, e); 26192 }, 26193 onTimeout: function(d) { 26194 self._onTimeout.call(self, d); 26195 }, 26196 onSuccess: function(d) { 26197 d.type = 'success'; 26198 d.fn = self._onSuccess; 26199 complete.call(self, d); 26200 }, 26201 onFailure: function(d) { 26202 d.type = 'failure'; 26203 d.fn = self._onFailure; 26204 complete.call(self, d); 26205 } 26206 }); 26207 } 26208 }, 26209 /** 26210 * Once a loader operation is completely finished, process any additional queued items. 26211 * @method _continue 26212 * @private 26213 */ 26214 _continue: function() { 26215 if (!(_queue.running) && _queue.size() > 0) { 26216 _queue.running = true; 26217 _queue.next()(); 26218 } 26219 }, 26220 26221 /** 26222 * inserts the requested modules and their dependencies. 26223 * <code>type</code> can be "js" or "css". Both script and 26224 * css are inserted if type is not provided. 26225 * @method insert 26226 * @param {object} o optional options object. 26227 * @param {string} type the type of dependency to insert. 26228 */ 26229 insert: function(o, type, skipsort) { 26230 var self = this, copy = Y.merge(this); 26231 delete copy.require; 26232 delete copy.dirty; 26233 _queue.add(function() { 26234 self._insert(copy, o, type, skipsort); 26235 }); 26236 this._continue(); 26237 }, 26238 26239 /** 26240 * Executed every time a module is loaded, and if we are in a load 26241 * cycle, we attempt to load the next script. Public so that it 26242 * is possible to call this if using a method other than 26243 * Y.register to determine when scripts are fully loaded 26244 * @method loadNext 26245 * @deprecated 26246 * @param {string} mname optional the name of the module that has 26247 * been loaded (which is usually why it is time to load the next 26248 * one). 26249 */ 26250 loadNext: function() { 26251 return; 26252 }, 26253 26254 /** 26255 * Apply filter defined for this instance to a url/path 26256 * @method _filter 26257 * @param {string} u the string to filter. 26258 * @param {string} name the name of the module, if we are processing 26259 * a single module as opposed to a combined url. 26260 * @return {string} the filtered string. 26261 * @private 26262 */ 26263 _filter: function(u, name, group) { 26264 var f = this.filter, 26265 hasFilter = name && (name in this.filters), 26266 modFilter = hasFilter && this.filters[name], 26267 groupName = group || (this.getModuleInfo(name) || {}).group || null; 26268 26269 if (groupName && this.groups[groupName] && this.groups[groupName].filter) { 26270 modFilter = this.groups[groupName].filter; 26271 hasFilter = true; 26272 } 26273 26274 if (u) { 26275 if (hasFilter) { 26276 f = (L.isString(modFilter)) ? this.FILTER_DEFS[modFilter.toUpperCase()] || null : modFilter; 26277 } 26278 if (f) { 26279 u = u.replace(new RegExp(f.searchExp, 'g'), f.replaceStr); 26280 } 26281 } 26282 return u; 26283 }, 26284 26285 /** 26286 * Generates the full url for a module 26287 * @method _url 26288 * @param {string} path the path fragment. 26289 * @param {String} name The name of the module 26290 * @param {String} [base] The base url to use. Defaults to self.base 26291 * @return {string} the full url. 26292 * @private 26293 */ 26294 _url: function(path, name, base) { 26295 return this._filter((base || this.base || '') + path, name); 26296 }, 26297 /** 26298 * Returns an Object hash of file arrays built from `loader.sorted` or from an arbitrary list of sorted modules. 26299 * @method resolve 26300 * @param {Boolean} [calc=false] Perform a loader.calculate() before anything else 26301 * @param {Array} [sorted=loader.sorted] An override for the loader.sorted array 26302 * @return {Object} Object hash (js and css) of two arrays of file lists 26303 * @example This method can be used as an off-line dep calculator 26304 * 26305 * var Y = YUI(); 26306 * var loader = new Y.Loader({ 26307 * filter: 'debug', 26308 * base: '../../', 26309 * root: 'build/', 26310 * combine: true, 26311 * require: ['node', 'dd', 'console'] 26312 * }); 26313 * var out = loader.resolve(true); 26314 * 26315 */ 26316 resolve: function(calc, sorted) { 26317 var self = this, 26318 resolved = { js: [], jsMods: [], css: [], cssMods: [] }, 26319 addSingle, 26320 usePathogen = Y.config.comboLoader && Y.config.customComboBase; 26321 26322 if (self.skin.overrides || self.skin.defaultSkin !== DEFAULT_SKIN || self.ignoreRegistered) { 26323 self._resetModules(); 26324 } 26325 26326 if (calc) { 26327 self.calculate(); 26328 } 26329 sorted = sorted || self.sorted; 26330 26331 addSingle = function(mod) { 26332 if (mod) { 26333 var group = (mod.group && self.groups[mod.group]) || NOT_FOUND, 26334 url; 26335 26336 //Always assume it's async 26337 if (group.async === false) { 26338 mod.async = group.async; 26339 } 26340 26341 url = (mod.fullpath) ? self._filter(mod.fullpath, mod.name) : 26342 self._url(mod.path, mod.name, group.base || mod.base); 26343 26344 if (mod.attributes || mod.async === false) { 26345 url = { 26346 url: url, 26347 async: mod.async 26348 }; 26349 if (mod.attributes) { 26350 url.attributes = mod.attributes; 26351 } 26352 } 26353 resolved[mod.type].push(url); 26354 resolved[mod.type + 'Mods'].push(mod); 26355 } else { 26356 } 26357 26358 }; 26359 26360 /*jslint vars: true */ 26361 var inserted = (self.ignoreRegistered) ? {}
26361 : self.inserted, 26362 comboSources, 26363 maxURLLength, 26364 comboMeta, 26365 comboBase, 26366 comboSep, 26367 group, 26368 mod, 26369 len, 26370 i, 26371 hasComboModule = false; 26372 26373 /*jslint vars: false */ 26374 26375 for (i = 0, len = sorted.length; i < len; i++) { 26376 mod = self.getModule(sorted[i]); 26377 if (!mod || inserted[mod.name]) { 26378 continue; 26379 } 26380 26381 group = self.groups[mod.group]; 26382 26383 comboBase = self.comboBase; 26384 26385 if (group) { 26386 if (!group.combine || mod.fullpath) { 26387 //This is not a combo module, skip it and load it singly later. 26388 addSingle(mod); 26389 continue; 26390 } 26391 mod.combine = true; 26392 26393 if (typeof group.root === 'string') { 26394 mod.root = group.root; 26395 } 26396 26397 comboBase = group.comboBase || comboBase; 26398 comboSep = group.comboSep; 26399 maxURLLength = group.maxURLLength; 26400 } else { 26401 if (!self.combine) { 26402 //This is not a combo module, skip it and load it singly later. 26403 addSingle(mod); 26404 continue; 26405 } 26406 } 26407 26408 if (!mod.combine && mod.ext) { 26409 addSingle(mod); 26410 continue; 26411 } 26412 hasComboModule = true; 26413 comboSources = comboSources || {}; 26414 comboSources[comboBase] = comboSources[comboBase] || 26415 { js: [], jsMods: [], css: [], cssMods: [] }; 26416 26417 comboMeta = comboSources[comboBase]; 26418 comboMeta.group = mod.group; 26419 comboMeta.comboSep = comboSep || self.comboSep; 26420 comboMeta.maxURLLength = maxURLLength || self.maxURLLength; 26421 26422 comboMeta[mod.type + 'Mods'].push(mod); 26423 if (mod.type === JS || mod.type === CSS) { 26424 resolved[mod.type + 'Mods'].push(mod); 26425 } 26426 } 26427 //only encode if we have something to encode 26428 if (hasComboModule) { 26429 if (usePathogen) { 26430 resolved = this._pathogenEncodeComboSources(resolved); 26431 } else { 26432 resolved = this._encodeComboSources(resolved, comboSources); 26433 } 26434 } 26435 return resolved; 26436 }, 26437 26438 /** 26439 * Encodes combo sources and appends them to an object hash of arrays from `loader.resolve`. 26440 * 26441 * @method _encodeComboSources 26442 * @param {Object} resolved The object hash of arrays in which to attach the encoded combo sources. 26443 * @param {Object} comboSources An object containing relevant data about modules. 26444 * @return Object 26445 * @private 26446 */ 26447 _encodeComboSources: function(resolved, comboSources) { 26448 var fragSubset, 26449 modules, 26450 tmpBase, 26451 baseLen, 26452 frags, 26453 frag, 26454 type, 26455 mod, 26456 maxURLLength, 26457 comboBase, 26458 comboMeta, 26459 comboSep, 26460 i, 26461 len, 26462 self = this; 26463 26464 for (comboBase in comboSources) { 26465 if (comboSources.hasOwnProperty(comboBase)) { 26466 comboMeta = comboSources[comboBase]; 26467 comboSep = comboMeta.comboSep; 26468 maxURLLength = comboMeta.maxURLLength; 26469 for (type in comboMeta) { 26470 if (type === JS || type === CSS) { 26471 modules = comboMeta[type + 'Mods']; 26472 frags = []; 26473 for (i = 0, len = modules.length; i < len; i += 1) { 26474 mod = modules[i]; 26475 frag = ((typeof mod.root === 'string') ? mod.root : self.root) + (mod.path || mod.fullpath); 26476 frags.push( 26477 self._filter(frag, mod.name) 26478 ); 26479 } 26480 tmpBase = comboBase + frags.join(comboSep); 26481 baseLen = tmpBase.length; 26482 if (maxURLLength <= comboBase.length) { 26483 maxURLLength = MAX_URL_LENGTH; 26484 } 26485 26486 if (frags.length) { 26487 if (baseLen > maxURLLength) { 26488 fragSubset = []; 26489 for (i = 0, len = frags.length; i < len; i++) { 26490 fragSubset.push(frags[i]); 26491 tmpBase = comboBase + fragSubset.join(comboSep); 26492 26493 if (tmpBase.length > maxURLLength) { 26494 frag = fragSubset.pop(); 26495 tmpBase = comboBase + fragSubset.join(comboSep); 26496 resolved[type].push(self._filter(tmpBase, null, comboMeta.group)); 26497 fragSubset = []; 26498 if (frag) { 26499 fragSubset.push(frag); 26500 } 26501 } 26502 } 26503 if (fragSubset.length) { 26504 tmpBase = comboBase + fragSubset.join(comboSep); 26505 resolved[type].push(self._filter(tmpBase, null, comboMeta.group)); 26506 } 26507 } else { 26508 resolved[type].push(self._filter(tmpBase, null, comboMeta.group)); 26509 } 26510 } 26511 } 26512 } 26513 } 26514 } 26515 return resolved; 26516 }, 26517 26518 /** 26519 Shortcut to calculate, resolve and load all modules. 26520 26521 var loader = new Y.Loader({ 26522 ignoreRegistered: true, 26523 modules: { 26524 mod: { 26525 path: 'mod.js' 26526 } 26527 }, 26528 requires: [ 'mod' ] 26529 }); 26530 loader.load(function() { 26531 console.log('All modules have loaded..'); 26532 }); 26533 26534 26535 @method load 26536 @param {Function} cb Executed after all load operations are complete 26537 */ 26538 load: function(cb) { 26539 if (!cb) { 26540 return; 26541 } 26542 var self = this, 26543 out = self.resolve(true); 26544 26545 self.data = out; 26546 26547 self.onEnd = function() { 26548 cb.apply(self.context || self, arguments); 26549 }; 26550 26551 self.insert(); 26552 } 26553}; 26554 26555 26556}, 'patched-v3.18.1', {"requires": ["get", "features"]}); 26557YUI.add('loader-rollup', function (Y, NAME) { 26558 26559/** 26560 * Optional automatic rollup logic for reducing http connections 26561 * when not using a combo service. 26562 * @module loader 26563 * @submodule rollup 26564 */ 26565 26566/** 26567 * Look for rollup packages to determine if all of the modules a 26568 * rollup supersedes are required. If so, include the rollup to 26569 * help reduce the total number of connections required. Called 26570 * by calculate(). This is an optional feature, and requires the 26571 * appropriate submodule to function. 26572 * @method _rollup 26573 * @for Loader 26574 * @private 26575 */ 26576Y.Loader.prototype._rollup = function() { 26577 var i, j, m, s, r = this.required, roll, 26578 info = this.moduleInfo, rolled, c, smod; 26579 26580 // find and cache rollup modules 26581 if (this.dirty || !this.rollups) { 26582 this.rollups = {}; 26583 for (i in info) { 26584 if (info.hasOwnProperty(i)) { 26585 m = this.getModule(i); 26586 // if (m && m.rollup && m.supersedes) { 26587 if (m && m.rollup) { 26588 this.rollups[i] = m; 26589 } 26590 } 26591 } 26592 } 26593 26594 // make as many passes as needed to pick up rollup rollups 26595 for (;;) { 26596 rolled = false;
26597 26598 // go through the rollup candidates 26599 for (i in this.rollups) { 26600 if (this.rollups.hasOwnProperty(i)) { 26601 // there can be only one, unless forced 26602 if (!r[i] && ((!this.loaded[i]) || this.forceMap[i])) { 26603 m = this.getModule(i); 26604 s = m.supersedes || []; 26605 roll = false; 26606 26607 // @TODO remove continue 26608 if (!m.rollup) { 26609 continue; 26610 } 26611 26612 c = 0; 26613 26614 // check the threshold 26615 for (j = 0; j < s.length; j++) { 26616 smod = info[s[j]]; 26617 26618 // if the superseded module is loaded, we can't 26619 // load the rollup unless it has been forced. 26620 if (this.loaded[s[j]] && !this.forceMap[s[j]]) { 26621 roll = false; 26622 break; 26623 // increment the counter if this module is required. 26624 // if we are beyond the rollup threshold, we will 26625 // use the rollup module 26626 } else if (r[s[j]] && m.type === smod.type) { 26627 c++; 26628 roll = (c >= m.rollup); 26629 if (roll) { 26630 break; 26631 } 26632 } 26633 } 26634 26635 if (roll) { 26636 // add the rollup 26637 r[i] = true; 26638 rolled = true; 26639 26640 // expand the rollup's dependencies 26641 this.getRequires(m); 26642 } 26643 } 26644 } 26645 } 26646 26647 // if we made it here w/o rolling up something, we are done 26648 if (!rolled) { 26649 break; 26650 } 26651 } 26652}; 26653 26654 26655}, 'patched-v3.18.1', {"requires": ["loader-base"]}); 26656YUI.add('loader-yui3', function (Y, NAME) { 26657 26658/* This file is auto-generated by (yogi loader --yes --mix --start ../) */ 26659 26660/*jshint maxlen:900, eqeqeq: false */ 26661 26662/** 26663 * YUI 3 module metadata 26664 * @module loader 26665 * @submodule loader-yui3 26666 */ 26667YUI.Env[Y.version].modules = YUI.Env[Y.version].modules || {}; 26668Y.mix(YUI.Env[Y.version].modules, { 26669 "align-plugin": { 26670 "requires": [ 26671 "node-screen", 26672 "node-pluginhost" 26673 ] 26674 }, 26675 "anim": { 26676 "use": [ 26677 "anim-base", 26678 "anim-color", 26679 "anim-curve", 26680 "anim-easing", 26681 "anim-node-plugin", 26682 "anim-scroll", 26683 "anim-xy" 26684 ] 26685 }, 26686 "anim-base": { 26687 "requires": [ 26688 "base-base", 26689 "node-style", 26690 "color-base" 26691 ] 26692 }, 26693 "anim-color": { 26694 "requires": [ 26695 "anim-base" 26696 ] 26697 }, 26698 "anim-curve": { 26699 "requires": [ 26700 "anim-xy" 26701 ] 26702 }, 26703 "anim-easing": { 26704 "requires": [ 26705 "anim-base" 26706 ] 26707 }, 26708 "anim-node-plugin": { 26709 "requires": [ 26710 "node-pluginhost", 26711 "anim-base" 26712 ] 26713 }, 26714 "anim-scroll": { 26715 "requires": [ 26716 "anim-base" 26717 ] 26718 }, 26719 "anim-shape": { 26720 "requires": [ 26721 "anim-base", 26722 "anim-easing", 26723 "anim-color", 26724 "matrix" 26725 ] 26726 }, 26727 "anim-shape-transform": { 26728 "use": [ 26729 "anim-shape" 26730 ] 26731 }, 26732 "anim-xy": { 26733 "requires": [ 26734 "anim-base", 26735 "node-screen" 26736 ] 26737 }, 26738 "app": { 26739 "use": [ 26740 "app-base", 26741 "app-content", 26742 "app-transitions", 26743 "lazy-model-list", 26744 "model", 26745 "model-list", 26746 "model-sync-rest", 26747 "model-sync-local", 26748 "router", 26749 "view", 26750 "view-node-map" 26751 ] 26752 }, 26753 "app-base": { 26754 "requires": [ 26755 "classnamemanager", 26756 "pjax-base", 26757 "router", 26758 "view" 26759 ] 26760 }, 26761 "app-content": { 26762 "requires": [ 26763 "app-base", 26764 "pjax-content" 26765 ] 26766 }, 26767 "app-transitions": { 26768 "requires": [ 26769 "app-base" 26770 ] 26771 }, 26772 "app-transitions-css": { 26773 "type": "css" 26774 }, 26775 "app-transitions-native": { 26776 "condition": { 26777 "name": "app-transitions-native", 26778 "test": function (Y) { 26779 var doc = Y.config.doc, 26780 node = doc ? doc.documentElement : null; 26781 26782 if (node && node.style) { 26783 return ('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); 26784 } 26785 26786 return false;
26787}, 26788 "trigger": "app-transitions" 26789 }, 26790 "requires": [ 26791 "app-transitions", 26792 "app-transitions-css", 26793 "parallel", 26794 "transition" 26795 ] 26796 }, 26797 "array-extras": { 26798 "requires": [ 26799 "yui-base" 26800 ] 26801 }, 26802 "array-invoke": { 26803 "requires": [ 26804 "yui-base" 26805 ] 26806 }, 26807 "arraylist": { 26808 "requires": [ 26809 "yui-base" 26810 ] 26811 }, 26812 "arraylist-add": { 26813 "requires": [ 26814 "arraylist" 26815 ] 26816 }, 26817 "arraylist-filter": { 26818 "requires": [ 26819 "arraylist" 26820 ] 26821 }, 26822 "arraysort": { 26823 "requires": [ 26824 "yui-base" 26825 ] 26826 }, 26827 "async-queue": { 26828 "requires": [ 26829 "event-custom" 26830 ] 26831 }, 26832 "attribute": { 26833 "use": [ 26834 "attribute-base", 26835 "attribute-complex" 26836 ] 26837 }, 26838 "attribute-base": { 26839 "requires": [ 26840 "attribute-core", 26841 "attribute-observable", 26842 "attribute-extras" 26843 ] 26844 }, 26845 "attribute-complex": { 26846 "requires": [ 26847 "attribute-base" 26848 ] 26849 }, 26850 "attribute-core": { 26851 "requires": [ 26852 "oop" 26853 ] 26854 }, 26855 "attribute-events": { 26856 "use": [ 26857 "attribute-observable" 26858 ] 26859 }, 26860 "attribute-extras": { 26861 "requires": [ 26862 "oop" 26863 ] 26864 }, 26865 "attribute-observable": { 26866 "requires": [ 26867 "event-custom" 26868 ] 26869 }, 26870 "autocomplete": { 26871 "use": [ 26872 "autocomplete-base", 26873 "autocomplete-sources", 26874 "autocomplete-list", 26875 "autocomplete-plugin" 26876 ] 26877 }, 26878 "autocomplete-base": { 26879 "optional": [ 26880 "autocomplete-sources" 26881 ], 26882 "requires": [ 26883 "array-extras", 26884 "base-build", 26885 "escape", 26886 "event-valuechange", 26887 "node-base" 26888 ] 26889 }, 26890 "autocomplete-filters": { 26891 "requires": [ 26892 "array-extras", 26893 "text-wordbreak" 26894 ] 26895 }, 26896 "autocomplete-filters-accentfold": { 26897 "requires": [ 26898 "array-extras", 26899 "text-accentfold", 26900 "text-wordbreak" 26901 ] 26902 }, 26903 "autocomplete-highlighters": { 26904 "requires": [ 26905 "array-extras", 26906 "highlight-base" 26907 ] 26908 }, 26909 "autocomplete-highlighters-accentfold": { 26910 "requires": [ 26911 "array-extras", 26912 "highlight-accentfold" 26913 ] 26914 }, 26915 "autocomplete-list": { 26916 "after": [ 26917 "autocomplete-sources" 26918 ], 26919 "lang": [ 26920 "en", 26921 "es", 26922 "hu", 26923 "it" 26924 ], 26925 "requires": [ 26926 "autocomplete-base", 26927 "event-resize", 26928 "node-screen", 26929 "selector-css3", 26930 "shim-plugin", 26931 "widget", 26932 "widget-position", 26933 "widget-position-align" 26934 ], 26935 "skinnable": true 26936 }, 26937 "autocomplete-list-keys": { 26938 "condition": { 26939 "name": "autocomplete-list-keys", 26940 "test": function (Y) { 26941 // Only add keyboard support to autocomplete-list if this doesn't appear to 26942 // be an iOS or Android-based mobile device. 26943 // 26944 // There's currently no feasible way to actually detect whether a device has 26945 // a hardware keyboard, so this sniff will have to do. It can easily be 26946 // overridden by manually loading the autocomplete-list-keys module. 26947 // 26948 // Worth noting: even though iOS supports bluetooth keyboards, Mobile Safari 26949 // doesn't fire the keyboard events used by AutoCompleteList, so there's 26950 // no point loading the -keys module even when a bluetooth keyboard may be 26951 // available. 26952 return !(Y.UA.ios || Y.UA.android); 26953}, 26954 "trigger": "autocomplete-list" 26955 }, 26956 "requires": [ 26957 "autocomplete-list", 26958 "base-build" 26959 ] 26960 }, 26961 "autocomplete-plugin": { 26962 "requires": [ 26963 "autocomplete-list", 26964 "node-pluginhost" 26965 ] 26966 }, 26967 "autocomplete-sources": { 26968 "optional": [ 26969 "io-base", 26970 "json-parse", 26971 "jsonp", 26972 "yql" 26973 ], 26974 "requires": [ 26975 "autocomplete-base" 26976 ] 26977 }, 26978 "axes": { 26979 "use": [ 26980 "axis-numeric", 26981 "axis-category", 26982 "axis-time", 26983 "axis-stacked" 26984 ] 26985 }, 26986 "axes-base": { 26987 "use": [ 26988 "axis-numeric-base", 26989 "axis-category-base", 26990 "axis-time-base", 26991 "axis-stacked-base" 26992 ] 26993 }, 26994 "axis": { 26995 "requires": [ 26996 "dom", 26997 "widget", 26998 "widget-position", 26999 "widget-stack", 27000 "graphics", 27001 "axis-base" 27002 ] 27003 }, 27004 "axis-base": { 27005 "requires": [ 27006 "classnamemanager", 27007 "datatype-number", 27008 "datatype-date", 27009 "base", 27010 "event-custom" 27011 ] 27012 }, 27013 "axis-category": { 27014 "requires": [ 27015 "axis", 27016 "axis-category-base" 27017 ] 27018 }, 27019 "axis-category-base": { 27020 "requires": [ 27021 "axis-base" 27022 ] 27023 }, 27024 "axis-numeric": { 27025 "requires": [ 27026 "axis", 27027 "axis-numeric-base" 27028 ] 27029 }, 27030 "axis-numeric-base": { 27031 "requires": [ 27032 "axis-base" 27033 ] 27034 }, 27035 "axis-stacked": { 27036 "requires": [ 27037 "axis-numeric", 27038 "axis-stacked-base" 27039 ] 27040 }, 27041 "axis-stacked-base": { 27042 "requires": [ 27043 "axis-numeric-base" 27044 ] 27045 }, 27046 "axis-time": { 27047 "requires": [ 27048 "axis", 27049 "axis-time-base" 27050 ] 27051 }, 27052 "axis-time-base": { 27053 "requires": [ 27054 "axis-base" 27055 ] 27056 }, 27057 "base": { 27058 "use": [ 27059 "base-base", 27060 "base-pluginhost", 27061 "base-build" 27062 ] 27063 }, 27064 "base-base": { 27065 "requires": [ 27066 "attribute-base", 27067 "base-core", 27068 "base-observable" 27069 ] 27070 }, 27071 "base-build": { 27072 "requires": [ 27073 "base-base" 27074 ] 27075 }, 27076 "base-core": { 27077 "requires": [ 27078 "attribute-core" 27079 ] 27080 }, 27081 "base-observable": { 27082 "requires": [ 27083 "attribute-observable", 27084 "base-core" 27085 ] 27086 }, 27087 "base-pluginhost": { 27088 "requires": [ 27089 "base-base", 27090 "pluginhost" 27091 ] 27092 }, 27093 "button": { 27094 "requires": [ 27095 "button-core", 27096 "cssbutton", 27097 "widget" 27098 ] 27099 }, 27100 "button-core": { 27101 "requires": [ 27102 "attribute-core", 27103 "classnamemanager", 27104 "node-base", 27105 "escape" 27106 ] 27107 }, 27108 "button-group": { 27109 "requires": [ 27110 "button-plugin", 27111 "cssbutton", 27112 "widget" 27113 ] 27114 }, 27115 "button-plugin": { 27116 "requires": [ 27117 "button-core", 27118 "cssbutton", 27119 "node-pluginhost" 27120 ] 27121 }, 27122 "cache": { 27123 "use": [ 27124 "cache-base", 27125 "cache-offline", 27126 "cache-plugin" 27127 ] 27128 }, 27129 "cache-base": { 27130 "requires": [ 27131 "base" 27132 ] 27133 }, 27134 "cache-offline": { 27135 "requires": [ 27136 "cache-base", 27137 "json" 27138 ] 27139 }, 27140 "cache-plugin": { 27141 "requires": [ 27142 "plugin", 27143 "cache-base" 27144 ] 27145 }, 27146 "calendar": { 27147 "requires": [ 27148 "calendar-base", 27149 "calendarnavigator" 27150 ], 27151 "skinnable": true 27152 }, 27153 "calendar-base": { 27154 "lang": [ 27155 "ca", 27156 "ca-ES", 27157 "de", 27158 "en", 27159 "es", 27160 "es-AR", 27161 "eu-ES", 27162 "fr", 27163 "hu", 27164 "it", 27165 "ja", 27166 "nb-NO", 27167 "nl", 27168 "pt-BR", 27169 "ru", 27170 "zh-Hans", 27171 "zh-Hans-CN", 27172 "zh-Hant", 27173 "zh-Hant-HK", 27174 "zh-HANT-TW" 27175 ], 27176 "requires": [ 27177 "widget", 27178 "datatype-date", 27179 "datatype-date-math", 27180 "cssgrids" 27181 ], 27182 "skinnable": true 27183 }, 27184 "calendarnavigator": { 27185 "requires": [ 27186 "plugin", 27187 "classnamemanager", 27188 "datatype-date", 27189 "node" 27190 ], 27191 "skinnable": true 27192 }, 27193 "charts": { 27194 "use": [ 27195 "charts-base" 27196 ] 27197 }, 27198 "charts-base": { 27199 "requires": [ 27200 "dom", 27201 "event-mouseenter", 27202 "event-touch", 27203 "graphics-group", 27204 "axes", 27205 "series-pie", 27206 "series-line", 27207 "series-marker", 27208 "series-area", 27209 "series-spline", 27210 "series-column", 27211 "series-bar", 27212 "series-areaspline", 27213 "series-combo", 27214 "series-combospline", 27215 "series-line-stacked", 27216 "series-marker-stacked", 27217 "series-area-stacked", 27218 "series-spline-stacked", 27219 "series-column-stacked", 27220 "series-bar-stacked", 27221 "series-areaspline-stacked", 27222 "series-combo-stacked", 27223 "series-combospline-stacked" 27224 ] 27225 }, 27226 "charts-legend": { 27227 "requires": [ 27228 "charts-base" 27229 ] 27230 }, 27231 "classnamemanager": { 27232 "requires": [ 27233 "yui-base" 27234 ] 27235 }, 27236 "clickable-rail": { 27237 "requires": [ 27238 "slider-base" 27239 ] 27240 }, 27241 "collection": { 27242 "use": [ 27243 "array-extras", 27244 "arraylist", 27245 "arraylist-add", 27246 "arraylist-filter", 27247 "array-invoke" 27248 ] 27249 }, 27250 "color": { 27251 "use": [ 27252 "color-base", 27253 "color-hsl", 27254 "color-harmony" 27255 ] 27256 }, 27257 "color-base": { 27258 "requires": [ 27259 "yui-base" 27260 ] 27261 }, 27262 "color-harmony": { 27263 "requires": [ 27264 "color-hsl" 27265 ] 27266 }, 27267 "color-hsl": { 27268 "requires": [ 27269 "color-base" 27270 ] 27271 }, 27272 "color-hsv": { 27273 "requires": [ 27274 "color-base" 27275 ] 27276 }, 27277 "console": { 27278 "lang": [ 27279 "en", 27280 "es", 27281 "hu", 27282 "it", 27283 "ja" 27284 ], 27285 "requires": [ 27286 "yui-log", 27287 "widget" 27288 ], 27289 "skinnable": true 27290 }, 27291 "console-filters": { 27292 "requires": [ 27293 "plugin", 27294 "console" 27295 ], 27296 "skinnable": true 27297 }, 27298 "content-editable": { 27299 "requires": [ 27300 "node-base", 27301 "editor-selection", 27302 "stylesheet", 27303 "plugin" 27304 ] 27305 }, 27306 "controller": { 27307 "use": [ 27308 "router" 27309 ] 27310 }, 27311 "cookie": { 27312 "requires": [ 27313 "yui-base" 27314 ] 27315 }, 27316 "createlink-base": { 27317 "requires": [ 27318 "editor-base" 27319 ] 27320 }, 27321 "cssbase": { 27322 "after": [ 27323 "cssreset", 27324 "cssfonts", 27325 "cssgrids", 27326 "cssreset-context", 27327 "cssfonts-context", 27328 "cssgrids-context" 27329 ], 27330 "type": "css" 27331 }, 27332 "cssbase-context": { 27333 "after": [ 27334 "cssreset", 27335 "cssfonts", 27336 "cssgrids", 27337 "cssreset-context", 27338 "cssfonts-context", 27339 "cssgrids-context" 27340 ], 27341 "type": "css" 27342 }, 27343 "cssbutton": { 27344 "type": "css" 27345 }, 27346 "cssfonts": { 27347 "type": "css" 27348 }, 27349 "cssfonts-context": { 27350 "type": "css" 27351 }, 27352 "cssgrids": { 27353 "optional": [ 27354 "cssnormalize" 27355 ], 27356 "type": "css" 27357 }, 27358 "cssgrids-base": { 27359 "optional": [ 27360 "cssnormalize" 27361 ], 27362 "type": "css" 27363 }, 27364 "cssgrids-responsive": { 27365 "optional": [ 27366 "cssnormalize" 27367 ], 27368 "requires": [ 27369 "cssgrids", 27370 "cssgrids-responsive-base" 27371 ], 27372 "type": "css" 27373 }, 27374 "cssgrids-units": { 27375 "optional": [ 27376 "cssnormalize" 27377 ], 27378 "requires": [ 27379 "cssgrids-base" 27380 ], 27381 "type": "css" 27382 }, 27383 "cssnormalize": { 27384 "type": "css" 27385 }, 27386 "cssnormalize-context": { 27387 "type": "css" 27388 }, 27389 "cssreset": { 27390 "type": "css" 27391 }, 27392 "cssreset-context": { 27393 "type": "css" 27394 }, 27395 "dataschema": { 27396 "use": [ 27397 "dataschema-base", 27398 "dataschema-json", 27399 "dataschema-xml", 27400 "dataschema-array", 27401 "dataschema-text" 27402 ] 27403 }, 27404 "dataschema-array": { 27405 "requires": [ 27406 "dataschema-base" 27407 ] 27408 }, 27409 "dataschema-base": { 27410 "requires": [ 27411 "base" 27412 ] 27413 }, 27414 "dataschema-json": { 27415 "requires": [ 27416 "dataschema-base", 27417 "json" 27418 ] 27419 }, 27420 "dataschema-text": { 27421 "requires": [ 27422 "dataschema-base" 27423 ] 27424 }, 27425 "dataschema-xml": { 27426 "requires": [ 27427 "dataschema-base" 27428 ] 27429 }, 27430 "datasource": { 27431 "use": [ 27432 "datasource-local", 27433 "datasource-io", 27434 "datasource-get", 27435 "datasource-function", 27436 "datasource-cache", 27437 "datasource-jsonschema", 27438 "datasource-xmlschema", 27439 "datasource-arrayschema", 27440 "datasource-textschema", 27441 "datasource-polling" 27442 ] 27443 }, 27444 "datasource-arrayschema": { 27445 "requires": [ 27446 "datasource-local", 27447 "plugin", 27448 "dataschema-array" 27449 ] 27450 }, 27451 "datasource-cache": { 27452 "requires": [ 27453 "datasource-local", 27454 "plugin", 27455 "cache-base" 27456 ] 27457 }, 27458 "datasource-function": { 27459 "requires": [ 27460 "datasource-local" 27461 ] 27462 }, 27463 "datasource-get": { 27464 "requires": [ 27465 "datasource-local", 27466 "get" 27467 ] 27468 }, 27469 "datasource-io": { 27470 "requires": [ 27471 "datasource-local", 27472 "io-base" 27473 ] 27474 }, 27475 "datasource-jsonschema": { 27476 "requires": [ 27477 "datasource-local", 27478 "plugin", 27479 "dataschema-json" 27480 ] 27481 }, 27482 "datasource-local": { 27483 "requires": [ 27484 "base" 27485 ] 27486 }, 27487 "datasource-polling": { 27488 "requires": [ 27489 "datasource-local" 27490 ] 27491 }, 27492 "datasource-textschema": { 27493 "requires": [ 27494 "datasource-local", 27495 "plugin", 27496 "dataschema-text" 27497 ] 27498 }, 27499 "datasource-xmlschema": { 27500 "requires": [ 27501 "datasource-local", 27502 "plugin", 27503 "datatype-xml", 27504 "dataschema-xml" 27505 ] 27506 }, 27507 "datatable": { 27508 "use": [ 27509 "datatable-core", 27510 "datatable-table", 27511 "datatable-head", 27512 "datatable-body", 27513 "datatable-base", 27514 "datatable-column-widths", 27515 "datatable-message", 27516 "datatable-mutable", 27517 "datatable-sort", 27518 "datatable-datasource" 27519 ] 27520 }, 27521 "datatable-base": { 27522 "requires": [ 27523 "datatable-core", 27524 "datatable-table", 27525 "datatable-head", 27526 "datatable-body", 27527 "base-build", 27528 "widget" 27529 ], 27530 "skinnable": true 27531 }, 27532 "datatable-body": { 27533 "requires": [ 27534 "datatable-core", 27535 "view", 27536 "classnamemanager" 27537 ] 27538 }, 27539 "datatable-column-widths": { 27540 "requires": [ 27541 "datatable-base" 27542 ] 27543 }, 27544 "datatable-core": { 27545 "requires": [ 27546 "escape", 27547 "model-list", 27548 "node-event-delegate" 27549 ] 27550 }, 27551 "datatable-datasource": { 27552 "requires": [ 27553 "datatable-base", 27554 "plugin", 27555 "datasource-local" 27556 ] 27557 }, 27558 "datatable-foot": { 27559 "requires": [ 27560 "datatable-core", 27561 "view" 27562 ] 27563 }, 27564 "datatable-formatters": { 27565 "requires": [ 27566 "datatable-body", 27567
27567 "datatype-number-format", 27568 "datatype-date-format", 27569 "escape" 27570 ] 27571 }, 27572 "datatable-head": { 27573 "requires": [ 27574 "datatable-core", 27575 "view", 27576 "classnamemanager" 27577 ] 27578 }, 27579 "datatable-highlight": { 27580 "requires": [ 27581 "datatable-base", 27582 "event-hover" 27583 ], 27584 "skinnable": true 27585 }, 27586 "datatable-keynav": { 27587 "requires": [ 27588 "datatable-base" 27589 ] 27590 }, 27591 "datatable-message": { 27592 "lang": [ 27593 "en", 27594 "fr", 27595 "es", 27596 "hu", 27597 "it" 27598 ], 27599 "requires": [ 27600 "datatable-base" 27601 ], 27602 "skinnable": true 27603 }, 27604 "datatable-mutable": { 27605 "requires": [ 27606 "datatable-base" 27607 ] 27608 }, 27609 "datatable-paginator": { 27610 "lang": [ 27611 "en", 27612 "fr" 27613 ], 27614 "requires": [ 27615 "model", 27616 "view", 27617 "paginator-core", 27618 "datatable-foot", 27619 "datatable-paginator-templates" 27620 ], 27621 "skinnable": true 27622 }, 27623 "datatable-paginator-templates": { 27624 "requires": [ 27625 "template" 27626 ] 27627 }, 27628 "datatable-scroll": { 27629 "requires": [ 27630 "datatable-base", 27631 "datatable-column-widths", 27632 "dom-screen" 27633 ], 27634 "skinnable": true 27635 }, 27636 "datatable-sort": { 27637 "lang": [ 27638 "en", 27639 "fr", 27640 "es", 27641 "hu" 27642 ], 27643 "requires": [ 27644 "datatable-base" 27645 ], 27646 "skinnable": true 27647 }, 27648 "datatable-table": { 27649 "requires": [ 27650 "datatable-core", 27651 "datatable-head", 27652 "datatable-body", 27653 "view", 27654 "classnamemanager" 27655 ] 27656 }, 27657 "datatype": { 27658 "use": [ 27659 "datatype-date", 27660 "datatype-number", 27661 "datatype-xml" 27662 ] 27663 }, 27664 "datatype-date": { 27665 "use": [ 27666 "datatype-date-parse", 27667 "datatype-date-format", 27668 "datatype-date-math" 27669 ] 27670 }, 27671 "datatype-date-format": { 27672 "lang": [ 27673 "ar", 27674 "ar-JO", 27675 "ca", 27676 "ca-ES", 27677 "da", 27678 "da-DK", 27679 "de", 27680 "de-AT", 27681 "de-DE", 27682 "el", 27683 "el-GR", 27684 "en", 27685 "en-AU", 27686 "en-CA", 27687 "en-GB", 27688 "en-IE", 27689 "en-IN", 27690 "en-JO", 27691 "en-MY", 27692 "en-NZ", 27693 "en-PH", 27694 "en-SG", 27695 "en-US", 27696 "es", 27697 "es-AR", 27698 "es-BO", 27699 "es-CL", 27700 "es-CO", 27701 "es-EC", 27702 "es-ES", 27703 "es-MX", 27704 "es-PE", 27705 "es-PY", 27706 "es-US", 27707 "es-UY", 27708 "es-VE", 27709 "fi", 27710 "fi-FI", 27711 "fr", 27712 "fr-BE", 27713 "fr-CA", 27714 "fr-FR", 27715 "hi", 27716 "hi-IN", 27717 "hu", 27718 "id", 27719 "id-ID", 27720 "it", 27721 "it-IT", 27722 "ja", 27723 "ja-JP", 27724 "ko", 27725 "ko-KR", 27726 "ms", 27727 "ms-MY", 27728 "nb", 27729 "nb-NO", 27730 "nl", 27731 "nl-BE", 27732 "nl-NL", 27733 "pl", 27734 "pl-PL", 27735 "pt", 27736 "pt-BR", 27737 "ro", 27738 "ro-RO", 27739 "ru", 27740 "ru-RU", 27741 "sv", 27742 "sv-SE", 27743 "th", 27744 "th-TH", 27745 "tr", 27746 "tr-TR", 27747 "vi", 27748 "vi-VN", 27749 "zh-Hans", 27750 "zh-Hans-CN", 27751 "zh-Hant", 27752 "zh-Hant-HK", 27753 "zh-Hant-TW" 27754 ] 27755 }, 27756 "datatype-date-math": { 27757 "requires": [ 27758 "yui-base" 27759 ] 27760 }, 27761 "datatype-date-parse": {}, 27762 "datatype-number": { 27763 "use": [ 27764 "datatype-number-parse", 27765 "datatype-number-format" 27766 ] 27767 }, 27768 "datatype-number-format": {}, 27769 "datatype-number-parse": { 27770 "requires": [ 27771 "escape" 27772 ] 27773 }, 27774 "datatype-xml": { 27775 "use": [ 27776 "datatype-xml-parse", 27777 "datatype-xml-format" 27778 ] 27779 }, 27780 "datatype-xml-format": {}, 27781 "datatype-xml-parse": {}, 27782 "dd": { 27783 "use": [ 27784 "dd-ddm-base", 27785 "dd-ddm", 27786 "dd-ddm-drop", 27787 "dd-drag", 27788 "dd-proxy", 27789 "dd-constrain", 27790 "dd-drop", 27791 "dd-scroll", 27792 "dd-delegate" 27793 ] 27794 }, 27795 "dd-constrain": { 27796 "requires": [ 27797 "dd-drag" 27798 ] 27799 }, 27800 "dd-ddm": { 27801 "requires": [ 27802 "dd-ddm-base", 27803 "event-resize" 27804 ] 27805 }, 27806 "dd-ddm-base": { 27807 "requires": [ 27808 "node", 27809 "base", 27810 "yui-throttle", 27811 "classnamemanager" 27812 ] 27813 }, 27814 "dd-ddm-drop": { 27815 "requires": [ 27816 "dd-ddm" 27817 ] 27818 }, 27819 "dd-delegate": { 27820 "requires": [ 27821 "dd-drag", 27822 "dd-drop-plugin", 27823 "event-mouseenter" 27824 ] 27825 }, 27826 "dd-drag": { 27827 "requires": [ 27828 "dd-ddm-base", 27829 "selector-css2" 27830 ] 27831 }, 27832 "dd-drop": { 27833 "requires": [ 27834 "dd-drag", 27835 "dd-ddm-drop" 27836 ] 27837 }, 27838 "dd-drop-plugin": { 27839 "requires": [ 27840 "dd-drop" 27841 ] 27842 }, 27843 "dd-gestures": { 27844 "condition": { 27845 "name": "dd-gestures", 27846 "trigger": "dd-drag", 27847 "ua": "touchEnabled" 27848 }, 27849 "requires": [ 27850 "dd-drag", 27851 "event-synthetic", 27852 "event-gestures" 27853 ] 27854 }, 27855 "dd-plugin": { 27856 "optional": [ 27857 "dd-constrain", 27858 "dd-proxy" 27859 ], 27860 "requires": [ 27861 "dd-drag" 27862 ] 27863 }, 27864 "dd-proxy": { 27865 "requires": [ 27866 "dd-drag" 27867 ] 27868 }, 27869 "dd-scroll": { 27870 "requires": [ 27871 "dd-drag" 27872 ] 27873 }, 27874 "dial": { 27875 "lang": [ 27876 "en", 27877 "es", 27878 "hu" 27879 ], 27880 "requires": [ 27881 "widget", 27882 "dd-drag", 27883 "event-mouseenter", 27884 "event-move", 27885 "event-key", 27886 "transition", 27887 "intl" 27888 ], 27889 "skinnable": true 27890 }, 27891 "dom": { 27892 "use": [ 27893 "dom-base", 27894 "dom-screen", 27895 "dom-style", 27896 "selector-native", 27897 "selector" 27898 ] 27899 },
27900 "dom-base": { 27901 "requires": [ 27902 "dom-core" 27903 ] 27904 }, 27905 "dom-core": { 27906 "requires": [ 27907 "oop", 27908 "features" 27909 ] 27910 }, 27911 "dom-screen": { 27912 "requires": [ 27913 "dom-base", 27914 "dom-style" 27915 ] 27916 }, 27917 "dom-style": { 27918 "requires": [ 27919 "dom-base" 27920 ] 27921 }, 27922 "dom-style-ie": { 27923 "condition": { 27924 "name": "dom-style-ie", 27925 "test": function (Y) { 27926 27927 var testFeature = Y.Features.test, 27928 addFeature = Y.Features.add, 27929 WINDOW = Y.config.win, 27930 DOCUMENT = Y.config.doc, 27931 DOCUMENT_ELEMENT = 'documentElement', 27932 ret = false; 27933 27934 addFeature('style', 'computedStyle', { 27935 test: function() { 27936 return WINDOW && 'getComputedStyle' in WINDOW; 27937 } 27938 }); 27939 27940 addFeature('style', 'opacity', { 27941 test: function() { 27942 return DOCUMENT && 'opacity' in DOCUMENT[DOCUMENT_ELEMENT].style; 27943 } 27944 }); 27945 27946 ret = (!testFeature('style', 'opacity') && 27947 !testFeature('style', 'computedStyle')); 27948 27949 return ret; 27950}, 27951 "trigger": "dom-style" 27952 }, 27953 "requires": [ 27954 "dom-style", 27955 "color-base" 27956 ] 27957 }, 27958 "dump": { 27959 "requires": [ 27960 "yui-base" 27961 ] 27962 }, 27963 "editor": { 27964 "use": [ 27965 "frame", 27966 "editor-selection", 27967 "exec-command", 27968 "editor-base", 27969 "editor-para", 27970 "editor-br", 27971 "editor-bidi", 27972 "editor-tab", 27973 "createlink-base" 27974 ] 27975 }, 27976 "editor-base": { 27977 "requires": [ 27978 "base", 27979 "frame", 27980 "node", 27981 "exec-command", 27982 "editor-selection" 27983 ] 27984 }, 27985 "editor-bidi": { 27986 "requires": [ 27987 "editor-base" 27988 ] 27989 }, 27990 "editor-br": { 27991 "requires": [ 27992 "editor-base" 27993 ] 27994 }, 27995 "editor-inline": { 27996 "requires": [ 27997 "editor-base", 27998 "content-editable" 27999 ] 28000 }, 28001 "editor-lists": { 28002 "requires": [ 28003 "editor-base" 28004 ] 28005 }, 28006 "editor-para": { 28007 "requires": [ 28008 "editor-para-base" 28009 ] 28010 }, 28011 "editor-para-base": { 28012 "requires": [ 28013 "editor-base" 28014 ] 28015 }, 28016 "editor-para-ie": { 28017 "condition": { 28018 "name": "editor-para-ie", 28019 "trigger": "editor-para", 28020 "ua": "ie", 28021 "when": "instead" 28022 }, 28023 "requires": [ 28024 "editor-para-base" 28025 ] 28026 }, 28027 "editor-selection": { 28028 "requires": [ 28029 "node" 28030 ] 28031 }, 28032 "editor-tab": { 28033 "requires": [ 28034 "editor-base" 28035 ] 28036 }, 28037 "escape": { 28038 "requires": [ 28039 "yui-base" 28040 ] 28041 }, 28042 "event": { 28043 "after": [ 28044 "node-base" 28045 ], 28046 "use": [ 28047 "event-base", 28048 "event-delegate", 28049 "event-synthetic", 28050 "event-mousewheel", 28051 "event-mouseenter", 28052 "event-key", 28053 "event-focus", 28054 "event-resize", 28055 "event-hover", 28056 "event-outside", 28057 "event-touch", 28058 "event-move", 28059 "event-flick", 28060 "event-valuechange", 28061 "event-tap" 28062 ] 28063 }, 28064 "event-base": { 28065 "after": [ 28066 "node-base" 28067 ], 28068 "requires": [ 28069 "event-custom-base" 28070 ] 28071 }, 28072 "event-base-ie": { 28073 "after": [ 28074 "event-base" 28075 ], 28076 "condition": { 28077 "name": "event-base-ie", 28078 "test": function(Y) { 28079 var imp = Y.config.doc && Y.config.doc.implementation; 28080 return (imp && (!imp.hasFeature('Events', '2.0'))); 28081}, 28082 "trigger": "node-base" 28083 }, 28084 "requires": [ 28085 "node-base" 28086 ] 28087 }, 28088 "event-contextmenu": { 28089 "requires": [ 28090 "event-synthetic", 28091 "dom-screen" 28092 ] 28093 }, 28094 "event-custom": { 28095 "use": [ 28096 "event-custom-base", 28097 "event-custom-complex" 28098 ] 28099 }, 28100 "event-custom-base": { 28101 "requires": [ 28102 "oop" 28103 ] 28104 }, 28105 "event-custom-complex": { 28106 "requires": [ 28107 "event-custom-base" 28108 ] 28109 }, 28110 "event-delegate": { 28111 "requires": [ 28112 "node-base" 28113 ] 28114 }, 28115 "event-flick": { 28116 "requires": [ 28117 "node-base", 28118 "event-touch", 28119 "event-synthetic" 28120 ] 28121 }, 28122 "event-focus": { 28123 "requires": [ 28124 "event-synthetic" 28125 ] 28126 }, 28127 "event-gestures": { 28128 "use": [ 28129 "event-flick", 28130 "event-move" 28131 ] 28132 }, 28133 "event-hover": { 28134 "requires": [ 28135 "event-mouseenter" 28136 ] 28137 }, 28138 "event-key": { 28139 "requires": [ 28140 "event-synthetic" 28141 ] 28142 }, 28143 "event-mouseenter": { 28144 "requires": [ 28145 "event-synthetic" 28146 ] 28147 }, 28148 "event-mousewheel": { 28149 "requires": [ 28150 "node-base" 28151 ] 28152 }, 28153 "event-move": { 28154 "requires": [ 28155 "node-base", 28156 "event-touch", 28157 "event-synthetic" 28158 ] 28159 }, 28160 "event-outside": { 28161 "requires": [ 28162 "event-synthetic" 28163 ] 28164 }, 28165 "event-resize": { 28166 "requires": [ 28167 "node-base", 28168 "event-synthetic" 28169 ] 28170 }, 28171 "event-simulate": { 28172 "requires": [ 28173 "event-base" 28174 ] 28175 }, 28176 "event-synthetic": { 28177 "requires": [ 28178 "node-base", 28179 "event-custom-complex" 28180 ] 28181 }, 28182 "event-tap": { 28183 "requires": [ 28184 "node-base", 28185 "event-base", 28186 "event-touch", 28187 "event-synthetic" 28188 ] 28189 }, 28190 "event-touch": { 28191 "requires": [ 28192 "node-base" 28193 ] 28194 }, 28195 "event-valuechange": { 28196 "requires": [ 28197 "event-focus", 28198 "event-synthetic" 28199 ] 28200 }, 28201 "exec-command": { 28202 "requires": [ 28203 "frame" 28204 ] 28205 }, 28206 "features": { 28207 "requires": [ 28208 "yui-base" 28209 ] 28210 }, 28211 "file": { 28212 "requires": [ 28213 "file-flash", 28214 "file-html5" 28215 ] 28216 }, 28217 "file-flash": { 28218 "requires": [ 28219 "base" 28220 ] 28221 }, 28222 "file-html5": { 28223 "requires": [ 28224 "base" 28225 ] 28226 }, 28227 "frame": { 28228 "requires": [ 28229 "base", 28230 "node", 28231 "plugin", 28232 "selector-css3", 28233 "yui-throttle" 28234 ] 28235 }, 28236 "gesture-simulate": { 28237 "requires": [ 28238 "async-queue", 28239 "event-simulate", 28240 "node-screen" 28241 ] 28242 }, 28243 "get": { 28244 "requires": [ 28245 "yui-base" 28246 ] 28247 }, 28248 "graphics": { 28249 "requires": [ 28250 "node", 28251 "event-custom", 28252 "pluginhost", 28253 "matrix", 28254 "classnamemanager" 28255 ] 28256 }, 28257 "graphics-canvas": { 28258 "condition": { 28259 "name": "graphics-canvas", 28260 "test": function(Y) { 28261 var DOCUMENT = Y.config.doc, 28262 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas",
28263 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 28264 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 28265 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); 28266}, 28267 "trigger": "graphics" 28268 }, 28269 "requires": [ 28270 "graphics", 28271 "color-base" 28272 ] 28273 }, 28274 "graphics-canvas-default": { 28275 "condition": { 28276 "name": "graphics-canvas-default", 28277 "test": function(Y) { 28278 var DOCUMENT = Y.config.doc, 28279 useCanvas = Y.config.defaultGraphicEngine && Y.config.defaultGraphicEngine == "canvas", 28280 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 28281 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 28282 return (!svg || useCanvas) && (canvas && canvas.getContext && canvas.getContext("2d")); 28283}, 28284 "trigger": "graphics" 28285 } 28286 }, 28287 "graphics-group": { 28288 "requires": [ 28289 "graphics" 28290 ] 28291 }, 28292 "graphics-svg": { 28293 "condition": { 28294 "name": "graphics-svg", 28295 "test": function(Y) { 28296 var DOCUMENT = Y.config.doc, 28297 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", 28298 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 28299 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 28300 28301 return svg && (useSVG || !canvas); 28302}, 28303 "trigger": "graphics" 28304 }, 28305 "requires": [ 28306 "graphics" 28307 ] 28308 }, 28309 "graphics-svg-default": { 28310 "condition": { 28311 "name": "graphics-svg-default", 28312 "test": function(Y) { 28313 var DOCUMENT = Y.config.doc, 28314 useSVG = !Y.config.defaultGraphicEngine || Y.config.defaultGraphicEngine != "canvas", 28315 canvas = DOCUMENT && DOCUMENT.createElement("canvas"), 28316 svg = (DOCUMENT && DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")); 28317 28318 return svg && (useSVG || !canvas); 28319}, 28320 "trigger": "graphics" 28321 } 28322 }, 28323 "graphics-vml": { 28324 "condition": { 28325 "name": "graphics-vml", 28326 "test": function(Y) { 28327 var DOCUMENT = Y.config.doc, 28328 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); 28329 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); 28330}, 28331 "trigger": "graphics" 28332 }, 28333 "requires": [ 28334 "graphics", 28335 "color-base" 28336 ] 28337 }, 28338 "graphics-vml-default": { 28339 "condition": { 28340 "name": "graphics-vml-default", 28341 "test": function(Y) { 28342 var DOCUMENT = Y.config.doc, 28343 canvas = DOCUMENT && DOCUMENT.createElement("canvas"); 28344 return (DOCUMENT && !DOCUMENT.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1") && (!canvas || !canvas.getContext || !canvas.getContext("2d"))); 28345}, 28346 "trigger": "graphics" 28347 } 28348 }, 28349 "handlebars": { 28350 "use": [ 28351 "handlebars-compiler" 28352 ] 28353 }, 28354 "handlebars-base": { 28355 "requires": [] 28356 }, 28357 "handlebars-compiler": { 28358 "requires": [ 28359 "handlebars-base" 28360 ] 28361 }, 28362 "highlight": { 28363 "use": [ 28364 "highlight-base", 28365 "highlight-accentfold" 28366 ] 28367 }, 28368 "highlight-accentfold": { 28369 "requires": [ 28370 "highlight-base", 28371 "text-accentfold" 28372 ] 28373 }, 28374 "highlight-base": { 28375 "requires": [ 28376 "array-extras", 28377 "classnamemanager", 28378 "escape", 28379 "text-wordbreak" 28380 ] 28381 }, 28382 "history": { 28383 "use": [ 28384 "history-base", 28385 "history-hash", 28386 "history-html5" 28387 ] 28388 }, 28389 "history-base": { 28390 "requires": [ 28391 "event-custom-complex" 28392 ] 28393 }, 28394 "history-hash": { 28395 "after": [ 28396 "history-html5" 28397 ], 28398 "requires": [ 28399 "event-synthetic", 28400 "history-base", 28401 "yui-later" 28402 ] 28403 }, 28404 "history-hash-ie": { 28405 "condition": { 28406 "name": "history-hash-ie", 28407 "test": function (Y) { 28408 var docMode = Y.config.doc && Y.config.doc.documentMode; 28409 28410 return Y.UA.ie && (!('onhashchange' in Y.config.win) || 28411 !docMode || docMode < 8); 28412}, 28413 "trigger": "history-hash" 28414 }, 28415 "requires": [ 28416 "history-hash", 28417 "node-base" 28418 ] 28419 }, 28420 "history-html5": { 28421 "optional": [ 28422 "json" 28423 ], 28424 "requires": [ 28425 "event-base", 28426 "history-base", 28427 "node-base" 28428 ] 28429 }, 28430 "imageloader": { 28431 "requires": [ 28432 "base-base", 28433 "node-style", 28434 "node-screen" 28435 ] 28436 }, 28437 "intl": { 28438 "requires": [ 28439 "intl-base", 28440 "event-custom" 28441 ] 28442 }, 28443 "intl-base": { 28444 "requires": [ 28445 "yui-base" 28446 ] 28447 }, 28448 "io": { 28449 "use": [ 28450 "io-base", 28451 "io-xdr", 28452 "io-form", 28453 "io-upload-iframe", 28454 "io-queue" 28455 ] 28456 }, 28457 "io-base": { 28458 "requires": [ 28459 "event-custom-base", 28460 "querystring-stringify-simple" 28461 ] 28462 }, 28463 "io-form": { 28464 "requires": [ 28465 "io-base", 28466 "node-base" 28467 ] 28468 }, 28469 "io-nodejs": { 28470 "condition": { 28471 "name": "io-nodejs", 28472 "trigger": "io-base", 28473 "ua": "nodejs" 28474 }, 28475 "requires": [ 28476 "io-base" 28477 ] 28478 }, 28479 "io-queue": { 28480 "requires": [ 28481 "io-base", 28482 "queue-promote" 28483 ] 28484 }, 28485 "io-upload-iframe": { 28486 "requires": [ 28487 "io-base", 28488 "node-base" 28489 ] 28490 }, 28491 "io-xdr": { 28492 "requires": [ 28493 "io-base", 28494 "datatype-xml-parse" 28495 ] 28496 }, 28497 "json": { 28498 "use": [ 28499 "json-parse", 28500 "json-stringify" 28501 ] 28502 }, 28503 "json-parse": { 28504 "requires": [ 28505 "yui-base" 28506 ] 28507 }, 28508 "json-parse-shim": { 28509 "condition": { 28510 "name": "json-parse-shim", 28511 "test": function (Y) { 28512 var _JSON = Y.config.global.JSON, 28513 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, 28514 nativeSupport = Y.config.useNativeJSONParse !== false && !!Native; 28515 28516 function workingNative( k, v ) { 28517 return k === "ok" ? true : v; 28518 } 28519 28520 // Double check basic functionality. This is mainly to catch early broken 28521 // implementations of the JSON API in Firefox 3.1 beta1 and beta2
28522 if ( nativeSupport ) { 28523 try { 28524 nativeSupport = ( Native.parse( '{"ok":false}', workingNative ) ).ok; 28525 } 28526 catch ( e ) { 28527 nativeSupport = false; 28528 } 28529 } 28530 28531 return !nativeSupport; 28532}, 28533 "trigger": "json-parse" 28534 }, 28535 "requires": [ 28536 "json-parse" 28537 ] 28538 }, 28539 "json-stringify": { 28540 "requires": [ 28541 "yui-base" 28542 ] 28543 }, 28544 "json-stringify-shim": { 28545 "condition": { 28546 "name": "json-stringify-shim", 28547 "test": function (Y) { 28548 var _JSON = Y.config.global.JSON, 28549 Native = Object.prototype.toString.call(_JSON) === '[object JSON]' && _JSON, 28550 nativeSupport = Y.config.useNativeJSONStringify !== false && !!Native; 28551 28552 // Double check basic native functionality. This is primarily to catch broken 28553 // early JSON API implementations in Firefox 3.1 beta1 and beta2. 28554 if ( nativeSupport ) { 28555 try { 28556 nativeSupport = ( '0' === Native.stringify(0) ); 28557 } catch ( e ) { 28558 nativeSupport = false; 28559 } 28560 } 28561 28562 28563 return !nativeSupport; 28564}, 28565 "trigger": "json-stringify" 28566 }, 28567 "requires": [ 28568 "json-stringify" 28569 ] 28570 }, 28571 "jsonp": { 28572 "requires": [ 28573 "get", 28574 "oop" 28575 ] 28576 }, 28577 "jsonp-url": { 28578 "requires": [ 28579 "jsonp" 28580 ] 28581 }, 28582 "lazy-model-list": { 28583 "requires": [ 28584 "model-list" 28585 ] 28586 }, 28587 "loader": { 28588 "use": [ 28589 "loader-base", 28590 "loader-rollup", 28591 "loader-yui3" 28592 ] 28593 }, 28594 "loader-base": { 28595 "requires": [ 28596 "get", 28597 "features" 28598 ] 28599 }, 28600 "loader-pathogen-combohandler": {}, 28601 "loader-pathogen-encoder": { 28602 "use": [ 28603 "loader-base", 28604 "loader-rollup", 28605 "loader-yui3", 28606 "loader-pathogen-combohandler" 28607 ] 28608 }, 28609 "loader-rollup": { 28610 "requires": [ 28611 "loader-base" 28612 ] 28613 }, 28614 "loader-yui3": { 28615 "requires": [ 28616 "loader-base" 28617 ] 28618 }, 28619 "matrix": { 28620 "requires": [ 28621 "yui-base" 28622 ] 28623 }, 28624 "model": { 28625 "requires": [ 28626 "base-build", 28627 "escape", 28628 "json-parse" 28629 ] 28630 }, 28631 "model-list": { 28632 "requires": [ 28633 "array-extras", 28634 "array-invoke", 28635 "arraylist", 28636 "base-build", 28637 "escape", 28638 "json-parse", 28639 "model" 28640 ] 28641 }, 28642 "model-sync-local": { 28643 "requires": [ 28644 "model", 28645 "json-stringify" 28646 ] 28647 }, 28648 "model-sync-rest": { 28649 "requires": [ 28650 "model", 28651 "io-base", 28652 "json-stringify" 28653 ] 28654 }, 28655 "node": { 28656 "use": [ 28657 "node-base", 28658 "node-event-delegate", 28659 "node-pluginhost", 28660 "node-screen", 28661 "node-style" 28662 ] 28663 }, 28664 "node-base": { 28665 "requires": [ 28666 "event-base", 28667 "node-core", 28668 "dom-base", 28669 "dom-style" 28670 ] 28671 }, 28672 "node-core": { 28673 "requires": [ 28674 "dom-core", 28675 "selector" 28676 ] 28677 }, 28678 "node-event-delegate": { 28679 "requires": [ 28680 "node-base", 28681 "event-delegate" 28682 ] 28683 }, 28684 "node-event-html5": { 28685 "requires": [ 28686 "node-base" 28687 ] 28688 }, 28689 "node-event-simulate": { 28690 "requires": [ 28691 "node-base", 28692 "event-simulate", 28693 "gesture-simulate" 28694 ] 28695 }, 28696 "node-flick": { 28697 "requires": [ 28698 "classnamemanager", 28699 "transition", 28700 "event-flick", 28701 "plugin" 28702 ], 28703 "skinnable": true 28704 }, 28705 "node-focusmanager": { 28706 "requires": [ 28707 "attribute", 28708 "node", 28709 "plugin", 28710 "node-event-simulate", 28711 "event-key", 28712 "event-focus" 28713 ] 28714 }, 28715 "node-load": { 28716 "requires": [ 28717 "node-base", 28718 "io-base" 28719 ] 28720 }, 28721 "node-menunav": { 28722 "requires": [ 28723 "node", 28724 "classnamemanager", 28725 "plugin", 28726 "node-focusmanager" 28727 ], 28728 "skinnable": true 28729 }, 28730 "node-pluginhost": { 28731 "requires": [ 28732 "node-base", 28733 "pluginhost" 28734 ] 28735 }, 28736 "node-screen": { 28737 "requires": [ 28738 "dom-screen", 28739 "node-base" 28740 ] 28741 }, 28742 "node-scroll-info": { 28743 "requires": [ 28744 "array-extras", 28745 "base-build", 28746 "event-resize", 28747 "node-pluginhost", 28748 "plugin", 28749 "selector" 28750 ] 28751 }, 28752 "node-style": { 28753 "requires": [ 28754 "dom-style", 28755 "node-base" 28756 ] 28757 }, 28758 "oop": { 28759 "requires": [ 28760 "yui-base" 28761 ] 28762 }, 28763 "overlay": { 28764 "requires": [ 28765 "widget", 28766 "widget-stdmod", 28767 "widget-position", 28768 "widget-position-align", 28769 "widget-stack", 28770 "widget-position-constrain" 28771 ], 28772 "skinnable": true 28773 }, 28774 "paginator": { 28775 "requires": [ 28776 "paginator-core" 28777 ] 28778 }, 28779 "paginator-core": { 28780 "requires": [ 28781 "base" 28782 ] 28783 }, 28784 "paginator-url": { 28785 "requires": [ 28786 "paginator" 28787 ] 28788 }, 28789 "panel": { 28790 "requires": [ 28791 "widget", 28792 "widget-autohide", 28793 "widget-buttons", 28794 "widget-modality", 28795 "widget-position", 28796 "widget-position-align", 28797 "widget-position-constrain", 28798 "widget-stack", 28799 "widget-stdmod" 28800 ], 28801 "skinnable": true 28802 }, 28803 "parallel": { 28804 "requires": [ 28805 "yui-base" 28806 ] 28807 }, 28808 "pjax": { 28809 "requires": [ 28810 "pjax-base", 28811 "pjax-content" 28812 ] 28813 }, 28814 "pjax-base": { 28815 "requires": [ 28816 "classnamemanager", 28817 "node-event-delegate", 28818 "router" 28819 ] 28820 }, 28821 "pjax-content": { 28822 "requires": [ 28823 "io-base", 28824 "node-base", 28825 "router" 28826 ] 28827 }, 28828 "pjax-plugin": { 28829 "requires": [ 28830 "node-pluginhost", 28831 "pjax", 28832 "plugin" 28833 ] 28834 }, 28835 "plugin": { 28836 "requires": [ 28837 "base-base" 28838 ] 28839 }, 28840 "pluginhost": { 28841 "use": [ 28842 "pluginhost-base", 28843 "pluginhost-config" 28844 ] 28845 }, 28846 "pluginhost-base": { 28847 "requires": [ 28848 "yui-base" 28849 ] 28850 }, 28851 "pluginhost-config": { 28852 "requires": [ 28853 "pluginhost-base" 28854 ] 28855 }, 28856 "promise": { 28857 "requires": [ 28858 "timers" 28859 ] 28860 }, 28861 "querystring": { 28862 "use": [ 28863 "querystring-parse", 28864 "querystring-stringify" 28865 ] 28866 }, 28867 "querystring-parse": { 28868 "requires": [ 28869 "yui-base", 28870 "array-extras" 28871 ] 28872 }, 28873 "querystring-parse-simple": { 28874 "requires": [ 28875 "yui-base" 28876 ] 28877 }, 28878 "querystring-stringify": { 28879 "requires": [ 28880 "yui-base" 28881 ] 28882 }, 28883 "querystring-stringify-simple": { 28884 "requires": [ 28885 "yui-base" 28886 ] 28887 }, 28888 "queue-promote": { 28889 "requires": [ 28890 "yui-base" 28891 ] 28892 }, 28893 "range-slider": { 28894 "requires": [ 28895 "slider-base", 28896 "slider-value-range", 28897 "clickable-rail" 28898 ] 28899 }, 28900 "recordset": { 28901 "use": [ 28902 "recordset-base", 28903 "recordset-sort", 28904 "recordset-filter", 28905 "recordset-indexer" 28906 ] 28907 }, 28908 "recordset-base": { 28909 "requires": [ 28910 "base", 28911 "arraylist" 28912 ] 28913 }, 28914 "recordset-filter": { 28915 "requires": [ 28916 "recordset-base", 28917 "array-extras", 28918 "plugin" 28919 ] 28920 }, 28921 "recordset-indexer": { 28922 "requires": [ 28923 "recordset-base", 28924 "plugin" 28925 ] 28926 }, 28927 "recordset-sort": { 28928 "requires": [ 28929 "arraysort", 28930 "recordset-base", 28931 "plugin" 28932 ] 28933 }, 28934 "resize": { 28935 "use": [ 28936 "resize-base", 28937 "resize-proxy", 28938 "resize-constrain" 28939 ] 28940 }, 28941 "resize-base": { 28942 "requires": [ 28943 "base", 28944 "widget", 28945 "event", 28946 "oop", 28947 "dd-drag", 28948 "dd-delegate", 28949 "dd-drop" 28950 ], 28951 "skinnable": true 28952 }, 28953 "resize-constrain": { 28954 "requires": [ 28955 "plugin", 28956 "resize-base" 28957 ] 28958 }, 28959 "resize-plugin": { 28960 "optional": [ 28961 "resize-constrain" 28962 ], 28963 "requires": [ 28964 "resize-base", 28965 "plugin" 28966 ] 28967 }, 28968 "resize-proxy": { 28969 "requires": [ 28970 "plugin", 28971 "resize-base" 28972 ] 28973 }, 28974 "router": { 28975 "optional": [ 28976 "querystring-parse" 28977 ], 28978 "requires": [ 28979 "array-extras", 28980 "base-build", 28981 "history" 28982 ] 28983 }, 28984 "scrollview": { 28985 "requires": [ 28986 "scrollview-base", 28987 "scrollview-scrollbars" 28988 ] 28989 }, 28990 "scrollview-base": { 28991 "requires": [ 28992 "widget", 28993 "event-gestures", 28994 "event-mousewheel", 28995 "transition" 28996 ], 28997 "skinnable": true 28998 }, 28999 "scrollview-base-ie": { 29000 "condition": { 29001 "name": "scrollview-base-ie", 29002 "trigger": "scrollview-base", 29003 "ua": "ie" 29004 }, 29005 "requires": [ 29006 "scrollview-base" 29007 ] 29008 }, 29009 "scrollview-list": { 29010 "requires": [ 29011 "plugin", 29012 "classnamemanager" 29013 ], 29014 "skinnable": true 29015 }, 29016 "scrollview-paginator": { 29017 "requires": [ 29018 "plugin", 29019 "classnamemanager" 29020 ] 29021 }, 29022 "scrollview-scrollbars": { 29023 "requires": [ 29024 "classnamemanager", 29025 "transition", 29026 "plugin" 29027 ], 29028 "skinnable": true 29029 }, 29030 "selector": { 29031 "requires": [ 29032 "selector-native" 29033 ] 29034 }, 29035 "selector-css2": { 29036 "condition": { 29037 "name": "selector-css2", 29038 "test": function (Y) { 29039 var DOCUMENT = Y.config.doc, 29040 ret = DOCUMENT && !('querySelectorAll' in DOCUMENT); 29041 29042 return ret; 29043}, 29044 "trigger": "selector" 29045 }, 29046 "requires": [ 29047 "selector-native" 29048 ] 29049 }, 29050 "selector-css3": { 29051 "requires": [ 29052 "selector-native", 29053 "selector-css2" 29054 ] 29055 }, 29056 "selector-native": { 29057 "requires": [ 29058 "dom-base" 29059 ] 29060 }, 29061 "series-area": { 29062 "requires": [ 29063 "series-cartesian", 29064 "series-fill-util" 29065 ] 29066 }, 29067 "series-area-stacked": { 29068 "requires": [ 29069 "series-stacked", 29070 "series-area" 29071 ] 29072 }, 29073 "series-areaspline": { 29074 "requires": [ 29075 "series-area", 29076 "series-curve-util" 29077 ] 29078 }, 29079 "series-areaspline-stacked": { 29080 "requires": [ 29081 "series-stacked", 29082 "series-areaspline" 29083 ] 29084 }, 29085 "series-bar": { 29086 "requires": [ 29087 "series-marker", 29088 "series-histogram-base" 29089 ] 29090 }, 29091 "series-bar-stacked": { 29092 "requires": [ 29093 "series-stacked", 29094 "series-bar" 29095 ] 29096 }, 29097 "series-base": { 29098 "requires": [ 29099 "graphics", 29100 "axis-base" 29101 ] 29102 }, 29103 "series-candlestick": { 29104 "requires": [ 29105 "series-range" 29106 ] 29107 }, 29108 "series-cartesian": { 29109 "requires": [ 29110 "series-base" 29111 ] 29112 }, 29113 "series-column": { 29114 "requires": [ 29115 "series-marker", 29116 "series-histogram-base" 29117 ] 29118 }, 29119 "series-column-stacked": { 29120 "requires": [ 29121 "series-stacked", 29122 "series-column" 29123 ] 29124 }, 29125 "series-combo": { 29126 "requires": [ 29127 "series-cartesian", 29128 "series-line-util", 29129 "series-plot-util", 29130 "series-fill-util" 29131 ] 29132 }, 29133 "series-combo-stacked": { 29134 "requires": [ 29135 "series-stacked", 29136 "series-combo" 29137 ] 29138 }, 29139 "series-combospline": { 29140 "requires": [ 29141 "series-combo", 29142 "series-curve-util" 29143 ] 29144 }, 29145 "series-combospline-stacked": { 29146 "requires": [ 29147 "series-combo-stacked", 29148 "series-curve-util" 29149 ] 29150 }, 29151 "series-curve-util": {}, 29152 "series-fill-util": {}, 29153 "series-histogram-base": { 29154 "requires": [ 29155 "series-cartesian", 29156 "series-plot-util" 29157 ] 29158 }, 29159 "series-line": { 29160 "requires": [ 29161 "series-cartesian", 29162 "series-line-util" 29163 ] 29164 }, 29165 "series-line-stacked": { 29166 "requires": [ 29167 "series-stacked", 29168 "series-line" 29169 ] 29170 }, 29171 "series-line-util": {}, 29172 "series-marker": { 29173 "requires": [ 29174 "series-cartesian", 29175 "series-plot-util" 29176 ] 29177 }, 29178 "series-marker-stacked": { 29179 "requires": [ 29180 "series-stacked", 29181 "series-marker" 29182 ] 29183 }, 29184 "series-ohlc": { 29185 "requires": [ 29186 "series-range" 29187 ] 29188 }, 29189 "series-pie": { 29190 "requires": [ 29191 "series-base", 29192 "series-plot-util" 29193 ] 29194 }, 29195 "series-plot-util": {}, 29196 "series-range": { 29197 "requires": [ 29198 "series-cartesian" 29199 ] 29200 }, 29201 "series-spline": { 29202 "requires": [ 29203 "series-line", 29204 "series-curve-util" 29205 ] 29206 }, 29207 "series-spline-stacked": { 29208 "requires": [ 29209 "series-stacked", 29210 "series-spline" 29211 ] 29212 }, 29213 "series-stacked": { 29214 "requires": [ 29215 "axis-stacked" 29216 ] 29217 }, 29218 "shim-plugin": { 29219 "requires": [ 29220 "node-style", 29221 "node-pluginhost" 29222 ] 29223 }, 29224 "slider": { 29225 "use": [ 29226 "slider-base", 29227 "slider-value-range", 29228 "clickable-rail", 29229 "range-slider" 29230 ] 29231 }, 29232 "slider-base": { 29233 "requires": [ 29234 "widget", 29235 "dd-constrain", 29236 "event-key" 29237 ], 29238 "skinnable": true 29239 }, 29240 "slider-value-range": { 29241 "requires": [ 29242 "slider-base" 29243 ] 29244 }, 29245 "sortable": { 29246 "requires": [ 29247 "dd-delegate", 29248 "dd-drop-plugin", 29249 "dd-proxy" 29250 ] 29251 }, 29252 "sortable-scroll": { 29253 "requires": [ 29254 "dd-scroll", 29255 "sortable" 29256 ] 29257 }, 29258 "stylesheet": { 29259 "requires": [ 29260 "yui-base" 29261 ] 29262 }, 29263 "substitute": { 29264 "optional": [ 29265 "dump" 29266 ], 29267 "requires": [ 29268 "yui-base" 29269 ] 29270 }, 29271 "swf": { 29272 "requires": [ 29273 "event-custom", 29274 "node", 29275 "swfdetect", 29276 "escape" 29277 ] 29278 }, 29279 "swfdetect": { 29280 "requires": [ 29281 "yui-base" 29282 ] 29283 }, 29284 "tabview": { 29285 "requires": [ 29286 "widget", 29287 "widget-parent", 29288 "widget-child", 29289 "tabview-base", 29290 "node-pluginhost", 29291 "node-focusmanager" 29292 ], 29293 "skinnable": true 29294 }, 29295 "tabview-base": { 29296 "requires": [ 29297 "node-event-delegate", 29298 "classnamemanager" 29299 ] 29300 }, 29301 "tabview-plugin": { 29302 "requires": [ 29303 "tabview-base" 29304 ] 29305 }, 29306 "template": { 29307 "use": [ 29308 "template-base", 29309 "template-micro" 29310 ] 29311 }, 29312 "template-base": { 29313 "requires": [ 29314 "yui-base" 29315 ] 29316 }, 29317 "template-micro": { 29318 "requires": [ 29319 "escape" 29320 ] 29321 }, 29322 "test": { 29323 "requires": [ 29324 "event-simulate", 29325 "event-custom", 29326 "json-stringify" 29327 ] 29328 }, 29329
29329 "test-console": { 29330 "requires": [ 29331 "console-filters", 29332 "test", 29333 "array-extras" 29334 ], 29335 "skinnable": true 29336 }, 29337 "text": { 29338 "use": [ 29339 "text-accentfold", 29340 "text-wordbreak" 29341 ] 29342 }, 29343 "text-accentfold": { 29344 "requires": [ 29345 "array-extras", 29346 "text-data-accentfold" 29347 ] 29348 }, 29349 "text-data-accentfold": { 29350 "requires": [ 29351 "yui-base" 29352 ] 29353 }, 29354 "text-data-wordbreak": { 29355 "requires": [ 29356 "yui-base" 29357 ] 29358 }, 29359 "text-wordbreak": { 29360 "requires": [ 29361 "array-extras", 29362 "text-data-wordbreak" 29363 ] 29364 }, 29365 "timers": { 29366 "requires": [ 29367 "yui-base" 29368 ] 29369 }, 29370 "transition": { 29371 "requires": [ 29372 "node-style" 29373 ] 29374 }, 29375 "transition-timer": { 29376 "condition": { 29377 "name": "transition-timer", 29378 "test": function (Y) { 29379 var DOCUMENT = Y.config.doc, 29380 node = (DOCUMENT) ? DOCUMENT.documentElement: null, 29381 ret = true; 29382 29383 if (node && node.style) { 29384 ret = !('MozTransition' in node.style || 'WebkitTransition' in node.style || 'transition' in node.style); 29385 } 29386 29387 return ret; 29388}, 29389 "trigger": "transition" 29390 }, 29391 "requires": [ 29392 "transition" 29393 ] 29394 }, 29395 "tree": { 29396 "requires": [ 29397 "base-build", 29398 "tree-node" 29399 ] 29400 }, 29401 "tree-labelable": { 29402 "requires": [ 29403 "tree" 29404 ] 29405 }, 29406 "tree-lazy": { 29407 "requires": [ 29408 "base-pluginhost", 29409 "plugin", 29410 "tree" 29411 ] 29412 }, 29413 "tree-node": {}, 29414 "tree-openable": { 29415 "requires": [ 29416 "tree" 29417 ] 29418 }, 29419 "tree-selectable": { 29420 "requires": [ 29421 "tree" 29422 ] 29423 }, 29424 "tree-sortable": { 29425 "requires": [ 29426 "tree" 29427 ] 29428 }, 29429 "uploader": { 29430 "requires": [ 29431 "uploader-html5", 29432 "uploader-flash" 29433 ] 29434 }, 29435 "uploader-flash": { 29436 "requires": [ 29437 "swfdetect", 29438 "escape", 29439 "widget", 29440 "base", 29441 "cssbutton", 29442 "node", 29443 "event-custom", 29444 "uploader-queue" 29445 ] 29446 }, 29447 "uploader-html5": { 29448 "requires": [ 29449 "widget", 29450 "node-event-simulate", 29451 "file-html5", 29452 "uploader-queue" 29453 ] 29454 }, 29455 "uploader-queue": { 29456 "requires": [ 29457 "base" 29458 ] 29459 }, 29460 "view": { 29461 "requires": [ 29462 "base-build", 29463 "node-event-delegate" 29464 ] 29465 }, 29466 "view-node-map": { 29467 "requires": [ 29468 "view" 29469 ] 29470 }, 29471 "widget": { 29472 "use": [ 29473 "widget-base", 29474 "widget-htmlparser", 29475 "widget-skin", 29476 "widget-uievents" 29477 ] 29478 }, 29479 "widget-anim": { 29480 "requires": [ 29481 "anim-base", 29482 "plugin", 29483 "widget" 29484 ] 29485 }, 29486 "widget-autohide": { 29487 "requires": [ 29488 "base-build", 29489 "event-key", 29490 "event-outside", 29491 "widget" 29492 ] 29493 }, 29494 "widget-base": { 29495 "requires": [ 29496 "attribute", 29497 "base-base", 29498 "base-pluginhost", 29499 "classnamemanager", 29500 "event-focus", 29501 "node-base", 29502 "node-style" 29503 ], 29504 "skinnable": true 29505 }, 29506 "widget-base-ie": { 29507 "condition": { 29508 "name": "widget-base-ie", 29509 "trigger": "widget-base", 29510 "ua": "ie" 29511 }, 29512 "requires": [ 29513 "widget-base" 29514 ] 29515 }, 29516 "widget-buttons": { 29517 "requires": [ 29518 "button-plugin", 29519 "cssbutton", 29520 "widget-stdmod" 29521 ] 29522 }, 29523 "widget-child": { 29524 "requires": [ 29525 "base-build", 29526 "widget" 29527 ] 29528 }, 29529 "widget-htmlparser": { 29530 "requires": [ 29531 "widget-base" 29532 ] 29533 }, 29534 "widget-modality": { 29535 "requires": [ 29536 "base-build", 29537 "event-outside", 29538 "widget" 29539 ], 29540 "skinnable": true 29541 }, 29542 "widget-parent": { 29543 "requires": [ 29544 "arraylist", 29545 "base-build", 29546 "widget" 29547 ] 29548 }, 29549 "widget-position": { 29550 "requires": [ 29551 "base-build", 29552 "node-screen", 29553 "widget" 29554 ] 29555 }, 29556 "widget-position-align": { 29557 "requires": [ 29558 "widget-position" 29559 ] 29560 }, 29561 "widget-position-constrain": { 29562 "requires": [ 29563 "widget-position" 29564 ] 29565 }, 29566 "widget-skin": { 29567 "requires": [ 29568 "widget-base" 29569 ] 29570 }, 29571 "widget-stack": { 29572 "requires": [ 29573 "base-build", 29574 "widget" 29575 ], 29576 "skinnable": true 29577 }, 29578 "widget-stdmod": { 29579 "requires": [ 29580 "base-build", 29581 "widget" 29582 ] 29583 }, 29584 "widget-uievents": { 29585 "requires": [ 29586 "node-event-delegate", 29587 "widget-base" 29588 ] 29589 }, 29590 "yql": { 29591 "requires": [ 29592 "oop" 29593 ] 29594 }, 29595 "yql-jsonp": { 29596 "condition": { 29597 "name": "yql-jsonp", 29598 "test": function (Y) { 29599 /* Only load the JSONP module when not in nodejs or winjs 29600 TODO Make the winjs module a CORS module 29601 */ 29602 return (!Y.UA.nodejs && !Y.UA.winjs); 29603}, 29604 "trigger": "yql" 29605 }, 29606 "requires": [ 29607 "yql", 29608 "jsonp", 29609 "jsonp-url" 29610 ] 29611 }, 29612 "yql-nodejs": { 29613 "condition": { 29614 "name": "yql-nodejs", 29615 "trigger": "yql", 29616 "ua": "nodejs" 29617 }, 29618 "requires": [ 29619 "yql" 29620 ] 29621 }, 29622 "yql-winjs": { 29623 "condition": { 29624 "name": "yql-winjs", 29625 "trigger": "yql", 29626 "ua": "winjs" 29627 }, 29628 "requires": [ 29629 "yql" 29630 ] 29631 }, 29632 "yui": {}, 29633 "yui-base": {}, 29634 "yui-later": { 29635 "requires": [ 29636 "yui-base" 29637 ] 29638 }, 29639 "yui-log": { 29640 "requires": [ 29641 "yui-base" 29642 ] 29643 }, 29644 "yui-throttle": { 29645 "requires": [ 29646 "yui-base" 29647 ] 29648 } 29649}); 29650YUI.Env[Y.version].md5 = 'f20377d5ab6d37137f73ea79d6eb476d'; 29651 29652 29653}, 'patched-v3.18.1', {"requires": ["loader-base"]}); 29654YUI.add('yui', function (Y, NAME) {}, 'patched-v3.18.1', { 29655 "use": [ 29656 "yui-base", 29657 "get", 29658 "features", 29659 "intl-base", 29660 "yui-log", 29661 "yui-later", 29662 "loader-base", 29663 "loader-rollup", 29664 "loader-yui3" 29665 ] 29666}); 29667YUI.add('aui-base-core', function (A, NAME) { 29668 29669var Y = A; 29670YUI.Env.aliases = YUI.Env.aliases || {}; 29671Y.mix(YUI.Env.aliases, { 29672 "aui-autosize": ["aui-autosize-iframe"], 29673 "aui-base": ["oop","yui-throttle","aui-classnamemanager","aui-debounce","aui-base-core","aui-base-lang","aui-node-base"], 29674 "aui-base-deprecated": ["aui-base","aui-node","aui-component","aui-delayed-task-deprecated","aui-selector","aui-event-base"], 29675 "aui-button": ["aui-button-core"], 29676 "aui-collection": ["aui-map","aui-set","aui-linkedset"], 29677 "aui-color-picker-deprecated": ["aui-color-picker-base-deprecated","aui-color-picker-grid-plugin-deprecated"], 29678 "aui-datasource-control-deprecated": ["aui-datasource-control-base-deprecated","aui-input-text-control-deprecated"], 29679 "aui-datatable": ["aui-datatable-edit","aui-datatable-highlight","aui-datatable-selection","aui-datatable-property-list"], 29680 "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"], 29681 "aui-datepicker-deprecated": ["aui-datepicker-base-deprecated","aui-datepicker-select-deprecated"], 29682 "aui-event": ["aui-event-base"], 29683 "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"], 29684 "aui-io": ["aui-io-request"], 29685 "aui-io-deprecated": ["aui-io-request","aui-io-plugin-deprecated"], 29686 "aui-node": ["aui-node-base"], 29687 "aui-overlay-deprecated": ["aui-overlay-base-deprecated","aui-overlay-context-deprecated","aui-overlay-context-panel-deprecated","aui-overlay-manager-deprecated","aui-overlay-mask-deprecated"], 29688 "aui-rating": ["aui-rating-base","aui-rating-thumb"], 29689 "aui-resize-deprecated": ["aui-resize-base-deprecated","aui-resize-constrain-deprecated"], 29690 "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"], 29691 "aui-search": ["aui-search-tst"], 29692 "aui-sortable": ["aui-sortable-layout","aui-sortable-list"], 29693 "aui-surface": ["aui-surface-app","aui-surface-screen"], 29694 "aui-toggler": ["aui-toggler-base","aui-toggler-delegate"], 29695 "aui-tooltip": ["aui-tooltip-base","aui-tooltip-delegate"], 29696 "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"], 29697 "aui-tree": ["aui-tree-data","aui-tree-io","aui-tree-node","aui-tree-paginator","aui-tree-view"], 29698 "aui-widget": ["aui-widget-cssclass","aui-widget-toolbars"], 29699 "aui-widget-core": ["aui-widget-cssclass"] 29700}); 29701/* This file is auto-generated by (yogi loader --yes --mix --js js/aui-loader.js --json js/aui-loader.json --start ../) */ 29702 29703/*jshint maxlen:900, eqeqeq: false */ 29704 29705/** 29706 * YUI 3 module metadata 29707 * @module loader 29708 * @submodule loader-yui3 29709 */ 29710YUI.Env[Y.version].modules = YUI.Env[Y.version].modules || {}; 29711Y.mix(YUI.Env[Y.version].modules, { 29712 "aui-ace-autocomplete-base": { 29713 "requires": [ 29714 "aui-ace-editor" 29715 ] 29716 }, 29717 "aui-ace-autocomplete-freemarker": { 29718 "requires": [ 29719 "aui-ace-autocomplete-templateprocessor" 29720 ] 29721 }, 29722 "aui-ace-autocomplete-list": { 29723 "requires": [ 29724 "aui-ace-autocomplete-base", 29725 "overlay", 29726 "widget-autohide" 29727 ], 29728 "skinnable": true 29729 }, 29730 "aui-ace-autocomplete-plugin": { 29731 "requires": [ 29732 "aui-ace-autocomplete-list", 29733 "plugin" 29734 ] 29735 }, 29736 "aui-ace-autocomplete-templateprocessor": { 29737 "requires": [ 29738 "aui-ace-autocomplete-base" 29739 ] 29740 }, 29741 "aui-ace-autocomplete-velocity": { 29742 "requires": [ 29743 "aui-ace-autocomplete-templateprocessor" 29744 ] 29745 }, 29746 "aui-ace-editor": { 29747 "requires": [ 29748 "aui-node", 29749 "aui-component" 29750 ] 29751 }, 29752 "aui-affix": { 29753 "requires": [ 29754 "base", 29755 "node-screen", 29756 "aui-node" 29757 ] 29758 }, 29759 "aui-alert": { 29760 "requires": [ 29761 "aui-aria", 29762 "aui-classnamemanager", 29763 "aui-widget-cssclass", 29764 "aui-widget-transition", 29765 "timers", 29766 "widget", 29767 "widget-stdmod" 29768 ], 29769 "skinnable": true 29770 }, 29771 "aui-aria": { 29772 "requires": [ 29773 "plugin", 29774 "aui-component" 29775 ] 29776 }, 29777 "aui-aria-table-sortable": { 29778 "requires": [ 29779 "aui-aria" 29780 ] 29781 }, 29782 "aui-arraysort": { 29783 "requires": [ 29784 "arraysort" 29785 ] 29786 }, 29787 "aui-audio": { 29788 "requires": [ 29789 "aui-aria", 29790 "aui-node", 29791 "aui-component", 29792 "node-event-html5", 29793 "querystring-stringify-simple" 29794 ], 29795 "skinnable": true 29796 }, 29797 "aui-autocomplete-deprecated": { 29798 "requires": [ 29799 "aui-base-deprecated", 29800 "aui-overlay-base-deprecated", 29801 "datasource", 29802 "dataschema", 29803 "aui-form-combobox-deprecated" 29804 ], 29805 "skinnable": true 29806 }, 29807 "aui-autosize": { 29808 "use": [ 29809 "aui-autosize-iframe" 29810 ] 29811 }, 29812 "aui-autosize-deprecated": { 29813 "requires": [ 29814 "event-valuechange", 29815 "plugin", 29816 "aui-base-deprecated" 29817 ], 29818 "skinnable": true 29819 }, 29820 "aui-autosize-iframe": { 29821 "requires": [ 29822 "plugin", 29823 "aui-component", 29824 "aui-timer", 29825 "aui-node-base" 29826 ] 29827 }, 29828 "aui-base": { 29829 "use": [ 29830 "oop", 29831 "yui-throttle", 29832 "aui-classnamemanager", 29833 "aui-debounce", 29834 "aui-base-core", 29835 "aui-base-lang", 29836 "aui-node-base" 29837 ] 29838 }, 29839 "aui-base-core": {}, 29840 "aui-base-deprecated": { 29841 "use": [ 29842 "aui-base", 29843 "aui-node", 29844 "aui-component", 29845 "aui-delayed-task-deprecated", 29846 "aui-selector", 29847 "aui-event-base" 29848 ] 29849 }, 29850 "aui-base-html5-shiv": { 29851 "condition": { 29852 "name": "aui-base-html5-shiv", 29853 "trigger": "node-base", 29854 "ua": "ie" 29855 } 29856 }, 29857 "aui-base-lang": {}, 29858 "aui-boolean-data-editor": { 29859 "requires": [ 29860 "aui-button-switch", 29861 "aui-data-editor" 29862 ] 29863 }, 29864 "aui-button": { 29865 "use": [ 29866 "aui-button-core" 29867 ] 29868 }, 29869 "aui-button-core": { 29870 "requires": [ 29871 "button", 29872 "button-group", 29873 "button-plugin", 29874 "aui-component", 29875 "aui-widget-cssclass", 29876 "aui-widget-toggle" 29877 ], 29878 "skinnable": true 29879 }, 29880 "aui-button-item-deprecated": { 29881 "requires": [ 29882 "aui-base-deprecated", 29883 "aui-state-interaction-deprecated", 29884 "widget-child" 29885 ], 29886 "skinnable": true 29887 }, 29888 "aui-button-search-cancel": { 29889 "requires": [ 29890 "array-invoke", 29891 "base", 29892 "base-build", 29893 "event-focus", 29894 "event-move", 29895 "event-resize", 29896 "node-screen", 29897 "node-event-delegate", 29898 "aui-node-base", 29899 "aui-classnamemanager", 29900 "aui-event-input" 29901 ] 29902 }, 29903 "aui-button-switch": { 29904 "requires": [ 29905 "aui-node-base", 29906 "base-build", 29907 "event-key", 29908 "transition", 29909 "widget" 29910 ], 29911 "skinnable": true 29912 }, 29913 "aui-carousel": { 29914 "requires": [ 29915 "anim", 29916 "aui-event", 29917 "aui-image-viewer-base", 29918 "aui-image-viewer-slideshow", 29919 "node-event-delegate", 29920 "node-focusmanager" 29921 ], 29922 "skinnable": true 29923 }, 29924 "aui-carousel-mobile-touch": { 29925 "condition": { 29926 "name": "aui-carousel-mobile-touch", 29927 "test": function(A) { 29928 return A.UA.mobile && A.UA.touchEnabled; 29929}, 29930 "trigger": "aui-carousel" 29931 }, 29932 "requires": [ 29933 "base-build", 29934 "aui-carousel" 29935 ] 29936 }, 29937 "aui-carousel-swipe": { 29938 "condition": { 29939 "name": "aui-carousel-swipe", 29940 "trigger": "aui-carousel", 29941 "ua": "touchEnabled" 29942 }, 29943 "requires": [ 29944 "aui-carousel", 29945 "aui-widget-swipe", 29946 "base-build" 29947 ], 29948 "skinnable": true 29949 },
29950 "aui-char-counter": { 29951 "requires": [ 29952 "aui-aria", 29953 "aui-node", 29954 "aui-event-input", 29955 "aui-component" 29956 ] 29957 }, 29958 "aui-chart-deprecated": { 29959 "requires": [ 29960 "datasource", 29961 "json", 29962 "aui-swf-deprecated" 29963 ] 29964 }, 29965 "aui-classnamemanager": { 29966 "requires": [ 29967 "classnamemanager" 29968 ] 29969 }, 29970 "aui-collection": { 29971 "use": [ 29972 "aui-map", 29973 "aui-set", 29974 "aui-linkedset" 29975 ] 29976 }, 29977 "aui-color-palette": { 29978 "requires": [ 29979 "array-extras", 29980 "aui-palette", 29981 "color-base", 29982 "node-core", 29983 "aui-widget-cssclass", 29984 "aui-widget-toggle" 29985 ], 29986 "skinnable": true 29987 }, 29988 "aui-color-picker-base": { 29989 "requires": [ 29990 "aui-color-palette", 29991 "aui-hsva-palette-modal", 29992 "event-outside" 29993 ], 29994 "skinnable": true 29995 }, 29996 "aui-color-picker-base-deprecated": { 29997 "requires": [ 29998 "dd-drag", 29999 "panel", 30000 "slider", 30001 "aui-button-item-deprecated", 30002 "aui-color-util-deprecated", 30003 "aui-form-base-deprecated", 30004 "aui-overlay-context-deprecated" 30005 ], 30006 "skinnable": true 30007 }, 30008 "aui-color-picker-deprecated": { 30009 "use": [ 30010 "aui-color-picker-base-deprecated", 30011 "aui-color-picker-grid-plugin-deprecated" 30012 ] 30013 }, 30014 "aui-color-picker-grid-plugin-deprecated": { 30015 "requires": [ 30016 "plugin", 30017 "aui-color-picker-base-deprecated" 30018 ], 30019 "skinnable": true 30020 }, 30021 "aui-color-picker-popover": { 30022 "requires": [ 30023 "aui-color-picker-base", 30024 "aui-popover", 30025 "aui-widget-cssclass", 30026 "aui-widget-toggle" 30027 ], 30028 "skinnable": true 30029 }, 30030 "aui-color-util-deprecated": { 30031 "requires": [] 30032 }, 30033 "aui-component": { 30034 "requires": [ 30035 "aui-classnamemanager", 30036 "aui-widget-cssclass", 30037 "aui-widget-toggle", 30038 "base-build", 30039 "widget-base" 30040 ] 30041 }, 30042 "aui-css": { 30043 "type": "css" 30044 }, 30045 "aui-data-editor": { 30046 "requires": [ 30047 "aui-classnamemanager", 30048 "base-build", 30049 "node-base" 30050 ], 30051 "skinnable": true 30052 }, 30053 "aui-data-set-deprecated": { 30054 "requires": [ 30055 "oop", 30056 "collection", 30057 "base" 30058 ] 30059 }, 30060 "aui-datasource-control-base-deprecated": { 30061 "requires": [ 30062 "datasource", 30063 "dataschema", 30064 "aui-base-deprecated" 30065 ] 30066 }, 30067 "aui-datasource-control-deprecated": { 30068 "use": [ 30069 "aui-datasource-control-base-deprecated", 30070 "aui-input-text-control-deprecated" 30071 ] 30072 }, 30073 "aui-datatable": { 30074 "use": [ 30075 "aui-datatable-edit", 30076 "aui-datatable-highlight", 30077 "aui-datatable-selection", 30078 "aui-datatable-property-list" 30079 ] 30080 }, 30081 "aui-datatable-base-cell-editor": { 30082 "requires": [ 30083 "datatable-base", 30084 "overlay" 30085 ], 30086 "skinnable": true 30087 }, 30088 "aui-datatable-base-options-cell-editor": { 30089 "requires": [ 30090 "aui-datatable-base-cell-editor", 30091 "escape" 30092 ], 30093 "skinnable": true 30094 }, 30095 "aui-datatable-body": { 30096 "requires": [ 30097 "aui-classnamemanager", 30098 "datatable-base", 30099 "event-key", 30100 "aui-event-base" 30101 ] 30102 }, 30103 "aui-datatable-cell-editor-support": { 30104 "requires": [ 30105 "datatable-base" 30106 ] 30107 }, 30108 "aui-datatable-checkbox-cell-editor": { 30109 "requires": [ 30110 "aui-datatable-base-options-cell-editor" 30111 ] 30112 }, 30113 "aui-datatable-core": { 30114 "requires": [ 30115 "aui-datatable-body", 30116 "datatable-base", 30117 "event-key", 30118 "aui-event-base" 30119 ], 30120 "skinnable": true 30121 }, 30122 "aui-datatable-date-cell-editor": { 30123 "requires": [ 30124 "aui-datatable-base-options-cell-editor" 30125 ] 30126 }, 30127 "aui-datatable-dropdown-cell-editor": { 30128 "requires": [ 30129 "aui-datatable-base-options-cell-editor" 30130 ] 30131 }, 30132 "aui-datatable-edit": { 30133 "use": [ 30134 "datatable-base", 30135 "calendar", 30136 "overlay", 30137 "sortable", 30138 "aui-datatype", 30139 "aui-toolbar", 30140 "aui-form-validator", 30141 "aui-datatable-base-cell-editor", 30142 "aui-datatable-base-options-cell-editor", 30143 "aui-datatable-cell-editor-support", 30144 "aui-datatable-core", 30145 "aui-datatable-checkbox-cell-editor", 30146 "aui-datatable-date-cell-editor", 30147 "aui-datatable-dropdown-cell-editor", 30148 "aui-datatable-radio-cell-editor", 30149 "aui-datatable-text-cell-editor", 30150 "aui-datatable-text-area-cell-editor" 30151 ] 30152 }, 30153 "aui-datatable-highlight": { 30154 "requires": [ 30155 "aui-datatable-selection" 30156 ], 30157 "skinnable": true 30158 }, 30159 "aui-datatable-property-list": { 30160 "requires": [ 30161 "datatable-scroll", 30162 "datatable-sort", 30163 "aui-datatable-core", 30164 "aui-datatable-edit", 30165 "aui-datatable-highlight", 30166 "aui-datatable-selection", 30167 "aui-widget-cssclass", 30168 "aui-widget-toggle" 30169 ], 30170 "skinnable": true 30171 }, 30172 "aui-datatable-radio-cell-editor": { 30173 "requires": [ 30174 "aui-datatable-base-options-cell-editor" 30175 ] 30176 }, 30177 "aui-datatable-selection": { 30178 "requires": [ 30179 "aui-datatable-core" 30180 ], 30181 "skinnable": true 30182 }, 30183 "aui-datatable-text-area-cell-editor": { 30184 "requires": [ 30185 "aui-datatable-base-options-cell-editor" 30186 ] 30187 }, 30188 "aui-datatable-text-cell-editor": { 30189 "requires": [ 30190 "aui-datatable-base-options-cell-editor" 30191 ] 30192 }, 30193 "aui-datatype": { 30194 "requires": [ 30195 "datatype", 30196 "aui-datatype-date-parse" 30197 ] 30198 }, 30199 "aui-datatype-date-parse": { 30200 "requires": [ 30201 "aui-base-lang", 30202 "datatype-date-format", 30203 "datatype-date-parse", 30204 "intl" 30205 ] 30206 }, 30207 "aui-datepicker": { 30208 "requires": [ 30209 "aui-aria", 30210 "aui-datepicker-delegate", 30211 "aui-datepicker-popover", 30212 "base", 30213 "base-build", 30214 "calendar" 30215 ], 30216 "skinnable": true 30217 }, 30218 "aui-datepicker-base-deprecated": { 30219 "requires": [ 30220 "calendar", 30221 "aui-datatype", 30222 "aui-overlay-context-deprecated" 30223 ], 30224 "skinnable": true 30225 }, 30226 "aui-datepicker-delegate": { 30227 "requires": [ 30228 "aui-datatype-date-parse", 30229 "aui-event-input", 30230 "event-focus", 30231 "node-event-delegate" 30232 ] 30233 }, 30234 "aui-datepicker-deprecated": { 30235 "skinnable": true, 30236 "use": [ 30237 "aui-datepicker-base-deprecated", 30238 "aui-datepicker-select-deprecated" 30239 ] 30240 }, 30241 "aui-datepicker-native": { 30242 "requires": [ 30243 "aui-datepicker-delegate", 30244 "aui-node-base", 30245 "base", 30246 "base-build" 30247 ] 30248 }, 30249 "aui-datepicker-popover": { 30250 "requires": [ 30251 "aui-classnamemanager", 30252 "aui-popover" 30253 ] 30254 }, 30255 "aui-datepicker-select-deprecated": { 30256 "requires": [ 30257 "aui-datepicker-base-deprecated", 30258 "aui-button-item-deprecated" 30259 ], 30260 "skinnable": true 30261 }, 30262 "aui-debounce": {}, 30263 "aui-delayed-task-deprecated": { 30264 "requires": [ 30265 "yui-base" 30266 ] 30267 }, 30268 "aui-diagram-builder": { 30269 "requires": [ 30270 "aui-aria", 30271 "aui-map", 30272 "aui-property-builder",
30273 "aui-diagram-builder-connector", 30274 "aui-property-builder-settings", 30275 "aui-diagram-node-condition", 30276 "aui-diagram-node-end", 30277 "aui-diagram-node-fork", 30278 "aui-diagram-node-join", 30279 "aui-diagram-node-start", 30280 "aui-diagram-node-state", 30281 "aui-diagram-node-task", 30282 "overlay" 30283 ], 30284 "skinnable": true 30285 }, 30286 "aui-diagram-builder-connector": { 30287 "requires": [ 30288 "arraylist-add", 30289 "arraylist-filter", 30290 "escape", 30291 "json", 30292 "graphics", 30293 "dd" 30294 ], 30295 "skinnable": true 30296 }, 30297 "aui-diagram-node": { 30298 "requires": [ 30299 "aui-aria", 30300 "aui-diagram-node-manager-base", 30301 "escape", 30302 "overlay" 30303 ] 30304 }, 30305 "aui-diagram-node-condition": { 30306 "requires": [ 30307 "aui-diagram-node-state" 30308 ] 30309 }, 30310 "aui-diagram-node-end": { 30311 "requires": [ 30312 "aui-diagram-node-state" 30313 ] 30314 }, 30315 "aui-diagram-node-fork": { 30316 "requires": [ 30317 "aui-diagram-node-state" 30318 ] 30319 }, 30320 "aui-diagram-node-join": { 30321 "requires": [ 30322 "aui-diagram-node-state" 30323 ] 30324 }, 30325 "aui-diagram-node-manager-base": { 30326 "requires": [ 30327 "base" 30328 ] 30329 }, 30330 "aui-diagram-node-start": { 30331 "requires": [ 30332 "aui-diagram-node-state" 30333 ] 30334 }, 30335 "aui-diagram-node-state": { 30336 "requires": [ 30337 "aui-diagram-node" 30338 ] 30339 }, 30340 "aui-diagram-node-task": { 30341 "requires": [ 30342 "aui-diagram-node-state" 30343 ] 30344 }, 30345 "aui-dialog-iframe-deprecated": { 30346 "requires": [ 30347 "plugin", 30348 "array-invoke", 30349 "aui-base-deprecated", 30350 "aui-loading-mask-deprecated" 30351 ], 30352 "skinnable": true 30353 }, 30354 "aui-dropdown": { 30355 "requires": [ 30356 "event-delegate", 30357 "event-key", 30358 "event-outside", 30359 "node-focusmanager", 30360 "widget", 30361 "widget-stack", 30362 "aui-classnamemanager", 30363 "aui-node", 30364 "aui-widget-cssclass", 30365 "aui-widget-toggle", 30366 "aui-widget-trigger" 30367 ], 30368 "skinnable": true 30369 }, 30370 "aui-editable-deprecated": { 30371 "requires": [ 30372 "aui-base-deprecated", 30373 "aui-form-combobox-deprecated", 30374 "escape", 30375 "event-resize" 30376 ], 30377 "skinnable": true 30378 }, 30379 "aui-event": { 30380 "use": [ 30381 "aui-event-base" 30382 ] 30383 }, 30384 "aui-event-base": { 30385 "requires": [ 30386 "event-base" 30387 ] 30388 }, 30389 "aui-event-delegate-change": { 30390 "condition": { 30391 "name": "aui-event-delegate-change", 30392 "trigger": "event-base-ie", 30393 "ua": "ie" 30394 }, 30395 "requires": [ 30396 "aui-event-base", 30397 "event-delegate", 30398 "event-synthetic" 30399 ] 30400 }, 30401 "aui-event-delegate-submit": { 30402 "condition": { 30403 "name": "aui-event-delegate-submit", 30404 "trigger": "event-base-ie", 30405 "ua": "ie" 30406 }, 30407 "requires": [ 30408 "aui-event-base", 30409 "event-delegate", 30410 "event-synthetic" 30411 ] 30412 }, 30413 "aui-event-input": { 30414 "condition": { 30415 "name": "aui-event-input", 30416 "test": function(A) { 30417 var supportsDOMEvent = A.supportsDOMEvent, 30418 testFeature = A.Features.test, 30419 addFeature = A.Features.add; 30420 30421 if (testFeature('event', 'input') === undefined) { 30422 addFeature('event', 'input', { 30423 test: function() { 30424 return supportsDOMEvent(document.createElement('textarea'), 'input') && (!A.UA.ie || A.UA.ie > 9); 30425 } 30426 }); 30427 } 30428 30429 return !testFeature('event', 'input'); 30430}, 30431 "trigger": "aui-event-base" 30432 }, 30433 "requires": [ 30434 "aui-event-base", 30435 "event-delegate", 30436 "event-synthetic", 30437 "timers" 30438 ] 30439 }, 30440 "aui-form-base-deprecated": { 30441 "requires": [ 30442 "io-form", 30443 "querystring-parse", 30444 "aui-base-deprecated", 30445 "aui-data-set-deprecated", 30446 "aui-form-field-deprecated" 30447 ] 30448 }, 30449 "aui-form-builder": { 30450 "requires": [ 30451 "aui-modal", 30452 "aui-layout",
30453 "aui-form-builder-field-list", 30454 "aui-form-builder-field-toolbar", 30455 "aui-form-builder-field-type", 30456 "aui-form-builder-field-types", 30457 "aui-form-builder-layout-builder", 30458 "aui-form-builder-page-manager", 30459 "aui-form-builder-settings-modal", 30460 "event-focus", 30461 "event-tap" 30462 ], 30463 "skinnable": true 30464 }, 30465 "aui-form-builder-available-field-deprecated": { 30466 "requires": [ 30467 "aui-property-builder-available-field" 30468 ] 30469 }, 30470 "aui-form-builder-deprecated": { 30471 "requires": [ 30472 "aui-button", 30473 "aui-collection", 30474 "aui-form-builder-available-field-deprecated", 30475 "aui-form-builder-field-deprecated", 30476 "aui-form-builder-field-button-deprecated", 30477 "aui-form-builder-field-checkbox-deprecated", 30478 "aui-form-builder-field-fieldset-deprecated", 30479 "aui-form-builder-field-file-upload-deprecated", 30480 "aui-form-builder-field-multiple-choice-deprecated", 30481 "aui-form-builder-field-radio-deprecated", 30482 "aui-form-builder-field-select-deprecated", 30483 "aui-form-builder-field-text-deprecated", 30484 "aui-form-builder-field-textarea-deprecated", 30485 "aui-property-builder", 30486 "aui-property-builder-settings", 30487 "aui-sortable-list", 30488 "aui-tabview", 30489 "aui-tooltip-base", 30490 "escape", 30491 "transition" 30492 ], 30493 "skinnable": true 30494 }, 30495 "aui-form-builder-field-base": { 30496 "requires": [ 30497 "aui-classnamemanager", 30498 "aui-node-base", 30499 "aui-text-data-editor", 30500 "aui-toggler", 30501 "base", 30502 "node-base" 30503 ], 30504 "skinnable": true 30505 }, 30506 "aui-form-builder-field-button-deprecated": { 30507 "requires": [ 30508 "aui-form-builder-field-deprecated" 30509 ] 30510 }, 30511 "aui-form-builder-field-checkbox-deprecated": { 30512 "requires": [ 30513 "aui-form-builder-field-deprecated" 30514 ] 30515 }, 30516 "aui-form-builder-field-choice": { 30517 "requires": [ 30518 "aui-boolean-data-editor", 30519 "aui-options-data-editor", 30520 "aui-tabs-data-editor", 30521 "aui-form-builder-field-base", 30522 "aui-form-field-choice" 30523 ] 30524 }, 30525 "aui-form-builder-field-deprecated": { 30526 "requires": [ 30527 "panel", 30528 "aui-datatype", 30529 "aui-datatable-edit", 30530 "aui-property-builder-field-support" 30531 ], 30532 "skinnable": true 30533 }, 30534 "aui-form-builder-field-fieldset-deprecated": { 30535 "requires": [ 30536 "aui-form-builder-field-deprecated" 30537 ] 30538 }, 30539 "aui-form-builder-field-file-upload-deprecated": { 30540 "requires": [ 30541 "aui-form-builder-field-deprecated" 30542 ] 30543 }, 30544 "aui-form-builder-field-list": { 30545 "requires": [ 30546 "aui-form-builder-field-type", 30547 "aui-form-builder-field-types", 30548 "aui-form-builder-layout-builder" 30549 ], 30550 "skinnable": true 30551 }, 30552 "aui-form-builder-field-multiple-choice-deprecated": { 30553 "requires": [ 30554 "aui-form-builder-field-deprecated" 30555 ] 30556 }, 30557 "aui-form-builder-field-radio-deprecated": { 30558 "requires": [ 30559 "aui-form-builder-field-deprecated" 30560 ] 30561 }, 30562 "aui-form-builder-field-select-deprecated": { 30563 "requires": [ 30564 "aui-form-builder-field-deprecated" 30565 ] 30566 }, 30567 "aui-form-builder-field-sentence": { 30568 "requires": [ 30569 "aui-form-builder-field-base", 30570 "aui-form-field" 30571 ] 30572 }, 30573 "aui-form-builder-field-text": { 30574 "requires": [ 30575 "aui-boolean-data-editor", 30576 "aui-radio-group-data-editor", 30577 "aui-form-builder-field-base", 30578 "aui-form-field-text" 30579 ] 30580 }, 30581 "aui-form-builder-field-text-deprecated": { 30582 "requires": [ 30583 "aui-form-builder-field-deprecated" 30584 ] 30585 },
30586 "aui-form-builder-field-textarea-deprecated": { 30587 "requires": [ 30588 "aui-form-builder-field-deprecated" 30589 ] 30590 }, 30591 "aui-form-builder-field-toolbar": { 30592 "requires": [ 30593 "aui-classnamemanager", 30594 "base", 30595 "node-base" 30596 ], 30597 "skinnable": true 30598 }, 30599 "aui-form-builder-field-type": { 30600 "requires": [ 30601 "base", 30602 "node-base" 30603 ], 30604 "skinnable": true 30605 }, 30606 "aui-form-builder-field-types": { 30607 "requires": [ 30608 "aui-classnamemanager", 30609 "aui-form-builder-field-types-modal", 30610 "base", 30611 "node-base" 30612 ], 30613 "skinnable": true 30614 }, 30615 "aui-form-builder-field-types-modal": { 30616 "requires": [ 30617 "aui-modal" 30618 ], 30619 "skinnable": true 30620 }, 30621 "aui-form-builder-layout-builder": { 30622 "requires": [ 30623 "aui-classnamemanager", 30624 "aui-layout-builder", 30625 "aui-modal", 30626 "base", 30627 "node-base" 30628 ], 30629 "skinnable": true 30630 }, 30631 "aui-form-builder-page-manager": { 30632 "requires": [ 30633 "aui-pagination", 30634 "aui-popover", 30635 "aui-tabview", 30636 "base", 30637 "event-valuechange", 30638 "node-base" 30639 ], 30640 "skinnable": true 30641 }, 30642 "aui-form-builder-settings-modal": { 30643 "requires": [ 30644 "aui-classnamemanager", 30645 "aui-modal", 30646 "base", 30647 "node-base" 30648 ], 30649 "skinnable": true 30650 }, 30651 "aui-form-combobox-deprecated": { 30652 "requires": [ 30653 "aui-form-textarea-deprecated", 30654 "aui-toolbar" 30655 ], 30656 "skinnable": true 30657 }, 30658 "aui-form-deprecated": { 30659 "use": [ 30660 "aui-form-base-deprecated", 30661 "aui-form-combobox-deprecated", 30662 "aui-form-field-deprecated", 30663 "aui-form-select-deprecated", 30664 "aui-form-textarea-deprecated", 30665 "aui-form-textfield-deprecated" 30666 ] 30667 }, 30668 "aui-form-field": { 30669 "requires": [ 30670 "aui-classnamemanager", 30671 "aui-node-base", 30672 "base-build" 30673 ], 30674 "skinnable": true 30675 }, 30676 "aui-form-field-choice": { 30677 "requires": [ 30678 "aui-form-field-required" 30679 ], 30680 "skinnable": true 30681 }, 30682 "aui-form-field-deprecated": { 30683 "requires": [ 30684 "aui-base-deprecated", 30685 "aui-component" 30686 ] 30687 }, 30688 "aui-form-field-required": { 30689 "requires": [ 30690 "aui-form-field" 30691 ] 30692 }, 30693 "aui-form-field-text": { 30694 "requires": [ 30695 "aui-form-field-required" 30696 ], 30697 "skinnable": true 30698 }, 30699 "aui-form-select-deprecated": { 30700 "requires": [ 30701 "aui-form-field-deprecated" 30702 ] 30703 }, 30704 "aui-form-textarea-deprecated": { 30705 "requires": [ 30706 "node-pluginhost", 30707 "aui-autosize-deprecated", 30708 "aui-form-textfield-deprecated" 30709 ] 30710 }, 30711 "aui-form-textfield-deprecated": { 30712 "requires": [ 30713 "aui-form-field-deprecated" 30714 ] 30715 }, 30716 "aui-form-validator": { 30717 "requires": [ 30718 "escape", 30719 "selector-css3", 30720 "node-event-delegate", 30721 "aui-node", 30722 "aui-component", 30723 "aui-event-input" 30724 ] 30725 }, 30726 "aui-hsv-palette": { 30727 "requires": [ 30728 "aui-classnamemanager", 30729 "aui-widget-cssclass", 30730 "aui-widget-toggle", 30731 "aui-event-input", 30732 "base-build", 30733 "clickable-rail", 30734 "color-hsv", 30735 "dd-constrain", 30736 "slider", 30737 "widget" 30738 ], 30739 "skinnable": true 30740 }, 30741 "aui-hsva-palette": { 30742 "requires": [ 30743 "aui-hsv-palette" 30744 ], 30745 "skinnable": true 30746 }, 30747 "aui-hsva-palette-modal": { 30748 "requires": [ 30749 "aui-hsva-palette", 30750 "aui-modal" 30751 ], 30752 "skinnable": true 30753 }, 30754 "aui-image-cropper": { 30755 "requires": [ 30756 "resize-base", 30757 "resize-constrain", 30758 "dd-constrain", 30759 "aui-node-base", 30760 "aui-component" 30761 ], 30762 "skinnable": true 30763 }, 30764 "aui-image-viewer": { 30765 "requires": [ 30766 "widget", 30767 "widget-modality", 30768 "widget-position", 30769 "widget-position-align", 30770 "widget-position-constrain", 30771 "widget-stack", 30772 "widget-stdmod", 30773 "aui-event", 30774 "aui-image-viewer-base", 30775 "aui-image-viewer-multiple", 30776 "aui-image-viewer-slideshow", 30777 "aui-node-base", 30778 "aui-widget-cssclass", 30779 "aui-widget-toggle" 30780 ], 30781 "skinnable": true 30782 }, 30783 "aui-image-viewer-base": { 30784 "requires": [ 30785 "anim", 30786 "aui-aria", 30787 "aui-classnamemanager", 30788 "aui-node", 30789 "aui-widget-responsive", 30790 "base-build", 30791 "imageloader", 30792 "node-base", 30793 "widget", 30794 "widget-stack" 30795 ], 30796 "skinnable": true 30797 }, 30798 "aui-image-viewer-media": { 30799 "requires": [ 30800 "plugin", 30801 "aui-component", 30802 "aui-image-viewer" 30803 ] 30804 }, 30805 "aui-image-viewer-multiple": { 30806 "requires": [ 30807 "base-build", 30808 "node-base", 30809 "aui-classnamemanager", 30810 "aui-image-viewer-base" 30811 ], 30812 "skinnable": true 30813 }, 30814 "aui-image-viewer-multiple-swipe": { 30815 "condition": { 30816 "name": "aui-image-viewer-multiple-swipe", 30817 "trigger": "aui-image-viewer-multiple", 30818 "ua": "touchEnabled" 30819 }, 30820 "requires": [ 30821 "aui-image-viewer-multiple",
30822 "aui-image-viewer-swipe" 30823 ] 30824 }, 30825 "aui-image-viewer-slideshow": { 30826 "requires": [ 30827 "node", 30828 "aui-classnamemanager" 30829 ] 30830 }, 30831 "aui-image-viewer-swipe": { 30832 "condition": { 30833 "name": "aui-image-viewer-swipe", 30834 "trigger": "aui-image-viewer-base", 30835 "ua": "touchEnabled" 30836 }, 30837 "requires": [ 30838 "event-resize", 30839 "aui-image-viewer-base", 30840 "aui-widget-swipe" 30841 ] 30842 }, 30843 "aui-input-text-control-deprecated": { 30844 "requires": [ 30845 "aui-base-deprecated", 30846 "aui-datasource-control-base-deprecated", 30847 "aui-form-combobox-deprecated" 30848 ] 30849 }, 30850 "aui-io": { 30851 "use": [ 30852 "aui-io-request" 30853 ] 30854 }, 30855 "aui-io-deprecated": { 30856 "use": [ 30857 "aui-io-request", 30858 "aui-io-plugin-deprecated" 30859 ] 30860 }, 30861 "aui-io-plugin-deprecated": { 30862 "requires": [ 30863 "aui-overlay-base-deprecated", 30864 "aui-parse-content", 30865 "aui-io-request", 30866 "aui-loading-mask-deprecated" 30867 ] 30868 }, 30869 "aui-io-request": { 30870 "requires": [ 30871 "io-base", 30872 "json", 30873 "plugin", 30874 "querystring-stringify", 30875 "aui-component" 30876 ] 30877 }, 30878 "aui-io-request-deprecated": { 30879 "requires": [ 30880 "io-base", 30881 "json", 30882 "plugin", 30883 "querystring-stringify", 30884 "aui-base-deprecated" 30885 ] 30886 }, 30887 "aui-layout": { 30888 "requires": [ 30889 "aui-layout-col", 30890 "aui-layout-row", 30891 "aui-node-base", 30892 "base-build", 30893 "datatype-number-parse", 30894 "event-resize" 30895 ] 30896 }, 30897 "aui-layout-builder": { 30898 "requires": [ 30899 "aui-classnamemanager", 30900 "aui-layout", 30901 "aui-layout-builder-add-col", 30902 "aui-layout-builder-add-row", 30903 "aui-layout-builder-move", 30904 "aui-layout-builder-remove-row", 30905 "aui-layout-builder-resize-col", 30906 "aui-node-base", 30907 "base-build", 30908 "node-event-delegate", 30909 "node-screen", 30910 "node-style" 30911 ] 30912 }, 30913 "aui-layout-builder-add-col": { 30914 "requires": [ 30915 "event-key", 30916 "node-base" 30917 ], 30918 "skinnable": true 30919 }, 30920 "aui-layout-builder-add-row": { 30921 "requires": [ 30922 "aui-node-base", 30923 "base-build", 30924 "node-scroll-info" 30925 ], 30926 "skinnable": true 30927 }, 30928 "aui-layout-builder-move": { 30929 "requires": [ 30930 "aui-node-base", 30931 "base-build" 30932 ], 30933 "skinnable": true 30934 }, 30935 "aui-layout-builder-remove-row": { 30936 "requires": [ 30937 "aui-node-base", 30938 "base-build" 30939 ], 30940 "skinnable": true 30941 }, 30942 "aui-layout-builder-resize-col": { 30943 "requires": [ 30944 "dd-constrain", 30945 "dd-delegate", 30946 "dd-drop-plugin", 30947 "dd-proxy", 30948 "event-mouseenter", 30949 "node-base" 30950 ], 30951 "skinnable": true 30952 }, 30953 "aui-layout-col": { 30954 "requires": [ 30955 "aui-classnamemanager", 30956 "aui-node-base", 30957 "base-build" 30958 ], 30959 "skinnable": true 30960 }, 30961 "aui-layout-row": { 30962 "requires": [ 30963 "array-invoke", 30964 "aui-node-base", 30965 "base-build" 30966 ], 30967 "skinnable": true 30968 }, 30969 "aui-linkedset": { 30970 "requires": [ 30971 "aui-set" 30972 ] 30973 }, 30974 "aui-live-search-deprecated": { 30975 "requires": [ 30976 "aui-base-deprecated" 30977 ] 30978 }, 30979 "aui-loading-mask-deprecated": { 30980 "requires": [ 30981 "plugin", 30982 "aui-overlay-mask-deprecated" 30983 ], 30984 "skinnable": true 30985 }, 30986 "aui-map": { 30987 "requires": [ 30988 "base-build" 30989 ] 30990 }, 30991 "aui-menu": { 30992 "requires": [ 30993 "base-build", 30994 "event-mouseenter", 30995 "event-resize", 30996 "widget", 30997 "widget-position", 30998 "widget-position-align", 30999 "widget-position-constrain", 31000 "widget-stack", 31001 "aui-classnamemanager", 31002 "aui-debounce", 31003 "aui-dropdown", 31004 "aui-menu-item" 31005 ], 31006 "skinnable": true 31007 }, 31008 "aui-menu-item": { 31009 "requires": [ 31010 "base-build", 31011 "node-base", 31012 "aui-classnamemanager", 31013 "aui-node", 31014 "aui-widget-shortcut" 31015 ] 31016 }, 31017 "aui-messaging": { 31018 "requires": [ 31019 "querystring", 31020 "aui-timer" 31021 ] 31022 }, 31023 "aui-modal": { 31024 "requires": [ 31025 "widget", 31026 "widget-autohide", 31027 "widget-buttons", 31028 "widget-modality", 31029 "widget-position", 31030 "widget-position-align", 31031 "widget-position-constrain", 31032 "widget-stack", 31033 "widget-stdmod", 31034 "dd-plugin", 31035 "dd-constrain", 31036 "timers", 31037 "aui-classnamemanager", 31038 "aui-widget-cssclass", 31039 "aui-widget-toggle", 31040 "aui-widget-toolbars" 31041 ], 31042 "skinnable": true 31043 }, 31044 "aui-modal-resize": { 31045 "condition": { 31046 "name": "aui-modal-resize", 31047 "test": function(A) { 31048 return !A.UA.mobile; 31049}, 31050 "trigger": "aui-modal" 31051 }, 31052 "requires": [ 31053 "aui-modal", 31054 "resize-plugin" 31055 ] 31056 }, 31057 "aui-node": { 31058 "use": [ 31059 "aui-node-base" 31060 ] 31061 }, 31062 "aui-node-accessible": { 31063 "requires": [ 31064 "aui-node-base", 31065 "event-custom-base" 31066 ] 31067 }, 31068 "aui-node-base": { 31069 "requires": [ 31070 "array-extras", 31071 "aui-base-lang", 31072 "aui-classnamemanager", 31073 "aui-debounce", 31074 "node" 31075 ] 31076 }, 31077 "aui-node-html5": { 31078 "condition": { 31079 "name": "aui-node-html5", 31080 "trigger": "aui-node", 31081 "ua": "ie" 31082 }, 31083 "requires": [ 31084 "collection", 31085 "aui-node-base" 31086 ] 31087 }, 31088 "aui-options-data-editor": { 31089 "requires": [ 31090 "aui-data-editor", 31091 "dd-constrain", 31092 "dd-delegate", 31093 "dd-drop-plugin", 31094 "dd-proxy", 31095 "event-valuechange", 31096 "node-event-delegate" 31097 ], 31098 "skinnable": true 31099 }, 31100 "aui-overlay-base-deprecated": { 31101 "requires": [ 31102 "widget-position", 31103 "widget-stack", 31104 "widget-position-align", 31105 "widget-position-constrain", 31106 "widget-stdmod", 31107 "aui-component" 31108 ] 31109 }, 31110 "aui-overlay-context-deprecated": { 31111 "requires": [ 31112 "aui-overlay-manager-deprecated", 31113 "aui-delayed-task-deprecated", 31114 "aui-aria" 31115 ] 31116 }, 31117 "aui-overlay-context-panel-deprecated": { 31118 "requires": [ 31119 "anim", 31120 "aui-overlay-context-deprecated" 31121 ], 31122 "skinnable": true 31123 }, 31124 "aui-overlay-deprecated": { 31125 "use": [ 31126 "aui-overlay-base-deprecated", 31127 "aui-overlay-context-deprecated", 31128 "aui-overlay-context-panel-deprecated", 31129 "aui-overlay-manager-deprecated", 31130 "aui-overlay-mask-deprecated" 31131 ] 31132 }, 31133 "aui-overlay-manager-deprecated": { 31134 "requires": [ 31135 "overlay", 31136 "plugin", 31137 "aui-base-deprecated", 31138 "aui-overlay-base-deprecated" 31139 ] 31140 }, 31141 "aui-overlay-mask-deprecated": { 31142 "requires": [ 31143 "event-resize", 31144 "aui-base-deprecated", 31145 "aui-overlay-base-deprecated" 31146 ], 31147 "skinnable": true 31148 }, 31149 "aui-pagination": { 31150 "requires": [ 31151 "node-event-delegate", 31152 "aui-node", 31153 "aui-component", 31154 "widget-htmlparser" 31155 ], 31156 "skinnable": true 31157 }, 31158 "aui-palette": { 31159 "requires": [ 31160 "base-build", 31161 "event-hover", 31162 "widget", 31163 "aui-classnamemanager", 31164 "aui-base", 31165 "aui-widget-cssclass", 31166 "aui-widget-toggle" 31167 ], 31168 "skinnable": true 31169 }, 31170 "aui-parse-content": { 31171 "requires": [ 31172 "async-queue", 31173 "plugin", 31174 "io-base", 31175 "aui-component", 31176 "aui-node-base" 31177 ] 31178 }, 31179 "aui-popover": { 31180 "requires": [ 31181 "event-resize", 31182 "widget", 31183 "widget-autohide", 31184 "widget-buttons", 31185 "widget-modality", 31186 "widget-position", 31187 "widget-position-align", 31188 "widget-position-constrain", 31189 "widget-stack", 31190 "widget-stdmod", 31191 "aui-classnamemanager", 31192 "aui-widget-cssclass", 31193 "aui-widget-toggle", 31194 "aui-widget-toolbars", 31195 "aui-widget-transition", 31196 "aui-widget-trigger", 31197 "aui-widget-position-align-suggestion", 31198 "aui-component", 31199 "aui-node-base" 31200 ], 31201 "skinnable": true 31202 }, 31203 "aui-progressbar": { 31204 "requires": [ 31205 "aui-node", 31206 "aui-component", 31207 "aui-aria" 31208 ], 31209 "skinnable": true 31210 }, 31211 "aui-promise": { 31212 "requires": [ 31213 "array-invoke", 31214 "promise", 31215 "oop" 31216 ] 31217 }, 31218 "aui-property-builder": { 31219 "requires": [ 31220 "dd", 31221 "collection", 31222 "aui-property-builder-available-field", 31223 "aui-property-builder-field-support", 31224 "aui-property-builder-settings", 31225 "aui-tabview" 31226 ], 31227 "skinnable": true 31228 }, 31229 "aui-property-builder-available-field": { 31230 "requires": [ 31231 "base", 31232 "aui-component", 31233 "aui-node" 31234 ] 31235 }, 31236 "aui-property-builder-field-support": {}, 31237 "aui-property-builder-settings": { 31238 "requires": [ 31239 "aui-tabview", 31240 "aui-datatable-property-list" 31241 ] 31242 }, 31243 "aui-radio-group-data-editor": { 31244 "requires": [ 31245 "aui-data-editor", 31246 "node-event-delegate" 31247 ], 31248 "skinnable": true 31249 }, 31250 "aui-rating": { 31251 "use": [ 31252 "aui-rating-base", 31253 "aui-rating-thumb" 31254 ] 31255 }, 31256 "aui-rating-base": { 31257 "requires": [ 31258 "aui-component", 31259 "aui-node-base", 31260 "widget-htmlparser", 31261 "widget-uievents" 31262 ], 31263 "skinnable": true 31264 }, 31265 "aui-rating-thumb": { 31266 "requires": [ 31267 "aui-rating-base" 31268 ] 31269 }, 31270 "aui-resize-base-deprecated": { 31271 "requires": [ 31272 "dd-drag", 31273 "dd-delegate", 31274 "dd-drop", 31275 "aui-base-deprecated" 31276 ], 31277 "skinnable": true 31278 }, 31279 "aui-resize-constrain-deprecated": { 31280 "requires": [ 31281 "dd-constrain", 31282 "plugin", 31283 "aui-resize-base-deprecated" 31284 ] 31285 }, 31286 "aui-resize-deprecated": { 31287 "skinnable": true, 31288 "use": [ 31289 "aui-resize-base-deprecated", 31290 "aui-resize-constrain-deprecated" 31291 ] 31292 }, 31293 "aui-scale-data-editor": { 31294 "requires": [ 31295 "aui-classnamemanager", 31296 "aui-data-editor", 31297 "event-valuechange" 31298 ] 31299 }, 31300 "aui-scheduler": { 31301 "use": [ 31302 "event-gestures", 31303 "aui-scheduler-base", 31304 "aui-scheduler-event-recorder", 31305 "aui-scheduler-view-agenda", 31306 "aui-scheduler-view-day", 31307 "aui-scheduler-view-month", 31308 "aui-scheduler-view-table-dd", 31309 "aui-scheduler-view-table", 31310 "aui-scheduler-view-week", 31311 "aui-viewport" 31312 ] 31313 }, 31314 "aui-scheduler-base": { 31315 "requires": [ 31316 "model", 31317 "model-list", 31318 "widget-stdmod", 31319 "color-hsl", 31320 "aui-event-base", 31321 "aui-node-base", 31322 "aui-component", 31323 "aui-datatype", 31324 "aui-button", 31325 "node-focusmanager" 31326 ], 31327 "skinnable": true 31328 }, 31329 "aui-scheduler-event-recorder": { 31330 "requires": [ 31331 "querystring", 31332 "io-form", 31333 "overlay", 31334 "aui-scheduler-base", 31335 "aui-popover" 31336 ], 31337 "skinnable": true 31338 }, 31339 "aui-scheduler-touch": { 31340 "condition": { 31341 "name": "aui-scheduler-touch", 31342 "trigger": "aui-scheduler", 31343 "ua": "touchEnabled" 31344 }, 31345 "requires": [ 31346 "base-build", 31347 "aui-scheduler" 31348 ], 31349 "skinnable": true 31350 }, 31351 "aui-scheduler-view-agenda": { 31352 "requires": [ 31353 "aui-scheduler-base" 31354 ], 31355 "skinnable": true 31356 }, 31357 "aui-scheduler-view-day": { 31358 "requires": [ 31359 "dd-drag", 31360 "dd-delegate", 31361 "dd-drop", 31362 "dd-constrain", 31363 "aui-scheduler-view-table" 31364 ], 31365 "skinnable": true 31366 }, 31367 "aui-scheduler-view-month": { 31368 "requires": [ 31369 "aui-scheduler-view-table" 31370 ], 31371 "skinnable": true 31372 }, 31373 "aui-scheduler-view-table": { 31374 "requires": [ 31375 "overlay", 31376 "aui-scheduler-base" 31377 ], 31378 "skinnable": true 31379 }, 31380 "aui-scheduler-view-table-dd": { 31381 "requires": [ 31382 "dd-drag", 31383 "dd-delegate", 31384 "dd-drop", 31385 "aui-scheduler-view-table" 31386 ] 31387 }, 31388 "aui-scheduler-view-week": { 31389 "requires": [ 31390 "aui-scheduler-view-day" 31391 ], 31392 "skinnable": true 31393 }, 31394 "aui-scroller-deprecated": { 31395 "requires": [ 31396 "event-mouseenter", 31397 "aui-base-deprecated", 31398 "aui-simple-anim-deprecated" 31399 ], 31400 "skinnable": true 31401 }, 31402 "aui-scrollspy": { 31403 "requires": [ 31404 "base-build", 31405 "node-screen", 31406 "aui-classnamemanager" 31407 ] 31408 }, 31409 "aui-search": { 31410 "use": [ 31411 "aui-search-tst" 31412 ] 31413 }, 31414 "aui-search-tst": { 31415 "requires": [ 31416 "aui-component" 31417 ] 31418 }, 31419 "aui-selector": { 31420 "requires": [ 31421 "selector-css3", 31422 "aui-classnamemanager" 31423 ] 31424 }, 31425 "aui-set": { 31426 "requires": [ 31427 "aui-map" 31428 ] 31429 }, 31430 "aui-simple-anim-deprecated": { 31431 "requires": [ 31432 "aui-base-deprecated" 31433 ] 31434 }, 31435 "aui-skin-deprecated": { 31436 "type": "css" 31437 }, 31438 "aui-sortable": { 31439 "use": [ 31440 "aui-sortable-layout", 31441 "aui-sortable-list" 31442 ] 31443 }, 31444 "aui-sortable-layout": { 31445 "requires": [ 31446 "dd-delegate", 31447 "dd-drag", 31448 "dd-drop", 31449 "dd-proxy", 31450 "aui-node", 31451 "aui-component" 31452 ], 31453 "skinnable": true 31454 }, 31455 "aui-sortable-list": { 31456 "requires": [ 31457 "dd-drag", 31458 "dd-drop", 31459 "dd-proxy", 31460 "dd-scroll", 31461 "aui-node", 31462 "aui-component" 31463 ] 31464 }, 31465 "aui-state-interaction-deprecated": { 31466 "requires": [ 31467 "aui-base-deprecated", 31468 "plugin" 31469 ] 31470 }, 31471 "aui-surface": { 31472 "use": [ 31473 "aui-surface-app", 31474 "aui-surface-screen" 31475 ] 31476 }, 31477 "aui-surface-app": { 31478 "requires": [ 31479 "event-delegate", 31480 "node-event-html5", 31481 "aui-surface-base", 31482 "aui-surface-screen", 31483 "aui-surface-screen-route" 31484 ] 31485 }, 31486 "aui-surface-base": { 31487 "requires": [ 31488 "base-build", 31489 "node-style", 31490 "timers", 31491 "aui-debounce", 31492 "aui-promise", 31493 "aui-parse-content" 31494 ] 31495 }, 31496 "aui-surface-screen": { 31497 "requires": [ 31498 "base-build" 31499 ] 31500 }, 31501 "aui-surface-screen-html": { 31502 "requires": [ 31503 "aui-base", 31504 "aui-io-request", 31505 "aui-promise", 31506
31506 "aui-surface-screen", 31507 "aui-url" 31508 ] 31509 }, 31510 "aui-surface-screen-route": { 31511 "requires": [ 31512 "base-build" 31513 ] 31514 }, 31515 "aui-swf-deprecated": { 31516 "requires": [ 31517 "querystring-parse-simple", 31518 "querystring-stringify-simple", 31519 "aui-base-deprecated" 31520 ] 31521 }, 31522 "aui-tabs-data-editor": { 31523 "requires": [ 31524 "aui-data-editor", 31525 "aui-tabview" 31526 ] 31527 }, 31528 "aui-tabview": { 31529 "requires": [ 31530 "selector-css3", 31531 "tabview", 31532 "aui-component", 31533 "aui-widget-css" 31534 ], 31535 "skinnable": true 31536 }, 31537 "aui-template-deprecated": { 31538 "requires": [ 31539 "aui-base-deprecated" 31540 ] 31541 }, 31542 "aui-text-data-editor": { 31543 "requires": [ 31544 "aui-data-editor", 31545 "event-valuechange" 31546 ], 31547 "skinnable": true 31548 }, 31549 "aui-text-data-unicode": { 31550 "requires": [ 31551 "text" 31552 ] 31553 }, 31554 "aui-text-unicode": { 31555 "requires": [ 31556 "aui-text-data-unicode" 31557 ] 31558 }, 31559 "aui-textboxlist-deprecated": { 31560 "requires": [ 31561 "anim-node-plugin", 31562 "aui-autocomplete-deprecated", 31563 "aui-button-item-deprecated", 31564 "aui-data-set-deprecated", 31565 "escape", 31566 "node-focusmanager" 31567 ], 31568 "skinnable": true 31569 }, 31570 "aui-timepicker": { 31571 "requires": [ 31572 "autocomplete", 31573 "aui-datepicker-delegate", 31574 "aui-datepicker-popover" 31575 ], 31576 "skinnable": true 31577 }, 31578 "aui-timepicker-native": { 31579 "requires": [ 31580 "base", 31581 "base-build", 31582 "aui-node-base", 31583 "aui-datepicker-delegate", 31584 "aui-datepicker-native" 31585 ] 31586 }, 31587 "aui-timer": { 31588 "requires": [ 31589 "oop" 31590 ] 31591 }, 31592 "aui-toggler": { 31593 "use": [ 31594 "aui-toggler-base", 31595 "aui-toggler-delegate" 31596 ] 31597 }, 31598 "aui-toggler-accessibility": { 31599 "requires": [ 31600 "aui-toggler-base" 31601 ] 31602 }, 31603 "aui-toggler-base": { 31604 "requires": [ 31605 "transition", 31606 "aui-selector", 31607 "aui-event-base", 31608 "aui-node", 31609 "aui-component", 31610 "event-tap" 31611 ], 31612 "skinnable": true 31613 }, 31614 "aui-toggler-delegate": { 31615 "requires": [ 31616 "array-invoke", 31617 "node-event-delegate", 31618 "aui-toggler-base" 31619 ] 31620 }, 31621 "aui-toolbar": { 31622 "requires": [ 31623 "arraylist", 31624 "arraylist-add", 31625 "aui-component", 31626 "aui-button-core" 31627 ] 31628 }, 31629 "aui-tooltip": { 31630 "use": [ 31631 "aui-tooltip-base", 31632 "aui-tooltip-delegate" 31633 ] 31634 }, 31635 "aui-tooltip-base": { 31636 "requires": [ 31637 "aui-aria", 31638 "aui-classnamemanager", 31639 "aui-component", 31640 "aui-debounce", 31641 "aui-node-base", 31642 "aui-widget-cssclass", 31643 "aui-widget-toggle", 31644 "aui-widget-transition", 31645 "aui-widget-trigger", 31646 "aui-widget-position-align-suggestion", 31647 "event-hover", 31648 "event-resize", 31649 "escape", 31650 "widget", 31651 "widget-autohide", 31652 "widget-position", 31653 "widget-position-align", 31654 "widget-position-constrain", 31655 "widget-stack", 31656 "widget-stdmod" 31657 ], 31658 "skinnable": true 31659 }, 31660 "aui-tooltip-delegate": { 31661 "requires": [ 31662 "aui-tooltip-base", 31663 "node-event-delegate" 31664 ] 31665 }, 31666 "aui-tooltip-deprecated": { 31667 "requires": [ 31668 "aui-overlay-context-panel-deprecated" 31669 ], 31670 "skinnable": true 31671 }, 31672 "aui-tpl-snippets-base-deprecated": { 31673 "requires": [ 31674 "aui-template-deprecated" 31675 ] 31676 }, 31677 "aui-tpl-snippets-checkbox-deprecated": { 31678 "requires": [ 31679 "aui-tpl-snippets-base-deprecated" 31680 ] 31681 }, 31682 "aui-tpl-snippets-deprecated": { 31683 "use": [ 31684 "aui-tpl-snippets-base-deprecated", 31685 "aui-tpl-snippets-checkbox-deprecated", 31686 "aui-tpl-snippets-input-deprecated", 31687 "aui-tpl-snippets-select-deprecated", 31688 "aui-tpl-snippets-textarea-deprecated" 31689 ] 31690 }, 31691 "aui-tpl-snippets-input-deprecated": { 31692 "requires": [ 31693 "aui-tpl-snippets-base-deprecated" 31694 ] 31695 }, 31696 "aui-tpl-snippets-select-deprecated": { 31697 "requires": [ 31698 "aui-tpl-snippets-base-deprecated" 31699 ] 31700 }, 31701 "aui-tpl-snippets-textarea-deprecated": { 31702 "requires": [ 31703 "aui-tpl-snippets-base-deprecated" 31704 ] 31705 }, 31706 "aui-tree": { 31707 "use": [ 31708 "aui-tree-data", 31709 "aui-tree-io", 31710 "aui-tree-node", 31711 "aui-tree-paginator", 31712 "aui-tree-view" 31713 ] 31714 }, 31715 "aui-tree-data": { 31716 "requires": [ 31717 "aui-base-core", 31718 "aui-base-lang", 31719 "aui-node-base", 31720 "aui-timer", 31721 "aui-component" 31722 ] 31723 }, 31724 "aui-tree-io": { 31725 "requires": [ 31726 "aui-component", 31727 "aui-io" 31728 ] 31729 }, 31730 "aui-tree-node": { 31731 "requires": [ 31732 "json", 31733 "querystring-stringify", 31734 "aui-tree-data", 31735 "aui-tree-io", 31736 "aui-tree-paginator", 31737 "event-key" 31738 ] 31739 }, 31740 "aui-tree-paginator": { 31741 "requires": [ 31742 "yui-base" 31743 ] 31744 }, 31745 "aui-tree-view": { 31746 "requires": [ 31747 "dd-delegate", 31748 "dd-proxy", 31749 "widget", 31750 "aui-tree-node", 31751 "aui-tree-paginator", 31752 "aui-tree-io" 31753 ], 31754 "skinnable": true 31755 }, 31756 "aui-undo-redo": { 31757 "requires": [ 31758 "aui-base", 31759 "base", 31760 "base-build", 31761 "event-key", 31762 "promise" 31763 ] 31764 }, 31765 "aui-url": { 31766 "requires": [ 31767 "oop", 31768 "querystring-parse", 31769 "querystring-stringify" 31770 ] 31771 }, 31772 "aui-video": { 31773 "requires": [ 31774 "event-resize", 31775 "node-event-html5", 31776 "querystring-stringify-simple", 31777 "aui-aria", 31778 "aui-node", 31779 "aui-component", 31780 "aui-debounce" 31781 ], 31782 "skinnable": true 31783 }, 31784 "aui-viewport": { 31785 "requires": [ 31786 "aui-node", 31787 "aui-component" 31788 ] 31789 }, 31790 "aui-widget": { 31791 "use": [ 31792 "aui-widget-cssclass", 31793 "aui-widget-toolbars" 31794 ] 31795 }, 31796 "aui-widget-core": { 31797 "use": [ 31798 "aui-widget-cssclass" 31799 ] 31800 }, 31801 "aui-widget-cssclass": { 31802 "requires": [ 31803 "widget-base" 31804 ] 31805 }, 31806 "aui-widget-position-align-suggestion": { 31807 "requires": [ 31808 "widget-position-align", 31809 "widget-stdmod" 31810 ] 31811 }, 31812 "aui-widget-responsive": { 31813 "requires": [ 31814 "event-resize", 31815 "widget-base" 31816 ] 31817 }, 31818 "aui-widget-shortcut": { 31819 "requires": [ 31820 "base" 31821 ] 31822 }, 31823 "aui-widget-swipe": { 31824 "requires": [ 31825 "classnamemanager", 31826 "scrollview-base", 31827 "scrollview-paginator", 31828 "timers" 31829 ] 31830 }, 31831 "aui-widget-toggle": {}, 31832 "aui-widget-toolbars": { 31833 "requires": [ 31834 "widget-stdmod", 31835 "aui-toolbar" 31836 ] 31837 }, 31838 "aui-widget-transition": { 31839 "requires": [ 31840 "transition" 31841 ] 31842 }, 31843 "aui-widget-trigger": { 31844 "requires": [ 31845 "node" 31846 ] 31847 } 31848}); 31849YUI.Env[Y.version].md5 = 'd7c627eb00edd6b6f054d8f6e7147480'; 31850/* 31851 * Alloy JavaScript Library 31852 * http://alloy.liferay.com/ 31853 * 31854 * Copyright (c) 2010 Liferay Inc. 31855 * http://alloy.liferay.com/LICENSE.txt 31856 * 31857 * Nate Cavanaugh ([email protected]) 31858 * Eduardo Lundgren ([email protected]) 31859 * 31860 * Attribution/Third-party licenses 31861 * http://alloy.liferay.com/ATTRIBUTION.txt 31862 */ 31863 31864// Simple version of 31865// http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ 31866 31867A.UA.edge = (function() { 31868 var edgeVersion = A.UA.userAgent.match(/Edge\/(.[0-9.]+)/); 31869 31870 if (edgeVersion) { 31871 return edgeVersion[1]; 31872 } 31873 31874 return 0; 31875})(); 31876 31877A.supportsDOMEvent = function(domNode, eventName) { 31878 eventName = 'on' + eventName; 31879 31880 if (!(eventName in domNode)) { 31881 if (!domNode.setAttribute) { 31882 domNode = A.config.doc.createElement('div'); 31883 } 31884 31885 if (domNode.setAttribute) { 31886 domNode.setAttribute(eventName, ''); 31887 return (typeof domNode[eventName] === 'function'); 31888 } 31889 } 31890 31891 domNode = null; 31892 31893 return true; 31894}; 31895(function() { 31896 var slice = Array.prototype.slice; 31897 31898 YUI.prototype.ready = function() { 31899 var instance = this, 31900 xargs = arguments, 31901 index = xargs.length - 1, 31902 modules = slice.call(arguments, 0, index); 31903 31904 modules.unshift('event-base'); 31905 modules.push(function(instance) { 31906 var args = arguments; 31907 31908 instance.on('domready', function() { 31909 xargs[index].apply(this, args); 31910 }); 31911 }); 31912 instance.use.apply(instance, modules); 31913 }; 31914}()); 31915 31916 31917}, '3.1.0-deprecated.70'); 31918YUI.add('aui', function (A, NAME) {}, '3.1.0-deprecated.70'); 31919YUI.Env.core.push.apply(YUI.Env.core, ["aui-base-core"]); 31920YUI.add('aui-base-html5-shiv', function (A, NAME) { 31921 31922A.HTML5_ELEMENTS = [ 31923 'abbr', 31924 'article', 31925 'aside', 31926 'audio', 31927 'canvas', 31928 'command', 31929 'datalist', 31930 'details', 31931 'figure', 31932 'figcaption', 31933 'footer', 31934 'header', 31935 'hgroup', 31936 'keygen', 31937 'mark', 31938 'meter',
31939 'nav', 31940 'output', 31941 'progress', 31942 'section', 31943 'source', 31944 'summary', 31945 'time', 31946 'video' 31947]; 31948 31949A.html5shiv = function(frag) { 31950 var DOC = frag || A.config.doc; 31951 31952 if (A.UA.ie && DOC && DOC.createElement) { 31953 var elements = A.HTML5_ELEMENTS, 31954 length = elements.length; 31955 31956 while (length--) { 31957 DOC.createElement(elements[length]); 31958 } 31959 } 31960 31961 return frag; 31962}; 31963 31964 31965}, '3.1.0-deprecated.70'); 31966 31967YUI.add( 31968 'liferay-browser-selectors', 31969 function(A) { 31970 var REGEX_VERSION_DOT = /\./g; 31971 31972 var YUI3_JS_ENABLED = 'yui3-js-enabled'; 31973 31974 var parseVersionNumber = function(str) { 31975 var count = 0; 31976 31977 return parseFloat( 31978 str.replace( 31979 REGEX_VERSION_DOT, 31980 function() { 31981 return (count++ == 1) ? '' : '.'; 31982 } 31983 ) 31984 ); 31985 }; 31986 31987 var DEFAULTS_VERSION = ['0', '0']; 31988 31989 var getVersion = function(regex, userAgent) { 31990 var version = (userAgent.match(regex) || DEFAULTS_VERSION)[1]; 31991 31992 return parseVersionNumber(version); 31993 }; 31994 31995 var BROWSERS = [ 31996 'ie', 31997 'opera', 31998 'chrome', 31999 'edge', 32000 'aol', 32001 'camino', 32002 'firefox', 32003 'flock', 32004 'mozilla', 32005 'netscape', 32006 'icab', 32007 'konqueror', 32008 'safari' 32009 ]; 32010 32011 var MAP_OS_SELECTORS = { 32012 macintosh: 'mac', 32013 windows: 'win' 32014 }; 32015 32016 var nav = navigator; 32017 32018 var CONFIG = A.config; 32019 32020 var DOC = CONFIG.doc; 32021 32022 var userAgent = nav.userAgent; 32023 32024 var UA = A.UA; 32025 32026 var OS = UA.os; 32027 32028 var UAX = { 32029 agent: userAgent, 32030 32031 aol: 0, 32032 browser: 0, 32033 camino: 0, 32034 firefox: 0, 32035 flock: 0, 32036 icab: 0, 32037 konqueror: 0, 32038 mozilla: 0, 32039 netscape: 0, 32040 safari: 0 32041 }; 32042 32043 UAX.mac = (OS == 'macintosh'); 32044 UAX.rhino = (OS == 'rhino'); 32045 UAX.win = (OS == 'windows'); 32046 32047 var BrowserSelectors = { 32048 getSelectors: function() { 32049 // The methods in this if block only run once across all instances 32050 32051 if (!UA.selectors) { 32052 if (userAgent.indexOf('Edge') !== -1) { 32053 UAX.edge = getVersion(/Edge\/([^\s]*)/, userAgent); 32054 } 32055 32056 if (UA.ie) { 32057 UAX.aol = getVersion(/America Online Browser ([^\s]*);/, userAgent); 32058 32059 var docMode = DOC.documentMode; 32060 32061 if (docMode) { 32062 UA.browser = UA.ie; 32063 UA.ie = docMode; 32064 } 32065 } 32066 else if (UA.gecko) { 32067 UAX.netscape = getVersion(/(Netscape|Navigator)\/([^\s]*)/, userAgent); 32068 UAX.flock = getVersion(/Flock\/([^\s]*)/, userAgent); 32069 UAX.camino = getVersion(/Camino\/([^\s]*)/, userAgent); 32070 UAX.firefox = getVersion(/Firefox\/([^\s]*)/, userAgent); 32071 } 32072 else if (UA.webkit) { 32073 UAX.safari = getVersion(/Version\/([^\s]*) Safari/, userAgent); 32074 } 32075 else { 32076 UAX.icab = getVersion(/iCab(?:\/|\s)?([^\s]*)/, userAgent); 32077 UAX.konqueror = getVersion(/Konqueror\/([^\s]*)/, userAgent); 32078 } 32079 32080 if (!UAX.win && !UAX.mac) { 32081 var linux = /Linux/.test(userAgent); 32082 var sun = /Solaris|SunOS/.test(userAgent); 32083 32084 if (linux) { 32085 UA.os = 'linux'; 32086 UAX.linux = linux; 32087 } 32088 else if (sun) { 32089 UA.os = 'sun'; 32090 UAX.sun = sun; 32091 } 32092 } 32093 32094 var touch = UA.touchEnabled; 32095 32096 UAX.touch = touch; 32097 UAX.touchMobile = touch && !!UA.mobile; 32098 32099 A.mix(UA, UAX); 32100 32101 var browserList = []; 32102 var versionMajor = 0; 32103 32104 var browser; 32105 var uaVersionMajor; 32106 var uaVersionMinor; 32107 var version; 32108 32109 var versionObj = { 32110 major: versionMajor, 32111 string: '' 32112 }; 32113 32114 var i = BROWSERS.length; 32115 32116 while (i--) { 32117 browser = BROWSERS[i]; 32118 version = UA[browser]; 32119 32120 if (version > 0) { 32121 versionMajor = parseInt(version, 10); 32122 uaVersionMajor = browser + versionMajor; 32123 32124 uaVersionMinor = (browser + version); 32125 32126 if (String(version).indexOf('.') > -1) { 32127 uaVersionMinor = uaVersionMinor.replace(/\.(\d).*/, '-$1'); 32128 } 32129 else { 32130 uaVersionMinor += '-0'; 32131 } 32132 32133 browserList.push(browser, uaVersionMajor, uaVersionMinor); 32134 32135 versionObj.string = browser + ''; 32136 versionObj.major = versionMajor; 32137 } 32138 } 32139 32140 UA.version = versionObj; 32141 32142 UA.renderer = ''; 32143 32144 if (UA.ie) { 32145 UA.renderer = 'trident'; 32146 } 32147 else if (UA.edge) { 32148 UA.renderer = 'edgeHTML' 32149 } 32150 else if (UA.gecko) { 32151 UA.renderer = 'gecko'; 32152 } 32153 else if (UA.webkit) { 32154 UA.renderer = 'webkit'; 32155 } 32156 else if (UA.opera) { 32157 UA.renderer = 'presto'; 32158 } 32159 32160 A.UA = UA; 32161 32162 /* 32163 * Browser selectors 32164 */ 32165 32166 var selectors = [ 32167 UA.renderer, 32168 'js' 32169 ].concat(browserList); 32170 32171 var osSelector = MAP_OS_SELECTORS[UA.os] || UA.os; 32172 32173 selectors.push(osSelector); 32174 32175 if (UA.mobile) { 32176 selectors.push('mobile'); 32177 } 32178 32179 if (UA.secure) { 32180 selectors.push('secure'); 32181 } 32182 32183 if (UA.touch) { 32184 selectors.push('touch'); 32185 } 32186 32187 UA.selectors = selectors.join(' '); 32188 32189 var svg; 32190 var vml; 32191 32192 vml = !(svg = !!(CONFIG.win.SVGAngle || DOC.implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1'))); 32193 32194 if (vml) { 32195 var behaviorObj; 32196 var div = DOC.createElement('div'); 32197
32198 div.innerHTML = '<v:shape adj="1"/>'; 32199 32200 behaviorObj = div.firstChild; 32201 32202 behaviorObj.style.behavior = 'url(#default#VML)'; 32203 32204 if (!(behaviorObj && typeof behaviorObj.adj == 'object')) { 32205 vml = false; 32206 } 32207 32208 div = null; 32209 } 32210 32211 YUI._VML = vml; 32212 YUI._SVG = svg; 32213 32214 UA.vml = YUI._VML; 32215 UA.svg = YUI._SVG; 32216 } 32217 32218 return UA.selectors; 32219 }, 32220 32221 run: function() { 32222 var documentElement = DOC.documentElement; 32223 32224 var selectors = this.getSelectors(); 32225 32226 UA.dir = documentElement.getAttribute('dir') || 'ltr'; 32227 32228 if (documentElement.className.indexOf(UA.dir) === -1) { 32229 selectors += ' ' + UA.dir; 32230 } 32231 32232 if (documentElement.className.indexOf(YUI3_JS_ENABLED) === -1 && selectors.indexOf(YUI3_JS_ENABLED) === -1) { 32233 selectors += ' ' + YUI3_JS_ENABLED; 32234 } 32235 32236 documentElement.className += ' ' + selectors; 32237 } 32238 }; 32239 32240 Liferay.BrowserSelectors = BrowserSelectors; 32241 }, 32242 '', 32243 { 32244 requires: ['yui-base'] 32245 } 32246); 32247;(function() { 32248 var LiferayAUI = Liferay.AUI; 32249 32250 var COMBINE = LiferayAUI.getCombine(); 32251 32252 var CORE_MODULES = YUI.Env.core; 32253 32254 var INPUT_EL = document.createElement('input'); 32255 32256 var PATH_EDITOR_CKEDITOR = LiferayAUI.getEditorCKEditorPath(); 32257 32258 var PATH_JAVASCRIPT = LiferayAUI.getJavaScriptRootPath(); 32259 32260 var SUPPORTS_INPUT_SELECTION = typeof INPUT_EL.selectionStart === 'number' && typeof INPUT_EL.selectionEnd === 'number'; 32261 32262 var testHistory = function(A) { 32263 var WIN = A.config.win; 32264 32265 var HISTORY = WIN.history; 32266 32267 return HISTORY && 32268 HISTORY.pushState && 32269 HISTORY.replaceState && 32270 ('onpopstate' in WIN || A.UA.gecko >= 2); 32271 }; 32272 32273 window.YUI_config = { 32274 base: Liferay.ThemeDisplay.getCDNBaseURL() + PATH_JAVASCRIPT + '/aui/', 32275 combine: COMBINE, 32276 comboBase: LiferayAUI.getComboPath(), 32277 filter: Liferay.AUI.getFilter(), 32278 groups: { 32279 editor: { 32280 base: PATH_EDITOR_CKEDITOR, 32281 combine: COMBINE, 32282 modules: { 32283 'inline-editor-ckeditor': { 32284 path: 'ckeditor/main.js' 32285 } 32286 }, 32287 root: PATH_EDITOR_CKEDITOR 32288 }, 32289 32290 liferay: { 32291 base: Liferay.ThemeDisplay.getCDNBaseURL() + PATH_JAVASCRIPT + '/liferay/', 32292 combine: COMBINE, 32293 filter: Liferay.AUI.getFilterConfig(), 32294 modules: { 32295 'liferay-address': { 32296 path: 'address.js', 32297 requires: [] 32298 }, 32299 'liferay-alert': { 32300 path: 'alert.js', 32301 requires: [ 32302 'aui-alert', 32303 'aui-component', 32304 'event-mouseenter', 32305 'liferay-portlet-base', 32306 'timers' 32307 ] 32308 }, 32309 'liferay-asset-addon-entry-selector': { 32310 path: 'asset_addon_entry_selector.js', 32311 requires: [ 32312 'aui-component', 32313 'liferay-portlet-base', 32314 'liferay-util-window' 32315 ] 32316 }, 32317 'liferay-asset-categories-selector': { 32318 path: 'asset_categories_selector.js', 32319 requires: [ 32320 'aui-tree', 32321 'liferay-asset-tags-selector' 32322 ] 32323 }, 32324 'liferay-asset-tags-selector': { 32325 path: 'asset_tags_selector.js', 32326 requires: [ 32327 'array-extras', 32328 'async-queue', 32329 'aui-autocomplete-deprecated', 32330 'aui-io-plugin-deprecated', 32331 'aui-io-request', 32332 'aui-live-search-deprecated', 32333 'aui-modal', 32334 'aui-template-deprecated', 32335 'aui-textboxlist-deprecated', 32336 'datasource-cache', 32337 'liferay-service-datasource' 32338 ] 32339 }, 32340 'liferay-auto-fields': { 32341 path: 'auto_fields.js', 32342 requires: [ 32343 'aui-base', 32344 'aui-data-set-deprecated', 32345 'aui-io-request', 32346 'aui-parse-content', 32347 'base', 32348 'liferay-undo-manager', 32349 'sortable' 32350 ] 32351 }, 32352 'liferay-autocomplete-input': { 32353 path: 'autocomplete_input.js', 32354 requires: [ 32355 'aui-base', 32356 'autocomplete', 32357 'autocomplete-filters', 32358 'autocomplete-highlighters' 32359 ] 32360 }, 32361 'liferay-autocomplete-input-caretindex': { 32362 condition: { 32363 name: 'liferay-autocomplete-input-caretindex', 32364 test: function() { 32365 return SUPPORTS_INPUT_SELECTION; 32366 }, 32367 trigger: 'liferay-autocomplete-textarea' 32368 }, 32369 path: 'autocomplete_input_caretindex.js', 32370 requires: [ 32371 'liferay-autocomplete-textarea' 32372 ] 32373 }, 32374 'liferay-autocomplete-input-caretindex-sel': { 32375 condition: { 32376 name: 'liferay-autocomplete-input-caretindex-sel', 32377 test: function() { 32378 return !SUPPORTS_INPUT_SELECTION; 32379 }, 32380 trigger: 'liferay-autocomplete-textarea' 32381 }, 32382 path: 'autocomplete_input_caretindex_sel.js', 32383 requires: [ 32384 'liferay-autocomplete-textarea' 32385 ] 32386 }, 32387 'liferay-autocomplete-input-caretoffset': { 32388 condition: { 32389 name: 'liferay-autocomplete-input-caretoffset', 32390 test: function(A) { 32391 return !(A.UA.ie && A.UA.ie < 9); 32392 }, 32393 trigger: 'liferay-autocomplete-textarea' 32394 }, 32395 path: 'autocomplete_input_caretoffset.js', 32396 requires: [ 32397 'liferay-autocomplete-textarea' 32398 ] 32399 }, 32400 'liferay-autocomplete-input-caretoffset-sel': { 32401 condition: { 32402 name: 'liferay-autocomplete-input-caretoffset-sel', 32403 test: function(A) { 32404 return A.UA.ie && A.UA.ie < 9; 32405 }, 32406 trigger: 'liferay-autocomplete-textarea' 32407 }, 32408 path: 'autocomplete_input_caretoffset_sel.js', 32409 requires: [ 32410 'liferay-autocomplete-textarea' 32411 ] 32412 }, 32413 'liferay-autocomplete-textarea': { 32414 path: 'autocomplete_textarea.js', 32415 requires: [ 32416 'liferay-autocomplete-input' 32417 ] 32418 }, 32419 'liferay-browser-selectors': { 32420 path: 'browser_selectors.js', 32421 requires: ['yui-base'] 32422 }, 32423 'liferay-cover-cropper': { 32424 path: 'cover_cropper.js', 32425 requires: [ 32426 'aui-base', 32427 'dd-constrain', 32428 'dd-drag', 32429 'liferay-crop-region', 32430 'plugin' 32431 ] 32432 }, 32433 'liferay-crop-region': { 32434 path: 'crop_region.js', 32435 requires: [ 32436 'aui-base' 32437 ] 32438 }, 32439 'liferay-dd-proxy': { 32440 path: 'dd_proxy.js', 32441 requires: [ 32442 'dd-proxy' 32443 ] 32444 }, 32445 'liferay-dynamic-select': {
32446 path: 'dynamic_select.js', 32447 requires: [ 32448 'aui-base' 32449 ] 32450 }, 32451 'liferay-form': { 32452 path: 'form.js', 32453 requires: [ 32454 'aui-base', 32455 'aui-form-validator' 32456 ] 32457 }, 32458 'liferay-form-placeholders': { 32459 condition: { 32460 name: 'liferay-form-placeholders', 32461 test: function(A) { 32462 return !('placeholder' in INPUT_EL); 32463 }, 32464 trigger: 'liferay-form' 32465 }, 32466 path: 'form_placeholders.js', 32467 requires: [ 32468 'liferay-form', 32469 'plugin' 32470 ] 32471 }, 32472 'liferay-fullscreen-source-editor': { 32473 path: 'fullscreen_source_editor.js', 32474 requires: [ 32475 'liferay-source-editor' 32476 ] 32477 }, 32478 'liferay-history': { 32479 path: 'history.js', 32480 requires: [ 32481 'history-hash', 32482 'querystring-parse-simple' 32483 ] 32484 }, 32485 'liferay-history-html5': { 32486 condition: { 32487 name: 'liferay-history-html5', 32488 test: testHistory, 32489 trigger: 'liferay-history' 32490 }, 32491 path: 'history_html5.js', 32492 requires: [ 32493 'history-html5', 32494 'liferay-history', 32495 'querystring-stringify-simple' 32496 ] 32497 }, 32498 'liferay-history-manager': { 32499 path: 'history_manager.js', 32500 requires: [ 32501 'liferay-history' 32502 ] 32503 }, 32504 'liferay-hudcrumbs': { 32505 path: 'hudcrumbs.js', 32506 requires: [ 32507 'aui-base', 32508 'aui-debounce', 32509 'event-resize' 32510 ] 32511 }, 32512 'liferay-icon': { 32513 path: 'icon.js', 32514 requires: [ 32515 'aui-base' 32516 ] 32517 }, 32518 'liferay-inline-editor-base': { 32519 path: 'inline_editor_base.js', 32520 requires: [ 32521 'aui-base', 32522 'aui-overlay-base-deprecated' 32523 ] 32524 }, 32525 'liferay-input-localized': { 32526 path: 'input_localized.js', 32527 requires: [ 32528 'aui-base', 32529 'aui-component', 32530 'aui-event-input', 32531 'aui-palette', 32532 'aui-set', 32533 'portal-available-languages' 32534 ] 32535 }, 32536 'liferay-input-move-boxes': { 32537 path: 'input_move_boxes.js', 32538 plugins: { 32539 'liferay-input-move-boxes-touch': { 32540 condition: { 32541 name: 'liferay-input-move-boxes-touch', 32542 trigger: 'liferay-input-move-boxes', 32543 ua: 'touchMobile' 32544 } 32545 } 32546 }, 32547 requires: [ 32548 'aui-base', 32549 'aui-toolbar' 32550 ] 32551 }, 32552 'liferay-input-move-boxes-touch': { 32553 path: 'input_move_boxes_touch.js', 32554 requires: [ 32555 'aui-base', 32556 'aui-template-deprecated', 32557 'liferay-input-move-boxes', 32558 'sortable' 32559 ] 32560 }, 32561 'liferay-item-selector-dialog': { 32562 path: 'item_selector_dialog.js', 32563 requires: [ 32564 'aui-component' 32565 ] 32566 }, 32567 'liferay-item-selector-repository-entry-browser': { 32568 path: 'item_selector_repository_entry_browser.js', 32569 requires: [ 32570 'liferay-item-selector-uploader', 32571 'liferay-item-viewer', 32572 'liferay-notice', 32573 'liferay-portlet-base', 32574 'liferay-storage-formatter' 32575 ] 32576 }, 32577 'liferay-item-selector-uploader': { 32578 path: 'item_selector_uploader.js', 32579 requires: [ 32580 'aui-base', 32581 'aui-progressbar', 32582 'liferay-portlet-base', 32583 'uploader' 32584 ] 32585 }, 32586 'liferay-item-selector-url': { 32587 path: 'item_selector_url.js', 32588 requires: [ 32589 'aui-event-input', 32590 'liferay-item-viewer', 32591 'liferay-portlet-base' 32592 ] 32593 }, 32594 'liferay-item-viewer': { 32595 path: 'item_viewer.js', 32596 requires: [ 32597 'aui-component', 32598 'aui-image-viewer', 32599 'liferay-portlet-url' 32600 ] 32601 }, 32602 'liferay-language': { 32603 path: 'language.js' 32604 }, 32605 'liferay-layout': { 32606 path: 'layout.js' 32607 }, 32608 'liferay-layout-column': { 32609 path: 'layout_column.js', 32610 requires: [ 32611 'aui-sortable-layout', 32612 'dd' 32613 ] 32614 }, 32615 'liferay-layout-freeform': { 32616 path: 'layout_freeform.js', 32617 requires: [ 32618 'liferay-layout-column', 32619 'resize' 32620 ] 32621 }, 32622 'liferay-list-view': { 32623 path: 'list_view.js', 32624 requires: [ 32625 'aui-base', 32626 'transition' 32627 ] 32628 }, 32629 'liferay-logo-editor': { 32630 path: 'logo_editor.js', 32631 requires: [ 32632 'aui-image-cropper', 32633 'aui-io-request', 32634 'liferay-alert', 32635 'liferay-crop-region', 32636 'liferay-portlet-base', 32637 'liferay-storage-formatter' 32638 ] 32639 }, 32640 'liferay-logo-selector': { 32641 path: 'logo_selector.js', 32642 requires: [ 32643 'aui-base' 32644 ] 32645 }, 32646 'liferay-menu': { 32647 path: 'menu.js', 32648 requires: [ 32649 'aui-debounce', 32650 'aui-node' 32651 ] 32652 }, 32653 'liferay-menu-filter': { 32654 path: 'menu_filter.js', 32655 requires: [ 32656 'autocomplete-base', 32657 'autocomplete-filters', 32658 'autocomplete-highlighters' 32659 ] 32660 }, 32661 'liferay-menu-toggle': { 32662 path: 'menu_toggle.js', 32663 requires: [ 32664 'aui-node', 32665 'event-outside', 32666 'event-tap', 32667 'liferay-menu-filter', 32668 'liferay-store' 32669 ] 32670 }, 32671 'liferay-message': { 32672 path: 'message.js', 32673 requires: [ 32674 'aui-base', 32675 'liferay-store' 32676 ] 32677 }, 32678 'liferay-navigation': { 32679 path: 'navigation.js', 32680 requires: [ 32681 'aui-component', 32682 'event-mouseenter' 32683 ] 32684 }, 32685 'liferay-navigation-interaction': { 32686 path: 'navigation_interaction.js', 32687 plugins: { 32688 'liferay-navigation-interaction-touch': { 32689 condition: { 32690 name: 'liferay-navigation-interaction-touch', 32691 trigger: 'liferay-navigation-interaction', 32692 ua: 'touch' 32693 } 32694 } 32695 }, 32696 requires: [ 32697 'aui-base', 32698 'aui-component', 32699 'event-mouseenter', 32700 'node-focusmanager', 32701 'plugin' 32702 ] 32703 }, 32704 'liferay-navigation-interaction-touch': { 32705 path: 'navigation_interaction_touch.js', 32706 requires: [ 32707 'event-tap', 32708 'event-touch', 32709 'liferay-navigation-interaction' 32710 ] 32711 },
32712 'liferay-node': { 32713 path: 'node.js', 32714 requires: [ 32715 'dom-base' 32716 ] 32717 }, 32718 'liferay-notice': { 32719 path: 'notice.js', 32720 requires: [ 32721 'aui-base', 32722 'transition' 32723 ] 32724 }, 32725 'liferay-notification': { 32726 path: 'notification.js', 32727 requires: [ 32728 'liferay-alert' 32729 ] 32730 }, 32731 'liferay-pagination': { 32732 path: 'pagination.js', 32733 requires: [ 32734 'aui-pagination' 32735 ] 32736 }, 32737 'liferay-panel-search': { 32738 path: 'panel_search.js', 32739 requires: [ 32740 'aui-base', 32741 'liferay-search-filter' 32742 ] 32743 }, 32744 'liferay-poller': { 32745 path: 'poller.js', 32746 requires: [ 32747 'aui-base', 32748 'io', 32749 'json' 32750 ] 32751 }, 32752 'liferay-portlet-base': { 32753 path: 'portlet_base.js', 32754 requires: [ 32755 'aui-base', 32756 'liferay-node' 32757 ] 32758 }, 32759 'liferay-portlet-url': { 32760 path: 'portlet_url.js', 32761 requires: [ 32762 'aui-base', 32763 'aui-io-request', 32764 'querystring-stringify-simple' 32765 ] 32766 }, 32767 'liferay-preview': { 32768 path: 'preview.js', 32769 requires: [ 32770 'aui-base', 32771 'aui-overlay-mask-deprecated', 32772 'aui-toolbar', 32773 'liferay-widget-zindex' 32774 ] 32775 }, 32776 'liferay-progress': { 32777 path: 'progress.js', 32778 requires: [ 32779 'aui-progressbar' 32780 ] 32781 }, 32782 'liferay-ratings': { 32783 path: 'ratings.js', 32784 requires: [ 32785 'aui-io-request', 32786 'aui-rating' 32787 ] 32788 }, 32789 'liferay-resize-rtl': { 32790 condition: { 32791 test: function(A) { 32792 return document.documentElement.dir === 'rtl'; 32793 }, 32794 trigger: 'resize-base' 32795 }, 32796 path: 'resize_rtl.js' 32797 }, 32798 'liferay-restore-entry': { 32799 path: 'restore_entry.js', 32800 requires: [ 32801 'aui-io-plugin-deprecated', 32802 'aui-io-request', 32803 'aui-modal', 32804 'liferay-portlet-base' 32805 ] 32806 }, 32807 'liferay-search-container': { 32808 path: 'search_container.js', 32809 requires: [ 32810 'aui-base', 32811 'aui-datatable-core' 32812 ] 32813 }, 32814 'liferay-search-container-move': { 32815 path: 'search_container_move.js', 32816 requires: [ 32817 'aui-component', 32818 'dd-constrain', 32819 'dd-delegate', 32820 'dd-drag', 32821 'dd-drop', 32822 'dd-proxy', 32823 'plugin' 32824 ] 32825 }, 32826 'liferay-search-container-select': { 32827 path: 'search_container_select.js', 32828 requires: [ 32829 'aui-component', 32830 'aui-url', 32831 'plugin' 32832 ] 32833 }, 32834 'liferay-search-filter': { 32835 path: 'search_filter.js', 32836 requires: [ 32837 'aui-base', 32838 'autocomplete-base', 32839 'autocomplete-filters' 32840 ] 32841 }, 32842 'liferay-service-datasource': { 32843 path: 'service_datasource.js', 32844 requires: [ 32845 'aui-base', 32846 'datasource-local' 32847 ] 32848 }, 32849 'liferay-session': { 32850 path: 'session.js', 32851 requires: [ 32852 'aui-io-request', 32853 'aui-timer', 32854 'cookie', 32855 'liferay-notification' 32856 ] 32857 }, 32858 'liferay-sign-in-modal': { 32859 path: 'sign_in_modal.js', 32860 requires: [ 32861 'aui-base', 32862 'aui-component', 32863 'aui-io-request', 32864 'aui-parse-content', 32865 'liferay-form', 32866 'liferay-portlet-url', 32867 'liferay-util-window', 32868 'plugin' 32869 ] 32870 }, 32871 'liferay-social-bookmarks': { 32872 path: 'social_bookmarks.js', 32873 requires: [ 32874 'aui-component', 32875 'aui-node' 32876 ] 32877 }, 32878 'liferay-sortable': { 32879 path: 'sortable.js', 32880 requires: [ 32881 'liferay-dd-proxy', 32882 'sortable' 32883 ] 32884 }, 32885 'liferay-source-editor': { 32886 path: 'source_editor.js', 32887 requires: [ 32888 'aui-ace-editor' 32889 ] 32890 }, 32891 'liferay-storage-formatter': { 32892 path: 'storage_formatter.js', 32893 requires: [ 32894 'aui-base', 32895 'datatype-number-format' 32896 ] 32897 }, 32898 'liferay-store': { 32899 path: 'store.js', 32900 requires: [ 32901 'aui-io-request' 32902 ] 32903 }, 32904 'liferay-toggler-interaction': { 32905 path: 'toggler_interaction.js', 32906 requires: [ 32907 'liferay-toggler-key-filter' 32908 ] 32909 }, 32910 'liferay-toggler-key-filter': { 32911 path: 'toggler_key_filter.js', 32912 requires: [ 32913 'aui-event-base' 32914 ] 32915 }, 32916 'liferay-token-list': { 32917 path: 'token_list.js', 32918 requires: [ 32919 'aui-base', 32920 'aui-template-deprecated' 32921 ] 32922 }, 32923 'liferay-translation-manager': { 32924 path: 'translation_manager.js', 32925 requires: [ 32926 'aui-base' 32927 ] 32928 }, 32929 'liferay-undo-manager': { 32930 path: 'undo_manager.js', 32931 requires: [ 32932 'aui-data-set-deprecated', 32933 'base' 32934 ] 32935 }, 32936 'liferay-upload': { 32937 path: 'upload.js', 32938 requires: [ 32939 'aui-io-request', 32940 'aui-template-deprecated', 32941 'collection', 32942 'liferay-portlet-base', 32943 'liferay-storage-formatter', 32944 'uploader' 32945 ] 32946 }, 32947 'liferay-url-preview': { 32948 path: 'url_preview.js', 32949 requires: [ 32950 'aui-component', 32951 'liferay-util-window' 32952 ] 32953 }, 32954 'liferay-util-window': { 32955 path: 'util_window.js', 32956 requires: [ 32957 'aui-dialog-iframe-deprecated', 32958 'aui-modal', 32959 'event-resize', 32960 'liferay-widget-zindex' 32961 ] 32962 }, 32963 'liferay-widget-size-animation-plugin': { 32964 path: 'widget_size_animation_plugin.js', 32965 requires: [ 32966 'anim-easing', 32967 'plugin', 32968 'widget' 32969 ] 32970 }, 32971 'liferay-widget-zindex': { 32972 path: 'widget_zindex.js', 32973 requires: [ 32974 'aui-modal', 32975 'plugin' 32976 ] 32977 }, 32978 'liferay-xml-formatter': { 32979 path: 'xml_formatter.js', 32980 requires: [ 32981 'aui-base' 32982 ] 32983 } 32984 }, 32985 root: PATH_JAVASCRIPT + '/liferay/' 32986 }, 32987 32988 misc: { 32989 base: Liferay.ThemeDisplay.getCDNBaseURL() + PATH_JAVASCRIPT + '/misc/', 32990 combine: COMBINE, 32991 modules: { 32992 'swfobject': { 32993 path: 'swfobject.js' 32994 }, 32995 'swfupload': { 32996 path: 'swfupload/swfupload.js' 32997 } 32998 }, 32999 root: PATH_JAVASCRIPT + '/misc/' 33000 }, 33001 33002 portal: { 33003 base: Liferay.ThemeDisplay.getCDNBaseURL() + PATH_JAVASCRIPT + '/liferay/', 33004 combine: false, 33005 modules: { 33006 'portal-available-languages': { 33007 path: LiferayAUI.getAvailableLangPath(), 33008 requires: [ 33009 'liferay-language' 33010 ] 33011 } 33012 }, 33013 root: PATH_JAVASCRIPT + '/liferay/' 33014 } 33015 }, 33016 insertBefore: 'liferayPortalCSS', 33017 lang: themeDisplay.getBCP47LanguageId(), 33018 root: PATH_JAVASCRIPT + '/aui/', 33019 useBrowserConsole: false 33020 }; 33021 33022 CORE_MODULES.push('liferay-browser-selectors'); 33023})(); 33024;(function() { 33025 var ALLOY = YUI(); 33026 33027 if (ALLOY.html5shiv) { 33028 ALLOY.html5shiv(); 33029 } 33030 33031 var originalUse = ALLOY.use; 33032 33033 ALLOY.use = function() { 33034 var args = Array.prototype.slice.call(arguments, 0); 33035 33036 var currentURL = Liferay.currentURL; 33037 33038 var originalCallback = args[args.length - 1]; 33039 33040 if (typeof originalCallback === 'function') { 33041 args[args.length - 1] = function() { 33042 if (Liferay.currentURL === currentURL) { 33043 originalCallback.apply(this, arguments); 33044 } 33045 }; 33046 } 33047 33048 return originalUse.apply(this, args); 33049 }; 33050 33051 window.AUI = function() { 33052 return ALLOY; 33053 }; 33054 33055 ALLOY.mix(AUI, YUI); 33056 33057 AUI.$ = window.jQuery; 33058 AUI._ = window._; 33059})(); 33060/** 33061* Clay 2.14.2 33062* 33063* Copyright 2019, Liferay, Inc. 33064* All rights reserved. 33065* MIT license 33066*/ 33067+function($) { 33068 var CollapsibleSearch = function(element) { 33069 var instance = this; 33070 33071 instance.$element = $(element); 33072 instance.$close = instance.$element.find('.basic-search-close'); 33073 instance.$input = instance.$element.find('input[type="text"]'); 33074 instance.$submit = instance.$element.find('[type="submit"]'); 33075 33076 instance.$close.on('click.lexicon.close.collapsible-search', $.proxy(instance.close, instance)); 33077 instance.$input.on('blur.lexicon.collapsible-search', $.proxy(instance.blur, instance)); 33078 instance.$input.on('focus.lexicon.collapsible-search', $.proxy(instance.focus, instance)); 33079 instance.$submit.on('click.lexicon.submit.collapsible-search', $.proxy(instance.submit, instance)); 33080 }; 33081 33082 CollapsibleSearch.BREAKPOINT = 768; 33083 CollapsibleSearch.TRANSITION_DURATION = 500; 33084 33085 CollapsibleSearch.prototype = { 33086 blur: function(event) { 33087 var $input = $(event.currentTarget); 33088 33089 $input.closest('.basic-search').removeClass('focus'); 33090 }, 33091 33092 close: function(event) { 33093 var instance = this; 33094 33095 var basicSearch = $(event.currentTarget).closest('.basic-search'); 33096 33097 var basicSearchSlider = basicSearch.find('.basic-search-slider'); 33098 var basicSearchSubmit = basicSearch.find('[type="submit"]'); 33099 33100 var complete = function() { 33101 basicSearch.removeClass('basic-search-transition'); 33102 33103 basicSearch.trigger('closed.lexicon.collapsible.search'); 33104 }; 33105 33106 var supportsTransition = bootstrap.Util.supportsTransitionEnd(); 33107 33108 if (supportsTransition) { 33109 basicSearchSlider.one('bsTransitionEnd', $.proxy(complete, instance)) 33110 .emulateTransitionEnd(CollapsibleSearch.TRANSITION_DURATION); 33111 } 33112 33113 basicSearch.addClass('basic-search-transition').removeClass('open'); 33114 33115 if (!supportsTransition) { 33116 complete.call(instance); 33117 } 33118 else { 33119 basicSearchSubmit.focus(); 33120 } 33121 }, 33122 33123 destroy: function() { 33124 var instance = this; 33125 33126 instance.$close.off('click.lexicon.close.collapsible-search'); 33127 instance.$input.off('blur.lexicon.collapsible-search'); 33128 instance.$input.off('focus.lexicon.collapsible-search'); 33129 instance.$submit.off('click.lexicon.submit.collapsible-search'); 33130 }, 33131 33132 focus: function(event) { 33133 $(event.currentTarget).closest('.basic-search').addClass('focus'); 33134 }, 33135 33136 submit: function(event) { 33137 var instance = this; 33138 33139 if (window.innerWidth < CollapsibleSearch.BREAKPOINT) { 33140 var basicSearch = $(event.currentTarget).parents('.basic-search'); 33141 33142 var basicSearchInput = basicSearch.find('input[type="text"]'); 33143 var basicSearchSlider = basicSearch.find('.basic-search-slider'); 33144 33145 var complete = function() { 33146 basicSearch.removeClass('basic-search-transition'); 33147 basicSearchInput.focus(); 33148 33149 basicSearch.trigger('open.lexicon.collapsible.search'); 33150 }; 33151 33152 if (!basicSearch.hasClass('open')) { 33153 event.preventDefault(); 33154 33155 var supportsTransition = bootstrap.Util.supportsTransitionEnd(); 33156 33157 if (supportsTransition) { 33158 basicSearchSlider.one('bsTransitionEnd', $.proxy(complete, instance)) 33159 .emulateTransitionEnd(CollapsibleSearch.TRANSITION_DURATION); 33160 } 33161 33162 basicSearch.addClass('basic-search-transition').addClass('open'); 33163 33164 if (!supportsTransition) { 33165 complete.call(instance); 33166 } 33167 } 33168 } 33169 } 33170 }; 33171 33172 var Plugin = function(option) { 33173 return this.each( 33174 function() { 33175 var $this = $(this); 33176 33177 var data = $this.data('lexicon.collapsible-search'); 33178 33179 if (!data) { 33180 data = new CollapsibleSearch(this); 33181 33182 $this.data('lexicon.collapsible-search', data); 33183 } 33184 33185 if (typeof option == 'string') { 33186 data[option](); 33187 } 33188 } 33189 ); 33190 }; 33191 33192 var old = $.fn.collapsibleSearch; 33193 33194 $.fn.collapsibleSearch = Plugin; 33195 $.fn.collapsibleSearch.Constructor = CollapsibleSearch; 33196 33197 $.fn.collapsibleSearch.noConflict = function() { 33198 $.fn.collapsibleSearch = old; 33199 33200 return this; 33201 }; 33202 33203 var close = '[data-toggle="collapsible-search"] .basic-search-close'; 33204 var input = '[data-toggle="collapsible-search"] input[type="text"]'; 33205 var submit = '[data-toggle="collapsible-search"] [type="submit"]'; 33206 33207 $(document) 33208 .on('blur.lexicon.collapsible-search.data-api', input, $.proxy(CollapsibleSearch.prototype.blur, CollapsibleSearch)) 33209 .on('click.lexicon.close.collapsible-search.data-api', close, $.proxy(CollapsibleSearch.prototype.close, CollapsibleSearch)) 33210 .on('click.lexicon.submit.collapsible-search.data-api', submit, $.proxy(CollapsibleSearch.prototype.submit, CollapsibleSearch)) 33211 .on('focus.lexicon.collapsible-search.data-api', input, $.proxy(CollapsibleSearch.prototype.focu
33211s, CollapsibleSearch)); 33212}(jQuery); 33213/** 33214* Clay 2.14.2 33215* 33216* Copyright 2019, Liferay, Inc. 33217* All rights reserved. 33218* MIT license 33219*/ 33220+function($) { 33221 var doc = $(document); 33222 33223 var listenerAdded = false; 33224 33225 // Make sure we only add one resize listener to the page, 33226 // no matter how many components we have 33227 33228 var addResizeListener = function() { 33229 if (!listenerAdded) { 33230 $(window).on( 33231 'resize', 33232 debounce( 33233 function(event) { 33234 doc.trigger('screenChange.lexicon.sidenav'); 33235 }, 33236 150 33237 ) 33238 ); 33239 33240 listenerAdded = true; 33241 } 33242 }; 33243 33244 var debounce = function(fn, delay) { 33245 var id; 33246 33247 return function() { 33248 var instance = this; 33249 33250 var args = arguments; 33251 33252 var later = function() { 33253 id = null; 33254 33255 fn.apply(instance, args); 33256 }; 33257 33258 clearTimeout(id); 33259 33260 id = setTimeout(later, delay); 33261 }; 33262 }; 33263 33264 var getBreakpointRegion = function() { 33265 var screenXs = 480; 33266 var screenSm = 768; 33267 var screenMd = 992; 33268 var screenLg = 1200; 33269 33270 var windowWidth = window.innerWidth; 33271 var region = ''; 33272 33273 if (windowWidth >= screenLg) { 33274 region = 'lg'; 33275 } 33276 else if (windowWidth >= screenMd) { 33277 region = 'md'; 33278 } 33279 else if (windowWidth >= screenSm) { 33280 region = 'sm'; 33281 } 33282 else if (windowWidth >= screenXs) { 33283 region = 'xs'; 33284 } 33285 else { 33286 region = 'xxs'; 33287 } 33288 33289 return region; 33290 }; 33291 33292 var guid = (function() { 33293 var counter = 0; 33294 33295 return function(toggler, ns) { 33296 var strId = toggler.attr('id'); 33297 33298 if (!strId) { 33299 strId = (ns + counter++); 33300 33301 toggler.attr('id', strId); 33302 } 33303 33304 return strId; 33305 }; 33306 }()); 33307 33308 var toInt = function(str) { 33309 return parseInt(str, 10) || 0; 33310 }; 33311 33312 var SideNavigation = function(toggler, options) { 33313 this.init(toggler, options); 33314 }; 33315 33316 SideNavigation.TRANSITION_DURATION = 500; 33317 33318 SideNavigation.prototype = { 33319 init: function(toggler, options) { 33320 var instance = this; 33321 33322 var useDataAttribute = toggler.data('toggle') === 'sidenav'; 33323 33324 options = $.extend({}, $.fn.sideNavigation.defaults, options); 33325 33326 options.breakpoint = toInt(options.breakpoint); 33327 options.container = options.container || toggler.data('target') || toggler.attr('href'); 33328 options.gutter = toInt(options.gutter); 33329 options.heightType = options.heightType || (options.equalHeight ? 'equalHeight' : false); 33330 options.rtl = doc.attr('dir') === 'rtl'; 33331 options.width = toInt(options.width); 33332 options.widthOriginal = options.width; 33333 33334 // instantiate using data attribute 33335 33336 if (useDataAttribute) { 33337 options.closedClass = toggler.data('closed-class') || 'closed'; 33338 options.content = toggler.data('content'); 33339 options.equalHeight = false; // equalHeight option is deprecated 33340 options.loadingIndicatorTPL = toggler.data('loading-indicator-tpl') || options.loadingIndicatorTPL; 33341 options.openClass = toggler.data('open-class') || 'open'; 33342 options.toggler = toggler; 33343 options.type = toggler.data('type'); 33344 options.typeMobile = toggler.data('type-mobile'); 33345 options.url = toggler.data('url'); 33346 options.useDelegate = toggler.data('use-delegate'); 33347 options.width = ''; 33348 33349 if (options.useDelegate === undefined) { 33350 options.useDelegate = true; 33351 } 33352 } 33353 33354 instance.toggler = toggler; 33355 instance.options = options; 33356 instance.useDataAttribute = useDataAttribute; 33357 33358 instance._bindUI(); 33359 instance._renderUI(); 33360 }, 33361 33362 clearStyle: function(attribute) { 33363 var instance = this; 33364 33365 var options = instance.options; 33366 33367 var container = $(options.container); 33368 var content = container.find(options.content).first(); 33369 var navigation = container.find(options.navigation).first(); 33370 33371 var menu = container.find('.sidenav-menu').first(); 33372 33373 var els = content.add(navigation).add(menu); 33374 33375 if (Array.isArray(attribute)) { 33376 for (var i = 0; i < attribute.length; i++) { 33377 els.css(attribute[i], ''); 33378 } 33379 } 33380 else { 33381 els.css(attribute, ''); 33382 } 33383 }, 33384 33385 destroy: function() { 33386 var instance = this; 33387 33388 var options = instance.options; 33389 33390 var container = $(instance.options.container); 33391 33392 // Detach sidenav close 33393 33394 doc.off('click.close.lexicon.sidenav', instance.closeButtonSelector); 33395 doc.data(instance.dataCloseButtonSelector, null); 33396 33397 // Detach toggler 33398 33399 if (options.useDelegate) { 33400 doc.off('click.lexicon.sidenav', instance.togglerSelector); 33401 doc.data(instance.dataTogglerSelector, null); 33402 } 33403 else { 33404 container.off('click.lexicon.sidenav'); 33405 } 33406 33407 // Remove Side Navigation 33408 33409 container.data('lexicon.sidenav', null); 33410 }, 33411 33412 hide: function() { 33413 var instance = this; 33414 33415 if (instance.useDataAttribute) { 33416 instance.hideSimpleSidenav(); 33417 } 33418 else { 33419 instance.toggleNavigation(false); 33420 } 33421 }, 33422 33423 hideSidenav: function() { 33424 var instance = this; 33425 var options = instance.options; 33426 33427 var container = $(options.container); 33428 var content = container.find(options.content).first(); 33429 var navigation = container.find(options.navigation).first(); 33430 var menu = navigation.find('.sidenav-menu').first(); 33431 33432 var sidenavRight = instance._isSidenavRight(); 33433 33434 var positionDirection = options.rtl ? 'right' : 'left'; 33435 33436 if (sidenavRight) { 33437 positionDirection = options.rtl ? 'left' : 'right'; 33438 } 33439 33440 var paddingDirection = 'padding-' + positionDirection; 33441 33442 content.css(paddingDirection, '').css(positionDirection, ''); 33443 33444 navigation.css('width', ''); 33445 33446 if (sidenavRight) { 33447 menu.css(positionDirection, instance._getSidenavWidth()); 33448 } 33449 }, 33450 33451 hideSimpleSidenav: function() { 33452 var instance = this; 33453 33454 var options = instance.options; 33455 33456 var simpleSidenavClosed = instance._isSimpleSidenavClosed(); 33457 33458 if (!simpleSidenavClosed) { 33459 var content = $(options.content).first(); 33460 var sidenav = $(options.container); 33461 33462 var closedClass = options.closedClass; 33463 var openClass = options.openClass; 33464 33465 var toggler = instance.toggler; 33466 33467 var target = toggler.attr('href') || toggler.attr('data-target'); 33468 33469 sidenav.trigger({ 33470 toggler: $(instance.togglerSelector), 33471 type: 'closedStart.lexicon.sidenav' 33472 }); 33473 33474 instance._onSidenavTransitionEnd(content, function() { 33475 sidenav.removeClass('sidenav-transition'); 33476 toggler.removeClass('sidenav-transition'); 33477 33478 sidenav.trigger({ 33479 toggler: $(instance.togglerSelector), 33480 type: 'closed.lexicon.sidenav' 33481 }); 33482 }); 33483 33484 if (content.hasClass(openClass)) { 33485 content.addClass('sidenav-transition').addClass(closedClass).removeClass(openClass); 33486 } 33487 33488 sidenav.addClass('sidenav-transition'); 33489 toggler.addClass('sidenav-transition'); 33490 33491 sidenav.addClass(closedClass).removeClass(openClass); 33492 33493 $('[data-target="' + target + '"]').removeClass(openClass).removeClass('active'); 33494 $('[href="' + target + '"]').removeClass(openClass).removeClass('active'); 33495 } 33496 }, 33497 33498 setEqualHeight: function() { 33499 var instance = this; 33500 33501 var options = instance.options; 33502 33503 var container = $(options.container); 33504 var content = options.content; 33505 var navigation = options.navigation; 33506 33507 var type = instance.mobile ? options.typeMobile : options.type; 33508 33509 if (type !== 'fixed' && type !== 'fixed-push') { 33510 var contentNode = container.find(content).first(); 33511 var navNode = container.find(navigation).first(); 33512 var sideNavMenuNode = container.find('.sidenav-menu').first(); 33513 33514 var tallest = Math.max(contentNode.outerHeight(), navNode.outerHeight()); 33515 33516 contentNode.css('min-height', tallest); 33517 33518 navNode.css({ 33519 'min-height': tallest, 33520 'height': '100%' 33521 }); 33522 33523 sideNavMenuNode.css({ 33524 'min-height': tallest, 33525 'height': '100%' 33526 }); 33527 } 33528 }, 33529 33530 setFullHeight: function() { 33531 var instance = this; 33532 33533 var options = instance.options; 33534 33535 var container = $(options.container); 33536 var navigation = options.navigation; 33537 33538 var type = instance.mobile ? options.typeMobile : options.type; 33539 33540 if (type === 'relative') { 33541 var navNode = container.find(navigation).first(); 33542 var sidenavMenuNode = container.find('.sidenav-menu').first(); 33543 33544 var minHeight = doc.innerHeight() - navNode.offset().top; 33545
33546 if (sidenavMenuNode.innerHeight() + navNode.offset().top > doc.innerHeight()) { 33547 minHeight = sidenavMenuNode.innerHeight(); 33548 } 33549 33550 navNode.css({ 33551 'min-height': minHeight, 33552 'height': '100%' 33553 }); 33554 33555 sidenavMenuNode.css({ 33556 'min-height': minHeight, 33557 'height': '100%' 33558 }); 33559 } 33560 }, 33561 33562 setHeight: function() { 33563 var instance = this; 33564 33565 var options = instance.options; 33566 33567 if (options.heightType === 'equalHeight') { 33568 instance.setEqualHeight(); 33569 } 33570 else if (options.heightType === 'fullHeight') { 33571 instance.setFullHeight(); 33572 } 33573 }, 33574 33575 show: function() { 33576 var instance = this; 33577 33578 if (instance.useDataAttribute) { 33579 instance.showSimpleSidenav(); 33580 } 33581 else { 33582 instance.toggleNavigation(true); 33583 } 33584 }, 33585 33586 showSidenav: function() { 33587 var instance = this; 33588 var mobile = instance.mobile; 33589 var options = instance.options; 33590 33591 var container = $(options.container); 33592 var content = container.find(options.content).first(); 33593 var navigation = container.find(options.navigation).first(); 33594 var menu = navigation.find('.sidenav-menu').first(); 33595 33596 var sidenavRight = instance._isSidenavRight(); 33597 var width = instance._getSidenavWidth(); 33598 33599 var offset = width + options.gutter; 33600 33601 var url = options.url; 33602 33603 if (url) { 33604 container.one( 33605 'urlLoaded.lexicon.sidenav', 33606 function(event) { 33607 instance.setHeight(); 33608 } 33609 ); 33610 33611 instance._loadUrl(menu, url, container); 33612 } 33613 33614 navigation.css('width', width); 33615 menu.css('width', width); 33616 33617 var positionDirection = options.rtl ? 'right' : 'left'; 33618 33619 if (sidenavRight) { 33620 positionDirection = options.rtl ? 'left' : 'right'; 33621 } 33622 33623 var paddingDirection = 'padding-' + positionDirection; 33624 33625 var pushContentCssProperty = mobile ? positionDirection : paddingDirection; 33626 var type = mobile ? options.typeMobile : options.type; 33627 33628 if (type !== 'fixed') { 33629 var navigationStartX = container.hasClass('open') ? navigation.offset().left - options.gutter : navigation.offset().left - offset; 33630 33631 var contentStartX = content.offset().left; 33632 var contentWidth = content.innerWidth(); 33633 33634 var padding = ''; 33635 33636 if ((options.rtl && sidenavRight) || (!options.rtl && options.position === 'left')) { 33637 navigationStartX = navigation.offset().left + offset; 33638 33639 if (navigationStartX > contentStartX) { 33640 padding = navigationStartX - contentStartX; 33641 } 33642 } 33643 else if ((options.rtl && options.position === 'left') || (!options.rtl && sidenavRight)) { 33644 if (navigationStartX < contentStartX + contentWidth) { 33645 padding = (contentStartX + contentWidth) - navigationStartX; 33646 33647 if (padding >= offset) { 33648 padding = offset; 33649 } 33650 } 33651 } 33652 33653 content.css(pushContentCssProperty, padding); 33654 } 33655 }, 33656 33657 showSimpleSidenav: function() { 33658 var instance = this; 33659 33660 var options = instance.options; 33661 33662 var simpleSidenavClosed = instance._isSimpleSidenavClosed(); 33663 33664 if (simpleSidenavClosed) { 33665 var content = $(options.content).first(); 33666 var sidenav = $(options.container); 33667 33668 var closedClass = options.closedClass; 33669 var openClass = options.openClass; 33670 33671 var toggler = options.toggler; 33672 33673 var url = toggler.data('url'); 33674 33675 if (url) { 33676 instance._loadUrl(sidenav, url); 33677 } 33678 33679 sidenav.trigger({ 33680 toggler: $(instance.togglerSelector), 33681 type: 'openStart.lexicon.sidenav' 33682 }); 33683 33684 instance._onSidenavTransitionEnd(content, function() { 33685 sidenav.removeClass('sidenav-transition'); 33686 toggler.removeClass('sidenav-transition'); 33687 33688 sidenav.trigger({ 33689 toggler: $(instance.togglerSelector), 33690 type: 'open.lexicon.sidenav' 33691 }); 33692 }); 33693 33694 content.addClass('sidenav-transition').addClass(openClass).removeClass(closedClass); 33695 sidenav.addClass('sidenav-transition'); 33696 toggler.addClass('sidenav-transition'); 33697 33698 sidenav.addClass(openClass).removeClass(closedClass); 33699 toggler.addClass('active').addClass(openClass); 33700 } 33701 }, 33702 33703 toggle: function() { 33704 var instance = this; 33705 33706 if (instance.useDataAttribute) { 33707 instance.toggleSimpleSidenav(); 33708 } 33709 else { 33710 instance.toggleNavigation(); 33711 } 33712 }, 33713 33714 toggleNavigation: function(force) { 33715 var instance = this; 33716 var options = instance.options; 33717 33718 var container = $(options.container); 33719 var menu = container.find('.sidenav-menu').first(); 33720 var toggler = instance.toggler; 33721 33722 var width = options.width; 33723 33724 var closed = $.type(force) === 'boolean' ? force : container.hasClass('closed'); 33725 var sidenavRight = instance._isSidenavRight(); 33726 33727 var widthMethod = closed ? 'showSidenav' : 'hideSidenav'; 33728 33729 if (closed) { 33730 container.trigger({ 33731 toggler: toggler, 33732 type: 'openStart.lexicon.sidenav' 33733 }); 33734 } 33735 else { 33736 container.trigger({ 33737 toggler: toggler, 33738 type: 'closedStart.lexicon.sidenav' 33739 }); 33740 } 33741 33742 instance._onSidenavTransitionEnd(container, function() { 33743 var menu = container.find('.sidenav-menu').first(); 33744 33745 if (container.hasClass('closed')) { 33746 instance.clearStyle(['min-height', 'height']); 33747 33748 toggler.removeClass('open').removeClass('sidenav-transition'); 33749 33750 container.trigger({ 33751 toggler: toggler, 33752 type: 'closed.lexicon.sidenav' 33753 }); 33754 } 33755 else { 33756 toggler.addClass('open').removeClass('sidenav-transition'); 33757 33758 container.trigger({ 33759 toggler: toggler, 33760 type: 'open.lexicon.sidenav' 33761 }); 33762 } 33763 33764 if (instance.mobile) { 33765 instance._focusElement(menu); 33766 } 33767 }); 33768 33769 if (closed) { 33770 instance.setHeight(); 33771 33772 menu.css('width', width); 33773 33774 var positionDirection = options.rtl ? 'left' : 'right'; 33775 33776 if (sidenavRight) { 33777 menu.css(positionDirection, ''); 33778 } 33779 } 33780 33781 container.addClass('sidenav-transition'); 33782 toggler.addClass('sidenav-transition'); 33783 33784 instance[widthMethod](container); 33785 33786 container.toggleClass('closed', !closed).toggleClass('open', closed); 33787 toggler.toggleClass('active', closed).toggleClass('open', closed); 33788 }, 33789 33790 toggleSimpleSidenav: function() { 33791 var instance = this; 33792 33793 var simpleSidenavClosed = instance._isSimpleSidenavClosed(); 33794 33795 if (simpleSidenavClosed) { 33796 instance.showSimpleSidenav(); 33797 } 33798 else { 33799 instance.hideSimpleSidenav(); 33800 } 33801 }, 33802 33803 visible: function() { 33804 var instance = this; 33805 33806 var closed; 33807 33808 if (instance.useDataAttribute) { 33809 closed = instance._isSimpleSidenavClosed(); 33810 } 33811 else { 33812 var container = $(instance.options.container); 33813 33814 closed = container.hasClass('sidenav-transition') ? !container.hasClass('closed') : container.hasClass('closed'); 33815 } 33816 33817 return !closed; 33818 }, 33819 33820 _bindUI: function() { 33821 var instance = this; 33822 33823 if (!instance.useDataAttribute) { 33824 addResizeListener(); 33825 instance._onScreenChange(); 33826 } 33827 33828 if (instance.options.useDelegate) { 33829 instance._onDelegateClickTrigger(); 33830 } 33831 else { 33832 instance._onClickTrigger(); 33833 } 33834 33835 instance._onClickSidenavClose(); 33836 }, 33837 33838 _focusElement: function(el) { 33839 33840 // ios 8 fixed element disappears when trying to scroll 33841 33842 el.focus(); 33843 }, 33844 33845 _getSidenavWidth: function() { 33846 var instance = this; 33847 33848 var options = instance.options; 33849 33850 var widthOriginal = options.widthOriginal; 33851 33852 var width = widthOriginal; 33853 var winWidth = window.innerWidth; 33854 33855 if (winWidth < widthOriginal + 40) { 33856 width = winWidth - 40; 33857 } 33858 33859 return width; 33860 }, 33861 33862 _getSimpleSidenavType: function() { 33863 var instance = this; 33864 33865 var options = instance.options; 33866 33867 var desktop = instance._isDesktop(); 33868 var type = options.type; 33869 var typeMobile = options.typeMobile; 33870 33871 if (desktop && (type === 'fixed-push')) { 33872 return 'desktop-fixed-push'; 33873 } 33874 else if (!desktop && (typeMobile === 'fixed-push')) { 33875 return 'mobile-fixed-push'; 33876 } 33877 33878 return 'fixed'; 33879 }, 33880 33881 _isDesktop: function() { 33882 return window.innerWidth >= this.options.breakpoint; 33883 }, 33884 33885 _isSidenavRight: function() { 33886 var instance = this; 33887 var options = instance.options; 33888 33889 var container = $(options.container); 33890 var isSidenavRight = container.hasClass('sidenav-right'); 33891 33892 return isSidenavRight; 33893 }, 33894 33895 _isSimpleSidenavClosed: function() { 33896 var instance = this; 33897 var options = instance.options; 33898 33899 var openClass = options.openClass; 33900 33901 var container = $(options.container); 33902 33903 return !container.hasClass(openClass); 33904 }, 33905 33906 _loadUrl: function(sidenav, url, eventTarget) { 33907 var instance = this; 33908 33909 var urlLoaded = sidenav.data('url-loaded'); 33910 33911 var readyState = urlLoaded ? urlLoaded.readyState : 0; 33912 33913 eventTarget = eventTarget || sidenav; 33914 33915 var sidebarBody = sidenav.find('.sidebar-body').first(); 33916 33917 if (!readyState && sidebarBody.length && (typeof url === 'string' || $.isPlainObject(url))) { 33918 sidebarBody.append('<div class="sidenav-loading">' + instance.options.loadingIndicatorTPL + '</div>'); 33919 33920 urlLoaded = $.ajax(url).done( 33921 function(response) { 33922 sidebarBody.append(response); 33923 33924 eventTarget.trigger('urlLoaded.lexicon.sidenav'); 33925 33926 sidebarBody.find('.sidenav-loading').remove(); 33927 } 33928 ); 33929 33930 sidenav.data('url-loaded', urlLoaded); 33931 } 33932 33933 return urlLoaded; 33934 }, 33935 33936 _onClickSidenavClose: function() { 33937 var instance = this; 33938 33939 var options = instance.options; 33940 33941 var container = $(options.container); 33942 var containerSelector = options.container; 33943 33944 var closeButton = $(containerSelector).find('.sidenav-close').first(); 33945 var closeButtonSelector = '#' + guid(closeButton, 'generatedLexiconSidenavCloseId'); 33946 var dataCloseButtonSelector = 'lexicon.' + closeButtonSelector; 33947 33948 if (!doc.data(dataCloseButtonSelector)) { 33949 doc.data(dataCloseButtonSelector, 'true'); 33950 33951 doc.on('click.close.lexicon.sidenav', closeButtonSelector, function(event) { 33952 event.preventDefault(); 33953
33954 instance.toggle(); 33955 }); 33956 } 33957 33958 instance.closeButtonSelector = closeButtonSelector; 33959 instance.dataCloseButtonSelector = dataCloseButtonSelector; 33960 }, 33961 33962 _onClickTrigger: function() { 33963 var instance = this; 33964 33965 var el = instance.toggler; 33966 33967 el.on( 33968 'click.lexicon.sidenav', 33969 function(event) { 33970 instance.toggle(); 33971 } 33972 ); 33973 }, 33974 33975 _onDelegateClickTrigger: function() { 33976 var instance = this; 33977 33978 var toggler = instance.toggler; 33979 33980 var togglerSelector = '#' + guid(toggler, 'generatedLexiconSidenavTogglerId'); 33981 33982 var dataTogglerSelector = 'lexicon.' + togglerSelector; 33983 33984 if (!doc.data(dataTogglerSelector)) { 33985 doc.data(dataTogglerSelector, 'true'); 33986 33987 doc.on( 33988 'click.lexicon.sidenav', 33989 togglerSelector, 33990 function(event) { 33991 instance.toggle(); 33992 33993 event.preventDefault(); 33994 } 33995 ); 33996 } 33997 33998 instance.togglerSelector = togglerSelector; 33999 instance.dataTogglerSelector = dataTogglerSelector; 34000 }, 34001 34002 _onScreenChange: function() { 34003 var instance = this; 34004 var options = instance.options; 34005 34006 var container = $(options.container); 34007 var toggler = instance.toggler; 34008 34009 var screenStartDesktop = instance._setScreenSize(); 34010 34011 doc.on('screenChange.lexicon.sidenav', function(event) { 34012 var desktop = instance._setScreenSize(); 34013 var sidenavRight = instance._isSidenavRight(); 34014 var type = desktop ? options.type : options.typeMobile; 34015 34016 var fixedMenu = type === 'fixed' || type === 'fixed-push'; 34017 34018 var menu = container.find('.sidenav-menu').first(); 34019 var navigation = container.find(options.navigation).first(); 34020 34021 var menuWidth; 34022 34023 var originalMenuWidth = options.widthOriginal; 34024 34025 var positionDirection = options.rtl ? 'left' : 'right'; 34026 34027 container.toggleClass('sidenav-fixed', fixedMenu); 34028 34029 if ((!desktop && screenStartDesktop) || (desktop && !screenStartDesktop)) { 34030 instance.hideSidenav(); 34031 34032 instance.clearStyle([ 'min-height', 'height' ]); 34033 34034 container.addClass('closed').removeClass('open'); 34035 toggler.removeClass('active').removeClass('open'); 34036 34037 screenStartDesktop = false; 34038 34039 if (desktop) { 34040 if (sidenavRight) { 34041 menu.css(positionDirection, originalMenuWidth).css('width', originalMenuWidth); 34042 } 34043 34044 screenStartDesktop = true; 34045 } 34046 } 34047 34048 var closed = container.hasClass('closed'); 34049 34050 if (!desktop) { 34051 menuWidth = originalMenuWidth; 34052 34053 if (window.innerWidth <= originalMenuWidth) { 34054 menuWidth = window.innerWidth - options.gutter - 25; 34055 } 34056 34057 if (sidenavRight) { 34058 if (closed) { 34059 menu.css(positionDirection, menuWidth); 34060 } 34061 34062 menu.css('width', menuWidth); 34063 } 34064 34065 screenStartDesktop = false; 34066 } 34067 34068 if (!closed) { 34069 instance.clearStyle([ 'min-height', 'height' ]); 34070 34071 instance.showSidenav(); 34072 instance.setHeight(); 34073 } 34074 }); 34075 }, 34076 34077 _onSidenavTransitionEnd: function(el, fn) { 34078 var instance = this; 34079 34080 var transitionEnd = 'bsTransitionEnd'; 34081 34082 var complete = function() { 34083 el.removeClass('sidenav-transition'); 34084 34085 if (fn) { 34086 fn(); 34087 } 34088 }; 34089 34090 if (!bootstrap.Util.supportsTransitionEnd()) { 34091 complete.call(instance); 34092 } 34093 else { 34094 el.one(transitionEnd, function(event) { 34095 complete(); 34096 }) 34097 .emulateTransitionEnd(SideNavigation.TRANSITION_DURATION); 34098 } 34099 }, 34100 34101 _renderNav: function() { 34102 var instance = this; 34103 var options = instance.options; 34104 34105 var container = $(options.container); 34106 var slider = container.find(options.navigation).first(); 34107 var menu = slider.find('.sidenav-menu').first(); 34108 34109 var closed = container.hasClass('closed'); 34110 var sidenavRight = instance._isSidenavRight(); 34111 var width = instance._getSidenavWidth(); 34112 34113 if (closed) { 34114 menu.css('width', width); 34115 34116 if (sidenavRight) { 34117 var positionDirection = options.rtl ? 'left' : 'right'; 34118 34119 menu.css(positionDirection, width); 34120 } 34121 } 34122 else { 34123 instance.showSidenav(); 34124 instance.setHeight(); 34125 } 34126 34127 container.removeClass('sidenav-js-fouc'); 34128 }, 34129 34130 _renderUI: function() { 34131 var instance = this; 34132 var options = instance.options; 34133 34134 var container = $(options.container); 34135 var toggler = instance.toggler; 34136 34137 var mobile = instance.mobile; 34138 var type = mobile ? options.typeMobile : options.type; 34139 34140 if (!instance.useDataAttribute) { 34141 if (mobile) { 34142 container.addClass('closed').removeClass('open'); 34143 toggler.removeClass('active').removeClass('open'); 34144 } 34145 34146 if (options.position === 'right') { 34147 container.addClass('sidenav-right'); 34148 } 34149 34150 if (type !== 'relative') { 34151 container.addClass('sidenav-fixed'); 34152 } 34153 34154 instance._renderNav(); 34155 } 34156 34157 container.css('display', ''); // Force Reflow for IE11 Browser Bug 34158 }, 34159 34160 _setScreenSize: function() { 34161 var instance = this; 34162
34163 var screenSize = getBreakpointRegion(); 34164 34165 var desktop = screenSize === 'sm' || screenSize === 'md' || screenSize === 'lg'; 34166 34167 instance.mobile = !desktop; 34168 instance.desktop = desktop; 34169 34170 return desktop; 34171 } 34172 }; 34173 34174 var old = $.fn.sideNavigation; 34175 34176 var initialize = function(toggler, options, selector) { 34177 var data = toggler.data('lexicon.sidenav'); 34178 34179 if (!data) { 34180 if (!options) { 34181 options = {}; 34182 } 34183 34184 options.selector = selector; 34185 34186 data = new SideNavigation(toggler, options); 34187 34188 toggler.data('lexicon.sidenav', data); 34189 } 34190 34191 return data; 34192 }; 34193 34194 var Plugin = function(options) { 34195 var instance = this; 34196 34197 var selector = instance.selector; 34198 34199 var retVal = instance; 34200 var methodCall = typeof options === 'string'; 34201 var returnInstance = options === 'instance'; 34202 var args = $.makeArray(arguments).slice(1); 34203 34204 if (methodCall) { 34205 this.each( 34206 function() { 34207 var $this = $(this); 34208 34209 var data = $this.data('lexicon.sidenav'); 34210 34211 if (data) { 34212 if (returnInstance) { 34213 retVal = data; 34214 34215 return false; 34216 } 34217 34218 var methodRetVal; 34219 34220 if ($.isFunction(data[options]) && options.indexOf('_') !== 0) { 34221 methodRetVal = data[options].apply(data, args); 34222 } 34223 34224 if (methodRetVal !== data && methodRetVal !== undefined) { 34225 if (methodRetVal.jquery) { 34226 retVal = retVal.pushStack(methodRetVal.get()); 34227 } 34228 else { 34229 retVal = methodRetVal; 34230 } 34231 34232 return false; 34233 } 34234 } 34235 else if (returnInstance) { 34236 retVal = null; 34237 34238 return false; 34239 } 34240 } 34241 ); 34242 } 34243 else { 34244 this.each( 34245 function() { 34246 initialize($(this), options, selector); 34247 } 34248 ); 34249 } 34250 34251 return retVal; 34252 }; 34253 34254 Plugin.noConflict = function() { 34255 $.fn.sideNavigation = old; 34256 34257 return this; 34258 }; 34259 34260 /** 34261 * Plugin options 34262 * @property {String|Number} breakpoint The window width that defines the desktop size. 34263 * @property {String} content The class or ID of the content container. 34264 * @property {String} container The class or ID of the sidenav container. 34265 * @property {String|Number} gutter The space between the sidenav-slider and the sidenav-content. 34266 * @property {String|Boolean} equalHeight The height of content and navigation should be equal. This is deprecated. 34267 * @property {String} heightType Calculates the height of sidenav when type is relative. Possible values: `fullHeight`, `equalHeight` 34268 * @property {String} navigation The class or ID of the navigation container. 34269 * @property {String} position The position of the sidenav-slider. Possible values: left, right 34270 * @property {String} type The type of sidenav in desktop. Possible values: relative, fixed, fixed-push 34271 * @property {String} typeMobile The type of sidenav in mobile. Possible values: relative, fixed, fixed-push 34272 * @property {String|Boolean} useDelegate The type of reference to use on the toggler event handler. Value false, directly binds click to the toggler. 34273 * @property {String|Object} url The URL or $.ajax config object to fetch the content to inject into .sidebar-body 34274 * @property {String|Number} width The width of the side navigation. 34275 */ 34276 34277 Plugin.defaults = { 34278 breakpoint: 768, 34279 content: '.sidenav-content', 34280 equalHeight: true, // equalHeight option is deprecated, use heightType instead 34281 gutter: '15px', 34282 heightType: null, 34283 loadingIndicatorTPL: '<div class="loading-animation loading-animation-md"></div>', 34284 navigation: '.sidenav-menu-slider', 34285 position: 'left', 34286 type: 'relative', 34287 typeMobile: 'relative', 34288 url: null, 34289 useDelegate: true, 34290 width: '225px' 34291 }; 34292 34293 Plugin.Constructor = SideNavigation; 34294 34295 $.fn.sideNavigation = Plugin; 34296 34297 $(function() { 34298 var sidenav = $('[data-toggle="sidenav"]'); 34299 34300 Plugin.call(sidenav); 34301 }); 34302}(jQuery); 34303; 34304 34305(function ($) { 34306 /*! 34307 * jQuery fm Plugin 34308 * version: 0.1 34309 * Copyright (c) 2014 Nate Cavanaugh / Liferay Inc. 34310 * Dual licensed under the MIT and GPL licenses. 34311 */ 34312 $.fn.fm = function (name, value) { 34313 var instance = this; 34314 var retVal = instance; 34315 34316 if (arguments.length === 1) { 34317 var nodes = instance.map(function (index, item) { 34318 var formEl = item.form || item; 34319 34320 if (formEl && $.nodeName(formEl, 'form')) { 34321 var form = $(formEl); 34322 var ns = form.data('fm.namespace') || form.data('fm-namespace') || ''; 34323 var inputName = ns + name; 34324 var inputNode = formEl[inputName] || formEl.ownerDocument.getElementById(inputName); 34325 34326 if (inputNode && !inputNode.nodeName) { 34327 inputNode = $.makeArray(inputNode); 34328 } 34329 34330 return inputNode; 34331 } 34332 }); 34333 retVal = nodes; 34334 } else { 34335 if (typeof name === 'string') { 34336 instance.data('fm.' + name, value); 34337 } 34338 } 34339 34340 return retVal; 34341 }; 34342})(AUI.$); 34343//# sourceMappingURL=fm.js.map 34344function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } 34345 34346; 34347 34348(function (jQuery) { 34349 /*! 34350 * jQuery Form Plugin 34351 * version: 3.51.0-2014.06.20 34352 * Requires jQuery v1.5 or later 34353 * Copyright (c) 2014 M. Alsup 34354 * Examples and documentation at: http://malsup.com/jquery/form/ 34355 * Project repository: https://github.com/malsup/form 34356 * Dual licensed under the MIT and GPL licenses.
34357 * https://github.com/malsup/form#copyright-and-license 34358 */ 34359 34360 /*global ActiveXObject */ 34361 // AMD support 34362 (function (factory) { 34363 "use strict"; 34364 34365 if (false && typeof define === 'function' && define.amd) { 34366 // using AMD; register as anon module 34367 define(['jquery'], factory); 34368 } else { 34369 // no AMD; invoke directly 34370 factory(typeof jQuery != 'undefined' ? jQuery : window.Zepto); 34371 } 34372 })(function ($) { 34373 "use strict"; 34374 /* 34375 Usage Note: 34376 ----------- 34377 Do not use both ajaxSubmit and ajaxForm on the same form. These 34378 functions are mutually exclusive. Use ajaxSubmit if you want 34379 to bind your own submit handler to the form. For example, 34380 34381 $(document).ready(function() { 34382 $('#myForm').on('submit', function(e) { 34383 e.preventDefault(); // <-- important 34384 $(this).ajaxSubmit({ 34385 target: '#output' 34386 }); 34387 }); 34388 }); 34389 34390 Use ajaxForm when you want the plugin to manage all the event binding 34391 for you. For example, 34392 34393 $(document).ready(function() { 34394 $('#myForm').ajaxForm({ 34395 target: '#output' 34396 }); 34397 }); 34398 34399 You can also use ajaxForm with delegation (requires jQuery v1.7+), so the 34400 form does not have to exist when you invoke ajaxForm: 34401 34402 $('#myForm').ajaxForm({ 34403 delegation: true, 34404 target: '#output' 34405 }); 34406 34407 When using ajaxForm, the ajaxSubmit function will be invoked for you 34408 at the appropriate time. 34409 */ 34410 34411 /** 34412 * Feature detection 34413 */ 34414 34415 var feature = {}; 34416 feature.fileapi = $("<input type='file'/>").get(0).files !== undefined; 34417 feature.formdata = window.FormData !== undefined; 34418 var hasProp = !!$.fn.prop; // attr2 uses prop when it can but checks the return type for 34419 // an expected string. this accounts for the case where a form 34420 // contains inputs with names like "action" or "method"; in those 34421 // cases "prop" returns the element 34422 34423 $.fn.attr2 = function () { 34424 if (!hasProp) { 34425 return this.attr.apply(this, arguments); 34426 } 34427 34428 var val = this.prop.apply(this, arguments); 34429 34430 if (val && val.jquery || typeof val === 'string') { 34431 return val; 34432 } 34433 34434 return this.attr.apply(this, arguments); 34435 }; 34436 /** 34437 * ajaxSubmit() provides a mechanism for immediately submitting 34438 * an HTML form using AJAX. 34439 */ 34440 34441 34442 $.fn.ajaxSubmit = function (options) { 34443 /*jshint scripturl:true */ 34444 // fast fail if nothing selected (http://dev.jquery.com/ticket/2752) 34445 if (!this.length) { 34446 log('ajaxSubmit: skipping submit process - no element selected'); 34447 return this; 34448 } 34449 34450 var method, 34451 action, 34452 url, 34453 $form = this; 34454 34455 if (typeof options == 'function') { 34456 options = { 34457 success: options 34458 }; 34459 } else if (options === undefined) { 34460 options = {}; 34461 } 34462 34463 method = options.type || this.attr2('method'); 34464 action = options.url || this.attr2('action'); 34465 url = typeof action === 'string' ? $.trim(action) : ''; 34466 url = url || window.location.href || ''; 34467 34468 if (url) { 34469 // clean url (don't include hash vaue) 34470 url = (url.match(/^([^#]+)/) || [])[1]; 34471 } 34472 34473 options = $.extend(true, { 34474 url: url, 34475 success: $.ajaxSettings.success, 34476 type: method || $.ajaxSettings.type, 34477 iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank' 34478 }, options); // hook for manipulating the form data before it is extracted; 34479 // convenient for use with rich editors like tinyMCE or FCKEditor 34480 34481 var veto = {}; 34482 this.trigger('form-pre-serialize', [this, options, veto]); 34483 34484 if (veto.veto) { 34485 log('ajaxSubmit: submit vetoed via form-pre-serialize trigger'); 34486 return this; 34487 } // provide opportunity to alter form data before it is serialized 34488 34489 34490 if (options.beforeSerialize && options.beforeSerialize(this, options) === false) { 34491 log('ajaxSubmit: submit aborted via beforeSerialize callback'); 34492 return this; 34493 } 34494 34495 var traditional = options.traditional; 34496 34497 if (traditional === undefined) { 34498 traditional = $.ajaxSettings.traditional; 34499 } 34500 34501 var elements = []; 34502 var qx,
34503 a = this.formToArray(options.semantic, elements); 34504 34505 if (options.data) { 34506 options.extraData = options.data; 34507 qx = $.param(options.data, traditional); 34508 } // give pre-submit callback an opportunity to abort the submit 34509 34510 34511 if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) { 34512 log('ajaxSubmit: submit aborted via beforeSubmit callback'); 34513 return this; 34514 } // fire vetoable 'validate' event 34515 34516 34517 this.trigger('form-submit-validate', [a, this, options, veto]); 34518 34519 if (veto.veto) { 34520 log('ajaxSubmit: submit vetoed via form-submit-validate trigger'); 34521 return this; 34522 } 34523 34524 var q = $.param(a, traditional); 34525 34526 if (qx) { 34527 q = q ? q + '&' + qx : qx; 34528 } 34529 34530 if (options.type.toUpperCase() == 'GET') { 34531 options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q; 34532 options.data = null; // data is null for 'get' 34533 } else { 34534 options.data = q; // data is the query string for 'post' 34535 } 34536 34537 var callbacks = []; 34538 34539 if (options.resetForm) { 34540 callbacks.push(function () { 34541 $form.resetForm(); 34542 }); 34543 } 34544 34545 if (options.clearForm) { 34546 callbacks.push(function () { 34547 $form.clearForm(options.includeHidden); 34548 }); 34549 } // perform a load on the target only if dataType is not provided 34550 34551 34552 if (!options.dataType && options.target) { 34553 var oldSuccess = options.success || function () {}; 34554 34555 callbacks.push(function (data) { 34556 var fn = options.replaceTarget ? 'replaceWith' : 'html'; 34557 $(options.target)[fn](data).each(oldSuccess, arguments); 34558 }); 34559 } else if (options.success) { 34560 callbacks.push(options.success); 34561 } 34562 34563 options.success = function (data, status, xhr) { 34564 // jQuery 1.4+ passes xhr as 3rd arg 34565 var context = options.context || this; // jQuery 1.4+ supports scope context 34566 34567 for (var i = 0, max = callbacks.length; i < max; i++) { 34568 callbacks[i].apply(context, [data, status, xhr || $form, $form]); 34569 } 34570 }; 34571 34572 if (options.error) { 34573 var oldError = options.error; 34574 34575 options.error = function (xhr, status, error) { 34576 var context = options.context || this; 34577 oldError.apply(context, [xhr, status, error, $form]); 34578 }; 34579 } 34580 34581 if (options.complete) { 34582 var oldComplete = options.complete; 34583 34584 options.complete = function (xhr, status) { 34585 var context = options.context || this; 34586 oldComplete.apply(context, [xhr, status, $form]); 34587 }; 34588 } // are there files to upload? 34589 // [value] (issue #113), also see comment: 34590 // https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219 34591 34592 34593 var fileInputs = $('input[type=file]:enabled', this).filter(function () { 34594 return $(this).val() !== ''; 34595 }); 34596 var hasFileInputs = fileInputs.length > 0; 34597 var mp = 'multipart/form-data'; 34598 var multipart = $form.attr('enctype') == mp || $form.attr('encoding') == mp; 34599 var fileAPI = feature.fileapi && feature.formdata; 34600 log("fileAPI :" + fileAPI); 34601 var shouldUseFrame = (hasFileInputs || multipart) && !fileAPI; 34602 var jqxhr; // options.iframe allows user to force iframe mode 34603 // 06-NOV-09: now defaulting to iframe mode if file input is detected 34604 34605 if (options.iframe !== false && (options.iframe || shouldUseFrame)) { 34606 // hack to fix Safari hang (thanks to Tim Molendijk for this) 34607 // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d 34608 if (options.closeKeepAlive) { 34609 $.get(options.closeKeepAlive, function () { 34610 jqxhr = fileUploadIframe(a); 34611 }); 34612 } else { 34613 jqxhr = fileUploadIframe(a); 34614 } 34615 } else if ((hasFileInputs || multipart) && fileAPI) { 34616 jqxhr = fileUploadXhr(a); 34617 } else { 34618 jqxhr = $.ajax(options); 34619 } 34620 34621 $form.removeData('jqxhr').data('jqxhr', jqxhr); // clear element array 34622 34623 for (var k = 0; k < elements.length; k++) { 34624 elements[k] = null; 34625 } // fire 'notify' event 34626 34627 34628 this.trigger('form-submit-notify', [this, options]); 34629 return this; // utility fn for deep serialization 34630 34631 function deepSerialize(extraData) { 34632 var serialized = $.param(extraData, options.traditional).split('&'); 34633 var len = serialized.length; 34634 var result = []; 34635 var i, part; 34636 34637 for (i = 0; i < len; i++) { 34638 // #252; undo param space replacement 34639 serialized[i] = serialized[i].replace(/\+/g, ' '); 34640 part = serialized[i].split('='); // #278; use array instead of object storage, favoring array serializations 34641 34642 result.push([decodeURIComponent(part[0]), decodeURIComponent(part[1])]); 34643 } 34644 34645 return result; 34646 } // XMLHttpRequest Level 2 file uploads (big hat tip to francois2metz) 34647 34648 34649 function fileUploadXhr(a) { 34650 var formdata = new FormData(); 34651 34652 for (var i = 0; i < a.length; i++) { 34653 formdata.append(a[i].name, a[i].value); 34654 } 34655 34656 if (options.extraData) { 34657 var serializedData = deepSerialize(options.extraData); 34658 34659 for (i = 0; i < serializedData.length; i++) { 34660 if (serializedData[i]) { 34661 formdata.append(serializedData[i][0], serializedData[i][1]); 34662 } 34663 } 34664 } 34665 34666 options.data = null; 34667 var s = $.extend(true, {}, $.ajaxSettings, options, { 34668 contentType: false, 34669 processData: false, 34670 cache: false, 34671 type: method || 'POST' 34672 }); 34673 34674 if (options.uploadProgress) { 34675 // workaround because jqXHR does not expose upload property 34676 s.xhr = function () { 34677 var xhr = $.ajaxSettings.xhr(); 34678 34679 if (xhr.upload) { 34680 xhr.upload.addEventListener('progress', function (event) { 34681 var percent = 0; 34682 var position = event.loaded || event.position; 34683 /*event.position is deprecated*/ 34684 34685 var total = event.total; 34686 34687 if (event.lengthComputable) {
34688 percent = Math.ceil(position / total * 100); 34689 } 34690 34691 options.uploadProgress(event, position, total, percent); 34692 }, false); 34693 } 34694 34695 return xhr; 34696 }; 34697 } 34698 34699 s.data = null; 34700 var beforeSend = s.beforeSend; 34701 34702 s.beforeSend = function (xhr, o) { 34703 //Send FormData() provided by user 34704 if (options.formData) { 34705 o.data = options.formData; 34706 } else { 34707 o.data = formdata; 34708 } 34709 34710 if (beforeSend) { 34711 beforeSend.call(this, xhr, o); 34712 } 34713 }; 34714 34715 return $.ajax(s); 34716 } // private function for handling file uploads (hat tip to YAHOO!) 34717 34718 34719 function fileUploadIframe(a) { 34720 var form = $form[0], 34721 el, 34722 i, 34723 s, 34724 g, 34725 id, 34726 $io, 34727 io, 34728 xhr, 34729 sub, 34730 n, 34731 timedOut, 34732 timeoutHandle; 34733 var deferred = $.Deferred(); // #341 34734 34735 deferred.abort = function (status) { 34736 xhr.abort(status); 34737 }; 34738 34739 if (a) { 34740 // ensure that every serialized input is still enabled 34741 for (i = 0; i < elements.length; i++) { 34742 el = $(elements[i]); 34743 34744 if (hasProp) { 34745 el.prop('disabled', false); 34746 } else { 34747 el.removeAttr('disabled'); 34748 } 34749 } 34750 } 34751 34752 s = $.extend(true, {}, $.ajaxSettings, options); 34753 s.context = s.context || s; 34754 id = 'jqFormIO' + new Date().getTime(); 34755 34756 if (s.iframeTarget) { 34757 $io = $(s.iframeTarget); 34758 n = $io.attr2('name'); 34759 34760 if (!n) { 34761 $io.attr2('name', id); 34762 } else { 34763 id = n; 34764 } 34765 } else { 34766 $io = $('<iframe name="' + id + '" src="' + s.iframeSrc + '" />'); 34767 $io.css({ 34768 position: 'absolute', 34769 top: '-1000px', 34770 left: '-1000px' 34771 }); 34772 } 34773 34774 io = $io[0]; 34775 xhr = { 34776 // mock object 34777 aborted: 0, 34778 responseText: null, 34779 responseXML: null, 34780 status: 0, 34781 statusText: 'n/a', 34782 getAllResponseHeaders: function getAllResponseHeaders() {}, 34783 getResponseHeader: function getResponseHeader() {}, 34784 setRequestHeader: function setRequestHeader() {}, 34785 abort: function abort(status) { 34786 var e = status === 'timeout' ? 'timeout' : 'aborted'; 34787 log('aborting upload... ' + e); 34788 this.aborted = 1; 34789 34790 try { 34791 // #214, #257 34792 if (io.contentWindow.document.execCommand) { 34793 io.contentWindow.document.execCommand('Stop'); 34794 } 34795 } catch (ignore) {} 34796 34797 $io.attr('src', s.iframeSrc); // abort op in progress 34798 34799 xhr.error = e; 34800 34801 if (s.error) { 34802 s.error.call(s.context, xhr, e, status); 34803 } 34804 34805 if (g) { 34806 $.event.trigger("ajaxError", [xhr, s, e]); 34807 } 34808 34809 if (s.complete) { 34810 s.complete.call(s.context, xhr, e); 34811 } 34812 } 34813 }; 34814 g = s.global; // trigger ajax global events so that activity/block indicators work like normal 34815 34816 if (g && 0 === $.active++) { 34817 $.event.trigger("ajaxStart"); 34818 } 34819 34820 if (g) { 34821 $.event.trigger("ajaxSend", [xhr, s]); 34822 } 34823 34824 if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) { 34825 if (s.global) { 34826 $.active--; 34827 } 34828 34829 deferred.reject(); 34830 return deferred; 34831 } 34832 34833 if (xhr.aborted) { 34834 deferred.reject(); 34835 return deferred; 34836 } // add submitting element to data if we know it 34837 34838 34839 sub = form.clk; 34840 34841 if (sub) { 34842 n = sub.name; 34843 34844 if (n && !sub.disabled) { 34845 s.extraData = s.extraData || {}; 34846 s.extraData[n] = sub.value; 34847 34848 if (sub.type == "image") { 34849 s.extraData[n + '.x'] = form.clk_x; 34850 s.extraData[n + '.y'] = form.clk_y; 34851 } 34852 } 34853 } 34854 34855 var CLIENT_TIMEOUT_ABORT = 1; 34856 var SERVER_ABORT = 2; 34857 34858 function getDoc(frame) { 34859 /* it looks like contentWindow or contentDocument do not 34860 * carry the protocol property in ie8, when running under ssl 34861 * frame.document is the only valid response document, since 34862 * the protocol is know but not on the other two objects. strange? 34863 * "Same origin policy" http://en.wikipedia.org/wiki/Same_origin_policy 34864 */ 34865 var doc = null; // IE8 cascading access check 34866 34867 try { 34868 if (frame.contentWindow) { 34869 doc = frame.contentWindow.document; 34870 } 34871 } catch (err) { 34872 // IE8 access denied under ssl & missing protocol 34873 log('cannot get iframe.contentWindow document: ' + err); 34874 } 34875 34876 if (doc) { 34877 // successful getting content 34878 return doc; 34879 } 34880 34881 try { 34882 // simply checking may throw in ie8 under ssl or mismatched protocol 34883 doc = frame.contentDocument ? frame.contentDocument : frame.document; 34884 } catch (err) { 34885 // last attempt 34886 log('cannot get iframe.contentDocument: ' + err); 34887 doc = frame.document; 34888 } 34889 34890 return doc; 34891 } // Rails CSRF hack (thanks to Yvan Barthelemy) 34892 34893 34894 var csrf_token = $('meta[name=csrf-token]').attr('content'); 34895 var csrf_param = $('meta[name=csrf-param]').attr('content'); 34896 34897 if (csrf_param && csrf_token) { 34898 s.extraData = s.extraData || {}; 34899 s.extraData[csrf_param] = csrf_token; 34900 } // take a breath so that pending repaints get some cpu time before the upload starts 34901 34902 34903 function doSubmit() { 34904 // make sure form attrs are set 34905 var t = $form.attr2('target'), 34906 a = $form.attr2('action'),
34907 mp = 'multipart/form-data', 34908 et = $form.attr('enctype') || $form.attr('encoding') || mp; // update form attrs in IE friendly way 34909 34910 form.setAttribute('target', id); 34911 34912 if (!method || /post/i.test(method)) { 34913 form.setAttribute('method', 'POST'); 34914 } 34915 34916 if (a != s.url) { 34917 form.setAttribute('action', s.url); 34918 } // ie borks in some cases when setting encoding 34919 34920 34921 if (!s.skipEncodingOverride && (!method || /post/i.test(method))) { 34922 $form.attr({ 34923 encoding: 'multipart/form-data', 34924 enctype: 'multipart/form-data' 34925 }); 34926 } // support timout 34927 34928 34929 if (s.timeout) { 34930 timeoutHandle = setTimeout(function () { 34931 timedOut = true; 34932 cb(CLIENT_TIMEOUT_ABORT); 34933 }, s.timeout); 34934 } // look for server aborts 34935 34936 34937 function checkState() { 34938 try { 34939 var state = getDoc(io).readyState; 34940 log('state = ' + state); 34941 34942 if (state && state.toLowerCase() == 'uninitialized') { 34943 setTimeout(checkState, 50); 34944 } 34945 } catch (e) { 34946 log('Server abort: ', e, ' (', e.name, ')'); 34947 cb(SERVER_ABORT); 34948 34949 if (timeoutHandle) { 34950 clearTimeout(timeoutHandle); 34951 } 34952 34953 timeoutHandle = undefined; 34954 } 34955 } // add "extra" data to form if provided in options 34956 34957 34958 var extraInputs = []; 34959 34960 try { 34961 if (s.extraData) { 34962 for (var n in s.extraData) { 34963 if (s.extraData.hasOwnProperty(n)) { 34964 // if using the $.param format that allows for multiple values with the same name 34965 if ($.isPlainObject(s.extraData[n]) && s.extraData[n].hasOwnProperty('name') && s.extraData[n].hasOwnProperty('value')) { 34966 extraInputs.push($('<input type="hidden" name="' + s.extraData[n].name + '">').val(s.extraData[n].value).appendTo(form)[0]); 34967 } else { 34968 extraInputs.push($('<input type="hidden" name="' + n + '">').val(s.extraData[n]).appendTo(form)[0]); 34969 } 34970 } 34971 } 34972 } 34973 34974 if (!s.iframeTarget) { 34975 // add iframe to doc and submit the form 34976 $io.appendTo('body'); 34977 } 34978 34979 if (io.attachEvent) { 34980 io.attachEvent('onload', cb); 34981 } else { 34982 io.addEventListener('load', cb, false); 34983 } 34984 34985 setTimeout(checkState, 15); 34986 34987 try { 34988 form.submit(); 34989 } catch (err) { 34990 // just in case form has element with name/id of 'submit' 34991 var submitFn = document.createElement('form').submit; 34992 submitFn.apply(form); 34993 } 34994 } finally { 34995 // reset attrs and remove "extra" input elements 34996 form.setAttribute('action', a); 34997 form.setAttribute('enctype', et); // #380 34998 34999 if (t) { 35000 form.setAttribute('target', t); 35001 } else { 35002 $form.removeAttr('target'); 35003 } 35004 35005 $(extraInputs).remove(); 35006 } 35007 } 35008 35009 if (s.forceSync) { 35010 doSubmit(); 35011 } else { 35012 setTimeout(doSubmit, 10); // this lets dom updates render 35013 } 35014 35015 var data, 35016 doc, 35017 domCheckCount = 50, 35018 callbackProcessed; 35019 35020 function cb(e) { 35021 if (xhr.aborted || callbackProcessed) { 35022 return; 35023 } 35024 35025 doc = getDoc(io); 35026 35027 if (!doc) { 35028 log('cannot access response document'); 35029 e = SERVER_ABORT; 35030 } 35031 35032 if (e === CLIENT_TIMEOUT_ABORT && xhr) { 35033 xhr.abort('timeout'); 35034 deferred.reject(xhr, 'timeout'); 35035 return; 35036 } else if (e == SERVER_ABORT && xhr) { 35037 xhr.abort('server abort'); 35038 deferred.reject(xhr, 'error', 'server abort'); 35039 return; 35040 } 35041 35042 if (!doc || doc.location.href == s.iframeSrc) { 35043 // response not received yet 35044 if (!timedOut) { 35045 return; 35046 } 35047 } 35048 35049 if (io.detachEvent) { 35050 io.detachEvent('onload', cb); 35051 } else { 35052 io.removeEventListener('load', cb, false); 35053 } 35054 35055 var status = 'success', 35056 errMsg; 35057 35058 try { 35059 if (timedOut) { 35060 throw 'timeout'; 35061 } 35062 35063 var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc); 35064 log('isXml=' + isXml); 35065 35066 if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) { 35067 if (--domCheckCount) { 35068 // in some browsers (Opera) the iframe DOM is not always traversable when 35069 // the onload callback fires, so we loop a bit to accommodate 35070 log('requeing onLoad callback, DOM not available'); 35071 setTimeout(cb, 250); 35072 return; 35073 } // let this fall through because server response could be an empty document 35074 //log('Could not access iframe DOM after mutiple tries.'); 35075 //throw 'DOMException: not available'; 35076 35077 } //log('response detected'); 35078 35079 35080 var docRoot = doc.body ? doc.body : doc.documentElement; 35081 xhr.responseText = docRoot ? docRoot.innerHTML : null; 35082 xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc; 35083 35084 if (isXml) { 35085 s.dataType = 'xml'; 35086 } 35087 35088 xhr.getResponseHeader = function (header) { 35089 var headers = { 35090 'content-type': s.dataType 35091 }; 35092 return headers[header.toLowerCase()]; 35093 }; // support for XHR 'status' & 'statusText' emulation : 35094 35095 35096 if (docRoot) { 35097 xhr.status = Number(docRoot.getAttribute('status')) || xhr.status; 35098 xhr.statusText = docRoot.getAttribute('statusText') || xhr.statusText; 35099 } 35100 35101 var dt = (s.dataType || '').toLowerCase(); 35102 var scr = /(json|script|text)/.test(dt); 35103 35104 if (scr || s.textarea) { 35105 // see if user embedded response in textarea 35106 var ta = doc.getElementsByTagName('textarea')[0]; 35107 35108 if (ta) { 35109 xhr.responseText = ta.value; // support for XHR 'status' & 'statusText' emulation : 35110 35111 xhr.status = Number(ta.getAttribute('status')) || xhr.status; 35112 xhr.statusText = ta.getAttribute('statusText') || xhr.statusText; 35113 } else if (scr) { 35114 // account for browsers injecting pre around json response 35115 var pre = doc.getElementsByTagName('pre')[0]; 35116 var b = doc.getElementsByTagName('body')[0]; 35117 35118 if (pre) { 35119 xhr.responseText = pre.textContent ? pre.textContent : pre.innerText; 35120 } else if (b) { 35121 xhr.responseText = b.textContent ? b.textContent : b.innerText; 35122 } 35123 } 35124 } else if (dt == 'xml' && !xhr.responseXML && xhr.responseText) { 35125 xhr.responseXML = toXml(xhr.responseText); 35126 } 35127 35128 try { 35129 data = httpData(xhr, dt, s); 35130 } catch (err) { 35131 status = 'parsererror'; 35132 xhr.error = errMsg = err || status; 35133 } 35134 } catch (err) { 35135 log('error caught: ', err); 35136 status = 'error'; 35137 xhr.error = errMsg = err || status; 35138 } 35139 35140 if (xhr.aborted) { 35141 log('upload aborted'); 35142 status = null; 35143 } 35144 35145 if (xhr.status) { 35146 // we've set xhr.status 35147 status = xhr.status >= 200 && xhr.status < 300 || xhr.status === 304 ? 'success' : 'error'; 35148 } // ordering of these callbacks/triggers is odd, but that's how $.ajax does it 35149 35150 35151 if (status === 'success') { 35152 if (s.success) { 35153 s.success.call(s.context, data, 'success', xhr); 35154 } 35155 35156 deferred.resolve(xhr.responseText, 'success', xhr); 35157 35158 if (g) { 35159 $.event.trigger("ajaxSuccess", [xhr, s]); 35160 } 35161 } else if (status) { 35162 if (errMsg === undefined) { 35163 errMsg = xhr.statusText; 35164 } 35165 35166 if (s.error) { 35167 s.error.call(s.context, xhr, status, errMsg); 35168 } 35169 35170 deferred.reject(xhr, 'error', errMsg); 35171 35172 if (g) { 35173 $.event.trigger("ajaxError", [xhr, s, errMsg]); 35174 } 35175 } 35176 35177 if (g) {
35178 $.event.trigger("ajaxComplete", [xhr, s]); 35179 } 35180 35181 if (g && ! --$.active) { 35182 $.event.trigger("ajaxStop"); 35183 } 35184 35185 if (s.complete) { 35186 s.complete.call(s.context, xhr, status); 35187 } 35188 35189 callbackProcessed = true; 35190 35191 if (s.timeout) { 35192 clearTimeout(timeoutHandle); 35193 } // clean up 35194 35195 35196 setTimeout(function () { 35197 if (!s.iframeTarget) { 35198 $io.remove(); 35199 } else { 35200 //adding else to clean up existing iframe response. 35201 $io.attr('src', s.iframeSrc); 35202 } 35203 35204 xhr.responseXML = null; 35205 }, 100); 35206 } 35207 35208 var toXml = $.parseXML || function (s, doc) { 35209 // use parseXML if available (jQuery 1.5+) 35210 if (window.ActiveXObject) { 35211 doc = new ActiveXObject('Microsoft.XMLDOM'); 35212 doc.async = 'false'; 35213 doc.loadXML(s); 35214 } else { 35215 doc = new DOMParser().parseFromString(s, 'text/xml'); 35216 } 35217 35218 return doc && doc.documentElement && doc.documentElement.nodeName != 'parsererror' ? doc : null; 35219 }; 35220 35221 var parseJSON = $.parseJSON || function (s) { 35222 /*jslint evil:true */ 35223 return window['eval']('(' + s + ')'); 35224 }; 35225 35226 var httpData = function httpData(xhr, type, s) { 35227 // mostly lifted from jq1.4.4 35228 var ct = xhr.getResponseHeader('content-type') || '', 35229 xml = type === 'xml' || !type && ct.indexOf('xml') >= 0, 35230 data = xml ? xhr.responseXML : xhr.responseText; 35231 35232 if (xml && data.documentElement.nodeName === 'parsererror') { 35233 if ($.error) { 35234 $.error('parsererror'); 35235 } 35236 } 35237 35238 if (s && s.dataFilter) { 35239 data = s.dataFilter(data, type); 35240 } 35241 35242 if (typeof data === 'string') { 35243 if (type === 'json' || !type && ct.indexOf('json') >= 0) { 35244 data = parseJSON(data); 35245 } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) { 35246 $.globalEval(data); 35247 } 35248 } 35249 35250 return data; 35251 }; 35252 35253 return deferred; 35254 } 35255 }; 35256 /** 35257 * ajaxForm() provides a mechanism for fully automating form submission. 35258 * 35259 * The advantages of using this method instead of ajaxSubmit() are: 35260 * 35261 * 1: This method will include coordinates for <input type="image" /> elements (if the element 35262 * is used to submit the form). 35263 * 2. This method will include the submit element's name/value data (for the element that was 35264 * used to submit the form). 35265 * 3. This method binds the submit() method to the form for you. 35266 * 35267 * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely 35268 * passes the options argument along after properly binding events for submit elements and 35269 * the form itself. 35270 */ 35271 35272 35273 $.fn.ajaxForm = function (options) { 35274 options = options || {}; 35275 options.delegation = options.delegation && $.isFunction($.fn.on); // in jQuery 1.3+ we can fix mistakes with the ready state 35276 35277 if (!options.delegation && this.length === 0) { 35278 var o = { 35279 s: this.selector, 35280 c: this.context 35281 }; 35282 35283 if (!$.isReady && o.s) { 35284 log('DOM not ready, queuing ajaxForm'); 35285 $(function () { 35286 $(o.s, o.c).ajaxForm(options); 35287 }); 35288 return this; 35289 } // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready() 35290 35291 35292 log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)')); 35293 return this; 35294 } 35295 35296 if (options.delegation) { 35297 $(document).off('submit.form-plugin', this.selector, doAjaxSubmit).off('click.form-plugin', this.selector, captureSubmittingElement).on('submit.form-plugin', this.selector, options, doAjaxSubmit).on('click.form-plugin', this.selector, options, captureSubmittingElement); 35298 return this; 35299 } 35300 35301 return this.ajaxFormUnbind().bind('submit.form-plugin', options, doAjaxSubmit).bind('click.form-plugin', options, captureSubmittingElement); 35302 }; // private event handlers 35303 35304 35305 function doAjaxSubmit(e) { 35306 /*jshint validthis:true */ 35307 var options = e.data; 35308 35309 if (!e.isDefaultPrevented()) { 35310 // if event has been canceled, don't proceed 35311 e.preventDefault(); 35312 $(e.target).ajaxSubmit(options); // #365 35313 } 35314 } 35315 35316 function captureSubmittingElement(e) { 35317 /*jshint validthis:true */ 35318 var target = e.target; 35319 var $el = $(target); 35320 35321 if (!$el.is("[type=submit],[type=image]")) { 35322 // is this a child element of the submit el? (ex: a span within a button) 35323 var t = $el.closest('[type=submit]'); 35324 35325 if (t.length === 0) { 35326 return; 35327 } 35328 35329 target = t[0]; 35330 } 35331 35332 var form = this; 35333 form.clk = target; 35334 35335 if (target.type == 'image') { 35336 if (e.offsetX !== undefined) { 35337 form.clk_x = e.offsetX; 35338 form.clk_y = e.offsetY; 35339 } else if (typeof $.fn.offset == 'function') { 35340 var offset = $el.offset(); 35341 form.clk_x = e.pageX - offset.left; 35342 form.clk_y = e.pageY - offset.top; 35343 } else { 35344 form.clk_x = e.pageX - target.offsetLeft; 35345 form.clk_y = e.pageY - target.offsetTop; 35346 } 35347 } // clear form vars 35348 35349 35350 setTimeout(function () { 35351 form.clk = form.clk_x = form.clk_y = null; 35352 }, 100); 35353 } // ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm 35354 35355 35356 $.fn.ajaxFormUnbind = function () { 35357 return this.unbind('submit.form-plugin click.form-plugin'); 35358 }; 35359 /** 35360 * formToArray() gathers form element data into an array of objects that can 35361 * be passed to any of the following ajax functions: $.get, $.post, or load. 35362 * Each object in the array has both a 'name' and 'value' property. An example of 35363 * an array for a simple login form might be: 35364 * 35365 * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ] 35366 * 35367 * It is this array that is passed to pre-submit callback functions provided to the 35368 * ajaxSubmit() and ajaxForm() methods. 35369 */ 35370 35371 35372 $.fn.formToArray = function (semantic, elements) { 35373 var a = []; 35374 35375 if (this.length === 0) { 35376 return a; 35377 } 35378 35379 var form = this[0]; 35380 var formId = this.attr('id'); 35381 var els = semantic ? form.getElementsByTagName('*') : form.elements; 35382 var els2; 35383 35384 if (els && !/MSIE [678]/.test(navigator.userAgent)) { 35385 // #390 35386 els = $(els).get(); // convert to standard array 35387 } // #386; account for inputs outside the form which use the 'form' attribute 35388 35389 35390 if (formId) { 35391 els2 = $(':input[form="' + formId + '"]').get(); // hat tip @thet 35392 35393 if (els2.length) { 35394 els = (els || []).concat(els2); 35395 } 35396 } 35397 35398 if (!els || !els.length) { 35399 return a; 35400 } 35401 35402 var i, j, n, v, el, max, jmax; 35403 35404 for (i = 0, max = els.length; i < max; i++) { 35405 el = els[i]; 35406 n = el.name; 35407 35408 if (!n || el.disabled) { 35409 continue; 35410 } 35411 35412 if (semantic && form.clk && el.type == "image") { 35413 // handle image inputs on the fly when semantic == true 35414 if (form.clk == el) { 35415 a.push({ 35416 name: n, 35417 value: $(el).val(), 35418 type: el.type 35419 }); 35420 a.push({ 35421 name: n + '.x', 35422 value: form.clk_x 35423 }, {
35424 name: n + '.y', 35425 value: form.clk_y 35426 }); 35427 } 35428 35429 continue; 35430 } 35431 35432 v = $.fieldValue(el, true); 35433 35434 if (v && v.constructor == Array) { 35435 if (elements) { 35436 elements.push(el); 35437 } 35438 35439 for (j = 0, jmax = v.length; j < jmax; j++) { 35440 a.push({ 35441 name: n, 35442 value: v[j] 35443 }); 35444 } 35445 } else if (feature.fileapi && el.type == 'file') { 35446 if (elements) { 35447 elements.push(el); 35448 } 35449 35450 var files = el.files; 35451 35452 if (files.length) { 35453 for (j = 0; j < files.length; j++) { 35454 a.push({ 35455 name: n, 35456 value: files[j], 35457 type: el.type 35458 }); 35459 } 35460 } else { 35461 // #180 35462 a.push({ 35463 name: n, 35464 value: '', 35465 type: el.type 35466 }); 35467 } 35468 } else if (v !== null && typeof v != 'undefined') { 35469 if (elements) { 35470 elements.push(el); 35471 } 35472 35473 a.push({ 35474 name: n, 35475 value: v, 35476 type: el.type, 35477 required: el.required 35478 }); 35479 } 35480 } 35481 35482 if (!semantic && form.clk) { 35483 // input type=='image' are not found in elements array! handle it here 35484 var $input = $(form.clk), 35485 input = $input[0]; 35486 n = input.name; 35487 35488 if (n && !input.disabled && input.type == 'image') { 35489 a.push({ 35490 name: n, 35491 value: $input.val() 35492 }); 35493 a.push({ 35494 name: n + '.x', 35495 value: form.clk_x 35496 }, { 35497 name: n + '.y', 35498 value: form.clk_y 35499 }); 35500 } 35501 } 35502 35503 return a; 35504 }; 35505 /** 35506 * Serializes form data into a 'submittable' string. This method will return a string 35507 * in the format: name1=value1&name2=value2 35508 */ 35509 35510 35511 $.fn.formSerialize = function (semantic) { 35512 //hand off to jQuery.param for proper encoding 35513 return $.param(this.formToArray(semantic)); 35514 }; 35515 /** 35516 * Serializes all field elements in the jQuery object into a query string. 35517 * This method will return a string in the format: name1=value1&name2=value2 35518 */ 35519 35520 35521 $.fn.fieldSerialize = function (successful) { 35522 var a = []; 35523 this.each(function () { 35524 var n = this.name; 35525 35526 if (!n) { 35527 return; 35528 } 35529 35530 var v = $.fieldValue(this, successful); 35531 35532 if (v && v.constructor == Array) { 35533 for (var i = 0, max = v.length; i < max; i++) { 35534 a.push({ 35535 name: n, 35536 value: v[i] 35537 }); 35538 } 35539 } else if (v !== null && typeof v != 'undefined') { 35540 a.push({ 35541 name: this.name, 35542 value: v 35543 }); 35544 } 35545 }); //hand off to jQuery.param for proper encoding 35546 35547 return $.param(a); 35548 }; 35549 /** 35550 * Returns the value(s) of the element in the matched set. For example, consider the following form: 35551 * 35552 * <form><fieldset> 35553 * <input name="A" type="text" /> 35554 * <input name="A" type="text" /> 35555 * <input name="B" type="checkbox" value="B1" /> 35556 * <input name="B" type="checkbox" value="B2"/> 35557 * <input name="C" type="radio" value="C1" /> 35558 * <input name="C" type="radio" value="C2" /> 35559 * </fieldset></form> 35560 * 35561 * var v = $('input[type=text]').fieldValue(); 35562 * // if no values are entered into the text inputs 35563 * v == ['',''] 35564 * // if values entered into the text inputs are 'foo' and 'bar' 35565 * v == ['foo','bar'] 35566 * 35567 * var v = $('input[type=checkbox]').fieldValue(); 35568 * // if neither checkbox is checked 35569 * v === undefined 35570 * // if both checkboxes are checked 35571 * v == ['B1', 'B2'] 35572 * 35573 * var v = $('input[type=radio]').fieldValue(); 35574 * // if neither radio is checked 35575 * v === undefined 35576 * // if first radio is checked 35577 * v == ['C1'] 35578 * 35579 * The successful argument controls whether or not the field element must be 'successful' 35580 * (per http://www.w3.org/TR/html4/interact/forms.html#successful-control
35580s). 35581 * The default value of the successful argument is true. If this value is false the value(s) 35582 * for each element is returned. 35583 * 35584 * Note: This method *always* returns an array. If no valid value can be determined the 35585 * array will be empty, otherwise it will contain one or more values. 35586 */ 35587 35588 35589 $.fn.fieldValue = function (successful) { 35590 for (var val = [], i = 0, max = this.length; i < max; i++) { 35591 var el = this[i]; 35592 var v = $.fieldValue(el, successful); 35593 35594 if (v === null || typeof v == 'undefined' || v.constructor == Array && !v.length) { 35595 continue; 35596 } 35597 35598 if (v.constructor == Array) { 35599 $.merge(val, v); 35600 } else { 35601 val.push(v); 35602 } 35603 } 35604 35605 return val; 35606 }; 35607 /** 35608 * Returns the value of the field element. 35609 */ 35610 35611 35612 $.fieldValue = function (el, successful) { 35613 var n = el.name, 35614 t = el.type, 35615 tag = el.tagName.toLowerCase(); 35616 35617 if (successful === undefined) { 35618 successful = true; 35619 } 35620 35621 if (successful && (!n || el.disabled || t == 'reset' || t == 'button' || (t == 'checkbox' || t == 'radio') && !el.checked || (t == 'submit' || t == 'image') && el.form && el.form.clk != el || tag == 'select' && el.selectedIndex == -1)) { 35622 return null; 35623 } 35624 35625 if (tag == 'select') { 35626 var index = el.selectedIndex; 35627 35628 if (index < 0) { 35629 return null; 35630 } 35631 35632 var a = [], 35633 ops = el.options; 35634 var one = t == 'select-one'; 35635 var max = one ? index + 1 : ops.length; 35636 35637 for (var i = one ? index : 0; i < max; i++) { 35638 var op = ops[i]; 35639 35640 if (op.selected) { 35641 var v = op.value; 35642 35643 if (!v) { 35644 // extra pain for IE... 35645 v = op.attributes && op.attributes.value && !op.attributes.value.specified ? op.text : op.value; 35646 } 35647 35648 if (one) { 35649 return v; 35650 } 35651 35652 a.push(v); 35653 } 35654 } 35655 35656 return a; 35657 } 35658 35659 return $(el).val(); 35660 }; 35661 /** 35662 * Clears the form data. Takes the following actions on the form's input fields: 35663 * - input text fields will have their 'value' property set to the empty string 35664 * - select elements will have their 'selectedIndex' property set to -1 35665 * - checkbox and radio inputs will have their 'checked' property set to false 35666 * - inputs of type submit, button, reset, and hidden will *not* be effected 35667 * - button elements will *not* be effected 35668 */ 35669 35670 35671 $.fn.clearForm = function (includeHidden) { 35672 return this.each(function () { 35673 $('input,select,textarea', this).clearFields(includeHidden); 35674 }); 35675 }; 35676 /** 35677 * Clears the selected form elements. 35678 */ 35679 35680 35681 $.fn.clearFields = $.fn.clearInputs = function (includeHidden) { 35682 var re = /^(?:color|date|datetime|email|month|number|password|range|search|tel|text|time|url|week)$/i; // 'hidden' is not in this list 35683 35684 return this.each(function () { 35685 var t = this.type, 35686 tag = this.tagName.toLowerCase(); 35687 35688 if (re.test(t) || tag == 'textarea') { 35689 this.value = ''; 35690 } else if (t == 'checkbox' || t == 'radio') { 35691 this.checked = false; 35692 } else if (tag == 'select') { 35693 this.selectedIndex = -1; 35694 } else if (t == "file") { 35695 if (/MSIE/.test(navigator.userAgent)) { 35696 $(this).replaceWith($(this).clone(true)); 35697 } else { 35698 $(this).val(''); 35699 } 35700 } else if (includeHidden) { 35701 // includeHidden can be the value true, or it can be a selector string 35702 // indicating a special test; for example: 35703 // $('#myForm').clearForm('.special:hidden') 35704 // the above would clean hidden inputs that have the class of 'special' 35705 if (includeHidden === true && /hidden/.test(t) || typeof includeHidden == 'string' && $(this).is(includeHidden)) { 35706 this.value = ''; 35707 } 35708 } 35709 }); 35710 }; 35711 /** 35712 * Resets the form data. Causes all form elements to be reset to their original value. 35713 */ 35714 35715 35716 $.fn.resetForm = function () { 35717 return this.each(function () { 35718 // guard against an input with the name of 'reset' 35719 // note that IE reports the reset function as an 'object' 35720 if (typeof this.reset == 'function' || _typeof(this.reset) == 'object' && !this.reset.nodeType) { 35721 this.reset(); 35722 } 35723 }); 35724 }; 35725 /** 35726 * Enables or disables any matching elements. 35727 */ 35728 35729 35730 $.fn.enable = function (b) { 35731 if (b === undefined) { 35732 b = true; 35733 } 35734 35735 return this.each(function () { 35736 this.disabled = !b; 35737 }); 35738 }; 35739 /** 35740 * Checks/unchecks any matching checkboxes or radio buttons and 35741 * selects/deselects and matching option elements. 35742 */ 35743 35744 35745 $.fn.selected = function (select) { 35746 if (select === undefined) { 35747 select = true; 35748 } 35749 35750 return this.each(function () { 35751 var t = this.type; 35752 35753 if (t == 'checkbox' || t == 'radio') { 35754 this.checked = select; 35755 } else if (this.tagName.toLowerCase() == 'option') { 35756 var $sel = $(this).parent('select'); 35757 35758 if (select && $sel[0] && $sel[0].type == 'select-one') { 35759 // deselect all other options 35760 $sel.find('option').selected(false); 35761 } 35762 35763 this.selected = select; 35764 } 35765 }); 35766 }; // expose debug var 35767 35768 35769 $.fn.ajaxSubmit.debug = false; // helper fn for console logging 35770 35771 function log() { 35772 if (!$.fn.ajaxSubmit.debug) { 35773 return; 35774 } 35775 35776 var msg = '[jquery.form] ' + Array.prototype.join.call(arguments, ''); 35777 35778 if (window.console && window.console.log) { 35779 window.console.log(msg); 35780 } else if (window.opera && window.opera.postError) { 35781 window.opera.postError(msg); 35782 } 35783 } 35784 }); 35785})(AUI.$); 35786//# sourceMappingURL=form.js.map 35787!function(root, factory) { 35788 false && "function" == typeof define && define.amd ? // AMD. Register as an anonymous module unless amdModuleId is set 35789 define([], function() { 35790 return root.svg4everybody = factory(); 35791 }) : "object" == typeof module && module.exports ? // Node. Does not work with strict CommonJS, but 35792 // only CommonJS-like environments that support module.exports, 35793 // like Node. 35794 module.exports = factory() : root.svg4everybody = factory(); 35795}(this, function() { 35796 /*! svg4everybody v2.1.9 | github.com/jonathantneal/svg4everybody */ 35797 function embed(parent, svg, target) { 35798 // if the target exists 35799 if (target) { 35800 // create a document fragment to hold the contents of the target 35801 var fragment = document.createDocumentFragment(), viewB
vendor: 6,434 bytes, lines 35801-35933
35801ox = !svg.hasAttribute("viewBox") && target.getAttribute("viewBox"); 35802 // conditionally set the viewBox on the svg 35803 viewBox && svg.setAttribute("viewBox", viewBox); 35804 // copy the contents of the clone into the fragment 35805 for (// clone the target 35806 var clone = target.cloneNode(!0); clone.childNodes.length; ) { 35807 fragment.appendChild(clone.firstChild); 35808 } 35809 // append the fragment into the svg 35810 parent.appendChild(fragment); 35811 } 35812 } 35813 function loadreadystatechange(xhr) { 35814 // listen to changes in the request 35815 xhr.onreadystatechange = function() { 35816 // if the request is ready 35817 if (4 === xhr.readyState) { 35818 // get the cached html document 35819 var cachedDocument = xhr._cachedDocument; 35820 // ensure the cached html document based on the xhr response 35821 cachedDocument || (cachedDocument = xhr._cachedDocument = document.implementation.createHTMLDocument(""), 35822 cachedDocument.body.innerHTML = xhr.responseText, xhr._cachedTarget = {}), // clear the xhr embeds list and embed each item 35823 xhr._embeds.splice(0).map(function(item) { 35824 // get the cached target 35825 var target = xhr._cachedTarget[item.id]; 35826 // ensure the cached target 35827 target || (target = xhr._cachedTarget[item.id] = cachedDocument.getElementById(item.id)), 35828 // embed the target into the svg 35829 embed(item.parent, item.svg, target); 35830 }); 35831 } 35832 }, // test the ready state change immediately 35833 xhr.onreadystatechange(); 35834 } 35835 function svg4everybody(rawopts) { 35836 function oninterval() { 35837 // while the index exists in the live <use> collection 35838 for (// get the cached <use> index 35839 var index = 0; index < uses.length; ) { 35840 // get the current <use> 35841 var use = uses[index], parent = use.parentNode, svg = getSVGAncestor(parent), src = use.getAttribute("xlink:href") || use.getAttribute("href"); 35842 if (!src && opts.attributeName && (src = use.getAttribute(opts.attributeName)), 35843 svg && src) { 35844 if (polyfill) { 35845 if (!opts.validate || opts.validate(src, svg, use)) { 35846 // remove the <use> element 35847 parent.removeChild(use); 35848 // parse the src and get the url and id 35849 var srcSplit = src.split("#"), url = srcSplit.shift(), id = srcSplit.join("#"); 35850 // if the link is external 35851 if (url.length) { 35852 // get the cached xhr request 35853 var xhr = requests[url]; 35854 // ensure the xhr request exists 35855 xhr || (xhr = requests[url] = new XMLHttpRequest(), xhr.open("GET", url), xhr.send(), 35856 xhr._embeds = []), // add the svg and id as an item to the xhr embeds list 35857 xhr._embeds.push({ 35858 parent: parent, 35859 svg: svg, 35860 id: id 35861 }), // prepare the xhr ready state change event 35862 loadreadystatechange(xhr); 35863 } else { 35864 // embed the local id into the svg 35865 embed(parent, svg, document.getElementById(id)); 35866 } 35867 } else { 35868 // increase the index when the previous value was not "valid" 35869 ++index, ++numberOfSvgUseElementsToBypass; 35870 } 35871 } 35872 } else { 35873 // increase the index when the previous value was not "valid" 35874 ++index; 35875 } 35876 } 35877 // continue the interval 35878 (!uses.length || uses.length - numberOfSvgUseElementsToBypass > 0) && requestAnimationFrame(oninterval, 67); 35879 } 35880 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; 35881 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; 35882 // create xhr requests object 35883 var requests = {}, requestAnimationFrame = window.requestAnimationFrame || setTimeout, uses = document.getElementsByTagName("use"), numberOfSvgUseElementsToBypass = 0; 35884 // conditionally start the interval if the polyfill is active 35885 polyfill && oninterval(); 35886 } 35887 function getSVGAncestor(node) { 35888 for (var svg = node; "svg" !== svg.nodeName.toLowerCase() && (svg = svg.parentNode); ) {} 35889 return svg; 35890 } 35891 return svg4everybody; 35892}); 35893YUI.add('arraylist-add', function (Y, NAME) { 35894 35895/** 35896 * Collection utilities beyond what is provided in the YUI core 35897 * @module collection 35898 * @submodule arraylist-add 35899 * @deprecated Use ModelList or a custom ArrayList subclass 35900 */ 35901 35902/* 35903 * Adds methods add and remove to Y.ArrayList 35904 */ 35905Y.mix(Y.ArrayList.prototype, { 35906 35907 /** 35908 * Add a single item to the ArrayList. Does not prevent duplicates. 35909 * 35910 * @method add 35911 * @param { mixed } item Item presumably of the same type as others in the 35912 * ArrayList. 35913 * @param {Number} index (Optional.) Number representing the position at 35914 * which the item should be inserted. 35915 * @return {ArrayList} the instance. 35916 * @for ArrayList 35917 * @deprecated Use ModelList or a custom ArrayList subclass 35918 * @chainable 35919 */ 35920 add: function(item, index) { 35921 var items = this._items; 35922 35923 if (Y.Lang.isNumber(index)) { 35924 items.splice(index, 0, item); 35925 } 35926 else { 35927 items.push(item); 35928 } 35929 35930 return this; 35931 }, 35932 35933 /**
35934 * Removes first or all occurrences of an item to the ArrayList. If a 35935 * comparator is not provided, uses itemsAreEqual method to determine 35936 * matches. 35937 * 35938 * @method remove 35939 * @param { mixed } needle Item to find and remove from the list. 35940 * @param { Boolean } all If true, remove all occurrences. 35941 * @param { Function } comparator optional a/b function to test equivalence. 35942 * @return {ArrayList} the instance. 35943 * @for ArrayList 35944 * @deprecated Use ModelList or a custom ArrayList subclass 35945 * @chainable 35946 */ 35947 remove: function(needle, all, comparator) { 35948 comparator = comparator || this.itemsAreEqual; 35949 35950 for (var i = this._items.length - 1; i >= 0; --i) { 35951 if (comparator.call(this, needle, this.item(i))) { 35952 this._items.splice(i, 1); 35953 if (!all) { 35954 break; 35955 } 35956 } 35957 } 35958 35959 return this; 35960 }, 35961 35962 /** 35963 * Default comparator for items stored in this list. Used by remove(). 35964 * 35965 * @method itemsAreEqual 35966 * @param { mixed } a item to test equivalence with. 35967 * @param { mixed } b other item to test equivalance. 35968 * @return { Boolean } true if items are deemed equivalent. 35969 * @for ArrayList 35970 * @deprecated Use ModelList or a custom ArrayList subclass 35971 */ 35972 itemsAreEqual: function(a, b) { 35973 return a === b; 35974 } 35975 35976}); 35977 35978 35979}, 'patched-v3.18.1', {"requires": ["arraylist"]}); 35980 35981YUI.add('arraylist-filter', function (Y, NAME) { 35982 35983/** 35984 * Collection utilities beyond what is provided in the YUI core 35985 * @module collection 35986 * @submodule arraylist-filter 35987 * @deprecated Use ModelList or a custom subclass implementation 35988 */ 35989 35990/* 35991 * Adds filter method to ArrayList prototype 35992 */ 35993Y.mix(Y.ArrayList.prototype, { 35994 35995 /** 35996 * <p>Create a new ArrayList (or augmenting class instance) from a subset 35997 * of items as determined by the boolean function passed as the 35998 * argument. The original ArrayList is unchanged.</p> 35999 * 36000 * <p>The validator signature is <code>validator( item )</code>.</p> 36001 * 36002 * @method filter 36003 * @param { Function } validator Boolean function to determine in or out. 36004 * @return { ArrayList } New instance based on who passed the validator. 36005 * @for ArrayList 36006 * @deprecated Use ModelList or a custom subclass implementation 36007 */ 36008 filter: function(validator) { 36009 var items = []; 36010 36011 Y.Array.each(this._items, function(item, i) { 36012 item = this.item(i); 36013 36014 if (validator(item)) { 36015 items.push(item); 36016 } 36017 }, this); 36018 36019 return new this.constructor(items); 36020 } 36021 36022}); 36023 36024 36025}, 'patched-v3.18.1', {"requires": ["arraylist"]}); 36026 36027YUI.add('arraylist', function (Y, NAME) { 36028 36029/** 36030 * Collection utilities beyond what is provided in the YUI core 36031 * @module collection 36032 * @submodule arraylist 36033 */ 36034 36035var YArray = Y.Array, 36036 YArray_each = YArray.each, 36037 ArrayListProto; 36038 36039/** 36040 * Generic ArrayList class for managing lists of items and iterating operations 36041 * over them. The targeted use for this class is for augmentation onto a 36042 * class that is responsible for managing multiple instances of another class 36043 * (e.g. NodeList for Nodes). The recommended use is to augment your class with 36044 * ArrayList, then use ArrayList.addMethod to mirror the API of the constituent 36045 * items on the list's API. 36046 * 36047 * The default implementation creates immutable lists, but mutability can be 36048 * provided via the arraylist-add submodule or by implementing mutation methods 36049 * directly on the augmented class's prototype. 36050 * 36051 * @class ArrayList 36052 * @constructor 36053 * @param items { Array } array of items this list will be responsible for 36054 */ 36055function ArrayList( items ) { 36056 if ( items !== undefined ) { 36057 this._items = Y.Lang.isArray( items ) ? items : YArray( items ); 36058 } else { 36059 // ||= to support lazy initialization from augment 36060 this._items = this._items || []; 36061 } 36062} 36063 36064ArrayListProto = { 36065 /** 36066 * Get an item by index from the list. Override this method if managing a 36067 * list of objects that have a different public representation (e.g. Node 36068 * instances vs DOM nodes). The iteration methods that accept a user 36069 * function will use this method for access list items for operation. 36070 * 36071 * @method item 36072 * @param i { Integer } index to fetch 36073 * @return { mixed } the item at the requested index 36074 */ 36075 item: function ( i ) { 36076 return this._items[i]; 36077 }, 36078 36079 /** 36080 * <p>Execute a function on each item of the list, optionally providing a 36081 * custom execution context. Default context is the item.</p> 36082 * 36083 * <p>The callback signature is <code>callback( item, index )</code>.</p> 36084 * 36085 * @method each 36086 * @param fn { Function } the function to execute 36087 * @param context { mixed } optional override 'this' in the function 36088 * @return { ArrayList } this instance 36089 * @chainable 36090 */ 36091 each: function ( fn, context ) { 36092 YArray_each( this._items, function ( item, i ) { 36093 item = this.item( i ); 36094 36095 fn.call( context || item, item, i, this ); 36096 }, this); 36097 36098 return this; 36099 }, 36100 36101 /** 36102 * <p>Execute a function on each item of the list, optionally providing a 36103 * custom execution context. Default context is the item.</p> 36104 * 36105 * <p>The callback signature is <code>callback( item, index )</code>.</p> 36106 * 36107 * <p>Unlike <code>each</code>, if the callback returns true, the 36108 * iteration will stop.</p> 36109 * 36110 * @method some 36111 * @param fn { Function } the function to execute 36112 * @param context { mixed } optional override 'this' in the function 36113 * @return { Boolean } True if the function returned true on an item 36114 */ 36115 some: function ( fn, context ) { 36116 return YArray.some( this._items, function ( item, i ) { 36117 item = this.item( i ); 36118
36119 return fn.call( context || item, item, i, this ); 36120 }, this); 36121 }, 36122 36123 /** 36124 * Finds the first index of the needle in the managed array of items. 36125 * 36126 * @method indexOf 36127 * @param needle { mixed } The item to search for 36128 * @return { Integer } Array index if found. Otherwise -1 36129 */ 36130 indexOf: function ( needle ) { 36131 return YArray.indexOf( this._items, needle ); 36132 }, 36133 36134 /** 36135 * How many items are in this list? 36136 * 36137 * @method size 36138 * @return { Integer } Number of items in the list 36139 */ 36140 size: function () { 36141 return this._items.length; 36142 }, 36143 36144 /** 36145 * Is this instance managing any items? 36146 * 36147 * @method isEmpty 36148 * @return { Boolean } true if 1 or more items are being managed 36149 */ 36150 isEmpty: function () { 36151 return !this.size(); 36152 }, 36153 36154 /** 36155 * Provides an array-like representation for JSON.stringify. 36156 * 36157 * @method toJSON 36158 * @return { Array } an array representation of the ArrayList 36159 */ 36160 toJSON: function () { 36161 return this._items; 36162 } 36163}; 36164// Default implementation does not distinguish between public and private 36165// item getter 36166/** 36167 * Protected method for optimizations that may be appropriate for API 36168 * mirroring. Similar in functionality to <code>item</code>, but is used by 36169 * methods added with <code>ArrayList.addMethod()</code>. 36170 * 36171 * @method _item 36172 * @protected 36173 * @param i { Integer } Index of item to fetch 36174 * @return { mixed } The item appropriate for pass through API methods 36175 */ 36176ArrayListProto._item = ArrayListProto.item; 36177 36178// Mixed onto existing proto to preserve constructor NOT being an own property. 36179// This has bitten me when composing classes by enumerating, copying prototypes. 36180Y.mix(ArrayList.prototype, ArrayListProto); 36181 36182Y.mix( ArrayList, { 36183 36184 /** 36185 * <p>Adds a pass through method to dest (typically the prototype of a list 36186 * class) that calls the named method on each item in the list with 36187 * whatever parameters are passed in. Allows for API indirection via list 36188 * instances.</p> 36189 * 36190 * <p>Accepts a single string name or an array of string names.</p> 36191 * 36192 * <pre><code>list.each( function ( item ) { 36193 * item.methodName( 1, 2, 3 ); 36194 * } ); 36195 * // becomes 36196 * list.methodName( 1, 2, 3 );</code></pre> 36197 * 36198 * <p>Additionally, the pass through methods use the item retrieved by the 36199 * <code>_item</code> method in case there is any special behavior that is 36200 * appropriate for API mirroring.</p> 36201 * 36202 * <p>If the iterated method returns a value, the return value from the 36203 * added method will be an array of values with each value being at the 36204 * corresponding index for that item. If the iterated method does not 36205 * return a value, the added method will be chainable. 36206 * 36207 * @method addMethod 36208 * @static 36209 * @param dest {Object} Object or prototype to receive the iterator method 36210 * @param name {String|String[]} Name of method of methods to create 36211 */ 36212 addMethod: function ( dest, names ) { 36213 36214 names = YArray( names ); 36215 36216 YArray_each( names, function ( name ) { 36217 dest[ name ] = function () { 36218 var args = YArray( arguments, 0, true ), 36219 ret = []; 36220 36221 YArray_each( this._items, function ( item, i ) { 36222 item = this._item( i ); 36223 36224 var result = item[ name ].apply( item, args ); 36225 36226 if ( result !== undefined && result !== item ) { 36227 ret[i] = result; 36228 } 36229 }, this); 36230 36231 return ret.length ? ret : this; 36232 }; 36233 } ); 36234 } 36235} ); 36236 36237Y.ArrayList = ArrayList; 36238 36239 36240}, 'patched-v3.18.1', {"requires": ["yui-base"]}); 36241 36242YUI.add('array-extras', function (Y, NAME) { 36243 36244/** 36245Adds additional utility methods to the `Y.Array` class. 36246 36247@module collection 36248@submodule array-extras 36249**/ 36250 36251var A = Y.Array, 36252 L = Y.Lang, 36253 ArrayProto = Array.prototype; 36254 36255/** 36256Returns the index of the last item in the array that contains the specified 36257value, or `-1` if the value isn't found. 36258 36259@method lastIndexOf 36260@param {Array} a Array to search in. 36261@param {Any} val Value to search for. 36262@param {Number} [fromIndex] Index at which to start searching backwards. 36263 Defaults to the array's length - 1. If negative, it will be taken as an offset 36264 from the end of the array. If the calculated index is less than 0, the array 36265 will not be searched and `-1` will be returned. 36266@return {Number} Index of the item that contains the value, or `-1` if not 36267 found. 36268@static 36269@for Array 36270**/ 36271A.lastIndexOf = L._isNative(ArrayProto.lastIndexOf) ? 36272 function(a, val, fromIndex) {
36273 // An undefined fromIndex is still considered a value by some (all?) 36274 // native implementations, so we can't pass it unless it's actually 36275 // specified. 36276 return fromIndex || fromIndex === 0 ? a.lastIndexOf(val, fromIndex) : 36277 a.lastIndexOf(val); 36278 } : 36279 function(a, val, fromIndex) { 36280 var len = a.length, 36281 i = len - 1; 36282 36283 if (fromIndex || fromIndex === 0) { 36284 i = Math.min(fromIndex < 0 ? len + fromIndex : fromIndex, len); 36285 } 36286 36287 if (i > -1 && len > 0) { 36288 for (; i > -1; --i) { 36289 if (i in a && a[i] === val) { 36290 return i; 36291 } 36292 } 36293 } 36294 36295 return -1; 36296 }; 36297 36298/** 36299Returns a copy of the input array with duplicate items removed. 36300 36301Note: If the input array only contains strings, the `Y.Array.dedupe()` method is 36302a much faster alternative. 36303 36304@method unique 36305@param {Array} array Array to dedupe. 36306@param {Function} [testFn] Custom function to use to test the equality of two 36307 values. A truthy return value indicates that the values are equal. A falsy 36308 return value indicates that the values are not equal. 36309 36310 @param {Any} testFn.a First value to compare. 36311 @param {Any} testFn.b Second value to compare. 36312 @param {Number} testFn.index Index of the current item in the original 36313 array. 36314 @param {Array} testFn.array The original array. 36315 @return {Boolean} _true_ if the items are equal, _false_ otherwise. 36316 36317@return {Array} Copy of the input array with duplicate items removed. 36318@static 36319**/ 36320A.unique = function (array, testFn) { 36321 var i = 0, 36322 len = array.length, 36323 results = [], 36324 j, result, resultLen, value; 36325 36326 // Note the label here. It's used to jump out of the inner loop when a value 36327 // is not unique. 36328 outerLoop: for (; i < len; i++) { 36329 value = array[i]; 36330 36331 // For each value in the input array, iterate through the result array 36332 // and check for uniqueness against each result value. 36333 for (j = 0, resultLen = results.length; j < resultLen; j++) { 36334 result = results[j]; 36335 36336 // If the test function returns true or there's no test function and 36337 // the value equals the current result item, stop iterating over the 36338 // results and continue to the next value in the input array. 36339 if (testFn) { 36340 if (testFn.call(array, value, result, i, array)) { 36341 continue outerLoop; 36342 } 36343 } else if (value === result) { 36344 continue outerLoop; 36345 } 36346 } 36347 36348 // If we get this far, that means the current value is not already in 36349 // the result array, so add it. 36350 results.push(value); 36351 } 36352 36353 return results; 36354}; 36355 36356/** 36357Executes the supplied function on each item in the array. Returns a new array 36358containing the items for which the supplied function returned a truthy value. 36359 36360@method filter 36361@param {Array} a Array to filter. 36362@param {Function} f Function to execute on each item. 36363@param {Object} [o] Optional context object. 36364@return {Array} Array of items for which the supplied function returned a 36365 truthy value (empty if it never returned a truthy value). 36366@static 36367*/ 36368A.filter = L._isNative(ArrayProto.filter) ? 36369 function(a, f, o) { 36370 return ArrayProto.filter.call(a, f, o); 36371 } : 36372 function(a, f, o) { 36373 var i = 0, 36374 len = a.length, 36375 results = [], 36376 item; 36377 36378 for (; i < len; ++i) { 36379 if (i in a) { 36380 item = a[i]; 36381 36382 if (f.call(o, item, i, a)) { 36383 results.push(item); 36384 } 36385 } 36386 } 36387 36388 return results; 36389 }; 36390 36391/** 36392The inverse of `Array.filter()`. Executes the supplied function on each item. 36393Returns a new array containing the items for which the supplied function 36394returned `false`. 36395 36396@method reject 36397@param {Array} a the array to iterate. 36398@param {Function} f the function to execute on each item. 36399@param {object} [o] Optional context object. 36400@return {Array} The items for which the supplied function returned `false`. 36401@static 36402*/ 36403A.reject = function(a, f, o) { 36404 return A.filter(a, function(item, i, a) { 36405 return !f.call(o, item, i, a); 36406 }); 36407}; 36408 36409/** 36410Executes the supplied function on each item in the array. Iteration stops if the 36411supplied function does not return a truthy value. 36412 36413@method every 36414@param {Array} a the array to iterate. 36415@param {Function} f the function to execute on each item. 36416@param {Object} [o] Optional context object. 36417@return {Boolean} `true` if every item in the array returns `true` from the 36418 supplied function, `false` otherwise. 36419@static 36420*/ 36421A.every = L._isNative(ArrayProto.every) ? 36422 function(a, f, o) { 36423 return ArrayProto.every.call(a, f, o); 36424 } : 36425 function(a, f, o) { 36426 for (var i = 0, l = a.length; i < l; ++i) { 36427 if (i in a && !f.call(o, a[i], i, a)) { 36428 return false;
36429 } 36430 } 36431 36432 return true; 36433 }; 36434 36435/** 36436Executes the supplied function on each item in the array and returns a new array 36437containing all the values returned by the supplied function. 36438 36439@example 36440 36441 // Convert an array of numbers into an array of strings. 36442 Y.Array.map([1, 2, 3, 4], function (item) { 36443 return '' + item; 36444 }); 36445 // => ['1', '2', '3', '4'] 36446 36447@method map 36448@param {Array} a the array to iterate. 36449@param {Function} f the function to execute on each item. 36450@param {object} [o] Optional context object. 36451@return {Array} A new array containing the return value of the supplied function 36452 for each item in the original array. 36453@static 36454*/ 36455A.map = L._isNative(ArrayProto.map) ? 36456 function(a, f, o) { 36457 return ArrayProto.map.call(a, f, o); 36458 } : 36459 function(a, f, o) { 36460 var i = 0, 36461 len = a.length, 36462 results = ArrayProto.concat.call(a); 36463 36464 for (; i < len; ++i) { 36465 if (i in a) { 36466 results[i] = f.call(o, a[i], i, a); 36467 } 36468 } 36469 36470 return results; 36471 }; 36472 36473 36474/** 36475Executes the supplied function on each item in the array, "folding" the array 36476into a single value. 36477 36478@method reduce 36479@param {Array} a Array to iterate. 36480@param {Any} init Initial value to start with. 36481@param {Function} f Function to execute on each item. This function should 36482 update and return the value of the computation. It will receive the following 36483 arguments: 36484 @param {Any} f.previousValue Value returned from the previous iteration, 36485 or the initial value if this is the first iteration. 36486 @param {Any} f.currentValue Value of the current item being iterated. 36487 @param {Number} f.index Index of the current item. 36488 @param {Array} f.array Array being iterated. 36489@param {Object} [o] Optional context object. 36490@return {Any} Final result from iteratively applying the given function to each 36491 element in the array. 36492@static 36493*/ 36494A.reduce = L._isNative(ArrayProto.reduce) ? 36495 function(a, init, f, o) { 36496 // ES5 Array.reduce doesn't support a thisObject, so we need to 36497 // implement it manually. 36498 return ArrayProto.reduce.call(a, function(init, item, i, a) { 36499 return f.call(o, init, item, i, a); 36500 }, init); 36501 } : 36502 function(a, init, f, o) { 36503 var i = 0, 36504 len = a.length, 36505 result = init; 36506 36507 for (; i < len; ++i) { 36508 if (i in a) { 36509 result = f.call(o, result, a[i], i, a); 36510 } 36511 } 36512 36513 return result; 36514 }; 36515 36516/** 36517Executes the supplied function on each item in the array, searching for the 36518first item that matches the supplied function. 36519 36520@method find 36521@param {Array} a the array to search. 36522@param {Function} f the function to execute on each item. Iteration is stopped 36523 as soon as this function returns `true`. 36524@param {Object} [o] Optional context object. 36525@return {Object} the first item that the supplied function returns `true` for, 36526 or `null` if it never returns `true`. 36527@static 36528*/ 36529A.find = function(a, f, o) { 36530 for (var i = 0, l = a.length; i < l; i++) { 36531 if (i in a && f.call(o, a[i], i, a)) { 36532 return a[i]; 36533 } 36534 } 36535 return null; 36536}; 36537 36538/** 36539Iterates over an array, returning a new array of all the elements that match the 36540supplied regular expression. 36541 36542@method grep 36543@param {Array} a Array to iterate over. 36544@param {RegExp} pattern Regular expression to test against each item. 36545@return {Array} All the items in the array that produce a match against the 36546 supplied regular expression. If no items match, an empty array is returned. 36547@static 36548*/ 36549A.grep = function(a, pattern) { 36550 return A.filter(a, function(item, index) { 36551 return pattern.test(item); 36552 }); 36553}; 36554 36555/** 36556Partitions an array into two new arrays, one with the items for which the 36557supplied function returns `true`, and one with the items for which the function 36558returns `false`. 36559 36560@method partition 36561@param {Array} a Array to iterate over. 36562@param {Function} f Function to execute for each item in the array. It will 36563 receive the following arguments: 36564 @param {Any} f.item Current item. 36565 @param {Number} f.index Index of the current item. 36566 @param {Array} f.array The array being iterated. 36567@param {Object} [o] Optional execution context. 36568@return {Object} An object with two properties: `matches` and `rejects`. Each is 36569 an array containing the items that were selected or rejected by the test 36570 function (or an empty array if none). 36571@static 36572*/ 36573A.partition = function(a, f, o) { 36574 var results = { 36575 matches: [], 36576 rejects: [] 36577 }; 36578 36579 A.each(a, function(item, index) { 36580 var set = f.call(o, item, index, a) ? results.matches : results.rejects; 36581 set.push(item); 36582 }); 36583 36584 return results; 36585}; 36586 36587/** 36588Creates an array of arrays by pairing the corresponding elements of two arrays
36589together into a new array. 36590 36591@method zip 36592@param {Array} a Array to iterate over. 36593@param {Array} a2 Another array whose values will be paired with values of the 36594 first array. 36595@return {Array} An array of arrays formed by pairing each element of the first 36596 array with an item in the second array having the corresponding index. 36597@static 36598*/ 36599A.zip = function(a, a2) { 36600 var results = []; 36601 A.each(a, function(item, index) { 36602 results.push([item, a2[index]]); 36603 }); 36604 return results; 36605}; 36606 36607/** 36608Flattens an array of nested arrays at any abitrary depth into a single, flat 36609array. 36610 36611@method flatten 36612@param {Array} a Array with nested arrays to flatten. 36613@return {Array} An array whose nested arrays have been flattened. 36614@static 36615@since 3.7.0 36616**/ 36617A.flatten = function(a) { 36618 var result = [], 36619 i, len, val; 36620 36621 // Always return an array. 36622 if (!a) { 36623 return result; 36624 } 36625 36626 for (i = 0, len = a.length; i < len; ++i) { 36627 val = a[i]; 36628 36629 if (L.isArray(val)) { 36630 // Recusively flattens any nested arrays. 36631 result.push.apply(result, A.flatten(val)); 36632 } else { 36633 result.push(val); 36634 } 36635 } 36636 36637 return result; 36638}; 36639 36640 36641}, 'patched-v3.18.1', {"requires": ["yui-base"]}); 36642 36643YUI.add('array-invoke', function (Y, NAME) { 36644 36645/** 36646@module collection 36647@submodule array-invoke 36648*/ 36649 36650/** 36651Executes a named method on each item in an array of objects. Items in the array 36652that do not have a function by that name will be skipped. 36653 36654@example 36655 36656 Y.Array.invoke(arrayOfDrags, 'plug', Y.Plugin.DDProxy); 36657 36658@method invoke 36659@param {Array} items Array of objects supporting the named method. 36660@param {String} name the name of the method to execute on each item. 36661@param {Any} [args*] Any number of additional args are passed as parameters to 36662 the execution of the named method. 36663@return {Array} All return values, indexed according to the item index. 36664@static 36665@for Array 36666**/ 36667Y.Array.invoke = function(items, name) { 36668 var args = Y.Array(arguments, 2, true), 36669 isFunction = Y.Lang.isFunction, 36670 ret = []; 36671 36672 Y.Array.each(Y.Array(items), function(item, i) { 36673 if (item && isFunction(item[name])) { 36674 ret[i] = item[name].apply(item, args); 36675 } 36676 }); 36677 36678 return ret; 36679}; 36680 36681 36682}, 'patched-v3.18.1', {"requires": ["yui-base"]}); 36683 36684YUI.add('attribute-base', function (Y, NAME) { 36685 36686 /** 36687 * The attribute module provides an augmentable Attribute implementation, which 36688 * adds configurable attributes and attribute change events to the class being 36689 * augmented. It also provides a State class, which is used internally by Attribute, 36690 * but can also be used independently to provide a name/property/value data structure to 36691 * store state. 36692 * 36693 * @module attribute 36694 */ 36695 36696 /** 36697 * The attribute-base submodule provides core attribute handling support, with everything 36698 * aside from complex attribute handling in the provider's constructor. 36699 * 36700 * @module attribute 36701 * @submodule attribute-base 36702 */ 36703 36704 /** 36705 * <p> 36706 * Attribute provides configurable attribute support along with attribute change events. It is designed to be 36707 * augmented on to a host class, and provides the host with the ability to configure attributes to store and retrieve state, 36708 * along with attribute change events. 36709 * </p> 36710 * <p>For example, attributes added to the host can be configured:</p> 36711 * <ul> 36712 * <li>As read only.</li> 36713 * <li>As write once.</li> 36714 * <li>With a setter function, which can be used to manipulate 36715 * values passed to Attribute's <a href="#method_set">set</a> method, before they are stored.</li> 36716 * <li>With a getter function, which can be used to manipulate stored values, 36717 * before they are returned by Attribute's <a href="#method_get">get</a> method.</li> 36718 * <li>With a validator function, to validate values before they are stored.</li> 36719 * </ul> 36720 * 36721 * <p>See the <a href="#method_addAttr">addAttr</a> method, for the complete set of configuration 36722 * options available for attributes.</p> 36723 * 36724 * <p><strong>NOTE:</strong> Most implementations will be better off extending the <a href="Base.html">Base</a> class, 36725 * instead of augmenting Attribute directly. Base augments Attribute and will handle the initial configuration 36726 * of attributes for derived classes, accounting for values passed into the constructor.</p> 36727 * 36728 * @class Attribute 36729 * @param attrs {Object} The attributes to add during construction (passed through to <a href="#method_addAttrs">addAttrs</a>). 36730 * These can also be defined on the constructor being augmented with Attribute by defining the ATTRS property on the constructor. 36731 * @param values {Object} The initial attribute values to apply (passed through to <a href="#method_addAttrs">addAttrs</a>). 36732 * These are not merged/cloned. The caller is responsible for isolating user provided values if required. 36733 * @param lazy {boolean} Whether or not to add attributes lazily (passed through to <a href="#method_addAttrs">addAttrs</a>). 36734 * @uses AttributeCore 36735 * @uses AttributeObservable 36736 * @uses EventTarget 36737 * @uses AttributeExtras 36738 */ 36739 function Attribute() { 36740 Y.AttributeCore.apply(this, arguments); 36741 Y.AttributeObservable.apply(this, arguments); 36742 Y.AttributeExtras.apply(this, arguments); 36743 } 36744 36745 Y.mix(Attribute, Y.AttributeCore, false, null, 1); 36746 Y.mix(Attribute, Y.AttributeExtras, false, null, 1); 36747 36748 // Needs to be `true`, to overwrite methods from AttributeCore 36749 Y.mix(Attribute, Y.AttributeObservable, true, null, 1); 36750 36751 /** 36752 * <p>The value to return from an attribute setter in order to prevent the set from going through.</p> 36753 * 36754 * <p>You can return this value from your setter if you wish to combine validator and setter 36755 * functionality into a single setter function, which either returns the massaged value to be stored or 36756 * AttributeCore.INVALID_VALUE to prevent invalid values from being stored.</p> 36757 * 36758 * @property INVALID_VALUE 36759 * @type Object 36760 * @static 36761 * @final 36762 */ 36763 Attribute.INVALID_VALUE = Y.AttributeCore.INVALID_VALUE; 36764 36765 /** 36766 * The list of properties which can be configured for 36767 * each attribute (e.g. setter, getter, writeOnce etc.). 36768 * 36769 * This property is used internally as a whitelist for faster 36770 * Y.mix operations. 36771 * 36772 * @property _ATTR_CFG 36773 * @type Array 36774 * @static 36775 * @protected 36776 */ 36777 Attribute._ATTR_CFG = Y.AttributeCore._ATTR_CFG.concat(Y.AttributeObservable._ATTR_CFG); 36778 36779 /** 36780 * Utility method to protect an attribute configuration hash, by merging the 36781 * entire object and the individual attr config objects. 36782 * 36783 * @method protectAttrs 36784 * @static 36785 * @param {Object} attrs A hash of attribute to configuration object pairs. 36786 * @return {Object} A protected version of the `attrs` argument. 36787 */ 36788 Attribute.protectAttrs = Y.AttributeCore.protectAttrs; 36789 36790 Y.Attribute = Attribute; 36791 36792 36793}, 'patched-v3.18.1', {"requires": ["attribute-core", "attribute-observable", "attribute-extras"]}); 36794 36795YUI.add('attribute-complex', function (Y, NAME) { 36796 36797 /** 36798 * Adds support for attribute providers to handle complex attributes in the constructor 36799 * 36800 * @module attribute 36801 * @submodule attribute-complex 36802 * @for Attribute 36803 * @deprecated AttributeComplex's overrides are now part of AttributeCore. 36804 */ 36805 36806 var Attribute = Y.Attribute; 36807 36808 Attribute.Complex = function() {}; 36809 Attribute.Complex.prototype = { 36810 36811 /** 36812 * Utility method to split out simple attribute name/value pairs ("x") 36813 * from complex attribute name/value pairs ("x.y.z"), so that complex 36814 * attributes can be keyed by the top level attribute name. 36815 * 36816 * @method _normAttrVals 36817 * @param {Object} valueHash An object with attribute name/value pairs 36818 * 36819 * @return {Object} An object literal with 2 properties - "simple" and "complex", 36820 * containing simple and complex attribute values respectively keyed 36821 * by the top level attribute name, or null, if valueHash is falsey. 36822 * 36823 * @private 36824 */ 36825 _normAttrVals : Attribute.prototype._normAttrVals, 36826 36827 /** 36828 * Returns the initial value of the given attribute from 36829 * either the default configuration provided, or the 36830 * over-ridden value if it exists in the set of initValues 36831 * provided and the attribute is not read-only. 36832 * 36833 * @param {String} attr The name of the attribute 36834 * @param {Object} cfg The attribute configuration object 36835 * @param {Object}
36835 initValues The object with simple and complex attribute name/value pairs returned from _normAttrVals 36836 * 36837 * @return {Any} The initial value of the attribute. 36838 * 36839 * @method _getAttrInitVal 36840 * @private 36841 */ 36842 _getAttrInitVal : Attribute.prototype._getAttrInitVal 36843 36844 }; 36845 36846 // Consistency with the rest of the Attribute addons for now. 36847 Y.AttributeComplex = Attribute.Complex; 36848 36849 36850}, 'patched-v3.18.1', {"requires": ["attribute-base"]}); 36851 36852YUI.add('attribute-core', function (Y, NAME) { 36853 36854 /** 36855 * The State class maintains state for a collection of named items, with 36856 * a varying number of properties defined. 36857 * 36858 * It avoids the need to create a separate class for the item, and separate instances 36859 * of these classes for each item, by storing the state in a 2 level hash table, 36860 * improving performance when the number of items is likely to be large. 36861 * 36862 * @constructor 36863 * @class State 36864 */ 36865 Y.State = function() { 36866 /** 36867 * Hash of attributes 36868 * @property data 36869 */ 36870 this.data = {}; 36871 }; 36872 36873 Y.State.prototype = { 36874 36875 /** 36876 * Adds a property to an item. 36877 * 36878 * @method add 36879 * @param name {String} The name of the item. 36880 * @param key {String} The name of the property. 36881 * @param val {Any} The value of the property. 36882 */ 36883 add: function(name, key, val) { 36884 var item = this.data[name]; 36885 36886 if (!item) { 36887 item = this.data[name] = {}; 36888 } 36889 36890 item[key] = val; 36891 }, 36892 36893 /** 36894 * Adds multiple properties to an item. 36895 * 36896 * @method addAll 36897 * @param name {String} The name of the item. 36898 * @param obj {Object} A hash of property/value pairs. 36899 */ 36900 addAll: function(name, obj) { 36901 var item = this.data[name], 36902 key; 36903 36904 if (!item) { 36905 item = this.data[name] = {}; 36906 } 36907 36908 for (key in obj) { 36909 if (obj.hasOwnProperty(key)) { 36910 item[key] = obj[key]; 36911 } 36912 } 36913 }, 36914 36915 /** 36916 * Removes a property from an item. 36917 * 36918 * @method remove 36919 * @param name {String} The name of the item. 36920 * @param key {String} The property to remove. 36921 */ 36922 remove: function(name, key) { 36923 var item = this.data[name]; 36924 36925 if (item) { 36926 delete item[key]; 36927 } 36928 }, 36929 36930 /** 36931 * Removes multiple properties from an item, or removes the item completely. 36932 * 36933 * @method removeAll 36934 * @param name {String} The name of the item. 36935 * @param obj {Object|Array} Collection of properties to delete. If not provided, the entire item is removed. 36936 */ 36937 removeAll: function(name, obj) { 36938 var data; 36939 36940 if (!obj) { 36941 data = this.data; 36942 36943 if (name in data) { 36944 delete data[name]; 36945 } 36946 } else { 36947 Y.each(obj, function(value, key) { 36948 this.remove(name, typeof key === 'string' ? key : value); 36949 }, this); 36950 } 36951 }, 36952 36953 /** 36954 * For a given item, returns the value of the property requested, or undefined if not found. 36955 * 36956 * @method get 36957 * @param name {String} The name of the item 36958 * @param key {String} Optional. The property value to retrieve. 36959 * @return {Any} The value of the supplied property. 36960 */ 36961 get: function(name, key) { 36962 var item = this.data[name]; 36963 36964 if (item) { 36965 return item[key]; 36966 } 36967 }, 36968 36969 /** 36970 * For the given item, returns an object with all of the 36971 * item's property/value pairs. By default the object returned 36972 * is a shallow copy of the stored data, but passing in true 36973 * as the second parameter will return a reference to the stored 36974 * data. 36975 * 36976 * @method getAll 36977 * @param name {String} The name of the item 36978 * @param reference {boolean} true, if you want a reference to the stored 36979 * object 36980 * @return {Object} An object with property/value pairs for the item. 36981 */ 36982 getAll : function(name, reference) { 36983 var item = this.data[name], 36984 key, obj; 36985 36986 if (reference) { 36987 obj = item; 36988 } else if (item) { 36989 obj = {}; 36990 36991 for (key in item) { 36992 if (item.hasOwnProperty(key)) { 36993 obj[key] = item[key]; 36994 } 36995 } 36996 } 36997 36998 return obj; 36999 } 37000 }; 37001 /*For log lines*/ 37002 /*jshint maxlen:200*/ 37003 37004 /** 37005 * The attribute module provides an augmentable Attribute implementation, which 37006 * adds configurable attributes and attribute change events to the class being 37007 * augmented. It also provides a State class, which is used internally by Attribute, 37008 * but can also be used independently to provide a name/property/value data structure to 37009 * store state. 37010 * 37011 * @module attribute 37012 */ 37013 37014 /** 37015 * The attribute-core submodule provides the lightest level of attribute handling support 37016 * without Attribute change events, or lesser used methods such as reset(), modifyAttrs(), 37017 * and removeAttr(). 37018 * 37019 * @module attribute 37020 * @submodule attribute-core 37021 */ 37022 var O = Y.Object, 37023 Lang = Y.Lang, 37024 37025 DOT = ".", 37026 37027 // Externally configurable props 37028 GETTER = "getter", 37029 SETTER = "setter", 37030 READ_ONLY = "readOnly", 37031 WRITE_ONCE = "writeOnce", 37032 INIT_ONLY = "initOnly", 37033 VALIDATOR = "validator", 37034 VALUE = "value", 37035 VALUE_FN = "valueFn", 37036 LAZY_ADD = "lazyAdd", 37037 37038 // Used for internal state management 37039 ADDED = "added", 37040 BYPASS_PROXY = "_bypassProxy", 37041 INIT_VALUE = "initValue", 37042 LAZY = "lazy", 37043 37044 INVALID_VALUE; 37045 37046 /** 37047 * <p> 37048 * AttributeCore provides the lightest level of configurable attribute support. It is designed to be 37049 * augmented on to a host class, and provides the host with the ability to configure 37050 * attributes to store and retrieve state, <strong>but without support for attribute change events</strong>. 37051 * </p> 37052 * <p>For example, attributes added to the host can be configured:</p> 37053 * <ul> 37054 * <li>As read only.</li> 37055 * <li>As write once.</li> 37056 * <li>With a setter function, which can be used to manipulate 37057 * values passed to Attribute's <a href="#method_set">set</a> method, before they are stored.</li> 37058 * <li>With a getter function, which can be used to manipulate stored values, 37059 * before they are returned by Attribute's <a href="#method_get">get</a> method.</li> 37060 * <li>With a validator function, to validate values before they are stored.</li> 37061 * </ul> 37062 * 37063 * <p>See the <a href="#method_addAttr">addAttr</a> method, for the complete set of configuration 37064 * options available for attributes.</p> 37065 * 37066 * <p>Object/Classes based on AttributeCore can augment <a href="AttributeObservable.html">AttributeObservable</a>
37067 * (with true for overwrite) and <a href="AttributeExtras.html">AttributeExtras</a> to add attribute event and 37068 * additional, less commonly used attribute methods, such as `modifyAttr`, `removeAttr` and `reset`.</p> 37069 * 37070 * @class AttributeCore 37071 * @param attrs {Object} The attributes to add during construction (passed through to <a href="#method_addAttrs">addAttrs</a>). 37072 * These can also be defined on the constructor being augmented with Attribute by defining the ATTRS property on the constructor. 37073 * @param values {Object} The initial attribute values to apply (passed through to <a href="#method_addAttrs">addAttrs</a>). 37074 * These are not merged/cloned. The caller is responsible for isolating user provided values if required. 37075 * @param lazy {boolean} Whether or not to add attributes lazily (passed through to <a href="#method_addAttrs">addAttrs</a>). 37076 */ 37077 function AttributeCore(attrs, values, lazy) { 37078 // HACK: Fix #2531929 37079 // 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. 37080 // Too late in the release cycle to do anything about the core problem. 37081 // 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). 37082 this._yuievt = null; 37083 37084 this._initAttrHost(attrs, values, lazy); 37085 } 37086 37087 /** 37088 * <p>The value to return from an attribute setter in order to prevent the set from going through.</p> 37089 * 37090 * <p>You can return this value from your setter if you wish to combine validator and setter 37091 * functionality into a single setter function, which either returns the massaged value to be stored or 37092 * AttributeCore.INVALID_VALUE to prevent invalid values from being stored.</p> 37093 * 37094 * @property INVALID_VALUE 37095 * @type Object 37096 * @static 37097 * @final 37098 */ 37099 AttributeCore.INVALID_VALUE = {}; 37100 INVALID_VALUE = AttributeCore.INVALID_VALUE; 37101 37102 /** 37103 * The list of properties which can be configured for 37104 * each attribute (e.g. setter, getter, writeOnce etc.). 37105 * 37106 * This property is used internally as a whitelist for faster 37107 * Y.mix operations. 37108 * 37109 * @property _ATTR_CFG 37110 * @type Array 37111 * @static 37112 * @protected 37113 */ 37114 AttributeCore._ATTR_CFG = [SETTER, GETTER, VALIDATOR, VALUE, VALUE_FN, WRITE_ONCE, READ_ONLY, LAZY_ADD, BYPASS_PROXY]; 37115 37116 /** 37117 * Utility method to protect an attribute configuration hash, by merging the 37118 * entire object and the individual attr config objects. 37119 * 37120 * @method protectAttrs 37121 * @static 37122 * @param {Object} attrs A hash of attribute to configuration object pairs. 37123 * @return {Object} A protected version of the `attrs` argument. 37124 */ 37125 AttributeCore.protectAttrs = function (attrs) { 37126 if (attrs) { 37127 attrs = Y.merge(attrs); 37128 for (var attr in attrs) { 37129 if (attrs.hasOwnProperty(attr)) { 37130 attrs[attr] = Y.merge(attrs[attr]); 37131 } 37132 } 37133 } 37134 37135 return attrs; 37136 }; 37137 37138 AttributeCore.prototype = { 37139 37140 /** 37141 * Constructor logic for attributes. Initializes the host state, and sets up the inital attributes passed to the 37142 * constructor. 37143 * 37144 * @method _initAttrHost 37145 * @param attrs {Object} The attributes to add during construction (passed through to <a href="#method_addAttrs">addAttrs</a>). 37146 * These can also be defined on the constructor being augmented with Attribute by defining the ATTRS property on the constructor. 37147 * @param values {Object} The initial attribute values to apply (passed through to <a href="#method_addAttrs">addAttrs</a>). 37148 * These are not merged/cloned. The caller is responsible for isolating user provided values if required. 37149 * @param lazy {boolean} Whether or not to add attributes lazily (passed through to <a href="#method_addAttrs">addAttrs</a>). 37150 * @private 37151 */ 37152 _initAttrHost : function(attrs, values, lazy) { 37153 this._state = new Y.State(); 37154 this._initAttrs(attrs, values, lazy); 37155 }, 37156 37157 /** 37158 * <p> 37159 * Adds an attribute with the provided configuration to the host object. 37160 * </p> 37161 * <p> 37162 * The config argument object supports the following properties: 37163 * </p> 37164 * 37165 * <dl> 37166 * <dt>value <Any></dt> 37167 * <dd>The initial value to set on the attribute</dd> 37168 * 37169 * <dt>valueFn <Function | String></dt> 37170 * <dd> 37171 * <p>A function, which will return the initial value to set on the attribute. This is useful 37172 * for cases where the attribute configuration is defined statically, but needs to 37173 * reference the host instance ("this") to obtain an initial value. If both the value and valueFn properties are defined, 37174 * the value returned by the valueFn has precedence over the value property, unless it returns undefined, in which 37175 * case the value property is used.</p> 37176 * 37177 * <p>valueFn can also be set to a string, representing the name of the instance method to be used to retrieve the value.</p> 37178 * </dd> 37179 * 37180 * <dt>readOnly <boolean></dt> 37181 * <dd>Whether or not the attribute is read only. Attributes having readOnly set to true 37182 * cannot be modified by invoking the set method.</dd> 37183 * 37184 * <dt>writeOnce <boolean> or <string></dt> 37185 * <dd> 37186 * Whether or not the attribute is "write once". Attributes having writeOnce set to true, 37187 * can only have their values set once, be it through the default configuration, 37188 * constructor configuration arguments, or by invoking set. 37189 * <p>The writeOnce attribute can also be set to the string "initOnly", 37190 * in which case the attribute can only be set during initialization 37191 * (when used with Base, this means it can only be set during construction)</p> 37192 * </dd> 37193 * 37194 * <dt>setter <Function | String></dt> 37195 * <dd> 37196 * <p>The setter function used to massage or normalize the value passed to the set method for the attribute. 37197 * The value returned by the setter will be the final stored value. Returning 37198 * <a href="#property_Attribute.INVALID_VALUE">Attribute.INVALID_VALUE</a>, from the setter will prevent 37199 * the value from being stored. 37200 * </p> 37201 * 37202 * <p>setter can also be set to a string, representing the name of the instance method to be used as the setter function.</p> 37203 * </dd> 37204 * 37205 * <dt>getter <Function | String></dt> 37206 * <dd> 37207 * <p> 37208 * The getter function used to massage or normalize the value returned by the get method for the attribute. 37209 * The value returned by the getter function is the value which will be returned to the user when they 37210 * invoke get. 37211 * </p> 37212 * 37213 * <p>getter can also be set to a string, representing the name of the instance method to be used as the getter function.</p> 37214 * </dd> 37215 * 37216 * <dt>validator <Function | String></dt> 37217 * <dd> 37218 * <p> 37219 * The validator function invoked prior to setting the stored value. Returning 37220 * false from the validator function will prevent the value from being stored. 37221 * </p> 37222 * 37223 * <p>validator can also be set to a string, representing the name of the instance method to be used as the validator function.</p> 37224 * </dd> 37225 * 37226 * <dt>lazyAdd <boolean></dt> 37227 * <dd>Whether or not to delay initialization of the attribute until the first call to get/set it. 37228 * This flag can be used to over-ride lazy initialization on a per attribute basis, when adding multiple attributes through 37229 * the <a href="#method_addAttrs">addAttrs</a> method.</dd> 37230 * 37231 * </dl> 37232 * 37233 * <p>The setter, getter and validator are invoked with the value and name passed in as the first and second arguments, and with 37234 * the context ("this") set to the host object.</p> 37235 * 37236 * <p>Configuration properties outside of the list mentioned above are considered private properties used internally by attribute, 37237 * and are not intended for public use.</p> 37238 * 37239 * @method addAttr 37240 * 37241 * @param {String} name The name of the attribute. 37242 * @param {Object} config An object with attribute configuration property/value pairs, specifying the configuration for the attribute. 37243 * 37244 * <p> 37245 * <strong>NOTE:</strong> The configuration object is modified when adding an attribute, so if you need 37246 * to protect the original values, you will need to merge the object. 37247 * </p> 37248 * 37249 * @param {boolean} lazy (optional) Whether or not to add this attribute lazily (on the first call to get/set). 37250 * 37251 * @return {Object} A reference to the host object. 37252 * 37253 * @chainable 37254 */ 37255 addAttr : function(name, config, lazy) { 37256 37257 37258 var host = this, // help compression 37259 state = host._state, 37260 data = state.data, 37261 value, 37262 added, 37263 hasValue; 37264 37265 config = config || {}; 37266 37267 if (LAZY_ADD in config) { 37268 lazy = config[LAZY_ADD]; 37269 } 37270 37271 added = state.get(name, ADDED); 37272 37273 if (lazy && !added) { 37274 state.data[name] = { 37275 lazy : config, 37276 added : true 37277 }; 37278 } else { 37279 37280 37281 if (!added || config.isLazyAdd) { 37282 37283 hasValue = (VALUE in config); 37284 37285 37286 if (hasValue) { 37287 37288 // We'll go through set, don't want to set value in config directly 37289 37290 // PERF TODO: VALIDATE: See if setting this to undefined is sufficient. We use to delete before. 37291 // In certain code paths/use cases, undefined may not be the same as not present. 37292 // If not, we can set it to some known fixed value (like INVALID_VALUE, say INITIALIZING_VALUE) for performance, 37293 // to avoid a delete which seems to help a lot. 37294 37295 value = config.value; 37296 config.value = undefined; 37297 } 37298 37299 config.added = true; 37300 config.initializing = true; 37301 37302 data[name] = config; 37303 37304 if (hasValue) { 37305 // Go through set, so that raw values get normalized/validated 37306 host.set(name, value); 37307 } 37308 37309 config.initializing = false;
37310 } 37311 } 37312 37313 return host; 37314 }, 37315 37316 /** 37317 * Checks if the given attribute has been added to the host 37318 * 37319 * @method attrAdded 37320 * @param {String} name The name of the attribute to check. 37321 * @return {boolean} true if an attribute with the given name has been added, false if it hasn't. 37322 * This method will return true for lazily added attributes. 37323 */ 37324 attrAdded: function(name) { 37325 return !!(this._state.get(name, ADDED)); 37326 }, 37327 37328 /** 37329 * Returns the current value of the attribute. If the attribute 37330 * has been configured with a 'getter' function, this method will delegate 37331 * to the 'getter' to obtain the value of the attribute. 37332 * 37333 * @method get 37334 * 37335 * @param {String} name The name of the attribute. If the value of the attribute is an Object, 37336 * dot notation can be used to obtain the value of a property of the object (e.g. <code>get("x.y.z")</code>) 37337 * 37338 * @return {Any} The value of the attribute 37339 */ 37340 get : function(name) { 37341 return this._getAttr(name); 37342 }, 37343 37344 /** 37345 * Checks whether or not the attribute is one which has been 37346 * added lazily and still requires initialization. 37347 * 37348 * @method _isLazyAttr 37349 * @private 37350 * @param {String} name The name of the attribute 37351 * @return {boolean} true if it's a lazily added attribute, false otherwise. 37352 */ 37353 _isLazyAttr: function(name) { 37354 return this._state.get(name, LAZY); 37355 }, 37356 37357 /** 37358 * Finishes initializing an attribute which has been lazily added. 37359 * 37360 * @method _addLazyAttr 37361 * @private 37362 * @param {Object} name The name of the attribute 37363 * @param {Object} [lazyCfg] Optional config hash for the attribute. This is added for performance 37364 * along the critical path, where the calling method has already obtained lazy config from state. 37365 */ 37366 _addLazyAttr: function(name, lazyCfg) { 37367 var state = this._state; 37368 37369 lazyCfg = lazyCfg || state.get(name, LAZY); 37370 37371 if (lazyCfg) { 37372 37373 // PERF TODO: For App's id override, otherwise wouldn't be 37374 // needed. It expects to find it in the cfg for it's 37375 // addAttr override. Would like to remove, once App override is 37376 // removed. 37377 state.data[name].lazy = undefined; 37378 37379 lazyCfg.isLazyAdd = true; 37380 37381 this.addAttr(name, lazyCfg); 37382 } 37383 }, 37384 37385 /** 37386 * Sets the value of an attribute. 37387 * 37388 * @method set 37389 * @chainable 37390 * 37391 * @param {String} name The name of the attribute. If the 37392 * current value of the attribute is an Object, dot notation can be used 37393 * to set the value of a property within the object (e.g. <code>set("x.y.z", 5)</code>). 37394 * @param {Any} value The value to set the attribute to. 37395 * @param {Object} [opts] Optional data providing the circumstances for the change. 37396 * @return {Object} A reference to the host object. 37397 */ 37398 set : function(name, val, opts) { 37399 return this._setAttr(name, val, opts); 37400 }, 37401 37402 /** 37403 * Allows setting of readOnly/writeOnce attributes. See <a href="#method_set">set</a> for argument details. 37404 * 37405 * @method _set 37406 * @protected 37407 * @chainable 37408 * 37409 * @param {String} name The name of the attribute. 37410 * @param {Any} val The value to set the attribute to. 37411 * @param {Object} [opts] Optional data providing the circumstances for the change. 37412 * @return {Object} A reference to the host object. 37413 */ 37414 _set : function(name, val, opts) { 37415 return this._setAttr(name, val, opts, true); 37416 }, 37417 37418 /** 37419 * Provides the common implementation for the public set and protected _set methods. 37420 * 37421 * See <a href="#method_set">set</a> for argument details. 37422 * 37423 * @method _setAttr 37424 * @protected 37425 * @chainable 37426 * 37427 * @param {String} name The name of the attribute. 37428 * @param {Any} value The value to set the attribute to. 37429 * @param {Object} [opts] Optional data providing the circumstances for the change. 37430 * @param {boolean} force If true, allows the caller to set values for 37431 * readOnly or writeOnce attributes which have already been set. 37432 * 37433 * @return {Object} A reference to the host object. 37434 */ 37435 _setAttr : function(name, val, opts, force) { 37436 var allowSet = true, 37437 state = this._state, 37438 stateProxy = this._stateProxy, 37439 tCfgs = this._tCfgs, 37440 cfg, 37441 initialSet, 37442 strPath, 37443 path, 37444 currVal, 37445 writeOnce, 37446 initializing; 37447 37448 if (name.indexOf(DOT) !== -1) { 37449 strPath = name; 37450 37451 path = name.split(DOT); 37452 name = path.shift(); 37453 } 37454 37455 // On Demand - Should be rare - handles out of order valueFn, setter, getter references 37456 if (tCfgs && tCfgs[name]) { 37457 this._addOutOfOrder(name, tCfgs[name]); 37458 } 37459 37460 cfg = state.data[name] || {}; 37461 37462 if (cfg.lazy) { 37463 cfg = cfg.lazy; 37464 this._addLazyAttr(name, cfg); 37465 } 37466 37467 initialSet = (cfg.value === undefined); 37468 37469 if (stateProxy && name in stateProxy && !cfg._bypassProxy) { 37470 // 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? 37471 initialSet = false;
37472 } 37473 37474 writeOnce = cfg.writeOnce; 37475 initializing = cfg.initializing; 37476 37477 if (!initialSet && !force) { 37478 37479 if (writeOnce) { 37480 allowSet = false; 37481 } 37482 37483 if (cfg.readOnly) { 37484 allowSet = false; 37485 } 37486 } 37487 37488 if (!initializing && !force && writeOnce === INIT_ONLY) { 37489 allowSet = false; 37490 } 37491 37492 if (allowSet) { 37493 // Don't need currVal if initialSet (might fail in custom getter if it always expects a non-undefined/non-null value) 37494 if (!initialSet) { 37495 currVal = this.get(name); 37496 } 37497 37498 if (path) { 37499 var copyVal = [currVal].reduce( 37500 function(retVal, currVal) { 37501 Object.keys(currVal).forEach( 37502 function(item) { 37503 retVal[item] = currVal[item]; 37504 } 37505 ); 37506 return retVal; 37507 }, 37508 {} 37509 ); 37510 37511 var pathNode = copyVal; 37512 var leafIdx = path.length - 1; 37513 37514 for (var i = 0; i < leafIdx && pathNode; i++) { 37515 pathNode = pathNode[path[i]]; 37516 } 37517 37518 if (pathNode) { 37519 delete pathNode[path[leafIdx]]; 37520 } 37521 37522 val = O.setValue(Y.clone(copyVal), path, val); 37523 37524 if (val === undefined) { 37525 allowSet = false; 37526 } 37527 } 37528 37529 if (allowSet) { 37530 if (!this._fireAttrChange || initializing) { 37531 this._setAttrVal(name, strPath, currVal, val, opts, cfg); 37532 } else { 37533 // HACK - no real reason core needs to know about _fireAttrChange, but 37534 // it adds fn hops if we want to break it out. Not sure it's worth it for this critical path 37535 this._fireAttrChange(name, strPath, currVal, val, opts, cfg); 37536 } 37537 } 37538 } 37539 37540 return this; 37541 }, 37542 37543 /** 37544 * Utility method used by get/set to add attributes 37545 * encountered out of order when calling addAttrs(). 37546 * 37547 * For example, if: 37548 * 37549 * this.addAttrs({ 37550 * foo: { 37551 * setter: function() { 37552 * // make sure this bar is available when foo is added 37553 * this.get("bar"); 37554 * } 37555 * }, 37556 * bar: { 37557 * value: ... 37558 * } 37559 * }); 37560 * 37561 * @method _addOutOfOrder 37562 * @private 37563 * @param name {String} attribute name 37564 * @param cfg {Object} attribute configuration 37565 */ 37566 _addOutOfOrder : function(name, cfg) { 37567 37568 var attrs = {}; 37569 attrs[name] = cfg; 37570 37571 delete this._tCfgs[name]; 37572 37573 // TODO: The original code went through addAttrs, so 37574 // sticking with it for this pass. Seems like we could 37575 // just jump straight to _addAttr() and get some perf 37576 // improvement. 37577 this._addAttrs(attrs, this._tVals); 37578 }, 37579 37580 /** 37581 * Provides the common implementation for the public get method, 37582 * allowing Attribute hosts to over-ride either method. 37583 * 37584 * See <a href="#method_get">get</a> for argument details. 37585 * 37586 * @method _getAttr 37587 * @protected 37588 * @chainable 37589 * 37590 * @param {String} name The name of the attribute. 37591 * @return {Any} The value of the attribute. 37592 */ 37593 _getAttr : function(name) { 37594 var fullName = name, 37595 tCfgs = this._tCfgs, 37596 path, 37597 getter, 37598 val, 37599 attrCfg; 37600 37601 if (name.indexOf(DOT) !== -1) { 37602 path = name.split(DOT); 37603 name = path.shift(); 37604 } 37605 37606 // On Demand - Should be rare - handles out of 37607 // order valueFn, setter, getter references 37608 if (tCfgs && tCfgs[name]) { 37609 this._addOutOfOrder(name, tCfgs[name]); 37610 } 37611 37612 attrCfg = this._state.data[name] || {}; 37613 37614 // Lazy Init 37615 if (attrCfg.lazy) { 37616 attrCfg = attrCfg.lazy; 37617 this._addLazyAttr(name, attrCfg); 37618 } 37619 37620 val = this._getStateVal(name, attrCfg); 37621 37622 getter = attrCfg.getter; 37623 37624 if (getter && !getter.call) { 37625 getter = this[getter]; 37626 } 37627 37628 val = (getter) ? getter.call(this, val, fullName) : val; 37629 val = (path) ? O.getValue(val, path) : val; 37630 37631 return val; 37632 }, 37633 37634 /** 37635 * Gets the stored value for the attribute, from either the 37636 * internal state object, or the state proxy if it exits 37637 * 37638 * @method _getStateVal 37639 * @private 37640 * @param {String} name The name of the attribute 37641 * @param {Object} [cfg] Optional config hash for the attribute. This is added for performance along the critical path, 37642 * where the calling method has already obtained the config from state. 37643 * 37644 * @return {Any} The stored value of the attribute 37645 */ 37646 _getStateVal : function(name, cfg) { 37647 var stateProxy = this._stateProxy; 37648 37649 if (!cfg) { 37650 cfg = this._state.getAll(name) || {}; 37651 } 37652 37653 return (stateProxy && (name in stateProxy) && !(cfg._bypassProxy)) ? stateProxy[name] : cfg.value; 37654 }, 37655 37656 /** 37657 * Sets the stored value for the attribute, in either the 37658 * internal state object, or the state proxy if it exits 37659 * 37660 * @method _setStateVal 37661 * @private 37662 * @param {String} name The name of the attribute 37663 * @param {Any} value The value of the attribute 37664 */ 37665 _setStateVal : function(name, value) { 37666 var stateProxy = this._stateProxy; 37667 if (stateProxy && (name in stateProxy) && !this._state.get(name, BYPASS_PROXY)) { 37668 stateProxy[name] = value; 37669 } else { 37670 this._state.add(name, VALUE, value); 37671 } 37672 }, 37673 37674 /** 37675 * Updates the stored value of the attribute in the privately held State object, 37676 * if validation and setter passes. 37677 * 37678 * @method _setAttrVal 37679 * @private 37680 * @param {String} attrName The attribute name. 37681 * @param {String} subAttrName The sub-attribute name, if setting a sub-attribute property ("x.y.z"). 37682 * @param {Any} prevVal The currently stored value of the attribute. 37683 * @param {Any} newVal The value which is going to be stored. 37684 * @param {Object} [opts] Optional data providing the circumstances for the change. 37685 * @param {Object} [attrCfg] Optional config hash for the attribute. This is added for performance along the critical path, 37686 * where the calling method has already obtained the config from state. 37687 * 37688 * @return {Boolean} true if the new attribute value was stored, false if not. 37689 */ 37690 _setAttrVal : function(attrName, subAttrName, prevVal, newVal, opts, attrCfg) { 37691 37692 var host = this, 37693 allowSet = true, 37694 cfg = attrCfg || this._state.data[attrName] || {}, 37695 validator = cfg.validator, 37696 setter = cfg.setter, 37697 initializing = cfg.initializing, 37698 prevRawVal = this._getStateVal(attrName, cfg), 37699 name = subAttrName || attrName, 37700 retVal, 37701 valid; 37702 37703 if (validator) { 37704 if (!validator.call) { 37705 // Assume string - trying to keep critical path tight, so avoiding Lang check 37706 validator = this[validator]; 37707 } 37708 if (validator) { 37709 valid = validator.call(host, newVal, name, opts); 37710 37711 if (!valid && initializing) { 37712 newVal = cfg.defaultValue; 37713 valid = true; // Assume it's valid, for perf. 37714 } 37715 } 37716 } 37717 37718 if (!validator || valid) { 37719 if (setter) { 37720 if (!setter.call) { 37721 // Assume string - trying to keep critical path tight, so avoiding Lang check 37722 setter = this[setter]; 37723 } 37724 if (setter) { 37725 retVal = setter.call(host, newVal, name, opts); 37726 37727 if (retVal === INVALID_VALUE) { 37728 if (initializing) { 37729 newVal = cfg.defaultValue; 37730 } else { 37731 allowSet = false;
37732 } 37733 } else if (retVal !== undefined){ 37734 newVal = retVal; 37735 } 37736 } 37737 } 37738 37739 if (allowSet) { 37740 if(!subAttrName && (newVal === prevRawVal) && !Lang.isObject(newVal)) { 37741 allowSet = false; 37742 } else { 37743 // Store value 37744 if (!(INIT_VALUE in cfg)) { 37745 cfg.initValue = newVal; 37746 } 37747 host._setStateVal(attrName, newVal); 37748 } 37749 } 37750 37751 } else { 37752 allowSet = false; 37753 } 37754 37755 return allowSet; 37756 }, 37757 37758 /** 37759 * Sets multiple attribute values. 37760 * 37761 * @method setAttrs 37762 * @param {Object} attrs An object with attributes name/value pairs. 37763 * @param {Object} [opts] Optional data providing the circumstances for the change. 37764 * @return {Object} A reference to the host object. 37765 * @chainable 37766 */ 37767 setAttrs : function(attrs, opts) { 37768 return this._setAttrs(attrs, opts); 37769 }, 37770 37771 /** 37772 * Implementation behind the public setAttrs method, to set multiple attribute values. 37773 * 37774 * @method _setAttrs 37775 * @protected 37776 * @param {Object} attrs An object with attributes name/value pairs. 37777 * @param {Object} [opts] Optional data providing the circumstances for the change 37778 * @return {Object} A reference to the host object. 37779 * @chainable 37780 */ 37781 _setAttrs : function(attrs, opts) { 37782 var attr; 37783 for (attr in attrs) { 37784 if ( attrs.hasOwnProperty(attr) ) { 37785 this.set(attr, attrs[attr], opts); 37786 } 37787 } 37788 return this; 37789 }, 37790 37791 /** 37792 * Gets multiple attribute values. 37793 * 37794 * @method getAttrs 37795 * @param {String[]|Boolean} attrs Optional. An array of attribute names. If omitted, all attribute values are 37796 * returned. If set to true, all attributes modified from their initial values are returned. 37797 * @return {Object} An object with attribute name/value pairs. 37798 */ 37799 getAttrs : function(attrs) { 37800 return this._getAttrs(attrs); 37801 }, 37802 37803 /** 37804 * Implementation behind the public getAttrs method, to get multiple attribute values. 37805 * 37806 * @method _getAttrs 37807 * @protected 37808 * @param {String[]|Boolean} attrs Optional. An array of attribute names. If omitted, all attribute values are 37809 * returned. If set to true, all attributes modified from their initial values are returned. 37810 * @return {Object} An object with attribute name/value pairs. 37811 */ 37812 _getAttrs : function(attrs) { 37813 var obj = {}, 37814 attr, i, len, 37815 modifiedOnly = (attrs === true); 37816 37817 // TODO - figure out how to get all "added" 37818 if (!attrs || modifiedOnly) { 37819 attrs = O.keys(this._state.data); 37820 } 37821 37822 for (i = 0, len = attrs.length; i < len; i++) { 37823 attr = attrs[i]; 37824 37825 if (!modifiedOnly || this._getStateVal(attr) != this._state.get(attr, INIT_VALUE)) { 37826 // Go through get, to honor cloning/normalization 37827 obj[attr] = this.get(attr); 37828 } 37829 } 37830 37831 return obj; 37832 }, 37833 37834 /** 37835 * Configures a group of attributes, and sets initial values. 37836 * 37837 * <p> 37838 * <strong>NOTE:</strong> This method does not isolate the configuration object by merging/cloning. 37839 * The caller is responsible for merging/cloning the configuration object if required. 37840 * </p> 37841 * 37842 * @method addAttrs 37843 * @chainable 37844 * 37845 * @param {Object} cfgs An object with attribute name/configuration pairs. 37846 * @param {Object} values An object with attribute name/value pairs, defining the initial values to apply. 37847 * Values defined in the cfgs argument will be over-written by values in this argument unless defined as read only. 37848 * @param {boolean} lazy Whether or not to delay the intialization of these attributes until the first call to get/set.
37849 * Individual attributes can over-ride this behavior by defining a lazyAdd configuration property in their configuration. 37850 * See <a href="#method_addAttr">addAttr</a>. 37851 * 37852 * @return {Object} A reference to the host object. 37853 */ 37854 addAttrs : function(cfgs, values, lazy) { 37855 if (cfgs) { 37856 this._tCfgs = cfgs; 37857 this._tVals = (values) ? this._normAttrVals(values) : null; 37858 this._addAttrs(cfgs, this._tVals, lazy); 37859 this._tCfgs = this._tVals = null; 37860 } 37861 37862 return this; 37863 }, 37864 37865 /** 37866 * Implementation behind the public addAttrs method. 37867 * 37868 * This method is invoked directly by get if it encounters a scenario 37869 * in which an attribute's valueFn attempts to obtain the 37870 * value an attribute in the same group of attributes, which has not yet 37871 * been added (on demand initialization). 37872 * 37873 * @method _addAttrs 37874 * @private 37875 * @param {Object} cfgs An object with attribute name/configuration pairs. 37876 * @param {Object} values An object with attribute name/value pairs, defining the initial values to apply. 37877 * Values defined in the cfgs argument will be over-written by values in this argument unless defined as read only. 37878 * @param {boolean} lazy Whether or not to delay the intialization of these attributes until the first call to get/set. 37879 * Individual attributes can over-ride this behavior by defining a lazyAdd configuration property in their configuration. 37880 * See <a href="#method_addAttr">addAttr</a>. 37881 */ 37882 _addAttrs : function(cfgs, values, lazy) { 37883 var tCfgs = this._tCfgs, 37884 tVals = this._tVals, 37885 attr, 37886 attrCfg, 37887 value; 37888 37889 for (attr in cfgs) { 37890 if (cfgs.hasOwnProperty(attr)) { 37891 37892 // Not Merging. Caller is responsible for isolating configs 37893 attrCfg = cfgs[attr]; 37894 attrCfg.defaultValue = attrCfg.value; 37895 37896 // Handle simple, complex and user values, accounting for read-only 37897 value = this._getAttrInitVal(attr, attrCfg, tVals); 37898 37899 if (value !== undefined) { 37900 attrCfg.value = value; 37901 } 37902 37903 if (tCfgs[attr]) { 37904 tCfgs[attr] = undefined; 37905 } 37906 37907 this.addAttr(attr, attrCfg, lazy); 37908 } 37909 } 37910 }, 37911 37912 /** 37913 * Utility method to protect an attribute configuration 37914 * hash, by merging the entire object and the individual 37915 * attr config objects. 37916 * 37917 * @method _protectAttrs 37918 * @protected 37919 * @param {Object} attrs A hash of attribute to configuration object pairs. 37920 * @return {Object} A protected version of the attrs argument. 37921 * @deprecated Use `AttributeCore.protectAttrs()` or 37922 * `Attribute.protectAttrs()` which are the same static utility method. 37923 */ 37924 _protectAttrs : AttributeCore.protectAttrs, 37925 37926 /** 37927 * Utility method to normalize attribute values. The base implementation 37928 * simply merges the hash to protect the original. 37929 * 37930 * @method _normAttrVals 37931 * @param {Object} valueHash An object with attribute name/value pairs 37932 * 37933 * @return {Object} An object literal with 2 properties - "simple" and "complex", 37934 * containing simple and complex attribute values respectively keyed 37935 * by the top level attribute name, or null, if valueHash is falsey. 37936 * 37937 * @private 37938 */ 37939 _normAttrVals : function(valueHash) { 37940 var vals, 37941 subvals, 37942 path, 37943 attr, 37944 v, k; 37945 37946 if (!valueHash) { 37947 return null; 37948 } 37949 37950 vals = {}; 37951 37952 for (k in valueHash) { 37953 if (valueHash.hasOwnProperty(k)) { 37954 if (k.indexOf(DOT) !== -1) { 37955 path = k.split(DOT); 37956 attr = path.shift(); 37957 37958 subvals = subvals || {}; 37959 37960 v = subvals[attr] = subvals[attr] || []; 37961 v[v.length] = { 37962 path : path, 37963 value: valueHash[k] 37964 }; 37965 } else { 37966 vals[k] = valueHash[k]; 37967 } 37968 } 37969 } 37970 37971 return { simple:vals, complex:subvals }; 37972 }, 37973 37974 /** 37975 * Returns the initial value of the given attribute from 37976 * either the default configuration provided, or the 37977 * over-ridden value if it exists in the set of initValues 37978 * provided and the attribute is not read-only. 37979 * 37980 * @param {String} attr The name of the attribute 37981 * @param {Object} cfg The attribute configuration object 37982 * @param {Object}
37982 initValues The object with simple and complex attribute name/value pairs returned from _normAttrVals 37983 * 37984 * @return {Any} The initial value of the attribute. 37985 * 37986 * @method _getAttrInitVal 37987 * @private 37988 */ 37989 _getAttrInitVal : function(attr, cfg, initValues) { 37990 var val = cfg.value, 37991 valFn = cfg.valueFn, 37992 tmpVal, 37993 initValSet = false, 37994 readOnly = cfg.readOnly, 37995 simple, 37996 complex, 37997 i, 37998 l, 37999 path, 38000 subval, 38001 subvals; 38002 38003 if (!readOnly && initValues) { 38004 // Simple Attributes 38005 simple = initValues.simple; 38006 if (simple && simple.hasOwnProperty(attr)) { 38007 val = simple[attr]; 38008 initValSet = true; 38009 } 38010 } 38011 38012 if (valFn && !initValSet) { 38013 if (!valFn.call) { 38014 valFn = this[valFn]; 38015 } 38016 if (valFn) { 38017 tmpVal = valFn.call(this, attr); 38018 val = tmpVal; 38019 } 38020 } 38021 38022 if (!readOnly && initValues) { 38023 38024 // Complex Attributes (complex values applied, after simple, in case both are set) 38025 complex = initValues.complex; 38026 38027 if (complex && complex.hasOwnProperty(attr) && (val !== undefined) && (val !== null)) { 38028 subvals = complex[attr]; 38029 for (i = 0, l = subvals.length; i < l; ++i) { 38030 path = subvals[i].path; 38031 subval = subvals[i].value; 38032 O.setValue(val, path, subval); 38033 } 38034 } 38035 } 38036 38037 return val; 38038 }, 38039 38040 /** 38041 * Utility method to set up initial attributes defined during construction, 38042 * either through the constructor.ATTRS property, or explicitly passed in. 38043 * 38044 * @method _initAttrs 38045 * @protected 38046 * @param attrs {Object} The attributes to add during construction (passed through to <a href="#method_addAttrs">addAttrs</a>). 38047 * These can also be defined on the constructor being augmented with Attribute by defining the ATTRS property on the constructor. 38048 * @param values {Object} The initial attribute values to apply (passed through to <a href="#method_addAttrs">addAttrs</a>). 38049 * These are not merged/cloned. The caller is responsible for isolating user provided values if required. 38050 * @param lazy {boolean} Whether or not to add attributes lazily (passed through to <a href="#method_addAttrs">addAttrs</a>). 38051 */ 38052 _initAttrs : function(attrs, values, lazy) { 38053 // ATTRS support for Node, which is not Base based 38054 attrs = attrs || this.constructor.ATTRS; 38055 38056 var Base = Y.Base, 38057 BaseCore = Y.BaseCore, 38058 baseInst = (Base && Y.instanceOf(this, Base)), 38059 baseCoreInst = (!baseInst && BaseCore && Y.instanceOf(this, BaseCore)); 38060 38061 if (attrs && !baseInst && !baseCoreInst) { 38062 this.addAttrs(Y.AttributeCore.protectAttrs(attrs), values, lazy); 38063 } 38064 } 38065 }; 38066 38067 Y.AttributeCore = AttributeCore; 38068 38069 38070}, 'patched-v3.18.1', {"requires": ["oop"]}); 38071 38072YUI.add('attribute-observable', function (Y, NAME) { 38073 38074 /*For log lines*/ 38075 /*jshint maxlen:200*/ 38076 38077 38078 /** 38079 * The attribute module provides an augmentable Attribute implementation, which 38080 * adds configurable attributes and attribute change events to the class being 38081 * augmented. It also provides a State class, which is used internally by Attribute, 38082 * but can also be used independently to provide a name/property/value data structure to 38083 * store state. 38084 * 38085 * @module attribute 38086 */ 38087 38088 /** 38089 * The `attribute-observable` submodule provides augmentable attribute change event support 38090 * for AttributeCore based implementations. 38091 * 38092 * @module attribute 38093 * @submodule attribute-observable 38094 */ 38095 var EventTarget = Y.EventTarget, 38096 38097 CHANGE = "Change", 38098 BROADCAST = "broadcast"; 38099 38100 /** 38101 * Provides an augmentable implementation of attribute change events for 38102 * AttributeCore. 38103 * 38104 * @class AttributeObservable 38105 * @extensionfor AttributeCore 38106 * @uses EventTarget 38107 */ 38108 function AttributeObservable() { 38109 // Perf tweak - avoid creating event literals if not required. 38110 this._ATTR_E_FACADE = {}; 38111 38112 EventTarget.call(this, {emitFacade:true}); 38113 } 38114 38115 AttributeObservable._ATTR_CFG = [BROADCAST]; 38116 38117 AttributeObservable.prototype = { 38118 38119 /** 38120 * Sets the value of an attribute. 38121 * 38122 * @method set 38123 * @chainable 38124 * 38125 * @param {String} name The name of the attribute. If the 38126 * current value of the attribute is an Object, dot notation can be used 38127 * to set the value of a property within the object (e.g. <code>set("x.y.z", 5)</code>). 38128 * 38129 * @param {Any} value The value to set the attribute to. 38130 * 38131 * @param {Object} opts (Optional) Optional event data to be mixed into 38132 * the event facade passed to subscribers of the attribute's change event. This 38133 * can be used as a flexible way to identify the source of a call to set, allowing 38134 * the developer to distinguish between set called internally by the host, vs. 38135 * set called externally by the application developer. 38136 * 38137 * @return {Object} A reference to the host object. 38138 */ 38139 set : function(name, val, opts) { 38140 return this._setAttr(name, val, opts); 38141 }, 38142 38143 /** 38144 * Allows setting of readOnly/writeOnce attributes. See <a href="#method_set">set</a> for argument details. 38145 * 38146 * @method _set 38147 * @protected 38148 * @chainable 38149 * 38150 * @param {String} name The name of the attribute. 38151 * @param {Any} val The value to set the attribute to. 38152 * @param {Object} opts (Optional) Optional event data to be mixed into 38153 * the event facade passed to subscribers of the attribute's change event. 38154 * @return {Object} A reference to the host object. 38155 */ 38156 _set : function(name, val, opts) { 38157 return this._setAttr(name, val, opts, true); 38158 }, 38159 38160 /** 38161 * Sets multiple attribute values. 38162 * 38163 * @method setAttrs 38164 * @param {Object} attrs An object with attributes name/value pairs. 38165 * @param {Object} opts Properties to mix into the event payload. These are shared and mixed into each set 38166 * @return {Object} A reference to the host object. 38167 * @chainable 38168 */ 38169 setAttrs : function(attrs, opts) { 38170 return this._setAttrs(attrs, opts); 38171 }, 38172 38173 /** 38174 * Implementation behind the public setAttrs method, to set multiple attribute values. 38175 * 38176 * @method _setAttrs 38177 * @protected 38178 * @param {Object} attrs An object with attributes name/value pairs. 38179 * @param {Object} opts Properties to mix into the event payload. These are shared and mixed into each set 38180 * @return {Object} A reference to the host object. 38181 * @chainable 38182 */ 38183 _setAttrs : function(attrs, opts) { 38184 var attr; 38185 for (attr in attrs) { 38186 if ( attrs.hasOwnProperty(attr) ) { 38187 this.set(attr, attrs[attr], opts); 38188 } 38189 } 38190 return this; 38191 }, 38192 38193 /** 38194 * Utility method to help setup the event payload and fire the attribute change event. 38195 * 38196 * @method _fireAttrChange 38197 * @private 38198 * @param {String} attrName The name of the attribute 38199 * @param {String} subAttrName The full path of the property being changed, 38200 * if this is a sub-attribute value being change. Otherwise null. 38201 * @param {Any} currVal The current value of the attribute 38202 * @param {Any} newVal The new value of the attribute 38203 * @param {Object} opts Any additional event data to mix into the attribute change event's event facade. 38204 * @param {Object} [cfg] The attribute config stored in State, if already available. 38205 */ 38206 _fireAttrChange : function(attrName, subAttrName, currVal, newVal, opts, cfg) { 38207 var host = this, 38208 eventName = this._getFullType(attrName + CHANGE), 38209 state = host._state, 38210 facade, 38211 broadcast, 38212 e; 38213 38214 if (!cfg) { 38215 cfg = state.data[attrName] || {}; 38216 } 38217 38218 if (!cfg.published) { 38219 38220 // PERF: Using lower level _publish() for 38221 // critical path performance 38222 e = host._publish(eventName); 38223 38224 e.emitFacade = true; 38225 e.defaultTargetOnly = true; 38226 e.defaultFn = host._defAttrChangeFn; 38227 38228 broadcast = cfg.broadcast; 38229 if (broadcast !== undefined) { 38230 e.broadcast = broadcast; 38231 } 38232 38233 cfg.published = true; 38234 } 38235 38236 if (opts) { 38237 facade = Y.merge(opts); 38238 facade._attrOpts = opts; 38239 } else { 38240 facade = host._ATTR_E_FACADE; 38241 } 38242 38243 // Not using the single object signature for fire({type:..., newVal:...}), since 38244 // we don't want to override type. Changed to the fire(type, {newVal:...}) signature. 38245 38246 facade.attrName = attrName; 38247 facade.subAttrName = subAttrName; 38248 facade.prevVal = currVal; 38249 facade.newVal = newVal; 38250 38251 if (host._hasPotentialSubscribers(eventName)) { 38252 host.fire(eventName, facade); 38253 } else { 38254 this._setAttrVal(attrName, subAttrName, currVal, newVal, opts, cfg); 38255 } 38256 }, 38257 38258 /** 38259 * Default function for attribute change events. 38260 * 38261 * @private 38262 * @method _defAttrChangeFn 38263 * @param {EventFacade} e The event object for attribute change events. 38264 * @param {boolean} eventFastPath Whether or not we're using this as a fast path in the case of no listeners or not 38265 */ 38266 _defAttrChangeFn : function(e, eventFastPath) { 38267 38268 var opts = e._attrOpts; 38269 if (opts) { 38270 delete e._attrOpts; 38271 } 38272 38273 if (!this._setAttrVal(e.attrName, e.subAttrName, e.prevVal, e.newVal, opts)) { 38274 38275 38276 if (!eventFastPath) { 38277 // Prevent "after" listeners from being invoked since nothing changed. 38278 e.stopImmediatePropagation(); 38279 } 38280 38281 } else { 38282 if (!eventFastPath) { 38283 e.newVal = this.get(e.attrName); 38284 } 38285 } 38286 } 38287 }; 38288 38289 // Basic prototype augment - no lazy constructor invocation. 38290 Y.mix(AttributeObservable, EventTarget, false, null, 1); 38291 38292 Y.AttributeObservable = AttributeObservable; 38293 38294 /**
38295 The `AttributeEvents` class extension was deprecated in YUI 3.8.0 and is now 38296 an alias for the `AttributeObservable` class extension. Use that class 38297 extnesion instead. This alias will be removed in a future version of YUI. 38298 38299 @class AttributeEvents 38300 @uses EventTarget 38301 @deprecated Use `AttributeObservable` instead. 38302 @see AttributeObservable 38303 **/ 38304 Y.AttributeEvents = AttributeObservable; 38305 38306 38307}, 'patched-v3.18.1', {"requires": ["event-custom"]}); 38308 38309YUI.add('attribute-extras', function (Y, NAME) { 38310 38311 /** 38312 * The attribute module provides an augmentable Attribute implementation, which 38313 * adds configurable attributes and attribute change events to the class being 38314 * augmented. It also provides a State class, which is used internally by Attribute, 38315 * but can also be used independently to provide a name/property/value data structure to 38316 * store state. 38317 * 38318 * @module attribute 38319 */ 38320 38321 /** 38322 * The attribute-extras submodule provides less commonly used attribute methods, and can 38323 * be augmented/mixed into an implemention which used attribute-core. 38324 * 38325 * @module attribute 38326 * @submodule attribute-extras 38327 */ 38328 var BROADCAST = "broadcast", 38329 PUBLISHED = "published", 38330 INIT_VALUE = "initValue", 38331 38332 MODIFIABLE = { 38333 readOnly:1, 38334 writeOnce:1, 38335 getter:1, 38336 broadcast:1 38337 }; 38338 38339 /** 38340 * A augmentable implementation for AttributeCore, providing less frequently used 38341 * methods for Attribute management such as modifyAttrs(), removeAttr and reset() 38342 * 38343 * @class AttributeExtras 38344 * @extensionfor AttributeCore 38345 */ 38346 function AttributeExtras() {} 38347 38348 AttributeExtras.prototype = { 38349 38350 /** 38351 * Updates the configuration of an attribute which has already been added. 38352 * <p> 38353 * The properties which can be modified through this interface are limited 38354 * to the following subset of attributes, which can be safely modified 38355 * after a value has already been set on the attribute: 38356 * </p> 38357 * <dl> 38358 * <dt>readOnly;</dt> 38359 * <dt>writeOnce;</dt> 38360 * <dt>broadcast; and</dt> 38361 * <dt>getter.</dt> 38362 * </dl> 38363 * <p> 38364 * Note: New attributes cannot be added using this interface. New attributes must be 38365 * added using {{#crossLink "AttributeCore/addAttr:method"}}addAttr{{/crossLink}}, or an 38366 * appropriate manner for a class which utilises Attributes (e.g. the 38367 * {{#crossLink "Base/ATTRS:property"}}ATTRS{{/crossLink}} property in 38368 * {{#crossLink "Base"}}Base{{/crossLink}}). 38369 * </p> 38370 * @method modifyAttr 38371 * @param {String} name The name of the attribute whose configuration is to be updated. 38372 * @param {Object} config An object with configuration property/value pairs, specifying the configuration properties to modify. 38373 */ 38374 modifyAttr: function(name, config) { 38375 var host = this, // help compression 38376 prop, state; 38377 38378 if (host.attrAdded(name)) { 38379 38380 if (host._isLazyAttr(name)) { 38381 host._addLazyAttr(name); 38382 } 38383 38384 state = host._state; 38385 for (prop in config) { 38386 if (MODIFIABLE[prop] && config.hasOwnProperty(prop)) { 38387 state.add(name, prop, config[prop]); 38388 38389 // If we reconfigured broadcast, need to republish 38390 if (prop === BROADCAST) { 38391 state.remove(name, PUBLISHED); 38392 } 38393 } 38394 } 38395 } else { 38396 } 38397 }, 38398 38399 /** 38400 * Removes an attribute from the host object 38401 * 38402 * @method removeAttr 38403 * @param {String} name The name of the attribute to be removed. 38404 */ 38405 removeAttr: function(name) { 38406 this._state.removeAll(name); 38407 }, 38408 38409 /** 38410 * Resets the attribute (or all attributes) to its initial value, as long as 38411 * the attribute is not readOnly, or writeOnce. 38412 * 38413 * @method reset 38414 * @param {String} name Optional. The name of the attribute to reset. If omitted, all attributes are reset. 38415 * @return {Object} A reference to the host object. 38416 * @chainable 38417 */ 38418 reset : function(name) { 38419 var host = this; // help compression 38420 38421 if (name) { 38422 if (host._isLazyAttr(name)) { 38423 host._addLazyAttr(name); 38424 } 38425 host.set(name, host._state.get(name, INIT_VALUE)); 38426 } else { 38427 Y.Object.each(host._state.data, function(v, n) { 38428 host.reset(n); 38429 }); 38430 } 38431 return host; 38432 }, 38433 38434 /** 38435 * Returns an object with the configuration properties (and value) 38436 * for the given attribute. If attrName is not provided, returns the 38437 * configuration properties for all attributes. 38438 * 38439 * @method _getAttrCfg 38440 * @protected 38441 * @param {String} name Optional. The attribute name. If not provided, the method will return the configuration for all attributes. 38442 * @return {Object} The configuration properties for the given attribute, or all attributes. 38443 */ 38444 _getAttrCfg : function(name) { 38445 var o, 38446 state = this._state; 38447 38448 if (name) { 38449 o = state.getAll(name) || {}; 38450 } else { 38451 o = {}; 38452 Y.each(state.data, function(v, n) { 38453 o[n] = state.getAll(n); 38454 }); 38455 } 38456 38457 return o; 38458 } 38459 }; 38460 38461 Y.AttributeExtras = AttributeExtras; 38462 38463 38464}, 'patched-v3.18.1', {"requires": ["oop"]}); 38465 38466YUI.add('base-base', function (Y, NAME) { 38467 38468 /** 38469 * The base module provides the Base class, which objects requiring attribute and custom event support can extend. 38470 * The module also provides two ways to reuse code - It augments Base with the Plugin.Host interface which provides 38471 * plugin support and also provides the BaseCore.build method which provides a way to build custom classes using extensions. 38472 * 38473 * @module base 38474 */ 38475 38476 /** 38477 * The base-base submodule provides the Base class without the Plugin support, provided by Plugin.Host, 38478 * and without the extension support provided by BaseCore.build. 38479 * 38480 * @module base 38481 * @submodule base-base 38482 */ 38483 38484 var AttributeCore = Y.AttributeCore, 38485 AttributeExtras = Y.AttributeExtras, 38486 BaseCore = Y.BaseCore, 38487 BaseObservable = Y.BaseObservable; 38488 38489 /** 38490 * <p> 38491 * A base class which objects requiring attributes and custom event support can 38492 * extend. Base also handles the chaining of initializer and destructor methods across
38493 * the hierarchy as part of object construction and destruction. Additionally, attributes configured 38494 * through the static <a href="#property_ATTRS">ATTRS</a> property for each class 38495 * in the hierarchy will be initialized by Base. 38496 * </p> 38497 * 38498 * <p> 38499 * **NOTE:** Prior to version 3.11.0, ATTRS would get added a class at a time. That is, 38500 * Base would loop through each class in the hierarchy, and add the class' ATTRS, and 38501 * then call it's initializer, and move on to the subclass' ATTRS and initializer. As of 38502 * 3.11.0, ATTRS from all classes in the hierarchy are added in one `addAttrs` call before 38503 * any initializers are called. This fixes subtle edge-case issues with subclass ATTRS overriding 38504 * superclass `setter`, `getter` or `valueFn` definitions and being unable to get/set attributes 38505 * defined by the subclass. This order of operation change may impact `setter`, `getter` or `valueFn` 38506 * code which expects a superclass' initializer to have run. This is expected to be rare, but to support 38507 * it, Base supports a `_preAddAttrs()`, method hook (same signature as `addAttrs`). Components can 38508 * implement this method on their prototype for edge cases which do require finer control over 38509 * the order in which attributes are added (see widget-htmlparser). 38510 * </p> 38511 * 38512 * <p> 38513 * The static <a href="#property_NAME">NAME</a> property of each class extending 38514 * from Base will be used as the identifier for the class, and is used by Base to prefix 38515 * all events fired by instances of that class. 38516 * </p> 38517 * 38518 * @class Base 38519 * @constructor 38520 * @uses BaseCore 38521 * @uses BaseObservable 38522 * @uses AttributeCore 38523 * @uses AttributeObservable 38524 * @uses AttributeExtras 38525 * @uses EventTarget 38526 * 38527 * @param {Object} config Object with configuration property name/value pairs. The object can be 38528 * used to provide default values for the objects published attributes. 38529 * 38530 * <p> 38531 * The config object can also contain the following non-attribute properties, providing a convenient 38532 * way to configure events listeners and plugins for the instance, as part of the constructor call: 38533 * </p> 38534 * 38535 * <dl> 38536 * <dt>on</dt> 38537 * <dd>An event name to listener function map, to register event listeners for the "on" moment of the event. 38538 * A constructor convenience property for the <a href="Base.html#method_on">on</a> method.</dd> 38539 * <dt>after</dt> 38540 * <dd>An event name to listener function map, to register event listeners for the "after" moment of the event. 38541 * A constructor convenience property for the <a href="Base.html#method_after">after</a> method.</dd> 38542 * <dt>bubbleTargets</dt> 38543 * <dd>An object, or array of objects, to register as bubble targets for bubbled events fired by this instance. 38544 * A constructor convenience property for the <a href="EventTarget.html#method_addTarget">addTarget</a> method.</dd> 38545 * <dt>plugins</dt> 38546 * <dd>A plugin, or array of plugins to be plugged into the instance (see PluginHost's plug method for signature details). 38547 * A constructor convenience property for the <a href="Plugin.Host.html#method_plug">plug</a> method.</dd> 38548 * </dl> 38549 */ 38550 function Base() { 38551 BaseCore.apply(this, arguments); 38552 BaseObservable.apply(this, arguments); 38553 AttributeExtras.apply(this, arguments); 38554 } 38555 38556 /** 38557 * The list of properties which can be configured for 38558 * each attribute (e.g. setter, getter, writeOnce, readOnly etc.) 38559 * 38560 * @property _ATTR_CFG 38561 * @type Array 38562 * @static 38563 * @private 38564 */ 38565 Base._ATTR_CFG = BaseCore._ATTR_CFG.concat(BaseObservable._ATTR_CFG); 38566 38567 /** 38568 * The array of non-attribute configuration properties supported by this class. 38569 * 38570 * `Base` supports "on", "after", "plugins" and "bubbleTargets" properties, 38571 * which are not set up as attributes. 38572 * 38573 * This property is primarily required so that when 38574 * <a href="#property__allowAdHocAttrs">`_allowAdHocAttrs`</a> is enabled by 38575 * a class, non-attribute configurations don't get added as ad-hoc attributes. 38576 * 38577 * @property _NON_ATTRS_CFG 38578 * @type Array 38579 * @static 38580 * @private 38581 */ 38582 Base._NON_ATTRS_CFG = BaseCore._NON_ATTRS_CFG.concat(BaseObservable._NON_ATTRS_CFG); 38583 38584 /** 38585 * <p> 38586 * The string to be used to identify instances of 38587 * this class, for example in prefixing events. 38588 * </p> 38589 * <p> 38590 * Classes extending Base, should define their own
38591 * static NAME property, which should be camelCase by 38592 * convention (e.g. MyClass.NAME = "myClass";). 38593 * </p> 38594 * @property NAME 38595 * @type String 38596 * @static 38597 */ 38598 Base.NAME = 'base'; 38599 38600 /** 38601 * The default set of attributes which will be available for instances of this class, and 38602 * their configuration. In addition to the configuration properties listed by 38603 * Attribute's <a href="Attribute.html#method_addAttr">addAttr</a> method, the attribute 38604 * can also be configured with a "cloneDefaultValue" property, which defines how the statically 38605 * defined value field should be protected ("shallow", "deep" and false are supported values). 38606 * 38607 * By default if the value is an object literal or an array it will be "shallow" cloned, to 38608 * protect the default value. 38609 * 38610 * @property ATTRS 38611 * @type Object 38612 * @static 38613 */ 38614 Base.ATTRS = AttributeCore.protectAttrs(BaseCore.ATTRS); 38615 38616 /** 38617 Provides a way to safely modify a `Y.Base` subclass' static `ATTRS` after 38618 the class has been defined or created. 38619 38620 Base-based classes cache information about the class hierarchy in order to 38621 efficiently create instances. This cache includes includes the aggregated 38622 `ATTRS` configs. If the static `ATTRS` configs need to be modified after the 38623 class has been defined or create, then use this method which will make sure 38624 to clear any cached data before making any modifications. 38625 38626 @method modifyAttrs 38627 @param {Function} [ctor] The constructor function whose `ATTRS` should be 38628 modified. If a `ctor` function is not specified, then `this` is assumed 38629 to be the constructor which hosts the `ATTRS`. 38630 @param {Object} configs The collection of `ATTRS` configs to mix with the 38631 existing attribute configurations. 38632 @static 38633 @since 3.10.0 38634 **/ 38635 Base.modifyAttrs = BaseCore.modifyAttrs; 38636 38637 Y.mix(Base, BaseCore, false, null, 1); 38638 Y.mix(Base, AttributeExtras, false, null, 1); 38639 38640 // Needs to be `true`, to overwrite methods from `BaseCore`. 38641 Y.mix(Base, BaseObservable, true, null, 1); 38642 38643 // Fix constructor 38644 Base.prototype.constructor = Base; 38645 38646 Y.Base = Base; 38647 38648 38649}, 'patched-v3.18.1', {"requires": ["attribute-base", "base-core", "base-observable"]}); 38650 38651YUI.add('base-pluginhost', function (Y, NAME) { 38652 38653 /** 38654 * The base-pluginhost submodule adds Plugin support to Base, by augmenting Base with 38655 * Plugin.Host and setting up static (class level) Base.plug and Base.unplug methods. 38656 * 38657 * @module base 38658 * @submodule base-pluginhost 38659 * @for Base 38660 */ 38661 38662 var Base = Y.Base, 38663 PluginHost = Y.Plugin.Host; 38664 38665 Y.mix(Base, PluginHost, false, null, 1); 38666 38667 /** 38668 * Alias for <a href="Plugin.Host.html#method_Plugin.Host.plug">Plugin.Host.plug</a>. See aliased 38669 * method for argument and return value details. 38670 * 38671 * @method plug 38672 * @static 38673 */ 38674 Base.plug = PluginHost.plug; 38675 38676 /** 38677 * Alias for <a href="Plugin.Host.html#method_Plugin.Host.unplug">Plugin.Host.unplug</a>. See the 38678 * aliased method for argument and return value details. 38679 * 38680 * @method unplug 38681 * @static 38682 */ 38683 Base.unplug = PluginHost.unplug; 38684 38685 38686}, 'patched-v3.18.1', {"requires": ["base-base", "pluginhost"]}); 38687 38688YUI.add('classnamemanager', function (Y, NAME) { 38689 38690/** 38691* Contains a singleton (ClassNameManager) that enables easy creation and caching of 38692* prefixed class names. 38693* @module classnamemanager 38694*/ 38695 38696/** 38697 * A singleton class providing: 38698 * 38699 * <ul> 38700 * <li>Easy creation of prefixed class names</li> 38701 * <li>Caching of previously created class names for improved performance.</li> 38702 * </ul> 38703 * 38704 * @class ClassNameManager 38705 * @static 38706 */ 38707 38708// String constants 38709var CLASS_NAME_PREFIX = 'classNamePrefix', 38710 CLASS_NAME_DELIMITER = 'classNameDelimiter', 38711 CONFIG = Y.config; 38712 38713// Global config 38714 38715/** 38716 * Configuration property indicating the prefix for all CSS class names in this YUI instance. 38717 * 38718 * @property classNamePrefix 38719 * @type {String} 38720 * @default "yui" 38721 * @static 38722 */ 38723CONFIG[CLASS_NAME_PREFIX] = CONFIG[CLASS_NAME_PREFIX] || 'yui3'; 38724 38725/** 38726 * Configuration property indicating the delimiter used to compose all CSS class names in 38727 * this YUI instance. 38728 * 38729 * @property classNameDelimiter 38730 * @type {String} 38731 * @default "-" 38732 * @static 38733 */ 38734CONFIG[CLASS_NAME_DELIMITER] = CONFIG[CLASS_NAME_DELIMITER] || '-'; 38735 38736Y.ClassNameManager = function () { 38737 38738 var sPrefix = CONFIG[CLASS_NAME_PREFIX], 38739 sDelimiter = CONFIG[CLASS_NAME_DELIMITER]; 38740 38741 return { 38742 38743 /** 38744 * Returns a class name prefixed with the value of the 38745 * <code>Y.config.classNamePrefix</code> attribute + the provided strings. 38746 * Uses the <code>Y.config.classNameDelimiter</code> attribute to delimit the 38747 * provided strings. E.g. Y.ClassNameManager.getClassName('foo','bar'); // yui-foo-bar 38748 * 38749 * @method getClassName 38750 * @param {String} [classnameSection*] one or more classname sections to be joined 38751 * @param {Boolean} skipPrefix If set to true, the classname will not be prefixed with the default Y.config.classNameDelimiter value. 38752 */ 38753 getClassName: Y.cached(function () { 38754 38755 var args = Y.Array(arguments); 38756 38757 if (args[args.length-1] !== true) { 38758 args.unshift(sPrefix); 38759 } else { 38760 args.pop(); 38761 } 38762 38763 return args.join(sDelimiter); 38764 }) 38765 38766 }; 38767 38768}(); 38769 38770 38771}, 'patched-v3.18.1', {"requires": ["yui-base"]}); 38772 38773YUI.add('datatype-xml-format', function (Y, NAME) { 38774 38775/** 38776 * The Number Utility provides type-conversion and string-formatting 38777 * convenience methods for Numbers. 38778 * 38779 * @module datatype-xml 38780 * @submodule datatype-xml-format 38781 */ 38782 38783/** 38784 * XML provides a set of utility functions to operate against XML documents. 38785 * 38786 * @class XML 38787 * @static 38788 */ 38789var LANG = Y.Lang; 38790 38791Y.mix(Y.namespace("XML"), { 38792 /** 38793 * Converts data to type XMLDocument. 38794 * 38795 * @method format 38796 * @param data {XMLDocument} Data to convert. 38797 * @return {String} String. 38798 */ 38799 format: function(data) { 38800 try { 38801 if(!LANG.isUndefined(data.getXml)) { 38802 return data.getXml(); 38803 } 38804 38805 if(!LANG.isUndefined(XMLSerializer)) { 38806 return (new XMLSerializer()).serializeToString(data); 38807 } 38808 } 38809 catch(e) { 38810 if(data && data.xml) { 38811 return data.xml; 38812 } 38813 else { 38814 return (LANG.isValue(data) && data.toString) ? data.toString() : ""; 38815 } 38816 } 38817 } 38818}); 38819 38820Y.namespace("DataType"); 38821Y.DataType.XML = Y.XML; 38822 38823 38824}, 'patched-v3.18.1'); 38825 38826YUI.add('datatype-xml-parse', function (Y, NAME) { 38827 38828/** 38829 * Parse XML submodule. 38830 * 38831 * @module datatype-xml 38832 * @submodule datatype-xml-parse 38833 * @for XML 38834 */ 38835 38836Y.mix(Y.namespace("XML"), { 38837 /** 38838 * Converts data to type XMLDocument. 38839 * 38840 * @method parse 38841 * @param data {String} Data to convert. 38842 * @return {XMLDocument} XML Document. 38843 */ 38844 parse: function(data) { 38845 var xmlDoc = null, win; 38846 if (typeof data === "string") { 38847 win = Y.config.win; 38848 if (win.ActiveXObject !== undefined) { 38849 xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); 38850 xmlDoc.async = false;
38851 xmlDoc.loadXML(data); 38852 } else if (win.DOMParser !== undefined) { 38853 xmlDoc = new DOMParser().parseFromString(data, "text/xml"); 38854 } else if (win.Windows !== undefined) { 38855 xmlDoc = new Windows.Data.Xml.Dom.XmlDocument(); 38856 xmlDoc.loadXml(data); 38857 } 38858 } 38859 38860 if (xmlDoc === null || xmlDoc.documentElement === null || xmlDoc.documentElement.nodeName === "parsererror") { 38861 } 38862 38863 return xmlDoc; 38864 } 38865}); 38866 38867// Add Parsers shortcut 38868Y.namespace("Parsers").xml = Y.XML.parse; 38869 38870Y.namespace("DataType"); 38871Y.DataType.XML = Y.XML; 38872 38873 38874}, 'patched-v3.18.1'); 38875 38876YUI.add('dom-base', function (Y, NAME) { 38877 38878/** 38879* @for DOM 38880* @module dom 38881*/ 38882var documentElement = Y.config.doc.documentElement, 38883 Y_DOM = Y.DOM, 38884 TAG_NAME = 'tagName', 38885 OWNER_DOCUMENT = 'ownerDocument', 38886 EMPTY_STRING = '', 38887 addFeature = Y.Features.add, 38888 testFeature = Y.Features.test; 38889 38890Y.mix(Y_DOM, { 38891 /** 38892 * Returns the text content of the HTMLElement. 38893 * @method getText 38894 * @param {HTMLElement} element The html element. 38895 * @return {String} The text content of the element (includes text of any descending elements). 38896 */ 38897 getText: (documentElement.textContent !== undefined) ? 38898 function(element) { 38899 var ret = ''; 38900 if (element) { 38901 ret = element.textContent; 38902 } 38903 return ret || ''; 38904 } : function(element) { 38905 var ret = ''; 38906 if (element) { 38907 ret = element.innerText || element.nodeValue; // might be a textNode 38908 } 38909 return ret || ''; 38910 }, 38911 38912 /** 38913 * Sets the text content of the HTMLElement. 38914 * @method setText 38915 * @param {HTMLElement} element The html element. 38916 * @param {String} content The content to add. 38917 */ 38918 setText: (documentElement.textContent !== undefined) ? 38919 function(element, content) { 38920 if (element) { 38921 element.textContent = content; 38922 } 38923 } : function(element, content) { 38924 if ('innerText' in element) { 38925 element.innerText = content; 38926 } else if ('nodeValue' in element) { 38927 element.nodeValue = content; 38928 } 38929 }, 38930 38931 CUSTOM_ATTRIBUTES: (!documentElement.hasAttribute) ? { // IE < 8 38932 'for': 'htmlFor', 38933 'class': 'className' 38934 } : { // w3c 38935 'htmlFor': 'for', 38936 'className': 'class' 38937 }, 38938 38939 /** 38940 * Provides a normalized attribute interface. 38941 * @method setAttribute 38942 * @param {HTMLElement} el The target element for the attribute. 38943 * @param {String} attr The attribute to set. 38944 * @param {String} val The value of the attribute. 38945 */ 38946 setAttribute: function(el, attr, val, ieAttr) { 38947 if (el && attr && el.setAttribute) { 38948 attr = Y_DOM.CUSTOM_ATTRIBUTES[attr] || attr; 38949 el.setAttribute(attr, val, ieAttr); 38950 } 38951 }, 38952 38953 38954 /** 38955 * Provides a normalized attribute interface. 38956 * @method getAttribute 38957 * @param {HTMLElement} el The target element for the attribute. 38958 * @param {String} attr The attribute to get. 38959 * @return {String} The current value of the attribute. 38960 */ 38961 getAttribute: function(el, attr, ieAttr) { 38962 ieAttr = (ieAttr !== undefined) ? ieAttr : 2; 38963 var ret = ''; 38964 if (el && attr && el.getAttribute) { 38965 attr = Y_DOM.CUSTOM_ATTRIBUTES[attr] || attr; 38966 // BUTTON value issue for IE < 8 38967 ret = (el.tagName === "BUTTON" && attr === 'value') ? Y_DOM.getValue(el) : el.getAttribute(attr, ieAttr); 38968 38969 if (ret === null) { 38970 ret = ''; // per DOM spec 38971 } 38972 } 38973 return ret; 38974 }, 38975 38976 VALUE_SETTERS: {}, 38977 38978 VALUE_GETTERS: {}, 38979 38980 getValue: function(node) { 38981 var ret = '', // TODO: return null? 38982 getter; 38983 38984 if (node && node[TAG_NAME]) { 38985 getter = Y_DOM.VALUE_GETTERS[node[TAG_NAME].toLowerCase()]; 38986 38987 if (getter) { 38988 ret = getter(node); 38989 } else { 38990 ret = node.value; 38991 } 38992 } 38993 38994 // workaround for IE8 JSON stringify bug 38995 // which converts empty string values to null 38996 if (ret === EMPTY_STRING) { 38997 ret = EMPTY_STRING; // for real 38998 } 38999 39000 return (typeof ret === 'string') ? ret : ''; 39001 }, 39002 39003 setValue: function(node, val) { 39004 var setter; 39005 39006 if (node && node[TAG_NAME]) { 39007 setter = Y_DOM.VALUE_SETTERS[node[TAG_NAME].toLowerCase()]; 39008 val = (val === null) ? '' : val; 39009 if (setter) { 39010 setter(node, val); 39011 } else { 39012 node.value = val; 39013 } 39014 } 39015 }, 39016 39017 creators: {} 39018}); 39019 39020addFeature('value-set', 'select', { 39021 test: function() { 39022 var node = Y.config.doc.createElement('select'); 39023 node.innerHTML = '<option>1</option><option>2</option>'; 39024 node.value = '2'; 39025 return (node.value && node.value === '2'); 39026 } 39027}); 39028
39029if (!testFeature('value-set', 'select')) { 39030 Y_DOM.VALUE_SETTERS.select = function(node, val) { 39031 for (var i = 0, options = node.getElementsByTagName('option'), option; 39032 option = options[i++];) { 39033 if (Y_DOM.getValue(option) === val) { 39034 option.selected = true; 39035 //Y_DOM.setAttribute(option, 'selected', 'selected'); 39036 break; 39037 } 39038 } 39039 }; 39040} 39041 39042Y.mix(Y_DOM.VALUE_GETTERS, { 39043 button: function(node) { 39044 return (node.attributes && node.attributes.value) ? node.attributes.value.value : ''; 39045 } 39046}); 39047 39048Y.mix(Y_DOM.VALUE_SETTERS, { 39049 // IE: node.value changes the button text, which should be handled via innerHTML 39050 button: function(node, val) { 39051 var attr = node.attributes.value; 39052 if (!attr) { 39053 attr = node[OWNER_DOCUMENT].createAttribute('value'); 39054 node.setAttributeNode(attr); 39055 } 39056 39057 attr.value = val; 39058 } 39059}); 39060 39061 39062Y.mix(Y_DOM.VALUE_GETTERS, { 39063 option: function(node) { 39064 var attrs = node.attributes; 39065 return (attrs.value && attrs.value.specified) ? node.value : node.text; 39066 }, 39067 39068 select: function(node) { 39069 var val = node.value, 39070 options = node.options; 39071 39072 if (options && options.length) { 39073 // TODO: implement multipe select 39074 if (node.multiple) { 39075 } else if (node.selectedIndex > -1) { 39076 val = Y_DOM.getValue(options[node.selectedIndex]); 39077 } 39078 } 39079 39080 return val; 39081 } 39082}); 39083var addClass, hasClass, removeClass; 39084 39085Y.mix(Y.DOM, { 39086 /** 39087 * Determines whether a DOM element has the given className. 39088 * @method hasClass 39089 * @for DOM 39090 * @param {HTMLElement} element The DOM element. 39091 * @param {String} className the class name to search for 39092 * @return {Boolean} Whether or not the element has the given class. 39093 */ 39094 hasClass: function(node, className) { 39095 var re = Y.DOM._getRegExp('(?:^|\\s+)' + className + '(?:\\s+|$)'); 39096 return re.test(node.className); 39097 }, 39098 39099 /** 39100 * Adds a class name to a given DOM element. 39101 * @method addClass 39102 * @for DOM 39103 * @param {HTMLElement} element The DOM element. 39104 * @param {String} className the class name to add to the class attribute 39105 */ 39106 addClass: function(node, className) { 39107 if (!Y.DOM.hasClass(node, className)) { // skip if already present 39108 node.className = Y.Lang.trim([node.className, className].join(' ')); 39109 } 39110 }, 39111 39112 /** 39113 * Removes a class name from a given element. 39114 * @method removeClass 39115 * @for DOM 39116 * @param {HTMLElement} element The DOM element. 39117 * @param {String} className the class name to remove from the class attribute 39118 */ 39119 removeClass: function(node, className) { 39120 if (className && hasClass(node, className)) { 39121 node.className = Y.Lang.trim(node.className.replace(Y.DOM._getRegExp('(?:^|\\s+)' + 39122 className + '(?:\\s+|$)'), ' ')); 39123 39124 if ( hasClass(node, className) ) { // in case of multiple adjacent 39125 removeClass(node, className); 39126 } 39127 } 39128 }, 39129 39130 /** 39131 * Replace a class with another class for a given element. 39132 * If no oldClassName is present, the newClassName is simply added. 39133 * @method replaceClass 39134 * @for DOM 39135 * @param {HTMLElement} element The DOM element 39136 * @param {String} oldClassName the class name to be replaced 39137 * @param {String} newClassName the class name that will be replacing the old class name 39138 */ 39139 replaceClass: function(node, oldC, newC) { 39140 removeClass(node, oldC); // remove first in case oldC === newC 39141 addClass(node, newC); 39142 }, 39143 39144 /** 39145 * If the className exists on the node it is removed, if it doesn't exist it is added. 39146 * @method toggleClass 39147 * @for DOM 39148 * @param {HTMLElement} element The DOM element 39149 * @param {String} className the class name to be toggled 39150 * @param {Boolean} addClass optional boolean to indicate whether class 39151 * should be added or removed regardless of current state 39152 */ 39153 toggleClass: function(node, className, force) { 39154 var add = (force !== undefined) ? force : 39155 !(hasClass(node, className)); 39156 39157 if (add) { 39158 addClass(node, className); 39159 } else { 39160 removeClass(node, className); 39161 } 39162 } 39163}); 39164 39165hasClass = Y.DOM.hasClass; 39166removeClass = Y.DOM.removeClass; 39167addClass = Y.DOM.addClass; 39168 39169var re_tag = /<([a-z]+)/i, 39170 39171 Y_DOM = Y.DOM, 39172 39173 addFeature = Y.Features.add, 39174 testFeature = Y.Features.test, 39175 39176 creators = {}, 39177 39178 createFromDIV = function(html, tag) { 39179 var div = Y.config.doc.createElement('div'), 39180 ret = true; 39181 39182 div.innerHTML = html; 39183 if (!div.firstChild || div.firstChild.tagName !== tag.toUpperCase()) { 39184 ret = false;
39185 } 39186 39187 return ret; 39188 }, 39189 39190 re_tbody = /(?:\/(?:thead|tfoot|tbody|caption|col|colgroup)>)+\s*<tbody/, 39191 39192 TABLE_OPEN = '<table>', 39193 TABLE_CLOSE = '</table>', 39194 39195 selectedIndex; 39196 39197Y.mix(Y.DOM, { 39198 _fragClones: {}, 39199 39200 _create: function(html, doc, tag) { 39201 tag = tag || 'div'; 39202 39203 var frag = Y_DOM._fragClones[tag]; 39204 if (frag) { 39205 frag = frag.cloneNode(false); 39206 } else { 39207 frag = Y_DOM._fragClones[tag] = doc.createElement(tag); 39208 } 39209 frag.innerHTML = html; 39210 return frag; 39211 }, 39212 39213 _children: function(node, tag) { 39214 var i = 0, 39215 children = node.children, 39216 childNodes, 39217 hasComments, 39218 child; 39219 39220 if (children && children.tags) { // use tags filter when possible 39221 if (tag) { 39222 children = node.children.tags(tag); 39223 } else { // IE leaks comments into children 39224 hasComments = children.tags('!').length; 39225 } 39226 } 39227 39228 if (!children || (!children.tags && tag) || hasComments) { 39229 childNodes = children || node.childNodes; 39230 children = []; 39231 while ((child = childNodes[i++])) { 39232 if (child.nodeType === 1) { 39233 if (!tag || tag === child.tagName) { 39234 children.push(child); 39235 } 39236 } 39237 } 39238 } 39239 39240 return children || []; 39241 }, 39242 39243 /** 39244 * Creates a new dom node using the provided markup string. 39245 * @method create 39246 * @param {String} html The markup used to create the element 39247 * @param {HTMLDocument} doc An optional document context 39248 * @return {HTMLElement|DocumentFragment} returns a single HTMLElement 39249 * when creating one node, and a documentFragment when creating 39250 * multiple nodes. 39251 */ 39252 create: function(html, doc) { 39253 if (typeof html === 'string') { 39254 html = Y.Lang.trim(html); // match IE which trims whitespace from innerHTML 39255 39256 } 39257 39258 doc = doc || Y.config.doc; 39259 var m = re_tag.exec(html), 39260 create = Y_DOM._create, 39261 custom = creators, 39262 ret = null, 39263 creator, tag, node, nodes; 39264 39265 if (html != undefined) { // not undefined or null 39266 if (m && m[1]) { 39267 creator = custom[m[1].toLowerCase()]; 39268 if (typeof creator === 'function') { 39269 create = creator; 39270 } else { 39271 tag = creator; 39272 } 39273 } 39274 39275 node = create(html, doc, tag); 39276 nodes = node.childNodes; 39277 39278 if (nodes.length === 1) { // return single node, breaking parentNode ref from "fragment" 39279 ret = node.removeChild(nodes[0]); 39280 } else if (nodes[0] && nodes[0].className === 'yui3-big-dummy') { // using dummy node to preserve some attributes (e.g. OPTION not selected) 39281 selectedIndex = node.selectedIndex; 39282 39283 if (nodes.length === 2) { 39284 ret = nodes[0].nextSibling; 39285 } else { 39286 node.removeChild(nodes[0]); 39287 ret = Y_DOM._nl2frag(nodes, doc); 39288 } 39289 } else { // return multiple nodes as a fragment 39290 ret = Y_DOM._nl2frag(nodes, doc); 39291 } 39292 39293 } 39294 39295 return ret; 39296 }, 39297 39298 _nl2frag: function(nodes, doc) { 39299 var ret = null, 39300 i, len; 39301 39302 if (nodes && (nodes.push || nodes.item) && nodes[0]) { 39303 doc = doc || nodes[0].ownerDocument; 39304 ret = doc.createDocumentFragment(); 39305 39306 if (nodes.item) { // convert live list to static array 39307 nodes = Y.Array(nodes, 0, true); 39308 } 39309 39310 for (i = 0, len = nodes.length; i < len; i++) { 39311 ret.appendChild(nodes[i]); 39312 } 39313 } // else inline with log for minification 39314 return ret; 39315 }, 39316 39317 /** 39318 * Inserts content in a node at the given location 39319 * @method addHTML 39320 * @param {HTMLElement} node The node to insert into 39321 * @param {HTMLElement | Array | HTMLCollection} content The content to be inserted 39322 * @param {HTMLElement} where Where to insert the content 39323 * If no "where" is given, content is appended to the node 39324 * Possible values for "where" 39325 * <dl> 39326 * <dt>HTMLElement</dt> 39327 * <dd>The element to insert before</dd> 39328 * <dt>"replace"</dt> 39329 * <dd>Replaces the existing HTML</dd> 39330 * <dt>"before"</dt> 39331 * <dd>Inserts before the existing HTML</dd> 39332 * <dt>"before"</dt> 39333 * <dd>Inserts content before the node</dd> 39334 * <dt>"after"</dt> 39335 * <dd>Inserts content after the node</dd> 39336 * </dl> 39337 */ 39338 addHTML: function(node, content, where) { 39339 var nodeParent = node.parentNode, 39340 i = 0, 39341 item, 39342 ret = content, 39343 newNode; 39344 39345 39346 if (content != undefined) { // not null or undefined (maybe 0) 39347 if (content.nodeType) { // DOM node, just add it 39348 newNode = content; 39349 } else if (typeof content == 'string' || typeof content == 'number') { 39350 ret = newNode = Y_DOM.create(content); 39351 } else if (content[0] && content[0].nodeType) { // array or collection 39352 newNode = Y.config.doc.createDocumentFragment(); 39353 while ((item = content[i++])) { 39354 newNode.appendChild(item); // append to fragment for insertion 39355 } 39356 } 39357 } 39358 39359 if (where) { 39360 if (newNode && where.parentNode) { // insert regardless of relationship to node 39361 where.parentNode.insertBefore(newNode, where); 39362 } else { 39363 switch (where) { 39364 case 'replace': 39365 while (node.firstChild) { 39366 node.removeChild(node.firstChild); 39367 } 39368 if (newNode) { // allow empty content to clear node 39369 node.appendChild(newNode); 39370 } 39371 break; 39372 case 'before': 39373 if (newNode) { 39374 nodeParent.insertBefore(newNode, node); 39375 } 39376 break; 39377 case 'after': 39378 if (newNode) { 39379 if (node.nextSibling) { // IE errors if refNo
39379de is null 39380 nodeParent.insertBefore(newNode, node.nextSibling); 39381 } else { 39382 nodeParent.appendChild(newNode); 39383 } 39384 } 39385 break; 39386 default: 39387 if (newNode) { 39388 node.appendChild(newNode); 39389 } 39390 } 39391 } 39392 } else if (newNode) { 39393 node.appendChild(newNode); 39394 } 39395 39396 // `select` elements are the only elements with `selectedIndex`. 39397 // Don't grab the dummy `option` element's `selectedIndex`. 39398 if (node.nodeName == "SELECT" && selectedIndex > 0) { 39399 node.selectedIndex = selectedIndex - 1; 39400 } 39401 39402 return ret; 39403 }, 39404 39405 wrap: function(node, html) { 39406 var parent = (html && html.nodeType) ? html : Y.DOM.create(html), 39407 nodes = parent.getElementsByTagName('*'); 39408 39409 if (nodes.length) { 39410 parent = nodes[nodes.length - 1]; 39411 } 39412 39413 if (node.parentNode) { 39414 node.parentNode.replaceChild(parent, node); 39415 } 39416 parent.appendChild(node); 39417 }, 39418 39419 unwrap: function(node) { 39420 var parent = node.parentNode, 39421 lastChild = parent.lastChild, 39422 next = node, 39423 grandparent; 39424 39425 if (parent) { 39426 grandparent = parent.parentNode; 39427 if (grandparent) { 39428 node = parent.firstChild; 39429 while (node !== lastChild) { 39430 next = node.nextSibling; 39431 grandparent.insertBefore(node, parent); 39432 node = next; 39433 } 39434 grandparent.replaceChild(lastChild, parent); 39435 } else { 39436 parent.removeChild(node); 39437 } 39438 } 39439 } 39440}); 39441 39442addFeature('innerhtml', 'table', { 39443 test: function() { 39444 var node = Y.config.doc.createElement('table'); 39445 try { 39446 node.innerHTML = '<tbody></tbody>'; 39447 } catch(e) { 39448 return false; 39449 } 39450 return (node.firstChild && node.firstChild.nodeName === 'TBODY'); 39451 } 39452}); 39453 39454addFeature('innerhtml-div', 'tr', { 39455 test: function() { 39456 return createFromDIV('<tr></tr>', 'tr'); 39457 } 39458}); 39459 39460addFeature('innerhtml-div', 'script', { 39461 test: function() { 39462 return createFromDIV('<script></script>', 'script'); 39463 } 39464}); 39465 39466if (!testFeature('innerhtml', 'table')) { 39467 // TODO: thead/tfoot with nested tbody 39468 // IE adds TBODY when creating TABLE elements (which may share this impl) 39469 creators.tbody = function(html, doc) { 39470 var frag = Y_DOM.create(TABLE_OPEN + html + TABLE_CLOSE, doc), 39471 tb = Y.DOM._children(frag, 'tbody')[0]; 39472 39473 if (frag.children.length > 1 && tb && !re_tbody.test(html)) { 39474 tb.parentNode.removeChild(tb); // strip extraneous tbody 39475 } 39476 return frag; 39477 }; 39478} 39479 39480if (!testFeature('innerhtml-div', 'script')) { 39481 creators.script = function(html, doc) { 39482 var frag = doc.createElement('div'); 39483 39484 frag.innerHTML = '-' + html; 39485 frag.removeChild(frag.firstChild); 39486 return frag; 39487 }; 39488 39489 creators.link = creators.style = creators.script; 39490} 39491 39492if (!testFeature('innerhtml-div', 'tr')) { 39493 Y.mix(creators, { 39494 option: function(html, doc) { 39495 return Y_DOM.create('<select><option class="yui3-big-dummy" selected></option>' + html + '</select>', doc); 39496 }, 39497 39498 tr: function(html, doc) { 39499 return Y_DOM.create('<tbody>' + html + '</tbody>', doc); 39500 }, 39501 39502 td: function(html, doc) { 39503 return Y_DOM.create('<tr>' + html + '</tr>', doc); 39504 }, 39505 39506 col: function(html, doc) { 39507 return Y_DOM.create('<colgroup>' + html + '</colgroup>', doc); 39508 }, 39509 39510 tbody: 'table' 39511 }); 39512 39513 Y.mix(creators, { 39514 legend: 'fieldset', 39515 th: creators.td, 39516 thead: creators.tbody, 39517 tfoot: creators.tbody, 39518 caption: creators.tbody, 39519 colgroup: creators.tbody, 39520 optgroup: creators.option 39521 }); 39522} 39523 39524Y_DOM.creators = creators; 39525Y.mix(Y.DOM, { 39526 /** 39527 * Sets the width of the element to the given size, regardless 39528 * of box model, border, padding, etc. 39529 * @method setWidth 39530 * @param {HTMLElement} element The DOM element. 39531 * @param {String|Number} size The pixel height to size to 39532 */ 39533 39534 setWidth: function(node, size) { 39535 Y.DOM._setSize(node, 'width', size); 39536 }, 39537 39538 /** 39539 * Sets the height of the element to the given size, regardless 39540 * of box model, border, padding, etc. 39541 * @method setHeight 39542 * @param {HTMLElement} element The DOM element. 39543 * @param {String|Number} size The pixel height to size to 39544 */ 39545 39546 setHeight: function(node, size) { 39547 Y.DOM._setSize(node, 'height', size); 39548 }, 39549 39550 _setSize: function(node, prop, val) { 39551 val = (val > 0) ? val : 0; 39552 var size = 0; 39553 39554 node.style[prop] = val + 'px'; 39555 size = (prop === 'height') ? node.offsetHeight : node.offsetWidth; 39556 39557 if (size > val) { 39558 val = val - (size - val); 39559 39560 if (val < 0) { 39561 val = 0; 39562 } 39563 39564 node.style[prop] = val + 'px'; 39565 } 39566 } 39567}); 39568 39569 39570}, 'patched-v3.18.1', {"requires": ["dom-core"]}); 39571 39572YUI.add('dom-core', function (Y, NAME) { 39573 39574var NODE_TYPE = 'nodeType', 39575 OWNER_DOCUMENT = 'ownerDocument', 39576 DOCUMENT_ELEMENT = 'documentElement', 39577 DEFAULT_VIEW = 'defaultView', 39578 PARENT_WINDOW = 'parentWindow', 39579 TAG_NAME = 'tagName', 39580 PARENT_NODE = 'parentNode', 39581 PREVIOUS_SIBLING = 'previousSibling', 39582 NEXT_SIBLING = 'nextSibling', 39583 CONTAINS = 'contains', 39584 COMPARE_DOCUMENT_POSITION = 'compareDocumentPosition', 39585 EMPTY_ARRAY = [], 39586 39587 // IE < 8 throws on node.contains(textNode) 39588 supportsContainsTextNode = (function() { 39589 var node = Y.config.doc.createElement('div'), 39590 textNode = node.appendChild(Y.config.doc.createTextNode('')), 39591 result = false;
39592 39593 try { 39594 result = node.contains(textNode); 39595 } catch(e) {} 39596 39597 return result; 39598 })(), 39599 39600/** 39601 * The DOM utility provides a cross-browser abtraction layer 39602 * normalizing DOM tasks, and adds extra helper functionality 39603 * for other common tasks. 39604 * @module dom 39605 * @main dom 39606 * @submodule dom-base 39607 * @for DOM 39608 * 39609 */ 39610 39611/** 39612 * Provides DOM helper methods. 39613 * @class DOM 39614 * 39615 */ 39616 39617Y_DOM = { 39618 /** 39619 * Returns the HTMLElement with the given ID (Wrapper for document.getElementById). 39620 * @method byId 39621 * @param {String} id the id attribute 39622 * @param {Object} doc optional The document to search. Defaults to current document 39623 * @return {HTMLElement | null} The HTMLElement with the id, or null if none found. 39624 */ 39625 byId: function(id, doc) { 39626 // handle dupe IDs and IE name collision 39627 return Y_DOM.allById(id, doc)[0] || null; 39628 }, 39629 39630 getId: function(node) { 39631 var id; 39632 // HTMLElement returned from FORM when INPUT name === "id" 39633 // IE < 8: HTMLCollection returned when INPUT id === "id" 39634 // via both getAttribute and form.id 39635 if (node.id && !node.id.tagName && !node.id.item) { 39636 id = node.id; 39637 } else if (node.attributes && node.attributes.id) { 39638 id = node.attributes.id.value; 39639 } 39640 39641 return id; 39642 }, 39643 39644 setId: function(node, id) { 39645 if (node.setAttribute) { 39646 node.setAttribute('id', id); 39647 } else { 39648 node.id = id; 39649 } 39650 }, 39651 39652 /* 39653 * Finds the ancestor of the element. 39654 * @method ancestor 39655 * @param {HTMLElement} element The html element. 39656 * @param {Function} fn optional An optional boolean test to apply. 39657 * The optional function is passed the current DOM node being tested as its only argument. 39658 * If no function is given, the parentNode is returned. 39659 * @param {Boolean} testSelf optional Whether or not to include the element in the scan 39660 * @return {HTMLElement | null} The matching DOM node or null if none found. 39661 */ 39662 ancestor: function(element, fn, testSelf, stopFn) { 39663 var ret = null; 39664 if (testSelf) { 39665 ret = (!fn || fn(element)) ? element : null; 39666 39667 } 39668 return ret || Y_DOM.elementByAxis(element, PARENT_NODE, fn, null, stopFn); 39669 }, 39670 39671 /* 39672 * Finds the ancestors of the element. 39673 * @method ancestors 39674 * @param {HTMLElement} element The html element. 39675 * @param {Function} fn optional An optional boolean test to apply. 39676 * The optional function is passed the current DOM node being tested as its only argument. 39677 * If no function is given, all ancestors are returned. 39678 * @param {Boolean} testSelf optional Whether or not to include the element in the scan 39679 * @return {Array} An array containing all matching DOM nodes. 39680 */ 39681 ancestors: function(element, fn, testSelf, stopFn) { 39682 var ancestor = element, 39683 ret = []; 39684 39685 while ((ancestor = Y_DOM.ancestor(ancestor, fn, testSelf, stopFn))) { 39686 testSelf = false; 39687 if (ancestor) { 39688 ret.unshift(ancestor); 39689 39690 if (stopFn && stopFn(ancestor)) { 39691 return ret; 39692 } 39693 } 39694 } 39695 39696 return ret; 39697 }, 39698 39699 /** 39700 * Searches the element by the given axis for the first matching element. 39701 * @method elementByAxis 39702 * @param {HTMLElement} element The html element. 39703 * @param {String} axis The axis to search (parentNode, nextSibling, previousSibling). 39704 * @param {Function} [fn] An optional boolean test to apply. 39705 * @param {Boolean} [all] Whether text nodes as well as element nodes should be returned, or 39706 * just element nodes will be returned(default) 39707 * The optional function is passed the current HTMLElement being tested as its only argument. 39708 * If no function is given, the first element is returned. 39709 * @return {HTMLElement | null} The matching element or null if none found. 39710 */ 39711 elementByAxis: function(element, axis, fn, all, stopAt) { 39712 while (element && (element = element[axis])) { // NOTE: assignment 39713 if ( (all || element[TAG_NAME]) && (!fn || fn(element)) ) { 39714 return element; 39715 } 39716 39717 if (stopAt && stopAt(element)) { 39718 return null; 39719 } 39720 } 39721 return null; 39722 }, 39723 39724 /** 39725 * Determines whether or not one HTMLElement is or contains another HTMLElement. 39726 * @method contains 39727 * @param {HTMLElement} element The containing html element. 39728 * @param {HTMLElement} needle The html element that may be contained. 39729 * @return {Boolean} Whether or not the element is or contains the needle. 39730 */ 39731 contains: function(element, needle) { 39732 var ret = false;
39733 39734 if ( !needle || !element || !needle[NODE_TYPE] || !element[NODE_TYPE]) { 39735 ret = false; 39736 } else if (element[CONTAINS] && 39737 // IE < 8 throws on node.contains(textNode) so fall back to brute. 39738 // Falling back for other nodeTypes as well. 39739 (needle[NODE_TYPE] === 1 || supportsContainsTextNode)) { 39740 ret = element[CONTAINS](needle); 39741 } else if (element[COMPARE_DOCUMENT_POSITION]) { 39742 // Match contains behavior (node.contains(node) === true). 39743 // Needed for Firefox < 4. 39744 if (element === needle || !!(element[COMPARE_DOCUMENT_POSITION](needle) & 16)) { 39745 ret = true; 39746 } 39747 } else { 39748 ret = Y_DOM._bruteContains(element, needle); 39749 } 39750 39751 return ret; 39752 }, 39753 39754 /** 39755 * Determines whether or not the HTMLElement is part of the document. 39756 * @method inDoc 39757 * @param {HTMLElement} element The containing html element. 39758 * @param {HTMLElement} doc optional The document to check. 39759 * @return {Boolean} Whether or not the element is attached to the document. 39760 */ 39761 inDoc: function(element, doc) { 39762 var ret = false, 39763 rootNode; 39764 39765 if (element && element.nodeType) { 39766 (doc) || (doc = element[OWNER_DOCUMENT]); 39767 39768 rootNode = doc[DOCUMENT_ELEMENT]; 39769 39770 // contains only works with HTML_ELEMENT 39771 if (rootNode && rootNode.contains && element.tagName) { 39772 ret = rootNode.contains(element); 39773 } else { 39774 ret = Y_DOM.contains(rootNode, element); 39775 } 39776 } 39777 39778 return ret; 39779 39780 }, 39781 39782 allById: function(id, root) { 39783 root = root || Y.config.doc; 39784 var nodes = [], 39785 ret = [], 39786 i, 39787 node; 39788 39789 if (root.querySelectorAll) { 39790 ret = root.querySelectorAll('[id="' + id + '"]'); 39791 } else if (root.all) { 39792 nodes = root.all(id); 39793 39794 if (nodes) { 39795 // root.all may return HTMLElement or HTMLCollection. 39796 // some elements are also HTMLCollection (FORM, SELECT). 39797 if (nodes.nodeName) { 39798 if (nodes.id === id) { // avoid false positive on name 39799 ret.push(nodes); 39800 nodes = EMPTY_ARRAY; // done, no need to filter 39801 } else { // prep for filtering 39802 nodes = [nodes]; 39803 } 39804 } 39805 39806 if (nodes.length) { 39807 // filter out matches on node.name 39808 // and element.id as reference to element with id === 'id' 39809 for (i = 0; node = nodes[i++];) { 39810 if (node.id === id || 39811 (node.attributes && node.attributes.id && 39812 node.attributes.id.value === id)) { 39813 ret.push(node); 39814 } 39815 } 39816 } 39817 } 39818 } else { 39819 ret = [Y_DOM._getDoc(root).getElementById(id)]; 39820 } 39821 39822 return ret; 39823 }, 39824 39825 39826 isWindow: function(obj) { 39827 return !!(obj && obj.scrollTo && obj.document); 39828 }, 39829 39830 _removeChildNodes: function(node) { 39831 while (node.firstChild) { 39832 node.removeChild(node.firstChild); 39833 } 39834 }, 39835 39836 siblings: function(node, fn) { 39837 var nodes = [], 39838 sibling = node; 39839 39840 while ((sibling = sibling[PREVIOUS_SIBLING])) { 39841 if (sibling[TAG_NAME] && (!fn || fn(sibling))) { 39842 nodes.unshift(sibling); 39843 } 39844 } 39845 39846 sibling = node; 39847 while ((sibling = sibling[NEXT_SIBLING])) { 39848 if (sibling[TAG_NAME] && (!fn || fn(sibling))) { 39849 nodes.push(sibling); 39850 } 39851 } 39852 39853 return nodes; 39854 }, 39855 39856 /** 39857 * Brute force version of contains. 39858 * Used for browsers without contains support for non-HTMLElement Nodes (textNodes, etc). 39859 * @method _bruteContains 39860 * @private 39861 * @param {HTMLElement} element The containing html element. 39862 * @param {HTMLElement} needle The html element that may be contained. 39863 * @return {Boolean} Whether or not the element is or contains the needle. 39864 */ 39865 _bruteContains: function(element, needle) { 39866 while (needle) { 39867 if (element === needle) { 39868 return true; 39869 } 39870 needle = needle.parentNode; 39871 } 39872 return false;
39873 }, 39874 39875// TODO: move to Lang? 39876 /** 39877 * Memoizes dynamic regular expressions to boost runtime performance. 39878 * @method _getRegExp 39879 * @private 39880 * @param {String} str The string to convert to a regular expression. 39881 * @param {String} flags optional An optinal string of flags. 39882 * @return {RegExp} An instance of RegExp 39883 */ 39884 _getRegExp: function(str, flags) { 39885 flags = flags || ''; 39886 Y_DOM._regexCache = Y_DOM._regexCache || {}; 39887 if (!Y_DOM._regexCache[str + flags]) { 39888 Y_DOM._regexCache[str + flags] = new RegExp(str, flags); 39889 } 39890 return Y_DOM._regexCache[str + flags]; 39891 }, 39892 39893// TODO: make getDoc/Win true privates? 39894 /** 39895 * returns the appropriate document. 39896 * @method _getDoc 39897 * @private 39898 * @param {HTMLElement} element optional Target element. 39899 * @return {Object} The document for the given element or the default document. 39900 */ 39901 _getDoc: function(element) { 39902 var doc = Y.config.doc; 39903 if (element) { 39904 doc = (element[NODE_TYPE] === 9) ? element : // element === document 39905 element[OWNER_DOCUMENT] || // element === DOM node 39906 element.document || // element === window 39907 Y.config.doc; // default 39908 } 39909 39910 return doc; 39911 }, 39912 39913 /** 39914 * returns the appropriate window. 39915 * @method _getWin 39916 * @private 39917 * @param {HTMLElement} element optional Target element. 39918 * @return {Object} The window for the given element or the default window. 39919 */ 39920 _getWin: function(element) { 39921 var doc = Y_DOM._getDoc(element); 39922 return doc[DEFAULT_VIEW] || doc[PARENT_WINDOW] || Y.config.win; 39923 }, 39924 39925 _batch: function(nodes, fn, arg1, arg2, arg3, etc) { 39926 fn = (typeof fn === 'string') ? Y_DOM[fn] : fn; 39927 var result, 39928 i = 0, 39929 node, 39930 ret; 39931 39932 if (fn && nodes) { 39933 while ((node = nodes[i++])) { 39934 result = result = fn.call(Y_DOM, node, arg1, arg2, arg3, etc); 39935 if (typeof result !== 'undefined') { 39936 (ret) || (ret = []); 39937 ret.push(result); 39938 } 39939 } 39940 } 39941 39942 return (typeof ret !== 'undefined') ? ret : nodes; 39943 }, 39944 39945 generateID: function(el) { 39946 var id = el.id; 39947 39948 if (!id) { 39949 id = Y.stamp(el); 39950 el.id = id; 39951 } 39952 39953 return id; 39954 } 39955}; 39956 39957 39958Y.DOM = Y_DOM; 39959 39960 39961}, 'patched-v3.18.1', {"requires": ["oop", "features"]}); 39962 39963YUI.add('dom-screen', function (Y, NAME) { 39964 39965(function(Y) { 39966 39967/** 39968 * Adds position and region management functionality to DOM. 39969 * @module dom 39970 * @submodule dom-screen 39971 * @for DOM 39972 */ 39973 39974var DOCUMENT_ELEMENT = 'documentElement', 39975 COMPAT_MODE = 'compatMode', 39976 POSITION = 'position', 39977 FIXED = 'fixed', 39978 RELATIVE = 'relative', 39979 LEFT = 'left', 39980 TOP = 'top', 39981 _BACK_COMPAT = 'BackCompat', 39982 MEDIUM = 'medium', 39983 BORDER_LEFT_WIDTH = 'borderLeftWidth', 39984 BORDER_TOP_WIDTH = 'borderTopWidth', 39985 GET_BOUNDING_CLIENT_RECT = 'getBoundingClientRect', 39986 GET_COMPUTED_STYLE = 'getComputedStyle', 39987 39988 Y_DOM = Y.DOM, 39989 39990 // TODO: how about thead/tbody/tfoot/tr? 39991 // TODO: does caption matter? 39992 RE_TABLE = /^t(?:able|d|h)$/i, 39993 39994 SCROLL_NODE; 39995 39996if (Y.UA.ie) { 39997 if (Y.config.doc[COMPAT_MODE] !== 'BackCompat') { 39998 SCROLL_NODE = DOCUMENT_ELEMENT; 39999 } else { 40000 SCROLL_NODE = 'body'; 40001 } 40002} 40003 40004Y.mix(Y_DOM, { 40005 /** 40006 * Returns the inner height of the viewport (exludes scrollbar). 40007 * @method winHeight 40008 * @return {Number} The current height of the viewport. 40009 */ 40010 winHeight: function(node) { 40011 var h = Y_DOM._getWinSize(node).height; 40012 return h; 40013 }, 40014 40015 /** 40016 * Returns the inner width of the viewport (exludes scrollbar). 40017 * @method winWidth 40018 * @return {Number} The current width of the viewport. 40019 */ 40020 winWidth: function(node) { 40021 var w = Y_DOM._getWinSize(node).width; 40022 return w; 40023 }, 40024 40025 /** 40026 * Document height 40027 * @method docHeight 40028 * @return {Number} The current height of the document. 40029 */ 40030 docHeight: function(node) { 40031 var h = Y_DOM._getDocSize(node).height; 40032 return Math.max(h, Y_DOM._getWinSize(node).height); 40033 }, 40034 40035 /** 40036 * Document width 40037 * @method docWidth 40038 * @return {Number} The current width of the document. 40039 */ 40040 docWidth: function(node) { 40041 var w = Y_DOM._getDocSize(node).width; 40042 return Math.max(w, Y_DOM._getWinSize(node).width); 40043 }, 40044 40045 /** 40046 * Amount page has been scroll horizontally 40047 * @method docScrollX 40048 * @return {Number} The current amount the screen is scrolled horizontally. 40049 */ 40050 docScrollX: function(node, doc) { 40051 doc = doc || (node) ? Y_DOM._getDoc(node) : Y.config.doc; // perf optimization 40052 var dv = doc.defaultView, 40053 pageOffset = (dv) ? dv.pageXOffset : 0; 40054 return Math.max(doc[DOCUMENT_ELEMENT].scrollLeft, doc.body.scrollLeft, pageOffset); 40055 }, 40056 40057 /** 40058 * Amount page has been scroll vertically 40059 * @method docScrollY 40060 * @return {Number} The current amount the screen is scrolled vertically. 40061 */ 40062 docScrollY: function(node, doc) { 40063 doc = doc || (node) ? Y_DOM._getDoc(node) : Y.config.doc; // perf optimization 40064 var dv = doc.defaultView, 40065 pageOffset = (dv) ? dv.pageYOffset : 0; 40066 return Math.max(doc[DOCUMENT_ELEMENT].scrollTop, doc.body.scrollTop, pageOffset); 40067 }, 40068 40069 /** 40070 * Gets the current position of an element based on page coordinates. 40071 * Element must be part of the DOM tree to have page coordinates 40072 * (display:none or elements not appended return false). 40073 * @method getXY 40074 * @param element The target element 40075 * @return {Array} The XY position of the element 40076 40077 TODO: test inDocument/display? 40078 */
40079 getXY: function() { 40080 if (Y.config.doc[DOCUMENT_ELEMENT][GET_BOUNDING_CLIENT_RECT]) { 40081 return function(node) { 40082 var xy = null, 40083 scrollLeft, 40084 scrollTop, 40085 mode, 40086 box, 40087 offX, 40088 offY, 40089 doc, 40090 win, 40091 inDoc, 40092 rootNode; 40093 40094 if (node && node.tagName) { 40095 doc = node.ownerDocument; 40096 mode = doc[COMPAT_MODE]; 40097 40098 if (mode !== _BACK_COMPAT) { 40099 rootNode = doc[DOCUMENT_ELEMENT]; 40100 } else { 40101 rootNode = doc.body; 40102 } 40103 40104 // inline inDoc check for perf 40105 if (rootNode.contains) { 40106 inDoc = rootNode.contains(node); 40107 } else { 40108 inDoc = Y.DOM.contains(rootNode, node); 40109 } 40110 40111 if (inDoc) { 40112 win = doc.defaultView; 40113 40114 // inline scroll calc for perf 40115 if (win && 'pageXOffset' in win) { 40116 scrollLeft = win.pageXOffset; 40117 scrollTop = win.pageYOffset; 40118 } else { 40119 scrollLeft = (SCROLL_NODE) ? doc[SCROLL_NODE].scrollLeft : Y_DOM.docScrollX(node, doc); 40120 scrollTop = (SCROLL_NODE) ? doc[SCROLL_NODE].scrollTop : Y_DOM.docScrollY(node, doc); 40121 } 40122 40123 if (Y.UA.ie) { // IE < 8, quirks, or compatMode 40124 if (!doc.documentMode || doc.documentMode < 8 || mode === _BACK_COMPAT) { 40125 offX = rootNode.clientLeft; 40126 offY = rootNode.clientTop; 40127 } 40128 } 40129 box = node[GET_BOUNDING_CLIENT_RECT](); 40130 xy = [box.left, box.top]; 40131 40132 if (offX || offY) { 40133 xy[0] -= offX; 40134 xy[1] -= offY; 40135 40136 } 40137 if ((scrollTop || scrollLeft)) { 40138 if (!Y.UA.ios || (Y.UA.ios >= 4.2)) { 40139 xy[0] += scrollLeft; 40140 xy[1] += scrollTop; 40141 } 40142 40143 } 40144 } else { 40145 xy = Y_DOM._getOffset(node); 40146 } 40147 } 40148 return xy; 40149 }; 40150 } else { 40151 return function(node) { // manually calculate by crawling up offsetParents 40152 //Calculate the Top and Left border sizes (assumes pixels) 40153 var xy = null, 40154 doc, 40155 parentNode, 40156 bCheck, 40157 scrollTop, 40158 scrollLeft; 40159 40160 if (node) { 40161 if (Y_DOM.inDoc(node)) { 40162 xy = [node.offsetLeft, node.offsetTop]; 40163 doc = node.ownerDocument; 40164 parentNode = node; 40165 // TODO: refactor with !! or just falsey 40166 bCheck = ((Y.UA.gecko || Y.UA.webkit > 519) ? true : false); 40167 40168 // TODO: worth refactoring for TOP/LEFT only? 40169 while ((parentNode = parentNode.offsetParent)) { 40170 xy[0] += parentNode.offsetLeft; 40171 xy[1] += parentNode.offsetTop; 40172 if (bCheck) { 40173 xy = Y_DOM._calcBorders(parentNode, xy); 40174 } 40175 } 40176 40177 // account for any scrolled ancestors 40178 if (Y_DOM.getStyle(node, POSITION) != FIXED) { 40179 parentNode = node; 40180 40181 while ((parentNode = parentNode.parentNode)) { 40182 scrollTop = parentNode.scrollTop; 40183 scrollLeft = parentNode.scrollLeft; 40184 40185 //Firefox does something funky with borders when overflow is not visible. 40186 if (Y.UA.gecko && (Y_DOM.getStyle(parentNode, 'overflow') !== 'visible')) { 40187 xy = Y_DOM._calcBorders(parentNode, xy); 40188 } 40189 40190 40191 if (scrollTop || scrollLeft) { 40192 xy[0] -= scrollLeft; 40193 xy[1] -= scrollTop; 40194 } 40195 } 40196 xy[0] += Y_DOM.docScrollX(node, doc); 40197 xy[1] += Y_DOM.docScrollY(node, doc); 40198 40199 } else { 40200 //Fix FIXED position -- add scrollbars 40201 xy[0] += Y_DOM.docScrollX(node, doc); 40202 xy[1] += Y_DOM.docScrollY(node, doc); 40203 } 40204 } else { 40205 xy = Y_DOM._getOffset(node); 40206 } 40207 } 40208 40209 return xy; 40210 }; 40211 } 40212 }(),// NOTE: Executing for loadtime branching 40213 40214 /** 40215 Gets the width of vertical scrollbars on overflowed containers in the body 40216 content. 40217 40218 @method getScrollbarWidth 40219 @return {Number} Pixel width of a scrollbar in the current browser 40220 **/ 40221 getScrollbarWidth: Y.cached(function () { 40222 var doc = Y.config.doc, 40223 testNode = doc.createElement('div'), 40224 body = doc.getElementsByTagName('body')[0], 40225 // 0.1 because cached doesn't support falsy refetch values 40226 width = 0.1; 40227 40228 if (body) { 40229 testNode.style.cssText = "position:absolute;visibility:hidden;overflow:scroll;width:20px;"; 40230 testNode.appendChild(doc.createElement('p')).style.height = '1px'; 40231 body.insertBefore(testNode, body.firstChild); 40232 width = testNode.offsetWidth - testNode.clientWidth; 40233 40234 body.removeChild(testNode); 40235 } 40236 40237 return width; 40238 }, null, 0.1), 40239 40240 /** 40241 * Gets the current X 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 getX 40245 * @param element The target element 40246 * @return {Number} The X position of the element 40247 */ 40248 40249 getX: function(node) { 40250 return Y_DOM.getXY(node)[0]; 40251 }, 40252 40253 /** 40254 * Gets the current Y position of an element based on page coordinates. 40255 * Element must be part of the DOM tree to have page coordinates 40256 * (display:none or elements not appended return false). 40257 * @method getY 40258 * @param element The target element 40259 * @return {Number} The Y position of the element 40260 */ 40261 40262 getY: function(node) { 40263 return Y_DOM.getXY(node)[1]; 40264 }, 40265 40266 /** 40267 * Set the position of an html element in page coordinates. 40268 * The element must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). 40269 * @method setXY 40270 * @param element The target element 40271 * @param {Array} xy Contains X & Y values for new position (coordinates are page-based) 40272 * @param {Boolean} noRetry By default we try and set the position a second time if the first fails 40273 */ 40274 setXY: function(node, xy, noRetry) { 40275 var setStyle = Y_DOM.setStyle, 40276 pos, 40277 delta, 40278 newXY, 40279 currentXY, 40280 offsetDir, 40281 dir, 40282 x; 40283 40284 if (node && xy) { 40285 pos = Y_DOM.getStyle(node, POSITION); 40286 40287 offsetDir = Y_DOM.OFFSET_XY; 40288 40289 if (!offsetDir) { 40290 dir = Y_DOM.getComputedStyle(node, 'direction'); 40291 40292 offsetDir = (dir === 'rtl' ? 'right' : LEFT); 40293 } 40294 40295 delta = Y_DOM._getOffset(node, offsetDir); 40296 if (pos == 'static') { // default to relative 40297 pos = RELATIVE; 40298 setStyle(node, POSITION, pos); 40299 } 40300 currentXY = Y_DOM._getDirXY(node, offsetDir); 40301 40302 x = xy[0]; 40303 40304 if (offsetDir === 'right') { 40305 x = Y_DOM.winWidth() - (xy[0] + parseInt(Y_DOM.getComputedStyle(node, 'width'), 10)); 40306 40307 if (!delta[0] && !noRetry) { 40308 noRetry = false;
40309 } 40310 } 40311 40312 if (x !== null) { 40313 setStyle(node, offsetDir, x - currentXY[0] + delta[0] + 'px'); 40314 } 40315 40316 if (xy[1] !== null) { 40317 setStyle(node, TOP, xy[1] - currentXY[1] + delta[1] + 'px'); 40318 } 40319 40320 if (!noRetry) { 40321 newXY = Y_DOM.getXY(node); 40322 if (newXY[0] !== xy[0] || newXY[1] !== xy[1]) { 40323 Y_DOM.setXY(node, xy, true); 40324 } 40325 } 40326 40327 } else { 40328 } 40329 }, 40330 40331 /** 40332 * Set the X position of an html element in page coordinates, regardless of how the element is positioned. 40333 * The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). 40334 * @method setX 40335 * @param element The target element 40336 * @param {Number} x The X values for new position (coordinates are page-based) 40337 */ 40338 setX: function(node, x) { 40339 return Y_DOM.setXY(node, [x, null]); 40340 }, 40341 40342 /** 40343 * Set the Y position of an html element in page coordinates, regardless of how the element is positioned. 40344 * The element(s) must be part of the DOM tree to have page coordinates (display:none or elements not appended return false). 40345 * @method setY 40346 * @param element The target element 40347 * @param {Number} y The Y values for new position (coordinates are page-based) 40348 */ 40349 setY: function(node, y) { 40350 return Y_DOM.setXY(node, [null, y]); 40351 }, 40352 40353 /** 40354 * @method swapXY 40355 * @description Swap the xy position with another node 40356 * @param {Node} node The node to swap with 40357 * @param {Node} otherNode The other node to swap with 40358 * @return {Node} 40359 */ 40360 swapXY: function(node, otherNode) { 40361 var xy = Y_DOM.getXY(node); 40362 Y_DOM.setXY(node, Y_DOM.getXY(otherNode)); 40363 Y_DOM.setXY(otherNode, xy); 40364 }, 40365 40366 _calcBorders: function(node, xy2) { 40367 var t = parseInt(Y_DOM[GET_COMPUTED_STYLE](node, BORDER_TOP_WIDTH), 10) || 0, 40368 l = parseInt(Y_DOM[GET_COMPUTED_STYLE](node, BORDER_LEFT_WIDTH), 10) || 0; 40369 if (Y.UA.gecko) { 40370 if (RE_TABLE.test(node.tagName)) { 40371 t = 0; 40372 l = 0; 40373 } 40374 } 40375 xy2[0] += l; 40376 xy2[1] += t; 40377 return xy2; 40378 }, 40379 40380 _getWinSize: function(node, doc) { 40381 doc = doc || (node) ? Y_DOM._getDoc(node) : Y.config.doc; 40382 var win = doc.defaultView || doc.parentWindow, 40383 mode = doc[COMPAT_MODE], 40384 h = win.innerHeight, 40385 w = win.innerWidth, 40386 root = doc[DOCUMENT_ELEMENT]; 40387 40388 if ( mode && !Y.UA.opera ) { // IE, Gecko 40389 if (mode != 'CSS1Compat') { // Quirks 40390 root = doc.body; 40391 } 40392 h = root.clientHeight; 40393 w = root.clientWidth; 40394 } 40395 return { height: h, width: w }; 40396 }, 40397 40398 _getDocSize: function(node) { 40399 var doc = (node) ? Y_DOM._getDoc(node) : Y.config.doc, 40400 root = doc[DOCUMENT_ELEMENT]; 40401 40402 if (doc[COMPAT_MODE] != 'CSS1Compat') { 40403 root = doc.body; 40404 } 40405 40406 return { height: root.scrollHeight, width: root.scrollWidth }; 40407 }, 40408 40409 _getDirXY: function(node, dir) { 40410 var xy = Y_DOM.getXY(node); 40411 40412 if (dir === 'right') { 40413 xy[0] = (Y_DOM.winWidth() - (xy[0] + parseInt(Y_DOM.getComputedStyle(node, 'width'), 10))); 40414 } 40415 40416 return xy; 40417 } 40418}); 40419 40420})(Y); 40421(function(Y) { 40422var TOP = 'top', 40423 RIGHT = 'right', 40424 BOTTOM = 'bottom', 40425 LEFT = 'left', 40426 40427 getOffsets = function(r1, r2) { 40428 var t = Math.max(r1[TOP], r2[TOP]), 40429 r = Math.min(r1[RIGHT], r2[RIGHT]), 40430 b = Math.min(r1[BOTTOM], r2[BOTTOM]), 40431 l = Math.max(r1[LEFT], r2[LEFT]), 40432 ret = {}; 40433 40434 ret[TOP] = t; 40435 ret[RIGHT] = r; 40436 ret[BOTTOM] = b; 40437 ret[LEFT] = l; 40438 return ret; 40439 }, 40440 40441 DOM = Y.DOM; 40442 40443Y.mix(DOM, { 40444 /** 40445 * Returns an Object literal containing the following about this element: (top, right, bottom, left) 40446 * @for DOM 40447 * @method region 40448 * @param {HTMLElement} element The DOM element. 40449 * @return {Object} Object literal containing the following about this element: (top, right, bottom, left) 40450 */ 40451 region: function(node) { 40452 var xy = DOM.getXY(node), 40453 ret = false;
40454 40455 if (node && xy) { 40456 ret = DOM._getRegion( 40457 xy[1], // top 40458 xy[0] + node.offsetWidth, // right 40459 xy[1] + node.offsetHeight, // bottom 40460 xy[0] // left 40461 ); 40462 } 40463 40464 return ret; 40465 }, 40466 40467 /** 40468 * Find the intersect information for the passed nodes. 40469 * @method intersect 40470 * @for DOM 40471 * @param {HTMLElement} element The first element 40472 * @param {HTMLElement | Object} element2 The element or region to check the interect with 40473 * @param {Object} altRegion An object literal containing the region for the first element if we already have the data (for performance e.g. DragDrop) 40474 * @return {Object} Object literal containing the following intersection data: (top, right, bottom, left, area, yoff, xoff, inRegion) 40475 */ 40476 intersect: function(node, node2, altRegion) { 40477 var r = altRegion || DOM.region(node), region = {}, 40478 n = node2, 40479 off; 40480 40481 if (n.tagName) { 40482 region = DOM.region(n); 40483 } else if (Y.Lang.isObject(node2)) { 40484 region = node2; 40485 } else { 40486 return false; 40487 } 40488 40489 off = getOffsets(region, r); 40490 return { 40491 top: off[TOP], 40492 right: off[RIGHT], 40493 bottom: off[BOTTOM], 40494 left: off[LEFT], 40495 area: ((off[BOTTOM] - off[TOP]) * (off[RIGHT] - off[LEFT])), 40496 yoff: ((off[BOTTOM] - off[TOP])), 40497 xoff: (off[RIGHT] - off[LEFT]), 40498 inRegion: DOM.inRegion(node, node2, false, altRegion) 40499 }; 40500 40501 }, 40502 /** 40503 * Check if any part of this node is in the passed region 40504 * @method inRegion 40505 * @for DOM 40506 * @param {Object} node The node to get the region from 40507 * @param {Object} node2 The second node to get the region from or an Object literal of the region 40508 * @param {Boolean} all Should all of the node be inside the region 40509 * @param {Object} altRegion An object literal containing the region for this node if we already have the data (for performance e.g. DragDrop) 40510 * @return {Boolean} True if in region, false if not. 40511 */ 40512 inRegion: function(node, node2, all, altRegion) { 40513 var region = {}, 40514 r = altRegion || DOM.region(node), 40515 n = node2, 40516 off; 40517 40518 if (n.tagName) { 40519 region = DOM.region(n); 40520 } else if (Y.Lang.isObject(node2)) { 40521 region = node2; 40522 } else { 40523 return false; 40524 } 40525 40526 if (all) { 40527 return ( 40528 r[LEFT] >= region[LEFT] && 40529 r[RIGHT] <= region[RIGHT] && 40530 r[TOP] >= region[TOP] && 40531 r[BOTTOM] <= region[BOTTOM] ); 40532 } else { 40533 off = getOffsets(region, r); 40534 if (off[BOTTOM] >= off[TOP] && off[RIGHT] >= off[LEFT]) { 40535 return true; 40536 } else { 40537 return false; 40538 } 40539 40540 } 40541 }, 40542 40543 /** 40544 * Check if any part of this element is in the viewport 40545 * @method inViewportRegion 40546 * @for DOM 40547 * @param {HTMLElement} element The DOM element. 40548 * @param {Boolean} all Should all of the node be inside the region 40549 * @param {Object} altRegion An object literal containing the region for this node if we already have the data (for performance e.g. DragDrop) 40550 * @return {Boolean} True if in region, false if not. 40551 */ 40552 inViewportRegion: function(node, all, altRegion) { 40553 return DOM.inRegion(node, DOM.viewportRegion(node), all, altRegion); 40554 40555 }, 40556 40557 _getRegion: function(t, r, b, l) { 40558 var region = {}; 40559 40560 region[TOP] = region[1] = t; 40561 region[LEFT] = region[0] = l; 40562 region[BOTTOM] = b; 40563 region[RIGHT] = r; 40564 region.width = region[RIGHT] - region[LEFT]; 40565 region.height = region[BOTTOM] - region[TOP]; 40566 40567 return region; 40568 }, 40569 40570 /** 40571 * Returns an Object literal containing the following about the visible region of viewport: (top, right, bottom, left) 40572 * @method viewportRegion 40573 * @for DOM 40574 * @return {Object} Object literal containing the following about the visible region of the viewport: (top, right, bottom, left) 40575 */ 40576 viewportRegion: function(node) { 40577 node = node || Y.config.doc.documentElement; 40578 var ret = false, 40579 scrollX, 40580 scrollY; 40581 40582 if (node) { 40583 scrollX = DOM.docScrollX(node); 40584 scrollY = DOM.docScrollY(node); 40585 40586 ret = DOM._getRegion(scrollY, // top 40587 DOM.winWidth(node) + scrollX, // right 40588 scrollY + DOM.winHeight(node), // bottom 40589 scrollX); // left 40590 } 40591 40592 return ret; 40593 } 40594}); 40595})(Y); 40596 40597 40598}, 'patched-v3.18.1', {"requires": ["dom-base", "dom-style"]}); 40599 40600YUI.add('dom-style', function (Y, NAME) { 40601 40602/** 40603 * Add style management functionality to DOM. 40604 * @module dom 40605 * @submodule dom-style 40606 * @for DOM 40607 */ 40608 40609var DOCUMENT_ELEMENT = 'documentElement', 40610 DEFAULT_VIEW = 'defaultView', 40611 OWNER_DOCUMENT = 'ownerDocument', 40612 STYLE = 'style', 40613 FLOAT = 'float', 40614 CSS_FLOAT = 'cssFloat', 40615 STYLE_FLOAT = 'styleFloat', 40616 TRANSPARENT = 'transparent', 40617 GET_COMPUTED_STYLE = 'getComputedStyle', 40618 GET_BOUNDING_CLIENT_RECT = 'getBoundingClientRect', 40619 40620 DOCUMENT = Y.config.doc, 40621 40622 Y_DOM = Y.DOM, 40623 40624 TRANSFORM, 40625 TRANSFORMORIGIN, 40626 VENDOR_TRANSFORM = [ 40627 'WebkitTransform', 40628 'MozTransform', 40629 'OTransform', 40630 'msTransform', 40631 'transform' 40632 ], 40633 40634 re_unit = /width|height|top|left|right|bottom|margin|padding/i; 40635 40636Y.Array.each(VENDOR_TRANSFORM, function(val) { 40637 if (val in DOCUMENT[DOCUMENT_ELEMENT].style) { 40638 TRANSFORM = val;
40639 TRANSFORMORIGIN = val + "Origin"; 40640 } 40641}); 40642 40643Y.mix(Y_DOM, { 40644 DEFAULT_UNIT: 'px', 40645 40646 CUSTOM_STYLES: { 40647 }, 40648 40649 40650 /** 40651 * Sets a style property for a given element. 40652 * @method setStyle 40653 * @param {HTMLElement} node The HTMLElement to apply the style to. 40654 * @param {String} att The style property to set. 40655 * @param {String|Number} val The value. 40656 * @param {Object} [style] The style node. Defaults to `node.style`. 40657 */ 40658 setStyle: function(node, att, val, style) { 40659 style = style || node.style; 40660 var CUSTOM_STYLES = Y_DOM.CUSTOM_STYLES; 40661 40662 if (style) { 40663 if (val === null || val === '') { // normalize unsetting 40664 val = ''; 40665 } else if (!isNaN(Number(val)) && re_unit.test(att)) { // number values may need a unit 40666 val += Y_DOM.DEFAULT_UNIT; 40667 } 40668 40669 if (att in CUSTOM_STYLES) { 40670 if (CUSTOM_STYLES[att].set) { 40671 CUSTOM_STYLES[att].set(node, val, style); 40672 return; // NOTE: return 40673 } else if (typeof CUSTOM_STYLES[att] === 'string') { 40674 att = CUSTOM_STYLES[att]; 40675 } 40676 } else if (att === '') { // unset inline styles 40677 att = 'cssText'; 40678 val = ''; 40679 } 40680 style[att] = val; 40681 } 40682 }, 40683 40684 /** 40685 * Returns the current style value for the given property. 40686 * @method getStyle 40687 * @param {HTMLElement} node The HTMLElement to get the style from. 40688 * @param {String} att The style property to get. 40689 * @param {Object} [style] The style node. Defaults to `node.style`. 40690 */ 40691 getStyle: function(node, att, style) { 40692 style = style || node.style; 40693 var CUSTOM_STYLES = Y_DOM.CUSTOM_STYLES, 40694 val = ''; 40695 40696 if (style) { 40697 if (att in CUSTOM_STYLES) { 40698 if (CUSTOM_STYLES[att].get) { 40699 return CUSTOM_STYLES[att].get(node, att, style); // NOTE: return 40700 } else if (typeof CUSTOM_STYLES[att] === 'string') { 40701 att = CUSTOM_STYLES[att]; 40702 } 40703 } 40704 val = style[att]; 40705 if (val === '') { // TODO: is empty string sufficient? 40706 val = Y_DOM[GET_COMPUTED_STYLE](node, att); 40707 } 40708 } 40709 40710 return val; 40711 }, 40712 40713 /** 40714 * Sets multiple style properties. 40715 * @method setStyles 40716 * @param {HTMLElement} node The HTMLElement to apply the styles to. 40717 * @param {Object} hash An object literal of property:value pairs. 40718 */ 40719 setStyles: function(node, hash) { 40720 var style = node.style; 40721 Y.each(hash, function(v, n) { 40722 Y_DOM.setStyle(node, n, v, style); 40723 }, Y_DOM); 40724 }, 40725 40726 /** 40727 * Returns the computed style for the given node. 40728 * @method getComputedStyle 40729 * @param {HTMLElement} node The HTMLElement to get the style from. 40730 * @param {String} att The style property to get. 40731 * @return {String} The computed value of the style property. 40732 */ 40733 getComputedStyle: function(node, att) { 40734 var val = '', 40735 doc = node[OWNER_DOCUMENT], 40736 computed; 40737 40738 if (node[STYLE] && doc[DEFAULT_VIEW] && doc[DEFAULT_VIEW][GET_COMPUTED_STYLE]) { 40739 computed = doc[DEFAULT_VIEW][GET_COMPUTED_STYLE](node, null); 40740 if (computed) { // FF may be null in some cases (ticket #2530548) 40741 val = computed[att]; 40742 } 40743 } 40744 return val; 40745 } 40746}); 40747 40748// normalize reserved word float alternatives ("cssFloat" or "styleFloat") 40749if (DOCUMENT[DOCUMENT_ELEMENT][STYLE][CSS_FLOAT] !== undefined) { 40750 Y_DOM.CUSTOM_STYLES[FLOAT] = CSS_FLOAT; 40751} else if (DOCUMENT[DOCUMENT_ELEMENT][STYLE][STYLE_FLOAT] !== undefined) { 40752 Y_DOM.CUSTOM_STYLES[FLOAT] = STYLE_FLOAT; 40753} 40754 40755// safari converts transparent to rgba(), others use "transparent" 40756if (Y.UA.webkit) { 40757 Y_DOM[GET_COMPUTED_STYLE] = function(node, att) { 40758 var view = node[OWNER_DOCUMENT][DEFAULT_VIEW], 40759 val = view[GET_COMPUTED_STYLE](node, '')[att]; 40760 40761 if (val === 'rgba(0, 0, 0, 0)') { 40762 val = TRANSPARENT; 40763 } 40764 40765 return val; 40766 }; 40767 40768} 40769 40770Y.DOM._getAttrOffset = function(node, attr) { 40771 var val = Y.DOM[GET_COMPUTED_STYLE](node, attr), 40772 offsetParent = node.offsetParent, 40773 position, 40774 parentOffset, 40775 offset; 40776 40777 if (val === 'auto') { 40778 position = Y.DOM.getStyle(node, 'position'); 40779 if (position === 'static' || position === 'relative') { 40780 val = 0; 40781 } else if (offsetParent && offsetParent[GET_BOUNDING_CLIENT_RECT]) { 40782 parentOffset = offsetParent[GET_BOUNDING_CLIENT_RECT]()[attr]; 40783 offset = node[GET_BOUNDING_CLIENT_RECT]()[attr]; 40784 if (attr === 'left' || attr === 'top') { 40785 val = offset - parentOffset; 40786 } else { 40787 val = parentOffset - node[GET_BOUNDING_CLIENT_RECT]()[attr]; 40788 } 40789 } 40790 } 40791 40792 return val; 40793}; 40794 40795Y.DOM._getOffset = function(node, dir) { 40796 var pos,
40797 xy = null, 40798 offset = { 40799 left: 'offsetLeft', 40800 right: 'offsetRight' 40801 }, 40802 margins = { 40803 left: 'marginLeft', 40804 right: 'marginRight' 40805 }, 40806 margin; 40807 40808 dir = dir || 'left'; 40809 40810 if (node) { 40811 pos = Y_DOM.getStyle(node, 'position'); 40812 margin = parseInt(Y_DOM[GET_COMPUTED_STYLE](node, margins[dir]), 10); 40813 xy = [ 40814 parseInt(Y_DOM[GET_COMPUTED_STYLE](node, dir), 10), 40815 parseInt(Y_DOM[GET_COMPUTED_STYLE](node, 'top'), 10) 40816 ]; 40817 40818 if ( isNaN(xy[0]) ) { // in case of 'auto' 40819 xy[0] = parseInt(Y_DOM.getStyle(node, dir), 10); // try inline 40820 if ( isNaN(xy[0]) ) { // default to offset value 40821 xy[0] = (pos === 'relative') ? 0 : (node[offset[dir]] - margin) || 0; 40822 } 40823 } 40824 40825 if ( isNaN(xy[1]) ) { // in case of 'auto' 40826 xy[1] = parseInt(Y_DOM.getStyle(node, 'top'), 10); // try inline 40827 if ( isNaN(xy[1]) ) { // default to offset value 40828 xy[1] = (pos === 'relative') ? 0 : node.offsetTop || 0; 40829 } 40830 } 40831 } 40832 40833 return xy; 40834 40835}; 40836 40837if (TRANSFORM) { 40838 Y_DOM.CUSTOM_STYLES.transform = { 40839 set: function(node, val, style) { 40840 style[TRANSFORM] = val; 40841 }, 40842 40843 get: function(node) { 40844 return Y_DOM[GET_COMPUTED_STYLE](node, TRANSFORM); 40845 } 40846 }; 40847 40848 Y_DOM.CUSTOM_STYLES.transformOrigin = { 40849 set: function(node, val, style) { 40850 style[TRANSFORMORIGIN] = val; 40851 }, 40852 40853 get: function(node) { 40854 return Y_DOM[GET_COMPUTED_STYLE](node, TRANSFORMORIGIN); 40855 } 40856 }; 40857} 40858 40859 40860}, 'patched-v3.18.1', {"requires": ["dom-base"]}); 40861 40862YUI.add('event-base', function (Y, NAME) { 40863 40864/* 40865 * DOM event listener abstraction layer 40866 * @module event 40867 * @submodule event-base 40868 */ 40869 40870/** 40871 * The domready event fires at the moment the browser's DOM is 40872 * usable. In most cases, this is before images are fully 40873 * downloaded, allowing you to provide a more responsive user 40874 * interface. 40875 * 40876 * In YUI 3, domready subscribers will be notified immediately if 40877 * that moment has already passed when the subscription is created. 40878 * 40879 * One exception is if the yui.js file is dynamically injected into 40880 * the page. If this is done, you must tell the YUI instance that 40881 * you did this in order for DOMReady (and window load events) to 40882 * fire normally. That configuration option is 'injected' -- set 40883 * it to true if the yui.js script is not included inline. 40884 * 40885 * This method is part of the 'event-ready' module, which is a 40886 * submodule of 'event'. 40887 * 40888 * @event domready 40889 * @for YUI 40890 */ 40891Y.publish('domready', { 40892 fireOnce: true, 40893 async: true 40894}); 40895 40896if (YUI.Env.DOMReady) { 40897 Y.fire('domready'); 40898} else { 40899 Y.Do.before(function() { Y.fire('domready'); }, YUI.Env, '_ready'); 40900} 40901 40902/** 40903 * Custom event engine, DOM event listener abstraction layer, synthetic DOM 40904 * events. 40905 * @module event 40906 * @submodule event-base 40907 */ 40908 40909/** 40910 * Wraps a DOM event, properties requiring browser abstraction are 40911 * fixed here. Provids a security layer when required. 40912 * @class DOMEventFacade 40913 * @param ev {Event} the DOM event 40914 * @param currentTarget {HTMLElement} the element the listener was attached to 40915 * @param wrapper {CustomEvent} the custom event wrapper for this DOM event 40916 */ 40917 40918 var ua = Y.UA, 40919 40920 EMPTY = {}, 40921 40922 /** 40923 * webkit key remapping required for Safari < 3.1 40924 * @property webkitKeymap 40925 * @private 40926 */ 40927 webkitKeymap = { 40928 63232: 38, // up 40929 63233: 40, // down 40930 63234: 37, // left 40931 63235: 39, // right 40932 63276: 33, // page up 40933 63277: 34, // page down 40934 25: 9, // SHIFT-TAB (Safari provides a different key code in 40935 // this case, even though the shiftKey modifier is set) 40936 63272: 46, // delete 40937 63273: 36, // home 40938 63275: 35 // end 40939 }, 40940 40941 /** 40942 * Returns a wrapped node. Intended to be used on event targets, 40943 * so it will return the node's parent if the target is a text 40944 * node. 40945 * 40946 * If accessing a property of the node throws an error, this is 40947 * probably the anonymous div wrapper Gecko adds inside text 40948 * nodes. This likely will only occur when attempting to access 40949 * the relatedTarget. In this case, we now return null because 40950 * the anonymous div is completely useless and we do not know 40951 * what the related target was because we can't even get to 40952 * the element's parent node. 40953 * 40954 * @method resolve 40955 * @private 40956 */ 40957 resolve = function(n) { 40958 if (!n) { 40959 return n; 40960 } 40961 try { 40962 if (n && 3 == n.nodeType) { 40963 n = n.parentNode; 40964 } 40965 } catch(e) { 40966 return null; 40967 } 40968 40969 return Y.one(n); 40970 }, 40971 40972 DOMEventFacade = function(ev, currentTarget, wrapper) { 40973 this._event = ev; 40974 this._currentTarget = currentTarget; 40975 this._wrapper = wrapper || EMPTY; 40976 40977 // if not lazy init 40978 this.init(); 40979 }; 40980 40981Y.extend(DOMEventFacade, Object, { 40982 40983 init: function() { 40984 40985 var e = this._event, 40986 overrides = this._wrapper.overrides, 40987 x = e.pageX, 40988 y = e.pageY, 40989 c, 40990 currentTarget = this._currentTarget; 40991 40992 this.altKey = e.altKey; 40993 this.ctrlKey = e.ctrlKey; 40994 this.metaKey = e.metaKey; 40995 this.shiftKey = e.shiftKey; 40996 this.type = (overrides && overrides.type) || e.type; 40997 this.clientX = e.clientX; 40998 this.clientY = e.clientY; 40999 41000 this.pageX = x; 41001 this.pageY = y; 41002
41003 // charCode is unknown in keyup, keydown. keyCode is unknown in keypress. 41004 // FF 3.6 - 8+? pass 0 for keyCode in keypress events. 41005 // Webkit, FF 3.6-8+?, and IE9+? pass 0 for charCode in keydown, keyup. 41006 // Webkit and IE9+? duplicate charCode in keyCode. 41007 // Opera never sets charCode, always keyCode (though with the charCode). 41008 // IE6-8 don't set charCode or which. 41009 // All browsers other than IE6-8 set which=keyCode in keydown, keyup, and 41010 // which=charCode in keypress. 41011 // 41012 // Moral of the story: (e.which || e.keyCode) will always return the 41013 // known code for that key event phase. e.keyCode is often different in 41014 // keypress from keydown and keyup. 41015 c = e.keyCode || e.charCode; 41016 41017 if (ua.webkit && (c in webkitKeymap)) { 41018 c = webkitKeymap[c]; 41019 } 41020 41021 this.keyCode = c; 41022 this.charCode = c; 41023 // Fill in e.which for IE - implementers should always use this over 41024 // e.keyCode or e.charCode. 41025 this.which = e.which || e.charCode || c; 41026 // this.button = e.button; 41027 this.button = this.which; 41028 41029 this.target = resolve(e.target); 41030 this.currentTarget = resolve(currentTarget); 41031 this.relatedTarget = resolve(e.relatedTarget); 41032 41033 if (e.type == "mousewheel" || e.type == "DOMMouseScroll") { 41034 this.wheelDelta = (e.detail) ? (e.detail * -1) : Math.round(e.wheelDelta / 80) || ((e.wheelDelta < 0) ? -1 : 1); 41035 } 41036 41037 if (this._touch) { 41038 this._touch(e, currentTarget, this._wrapper); 41039 } 41040 }, 41041 41042 stopPropagation: function() { 41043 this._event.stopPropagation(); 41044 this._wrapper.stopped = 1; 41045 this.stopped = 1; 41046 }, 41047 41048 stopImmediatePropagation: function() { 41049 var e = this._event; 41050 if (e.stopImmediatePropagation) { 41051 e.stopImmediatePropagation(); 41052 } else { 41053 this.stopPropagation(); 41054 } 41055 this._wrapper.stopped = 2; 41056 this.stopped = 2; 41057 }, 41058 41059 preventDefault: function(returnValue) { 41060 var e = this._event; 41061 e.preventDefault(); 41062 if (returnValue) { 41063 e.returnValue = returnValue; 41064 } 41065 this._wrapper.prevented = 1; 41066 this.prevented = 1; 41067 }, 41068 41069 halt: function(immediate) { 41070 if (immediate) { 41071 this.stopImmediatePropagation(); 41072 } else { 41073 this.stopPropagation(); 41074 } 41075 41076 this.preventDefault(); 41077 } 41078 41079}); 41080 41081DOMEventFacade.resolve = resolve; 41082Y.DOM2EventFacade = DOMEventFacade; 41083Y.DOMEventFacade = DOMEventFacade; 41084 41085 /** 41086 * The native event 41087 * @property _event 41088 * @type {DOMEvent} 41089 * @private 41090 */ 41091 41092 /** 41093 The name of the event (e.g. "click") 41094 41095 @property type 41096 @type {String} 41097 **/ 41098 41099 /** 41100 `true` if the "alt" or "option" key is pressed. 41101 41102 @property altKey 41103 @type {Boolean} 41104 **/ 41105 41106 /** 41107 `true` if the shift key is pressed. 41108 41109 @property shiftKey 41110 @type {Boolean} 41111 **/ 41112 41113 /** 41114 `true` if the "Windows" key on a Windows keyboard, "command" key on an 41115 Apple keyboard, or "meta" key on other keyboards is pressed. 41116 41117 @property metaKey 41118 @type {Boolean} 41119 **/ 41120 41121 /** 41122 `true` if the "Ctrl" or "control" key is pressed. 41123 41124 @property ctrlKey 41125 @type {Boolean} 41126 **/ 41127 41128 /** 41129 * The X location of the event on the page (including scroll) 41130 * @property pageX 41131 * @type {Number} 41132 */ 41133 41134 /** 41135 * The Y location of the event on the page (including scroll) 41136 * @property pageY 41137 * @type {Number} 41138 */ 41139 41140 /** 41141 * The X location of the event in the viewport 41142 * @property clientX 41143 * @type {Number} 41144 */ 41145 41146 /** 41147 * The Y location of the event in the viewport 41148 * @property clientY 41149 * @type {Number} 41150 */ 41151 41152 /** 41153 * The keyCode for key events. Uses charCode if keyCode is not available 41154 * @property keyCode 41155 * @type {Number} 41156 */ 41157 41158 /** 41159 * The charCode for key events. Same as keyCode 41160 * @property charCode 41161 * @type {Number} 41162 */ 41163 41164 /** 41165 * The button that was pushed. 1 for left click, 2 for middle click, 3 for 41166 * right click. This is only reliably populated on `mouseup` events. 41167 * @property button 41168 * @type {Number} 41169 */ 41170 41171 /** 41172 * The button that was pushed. Same as button. 41173 * @property which 41174 * @type {Number} 41175 */ 41176 41177 /** 41178 * Node reference for the targeted element 41179 * @property target 41180 * @type {Node} 41181 */ 41182 41183 /** 41184 * Node reference for the element that the listener was attached to. 41185 * @property currentTarget 41186 * @type {Node} 41187 */ 41188 41189 /** 41190 * Node reference to the relatedTarget 41191 * @property relatedTarget 41192 * @type {Node} 41193 */ 41194 41195 /** 41196 * Number representing the direction and velocity of the movement of the mousewheel. 41197 * Negative is down, the higher the number, the faster. Applies to the mousewheel event. 41198 * @property wheelDelta 41199 * @type {Number} 41200 */ 41201 41202 /** 41203 * Stops the propagation to the next bubble target 41204 * @method stopPropagation 41205 */ 41206 41207 /** 41208 * Stops the propagation to the next bubble target and 41209 * prevents any additional listeners from being exectued 41210 * on the current target. 41211 * @method stopImmediatePropagation 41212 */ 41213 41214 /** 41215 * Prevents the event's default behavior 41216 * @method preventDefault 41217 * @param returnValue {string} sets the returnValue of the event to this value 41218 * (rather than the default false value). This can be used to add a customized 41219 * confirmation query to the beforeunload event). 41220 */ 41221 41222 /** 41223 * Stops the event propagation and prevents the default 41224 * event behavior. 41225 * @method halt 41226 * @param immediate {boolean} if true additional listeners 41227 * on the current target will not be executed 41228 */ 41229(function() { 41230 41231/** 41232 * The event utility provides functions to add and remove event listeners, 41233 * event cleansing. It also tries to automatically remove listeners it 41234 * registers during the unload event. 41235 * @module event 41236 * @main event 41237 * @submodule event-base 41238 */ 41239 41240/** 41241 * The event utility provides functions to add and remove event listeners, 41242 * event cleansing. It also tries to automatically remove listeners it 41243 * registers during the unload event. 41244 * 41245 * @class Event 41246 * @static 41247 */ 41248 41249Y.Env.evt.dom_wrappers = {}; 41250Y.Env.evt.dom_map = {}; 41251 41252var _eventenv = Y.Env.evt, 41253 config = Y.config, 41254 win = config.win, 41255 add = YUI.Env.add, 41256 remove = YUI.Env.remove, 41257 41258 onLoad = function() { 41259 YUI.Env.windowLoaded = true; 41260 Y.Event._load(); 41261 remove(win, "load", onLoad); 41262 }, 41263 41264 onUnload = function() { 41265 Y.Event._unload(); 41266 }, 41267 41268 EVENT_READY = 'domready', 41269 41270 COMPAT_ARG = '~yui|2|compat~', 41271 41272 shouldIterate = function(o) { 41273 try { 41274 // TODO: See if there's a more performant way to return true early on this, for the common case 41275 return (o && typeof o !== "string" && Y.Lang.isNumber(o.length) && !o.tagName && !Y.DOM.isWindow(o)); 41276 } catch(ex) { 41277 return false;
41278 } 41279 }, 41280 41281 // aliases to support DOM event subscription clean up when the last 41282 // subscriber is detached. deleteAndClean overrides the DOM event's wrapper 41283 // CustomEvent _delete method. 41284 _ceProtoDelete = Y.CustomEvent.prototype._delete, 41285 _deleteAndClean = function(s) { 41286 var ret = _ceProtoDelete.apply(this, arguments); 41287 41288 if (!this.hasSubs()) { 41289 Y.Event._clean(this); 41290 } 41291 41292 return ret; 41293 }, 41294 41295Event = function() { 41296 41297 /** 41298 * True after the onload event has fired 41299 * @property _loadComplete 41300 * @type boolean 41301 * @static 41302 * @private 41303 */ 41304 var _loadComplete = false, 41305 41306 /** 41307 * The number of times to poll after window.onload. This number is 41308 * increased if additional late-bound handlers are requested after 41309 * the page load. 41310 * @property _retryCount 41311 * @static 41312 * @private 41313 */ 41314 _retryCount = 0, 41315 41316 /** 41317 * onAvailable listeners 41318 * @property _avail 41319 * @static 41320 * @private 41321 */ 41322 _avail = [], 41323 41324 /** 41325 * Custom event wrappers for DOM events. Key is 41326 * 'event:' + Element uid stamp + event type 41327 * @property _wrappers 41328 * @type CustomEvent 41329 * @static 41330 * @private 41331 */ 41332 _wrappers = _eventenv.dom_wrappers, 41333 41334 _windowLoadKey = null, 41335 41336 /** 41337 * Custom event wrapper map DOM events. Key is 41338 * Element uid stamp. Each item is a hash of custom event 41339 * wrappers as provided in the _wrappers collection. This 41340 * provides the infrastructure for getListeners. 41341 * @property _el_events 41342 * @static 41343 * @private 41344 */ 41345 _el_events = _eventenv.dom_map; 41346 41347 return { 41348 41349 /** 41350 * The number of times we should look for elements that are not 41351 * in the DOM at the time the event is requested after the document 41352 * has been loaded. The default is 1000@amp;40 ms, so it will poll 41353 * for 40 seconds or until all outstanding handlers are bound 41354 * (whichever comes first). 41355 * @property POLL_RETRYS 41356 * @type int 41357 * @static 41358 * @final 41359 */ 41360 POLL_RETRYS: 1000, 41361 41362 /** 41363 * The poll interval in milliseconds 41364 * @property POLL_INTERVAL 41365 * @type int 41366 * @static 41367 * @final 41368 */ 41369 POLL_INTERVAL: 40, 41370 41371 /** 41372 * addListener/removeListener can throw errors in unexpected scenarios. 41373 * These errors are suppressed, the method returns false, and this property 41374 * is set 41375 * @property lastError 41376 * @static 41377 * @type Error 41378 */ 41379 lastError: null, 41380 41381 41382 /** 41383 * poll handle 41384 * @property _interval 41385 * @static 41386 * @private 41387 */ 41388 _interval: null, 41389 41390 /** 41391 * document readystate poll handle 41392 * @property _dri 41393 * @static 41394 * @private 41395 */ 41396 _dri: null, 41397 41398 /** 41399 * True when the document is initially usable 41400 * @property DOMReady 41401 * @type boolean 41402 * @static 41403 */ 41404 DOMReady: false, 41405 41406 /** 41407 * @method startInterval 41408 * @static 41409 * @private 41410 */ 41411 startInterval: function() { 41412 if (!Event._interval) { 41413Event._interval = setInterval(Event._poll, Event.POLL_INTERVAL); 41414 } 41415 }, 41416 41417 /** 41418 * Executes the supplied callback when the item with the supplied 41419 * id is found. This is meant to be used to execute behavior as 41420 * soon as possible as the page loads. If you use this after the 41421 * initial page load it will poll for a fixed time for the element. 41422 * The number of times it will poll and the frequency are 41423 * configurable. By default it will poll for 10 seconds. 41424 * 41425 * <p>The callback is executed with a single parameter: 41426 * the custom object parameter, if provided.</p> 41427 * 41428 * @method onAvailable 41429 * 41430 * @param {string||string[]} id the id of the element, or an array 41431 * of ids to look for. 41432 * @param {function} fn what to execute when the element is found. 41433 * @param {object} p_obj an optional object to be passed back as 41434 * a parameter to fn. 41435 * @param {boolean|object} p_override If set to true, fn will execute 41436 * in the context of p_obj, if set to an object it 41437 * will execute in the context of that object 41438 * @param checkContent {boolean} check child node readiness (onContentReady) 41439 * @static 41440 * @deprecated Use Y.on("available") 41441 */ 41442 // @TODO fix arguments 41443 onAvailable: function(id, fn, p_obj, p_override, checkContent, compat) { 41444 41445 var a = Y.Array(id), i, availHandle; 41446 41447 for (i=0; i<a.length; i=i+1) { 41448 _avail.push({ 41449 id: a[i], 41450 fn: fn, 41451 obj: p_obj, 41452 override: p_override, 41453 checkReady: checkContent, 41454 compat: compat 41455 }); 41456 } 41457 _retryCount = this.POLL_RETRYS; 41458 41459 // We want the first test to be immediate, but async 41460 setTimeout(Event._poll, 0); 41461 41462 availHandle = new Y.EventHandle({ 41463 41464 _delete: function() { 41465 // set by the event system for lazy DOM listeners 41466 if (availHandle.handle) { 41467 availHandle.handle.detach(); 41468 return; 41469 } 41470 41471 var i, j; 41472 41473 // otherwise try to remove the onAvailable listener(s) 41474 for (i = 0; i < a.length; i++) { 41475 for (j = 0; j < _avail.length; j++) { 41476 if (a[i] === _avail[j].id) { 41477 _avail.splice(j, 1); 41478 } 41479 } 41480 } 41481 } 41482 41483 }); 41484 41485 return availHandle; 41486 }, 41487 41488 /** 41489 * Works the same way as onAvailable, but additionally checks the 41490 * state of sibling elements to determine if the content of the 41491 * available element is safe to modify. 41492 * 41493 * <p>The callback is executed with a single parameter:
41494 * the custom object parameter, if provided.</p> 41495 * 41496 * @method onContentReady 41497 * 41498 * @param {string} id the id of the element to look for. 41499 * @param {function} fn what to execute when the element is ready. 41500 * @param {object} obj an optional object to be passed back as 41501 * a parameter to fn. 41502 * @param {boolean|object} override If set to true, fn will execute 41503 * in the context of p_obj. If an object, fn will 41504 * exectute in the context of that object 41505 * 41506 * @static 41507 * @deprecated Use Y.on("contentready") 41508 */ 41509 // @TODO fix arguments 41510 onContentReady: function(id, fn, obj, override, compat) { 41511 return Event.onAvailable(id, fn, obj, override, true, compat); 41512 }, 41513 41514 /** 41515 * Adds an event listener 41516 * 41517 * @method attach 41518 * 41519 * @param {String} type The type of event to append 41520 * @param {Function} fn The method the event invokes 41521 * @param {String|HTMLElement|Array|NodeList} el An id, an element 41522 * reference, or a collection of ids and/or elements to assign the 41523 * listener to. 41524 * @param {Object} context optional context object 41525 * @param {Boolean|object} args 0..n arguments to pass to the callback 41526 * @return {EventHandle} an object to that can be used to detach the listener 41527 * 41528 * @static 41529 */ 41530 41531 attach: function(type, fn, el, context) { 41532 return Event._attach(Y.Array(arguments, 0, true)); 41533 }, 41534 41535 _createWrapper: function (el, type, capture, compat, facade) { 41536 41537 var cewrapper, 41538 ek = Y.stamp(el), 41539 key = 'event:' + ek + type; 41540 41541 if (false === facade) { 41542 key += 'native'; 41543 } 41544 if (capture) { 41545 key += 'capture'; 41546 } 41547 41548 41549 cewrapper = _wrappers[key]; 41550 41551 41552 if (!cewrapper) { 41553 // create CE wrapper 41554 cewrapper = Y.publish(key, { 41555 silent: true, 41556 bubbles: false, 41557 emitFacade:false, 41558 contextFn: function() { 41559 if (compat) { 41560 return cewrapper.el; 41561 } else { 41562 cewrapper.nodeRef = cewrapper.nodeRef || Y.one(cewrapper.el); 41563 return cewrapper.nodeRef; 41564 } 41565 } 41566 }); 41567 41568 cewrapper.overrides = {}; 41569 41570 // for later removeListener calls 41571 cewrapper.el = el; 41572 cewrapper.key = key; 41573 cewrapper.domkey = ek; 41574 cewrapper.type = type; 41575 cewrapper.fn = function(e) { 41576 cewrapper.fire(Event.getEvent(e, el, (compat || (false === facade)))); 41577 }; 41578 cewrapper.capture = capture; 41579 41580 if (el == win && type == "load") { 41581 // window load happens once 41582 cewrapper.fireOnce = true; 41583 _windowLoadKey = key; 41584 } 41585 cewrapper._delete = _deleteAndClean; 41586 41587 _wrappers[key] = cewrapper; 41588 _el_events[ek] = _el_events[ek] || {}; 41589 _el_events[ek][key] = cewrapper; 41590 41591 add(el, type, cewrapper.fn, capture); 41592 } 41593 41594 return cewrapper; 41595 41596 }, 41597 41598 _attach: function(args, conf) { 41599 41600 var compat, 41601 handles, oEl, cewrapper, context, 41602 fireNow = false, ret, 41603 type = args[0], 41604 fn = args[1], 41605 el = args[2] || win, 41606 facade = conf && conf.facade, 41607 capture = conf && conf.capture, 41608 overrides = conf && conf.overrides; 41609 41610 if (args[args.length-1] === COMPAT_ARG) { 41611 compat = true; 41612 } 41613 41614 if (!fn || !fn.call) { 41615 return false;
41616 } 41617 41618 // The el argument can be an array of elements or element ids. 41619 if (shouldIterate(el)) { 41620 41621 handles=[]; 41622 41623 Y.each(el, function(v, k) { 41624 args[2] = v; 41625 handles.push(Event._attach(args.slice(), conf)); 41626 }); 41627 41628 // return (handles.length === 1) ? handles[0] : handles; 41629 return new Y.EventHandle(handles); 41630 41631 // If the el argument is a string, we assume it is 41632 // actually the id of the element. If the page is loaded 41633 // we convert el to the actual element, otherwise we 41634 // defer attaching the event until the element is 41635 // ready 41636 } else if (Y.Lang.isString(el)) { 41637 41638 // oEl = (compat) ? Y.DOM.byId(el) : Y.Selector.query(el); 41639 41640 if (compat) { 41641 oEl = Y.DOM.byId(el); 41642 } else { 41643 41644 oEl = Y.Selector.query(el); 41645 41646 switch (oEl.length) { 41647 case 0: 41648 oEl = null; 41649 break; 41650 case 1: 41651 oEl = oEl[0]; 41652 break; 41653 default: 41654 args[2] = oEl; 41655 return Event._attach(args, conf); 41656 } 41657 } 41658 41659 if (oEl) { 41660 41661 el = oEl; 41662 41663 // Not found = defer adding the event until the element is available 41664 } else { 41665 41666 ret = Event.onAvailable(el, function() { 41667 41668 ret.handle = Event._attach(args, conf); 41669 41670 }, Event, true, false, compat); 41671 41672 return ret; 41673 41674 } 41675 } 41676 41677 // Element should be an html element or node 41678 if (!el) { 41679 return false; 41680 } 41681 41682 if (Y.Node && Y.instanceOf(el, Y.Node)) { 41683 el = Y.Node.getDOMNode(el); 41684 } 41685 41686 cewrapper = Event._createWrapper(el, type, capture, compat, facade); 41687 if (overrides) { 41688 Y.mix(cewrapper.overrides, overrides); 41689 } 41690 41691 if (el == win && type == "load") { 41692 41693 // if the load is complete, fire immediately. 41694 // all subscribers, including the current one 41695 // will be notified. 41696 if (YUI.Env.windowLoaded) { 41697 fireNow = true; 41698 } 41699 } 41700 41701 if (compat) { 41702 args.pop(); 41703 } 41704 41705 context = args[3]; 41706 41707 // set context to the Node if not specified 41708 // ret = cewrapper.on.apply(cewrapper, trimmedArgs); 41709 ret = cewrapper._on(fn, context, (args.length > 4) ? args.slice(4) : null); 41710 41711 if (fireNow) { 41712 cewrapper.fire(); 41713 } 41714 41715 return ret; 41716 41717 }, 41718 41719 /** 41720 * Removes an event listener. Supports the signature the event was bound 41721 * with, but the preferred way to remove listeners is using the handle 41722 * that is returned when using Y.on 41723 * 41724 * @method detach 41725 * 41726 * @param {String} type the type of event to remove. 41727 * @param {Function} fn the method the event invokes. If fn is 41728 * undefined, then all event handlers for the type of event are 41729 * removed. 41730 * @param {String|HTMLElement|Array|NodeList|EventHandle} el An 41731 * event handle, an id, an element reference, or a collection 41732 * of ids and/or elements to remove the listener from. 41733 * @return {boolean} true if the unbind was successful, false otherwise. 41734 * @static 41735 */ 41736 detach: function(type, fn, el, obj) { 41737 41738 var args=Y.Array(arguments, 0, true), compat, l, ok, i, 41739 id, ce; 41740 41741 if (args[args.length-1] === COMPAT_ARG) { 41742 compat = true; 41743 // args.pop(); 41744 } 41745 41746 if (type && type.detach) { 41747 return type.detach(); 41748 } 41749 41750 // The el argument can be a string 41751 if (typeof el == "string") { 41752 41753 // el = (compat) ? Y.DOM.byId(el) : Y.all(el); 41754 if (compat) { 41755 el = Y.DOM.byId(el); 41756 } else { 41757 el = Y.Selector.query(el); 41758 l = el.length; 41759 if (l < 1) { 41760 el = null; 41761 } else if (l == 1) { 41762 el = el[0]; 41763 } 41764 } 41765 // return Event.detach.apply(Event, args); 41766 } 41767 41768 if (!el) { 41769 return false;
41770 } 41771 41772 if (el.detach) { 41773 args.splice(2, 1); 41774 return el.detach.apply(el, args); 41775 // The el argument can be an array of elements or element ids. 41776 } else if (shouldIterate(el)) { 41777 ok = true; 41778 for (i=0, l=el.length; i<l; ++i) { 41779 args[2] = el[i]; 41780 ok = ( Y.Event.detach.apply(Y.Event, args) && ok ); 41781 } 41782 41783 return ok; 41784 } 41785 41786 if (!type || !fn || !fn.call) { 41787 return Event.purgeElement(el, false, type); 41788 } 41789 41790 id = 'event:' + Y.stamp(el) + type; 41791 ce = _wrappers[id]; 41792 41793 if (ce) { 41794 return ce.detach(fn); 41795 } else { 41796 return false; 41797 } 41798 41799 }, 41800 41801 /** 41802 * Finds the event in the window object, the caller's arguments, or 41803 * in the arguments of another method in the callstack. This is 41804 * executed automatically for events registered through the event 41805 * manager, so the implementer should not normally need to execute 41806 * this function at all. 41807 * @method getEvent 41808 * @param {Event} e the event parameter from the handler 41809 * @param {HTMLElement} el the element the listener was attached to 41810 * @return {Event} the event 41811 * @static 41812 */ 41813 getEvent: function(e, el, noFacade) { 41814 var ev = e || win.event; 41815 41816 return (noFacade) ? ev : 41817 new Y.DOMEventFacade(ev, el, _wrappers['event:' + Y.stamp(el) + e.type]); 41818 }, 41819 41820 /** 41821 * Generates an unique ID for the element if it does not already 41822 * have one. 41823 * @method generateId 41824 * @param el the element to create the id for 41825 * @return {string} the resulting id of the element 41826 * @static 41827 */ 41828 generateId: function(el) { 41829 return Y.DOM.generateID(el); 41830 }, 41831 41832 /** 41833 * We want to be able to use getElementsByTagName as a collection 41834 * to attach a group of events to. Unfortunately, different 41835 * browsers return different types of collections. This function 41836 * tests to determine if the object is array-like. It will also 41837 * fail if the object is an array, but is empty. 41838 * @method _isValidCollection 41839 * @param o the object to test 41840 * @return {boolean} true if the object is array-like and populated 41841 * @deprecated was not meant to be used directly 41842 * @static 41843 * @private 41844 */ 41845 _isValidCollection: shouldIterate, 41846 41847 /** 41848 * hook up any deferred listeners 41849 * @method _load 41850 * @static 41851 * @private 41852 */ 41853 _load: function(e) { 41854 if (!_loadComplete) { 41855 _loadComplete = true; 41856 41857 // Just in case DOMReady did not go off for some reason 41858 // E._ready(); 41859 if (Y.fire) { 41860 Y.fire(EVENT_READY); 41861 } 41862 41863 // Available elements may not have been detected before the 41864 // window load event fires. Try to find them now so that the 41865 // the user is more likely to get the onAvailable notifications 41866 // before the window load notification 41867 Event._poll(); 41868 } 41869 }, 41870 41871 /** 41872 * Polling function that runs before the onload event fires, 41873 * attempting to attach to DOM Nodes as soon as they are 41874 * available 41875 * @method _poll 41876 * @static 41877 * @private 41878 */ 41879 _poll: function() { 41880 if (Event.locked) { 41881 return; 41882 } 41883 41884 if (Y.UA.ie && !YUI.Env.DOMReady) { 41885 // Hold off if DOMReady has not fired and check current 41886 // readyState to protect against the IE operation aborted 41887 // issue. 41888 Event.startInterval(); 41889 return; 41890 } 41891 41892 Event.locked = true; 41893 41894 // keep trying until after the page is loaded. We need to 41895 // check the page load state prior to trying to bind the 41896 // elements so that we can be certain all elements have been 41897 // tested appropriately 41898 var i, len, item, el, notAvail, executeItem, 41899 tryAgain = !_loadComplete; 41900 41901 if (!tryAgain) { 41902 tryAgain = (_retryCount > 0); 41903 } 41904 41905 // onAvailable 41906 notAvail = []; 41907 41908 executeItem = function (el, item) { 41909 var context, ov = item.override; 41910 try { 41911 if (item.compat) { 41912 if (item.override) { 41913 if (ov === true) { 41914 context = item.obj; 41915 } else { 41916 context = ov; 41917 } 41918 } else { 41919 context = el; 41920 } 41921 item.fn.call(context, item.obj); 41922 } else { 41923 context = item.obj || Y.one(el); 41924 item.fn.apply(context, (Y.Lang.isArray(ov)) ? ov : []); 41925 } 41926 } catch (e) { 41927 } 41928 }; 41929 41930 // onAvailable 41931 for (i=0,len=_avail.length; i<len; ++i) { 41932 item = _avail[i]; 41933 if (item && !item.checkReady) { 41934 41935 // el = (item.compat) ? Y.DOM.byId(item.id) : Y.one(item.id); 41936 el = (item.compat) ? Y.DOM.byId(item.id) : Y.Selector.query(item.id, null, true); 41937 41938 if (el) { 41939 executeItem(el, item); 41940 _avail[i] = null; 41941 } else { 41942 notAvail.push(item); 41943 } 41944 } 41945 } 41946 41947 // onContentReady 41948 for (i=0,len=_avail.length; i<len; ++i) { 41949 item = _avail[i]; 41950 if (item && item.checkReady) { 41951 41952 // el = (item.compat) ? Y.DOM.byId(item.id) : Y.one(item.id); 41953 el = (item.compat) ? Y.DOM.byId(item.id) : Y.Selector.query(item.id, null, true); 41954 41955 if (el) { 41956 // The element is available, but not necessarily ready 41957 // @todo should we test parentNode.nextSibling? 41958 if (_loadComplete || (el.get && el.get('nextSibling')) || el.nextSibling) { 41959 executeItem(el, item); 41960 _avail[i] = null; 41961 } 41962 } else { 41963 notAvail.push(item); 41964 } 41965 } 41966 } 41967 41968 _retryCount = (notAvail.length === 0) ? 0 : _retryCount - 1; 41969 41970 if (tryAgain) { 41971 // we may need to strip the nulled out items here 41972 Event.startInterval(); 41973 } else { 41974 clearInterval(Event._interval); 41975 Event._interval = null; 41976 } 41977 41978 Event.locked = false;
41979 41980 return; 41981 41982 }, 41983 41984 /** 41985 * Removes all listeners attached to the given element via addListener. 41986 * Optionally, the node's children can also be purged. 41987 * Optionally, you can specify a specific type of event to remove. 41988 * @method purgeElement 41989 * @param {HTMLElement} el the element to purge 41990 * @param {boolean} recurse recursively purge this element's children 41991 * as well. Use with caution. 41992 * @param {string} type optional type of listener to purge. If 41993 * left out, all listeners will be removed 41994 * @static 41995 */ 41996 purgeElement: function(el, recurse, type) { 41997 // var oEl = (Y.Lang.isString(el)) ? Y.one(el) : el, 41998 var oEl = (Y.Lang.isString(el)) ? Y.Selector.query(el, null, true) : el, 41999 lis = Event.getListeners(oEl, type), i, len, children, child; 42000 42001 if (recurse && oEl) { 42002 lis = lis || []; 42003 children = Y.Selector.query('*', oEl); 42004 len = children.length; 42005 for (i = 0; i < len; ++i) { 42006 child = Event.getListeners(children[i], type); 42007 if (child) { 42008 lis = lis.concat(child); 42009 } 42010 } 42011 } 42012 42013 if (lis) { 42014 for (i = 0, len = lis.length; i < len; ++i) { 42015 lis[i].detachAll(); 42016 } 42017 } 42018 42019 }, 42020 42021 /** 42022 * Removes all object references and the DOM proxy subscription for 42023 * a given event for a DOM node. 42024 * 42025 * @method _clean 42026 * @param wrapper {CustomEvent} Custom event proxy for the DOM 42027 * subscription 42028 * @private 42029 * @static 42030 * @since 3.4.0 42031 */ 42032 _clean: function (wrapper) { 42033 var key = wrapper.key, 42034 domkey = wrapper.domkey; 42035 42036 remove(wrapper.el, wrapper.type, wrapper.fn, wrapper.capture); 42037 delete _wrappers[key]; 42038 delete Y._yuievt.events[key]; 42039 if (_el_events[domkey]) { 42040 delete _el_events[domkey][key]; 42041 if (!Y.Object.size(_el_events[domkey])) { 42042 delete _el_events[domkey]; 42043 } 42044 } 42045 }, 42046 42047 /** 42048 * Returns all listeners attached to the given element via addListener. 42049 * Optionally, you can specify a specific type of event to return. 42050 * @method getListeners 42051 * @param el {HTMLElement|string} the element or element id to inspect 42052 * @param type {string} optional type of listener to return. If 42053 * left out, all listeners will be returned 42054 * @return {CustomEvent} the custom event wrapper for the DOM event(s) 42055 * @static 42056 */ 42057 getListeners: function(el, type) { 42058 var ek = Y.stamp(el, true), evts = _el_events[ek], 42059 results=[] , key = (type) ? 'event:' + ek + type : null, 42060 adapters = _eventenv.plugins; 42061 42062 if (!evts) { 42063 return null; 42064 } 42065 42066 if (key) { 42067 // look for synthetic events 42068 if (adapters[type] && adapters[type].eventDef) { 42069 key += '_synth'; 42070 } 42071 42072 if (evts[key]) { 42073 results.push(evts[key]); 42074 } 42075 42076 // get native events as well 42077 key += 'native'; 42078 if (evts[key]) { 42079 results.push(evts[key]); 42080 } 42081 42082 } else { 42083 Y.each(evts, function(v, k) { 42084 results.push(v); 42085 }); 42086 } 42087 42088 return (results.length) ? results : null; 42089 }, 42090 42091 /** 42092 * Removes all listeners registered by pe.event. Called 42093 * automatically during the unload event. 42094 * @method _unload 42095 * @static 42096 * @private 42097 */ 42098 _unload: function(e) { 42099 Y.each(_wrappers, function(v, k) { 42100 if (v.type == 'unload') { 42101 v.fire(e); 42102 } 42103 v.detachAll(); 42104 }); 42105 remove(win, "unload", onUnload); 42106 }, 42107 42108 /** 42109 * Adds a DOM event directly without the caching, cleanup, context adj, etc 42110 *
42111 * @method nativeAdd 42112 * @param {HTMLElement} el the element to bind the handler to 42113 * @param {string} type the type of event handler 42114 * @param {function} fn the callback to invoke 42115 * @param {Boolean} capture capture or bubble phase 42116 * @static 42117 * @private 42118 */ 42119 nativeAdd: add, 42120 42121 /** 42122 * Basic remove listener 42123 * 42124 * @method nativeRemove 42125 * @param {HTMLElement} el the element to bind the handler to 42126 * @param {string} type the type of event handler 42127 * @param {function} fn the callback to invoke 42128 * @param {Boolean} capture capture or bubble phase 42129 * @static 42130 * @private 42131 */ 42132 nativeRemove: remove 42133 }; 42134 42135}(); 42136 42137Y.Event = Event; 42138 42139if (config.injected || YUI.Env.windowLoaded) { 42140 onLoad(); 42141} else { 42142 add(win, "load", onLoad); 42143} 42144 42145// Process onAvailable/onContentReady items when when the DOM is ready in IE 42146if (Y.UA.ie) { 42147 Y.on(EVENT_READY, Event._poll); 42148 42149 // In IE6 and below, detach event handlers when the page is unloaded in 42150 // order to try and prevent cross-page memory leaks. This isn't done in 42151 // other browsers because a) it's not necessary, and b) it breaks the 42152 // back/forward cache. 42153 if (Y.UA.ie < 7) { 42154 try { 42155 add(win, "unload", onUnload); 42156 } catch(e) { 42157 } 42158 } 42159} 42160 42161Event.Custom = Y.CustomEvent; 42162Event.Subscriber = Y.Subscriber; 42163Event.Target = Y.EventTarget; 42164Event.Handle = Y.EventHandle; 42165Event.Facade = Y.EventFacade; 42166 42167Event._poll(); 42168 42169}()); 42170 42171/** 42172 * DOM event listener abstraction layer 42173 * @module event 42174 * @submodule event-base 42175 */ 42176 42177/** 42178 * Executes the callback as soon as the specified element 42179 * is detected in the DOM. This function expects a selector 42180 * string for the element(s) to detect. If you already have 42181 * an element reference, you don't need this event. 42182 * @event available 42183 * @param type {string} 'available' 42184 * @param fn {function} the callback function to execute. 42185 * @param el {string} an selector for the element(s) to attach 42186 * @param context optional argument that specifies what 'this' refers to. 42187 * @param args* 0..n additional arguments to pass on to the callback function. 42188 * These arguments will be added after the event object. 42189 * @return {EventHandle} the detach handle 42190 * @for YUI 42191 */ 42192Y.Env.evt.plugins.available = { 42193 on: function(type, fn, id, o) { 42194 var a = arguments.length > 4 ? Y.Array(arguments, 4, true) : null; 42195 return Y.Event.onAvailable.call(Y.Event, id, fn, o, a); 42196 } 42197}; 42198 42199/** 42200 * Executes the callback as soon as the specified element 42201 * is detected in the DOM with a nextSibling property 42202 * (indicating that the element's children are available). 42203 * This function expects a selector 42204 * string for the element(s) to detect. If you already have 42205 * an element reference, you don't need this event. 42206 * @event contentready 42207 * @param type {string} 'contentready' 42208 * @param fn {function} the callback function to execute. 42209 * @param el {string} an selector for the element(s) to attach. 42210 * @param context optional argument that specifies what 'this' refers to. 42211 * @param args* 0..n additional arguments to pass on to the callback function. 42212 * These arguments will be added after the event object. 42213 * @return {EventHandle} the detach handle 42214 * @for YUI 42215 */ 42216Y.Env.evt.plugins.contentready = { 42217 on: function(type, fn, id, o) { 42218 var a = arguments.length > 4 ? Y.Array(arguments, 4, true) : null; 42219 return Y.Event.onContentReady.call(Y.Event, id, fn, o, a); 42220 } 42221}; 42222 42223 42224}, 'patched-v3.18.1', {"requires": ["event-custom-base"]}); 42225 42226YUI.add('event-custom-base', function (Y, NAME) { 42227 42228/** 42229 * Custom event engine, DOM event listener abstraction layer, synthetic DOM 42230 * events. 42231 * @module event-custom 42232 */ 42233 42234Y.Env.evt = { 42235 handles: {}, 42236 plugins: {} 42237}; 42238 42239/** 42240 * Custom event engine, DOM event listener abstraction layer, synthetic DOM 42241 * events. 42242 * @module event-custom 42243 * @submodule event-custom-base 42244 */ 42245 42246/** 42247 * Allows for the insertion of methods that are executed before or after 42248 * a specified method 42249 * @class Do 42250 * @static 42251 */ 42252 42253var DO_BEFORE = 0, 42254 DO_AFTER = 1, 42255 42256DO = { 42257 42258 /** 42259 * Cache of objects touched by the utility 42260 * @property objs 42261 * @static 42262 * @deprecated Since 3.6.0. The `_yuiaop` property on the AOP'd object 42263 * replaces the role of this property, but is considered to be private, and 42264 * is only mentioned to provide a migration path. 42265 * 42266 * If you have a use case which warrants migration to the _yuiaop property,
42267 * please file a ticket to let us know what it's used for and we can see if 42268 * we need to expose hooks for that functionality more formally. 42269 */ 42270 objs: null, 42271 42272 /** 42273 * <p>Execute the supplied method before the specified function. Wrapping 42274 * function may optionally return an instance of the following classes to 42275 * further alter runtime behavior:</p> 42276 * <dl> 42277 * <dt></code>Y.Do.Halt(message, returnValue)</code></dt> 42278 * <dd>Immediatly stop execution and return 42279 * <code>returnValue</code>. No other wrapping functions will be 42280 * executed.</dd> 42281 * <dt></code>Y.Do.AlterArgs(message, newArgArray)</code></dt> 42282 * <dd>Replace the arguments that the original function will be 42283 * called with.</dd> 42284 * <dt></code>Y.Do.Prevent(message)</code></dt> 42285 * <dd>Don't execute the wrapped function. Other before phase 42286 * wrappers will be executed.</dd> 42287 * </dl> 42288 * 42289 * @method before 42290 * @param fn {Function} the function to execute 42291 * @param obj the object hosting the method to displace 42292 * @param sFn {string} the name of the method to displace 42293 * @param c The execution context for fn 42294 * @param arg* {mixed} 0..n additional arguments to supply to the subscriber 42295 * when the event fires. 42296 * @return {EventHandle} handle for the subscription 42297 * @static 42298 */ 42299 before: function(fn, obj, sFn, c) { 42300 var f = fn, a; 42301 if (c) { 42302 a = [fn, c].concat(Y.Array(arguments, 4, true)); 42303 f = Y.rbind.apply(Y, a); 42304 } 42305 42306 return this._inject(DO_BEFORE, f, obj, sFn); 42307 }, 42308 42309 /** 42310 * <p>Execute the supplied method after the specified function. Wrapping 42311 * function may optionally return an instance of the following classes to 42312 * further alter runtime behavior:</p> 42313 * <dl> 42314 * <dt></code>Y.Do.Halt(message, returnValue)</code></dt> 42315 * <dd>Immediatly stop execution and return 42316 * <code>returnValue</code>. No other wrapping functions will be 42317 * executed.</dd> 42318 * <dt></code>Y.Do.AlterReturn(message, returnValue)</code></dt> 42319 * <dd>Return <code>returnValue</code> instead of the wrapped 42320 * method's original return value. This can be further altered by 42321 * other after phase wrappers.</dd> 42322 * </dl> 42323 * 42324 * <p>The static properties <code>Y.Do.originalRetVal</code> and 42325 * <code>Y.Do.currentRetVal</code> will be populated for reference.</p> 42326 * 42327 * @method after 42328 * @param fn {Function} the function to execute 42329 * @param obj the object hosting the method to displace 42330 * @param sFn {string} the name of the method to displace 42331 * @param c The execution context for fn 42332 * @param arg* {mixed} 0..n additional arguments to supply to the subscriber 42333 * @return {EventHandle} handle for the subscription 42334 * @static 42335 */ 42336 after: function(fn, obj, sFn, c) { 42337 var f = fn, a; 42338 if (c) { 42339 a = [fn, c].concat(Y.Array(arguments, 4, true)); 42340 f = Y.rbind.apply(Y, a); 42341 } 42342 42343 return this._inject(DO_AFTER, f, obj, sFn); 42344 }, 42345 42346 /** 42347 * Execute the supplied method before or after the specified function. 42348 * Used by <code>before</code> and <code>after</code>. 42349 * 42350 * @method _inject 42351 * @param when {string} before or after 42352 * @param fn {Function} the function to execute 42353 * @param obj the object hosting the method to displace 42354 * @param sFn {string} the name of the method to displace 42355 * @param c The execution context for fn 42356 * @return {EventHandle} handle for the subscription 42357 * @private 42358 * @static 42359 */ 42360 _inject: function(when, fn, obj, sFn) { 42361 // object id 42362 var id = Y.stamp(obj), o, sid; 42363 42364 if (!obj._yuiaop) { 42365 // create a map entry for the obj if it doesn't exist, to hold overridden methods 42366 obj._yuiaop = {}; 42367 } 42368 42369 o = obj._yuiaop; 42370 42371 if (!o[sFn]) { 42372 // create a map entry for the method if it doesn't exist 42373 o[sFn] = new Y.Do.Method(obj, sFn); 42374 42375 // re-route the method to our wrapper 42376 obj[sFn] = function() { 42377 return o[sFn].exec.apply(o[sFn], arguments); 42378 }; 42379 } 42380 42381 // subscriber id 42382 sid = id + Y.stamp(fn) + sFn; 42383 42384 // register the callback 42385 o[sFn].register(sid, fn, when); 42386 42387 return new Y.EventHandle(o[sFn], sid); 42388 }, 42389 42390 /** 42391 * Detach a before or after subscription. 42392 * 42393 * @method detach 42394 * @param handle {EventHandle} the subscription handle 42395 * @static 42396 */ 42397 detach: function(handle) { 42398 if (handle.detach) { 42399 handle.detach(); 42400 } 42401 } 42402}; 42403 42404Y.Do = DO; 42405 42406////////////////////////////////////////////////////////////////////////// 42407 42408/** 42409 * Contains the return value from the wrapped method, accessible 42410 * by 'after' event listeners. 42411 * 42412 * @property originalRetVal 42413 * @static 42414 * @since 3.2.0 42415 */ 42416
42417/** 42418 * Contains the current state of the return value, consumable by 42419 * 'after' event listeners, and updated if an after subscriber 42420 * changes the return value generated by the wrapped function. 42421 * 42422 * @property currentRetVal 42423 * @static 42424 * @since 3.2.0 42425 */ 42426 42427////////////////////////////////////////////////////////////////////////// 42428 42429/** 42430 * Wrapper for a displaced method with aop enabled 42431 * @class Do.Method 42432 * @constructor 42433 * @param obj The object to operate on 42434 * @param sFn The name of the method to displace 42435 */ 42436DO.Method = function(obj, sFn) { 42437 this.obj = obj; 42438 this.methodName = sFn; 42439 this.method = obj[sFn]; 42440 this.before = {}; 42441 this.after = {}; 42442}; 42443 42444/** 42445 * Register a aop subscriber 42446 * @method register 42447 * @param sid {string} the subscriber id 42448 * @param fn {Function} the function to execute 42449 * @param when {string} when to execute the function 42450 */ 42451DO.Method.prototype.register = function (sid, fn, when) { 42452 if (when) { 42453 this.after[sid] = fn; 42454 } else { 42455 this.before[sid] = fn; 42456 } 42457}; 42458 42459/** 42460 * Unregister a aop subscriber 42461 * @method delete 42462 * @param sid {string} the subscriber id 42463 * @param fn {Function} the function to execute 42464 * @param when {string} when to execute the function 42465 */ 42466DO.Method.prototype._delete = function (sid) { 42467 delete this.before[sid]; 42468 delete this.after[sid]; 42469}; 42470 42471/** 42472 * <p>Execute the wrapped method. All arguments are passed into the wrapping 42473 * functions. If any of the before wrappers return an instance of 42474 * <code>Y.Do.Halt</code> or <code>Y.Do.Prevent</code>, neither the wrapped 42475 * function nor any after phase subscribers will be executed.</p> 42476 * 42477 * <p>The return value will be the return value of the wrapped function or one 42478 * provided by a wrapper function via an instance of <code>Y.Do.Halt</code> or 42479 * <code>Y.Do.AlterReturn</code>. 42480 * 42481 * @method exec 42482 * @param arg* {any} Arguments are passed to the wrapping and wrapped functions 42483 * @return {any} Return value of wrapped function unless overwritten (see above) 42484 */ 42485DO.Method.prototype.exec = function () { 42486 42487 var args = Y.Array(arguments, 0, true), 42488 i, ret, newRet, 42489 bf = this.before, 42490 af = this.after, 42491 prevented = false; 42492 42493 // execute before 42494 for (i in bf) { 42495 if (bf.hasOwnProperty(i)) { 42496 ret = bf[i].apply(this.obj, args); 42497 if (ret) { 42498 switch (ret.constructor) { 42499 case DO.Halt: 42500 return ret.retVal; 42501 case DO.AlterArgs: 42502 args = ret.newArgs; 42503 break; 42504 case DO.Prevent: 42505 prevented = true; 42506 break; 42507 default: 42508 } 42509 } 42510 } 42511 } 42512 42513 // execute method 42514 if (!prevented) { 42515 ret = this.method.apply(this.obj, args); 42516 } 42517 42518 DO.originalRetVal = ret; 42519 DO.currentRetVal = ret; 42520 42521 // execute after methods. 42522 for (i in af) { 42523 if (af.hasOwnProperty(i)) { 42524 newRet = af[i].apply(this.obj, args); 42525 // Stop processing if a Halt object is returned 42526 if (newRet && newRet.constructor === DO.Halt) { 42527 return newRet.retVal; 42528 // Check for a new return value 42529 } else if (newRet && newRet.constructor === DO.AlterReturn) { 42530 ret = newRet.newRetVal; 42531 // Update the static retval state 42532 DO.currentRetVal = ret; 42533 } 42534 } 42535 } 42536 42537 return ret; 42538}; 42539 42540////////////////////////////////////////////////////////////////////////// 42541 42542/** 42543 * Return an AlterArgs object when you want to change the arguments that 42544 * were passed into the function. Useful for Do.before subscribers. An 42545 * example would be a service that scrubs out illegal characters prior to 42546 * executing the core business logic. 42547 * @class Do.AlterArgs 42548 * @constructor 42549 * @param msg {String} (optional) Explanation of the altered return value 42550 * @param newArgs {Array} Call parameters to be used for the original method 42551 * instead of the arguments originally passed in. 42552 */ 42553DO.AlterArgs = function(msg, newArgs) { 42554 this.msg = msg; 42555 this.newArgs = newArgs; 42556}; 42557 42558/** 42559 * Return an AlterReturn object when you want to change the result returned 42560 * from the core method to the caller. Useful for Do.after subscribers. 42561 * @class Do.AlterReturn 42562 * @constructor 42563 * @param msg {String} (optional) Explanation of the altered return value 42564 * @param newRetVal {any} Return value passed to code that invoked the wrapped 42565 * function. 42566 */ 42567DO.AlterReturn = function(msg, newRetVal) { 42568 this.msg = msg; 42569 this.newRetVal = newRetVal; 42570}; 42571 42572/** 42573 * Return a Halt object when you want to terminate the execution 42574 * of all subsequent subscribers as well as the wrapped method 42575 * if it has not exectued yet. Useful for Do.before subscribers. 42576 * @class Do.Halt 42577 * @constructor 42578 * @param msg {String} (optional) Explanation of why the termination was done 42579 * @param retVal {any} Return value passed to code that invoked the wrapped 42580 * function. 42581 */ 42582DO.Halt = function(msg, retVal) { 42583 this.msg = msg; 42584 this.retVal = retVal; 42585}; 42586 42587/** 42588 * Return a Prevent object when you want to prevent the wrapped function 42589 * from executing, but want the remaining listeners to execute. Useful 42590 * for Do.before subscribers. 42591 * @class Do.Prevent 42592 * @constructor 42593 * @param msg {String} (optional) Explanation of why the termination was done 42594 */ 42595DO.Prevent = function(msg) { 42596 this.msg = msg; 42597}; 42598 42599/** 42600 * Return an Error object when you want to terminate the execution 42601 * of all subsequent method calls. 42602 * @class Do.Error 42603 * @constructor 42604 * @param msg {String} (optional) Explanation of the altered return value 42605 * @param retVal {any} Return value passed to code that invoked the wrapped 42606 * function. 42607 * @deprecated use Y.Do.Halt or Y.Do.Prevent 42608 */ 42609DO.Error = DO.Halt; 42610 42611
42612////////////////////////////////////////////////////////////////////////// 42613 42614/** 42615 * Custom event engine, DOM event listener abstraction layer, synthetic DOM 42616 * events. 42617 * @module event-custom 42618 * @submodule event-custom-base 42619 */ 42620 42621 42622// var onsubscribeType = "_event:onsub", 42623var YArray = Y.Array, 42624 42625 AFTER = 'after', 42626 CONFIGS = [ 42627 'broadcast', 42628 'monitored', 42629 'bubbles', 42630 'context', 42631 'contextFn', 42632 'currentTarget', 42633 'defaultFn', 42634 'defaultTargetOnly', 42635 'details', 42636 'emitFacade', 42637 'fireOnce', 42638 'async', 42639 'host', 42640 'preventable', 42641 'preventedFn', 42642 'queuable', 42643 'silent', 42644 'stoppedFn', 42645 'target', 42646 'type' 42647 ], 42648 42649 CONFIGS_HASH = YArray.hash(CONFIGS), 42650 42651 nativeSlice = Array.prototype.slice, 42652 42653 YUI3_SIGNATURE = 9, 42654 YUI_LOG = 'yui:log', 42655 42656 mixConfigs = function(r, s, ov) { 42657 var p; 42658 42659 for (p in s) { 42660 if (CONFIGS_HASH[p] && (ov || !(p in r))) { 42661 r[p] = s[p]; 42662 } 42663 } 42664 42665 return r; 42666 }; 42667 42668/** 42669 * The CustomEvent class lets you define events for your application 42670 * that can be subscribed to by one or more independent component. 42671 * 42672 * @param {String} type The type of event, which is passed to the callback 42673 * when the event fires. 42674 * @param {object} defaults configuration object. 42675 * @class CustomEvent 42676 * @constructor 42677 */ 42678 42679 /** 42680 * The type of event, returned to subscribers when the event fires 42681 * @property type 42682 * @type string 42683 */ 42684 42685/** 42686 * By default all custom events are logged in the debug build, set silent 42687 * to true to disable debug outpu for this event. 42688 * @property silent 42689 * @type boolean 42690 */ 42691 42692Y.CustomEvent = function(type, defaults) { 42693 42694 this._kds = Y.CustomEvent.keepDeprecatedSubs; 42695 42696 this.id = Y.guid(); 42697 42698 this.type = type; 42699 this.silent = this.logSystem = (type === YUI_LOG); 42700 42701 if (this._kds) { 42702 /** 42703 * The subscribers to this event 42704 * @property subscribers 42705 * @type Subscriber {} 42706 * @deprecated 42707 */ 42708 42709 /** 42710 * 'After' subscribers 42711 * @property afters 42712 * @type Subscriber {} 42713 * @deprecated 42714 */ 42715 this.subscribers = {}; 42716 this.afters = {}; 42717 } 42718 42719 if (defaults) { 42720 mixConfigs(this, defaults, true); 42721 } 42722}; 42723 42724/** 42725 * Static flag to enable population of the <a href="#property_subscribers">`subscribers`</a> 42726 * and <a href="#property_subscribers">`afters`</a> properties held on a `CustomEvent` instance. 42727 * 42728 * These properties were changed to private properties (`_subscribers` and `_afters`), and 42729 * converted from objects to arrays for performance reasons. 42730 * 42731 * Setting this property to true will populate the deprecated `subscribers` and `afters` 42732 * properties for people who may be using them (which is expected to be rare). There will 42733 * be a performance hit, compared to the new array based implementation. 42734 * 42735 * If you are using these deprecated properties for a use case which the public API 42736 * does not support, please file an enhancement request, and we can provide an alternate 42737 * public implementation which doesn't have the performance cost required to maintiain the 42738 * properties as objects. 42739 * 42740 * @property keepDeprecatedSubs 42741 * @static 42742 * @for CustomEvent 42743 * @type boolean 42744 * @default false 42745 * @deprecated 42746 */ 42747Y.CustomEvent.keepDeprecatedSubs = false; 42748 42749Y.CustomEvent.mixConfigs = mixConfigs; 42750 42751Y.CustomEvent.prototype = { 42752 42753 constructor: Y.CustomEvent, 42754 42755 /** 42756 * Monitor when an event is attached or detached. 42757 * 42758 * @property monitored 42759 * @type boolean 42760 */ 42761 42762 /** 42763 * If 0, this event does not broadcast. If 1, the YUI instance is notified 42764 * every time this event fires. If 2, the YUI instance and the YUI global 42765 * (if event is enabled on the global) are notified every time this event 42766 * fires. 42767 * @property broadcast 42768 * @type int 42769 */ 42770 42771 /** 42772 * Specifies whether this event should be queued when the host is actively 42773 * processing an event. This will effect exectution order of the callbacks 42774 * for the various events. 42775 * @property queuable 42776 * @type boolean 42777 * @default false 42778 */ 42779 42780 /** 42781 * This event has fired if true 42782 * 42783 * @property fired 42784 * @type boolean 42785 * @default false; 42786 */ 42787 42788 /** 42789 * An array containing the arguments the custom event 42790 * was last fired with. 42791 * @property firedWith 42792 * @type Array 42793 */ 42794 42795 /** 42796 * This event should only fire one time if true, and if 42797 * it has fired, any new subscribers should be notified 42798 * immediately. 42799 * 42800 * @property fireOnce 42801 * @type boolean 42802 * @default false; 42803 */ 42804 42805 /** 42806 * fireOnce listeners will fire syncronously unless async 42807 * is set to true 42808 * @property async 42809 * @type boolean 42810 * @default false 42811 */ 42812 42813 /** 42814 * Flag for stopPropagation that is modified during fire() 42815 * 1 means to stop propagation to bubble targets. 2 means
42816 * to also stop additional subscribers on this target. 42817 * @property stopped 42818 * @type int 42819 */ 42820 42821 /** 42822 * Flag for preventDefault that is modified during fire(). 42823 * if it is not 0, the default behavior for this event 42824 * @property prevented 42825 * @type int 42826 */ 42827 42828 /** 42829 * Specifies the host for this custom event. This is used 42830 * to enable event bubbling 42831 * @property host 42832 * @type EventTarget 42833 */ 42834 42835 /** 42836 * The default function to execute after event listeners 42837 * have fire, but only if the default action was not 42838 * prevented. 42839 * @property defaultFn 42840 * @type Function 42841 */ 42842 42843 /** 42844 * Flag for the default function to execute only if the 42845 * firing event is the current target. This happens only 42846 * when using custom event delegation and setting the 42847 * flag to `true` mimics the behavior of event delegation 42848 * in the DOM. 42849 * 42850 * @property defaultTargetOnly 42851 * @type Boolean 42852 * @default false 42853 */ 42854 42855 /** 42856 * The function to execute if a subscriber calls 42857 * stopPropagation or stopImmediatePropagation 42858 * @property stoppedFn 42859 * @type Function 42860 */ 42861 42862 /** 42863 * The function to execute if a subscriber calls 42864 * preventDefault 42865 * @property preventedFn 42866 * @type Function 42867 */ 42868 42869 /** 42870 * The subscribers to this event 42871 * @property _subscribers 42872 * @type Subscriber [] 42873 * @private 42874 */ 42875 42876 /** 42877 * 'After' subscribers 42878 * @property _afters 42879 * @type Subscriber [] 42880 * @private 42881 */ 42882 42883 /** 42884 * If set to true, the custom event will deliver an EventFacade object 42885 * that is similar to a DOM event object. 42886 * @property emitFacade 42887 * @type boolean 42888 * @default false 42889 */ 42890 42891 /** 42892 * Supports multiple options for listener signatures in order to 42893 * port YUI 2 apps. 42894 * @property signature 42895 * @type int 42896 * @default 9 42897 */ 42898 signature : YUI3_SIGNATURE, 42899 42900 /** 42901 * The context the the event will fire from by default. Defaults to the YUI 42902 * instance. 42903 * @property context 42904 * @type object 42905 */ 42906 context : Y, 42907 42908 /** 42909 * Specifies whether or not this event's default function 42910 * can be cancelled by a subscriber by executing preventDefault() 42911 * on the event facade 42912 * @property preventable 42913 * @type boolean 42914 * @default true 42915 */ 42916 preventable : true, 42917 42918 /** 42919 * Specifies whether or not a subscriber can stop the event propagation 42920 * via stopPropagation(), stopImmediatePropagation(), or halt() 42921 * 42922 * Events can only bubble if emitFacade is true. 42923 * 42924 * @property bubbles 42925 * @type boolean 42926 * @default true 42927 */ 42928 bubbles : true, 42929 42930 /** 42931 * Returns the number of subscribers for this event as the sum of the on() 42932 * subscribers and after() subscribers. 42933 * 42934 * @method hasSubs 42935 * @return Number 42936 */ 42937 hasSubs: function(when) { 42938 var s = 0, 42939 a = 0, 42940 subs = this._subscribers, 42941 afters = this._afters, 42942 sib = this.sibling; 42943 42944 if (subs) { 42945 s = subs.length; 42946 } 42947 42948 if (afters) { 42949 a = afters.length; 42950 } 42951 42952 if (sib) { 42953 subs = sib._subscribers; 42954 afters = sib._afters; 42955 42956 if (subs) { 42957 s += subs.length; 42958 } 42959 42960 if (afters) { 42961 a += afters.length; 42962 } 42963 } 42964 42965 if (when) { 42966 return (when === 'after') ? a : s; 42967 } 42968 42969 return (s + a); 42970 }, 42971 42972 /** 42973 * Monitor the event state for the subscribed event. The first parameter 42974 * is what should be monitored, the rest are the normal parameters when 42975 * subscribing to an event. 42976 * @method monitor 42977 * @param what {string} what to monitor ('detach', 'attach', 'publish'). 42978 * @return {EventHandle} return value from the monitor event subscription. 42979 */ 42980 monitor: function(what) { 42981 this.monitored = true; 42982 var type = this.id + '|' + this.type + '_' + what, 42983 args = nativeSlice.call(arguments, 0); 42984 args[0] = type;
42985 return this.host.on.apply(this.host, args); 42986 }, 42987 42988 /** 42989 * Get all of the subscribers to this event and any sibling event 42990 * @method getSubs 42991 * @return {Array} first item is the on subscribers, second the after. 42992 */ 42993 getSubs: function() { 42994 42995 var sibling = this.sibling, 42996 subs = this._subscribers, 42997 afters = this._afters, 42998 siblingSubs, 42999 siblingAfters; 43000 43001 if (sibling) { 43002 siblingSubs = sibling._subscribers; 43003 siblingAfters = sibling._afters; 43004 } 43005 43006 if (siblingSubs) { 43007 if (subs) { 43008 subs = subs.concat(siblingSubs); 43009 } else { 43010 subs = siblingSubs.concat(); 43011 } 43012 } else { 43013 if (subs) { 43014 subs = subs.concat(); 43015 } else { 43016 subs = []; 43017 } 43018 } 43019 43020 if (siblingAfters) { 43021 if (afters) { 43022 afters = afters.concat(siblingAfters); 43023 } else { 43024 afters = siblingAfters.concat(); 43025 } 43026 } else { 43027 if (afters) { 43028 afters = afters.concat(); 43029 } else { 43030 afters = []; 43031 } 43032 } 43033 43034 return [subs, afters]; 43035 }, 43036 43037 /** 43038 * Apply configuration properties. Only applies the CONFIG whitelist 43039 * @method applyConfig 43040 * @param o hash of properties to apply. 43041 * @param force {boolean} if true, properties that exist on the event 43042 * will be overwritten. 43043 */ 43044 applyConfig: function(o, force) { 43045 mixConfigs(this, o, force); 43046 }, 43047 43048 /** 43049 * Create the Subscription for subscribing function, context, and bound 43050 * arguments. If this is a fireOnce event, the subscriber is immediately 43051 * notified. 43052 * 43053 * @method _on 43054 * @param fn {Function} Subscription callback 43055 * @param [context] {Object} Override `this` in the callback 43056 * @param [args] {Array} bound arguments that will be passed to the callback after the arguments generated by fire() 43057 * @param [when] {String} "after" to slot into after subscribers 43058 * @return {EventHandle} 43059 * @protected 43060 */ 43061 _on: function(fn, context, args, when) { 43062 43063 43064 var s = new Y.Subscriber(fn, context, args, when), 43065 firedWith; 43066 43067 if (this.fireOnce && this.fired) { 43068 43069 firedWith = this.firedWith; 43070 43071 // It's a little ugly for this to know about facades, 43072 // but given the current breakup, not much choice without 43073 // moving a whole lot of stuff around. 43074 if (this.emitFacade && this._addFacadeToArgs) { 43075 this._addFacadeToArgs(firedWith); 43076 } 43077 43078 if (this.async) { 43079 setTimeout(Y.bind(this._notify, this, s, firedWith), 0); 43080 } else { 43081 this._notify(s, firedWith); 43082 } 43083 } 43084 43085 if (when === AFTER) { 43086 if (!this._afters) { 43087 this._afters = []; 43088 } 43089 this._afters.push(s); 43090 } else { 43091 if (!this._subscribers) { 43092 this._subscribers = []; 43093 } 43094 this._subscribers.push(s); 43095 } 43096 43097 if (this._kds) { 43098 if (when === AFTER) { 43099 this.afters[s.id] = s; 43100 } else { 43101 this.subscribers[s.id] = s; 43102 } 43103 } 43104 43105 return new Y.EventHandle(this, s); 43106 }, 43107 43108 /** 43109 * Listen for this event 43110 * @method subscribe 43111 * @param {Function} fn The function to execute. 43112 * @return {EventHandle} Unsubscribe handle. 43113 * @deprecated use on. 43114 */ 43115 subscribe: function(fn, context) { 43116 var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null; 43117 return this._on(fn, context, a, true); 43118 }, 43119 43120 /** 43121 * Listen for this event 43122 * @method on 43123 * @param {Function} fn The function to execute. 43124 * @param {object} context optional execution context. 43125 * @param {mixed} arg* 0..n additional arguments to supply to the subscriber 43126 * when the event fires. 43127 * @return {EventHandle} An object with a detach method to detch the handler(s). 43128 */ 43129 on: function(fn, context) { 43130 var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null; 43131 43132 if (this.monitored && this.host) { 43133 this.host._monitor('attach', this, { 43134 args: arguments 43135 }); 43136 } 43137 return this._on(fn, context, a, true); 43138 }, 43139 43140 /** 43141 * Listen for this event after the normal subscribers have been notified and 43142 * the default behavior has been applied. If a normal subscriber prevents the 43143 * default behavior, it also prevents after listeners from firing. 43144 * @method after 43145 * @param {Function} fn The function to execute. 43146 * @param {object} context optional execution context. 43147 * @param {mixed} arg* 0..n additional arguments to supply to the subscriber 43148 * when the event fires. 43149 * @return {EventHandle} handle Unsubscribe handle. 43150 */ 43151 after: function(fn, context) { 43152 var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null; 43153 return this._on(fn, context, a, AFTER); 43154 }, 43155 43156 /** 43157 * Detach listeners. 43158 * @method detach 43159 * @param {Function} fn The subscribed function to remove, if not supplied 43160 * all will be removed. 43161 * @param {Object} context The context object passed to subscribe. 43162 * @return {Number} returns the number of subscribers unsubscribed. 43163 */ 43164 detach: function(fn, context) { 43165 // unsubscribe handle 43166 if (fn && fn.detach) { 43167 return fn.detach(); 43168 } 43169 43170 var i, s, 43171 found = 0, 43172 subs = this._subscribers, 43173 afters = this._afters; 43174 43175 if (subs) { 43176 for (i = subs.length; i >= 0; i--) { 43177 s = subs[i]; 43178 if (s && (!fn || fn === s.fn)) { 43179 this._delete(s, subs, i); 43180 found++; 43181 } 43182 } 43183 } 43184 43185 if (afters) { 43186 for (i = afters.length; i >= 0; i--) { 43187 s = afters[i]; 43188 if (s && (!fn || fn === s.fn)) { 43189 this._delete(s, afters, i); 43190 found++; 43191 } 43192 } 43193 } 43194 43195 return found; 43196 }, 43197 43198 /** 43199 * Detach listeners. 43200 * @method unsubscribe 43201 * @param {Function} fn The subscribed function to remove, if not supplied 43202 * all will be removed. 43203 * @param {Object} context The context object passed to subscribe. 43204 * @return {int|undefined} returns the number of subscribers unsubscribed. 43205 * @deprecated use detach. 43206 */ 43207 unsubscribe: function() { 43208 return this.detach.apply(this, arguments); 43209 }, 43210 43211 /** 43212 * Notify a single subscriber 43213 * @method _notify 43214 * @param {Subscriber} s the subscriber. 43215 * @param {Array} args the arguments array to apply to the listener. 43216 * @protected 43217 */ 43218 _notify: function(s, args, ef) { 43219 43220 43221 var ret; 43222 43223 ret = s.notify(args, this); 43224 43225 if (false === ret || this.stopped > 1) { 43226 return false;
43227 } 43228 43229 return true; 43230 }, 43231 43232 /** 43233 * Logger abstraction to centralize the application of the silent flag 43234 * @method log 43235 * @param {string} msg message to log. 43236 * @param {string} cat log category. 43237 */ 43238 log: function(msg, cat) { 43239 }, 43240 43241 /** 43242 * Notifies the subscribers. The callback functions will be executed 43243 * from the context specified when the event was created, and with the 43244 * following parameters: 43245 * <ul> 43246 * <li>The type of event</li> 43247 * <li>All of the arguments fire() was executed with as an array</li> 43248 * <li>The custom object (if any) that was passed into the subscribe() 43249 * method</li> 43250 * </ul> 43251 * @method fire 43252 * @param {Object*} arguments an arbitrary set of parameters to pass to 43253 * the handler. 43254 * @return {boolean} false if one of the subscribers returned false, 43255 * true otherwise. 43256 * 43257 */ 43258 fire: function() { 43259 43260 // push is the fastest way to go from arguments to arrays 43261 // for most browsers currently 43262 // http://jsperf.com/push-vs-concat-vs-slice/2 43263 43264 var args = []; 43265 args.push.apply(args, arguments); 43266 43267 return this._fire(args); 43268 }, 43269 43270 /** 43271 * Private internal implementation for `fire`, which is can be used directly by 43272 * `EventTarget` and other event module classes which have already converted from 43273 * an `arguments` list to an array, to avoid the repeated overhead. 43274 * 43275 * @method _fire 43276 * @private 43277 * @param {Array} args The array of arguments passed to be passed to handlers. 43278 * @return {boolean} false if one of the subscribers returned false, true otherwise. 43279 */ 43280 _fire: function(args) { 43281 43282 if (this.fireOnce && this.fired) { 43283 return true; 43284 } else { 43285 43286 // this doesn't happen if the event isn't published 43287 // this.host._monitor('fire', this.type, args); 43288 43289 this.fired = true; 43290 43291 if (this.fireOnce) { 43292 this.firedWith = args; 43293 } 43294 43295 if (this.emitFacade) { 43296 return this.fireComplex(args); 43297 } else { 43298 return this.fireSimple(args); 43299 } 43300 } 43301 }, 43302 43303 /** 43304 * Set up for notifying subscribers of non-emitFacade events. 43305 * 43306 * @method fireSimple 43307 * @param args {Array} Arguments passed to fire() 43308 * @return Boolean false if a subscriber returned false 43309 * @protected 43310 */ 43311 fireSimple: function(args) { 43312 this.stopped = 0; 43313 this.prevented = 0; 43314 if (this.hasSubs()) { 43315 var subs = this.getSubs(); 43316 this._procSubs(subs[0], args); 43317 this._procSubs(subs[1], args); 43318 } 43319 if (this.broadcast) { 43320 this._broadcast(args); 43321 } 43322 return this.stopped ? false : true; 43323 }, 43324 43325 // Requires the event-custom-complex module for full funcitonality. 43326 fireComplex: function(args) { 43327 args[0] = args[0] || {}; 43328 return this.fireSimple(args); 43329 }, 43330 43331 /** 43332 * Notifies a list of subscribers. 43333 * 43334 * @method _procSubs 43335 * @param subs {Array} List of subscribers 43336 * @param args {Array} Arguments passed to fire() 43337 * @param ef {} 43338 * @return Boolean false if a subscriber returns false or stops the event 43339 * propagation via e.stopPropagation(), 43340 * e.stopImmediatePropagation(), or e.halt() 43341 * @private 43342 */ 43343 _procSubs: function(subs, args, ef) { 43344 var s, i, l; 43345 43346 for (i = 0, l = subs.length; i < l; i++) { 43347 s = subs[i]; 43348 if (s && s.fn) { 43349 if (false === this._notify(s, args, ef)) { 43350 this.stopped = 2; 43351 } 43352 if (this.stopped === 2) { 43353 return false; 43354 } 43355 } 43356 } 43357 43358 return true; 43359 }, 43360 43361 /** 43362 * Notifies the YUI instance if the event is configured with broadcast = 1, 43363 * and both the YUI instance and Y.Global if configured with broadcast = 2. 43364 * 43365 * @method _broadcast 43366 * @param args {Array} Arguments sent to fire() 43367 * @private 43368 */ 43369 _broadcast: function(args) { 43370 if (!this.stopped && this.broadcast) { 43371 43372 var a = args.concat(); 43373 a.unshift(this.type); 43374 43375 if (this.host !== Y) { 43376 Y.fire.apply(Y, a); 43377 } 43378 43379 if (this.broadcast === 2) { 43380 Y.Global.fire.apply(Y.Global, a); 43381 } 43382 } 43383 }, 43384 43385 /** 43386 * Removes all listeners 43387 * @method unsubscribeAll 43388 * @return {Number} The number of listeners unsubscribed. 43389 * @deprecated use detachAll. 43390 */ 43391 unsubscribeAll: function() { 43392 return this.detachAll.apply(this, arguments); 43393 }, 43394 43395 /** 43396 * Removes all listeners 43397 * @method detachAll 43398 * @return {Number} The number of listeners unsubscribed. 43399 */ 43400 detachAll: function() { 43401 return this.detach(); 43402 }, 43403 43404 /** 43405 * Deletes the subscriber from the internal store of on() and after() 43406 * subscribers. 43407 * 43408 * @method _delete 43409 * @param s subscriber object. 43410 * @param subs (optional) on or after subscriber array 43411 * @param index (optional) The index found. 43412 * @private 43413 */ 43414 _delete: function(s, subs, i) { 43415 var when = s._when; 43416 43417 if (!subs) { 43418 subs = (when === AFTER) ? this._afters : this._subscribers; 43419 } 43420 43421 if (subs) { 43422 i = YArray.indexOf(subs, s, 0); 43423 43424 if (s && subs[i] === s) { 43425 subs.splice(i, 1); 43426 } 43427 } 43428 43429 if (this._kds) { 43430 if (when === AFTER) { 43431 delete this.afters[s.id]; 43432 } else { 43433 delete this.subscribers[s.id]; 43434 } 43435 } 43436 43437 if (this.monitored && this.host) { 43438 this.host._monitor('detach', this, { 43439 ce: this, 43440 sub: s 43441 }); 43442 } 43443 43444 if (s) { 43445 s.deleted = true; 43446 } 43447 } 43448}; 43449/** 43450 * Stores the subscriber information to be used when the event fires. 43451 * @param {Function} fn The wrapped function to execute. 43452 * @param {Object} context The value of the keyword 'this' in the listener. 43453 * @param {Array} args* 0..n additional arguments to supply the listener. 43454 * 43455 * @class Subscriber 43456 * @constructor 43457 */ 43458Y.Subscriber = function(fn, context, args, when) { 43459 43460 /** 43461 * The callback that will be execute when the event fires 43462 * This is wrapped by Y.rbind if obj was supplied.
43463 * @property fn 43464 * @type Function 43465 */ 43466 this.fn = fn; 43467 43468 /** 43469 * Optional 'this' keyword for the listener 43470 * @property context 43471 * @type Object 43472 */ 43473 this.context = context; 43474 43475 /** 43476 * Unique subscriber id 43477 * @property id 43478 * @type String 43479 */ 43480 this.id = Y.guid(); 43481 43482 /** 43483 * Additional arguments to propagate to the subscriber 43484 * @property args 43485 * @type Array 43486 */ 43487 this.args = args; 43488 43489 this._when = when; 43490 43491 /** 43492 * Custom events for a given fire transaction. 43493 * @property events 43494 * @type {EventTarget} 43495 */ 43496 // this.events = null; 43497 43498 /** 43499 * This listener only reacts to the event once 43500 * @property once 43501 */ 43502 // this.once = false; 43503 43504}; 43505 43506Y.Subscriber.prototype = { 43507 constructor: Y.Subscriber, 43508 43509 _notify: function(c, args, ce) { 43510 if (this.deleted && !this.postponed) { 43511 if (this.postponed) { 43512 delete this.fn; 43513 delete this.context; 43514 } else { 43515 delete this.postponed; 43516 return null; 43517 } 43518 } 43519 var a = this.args, ret; 43520 switch (ce.signature) { 43521 case 0: 43522 ret = this.fn.call(c, ce.type, args, c); 43523 break; 43524 case 1: 43525 ret = this.fn.call(c, args[0] || null, c); 43526 break; 43527 default: 43528 if (a || args) { 43529 args = args || []; 43530 a = (a) ? args.concat(a) : args; 43531 ret = this.fn.apply(c, a); 43532 } else { 43533 ret = this.fn.call(c); 43534 } 43535 } 43536 43537 if (this.once) { 43538 ce._delete(this); 43539 } 43540 43541 return ret; 43542 }, 43543 43544 /** 43545 * Executes the subscriber. 43546 * @method notify 43547 * @param args {Array} Arguments array for the subscriber. 43548 * @param ce {CustomEvent} The custom event that sent the notification. 43549 */ 43550 notify: function(args, ce) { 43551 var c = this.context, 43552 ret = true; 43553 43554 if (!c) { 43555 c = (ce.contextFn) ? ce.contextFn() : ce.context; 43556 } 43557 43558 // only catch errors if we will not re-throw them. 43559 if (Y.config && Y.config.throwFail) { 43560 ret = this._notify(c, args, ce); 43561 } else { 43562 try { 43563 ret = this._notify(c, args, ce); 43564 } catch (e) { 43565 Y.error(this + ' failed: ' + e.message, e); 43566 } 43567 } 43568 43569 return ret; 43570 }, 43571 43572 /** 43573 * Returns true if the fn and obj match this objects properties. 43574 * Used by the unsubscribe method to match the right subscriber. 43575 * 43576 * @method contains 43577 * @param {Function} fn the function to execute. 43578 * @param {Object} context optional 'this' keyword for the listener. 43579 * @return {boolean} true if the supplied arguments match this 43580 * subscriber's signature. 43581 */ 43582 contains: function(fn, context) { 43583 if (context) { 43584 return ((this.fn === fn) && this.context === context); 43585 } else { 43586 return (this.fn === fn); 43587 } 43588 }, 43589 43590 valueOf : function() { 43591 return this.id; 43592 } 43593 43594}; 43595/** 43596 * Return value from all subscribe operations 43597 * @class EventHandle 43598 * @constructor 43599 * @param {CustomEvent} evt the custom event. 43600 * @param {Subscriber} sub the subscriber. 43601 */ 43602Y.EventHandle = function(evt, sub) { 43603 43604 /** 43605 * The custom event 43606 * 43607 * @property evt 43608 * @type CustomEvent 43609 */ 43610 this.evt = evt; 43611 43612 /** 43613 * The subscriber object 43614 * 43615 * @property sub 43616 * @type Subscriber 43617 */ 43618 this.sub = sub; 43619}; 43620 43621Y.EventHandle.prototype = { 43622 batch: function(f, c) { 43623 f.call(c || this, this); 43624 if (Y.Lang.isArray(this.evt)) { 43625 Y.Array.each(this.evt, function(h) { 43626 h.batch.call(c || h, f); 43627 }); 43628 } 43629 }, 43630 43631 /** 43632 * Detaches this subscriber 43633 * @method detach 43634 * @return {Number} the number of detached listeners 43635 */ 43636 detach: function() { 43637 var evt = this.evt, detached = 0, i; 43638 if (evt) { 43639 if (Y.Lang.isArray(evt)) { 43640 for (i = 0; i < evt.length; i++) { 43641 detached += evt[i].detach(); 43642 } 43643 } else { 43644 evt._delete(this.sub); 43645 detached = 1; 43646 } 43647 43648 } 43649 43650 return detached; 43651 }, 43652 43653 /** 43654 * Monitor the event state for the subscribed event. The first parameter 43655 * is what should be monitored, the rest are the normal parameters when 43656 * subscribing to an event. 43657 * @method monitor 43658 * @param what {string} what to monitor ('attach', 'detach', 'publish'). 43659 * @return {EventHandle} return value from the monitor event subscription. 43660 */ 43661 monitor: function(what) { 43662 return this.evt.monitor.apply(this.evt, arguments); 43663 } 43664}; 43665 43666/** 43667 * Custom event engine, DOM event listener abstraction layer, synthetic DOM 43668 * events. 43669 * @module event-custom 43670 * @submodule event-custom-base 43671 */ 43672 43673/** 43674 * EventTarget provides the implementation for any object to 43675 * publish, subscribe and fire to custom events, and also 43676 * alows other EventTargets to target the object with events 43677 * sourced from the other object. 43678 * EventTarget is designed to be used with Y.augment to wrap 43679 * EventCustom in an interface that allows events to be listened to
43680 * and fired by name. This makes it possible for implementing code to 43681 * subscribe to an event that either has not been created yet, or will 43682 * not be created at all. 43683 * @class EventTarget 43684 * @param opts a configuration object 43685 * @config emitFacade {boolean} if true, all events will emit event 43686 * facade payloads by default (default false) 43687 * @config prefix {String} the prefix to apply to non-prefixed event names 43688 */ 43689 43690var L = Y.Lang, 43691 PREFIX_DELIMITER = ':', 43692 CATEGORY_DELIMITER = '|', 43693 AFTER_PREFIX = '~AFTER~', 43694 WILD_TYPE_RE = /(.*?)(:)(.*?)/, 43695 43696 _wildType = Y.cached(function(type) { 43697 return type.replace(WILD_TYPE_RE, "*$2$3"); 43698 }), 43699 43700 /** 43701 * If the instance has a prefix attribute and the 43702 * event type is not prefixed, the instance prefix is 43703 * applied to the supplied type. 43704 * @method _getType 43705 * @private 43706 */ 43707 _getType = function(type, pre) { 43708 43709 if (!pre || (typeof type !== "string") || type.indexOf(PREFIX_DELIMITER) > -1) { 43710 return type; 43711 } 43712 43713 return pre + PREFIX_DELIMITER + type; 43714 }, 43715 43716 /** 43717 * Returns an array with the detach key (if provided), 43718 * and the prefixed event name from _getType 43719 * Y.on('detachcategory| menu:click', fn) 43720 * @method _parseType 43721 * @private 43722 */ 43723 _parseType = Y.cached(function(type, pre) { 43724 43725 var t = type, detachcategory, after, i; 43726 43727 if (!L.isString(t)) { 43728 return t; 43729 } 43730 43731 i = t.indexOf(AFTER_PREFIX); 43732 43733 if (i > -1) { 43734 after = true; 43735 t = t.substr(AFTER_PREFIX.length); 43736 } 43737 43738 i = t.indexOf(CATEGORY_DELIMITER); 43739 43740 if (i > -1) { 43741 detachcategory = t.substr(0, (i)); 43742 t = t.substr(i+1); 43743 if (t === '*') { 43744 t = null; 43745 } 43746 } 43747 43748 // detach category, full type with instance prefix, is this an after listener, short type 43749 return [detachcategory, (pre) ? _getType(t, pre) : t, after, t]; 43750 }), 43751 43752 ET = function(opts) { 43753 43754 var etState = this._yuievt, 43755 etConfig; 43756 43757 if (!etState) { 43758 etState = this._yuievt = { 43759 events: {}, // PERF: Not much point instantiating lazily. We're bound to have events 43760 targets: null, // PERF: Instantiate lazily, if user actually adds target, 43761 config: { 43762 host: this, 43763 context: this 43764 }, 43765 chain: Y.config.chain 43766 }; 43767 } 43768 43769 etConfig = etState.config; 43770 43771 if (opts) { 43772 mixConfigs(etConfig, opts, true); 43773 43774 if (opts.chain !== undefined) { 43775 etState.chain = opts.chain; 43776 } 43777 43778 if (opts.prefix) { 43779 etConfig.prefix = opts.prefix; 43780 } 43781 } 43782 }; 43783 43784ET.prototype = { 43785 43786 constructor: ET, 43787 43788 /** 43789 * Listen to a custom event hosted by this object one time. 43790 * This is the equivalent to <code>on</code> except the 43791 * listener is immediatelly detached when it is executed. 43792 * @method once 43793 * @param {String} type The name of the event 43794 * @param {Function} fn The callback to execute in response to the event 43795 * @param {Object} [context] Override `this` object in callback 43796 * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber 43797 * @return {EventHandle} A subscription handle capable of detaching the 43798 * subscription 43799 */ 43800 once: function() { 43801 var handle = this.on.apply(this, arguments); 43802 handle.batch(function(hand) { 43803 if (hand.sub) { 43804 hand.sub.once = true; 43805 } 43806 }); 43807 return handle; 43808 }, 43809 43810 /** 43811 * Listen to a custom event hosted by this object one time. 43812 * This is the equivalent to <code>after</code> except the 43813 * listener is immediatelly detached when it is executed. 43814 * @method onceAfter 43815 * @param {String} type The name of the event 43816 * @param {Function} fn The callback to execute in response to the event 43817 * @param {Object} [context] Override `this` object in callback 43818 * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber 43819 * @return {EventHandle} A subscription handle capable of detaching that 43820 * subscription 43821 */ 43822 onceAfter: function() { 43823 var handle = this.after.apply(this, arguments); 43824 handle.batch(function(hand) { 43825 if (hand.sub) { 43826 hand.sub.once = true; 43827 } 43828 }); 43829 return handle; 43830 }, 43831 43832 /** 43833 * Takes the type parameter passed to 'on' and parses out the 43834 * various pieces that could be included in the type. If the 43835 * event type is passed without a prefix, it will be expanded 43836 * to include the prefix one is supplied or the event target 43837 * is configured with a default prefix. 43838 * @method parseType 43839 * @param {String} type the type 43840 * @param {String} [pre] The prefix. Defaults to this._yuievt.config.prefix 43841 * @since 3.3.0 43842 * @return {Array} an array containing: 43843 * * the detach category, if supplied, 43844 * * the prefixed event type, 43845 * * whether or not this is an after listener, 43846 * * the supplied event type 43847 */ 43848 parseType: function(type, pre) { 43849 return _parseType(type, pre || this._yuievt.config.prefix); 43850 }, 43851 43852 /** 43853 * Subscribe a callback function to a custom event fired by this object or 43854 * from an object that bubbles its events to this object. 43855 * 43856 * this.on("change", this._onChange, this); 43857 * 43858 * Callback functions for events published with `emitFacade = true` will 43859 * receive an `EventFacade` as the first argument (typically named "e"). 43860 * These callbacks can then call `e.preventDefault()` to disable the 43861 * behavior published to that event's `defaultFn`. See the `EventFacade` 43862 * API for all available properties and methods. Subscribers to 43863 * non-`emitFacade` events will receive the arguments passed to `fire()` 43864 * after the event name. 43865 * 43866 * To subscribe to multiple events at once, pass an object as the first 43867 * argument, where the key:value pairs correspond to the eventName:callback. 43868 * 43869 * this.on({ 43870 * "attrChange" : this._onAttrChange, 43871 * "change" : this._onChange 43872 * }); 43873 * 43874 * You can also pass an array of event names as the first argument to 43875 * subscribe to all listed events with the same callback. 43876 * 43877 * this.on([ "change", "attrChange" ], this._onChange); 43878 * 43879 * Returning `false` from a callback is supported as an alternative to 43880 * calling `e.preventDefault(); e.stopPropagation();`. However, it is 43881 * recommended to use the event methods whenever possible. 43882 * 43883 * @method on 43884 * @param {String} type The name of the event 43885 * @param {Function} fn The callback to execute in response to the event 43886 * @param {Object} [context] Override `this` object in callback 43887 * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber 43888 * @return {EventHandle} A subscription handle capable of detaching that 43889 * subscription 43890 */ 43891 on: function(type, fn, context) { 43892 43893 var yuievt = this._yuievt, 43894 parts = _parseType(type, yuievt.config.prefix), f, c, args, ret, ce, 43895 detachcategory, handle, store = Y.Env.evt.handles, after, adapt, shorttype, 43896 Node = Y.Node, n, domevent, isArr; 43897 43898 // full name, args, detachcategory, after 43899 this._monitor('attach', parts[1], { 43900 args: arguments, 43901 category: parts[0], 43902 after: parts[2] 43903 }); 43904 43905 if (L.isObject(type)) { 43906 43907 if (L.isFunction(type)) { 43908 return Y.Do.before.apply(Y.Do, arguments); 43909 } 43910 43911 f = fn; 43912 c = context; 43913 args = nativeSlice.call(arguments, 0); 43914 ret = []; 43915 43916 if (L.isArray(type)) { 43917 isArr = true; 43918 } 43919 43920 after = type._after; 43921 delete type._after; 43922 43923 Y.each(type, function(v, k) { 43924 43925 if (L.isObject(v)) { 43926 f = v.fn || ((L.isFunction(v)) ? v : f); 43927 c = v.context || c; 43928 } 43929 43930 var nv = (after) ? AFTER_PREFIX : ''; 43931 43932 args[0] = nv + ((isArr) ? v : k); 43933 args[1] = f; 43934 args[2] = c; 43935
43936 ret.push(this.on.apply(this, args)); 43937 43938 }, this); 43939 43940 return (yuievt.chain) ? this : new Y.EventHandle(ret); 43941 } 43942 43943 detachcategory = parts[0]; 43944 after = parts[2]; 43945 shorttype = parts[3]; 43946 43947 // extra redirection so we catch adaptor events too. take a look at this. 43948 if (Node && Y.instanceOf(this, Node) && (shorttype in Node.DOM_EVENTS)) { 43949 args = nativeSlice.call(arguments, 0); 43950 args.splice(2, 0, Node.getDOMNode(this)); 43951 return Y.on.apply(Y, args); 43952 } 43953 43954 type = parts[1]; 43955 43956 if (Y.instanceOf(this, YUI)) { 43957 43958 adapt = Y.Env.evt.plugins[type]; 43959 args = nativeSlice.call(arguments, 0); 43960 args[0] = shorttype; 43961 43962 if (Node) { 43963 n = args[2]; 43964 43965 if (Y.instanceOf(n, Y.NodeList)) { 43966 n = Y.NodeList.getDOMNodes(n); 43967 } else if (Y.instanceOf(n, Node)) { 43968 n = Node.getDOMNode(n); 43969 } 43970 43971 domevent = (shorttype in Node.DOM_EVENTS); 43972 43973 // Captures both DOM events and event plugins. 43974 if (domevent) { 43975 args[2] = n; 43976 } 43977 } 43978 43979 // check for the existance of an event adaptor 43980 if (adapt) { 43981 handle = adapt.on.apply(Y, args); 43982 } else if ((!type) || domevent) { 43983 handle = Y.Event._attach(args); 43984 } 43985 43986 } 43987 43988 if (!handle) { 43989 ce = yuievt.events[type] || this.publish(type); 43990 handle = ce._on(fn, context, (arguments.length > 3) ? nativeSlice.call(arguments, 3) : null, (after) ? 'after' : true); 43991 43992 // TODO: More robust regex, accounting for category 43993 if (type.indexOf("*:") !== -1) { 43994 this._hasSiblings = true; 43995 } 43996 } 43997 43998 if (detachcategory) { 43999 store[detachcategory] = store[detachcategory] || {}; 44000 store[detachcategory][type] = store[detachcategory][type] || []; 44001 store[detachcategory][type].push(handle); 44002 } 44003 44004 return (yuievt.chain) ? this : handle; 44005 44006 }, 44007 44008 /** 44009 * subscribe to an event 44010 * @method subscribe 44011 * @deprecated use on 44012 */ 44013 subscribe: function() { 44014 return this.on.apply(this, arguments); 44015 }, 44016 44017 /** 44018 * Detach one or more listeners the from the specified event 44019 * @method detach 44020 * @param type {string|Object} Either the handle to the subscriber or the 44021 * type of event. If the type 44022 * is not specified, it will attempt to remove 44023 * the listener from all hosted events. 44024 * @param fn {Function} The subscribed function to unsubscribe, if not 44025 * supplied, all subscribers will be removed. 44026 * @param context {Object} The custom object passed to subscribe. This is 44027 * optional, but if supplied will be used to 44028 * disambiguate multiple listeners that are the same 44029 * (e.g., you subscribe many object using a function 44030 * that lives on the prototype) 44031 * @return {EventTarget} the host 44032 */ 44033 detach: function(type, fn, context) { 44034 44035 var evts = this._yuievt.events, 44036 i, 44037 Node = Y.Node, 44038 isNode = Node && (Y.instanceOf(this, Node)); 44039 44040 // detachAll disabled on the Y instance. 44041 if (!type && (this !== Y)) { 44042 for (i in evts) { 44043 if (evts.hasOwnProperty(i)) { 44044 evts[i].detach(fn, context); 44045 } 44046 } 44047 if (isNode) { 44048 Y.Event.purgeElement(Node.getDOMNode(this)); 44049 } 44050 44051 return this; 44052 } 44053 44054 var parts = _parseType(type, this._yuievt.config.prefix), 44055 detachcategory = L.isArray(parts) ? parts[0] : null, 44056 shorttype = (parts) ? parts[3] : null, 44057 adapt, store = Y.Env.evt.handles, detachhost, cat, args, 44058 ce, 44059 44060 keyDetacher = function(lcat, ltype, host) { 44061 var handles = lcat[ltype], ce, i; 44062 if (handles) { 44063 for (i = handles.length - 1; i >= 0; --i) { 44064 ce = handles[i].evt; 44065 if (ce.host === host || ce.el === host) { 44066 handles[i].detach(); 44067 } 44068 } 44069 } 44070 }; 44071 44072 if (detachcategory) { 44073 44074 cat = store[detachcategory]; 44075 type = parts[1]; 44076 detachhost = (isNode) ? Y.Node.getDOMNode(this) : this; 44077 44078 if (cat) { 44079 if (type) { 44080 keyDetacher(cat, type, detachhost); 44081 } else { 44082 for (i in cat) { 44083 if (cat.hasOwnProperty(i)) { 44084 keyDetacher(cat, i, detachhost); 44085 } 44086 } 44087 } 44088 44089 return this; 44090 } 44091 44092 // If this is an event handle, use it to detach 44093 } else if (L.isObject(type) && type.detach) { 44094 type.detach(); 44095 return this; 44096 // extra redirection so we catch adaptor events too. take a look at this. 44097 } else if (isNode && ((!shorttype) || (shorttype in Node.DOM_EVENTS))) { 44098 args = nativeSlice.call(arguments, 0); 44099 args[2] = Node.getDOMNode(this); 44100 Y.detach.apply(Y, args); 44101 return this; 44102 } 44103 44104 adapt = Y.Env.evt.plugins[shorttype]; 44105 44106 // The YUI instance handles DOM events and adaptors 44107 if (Y.instanceOf(this, YUI)) { 44108 args = nativeSlice.call(arguments, 0); 44109 // use the adaptor specific detach code if 44110 if (adapt && adapt.detach) { 44111 adapt.detach.apply(Y, args); 44112 return this; 44113 // DOM event fork 44114 } else if (!type || (!adapt && Node && (type in Node.DOM_EVENTS))) { 44115 args[0] = type; 44116 Y.Event.detach.apply(Y.Event, args); 44117 return this; 44118 } 44119 } 44120 44121 // ce = evts[type]; 44122 ce = evts[parts[1]]; 44123 if (ce) { 44124 ce.detach(fn, context); 44125 } 44126 44127 return this; 44128 }, 44129 44130 /** 44131 * detach a listener 44132 * @method unsubscribe 44133 * @deprecated use detach 44134 */ 44135 unsubscribe: function() { 44136 return this.detach.apply(this, arguments); 44137 }, 44138 44139 /** 44140 * Removes all listeners from the specified event. If the event type 44141 * is not specified, all listeners from all hosted custom events will 44142 * be removed. 44143 * @method detachAll 44144 * @param type {String} The type, or name of the event 44145 */ 44146 detachAll: function(type) { 44147 return this.detach(type); 44148 }, 44149 44150 /** 44151 * Removes all listeners from the specified event. If the event type 44152 * is not specified, all listeners from all hosted custom events will 44153 * be removed. 44154 * @method unsubscribeAll 44155 * @param type {String} The type, or name of the event 44156 * @deprecated use detachAll 44157 */ 44158 unsubscribeAll: function() { 44159 return this.detachAll.apply(this, arguments); 44160 }, 44161 44162 /** 44163 * Creates a new custom event of the specified type. If a custom event 44164 * by that name already exists, it will not be re-created. In either 44165 * case the custom event is returned. 44166 * 44167 * @method publish 44168 * 44169 * @param type {String} the type, or name of the event 44170 * @param opts {object} optional config params. Valid properties are: 44171 * @param [opts.broadcast=false] {Boolean} whether or not the YUI instance and YUI global 44172 * are notified when the event is fired. 44173 * @param [opts.bubbles=true] {Boolean} Whether or not this event bubbles. Events can 44174 * only bubble if `emitFacade` is true.
44175 * @param [opts.context=this] {Object} the default execution context for the listeners. 44176 * @param [opts.defaultFn] {Function} the default function to execute when this event 44177 * fires if preventDefault was not called. 44178 * @param [opts.emitFacade=false] {Boolean} whether or not this event emits a facade. 44179 * @param [opts.prefix] {String} the prefix for this targets events, e.g., 'menu' in 'menu:click'. 44180 * @param [opts.fireOnce=false] {Boolean} if an event is configured to fire once, 44181 * new subscribers after the fire will be notified immediately. 44182 * @param [opts.async=false] {Boolean} fireOnce event listeners will fire synchronously 44183 * if the event has already fired unless `async` is `true`. 44184 * @param [opts.preventable=true] {Boolean} whether or not `preventDefault()` has an effect. 44185 * @param [opts.preventedFn] {Function} a function that is executed when `preventDefault()` is called. 44186 * @param [opts.queuable=false] {Boolean} whether or not this event can be queued during bubbling. 44187 * @param [opts.silent] {Boolean} if silent is true, debug messages are not provided for this event. 44188 * @param [opts.stoppedFn] {Function} a function that is executed when stopPropagation is called. 44189 * @param [opts.monitored] {Boolean} specifies whether or not this event should send notifications about 44190 * when the event has been attached, detached, or published. 44191 * @param [opts.type] {String} the event type (valid option if not provided as the first parameter to publish). 44192 * 44193 * @return {CustomEvent} the custom event 44194 * 44195 */ 44196 publish: function(type, opts) { 44197 44198 var ret, 44199 etState = this._yuievt, 44200 etConfig = etState.config, 44201 pre = etConfig.prefix; 44202 44203 if (typeof type === "string") { 44204 if (pre) { 44205 type = _getType(type, pre); 44206 } 44207 ret = this._publish(type, etConfig, opts); 44208 } else { 44209 ret = {}; 44210 44211 Y.each(type, function(v, k) { 44212 if (pre) { 44213 k = _getType(k, pre); 44214 } 44215 ret[k] = this._publish(k, etConfig, v || opts); 44216 }, this); 44217 44218 } 44219 44220 return ret; 44221 }, 44222 44223 /** 44224 * Returns the fully qualified type, given a short type string. 44225 * That is, returns "foo:bar" when given "bar" if "foo" is the configured prefix. 44226 * 44227 * NOTE: This method, unlike _getType, does no checking of the value passed in, and 44228 * is designed to be used with the low level _publish() method, for critical path 44229 * implementations which need to fast-track publish for performance reasons. 44230 * 44231 * @method _getFullType 44232 * @private 44233 * @param {String} type The short type to prefix 44234 * @return {String} The prefixed type, if a prefix is set, otherwise the type passed in 44235 */ 44236 _getFullType : function(type) { 44237 44238 var pre = this._yuievt.config.prefix; 44239 44240 if (pre) { 44241 return pre + PREFIX_DELIMITER + type; 44242 } else { 44243 return type; 44244 } 44245 }, 44246 44247 /** 44248 * The low level event publish implementation. It expects all the massaging to have been done 44249 * outside of this method. e.g. the `type` to `fullType` conversion. It's designed to be a fast 44250 * path publish, which can be used by critical code paths to improve performance. 44251 * 44252 * @method _publish 44253 * @private 44254 * @param {String} fullType The prefixed type of the event to publish. 44255 * @param {Object} etOpts The EventTarget specific configuration to mix into the published event. 44256 * @param {Object} ceOpts The publish specific configuration to mix into the published event. 44257 * @return {CustomEvent} The published event. If called without `etOpts` or `ceOpts`, this will 44258 * be the default `CustomEvent` instance, and can be configured independently. 44259 */ 44260 _publish : function(fullType, etOpts, ceOpts) { 44261 44262 var ce, 44263 etState = this._yuievt, 44264 etConfig = etState.config, 44265 host = etConfig.host, 44266 context = etConfig.context, 44267 events = etState.events; 44268 44269 ce = events[fullType]; 44270 44271 // PERF: Hate to pull the check out of monitor, but trying to keep critical path tight. 44272 if ((etConfig.monitored && !ce) || (ce && ce.monitored)) { 44273 this._monitor('publish', fullType, { 44274 args: arguments 44275 }); 44276 } 44277 44278 if (!ce) { 44279 // Publish event 44280 ce = events[fullType] = new Y.CustomEvent(fullType, etOpts); 44281 44282 if (!etOpts) { 44283 ce.host = host; 44284 ce.context = context; 44285 } 44286 } 44287 44288 if (ceOpts) { 44289 mixConfigs(ce, ceOpts, true); 44290 } 44291 44292 return ce; 44293 }, 44294 44295 /** 44296 * This is the entry point for the event monitoring system. 44297 * You can monitor 'attach', 'detach', 'fire', and 'publish'. 44298 * When configured, these events generate an event. click -> 44299 * click_attach, click_detach, click_publish -- these can 44300 * be subscribed to like other events to monitor the event 44301 * system. Inividual published events can have monitoring 44302 * turned on or off (publish can't be turned off before it 44303 * it published) by setting the events 'monitor' config. 44304 * 44305 * @method _monitor 44306 * @param what {String} 'attach', 'detach', 'fire', or 'publish' 44307 * @param eventType {String|CustomEvent} The prefixed name of the event being monitored, or the CustomEvent object. 44308 * @param o {Object} Information about the event interaction, such as 44309 * fire() args, subscription category, publish config 44310 * @private 44311 */ 44312 _monitor: function(what, eventType, o) {
44313 var monitorevt, ce, type; 44314 44315 if (eventType) { 44316 if (typeof eventType === "string") { 44317 type = eventType; 44318 ce = this.getEvent(eventType, true); 44319 } else { 44320 ce = eventType; 44321 type = eventType.type; 44322 } 44323 44324 if ((this._yuievt.config.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) { 44325 monitorevt = type + '_' + what; 44326 o.monitored = what; 44327 this.fire.call(this, monitorevt, o); 44328 } 44329 } 44330 }, 44331 44332 /** 44333 * Fire a custom event by name. The callback functions will be executed 44334 * from the context specified when the event was created, and with the 44335 * following parameters. 44336 * 44337 * The first argument is the event type, and any additional arguments are 44338 * passed to the listeners as parameters. If the first of these is an 44339 * object literal, and the event is configured to emit an event facade, 44340 * that object is mixed into the event facade and the facade is provided 44341 * in place of the original object. 44342 * 44343 * If the custom event object hasn't been created, then the event hasn't 44344 * been published and it has no subscribers. For performance sake, we 44345 * immediate exit in this case. This means the event won't bubble, so 44346 * if the intention is that a bubble target be notified, the event must 44347 * be published on this object first. 44348 * 44349 * @method fire 44350 * @param type {String|Object} The type of the event, or an object that contains 44351 * a 'type' property. 44352 * @param arguments {Object*} an arbitrary set of parameters to pass to 44353 * the handler. If the first of these is an object literal and the event is 44354 * configured to emit an event facade, the event facade will replace that 44355 * parameter after the properties the object literal contains are copied to 44356 * the event facade. 44357 * @return {Boolean} True if the whole lifecycle of the event went through, 44358 * false if at any point the event propagation was halted. 44359 */ 44360 fire: function(type) { 44361 44362 var typeIncluded = (typeof type === "string"), 44363 argCount = arguments.length, 44364 t = type, 44365 yuievt = this._yuievt, 44366 etConfig = yuievt.config, 44367 pre = etConfig.prefix, 44368 ret, 44369 ce, 44370 ce2, 44371 args; 44372 44373 if (typeIncluded && argCount <= 3) { 44374 44375 // PERF: Try to avoid slice/iteration for the common signatures 44376 44377 // Most common 44378 if (argCount === 2) { 44379 args = [arguments[1]]; // fire("foo", {}) 44380 } else if (argCount === 3) { 44381 args = [arguments[1], arguments[2]]; // fire("foo", {}, opts) 44382 } else { 44383 args = []; // fire("foo") 44384 } 44385 44386 } else { 44387 args = nativeSlice.call(arguments, ((typeIncluded) ? 1 : 0)); 44388 } 44389 44390 if (!typeIncluded) { 44391 t = (type && type.type); 44392 } 44393 44394 if (pre) { 44395 t = _getType(t, pre); 44396 } 44397 44398 ce = yuievt.events[t]; 44399 44400 if (this._hasSiblings) { 44401 ce2 = this.getSibling(t, ce); 44402 44403 if (ce2 && !ce) { 44404 ce = this.publish(t); 44405 } 44406 } 44407 44408 // PERF: trying to avoid function call, since this is a critical path 44409 if ((etConfig.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) { 44410 this._monitor('fire', (ce || t), { 44411 args: args 44412 }); 44413 } 44414 44415 // this event has not been published or subscribed to 44416 if (!ce) { 44417 if (yuievt.hasTargets) { 44418 return this.bubble({ type: t }, args, this); 44419 } 44420 44421 // otherwise there is nothing to be done 44422 ret = true; 44423 } else { 44424 44425 if (ce2) { 44426 ce.sibling = ce2; 44427 } 44428 44429 ret = ce._fire(args); 44430 } 44431 44432 return (yuievt.chain) ? this : ret; 44433 }, 44434 44435 getSibling: function(type, ce) { 44436 var ce2; 44437 44438 // delegate to *:type events if there are subscribers 44439 if (type.indexOf(PREFIX_DELIMITER) > -1) { 44440 type = _wildType(type); 44441 ce2 = this.getEvent(type, true); 44442 if (ce2) { 44443 ce2.applyConfig(ce); 44444 ce2.bubbles = false;
44445 ce2.broadcast = 0; 44446 } 44447 } 44448 44449 return ce2; 44450 }, 44451 44452 /** 44453 * Returns the custom event of the provided type has been created, a 44454 * falsy value otherwise 44455 * @method getEvent 44456 * @param type {String} the type, or name of the event 44457 * @param prefixed {String} if true, the type is prefixed already 44458 * @return {CustomEvent} the custom event or null 44459 */ 44460 getEvent: function(type, prefixed) { 44461 var pre, e; 44462 44463 if (!prefixed) { 44464 pre = this._yuievt.config.prefix; 44465 type = (pre) ? _getType(type, pre) : type; 44466 } 44467 e = this._yuievt.events; 44468 return e[type] || null; 44469 }, 44470 44471 /** 44472 * Subscribe to a custom event hosted by this object. The 44473 * supplied callback will execute after any listeners add 44474 * via the subscribe method, and after the default function, 44475 * if configured for the event, has executed. 44476 * 44477 * @method after 44478 * @param {String} type The name of the event 44479 * @param {Function} fn The callback to execute in response to the event 44480 * @param {Object} [context] Override `this` object in callback 44481 * @param {Any} [arg*] 0..n additional arguments to supply to the subscriber 44482 * @return {EventHandle} A subscription handle capable of detaching the 44483 * subscription 44484 */ 44485 after: function(type, fn) { 44486 44487 var a = nativeSlice.call(arguments, 0); 44488 44489 switch (L.type(type)) { 44490 case 'function': 44491 return Y.Do.after.apply(Y.Do, arguments); 44492 case 'array': 44493 // YArray.each(a[0], function(v) { 44494 // v = AFTER_PREFIX + v; 44495 // }); 44496 // break; 44497 case 'object': 44498 a[0]._after = true; 44499 break; 44500 default: 44501 a[0] = AFTER_PREFIX + type; 44502 } 44503 44504 return this.on.apply(this, a); 44505 44506 }, 44507 44508 /** 44509 * Executes the callback before a DOM event, custom event 44510 * or method. If the first argument is a function, it 44511 * is assumed the target is a method. For DOM and custom 44512 * events, this is an alias for Y.on. 44513 * 44514 * For DOM and custom events: 44515 * type, callback, context, 0-n arguments 44516 * 44517 * For methods: 44518 * callback, object (method host), methodName, context, 0-n arguments 44519 * 44520 * @method before 44521 * @return detach handle 44522 */ 44523 before: function() { 44524 return this.on.apply(this, arguments); 44525 } 44526 44527}; 44528 44529Y.EventTarget = ET; 44530 44531// make Y an event target 44532Y.mix(Y, ET.prototype); 44533ET.call(Y, { bubbles: false }); 44534 44535YUI.Env.globalEvents = YUI.Env.globalEvents || new ET(); 44536 44537/** 44538 * Hosts YUI page level events. This is where events bubble to 44539 * when the broadcast config is set to 2. This property is 44540 * only available if the custom event module is loaded. 44541 * @property Global 44542 * @type EventTarget 44543 * @for YUI 44544 */ 44545Y.Global = YUI.Env.globalEvents; 44546 44547// @TODO implement a global namespace function on Y.Global? 44548 44549/** 44550`Y.on()` can do many things: 44551 44552<ul> 44553 <li>Subscribe to custom events `publish`ed and `fire`d from Y</li> 44554 <li>Subscribe to custom events `publish`ed with `broadcast` 1 or 2 and 44555 `fire`d from any object in the YUI instance sandbox</li> 44556 <li>Subscribe to DOM events</li> 44557 <li>Subscribe to the execution of a method on any object, effectively 44558 treating that method as an event</li> 44559</ul> 44560 44561For custom event subscriptions, pass the custom event name as the first argument 44562and callback as the second. The `this` object in the callback will be `Y` unless 44563an override is passed as the third argument. 44564 44565 Y.on('io:complete', function () { 44566 Y.MyApp.updateStatus('Transaction complete'); 44567 }); 44568 44569To subscribe to DOM events, pass the name of a DOM event as the first argument 44570and a CSS selector string as the third argument after the callback function. 44571Alternately, the third argument can be a `Node`, `NodeList`, `HTMLElement`, 44572array, or simply omitted (the default is the `window` object). 44573 44574 Y.on('click', function (e) { 44575 e.preventDefault(); 44576 44577 // proceed with ajax form submission 44578 var url = this.get('action'); 44579 ... 44580 }, '#my-form'); 44581 44582The `this` object in DOM event callbacks will be the `Node` targeted by the CSS 44583selector or other identifier. 44584 44585`on()` subscribers for DOM events or custom events `publish`ed with a 44586`defaultFn` can prevent the default behavior with `e.preventDefault()` from the 44587event object passed as the first parameter to the subscription callback. 44588 44589To subscribe to the execution of an object method, pass arguments corresponding to the call signature for 44590<a href="../classes/Do.html#methods_before">`Y.Do.before(...)`</a>. 44591 44592NOTE: The formal parameter list below is for events, not for function 44593injection. See `Y.Do.before` for that signature. 44594 44595@method on 44596@param {String} type DOM or custom event name 44597@param {Function} fn The callback to execute in response to the event 44598@param {Object} [context] Override `this` object in callback 44599@param {Any} [arg*] 0..n additional arguments to supply to the subscriber 44600@return {EventHandle} A subscription handle capable of detaching the 44601 subscription 44602@see Do.before 44603@for YUI
44604**/ 44605 44606/** 44607Listen for an event one time. Equivalent to `on()`, except that 44608the listener is immediately detached when executed. 44609 44610See the <a href="#methods_on">`on()` method</a> for additional subscription 44611options. 44612 44613@see on 44614@method once 44615@param {String} type DOM or custom event name 44616@param {Function} fn The callback to execute in response to the event 44617@param {Object} [context] Override `this` object in callback 44618@param {Any} [arg*] 0..n additional arguments to supply to the subscriber 44619@return {EventHandle} A subscription handle capable of detaching the 44620 subscription 44621@for YUI 44622**/ 44623 44624/** 44625Listen for an event one time. Equivalent to `once()`, except, like `after()`, 44626the subscription callback executes after all `on()` subscribers and the event's 44627`defaultFn` (if configured) have executed. Like `after()` if any `on()` phase 44628subscriber calls `e.preventDefault()`, neither the `defaultFn` nor the `after()` 44629subscribers will execute. 44630 44631The listener is immediately detached when executed. 44632 44633See the <a href="#methods_on">`on()` method</a> for additional subscription 44634options. 44635 44636@see once 44637@method onceAfter 44638@param {String} type The custom event name 44639@param {Function} fn The callback to execute in response to the event 44640@param {Object} [context] Override `this` object in callback 44641@param {Any} [arg*] 0..n additional arguments to supply to the subscriber 44642@return {EventHandle} A subscription handle capable of detaching the 44643 subscription 44644@for YUI 44645**/ 44646 44647/** 44648Like `on()`, this method creates a subscription to a custom event or to the 44649execution of a method on an object. 44650 44651For events, `after()` subscribers are executed after the event's 44652`defaultFn` unless `e.preventDefault()` was called from an `on()` subscriber. 44653 44654See the <a href="#methods_on">`on()` method</a> for additional subscription 44655options. 44656 44657NOTE: The subscription signature shown is for events, not for function 44658injection. See <a href="../classes/Do.html#methods_after">`Y.Do.after`</a> 44659for that signature. 44660 44661@see on 44662@see Do.after 44663@method after 44664@param {String} type The custom event name 44665@param {Function} fn The callback to execute in response to the event 44666@param {Object} [context] Override `this` object in callback 44667@param {Any} [args*] 0..n additional arguments to supply to the subscriber 44668@return {EventHandle} A subscription handle capable of detaching the 44669 subscription 44670@for YUI 44671**/ 44672 44673 44674}, 'patched-v3.18.1', {"requires": ["oop"]}); 44675 44676YUI.add('event-custom-complex', function (Y, NAME) { 44677 44678 44679/** 44680 * Adds event facades, preventable default behavior, and bubbling. 44681 * events. 44682 * @module event-custom 44683 * @submodule event-custom-complex 44684 */ 44685 44686var FACADE, 44687 FACADE_KEYS, 44688 YObject = Y.Object, 44689 key, 44690 EMPTY = {}, 44691 CEProto = Y.CustomEvent.prototype, 44692 ETProto = Y.EventTarget.prototype, 44693 44694 mixFacadeProps = function(facade, payload) { 44695 var p; 44696 44697 for (p in payload) { 44698 if (!(FACADE_KEYS.hasOwnProperty(p))) { 44699 facade[p] = payload[p]; 44700 } 44701 } 44702 }; 44703 44704/** 44705 * Wraps and protects a custom event for use when emitFacade is set to true. 44706 * Requires the event-custom-complex module 44707 * @class EventFacade 44708 * @param e {Event} the custom event 44709 * @param currentTarget {HTMLElement} the element the listener was attached to 44710 */ 44711 44712Y.EventFacade = function(e, currentTarget) { 44713 44714 if (!e) { 44715 e = EMPTY; 44716 } 44717 44718 this._event = e; 44719 44720 /** 44721 * The arguments passed to fire 44722 * @property details 44723 * @type Array 44724 */ 44725 this.details = e.details; 44726 44727 /** 44728 * The event type, this can be overridden by the fire() payload 44729 * @property type 44730 * @type string 44731 */ 44732 this.type = e.type; 44733 44734 /** 44735 * The real event type 44736 * @property _type 44737 * @type string 44738 * @private 44739 */ 44740 this._type = e.type; 44741 44742 ////////////////////////////////////////////////////// 44743 44744 /** 44745 * Node reference for the targeted eventtarget 44746 * @property target 44747 * @type Node 44748 */ 44749 this.target = e.target; 44750 44751 /** 44752 * Node reference for the element that the listener was attached to. 44753 * @property currentTarget 44754 * @type Node 44755 */ 44756 this.currentTarget = currentTarget; 44757 44758 /** 44759 * Node reference to the relatedTarget 44760 * @property relatedTarget 44761 * @type Node 44762 */ 44763 this.relatedTarget = e.relatedTarget; 44764 44765}; 44766 44767Y.mix(Y.EventFacade.prototype, { 44768 44769 /** 44770 * Stops the propagation to the next bubble target 44771 * @method stopPropagation 44772 */ 44773 stopPropagation: function() { 44774 this._event.stopPropagation(); 44775 this.stopped = 1; 44776 }, 44777 44778 /** 44779 * Stops the propagation to the next bubble target and 44780 * prevents any additional listeners from being exectued 44781 * on the current target. 44782 * @method stopImmediatePropagation 44783 */ 44784 stopImmediatePropagation: function() { 44785 this._event.stopImmediatePropagation(); 44786 this.stopped = 2; 44787 }, 44788 44789 /** 44790 * Prevents the event's default behavior 44791 * @method preventDefault 44792 */ 44793 preventDefault: function() { 44794 this._event.preventDefault(); 44795 this.prevented = 1; 44796 }, 44797 44798 /** 44799 * Stops the event propagation and prevents the default 44800 * event behavior. 44801 * @method halt 44802 * @param immediate {boolean} if true additional listeners 44803 * on the current target will not be executed 44804 */ 44805 halt: function(immediate) { 44806 this._event.halt(immediate); 44807 this.prevented = 1; 44808 this.stopped = (immediate) ? 2 : 1; 44809 } 44810 44811}); 44812 44813CEProto.fireComplex = function(args) { 44814 44815 var es, 44816 ef, 44817 q, 44818 queue, 44819 ce, 44820 ret = true, 44821 events, 44822 subs, 44823 ons, 44824 afters, 44825 afterQueue, 44826 postponed, 44827 prevented, 44828 preventedFn, 44829 defaultFn, 44830 self = this, 44831 host = self.host || self, 44832 next, 44833 oldbubble, 44834 stack = self.stack, 44835 yuievt = host._yuievt, 44836 hasPotentialSubscribers; 44837 44838 if (stack) { 44839 44840 // queue this event if the current item in the queue bubbles 44841 if (self.queuable && self.type !== stack.next.type) { 44842 44843 if (!stack.queue) { 44844 stack.queue = []; 44845 } 44846 stack.queue.push([self, args]); 44847 44848 return true; 44849 } 44850 } 44851 44852 hasPotentialSubscribers = self.hasSubs() || yuievt.hasTargets || self.broadcast; 44853 44854 self.target = self.target || host; 44855 self.currentTarget = host; 44856 44857 self.details = args.concat(); 44858 44859 if (hasPotentialSubscribers) { 44860 44861 es = stack || { 44862 44863 id: self.id, // id of the first event in the stack 44864 next: self, 44865 silent: self.silent, 44866 stopped: 0, 44867 prevented: 0, 44868 bubbling: null, 44869 type: self.type, 44870 // defaultFnQueue: new Y.Queue(), 44871 defaultTargetOnly: self.defaultTargetOnly 44872 44873 }; 44874 44875 subs = self.getSubs(); 44876 ons = subs[0]; 44877 afters = subs[1]; 44878 44879 self.stopped = (self.type !== es.type) ? 0 : es.stopped; 44880 self.prevented = (self.type !== es.type) ? 0 : es.prevented; 44881 44882 if (self.stoppedFn) { 44883 // PERF TODO: Can we replace with callback, like preventedFn. Look into history 44884 events = new Y.EventTarget({
44885 fireOnce: true, 44886 context: host 44887 }); 44888 self.events = events; 44889 events.on('stopped', self.stoppedFn); 44890 } 44891 44892 44893 self._facade = null; // kill facade to eliminate stale properties 44894 44895 ef = self._createFacade(args); 44896 44897 if (ons) { 44898 self._procSubs(ons, args, ef); 44899 } 44900 44901 // bubble if this is hosted in an event target and propagation has not been stopped 44902 if (self.bubbles && host.bubble && !self.stopped) { 44903 oldbubble = es.bubbling; 44904 44905 es.bubbling = self.type; 44906 44907 if (es.type !== self.type) { 44908 es.stopped = 0; 44909 es.prevented = 0; 44910 } 44911 44912 ret = host.bubble(self, args, null, es); 44913 44914 self.stopped = Math.max(self.stopped, es.stopped); 44915 self.prevented = Math.max(self.prevented, es.prevented); 44916 44917 es.bubbling = oldbubble; 44918 } 44919 44920 prevented = self.prevented; 44921 44922 if (prevented) { 44923 preventedFn = self.preventedFn; 44924 if (preventedFn) {
44925 preventedFn.apply(host, args); 44926 } 44927 } else { 44928 defaultFn = self.defaultFn; 44929 44930 if (defaultFn && ((!self.defaultTargetOnly && !es.defaultTargetOnly) || host === ef.target)) { 44931 defaultFn.apply(host, args); 44932 } 44933 } 44934 44935 // broadcast listeners are fired as discreet events on the 44936 // YUI instance and potentially the YUI global. 44937 if (self.broadcast) { 44938 self._broadcast(args); 44939 } 44940 44941 if (afters && !self.prevented && self.stopped < 2) { 44942 44943 // Queue the after 44944 afterQueue = es.afterQueue; 44945 44946 if (es.id === self.id || self.type !== yuievt.bubbling) { 44947 44948 self._procSubs(afters, args, ef); 44949 44950 if (afterQueue) { 44951 while ((next = afterQueue.last())) { 44952 next(); 44953 } 44954 } 44955 } else { 44956 postponed = afters; 44957 44958 if (es.execDefaultCnt) { 44959 postponed = Y.merge(postponed); 44960 44961 Y.each(postponed, function(s) { 44962 s.postponed = true; 44963 }); 44964 } 44965 44966 if (!afterQueue) { 44967 es.afterQueue = new Y.Queue(); 44968 } 44969 44970 es.afterQueue.add(function() { 44971 self._procSubs(postponed, args, ef); 44972 }); 44973 } 44974 44975 } 44976 44977 self.target = null; 44978 44979 if (es.id === self.id) { 44980 44981 queue = es.queue; 44982 44983 if (queue) { 44984 while (queue.length) { 44985 q = queue.pop(); 44986 ce = q[0]; 44987 // set up stack to allow the next item to be processed 44988 es.next = ce; 44989 ce._fire(q[1]); 44990 } 44991 } 44992 44993 self.stack = null; 44994 } 44995 44996 ret = !(self.stopped); 44997 44998 if (self.type !== yuievt.bubbling) { 44999 es.stopped = 0; 45000 es.prevented = 0; 45001 self.stopped = 0; 45002 self.prevented = 0; 45003 } 45004 45005 } else { 45006 defaultFn = self.defaultFn; 45007 45008 if(defaultFn) { 45009 ef = self._createFacade(args); 45010 45011 if ((!self.defaultTargetOnly) || (host === ef.target)) {
45012 defaultFn.apply(host, args); 45013 } 45014 } 45015 } 45016 45017 // Kill the cached facade to free up memory. 45018 // Otherwise we have the facade from the last fire, sitting around forever. 45019 self._facade = null; 45020 45021 return ret; 45022}; 45023 45024/** 45025 * @method _hasPotentialSubscribers 45026 * @for CustomEvent 45027 * @private 45028 * @return {boolean} Whether the event has potential subscribers or not 45029 */ 45030CEProto._hasPotentialSubscribers = function() { 45031 return this.hasSubs() || this.host._yuievt.hasTargets || this.broadcast; 45032}; 45033 45034/** 45035 * Internal utility method to create a new facade instance and 45036 * insert it into the fire argument list, accounting for any payload 45037 * merging which needs to happen. 45038 * 45039 * This used to be called `_getFacade`, but the name seemed inappropriate 45040 * when it was used without a need for the return value. 45041 * 45042 * @method _createFacade 45043 * @private 45044 * @param fireArgs {Array} The arguments passed to "fire", which need to be 45045 * shifted (and potentially merged) when the facade is added. 45046 * @return {EventFacade} The event facade created. 45047 */ 45048 45049// TODO: Remove (private) _getFacade alias, once synthetic.js is updated. 45050CEProto._createFacade = CEProto._getFacade = function(fireArgs) { 45051 45052 var userArgs = this.details, 45053 firstArg = userArgs && userArgs[0], 45054 firstArgIsObj = (firstArg && (typeof firstArg === "object")), 45055 ef = this._facade; 45056 45057 if (!ef) { 45058 ef = new Y.EventFacade(this, this.currentTarget); 45059 } 45060 45061 if (firstArgIsObj) { 45062 // protect the event facade properties 45063 mixFacadeProps(ef, firstArg); 45064 45065 // Allow the event type to be faked http://yuilibrary.com/projects/yui3/ticket/2528376 45066 if (firstArg.type) { 45067 ef.type = firstArg.type; 45068 } 45069 45070 if (fireArgs) { 45071 fireArgs[0] = ef; 45072 } 45073 } else { 45074 if (fireArgs) { 45075 fireArgs.unshift(ef); 45076 } 45077 } 45078 45079 // update the details field with the arguments 45080 ef.details = this.details; 45081 45082 // use the original target when the event bubbled to this target 45083 ef.target = this.originalTarget || this.target; 45084 45085 ef.currentTarget = this.currentTarget; 45086 ef.stopped = 0; 45087 ef.prevented = 0; 45088 45089 this._facade = ef; 45090 45091 return this._facade; 45092}; 45093 45094/** 45095 * Utility method to manipulate the args array passed in, to add the event facade, 45096 * if it's not already the first arg. 45097 * 45098 * @method _addFacadeToArgs 45099 * @private 45100 * @param {Array} The arguments to manipulate 45101 */ 45102CEProto._addFacadeToArgs = function(args) { 45103 var e = args[0]; 45104 45105 // Trying not to use instanceof, just to avoid potential cross Y edge case issues. 45106 if (!(e && e.halt && e.stopImmediatePropagation && e.stopPropagation && e._event)) { 45107 this._createFacade(args); 45108 } 45109}; 45110 45111/** 45112 * Stop propagation to bubble targets 45113 * @for CustomEvent 45114 * @method stopPropagation 45115 */ 45116CEProto.stopPropagation = function() { 45117 this.stopped = 1; 45118 if (this.stack) { 45119 this.stack.stopped = 1; 45120 } 45121 if (this.events) { 45122 this.events.fire('stopped', this); 45123 } 45124}; 45125 45126/** 45127 * Stops propagation to bubble targets, and prevents any remaining 45128 * subscribers on the current target from executing. 45129 * @method stopImmediatePropagation 45130 */ 45131CEProto.stopImmediatePropagation = function() { 45132 this.stopped = 2; 45133 if (this.stack) { 45134 this.stack.stopped = 2; 45135 } 45136 if (this.events) { 45137 this.events.fire('stopped', this); 45138 } 45139}; 45140 45141/** 45142 * Prevents the execution of this event's defaultFn 45143 * @method preventDefault 45144 */ 45145CEProto.preventDefault = function() { 45146 if (this.preventable) { 45147 this.prevented = 1; 45148 if (this.stack) { 45149 this.stack.prevented = 1; 45150 } 45151 } 45152}; 45153 45154/** 45155 * Stops the event propagation and prevents the default 45156 * event behavior. 45157 * @method halt 45158 * @param immediate {boolean} if true additional listeners 45159 * on the current target will not be executed 45160 */ 45161CEProto.halt = function(immediate) { 45162 if (immediate) { 45163 this.stopImmediatePropagation(); 45164 } else { 45165 this.stopPropagation(); 45166 } 45167 this.preventDefault(); 45168}; 45169 45170/** 45171 * Registers another EventTarget as a bubble target. Bubble order 45172 * is determined by the order registered. Multiple targets can 45173 * be specified. 45174 * 45175 * Events can only bubble if emitFacade is true. 45176 * 45177 * Included in the event-custom-complex submodule. 45178 * 45179 * @method addTarget 45180 * @chainable 45181 * @param o {EventTarget} the target to add 45182 * @for EventTarget 45183 */ 45184ETProto.addTarget = function(o) { 45185 var etState = this._yuievt; 45186 45187 if (!etState.targets) { 45188 etState.targets = {}; 45189 } 45190 45191 etState.targets[Y.stamp(o)] = o; 45192 etState.hasTargets = true; 45193 45194 return this; 45195}; 45196 45197/** 45198 * Returns an array of bubble targets for this object. 45199 * @method getTargets 45200 * @return EventTarget[] 45201 */ 45202ETProto.getTargets = function() { 45203 var targets = this._yuievt.targets; 45204 return targets ? YObject.values(targets) : []; 45205}; 45206 45207/** 45208 * Removes a bubble target 45209 * @method removeTarget 45210 * @chainable 45211 * @param o {EventTarget} the target to remove 45212 * @for EventTarget 45213 */ 45214ETProto.removeTarget = function(o) { 45215 var targets = this._yuievt.targets; 45216 45217 if (targets) { 45218 delete targets[Y.stamp(o, true)]; 45219 45220 if (YObject.size(targets) === 0) { 45221 this._yuievt.hasTargets = false;
45222 } 45223 } 45224 45225 return this; 45226}; 45227 45228/** 45229 * Propagate an event. Requires the event-custom-complex module. 45230 * @method bubble 45231 * @param evt {CustomEvent} the custom event to propagate 45232 * @return {boolean} the aggregated return value from Event.Custom.fire 45233 * @for EventTarget 45234 */ 45235ETProto.bubble = function(evt, args, target, es) { 45236 45237 var targs = this._yuievt.targets, 45238 ret = true, 45239 t, 45240 ce, 45241 i, 45242 bc, 45243 ce2, 45244 type = evt && evt.type, 45245 originalTarget = target || (evt && evt.target) || this, 45246 oldbubble; 45247 45248 if (!evt || ((!evt.stopped) && targs)) { 45249 45250 for (i in targs) { 45251 if (targs.hasOwnProperty(i)) { 45252 45253 t = targs[i]; 45254 45255 ce = t._yuievt.events[type]; 45256 45257 if (t._hasSiblings) { 45258 ce2 = t.getSibling(type, ce); 45259 } 45260 45261 if (ce2 && !ce) { 45262 ce = t.publish(type); 45263 } 45264 45265 oldbubble = t._yuievt.bubbling; 45266 t._yuievt.bubbling = type; 45267 45268 // if this event was not published on the bubble target, 45269 // continue propagating the event. 45270 if (!ce) { 45271 if (t._yuievt.hasTargets) { 45272 t.bubble(evt, args, originalTarget, es); 45273 } 45274 } else { 45275 45276 if (ce2) { 45277 ce.sibling = ce2; 45278 } 45279 45280 // set the original target to that the target payload on the facade is correct. 45281 ce.target = originalTarget; 45282 ce.originalTarget = originalTarget; 45283 ce.currentTarget = t; 45284 bc = ce.broadcast; 45285 ce.broadcast = false; 45286 45287 // default publish may not have emitFacade true -- that 45288 // shouldn't be what the implementer meant to do 45289 ce.emitFacade = true; 45290 45291 ce.stack = es; 45292 45293 // TODO: See what's getting in the way of changing this to use 45294 // the more performant ce._fire(args || evt.details || []). 45295 45296 // Something in Widget Parent/Child tests is not happy if we 45297 // change it - maybe evt.details related? 45298 ret = ret && ce.fire.apply(ce, args || evt.details || []); 45299 45300 ce.broadcast = bc; 45301 ce.originalTarget = null; 45302 45303 // stopPropagation() was called 45304 if (ce.stopped) { 45305 break; 45306 } 45307 } 45308 45309 t._yuievt.bubbling = oldbubble; 45310 } 45311 } 45312 } 45313 45314 return ret; 45315}; 45316 45317/** 45318 * @method _hasPotentialSubscribers 45319 * @for EventTarget 45320 * @private 45321 * @param {String} fullType The fully prefixed type name 45322 * @return {boolean} Whether the event has potential subscribers or not 45323 */ 45324ETProto._hasPotentialSubscribers = function(fullType) { 45325 45326 var etState = this._yuievt, 45327 e = etState.events[fullType]; 45328 45329 if (e) { 45330 return e.hasSubs() || etState.hasTargets || e.broadcast; 45331 } else { 45332 return false; 45333 } 45334}; 45335 45336FACADE = new Y.EventFacade(); 45337FACADE_KEYS = {}; 45338 45339// Flatten whitelist 45340for (key in FACADE) { 45341 FACADE_KEYS[key] = true; 45342} 45343 45344 45345}, 'patched-v3.18.1', {"requires": ["event-custom-base"]}); 45346 45347YUI.add('event-delegate', function (Y, NAME) { 45348 45349/** 45350 * Adds event delegation support to the library. 45351 * 45352 * @module event 45353 * @submodule event-delegate 45354 */ 45355 45356var toArray = Y.Array, 45357 YLang = Y.Lang, 45358 isString = YLang.isString, 45359 isObject = YLang.isObject, 45360 isArray = YLang.isArray, 45361 selectorTest = Y.Selector.test, 45362 detachCategories = Y.Env.evt.handles; 45363 45364/** 45365 * <p>Sets up event delegation on a container element. The delegated event 45366 * will use a supplied selector or filtering function to test if the event 45367 * references at least one node that should trigger the subscription 45368 * callback.</p> 45369 * 45370 * <p>Selector string filters will trigger the callback if the event originated 45371 * from a node that matches it or is contained in a node that matches it. 45372 * Function filters are called for each Node up the parent axis to the 45373 * subscribing container node, and receive at each level the Node and the event 45374 * object. The function should return true (or a truthy value) if that Node 45375 * should trigger the subscription callback. Note, it is possible for filters 45376 * to match multiple Nodes for a single event. In this case, the delegate 45377 * callback will be executed for each matching Node.</p> 45378 * 45379 * <p>For each matching Node, the callback will be executed with its 'this' 45380 * object set to the Node matched by the filter (unless a specific context was 45381 * provided during subscription), and the provided event's 45382 * <code>currentTarget</code> will also be set to the matching Node. The 45383 * containing Node from which the subscription was originally made can be 45384 * referenced as <code>e.container</code>. 45385 * 45386 * @method delegate 45387 * @param type {String} the event type to delegate 45388 * @param fn {Function} the callback function to execute. This function 45389 * will be provided the event object for the delegated event. 45390 * @param el {String|node} the element that is the delegation container 45391 * @param filter {string|Function} a selector that must match the target of the 45392 * event or a function to test target and its parents for a match 45393 * @param context optional argument that specifies what 'this' refers to. 45394 * @param args* 0..n additional arguments to pass on to the callback function. 45395 * These arguments will be added after the event object. 45396 * @return {EventHandle} the detach handle 45397 * @static 45398 * @for Event 45399 */ 45400function delegate(type, fn, el, filter) { 45401 var args = toArray(arguments, 0, true), 45402 query = isString(el) ? el : null,
45403 typeBits, synth, container, categories, cat, i, len, handles, handle; 45404 45405 // Support Y.delegate({ click: fnA, key: fnB }, el, filter, ...); 45406 // and Y.delegate(['click', 'key'], fn, el, filter, ...); 45407 if (isObject(type)) { 45408 handles = []; 45409 45410 if (isArray(type)) { 45411 for (i = 0, len = type.length; i < len; ++i) { 45412 args[0] = type[i]; 45413 handles.push(Y.delegate.apply(Y, args)); 45414 } 45415 } else { 45416 // Y.delegate({'click', fn}, el, filter) => 45417 // Y.delegate('click', fn, el, filter) 45418 args.unshift(null); // one arg becomes two; need to make space 45419 45420 for (i in type) { 45421 if (type.hasOwnProperty(i)) { 45422 args[0] = i; 45423 args[1] = type[i]; 45424 handles.push(Y.delegate.apply(Y, args)); 45425 } 45426 } 45427 } 45428 45429 return new Y.EventHandle(handles); 45430 } 45431 45432 typeBits = type.split(/\|/); 45433 45434 if (typeBits.length > 1) { 45435 cat = typeBits.shift(); 45436 args[0] = type = typeBits.shift(); 45437 } 45438 45439 synth = Y.Node.DOM_EVENTS[type]; 45440 45441 if (isObject(synth) && synth.delegate) { 45442 handle = synth.delegate.apply(synth, arguments); 45443 } 45444 45445 if (!handle) { 45446 if (!type || !fn || !el || !filter) { 45447 return; 45448 } 45449 45450 container = (query) ? Y.Selector.query(query, null, true) : el; 45451 45452 if (!container && isString(el)) { 45453 handle = Y.on('available', function () { 45454 Y.mix(handle, Y.delegate.apply(Y, args), true); 45455 }, el); 45456 } 45457 45458 if (!handle && container) { 45459 args.splice(2, 2, container); // remove the filter 45460 45461 handle = Y.Event._attach(args, { facade: false }); 45462 handle.sub.filter = filter; 45463 handle.sub._notify = delegate.notifySub; 45464 } 45465 } 45466 45467 if (handle && cat) { 45468 categories = detachCategories[cat] || (detachCategories[cat] = {}); 45469 categories = categories[type] || (categories[type] = []); 45470 categories.push(handle); 45471 } 45472 45473 return handle; 45474} 45475
45476/** 45477Overrides the <code>_notify</code> method on the normal DOM subscription to 45478inject the filtering logic and only proceed in the case of a match. 45479 45480This method is hosted as a private property of the `delegate` method 45481(e.g. `Y.delegate.notifySub`) 45482 45483@method notifySub 45484@param thisObj {Object} default 'this' object for the callback 45485@param args {Array} arguments passed to the event's <code>fire()</code> 45486@param ce {CustomEvent} the custom event managing the DOM subscriptions for 45487 the subscribed event on the subscribing node. 45488@return {Boolean} false if the event was stopped 45489@private 45490@static 45491@since 3.2.0 45492**/ 45493delegate.notifySub = function (thisObj, args, ce) { 45494 // Preserve args for other subscribers 45495 args = args.slice(); 45496 if (this.args) { 45497 args.push.apply(args, this.args); 45498 } 45499 45500 // Only notify subs if the event occurred on a targeted element 45501 var currentTarget = delegate._applyFilter(this.filter, args, ce), 45502 //container = e.currentTarget, 45503 e, i, len, ret; 45504 45505 if (currentTarget) { 45506 // Support multiple matches up the the container subtree 45507 currentTarget = toArray(currentTarget); 45508 45509 // The second arg is the currentTarget, but we'll be reusing this 45510 // facade, replacing the currentTarget for each use, so it doesn't 45511 // matter what element we seed it with. 45512 e = args[0] = new Y.DOMEventFacade(args[0], ce.el, ce); 45513 45514 e.container = Y.one(ce.el); 45515 45516 for (i = 0, len = currentTarget.length; i < len && !e.stopped; ++i) { 45517 e.currentTarget = Y.one(currentTarget[i]); 45518 45519 ret = this.fn.apply(this.context || e.currentTarget, args); 45520 45521 if (ret === false) { // stop further notifications 45522 break; 45523 } 45524 } 45525 45526 return ret; 45527 } 45528}; 45529 45530/** 45531Compiles a selector string into a filter function to identify whether 45532Nodes along the parent axis of an event's target should trigger event 45533notification. 45534 45535This function is memoized, so previously compiled filter functions are 45536returned if the same selector string is provided. 45537 45538This function may be useful when defining synthetic events for delegate 45539handling. 45540 45541Hosted as a property of the `delegate` method (e.g. `Y.delegate.compileFilter`). 45542 45543@method compileFilter 45544@param selector {String} the selector string to base the filtration on 45545@return {Function} 45546@since 3.2.0 45547@static 45548**/ 45549delegate.compileFilter = Y.cached(function (selector) { 45550 return function (target, e) { 45551 return selectorTest(target._node, selector, 45552 (e.currentTarget === e.target) ? null : e.currentTarget._node); 45553 }; 45554}); 45555 45556/** 45557Regex to test for disabled elements during filtering. This is only relevant to 45558IE to normalize behavior with other browsers, which swallow events that occur 45559to disabled elements. IE fires the event from the parent element instead of the 45560original target, though it does preserve `event.srcElement` as the disabled 45561element. IE also supports disabled on `<a>`, but the event still bubbles, so it 45562acts more like `e.preventDefault()` plus styling. That issue is not handled here 45563because other browsers fire the event on the `<a>`, so delegate is supported in 45564both cases. 45565 45566@property _disabledRE 45567@type {RegExp} 45568@protected 45569@since 3.8.1 45570**/ 45571delegate._disabledRE = /^(?:button|input|select|textarea)$/i; 45572 45573/** 45574Walks up the parent axis of an event's target, and tests each element 45575against a supplied filter function. If any Nodes, including the container, 45576satisfy the filter, the delegated callback will be triggered for each. 45577 45578Hosted as a protected property of the `delegate` method (e.g. 45579`Y.delegate._applyFilter`). 45580 45581@method _applyFilter 45582@param filter {Function} boolean function to test for inclusion in event 45583 notification 45584@param args {Array} the arguments that would be passed to subscribers 45585@param ce {CustomEvent} the DOM event wrapper 45586@return {Node|Node[]|undefined} The Node or Nodes that satisfy the filter 45587@protected 45588**/ 45589delegate._applyFilter = function (filter, args, ce) { 45590 var e = args[0], 45591 container = ce.el, // facadeless events in IE, have no e.currentTarget 45592 target = e.target || e.srcElement, 45593 match = [], 45594 isContainer = false;
45595 45596 // Resolve text nodes to their containing element 45597 if (target.nodeType === 3) { 45598 target = target.parentNode; 45599 } 45600 45601 // For IE. IE propagates events from the parent element of disabled 45602 // elements, where other browsers swallow the event entirely. To normalize 45603 // this in IE, filtering for matching elements should abort if the target 45604 // is a disabled form control. 45605 if (target.disabled && delegate._disabledRE.test(target.nodeName)) { 45606 return match; 45607 } 45608 45609 // passing target as the first arg rather than leaving well enough alone 45610 // making 'this' in the filter function refer to the target. This is to 45611 // support bound filter functions. 45612 args.unshift(target); 45613 45614 if (isString(filter)) { 45615 while (target) { 45616 isContainer = (target === container); 45617 if (selectorTest(target, filter, (isContainer ? null: container))) { 45618 match.push(target); 45619 } 45620 45621 if (isContainer) { 45622 break; 45623 } 45624 45625 target = target.parentNode; 45626 } 45627 } else { 45628 // filter functions are implementer code and should receive wrappers 45629 args[0] = Y.one(target); 45630 args[1] = new Y.DOMEventFacade(e, container, ce); 45631 45632 while (target) { 45633 // filter(target, e, extra args...) - this === target 45634 if (filter.apply(args[0], args)) { 45635 match.push(target); 45636 } 45637 45638 if (target === container) { 45639 break; 45640 } 45641 45642 target = target.parentNode; 45643 args[0] = Y.one(target); 45644 } 45645 args[1] = e; // restore the raw DOM event 45646 } 45647 45648 if (match.length <= 1) { 45649 match = match[0]; // single match or undefined 45650 } 45651 45652 // remove the target 45653 args.shift(); 45654 45655 return match; 45656}; 45657 45658/** 45659 * Sets up event delegation on a container element. The delegated event 45660 * will use a supplied filter to test if the callback should be executed. 45661 * This filter can be either a selector string or a function that returns 45662 * a Node to use as the currentTarget for the event. 45663 * 45664 * The event object for the delegated event is supplied to the callback 45665 * function. It is modified slightly in order to support all properties 45666 * that may be needed for event delegation. 'currentTarget' is set to 45667 * the element that matched the selector string filter or the Node returned 45668 * from the filter function. 'container' is set to the element that the 45669 * listener is delegated from (this normally would be the 'currentTarget'). 45670 * 45671 * Filter functions will be called with the arguments that would be passed to 45672 * the callback function, including the event object as the first parameter. 45673 * The function should return false (or a falsey value) if the success criteria 45674 * aren't met, and the Node to use as the event's currentTarget and 'this' 45675 * object if they are. 45676 * 45677 * @method delegate 45678 * @param type {string} the event type to delegate 45679 * @param fn {function} the callback function to execute. This function 45680 * will be provided the event object for the delegated event. 45681 * @param el {string|node} the element that is the delegation container 45682 * @param filter {string|function} a selector that must match the target of the 45683 * event or a function that returns a Node or false. 45684 * @param context optional argument that specifies what 'this' refers to. 45685 * @param args* 0..n additional arguments to pass on to the callback function. 45686 * These arguments will be added after the event object. 45687 * @return {EventHandle} the detach handle 45688 * @for YUI 45689 */ 45690Y.delegate = Y.Event.delegate = delegate; 45691 45692 45693}, 'patched-v3.18.1', {"requires": ["node-base"]}); 45694 45695YUI.add('event-focus', function (Y, NAME) { 45696 45697/** 45698 * Adds bubbling and delegation support to DOM events focus and blur. 45699 * 45700 * @module event 45701 * @submodule event-focus 45702 */ 45703var Event = Y.Event, 45704 45705 YLang = Y.Lang, 45706 45707 isString = YLang.isString, 45708 45709 arrayIndex = Y.Array.indexOf, 45710 45711 useActivate = (function() { 45712 45713 // Changing the structure of this test, so that it doesn't use inline JS in HTML, 45714 // which throws an exception in Win8 packaged apps, due to additional security restrictions:
45715 // http://msdn.microsoft.com/en-us/library/windows/apps/hh465380.aspx#differences 45716 45717 var supported = false, 45718 doc = Y.config.doc, 45719 p; 45720 45721 if (doc) { 45722 45723 p = doc.createElement("p"); 45724 p.setAttribute("onbeforeactivate", ";"); 45725 45726 // onbeforeactivate is a function in IE8+. 45727 // onbeforeactivate is a string in IE6,7 (unfortunate, otherwise we could have just checked for function below). 45728 // onbeforeactivate is a function in IE10, in a Win8 App environment (no exception running the test). 45729 45730 // onbeforeactivate is undefined in Webkit/Gecko. 45731 // onbeforeactivate is a function in Webkit/Gecko if it's a supported event (e.g. onclick). 45732 45733 supported = (p.onbeforeactivate !== undefined); 45734 } 45735 45736 return supported; 45737 }()); 45738 45739function define(type, proxy, directEvent) { 45740 var nodeDataKey = '_' + type + 'Notifiers'; 45741 45742 Y.Event.define(type, { 45743 45744 _useActivate : useActivate, 45745 45746 _attach: function (el, notifier, delegate) { 45747 if (Y.DOM.isWindow(el)) { 45748 return Event._attach([type, function (e) { 45749 notifier.fire(e); 45750 }, el]); 45751 } else { 45752 return Event._attach( 45753 [proxy, this._proxy, el, this, notifier, delegate], 45754 { capture: true }); 45755 } 45756 }, 45757 45758 _proxy: function (e, notifier, delegate) { 45759 var target = e.target, 45760 currentTarget = e.currentTarget, 45761 notifiers = target.getData(nodeDataKey), 45762 yuid = Y.stamp(currentTarget._node), 45763 defer = (useActivate || target !== currentTarget), 45764 directSub; 45765 45766 notifier.currentTarget = (delegate) ? target : currentTarget; 45767 notifier.container = (delegate) ? currentTarget : null; 45768 45769 // Maintain a list to handle subscriptions from nested 45770 // containers div#a>div#b>input #a.on(focus..) #b.on(focus..), 45771 // use one focus or blur subscription that fires notifiers from 45772 // #b then #a to emulate bubble sequence. 45773 if (!notifiers) { 45774 notifiers = {}; 45775 target.setData(nodeDataKey, notifiers); 45776 45777 // only subscribe to the element's focus if the target is 45778 // not the current target ( 45779 if (defer) { 45780 directSub = Event._attach( 45781 [directEvent, this._notify, target._node]).sub; 45782 directSub.once = true; 45783 } 45784 } else { 45785 // In old IE, defer is always true. In capture-phase browsers, 45786 // The delegate subscriptions will be encountered first, which 45787 // will establish the notifiers data and direct subscription 45788 // on the node. If there is also a direct subscription to the 45789 // node's focus/blur, it should not call _notify because the 45790 // direct subscription from the delegate sub(s) exists, which 45791 // will call _notify. So this avoids _notify being called 45792 // twice, unnecessarily. 45793 defer = true; 45794 } 45795 45796 if (!notifiers[yuid]) { 45797 notifiers[yuid] = []; 45798 } 45799 45800 notifiers[yuid].push(notifier); 45801 45802 if (!defer) { 45803 this._notify(e); 45804 } 45805 }, 45806 45807 _notify: function (e, container) { 45808 var currentTarget = e.currentTarget, 45809 notifierData = currentTarget.getData(nodeDataKey), 45810 axisNodes = currentTarget.ancestors(), 45811 doc = currentTarget.get('ownerDocument'), 45812 delegates = [], 45813 // Used to escape loops when there are no more 45814 // notifiers to consider 45815 count = notifierData ? 45816 Y.Object.keys(notifierData).length : 45817 0, 45818 target, notifiers, notifier, yuid, match, tmp, i, len, sub, ret; 45819 45820 // clear the notifications list (mainly for delegation) 45821 currentTarget.clearData(nodeDataKey); 45822 45823 // Order the delegate subs by their placement in the parent axis 45824 axisNodes.push(currentTarget); 45825 // document.get('ownerDocument') returns null 45826 // which we'll use to prevent having duplicate Nodes in the list 45827 if (doc) { 45828 axisNodes.unshift(doc); 45829 } 45830 45831 // ancestors() returns the Nodes from top to bottom 45832 axisNodes._nodes.reverse(); 45833 45834 if (count) { 45835 // Store the count for step 2 45836 tmp = count; 45837 axisNodes.some(function (node) { 45838 var yuid = Y.stamp(node), 45839 notifiers = notifierData[yuid], 45840 i, len; 45841 45842 if (notifiers) { 45843 count--; 45844 for (i = 0, len = notifiers.length; i < len; ++i) { 45845 if (notifiers[i].handle.sub.filter) { 45846 delegates.push(notifiers[i]); 45847 } 45848 } 45849 } 45850 45851 return !count; 45852 }); 45853 count = tmp; 45854 } 45855 45856 // Walk up the parent axis, notifying direct subscriptions and 45857 // testing delegate filters. 45858 while (count && (target = axisNodes.shift())) { 45859 yuid = Y.stamp(target); 45860 45861 notifiers = notifierData[yuid]; 45862 45863 if (notifiers) { 45864 for (i = 0, len = notifiers.length; i < len; ++i) { 45865 notifier = notifiers[i]; 45866 sub = notifier.handle.sub; 45867 match = true; 45868 45869 e.currentTarget = target; 45870 45871 if (sub.filter) { 45872 match = sub.filter.apply(target, 45873 [target, e].concat(sub.args || [])); 45874 45875 // No longer necessary to test against this 45876 // delegate subscription for the nodes along 45877 // the parent axis. 45878 delegates.splice( 45879 arrayIndex(delegates, notifier), 1); 45880 } 45881 45882 if (match) { 45883 // undefined for direct subs 45884 e.container = notifier.container; 45885 ret = notifier.fire(e); 45886 } 45887 45888 if (ret === false || e.stopped === 2) { 45889 break; 45890 } 45891 } 45892 45893 delete notifiers[yuid]; 45894 count--; 45895 } 45896 45897 if (e.stopped !== 2) { 45898 // delegates come after subs targeting this specific node 45899 // because they would not normally report until they'd 45900 // bubbled to the container node. 45901 for (i = 0, len = delegates.length; i < len; ++i) { 45902 notifier = delegates[i]; 45903 sub = notifier.handle.sub; 45904 45905 if (sub.filter.apply(target, 45906 [target, e].concat(sub.args || []))) { 45907 45908 e.container = notifier.container; 45909 e.currentTarget = target; 45910 ret = notifier.fire(e); 45911 } 45912 45913 if (ret === false || e.stopped === 2 || 45914 // If e.stopPropagation() is called, notify any 45915 // delegate subs from the same container, but break 45916 // once the container changes. This emulates 45917 // delegate() behavior for events like 'click' which 45918 // won't notify delegates higher up the parent axis. 45919 (e.stopped && delegates[i+1] && 45920 delegates[i+1].container !== notifier.container)) { 45921 break; 45922 } 45923 } 45924 } 45925 45926 if (e.stopped) { 45927 break; 45928 } 45929 } 45930 }, 45931 45932 on: function (node, sub, notifier) { 45933 sub.handle = this._attach(node._node, notifier); 45934 }, 45935 45936 detach: function (node, sub) { 45937 sub.handle.detach(); 45938 }, 45939 45940 delegate: function (node, sub, notifier, filter) { 45941 if (isString(filter)) { 45942 sub.filter = function (target) { 45943 return Y.Selector.test(target._node, filter, 45944 node === target ? null : node._node); 45945 }; 45946 } 45947 45948 sub.handle = this._attach(node._node, notifier, true); 45949 }, 45950 45951 detachDelegate: function (node, sub) { 45952 sub.handle.detach(); 45953 } 45954 }, true); 45955} 45956 45957// For IE, we need to defer to focusin rather than focus because 45958// `el.focus(); doSomething();` executes el.onbeforeactivate, el.onactivate, 45959// el.onfocusin, doSomething, then el.onfocus. All others support capture 45960// phase focus, which executes before doSomething. To guarantee consistent 45961// behavior for this use case, IE's direct subscriptions are made against 45962// focusin so subscribers will be notified before js following el.focus() is 45963// executed. 45964if (useActivate) { 45965 // name capture phase direct subscription 45966 define("focus", "beforeactivate", "focusin");
45967 define("blur", "beforedeactivate", "focusout"); 45968} else { 45969 define("focus", "focus", "focus"); 45970 define("blur", "blur", "blur"); 45971} 45972 45973 45974}, 'patched-v3.18.1', {"requires": ["event-synthetic"]}); 45975 45976YUI.add('event-hover', function (Y, NAME) { 45977 45978/** 45979 * Adds support for a "hover" event. The event provides a convenience wrapper 45980 * for subscribing separately to mouseenter and mouseleave. The signature for 45981 * subscribing to the event is</p> 45982 * 45983 * <pre><code>node.on("hover", overFn, outFn); 45984 * node.delegate("hover", overFn, outFn, ".filterSelector"); 45985 * Y.on("hover", overFn, outFn, ".targetSelector"); 45986 * Y.delegate("hover", overFn, outFn, "#container", ".filterSelector"); 45987 * </code></pre> 45988 * 45989 * <p>Additionally, for compatibility with a more typical subscription 45990 * signature, the following are also supported:</p> 45991 * 45992 * <pre><code>Y.on("hover", overFn, ".targetSelector", outFn); 45993 * Y.delegate("hover", overFn, "#container", outFn, ".filterSelector"); 45994 * </code></pre> 45995 * 45996 * @module event 45997 * @submodule event-hover 45998 */ 45999var isFunction = Y.Lang.isFunction, 46000 noop = function () {}, 46001 conf = { 46002 processArgs: function (args) { 46003 // Y.delegate('hover', over, out, '#container', '.filter') 46004 // comes in as ['hover', over, out, '#container', '.filter'], but 46005 // node.delegate('hover', over, out, '.filter') 46006 // comes in as ['hover', over, containerEl, out, '.filter'] 46007 var i = isFunction(args[2]) ? 2 : 3; 46008 46009 return (isFunction(args[i])) ? args.splice(i,1)[0] : noop; 46010 }, 46011 46012 on: function (node, sub, notifier, filter) { 46013 var args = (sub.args) ? sub.args.slice() : []; 46014 46015 args.unshift(null); 46016 46017 sub._detach = node[(filter) ? "delegate" : "on"]({ 46018 mouseenter: function (e) { 46019 e.phase = 'over'; 46020 notifier.fire(e); 46021 }, 46022 mouseleave: function (e) { 46023 var thisObj = sub.context || this; 46024 46025 args[0] = e; 46026 46027 e.type = 'hover'; 46028 e.phase = 'out'; 46029 sub._extra.apply(thisObj, args); 46030 } 46031 }, filter); 46032 }, 46033 46034 detach: function (node, sub, notifier) { 46035 sub._detach.detach(); 46036 } 46037 }; 46038 46039conf.delegate = conf.on; 46040conf.detachDelegate = conf.detach; 46041 46042Y.Event.define("hover", conf); 46043 46044 46045}, 'patched-v3.18.1', {"requires": ["event-mouseenter"]}); 46046
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.