vendor: 2,248 bytes, lines 1-79
1/*! 2 * jQuery JavaScript Library v3.7.1 3 * https://jquery.com/ 4 * 5 * Copyright OpenJS Foundation and other contributors 6 * Released under the MIT license 7 * https://jquery.org/license 8 * 9 * Date: 2023-08-28T13:37Z 10 */ 11( function( global, factory ) { 12 13 "use strict"; 14 15 if ( typeof module === "object" && typeof module.exports === "object" ) { 16 17 // For CommonJS and CommonJS-like environments where a proper `window` 18 // is present, execute the factory and get jQuery. 19 // For environments that do not have a `window` with a `document` 20 // (such as Node.js), expose a factory as module.exports. 21 // This accentuates the need for the creation of a real `window`. 22 // e.g. var jQuery = require("jquery")(window); 23 // See ticket trac-14549 for more info. 24 module.exports = global.document ? 25 factory( global, true ) : 26 function( w ) { 27 if ( !w.document ) { 28 throw new Error( "jQuery requires a window with a document" ); 29 } 30 return factory( w ); 31 }; 32 } else { 33 factory( global ); 34 } 35 36// Pass this if window is not defined yet 37} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 38 39// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 40// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 41// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 42// enough that all such attempts are guarded in a try block. 43"use strict"; 44 45var arr = []; 46 47var getProto = Object.getPrototypeOf; 48 49var slice = arr.slice; 50 51var flat = arr.flat ? function( array ) { 52 return arr.flat.call( array ); 53} : function( array ) { 54 return arr.concat.apply( [], array ); 55}; 56 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.
vendor: 10,176 bytes, lines 80-508
80 // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 81 // Plus for old WebKit, typeof returns "function" for HTML collections 82 // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) 83 return typeof obj === "function" && typeof obj.nodeType !== "number" && 84 typeof obj.item !== "function"; 85 }; 86 87 88var isWindow = function isWindow( obj ) { 89 return obj != null && obj === obj.window; 90 }; 91 92 93var document = window.document; 94 95 96 97 var preservedScriptAttributes = { 98 type: true, 99 src: true, 100 nonce: true, 101 noModule: true 102 }; 103 104 function DOMEval( code, node, doc ) { 105 doc = doc || document; 106 107 var i, val, 108 script = doc.createElement( "script" ); 109 110 script.text = code; 111 if ( node ) { 112 for ( i in preservedScriptAttributes ) { 113 114 // Support: Firefox 64+, Edge 18+ 115 // Some browsers don't support the "nonce" property on scripts. 116 // On the other hand, just using `getAttribute` is not enough as 117 // the `nonce` attribute is reset to an empty string whenever it 118 // becomes browsing-context connected. 119 // See https://github.com/whatwg/html/issues/2369 120 // See https://html.spec.whatwg.org/#nonce-attributes 121 // The `node.getAttribute` check was added for the sake of 122 // `jQuery.globalEval` so that it can fake a nonce-containing node 123 // via an object. 124 val = node[ i ] || node.getAttribute && node.getAttribute( i ); 125 if ( val ) { 126 script.setAttribute( i, val ); 127 } 128 } 129 } 130 doc.head.appendChild( script ).parentNode.removeChild( script ); 131 } 132 133 134function toType( obj ) { 135 if ( obj == null ) { 136 return obj + ""; 137 } 138 139 // Support: Android <=2.3 only (functionish RegExp) 140 return typeof obj === "object" || typeof obj === "function" ? 141 class2type[ toString.call( obj ) ] || "object" : 142 typeof obj; 143} 144/* global Symbol */ 145// Defining this global in .eslintrc.json would create a danger of using the global 146// unguarded in another place, it seems safer to define global only for this module 147 148 149 150var version = "3.7.1", 151 152 rhtmlSuffix = /HTML$/i, 153 154 // Define a local copy of jQuery 155 jQuery = function( selector, context ) { 156 157 // The jQuery object is actually just the init constructor 'enhanced' 158 // Need init if jQuery is called (just allow error to be thrown if not included) 159 return new jQuery.fn.init( selector, context ); 160 }; 161 162jQuery.fn = jQuery.prototype = { 163 164 // The current version of jQuery being used 165 jquery: version, 166 167 constructor: jQuery, 168 169 // The default length of a jQuery object is 0 170 length: 0, 171 172 toArray: function() { 173 return slice.call( this ); 174 }, 175 176 // Get the Nth element in the matched element set OR 177 // Get the whole matched element set as a clean array 178 get: function( num ) { 179 180 // Return all the elements in a clean array 181 if ( num == null ) { 182 return slice.call( this ); 183 } 184 185 // Return just the one element from the set 186 return num < 0 ? this[ num + this.length ] : this[ num ]; 187 }, 188 189 // Take an array of elements and push it onto the stack 190 // (returning the new matched element set) 191 pushStack: function( elems ) { 192 193 // Build a new jQuery matched element set 194 var ret = jQuery.merge( this.constructor(), elems ); 195 196 // Add the old object onto the stack (as a reference) 197 ret.prevObject = this; 198 199 // Return the newly-formed element set 200 return ret; 201 }, 202 203 // Execute a callback for every element in the matched set. 204 each: function( callback ) { 205 return jQuery.each( this, callback ); 206 }, 207 208 map: function( callback ) { 209 return this.pushStack( jQuery.map( this, function( elem, i ) { 210 return callback.call( elem, i, elem ); 211 } ) ); 212 }, 213 214 slice: function() { 215 return this.pushStack( slice.apply( this, arguments ) ); 216 }, 217 218 first: function() { 219 return this.eq( 0 ); 220 }, 221 222 last: function() { 223 return this.eq( -1 ); 224 }, 225 226 even: function() { 227 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 228 return ( i + 1 ) % 2; 229 } ) ); 230 }, 231 232 odd: function() { 233 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 234 return i % 2; 235 } ) ); 236 }, 237 238 eq: function( i ) { 239 var len = this.length, 240 j = +i + ( i < 0 ? len : 0 ); 241 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 242 }, 243 244 end: function() { 245 return this.prevObject || this.constructor(); 246 }, 247 248 // For internal use only. 249 // Behaves like an Array's method, not like a jQuery method. 250 push: push, 251 sort: arr.sort, 252 splice: arr.splice 253}; 254 255jQuery.extend = jQuery.fn.extend = function() { 256 var options, name, src, copy, copyIsArray, clone, 257 target = arguments[ 0 ] || {}, 258 i = 1, 259 length = arguments.length, 260 deep = false; 261 262 // Handle a deep copy situation 263 if ( typeof target === "boolean" ) { 264 deep = target; 265 266 // Skip the boolean and the target 267 target = arguments[ i ] || {}; 268 i++; 269 } 270 271 // Handle case when target is a string or something (possible in deep copy) 272 if ( typeof target !== "object" && !isFunction( target ) ) { 273 target = {}; 274 } 275 276 // Extend jQuery itself if only one argument is passed 277 if ( i === length ) { 278 target = this; 279 i--; 280 } 281 282 for ( ; i < length; i++ ) { 283 284 // Only deal with non-null/undefined values 285 if ( ( options = arguments[ i ] ) != null ) { 286 287 // Extend the base object 288 for ( name in options ) { 289 copy = options[ name ]; 290 291 // Prevent Object.prototype pollution 292 // Prevent never-ending loop 293 if ( name === "__proto__" || target === copy ) { 294 continue; 295 } 296 297 // Recurse if we're merging plain objects or arrays 298 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 299 ( copyIsArray = Array.isArray( copy ) ) ) ) { 300 src = target[ name ]; 301 302 // Ensure proper type for the source value 303 if ( copyIsArray && !Array.isArray( src ) ) { 304 clone = []; 305 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { 306 clone = {}; 307 } else { 308 clone = src; 309 } 310 copyIsArray = false; 311 312 // Never move original objects, clone them 313 target[ name ] = jQuery.extend( deep, clone, copy ); 314 315 // Don't bring in undefined values 316 } else if ( copy !== undefined ) { 317 target[ name ] = copy; 318 } 319 } 320 } 321 } 322 323 // Return the modified object 324 return target; 325}; 326 327jQuery.extend( { 328 329 // Unique for each copy of jQuery on the page 330 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 331 332 // Assume jQuery is ready without the ready module 333 isReady: true, 334 335 error: function( msg ) { 336 throw new Error( msg ); 337 }, 338 339 noop: function() {}, 340 341 isPlainObject: function( obj ) { 342 var proto, Ctor; 343 344 // Detect obvious negatives 345 // Use toString instead of jQuery.type to catch host objects 346 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 347 return false; 348 } 349 350 proto = getProto( obj ); 351 352 // Objects with no prototype (e.g., `Object.create( null )`) are plain 353 if ( !proto ) { 354 return true; 355 } 356 357 // Objects with prototype are plain iff they were constructed by a global Object function 358 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 359 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 360 }, 361 362 isEmptyObject: function( obj ) { 363 var name; 364 365 for ( name in obj ) { 366 return false; 367 } 368 return true; 369 }, 370 371 // Evaluates a script in a provided context; falls back to the global one 372 // if not specified. 373 globalEval: function( code, options, doc ) { 374 DOMEval( code, { nonce: options && options.nonce }, doc ); 375 }, 376 377 each: function( obj, callback ) { 378 var length, i = 0; 379 380 if ( isArrayLike( obj ) ) { 381 length = obj.length; 382 for ( ; i < length; i++ ) { 383 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 384 break; 385 } 386 } 387 } else { 388 for ( i in obj ) { 389 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 390 break; 391 } 392 } 393 } 394 395 return obj; 396 }, 397 398 399 // Retrieve the text value of an array of DOM nodes 400 text: function( elem ) { 401 var node, 402 ret = "", 403 i = 0, 404 nodeType = elem.nodeType; 405 406 if ( !nodeType ) { 407 408 // If no nodeType, this is expected to be an array 409 while ( ( node = elem[ i++ ] ) ) { 410 411 // Do not traverse comment nodes 412 ret += jQuery.text( node ); 413 } 414 } 415 if ( nodeType === 1 || nodeType === 11 ) { 416 return elem.textContent; 417 } 418 if ( nodeType === 9 ) { 419 return elem.documentElement.textContent; 420 } 421 if ( nodeType === 3 || nodeType === 4 ) { 422 return elem.nodeValue; 423 } 424 425 // Do not include comment or processing instruction nodes 426 427 return ret; 428 }, 429 430 // results is for internal usage only 431 makeArray: function( arr, results ) { 432 var ret = results || []; 433 434 if ( arr != null ) { 435 if ( isArrayLike( Object( arr ) ) ) { 436 jQuery.merge( ret, 437 typeof arr === "string" ? 438 [ arr ] : arr 439 ); 440 } else { 441 push.call( ret, arr ); 442 } 443 } 444 445 return ret; 446 }, 447 448 inArray: function( elem, arr, i ) { 449 return arr == null ? -1 : indexOf.call( arr, elem, i ); 450 }, 451 452 isXMLDoc: function( elem ) { 453 var namespace = elem && elem.namespaceURI, 454 docElem = elem && ( elem.ownerDocument || elem ).documentElement; 455 456 // Assume HTML when documentElement doesn't yet exist, such as inside 457 // document fragments. 458 return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" ); 459 }, 460 461 // Support: Android <=4.0 only, PhantomJS 1 only 462 // push.apply(_, arraylike) throws on ancient WebKit 463 merge: function( first, second ) { 464 var len = +second.length, 465 j = 0, 466 i = first.length; 467 468 for ( ; j < len; j++ ) { 469 first[ i++ ] = second[ j ]; 470 } 471 472 first.length = i; 473 474 return first; 475 }, 476 477 grep: function( elems, callback, invert ) { 478 var callbackInverse, 479 matches = [], 480 i = 0, 481 length = elems.length, 482 callbackExpect = !invert; 483 484 // Go through the array, only saving the items 485 // that pass the validator function 486 for ( ; i < length; i++ ) { 487 callbackInverse = !callback( elems[ i ], i ); 488 if ( callbackInverse !== callbackExpect ) { 489 matches.push( elems[ i ] ); 490 } 491 } 492 493 return matches; 494 }, 495 496 // arg is for internal usage only 497 map: function( elems, callback, arg ) { 498 var length, value, 499 i = 0, 500 ret = []; 501 502 // Go through the array, translating each of the items to their new values 503 if ( isArrayLike( elems ) ) { 504 length = elems.length; 505 for ( ; i < length; i++ ) { 506 value = callback( elems[ i ], i, arg ); 507 508 if ( value != null ) {
vendor: 17,514 bytes, lines 509-1130
509 ret.push( value ); 510 } 511 } 512 513 // Go through every key on the object, 514 } else { 515 for ( i in elems ) { 516 value = callback( elems[ i ], i, arg ); 517 518 if ( value != null ) { 519 ret.push( value ); 520 } 521 } 522 } 523 524 // Flatten any nested arrays 525 return flat( ret ); 526 }, 527 528 // A global GUID counter for objects 529 guid: 1, 530 531 // jQuery.support is not used in Core but other projects attach their 532 // properties to it so it needs to exist. 533 support: support 534} ); 535 536if ( typeof Symbol === "function" ) { 537 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 538} 539 540// Populate the class2type map 541jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 542 function( _i, name ) { 543 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 544 } ); 545 546function isArrayLike( obj ) { 547 548 // Support: real iOS 8.2 only (not reproducible in simulator) 549 // `in` check used to prevent JIT error (gh-2145) 550 // hasOwn isn't used here due to false negatives 551 // regarding Nodelist length in IE 552 var length = !!obj && "length" in obj && obj.length, 553 type = toType( obj ); 554 555 if ( isFunction( obj ) || isWindow( obj ) ) { 556 return false; 557 } 558 559 return type === "array" || length === 0 || 560 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 561} 562 563 564function nodeName( elem, name ) { 565 566 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 567 568} 569var pop = arr.pop; 570 571 572var sort = arr.sort; 573 574 575var splice = arr.splice; 576 577 578var whitespace = "[\\x20\\t\\r\\n\\f]"; 579 580 581var rtrimCSS = new RegExp( 582 "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", 583 "g" 584); 585 586 587 588 589// Note: an element does not contain itself 590jQuery.contains = function( a, b ) { 591 var bup = b && b.parentNode; 592 593 return a === bup || !!( bup && bup.nodeType === 1 && ( 594 595 // Support: IE 9 - 11+ 596 // IE doesn't have `contains` on SVG. 597 a.contains ? 598 a.contains( bup ) : 599 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 600 ) ); 601}; 602 603 604 605 606// CSS string/identifier serialization 607// https://drafts.csswg.org/cssom/#common-serializing-idioms 608var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 609 610function fcssescape( ch, asCodePoint ) { 611 if ( asCodePoint ) { 612 613 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 614 if ( ch === "\0" ) { 615 return "\uFFFD"; 616 } 617 618 // Control characters and (dependent upon position) numbers get escaped as code points 619 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 620 } 621 622 // Other potentially-special ASCII characters get backslash-escaped 623 return "\\" + ch; 624} 625 626jQuery.escapeSelector = function( sel ) { 627 return ( sel + "" ).replace( rcssescape, fcssescape ); 628}; 629 630 631 632 633var preferredDoc = document, 634 pushNative = push; 635 636( function() { 637 638var i, 639 Expr, 640 outermostContext, 641 sortInput, 642 hasDuplicate, 643 push = pushNative, 644 645 // Local document vars 646 document, 647 documentElement, 648 documentIsHTML, 649 rbuggyQSA, 650 matches, 651 652 // Instance-specific data 653 expando = jQuery.expando, 654 dirruns = 0, 655 done = 0, 656 classCache = createCache(), 657 tokenCache = createCache(), 658 compilerCache = createCache(), 659 nonnativeSelectorCache = createCache(), 660 sortOrder = function( a, b ) { 661 if ( a === b ) { 662 hasDuplicate = true; 663 } 664 return 0; 665 }, 666 667 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + 668 "loop|multiple|open|readonly|required|scoped", 669 670 // Regular expressions 671 672 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram 673 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + 674 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", 675 676 // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors 677 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 678 679 // Operator (capture 2) 680 "*([*^$|!~]?=)" + whitespace + 681 682 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 683 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + 684 whitespace + "*\\]", 685 686 pseudos = ":(" + identifier + ")(?:\\((" + 687 688 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 689 // 1. quoted (capture 3; capture 4 or capture 5) 690 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 691 692 // 2. simple (capture 6) 693 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 694 695 // 3. anything else (capture 2) 696 ".*" + 697 ")\\)|)", 698 699 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 700 rwhitespace = new RegExp( whitespace + "+", "g" ), 701 702 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 703 rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + 704 whitespace + "*" ), 705 rdescend = new RegExp( whitespace + "|>" ), 706 707 rpseudo = new RegExp( pseudos ), 708 ridentifier = new RegExp( "^" + identifier + "$" ), 709 710 matchExpr = { 711 ID: new RegExp( "^#(" + identifier + ")" ), 712 CLASS: new RegExp( "^\\.(" + identifier + ")" ), 713 TAG: new RegExp( "^(" + identifier + "|[*])" ), 714 ATTR: new RegExp( "^" + attributes ), 715 PSEUDO: new RegExp( "^" + pseudos ), 716 CHILD: new RegExp( 717 "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + 718 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + 719 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 720 bool: new RegExp( "^(?:" + booleans + ")$", "i" ), 721 722 // For use in libraries implementing .is() 723 // We use this for POS matching in `select` 724 needsContext: new RegExp( "^" + whitespace + 725 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + 726 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 727 }, 728 729 rinputs = /^(?:input|select|textarea|button)$/i, 730 rheader = /^h\d$/i, 731 732 // Easily-parseable/retrievable ID or TAG or CLASS selectors 733 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 734 735 rsibling = /[+~]/, 736 737 // CSS escapes 738 // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters 739 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + 740 "?|\\\\([^\\r\\n\\f])", "g" ), 741 funescape = function( escape, nonHex ) { 742 var high = "0x" + escape.slice( 1 ) - 0x10000; 743 744 if ( nonHex ) { 745 746 // Strip the backslash prefix from a non-hex escape sequence 747 return nonHex; 748 } 749 750 // Replace a hexadecimal escape sequence with the encoded Unicode code point 751 // Support: IE <=11+ 752 // For values outside the Basic Multilingual Plane (BMP), manually construct a 753 // surrogate pair 754 return high < 0 ? 755 String.fromCharCode( high + 0x10000 ) : 756 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 757 }, 758 759 // Used for iframes; see `setDocument`. 760 // Support: IE 9 - 11+, Edge 12 - 18+ 761 // Removing the function wrapper causes a "Permission Denied" 762 // error in IE/Edge. 763 unloadHandler = function() { 764 setDocument(); 765 }, 766 767 inDisabledFieldset = addCombinator( 768 function( elem ) { 769 return elem.disabled === true && nodeName( elem, "fieldset" ); 770 }, 771 { dir: "parentNode", next: "legend" } 772 ); 773 774// Support: IE <=9 only 775// Accessing document.activeElement can throw unexpectedly 776// https://bugs.jquery.com/ticket/13393 777function safeActiveElement() { 778 try { 779 return document.activeElement; 780 } catch ( err ) { } 781} 782 783// Optimize for push.apply( _, NodeList ) 784try { 785 push.apply( 786 ( arr = slice.call( preferredDoc.childNodes ) ), 787 preferredDoc.childNodes 788 ); 789 790 // Support: Android <=4.0 791 // Detect silently failing push.apply 792 // eslint-disable-next-line no-unused-expressions 793 arr[ preferredDoc.childNodes.length ].nodeType; 794} catch ( e ) { 795 push = { 796 apply: function( target, els ) { 797 pushNative.apply( target, slice.call( els ) ); 798 }, 799 call: function( target ) { 800 pushNative.apply( target, slice.call( arguments, 1 ) ); 801 } 802 }; 803} 804 805function find( selector, context, results, seed ) { 806 var m, i, elem, nid, match, groups, newSelector, 807 newContext = context && context.ownerDocument, 808 809 // nodeType defaults to 9, since context defaults to document 810 nodeType = context ? context.nodeType : 9; 811 812 results = results || []; 813 814 // Return early from calls with invalid selector or context 815 if ( typeof selector !== "string" || !selector || 816 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 817 818 return results; 819 } 820 821 // Try to shortcut find operations (as opposed to filters) in HTML documents 822 if ( !seed ) { 823 setDocument( context ); 824 context = context || document; 825 826 if ( documentIsHTML ) { 827 828 // If the selector is sufficiently simple, try using a "get*By*" DOM method 829 // (excepting DocumentFragment context, where the methods don't exist) 830 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { 831 832 // ID selector 833 if ( ( m = match[ 1 ] ) ) { 834 835 // Document context 836 if ( nodeType === 9 ) { 837 if ( ( elem = context.getElementById( m ) ) ) { 838 839 // Support: IE 9 only 840 // getElementById can match elements by name instead of ID 841 if ( elem.id === m ) { 842 push.call( results, elem ); 843 return results; 844 } 845 } else { 846 return results; 847 } 848 849 // Element context 850 } else { 851 852 // Support: IE 9 only 853 // getElementById can match elements by name instead of ID 854 if ( newContext && ( elem = newContext.getElementById( m ) ) && 855 find.contains( context, elem ) && 856 elem.id === m ) { 857 858 push.call( results, elem ); 859 return results; 860 } 861 } 862 863 // Type selector 864 } else if ( match[ 2 ] ) { 865 push.apply( results, context.getElementsByTagName( selector ) ); 866 return results; 867 868 // Class selector 869 } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) { 870 push.apply( results, context.getElementsByClassName( m ) ); 871 return results; 872 } 873 } 874 875 // Take advantage of querySelectorAll 876 if ( !nonnativeSelectorCache[ selector + " " ] && 877 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) { 878 879 newSelector = selector; 880 newContext = context; 881 882 // qSA considers elements outside a scoping root when evaluating child or 883 // descendant combinators, which is not what we want. 884 // In such cases, we work around the behavior by prefixing every selector in the 885 // list with an ID selector referencing the scope context. 886 // The technique has to be used as well when a leading combinator is used 887 // as such selectors are not recognized by querySelectorAll. 888 // Thanks to Andrew Dupont for this technique. 889 if ( nodeType === 1 && 890 ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) { 891 892 // Expand context for sibling selectors 893 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 894 context; 895 896 // We can use :scope instead of the ID hack if the browser 897 // supports it & if we're not changing the context. 898 // Support: IE 11+, Edge 17 - 18+ 899 // IE/Edge sometimes throw a "Permission denied" error when 900 // strict-comparing two documents; shallow comparisons work. 901 // eslint-disable-next-line eqeqeq 902 if ( newContext != context || !support.scope ) { 903 904 // Capture the context ID, setting it first if necessary 905 if ( ( nid = context.getAttribute( "id" ) ) ) { 906 nid = jQuery.escapeSelector( nid ); 907 } else { 908 context.setAttribute( "id", ( nid = expando ) ); 909 } 910 } 911 912 // Prefix every selector in the list 913 groups = tokenize( selector ); 914 i = groups.length; 915 while ( i-- ) { 916 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + 917 toSelector( groups[ i ] ); 918 } 919 newSelector = groups.join( "," ); 920 } 921 922 try { 923 push.apply( results, 924 newContext.querySelectorAll( newSelector ) 925 ); 926 return results; 927 } catch ( qsaError ) { 928 nonnativeSelectorCache( selector, true ); 929 } finally { 930 if ( nid === expando ) { 931 context.removeAttribute( "id" ); 932 } 933 } 934 } 935 } 936 } 937 938 // All others 939 return select( selector.replace( rtrimCSS, "$1" ), context, results, seed ); 940} 941 942/** 943 * Create key-value caches of limited size 944 * @returns {function(string, object)} Returns the Object data after storing it on itself with 945 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 946 * deleting the oldest entry 947 */ 948function createCache() { 949 var keys = []; 950 951 function cache( key, value ) { 952 953 // Use (key + " ") to avoid collision with native prototype properties 954 // (see https://github.com/jquery/sizzle/issues/157) 955 if ( keys.push( key + " " ) > Expr.cacheLength ) { 956 957 // Only keep the most recent entries 958 delete cache[ keys.shift() ]; 959 } 960 return ( cache[ key + " " ] = value ); 961 } 962 return cache; 963} 964 965/** 966 * Mark a function for special use by jQuery selector module 967 * @param {Function} fn The function to mark 968 */ 969function markFunction( fn ) { 970 fn[ expando ] = true; 971 return fn; 972} 973 974/** 975 * Support testing using an element 976 * @param {Function} fn Passed the created element and returns a boolean result 977 */ 978function assert( fn ) { 979 var el = document.createElement( "fieldset" ); 980 981 try { 982 return !!fn( el ); 983 } catch ( e ) { 984 return false; 985 } finally { 986 987 // Remove from its parent by default 988 if ( el.parentNode ) { 989 el.parentNode.removeChild( el ); 990 } 991 992 // release memory in IE 993 el = null; 994 } 995} 996 997/** 998 * Returns a function to use in pseudos for input types 999 * @param {String} type 1000 */ 1001function createInputPseudo( type ) { 1002 return function( elem ) { 1003 return nodeName( elem, "input" ) && elem.type === type; 1004 }; 1005} 1006 1007/** 1008 * Returns a function to use in pseudos for buttons 1009 * @param {String} type 1010 */ 1011function createButtonPseudo( type ) { 1012 return function( elem ) { 1013 return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) && 1014 elem.type === type; 1015 }; 1016} 1017 1018/** 1019 * Returns a function to use in pseudos for :enabled/:disabled 1020 * @param {Boolean} disabled true for :disabled; false for :enabled 1021 */ 1022function createDisabledPseudo( disabled ) { 1023 1024 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 1025 return function( elem ) { 1026 1027 // Only certain elements can match :enabled or :disabled 1028 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 1029 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 1030 if ( "form" in elem ) { 1031 1032 // Check for inherited disabledness on relevant non-disabled elements: 1033 // * listed form-associated elements in a disabled fieldset 1034 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 1035 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 1036 // * option elements in a disabled optgroup 1037 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 1038 // All such elements have a "form" property. 1039 if ( elem.parentNode && elem.disabled === false ) { 1040 1041 // Option elements defer to a parent optgroup if present 1042 if ( "label" in elem ) { 1043 if ( "label" in elem.parentNode ) { 1044 return elem.parentNode.disabled === disabled; 1045 } else { 1046 return elem.disabled === disabled; 1047 } 1048 } 1049 1050 // Support: IE 6 - 11+ 1051 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 1052 return elem.isDisabled === disabled || 1053 1054 // Where there is no isDisabled, check manually 1055 elem.isDisabled !== !disabled && 1056 inDisabledFieldset( elem ) === disabled; 1057 } 1058 1059 return elem.disabled === disabled; 1060 1061 // Try to winnow out elements that can't be disabled before trusting the disabled property. 1062 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 1063 // even exist on them, let alone have a boolean value. 1064 } else if ( "label" in elem ) { 1065 return elem.disabled === disabled; 1066 } 1067 1068 // Remaining elements are neither :enabled nor :disabled 1069 return false; 1070 }; 1071} 1072 1073/** 1074 * Returns a function to use in pseudos for positionals 1075 * @param {Function} fn 1076 */ 1077function createPositionalPseudo( fn ) { 1078 return markFunction( function( argument ) { 1079 argument = +argument; 1080 return markFunction( function( seed, matches ) { 1081 var j, 1082 matchIndexes = fn( [], seed.length, argument ), 1083 i = matchIndexes.length; 1084 1085 // Match elements found at the specified indexes 1086 while ( i-- ) { 1087 if ( seed[ ( j = matchIndexes[ i ] ) ] ) { 1088 seed[ j ] = !( matches[ j ] = seed[ j ] ); 1089 } 1090 } 1091 } ); 1092 } ); 1093} 1094 1095/** 1096 * Checks a node for validity as a jQuery selector context 1097 * @param {Element|Object=} context 1098 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 1099 */ 1100function testContext( context ) { 1101 return context && typeof context.getElementsByTagName !== "undefined" && context; 1102} 1103 1104/** 1105 * Sets document-related variables once based on the current document 1106 * @param {Element|Object} [node] An element or document object to use to set the document 1107 * @returns {Object} Returns the current document 1108 */ 1109function setDocument( node ) { 1110 var subWindow, 1111 doc = node ? node.ownerDocument || node : preferredDoc; 1112 1113 // Return early if doc is invalid or already selected 1114 // Support: IE 11+, Edge 17 - 18+ 1115 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1116 // two documents; shallow comparisons work. 1117 // eslint-disable-next-line eqeqeq 1118 if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { 1119 return document; 1120 } 1121 1122 // Update global variables 1123 document = doc; 1124 documentElement = document.documentElement; 1125 documentIsHTML = !jQuery.isXMLDoc( document ); 1126 1127 // Support: iOS 7 only, IE 9 - 11+ 1128 // Older browsers didn't support unprefixed `matches`. 1129 matches = documentElement.matches || 1130 documentElement.webkitMatchesSelector ||
vendor: 4,667 bytes, lines 1131-1282
1131 documentElement.msMatchesSelector; 1132 1133 // Support: IE 9 - 11+, Edge 12 - 18+ 1134 // Accessing iframe documents after unload throws "permission denied" errors 1135 // (see trac-13936). 1136 // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`, 1137 // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well. 1138 if ( documentElement.msMatchesSelector && 1139 1140 // Support: IE 11+, Edge 17 - 18+ 1141 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1142 // two documents; shallow comparisons work. 1143 // eslint-disable-next-line eqeqeq 1144 preferredDoc != document && 1145 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { 1146 1147 // Support: IE 9 - 11+, Edge 12 - 18+ 1148 subWindow.addEventListener( "unload", unloadHandler ); 1149 } 1150 1151 // Support: IE <10 1152 // Check if getElementById returns elements by name 1153 // The broken getElementById methods don't pick up programmatically-set names, 1154 // so use a roundabout getElementsByName test 1155 support.getById = assert( function( el ) { 1156 documentElement.appendChild( el ).id = jQuery.expando; 1157 return !document.getElementsByName || 1158 !document.getElementsByName( jQuery.expando ).length; 1159 } ); 1160 1161 // Support: IE 9 only 1162 // Check to see if it's possible to do matchesSelector 1163 // on a disconnected node. 1164 support.disconnectedMatch = assert( function( el ) { 1165 return matches.call( el, "*" ); 1166 } ); 1167 1168 // Support: IE 9 - 11+, Edge 12 - 18+ 1169 // IE/Edge don't support the :scope pseudo-class. 1170 support.scope = assert( function() { 1171 return document.querySelectorAll( ":scope" ); 1172 } ); 1173 1174 // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only 1175 // Make sure the `:has()` argument is parsed unforgivingly. 1176 // We include `*` in the test to detect buggy implementations that are 1177 // _selectively_ forgiving (specifically when the list includes at least 1178 // one valid selector). 1179 // Note that we treat complete lack of support for `:has()` as if it were 1180 // spec-compliant support, which is fine because use of `:has()` in such 1181 // environments will fail in the qSA path and fall back to jQuery traversal 1182 // anyway. 1183 support.cssHas = assert( function() { 1184 try { 1185 document.querySelector( ":has(*,:jqfake)" ); 1186 return false; 1187 } catch ( e ) { 1188 return true; 1189 } 1190 } ); 1191 1192 // ID filter and find 1193 if ( support.getById ) { 1194 Expr.filter.ID = function( id ) { 1195 var attrId = id.replace( runescape, funescape ); 1196 return function( elem ) { 1197 return elem.getAttribute( "id" ) === attrId; 1198 }; 1199 }; 1200 Expr.find.ID = function( id, context ) { 1201 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1202 var elem = context.getElementById( id ); 1203 return elem ? [ elem ] : []; 1204 } 1205 }; 1206 } else { 1207 Expr.filter.ID = function( id ) { 1208 var attrId = id.replace( runescape, funescape ); 1209 return function( elem ) { 1210 var node = typeof elem.getAttributeNode !== "undefined" && 1211 elem.getAttributeNode( "id" ); 1212 return node && node.value === attrId; 1213 }; 1214 }; 1215 1216 // Support: IE 6 - 7 only 1217 // getElementById is not reliable as a find shortcut 1218 Expr.find.ID = function( id, context ) { 1219 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1220 var node, i, elems, 1221 elem = context.getElementById( id ); 1222 1223 if ( elem ) { 1224 1225 // Verify the id attribute 1226 node = elem.getAttributeNode( "id" ); 1227 if ( node && node.value === id ) { 1228 return [ elem ]; 1229 } 1230 1231 // Fall back on getElementsByName 1232 elems = context.getElementsByName( id ); 1233 i = 0; 1234 while ( ( elem = elems[ i++ ] ) ) { 1235 node = elem.getAttributeNode( "id" ); 1236 if ( node && node.value === id ) { 1237 return [ elem ]; 1238 } 1239 } 1240 } 1241 1242 return []; 1243 } 1244 }; 1245 } 1246 1247 // Tag 1248 Expr.find.TAG = function( tag, context ) { 1249 if ( typeof context.getElementsByTagName !== "undefined" ) { 1250 return context.getElementsByTagName( tag ); 1251 1252 // DocumentFragment nodes don't have gEBTN 1253 } else { 1254 return context.querySelectorAll( tag ); 1255 } 1256 }; 1257 1258 // Class 1259 Expr.find.CLASS = function( className, context ) { 1260 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 1261 return context.getElementsByClassName( className ); 1262 } 1263 }; 1264 1265 /* QSA/matchesSelector 1266 ---------------------------------------------------------------------- */ 1267 1268 // QSA and matchesSelector support 1269 1270 rbuggyQSA = []; 1271 1272 // Build QSA regex 1273 // Regex strategy adopted from Diego Perini 1274 assert( function( el ) { 1275 1276 var input; 1277 1278 documentElement.appendChild( el ).innerHTML = 1279 "<a id='" + expando + "' href='' disabled='disabled'></a>" + 1280 "<select id='" + expando + "-\r\\' disabled='disabled'>" + 1281 "<option selected=''></option></select>"; 1282
vendor: 38,614 bytes, lines 1283-2654
1283 // Support: iOS <=7 - 8 only 1284 // Boolean attributes and "value" are not treated correctly in some XML documents 1285 if ( !el.querySelectorAll( "[selected]" ).length ) { 1286 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 1287 } 1288 1289 // Support: iOS <=7 - 8 only 1290 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 1291 rbuggyQSA.push( "~=" ); 1292 } 1293 1294 // Support: iOS 8 only 1295 // https://bugs.webkit.org/show_bug.cgi?id=136851 1296 // In-page `selector#id sibling-combinator selector` fails 1297 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 1298 rbuggyQSA.push( ".#.+[+~]" ); 1299 } 1300 1301 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ 1302 // In some of the document kinds, these selectors wouldn't work natively. 1303 // This is probably OK but for backwards compatibility we want to maintain 1304 // handling them through jQuery traversal in jQuery 3.x. 1305 if ( !el.querySelectorAll( ":checked" ).length ) { 1306 rbuggyQSA.push( ":checked" ); 1307 } 1308 1309 // Support: Windows 8 Native Apps 1310 // The type and name attributes are restricted during .innerHTML assignment 1311 input = document.createElement( "input" ); 1312 input.setAttribute( "type", "hidden" ); 1313 el.appendChild( input ).setAttribute( "name", "D" ); 1314 1315 // Support: IE 9 - 11+ 1316 // IE's :disabled selector does not pick up the children of disabled fieldsets 1317 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ 1318 // In some of the document kinds, these selectors wouldn't work natively. 1319 // This is probably OK but for backwards compatibility we want to maintain 1320 // handling them through jQuery traversal in jQuery 3.x. 1321 documentElement.appendChild( el ).disabled = true; 1322 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { 1323 rbuggyQSA.push( ":enabled", ":disabled" ); 1324 } 1325 1326 // Support: IE 11+, Edge 15 - 18+ 1327 // IE 11/Edge don't find elements on a `[name='']` query in some cases. 1328 // Adding a temporary attribute to the document before the selection works 1329 // around the issue. 1330 // Interestingly, IE 10 & older don't seem to have the issue. 1331 input = document.createElement( "input" ); 1332 input.setAttribute( "name", "" ); 1333 el.appendChild( input ); 1334 if ( !el.querySelectorAll( "[name='']" ).length ) { 1335 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + 1336 whitespace + "*(?:''|\"\")" ); 1337 } 1338 } ); 1339 1340 if ( !support.cssHas ) { 1341 1342 // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ 1343 // Our regular `try-catch` mechanism fails to detect natively-unsupported 1344 // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) 1345 // in browsers that parse the `:has()` argument as a forgiving selector list. 1346 // https://drafts.csswg.org/selectors/#relational now requires the argument 1347 // to be parsed unforgivingly, but browsers have not yet fully adjusted. 1348 rbuggyQSA.push( ":has" ); 1349 } 1350 1351 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); 1352 1353 /* Sorting 1354 ---------------------------------------------------------------------- */ 1355 1356 // Document order sorting 1357 sortOrder = function( a, b ) { 1358 1359 // Flag for duplicate removal 1360 if ( a === b ) { 1361 hasDuplicate = true; 1362 return 0; 1363 } 1364 1365 // Sort on method existence if only one input has compareDocumentPosition 1366 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 1367 if ( compare ) { 1368 return compare; 1369 } 1370 1371 // Calculate position if both inputs belong to the same document 1372 // Support: IE 11+, Edge 17 - 18+ 1373 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1374 // two documents; shallow comparisons work. 1375 // eslint-disable-next-line eqeqeq 1376 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? 1377 a.compareDocumentPosition( b ) : 1378 1379 // Otherwise we know they are disconnected 1380 1; 1381 1382 // Disconnected nodes 1383 if ( compare & 1 || 1384 ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { 1385 1386 // Choose the first element that is related to our preferred document 1387 // Support: IE 11+, Edge 17 - 18+ 1388 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1389 // two documents; shallow comparisons work. 1390 // eslint-disable-next-line eqeqeq 1391 if ( a === document || a.ownerDocument == preferredDoc && 1392 find.contains( preferredDoc, a ) ) { 1393 return -1; 1394 } 1395 1396 // Support: IE 11+, Edge 17 - 18+ 1397 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1398 // two documents; shallow comparisons work. 1399 // eslint-disable-next-line eqeqeq 1400 if ( b === document || b.ownerDocument == preferredDoc && 1401 find.contains( preferredDoc, b ) ) { 1402 return 1; 1403 } 1404 1405 // Maintain original order 1406 return sortInput ? 1407 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : 1408 0; 1409 } 1410 1411 return compare & 4 ? -1 : 1; 1412 }; 1413 1414 return document; 1415} 1416 1417find.matches = function( expr, elements ) { 1418 return find( expr, null, null, elements ); 1419}; 1420 1421find.matchesSelector = function( elem, expr ) { 1422 setDocument( elem ); 1423 1424 if ( documentIsHTML && 1425 !nonnativeSelectorCache[ expr + " " ] && 1426 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 1427 1428 try { 1429 var ret = matches.call( elem, expr ); 1430 1431 // IE 9's matchesSelector returns false on disconnected nodes 1432 if ( ret || support.disconnectedMatch || 1433 1434 // As well, disconnected nodes are said to be in a document 1435 // fragment in IE 9 1436 elem.document && elem.document.nodeType !== 11 ) { 1437 return ret; 1438 } 1439 } catch ( e ) { 1440 nonnativeSelectorCache( expr, true ); 1441 } 1442 } 1443 1444 return find( expr, document, null, [ elem ] ).length > 0; 1445}; 1446 1447find.contains = function( context, elem ) { 1448 1449 // Set document vars if needed 1450 // Support: IE 11+, Edge 17 - 18+ 1451 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1452 // two documents; shallow comparisons work. 1453 // eslint-disable-next-line eqeqeq 1454 if ( ( context.ownerDocument || context ) != document ) { 1455 setDocument( context ); 1456 } 1457 return jQuery.contains( context, elem ); 1458}; 1459 1460 1461find.attr = function( elem, name ) { 1462 1463 // Set document vars if needed 1464 // Support: IE 11+, Edge 17 - 18+ 1465 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1466 // two documents; shallow comparisons work. 1467 // eslint-disable-next-line eqeqeq 1468 if ( ( elem.ownerDocument || elem ) != document ) { 1469 setDocument( elem ); 1470 } 1471 1472 var fn = Expr.attrHandle[ name.toLowerCase() ], 1473 1474 // Don't get fooled by Object.prototype properties (see trac-13807) 1475 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 1476 fn( elem, name, !documentIsHTML ) : 1477 undefined; 1478 1479 if ( val !== undefined ) { 1480 return val; 1481 } 1482 1483 return elem.getAttribute( name ); 1484}; 1485 1486find.error = function( msg ) { 1487 throw new Error( "Syntax error, unrecognized expression: " + msg ); 1488}; 1489 1490/** 1491 * Document sorting and removing duplicates 1492 * @param {ArrayLike} results 1493 */ 1494jQuery.uniqueSort = function( results ) { 1495 var elem, 1496 duplicates = [], 1497 j = 0, 1498 i = 0; 1499 1500 // Unless we *know* we can detect duplicates, assume their presence 1501 // 1502 // Support: Android <=4.0+ 1503 // Testing for detecting duplicates is unpredictable so instead assume we can't 1504 // depend on duplicate detection in all browsers without a stable sort. 1505 hasDuplicate = !support.sortStable; 1506 sortInput = !support.sortStable && slice.call( results, 0 ); 1507 sort.call( results, sortOrder ); 1508 1509 if ( hasDuplicate ) { 1510 while ( ( elem = results[ i++ ] ) ) { 1511 if ( elem === results[ i ] ) { 1512 j = duplicates.push( i ); 1513 } 1514 } 1515 while ( j-- ) { 1516 splice.call( results, duplicates[ j ], 1 ); 1517 } 1518 } 1519 1520 // Clear input after sorting to release objects 1521 // See https://github.com/jquery/sizzle/pull/225 1522 sortInput = null; 1523 1524 return results; 1525}; 1526 1527jQuery.fn.uniqueSort = function() { 1528 return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) ); 1529}; 1530 1531Expr = jQuery.expr = { 1532 1533 // Can be adjusted by the user 1534 cacheLength: 50, 1535 1536 createPseudo: markFunction, 1537 1538 match: matchExpr, 1539 1540 attrHandle: {}, 1541 1542 find: {}, 1543 1544 relative: { 1545 ">": { dir: "parentNode", first: true }, 1546 " ": { dir: "parentNode" }, 1547 "+": { dir: "previousSibling", first: true }, 1548 "~": { dir: "previousSibling" } 1549 }, 1550 1551 preFilter: { 1552 ATTR: function( match ) { 1553 match[ 1 ] = match[ 1 ].replace( runescape, funescape ); 1554 1555 // Move the given value to match[3] whether quoted or unquoted 1556 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" ) 1557 .replace( runescape, funescape ); 1558 1559 if ( match[ 2 ] === "~=" ) { 1560 match[ 3 ] = " " + match[ 3 ] + " "; 1561 } 1562 1563 return match.slice( 0, 4 ); 1564 }, 1565 1566 CHILD: function( match ) { 1567 1568 /* matches from matchExpr["CHILD"] 1569 1 type (only|nth|...) 1570 2 what (child|of-type) 1571 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 1572 4 xn-component of xn+y argument ([+-]?\d*n|) 1573 5 sign of xn-component 1574 6 x of xn-component 1575 7 sign of y-component 1576 8 y of y-component 1577 */ 1578 match[ 1 ] = match[ 1 ].toLowerCase(); 1579 1580 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { 1581 1582 // nth-* requires argument 1583 if ( !match[ 3 ] ) { 1584 find.error( match[ 0 ] ); 1585 } 1586 1587 // numeric x and y parameters for Expr.filter.CHILD 1588 // remember that false/true cast respectively to 0/1 1589 match[ 4 ] = +( match[ 4 ] ? 1590 match[ 5 ] + ( match[ 6 ] || 1 ) : 1591 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) 1592 ); 1593 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); 1594 1595 // other types prohibit arguments 1596 } else if ( match[ 3 ] ) { 1597 find.error( match[ 0 ] ); 1598 } 1599 1600 return match; 1601 }, 1602 1603 PSEUDO: function( match ) { 1604 var excess, 1605 unquoted = !match[ 6 ] && match[ 2 ]; 1606 1607 if ( matchExpr.CHILD.test( match[ 0 ] ) ) { 1608 return null; 1609 } 1610 1611 // Accept quoted arguments as-is 1612 if ( match[ 3 ] ) { 1613 match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; 1614 1615 // Strip excess characters from unquoted arguments 1616 } else if ( unquoted && rpseudo.test( unquoted ) && 1617 1618 // Get excess from tokenize (recursively) 1619 ( excess = tokenize( unquoted, true ) ) && 1620 1621 // advance to the next closing parenthesis 1622 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { 1623 1624 // excess is a negative index 1625 match[ 0 ] = match[ 0 ].slice( 0, excess ); 1626 match[ 2 ] = unquoted.slice( 0, excess ); 1627 } 1628 1629 // Return only captures needed by the pseudo filter method (type and argument) 1630 return match.slice( 0, 3 ); 1631 } 1632 }, 1633 1634 filter: { 1635 1636 TAG: function( nodeNameSelector ) { 1637 var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 1638 return nodeNameSelector === "*" ? 1639 function() { 1640 return true; 1641 } : 1642 function( elem ) { 1643 return nodeName( elem, expectedNodeName ); 1644 }; 1645 }, 1646 1647 CLASS: function( className ) { 1648 var pattern = classCache[ className + " " ]; 1649 1650 return pattern || 1651 ( pattern = new RegExp( "(^|" + whitespace + ")" + className + 1652 "(" + whitespace + "|$)" ) ) && 1653 classCache( className, function( elem ) { 1654 return pattern.test( 1655 typeof elem.className === "string" && elem.className || 1656 typeof elem.getAttribute !== "undefined" && 1657 elem.getAttribute( "class" ) || 1658 "" 1659 ); 1660 } ); 1661 }, 1662 1663 ATTR: function( name, operator, check ) { 1664 return function( elem ) { 1665 var result = find.attr( elem, name ); 1666 1667 if ( result == null ) { 1668 return operator === "!="; 1669 } 1670 if ( !operator ) { 1671 return true; 1672 } 1673 1674 result += ""; 1675 1676 if ( operator === "=" ) { 1677 return result === check; 1678 } 1679 if ( operator === "!=" ) { 1680 return result !== check; 1681 } 1682 if ( operator === "^=" ) { 1683 return check && result.indexOf( check ) === 0; 1684 } 1685 if ( operator === "*=" ) { 1686 return check && result.indexOf( check ) > -1; 1687 } 1688 if ( operator === "$=" ) { 1689 return check && result.slice( -check.length ) === check; 1690 } 1691 if ( operator === "~=" ) { 1692 return ( " " + result.replace( rwhitespace, " " ) + " " ) 1693 .indexOf( check ) > -1; 1694 } 1695 if ( operator === "|=" ) { 1696 return result === check || result.slice( 0, check.length + 1 ) === check + "-"; 1697 } 1698 1699 return false; 1700 }; 1701 }, 1702 1703 CHILD: function( type, what, _argument, first, last ) { 1704 var simple = type.slice( 0, 3 ) !== "nth", 1705 forward = type.slice( -4 ) !== "last", 1706 ofType = what === "of-type"; 1707 1708 return first === 1 && last === 0 ? 1709 1710 // Shortcut for :nth-*(n) 1711 function( elem ) { 1712 return !!elem.parentNode; 1713 } : 1714 1715 function( elem, _context, xml ) { 1716 var cache, outerCache, node, nodeIndex, start, 1717 dir = simple !== forward ? "nextSibling" : "previousSibling", 1718 parent = elem.parentNode, 1719 name = ofType && elem.nodeName.toLowerCase(), 1720 useCache = !xml && !ofType, 1721 diff = false; 1722 1723 if ( parent ) { 1724 1725 // :(first|last|only)-(child|of-type) 1726 if ( simple ) { 1727 while ( dir ) { 1728 node = elem; 1729 while ( ( node = node[ dir ] ) ) { 1730 if ( ofType ? 1731 nodeName( node, name ) : 1732 node.nodeType === 1 ) { 1733 1734 return false; 1735 } 1736 } 1737 1738 // Reverse direction for :only-* (if we haven't yet done so) 1739 start = dir = type === "only" && !start && "nextSibling"; 1740 } 1741 return true; 1742 } 1743 1744 start = [ forward ? parent.firstChild : parent.lastChild ]; 1745 1746 // non-xml :nth-child(...) stores cache data on `parent` 1747 if ( forward && useCache ) { 1748 1749 // Seek `elem` from a previously-cached index 1750 outerCache = parent[ expando ] || ( parent[ expando ] = {} ); 1751 cache = outerCache[ type ] || []; 1752 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1753 diff = nodeIndex && cache[ 2 ]; 1754 node = nodeIndex && parent.childNodes[ nodeIndex ]; 1755 1756 while ( ( node = ++nodeIndex && node && node[ dir ] || 1757 1758 // Fallback to seeking `elem` from the start 1759 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 1760 1761 // When found, cache indexes on `parent` and break 1762 if ( node.nodeType === 1 && ++diff && node === elem ) { 1763 outerCache[ type ] = [ dirruns, nodeIndex, diff ]; 1764 break; 1765 } 1766 } 1767 1768 } else { 1769 1770 // Use previously-cached element index if available 1771 if ( useCache ) { 1772 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 1773 cache = outerCache[ type ] || []; 1774 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1775 diff = nodeIndex; 1776 } 1777 1778 // xml :nth-child(...) 1779 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 1780 if ( diff === false ) { 1781 1782 // Use the same loop as above to seek `elem` from the start 1783 while ( ( node = ++nodeIndex && node && node[ dir ] || 1784 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 1785 1786 if ( ( ofType ? 1787 nodeName( node, name ) : 1788 node.nodeType === 1 ) && 1789 ++diff ) { 1790 1791 // Cache the index of each encountered element 1792 if ( useCache ) { 1793 outerCache = node[ expando ] || 1794 ( node[ expando ] = {} ); 1795 outerCache[ type ] = [ dirruns, diff ]; 1796 } 1797 1798 if ( node === elem ) { 1799 break; 1800 } 1801 } 1802 } 1803 } 1804 } 1805 1806 // Incorporate the offset, then check against cycle size 1807 diff -= last; 1808 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 1809 } 1810 }; 1811 }, 1812 1813 PSEUDO: function( pseudo, argument ) { 1814 1815 // pseudo-class names are case-insensitive 1816 // https://www.w3.org/TR/selectors/#pseudo-classes 1817 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 1818 // Remember that setFilters inherits from pseudos 1819 var args, 1820 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 1821 find.error( "unsupported pseudo: " + pseudo ); 1822 1823 // The user may use createPseudo to indicate that 1824 // arguments are needed to create the filter function 1825 // just as jQuery does 1826 if ( fn[ expando ] ) { 1827 return fn( argument ); 1828 } 1829 1830 // But maintain support for old signatures 1831 if ( fn.length > 1 ) { 1832 args = [ pseudo, pseudo, "", argument ]; 1833 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 1834 markFunction( function( seed, matches ) { 1835 var idx, 1836 matched = fn( seed, argument ), 1837 i = matched.length; 1838 while ( i-- ) { 1839 idx = indexOf.call( seed, matched[ i ] ); 1840 seed[ idx ] = !( matches[ idx ] = matched[ i ] ); 1841 } 1842 } ) : 1843 function( elem ) { 1844 return fn( elem, 0, args ); 1845 }; 1846 } 1847 1848 return fn; 1849 } 1850 }, 1851 1852 pseudos: { 1853 1854 // Potentially complex pseudos 1855 not: markFunction( function( selector ) { 1856 1857 // Trim the selector passed to compile 1858 // to avoid treating leading and trailing 1859 // spaces as combinators 1860 var input = [], 1861 results = [], 1862 matcher = compile( selector.replace( rtrimCSS, "$1" ) ); 1863 1864 return matcher[ expando ] ? 1865 markFunction( function( seed, matches, _context, xml ) { 1866 var elem, 1867 unmatched = matcher( seed, null, xml, [] ), 1868 i = seed.length; 1869 1870 // Match elements unmatched by `matcher` 1871 while ( i-- ) { 1872 if ( ( elem = unmatched[ i ] ) ) { 1873 seed[ i ] = !( matches[ i ] = elem ); 1874 } 1875 } 1876 } ) : 1877 function( elem, _context, xml ) { 1878 input[ 0 ] = elem; 1879 matcher( input, null, xml, results ); 1880 1881 // Don't keep the element 1882 // (see https://github.com/jquery/sizzle/issues/299) 1883 input[ 0 ] = null; 1884 return !results.pop(); 1885 }; 1886 } ), 1887 1888 has: markFunction( function( selector ) { 1889 return function( elem ) { 1890 return find( selector, elem ).length > 0; 1891 }; 1892 } ), 1893 1894 contains: markFunction( function( text ) { 1895 text = text.replace( runescape, funescape ); 1896 return function( elem ) { 1897 return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1; 1898 }; 1899 } ), 1900 1901 // "Whether an element is represented by a :lang() selector 1902 // is based solely on the element's language value 1903 // being equal to the identifier C, 1904 // or beginning with the identifier C immediately followed by "-". 1905 // The matching of C against the element's language value is performed case-insensitively. 1906 // The identifier C does not have to be a valid language name." 1907 // https://www.w3.org/TR/selectors/#lang-pseudo 1908 lang: markFunction( function( lang ) { 1909 1910 // lang value must be a valid identifier 1911 if ( !ridentifier.test( lang || "" ) ) { 1912 find.error( "unsupported lang: " + lang ); 1913 } 1914 lang = lang.replace( runescape, funescape ).toLowerCase(); 1915 return function( elem ) { 1916 var elemLang; 1917 do { 1918 if ( ( elemLang = documentIsHTML ? 1919 elem.lang : 1920 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { 1921 1922 elemLang = elemLang.toLowerCase(); 1923 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 1924 } 1925 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); 1926 return false; 1927 }; 1928 } ), 1929 1930 // Miscellaneous 1931 target: function( elem ) { 1932 var hash = window.location && window.location.hash; 1933 return hash && hash.slice( 1 ) === elem.id; 1934 }, 1935 1936 root: function( elem ) { 1937 return elem === documentElement; 1938 }, 1939 1940 focus: function( elem ) { 1941 return elem === safeActiveElement() && 1942 document.hasFocus() && 1943 !!( elem.type || elem.href || ~elem.tabIndex ); 1944 }, 1945 1946 // Boolean properties 1947 enabled: createDisabledPseudo( false ), 1948 disabled: createDisabledPseudo( true ), 1949 1950 checked: function( elem ) { 1951 1952 // In CSS3, :checked should return both checked and selected elements 1953 // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1954 return ( nodeName( elem, "input" ) && !!elem.checked ) || 1955 ( nodeName( elem, "option" ) && !!elem.selected ); 1956 }, 1957 1958 selected: function( elem ) { 1959 1960 // Support: IE <=11+ 1961 // Accessing the selectedIndex property 1962 // forces the browser to treat the default option as 1963 // selected when in an optgroup. 1964 if ( elem.parentNode ) { 1965 // eslint-disable-next-line no-unused-expressions 1966 elem.parentNode.selectedIndex; 1967 } 1968 1969 return elem.selected === true; 1970 }, 1971 1972 // Contents 1973 empty: function( elem ) { 1974 1975 // https://www.w3.org/TR/selectors/#empty-pseudo 1976 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 1977 // but not by others (comment: 8; processing instruction: 7; etc.) 1978 // nodeType < 6 works because attributes (2) do not appear as children 1979 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 1980 if ( elem.nodeType < 6 ) { 1981 return false; 1982 } 1983 } 1984 return true; 1985 }, 1986 1987 parent: function( elem ) { 1988 return !Expr.pseudos.empty( elem ); 1989 }, 1990 1991 // Element/input types 1992 header: function( elem ) { 1993 return rheader.test( elem.nodeName ); 1994 }, 1995 1996 input: function( elem ) { 1997 return rinputs.test( elem.nodeName ); 1998 }, 1999 2000 button: function( elem ) { 2001 return nodeName( elem, "input" ) && elem.type === "button" || 2002 nodeName( elem, "button" ); 2003 }, 2004 2005 text: function( elem ) { 2006 var attr; 2007 return nodeName( elem, "input" ) && elem.type === "text" && 2008 2009 // Support: IE <10 only 2010 // New HTML5 attribute values (e.g., "search") appear 2011 // with elem.type === "text" 2012 ( ( attr = elem.getAttribute( "type" ) ) == null || 2013 attr.toLowerCase() === "text" ); 2014 }, 2015 2016 // Position-in-collection 2017 first: createPositionalPseudo( function() { 2018 return [ 0 ]; 2019 } ), 2020 2021 last: createPositionalPseudo( function( _matchIndexes, length ) { 2022 return [ length - 1 ]; 2023 } ), 2024 2025 eq: createPositionalPseudo( function( _matchIndexes, length, argument ) { 2026 return [ argument < 0 ? argument + length : argument ]; 2027 } ), 2028 2029 even: createPositionalPseudo( function( matchIndexes, length ) { 2030 var i = 0; 2031 for ( ; i < length; i += 2 ) { 2032 matchIndexes.push( i ); 2033 } 2034 return matchIndexes; 2035 } ), 2036 2037 odd: createPositionalPseudo( function( matchIndexes, length ) { 2038 var i = 1; 2039 for ( ; i < length; i += 2 ) { 2040 matchIndexes.push( i ); 2041 } 2042 return matchIndexes; 2043 } ), 2044 2045 lt: createPositionalPseudo( function( matchIndexes, length, argument ) { 2046 var i; 2047 2048 if ( argument < 0 ) { 2049 i = argument + length; 2050 } else if ( argument > length ) { 2051 i = length; 2052 } else { 2053 i = argument; 2054 } 2055 2056 for ( ; --i >= 0; ) { 2057 matchIndexes.push( i ); 2058 } 2059 return matchIndexes; 2060 } ), 2061 2062 gt: createPositionalPseudo( function( matchIndexes, length, argument ) { 2063 var i = argument < 0 ? argument + length : argument; 2064 for ( ; ++i < length; ) { 2065 matchIndexes.push( i ); 2066 } 2067 return matchIndexes; 2068 } ) 2069 } 2070}; 2071 2072Expr.pseudos.nth = Expr.pseudos.eq; 2073 2074// Add button/input type pseudos 2075for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 2076 Expr.pseudos[ i ] = createInputPseudo( i ); 2077} 2078for ( i in { submit: true, reset: true } ) { 2079 Expr.pseudos[ i ] = createButtonPseudo( i ); 2080} 2081 2082// Easy API for creating new setFilters 2083function setFilters() {} 2084setFilters.prototype = Expr.filters = Expr.pseudos; 2085Expr.setFilters = new setFilters(); 2086 2087function tokenize( selector, parseOnly ) { 2088 var matched, match, tokens, type, 2089 soFar, groups, preFilters, 2090 cached = tokenCache[ selector + " " ]; 2091 2092 if ( cached ) { 2093 return parseOnly ? 0 : cached.slice( 0 ); 2094 } 2095 2096 soFar = selector; 2097 groups = []; 2098 preFilters = Expr.preFilter; 2099 2100 while ( soFar ) { 2101 2102 // Comma and first run 2103 if ( !matched || ( match = rcomma.exec( soFar ) ) ) { 2104 if ( match ) { 2105 2106 // Don't consume trailing commas as valid 2107 soFar = soFar.slice( match[ 0 ].length ) || soFar; 2108 } 2109 groups.push( ( tokens = [] ) ); 2110 } 2111 2112 matched = false; 2113 2114 // Combinators 2115 if ( ( match = rleadingCombinator.exec( soFar ) ) ) { 2116 matched = match.shift(); 2117 tokens.push( { 2118 value: matched, 2119 2120 // Cast descendant combinators to space 2121 type: match[ 0 ].replace( rtrimCSS, " " ) 2122 } ); 2123 soFar = soFar.slice( matched.length ); 2124 } 2125 2126 // Filters 2127 for ( type in Expr.filter ) { 2128 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || 2129 ( match = preFilters[ type ]( match ) ) ) ) { 2130 matched = match.shift(); 2131 tokens.push( { 2132 value: matched, 2133 type: type, 2134 matches: match 2135 } ); 2136 soFar = soFar.slice( matched.length ); 2137 } 2138 } 2139 2140 if ( !matched ) { 2141 break; 2142 } 2143 } 2144 2145 // Return the length of the invalid excess 2146 // if we're just parsing 2147 // Otherwise, throw an error or return tokens 2148 if ( parseOnly ) { 2149 return soFar.length; 2150 } 2151 2152 return soFar ? 2153 find.error( selector ) : 2154 2155 // Cache the tokens 2156 tokenCache( selector, groups ).slice( 0 ); 2157} 2158 2159function toSelector( tokens ) { 2160 var i = 0, 2161 len = tokens.length, 2162 selector = ""; 2163 for ( ; i < len; i++ ) { 2164 selector += tokens[ i ].value; 2165 } 2166 return selector; 2167} 2168 2169function addCombinator( matcher, combinator, base ) { 2170 var dir = combinator.dir, 2171 skip = combinator.next, 2172 key = skip || dir, 2173 checkNonElements = base && key === "parentNode", 2174 doneName = done++; 2175 2176 return combinator.first ? 2177 2178 // Check against closest ancestor/preceding element 2179 function( elem, context, xml ) { 2180 while ( ( elem = elem[ dir ] ) ) { 2181 if ( elem.nodeType === 1 || checkNonElements ) { 2182 return matcher( elem, context, xml ); 2183 } 2184 } 2185 return false; 2186 } : 2187 2188 // Check against all ancestor/preceding elements 2189 function( elem, context, xml ) { 2190 var oldCache, outerCache, 2191 newCache = [ dirruns, doneName ]; 2192 2193 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 2194 if ( xml ) { 2195 while ( ( elem = elem[ dir ] ) ) { 2196 if ( elem.nodeType === 1 || checkNonElements ) { 2197 if ( matcher( elem, context, xml ) ) { 2198 return true; 2199 } 2200 } 2201 } 2202 } else { 2203 while ( ( elem = elem[ dir ] ) ) { 2204 if ( elem.nodeType === 1 || checkNonElements ) { 2205 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 2206 2207 if ( skip && nodeName( elem, skip ) ) { 2208 elem = elem[ dir ] || elem; 2209 } else if ( ( oldCache = outerCache[ key ] ) && 2210 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 2211 2212 // Assign to newCache so results back-propagate to previous elements 2213 return ( newCache[ 2 ] = oldCache[ 2 ] ); 2214 } else { 2215 2216 // Reuse newcache so results back-propagate to previous elements 2217 outerCache[ key ] = newCache; 2218 2219 // A match means we're done; a fail means we have to keep checking 2220 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { 2221 return true; 2222 } 2223 } 2224 } 2225 } 2226 } 2227 return false; 2228 }; 2229} 2230 2231function elementMatcher( matchers ) { 2232 return matchers.length > 1 ? 2233 function( elem, context, xml ) { 2234 var i = matchers.length; 2235 while ( i-- ) { 2236 if ( !matchers[ i ]( elem, context, xml ) ) { 2237 return false; 2238 } 2239 } 2240 return true; 2241 } : 2242 matchers[ 0 ]; 2243} 2244 2245function multipleContexts( selector, contexts, results ) { 2246 var i = 0, 2247 len = contexts.length; 2248 for ( ; i < len; i++ ) { 2249 find( selector, contexts[ i ], results ); 2250 } 2251 return results; 2252} 2253 2254function condense( unmatched, map, filter, context, xml ) { 2255 var elem, 2256 newUnmatched = [], 2257 i = 0, 2258 len = unmatched.length, 2259 mapped = map != null; 2260 2261 for ( ; i < len; i++ ) { 2262 if ( ( elem = unmatched[ i ] ) ) { 2263 if ( !filter || filter( elem, context, xml ) ) { 2264 newUnmatched.push( elem ); 2265 if ( mapped ) { 2266 map.push( i ); 2267 } 2268 } 2269 } 2270 } 2271 2272 return newUnmatched; 2273} 2274 2275function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 2276 if ( postFilter && !postFilter[ expando ] ) { 2277 postFilter = setMatcher( postFilter ); 2278 } 2279 if ( postFinder && !postFinder[ expando ] ) { 2280 postFinder = setMatcher( postFinder, postSelector ); 2281 } 2282 return markFunction( function( seed, results, context, xml ) { 2283 var temp, i, elem, matcherOut, 2284 preMap = [], 2285 postMap = [], 2286 preexisting = results.length, 2287 2288 // Get initial elements from seed or context 2289 elems = seed || 2290 multipleContexts( selector || "*", 2291 context.nodeType ? [ context ] : context, [] ), 2292 2293 // Prefilter to get matcher input, preserving a map for seed-results synchronization 2294 matcherIn = preFilter && ( seed || !selector ) ? 2295 condense( elems, preMap, preFilter, context, xml ) : 2296 elems; 2297 2298 if ( matcher ) { 2299 2300 // If we have a postFinder, or filtered seed, or non-seed postFilter 2301 // or preexisting results, 2302 matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 2303 2304 // ...intermediate processing is necessary 2305 [] : 2306 2307 // ...otherwise use results directly 2308 results; 2309 2310 // Find primary matches 2311 matcher( matcherIn, matcherOut, context, xml ); 2312 } else { 2313 matcherOut = matcherIn; 2314 } 2315 2316 // Apply postFilter 2317 if ( postFilter ) { 2318 temp = condense( matcherOut, postMap ); 2319 postFilter( temp, [], context, xml ); 2320 2321 // Un-match failing elements by moving them back to matcherIn 2322 i = temp.length; 2323 while ( i-- ) { 2324 if ( ( elem = temp[ i ] ) ) { 2325 matcherOut[ postMap[ i ] ] = !( matcherIn[ postMap[ i ] ] = elem ); 2326 } 2327 } 2328 } 2329 2330 if ( seed ) { 2331 if ( postFinder || preFilter ) { 2332 if ( postFinder ) { 2333 2334 // Get the final matcherOut by condensing this intermediate into postFinder contexts 2335 temp = []; 2336 i = matcherOut.length; 2337 while ( i-- ) { 2338 if ( ( elem = matcherOut[ i ] ) ) { 2339 2340 // Restore matcherIn since elem is not yet a final match 2341 temp.push( ( matcherIn[ i ] = elem ) ); 2342 } 2343 } 2344 postFinder( null, ( matcherOut = [] ), temp, xml ); 2345 } 2346 2347 // Move matched elements from seed to results to keep them synchronized 2348 i = matcherOut.length; 2349 while ( i-- ) { 2350 if ( ( elem = matcherOut[ i ] ) && 2351 ( temp = postFinder ? indexOf.call( seed, elem ) : preMap[ i ] ) > -1 ) { 2352 2353 seed[ temp ] = !( results[ temp ] = elem ); 2354 } 2355 } 2356 } 2357 2358 // Add elements to results, through postFinder if defined 2359 } else { 2360 matcherOut = condense( 2361 matcherOut === results ? 2362 matcherOut.splice( preexisting, matcherOut.length ) : 2363 matcherOut 2364 ); 2365 if ( postFinder ) { 2366 postFinder( null, results, matcherOut, xml ); 2367 } else { 2368 push.apply( results, matcherOut ); 2369 } 2370 } 2371 } ); 2372} 2373 2374function matcherFromTokens( tokens ) { 2375 var checkContext, matcher, j, 2376 len = tokens.length, 2377 leadingRelative = Expr.relative[ tokens[ 0 ].type ], 2378 implicitRelative = leadingRelative || Expr.relative[ " " ], 2379 i = leadingRelative ? 1 : 0, 2380 2381 // The foundational matcher ensures that elements are reachable from top-level context(s) 2382 matchContext = addCombinator( function( elem ) { 2383 return elem === checkContext; 2384 }, implicitRelative, true ), 2385 matchAnyContext = addCombinator( function( elem ) { 2386 return indexOf.call( checkContext, elem ) > -1; 2387 }, implicitRelative, true ), 2388 matchers = [ function( elem, context, xml ) { 2389 2390 // Support: IE 11+, Edge 17 - 18+ 2391 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2392 // two documents; shallow comparisons work. 2393 // eslint-disable-next-line eqeqeq 2394 var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || ( 2395 ( checkContext = context ).nodeType ? 2396 matchContext( elem, context, xml ) : 2397 matchAnyContext( elem, context, xml ) ); 2398 2399 // Avoid hanging onto element 2400 // (see https://github.com/jquery/sizzle/issues/299) 2401 checkContext = null; 2402 return ret; 2403 } ]; 2404 2405 for ( ; i < len; i++ ) { 2406 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { 2407 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; 2408 } else { 2409 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); 2410 2411 // Return special upon seeing a positional matcher 2412 if ( matcher[ expando ] ) { 2413 2414 // Find the next relative operator (if any) for proper handling 2415 j = ++i; 2416 for ( ; j < len; j++ ) { 2417 if ( Expr.relative[ tokens[ j ].type ] ) { 2418 break; 2419 } 2420 } 2421 return setMatcher( 2422 i > 1 && elementMatcher( matchers ), 2423 i > 1 && toSelector( 2424 2425 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 2426 tokens.slice( 0, i - 1 ) 2427 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) 2428 ).replace( rtrimCSS, "$1" ), 2429 matcher, 2430 i < j && matcherFromTokens( tokens.slice( i, j ) ), 2431 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), 2432 j < len && toSelector( tokens ) 2433 ); 2434 } 2435 matchers.push( matcher ); 2436 } 2437 } 2438 2439 return elementMatcher( matchers ); 2440} 2441 2442function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 2443 var bySet = setMatchers.length > 0, 2444 byElement = elementMatchers.length > 0, 2445 superMatcher = function( seed, context, xml, results, outermost ) { 2446 var elem, j, matcher, 2447 matchedCount = 0, 2448 i = "0", 2449 unmatched = seed && [], 2450 setMatched = [], 2451 contextBackup = outermostContext, 2452 2453 // We must always have either seed elements or outermost context 2454 elems = seed || byElement && Expr.find.TAG( "*", outermost ), 2455 2456 // Use integer dirruns iff this is the outermost matcher 2457 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), 2458 len = elems.length; 2459 2460 if ( outermost ) { 2461 2462 // Support: IE 11+, Edge 17 - 18+ 2463 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2464 // two documents; shallow comparisons work. 2465 // eslint-disable-next-line eqeqeq 2466 outermostContext = context == document || context || outermost; 2467 } 2468 2469 // Add elements passing elementMatchers directly to results 2470 // Support: iOS <=7 - 9 only 2471 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching 2472 // elements by id. (see trac-14142) 2473 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { 2474 if ( byElement && elem ) { 2475 j = 0; 2476 2477 // Support: IE 11+, Edge 17 - 18+ 2478 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2479 // two documents; shallow comparisons work. 2480 // eslint-disable-next-line eqeqeq 2481 if ( !context && elem.ownerDocument != document ) { 2482 setDocument( elem ); 2483 xml = !documentIsHTML; 2484 } 2485 while ( ( matcher = elementMatchers[ j++ ] ) ) { 2486 if ( matcher( elem, context || document, xml ) ) { 2487 push.call( results, elem ); 2488 break; 2489 } 2490 } 2491 if ( outermost ) { 2492 dirruns = dirrunsUnique; 2493 } 2494 } 2495 2496 // Track unmatched elements for set filters 2497 if ( bySet ) { 2498 2499 // They will have gone through all possible matchers 2500 if ( ( elem = !matcher && elem ) ) { 2501 matchedCount--; 2502 } 2503 2504 // Lengthen the array for every element, matched or not 2505 if ( seed ) { 2506 unmatched.push( elem ); 2507 } 2508 } 2509 } 2510 2511 // `i` is now the count of elements visited above, and adding it to `matchedCount` 2512 // makes the latter nonnegative. 2513 matchedCount += i; 2514 2515 // Apply set filters to unmatched elements 2516 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 2517 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 2518 // no element matchers and no seed. 2519 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 2520 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 2521 // numerically zero. 2522 if ( bySet && i !== matchedCount ) { 2523 j = 0; 2524 while ( ( matcher = setMatchers[ j++ ] ) ) { 2525 matcher( unmatched, setMatched, context, xml ); 2526 } 2527 2528 if ( seed ) { 2529 2530 // Reintegrate element matches to eliminate the need for sorting 2531 if ( matchedCount > 0 ) { 2532 while ( i-- ) { 2533 if ( !( unmatched[ i ] || setMatched[ i ] ) ) { 2534 setMatched[ i ] = pop.call( results ); 2535 } 2536 } 2537 } 2538 2539 // Discard index placeholder values to get only actual matches 2540 setMatched = condense( setMatched ); 2541 } 2542 2543 // Add matches to results 2544 push.apply( results, setMatched ); 2545 2546 // Seedless set matches succeeding multiple successful matchers stipulate sorting 2547 if ( outermost && !seed && setMatched.length > 0 && 2548 ( matchedCount + setMatchers.length ) > 1 ) { 2549 2550 jQuery.uniqueSort( results ); 2551 } 2552 } 2553 2554 // Override manipulation of globals by nested matchers 2555 if ( outermost ) { 2556 dirruns = dirrunsUnique; 2557 outermostContext = contextBackup; 2558 } 2559 2560 return unmatched; 2561 }; 2562 2563 return bySet ? 2564 markFunction( superMatcher ) : 2565 superMatcher; 2566} 2567 2568function compile( selector, match /* Internal Use Only */ ) { 2569 var i, 2570 setMatchers = [], 2571 elementMatchers = [], 2572 cached = compilerCache[ selector + " " ]; 2573 2574 if ( !cached ) { 2575 2576 // Generate a function of recursive functions that can be used to check each element 2577 if ( !match ) { 2578 match = tokenize( selector ); 2579 } 2580 i = match.length; 2581 while ( i-- ) { 2582 cached = matcherFromTokens( match[ i ] ); 2583 if ( cached[ expando ] ) { 2584 setMatchers.push( cached ); 2585 } else { 2586 elementMatchers.push( cached ); 2587 } 2588 } 2589 2590 // Cache the compiled function 2591 cached = compilerCache( selector, 2592 matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 2593 2594 // Save selector and tokenization 2595 cached.selector = selector; 2596 } 2597 return cached; 2598} 2599 2600/** 2601 * A low-level selection function that works with jQuery's compiled 2602 * selector functions 2603 * @param {String|Function} selector A selector or a pre-compiled 2604 * selector function built with jQuery selector compile 2605 * @param {Element} context 2606 * @param {Array} [results] 2607 * @param {Array} [seed] A set of elements to match against 2608 */ 2609function select( selector, context, results, seed ) { 2610 var i, tokens, token, type, find, 2611 compiled = typeof selector === "function" && selector, 2612 match = !seed && tokenize( ( selector = compiled.selector || selector ) ); 2613 2614 results = results || []; 2615 2616 // Try to minimize operations if there is only one selector in the list and no seed 2617 // (the latter of which guarantees us context) 2618 if ( match.length === 1 ) { 2619 2620 // Reduce context if the leading compound selector is an ID 2621 tokens = match[ 0 ] = match[ 0 ].slice( 0 ); 2622 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && 2623 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { 2624 2625 context = ( Expr.find.ID( 2626 token.matches[ 0 ].replace( runescape, funescape ), 2627 context 2628 ) || [] )[ 0 ]; 2629 if ( !context ) { 2630 return results; 2631 2632 // Precompiled matchers will still verify ancestry, so step up a level 2633 } else if ( compiled ) { 2634 context = context.parentNode; 2635 } 2636 2637 selector = selector.slice( tokens.shift().value.length ); 2638 } 2639 2640 // Fetch a seed set for right-to-left matching 2641 i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length; 2642 while ( i-- ) { 2643 token = tokens[ i ]; 2644 2645 // Abort if we hit a combinator 2646 if ( Expr.relative[ ( type = token.type ) ] ) { 2647 break; 2648 } 2649 if ( ( find = Expr.find[ type ] ) ) { 2650 2651 // Search, expanding context for leading sibling combinators 2652 if ( ( seed = find( 2653 token.matches[ 0 ].replace( runescape, funescape ), 2654 rsibling.test( tokens[ 0 ].type ) &&
vendor: 4,497 bytes, lines 2655-2839
2655 testContext( context.parentNode ) || context 2656 ) ) ) { 2657 2658 // If seed is empty or no tokens remain, we can return early 2659 tokens.splice( i, 1 ); 2660 selector = seed.length && toSelector( tokens ); 2661 if ( !selector ) { 2662 push.apply( results, seed ); 2663 return results; 2664 } 2665 2666 break; 2667 } 2668 } 2669 } 2670 } 2671 2672 // Compile and execute a filtering function if one is not provided 2673 // Provide `match` to avoid retokenization if we modified the selector above 2674 ( compiled || compile( selector, match ) )( 2675 seed, 2676 context, 2677 !documentIsHTML, 2678 results, 2679 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 2680 ); 2681 return results; 2682} 2683 2684// One-time assignments 2685 2686// Support: Android <=4.0 - 4.1+ 2687// Sort stability 2688support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; 2689 2690// Initialize against the default document 2691setDocument(); 2692 2693// Support: Android <=4.0 - 4.1+ 2694// Detached nodes confoundingly follow *each other* 2695support.sortDetached = assert( function( el ) { 2696 2697 // Should return 1, but returns 4 (following) 2698 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; 2699} ); 2700 2701jQuery.find = find; 2702 2703// Deprecated 2704jQuery.expr[ ":" ] = jQuery.expr.pseudos; 2705jQuery.unique = jQuery.uniqueSort; 2706 2707// These have always been private, but they used to be documented as part of 2708// Sizzle so let's maintain them for now for backwards compatibility purposes. 2709find.compile = compile; 2710find.select = select; 2711find.setDocument = setDocument; 2712find.tokenize = tokenize; 2713 2714find.escape = jQuery.escapeSelector; 2715find.getText = jQuery.text; 2716find.isXML = jQuery.isXMLDoc; 2717find.selectors = jQuery.expr; 2718find.support = jQuery.support; 2719find.uniqueSort = jQuery.uniqueSort; 2720 2721 /* eslint-enable */ 2722 2723} )(); 2724 2725 2726var dir = function( elem, dir, until ) { 2727 var matched = [], 2728 truncate = until !== undefined; 2729 2730 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 2731 if ( elem.nodeType === 1 ) { 2732 if ( truncate && jQuery( elem ).is( until ) ) { 2733 break; 2734 } 2735 matched.push( elem ); 2736 } 2737 } 2738 return matched; 2739}; 2740 2741 2742var siblings = function( n, elem ) { 2743 var matched = []; 2744 2745 for ( ; n; n = n.nextSibling ) { 2746 if ( n.nodeType === 1 && n !== elem ) { 2747 matched.push( n ); 2748 } 2749 } 2750 2751 return matched; 2752}; 2753 2754 2755var rneedsContext = jQuery.expr.match.needsContext; 2756 2757var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 2758 2759 2760 2761// Implement the identical functionality for filter and not 2762function winnow( elements, qualifier, not ) { 2763 if ( isFunction( qualifier ) ) { 2764 return jQuery.grep( elements, function( elem, i ) { 2765 return !!qualifier.call( elem, i, elem ) !== not; 2766 } ); 2767 } 2768 2769 // Single element 2770 if ( qualifier.nodeType ) { 2771 return jQuery.grep( elements, function( elem ) { 2772 return ( elem === qualifier ) !== not; 2773 } ); 2774 } 2775 2776 // Arraylike of elements (jQuery, arguments, Array) 2777 if ( typeof qualifier !== "string" ) { 2778 return jQuery.grep( elements, function( elem ) { 2779 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 2780 } ); 2781 } 2782 2783 // Filtered directly for both simple and complex selectors 2784 return jQuery.filter( qualifier, elements, not ); 2785} 2786 2787jQuery.filter = function( expr, elems, not ) { 2788 var elem = elems[ 0 ]; 2789 2790 if ( not ) { 2791 expr = ":not(" + expr + ")"; 2792 } 2793 2794 if ( elems.length === 1 && elem.nodeType === 1 ) { 2795 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 2796 } 2797 2798 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 2799 return elem.nodeType === 1; 2800 } ) ); 2801}; 2802 2803jQuery.fn.extend( { 2804 find: function( selector ) { 2805 var i, ret, 2806 len = this.length, 2807 self = this; 2808 2809 if ( typeof selector !== "string" ) { 2810 return this.pushStack( jQuery( selector ).filter( function() { 2811 for ( i = 0; i < len; i++ ) { 2812 if ( jQuery.contains( self[ i ], this ) ) { 2813 return true; 2814 } 2815 } 2816 } ) ); 2817 } 2818 2819 ret = this.pushStack( [] ); 2820 2821 for ( i = 0; i < len; i++ ) { 2822 jQuery.find( selector, self[ i ], ret ); 2823 } 2824 2825 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 2826 }, 2827 filter: function( selector ) { 2828 return this.pushStack( winnow( this, selector || [], false ) ); 2829 }, 2830 not: function( selector ) { 2831 return this.pushStack( winnow( this, selector || [], true ) ); 2832 }, 2833 is: function( selector ) { 2834 return !!winnow( 2835 this, 2836 2837 // If this is a positional/relative selector, check membership in the returned set 2838 // so $("p:first").is("p:last") won't return true for a doc with two "p". 2839 typeof selector === "string" && rneedsContext.test( selector ) ?
vendor: 9,941 bytes, lines 2840-3228
2840 jQuery( selector ) : 2841 selector || [], 2842 false 2843 ).length; 2844 } 2845} ); 2846 2847 2848// Initialize a jQuery object 2849 2850 2851// A central reference to the root jQuery(document) 2852var rootjQuery, 2853 2854 // A simple way to check for HTML strings 2855 // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521) 2856 // Strict HTML recognition (trac-11290: must start with <) 2857 // Shortcut simple #id case for speed 2858 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 2859 2860 init = jQuery.fn.init = function( selector, context, root ) { 2861 var match, elem; 2862 2863 // HANDLE: $(""), $(null), $(undefined), $(false) 2864 if ( !selector ) { 2865 return this; 2866 } 2867 2868 // Method init() accepts an alternate rootjQuery 2869 // so migrate can support jQuery.sub (gh-2101) 2870 root = root || rootjQuery; 2871 2872 // Handle HTML strings 2873 if ( typeof selector === "string" ) { 2874 if ( selector[ 0 ] === "<" && 2875 selector[ selector.length - 1 ] === ">" && 2876 selector.length >= 3 ) { 2877 2878 // Assume that strings that start and end with <> are HTML and skip the regex check 2879 match = [ null, selector, null ]; 2880 2881 } else { 2882 match = rquickExpr.exec( selector ); 2883 } 2884 2885 // Match html or make sure no context is specified for #id 2886 if ( match && ( match[ 1 ] || !context ) ) { 2887 2888 // HANDLE: $(html) -> $(array) 2889 if ( match[ 1 ] ) { 2890 context = context instanceof jQuery ? context[ 0 ] : context; 2891 2892 // Option to run scripts is true for back-compat 2893 // Intentionally let the error be thrown if parseHTML is not present 2894 jQuery.merge( this, jQuery.parseHTML( 2895 match[ 1 ], 2896 context && context.nodeType ? context.ownerDocument || context : document, 2897 true 2898 ) ); 2899 2900 // HANDLE: $(html, props) 2901 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 2902 for ( match in context ) { 2903 2904 // Properties of context are called as methods if possible 2905 if ( isFunction( this[ match ] ) ) { 2906 this[ match ]( context[ match ] ); 2907 2908 // ...and otherwise set as attributes 2909 } else { 2910 this.attr( match, context[ match ] ); 2911 } 2912 } 2913 } 2914 2915 return this; 2916 2917 // HANDLE: $(#id) 2918 } else { 2919 elem = document.getElementById( match[ 2 ] ); 2920 2921 if ( elem ) { 2922 2923 // Inject the element directly into the jQuery object 2924 this[ 0 ] = elem; 2925 this.length = 1; 2926 } 2927 return this; 2928 } 2929 2930 // HANDLE: $(expr, $(...)) 2931 } else if ( !context || context.jquery ) { 2932 return ( context || root ).find( selector ); 2933 2934 // HANDLE: $(expr, context) 2935 // (which is just equivalent to: $(context).find(expr) 2936 } else { 2937 return this.constructor( context ).find( selector ); 2938 } 2939 2940 // HANDLE: $(DOMElement) 2941 } else if ( selector.nodeType ) { 2942 this[ 0 ] = selector; 2943 this.length = 1; 2944 return this; 2945 2946 // HANDLE: $(function) 2947 // Shortcut for document ready 2948 } else if ( isFunction( selector ) ) { 2949 return root.ready !== undefined ? 2950 root.ready( selector ) : 2951 2952 // Execute immediately if ready is not present 2953 selector( jQuery ); 2954 } 2955 2956 return jQuery.makeArray( selector, this ); 2957 }; 2958 2959// Give the init function the jQuery prototype for later instantiation 2960init.prototype = jQuery.fn; 2961 2962// Initialize central reference 2963rootjQuery = jQuery( document ); 2964 2965 2966var rparentsprev = /^(?:parents|prev(?:Until|All))/, 2967 2968 // Methods guaranteed to produce a unique set when starting from a unique set 2969 guaranteedUnique = { 2970 children: true, 2971 contents: true, 2972 next: true, 2973 prev: true 2974 }; 2975 2976jQuery.fn.extend( { 2977 has: function( target ) { 2978 var targets = jQuery( target, this ), 2979 l = targets.length; 2980 2981 return this.filter( function() { 2982 var i = 0; 2983 for ( ; i < l; i++ ) { 2984 if ( jQuery.contains( this, targets[ i ] ) ) { 2985 return true; 2986 } 2987 } 2988 } ); 2989 }, 2990 2991 closest: function( selectors, context ) { 2992 var cur, 2993 i = 0, 2994 l = this.length, 2995 matched = [], 2996 targets = typeof selectors !== "string" && jQuery( selectors ); 2997 2998 // Positional selectors never match, since there's no _selection_ context 2999 if ( !rneedsContext.test( selectors ) ) { 3000 for ( ; i < l; i++ ) { 3001 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 3002 3003 // Always skip document fragments 3004 if ( cur.nodeType < 11 && ( targets ? 3005 targets.index( cur ) > -1 : 3006 3007 // Don't pass non-elements to jQuery#find 3008 cur.nodeType === 1 && 3009 jQuery.find.matchesSelector( cur, selectors ) ) ) { 3010 3011 matched.push( cur ); 3012 break; 3013 } 3014 } 3015 } 3016 } 3017 3018 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 3019 }, 3020 3021 // Determine the position of an element within the set 3022 index: function( elem ) { 3023 3024 // No argument, return index in parent 3025 if ( !elem ) { 3026 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 3027 } 3028 3029 // Index in selector 3030 if ( typeof elem === "string" ) { 3031 return indexOf.call( jQuery( elem ), this[ 0 ] ); 3032 } 3033 3034 // Locate the position of the desired element 3035 return indexOf.call( this, 3036 3037 // If it receives a jQuery object, the first element is used 3038 elem.jquery ? elem[ 0 ] : elem 3039 ); 3040 }, 3041 3042 add: function( selector, context ) { 3043 return this.pushStack( 3044 jQuery.uniqueSort( 3045 jQuery.merge( this.get(), jQuery( selector, context ) ) 3046 ) 3047 ); 3048 }, 3049 3050 addBack: function( selector ) { 3051 return this.add( selector == null ? 3052 this.prevObject : this.prevObject.filter( selector ) 3053 ); 3054 } 3055} ); 3056 3057function sibling( cur, dir ) { 3058 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 3059 return cur; 3060} 3061 3062jQuery.each( { 3063 parent: function( elem ) { 3064 var parent = elem.parentNode; 3065 return parent && parent.nodeType !== 11 ? parent : null; 3066 }, 3067 parents: function( elem ) { 3068 return dir( elem, "parentNode" ); 3069 }, 3070 parentsUntil: function( elem, _i, until ) { 3071 return dir( elem, "parentNode", until ); 3072 }, 3073 next: function( elem ) { 3074 return sibling( elem, "nextSibling" ); 3075 }, 3076 prev: function( elem ) { 3077 return sibling( elem, "previousSibling" ); 3078 }, 3079 nextAll: function( elem ) { 3080 return dir( elem, "nextSibling" ); 3081 }, 3082 prevAll: function( elem ) { 3083 return dir( elem, "previousSibling" ); 3084 }, 3085 nextUntil: function( elem, _i, until ) { 3086 return dir( elem, "nextSibling", until ); 3087 }, 3088 prevUntil: function( elem, _i, until ) { 3089 return dir( elem, "previousSibling", until ); 3090 }, 3091 siblings: function( elem ) { 3092 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 3093 }, 3094 children: function( elem ) { 3095 return siblings( elem.firstChild ); 3096 }, 3097 contents: function( elem ) { 3098 if ( elem.contentDocument != null && 3099 3100 // Support: IE 11+ 3101 // <object> elements with no `data` attribute has an object 3102 // `contentDocument` with a `null` prototype. 3103 getProto( elem.contentDocument ) ) { 3104 3105 return elem.contentDocument; 3106 } 3107 3108 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 3109 // Treat the template element as a regular one in browsers that 3110 // don't support it. 3111 if ( nodeName( elem, "template" ) ) { 3112 elem = elem.content || elem; 3113 } 3114 3115 return jQuery.merge( [], elem.childNodes ); 3116 } 3117}, function( name, fn ) { 3118 jQuery.fn[ name ] = function( until, selector ) { 3119 var matched = jQuery.map( this, fn, until ); 3120 3121 if ( name.slice( -5 ) !== "Until" ) { 3122 selector = until; 3123 } 3124 3125 if ( selector && typeof selector === "string" ) { 3126 matched = jQuery.filter( selector, matched ); 3127 } 3128 3129 if ( this.length > 1 ) { 3130 3131 // Remove duplicates 3132 if ( !guaranteedUnique[ name ] ) { 3133 jQuery.uniqueSort( matched ); 3134 } 3135 3136 // Reverse order for parents* and prev-derivatives 3137 if ( rparentsprev.test( name ) ) { 3138 matched.reverse(); 3139 } 3140 } 3141 3142 return this.pushStack( matched ); 3143 }; 3144} ); 3145var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 3146 3147 3148 3149// Convert String-formatted options into Object-formatted ones 3150function createOptions( options ) { 3151 var object = {}; 3152 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 3153 object[ flag ] = true; 3154 } ); 3155 return object; 3156} 3157 3158/* 3159 * Create a callback list using the following parameters: 3160 * 3161 * options: an optional list of space-separated options that will change how 3162 * the callback list behaves or a more traditional option object 3163 * 3164 * By default a callback list will act like an event callback list and can be 3165 * "fired" multiple times. 3166 * 3167 * Possible options: 3168 * 3169 * once: will ensure the callback list can only be fired once (like a Deferred) 3170 * 3171 * memory: will keep track of previous values and will call any callback added 3172 * after the list has been fired right away with the latest "memorized" 3173 * values (like a Deferred) 3174 * 3175 * unique: will ensure a callback can only be added once (no duplicate in the list) 3176 * 3177 * stopOnFalse: interrupt callings when a callback returns false 3178 * 3179 */ 3180jQuery.Callbacks = function( options ) { 3181 3182 // Convert options from String-formatted to Object-formatted if needed 3183 // (we check in cache first) 3184 options = typeof options === "string" ? 3185 createOptions( options ) : 3186 jQuery.extend( {}, options ); 3187 3188 var // Flag to know if list is currently firing 3189 firing, 3190 3191 // Last fire value for non-forgettable lists 3192 memory, 3193 3194 // Flag to know if list was already fired 3195 fired, 3196 3197 // Flag to prevent firing 3198 locked, 3199 3200 // Actual callback list 3201 list = [], 3202 3203 // Queue of execution data for repeatable lists 3204 queue = [], 3205 3206 // Index of currently firing callback (modified by add/remove as needed) 3207 firingIndex = -1, 3208 3209 // Fire callbacks 3210 fire = function() { 3211 3212 // Enforce single-firing 3213 locked = locked || options.once; 3214 3215 // Execute callbacks for all pending executions, 3216 // respecting firingIndex overrides and runtime changes 3217 fired = firing = true; 3218 for ( ; queue.length; firingIndex = -1 ) { 3219 memory = queue.shift(); 3220 while ( ++firingIndex < list.length ) { 3221 3222 // Run callback and check for early termination 3223 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 3224 options.stopOnFalse ) { 3225 3226 // Jump to end and forget the data so .add doesn't re-fire 3227 firingIndex = list.length; 3228 memory = false;
vendor: 4,918 bytes, lines 3229-3438
3229 } 3230 } 3231 } 3232 3233 // Forget the data if we're done with it 3234 if ( !options.memory ) { 3235 memory = false; 3236 } 3237 3238 firing = false; 3239 3240 // Clean up if we're done firing for good 3241 if ( locked ) { 3242 3243 // Keep an empty list if we have data for future add calls 3244 if ( memory ) { 3245 list = []; 3246 3247 // Otherwise, this object is spent 3248 } else { 3249 list = ""; 3250 } 3251 } 3252 }, 3253 3254 // Actual Callbacks object 3255 self = { 3256 3257 // Add a callback or a collection of callbacks to the list 3258 add: function() { 3259 if ( list ) { 3260 3261 // If we have memory from a past run, we should fire after adding 3262 if ( memory && !firing ) { 3263 firingIndex = list.length - 1; 3264 queue.push( memory ); 3265 } 3266 3267 ( function add( args ) { 3268 jQuery.each( args, function( _, arg ) { 3269 if ( isFunction( arg ) ) { 3270 if ( !options.unique || !self.has( arg ) ) { 3271 list.push( arg ); 3272 } 3273 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 3274 3275 // Inspect recursively 3276 add( arg ); 3277 } 3278 } ); 3279 } )( arguments ); 3280 3281 if ( memory && !firing ) { 3282 fire(); 3283 } 3284 } 3285 return this; 3286 }, 3287 3288 // Remove a callback from the list 3289 remove: function() { 3290 jQuery.each( arguments, function( _, arg ) { 3291 var index; 3292 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 3293 list.splice( index, 1 ); 3294 3295 // Handle firing indexes 3296 if ( index <= firingIndex ) { 3297 firingIndex--; 3298 } 3299 } 3300 } ); 3301 return this; 3302 }, 3303 3304 // Check if a given callback is in the list. 3305 // If no argument is given, return whether or not list has callbacks attached. 3306 has: function( fn ) { 3307 return fn ? 3308 jQuery.inArray( fn, list ) > -1 : 3309 list.length > 0; 3310 }, 3311 3312 // Remove all callbacks from the list 3313 empty: function() { 3314 if ( list ) { 3315 list = []; 3316 } 3317 return this; 3318 }, 3319 3320 // Disable .fire and .add 3321 // Abort any current/pending executions 3322 // Clear all callbacks and values 3323 disable: function() { 3324 locked = queue = []; 3325 list = memory = ""; 3326 return this; 3327 }, 3328 disabled: function() { 3329 return !list; 3330 }, 3331 3332 // Disable .fire 3333 // Also disable .add unless we have memory (since it would have no effect) 3334 // Abort any pending executions 3335 lock: function() { 3336 locked = queue = []; 3337 if ( !memory && !firing ) { 3338 list = memory = ""; 3339 } 3340 return this; 3341 }, 3342 locked: function() { 3343 return !!locked; 3344 }, 3345 3346 // Call all callbacks with the given context and arguments 3347 fireWith: function( context, args ) { 3348 if ( !locked ) { 3349 args = args || []; 3350 args = [ context, args.slice ? args.slice() : args ]; 3351 queue.push( args ); 3352 if ( !firing ) { 3353 fire(); 3354 } 3355 } 3356 return this; 3357 }, 3358 3359 // Call all the callbacks with the given arguments 3360 fire: function() { 3361 self.fireWith( this, arguments ); 3362 return this; 3363 }, 3364 3365 // To know if the callbacks have already been called at least once 3366 fired: function() { 3367 return !!fired; 3368 } 3369 }; 3370 3371 return self; 3372}; 3373 3374 3375function Identity( v ) { 3376 return v; 3377} 3378function Thrower( ex ) { 3379 throw ex; 3380} 3381 3382function adoptValue( value, resolve, reject, noValue ) { 3383 var method; 3384 3385 try { 3386 3387 // Check for promise aspect first to privilege synchronous behavior 3388 if ( value && isFunction( ( method = value.promise ) ) ) { 3389 method.call( value ).done( resolve ).fail( reject ); 3390 3391 // Other thenables 3392 } else if ( value && isFunction( ( method = value.then ) ) ) { 3393 method.call( value, resolve, reject ); 3394 3395 // Other non-thenables 3396 } else { 3397 3398 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 3399 // * false: [ value ].slice( 0 ) => resolve( value ) 3400 // * true: [ value ].slice( 1 ) => resolve() 3401 resolve.apply( undefined, [ value ].slice( noValue ) ); 3402 } 3403 3404 // For Promises/A+, convert exceptions into rejections 3405 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 3406 // Deferred#then to conditionally suppress rejection. 3407 } catch ( value ) { 3408 3409 // Support: Android 4.0 only 3410 // Strict mode functions invoked without .call/.apply get global-object context 3411 reject.apply( undefined, [ value ] ); 3412 } 3413} 3414 3415jQuery.extend( { 3416 3417 Deferred: function( func ) { 3418 var tuples = [ 3419 3420 // action, add listener, callbacks, 3421 // ... .then handlers, argument index, [final state] 3422 [ "notify", "progress", jQuery.Callbacks( "memory" ), 3423 jQuery.Callbacks( "memory" ), 2 ], 3424 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 3425 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 3426 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 3427 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 3428 ], 3429 state = "pending", 3430 promise = { 3431 state: function() { 3432 return state; 3433 }, 3434 always: function() { 3435 deferred.done( arguments ).fail( arguments ); 3436 return this; 3437 }, 3438 "catch": function( fn ) {
vendor: 28,472 bytes, lines 3439-4550
3439 return promise.then( null, fn ); 3440 }, 3441 3442 // Keep pipe for back-compat 3443 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 3444 var fns = arguments; 3445 3446 return jQuery.Deferred( function( newDefer ) { 3447 jQuery.each( tuples, function( _i, tuple ) { 3448 3449 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 3450 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 3451 3452 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 3453 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 3454 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 3455 deferred[ tuple[ 1 ] ]( function() { 3456 var returned = fn && fn.apply( this, arguments ); 3457 if ( returned && isFunction( returned.promise ) ) { 3458 returned.promise() 3459 .progress( newDefer.notify ) 3460 .done( newDefer.resolve ) 3461 .fail( newDefer.reject ); 3462 } else { 3463 newDefer[ tuple[ 0 ] + "With" ]( 3464 this, 3465 fn ? [ returned ] : arguments 3466 ); 3467 } 3468 } ); 3469 } ); 3470 fns = null; 3471 } ).promise(); 3472 }, 3473 then: function( onFulfilled, onRejected, onProgress ) { 3474 var maxDepth = 0; 3475 function resolve( depth, deferred, handler, special ) { 3476 return function() { 3477 var that = this, 3478 args = arguments, 3479 mightThrow = function() { 3480 var returned, then; 3481 3482 // Support: Promises/A+ section 2.3.3.3.3 3483 // https://promisesaplus.com/#point-59 3484 // Ignore double-resolution attempts 3485 if ( depth < maxDepth ) { 3486 return; 3487 } 3488 3489 returned = handler.apply( that, args ); 3490 3491 // Support: Promises/A+ section 2.3.1 3492 // https://promisesaplus.com/#point-48 3493 if ( returned === deferred.promise() ) { 3494 throw new TypeError( "Thenable self-resolution" ); 3495 } 3496 3497 // Support: Promises/A+ sections 2.3.3.1, 3.5 3498 // https://promisesaplus.com/#point-54 3499 // https://promisesaplus.com/#point-75 3500 // Retrieve `then` only once 3501 then = returned && 3502 3503 // Support: Promises/A+ section 2.3.4 3504 // https://promisesaplus.com/#point-64 3505 // Only check objects and functions for thenability 3506 ( typeof returned === "object" || 3507 typeof returned === "function" ) && 3508 returned.then; 3509 3510 // Handle a returned thenable 3511 if ( isFunction( then ) ) { 3512 3513 // Special processors (notify) just wait for resolution 3514 if ( special ) { 3515 then.call( 3516 returned, 3517 resolve( maxDepth, deferred, Identity, special ), 3518 resolve( maxDepth, deferred, Thrower, special ) 3519 ); 3520 3521 // Normal processors (resolve) also hook into progress 3522 } else { 3523 3524 // ...and disregard older resolution values 3525 maxDepth++; 3526 3527 then.call( 3528 returned, 3529 resolve( maxDepth, deferred, Identity, special ), 3530 resolve( maxDepth, deferred, Thrower, special ), 3531 resolve( maxDepth, deferred, Identity, 3532 deferred.notifyWith ) 3533 ); 3534 } 3535 3536 // Handle all other returned values 3537 } else { 3538 3539 // Only substitute handlers pass on context 3540 // and multiple values (non-spec behavior) 3541 if ( handler !== Identity ) { 3542 that = undefined; 3543 args = [ returned ]; 3544 } 3545 3546 // Process the value(s) 3547 // Default process is resolve 3548 ( special || deferred.resolveWith )( that, args ); 3549 } 3550 }, 3551 3552 // Only normal processors (resolve) catch and reject exceptions 3553 process = special ? 3554 mightThrow : 3555 function() { 3556 try { 3557 mightThrow(); 3558 } catch ( e ) { 3559 3560 if ( jQuery.Deferred.exceptionHook ) { 3561 jQuery.Deferred.exceptionHook( e, 3562 process.error ); 3563 } 3564 3565 // Support: Promises/A+ section 2.3.3.3.4.1 3566 // https://promisesaplus.com/#point-61 3567 // Ignore post-resolution exceptions 3568 if ( depth + 1 >= maxDepth ) { 3569 3570 // Only substitute handlers pass on context 3571 // and multiple values (non-spec behavior) 3572 if ( handler !== Thrower ) { 3573 that = undefined; 3574 args = [ e ]; 3575 } 3576 3577 deferred.rejectWith( that, args ); 3578 } 3579 } 3580 }; 3581 3582 // Support: Promises/A+ section 2.3.3.3.1 3583 // https://promisesaplus.com/#point-57 3584 // Re-resolve promises immediately to dodge false rejection from 3585 // subsequent errors 3586 if ( depth ) { 3587 process(); 3588 } else { 3589 3590 // Call an optional hook to record the error, in case of exception 3591 // since it's otherwise lost when execution goes async 3592 if ( jQuery.Deferred.getErrorHook ) { 3593 process.error = jQuery.Deferred.getErrorHook(); 3594 3595 // The deprecated alias of the above. While the name suggests 3596 // returning the stack, not an error instance, jQuery just passes 3597 // it directly to `console.warn` so both will work; an instance 3598 // just better cooperates with source maps. 3599 } else if ( jQuery.Deferred.getStackHook ) { 3600 process.error = jQuery.Deferred.getStackHook(); 3601 } 3602 window.setTimeout( process ); 3603 } 3604 }; 3605 } 3606 3607 return jQuery.Deferred( function( newDefer ) { 3608 3609 // progress_handlers.add( ... ) 3610 tuples[ 0 ][ 3 ].add( 3611 resolve( 3612 0, 3613 newDefer, 3614 isFunction( onProgress ) ? 3615 onProgress : 3616 Identity, 3617 newDefer.notifyWith 3618 ) 3619 ); 3620 3621 // fulfilled_handlers.add( ... ) 3622 tuples[ 1 ][ 3 ].add( 3623 resolve( 3624 0, 3625 newDefer, 3626 isFunction( onFulfilled ) ? 3627 onFulfilled : 3628 Identity 3629 ) 3630 ); 3631 3632 // rejected_handlers.add( ... ) 3633 tuples[ 2 ][ 3 ].add( 3634 resolve( 3635 0, 3636 newDefer, 3637 isFunction( onRejected ) ? 3638 onRejected : 3639 Thrower 3640 ) 3641 ); 3642 } ).promise(); 3643 }, 3644 3645 // Get a promise for this deferred 3646 // If obj is provided, the promise aspect is added to the object 3647 promise: function( obj ) { 3648 return obj != null ? jQuery.extend( obj, promise ) : promise; 3649 } 3650 }, 3651 deferred = {}; 3652 3653 // Add list-specific methods 3654 jQuery.each( tuples, function( i, tuple ) { 3655 var list = tuple[ 2 ], 3656 stateString = tuple[ 5 ]; 3657 3658 // promise.progress = list.add 3659 // promise.done = list.add 3660 // promise.fail = list.add 3661 promise[ tuple[ 1 ] ] = list.add; 3662 3663 // Handle state 3664 if ( stateString ) { 3665 list.add( 3666 function() { 3667 3668 // state = "resolved" (i.e., fulfilled) 3669 // state = "rejected" 3670 state = stateString; 3671 }, 3672 3673 // rejected_callbacks.disable 3674 // fulfilled_callbacks.disable 3675 tuples[ 3 - i ][ 2 ].disable, 3676 3677 // rejected_handlers.disable 3678 // fulfilled_handlers.disable 3679 tuples[ 3 - i ][ 3 ].disable, 3680 3681 // progress_callbacks.lock 3682 tuples[ 0 ][ 2 ].lock, 3683 3684 // progress_handlers.lock 3685 tuples[ 0 ][ 3 ].lock 3686 ); 3687 } 3688 3689 // progress_handlers.fire 3690 // fulfilled_handlers.fire 3691 // rejected_handlers.fire 3692 list.add( tuple[ 3 ].fire ); 3693 3694 // deferred.notify = function() { deferred.notifyWith(...) } 3695 // deferred.resolve = function() { deferred.resolveWith(...) } 3696 // deferred.reject = function() { deferred.rejectWith(...) } 3697 deferred[ tuple[ 0 ] ] = function() { 3698 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 3699 return this; 3700 }; 3701 3702 // deferred.notifyWith = list.fireWith 3703 // deferred.resolveWith = list.fireWith 3704 // deferred.rejectWith = list.fireWith 3705 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 3706 } ); 3707 3708 // Make the deferred a promise 3709 promise.promise( deferred ); 3710 3711 // Call given func if any 3712 if ( func ) { 3713 func.call( deferred, deferred ); 3714 } 3715 3716 // All done! 3717 return deferred; 3718 }, 3719 3720 // Deferred helper 3721 when: function( singleValue ) { 3722 var 3723 3724 // count of uncompleted subordinates 3725 remaining = arguments.length, 3726 3727 // count of unprocessed arguments 3728 i = remaining, 3729 3730 // subordinate fulfillment data 3731 resolveContexts = Array( i ), 3732 resolveValues = slice.call( arguments ), 3733 3734 // the primary Deferred 3735 primary = jQuery.Deferred(), 3736 3737 // subordinate callback factory 3738 updateFunc = function( i ) { 3739 return function( value ) { 3740 resolveContexts[ i ] = this; 3741 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 3742 if ( !( --remaining ) ) { 3743 primary.resolveWith( resolveContexts, resolveValues ); 3744 } 3745 }; 3746 }; 3747 3748 // Single- and empty arguments are adopted like Promise.resolve 3749 if ( remaining <= 1 ) { 3750 adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, 3751 !remaining ); 3752 3753 // Use .then() to unwrap secondary thenables (cf. gh-3000) 3754 if ( primary.state() === "pending" || 3755 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 3756 3757 return primary.then(); 3758 } 3759 } 3760 3761 // Multiple arguments are aggregated like Promise.all array elements 3762 while ( i-- ) { 3763 adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); 3764 } 3765 3766 return primary.promise(); 3767 } 3768} ); 3769 3770 3771// These usually indicate a programmer mistake during development, 3772// warn about them ASAP rather than swallowing them by default. 3773var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 3774 3775// If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error 3776// captured before the async barrier to get the original error cause 3777// which may otherwise be hidden. 3778jQuery.Deferred.exceptionHook = function( error, asyncError ) { 3779 3780 // Support: IE 8 - 9 only 3781 // Console exists when dev tools are open, which can happen at any time 3782 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 3783 window.console.warn( "jQuery.Deferred exception: " + error.message, 3784 error.stack, asyncError ); 3785 } 3786}; 3787 3788 3789 3790 3791jQuery.readyException = function( error ) { 3792 window.setTimeout( function() { 3793 throw error; 3794 } ); 3795}; 3796 3797 3798 3799 3800// The deferred used on DOM ready 3801var readyList = jQuery.Deferred(); 3802 3803jQuery.fn.ready = function( fn ) { 3804 3805 readyList 3806 .then( fn ) 3807 3808 // Wrap jQuery.readyException in a function so that the lookup 3809 // happens at the time of error handling instead of callback 3810 // registration. 3811 .catch( function( error ) { 3812 jQuery.readyException( error ); 3813 } ); 3814 3815 return this; 3816}; 3817 3818jQuery.extend( { 3819 3820 // Is the DOM ready to be used? Set to true once it occurs. 3821 isReady: false, 3822 3823 // A counter to track how many items to wait for before 3824 // the ready event fires. See trac-6781 3825 readyWait: 1, 3826 3827 // Handle when the DOM is ready 3828 ready: function( wait ) { 3829 3830 // Abort if there are pending holds or we're already ready 3831 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 3832 return; 3833 } 3834 3835 // Remember that the DOM is ready 3836 jQuery.isReady = true; 3837 3838 // If a normal DOM Ready event fired, decrement, and wait if need be 3839 if ( wait !== true && --jQuery.readyWait > 0 ) { 3840 return; 3841 } 3842 3843 // If there are functions bound, to execute 3844 readyList.resolveWith( document, [ jQuery ] ); 3845 } 3846} ); 3847 3848jQuery.ready.then = readyList.then; 3849 3850// The ready event handler and self cleanup method 3851function completed() { 3852 document.removeEventListener( "DOMContentLoaded", completed ); 3853 window.removeEventListener( "load", completed ); 3854 jQuery.ready(); 3855} 3856 3857// Catch cases where $(document).ready() is called 3858// after the browser event has already occurred. 3859// Support: IE <=9 - 10 only 3860// Older IE sometimes signals "interactive" too soon 3861if ( document.readyState === "complete" || 3862 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 3863 3864 // Handle it asynchronously to allow scripts the opportunity to delay ready 3865 window.setTimeout( jQuery.ready ); 3866 3867} else { 3868 3869 // Use the handy event callback 3870 document.addEventListener( "DOMContentLoaded", completed ); 3871 3872 // A fallback to window.onload, that will always work 3873 window.addEventListener( "load", completed ); 3874} 3875 3876 3877 3878 3879// Multifunctional method to get and set values of a collection 3880// The value/s can optionally be executed if it's a function 3881var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 3882 var i = 0, 3883 len = elems.length, 3884 bulk = key == null; 3885 3886 // Sets many values 3887 if ( toType( key ) === "object" ) { 3888 chainable = true; 3889 for ( i in key ) { 3890 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 3891 } 3892 3893 // Sets one value 3894 } else if ( value !== undefined ) { 3895 chainable = true; 3896 3897 if ( !isFunction( value ) ) { 3898 raw = true; 3899 } 3900 3901 if ( bulk ) { 3902 3903 // Bulk operations run against the entire set 3904 if ( raw ) { 3905 fn.call( elems, value ); 3906 fn = null; 3907 3908 // ...except when executing function values 3909 } else { 3910 bulk = fn; 3911 fn = function( elem, _key, value ) { 3912 return bulk.call( jQuery( elem ), value ); 3913 }; 3914 } 3915 } 3916 3917 if ( fn ) { 3918 for ( ; i < len; i++ ) { 3919 fn( 3920 elems[ i ], key, raw ? 3921 value : 3922 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 3923 ); 3924 } 3925 } 3926 } 3927 3928 if ( chainable ) { 3929 return elems; 3930 } 3931 3932 // Gets 3933 if ( bulk ) { 3934 return fn.call( elems ); 3935 } 3936 3937 return len ? fn( elems[ 0 ], key ) : emptyGet; 3938}; 3939 3940 3941// Matches dashed string for camelizing 3942var rmsPrefix = /^-ms-/, 3943 rdashAlpha = /-([a-z])/g; 3944 3945// Used by camelCase as callback to replace() 3946function fcamelCase( _all, letter ) { 3947 return letter.toUpperCase(); 3948} 3949 3950// Convert dashed to camelCase; used by the css and data modules 3951// Support: IE <=9 - 11, Edge 12 - 15 3952// Microsoft forgot to hump their vendor prefix (trac-9572) 3953function camelCase( string ) { 3954 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 3955} 3956var acceptData = function( owner ) { 3957 3958 // Accepts only: 3959 // - Node 3960 // - Node.ELEMENT_NODE 3961 // - Node.DOCUMENT_NODE 3962 // - Object 3963 // - Any 3964 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 3965}; 3966 3967 3968 3969 3970function Data() { 3971 this.expando = jQuery.expando + Data.uid++; 3972} 3973 3974Data.uid = 1; 3975 3976Data.prototype = { 3977 3978 cache: function( owner ) { 3979 3980 // Check if the owner object already has a cache 3981 var value = owner[ this.expando ]; 3982 3983 // If not, create one 3984 if ( !value ) { 3985 value = {}; 3986 3987 // We can accept data for non-element nodes in modern browsers, 3988 // but we should not, see trac-8335. 3989 // Always return an empty object. 3990 if ( acceptData( owner ) ) { 3991 3992 // If it is a node unlikely to be stringify-ed or looped over 3993 // use plain assignment 3994 if ( owner.nodeType ) { 3995 owner[ this.expando ] = value; 3996 3997 // Otherwise secure it in a non-enumerable property 3998 // configurable must be true to allow the property to be 3999 // deleted when data is removed 4000 } else { 4001 Object.defineProperty( owner, this.expando, { 4002 value: value, 4003 configurable: true 4004 } ); 4005 } 4006 } 4007 } 4008 4009 return value; 4010 }, 4011 set: function( owner, data, value ) { 4012 var prop, 4013 cache = this.cache( owner ); 4014 4015 // Handle: [ owner, key, value ] args 4016 // Always use camelCase key (gh-2257) 4017 if ( typeof data === "string" ) { 4018 cache[ camelCase( data ) ] = value; 4019 4020 // Handle: [ owner, { properties } ] args 4021 } else { 4022 4023 // Copy the properties one-by-one to the cache object 4024 for ( prop in data ) { 4025 cache[ camelCase( prop ) ] = data[ prop ]; 4026 } 4027 } 4028 return cache; 4029 }, 4030 get: function( owner, key ) { 4031 return key === undefined ? 4032 this.cache( owner ) : 4033 4034 // Always use camelCase key (gh-2257) 4035 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 4036 }, 4037 access: function( owner, key, value ) { 4038 4039 // In cases where either: 4040 // 4041 // 1. No key was specified 4042 // 2. A string key was specified, but no value provided 4043 // 4044 // Take the "read" path and allow the get method to determine 4045 // which value to return, respectively either: 4046 // 4047 // 1. The entire cache object 4048 // 2. The data stored at the key 4049 // 4050 if ( key === undefined || 4051 ( ( key && typeof key === "string" ) && value === undefined ) ) { 4052 4053 return this.get( owner, key ); 4054 } 4055 4056 // When the key is not a string, or both a key and value 4057 // are specified, set or extend (existing objects) with either: 4058 // 4059 // 1. An object of properties 4060 // 2. A key and value 4061 // 4062 this.set( owner, key, value ); 4063 4064 // Since the "set" path can have two possible entry points 4065 // return the expected data based on which path was taken[*] 4066 return value !== undefined ? value : key; 4067 }, 4068 remove: function( owner, key ) { 4069 var i, 4070 cache = owner[ this.expando ]; 4071 4072 if ( cache === undefined ) { 4073 return; 4074 } 4075 4076 if ( key !== undefined ) { 4077 4078 // Support array or space separated string of keys 4079 if ( Array.isArray( key ) ) { 4080 4081 // If key is an array of keys... 4082 // We always set camelCase keys, so remove that. 4083 key = key.map( camelCase ); 4084 } else { 4085 key = camelCase( key ); 4086 4087 // If a key with the spaces exists, use it. 4088 // Otherwise, create an array by matching non-whitespace 4089 key = key in cache ? 4090 [ key ] : 4091 ( key.match( rnothtmlwhite ) || [] ); 4092 } 4093 4094 i = key.length; 4095 4096 while ( i-- ) { 4097 delete cache[ key[ i ] ]; 4098 } 4099 } 4100 4101 // Remove the expando if there's no more data 4102 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 4103 4104 // Support: Chrome <=35 - 45 4105 // Webkit & Blink performance suffers when deleting properties 4106 // from DOM nodes, so set to undefined instead 4107 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 4108 if ( owner.nodeType ) { 4109 owner[ this.expando ] = undefined; 4110 } else { 4111 delete owner[ this.expando ]; 4112 } 4113 } 4114 }, 4115 hasData: function( owner ) { 4116 var cache = owner[ this.expando ]; 4117 return cache !== undefined && !jQuery.isEmptyObject( cache ); 4118 } 4119}; 4120var dataPriv = new Data(); 4121 4122var dataUser = new Data(); 4123 4124 4125 4126// Implementation Summary 4127// 4128// 1. Enforce API surface and semantic compatibility with 1.9.x branch 4129// 2. Improve the module's maintainability by reducing the storage 4130// paths to a single mechanism. 4131// 3. Use the same single mechanism to support "private" and "user" data. 4132// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 4133// 5. Avoid exposing implementation details on user objects (eg. expando properties) 4134// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 4135 4136var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 4137 rmultiDash = /[A-Z]/g; 4138 4139function getData( data ) { 4140 if ( data === "true" ) { 4141 return true; 4142 } 4143 4144 if ( data === "false" ) { 4145 return false; 4146 } 4147 4148 if ( data === "null" ) { 4149 return null; 4150 } 4151 4152 // Only convert to a number if it doesn't change the string 4153 if ( data === +data + "" ) { 4154 return +data; 4155 } 4156 4157 if ( rbrace.test( data ) ) { 4158 return JSON.parse( data ); 4159 } 4160 4161 return data; 4162} 4163 4164function dataAttr( elem, key, data ) { 4165 var name; 4166 4167 // If nothing was found internally, try to fetch any 4168 // data from the HTML5 data-* attribute 4169 if ( data === undefined && elem.nodeType === 1 ) { 4170 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 4171 data = elem.getAttribute( name ); 4172 4173 if ( typeof data === "string" ) { 4174 try { 4175 data = getData( data ); 4176 } catch ( e ) {} 4177 4178 // Make sure we set the data so it isn't changed later 4179 dataUser.set( elem, key, data ); 4180 } else { 4181 data = undefined; 4182 } 4183 } 4184 return data; 4185} 4186 4187jQuery.extend( { 4188 hasData: function( elem ) { 4189 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 4190 }, 4191 4192 data: function( elem, name, data ) { 4193 return dataUser.access( elem, name, data ); 4194 }, 4195 4196 removeData: function( elem, name ) { 4197 dataUser.remove( elem, name ); 4198 }, 4199 4200 // TODO: Now that all calls to _data and _removeData have been replaced 4201 // with direct calls to dataPriv methods, these can be deprecated. 4202 _data: function( elem, name, data ) { 4203 return dataPriv.access( elem, name, data ); 4204 }, 4205 4206 _removeData: function( elem, name ) { 4207 dataPriv.remove( elem, name ); 4208 } 4209} ); 4210 4211jQuery.fn.extend( { 4212 data: function( key, value ) { 4213 var i, name, data, 4214 elem = this[ 0 ], 4215 attrs = elem && elem.attributes; 4216 4217 // Gets all values 4218 if ( key === undefined ) { 4219 if ( this.length ) { 4220 data = dataUser.get( elem ); 4221 4222 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 4223 i = attrs.length; 4224 while ( i-- ) { 4225 4226 // Support: IE 11 only 4227 // The attrs elements can be null (trac-14894) 4228 if ( attrs[ i ] ) { 4229 name = attrs[ i ].name; 4230 if ( name.indexOf( "data-" ) === 0 ) { 4231 name = camelCase( name.slice( 5 ) ); 4232 dataAttr( elem, name, data[ name ] ); 4233 } 4234 } 4235 } 4236 dataPriv.set( elem, "hasDataAttrs", true ); 4237 } 4238 } 4239 4240 return data; 4241 } 4242 4243 // Sets multiple values 4244 if ( typeof key === "object" ) { 4245 return this.each( function() { 4246 dataUser.set( this, key ); 4247 } ); 4248 } 4249 4250 return access( this, function( value ) { 4251 var data; 4252 4253 // The calling jQuery object (element matches) is not empty 4254 // (and therefore has an element appears at this[ 0 ]) and the 4255 // `value` parameter was not undefined. An empty jQuery object 4256 // will result in `undefined` for elem = this[ 0 ] which will 4257 // throw an exception if an attempt to read a data cache is made. 4258 if ( elem && value === undefined ) { 4259 4260 // Attempt to get data from the cache 4261 // The key will always be camelCased in Data 4262 data = dataUser.get( elem, key ); 4263 if ( data !== undefined ) { 4264 return data; 4265 } 4266 4267 // Attempt to "discover" the data in 4268 // HTML5 custom data-* attrs 4269 data = dataAttr( elem, key ); 4270 if ( data !== undefined ) { 4271 return data; 4272 } 4273 4274 // We tried really hard, but the data doesn't exist. 4275 return; 4276 } 4277 4278 // Set the data... 4279 this.each( function() { 4280 4281 // We always store the camelCased key 4282 dataUser.set( this, key, value ); 4283 } ); 4284 }, null, value, arguments.length > 1, null, true ); 4285 }, 4286 4287 removeData: function( key ) { 4288 return this.each( function() { 4289 dataUser.remove( this, key ); 4290 } ); 4291 } 4292} ); 4293 4294 4295jQuery.extend( { 4296 queue: function( elem, type, data ) { 4297 var queue; 4298 4299 if ( elem ) { 4300 type = ( type || "fx" ) + "queue"; 4301 queue = dataPriv.get( elem, type ); 4302 4303 // Speed up dequeue by getting out quickly if this is just a lookup 4304 if ( data ) { 4305 if ( !queue || Array.isArray( data ) ) { 4306 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 4307 } else { 4308 queue.push( data ); 4309 } 4310 } 4311 return queue || []; 4312 } 4313 }, 4314 4315 dequeue: function( elem, type ) { 4316 type = type || "fx"; 4317 4318 var queue = jQuery.queue( elem, type ), 4319 startLength = queue.length, 4320 fn = queue.shift(), 4321 hooks = jQuery._queueHooks( elem, type ), 4322 next = function() { 4323 jQuery.dequeue( elem, type ); 4324 }; 4325 4326 // If the fx queue is dequeued, always remove the progress sentinel 4327 if ( fn === "inprogress" ) { 4328 fn = queue.shift(); 4329 startLength--; 4330 } 4331 4332 if ( fn ) { 4333 4334 // Add a progress sentinel to prevent the fx queue from being 4335 // automatically dequeued 4336 if ( type === "fx" ) { 4337 queue.unshift( "inprogress" ); 4338 } 4339 4340 // Clear up the last queue stop function 4341 delete hooks.stop; 4342 fn.call( elem, next, hooks ); 4343 } 4344 4345 if ( !startLength && hooks ) { 4346 hooks.empty.fire(); 4347 } 4348 }, 4349 4350 // Not public - generate a queueHooks object, or return the current one 4351 _queueHooks: function( elem, type ) { 4352 var key = type + "queueHooks"; 4353 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 4354 empty: jQuery.Callbacks( "once memory" ).add( function() { 4355 dataPriv.remove( elem, [ type + "queue", key ] ); 4356 } ) 4357 } ); 4358 } 4359} ); 4360 4361jQuery.fn.extend( { 4362 queue: function( type, data ) { 4363 var setter = 2; 4364 4365 if ( typeof type !== "string" ) { 4366 data = type; 4367 type = "fx"; 4368 setter--; 4369 } 4370 4371 if ( arguments.length < setter ) { 4372 return jQuery.queue( this[ 0 ], type ); 4373 } 4374 4375 return data === undefined ? 4376 this : 4377 this.each( function() { 4378 var queue = jQuery.queue( this, type, data ); 4379 4380 // Ensure a hooks for this queue 4381 jQuery._queueHooks( this, type ); 4382 4383 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 4384 jQuery.dequeue( this, type ); 4385 } 4386 } ); 4387 }, 4388 dequeue: function( type ) { 4389 return this.each( function() { 4390 jQuery.dequeue( this, type ); 4391 } ); 4392 }, 4393 clearQueue: function( type ) { 4394 return this.queue( type || "fx", [] ); 4395 }, 4396 4397 // Get a promise resolved when queues of a certain type 4398 // are emptied (fx is the type by default) 4399 promise: function( type, obj ) { 4400 var tmp, 4401 count = 1, 4402 defer = jQuery.Deferred(), 4403 elements = this, 4404 i = this.length, 4405 resolve = function() { 4406 if ( !( --count ) ) { 4407 defer.resolveWith( elements, [ elements ] ); 4408 } 4409 }; 4410 4411 if ( typeof type !== "string" ) { 4412 obj = type; 4413 type = undefined; 4414 } 4415 type = type || "fx"; 4416 4417 while ( i-- ) { 4418 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 4419 if ( tmp && tmp.empty ) { 4420 count++; 4421 tmp.empty.add( resolve ); 4422 } 4423 } 4424 resolve(); 4425 return defer.promise( obj ); 4426 } 4427} ); 4428var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 4429 4430var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 4431 4432 4433var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 4434 4435var documentElement = document.documentElement; 4436 4437 4438 4439 var isAttached = function( elem ) { 4440 return jQuery.contains( elem.ownerDocument, elem ); 4441 }, 4442 composed = { composed: true }; 4443 4444 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only 4445 // Check attachment across shadow DOM boundaries when possible (gh-3504) 4446 // Support: iOS 10.0-10.2 only 4447 // Early iOS 10 versions support `attachShadow` but not `getRootNode`, 4448 // leading to errors. We need to check for `getRootNode`. 4449 if ( documentElement.getRootNode ) { 4450 isAttached = function( elem ) { 4451 return jQuery.contains( elem.ownerDocument, elem ) || 4452 elem.getRootNode( composed ) === elem.ownerDocument; 4453 }; 4454 } 4455var isHiddenWithinTree = function( elem, el ) { 4456 4457 // isHiddenWithinTree might be called from jQuery#filter function; 4458 // in that case, element will be second argument 4459 elem = el || elem; 4460 4461 // Inline style trumps all 4462 return elem.style.display === "none" || 4463 elem.style.display === "" && 4464 4465 // Otherwise, check computed style 4466 // Support: Firefox <=43 - 45 4467 // Disconnected elements can have computed display: none, so first confirm that elem is 4468 // in the document. 4469 isAttached( elem ) && 4470 4471 jQuery.css( elem, "display" ) === "none"; 4472 }; 4473 4474 4475 4476function adjustCSS( elem, prop, valueParts, tween ) { 4477 var adjusted, scale, 4478 maxIterations = 20, 4479 currentValue = tween ? 4480 function() { 4481 return tween.cur(); 4482 } : 4483 function() { 4484 return jQuery.css( elem, prop, "" ); 4485 }, 4486 initial = currentValue(), 4487 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 4488 4489 // Starting value computation is required for potential unit mismatches 4490 initialInUnit = elem.nodeType && 4491 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 4492 rcssNum.exec( jQuery.css( elem, prop ) ); 4493 4494 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 4495 4496 // Support: Firefox <=54 4497 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 4498 initial = initial / 2; 4499 4500 // Trust units reported by jQuery.css 4501 unit = unit || initialInUnit[ 3 ]; 4502 4503 // Iteratively approximate from a nonzero starting point 4504 initialInUnit = +initial || 1; 4505 4506 while ( maxIterations-- ) { 4507 4508 // Evaluate and update our best guess (doubling guesses that zero out). 4509 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 4510 jQuery.style( elem, prop, initialInUnit + unit ); 4511 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 4512 maxIterations = 0; 4513 } 4514 initialInUnit = initialInUnit / scale; 4515 4516 } 4517 4518 initialInUnit = initialInUnit * 2; 4519 jQuery.style( elem, prop, initialInUnit + unit ); 4520 4521 // Make sure we update the tween properties later on 4522 valueParts = valueParts || []; 4523 } 4524 4525 if ( valueParts ) { 4526 initialInUnit = +initialInUnit || +initial || 0; 4527 4528 // Apply relative offset (+=/-=) if specified 4529 adjusted = valueParts[ 1 ] ? 4530 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 4531 +valueParts[ 2 ]; 4532 if ( tween ) { 4533 tween.unit = unit; 4534 tween.start = initialInUnit; 4535 tween.end = adjusted; 4536 } 4537 } 4538 return adjusted; 4539} 4540 4541 4542var defaultDisplayMap = {}; 4543 4544function getDefaultDisplay( elem ) { 4545 var temp, 4546 doc = elem.ownerDocument, 4547 nodeName = elem.nodeName, 4548 display = defaultDisplayMap[ nodeName ]; 4549 4550 if ( display ) {
vendor: 2,317 bytes, lines 4551-4649
4551 return display; 4552 } 4553 4554 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 4555 display = jQuery.css( temp, "display" ); 4556 4557 temp.parentNode.removeChild( temp ); 4558 4559 if ( display === "none" ) { 4560 display = "block"; 4561 } 4562 defaultDisplayMap[ nodeName ] = display; 4563 4564 return display; 4565} 4566 4567function showHide( elements, show ) { 4568 var display, elem, 4569 values = [], 4570 index = 0, 4571 length = elements.length; 4572 4573 // Determine new display value for elements that need to change 4574 for ( ; index < length; index++ ) { 4575 elem = elements[ index ]; 4576 if ( !elem.style ) { 4577 continue; 4578 } 4579 4580 display = elem.style.display; 4581 if ( show ) { 4582 4583 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 4584 // check is required in this first loop unless we have a nonempty display value (either 4585 // inline or about-to-be-restored) 4586 if ( display === "none" ) { 4587 values[ index ] = dataPriv.get( elem, "display" ) || null; 4588 if ( !values[ index ] ) { 4589 elem.style.display = ""; 4590 } 4591 } 4592 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 4593 values[ index ] = getDefaultDisplay( elem ); 4594 } 4595 } else { 4596 if ( display !== "none" ) { 4597 values[ index ] = "none"; 4598 4599 // Remember what we're overwriting 4600 dataPriv.set( elem, "display", display ); 4601 } 4602 } 4603 } 4604 4605 // Set the display of the elements in a second loop to avoid constant reflow 4606 for ( index = 0; index < length; index++ ) { 4607 if ( values[ index ] != null ) { 4608 elements[ index ].style.display = values[ index ]; 4609 } 4610 } 4611 4612 return elements; 4613} 4614 4615jQuery.fn.extend( { 4616 show: function() { 4617 return showHide( this, true ); 4618 }, 4619 hide: function() { 4620 return showHide( this ); 4621 }, 4622 toggle: function( state ) { 4623 if ( typeof state === "boolean" ) { 4624 return state ? this.show() : this.hide(); 4625 } 4626 4627 return this.each( function() { 4628 if ( isHiddenWithinTree( this ) ) { 4629 jQuery( this ).show(); 4630 } else { 4631 jQuery( this ).hide(); 4632 } 4633 } ); 4634 } 4635} ); 4636var rcheckableType = ( /^(?:checkbox|radio)$/i ); 4637 4638var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); 4639 4640var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 4641 4642 4643 4644( function() { 4645 var fragment = document.createDocumentFragment(), 4646 div = fragment.appendChild( document.createElement( "div" ) ), 4647 input = document.createElement( "input" ); 4648 4649 // Support: Android 4.0 - 4.3 only
vendor: 10,092 bytes, lines 4650-5034
4650 // Check state lost if the name is set (trac-11217) 4651 // Support: Windows Web Apps (WWA) 4652 // `name` and `type` must use .setAttribute for WWA (trac-14901) 4653 input.setAttribute( "type", "radio" ); 4654 input.setAttribute( "checked", "checked" ); 4655 input.setAttribute( "name", "t" ); 4656 4657 div.appendChild( input ); 4658 4659 // Support: Android <=4.1 only 4660 // Older WebKit doesn't clone checked state correctly in fragments 4661 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 4662 4663 // Support: IE <=11 only 4664 // Make sure textarea (and checkbox) defaultValue is properly cloned 4665 div.innerHTML = "<textarea>x</textarea>"; 4666 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 4667 4668 // Support: IE <=9 only 4669 // IE <=9 replaces <option> tags with their contents when inserted outside of 4670 // the select element. 4671 div.innerHTML = "<option></option>"; 4672 support.option = !!div.lastChild; 4673} )(); 4674 4675 4676// We have to close these tags to support XHTML (trac-13200) 4677var wrapMap = { 4678 4679 // XHTML parsers do not magically insert elements in the 4680 // same way that tag soup parsers do. So we cannot shorten 4681 // this by omitting <tbody> or other required elements. 4682 thead: [ 1, "<table>", "</table>" ], 4683 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 4684 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 4685 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 4686 4687 _default: [ 0, "", "" ] 4688}; 4689 4690wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 4691wrapMap.th = wrapMap.td; 4692 4693// Support: IE <=9 only 4694if ( !support.option ) { 4695 wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ]; 4696} 4697 4698 4699function getAll( context, tag ) { 4700 4701 // Support: IE <=9 - 11 only 4702 // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) 4703 var ret; 4704 4705 if ( typeof context.getElementsByTagName !== "undefined" ) { 4706 ret = context.getElementsByTagName( tag || "*" ); 4707 4708 } else if ( typeof context.querySelectorAll !== "undefined" ) { 4709 ret = context.querySelectorAll( tag || "*" ); 4710 4711 } else { 4712 ret = []; 4713 } 4714 4715 if ( tag === undefined || tag && nodeName( context, tag ) ) { 4716 return jQuery.merge( [ context ], ret ); 4717 } 4718 4719 return ret; 4720} 4721 4722 4723// Mark scripts as having already been evaluated 4724function setGlobalEval( elems, refElements ) { 4725 var i = 0, 4726 l = elems.length; 4727 4728 for ( ; i < l; i++ ) { 4729 dataPriv.set( 4730 elems[ i ], 4731 "globalEval", 4732 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 4733 ); 4734 } 4735} 4736 4737 4738var rhtml = /<|&#?\w+;/; 4739 4740function buildFragment( elems, context, scripts, selection, ignored ) { 4741 var elem, tmp, tag, wrap, attached, j, 4742 fragment = context.createDocumentFragment(), 4743 nodes = [], 4744 i = 0, 4745 l = elems.length; 4746 4747 for ( ; i < l; i++ ) { 4748 elem = elems[ i ]; 4749 4750 if ( elem || elem === 0 ) { 4751 4752 // Add nodes directly 4753 if ( toType( elem ) === "object" ) { 4754 4755 // Support: Android <=4.0 only, PhantomJS 1 only 4756 // push.apply(_, arraylike) throws on ancient WebKit 4757 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 4758 4759 // Convert non-html into a text node 4760 } else if ( !rhtml.test( elem ) ) { 4761 nodes.push( context.createTextNode( elem ) ); 4762 4763 // Convert html into DOM nodes 4764 } else { 4765 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 4766 4767 // Deserialize a standard representation 4768 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 4769 wrap = wrapMap[ tag ] || wrapMap._default; 4770 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 4771 4772 // Descend through wrappers to the right content 4773 j = wrap[ 0 ]; 4774 while ( j-- ) { 4775 tmp = tmp.lastChild; 4776 } 4777 4778 // Support: Android <=4.0 only, PhantomJS 1 only 4779 // push.apply(_, arraylike) throws on ancient WebKit 4780 jQuery.merge( nodes, tmp.childNodes ); 4781 4782 // Remember the top-level container 4783 tmp = fragment.firstChild; 4784 4785 // Ensure the created nodes are orphaned (trac-12392) 4786 tmp.textContent = ""; 4787 } 4788 } 4789 } 4790 4791 // Remove wrapper from fragment 4792 fragment.textContent = ""; 4793 4794 i = 0; 4795 while ( ( elem = nodes[ i++ ] ) ) { 4796 4797 // Skip elements already in the context collection (trac-4087) 4798 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 4799 if ( ignored ) { 4800 ignored.push( elem ); 4801 } 4802 continue; 4803 } 4804 4805 attached = isAttached( elem ); 4806 4807 // Append to fragment 4808 tmp = getAll( fragment.appendChild( elem ), "script" ); 4809 4810 // Preserve script evaluation history 4811 if ( attached ) { 4812 setGlobalEval( tmp ); 4813 } 4814 4815 // Capture executables 4816 if ( scripts ) { 4817 j = 0; 4818 while ( ( elem = tmp[ j++ ] ) ) { 4819 if ( rscriptType.test( elem.type || "" ) ) { 4820 scripts.push( elem ); 4821 } 4822 } 4823 } 4824 } 4825 4826 return fragment; 4827} 4828 4829 4830var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 4831 4832function returnTrue() { 4833 return true; 4834} 4835 4836function returnFalse() { 4837 return false; 4838} 4839 4840function on( elem, types, selector, data, fn, one ) { 4841 var origFn, type; 4842 4843 // Types can be a map of types/handlers 4844 if ( typeof types === "object" ) { 4845 4846 // ( types-Object, selector, data ) 4847 if ( typeof selector !== "string" ) { 4848 4849 // ( types-Object, data ) 4850 data = data || selector; 4851 selector = undefined; 4852 } 4853 for ( type in types ) { 4854 on( elem, type, selector, data, types[ type ], one ); 4855 } 4856 return elem; 4857 } 4858 4859 if ( data == null && fn == null ) { 4860 4861 // ( types, fn ) 4862 fn = selector; 4863 data = selector = undefined; 4864 } else if ( fn == null ) { 4865 if ( typeof selector === "string" ) { 4866 4867 // ( types, selector, fn ) 4868 fn = data; 4869 data = undefined; 4870 } else { 4871 4872 // ( types, data, fn ) 4873 fn = data; 4874 data = selector; 4875 selector = undefined; 4876 } 4877 } 4878 if ( fn === false ) { 4879 fn = returnFalse; 4880 } else if ( !fn ) { 4881 return elem; 4882 } 4883 4884 if ( one === 1 ) { 4885 origFn = fn; 4886 fn = function( event ) { 4887 4888 // Can use an empty set, since event contains the info 4889 jQuery().off( event ); 4890 return origFn.apply( this, arguments ); 4891 }; 4892 4893 // Use same guid so caller can remove using origFn 4894 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 4895 } 4896 return elem.each( function() { 4897 jQuery.event.add( this, types, fn, data, selector ); 4898 } ); 4899} 4900 4901/* 4902 * Helper functions for managing events -- not part of the public interface. 4903 * Props to Dean Edwards' addEvent library for many of the ideas. 4904 */ 4905jQuery.event = { 4906 4907 global: {}, 4908 4909 add: function( elem, types, handler, data, selector ) { 4910 4911 var handleObjIn, eventHandle, tmp, 4912 events, t, handleObj, 4913 special, handlers, type, namespaces, origType, 4914 elemData = dataPriv.get( elem ); 4915 4916 // Only attach events to objects that accept data 4917 if ( !acceptData( elem ) ) { 4918 return; 4919 } 4920 4921 // Caller can pass in an object of custom data in lieu of the handler 4922 if ( handler.handler ) { 4923 handleObjIn = handler; 4924 handler = handleObjIn.handler; 4925 selector = handleObjIn.selector; 4926 } 4927 4928 // Ensure that invalid selectors throw exceptions at attach time 4929 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 4930 if ( selector ) { 4931 jQuery.find.matchesSelector( documentElement, selector ); 4932 } 4933 4934 // Make sure that the handler has a unique ID, used to find/remove it later 4935 if ( !handler.guid ) { 4936 handler.guid = jQuery.guid++; 4937 } 4938 4939 // Init the element's event structure and main handler, if this is the first 4940 if ( !( events = elemData.events ) ) { 4941 events = elemData.events = Object.create( null ); 4942 } 4943 if ( !( eventHandle = elemData.handle ) ) { 4944 eventHandle = elemData.handle = function( e ) { 4945 4946 // Discard the second event of a jQuery.event.trigger() and 4947 // when an event is called after a page has unloaded 4948 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 4949 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 4950 }; 4951 } 4952 4953 // Handle multiple events separated by a space 4954 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 4955 t = types.length; 4956 while ( t-- ) { 4957 tmp = rtypenamespace.exec( types[ t ] ) || []; 4958 type = origType = tmp[ 1 ]; 4959 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 4960 4961 // There *must* be a type, no attaching namespace-only handlers 4962 if ( !type ) { 4963 continue; 4964 } 4965 4966 // If event changes its type, use the special event handlers for the changed type 4967 special = jQuery.event.special[ type ] || {}; 4968 4969 // If selector defined, determine special event api type, otherwise given type 4970 type = ( selector ? special.delegateType : special.bindType ) || type; 4971 4972 // Update special based on newly reset type 4973 special = jQuery.event.special[ type ] || {}; 4974 4975 // handleObj is passed to all event handlers 4976 handleObj = jQuery.extend( { 4977 type: type, 4978 origType: origType, 4979 data: data, 4980 handler: handler, 4981 guid: handler.guid, 4982 selector: selector, 4983 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 4984 namespace: namespaces.join( "." ) 4985 }, handleObjIn ); 4986 4987 // Init the event handler queue if we're the first 4988 if ( !( handlers = events[ type ] ) ) { 4989 handlers = events[ type ] = []; 4990 handlers.delegateCount = 0; 4991 4992 // Only use addEventListener if the special events handler returns false 4993 if ( !special.setup || 4994 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 4995 4996 if ( elem.addEventListener ) { 4997 elem.addEventListener( type, eventHandle ); 4998 } 4999 } 5000 } 5001 5002 if ( special.add ) { 5003 special.add.call( elem, handleObj ); 5004 5005 if ( !handleObj.handler.guid ) { 5006 handleObj.handler.guid = handler.guid; 5007 } 5008 } 5009 5010 // Add to the element's handler list, delegates in front 5011 if ( selector ) { 5012 handlers.splice( handlers.delegateCount++, 0, handleObj ); 5013 } else { 5014 handlers.push( handleObj ); 5015 } 5016 5017 // Keep track of which events have ever been used, for event optimization 5018 jQuery.event.global[ type ] = true; 5019 } 5020 5021 }, 5022 5023 // Detach an event or set of events from an element 5024 remove: function( elem, types, handler, selector, mappedTypes ) { 5025 5026 var j, origCount, tmp, 5027 events, t, handleObj, 5028 special, handlers, type, namespaces, origType, 5029 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 5030 5031 if ( !elemData || !( events = elemData.events ) ) { 5032 return; 5033 } 5034
vendor: 4,197 bytes, lines 5035-5173
5035 // Once for each type.namespace in types; type may be omitted 5036 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 5037 t = types.length; 5038 while ( t-- ) { 5039 tmp = rtypenamespace.exec( types[ t ] ) || []; 5040 type = origType = tmp[ 1 ]; 5041 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5042 5043 // Unbind all events (on this namespace, if provided) for the element 5044 if ( !type ) { 5045 for ( type in events ) { 5046 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 5047 } 5048 continue; 5049 } 5050 5051 special = jQuery.event.special[ type ] || {}; 5052 type = ( selector ? special.delegateType : special.bindType ) || type; 5053 handlers = events[ type ] || []; 5054 tmp = tmp[ 2 ] && 5055 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 5056 5057 // Remove matching events 5058 origCount = j = handlers.length; 5059 while ( j-- ) { 5060 handleObj = handlers[ j ]; 5061 5062 if ( ( mappedTypes || origType === handleObj.origType ) && 5063 ( !handler || handler.guid === handleObj.guid ) && 5064 ( !tmp || tmp.test( handleObj.namespace ) ) && 5065 ( !selector || selector === handleObj.selector || 5066 selector === "**" && handleObj.selector ) ) { 5067 handlers.splice( j, 1 ); 5068 5069 if ( handleObj.selector ) { 5070 handlers.delegateCount--; 5071 } 5072 if ( special.remove ) { 5073 special.remove.call( elem, handleObj ); 5074 } 5075 } 5076 } 5077 5078 // Remove generic event handler if we removed something and no more handlers exist 5079 // (avoids potential for endless recursion during removal of special event handlers) 5080 if ( origCount && !handlers.length ) { 5081 if ( !special.teardown || 5082 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 5083 5084 jQuery.removeEvent( elem, type, elemData.handle ); 5085 } 5086 5087 delete events[ type ]; 5088 } 5089 } 5090 5091 // Remove data and the expando if it's no longer used 5092 if ( jQuery.isEmptyObject( events ) ) { 5093 dataPriv.remove( elem, "handle events" ); 5094 } 5095 }, 5096 5097 dispatch: function( nativeEvent ) { 5098 5099 var i, j, ret, matched, handleObj, handlerQueue, 5100 args = new Array( arguments.length ), 5101 5102 // Make a writable jQuery.Event from the native event object 5103 event = jQuery.event.fix( nativeEvent ), 5104 5105 handlers = ( 5106 dataPriv.get( this, "events" ) || Object.create( null ) 5107 )[ event.type ] || [], 5108 special = jQuery.event.special[ event.type ] || {}; 5109 5110 // Use the fix-ed jQuery.Event rather than the (read-only) native event 5111 args[ 0 ] = event; 5112 5113 for ( i = 1; i < arguments.length; i++ ) { 5114 args[ i ] = arguments[ i ]; 5115 } 5116 5117 event.delegateTarget = this; 5118 5119 // Call the preDispatch hook for the mapped type, and let it bail if desired 5120 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 5121 return; 5122 } 5123 5124 // Determine handlers 5125 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 5126 5127 // Run delegates first; they may want to stop propagation beneath us 5128 i = 0; 5129 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 5130 event.currentTarget = matched.elem; 5131 5132 j = 0; 5133 while ( ( handleObj = matched.handlers[ j++ ] ) && 5134 !event.isImmediatePropagationStopped() ) { 5135 5136 // If the event is namespaced, then each handler is only invoked if it is 5137 // specially universal or its namespaces are a superset of the event's. 5138 if ( !event.rnamespace || handleObj.namespace === false || 5139 event.rnamespace.test( handleObj.namespace ) ) { 5140 5141 event.handleObj = handleObj; 5142 event.data = handleObj.data; 5143 5144 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 5145 handleObj.handler ).apply( matched.elem, args ); 5146 5147 if ( ret !== undefined ) { 5148 if ( ( event.result = ret ) === false ) { 5149 event.preventDefault(); 5150 event.stopPropagation(); 5151 } 5152 } 5153 } 5154 } 5155 } 5156 5157 // Call the postDispatch hook for the mapped type 5158 if ( special.postDispatch ) { 5159 special.postDispatch.call( this, event ); 5160 } 5161 5162 return event.result; 5163 }, 5164 5165 handlers: function( event, handlers ) { 5166 var i, handleObj, sel, matchedHandlers, matchedSelectors, 5167 handlerQueue = [], 5168 delegateCount = handlers.delegateCount, 5169 cur = event.target; 5170 5171 // Find delegate handlers 5172 if ( delegateCount && 5173
vendor: 19,034 bytes, lines 5174-5820
5174 // Support: IE <=9 5175 // Black-hole SVG <use> instance trees (trac-13180) 5176 cur.nodeType && 5177 5178 // Support: Firefox <=42 5179 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 5180 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 5181 // Support: IE 11 only 5182 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 5183 !( event.type === "click" && event.button >= 1 ) ) { 5184 5185 for ( ; cur !== this; cur = cur.parentNode || this ) { 5186 5187 // Don't check non-elements (trac-13208) 5188 // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764) 5189 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 5190 matchedHandlers = []; 5191 matchedSelectors = {}; 5192 for ( i = 0; i < delegateCount; i++ ) { 5193 handleObj = handlers[ i ]; 5194 5195 // Don't conflict with Object.prototype properties (trac-13203) 5196 sel = handleObj.selector + " "; 5197 5198 if ( matchedSelectors[ sel ] === undefined ) { 5199 matchedSelectors[ sel ] = handleObj.needsContext ? 5200 jQuery( sel, this ).index( cur ) > -1 : 5201 jQuery.find( sel, this, null, [ cur ] ).length; 5202 } 5203 if ( matchedSelectors[ sel ] ) { 5204 matchedHandlers.push( handleObj ); 5205 } 5206 } 5207 if ( matchedHandlers.length ) { 5208 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 5209 } 5210 } 5211 } 5212 } 5213 5214 // Add the remaining (directly-bound) handlers 5215 cur = this; 5216 if ( delegateCount < handlers.length ) { 5217 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 5218 } 5219 5220 return handlerQueue; 5221 }, 5222 5223 addProp: function( name, hook ) { 5224 Object.defineProperty( jQuery.Event.prototype, name, { 5225 enumerable: true, 5226 configurable: true, 5227 5228 get: isFunction( hook ) ? 5229 function() { 5230 if ( this.originalEvent ) { 5231 return hook( this.originalEvent ); 5232 } 5233 } : 5234 function() { 5235 if ( this.originalEvent ) { 5236 return this.originalEvent[ name ]; 5237 } 5238 }, 5239 5240 set: function( value ) { 5241 Object.defineProperty( this, name, { 5242 enumerable: true, 5243 configurable: true, 5244 writable: true, 5245 value: value 5246 } ); 5247 } 5248 } ); 5249 }, 5250 5251 fix: function( originalEvent ) { 5252 return originalEvent[ jQuery.expando ] ? 5253 originalEvent : 5254 new jQuery.Event( originalEvent ); 5255 }, 5256 5257 special: { 5258 load: { 5259 5260 // Prevent triggered image.load events from bubbling to window.load 5261 noBubble: true 5262 }, 5263 click: { 5264 5265 // Utilize native event to ensure correct state for checkable inputs 5266 setup: function( data ) { 5267 5268 // For mutual compressibility with _default, replace `this` access with a local var. 5269 // `|| data` is dead code meant only to preserve the variable through minification. 5270 var el = this || data; 5271 5272 // Claim the first handler 5273 if ( rcheckableType.test( el.type ) && 5274 el.click && nodeName( el, "input" ) ) { 5275 5276 // dataPriv.set( el, "click", ... ) 5277 leverageNative( el, "click", true ); 5278 } 5279 5280 // Return false to allow normal processing in the caller 5281 return false; 5282 }, 5283 trigger: function( data ) { 5284 5285 // For mutual compressibility with _default, replace `this` access with a local var. 5286 // `|| data` is dead code meant only to preserve the variable through minification. 5287 var el = this || data; 5288 5289 // Force setup before triggering a click 5290 if ( rcheckableType.test( el.type ) && 5291 el.click && nodeName( el, "input" ) ) { 5292 5293 leverageNative( el, "click" ); 5294 } 5295 5296 // Return non-false to allow normal event-path propagation 5297 return true; 5298 }, 5299 5300 // For cross-browser consistency, suppress native .click() on links 5301 // Also prevent it if we're currently inside a leveraged native-event stack 5302 _default: function( event ) { 5303 var target = event.target; 5304 return rcheckableType.test( target.type ) && 5305 target.click && nodeName( target, "input" ) && 5306 dataPriv.get( target, "click" ) || 5307 nodeName( target, "a" ); 5308 } 5309 }, 5310 5311 beforeunload: { 5312 postDispatch: function( event ) { 5313 5314 // Support: Firefox 20+ 5315 // Firefox doesn't alert if the returnValue field is not set. 5316 if ( event.result !== undefined && event.originalEvent ) { 5317 event.originalEvent.returnValue = event.result; 5318 } 5319 } 5320 } 5321 } 5322}; 5323 5324// Ensure the presence of an event listener that handles manually-triggered 5325// synthetic events by interrupting progress until reinvoked in response to 5326// *native* events that it fires directly, ensuring that state changes have 5327// already occurred before other listeners are invoked. 5328function leverageNative( el, type, isSetup ) { 5329 5330 // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add 5331 if ( !isSetup ) { 5332 if ( dataPriv.get( el, type ) === undefined ) { 5333 jQuery.event.add( el, type, returnTrue ); 5334 } 5335 return; 5336 } 5337 5338 // Register the controller as a special universal handler for all event namespaces 5339 dataPriv.set( el, type, false ); 5340 jQuery.event.add( el, type, { 5341 namespace: false, 5342 handler: function( event ) { 5343 var result, 5344 saved = dataPriv.get( this, type ); 5345 5346 if ( ( event.isTrigger & 1 ) && this[ type ] ) { 5347 5348 // Interrupt processing of the outer synthetic .trigger()ed event 5349 if ( !saved ) { 5350 5351 // Store arguments for use when handling the inner native event 5352 // There will always be at least one argument (an event object), so this array 5353 // will not be confused with a leftover capture object. 5354 saved = slice.call( arguments ); 5355 dataPriv.set( this, type, saved ); 5356 5357 // Trigger the native event and capture its result 5358 this[ type ](); 5359 result = dataPriv.get( this, type ); 5360 dataPriv.set( this, type, false ); 5361 5362 if ( saved !== result ) { 5363 5364 // Cancel the outer synthetic event 5365 event.stopImmediatePropagation(); 5366 event.preventDefault(); 5367 5368 return result; 5369 } 5370 5371 // If this is an inner synthetic event for an event with a bubbling surrogate 5372 // (focus or blur), assume that the surrogate already propagated from triggering 5373 // the native event and prevent that from happening again here. 5374 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 5375 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 5376 // less bad than duplication. 5377 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { 5378 event.stopPropagation(); 5379 } 5380 5381 // If this is a native event triggered above, everything is now in order 5382 // Fire an inner synthetic event with the original arguments 5383 } else if ( saved ) { 5384 5385 // ...and capture the result 5386 dataPriv.set( this, type, jQuery.event.trigger( 5387 saved[ 0 ], 5388 saved.slice( 1 ), 5389 this 5390 ) ); 5391 5392 // Abort handling of the native event by all jQuery handlers while allowing 5393 // native handlers on the same element to run. On target, this is achieved 5394 // by stopping immediate propagation just on the jQuery event. However, 5395 // the native event is re-wrapped by a jQuery one on each level of the 5396 // propagation so the only way to stop it for jQuery is to stop it for 5397 // everyone via native `stopPropagation()`. This is not a problem for 5398 // focus/blur which don't bubble, but it does also stop click on checkboxes 5399 // and radios. We accept this limitation. 5400 event.stopPropagation(); 5401 event.isImmediatePropagationStopped = returnTrue; 5402 } 5403 } 5404 } ); 5405} 5406 5407jQuery.removeEvent = function( elem, type, handle ) { 5408 5409 // This "if" is needed for plain objects 5410 if ( elem.removeEventListener ) { 5411 elem.removeEventListener( type, handle ); 5412 } 5413}; 5414 5415jQuery.Event = function( src, props ) { 5416 5417 // Allow instantiation without the 'new' keyword 5418 if ( !( this instanceof jQuery.Event ) ) { 5419 return new jQuery.Event( src, props ); 5420 } 5421 5422 // Event object 5423 if ( src && src.type ) { 5424 this.originalEvent = src; 5425 this.type = src.type; 5426 5427 // Events bubbling up the document may have been marked as prevented 5428 // by a handler lower down the tree; reflect the correct value. 5429 this.isDefaultPrevented = src.defaultPrevented || 5430 src.defaultPrevented === undefined && 5431 5432 // Support: Android <=2.3 only 5433 src.returnValue === false ? 5434 returnTrue : 5435 returnFalse; 5436 5437 // Create target properties 5438 // Support: Safari <=6 - 7 only 5439 // Target should not be a text node (trac-504, trac-13143) 5440 this.target = ( src.target && src.target.nodeType === 3 ) ? 5441 src.target.parentNode : 5442 src.target; 5443 5444 this.currentTarget = src.currentTarget; 5445 this.relatedTarget = src.relatedTarget; 5446 5447 // Event type 5448 } else { 5449 this.type = src; 5450 } 5451 5452 // Put explicitly provided properties onto the event object 5453 if ( props ) { 5454 jQuery.extend( this, props ); 5455 } 5456 5457 // Create a timestamp if incoming event doesn't have one 5458 this.timeStamp = src && src.timeStamp || Date.now(); 5459 5460 // Mark it as fixed 5461 this[ jQuery.expando ] = true; 5462}; 5463 5464// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 5465// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 5466jQuery.Event.prototype = { 5467 constructor: jQuery.Event, 5468 isDefaultPrevented: returnFalse, 5469 isPropagationStopped: returnFalse, 5470 isImmediatePropagationStopped: returnFalse, 5471 isSimulated: false, 5472 5473 preventDefault: function() { 5474 var e = this.originalEvent; 5475 5476 this.isDefaultPrevented = returnTrue; 5477 5478 if ( e && !this.isSimulated ) { 5479 e.preventDefault(); 5480 } 5481 }, 5482 stopPropagation: function() { 5483 var e = this.originalEvent; 5484 5485 this.isPropagationStopped = returnTrue; 5486 5487 if ( e && !this.isSimulated ) { 5488 e.stopPropagation(); 5489 } 5490 }, 5491 stopImmediatePropagation: function() { 5492 var e = this.originalEvent; 5493 5494 this.isImmediatePropagationStopped = returnTrue; 5495 5496 if ( e && !this.isSimulated ) { 5497 e.stopImmediatePropagation(); 5498 } 5499 5500 this.stopPropagation(); 5501 } 5502}; 5503 5504// Includes all common event props including KeyEvent and MouseEvent specific props 5505jQuery.each( { 5506 altKey: true, 5507 bubbles: true, 5508 cancelable: true, 5509 changedTouches: true, 5510 ctrlKey: true, 5511 detail: true, 5512 eventPhase: true, 5513 metaKey: true, 5514 pageX: true, 5515 pageY: true, 5516 shiftKey: true, 5517 view: true, 5518 "char": true, 5519 code: true, 5520 charCode: true, 5521 key: true, 5522 keyCode: true, 5523 button: true, 5524 buttons: true, 5525 clientX: true, 5526 clientY: true, 5527 offsetX: true, 5528 offsetY: true, 5529 pointerId: true, 5530 pointerType: true, 5531 screenX: true, 5532 screenY: true, 5533 targetTouches: true, 5534 toElement: true, 5535 touches: true, 5536 which: true 5537}, jQuery.event.addProp ); 5538 5539jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { 5540 5541 function focusMappedHandler( nativeEvent ) { 5542 if ( document.documentMode ) { 5543 5544 // Support: IE 11+ 5545 // Attach a single focusin/focusout handler on the document while someone wants 5546 // focus/blur. This is because the former are synchronous in IE while the latter 5547 // are async. In other browsers, all those handlers are invoked synchronously. 5548 5549 // `handle` from private data would already wrap the event, but we need 5550 // to change the `type` here. 5551 var handle = dataPriv.get( this, "handle" ), 5552 event = jQuery.event.fix( nativeEvent ); 5553 event.type = nativeEvent.type === "focusin" ? "focus" : "blur"; 5554 event.isSimulated = true; 5555 5556 // First, handle focusin/focusout 5557 handle( nativeEvent ); 5558 5559 // ...then, handle focus/blur 5560 // 5561 // focus/blur don't bubble while focusin/focusout do; simulate the former by only 5562 // invoking the handler at the lower level. 5563 if ( event.target === event.currentTarget ) { 5564 5565 // The setup part calls `leverageNative`, which, in turn, calls 5566 // `jQuery.event.add`, so event handle will already have been set 5567 // by this point. 5568 handle( event ); 5569 } 5570 } else { 5571 5572 // For non-IE browsers, attach a single capturing handler on the document 5573 // while someone wants focusin/focusout. 5574 jQuery.event.simulate( delegateType, nativeEvent.target, 5575 jQuery.event.fix( nativeEvent ) ); 5576 } 5577 } 5578 5579 jQuery.event.special[ type ] = { 5580 5581 // Utilize native event if possible so blur/focus sequence is correct 5582 setup: function() { 5583 5584 var attaches; 5585 5586 // Claim the first handler 5587 // dataPriv.set( this, "focus", ... ) 5588 // dataPriv.set( this, "blur", ... ) 5589 leverageNative( this, type, true ); 5590 5591 if ( document.documentMode ) { 5592 5593 // Support: IE 9 - 11+ 5594 // We use the same native handler for focusin & focus (and focusout & blur) 5595 // so we need to coordinate setup & teardown parts between those events. 5596 // Use `delegateType` as the key as `type` is already used by `leverageNative`. 5597 attaches = dataPriv.get( this, delegateType ); 5598 if ( !attaches ) { 5599 this.addEventListener( delegateType, focusMappedHandler ); 5600 } 5601 dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 ); 5602 } else { 5603 5604 // Return false to allow normal processing in the caller 5605 return false; 5606 } 5607 }, 5608 trigger: function() { 5609 5610 // Force setup before trigger 5611 leverageNative( this, type ); 5612 5613 // Return non-false to allow normal event-path propagation 5614 return true; 5615 }, 5616 5617 teardown: function() { 5618 var attaches; 5619 5620 if ( document.documentMode ) { 5621 attaches = dataPriv.get( this, delegateType ) - 1; 5622 if ( !attaches ) { 5623 this.removeEventListener( delegateType, focusMappedHandler ); 5624 dataPriv.remove( this, delegateType ); 5625 } else { 5626 dataPriv.set( this, delegateType, attaches ); 5627 } 5628 } else { 5629 5630 // Return false to indicate standard teardown should be applied 5631 return false; 5632 } 5633 }, 5634 5635 // Suppress native focus or blur if we're currently inside 5636 // a leveraged native-event stack 5637 _default: function( event ) { 5638 return dataPriv.get( event.target, type ); 5639 }, 5640 5641 delegateType: delegateType 5642 }; 5643 5644 // Support: Firefox <=44 5645 // Firefox doesn't have focus(in | out) events 5646 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 5647 // 5648 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 5649 // focus(in | out) events fire after focus & blur events, 5650 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 5651 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 5652 // 5653 // Support: IE 9 - 11+ 5654 // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch, 5655 // attach a single handler for both events in IE. 5656 jQuery.event.special[ delegateType ] = { 5657 setup: function() { 5658 5659 // Handle: regular nodes (via `this.ownerDocument`), window 5660 // (via `this.document`) & document (via `this`). 5661 var doc = this.ownerDocument || this.document || this, 5662 dataHolder = document.documentMode ? this : doc, 5663 attaches = dataPriv.get( dataHolder, delegateType ); 5664 5665 // Support: IE 9 - 11+ 5666 // We use the same native handler for focusin & focus (and focusout & blur) 5667 // so we need to coordinate setup & teardown parts between those events. 5668 // Use `delegateType` as the key as `type` is already used by `leverageNative`. 5669 if ( !attaches ) { 5670 if ( document.documentMode ) { 5671 this.addEventListener( delegateType, focusMappedHandler ); 5672 } else { 5673 doc.addEventListener( type, focusMappedHandler, true ); 5674 } 5675 } 5676 dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 ); 5677 }, 5678 teardown: function() { 5679 var doc = this.ownerDocument || this.document || this, 5680 dataHolder = document.documentMode ? this : doc, 5681 attaches = dataPriv.get( dataHolder, delegateType ) - 1; 5682 5683 if ( !attaches ) { 5684 if ( document.documentMode ) { 5685 this.removeEventListener( delegateType, focusMappedHandler ); 5686 } else { 5687 doc.removeEventListener( type, focusMappedHandler, true ); 5688 } 5689 dataPriv.remove( dataHolder, delegateType ); 5690 } else { 5691 dataPriv.set( dataHolder, delegateType, attaches ); 5692 } 5693 } 5694 }; 5695} ); 5696 5697// Create mouseenter/leave events using mouseover/out and event-time checks 5698// so that event delegation works in jQuery. 5699// Do the same for pointerenter/pointerleave and pointerover/pointerout 5700// 5701// Support: Safari 7 only 5702// Safari sends mouseenter too often; see: 5703// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 5704// for the description of the bug (it existed in older Chrome versions as well). 5705jQuery.each( { 5706 mouseenter: "mouseover", 5707 mouseleave: "mouseout", 5708 pointerenter: "pointerover", 5709 pointerleave: "pointerout" 5710}, function( orig, fix ) { 5711 jQuery.event.special[ orig ] = { 5712 delegateType: fix, 5713 bindType: fix, 5714 5715 handle: function( event ) { 5716 var ret, 5717 target = this, 5718 related = event.relatedTarget, 5719 handleObj = event.handleObj; 5720 5721 // For mouseenter/leave call the handler if related is outside the target. 5722 // NB: No relatedTarget if the mouse left/entered the browser window 5723 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 5724 event.type = handleObj.origType; 5725 ret = handleObj.handler.apply( this, arguments ); 5726 event.type = fix; 5727 } 5728 return ret; 5729 } 5730 }; 5731} ); 5732 5733jQuery.fn.extend( { 5734 5735 on: function( types, selector, data, fn ) { 5736 return on( this, types, selector, data, fn ); 5737 }, 5738 one: function( types, selector, data, fn ) { 5739 return on( this, types, selector, data, fn, 1 ); 5740 }, 5741 off: function( types, selector, fn ) { 5742 var handleObj, type; 5743 if ( types && types.preventDefault && types.handleObj ) { 5744 5745 // ( event ) dispatched jQuery.Event 5746 handleObj = types.handleObj; 5747 jQuery( types.delegateTarget ).off( 5748 handleObj.namespace ? 5749 handleObj.origType + "." + handleObj.namespace : 5750 handleObj.origType, 5751 handleObj.selector, 5752 handleObj.handler 5753 ); 5754 return this; 5755 } 5756 if ( typeof types === "object" ) { 5757 5758 // ( types-object [, selector] ) 5759 for ( type in types ) { 5760 this.off( type, selector, types[ type ] ); 5761 } 5762 return this; 5763 } 5764 if ( selector === false || typeof selector === "function" ) { 5765 5766 // ( types [, fn] ) 5767 fn = selector; 5768 selector = undefined; 5769 } 5770 if ( fn === false ) { 5771 fn = returnFalse; 5772 } 5773 return this.each( function() { 5774 jQuery.event.remove( this, types, fn, selector ); 5775 } ); 5776 } 5777} ); 5778 5779 5780var 5781 5782 // Support: IE <=10 - 11, Edge 12 - 13 only 5783 // In IE/Edge using regex groups here causes severe slowdowns. 5784 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 5785 rnoInnerhtml = /<script|<style|<link/i, 5786 5787 // checked="checked" or checked 5788 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 5789 5790 rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g; 5791 5792// Prefer a tbody over its parent table for containing new rows 5793function manipulationTarget( elem, content ) { 5794 if ( nodeName( elem, "table" ) && 5795 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 5796 5797 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 5798 } 5799 5800 return elem; 5801} 5802 5803// Replace/restore the type attribute of script elements for safe DOM manipulation 5804function disableScript( elem ) { 5805 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 5806 return elem; 5807} 5808function restoreScript( elem ) { 5809 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 5810 elem.type = elem.type.slice( 5 ); 5811 } else { 5812 elem.removeAttribute( "type" ); 5813 } 5814 5815 return elem; 5816} 5817 5818function cloneCopyEvent( src, dest ) { 5819 var i, l, type, pdataOld, udataOld, udataCur, events; 5820
vendor: 6,382 bytes, lines 5821-6050
5821 if ( dest.nodeType !== 1 ) { 5822 return; 5823 } 5824 5825 // 1. Copy private data: events, handlers, etc. 5826 if ( dataPriv.hasData( src ) ) { 5827 pdataOld = dataPriv.get( src ); 5828 events = pdataOld.events; 5829 5830 if ( events ) { 5831 dataPriv.remove( dest, "handle events" ); 5832 5833 for ( type in events ) { 5834 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 5835 jQuery.event.add( dest, type, events[ type ][ i ] ); 5836 } 5837 } 5838 } 5839 } 5840 5841 // 2. Copy user data 5842 if ( dataUser.hasData( src ) ) { 5843 udataOld = dataUser.access( src ); 5844 udataCur = jQuery.extend( {}, udataOld ); 5845 5846 dataUser.set( dest, udataCur ); 5847 } 5848} 5849 5850// Fix IE bugs, see support tests 5851function fixInput( src, dest ) { 5852 var nodeName = dest.nodeName.toLowerCase(); 5853 5854 // Fails to persist the checked state of a cloned checkbox or radio button. 5855 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 5856 dest.checked = src.checked; 5857 5858 // Fails to return the selected option to the default selected state when cloning options 5859 } else if ( nodeName === "input" || nodeName === "textarea" ) { 5860 dest.defaultValue = src.defaultValue; 5861 } 5862} 5863 5864function domManip( collection, args, callback, ignored ) { 5865 5866 // Flatten any nested arrays 5867 args = flat( args ); 5868 5869 var fragment, first, scripts, hasScripts, node, doc, 5870 i = 0, 5871 l = collection.length, 5872 iNoClone = l - 1, 5873 value = args[ 0 ], 5874 valueIsFunction = isFunction( value ); 5875 5876 // We can't cloneNode fragments that contain checked, in WebKit 5877 if ( valueIsFunction || 5878 ( l > 1 && typeof value === "string" && 5879 !support.checkClone && rchecked.test( value ) ) ) { 5880 return collection.each( function( index ) { 5881 var self = collection.eq( index ); 5882 if ( valueIsFunction ) { 5883 args[ 0 ] = value.call( this, index, self.html() ); 5884 } 5885 domManip( self, args, callback, ignored ); 5886 } ); 5887 } 5888 5889 if ( l ) { 5890 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 5891 first = fragment.firstChild; 5892 5893 if ( fragment.childNodes.length === 1 ) { 5894 fragment = first; 5895 } 5896 5897 // Require either new content or an interest in ignored elements to invoke the callback 5898 if ( first || ignored ) { 5899 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 5900 hasScripts = scripts.length; 5901 5902 // Use the original fragment for the last item 5903 // instead of the first because it can end up 5904 // being emptied incorrectly in certain situations (trac-8070). 5905 for ( ; i < l; i++ ) { 5906 node = fragment; 5907 5908 if ( i !== iNoClone ) { 5909 node = jQuery.clone( node, true, true ); 5910 5911 // Keep references to cloned scripts for later restoration 5912 if ( hasScripts ) { 5913 5914 // Support: Android <=4.0 only, PhantomJS 1 only 5915 // push.apply(_, arraylike) throws on ancient WebKit 5916 jQuery.merge( scripts, getAll( node, "script" ) ); 5917 } 5918 } 5919 5920 callback.call( collection[ i ], node, i ); 5921 } 5922 5923 if ( hasScripts ) { 5924 doc = scripts[ scripts.length - 1 ].ownerDocument; 5925 5926 // Re-enable scripts 5927 jQuery.map( scripts, restoreScript ); 5928 5929 // Evaluate executable scripts on first document insertion 5930 for ( i = 0; i < hasScripts; i++ ) { 5931 node = scripts[ i ]; 5932 if ( rscriptType.test( node.type || "" ) && 5933 !dataPriv.access( node, "globalEval" ) && 5934 jQuery.contains( doc, node ) ) { 5935 5936 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 5937 5938 // Optional AJAX dependency, but won't run scripts if not present 5939 if ( jQuery._evalUrl && !node.noModule ) { 5940 jQuery._evalUrl( node.src, { 5941 nonce: node.nonce || node.getAttribute( "nonce" ) 5942 }, doc ); 5943 } 5944 } else { 5945 5946 // Unwrap a CDATA section containing script contents. This shouldn't be 5947 // needed as in XML documents they're already not visible when 5948 // inspecting element contents and in HTML documents they have no 5949 // meaning but we're preserving that logic for backwards compatibility. 5950 // This will be removed completely in 4.0. See gh-4904. 5951 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); 5952 } 5953 } 5954 } 5955 } 5956 } 5957 } 5958 5959 return collection; 5960} 5961 5962function remove( elem, selector, keepData ) { 5963 var node, 5964 nodes = selector ? jQuery.filter( selector, elem ) : elem, 5965 i = 0; 5966 5967 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 5968 if ( !keepData && node.nodeType === 1 ) { 5969 jQuery.cleanData( getAll( node ) ); 5970 } 5971 5972 if ( node.parentNode ) { 5973 if ( keepData && isAttached( node ) ) { 5974 setGlobalEval( getAll( node, "script" ) ); 5975 } 5976 node.parentNode.removeChild( node ); 5977 } 5978 } 5979 5980 return elem; 5981} 5982 5983jQuery.extend( { 5984 htmlPrefilter: function( html ) { 5985 return html; 5986 }, 5987 5988 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 5989 var i, l, srcElements, destElements, 5990 clone = elem.cloneNode( true ), 5991 inPage = isAttached( elem ); 5992 5993 // Fix IE cloning issues 5994 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 5995 !jQuery.isXMLDoc( elem ) ) { 5996 5997 // We eschew jQuery#find here for performance reasons: 5998 // https://jsperf.com/getall-vs-sizzle/2 5999 destElements = getAll( clone ); 6000 srcElements = getAll( elem ); 6001 6002 for ( i = 0, l = srcElements.length; i < l; i++ ) { 6003 fixInput( srcElements[ i ], destElements[ i ] ); 6004 } 6005 } 6006 6007 // Copy the events from the original to the clone 6008 if ( dataAndEvents ) { 6009 if ( deepDataAndEvents ) { 6010 srcElements = srcElements || getAll( elem ); 6011 destElements = destElements || getAll( clone ); 6012 6013 for ( i = 0, l = srcElements.length; i < l; i++ ) { 6014 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 6015 } 6016 } else { 6017 cloneCopyEvent( elem, clone ); 6018 } 6019 } 6020 6021 // Preserve script evaluation history 6022 destElements = getAll( clone, "script" ); 6023 if ( destElements.length > 0 ) { 6024 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 6025 } 6026 6027 // Return the cloned set 6028 return clone; 6029 }, 6030 6031 cleanData: function( elems ) { 6032 var data, elem, type, 6033 special = jQuery.event.special, 6034 i = 0; 6035 6036 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 6037 if ( acceptData( elem ) ) { 6038 if ( ( data = elem[ dataPriv.expando ] ) ) { 6039 if ( data.events ) { 6040 for ( type in data.events ) { 6041 if ( special[ type ] ) { 6042 jQuery.event.remove( elem, type ); 6043 6044 // This is a shortcut to avoid jQuery.event.remove's overhead 6045 } else { 6046 jQuery.removeEvent( elem, type, data.handle ); 6047 } 6048 } 6049 } 6050
vendor: 1,119 bytes, lines 6051-6095
6051 // Support: Chrome <=35 - 45+ 6052 // Assign undefined instead of using delete, see Data#remove 6053 elem[ dataPriv.expando ] = undefined; 6054 } 6055 if ( elem[ dataUser.expando ] ) { 6056 6057 // Support: Chrome <=35 - 45+ 6058 // Assign undefined instead of using delete, see Data#remove 6059 elem[ dataUser.expando ] = undefined; 6060 } 6061 } 6062 } 6063 } 6064} ); 6065 6066jQuery.fn.extend( { 6067 detach: function( selector ) { 6068 return remove( this, selector, true ); 6069 }, 6070 6071 remove: function( selector ) { 6072 return remove( this, selector ); 6073 }, 6074 6075 text: function( value ) { 6076 return access( this, function( value ) { 6077 return value === undefined ? 6078 jQuery.text( this ) : 6079 this.empty().each( function() { 6080 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6081 this.textContent = value; 6082 } 6083 } ); 6084 }, null, value, arguments.length ); 6085 }, 6086 6087 append: function() { 6088 return domManip( this, arguments, function( elem ) { 6089 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6090 var target = manipulationTarget( this, elem ); 6091 target.appendChild( elem ); 6092 } 6093 } ); 6094 }, 6095
vendor: 4,514 bytes, lines 6096-6287
6096 prepend: function() { 6097 return domManip( this, arguments, function( elem ) { 6098 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6099 var target = manipulationTarget( this, elem ); 6100 target.insertBefore( elem, target.firstChild ); 6101 } 6102 } ); 6103 }, 6104 6105 before: function() { 6106 return domManip( this, arguments, function( elem ) { 6107 if ( this.parentNode ) { 6108 this.parentNode.insertBefore( elem, this ); 6109 } 6110 } ); 6111 }, 6112 6113 after: function() { 6114 return domManip( this, arguments, function( elem ) { 6115 if ( this.parentNode ) { 6116 this.parentNode.insertBefore( elem, this.nextSibling ); 6117 } 6118 } ); 6119 }, 6120 6121 empty: function() { 6122 var elem, 6123 i = 0; 6124 6125 for ( ; ( elem = this[ i ] ) != null; i++ ) { 6126 if ( elem.nodeType === 1 ) { 6127 6128 // Prevent memory leaks 6129 jQuery.cleanData( getAll( elem, false ) ); 6130 6131 // Remove any remaining nodes 6132 elem.textContent = ""; 6133 } 6134 } 6135 6136 return this; 6137 }, 6138 6139 clone: function( dataAndEvents, deepDataAndEvents ) { 6140 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 6141 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 6142 6143 return this.map( function() { 6144 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 6145 } ); 6146 }, 6147 6148 html: function( value ) { 6149 return access( this, function( value ) { 6150 var elem = this[ 0 ] || {}, 6151 i = 0, 6152 l = this.length; 6153 6154 if ( value === undefined && elem.nodeType === 1 ) { 6155 return elem.innerHTML; 6156 } 6157 6158 // See if we can take a shortcut and just use innerHTML 6159 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 6160 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 6161 6162 value = jQuery.htmlPrefilter( value ); 6163 6164 try { 6165 for ( ; i < l; i++ ) { 6166 elem = this[ i ] || {}; 6167 6168 // Remove element nodes and prevent memory leaks 6169 if ( elem.nodeType === 1 ) { 6170 jQuery.cleanData( getAll( elem, false ) ); 6171 elem.innerHTML = value; 6172 } 6173 } 6174 6175 elem = 0; 6176 6177 // If using innerHTML throws an exception, use the fallback method 6178 } catch ( e ) {} 6179 } 6180 6181 if ( elem ) { 6182 this.empty().append( value ); 6183 } 6184 }, null, value, arguments.length ); 6185 }, 6186 6187 replaceWith: function() { 6188 var ignored = []; 6189 6190 // Make the changes, replacing each non-ignored context element with the new content 6191 return domManip( this, arguments, function( elem ) { 6192 var parent = this.parentNode; 6193 6194 if ( jQuery.inArray( this, ignored ) < 0 ) { 6195 jQuery.cleanData( getAll( this ) ); 6196 if ( parent ) { 6197 parent.replaceChild( elem, this ); 6198 } 6199 } 6200 6201 // Force callback invocation 6202 }, ignored ); 6203 } 6204} ); 6205 6206jQuery.each( { 6207 appendTo: "append", 6208 prependTo: "prepend", 6209 insertBefore: "before", 6210 insertAfter: "after", 6211 replaceAll: "replaceWith" 6212}, function( name, original ) { 6213 jQuery.fn[ name ] = function( selector ) { 6214 var elems, 6215 ret = [], 6216 insert = jQuery( selector ), 6217 last = insert.length - 1, 6218 i = 0; 6219 6220 for ( ; i <= last; i++ ) { 6221 elems = i === last ? this : this.clone( true ); 6222 jQuery( insert[ i ] )[ original ]( elems ); 6223 6224 // Support: Android <=4.0 only, PhantomJS 1 only 6225 // .get() because push.apply(_, arraylike) throws on ancient WebKit 6226 push.apply( ret, elems.get() ); 6227 } 6228 6229 return this.pushStack( ret ); 6230 }; 6231} ); 6232var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 6233 6234var rcustomProp = /^--/; 6235 6236 6237var getStyles = function( elem ) { 6238 6239 // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150) 6240 // IE throws on elements created in popups 6241 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 6242 var view = elem.ownerDocument.defaultView; 6243 6244 if ( !view || !view.opener ) { 6245 view = window; 6246 } 6247 6248 return view.getComputedStyle( elem ); 6249 }; 6250 6251var swap = function( elem, options, callback ) { 6252 var ret, name, 6253 old = {}; 6254 6255 // Remember the old values, and insert the new ones 6256 for ( name in options ) { 6257 old[ name ] = elem.style[ name ]; 6258 elem.style[ name ] = options[ name ]; 6259 } 6260 6261 ret = callback.call( elem ); 6262 6263 // Revert the old values 6264 for ( name in options ) { 6265 elem.style[ name ] = old[ name ]; 6266 } 6267 6268 return ret; 6269}; 6270 6271 6272var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 6273 6274 6275 6276( function() { 6277 6278 // Executing both pixelPosition & boxSizingReliable tests require only one layout 6279 // so they're executed at the same time to save the second computation. 6280 function computeStyleTests() { 6281 6282 // This is a singleton, we need to execute it only once 6283 if ( !div ) { 6284 return; 6285 } 6286 6287 container.style.cssText = "position:absolute;
vendor: 4,156 bytes, lines 6287-6406
6287left:-11111px;width:60px;" + 6288 "margin-top:1px;padding:0;border:0"; 6289 div.style.cssText = 6290 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 6291 "margin:auto;border:1px;padding:1px;" + 6292 "width:60%;top:1%"; 6293 documentElement.appendChild( container ).appendChild( div ); 6294 6295 var divStyle = window.getComputedStyle( div ); 6296 pixelPositionVal = divStyle.top !== "1%"; 6297 6298 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 6299 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 6300 6301 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 6302 // Some styles come back with percentage values, even though they shouldn't 6303 div.style.right = "60%"; 6304 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 6305 6306 // Support: IE 9 - 11 only 6307 // Detect misreporting of content dimensions for box-sizing:border-box elements 6308 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 6309 6310 // Support: IE 9 only 6311 // Detect overflow:scroll screwiness (gh-3699) 6312 // Support: Chrome <=64 6313 // Don't get tricked when zoom affects offsetWidth (gh-4029) 6314 div.style.position = "absolute"; 6315 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; 6316 6317 documentElement.removeChild( container ); 6318 6319 // Nullify the div so it wouldn't be stored in the memory and 6320 // it will also be a sign that checks already performed 6321 div = null; 6322 } 6323 6324 function roundPixelMeasures( measure ) { 6325 return Math.round( parseFloat( measure ) ); 6326 } 6327 6328 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 6329 reliableTrDimensionsVal, reliableMarginLeftVal, 6330 container = document.createElement( "div" ), 6331 div = document.createElement( "div" ); 6332 6333 // Finish early in limited (non-browser) environments 6334 if ( !div.style ) { 6335 return; 6336 } 6337 6338 // Support: IE <=9 - 11 only 6339 // Style of cloned element affects source element cloned (trac-8908) 6340 div.style.backgroundClip = "content-box"; 6341 div.cloneNode( true ).style.backgroundClip = ""; 6342 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 6343 6344 jQuery.extend( support, { 6345 boxSizingReliable: function() { 6346 computeStyleTests(); 6347 return boxSizingReliableVal; 6348 }, 6349 pixelBoxStyles: function() { 6350 computeStyleTests(); 6351 return pixelBoxStylesVal; 6352 }, 6353 pixelPosition: function() { 6354 computeStyleTests(); 6355 return pixelPositionVal; 6356 }, 6357 reliableMarginLeft: function() { 6358 computeStyleTests(); 6359 return reliableMarginLeftVal; 6360 }, 6361 scrollboxSize: function() { 6362 computeStyleTests(); 6363 return scrollboxSizeVal; 6364 }, 6365 6366 // Support: IE 9 - 11+, Edge 15 - 18+ 6367 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6368 // set in CSS while `offset*` properties report correct values. 6369 // Behavior in IE 9 is more subtle than in newer versions & it passes 6370 // some versions of this test; make sure not to make it pass there! 6371 // 6372 // Support: Firefox 70+ 6373 // Only Firefox includes border widths 6374 // in computed dimensions. (gh-4529) 6375 reliableTrDimensions: function() { 6376 var table, tr, trChild, trStyle; 6377 if ( reliableTrDimensionsVal == null ) { 6378 table = document.createElement( "table" ); 6379 tr = document.createElement( "tr" ); 6380 trChild = document.createElement( "div" ); 6381 6382 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; 6383 tr.style.cssText = "box-sizing:content-box;border:1px solid"; 6384 6385 // Support: Chrome 86+ 6386 // Height set through cssText does not get applied. 6387 // Computed height then comes back as 0. 6388 tr.style.height = "1px"; 6389 trChild.style.height = "9px"; 6390 6391 // Support: Android 8 Chrome 86+ 6392 // In our bodyBackground.html iframe, 6393 // display for all div elements is set to "inline", 6394 // which causes a problem only in Android 8 Chrome 86. 6395 // Ensuring the div is `display: block` 6396 // gets around this issue. 6397 trChild.style.display = "block"; 6398 6399 documentElement 6400 .appendChild( table ) 6401 .appendChild( tr ) 6402 .appendChild( trChild ); 6403 6404 trStyle = window.getComputedStyle( tr ); 6405 reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + 6406 parseInt( trStyle.borderTopWidth, 10 ) +
vendor: 12,879 bytes, lines 6407-6833
6407 parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; 6408 6409 documentElement.removeChild( table ); 6410 } 6411 return reliableTrDimensionsVal; 6412 } 6413 } ); 6414} )(); 6415 6416 6417function curCSS( elem, name, computed ) { 6418 var width, minWidth, maxWidth, ret, 6419 isCustomProp = rcustomProp.test( name ), 6420 6421 // Support: Firefox 51+ 6422 // Retrieving style before computed somehow 6423 // fixes an issue with getting wrong values 6424 // on detached elements 6425 style = elem.style; 6426 6427 computed = computed || getStyles( elem ); 6428 6429 // getPropertyValue is needed for: 6430 // .css('filter') (IE 9 only, trac-12537) 6431 // .css('--customProperty) (gh-3144) 6432 if ( computed ) { 6433 6434 // Support: IE <=9 - 11+ 6435 // IE only supports `"float"` in `getPropertyValue`; in computed styles 6436 // it's only available as `"cssFloat"`. We no longer modify properties 6437 // sent to `.css()` apart from camelCasing, so we need to check both. 6438 // Normally, this would create difference in behavior: if 6439 // `getPropertyValue` returns an empty string, the value returned 6440 // by `.css()` would be `undefined`. This is usually the case for 6441 // disconnected elements. However, in IE even disconnected elements 6442 // with no styles return `"none"` for `getPropertyValue( "float" )` 6443 ret = computed.getPropertyValue( name ) || computed[ name ]; 6444 6445 if ( isCustomProp && ret ) { 6446 6447 // Support: Firefox 105+, Chrome <=105+ 6448 // Spec requires trimming whitespace for custom properties (gh-4926). 6449 // Firefox only trims leading whitespace. Chrome just collapses 6450 // both leading & trailing whitespace to a single space. 6451 // 6452 // Fall back to `undefined` if empty string returned. 6453 // This collapses a missing definition with property defined 6454 // and set to an empty string but there's no standard API 6455 // allowing us to differentiate them without a performance penalty 6456 // and returning `undefined` aligns with older jQuery. 6457 // 6458 // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED 6459 // as whitespace while CSS does not, but this is not a problem 6460 // because CSS preprocessing replaces them with U+000A LINE FEED 6461 // (which *is* CSS whitespace) 6462 // https://www.w3.org/TR/css-syntax-3/#input-preprocessing 6463 ret = ret.replace( rtrimCSS, "$1" ) || undefined; 6464 } 6465 6466 if ( ret === "" && !isAttached( elem ) ) { 6467 ret = jQuery.style( elem, name ); 6468 } 6469 6470 // A tribute to the "awesome hack by Dean Edwards" 6471 // Android Browser returns percentage for some values, 6472 // but width seems to be reliably pixels. 6473 // This is against the CSSOM draft spec: 6474 // https://drafts.csswg.org/cssom/#resolved-values 6475 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 6476 6477 // Remember the original values 6478 width = style.width; 6479 minWidth = style.minWidth; 6480 maxWidth = style.maxWidth; 6481 6482 // Put in the new values to get a computed value out 6483 style.minWidth = style.maxWidth = style.width = ret; 6484 ret = computed.width; 6485 6486 // Revert the changed values 6487 style.width = width; 6488 style.minWidth = minWidth; 6489 style.maxWidth = maxWidth; 6490 } 6491 } 6492 6493 return ret !== undefined ? 6494 6495 // Support: IE <=9 - 11 only 6496 // IE returns zIndex value as an integer. 6497 ret + "" : 6498 ret; 6499} 6500 6501 6502function addGetHookIf( conditionFn, hookFn ) { 6503 6504 // Define the hook, we'll check on the first run if it's really needed. 6505 return { 6506 get: function() { 6507 if ( conditionFn() ) { 6508 6509 // Hook not needed (or it's not possible to use it due 6510 // to missing dependency), remove it. 6511 delete this.get; 6512 return; 6513 } 6514 6515 // Hook needed; redefine it so that the support test is not executed again. 6516 return ( this.get = hookFn ).apply( this, arguments ); 6517 } 6518 }; 6519} 6520 6521 6522var cssPrefixes = [ "Webkit", "Moz", "ms" ], 6523 emptyStyle = document.createElement( "div" ).style, 6524 vendorProps = {}; 6525 6526// Return a vendor-prefixed property or undefined 6527function vendorPropName( name ) { 6528 6529 // Check for vendor prefixed names 6530 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 6531 i = cssPrefixes.length; 6532 6533 while ( i-- ) { 6534 name = cssPrefixes[ i ] + capName; 6535 if ( name in emptyStyle ) { 6536 return name; 6537 } 6538 } 6539} 6540 6541// Return a potentially-mapped jQuery.cssProps or vendor prefixed property 6542function finalPropName( name ) { 6543 var final = jQuery.cssProps[ name ] || vendorProps[ name ]; 6544 6545 if ( final ) { 6546 return final; 6547 } 6548 if ( name in emptyStyle ) { 6549 return name; 6550 } 6551 return vendorProps[ name ] = vendorPropName( name ) || name; 6552} 6553 6554 6555var 6556 6557 // Swappable if display is none or starts with table 6558 // except "table", "table-cell", or "table-caption" 6559 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 6560 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 6561 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 6562 cssNormalTransform = { 6563 letterSpacing: "0", 6564 fontWeight: "400" 6565 }; 6566 6567function setPositiveNumber( _elem, value, subtract ) { 6568 6569 // Any relative (+/-) values have already been 6570 // normalized at this point 6571 var matches = rcssNum.exec( value ); 6572 return matches ? 6573 6574 // Guard against undefined "subtract", e.g., when used as in cssHooks 6575 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 6576 value; 6577} 6578 6579function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 6580 var i = dimension === "width" ? 1 : 0, 6581 extra = 0, 6582 delta = 0, 6583 marginDelta = 0; 6584 6585 // Adjustment may not be necessary 6586 if ( box === ( isBorderBox ? "border" : "content" ) ) { 6587 return 0; 6588 } 6589 6590 for ( ; i < 4; i += 2 ) { 6591 6592 // Both box models exclude margin 6593 // Count margin delta separately to only add it after scroll gutter adjustment. 6594 // This is needed to make negative margins work with `outerHeight( true )` (gh-3982). 6595 if ( box === "margin" ) { 6596 marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 6597 } 6598 6599 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 6600 if ( !isBorderBox ) { 6601 6602 // Add padding 6603 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6604 6605 // For "border" or "margin", add border 6606 if ( box !== "padding" ) { 6607 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6608 6609 // But still keep track of it otherwise 6610 } else { 6611 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6612 } 6613 6614 // If we get here with a border-box (content + padding + border), we're seeking "content" or 6615 // "padding" or "margin" 6616 } else { 6617 6618 // For "content", subtract padding 6619 if ( box === "content" ) { 6620 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6621 } 6622 6623 // For "content" or "padding", subtract border 6624 if ( box !== "margin" ) { 6625 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6626 } 6627 } 6628 } 6629 6630 // Account for positive content-box scroll gutter when requested by providing computedVal 6631 if ( !isBorderBox && computedVal >= 0 ) { 6632 6633 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 6634 // Assuming integer scroll gutter, subtract the rest and round down 6635 delta += Math.max( 0, Math.ceil( 6636 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 6637 computedVal - 6638 delta - 6639 extra - 6640 0.5 6641 6642 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 6643 // Use an explicit zero to avoid NaN (gh-3964) 6644 ) ) || 0; 6645 } 6646 6647 return delta + marginDelta; 6648} 6649 6650function getWidthOrHeight( elem, dimension, extra ) { 6651 6652 // Start with computed style 6653 var styles = getStyles( elem ), 6654 6655 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 6656 // Fake content-box until we know it's needed to know the true value. 6657 boxSizingNeeded = !support.boxSizingReliable() || extra, 6658 isBorderBox = boxSizingNeeded && 6659 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 6660 valueIsBorderBox = isBorderBox, 6661 6662 val = curCSS( elem, dimension, styles ), 6663 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); 6664 6665 // Support: Firefox <=54 6666 // Return a confounding non-pixel value or feign ignorance, as appropriate. 6667 if ( rnumnonpx.test( val ) ) { 6668 if ( !extra ) { 6669 return val; 6670 } 6671 val = "auto"; 6672 } 6673 6674 6675 // Support: IE 9 - 11 only 6676 // Use offsetWidth/offsetHeight for when box sizing is unreliable. 6677 // In those cases, the computed value can be trusted to be border-box. 6678 if ( ( !support.boxSizingReliable() && isBorderBox || 6679 6680 // Support: IE 10 - 11+, Edge 15 - 18+ 6681 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6682 // set in CSS while `offset*` properties report correct values. 6683 // Interestingly, in some cases IE 9 doesn't suffer from this issue. 6684 !support.reliableTrDimensions() && nodeName( elem, "tr" ) || 6685 6686 // Fall back to offsetWidth/offsetHeight when value is "auto" 6687 // This happens for inline elements with no explicit setting (gh-3571) 6688 val === "auto" || 6689 6690 // Support: Android <=4.1 - 4.3 only 6691 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 6692 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && 6693 6694 // Make sure the element is visible & connected 6695 elem.getClientRects().length ) { 6696 6697 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 6698 6699 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 6700 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 6701 // retrieved value as a content box dimension. 6702 valueIsBorderBox = offsetProp in elem; 6703 if ( valueIsBorderBox ) { 6704 val = elem[ offsetProp ]; 6705 } 6706 } 6707 6708 // Normalize "" and auto 6709 val = parseFloat( val ) || 0; 6710 6711 // Adjust for the element's box model 6712 return ( val + 6713 boxModelAdjustment( 6714 elem, 6715 dimension, 6716 extra || ( isBorderBox ? "border" : "content" ), 6717 valueIsBorderBox, 6718 styles, 6719 6720 // Provide the current computed size to request scroll gutter calculation (gh-3589) 6721 val 6722 ) 6723 ) + "px"; 6724} 6725 6726jQuery.extend( { 6727 6728 // Add in style property hooks for overriding the default 6729 // behavior of getting and setting a style property 6730 cssHooks: { 6731 opacity: { 6732 get: function( elem, computed ) { 6733 if ( computed ) { 6734 6735 // We should always get a number back from opacity 6736 var ret = curCSS( elem, "opacity" ); 6737 return ret === "" ? "1" : ret; 6738 } 6739 } 6740 } 6741 }, 6742 6743 // Don't automatically add "px" to these possibly-unitless properties 6744 cssNumber: { 6745 animationIterationCount: true, 6746 aspectRatio: true, 6747 borderImageSlice: true, 6748 columnCount: true, 6749 flexGrow: true, 6750 flexShrink: true, 6751 fontWeight: true, 6752 gridArea: true, 6753 gridColumn: true, 6754 gridColumnEnd: true, 6755 gridColumnStart: true, 6756 gridRow: true, 6757 gridRowEnd: true, 6758 gridRowStart: true, 6759 lineHeight: true, 6760 opacity: true, 6761 order: true, 6762 orphans: true, 6763 scale: true, 6764 widows: true, 6765 zIndex: true, 6766 zoom: true, 6767 6768 // SVG-related 6769 fillOpacity: true, 6770 floodOpacity: true, 6771 stopOpacity: true, 6772 strokeMiterlimit: true, 6773 strokeOpacity: true 6774 }, 6775 6776 // Add in properties whose names you wish to fix before 6777 // setting or getting the value 6778 cssProps: {}, 6779 6780 // Get and set the style property on a DOM Node 6781 style: function( elem, name, value, extra ) { 6782 6783 // Don't set styles on text and comment nodes 6784 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 6785 return; 6786 } 6787 6788 // Make sure that we're working with the right name 6789 var ret, type, hooks, 6790 origName = camelCase( name ), 6791 isCustomProp = rcustomProp.test( name ), 6792 style = elem.style; 6793 6794 // Make sure that we're working with the right name. We don't 6795 // want to query the value if it is a CSS custom property 6796 // since they are user-defined. 6797 if ( !isCustomProp ) { 6798 name = finalPropName( origName ); 6799 } 6800 6801 // Gets hook for the prefixed version, then unprefixed version 6802 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6803 6804 // Check if we're setting a value 6805 if ( value !== undefined ) { 6806 type = typeof value; 6807 6808 // Convert "+=" or "-=" to relative numbers (trac-7345) 6809 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 6810 value = adjustCSS( elem, name, ret ); 6811 6812 // Fixes bug trac-9237 6813 type = "number"; 6814 } 6815 6816 // Make sure that null and NaN values aren't set (trac-7116) 6817 if ( value == null || value !== value ) { 6818 return; 6819 } 6820 6821 // If a number was passed in, add the unit (except for certain CSS properties) 6822 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 6823 // "px" to a few hardcoded values. 6824 if ( type === "number" && !isCustomProp ) { 6825 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 6826 } 6827 6828 // background-* props affect original clone's values 6829 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 6830 style[ name ] = "inherit"; 6831 } 6832 6833 // If a hook was provided, use that value, otherwise just set the specified value
vendor: 16,052 bytes, lines 6834-7438
6834 if ( !hooks || !( "set" in hooks ) || 6835 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 6836 6837 if ( isCustomProp ) { 6838 style.setProperty( name, value ); 6839 } else { 6840 style[ name ] = value; 6841 } 6842 } 6843 6844 } else { 6845 6846 // If a hook was provided get the non-computed value from there 6847 if ( hooks && "get" in hooks && 6848 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 6849 6850 return ret; 6851 } 6852 6853 // Otherwise just get the value from the style object 6854 return style[ name ]; 6855 } 6856 }, 6857 6858 css: function( elem, name, extra, styles ) { 6859 var val, num, hooks, 6860 origName = camelCase( name ), 6861 isCustomProp = rcustomProp.test( name ); 6862 6863 // Make sure that we're working with the right name. We don't 6864 // want to modify the value if it is a CSS custom property 6865 // since they are user-defined. 6866 if ( !isCustomProp ) { 6867 name = finalPropName( origName ); 6868 } 6869 6870 // Try prefixed name followed by the unprefixed name 6871 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 6872 6873 // If a hook was provided get the computed value from there 6874 if ( hooks && "get" in hooks ) { 6875 val = hooks.get( elem, true, extra ); 6876 } 6877 6878 // Otherwise, if a way to get the computed value exists, use that 6879 if ( val === undefined ) { 6880 val = curCSS( elem, name, styles ); 6881 } 6882 6883 // Convert "normal" to computed value 6884 if ( val === "normal" && name in cssNormalTransform ) { 6885 val = cssNormalTransform[ name ]; 6886 } 6887 6888 // Make numeric if forced or a qualifier was provided and val looks numeric 6889 if ( extra === "" || extra ) { 6890 num = parseFloat( val ); 6891 return extra === true || isFinite( num ) ? num || 0 : val; 6892 } 6893 6894 return val; 6895 } 6896} ); 6897 6898jQuery.each( [ "height", "width" ], function( _i, dimension ) { 6899 jQuery.cssHooks[ dimension ] = { 6900 get: function( elem, computed, extra ) { 6901 if ( computed ) { 6902 6903 // Certain elements can have dimension info if we invisibly show them 6904 // but it must have a current display style that would benefit 6905 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 6906 6907 // Support: Safari 8+ 6908 // Table columns in Safari have non-zero offsetWidth & zero 6909 // getBoundingClientRect().width unless display is changed. 6910 // Support: IE <=11 only 6911 // Running getBoundingClientRect on a disconnected node 6912 // in IE throws an error. 6913 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 6914 swap( elem, cssShow, function() { 6915 return getWidthOrHeight( elem, dimension, extra ); 6916 } ) : 6917 getWidthOrHeight( elem, dimension, extra ); 6918 } 6919 }, 6920 6921 set: function( elem, value, extra ) { 6922 var matches, 6923 styles = getStyles( elem ), 6924 6925 // Only read styles.position if the test has a chance to fail 6926 // to avoid forcing a reflow. 6927 scrollboxSizeBuggy = !support.scrollboxSize() && 6928 styles.position === "absolute", 6929 6930 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 6931 boxSizingNeeded = scrollboxSizeBuggy || extra, 6932 isBorderBox = boxSizingNeeded && 6933 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 6934 subtract = extra ? 6935 boxModelAdjustment( 6936 elem, 6937 dimension, 6938 extra, 6939 isBorderBox, 6940 styles 6941 ) : 6942 0; 6943 6944 // Account for unreliable border-box dimensions by comparing offset* to computed and 6945 // faking a content-box to get border and padding (gh-3699) 6946 if ( isBorderBox && scrollboxSizeBuggy ) { 6947 subtract -= Math.ceil( 6948 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 6949 parseFloat( styles[ dimension ] ) - 6950 boxModelAdjustment( elem, dimension, "border", false, styles ) - 6951 0.5 6952 ); 6953 } 6954 6955 // Convert to pixels if value adjustment is needed 6956 if ( subtract && ( matches = rcssNum.exec( value ) ) && 6957 ( matches[ 3 ] || "px" ) !== "px" ) { 6958 6959 elem.style[ dimension ] = value; 6960 value = jQuery.css( elem, dimension ); 6961 } 6962 6963 return setPositiveNumber( elem, value, subtract ); 6964 } 6965 }; 6966} ); 6967 6968jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 6969 function( elem, computed ) { 6970 if ( computed ) { 6971 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 6972 elem.getBoundingClientRect().left - 6973 swap( elem, { marginLeft: 0 }, function() { 6974 return elem.getBoundingClientRect().left; 6975 } ) 6976 ) + "px"; 6977 } 6978 } 6979); 6980 6981// These hooks are used by animate to expand properties 6982jQuery.each( { 6983 margin: "", 6984 padding: "", 6985 border: "Width" 6986}, function( prefix, suffix ) { 6987 jQuery.cssHooks[ prefix + suffix ] = { 6988 expand: function( value ) { 6989 var i = 0, 6990 expanded = {}, 6991 6992 // Assumes a single number if not a string 6993 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 6994 6995 for ( ; i < 4; i++ ) { 6996 expanded[ prefix + cssExpand[ i ] + suffix ] = 6997 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 6998 } 6999 7000 return expanded; 7001 } 7002 }; 7003 7004 if ( prefix !== "margin" ) { 7005 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 7006 } 7007} ); 7008 7009jQuery.fn.extend( { 7010 css: function( name, value ) { 7011 return access( this, function( elem, name, value ) { 7012 var styles, len, 7013 map = {}, 7014 i = 0; 7015 7016 if ( Array.isArray( name ) ) { 7017 styles = getStyles( elem ); 7018 len = name.length; 7019 7020 for ( ; i < len; i++ ) { 7021 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 7022 } 7023 7024 return map; 7025 } 7026 7027 return value !== undefined ? 7028 jQuery.style( elem, name, value ) : 7029 jQuery.css( elem, name ); 7030 }, name, value, arguments.length > 1 ); 7031 } 7032} ); 7033 7034 7035function Tween( elem, options, prop, end, easing ) { 7036 return new Tween.prototype.init( elem, options, prop, end, easing ); 7037} 7038jQuery.Tween = Tween; 7039 7040Tween.prototype = { 7041 constructor: Tween, 7042 init: function( elem, options, prop, end, easing, unit ) { 7043 this.elem = elem; 7044 this.prop = prop; 7045 this.easing = easing || jQuery.easing._default; 7046 this.options = options; 7047 this.start = this.now = this.cur(); 7048 this.end = end; 7049 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 7050 }, 7051 cur: function() { 7052 var hooks = Tween.propHooks[ this.prop ]; 7053 7054 return hooks && hooks.get ? 7055 hooks.get( this ) : 7056 Tween.propHooks._default.get( this ); 7057 }, 7058 run: function( percent ) { 7059 var eased, 7060 hooks = Tween.propHooks[ this.prop ]; 7061 7062 if ( this.options.duration ) { 7063 this.pos = eased = jQuery.easing[ this.easing ]( 7064 percent, this.options.duration * percent, 0, 1, this.options.duration 7065 ); 7066 } else { 7067 this.pos = eased = percent; 7068 } 7069 this.now = ( this.end - this.start ) * eased + this.start; 7070 7071 if ( this.options.step ) { 7072 this.options.step.call( this.elem, this.now, this ); 7073 } 7074 7075 if ( hooks && hooks.set ) { 7076 hooks.set( this ); 7077 } else { 7078 Tween.propHooks._default.set( this ); 7079 } 7080 return this; 7081 } 7082}; 7083 7084Tween.prototype.init.prototype = Tween.prototype; 7085 7086Tween.propHooks = { 7087 _default: { 7088 get: function( tween ) { 7089 var result; 7090 7091 // Use a property on the element directly when it is not a DOM element, 7092 // or when there is no matching style property that exists. 7093 if ( tween.elem.nodeType !== 1 || 7094 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 7095 return tween.elem[ tween.prop ]; 7096 } 7097 7098 // Passing an empty string as a 3rd parameter to .css will automatically 7099 // attempt a parseFloat and fallback to a string if the parse fails. 7100 // Simple values such as "10px" are parsed to Float; 7101 // complex values such as "rotate(1rad)" are returned as-is. 7102 result = jQuery.css( tween.elem, tween.prop, "" ); 7103 7104 // Empty strings, null, undefined and "auto" are converted to 0. 7105 return !result || result === "auto" ? 0 : result; 7106 }, 7107 set: function( tween ) { 7108 7109 // Use step hook for back compat. 7110 // Use cssHook if its there. 7111 // Use .style if available and use plain properties where available. 7112 if ( jQuery.fx.step[ tween.prop ] ) { 7113 jQuery.fx.step[ tween.prop ]( tween ); 7114 } else if ( tween.elem.nodeType === 1 && ( 7115 jQuery.cssHooks[ tween.prop ] || 7116 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { 7117 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 7118 } else { 7119 tween.elem[ tween.prop ] = tween.now; 7120 } 7121 } 7122 } 7123}; 7124 7125// Support: IE <=9 only 7126// Panic based approach to setting things on disconnected nodes 7127Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 7128 set: function( tween ) { 7129 if ( tween.elem.nodeType && tween.elem.parentNode ) { 7130 tween.elem[ tween.prop ] = tween.now; 7131 } 7132 } 7133}; 7134 7135jQuery.easing = { 7136 linear: function( p ) { 7137 return p; 7138 }, 7139 swing: function( p ) { 7140 return 0.5 - Math.cos( p * Math.PI ) / 2; 7141 }, 7142 _default: "swing" 7143}; 7144 7145jQuery.fx = Tween.prototype.init; 7146 7147// Back compat <1.8 extension point 7148jQuery.fx.step = {}; 7149 7150 7151 7152 7153var 7154 fxNow, inProgress, 7155 rfxtypes = /^(?:toggle|show|hide)$/, 7156 rrun = /queueHooks$/; 7157 7158function schedule() { 7159 if ( inProgress ) { 7160 if ( document.hidden === false && window.requestAnimationFrame ) { 7161 window.requestAnimationFrame( schedule ); 7162 } else { 7163 window.setTimeout( schedule, jQuery.fx.interval ); 7164 } 7165 7166 jQuery.fx.tick(); 7167 } 7168} 7169 7170// Animations created synchronously will run synchronously 7171function createFxNow() { 7172 window.setTimeout( function() { 7173 fxNow = undefined; 7174 } ); 7175 return ( fxNow = Date.now() ); 7176} 7177 7178// Generate parameters to create a standard animation 7179function genFx( type, includeWidth ) { 7180 var which, 7181 i = 0, 7182 attrs = { height: type }; 7183 7184 // If we include width, step value is 1 to do all cssExpand values, 7185 // otherwise step value is 2 to skip over Left and Right 7186 includeWidth = includeWidth ? 1 : 0; 7187 for ( ; i < 4; i += 2 - includeWidth ) { 7188 which = cssExpand[ i ]; 7189 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 7190 } 7191 7192 if ( includeWidth ) { 7193 attrs.opacity = attrs.width = type; 7194 } 7195 7196 return attrs; 7197} 7198 7199function createTween( value, prop, animation ) { 7200 var tween, 7201 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 7202 index = 0, 7203 length = collection.length; 7204 for ( ; index < length; index++ ) { 7205 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 7206 7207 // We're done with this property 7208 return tween; 7209 } 7210 } 7211} 7212 7213function defaultPrefilter( elem, props, opts ) { 7214 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 7215 isBox = "width" in props || "height" in props, 7216 anim = this, 7217 orig = {}, 7218 style = elem.style, 7219 hidden = elem.nodeType && isHiddenWithinTree( elem ), 7220 dataShow = dataPriv.get( elem, "fxshow" ); 7221 7222 // Queue-skipping animations hijack the fx hooks 7223 if ( !opts.queue ) { 7224 hooks = jQuery._queueHooks( elem, "fx" ); 7225 if ( hooks.unqueued == null ) { 7226 hooks.unqueued = 0; 7227 oldfire = hooks.empty.fire; 7228 hooks.empty.fire = function() { 7229 if ( !hooks.unqueued ) { 7230 oldfire(); 7231 } 7232 }; 7233 } 7234 hooks.unqueued++; 7235 7236 anim.always( function() { 7237 7238 // Ensure the complete handler is called before this completes 7239 anim.always( function() { 7240 hooks.unqueued--; 7241 if ( !jQuery.queue( elem, "fx" ).length ) { 7242 hooks.empty.fire(); 7243 } 7244 } ); 7245 } ); 7246 } 7247 7248 // Detect show/hide animations 7249 for ( prop in props ) { 7250 value = props[ prop ]; 7251 if ( rfxtypes.test( value ) ) { 7252 delete props[ prop ]; 7253 toggle = toggle || value === "toggle"; 7254 if ( value === ( hidden ? "hide" : "show" ) ) { 7255 7256 // Pretend to be hidden if this is a "show" and 7257 // there is still data from a stopped show/hide 7258 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 7259 hidden = true; 7260 7261 // Ignore all other no-op show/hide data 7262 } else { 7263 continue; 7264 } 7265 } 7266 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 7267 } 7268 } 7269 7270 // Bail out if this is a no-op like .hide().hide() 7271 propTween = !jQuery.isEmptyObject( props ); 7272 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 7273 return; 7274 } 7275 7276 // Restrict "overflow" and "display" styles during box animations 7277 if ( isBox && elem.nodeType === 1 ) { 7278 7279 // Support: IE <=9 - 11, Edge 12 - 15 7280 // Record all 3 overflow attributes because IE does not infer the shorthand 7281 // from identically-valued overflowX and overflowY and Edge just mirrors 7282 // the overflowX value there. 7283 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 7284 7285 // Identify a display type, preferring old show/hide data over the CSS cascade 7286 restoreDisplay = dataShow && dataShow.display; 7287 if ( restoreDisplay == null ) { 7288 restoreDisplay = dataPriv.get( elem, "display" ); 7289 } 7290 display = jQuery.css( elem, "display" ); 7291 if ( display === "none" ) { 7292 if ( restoreDisplay ) { 7293 display = restoreDisplay; 7294 } else { 7295 7296 // Get nonempty value(s) by temporarily forcing visibility 7297 showHide( [ elem ], true ); 7298 restoreDisplay = elem.style.display || restoreDisplay; 7299 display = jQuery.css( elem, "display" ); 7300 showHide( [ elem ] ); 7301 } 7302 } 7303 7304 // Animate inline elements as inline-block 7305 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 7306 if ( jQuery.css( elem, "float" ) === "none" ) { 7307 7308 // Restore the original display value at the end of pure show/hide animations 7309 if ( !propTween ) { 7310 anim.done( function() { 7311 style.display = restoreDisplay; 7312 } ); 7313 if ( restoreDisplay == null ) { 7314 display = style.display; 7315 restoreDisplay = display === "none" ? "" : display; 7316 } 7317 } 7318 style.display = "inline-block"; 7319 } 7320 } 7321 } 7322 7323 if ( opts.overflow ) { 7324 style.overflow = "hidden"; 7325 anim.always( function() { 7326 style.overflow = opts.overflow[ 0 ]; 7327 style.overflowX = opts.overflow[ 1 ]; 7328 style.overflowY = opts.overflow[ 2 ]; 7329 } ); 7330 } 7331 7332 // Implement show/hide animations 7333 propTween = false; 7334 for ( prop in orig ) { 7335 7336 // General show/hide setup for this element animation 7337 if ( !propTween ) { 7338 if ( dataShow ) { 7339 if ( "hidden" in dataShow ) { 7340 hidden = dataShow.hidden; 7341 } 7342 } else { 7343 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 7344 } 7345 7346 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 7347 if ( toggle ) { 7348 dataShow.hidden = !hidden; 7349 } 7350 7351 // Show elements before animating them 7352 if ( hidden ) { 7353 showHide( [ elem ], true ); 7354 } 7355 7356 /* eslint-disable no-loop-func */ 7357 7358 anim.done( function() { 7359 7360 /* eslint-enable no-loop-func */ 7361 7362 // The final step of a "hide" animation is actually hiding the element 7363 if ( !hidden ) { 7364 showHide( [ elem ] ); 7365 } 7366 dataPriv.remove( elem, "fxshow" ); 7367 for ( prop in orig ) { 7368 jQuery.style( elem, prop, orig[ prop ] ); 7369 } 7370 } ); 7371 } 7372 7373 // Per-property setup 7374 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 7375 if ( !( prop in dataShow ) ) { 7376 dataShow[ prop ] = propTween.start; 7377 if ( hidden ) { 7378 propTween.end = propTween.start; 7379 propTween.start = 0; 7380 } 7381 } 7382 } 7383} 7384 7385function propFilter( props, specialEasing ) { 7386 var index, name, easing, value, hooks; 7387 7388 // camelCase, specialEasing and expand cssHook pass 7389 for ( index in props ) { 7390 name = camelCase( index ); 7391 easing = specialEasing[ name ]; 7392 value = props[ index ]; 7393 if ( Array.isArray( value ) ) { 7394 easing = value[ 1 ]; 7395 value = props[ index ] = value[ 0 ]; 7396 } 7397 7398 if ( index !== name ) { 7399 props[ name ] = value; 7400 delete props[ index ]; 7401 } 7402 7403 hooks = jQuery.cssHooks[ name ]; 7404 if ( hooks && "expand" in hooks ) { 7405 value = hooks.expand( value ); 7406 delete props[ name ]; 7407 7408 // Not quite $.extend, this won't overwrite existing keys. 7409 // Reusing 'index' because we have the correct "name" 7410 for ( index in value ) { 7411 if ( !( index in props ) ) { 7412 props[ index ] = value[ index ]; 7413 specialEasing[ index ] = easing; 7414 } 7415 } 7416 } else { 7417 specialEasing[ name ] = easing; 7418 } 7419 } 7420} 7421 7422function Animation( elem, properties, options ) { 7423 var result, 7424 stopped, 7425 index = 0, 7426 length = Animation.prefilters.length, 7427 deferred = jQuery.Deferred().always( function() { 7428 7429 // Don't match elem in the :animated selector 7430 delete tick.elem; 7431 } ), 7432 tick = function() { 7433 if ( stopped ) { 7434 return false; 7435 } 7436 var currentTime = fxNow || createFxNow(), 7437 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 7438
vendor: 9,542 bytes, lines 7439-7829
7439 // Support: Android 2.3 only 7440 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497) 7441 temp = remaining / animation.duration || 0, 7442 percent = 1 - temp, 7443 index = 0, 7444 length = animation.tweens.length; 7445 7446 for ( ; index < length; index++ ) { 7447 animation.tweens[ index ].run( percent ); 7448 } 7449 7450 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 7451 7452 // If there's more to do, yield 7453 if ( percent < 1 && length ) { 7454 return remaining; 7455 } 7456 7457 // If this was an empty animation, synthesize a final progress notification 7458 if ( !length ) { 7459 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7460 } 7461 7462 // Resolve the animation and report its conclusion 7463 deferred.resolveWith( elem, [ animation ] ); 7464 return false; 7465 }, 7466 animation = deferred.promise( { 7467 elem: elem, 7468 props: jQuery.extend( {}, properties ), 7469 opts: jQuery.extend( true, { 7470 specialEasing: {}, 7471 easing: jQuery.easing._default 7472 }, options ), 7473 originalProperties: properties, 7474 originalOptions: options, 7475 startTime: fxNow || createFxNow(), 7476 duration: options.duration, 7477 tweens: [], 7478 createTween: function( prop, end ) { 7479 var tween = jQuery.Tween( elem, animation.opts, prop, end, 7480 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 7481 animation.tweens.push( tween ); 7482 return tween; 7483 }, 7484 stop: function( gotoEnd ) { 7485 var index = 0, 7486 7487 // If we are going to the end, we want to run all the tweens 7488 // otherwise we skip this part 7489 length = gotoEnd ? animation.tweens.length : 0; 7490 if ( stopped ) { 7491 return this; 7492 } 7493 stopped = true; 7494 for ( ; index < length; index++ ) { 7495 animation.tweens[ index ].run( 1 ); 7496 } 7497 7498 // Resolve when we played the last frame; otherwise, reject 7499 if ( gotoEnd ) { 7500 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7501 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 7502 } else { 7503 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 7504 } 7505 return this; 7506 } 7507 } ), 7508 props = animation.props; 7509 7510 propFilter( props, animation.opts.specialEasing ); 7511 7512 for ( ; index < length; index++ ) { 7513 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 7514 if ( result ) { 7515 if ( isFunction( result.stop ) ) { 7516 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 7517 result.stop.bind( result ); 7518 } 7519 return result; 7520 } 7521 } 7522 7523 jQuery.map( props, createTween, animation ); 7524 7525 if ( isFunction( animation.opts.start ) ) { 7526 animation.opts.start.call( elem, animation ); 7527 } 7528 7529 // Attach callbacks from options 7530 animation 7531 .progress( animation.opts.progress ) 7532 .done( animation.opts.done, animation.opts.complete ) 7533 .fail( animation.opts.fail ) 7534 .always( animation.opts.always ); 7535 7536 jQuery.fx.timer( 7537 jQuery.extend( tick, { 7538 elem: elem, 7539 anim: animation, 7540 queue: animation.opts.queue 7541 } ) 7542 ); 7543 7544 return animation; 7545} 7546 7547jQuery.Animation = jQuery.extend( Animation, { 7548 7549 tweeners: { 7550 "*": [ function( prop, value ) { 7551 var tween = this.createTween( prop, value ); 7552 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 7553 return tween; 7554 } ] 7555 }, 7556 7557 tweener: function( props, callback ) { 7558 if ( isFunction( props ) ) { 7559 callback = props; 7560 props = [ "*" ]; 7561 } else { 7562 props = props.match( rnothtmlwhite ); 7563 } 7564 7565 var prop, 7566 index = 0, 7567 length = props.length; 7568 7569 for ( ; index < length; index++ ) { 7570 prop = props[ index ]; 7571 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 7572 Animation.tweeners[ prop ].unshift( callback ); 7573 } 7574 }, 7575 7576 prefilters: [ defaultPrefilter ], 7577 7578 prefilter: function( callback, prepend ) { 7579 if ( prepend ) { 7580 Animation.prefilters.unshift( callback ); 7581 } else { 7582 Animation.prefilters.push( callback ); 7583 } 7584 } 7585} ); 7586 7587jQuery.speed = function( speed, easing, fn ) { 7588 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 7589 complete: fn || !fn && easing || 7590 isFunction( speed ) && speed, 7591 duration: speed, 7592 easing: fn && easing || easing && !isFunction( easing ) && easing 7593 }; 7594 7595 // Go to the end state if fx are off 7596 if ( jQuery.fx.off ) { 7597 opt.duration = 0; 7598 7599 } else { 7600 if ( typeof opt.duration !== "number" ) { 7601 if ( opt.duration in jQuery.fx.speeds ) { 7602 opt.duration = jQuery.fx.speeds[ opt.duration ]; 7603 7604 } else { 7605 opt.duration = jQuery.fx.speeds._default; 7606 } 7607 } 7608 } 7609 7610 // Normalize opt.queue - true/undefined/null -> "fx" 7611 if ( opt.queue == null || opt.queue === true ) { 7612 opt.queue = "fx"; 7613 } 7614 7615 // Queueing 7616 opt.old = opt.complete; 7617 7618 opt.complete = function() { 7619 if ( isFunction( opt.old ) ) { 7620 opt.old.call( this ); 7621 } 7622 7623 if ( opt.queue ) { 7624 jQuery.dequeue( this, opt.queue ); 7625 } 7626 }; 7627 7628 return opt; 7629}; 7630 7631jQuery.fn.extend( { 7632 fadeTo: function( speed, to, easing, callback ) { 7633 7634 // Show any hidden elements after setting opacity to 0 7635 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 7636 7637 // Animate to the value specified 7638 .end().animate( { opacity: to }, speed, easing, callback ); 7639 }, 7640 animate: function( prop, speed, easing, callback ) { 7641 var empty = jQuery.isEmptyObject( prop ), 7642 optall = jQuery.speed( speed, easing, callback ), 7643 doAnimation = function() { 7644 7645 // Operate on a copy of prop so per-property easing won't be lost 7646 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 7647 7648 // Empty animations, or finishing resolves immediately 7649 if ( empty || dataPriv.get( this, "finish" ) ) { 7650 anim.stop( true ); 7651 } 7652 }; 7653 7654 doAnimation.finish = doAnimation; 7655 7656 return empty || optall.queue === false ? 7657 this.each( doAnimation ) : 7658 this.queue( optall.queue, doAnimation ); 7659 }, 7660 stop: function( type, clearQueue, gotoEnd ) { 7661 var stopQueue = function( hooks ) { 7662 var stop = hooks.stop; 7663 delete hooks.stop; 7664 stop( gotoEnd ); 7665 }; 7666 7667 if ( typeof type !== "string" ) { 7668 gotoEnd = clearQueue; 7669 clearQueue = type; 7670 type = undefined; 7671 } 7672 if ( clearQueue ) { 7673 this.queue( type || "fx", [] ); 7674 } 7675 7676 return this.each( function() { 7677 var dequeue = true, 7678 index = type != null && type + "queueHooks", 7679 timers = jQuery.timers, 7680 data = dataPriv.get( this ); 7681 7682 if ( index ) { 7683 if ( data[ index ] && data[ index ].stop ) { 7684 stopQueue( data[ index ] ); 7685 } 7686 } else { 7687 for ( index in data ) { 7688 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 7689 stopQueue( data[ index ] ); 7690 } 7691 } 7692 } 7693 7694 for ( index = timers.length; index--; ) { 7695 if ( timers[ index ].elem === this && 7696 ( type == null || timers[ index ].queue === type ) ) { 7697 7698 timers[ index ].anim.stop( gotoEnd ); 7699 dequeue = false; 7700 timers.splice( index, 1 ); 7701 } 7702 } 7703 7704 // Start the next in the queue if the last step wasn't forced. 7705 // Timers currently will call their complete callbacks, which 7706 // will dequeue but only if they were gotoEnd. 7707 if ( dequeue || !gotoEnd ) { 7708 jQuery.dequeue( this, type ); 7709 } 7710 } ); 7711 }, 7712 finish: function( type ) { 7713 if ( type !== false ) { 7714 type = type || "fx"; 7715 } 7716 return this.each( function() { 7717 var index, 7718 data = dataPriv.get( this ), 7719 queue = data[ type + "queue" ], 7720 hooks = data[ type + "queueHooks" ], 7721 timers = jQuery.timers, 7722 length = queue ? queue.length : 0; 7723 7724 // Enable finishing flag on private data 7725 data.finish = true; 7726 7727 // Empty the queue first 7728 jQuery.queue( this, type, [] ); 7729 7730 if ( hooks && hooks.stop ) { 7731 hooks.stop.call( this, true ); 7732 } 7733 7734 // Look for any active animations, and finish them 7735 for ( index = timers.length; index--; ) { 7736 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 7737 timers[ index ].anim.stop( true ); 7738 timers.splice( index, 1 ); 7739 } 7740 } 7741 7742 // Look for any animations in the old queue and finish them 7743 for ( index = 0; index < length; index++ ) { 7744 if ( queue[ index ] && queue[ index ].finish ) { 7745 queue[ index ].finish.call( this ); 7746 } 7747 } 7748 7749 // Turn off finishing flag 7750 delete data.finish; 7751 } ); 7752 } 7753} ); 7754 7755jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { 7756 var cssFn = jQuery.fn[ name ]; 7757 jQuery.fn[ name ] = function( speed, easing, callback ) { 7758 return speed == null || typeof speed === "boolean" ? 7759 cssFn.apply( this, arguments ) : 7760 this.animate( genFx( name, true ), speed, easing, callback ); 7761 }; 7762} ); 7763 7764// Generate shortcuts for custom animations 7765jQuery.each( { 7766 slideDown: genFx( "show" ), 7767 slideUp: genFx( "hide" ), 7768 slideToggle: genFx( "toggle" ), 7769 fadeIn: { opacity: "show" }, 7770 fadeOut: { opacity: "hide" }, 7771 fadeToggle: { opacity: "toggle" } 7772}, function( name, props ) { 7773 jQuery.fn[ name ] = function( speed, easing, callback ) { 7774 return this.animate( props, speed, easing, callback ); 7775 }; 7776} ); 7777 7778jQuery.timers = []; 7779jQuery.fx.tick = function() { 7780 var timer, 7781 i = 0, 7782 timers = jQuery.timers; 7783 7784 fxNow = Date.now(); 7785 7786 for ( ; i < timers.length; i++ ) { 7787 timer = timers[ i ]; 7788 7789 // Run the timer and safely remove it when done (allowing for external removal) 7790 if ( !timer() && timers[ i ] === timer ) { 7791 timers.splice( i--, 1 ); 7792 } 7793 } 7794 7795 if ( !timers.length ) { 7796 jQuery.fx.stop(); 7797 } 7798 fxNow = undefined; 7799}; 7800 7801jQuery.fx.timer = function( timer ) { 7802 jQuery.timers.push( timer ); 7803 jQuery.fx.start(); 7804}; 7805 7806jQuery.fx.interval = 13; 7807jQuery.fx.start = function() { 7808 if ( inProgress ) { 7809 return; 7810 } 7811 7812 inProgress = true; 7813 schedule(); 7814}; 7815 7816jQuery.fx.stop = function() { 7817 inProgress = null; 7818}; 7819 7820jQuery.fx.speeds = { 7821 slow: 600, 7822 fast: 200, 7823 7824 // Default speed 7825 _default: 400 7826}; 7827 7828 7829// Based off of the plugin by Clint Helfers, with permission.
vendor: 5,177 bytes, lines 7830-8050
7830jQuery.fn.delay = function( time, type ) { 7831 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 7832 type = type || "fx"; 7833 7834 return this.queue( type, function( next, hooks ) { 7835 var timeout = window.setTimeout( next, time ); 7836 hooks.stop = function() { 7837 window.clearTimeout( timeout ); 7838 }; 7839 } ); 7840}; 7841 7842 7843( function() { 7844 var input = document.createElement( "input" ), 7845 select = document.createElement( "select" ), 7846 opt = select.appendChild( document.createElement( "option" ) ); 7847 7848 input.type = "checkbox"; 7849 7850 // Support: Android <=4.3 only 7851 // Default value for a checkbox should be "on" 7852 support.checkOn = input.value !== ""; 7853 7854 // Support: IE <=11 only 7855 // Must access selectedIndex to make default options select 7856 support.optSelected = opt.selected; 7857 7858 // Support: IE <=11 only 7859 // An input loses its value after becoming a radio 7860 input = document.createElement( "input" ); 7861 input.value = "t"; 7862 input.type = "radio"; 7863 support.radioValue = input.value === "t"; 7864} )(); 7865 7866 7867var boolHook, 7868 attrHandle = jQuery.expr.attrHandle; 7869 7870jQuery.fn.extend( { 7871 attr: function( name, value ) { 7872 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 7873 }, 7874 7875 removeAttr: function( name ) { 7876 return this.each( function() { 7877 jQuery.removeAttr( this, name ); 7878 } ); 7879 } 7880} ); 7881 7882jQuery.extend( { 7883 attr: function( elem, name, value ) { 7884 var ret, hooks, 7885 nType = elem.nodeType; 7886 7887 // Don't get/set attributes on text, comment and attribute nodes 7888 if ( nType === 3 || nType === 8 || nType === 2 ) { 7889 return; 7890 } 7891 7892 // Fallback to prop when attributes are not supported 7893 if ( typeof elem.getAttribute === "undefined" ) { 7894 return jQuery.prop( elem, name, value ); 7895 } 7896 7897 // Attribute hooks are determined by the lowercase version 7898 // Grab necessary hook if one is defined 7899 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 7900 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 7901 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 7902 } 7903 7904 if ( value !== undefined ) { 7905 if ( value === null ) { 7906 jQuery.removeAttr( elem, name ); 7907 return; 7908 } 7909 7910 if ( hooks && "set" in hooks && 7911 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 7912 return ret; 7913 } 7914 7915 elem.setAttribute( name, value + "" ); 7916 return value; 7917 } 7918 7919 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 7920 return ret; 7921 } 7922 7923 ret = jQuery.find.attr( elem, name ); 7924 7925 // Non-existent attributes return null, we normalize to undefined 7926 return ret == null ? undefined : ret; 7927 }, 7928 7929 attrHooks: { 7930 type: { 7931 set: function( elem, value ) { 7932 if ( !support.radioValue && value === "radio" && 7933 nodeName( elem, "input" ) ) { 7934 var val = elem.value; 7935 elem.setAttribute( "type", value ); 7936 if ( val ) { 7937 elem.value = val; 7938 } 7939 return value; 7940 } 7941 } 7942 } 7943 }, 7944 7945 removeAttr: function( elem, value ) { 7946 var name, 7947 i = 0, 7948 7949 // Attribute names can contain non-HTML whitespace characters 7950 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 7951 attrNames = value && value.match( rnothtmlwhite ); 7952 7953 if ( attrNames && elem.nodeType === 1 ) { 7954 while ( ( name = attrNames[ i++ ] ) ) { 7955 elem.removeAttribute( name ); 7956 } 7957 } 7958 } 7959} ); 7960 7961// Hooks for boolean attributes 7962boolHook = { 7963 set: function( elem, value, name ) { 7964 if ( value === false ) { 7965 7966 // Remove boolean attributes when set to false 7967 jQuery.removeAttr( elem, name ); 7968 } else { 7969 elem.setAttribute( name, name ); 7970 } 7971 return name; 7972 } 7973}; 7974 7975jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { 7976 var getter = attrHandle[ name ] || jQuery.find.attr; 7977 7978 attrHandle[ name ] = function( elem, name, isXML ) { 7979 var ret, handle, 7980 lowercaseName = name.toLowerCase(); 7981 7982 if ( !isXML ) { 7983 7984 // Avoid an infinite loop by temporarily removing this function from the getter 7985 handle = attrHandle[ lowercaseName ]; 7986 attrHandle[ lowercaseName ] = ret; 7987 ret = getter( elem, name, isXML ) != null ? 7988 lowercaseName : 7989 null; 7990 attrHandle[ lowercaseName ] = handle; 7991 } 7992 return ret; 7993 }; 7994} ); 7995 7996 7997 7998 7999var rfocusable = /^(?:input|select|textarea|button)$/i, 8000 rclickable = /^(?:a|area)$/i; 8001 8002jQuery.fn.extend( { 8003 prop: function( name, value ) { 8004 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 8005 }, 8006 8007 removeProp: function( name ) { 8008 return this.each( function() { 8009 delete this[ jQuery.propFix[ name ] || name ]; 8010 } ); 8011 } 8012} ); 8013 8014jQuery.extend( { 8015 prop: function( elem, name, value ) { 8016 var ret, hooks, 8017 nType = elem.nodeType; 8018 8019 // Don't get/set properties on text, comment and attribute nodes 8020 if ( nType === 3 || nType === 8 || nType === 2 ) { 8021 return; 8022 } 8023 8024 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8025 8026 // Fix name and attach hooks 8027 name = jQuery.propFix[ name ] || name; 8028 hooks = jQuery.propHooks[ name ]; 8029 } 8030 8031 if ( value !== undefined ) { 8032 if ( hooks && "set" in hooks && 8033 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8034 return ret; 8035 } 8036 8037 return ( elem[ name ] = value ); 8038 } 8039 8040 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8041 return ret; 8042 } 8043 8044 return elem[ name ]; 8045 }, 8046 8047 propHooks: { 8048 tabIndex: { 8049 get: function( elem ) { 8050
vendor: 6,126 bytes, lines 8051-8310
8051 // Support: IE <=9 - 11 only 8052 // elem.tabIndex doesn't always return the 8053 // correct value when it hasn't been explicitly set 8054 // Use proper attribute retrieval (trac-12072) 8055 var tabindex = jQuery.find.attr( elem, "tabindex" ); 8056 8057 if ( tabindex ) { 8058 return parseInt( tabindex, 10 ); 8059 } 8060 8061 if ( 8062 rfocusable.test( elem.nodeName ) || 8063 rclickable.test( elem.nodeName ) && 8064 elem.href 8065 ) { 8066 return 0; 8067 } 8068 8069 return -1; 8070 } 8071 } 8072 }, 8073 8074 propFix: { 8075 "for": "htmlFor", 8076 "class": "className" 8077 } 8078} ); 8079 8080// Support: IE <=11 only 8081// Accessing the selectedIndex property 8082// forces the browser to respect setting selected 8083// on the option 8084// The getter ensures a default option is selected 8085// when in an optgroup 8086// eslint rule "no-unused-expressions" is disabled for this code 8087// since it considers such accessions noop 8088if ( !support.optSelected ) { 8089 jQuery.propHooks.selected = { 8090 get: function( elem ) { 8091 8092 /* eslint no-unused-expressions: "off" */ 8093 8094 var parent = elem.parentNode; 8095 if ( parent && parent.parentNode ) { 8096 parent.parentNode.selectedIndex; 8097 } 8098 return null; 8099 }, 8100 set: function( elem ) { 8101 8102 /* eslint no-unused-expressions: "off" */ 8103 8104 var parent = elem.parentNode; 8105 if ( parent ) { 8106 parent.selectedIndex; 8107 8108 if ( parent.parentNode ) { 8109 parent.parentNode.selectedIndex; 8110 } 8111 } 8112 } 8113 }; 8114} 8115 8116jQuery.each( [ 8117 "tabIndex", 8118 "readOnly", 8119 "maxLength", 8120 "cellSpacing", 8121 "cellPadding", 8122 "rowSpan", 8123 "colSpan", 8124 "useMap", 8125 "frameBorder", 8126 "contentEditable" 8127], function() { 8128 jQuery.propFix[ this.toLowerCase() ] = this; 8129} ); 8130 8131 8132 8133 8134 // Strip and collapse whitespace according to HTML spec 8135 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 8136 function stripAndCollapse( value ) { 8137 var tokens = value.match( rnothtmlwhite ) || []; 8138 return tokens.join( " " ); 8139 } 8140 8141 8142function getClass( elem ) { 8143 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 8144} 8145 8146function classesToArray( value ) { 8147 if ( Array.isArray( value ) ) { 8148 return value; 8149 } 8150 if ( typeof value === "string" ) { 8151 return value.match( rnothtmlwhite ) || []; 8152 } 8153 return []; 8154} 8155 8156jQuery.fn.extend( { 8157 addClass: function( value ) { 8158 var classNames, cur, curValue, className, i, finalValue; 8159 8160 if ( isFunction( value ) ) { 8161 return this.each( function( j ) { 8162 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 8163 } ); 8164 } 8165 8166 classNames = classesToArray( value ); 8167 8168 if ( classNames.length ) { 8169 return this.each( function() { 8170 curValue = getClass( this ); 8171 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8172 8173 if ( cur ) { 8174 for ( i = 0; i < classNames.length; i++ ) { 8175 className = classNames[ i ]; 8176 if ( cur.indexOf( " " + className + " " ) < 0 ) { 8177 cur += className + " "; 8178 } 8179 } 8180 8181 // Only assign if different to avoid unneeded rendering. 8182 finalValue = stripAndCollapse( cur ); 8183 if ( curValue !== finalValue ) { 8184 this.setAttribute( "class", finalValue ); 8185 } 8186 } 8187 } ); 8188 } 8189 8190 return this; 8191 }, 8192 8193 removeClass: function( value ) { 8194 var classNames, cur, curValue, className, i, finalValue; 8195 8196 if ( isFunction( value ) ) { 8197 return this.each( function( j ) { 8198 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 8199 } ); 8200 } 8201 8202 if ( !arguments.length ) { 8203 return this.attr( "class", "" ); 8204 } 8205 8206 classNames = classesToArray( value ); 8207 8208 if ( classNames.length ) { 8209 return this.each( function() { 8210 curValue = getClass( this ); 8211 8212 // This expression is here for better compressibility (see addClass) 8213 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8214 8215 if ( cur ) { 8216 for ( i = 0; i < classNames.length; i++ ) { 8217 className = classNames[ i ]; 8218 8219 // Remove *all* instances 8220 while ( cur.indexOf( " " + className + " " ) > -1 ) { 8221 cur = cur.replace( " " + className + " ", " " ); 8222 } 8223 } 8224 8225 // Only assign if different to avoid unneeded rendering. 8226 finalValue = stripAndCollapse( cur ); 8227 if ( curValue !== finalValue ) { 8228 this.setAttribute( "class", finalValue ); 8229 } 8230 } 8231 } ); 8232 } 8233 8234 return this; 8235 }, 8236 8237 toggleClass: function( value, stateVal ) { 8238 var classNames, className, i, self, 8239 type = typeof value, 8240 isValidValue = type === "string" || Array.isArray( value ); 8241 8242 if ( isFunction( value ) ) { 8243 return this.each( function( i ) { 8244 jQuery( this ).toggleClass( 8245 value.call( this, i, getClass( this ), stateVal ), 8246 stateVal 8247 ); 8248 } ); 8249 } 8250 8251 if ( typeof stateVal === "boolean" && isValidValue ) { 8252 return stateVal ? this.addClass( value ) : this.removeClass( value ); 8253 } 8254 8255 classNames = classesToArray( value ); 8256 8257 return this.each( function() { 8258 if ( isValidValue ) { 8259 8260 // Toggle individual class names 8261 self = jQuery( this ); 8262 8263 for ( i = 0; i < classNames.length; i++ ) { 8264 className = classNames[ i ]; 8265 8266 // Check each className given, space separated list 8267 if ( self.hasClass( className ) ) { 8268 self.removeClass( className ); 8269 } else { 8270 self.addClass( className ); 8271 } 8272 } 8273 8274 // Toggle whole class name 8275 } else if ( value === undefined || type === "boolean" ) { 8276 className = getClass( this ); 8277 if ( className ) { 8278 8279 // Store className if set 8280 dataPriv.set( this, "__className__", className ); 8281 } 8282 8283 // If the element has a class name or if we're passed `false`, 8284 // then remove the whole classname (if there was one, the above saved it). 8285 // Otherwise bring back whatever was previously saved (if anything), 8286 // falling back to the empty string if nothing was stored. 8287 if ( this.setAttribute ) { 8288 this.setAttribute( "class", 8289 className || value === false ? 8290 "" : 8291 dataPriv.get( this, "__className__" ) || "" 8292 ); 8293 } 8294 } 8295 } ); 8296 }, 8297 8298 hasClass: function( selector ) { 8299 var className, elem, 8300 i = 0; 8301 8302 className = " " + selector + " "; 8303 while ( ( elem = this[ i++ ] ) ) { 8304 if ( elem.nodeType === 1 && 8305 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 8306 return true; 8307 } 8308 } 8309 8310 return false;
vendor: 1,385 bytes, lines 8311-8380
8311 } 8312} ); 8313 8314 8315 8316 8317var rreturn = /\r/g; 8318 8319jQuery.fn.extend( { 8320 val: function( value ) { 8321 var hooks, ret, valueIsFunction, 8322 elem = this[ 0 ]; 8323 8324 if ( !arguments.length ) { 8325 if ( elem ) { 8326 hooks = jQuery.valHooks[ elem.type ] || 8327 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 8328 8329 if ( hooks && 8330 "get" in hooks && 8331 ( ret = hooks.get( elem, "value" ) ) !== undefined 8332 ) { 8333 return ret; 8334 } 8335 8336 ret = elem.value; 8337 8338 // Handle most common string cases 8339 if ( typeof ret === "string" ) { 8340 return ret.replace( rreturn, "" ); 8341 } 8342 8343 // Handle cases where value is null/undef or number 8344 return ret == null ? "" : ret; 8345 } 8346 8347 return; 8348 } 8349 8350 valueIsFunction = isFunction( value ); 8351 8352 return this.each( function( i ) { 8353 var val; 8354 8355 if ( this.nodeType !== 1 ) { 8356 return; 8357 } 8358 8359 if ( valueIsFunction ) { 8360 val = value.call( this, i, jQuery( this ).val() ); 8361 } else { 8362 val = value; 8363 } 8364 8365 // Treat null/undefined as ""; convert numbers to string 8366 if ( val == null ) { 8367 val = ""; 8368 8369 } else if ( typeof val === "number" ) { 8370 val += ""; 8371 8372 } else if ( Array.isArray( val ) ) { 8373 val = jQuery.map( val, function( value ) { 8374 return value == null ? "" : value + ""; 8375 } ); 8376 } 8377 8378 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 8379 8380 // If set returns undefined, fall back to normal setting
vendor: 4,458 bytes, lines 8381-8566
8381 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 8382 this.value = val; 8383 } 8384 } ); 8385 } 8386} ); 8387 8388jQuery.extend( { 8389 valHooks: { 8390 option: { 8391 get: function( elem ) { 8392 8393 var val = jQuery.find.attr( elem, "value" ); 8394 return val != null ? 8395 val : 8396 8397 // Support: IE <=10 - 11 only 8398 // option.text throws exceptions (trac-14686, trac-14858) 8399 // Strip and collapse whitespace 8400 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 8401 stripAndCollapse( jQuery.text( elem ) ); 8402 } 8403 }, 8404 select: { 8405 get: function( elem ) { 8406 var value, option, i, 8407 options = elem.options, 8408 index = elem.selectedIndex, 8409 one = elem.type === "select-one", 8410 values = one ? null : [], 8411 max = one ? index + 1 : options.length; 8412 8413 if ( index < 0 ) { 8414 i = max; 8415 8416 } else { 8417 i = one ? index : 0; 8418 } 8419 8420 // Loop through all the selected options 8421 for ( ; i < max; i++ ) { 8422 option = options[ i ]; 8423 8424 // Support: IE <=9 only 8425 // IE8-9 doesn't update selected after form reset (trac-2551) 8426 if ( ( option.selected || i === index ) && 8427 8428 // Don't return options that are disabled or in a disabled optgroup 8429 !option.disabled && 8430 ( !option.parentNode.disabled || 8431 !nodeName( option.parentNode, "optgroup" ) ) ) { 8432 8433 // Get the specific value for the option 8434 value = jQuery( option ).val(); 8435 8436 // We don't need an array for one selects 8437 if ( one ) { 8438 return value; 8439 } 8440 8441 // Multi-Selects return an array 8442 values.push( value ); 8443 } 8444 } 8445 8446 return values; 8447 }, 8448 8449 set: function( elem, value ) { 8450 var optionSet, option, 8451 options = elem.options, 8452 values = jQuery.makeArray( value ), 8453 i = options.length; 8454 8455 while ( i-- ) { 8456 option = options[ i ]; 8457 8458 /* eslint-disable no-cond-assign */ 8459 8460 if ( option.selected = 8461 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 8462 ) { 8463 optionSet = true; 8464 } 8465 8466 /* eslint-enable no-cond-assign */ 8467 } 8468 8469 // Force browsers to behave consistently when non-matching value is set 8470 if ( !optionSet ) { 8471 elem.selectedIndex = -1; 8472 } 8473 return values; 8474 } 8475 } 8476 } 8477} ); 8478 8479// Radios and checkboxes getter/setter 8480jQuery.each( [ "radio", "checkbox" ], function() { 8481 jQuery.valHooks[ this ] = { 8482 set: function( elem, value ) { 8483 if ( Array.isArray( value ) ) { 8484 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 8485 } 8486 } 8487 }; 8488 if ( !support.checkOn ) { 8489 jQuery.valHooks[ this ].get = function( elem ) { 8490 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 8491 }; 8492 } 8493} ); 8494 8495 8496 8497 8498// Return jQuery for attributes-only inclusion 8499var location = window.location; 8500 8501var nonce = { guid: Date.now() }; 8502 8503var rquery = ( /\?/ ); 8504 8505 8506 8507// Cross-browser xml parsing 8508jQuery.parseXML = function( data ) { 8509 var xml, parserErrorElem; 8510 if ( !data || typeof data !== "string" ) { 8511 return null; 8512 } 8513 8514 // Support: IE 9 - 11 only 8515 // IE throws on parseFromString with invalid input. 8516 try { 8517 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 8518 } catch ( e ) {} 8519 8520 parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; 8521 if ( !xml || parserErrorElem ) { 8522 jQuery.error( "Invalid XML: " + ( 8523 parserErrorElem ? 8524 jQuery.map( parserErrorElem.childNodes, function( el ) { 8525 return el.textContent; 8526 } ).join( "\n" ) : 8527 data 8528 ) ); 8529 } 8530 return xml; 8531}; 8532 8533 8534var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 8535 stopPropagationCallback = function( e ) { 8536 e.stopPropagation(); 8537 }; 8538 8539jQuery.extend( jQuery.event, { 8540 8541 trigger: function( event, data, elem, onlyHandlers ) { 8542 8543 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 8544 eventPath = [ elem || document ], 8545 type = hasOwn.call( event, "type" ) ? event.type : event, 8546 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 8547 8548 cur = lastElement = tmp = elem = elem || document; 8549 8550 // Don't do events on text and comment nodes 8551 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 8552 return; 8553 } 8554 8555 // focus/blur morphs to focusin/out; ensure we're not firing them right now 8556 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 8557 return; 8558 } 8559 8560 if ( type.indexOf( "." ) > -1 ) { 8561 8562 // Namespaced trigger; create a regexp to match event type in handle() 8563 namespaces = type.split( "." ); 8564 type = namespaces.shift(); 8565 namespaces.sort(); 8566 }
vendor: 6,524 bytes, lines 8567-8816
8567 ontype = type.indexOf( ":" ) < 0 && "on" + type; 8568 8569 // Caller can pass in a jQuery.Event object, Object, or just an event type string 8570 event = event[ jQuery.expando ] ? 8571 event : 8572 new jQuery.Event( type, typeof event === "object" && event ); 8573 8574 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 8575 event.isTrigger = onlyHandlers ? 2 : 3; 8576 event.namespace = namespaces.join( "." ); 8577 event.rnamespace = event.namespace ? 8578 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 8579 null; 8580 8581 // Clean up the event in case it is being reused 8582 event.result = undefined; 8583 if ( !event.target ) { 8584 event.target = elem; 8585 } 8586 8587 // Clone any incoming data and prepend the event, creating the handler arg list 8588 data = data == null ? 8589 [ event ] : 8590 jQuery.makeArray( data, [ event ] ); 8591 8592 // Allow special events to draw outside the lines 8593 special = jQuery.event.special[ type ] || {}; 8594 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 8595 return; 8596 } 8597 8598 // Determine event propagation path in advance, per W3C events spec (trac-9951) 8599 // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724) 8600 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 8601 8602 bubbleType = special.delegateType || type; 8603 if ( !rfocusMorph.test( bubbleType + type ) ) { 8604 cur = cur.parentNode; 8605 } 8606 for ( ; cur; cur = cur.parentNode ) { 8607 eventPath.push( cur ); 8608 tmp = cur; 8609 } 8610 8611 // Only add window if we got to document (e.g., not plain obj or detached DOM) 8612 if ( tmp === ( elem.ownerDocument || document ) ) { 8613 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 8614 } 8615 } 8616 8617 // Fire handlers on the event path 8618 i = 0; 8619 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 8620 lastElement = cur; 8621 event.type = i > 1 ? 8622 bubbleType : 8623 special.bindType || type; 8624 8625 // jQuery handler 8626 handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && 8627 dataPriv.get( cur, "handle" ); 8628 if ( handle ) { 8629 handle.apply( cur, data ); 8630 } 8631 8632 // Native handler 8633 handle = ontype && cur[ ontype ]; 8634 if ( handle && handle.apply && acceptData( cur ) ) { 8635 event.result = handle.apply( cur, data ); 8636 if ( event.result === false ) { 8637 event.preventDefault(); 8638 } 8639 } 8640 } 8641 event.type = type; 8642 8643 // If nobody prevented the default action, do it now 8644 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 8645 8646 if ( ( !special._default || 8647 special._default.apply( eventPath.pop(), data ) === false ) && 8648 acceptData( elem ) ) { 8649 8650 // Call a native DOM method on the target with the same name as the event. 8651 // Don't do default actions on window, that's where global variables be (trac-6170) 8652 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 8653 8654 // Don't re-trigger an onFOO event when we call its FOO() method 8655 tmp = elem[ ontype ]; 8656 8657 if ( tmp ) { 8658 elem[ ontype ] = null; 8659 } 8660 8661 // Prevent re-triggering of the same event, since we already bubbled it above 8662 jQuery.event.triggered = type; 8663 8664 if ( event.isPropagationStopped() ) { 8665 lastElement.addEventListener( type, stopPropagationCallback ); 8666 } 8667 8668 elem[ type ](); 8669 8670 if ( event.isPropagationStopped() ) { 8671 lastElement.removeEventListener( type, stopPropagationCallback ); 8672 } 8673 8674 jQuery.event.triggered = undefined; 8675 8676 if ( tmp ) { 8677 elem[ ontype ] = tmp; 8678 } 8679 } 8680 } 8681 } 8682 8683 return event.result; 8684 }, 8685 8686 // Piggyback on a donor event to simulate a different one 8687 // Used only for `focus(in | out)` events 8688 simulate: function( type, elem, event ) { 8689 var e = jQuery.extend( 8690 new jQuery.Event(), 8691 event, 8692 { 8693 type: type, 8694 isSimulated: true 8695 } 8696 ); 8697 8698 jQuery.event.trigger( e, null, elem ); 8699 } 8700 8701} ); 8702 8703jQuery.fn.extend( { 8704 8705 trigger: function( type, data ) { 8706 return this.each( function() { 8707 jQuery.event.trigger( type, data, this ); 8708 } ); 8709 }, 8710 triggerHandler: function( type, data ) { 8711 var elem = this[ 0 ]; 8712 if ( elem ) { 8713 return jQuery.event.trigger( type, data, elem, true ); 8714 } 8715 } 8716} ); 8717 8718 8719var 8720 rbracket = /\[\]$/, 8721 rCRLF = /\r?\n/g, 8722 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 8723 rsubmittable = /^(?:input|select|textarea|keygen)/i; 8724 8725function buildParams( prefix, obj, traditional, add ) { 8726 var name; 8727 8728 if ( Array.isArray( obj ) ) { 8729 8730 // Serialize array item. 8731 jQuery.each( obj, function( i, v ) { 8732 if ( traditional || rbracket.test( prefix ) ) { 8733 8734 // Treat each array item as a scalar. 8735 add( prefix, v ); 8736 8737 } else { 8738 8739 // Item is non-scalar (array or object), encode its numeric index. 8740 buildParams( 8741 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 8742 v, 8743 traditional, 8744 add 8745 ); 8746 } 8747 } ); 8748 8749 } else if ( !traditional && toType( obj ) === "object" ) { 8750 8751 // Serialize object item. 8752 for ( name in obj ) { 8753 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 8754 } 8755 8756 } else { 8757 8758 // Serialize scalar item. 8759 add( prefix, obj ); 8760 } 8761} 8762 8763// Serialize an array of form elements or a set of 8764// key/values into a query string 8765jQuery.param = function( a, traditional ) { 8766 var prefix, 8767 s = [], 8768 add = function( key, valueOrFunction ) { 8769 8770 // If value is a function, invoke it and use its return value 8771 var value = isFunction( valueOrFunction ) ? 8772 valueOrFunction() : 8773 valueOrFunction; 8774 8775 s[ s.length ] = encodeURIComponent( key ) + "=" + 8776 encodeURIComponent( value == null ? "" : value ); 8777 }; 8778 8779 if ( a == null ) { 8780 return ""; 8781 } 8782 8783 // If an array was passed in, assume that it is an array of form elements. 8784 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 8785 8786 // Serialize the form elements 8787 jQuery.each( a, function() { 8788 add( this.name, this.value ); 8789 } ); 8790 8791 } else { 8792 8793 // If traditional, encode the "old" way (the way 1.3.2 or older 8794 // did it), otherwise encode params recursively. 8795 for ( prefix in a ) { 8796 buildParams( prefix, a[ prefix ], traditional, add ); 8797 } 8798 } 8799 8800 // Return the resulting serialization 8801 return s.join( "&" ); 8802}; 8803 8804jQuery.fn.extend( { 8805 serialize: function() { 8806 return jQuery.param( this.serializeArray() ); 8807 }, 8808 serializeArray: function() { 8809 return this.map( function() { 8810 8811 // Can add propHook for "elements" to filter or add form elements 8812 var elements = jQuery.prop( this, "elements" ); 8813 return elements ? jQuery.makeArray( elements ) : this; 8814 } ).filter( function() { 8815 var type = this.type; 8816
vendor: 32,437 bytes, lines 8817-10070
8817 // Use .is( ":disabled" ) so that fieldset[disabled] works 8818 return this.name && !jQuery( this ).is( ":disabled" ) && 8819 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 8820 ( this.checked || !rcheckableType.test( type ) ); 8821 } ).map( function( _i, elem ) { 8822 var val = jQuery( this ).val(); 8823 8824 if ( val == null ) { 8825 return null; 8826 } 8827 8828 if ( Array.isArray( val ) ) { 8829 return jQuery.map( val, function( val ) { 8830 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 8831 } ); 8832 } 8833 8834 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 8835 } ).get(); 8836 } 8837} ); 8838 8839 8840var 8841 r20 = /%20/g, 8842 rhash = /#.*$/, 8843 rantiCache = /([?&])_=[^&]*/, 8844 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 8845 8846 // trac-7653, trac-8125, trac-8152: local protocol detection 8847 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 8848 rnoContent = /^(?:GET|HEAD)$/, 8849 rprotocol = /^\/\//, 8850 8851 /* Prefilters 8852 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 8853 * 2) These are called: 8854 * - BEFORE asking for a transport 8855 * - AFTER param serialization (s.data is a string if s.processData is true) 8856 * 3) key is the dataType 8857 * 4) the catchall symbol "*" can be used 8858 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 8859 */ 8860 prefilters = {}, 8861 8862 /* Transports bindings 8863 * 1) key is the dataType 8864 * 2) the catchall symbol "*" can be used 8865 * 3) selection will start with transport dataType and THEN go to "*" if needed 8866 */ 8867 transports = {}, 8868 8869 // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression 8870 allTypes = "*/".concat( "*" ), 8871 8872 // Anchor tag for parsing the document origin 8873 originAnchor = document.createElement( "a" ); 8874 8875originAnchor.href = location.href; 8876 8877// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 8878function addToPrefiltersOrTransports( structure ) { 8879 8880 // dataTypeExpression is optional and defaults to "*" 8881 return function( dataTypeExpression, func ) { 8882 8883 if ( typeof dataTypeExpression !== "string" ) { 8884 func = dataTypeExpression; 8885 dataTypeExpression = "*"; 8886 } 8887 8888 var dataType, 8889 i = 0, 8890 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 8891 8892 if ( isFunction( func ) ) { 8893 8894 // For each dataType in the dataTypeExpression 8895 while ( ( dataType = dataTypes[ i++ ] ) ) { 8896 8897 // Prepend if requested 8898 if ( dataType[ 0 ] === "+" ) { 8899 dataType = dataType.slice( 1 ) || "*"; 8900 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 8901 8902 // Otherwise append 8903 } else { 8904 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 8905 } 8906 } 8907 } 8908 }; 8909} 8910 8911// Base inspection function for prefilters and transports 8912function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 8913 8914 var inspected = {}, 8915 seekingTransport = ( structure === transports ); 8916 8917 function inspect( dataType ) { 8918 var selected; 8919 inspected[ dataType ] = true; 8920 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 8921 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 8922 if ( typeof dataTypeOrTransport === "string" && 8923 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 8924 8925 options.dataTypes.unshift( dataTypeOrTransport ); 8926 inspect( dataTypeOrTransport ); 8927 return false; 8928 } else if ( seekingTransport ) { 8929 return !( selected = dataTypeOrTransport ); 8930 } 8931 } ); 8932 return selected; 8933 } 8934 8935 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 8936} 8937 8938// A special extend for ajax options 8939// that takes "flat" options (not to be deep extended) 8940// Fixes trac-9887 8941function ajaxExtend( target, src ) { 8942 var key, deep, 8943 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 8944 8945 for ( key in src ) { 8946 if ( src[ key ] !== undefined ) { 8947 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 8948 } 8949 } 8950 if ( deep ) { 8951 jQuery.extend( true, target, deep ); 8952 } 8953 8954 return target; 8955} 8956 8957/* Handles responses to an ajax request: 8958 * - finds the right dataType (mediates between content-type and expected dataType) 8959 * - returns the corresponding response 8960 */ 8961function ajaxHandleResponses( s, jqXHR, responses ) { 8962 8963 var ct, type, finalDataType, firstDataType, 8964 contents = s.contents, 8965 dataTypes = s.dataTypes; 8966 8967 // Remove auto dataType and get content-type in the process 8968 while ( dataTypes[ 0 ] === "*" ) { 8969 dataTypes.shift(); 8970 if ( ct === undefined ) { 8971 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 8972 } 8973 } 8974 8975 // Check if we're dealing with a known content-type 8976 if ( ct ) { 8977 for ( type in contents ) { 8978 if ( contents[ type ] && contents[ type ].test( ct ) ) { 8979 dataTypes.unshift( type ); 8980 break; 8981 } 8982 } 8983 } 8984 8985 // Check to see if we have a response for the expected dataType 8986 if ( dataTypes[ 0 ] in responses ) { 8987 finalDataType = dataTypes[ 0 ]; 8988 } else { 8989 8990 // Try convertible dataTypes 8991 for ( type in responses ) { 8992 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 8993 finalDataType = type; 8994 break; 8995 } 8996 if ( !firstDataType ) { 8997 firstDataType = type; 8998 } 8999 } 9000 9001 // Or just use first one 9002 finalDataType = finalDataType || firstDataType; 9003 } 9004 9005 // If we found a dataType 9006 // We add the dataType to the list if needed 9007 // and return the corresponding response 9008 if ( finalDataType ) { 9009 if ( finalDataType !== dataTypes[ 0 ] ) { 9010 dataTypes.unshift( finalDataType ); 9011 } 9012 return responses[ finalDataType ]; 9013 } 9014} 9015 9016/* Chain conversions given the request and the original response 9017 * Also sets the responseXXX fields on the jqXHR instance 9018 */ 9019function ajaxConvert( s, response, jqXHR, isSuccess ) { 9020 var conv2, current, conv, tmp, prev, 9021 converters = {}, 9022 9023 // Work with a copy of dataTypes in case we need to modify it for conversion 9024 dataTypes = s.dataTypes.slice(); 9025 9026 // Create converters map with lowercased keys 9027 if ( dataTypes[ 1 ] ) { 9028 for ( conv in s.converters ) { 9029 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 9030 } 9031 } 9032 9033 current = dataTypes.shift(); 9034 9035 // Convert to each sequential dataType 9036 while ( current ) { 9037 9038 if ( s.responseFields[ current ] ) { 9039 jqXHR[ s.responseFields[ current ] ] = response; 9040 } 9041 9042 // Apply the dataFilter if provided 9043 if ( !prev && isSuccess && s.dataFilter ) { 9044 response = s.dataFilter( response, s.dataType ); 9045 } 9046 9047 prev = current; 9048 current = dataTypes.shift(); 9049 9050 if ( current ) { 9051 9052 // There's only work to do if current dataType is non-auto 9053 if ( current === "*" ) { 9054 9055 current = prev; 9056 9057 // Convert response if prev dataType is non-auto and differs from current 9058 } else if ( prev !== "*" && prev !== current ) { 9059 9060 // Seek a direct converter 9061 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 9062 9063 // If none found, seek a pair 9064 if ( !conv ) { 9065 for ( conv2 in converters ) { 9066 9067 // If conv2 outputs current 9068 tmp = conv2.split( " " ); 9069 if ( tmp[ 1 ] === current ) { 9070 9071 // If prev can be converted to accepted input 9072 conv = converters[ prev + " " + tmp[ 0 ] ] || 9073 converters[ "* " + tmp[ 0 ] ]; 9074 if ( conv ) { 9075 9076 // Condense equivalence converters 9077 if ( conv === true ) { 9078 conv = converters[ conv2 ]; 9079 9080 // Otherwise, insert the intermediate dataType 9081 } else if ( converters[ conv2 ] !== true ) { 9082 current = tmp[ 0 ]; 9083 dataTypes.unshift( tmp[ 1 ] ); 9084 } 9085 break; 9086 } 9087 } 9088 } 9089 } 9090 9091 // Apply converter (if not an equivalence) 9092 if ( conv !== true ) { 9093 9094 // Unless errors are allowed to bubble, catch and return them 9095 if ( conv && s.throws ) { 9096 response = conv( response ); 9097 } else { 9098 try { 9099 response = conv( response ); 9100 } catch ( e ) { 9101 return { 9102 state: "parsererror", 9103 error: conv ? e : "No conversion from " + prev + " to " + current 9104 }; 9105 } 9106 } 9107 } 9108 } 9109 } 9110 } 9111 9112 return { state: "success", data: response }; 9113} 9114 9115jQuery.extend( { 9116 9117 // Counter for holding the number of active queries 9118 active: 0, 9119 9120 // Last-Modified header cache for next request 9121 lastModified: {}, 9122 etag: {}, 9123 9124 ajaxSettings: { 9125 url: location.href, 9126 type: "GET", 9127 isLocal: rlocalProtocol.test( location.protocol ), 9128 global: true, 9129 processData: true, 9130 async: true, 9131 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 9132 9133 /* 9134 timeout: 0, 9135 data: null, 9136 dataType: null, 9137 username: null, 9138 password: null, 9139 cache: null, 9140 throws: false, 9141 traditional: false, 9142 headers: {}, 9143 */ 9144 9145 accepts: { 9146 "*": allTypes, 9147 text: "text/plain", 9148 html: "text/html", 9149 xml: "application/xml, text/xml", 9150 json: "application/json, text/javascript" 9151 }, 9152 9153 contents: { 9154 xml: /\bxml\b/, 9155 html: /\bhtml/, 9156 json: /\bjson\b/ 9157 }, 9158 9159 responseFields: { 9160 xml: "responseXML", 9161 text: "responseText", 9162 json: "responseJSON" 9163 }, 9164 9165 // Data converters 9166 // Keys separate source (or catchall "*") and destination types with a single space 9167 converters: { 9168 9169 // Convert anything to text 9170 "* text": String, 9171 9172 // Text to html (true = no transformation) 9173 "text html": true, 9174 9175 // Evaluate text as a json expression 9176 "text json": JSON.parse, 9177 9178 // Parse text as xml 9179 "text xml": jQuery.parseXML 9180 }, 9181 9182 // For options that shouldn't be deep extended: 9183 // you can add your own custom options here if 9184 // and when you create one that shouldn't be 9185 // deep extended (see ajaxExtend) 9186 flatOptions: { 9187 url: true, 9188 context: true 9189 } 9190 }, 9191 9192 // Creates a full fledged settings object into target 9193 // with both ajaxSettings and settings fields. 9194 // If target is omitted, writes into ajaxSettings. 9195 ajaxSetup: function( target, settings ) { 9196 return settings ? 9197 9198 // Building a settings object 9199 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 9200 9201 // Extending ajaxSettings 9202 ajaxExtend( jQuery.ajaxSettings, target ); 9203 }, 9204 9205 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 9206 ajaxTransport: addToPrefiltersOrTransports( transports ), 9207 9208 // Main method 9209 ajax: function( url, options ) { 9210 9211 // If url is an object, simulate pre-1.5 signature 9212 if ( typeof url === "object" ) { 9213 options = url; 9214 url = undefined; 9215 } 9216 9217 // Force options to be an object 9218 options = options || {}; 9219 9220 var transport, 9221 9222 // URL without anti-cache param 9223 cacheURL, 9224 9225 // Response headers 9226 responseHeadersString, 9227 responseHeaders, 9228 9229 // timeout handle 9230 timeoutTimer, 9231 9232 // Url cleanup var 9233 urlAnchor, 9234 9235 // Request state (becomes false upon send and true upon completion) 9236 completed, 9237 9238 // To know if global events are to be dispatched 9239 fireGlobals, 9240 9241 // Loop variable 9242 i, 9243 9244 // uncached part of the url 9245 uncached, 9246 9247 // Create the final options object 9248 s = jQuery.ajaxSetup( {}, options ), 9249 9250 // Callbacks context 9251 callbackContext = s.context || s, 9252 9253 // Context for global events is callbackContext if it is a DOM node or jQuery collection 9254 globalEventContext = s.context && 9255 ( callbackContext.nodeType || callbackContext.jquery ) ? 9256 jQuery( callbackContext ) : 9257 jQuery.event, 9258 9259 // Deferreds 9260 deferred = jQuery.Deferred(), 9261 completeDeferred = jQuery.Callbacks( "once memory" ), 9262 9263 // Status-dependent callbacks 9264 statusCode = s.statusCode || {}, 9265 9266 // Headers (they are sent all at once) 9267 requestHeaders = {}, 9268 requestHeadersNames = {}, 9269 9270 // Default abort message 9271 strAbort = "canceled", 9272 9273 // Fake xhr 9274 jqXHR = { 9275 readyState: 0, 9276 9277 // Builds headers hashtable if needed 9278 getResponseHeader: function( key ) { 9279 var match; 9280 if ( completed ) { 9281 if ( !responseHeaders ) { 9282 responseHeaders = {}; 9283 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 9284 responseHeaders[ match[ 1 ].toLowerCase() + " " ] = 9285 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) 9286 .concat( match[ 2 ] ); 9287 } 9288 } 9289 match = responseHeaders[ key.toLowerCase() + " " ]; 9290 } 9291 return match == null ? null : match.join( ", " ); 9292 }, 9293 9294 // Raw string 9295 getAllResponseHeaders: function() { 9296 return completed ? responseHeadersString : null; 9297 }, 9298 9299 // Caches the header 9300 setRequestHeader: function( name, value ) { 9301 if ( completed == null ) { 9302 name = requestHeadersNames[ name.toLowerCase() ] = 9303 requestHeadersNames[ name.toLowerCase() ] || name; 9304 requestHeaders[ name ] = value; 9305 } 9306 return this; 9307 }, 9308 9309 // Overrides response content-type header 9310 overrideMimeType: function( type ) { 9311 if ( completed == null ) { 9312 s.mimeType = type; 9313 } 9314 return this; 9315 }, 9316 9317 // Status-dependent callbacks 9318 statusCode: function( map ) { 9319 var code; 9320 if ( map ) { 9321 if ( completed ) { 9322 9323 // Execute the appropriate callbacks 9324 jqXHR.always( map[ jqXHR.status ] ); 9325 } else { 9326 9327 // Lazy-add the new callbacks in a way that preserves old ones 9328 for ( code in map ) { 9329 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 9330 } 9331 } 9332 } 9333 return this; 9334 }, 9335 9336 // Cancel the request 9337 abort: function( statusText ) { 9338 var finalText = statusText || strAbort; 9339 if ( transport ) { 9340 transport.abort( finalText ); 9341 } 9342 done( 0, finalText ); 9343 return this; 9344 } 9345 }; 9346 9347 // Attach deferreds 9348 deferred.promise( jqXHR ); 9349 9350 // Add protocol if not provided (prefilters might expect it) 9351 // Handle falsy url in the settings object (trac-10093: consistency with old signature) 9352 // We also use the url parameter if available 9353 s.url = ( ( url || s.url || location.href ) + "" ) 9354 .replace( rprotocol, location.protocol + "//" ); 9355 9356 // Alias method option to type as per ticket trac-12004 9357 s.type = options.method || options.type || s.method || s.type; 9358 9359 // Extract dataTypes list 9360 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 9361 9362 // A cross-domain request is in order when the origin doesn't match the current origin. 9363 if ( s.crossDomain == null ) { 9364 urlAnchor = document.createElement( "a" ); 9365 9366 // Support: IE <=8 - 11, Edge 12 - 15 9367 // IE throws exception on accessing the href property if url is malformed, 9368 // e.g. http://example.com:80x/ 9369 try { 9370 urlAnchor.href = s.url; 9371 9372 // Support: IE <=8 - 11 only 9373 // Anchor's host property isn't correctly set when s.url is relative 9374 urlAnchor.href = urlAnchor.href; 9375 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 9376 urlAnchor.protocol + "//" + urlAnchor.host; 9377 } catch ( e ) { 9378 9379 // If there is an error parsing the URL, assume it is crossDomain, 9380 // it can be rejected by the transport if it is invalid 9381 s.crossDomain = true; 9382 } 9383 } 9384 9385 // Convert data if not already a string 9386 if ( s.data && s.processData && typeof s.data !== "string" ) { 9387 s.data = jQuery.param( s.data, s.traditional ); 9388 } 9389 9390 // Apply prefilters 9391 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 9392 9393 // If request was aborted inside a prefilter, stop there 9394 if ( completed ) { 9395 return jqXHR; 9396 } 9397 9398 // We can fire global events as of now if asked to 9399 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118) 9400 fireGlobals = jQuery.event && s.global; 9401 9402 // Watch for a new set of requests 9403 if ( fireGlobals && jQuery.active++ === 0 ) { 9404 jQuery.event.trigger( "ajaxStart" ); 9405 } 9406 9407 // Uppercase the type 9408 s.type = s.type.toUpperCase(); 9409 9410 // Determine if request has content 9411 s.hasContent = !rnoContent.test( s.type ); 9412 9413 // Save the URL in case we're toying with the If-Modified-Since 9414 // and/or If-None-Match header later on 9415 // Remove hash to simplify url manipulation 9416 cacheURL = s.url.replace( rhash, "" ); 9417 9418 // More options handling for requests with no content 9419 if ( !s.hasContent ) { 9420 9421 // Remember the hash so we can put it back 9422 uncached = s.url.slice( cacheURL.length ); 9423 9424 // If data is available and should be processed, append data to url 9425 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 9426 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 9427 9428 // trac-9682: remove data so that it's not used in an eventual retry 9429 delete s.data; 9430 } 9431 9432 // Add or update anti-cache param if needed 9433 if ( s.cache === false ) { 9434 cacheURL = cacheURL.replace( rantiCache, "$1" ); 9435 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + 9436 uncached; 9437 } 9438 9439 // Put hash and anti-cache on the URL that will be requested (gh-1732) 9440 s.url = cacheURL + uncached; 9441 9442 // Change '%20' to '+' if this is encoded form body content (gh-2658) 9443 } else if ( s.data && s.processData && 9444 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 9445 s.data = s.data.replace( r20, "+" ); 9446 } 9447 9448 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9449 if ( s.ifModified ) { 9450 if ( jQuery.lastModified[ cacheURL ] ) { 9451 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 9452 } 9453 if ( jQuery.etag[ cacheURL ] ) { 9454 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 9455 } 9456 } 9457 9458 // Set the correct header, if data is being sent 9459 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 9460 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 9461 } 9462 9463 // Set the Accepts header for the server, depending on the dataType 9464 jqXHR.setRequestHeader( 9465 "Accept", 9466 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 9467 s.accepts[ s.dataTypes[ 0 ] ] + 9468 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 9469 s.accepts[ "*" ] 9470 ); 9471 9472 // Check for headers option 9473 for ( i in s.headers ) { 9474 jqXHR.setRequestHeader( i, s.headers[ i ] ); 9475 } 9476 9477 // Allow custom headers/mimetypes and early abort 9478 if ( s.beforeSend && 9479 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 9480 9481 // Abort if not done already and return 9482 return jqXHR.abort(); 9483 } 9484 9485 // Aborting is no longer a cancellation 9486 strAbort = "abort"; 9487 9488 // Install callbacks on deferreds 9489 completeDeferred.add( s.complete ); 9490 jqXHR.done( s.success ); 9491 jqXHR.fail( s.error ); 9492 9493 // Get transport 9494 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 9495 9496 // If no transport, we auto-abort 9497 if ( !transport ) { 9498 done( -1, "No Transport" ); 9499 } else { 9500 jqXHR.readyState = 1; 9501 9502 // Send global event 9503 if ( fireGlobals ) { 9504 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 9505 } 9506 9507 // If request was aborted inside ajaxSend, stop there 9508 if ( completed ) { 9509 return jqXHR; 9510 } 9511 9512 // Timeout 9513 if ( s.async && s.timeout > 0 ) { 9514 timeoutTimer = window.setTimeout( function() { 9515 jqXHR.abort( "timeout" ); 9516 }, s.timeout ); 9517 } 9518 9519 try { 9520 completed = false; 9521 transport.send( requestHeaders, done ); 9522 } catch ( e ) { 9523 9524 // Rethrow post-completion exceptions 9525 if ( completed ) { 9526 throw e; 9527 } 9528 9529 // Propagate others as results 9530 done( -1, e ); 9531 } 9532 } 9533 9534 // Callback for when everything is done 9535 function done( status, nativeStatusText, responses, headers ) { 9536 var isSuccess, success, error, response, modified, 9537 statusText = nativeStatusText; 9538 9539 // Ignore repeat invocations 9540 if ( completed ) { 9541 return; 9542 } 9543 9544 completed = true; 9545 9546 // Clear timeout if it exists 9547 if ( timeoutTimer ) { 9548 window.clearTimeout( timeoutTimer ); 9549 } 9550 9551 // Dereference transport for early garbage collection 9552 // (no matter how long the jqXHR object will be used) 9553 transport = undefined; 9554 9555 // Cache response headers 9556 responseHeadersString = headers || ""; 9557 9558 // Set readyState 9559 jqXHR.readyState = status > 0 ? 4 : 0; 9560 9561 // Determine if successful 9562 isSuccess = status >= 200 && status < 300 || status === 304; 9563 9564 // Get response data 9565 if ( responses ) { 9566 response = ajaxHandleResponses( s, jqXHR, responses ); 9567 } 9568 9569 // Use a noop converter for missing script but not if jsonp 9570 if ( !isSuccess && 9571 jQuery.inArray( "script", s.dataTypes ) > -1 && 9572 jQuery.inArray( "json", s.dataTypes ) < 0 ) { 9573 s.converters[ "text script" ] = function() {}; 9574 } 9575 9576 // Convert no matter what (that way responseXXX fields are always set) 9577 response = ajaxConvert( s, response, jqXHR, isSuccess ); 9578 9579 // If successful, handle type chaining 9580 if ( isSuccess ) { 9581 9582 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9583 if ( s.ifModified ) { 9584 modified = jqXHR.getResponseHeader( "Last-Modified" ); 9585 if ( modified ) { 9586 jQuery.lastModified[ cacheURL ] = modified; 9587 } 9588 modified = jqXHR.getResponseHeader( "etag" ); 9589 if ( modified ) { 9590 jQuery.etag[ cacheURL ] = modified; 9591 } 9592 } 9593 9594 // if no content 9595 if ( status === 204 || s.type === "HEAD" ) { 9596 statusText = "nocontent"; 9597 9598 // if not modified 9599 } else if ( status === 304 ) { 9600 statusText = "notmodified"; 9601 9602 // If we have data, let's convert it 9603 } else { 9604 statusText = response.state; 9605 success = response.data; 9606 error = response.error; 9607 isSuccess = !error; 9608 } 9609 } else { 9610 9611 // Extract error from statusText and normalize for non-aborts 9612 error = statusText; 9613 if ( status || !statusText ) { 9614 statusText = "error"; 9615 if ( status < 0 ) { 9616 status = 0; 9617 } 9618 } 9619 } 9620 9621 // Set data for the fake xhr object 9622 jqXHR.status = status; 9623 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 9624 9625 // Success/Error 9626 if ( isSuccess ) { 9627 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 9628 } else { 9629 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 9630 } 9631 9632 // Status-dependent callbacks 9633 jqXHR.statusCode( statusCode ); 9634 statusCode = undefined; 9635 9636 if ( fireGlobals ) { 9637 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 9638 [ jqXHR, s, isSuccess ? success : error ] ); 9639 } 9640 9641 // Complete 9642 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 9643 9644 if ( fireGlobals ) { 9645 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 9646 9647 // Handle the global AJAX counter 9648 if ( !( --jQuery.active ) ) { 9649 jQuery.event.trigger( "ajaxStop" ); 9650 } 9651 } 9652 } 9653 9654 return jqXHR; 9655 }, 9656 9657 getJSON: function( url, data, callback ) { 9658 return jQuery.get( url, data, callback, "json" ); 9659 }, 9660 9661 getScript: function( url, callback ) { 9662 return jQuery.get( url, undefined, callback, "script" ); 9663 } 9664} ); 9665 9666jQuery.each( [ "get", "post" ], function( _i, method ) { 9667 jQuery[ method ] = function( url, data, callback, type ) { 9668 9669 // Shift arguments if data argument was omitted 9670 if ( isFunction( data ) ) { 9671 type = type || callback; 9672 callback = data; 9673 data = undefined; 9674 } 9675 9676 // The url can be an options object (which then must have .url) 9677 return jQuery.ajax( jQuery.extend( { 9678 url: url, 9679 type: method, 9680 dataType: type, 9681 data: data, 9682 success: callback 9683 }, jQuery.isPlainObject( url ) && url ) ); 9684 }; 9685} ); 9686 9687jQuery.ajaxPrefilter( function( s ) { 9688 var i; 9689 for ( i in s.headers ) { 9690 if ( i.toLowerCase() === "content-type" ) { 9691 s.contentType = s.headers[ i ] || ""; 9692 } 9693 } 9694} ); 9695 9696 9697jQuery._evalUrl = function( url, options, doc ) { 9698 return jQuery.ajax( { 9699 url: url, 9700 9701 // Make this explicit, since user can override this through ajaxSetup (trac-11264) 9702 type: "GET", 9703 dataType: "script", 9704 cache: true, 9705 async: false, 9706 global: false, 9707 9708 // Only evaluate the response if it is successful (gh-4126) 9709 // dataFilter is not invoked for failure responses, so using it instead 9710 // of the default converter is kludgy but it works. 9711 converters: { 9712 "text script": function() {} 9713 }, 9714 dataFilter: function( response ) { 9715 jQuery.globalEval( response, options, doc ); 9716 } 9717 } ); 9718}; 9719 9720 9721jQuery.fn.extend( { 9722 wrapAll: function( html ) { 9723 var wrap; 9724 9725 if ( this[ 0 ] ) { 9726 if ( isFunction( html ) ) { 9727 html = html.call( this[ 0 ] ); 9728 } 9729 9730 // The elements to wrap the target around 9731 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 9732 9733 if ( this[ 0 ].parentNode ) { 9734 wrap.insertBefore( this[ 0 ] ); 9735 } 9736 9737 wrap.map( function() { 9738 var elem = this; 9739 9740 while ( elem.firstElementChild ) { 9741 elem = elem.firstElementChild; 9742 } 9743 9744 return elem; 9745 } ).append( this ); 9746 } 9747 9748 return this; 9749 }, 9750 9751 wrapInner: function( html ) { 9752 if ( isFunction( html ) ) { 9753 return this.each( function( i ) { 9754 jQuery( this ).wrapInner( html.call( this, i ) ); 9755 } ); 9756 } 9757 9758 return this.each( function() { 9759 var self = jQuery( this ), 9760 contents = self.contents(); 9761 9762 if ( contents.length ) { 9763 contents.wrapAll( html ); 9764 9765 } else { 9766 self.append( html ); 9767 } 9768 } ); 9769 }, 9770 9771 wrap: function( html ) { 9772 var htmlIsFunction = isFunction( html ); 9773 9774 return this.each( function( i ) { 9775 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 9776 } ); 9777 }, 9778 9779 unwrap: function( selector ) { 9780 this.parent( selector ).not( "body" ).each( function() { 9781 jQuery( this ).replaceWith( this.childNodes ); 9782 } ); 9783 return this; 9784 } 9785} ); 9786 9787 9788jQuery.expr.pseudos.hidden = function( elem ) { 9789 return !jQuery.expr.pseudos.visible( elem ); 9790}; 9791jQuery.expr.pseudos.visible = function( elem ) { 9792 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 9793}; 9794 9795 9796 9797 9798jQuery.ajaxSettings.xhr = function() { 9799 try { 9800 return new window.XMLHttpRequest(); 9801 } catch ( e ) {} 9802}; 9803 9804var xhrSuccessStatus = { 9805 9806 // File protocol always yields status code 0, assume 200 9807 0: 200, 9808 9809 // Support: IE <=9 only 9810 // trac-1450: sometimes IE returns 1223 when it should be 204 9811 1223: 204 9812 }, 9813 xhrSupported = jQuery.ajaxSettings.xhr(); 9814 9815support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 9816support.ajax = xhrSupported = !!xhrSupported; 9817 9818jQuery.ajaxTransport( function( options ) { 9819 var callback, errorCallback; 9820 9821 // Cross domain only allowed if supported through XMLHttpRequest 9822 if ( support.cors || xhrSupported && !options.crossDomain ) { 9823 return { 9824 send: function( headers, complete ) { 9825 var i, 9826 xhr = options.xhr(); 9827 9828 xhr.open( 9829 options.type, 9830 options.url, 9831 options.async, 9832 options.username, 9833 options.password 9834 ); 9835 9836 // Apply custom fields if provided 9837 if ( options.xhrFields ) { 9838 for ( i in options.xhrFields ) { 9839 xhr[ i ] = options.xhrFields[ i ]; 9840 } 9841 } 9842 9843 // Override mime type if needed 9844 if ( options.mimeType && xhr.overrideMimeType ) { 9845 xhr.overrideMimeType( options.mimeType ); 9846 } 9847 9848 // X-Requested-With header 9849 // For cross-domain requests, seeing as conditions for a preflight are 9850 // akin to a jigsaw puzzle, we simply never set it to be sure. 9851 // (it can always be set on a per-request basis or even using ajaxSetup) 9852 // For same-domain requests, won't change header if already provided. 9853 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 9854 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 9855 } 9856 9857 // Set headers 9858 for ( i in headers ) { 9859 xhr.setRequestHeader( i, headers[ i ] ); 9860 } 9861 9862 // Callback 9863 callback = function( type ) { 9864 return function() { 9865 if ( callback ) { 9866 callback = errorCallback = xhr.onload = 9867 xhr.onerror = xhr.onabort = xhr.ontimeout = 9868 xhr.onreadystatechange = null; 9869 9870 if ( type === "abort" ) { 9871 xhr.abort(); 9872 } else if ( type === "error" ) { 9873 9874 // Support: IE <=9 only 9875 // On a manual native abort, IE9 throws 9876 // errors on any property access that is not readyState 9877 if ( typeof xhr.status !== "number" ) { 9878 complete( 0, "error" ); 9879 } else { 9880 complete( 9881 9882 // File: protocol always yields status 0; see trac-8605, trac-14207 9883 xhr.status, 9884 xhr.statusText 9885 ); 9886 } 9887 } else { 9888 complete( 9889 xhrSuccessStatus[ xhr.status ] || xhr.status, 9890 xhr.statusText, 9891 9892 // Support: IE <=9 only 9893 // IE9 has no XHR2 but throws on binary (trac-11426) 9894 // For XHR2 non-text, let the caller handle it (gh-2498) 9895 ( xhr.responseType || "text" ) !== "text" || 9896 typeof xhr.responseText !== "string" ? 9897 { binary: xhr.response } : 9898 { text: xhr.responseText }, 9899 xhr.getAllResponseHeaders() 9900 ); 9901 } 9902 } 9903 }; 9904 }; 9905 9906 // Listen to events 9907 xhr.onload = callback(); 9908 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 9909 9910 // Support: IE 9 only 9911 // Use onreadystatechange to replace onabort 9912 // to handle uncaught aborts 9913 if ( xhr.onabort !== undefined ) { 9914 xhr.onabort = errorCallback; 9915 } else { 9916 xhr.onreadystatechange = function() { 9917 9918 // Check readyState before timeout as it changes 9919 if ( xhr.readyState === 4 ) { 9920 9921 // Allow onerror to be called first, 9922 // but that will not handle a native abort 9923 // Also, save errorCallback to a variable 9924 // as xhr.onerror cannot be accessed 9925 window.setTimeout( function() { 9926 if ( callback ) { 9927 errorCallback(); 9928 } 9929 } ); 9930 } 9931 }; 9932 } 9933 9934 // Create the abort callback 9935 callback = callback( "abort" ); 9936 9937 try { 9938 9939 // Do send the request (this may raise an exception) 9940 xhr.send( options.hasContent && options.data || null ); 9941 } catch ( e ) { 9942 9943 // trac-14683: Only rethrow if this hasn't been notified as an error yet 9944 if ( callback ) { 9945 throw e; 9946 } 9947 } 9948 }, 9949 9950 abort: function() { 9951 if ( callback ) { 9952 callback(); 9953 } 9954 } 9955 }; 9956 } 9957} ); 9958 9959 9960 9961 9962// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 9963jQuery.ajaxPrefilter( function( s ) { 9964 if ( s.crossDomain ) { 9965 s.contents.script = false; 9966 } 9967} ); 9968 9969// Install script dataType 9970jQuery.ajaxSetup( { 9971 accepts: { 9972 script: "text/javascript, application/javascript, " + 9973 "application/ecmascript, application/x-ecmascript" 9974 }, 9975 contents: { 9976 script: /\b(?:java|ecma)script\b/ 9977 }, 9978 converters: { 9979 "text script": function( text ) { 9980 jQuery.globalEval( text ); 9981 return text; 9982 } 9983 } 9984} ); 9985 9986// Handle cache's special case and crossDomain 9987jQuery.ajaxPrefilter( "script", function( s ) { 9988 if ( s.cache === undefined ) { 9989 s.cache = false; 9990 } 9991 if ( s.crossDomain ) { 9992 s.type = "GET"; 9993 } 9994} ); 9995 9996// Bind script tag hack transport 9997jQuery.ajaxTransport( "script", function( s ) { 9998 9999 // This transport only deals with cross domain or forced-by-attrs requests 10000 if ( s.crossDomain || s.scriptAttrs ) { 10001 var script, callback; 10002 return { 10003 send: function( _, complete ) { 10004 script = jQuery( "<script>" ) 10005 .attr( s.scriptAttrs || {} ) 10006 .prop( { charset: s.scriptCharset, src: s.url } ) 10007 .on( "load error", callback = function( evt ) { 10008 script.remove(); 10009 callback = null; 10010 if ( evt ) { 10011 complete( evt.type === "error" ? 404 : 200, evt.type ); 10012 } 10013 } ); 10014 10015 // Use native DOM manipulation to avoid our domManip AJAX trickery 10016 document.head.appendChild( script[ 0 ] ); 10017 }, 10018 abort: function() { 10019 if ( callback ) { 10020 callback(); 10021 } 10022 } 10023 }; 10024 } 10025} ); 10026 10027 10028 10029 10030var oldCallbacks = [], 10031 rjsonp = /(=)\?(?=&|$)|\?\?/; 10032 10033// Default jsonp settings 10034jQuery.ajaxSetup( { 10035 jsonp: "callback", 10036 jsonpCallback: function() { 10037 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) ); 10038 this[ callback ] = true; 10039 return callback; 10040 } 10041} ); 10042 10043// Detect, normalize options and install callbacks for jsonp requests 10044jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 10045 10046 var callbackName, overwritten, responseContainer, 10047 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 10048 "url" : 10049 typeof s.data === "string" && 10050 ( s.contentType || "" ) 10051 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 10052 rjsonp.test( s.data ) && "data" 10053 ); 10054 10055 // Handle iff the expected data type is "jsonp" or we have a parameter to set 10056 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 10057 10058 // Get callback name, remembering preexisting value associated with it 10059 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 10060 s.jsonpCallback() : 10061 s.jsonpCallback; 10062 10063 // Insert callback into url or form data 10064 if ( jsonProp ) { 10065 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 10066 } else if ( s.jsonp !== false ) { 10067 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 10068 } 10069 10070 // Use data converter to retrieve json after script execution
vendor: 8,362 bytes, lines 10071-10382
10071 s.converters[ "script json" ] = function() { 10072 if ( !responseContainer ) { 10073 jQuery.error( callbackName + " was not called" ); 10074 } 10075 return responseContainer[ 0 ]; 10076 }; 10077 10078 // Force json dataType 10079 s.dataTypes[ 0 ] = "json"; 10080 10081 // Install callback 10082 overwritten = window[ callbackName ]; 10083 window[ callbackName ] = function() { 10084 responseContainer = arguments; 10085 }; 10086 10087 // Clean-up function (fires after converters) 10088 jqXHR.always( function() { 10089 10090 // If previous value didn't exist - remove it 10091 if ( overwritten === undefined ) { 10092 jQuery( window ).removeProp( callbackName ); 10093 10094 // Otherwise restore preexisting value 10095 } else { 10096 window[ callbackName ] = overwritten; 10097 } 10098 10099 // Save back as free 10100 if ( s[ callbackName ] ) { 10101 10102 // Make sure that re-using the options doesn't screw things around 10103 s.jsonpCallback = originalSettings.jsonpCallback; 10104 10105 // Save the callback name for future use 10106 oldCallbacks.push( callbackName ); 10107 } 10108 10109 // Call if it was a function and we have a response 10110 if ( responseContainer && isFunction( overwritten ) ) { 10111 overwritten( responseContainer[ 0 ] ); 10112 } 10113 10114 responseContainer = overwritten = undefined; 10115 } ); 10116 10117 // Delegate to script 10118 return "script"; 10119 } 10120} ); 10121 10122 10123 10124 10125// Support: Safari 8 only 10126// In Safari 8 documents created via document.implementation.createHTMLDocument 10127// collapse sibling forms: the second one becomes a child of the first one. 10128// Because of that, this security measure has to be disabled in Safari 8. 10129// https://bugs.webkit.org/show_bug.cgi?id=137337 10130support.createHTMLDocument = ( function() { 10131 var body = document.implementation.createHTMLDocument( "" ).body; 10132 body.innerHTML = "<form></form><form></form>"; 10133 return body.childNodes.length === 2; 10134} )(); 10135 10136 10137// Argument "data" should be string of html 10138// context (optional): If specified, the fragment will be created in this context, 10139// defaults to document 10140// keepScripts (optional): If true, will include scripts passed in the html string 10141jQuery.parseHTML = function( data, context, keepScripts ) { 10142 if ( typeof data !== "string" ) { 10143 return []; 10144 } 10145 if ( typeof context === "boolean" ) { 10146 keepScripts = context; 10147 context = false; 10148 } 10149 10150 var base, parsed, scripts; 10151 10152 if ( !context ) { 10153 10154 // Stop scripts or inline event handlers from being executed immediately 10155 // by using document.implementation 10156 if ( support.createHTMLDocument ) { 10157 context = document.implementation.createHTMLDocument( "" ); 10158 10159 // Set the base href for the created document 10160 // so any parsed elements with URLs 10161 // are based on the document's URL (gh-2965) 10162 base = context.createElement( "base" ); 10163 base.href = document.location.href; 10164 context.head.appendChild( base ); 10165 } else { 10166 context = document; 10167 } 10168 } 10169 10170 parsed = rsingleTag.exec( data ); 10171 scripts = !keepScripts && []; 10172 10173 // Single tag 10174 if ( parsed ) { 10175 return [ context.createElement( parsed[ 1 ] ) ]; 10176 } 10177 10178 parsed = buildFragment( [ data ], context, scripts ); 10179 10180 if ( scripts && scripts.length ) { 10181 jQuery( scripts ).remove(); 10182 } 10183 10184 return jQuery.merge( [], parsed.childNodes ); 10185}; 10186 10187 10188/** 10189 * Load a url into a page 10190 */ 10191jQuery.fn.load = function( url, params, callback ) { 10192 var selector, type, response, 10193 self = this, 10194 off = url.indexOf( " " ); 10195 10196 if ( off > -1 ) { 10197 selector = stripAndCollapse( url.slice( off ) ); 10198 url = url.slice( 0, off ); 10199 } 10200 10201 // If it's a function 10202 if ( isFunction( params ) ) { 10203 10204 // We assume that it's the callback 10205 callback = params; 10206 params = undefined; 10207 10208 // Otherwise, build a param string 10209 } else if ( params && typeof params === "object" ) { 10210 type = "POST"; 10211 } 10212 10213 // If we have elements to modify, make the request 10214 if ( self.length > 0 ) { 10215 jQuery.ajax( { 10216 url: url, 10217 10218 // If "type" variable is undefined, then "GET" method will be used. 10219 // Make value of this field explicit since 10220 // user can override it through ajaxSetup method 10221 type: type || "GET", 10222 dataType: "html", 10223 data: params 10224 } ).done( function( responseText ) { 10225 10226 // Save response for use in complete callback 10227 response = arguments; 10228 10229 self.html( selector ? 10230 10231 // If a selector was specified, locate the right elements in a dummy div 10232 // Exclude scripts to avoid IE 'Permission Denied' errors 10233 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 10234 10235 // Otherwise use the full result 10236 responseText ); 10237 10238 // If the request succeeds, this function gets "data", "status", "jqXHR" 10239 // but they are ignored because response was set above. 10240 // If it fails, this function gets "jqXHR", "status", "error" 10241 } ).always( callback && function( jqXHR, status ) { 10242 self.each( function() { 10243 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 10244 } ); 10245 } ); 10246 } 10247 10248 return this; 10249}; 10250 10251 10252 10253 10254jQuery.expr.pseudos.animated = function( elem ) { 10255 return jQuery.grep( jQuery.timers, function( fn ) { 10256 return elem === fn.elem; 10257 } ).length; 10258}; 10259 10260 10261 10262 10263jQuery.offset = { 10264 setOffset: function( elem, options, i ) { 10265 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 10266 position = jQuery.css( elem, "position" ), 10267 curElem = jQuery( elem ), 10268 props = {}; 10269 10270 // Set position first, in-case top/left are set even on static elem 10271 if ( position === "static" ) { 10272 elem.style.position = "relative"; 10273 } 10274 10275 curOffset = curElem.offset(); 10276 curCSSTop = jQuery.css( elem, "top" ); 10277 curCSSLeft = jQuery.css( elem, "left" ); 10278 calculatePosition = ( position === "absolute" || position === "fixed" ) && 10279 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 10280 10281 // Need to be able to calculate position if either 10282 // top or left is auto and position is either absolute or fixed 10283 if ( calculatePosition ) { 10284 curPosition = curElem.position(); 10285 curTop = curPosition.top; 10286 curLeft = curPosition.left; 10287 10288 } else { 10289 curTop = parseFloat( curCSSTop ) || 0; 10290 curLeft = parseFloat( curCSSLeft ) || 0; 10291 } 10292 10293 if ( isFunction( options ) ) { 10294 10295 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 10296 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 10297 } 10298 10299 if ( options.top != null ) { 10300 props.top = ( options.top - curOffset.top ) + curTop; 10301 } 10302 if ( options.left != null ) { 10303 props.left = ( options.left - curOffset.left ) + curLeft; 10304 } 10305 10306 if ( "using" in options ) { 10307 options.using.call( elem, props ); 10308 10309 } else { 10310 curElem.css( props ); 10311 } 10312 } 10313}; 10314 10315jQuery.fn.extend( { 10316 10317 // offset() relates an element's border box to the document origin 10318 offset: function( options ) { 10319 10320 // Preserve chaining for setter 10321 if ( arguments.length ) { 10322 return options === undefined ? 10323 this : 10324 this.each( function( i ) { 10325 jQuery.offset.setOffset( this, options, i ); 10326 } ); 10327 } 10328 10329 var rect, win, 10330 elem = this[ 0 ]; 10331 10332 if ( !elem ) { 10333 return; 10334 } 10335 10336 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 10337 // Support: IE <=11 only 10338 // Running getBoundingClientRect on a 10339 // disconnected node in IE throws an error 10340 if ( !elem.getClientRects().length ) { 10341 return { top: 0, left: 0 }; 10342 } 10343 10344 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 10345 rect = elem.getBoundingClientRect(); 10346 win = elem.ownerDocument.defaultView; 10347 return { 10348 top: rect.top + win.pageYOffset, 10349 left: rect.left + win.pageXOffset 10350 }; 10351 }, 10352 10353 // position() relates an element's margin box to its offset parent's padding box 10354 // This corresponds to the behavior of CSS absolute positioning 10355 position: function() { 10356 if ( !this[ 0 ] ) { 10357 return; 10358 } 10359 10360 var offsetParent, offset, doc, 10361 elem = this[ 0 ], 10362 parentOffset = { top: 0, left: 0 }; 10363 10364 // position:fixed elements are offset from the viewport, which itself always has zero offset 10365 if ( jQuery.css( elem, "position" ) === "fixed" ) { 10366 10367 // Assume position:fixed implies availability of getBoundingClientRect 10368 offset = elem.getBoundingClientRect(); 10369 10370 } else { 10371 offset = this.offset(); 10372 10373 // Account for the *real* offset parent, which can be the document or its root element 10374 // when a statically positioned element is identified 10375 doc = elem.ownerDocument; 10376 offsetParent = elem.offsetParent || doc.documentElement; 10377 while ( offsetParent && 10378 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 10379 jQuery.css( offsetParent, "position" ) === "static" ) { 10380 10381 offsetParent = offsetParent.parentNode; 10382 }
vendor: 8,818 bytes, lines 10383-10676
10383 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 10384 10385 // Incorporate borders into its offset, since they are outside its content origin 10386 parentOffset = jQuery( offsetParent ).offset(); 10387 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 10388 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 10389 } 10390 } 10391 10392 // Subtract parent offsets and element margins 10393 return { 10394 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 10395 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 10396 }; 10397 }, 10398 10399 // This method will return documentElement in the following cases: 10400 // 1) For the element inside the iframe without offsetParent, this method will return 10401 // documentElement of the parent window 10402 // 2) For the hidden or detached element 10403 // 3) For body or html element, i.e. in case of the html node - it will return itself 10404 // 10405 // but those exceptions were never presented as a real life use-cases 10406 // and might be considered as more preferable results. 10407 // 10408 // This logic, however, is not guaranteed and can change at any point in the future 10409 offsetParent: function() { 10410 return this.map( function() { 10411 var offsetParent = this.offsetParent; 10412 10413 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 10414 offsetParent = offsetParent.offsetParent; 10415 } 10416 10417 return offsetParent || documentElement; 10418 } ); 10419 } 10420} ); 10421 10422// Create scrollLeft and scrollTop methods 10423jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 10424 var top = "pageYOffset" === prop; 10425 10426 jQuery.fn[ method ] = function( val ) { 10427 return access( this, function( elem, method, val ) { 10428 10429 // Coalesce documents and windows 10430 var win; 10431 if ( isWindow( elem ) ) { 10432 win = elem; 10433 } else if ( elem.nodeType === 9 ) { 10434 win = elem.defaultView; 10435 } 10436 10437 if ( val === undefined ) { 10438 return win ? win[ prop ] : elem[ method ]; 10439 } 10440 10441 if ( win ) { 10442 win.scrollTo( 10443 !top ? val : win.pageXOffset, 10444 top ? val : win.pageYOffset 10445 ); 10446 10447 } else { 10448 elem[ method ] = val; 10449 } 10450 }, method, val, arguments.length ); 10451 }; 10452} ); 10453 10454// Support: Safari <=7 - 9.1, Chrome <=37 - 49 10455// Add the top/left cssHooks using jQuery.fn.position 10456// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 10457// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 10458// getComputedStyle returns percent when specified for top/left/bottom/right; 10459// rather than make the css module depend on the offset module, just check for it here 10460jQuery.each( [ "top", "left" ], function( _i, prop ) { 10461 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 10462 function( elem, computed ) { 10463 if ( computed ) { 10464 computed = curCSS( elem, prop ); 10465 10466 // If curCSS returns percentage, fallback to offset 10467 return rnumnonpx.test( computed ) ? 10468 jQuery( elem ).position()[ prop ] + "px" : 10469 computed; 10470 } 10471 } 10472 ); 10473} ); 10474 10475 10476// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 10477jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 10478 jQuery.each( { 10479 padding: "inner" + name, 10480 content: type, 10481 "": "outer" + name 10482 }, function( defaultExtra, funcName ) { 10483 10484 // Margin is only for outerHeight, outerWidth 10485 jQuery.fn[ funcName ] = function( margin, value ) { 10486 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 10487 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 10488 10489 return access( this, function( elem, type, value ) { 10490 var doc; 10491 10492 if ( isWindow( elem ) ) { 10493 10494 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 10495 return funcName.indexOf( "outer" ) === 0 ? 10496 elem[ "inner" + name ] : 10497 elem.document.documentElement[ "client" + name ]; 10498 } 10499 10500 // Get document width or height 10501 if ( elem.nodeType === 9 ) { 10502 doc = elem.documentElement; 10503 10504 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 10505 // whichever is greatest 10506 return Math.max( 10507 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 10508 elem.body[ "offset" + name ], doc[ "offset" + name ], 10509 doc[ "client" + name ] 10510 ); 10511 } 10512 10513 return value === undefined ? 10514 10515 // Get width or height on the element, requesting but not forcing parseFloat 10516 jQuery.css( elem, type, extra ) : 10517 10518 // Set width or height on the element 10519 jQuery.style( elem, type, value, extra ); 10520 }, type, chainable ? margin : undefined, chainable ); 10521 }; 10522 } ); 10523} ); 10524 10525 10526jQuery.each( [ 10527 "ajaxStart", 10528 "ajaxStop", 10529 "ajaxComplete", 10530 "ajaxError", 10531 "ajaxSuccess", 10532 "ajaxSend" 10533], function( _i, type ) { 10534 jQuery.fn[ type ] = function( fn ) { 10535 return this.on( type, fn ); 10536 }; 10537} ); 10538 10539 10540 10541 10542jQuery.fn.extend( { 10543 10544 bind: function( types, data, fn ) { 10545 return this.on( types, null, data, fn ); 10546 }, 10547 unbind: function( types, fn ) { 10548 return this.off( types, null, fn ); 10549 }, 10550 10551 delegate: function( selector, types, data, fn ) { 10552 return this.on( types, selector, data, fn ); 10553 }, 10554 undelegate: function( selector, types, fn ) { 10555 10556 // ( namespace ) or ( selector, types [, fn] ) 10557 return arguments.length === 1 ? 10558 this.off( selector, "**" ) : 10559 this.off( types, selector || "**", fn ); 10560 }, 10561 10562 hover: function( fnOver, fnOut ) { 10563 return this 10564 .on( "mouseenter", fnOver ) 10565 .on( "mouseleave", fnOut || fnOver ); 10566 } 10567} ); 10568 10569jQuery.each( 10570 ( "blur focus focusin focusout resize scroll click dblclick " + 10571 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 10572 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 10573 function( _i, name ) { 10574 10575 // Handle event binding 10576 jQuery.fn[ name ] = function( data, fn ) { 10577 return arguments.length > 0 ? 10578 this.on( name, null, data, fn ) : 10579 this.trigger( name ); 10580 }; 10581 } 10582); 10583 10584 10585 10586 10587// Support: Android <=4.0 only 10588// Make sure we trim BOM and NBSP 10589// Require that the "whitespace run" starts from a non-whitespace 10590// to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. 10591var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; 10592 10593// Bind a function to a context, optionally partially applying any 10594// arguments. 10595// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 10596// However, it is not slated for removal any time soon 10597jQuery.proxy = function( fn, context ) { 10598 var tmp, args, proxy; 10599 10600 if ( typeof context === "string" ) { 10601 tmp = fn[ context ]; 10602 context = fn; 10603 fn = tmp; 10604 } 10605 10606 // Quick check to determine if target is callable, in the spec 10607 // this throws a TypeError, but we will just return undefined. 10608 if ( !isFunction( fn ) ) { 10609 return undefined; 10610 } 10611 10612 // Simulated bind 10613 args = slice.call( arguments, 2 ); 10614 proxy = function() { 10615 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 10616 }; 10617 10618 // Set the guid of unique handler to the same of original handler, so it can be removed 10619 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 10620 10621 return proxy; 10622}; 10623 10624jQuery.holdReady = function( hold ) { 10625 if ( hold ) { 10626 jQuery.readyWait++; 10627 } else { 10628 jQuery.ready( true ); 10629 } 10630}; 10631jQuery.isArray = Array.isArray; 10632jQuery.parseJSON = JSON.parse; 10633jQuery.nodeName = nodeName; 10634jQuery.isFunction = isFunction; 10635jQuery.isWindow = isWindow; 10636jQuery.camelCase = camelCase; 10637jQuery.type = toType; 10638 10639jQuery.now = Date.now; 10640 10641jQuery.isNumeric = function( obj ) { 10642 10643 // As of jQuery 3.0, isNumeric is limited to 10644 // strings and numbers (primitives or objects) 10645 // that can be coerced to finite numbers (gh-2662) 10646 var type = jQuery.type( obj ); 10647 return ( type === "number" || type === "string" ) && 10648 10649 // parseFloat NaNs numeric-cast false positives ("") 10650 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 10651 // subtraction forces infinities to NaN 10652 !isNaN( obj - parseFloat( obj ) ); 10653}; 10654 10655jQuery.trim = function( text ) { 10656 return text == null ? 10657 "" : 10658 ( text + "" ).replace( rtrim, "$1" ); 10659}; 10660 10661 10662 10663// Register as a named AMD module, since jQuery can be concatenated with other 10664// files that may use define, but not via a proper concatenation script that 10665// understands anonymous AMD modules. A named AMD is safest and most robust 10666// way to register. Lowercase jquery is used because AMD module names are 10667// derived from file names, and jQuery is normally delivered in a lowercase 10668// file name. Do this after creating the global so that if an AMD module wants 10669// to call noConflict to hide this version of jQuery, it will work. 10670 10671// Note that for maximum portability, libraries that are not jQuery should 10672// declare themselves as anonymous modules, and avoid setting a global if an 10673// AMD loader is present. jQuery is a special case. For more information, see 10674// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 10675 10676if ( t
10676ypeof define === "function" && define.amd ) { 10677 define( "jquery", [], function() { 10678 return jQuery; 10679 } ); 10680} 10681 10682 10683 10684 10685var 10686 10687 // Map over jQuery in case of overwrite 10688 _jQuery = window.jQuery, 10689 10690 // Map over the $ in case of overwrite 10691 _$ = window.$; 10692 10693jQuery.noConflict = function( deep ) { 10694 if ( window.$ === jQuery ) { 10695 window.$ = _$; 10696 } 10697 10698 if ( deep && window.jQuery === jQuery ) { 10699 window.jQuery = _jQuery; 10700 } 10701 10702 return jQuery; 10703}; 10704 10705// Expose jQuery and $ identifiers, even in AMD 10706// (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557) 10707// and CommonJS for browser emulators (trac-13566) 10708if ( typeof noGlobal === "undefined" ) { 10709 window.jQuery = window.$ = jQuery; 10710} 10711 10712 10713 10714 10715return jQuery; 10716} ); 10717( function( factory ) { 10718 "use strict"; 10719 10720 if ( typeof define === "function" && define.amd ) { 10721 10722 // AMD. Register as an anonymous module. 10723 define( [ "jquery" ], factory ); 10724 } else { 10725 10726 // Browser globals 10727 factory( jQuery ); 10728 } 10729} )( function( $ ) { 10730"use strict"; 10731 10732$.ui = $.ui || {}; 10733 10734return $.ui.version = "1.14.2"; 10735 10736} ); 10737 10738 10739/*! 10740 * jQuery UI Keycode 1.14.2 10741 * https://jqueryui.com 10742 * 10743 * Copyright OpenJS Foundation and other contributors 10744 * Released under the MIT license. 10745 * https://jquery.org/license 10746 */ 10747 10748//>>label: Keycode 10749//>>group: Core 10750//>>description: Provide keycodes as keynames 10751//>>docs: https://api.jqueryui.com/jQuery.ui.keyCode/ 10752 10753( function( factory ) { 10754 "use strict"; 10755 10756 if ( typeof define === "function" && define.amd ) { 10757 10758 // AMD. Register as an anonymous module. 10759 define( [ "jquery", "./version" ], factory ); 10760 } else { 10761 10762 // Browser globals 10763 factory( jQuery ); 10764 } 10765} )( function( $ ) { 10766"use strict"; 10767 10768return $.ui.keyCode = { 10769 BACKSPACE: 8, 10770 COMMA: 188, 10771 DELETE: 46, 10772 DOWN: 40, 10773 END: 35, 10774 ENTER: 13, 10775 ESCAPE: 27, 10776 HOME: 36, 10777 LEFT: 37, 10778 PAGE_DOWN: 34, 10779 PAGE_UP: 33, 10780 PERIOD: 190, 10781 RIGHT: 39, 10782 SPACE: 32, 10783 TAB: 9, 10784 UP: 38 10785}; 10786 10787} ); 10788 10789 10790 10791/* eslint-disable max-len */ 10792/*! 10793 * jQuery UI Datepicker 1.14.2 10794 * https://jqueryui.com 10795 * 10796 * Copyright OpenJS Foundation and other contributors 10797 * Released under the MIT license. 10798 * https://jquery.org/license 10799 */ 10800 10801//>>label: Datepicker 10802//>>group: Widgets 10803//>>description: Displays a calendar from an input or inline for selecting dates. 10804//>>docs: https://api.jqueryui.com/datepicker/ 10805//>>demos: https://jqueryui.com/datepicker/ 10806//>>css.structure: ../../themes/base/core.css 10807//>>css.structure: ../../themes/base/datepicker.css 10808//>>css.theme: ../../themes/base/theme.css 10809 10810( function( factory ) { 10811 "use strict"; 10812 10813 if ( typeof define === "function" && define.amd ) { 10814 10815 // AMD. Register as an anonymous module. 10816 define( [ 10817 "jquery", 10818 "../version", 10819 "../keycode" 10820 ], factory
vendor: 43,234 bytes, lines 10820-11979
10820 ); 10821 } else { 10822 10823 // Browser globals 10824 factory( jQuery ); 10825 } 10826} )( function( $ ) { 10827"use strict"; 10828 10829$.extend( $.ui, { datepicker: { version: "1.14.2" } } ); 10830 10831var datepicker_instActive; 10832 10833function datepicker_getZindex( elem ) { 10834 var position, value; 10835 while ( elem.length && elem[ 0 ] !== document ) { 10836 10837 // Ignore z-index if position is set to a value where z-index is ignored by the browser 10838 // This makes behavior of this function consistent across browsers 10839 // WebKit always returns auto if the element is positioned 10840 position = elem.css( "position" ); 10841 if ( position === "absolute" || position === "relative" || position === "fixed" ) { 10842 10843 // IE returns 0 when zIndex is not specified 10844 // other browsers return a string 10845 // we ignore the case of nested elements with an explicit value of 0 10846 // <div style="z-index: -10;"><div style="z-index: 0;"></div></div> 10847 value = parseInt( elem.css( "zIndex" ), 10 ); 10848 if ( !isNaN( value ) && value !== 0 ) { 10849 return value; 10850 } 10851 } 10852 elem = elem.parent(); 10853 } 10854 10855 return 0; 10856} 10857 10858/* Date picker manager. 10859 Use the singleton instance of this class, $.datepicker, to interact with the date picker. 10860 Settings for (groups of) date pickers are maintained in an instance object, 10861 allowing multiple different settings on the same page. */ 10862 10863function Datepicker() { 10864 this._curInst = null; // The current instance in use 10865 this._keyEvent = false; // If the last event was a key event 10866 this._disabledInputs = []; // List of date picker inputs that have been disabled 10867 this._datepickerShowing = false; // True if the popup picker is showing , false if not 10868 this._inDialog = false; // True if showing within a "dialog", false if not 10869 this._mainDivId = "ui-datepicker-div"; // The ID of the main datepicker division 10870 this._inlineClass = "ui-datepicker-inline"; // The name of the inline marker class 10871 this._appendClass = "ui-datepicker-append"; // The name of the append marker class 10872 this._triggerClass = "ui-datepicker-trigger"; // The name of the trigger marker class 10873 this._dialogClass = "ui-datepicker-dialog"; // The name of the dialog marker class 10874 this._disableClass = "ui-datepicker-disabled"; // The name of the disabled covering marker class 10875 this._unselectableClass = "ui-datepicker-unselectable"; // The name of the unselectable cell marker class 10876 this._currentClass = "ui-datepicker-current-day"; // The name of the current day marker class 10877 this._dayOverClass = "ui-datepicker-days-cell-over"; // The name of the day hover marker class 10878 this.regional = []; // Available regional settings, indexed by language code 10879 this.regional[ "" ] = { // Default regional settings 10880 closeText: "Done", // Display text for close link 10881 prevText: "Prev", // Display text for previous month link 10882 nextText: "Next", // Display text for next month link 10883 currentText: "Today", // Display text for current month link 10884 monthNames: [ "January", "February", "March", "April", "May", "June", 10885 "July", "August", "September", "October", "November", "December" ], // Names of months for drop-down and formatting 10886 monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting 10887 dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting 10888 dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting 10889 dayNamesMin: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ], // Column headings for days starting at Sunday 10890 weekHeader: "Wk", // Column header for week of the year 10891 dateFormat: "mm/dd/yy", // See format options on parseDate 10892 firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... 10893 isRTL: false, // True if right-to-left language, false if left-to-right 10894 showMonthAfterYear: false, // True if the year select precedes month, false for month then year 10895 yearSuffix: "", // Additional text to append to the year in the month headers, 10896 selectMonthLabel: "Select month", // Invisible label for month selector 10897 selectYearLabel: "Select year" // Invisible label for year selector 10898 }; 10899 this._defaults = { // Global defaults for all the date picker instances 10900 showOn: "focus", // "focus" for popup on focus, 10901 // "button" for trigger button, or "both" for either 10902 showAnim: "fadeIn", // Name of jQuery animation for popup 10903 showOptions: {}, // Options for enhanced animations 10904 defaultDate: null, // Used when field is blank: actual date, 10905 // +/-number for offset from today, null for today 10906 appendText: "", // Display text following the input box, e.g. showing the format 10907 buttonText: "...", // Text for trigger button 10908 buttonImage: "", // URL for trigger button image 10909 buttonImageOnly: false, // True if the image appears alone, false if it appears on a button 10910 hideIfNoPrevNext: false, // True to hide next/previous month links 10911 // if not applicable, false to just disable them 10912 navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links 10913 gotoCurrent: false, // True if today link goes back to current selection instead 10914 changeMonth: false, // True if month can be selected directly, false if only prev/next 10915 changeYear: false, // True if year can be selected directly, false if only prev/next 10916 yearRange: "c-10:c+10", // Range of years to display in drop-down, 10917 // either relative to today's year (-nn:+nn), relative to currently displayed year 10918 // (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n) 10919 showOtherMonths: false, // True to show dates in other months, false to leave blank 10920 selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable 10921 showWeek: false, // True to show week of the year, false to not show it 10922 calculateWeek: this.iso8601Week, // How to calculate the week of the year, 10923 // takes a Date and returns the number of the week for it 10924 shortYearCutoff: "+10", // Short year values < this are in the current century, 10925 // > this are in the previous century, 10926 // string value starting with "+" for current year + value 10927 minDate: null, // The earliest selectable date, or null for no limit 10928 maxDate: null, // The latest selectable date, or null for no limit 10929 duration: "fast", // Duration of display/closure 10930 beforeShowDay: null, // Function that takes a date and returns an array with 10931 // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or "", 10932 // [2] = cell title (optional), e.g. $.datepicker.noWeekends 10933 beforeShow: null, // Function that takes an input field and 10934 // returns a set of custom settings for the date picker 10935 onSelect: null, // Define a callback function when a date is selected 10936 onChangeMonthYear: null, // Define a callback function when the month or year is changed 10937 onClose: null, // Define a callback function when the datepicker is closed 10938 onUpdateDatepicker: null, // Define a callback function when the datepicker is updated 10939 numberOfMonths: 1, // Number of months to show at a time 10940 showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0) 10941 stepMonths: 1, // Number of months to step back/forward 10942 stepBigMonths: 12, // Number of months to step back/forward for the big links 10943 altField: "", // Selector for an alternate field to store selected dates into 10944 altFormat: "", // The date format to use for the alternate field 10945 constrainInput: true, // The input is constrained by the current date format 10946 showButtonPanel: false, // True to show button panel, false to not show it 10947 autoSize: false, // True to size the input for the date format, false to leave as is 10948 disabled: false // The initial disabled state 10949 }; 10950 $.extend( this._defaults, this.regional[ "" ] ); 10951 this.regional.en = $.extend( true, {}, this.regional[ "" ] ); 10952 this.regional[ "en-US" ] = $.extend( true, {}, this.regional.en ); 10953 this.dpDiv = datepicker_bindHover( $( "<div id='" + this._mainDivId + "' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ); 10954} 10955 10956$.extend( Datepicker.prototype, { 10957 10958 /* Class name added to elements to indicate already configured with a date picker. */ 10959 markerClassName: "hasDatepicker", 10960 10961 //Keep track of the maximum number of rows displayed (see #7043) 10962 maxRows: 4, 10963 10964 // TODO rename to "widget" when switching to widget factory 10965 _widgetDatepicker: function() { 10966 return this.dpDiv; 10967 }, 10968 10969 /* Override the default settings for all instances of the date picker. 10970 * @param settings object - the new settings to use as defaults (anonymous object) 10971 * @return the manager object 10972 */ 10973 setDefaults: function( settings ) { 10974 datepicker_extendRemove( this._defaults, settings || {} ); 10975 return this; 10976 }, 10977 10978 /* Attach the date picker to a jQuery selection. 10979 * @param target element - the target input field or division or span 10980 * @param settings object - the new settings to use for this date picker instance (anonymous) 10981 */ 10982 _attachDatepicker: function( target, settings ) { 10983 var nodeName, inline, inst; 10984 nodeName = target.nodeName.toLowerCase(); 10985 inline = ( nodeName === "div" || nodeName === "span" ); 10986 if ( !target.id ) { 10987 this.uuid += 1; 10988 target.id = "dp" + this.uuid; 10989 } 10990 inst = this._newInst( $( target ), inline ); 10991 inst.settings = $.extend( {}, settings || {} ); 10992 if ( nodeName === "input" ) { 10993 this._connectDatepicker( target, inst ); 10994 } else if ( inline ) { 10995 this._inlineDatepicker( target, inst ); 10996 } 10997 }, 10998 10999 /* Create a new instance object. */ 11000 _newInst: function( target, inline ) { 11001 var id = target[ 0 ].id.replace( /([^A-Za-z0-9_\-])/g, "\\\\$1" ); // escape jQuery meta chars 11002 return { id: id, input: target, // associated target 11003 selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection 11004 drawMonth: 0, drawYear: 0, // month being drawn 11005 inline: inline, // is datepicker inline or not 11006 dpDiv: ( !inline ? this.dpDiv : // presentation div 11007 datepicker_bindHover( $( "<div class='" + this._inlineClass + " ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>" ) ) ) }; 11008 }, 11009 11010 /* Attach the date picker to an input field. */ 11011 _connectDatepicker: function( target, inst ) { 11012 var input = $( target ); 11013 inst.append = $( [] ); 11014 inst.trigger = $( [] ); 11015 if ( input.hasClass( this.markerClassName ) ) { 11016 return; 11017 } 11018 this._attachments( input, inst ); 11019 input.addClass( this.markerClassName ).on( "keydown", this._doKeyDown ). 11020 on( "keypress", this._doKeyPress ).on( "keyup", this._doKeyUp ); 11021 this._autoSize( inst ); 11022 $.data( target, "datepicker", inst ); 11023 11024 //If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665) 11025 if ( inst.settings.disabled ) { 11026 this._disableDatepicker( target ); 11027 } 11028 }, 11029 11030 /* Make attachments based on settings. */ 11031 _attachments: function( input, inst ) { 11032 var showOn, buttonText, buttonImage, 11033 appendText = this._get( inst, "appendText" ), 11034 isRTL = this._get( inst, "isRTL" ); 11035 11036 if ( inst.append ) { 11037 inst.append.remove(); 11038 } 11039 if ( appendText ) { 11040 inst.append = $( "<span>" ) 11041 .addClass( this._appendClass ) 11042 .text( appendText ); 11043 input[ isRTL ? "before" : "after" ]( inst.append ); 11044 } 11045 11046 input.off( "focus", this._showDatepicker ); 11047 11048 if ( inst.trigger ) { 11049 inst.trigger.remove(); 11050 } 11051 11052 showOn = this._get( inst, "showOn" ); 11053 if ( showOn === "focus" || showOn === "both" ) { // pop-up date picker when in the marked field 11054 input.on( "focus", this._showDatepicker ); 11055 } 11056 if ( showOn === "button" || showOn === "both" ) { // pop-up date picker when button clicked 11057 buttonText = this._get( inst, "buttonText" ); 11058 buttonImage = this._get( inst, "buttonImage" ); 11059 11060 if ( this._get( inst, "buttonImageOnly" ) ) { 11061 inst.trigger = $( "<img>" ) 11062 .addClass( this._triggerClass ) 11063 .attr( { 11064 src: buttonImage, 11065 alt: buttonText, 11066 title: buttonText 11067 } ); 11068 } else { 11069 inst.trigger = $( "<button type='button'>" ) 11070 .addClass( this._triggerClass ); 11071 if ( buttonImage ) { 11072 inst.trigger.html( 11073 $( "<img>" ) 11074 .attr( { 11075 src: buttonImage, 11076 alt: buttonText, 11077 title: buttonText 11078 } ) 11079 ); 11080 } else { 11081 inst.trigger.text( buttonText ); 11082 } 11083 } 11084 11085 input[ isRTL ? "before" : "after" ]( inst.trigger ); 11086 inst.trigger.on( "click", function() { 11087 if ( $.datepicker._datepickerShowing && $.datepicker._lastInput === input[ 0 ] ) { 11088 $.datepicker._hideDatepicker(); 11089 } else if ( $.datepicker._datepickerShowing && $.datepicker._lastInput !== input[ 0 ] ) { 11090 $.datepicker._hideDatepicker(); 11091 $.datepicker._showDatepicker( input[ 0 ] ); 11092 } else { 11093 $.datepicker._showDatepicker( input[ 0 ] ); 11094 } 11095 return false; 11096 } ); 11097 } 11098 }, 11099 11100 /* Apply the maximum length for the date format. */ 11101 _autoSize: function( inst ) { 11102 if ( this._get( inst, "autoSize" ) && !inst.inline ) { 11103 var findMax, max, maxI, i, 11104 date = new Date( 2009, 12 - 1, 20 ), // Ensure double digits 11105 dateFormat = this._get( inst, "dateFormat" ); 11106 11107 if ( dateFormat.match( /[DM]/ ) ) { 11108 findMax = function( names ) { 11109 max = 0; 11110 maxI = 0; 11111 for ( i = 0; i < names.length; i++ ) { 11112 if ( names[ i ].length > max ) { 11113 max = names[ i ].length; 11114 maxI = i; 11115 } 11116 } 11117 return maxI; 11118 }; 11119 date.setMonth( findMax( this._get( inst, ( dateFormat.match( /MM/ ) ? 11120 "monthNames" : "monthNamesShort" ) ) ) ); 11121 date.setDate( findMax( this._get( inst, ( dateFormat.match( /DD/ ) ? 11122 "dayNames" : "dayNamesShort" ) ) ) + 20 - date.getDay() ); 11123 } 11124 inst.input.attr( "size", this._formatDate( inst, date ).length ); 11125 } 11126 }, 11127 11128 /* Attach an inline date picker to a div. */ 11129 _inlineDatepicker: function( target, inst ) { 11130 var divSpan = $( target ); 11131 if ( divSpan.hasClass( this.markerClassName ) ) { 11132 return; 11133 } 11134 divSpan.addClass( this.markerClassName ).append( inst.dpDiv ); 11135 $.data( target, "datepicker", inst ); 11136 this._setDate( inst, this._getDefaultDate( inst ), true ); 11137 this._updateDatepicker( inst ); 11138 this._updateAlternate( inst ); 11139 11140 //If disabled option is true, disable the datepicker before showing it (see ticket #5665) 11141 if ( inst.settings.disabled ) { 11142 this._disableDatepicker( target ); 11143 } 11144 11145 // Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements 11146 // https://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height 11147 inst.dpDiv.css( "display", "block" ); 11148 }, 11149 11150 /* Pop-up the date picker in a "dialog" box. 11151 * @param input element - ignored 11152 * @param date string or Date - the initial date to display 11153 * @param onSelect function - the function to call when a date is selected 11154 * @param settings object - update the dialog date picker instance's settings (anonymous object) 11155 * @param pos int[2] - coordinates for the dialog's position within the screen or 11156 * event - with x/y coordinates or 11157 * leave empty for default (screen centre) 11158 * @return the manager object 11159 */ 11160 _dialogDatepicker: function( input, date, onSelect, settings, pos ) { 11161 var id, browserWidth, browserHeight, scrollX, scrollY, 11162 inst = this._dialogInst; // internal instance 11163 11164 if ( !inst ) { 11165 this.uuid += 1; 11166 id = "dp" + this.uuid; 11167 this._dialogInput = $( "<input type='text' id='" + id + 11168 "' style='position: absolute; top: -100px; width: 0px;'/>" ); 11169 this._dialogInput.on( "keydown", this._doKeyDown ); 11170 $( "body" ).append( this._dialogInput ); 11171 inst = this._dialogInst = this._newInst( this._dialogInput, false ); 11172 inst.settings = {}; 11173 $.data( this._dialogInput[ 0 ], "datepicker", inst ); 11174 } 11175 datepicker_extendRemove( inst.settings, settings || {} ); 11176 date = ( date && date.constructor === Date ? this._formatDate( inst, date ) : date ); 11177 this._dialogInput.val( date ); 11178 11179 this._pos = ( pos ? ( pos.length ? pos : [ pos.pageX, pos.pageY ] ) : null ); 11180 if ( !this._pos ) { 11181 browserWidth = document.documentElement.clientWidth; 11182 browserHeight = document.documentElement.clientHeight; 11183 scrollX = document.documentElement.scrollLeft || document.body.scrollLeft; 11184 scrollY = document.documentElement.scrollTop || document.body.scrollTop; 11185 this._pos = // should use actual width/height below 11186 [ ( browserWidth / 2 ) - 100 + scrollX, ( browserHeight / 2 ) - 150 + scrollY ]; 11187 } 11188 11189 // Move input on screen for focus, but hidden behind dialog 11190 this._dialogInput.css( "left", ( this._pos[ 0 ] + 20 ) + "px" ).css( "top", this._pos[ 1 ] + "px" ); 11191 inst.settings.onSelect = onSelect; 11192 this._inDialog = true; 11193 this.dpDiv.addClass( this._dialogClass ); 11194 this._showDatepicker( this._dialogInput[ 0 ] ); 11195 if ( $.blockUI ) { 11196 $.blockUI( this.dpDiv ); 11197 } 11198 $.data( this._dialogInput[ 0 ], "datepicker", inst ); 11199 return this; 11200 }, 11201 11202 /* Detach a datepicker from its control. 11203 * @param target element - the target input field or division or span 11204 */ 11205 _destroyDatepicker: function( target ) { 11206 var nodeName, 11207 $target = $( target ), 11208 inst = $.data( target, "datepicker" ); 11209 11210 if ( !$target.hasClass( this.markerClassName ) ) { 11211 return; 11212 } 11213 11214 nodeName = target.nodeName.toLowerCase(); 11215 $.removeData( target, "datepicker" ); 11216 if ( nodeName === "input" ) { 11217 inst.append.remove(); 11218 inst.trigger.remove(); 11219 $target.removeClass( this.markerClassName ). 11220 off( "focus", this._showDatepicker ). 11221 off( "keydown", this._doKeyDown ). 11222 off( "keypress", this._doKeyPress ). 11223 off( "keyup", this._doKeyUp ); 11224 } else if ( nodeName === "div" || nodeName === "span" ) { 11225 $target.removeClass( this.markerClassName ).empty(); 11226 } 11227 11228 $.datepicker._hideDatepicker(); 11229 if ( datepicker_instActive === inst ) { 11230 datepicker_instActive = null; 11231 this._curInst = null; 11232 } 11233 }, 11234 11235 /* Enable the date picker to a jQuery selection. 11236 * @param target element - the target input field or division or span 11237 */ 11238 _enableDatepicker: function( target ) { 11239 var nodeName, inline, 11240 $target = $( target ), 11241 inst = $.data( target, "datepicker" ); 11242 11243 if ( !$target.hasClass( this.markerClassName ) ) { 11244 return; 11245 } 11246 11247 nodeName = target.nodeName.toLowerCase(); 11248 if ( nodeName === "input" ) { 11249 target.disabled = false; 11250 inst.trigger.filter( "button" ). 11251 each( function() { 11252 this.disabled = false; 11253 } ).end(). 11254 filter( "img" ).css( { opacity: "1.0", cursor: "" } ); 11255 } else if ( nodeName === "div" || nodeName === "span" ) { 11256 inline = $target.children( "." + this._inlineClass ); 11257 inline.children().removeClass( "ui-state-disabled" ); 11258 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). 11259 prop( "disabled", false ); 11260 } 11261 this._disabledInputs = $.map( this._disabledInputs, 11262 11263 // Delete entry 11264 function( value ) { 11265 return ( value === target ? null : value ); 11266 } ); 11267 }, 11268 11269 /* Disable the date picker to a jQuery selection. 11270 * @param target element - the target input field or division or span 11271 */ 11272 _disableDatepicker: function( target ) { 11273 var nodeName, inline, 11274 $target = $( target ), 11275 inst = $.data( target, "datepicker" ); 11276 11277 if ( !$target.hasClass( this.markerClassName ) ) { 11278 return; 11279 } 11280 11281 nodeName = target.nodeName.toLowerCase(); 11282 if ( nodeName === "input" ) { 11283 target.disabled = true; 11284 inst.trigger.filter( "button" ). 11285 each( function() { 11286 this.disabled = true; 11287 } ).end(). 11288 filter( "img" ).css( { opacity: "0.5", cursor: "default" } ); 11289 } else if ( nodeName === "div" || nodeName === "span" ) { 11290 inline = $target.children( "." + this._inlineClass ); 11291 inline.children().addClass( "ui-state-disabled" ); 11292 inline.find( "select.ui-datepicker-month, select.ui-datepicker-year" ). 11293 prop( "disabled", true ); 11294 } 11295 this._disabledInputs = $.map( this._disabledInputs, 11296 11297 // Delete entry 11298 function( value ) { 11299 return ( value === target ? null : value ); 11300 } ); 11301 this._disabledInputs[ this._disabledInputs.length ] = target; 11302 }, 11303 11304 /* Is the first field in a jQuery collection disabled as a datepicker? 11305 * @param target element - the target input field or division or span 11306 * @return boolean - true if disabled, false if enabled 11307 */ 11308 _isDisabledDatepicker: function( target ) { 11309 if ( !target ) { 11310 return false; 11311 } 11312 for ( var i = 0; i < this._disabledInputs.length; i++ ) { 11313 if ( this._disabledInputs[ i ] === target ) { 11314 return true; 11315 } 11316 } 11317 return false; 11318 }, 11319 11320 /* Retrieve the instance data for the target control. 11321 * @param target element - the target input field or division or span 11322 * @return object - the associated instance data 11323 * @throws error if a jQuery problem getting data 11324 */ 11325 _getInst: function( target ) { 11326 try { 11327 return $.data( target, "datepicker" ); 11328 } catch ( _err ) { 11329 throw "Missing instance data for this datepicker"; 11330 } 11331 }, 11332 11333 /* Update or retrieve the settings for a date picker attached to an input field or division. 11334 * @param target element - the target input field or division or span 11335 * @param name object - the new settings to update or 11336 * string - the name of the setting to change or retrieve, 11337 * when retrieving also "all" for all instance settings or 11338 * "defaults" for all global defaults 11339 * @param value any - the new value for the setting 11340 * (omit if above is an object or to retrieve a value) 11341 */ 11342 _optionDatepicker: function( target, name, value ) { 11343 var settings, date, minDate, maxDate, 11344 inst = this._getInst( target ); 11345 11346 if ( arguments.length === 2 && typeof name === "string" ) { 11347 return ( name === "defaults" ? $.extend( {}, $.datepicker._defaults ) : 11348 ( inst ? ( name === "all" ? $.extend( {}, inst.settings ) : 11349 this._get( inst, name ) ) : null ) ); 11350 } 11351 11352 settings = name || {}; 11353 if ( typeof name === "string" ) { 11354 settings = {}; 11355 settings[ name ] = value; 11356 } 11357 11358 if ( inst ) { 11359 if ( this._curInst === inst ) { 11360 this._hideDatepicker(); 11361 } 11362 11363 date = this._getDateDatepicker( target, true ); 11364 minDate = this._getMinMaxDate( inst, "min" ); 11365 maxDate = this._getMinMaxDate( inst, "max" ); 11366 datepicker_extendRemove( inst.settings, settings ); 11367 11368 // reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided 11369 if ( minDate !== null && settings.dateFormat !== undefined && settings.minDate === undefined ) { 11370 inst.settings.minDate = this._formatDate( inst, minDate ); 11371 } 11372 if ( maxDate !== null && settings.dateFormat !== undefined && settings.maxDate === undefined ) { 11373 inst.settings.maxDate = this._formatDate( inst, maxDate ); 11374 } 11375 if ( "disabled" in settings ) { 11376 if ( settings.disabled ) { 11377 this._disableDatepicker( target ); 11378 } else { 11379 this._enableDatepicker( target ); 11380 } 11381 } 11382 this._attachments( $( target ), inst ); 11383 this._autoSize( inst ); 11384 this._setDate( inst, date ); 11385 this._updateAlternate( inst ); 11386 this._updateDatepicker( inst ); 11387 } 11388 }, 11389 11390 // Change method deprecated 11391 _changeDatepicker: function( target, name, value ) { 11392 this._optionDatepicker( target, name, value ); 11393 }, 11394 11395 /* Redraw the date picker attached to an input field or division. 11396 * @param target element - the target input field or division or span 11397 */ 11398 _refreshDatepicker: function( target ) { 11399 var inst = this._getInst( target ); 11400 if ( inst ) { 11401 this._updateDatepicker( inst ); 11402 } 11403 }, 11404 11405 /* Set the dates for a jQuery selection. 11406 * @param target element - the target input field or division or span 11407 * @param date Date - the new date 11408 */ 11409 _setDateDatepicker: function( target, date ) { 11410 var inst = this._getInst( target ); 11411 if ( inst ) { 11412 this._setDate( inst, date ); 11413 this._updateDatepicker( inst ); 11414 this._updateAlternate( inst ); 11415 } 11416 }, 11417 11418 /* Get the date(s) for the first entry in a jQuery selection. 11419 * @param target element - the target input field or division or span 11420 * @param noDefault boolean - true if no default date is to be used 11421 * @return Date - the current date 11422 */ 11423 _getDateDatepicker: function( target, noDefault ) { 11424 var inst = this._getInst( target ); 11425 if ( inst && !inst.inline ) { 11426 this._setDateFromField( inst, noDefault ); 11427 } 11428 return ( inst ? this._getDate( inst ) : null ); 11429 }, 11430 11431 /* Handle keystrokes. */ 11432 _doKeyDown: function( event ) { 11433 var onSelect, dateStr, sel, 11434 inst = $.datepicker._getInst( event.target ), 11435 handled = true, 11436 isRTL = inst.dpDiv.is( ".ui-datepicker-rtl" ); 11437 11438 inst._keyEvent = true; 11439 if ( $.datepicker._datepickerShowing ) { 11440 switch ( event.keyCode ) { 11441 case 9: $.datepicker._hideDatepicker(); 11442 handled = false; 11443 break; // hide on tab out 11444 case 13: sel = $( "td." + $.datepicker._dayOverClass + ":not(." + 11445 $.datepicker._currentClass + ")", inst.dpDiv ); 11446 if ( sel[ 0 ] ) { 11447 $.datepicker._selectDay( event.target, inst.selectedMonth, inst.selectedYear, sel[ 0 ] ); 11448 } 11449 11450 onSelect = $.datepicker._get( inst, "onSelect" ); 11451 if ( onSelect ) { 11452 dateStr = $.datepicker._formatDate( inst ); 11453 11454 // Trigger custom callback 11455 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); 11456 } else { 11457 $.datepicker._hideDatepicker(); 11458 } 11459 11460 return false; // don't submit the form 11461 case 27: $.datepicker._hideDatepicker(); 11462 break; // hide on escape 11463 case 33: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 11464 -$.datepicker._get( inst, "stepBigMonths" ) : 11465 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); 11466 break; // previous month/year on page up/+ ctrl 11467 case 34: $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 11468 +$.datepicker._get( inst, "stepBigMonths" ) : 11469 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); 11470 break; // next month/year on page down/+ ctrl 11471 case 35: if ( event.ctrlKey || event.metaKey ) { 11472 $.datepicker._clearDate( event.target ); 11473 } 11474 handled = event.ctrlKey || event.metaKey; 11475 break; // clear on ctrl or command +end 11476 case 36: if ( event.ctrlKey || event.metaKey ) { 11477 $.datepicker._gotoToday( event.target ); 11478 } 11479 handled = event.ctrlKey || event.metaKey; 11480 break; // current on ctrl or command +home 11481 case 37: if ( event.ctrlKey || event.metaKey ) { 11482 $.datepicker._adjustDate( event.target, ( isRTL ? +1 : -1 ), "D" ); 11483 } 11484 handled = event.ctrlKey || event.metaKey; 11485 11486 // -1 day on ctrl or command +left 11487 if ( event.originalEvent.altKey ) { 11488 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 11489 -$.datepicker._get( inst, "stepBigMonths" ) : 11490 -$.datepicker._get( inst, "stepMonths" ) ), "M" ); 11491 } 11492 11493 // next month/year on alt +left on Mac 11494 break; 11495 case 38: if ( event.ctrlKey || event.metaKey ) { 11496 $.datepicker._adjustDate( event.target, -7, "D" ); 11497 } 11498 handled = event.ctrlKey || event.metaKey; 11499 break; // -1 week on ctrl or command +up 11500 case 39: if ( event.ctrlKey || event.metaKey ) { 11501 $.datepicker._adjustDate( event.target, ( isRTL ? -1 : +1 ), "D" ); 11502 } 11503 handled = event.ctrlKey || event.metaKey; 11504 11505 // +1 day on ctrl or command +right 11506 if ( event.originalEvent.altKey ) { 11507 $.datepicker._adjustDate( event.target, ( event.ctrlKey ? 11508 +$.datepicker._get( inst, "stepBigMonths" ) : 11509 +$.datepicker._get( inst, "stepMonths" ) ), "M" ); 11510 } 11511 11512 // next month/year on alt +right 11513 break; 11514 case 40: if ( event.ctrlKey || event.metaKey ) { 11515 $.datepicker._adjustDate( event.target, +7, "D" ); 11516 } 11517 handled = event.ctrlKey || event.metaKey; 11518 break; // +1 week on ctrl or command +down 11519 default: handled = false; 11520 } 11521 } else if ( event.keyCode === 36 && event.ctrlKey ) { // display the date picker on ctrl+home 11522 $.datepicker._showDatepicker( this ); 11523 } else { 11524 handled = false; 11525 } 11526 11527 if ( handled ) { 11528 event.preventDefault(); 11529 event.stopPropagation(); 11530 } 11531 }, 11532 11533 /* Filter entered characters - based on date format. */ 11534 _doKeyPress: function( event ) { 11535 var chars, chr, 11536 inst = $.datepicker._getInst( event.target ); 11537 11538 if ( $.datepicker._get( inst, "constrainInput" ) ) { 11539 chars = $.datepicker._possibleChars( $.datepicker._get( inst, "dateFormat" ) ); 11540 chr = String.fromCharCode( event.charCode == null ? event.keyCode : event.charCode ); 11541 return event.ctrlKey || event.metaKey || ( chr < " " || !chars || chars.indexOf( chr ) > -1 ); 11542 } 11543 }, 11544 11545 /* Synchronise manual entry and field/alternate field. */ 11546 _doKeyUp: function( event ) { 11547 var date, 11548 inst = $.datepicker._getInst( event.target ); 11549 11550 if ( inst.input.val() !== inst.lastVal ) { 11551 try { 11552 date = $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), 11553 ( inst.input ? inst.input.val() : null ), 11554 $.datepicker._getFormatConfig( inst ) ); 11555 11556 if ( date ) { // only if valid 11557 $.datepicker._setDateFromField( inst ); 11558 $.datepicker._updateAlternate( inst ); 11559 $.datepicker._updateDatepicker( inst ); 11560 } 11561 } catch ( _err ) { 11562 } 11563 } 11564 return true; 11565 }, 11566 11567 /* Pop-up the date picker for a given input field. 11568 * If false returned from beforeShow event handler do not show. 11569 * @param input element - the input field attached to the date picker or 11570 * event - if triggered by focus 11571 */ 11572 _showDatepicker: function( input ) { 11573 input = input.target || input; 11574 if ( input.nodeName.toLowerCase() !== "input" ) { // find from button/image trigger 11575 input = $( "input", input.parentNode )[ 0 ]; 11576 } 11577 11578 if ( $.datepicker._isDisabledDatepicker( input ) || $.datepicker._lastInput === input ) { // already here 11579 return; 11580 } 11581 11582 var inst, beforeShow, beforeShowSettings, isFixed, 11583 offset, showAnim, duration; 11584 11585 inst = $.datepicker._getInst( input ); 11586 if ( $.datepicker._curInst && $.datepicker._curInst !== inst ) { 11587 $.datepicker._curInst.dpDiv.stop( true, true ); 11588 if ( inst && $.datepicker._datepickerShowing ) { 11589 $.datepicker._hideDatepicker( $.datepicker._curInst.input[ 0 ] ); 11590 } 11591 } 11592 11593 beforeShow = $.datepicker._get( inst, "beforeShow" ); 11594 beforeShowSettings = beforeShow ? beforeShow.apply( input, [ input, inst ] ) : {}; 11595 if ( beforeShowSettings === false ) { 11596 return; 11597 } 11598 datepicker_extendRemove( inst.settings, beforeShowSettings ); 11599 11600 inst.lastVal = null; 11601 $.datepicker._lastInput = input; 11602 $.datepicker._setDateFromField( inst ); 11603 11604 if ( $.datepicker._inDialog ) { // hide cursor 11605 input.value = ""; 11606 } 11607 if ( !$.datepicker._pos ) { // position below input 11608 $.datepicker._pos = $.datepicker._findPos( input ); 11609 $.datepicker._pos[ 1 ] += input.offsetHeight; // add the height 11610 } 11611 11612 isFixed = false; 11613 $( input ).parents().each( function() { 11614 isFixed |= $( this ).css( "position" ) === "fixed"; 11615 return !isFixed; 11616 } ); 11617 11618 offset = { left: $.datepicker._pos[ 0 ], top: $.datepicker._pos[ 1 ] }; 11619 $.datepicker._pos = null; 11620 11621 //to avoid flashes on Firefox 11622 inst.dpDiv.empty(); 11623 11624 // determine sizing offscreen 11625 inst.dpDiv.css( { position: "absolute", display: "block", top: "-1000px" } ); 11626 $.datepicker._updateDatepicker( inst ); 11627 11628 // fix width for dynamic number of date pickers 11629 // and adjust position before showing 11630 offset = $.datepicker._checkOffset( inst, offset, isFixed ); 11631 inst.dpDiv.css( { position: ( $.datepicker._inDialog && $.blockUI ? 11632 "static" : ( isFixed ? "fixed" : "absolute" ) ), display: "none", 11633 left: offset.left + "px", top: offset.top + "px" } ); 11634 11635 if ( !inst.inline ) { 11636 showAnim = $.datepicker._get( inst, "showAnim" ); 11637 duration = $.datepicker._get( inst, "duration" ); 11638 inst.dpDiv.css( "z-index", datepicker_getZindex( $( input ) ) + 1 ); 11639 $.datepicker._datepickerShowing = true; 11640 11641 if ( $.effects && $.effects.effect[ showAnim ] ) { 11642 inst.dpDiv.show( showAnim, $.datepicker._get( inst, "showOptions" ), duration ); 11643 } else { 11644 inst.dpDiv[ showAnim || "show" ]( showAnim ? duration : null ); 11645 } 11646 11647 if ( $.datepicker._shouldFocusInput( inst ) ) { 11648 inst.input.trigger( "focus" ); 11649 } 11650 11651 $.datepicker._curInst = inst; 11652 } 11653 }, 11654 11655 /* Generate the date picker content. */ 11656 _updateDatepicker: function( inst ) { 11657 this.maxRows = 4; //Reset the max number of rows being displayed (see #7043) 11658 datepicker_instActive = inst; // for delegate hover events 11659 inst.dpDiv.empty().append( this._generateHTML( inst ) ); 11660 this._attachHandlers( inst ); 11661 11662 var origyearshtml, 11663 numMonths = this._getNumberOfMonths( inst ), 11664 cols = numMonths[ 1 ], 11665 width = 17, 11666 activeCell = inst.dpDiv.find( "." + this._dayOverClass + " a" ), 11667 onUpdateDatepicker = $.datepicker._get( inst, "onUpdateDatepicker" ); 11668 11669 if ( activeCell.length > 0 ) { 11670 datepicker_handleMouseover.apply( activeCell.get( 0 ) ); 11671 } 11672 11673 inst.dpDiv.removeClass( "ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4" ).width( "" ); 11674 if ( cols > 1 ) { 11675 inst.dpDiv.addClass( "ui-datepicker-multi-" + cols ).css( "width", ( width * cols ) + "em" ); 11676 } 11677 inst.dpDiv[ ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ? "add" : "remove" ) + 11678 "Class" ]( "ui-datepicker-multi" ); 11679 inst.dpDiv[ ( this._get( inst, "isRTL" ) ? "add" : "remove" ) + 11680 "Class" ]( "ui-datepicker-rtl" ); 11681 11682 if ( inst === $.datepicker._curInst && $.datepicker._datepickerShowing && $.datepicker._shouldFocusInput( inst ) ) { 11683 inst.input.trigger( "focus" ); 11684 } 11685 11686 // Deffered render of the years select (to avoid flashes on Firefox) 11687 if ( inst.yearshtml ) { 11688 origyearshtml = inst.yearshtml; 11689 setTimeout( function() { 11690 11691 //assure that inst.yearshtml didn't change. 11692 if ( origyearshtml === inst.yearshtml && inst.yearshtml ) { 11693 inst.dpDiv.find( "select.ui-datepicker-year" ).first().replaceWith( inst.yearshtml ); 11694 } 11695 origyearshtml = inst.yearshtml = null; 11696 }, 0 ); 11697 } 11698 11699 if ( onUpdateDatepicker ) { 11700 onUpdateDatepicker.apply( ( inst.input ? inst.input[ 0 ] : null ), [ inst ] ); 11701 } 11702 }, 11703 11704 _shouldFocusInput: function( inst ) { 11705 return inst.input && inst.input.is( ":visible" ) && !inst.input.is( ":disabled" ); 11706 }, 11707 11708 /* Check positioning to remain on screen. */ 11709 _checkOffset: function( inst, offset, isFixed ) { 11710 var dpWidth = inst.dpDiv.outerWidth(), 11711 dpHeight = inst.dpDiv.outerHeight(), 11712 inputWidth = inst.input ? inst.input.outerWidth() : 0, 11713 inputHeight = inst.input ? inst.input.outerHeight() : 0, 11714 viewWidth = document.documentElement.clientWidth + ( isFixed ? 0 : $( document ).scrollLeft() ), 11715 viewHeight = document.documentElement.clientHeight + ( isFixed ? 0 : $( document ).scrollTop() ); 11716 11717 offset.left -= ( this._get( inst, "isRTL" ) ? ( dpWidth - inputWidth ) : 0 ); 11718 offset.left -= ( isFixed && offset.left === inst.input.offset().left ) ? $( document ).scrollLeft() : 0; 11719 offset.top -= ( isFixed && offset.top === ( inst.input.offset().top + inputHeight ) ) ? $( document ).scrollTop() : 0; 11720 11721 // Now check if datepicker is showing outside window viewport - move to a better place if so. 11722 offset.left -= Math.min( offset.left, ( offset.left + dpWidth > viewWidth && viewWidth > dpWidth ) ? 11723 Math.abs( offset.left + dpWidth - viewWidth ) : 0 ); 11724 offset.top -= Math.min( offset.top, ( offset.top + dpHeight > viewHeight && viewHeight > dpHeight ) ? 11725 Math.abs( dpHeight + inputHeight ) : 0 ); 11726 11727 return offset; 11728 }, 11729 11730 /* Find an object's position on the screen. */ 11731 _findPos: function( obj ) { 11732 var position, 11733 inst = this._getInst( obj ), 11734 isRTL = this._get( inst, "isRTL" ); 11735 11736 while ( obj && ( obj.type === "hidden" || obj.nodeType !== 1 || $.expr.pseudos.hidden( obj ) ) ) { 11737 obj = obj[ isRTL ? "previousSibling" : "nextSibling" ]; 11738 } 11739 11740 position = $( obj ).offset(); 11741 return [ position.left, position.top ]; 11742 }, 11743 11744 /* Hide the date picker from view. 11745 * @param input element - the input field attached to the date picker 11746 */ 11747 _hideDatepicker: function( input ) { 11748 var showAnim, duration, postProcess, onClose, 11749 inst = this._curInst; 11750 11751 if ( !inst || ( input && inst !== $.data( input, "datepicker" ) ) ) { 11752 return; 11753 } 11754 11755 if ( this._datepickerShowing ) { 11756 showAnim = this._get( inst, "showAnim" ); 11757 duration = this._get( inst, "duration" ); 11758 postProcess = function() { 11759 $.datepicker._tidyDialog( inst ); 11760 }; 11761 11762 if ( $.effects && ( $.effects.effect[ showAnim ] ) ) { 11763 inst.dpDiv.hide( showAnim, $.datepicker._get( inst, "showOptions" ), duration, postProcess ); 11764 } else { 11765 inst.dpDiv[ ( showAnim === "slideDown" ? "slideUp" : 11766 ( showAnim === "fadeIn" ? "fadeOut" : "hide" ) ) ]( ( showAnim ? duration : null ), postProcess ); 11767 } 11768 11769 if ( !showAnim ) { 11770 postProcess(); 11771 } 11772 this._datepickerShowing = false; 11773 11774 onClose = this._get( inst, "onClose" ); 11775 if ( onClose ) { 11776 onClose.apply( ( inst.input ? inst.input[ 0 ] : null ), [ ( inst.input ? inst.input.val() : "" ), inst ] ); 11777 } 11778 11779 this._lastInput = null; 11780 if ( this._inDialog ) { 11781 this._dialogInput.css( { position: "absolute", left: "0", top: "-100px" } ); 11782 if ( $.blockUI ) { 11783 $.unblockUI(); 11784 $( "body" ).append( this.dpDiv ); 11785 } 11786 } 11787 this._inDialog = false; 11788 } 11789 }, 11790 11791 /* Tidy up after a dialog display. */ 11792 _tidyDialog: function( inst ) { 11793 inst.dpDiv.removeClass( this._dialogClass ).off( ".ui-datepicker-calendar" ); 11794 }, 11795 11796 /* Close date picker if clicked elsewhere. */ 11797 _checkExternalClick: function( event ) { 11798 if ( !$.datepicker._curInst ) { 11799 return; 11800 } 11801 11802 var $target = $( event.target ), 11803 inst = $.datepicker._getInst( $target[ 0 ] ); 11804 11805 if ( ( ( $target[ 0 ].id !== $.datepicker._mainDivId && 11806 $target.parents( "#" + $.datepicker._mainDivId ).length === 0 && 11807 !$target.hasClass( $.datepicker.markerClassName ) && 11808 !$target.closest( "." + $.datepicker._triggerClass ).length && 11809 $.datepicker._datepickerShowing && !( $.datepicker._inDialog && $.blockUI ) ) ) || 11810 ( $target.hasClass( $.datepicker.markerClassName ) && $.datepicker._curInst !== inst ) ) { 11811 $.datepicker._hideDatepicker(); 11812 } 11813 }, 11814 11815 /* Adjust one of the date sub-fields. */ 11816 _adjustDate: function( id, offset, period ) { 11817 var target = $( id ), 11818 inst = this._getInst( target[ 0 ] ); 11819 11820 if ( this._isDisabledDatepicker( target[ 0 ] ) ) { 11821 return; 11822 } 11823 this._adjustInstDate( inst, offset, period ); 11824 this._updateDatepicker( inst ); 11825 }, 11826 11827 /* Action for current link. */ 11828 _gotoToday: function( id ) { 11829 var date, 11830 target = $( id ), 11831 inst = this._getInst( target[ 0 ] ); 11832 11833 if ( this._get( inst, "gotoCurrent" ) && inst.currentDay ) { 11834 inst.selectedDay = inst.currentDay; 11835 inst.drawMonth = inst.selectedMonth = inst.currentMonth; 11836 inst.drawYear = inst.selectedYear = inst.currentYear; 11837 } else { 11838 date = new Date(); 11839 inst.selectedDay = date.getDate(); 11840 inst.drawMonth = inst.selectedMonth = date.getMonth(); 11841 inst.drawYear = inst.selectedYear = date.getFullYear(); 11842 } 11843 this._notifyChange( inst ); 11844 this._adjustDate( target ); 11845 }, 11846 11847 /* Action for selecting a new month/year. */ 11848 _selectMonthYear: function( id, select, period ) { 11849 var target = $( id ), 11850 inst = this._getInst( target[ 0 ] ); 11851 11852 inst[ "selected" + ( period === "M" ? "Month" : "Year" ) ] = 11853 inst[ "draw" + ( period === "M" ? "Month" : "Year" ) ] = 11854 parseInt( select.options[ select.selectedIndex ].value, 10 ); 11855 11856 this._notifyChange( inst ); 11857 this._adjustDate( target ); 11858 }, 11859 11860 /* Action for selecting a day. */ 11861 _selectDay: function( id, month, year, td ) { 11862 var inst, 11863 target = $( id ); 11864 11865 if ( $( td ).hasClass( this._unselectableClass ) || this._isDisabledDatepicker( target[ 0 ] ) ) { 11866 return; 11867 } 11868 11869 inst = this._getInst( target[ 0 ] ); 11870 inst.selectedDay = inst.currentDay = parseInt( $( "a", td ).attr( "data-date" ) ); 11871 inst.selectedMonth = inst.currentMonth = month; 11872 inst.selectedYear = inst.currentYear = year; 11873 this._selectDate( id, this._formatDate( inst, 11874 inst.currentDay, inst.currentMonth, inst.currentYear ) ); 11875 }, 11876 11877 /* Erase the input field and hide the date picker. */ 11878 _clearDate: function( id ) { 11879 var target = $( id ); 11880 this._selectDate( target, "" ); 11881 }, 11882 11883 /* Update the input field with the selected date. */ 11884 _selectDate: function( id, dateStr ) { 11885 var onSelect, 11886 target = $( id ), 11887 inst = this._getInst( target[ 0 ] ); 11888 11889 dateStr = ( dateStr != null ? dateStr : this._formatDate( inst ) ); 11890 if ( inst.input ) { 11891 inst.input.val( dateStr ); 11892 } 11893 this._updateAlternate( inst ); 11894 11895 onSelect = this._get( inst, "onSelect" ); 11896 if ( onSelect ) { 11897 onSelect.apply( ( inst.input ? inst.input[ 0 ] : null ), [ dateStr, inst ] ); // trigger custom callback 11898 } else if ( inst.input ) { 11899 inst.input.trigger( "change" ); // fire the change event 11900 } 11901 11902 if ( inst.inline ) { 11903 this._updateDatepicker( inst ); 11904 } else { 11905 this._hideDatepicker(); 11906 this._lastInput = inst.input[ 0 ]; 11907 if ( typeof( inst.input[ 0 ] ) !== "object" ) { 11908 inst.input.trigger( "focus" ); // restore focus 11909 } 11910 this._lastInput = null; 11911 } 11912 }, 11913 11914 /* Update any alternate field to synchronise with the main field. */ 11915 _updateAlternate: function( inst ) { 11916 var altFormat, date, dateStr, 11917 altField = this._get( inst, "altField" ); 11918 11919 if ( altField ) { // update alternate field too 11920 altFormat = this._get( inst, "altFormat" ) || this._get( inst, "dateFormat" ); 11921 date = this._getDate( inst ); 11922 dateStr = this.formatDate( altFormat, date, this._getFormatConfig( inst ) ); 11923 $( document ).find( altField ).val( dateStr ); 11924 } 11925 }, 11926 11927 /* Set as beforeShowDay function to prevent selection of weekends. 11928 * @param date Date - the date to customise 11929 * @return [boolean, string] - is this date selectable?, what is its CSS class? 11930 */ 11931 noWeekends: function( date ) { 11932 var day = date.getDay(); 11933 return [ ( day > 0 && day < 6 ), "" ]; 11934 }, 11935 11936 /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. 11937 * @param date Date - the date to get the week for 11938 * @return number - the number of the week within the year that contains this date 11939 */ 11940 iso8601Week: function( date ) { 11941 var time, 11942 checkDate = new Date( date.getTime() ); 11943 11944 // Find Thursday of this week starting on Monday 11945 checkDate.setDate( checkDate.getDate() + 4 - ( checkDate.getDay() || 7 ) ); 11946 11947 time = checkDate.getTime(); 11948 checkDate.setMonth( 0 ); // Compare with Jan 1 11949 checkDate.setDate( 1 ); 11950 return Math.floor( Math.round( ( time - checkDate ) / 86400000 ) / 7 ) + 1; 11951 }, 11952 11953 /* Parse a string value into a date object. 11954 * See formatDate below for the possible formats. 11955 * 11956 * @param format string - the expected format of the date 11957 * @param value string - the date in the above format 11958 * @param settings Object - attributes include: 11959 * shortYearCutoff number - the cutoff year for determining the century (optional) 11960 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 11961 * dayNames string[7] - names of the days from Sunday (optional) 11962 * monthNamesShort string[12] - abbreviated names of the months (optional) 11963 * monthNames string[12] - names of the months (optional) 11964 * @return Date - the extracted date value or null if value is blank 11965 */ 11966 parseDate: function( format, value, settings ) { 11967 if ( format == null || value == null ) { 11968 throw "Invalid arguments"; 11969 } 11970 11971 value = ( typeof value === "object" ? value.toString() : value + "" ); 11972 if ( value === "" ) { 11973 return null; 11974 } 11975 11976 var iFormat, dim, extra, 11977 iValue = 0, 11978 shortYearCutoffTemp = ( settings ? settings.shortYearCutoff : null ) || this._defaults.shortYearCutoff, 11979 shortYearCutoff = ( typeof shortYearCutoffTemp !== "string" ? shortYearCutoffTemp
vendor: 5,431 bytes, lines 11979-12169
11979: 11980 new Date().getFullYear() % 100 + parseInt( shortYearCutoffTemp, 10 ) ), 11981 dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort, 11982 dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames, 11983 monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort, 11984 monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames, 11985 year = -1, 11986 month = -1, 11987 day = -1, 11988 doy = -1, 11989 literal = false, 11990 date, 11991 11992 // Check whether a format character is doubled 11993 lookAhead = function( match ) { 11994 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 11995 if ( matches ) { 11996 iFormat++; 11997 } 11998 return matches; 11999 }, 12000 12001 // Extract a number from the string value 12002 getNumber = function( match ) { 12003 var isDoubled = lookAhead( match ), 12004 size = ( match === "@" ? 14 : ( match === "!" ? 20 : 12005 ( match === "y" && isDoubled ? 4 : ( match === "o" ? 3 : 2 ) ) ) ), 12006 minSize = ( match === "y" ? size : 1 ), 12007 digits = new RegExp( "^\\d{" + minSize + "," + size + "}" ), 12008 num = value.substring( iValue ).match( digits ); 12009 if ( !num ) { 12010 throw "Missing number at position " + iValue; 12011 } 12012 iValue += num[ 0 ].length; 12013 return parseInt( num[ 0 ], 10 ); 12014 }, 12015 12016 // Extract a name from the string value and convert to an index 12017 getName = function( match, shortNames, longNames ) { 12018 var index = -1, 12019 names = $.map( lookAhead( match ) ? longNames : shortNames, function( v, k ) { 12020 return [ [ k, v ] ]; 12021 } ).sort( function( a, b ) { 12022 return -( a[ 1 ].length - b[ 1 ].length ); 12023 } ); 12024 12025 $.each( names, function( i, pair ) { 12026 var name = pair[ 1 ]; 12027 if ( value.substr( iValue, name.length ).toLowerCase() === name.toLowerCase() ) { 12028 index = pair[ 0 ]; 12029 iValue += name.length; 12030 return false; 12031 } 12032 } ); 12033 if ( index !== -1 ) { 12034 return index + 1; 12035 } else { 12036 throw "Unknown name at position " + iValue; 12037 } 12038 }, 12039 12040 // Confirm that a literal character matches the string value 12041 checkLiteral = function() { 12042 if ( value.charAt( iValue ) !== format.charAt( iFormat ) ) { 12043 throw "Unexpected literal at position " + iValue; 12044 } 12045 iValue++; 12046 }; 12047 12048 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 12049 if ( literal ) { 12050 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 12051 literal = false; 12052 } else { 12053 checkLiteral(); 12054 } 12055 } else { 12056 switch ( format.charAt( iFormat ) ) { 12057 case "d": 12058 day = getNumber( "d" ); 12059 break; 12060 case "D": 12061 getName( "D", dayNamesShort, dayNames ); 12062 break; 12063 case "o": 12064 doy = getNumber( "o" ); 12065 break; 12066 case "m": 12067 month = getNumber( "m" ); 12068 break; 12069 case "M": 12070 month = getName( "M", monthNamesShort, monthNames ); 12071 break; 12072 case "y": 12073 year = getNumber( "y" ); 12074 break; 12075 case "@": 12076 date = new Date( getNumber( "@" ) ); 12077 year = date.getFullYear(); 12078 month = date.getMonth() + 1; 12079 day = date.getDate(); 12080 break; 12081 case "!": 12082 date = new Date( ( getNumber( "!" ) - this._ticksTo1970 ) / 10000 ); 12083 year = date.getFullYear(); 12084 month = date.getMonth() + 1; 12085 day = date.getDate(); 12086 break; 12087 case "'": 12088 if ( lookAhead( "'" ) ) { 12089 checkLiteral(); 12090 } else { 12091 literal = true; 12092 } 12093 break; 12094 default: 12095 checkLiteral(); 12096 } 12097 } 12098 } 12099 12100 if ( iValue < value.length ) { 12101 extra = value.substr( iValue ); 12102 if ( !/^\s+/.test( extra ) ) { 12103 throw "Extra/unparsed characters found in date: " + extra; 12104 } 12105 } 12106 12107 if ( year === -1 ) { 12108 year = new Date().getFullYear(); 12109 } else if ( year < 100 ) { 12110 year += new Date().getFullYear() - new Date().getFullYear() % 100 + 12111 ( year <= shortYearCutoff ? 0 : -100 ); 12112 } 12113 12114 if ( doy > -1 ) { 12115 month = 1; 12116 day = doy; 12117 do { 12118 dim = this._getDaysInMonth( year, month - 1 ); 12119 if ( day <= dim ) { 12120 break; 12121 } 12122 month++; 12123 day -= dim; 12124 } while ( true ); 12125 } 12126 12127 date = this._daylightSavingAdjust( new Date( year, month - 1, day ) ); 12128 if ( date.getFullYear() !== year || date.getMonth() + 1 !== month || date.getDate() !== day ) { 12129 throw "Invalid date"; // E.g. 31/02/00 12130 } 12131 return date; 12132 }, 12133 12134 /* Standard date formats. */ 12135 ATOM: "yy-mm-dd", // RFC 3339 (ISO 8601) 12136 COOKIE: "D, dd M yy", 12137 ISO_8601: "yy-mm-dd", 12138 RFC_822: "D, d M y", 12139 RFC_850: "DD, dd-M-y", 12140 RFC_1036: "D, d M y", 12141 RFC_1123: "D, d M yy", 12142 RFC_2822: "D, d M yy", 12143 RSS: "D, d M y", // RFC 822 12144 TICKS: "!", 12145 TIMESTAMP: "@", 12146 W3C: "yy-mm-dd", // ISO 8601 12147 12148 _ticksTo1970: ( ( ( 1970 - 1 ) * 365 + Math.floor( 1970 / 4 ) - Math.floor( 1970 / 100 ) + 12149 Math.floor( 1970 / 400 ) ) * 24 * 60 * 60 * 10000000 ), 12150 12151 /* Format a date object into a string value. 12152 * The format can be combinations of the following: 12153 * d - day of month (no leading zero) 12154 * dd - day of month (two digit) 12155 * o - day of year (no leading zeros) 12156 * oo - day of year (three digit) 12157 * D - day name short 12158 * DD - day name long 12159 * m - month of year (no leading zero) 12160 * mm - month of year (two digit) 12161 * M - month name short 12162 * MM - month name long 12163 * y - year (two digit) 12164 * yy - year (four digit) 12165 * @ - Unix timestamp (ms since 01/01/1970) 12166 * ! - Windows ticks (100ns since 01/01/0001) 12167 * "..." - literal text 12168 * '' - single quote 12169 *
vendor: 6,198 bytes, lines 12170-12369
12170 * @param format string - the desired format of the date 12171 * @param date Date - the date value to format 12172 * @param settings Object - attributes include: 12173 * dayNamesShort string[7] - abbreviated names of the days from Sunday (optional) 12174 * dayNames string[7] - names of the days from Sunday (optional) 12175 * monthNamesShort string[12] - abbreviated names of the months (optional) 12176 * monthNames string[12] - names of the months (optional) 12177 * @return string - the date in the above format 12178 */ 12179 formatDate: function( format, date, settings ) { 12180 if ( !date ) { 12181 return ""; 12182 } 12183 12184 var iFormat, 12185 dayNamesShort = ( settings ? settings.dayNamesShort : null ) || this._defaults.dayNamesShort, 12186 dayNames = ( settings ? settings.dayNames : null ) || this._defaults.dayNames, 12187 monthNamesShort = ( settings ? settings.monthNamesShort : null ) || this._defaults.monthNamesShort, 12188 monthNames = ( settings ? settings.monthNames : null ) || this._defaults.monthNames, 12189 12190 // Check whether a format character is doubled 12191 lookAhead = function( match ) { 12192 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 12193 if ( matches ) { 12194 iFormat++; 12195 } 12196 return matches; 12197 }, 12198 12199 // Format a number, with leading zero if necessary 12200 formatNumber = function( match, value, len ) { 12201 var num = "" + value; 12202 if ( lookAhead( match ) ) { 12203 while ( num.length < len ) { 12204 num = "0" + num; 12205 } 12206 } 12207 return num; 12208 }, 12209 12210 // Format a name, short or long as requested 12211 formatName = function( match, value, shortNames, longNames ) { 12212 return ( lookAhead( match ) ? longNames[ value ] : shortNames[ value ] ); 12213 }, 12214 output = "", 12215 literal = false; 12216 12217 if ( date ) { 12218 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 12219 if ( literal ) { 12220 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 12221 literal = false; 12222 } else { 12223 output += format.charAt( iFormat ); 12224 } 12225 } else { 12226 switch ( format.charAt( iFormat ) ) { 12227 case "d": 12228 output += formatNumber( "d", date.getDate(), 2 ); 12229 break; 12230 case "D": 12231 output += formatName( "D", date.getDay(), dayNamesShort, dayNames ); 12232 break; 12233 case "o": 12234 output += formatNumber( "o", 12235 Math.round( ( new Date( date.getFullYear(), date.getMonth(), date.getDate() ).getTime() - new Date( date.getFullYear(), 0, 0 ).getTime() ) / 86400000 ), 3 ); 12236 break; 12237 case "m": 12238 output += formatNumber( "m", date.getMonth() + 1, 2 ); 12239 break; 12240 case "M": 12241 output += formatName( "M", date.getMonth(), monthNamesShort, monthNames ); 12242 break; 12243 case "y": 12244 output += ( lookAhead( "y" ) ? date.getFullYear() : 12245 ( date.getFullYear() % 100 < 10 ? "0" : "" ) + date.getFullYear() % 100 ); 12246 break; 12247 case "@": 12248 output += date.getTime(); 12249 break; 12250 case "!": 12251 output += date.getTime() * 10000 + this._ticksTo1970; 12252 break; 12253 case "'": 12254 if ( lookAhead( "'" ) ) { 12255 output += "'"; 12256 } else { 12257 literal = true; 12258 } 12259 break; 12260 default: 12261 output += format.charAt( iFormat ); 12262 } 12263 } 12264 } 12265 } 12266 return output; 12267 }, 12268 12269 /* Extract all possible characters from the date format. */ 12270 _possibleChars: function( format ) { 12271 var iFormat, 12272 chars = "", 12273 literal = false, 12274 12275 // Check whether a format character is doubled 12276 lookAhead = function( match ) { 12277 var matches = ( iFormat + 1 < format.length && format.charAt( iFormat + 1 ) === match ); 12278 if ( matches ) { 12279 iFormat++; 12280 } 12281 return matches; 12282 }; 12283 12284 for ( iFormat = 0; iFormat < format.length; iFormat++ ) { 12285 if ( literal ) { 12286 if ( format.charAt( iFormat ) === "'" && !lookAhead( "'" ) ) { 12287 literal = false; 12288 } else { 12289 chars += format.charAt( iFormat ); 12290 } 12291 } else { 12292 switch ( format.charAt( iFormat ) ) { 12293 case "d": case "m": case "y": case "@": 12294 chars += "0123456789"; 12295 break; 12296 case "D": case "M": 12297 return null; // Accept anything 12298 case "'": 12299 if ( lookAhead( "'" ) ) { 12300 chars += "'"; 12301 } else { 12302 literal = true; 12303 } 12304 break; 12305 default: 12306 chars += format.charAt( iFormat ); 12307 } 12308 } 12309 } 12310 return chars; 12311 }, 12312 12313 /* Get a setting value, defaulting if necessary. */ 12314 _get: function( inst, name ) { 12315 return inst.settings[ name ] !== undefined ? 12316 inst.settings[ name ] : this._defaults[ name ]; 12317 }, 12318 12319 /* Parse existing date and initialise date picker. */ 12320 _setDateFromField: function( inst, noDefault ) { 12321 if ( inst.input.val() === inst.lastVal ) { 12322 return; 12323 } 12324 12325 var dateFormat = this._get( inst, "dateFormat" ), 12326 dates = inst.lastVal = inst.input ? inst.input.val() : null, 12327 defaultDate = this._getDefaultDate( inst ), 12328 date = defaultDate, 12329 settings = this._getFormatConfig( inst ); 12330 12331 try { 12332 date = this.parseDate( dateFormat, dates, settings ) || defaultDate; 12333 } catch ( _err ) { 12334 dates = ( noDefault ? "" : dates ); 12335 } 12336 inst.selectedDay = date.getDate(); 12337 inst.drawMonth = inst.selectedMonth = date.getMonth(); 12338 inst.drawYear = inst.selectedYear = date.getFullYear(); 12339 inst.currentDay = ( dates ? date.getDate() : 0 ); 12340 inst.currentMonth = ( dates ? date.getMonth() : 0 ); 12341 inst.currentYear = ( dates ? date.getFullYear() : 0 ); 12342 this._adjustInstDate( inst ); 12343 }, 12344 12345 /* Retrieve the default date shown on opening. */ 12346 _getDefaultDate: function( inst ) { 12347 return this._restrictMinMax( inst, 12348 this._determineDate( inst, this._get( inst, "defaultDate" ), new Date() ) ); 12349 }, 12350 12351 /* A date may be specified as an exact value or a relative one. */ 12352 _determineDate: function( inst, date, defaultDate ) { 12353 var offsetNumeric = function( offset ) { 12354 var date = new Date(); 12355 date.setDate( date.getDate() + offset ); 12356 return date; 12357 }, 12358 offsetString = function( offset ) { 12359 try { 12360 return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), 12361 offset, $.datepicker._getFormatConfig( inst ) ); 12362 } catch ( _e ) { 12363 12364 // Ignore 12365 } 12366 12367 var date = ( offset.toLowerCase().match( /^c/ ) ? 12368 $.datepicker._getDate( inst ) : null ) || new Date(), 12369 year = date.getFullYear(),
vendor: 5,359 bytes, lines 12370-12508
12370 month = date.getMonth(), 12371 day = date.getDate(), 12372 pattern = /([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g, 12373 matches = pattern.exec( offset ); 12374 12375 while ( matches ) { 12376 switch ( matches[ 2 ] || "d" ) { 12377 case "d" : case "D" : 12378 day += parseInt( matches[ 1 ], 10 ); break; 12379 case "w" : case "W" : 12380 day += parseInt( matches[ 1 ], 10 ) * 7; break; 12381 case "m" : case "M" : 12382 month += parseInt( matches[ 1 ], 10 ); 12383 day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) ); 12384 break; 12385 case "y": case "Y" : 12386 year += parseInt( matches[ 1 ], 10 ); 12387 day = Math.min( day, $.datepicker._getDaysInMonth( year, month ) ); 12388 break; 12389 } 12390 matches = pattern.exec( offset ); 12391 } 12392 return new Date( year, month, day ); 12393 }, 12394 newDate = ( date == null || date === "" ? defaultDate : ( typeof date === "string" ? offsetString( date ) : 12395 ( typeof date === "number" ? ( isNaN( date ) ? defaultDate : offsetNumeric( date ) ) : new Date( date.getTime() ) ) ) ); 12396 12397 newDate = ( newDate && newDate.toString() === "Invalid Date" ? defaultDate : newDate ); 12398 if ( newDate ) { 12399 newDate.setHours( 0 ); 12400 newDate.setMinutes( 0 ); 12401 newDate.setSeconds( 0 ); 12402 newDate.setMilliseconds( 0 ); 12403 } 12404 return this._daylightSavingAdjust( newDate ); 12405 }, 12406 12407 /* Handle switch to/from daylight saving. 12408 * Hours may be non-zero on daylight saving cut-over: 12409 * > 12 when midnight changeover, but then cannot generate 12410 * midnight datetime, so jump to 1AM, otherwise reset. 12411 * @param date (Date) the date to check 12412 * @return (Date) the corrected date 12413 */ 12414 _daylightSavingAdjust: function( date ) { 12415 if ( !date ) { 12416 return null; 12417 } 12418 date.setHours( date.getHours() > 12 ? date.getHours() + 2 : 0 ); 12419 return date; 12420 }, 12421 12422 /* Set the date(s) directly. */ 12423 _setDate: function( inst, date, noChange ) { 12424 var clear = !date, 12425 origMonth = inst.selectedMonth, 12426 origYear = inst.selectedYear, 12427 newDate = this._restrictMinMax( inst, this._determineDate( inst, date, new Date() ) ); 12428 12429 inst.selectedDay = inst.currentDay = newDate.getDate(); 12430 inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth(); 12431 inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear(); 12432 if ( ( origMonth !== inst.selectedMonth || origYear !== inst.selectedYear ) && !noChange ) { 12433 this._notifyChange( inst ); 12434 } 12435 this._adjustInstDate( inst ); 12436 if ( inst.input ) { 12437 inst.input.val( clear ? "" : this._formatDate( inst ) ); 12438 } 12439 }, 12440 12441 /* Retrieve the date(s) directly. */ 12442 _getDate: function( inst ) { 12443 var startDate = ( !inst.currentYear || ( inst.input && inst.input.val() === "" ) ? null : 12444 this._daylightSavingAdjust( new Date( 12445 inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); 12446 return startDate; 12447 }, 12448 12449 /* Attach the onxxx handlers. These are declared statically so 12450 * they work with static code transformers like Caja. 12451 */ 12452 _attachHandlers: function( inst ) { 12453 var stepMonths = this._get( inst, "stepMonths" ), 12454 id = "#" + inst.id.replace( /\\\\/g, "\\" ); 12455 inst.dpDiv.find( "[data-handler]" ).map( function() { 12456 var handler = { 12457 prev: function() { 12458 $.datepicker._adjustDate( id, -stepMonths, "M" ); 12459 }, 12460 next: function() { 12461 $.datepicker._adjustDate( id, +stepMonths, "M" ); 12462 }, 12463 hide: function() { 12464 $.datepicker._hideDatepicker(); 12465 }, 12466 today: function() { 12467 $.datepicker._gotoToday( id ); 12468 }, 12469 selectDay: function() { 12470 $.datepicker._selectDay( id, +this.getAttribute( "data-month" ), +this.getAttribute( "data-year" ), this ); 12471 return false; 12472 }, 12473 selectMonth: function() { 12474 $.datepicker._selectMonthYear( id, this, "M" ); 12475 return false; 12476 }, 12477 selectYear: function() { 12478 $.datepicker._selectMonthYear( id, this, "Y" ); 12479 return false; 12480 } 12481 }; 12482 $( this ).on( this.getAttribute( "data-event" ), handler[ this.getAttribute( "data-handler" ) ] ); 12483 } ); 12484 }, 12485 12486 /* Generate the HTML for the current state of the date picker. */ 12487 _generateHTML: function( inst ) { 12488 var maxDraw, prevText, prev, nextText, next, currentText, gotoDate, 12489 controls, buttonPanel, firstDay, showWeek, dayNames, dayNamesMin, 12490 monthNames, monthNamesShort, beforeShowDay, showOtherMonths, 12491 selectOtherMonths, defaultDate, html, dow, row, group, col, selectedDate, 12492 cornerClass, calender, thead, day, daysInMonth, leadDays, curRows, numRows, 12493 printDate, dRow, tbody, daySettings, otherMonth, unselectable, 12494 tempDate = new Date(), 12495 today = this._daylightSavingAdjust( 12496 new Date( tempDate.getFullYear(), tempDate.getMonth(), tempDate.getDate() ) ), // clear time 12497 isRTL = this._get( inst, "isRTL" ), 12498 showButtonPanel = this._get( inst, "showButtonPanel" ), 12499 hideIfNoPrevNext = this._get( inst, "hideIfNoPrevNext" ), 12500 navigationAsDateFormat = this._get( inst, "navigationAsDateFormat" ), 12501 numMonths = this._getNumberOfMonths( inst ), 12502 showCurrentAtPos = this._get( inst, "showCurrentAtPos" ), 12503 stepMonths = this._get( inst, "stepMonths" ), 12504 isMultiMonth = ( numMonths[ 0 ] !== 1 || numMonths[ 1 ] !== 1 ), 12505 currentDate = this._daylightSavingAdjust( ( !inst.currentDay ? new Date( 9999, 9, 9 ) : 12506 new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ), 12507 minDate = this._getMinMaxDate( inst, "min" ), 12508 maxDate = this._getMinMaxDate( inst, "max" ),
vendor: 21,291 bytes, lines 12509-13027
12509 drawMonth = inst.drawMonth - showCurrentAtPos, 12510 drawYear = inst.drawYear; 12511 12512 if ( drawMonth < 0 ) { 12513 drawMonth += 12; 12514 drawYear--; 12515 } 12516 if ( maxDate ) { 12517 maxDraw = this._daylightSavingAdjust( new Date( maxDate.getFullYear(), 12518 maxDate.getMonth() - ( numMonths[ 0 ] * numMonths[ 1 ] ) + 1, maxDate.getDate() ) ); 12519 maxDraw = ( minDate && maxDraw < minDate ? minDate : maxDraw ); 12520 while ( this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 ) ) > maxDraw ) { 12521 drawMonth--; 12522 if ( drawMonth < 0 ) { 12523 drawMonth = 11; 12524 drawYear--; 12525 } 12526 } 12527 } 12528 inst.drawMonth = drawMonth; 12529 inst.drawYear = drawYear; 12530 12531 prevText = this._get( inst, "prevText" ); 12532 prevText = ( !navigationAsDateFormat ? prevText : this.formatDate( prevText, 12533 this._daylightSavingAdjust( new Date( drawYear, drawMonth - stepMonths, 1 ) ), 12534 this._getFormatConfig( inst ) ) ); 12535 12536 if ( this._canAdjustMonth( inst, -1, drawYear, drawMonth ) ) { 12537 prev = $( "<a>" ) 12538 .attr( { 12539 "class": "ui-datepicker-prev ui-corner-all", 12540 "data-handler": "prev", 12541 "data-event": "click", 12542 title: prevText 12543 } ) 12544 .append( 12545 $( "<span>" ) 12546 .addClass( "ui-icon ui-icon-circle-triangle-" + 12547 ( isRTL ? "e" : "w" ) ) 12548 .text( prevText ) 12549 )[ 0 ].outerHTML; 12550 } else if ( hideIfNoPrevNext ) { 12551 prev = ""; 12552 } else { 12553 prev = $( "<a>" ) 12554 .attr( { 12555 "class": "ui-datepicker-prev ui-corner-all ui-state-disabled", 12556 title: prevText 12557 } ) 12558 .append( 12559 $( "<span>" ) 12560 .addClass( "ui-icon ui-icon-circle-triangle-" + 12561 ( isRTL ? "e" : "w" ) ) 12562 .text( prevText ) 12563 )[ 0 ].outerHTML; 12564 } 12565 12566 nextText = this._get( inst, "nextText" ); 12567 nextText = ( !navigationAsDateFormat ? nextText : this.formatDate( nextText, 12568 this._daylightSavingAdjust( new Date( drawYear, drawMonth + stepMonths, 1 ) ), 12569 this._getFormatConfig( inst ) ) ); 12570 12571 if ( this._canAdjustMonth( inst, +1, drawYear, drawMonth ) ) { 12572 next = $( "<a>" ) 12573 .attr( { 12574 "class": "ui-datepicker-next ui-corner-all", 12575 "data-handler": "next", 12576 "data-event": "click", 12577 title: nextText 12578 } ) 12579 .append( 12580 $( "<span>" ) 12581 .addClass( "ui-icon ui-icon-circle-triangle-" + 12582 ( isRTL ? "w" : "e" ) ) 12583 .text( nextText ) 12584 )[ 0 ].outerHTML; 12585 } else if ( hideIfNoPrevNext ) { 12586 next = ""; 12587 } else { 12588 next = $( "<a>" ) 12589 .attr( { 12590 "class": "ui-datepicker-next ui-corner-all ui-state-disabled", 12591 title: nextText 12592 } ) 12593 .append( 12594 $( "<span>" ) 12595 .attr( "class", "ui-icon ui-icon-circle-triangle-" + 12596 ( isRTL ? "w" : "e" ) ) 12597 .text( nextText ) 12598 )[ 0 ].outerHTML; 12599 } 12600 12601 currentText = this._get( inst, "currentText" ); 12602 gotoDate = ( this._get( inst, "gotoCurrent" ) && inst.currentDay ? currentDate : today ); 12603 currentText = ( !navigationAsDateFormat ? currentText : 12604 this.formatDate( currentText, gotoDate, this._getFormatConfig( inst ) ) ); 12605 12606 controls = ""; 12607 if ( !inst.inline ) { 12608 controls = $( "<button>" ) 12609 .attr( { 12610 type: "button", 12611 "class": "ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all", 12612 "data-handler": "hide", 12613 "data-event": "click" 12614 } ) 12615 .text( this._get( inst, "closeText" ) )[ 0 ].outerHTML; 12616 } 12617 12618 buttonPanel = ""; 12619 if ( showButtonPanel ) { 12620 buttonPanel = $( "<div class='ui-datepicker-buttonpane ui-widget-content'>" ) 12621 .append( isRTL ? controls : "" ) 12622 .append( this._isInRange( inst, gotoDate ) ? 12623 $( "<button>" ) 12624 .attr( { 12625 type: "button", 12626 "class": "ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all", 12627 "data-handler": "today", 12628 "data-event": "click" 12629 } ) 12630 .text( currentText ) : 12631 "" ) 12632 .append( isRTL ? "" : controls )[ 0 ].outerHTML; 12633 } 12634 12635 firstDay = parseInt( this._get( inst, "firstDay" ), 10 ); 12636 firstDay = ( isNaN( firstDay ) ? 0 : firstDay ); 12637 12638 showWeek = this._get( inst, "showWeek" ); 12639 dayNames = this._get( inst, "dayNames" ); 12640 dayNamesMin = this._get( inst, "dayNamesMin" ); 12641 monthNames = this._get( inst, "monthNames" ); 12642 monthNamesShort = this._get( inst, "monthNamesShort" ); 12643 beforeShowDay = this._get( inst, "beforeShowDay" ); 12644 showOtherMonths = this._get( inst, "showOtherMonths" ); 12645 selectOtherMonths = this._get( inst, "selectOtherMonths" ); 12646 defaultDate = this._getDefaultDate( inst ); 12647 html = ""; 12648 12649 for ( row = 0; row < numMonths[ 0 ]; row++ ) { 12650 group = ""; 12651 this.maxRows = 4; 12652 for ( col = 0; col < numMonths[ 1 ]; col++ ) { 12653 selectedDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, inst.selectedDay ) ); 12654 cornerClass = " ui-corner-all"; 12655 calender = ""; 12656 if ( isMultiMonth ) { 12657 calender += "<div class='ui-datepicker-group"; 12658 if ( numMonths[ 1 ] > 1 ) { 12659 switch ( col ) { 12660 case 0: calender += " ui-datepicker-group-first"; 12661 cornerClass = " ui-corner-" + ( isRTL ? "right" : "left" ); break; 12662 case numMonths[ 1 ] - 1: calender += " ui-datepicker-group-last"; 12663 cornerClass = " ui-corner-" + ( isRTL ? "left" : "right" ); break; 12664 default: calender += " ui-datepicker-group-middle"; cornerClass = ""; break; 12665 } 12666 } 12667 calender += "'>"; 12668 } 12669 calender += "<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix" + cornerClass + "'>" + 12670 ( /all|left/.test( cornerClass ) && row === 0 ? ( isRTL ? next : prev ) : "" ) + 12671 ( /all|right/.test( cornerClass ) && row === 0 ? ( isRTL ? prev : next ) : "" ) + 12672 this._generateMonthYearHeader( inst, drawMonth, drawYear, minDate, maxDate, 12673 row > 0 || col > 0, monthNames, monthNamesShort ) + // draw month headers 12674 "</div><table class='ui-datepicker-calendar'><thead>" + 12675 "<tr>"; 12676 thead = ( showWeek ? "<th class='ui-datepicker-week-col'>" + this._get( inst, "weekHeader" ) + "</th>" : "" ); 12677 for ( dow = 0; dow < 7; dow++ ) { // days of the week 12678 day = ( dow + firstDay ) % 7; 12679 thead += "<th scope='col'" + ( ( dow + firstDay + 6 ) % 7 >= 5 ? " class='ui-datepicker-week-end'" : "" ) + ">" + 12680 "<span title='" + dayNames[ day ] + "'>" + dayNamesMin[ day ] + "</span></th>"; 12681 } 12682 calender += thead + "</tr></thead><tbody>"; 12683 daysInMonth = this._getDaysInMonth( drawYear, drawMonth ); 12684 if ( drawYear === inst.selectedYear && drawMonth === inst.selectedMonth ) { 12685 inst.selectedDay = Math.min( inst.selectedDay, daysInMonth ); 12686 } 12687 leadDays = ( this._getFirstDayOfMonth( drawYear, drawMonth ) - firstDay + 7 ) % 7; 12688 curRows = Math.ceil( ( leadDays + daysInMonth ) / 7 ); // calculate the number of rows to generate 12689 numRows = ( isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows ); //If multiple months, use the higher number of rows (see #7043) 12690 this.maxRows = numRows; 12691 printDate = this._daylightSavingAdjust( new Date( drawYear, drawMonth, 1 - leadDays ) ); 12692 for ( dRow = 0; dRow < numRows; dRow++ ) { // create date picker rows 12693 calender += "<tr>"; 12694 tbody = ( !showWeek ? "" : "<td class='ui-datepicker-week-col'>" + 12695 this._get( inst, "calculateWeek" )( printDate ) + "</td>" ); 12696 for ( dow = 0; dow < 7; dow++ ) { // create date picker days 12697 daySettings = ( beforeShowDay ? 12698 beforeShowDay.apply( ( inst.input ? inst.input[ 0 ] : null ), [ printDate ] ) : [ true, "" ] ); 12699 otherMonth = ( printDate.getMonth() !== drawMonth ); 12700 unselectable = ( otherMonth && !selectOtherMonths ) || !daySettings[ 0 ] || 12701 ( minDate && printDate < minDate ) || ( maxDate && printDate > maxDate ); 12702 tbody += "<td class='" + 12703 ( ( dow + firstDay + 6 ) % 7 >= 5 ? " ui-datepicker-week-end" : "" ) + // highlight weekends 12704 ( otherMonth ? " ui-datepicker-other-month" : "" ) + // highlight days from other months 12705 ( ( printDate.getTime() === selectedDate.getTime() && drawMonth === inst.selectedMonth && inst._keyEvent ) || // user pressed key 12706 ( defaultDate.getTime() === printDate.getTime() && defaultDate.getTime() === selectedDate.getTime() ) ? 12707 12708 // or defaultDate is current printedDate and defaultDate is selectedDate 12709 " " + this._dayOverClass : "" ) + // highlight selected day 12710 ( unselectable ? " " + this._unselectableClass + " ui-state-disabled" : "" ) + // highlight unselectable days 12711 ( otherMonth && !showOtherMonths ? "" : " " + daySettings[ 1 ] + // highlight custom dates 12712 ( printDate.getTime() === currentDate.getTime() ? " " + this._currentClass : "" ) + // highlight selected day 12713 ( printDate.getTime() === today.getTime() ? " ui-datepicker-today" : "" ) ) + "'" + // highlight today (if different) 12714 ( ( !otherMonth || showOtherMonths ) && daySettings[ 2 ] ? " title='" + daySettings[ 2 ].replace( /'/g, "'" ) + "'" : "" ) + // cell title 12715 ( unselectable ? "" : " data-handler='selectDay' data-event='click' data-month='" + printDate.getMonth() + "' data-year='" + printDate.getFullYear() + "'" ) + ">" + // actions 12716 ( otherMonth && !showOtherMonths ? " " : // display for other months 12717 ( unselectable ? "<span class='ui-state-default'>" + printDate.getDate() + "</span>" : "<a class='ui-state-default" + 12718 ( printDate.getTime() === today.getTime() ? " ui-state-highlight" : "" ) + 12719 ( printDate.getTime() === currentDate.getTime() ? " ui-state-active" : "" ) + // highlight selected day 12720 ( otherMonth ? " ui-priority-secondary" : "" ) + // distinguish dates from other months 12721 "' href='#' aria-current='" + ( printDate.getTime() === currentDate.getTime() ? "true" : "false" ) + // mark date as selected for screen reader 12722 "' data-date='" + printDate.getDate() + // store date as data 12723 "'>" + printDate.getDate() + "</a>" ) ) + "</td>"; // display selectable date 12724 printDate.setDate( printDate.getDate() + 1 ); 12725 printDate = this._daylightSavingAdjust( printDate ); 12726 } 12727 calender += tbody + "</tr>"; 12728 } 12729 drawMonth++; 12730 if ( drawMonth > 11 ) { 12731 drawMonth = 0; 12732 drawYear++; 12733 } 12734 calender += "</tbody></table>" + ( isMultiMonth ? "</div>" + 12735 ( ( numMonths[ 0 ] > 0 && col === numMonths[ 1 ] - 1 ) ? "<div class='ui-datepicker-row-break'></div>" : "" ) : "" ); 12736 group += calender; 12737 } 12738 html += group; 12739 } 12740 html += buttonPanel; 12741 inst._keyEvent = false; 12742 return html; 12743 }, 12744 12745 /* Generate the month and year header. */ 12746 _generateMonthYearHeader: function( inst, drawMonth, drawYear, minDate, maxDate, 12747 secondary, monthNames, monthNamesShort ) { 12748 12749 var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear, 12750 changeMonth = this._get( inst, "changeMonth" ), 12751 changeYear = this._get( inst, "changeYear" ), 12752 showMonthAfterYear = this._get( inst, "showMonthAfterYear" ), 12753 selectMonthLabel = this._get( inst, "selectMonthLabel" ), 12754 selectYearLabel = this._get( inst, "selectYearLabel" ), 12755 html = "<div class='ui-datepicker-title'>", 12756 monthHtml = ""; 12757 12758 // Month selection 12759 if ( secondary || !changeMonth ) { 12760 monthHtml += "<span class='ui-datepicker-month'>" + monthNames[ drawMonth ] + "</span>"; 12761 } else { 12762 inMinYear = ( minDate && minDate.getFullYear() === drawYear ); 12763 inMaxYear = ( maxDate && maxDate.getFullYear() === drawYear ); 12764 monthHtml += "<select class='ui-datepicker-month' aria-label='" + selectMonthLabel + "' data-handler='selectMonth' data-event='change'>"; 12765 for ( month = 0; month < 12; month++ ) { 12766 if ( ( !inMinYear || month >= minDate.getMonth() ) && ( !inMaxYear || month <= maxDate.getMonth() ) ) { 12767 monthHtml += "<option value='" + month + "'" + 12768 ( month === drawMonth ? " selected='selected'" : "" ) + 12769 ">" + monthNamesShort[ month ] + "</option>"; 12770 } 12771 } 12772 monthHtml += "</select>"; 12773 } 12774 12775 if ( !showMonthAfterYear ) { 12776 html += monthHtml + ( secondary || !( changeMonth && changeYear ) ? " " : "" ); 12777 } 12778 12779 // Year selection 12780 if ( !inst.yearshtml ) { 12781 inst.yearshtml = ""; 12782 if ( secondary || !changeYear ) { 12783 html += "<span class='ui-datepicker-year'>" + drawYear + "</span>"; 12784 } else { 12785 12786 // determine range of years to display 12787 years = this._get( inst, "yearRange" ).split( ":" ); 12788 thisYear = new Date().getFullYear(); 12789 determineYear = function( value ) { 12790 var year = ( value.match( /c[+\-].*/ ) ? drawYear + parseInt( value.substring( 1 ), 10 ) : 12791 ( value.match( /[+\-].*/ ) ? thisYear + parseInt( value, 10 ) : 12792 parseInt( value, 10 ) ) ); 12793 return ( isNaN( year ) ? thisYear : year ); 12794 }; 12795 year = determineYear( years[ 0 ] ); 12796 endYear = Math.max( year, determineYear( years[ 1 ] || "" ) ); 12797 year = ( minDate ? Math.max( year, minDate.getFullYear() ) : year ); 12798 endYear = ( maxDate ? Math.min( endYear, maxDate.getFullYear() ) : endYear ); 12799 inst.yearshtml += "<select class='ui-datepicker-year' aria-label='" + selectYearLabel + "' data-handler='selectYear' data-event='change'>"; 12800 for ( ; year <= endYear; year++ ) { 12801 inst.yearshtml += "<option value='" + year + "'" + 12802 ( year === drawYear ? " selected='selected'" : "" ) + 12803 ">" + year + "</option>"; 12804 } 12805 inst.yearshtml += "</select>"; 12806 12807 html += inst.yearshtml; 12808 inst.yearshtml = null; 12809 } 12810 } 12811 12812 html += this._get( inst, "yearSuffix" ); 12813 if ( showMonthAfterYear ) { 12814 html += ( secondary || !( changeMonth && changeYear ) ? " " : "" ) + monthHtml; 12815 } 12816 html += "</div>"; // Close datepicker_header 12817 return html; 12818 }, 12819 12820 /* Adjust one of the date sub-fields. */ 12821 _adjustInstDate: function( inst, offset, period ) { 12822 var year = inst.selectedYear + ( period === "Y" ? offset : 0 ), 12823 month = inst.selectedMonth + ( period === "M" ? offset : 0 ), 12824 day = Math.min( inst.selectedDay, this._getDaysInMonth( year, month ) ) + ( period === "D" ? offset : 0 ), 12825 date = this._restrictMinMax( inst, this._daylightSavingAdjust( new Date( year, month, day ) ) ); 12826 12827 inst.selectedDay = date.getDate(); 12828 inst.drawMonth = inst.selectedMonth = date.getMonth(); 12829 inst.drawYear = inst.selectedYear = date.getFullYear(); 12830 if ( period === "M" || period === "Y" ) { 12831 this._notifyChange( inst ); 12832 } 12833 }, 12834 12835 /* Ensure a date is within any min/max bounds. */ 12836 _restrictMinMax: function( inst, date ) { 12837 var minDate = this._getMinMaxDate( inst, "min" ), 12838 maxDate = this._getMinMaxDate( inst, "max" ), 12839 newDate = ( minDate && date < minDate ? minDate : date ); 12840 return ( maxDate && newDate > maxDate ? maxDate : newDate ); 12841 }, 12842 12843 /* Notify change of month/year. */ 12844 _notifyChange: function( inst ) { 12845 var onChange = this._get( inst, "onChangeMonthYear" ); 12846 if ( onChange ) { 12847 onChange.apply( ( inst.input ? inst.input[ 0 ] : null ), 12848 [ inst.selectedYear, inst.selectedMonth + 1, inst ] ); 12849 } 12850 }, 12851 12852 /* Determine the number of months to show. */ 12853 _getNumberOfMonths: function( inst ) { 12854 var numMonths = this._get( inst, "numberOfMonths" ); 12855 return ( numMonths == null ? [ 1, 1 ] : ( typeof numMonths === "number" ? [ 1, numMonths ] : numMonths ) ); 12856 }, 12857 12858 /* Determine the current maximum date - ensure no time components are set. */ 12859 _getMinMaxDate: function( inst, minMax ) { 12860 return this._determineDate( inst, this._get( inst, minMax + "Date" ), null ); 12861 }, 12862 12863 /* Find the number of days in a given month. */ 12864 _getDaysInMonth: function( year, month ) { 12865 return 32 - this._daylightSavingAdjust( new Date( year, month, 32 ) ).getDate(); 12866 }, 12867 12868 /* Find the day of the week of the first of a month. */ 12869 _getFirstDayOfMonth: function( year, month ) { 12870 return new Date( year, month, 1 ).getDay(); 12871 }, 12872 12873 /* Determines if we should allow a "next/prev" month display change. */ 12874 _canAdjustMonth: function( inst, offset, curYear, curMonth ) { 12875 var numMonths = this._getNumberOfMonths( inst ), 12876 date = this._daylightSavingAdjust( new Date( curYear, 12877 curMonth + ( offset < 0 ? offset : numMonths[ 0 ] * numMonths[ 1 ] ), 1 ) ); 12878 12879 if ( offset < 0 ) { 12880 date.setDate( this._getDaysInMonth( date.getFullYear(), date.getMonth() ) ); 12881 } 12882 return this._isInRange( inst, date ); 12883 }, 12884 12885 /* Is the given date in the accepted range? */ 12886 _isInRange: function( inst, date ) { 12887 var yearSplit, currentYear, 12888 minDate = this._getMinMaxDate( inst, "min" ), 12889 maxDate = this._getMinMaxDate( inst, "max" ), 12890 minYear = null, 12891 maxYear = null, 12892 years = this._get( inst, "yearRange" ); 12893 if ( years ) { 12894 yearSplit = years.split( ":" ); 12895 currentYear = new Date().getFullYear(); 12896 minYear = parseInt( yearSplit[ 0 ], 10 ); 12897 maxYear = parseInt( yearSplit[ 1 ], 10 ); 12898 if ( yearSplit[ 0 ].match( /[+\-].*/ ) ) { 12899 minYear += currentYear; 12900 } 12901 if ( yearSplit[ 1 ].match( /[+\-].*/ ) ) { 12902 maxYear += currentYear; 12903 } 12904 } 12905 12906 return ( ( !minDate || date.getTime() >= minDate.getTime() ) && 12907 ( !maxDate || date.getTime() <= maxDate.getTime() ) && 12908 ( !minYear || date.getFullYear() >= minYear ) && 12909 ( !maxYear || date.getFullYear() <= maxYear ) ); 12910 }, 12911 12912 /* Provide the configuration settings for formatting/parsing. */ 12913 _getFormatConfig: function( inst ) { 12914 var shortYearCutoff = this._get( inst, "shortYearCutoff" ); 12915 shortYearCutoff = ( typeof shortYearCutoff !== "string" ? shortYearCutoff : 12916 new Date().getFullYear() % 100 + parseInt( shortYearCutoff, 10 ) ); 12917 return { shortYearCutoff: shortYearCutoff, 12918 dayNamesShort: this._get( inst, "dayNamesShort" ), dayNames: this._get( inst, "dayNames" ), 12919 monthNamesShort: this._get( inst, "monthNamesShort" ), monthNames: this._get( inst, "monthNames" ) }; 12920 }, 12921 12922 /* Format the given date for display. */ 12923 _formatDate: function( inst, day, month, year ) { 12924 if ( !day ) { 12925 inst.currentDay = inst.selectedDay; 12926 inst.currentMonth = inst.selectedMonth; 12927 inst.currentYear = inst.selectedYear; 12928 } 12929 var date = ( day ? ( typeof day === "object" ? day : 12930 this._daylightSavingAdjust( new Date( year, month, day ) ) ) : 12931 this._daylightSavingAdjust( new Date( inst.currentYear, inst.currentMonth, inst.currentDay ) ) ); 12932 return this.formatDate( this._get( inst, "dateFormat" ), date, this._getFormatConfig( inst ) ); 12933 } 12934} ); 12935 12936/* 12937 * Bind hover events for datepicker elements. 12938 * Done via delegate so the binding only occurs once in the lifetime of the parent div. 12939 * Global datepicker_instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker. 12940 */ 12941function datepicker_bindHover( dpDiv ) { 12942 var selector = "button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a"; 12943 return dpDiv.on( "mouseout", selector, function() { 12944 $( this ).removeClass( "ui-state-hover" ); 12945 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { 12946 $( this ).removeClass( "ui-datepicker-prev-hover" ); 12947 } 12948 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { 12949 $( this ).removeClass( "ui-datepicker-next-hover" ); 12950 } 12951 } ) 12952 .on( "mouseover", selector, datepicker_handleMouseover ); 12953} 12954 12955function datepicker_handleMouseover() { 12956 if ( !$.datepicker._isDisabledDatepicker( datepicker_instActive.inline ? datepicker_instActive.dpDiv.parent()[ 0 ] : datepicker_instActive.input[ 0 ] ) ) { 12957 $( this ).parents( ".ui-datepicker-calendar" ).find( "a" ).removeClass( "ui-state-hover" ); 12958 $( this ).addClass( "ui-state-hover" ); 12959 if ( this.className.indexOf( "ui-datepicker-prev" ) !== -1 ) { 12960 $( this ).addClass( "ui-datepicker-prev-hover" ); 12961 } 12962 if ( this.className.indexOf( "ui-datepicker-next" ) !== -1 ) { 12963 $( this ).addClass( "ui-datepicker-next-hover" ); 12964 } 12965 } 12966} 12967 12968/* jQuery extend now ignores nulls! */ 12969function datepicker_extendRemove( target, props ) { 12970 $.extend( target, props ); 12971 for ( var name in props ) { 12972 if ( props[ name ] == null ) { 12973 target[ name ] = props[ name ]; 12974 } 12975 } 12976 return target; 12977} 12978 12979/* Invoke the datepicker functionality. 12980 @param options string - a command, optionally followed by additional parameters or 12981 Object - settings for attaching new datepicker functionality 12982 @return jQuery object */ 12983$.fn.datepicker = function( options ) { 12984 12985 /* Verify an empty collection wasn't passed - Fixes #6976 */ 12986 if ( !this.length ) { 12987 return this; 12988 } 12989 12990 /* Initialise the date picker. */ 12991 if ( !$.datepicker.initialized ) { 12992 $( document ).on( "mousedown", $.datepicker._checkExternalClick ); 12993 $.datepicker.initialized = true; 12994 } 12995 12996 /* Append datepicker main container to body if not exist. */ 12997 if ( $( "#" + $.datepicker._mainDivId ).length === 0 ) { 12998 $( "body" ).append( $.datepicker.dpDiv ); 12999 } 13000 13001 var otherArgs = Array.prototype.slice.call( arguments, 1 ); 13002 if ( typeof options === "string" && ( options === "isDisabled" || options === "getDate" || options === "widget" ) ) { 13003 return $.datepicker[ "_" + options + "Datepicker" ]. 13004 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); 13005 } 13006 if ( options === "option" && arguments.length === 2 && typeof arguments[ 1 ] === "string" ) { 13007 return $.datepicker[ "_" + options + "Datepicker" ]. 13008 apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); 13009 } 13010 return this.each( function() { 13011 if ( typeof options === "string" ) { 13012 $.datepicker[ "_" + options + "Datepicker" ] 13013 .apply( $.datepicker, [ this ].concat( otherArgs ) ); 13014 } else { 13015 $.datepicker._attachDatepicker( this, options ); 13016 } 13017 } ); 13018}; 13019 13020$.datepicker = new Datepicker(); // singleton instance 13021$.datepicker.initialized = false; 13022$.datepicker.uuid = new Date().getTime(); 13023$.datepicker.version = "1.14.2"; 13024 13025return $.datepicker; 13026 13027} );
13028 13029 13030/*! 13031 * jQuery UI Widget 1.14.2 13032 * https://jqueryui.com 13033 * 13034 * Copyright OpenJS Foundation and other contributors 13035 * Released under the MIT license. 13036 * https://jquery.org/license 13037 */ 13038 13039//>>label: Widget 13040//>>group: Core 13041//>>description: Provides a factory for creating stateful widgets with a common API. 13042//>>docs: https://api.jqueryui.com/jQuery.widget/ 13043//>>demos: https://jqueryui.com/widget/ 13044 13045( function( factory ) { 13046 "use strict"; 13047 13048 if ( typeof define === "function" && define.amd ) { 13049 13050 // AMD. Register as an anonymous module. 13051 define( [ "jquery", "./version" ], factory ); 13052 } else { 13053 13054 // Browser globals 13055 factory( jQuery ); 13056 } 13057} )( function( $ ) { 13058"use strict";
vendor: 19,709 bytes, lines 13058-13785
13058 13059 13060var widgetUuid = 0; 13061var widgetHasOwnProperty = Array.prototype.hasOwnProperty; 13062var widgetSlice = Array.prototype.slice; 13063 13064$.cleanData = ( function( orig ) { 13065 return function( elems ) { 13066 var events, elem, i; 13067 for ( i = 0; ( elem = elems[ i ] ) != null; i++ ) { 13068 13069 // Only trigger remove when necessary to save time 13070 events = $._data( elem, "events" ); 13071 if ( events && events.remove ) { 13072 $( elem ).triggerHandler( "remove" ); 13073 } 13074 } 13075 orig( elems ); 13076 }; 13077} )( $.cleanData ); 13078 13079$.widget = function( name, base, prototype ) { 13080 var existingConstructor, constructor, basePrototype; 13081 13082 // ProxiedPrototype allows the provided prototype to remain unmodified 13083 // so that it can be used as a mixin for multiple widgets (#8876) 13084 var proxiedPrototype = {}; 13085 13086 var namespace = name.split( "." )[ 0 ]; 13087 name = name.split( "." )[ 1 ]; 13088 if ( name === "__proto__" || name === "constructor" ) { 13089 return $.error( "Invalid widget name: " + name ); 13090 } 13091 var fullName = namespace + "-" + name; 13092 13093 if ( !prototype ) { 13094 prototype = base; 13095 base = $.Widget; 13096 } 13097 13098 if ( Array.isArray( prototype ) ) { 13099 prototype = $.extend.apply( null, [ {} ].concat( prototype ) ); 13100 } 13101 13102 // Create selector for plugin 13103 $.expr.pseudos[ fullName.toLowerCase() ] = function( elem ) { 13104 return !!$.data( elem, fullName ); 13105 }; 13106 13107 $[ namespace ] = $[ namespace ] || {}; 13108 existingConstructor = $[ namespace ][ name ]; 13109 constructor = $[ namespace ][ name ] = function( options, element ) { 13110 13111 // Allow instantiation without "new" keyword 13112 if ( !this || !this._createWidget ) { 13113 return new constructor( options, element ); 13114 } 13115 13116 // Allow instantiation without initializing for simple inheritance 13117 // must use "new" keyword (the code above always passes args) 13118 if ( arguments.length ) { 13119 this._createWidget( options, element ); 13120 } 13121 }; 13122 13123 // Extend with the existing constructor to carry over any static properties 13124 $.extend( constructor, existingConstructor, { 13125 version: prototype.version, 13126 13127 // Copy the object used to create the prototype in case we need to 13128 // redefine the widget later 13129 _proto: $.extend( {}, prototype ), 13130 13131 // Track widgets that inherit from this widget in case this widget is 13132 // redefined after a widget inherits from it 13133 _childConstructors: [] 13134 } ); 13135 13136 basePrototype = new base(); 13137 13138 // We need to make the options hash a property directly on the new instance 13139 // otherwise we'll modify the options hash on the prototype that we're 13140 // inheriting from 13141 basePrototype.options = $.widget.extend( {}, basePrototype.options ); 13142 $.each( prototype, function( prop, value ) { 13143 if ( typeof value !== "function" ) { 13144 proxiedPrototype[ prop ] = value; 13145 return; 13146 } 13147 proxiedPrototype[ prop ] = ( function() { 13148 function _super() { 13149 return base.prototype[ prop ].apply( this, arguments ); 13150 } 13151 13152 function _superApply( args ) { 13153 return base.prototype[ prop ].apply( this, args ); 13154 } 13155 13156 return function() { 13157 var __super = this._super; 13158 var __superApply = this._superApply; 13159 var returnValue; 13160 13161 this._super = _super; 13162 this._superApply = _superApply; 13163 13164 returnValue = value.apply( this, arguments ); 13165 13166 this._super = __super; 13167 this._superApply = __superApply; 13168 13169 return returnValue; 13170 }; 13171 } )(); 13172 } ); 13173 constructor.prototype = $.widget.extend( basePrototype, { 13174 13175 // TODO: remove support for widgetEventPrefix 13176 // always use the name + a colon as the prefix, e.g., draggable:start 13177 // don't prefix for widgets that aren't DOM-based 13178 widgetEventPrefix: existingConstructor ? ( basePrototype.widgetEventPrefix || name ) : name 13179 }, proxiedPrototype, { 13180 constructor: constructor, 13181 namespace: namespace, 13182 widgetName: name, 13183 widgetFullName: fullName 13184 } ); 13185 13186 // If this widget is being redefined then we need to find all widgets that 13187 // are inheriting from it and redefine all of them so that they inherit from 13188 // the new version of this widget. We're essentially trying to replace one 13189 // level in the prototype chain. 13190 if ( existingConstructor ) { 13191 $.each( existingConstructor._childConstructors, function( i, child ) { 13192 var childPrototype = child.prototype; 13193 13194 // Redefine the child widget using the same prototype that was 13195 // originally used, but inherit from the new version of the base 13196 $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, 13197 child._proto ); 13198 } ); 13199 13200 // Remove the list of existing child constructors from the old constructor 13201 // so the old child constructors can be garbage collected 13202 delete existingConstructor._childConstructors; 13203 } else { 13204 base._childConstructors.push( constructor ); 13205 } 13206 13207 $.widget.bridge( name, constructor ); 13208 13209 return constructor; 13210}; 13211 13212$.widget.extend = function( target ) { 13213 var input = widgetSlice.call( arguments, 1 ); 13214 var inputIndex = 0; 13215 var inputLength = input.length; 13216 var key; 13217 var value; 13218 13219 for ( ; inputIndex < inputLength; inputIndex++ ) { 13220 for ( key in input[ inputIndex ] ) { 13221 value = input[ inputIndex ][ key ]; 13222 if ( widgetHasOwnProperty.call( input[ inputIndex ], key ) && value !== undefined ) { 13223 13224 // Clone objects 13225 if ( $.isPlainObject( value ) ) { 13226 target[ key ] = $.isPlainObject( target[ key ] ) ? 13227 $.widget.extend( {}, target[ key ], value ) : 13228 13229 // Don't extend strings, arrays, etc. with objects 13230 $.widget.extend( {}, value ); 13231 13232 // Copy everything else by reference 13233 } else { 13234 target[ key ] = value; 13235 } 13236 } 13237 } 13238 } 13239 return target; 13240}; 13241 13242$.widget.bridge = function( name, object ) { 13243 var fullName = object.prototype.widgetFullName || name; 13244 $.fn[ name ] = function( options ) { 13245 var isMethodCall = typeof options === "string"; 13246 var args = widgetSlice.call( arguments, 1 ); 13247 var returnValue = this; 13248 13249 if ( isMethodCall ) { 13250 13251 // If this is an empty collection, we need to have the instance method 13252 // return undefined instead of the jQuery instance 13253 if ( !this.length && options === "instance" ) { 13254 returnValue = undefined; 13255 } else { 13256 this.each( function() { 13257 var methodValue; 13258 var instance = $.data( this, fullName ); 13259 13260 if ( options === "instance" ) { 13261 returnValue = instance; 13262 return false; 13263 } 13264 13265 if ( !instance ) { 13266 return $.error( "cannot call methods on " + name + 13267 " prior to initialization; " + 13268 "attempted to call method '" + options + "'" ); 13269 } 13270 13271 if ( typeof instance[ options ] !== "function" || 13272 options.charAt( 0 ) === "_" ) { 13273 return $.error( "no such method '" + options + "' for " + name + 13274 " widget instance" ); 13275 } 13276 13277 methodValue = instance[ options ].apply( instance, args ); 13278 13279 if ( methodValue !== instance && methodValue !== undefined ) { 13280 returnValue = methodValue && methodValue.jquery ? 13281 returnValue.pushStack( methodValue.get() ) : 13282 methodValue; 13283 return false; 13284 } 13285 } ); 13286 } 13287 } else { 13288 13289 // Allow multiple hashes to be passed on init 13290 if ( args.length ) { 13291 options = $.widget.extend.apply( null, [ options ].concat( args ) ); 13292 } 13293 13294 this.each( function() { 13295 var instance = $.data( this, fullName ); 13296 if ( instance ) { 13297 instance.option( options || {} ); 13298 if ( instance._init ) { 13299 instance._init(); 13300 } 13301 } else { 13302 $.data( this, fullName, new object( options, this ) ); 13303 } 13304 } ); 13305 } 13306 13307 return returnValue; 13308 }; 13309}; 13310 13311$.Widget = function( /* options, element */ ) {}; 13312$.Widget._childConstructors = []; 13313 13314$.Widget.prototype = { 13315 widgetName: "widget", 13316 widgetEventPrefix: "", 13317 defaultElement: "<div>", 13318 13319 options: { 13320 classes: {}, 13321 disabled: false, 13322 13323 // Callbacks 13324 create: null 13325 }, 13326 13327 _createWidget: function( options, element ) { 13328 element = $( element || this.defaultElement || this )[ 0 ]; 13329 this.element = $( element ); 13330 this.uuid = widgetUuid++; 13331 this.eventNamespace = "." + this.widgetName + this.uuid; 13332 13333 this.bindings = $(); 13334 this.hoverable = $(); 13335 this.focusable = $(); 13336 this.classesElementLookup = {}; 13337 13338 if ( element !== this ) { 13339 $.data( element, this.widgetFullName, this ); 13340 this._on( true, this.element, { 13341 remove: function( event ) { 13342 if ( event.target === element ) { 13343 this.destroy(); 13344 } 13345 } 13346 } ); 13347 this.document = $( element.style ? 13348 13349 // Element within the document 13350 element.ownerDocument : 13351 13352 // Element is window or document 13353 element.document || element ); 13354 this.window = $( this.document[ 0 ].defaultView || this.document[ 0 ].parentWindow ); 13355 } 13356 13357 this.options = $.widget.extend( {}, 13358 this.options, 13359 this._getCreateOptions(), 13360 options ); 13361 13362 this._create(); 13363 13364 if ( this.options.disabled ) { 13365 this._setOptionDisabled( this.options.disabled ); 13366 } 13367 13368 this._trigger( "create", null, this._getCreateEventData() ); 13369 this._init(); 13370 }, 13371 13372 _getCreateOptions: function() { 13373 return {}; 13374 }, 13375 13376 _getCreateEventData: $.noop, 13377 13378 _create: $.noop, 13379 13380 _init: $.noop, 13381 13382 destroy: function() { 13383 var that = this; 13384 13385 this._destroy(); 13386 $.each( this.classesElementLookup, function( key, value ) { 13387 that._removeClass( value, key ); 13388 } ); 13389 13390 // We can probably remove the unbind calls in 2.0 13391 // all event bindings should go through this._on() 13392 this.element 13393 .off( this.eventNamespace ) 13394 .removeData( this.widgetFullName ); 13395 this.widget() 13396 .off( this.eventNamespace ) 13397 .removeAttr( "aria-disabled" ); 13398 13399 // Clean up events and states 13400 this.bindings.off( this.eventNamespace ); 13401 }, 13402 13403 _destroy: $.noop, 13404 13405 widget: function() { 13406 return this.element; 13407 }, 13408 13409 option: function( key, value ) { 13410 var options = key; 13411 var parts; 13412 var curOption; 13413 var i; 13414 13415 if ( arguments.length === 0 ) { 13416 13417 // Don't return a reference to the internal hash 13418 return $.widget.extend( {}, this.options ); 13419 } 13420 13421 if ( typeof key === "string" ) { 13422 13423 // Handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } 13424 options = {}; 13425 parts = key.split( "." ); 13426 key = parts.shift(); 13427 if ( parts.length ) { 13428 curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); 13429 for ( i = 0; i < parts.length - 1; i++ ) { 13430 curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; 13431 curOption = curOption[ parts[ i ] ]; 13432 } 13433 key = parts.pop(); 13434 if ( arguments.length === 1 ) { 13435 return curOption[ key ] === undefined ? null : curOption[ key ]; 13436 } 13437 curOption[ key ] = value; 13438 } else { 13439 if ( arguments.length === 1 ) { 13440 return this.options[ key ] === undefined ? null : this.options[ key ]; 13441 } 13442 options[ key ] = value; 13443 } 13444 } 13445 13446 this._setOptions( options ); 13447 13448 return this; 13449 }, 13450 13451 _setOptions: function( options ) { 13452 var key; 13453 13454 for ( key in options ) { 13455 this._setOption( key, options[ key ] ); 13456 } 13457 13458 return this; 13459 }, 13460 13461 _setOption: function( key, value ) { 13462 if ( key === "classes" ) { 13463 this._setOptionClasses( value ); 13464 } 13465 13466 this.options[ key ] = value; 13467 13468 if ( key === "disabled" ) { 13469 this._setOptionDisabled( value ); 13470 } 13471 13472 return this; 13473 }, 13474 13475 _setOptionClasses: function( value ) { 13476 var classKey, elements, currentElements; 13477 13478 for ( classKey in value ) { 13479 currentElements = this.classesElementLookup[ classKey ]; 13480 if ( value[ classKey ] === this.options.classes[ classKey ] || 13481 !currentElements || 13482 !currentElements.length ) { 13483 continue; 13484 } 13485 13486 // We are doing this to create a new jQuery object because the _removeClass() call 13487 // on the next line is going to destroy the reference to the current elements being 13488 // tracked. We need to save a copy of this collection so that we can add the new classes 13489 // below. 13490 elements = $( currentElements.get() ); 13491 this._removeClass( currentElements, classKey ); 13492 13493 // We don't use _addClass() here, because that uses this.options.classes 13494 // for generating the string of classes. We want to use the value passed in from 13495 // _setOption(), this is the new value of the classes option which was passed to 13496 // _setOption(). We pass this value directly to _classes(). 13497 elements.addClass( this._classes( { 13498 element: elements, 13499 keys: classKey, 13500 classes: value, 13501 add: true 13502 } ) ); 13503 } 13504 }, 13505 13506 _setOptionDisabled: function( value ) { 13507 this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, !!value ); 13508 13509 // If the widget is becoming disabled, then nothing is interactive 13510 if ( value ) { 13511 this._removeClass( this.hoverable, null, "ui-state-hover" ); 13512 this._removeClass( this.focusable, null, "ui-state-focus" ); 13513 } 13514 }, 13515 13516 enable: function() { 13517 return this._setOptions( { disabled: false } ); 13518 }, 13519 13520 disable: function() { 13521 return this._setOptions( { disabled: true } ); 13522 }, 13523 13524 _classes: function( options ) { 13525 var full = []; 13526 var that = this; 13527 13528 options = $.extend( { 13529 element: this.element, 13530 classes: this.options.classes || {} 13531 }, options ); 13532 13533 function bindRemoveEvent() { 13534 var nodesToBind = []; 13535 13536 options.element.each( function( _, element ) { 13537 var isTracked = $.map( that.classesElementLookup, function( elements ) { 13538 return elements; 13539 } ) 13540 .some( function( elements ) { 13541 return elements.is( element ); 13542 } ); 13543 13544 if ( !isTracked ) { 13545 nodesToBind.push( element ); 13546 } 13547 } ); 13548 13549 that._on( $( nodesToBind ), { 13550 remove: "_untrackClassesElement" 13551 } ); 13552 } 13553 13554 function processClassString( classes, checkOption ) { 13555 var current, i; 13556 for ( i = 0; i < classes.length; i++ ) { 13557 current = that.classesElementLookup[ classes[ i ] ] || $(); 13558 if ( options.add ) { 13559 bindRemoveEvent(); 13560 current = $( $.uniqueSort( current.get().concat( options.element.get() ) ) ); 13561 } else { 13562 current = $( current.not( options.element ).get() ); 13563 } 13564 that.classesElementLookup[ classes[ i ] ] = current; 13565 full.push( classes[ i ] ); 13566 if ( checkOption && options.classes[ classes[ i ] ] ) { 13567 full.push( options.classes[ classes[ i ] ] ); 13568 } 13569 } 13570 } 13571 13572 if ( options.keys ) { 13573 processClassString( options.keys.match( /\S+/g ) || [], true ); 13574 } 13575 if ( options.extra ) { 13576 processClassString( options.extra.match( /\S+/g ) || [] ); 13577 } 13578 13579 return full.join( " " ); 13580 }, 13581 13582 _untrackClassesElement: function( event ) { 13583 var that = this; 13584 $.each( that.classesElementLookup, function( key, value ) { 13585 if ( $.inArray( event.target, value ) !== -1 ) { 13586 that.classesElementLookup[ key ] = $( value.not( event.target ).get() ); 13587 } 13588 } ); 13589 13590 this._off( $( event.target ) ); 13591 }, 13592 13593 _removeClass: function( element, keys, extra ) { 13594 return this._toggleClass( element, keys, extra, false ); 13595 }, 13596 13597 _addClass: function( element, keys, extra ) { 13598 return this._toggleClass( element, keys, extra, true ); 13599 }, 13600 13601 _toggleClass: function( element, keys, extra, add ) { 13602 add = ( typeof add === "boolean" ) ? add : extra; 13603 var shift = ( typeof element === "string" || element === null ), 13604 options = { 13605 extra: shift ? keys : extra, 13606 keys: shift ? element : keys, 13607 element: shift ? this.element : element, 13608 add: add 13609 }; 13610 options.element.toggleClass( this._classes( options ), add ); 13611 return this; 13612 }, 13613 13614 _on: function( suppressDisabledCheck, element, handlers ) { 13615 var delegateElement; 13616 var instance = this; 13617 13618 // No suppressDisabledCheck flag, shuffle arguments 13619 if ( typeof suppressDisabledCheck !== "boolean" ) { 13620 handlers = element; 13621 element = suppressDisabledCheck; 13622 suppressDisabledCheck = false; 13623 } 13624 13625 // No element argument, shuffle and use this.element 13626 if ( !handlers ) { 13627 handlers = element; 13628 element = this.element; 13629 delegateElement = this.widget(); 13630 } else { 13631 element = delegateElement = $( element ); 13632 this.bindings = this.bindings.add( element ); 13633 } 13634 13635 $.each( handlers, function( event, handler ) { 13636 function handlerProxy() { 13637 13638 // Allow widgets to customize the disabled handling 13639 // - disabled as an array instead of boolean 13640 // - disabled class as method for disabling individual parts 13641 if ( !suppressDisabledCheck && 13642 ( instance.options.disabled === true || 13643 $( this ).hasClass( "ui-state-disabled" ) ) ) { 13644 return; 13645 } 13646 return ( typeof handler === "string" ? instance[ handler ] : handler ) 13647 .apply( instance, arguments ); 13648 } 13649 13650 // Copy the guid so direct unbinding works 13651 if ( typeof handler !== "string" ) { 13652 handlerProxy.guid = handler.guid = 13653 handler.guid || handlerProxy.guid || $.guid++; 13654 } 13655 13656 var match = event.match( /^([\w:-]*)\s*(.*)$/ ); 13657 var eventName = match[ 1 ] + instance.eventNamespace; 13658 var selector = match[ 2 ]; 13659 13660 if ( selector ) { 13661 delegateElement.on( eventName, selector, handlerProxy ); 13662 } else { 13663 element.on( eventName, handlerProxy ); 13664 } 13665 } ); 13666 }, 13667 13668 _off: function( element, eventName ) { 13669 eventName = ( eventName || "" ).split( " " ).join( this.eventNamespace + " " ) + 13670 this.eventNamespace; 13671 element.off( eventName ); 13672 13673 // Clear the stack to avoid memory leaks (#10056) 13674 this.bindings = $( this.bindings.not( element ).get() ); 13675 this.focusable = $( this.focusable.not( element ).get() ); 13676 this.hoverable = $( this.hoverable.not( element ).get() ); 13677 }, 13678 13679 _delay: function( handler, delay ) { 13680 function handlerProxy() { 13681 return ( typeof handler === "string" ? instance[ handler ] : handler ) 13682 .apply( instance, arguments ); 13683 } 13684 var instance = this; 13685 return setTimeout( handlerProxy, delay || 0 ); 13686 }, 13687 13688 _hoverable: function( element ) { 13689 this.hoverable = this.hoverable.add( element ); 13690 this._on( element, { 13691 mouseenter: function( event ) { 13692 this._addClass( $( event.currentTarget ), null, "ui-state-hover" ); 13693 }, 13694 mouseleave: function( event ) { 13695 this._removeClass( $( event.currentTarget ), null, "ui-state-hover" ); 13696 } 13697 } ); 13698 }, 13699 13700 _focusable: function( element ) { 13701 this.focusable = this.focusable.add( element ); 13702 this._on( element, { 13703 focusin: function( event ) { 13704 this._addClass( $( event.currentTarget ), null, "ui-state-focus" ); 13705 }, 13706 focusout: function( event ) { 13707 this._removeClass( $( event.currentTarget ), null, "ui-state-focus" ); 13708 } 13709 } ); 13710 }, 13711 13712 _trigger: function( type, event, data ) { 13713 var prop, orig; 13714 var callback = this.options[ type ]; 13715 13716 data = data || {}; 13717 event = $.Event( event ); 13718 event.type = ( type === this.widgetEventPrefix ? 13719 type : 13720 this.widgetEventPrefix + type ).toLowerCase(); 13721 13722 // The original event may come from any element 13723 // so we need to reset the target on the new event 13724 event.target = this.element[ 0 ]; 13725 13726 // Copy original event properties over to the new event 13727 orig = event.originalEvent; 13728 if ( orig ) { 13729 for ( prop in orig ) { 13730 if ( !( prop in event ) ) { 13731 event[ prop ] = orig[ prop ]; 13732 } 13733 } 13734 } 13735 13736 this.element.trigger( event, data ); 13737 return !( typeof callback === "function" && 13738 callback.apply( this.element[ 0 ], [ event ].concat( data ) ) === false || 13739 event.isDefaultPrevented() ); 13740 } 13741}; 13742 13743$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { 13744 $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { 13745 if ( typeof options === "string" ) { 13746 options = { effect: options }; 13747 } 13748 13749 var hasOptions; 13750 var effectName = !options ? 13751 method : 13752 options === true || typeof options === "number" ? 13753 defaultEffect : 13754 options.effect || defaultEffect; 13755 13756 options = options || {}; 13757 if ( typeof options === "number" ) { 13758 options = { duration: options }; 13759 } else if ( options === true ) { 13760 options = {}; 13761 } 13762 13763 hasOptions = !$.isEmptyObject( options ); 13764 options.complete = callback; 13765 13766 if ( options.delay ) { 13767 element.delay( options.delay ); 13768 } 13769 13770 if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { 13771 element[ method ]( options ); 13772 } else if ( effectName !== method && element[ effectName ] ) { 13773 element[ effectName ]( options.duration, options.easing, callback ); 13774 } else { 13775 element.queue( function( next ) { 13776 $( this )[ method ](); 13777 if ( callback ) { 13778 callback.call( element[ 0 ] ); 13779 } 13780 next(); 13781 } ); 13782 } 13783 }; 13784} ); 13785
vendor: 20,643 bytes, lines 13786-14584
13786return $.widget; 13787 13788} ); 13789 13790 13791/*! 13792 * jQuery UI Controlgroup 1.14.2 13793 * https://jqueryui.com 13794 * 13795 * Copyright OpenJS Foundation and other contributors 13796 * Released under the MIT license. 13797 * https://jquery.org/license 13798 */ 13799 13800//>>label: Controlgroup 13801//>>group: Widgets 13802//>>description: Visually groups form control widgets 13803//>>docs: https://api.jqueryui.com/controlgroup/ 13804//>>demos: https://jqueryui.com/controlgroup/ 13805//>>css.structure: ../../themes/base/core.css 13806//>>css.structure: ../../themes/base/controlgroup.css 13807//>>css.theme: ../../themes/base/theme.css 13808 13809( function( factory ) { 13810 "use strict"; 13811 13812 if ( typeof define === "function" && define.amd ) { 13813 13814 // AMD. Register as an anonymous module. 13815 define( [ 13816 "jquery", 13817 "../widget" 13818 ], factory ); 13819 } else { 13820 13821 // Browser globals 13822 factory( jQuery ); 13823 } 13824} )( function( $ ) { 13825"use strict"; 13826 13827var controlgroupCornerRegex = /ui-corner-([a-z]){2,6}/g; 13828 13829return $.widget( "ui.controlgroup", { 13830 version: "1.14.2", 13831 defaultElement: "<div>", 13832 options: { 13833 direction: "horizontal", 13834 disabled: null, 13835 onlyVisible: true, 13836 items: { 13837 "button": "input[type=button], input[type=submit], input[type=reset], button, a", 13838 "controlgroupLabel": ".ui-controlgroup-label", 13839 "checkboxradio": "input[type='checkbox'], input[type='radio']", 13840 "selectmenu": "select", 13841 "spinner": ".ui-spinner-input" 13842 } 13843 }, 13844 13845 _create: function() { 13846 this._enhance(); 13847 }, 13848 13849 // To support the enhanced option in jQuery Mobile, we isolate DOM manipulation 13850 _enhance: function() { 13851 this.element.attr( "role", "toolbar" ); 13852 this.refresh(); 13853 }, 13854 13855 _destroy: function() { 13856 this._callChildMethod( "destroy" ); 13857 this.childWidgets.removeData( "ui-controlgroup-data" ); 13858 this.element.removeAttr( "role" ); 13859 if ( this.options.items.controlgroupLabel ) { 13860 this.element 13861 .find( this.options.items.controlgroupLabel ) 13862 .find( ".ui-controlgroup-label-contents" ) 13863 .contents().unwrap(); 13864 } 13865 }, 13866 13867 _initWidgets: function() { 13868 var that = this, 13869 childWidgets = []; 13870 13871 // First we iterate over each of the items options 13872 $.each( this.options.items, function( widget, selector ) { 13873 var labels; 13874 var options = {}; 13875 13876 // Make sure the widget has a selector set 13877 if ( !selector ) { 13878 return; 13879 } 13880 13881 if ( widget === "controlgroupLabel" ) { 13882 labels = that.element.find( selector ); 13883 labels.each( function() { 13884 var element = $( this ); 13885 13886 if ( element.children( ".ui-controlgroup-label-contents" ).length ) { 13887 return; 13888 } 13889 element.contents() 13890 .wrapAll( "<span class='ui-controlgroup-label-contents'></span>" ); 13891 } ); 13892 that._addClass( labels, null, "ui-widget ui-widget-content ui-state-default" ); 13893 childWidgets = childWidgets.concat( labels.get() ); 13894 return; 13895 } 13896 13897 // Make sure the widget actually exists 13898 if ( !$.fn[ widget ] ) { 13899 return; 13900 } 13901 13902 // We assume everything is in the middle to start because we can't determine 13903 // first / last elements until all enhancments are done. 13904 if ( that[ "_" + widget + "Options" ] ) { 13905 options = that[ "_" + widget + "Options" ]( "middle" ); 13906 } else { 13907 options = { classes: {} }; 13908 } 13909 13910 // Find instances of this widget inside controlgroup and init them 13911 that.element 13912 .find( selector ) 13913 .each( function() { 13914 var element = $( this ); 13915 var instance = element[ widget ]( "instance" ); 13916 13917 // We need to clone the default options for this type of widget to avoid 13918 // polluting the variable options which has a wider scope than a single widget. 13919 var instanceOptions = $.widget.extend( {}, options ); 13920 13921 // If the button is the child of a spinner ignore it 13922 // TODO: Find a more generic solution 13923 if ( widget === "button" && element.parent( ".ui-spinner" ).length ) { 13924 return; 13925 } 13926 13927 // Create the widget if it doesn't exist 13928 if ( !instance ) { 13929 instance = element[ widget ]()[ widget ]( "instance" ); 13930 } 13931 if ( instance ) { 13932 instanceOptions.classes = 13933 that._resolveClassesValues( instanceOptions.classes, instance ); 13934 } 13935 element[ widget ]( instanceOptions ); 13936 13937 // Store an instance of the controlgroup to be able to reference 13938 // from the outermost element for changing options and refresh 13939 var widgetElement = element[ widget ]( "widget" ); 13940 $.data( widgetElement[ 0 ], "ui-controlgroup-data", 13941 instance ? instance : element[ widget ]( "instance" ) ); 13942 13943 childWidgets.push( widgetElement[ 0 ] ); 13944 } ); 13945 } ); 13946 13947 this.childWidgets = $( $.uniqueSort( childWidgets ) ); 13948 this._addClass( this.childWidgets, "ui-controlgroup-item" ); 13949 }, 13950 13951 _callChildMethod: function( method ) { 13952 this.childWidgets.each( function() { 13953 var element = $( this ), 13954 data = element.data( "ui-controlgroup-data" ); 13955 if ( data && data[ method ] ) { 13956 data[ method ](); 13957 } 13958 } ); 13959 }, 13960 13961 _updateCornerClass: function( element, position ) { 13962 var remove = "ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"; 13963 var add = this._buildSimpleOptions( position, "label" ).classes.label; 13964 13965 this._removeClass( element, null, remove ); 13966 this._addClass( element, null, add ); 13967 }, 13968 13969 _buildSimpleOptions: function( position, key ) { 13970 var direction = this.options.direction === "vertical"; 13971 var result = { 13972 classes: {} 13973 }; 13974 result.classes[ key ] = { 13975 "middle": "", 13976 "first": "ui-corner-" + ( direction ? "top" : "left" ), 13977 "last": "ui-corner-" + ( direction ? "bottom" : "right" ), 13978 "only": "ui-corner-all" 13979 }[ position ]; 13980 13981 return result; 13982 }, 13983 13984 _spinnerOptions: function( position ) { 13985 var options = this._buildSimpleOptions( position, "ui-spinner" ); 13986 13987 options.classes[ "ui-spinner-up" ] = ""; 13988 options.classes[ "ui-spinner-down" ] = ""; 13989 13990 return options; 13991 }, 13992 13993 _buttonOptions: function( position ) { 13994 return this._buildSimpleOptions( position, "ui-button" ); 13995 }, 13996 13997 _checkboxradioOptions: function( position ) { 13998 return this._buildSimpleOptions( position, "ui-checkboxradio-label" ); 13999 }, 14000 14001 _selectmenuOptions: function( position ) { 14002 var direction = this.options.direction === "vertical"; 14003 return { 14004 width: direction ? "auto" : false, 14005 classes: { 14006 middle: { 14007 "ui-selectmenu-button-open": "", 14008 "ui-selectmenu-button-closed": "" 14009 }, 14010 first: { 14011 "ui-selectmenu-button-open": "ui-corner-" + ( direction ? "top" : "tl" ), 14012 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "top" : "left" ) 14013 }, 14014 last: { 14015 "ui-selectmenu-button-open": direction ? "" : "ui-corner-tr", 14016 "ui-selectmenu-button-closed": "ui-corner-" + ( direction ? "bottom" : "right" ) 14017 }, 14018 only: { 14019 "ui-selectmenu-button-open": "ui-corner-top", 14020 "ui-selectmenu-button-closed": "ui-corner-all" 14021 } 14022 14023 }[ position ] 14024 }; 14025 }, 14026 14027 _resolveClassesValues: function( classes, instance ) { 14028 var result = {}; 14029 $.each( classes, function( key ) { 14030 var current = instance.options.classes[ key ] || ""; 14031 current = String.prototype.trim.call( current.replace( controlgroupCornerRegex, "" ) ); 14032 result[ key ] = ( current + " " + classes[ key ] ).replace( /\s+/g, " " ); 14033 } ); 14034 return result; 14035 }, 14036 14037 _setOption: function( key, value ) { 14038 if ( key === "direction" ) { 14039 this._removeClass( "ui-controlgroup-" + this.options.direction ); 14040 } 14041 14042 this._super( key, value ); 14043 if ( key === "disabled" ) { 14044 this._callChildMethod( value ? "disable" : "enable" ); 14045 return; 14046 } 14047 14048 this.refresh(); 14049 }, 14050 14051 refresh: function() { 14052 var children, 14053 that = this; 14054 14055 this._addClass( "ui-controlgroup ui-controlgroup-" + this.options.direction ); 14056 14057 if ( this.options.direction === "horizontal" ) { 14058 this._addClass( null, "ui-helper-clearfix" ); 14059 } 14060 this._initWidgets(); 14061 14062 children = this.childWidgets; 14063 14064 // We filter here because we need to track all childWidgets not just the visible ones 14065 if ( this.options.onlyVisible ) { 14066 children = children.filter( ":visible" ); 14067 } 14068 14069 if ( children.length ) { 14070 14071 // We do this last because we need to make sure all enhancment is done 14072 // before determining first and last 14073 $.each( [ "first", "last" ], function( index, value ) { 14074 var instance = children[ value ]().data( "ui-controlgroup-data" ); 14075 14076 if ( instance && that[ "_" + instance.widgetName + "Options" ] ) { 14077 var options = that[ "_" + instance.widgetName + "Options" ]( 14078 children.length === 1 ? "only" : value 14079 ); 14080 options.classes = that._resolveClassesValues( options.classes, instance ); 14081 instance.element[ instance.widgetName ]( options ); 14082 } else { 14083 that._updateCornerClass( children[ value ](), value ); 14084 } 14085 } ); 14086 14087 // Finally call the refresh method on each of the child widgets. 14088 this._callChildMethod( "refresh" ); 14089 } 14090 } 14091} ); 14092} ); 14093 14094 14095/*! 14096 * jQuery UI Form Reset Mixin 1.14.2 14097 * https://jqueryui.com 14098 * 14099 * Copyright OpenJS Foundation and other contributors 14100 * Released under the MIT license. 14101 * https://jquery.org/license 14102 */ 14103 14104//>>label: Form Reset Mixin 14105//>>group: Core 14106//>>description: Refresh input widgets when their form is reset 14107//>>docs: https://api.jqueryui.com/form-reset-mixin/ 14108 14109( function( factory ) { 14110 "use strict"; 14111 14112 if ( typeof define === "function" && define.amd ) { 14113 14114 // AMD. Register as an anonymous module. 14115 define( [ 14116 "jquery", 14117 "./version" 14118 ], factory ); 14119 } else { 14120 14121 // Browser globals 14122 factory( jQuery ); 14123 } 14124} )( function( $ ) { 14125"use strict"; 14126 14127return $.ui.formResetMixin = { 14128 _formResetHandler: function() { 14129 var form = $( this ); 14130 14131 // Wait for the form reset to actually happen before refreshing 14132 setTimeout( function() { 14133 var instances = form.data( "ui-form-reset-instances" ); 14134 $.each( instances, function() { 14135 this.refresh(); 14136 } ); 14137 } ); 14138 }, 14139 14140 _bindFormResetHandler: function() { 14141 this.form = $( this.element.prop( "form" ) ); 14142 if ( !this.form.length ) { 14143 return; 14144 } 14145 14146 var instances = this.form.data( "ui-form-reset-instances" ) || []; 14147 if ( !instances.length ) { 14148 14149 // We don't use _on() here because we use a single event handler per form 14150 this.form.on( "reset.ui-form-reset", this._formResetHandler ); 14151 } 14152 instances.push( this ); 14153 this.form.data( "ui-form-reset-instances", instances ); 14154 }, 14155 14156 _unbindFormResetHandler: function() { 14157 if ( !this.form.length ) { 14158 return; 14159 } 14160 14161 var instances = this.form.data( "ui-form-reset-instances" ); 14162 instances.splice( $.inArray( this, instances ), 1 ); 14163 if ( instances.length ) { 14164 this.form.data( "ui-form-reset-instances", instances ); 14165 } else { 14166 this.form 14167 .removeData( "ui-form-reset-instances" ) 14168 .off( "reset.ui-form-reset" ); 14169 } 14170 } 14171}; 14172 14173} ); 14174 14175 14176/*! 14177 * jQuery UI Labels 1.14.2 14178 * https://jqueryui.com 14179 * 14180 * Copyright OpenJS Foundation and other contributors 14181 * Released under the MIT license. 14182 * https://jquery.org/license 14183 */ 14184 14185//>>label: labels 14186//>>group: Core 14187//>>description: Find all the labels associated with a given input 14188//>>docs: https://api.jqueryui.com/labels/ 14189 14190( function( factory ) { 14191 "use strict"; 14192 14193 if ( typeof define === "function" && define.amd ) { 14194 14195 // AMD. Register as an anonymous module. 14196 define( [ "jquery", "./version" ], factory ); 14197 } else { 14198 14199 // Browser globals 14200 factory( jQuery ); 14201 } 14202} )( function( $ ) { 14203"use strict"; 14204 14205return $.fn.labels = function() { 14206 var ancestor, selector, id, labels, ancestors; 14207 14208 if ( !this.length ) { 14209 return this.pushStack( [] ); 14210 } 14211 14212 // Check control.labels first 14213 if ( this[ 0 ].labels && this[ 0 ].labels.length ) { 14214 return this.pushStack( this[ 0 ].labels ); 14215 } 14216 14217 // If `control.labels` is empty - e.g. inside of document fragments - find 14218 // the labels manually 14219 labels = this.eq( 0 ).parents( "label" ); 14220 14221 // Look for the label based on the id 14222 id = this.attr( "id" ); 14223 if ( id ) { 14224 14225 // We don't search against the document in case the element 14226 // is disconnected from the DOM 14227 ancestor = this.eq( 0 ).parents().last(); 14228 14229 // Get a full set of top level ancestors 14230 ancestors = ancestor.add( ancestor.length ? ancestor.siblings() : this.siblings() ); 14231 14232 // Create a selector for the label based on the id 14233 selector = "label[for='" + CSS.escape( id ) + "']"; 14234 14235 labels = labels.add( ancestors.find( selector ).addBack( selector ) ); 14236 14237 } 14238 14239 // Return whatever we have found for labels 14240 return this.pushStack( labels ); 14241}; 14242 14243} ); 14244 14245 14246 14247 14248/*! 14249 * jQuery UI Checkboxradio 1.14.2 14250 * https://jqueryui.com 14251 * 14252 * Copyright OpenJS Foundation and other contributors 14253 * Released under the MIT license. 14254 * https://jquery.org/license 14255 */ 14256 14257//>>label: Checkboxradio 14258//>>group: Widgets 14259//>>description: Enhances a form with multiple themeable checkboxes or radio buttons. 14260//>>docs: https://api.jqueryui.com/checkboxradio/ 14261//>>demos: https://jqueryui.com/checkboxradio/ 14262//>>css.structure: ../../themes/base/core.css 14263//>>css.structure: ../../themes/base/button.css 14264//>>css.structure: ../../themes/base/checkboxradio.css 14265//>>css.theme: ../../themes/base/theme.css 14266 14267( function( factory ) { 14268 "use strict"; 14269 14270 if ( typeof define === "function" && define.amd ) { 14271 14272 // AMD. Register as an anonymous module. 14273 define( [ 14274 "jquery", 14275 "../form-reset-mixin", 14276 "../labels", 14277 "../widget" 14278 ], factory ); 14279 } else { 14280 14281 // Browser globals 14282 factory( jQuery ); 14283 } 14284} )( function( $ ) { 14285"use strict"; 14286 14287$.widget( "ui.checkboxradio", [ $.ui.formResetMixin, { 14288 version: "1.14.2", 14289 options: { 14290 disabled: null, 14291 label: null, 14292 icon: true, 14293 classes: { 14294 "ui-checkboxradio-label": "ui-corner-all", 14295 "ui-checkboxradio-icon": "ui-corner-all" 14296 } 14297 }, 14298 14299 _getCreateOptions: function() { 14300 var disabled, labels, labelContents; 14301 var options = this._super() || {}; 14302 14303 // We read the type here, because it makes more sense to throw a element type error first, 14304 // rather then the error for lack of a label. Often if its the wrong type, it 14305 // won't have a label (e.g. calling on a div, btn, etc) 14306 this._readType(); 14307 14308 labels = this.element.labels(); 14309 14310 // If there are multiple labels, use the last one 14311 this.label = $( labels[ labels.length - 1 ] ); 14312 if ( !this.label.length ) { 14313 $.error( "No label found for checkboxradio widget" ); 14314 } 14315 14316 this.originalLabel = ""; 14317 14318 // We need to get the label text but this may also need to make sure it does not contain the 14319 // input itself. 14320 // The label contents could be text, html, or a mix. We wrap all elements 14321 // and read the wrapper's `innerHTML` to get a string representation of 14322 // the label, without the input as part of it. 14323 labelContents = this.label.contents().not( this.element[ 0 ] ); 14324 14325 if ( labelContents.length ) { 14326 this.originalLabel += labelContents 14327 .clone() 14328 .wrapAll( "<div></div>" ) 14329 .parent() 14330 .html(); 14331 } 14332 14333 // Set the label option if we found label text 14334 if ( this.originalLabel ) { 14335 options.label = this.originalLabel; 14336 } 14337 14338 disabled = this.element[ 0 ].disabled; 14339 if ( disabled != null ) { 14340 options.disabled = disabled; 14341 } 14342 return options; 14343 }, 14344 14345 _create: function() { 14346 var checked = this.element[ 0 ].checked; 14347 14348 this._bindFormResetHandler(); 14349 14350 if ( this.options.disabled == null ) { 14351 this.options.disabled = this.element[ 0 ].disabled; 14352 } 14353 14354 this._setOption( "disabled", this.options.disabled ); 14355 this._addClass( "ui-checkboxradio", "ui-helper-hidden-accessible" ); 14356 this._addClass( this.label, "ui-checkboxradio-label", "ui-button ui-widget" ); 14357 14358 if ( this.type === "radio" ) { 14359 this._addClass( this.label, "ui-checkboxradio-radio-label" ); 14360 } 14361 14362 if ( this.options.label && this.options.label !== this.originalLabel ) { 14363 this._updateLabel(); 14364 } else if ( this.originalLabel ) { 14365 this.options.label = this.originalLabel; 14366 } 14367 14368 this._enhance(); 14369 14370 if ( checked ) { 14371 this._addClass( this.label, "ui-checkboxradio-checked", "ui-state-active" ); 14372 } 14373 14374 this._on( { 14375 change: "_toggleClasses", 14376 focus: function() { 14377 this._addClass( this.label, null, "ui-state-focus ui-visual-focus" ); 14378 }, 14379 blur: function() { 14380 this._removeClass( this.label, null, "ui-state-focus ui-visual-focus" ); 14381 } 14382 } ); 14383 }, 14384 14385 _readType: function() { 14386 var nodeName = this.element[ 0 ].nodeName.toLowerCase(); 14387 this.type = this.element[ 0 ].type; 14388 if ( nodeName !== "input" || !/radio|checkbox/.test( this.type ) ) { 14389 $.error( "Can't create checkboxradio on element.nodeName=" + nodeName + 14390 " and element.type=" + this.type ); 14391 } 14392 }, 14393 14394 // Support jQuery Mobile enhanced option 14395 _enhance: function() { 14396 this._updateIcon( this.element[ 0 ].checked ); 14397 }, 14398 14399 widget: function() { 14400 return this.label; 14401 }, 14402 14403 _getRadioGroup: function() { 14404 var group; 14405 var name = this.element[ 0 ].name; 14406 var nameSelector = "input[name='" + CSS.escape( name ) + "']"; 14407 14408 if ( !name ) { 14409 return $( [] ); 14410 } 14411 14412 if ( this.form.length ) { 14413 group = $( this.form[ 0 ].elements ).filter( nameSelector ); 14414 } else { 14415 14416 // Not inside a form, check all inputs that also are not inside a form 14417 group = $( nameSelector ).filter( function() { 14418 return $( $( this ).prop( "form" ) ).length === 0; 14419 } ); 14420 } 14421 14422 return group.not( this.element ); 14423 }, 14424 14425 _toggleClasses: function() { 14426 var checked = this.element[ 0 ].checked; 14427 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked ); 14428 14429 if ( this.options.icon && this.type === "checkbox" ) { 14430 this._toggleClass( this.icon, null, "ui-icon-check ui-state-checked", checked ) 14431 ._toggleClass( this.icon, null, "ui-icon-blank", !checked ); 14432 } 14433 14434 if ( this.type === "radio" ) { 14435 this._getRadioGroup() 14436 .each( function() { 14437 var instance = $( this ).checkboxradio( "instance" ); 14438 14439 if ( instance ) { 14440 instance._removeClass( instance.label, 14441 "ui-checkboxradio-checked", "ui-state-active" ); 14442 } 14443 } ); 14444 } 14445 }, 14446 14447 _destroy: function() { 14448 this._unbindFormResetHandler(); 14449 14450 if ( this.icon ) { 14451 this.icon.remove(); 14452 this.iconSpace.remove(); 14453 } 14454 }, 14455 14456 _setOption: function( key, value ) { 14457 14458 // We don't allow the value to be set to nothing 14459 if ( key === "label" && !value ) { 14460 return; 14461 } 14462 14463 this._super( key, value ); 14464 14465 if ( key === "disabled" ) { 14466 this._toggleClass( this.label, null, "ui-state-disabled", value ); 14467 this.element[ 0 ].disabled = value; 14468 14469 // Don't refresh when setting disabled 14470 return; 14471 } 14472 this.refresh(); 14473 }, 14474 14475 _updateIcon: function( checked ) { 14476 var toAdd = "ui-icon ui-icon-background "; 14477 14478 if ( this.options.icon ) { 14479 if ( !this.icon ) { 14480 this.icon = $( "<span>" ); 14481 this.iconSpace = $( "<span> </span>" ); 14482 this._addClass( this.iconSpace, "ui-checkboxradio-icon-space" ); 14483 } 14484 14485 if ( this.type === "checkbox" ) { 14486 toAdd += checked ? "ui-icon-check ui-state-checked" : "ui-icon-blank"; 14487 this._removeClass( this.icon, null, checked ? "ui-icon-blank" : "ui-icon-check" ); 14488 } else { 14489 toAdd += "ui-icon-blank"; 14490 } 14491 this._addClass( this.icon, "ui-checkboxradio-icon", toAdd ); 14492 if ( !checked ) { 14493 this._removeClass( this.icon, null, "ui-icon-check ui-state-checked" ); 14494 } 14495 this.icon.prependTo( this.label ).after( this.iconSpace ); 14496 } else if ( this.icon !== undefined ) { 14497 this.icon.remove(); 14498 this.iconSpace.remove(); 14499 delete this.icon; 14500 } 14501 }, 14502 14503 _updateLabel: function() { 14504 14505 // Remove the contents of the label ( minus the icon, icon space, and input ) 14506 var contents = this.label.contents().not( this.element[ 0 ] ); 14507 if ( this.icon ) { 14508 contents = contents.not( this.icon[ 0 ] ); 14509 } 14510 if ( this.iconSpace ) { 14511 contents = contents.not( this.iconSpace[ 0 ] ); 14512 } 14513 contents.remove(); 14514 14515 this.label.append( this.options.label ); 14516 }, 14517 14518 refresh: function() { 14519 var checked = this.element[ 0 ].checked, 14520 isDisabled = this.element[ 0 ].disabled; 14521 14522 this._updateIcon( checked ); 14523 this._toggleClass( this.label, "ui-checkboxradio-checked", "ui-state-active", checked ); 14524 if ( this.options.label !== null ) { 14525 this._updateLabel(); 14526 } 14527 14528 if ( isDisabled !== this.options.disabled ) { 14529 this._setOptions( { "disabled": isDisabled } ); 14530 } 14531 } 14532 14533} ] ); 14534 14535return $.ui.checkboxradio; 14536 14537} ); 14538 14539 14540 14541 14542 14543/*! 14544 * jQuery UI Button 1.14.2 14545 * https://jqueryui.com 14546 * 14547 * Copyright OpenJS Foundation and other contributors 14548 * Released under the MIT license. 14549 * https://jquery.org/license 14550 */ 14551 14552//>>label: Button 14553//>>group: Widgets 14554//>>description: Enhances a form with themeable buttons. 14555//>>docs: https://api.jqueryui.com/button/ 14556//>>demos: https://jqueryui.com/button/ 14557//>>css.structure: ../../themes/base/core.css 14558//>>css.structure: ../../themes/base/button.css 14559//>>css.theme: ../../themes/base/theme.css 14560 14561( function( factory ) { 14562 "use strict"; 14563 14564 if ( typeof define === "function" && define.amd ) { 14565 14566 // AMD. Register as an anonymous module. 14567 define( [ 14568 "jquery", 14569 14570 // These are only for backcompat 14571 // TODO: Remove after 1.12 14572 "./controlgroup", 14573 "./checkboxradio", 14574 14575 "../keycode", 14576 "../widget" 14577 ], factory ); 14578 } else { 14579 14580 // Browser globals 14581 factory( jQuery ); 14582 } 14583} )( function( $ ) { 14584"use strict";
vendor: 10,738 bytes, lines 14584-14988
14584 14585 14586$.widget( "ui.button", { 14587 version: "1.14.2", 14588 defaultElement: "<button>", 14589 options: { 14590 classes: { 14591 "ui-button": "ui-corner-all" 14592 }, 14593 disabled: null, 14594 icon: null, 14595 iconPosition: "beginning", 14596 label: null, 14597 showLabel: true 14598 }, 14599 14600 _getCreateOptions: function() { 14601 var disabled, 14602 14603 // This is to support cases like in jQuery Mobile where the base widget does have 14604 // an implementation of _getCreateOptions 14605 options = this._super() || {}; 14606 14607 this.isInput = this.element.is( "input" ); 14608 14609 disabled = this.element[ 0 ].disabled; 14610 if ( disabled != null ) { 14611 options.disabled = disabled; 14612 } 14613 14614 this.originalLabel = this.isInput ? this.element.val() : this.element.html(); 14615 if ( this.originalLabel ) { 14616 options.label = this.originalLabel; 14617 } 14618 14619 return options; 14620 }, 14621 14622 _create: function() { 14623 if ( !this.option.showLabel & !this.options.icon ) { 14624 this.options.showLabel = true; 14625 } 14626 14627 // We have to check the option again here even though we did in _getCreateOptions, 14628 // because null may have been passed on init which would override what was set in 14629 // _getCreateOptions 14630 if ( this.options.disabled == null ) { 14631 this.options.disabled = this.element[ 0 ].disabled || false; 14632 } 14633 14634 this.hasTitle = !!this.element.attr( "title" ); 14635 14636 // Check to see if the label needs to be set or if its already correct 14637 if ( this.options.label && this.options.label !== this.originalLabel ) { 14638 if ( this.isInput ) { 14639 this.element.val( this.options.label ); 14640 } else { 14641 this.element.html( this.options.label ); 14642 } 14643 } 14644 this._addClass( "ui-button", "ui-widget" ); 14645 this._setOption( "disabled", this.options.disabled ); 14646 this._enhance(); 14647 14648 if ( this.element.is( "a" ) ) { 14649 this._on( { 14650 "keyup": function( event ) { 14651 if ( event.keyCode === $.ui.keyCode.SPACE ) { 14652 event.preventDefault(); 14653 14654 // If a native click is available use it, so we 14655 // actually cause navigation. Otherwise, just trigger 14656 // a click event. 14657 if ( this.element[ 0 ].click ) { 14658 this.element[ 0 ].click(); 14659 } else { 14660 this.element.trigger( "click" ); 14661 } 14662 } 14663 } 14664 } ); 14665 } 14666 }, 14667 14668 _enhance: function() { 14669 if ( !this.element.is( "button" ) ) { 14670 this.element.attr( "role", "button" ); 14671 } 14672 14673 if ( this.options.icon ) { 14674 this._updateIcon( "icon", this.options.icon ); 14675 this._updateTooltip(); 14676 } 14677 }, 14678 14679 _updateTooltip: function() { 14680 this.title = this.element.attr( "title" ); 14681 14682 if ( !this.options.showLabel && !this.title ) { 14683 this.element.attr( "title", this.options.label ); 14684 } 14685 }, 14686 14687 _updateIcon: function( option, value ) { 14688 var icon = option !== "iconPosition", 14689 position = icon ? this.options.iconPosition : value, 14690 displayBlock = position === "top" || position === "bottom"; 14691 14692 // Create icon 14693 if ( !this.icon ) { 14694 this.icon = $( "<span>" ); 14695 14696 this._addClass( this.icon, "ui-button-icon", "ui-icon" ); 14697 14698 if ( !this.options.showLabel ) { 14699 this._addClass( "ui-button-icon-only" ); 14700 } 14701 } else if ( icon ) { 14702 14703 // If we are updating the icon remove the old icon class 14704 this._removeClass( this.icon, null, this.options.icon ); 14705 } 14706 14707 // If we are updating the icon add the new icon class 14708 if ( icon ) { 14709 this._addClass( this.icon, null, value ); 14710 } 14711 14712 this._attachIcon( position ); 14713 14714 // If the icon is on top or bottom we need to add the ui-widget-icon-block class and remove 14715 // the iconSpace if there is one. 14716 if ( displayBlock ) { 14717 this._addClass( this.icon, null, "ui-widget-icon-block" ); 14718 if ( this.iconSpace ) { 14719 this.iconSpace.remove(); 14720 } 14721 } else { 14722 14723 // Position is beginning or end so remove the ui-widget-icon-block class and add the 14724 // space if it does not exist 14725 if ( !this.iconSpace ) { 14726 this.iconSpace = $( "<span> </span>" ); 14727 this._addClass( this.iconSpace, "ui-button-icon-space" ); 14728 } 14729 this._removeClass( this.icon, null, "ui-wiget-icon-block" ); 14730 this._attachIconSpace( position ); 14731 } 14732 }, 14733 14734 _destroy: function() { 14735 this.element.removeAttr( "role" ); 14736 14737 if ( this.icon ) { 14738 this.icon.remove(); 14739 } 14740 if ( this.iconSpace ) { 14741 this.iconSpace.remove(); 14742 } 14743 if ( !this.hasTitle ) { 14744 this.element.removeAttr( "title" ); 14745 } 14746 }, 14747 14748 _attachIconSpace: function( iconPosition ) { 14749 this.icon[ /^(?:end|bottom)/.test( iconPosition ) ? "before" : "after" ]( this.iconSpace ); 14750 }, 14751 14752 _attachIcon: function( iconPosition ) { 14753 this.element[ /^(?:end|bottom)/.test( iconPosition ) ? "append" : "prepend" ]( this.icon ); 14754 }, 14755 14756 _setOptions: function( options ) { 14757 var newShowLabel = options.showLabel === undefined ? 14758 this.options.showLabel : 14759 options.showLabel, 14760 newIcon = options.icon === undefined ? this.options.icon : options.icon; 14761 14762 if ( !newShowLabel && !newIcon ) { 14763 options.showLabel = true; 14764 } 14765 this._super( options ); 14766 }, 14767 14768 _setOption: function( key, value ) { 14769 if ( key === "icon" ) { 14770 if ( value ) { 14771 this._updateIcon( key, value ); 14772 } else if ( this.icon ) { 14773 this.icon.remove(); 14774 if ( this.iconSpace ) { 14775 this.iconSpace.remove(); 14776 } 14777 } 14778 } 14779 14780 if ( key === "iconPosition" ) { 14781 this._updateIcon( key, value ); 14782 } 14783 14784 // Make sure we can't end up with a button that has neither text nor icon 14785 if ( key === "showLabel" ) { 14786 this._toggleClass( "ui-button-icon-only", null, !value ); 14787 this._updateTooltip(); 14788 } 14789 14790 if ( key === "label" ) { 14791 if ( this.isInput ) { 14792 this.element.val( value ); 14793 } else { 14794 14795 // If there is an icon, append it, else nothing then append the value 14796 // this avoids removal of the icon when setting label text 14797 this.element.html( value ); 14798 if ( this.icon ) { 14799 this._attachIcon( this.options.iconPosition ); 14800 this._attachIconSpace( this.options.iconPosition ); 14801 } 14802 } 14803 } 14804 14805 this._super( key, value ); 14806 14807 if ( key === "disabled" ) { 14808 this._toggleClass( null, "ui-state-disabled", value ); 14809 this.element[ 0 ].disabled = value; 14810 if ( value ) { 14811 this.element.trigger( "blur" ); 14812 } 14813 } 14814 }, 14815 14816 refresh: function() { 14817 14818 // Make sure to only check disabled if its an element that supports this otherwise 14819 // check for the disabled class to determine state 14820 var isDisabled = this.element.is( "input, button" ) ? 14821 this.element[ 0 ].disabled : this.element.hasClass( "ui-button-disabled" ); 14822 14823 if ( isDisabled !== this.options.disabled ) { 14824 this._setOptions( { disabled: isDisabled } ); 14825 } 14826 14827 this._updateTooltip(); 14828 } 14829} ); 14830 14831// DEPRECATED 14832if ( $.uiBackCompat === true ) { 14833 14834 // Text and Icons options 14835 $.widget( "ui.button", $.ui.button, { 14836 options: { 14837 text: true, 14838 icons: { 14839 primary: null, 14840 secondary: null 14841 } 14842 }, 14843 14844 _create: function() { 14845 if ( this.options.showLabel && !this.options.text ) { 14846 this.options.showLabel = this.options.text; 14847 } 14848 if ( !this.options.showLabel && this.options.text ) { 14849 this.options.text = this.options.showLabel; 14850 } 14851 if ( !this.options.icon && ( this.options.icons.primary || 14852 this.options.icons.secondary ) ) { 14853 if ( this.options.icons.primary ) { 14854 this.options.icon = this.options.icons.primary; 14855 } else { 14856 this.options.icon = this.options.icons.secondary; 14857 this.options.iconPosition = "end"; 14858 } 14859 } else if ( this.options.icon ) { 14860 this.options.icons.primary = this.options.icon; 14861 } 14862 this._super(); 14863 }, 14864 14865 _setOption: function( key, value ) { 14866 if ( key === "text" ) { 14867 this._super( "showLabel", value ); 14868 return; 14869 } 14870 if ( key === "showLabel" ) { 14871 this.options.text = value; 14872 } 14873 if ( key === "icon" ) { 14874 this.options.icons.primary = value; 14875 } 14876 if ( key === "icons" ) { 14877 if ( value.primary ) { 14878 this._super( "icon", value.primary ); 14879 this._super( "iconPosition", "beginning" ); 14880 } else if ( value.secondary ) { 14881 this._super( "icon", value.secondary ); 14882 this._super( "iconPosition", "end" ); 14883 } 14884 } 14885 this._superApply( arguments ); 14886 } 14887 } ); 14888 14889 $.fn.button = ( function( orig ) { 14890 return function( options ) { 14891 var isMethodCall = typeof options === "string"; 14892 var args = Array.prototype.slice.call( arguments, 1 ); 14893 var returnValue = this; 14894 14895 if ( isMethodCall ) { 14896 14897 // If this is an empty collection, we need to have the instance method 14898 // return undefined instead of the jQuery instance 14899 if ( !this.length && options === "instance" ) { 14900 returnValue = undefined; 14901 } else { 14902 this.each( function() { 14903 var methodValue; 14904 var type = $( this ).attr( "type" ); 14905 var name = type !== "checkbox" && type !== "radio" ? 14906 "button" : 14907 "checkboxradio"; 14908 var instance = $.data( this, "ui-" + name ); 14909 14910 if ( options === "instance" ) { 14911 returnValue = instance; 14912 return false; 14913 } 14914 14915 if ( !instance ) { 14916 return $.error( "cannot call methods on button" + 14917 " prior to initialization; " + 14918 "attempted to call method '" + options + "'" ); 14919 } 14920 14921 if ( typeof instance[ options ] !== "function" || 14922 options.charAt( 0 ) === "_" ) { 14923 return $.error( "no such method '" + options + "' for button" + 14924 " widget instance" ); 14925 } 14926 14927 methodValue = instance[ options ].apply( instance, args ); 14928 14929 if ( methodValue !== instance && methodValue !== undefined ) { 14930 returnValue = methodValue && methodValue.jquery ? 14931 returnValue.pushStack( methodValue.get() ) : 14932 methodValue; 14933 return false; 14934 } 14935 } ); 14936 } 14937 } else { 14938 14939 // Allow multiple hashes to be passed on init 14940 if ( args.length ) { 14941 options = $.widget.extend.apply( null, [ options ].concat( args ) ); 14942 } 14943 14944 this.each( function() { 14945 var type = $( this ).attr( "type" ); 14946 var name = type !== "checkbox" && type !== "radio" ? "button" : "checkboxradio"; 14947 var instance = $.data( this, "ui-" + name ); 14948 14949 if ( instance ) { 14950 instance.option( options || {} ); 14951 if ( instance._init ) { 14952 instance._init(); 14953 } 14954 } else { 14955 if ( name === "button" ) { 14956 orig.call( $( this ), options ); 14957 return; 14958 } 14959 14960 $( this ).checkboxradio( $.extend( { icon: false }, options ) ); 14961 } 14962 } ); 14963 } 14964 14965 return returnValue; 14966 }; 14967 } )( $.fn.button ); 14968 14969 $.fn.buttonset = function() { 14970 if ( !$.ui.controlgroup ) { 14971 $.error( "Controlgroup widget missing" ); 14972 } 14973 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" && arguments[ 2 ] ) { 14974 return this.controlgroup.apply( this, 14975 [ arguments[ 0 ], "items.button", arguments[ 2 ] ] ); 14976 } 14977 if ( arguments[ 0 ] === "option" && arguments[ 1 ] === "items" ) { 14978 return this.controlgroup.apply( this, [ arguments[ 0 ], "items.button" ] ); 14979 } 14980 if ( typeof arguments[ 0 ] === "object" && arguments[ 0 ].items ) { 14981 arguments[ 0 ].items = { 14982 button: arguments[ 0 ].items 14983 }; 14984 } 14985 return this.controlgroup.apply( this, arguments ); 14986 }; 14987} 14988
vendor: 8,501 bytes, lines 14989-15343
14989return $.ui.button; 14990 14991} ); 14992 14993 14994 14995/*! 14996 * jQuery UI Mouse 1.14.2 14997 * https://jqueryui.com 14998 * 14999 * Copyright OpenJS Foundation and other contributors 15000 * Released under the MIT license. 15001 * https://jquery.org/license 15002 */ 15003 15004//>>label: Mouse 15005//>>group: Widgets 15006//>>description: Abstracts mouse-based interactions to assist in creating certain widgets. 15007//>>docs: https://api.jqueryui.com/mouse/ 15008 15009( function( factory ) { 15010 "use strict"; 15011 15012 if ( typeof define === "function" && define.amd ) { 15013 15014 // AMD. Register as an anonymous module. 15015 define( [ 15016 "jquery", 15017 "../version", 15018 "../widget" 15019 ], factory ); 15020 } else { 15021 15022 // Browser globals 15023 factory( jQuery ); 15024 } 15025} )( function( $ ) { 15026"use strict"; 15027 15028var mouseHandled = false; 15029$( document ).on( "mouseup", function() { 15030 mouseHandled = false; 15031} ); 15032 15033return $.widget( "ui.mouse", { 15034 version: "1.14.2", 15035 options: { 15036 cancel: "input, textarea, button, select, option", 15037 distance: 1, 15038 delay: 0 15039 }, 15040 _mouseInit: function() { 15041 var that = this; 15042 15043 this.element 15044 .on( "mousedown." + this.widgetName, function( event ) { 15045 return that._mouseDown( event ); 15046 } ) 15047 .on( "click." + this.widgetName, function( event ) { 15048 if ( true === $.data( event.target, that.widgetName + ".preventClickEvent" ) ) { 15049 $.removeData( event.target, that.widgetName + ".preventClickEvent" ); 15050 event.stopImmediatePropagation(); 15051 return false; 15052 } 15053 } ); 15054 15055 this.started = false; 15056 }, 15057 15058 // TODO: make sure destroying one instance of mouse doesn't mess with 15059 // other instances of mouse 15060 _mouseDestroy: function() { 15061 this.element.off( "." + this.widgetName ); 15062 if ( this._mouseMoveDelegate ) { 15063 this.document 15064 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 15065 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 15066 } 15067 }, 15068 15069 _mouseDown: function( event ) { 15070 15071 // don't let more than one widget handle mouseStart 15072 if ( mouseHandled ) { 15073 return; 15074 } 15075 15076 this._mouseMoved = false; 15077 15078 // We may have missed mouseup (out of window) 15079 if ( this._mouseStarted ) { 15080 this._mouseUp( event ); 15081 } 15082 15083 this._mouseDownEvent = event; 15084 15085 var that = this, 15086 btnIsLeft = event.which === 1, 15087 elIsCancel = typeof this.options.cancel === "string" ? 15088 $( event.target ).closest( this.options.cancel ).length : 15089 false; 15090 if ( !btnIsLeft || elIsCancel || !this._mouseCapture( event ) ) { 15091 return true; 15092 } 15093 15094 this.mouseDelayMet = !this.options.delay; 15095 if ( !this.mouseDelayMet ) { 15096 this._mouseDelayTimer = setTimeout( function() { 15097 that.mouseDelayMet = true; 15098 }, this.options.delay ); 15099 } 15100 15101 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 15102 this._mouseStarted = ( this._mouseStart( event ) !== false ); 15103 if ( !this._mouseStarted ) { 15104 event.preventDefault(); 15105 return true; 15106 } 15107 } 15108 15109 // Click event may never have fired (Gecko & Opera) 15110 if ( true === $.data( event.target, this.widgetName + ".preventClickEvent" ) ) { 15111 $.removeData( event.target, this.widgetName + ".preventClickEvent" ); 15112 } 15113 15114 // These delegates are required to keep context 15115 this._mouseMoveDelegate = function( event ) { 15116 return that._mouseMove( event ); 15117 }; 15118 this._mouseUpDelegate = function( event ) { 15119 return that._mouseUp( event ); 15120 }; 15121 15122 this.document 15123 .on( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 15124 .on( "mouseup." + this.widgetName, this._mouseUpDelegate ); 15125 15126 event.preventDefault(); 15127 15128 mouseHandled = true; 15129 return true; 15130 }, 15131 15132 _mouseMove: function( event ) { 15133 15134 // Only check for mouseups outside the document if you've moved inside the document 15135 // at least once. 15136 if ( this._mouseMoved && !event.which ) { 15137 15138 // Support: Safari <=8 - 9 15139 // Safari sets which to 0 if you press any of the following keys 15140 // during a drag (#14461) 15141 if ( event.originalEvent.altKey || event.originalEvent.ctrlKey || 15142 event.originalEvent.metaKey || event.originalEvent.shiftKey ) { 15143 this.ignoreMissingWhich = true; 15144 } else if ( !this.ignoreMissingWhich ) { 15145 return this._mouseUp( event ); 15146 } 15147 } 15148 15149 if ( event.which || event.button ) { 15150 this._mouseMoved = true; 15151 } 15152 15153 if ( this._mouseStarted ) { 15154 this._mouseDrag( event ); 15155 return event.preventDefault(); 15156 } 15157 15158 if ( this._mouseDistanceMet( event ) && this._mouseDelayMet( event ) ) { 15159 this._mouseStarted = 15160 ( this._mouseStart( this._mouseDownEvent, event ) !== false ); 15161 if ( this._mouseStarted ) { 15162 this._mouseDrag( event ); 15163 } else { 15164 this._mouseUp( event ); 15165 } 15166 } 15167 15168 return !this._mouseStarted; 15169 }, 15170 15171 _mouseUp: function( event ) { 15172 this.document 15173 .off( "mousemove." + this.widgetName, this._mouseMoveDelegate ) 15174 .off( "mouseup." + this.widgetName, this._mouseUpDelegate ); 15175 15176 if ( this._mouseStarted ) { 15177 this._mouseStarted = false; 15178 15179 if ( event.target === this._mouseDownEvent.target ) { 15180 $.data( event.target, this.widgetName + ".preventClickEvent", true ); 15181 } 15182 15183 this._mouseStop( event ); 15184 } 15185 15186 if ( this._mouseDelayTimer ) { 15187 clearTimeout( this._mouseDelayTimer ); 15188 delete this._mouseDelayTimer; 15189 } 15190 15191 this.ignoreMissingWhich = false; 15192 mouseHandled = false; 15193 event.preventDefault(); 15194 }, 15195 15196 _mouseDistanceMet: function( event ) { 15197 return ( Math.max( 15198 Math.abs( this._mouseDownEvent.pageX - event.pageX ), 15199 Math.abs( this._mouseDownEvent.pageY - event.pageY ) 15200 ) >= this.options.distance 15201 ); 15202 }, 15203 15204 _mouseDelayMet: function( /* event */ ) { 15205 return this.mouseDelayMet; 15206 }, 15207 15208 // These are placeholder methods, to be overriden by extending plugin 15209 _mouseStart: function( /* event */ ) {}, 15210 _mouseDrag: function( /* event */ ) {}, 15211 _mouseStop: function( /* event */ ) {}, 15212 _mouseCapture: function( /* event */ ) { 15213 return true; 15214 } 15215} ); 15216 15217} ); 15218 15219 15220/*! 15221 * jQuery UI :data 1.14.2 15222 * https://jqueryui.com 15223 * 15224 * Copyright OpenJS Foundation and other contributors 15225 * Released under the MIT license. 15226 * https://jquery.org/license 15227 */ 15228 15229//>>label: :data Selector 15230//>>group: Core 15231//>>description: Selects elements which have data stored under the specified key. 15232//>>docs: https://api.jqueryui.com/data-selector/ 15233 15234( function( factory ) { 15235 "use strict"; 15236 15237 if ( typeof define === "function" && define.amd ) { 15238 15239 // AMD. Register as an anonymous module. 15240 define( [ "jquery", "./version" ], factory ); 15241 } else { 15242 15243 // Browser globals 15244 factory( jQuery ); 15245 } 15246} )( function( $ ) { 15247"use strict"; 15248 15249return $.extend( $.expr.pseudos, { 15250 data: $.expr.createPseudo( function( dataName ) { 15251 return function( elem ) { 15252 return !!$.data( elem, dataName ); 15253 }; 15254 } ) 15255} ); 15256} ); 15257 15258( function( factory ) { 15259 "use strict"; 15260 15261 if ( typeof define === "function" && define.amd ) { 15262 15263 // AMD. Register as an anonymous module. 15264 define( [ "jquery", "./version" ], factory ); 15265 } else { 15266 15267 // Browser globals 15268 factory( jQuery ); 15269 } 15270} )( function( $ ) { 15271"use strict"; 15272 15273// $.ui.plugin is deprecated. Use $.widget() extensions instead. 15274return $.ui.plugin = { 15275 add: function( module, option, set ) { 15276 var i, 15277 proto = $.ui[ module ].prototype; 15278 for ( i in set ) { 15279 proto.plugins[ i ] = proto.plugins[ i ] || []; 15280 proto.plugins[ i ].push( [ option, set[ i ] ] ); 15281 } 15282 }, 15283 call: function( instance, name, args, allowDisconnected ) { 15284 var i, 15285 set = instance.plugins[ name ]; 15286 15287 if ( !set ) { 15288 return; 15289 } 15290 15291 if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || 15292 instance.element[ 0 ].parentNode.nodeType === 11 ) ) { 15293 return; 15294 } 15295 15296 for ( i = 0; i < set.length; i++ ) { 15297 if ( instance.options[ set[ i ][ 0 ] ] ) { 15298 set[ i ][ 1 ].apply( instance.element, args ); 15299 } 15300 } 15301 } 15302}; 15303 15304} ); 15305 15306 15307/*! 15308 * jQuery UI Scroll Parent 1.14.2 15309 * https://jqueryui.com 15310 * 15311 * Copyright OpenJS Foundation and other contributors 15312 * Released under the MIT license. 15313 * https://jquery.org/license 15314 */ 15315 15316//>>label: scrollParent 15317//>>group: Core 15318//>>description: Get the closest ancestor element that is scrollable. 15319//>>docs: https://api.jqueryui.com/scrollParent/ 15320 15321( function( factory ) { 15322 "use strict"; 15323 15324 if ( typeof define === "function" && define.amd ) { 15325 15326 // AMD. Register as an anonymous module. 15327 define( [ "jquery", "./version" ], factory ); 15328 } else { 15329 15330 // Browser globals 15331 factory( jQuery ); 15332 } 15333} )( function( $ ) { 15334"use strict"; 15335 15336return $.fn.scrollParent = function( includeHidden ) { 15337 var position = this.css( "position" ), 15338 excludeStaticParent = position === "absolute", 15339 overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, 15340 scrollParent = this.parents().filter( function() { 15341 var parent = $( this ); 15342 if ( excludeStaticParent && parent.css( "position" ) === "static" ) { 15343 return false;
15344 } 15345 return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + 15346 parent.css( "overflow-x" ) ); 15347 } ).eq( 0 ); 15348 15349 return position === "fixed" || !scrollParent.length ? 15350 $( this[ 0 ].ownerDocument || document ) : 15351 scrollParent; 15352}; 15353 15354} ); 15355 15356 15357 15358 15359 15360 15361 15362/*! 15363 * jQuery UI Draggable 1.14.2 15364 * https://jqueryui.com 15365 * 15366 * Copyright OpenJS Foundation and other contributors 15367 * Released under the MIT license. 15368 * https://jquery.org/license 15369 */ 15370 15371//>>label: Draggable 15372//>>group: Interactions 15373//>>description: Enables dragging functionality for any element. 15374//>>docs: https://api.jqueryui.com/draggable/ 15375//>>demos: https://jqueryui.com/draggable/ 15376//>>css.structure: ../../themes/base/draggable.css 15377 15378( function( factory ) { 15379 "use strict"; 15380 15381 if ( typeof define === "function" && define.amd ) { 15382 15383 // AMD. Register as an anonymous module. 15384 define( [ 15385 "jquery", 15386 "./mouse", 15387 "../data", 15388 "../plugin", 15389 "../scroll-parent", 15390 "../version", 15391 "../widget" 15392 ], factory ); 15393 } else { 15394 15395 // Browser globals 15396 factory( jQuery ); 15397 } 15398} )( function( $ ) { 15399"use strict";
vendor: 13,313 bytes, lines 15399-15895
15399 15400 15401$.widget( "ui.draggable", $.ui.mouse, { 15402 version: "1.14.2", 15403 widgetEventPrefix: "drag", 15404 options: { 15405 addClasses: true, 15406 appendTo: "parent", 15407 axis: false, 15408 connectToSortable: false, 15409 containment: false, 15410 cursor: "auto", 15411 cursorAt: false, 15412 grid: false, 15413 handle: false, 15414 helper: "original", 15415 iframeFix: false, 15416 opacity: false, 15417 refreshPositions: false, 15418 revert: false, 15419 revertDuration: 500, 15420 scope: "default", 15421 scroll: true, 15422 scrollSensitivity: 20, 15423 scrollSpeed: 20, 15424 snap: false, 15425 snapMode: "both", 15426 snapTolerance: 20, 15427 stack: false, 15428 zIndex: false, 15429 15430 // Callbacks 15431 drag: null, 15432 start: null, 15433 stop: null 15434 }, 15435 _create: function() { 15436 15437 if ( this.options.helper === "original" ) { 15438 this._setPositionRelative(); 15439 } 15440 if ( this.options.addClasses ) { 15441 this._addClass( "ui-draggable" ); 15442 } 15443 this._setHandleClassName(); 15444 15445 this._mouseInit(); 15446 }, 15447 15448 _setOption: function( key, value ) { 15449 this._super( key, value ); 15450 if ( key === "handle" ) { 15451 this._removeHandleClassName(); 15452 this._setHandleClassName(); 15453 } 15454 }, 15455 15456 _destroy: function() { 15457 if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) { 15458 this.destroyOnClear = true; 15459 return; 15460 } 15461 this._removeHandleClassName(); 15462 this._mouseDestroy(); 15463 }, 15464 15465 _mouseCapture: function( event ) { 15466 var o = this.options; 15467 15468 // Among others, prevent a drag on a resizable-handle 15469 if ( this.helper || o.disabled || 15470 $( event.target ).closest( ".ui-resizable-handle" ).length > 0 ) { 15471 return false; 15472 } 15473 15474 //Quit if we're not on a valid handle 15475 this.handle = this._getHandle( event ); 15476 if ( !this.handle ) { 15477 return false; 15478 } 15479 15480 this._blurActiveElement( event ); 15481 15482 this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix ); 15483 15484 return true; 15485 15486 }, 15487 15488 _blockFrames: function( selector ) { 15489 this.iframeBlocks = this.document.find( selector ).map( function() { 15490 var iframe = $( this ); 15491 15492 return $( "<div>" ) 15493 .css( "position", "absolute" ) 15494 .appendTo( iframe.parent() ) 15495 .outerWidth( iframe.outerWidth() ) 15496 .outerHeight( iframe.outerHeight() ) 15497 .offset( iframe.offset() )[ 0 ]; 15498 } ); 15499 }, 15500 15501 _unblockFrames: function() { 15502 if ( this.iframeBlocks ) { 15503 this.iframeBlocks.remove(); 15504 delete this.iframeBlocks; 15505 } 15506 }, 15507 15508 _blurActiveElement: function( event ) { 15509 var activeElement = this.document[ 0 ].activeElement, 15510 target = $( event.target ); 15511 15512 // Don't blur if the event occurred on an element that is within 15513 // the currently focused element 15514 // See #10527, #12472 15515 if ( target.closest( activeElement ).length ) { 15516 return; 15517 } 15518 15519 // Blur any element that currently has focus, see #4261 15520 $( activeElement ).trigger( "blur" ); 15521 }, 15522 15523 _mouseStart: function( event ) { 15524 15525 var o = this.options; 15526 15527 //Create and append the visible helper 15528 this.helper = this._createHelper( event ); 15529 15530 this._addClass( this.helper, "ui-draggable-dragging" ); 15531 15532 //Cache the helper size 15533 this._cacheHelperProportions(); 15534 15535 //If ddmanager is used for droppables, set the global draggable 15536 if ( $.ui.ddmanager ) { 15537 $.ui.ddmanager.current = this; 15538 } 15539 15540 /* 15541 * - Position generation - 15542 * This block generates everything position related - it's the core of draggables. 15543 */ 15544 15545 //Cache the margins of the original element 15546 this._cacheMargins(); 15547 15548 //Store the helper's css position 15549 this.cssPosition = this.helper.css( "position" ); 15550 this.scrollParent = this.helper.scrollParent( true ); 15551 this.offsetParent = this.helper.offsetParent(); 15552 this.hasFixedAncestor = this.helper.parents().filter( function() { 15553 return $( this ).css( "position" ) === "fixed"; 15554 } ).length > 0; 15555 15556 //The element's absolute position on the page minus margins 15557 this.positionAbs = this.element.offset(); 15558 this._refreshOffsets( event ); 15559 15560 //Generate the original position 15561 this.originalPosition = this.position = this._generatePosition( event, false ); 15562 this.originalPageX = event.pageX; 15563 this.originalPageY = event.pageY; 15564 15565 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 15566 if ( o.cursorAt ) { 15567 this._adjustOffsetFromHelper( o.cursorAt ); 15568 } 15569 15570 //Set a containment if given in the options 15571 this._setContainment(); 15572 15573 //Trigger event + callbacks 15574 if ( this._trigger( "start", event ) === false ) { 15575 this._clear(); 15576 return false; 15577 } 15578 15579 //Recache the helper size 15580 this._cacheHelperProportions(); 15581 15582 //Prepare the droppable offsets 15583 if ( $.ui.ddmanager && !o.dropBehaviour ) { 15584 $.ui.ddmanager.prepareOffsets( this, event ); 15585 } 15586 15587 // Execute the drag once - this causes the helper not to be visible before getting its 15588 // correct position 15589 this._mouseDrag( event, true ); 15590 15591 // If the ddmanager is used for droppables, inform the manager that dragging has started 15592 // (see #5003) 15593 if ( $.ui.ddmanager ) { 15594 $.ui.ddmanager.dragStart( this, event ); 15595 } 15596 15597 return true; 15598 }, 15599 15600 _refreshOffsets: function( event ) { 15601 this.offset = { 15602 top: this.positionAbs.top - this.margins.top, 15603 left: this.positionAbs.left - this.margins.left, 15604 scroll: false, 15605 parent: this._getParentOffset(), 15606 relative: this._getRelativeOffset() 15607 }; 15608 15609 this.offset.click = { 15610 left: event.pageX - this.offset.left, 15611 top: event.pageY - this.offset.top 15612 }; 15613 }, 15614 15615 _mouseDrag: function( event, noPropagation ) { 15616 15617 // reset any necessary cached properties (see #5009) 15618 if ( this.hasFixedAncestor ) { 15619 this.offset.parent = this._getParentOffset(); 15620 } 15621 15622 //Compute the helpers position 15623 this.position = this._generatePosition( event, true ); 15624 this.positionAbs = this._convertPositionTo( "absolute" ); 15625 15626 //Call plugins and callbacks and use the resulting position if something is returned 15627 if ( !noPropagation ) { 15628 var ui = this._uiHash(); 15629 if ( this._trigger( "drag", event, ui ) === false ) { 15630 this._mouseUp( new $.Event( "mouseup", event ) ); 15631 return false; 15632 } 15633 this.position = ui.position; 15634 } 15635 15636 this.helper[ 0 ].style.left = this.position.left + "px"; 15637 this.helper[ 0 ].style.top = this.position.top + "px"; 15638 15639 if ( $.ui.ddmanager ) { 15640 $.ui.ddmanager.drag( this, event ); 15641 } 15642 15643 return false; 15644 }, 15645 15646 _mouseStop: function( event ) { 15647 15648 //If we are using droppables, inform the manager about the drop 15649 var that = this, 15650 dropped = false; 15651 if ( $.ui.ddmanager && !this.options.dropBehaviour ) { 15652 dropped = $.ui.ddmanager.drop( this, event ); 15653 } 15654 15655 //if a drop comes from outside (a sortable) 15656 if ( this.dropped ) { 15657 dropped = this.dropped; 15658 this.dropped = false; 15659 } 15660 15661 if ( ( this.options.revert === "invalid" && !dropped ) || 15662 ( this.options.revert === "valid" && dropped ) || 15663 this.options.revert === true || ( typeof this.options.revert === "function" && 15664 this.options.revert.call( this.element, dropped ) ) 15665 ) { 15666 $( this.helper ).animate( 15667 this.originalPosition, 15668 parseInt( this.options.revertDuration, 10 ), 15669 function() { 15670 if ( that._trigger( "stop", event ) !== false ) { 15671 that._clear(); 15672 } 15673 } 15674 ); 15675 } else { 15676 if ( this._trigger( "stop", event ) !== false ) { 15677 this._clear(); 15678 } 15679 } 15680 15681 return false; 15682 }, 15683 15684 _mouseUp: function( event ) { 15685 this._unblockFrames(); 15686 15687 // If the ddmanager is used for droppables, inform the manager that dragging has stopped 15688 // (see #5003) 15689 if ( $.ui.ddmanager ) { 15690 $.ui.ddmanager.dragStop( this, event ); 15691 } 15692 15693 // Only need to focus if the event occurred on the draggable itself, see #10527 15694 if ( this.handleElement.is( event.target ) ) { 15695 15696 // The interaction is over; whether or not the click resulted in a drag, 15697 // focus the element 15698 this.element.trigger( "focus" ); 15699 } 15700 15701 return $.ui.mouse.prototype._mouseUp.call( this, event ); 15702 }, 15703 15704 cancel: function() { 15705 15706 if ( this.helper.is( ".ui-draggable-dragging" ) ) { 15707 this._mouseUp( new $.Event( "mouseup", { target: this.element[ 0 ] } ) ); 15708 } else { 15709 this._clear(); 15710 } 15711 15712 return this; 15713 15714 }, 15715 15716 _getHandle: function( event ) { 15717 return this.options.handle ? 15718 !!$( event.target ).closest( this.element.find( this.options.handle ) ).length : 15719 true; 15720 }, 15721 15722 _setHandleClassName: function() { 15723 this.handleElement = this.options.handle ? 15724 this.element.find( this.options.handle ) : this.element; 15725 this._addClass( this.handleElement, "ui-draggable-handle" ); 15726 }, 15727 15728 _removeHandleClassName: function() { 15729 this._removeClass( this.handleElement, "ui-draggable-handle" ); 15730 }, 15731 15732 _createHelper: function( event ) { 15733 15734 var o = this.options, 15735 helperIsFunction = typeof o.helper === "function", 15736 helper = helperIsFunction ? 15737 $( o.helper.apply( this.element[ 0 ], [ event ] ) ) : 15738 ( o.helper === "clone" ? 15739 this.element.clone().removeAttr( "id" ) : 15740 this.element ); 15741 15742 if ( !helper.parents( "body" ).length ) { 15743 helper.appendTo( ( o.appendTo === "parent" ? 15744 this.element[ 0 ].parentNode : 15745 o.appendTo ) ); 15746 } 15747 15748 // https://bugs.jqueryui.com/ticket/9446 15749 // a helper function can return the original element 15750 // which wouldn't have been set to relative in _create 15751 if ( helperIsFunction && helper[ 0 ] === this.element[ 0 ] ) { 15752 this._setPositionRelative(); 15753 } 15754 15755 if ( helper[ 0 ] !== this.element[ 0 ] && 15756 !( /(fixed|absolute)/ ).test( helper.css( "position" ) ) ) { 15757 helper.css( "position", "absolute" ); 15758 } 15759 15760 return helper; 15761 15762 }, 15763 15764 _setPositionRelative: function() { 15765 if ( !( /^(?:r|a|f)/ ).test( this.element.css( "position" ) ) ) { 15766 this.element[ 0 ].style.position = "relative"; 15767 } 15768 }, 15769 15770 _adjustOffsetFromHelper: function( obj ) { 15771 if ( typeof obj === "string" ) { 15772 obj = obj.split( " " ); 15773 } 15774 if ( Array.isArray( obj ) ) { 15775 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; 15776 } 15777 if ( "left" in obj ) { 15778 this.offset.click.left = obj.left + this.margins.left; 15779 } 15780 if ( "right" in obj ) { 15781 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 15782 } 15783 if ( "top" in obj ) { 15784 this.offset.click.top = obj.top + this.margins.top; 15785 } 15786 if ( "bottom" in obj ) { 15787 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 15788 } 15789 }, 15790 15791 _isRootNode: function( element ) { 15792 return ( /(html|body)/i ).test( element.tagName ) || element === this.document[ 0 ]; 15793 }, 15794 15795 _getParentOffset: function() { 15796 15797 //Get the offsetParent and cache its position 15798 var po = this.offsetParent.offset(), 15799 document = this.document[ 0 ]; 15800 15801 // This is a special case where we need to modify a offset calculated on start, since the 15802 // following happened: 15803 // 1. The position of the helper is absolute, so it's position is calculated based on the 15804 // next positioned parent 15805 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 15806 // the document, which means that the scroll is included in the initial calculation of the 15807 // offset of the parent, and never recalculated upon drag 15808 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== document && 15809 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { 15810 po.left += this.scrollParent.scrollLeft(); 15811 po.top += this.scrollParent.scrollTop(); 15812 } 15813 15814 if ( this._isRootNode( this.offsetParent[ 0 ] ) ) { 15815 po = { top: 0, left: 0 }; 15816 } 15817 15818 return { 15819 top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), 15820 left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) 15821 }; 15822 15823 }, 15824 15825 _getRelativeOffset: function() { 15826 if ( this.cssPosition !== "relative" ) { 15827 return { top: 0, left: 0 }; 15828 } 15829 15830 var p = this.element.position(), 15831 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 15832 15833 return { 15834 top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + 15835 ( !scrollIsRootNode ? this.scrollParent.scrollTop() : 0 ), 15836 left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + 15837 ( !scrollIsRootNode ? this.scrollParent.scrollLeft() : 0 ) 15838 }; 15839 15840 }, 15841 15842 _cacheMargins: function() { 15843 this.margins = { 15844 left: ( parseInt( this.element.css( "marginLeft" ), 10 ) || 0 ), 15845 top: ( parseInt( this.element.css( "marginTop" ), 10 ) || 0 ), 15846 right: ( parseInt( this.element.css( "marginRight" ), 10 ) || 0 ), 15847 bottom: ( parseInt( this.element.css( "marginBottom" ), 10 ) || 0 ) 15848 }; 15849 }, 15850 15851 _cacheHelperProportions: function() { 15852 this.helperProportions = { 15853 width: this.helper.outerWidth(), 15854 height: this.helper.outerHeight() 15855 }; 15856 }, 15857 15858 _setContainment: function() { 15859 15860 var isUserScrollable, c, ce, 15861 o = this.options, 15862 document = this.document[ 0 ]; 15863 15864 this.relativeContainer = null; 15865 15866 if ( !o.containment ) { 15867 this.containment = null; 15868 return; 15869 } 15870 15871 if ( o.containment === "window" ) { 15872 this.containment = [ 15873 $( window ).scrollLeft() - this.offset.relative.left - this.offset.parent.left, 15874 $( window ).scrollTop() - this.offset.relative.top - this.offset.parent.top, 15875 $( window ).scrollLeft() + $( window ).width() - 15876 this.helperProportions.width - this.margins.left, 15877 $( window ).scrollTop() + 15878 ( $( window ).height() || document.body.parentNode.scrollHeight ) - 15879 this.helperProportions.height - this.margins.top 15880 ]; 15881 return; 15882 } 15883 15884 if ( o.containment === "document" ) { 15885 this.containment = [ 15886 0, 15887 0, 15888 $( document ).width() - this.helperProportions.width - this.margins.left, 15889 ( $( document ).height() || document.body.parentNode.scrollHeight ) - 15890 this.helperProportions.height - this.margins.top 15891 ]; 15892 return; 15893 } 15894 15895 if ( o.containment.constructor === Array ) {
vendor: 10,369 bytes, lines 15896-16242
15896 this.containment = o.containment; 15897 return; 15898 } 15899 15900 if ( o.containment === "parent" ) { 15901 o.containment = this.helper[ 0 ].parentNode; 15902 } 15903 15904 c = $( o.containment ); 15905 ce = c[ 0 ]; 15906 15907 if ( !ce ) { 15908 return; 15909 } 15910 15911 isUserScrollable = /(scroll|auto)/.test( c.css( "overflow" ) ); 15912 15913 this.containment = [ 15914 ( parseInt( c.css( "borderLeftWidth" ), 10 ) || 0 ) + 15915 ( parseInt( c.css( "paddingLeft" ), 10 ) || 0 ), 15916 ( parseInt( c.css( "borderTopWidth" ), 10 ) || 0 ) + 15917 ( parseInt( c.css( "paddingTop" ), 10 ) || 0 ), 15918 ( isUserScrollable ? Math.max( ce.scrollWidth, ce.offsetWidth ) : ce.offsetWidth ) - 15919 ( parseInt( c.css( "borderRightWidth" ), 10 ) || 0 ) - 15920 ( parseInt( c.css( "paddingRight" ), 10 ) || 0 ) - 15921 this.helperProportions.width - 15922 this.margins.left - 15923 this.margins.right, 15924 ( isUserScrollable ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - 15925 ( parseInt( c.css( "borderBottomWidth" ), 10 ) || 0 ) - 15926 ( parseInt( c.css( "paddingBottom" ), 10 ) || 0 ) - 15927 this.helperProportions.height - 15928 this.margins.top - 15929 this.margins.bottom 15930 ]; 15931 this.relativeContainer = c; 15932 }, 15933 15934 _convertPositionTo: function( d, pos ) { 15935 15936 if ( !pos ) { 15937 pos = this.position; 15938 } 15939 15940 var mod = d === "absolute" ? 1 : -1, 15941 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ); 15942 15943 return { 15944 top: ( 15945 15946 // The absolute mouse position 15947 pos.top + 15948 15949 // Only for relative positioned nodes: Relative offset from element to offset parent 15950 this.offset.relative.top * mod + 15951 15952 // The offsetParent's offset without borders (offset + border) 15953 this.offset.parent.top * mod - 15954 ( ( this.cssPosition === "fixed" ? 15955 -this.offset.scroll.top : 15956 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) * mod ) 15957 ), 15958 left: ( 15959 15960 // The absolute mouse position 15961 pos.left + 15962 15963 // Only for relative positioned nodes: Relative offset from element to offset parent 15964 this.offset.relative.left * mod + 15965 15966 // The offsetParent's offset without borders (offset + border) 15967 this.offset.parent.left * mod - 15968 ( ( this.cssPosition === "fixed" ? 15969 -this.offset.scroll.left : 15970 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) * mod ) 15971 ) 15972 }; 15973 15974 }, 15975 15976 _generatePosition: function( event, constrainPosition ) { 15977 15978 var containment, co, top, left, 15979 o = this.options, 15980 scrollIsRootNode = this._isRootNode( this.scrollParent[ 0 ] ), 15981 pageX = event.pageX, 15982 pageY = event.pageY; 15983 15984 // Cache the scroll 15985 if ( !scrollIsRootNode || !this.offset.scroll ) { 15986 this.offset.scroll = { 15987 top: this.scrollParent.scrollTop(), 15988 left: this.scrollParent.scrollLeft() 15989 }; 15990 } 15991 15992 /* 15993 * - Position constraining - 15994 * Constrain the position to a mix of grid, containment. 15995 */ 15996 15997 // If we are not dragging yet, we won't check for options 15998 if ( constrainPosition ) { 15999 if ( this.containment ) { 16000 if ( this.relativeContainer ) { 16001 co = this.relativeContainer.offset(); 16002 containment = [ 16003 this.containment[ 0 ] + co.left, 16004 this.containment[ 1 ] + co.top, 16005 this.containment[ 2 ] + co.left, 16006 this.containment[ 3 ] + co.top 16007 ]; 16008 } else { 16009 containment = this.containment; 16010 } 16011 16012 if ( event.pageX - this.offset.click.left < containment[ 0 ] ) { 16013 pageX = containment[ 0 ] + this.offset.click.left; 16014 } 16015 if ( event.pageY - this.offset.click.top < containment[ 1 ] ) { 16016 pageY = containment[ 1 ] + this.offset.click.top; 16017 } 16018 if ( event.pageX - this.offset.click.left > containment[ 2 ] ) { 16019 pageX = containment[ 2 ] + this.offset.click.left; 16020 } 16021 if ( event.pageY - this.offset.click.top > containment[ 3 ] ) { 16022 pageY = containment[ 3 ] + this.offset.click.top; 16023 } 16024 } 16025 16026 if ( o.grid ) { 16027 16028 //Check for grid elements set to 0 to prevent divide by 0 error causing invalid 16029 // argument errors in IE (see ticket #6950) 16030 top = o.grid[ 1 ] ? this.originalPageY + Math.round( ( pageY - 16031 this.originalPageY ) / o.grid[ 1 ] ) * o.grid[ 1 ] : this.originalPageY; 16032 pageY = containment ? ( ( top - this.offset.click.top >= containment[ 1 ] || 16033 top - this.offset.click.top > containment[ 3 ] ) ? 16034 top : 16035 ( ( top - this.offset.click.top >= containment[ 1 ] ) ? 16036 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : top; 16037 16038 left = o.grid[ 0 ] ? this.originalPageX + 16039 Math.round( ( pageX - this.originalPageX ) / o.grid[ 0 ] ) * o.grid[ 0 ] : 16040 this.originalPageX; 16041 pageX = containment ? ( ( left - this.offset.click.left >= containment[ 0 ] || 16042 left - this.offset.click.left > containment[ 2 ] ) ? 16043 left : 16044 ( ( left - this.offset.click.left >= containment[ 0 ] ) ? 16045 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : left; 16046 } 16047 16048 if ( o.axis === "y" ) { 16049 pageX = this.originalPageX; 16050 } 16051 16052 if ( o.axis === "x" ) { 16053 pageY = this.originalPageY; 16054 } 16055 } 16056 16057 return { 16058 top: ( 16059 16060 // The absolute mouse position 16061 pageY - 16062 16063 // Click offset (relative to the element) 16064 this.offset.click.top - 16065 16066 // Only for relative positioned nodes: Relative offset from element to offset parent 16067 this.offset.relative.top - 16068 16069 // The offsetParent's offset without borders (offset + border) 16070 this.offset.parent.top + 16071 ( this.cssPosition === "fixed" ? 16072 -this.offset.scroll.top : 16073 ( scrollIsRootNode ? 0 : this.offset.scroll.top ) ) 16074 ), 16075 left: ( 16076 16077 // The absolute mouse position 16078 pageX - 16079 16080 // Click offset (relative to the element) 16081 this.offset.click.left - 16082 16083 // Only for relative positioned nodes: Relative offset from element to offset parent 16084 this.offset.relative.left - 16085 16086 // The offsetParent's offset without borders (offset + border) 16087 this.offset.parent.left + 16088 ( this.cssPosition === "fixed" ? 16089 -this.offset.scroll.left : 16090 ( scrollIsRootNode ? 0 : this.offset.scroll.left ) ) 16091 ) 16092 }; 16093 16094 }, 16095 16096 _clear: function() { 16097 this._removeClass( this.helper, "ui-draggable-dragging" ); 16098 if ( this.helper[ 0 ] !== this.element[ 0 ] && !this.cancelHelperRemoval ) { 16099 this.helper.remove(); 16100 } 16101 this.helper = null; 16102 this.cancelHelperRemoval = false; 16103 if ( this.destroyOnClear ) { 16104 this.destroy(); 16105 } 16106 }, 16107 16108 // From now on bulk stuff - mainly helpers 16109 16110 _trigger: function( type, event, ui ) { 16111 ui = ui || this._uiHash(); 16112 $.ui.plugin.call( this, type, [ event, ui, this ], true ); 16113 16114 // Absolute position and offset (see #6884 ) have to be recalculated after plugins 16115 if ( /^(drag|start|stop)/.test( type ) ) { 16116 this.positionAbs = this._convertPositionTo( "absolute" ); 16117 ui.offset = this.positionAbs; 16118 } 16119 return $.Widget.prototype._trigger.call( this, type, event, ui ); 16120 }, 16121 16122 plugins: {}, 16123 16124 _uiHash: function() { 16125 return { 16126 helper: this.helper, 16127 position: this.position, 16128 originalPosition: this.originalPosition, 16129 offset: this.positionAbs 16130 }; 16131 } 16132 16133} ); 16134 16135$.ui.plugin.add( "draggable", "connectToSortable", { 16136 start: function( event, ui, draggable ) { 16137 var uiSortable = $.extend( {}, ui, { 16138 item: draggable.element 16139 } ); 16140 16141 draggable.sortables = []; 16142 $( draggable.options.connectToSortable ).each( function() { 16143 var sortable = $( this ).sortable( "instance" ); 16144 16145 if ( sortable && !sortable.options.disabled ) { 16146 draggable.sortables.push( sortable ); 16147 16148 // RefreshPositions is called at drag start to refresh the containerCache 16149 // which is used in drag. This ensures it's initialized and synchronized 16150 // with any changes that might have happened on the page since initialization. 16151 sortable.refreshPositions(); 16152 sortable._trigger( "activate", event, uiSortable ); 16153 } 16154 } ); 16155 }, 16156 stop: function( event, ui, draggable ) { 16157 var uiSortable = $.extend( {}, ui, { 16158 item: draggable.element 16159 } ); 16160 16161 draggable.cancelHelperRemoval = false; 16162 16163 $.each( draggable.sortables, function() { 16164 var sortable = this; 16165 16166 if ( sortable.isOver ) { 16167 sortable.isOver = 0; 16168 16169 // Allow this sortable to handle removing the helper 16170 draggable.cancelHelperRemoval = true; 16171 sortable.cancelHelperRemoval = false; 16172 16173 // Use _storedCSS To restore properties in the sortable, 16174 // as this also handles revert (#9675) since the draggable 16175 // may have modified them in unexpected ways (#8809) 16176 sortable._storedCSS = { 16177 position: sortable.placeholder.css( "position" ), 16178 top: sortable.placeholder.css( "top" ), 16179 left: sortable.placeholder.css( "left" ) 16180 }; 16181 16182 sortable._mouseStop( event ); 16183 16184 // Once drag has ended, the sortable should return to using 16185 // its original helper, not the shared helper from draggable 16186 sortable.options.helper = sortable.options._helper; 16187 } else { 16188 16189 // Prevent this Sortable from removing the helper. 16190 // However, don't set the draggable to remove the helper 16191 // either as another connected Sortable may yet handle the removal. 16192 sortable.cancelHelperRemoval = true; 16193 16194 sortable._trigger( "deactivate", event, uiSortable ); 16195 } 16196 } ); 16197 }, 16198 drag: function( event, ui, draggable ) { 16199 $.each( draggable.sortables, function() { 16200 var innermostIntersecting = false, 16201 sortable = this; 16202 16203 // Copy over variables that sortable's _intersectsWith uses 16204 sortable.positionAbs = draggable.positionAbs; 16205 sortable.helperProportions = draggable.helperProportions; 16206 sortable.offset.click = draggable.offset.click; 16207 16208 if ( sortable._intersectsWith( sortable.containerCache ) ) { 16209 innermostIntersecting = true; 16210 16211 $.each( draggable.sortables, function() { 16212 16213 // Copy over variables that sortable's _intersectsWith uses 16214 this.positionAbs = draggable.positionAbs; 16215 this.helperProportions = draggable.helperProportions; 16216 this.offset.click = draggable.offset.click; 16217 16218 if ( this !== sortable && 16219 this._intersectsWith( this.containerCache ) && 16220 $.contains( sortable.element[ 0 ], this.element[ 0 ] ) ) { 16221 innermostIntersecting = false; 16222 } 16223 16224 return innermostIntersecting; 16225 } ); 16226 } 16227 16228 if ( innermostIntersecting ) { 16229 16230 // If it intersects, we use a little isOver variable and set it once, 16231 // so that the move-in stuff gets fired only once. 16232 if ( !sortable.isOver ) { 16233 sortable.isOver = 1; 16234 16235 // Store draggable's parent in case we need to reappend to it later. 16236 draggable._parent = ui.helper.parent(); 16237 16238 sortable.currentItem = ui.helper 16239 .appendTo( sortable.element ) 16240 .data( "ui-sortable-item", true ); 16241 16242 // Store helper option to later restore it
vendor: 10,978 bytes, lines 16243-16615
16243 sortable.options._helper = sortable.options.helper; 16244 16245 sortable.options.helper = function() { 16246 return ui.helper[ 0 ]; 16247 }; 16248 16249 // Fire the start events of the sortable with our passed browser event, 16250 // and our own helper (so it doesn't create a new one) 16251 event.target = sortable.currentItem[ 0 ]; 16252 sortable._mouseCapture( event, true ); 16253 sortable._mouseStart( event, true, true ); 16254 16255 // Because the browser event is way off the new appended portlet, 16256 // modify necessary variables to reflect the changes 16257 sortable.offset.click.top = draggable.offset.click.top; 16258 sortable.offset.click.left = draggable.offset.click.left; 16259 sortable.offset.parent.left -= draggable.offset.parent.left - 16260 sortable.offset.parent.left; 16261 sortable.offset.parent.top -= draggable.offset.parent.top - 16262 sortable.offset.parent.top; 16263 16264 draggable._trigger( "toSortable", event ); 16265 16266 // Inform draggable that the helper is in a valid drop zone, 16267 // used solely in the revert option to handle "valid/invalid". 16268 draggable.dropped = sortable.element; 16269 16270 // Need to refreshPositions of all sortables in the case that 16271 // adding to one sortable changes the location of the other sortables (#9675) 16272 $.each( draggable.sortables, function() { 16273 this.refreshPositions(); 16274 } ); 16275 16276 // Hack so receive/update callbacks work (mostly) 16277 draggable.currentItem = draggable.element; 16278 sortable.fromOutside = draggable; 16279 } 16280 16281 if ( sortable.currentItem ) { 16282 sortable._mouseDrag( event ); 16283 16284 // Copy the sortable's position because the draggable's can potentially reflect 16285 // a relative position, while sortable is always absolute, which the dragged 16286 // element has now become. (#8809) 16287 ui.position = sortable.position; 16288 } 16289 } else { 16290 16291 // If it doesn't intersect with the sortable, and it intersected before, 16292 // we fake the drag stop of the sortable, but make sure it doesn't remove 16293 // the helper by using cancelHelperRemoval. 16294 if ( sortable.isOver ) { 16295 16296 sortable.isOver = 0; 16297 sortable.cancelHelperRemoval = true; 16298 16299 // Calling sortable's mouseStop would trigger a revert, 16300 // so revert must be temporarily false until after mouseStop is called. 16301 sortable.options._revert = sortable.options.revert; 16302 sortable.options.revert = false; 16303 16304 sortable._trigger( "out", event, sortable._uiHash( sortable ) ); 16305 sortable._mouseStop( event, true ); 16306 16307 // Restore sortable behaviors that were modfied 16308 // when the draggable entered the sortable area (#9481) 16309 sortable.options.revert = sortable.options._revert; 16310 sortable.options.helper = sortable.options._helper; 16311 16312 if ( sortable.placeholder ) { 16313 sortable.placeholder.remove(); 16314 } 16315 16316 // Restore and recalculate the draggable's offset considering the sortable 16317 // may have modified them in unexpected ways. (#8809, #10669) 16318 ui.helper.appendTo( draggable._parent ); 16319 draggable._refreshOffsets( event ); 16320 ui.position = draggable._generatePosition( event, true ); 16321 16322 draggable._trigger( "fromSortable", event ); 16323 16324 // Inform draggable that the helper is no longer in a valid drop zone 16325 draggable.dropped = false; 16326 16327 // Need to refreshPositions of all sortables just in case removing 16328 // from one sortable changes the location of other sortables (#9675) 16329 $.each( draggable.sortables, function() { 16330 this.refreshPositions(); 16331 } ); 16332 } 16333 } 16334 } ); 16335 } 16336} ); 16337 16338$.ui.plugin.add( "draggable", "cursor", { 16339 start: function( event, ui, instance ) { 16340 var t = $( "body" ), 16341 o = instance.options; 16342 16343 if ( t.css( "cursor" ) ) { 16344 o._cursor = t.css( "cursor" ); 16345 } 16346 t.css( "cursor", o.cursor ); 16347 }, 16348 stop: function( event, ui, instance ) { 16349 var o = instance.options; 16350 if ( o._cursor ) { 16351 $( "body" ).css( "cursor", o._cursor ); 16352 } 16353 } 16354} ); 16355 16356$.ui.plugin.add( "draggable", "opacity", { 16357 start: function( event, ui, instance ) { 16358 var t = $( ui.helper ), 16359 o = instance.options; 16360 if ( t.css( "opacity" ) ) { 16361 o._opacity = t.css( "opacity" ); 16362 } 16363 t.css( "opacity", o.opacity ); 16364 }, 16365 stop: function( event, ui, instance ) { 16366 var o = instance.options; 16367 if ( o._opacity ) { 16368 $( ui.helper ).css( "opacity", o._opacity ); 16369 } 16370 } 16371} ); 16372 16373$.ui.plugin.add( "draggable", "scroll", { 16374 start: function( event, ui, i ) { 16375 if ( !i.scrollParentNotHidden ) { 16376 i.scrollParentNotHidden = i.helper.scrollParent( false ); 16377 } 16378 16379 if ( i.scrollParentNotHidden[ 0 ] !== i.document[ 0 ] && 16380 i.scrollParentNotHidden[ 0 ].tagName !== "HTML" ) { 16381 i.overflowOffset = i.scrollParentNotHidden.offset(); 16382 } 16383 }, 16384 drag: function( event, ui, i ) { 16385 16386 var o = i.options, 16387 scrolled = false, 16388 scrollParent = i.scrollParentNotHidden[ 0 ], 16389 document = i.document[ 0 ]; 16390 16391 if ( scrollParent !== document && scrollParent.tagName !== "HTML" ) { 16392 if ( !o.axis || o.axis !== "x" ) { 16393 if ( ( i.overflowOffset.top + scrollParent.offsetHeight ) - event.pageY < 16394 o.scrollSensitivity ) { 16395 scrollParent.scrollTop = scrolled = scrollParent.scrollTop + o.scrollSpeed; 16396 } else if ( event.pageY - i.overflowOffset.top < o.scrollSensitivity ) { 16397 scrollParent.scrollTop = scrolled = scrollParent.scrollTop - o.scrollSpeed; 16398 } 16399 } 16400 16401 if ( !o.axis || o.axis !== "y" ) { 16402 if ( ( i.overflowOffset.left + scrollParent.offsetWidth ) - event.pageX < 16403 o.scrollSensitivity ) { 16404 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft + o.scrollSpeed; 16405 } else if ( event.pageX - i.overflowOffset.left < o.scrollSensitivity ) { 16406 scrollParent.scrollLeft = scrolled = scrollParent.scrollLeft - o.scrollSpeed; 16407 } 16408 } 16409 16410 } else { 16411 16412 if ( !o.axis || o.axis !== "x" ) { 16413 if ( event.pageY - $( document ).scrollTop() < o.scrollSensitivity ) { 16414 scrolled = $( document ).scrollTop( $( document ).scrollTop() - o.scrollSpeed ); 16415 } else if ( $( window ).height() - ( event.pageY - $( document ).scrollTop() ) < 16416 o.scrollSensitivity ) { 16417 scrolled = $( document ).scrollTop( $( document ).scrollTop() + o.scrollSpeed ); 16418 } 16419 } 16420 16421 if ( !o.axis || o.axis !== "y" ) { 16422 if ( event.pageX - $( document ).scrollLeft() < o.scrollSensitivity ) { 16423 scrolled = $( document ).scrollLeft( 16424 $( document ).scrollLeft() - o.scrollSpeed 16425 ); 16426 } else if ( $( window ).width() - ( event.pageX - $( document ).scrollLeft() ) < 16427 o.scrollSensitivity ) { 16428 scrolled = $( document ).scrollLeft( 16429 $( document ).scrollLeft() + o.scrollSpeed 16430 ); 16431 } 16432 } 16433 16434 } 16435 16436 if ( scrolled !== false && $.ui.ddmanager && !o.dropBehaviour ) { 16437 $.ui.ddmanager.prepareOffsets( i, event ); 16438 } 16439 16440 } 16441} ); 16442 16443$.ui.plugin.add( "draggable", "snap", { 16444 start: function( event, ui, i ) { 16445 16446 var o = i.options; 16447 16448 i.snapElements = []; 16449 16450 $( o.snap.constructor !== String ? ( o.snap.items || ":data(ui-draggable)" ) : o.snap ) 16451 .each( function() { 16452 var $t = $( this ), 16453 $o = $t.offset(); 16454 if ( this !== i.element[ 0 ] ) { 16455 i.snapElements.push( { 16456 item: this, 16457 width: $t.outerWidth(), height: $t.outerHeight(), 16458 top: $o.top, left: $o.left 16459 } ); 16460 } 16461 } ); 16462 16463 }, 16464 drag: function( event, ui, inst ) { 16465 16466 var ts, bs, ls, rs, l, r, t, b, i, first, 16467 o = inst.options, 16468 d = o.snapTolerance, 16469 x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width, 16470 y1 = ui.offset.top, y2 = y1 + inst.helperProportions.height; 16471 16472 for ( i = inst.snapElements.length - 1; i >= 0; i-- ) { 16473 16474 l = inst.snapElements[ i ].left - inst.margins.left; 16475 r = l + inst.snapElements[ i ].width; 16476 t = inst.snapElements[ i ].top - inst.margins.top; 16477 b = t + inst.snapElements[ i ].height; 16478 16479 if ( x2 < l - d || x1 > r + d || y2 < t - d || y1 > b + d || 16480 !$.contains( inst.snapElements[ i ].item.ownerDocument, 16481 inst.snapElements[ i ].item ) ) { 16482 if ( inst.snapElements[ i ].snapping ) { 16483 if ( inst.options.snap.release ) { 16484 inst.options.snap.release.call( 16485 inst.element, 16486 event, 16487 $.extend( inst._uiHash(), { snapItem: inst.snapElements[ i ].item } ) 16488 ); 16489 } 16490 } 16491 inst.snapElements[ i ].snapping = false; 16492 continue; 16493 } 16494 16495 if ( o.snapMode !== "inner" ) { 16496 ts = Math.abs( t - y2 ) <= d; 16497 bs = Math.abs( b - y1 ) <= d; 16498 ls = Math.abs( l - x2 ) <= d; 16499 rs = Math.abs( r - x1 ) <= d; 16500 if ( ts ) { 16501 ui.position.top = inst._convertPositionTo( "relative", { 16502 top: t - inst.helperProportions.height, 16503 left: 0 16504 } ).top; 16505 } 16506 if ( bs ) { 16507 ui.position.top = inst._convertPositionTo( "relative", { 16508 top: b, 16509 left: 0 16510 } ).top; 16511 } 16512 if ( ls ) { 16513 ui.position.left = inst._convertPositionTo( "relative", { 16514 top: 0, 16515 left: l - inst.helperProportions.width 16516 } ).left; 16517 } 16518 if ( rs ) { 16519 ui.position.left = inst._convertPositionTo( "relative", { 16520 top: 0, 16521 left: r 16522 } ).left; 16523 } 16524 } 16525 16526 first = ( ts || bs || ls || rs ); 16527 16528 if ( o.snapMode !== "outer" ) { 16529 ts = Math.abs( t - y1 ) <= d; 16530 bs = Math.abs( b - y2 ) <= d; 16531 ls = Math.abs( l - x1 ) <= d; 16532 rs = Math.abs( r - x2 ) <= d; 16533 if ( ts ) { 16534 ui.position.top = inst._convertPositionTo( "relative", { 16535 top: t, 16536 left: 0 16537 } ).top; 16538 } 16539 if ( bs ) { 16540 ui.position.top = inst._convertPositionTo( "relative", { 16541 top: b - inst.helperProportions.height, 16542 left: 0 16543 } ).top; 16544 } 16545 if ( ls ) { 16546 ui.position.left = inst._convertPositionTo( "relative", { 16547 top: 0, 16548 left: l 16549 } ).left; 16550 } 16551 if ( rs ) { 16552 ui.position.left = inst._convertPositionTo( "relative", { 16553 top: 0, 16554 left: r - inst.helperProportions.width 16555 } ).left; 16556 } 16557 } 16558 16559 if ( !inst.snapElements[ i ].snapping && ( ts || bs || ls || rs || first ) ) { 16560 if ( inst.options.snap.snap ) { 16561 inst.options.snap.snap.call( 16562 inst.element, 16563 event, 16564 $.extend( inst._uiHash(), { 16565 snapItem: inst.snapElements[ i ].item 16566 } ) ); 16567 } 16568 } 16569 inst.snapElements[ i ].snapping = ( ts || bs || ls || rs || first ); 16570 16571 } 16572 16573 } 16574} ); 16575 16576$.ui.plugin.add( "draggable", "stack", { 16577 start: function( event, ui, instance ) { 16578 var min, 16579 o = instance.options, 16580 group = $.makeArray( $( o.stack ) ).sort( function( a, b ) { 16581 return ( parseInt( $( a ).css( "zIndex" ), 10 ) || 0 ) - 16582 ( parseInt( $( b ).css( "zIndex" ), 10 ) || 0 ); 16583 } ); 16584 16585 if ( !group.length ) { 16586 return; 16587 } 16588 16589 min = parseInt( $( group[ 0 ] ).css( "zIndex" ), 10 ) || 0; 16590 $( group ).each( function( i ) { 16591 $( this ).css( "zIndex", min + i ); 16592 } ); 16593 this.css( "zIndex", ( min + group.length ) ); 16594 } 16595} ); 16596 16597$.ui.plugin.add( "draggable", "zIndex", { 16598 start: function( event, ui, instance ) { 16599 var t = $( ui.helper ), 16600 o = instance.options; 16601 16602 if ( t.css( "zIndex" ) ) { 16603 o._zIndex = t.css( "zIndex" ); 16604 } 16605 t.css( "zIndex", o.zIndex ); 16606 }, 16607 stop: function( event, ui, instance ) { 16608 var o = instance.options; 16609 16610 if ( o._zIndex ) { 16611 $( ui.helper ).css( "zIndex", o._zIndex ); 16612 } 16613 } 16614} ); 16615
16616return $.ui.draggable; 16617 16618} ); 16619 16620 16621/*! 16622 * jQuery UI Disable Selection 1.14.2 16623 * https://jqueryui.com 16624 * 16625 * Copyright OpenJS Foundation and other contributors 16626 * Released under the MIT license. 16627 * https://jquery.org/license 16628 */ 16629 16630//>>label: disableSelection 16631//>>group: Core 16632//>>description: Disable selection of text content within the set of matched elements. 16633//>>docs: https://api.jqueryui.com/disableSelection/ 16634 16635// This file is deprecated 16636( function( factory ) { 16637 "use strict"; 16638 16639 if ( typeof define === "function" && define.amd ) { 16640 16641 // AMD. Register as an anonymous module. 16642 define( [ "jquery", "./version" ], factory ); 16643 } else { 16644 16645 // Browser globals 16646 factory( jQuery ); 16647 } 16648} )( function( $ ) { 16649"use strict"; 16650 16651return $.fn.extend( { 16652 disableSelection: ( function() { 16653 var eventType = "onselectstart" in document.createElement( "div" ) ? 16654 "selectstart" : 16655 "mousedown"; 16656 16657 return function() { 16658 return this.on( eventType + ".ui-disableSelection", function( event ) { 16659 event.preventDefault(); 16660 } ); 16661 }; 16662 } )(), 16663 16664 enableSelection: function() { 16665 return this.off( ".ui-disableSelection" ); 16666 } 16667} ); 16668 16669} ); 16670 16671 16672 16673 16674 16675 16676/*! 16677 * jQuery UI Resizable 1.14.2 16678 * https://jqueryui.com 16679 * 16680 * Copyright OpenJS Foundation and other contributors 16681 * Released under the MIT license. 16682 * https://jquery.org/license 16683 */ 16684 16685//>>label: Resizable 16686//>>group: Interactions 16687//>>description: Enables resize functionality for any element. 16688//>>docs: https://api.jqueryui.com/resizable/ 16689//>>demos: https://jqueryui.com/resizable/ 16690//>>css.structure: ../../themes/base/core.css 16691//>>css.structure: ../../themes/base/resizable.css 16692//>>css.theme: ../../themes/base/theme.css 16693 16694( function( factory ) { 16695 "use strict"; 16696 16697 if ( typeof define === "function" && define.amd ) { 16698 16699 // AMD. Register as an anonymous module. 16700 define( [ 16701 "jquery", 16702 "./mouse", 16703 "../disable-selection", 16704 "../plugin", 16705 "../version", 16706 "../widget" 16707 ], factory ); 16708 } else { 16709 16710 // Browser globals 16711 factory( jQuery ); 16712 } 16713} )( function( $ ) { 16714"use strict";
vendor: 31,156 bytes, lines 16714-17947
16714 16715 16716$.widget( "ui.resizable", $.ui.mouse, { 16717 version: "1.14.2", 16718 widgetEventPrefix: "resize", 16719 options: { 16720 alsoResize: false, 16721 animate: false, 16722 animateDuration: "slow", 16723 animateEasing: "swing", 16724 aspectRatio: false, 16725 autoHide: false, 16726 classes: { 16727 "ui-resizable-se": "ui-icon ui-icon-gripsmall-diagonal-se" 16728 }, 16729 containment: false, 16730 ghost: false, 16731 grid: false, 16732 handles: "e,s,se", 16733 helper: false, 16734 maxHeight: null, 16735 maxWidth: null, 16736 minHeight: 10, 16737 minWidth: 10, 16738 16739 // See #7960 16740 zIndex: 90, 16741 16742 // Callbacks 16743 resize: null, 16744 start: null, 16745 stop: null 16746 }, 16747 16748 _num: function( value ) { 16749 return parseFloat( value ) || 0; 16750 }, 16751 16752 _isNumber: function( value ) { 16753 return !isNaN( parseFloat( value ) ); 16754 }, 16755 16756 _hasScroll: function( el, a ) { 16757 16758 var scroll, 16759 has = false, 16760 overflow = $( el ).css( "overflow" ); 16761 16762 if ( overflow === "hidden" ) { 16763 return false; 16764 } 16765 if ( overflow === "scroll" ) { 16766 return true; 16767 } 16768 16769 scroll = ( a && a === "left" ) ? "scrollLeft" : "scrollTop"; 16770 16771 if ( el[ scroll ] > 0 ) { 16772 return true; 16773 } 16774 16775 // TODO: determine which cases actually cause this to happen 16776 // if the element doesn't have the scroll set, see if it's possible to 16777 // set the scroll 16778 try { 16779 el[ scroll ] = 1; 16780 has = ( el[ scroll ] > 0 ); 16781 el[ scroll ] = 0; 16782 } catch ( _e ) { 16783 16784 // `el` might be a string, then setting `scroll` will throw 16785 // an error in strict mode; ignore it. 16786 } 16787 return has; 16788 }, 16789 16790 _create: function() { 16791 16792 var margins, 16793 o = this.options, 16794 that = this; 16795 this._addClass( "ui-resizable" ); 16796 16797 $.extend( this, { 16798 _aspectRatio: !!( o.aspectRatio ), 16799 aspectRatio: o.aspectRatio, 16800 originalElement: this.element, 16801 _proportionallyResizeElements: [], 16802 _helper: o.helper || o.ghost || o.animate ? o.helper || "ui-resizable-helper" : null 16803 } ); 16804 16805 // Wrap the element if it cannot hold child nodes 16806 if ( this.element[ 0 ].nodeName.match( /^(canvas|textarea|input|select|button|img)$/i ) ) { 16807 16808 this.element.wrap( 16809 $( "<div class='ui-wrapper'></div>" ).css( { 16810 overflow: "hidden", 16811 position: this.element.css( "position" ), 16812 width: this.element.outerWidth(), 16813 height: this.element.outerHeight(), 16814 top: this.element.css( "top" ), 16815 left: this.element.css( "left" ) 16816 } ) 16817 ); 16818 16819 this.element = this.element.parent().data( 16820 "ui-resizable", this.element.resizable( "instance" ) 16821 ); 16822 16823 this.elementIsWrapper = true; 16824 16825 margins = { 16826 marginTop: this.originalElement.css( "marginTop" ), 16827 marginRight: this.originalElement.css( "marginRight" ), 16828 marginBottom: this.originalElement.css( "marginBottom" ), 16829 marginLeft: this.originalElement.css( "marginLeft" ) 16830 }; 16831 16832 this.element.css( margins ); 16833 16834 // Support: Safari 16835 // Prevent Safari textarea resize 16836 this.originalResizeStyle = this.originalElement.css( "resize" ); 16837 this.originalElement.css( "resize", "none" ); 16838 16839 this._proportionallyResizeElements.push( this.originalElement.css( { 16840 position: "static", 16841 zoom: 1, 16842 display: "block" 16843 } ) ); 16844 16845 this._proportionallyResize(); 16846 } 16847 16848 this._setupHandles(); 16849 16850 if ( o.autoHide ) { 16851 $( this.element ) 16852 .on( "mouseenter", function() { 16853 if ( o.disabled ) { 16854 return; 16855 } 16856 that._removeClass( "ui-resizable-autohide" ); 16857 that._handles.show(); 16858 } ) 16859 .on( "mouseleave", function() { 16860 if ( o.disabled ) { 16861 return; 16862 } 16863 if ( !that.resizing ) { 16864 that._addClass( "ui-resizable-autohide" ); 16865 that._handles.hide(); 16866 } 16867 } ); 16868 } 16869 16870 this._mouseInit(); 16871 }, 16872 16873 _destroy: function() { 16874 16875 this._mouseDestroy(); 16876 this._addedHandles.remove(); 16877 16878 var wrapper, 16879 _destroy = function( exp ) { 16880 $( exp ) 16881 .removeData( "resizable" ) 16882 .removeData( "ui-resizable" ) 16883 .off( ".resizable" ); 16884 }; 16885 16886 // TODO: Unwrap at same DOM position 16887 if ( this.elementIsWrapper ) { 16888 _destroy( this.element ); 16889 wrapper = this.element; 16890 this.originalElement.css( { 16891 position: wrapper.css( "position" ), 16892 width: wrapper.outerWidth(), 16893 height: wrapper.outerHeight(), 16894 top: wrapper.css( "top" ), 16895 left: wrapper.css( "left" ) 16896 } ).insertAfter( wrapper ); 16897 wrapper.remove(); 16898 } 16899 16900 this.originalElement.css( "resize", this.originalResizeStyle ); 16901 _destroy( this.originalElement ); 16902 16903 return this; 16904 }, 16905 16906 _setOption: function( key, value ) { 16907 this._super( key, value ); 16908 16909 switch ( key ) { 16910 case "handles": 16911 this._removeHandles(); 16912 this._setupHandles(); 16913 break; 16914 case "aspectRatio": 16915 this._aspectRatio = !!value; 16916 break; 16917 default: 16918 break; 16919 } 16920 }, 16921 16922 _setupHandles: function() { 16923 var o = this.options, handle, i, n, hname, axis, that = this; 16924 this.handles = o.handles || 16925 ( !$( ".ui-resizable-handle", this.element ).length ? 16926 "e,s,se" : { 16927 n: ".ui-resizable-n", 16928 e: ".ui-resizable-e", 16929 s: ".ui-resizable-s", 16930 w: ".ui-resizable-w", 16931 se: ".ui-resizable-se", 16932 sw: ".ui-resizable-sw", 16933 ne: ".ui-resizable-ne", 16934 nw: ".ui-resizable-nw" 16935 } ); 16936 16937 this._handles = $(); 16938 this._addedHandles = $(); 16939 if ( this.handles.constructor === String ) { 16940 16941 if ( this.handles === "all" ) { 16942 this.handles = "n,e,s,w,se,sw,ne,nw"; 16943 } 16944 16945 n = this.handles.split( "," ); 16946 this.handles = {}; 16947 16948 for ( i = 0; i < n.length; i++ ) { 16949 16950 handle = String.prototype.trim.call( n[ i ] ); 16951 hname = "ui-resizable-" + handle; 16952 axis = $( "<div>" ); 16953 this._addClass( axis, "ui-resizable-handle " + hname ); 16954 16955 axis.css( { zIndex: o.zIndex } ); 16956 16957 this.handles[ handle ] = ".ui-resizable-" + handle; 16958 if ( !this.element.children( this.handles[ handle ] ).length ) { 16959 this.element.append( axis ); 16960 this._addedHandles = this._addedHandles.add( axis ); 16961 } 16962 } 16963 16964 } 16965 16966 this._renderAxis = function( target ) { 16967 16968 var i, axis, padPos, padWrapper; 16969 16970 target = target || this.element; 16971 16972 for ( i in this.handles ) { 16973 16974 if ( this.handles[ i ].constructor === String ) { 16975 this.handles[ i ] = this.element.children( this.handles[ i ] ).first().show(); 16976 } else if ( this.handles[ i ].jquery || this.handles[ i ].nodeType ) { 16977 this.handles[ i ] = $( this.handles[ i ] ); 16978 this._on( this.handles[ i ], { "mousedown": that._mouseDown } ); 16979 } 16980 16981 if ( this.elementIsWrapper && 16982 this.originalElement[ 0 ] 16983 .nodeName 16984 .match( /^(textarea|input|select|button)$/i ) ) { 16985 axis = $( this.handles[ i ], this.element ); 16986 16987 padWrapper = /sw|ne|nw|se|n|s/.test( i ) ? 16988 axis.outerHeight() : 16989 axis.outerWidth(); 16990 16991 padPos = [ "padding", 16992 /ne|nw|n/.test( i ) ? "Top" : 16993 /se|sw|s/.test( i ) ? "Bottom" : 16994 /^e$/.test( i ) ? "Right" : "Left" ].join( "" ); 16995 16996 target.css( padPos, padWrapper ); 16997 16998 this._proportionallyResize(); 16999 } 17000 17001 this._handles = this._handles.add( this.handles[ i ] ); 17002 } 17003 }; 17004 17005 // TODO: make renderAxis a prototype function 17006 this._renderAxis( this.element ); 17007 17008 this._handles = this._handles.add( this.element.find( ".ui-resizable-handle" ) ); 17009 this._handles.disableSelection(); 17010 17011 this._handles.on( "mouseover", function() { 17012 if ( !that.resizing ) { 17013 if ( this.className ) { 17014 axis = this.className.match( /ui-resizable-(se|sw|ne|nw|n|e|s|w)/i ); 17015 } 17016 that.axis = axis && axis[ 1 ] ? axis[ 1 ] : "se"; 17017 } 17018 } ); 17019 17020 if ( o.autoHide ) { 17021 this._handles.hide(); 17022 this._addClass( "ui-resizable-autohide" ); 17023 } 17024 }, 17025 17026 _removeHandles: function() { 17027 this._addedHandles.remove(); 17028 }, 17029 17030 _mouseCapture: function( event ) { 17031 var i, handle, 17032 capture = false; 17033 17034 for ( i in this.handles ) { 17035 handle = $( this.handles[ i ] )[ 0 ]; 17036 if ( handle === event.target || $.contains( handle, event.target ) ) { 17037 capture = true; 17038 } 17039 } 17040 17041 return !this.options.disabled && capture; 17042 }, 17043 17044 _mouseStart: function( event ) { 17045 17046 var curleft, curtop, cursor, calculatedSize, 17047 o = this.options, 17048 el = this.element; 17049 17050 this.resizing = true; 17051 17052 this._renderProxy(); 17053 17054 curleft = this._num( this.helper.css( "left" ) ); 17055 curtop = this._num( this.helper.css( "top" ) ); 17056 17057 if ( o.containment ) { 17058 curleft += $( o.containment ).scrollLeft() || 0; 17059 curtop += $( o.containment ).scrollTop() || 0; 17060 } 17061 17062 this.offset = this.helper.offset(); 17063 this.position = { left: curleft, top: curtop }; 17064 17065 if ( !this._helper ) { 17066 calculatedSize = this._calculateAdjustedElementDimensions( el ); 17067 } 17068 17069 this.size = this._helper ? { 17070 width: this.helper.width(), 17071 height: this.helper.height() 17072 } : { 17073 width: calculatedSize.width, 17074 height: calculatedSize.height 17075 }; 17076 17077 this.originalSize = this._helper ? { 17078 width: el.outerWidth(), 17079 height: el.outerHeight() 17080 } : { 17081 width: calculatedSize.width, 17082 height: calculatedSize.height 17083 }; 17084 17085 this.sizeDiff = { 17086 width: el.outerWidth() - el.width(), 17087 height: el.outerHeight() - el.height() 17088 }; 17089 17090 this.originalPosition = { left: curleft, top: curtop }; 17091 this.originalMousePosition = { left: event.pageX, top: event.pageY }; 17092 17093 this.aspectRatio = ( typeof o.aspectRatio === "number" ) ? 17094 o.aspectRatio : 17095 ( ( this.originalSize.width / this.originalSize.height ) || 1 ); 17096 17097 cursor = $( ".ui-resizable-" + this.axis ).css( "cursor" ); 17098 $( "body" ).css( "cursor", cursor === "auto" ? this.axis + "-resize" : cursor ); 17099 17100 this._addClass( "ui-resizable-resizing" ); 17101 this._propagate( "start", event ); 17102 return true; 17103 }, 17104 17105 _mouseDrag: function( event ) { 17106 17107 var data, props, 17108 smp = this.originalMousePosition, 17109 a = this.axis, 17110 dx = ( event.pageX - smp.left ) || 0, 17111 dy = ( event.pageY - smp.top ) || 0, 17112 trigger = this._change[ a ]; 17113 17114 this._updatePrevProperties(); 17115 17116 if ( !trigger ) { 17117 return false; 17118 } 17119 17120 data = trigger.apply( this, [ event, dx, dy ] ); 17121 17122 this._updateVirtualBoundaries( event.shiftKey ); 17123 if ( this._aspectRatio || event.shiftKey ) { 17124 data = this._updateRatio( data, event ); 17125 } 17126 17127 data = this._respectSize( data, event ); 17128 17129 this._updateCache( data ); 17130 17131 this._propagate( "resize", event ); 17132 17133 props = this._applyChanges(); 17134 17135 if ( !this._helper && this._proportionallyResizeElements.length ) { 17136 this._proportionallyResize(); 17137 } 17138 17139 if ( !$.isEmptyObject( props ) ) { 17140 this._updatePrevProperties(); 17141 this._trigger( "resize", event, this.ui() ); 17142 this._applyChanges(); 17143 } 17144 17145 return false; 17146 }, 17147 17148 _mouseStop: function( event ) { 17149 17150 this.resizing = false; 17151 var pr, ista, soffseth, soffsetw, s, left, top, 17152 o = this.options, that = this; 17153 17154 if ( this._helper ) { 17155 17156 pr = this._proportionallyResizeElements; 17157 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ); 17158 soffseth = ista && this._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height; 17159 soffsetw = ista ? 0 : that.sizeDiff.width; 17160 17161 s = { 17162 width: ( that.helper.width() - soffsetw ), 17163 height: ( that.helper.height() - soffseth ) 17164 }; 17165 left = ( parseFloat( that.element.css( "left" ) ) + 17166 ( that.position.left - that.originalPosition.left ) ) || null; 17167 top = ( parseFloat( that.element.css( "top" ) ) + 17168 ( that.position.top - that.originalPosition.top ) ) || null; 17169 17170 if ( !o.animate ) { 17171 this.element.css( $.extend( s, { top: top, left: left } ) ); 17172 } 17173 17174 that.helper.height( that.size.height ); 17175 that.helper.width( that.size.width ); 17176 17177 if ( this._helper && !o.animate ) { 17178 this._proportionallyResize(); 17179 } 17180 } 17181 17182 $( "body" ).css( "cursor", "auto" ); 17183 17184 this._removeClass( "ui-resizable-resizing" ); 17185 17186 this._propagate( "stop", event ); 17187 17188 if ( this._helper ) { 17189 this.helper.remove(); 17190 } 17191 17192 return false; 17193 17194 }, 17195 17196 _updatePrevProperties: function() { 17197 this.prevPosition = { 17198 top: this.position.top, 17199 left: this.position.left 17200 }; 17201 this.prevSize = { 17202 width: this.size.width, 17203 height: this.size.height 17204 }; 17205 }, 17206 17207 _applyChanges: function() { 17208 var props = {}; 17209 17210 if ( this.position.top !== this.prevPosition.top ) { 17211 props.top = this.position.top + "px"; 17212 } 17213 if ( this.position.left !== this.prevPosition.left ) { 17214 props.left = this.position.left + "px"; 17215 } 17216 17217 this.helper.css( props ); 17218 17219 if ( this.size.width !== this.prevSize.width ) { 17220 props.width = this.size.width + "px"; 17221 this.helper.width( props.width ); 17222 } 17223 if ( this.size.height !== this.prevSize.height ) { 17224 props.height = this.size.height + "px"; 17225 this.helper.height( props.height ); 17226 } 17227 17228 return props; 17229 }, 17230 17231 _updateVirtualBoundaries: function( forceAspectRatio ) { 17232 var pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b, 17233 o = this.options; 17234 17235 b = { 17236 minWidth: this._isNumber( o.minWidth ) ? o.minWidth : 0, 17237 maxWidth: this._isNumber( o.maxWidth ) ? o.maxWidth : Infinity, 17238 minHeight: this._isNumber( o.minHeight ) ? o.minHeight : 0, 17239 maxHeight: this._isNumber( o.maxHeight ) ? o.maxHeight : Infinity 17240 }; 17241 17242 if ( this._aspectRatio || forceAspectRatio ) { 17243 pMinWidth = b.minHeight * this.aspectRatio; 17244 pMinHeight = b.minWidth / this.aspectRatio; 17245 pMaxWidth = b.maxHeight * this.aspectRatio; 17246 pMaxHeight = b.maxWidth / this.aspectRatio; 17247 17248 if ( pMinWidth > b.minWidth ) { 17249 b.minWidth = pMinWidth; 17250 } 17251 if ( pMinHeight > b.minHeight ) { 17252 b.minHeight = pMinHeight; 17253 } 17254 if ( pMaxWidth < b.maxWidth ) { 17255 b.maxWidth = pMaxWidth; 17256 } 17257 if ( pMaxHeight < b.maxHeight ) { 17258 b.maxHeight = pMaxHeight; 17259 } 17260 } 17261 this._vBoundaries = b; 17262 }, 17263 17264 _updateCache: function( data ) { 17265 this.offset = this.helper.offset(); 17266 if ( this._isNumber( data.left ) ) { 17267 this.position.left = data.left; 17268 } 17269 if ( this._isNumber( data.top ) ) { 17270 this.position.top = data.top; 17271 } 17272 if ( this._isNumber( data.height ) ) { 17273 this.size.height = data.height; 17274 } 17275 if ( this._isNumber( data.width ) ) { 17276 this.size.width = data.width; 17277 } 17278 }, 17279 17280 _updateRatio: function( data ) { 17281 17282 var cpos = this.position, 17283 csize = this.size, 17284 a = this.axis; 17285 17286 if ( this._isNumber( data.height ) ) { 17287 data.width = ( data.height * this.aspectRatio ); 17288 } else if ( this._isNumber( data.width ) ) { 17289 data.height = ( data.width / this.aspectRatio ); 17290 } 17291 17292 if ( a === "sw" ) { 17293 data.left = cpos.left + ( csize.width - data.width ); 17294 data.top = null; 17295 } 17296 if ( a === "nw" ) { 17297 data.top = cpos.top + ( csize.height - data.height ); 17298 data.left = cpos.left + ( csize.width - data.width ); 17299 } 17300 17301 return data; 17302 }, 17303 17304 _respectSize: function( data ) { 17305 17306 var o = this._vBoundaries, 17307 a = this.axis, 17308 ismaxw = this._isNumber( data.width ) && o.maxWidth && ( o.maxWidth < data.width ), 17309 ismaxh = this._isNumber( data.height ) && o.maxHeight && ( o.maxHeight < data.height ), 17310 isminw = this._isNumber( data.width ) && o.minWidth && ( o.minWidth > data.width ), 17311 isminh = this._isNumber( data.height ) && o.minHeight && ( o.minHeight > data.height ), 17312 dw = this.originalPosition.left + this.originalSize.width, 17313 dh = this.originalPosition.top + this.originalSize.height, 17314 cw = /sw|nw|w/.test( a ), ch = /nw|ne|n/.test( a ); 17315 if ( isminw ) { 17316 data.width = o.minWidth; 17317 } 17318 if ( isminh ) { 17319 data.height = o.minHeight; 17320 } 17321 if ( ismaxw ) { 17322 data.width = o.maxWidth; 17323 } 17324 if ( ismaxh ) { 17325 data.height = o.maxHeight; 17326 } 17327 17328 if ( isminw && cw ) { 17329 data.left = dw - o.minWidth; 17330 } 17331 if ( ismaxw && cw ) { 17332 data.left = dw - o.maxWidth; 17333 } 17334 if ( isminh && ch ) { 17335 data.top = dh - o.minHeight; 17336 } 17337 if ( ismaxh && ch ) { 17338 data.top = dh - o.maxHeight; 17339 } 17340 17341 // Fixing jump error on top/left - bug #2330 17342 if ( !data.width && !data.height && !data.left && data.top ) { 17343 data.top = null; 17344 } else if ( !data.width && !data.height && !data.top && data.left ) { 17345 data.left = null; 17346 } 17347 17348 return data; 17349 }, 17350 17351 _getPaddingPlusBorderDimensions: function( element ) { 17352 var i = 0, 17353 widths = [], 17354 borders = [ 17355 element.css( "borderTopWidth" ), 17356 element.css( "borderRightWidth" ), 17357 element.css( "borderBottomWidth" ), 17358 element.css( "borderLeftWidth" ) 17359 ], 17360 paddings = [ 17361 element.css( "paddingTop" ), 17362 element.css( "paddingRight" ), 17363 element.css( "paddingBottom" ), 17364 element.css( "paddingLeft" ) 17365 ]; 17366 17367 for ( ; i < 4; i++ ) { 17368 widths[ i ] = ( parseFloat( borders[ i ] ) || 0 ); 17369 widths[ i ] += ( parseFloat( paddings[ i ] ) || 0 ); 17370 } 17371 17372 return { 17373 height: widths[ 0 ] + widths[ 2 ], 17374 width: widths[ 1 ] + widths[ 3 ] 17375 }; 17376 }, 17377 17378 _calculateAdjustedElementDimensions: function( element ) { 17379 var elWidth, elHeight, paddingBorder, 17380 ce = element.get( 0 ); 17381 17382 if ( element.css( "box-sizing" ) !== "content-box" || 17383 ( !this._hasScroll( ce ) && !this._hasScroll( ce, "left" ) ) ) { 17384 return { 17385 height: parseFloat( element.css( "height" ) ), 17386 width: parseFloat( element.css( "width" ) ) 17387 }; 17388 } 17389 17390 // Check if CSS inline styles are set and use those (usually from previous resizes) 17391 elWidth = parseFloat( ce.style.width ); 17392 elHeight = parseFloat( ce.style.height ); 17393 17394 paddingBorder = this._getPaddingPlusBorderDimensions( element ); 17395 elWidth = isNaN( elWidth ) ? 17396 this._getElementTheoreticalSize( element, paddingBorder, "width" ) : 17397 elWidth; 17398 elHeight = isNaN( elHeight ) ? 17399 this._getElementTheoreticalSize( element, paddingBorder, "height" ) : 17400 elHeight; 17401 17402 return { 17403 height: elHeight, 17404 width: elWidth 17405 }; 17406 }, 17407 17408 _getElementTheoreticalSize: function( element, extraSize, dimension ) { 17409 17410 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 17411 var size = Math.max( 0, Math.ceil( 17412 element.get( 0 )[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 17413 extraSize[ dimension ] - 17414 0.5 17415 17416 // If offsetWidth/offsetHeight is unknown, then we can't determine theoretical size. 17417 // Use an explicit zero to avoid NaN. 17418 // See https://github.com/jquery/jquery/issues/3964 17419 ) ) || 0; 17420 17421 return size; 17422 }, 17423 17424 _proportionallyResize: function() { 17425 17426 if ( !this._proportionallyResizeElements.length ) { 17427 return; 17428 } 17429 17430 var prel, 17431 i = 0, 17432 element = this.helper || this.element; 17433 17434 for ( ; i < this._proportionallyResizeElements.length; i++ ) { 17435 17436 prel = this._proportionallyResizeElements[ i ]; 17437 17438 // TODO: Seems like a bug to cache this.outerDimensions 17439 // considering that we are in a loop. 17440 if ( !this.outerDimensions ) { 17441 this.outerDimensions = this._getPaddingPlusBorderDimensions( prel ); 17442 } 17443 17444 prel.css( { 17445 height: ( element.height() - this.outerDimensions.height ) || 0, 17446 width: ( element.width() - this.outerDimensions.width ) || 0 17447 } ); 17448 17449 } 17450 17451 }, 17452 17453 _renderProxy: function() { 17454 17455 var el = this.element, o = this.options; 17456 this.elementOffset = el.offset(); 17457 17458 if ( this._helper ) { 17459 17460 this.helper = this.helper || $( "<div></div>" ).css( { overflow: "hidden" } ); 17461 17462 this._addClass( this.helper, this._helper ); 17463 this.helper.css( { 17464 width: this.element.outerWidth(), 17465 height: this.element.outerHeight(), 17466 position: "absolute", 17467 left: this.elementOffset.left + "px", 17468 top: this.elementOffset.top + "px", 17469 zIndex: ++o.zIndex //TODO: Don't modify option 17470 } ); 17471 17472 this.helper 17473 .appendTo( "body" ) 17474 .disableSelection(); 17475 17476 } else { 17477 this.helper = this.element; 17478 } 17479 17480 }, 17481 17482 _change: { 17483 e: function( event, dx ) { 17484 return { width: this.originalSize.width + dx }; 17485 }, 17486 w: function( event, dx ) { 17487 var cs = this.originalSize, sp = this.originalPosition; 17488 return { left: sp.left + dx, width: cs.width - dx }; 17489 }, 17490 n: function( event, dx, dy ) { 17491 var cs = this.originalSize, sp = this.originalPosition; 17492 return { top: sp.top + dy, height: cs.height - dy }; 17493 }, 17494 s: function( event, dx, dy ) { 17495 return { height: this.originalSize.height + dy }; 17496 }, 17497 se: function( event, dx, dy ) { 17498 return $.extend( this._change.s.apply( this, arguments ), 17499 this._change.e.apply( this, [ event, dx, dy ] ) ); 17500 }, 17501 sw: function( event, dx, dy ) { 17502 return $.extend( this._change.s.apply( this, arguments ), 17503 this._change.w.apply( this, [ event, dx, dy ] ) ); 17504 }, 17505 ne: function( event, dx, dy ) { 17506 return $.extend( this._change.n.apply( this, arguments ), 17507 this._change.e.apply( this, [ event, dx, dy ] ) ); 17508 }, 17509 nw: function( event, dx, dy ) { 17510 return $.extend( this._change.n.apply( this, arguments ), 17511 this._change.w.apply( this, [ event, dx, dy ] ) ); 17512 } 17513 }, 17514 17515 _propagate: function( n, event ) { 17516 $.ui.plugin.call( this, n, [ event, this.ui() ] ); 17517 if ( n !== "resize" ) { 17518 this._trigger( n, event, this.ui() ); 17519 } 17520 }, 17521 17522 plugins: {}, 17523 17524 ui: function() { 17525 return { 17526 originalElement: this.originalElement, 17527 element: this.element, 17528 helper: this.helper, 17529 position: this.position, 17530 size: this.size, 17531 originalSize: this.originalSize, 17532 originalPosition: this.originalPosition 17533 }; 17534 } 17535 17536} ); 17537 17538/* 17539 * Resizable Extensions 17540 */ 17541 17542$.ui.plugin.add( "resizable", "animate", { 17543 17544 stop: function( event ) { 17545 var that = $( this ).resizable( "instance" ), 17546 o = that.options, 17547 pr = that._proportionallyResizeElements, 17548 ista = pr.length && ( /textarea/i ).test( pr[ 0 ].nodeName ), 17549 soffseth = ista && that._hasScroll( pr[ 0 ], "left" ) ? 0 : that.sizeDiff.height, 17550 soffsetw = ista ? 0 : that.sizeDiff.width, 17551 style = { 17552 width: ( that.size.width - soffsetw ), 17553 height: ( that.size.height - soffseth ) 17554 }, 17555 left = ( parseFloat( that.element.css( "left" ) ) + 17556 ( that.position.left - that.originalPosition.left ) ) || null, 17557 top = ( parseFloat( that.element.css( "top" ) ) + 17558 ( that.position.top - that.originalPosition.top ) ) || null; 17559 17560 that.element.animate( 17561 $.extend( style, top && left ? { top: top, left: left } : {} ), { 17562 duration: o.animateDuration, 17563 easing: o.animateEasing, 17564 step: function() { 17565 17566 var data = { 17567 width: parseFloat( that.element.css( "width" ) ), 17568 height: parseFloat( that.element.css( "height" ) ), 17569 top: parseFloat( that.element.css( "top" ) ), 17570 left: parseFloat( that.element.css( "left" ) ) 17571 }; 17572 17573 if ( pr && pr.length ) { 17574 $( pr[ 0 ] ).css( { width: data.width, height: data.height } ); 17575 } 17576 17577 // Propagating resize, and updating values for each animation step 17578 that._updateCache( data ); 17579 that._propagate( "resize", event ); 17580 17581 } 17582 } 17583 ); 17584 } 17585 17586} ); 17587 17588$.ui.plugin.add( "resizable", "containment", { 17589 17590 start: function() { 17591 var element, p, co, ch, cw, width, height, 17592 that = $( this ).resizable( "instance" ), 17593 o = that.options, 17594 el = that.element, 17595 oc = o.containment, 17596 ce = ( oc instanceof $ ) ? 17597 oc.get( 0 ) : 17598 ( /parent/.test( oc ) ) ? el.parent().get( 0 ) : oc; 17599 17600 if ( !ce ) { 17601 return; 17602 } 17603 17604 that.containerElement = $( ce ); 17605 17606 if ( /document/.test( oc ) || oc === document ) { 17607 that.containerOffset = { 17608 left: 0, 17609 top: 0 17610 }; 17611 that.containerPosition = { 17612 left: 0, 17613 top: 0 17614 }; 17615 17616 that.parentData = { 17617 element: $( document ), 17618 left: 0, 17619 top: 0, 17620 width: $( document ).width(), 17621 height: $( document ).height() || document.body.parentNode.scrollHeight 17622 }; 17623 } else { 17624 element = $( ce ); 17625 p = []; 17626 $( [ "Top", "Right", "Left", "Bottom" ] ).each( function( i, name ) { 17627 p[ i ] = that._num( element.css( "padding" + name ) ); 17628 } ); 17629 17630 that.containerOffset = element.offset(); 17631 that.containerPosition = element.position(); 17632 that.containerSize = { 17633 height: ( element.innerHeight() - p[ 3 ] ), 17634 width: ( element.innerWidth() - p[ 1 ] ) 17635 }; 17636 17637 co = that.containerOffset; 17638 ch = that.containerSize.height; 17639 cw = that.containerSize.width; 17640 width = ( that._hasScroll( ce, "left" ) ? ce.scrollWidth : cw ); 17641 height = ( that._hasScroll( ce ) ? ce.scrollHeight : ch ); 17642 17643 that.parentData = { 17644 element: ce, 17645 left: co.left, 17646 top: co.top, 17647 width: width, 17648 height: height 17649 }; 17650 } 17651 }, 17652 17653 resize: function( event ) { 17654 var woset, hoset, isParent, isOffsetRelative, 17655 that = $( this ).resizable( "instance" ), 17656 o = that.options, 17657 co = that.containerOffset, 17658 cp = that.position, 17659 pRatio = that._aspectRatio || event.shiftKey, 17660 cop = { 17661 top: 0, 17662 left: 0 17663 }, 17664 ce = that.containerElement, 17665 continueResize = true; 17666 17667 if ( ce[ 0 ] !== document && ( /static/ ).test( ce.css( "position" ) ) ) { 17668 cop = co; 17669 } 17670 17671 if ( cp.left < ( that._helper ? co.left : 0 ) ) { 17672 that.size.width = that.size.width + 17673 ( that._helper ? 17674 ( that.position.left - co.left ) : 17675 ( that.position.left - cop.left ) ); 17676 17677 if ( pRatio ) { 17678 that.size.height = that.size.width / that.aspectRatio; 17679 continueResize = false; 17680 } 17681 that.position.left = o.helper ? co.left : 0; 17682 } 17683 17684 if ( cp.top < ( that._helper ? co.top : 0 ) ) { 17685 that.size.height = that.size.height + 17686 ( that._helper ? 17687 ( that.position.top - co.top ) : 17688 that.position.top ); 17689 17690 if ( pRatio ) { 17691 that.size.width = that.size.height * that.aspectRatio; 17692 continueResize = false; 17693 } 17694 that.position.top = that._helper ? co.top : 0; 17695 } 17696 17697 isParent = that.containerElement.get( 0 ) === that.element.parent().get( 0 ); 17698 isOffsetRelative = /relative|absolute/.test( that.containerElement.css( "position" ) ); 17699 17700 if ( isParent && isOffsetRelative ) { 17701 that.offset.left = that.parentData.left + that.position.left; 17702 that.offset.top = that.parentData.top + that.position.top; 17703 } else { 17704 that.offset.left = that.element.offset().left; 17705 that.offset.top = that.element.offset().top; 17706 } 17707 17708 woset = Math.abs( that.sizeDiff.width + 17709 ( that._helper ? 17710 that.offset.left - cop.left : 17711 ( that.offset.left - co.left ) ) ); 17712 17713 hoset = Math.abs( that.sizeDiff.height + 17714 ( that._helper ? 17715 that.offset.top - cop.top : 17716 ( that.offset.top - co.top ) ) ); 17717 17718 if ( woset + that.size.width >= that.parentData.width ) { 17719 that.size.width = that.parentData.width - woset; 17720 if ( pRatio ) { 17721 that.size.height = that.size.width / that.aspectRatio; 17722 continueResize = false; 17723 } 17724 } 17725 17726 if ( hoset + that.size.height >= that.parentData.height ) { 17727 that.size.height = that.parentData.height - hoset; 17728 if ( pRatio ) { 17729 that.size.width = that.size.height * that.aspectRatio; 17730 continueResize = false; 17731 } 17732 } 17733 17734 if ( !continueResize ) { 17735 that.position.left = that.prevPosition.left; 17736 that.position.top = that.prevPosition.top; 17737 that.size.width = that.prevSize.width; 17738 that.size.height = that.prevSize.height; 17739 } 17740 }, 17741 17742 stop: function() { 17743 var that = $( this ).resizable( "instance" ), 17744 o = that.options, 17745 co = that.containerOffset, 17746 cop = that.containerPosition, 17747 ce = that.containerElement, 17748 helper = $( that.helper ), 17749 ho = helper.offset(), 17750 w = helper.outerWidth() - that.sizeDiff.width, 17751 h = helper.outerHeight() - that.sizeDiff.height; 17752 17753 if ( that._helper && !o.animate && ( /relative/ ).test( ce.css( "position" ) ) ) { 17754 $( this ).css( { 17755 left: ho.left - cop.left - co.left, 17756 width: w, 17757 height: h 17758 } ); 17759 } 17760 17761 if ( that._helper && !o.animate && ( /static/ ).test( ce.css( "position" ) ) ) { 17762 $( this ).css( { 17763 left: ho.left - cop.left - co.left, 17764 width: w, 17765 height: h 17766 } ); 17767 } 17768 } 17769} ); 17770 17771$.ui.plugin.add( "resizable", "alsoResize", { 17772 17773 start: function() { 17774 var that = $( this ).resizable( "instance" ), 17775 o = that.options; 17776 17777 $( o.alsoResize ).each( function() { 17778 var el = $( this ), 17779 elSize = that._calculateAdjustedElementDimensions( el ); 17780 17781 el.data( "ui-resizable-alsoresize", { 17782 width: elSize.width, height: elSize.height, 17783 left: parseFloat( el.css( "left" ) ), top: parseFloat( el.css( "top" ) ) 17784 } ); 17785 } ); 17786 }, 17787 17788 resize: function( event, ui ) { 17789 var that = $( this ).resizable( "instance" ), 17790 o = that.options, 17791 os = that.originalSize, 17792 op = that.originalPosition, 17793 delta = { 17794 height: ( that.size.height - os.height ) || 0, 17795 width: ( that.size.width - os.width ) || 0, 17796 top: ( that.position.top - op.top ) || 0, 17797 left: ( that.position.left - op.left ) || 0 17798 }; 17799 17800 $( o.alsoResize ).each( function() { 17801 var el = $( this ), start = $( this ).data( "ui-resizable-alsoresize" ), style = {}, 17802 css = el.parents( ui.originalElement[ 0 ] ).length ? 17803 [ "width", "height" ] : 17804 [ "width", "height", "top", "left" ]; 17805 17806 $.each( css, function( i, prop ) { 17807 var sum = ( start[ prop ] || 0 ) + ( delta[ prop ] || 0 ); 17808 if ( sum && sum >= 0 ) { 17809 style[ prop ] = sum || null; 17810 } 17811 } ); 17812 17813 el.css( style ); 17814 } ); 17815 }, 17816 17817 stop: function() { 17818 $( this ).removeData( "ui-resizable-alsoresize" ); 17819 } 17820} ); 17821 17822$.ui.plugin.add( "resizable", "ghost", { 17823 17824 start: function() { 17825 17826 var that = $( this ).resizable( "instance" ), cs = that.size; 17827 17828 that.ghost = that.originalElement.clone(); 17829 that.ghost.css( { 17830 opacity: 0.25, 17831 display: "block", 17832 position: "relative", 17833 height: cs.height, 17834 width: cs.width, 17835 margin: 0, 17836 left: 0, 17837 top: 0 17838 } ); 17839 17840 that._addClass( that.ghost, "ui-resizable-ghost" ); 17841 17842 // DEPRECATED 17843 // TODO: remove after 1.12 17844 if ( $.uiBackCompat === true && typeof that.options.ghost === "string" ) { 17845 17846 // Ghost option 17847 that.ghost.addClass( this.options.ghost ); 17848 } 17849 17850 that.ghost.appendTo( that.helper ); 17851 17852 }, 17853 17854 resize: function() { 17855 var that = $( this ).resizable( "instance" ); 17856 if ( that.ghost ) { 17857 that.ghost.css( { 17858 position: "relative", 17859 height: that.size.height, 17860 width: that.size.width 17861 } ); 17862 } 17863 }, 17864 17865 stop: function() { 17866 var that = $( this ).resizable( "instance" ); 17867 if ( that.ghost && that.helper ) { 17868 that.helper.get( 0 ).removeChild( that.ghost.get( 0 ) ); 17869 } 17870 } 17871 17872} ); 17873 17874$.ui.plugin.add( "resizable", "grid", { 17875 17876 resize: function() { 17877 var outerDimensions, 17878 that = $( this ).resizable( "instance" ), 17879 o = that.options, 17880 cs = that.size, 17881 os = that.originalSize, 17882 op = that.originalPosition, 17883 a = that.axis, 17884 grid = typeof o.grid === "number" ? [ o.grid, o.grid ] : o.grid, 17885 gridX = ( grid[ 0 ] || 1 ), 17886 gridY = ( grid[ 1 ] || 1 ), 17887 ox = Math.round( ( cs.width - os.width ) / gridX ) * gridX, 17888 oy = Math.round( ( cs.height - os.height ) / gridY ) * gridY, 17889 newWidth = os.width + ox, 17890 newHeight = os.height + oy, 17891 isMaxWidth = o.maxWidth && ( o.maxWidth < newWidth ), 17892 isMaxHeight = o.maxHeight && ( o.maxHeight < newHeight ), 17893 isMinWidth = o.minWidth && ( o.minWidth > newWidth ), 17894 isMinHeight = o.minHeight && ( o.minHeight > newHeight ); 17895 17896 o.grid = grid; 17897 17898 if ( isMinWidth ) { 17899 newWidth += gridX; 17900 } 17901 if ( isMinHeight ) { 17902 newHeight += gridY; 17903 } 17904 if ( isMaxWidth ) { 17905 newWidth -= gridX; 17906 } 17907 if ( isMaxHeight ) { 17908 newHeight -= gridY; 17909 } 17910 17911 if ( /^(se|s|e)$/.test( a ) ) { 17912 that.size.width = newWidth; 17913 that.size.height = newHeight; 17914 } else if ( /^(ne)$/.test( a ) ) { 17915 that.size.width = newWidth; 17916 that.size.height = newHeight; 17917 that.position.top = op.top - oy; 17918 } else if ( /^(sw)$/.test( a ) ) { 17919 that.size.width = newWidth; 17920 that.size.height = newHeight; 17921 that.position.left = op.left - ox; 17922 } else { 17923 if ( newHeight - gridY <= 0 || newWidth - gridX <= 0 ) { 17924 outerDimensions = that._getPaddingPlusBorderDimensions( this ); 17925 } 17926 17927 if ( newHeight - gridY > 0 ) { 17928 that.size.height = newHeight; 17929 that.position.top = op.top - oy; 17930 } else { 17931 newHeight = gridY - outerDimensions.height; 17932 that.size.height = newHeight; 17933 that.position.top = op.top + os.height - newHeight; 17934 } 17935 if ( newWidth - gridX > 0 ) { 17936 that.size.width = newWidth; 17937 that.position.left = op.left - ox; 17938 } else { 17939 newWidth = gridX - outerDimensions.width; 17940 that.size.width = newWidth; 17941 that.position.left = op.left + os.width - newWidth; 17942 } 17943 } 17944 } 17945 17946} ); 17947
17948return $.ui.resizable; 17949 17950} ); 17951 17952 17953/*! 17954 * jQuery UI Focusable 1.14.2 17955 * https://jqueryui.com 17956 * 17957 * Copyright OpenJS Foundation and other contributors 17958 * Released under the MIT license. 17959 * https://jquery.org/license 17960 */ 17961 17962//>>label: :focusable Selector 17963//>>group: Core 17964//>>description: Selects elements which can be focused. 17965//>>docs: https://api.jqueryui.com/focusable-selector/ 17966 17967( function( factory ) { 17968 "use strict"; 17969 17970 if ( typeof define === "function" && define.amd ) { 17971 17972 // AMD. Register as an anonymous module. 17973 define( [ "jquery", "./version" ], factory ); 17974 } else { 17975 17976 // Browser globals 17977 factory( jQuery ); 17978 } 17979} )( function( $ ) { 17980"use strict"; 17981 17982// Selectors 17983$.ui.focusable = function( element, hasTabindex ) { 17984 var map, mapName, img, focusableIfVisible, fieldset, 17985 nodeName = element.nodeName.toLowerCase(); 17986 17987 if ( "area" === nodeName ) { 17988 map = element.parentNode; 17989 mapName = map.name; 17990 if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { 17991 return false; 17992 } 17993 img = $( "img[usemap='#" + mapName + "']" ); 17994 return img.length > 0 && img.is( ":visible" ); 17995 } 17996 17997 if ( /^(input|select|textarea|button|object)$/.test( nodeName ) ) { 17998 focusableIfVisible = !element.disabled; 17999 18000 if ( focusableIfVisible ) { 18001 18002 // Form controls within a disabled fieldset are disabled. 18003 // However, controls within the fieldset's legend do not get disabled. 18004 // Since controls generally aren't placed inside legends, we skip 18005 // this portion of the check. 18006 fieldset = $( element ).closest( "fieldset" )[ 0 ]; 18007 if ( fieldset ) { 18008 focusableIfVisible = !fieldset.disabled; 18009 } 18010 } 18011 } else if ( "a" === nodeName ) { 18012 focusableIfVisible = element.href || hasTabindex; 18013 } else { 18014 focusableIfVisible = hasTabindex; 18015 } 18016 18017 return focusableIfVisible && $( element ).is( ":visible" ) && 18018 $( element ).css( "visibility" ) === "visible"; 18019}; 18020 18021$.extend( $.expr.pseudos, {
vendor: 4,317 bytes, lines 18022-18190
18022 focusable: function( element ) { 18023 return $.ui.focusable( element, $.attr( element, "tabindex" ) != null ); 18024 } 18025} ); 18026 18027return $.ui.focusable; 18028 18029} ); 18030 18031 18032/*! 18033 * jQuery UI Position 1.14.2 18034 * https://jqueryui.com 18035 * 18036 * Copyright OpenJS Foundation and other contributors 18037 * Released under the MIT license. 18038 * https://jquery.org/license 18039 * 18040 * https://api.jqueryui.com/position/ 18041 */ 18042 18043//>>label: Position 18044//>>group: Core 18045//>>description: Positions elements relative to other elements. 18046//>>docs: https://api.jqueryui.com/position/ 18047//>>demos: https://jqueryui.com/position/ 18048 18049( function( factory ) { 18050 "use strict"; 18051 18052 if ( typeof define === "function" && define.amd ) { 18053 18054 // AMD. Register as an anonymous module. 18055 define( [ "jquery", "./version" ], factory ); 18056 } else { 18057 18058 // Browser globals 18059 factory( jQuery ); 18060 } 18061} )( function( $ ) { 18062"use strict"; 18063 18064( function() { 18065var cachedScrollbarWidth, 18066 max = Math.max, 18067 abs = Math.abs, 18068 rhorizontal = /left|center|right/, 18069 rvertical = /top|center|bottom/, 18070 roffset = /[\+\-]\d+(\.[\d]+)?%?/, 18071 rposition = /^\w+/, 18072 rpercent = /%$/, 18073 _position = $.fn.position; 18074 18075function getOffsets( offsets, width, height ) { 18076 return [ 18077 parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), 18078 parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) 18079 ]; 18080} 18081 18082function parseCss( element, property ) { 18083 return parseInt( $.css( element, property ), 10 ) || 0; 18084} 18085 18086function isWindow( obj ) { 18087 return obj != null && obj === obj.window; 18088} 18089 18090function getDimensions( elem ) { 18091 var raw = elem[ 0 ]; 18092 if ( raw.nodeType === 9 ) { 18093 return { 18094 width: elem.width(), 18095 height: elem.height(), 18096 offset: { top: 0, left: 0 } 18097 }; 18098 } 18099 if ( isWindow( raw ) ) { 18100 return { 18101 width: elem.width(), 18102 height: elem.height(), 18103 offset: { top: elem.scrollTop(), left: elem.scrollLeft() } 18104 }; 18105 } 18106 if ( raw.preventDefault ) { 18107 return { 18108 width: 0, 18109 height: 0, 18110 offset: { top: raw.pageY, left: raw.pageX } 18111 }; 18112 } 18113 return { 18114 width: elem.outerWidth(), 18115 height: elem.outerHeight(), 18116 offset: elem.offset() 18117 }; 18118} 18119 18120$.position = { 18121 scrollbarWidth: function() { 18122 if ( cachedScrollbarWidth !== undefined ) { 18123 return cachedScrollbarWidth; 18124 } 18125 var w1, w2, 18126 div = $( "<div style=" + 18127 "'display:block;position:absolute;width:200px;height:200px;overflow:hidden;'>" + 18128 "<div style='height:300px;width:auto;'></div></div>" ), 18129 innerDiv = div.children()[ 0 ]; 18130 18131 $( "body" ).append( div ); 18132 w1 = innerDiv.offsetWidth; 18133 div.css( "overflow", "scroll" ); 18134 18135 w2 = innerDiv.offsetWidth; 18136 18137 if ( w1 === w2 ) { 18138 w2 = div[ 0 ].clientWidth; 18139 } 18140 18141 div.remove(); 18142 18143 return ( cachedScrollbarWidth = w1 - w2 ); 18144 }, 18145 getScrollInfo: function( within ) { 18146 var overflowX = within.isWindow || within.isDocument ? "" : 18147 within.element.css( "overflow-x" ), 18148 overflowY = within.isWindow || within.isDocument ? "" : 18149 within.element.css( "overflow-y" ), 18150 hasOverflowX = overflowX === "scroll" || 18151 ( overflowX === "auto" && within.width < within.element[ 0 ].scrollWidth ), 18152 hasOverflowY = overflowY === "scroll" || 18153 ( overflowY === "auto" && within.height < within.element[ 0 ].scrollHeight ); 18154 return { 18155 width: hasOverflowY ? $.position.scrollbarWidth() : 0, 18156 height: hasOverflowX ? $.position.scrollbarWidth() : 0 18157 }; 18158 }, 18159 getWithinInfo: function( element ) { 18160 var withinElement = $( element || window ), 18161 isElemWindow = isWindow( withinElement[ 0 ] ), 18162 isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9, 18163 hasOffset = !isElemWindow && !isDocument; 18164 return { 18165 element: withinElement, 18166 isWindow: isElemWindow, 18167 isDocument: isDocument, 18168 offset: hasOffset ? $( element ).offset() : { left: 0, top: 0 }, 18169 scrollLeft: withinElement.scrollLeft(), 18170 scrollTop: withinElement.scrollTop(), 18171 width: withinElement.outerWidth(), 18172 height: withinElement.outerHeight() 18173 }; 18174 } 18175}; 18176 18177$.fn.position = function( options ) { 18178 if ( !options || !options.of ) { 18179 return _position.apply( this, arguments ); 18180 } 18181 18182 // Make a copy, we don't want to modify arguments 18183 options = $.extend( {}, options ); 18184 18185 var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, 18186 18187 // Make sure string options are treated as CSS selectors 18188 target = typeof options.of === "string" ? 18189 $( document ).find( options.of ) : 18190 $( options.of ),
vendor: 10,934 bytes, lines 18191-18539
18191 18192 within = $.position.getWithinInfo( options.within ), 18193 scrollInfo = $.position.getScrollInfo( within ), 18194 collision = ( options.collision || "flip" ).split( " " ), 18195 offsets = {}; 18196 18197 dimensions = getDimensions( target ); 18198 if ( target[ 0 ].preventDefault ) { 18199 18200 // Force left top to allow flipping 18201 options.at = "left top"; 18202 } 18203 targetWidth = dimensions.width; 18204 targetHeight = dimensions.height; 18205 targetOffset = dimensions.offset; 18206 18207 // Clone to reuse original targetOffset later 18208 basePosition = $.extend( {}, targetOffset ); 18209 18210 // Force my and at to have valid horizontal and vertical positions 18211 // if a value is missing or invalid, it will be converted to center 18212 $.each( [ "my", "at" ], function() { 18213 var pos = ( options[ this ] || "" ).split( " " ), 18214 horizontalOffset, 18215 verticalOffset; 18216 18217 if ( pos.length === 1 ) { 18218 pos = rhorizontal.test( pos[ 0 ] ) ? 18219 pos.concat( [ "center" ] ) : 18220 rvertical.test( pos[ 0 ] ) ? 18221 [ "center" ].concat( pos ) : 18222 [ "center", "center" ]; 18223 } 18224 pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; 18225 pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; 18226 18227 // Calculate offsets 18228 horizontalOffset = roffset.exec( pos[ 0 ] ); 18229 verticalOffset = roffset.exec( pos[ 1 ] ); 18230 offsets[ this ] = [ 18231 horizontalOffset ? horizontalOffset[ 0 ] : 0, 18232 verticalOffset ? verticalOffset[ 0 ] : 0 18233 ]; 18234 18235 // Reduce to just the positions without the offsets 18236 options[ this ] = [ 18237 rposition.exec( pos[ 0 ] )[ 0 ], 18238 rposition.exec( pos[ 1 ] )[ 0 ] 18239 ]; 18240 } ); 18241 18242 // Normalize collision option 18243 if ( collision.length === 1 ) { 18244 collision[ 1 ] = collision[ 0 ]; 18245 } 18246 18247 if ( options.at[ 0 ] === "right" ) { 18248 basePosition.left += targetWidth; 18249 } else if ( options.at[ 0 ] === "center" ) { 18250 basePosition.left += targetWidth / 2; 18251 } 18252 18253 if ( options.at[ 1 ] === "bottom" ) { 18254 basePosition.top += targetHeight; 18255 } else if ( options.at[ 1 ] === "center" ) { 18256 basePosition.top += targetHeight / 2; 18257 } 18258 18259 atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); 18260 basePosition.left += atOffset[ 0 ]; 18261 basePosition.top += atOffset[ 1 ]; 18262 18263 return this.each( function() { 18264 var collisionPosition, using, 18265 elem = $( this ), 18266 elemWidth = elem.outerWidth(), 18267 elemHeight = elem.outerHeight(), 18268 marginLeft = parseCss( this, "marginLeft" ), 18269 marginTop = parseCss( this, "marginTop" ), 18270 collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + 18271 scrollInfo.width, 18272 collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + 18273 scrollInfo.height, 18274 position = $.extend( {}, basePosition ), 18275 myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); 18276 18277 if ( options.my[ 0 ] === "right" ) { 18278 position.left -= elemWidth; 18279 } else if ( options.my[ 0 ] === "center" ) { 18280 position.left -= elemWidth / 2; 18281 } 18282 18283 if ( options.my[ 1 ] === "bottom" ) { 18284 position.top -= elemHeight; 18285 } else if ( options.my[ 1 ] === "center" ) { 18286 position.top -= elemHeight / 2; 18287 } 18288 18289 position.left += myOffset[ 0 ]; 18290 position.top += myOffset[ 1 ]; 18291 18292 collisionPosition = { 18293 marginLeft: marginLeft, 18294 marginTop: marginTop 18295 }; 18296 18297 $.each( [ "left", "top" ], function( i, dir ) { 18298 if ( $.ui.position[ collision[ i ] ] ) { 18299 $.ui.position[ collision[ i ] ][ dir ]( position, { 18300 targetWidth: targetWidth, 18301 targetHeight: targetHeight, 18302 elemWidth: elemWidth, 18303 elemHeight: elemHeight, 18304 collisionPosition: collisionPosition, 18305 collisionWidth: collisionWidth, 18306 collisionHeight: collisionHeight, 18307 offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], 18308 my: options.my, 18309 at: options.at, 18310 within: within, 18311 elem: elem 18312 } ); 18313 } 18314 } ); 18315 18316 if ( options.using ) { 18317 18318 // Adds feedback as second argument to using callback, if present 18319 using = function( props ) { 18320 var left = targetOffset.left - position.left, 18321 right = left + targetWidth - elemWidth, 18322 top = targetOffset.top - position.top, 18323 bottom = top + targetHeight - elemHeight, 18324 feedback = { 18325 target: { 18326 element: target, 18327 left: targetOffset.left, 18328 top: targetOffset.top, 18329 width: targetWidth, 18330 height: targetHeight 18331 }, 18332 element: { 18333 element: elem, 18334 left: position.left, 18335 top: position.top, 18336 width: elemWidth, 18337 height: elemHeight 18338 }, 18339 horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", 18340 vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" 18341 }; 18342 if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { 18343 feedback.horizontal = "center"; 18344 } 18345 if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { 18346 feedback.vertical = "middle"; 18347 } 18348 if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { 18349 feedback.important = "horizontal"; 18350 } else { 18351 feedback.important = "vertical"; 18352 } 18353 options.using.call( this, props, feedback ); 18354 }; 18355 } 18356 18357 elem.offset( $.extend( position, { using: using } ) ); 18358 } ); 18359}; 18360 18361$.ui.position = { 18362 fit: { 18363 left: function( position, data ) { 18364 var within = data.within, 18365 withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, 18366 outerWidth = within.width, 18367 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 18368 overLeft = withinOffset - collisionPosLeft, 18369 overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, 18370 newOverRight; 18371 18372 // Element is wider than within 18373 if ( data.collisionWidth > outerWidth ) { 18374 18375 // Element is initially over the left side of within 18376 if ( overLeft > 0 && overRight <= 0 ) { 18377 newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - 18378 withinOffset; 18379 position.left += overLeft - newOverRight; 18380 18381 // Element is initially over right side of within 18382 } else if ( overRight > 0 && overLeft <= 0 ) { 18383 position.left = withinOffset; 18384 18385 // Element is initially over both left and right sides of within 18386 } else { 18387 if ( overLeft > overRight ) { 18388 position.left = withinOffset + outerWidth - data.collisionWidth; 18389 } else { 18390 position.left = withinOffset; 18391 } 18392 } 18393 18394 // Too far left -> align with left edge 18395 } else if ( overLeft > 0 ) { 18396 position.left += overLeft; 18397 18398 // Too far right -> align with right edge 18399 } else if ( overRight > 0 ) { 18400 position.left -= overRight; 18401 18402 // Adjust based on position and margin 18403 } else { 18404 position.left = max( position.left - collisionPosLeft, position.left ); 18405 } 18406 }, 18407 top: function( position, data ) { 18408 var within = data.within, 18409 withinOffset = within.isWindow ? within.scrollTop : within.offset.top, 18410 outerHeight = data.within.height, 18411 collisionPosTop = position.top - data.collisionPosition.marginTop, 18412 overTop = withinOffset - collisionPosTop, 18413 overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, 18414 newOverBottom; 18415 18416 // Element is taller than within 18417 if ( data.collisionHeight > outerHeight ) { 18418 18419 // Element is initially over the top of within 18420 if ( overTop > 0 && overBottom <= 0 ) { 18421 newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - 18422 withinOffset; 18423 position.top += overTop - newOverBottom; 18424 18425 // Element is initially over bottom of within 18426 } else if ( overBottom > 0 && overTop <= 0 ) { 18427 position.top = withinOffset; 18428 18429 // Element is initially over both top and bottom of within 18430 } else { 18431 if ( overTop > overBottom ) { 18432 position.top = withinOffset + outerHeight - data.collisionHeight; 18433 } else { 18434 position.top = withinOffset; 18435 } 18436 } 18437 18438 // Too far up -> align with top 18439 } else if ( overTop > 0 ) { 18440 position.top += overTop; 18441 18442 // Too far down -> align with bottom edge 18443 } else if ( overBottom > 0 ) { 18444 position.top -= overBottom; 18445 18446 // Adjust based on position and margin 18447 } else { 18448 position.top = max( position.top - collisionPosTop, position.top ); 18449 } 18450 } 18451 }, 18452 flip: { 18453 left: function( position, data ) { 18454 var within = data.within, 18455 withinOffset = within.offset.left + within.scrollLeft, 18456 outerWidth = within.width, 18457 offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, 18458 collisionPosLeft = position.left - data.collisionPosition.marginLeft, 18459 overLeft = collisionPosLeft - offsetLeft, 18460 overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, 18461 myOffset = data.my[ 0 ] === "left" ? 18462 -data.elemWidth : 18463 data.my[ 0 ] === "right" ? 18464 data.elemWidth : 18465 0, 18466 atOffset = data.at[ 0 ] === "left" ? 18467 data.targetWidth : 18468 data.at[ 0 ] === "right" ? 18469 -data.targetWidth : 18470 0, 18471 offset = -2 * data.offset[ 0 ], 18472 newOverRight, 18473 newOverLeft; 18474 18475 if ( overLeft < 0 ) { 18476 newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - 18477 outerWidth - withinOffset; 18478 if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { 18479 position.left += myOffset + atOffset + offset; 18480 } 18481 } else if ( overRight > 0 ) { 18482 newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + 18483 atOffset + offset - offsetLeft; 18484 if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { 18485 position.left += myOffset + atOffset + offset; 18486 } 18487 } 18488 }, 18489 top: function( position, data ) { 18490 var within = data.within, 18491 withinOffset = within.offset.top + within.scrollTop, 18492 outerHeight = within.height, 18493 offsetTop = within.isWindow ? within.scrollTop : within.offset.top, 18494 collisionPosTop = position.top - data.collisionPosition.marginTop, 18495 overTop = collisionPosTop - offsetTop, 18496 overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, 18497 top = data.my[ 1 ] === "top", 18498 myOffset = top ? 18499 -data.elemHeight : 18500 data.my[ 1 ] === "bottom" ? 18501 data.elemHeight : 18502 0, 18503 atOffset = data.at[ 1 ] === "top" ? 18504 data.targetHeight : 18505 data.at[ 1 ] === "bottom" ? 18506 -data.targetHeight : 18507 0, 18508 offset = -2 * data.offset[ 1 ], 18509 newOverTop, 18510 newOverBottom; 18511 if ( overTop < 0 ) { 18512 newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - 18513 outerHeight - withinOffset; 18514 if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) { 18515 position.top += myOffset + atOffset + offset; 18516 } 18517 } else if ( overBottom > 0 ) { 18518 newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + 18519 offset - offsetTop; 18520 if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) { 18521 position.top += myOffset + atOffset + offset; 18522 } 18523 } 18524 } 18525 }, 18526 flipfit: { 18527 left: function() { 18528 $.ui.position.flip.left.apply( this, arguments ); 18529 $.ui.position.fit.left.apply( this, arguments ); 18530 }, 18531 top: function() { 18532 $.ui.position.flip.top.apply( this, arguments ); 18533 $.ui.position.fit.top.apply( this, arguments ); 18534 } 18535 } 18536}; 18537 18538} )(); 18539
18540return $.ui.position; 18541 18542} ); 18543 18544 18545 18546/*! 18547 * jQuery UI Tabbable 1.14.2 18548 * https://jqueryui.com 18549 * 18550 * Copyright OpenJS Foundation and other contributors 18551 * Released under the MIT license. 18552 * https://jquery.org/license 18553 */ 18554 18555//>>label: :tabbable Selector
18556//>>group: Core 18557//>>description: Selects elements which can be tabbed to. 18558//>>docs: https://api.jqueryui.com/tabbable-selector/ 18559 18560( function( factory ) { 18561 "use strict"; 18562 18563 if ( typeof define === "function" && define.amd ) { 18564 18565 // AMD. Register as an anonymous module. 18566 define( [ "jquery", "./version", "./focusable" ], factory ); 18567 } else { 18568 18569 // Browser globals 18570 factory( jQuery ); 18571 } 18572} )( function( $ ) { 18573"use strict"; 18574 18575return $.extend( $.expr.pseudos, { 18576 tabbable: function( element ) { 18577 var tabIndex = $.attr( element, "tabindex" ), 18578 hasTabindex = tabIndex != null; 18579 return ( !hasTabindex || tabIndex >= 0 ) && $.ui.focusable( element, hasTabindex ); 18580 } 18581} ); 18582 18583} ); 18584 18585 18586/*! 18587 * jQuery UI Unique ID 1.14.2 18588 * https://jqueryui.com 18589 * 18590 * Copyright OpenJS Foundation and other contributors 18591 * Released under the MIT license. 18592 * https://jquery.org/license 18593 */ 18594 18595//>>label: uniqueId 18596//>>group: Core 18597//>>description: Functions to generate and remove uniqueId's 18598//>>docs: https://api.jqueryui.com/uniqueId/ 18599 18600( function( factory ) { 18601 "use strict"; 18602 18603 if ( typeof define === "function" && define.amd ) { 18604 18605 // AMD. Register as an anonymous module. 18606 define( [ "jquery", "./version" ], factory ); 18607 } else { 18608 18609 // Browser globals 18610 factory( jQuery ); 18611 } 18612} )( function( $ ) { 18613"use strict"; 18614 18615return $.fn.extend( { 18616 uniqueId: ( function() { 18617 var uuid = 0; 18618 18619 return function() { 18620 return this.each( function() { 18621 if ( !this.id ) { 18622 this.id = "ui-id-" + ( ++uuid ); 18623 } 18624 } ); 18625 }; 18626 } )(), 18627 18628 removeUniqueId: function() { 18629 return this.each( function() { 18630 if ( /^ui-id-\d+$/.test( this.id ) ) { 18631 $( this ).removeAttr( "id" ); 18632 } 18633 } ); 18634 } 18635} ); 18636 18637} ); 18638 18639 18640 18641 18642 18643 18644 18645 18646 18647 18648 18649 18650/*! 18651 * jQuery UI Dialog 1.14.2 18652 * https://jqueryui.com 18653 * 18654 * Copyright OpenJS Foundation and other contributors 18655 * Released under the MIT license. 18656 * https://jquery.org/license 18657 */ 18658 18659//>>label: Dialog 18660//>>group: Widgets 18661//>>description: Displays customizable dialog windows. 18662//>>docs: https://api.jqueryui.com/dialog/ 18663//>>demos: https://jqueryui.com/dialog/ 18664//>>css.structure: ../../themes/base/core.css 18665//>>css.structure: ../../themes/base/dialog.css 18666//>>css.theme: ../../themes/base/theme.css 18667 18668( function( factory ) { 18669 "use strict"; 18670 18671 if ( typeof define === "function" && define.amd ) { 18672 18673 // AMD. Register as an anonymous module. 18674 define( [ 18675 "jquery", 18676 "./button", 18677 "./draggable", 18678 "./mouse", 18679 "./resizable", 18680 "../focusable", 18681 "../keycode", 18682 "../position", 18683 "../tabbable", 18684 "../unique-id", 18685 "../version", 18686 "../widget" 18687 ], factory ); 18688 } else { 18689 18690 // Browser globals 18691 factory( jQuery ); 18692 } 18693} )( function( $ ) { 18694"use strict";
vendor: 22,361 bytes, lines 18694-19591
18694 18695 18696$.widget( "ui.dialog", { 18697 version: "1.14.2", 18698 options: { 18699 appendTo: "body", 18700 autoOpen: true, 18701 buttons: [], 18702 classes: { 18703 "ui-dialog": "ui-corner-all", 18704 "ui-dialog-titlebar": "ui-corner-all" 18705 }, 18706 closeOnEscape: true, 18707 closeText: "Close", 18708 draggable: true, 18709 hide: null, 18710 height: "auto", 18711 maxHeight: null, 18712 maxWidth: null, 18713 minHeight: 150, 18714 minWidth: 150, 18715 modal: false, 18716 position: { 18717 my: "center", 18718 at: "center", 18719 of: window, 18720 collision: "fit", 18721 18722 // Ensure the titlebar is always visible 18723 using: function( pos ) { 18724 var topOffset = $( this ).css( pos ).offset().top; 18725 if ( topOffset < 0 ) { 18726 $( this ).css( "top", pos.top - topOffset ); 18727 } 18728 } 18729 }, 18730 resizable: true, 18731 show: null, 18732 title: null, 18733 uiDialogTitleHeadingLevel: 0, 18734 width: 300, 18735 18736 // Callbacks 18737 beforeClose: null, 18738 close: null, 18739 drag: null, 18740 dragStart: null, 18741 dragStop: null, 18742 focus: null, 18743 open: null, 18744 resize: null, 18745 resizeStart: null, 18746 resizeStop: null 18747 }, 18748 18749 sizeRelatedOptions: { 18750 buttons: true, 18751 height: true, 18752 maxHeight: true, 18753 maxWidth: true, 18754 minHeight: true, 18755 minWidth: true, 18756 width: true 18757 }, 18758 18759 resizableRelatedOptions: { 18760 maxHeight: true, 18761 maxWidth: true, 18762 minHeight: true, 18763 minWidth: true 18764 }, 18765 18766 _create: function() { 18767 this.originalCss = { 18768 display: this.element[ 0 ].style.display, 18769 width: this.element[ 0 ].style.width, 18770 minHeight: this.element[ 0 ].style.minHeight, 18771 maxHeight: this.element[ 0 ].style.maxHeight, 18772 height: this.element[ 0 ].style.height 18773 }; 18774 this.originalPosition = { 18775 parent: this.element.parent(), 18776 index: this.element.parent().children().index( this.element ) 18777 }; 18778 this.originalTitle = this.element.attr( "title" ); 18779 if ( this.options.title == null && this.originalTitle != null ) { 18780 this.options.title = this.originalTitle; 18781 } 18782 18783 // Dialogs can't be disabled 18784 if ( this.options.disabled ) { 18785 this.options.disabled = false; 18786 } 18787 18788 this._createWrapper(); 18789 18790 this.element 18791 .show() 18792 .removeAttr( "title" ) 18793 .appendTo( this.uiDialog ); 18794 18795 this._addClass( "ui-dialog-content", "ui-widget-content" ); 18796 18797 this._createTitlebar(); 18798 this._createButtonPane(); 18799 18800 if ( this.options.draggable && $.fn.draggable ) { 18801 this._makeDraggable(); 18802 } 18803 if ( this.options.resizable && $.fn.resizable ) { 18804 this._makeResizable(); 18805 } 18806 18807 this._isOpen = false; 18808 18809 this._trackFocus(); 18810 }, 18811 18812 _init: function() { 18813 if ( this.options.autoOpen ) { 18814 this.open(); 18815 } 18816 }, 18817 18818 _appendTo: function() { 18819 var element = this.options.appendTo; 18820 if ( element && ( element.jquery || element.nodeType ) ) { 18821 return $( element ); 18822 } 18823 return this.document.find( element || "body" ).eq( 0 ); 18824 }, 18825 18826 _destroy: function() { 18827 var next, 18828 originalPosition = this.originalPosition; 18829 18830 this._untrackInstance(); 18831 this._destroyOverlay(); 18832 18833 this.element 18834 .removeUniqueId() 18835 .css( this.originalCss ) 18836 18837 // Without detaching first, the following becomes really slow 18838 .detach(); 18839 18840 this.uiDialog.remove(); 18841 18842 if ( this.originalTitle ) { 18843 this.element.attr( "title", this.originalTitle ); 18844 } 18845 18846 next = originalPosition.parent.children().eq( originalPosition.index ); 18847 18848 // Don't try to place the dialog next to itself (#8613) 18849 if ( next.length && next[ 0 ] !== this.element[ 0 ] ) { 18850 next.before( this.element ); 18851 } else { 18852 originalPosition.parent.append( this.element ); 18853 } 18854 }, 18855 18856 widget: function() { 18857 return this.uiDialog; 18858 }, 18859 18860 disable: $.noop, 18861 enable: $.noop, 18862 18863 close: function( event ) { 18864 var that = this; 18865 18866 if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) { 18867 return; 18868 } 18869 18870 this._isOpen = false; 18871 this._focusedElement = null; 18872 this._destroyOverlay(); 18873 this._untrackInstance(); 18874 18875 if ( !this.opener.filter( ":focusable" ).trigger( "focus" ).length ) { 18876 18877 // Hiding a focused element doesn't trigger blur in WebKit 18878 // so in case we have nothing to focus on, explicitly blur the active element 18879 // https://bugs.webkit.org/show_bug.cgi?id=47182 18880 $( this.document[ 0 ].activeElement ).trigger( "blur" ); 18881 } 18882 18883 this._hide( this.uiDialog, this.options.hide, function() { 18884 that._trigger( "close", event ); 18885 } ); 18886 }, 18887 18888 isOpen: function() { 18889 return this._isOpen; 18890 }, 18891 18892 moveToTop: function() { 18893 this._moveToTop(); 18894 }, 18895 18896 _moveToTop: function( event, silent ) { 18897 var moved = false, 18898 zIndices = this.uiDialog.siblings( ".ui-front:visible" ).map( function() { 18899 return +$( this ).css( "z-index" ); 18900 } ).get(), 18901 zIndexMax = Math.max.apply( null, zIndices ); 18902 18903 if ( zIndexMax >= +this.uiDialog.css( "z-index" ) ) { 18904 this.uiDialog.css( "z-index", zIndexMax + 1 ); 18905 moved = true; 18906 } 18907 18908 if ( moved && !silent ) { 18909 this._trigger( "focus", event ); 18910 } 18911 return moved; 18912 }, 18913 18914 open: function() { 18915 var that = this; 18916 if ( this._isOpen ) { 18917 if ( this._moveToTop() ) { 18918 this._focusTabbable(); 18919 } 18920 return; 18921 } 18922 18923 this._isOpen = true; 18924 this.opener = $( this.document[ 0 ].activeElement ); 18925 18926 this._size(); 18927 this._position(); 18928 this._createOverlay(); 18929 this._moveToTop( null, true ); 18930 18931 // Ensure the overlay is moved to the top with the dialog, but only when 18932 // opening. The overlay shouldn't move after the dialog is open so that 18933 // modeless dialogs opened after the modal dialog stack properly. 18934 if ( this.overlay ) { 18935 this.overlay.css( "z-index", this.uiDialog.css( "z-index" ) - 1 ); 18936 } 18937 18938 this._show( this.uiDialog, this.options.show, function() { 18939 that._focusTabbable(); 18940 that._trigger( "focus" ); 18941 } ); 18942 18943 // Track the dialog immediately upon opening in case a focus event 18944 // somehow occurs outside of the dialog before an element inside the 18945 // dialog is focused (#10152) 18946 this._makeFocusTarget(); 18947 18948 this._trigger( "open" ); 18949 }, 18950 18951 _focusTabbable: function() { 18952 18953 // Set focus to the first match: 18954 // 1. An element that was focused previously 18955 // 2. First element inside the dialog matching [autofocus] 18956 // 3. Tabbable element inside the content element 18957 // 4. Tabbable element inside the buttonpane 18958 // 5. The close button 18959 // 6. The dialog itself 18960 var hasFocus = this._focusedElement; 18961 if ( !hasFocus ) { 18962 hasFocus = this.element.find( "[autofocus]" ); 18963 } 18964 if ( !hasFocus.length ) { 18965 hasFocus = this.element.find( ":tabbable" ); 18966 } 18967 if ( !hasFocus.length ) { 18968 hasFocus = this.uiDialogButtonPane.find( ":tabbable" ); 18969 } 18970 if ( !hasFocus.length ) { 18971 hasFocus = this.uiDialogTitlebarClose.filter( ":tabbable" ); 18972 } 18973 if ( !hasFocus.length ) { 18974 hasFocus = this.uiDialog; 18975 } 18976 hasFocus.eq( 0 ).trigger( "focus" ); 18977 }, 18978 18979 _restoreTabbableFocus: function() { 18980 var activeElement = this.document[ 0 ].activeElement, 18981 isActive = this.uiDialog[ 0 ] === activeElement || 18982 $.contains( this.uiDialog[ 0 ], activeElement ); 18983 if ( !isActive ) { 18984 this._focusTabbable(); 18985 } 18986 }, 18987 18988 _keepFocus: function( event ) { 18989 event.preventDefault(); 18990 this._restoreTabbableFocus(); 18991 }, 18992 18993 _createWrapper: function() { 18994 this.uiDialog = $( "<div>" ) 18995 .hide() 18996 .attr( { 18997 18998 // Setting tabIndex makes the div focusable 18999 tabIndex: -1, 19000 role: "dialog", 19001 "aria-modal": this.options.modal ? "true" : null 19002 } ) 19003 .appendTo( this._appendTo() ); 19004 19005 this._addClass( this.uiDialog, "ui-dialog", "ui-widget ui-widget-content ui-front" ); 19006 this._on( this.uiDialog, { 19007 keydown: function( event ) { 19008 if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode && 19009 event.keyCode === $.ui.keyCode.ESCAPE ) { 19010 event.preventDefault(); 19011 this.close( event ); 19012 return; 19013 } 19014 19015 // Prevent tabbing out of dialogs 19016 if ( event.keyCode !== $.ui.keyCode.TAB || event.isDefaultPrevented() ) { 19017 return; 19018 } 19019 var tabbables = this.uiDialog.find( ":tabbable" ), 19020 first = tabbables.first(), 19021 last = tabbables.last(); 19022 19023 if ( ( event.target === last[ 0 ] || event.target === this.uiDialog[ 0 ] ) && 19024 !event.shiftKey ) { 19025 this._delay( function() { 19026 first.trigger( "focus" ); 19027 } ); 19028 event.preventDefault(); 19029 } else if ( ( event.target === first[ 0 ] || 19030 event.target === this.uiDialog[ 0 ] ) && event.shiftKey ) { 19031 this._delay( function() { 19032 last.trigger( "focus" ); 19033 } ); 19034 event.preventDefault(); 19035 } 19036 }, 19037 mousedown: function( event ) { 19038 if ( this._moveToTop( event ) ) { 19039 this._focusTabbable(); 19040 } 19041 } 19042 } ); 19043 19044 // We assume that any existing aria-describedby attribute means 19045 // that the dialog content is marked up properly 19046 // otherwise we brute force the content as the description 19047 if ( !this.element.find( "[aria-describedby]" ).length ) { 19048 this.uiDialog.attr( { 19049 "aria-describedby": this.element.uniqueId().attr( "id" ) 19050 } ); 19051 } 19052 }, 19053 19054 _createTitlebar: function() { 19055 var uiDialogTitle; 19056 19057 this.uiDialogTitlebar = $( "<div>" ); 19058 this._addClass( this.uiDialogTitlebar, 19059 "ui-dialog-titlebar", "ui-widget-header ui-helper-clearfix" ); 19060 this._on( this.uiDialogTitlebar, { 19061 mousedown: function( event ) { 19062 19063 // Don't prevent click on close button (#8838) 19064 // Focusing a dialog that is partially scrolled out of view 19065 // causes the browser to scroll it into view, preventing the click event 19066 if ( !$( event.target ).closest( ".ui-dialog-titlebar-close" ) ) { 19067 19068 // Dialog isn't getting focus when dragging (#8063) 19069 this.uiDialog.trigger( "focus" ); 19070 } 19071 } 19072 } ); 19073 19074 this.uiDialogTitlebarClose = $( "<button type='button'></button>" ) 19075 .button( { 19076 label: $( "<a>" ).text( this.options.closeText ).html(), 19077 icon: "ui-icon-closethick", 19078 showLabel: false 19079 } ) 19080 .appendTo( this.uiDialogTitlebar ); 19081 19082 this._addClass( this.uiDialogTitlebarClose, "ui-dialog-titlebar-close" ); 19083 this._on( this.uiDialogTitlebarClose, { 19084 click: function( event ) { 19085 event.preventDefault(); 19086 this.close( event ); 19087 } 19088 } ); 19089 19090 var uiDialogHeadingLevel = Number.isInteger( this.options.uiDialogTitleHeadingLevel ) && 19091 this.options.uiDialogTitleHeadingLevel > 0 && 19092 this.options.uiDialogTitleHeadingLevel <= 6 ? 19093 "h" + this.options.uiDialogTitleHeadingLevel : "span"; 19094 19095 uiDialogTitle = $( "<" + uiDialogHeadingLevel + ">" ) 19096 .uniqueId().prependTo( this.uiDialogTitlebar ); 19097 this._addClass( uiDialogTitle, "ui-dialog-title" ); 19098 this._title( uiDialogTitle ); 19099 19100 this.uiDialogTitlebar.prependTo( this.uiDialog ); 19101 19102 this.uiDialog.attr( { 19103 "aria-labelledby": uiDialogTitle.attr( "id" ) 19104 } ); 19105 }, 19106 19107 _title: function( title ) { 19108 if ( this.options.title ) { 19109 title.text( this.options.title ); 19110 } else { 19111 title.html( " " ); 19112 } 19113 }, 19114 19115 _createButtonPane: function() { 19116 this.uiDialogButtonPane = $( "<div>" ); 19117 this._addClass( this.uiDialogButtonPane, "ui-dialog-buttonpane", 19118 "ui-widget-content ui-helper-clearfix" ); 19119 19120 this.uiButtonSet = $( "<div>" ) 19121 .appendTo( this.uiDialogButtonPane ); 19122 this._addClass( this.uiButtonSet, "ui-dialog-buttonset" ); 19123 19124 this._createButtons(); 19125 }, 19126 19127 _createButtons: function() { 19128 var that = this, 19129 buttons = this.options.buttons; 19130 19131 // If we already have a button pane, remove it 19132 this.uiDialogButtonPane.remove(); 19133 this.uiButtonSet.empty(); 19134 19135 if ( $.isEmptyObject( buttons ) || ( Array.isArray( buttons ) && !buttons.length ) ) { 19136 this._removeClass( this.uiDialog, "ui-dialog-buttons" ); 19137 return; 19138 } 19139 19140 $.each( buttons, function( name, props ) { 19141 var click, buttonOptions; 19142 props = typeof props === "function" ? 19143 { click: props, text: name } : 19144 props; 19145 19146 // Default to a non-submitting button 19147 props = $.extend( { type: "button" }, props ); 19148 19149 // Change the context for the click callback to be the main element 19150 click = props.click; 19151 buttonOptions = { 19152 icon: props.icon, 19153 iconPosition: props.iconPosition, 19154 showLabel: props.showLabel, 19155 19156 // Deprecated options 19157 icons: props.icons, 19158 text: props.text 19159 }; 19160 19161 delete props.click; 19162 delete props.icon; 19163 delete props.iconPosition; 19164 delete props.showLabel; 19165 19166 // Deprecated options 19167 delete props.icons; 19168 if ( typeof props.text === "boolean" ) { 19169 delete props.text; 19170 } 19171 19172 $( "<button></button>", props ) 19173 .button( buttonOptions ) 19174 .appendTo( that.uiButtonSet ) 19175 .on( "click", function() { 19176 click.apply( that.element[ 0 ], arguments ); 19177 } ); 19178 } ); 19179 this._addClass( this.uiDialog, "ui-dialog-buttons" ); 19180 this.uiDialogButtonPane.appendTo( this.uiDialog ); 19181 }, 19182 19183 _makeDraggable: function() { 19184 var that = this, 19185 options = this.options; 19186 19187 function filteredUi( ui ) { 19188 return { 19189 position: ui.position, 19190 offset: ui.offset 19191 }; 19192 } 19193 19194 this.uiDialog.draggable( { 19195 cancel: ".ui-dialog-content, .ui-dialog-titlebar-close", 19196 handle: ".ui-dialog-titlebar", 19197 containment: "document", 19198 start: function( event, ui ) { 19199 that._addClass( $( this ), "ui-dialog-dragging" ); 19200 that._blockFrames(); 19201 that._trigger( "dragStart", event, filteredUi( ui ) ); 19202 }, 19203 drag: function( event, ui ) { 19204 that._trigger( "drag", event, filteredUi( ui ) ); 19205 }, 19206 stop: function( event, ui ) { 19207 var left = ui.offset.left - that.document.scrollLeft(), 19208 top = ui.offset.top - that.document.scrollTop(); 19209 19210 options.position = { 19211 my: "left top", 19212 at: "left" + ( left >= 0 ? "+" : "" ) + left + " " + 19213 "top" + ( top >= 0 ? "+" : "" ) + top, 19214 of: that.window 19215 }; 19216 that._removeClass( $( this ), "ui-dialog-dragging" ); 19217 that._unblockFrames(); 19218 that._trigger( "dragStop", event, filteredUi( ui ) ); 19219 } 19220 } ); 19221 }, 19222 19223 _makeResizable: function() { 19224 var that = this, 19225 options = this.options, 19226 handles = options.resizable, 19227 19228 // .ui-resizable has position: relative defined in the stylesheet 19229 // but dialogs have to use absolute or fixed positioning 19230 position = this.uiDialog.css( "position" ), 19231 resizeHandles = typeof handles === "string" ? 19232 handles : 19233 "n,e,s,w,se,sw,ne,nw"; 19234 19235 function filteredUi( ui ) { 19236 return { 19237 originalPosition: ui.originalPosition, 19238 originalSize: ui.originalSize, 19239 position: ui.position, 19240 size: ui.size 19241 }; 19242 } 19243 19244 this.uiDialog.resizable( { 19245 cancel: ".ui-dialog-content", 19246 containment: "document", 19247 alsoResize: this.element, 19248 maxWidth: options.maxWidth, 19249 maxHeight: options.maxHeight, 19250 minWidth: options.minWidth, 19251 minHeight: this._minHeight(), 19252 handles: resizeHandles, 19253 start: function( event, ui ) { 19254 that._addClass( $( this ), "ui-dialog-resizing" ); 19255 that._blockFrames(); 19256 that._trigger( "resizeStart", event, filteredUi( ui ) ); 19257 }, 19258 resize: function( event, ui ) { 19259 that._trigger( "resize", event, filteredUi( ui ) ); 19260 }, 19261 stop: function( event, ui ) { 19262 var offset = that.uiDialog.offset(), 19263 left = offset.left - that.document.scrollLeft(), 19264 top = offset.top - that.document.scrollTop(); 19265 19266 options.height = that.uiDialog.height(); 19267 options.width = that.uiDialog.width(); 19268 options.position = { 19269 my: "left top", 19270 at: "left" + ( left >= 0 ? "+" : "" ) + left + " " + 19271 "top" + ( top >= 0 ? "+" : "" ) + top, 19272 of: that.window 19273 }; 19274 that._removeClass( $( this ), "ui-dialog-resizing" ); 19275 that._unblockFrames(); 19276 that._trigger( "resizeStop", event, filteredUi( ui ) ); 19277 } 19278 } ) 19279 .css( "position", position ); 19280 }, 19281 19282 _trackFocus: function() { 19283 this._on( this.widget(), { 19284 focusin: function( event ) { 19285 this._makeFocusTarget(); 19286 this._focusedElement = $( event.target ); 19287 } 19288 } ); 19289 }, 19290 19291 _makeFocusTarget: function() { 19292 this._untrackInstance(); 19293 this._trackingInstances().unshift( this ); 19294 }, 19295 19296 _untrackInstance: function() { 19297 var instances = this._trackingInstances(), 19298 exists = $.inArray( this, instances ); 19299 if ( exists !== -1 ) { 19300 instances.splice( exists, 1 ); 19301 } 19302 }, 19303 19304 _trackingInstances: function() { 19305 var instances = this.document.data( "ui-dialog-instances" ); 19306 if ( !instances ) { 19307 instances = []; 19308 this.document.data( "ui-dialog-instances", instances ); 19309 } 19310 return instances; 19311 }, 19312 19313 _minHeight: function() { 19314 var options = this.options; 19315 19316 return options.height === "auto" ? 19317 options.minHeight : 19318 Math.min( options.minHeight, options.height ); 19319 }, 19320 19321 _position: function() { 19322 19323 // Need to show the dialog to get the actual offset in the position plugin 19324 var isVisible = this.uiDialog.is( ":visible" ); 19325 if ( !isVisible ) { 19326 this.uiDialog.show(); 19327 } 19328 this.uiDialog.position( this.options.position ); 19329 if ( !isVisible ) { 19330 this.uiDialog.hide(); 19331 } 19332 }, 19333 19334 _setOptions: function( options ) { 19335 var that = this, 19336 resize = false, 19337 resizableOptions = {}; 19338 19339 $.each( options, function( key, value ) { 19340 that._setOption( key, value ); 19341 19342 if ( key in that.sizeRelatedOptions ) { 19343 resize = true; 19344 } 19345 if ( key in that.resizableRelatedOptions ) { 19346 resizableOptions[ key ] = value; 19347 } 19348 } ); 19349 19350 if ( resize ) { 19351 this._size(); 19352 this._position(); 19353 } 19354 if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { 19355 this.uiDialog.resizable( "option", resizableOptions ); 19356 } 19357 }, 19358 19359 _setOption: function( key, value ) { 19360 var isDraggable, isResizable, 19361 uiDialog = this.uiDialog; 19362 19363 if ( key === "disabled" ) { 19364 return; 19365 } 19366 19367 this._super( key, value ); 19368 19369 if ( key === "appendTo" ) { 19370 this.uiDialog.appendTo( this._appendTo() ); 19371 } 19372 19373 if ( key === "buttons" ) { 19374 this._createButtons(); 19375 } 19376 19377 if ( key === "closeText" ) { 19378 this.uiDialogTitlebarClose.button( { 19379 19380 // Ensure that we always pass a string 19381 label: $( "<a>" ).text( "" + this.options.closeText ).html() 19382 } ); 19383 } 19384 19385 if ( key === "draggable" ) { 19386 isDraggable = uiDialog.is( ":data(ui-draggable)" ); 19387 if ( isDraggable && !value ) { 19388 uiDialog.draggable( "destroy" ); 19389 } 19390 19391 if ( !isDraggable && value ) { 19392 this._makeDraggable(); 19393 } 19394 } 19395 19396 if ( key === "position" ) { 19397 this._position(); 19398 } 19399 19400 if ( key === "resizable" ) { 19401 19402 // currently resizable, becoming non-resizable 19403 isResizable = uiDialog.is( ":data(ui-resizable)" ); 19404 if ( isResizable && !value ) { 19405 uiDialog.resizable( "destroy" ); 19406 } 19407 19408 // Currently resizable, changing handles 19409 if ( isResizable && typeof value === "string" ) { 19410 uiDialog.resizable( "option", "handles", value ); 19411 } 19412 19413 // Currently non-resizable, becoming resizable 19414 if ( !isResizable && value !== false ) { 19415 this._makeResizable(); 19416 } 19417 } 19418 19419 if ( key === "title" ) { 19420 this._title( this.uiDialogTitlebar.find( ".ui-dialog-title" ) ); 19421 } 19422 19423 if ( key === "modal" ) { 19424 uiDialog.attr( "aria-modal", value ? "true" : null ); 19425 } 19426 }, 19427 19428 _size: function() { 19429 19430 // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content 19431 // divs will both have width and height set, so we need to reset them 19432 var nonContentHeight, minContentHeight, maxContentHeight, 19433 options = this.options; 19434 19435 // Reset content sizing 19436 this.element.show().css( { 19437 width: "auto", 19438 minHeight: 0, 19439 maxHeight: "none", 19440 height: 0 19441 } ); 19442 19443 if ( options.minWidth > options.width ) { 19444 options.width = options.minWidth; 19445 } 19446 19447 // Reset wrapper sizing 19448 // determine the height of all the non-content elements 19449 nonContentHeight = this.uiDialog.css( { 19450 height: "auto", 19451 width: options.width 19452 } ) 19453 .outerHeight(); 19454 minContentHeight = Math.max( 0, options.minHeight - nonContentHeight ); 19455 maxContentHeight = typeof options.maxHeight === "number" ? 19456 Math.max( 0, options.maxHeight - nonContentHeight ) : 19457 "none"; 19458 19459 if ( options.height === "auto" ) { 19460 this.element.css( { 19461 minHeight: minContentHeight, 19462 maxHeight: maxContentHeight, 19463 height: "auto" 19464 } ); 19465 } else { 19466 this.element.height( Math.max( 0, options.height - nonContentHeight ) ); 19467 } 19468 19469 if ( this.uiDialog.is( ":data(ui-resizable)" ) ) { 19470 this.uiDialog.resizable( "option", "minHeight", this._minHeight() ); 19471 } 19472 }, 19473 19474 _blockFrames: function() { 19475 this.iframeBlocks = this.document.find( "iframe" ).map( function() { 19476 var iframe = $( this ); 19477 19478 return $( "<div>" ) 19479 .css( { 19480 position: "absolute", 19481 width: iframe.outerWidth(), 19482 height: iframe.outerHeight() 19483 } ) 19484 .appendTo( iframe.parent() ) 19485 .offset( iframe.offset() )[ 0 ]; 19486 } ); 19487 }, 19488 19489 _unblockFrames: function() { 19490 if ( this.iframeBlocks ) { 19491 this.iframeBlocks.remove(); 19492 delete this.iframeBlocks; 19493 } 19494 }, 19495 19496 _allowInteraction: function( event ) { 19497 if ( $( event.target ).closest( ".ui-dialog" ).length ) { 19498 return true; 19499 } 19500 19501 // TODO: Remove hack when datepicker implements 19502 // the .ui-front logic (#8989) 19503 return !!$( event.target ).closest( ".ui-datepicker" ).length; 19504 }, 19505 19506 _createOverlay: function() { 19507 if ( !this.options.modal ) { 19508 return; 19509 } 19510 19511 // We use a delay in case the overlay is created from an 19512 // event that we're going to be cancelling (#2804) 19513 var isOpening = true; 19514 this._delay( function() { 19515 isOpening = false; 19516 } ); 19517 19518 if ( !this.document.data( "ui-dialog-overlays" ) ) { 19519 19520 // Prevent use of anchors and inputs 19521 // This doesn't use `_on()` because it is a shared event handler 19522 // across all open modal dialogs. 19523 this.document.on( "focusin.ui-dialog", function( event ) { 19524 if ( isOpening ) { 19525 return; 19526 } 19527 19528 var instance = this._trackingInstances()[ 0 ]; 19529 if ( !instance._allowInteraction( event ) ) { 19530 event.preventDefault(); 19531 instance._focusTabbable(); 19532 } 19533 }.bind( this ) ); 19534 } 19535 19536 this.overlay = $( "<div>" ) 19537 .appendTo( this._appendTo() ); 19538 19539 this._addClass( this.overlay, null, "ui-widget-overlay ui-front" ); 19540 this._on( this.overlay, { 19541 mousedown: "_keepFocus" 19542 } ); 19543 this.document.data( "ui-dialog-overlays", 19544 ( this.document.data( "ui-dialog-overlays" ) || 0 ) + 1 ); 19545 }, 19546 19547 _destroyOverlay: function() { 19548 if ( !this.options.modal ) { 19549 return; 19550 } 19551 19552 if ( this.overlay ) { 19553 var overlays = this.document.data( "ui-dialog-overlays" ) - 1; 19554 19555 if ( !overlays ) { 19556 this.document.off( "focusin.ui-dialog" ); 19557 this.document.removeData( "ui-dialog-overlays" ); 19558 } else { 19559 this.document.data( "ui-dialog-overlays", overlays ); 19560 } 19561 19562 this.overlay.remove(); 19563 this.overlay = null; 19564 } 19565 } 19566} ); 19567 19568// DEPRECATED 19569// TODO: switch return back to widget declaration at top of file when this is removed 19570if ( $.uiBackCompat === true ) { 19571 19572 // Backcompat for dialogClass option 19573 $.widget( "ui.dialog", $.ui.dialog, { 19574 options: { 19575 dialogClass: "" 19576 }, 19577 _createWrapper: function() { 19578 this._super(); 19579 this.uiDialog.addClass( this.options.dialogClass ); 19580 }, 19581 _setOption: function( key, value ) { 19582 if ( key === "dialogClass" ) { 19583 this.uiDialog 19584 .removeClass( this.options.dialogClass ) 19585 .addClass( value ); 19586 } 19587 this._superApply( arguments ); 19588 } 19589 } ); 19590} 19591
19592return $.ui.dialog; 19593 19594} ); 19595 19596 19597 19598 19599 19600 19601/*! 19602 * jQuery UI Sortable 1.14.2 19603 * https://jqueryui.com 19604 * 19605 * Copyright OpenJS Foundation and other contributors 19606 * Released under the MIT license. 19607 * https://jquery.org/license 19608 */ 19609 19610//>>label: Sortable 19611//>>group: Interactions 19612//>>description: Enables items in a list to be sorted using the mouse. 19613//>>docs: https://api.jqueryui.com/sortable/ 19614//>>demos: https://jqueryui.com/sortable/ 19615//>>css.structure: ../../themes/base/sortable.css 19616 19617( function( factory ) { 19618 "use strict"; 19619 19620 if ( typeof define === "function" && define.amd ) { 19621 19622 // AMD. Register as an anonymous module. 19623 define( [ 19624 "jquery", 19625 "./mouse", 19626 "../data", 19627 "../scroll-parent", 19628 "../version", 19629 "../widget" 19630 ], factory
vendor: 12,475 bytes, lines 19630-20098
19630 ); 19631 } else { 19632 19633 // Browser globals 19634 factory( jQuery ); 19635 } 19636} )( function( $ ) { 19637"use strict"; 19638 19639return $.widget( "ui.sortable", $.ui.mouse, { 19640 version: "1.14.2", 19641 widgetEventPrefix: "sort", 19642 ready: false, 19643 options: { 19644 appendTo: "parent", 19645 axis: false, 19646 connectWith: false, 19647 containment: false, 19648 cursor: "auto", 19649 cursorAt: false, 19650 dropOnEmpty: true, 19651 forcePlaceholderSize: false, 19652 forceHelperSize: false, 19653 grid: false, 19654 handle: false, 19655 helper: "original", 19656 items: "> *", 19657 opacity: false, 19658 placeholder: false, 19659 revert: false, 19660 scroll: true, 19661 scrollSensitivity: 20, 19662 scrollSpeed: 20, 19663 scope: "default", 19664 tolerance: "intersect", 19665 zIndex: 1000, 19666 19667 // Callbacks 19668 activate: null, 19669 beforeStop: null, 19670 change: null, 19671 deactivate: null, 19672 out: null, 19673 over: null, 19674 receive: null, 19675 remove: null, 19676 sort: null, 19677 start: null, 19678 stop: null, 19679 update: null 19680 }, 19681 19682 _isOverAxis: function( x, reference, size ) { 19683 return ( x >= reference ) && ( x < ( reference + size ) ); 19684 }, 19685 19686 _isFloating: function( item ) { 19687 return ( /left|right/ ).test( item.css( "float" ) ) || 19688 ( /inline|table-cell/ ).test( item.css( "display" ) ); 19689 }, 19690 19691 _create: function() { 19692 this.containerCache = {}; 19693 this._addClass( "ui-sortable" ); 19694 19695 //Get the items 19696 this.refresh(); 19697 19698 //Let's determine the parent's offset 19699 this.offset = this.element.offset(); 19700 19701 //Initialize mouse events for interaction 19702 this._mouseInit(); 19703 19704 this._setHandleClassName(); 19705 19706 //We're ready to go 19707 this.ready = true; 19708 19709 }, 19710 19711 _setOption: function( key, value ) { 19712 this._super( key, value ); 19713 19714 if ( key === "handle" ) { 19715 this._setHandleClassName(); 19716 } 19717 }, 19718 19719 _setHandleClassName: function() { 19720 var that = this; 19721 this._removeClass( this.element.find( ".ui-sortable-handle" ), "ui-sortable-handle" ); 19722 $.each( this.items, function() { 19723 that._addClass( 19724 this.instance.options.handle ? 19725 this.item.find( this.instance.options.handle ) : 19726 this.item, 19727 "ui-sortable-handle" 19728 ); 19729 } ); 19730 }, 19731 19732 _destroy: function() { 19733 this._mouseDestroy(); 19734 19735 for ( var i = this.items.length - 1; i >= 0; i-- ) { 19736 this.items[ i ].item.removeData( this.widgetName + "-item" ); 19737 } 19738 19739 return this; 19740 }, 19741 19742 _mouseCapture: function( event, overrideHandle ) { 19743 var currentItem = null, 19744 validHandle = false, 19745 that = this; 19746 19747 if ( this.reverting ) { 19748 return false; 19749 } 19750 19751 if ( this.options.disabled || this.options.type === "static" ) { 19752 return false; 19753 } 19754 19755 //We have to refresh the items data once first 19756 this._refreshItems( event ); 19757 19758 //Find out if the clicked node (or one of its parents) is a actual item in this.items 19759 $( event.target ).parents().each( function() { 19760 if ( $.data( this, that.widgetName + "-item" ) === that ) { 19761 currentItem = $( this ); 19762 return false; 19763 } 19764 } ); 19765 if ( $.data( event.target, that.widgetName + "-item" ) === that ) { 19766 currentItem = $( event.target ); 19767 } 19768 19769 if ( !currentItem ) { 19770 return false; 19771 } 19772 if ( this.options.handle && !overrideHandle ) { 19773 $( this.options.handle, currentItem ).find( "*" ).addBack().each( function() { 19774 if ( this === event.target ) { 19775 validHandle = true; 19776 } 19777 } ); 19778 if ( !validHandle ) { 19779 return false; 19780 } 19781 } 19782 19783 this.currentItem = currentItem; 19784 this._removeCurrentsFromItems(); 19785 return true; 19786 19787 }, 19788 19789 _mouseStart: function( event, overrideHandle, noActivation ) { 19790 19791 var i, body, 19792 o = this.options; 19793 19794 this.currentContainer = this; 19795 19796 //We only need to call refreshPositions, because the refreshItems call has been moved to 19797 // mouseCapture 19798 this.refreshPositions(); 19799 19800 //Prepare the dragged items parent 19801 this.appendTo = $( o.appendTo !== "parent" ? 19802 o.appendTo : 19803 this.currentItem.parent() ); 19804 19805 //Create and append the visible helper 19806 this.helper = this._createHelper( event ); 19807 19808 //Cache the helper size 19809 this._cacheHelperProportions(); 19810 19811 /* 19812 * - Position generation - 19813 * This block generates everything position related - it's the core of draggables. 19814 */ 19815 19816 //Cache the margins of the original element 19817 this._cacheMargins(); 19818 19819 //The element's absolute position on the page minus margins 19820 this.offset = this.currentItem.offset(); 19821 this.offset = { 19822 top: this.offset.top - this.margins.top, 19823 left: this.offset.left - this.margins.left 19824 }; 19825 19826 $.extend( this.offset, { 19827 click: { //Where the click happened, relative to the element 19828 left: event.pageX - this.offset.left, 19829 top: event.pageY - this.offset.top 19830 }, 19831 19832 // This is a relative to absolute position minus the actual position calculation - 19833 // only used for relative positioned helper 19834 relative: this._getRelativeOffset() 19835 } ); 19836 19837 // After we get the helper offset, but before we get the parent offset we can 19838 // change the helper's position to absolute 19839 // TODO: Still need to figure out a way to make relative sorting possible 19840 this.helper.css( "position", "absolute" ); 19841 this.cssPosition = this.helper.css( "position" ); 19842 19843 //Adjust the mouse offset relative to the helper if "cursorAt" is supplied 19844 if ( o.cursorAt ) { 19845 this._adjustOffsetFromHelper( o.cursorAt ); 19846 } 19847 19848 //Cache the former DOM position 19849 this.domPosition = { 19850 prev: this.currentItem.prev()[ 0 ], 19851 parent: this.currentItem.parent()[ 0 ] 19852 }; 19853 19854 // If the helper is not the original, hide the original so it's not playing any role during 19855 // the drag, won't cause anything bad this way 19856 if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { 19857 this.currentItem.hide(); 19858 } 19859 19860 //Create the placeholder 19861 this._createPlaceholder(); 19862 19863 //Get the next scrolling parent 19864 this.scrollParent = this.placeholder.scrollParent(); 19865 19866 $.extend( this.offset, { 19867 parent: this._getParentOffset() 19868 } ); 19869 19870 //Set a containment if given in the options 19871 if ( o.containment ) { 19872 this._setContainment(); 19873 } 19874 19875 if ( o.cursor && o.cursor !== "auto" ) { // cursor option 19876 body = this.document.find( "body" ); 19877 19878 this._storedStylesheet = 19879 $( "<style>*{ cursor: " + o.cursor + " !important; }</style>" ).appendTo( body ); 19880 } 19881 19882 // We need to make sure to grab the zIndex before setting the 19883 // opacity, because setting the opacity to anything lower than 1 19884 // causes the zIndex to change from "auto" to 0. 19885 if ( o.zIndex ) { // zIndex option 19886 if ( this.helper.css( "zIndex" ) ) { 19887 this._storedZIndex = this.helper.css( "zIndex" ); 19888 } 19889 this.helper.css( "zIndex", o.zIndex ); 19890 } 19891 19892 if ( o.opacity ) { // opacity option 19893 if ( this.helper.css( "opacity" ) ) { 19894 this._storedOpacity = this.helper.css( "opacity" ); 19895 } 19896 this.helper.css( "opacity", o.opacity ); 19897 } 19898 19899 //Prepare scrolling 19900 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 19901 this.scrollParent[ 0 ].tagName !== "HTML" ) { 19902 this.overflowOffset = this.scrollParent.offset(); 19903 } 19904 19905 //Call callbacks 19906 this._trigger( "start", event, this._uiHash() ); 19907 19908 //Recache the helper size 19909 if ( !this._preserveHelperProportions ) { 19910 this._cacheHelperProportions(); 19911 } 19912 19913 //Post "activate" events to possible containers 19914 if ( !noActivation ) { 19915 for ( i = this.containers.length - 1; i >= 0; i-- ) { 19916 this.containers[ i ]._trigger( "activate", event, this._uiHash( this ) ); 19917 } 19918 } 19919 19920 //Prepare possible droppables 19921 if ( $.ui.ddmanager ) { 19922 $.ui.ddmanager.current = this; 19923 } 19924 19925 if ( $.ui.ddmanager && !o.dropBehaviour ) { 19926 $.ui.ddmanager.prepareOffsets( this, event ); 19927 } 19928 19929 this.dragging = true; 19930 19931 this._addClass( this.helper, "ui-sortable-helper" ); 19932 19933 //Move the helper, if needed 19934 if ( !this.helper.parent().is( this.appendTo ) ) { 19935 this.helper.detach().appendTo( this.appendTo ); 19936 19937 //Update position 19938 this.offset.parent = this._getParentOffset(); 19939 } 19940 19941 //Generate the original position 19942 this.position = this.originalPosition = this._generatePosition( event ); 19943 this.originalPageX = event.pageX; 19944 this.originalPageY = event.pageY; 19945 this.lastPositionAbs = this.positionAbs = this._convertPositionTo( "absolute" ); 19946 19947 this._mouseDrag( event ); 19948 19949 return true; 19950 19951 }, 19952 19953 _scroll: function( event ) { 19954 var o = this.options, 19955 scrolled = false; 19956 19957 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 19958 this.scrollParent[ 0 ].tagName !== "HTML" ) { 19959 19960 if ( ( this.overflowOffset.top + this.scrollParent[ 0 ].offsetHeight ) - 19961 event.pageY < o.scrollSensitivity ) { 19962 this.scrollParent[ 0 ].scrollTop = 19963 scrolled = this.scrollParent[ 0 ].scrollTop + o.scrollSpeed; 19964 } else if ( event.pageY - this.overflowOffset.top < o.scrollSensitivity ) { 19965 this.scrollParent[ 0 ].scrollTop = 19966 scrolled = this.scrollParent[ 0 ].scrollTop - o.scrollSpeed; 19967 } 19968 19969 if ( ( this.overflowOffset.left + this.scrollParent[ 0 ].offsetWidth ) - 19970 event.pageX < o.scrollSensitivity ) { 19971 this.scrollParent[ 0 ].scrollLeft = scrolled = 19972 this.scrollParent[ 0 ].scrollLeft + o.scrollSpeed; 19973 } else if ( event.pageX - this.overflowOffset.left < o.scrollSensitivity ) { 19974 this.scrollParent[ 0 ].scrollLeft = scrolled = 19975 this.scrollParent[ 0 ].scrollLeft - o.scrollSpeed; 19976 } 19977 19978 } else { 19979 19980 if ( event.pageY - this.document.scrollTop() < o.scrollSensitivity ) { 19981 scrolled = this.document.scrollTop( this.document.scrollTop() - o.scrollSpeed ); 19982 } else if ( this.window.height() - ( event.pageY - this.document.scrollTop() ) < 19983 o.scrollSensitivity ) { 19984 scrolled = this.document.scrollTop( this.document.scrollTop() + o.scrollSpeed ); 19985 } 19986 19987 if ( event.pageX - this.document.scrollLeft() < o.scrollSensitivity ) { 19988 scrolled = this.document.scrollLeft( 19989 this.document.scrollLeft() - o.scrollSpeed 19990 ); 19991 } else if ( this.window.width() - ( event.pageX - this.document.scrollLeft() ) < 19992 o.scrollSensitivity ) { 19993 scrolled = this.document.scrollLeft( 19994 this.document.scrollLeft() + o.scrollSpeed 19995 ); 19996 } 19997 19998 } 19999 20000 return scrolled; 20001 }, 20002 20003 _mouseDrag: function( event ) { 20004 var i, item, itemElement, intersection, 20005 o = this.options; 20006 20007 //Compute the helpers position 20008 this.position = this._generatePosition( event ); 20009 this.positionAbs = this._convertPositionTo( "absolute" ); 20010 20011 //Set the helper position 20012 if ( !this.options.axis || this.options.axis !== "y" ) { 20013 this.helper[ 0 ].style.left = this.position.left + "px"; 20014 } 20015 if ( !this.options.axis || this.options.axis !== "x" ) { 20016 this.helper[ 0 ].style.top = this.position.top + "px"; 20017 } 20018 20019 //Do scrolling 20020 if ( o.scroll ) { 20021 if ( this._scroll( event ) !== false ) { 20022 20023 //Update item positions used in position checks 20024 this._refreshItemPositions( true ); 20025 20026 if ( $.ui.ddmanager && !o.dropBehaviour ) { 20027 $.ui.ddmanager.prepareOffsets( this, event ); 20028 } 20029 } 20030 } 20031 20032 this.dragDirection = { 20033 vertical: this._getDragVerticalDirection(), 20034 horizontal: this._getDragHorizontalDirection() 20035 }; 20036 20037 //Rearrange 20038 for ( i = this.items.length - 1; i >= 0; i-- ) { 20039 20040 //Cache variables and intersection, continue if no intersection 20041 item = this.items[ i ]; 20042 itemElement = item.item[ 0 ]; 20043 intersection = this._intersectsWithPointer( item ); 20044 if ( !intersection ) { 20045 continue; 20046 } 20047 20048 // Only put the placeholder inside the current Container, skip all 20049 // items from other containers. This works because when moving 20050 // an item from one container to another the 20051 // currentContainer is switched before the placeholder is moved. 20052 // 20053 // Without this, moving items in "sub-sortables" can cause 20054 // the placeholder to jitter between the outer and inner container. 20055 if ( item.instance !== this.currentContainer ) { 20056 continue; 20057 } 20058 20059 // Cannot intersect with itself 20060 // no useless actions that have been done before 20061 // no action if the item moved is the parent of the item checked 20062 if ( itemElement !== this.currentItem[ 0 ] && 20063 this.placeholder[ intersection === 1 ? 20064 "next" : "prev" ]()[ 0 ] !== itemElement && 20065 !$.contains( this.placeholder[ 0 ], itemElement ) && 20066 ( this.options.type === "semi-dynamic" ? 20067 !$.contains( this.element[ 0 ], itemElement ) : 20068 true 20069 ) 20070 ) { 20071 20072 this.direction = intersection === 1 ? "down" : "up"; 20073 20074 if ( this.options.tolerance === "pointer" || 20075 this._intersectsWithSides( item ) ) { 20076 this._rearrange( event, item ); 20077 } else { 20078 break; 20079 } 20080 20081 this._trigger( "change", event, this._uiHash() ); 20082 break; 20083 } 20084 } 20085 20086 //Post events to containers 20087 this._contactContainers( event ); 20088 20089 //Interconnect with droppables 20090 if ( $.ui.ddmanager ) { 20091 $.ui.ddmanager.drag( this, event ); 20092 } 20093 20094 //Call callbacks 20095 this._trigger( "sort", event, this._uiHash() ); 20096 20097 this.lastPositionAbs = this.positionAbs; 20098 return false;
vendor: 5,063 bytes, lines 20099-20288
20099 20100 }, 20101 20102 _mouseStop: function( event, noPropagation ) { 20103 20104 if ( !event ) { 20105 return; 20106 } 20107 20108 //If we are using droppables, inform the manager about the drop 20109 if ( $.ui.ddmanager && !this.options.dropBehaviour ) { 20110 $.ui.ddmanager.drop( this, event ); 20111 } 20112 20113 if ( this.options.revert ) { 20114 var that = this, 20115 cur = this.placeholder.offset(), 20116 axis = this.options.axis, 20117 animation = {}; 20118 20119 if ( !axis || axis === "x" ) { 20120 animation.left = cur.left - this.offset.parent.left - this.margins.left + 20121 ( this.offsetParent[ 0 ] === this.document[ 0 ].body ? 20122 0 : 20123 this.offsetParent[ 0 ].scrollLeft 20124 ); 20125 } 20126 if ( !axis || axis === "y" ) { 20127 animation.top = cur.top - this.offset.parent.top - this.margins.top + 20128 ( this.offsetParent[ 0 ] === this.document[ 0 ].body ? 20129 0 : 20130 this.offsetParent[ 0 ].scrollTop 20131 ); 20132 } 20133 this.reverting = true; 20134 $( this.helper ).animate( 20135 animation, 20136 parseInt( this.options.revert, 10 ) || 500, 20137 function() { 20138 that._clear( event ); 20139 } 20140 ); 20141 } else { 20142 this._clear( event, noPropagation ); 20143 } 20144 20145 return false; 20146 20147 }, 20148 20149 cancel: function() { 20150 20151 if ( this.dragging ) { 20152 20153 this._mouseUp( new $.Event( "mouseup", { target: null } ) ); 20154 20155 if ( this.options.helper === "original" ) { 20156 this.currentItem.css( this._storedCSS ); 20157 this._removeClass( this.currentItem, "ui-sortable-helper" ); 20158 } else { 20159 this.currentItem.show(); 20160 } 20161 20162 //Post deactivating events to containers 20163 for ( var i = this.containers.length - 1; i >= 0; i-- ) { 20164 this.containers[ i ]._trigger( "deactivate", null, this._uiHash( this ) ); 20165 if ( this.containers[ i ].containerCache.over ) { 20166 this.containers[ i ]._trigger( "out", null, this._uiHash( this ) ); 20167 this.containers[ i ].containerCache.over = 0; 20168 } 20169 } 20170 20171 } 20172 20173 if ( this.placeholder ) { 20174 20175 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 20176 // it unbinds ALL events from the original node! 20177 if ( this.placeholder[ 0 ].parentNode ) { 20178 this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] ); 20179 } 20180 if ( this.options.helper !== "original" && this.helper && 20181 this.helper[ 0 ].parentNode ) { 20182 this.helper.remove(); 20183 } 20184 20185 $.extend( this, { 20186 helper: null, 20187 dragging: false, 20188 reverting: false, 20189 _noFinalSort: null 20190 } ); 20191 20192 if ( this.domPosition.prev ) { 20193 $( this.domPosition.prev ).after( this.currentItem ); 20194 } else { 20195 $( this.domPosition.parent ).prepend( this.currentItem ); 20196 } 20197 } 20198 20199 return this; 20200 20201 }, 20202 20203 serialize: function( o ) { 20204 20205 var items = this._getItemsAsjQuery( o && o.connected ), 20206 str = []; 20207 o = o || {}; 20208 20209 $( items ).each( function() { 20210 var res = ( $( o.item || this ).attr( o.attribute || "id" ) || "" ) 20211 .match( o.expression || ( /(.+)[\-=_](.+)/ ) ); 20212 if ( res ) { 20213 str.push( 20214 ( o.key || res[ 1 ] + "[]" ) + 20215 "=" + ( o.key && o.expression ? res[ 1 ] : res[ 2 ] ) ); 20216 } 20217 } ); 20218 20219 if ( !str.length && o.key ) { 20220 str.push( o.key + "=" ); 20221 } 20222 20223 return str.join( "&" ); 20224 20225 }, 20226 20227 toArray: function( o ) { 20228 20229 var items = this._getItemsAsjQuery( o && o.connected ), 20230 ret = []; 20231 20232 o = o || {}; 20233 20234 items.each( function() { 20235 ret.push( $( o.item || this ).attr( o.attribute || "id" ) || "" ); 20236 } ); 20237 return ret; 20238 20239 }, 20240 20241 /* Be careful with the following core functions */ 20242 _intersectsWith: function( item ) { 20243 20244 var x1 = this.positionAbs.left, 20245 x2 = x1 + this.helperProportions.width, 20246 y1 = this.positionAbs.top, 20247 y2 = y1 + this.helperProportions.height, 20248 l = item.left, 20249 r = l + item.width, 20250 t = item.top, 20251 b = t + item.height, 20252 dyClick = this.offset.click.top, 20253 dxClick = this.offset.click.left, 20254 isOverElementHeight = ( this.options.axis === "x" ) || ( ( y1 + dyClick ) > t && 20255 ( y1 + dyClick ) < b ), 20256 isOverElementWidth = ( this.options.axis === "y" ) || ( ( x1 + dxClick ) > l && 20257 ( x1 + dxClick ) < r ), 20258 isOverElement = isOverElementHeight && isOverElementWidth; 20259 20260 if ( this.options.tolerance === "pointer" || 20261 this.options.forcePointerForContainers || 20262 ( this.options.tolerance !== "pointer" && 20263 this.helperProportions[ this.floating ? "width" : "height" ] > 20264 item[ this.floating ? "width" : "height" ] ) 20265 ) { 20266 return isOverElement; 20267 } else { 20268 20269 return ( l < x1 + ( this.helperProportions.width / 2 ) && // Right Half 20270 x2 - ( this.helperProportions.width / 2 ) < r && // Left Half 20271 t < y1 + ( this.helperProportions.height / 2 ) && // Bottom Half 20272 y2 - ( this.helperProportions.height / 2 ) < b ); // Top Half 20273 20274 } 20275 }, 20276 20277 _intersectsWithPointer: function( item ) { 20278 var verticalDirection, horizontalDirection, 20279 isOverElementHeight = ( this.options.axis === "x" ) || 20280 this._isOverAxis( 20281 this.positionAbs.top + this.offset.click.top, item.top, item.height ), 20282 isOverElementWidth = ( this.options.axis === "y" ) || 20283 this._isOverAxis( 20284 this.positionAbs.left + this.offset.click.left, item.left, item.width ), 20285 isOverElement = isOverElementHeight && isOverElementWidth; 20286 20287 if ( !isOverElement ) { 20288 return false;
vendor: 18,528 bytes, lines 20289-20869
20289 } 20290 20291 verticalDirection = this.dragDirection.vertical; 20292 horizontalDirection = this.dragDirection.horizontal; 20293 20294 return this.floating ? 20295 ( ( horizontalDirection === "right" || verticalDirection === "down" ) ? 2 : 1 ) : 20296 ( verticalDirection && ( verticalDirection === "down" ? 2 : 1 ) ); 20297 20298 }, 20299 20300 _intersectsWithSides: function( item ) { 20301 20302 var isOverBottomHalf = this._isOverAxis( this.positionAbs.top + 20303 this.offset.click.top, item.top + ( item.height / 2 ), item.height ), 20304 isOverRightHalf = this._isOverAxis( this.positionAbs.left + 20305 this.offset.click.left, item.left + ( item.width / 2 ), item.width ), 20306 verticalDirection = this.dragDirection.vertical, 20307 horizontalDirection = this.dragDirection.horizontal; 20308 20309 if ( this.floating && horizontalDirection ) { 20310 return ( ( horizontalDirection === "right" && isOverRightHalf ) || 20311 ( horizontalDirection === "left" && !isOverRightHalf ) ); 20312 } else { 20313 return verticalDirection && ( ( verticalDirection === "down" && isOverBottomHalf ) || 20314 ( verticalDirection === "up" && !isOverBottomHalf ) ); 20315 } 20316 20317 }, 20318 20319 _getDragVerticalDirection: function() { 20320 var delta = this.positionAbs.top - this.lastPositionAbs.top; 20321 return delta !== 0 && ( delta > 0 ? "down" : "up" ); 20322 }, 20323 20324 _getDragHorizontalDirection: function() { 20325 var delta = this.positionAbs.left - this.lastPositionAbs.left; 20326 return delta !== 0 && ( delta > 0 ? "right" : "left" ); 20327 }, 20328 20329 refresh: function( event ) { 20330 this._refreshItems( event ); 20331 this._setHandleClassName(); 20332 this.refreshPositions(); 20333 return this; 20334 }, 20335 20336 _connectWith: function() { 20337 var options = this.options; 20338 return options.connectWith.constructor === String ? 20339 [ options.connectWith ] : 20340 options.connectWith; 20341 }, 20342 20343 _getItemsAsjQuery: function( connected ) { 20344 20345 var i, j, cur, inst, 20346 items = [], 20347 queries = [], 20348 connectWith = this._connectWith(); 20349 20350 if ( connectWith && connected ) { 20351 for ( i = connectWith.length - 1; i >= 0; i-- ) { 20352 cur = $( connectWith[ i ], this.document[ 0 ] ); 20353 for ( j = cur.length - 1; j >= 0; j-- ) { 20354 inst = $.data( cur[ j ], this.widgetFullName ); 20355 if ( inst && inst !== this && !inst.options.disabled ) { 20356 queries.push( [ typeof inst.options.items === "function" ? 20357 inst.options.items.call( inst.element ) : 20358 $( inst.options.items, inst.element ) 20359 .not( ".ui-sortable-helper" ) 20360 .not( ".ui-sortable-placeholder" ), inst ] ); 20361 } 20362 } 20363 } 20364 } 20365 20366 queries.push( [ typeof this.options.items === "function" ? 20367 this.options.items 20368 .call( this.element, null, { options: this.options, item: this.currentItem } ) : 20369 $( this.options.items, this.element ) 20370 .not( ".ui-sortable-helper" ) 20371 .not( ".ui-sortable-placeholder" ), this ] ); 20372 20373 function addItems() { 20374 items.push( this ); 20375 } 20376 for ( i = queries.length - 1; i >= 0; i-- ) { 20377 queries[ i ][ 0 ].each( addItems ); 20378 } 20379 20380 return $( items ); 20381 20382 }, 20383 20384 _removeCurrentsFromItems: function() { 20385 20386 var list = this.currentItem.find( ":data(" + this.widgetName + "-item)" ); 20387 20388 this.items = $.grep( this.items, function( item ) { 20389 for ( var j = 0; j < list.length; j++ ) { 20390 if ( list[ j ] === item.item[ 0 ] ) { 20391 return false; 20392 } 20393 } 20394 return true; 20395 } ); 20396 20397 }, 20398 20399 _refreshItems: function( event ) { 20400 20401 this.items = []; 20402 this.containers = [ this ]; 20403 20404 var i, j, cur, inst, targetData, _queries, item, queriesLength, 20405 items = this.items, 20406 queries = [ [ typeof this.options.items === "function" ? 20407 this.options.items.call( this.element[ 0 ], event, { item: this.currentItem } ) : 20408 $( this.options.items, this.element ), this ] ], 20409 connectWith = this._connectWith(); 20410 20411 //Shouldn't be run the first time through due to massive slow-down 20412 if ( connectWith && this.ready ) { 20413 for ( i = connectWith.length - 1; i >= 0; i-- ) { 20414 cur = $( connectWith[ i ], this.document[ 0 ] ); 20415 for ( j = cur.length - 1; j >= 0; j-- ) { 20416 inst = $.data( cur[ j ], this.widgetFullName ); 20417 if ( inst && inst !== this && !inst.options.disabled ) { 20418 queries.push( [ typeof inst.options.items === "function" ? 20419 inst.options.items 20420 .call( inst.element[ 0 ], event, { item: this.currentItem } ) : 20421 $( inst.options.items, inst.element ), inst ] ); 20422 this.containers.push( inst ); 20423 } 20424 } 20425 } 20426 } 20427 20428 for ( i = queries.length - 1; i >= 0; i-- ) { 20429 targetData = queries[ i ][ 1 ]; 20430 _queries = queries[ i ][ 0 ]; 20431 20432 for ( j = 0, queriesLength = _queries.length; j < queriesLength; j++ ) { 20433 item = $( _queries[ j ] ); 20434 20435 // Data for target checking (mouse manager) 20436 item.data( this.widgetName + "-item", targetData ); 20437 20438 items.push( { 20439 item: item, 20440 instance: targetData, 20441 width: 0, height: 0, 20442 left: 0, top: 0 20443 } ); 20444 } 20445 } 20446 20447 }, 20448 20449 _refreshItemPositions: function( fast ) { 20450 var i, item, t, p; 20451 20452 for ( i = this.items.length - 1; i >= 0; i-- ) { 20453 item = this.items[ i ]; 20454 20455 //We ignore calculating positions of all connected containers when we're not over them 20456 if ( this.currentContainer && item.instance !== this.currentContainer && 20457 item.item[ 0 ] !== this.currentItem[ 0 ] ) { 20458 continue; 20459 } 20460 20461 t = this.options.toleranceElement ? 20462 $( this.options.toleranceElement, item.item ) : 20463 item.item; 20464 20465 if ( !fast ) { 20466 item.width = t.outerWidth(); 20467 item.height = t.outerHeight(); 20468 } 20469 20470 p = t.offset(); 20471 item.left = p.left; 20472 item.top = p.top; 20473 } 20474 }, 20475 20476 refreshPositions: function( fast ) { 20477 20478 // Determine whether items are being displayed horizontally 20479 this.floating = this.items.length ? 20480 this.options.axis === "x" || this._isFloating( this.items[ 0 ].item ) : 20481 false; 20482 20483 // This has to be redone because due to the item being moved out/into the offsetParent, 20484 // the offsetParent's position will change 20485 if ( this.offsetParent && this.helper ) { 20486 this.offset.parent = this._getParentOffset(); 20487 } 20488 20489 this._refreshItemPositions( fast ); 20490 20491 var i, p; 20492 20493 if ( this.options.custom && this.options.custom.refreshContainers ) { 20494 this.options.custom.refreshContainers.call( this ); 20495 } else { 20496 for ( i = this.containers.length - 1; i >= 0; i-- ) { 20497 p = this.containers[ i ].element.offset(); 20498 this.containers[ i ].containerCache.left = p.left; 20499 this.containers[ i ].containerCache.top = p.top; 20500 this.containers[ i ].containerCache.width = 20501 this.containers[ i ].element.outerWidth(); 20502 this.containers[ i ].containerCache.height = 20503 this.containers[ i ].element.outerHeight(); 20504 } 20505 } 20506 20507 return this; 20508 }, 20509 20510 _createPlaceholder: function( that ) { 20511 that = that || this; 20512 var className, nodeName, 20513 o = that.options; 20514 20515 if ( !o.placeholder || o.placeholder.constructor === String ) { 20516 className = o.placeholder; 20517 nodeName = that.currentItem[ 0 ].nodeName.toLowerCase(); 20518 o.placeholder = { 20519 element: function() { 20520 20521 var element = $( "<" + nodeName + ">", that.document[ 0 ] ); 20522 20523 that._addClass( element, "ui-sortable-placeholder", 20524 className || that.currentItem[ 0 ].className ) 20525 ._removeClass( element, "ui-sortable-helper" ); 20526 20527 if ( nodeName === "tbody" ) { 20528 that._createTrPlaceholder( 20529 that.currentItem.find( "tr" ).eq( 0 ), 20530 $( "<tr>", that.document[ 0 ] ).appendTo( element ) 20531 ); 20532 } else if ( nodeName === "tr" ) { 20533 that._createTrPlaceholder( that.currentItem, element ); 20534 } else if ( nodeName === "img" ) { 20535 element.attr( "src", that.currentItem.attr( "src" ) ); 20536 } 20537 20538 if ( !className ) { 20539 element.css( "visibility", "hidden" ); 20540 } 20541 20542 return element; 20543 }, 20544 update: function( container, p ) { 20545 20546 // 1. If a className is set as 'placeholder option, we don't force sizes - 20547 // the class is responsible for that 20548 // 2. The option 'forcePlaceholderSize can be enabled to force it even if a 20549 // class name is specified 20550 if ( className && !o.forcePlaceholderSize ) { 20551 return; 20552 } 20553 20554 // If the element doesn't have a actual height or width by itself (without 20555 // styles coming from a stylesheet), it receives the inline height and width 20556 // from the dragged item. Or, if it's a tbody or tr, it's going to have a height 20557 // anyway since we're populating them with <td>s above, but they're unlikely to 20558 // be the correct height on their own if the row heights are dynamic, so we'll 20559 // always assign the height of the dragged item given forcePlaceholderSize 20560 // is true. 20561 if ( !p.height() || ( o.forcePlaceholderSize && 20562 ( nodeName === "tbody" || nodeName === "tr" ) ) ) { 20563 p.height( 20564 that.currentItem.innerHeight() - 20565 parseInt( that.currentItem.css( "paddingTop" ) || 0, 10 ) - 20566 parseInt( that.currentItem.css( "paddingBottom" ) || 0, 10 ) ); 20567 } 20568 if ( !p.width() ) { 20569 p.width( 20570 that.currentItem.innerWidth() - 20571 parseInt( that.currentItem.css( "paddingLeft" ) || 0, 10 ) - 20572 parseInt( that.currentItem.css( "paddingRight" ) || 0, 10 ) ); 20573 } 20574 } 20575 }; 20576 } 20577 20578 //Create the placeholder 20579 that.placeholder = $( o.placeholder.element.call( that.element, that.currentItem ) ); 20580 20581 //Append it after the actual current item 20582 that.currentItem.after( that.placeholder ); 20583 20584 //Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317) 20585 o.placeholder.update( that, that.placeholder ); 20586 20587 }, 20588 20589 _createTrPlaceholder: function( sourceTr, targetTr ) { 20590 var that = this; 20591 20592 sourceTr.children().each( function() { 20593 $( "<td> </td>", that.document[ 0 ] ) 20594 .attr( "colspan", $( this ).attr( "colspan" ) || 1 ) 20595 .appendTo( targetTr ); 20596 } ); 20597 }, 20598 20599 _contactContainers: function( event ) { 20600 var i, j, dist, itemWithLeastDistance, posProperty, sizeProperty, cur, nearBottom, 20601 floating, axis, 20602 innermostContainer = null, 20603 innermostIndex = null; 20604 20605 // Get innermost container that intersects with item 20606 for ( i = this.containers.length - 1; i >= 0; i-- ) { 20607 20608 // Never consider a container that's located within the item itself 20609 if ( $.contains( this.currentItem[ 0 ], this.containers[ i ].element[ 0 ] ) ) { 20610 continue; 20611 } 20612 20613 if ( this._intersectsWith( this.containers[ i ].containerCache ) ) { 20614 20615 // If we've already found a container and it's more "inner" than this, then continue 20616 if ( innermostContainer && 20617 $.contains( 20618 this.containers[ i ].element[ 0 ], 20619 innermostContainer.element[ 0 ] ) ) { 20620 continue; 20621 } 20622 20623 innermostContainer = this.containers[ i ]; 20624 innermostIndex = i; 20625 20626 } else { 20627 20628 // container doesn't intersect. trigger "out" event if necessary 20629 if ( this.containers[ i ].containerCache.over ) { 20630 this.containers[ i ]._trigger( "out", event, this._uiHash( this ) ); 20631 this.containers[ i ].containerCache.over = 0; 20632 } 20633 } 20634 20635 } 20636 20637 // If no intersecting containers found, return 20638 if ( !innermostContainer ) { 20639 return; 20640 } 20641 20642 // Move the item into the container if it's not there already 20643 if ( this.containers.length === 1 ) { 20644 if ( !this.containers[ innermostIndex ].containerCache.over ) { 20645 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) ); 20646 this.containers[ innermostIndex ].containerCache.over = 1; 20647 } 20648 } else { 20649 20650 // When entering a new container, we will find the item with the least distance and 20651 // append our item near it 20652 dist = 10000; 20653 itemWithLeastDistance = null; 20654 floating = innermostContainer.floating || this._isFloating( this.currentItem ); 20655 posProperty = floating ? "left" : "top"; 20656 sizeProperty = floating ? "width" : "height"; 20657 axis = floating ? "pageX" : "pageY"; 20658 20659 for ( j = this.items.length - 1; j >= 0; j-- ) { 20660 if ( !$.contains( 20661 this.containers[ innermostIndex ].element[ 0 ], this.items[ j ].item[ 0 ] ) 20662 ) { 20663 continue; 20664 } 20665 if ( this.items[ j ].item[ 0 ] === this.currentItem[ 0 ] ) { 20666 continue; 20667 } 20668 20669 cur = this.items[ j ].item.offset()[ posProperty ]; 20670 nearBottom = false; 20671 if ( event[ axis ] - cur > this.items[ j ][ sizeProperty ] / 2 ) { 20672 nearBottom = true; 20673 } 20674 20675 if ( Math.abs( event[ axis ] - cur ) < dist ) { 20676 dist = Math.abs( event[ axis ] - cur ); 20677 itemWithLeastDistance = this.items[ j ]; 20678 this.direction = nearBottom ? "up" : "down"; 20679 } 20680 } 20681 20682 //Check if dropOnEmpty is enabled 20683 if ( !itemWithLeastDistance && !this.options.dropOnEmpty ) { 20684 return; 20685 } 20686 20687 if ( this.currentContainer === this.containers[ innermostIndex ] ) { 20688 if ( !this.currentContainer.containerCache.over ) { 20689 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash() ); 20690 this.currentContainer.containerCache.over = 1; 20691 } 20692 return; 20693 } 20694 20695 if ( itemWithLeastDistance ) { 20696 this._rearrange( event, itemWithLeastDistance, null, true ); 20697 } else { 20698 this._rearrange( event, null, this.containers[ innermostIndex ].element, true ); 20699 } 20700 this._trigger( "change", event, this._uiHash() ); 20701 this.containers[ innermostIndex ]._trigger( "change", event, this._uiHash( this ) ); 20702 this.currentContainer = this.containers[ innermostIndex ]; 20703 20704 //Update the placeholder 20705 this.options.placeholder.update( this.currentContainer, this.placeholder ); 20706 20707 //Update scrollParent 20708 this.scrollParent = this.placeholder.scrollParent(); 20709 20710 //Update overflowOffset 20711 if ( this.scrollParent[ 0 ] !== this.document[ 0 ] && 20712 this.scrollParent[ 0 ].tagName !== "HTML" ) { 20713 this.overflowOffset = this.scrollParent.offset(); 20714 } 20715 20716 this.containers[ innermostIndex ]._trigger( "over", event, this._uiHash( this ) ); 20717 this.containers[ innermostIndex ].containerCache.over = 1; 20718 } 20719 20720 }, 20721 20722 _createHelper: function( event ) { 20723 20724 var o = this.options, 20725 helper = typeof o.helper === "function" ? 20726 $( o.helper.apply( this.element[ 0 ], [ event, this.currentItem ] ) ) : 20727 ( o.helper === "clone" ? this.currentItem.clone() : this.currentItem ); 20728 20729 //Add the helper to the DOM if that didn't happen already 20730 if ( !helper.parents( "body" ).length ) { 20731 this.appendTo[ 0 ].appendChild( helper[ 0 ] ); 20732 } 20733 20734 if ( helper[ 0 ] === this.currentItem[ 0 ] ) { 20735 this._storedCSS = { 20736 width: this.currentItem[ 0 ].style.width, 20737 height: this.currentItem[ 0 ].style.height, 20738 position: this.currentItem.css( "position" ), 20739 top: this.currentItem.css( "top" ), 20740 left: this.currentItem.css( "left" ) 20741 }; 20742 } 20743 20744 if ( !helper[ 0 ].style.width || o.forceHelperSize ) { 20745 helper.width( this.currentItem.width() ); 20746 } 20747 if ( !helper[ 0 ].style.height || o.forceHelperSize ) { 20748 helper.height( this.currentItem.height() ); 20749 } 20750 20751 return helper; 20752 20753 }, 20754 20755 _adjustOffsetFromHelper: function( obj ) { 20756 if ( typeof obj === "string" ) { 20757 obj = obj.split( " " ); 20758 } 20759 if ( Array.isArray( obj ) ) { 20760 obj = { left: +obj[ 0 ], top: +obj[ 1 ] || 0 }; 20761 } 20762 if ( "left" in obj ) { 20763 this.offset.click.left = obj.left + this.margins.left; 20764 } 20765 if ( "right" in obj ) { 20766 this.offset.click.left = this.helperProportions.width - obj.right + this.margins.left; 20767 } 20768 if ( "top" in obj ) { 20769 this.offset.click.top = obj.top + this.margins.top; 20770 } 20771 if ( "bottom" in obj ) { 20772 this.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top; 20773 } 20774 }, 20775 20776 _getParentOffset: function() { 20777 20778 //Get the offsetParent and cache its position 20779 this.offsetParent = this.helper.offsetParent(); 20780 var po = this.offsetParent.offset(); 20781 20782 // This is a special case where we need to modify a offset calculated on start, since the 20783 // following happened: 20784 // 1. The position of the helper is absolute, so it's position is calculated based on the 20785 // next positioned parent 20786 // 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't 20787 // the document, which means that the scroll is included in the initial calculation of the 20788 // offset of the parent, and never recalculated upon drag 20789 if ( this.cssPosition === "absolute" && this.scrollParent[ 0 ] !== this.document[ 0 ] && 20790 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) { 20791 po.left += this.scrollParent.scrollLeft(); 20792 po.top += this.scrollParent.scrollTop(); 20793 } 20794 20795 // This needs to be actually done for all browsers, since pageX/pageY includes 20796 // this information. 20797 if ( this.offsetParent[ 0 ] === this.document[ 0 ].body ) { 20798 po = { top: 0, left: 0 }; 20799 } 20800 20801 return { 20802 top: po.top + ( parseInt( this.offsetParent.css( "borderTopWidth" ), 10 ) || 0 ), 20803 left: po.left + ( parseInt( this.offsetParent.css( "borderLeftWidth" ), 10 ) || 0 ) 20804 }; 20805 20806 }, 20807 20808 _getRelativeOffset: function() { 20809 20810 if ( this.cssPosition === "relative" ) { 20811 var p = this.currentItem.position(); 20812 return { 20813 top: p.top - ( parseInt( this.helper.css( "top" ), 10 ) || 0 ) + 20814 this.scrollParent.scrollTop(), 20815 left: p.left - ( parseInt( this.helper.css( "left" ), 10 ) || 0 ) + 20816 this.scrollParent.scrollLeft() 20817 }; 20818 } else { 20819 return { top: 0, left: 0 }; 20820 } 20821 20822 }, 20823 20824 _cacheMargins: function() { 20825 this.margins = { 20826 left: ( parseInt( this.currentItem.css( "marginLeft" ), 10 ) || 0 ), 20827 top: ( parseInt( this.currentItem.css( "marginTop" ), 10 ) || 0 ) 20828 }; 20829 }, 20830 20831 _cacheHelperProportions: function() { 20832 this.helperProportions = { 20833 width: this.helper.outerWidth(), 20834 height: this.helper.outerHeight() 20835 }; 20836 }, 20837 20838 _setContainment: function() { 20839 20840 var ce, co, over, 20841 o = this.options; 20842 if ( o.containment === "parent" ) { 20843 o.containment = this.helper[ 0 ].parentNode; 20844 } 20845 if ( o.containment === "document" || o.containment === "window" ) { 20846 this.containment = [ 20847 0 - this.offset.relative.left - this.offset.parent.left, 20848 0 - this.offset.relative.top - this.offset.parent.top, 20849 o.containment === "document" ? 20850 this.document.width() : 20851 this.window.width() - this.helperProportions.width - this.margins.left, 20852 ( o.containment === "document" ? 20853 ( this.document.height() || document.body.parentNode.scrollHeight ) : 20854 this.window.height() || this.document[ 0 ].body.parentNode.scrollHeight 20855 ) - this.helperProportions.height - this.margins.top 20856 ]; 20857 } 20858 20859 if ( !( /^(document|window|parent)$/ ).test( o.containment ) ) { 20860 ce = $( o.containment )[ 0 ]; 20861 co = $( o.containment ).offset(); 20862 over = ( $( ce ).css( "overflow" ) !== "hidden" ); 20863 20864 this.containment = [ 20865 co.left + ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) + 20866 ( parseInt( $( ce ).css( "paddingLeft" ), 10 ) || 0 ) - this.margins.left, 20867 co.top + ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) + 20868 ( parseInt( $( ce ).css( "paddingTop" ), 10 ) || 0 ) - this.margins.top, 20869 co.left + ( over ? Math.max( ce.scrollWidth, ce.offsetWidth )
vendor: 1,747 bytes, lines 20869-20921
20869: ce.offsetWidth ) - 20870 ( parseInt( $( ce ).css( "borderLeftWidth" ), 10 ) || 0 ) - 20871 ( parseInt( $( ce ).css( "paddingRight" ), 10 ) || 0 ) - 20872 this.helperProportions.width - this.margins.left, 20873 co.top + ( over ? Math.max( ce.scrollHeight, ce.offsetHeight ) : ce.offsetHeight ) - 20874 ( parseInt( $( ce ).css( "borderTopWidth" ), 10 ) || 0 ) - 20875 ( parseInt( $( ce ).css( "paddingBottom" ), 10 ) || 0 ) - 20876 this.helperProportions.height - this.margins.top 20877 ]; 20878 } 20879 20880 }, 20881 20882 _convertPositionTo: function( d, pos ) { 20883 20884 if ( !pos ) { 20885 pos = this.position; 20886 } 20887 var mod = d === "absolute" ? 1 : -1, 20888 scroll = this.cssPosition === "absolute" && 20889 !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 20890 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? 20891 this.offsetParent : 20892 this.scrollParent, 20893 scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName ); 20894 20895 return { 20896 top: ( 20897 20898 // The absolute mouse position 20899 pos.top + 20900 20901 // Only for relative positioned nodes: Relative offset from element to offset parent 20902 this.offset.relative.top * mod + 20903 20904 // The offsetParent's offset without borders (offset + border) 20905 this.offset.parent.top * mod - 20906 ( ( this.cssPosition === "fixed" ? 20907 -this.scrollParent.scrollTop() : 20908 ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod ) 20909 ), 20910 left: ( 20911 20912 // The absolute mouse position 20913 pos.left + 20914 20915 // Only for relative positioned nodes: Relative offset from element to offset parent 20916 this.offset.relative.left * mod + 20917 20918 // The offsetParent's offset without borders (offset + border) 20919 this.offset.parent.left * mod - 20920 ( ( this.cssPosition === "fixed" ? 20921 -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 :
vendor: 8,861 bytes, lines 20922-21208
20922 scroll.scrollLeft() ) * mod ) 20923 ) 20924 }; 20925 20926 }, 20927 20928 _generatePosition: function( event ) { 20929 20930 var top, left, 20931 o = this.options, 20932 pageX = event.pageX, 20933 pageY = event.pageY, 20934 scroll = this.cssPosition === "absolute" && 20935 !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 20936 $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? 20937 this.offsetParent : 20938 this.scrollParent, 20939 scrollIsRootNode = ( /(html|body)/i ).test( scroll[ 0 ].tagName ); 20940 20941 // This is another very weird special case that only happens for relative elements: 20942 // 1. If the css position is relative 20943 // 2. and the scroll parent is the document or similar to the offset parent 20944 // we have to refresh the relative offset during the scroll so there are no jumps 20945 if ( this.cssPosition === "relative" && !( this.scrollParent[ 0 ] !== this.document[ 0 ] && 20946 this.scrollParent[ 0 ] !== this.offsetParent[ 0 ] ) ) { 20947 this.offset.relative = this._getRelativeOffset(); 20948 } 20949 20950 /* 20951 * - Position constraining - 20952 * Constrain the position to a mix of grid, containment. 20953 */ 20954 20955 if ( this.originalPosition ) { //If we are not dragging yet, we won't check for options 20956 20957 if ( this.containment ) { 20958 if ( event.pageX - this.offset.click.left < this.containment[ 0 ] ) { 20959 pageX = this.containment[ 0 ] + this.offset.click.left; 20960 } 20961 if ( event.pageY - this.offset.click.top < this.containment[ 1 ] ) { 20962 pageY = this.containment[ 1 ] + this.offset.click.top; 20963 } 20964 if ( event.pageX - this.offset.click.left > this.containment[ 2 ] ) { 20965 pageX = this.containment[ 2 ] + this.offset.click.left; 20966 } 20967 if ( event.pageY - this.offset.click.top > this.containment[ 3 ] ) { 20968 pageY = this.containment[ 3 ] + this.offset.click.top; 20969 } 20970 } 20971 20972 if ( o.grid ) { 20973 top = this.originalPageY + Math.round( ( pageY - this.originalPageY ) / 20974 o.grid[ 1 ] ) * o.grid[ 1 ]; 20975 pageY = this.containment ? 20976 ( ( top - this.offset.click.top >= this.containment[ 1 ] && 20977 top - this.offset.click.top <= this.containment[ 3 ] ) ? 20978 top : 20979 ( ( top - this.offset.click.top >= this.containment[ 1 ] ) ? 20980 top - o.grid[ 1 ] : top + o.grid[ 1 ] ) ) : 20981 top; 20982 20983 left = this.originalPageX + Math.round( ( pageX - this.originalPageX ) / 20984 o.grid[ 0 ] ) * o.grid[ 0 ]; 20985 pageX = this.containment ? 20986 ( ( left - this.offset.click.left >= this.containment[ 0 ] && 20987 left - this.offset.click.left <= this.containment[ 2 ] ) ? 20988 left : 20989 ( ( left - this.offset.click.left >= this.containment[ 0 ] ) ? 20990 left - o.grid[ 0 ] : left + o.grid[ 0 ] ) ) : 20991 left; 20992 } 20993 20994 } 20995 20996 return { 20997 top: ( 20998 20999 // The absolute mouse position 21000 pageY - 21001 21002 // Click offset (relative to the element) 21003 this.offset.click.top - 21004 21005 // Only for relative positioned nodes: Relative offset from element to offset parent 21006 this.offset.relative.top - 21007 21008 // The offsetParent's offset without borders (offset + border) 21009 this.offset.parent.top + 21010 ( ( this.cssPosition === "fixed" ? 21011 -this.scrollParent.scrollTop() : 21012 ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) ) 21013 ), 21014 left: ( 21015 21016 // The absolute mouse position 21017 pageX - 21018 21019 // Click offset (relative to the element) 21020 this.offset.click.left - 21021 21022 // Only for relative positioned nodes: Relative offset from element to offset parent 21023 this.offset.relative.left - 21024 21025 // The offsetParent's offset without borders (offset + border) 21026 this.offset.parent.left + 21027 ( ( this.cssPosition === "fixed" ? 21028 -this.scrollParent.scrollLeft() : 21029 scrollIsRootNode ? 0 : scroll.scrollLeft() ) ) 21030 ) 21031 }; 21032 21033 }, 21034 21035 _rearrange: function( event, i, a, hardRefresh ) { 21036 21037 if ( a ) { 21038 a[ 0 ].appendChild( this.placeholder[ 0 ] ); 21039 } else { 21040 i.item[ 0 ].parentNode.insertBefore( this.placeholder[ 0 ], 21041 ( this.direction === "down" ? i.item[ 0 ] : i.item[ 0 ].nextSibling ) ); 21042 } 21043 21044 //Various things done here to improve the performance: 21045 // 1. we create a setTimeout, that calls refreshPositions 21046 // 2. on the instance, we have a counter variable, that get's higher after every append 21047 // 3. on the local scope, we copy the counter variable, and check in the timeout, 21048 // if it's still the same 21049 // 4. this lets only the last addition to the timeout stack through 21050 this.counter = this.counter ? ++this.counter : 1; 21051 var counter = this.counter; 21052 21053 this._delay( function() { 21054 if ( counter === this.counter ) { 21055 21056 //Precompute after each DOM insertion, NOT on mousemove 21057 this.refreshPositions( !hardRefresh ); 21058 } 21059 } ); 21060 21061 }, 21062 21063 _clear: function( event, noPropagation ) { 21064 21065 this.reverting = false; 21066 21067 // We delay all events that have to be triggered to after the point where the placeholder 21068 // has been removed and everything else normalized again 21069 var i, 21070 delayedTriggers = []; 21071 21072 // We first have to update the dom position of the actual currentItem 21073 // Note: don't do it if the current item is already removed (by a user), or it gets 21074 // reappended (see #4088) 21075 if ( !this._noFinalSort && this.currentItem.parent().length ) { 21076 this.placeholder.before( this.currentItem ); 21077 } 21078 this._noFinalSort = null; 21079 21080 if ( this.helper[ 0 ] === this.currentItem[ 0 ] ) { 21081 for ( i in this._storedCSS ) { 21082 if ( this._storedCSS[ i ] === "auto" || this._storedCSS[ i ] === "static" ) { 21083 this._storedCSS[ i ] = ""; 21084 } 21085 } 21086 this.currentItem.css( this._storedCSS ); 21087 this._removeClass( this.currentItem, "ui-sortable-helper" ); 21088 } else { 21089 this.currentItem.show(); 21090 } 21091 21092 if ( this.fromOutside && !noPropagation ) { 21093 delayedTriggers.push( function( event ) { 21094 this._trigger( "receive", event, this._uiHash( this.fromOutside ) ); 21095 } ); 21096 } 21097 if ( ( this.fromOutside || 21098 this.domPosition.prev !== 21099 this.currentItem.prev().not( ".ui-sortable-helper" )[ 0 ] || 21100 this.domPosition.parent !== this.currentItem.parent()[ 0 ] ) && !noPropagation ) { 21101 21102 // Trigger update callback if the DOM position has changed 21103 delayedTriggers.push( function( event ) { 21104 this._trigger( "update", event, this._uiHash() ); 21105 } ); 21106 } 21107 21108 // Check if the items Container has Changed and trigger appropriate 21109 // events. 21110 if ( this !== this.currentContainer ) { 21111 if ( !noPropagation ) { 21112 delayedTriggers.push( function( event ) { 21113 this._trigger( "remove", event, this._uiHash() ); 21114 } ); 21115 delayedTriggers.push( ( function( c ) { 21116 return function( event ) { 21117 c._trigger( "receive", event, this._uiHash( this ) ); 21118 }; 21119 } ).call( this, this.currentContainer ) ); 21120 delayedTriggers.push( ( function( c ) { 21121 return function( event ) { 21122 c._trigger( "update", event, this._uiHash( this ) ); 21123 }; 21124 } ).call( this, this.currentContainer ) ); 21125 } 21126 } 21127 21128 //Post events to containers 21129 function delayEvent( type, instance, container ) { 21130 return function( event ) { 21131 container._trigger( type, event, instance._uiHash( instance ) ); 21132 }; 21133 } 21134 for ( i = this.containers.length - 1; i >= 0; i-- ) { 21135 if ( !noPropagation ) { 21136 delayedTriggers.push( delayEvent( "deactivate", this, this.containers[ i ] ) ); 21137 } 21138 if ( this.containers[ i ].containerCache.over ) { 21139 delayedTriggers.push( delayEvent( "out", this, this.containers[ i ] ) ); 21140 this.containers[ i ].containerCache.over = 0; 21141 } 21142 } 21143 21144 //Do what was originally in plugins 21145 if ( this._storedStylesheet ) { 21146 this._storedStylesheet.remove(); 21147 this._storedStylesheet = null; 21148 } 21149 if ( this._storedOpacity ) { 21150 this.helper.css( "opacity", this._storedOpacity ); 21151 } 21152 if ( this._storedZIndex ) { 21153 this.helper.css( "zIndex", this._storedZIndex === "auto" ? "" : this._storedZIndex ); 21154 } 21155 21156 this.dragging = false; 21157 21158 if ( !noPropagation ) { 21159 this._trigger( "beforeStop", event, this._uiHash() ); 21160 } 21161 21162 //$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, 21163 // it unbinds ALL events from the original node! 21164 this.placeholder[ 0 ].parentNode.removeChild( this.placeholder[ 0 ] ); 21165 21166 if ( !this.cancelHelperRemoval ) { 21167 if ( this.helper[ 0 ] !== this.currentItem[ 0 ] ) { 21168 this.helper.remove(); 21169 } 21170 this.helper = null; 21171 } 21172 21173 if ( !noPropagation ) { 21174 for ( i = 0; i < delayedTriggers.length; i++ ) { 21175 21176 // Trigger all delayed events 21177 delayedTriggers[ i ].call( this, event ); 21178 } 21179 this._trigger( "stop", event, this._uiHash() ); 21180 } 21181 21182 this.fromOutside = false; 21183 return !this.cancelHelperRemoval; 21184 21185 }, 21186 21187 _trigger: function() { 21188 if ( $.Widget.prototype._trigger.apply( this, arguments ) === false ) { 21189 this.cancel(); 21190 } 21191 }, 21192 21193 _uiHash: function( _inst ) { 21194 var inst = _inst || this; 21195 return { 21196 helper: inst.helper, 21197 placeholder: inst.placeholder || $( [] ), 21198 position: inst.position, 21199 originalPosition: inst.originalPosition, 21200 offset: inst.positionAbs, 21201 item: inst.currentItem, 21202 sender: _inst ? _inst.element : null 21203 }; 21204 } 21205 21206} ); 21207 21208} );
21209 21210 21211 21212 21213 21214/*! 21215 * jQuery UI Tabs 1.14.2 21216 * https://jqueryui.com 21217 * 21218 * Copyright OpenJS Foundation and other contributors 21219 * Released under the MIT license. 21220 * https://jquery.org/license 21221 */ 21222 21223//>>label: Tabs 21224//>>group: Widgets 21225//>>description: Transforms a set of container elements into a tab structure. 21226//>>docs: https://api.jqueryui.com/tabs/ 21227//>>demos: https://jqueryui.com/tabs/ 21228//>>css.structure: ../../themes/base/core.css 21229//>>css.structure: ../../themes/base/tabs.css 21230//>>css.theme: ../../themes/base/theme.css 21231 21232( function( factory ) { 21233 "use strict"; 21234 21235 if ( typeof define === "function" && define.amd ) { 21236 21237 // AMD. Register as an anonymous module. 21238 define( [ 21239 "jquery", 21240 "../keycode", 21241 "../unique-id", 21242 "../version", 21243 "../widget" 21244 ], factory ); 21245 } else { 21246 21247 // Browser globals 21248 factory( jQuery ); 21249 } 21250} )( function( $ ) { 21251"use strict";
vendor: 22,630 bytes, lines 21251-22123
21251 21252 21253$.widget( "ui.tabs", { 21254 version: "1.14.2", 21255 delay: 300, 21256 options: { 21257 active: null, 21258 classes: { 21259 "ui-tabs": "ui-corner-all", 21260 "ui-tabs-nav": "ui-corner-all", 21261 "ui-tabs-panel": "ui-corner-bottom", 21262 "ui-tabs-tab": "ui-corner-top" 21263 }, 21264 collapsible: false, 21265 event: "click", 21266 heightStyle: "content", 21267 hide: null, 21268 show: null, 21269 21270 // Callbacks 21271 activate: null, 21272 beforeActivate: null, 21273 beforeLoad: null, 21274 load: null 21275 }, 21276 21277 _isLocal: function( anchor ) { 21278 var anchorUrl = new URL( anchor.href ), 21279 locationUrl = new URL( location.href ); 21280 21281 return anchor.hash.length > 1 && 21282 21283 // `href` may contain a hash but also username & password; 21284 // we want to ignore them, so we check the three fields 21285 // below instead. 21286 anchorUrl.origin === locationUrl.origin && 21287 anchorUrl.pathname === locationUrl.pathname && 21288 anchorUrl.search === locationUrl.search; 21289 }, 21290 21291 _create: function() { 21292 var that = this, 21293 options = this.options; 21294 21295 this.running = false; 21296 21297 this._addClass( "ui-tabs", "ui-widget ui-widget-content" ); 21298 this._toggleClass( "ui-tabs-collapsible", null, options.collapsible ); 21299 21300 this._processTabs(); 21301 options.active = this._initialActive(); 21302 21303 // Take disabling tabs via class attribute from HTML 21304 // into account and update option properly. 21305 if ( Array.isArray( options.disabled ) ) { 21306 options.disabled = $.uniqueSort( options.disabled.concat( 21307 $.map( this.tabs.filter( ".ui-state-disabled" ), function( li ) { 21308 return that.tabs.index( li ); 21309 } ) 21310 ) ).sort(); 21311 } 21312 21313 // Check for length avoids error when initializing empty list 21314 if ( this.options.active !== false && this.anchors.length ) { 21315 this.active = this._findActive( options.active ); 21316 } else { 21317 this.active = $(); 21318 } 21319 21320 this._refresh(); 21321 21322 if ( this.active.length ) { 21323 this.load( options.active ); 21324 } 21325 }, 21326 21327 _initialActive: function() { 21328 var active = this.options.active, 21329 collapsible = this.options.collapsible, 21330 locationHash = location.hash.substring( 1 ), 21331 locationHashDecoded = decodeURIComponent( locationHash ); 21332 21333 if ( active === null ) { 21334 21335 // check the fragment identifier in the URL 21336 if ( locationHash ) { 21337 this.tabs.each( function( i, tab ) { 21338 if ( $( tab ).attr( "aria-controls" ) === locationHash ) { 21339 active = i; 21340 return false; 21341 } 21342 } ); 21343 21344 // If not found, decode the hash & try again. 21345 // See the comment in `_processTabs` under the `_isLocal` check 21346 // for more information. 21347 if ( active === null ) { 21348 this.tabs.each( function( i, tab ) { 21349 if ( $( tab ).attr( "aria-controls" ) === locationHashDecoded ) { 21350 active = i; 21351 return false; 21352 } 21353 } ); 21354 } 21355 } 21356 21357 // Check for a tab marked active via a class 21358 if ( active === null ) { 21359 active = this.tabs.index( this.tabs.filter( ".ui-tabs-active" ) ); 21360 } 21361 21362 // No active tab, set to false 21363 if ( active === null || active === -1 ) { 21364 active = this.tabs.length ? 0 : false; 21365 } 21366 } 21367 21368 // Handle numbers: negative, out of range 21369 if ( active !== false ) { 21370 active = this.tabs.index( this.tabs.eq( active ) ); 21371 if ( active === -1 ) { 21372 active = collapsible ? false : 0; 21373 } 21374 } 21375 21376 // Don't allow collapsible: false and active: false 21377 if ( !collapsible && active === false && this.anchors.length ) { 21378 active = 0; 21379 } 21380 21381 return active; 21382 }, 21383 21384 _getCreateEventData: function() { 21385 return { 21386 tab: this.active, 21387 panel: !this.active.length ? $() : this._getPanelForTab( this.active ) 21388 }; 21389 }, 21390 21391 _tabKeydown: function( event ) { 21392 var focusedTab = $( this.document[ 0 ].activeElement ).closest( "li" ), 21393 selectedIndex = this.tabs.index( focusedTab ), 21394 goingForward = true; 21395 21396 if ( this._handlePageNav( event ) ) { 21397 return; 21398 } 21399 21400 switch ( event.keyCode ) { 21401 case $.ui.keyCode.RIGHT: 21402 case $.ui.keyCode.DOWN: 21403 selectedIndex++; 21404 break; 21405 case $.ui.keyCode.UP: 21406 case $.ui.keyCode.LEFT: 21407 goingForward = false; 21408 selectedIndex--; 21409 break; 21410 case $.ui.keyCode.END: 21411 selectedIndex = this.anchors.length - 1; 21412 break; 21413 case $.ui.keyCode.HOME: 21414 selectedIndex = 0; 21415 break; 21416 case $.ui.keyCode.SPACE: 21417 21418 // Activate only, no collapsing 21419 event.preventDefault(); 21420 clearTimeout( this.activating ); 21421 this._activate( selectedIndex ); 21422 return; 21423 case $.ui.keyCode.ENTER: 21424 21425 // Toggle (cancel delayed activation, allow collapsing) 21426 event.preventDefault(); 21427 clearTimeout( this.activating ); 21428 21429 // Determine if we should collapse or activate 21430 this._activate( selectedIndex === this.options.active ? false : selectedIndex ); 21431 return; 21432 default: 21433 return; 21434 } 21435 21436 // Focus the appropriate tab, based on which key was pressed 21437 event.preventDefault(); 21438 clearTimeout( this.activating ); 21439 selectedIndex = this._focusNextTab( selectedIndex, goingForward ); 21440 21441 // Navigating with control/command key will prevent automatic activation 21442 if ( !event.ctrlKey && !event.metaKey ) { 21443 21444 // Update aria-selected immediately so that AT think the tab is already selected. 21445 // Otherwise AT may confuse the user by stating that they need to activate the tab, 21446 // but the tab will already be activated by the time the announcement finishes. 21447 focusedTab.attr( "aria-selected", "false" ); 21448 this.tabs.eq( selectedIndex ).attr( "aria-selected", "true" ); 21449 21450 this.activating = this._delay( function() { 21451 this.option( "active", selectedIndex ); 21452 }, this.delay ); 21453 } 21454 }, 21455 21456 _panelKeydown: function( event ) { 21457 if ( this._handlePageNav( event ) ) { 21458 return; 21459 } 21460 21461 // Ctrl+up moves focus to the current tab 21462 if ( event.ctrlKey && event.keyCode === $.ui.keyCode.UP ) { 21463 event.preventDefault(); 21464 this.active.trigger( "focus" ); 21465 } 21466 }, 21467 21468 // Alt+page up/down moves focus to the previous/next tab (and activates) 21469 _handlePageNav: function( event ) { 21470 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_UP ) { 21471 this._activate( this._focusNextTab( this.options.active - 1, false ) ); 21472 return true; 21473 } 21474 if ( event.altKey && event.keyCode === $.ui.keyCode.PAGE_DOWN ) { 21475 this._activate( this._focusNextTab( this.options.active + 1, true ) ); 21476 return true; 21477 } 21478 }, 21479 21480 _findNextTab: function( index, goingForward ) { 21481 var lastTabIndex = this.tabs.length - 1; 21482 21483 function constrain() { 21484 if ( index > lastTabIndex ) { 21485 index = 0; 21486 } 21487 if ( index < 0 ) { 21488 index = lastTabIndex; 21489 } 21490 return index; 21491 } 21492 21493 while ( $.inArray( constrain(), this.options.disabled ) !== -1 ) { 21494 index = goingForward ? index + 1 : index - 1; 21495 } 21496 21497 return index; 21498 }, 21499 21500 _focusNextTab: function( index, goingForward ) { 21501 index = this._findNextTab( index, goingForward ); 21502 this.tabs.eq( index ).trigger( "focus" ); 21503 return index; 21504 }, 21505 21506 _setOption: function( key, value ) { 21507 if ( key === "active" ) { 21508 21509 // _activate() will handle invalid values and update this.options 21510 this._activate( value ); 21511 return; 21512 } 21513 21514 this._super( key, value ); 21515 21516 if ( key === "collapsible" ) { 21517 this._toggleClass( "ui-tabs-collapsible", null, value ); 21518 21519 // Setting collapsible: false while collapsed; open first panel 21520 if ( !value && this.options.active === false ) { 21521 this._activate( 0 ); 21522 } 21523 } 21524 21525 if ( key === "event" ) { 21526 this._setupEvents( value ); 21527 } 21528 21529 if ( key === "heightStyle" ) { 21530 this._setupHeightStyle( value ); 21531 } 21532 }, 21533 21534 refresh: function() { 21535 var options = this.options, 21536 lis = this.tablist.children( ":has(a[href])" ); 21537 21538 // Get disabled tabs from class attribute from HTML 21539 // this will get converted to a boolean if needed in _refresh() 21540 options.disabled = $.map( lis.filter( ".ui-state-disabled" ), function( tab ) { 21541 return lis.index( tab ); 21542 } ); 21543 21544 this._processTabs(); 21545 21546 // Was collapsed or no tabs 21547 if ( options.active === false || !this.anchors.length ) { 21548 options.active = false; 21549 this.active = $(); 21550 21551 // was active, but active tab is gone 21552 } else if ( this.active.length && !$.contains( this.tablist[ 0 ], this.active[ 0 ] ) ) { 21553 21554 // all remaining tabs are disabled 21555 if ( this.tabs.length === options.disabled.length ) { 21556 options.active = false; 21557 this.active = $(); 21558 21559 // activate previous tab 21560 } else { 21561 this._activate( this._findNextTab( Math.max( 0, options.active - 1 ), false ) ); 21562 } 21563 21564 // was active, active tab still exists 21565 } else { 21566 21567 // make sure active index is correct 21568 options.active = this.tabs.index( this.active ); 21569 } 21570 21571 this._refresh(); 21572 }, 21573 21574 _refresh: function() { 21575 this._setOptionDisabled( this.options.disabled ); 21576 this._setupEvents( this.options.event ); 21577 this._setupHeightStyle( this.options.heightStyle ); 21578 21579 this.tabs.not( this.active ).attr( { 21580 "aria-selected": "false", 21581 "aria-expanded": "false", 21582 tabIndex: -1 21583 } ); 21584 this.panels.not( this._getPanelForTab( this.active ) ) 21585 .hide() 21586 .attr( { 21587 "aria-hidden": "true" 21588 } ); 21589 21590 // Make sure one tab is in the tab order 21591 if ( !this.active.length ) { 21592 this.tabs.eq( 0 ).attr( "tabIndex", 0 ); 21593 } else { 21594 this.active 21595 .attr( { 21596 "aria-selected": "true", 21597 "aria-expanded": "true", 21598 tabIndex: 0 21599 } ); 21600 this._addClass( this.active, "ui-tabs-active", "ui-state-active" ); 21601 this._getPanelForTab( this.active ) 21602 .show() 21603 .attr( { 21604 "aria-hidden": "false" 21605 } ); 21606 } 21607 }, 21608 21609 _processTabs: function() { 21610 var that = this, 21611 prevTabs = this.tabs, 21612 prevAnchors = this.anchors, 21613 prevPanels = this.panels; 21614 21615 this.tablist = this._getList().attr( "role", "tablist" ); 21616 this._addClass( this.tablist, "ui-tabs-nav", 21617 "ui-helper-reset ui-helper-clearfix ui-widget-header" ); 21618 21619 // Prevent users from focusing disabled tabs via click 21620 this.tablist 21621 .on( "mousedown" + this.eventNamespace, "> li", function( event ) { 21622 if ( $( this ).is( ".ui-state-disabled" ) ) { 21623 event.preventDefault(); 21624 } 21625 } ); 21626 21627 this.tabs = this.tablist.find( "> li:has(a[href])" ) 21628 .attr( { 21629 role: "tab", 21630 tabIndex: -1 21631 } ); 21632 this._addClass( this.tabs, "ui-tabs-tab", "ui-state-default" ); 21633 21634 this.anchors = this.tabs.map( function() { 21635 return $( "a", this )[ 0 ]; 21636 } ) 21637 .attr( { 21638 tabIndex: -1 21639 } ); 21640 this._addClass( this.anchors, "ui-tabs-anchor" ); 21641 21642 this.panels = $(); 21643 21644 this.anchors.each( function( i, anchor ) { 21645 var selector, panel, panelId, 21646 anchorId = $( anchor ).uniqueId().attr( "id" ), 21647 tab = $( anchor ).closest( "li" ), 21648 originalAriaControls = tab.attr( "aria-controls" ); 21649 21650 // Inline tab 21651 if ( that._isLocal( anchor ) ) { 21652 21653 // The "scrolling to a fragment" section of the HTML spec: 21654 // https://html.spec.whatwg.org/#scrolling-to-a-fragment 21655 // uses a concept of document's indicated part: 21656 // https://html.spec.whatwg.org/#the-indicated-part-of-the-document 21657 // Slightly below there's an algorithm to compute the indicated 21658 // part: 21659 // https://html.spec.whatwg.org/#the-indicated-part-of-the-document 21660 // First, the algorithm tries the hash as-is, without decoding. 21661 // Then, if one is not found, the same is attempted with a decoded 21662 // hash. Replicate this logic. 21663 selector = anchor.hash; 21664 panelId = selector.substring( 1 ); 21665 panel = that.element.find( "#" + CSS.escape( panelId ) ); 21666 if ( !panel.length ) { 21667 panelId = decodeURIComponent( panelId ); 21668 panel = that.element.find( "#" + CSS.escape( panelId ) ); 21669 } 21670 21671 // remote tab 21672 } else { 21673 21674 // If the tab doesn't already have aria-controls, 21675 // generate an id by using a throw-away element 21676 panelId = tab.attr( "aria-controls" ) || $( {} ).uniqueId()[ 0 ].id; 21677 selector = "#" + panelId; 21678 panel = that.element.find( selector ); 21679 if ( !panel.length ) { 21680 panel = that._createPanel( panelId ); 21681 panel.insertAfter( that.panels[ i - 1 ] || that.tablist ); 21682 } 21683 panel.attr( "aria-live", "polite" ); 21684 } 21685 21686 if ( panel.length ) { 21687 that.panels = that.panels.add( panel ); 21688 } 21689 if ( originalAriaControls ) { 21690 tab.data( "ui-tabs-aria-controls", originalAriaControls ); 21691 } 21692 tab.attr( { 21693 "aria-controls": panelId, 21694 "aria-labelledby": anchorId 21695 } ); 21696 panel.attr( "aria-labelledby", anchorId ); 21697 } ); 21698 21699 this.panels.attr( "role", "tabpanel" ); 21700 this._addClass( this.panels, "ui-tabs-panel", "ui-widget-content" ); 21701 21702 // Avoid memory leaks (#10056) 21703 if ( prevTabs ) { 21704 this._off( prevTabs.not( this.tabs ) ); 21705 this._off( prevAnchors.not( this.anchors ) ); 21706 this._off( prevPanels.not( this.panels ) ); 21707 } 21708 }, 21709 21710 // Allow overriding how to find the list for rare usage scenarios (#7715) 21711 _getList: function() { 21712 return this.tablist || this.element.find( "ol, ul" ).eq( 0 ); 21713 }, 21714 21715 _createPanel: function( id ) { 21716 return $( "<div>" ) 21717 .attr( "id", id ) 21718 .data( "ui-tabs-destroy", true ); 21719 }, 21720 21721 _setOptionDisabled: function( disabled ) { 21722 var currentItem, li, i; 21723 21724 if ( Array.isArray( disabled ) ) { 21725 if ( !disabled.length ) { 21726 disabled = false; 21727 } else if ( disabled.length === this.anchors.length ) { 21728 disabled = true; 21729 } 21730 } 21731 21732 // Disable tabs 21733 for ( i = 0; ( li = this.tabs[ i ] ); i++ ) { 21734 currentItem = $( li ); 21735 if ( disabled === true || $.inArray( i, disabled ) !== -1 ) { 21736 currentItem.attr( "aria-disabled", "true" ); 21737 this._addClass( currentItem, null, "ui-state-disabled" ); 21738 } else { 21739 currentItem.removeAttr( "aria-disabled" ); 21740 this._removeClass( currentItem, null, "ui-state-disabled" ); 21741 } 21742 } 21743 21744 this.options.disabled = disabled; 21745 21746 this._toggleClass( this.widget(), this.widgetFullName + "-disabled", null, 21747 disabled === true ); 21748 }, 21749 21750 _setupEvents: function( event ) { 21751 var events = {}; 21752 if ( event ) { 21753 $.each( event.split( " " ), function( index, eventName ) { 21754 events[ eventName ] = "_eventHandler"; 21755 } ); 21756 } 21757 21758 this._off( this.anchors.add( this.tabs ).add( this.panels ) ); 21759 21760 // Always prevent the default action, even when disabled 21761 this._on( true, this.anchors, { 21762 click: function( event ) { 21763 event.preventDefault(); 21764 } 21765 } ); 21766 this._on( this.anchors, events ); 21767 this._on( this.tabs, { keydown: "_tabKeydown" } ); 21768 this._on( this.panels, { keydown: "_panelKeydown" } ); 21769 21770 this._focusable( this.tabs ); 21771 this._hoverable( this.tabs ); 21772 }, 21773 21774 _setupHeightStyle: function( heightStyle ) { 21775 var maxHeight, 21776 parent = this.element.parent(); 21777 21778 if ( heightStyle === "fill" ) { 21779 maxHeight = parent.height(); 21780 maxHeight -= this.element.outerHeight() - this.element.height(); 21781 21782 this.element.siblings( ":visible" ).each( function() { 21783 var elem = $( this ), 21784 position = elem.css( "position" ); 21785 21786 if ( position === "absolute" || position === "fixed" ) { 21787 return; 21788 } 21789 maxHeight -= elem.outerHeight( true ); 21790 } ); 21791 21792 this.element.children().not( this.panels ).each( function() { 21793 maxHeight -= $( this ).outerHeight( true ); 21794 } ); 21795 21796 this.panels.each( function() { 21797 $( this ).height( Math.max( 0, maxHeight - 21798 $( this ).innerHeight() + $( this ).height() ) ); 21799 } ) 21800 .css( "overflow", "auto" ); 21801 } else if ( heightStyle === "auto" ) { 21802 maxHeight = 0; 21803 this.panels.each( function() { 21804 maxHeight = Math.max( maxHeight, $( this ).height( "" ).height() ); 21805 } ).height( maxHeight ); 21806 } 21807 }, 21808 21809 _eventHandler: function( event ) { 21810 var options = this.options, 21811 active = this.active, 21812 anchor = $( event.currentTarget ), 21813 tab = anchor.closest( "li" ), 21814 clickedIsActive = tab[ 0 ] === active[ 0 ], 21815 collapsing = clickedIsActive && options.collapsible, 21816 toShow = collapsing ? $() : this._getPanelForTab( tab ), 21817 toHide = !active.length ? $() : this._getPanelForTab( active ), 21818 eventData = { 21819 oldTab: active, 21820 oldPanel: toHide, 21821 newTab: collapsing ? $() : tab, 21822 newPanel: toShow 21823 }; 21824 21825 event.preventDefault(); 21826 21827 if ( tab.hasClass( "ui-state-disabled" ) || 21828 21829 // tab is already loading 21830 tab.hasClass( "ui-tabs-loading" ) || 21831 21832 // can't switch durning an animation 21833 this.running || 21834 21835 // click on active header, but not collapsible 21836 ( clickedIsActive && !options.collapsible ) || 21837 21838 // allow canceling activation 21839 ( this._trigger( "beforeActivate", event, eventData ) === false ) ) { 21840 return; 21841 } 21842 21843 options.active = collapsing ? false : this.tabs.index( tab ); 21844 21845 this.active = clickedIsActive ? $() : tab; 21846 if ( this.xhr ) { 21847 this.xhr.abort(); 21848 } 21849 21850 if ( !toHide.length && !toShow.length ) { 21851 $.error( "jQuery UI Tabs: Mismatching fragment identifier." ); 21852 } 21853 21854 if ( toShow.length ) { 21855 this.load( this.tabs.index( tab ), event ); 21856 } 21857 this._toggle( event, eventData ); 21858 }, 21859 21860 // Handles show/hide for selecting tabs 21861 _toggle: function( event, eventData ) { 21862 var that = this, 21863 toShow = eventData.newPanel, 21864 toHide = eventData.oldPanel; 21865 21866 this.running = true; 21867 21868 function complete() { 21869 that.running = false; 21870 that._trigger( "activate", event, eventData ); 21871 } 21872 21873 function show() { 21874 that._addClass( eventData.newTab.closest( "li" ), "ui-tabs-active", "ui-state-active" ); 21875 21876 if ( toShow.length && that.options.show ) { 21877 that._show( toShow, that.options.show, complete ); 21878 } else { 21879 toShow.show(); 21880 complete(); 21881 } 21882 } 21883 21884 // Start out by hiding, then showing, then completing 21885 if ( toHide.length && this.options.hide ) { 21886 this._hide( toHide, this.options.hide, function() { 21887 that._removeClass( eventData.oldTab.closest( "li" ), 21888 "ui-tabs-active", "ui-state-active" ); 21889 show(); 21890 } ); 21891 } else { 21892 this._removeClass( eventData.oldTab.closest( "li" ), 21893 "ui-tabs-active", "ui-state-active" ); 21894 toHide.hide(); 21895 show(); 21896 } 21897 21898 toHide.attr( "aria-hidden", "true" ); 21899 eventData.oldTab.attr( { 21900 "aria-selected": "false", 21901 "aria-expanded": "false" 21902 } ); 21903 21904 // If we're switching tabs, remove the old tab from the tab order. 21905 // If we're opening from collapsed state, remove the previous tab from the tab order. 21906 // If we're collapsing, then keep the collapsing tab in the tab order. 21907 if ( toShow.length && toHide.length ) { 21908 eventData.oldTab.attr( "tabIndex", -1 ); 21909 } else if ( toShow.length ) { 21910 this.tabs.filter( function() { 21911 return $( this ).attr( "tabIndex" ) === 0; 21912 } ) 21913 .attr( "tabIndex", -1 ); 21914 } 21915 21916 toShow.attr( "aria-hidden", "false" ); 21917 eventData.newTab.attr( { 21918 "aria-selected": "true", 21919 "aria-expanded": "true", 21920 tabIndex: 0 21921 } ); 21922 }, 21923 21924 _activate: function( index ) { 21925 var anchor, 21926 active = this._findActive( index ); 21927 21928 // Trying to activate the already active panel 21929 if ( active[ 0 ] === this.active[ 0 ] ) { 21930 return; 21931 } 21932 21933 // Trying to collapse, simulate a click on the current active header 21934 if ( !active.length ) { 21935 active = this.active; 21936 } 21937 21938 anchor = active.find( ".ui-tabs-anchor" )[ 0 ]; 21939 this._eventHandler( { 21940 target: anchor, 21941 currentTarget: anchor, 21942 preventDefault: $.noop 21943 } ); 21944 }, 21945 21946 _findActive: function( index ) { 21947 return index === false ? $() : this.tabs.eq( index ); 21948 }, 21949 21950 _getIndex: function( index ) { 21951 21952 // meta-function to give users option to provide a href string instead of a numerical index. 21953 if ( typeof index === "string" ) { 21954 index = this.anchors.index( this.anchors.filter( "[href$='" + 21955 CSS.escape( index ) + "']" ) ); 21956 } 21957 21958 return index; 21959 }, 21960 21961 _destroy: function() { 21962 if ( this.xhr ) { 21963 this.xhr.abort(); 21964 } 21965 21966 this.tablist 21967 .removeAttr( "role" ) 21968 .off( this.eventNamespace ); 21969 21970 this.anchors 21971 .removeAttr( "role tabIndex" ) 21972 .removeUniqueId(); 21973 21974 this.tabs.add( this.panels ).each( function() { 21975 if ( $.data( this, "ui-tabs-destroy" ) ) { 21976 $( this ).remove(); 21977 } else { 21978 $( this ).removeAttr( "role tabIndex " + 21979 "aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded" ); 21980 } 21981 } ); 21982 21983 this.tabs.each( function() { 21984 var li = $( this ), 21985 prev = li.data( "ui-tabs-aria-controls" ); 21986 if ( prev ) { 21987 li 21988 .attr( "aria-controls", prev ) 21989 .removeData( "ui-tabs-aria-controls" ); 21990 } else { 21991 li.removeAttr( "aria-controls" ); 21992 } 21993 } ); 21994 21995 this.panels.show(); 21996 21997 if ( this.options.heightStyle !== "content" ) { 21998 this.panels.css( "height", "" ); 21999 } 22000 }, 22001 22002 enable: function( index ) { 22003 var disabled = this.options.disabled; 22004 if ( disabled === false ) { 22005 return; 22006 } 22007 22008 if ( index === undefined ) { 22009 disabled = false; 22010 } else { 22011 index = this._getIndex( index ); 22012 if ( Array.isArray( disabled ) ) { 22013 disabled = $.map( disabled, function( num ) { 22014 return num !== index ? num : null; 22015 } ); 22016 } else { 22017 disabled = $.map( this.tabs, function( li, num ) { 22018 return num !== index ? num : null; 22019 } ); 22020 } 22021 } 22022 this._setOptionDisabled( disabled ); 22023 }, 22024 22025 disable: function( index ) { 22026 var disabled = this.options.disabled; 22027 if ( disabled === true ) { 22028 return; 22029 } 22030 22031 if ( index === undefined ) { 22032 disabled = true; 22033 } else { 22034 index = this._getIndex( index ); 22035 if ( $.inArray( index, disabled ) !== -1 ) { 22036 return; 22037 } 22038 if ( Array.isArray( disabled ) ) { 22039 disabled = $.merge( [ index ], disabled ).sort(); 22040 } else { 22041 disabled = [ index ]; 22042 } 22043 } 22044 this._setOptionDisabled( disabled ); 22045 }, 22046 22047 load: function( index, event ) { 22048 index = this._getIndex( index ); 22049 var that = this, 22050 tab = this.tabs.eq( index ), 22051 anchor = tab.find( ".ui-tabs-anchor" ), 22052 panel = this._getPanelForTab( tab ), 22053 eventData = { 22054 tab: tab, 22055 panel: panel 22056 }, 22057 complete = function( jqXHR, status ) { 22058 if ( status === "abort" ) { 22059 that.panels.stop( false, true ); 22060 } 22061 22062 that._removeClass( tab, "ui-tabs-loading" ); 22063 panel.removeAttr( "aria-busy" ); 22064 22065 if ( jqXHR === that.xhr ) { 22066 delete that.xhr; 22067 } 22068 }; 22069 22070 // Not remote 22071 if ( this._isLocal( anchor[ 0 ] ) ) { 22072 return; 22073 } 22074 22075 this.xhr = $.ajax( this._ajaxSettings( anchor, event, eventData ) ); 22076 22077 if ( this.xhr.statusText !== "canceled" ) { 22078 this._addClass( tab, "ui-tabs-loading" ); 22079 panel.attr( "aria-busy", "true" ); 22080 22081 this.xhr 22082 .done( function( response, status, jqXHR ) { 22083 panel.html( response ); 22084 that._trigger( "load", event, eventData ); 22085 22086 complete( jqXHR, status ); 22087 } ) 22088 .fail( function( jqXHR, status ) { 22089 complete( jqXHR, status ); 22090 } ); 22091 } 22092 }, 22093 22094 _ajaxSettings: function( anchor, event, eventData ) { 22095 var that = this; 22096 return { 22097 url: anchor.attr( "href" ), 22098 beforeSend: function( jqXHR, settings ) { 22099 return that._trigger( "beforeLoad", event, 22100 $.extend( { jqXHR: jqXHR, ajaxSettings: settings }, eventData ) ); 22101 } 22102 }; 22103 }, 22104 22105 _getPanelForTab: function( tab ) { 22106 var id = $( tab ).attr( "aria-controls" ); 22107 return this.element.find( "#" + CSS.escape( id ) ); 22108 } 22109} ); 22110 22111// DEPRECATED 22112// TODO: Switch return back to widget declaration at top of file when this is removed 22113if ( $.uiBackCompat === true ) { 22114 22115 // Backcompat for ui-tab class (now ui-tabs-tab) 22116 $.widget( "ui.tabs", $.ui.tabs, { 22117 _processTabs: function() { 22118 this._superApply( arguments ); 22119 this._addClass( this.tabs, "ui-tab" ); 22120 } 22121 } ); 22122} 22123
22124return $.ui.tabs; 22125 22126} ); 22127/* jshint node: true */ 22128 22129/** 22130 * Unobtrusive scripting adapter for jQuery 22131 * https://github.com/rails/jquery-ujs 22132 * 22133 * Requires jQuery 1.8.0 or later. 22134 * 22135 * Released under the MIT license 22136 * 22137 */ 22138 22139(function() { 22140 'use strict'; 22141 22142 var jqueryUjsInit = function($, undefined) { 22143 22144 // Cut down on the number of issues from people inadvertently including jquery_ujs twice 22145 // by detecting and raising an error when it happens. 22146 if ( $.rails !== undefined ) { 22147 $.error('jquery-ujs has already been loaded!'); 22148 } 22149 22150 // Shorthand to make it a little easier to call public rails functions from within rails.js 22151 var rails; 22152 var $document = $(document); 22153 22154 $.rails = rails = { 22155 // Link elements bound by jquery-ujs 22156 linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]', 22157 22158 // Button elements bound by jquery-ujs 22159 buttonClickSelector: 'button[data-remote]:not([form]):not(form button), button[data-confirm]:not([form]):not(form button)', 22160 22161 // Select elements bound by jquery-ujs 22162 inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]', 22163 22164 // Form elements bound by jquery-ujs 22165 formSubmitSelector: 'form:not([data-turbo=true])', 22166 22167 // Form input elements bound by jquery-ujs 22168 formInputClickSelector: 'form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])', 22169 22170 // Form input elements disabled during form submission 22171 disableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled', 22172 22173 // Form input elements re-enabled after form submission 22174 enableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled', 22175 22176 // Form required input elements 22177 requiredInputSelector: 'input[name][required]:not([disabled]), textarea[name][required]:not([disabled])', 22178 22179 // Form file input elements 22180 fileInputSelector: 'input[name][type=file]:not([disabled])', 22181 22182 // Link onClick disable selector with possible reenable after remote submission 22183 linkDisableSelector: 'a[data-disable-with], a[data-disable]', 22184 22185 // Button onClick disable selector with possible reenable after remote submission 22186 buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]', 22187 22188 // Up-to-date Cross-Site Request Forgery token 22189 csrfToken: function() { 22190 return $('meta[name=csrf-token]').attr('content'); 22191 }, 22192 22193 // URL param that must contain the CSRF token 22194 csrfParam: function() { 22195 return $('meta[name=csrf-param]').attr('content'); 22196 }, 22197 22198 // Make sure that every Ajax request sends the CSRF token 22199 CSRFProtection: function(xhr) { 22200 var token = rails.csrfToken(); 22201 if (token) xhr.setRequestHeader('X-CSRF-Token', token); 22202 }, 22203 22204 // Make sure that all forms have actual up-to-date tokens (cached forms contain old ones) 22205 refreshCSRFTokens: function(){ 22206 $('form input[name="' + rails.csrfParam() + '"]').val(rails.csrfToken()); 22207 }, 22208 22209 // Triggers an event on an element and returns false if the event result is false 22210 fire: function(obj, name, data) { 22211 var event = $.Event(name); 22212 obj.trigger(event, data); 22213 return event.result !== false; 22214 }, 22215 22216 // Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm 22217 confirm: function(message) { 22218 return confirm(message); 22219 }, 22220 22221 // Default ajax function, may be overridden with custom function in $.rails.ajax 22222 ajax: function(options) { 22223 return $.ajax(options); 22224 }, 22225 22226 // Default way to get an element's href. May be overridden at $.rails.href. 22227 href: function(element) { 22228 return element[0].href; 22229 }, 22230 22231 // Checks "data-remote" if true to handle the request through a XHR request. 22232 isRemote: function(element) { 22233 return element.data('remote') !== undefined && element.data('remote') !== false; 22234 }, 22235 22236 // Submits "remote" forms and links with ajax 22237 handleRemote: function(element) { 22238 var method, url, data, withCredentials, dataType, options; 22239 22240 if (rails.fire(element, 'ajax:before')) { 22241 withCredentials = element.data('with-credentials') || null; 22242 dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType); 22243 22244 if (element.is('form')) { 22245 method = element.data('ujs:submit-button-formmethod') || element.attr('method'); 22246 url = element.data('ujs:submit-button-formaction') || element.attr('action'); 22247 data = $(element[0]).serializeArray(); 22248 // memoized value from clicked submit button 22249 var button = element.data('ujs:submit-button'); 22250 if (button) { 22251 data.push(button); 22252 element.data('ujs:submit-button', null); 22253 } 22254 element.data('ujs:submit-button-formmethod', null); 22255 element.data('ujs:submit-button-formaction', null); 22256 } else if (element.is(rails.inputChangeSelector)) { 22257 method = element.data('method'); 22258 url = element.data('url'); 22259 data = element.serialize(); 22260 if (element.data('params')) data = data + '&' + element.data('params'); 22261 } else if (element.is(rails.buttonClickSelector)) { 22262 method = element.data('method') || 'get'; 22263 url = element.data('url'); 22264 data = element.serialize(); 22265 if (element.data('params')) data = data + '&' + element.data('params'); 22266 } else { 22267 method = element.data('method'); 22268 url = rails.href(element); 22269 data = element.data('params') || null; 22270 } 22271 22272 options = { 22273 type: method || 'GET', data: data, dataType: dataType, 22274 // stopping the "ajax:beforeSend" event will cancel the ajax request 22275 beforeSend: function(xhr, settings) { 22276 if (settings.dataType === undefined) { 22277 xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script); 22278 } 22279 if (rails.fire(element, 'ajax:beforeSend', [xhr, settings])) {
22280 element.trigger('ajax:send', xhr); 22281 } else { 22282 return false; 22283 } 22284 }, 22285 success: function(data, status, xhr) { 22286 element.trigger('ajax:success', [data, status, xhr]); 22287 }, 22288 complete: function(xhr, status) { 22289 element.trigger('ajax:complete', [xhr, status]); 22290 }, 22291 error: function(xhr, status, error) { 22292 element.trigger('ajax:error', [xhr, status, error]); 22293 }, 22294 crossDomain: rails.isCrossDomain(url) 22295 }; 22296 22297 // There is no withCredentials for IE6-8 when 22298 // "Enable native XMLHTTP support" is disabled 22299 if (withCredentials) { 22300 options.xhrFields = { 22301 withCredentials: withCredentials 22302 }; 22303 } 22304 22305 // Only pass url to `ajax` options if not blank 22306 if (url) { options.url = url; } 22307 22308 return rails.ajax(options); 22309 } else { 22310 return false; 22311 } 22312 }, 22313 22314 // Determines if the request is a cross domain request. 22315 isCrossDomain: function(url) { 22316 var originAnchor = document.createElement('a'); 22317 originAnchor.href = location.href; 22318 var urlAnchor = document.createElement('a'); 22319 22320 try { 22321 urlAnchor.href = url; 22322 // This is a workaround to a IE bug. 22323 urlAnchor.href = urlAnchor.href; 22324 22325 // If URL protocol is false or is a string containing a single colon 22326 // *and* host are false, assume it is not a cross-domain request 22327 // (should only be the case for IE7 and IE compatibility mode). 22328 // Otherwise, evaluate protocol and host of the URL against the origin 22329 // protocol and host. 22330 return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) || 22331 (originAnchor.protocol + '//' + originAnchor.host === 22332 urlAnchor.protocol + '//' + urlAnchor.host)); 22333 } catch (e) { 22334 // If there is an error parsing the URL, assume it is crossDomain. 22335 return true; 22336 } 22337 }, 22338 22339 // Handles "data-method" on links such as: 22340 // <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a> 22341 handleMethod: function(link) { 22342 var href = rails.href(link), 22343 method = link.data('method'), 22344 target = link.attr('target'), 22345 csrfToken = rails.csrfToken(), 22346 csrfParam = rails.csrfParam(), 22347 form = $('<form method="post" action="' + href + '"></form>'), 22348 metadataInput = '<input name="_method" value="' + method + '" type="hidden" />'; 22349 22350 if (csrfParam !== undefined && csrfToken !== undefined && !rails.isCrossDomain(href)) { 22351 metadataInput += '<input name="' + csrfParam + '" value="' + csrfToken + '" type="hidden" />'; 22352 } 22353 22354 if (target) { form.attr('target', target); } 22355 22356 form.hide().append(metadataInput).appendTo('body'); 22357 form.submit(); 22358 }, 22359 22360 // Helper function that returns form elements that match the specified CSS selector 22361 // If form is actually a "form" element this will return associated elements outside the from that have 22362 // the html form attribute set 22363 formElements: function(form, selector) { 22364 return form.is('form') ? $(form[0].elements).filter(selector) : form.find(selector); 22365 }, 22366 22367 /* Disables form elements: 22368 - Caches element value in 'ujs:enable-with' data store 22369 - Replaces element text with value of 'data-disable-with' attribute 22370 - Sets disabled property to true 22371 */ 22372 disableFormElements: function(form) { 22373 rails.formElements(form, rails.disableSelector).each(function() { 22374 rails.disableFormElement($(this)); 22375 }); 22376 }, 22377 22378 disableFormElement: function(element) { 22379 var method, replacement; 22380 22381 method = element.is('button') ? 'html' : 'val'; 22382 replacement = element.data('disable-with'); 22383 22384 if (replacement !== undefined) { 22385 element.data('ujs:enable-with', element[method]()); 22386 element[method](replacement); 22387 } 22388 22389 element.prop('disabled', true); 22390 element.data('ujs:disabled', true); 22391 }, 22392 22393 /* Re-enables disabled form elements: 22394 - Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`) 22395 - Sets disabled property to false 22396 */ 22397 enableFormElements: function(form) { 22398 rails.formElements(form, rails.enableSelector).each(function() { 22399 rails.enableFormElement($(this)); 22400 }); 22401 }, 22402 22403 enableFormElement: function(element) { 22404 var method = element.is('button') ? 'html' : 'val'; 22405 if (element.data('ujs:enable-with') !== undefined) { 22406 element[method](element.data('ujs:enable-with')); 22407 element.removeData('ujs:enable-with'); // clean up cache 22408 } 22409 element.prop('disabled', false); 22410 element.removeData('ujs:disabled'); 22411 }, 22412 22413 /* For 'data-confirm' attribute: 22414 - Fires `confirm` event 22415 - Shows the confirmation dialog 22416 - Fires the `confirm:complete` event 22417 22418 Returns `true` if no function stops the chain and user chose yes; `false` otherwise. 22419 Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog. 22420 Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function
22421 return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog. 22422 */ 22423 allowAction: function(element) { 22424 var message = element.data('confirm'), 22425 answer = false, callback; 22426 if (!message) { return true; } 22427 22428 if (rails.fire(element, 'confirm')) { 22429 try { 22430 answer = rails.confirm(message); 22431 } catch (e) { 22432 (console.error || console.log).call(console, e.stack || e); 22433 } 22434 callback = rails.fire(element, 'confirm:complete', [answer]); 22435 } 22436 return answer && callback; 22437 }, 22438 22439 // Helper function which checks for blank inputs in a form that match the specified CSS selector 22440 blankInputs: function(form, specifiedSelector, nonBlank) { 22441 var foundInputs = $(), 22442 input, 22443 valueToCheck, 22444 radiosForNameWithNoneSelected, 22445 radioName, 22446 selector = specifiedSelector || 'input,textarea', 22447 requiredInputs = form.find(selector), 22448 checkedRadioButtonNames = {}; 22449 22450 requiredInputs.each(function() { 22451 input = $(this); 22452 if (input.is('input[type=radio]')) { 22453 22454 // Don't count unchecked required radio as blank if other radio with same name is checked, 22455 // regardless of whether same-name radio input has required attribute or not. The spec 22456 // states https://www.w3.org/TR/html5/forms.html#the-required-attribute 22457 radioName = input.attr('name'); 22458 22459 // Skip if we've already seen the radio with this name. 22460 if (!checkedRadioButtonNames[radioName]) { 22461 22462 // If none checked 22463 if (form.find('input[type=radio]:checked[name="' + radioName + '"]').length === 0) { 22464 radiosForNameWithNoneSelected = form.find( 22465 'input[type=radio][name="' + radioName + '"]'); 22466 foundInputs = foundInputs.add(radiosForNameWithNoneSelected); 22467 } 22468 22469 // We only need to check each name once. 22470 checkedRadioButtonNames[radioName] = radioName; 22471 } 22472 } else { 22473 valueToCheck = input.is('input[type=checkbox],input[type=radio]') ? input.is(':checked') : !!input.val(); 22474 if (valueToCheck === nonBlank) { 22475 foundInputs = foundInputs.add(input); 22476 } 22477 } 22478 }); 22479 return foundInputs.length ? foundInputs : false; 22480 }, 22481 22482 // Helper function which checks for non-blank inputs in a form that match the specified CSS selector 22483 nonBlankInputs: function(form, specifiedSelector) { 22484 return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank 22485 }, 22486 22487 // Helper function, needed to provide consistent behavior in IE 22488 stopEverything: function(e) { 22489 $(e.target).trigger('ujs:everythingStopped'); 22490 e.stopImmediatePropagation(); 22491 return false; 22492 }, 22493 22494 // Replace element's html with the 'data-disable-with' after storing original html 22495 // and prevent clicking on it 22496 disableElement: function(element) { 22497 var replacement = element.data('disable-with'); 22498 22499 if (replacement !== undefined) { 22500 element.data('ujs:enable-with', element.html()); // store enabled state 22501 element.html(replacement); 22502 } 22503 22504 element.on('click.railsDisable', function(e) { // prevent further clicking 22505 return rails.stopEverything(e); 22506 }); 22507 element.data('ujs:disabled', true); 22508 }, 22509 22510 // Restore element to its original state which was disabled by 'disableElement' above 22511 enableElement: function(element) { 22512 if (element.data('ujs:enable-with') !== undefined) { 22513 element.html(element.data('ujs:enable-with')); // set to old enabled state 22514 element.removeData('ujs:enable-with'); // clean up cache 22515 } 22516 element.off('click.railsDisable'); // enable element 22517 element.removeData('ujs:disabled'); 22518 } 22519 }; 22520 22521 if (rails.fire($document, 'rails:attachBindings')) { 22522 22523 $.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }}); 22524 22525 // This event works the same as the load event, except that it fires every 22526 // time the page is loaded. 22527 // 22528 // See https://github.com/rails/jquery-ujs/issues/357 22529 // See https://developer.mozilla.org/en-US/docs/Using_Firefox_1.5_caching 22530 $(window).on('pageshow.rails', function () { 22531 $($.rails.enableSelector).each(function () { 22532 var element = $(this); 22533 22534 if (element.data('ujs:disabled')) { 22535 $.rails.enableFormElement(element); 22536 } 22537 }); 22538 22539 $($.rails.linkDisableSelector).each(function () { 22540 var element = $(this); 22541 22542 if (element.data('ujs:disabled')) { 22543 $.rails.enableElement(element); 22544 } 22545 }); 22546 }); 22547 22548 $document.on('ajax:complete', rails.linkDisableSelector, function() { 22549 rails.enableElement($(this)); 22550 }); 22551 22552 $document.on('ajax:complete', rails.buttonDisableSelector, function() { 22553 rails.enableFormElement($(this)); 22554 }); 22555 22556 $document.on('click.rails', rails.linkClickSelector, function(e) { 22557 var link = $(this), method = link.data('method'), data = link.data('params'), metaClick = e.metaKey || e.ctrlKey; 22558 if (!rails.allowAction(link)) return rails.stopEverything(e); 22559 22560 if (!metaClick && link.is(rails.linkDisableSelector)) rails.disableElement(link); 22561 22562 if (rails.isRemote(link)) { 22563 if (metaClick && (!method || method === 'GET') && !data) { return true; } 22564 22565 var handleRemote = rails.handleRemote(link); 22566 // Response from rails.handleRemote() will either be false or a deferred object promise. 22567 if (handleRemote === false) { 22568 rails.enableElement(link); 22569 } else { 22570 handleRemote.fail( function() { rails.enableElement(link); } ); 22571 } 22572 return false;
22573 22574 } else if (method) { 22575 rails.handleMethod(link); 22576 return false; 22577 } 22578 }); 22579 22580 $document.on('click.rails', rails.buttonClickSelector, function(e) { 22581 var button = $(this); 22582 22583 if (!rails.allowAction(button) || !rails.isRemote(button)) return rails.stopEverything(e); 22584 22585 if (button.is(rails.buttonDisableSelector)) rails.disableFormElement(button); 22586 22587 var handleRemote = rails.handleRemote(button); 22588 // Response from rails.handleRemote() will either be false or a deferred object promise. 22589 if (handleRemote === false) { 22590 rails.enableFormElement(button); 22591 } else { 22592 handleRemote.fail( function() { rails.enableFormElement(button); } ); 22593 } 22594 return false; 22595 }); 22596 22597 $document.on('change.rails', rails.inputChangeSelector, function(e) { 22598 var link = $(this); 22599 if (!rails.allowAction(link) || !rails.isRemote(link)) return rails.stopEverything(e); 22600 22601 rails.handleRemote(link); 22602 return false; 22603 }); 22604 22605 $document.on('submit.rails', rails.formSubmitSelector, function(e) { 22606 var form = $(this), 22607 remote = rails.isRemote(form), 22608 blankRequiredInputs, 22609 nonBlankFileInputs; 22610 22611 if (!rails.allowAction(form)) return rails.stopEverything(e); 22612 22613 // Skip other logic when required values are missing or file upload is present 22614 if (form.attr('novalidate') === undefined) { 22615 if (form.data('ujs:formnovalidate-button') === undefined) { 22616 blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector, false); 22617 if (blankRequiredInputs && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) { 22618 return rails.stopEverything(e); 22619 } 22620 } else { 22621 // Clear the formnovalidate in case the next button click is not on a formnovalidate button 22622 // Not strictly necessary to do here, since it is also reset on each button click, but just to be certain 22623 form.data('ujs:formnovalidate-button', undefined); 22624 } 22625 } 22626 22627 if (remote) { 22628 nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector); 22629 if (nonBlankFileInputs) { 22630 // Slight timeout so that the submit button gets properly serialized 22631 // (make it easy for event handler to serialize form without disabled values) 22632 setTimeout(function(){ rails.disableFormElements(form); }, 13); 22633 var aborted = rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]); 22634 22635 // Re-enable form elements if event bindings return false (canceling normal form submission) 22636 if (!aborted) { setTimeout(function(){ rails.enableFormElements(form); }, 13); } 22637 22638 return aborted; 22639 } 22640 22641 rails.handleRemote(form); 22642 return false; 22643 22644 } else { 22645 // Slight timeout so that the submit button gets properly serialized 22646 setTimeout(function(){ rails.disableFormElements(form); }, 13); 22647 } 22648 }); 22649 22650 $document.on('click.rails', rails.formInputClickSelector, function(event) { 22651 var button = $(this); 22652 22653 if (!rails.allowAction(button)) return rails.stopEverything(event); 22654 22655 // Register the pressed submit button 22656 var name = button.attr('name'), 22657 data = name ? {name:name, value:button.val()} : null; 22658 22659 var form = button.closest('form'); 22660 if (form.length === 0) { 22661 form = $('#' + button.attr('form')); 22662 } 22663 form.data('ujs:submit-button', data); 22664 22665 // Save attributes from button 22666 form.data('ujs:formnovalidate-button', button.attr('formnovalidate')); 22667 form.data('ujs:submit-button-formaction', button.attr('formaction')); 22668 form.data('ujs:submit-button-formmethod', button.attr('formmethod')); 22669 }); 22670 22671 $document.on('ajax:send.rails', rails.formSubmitSelector, function(event) { 22672 if (this === event.target) rails.disableFormElements($(this)); 22673 }); 22674 22675 $document.on('ajax:complete.rails', rails.formSubmitSelector, function(event) { 22676 if (this === event.target) rails.enableFormElements($(this)); 22677 }); 22678 22679 $(function(){ 22680 rails.refreshCSRFTokens(); 22681 }); 22682 } 22683 22684 }; 22685 22686 if (window.jQuery) { 22687 jqueryUjsInit(jQuery); 22688 } else if (typeof exports === 'object' && typeof module === 'object') { 22689 module.exports = jqueryUjsInit; 22690 } 22691})(); 22692/** 22693 * Warning: This file is auto-generated, do not modify. Instead, make your changes in 'app/javascript/active_admin/' and run `yarn build` 22694 */ 22695 22696 22697 22698 22699 22700 22701 22702 22703 22704(function(global, factory) { 22705 typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("jquery"), require("jquery-ui/ui/widgets/datepicker"), require("jquery-ui/ui/widgets/dialog"), require("jquery-ui/ui/widgets/sortable"), require("jquery-ui/ui/widgets/tabs"), require("jquery-ui/ui/widget"), require("jquery-ujs")) : typeof define === "function" && define.amd ? define([ "exports", "jquery", "jquery-ui/ui/widgets/datepicker", "jquery-ui/ui/widgets/dialog", "jquery-ui/ui/widgets/sortable", "jquery-ui/ui/widgets/tabs", "jquery-ui/ui/widget", "jquery-ujs" ], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, 22706 factory(global.ActiveAdmin = {})); 22707})(this, function(exports) { 22708 "use strict"; 22709 $.fn.serializeObject = function() { 22710 return this.serializeArray().reduce(function(obj, item) { 22711 obj[item.name] = item.value; 22712 return obj; 22713 }, {}); 22714 }; 22715 $.ui.dialog.prototype._focusTabbable = function() { 22716 this.uiDialog.focus(); 22717 }; 22718 function ModalDialog(message, inputs, callback) { 22719 var html = '<form id="dialog_confirm" title="' + message + '"><ul>'; 22720 for (var name in inputs) { 22721 var opts, wrapper; 22722 var type = inputs[name]; 22723 if (/^(datepicker|checkbox|text|number)$/.test(type)) { 22724 wrapper = "input"; 22725 } else if (type === "textarea") { 22726 wrapper = "textarea"; 22727 } else if ($.isArray(type)) { 22728 var _ref = [ "select", type, "" ]; 22729 wrapper = _ref[0]; 22730 opts = _ref[1]; 22731 type = _ref[2]; 22732 } else { 22733 throw new Error("Unsupported input type: {" + name + ": " + type + "}"); 22734 } 22735 var klass = type === "datepicker" ? type : ""; 22736 html += "<li>\n <label>" + (name.charAt(0).toUpperCase() + name.slice(1)) + "</label>\n <" + wrapper + ' name="' + name + '" class="' + klass + '" type="' + type + '">' + (opts ? function() { 22737 var result = [];
22738 opts.forEach(function(v) { 22739 var $elem = $("<option></option>"); 22740 if ($.isArray(v)) { 22741 $elem.text(v[0]).val(v[1]); 22742 } else { 22743 $elem.text(v); 22744 } 22745 result.push($elem.wrap("<div></div>").parent().html()); 22746 }); 22747 return result; 22748 }().join("") : "") + ("</" + wrapper + ">") + "</li>"; 22749 var _ref2 = []; 22750 wrapper = _ref2[0]; 22751 opts = _ref2[1]; 22752 type = _ref2[2]; 22753 klass = _ref2[3]; 22754 } 22755 html += "</ul></form>"; 22756 var form = $(html).appendTo("body"); 22757 $("body").trigger("modal_dialog:before_open", [ form ]); 22758 form.dialog({ 22759 modal: true, 22760 open: function open(_event, _ui) { 22761 $("body").trigger("modal_dialog:after_open", [ form ]); 22762 }, 22763 classes: { 22764 "ui-dialog": "active_admin_dialog" 22765 }, 22766 buttons: { 22767 OK: function OK() { 22768 callback($(this).serializeObject()); 22769 $(this).dialog("close"); 22770 }, 22771 Cancel: function Cancel() { 22772 $(this).dialog("close").remove(); 22773 } 22774 } 22775 }); 22776 } 22777 var onDOMReady$2 = function onDOMReady() {
22778 $(".batch_actions_selector li a").off("click confirm:complete"); 22779 $(".batch_actions_selector li a").on("click", function(event) { 22780 var _this = this; 22781 var message; 22782 event.stopPropagation(); 22783 event.preventDefault(); 22784 if (message = $(this).data("confirm")) { 22785 ModalDialog(message, $(this).data("inputs"), function(inputs) { 22786 $(_this).trigger("confirm:complete", inputs); 22787 }); 22788 } else { 22789 $(this).trigger("confirm:complete"); 22790 } 22791 }); 22792 $(".batch_actions_selector li a").on("confirm:complete", function(event, inputs) { 22793 var val; 22794 if (val = JSON.stringify(inputs)) { 22795 $("#batch_action_inputs").removeAttr("disabled").val(val); 22796 } else { 22797 $("#batch_action_inputs").attr("disabled", "disabled"); 22798 } 22799 $("#batch_action").val($(this).data("action")); 22800 $("#collection_selection").submit(); 22801 }); 22802 if ($(".batch_actions_selector").length && $(":checkbox.toggle_all").length) { 22803 if ($(".paginated_collection table.index_table").length) { 22804 $(".paginated_collection table.index_table").tableCheckboxToggler(); 22805 } else { 22806 $(".paginated_collection").checkboxToggler(); 22807 } 22808 $(document).on("change", ".paginated_collection :checkbox", function() { 22809 if ($(".paginated_collection :checkbox:checked").length && $(".dropdown_menu_list").children().length) { 22810 $(".batch_actions_selector").each(function() { 22811 $(this).aaDropdownMenu("enable"); 22812 }); 22813 } else { 22814 $(".batch_actions_selector").each(function() { 22815 $(this).aaDropdownMenu("disable"); 22816 }); 22817 } 22818 }); 22819 } 22820 }; 22821 $(document).ready(onDOMReady$2).on("page:load turbolinks:load", onDOMReady$2); 22822 var CheckboxToggler = function() { 22823 function CheckboxToggler(options, container) { 22824 this.options = options; 22825 this.container = container; 22826 this._init(); 22827 this._bind(); 22828 } 22829 var _proto = CheckboxToggler.prototype; 22830 _proto.option = function option(_key, _value) {}; 22831 _proto._init = function _init() { 22832 if (!this.container) { 22833 throw new Error("Container element not found"); 22834 } else { 22835 this.$container = $(this.container); 22836 } 22837 if (!this.$container.find(".toggle_all").length) { 22838 throw new Error('"toggle all" checkbox not found'); 22839 } else { 22840 this.toggle_all_checkbox = this.$container.find(".toggle_all"); 22841 } 22842 this.checkboxes = this.$container.find(":checkbox").not(this.toggle_all_checkbox); 22843 }; 22844 _proto._bind = function _bind() { 22845 var _this = this; 22846 this.checkboxes.change(function(event) { 22847 return _this._didChangeCheckbox(event.target); 22848 }); 22849 this.toggle_all_checkbox.change(function() { 22850 return _this._didChangeToggleAllCheckbox(); 22851 }); 22852 }; 22853 _proto._didChangeCheckbox = function _didChangeCheckbox(_checkbox) { 22854 var numChecked = this.checkboxes.filter(":checked").length; 22855 var allChecked = numChecked === this.checkboxes.length; 22856 var someChecked = numChecked > 0 && numChecked < this.checkboxes.length; 22857 this.toggle_all_checkbox.prop({ 22858 checked: allChecked, 22859 indeterminate: someChecked 22860 }); 22861 }; 22862 _proto._didChangeToggleAllCheckbox = function _didChangeToggleAllCheckbox() { 22863 var setting = this.toggle_all_checkbox.prop("checked"); 22864 this.checkboxes.prop({ 22865 checked: setting 22866 }); 22867 return setting; 22868 }; 22869 return CheckboxToggler; 22870 }(); 22871 $.widget.bridge("checkboxToggler", CheckboxToggler); 22872 (function($) { 22873 $(document).on("focus", "input.datepicker:not(.hasDatepicker)", function() { 22874 var input = $(this); 22875 if (input[0].type === "date") { 22876 return; 22877 } 22878 var defaults = { 22879 dateFormat: "yy-mm-dd" 22880 }; 22881 var options = input.data("datepicker-options"); 22882 input.datepicker($.extend(defaults, options)); 22883 input.datepicker("show"); 22884 }); 22885 })(jQuery); 22886 var DropdownMenu = function() { 22887 function DropdownMenu(options, element) { 22888 this.options = options; 22889 this.element = element; 22890 this.$element = $(this.element); 22891 var defaults = { 22892 fadeInDuration: 20, 22893 fadeOutDuration: 100, 22894 onClickActionItemCallback: null 22895 }; 22896 this.options = $.extend(defaults, this.options); 22897 this.isOpen = false;
22898 this.$menuButton = this.$element.find(".dropdown_menu_button"); 22899 this.$menuList = this.$element.find(".dropdown_menu_list_wrapper"); 22900 this._buildMenuList(); 22901 this._bind(); 22902 } 22903 var _proto = DropdownMenu.prototype; 22904 _proto.open = function open() { 22905 this.isOpen = true; 22906 this.$menuList.fadeIn(this.options.fadeInDuration); 22907 this._position(); 22908 return this; 22909 }; 22910 _proto.close = function close() { 22911 this.isOpen = false; 22912 this.$menuList.fadeOut(this.options.fadeOutDuration); 22913 return this; 22914 }; 22915 _proto.destroy = function destroy() { 22916 this.$element = null; 22917 return this; 22918 }; 22919 _proto.isDisabled = function isDisabled() { 22920 return this.$menuButton.hasClass("disabled"); 22921 }; 22922 _proto.disable = function disable() { 22923 this.$menuButton.addClass("disabled"); 22924 }; 22925 _proto.enable = function enable() { 22926 this.$menuButton.removeClass("disabled"); 22927 }; 22928 _proto.option = function option(key, value) { 22929 if ($.isPlainObject(key)) { 22930 return this.options = $.extend(true, this.options, key); 22931 } else if (key != null) { 22932 return this.options[key]; 22933 } else { 22934 return this.options[key] = value; 22935 } 22936 }; 22937 _proto._buildMenuList = function _buildMenuList() { 22938 this.$nipple = $('<div class="dropdown_menu_nipple"></div>'); 22939 this.$menuList.prepend(this.$nipple); 22940 this.$menuList.hide(); 22941 }; 22942 _proto._bind = function _bind() { 22943 var _this = this; 22944 $("body").click(function() { 22945 if (_this.isOpen) { 22946 _this.close(); 22947 } 22948 }); 22949 this.$menuButton.click(function() { 22950 if (!_this.isDisabled()) { 22951 if (_this.isOpen) { 22952 _this.close(); 22953 } else { 22954 _this.open(); 22955 } 22956 } 22957 return false; 22958 }); 22959 }; 22960 _proto._position = function _position() { 22961 this.$menuList.css("top", this.$menuButton.position().top + this.$menuButton.outerHeight() + 10); 22962 var button_left = this.$menuButton.position().left; 22963 var button_center = this.$menuButton.outerWidth() / 2; 22964 var button_right = button_left + button_center * 2; 22965 var menu_center = this.$menuList.outerWidth() / 2; 22966 var nipple_center = this.$nipple.outerWidth() / 2; 22967 var window_right = $(window).width(); 22968 var centered_menu_left = button_left + button_center - menu_center; 22969 var centered_menu_right = button_left + button_center + menu_center; 22970 if (centered_menu_left < 0) { 22971 this.$menuList.css("left", button_left); 22972 this.$nipple.css("left", button_center - nipple_center); 22973 } else if (centered_menu_right > window_right) { 22974 this.$menuList.css("right", window_right - button_right); 22975 this.$nipple.css("right", button_center - nipple_center); 22976 } else { 22977 this.$menuList.css("left", centered_menu_left); 22978 this.$nipple.css("left", menu_center - nipple_center); 22979 } 22980 }; 22981 return DropdownMenu; 22982 }(); 22983 $.widget.bridge("aaDropdownMenu", DropdownMenu); 22984 var onDOMReady$1 = function onDOMReady() { 22985 return $(".dropdown_menu").aaDropdownMenu(); 22986 }; 22987 $(document).ready(onDOMReady$1).on("page:load turbolinks:load", onDOMReady$1); 22988 function hasTurbolinks() { 22989 return typeof Turbolinks !== "undefined" && Turbolinks.supported; 22990 } 22991 function turbolinksVisit(params) { 22992 var path = [ window.location.pathname, "?", toQueryString(params) ].join(""); 22993 Turbolinks.visit(path); 22994 } 22995 function queryString() { 22996 return (window.location.search || "").replace(/^\?/, ""); 22997 } 22998 function queryStringToParams() { 22999 var decode = function decode(value) { 23000 return decodeURIComponent((value || "").replace(/\+/g, "%20")); 23001 }; 23002 return queryString().split("&").map(function(pair) { 23003 return pair.split("="); 23004 }).map(function(_ref) { 23005 var key = _ref[0], value = _ref[1]; 23006 return { 23007 name: decode(key), 23008 value: decode(value) 23009 }; 23010 }); 23011 } 23012 function toQueryString(params) { 23013 var encode = function encode(value) { 23014 return encodeURIComponent(value || ""); 23015 }; 23016 return params.map(function(_ref2) { 23017 var name = _ref2.name, value = _ref2.value; 23018 return [ encode(name), encode(value) ]; 23019 }).map(function(pair) { 23020 return pair.join("="); 23021 }).join("&"); 23022 } 23023 var Filters = function() { 23024 function Filters() {} 23025 Filters._clearForm = function _clearForm(event) { 23026 var regex = /^(q\[|q%5B|q%5b|page|utf8|commit)/; 23027 var params = queryStringToParams().filter(function(_ref) { 23028 var name = _ref.name; 23029 return !name.match(regex); 23030 }); 23031 event.preventDefault(); 23032 if (hasTurbolinks()) { 23033 turbolinksVisit(params); 23034 } else { 23035 window.location.search = toQueryString(params); 23036 } 23037 }; 23038 Filters._disableEmptyInputFields = function _disableEmptyInputFields(event) { 23039 var params = $(this).find(":input").filter(function(i, input) { 23040 return input.value === ""; 23041 }).prop({ 23042 disabled: true 23043 }).end().serializeArray(); 23044 if (hasTurbolinks()) { 23045 event.preventDefault(); 23046 turbolinksVisit(params); 23047 } 23048 }; 23049 Filters._setSearchType = function _setSearchType() { 23050 $(this).siblings("input").prop({ 23051 name: "q[" + this.value + "]" 23052 }); 23053 }; 23054 return Filters; 23055 }(); 23056 (function($) { 23057 $(document).on("click", ".clear_filters_btn", Filters._clearForm).on("submit", ".filter_form", Filters._disableEmptyInputFields).on("change", ".filter_form_field.select_and_search select", Filters._setSearchType); 23058 })(jQuery); 23059 $(function() { 23060 $(document).on("click", "a.button.has_many_remove", function(event) { 23061 event.preventDefault(); 23062 var parent = $(this).closest(".has_many_container"); 23063 var to_remove = $(this).closest("fieldset"); 23064 recompute_positions(parent); 23065 parent.trigger("has_many_remove:before", [ to_remove, parent ]); 23066 to_remove.remove(); 23067 return parent.trigger("has_many_remove:after", [ to_remove, parent ]); 23068 }); 23069 $(document).on("click", "a.button.has_many_add", function(event) { 23070 var before_add; 23071 event.preventDefault(); 23072 var parent = $(this).closest(".has_many_container"); 23073 parent.trigger(before_add = $.Event("has_many_add:before"), [ parent ]); 23074 if (!before_add.isDefaultPrevented()) { 23075 var index = parent.data("has_many_index") || parent.children("fieldset").length - 1; 23076 parent.data({ 23077 has_many_index: ++index 23078 }); 23079 var regex = new RegExp($(this).data("placeholder"), "g"); 23080 var html = $(this).data("html").replace(regex, index); 23081 var fieldset = $(html).insertBefore(this); 23082 recompute_positions(parent); 23083 return parent.trigger("has_many_add:after", [ fieldset, parent ]); 23084 } 23085 }); 23086 $(document).on("change", '.has_many_container[data-sortable] :input[name$="[_destroy]"]', function() { 23087 recompute_positions($(this).closest(".has_many")); 23088 }); 23089 $(document).on("has_many_add:after", ".has_many_container", init_sortable); 23090 }); 23091 var init_sortable = function init_sortable() { 23092 var elems = $(".has_many_container[data-sortable]:not(.ui-sortable)"); 23093 elems.sortable({ 23094 items: "> fieldset", 23095 handle: "> ol > .handle", 23096 start: function start(ev, ui) { 23097 ui.item.css({ 23098 opacity: .3 23099 }); 23100 }, 23101 stop: function stop(ev, ui) { 23102 ui.item.css({ 23103 opacity: 1 23104 }); 23105 recompute_positions($(this)); 23106 } 23107 }); 23108 elems.each(recompute_positions); 23109 }; 23110 var recompute_positions = function recompute_positions(parent) { 23111 parent = parent instanceof jQuery ? parent : $(this); 23112 var input_name = parent.data("sortable"); 23113 var position = parseInt(parent.data("sortable-start") || 0, 10); 23114 parent.children("fieldset").each(function() { 23115 var destroy_input = $(this).find("> ol > .input > :input[name$='[_destroy]']"); 23116 var sortable_input = $(this).find("> ol > .input > :input[name$='[" + input_name + "]']"); 23117 if (sortable_input.length) { 23118 sortable_input.val(destroy_input.is(":checked") ? "" : position++); 23119 } 23120 }); 23121 }; 23122 $(document).ready(init_sortable).on("page:load turbolinks:load", init_sortable); 23123 var PerPage = function() { 23124 function PerPage(element) { 23125 this.element = element; 23126 } 23127 var _proto = PerPage.prototype;
23128 _proto.update = function update() { 23129 var params = queryStringToParams().filter(function(_ref) { 23130 var name = _ref.name; 23131 return name != "per_page" || name != "page"; 23132 }); 23133 params.push({ 23134 name: "per_page", 23135 value: this.element.value 23136 }); 23137 if (hasTurbolinks()) { 23138 turbolinksVisit(params); 23139 } else { 23140 window.location.search = toQueryString(params); 23141 } 23142 }; 23143 PerPage._jQueryInterface = function _jQueryInterface(config) { 23144 return this.each(function() { 23145 var $this = $(this); 23146 var data = $this.data("perPage"); 23147 if (!data) { 23148 data = new PerPage(this); 23149 $this.data("perPage", data); 23150 } 23151 if (config === "update") { 23152 data[config](); 23153 } 23154 }); 23155 }; 23156 return PerPage; 23157 }(); 23158 (function($) { 23159 $(document).on("change", ".pagination_per_page > select", function(_event) { 23160 PerPage._jQueryInterface.call($(this), "update"); 23161 }); 23162 $.fn["perPage"] = PerPage._jQueryInterface; 23163 $.fn["perPage"].Constructor = PerPage; 23164 })(jQuery); 23165 function _inheritsLoose(t, o) { 23166 t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o); 23167 } 23168 function _setPrototypeOf(t, e) { 23169 return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t, e) { 23170 return t.__proto__ = e, t; 23171 }, _setPrototypeOf(t, e); 23172 } 23173 var TableCheckboxToggler = function(_CheckboxToggler) { 23174 function TableCheckboxToggler() { 23175 return _CheckboxToggler.apply(this, arguments) || this; 23176 } 23177 _inheritsLoose(TableCheckboxToggler, _CheckboxToggler); 23178 var _proto = TableCheckboxToggler.prototype; 23179 _proto._bind = function _bind() { 23180 var _this = this; 23181 _CheckboxToggler.prototype._bind.apply(this, arguments); 23182 this.$container.find("tbody td").click(function(event) { 23183 if (event.target.type !== "checkbox") { 23184 _this._didClickCell(event.target); 23185 } 23186 }); 23187 }; 23188 _proto._didChangeCheckbox = function _didChangeCheckbox(checkbox) { 23189 _CheckboxToggler.prototype._didChangeCheckbox.apply(this, arguments); 23190 $(checkbox).parents("tr").toggleClass("selected", checkbox.checked); 23191 }; 23192 _proto._didChangeToggleAllCheckbox = function _didChangeToggleAllCheckbox() { 23193 this.$container.find("tbody tr").toggleClass("selected", _CheckboxToggler.prototype._didChangeToggleAllCheckbox.apply(this, arguments)); 23194 }; 23195 _proto._didClickCell = function _didClickCell(cell) { 23196 $(cell).parent("tr").find(":checkbox").click(); 23197 }; 23198 return TableCheckboxToggler; 23199 }(CheckboxToggler); 23200 $.widget.bridge("tableCheckboxToggler", TableCheckboxToggler); 23201 var onDOMReady = function onDOMReady() { 23202 return $("#active_admin_content .tabs").tabs(); 23203 }; 23204 $(document).ready(onDOMReady).on("page:load turbolinks:load", onDOMReady); 23205 function modal_dialog(message, inputs, callback) { 23206 console.warn("ActiveAdmin.modal_dialog is deprecated in favor of ActiveAdmin.ModalDialog, please update usage."); 23207 return ModalDialog(message, inputs, callback); 23208 } 23209 exports.ModalDialog = ModalDialog; 23210 exports.modal_dialog = modal_dialog; 23211}); 23212/*! 23213 * Select2 4.0.13 23214 * https://select2.github.io 23215 * 23216 * Released under the MIT license 23217 * https://github.com/select2/select2/blob/master/LICENSE.md 23218 */ 23219;
vendor: 18,996 bytes, lines 23219-23788
23219(function (factory) { 23220 if (typeof define === 'function' && define.amd) { 23221 // AMD. Register as an anonymous module. 23222 define(['jquery'], factory); 23223 } else if (typeof module === 'object' && module.exports) { 23224 // Node/CommonJS 23225 module.exports = function (root, jQuery) { 23226 if (jQuery === undefined) { 23227 // require('jQuery') returns a factory that requires window to 23228 // build a jQuery instance, we normalize how we use modules 23229 // that require this pattern but the window provided is a noop 23230 // if it's defined (how jquery works) 23231 if (typeof window !== 'undefined') { 23232 jQuery = require('jquery'); 23233 } 23234 else { 23235 jQuery = require('jquery')(root); 23236 } 23237 } 23238 factory(jQuery); 23239 return jQuery; 23240 }; 23241 } else { 23242 // Browser globals 23243 factory(jQuery); 23244 } 23245} (function (jQuery) { 23246 // This is needed so we can catch the AMD loader configuration and use it 23247 // The inner file should be wrapped (by `banner.start.js`) in a function that 23248 // returns the AMD loader references. 23249 var S2 =(function () { 23250 // Restore the Select2 AMD loader so it can be used 23251 // Needed mostly in the language files, where the loader is not inserted 23252 if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) { 23253 var S2 = jQuery.fn.select2.amd; 23254 } 23255var S2;(function () { if (!S2 || !S2.requirejs) { 23256if (!S2) { S2 = {}; } else { require = S2; } 23257/** 23258 * @license almond 0.3.3 Copyright jQuery Foundation and other contributors. 23259 * Released under MIT license, http://github.com/requirejs/almond/LICENSE 23260 */ 23261//Going sloppy to avoid 'use strict' string cost, but strict practices should 23262//be followed. 23263/*global setTimeout: false */ 23264 23265var requirejs, require, define; 23266(function (undef) { 23267 var main, req, makeMap, handlers, 23268 defined = {}, 23269 waiting = {}, 23270 config = {}, 23271 defining = {}, 23272 hasOwn = Object.prototype.hasOwnProperty, 23273 aps = [].slice, 23274 jsSuffixRegExp = /\.js$/; 23275 23276 function hasProp(obj, prop) { 23277 return hasOwn.call(obj, prop); 23278 } 23279 23280 /** 23281 * Given a relative module name, like ./something, normalize it to 23282 * a real name that can be mapped to a path. 23283 * @param {String} name the relative name 23284 * @param {String} baseName a real name that the name arg is relative 23285 * to. 23286 * @returns {String} normalized name 23287 */ 23288 function normalize(name, baseName) { 23289 var nameParts, nameSegment, mapValue, foundMap, lastIndex, 23290 foundI, foundStarMap, starI, i, j, part, normalizedBaseParts, 23291 baseParts = baseName && baseName.split("/"), 23292 map = config.map, 23293 starMap = (map && map['*']) || {}; 23294 23295 //Adjust any relative paths. 23296 if (name) { 23297 name = name.split('/'); 23298 lastIndex = name.length - 1; 23299 23300 // If wanting node ID compatibility, strip .js from end 23301 // of IDs. Have to do this here, and not in nameToUrl 23302 // because node allows either .js or non .js to map 23303 // to same file. 23304 if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { 23305 name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); 23306 } 23307 23308 // Starts with a '.' so need the baseName 23309 if (name[0].charAt(0) === '.' && baseParts) { 23310 //Convert baseName to array, and lop off the last part, 23311 //so that . matches that 'directory' and not name of the baseName's 23312 //module. For instance, baseName of 'one/two/three', maps to 23313 //'one/two/three.js', but we want the directory, 'one/two' for 23314 //this normalization. 23315 normalizedBaseParts = baseParts.slice(0, baseParts.length - 1); 23316 name = normalizedBaseParts.concat(name); 23317 } 23318 23319 //start trimDots 23320 for (i = 0; i < name.length; i++) { 23321 part = name[i]; 23322 if (part === '.') { 23323 name.splice(i, 1); 23324 i -= 1; 23325 } else if (part === '..') { 23326 // If at the start, or previous value is still .., 23327 // keep them so that when converted to a path it may 23328 // still work when converted to a path, even though 23329 // as an ID it is less than ideal. In larger point 23330 // releases, may be better to just kick out an error. 23331 if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') { 23332 continue; 23333 } else if (i > 0) { 23334 name.splice(i - 1, 2); 23335 i -= 2; 23336 } 23337 } 23338 } 23339 //end trimDots 23340 23341 name = name.join('/'); 23342 } 23343 23344 //Apply map config if available. 23345 if ((baseParts || starMap) && map) { 23346 nameParts = name.split('/'); 23347 23348 for (i = nameParts.length; i > 0; i -= 1) { 23349 nameSegment = nameParts.slice(0, i).join("/"); 23350 23351 if (baseParts) { 23352 //Find the longest baseName segment match in the config. 23353 //So, do joins on the biggest to smallest lengths of baseParts. 23354 for (j = baseParts.length; j > 0; j -= 1) { 23355 mapValue = map[baseParts.slice(0, j).join('/')]; 23356 23357 //baseName segment has config, find if it has one for 23358 //this name. 23359 if (mapValue) { 23360 mapValue = mapValue[nameSegment]; 23361 if (mapValue) { 23362 //Match, update name to the new value. 23363 foundMap = mapValue; 23364 foundI = i; 23365 break; 23366 } 23367 } 23368 } 23369 } 23370 23371 if (foundMap) { 23372 break; 23373 } 23374 23375 //Check for a star map match, but just hold on to it, 23376 //if there is a shorter segment match later in a matching 23377 //config, then favor over this star map. 23378 if (!foundStarMap && starMap && starMap[nameSegment]) { 23379 foundStarMap = starMap[nameSegment]; 23380 starI = i; 23381 } 23382 } 23383 23384 if (!foundMap && foundStarMap) { 23385 foundMap = foundStarMap; 23386 foundI = starI; 23387 } 23388 23389 if (foundMap) { 23390 nameParts.splice(0, foundI, foundMap); 23391 name = nameParts.join('/'); 23392 } 23393 } 23394 23395 return name; 23396 } 23397 23398 function makeRequire(relName, forceSync) { 23399 return function () { 23400 //A version of a require function that passes a moduleName 23401 //value for items that may need to 23402 //look up paths relative to the moduleName 23403 var args = aps.call(arguments, 0); 23404 23405 //If first arg is not require('string'), and there is only 23406 //one arg, it is the array form without a callback. Insert 23407 //a null so that the following concat is correct. 23408 if (typeof args[0] !== 'string' && args.length === 1) { 23409 args.push(null); 23410 } 23411 return req.apply(undef, args.concat([relName, forceSync])); 23412 }; 23413 } 23414 23415 function makeNormalize(relName) { 23416 return function (name) { 23417 return normalize(name, relName); 23418 }; 23419 } 23420 23421 function makeLoad(depName) { 23422 return function (value) { 23423 defined[depName] = value; 23424 }; 23425 } 23426 23427 function callDep(name) { 23428 if (hasProp(waiting, name)) { 23429 var args = waiting[name]; 23430 delete waiting[name]; 23431 defining[name] = true; 23432 main.apply(undef, args); 23433 } 23434 23435 if (!hasProp(defined, name) && !hasProp(defining, name)) { 23436 throw new Error('No ' + name); 23437 } 23438 return defined[name]; 23439 } 23440 23441 //Turns a plugin!resource to [plugin, resource] 23442 //with the plugin being undefined if the name 23443 //did not have a plugin prefix. 23444 function splitPrefix(name) { 23445 var prefix, 23446 index = name ? name.indexOf('!') : -1; 23447 if (index > -1) { 23448 prefix = name.substring(0, index); 23449 name = name.substring(index + 1, name.length); 23450 } 23451 return [prefix, name]; 23452 } 23453 23454 //Creates a parts array for a relName where first part is plugin ID, 23455 //second part is resource ID. Assumes relName has already been normalized. 23456 function makeRelParts(relName) { 23457 return relName ? splitPrefix(relName) : []; 23458 } 23459 23460 /** 23461 * Makes a name map, normalizing the name, and using a plugin 23462 * for normalization if necessary. Grabs a ref to plugin 23463 * too, as an optimization. 23464 */ 23465 makeMap = function (name, relParts) { 23466 var plugin, 23467 parts = splitPrefix(name), 23468 prefix = parts[0], 23469 relResourceName = relParts[1]; 23470 23471 name = parts[1]; 23472 23473 if (prefix) { 23474 prefix = normalize(prefix, relResourceName); 23475 plugin = callDep(prefix); 23476 } 23477 23478 //Normalize according 23479 if (prefix) { 23480 if (plugin && plugin.normalize) { 23481 name = plugin.normalize(name, makeNormalize(relResourceName)); 23482 } else { 23483 name = normalize(name, relResourceName); 23484 } 23485 } else { 23486 name = normalize(name, relResourceName); 23487 parts = splitPrefix(name); 23488 prefix = parts[0]; 23489 name = parts[1]; 23490 if (prefix) { 23491 plugin = callDep(prefix); 23492 } 23493 } 23494 23495 //Using ridiculous property names for space reasons 23496 return { 23497 f: prefix ? prefix + '!' + name : name, //fullName 23498 n: name, 23499 pr: prefix, 23500 p: plugin 23501 }; 23502 }; 23503 23504 function makeConfig(name) { 23505 return function () { 23506 return (config && config.config && config.config[name]) || {}; 23507 }; 23508 } 23509 23510 handlers = { 23511 require: function (name) { 23512 return makeRequire(name); 23513 }, 23514 exports: function (name) { 23515 var e = defined[name]; 23516 if (typeof e !== 'undefined') { 23517 return e; 23518 } else { 23519 return (defined[name] = {}); 23520 } 23521 }, 23522 module: function (name) { 23523 return { 23524 id: name, 23525 uri: '', 23526 exports: defined[name], 23527 config: makeConfig(name) 23528 }; 23529 } 23530 }; 23531 23532 main = function (name, deps, callback, relName) { 23533 var cjsModule, depName, ret, map, i, relParts, 23534 args = [], 23535 callbackType = typeof callback, 23536 usingExports; 23537 23538 //Use name if no relName 23539 relName = relName || name; 23540 relParts = makeRelParts(relName); 23541 23542 //Call the callback to define the module, if necessary. 23543 if (callbackType === 'undefined' || callbackType === 'function') { 23544 //Pull out the defined dependencies and pass the ordered 23545 //values to the callback. 23546 //Default to [require, exports, module] if no deps 23547 deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps; 23548 for (i = 0; i < deps.length; i += 1) { 23549 map = makeMap(deps[i], relParts); 23550 depName = map.f; 23551 23552 //Fast path CommonJS standard dependencies. 23553 if (depName === "require") { 23554 args[i] = handlers.require(name); 23555 } else if (depName === "exports") { 23556 //CommonJS module spec 1.1 23557 args[i] = handlers.exports(name); 23558 usingExports = true; 23559 } else if (depName === "module") { 23560 //CommonJS module spec 1.1 23561 cjsModule = args[i] = handlers.module(name); 23562 } else if (hasProp(defined, depName) || 23563 hasProp(waiting, depName) || 23564 hasProp(defining, depName)) { 23565 args[i] = callDep(depName); 23566 } else if (map.p) { 23567 map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {}); 23568 args[i] = defined[depName]; 23569 } else { 23570 throw new Error(name + ' missing ' + depName); 23571 } 23572 } 23573 23574 ret = callback ? callback.apply(defined[name], args) : undefined; 23575 23576 if (name) { 23577 //If setting exports via "module" is in play, 23578 //favor that over return value and exports. After that, 23579 //favor a non-undefined return value over exports use. 23580 if (cjsModule && cjsModule.exports !== undef && 23581 cjsModule.exports !== defined[name]) { 23582 defined[name] = cjsModule.exports; 23583 } else if (ret !== undef || !usingExports) { 23584 //Use the return value from the function. 23585 defined[name] = ret; 23586 } 23587 } 23588 } else if (name) { 23589 //May just be an object definition for the module. Only 23590 //worry about defining if have a module name. 23591 defined[name] = callback; 23592 } 23593 }; 23594 23595 requirejs = require = req = function (deps, callback, relName, forceSync, alt) { 23596 if (typeof deps === "string") { 23597 if (handlers[deps]) { 23598 //callback in this case is really relName 23599 return handlers[deps](callback); 23600 } 23601 //Just return the module wanted. In this scenario, the 23602 //deps arg is the module name, and second arg (if passed) 23603 //is just the relName. 23604 //Normalize module name, if it contains . or .. 23605 return callDep(makeMap(deps, makeRelParts(callback)).f); 23606 } else if (!deps.splice) { 23607 //deps is a config object, not an array. 23608 config = deps; 23609 if (config.deps) { 23610 req(config.deps, config.callback); 23611 } 23612 if (!callback) { 23613 return; 23614 } 23615 23616 if (callback.splice) { 23617 //callback is an array, which means it is a dependency list. 23618 //Adjust args if there are dependencies 23619 deps = callback; 23620 callback = relName; 23621 relName = null; 23622 } else { 23623 deps = undef; 23624 } 23625 } 23626 23627 //Support require(['a']) 23628 callback = callback || function () {}; 23629 23630 //If relName is a function, it is an errback handler, 23631 //so remove it. 23632 if (typeof relName === 'function') { 23633 relName = forceSync; 23634 forceSync = alt; 23635 } 23636 23637 //Simulate async callback; 23638 if (forceSync) { 23639 main(undef, deps, callback, relName); 23640 } else { 23641 //Using a non-zero value because of concern for what old browsers 23642 //do, and latest browsers "upgrade" to 4 if lower value is used: 23643 //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout: 23644 //If want a value immediately, use require('id') instead -- something 23645 //that works in almond on the global level, but not guaranteed and 23646 //unlikely to work in other AMD implementations. 23647 setTimeout(function () { 23648 main(undef, deps, callback, relName); 23649 }, 4); 23650 } 23651 23652 return req; 23653 }; 23654 23655 /** 23656 * Just drops the config on the floor, but returns req in case 23657 * the config return value is used. 23658 */ 23659 req.config = function (cfg) { 23660 return req(cfg); 23661 }; 23662 23663 /** 23664 * Expose module registry for debugging and tooling 23665 */ 23666 requirejs._defined = defined; 23667 23668 define = function (name, deps, callback) { 23669 if (typeof name !== 'string') { 23670 throw new Error('See almond README: incorrect module build, no module name'); 23671 } 23672 23673 //This module may not have dependencies 23674 if (!deps.splice) { 23675 //deps is not an array, so probably means 23676 //an object literal or factory function for 23677 //the value. Adjust args. 23678 callback = deps; 23679 deps = []; 23680 } 23681 23682 if (!hasProp(defined, name) && !hasProp(waiting, name)) { 23683 waiting[name] = [name, deps, callback]; 23684 } 23685 }; 23686 23687 define.amd = { 23688 jQuery: true 23689 }; 23690}()); 23691 23692S2.requirejs = requirejs;S2.require = require;S2.define = define; 23693} 23694}()); 23695S2.define("almond", function(){}); 23696 23697/* global jQuery:false, $:false */ 23698S2.define('jquery',[],function () { 23699 var _$ = jQuery || $; 23700 23701 if (_$ == null && console && console.error) { 23702 console.error( 23703 'Select2: An instance of jQuery or a jQuery-compatible library was not ' + 23704 'found. Make sure that you are including jQuery before Select2 on your ' + 23705 'web page.' 23706 ); 23707 } 23708 23709 return _$; 23710}); 23711 23712S2.define('select2/utils',[ 23713 'jquery' 23714], function ($) { 23715 var Utils = {}; 23716 23717 Utils.Extend = function (ChildClass, SuperClass) { 23718 var __hasProp = {}.hasOwnProperty; 23719 23720 function BaseConstructor () { 23721 this.constructor = ChildClass; 23722 } 23723 23724 for (var key in SuperClass) { 23725 if (__hasProp.call(SuperClass, key)) { 23726 ChildClass[key] = SuperClass[key]; 23727 } 23728 } 23729 23730 BaseConstructor.prototype = SuperClass.prototype; 23731 ChildClass.prototype = new BaseConstructor(); 23732 ChildClass.__super__ = SuperClass.prototype; 23733 23734 return ChildClass; 23735 }; 23736 23737 function getMethods (theClass) { 23738 var proto = theClass.prototype; 23739 23740 var methods = []; 23741 23742 for (var methodName in proto) { 23743 var m = proto[methodName]; 23744 23745 if (typeof m !== 'function') { 23746 continue; 23747 } 23748 23749 if (methodName === 'constructor') { 23750 continue; 23751 } 23752 23753 methods.push(methodName); 23754 } 23755 23756 return methods; 23757 } 23758 23759 Utils.Decorate = function (SuperClass, DecoratorClass) { 23760 var decoratedMethods = getMethods(DecoratorClass); 23761 var superMethods = getMethods(SuperClass); 23762 23763 function DecoratedClass () { 23764 var unshift = Array.prototype.unshift; 23765 23766 var argCount = DecoratorClass.prototype.constructor.length; 23767 23768 var calledConstructor = SuperClass.prototype.constructor; 23769 23770 if (argCount > 0) { 23771 unshift.call(arguments, SuperClass.prototype.constructor); 23772 23773 calledConstructor = DecoratorClass.prototype.constructor; 23774 } 23775 23776 calledConstructor.apply(this, arguments); 23777 } 23778 23779 DecoratorClass.displayName = SuperClass.displayName; 23780 23781 function ctr () { 23782 this.constructor = DecoratedClass; 23783 } 23784 23785 DecoratedClass.prototype = new ctr(); 23786 23787 for (var m = 0; m < superMethods.length; m++) { 23788
vendor: 3,385 bytes, lines 23788-23925
23788var superMethod = superMethods[m]; 23789 23790 DecoratedClass.prototype[superMethod] = 23791 SuperClass.prototype[superMethod]; 23792 } 23793 23794 var calledMethod = function (methodName) { 23795 // Stub out the original method if it's not decorating an actual method 23796 var originalMethod = function () {}; 23797 23798 if (methodName in DecoratedClass.prototype) { 23799 originalMethod = DecoratedClass.prototype[methodName]; 23800 } 23801 23802 var decoratedMethod = DecoratorClass.prototype[methodName]; 23803 23804 return function () { 23805 var unshift = Array.prototype.unshift; 23806 23807 unshift.call(arguments, originalMethod); 23808 23809 return decoratedMethod.apply(this, arguments); 23810 }; 23811 }; 23812 23813 for (var d = 0; d < decoratedMethods.length; d++) { 23814 var decoratedMethod = decoratedMethods[d]; 23815 23816 DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod); 23817 } 23818 23819 return DecoratedClass; 23820 }; 23821 23822 var Observable = function () { 23823 this.listeners = {}; 23824 }; 23825 23826 Observable.prototype.on = function (event, callback) { 23827 this.listeners = this.listeners || {}; 23828 23829 if (event in this.listeners) { 23830 this.listeners[event].push(callback); 23831 } else { 23832 this.listeners[event] = [callback]; 23833 } 23834 }; 23835 23836 Observable.prototype.trigger = function (event) { 23837 var slice = Array.prototype.slice; 23838 var params = slice.call(arguments, 1); 23839 23840 this.listeners = this.listeners || {}; 23841 23842 // Params should always come in as an array 23843 if (params == null) { 23844 params = []; 23845 } 23846 23847 // If there are no arguments to the event, use a temporary object 23848 if (params.length === 0) { 23849 params.push({}); 23850 } 23851 23852 // Set the `_type` of the first object to the event 23853 params[0]._type = event; 23854 23855 if (event in this.listeners) { 23856 this.invoke(this.listeners[event], slice.call(arguments, 1)); 23857 } 23858 23859 if ('*' in this.listeners) { 23860 this.invoke(this.listeners['*'], arguments); 23861 } 23862 }; 23863 23864 Observable.prototype.invoke = function (listeners, params) { 23865 for (var i = 0, len = listeners.length; i < len; i++) { 23866 listeners[i].apply(this, params); 23867 } 23868 }; 23869 23870 Utils.Observable = Observable; 23871 23872 Utils.generateChars = function (length) { 23873 var chars = ''; 23874 23875 for (var i = 0; i < length; i++) { 23876 var randomChar = Math.floor(Math.random() * 36); 23877 chars += randomChar.toString(36); 23878 } 23879 23880 return chars; 23881 }; 23882 23883 Utils.bind = function (func, context) { 23884 return function () { 23885 func.apply(context, arguments); 23886 }; 23887 }; 23888 23889 Utils._convertData = function (data) { 23890 for (var originalKey in data) { 23891 var keys = originalKey.split('-'); 23892 23893 var dataLevel = data; 23894 23895 if (keys.length === 1) { 23896 continue; 23897 } 23898 23899 for (var k = 0; k < keys.length; k++) { 23900 var key = keys[k]; 23901 23902 // Lowercase the first letter 23903 // By default, dash-separated becomes camelCase 23904 key = key.substring(0, 1).toLowerCase() + key.substring(1); 23905 23906 if (!(key in dataLevel)) { 23907 dataLevel[key] = {}; 23908 } 23909 23910 if (k == keys.length - 1) { 23911 dataLevel[key] = data[originalKey]; 23912 } 23913 23914 dataLevel = dataLevel[key]; 23915 } 23916 23917 delete data[originalKey]; 23918 } 23919 23920 return data; 23921 }; 23922 23923 Utils.hasScroll = function (index, el) { 23924 // Adapted from the function created by @ShadowScripter 23925 // and adapted by @BillBarry on the Stack Exchange Code Review website.
23926 // The original code can be found at 23927 // http://codereview.stackexchange.com/q/13338 23928 // and was designed to be used with the Sizzle selector engine. 23929 23930 var $el = $(el); 23931 var overflowX = el.style.overflowX; 23932 var overflowY = el.style.overflowY; 23933 23934 //Check both x and y declarations 23935 if (overflowX === overflowY && 23936 (overflowY === 'hidden' || overflowY === 'visible')) { 23937 return false; 23938 } 23939 23940 if (overflowX === 'scroll' || overflowY === 'scroll') { 23941 return true; 23942 } 23943 23944 return ($el.innerHeight() < el.scrollHeight || 23945 $el.innerWidth() < el.scrollWidth); 23946 }; 23947 23948 Utils.escapeMarkup = function (markup) { 23949 var replaceMap = { 23950 '\\': '\', 23951 '&': '&', 23952 '<': '<', 23953 '>': '>', 23954 '"': '"', 23955 '\'': ''', 23956 '/': '/' 23957 }; 23958 23959 // Do not try to escape the markup if it's not a string 23960 if (typeof markup !== 'string') { 23961 return markup; 23962 } 23963 23964 return String(markup).replace(/[&<>"'\/\\]/g, function (match) { 23965 return replaceMap[match]; 23966 }); 23967 }; 23968 23969 // Append an array of jQuery nodes to a given element. 23970 Utils.appendMany = function ($element, $nodes) { 23971 // jQuery 1.7.x does not support $.fn.append() with an array 23972 // Fall back to a jQuery object collection using $.fn.add() 23973 if ($.fn.jquery.substr(0, 3) === '1.7') { 23974 var $jqNodes = $(); 23975 23976 $.map($nodes, function (node) { 23977 $jqNodes = $jqNodes.add(node); 23978 }); 23979 23980 $nodes = $jqNodes; 23981 } 23982 23983 $element.append($nodes); 23984 }; 23985 23986 // Cache objects in Utils.__cache instead of $.data (see #4346) 23987 Utils.__cache = {}; 23988 23989 var id = 0; 23990 Utils.GetUniqueElementId = function (element) { 23991 // Get a unique element Id. If element has no id, 23992 // creates a new unique number, stores it in the id 23993 // attribute and returns the new id. 23994 // If an id already exists, it simply returns it. 23995 23996 var select2Id = element.getAttribute('data-select2-id'); 23997 if (select2Id == null) { 23998 // If element has id, use it. 23999 if (element.id) { 24000 select2Id = element.id; 24001 element.setAttribute('data-select2-id', select2Id); 24002 } else { 24003 element.setAttribute('data-select2-id', ++id); 24004 select2Id = id.toString(); 24005 } 24006 } 24007 return select2Id; 24008 }; 24009 24010 Utils.StoreData = function (element, name, value) { 24011 // Stores an item in the cache for a specified element. 24012 // name is the cache key. 24013 var id = Utils.GetUniqueElementId(element); 24014 if (!Utils.__cache[id]) { 24015 Utils.__cache[id] = {}; 24016 } 24017 24018 Utils.__cache[id][name] = value; 24019 }; 24020 24021 Utils.GetData = function (element, name) { 24022 // Retrieves a value from the cache by its key (name) 24023 // name is optional. If no name specified, return 24024 // all cache items for the specified element. 24025 // and for a specified element. 24026 var id = Utils.GetUniqueElementId(element); 24027 if (name) { 24028 if (Utils.__cache[id]) { 24029 if (Utils.__cache[id][name] != null) { 24030 return Utils.__cache[id][name]; 24031 } 24032 return $(element).data(name); // Fallback to HTML5 data attribs. 24033 } 24034 return $(element).data(name); // Fallback to HTML5 data attribs. 24035 } else { 24036 return Utils.__cache[id]; 24037 } 24038 }; 24039 24040 Utils.RemoveData = function (element) { 24041 // Removes all cached items for a specified element. 24042 var id = Utils.GetUniqueElementId(element); 24043 if (Utils.__cache[id] != null) { 24044 delete Utils.__cache[id]; 24045 } 24046 24047 element.removeAttribute('data-select2-id'); 24048 }; 24049 24050 return Utils; 24051}); 24052 24053S2.define('select2/results',[ 24054 'jquery', 24055 './utils' 24056], function ($, Utils) { 24057 function Results ($element, options, dataAdapter) { 24058 this.$element = $element; 24059 this.data = dataAdapter; 24060 this.options = options; 24061 24062 Results.__super__.constructor.call(this); 24063 } 24064 24065 Utils.Extend(Results, Utils.Observable); 24066 24067 Results.prototype.render = function () { 24068 var $results = $( 24069 '<ul class="select2-results__options" role="listbox"></ul>' 24070 ); 24071 24072 if (this.options.get('multiple')) { 24073 $results.attr('aria-multiselectable', 'true'); 24074 } 24075 24076 this.$results = $results; 24077 24078 return $results; 24079 }; 24080 24081 Results.prototype.clear = function () { 24082 this.$results.empty(); 24083 }; 24084 24085 Results.prototype.displayMessage = function (params) { 24086 var escapeMarkup = this.options.get('escapeMarkup'); 24087 24088 this.clear(); 24089 this.hideLoading(); 24090 24091 var $message = $( 24092 '<li role="alert" aria-live="assertive"' + 24093 ' class="select2-results__option"></li>' 24094 ); 24095 24096 var message = this.options.get('translations').get(params.message); 24097 24098 $message.append( 24099 escapeMarkup( 24100 message(params.args) 24101 ) 24102 ); 24103 24104 $message[0].className += ' select2-results__message';
vendor: 9,101 bytes, lines 24105-24467
24105 24106 this.$results.append($message); 24107 }; 24108 24109 Results.prototype.hideMessages = function () { 24110 this.$results.find('.select2-results__message').remove(); 24111 }; 24112 24113 Results.prototype.append = function (data) { 24114 this.hideLoading(); 24115 24116 var $options = []; 24117 24118 if (data.results == null || data.results.length === 0) { 24119 if (this.$results.children().length === 0) { 24120 this.trigger('results:message', { 24121 message: 'noResults' 24122 }); 24123 } 24124 24125 return; 24126 } 24127 24128 data.results = this.sort(data.results); 24129 24130 for (var d = 0; d < data.results.length; d++) { 24131 var item = data.results[d]; 24132 24133 var $option = this.option(item); 24134 24135 $options.push($option); 24136 } 24137 24138 this.$results.append($options); 24139 }; 24140 24141 Results.prototype.position = function ($results, $dropdown) { 24142 var $resultsContainer = $dropdown.find('.select2-results'); 24143 $resultsContainer.append($results); 24144 }; 24145 24146 Results.prototype.sort = function (data) { 24147 var sorter = this.options.get('sorter'); 24148 24149 return sorter(data); 24150 }; 24151 24152 Results.prototype.highlightFirstItem = function () { 24153 var $options = this.$results 24154 .find('.select2-results__option[aria-selected]'); 24155 24156 var $selected = $options.filter('[aria-selected=true]'); 24157 24158 // Check if there are any selected options 24159 if ($selected.length > 0) { 24160 // If there are selected options, highlight the first 24161 $selected.first().trigger('mouseenter'); 24162 } else { 24163 // If there are no selected options, highlight the first option 24164 // in the dropdown 24165 $options.first().trigger('mouseenter'); 24166 } 24167 24168 this.ensureHighlightVisible(); 24169 }; 24170 24171 Results.prototype.setClasses = function () { 24172 var self = this; 24173 24174 this.data.current(function (selected) { 24175 var selectedIds = $.map(selected, function (s) { 24176 return s.id.toString(); 24177 }); 24178 24179 var $options = self.$results 24180 .find('.select2-results__option[aria-selected]'); 24181 24182 $options.each(function () { 24183 var $option = $(this); 24184 24185 var item = Utils.GetData(this, 'data'); 24186 24187 // id needs to be converted to a string when comparing 24188 var id = '' + item.id; 24189 24190 if ((item.element != null && item.element.selected) || 24191 (item.element == null && $.inArray(id, selectedIds) > -1)) { 24192 $option.attr('aria-selected', 'true'); 24193 } else { 24194 $option.attr('aria-selected', 'false'); 24195 } 24196 }); 24197 24198 }); 24199 }; 24200 24201 Results.prototype.showLoading = function (params) { 24202 this.hideLoading(); 24203 24204 var loadingMore = this.options.get('translations').get('searching'); 24205 24206 var loading = { 24207 disabled: true, 24208 loading: true, 24209 text: loadingMore(params) 24210 }; 24211 var $loading = this.option(loading); 24212 $loading.className += ' loading-results'; 24213 24214 this.$results.prepend($loading); 24215 }; 24216 24217 Results.prototype.hideLoading = function () { 24218 this.$results.find('.loading-results').remove(); 24219 }; 24220 24221 Results.prototype.option = function (data) { 24222 var option = document.createElement('li'); 24223 option.className = 'select2-results__option'; 24224 24225 var attrs = { 24226 'role': 'option', 24227 'aria-selected': 'false' 24228 }; 24229 24230 var matches = window.Element.prototype.matches || 24231 window.Element.prototype.msMatchesSelector || 24232 window.Element.prototype.webkitMatchesSelector; 24233 24234 if ((data.element != null && matches.call(data.element, ':disabled')) || 24235 (data.element == null && data.disabled)) { 24236 delete attrs['aria-selected']; 24237 attrs['aria-disabled'] = 'true'; 24238 } 24239 24240 if (data.id == null) { 24241 delete attrs['aria-selected']; 24242 } 24243 24244 if (data._resultId != null) { 24245 option.id = data._resultId; 24246 } 24247 24248 if (data.title) { 24249 option.title = data.title; 24250 } 24251 24252 if (data.children) { 24253 attrs.role = 'group'; 24254 attrs['aria-label'] = data.text; 24255 delete attrs['aria-selected']; 24256 } 24257 24258 for (var attr in attrs) { 24259 var val = attrs[attr]; 24260 24261 option.setAttribute(attr, val); 24262 } 24263 24264 if (data.children) { 24265 var $option = $(option); 24266 24267 var label = document.createElement('strong'); 24268 label.className = 'select2-results__group'; 24269 24270 var $label = $(label); 24271 this.template(data, label); 24272 24273 var $children = []; 24274 24275 for (var c = 0; c < data.children.length; c++) { 24276 var child = data.children[c]; 24277 24278 var $child = this.option(child); 24279 24280 $children.push($child); 24281 } 24282 24283 var $childrenContainer = $('<ul></ul>', { 24284 'class': 'select2-results__options select2-results__options--nested' 24285 }); 24286 24287 $childrenContainer.append($children); 24288 24289 $option.append(label); 24290 $option.append($childrenContainer); 24291 } else { 24292 this.template(data, option); 24293 } 24294 24295 Utils.StoreData(option, 'data', data); 24296 24297 return option; 24298 }; 24299 24300 Results.prototype.bind = function (container, $container) { 24301 var self = this; 24302 24303 var id = container.id + '-results'; 24304 24305 this.$results.attr('id', id); 24306 24307 container.on('results:all', function (params) { 24308 self.clear(); 24309 self.append(params.data); 24310 24311 if (container.isOpen()) { 24312 self.setClasses(); 24313 self.highlightFirstItem(); 24314 } 24315 }); 24316 24317 container.on('results:append', function (params) { 24318 self.append(params.data); 24319 24320 if (container.isOpen()) { 24321 self.setClasses(); 24322 } 24323 }); 24324 24325 container.on('query', function (params) { 24326 self.hideMessages(); 24327 self.showLoading(params); 24328 }); 24329 24330 container.on('select', function () { 24331 if (!container.isOpen()) { 24332 return; 24333 } 24334 24335 self.setClasses(); 24336 24337 if (self.options.get('scrollAfterSelect')) { 24338 self.highlightFirstItem(); 24339 } 24340 }); 24341 24342 container.on('unselect', function () { 24343 if (!container.isOpen()) { 24344 return; 24345 } 24346 24347 self.setClasses(); 24348 24349 if (self.options.get('scrollAfterSelect')) { 24350 self.highlightFirstItem(); 24351 } 24352 }); 24353 24354 container.on('open', function () { 24355 // When the dropdown is open, aria-expended="true" 24356 self.$results.attr('aria-expanded', 'true'); 24357 self.$results.attr('aria-hidden', 'false'); 24358 24359 self.setClasses(); 24360 self.ensureHighlightVisible(); 24361 }); 24362 24363 container.on('close', function () { 24364 // When the dropdown is closed, aria-expended="false" 24365 self.$results.attr('aria-expanded', 'false'); 24366 self.$results.attr('aria-hidden', 'true'); 24367 self.$results.removeAttr('aria-activedescendant'); 24368 }); 24369 24370 container.on('results:toggle', function () { 24371 var $highlighted = self.getHighlightedResults(); 24372 24373 if ($highlighted.length === 0) { 24374 return; 24375 } 24376 24377 $highlighted.trigger('mouseup'); 24378 }); 24379 24380 container.on('results:select', function () { 24381 var $highlighted = self.getHighlightedResults(); 24382 24383 if ($highlighted.length === 0) { 24384 return; 24385 } 24386 24387 var data = Utils.GetData($highlighted[0], 'data'); 24388 24389 if ($highlighted.attr('aria-selected') == 'true') { 24390 self.trigger('close', {}); 24391 } else { 24392 self.trigger('select', { 24393 data: data 24394 }); 24395 } 24396 }); 24397 24398 container.on('results:previous', function () { 24399 var $highlighted = self.getHighlightedResults(); 24400 24401 var $options = self.$results.find('[aria-selected]'); 24402 24403 var currentIndex = $options.index($highlighted); 24404 24405 // If we are already at the top, don't move further 24406 // If no options, currentIndex will be -1 24407 if (currentIndex <= 0) { 24408 return; 24409 } 24410 24411 var nextIndex = currentIndex - 1; 24412 24413 // If none are highlighted, highlight the first 24414 if ($highlighted.length === 0) { 24415 nextIndex = 0; 24416 } 24417 24418 var $next = $options.eq(nextIndex); 24419 24420 $next.trigger('mouseenter'); 24421 24422 var currentOffset = self.$results.offset().top; 24423 var nextTop = $next.offset().top; 24424 var nextOffset = self.$results.scrollTop() + (nextTop - currentOffset); 24425 24426 if (nextIndex === 0) { 24427 self.$results.scrollTop(0); 24428 } else if (nextTop - currentOffset < 0) { 24429 self.$results.scrollTop(nextOffset); 24430 } 24431 }); 24432 24433 container.on('results:next', function () { 24434 var $highlighted = self.getHighlightedResults(); 24435 24436 var $options = self.$results.find('[aria-selected]'); 24437 24438 var currentIndex = $options.index($highlighted); 24439 24440 var nextIndex = currentIndex + 1; 24441 24442 // If we are at the last option, stay there 24443 if (nextIndex >= $options.length) { 24444 return; 24445 } 24446 24447 var $next = $options.eq(nextIndex); 24448 24449 $next.trigger('mouseenter'); 24450 24451 var currentOffset = self.$results.offset().top + 24452 self.$results.outerHeight(false); 24453 var nextBottom = $next.offset().top + $next.outerHeight(false); 24454 var nextOffset = self.$results.scrollTop() + nextBottom - currentOffset; 24455 24456 if (nextIndex === 0) { 24457 self.$results.scrollTop(0); 24458 } else if (nextBottom > currentOffset) { 24459 self.$results.scrollTop(nextOffset); 24460 } 24461 }); 24462 24463 container.on('results:focus', function (params) { 24464 params.element.addClass('select2-results__option--highlighted'); 24465 }); 24466 24467 container.on('results:message', function (params) {
vendor: 24,175 bytes, lines 24468-25389
24468 self.displayMessage(params); 24469 }); 24470 24471 if ($.fn.mousewheel) { 24472 this.$results.on('mousewheel', function (e) { 24473 var top = self.$results.scrollTop(); 24474 24475 var bottom = self.$results.get(0).scrollHeight - top + e.deltaY; 24476 24477 var isAtTop = e.deltaY > 0 && top - e.deltaY <= 0; 24478 var isAtBottom = e.deltaY < 0 && bottom <= self.$results.height(); 24479 24480 if (isAtTop) { 24481 self.$results.scrollTop(0); 24482 24483 e.preventDefault(); 24484 e.stopPropagation(); 24485 } else if (isAtBottom) { 24486 self.$results.scrollTop( 24487 self.$results.get(0).scrollHeight - self.$results.height() 24488 ); 24489 24490 e.preventDefault(); 24491 e.stopPropagation(); 24492 } 24493 }); 24494 } 24495 24496 this.$results.on('mouseup', '.select2-results__option[aria-selected]', 24497 function (evt) { 24498 var $this = $(this); 24499 24500 var data = Utils.GetData(this, 'data'); 24501 24502 if ($this.attr('aria-selected') === 'true') { 24503 if (self.options.get('multiple')) { 24504 self.trigger('unselect', { 24505 originalEvent: evt, 24506 data: data 24507 }); 24508 } else { 24509 self.trigger('close', {}); 24510 } 24511 24512 return; 24513 } 24514 24515 self.trigger('select', { 24516 originalEvent: evt, 24517 data: data 24518 }); 24519 }); 24520 24521 this.$results.on('mouseenter', '.select2-results__option[aria-selected]', 24522 function (evt) { 24523 var data = Utils.GetData(this, 'data'); 24524 24525 self.getHighlightedResults() 24526 .removeClass('select2-results__option--highlighted'); 24527 24528 self.trigger('results:focus', { 24529 data: data, 24530 element: $(this) 24531 }); 24532 }); 24533 }; 24534 24535 Results.prototype.getHighlightedResults = function () { 24536 var $highlighted = this.$results 24537 .find('.select2-results__option--highlighted'); 24538 24539 return $highlighted; 24540 }; 24541 24542 Results.prototype.destroy = function () { 24543 this.$results.remove(); 24544 }; 24545 24546 Results.prototype.ensureHighlightVisible = function () { 24547 var $highlighted = this.getHighlightedResults(); 24548 24549 if ($highlighted.length === 0) { 24550 return; 24551 } 24552 24553 var $options = this.$results.find('[aria-selected]'); 24554 24555 var currentIndex = $options.index($highlighted); 24556 24557 var currentOffset = this.$results.offset().top; 24558 var nextTop = $highlighted.offset().top; 24559 var nextOffset = this.$results.scrollTop() + (nextTop - currentOffset); 24560 24561 var offsetDelta = nextTop - currentOffset; 24562 nextOffset -= $highlighted.outerHeight(false) * 2; 24563 24564 if (currentIndex <= 2) { 24565 this.$results.scrollTop(0); 24566 } else if (offsetDelta > this.$results.outerHeight() || offsetDelta < 0) { 24567 this.$results.scrollTop(nextOffset); 24568 } 24569 }; 24570 24571 Results.prototype.template = function (result, container) { 24572 var template = this.options.get('templateResult'); 24573 var escapeMarkup = this.options.get('escapeMarkup'); 24574 24575 var content = template(result, container); 24576 24577 if (content == null) { 24578 container.style.display = 'none'; 24579 } else if (typeof content === 'string') { 24580 container.innerHTML = escapeMarkup(content); 24581 } else { 24582 $(container).append(content); 24583 } 24584 }; 24585 24586 return Results; 24587}); 24588 24589S2.define('select2/keys',[ 24590 24591], function () { 24592 var KEYS = { 24593 BACKSPACE: 8, 24594 TAB: 9, 24595 ENTER: 13, 24596 SHIFT: 16, 24597 CTRL: 17, 24598 ALT: 18, 24599 ESC: 27, 24600 SPACE: 32, 24601 PAGE_UP: 33, 24602 PAGE_DOWN: 34, 24603 END: 35, 24604 HOME: 36, 24605 LEFT: 37, 24606 UP: 38, 24607 RIGHT: 39, 24608 DOWN: 40, 24609 DELETE: 46 24610 }; 24611 24612 return KEYS; 24613}); 24614 24615S2.define('select2/selection/base',[ 24616 'jquery', 24617 '../utils', 24618 '../keys' 24619], function ($, Utils, KEYS) { 24620 function BaseSelection ($element, options) { 24621 this.$element = $element; 24622 this.options = options; 24623 24624 BaseSelection.__super__.constructor.call(this); 24625 } 24626 24627 Utils.Extend(BaseSelection, Utils.Observable); 24628 24629 BaseSelection.prototype.render = function () { 24630 var $selection = $( 24631 '<span class="select2-selection" role="combobox" ' + 24632 ' aria-haspopup="true" aria-expanded="false">' + 24633 '</span>' 24634 ); 24635 24636 this._tabindex = 0; 24637 24638 if (Utils.GetData(this.$element[0], 'old-tabindex') != null) { 24639 this._tabindex = Utils.GetData(this.$element[0], 'old-tabindex'); 24640 } else if (this.$element.attr('tabindex') != null) { 24641 this._tabindex = this.$element.attr('tabindex'); 24642 } 24643 24644 $selection.attr('title', this.$element.attr('title')); 24645 $selection.attr('tabindex', this._tabindex); 24646 $selection.attr('aria-disabled', 'false'); 24647 24648 this.$selection = $selection; 24649 24650 return $selection; 24651 }; 24652 24653 BaseSelection.prototype.bind = function (container, $container) { 24654 var self = this; 24655 24656 var resultsId = container.id + '-results'; 24657 24658 this.container = container; 24659 24660 this.$selection.on('focus', function (evt) { 24661 self.trigger('focus', evt); 24662 }); 24663 24664 this.$selection.on('blur', function (evt) { 24665 self._handleBlur(evt); 24666 }); 24667 24668 this.$selection.on('keydown', function (evt) { 24669 self.trigger('keypress', evt); 24670 24671 if (evt.which === KEYS.SPACE) { 24672 evt.preventDefault(); 24673 } 24674 }); 24675 24676 container.on('results:focus', function (params) { 24677 self.$selection.attr('aria-activedescendant', params.data._resultId); 24678 }); 24679 24680 container.on('selection:update', function (params) { 24681 self.update(params.data); 24682 }); 24683 24684 container.on('open', function () { 24685 // When the dropdown is open, aria-expanded="true" 24686 self.$selection.attr('aria-expanded', 'true'); 24687 self.$selection.attr('aria-owns', resultsId); 24688 24689 self._attachCloseHandler(container); 24690 }); 24691 24692 container.on('close', function () { 24693 // When the dropdown is closed, aria-expanded="false" 24694 self.$selection.attr('aria-expanded', 'false'); 24695 self.$selection.removeAttr('aria-activedescendant'); 24696 self.$selection.removeAttr('aria-owns'); 24697 24698 self.$selection.trigger('focus'); 24699 24700 self._detachCloseHandler(container); 24701 }); 24702 24703 container.on('enable', function () { 24704 self.$selection.attr('tabindex', self._tabindex); 24705 self.$selection.attr('aria-disabled', 'false'); 24706 }); 24707 24708 container.on('disable', function () { 24709 self.$selection.attr('tabindex', '-1'); 24710 self.$selection.attr('aria-disabled', 'true'); 24711 }); 24712 }; 24713 24714 BaseSelection.prototype._handleBlur = function (evt) { 24715 var self = this; 24716 24717 // This needs to be delayed as the active element is the body when the tab 24718 // key is pressed, possibly along with others. 24719 window.setTimeout(function () { 24720 // Don't trigger `blur` if the focus is still in the selection 24721 if ( 24722 (document.activeElement == self.$selection[0]) || 24723 ($.contains(self.$selection[0], document.activeElement)) 24724 ) { 24725 return; 24726 } 24727 24728 self.trigger('blur', evt); 24729 }, 1); 24730 }; 24731 24732 BaseSelection.prototype._attachCloseHandler = function (container) { 24733 24734 $(document.body).on('mousedown.select2.' + container.id, function (e) { 24735 var $target = $(e.target); 24736 24737 var $select = $target.closest('.select2'); 24738 24739 var $all = $('.select2.select2-container--open'); 24740 24741 $all.each(function () { 24742 if (this == $select[0]) { 24743 return; 24744 } 24745 24746 var $element = Utils.GetData(this, 'element'); 24747 24748 $element.select2('close'); 24749 }); 24750 }); 24751 }; 24752 24753 BaseSelection.prototype._detachCloseHandler = function (container) { 24754 $(document.body).off('mousedown.select2.' + container.id); 24755 }; 24756 24757 BaseSelection.prototype.position = function ($selection, $container) { 24758 var $selectionContainer = $container.find('.selection'); 24759 $selectionContainer.append($selection); 24760 }; 24761 24762 BaseSelection.prototype.destroy = function () { 24763 this._detachCloseHandler(this.container); 24764 }; 24765 24766 BaseSelection.prototype.update = function (data) { 24767 throw new Error('The `update` method must be defined in child classes.'); 24768 }; 24769 24770 /** 24771 * Helper method to abstract the "enabled" (not "disabled") state of this 24772 * object. 24773 * 24774 * @return {true} if the instance is not disabled. 24775 * @return {false} if the instance is disabled. 24776 */ 24777 BaseSelection.prototype.isEnabled = function () { 24778 return !this.isDisabled(); 24779 }; 24780 24781 /** 24782 * Helper method to abstract the "disabled" state of this object. 24783 * 24784 * @return {true} if the disabled option is true. 24785 * @return {false} if the disabled option is false. 24786 */ 24787 BaseSelection.prototype.isDisabled = function () { 24788 return this.options.get('disabled'); 24789 }; 24790 24791 return BaseSelection; 24792}); 24793 24794S2.define('select2/selection/single',[ 24795 'jquery', 24796 './base', 24797 '../utils', 24798 '../keys' 24799], function ($, BaseSelection, Utils, KEYS) { 24800 function SingleSelection () { 24801 SingleSelection.__super__.constructor.apply(this, arguments); 24802 } 24803 24804 Utils.Extend(SingleSelection, BaseSelection); 24805 24806 SingleSelection.prototype.render = function () { 24807 var $selection = SingleSelection.__super__.render.call(this); 24808 24809 $selection.addClass('select2-selection--single'); 24810 24811 $selection.html( 24812 '<span class="select2-selection__rendered"></span>' + 24813 '<span class="select2-selection__arrow" role="presentation">' + 24814 '<b role="presentation"></b>' + 24815 '</span>' 24816 ); 24817 24818 return $selection; 24819 }; 24820 24821 SingleSelection.prototype.bind = function (container, $container) { 24822 var self = this; 24823 24824 SingleSelection.__super__.bind.apply(this, arguments); 24825 24826 var id = container.id + '-container'; 24827 24828 this.$selection.find('.select2-selection__rendered') 24829 .attr('id', id) 24830 .attr('role', 'textbox') 24831 .attr('aria-readonly', 'true'); 24832 this.$selection.attr('aria-labelledby', id); 24833 24834 this.$selection.on('mousedown', function (evt) { 24835 // Only respond to left clicks 24836 if (evt.which !== 1) { 24837 return; 24838 } 24839 24840 self.trigger('toggle', { 24841 originalEvent: evt 24842 }); 24843 }); 24844 24845 this.$selection.on('focus', function (evt) { 24846 // User focuses on the container 24847 }); 24848 24849 this.$selection.on('blur', function (evt) { 24850 // User exits the container 24851 }); 24852 24853 container.on('focus', function (evt) { 24854 if (!container.isOpen()) { 24855 self.$selection.trigger('focus'); 24856 } 24857 }); 24858 }; 24859 24860 SingleSelection.prototype.clear = function () { 24861 var $rendered = this.$selection.find('.select2-selection__rendered'); 24862 $rendered.empty(); 24863 $rendered.removeAttr('title'); // clear tooltip on empty 24864 }; 24865 24866 SingleSelection.prototype.display = function (data, container) { 24867 var template = this.options.get('templateSelection'); 24868 var escapeMarkup = this.options.get('escapeMarkup'); 24869 24870 return escapeMarkup(template(data, container)); 24871 }; 24872 24873 SingleSelection.prototype.selectionContainer = function () { 24874 return $('<span></span>'); 24875 }; 24876 24877 SingleSelection.prototype.update = function (data) { 24878 if (data.length === 0) { 24879 this.clear(); 24880 return; 24881 } 24882 24883 var selection = data[0]; 24884 24885 var $rendered = this.$selection.find('.select2-selection__rendered'); 24886 var formatted = this.display(selection, $rendered); 24887 24888 $rendered.empty().append(formatted); 24889 24890 var title = selection.title || selection.text; 24891 24892 if (title) { 24893 $rendered.attr('title', title); 24894 } else { 24895 $rendered.removeAttr('title'); 24896 } 24897 }; 24898 24899 return SingleSelection; 24900}); 24901 24902S2.define('select2/selection/multiple',[ 24903 'jquery', 24904 './base', 24905 '../utils' 24906], function ($, BaseSelection, Utils) { 24907 function MultipleSelection ($element, options) { 24908 MultipleSelection.__super__.constructor.apply(this, arguments); 24909 } 24910 24911 Utils.Extend(MultipleSelection, BaseSelection); 24912 24913 MultipleSelection.prototype.render = function () { 24914 var $selection = MultipleSelection.__super__.render.call(this); 24915 24916 $selection.addClass('select2-selection--multiple'); 24917 24918 $selection.html( 24919 '<ul class="select2-selection__rendered"></ul>' 24920 ); 24921 24922 return $selection; 24923 }; 24924 24925 MultipleSelection.prototype.bind = function (container, $container) { 24926 var self = this; 24927 24928 MultipleSelection.__super__.bind.apply(this, arguments); 24929 24930 this.$selection.on('click', function (evt) { 24931 self.trigger('toggle', { 24932 originalEvent: evt 24933 }); 24934 }); 24935 24936 this.$selection.on( 24937 'click', 24938 '.select2-selection__choice__remove', 24939 function (evt) { 24940 // Ignore the event if it is disabled 24941 if (self.isDisabled()) { 24942 return; 24943 } 24944 24945 var $remove = $(this); 24946 var $selection = $remove.parent(); 24947 24948 var data = Utils.GetData($selection[0], 'data'); 24949 24950 self.trigger('unselect', { 24951 originalEvent: evt, 24952 data: data 24953 }); 24954 } 24955 ); 24956 }; 24957 24958 MultipleSelection.prototype.clear = function () { 24959 var $rendered = this.$selection.find('.select2-selection__rendered'); 24960 $rendered.empty(); 24961 $rendered.removeAttr('title'); 24962 }; 24963 24964 MultipleSelection.prototype.display = function (data, container) { 24965 var template = this.options.get('templateSelection'); 24966 var escapeMarkup = this.options.get('escapeMarkup'); 24967 24968 return escapeMarkup(template(data, container)); 24969 }; 24970 24971 MultipleSelection.prototype.selectionContainer = function () { 24972 var $container = $( 24973 '<li class="select2-selection__choice">' + 24974 '<span class="select2-selection__choice__remove" role="presentation">' + 24975 '×' + 24976 '</span>' + 24977 '</li>' 24978 ); 24979 24980 return $container; 24981 }; 24982 24983 MultipleSelection.prototype.update = function (data) { 24984 this.clear(); 24985 24986 if (data.length === 0) { 24987 return; 24988 } 24989 24990 var $selections = []; 24991 24992 for (var d = 0; d < data.length; d++) { 24993 var selection = data[d]; 24994 24995 var $selection = this.selectionContainer(); 24996 var formatted = this.display(selection, $selection); 24997 24998 $selection.append(formatted); 24999 25000 var title = selection.title || selection.text; 25001 25002 if (title) { 25003 $selection.attr('title', title); 25004 } 25005 25006 Utils.StoreData($selection[0], 'data', selection); 25007 25008 $selections.push($selection); 25009 } 25010 25011 var $rendered = this.$selection.find('.select2-selection__rendered'); 25012 25013 Utils.appendMany($rendered, $selections); 25014 }; 25015 25016 return MultipleSelection; 25017}); 25018 25019S2.define('select2/selection/placeholder',[ 25020 '../utils' 25021], function (Utils) { 25022 function Placeholder (decorated, $element, options) { 25023 this.placeholder = this.normalizePlaceholder(options.get('placeholder')); 25024 25025 decorated.call(this, $element, options); 25026 } 25027 25028 Placeholder.prototype.normalizePlaceholder = function (_, placeholder) { 25029 if (typeof placeholder === 'string') { 25030 placeholder = { 25031 id: '', 25032 text: placeholder 25033 }; 25034 } 25035 25036 return placeholder; 25037 }; 25038 25039 Placeholder.prototype.createPlaceholder = function (decorated, placeholder) { 25040 var $placeholder = this.selectionContainer(); 25041 25042 $placeholder.html(this.display(placeholder)); 25043 $placeholder.addClass('select2-selection__placeholder') 25044 .removeClass('select2-selection__choice'); 25045 25046 return $placeholder; 25047 }; 25048 25049 Placeholder.prototype.update = function (decorated, data) { 25050 var singlePlaceholder = ( 25051 data.length == 1 && data[0].id != this.placeholder.id 25052 ); 25053 var multipleSelections = data.length > 1; 25054 25055 if (multipleSelections || singlePlaceholder) { 25056 return decorated.call(this, data); 25057 } 25058 25059 this.clear(); 25060 25061 var $placeholder = this.createPlaceholder(this.placeholder); 25062 25063 this.$selection.find('.select2-selection__rendered').append($placeholder); 25064 }; 25065 25066 return Placeholder; 25067}); 25068 25069S2.define('select2/selection/allowClear',[ 25070 'jquery', 25071 '../keys', 25072 '../utils' 25073], function ($, KEYS, Utils) { 25074 function AllowClear () { } 25075 25076 AllowClear.prototype.bind = function (decorated, container, $container) { 25077 var self = this; 25078 25079 decorated.call(this, container, $container); 25080 25081 if (this.placeholder == null) { 25082 if (this.options.get('debug') && window.console && console.error) { 25083 console.error( 25084 'Select2: The `allowClear` option should be used in combination ' + 25085 'with the `placeholder` option.' 25086 ); 25087 } 25088 } 25089 25090 this.$selection.on('mousedown', '.select2-selection__clear', 25091 function (evt) { 25092 self._handleClear(evt); 25093 }); 25094 25095 container.on('keypress', function (evt) { 25096 self._handleKeyboardClear(evt, container); 25097 }); 25098 }; 25099 25100 AllowClear.prototype._handleClear = function (_, evt) { 25101 // Ignore the event if it is disabled 25102 if (this.isDisabled()) { 25103 return; 25104 } 25105 25106 var $clear = this.$selection.find('.select2-selection__clear'); 25107 25108 // Ignore the event if nothing has been selected 25109 if ($clear.length === 0) { 25110 return; 25111 } 25112 25113 evt.stopPropagation(); 25114 25115 var data = Utils.GetData($clear[0], 'data'); 25116 25117 var previousVal = this.$element.val(); 25118 this.$element.val(this.placeholder.id); 25119 25120 var unselectData = { 25121 data: data 25122 }; 25123 this.trigger('clear', unselectData); 25124 if (unselectData.prevented) { 25125 this.$element.val(previousVal); 25126 return; 25127 } 25128 25129 for (var d = 0; d < data.length; d++) { 25130 unselectData = { 25131 data: data[d] 25132 }; 25133 25134 // Trigger the `unselect` event, so people can prevent it from being 25135 // cleared. 25136 this.trigger('unselect', unselectData); 25137 25138 // If the event was prevented, don't clear it out. 25139 if (unselectData.prevented) { 25140 this.$element.val(previousVal); 25141 return; 25142 } 25143 } 25144 25145 this.$element.trigger('input').trigger('change'); 25146 25147 this.trigger('toggle', {}); 25148 }; 25149 25150 AllowClear.prototype._handleKeyboardClear = function (_, evt, container) { 25151 if (container.isOpen()) { 25152 return; 25153 } 25154 25155 if (evt.which == KEYS.DELETE || evt.which == KEYS.BACKSPACE) { 25156 this._handleClear(evt); 25157 } 25158 }; 25159 25160 AllowClear.prototype.update = function (decorated, data) { 25161 decorated.call(this, data); 25162 25163 if (this.$selection.find('.select2-selection__placeholder').length > 0 || 25164 data.length === 0) { 25165 return; 25166 } 25167 25168 var removeAll = this.options.get('translations').get('removeAllItems'); 25169 25170 var $remove = $( 25171 '<span class="select2-selection__clear" title="' + removeAll() +'">' + 25172 '×' + 25173 '</span>' 25174 ); 25175 Utils.StoreData($remove[0], 'data', data); 25176 25177 this.$selection.find('.select2-selection__rendered').prepend($remove); 25178 }; 25179 25180 return AllowClear; 25181}); 25182 25183S2.define('select2/selection/search',[ 25184 'jquery', 25185 '../utils', 25186 '../keys' 25187], function ($, Utils, KEYS) { 25188 function Search (decorated, $element, options) { 25189 decorated.call(this, $element, options); 25190 } 25191 25192 Search.prototype.render = function (decorated) { 25193 var $search = $( 25194 '<li class="select2-search select2-search--inline">' + 25195 '<input class="select2-search__field" type="search" tabindex="-1"' + 25196 ' autocomplete="off" autocorrect="off" autocapitalize="none"' + 25197 ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' + 25198 '</li>' 25199 ); 25200 25201 this.$searchContainer = $search; 25202 this.$search = $search.find('input'); 25203 25204 var $rendered = decorated.call(this); 25205 25206 this._transferTabIndex(); 25207 25208 return $rendered; 25209 }; 25210 25211 Search.prototype.bind = function (decorated, container, $container) { 25212 var self = this; 25213 25214 var resultsId = container.id + '-results'; 25215 25216 decorated.call(this, container, $container); 25217 25218 container.on('open', function () { 25219 self.$search.attr('aria-controls', resultsId); 25220 self.$search.trigger('focus'); 25221 }); 25222 25223 container.on('close', function () { 25224 self.$search.val(''); 25225 self.$search.removeAttr('aria-controls'); 25226 self.$search.removeAttr('aria-activedescendant'); 25227 self.$search.trigger('focus'); 25228 }); 25229 25230 container.on('enable', function () { 25231 self.$search.prop('disabled', false); 25232 25233 self._transferTabIndex(); 25234 }); 25235 25236 container.on('disable', function () { 25237 self.$search.prop('disabled', true); 25238 }); 25239 25240 container.on('focus', function (evt) { 25241 self.$search.trigger('focus'); 25242 }); 25243 25244 container.on('results:focus', function (params) { 25245 if (params.data._resultId) { 25246 self.$search.attr('aria-activedescendant', params.data._resultId); 25247 } else { 25248 self.$search.removeAttr('aria-activedescendant'); 25249 } 25250 }); 25251 25252 this.$selection.on('focusin', '.select2-search--inline', function (evt) { 25253 self.trigger('focus', evt); 25254 }); 25255 25256 this.$selection.on('focusout', '.select2-search--inline', function (evt) { 25257 self._handleBlur(evt); 25258 }); 25259 25260 this.$selection.on('keydown', '.select2-search--inline', function (evt) { 25261 evt.stopPropagation(); 25262 25263 self.trigger('keypress', evt); 25264 25265 self._keyUpPrevented = evt.isDefaultPrevented(); 25266 25267 var key = evt.which; 25268 25269 if (key === KEYS.BACKSPACE && self.$search.val() === '') { 25270 var $previousChoice = self.$searchContainer 25271 .prev('.select2-selection__choice'); 25272 25273 if ($previousChoice.length > 0) { 25274 var item = Utils.GetData($previousChoice[0], 'data'); 25275 25276 self.searchRemoveChoice(item); 25277 25278 evt.preventDefault(); 25279 } 25280 } 25281 }); 25282 25283 this.$selection.on('click', '.select2-search--inline', function (evt) { 25284 if (self.$search.val()) { 25285 evt.stopPropagation(); 25286 } 25287 }); 25288 25289 // Try to detect the IE version should the `documentMode` property that 25290 // is stored on the document. This is only implemented in IE and is 25291 // slightly cleaner than doing a user agent check. 25292 // This property is not available in Edge, but Edge also doesn't have 25293 // this bug. 25294 var msie = document.documentMode; 25295 var disableInputEvents = msie && msie <= 11; 25296 25297 // Workaround for browsers which do not support the `input` event 25298 // This will prevent double-triggering of events for browsers which support 25299 // both the `keyup` and `input` events. 25300 this.$selection.on( 25301 'input.searchcheck', 25302 '.select2-search--inline', 25303 function (evt) { 25304 // IE will trigger the `input` event when a placeholder is used on a 25305 // search box. To get around this issue, we are forced to ignore all 25306 // `input` events in IE and keep using `keyup`. 25307 if (disableInputEvents) { 25308 self.$selection.off('input.search input.searchcheck'); 25309 return; 25310 } 25311 25312 // Unbind the duplicated `keyup` event 25313 self.$selection.off('keyup.search'); 25314 } 25315 ); 25316 25317 this.$selection.on( 25318 'keyup.search input.search', 25319 '.select2-search--inline', 25320 function (evt) { 25321 // IE will trigger the `input` event when a placeholder is used on a 25322 // search box. To get around this issue, we are forced to ignore all 25323 // `input` events in IE and keep using `keyup`. 25324 if (disableInputEvents && evt.type === 'input') { 25325 self.$selection.off('input.search input.searchcheck'); 25326 return; 25327 } 25328 25329 var key = evt.which; 25330 25331 // We can freely ignore events from modifier keys 25332 if (key == KEYS.SHIFT || key == KEYS.CTRL || key == KEYS.ALT) { 25333 return; 25334 } 25335 25336 // Tabbing will be handled during the `keydown` phase 25337 if (key == KEYS.TAB) { 25338 return; 25339 } 25340 25341 self.handleSearch(evt); 25342 } 25343 ); 25344 }; 25345 25346 /** 25347 * This method will transfer the tabindex attribute from the rendered 25348 * selection to the search box. This allows for the search box to be used as 25349 * the primary focus instead of the selection container. 25350 * 25351 * @private 25352 */ 25353 Search.prototype._transferTabIndex = function (decorated) { 25354 this.$search.attr('tabindex', this.$selection.attr('tabindex')); 25355 this.$selection.attr('tabindex', '-1'); 25356 }; 25357 25358 Search.prototype.createPlaceholder = function (decorated, placeholder) { 25359 this.$search.attr('placeholder', placeholder.text); 25360 }; 25361 25362 Search.prototype.update = function (decorated, data) { 25363 var searchHadFocus = this.$search[0] == document.activeElement; 25364 25365 this.$search.attr('placeholder', ''); 25366 25367 decorated.call(this, data); 25368 25369 this.$selection.find('.select2-selection__rendered') 25370 .append(this.$searchContainer); 25371 25372 this.resizeSearch(); 25373 if (searchHadFocus) { 25374 this.$search.trigger('focus'); 25375 } 25376 }; 25377 25378 Search.prototype.handleSearch = function () { 25379 this.resizeSearch(); 25380 25381 if (!this._keyUpPrevented) { 25382 var input = this.$search.val(); 25383 25384 this.trigger('query', { 25385 term: input 25386 }); 25387 } 25388 25389 this._keyUpPrevented = false;
vendor: 43,019 bytes, lines 25390-27390
25390 }; 25391 25392 Search.prototype.searchRemoveChoice = function (decorated, item) { 25393 this.trigger('unselect', { 25394 data: item 25395 }); 25396 25397 this.$search.val(item.text); 25398 this.handleSearch(); 25399 }; 25400 25401 Search.prototype.resizeSearch = function () { 25402 this.$search.css('width', '25px'); 25403 25404 var width = ''; 25405 25406 if (this.$search.attr('placeholder') !== '') { 25407 width = this.$selection.find('.select2-selection__rendered').width(); 25408 } else { 25409 var minimumWidth = this.$search.val().length + 1; 25410 25411 width = (minimumWidth * 0.75) + 'em'; 25412 } 25413 25414 this.$search.css('width', width); 25415 }; 25416 25417 return Search; 25418}); 25419 25420S2.define('select2/selection/eventRelay',[ 25421 'jquery' 25422], function ($) { 25423 function EventRelay () { } 25424 25425 EventRelay.prototype.bind = function (decorated, container, $container) { 25426 var self = this; 25427 var relayEvents = [ 25428 'open', 'opening', 25429 'close', 'closing', 25430 'select', 'selecting', 25431 'unselect', 'unselecting', 25432 'clear', 'clearing' 25433 ]; 25434 25435 var preventableEvents = [ 25436 'opening', 'closing', 'selecting', 'unselecting', 'clearing' 25437 ]; 25438 25439 decorated.call(this, container, $container); 25440 25441 container.on('*', function (name, params) { 25442 // Ignore events that should not be relayed 25443 if ($.inArray(name, relayEvents) === -1) { 25444 return; 25445 } 25446 25447 // The parameters should always be an object 25448 params = params || {}; 25449 25450 // Generate the jQuery event for the Select2 event 25451 var evt = $.Event('select2:' + name, { 25452 params: params 25453 }); 25454 25455 self.$element.trigger(evt); 25456 25457 // Only handle preventable events if it was one 25458 if ($.inArray(name, preventableEvents) === -1) { 25459 return; 25460 } 25461 25462 params.prevented = evt.isDefaultPrevented(); 25463 }); 25464 }; 25465 25466 return EventRelay; 25467}); 25468 25469S2.define('select2/translation',[ 25470 'jquery', 25471 'require' 25472], function ($, require) { 25473 function Translation (dict) { 25474 this.dict = dict || {}; 25475 } 25476 25477 Translation.prototype.all = function () { 25478 return this.dict; 25479 }; 25480 25481 Translation.prototype.get = function (key) { 25482 return this.dict[key]; 25483 }; 25484 25485 Translation.prototype.extend = function (translation) { 25486 this.dict = $.extend({}, translation.all(), this.dict); 25487 }; 25488 25489 // Static functions 25490 25491 Translation._cache = {}; 25492 25493 Translation.loadPath = function (path) { 25494 if (!(path in Translation._cache)) { 25495 var translations = require(path); 25496 25497 Translation._cache[path] = translations; 25498 } 25499 25500 return new Translation(Translation._cache[path]); 25501 }; 25502 25503 return Translation; 25504}); 25505 25506S2.define('select2/diacritics',[ 25507 25508], function () { 25509 var diacritics = { 25510 '\u24B6': 'A', 25511 '\uFF21': 'A', 25512 '\u00C0': 'A', 25513 '\u00C1': 'A', 25514 '\u00C2': 'A', 25515 '\u1EA6': 'A', 25516 '\u1EA4': 'A', 25517 '\u1EAA': 'A', 25518 '\u1EA8': 'A', 25519 '\u00C3': 'A', 25520 '\u0100': 'A', 25521 '\u0102': 'A', 25522 '\u1EB0': 'A', 25523 '\u1EAE': 'A', 25524 '\u1EB4': 'A', 25525 '\u1EB2': 'A', 25526 '\u0226': 'A', 25527 '\u01E0': 'A', 25528 '\u00C4': 'A', 25529 '\u01DE': 'A', 25530 '\u1EA2': 'A', 25531 '\u00C5': 'A', 25532 '\u01FA': 'A', 25533 '\u01CD': 'A', 25534 '\u0200': 'A', 25535 '\u0202': 'A', 25536 '\u1EA0': 'A', 25537 '\u1EAC': 'A', 25538 '\u1EB6': 'A', 25539 '\u1E00': 'A', 25540 '\u0104': 'A', 25541 '\u023A': 'A', 25542 '\u2C6F': 'A', 25543 '\uA732': 'AA', 25544 '\u00C6': 'AE', 25545 '\u01FC': 'AE', 25546 '\u01E2': 'AE', 25547 '\uA734': 'AO', 25548 '\uA736': 'AU', 25549 '\uA738': 'AV', 25550 '\uA73A': 'AV', 25551 '\uA73C': 'AY', 25552 '\u24B7': 'B', 25553 '\uFF22': 'B', 25554 '\u1E02': 'B', 25555 '\u1E04': 'B', 25556 '\u1E06': 'B', 25557 '\u0243': 'B', 25558 '\u0182': 'B', 25559 '\u0181': 'B', 25560 '\u24B8': 'C', 25561 '\uFF23': 'C', 25562 '\u0106': 'C', 25563 '\u0108': 'C', 25564 '\u010A': 'C', 25565 '\u010C': 'C', 25566 '\u00C7': 'C', 25567 '\u1E08': 'C', 25568 '\u0187': 'C', 25569 '\u023B': 'C', 25570 '\uA73E': 'C', 25571 '\u24B9': 'D', 25572 '\uFF24': 'D', 25573 '\u1E0A': 'D', 25574 '\u010E': 'D', 25575 '\u1E0C': 'D', 25576 '\u1E10': 'D', 25577 '\u1E12': 'D', 25578 '\u1E0E': 'D', 25579 '\u0110': 'D', 25580 '\u018B': 'D', 25581 '\u018A': 'D', 25582 '\u0189': 'D', 25583 '\uA779': 'D', 25584 '\u01F1': 'DZ', 25585 '\u01C4': 'DZ', 25586 '\u01F2': 'Dz', 25587 '\u01C5': 'Dz', 25588 '\u24BA': 'E', 25589 '\uFF25': 'E', 25590 '\u00C8': 'E', 25591 '\u00C9': 'E', 25592 '\u00CA': 'E', 25593 '\u1EC0': 'E', 25594 '\u1EBE': 'E', 25595 '\u1EC4': 'E', 25596 '\u1EC2': 'E', 25597 '\u1EBC': 'E', 25598 '\u0112': 'E', 25599 '\u1E14': 'E', 25600 '\u1E16': 'E', 25601 '\u0114': 'E', 25602 '\u0116': 'E', 25603 '\u00CB': 'E', 25604 '\u1EBA': 'E', 25605 '\u011A': 'E', 25606 '\u0204': 'E', 25607 '\u0206': 'E', 25608 '\u1EB8': 'E', 25609 '\u1EC6': 'E', 25610 '\u0228': 'E', 25611 '\u1E1C': 'E', 25612 '\u0118': 'E', 25613 '\u1E18': 'E', 25614 '\u1E1A': 'E', 25615 '\u0190': 'E', 25616 '\u018E': 'E', 25617 '\u24BB': 'F', 25618 '\uFF26': 'F', 25619 '\u1E1E': 'F', 25620 '\u0191': 'F', 25621 '\uA77B': 'F', 25622 '\u24BC': 'G', 25623 '\uFF27': 'G', 25624 '\u01F4': 'G', 25625 '\u011C': 'G', 25626 '\u1E20': 'G', 25627 '\u011E': 'G', 25628 '\u0120': 'G', 25629 '\u01E6': 'G', 25630 '\u0122': 'G', 25631 '\u01E4': 'G', 25632 '\u0193': 'G', 25633 '\uA7A0': 'G', 25634 '\uA77D': 'G', 25635 '\uA77E': 'G', 25636 '\u24BD': 'H', 25637 '\uFF28': 'H', 25638 '\u0124': 'H', 25639 '\u1E22': 'H', 25640 '\u1E26': 'H', 25641 '\u021E': 'H', 25642 '\u1E24': 'H', 25643 '\u1E28': 'H', 25644 '\u1E2A': 'H', 25645 '\u0126': 'H', 25646 '\u2C67': 'H', 25647 '\u2C75': 'H', 25648 '\uA78D': 'H', 25649 '\u24BE': 'I', 25650 '\uFF29': 'I', 25651 '\u00CC': 'I', 25652 '\u00CD': 'I', 25653 '\u00CE': 'I', 25654 '\u0128': 'I', 25655 '\u012A': 'I', 25656 '\u012C': 'I', 25657 '\u0130': 'I', 25658 '\u00CF': 'I', 25659 '\u1E2E': 'I', 25660 '\u1EC8': 'I', 25661 '\u01CF': 'I', 25662 '\u0208': 'I', 25663 '\u020A': 'I', 25664 '\u1ECA': 'I', 25665 '\u012E': 'I', 25666 '\u1E2C': 'I', 25667 '\u0197': 'I', 25668 '\u24BF': 'J', 25669 '\uFF2A': 'J', 25670 '\u0134': 'J', 25671 '\u0248': 'J', 25672 '\u24C0': 'K', 25673 '\uFF2B': 'K', 25674 '\u1E30': 'K', 25675 '\u01E8': 'K', 25676 '\u1E32': 'K', 25677 '\u0136': 'K', 25678 '\u1E34': 'K', 25679 '\u0198': 'K', 25680 '\u2C69': 'K', 25681 '\uA740': 'K', 25682 '\uA742': 'K', 25683 '\uA744': 'K', 25684 '\uA7A2': 'K', 25685 '\u24C1': 'L', 25686 '\uFF2C': 'L', 25687 '\u013F': 'L', 25688 '\u0139': 'L', 25689 '\u013D': 'L', 25690 '\u1E36': 'L', 25691 '\u1E38': 'L', 25692 '\u013B': 'L', 25693 '\u1E3C': 'L', 25694 '\u1E3A': 'L', 25695 '\u0141': 'L', 25696 '\u023D': 'L', 25697 '\u2C62': 'L', 25698 '\u2C60': 'L', 25699 '\uA748': 'L', 25700 '\uA746': 'L', 25701 '\uA780': 'L', 25702 '\u01C7': 'LJ', 25703 '\u01C8': 'Lj', 25704 '\u24C2': 'M', 25705 '\uFF2D': 'M', 25706 '\u1E3E': 'M', 25707 '\u1E40': 'M', 25708 '\u1E42': 'M', 25709 '\u2C6E': 'M', 25710 '\u019C': 'M', 25711 '\u24C3': 'N', 25712 '\uFF2E': 'N', 25713 '\u01F8': 'N', 25714 '\u0143': 'N', 25715 '\u00D1': 'N', 25716 '\u1E44': 'N', 25717 '\u0147': 'N', 25718 '\u1E46': 'N', 25719 '\u0145': 'N', 25720 '\u1E4A': 'N', 25721 '\u1E48': 'N', 25722 '\u0220': 'N', 25723 '\u019D': 'N', 25724 '\uA790': 'N', 25725 '\uA7A4': 'N', 25726 '\u01CA': 'NJ', 25727 '\u01CB': 'Nj', 25728 '\u24C4': 'O', 25729 '\uFF2F': 'O', 25730 '\u00D2': 'O', 25731 '\u00D3': 'O', 25732 '\u00D4': 'O', 25733 '\u1ED2': 'O', 25734 '\u1ED0': 'O', 25735 '\u1ED6': 'O', 25736 '\u1ED4': 'O', 25737 '\u00D5': 'O', 25738 '\u1E4C': 'O', 25739 '\u022C': 'O', 25740 '\u1E4E': 'O', 25741 '\u014C': 'O', 25742 '\u1E50': 'O', 25743 '\u1E52': 'O', 25744 '\u014E': 'O', 25745 '\u022E': 'O', 25746 '\u0230': 'O', 25747 '\u00D6': 'O', 25748 '\u022A': 'O', 25749 '\u1ECE': 'O', 25750 '\u0150': 'O', 25751 '\u01D1': 'O', 25752 '\u020C': 'O', 25753 '\u020E': 'O', 25754 '\u01A0': 'O', 25755 '\u1EDC': 'O', 25756 '\u1EDA': 'O', 25757 '\u1EE0': 'O', 25758 '\u1EDE': 'O', 25759 '\u1EE2': 'O', 25760 '\u1ECC': 'O', 25761 '\u1ED8': 'O', 25762 '\u01EA': 'O', 25763 '\u01EC': 'O', 25764 '\u00D8': 'O', 25765 '\u01FE': 'O', 25766 '\u0186': 'O', 25767 '\u019F': 'O', 25768 '\uA74A': 'O', 25769 '\uA74C': 'O', 25770 '\u0152': 'OE', 25771 '\u01A2': 'OI', 25772 '\uA74E': 'OO', 25773 '\u0222': 'OU', 25774 '\u24C5': 'P', 25775 '\uFF30': 'P', 25776 '\u1E54': 'P', 25777 '\u1E56': 'P', 25778 '\u01A4': 'P', 25779 '\u2C63': 'P', 25780 '\uA750': 'P', 25781 '\uA752': 'P', 25782 '\uA754': 'P', 25783 '\u24C6': 'Q', 25784 '\uFF31': 'Q', 25785 '\uA756': 'Q', 25786 '\uA758': 'Q', 25787 '\u024A': 'Q', 25788 '\u24C7': 'R', 25789 '\uFF32': 'R', 25790 '\u0154': 'R', 25791 '\u1E58': 'R', 25792 '\u0158': 'R', 25793 '\u0210': 'R', 25794 '\u0212': 'R', 25795 '\u1E5A': 'R', 25796 '\u1E5C': 'R', 25797 '\u0156': 'R', 25798 '\u1E5E': 'R', 25799 '\u024C': 'R', 25800 '\u2C64': 'R', 25801 '\uA75A': 'R', 25802 '\uA7A6': 'R', 25803 '\uA782': 'R', 25804 '\u24C8': 'S', 25805 '\uFF33': 'S', 25806 '\u1E9E': 'S', 25807 '\u015A': 'S', 25808 '\u1E64': 'S', 25809 '\u015C': 'S', 25810 '\u1E60': 'S', 25811 '\u0160': 'S', 25812 '\u1E66': 'S', 25813 '\u1E62': 'S', 25814 '\u1E68': 'S', 25815 '\u0218': 'S', 25816 '\u015E': 'S', 25817 '\u2C7E': 'S', 25818 '\uA7A8': 'S', 25819 '\uA784': 'S', 25820 '\u24C9': 'T', 25821 '\uFF34': 'T', 25822 '\u1E6A': 'T', 25823 '\u0164': 'T', 25824 '\u1E6C': 'T', 25825 '\u021A': 'T', 25826 '\u0162': 'T', 25827 '\u1E70': 'T', 25828 '\u1E6E': 'T', 25829 '\u0166': 'T', 25830 '\u01AC': 'T', 25831 '\u01AE': 'T', 25832 '\u023E': 'T', 25833 '\uA786': 'T', 25834 '\uA728': 'TZ', 25835 '\u24CA': 'U', 25836 '\uFF35': 'U', 25837 '\u00D9': 'U', 25838 '\u00DA': 'U', 25839 '\u00DB': 'U', 25840 '\u0168': 'U', 25841 '\u1E78': 'U', 25842 '\u016A': 'U', 25843 '\u1E7A': 'U', 25844 '\u016C': 'U', 25845 '\u00DC': 'U', 25846 '\u01DB': 'U', 25847 '\u01D7': 'U', 25848 '\u01D5': 'U', 25849 '\u01D9': 'U', 25850 '\u1EE6': 'U', 25851 '\u016E': 'U', 25852 '\u0170': 'U', 25853 '\u01D3': 'U', 25854 '\u0214': 'U', 25855 '\u0216': 'U', 25856 '\u01AF': 'U', 25857 '\u1EEA': 'U', 25858 '\u1EE8': 'U', 25859 '\u1EEE': 'U', 25860 '\u1EEC': 'U', 25861 '\u1EF0': 'U', 25862 '\u1EE4': 'U', 25863 '\u1E72': 'U', 25864 '\u0172': 'U', 25865 '\u1E76': 'U', 25866 '\u1E74': 'U', 25867 '\u0244': 'U', 25868 '\u24CB': 'V', 25869 '\uFF36': 'V', 25870 '\u1E7C': 'V', 25871 '\u1E7E': 'V', 25872 '\u01B2': 'V', 25873 '\uA75E': 'V', 25874 '\u0245': 'V', 25875 '\uA760': 'VY', 25876 '\u24CC': 'W', 25877 '\uFF37': 'W', 25878 '\u1E80': 'W', 25879 '\u1E82': 'W', 25880 '\u0174': 'W', 25881 '\u1E86': 'W', 25882 '\u1E84': 'W', 25883 '\u1E88': 'W', 25884 '\u2C72': 'W', 25885 '\u24CD': 'X', 25886 '\uFF38': 'X', 25887 '\u1E8A': 'X', 25888 '\u1E8C': 'X', 25889 '\u24CE': 'Y', 25890 '\uFF39': 'Y', 25891 '\u1EF2': 'Y', 25892 '\u00DD': 'Y', 25893 '\u0176': 'Y', 25894 '\u1EF8': 'Y', 25895 '\u0232': 'Y', 25896 '\u1E8E': 'Y', 25897 '\u0178': 'Y', 25898 '\u1EF6': 'Y', 25899 '\u1EF4': 'Y', 25900 '\u01B3': 'Y', 25901 '\u024E': 'Y', 25902 '\u1EFE': 'Y', 25903 '\u24CF': 'Z', 25904 '\uFF3A': 'Z', 25905 '\u0179': 'Z', 25906 '\u1E90': 'Z', 25907 '\u017B': 'Z', 25908 '\u017D': 'Z', 25909 '\u1E92': 'Z', 25910 '\u1E94': 'Z', 25911 '\u01B5': 'Z', 25912 '\u0224': 'Z', 25913 '\u2C7F': 'Z', 25914 '\u2C6B': 'Z', 25915 '\uA762': 'Z', 25916 '\u24D0': 'a', 25917 '\uFF41': 'a', 25918 '\u1E9A': 'a', 25919 '\u00E0': 'a', 25920 '\u00E1': 'a', 25921 '\u00E2': 'a', 25922 '\u1EA7': 'a', 25923 '\u1EA5': 'a', 25924 '\u1EAB': 'a', 25925 '\u1EA9': 'a', 25926 '\u00E3': 'a', 25927 '\u0101': 'a', 25928 '\u0103': 'a', 25929 '\u1EB1': 'a', 25930 '\u1EAF': 'a', 25931 '\u1EB5': 'a', 25932 '\u1EB3': 'a', 25933 '\u0227': 'a', 25934 '\u01E1': 'a', 25935 '\u00E4': 'a', 25936 '\u01DF': 'a', 25937 '\u1EA3': 'a', 25938 '\u00E5': 'a', 25939 '\u01FB': 'a', 25940 '\u01CE': 'a', 25941 '\u0201': 'a', 25942 '\u0203': 'a', 25943 '\u1EA1': 'a', 25944 '\u1EAD': 'a', 25945 '\u1EB7': 'a', 25946 '\u1E01': 'a', 25947 '\u0105': 'a', 25948 '\u2C65': 'a', 25949 '\u0250': 'a', 25950 '\uA733': 'aa', 25951 '\u00E6': 'ae', 25952 '\u01FD': 'ae', 25953 '\u01E3': 'ae', 25954 '\uA735': 'ao', 25955 '\uA737': 'au', 25956 '\uA739': 'av', 25957 '\uA73B': 'av', 25958 '\uA73D': 'ay', 25959 '\u24D1': 'b', 25960 '\uFF42': 'b', 25961 '\u1E03': 'b', 25962 '\u1E05': 'b', 25963 '\u1E07': 'b', 25964 '\u0180': 'b', 25965 '\u0183': 'b', 25966 '\u0253': 'b', 25967 '\u24D2': 'c', 25968 '\uFF43': 'c', 25969 '\u0107': 'c', 25970 '\u0109': 'c', 25971 '\u010B': 'c', 25972 '\u010D': 'c', 25973 '\u00E7': 'c', 25974 '\u1E09': 'c', 25975 '\u0188': 'c', 25976 '\u023C': 'c', 25977 '\uA73F': 'c', 25978 '\u2184': 'c', 25979 '\u24D3': 'd', 25980 '\uFF44': 'd', 25981 '\u1E0B': 'd', 25982 '\u010F': 'd', 25983 '\u1E0D': 'd', 25984 '\u1E11': 'd', 25985 '\u1E13': 'd', 25986 '\u1E0F': 'd', 25987 '\u0111': 'd', 25988 '\u018C': 'd', 25989 '\u0256': 'd', 25990 '\u0257': 'd', 25991 '\uA77A': 'd', 25992 '\u01F3': 'dz', 25993 '\u01C6': 'dz', 25994 '\u24D4': 'e', 25995 '\uFF45': 'e', 25996 '\u00E8': 'e', 25997 '\u00E9': 'e', 25998 '\u00EA': 'e', 25999 '\u1EC1': 'e', 26000 '\u1EBF': 'e', 26001 '\u1EC5': 'e', 26002 '\u1EC3': 'e', 26003 '\u1EBD': 'e', 26004 '\u0113': 'e', 26005 '\u1E15': 'e', 26006 '\u1E17': 'e', 26007 '\u0115': 'e', 26008 '\u0117': 'e', 26009 '\u00EB': 'e', 26010 '\u1EBB': 'e', 26011 '\u011B': 'e', 26012 '\u0205': 'e', 26013 '\u0207': 'e', 26014 '\u1EB9': 'e', 26015 '\u1EC7': 'e', 26016 '\u0229': 'e', 26017 '\u1E1D': 'e', 26018 '\u0119': 'e', 26019 '\u1E19': 'e', 26020 '\u1E1B': 'e', 26021 '\u0247': 'e', 26022 '\u025B': 'e', 26023 '\u01DD': 'e', 26024 '\u24D5': 'f', 26025 '\uFF46': 'f', 26026 '\u1E1F': 'f', 26027 '\u0192': 'f', 26028 '\uA77C': 'f', 26029 '\u24D6': 'g', 26030 '\uFF47': 'g', 26031 '\u01F5': 'g', 26032 '\u011D': 'g', 26033 '\u1E21': 'g', 26034 '\u011F': 'g', 26035 '\u0121': 'g', 26036 '\u01E7': 'g', 26037 '\u0123': 'g', 26038 '\u01E5': 'g', 26039 '\u0260': 'g', 26040 '\uA7A1': 'g', 26041 '\u1D79': 'g', 26042 '\uA77F': 'g', 26043 '\u24D7': 'h', 26044 '\uFF48': 'h', 26045 '\u0125': 'h', 26046 '\u1E23': 'h', 26047 '\u1E27': 'h', 26048 '\u021F': 'h', 26049 '\u1E25': 'h', 26050 '\u1E29': 'h', 26051 '\u1E2B': 'h', 26052 '\u1E96': 'h', 26053 '\u0127': 'h', 26054 '\u2C68': 'h', 26055 '\u2C76': 'h', 26056 '\u0265': 'h', 26057 '\u0195': 'hv', 26058 '\u24D8': 'i', 26059 '\uFF49': 'i', 26060 '\u00EC': 'i', 26061 '\u00ED': 'i', 26062 '\u00EE': 'i', 26063 '\u0129': 'i', 26064 '\u012B': 'i', 26065 '\u012D': 'i', 26066 '\u00EF': 'i', 26067 '\u1E2F': 'i', 26068 '\u1EC9': 'i', 26069 '\u01D0': 'i', 26070 '\u0209': 'i', 26071 '\u020B': 'i', 26072 '\u1ECB': 'i', 26073 '\u012F': 'i', 26074 '\u1E2D': 'i', 26075 '\u0268': 'i', 26076 '\u0131': 'i', 26077 '\u24D9': 'j', 26078 '\uFF4A': 'j', 26079 '\u0135': 'j', 26080 '\u01F0': 'j', 26081 '\u0249': 'j', 26082 '\u24DA': 'k', 26083 '\uFF4B': 'k', 26084 '\u1E31': 'k', 26085 '\u01E9': 'k', 26086 '\u1E33': 'k', 26087 '\u0137': 'k', 26088 '\u1E35': 'k', 26089 '\u0199': 'k', 26090 '\u2C6A': 'k', 26091 '\uA741': 'k', 26092 '\uA743': 'k', 26093 '\uA745': 'k', 26094 '\uA7A3': 'k', 26095 '\u24DB': 'l', 26096 '\uFF4C': 'l', 26097 '\u0140': 'l', 26098 '\u013A': 'l', 26099 '\u013E': 'l', 26100 '\u1E37': 'l', 26101 '\u1E39': 'l', 26102 '\u013C': 'l', 26103 '\u1E3D': 'l', 26104 '\u1E3B': 'l', 26105 '\u017F': 'l', 26106 '\u0142': 'l', 26107 '\u019A': 'l', 26108 '\u026B': 'l', 26109 '\u2C61': 'l', 26110 '\uA749': 'l', 26111 '\uA781': 'l', 26112 '\uA747': 'l', 26113 '\u01C9': 'lj', 26114 '\u24DC': 'm', 26115 '\uFF4D': 'm', 26116 '\u1E3F': 'm', 26117 '\u1E41': 'm', 26118 '\u1E43': 'm', 26119 '\u0271': 'm', 26120 '\u026F': 'm', 26121 '\u24DD': 'n', 26122 '\uFF4E': 'n', 26123 '\u01F9': 'n', 26124 '\u0144': 'n', 26125 '\u00F1': 'n', 26126 '\u1E45': 'n', 26127 '\u0148': 'n', 26128 '\u1E47': 'n', 26129 '\u0146': 'n', 26130 '\u1E4B': 'n', 26131 '\u1E49': 'n', 26132 '\u019E': 'n', 26133 '\u0272': 'n', 26134 '\u0149': 'n', 26135 '\uA791': 'n', 26136 '\uA7A5': 'n', 26137 '\u01CC': 'nj', 26138 '\u24DE': 'o', 26139 '\uFF4F': 'o', 26140 '\u00F2': 'o', 26141 '\u00F3': 'o', 26142 '\u00F4': 'o', 26143 '\u1ED3': 'o', 26144 '\u1ED1': 'o', 26145 '\u1ED7': 'o', 26146 '\u1ED5': 'o', 26147 '\u00F5': 'o', 26148 '\u1E4D': 'o', 26149 '\u022D': 'o', 26150 '\u1E4F': 'o', 26151 '\u014D': 'o', 26152 '\u1E51': 'o', 26153 '\u1E53': 'o', 26154 '\u014F': 'o', 26155 '\u022F': 'o', 26156 '\u0231': 'o', 26157 '\u00F6': 'o', 26158 '\u022B': 'o', 26159 '\u1ECF': 'o', 26160 '\u0151': 'o', 26161 '\u01D2': 'o', 26162 '\u020D': 'o', 26163 '\u020F': 'o', 26164 '\u01A1': 'o', 26165 '\u1EDD': 'o', 26166 '\u1EDB': 'o', 26167 '\u1EE1': 'o', 26168 '\u1EDF': 'o', 26169 '\u1EE3': 'o', 26170 '\u1ECD': 'o', 26171 '\u1ED9': 'o', 26172 '\u01EB': 'o', 26173 '\u01ED': 'o', 26174 '\u00F8': 'o', 26175 '\u01FF': 'o', 26176 '\u0254': 'o', 26177 '\uA74B': 'o', 26178 '\uA74D': 'o', 26179 '\u0275': 'o', 26180 '\u0153': 'oe', 26181 '\u01A3': 'oi', 26182 '\u0223': 'ou', 26183 '\uA74F': 'oo', 26184 '\u24DF': 'p', 26185 '\uFF50': 'p', 26186 '\u1E55': 'p', 26187 '\u1E57': 'p', 26188 '\u01A5': 'p', 26189 '\u1D7D': 'p', 26190 '\uA751': 'p', 26191 '\uA753': 'p', 26192 '\uA755': 'p', 26193 '\u24E0': 'q', 26194 '\uFF51': 'q', 26195 '\u024B': 'q', 26196 '\uA757': 'q', 26197 '\uA759': 'q', 26198 '\u24E1': 'r', 26199 '\uFF52': 'r', 26200 '\u0155': 'r', 26201 '\u1E59': 'r', 26202 '\u0159': 'r', 26203 '\u0211': 'r', 26204 '\u0213': 'r', 26205 '\u1E5B': 'r', 26206 '\u1E5D': 'r', 26207 '\u0157': 'r', 26208 '\u1E5F': 'r', 26209 '\u024D': 'r', 26210 '\u027D': 'r', 26211 '\uA75B': 'r', 26212 '\uA7A7': 'r', 26213 '\uA783': 'r', 26214 '\u24E2': 's', 26215 '\uFF53': 's', 26216 '\u00DF': 's', 26217 '\u015B': 's', 26218 '\u1E65': 's', 26219 '\u015D': 's', 26220 '\u1E61': 's', 26221 '\u0161': 's', 26222 '\u1E67': 's', 26223 '\u1E63': 's', 26224 '\u1E69': 's', 26225 '\u0219': 's', 26226 '\u015F': 's', 26227 '\u023F': 's', 26228 '\uA7A9': 's', 26229 '\uA785': 's', 26230 '\u1E9B': 's', 26231 '\u24E3': 't', 26232 '\uFF54': 't', 26233 '\u1E6B': 't', 26234 '\u1E97': 't', 26235 '\u0165': 't', 26236 '\u1E6D': 't', 26237 '\u021B': 't', 26238 '\u0163': 't', 26239 '\u1E71': 't', 26240 '\u1E6F': 't', 26241 '\u0167': 't', 26242 '\u01AD': 't', 26243 '\u0288': 't', 26244 '\u2C66': 't', 26245 '\uA787': 't', 26246 '\uA729': 'tz', 26247 '\u24E4': 'u', 26248 '\uFF55': 'u', 26249 '\u00F9': 'u', 26250 '\u00FA': 'u', 26251 '\u00FB': 'u', 26252 '\u0169': 'u', 26253 '\u1E79': 'u', 26254 '\u016B': 'u', 26255 '\u1E7B': 'u', 26256 '\u016D': 'u', 26257 '\u00FC': 'u', 26258 '\u01DC': 'u', 26259 '\u01D8': 'u', 26260 '\u01D6': 'u', 26261 '\u01DA': 'u', 26262 '\u1EE7': 'u', 26263 '\u016F': 'u', 26264 '\u0171': 'u', 26265 '\u01D4': 'u', 26266 '\u0215': 'u', 26267 '\u0217': 'u', 26268 '\u01B0': 'u', 26269 '\u1EEB': 'u', 26270 '\u1EE9': 'u', 26271 '\u1EEF': 'u', 26272 '\u1EED': 'u', 26273 '\u1EF1': 'u', 26274 '\u1EE5': 'u', 26275 '\u1E73': 'u', 26276 '\u0173': 'u', 26277 '\u1E77': 'u', 26278 '\u1E75': 'u', 26279 '\u0289': 'u', 26280 '\u24E5': 'v', 26281 '\uFF56': 'v', 26282 '\u1E7D': 'v', 26283 '\u1E7F': 'v', 26284 '\u028B': 'v', 26285 '\uA75F': 'v', 26286 '\u028C': 'v', 26287 '\uA761': 'vy', 26288 '\u24E6': 'w', 26289 '\uFF57': 'w', 26290 '\u1E81': 'w', 26291 '\u1E83': 'w', 26292 '\u0175': 'w', 26293 '\u1E87': 'w', 26294 '\u1E85': 'w', 26295 '\u1E98': 'w', 26296 '\u1E89': 'w', 26297 '\u2C73': 'w', 26298 '\u24E7': 'x', 26299 '\uFF58': 'x', 26300 '\u1E8B': 'x', 26301 '\u1E8D': 'x', 26302 '\u24E8': 'y', 26303 '\uFF59': 'y', 26304 '\u1EF3': 'y', 26305 '\u00FD': 'y', 26306 '\u0177': 'y', 26307 '\u1EF9': 'y', 26308 '\u0233': 'y', 26309 '\u1E8F': 'y', 26310 '\u00FF': 'y', 26311 '\u1EF7': 'y', 26312 '\u1E99': 'y', 26313 '\u1EF5': 'y', 26314 '\u01B4': 'y', 26315 '\u024F': 'y', 26316 '\u1EFF': 'y', 26317 '\u24E9': 'z', 26318 '\uFF5A': 'z', 26319 '\u017A': 'z', 26320 '\u1E91': 'z', 26321 '\u017C': 'z', 26322 '\u017E': 'z', 26323 '\u1E93': 'z', 26324 '\u1E95': 'z', 26325 '\u01B6': 'z', 26326 '\u0225': 'z', 26327 '\u0240': 'z', 26328 '\u2C6C': 'z', 26329 '\uA763': 'z', 26330 '\u0386': '\u0391', 26331 '\u0388': '\u0395', 26332 '\u0389': '\u0397', 26333 '\u038A': '\u0399', 26334 '\u03AA': '\u0399', 26335 '\u038C': '\u039F', 26336 '\u038E': '\u03A5', 26337 '\u03AB': '\u03A5', 26338 '\u038F': '\u03A9', 26339 '\u03AC': '\u03B1', 26340 '\u03AD': '\u03B5', 26341 '\u03AE': '\u03B7', 26342 '\u03AF': '\u03B9', 26343 '\u03CA': '\u03B9', 26344 '\u0390': '\u03B9', 26345 '\u03CC': '\u03BF', 26346 '\u03CD': '\u03C5', 26347 '\u03CB': '\u03C5', 26348 '\u03B0': '\u03C5', 26349 '\u03CE': '\u03C9', 26350 '\u03C2': '\u03C3', 26351 '\u2019': '\'' 26352 }; 26353 26354 return diacritics; 26355}); 26356 26357S2.define('select2/data/base',[ 26358 '../utils' 26359], function (Utils) { 26360 function BaseAdapter ($element, options) { 26361 BaseAdapter.__super__.constructor.call(this); 26362 } 26363 26364 Utils.Extend(BaseAdapter, Utils.Observable); 26365 26366 BaseAdapter.prototype.current = function (callback) { 26367 throw new Error('The `current` method must be defined in child classes.'); 26368 }; 26369 26370 BaseAdapter.prototype.query = function (params, callback) { 26371 throw new Error('The `query` method must be defined in child classes.'); 26372 }; 26373 26374 BaseAdapter.prototype.bind = function (container, $container) { 26375 // Can be implemented in subclasses 26376 }; 26377 26378 BaseAdapter.prototype.destroy = function () { 26379 // Can be implemented in subclasses 26380 }; 26381 26382 BaseAdapter.prototype.generateResultId = function (container, data) { 26383 var id = container.id + '-result-'; 26384 26385 id += Utils.generateChars(4); 26386 26387 if (data.id != null) { 26388 id += '-' + data.id.toString(); 26389 } else { 26390 id += '-' + Utils.generateChars(4); 26391 } 26392 return id; 26393 }; 26394 26395 return BaseAdapter; 26396}); 26397 26398S2.define('select2/data/select',[ 26399 './base', 26400 '../utils', 26401 'jquery' 26402], function (BaseAdapter, Utils, $) { 26403 function SelectAdapter ($element, options) { 26404 this.$element = $element; 26405 this.options = options; 26406 26407 SelectAdapter.__super__.constructor.call(this); 26408 } 26409 26410 Utils.Extend(SelectAdapter, BaseAdapter); 26411 26412 SelectAdapter.prototype.current = function (callback) { 26413 var data = []; 26414 var self = this; 26415 26416 this.$element.find(':selected').each(function () { 26417 var $option = $(this); 26418 26419 var option = self.item($option); 26420 26421 data.push(option); 26422 }); 26423 26424 callback(data); 26425 }; 26426 26427 SelectAdapter.prototype.select = function (data) { 26428 var self = this; 26429 26430 data.selected = true; 26431 26432 // If data.element is a DOM node, use it instead 26433 if ($(data.element).is('option')) { 26434 data.element.selected = true; 26435 26436 this.$element.trigger('input').trigger('change'); 26437 26438 return; 26439 } 26440 26441 if (this.$element.prop('multiple')) { 26442 this.current(function (currentData) { 26443 var val = []; 26444 26445 data = [data]; 26446 data.push.apply(data, currentData); 26447 26448 for (var d = 0; d < data.length; d++) { 26449 var id = data[d].id; 26450 26451 if ($.inArray(id, val) === -1) { 26452 val.push(id); 26453 } 26454 } 26455 26456 self.$element.val(val); 26457 self.$element.trigger('input').trigger('change'); 26458 }); 26459 } else { 26460 var val = data.id; 26461 26462 this.$element.val(val); 26463 this.$element.trigger('input').trigger('change'); 26464 } 26465 }; 26466 26467 SelectAdapter.prototype.unselect = function (data) { 26468 var self = this; 26469 26470 if (!this.$element.prop('multiple')) { 26471 return; 26472 } 26473 26474 data.selected = false; 26475 26476 if ($(data.element).is('option')) { 26477 data.element.selected = false; 26478 26479 this.$element.trigger('input').trigger('change'); 26480 26481 return; 26482 } 26483 26484 this.current(function (currentData) { 26485 var val = []; 26486 26487 for (var d = 0; d < currentData.length; d++) { 26488 var id = currentData[d].id; 26489 26490 if (id !== data.id && $.inArray(id, val) === -1) { 26491 val.push(id); 26492 } 26493 } 26494 26495 self.$element.val(val); 26496 26497 self.$element.trigger('input').trigger('change'); 26498 }); 26499 }; 26500 26501 SelectAdapter.prototype.bind = function (container, $container) { 26502 var self = this; 26503 26504 this.container = container; 26505 26506 container.on('select', function (params) { 26507 self.select(params.data); 26508 }); 26509 26510 container.on('unselect', function (params) { 26511 self.unselect(params.data); 26512 }); 26513 }; 26514 26515 SelectAdapter.prototype.destroy = function () { 26516 // Remove anything added to child elements 26517 this.$element.find('*').each(function () { 26518 // Remove any custom data set by Select2 26519 Utils.RemoveData(this); 26520 }); 26521 }; 26522 26523 SelectAdapter.prototype.query = function (params, callback) { 26524 var data = []; 26525 var self = this; 26526 26527 var $options = this.$element.children(); 26528 26529 $options.each(function () { 26530 var $option = $(this); 26531 26532 if (!$option.is('option') && !$option.is('optgroup')) { 26533 return; 26534 } 26535 26536 var option = self.item($option); 26537 26538 var matches = self.matches(params, option); 26539 26540 if (matches !== null) { 26541 data.push(matches); 26542 } 26543 }); 26544 26545 callback({ 26546 results: data 26547 }); 26548 }; 26549 26550 SelectAdapter.prototype.addOptions = function ($options) { 26551 Utils.appendMany(this.$element, $options); 26552 }; 26553 26554 SelectAdapter.prototype.option = function (data) { 26555 var option; 26556 26557 if (data.children) { 26558 option = document.createElement('optgroup'); 26559 option.label = data.text; 26560 } else { 26561 option = document.createElement('option'); 26562 26563 if (option.textContent !== undefined) { 26564 option.textContent = data.text; 26565 } else { 26566 option.innerText = data.text; 26567 } 26568 } 26569 26570 if (data.id !== undefined) { 26571 option.value = data.id; 26572 } 26573 26574 if (data.disabled) { 26575 option.disabled = true; 26576 } 26577 26578 if (data.selected) { 26579 option.selected = true; 26580 } 26581 26582 if (data.title) { 26583 option.title = data.title; 26584 } 26585 26586 var $option = $(option); 26587 26588 var normalizedData = this._normalizeItem(data); 26589 normalizedData.element = option; 26590 26591 // Override the option's data with the combined data 26592 Utils.StoreData(option, 'data', normalizedData); 26593 26594 return $option; 26595 }; 26596 26597 SelectAdapter.prototype.item = function ($option) { 26598 var data = {}; 26599 26600 data = Utils.GetData($option[0], 'data'); 26601 26602 if (data != null) { 26603 return data; 26604 } 26605 26606 if ($option.is('option')) { 26607 data = { 26608 id: $option.val(), 26609 text: $option.text(), 26610 disabled: $option.prop('disabled'), 26611 selected: $option.prop('selected'), 26612 title: $option.prop('title') 26613 }; 26614 } else if ($option.is('optgroup')) { 26615 data = { 26616 text: $option.prop('label'), 26617 children: [], 26618 title: $option.prop('title') 26619 }; 26620 26621 var $children = $option.children('option'); 26622 var children = []; 26623 26624 for (var c = 0; c < $children.length; c++) { 26625 var $child = $($children[c]); 26626 26627 var child = this.item($child); 26628 26629 children.push(child); 26630 } 26631 26632 data.children = children; 26633 } 26634 26635 data = this._normalizeItem(data); 26636 data.element = $option[0]; 26637 26638 Utils.StoreData($option[0], 'data', data); 26639 26640 return data; 26641 }; 26642 26643 SelectAdapter.prototype._normalizeItem = function (item) { 26644 if (item !== Object(item)) { 26645 item = { 26646 id: item, 26647 text: item 26648 }; 26649 } 26650 26651 item = $.extend({}, { 26652 text: '' 26653 }, item); 26654 26655 var defaults = { 26656 selected: false, 26657 disabled: false 26658 }; 26659 26660 if (item.id != null) { 26661 item.id = item.id.toString(); 26662 } 26663 26664 if (item.text != null) { 26665 item.text = item.text.toString(); 26666 } 26667 26668 if (item._resultId == null && item.id && this.container != null) { 26669 item._resultId = this.generateResultId(this.container, item); 26670 } 26671 26672 return $.extend({}, defaults, item); 26673 }; 26674 26675 SelectAdapter.prototype.matches = function (params, data) { 26676 var matcher = this.options.get('matcher'); 26677 26678 return matcher(params, data); 26679 }; 26680 26681 return SelectAdapter; 26682}); 26683 26684S2.define('select2/data/array',[ 26685 './select', 26686 '../utils', 26687 'jquery' 26688], function (SelectAdapter, Utils, $) { 26689 function ArrayAdapter ($element, options) { 26690 this._dataToConvert = options.get('data') || []; 26691 26692 ArrayAdapter.__super__.constructor.call(this, $element, options); 26693 } 26694 26695 Utils.Extend(ArrayAdapter, SelectAdapter); 26696 26697 ArrayAdapter.prototype.bind = function (container, $container) { 26698 ArrayAdapter.__super__.bind.call(this, container, $container); 26699 26700 this.addOptions(this.convertToOptions(this._dataToConvert)); 26701 }; 26702 26703 ArrayAdapter.prototype.select = function (data) { 26704 var $option = this.$element.find('option').filter(function (i, elm) { 26705 return elm.value == data.id.toString(); 26706 }); 26707 26708 if ($option.length === 0) { 26709 $option = this.option(data); 26710 26711 this.addOptions($option); 26712 } 26713 26714 ArrayAdapter.__super__.select.call(this, data); 26715 }; 26716 26717 ArrayAdapter.prototype.convertToOptions = function (data) { 26718 var self = this; 26719 26720 var $existing = this.$element.find('option'); 26721 var existingIds = $existing.map(function () { 26722 return self.item($(this)).id; 26723 }).get(); 26724 26725 var $options = []; 26726 26727 // Filter out all items except for the one passed in the argument 26728 function onlyItem (item) { 26729 return function () { 26730 return $(this).val() == item.id; 26731 }; 26732 } 26733 26734 for (var d = 0; d < data.length; d++) { 26735 var item = this._normalizeItem(data[d]); 26736 26737 // Skip items which were pre-loaded, only merge the data 26738 if ($.inArray(item.id, existingIds) >= 0) { 26739 var $existingOption = $existing.filter(onlyItem(item)); 26740 26741 var existingData = this.item($existingOption); 26742 var newData = $.extend(true, {}, item, existingData); 26743 26744 var $newOption = this.option(newData); 26745 26746 $existingOption.replaceWith($newOption); 26747 26748 continue; 26749 } 26750 26751 var $option = this.option(item); 26752 26753 if (item.children) { 26754 var $children = this.convertToOptions(item.children); 26755 26756 Utils.appendMany($option, $children); 26757 } 26758 26759 $options.push($option); 26760 } 26761 26762 return $options; 26763 }; 26764 26765 return ArrayAdapter; 26766}); 26767 26768S2.define('select2/data/ajax',[ 26769 './array', 26770 '../utils', 26771 'jquery' 26772], function (ArrayAdapter, Utils, $) { 26773 function AjaxAdapter ($element, options) { 26774 this.ajaxOptions = this._applyDefaults(options.get('ajax')); 26775 26776 if (this.ajaxOptions.processResults != null) { 26777 this.processResults = this.ajaxOptions.processResults; 26778 } 26779 26780 AjaxAdapter.__super__.constructor.call(this, $element, options); 26781 } 26782 26783 Utils.Extend(AjaxAdapter, ArrayAdapter); 26784 26785 AjaxAdapter.prototype._applyDefaults = function (options) { 26786 var defaults = { 26787 data: function (params) { 26788 return $.extend({}, params, { 26789 q: params.term 26790 }); 26791 }, 26792 transport: function (params, success, failure) { 26793 var $request = $.ajax(params); 26794 26795 $request.then(success); 26796 $request.fail(failure); 26797 26798 return $request; 26799 } 26800 }; 26801 26802 return $.extend({}, defaults, options, true); 26803 }; 26804 26805 AjaxAdapter.prototype.processResults = function (results) { 26806 return results; 26807 }; 26808 26809 AjaxAdapter.prototype.query = function (params, callback) { 26810 var matches = []; 26811 var self = this; 26812 26813 if (this._request != null) { 26814 // JSONP requests cannot always be aborted 26815 if ($.isFunction(this._request.abort)) { 26816 this._request.abort(); 26817 } 26818 26819 this._request = null; 26820 } 26821 26822 var options = $.extend({ 26823 type: 'GET' 26824 }, this.ajaxOptions); 26825 26826 if (typeof options.url === 'function') { 26827 options.url = options.url.call(this.$element, params); 26828 } 26829 26830 if (typeof options.data === 'function') { 26831 options.data = options.data.call(this.$element, params); 26832 } 26833 26834 function request () { 26835 var $request = options.transport(options, function (data) { 26836 var results = self.processResults(data, params); 26837 26838 if (self.options.get('debug') && window.console && console.error) { 26839 // Check to make sure that the response included a `results` key. 26840 if (!results || !results.results || !$.isArray(results.results)) { 26841 console.error( 26842 'Select2: The AJAX results did not return an array in the ' + 26843 '`results` key of the response.' 26844 ); 26845 } 26846 } 26847 26848 callback(results); 26849 }, function () { 26850 // Attempt to detect if a request was aborted 26851 // Only works if the transport exposes a status property 26852 if ('status' in $request && 26853 ($request.status === 0 || $request.status === '0')) { 26854 return; 26855 } 26856 26857 self.trigger('results:message', { 26858 message: 'errorLoading' 26859 }); 26860 }); 26861 26862 self._request = $request; 26863 } 26864 26865 if (this.ajaxOptions.delay && params.term != null) { 26866 if (this._queryTimeout) { 26867 window.clearTimeout(this._queryTimeout); 26868 } 26869 26870 this._queryTimeout = window.setTimeout(request, this.ajaxOptions.delay); 26871 } else { 26872 request(); 26873 } 26874 }; 26875 26876 return AjaxAdapter; 26877}); 26878 26879S2.define('select2/data/tags',[ 26880 'jquery' 26881], function ($) { 26882 function Tags (decorated, $element, options) { 26883 var tags = options.get('tags'); 26884 26885 var createTag = options.get('createTag'); 26886 26887 if (createTag !== undefined) { 26888 this.createTag = createTag; 26889 } 26890 26891 var insertTag = options.get('insertTag'); 26892 26893 if (insertTag !== undefined) { 26894 this.insertTag = insertTag; 26895 } 26896 26897 decorated.call(this, $element, options); 26898 26899 if ($.isArray(tags)) { 26900 for (var t = 0; t < tags.length; t++) { 26901 var tag = tags[t]; 26902 var item = this._normalizeItem(tag); 26903 26904 var $option = this.option(item); 26905 26906 this.$element.append($option); 26907 } 26908 } 26909 } 26910 26911 Tags.prototype.query = function (decorated, params, callback) { 26912 var self = this; 26913 26914 this._removeOldTags(); 26915 26916 if (params.term == null || params.page != null) { 26917 decorated.call(this, params, callback); 26918 return; 26919 } 26920 26921 function wrapper (obj, child) { 26922 var data = obj.results; 26923 26924 for (var i = 0; i < data.length; i++) { 26925 var option = data[i]; 26926 26927 var checkChildren = ( 26928 option.children != null && 26929 !wrapper({ 26930 results: option.children 26931 }, true) 26932 ); 26933 26934 var optionText = (option.text || '').toUpperCase(); 26935 var paramsTerm = (params.term || '').toUpperCase(); 26936 26937 var checkText = optionText === paramsTerm; 26938 26939 if (checkText || checkChildren) { 26940 if (child) { 26941 return false; 26942 } 26943 26944 obj.data = data; 26945 callback(obj); 26946 26947 return; 26948 } 26949 } 26950 26951 if (child) { 26952 return true; 26953 } 26954 26955 var tag = self.createTag(params); 26956 26957 if (tag != null) { 26958 var $option = self.option(tag); 26959 $option.attr('data-select2-tag', true); 26960 26961 self.addOptions([$option]); 26962 26963 self.insertTag(data, tag); 26964 } 26965 26966 obj.results = data; 26967 26968 callback(obj); 26969 } 26970 26971 decorated.call(this, params, wrapper); 26972 }; 26973 26974 Tags.prototype.createTag = function (decorated, params) { 26975 var term = $.trim(params.term); 26976 26977 if (term === '') { 26978 return null; 26979 } 26980 26981 return { 26982 id: term, 26983 text: term 26984 }; 26985 }; 26986 26987 Tags.prototype.insertTag = function (_, data, tag) { 26988 data.unshift(tag); 26989 }; 26990 26991 Tags.prototype._removeOldTags = function (_) { 26992 var $options = this.$element.find('option[data-select2-tag]'); 26993 26994 $options.each(function () { 26995 if (this.selected) { 26996 return; 26997 } 26998 26999 $(this).remove(); 27000 }); 27001 }; 27002 27003 return Tags; 27004}); 27005 27006S2.define('select2/data/tokenizer',[ 27007 'jquery' 27008], function ($) { 27009 function Tokenizer (decorated, $element, options) { 27010 var tokenizer = options.get('tokenizer'); 27011 27012 if (tokenizer !== undefined) { 27013 this.tokenizer = tokenizer; 27014 } 27015 27016 decorated.call(this, $element, options); 27017 } 27018 27019 Tokenizer.prototype.bind = function (decorated, container, $container) { 27020 decorated.call(this, container, $container); 27021 27022 this.$search = container.dropdown.$search || container.selection.$search || 27023 $container.find('.select2-search__field'); 27024 }; 27025 27026 Tokenizer.prototype.query = function (decorated, params, callback) { 27027 var self = this; 27028 27029 function createAndSelect (data) { 27030 // Normalize the data object so we can use it for checks 27031 var item = self._normalizeItem(data); 27032 27033 // Check if the data object already exists as a tag 27034 // Select it if it doesn't 27035 var $existingOptions = self.$element.find('option').filter(function () { 27036 return $(this).val() === item.id; 27037 }); 27038 27039 // If an existing option wasn't found for it, create the option 27040 if (!$existingOptions.length) { 27041 var $option = self.option(item); 27042 $option.attr('data-select2-tag', true); 27043 27044 self._removeOldTags(); 27045 self.addOptions([$option]); 27046 } 27047 27048 // Select the item, now that we know there is an option for it 27049 select(item); 27050 } 27051 27052 function select (data) { 27053 self.trigger('select', { 27054 data: data 27055 }); 27056 } 27057 27058 params.term = params.term || ''; 27059 27060 var tokenData = this.tokenizer(params, this.options, createAndSelect); 27061 27062 if (tokenData.term !== params.term) { 27063 // Replace the search term if we have the search box 27064 if (this.$search.length) { 27065 this.$search.val(tokenData.term); 27066 this.$search.trigger('focus'); 27067 } 27068 27069 params.term = tokenData.term; 27070 } 27071 27072 decorated.call(this, params, callback); 27073 }; 27074 27075 Tokenizer.prototype.tokenizer = function (_, params, options, callback) { 27076 var separators = options.get('tokenSeparators') || []; 27077 var term = params.term; 27078 var i = 0; 27079 27080 var createTag = this.createTag || function (params) { 27081 return { 27082 id: params.term, 27083 text: params.term 27084 }; 27085 }; 27086 27087 while (i < term.length) { 27088 var termChar = term[i]; 27089 27090 if ($.inArray(termChar, separators) === -1) { 27091 i++; 27092 27093 continue; 27094 } 27095 27096 var part = term.substr(0, i); 27097 var partParams = $.extend({}, params, { 27098 term: part 27099 }); 27100 27101 var data = createTag(partParams); 27102 27103 if (data == null) { 27104 i++; 27105 continue; 27106 } 27107 27108 callback(data); 27109 27110 // Reset the term to not include the tokenized portion 27111 term = term.substr(i + 1) || ''; 27112 i = 0; 27113 } 27114 27115 return { 27116 term: term 27117 }; 27118 }; 27119 27120 return Tokenizer; 27121}); 27122 27123S2.define('select2/data/minimumInputLength',[ 27124 27125], function () { 27126 function MinimumInputLength (decorated, $e, options) { 27127 this.minimumInputLength = options.get('minimumInputLength'); 27128 27129 decorated.call(this, $e, options); 27130 } 27131 27132 MinimumInputLength.prototype.query = function (decorated, params, callback) { 27133 params.term = params.term || ''; 27134 27135 if (params.term.length < this.minimumInputLength) { 27136 this.trigger('results:message', { 27137 message: 'inputTooShort', 27138 args: { 27139 minimum: this.minimumInputLength, 27140 input: params.term, 27141 params: params 27142 } 27143 }); 27144 27145 return; 27146 } 27147 27148 decorated.call(this, params, callback); 27149 }; 27150 27151 return MinimumInputLength; 27152}); 27153 27154S2.define('select2/data/maximumInputLength',[ 27155 27156], function () { 27157 function MaximumInputLength (decorated, $e, options) { 27158 this.maximumInputLength = options.get('maximumInputLength'); 27159 27160 decorated.call(this, $e, options); 27161 } 27162 27163 MaximumInputLength.prototype.query = function (decorated, params, callback) { 27164 params.term = params.term || ''; 27165 27166 if (this.maximumInputLength > 0 && 27167 params.term.length > this.maximumInputLength) { 27168 this.trigger('results:message', { 27169 message: 'inputTooLong', 27170 args: { 27171 maximum: this.maximumInputLength, 27172 input: params.term, 27173 params: params 27174 } 27175 }); 27176 27177 return; 27178 } 27179 27180 decorated.call(this, params, callback); 27181 }; 27182 27183 return MaximumInputLength; 27184}); 27185 27186S2.define('select2/data/maximumSelectionLength',[ 27187 27188], function (){ 27189 function MaximumSelectionLength (decorated, $e, options) { 27190 this.maximumSelectionLength = options.get('maximumSelectionLength'); 27191 27192 decorated.call(this, $e, options); 27193 } 27194 27195 MaximumSelectionLength.prototype.bind = 27196 function (decorated, container, $container) { 27197 var self = this; 27198 27199 decorated.call(this, container, $container); 27200 27201 container.on('select', function () { 27202 self._checkIfMaximumSelected(); 27203 }); 27204 }; 27205 27206 MaximumSelectionLength.prototype.query = 27207 function (decorated, params, callback) { 27208 var self = this; 27209 27210 this._checkIfMaximumSelected(function () { 27211 decorated.call(self, params, callback); 27212 }); 27213 }; 27214 27215 MaximumSelectionLength.prototype._checkIfMaximumSelected = 27216 function (_, successCallback) { 27217 var self = this; 27218 27219 this.current(function (currentData) { 27220 var count = currentData != null ? currentData.length : 0; 27221 if (self.maximumSelectionLength > 0 && 27222 count >= self.maximumSelectionLength) { 27223 self.trigger('results:message', { 27224 message: 'maximumSelected', 27225 args: { 27226 maximum: self.maximumSelectionLength 27227 } 27228 }); 27229 return; 27230 } 27231 27232 if (successCallback) { 27233 successCallback(); 27234 } 27235 }); 27236 }; 27237 27238 return MaximumSelectionLength; 27239}); 27240 27241S2.define('select2/dropdown',[ 27242 'jquery', 27243 './utils' 27244], function ($, Utils) { 27245 function Dropdown ($element, options) { 27246 this.$element = $element; 27247 this.options = options; 27248 27249 Dropdown.__super__.constructor.call(this); 27250 } 27251 27252 Utils.Extend(Dropdown, Utils.Observable); 27253 27254 Dropdown.prototype.render = function () { 27255 var $dropdown = $( 27256 '<span class="select2-dropdown">' + 27257 '<span class="select2-results"></span>' + 27258 '</span>' 27259 ); 27260 27261 $dropdown.attr('dir', this.options.get('dir')); 27262 27263 this.$dropdown = $dropdown; 27264 27265 return $dropdown; 27266 }; 27267 27268 Dropdown.prototype.bind = function () { 27269 // Should be implemented in subclasses 27270 }; 27271 27272 Dropdown.prototype.position = function ($dropdown, $container) { 27273 // Should be implemented in subclasses 27274 }; 27275 27276 Dropdown.prototype.destroy = function () { 27277 // Remove the dropdown from the DOM 27278 this.$dropdown.remove(); 27279 }; 27280 27281 return Dropdown; 27282}); 27283 27284S2.define('select2/dropdown/search',[ 27285 'jquery', 27286 '../utils' 27287], function ($, Utils) { 27288 function Search () { } 27289 27290 Search.prototype.render = function (decorated) { 27291 var $rendered = decorated.call(this); 27292 27293 var $search = $( 27294 '<span class="select2-search select2-search--dropdown">' + 27295 '<input class="select2-search__field" type="search" tabindex="-1"' + 27296 ' autocomplete="off" autocorrect="off" autocapitalize="none"' + 27297 ' spellcheck="false" role="searchbox" aria-autocomplete="list" />' + 27298 '</span>' 27299 ); 27300 27301 this.$searchContainer = $search; 27302 this.$search = $search.find('input'); 27303 27304 $rendered.prepend($search); 27305 27306 return $rendered; 27307 }; 27308 27309 Search.prototype.bind = function (decorated, container, $container) { 27310 var self = this; 27311 27312 var resultsId = container.id + '-results'; 27313 27314 decorated.call(this, container, $container); 27315 27316 this.$search.on('keydown', function (evt) { 27317 self.trigger('keypress', evt); 27318 27319 self._keyUpPrevented = evt.isDefaultPrevented(); 27320 }); 27321 27322 // Workaround for browsers which do not support the `input` event 27323 // This will prevent double-triggering of events for browsers which support 27324 // both the `keyup` and `input` events. 27325 this.$search.on('input', function (evt) { 27326 // Unbind the duplicated `keyup` event 27327 $(this).off('keyup'); 27328 }); 27329 27330 this.$search.on('keyup input', function (evt) { 27331 self.handleSearch(evt); 27332 }); 27333 27334 container.on('open', function () { 27335 self.$search.attr('tabindex', 0); 27336 self.$search.attr('aria-controls', resultsId); 27337 27338 self.$search.trigger('focus'); 27339 27340 window.setTimeout(function () { 27341 self.$search.trigger('focus'); 27342 }, 0); 27343 }); 27344 27345 container.on('close', function () { 27346 self.$search.attr('tabindex', -1); 27347 self.$search.removeAttr('aria-controls'); 27348 self.$search.removeAttr('aria-activedescendant'); 27349 27350 self.$search.val(''); 27351 self.$search.trigger('blur'); 27352 }); 27353 27354 container.on('focus', function () { 27355 if (!container.isOpen()) { 27356 self.$search.trigger('focus'); 27357 } 27358 }); 27359 27360 container.on('results:all', function (params) { 27361 if (params.query.term == null || params.query.term === '') { 27362 var showSearch = self.showSearch(params); 27363 27364 if (showSearch) { 27365 self.$searchContainer.removeClass('select2-search--hide'); 27366 } else { 27367 self.$searchContainer.addClass('select2-search--hide'); 27368 } 27369 } 27370 }); 27371 27372 container.on('results:focus', function (params) { 27373 if (params.data._resultId) { 27374 self.$search.attr('aria-activedescendant', params.data._resultId); 27375 } else { 27376 self.$search.removeAttr('aria-activedescendant'); 27377 } 27378 }); 27379 }; 27380 27381 Search.prototype.handleSearch = function (evt) { 27382 if (!this._keyUpPrevented) { 27383 var input = this.$search.val(); 27384 27385 this.trigger('query', { 27386 term: input 27387 }); 27388 } 27389 27390 this._keyUpPrevented = false;
vendor: 18,179 bytes, lines 27391-28116
27391 }; 27392 27393 Search.prototype.showSearch = function (_, params) { 27394 return true; 27395 }; 27396 27397 return Search; 27398}); 27399 27400S2.define('select2/dropdown/hidePlaceholder',[ 27401 27402], function () { 27403 function HidePlaceholder (decorated, $element, options, dataAdapter) { 27404 this.placeholder = this.normalizePlaceholder(options.get('placeholder')); 27405 27406 decorated.call(this, $element, options, dataAdapter); 27407 } 27408 27409 HidePlaceholder.prototype.append = function (decorated, data) { 27410 data.results = this.removePlaceholder(data.results); 27411 27412 decorated.call(this, data); 27413 }; 27414 27415 HidePlaceholder.prototype.normalizePlaceholder = function (_, placeholder) { 27416 if (typeof placeholder === 'string') { 27417 placeholder = { 27418 id: '', 27419 text: placeholder 27420 }; 27421 } 27422 27423 return placeholder; 27424 }; 27425 27426 HidePlaceholder.prototype.removePlaceholder = function (_, data) { 27427 var modifiedData = data.slice(0); 27428 27429 for (var d = data.length - 1; d >= 0; d--) { 27430 var item = data[d]; 27431 27432 if (this.placeholder.id === item.id) { 27433 modifiedData.splice(d, 1); 27434 } 27435 } 27436 27437 return modifiedData; 27438 }; 27439 27440 return HidePlaceholder; 27441}); 27442 27443S2.define('select2/dropdown/infiniteScroll',[ 27444 'jquery' 27445], function ($) { 27446 function InfiniteScroll (decorated, $element, options, dataAdapter) { 27447 this.lastParams = {}; 27448 27449 decorated.call(this, $element, options, dataAdapter); 27450 27451 this.$loadingMore = this.createLoadingMore(); 27452 this.loading = false; 27453 } 27454 27455 InfiniteScroll.prototype.append = function (decorated, data) { 27456 this.$loadingMore.remove(); 27457 this.loading = false; 27458 27459 decorated.call(this, data); 27460 27461 if (this.showLoadingMore(data)) { 27462 this.$results.append(this.$loadingMore); 27463 this.loadMoreIfNeeded(); 27464 } 27465 }; 27466 27467 InfiniteScroll.prototype.bind = function (decorated, container, $container) { 27468 var self = this; 27469 27470 decorated.call(this, container, $container); 27471 27472 container.on('query', function (params) { 27473 self.lastParams = params; 27474 self.loading = true; 27475 }); 27476 27477 container.on('query:append', function (params) { 27478 self.lastParams = params; 27479 self.loading = true; 27480 }); 27481 27482 this.$results.on('scroll', this.loadMoreIfNeeded.bind(this)); 27483 }; 27484 27485 InfiniteScroll.prototype.loadMoreIfNeeded = function () { 27486 var isLoadMoreVisible = $.contains( 27487 document.documentElement, 27488 this.$loadingMore[0] 27489 ); 27490 27491 if (this.loading || !isLoadMoreVisible) { 27492 return; 27493 } 27494 27495 var currentOffset = this.$results.offset().top + 27496 this.$results.outerHeight(false); 27497 var loadingMoreOffset = this.$loadingMore.offset().top + 27498 this.$loadingMore.outerHeight(false); 27499 27500 if (currentOffset + 50 >= loadingMoreOffset) { 27501 this.loadMore(); 27502 } 27503 }; 27504 27505 InfiniteScroll.prototype.loadMore = function () { 27506 this.loading = true; 27507 27508 var params = $.extend({}, {page: 1}, this.lastParams); 27509 27510 params.page++; 27511 27512 this.trigger('query:append', params); 27513 }; 27514 27515 InfiniteScroll.prototype.showLoadingMore = function (_, data) { 27516 return data.pagination && data.pagination.more; 27517 }; 27518 27519 InfiniteScroll.prototype.createLoadingMore = function () { 27520 var $option = $( 27521 '<li ' + 27522 'class="select2-results__option select2-results__option--load-more"' + 27523 'role="option" aria-disabled="true"></li>' 27524 ); 27525 27526 var message = this.options.get('translations').get('loadingMore'); 27527 27528 $option.html(message(this.lastParams)); 27529 27530 return $option; 27531 }; 27532 27533 return InfiniteScroll; 27534}); 27535 27536S2.define('select2/dropdown/attachBody',[ 27537 'jquery', 27538 '../utils' 27539], function ($, Utils) { 27540 function AttachBody (decorated, $element, options) { 27541 this.$dropdownParent = $(options.get('dropdownParent') || document.body); 27542 27543 decorated.call(this, $element, options); 27544 } 27545 27546 AttachBody.prototype.bind = function (decorated, container, $container) { 27547 var self = this; 27548 27549 decorated.call(this, container, $container); 27550 27551 container.on('open', function () { 27552 self._showDropdown(); 27553 self._attachPositioningHandler(container); 27554 27555 // Must bind after the results handlers to ensure correct sizing 27556 self._bindContainerResultHandlers(container); 27557 }); 27558 27559 container.on('close', function () { 27560 self._hideDropdown(); 27561 self._detachPositioningHandler(container); 27562 }); 27563 27564 this.$dropdownContainer.on('mousedown', function (evt) { 27565 evt.stopPropagation(); 27566 }); 27567 }; 27568 27569 AttachBody.prototype.destroy = function (decorated) { 27570 decorated.call(this); 27571 27572 this.$dropdownContainer.remove(); 27573 }; 27574 27575 AttachBody.prototype.position = function (decorated, $dropdown, $container) { 27576 // Clone all of the container classes 27577 $dropdown.attr('class', $container.attr('class')); 27578 27579 $dropdown.removeClass('select2'); 27580 $dropdown.addClass('select2-container--open'); 27581 27582 $dropdown.css({ 27583 position: 'absolute', 27584 top: -999999 27585 }); 27586 27587 this.$container = $container; 27588 }; 27589 27590 AttachBody.prototype.render = function (decorated) { 27591 var $container = $('<span></span>'); 27592 27593 var $dropdown = decorated.call(this); 27594 $container.append($dropdown); 27595 27596 this.$dropdownContainer = $container; 27597 27598 return $container; 27599 }; 27600 27601 AttachBody.prototype._hideDropdown = function (decorated) { 27602 this.$dropdownContainer.detach(); 27603 }; 27604 27605 AttachBody.prototype._bindContainerResultHandlers = 27606 function (decorated, container) { 27607 27608 // These should only be bound once 27609 if (this._containerResultsHandlersBound) { 27610 return; 27611 } 27612 27613 var self = this; 27614 27615 container.on('results:all', function () { 27616 self._positionDropdown(); 27617 self._resizeDropdown(); 27618 }); 27619 27620 container.on('results:append', function () { 27621 self._positionDropdown(); 27622 self._resizeDropdown(); 27623 }); 27624 27625 container.on('results:message', function () { 27626 self._positionDropdown(); 27627 self._resizeDropdown(); 27628 }); 27629 27630 container.on('select', function () { 27631 self._positionDropdown(); 27632 self._resizeDropdown(); 27633 }); 27634 27635 container.on('unselect', function () { 27636 self._positionDropdown(); 27637 self._resizeDropdown(); 27638 }); 27639 27640 this._containerResultsHandlersBound = true; 27641 }; 27642 27643 AttachBody.prototype._attachPositioningHandler = 27644 function (decorated, container) { 27645 var self = this; 27646 27647 var scrollEvent = 'scroll.select2.' + container.id; 27648 var resizeEvent = 'resize.select2.' + container.id; 27649 var orientationEvent = 'orientationchange.select2.' + container.id; 27650 27651 var $watchers = this.$container.parents().filter(Utils.hasScroll); 27652 $watchers.each(function () { 27653 Utils.StoreData(this, 'select2-scroll-position', { 27654 x: $(this).scrollLeft(), 27655 y: $(this).scrollTop() 27656 }); 27657 }); 27658 27659 $watchers.on(scrollEvent, function (ev) { 27660 var position = Utils.GetData(this, 'select2-scroll-position'); 27661 $(this).scrollTop(position.y); 27662 }); 27663 27664 $(window).on(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent, 27665 function (e) { 27666 self._positionDropdown(); 27667 self._resizeDropdown(); 27668 }); 27669 }; 27670 27671 AttachBody.prototype._detachPositioningHandler = 27672 function (decorated, container) { 27673 var scrollEvent = 'scroll.select2.' + container.id; 27674 var resizeEvent = 'resize.select2.' + container.id; 27675 var orientationEvent = 'orientationchange.select2.' + container.id; 27676 27677 var $watchers = this.$container.parents().filter(Utils.hasScroll); 27678 $watchers.off(scrollEvent); 27679 27680 $(window).off(scrollEvent + ' ' + resizeEvent + ' ' + orientationEvent); 27681 }; 27682 27683 AttachBody.prototype._positionDropdown = function () { 27684 var $window = $(window); 27685 27686 var isCurrentlyAbove = this.$dropdown.hasClass('select2-dropdown--above'); 27687 var isCurrentlyBelow = this.$dropdown.hasClass('select2-dropdown--below'); 27688 27689 var newDirection = null; 27690 27691 var offset = this.$container.offset(); 27692 27693 offset.bottom = offset.top + this.$container.outerHeight(false); 27694 27695 var container = { 27696 height: this.$container.outerHeight(false) 27697 }; 27698 27699 container.top = offset.top; 27700 container.bottom = offset.top + container.height; 27701 27702 var dropdown = { 27703 height: this.$dropdown.outerHeight(false) 27704 }; 27705 27706 var viewport = { 27707 top: $window.scrollTop(), 27708 bottom: $window.scrollTop() + $window.height() 27709 }; 27710 27711 var enoughRoomAbove = viewport.top < (offset.top - dropdown.height); 27712 var enoughRoomBelow = viewport.bottom > (offset.bottom + dropdown.height); 27713 27714 var css = { 27715 left: offset.left, 27716 top: container.bottom 27717 }; 27718 27719 // Determine what the parent element is to use for calculating the offset 27720 var $offsetParent = this.$dropdownParent; 27721 27722 // For statically positioned elements, we need to get the element 27723 // that is determining the offset 27724 if ($offsetParent.css('position') === 'static') { 27725 $offsetParent = $offsetParent.offsetParent(); 27726 } 27727 27728 var parentOffset = { 27729 top: 0, 27730 left: 0 27731 }; 27732 27733 if ( 27734 $.contains(document.body, $offsetParent[0]) || 27735 $offsetParent[0].isConnected 27736 ) { 27737 parentOffset = $offsetParent.offset(); 27738 } 27739 27740 css.top -= parentOffset.top; 27741 css.left -= parentOffset.left; 27742 27743 if (!isCurrentlyAbove && !isCurrentlyBelow) { 27744 newDirection = 'below'; 27745 } 27746 27747 if (!enoughRoomBelow && enoughRoomAbove && !isCurrentlyAbove) { 27748 newDirection = 'above'; 27749 } else if (!enoughRoomAbove && enoughRoomBelow && isCurrentlyAbove) { 27750 newDirection = 'below'; 27751 } 27752 27753 if (newDirection == 'above' || 27754 (isCurrentlyAbove && newDirection !== 'below')) { 27755 css.top = container.top - parentOffset.top - dropdown.height; 27756 } 27757 27758 if (newDirection != null) { 27759 this.$dropdown 27760 .removeClass('select2-dropdown--below select2-dropdown--above') 27761 .addClass('select2-dropdown--' + newDirection); 27762 this.$container 27763 .removeClass('select2-container--below select2-container--above') 27764 .addClass('select2-container--' + newDirection); 27765 } 27766 27767 this.$dropdownContainer.css(css); 27768 }; 27769 27770 AttachBody.prototype._resizeDropdown = function () { 27771 var css = { 27772 width: this.$container.outerWidth(false) + 'px' 27773 }; 27774 27775 if (this.options.get('dropdownAutoWidth')) { 27776 css.minWidth = css.width; 27777 css.position = 'relative'; 27778 css.width = 'auto'; 27779 } 27780 27781 this.$dropdown.css(css); 27782 }; 27783 27784 AttachBody.prototype._showDropdown = function (decorated) { 27785 this.$dropdownContainer.appendTo(this.$dropdownParent); 27786 27787 this._positionDropdown(); 27788 this._resizeDropdown(); 27789 }; 27790 27791 return AttachBody; 27792}); 27793 27794S2.define('select2/dropdown/minimumResultsForSearch',[ 27795 27796], function () { 27797 function countResults (data) { 27798 var count = 0; 27799 27800 for (var d = 0; d < data.length; d++) { 27801 var item = data[d]; 27802 27803 if (item.children) { 27804 count += countResults(item.children); 27805 } else { 27806 count++; 27807 } 27808 } 27809 27810 return count; 27811 } 27812 27813 function MinimumResultsForSearch (decorated, $element, options, dataAdapter) { 27814 this.minimumResultsForSearch = options.get('minimumResultsForSearch'); 27815 27816 if (this.minimumResultsForSearch < 0) { 27817 this.minimumResultsForSearch = Infinity; 27818 } 27819 27820 decorated.call(this, $element, options, dataAdapter); 27821 } 27822 27823 MinimumResultsForSearch.prototype.showSearch = function (decorated, params) { 27824 if (countResults(params.data.results) < this.minimumResultsForSearch) { 27825 return false; 27826 } 27827 27828 return decorated.call(this, params); 27829 }; 27830 27831 return MinimumResultsForSearch; 27832}); 27833 27834S2.define('select2/dropdown/selectOnClose',[ 27835 '../utils' 27836], function (Utils) { 27837 function SelectOnClose () { } 27838 27839 SelectOnClose.prototype.bind = function (decorated, container, $container) { 27840 var self = this; 27841 27842 decorated.call(this, container, $container); 27843 27844 container.on('close', function (params) { 27845 self._handleSelectOnClose(params); 27846 }); 27847 }; 27848 27849 SelectOnClose.prototype._handleSelectOnClose = function (_, params) { 27850 if (params && params.originalSelect2Event != null) { 27851 var event = params.originalSelect2Event; 27852 27853 // Don't select an item if the close event was triggered from a select or 27854 // unselect event 27855 if (event._type === 'select' || event._type === 'unselect') { 27856 return; 27857 } 27858 } 27859 27860 var $highlightedResults = this.getHighlightedResults(); 27861 27862 // Only select highlighted results 27863 if ($highlightedResults.length < 1) { 27864 return; 27865 } 27866 27867 var data = Utils.GetData($highlightedResults[0], 'data'); 27868 27869 // Don't re-select already selected resulte 27870 if ( 27871 (data.element != null && data.element.selected) || 27872 (data.element == null && data.selected) 27873 ) { 27874 return; 27875 } 27876 27877 this.trigger('select', { 27878 data: data 27879 }); 27880 }; 27881 27882 return SelectOnClose; 27883}); 27884 27885S2.define('select2/dropdown/closeOnSelect',[ 27886 27887], function () { 27888 function CloseOnSelect () { } 27889 27890 CloseOnSelect.prototype.bind = function (decorated, container, $container) { 27891 var self = this; 27892 27893 decorated.call(this, container, $container); 27894 27895 container.on('select', function (evt) { 27896 self._selectTriggered(evt); 27897 }); 27898 27899 container.on('unselect', function (evt) { 27900 self._selectTriggered(evt); 27901 }); 27902 }; 27903 27904 CloseOnSelect.prototype._selectTriggered = function (_, evt) { 27905 var originalEvent = evt.originalEvent; 27906 27907 // Don't close if the control key is being held 27908 if (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey)) { 27909 return; 27910 } 27911 27912 this.trigger('close', { 27913 originalEvent: originalEvent, 27914 originalSelect2Event: evt 27915 }); 27916 }; 27917 27918 return CloseOnSelect; 27919}); 27920 27921S2.define('select2/i18n/en',[],function () { 27922 // English 27923 return { 27924 errorLoading: function () { 27925 return 'The results could not be loaded.'; 27926 }, 27927 inputTooLong: function (args) { 27928 var overChars = args.input.length - args.maximum; 27929 27930 var message = 'Please delete ' + overChars + ' character'; 27931 27932 if (overChars != 1) { 27933 message += 's'; 27934 } 27935 27936 return message; 27937 }, 27938 inputTooShort: function (args) { 27939 var remainingChars = args.minimum - args.input.length; 27940 27941 var message = 'Please enter ' + remainingChars + ' or more characters'; 27942 27943 return message; 27944 }, 27945 loadingMore: function () { 27946 return 'Loading more results…'; 27947 }, 27948 maximumSelected: function (args) { 27949 var message = 'You can only select ' + args.maximum + ' item'; 27950 27951 if (args.maximum != 1) { 27952 message += 's'; 27953 } 27954 27955 return message; 27956 }, 27957 noResults: function () { 27958 return 'No results found'; 27959 }, 27960 searching: function () { 27961 return 'Searching…'; 27962 }, 27963 removeAllItems: function () { 27964 return 'Remove all items'; 27965 } 27966 }; 27967}); 27968 27969S2.define('select2/defaults',[ 27970 'jquery', 27971 'require', 27972 27973 './results', 27974 27975 './selection/single', 27976 './selection/multiple', 27977 './selection/placeholder', 27978 './selection/allowClear', 27979 './selection/search', 27980 './selection/eventRelay', 27981 27982 './utils', 27983 './translation', 27984 './diacritics', 27985 27986 './data/select', 27987 './data/array', 27988 './data/ajax', 27989 './data/tags', 27990 './data/tokenizer', 27991 './data/minimumInputLength', 27992 './data/maximumInputLength', 27993 './data/maximumSelectionLength', 27994 27995 './dropdown', 27996 './dropdown/search', 27997 './dropdown/hidePlaceholder', 27998 './dropdown/infiniteScroll', 27999 './dropdown/attachBody', 28000 './dropdown/minimumResultsForSearch', 28001 './dropdown/selectOnClose', 28002 './dropdown/closeOnSelect', 28003 28004 './i18n/en' 28005], function ($, require, 28006 28007 ResultsList, 28008 28009 SingleSelection, MultipleSelection, Placeholder, AllowClear, 28010 SelectionSearch, EventRelay, 28011 28012 Utils, Translation, DIACRITICS, 28013 28014 SelectData, ArrayData, AjaxData, Tags, Tokenizer, 28015 MinimumInputLength, MaximumInputLength, MaximumSelectionLength, 28016 28017 Dropdown, DropdownSearch, HidePlaceholder, InfiniteScroll, 28018 AttachBody, MinimumResultsForSearch, SelectOnClose, CloseOnSelect, 28019 28020 EnglishTranslation) { 28021 function Defaults () { 28022 this.reset(); 28023 } 28024 28025 Defaults.prototype.apply = function (options) { 28026 options = $.extend(true, {}, this.defaults, options); 28027 28028 if (options.dataAdapter == null) { 28029 if (options.ajax != null) { 28030 options.dataAdapter = AjaxData; 28031 } else if (options.data != null) { 28032 options.dataAdapter = ArrayData; 28033 } else { 28034 options.dataAdapter = SelectData; 28035 } 28036 28037 if (options.minimumInputLength > 0) { 28038 options.dataAdapter = Utils.Decorate( 28039 options.dataAdapter, 28040 MinimumInputLength 28041 ); 28042 } 28043 28044 if (options.maximumInputLength > 0) { 28045 options.dataAdapter = Utils.Decorate( 28046 options.dataAdapter, 28047 MaximumInputLength 28048 ); 28049 } 28050 28051 if (options.maximumSelectionLength > 0) { 28052 options.dataAdapter = Utils.Decorate( 28053 options.dataAdapter, 28054 MaximumSelectionLength 28055 ); 28056 } 28057 28058 if (options.tags) { 28059 options.dataAdapter = Utils.Decorate(options.dataAdapter, Tags); 28060 } 28061 28062 if (options.tokenSeparators != null || options.tokenizer != null) { 28063 options.dataAdapter = Utils.Decorate( 28064 options.dataAdapter, 28065 Tokenizer 28066 ); 28067 } 28068 28069 if (options.query != null) { 28070 var Query = require(options.amdBase + 'compat/query'); 28071 28072 options.dataAdapter = Utils.Decorate( 28073 options.dataAdapter, 28074 Query 28075 ); 28076 } 28077 28078 if (options.initSelection != null) { 28079 var InitSelection = require(options.amdBase + 'compat/initSelection'); 28080 28081 options.dataAdapter = Utils.Decorate( 28082 options.dataAdapter, 28083 InitSelection 28084 ); 28085 } 28086 } 28087 28088 if (options.resultsAdapter == null) { 28089 options.resultsAdapter = ResultsList; 28090 28091 if (options.ajax != null) { 28092 options.resultsAdapter = Utils.Decorate( 28093 options.resultsAdapter, 28094 InfiniteScroll 28095 ); 28096 } 28097 28098 if (options.placeholder != null) { 28099 options.resultsAdapter = Utils.Decorate( 28100 options.resultsAdapter, 28101 HidePlaceholder 28102 ); 28103 } 28104 28105 if (options.selectOnClose) { 28106 options.resultsAdapter = Utils.Decorate( 28107 options.resultsAdapter, 28108 SelectOnClose 28109 ); 28110 } 28111 } 28112 28113 if (options.dropdownAdapter == null) { 28114 if (options.multiple) { 28115 options.dropdownAdapter = Dropdown; 28116 } else {
28117 var SearchableDropdown = Utils.Decorate(Dropdown, DropdownSearch); 28118 28119 options.dropdownAdapter = SearchableDropdown; 28120 } 28121 28122 if (options.minimumResultsForSearch !== 0) { 28123 options.dropdownAdapter = Utils.Decorate( 28124 options.dropdownAdapter, 28125 MinimumResultsForSearch 28126 ); 28127 } 28128 28129 if (options.closeOnSelect) { 28130 options.dropdownAdapter = Utils.Decorate( 28131 options.dropdownAdapter, 28132 CloseOnSelect 28133 ); 28134 } 28135 28136 if ( 28137 options.dropdownCssClass != null || 28138 options.dropdownCss != null || 28139 options.adaptDropdownCssClass != null 28140 ) { 28141 var DropdownCSS = require(options.amdBase + 'compat/dropdownCss'); 28142 28143 options.dropdownAdapter = Utils.Decorate( 28144 options.dropdownAdapter, 28145 DropdownCSS 28146 ); 28147 } 28148 28149 options.dropdownAdapter = Utils.Decorate( 28150 options.dropdownAdapter, 28151 AttachBody 28152 ); 28153 } 28154 28155 if (options.selectionAdapter == null) { 28156 if (options.multiple) { 28157 options.selectionAdapter = MultipleSelection; 28158 } else { 28159 options.selectionAdapter = SingleSelection; 28160 } 28161 28162 // Add the placeholder mixin if a placeholder was specified 28163 if (options.placeholder != null) { 28164 options.selectionAdapter = Utils.Decorate( 28165 options.selectionAdapter, 28166 Placeholder 28167 ); 28168 } 28169 28170 if (options.allowClear) { 28171 options.selectionAdapter = Utils.Decorate( 28172 options.selectionAdapter, 28173 AllowClear 28174 ); 28175 } 28176 28177 if (options.multiple) { 28178 options.selectionAdapter = Utils.Decorate( 28179 options.selectionAdapter, 28180 SelectionSearch 28181 ); 28182 } 28183 28184 if ( 28185 options.containerCssClass != null || 28186 options.containerCss != null || 28187 options.adaptContainerCssClass != null 28188 ) { 28189 var ContainerCSS = require(options.amdBase + 'compat/containerCss'); 28190 28191 options.selectionAdapter = Utils.Decorate( 28192 options.selectionAdapter, 28193 ContainerCSS 28194 ); 28195 } 28196 28197 options.selectionAdapter = Utils.Decorate( 28198 options.selectionAdapter, 28199 EventRelay 28200 ); 28201 } 28202 28203 // If the defaults were not previously applied from an element, it is 28204 // possible for the language option to have not been resolved 28205 options.language = this._resolveLanguage(options.language); 28206 28207 // Always fall back to English since it will always be complete 28208 options.language.push('en'); 28209 28210 var uniqueLanguages = []; 28211 28212 for (var l = 0; l < options.language.length; l++) { 28213 var language = options.language[l]; 28214 28215 if (uniqueLanguages.indexOf(language) === -1) { 28216 uniqueLanguages.push(language); 28217 } 28218 } 28219 28220 options.language = uniqueLanguages; 28221 28222 options.translations = this._processTranslations( 28223 options.language, 28224 options.debug 28225 ); 28226 28227 return options; 28228 }; 28229 28230 Defaults.prototype.reset = function () { 28231 function stripDiacritics (text) { 28232 // Used 'uni range + named function' from http://jsperf.com/diacritics/18 28233 function match(a) { 28234 return DIACRITICS[a] || a; 28235 } 28236
vendor: 16,384 bytes, lines 28237-28839
28237 return text.replace(/[^\u0000-\u007E]/g, match); 28238 } 28239 28240 function matcher (params, data) { 28241 // Always return the object if there is nothing to compare 28242 if ($.trim(params.term) === '') { 28243 return data; 28244 } 28245 28246 // Do a recursive check for options with children 28247 if (data.children && data.children.length > 0) { 28248 // Clone the data object if there are children 28249 // This is required as we modify the object to remove any non-matches 28250 var match = $.extend(true, {}, data); 28251 28252 // Check each child of the option 28253 for (var c = data.children.length - 1; c >= 0; c--) { 28254 var child = data.children[c]; 28255 28256 var matches = matcher(params, child); 28257 28258 // If there wasn't a match, remove the object in the array 28259 if (matches == null) { 28260 match.children.splice(c, 1); 28261 } 28262 } 28263 28264 // If any children matched, return the new object 28265 if (match.children.length > 0) { 28266 return match; 28267 } 28268 28269 // If there were no matching children, check just the plain object 28270 return matcher(params, match); 28271 } 28272 28273 var original = stripDiacritics(data.text).toUpperCase(); 28274 var term = stripDiacritics(params.term).toUpperCase(); 28275 28276 // Check if the text contains the term 28277 if (original.indexOf(term) > -1) { 28278 return data; 28279 } 28280 28281 // If it doesn't contain the term, don't return anything 28282 return null; 28283 } 28284 28285 this.defaults = { 28286 amdBase: './', 28287 amdLanguageBase: './i18n/', 28288 closeOnSelect: true, 28289 debug: false, 28290 dropdownAutoWidth: false, 28291 escapeMarkup: Utils.escapeMarkup, 28292 language: {}, 28293 matcher: matcher, 28294 minimumInputLength: 0, 28295 maximumInputLength: 0, 28296 maximumSelectionLength: 0, 28297 minimumResultsForSearch: 0, 28298 selectOnClose: false, 28299 scrollAfterSelect: false, 28300 sorter: function (data) { 28301 return data; 28302 }, 28303 templateResult: function (result) { 28304 return result.text; 28305 }, 28306 templateSelection: function (selection) { 28307 return selection.text; 28308 }, 28309 theme: 'default', 28310 width: 'resolve' 28311 }; 28312 }; 28313 28314 Defaults.prototype.applyFromElement = function (options, $element) { 28315 var optionLanguage = options.language; 28316 var defaultLanguage = this.defaults.language; 28317 var elementLanguage = $element.prop('lang'); 28318 var parentLanguage = $element.closest('[lang]').prop('lang'); 28319 28320 var languages = Array.prototype.concat.call( 28321 this._resolveLanguage(elementLanguage), 28322 this._resolveLanguage(optionLanguage), 28323 this._resolveLanguage(defaultLanguage), 28324 this._resolveLanguage(parentLanguage) 28325 ); 28326 28327 options.language = languages; 28328 28329 return options; 28330 }; 28331 28332 Defaults.prototype._resolveLanguage = function (language) { 28333 if (!language) { 28334 return []; 28335 } 28336 28337 if ($.isEmptyObject(language)) { 28338 return []; 28339 } 28340 28341 if ($.isPlainObject(language)) { 28342 return [language]; 28343 } 28344 28345 var languages; 28346 28347 if (!$.isArray(language)) { 28348 languages = [language]; 28349 } else { 28350 languages = language; 28351 } 28352 28353 var resolvedLanguages = []; 28354 28355 for (var l = 0; l < languages.length; l++) { 28356 resolvedLanguages.push(languages[l]); 28357 28358 if (typeof languages[l] === 'string' && languages[l].indexOf('-') > 0) { 28359 // Extract the region information if it is included 28360 var languageParts = languages[l].split('-'); 28361 var baseLanguage = languageParts[0]; 28362 28363 resolvedLanguages.push(baseLanguage); 28364 } 28365 } 28366 28367 return resolvedLanguages; 28368 }; 28369 28370 Defaults.prototype._processTranslations = function (languages, debug) { 28371 var translations = new Translation(); 28372 28373 for (var l = 0; l < languages.length; l++) { 28374 var languageData = new Translation(); 28375 28376 var language = languages[l]; 28377 28378 if (typeof language === 'string') { 28379 try { 28380 // Try to load it with the original name 28381 languageData = Translation.loadPath(language); 28382 } catch (e) { 28383 try { 28384 // If we couldn't load it, check if it wasn't the full path 28385 language = this.defaults.amdLanguageBase + language; 28386 languageData = Translation.loadPath(language); 28387 } catch (ex) { 28388 // The translation could not be loaded at all. Sometimes this is 28389 // because of a configuration problem, other times this can be 28390 // because of how Select2 helps load all possible translation files 28391 if (debug && window.console && console.warn) { 28392 console.warn( 28393 'Select2: The language file for "' + language + '" could ' + 28394 'not be automatically loaded. A fallback will be used instead.' 28395 ); 28396 } 28397 } 28398 } 28399 } else if ($.isPlainObject(language)) { 28400 languageData = new Translation(language); 28401 } else { 28402 languageData = language; 28403 } 28404 28405 translations.extend(languageData); 28406 } 28407 28408 return translations; 28409 }; 28410 28411 Defaults.prototype.set = function (key, value) { 28412 var camelKey = $.camelCase(key); 28413 28414 var data = {}; 28415 data[camelKey] = value; 28416 28417 var convertedData = Utils._convertData(data); 28418 28419 $.extend(true, this.defaults, convertedData); 28420 }; 28421 28422 var defaults = new Defaults(); 28423 28424 return defaults; 28425}); 28426 28427S2.define('select2/options',[ 28428 'require', 28429 'jquery', 28430 './defaults', 28431 './utils' 28432], function (require, $, Defaults, Utils) { 28433 function Options (options, $element) { 28434 this.options = options; 28435 28436 if ($element != null) { 28437 this.fromElement($element); 28438 } 28439 28440 if ($element != null) { 28441 this.options = Defaults.applyFromElement(this.options, $element); 28442 } 28443 28444 this.options = Defaults.apply(this.options); 28445 28446 if ($element && $element.is('input')) { 28447 var InputCompat = require(this.get('amdBase') + 'compat/inputData'); 28448 28449 this.options.dataAdapter = Utils.Decorate( 28450 this.options.dataAdapter, 28451 InputCompat 28452 ); 28453 } 28454 } 28455 28456 Options.prototype.fromElement = function ($e) { 28457 var excludedData = ['select2']; 28458 28459 if (this.options.multiple == null) { 28460 this.options.multiple = $e.prop('multiple'); 28461 } 28462 28463 if (this.options.disabled == null) { 28464 this.options.disabled = $e.prop('disabled'); 28465 } 28466 28467 if (this.options.dir == null) { 28468 if ($e.prop('dir')) { 28469 this.options.dir = $e.prop('dir'); 28470 } else if ($e.closest('[dir]').prop('dir')) { 28471 this.options.dir = $e.closest('[dir]').prop('dir'); 28472 } else { 28473 this.options.dir = 'ltr'; 28474 } 28475 } 28476 28477 $e.prop('disabled', this.options.disabled); 28478 $e.prop('multiple', this.options.multiple); 28479 28480 if (Utils.GetData($e[0], 'select2Tags')) { 28481 if (this.options.debug && window.console && console.warn) { 28482 console.warn( 28483 'Select2: The `data-select2-tags` attribute has been changed to ' + 28484 'use the `data-data` and `data-tags="true"` attributes and will be ' + 28485 'removed in future versions of Select2.' 28486 ); 28487 } 28488 28489 Utils.StoreData($e[0], 'data', Utils.GetData($e[0], 'select2Tags')); 28490 Utils.StoreData($e[0], 'tags', true); 28491 } 28492 28493 if (Utils.GetData($e[0], 'ajaxUrl')) { 28494 if (this.options.debug && window.console && console.warn) { 28495 console.warn( 28496 'Select2: The `data-ajax-url` attribute has been changed to ' + 28497 '`data-ajax--url` and support for the old attribute will be removed' + 28498 ' in future versions of Select2.' 28499 ); 28500 } 28501 28502 $e.attr('ajax--url', Utils.GetData($e[0], 'ajaxUrl')); 28503 Utils.StoreData($e[0], 'ajax-Url', Utils.GetData($e[0], 'ajaxUrl')); 28504 } 28505 28506 var dataset = {}; 28507 28508 function upperCaseLetter(_, letter) { 28509 return letter.toUpperCase(); 28510 } 28511 28512 // Pre-load all of the attributes which are prefixed with `data-` 28513 for (var attr = 0; attr < $e[0].attributes.length; attr++) { 28514 var attributeName = $e[0].attributes[attr].name; 28515 var prefix = 'data-'; 28516 28517 if (attributeName.substr(0, prefix.length) == prefix) { 28518 // Get the contents of the attribute after `data-` 28519 var dataName = attributeName.substring(prefix.length); 28520 28521 // Get the data contents from the consistent source 28522 // This is more than likely the jQuery data helper 28523 var dataValue = Utils.GetData($e[0], dataName); 28524 28525 // camelCase the attribute name to match the spec 28526 var camelDataName = dataName.replace(/-([a-z])/g, upperCaseLetter); 28527 28528 // Store the data attribute contents into the dataset since 28529 dataset[camelDataName] = dataValue; 28530 } 28531 } 28532 28533 // Prefer the element's `dataset` attribute if it exists 28534 // jQuery 1.x does not correctly handle data attributes with multiple dashes 28535 if ($.fn.jquery && $.fn.jquery.substr(0, 2) == '1.' && $e[0].dataset) { 28536 dataset = $.extend(true, {}, $e[0].dataset, dataset); 28537 } 28538 28539 // Prefer our internal data cache if it exists 28540 var data = $.extend(true, {}, Utils.GetData($e[0]), dataset); 28541 28542 data = Utils._convertData(data); 28543 28544 for (var key in data) { 28545 if ($.inArray(key, excludedData) > -1) { 28546 continue; 28547 } 28548 28549 if ($.isPlainObject(this.options[key])) { 28550 $.extend(this.options[key], data[key]); 28551 } else { 28552 this.options[key] = data[key]; 28553 } 28554 } 28555 28556 return this; 28557 }; 28558 28559 Options.prototype.get = function (key) { 28560 return this.options[key]; 28561 }; 28562 28563 Options.prototype.set = function (key, val) { 28564 this.options[key] = val; 28565 }; 28566 28567 return Options; 28568}); 28569 28570S2.define('select2/core',[ 28571 'jquery', 28572 './options', 28573 './utils', 28574 './keys' 28575], function ($, Options, Utils, KEYS) { 28576 var Select2 = function ($element, options) { 28577 if (Utils.GetData($element[0], 'select2') != null) { 28578 Utils.GetData($element[0], 'select2').destroy(); 28579 } 28580 28581 this.$element = $element; 28582 28583 this.id = this._generateId($element); 28584 28585 options = options || {}; 28586 28587 this.options = new Options(options, $element); 28588 28589 Select2.__super__.constructor.call(this); 28590 28591 // Set up the tabindex 28592 28593 var tabindex = $element.attr('tabindex') || 0; 28594 Utils.StoreData($element[0], 'old-tabindex', tabindex); 28595 $element.attr('tabindex', '-1'); 28596 28597 // Set up containers and adapters 28598 28599 var DataAdapter = this.options.get('dataAdapter'); 28600 this.dataAdapter = new DataAdapter($element, this.options); 28601 28602 var $container = this.render(); 28603 28604 this._placeContainer($container); 28605 28606 var SelectionAdapter = this.options.get('selectionAdapter'); 28607 this.selection = new SelectionAdapter($element, this.options); 28608 this.$selection = this.selection.render(); 28609 28610 this.selection.position(this.$selection, $container); 28611 28612 var DropdownAdapter = this.options.get('dropdownAdapter'); 28613 this.dropdown = new DropdownAdapter($element, this.options); 28614 this.$dropdown = this.dropdown.render(); 28615 28616 this.dropdown.position(this.$dropdown, $container); 28617 28618 var ResultsAdapter = this.options.get('resultsAdapter'); 28619 this.results = new ResultsAdapter($element, this.options, this.dataAdapter); 28620 this.$results = this.results.render(); 28621 28622 this.results.position(this.$results, this.$dropdown); 28623 28624 // Bind events 28625 28626 var self = this; 28627 28628 // Bind the container to all of the adapters 28629 this._bindAdapters(); 28630 28631 // Register any DOM event handlers 28632 this._registerDomEvents(); 28633 28634 // Register any internal event handlers 28635 this._registerDataEvents(); 28636 this._registerSelectionEvents(); 28637 this._registerDropdownEvents(); 28638 this._registerResultsEvents(); 28639 this._registerEvents(); 28640 28641 // Set the initial state 28642 this.dataAdapter.current(function (initialData) { 28643 self.trigger('selection:update', { 28644 data: initialData 28645 }); 28646 }); 28647 28648 // Hide the original select 28649 $element.addClass('select2-hidden-accessible'); 28650 $element.attr('aria-hidden', 'true'); 28651 28652 // Synchronize any monitored attributes 28653 this._syncAttributes(); 28654 28655 Utils.StoreData($element[0], 'select2', this); 28656 28657 // Ensure backwards compatibility with $element.data('select2'). 28658 $element.data('select2', this); 28659 }; 28660 28661 Utils.Extend(Select2, Utils.Observable); 28662 28663 Select2.prototype._generateId = function ($element) { 28664 var id = ''; 28665 28666 if ($element.attr('id') != null) { 28667 id = $element.attr('id'); 28668 } else if ($element.attr('name') != null) { 28669 id = $element.attr('name') + '-' + Utils.generateChars(2); 28670 } else { 28671 id = Utils.generateChars(4); 28672 } 28673 28674 id = id.replace(/(:|\.|\[|\]|,)/g, ''); 28675 id = 'select2-' + id; 28676 28677 return id; 28678 }; 28679 28680 Select2.prototype._placeContainer = function ($container) { 28681 $container.insertAfter(this.$element); 28682 28683 var width = this._resolveWidth(this.$element, this.options.get('width')); 28684 28685 if (width != null) { 28686 $container.css('width', width); 28687 } 28688 }; 28689 28690 Select2.prototype._resolveWidth = function ($element, method) { 28691 var WIDTH = /^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i; 28692 28693 if (method == 'resolve') { 28694 var styleWidth = this._resolveWidth($element, 'style'); 28695 28696 if (styleWidth != null) { 28697 return styleWidth; 28698 } 28699 28700 return this._resolveWidth($element, 'element'); 28701 } 28702 28703 if (method == 'element') { 28704 var elementWidth = $element.outerWidth(false); 28705 28706 if (elementWidth <= 0) { 28707 return 'auto'; 28708 } 28709 28710 return elementWidth + 'px'; 28711 } 28712 28713 if (method == 'style') { 28714 var style = $element.attr('style'); 28715 28716 if (typeof(style) !== 'string') { 28717 return null; 28718 } 28719 28720 var attrs = style.split(';'); 28721 28722 for (var i = 0, l = attrs.length; i < l; i = i + 1) { 28723 var attr = attrs[i].replace(/\s/g, ''); 28724 var matches = attr.match(WIDTH); 28725 28726 if (matches !== null && matches.length >= 1) { 28727 return matches[1]; 28728 } 28729 } 28730 28731 return null; 28732 } 28733 28734 if (method == 'computedstyle') { 28735 var computedStyle = window.getComputedStyle($element[0]); 28736 28737 return computedStyle.width; 28738 } 28739 28740 return method; 28741 }; 28742 28743 Select2.prototype._bindAdapters = function () { 28744 this.dataAdapter.bind(this, this.$container); 28745 this.selection.bind(this, this.$container); 28746 28747 this.dropdown.bind(this, this.$container); 28748 this.results.bind(this, this.$container); 28749 }; 28750 28751 Select2.prototype._registerDomEvents = function () { 28752 var self = this; 28753 28754 this.$element.on('change.select2', function () { 28755 self.dataAdapter.current(function (data) { 28756 self.trigger('selection:update', { 28757 data: data 28758 }); 28759 }); 28760 }); 28761 28762 this.$element.on('focus.select2', function (evt) { 28763 self.trigger('focus', evt); 28764 }); 28765 28766 this._syncA = Utils.bind(this._syncAttributes, this); 28767 this._syncS = Utils.bind(this._syncSubtree, this); 28768 28769 if (this.$element[0].attachEvent) { 28770 this.$element[0].attachEvent('onpropertychange', this._syncA); 28771 } 28772 28773 var observer = window.MutationObserver || 28774 window.WebKitMutationObserver || 28775 window.MozMutationObserver 28776 ; 28777 28778 if (observer != null) { 28779 this._observer = new observer(function (mutations) { 28780 self._syncA(); 28781 self._syncS(null, mutations); 28782 }); 28783 this._observer.observe(this.$element[0], { 28784 attributes: true, 28785 childList: true, 28786 subtree: false 28787 }); 28788 } else if (this.$element[0].addEventListener) { 28789 this.$element[0].addEventListener( 28790 'DOMAttrModified', 28791 self._syncA, 28792 false 28793 ); 28794 this.$element[0].addEventListener( 28795 'DOMNodeInserted', 28796 self._syncS, 28797 false 28798 ); 28799 this.$element[0].addEventListener( 28800 'DOMNodeRemoved', 28801 self._syncS, 28802 false 28803 ); 28804 } 28805 }; 28806 28807 Select2.prototype._registerDataEvents = function () { 28808 var self = this; 28809 28810 this.dataAdapter.on('*', function (name, params) { 28811 self.trigger(name, params); 28812 }); 28813 }; 28814 28815 Select2.prototype._registerSelectionEvents = function () { 28816 var self = this; 28817 var nonRelayEvents = ['toggle', 'focus']; 28818 28819 this.selection.on('toggle', function () { 28820 self.toggleDropdown(); 28821 }); 28822 28823 this.selection.on('focus', function (params) { 28824 self.focus(params); 28825 }); 28826 28827 this.selection.on('*', function (name, params) { 28828 if ($.inArray(name, nonRelayEvents) !== -1) { 28829 return; 28830 } 28831 28832 self.trigger(name, params); 28833 }); 28834 }; 28835 28836 Select2.prototype._registerDropdownEvents = function () { 28837 var self = this; 28838 28839 this.dropdown.on('*', fu
28839nction (name, params) { 28840 self.trigger(name, params); 28841 }); 28842 }; 28843 28844 Select2.prototype._registerResultsEvents = function () { 28845 var self = this; 28846 28847 this.results.on('*', function (name, params) { 28848 self.trigger(name, params); 28849 }); 28850 }; 28851 28852 Select2.prototype._registerEvents = function () { 28853 var self = this; 28854 28855 this.on('open', function () { 28856 self.$container.addClass('select2-container--open'); 28857 }); 28858 28859 this.on('close', function () { 28860 self.$container.removeClass('select2-container--open'); 28861 }); 28862 28863 this.on('enable', function () { 28864 self.$container.removeClass('select2-container--disabled'); 28865 }); 28866 28867 this.on('disable', function () { 28868 self.$container.addClass('select2-container--disabled'); 28869 }); 28870 28871 this.on('blur', function () { 28872 self.$container.removeClass('select2-container--focus'); 28873 }); 28874 28875 this.on('query', function (params) { 28876 if (!self.isOpen()) { 28877 self.trigger('open', {}); 28878 } 28879 28880 this.dataAdapter.query(params, function (data) { 28881 self.trigger('results:all', { 28882 data: data, 28883 query: params 28884 }); 28885 }); 28886 }); 28887 28888 this.on('query:append', function (params) { 28889 this.dataAdapter.query(params, function (data) { 28890 self.trigger('results:append', { 28891 data: data, 28892 query: params 28893 }); 28894 }); 28895 }); 28896 28897 this.on('keypress', function (evt) { 28898 var key = evt.which; 28899 28900 if (self.isOpen()) { 28901 if (key === KEYS.ESC || key === KEYS.TAB || 28902 (key === KEYS.UP && evt.altKey)) { 28903 self.close(evt); 28904 28905 evt.preventDefault(); 28906 } else if (key === KEYS.ENTER) { 28907 self.trigger('results:select', {}); 28908 28909 evt.preventDefault(); 28910 } else if ((key === KEYS.SPACE && evt.ctrlKey)) { 28911 self.trigger('results:toggle', {}); 28912 28913 evt.preventDefault(); 28914 } else if (key === KEYS.UP) { 28915 self.trigger('results:previous', {}); 28916 28917 evt.preventDefault(); 28918 } else if (key === KEYS.DOWN) { 28919 self.trigger('results:next', {}); 28920 28921 evt.preventDefault(); 28922 } 28923 } else { 28924 if (key === KEYS.ENTER || key === KEYS.SPACE || 28925 (key === KEYS.DOWN && evt.altKey)) { 28926 self.open(); 28927 28928 evt.preventDefault(); 28929 } 28930 } 28931 }); 28932 }; 28933 28934 Select2.prototype._syncAttributes = function () { 28935 this.options.set('disabled', this.$element.prop('disabled')); 28936 28937 if (this.isDisabled()) { 28938 if (this.isOpen()) { 28939 this.close(); 28940 } 28941 28942 this.trigger('disable', {}); 28943 } else { 28944 this.trigger('enable', {}); 28945 } 28946 }; 28947 28948 Select2.prototype._isChangeMutation = function (evt, mutations) { 28949 var changed = false; 28950 var self = this; 28951 28952 // Ignore any mutation events raised for elements that aren't options or 28953 // optgroups. This handles the case when the select element is destroyed 28954 if ( 28955 evt && evt.target && ( 28956 evt.target.nodeName !== 'OPTION' && evt.target.nodeName !== 'OPTGROUP' 28957 ) 28958 ) { 28959 return; 28960 } 28961 28962 if (!mutations) { 28963 // If mutation events aren't supported, then we can only assume that the 28964 // change affected the selections 28965 changed = true; 28966 } else if (mutations.addedNodes && mutations.addedNodes.length > 0) { 28967 for (var n = 0; n < mutations.addedNodes.length; n++) { 28968 var node = mutations.addedNodes[n]; 28969 28970 if (node.selected) { 28971 changed = true; 28972 } 28973 } 28974 } else if (mutations.removedNodes && mutations.removedNodes.length > 0) { 28975 changed = true; 28976 } else if ($.isArray(mutations)) { 28977 $.each(mutations, function(evt, mutation) { 28978 if (self._isChangeMutation(evt, mutation)) { 28979 // We've found a change mutation. 28980 // Let's escape from the loop and continue 28981 changed = true; 28982 return false; 28983 } 28984 }); 28985 } 28986 return changed; 28987 }; 28988 28989 Select2.prototype._syncSubtree = function (evt, mutations) { 28990 var changed = this._isChangeMutation(evt, mutations); 28991 var self = this; 28992 28993 // Only re-pull the data if we think there is a change 28994 if (changed) { 28995 this.dataAdapter.current(function (currentData) { 28996 self.trigger('selection:update', { 28997 data: currentData 28998 }); 28999 }); 29000 } 29001 }; 29002 29003 /** 29004 * Override the trigger method to automatically trigger pre-events when 29005 * there are events that can be prevented. 29006 */ 29007 Select2.prototype.trigger = function (name, args) { 29008 var actualTrigger = Select2.__super__.trigger; 29009 var preTriggerMap = { 29010 'open': 'opening', 29011 'close': 'closing', 29012 'select': 'selecting', 29013 'unselect': 'unselecting', 29014 'clear': 'clearing' 29015 }; 29016 29017 if (args === undefined) { 29018 args = {}; 29019 } 29020 29021 if (name in preTriggerMap) { 29022 var preTriggerName = preTriggerMap[name]; 29023 var preTriggerArgs = { 29024 prevented: false, 29025 name: name, 29026 args: args 29027 }; 29028 29029 actualTrigger.call(this, preTriggerName, preTriggerArgs); 29030 29031 if (preTriggerArgs.prevented) { 29032 args.prevented = true; 29033 29034 return; 29035 } 29036 } 29037 29038 actualTrigger.call(this, name, args); 29039 }; 29040 29041 Select2.prototype.toggleDropdown = function () { 29042 if (this.isDisabled()) { 29043 return; 29044 } 29045 29046 if (this.isOpen()) { 29047 this.close(); 29048 } else { 29049 this.open(); 29050 } 29051 }; 29052 29053 Select2.prototype.open = function () { 29054 if (this.isOpen()) { 29055 return; 29056 } 29057 29058 if (this.isDisabled()) { 29059 return; 29060 } 29061 29062 this.trigger('query', {}); 29063 }; 29064 29065 Select2.prototype.close = function (evt) { 29066 if (!this.isOpen()) { 29067 return; 29068 } 29069 29070 this.trigger('close', { originalEvent : evt }); 29071 }; 29072 29073 /** 29074 * Helper method to abstract the "enabled" (not "disabled") state of this 29075 * object. 29076 * 29077 * @return {true} if the instance is not disabled. 29078 * @return {false} if the instance is disabled. 29079 */ 29080 Select2.prototype.isEnabled = function () { 29081 return !this.isDisabled(); 29082 }; 29083 29084 /** 29085 * Helper method to abstract the "disabled" state of this object. 29086 * 29087 * @return {true} if the disabled option is true. 29088 * @return {false} if the disabled option is false. 29089 */ 29090 Select2.prototype.isDisabled = function () { 29091 return this.options.get('disabled'); 29092 }; 29093 29094 Select2.prototype.isOpen = function () { 29095 return this.$container.hasClass('select2-container--open'); 29096 }; 29097 29098 Select2.prototype.hasFocus = function () { 29099 return this.$container.hasClass('select2-container--focus'); 29100 }; 29101
vendor: 5,856 bytes, lines 29102-29321
29102 Select2.prototype.focus = function (data) { 29103 // No need to re-trigger focus events if we are already focused 29104 if (this.hasFocus()) { 29105 return; 29106 } 29107 29108 this.$container.addClass('select2-container--focus'); 29109 this.trigger('focus', {}); 29110 }; 29111 29112 Select2.prototype.enable = function (args) { 29113 if (this.options.get('debug') && window.console && console.warn) { 29114 console.warn( 29115 'Select2: The `select2("enable")` method has been deprecated and will' + 29116 ' be removed in later Select2 versions. Use $element.prop("disabled")' + 29117 ' instead.' 29118 ); 29119 } 29120 29121 if (args == null || args.length === 0) { 29122 args = [true]; 29123 } 29124 29125 var disabled = !args[0]; 29126 29127 this.$element.prop('disabled', disabled); 29128 }; 29129 29130 Select2.prototype.data = function () { 29131 if (this.options.get('debug') && 29132 arguments.length > 0 && window.console && console.warn) { 29133 console.warn( 29134 'Select2: Data can no longer be set using `select2("data")`. You ' + 29135 'should consider setting the value instead using `$element.val()`.' 29136 ); 29137 } 29138 29139 var data = []; 29140 29141 this.dataAdapter.current(function (currentData) { 29142 data = currentData; 29143 }); 29144 29145 return data; 29146 }; 29147 29148 Select2.prototype.val = function (args) { 29149 if (this.options.get('debug') && window.console && console.warn) { 29150 console.warn( 29151 'Select2: The `select2("val")` method has been deprecated and will be' + 29152 ' removed in later Select2 versions. Use $element.val() instead.' 29153 ); 29154 } 29155 29156 if (args == null || args.length === 0) { 29157 return this.$element.val(); 29158 } 29159 29160 var newVal = args[0]; 29161 29162 if ($.isArray(newVal)) { 29163 newVal = $.map(newVal, function (obj) { 29164 return obj.toString(); 29165 }); 29166 } 29167 29168 this.$element.val(newVal).trigger('input').trigger('change'); 29169 }; 29170 29171 Select2.prototype.destroy = function () { 29172 this.$container.remove(); 29173 29174 if (this.$element[0].detachEvent) { 29175 this.$element[0].detachEvent('onpropertychange', this._syncA); 29176 } 29177 29178 if (this._observer != null) { 29179 this._observer.disconnect(); 29180 this._observer = null; 29181 } else if (this.$element[0].removeEventListener) { 29182 this.$element[0] 29183 .removeEventListener('DOMAttrModified', this._syncA, false); 29184 this.$element[0] 29185 .removeEventListener('DOMNodeInserted', this._syncS, false); 29186 this.$element[0] 29187 .removeEventListener('DOMNodeRemoved', this._syncS, false); 29188 } 29189 29190 this._syncA = null; 29191 this._syncS = null; 29192 29193 this.$element.off('.select2'); 29194 this.$element.attr('tabindex', 29195 Utils.GetData(this.$element[0], 'old-tabindex')); 29196 29197 this.$element.removeClass('select2-hidden-accessible'); 29198 this.$element.attr('aria-hidden', 'false'); 29199 Utils.RemoveData(this.$element[0]); 29200 this.$element.removeData('select2'); 29201 29202 this.dataAdapter.destroy(); 29203 this.selection.destroy(); 29204 this.dropdown.destroy(); 29205 this.results.destroy(); 29206 29207 this.dataAdapter = null; 29208 this.selection = null; 29209 this.dropdown = null; 29210 this.results = null; 29211 }; 29212 29213 Select2.prototype.render = function () { 29214 var $container = $( 29215 '<span class="select2 select2-container">' + 29216 '<span class="selection"></span>' + 29217 '<span class="dropdown-wrapper" aria-hidden="true"></span>' + 29218 '</span>' 29219 ); 29220 29221 $container.attr('dir', this.options.get('dir')); 29222 29223 this.$container = $container; 29224 29225 this.$container.addClass('select2-container--' + this.options.get('theme')); 29226 29227 Utils.StoreData($container[0], 'element', this.$element); 29228 29229 return $container; 29230 }; 29231 29232 return Select2; 29233}); 29234 29235S2.define('jquery-mousewheel',[ 29236 'jquery' 29237], function ($) { 29238 // Used to shim jQuery.mousewheel for non-full builds. 29239 return $; 29240}); 29241 29242S2.define('jquery.select2',[ 29243 'jquery', 29244 'jquery-mousewheel', 29245 29246 './select2/core', 29247 './select2/defaults', 29248 './select2/utils' 29249], function ($, _, Select2, Defaults, Utils) { 29250 if ($.fn.select2 == null) { 29251 // All methods that should return the element 29252 var thisMethods = ['open', 'close', 'destroy']; 29253 29254 $.fn.select2 = function (options) { 29255 options = options || {}; 29256 29257 if (typeof options === 'object') { 29258 this.each(function () { 29259 var instanceOptions = $.extend(true, {}, options); 29260 29261 var instance = new Select2($(this), instanceOptions); 29262 }); 29263 29264 return this; 29265 } else if (typeof options === 'string') { 29266 var ret; 29267 var args = Array.prototype.slice.call(arguments, 1); 29268 29269 this.each(function () { 29270 var instance = Utils.GetData(this, 'select2'); 29271 29272 if (instance == null && window.console && console.error) { 29273 console.error( 29274 'The select2(\'' + options + '\') method was called on an ' + 29275 'element that is not using Select2.' 29276 ); 29277 } 29278 29279 ret = instance[options].apply(instance, args); 29280 }); 29281 29282 // Check if we should be returning `this` 29283 if ($.inArray(options, thisMethods) > -1) { 29284 return this; 29285 } 29286 29287 return ret; 29288 } else { 29289 throw new Error('Invalid arguments for Select2: ' + options); 29290 } 29291 }; 29292 } 29293 29294 if ($.fn.select2.defaults == null) { 29295 $.fn.select2.defaults = Defaults; 29296 } 29297 29298 return Select2; 29299}); 29300 29301 // Return the AMD loader configuration so it can be used outside of this file 29302 return { 29303 define: S2.define, 29304 require: S2.require 29305 }; 29306}()); 29307 29308 // Autoload the jQuery bindings 29309 // We know that all of the modules exist above this, so we're safe 29310 var select2 = S2.require('jquery.select2'); 29311 29312 // Hold the AMD module references on the jQuery function that was just loaded 29313 // This allows Select2 to use the internal loader outside of this file, such 29314 // as in the language files. 29315 jQuery.fn.select2.amd = S2; 29316 29317 // Return the Select2 instance for anyone who is importing it. 29318 return select2; 29319})); 29320 29321
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.