vendor: 10,654 bytes, lines 1-370
1/* Minification failed. Returning unminified contents. 2(11927,15-16): run-time error JS1010: Expected identifier: . 3(11927,15-16): run-time error JS1195: Expected expression: . 4(16518,15-16): run-time error JS1010: Expected identifier: . 5(16518,15-16): run-time error JS1195: Expected expression: . 6(17049,15-16): run-time error JS1010: Expected identifier: . 7(17049,15-16): run-time error JS1195: Expected expression: . 8(17388,6): run-time error JS1004: Expected ';' 9(17389,67): run-time error JS1004: Expected ';' 10(17552,16-17): run-time error JS1195: Expected expression: . 11(17552,36-37): run-time error JS1195: Expected expression: . 12(17552,55-56): run-time error JS1003: Expected ':': ) 13(17553,9-21): run-time error JS1009: Expected '}': customParams 14(17553,9-21): run-time error JS1003: Expected ':': customParams 15(17553,21-22): run-time error JS1195: Expected expression: . 16(17553,64-65): run-time error JS1006: Expected ')': ; 17(17557,16-17): run-time error JS1195: Expected expression: . 18(17557,36-37): run-time error JS1195: Expected expression: . 19(17557,57-58): run-time error JS1003: Expected ':': ) 20(17558,9-21): run-time error JS1009: Expected '}': customParams 21(17558,9-21): run-time error JS1003: Expected ':': customParams 22(17558,21-22): run-time error JS1195: Expected expression: . 23(17558,88-89): run-time error JS1006: Expected ')': ; 24(17560,5-6): run-time error JS1002: Syntax error: } 25(17562,1-2): run-time error JS1002: Syntax error: } 26(17564,6): run-time error JS1004: Expected ';' 27(17588,27): run-time error JS1004: Expected ';' 28(17589,17): run-time error JS1004: Expected ';' 29(17591,25-33): run-time error JS1006: Expected ')': function 30(17591,36): run-time error JS1004: Expected ';' 31(17629,10): run-time error JS1004: Expected ';' 32(17630,2-3): run-time error JS1195: Expected expression: ) 33(17561,5-24): run-time error JS1018: 'return' statement outside of function: return customParams 34 */ 35/*! 36 * jQuery JavaScript Library v3.5.1 37 * https://jquery.com/ 38 * 39 * Includes Sizzle.js 40 * https://sizzlejs.com/ 41 * 42 * Copyright JS Foundation and other contributors 43 * Released under the MIT license 44 * https://jquery.org/license 45 * 46 * Date: 2020-05-04T22:49Z 47 */ 48(function (global, factory) { 49 50 "use strict"; 51 52 if (typeof module === "object" && typeof module.exports === "object") { 53 54 // For CommonJS and CommonJS-like environments where a proper `window` 55 // is present, execute the factory and get jQuery. 56 // For environments that do not have a `window` with a `document` 57 // (such as Node.js), expose a factory as module.exports. 58 // This accentuates the need for the creation of a real `window`. 59 // e.g. var jQuery = require("jquery")(window); 60 // See ticket #14549 for more info. 61 module.exports = global.document ? 62 factory(global, true) : 63 function (w) { 64 if (!w.document) { 65 throw new Error("jQuery requires a window with a document"); 66 } 67 return factory(w); 68 }; 69 } else { 70 factory(global); 71 } 72 73 // Pass this if window is not defined yet 74})(typeof window !== "undefined" ? window : this, function (window, noGlobal) { 75 76 // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 77 // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 78 // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 79 // enough that all such attempts are guarded in a try block. 80 "use strict"; 81 82 var arr = []; 83 84 var getProto = Object.getPrototypeOf; 85 86 var slice = arr.slice; 87 88 var flat = arr.flat ? function (array) { 89 return arr.flat.call(array); 90 } : function (array) { 91 return arr.concat.apply([], array); 92 }; 93 94 95 var push = arr.push; 96 97 var indexOf = arr.indexOf; 98 99 var class2type = {}; 100 101 var toString = class2type.toString; 102 103 var hasOwn = class2type.hasOwnProperty; 104 105 var fnToString = hasOwn.toString; 106 107 var ObjectFunctionString = fnToString.call(Object); 108 109 var support = {}; 110 111 var isFunction = function isFunction(obj) { 112 113 // Support: Chrome <=57, Firefox <=52 114 // In some browsers, typeof returns "function" for HTML <object> elements 115 // (i.e., `typeof document.createElement( "object" ) === "function"`). 116 // We don't want to classify *any* DOM node as a function. 117 return typeof obj === "function" && typeof obj.nodeType !== "number"; 118 }; 119 120 121 var isWindow = function isWindow(obj) { 122 return obj != null && obj === obj.window; 123 }; 124 125 126 var document = window.document; 127 128 129 130 var preservedScriptAttributes = { 131 type: true, 132 src: true, 133 nonce: true, 134 noModule: true 135 }; 136 137 function DOMEval(code, node, doc) { 138 doc = doc || document; 139 140 var i, val, 141 script = doc.createElement("script"); 142 143 script.text = code; 144 if (node) { 145 for (i in preservedScriptAttributes) { 146 147 // Support: Firefox 64+, Edge 18+ 148 // Some browsers don't support the "nonce" property on scripts. 149 // On the other hand, just using `getAttribute` is not enough as 150 // the `nonce` attribute is reset to an empty string whenever it 151 // becomes browsing-context connected. 152 // See https://github.com/whatwg/html/issues/2369 153 // See https://html.spec.whatwg.org/#nonce-attributes 154 // The `node.getAttribute` check was added for the sake of 155 // `jQuery.globalEval` so that it can fake a nonce-containing node 156 // via an object. 157 val = node[i] || node.getAttribute && node.getAttribute(i); 158 if (val) { 159 script.setAttribute(i, val); 160 } 161 } 162 } 163 doc.head.appendChild(script).parentNode.removeChild(script); 164 } 165 166 167 function toType(obj) { 168 if (obj == null) { 169 return obj + ""; 170 } 171 172 // Support: Android <=2.3 only (functionish RegExp) 173 return typeof obj === "object" || typeof obj === "function" ? 174 class2type[toString.call(obj)] || "object" : 175 typeof obj; 176 } 177 /* global Symbol */ 178 // Defining this global in .eslintrc.json would create a danger of using the global 179 // unguarded in another place, it seems safer to define global only for this module 180 181 182 183 var 184 version = "3.5.1", 185 186 // Define a local copy of jQuery 187 jQuery = function (selector, context) { 188 189 // The jQuery object is actually just the init constructor 'enhanced' 190 // Need init if jQuery is called (just allow error to be thrown if not included) 191 return new jQuery.fn.init(selector, context); 192 }; 193 194 jQuery.fn = jQuery.prototype = { 195 196 // The current version of jQuery being used 197 jquery: version, 198 199 constructor: jQuery, 200 201 // The default length of a jQuery object is 0 202 length: 0, 203 204 toArray: function () { 205 return slice.call(this); 206 }, 207 208 // Get the Nth element in the matched element set OR 209 // Get the whole matched element set as a clean array 210 get: function (num) { 211 212 // Return all the elements in a clean array 213 if (num == null) { 214 return slice.call(this); 215 } 216 217 // Return just the one element from the set 218 return num < 0 ? this[num + this.length] : this[num]; 219 }, 220 221 // Take an array of elements and push it onto the stack 222 // (returning the new matched element set) 223 pushStack: function (elems) { 224 225 // Build a new jQuery matched element set 226 var ret = jQuery.merge(this.constructor(), elems); 227 228 // Add the old object onto the stack (as a reference) 229 ret.prevObject = this; 230 231 // Return the newly-formed element set 232 return ret; 233 }, 234 235 // Execute a callback for every element in the matched set. 236 each: function (callback) { 237 return jQuery.each(this, callback); 238 }, 239 240 map: function (callback) { 241 return this.pushStack(jQuery.map(this, function (elem, i) { 242 return callback.call(elem, i, elem); 243 })); 244 }, 245 246 slice: function () { 247 return this.pushStack(slice.apply(this, arguments)); 248 }, 249 250 first: function () { 251 return this.eq(0); 252 }, 253 254 last: function () { 255 return this.eq(-1); 256 }, 257 258 even: function () { 259 return this.pushStack(jQuery.grep(this, function (_elem, i) { 260 return (i + 1) % 2; 261 })); 262 }, 263 264 odd: function () { 265 return this.pushStack(jQuery.grep(this, function (_elem, i) { 266 return i % 2; 267 })); 268 }, 269 270 eq: function (i) { 271 var len = this.length, 272 j = +i + (i < 0 ? len : 0); 273 return this.pushStack(j >= 0 && j < len ? [this[j]] : []); 274 }, 275 276 end: function () { 277 return this.prevObject || this.constructor(); 278 }, 279 280 // For internal use only. 281 // Behaves like an Array's method, not like a jQuery method. 282 push: push, 283 sort: arr.sort, 284 splice: arr.splice 285 }; 286 287 jQuery.extend = jQuery.fn.extend = function () { 288 var options, name, src, copy, copyIsArray, clone, 289 target = arguments[0] || {}, 290 i = 1, 291 length = arguments.length, 292 deep = false; 293 294 // Handle a deep copy situation 295 if (typeof target === "boolean") { 296 deep = target; 297 298 // Skip the boolean and the target 299 target = arguments[i] || {}; 300 i++; 301 } 302 303 // Handle case when target is a string or something (possible in deep copy) 304 if (typeof target !== "object" && !isFunction(target)) { 305 target = {}; 306 } 307 308 // Extend jQuery itself if only one argument is passed 309 if (i === length) { 310 target = this; 311 i--; 312 } 313 314 for (; i < length; i++) { 315 316 // Only deal with non-null/undefined values 317 if ((options = arguments[i]) != null) { 318 319 // Extend the base object 320 for (name in options) { 321 copy = options[name]; 322 323 // Prevent Object.prototype pollution 324 // Prevent never-ending loop 325 if (name === "__proto__" || target === copy) { 326 continue; 327 } 328 329 // Recurse if we're merging plain objects or arrays 330 if (deep && copy && (jQuery.isPlainObject(copy) || 331 (copyIsArray = Array.isArray(copy)))) { 332 src = target[name]; 333 334 // Ensure proper type for the source value 335 if (copyIsArray && !Array.isArray(src)) { 336 clone = []; 337 } else if (!copyIsArray && !jQuery.isPlainObject(src)) { 338 clone = {}; 339 } else { 340 clone = src; 341 } 342 copyIsArray = false; 343 344 // Never move original objects, clone them 345 target[name] = jQuery.extend(deep, clone, copy); 346 347 // Don't bring in undefined values 348 } else if (copy !== undefined) { 349 target[name] = copy; 350 } 351 } 352 } 353 } 354 355 // Return the modified object 356 return target; 357 }; 358 359 jQuery.extend({ 360 361 // Unique for each copy of jQuery on the page 362 expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""), 363 364 // Assume jQuery is ready without the ready module 365 isReady: true, 366 367 error: function (msg) { 368 throw new Error(msg); 369 }, 370
vendor: 14,033 bytes, lines 371-868
371 noop: function () { }, 372 373 isPlainObject: function (obj) { 374 var proto, Ctor; 375 376 // Detect obvious negatives 377 // Use toString instead of jQuery.type to catch host objects 378 if (!obj || toString.call(obj) !== "[object Object]") { 379 return false; 380 } 381 382 proto = getProto(obj); 383 384 // Objects with no prototype (e.g., `Object.create( null )`) are plain 385 if (!proto) { 386 return true; 387 } 388 389 // Objects with prototype are plain iff they were constructed by a global Object function 390 Ctor = hasOwn.call(proto, "constructor") && proto.constructor; 391 return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString; 392 }, 393 394 isEmptyObject: function (obj) { 395 var name; 396 397 for (name in obj) { 398 return false; 399 } 400 return true; 401 }, 402 403 // Evaluates a script in a provided context; falls back to the global one 404 // if not specified. 405 globalEval: function (code, options, doc) { 406 DOMEval(code, { nonce: options && options.nonce }, doc); 407 }, 408 409 each: function (obj, callback) { 410 var length, i = 0; 411 412 if (isArrayLike(obj)) { 413 length = obj.length; 414 for (; i < length; i++) { 415 if (callback.call(obj[i], i, obj[i]) === false) { 416 break; 417 } 418 } 419 } else { 420 for (i in obj) { 421 if (callback.call(obj[i], i, obj[i]) === false) { 422 break; 423 } 424 } 425 } 426 427 return obj; 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 // Support: Android <=4.0 only, PhantomJS 1 only 453 // push.apply(_, arraylike) throws on ancient WebKit 454 merge: function (first, second) { 455 var len = +second.length, 456 j = 0, 457 i = first.length; 458 459 for (; j < len; j++) { 460 first[i++] = second[j]; 461 } 462 463 first.length = i; 464 465 return first; 466 }, 467 468 grep: function (elems, callback, invert) { 469 var callbackInverse, 470 matches = [], 471 i = 0, 472 length = elems.length, 473 callbackExpect = !invert; 474 475 // Go through the array, only saving the items 476 // that pass the validator function 477 for (; i < length; i++) { 478 callbackInverse = !callback(elems[i], i); 479 if (callbackInverse !== callbackExpect) { 480 matches.push(elems[i]); 481 } 482 } 483 484 return matches; 485 }, 486 487 // arg is for internal usage only 488 map: function (elems, callback, arg) { 489 var length, value, 490 i = 0, 491 ret = []; 492 493 // Go through the array, translating each of the items to their new values 494 if (isArrayLike(elems)) { 495 length = elems.length; 496 for (; i < length; i++) { 497 value = callback(elems[i], i, arg); 498 499 if (value != null) { 500 ret.push(value); 501 } 502 } 503 504 // Go through every key on the object, 505 } else { 506 for (i in elems) { 507 value = callback(elems[i], i, arg); 508 509 if (value != null) { 510 ret.push(value); 511 } 512 } 513 } 514 515 // Flatten any nested arrays 516 return flat(ret); 517 }, 518 519 // A global GUID counter for objects 520 guid: 1, 521 522 // jQuery.support is not used in Core but other projects attach their 523 // properties to it so it needs to exist. 524 support: support 525 }); 526 527 if (typeof Symbol === "function") { 528 jQuery.fn[Symbol.iterator] = arr[Symbol.iterator]; 529 } 530 531 // Populate the class2type map 532 jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), 533 function (_i, name) { 534 class2type["[object " + name + "]"] = name.toLowerCase(); 535 }); 536 537 function isArrayLike(obj) { 538 539 // Support: real iOS 8.2 only (not reproducible in simulator) 540 // `in` check used to prevent JIT error (gh-2145) 541 // hasOwn isn't used here due to false negatives 542 // regarding Nodelist length in IE 543 var length = !!obj && "length" in obj && obj.length, 544 type = toType(obj); 545 546 if (isFunction(obj) || isWindow(obj)) { 547 return false; 548 } 549 550 return type === "array" || length === 0 || 551 typeof length === "number" && length > 0 && (length - 1) in obj; 552 } 553 var Sizzle = 554 /*! 555 * Sizzle CSS Selector Engine v2.3.5 556 * https://sizzlejs.com/ 557 * 558 * Copyright JS Foundation and other contributors 559 * Released under the MIT license 560 * https://js.foundation/ 561 * 562 * Date: 2020-03-14 563 */ 564 (function (window) { 565 var i, 566 support, 567 Expr, 568 getText, 569 isXML, 570 tokenize, 571 compile, 572 select, 573 outermostContext, 574 sortInput, 575 hasDuplicate, 576 577 // Local document vars 578 setDocument, 579 document, 580 docElem, 581 documentIsHTML, 582 rbuggyQSA, 583 rbuggyMatches, 584 matches, 585 contains, 586 587 // Instance-specific data 588 expando = "sizzle" + 1 * new Date(), 589 preferredDoc = window.document, 590 dirruns = 0, 591 done = 0, 592 classCache = createCache(), 593 tokenCache = createCache(), 594 compilerCache = createCache(), 595 nonnativeSelectorCache = createCache(), 596 sortOrder = function (a, b) { 597 if (a === b) { 598 hasDuplicate = true; 599 } 600 return 0; 601 }, 602 603 // Instance methods 604 hasOwn = ({}).hasOwnProperty, 605 arr = [], 606 pop = arr.pop, 607 pushNative = arr.push, 608 push = arr.push, 609 slice = arr.slice, 610 611 // Use a stripped-down indexOf as it's faster than native 612 // https://jsperf.com/thor-indexof-vs-for/5 613 indexOf = function (list, elem) { 614 var i = 0, 615 len = list.length; 616 for (; i < len; i++) { 617 if (list[i] === elem) { 618 return i; 619 } 620 } 621 return -1; 622 }, 623 624 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|" + 625 "ismap|loop|multiple|open|readonly|required|scoped", 626 627 // Regular expressions 628 629 // http://www.w3.org/TR/css3-selectors/#whitespace 630 whitespace = "[\\x20\\t\\r\\n\\f]", 631 632 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram 633 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + 634 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", 635 636 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 637 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 638 639 // Operator (capture 2) 640 "*([*^$|!~]?=)" + whitespace + 641 642 // "Attribute values must be CSS identifiers [capture 5] 643 // or strings [capture 3 or capture 4]" 644 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + 645 whitespace + "*\\]", 646 647 pseudos = ":(" + identifier + ")(?:\\((" + 648 649 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 650 // 1. quoted (capture 3; capture 4 or capture 5) 651 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 652 653 // 2. simple (capture 6) 654 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 655 656 // 3. anything else (capture 2) 657 ".*" + 658 ")\\)|)", 659 660 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 661 rwhitespace = new RegExp(whitespace + "+", "g"), 662 rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + 663 whitespace + "+$", "g"), 664 665 rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"), 666 rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + 667 "*"), 668 rdescend = new RegExp(whitespace + "|>"), 669 670 rpseudo = new RegExp(pseudos), 671 ridentifier = new RegExp("^" + identifier + "$"), 672 673 matchExpr = { 674 "ID": new RegExp("^#(" + identifier + ")"), 675 "CLASS": new RegExp("^\\.(" + identifier + ")"), 676 "TAG": new RegExp("^(" + identifier + "|[*])"), 677 "ATTR": new RegExp("^" + attributes), 678 "PSEUDO": new RegExp("^" + pseudos), 679 "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + 680 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + 681 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"), 682 "bool": new RegExp("^(?:" + booleans + ")$", "i"), 683 684 // For use in libraries implementing .is() 685 // We use this for POS matching in `select` 686 "needsContext": new RegExp("^" + whitespace + 687 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + 688 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i") 689 }, 690 691 rhtml = /HTML$/i, 692 rinputs = /^(?:input|select|textarea|button)$/i, 693 rheader = /^h\d$/i, 694 695 rnative = /^[^{]+\{\s*\[native \w/, 696 697 // Easily-parseable/retrievable ID or TAG or CLASS selectors 698 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 699 700 rsibling = /[+~]/, 701 702 // CSS escapes 703 // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 704 runescape = new RegExp("\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g"), 705 funescape = function (escape, nonHex) { 706 var high = "0x" + escape.slice(1) - 0x10000; 707 708 return nonHex ? 709 710 // Strip the backslash prefix from a non-hex escape sequence 711 nonHex : 712 713 // Replace a hexadecimal escape sequence with the encoded Unicode code point 714 // Support: IE <=11+ 715 // For values outside the Basic Multilingual Plane (BMP), manually construct a 716 // surrogate pair 717 high < 0 ? 718 String.fromCharCode(high + 0x10000) : 719 String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00); 720 }, 721 722 // CSS string/identifier serialization 723 // https://drafts.csswg.org/cssom/#common-serializing-idioms 724 rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g, 725 fcssescape = function (ch, asCodePoint) { 726 if (asCodePoint) { 727 728 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 729 if (ch === "\0") { 730 return "\uFFFD"; 731 } 732 733 // Control characters and (dependent upon position) numbers get escaped as code points 734 return ch.slice(0, -1) + "\\" + 735 ch.charCodeAt(ch.length - 1).toString(16) + " "; 736 } 737 738 // Other potentially-special ASCII characters get backslash-escaped 739 return "\\" + ch; 740 }, 741 742 // Used for iframes 743 // See setDocument() 744 // Removing the function wrapper causes a "Permission Denied" 745 // error in IE 746 unloadHandler = function () { 747 setDocument(); 748 }, 749 750 inDisabledFieldset = addCombinator( 751 function (elem) { 752 return elem.disabled === true && elem.nodeName.toLowerCase() === "fieldset"; 753 }, 754 { dir: "parentNode", next: "legend" } 755 ); 756 757 // Optimize for push.apply( _, NodeList ) 758 try { 759 push.apply( 760 (arr = slice.call(preferredDoc.childNodes)), 761 preferredDoc.childNodes 762 ); 763 764 // Support: Android<4.0 765 // Detect silently failing push.apply 766 // eslint-disable-next-line no-unused-expressions 767 arr[preferredDoc.childNodes.length].nodeType; 768 } catch (e) { 769 push = { 770 apply: arr.length ? 771 772 // Leverage slice if possible 773 function (target, els) { 774 pushNative.apply(target, slice.call(els)); 775 } : 776 777 // Support: IE<9 778 // Otherwise append directly 779 function (target, els) { 780 var j = target.length, 781 i = 0; 782 783 // Can't trust NodeList.length 784 while ((target[j++] = els[i++])) { } 785 target.length = j - 1; 786 } 787 }; 788 } 789 790 function Sizzle(selector, context, results, seed) { 791 var m, i, elem, nid, match, groups, newSelector, 792 newContext = context && context.ownerDocument, 793 794 // nodeType defaults to 9, since context defaults to document 795 nodeType = context ? context.nodeType : 9; 796 797 results = results || []; 798 799 // Return early from calls with invalid selector or context 800 if (typeof selector !== "string" || !selector || 801 nodeType !== 1 && nodeType !== 9 && nodeType !== 11) { 802 803 return results; 804 } 805 806 // Try to shortcut find operations (as opposed to filters) in HTML documents 807 if (!seed) { 808 setDocument(context); 809 context = context || document; 810 811 if (documentIsHTML) { 812 813 // If the selector is sufficiently simple, try using a "get*By*" DOM method 814 // (excepting DocumentFragment context, where the methods don't exist) 815 if (nodeType !== 11 && (match = rquickExpr.exec(selector))) { 816 817 // ID selector 818 if ((m = match[1])) { 819 820 // Document context 821 if (nodeType === 9) { 822 if ((elem = context.getElementById(m))) { 823 824 // Support: IE, Opera, Webkit 825 // TODO: identify versions 826 // getElementById can match elements by name instead of ID 827 if (elem.id === m) { 828 results.push(elem); 829 return results; 830 } 831 } else { 832 return results; 833 } 834 835 // Element context 836 } else { 837 838 // Support: IE, Opera, Webkit 839 // TODO: identify versions 840 // getElementById can match elements by name instead of ID 841 if (newContext && (elem = newContext.getElementById(m)) && 842 contains(context, elem) && 843 elem.id === m) { 844 845 results.push(elem); 846 return results; 847 } 848 } 849 850 // Type selector 851 } else if (match[2]) { 852 push.apply(results, context.getElementsByTagName(selector)); 853 return results; 854 855 // Class selector 856 } else if ((m = match[3]) && support.getElementsByClassName && 857 context.getElementsByClassName) { 858 859 push.apply(results, context.getElementsByClassName(m)); 860 return results; 861 } 862 } 863 864 // Take advantage of querySelectorAll 865 if (support.qsa && 866 !nonnativeSelectorCache[selector + " "] && 867 (!rbuggyQSA || !rbuggyQSA.test(selector)) && 868
869 // Support: IE 8 only 870 // Exclude object elements 871 (nodeType !== 1 || context.nodeName.toLowerCase() !== "object")) { 872 873 newSelector = selector; 874 newContext = context; 875 876 // qSA considers elements outside a scoping root when evaluating child or 877 // descendant combinators, which is not what we want. 878 // In such cases, we work around the behavior by prefixing every selector in the 879 // list with an ID selector referencing the scope context. 880 // The technique has to be used as well when a leading combinator is used 881 // as such selectors are not recognized by querySelectorAll. 882 // Thanks to Andrew Dupont for this technique. 883 if (nodeType === 1 && 884 (rdescend.test(selector) || rcombinators.test(selector))) { 885 886 // Expand context for sibling selectors 887 newContext = rsibling.test(selector) && testContext(context.parentNode) || 888 context; 889 890 // We can use :scope instead of the ID hack if the browser 891 // supports it & if we're not changing the context. 892 if (newContext !== context || !support.scope) { 893 894 // Capture the context ID, setting it first if necessary 895 if ((nid = context.getAttribute("id"))) { 896 nid = nid.replace(rcssescape, fcssescape); 897 } else { 898 context.setAttribute("id", (nid = expando)); 899 } 900 } 901 902 // Prefix every selector in the list 903 groups = tokenize(selector); 904 i = groups.length; 905 while (i--) { 906 groups[i] = (nid ? "#" + nid : ":scope") + " " + 907 toSelector(groups[i]); 908 } 909 newSelector = groups.join(","); 910 } 911 912 try { 913 push.apply(results, 914 newContext.querySelectorAll(newSelector) 915 ); 916 return results; 917 } catch (qsaError) { 918 nonnativeSelectorCache(selector, true); 919 } finally { 920 if (nid === expando) { 921 context.removeAttribute("id"); 922 } 923 } 924 } 925 } 926 } 927 928 // All others 929 return select(selector.replace(rtrim, "$1"), context, results, seed); 930 } 931 932 /** 933 * Create key-value caches of limited size 934 * @returns {function(string, object)} Returns the Object data after storing it on itself with 935 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 936 * deleting the oldest entry 937 */ 938 function createCache() { 939 var keys = []; 940 941 function cache(key, value) { 942 943 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 944 if (keys.push(key + " ") > Expr.cacheLength) { 945 946 // Only keep the most recent entries 947 delete cache[keys.shift()]; 948 } 949 return (cache[key + " "] = value); 950 } 951 return cache; 952 } 953 954 /** 955 * Mark a function for special use by Sizzle 956 * @param {Function} fn The function to mark 957 */ 958 function markFunction(fn) { 959 fn[expando] = true; 960 return fn; 961 } 962 963 /** 964 * Support testing using an element 965 * @param {Function} fn Passed the created element and returns a boolean result 966 */ 967 function assert(fn) { 968 var el = document.createElement("fieldset"); 969 970 try { 971 return !!fn(el); 972 } catch (e) { 973 return false; 974 } finally { 975 976 // Remove from its parent by default 977 if (el.parentNode) { 978 el.parentNode.removeChild(el); 979 } 980 981 // release memory in IE 982 el = null; 983 } 984 } 985 986 /** 987 * Adds the same handler for all of the specified attrs 988 * @param {String} attrs Pipe-separated list of attributes 989 * @param {Function} handler The method that will be applied 990 */ 991 function addHandle(attrs, handler) { 992 var arr = attrs.split("|"), 993 i = arr.length; 994 995 while (i--) { 996 Expr.attrHandle[arr[i]] = handler; 997 } 998 } 999 1000 /** 1001 * Checks document order of two siblings 1002 * @param {Element} a 1003 * @param {Element} b 1004 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 1005 */ 1006 function siblingCheck(a, b) { 1007 var cur = b && a, 1008 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 1009 a.sourceIndex - b.sourceIndex; 1010 1011 // Use IE sourceIndex if available on both nodes 1012 if (diff) { 1013 return diff; 1014 } 1015 1016 // Check if b follows a 1017 if (cur) { 1018 while ((cur = cur.nextSibling)) { 1019 if (cur === b) { 1020 return -1; 1021 } 1022 } 1023 } 1024 1025 return a ? 1 : -1; 1026 } 1027 1028 /** 1029 * Returns a function to use in pseudos for input types 1030 * @param {String} type 1031 */ 1032 function createInputPseudo(type) { 1033 return function (elem) { 1034 var name = elem.nodeName.toLowerCase(); 1035 return name === "input" && elem.type === type; 1036 }; 1037 } 1038 1039 /** 1040 * Returns a function to use in pseudos for buttons 1041 * @param {String} type 1042 */ 1043 function createButtonPseudo(type) { 1044 return function (elem) { 1045 var name = elem.nodeName.toLowerCase(); 1046 return (name === "input" || name === "button") && elem.type === type; 1047 }; 1048 } 1049 1050 /** 1051 * Returns a function to use in pseudos for :enabled/:disabled 1052 * @param {Boolean} disabled true for :disabled; false for :enabled 1053 */ 1054 function createDisabledPseudo(disabled) { 1055 1056 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 1057 return function (elem) { 1058 1059 // Only certain elements can match :enabled or :disabled 1060 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 1061 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 1062 if ("form" in elem) { 1063 1064 // Check for inherited disabledness on relevant non-disabled elements: 1065 // * listed form-associated elements in a disabled fieldset 1066 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 1067 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 1068 // * option elements in a disabled optgroup 1069 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 1070 // All such elements have a "form" property. 1071 if (elem.parentNode && elem.disabled === false) { 1072 1073 // Option elements defer to a parent optgroup if present 1074 if ("label" in elem) { 1075 if ("label" in elem.parentNode) { 1076 return elem.parentNode.disabled === disabled; 1077 } else { 1078 return elem.disabled === disabled; 1079 } 1080 } 1081
1082 // Support: IE 6 - 11 1083 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 1084 return elem.isDisabled === disabled || 1085 1086 // Where there is no isDisabled, check manually 1087 /* jshint -W018 */ 1088 elem.isDisabled !== !disabled && 1089 inDisabledFieldset(elem) === disabled; 1090 } 1091 1092 return elem.disabled === disabled; 1093 1094 // Try to winnow out elements that can't be disabled before trusting the disabled property. 1095 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 1096 // even exist on them, let alone have a boolean value. 1097 } else if ("label" in elem) { 1098 return elem.disabled === disabled; 1099 } 1100 1101 // Remaining elements are neither :enabled nor :disabled 1102 return false; 1103 }; 1104 } 1105 1106 /** 1107 * Returns a function to use in pseudos for positionals 1108 * @param {Function} fn 1109 */ 1110 function createPositionalPseudo(fn) { 1111 return markFunction(function (argument) { 1112 argument = +argument; 1113 return markFunction(function (seed, matches) { 1114 var j, 1115 matchIndexes = fn([], seed.length, argument), 1116 i = matchIndexes.length; 1117 1118 // Match elements found at the specified indexes 1119 while (i--) { 1120 if (seed[(j = matchIndexes[i])]) { 1121 seed[j] = !(matches[j] = seed[j]); 1122 } 1123 } 1124 }); 1125 }); 1126 } 1127 1128 /** 1129 * Checks a node for validity as a Sizzle context 1130 * @param {Element|Object=} context 1131 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 1132 */ 1133 function testContext(context) { 1134 return context && typeof context.getElementsByTagName !== "undefined" && context; 1135 } 1136 1137 // Expose support vars for convenience 1138 support = Sizzle.support = {}; 1139 1140 /** 1141 * Detects XML nodes 1142 * @param {Element|Object} elem An element or a document 1143 * @returns {Boolean} True iff elem is a non-HTML XML node 1144 */ 1145 isXML = Sizzle.isXML = function (elem) { 1146 var namespace = elem.namespaceURI, 1147 docElem = (elem.ownerDocument || elem).documentElement; 1148 1149 // Support: IE <=8 1150 // Assume HTML when documentElement doesn't yet exist, such as inside loading iframes 1151 // https://bugs.jquery.com/ticket/4833 1152 return !rhtml.test(namespace || docElem && docElem.nodeName || "HTML"); 1153 }; 1154 1155 /** 1156 * Sets document-related variables once based on the current document 1157 * @param {Element|Object} [doc] An element or document object to use to set the document 1158 * @returns {Object} Returns the current document 1159 */ 1160 setDocument = Sizzle.setDocument = function (node) { 1161 var hasCompare, subWindow, 1162 doc = node ? node.ownerDocument || node : preferredDoc; 1163 1164 // Return early if doc is invalid or already selected 1165 // Support: IE 11+, Edge 17 - 18+ 1166 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1167 // two documents; shallow comparisons work. 1168 // eslint-disable-next-line eqeqeq 1169 if (doc == document || doc.nodeType !== 9 || !doc.documentElement) { 1170 return document; 1171 } 1172 1173 // Update global variables 1174 document = doc; 1175 docElem = document.documentElement; 1176 documentIsHTML = !isXML(document); 1177 1178 // Support: IE 9 - 11+, Edge 12 - 18+ 1179 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) 1180 // Support: IE 11+, Edge 17 - 18+ 1181 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1182 // two documents; shallow comparisons work. 1183 // eslint-disable-next-line eqeqeq 1184 if (preferredDoc != document && 1185 (subWindow = document.defaultView) && subWindow.top !== subWindow) { 1186 1187 // Support: IE 11, Edge 1188 if (subWindow.addEventListener) { 1189 subWindow.addEventListener("unload", unloadHandler, false); 1190 1191 // Support: IE 9 - 10 only 1192 } else if (subWindow.attachEvent) { 1193 subWindow.attachEvent("onunload", unloadHandler); 1194 } 1195 } 1196 1197 // Support: IE 8 - 11+, Edge 12 - 18+, Chrome <=16 - 25 only, Firefox <=3.6 - 31 only, 1198 // Safari 4 - 5 only, Opera <=11.6 - 12.x only 1199 // IE/Edge & older browsers don't support the :scope pseudo-class.
1200 // Support: Safari 6.0 only 1201 // Safari 6.0 supports :scope but it's an alias of :root there. 1202 support.scope = assert(function (el) { 1203 docElem.appendChild(el).appendChild(document.createElement("div")); 1204 return typeof el.querySelectorAll !== "undefined" && 1205 !el.querySelectorAll(":scope fieldset div").length; 1206 }); 1207 1208 /* Attributes 1209 ---------------------------------------------------------------------- */ 1210 1211 // Support: IE<8 1212 // Verify that getAttribute really returns attributes and not properties 1213 // (excepting IE8 booleans) 1214 support.attributes = assert(function (el) { 1215 el.className = "i"; 1216 return !el.getAttribute("className"); 1217 }); 1218 1219 /* getElement(s)By* 1220 ---------------------------------------------------------------------- */ 1221 1222 // Check if getElementsByTagName("*") returns only elements 1223 support.getElementsByTagName = assert(function (el) { 1224 el.appendChild(document.createComment("")); 1225 return !el.getElementsByTagName("*").length; 1226 }); 1227 1228 // Support: IE<9 1229 support.getElementsByClassName = rnative.test(document.getElementsByClassName); 1230 1231 // Support: IE<10 1232 // Check if getElementById returns elements by name 1233 // The broken getElementById methods don't pick up programmatically-set names, 1234 // so use a roundabout getElementsByName test 1235 support.getById = assert(function (el) { 1236 docElem.appendChild(el).id = expando; 1237 return !document.getElementsByName || !document.getElementsByName(expando).length; 1238 }); 1239 1240 // ID filter and find 1241 if (support.getById) { 1242 Expr.filter["ID"] = function (id) { 1243 var attrId = id.replace(runescape, funescape); 1244 return function (elem) { 1245 return elem.getAttribute("id") === attrId; 1246 }; 1247 }; 1248 Expr.find["ID"] = function (id, context) { 1249 if (typeof context.getElementById !== "undefined" && documentIsHTML) { 1250 var elem = context.getElementById(id); 1251 return elem ? [elem] : []; 1252 } 1253 }; 1254 } else { 1255 Expr.filter["ID"] = function (id) { 1256 var attrId = id.replace(runescape, funescape); 1257 return function (elem) { 1258 var node = typeof elem.getAttributeNode !== "undefined" && 1259 elem.getAttributeNode("id"); 1260 return node && node.value === attrId; 1261 }; 1262 }; 1263 1264 // Support: IE 6 - 7 only 1265 // getElementById is not reliable as a find shortcut 1266 Expr.find["ID"] = function (id, context) { 1267 if (typeof context.getElementById !== "undefined" && documentIsHTML) { 1268 var node, i, elems, 1269 elem = context.getElementById(id); 1270 1271 if (elem) { 1272 1273 // Verify the id attribute 1274 node = elem.getAttributeNode("id"); 1275 if (node && node.value === id) { 1276 return [elem]; 1277 } 1278 1279 // Fall back on getElementsByName 1280 elems = context.getElementsByName(id); 1281 i = 0; 1282 while ((elem = elems[i++])) { 1283 node = elem.getAttributeNode("id"); 1284 if (node && node.value === id) { 1285 return [elem]; 1286 } 1287 } 1288 } 1289 1290 return []; 1291 } 1292 }; 1293 } 1294 1295 // Tag 1296 Expr.find["TAG"] = support.getElementsByTagName ? 1297 function (tag, context) { 1298 if (typeof context.getElementsByTagName !== "undefined") { 1299 return context.getElementsByTagName(tag); 1300 1301 // DocumentFragment nodes don't have gEBTN 1302 } else if (support.qsa) { 1303 return context.querySelectorAll(tag); 1304 } 1305 } : 1306 1307 function (tag, context) { 1308 var elem, 1309 tmp = [], 1310 i = 0, 1311 1312 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too 1313 results = context.getElementsByTagName(tag); 1314 1315 // Filter out possible comments 1316 if (tag === "*") { 1317 while ((elem = results[i++])) { 1318 if (elem.nodeType === 1) { 1319 tmp.push(elem); 1320 } 1321 } 1322 1323 return tmp; 1324 } 1325 return results; 1326 }; 1327 1328 // Class 1329 Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) { 1330 if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) { 1331 return context.getElementsByClassName(className); 1332 } 1333 }; 1334 1335 /* QSA/matchesSelector 1336 ---------------------------------------------------------------------- */ 1337 1338 // QSA and matchesSelector support 1339 1340 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 1341 rbuggyMatches = []; 1342 1343 // qSa(:focus) reports false when true (Chrome 21) 1344 // We allow this because of a bug in IE8/9 that throws an error 1345 // whenever `document.activeElement` is accessed on an iframe 1346 // So, we allow :focus to pass through QSA all the time to avoid the IE error 1347 // See https://bugs.jquery.com/ticket/13378 1348 rbuggyQSA = []; 1349 1350 if ((support.qsa = rnative.test(document.querySelectorAll))) { 1351 1352 // Build QSA regex 1353 // Regex strategy adopted from Diego Perini 1354 assert(function (el) { 1355 1356 var input; 1357 1358 // Select is set to empty string on purpose 1359 // This is to test IE's treatment of not explicitly 1360 // setting a boolean content attribute, 1361 // since its presence should be enough 1362 // https://bugs.jquery.com/ticket/12359 1363 docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a>" + 1364 "<select id='" + expando + "-\r\\' msallowcapture=''>" + 1365 "<option selected=''></option></select>"; 1366
vendor: 54,763 bytes, lines 1367-3176
1367 // Support: IE8, Opera 11-12.16 1368 // Nothing should be selected when empty strings follow ^= or $= or *= 1369 // The test attribute must be unknown in Opera but "safe" for WinRT 1370 // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 1371 if (el.querySelectorAll("[msallowcapture^='']").length) { 1372 rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")"); 1373 } 1374 1375 // Support: IE8 1376 // Boolean attributes and "value" are not treated correctly 1377 if (!el.querySelectorAll("[selected]").length) { 1378 rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")"); 1379 } 1380 1381 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ 1382 if (!el.querySelectorAll("[id~=" + expando + "-]").length) { 1383 rbuggyQSA.push("~="); 1384 } 1385 1386 // Support: IE 11+, Edge 15 - 18+ 1387 // IE 11/Edge don't find elements on a `[name='']` query in some cases. 1388 // Adding a temporary attribute to the document before the selection works 1389 // around the issue. 1390 // Interestingly, IE 10 & older don't seem to have the issue. 1391 input = document.createElement("input"); 1392 input.setAttribute("name", ""); 1393 el.appendChild(input); 1394 if (!el.querySelectorAll("[name='']").length) { 1395 rbuggyQSA.push("\\[" + whitespace + "*name" + whitespace + "*=" + 1396 whitespace + "*(?:''|\"\")"); 1397 } 1398 1399 // Webkit/Opera - :checked should return selected option elements 1400 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1401 // IE8 throws error here and will not see later tests 1402 if (!el.querySelectorAll(":checked").length) { 1403 rbuggyQSA.push(":checked"); 1404 } 1405 1406 // Support: Safari 8+, iOS 8+ 1407 // https://bugs.webkit.org/show_bug.cgi?id=136851 1408 // In-page `selector#id sibling-combinator selector` fails 1409 if (!el.querySelectorAll("a#" + expando + "+*").length) { 1410 rbuggyQSA.push(".#.+[+~]"); 1411 } 1412 1413 // Support: Firefox <=3.6 - 5 only 1414 // Old Firefox doesn't throw on a badly-escaped identifier. 1415 el.querySelectorAll("\\\f"); 1416 rbuggyQSA.push("[\\r\\n\\f]"); 1417 }); 1418 1419 assert(function (el) { 1420 el.innerHTML = "<a href='' disabled='disabled'></a>" + 1421 "<select disabled='disabled'><option/></select>"; 1422 1423 // Support: Windows 8 Native Apps 1424 // The type and name attributes are restricted during .innerHTML assignment 1425 var input = document.createElement("input"); 1426 input.setAttribute("type", "hidden"); 1427 el.appendChild(input).setAttribute("name", "D"); 1428 1429 // Support: IE8 1430 // Enforce case-sensitivity of name attribute 1431 if (el.querySelectorAll("[name=d]").length) { 1432 rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?="); 1433 } 1434 1435 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 1436 // IE8 throws error here and will not see later tests 1437 if (el.querySelectorAll(":enabled").length !== 2) { 1438 rbuggyQSA.push(":enabled", ":disabled"); 1439 } 1440 1441 // Support: IE9-11+ 1442 // IE's :disabled selector does not pick up the children of disabled fieldsets 1443 docElem.appendChild(el).disabled = true; 1444 if (el.querySelectorAll(":disabled").length !== 2) { 1445 rbuggyQSA.push(":enabled", ":disabled"); 1446 } 1447 1448 // Support: Opera 10 - 11 only 1449 // Opera 10-11 does not throw on post-comma invalid pseudos 1450 el.querySelectorAll("*,:x"); 1451 rbuggyQSA.push(",.*:"); 1452 }); 1453 } 1454 1455 if ((support.matchesSelector = rnative.test((matches = docElem.matches || 1456 docElem.webkitMatchesSelector || 1457 docElem.mozMatchesSelector || 1458 docElem.oMatchesSelector || 1459 docElem.msMatchesSelector)))) { 1460 1461 assert(function (el) { 1462 1463 // Check to see if it's possible to do matchesSelector 1464 // on a disconnected node (IE 9) 1465 support.disconnectedMatch = matches.call(el, "*"); 1466 1467 // This should fail with an exception 1468 // Gecko does not error, returns false instead 1469 matches.call(el, "[s!='']:x"); 1470 rbuggyMatches.push("!=", pseudos); 1471 }); 1472 } 1473 1474 rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|")); 1475 rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|")); 1476 1477 /* Contains 1478 ---------------------------------------------------------------------- */ 1479 hasCompare = rnative.test(docElem.compareDocumentPosition); 1480 1481 // Element contains another 1482 // Purposefully self-exclusive 1483 // As in, an element does not contain itself 1484 contains = hasCompare || rnative.test(docElem.contains) ? 1485 function (a, b) { 1486 var adown = a.nodeType === 9 ? a.documentElement : a, 1487 bup = b && b.parentNode; 1488 return a === bup || !!(bup && bup.nodeType === 1 && ( 1489 adown.contains ? 1490 adown.contains(bup) : 1491 a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16 1492 )); 1493 } : 1494 function (a, b) { 1495 if (b) { 1496 while ((b = b.parentNode)) { 1497 if (b === a) { 1498 return true; 1499 } 1500 } 1501 } 1502 return false; 1503 }; 1504 1505 /* Sorting 1506 ---------------------------------------------------------------------- */ 1507 1508 // Document order sorting 1509 sortOrder = hasCompare ? 1510 function (a, b) { 1511 1512 // Flag for duplicate removal 1513 if (a === b) { 1514 hasDuplicate = true; 1515 return 0; 1516 } 1517 1518 // Sort on method existence if only one input has compareDocumentPosition 1519 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 1520 if (compare) { 1521 return compare; 1522 } 1523 1524 // Calculate position if both inputs belong to the same document 1525 // Support: IE 11+, Edge 17 - 18+ 1526 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1527 // two documents; shallow comparisons work. 1528 // eslint-disable-next-line eqeqeq 1529 compare = (a.ownerDocument || a) == (b.ownerDocument || b) ? 1530 a.compareDocumentPosition(b) : 1531 1532 // Otherwise we know they are disconnected 1533 1; 1534 1535 // Disconnected nodes 1536 if (compare & 1 || 1537 (!support.sortDetached && b.compareDocumentPosition(a) === compare)) { 1538 1539 // Choose the first element that is related to our preferred document 1540 // Support: IE 11+, Edge 17 - 18+ 1541 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1542 // two documents; shallow comparisons work. 1543 // eslint-disable-next-line eqeqeq 1544 if (a == document || a.ownerDocument == preferredDoc && 1545 contains(preferredDoc, a)) { 1546 return -1; 1547 } 1548 1549 // Support: IE 11+, Edge 17 - 18+ 1550 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1551 // two documents; shallow comparisons work. 1552 // eslint-disable-next-line eqeqeq 1553 if (b == document || b.ownerDocument == preferredDoc && 1554 contains(preferredDoc, b)) { 1555 return 1; 1556 } 1557 1558 // Maintain original order 1559 return sortInput ? 1560 (indexOf(sortInput, a) - indexOf(sortInput, b)) : 1561 0; 1562 } 1563 1564 return compare & 4 ? -1 : 1; 1565 } : 1566 function (a, b) { 1567 1568 // Exit early if the nodes are identical 1569 if (a === b) { 1570 hasDuplicate = true; 1571 return 0; 1572 } 1573 1574 var cur, 1575 i = 0, 1576 aup = a.parentNode, 1577 bup = b.parentNode, 1578 ap = [a], 1579 bp = [b]; 1580 1581 // Parentless nodes are either documents or disconnected 1582 if (!aup || !bup) { 1583 1584 // Support: IE 11+, Edge 17 - 18+ 1585 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1586 // two documents; shallow comparisons work. 1587 /* eslint-disable eqeqeq */ 1588 return a == document ? -1 : 1589 b == document ? 1 : 1590 /* eslint-enable eqeqeq */ 1591 aup ? -1 : 1592 bup ? 1 : 1593 sortInput ? 1594 (indexOf(sortInput, a) - indexOf(sortInput, b)) : 1595 0; 1596 1597 // If the nodes are siblings, we can do a quick check 1598 } else if (aup === bup) { 1599 return siblingCheck(a, b); 1600 } 1601 1602 // Otherwise we need full lists of their ancestors for comparison 1603 cur = a; 1604 while ((cur = cur.parentNode)) { 1605 ap.unshift(cur); 1606 } 1607 cur = b; 1608 while ((cur = cur.parentNode)) { 1609 bp.unshift(cur); 1610 } 1611 1612 // Walk down the tree looking for a discrepancy 1613 while (ap[i] === bp[i]) { 1614 i++; 1615 } 1616 1617 return i ? 1618 1619 // Do a sibling check if the nodes have a common ancestor 1620 siblingCheck(ap[i], bp[i]) : 1621 1622 // Otherwise nodes in our document sort first 1623 // Support: IE 11+, Edge 17 - 18+ 1624 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1625 // two documents; shallow comparisons work. 1626 /* eslint-disable eqeqeq */ 1627 ap[i] == preferredDoc ? -1 : 1628 bp[i] == preferredDoc ? 1 : 1629 /* eslint-enable eqeqeq */ 1630 0; 1631 }; 1632 1633 return document; 1634 }; 1635 1636 Sizzle.matches = function (expr, elements) { 1637 return Sizzle(expr, null, null, elements); 1638 }; 1639 1640 Sizzle.matchesSelector = function (elem, expr) { 1641 setDocument(elem); 1642 1643 if (support.matchesSelector && documentIsHTML && 1644 !nonnativeSelectorCache[expr + " "] && 1645 (!rbuggyMatches || !rbuggyMatches.test(expr)) && 1646 (!rbuggyQSA || !rbuggyQSA.test(expr))) { 1647 1648 try { 1649 var ret = matches.call(elem, expr); 1650 1651 // IE 9's matchesSelector returns false on disconnected nodes 1652 if (ret || support.disconnectedMatch || 1653 1654 // As well, disconnected nodes are said to be in a document 1655 // fragment in IE 9 1656 elem.document && elem.document.nodeType !== 11) { 1657 return ret; 1658 } 1659 } catch (e) { 1660 nonnativeSelectorCache(expr, true); 1661 } 1662 } 1663 1664 return Sizzle(expr, document, null, [elem]).length > 0; 1665 }; 1666 1667 Sizzle.contains = function (context, elem) { 1668 1669 // Set document vars if needed 1670 // Support: IE 11+, Edge 17 - 18+ 1671 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1672 // two documents; shallow comparisons work. 1673 // eslint-disable-next-line eqeqeq 1674 if ((context.ownerDocument || context) != document) { 1675 setDocument(context); 1676 } 1677 return contains(context, elem); 1678 }; 1679 1680 Sizzle.attr = function (elem, name) { 1681 1682 // Set document vars if needed 1683 // Support: IE 11+, Edge 17 - 18+ 1684 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1685 // two documents; shallow comparisons work. 1686 // eslint-disable-next-line eqeqeq 1687 if ((elem.ownerDocument || elem) != document) { 1688 setDocument(elem); 1689 } 1690 1691 var fn = Expr.attrHandle[name.toLowerCase()], 1692 1693 // Don't get fooled by Object.prototype properties (jQuery #13807) 1694 val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? 1695 fn(elem, name, !documentIsHTML) : 1696 undefined; 1697 1698 return val !== undefined ? 1699 val : 1700 support.attributes || !documentIsHTML ? 1701 elem.getAttribute(name) : 1702 (val = elem.getAttributeNode(name)) && val.specified ? 1703 val.value : 1704 null; 1705 }; 1706 1707 Sizzle.escape = function (sel) { 1708 return (sel + "").replace(rcssescape, fcssescape); 1709 }; 1710 1711 Sizzle.error = function (msg) { 1712 throw new Error("Syntax error, unrecognized expression: " + msg); 1713 }; 1714 1715 /** 1716 * Document sorting and removing duplicates 1717 * @param {ArrayLike} results 1718 */ 1719 Sizzle.uniqueSort = function (results) { 1720 var elem, 1721 duplicates = [], 1722 j = 0, 1723 i = 0; 1724 1725 // Unless we *know* we can detect duplicates, assume their presence 1726 hasDuplicate = !support.detectDuplicates; 1727 sortInput = !support.sortStable && results.slice(0); 1728 results.sort(sortOrder); 1729 1730 if (hasDuplicate) { 1731 while ((elem = results[i++])) { 1732 if (elem === results[i]) { 1733 j = duplicates.push(i); 1734 } 1735 } 1736 while (j--) { 1737 results.splice(duplicates[j], 1); 1738 } 1739 } 1740 1741 // Clear input after sorting to release objects 1742 // See https://github.com/jquery/sizzle/pull/225 1743 sortInput = null; 1744 1745 return results; 1746 }; 1747 1748 /** 1749 * Utility function for retrieving the text value of an array of DOM nodes 1750 * @param {Array|Element} elem 1751 */ 1752 getText = Sizzle.getText = function (elem) { 1753 var node, 1754 ret = "", 1755 i = 0, 1756 nodeType = elem.nodeType; 1757 1758 if (!nodeType) { 1759 1760 // If no nodeType, this is expected to be an array 1761 while ((node = elem[i++])) { 1762 1763 // Do not traverse comment nodes 1764 ret += getText(node); 1765 } 1766 } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) { 1767 1768 // Use textContent for elements 1769 // innerText usage removed for consistency of new lines (jQuery #11153) 1770 if (typeof elem.textContent === "string") { 1771 return elem.textContent; 1772 } else { 1773 1774 // Traverse its children 1775 for (elem = elem.firstChild; elem; elem = elem.nextSibling) { 1776 ret += getText(elem); 1777 } 1778 } 1779 } else if (nodeType === 3 || nodeType === 4) { 1780 return elem.nodeValue; 1781 } 1782 1783 // Do not include comment or processing instruction nodes 1784 1785 return ret; 1786 }; 1787 1788 Expr = Sizzle.selectors = { 1789 1790 // Can be adjusted by the user 1791 cacheLength: 50, 1792 1793 createPseudo: markFunction, 1794 1795 match: matchExpr, 1796 1797 attrHandle: {}, 1798 1799 find: {}, 1800 1801 relative: { 1802 ">": { dir: "parentNode", first: true }, 1803 " ": { dir: "parentNode" }, 1804 "+": { dir: "previousSibling", first: true }, 1805 "~": { dir: "previousSibling" } 1806 }, 1807 1808 preFilter: { 1809 "ATTR": function (match) { 1810 match[1] = match[1].replace(runescape, funescape); 1811 1812 // Move the given value to match[3] whether quoted or unquoted 1813 match[3] = (match[3] || match[4] || 1814 match[5] || "").replace(runescape, funescape); 1815 1816 if (match[2] === "~=") { 1817 match[3] = " " + match[3] + " "; 1818 } 1819 1820 return match.slice(0, 4); 1821 }, 1822 1823 "CHILD": function (match) { 1824 1825 /* matches from matchExpr["CHILD"] 1826 1 type (only|nth|...) 1827 2 what (child|of-type) 1828 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 1829 4 xn-component of xn+y argument ([+-]?\d*n|) 1830 5 sign of xn-component 1831 6 x of xn-component 1832 7 sign of y-component 1833 8 y of y-component 1834 */ 1835 match[1] = match[1].toLowerCase(); 1836 1837 if (match[1].slice(0, 3) === "nth") { 1838 1839 // nth-* requires argument 1840 if (!match[3]) { 1841 Sizzle.error(match[0]); 1842 } 1843 1844 // numeric x and y parameters for Expr.filter.CHILD 1845 // remember that false/true cast respectively to 0/1 1846 match[4] = +(match[4] ? 1847 match[5] + (match[6] || 1) : 1848 2 * (match[3] === "even" || match[3] === "odd")); 1849 match[5] = +((match[7] + match[8]) || match[3] === "odd"); 1850 1851 // other types prohibit arguments 1852 } else if (match[3]) { 1853 Sizzle.error(match[0]); 1854 } 1855 1856 return match; 1857 }, 1858 1859 "PSEUDO": function (match) { 1860 var excess, 1861 unquoted = !match[6] && match[2]; 1862 1863 if (matchExpr["CHILD"].test(match[0])) { 1864 return null; 1865 } 1866 1867 // Accept quoted arguments as-is 1868 if (match[3]) { 1869 match[2] = match[4] || match[5] || ""; 1870 1871 // Strip excess characters from unquoted arguments 1872 } else if (unquoted && rpseudo.test(unquoted) && 1873 1874 // Get excess from tokenize (recursively) 1875 (excess = tokenize(unquoted, true)) && 1876 1877 // advance to the next closing parenthesis 1878 (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) { 1879 1880 // excess is a negative index 1881 match[0] = match[0].slice(0, excess); 1882 match[2] = unquoted.slice(0, excess); 1883 } 1884 1885 // Return only captures needed by the pseudo filter method (type and argument) 1886 return match.slice(0, 3); 1887 } 1888 }, 1889 1890 filter: { 1891 1892 "TAG": function (nodeNameSelector) { 1893 var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase(); 1894 return nodeNameSelector === "*" ? 1895 function () { 1896 return true; 1897 } : 1898 function (elem) { 1899 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 1900 }; 1901 }, 1902 1903 "CLASS": function (className) { 1904 var pattern = classCache[className + " "]; 1905 1906 return pattern || 1907 (pattern = new RegExp("(^|" + whitespace + 1908 ")" + className + "(" + whitespace + "|$)")) && classCache( 1909 className, function (elem) { 1910 return pattern.test( 1911 typeof elem.className === "string" && elem.className || 1912 typeof elem.getAttribute !== "undefined" && 1913 elem.getAttribute("class") || 1914 "" 1915 ); 1916 }); 1917 }, 1918 1919 "ATTR": function (name, operator, check) { 1920 return function (elem) { 1921 var result = Sizzle.attr(elem, name); 1922 1923 if (result == null) { 1924 return operator === "!="; 1925 } 1926 if (!operator) { 1927 return true; 1928 } 1929 1930 result += ""; 1931 1932 /* eslint-disable max-len */ 1933 1934 return operator === "=" ? result === check : 1935 operator === "!=" ? result !== check : 1936 operator === "^=" ? check && result.indexOf(check) === 0 : 1937 operator === "*=" ? check && result.indexOf(check) > -1 : 1938 operator === "$=" ? check && result.slice(-check.length) === check : 1939 operator === "~=" ? (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1 : 1940 operator === "|=" ? result === check || result.slice(0, check.length + 1) === check + "-" : 1941 false; 1942 /* eslint-enable max-len */ 1943 1944 }; 1945 }, 1946 1947 "CHILD": function (type, what, _argument, first, last) { 1948 var simple = type.slice(0, 3) !== "nth", 1949 forward = type.slice(-4) !== "last", 1950 ofType = what === "of-type"; 1951 1952 return first === 1 && last === 0 ? 1953 1954 // Shortcut for :nth-*(n) 1955 function (elem) { 1956 return !!elem.parentNode; 1957 } : 1958 1959 function (elem, _context, xml) { 1960 var cache, uniqueCache, outerCache, node, nodeIndex, start, 1961 dir = simple !== forward ? "nextSibling" : "previousSibling", 1962 parent = elem.parentNode, 1963 name = ofType && elem.nodeName.toLowerCase(), 1964 useCache = !xml && !ofType, 1965 diff = false; 1966 1967 if (parent) { 1968 1969 // :(first|last|only)-(child|of-type) 1970 if (simple) { 1971 while (dir) { 1972 node = elem; 1973 while ((node = node[dir])) { 1974 if (ofType ? 1975 node.nodeName.toLowerCase() === name : 1976 node.nodeType === 1) { 1977 1978 return false; 1979 } 1980 } 1981 1982 // Reverse direction for :only-* (if we haven't yet done so) 1983 start = dir = type === "only" && !start && "nextSibling"; 1984 } 1985 return true; 1986 } 1987 1988 start = [forward ? parent.firstChild : parent.lastChild]; 1989 1990 // non-xml :nth-child(...) stores cache data on `parent` 1991 if (forward && useCache) { 1992 1993 // Seek `elem` from a previously-cached index 1994 1995 // ...in a gzip-friendly way 1996 node = parent; 1997 outerCache = node[expando] || (node[expando] = {}); 1998 1999 // Support: IE <9 only 2000 // Defend against cloned attroperties (jQuery gh-1709) 2001 uniqueCache = outerCache[node.uniqueID] || 2002 (outerCache[node.uniqueID] = {}); 2003 2004 cache = uniqueCache[type] || []; 2005 nodeIndex = cache[0] === dirruns && cache[1]; 2006 diff = nodeIndex && cache[2]; 2007 node = nodeIndex && parent.childNodes[nodeIndex]; 2008 2009 while ((node = ++nodeIndex && node && node[dir] || 2010 2011 // Fallback to seeking `elem` from the start 2012 (diff = nodeIndex = 0) || start.pop())) { 2013 2014 // When found, cache indexes on `parent` and break 2015 if (node.nodeType === 1 && ++diff && node === elem) { 2016 uniqueCache[type] = [dirruns, nodeIndex, diff]; 2017 break; 2018 } 2019 } 2020 2021 } else { 2022 2023 // Use previously-cached element index if available 2024 if (useCache) { 2025 2026 // ...in a gzip-friendly way 2027 node = elem; 2028 outerCache = node[expando] || (node[expando] = {}); 2029 2030 // Support: IE <9 only 2031 // Defend against cloned attroperties (jQuery gh-1709) 2032 uniqueCache = outerCache[node.uniqueID] || 2033 (outerCache[node.uniqueID] = {}); 2034 2035 cache = uniqueCache[type] || []; 2036 nodeIndex = cache[0] === dirruns && cache[1]; 2037 diff = nodeIndex; 2038 } 2039 2040 // xml :nth-child(...) 2041 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 2042 if (diff === false) { 2043 2044 // Use the same loop as above to seek `elem` from the start 2045 while ((node = ++nodeIndex && node && node[dir] || 2046 (diff = nodeIndex = 0) || start.pop())) { 2047 2048 if ((ofType ? 2049 node.nodeName.toLowerCase() === name : 2050 node.nodeType === 1) && 2051 ++diff) { 2052 2053 // Cache the index of each encountered element 2054 if (useCache) { 2055 outerCache = node[expando] || 2056 (node[expando] = {}); 2057 2058 // Support: IE <9 only 2059 // Defend against cloned attroperties (jQuery gh-1709) 2060 uniqueCache = outerCache[node.uniqueID] || 2061 (outerCache[node.uniqueID] = {}); 2062 2063 uniqueCache[type] = [dirruns, diff]; 2064 } 2065 2066 if (node === elem) { 2067 break; 2068 } 2069 } 2070 } 2071 } 2072 } 2073 2074 // Incorporate the offset, then check against cycle size 2075 diff -= last; 2076 return diff === first || (diff % first === 0 && diff / first >= 0); 2077 } 2078 }; 2079 }, 2080 2081 "PSEUDO": function (pseudo, argument) { 2082 2083 // pseudo-class names are case-insensitive 2084 // http://www.w3.org/TR/selectors/#pseudo-classes 2085 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 2086 // Remember that setFilters inherits from pseudos 2087 var args, 2088 fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || 2089 Sizzle.error("unsupported pseudo: " + pseudo); 2090 2091 // The user may use createPseudo to indicate that 2092 // arguments are needed to create the filter function 2093 // just as Sizzle does 2094 if (fn[expando]) { 2095 return fn(argument); 2096 } 2097 2098 // But maintain support for old signatures 2099 if (fn.length > 1) { 2100 args = [pseudo, pseudo, "", argument]; 2101 return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? 2102 markFunction(function (seed, matches) { 2103 var idx, 2104 matched = fn(seed, argument), 2105 i = matched.length; 2106 while (i--) { 2107 idx = indexOf(seed, matched[i]); 2108 seed[idx] = !(matches[idx] = matched[i]); 2109 } 2110 }) : 2111 function (elem) { 2112 return fn(elem, 0, args); 2113 }; 2114 } 2115 2116 return fn; 2117 } 2118 }, 2119 2120 pseudos: { 2121 2122 // Potentially complex pseudos 2123 "not": markFunction(function (selector) { 2124 2125 // Trim the selector passed to compile 2126 // to avoid treating leading and trailing 2127 // spaces as combinators 2128 var input = [], 2129 results = [], 2130 matcher = compile(selector.replace(rtrim, "$1")); 2131 2132 return matcher[expando] ? 2133 markFunction(function (seed, matches, _context, xml) { 2134 var elem, 2135 unmatched = matcher(seed, null, xml, []), 2136 i = seed.length; 2137 2138 // Match elements unmatched by `matcher` 2139 while (i--) { 2140 if ((elem = unmatched[i])) { 2141 seed[i] = !(matches[i] = elem); 2142 } 2143 } 2144 }) : 2145 function (elem, _context, xml) { 2146 input[0] = elem; 2147 matcher(input, null, xml, results); 2148 2149 // Don't keep the element (issue #299) 2150 input[0] = null; 2151 return !results.pop(); 2152 }; 2153 }), 2154 2155 "has": markFunction(function (selector) { 2156 return function (elem) { 2157 return Sizzle(selector, elem).length > 0; 2158 }; 2159 }), 2160 2161 "contains": markFunction(function (text) { 2162 text = text.replace(runescape, funescape); 2163 return function (elem) { 2164 return (elem.textContent || getText(elem)).indexOf(text) > -1; 2165 }; 2166 }), 2167 2168 // "Whether an element is represented by a :lang() selector 2169 // is based solely on the element's language value 2170 // being equal to the identifier C, 2171 // or beginning with the identifier C immediately followed by "-". 2172 // The matching of C against the element's language value is performed case-insensitively. 2173 // The identifier C does not have to be a valid language name." 2174 // http://www.w3.org/TR/selectors/#lang-pseudo 2175 "lang": markFunction(function (lang) { 2176 2177 // lang value must be a valid identifier 2178 if (!ridentifier.test(lang || "")) { 2179 Sizzle.error("unsupported lang: " + lang); 2180 } 2181 lang = lang.replace(runescape, funescape).toLowerCase(); 2182 return function (elem) { 2183 var elemLang; 2184 do { 2185 if ((elemLang = documentIsHTML ? 2186 elem.lang : 2187 elem.getAttribute("xml:lang") || elem.getAttribute("lang"))) { 2188 2189 elemLang = elemLang.toLowerCase(); 2190 return elemLang === lang || elemLang.indexOf(lang + "-") === 0; 2191 } 2192 } while ((elem = elem.parentNode) && elem.nodeType === 1); 2193 return false; 2194 }; 2195 }), 2196 2197 // Miscellaneous 2198 "target": function (elem) { 2199 var hash = window.location && window.location.hash; 2200 return hash && hash.slice(1) === elem.id; 2201 }, 2202 2203 "root": function (elem) { 2204 return elem === docElem; 2205 }, 2206 2207 "focus": function (elem) { 2208 return elem === document.activeElement && 2209 (!document.hasFocus || document.hasFocus()) && 2210 !!(elem.type || elem.href || ~elem.tabIndex); 2211 }, 2212 2213 // Boolean properties 2214 "enabled": createDisabledPseudo(false), 2215 "disabled": createDisabledPseudo(true), 2216 2217 "checked": function (elem) { 2218 2219 // In CSS3, :checked should return both checked and selected elements 2220 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 2221 var nodeName = elem.nodeName.toLowerCase(); 2222 return (nodeName === "input" && !!elem.checked) || 2223 (nodeName === "option" && !!elem.selected); 2224 }, 2225 2226 "selected": function (elem) { 2227 2228 // Accessing this property makes selected-by-default 2229 // options in Safari work properly 2230 if (elem.parentNode) { 2231 // eslint-disable-next-line no-unused-expressions 2232 elem.parentNode.selectedIndex; 2233 } 2234 2235 return elem.selected === true; 2236 }, 2237 2238 // Contents 2239 "empty": function (elem) { 2240 2241 // http://www.w3.org/TR/selectors/#empty-pseudo 2242 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 2243 // but not by others (comment: 8; processing instruction: 7; etc.) 2244 // nodeType < 6 works because attributes (2) do not appear as children 2245 for (elem = elem.firstChild; elem; elem = elem.nextSibling) { 2246 if (elem.nodeType < 6) { 2247 return false; 2248 } 2249 } 2250 return true; 2251 }, 2252 2253 "parent": function (elem) { 2254 return !Expr.pseudos["empty"](elem); 2255 }, 2256 2257 // Element/input types 2258 "header": function (elem) { 2259 return rheader.test(elem.nodeName); 2260 }, 2261 2262 "input": function (elem) { 2263 return rinputs.test(elem.nodeName); 2264 }, 2265 2266 "button": function (elem) { 2267 var name = elem.nodeName.toLowerCase(); 2268 return name === "input" && elem.type === "button" || name === "button"; 2269 }, 2270 2271 "text": function (elem) { 2272 var attr; 2273 return elem.nodeName.toLowerCase() === "input" && 2274 elem.type === "text" && 2275 2276 // Support: IE<8 2277 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 2278 ((attr = elem.getAttribute("type")) == null || 2279 attr.toLowerCase() === "text"); 2280 }, 2281 2282 // Position-in-collection 2283 "first": createPositionalPseudo(function () { 2284 return [0]; 2285 }), 2286 2287 "last": createPositionalPseudo(function (_matchIndexes, length) { 2288 return [length - 1]; 2289 }), 2290 2291 "eq": createPositionalPseudo(function (_matchIndexes, length, argument) { 2292 return [argument < 0 ? argument + length : argument]; 2293 }), 2294 2295 "even": createPositionalPseudo(function (matchIndexes, length) { 2296 var i = 0; 2297 for (; i < length; i += 2) { 2298 matchIndexes.push(i); 2299 } 2300 return matchIndexes; 2301 }), 2302 2303 "odd": createPositionalPseudo(function (matchIndexes, length) { 2304 var i = 1; 2305 for (; i < length; i += 2) { 2306 matchIndexes.push(i); 2307 } 2308 return matchIndexes; 2309 }), 2310 2311 "lt": createPositionalPseudo(function (matchIndexes, length, argument) { 2312 var i = argument < 0 ? 2313 argument + length : 2314 argument > length ? 2315 length : 2316 argument; 2317 for (; --i >= 0;) { 2318 matchIndexes.push(i); 2319 } 2320 return matchIndexes; 2321 }), 2322 2323 "gt": createPositionalPseudo(function (matchIndexes, length, argument) { 2324 var i = argument < 0 ? argument + length : argument; 2325 for (; ++i < length;) { 2326 matchIndexes.push(i); 2327 } 2328 return matchIndexes; 2329 }) 2330 } 2331 }; 2332 2333 Expr.pseudos["nth"] = Expr.pseudos["eq"]; 2334 2335 // Add button/input type pseudos 2336 for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) { 2337 Expr.pseudos[i] = createInputPseudo(i); 2338 } 2339 for (i in { submit: true, reset: true }) { 2340 Expr.pseudos[i] = createButtonPseudo(i); 2341 } 2342 2343 // Easy API for creating new setFilters 2344 function setFilters() { } 2345 setFilters.prototype = Expr.filters = Expr.pseudos; 2346 Expr.setFilters = new setFilters(); 2347 2348 tokenize = Sizzle.tokenize = function (selector, parseOnly) { 2349 var matched, match, tokens, type, 2350 soFar, groups, preFilters, 2351 cached = tokenCache[selector + " "]; 2352 2353 if (cached) { 2354 return parseOnly ? 0 : cached.slice(0); 2355 } 2356 2357 soFar = selector; 2358 groups = []; 2359 preFilters = Expr.preFilter; 2360 2361 while (soFar) { 2362 2363 // Comma and first run 2364 if (!matched || (match = rcomma.exec(soFar))) { 2365 if (match) { 2366 2367 // Don't consume trailing commas as valid 2368 soFar = soFar.slice(match[0].length) || soFar; 2369 } 2370 groups.push((tokens = [])); 2371 } 2372 2373 matched = false; 2374 2375 // Combinators 2376 if ((match = rcombinators.exec(soFar))) { 2377 matched = match.shift(); 2378 tokens.push({ 2379 value: matched, 2380 2381 // Cast descendant combinators to space 2382 type: match[0].replace(rtrim, " ") 2383 }); 2384 soFar = soFar.slice(matched.length); 2385 } 2386 2387 // Filters 2388 for (type in Expr.filter) { 2389 if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || 2390 (match = preFilters[type](match)))) { 2391 matched = match.shift(); 2392 tokens.push({ 2393 value: matched, 2394 type: type, 2395 matches: match 2396 }); 2397 soFar = soFar.slice(matched.length); 2398 } 2399 } 2400 2401 if (!matched) { 2402 break; 2403 } 2404 } 2405 2406 // Return the length of the invalid excess 2407 // if we're just parsing 2408 // Otherwise, throw an error or return tokens 2409 return parseOnly ? 2410 soFar.length : 2411 soFar ? 2412 Sizzle.error(selector) : 2413 2414 // Cache the tokens 2415 tokenCache(selector, groups).slice(0); 2416 }; 2417 2418 function toSelector(tokens) { 2419 var i = 0, 2420 len = tokens.length, 2421 selector = ""; 2422 for (; i < len; i++) { 2423 selector += tokens[i].value; 2424 } 2425 return selector; 2426 } 2427 2428 function addCombinator(matcher, combinator, base) { 2429 var dir = combinator.dir, 2430 skip = combinator.next, 2431 key = skip || dir, 2432 checkNonElements = base && key === "parentNode", 2433 doneName = done++; 2434 2435 return combinator.first ? 2436 2437 // Check against closest ancestor/preceding element 2438 function (elem, context, xml) { 2439 while ((elem = elem[dir])) { 2440 if (elem.nodeType === 1 || checkNonElements) { 2441 return matcher(elem, context, xml); 2442 } 2443 } 2444 return false; 2445 } : 2446 2447 // Check against all ancestor/preceding elements 2448 function (elem, context, xml) { 2449 var oldCache, uniqueCache, outerCache, 2450 newCache = [dirruns, doneName]; 2451 2452 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 2453 if (xml) { 2454 while ((elem = elem[dir])) { 2455 if (elem.nodeType === 1 || checkNonElements) { 2456 if (matcher(elem, context, xml)) { 2457 return true; 2458 } 2459 } 2460 } 2461 } else { 2462 while ((elem = elem[dir])) { 2463 if (elem.nodeType === 1 || checkNonElements) { 2464 outerCache = elem[expando] || (elem[expando] = {}); 2465 2466 // Support: IE <9 only 2467 // Defend against cloned attroperties (jQuery gh-1709) 2468 uniqueCache = outerCache[elem.uniqueID] || 2469 (outerCache[elem.uniqueID] = {}); 2470 2471 if (skip && skip === elem.nodeName.toLowerCase()) { 2472 elem = elem[dir] || elem; 2473 } else if ((oldCache = uniqueCache[key]) && 2474 oldCache[0] === dirruns && oldCache[1] === doneName) { 2475 2476 // Assign to newCache so results back-propagate to previous elements 2477 return (newCache[2] = oldCache[2]); 2478 } else { 2479 2480 // Reuse newcache so results back-propagate to previous elements 2481 uniqueCache[key] = newCache; 2482 2483 // A match means we're done; a fail means we have to keep checking 2484 if ((newCache[2] = matcher(elem, context, xml))) { 2485 return true; 2486 } 2487 } 2488 } 2489 } 2490 } 2491 return false; 2492 }; 2493 } 2494 2495 function elementMatcher(matchers) { 2496 return matchers.length > 1 ? 2497 function (elem, context, xml) { 2498 var i = matchers.length; 2499 while (i--) { 2500 if (!matchers[i](elem, context, xml)) { 2501 return false; 2502 } 2503 } 2504 return true; 2505 } : 2506 matchers[0]; 2507 } 2508 2509 function multipleContexts(selector, contexts, results) { 2510 var i = 0, 2511 len = contexts.length; 2512 for (; i < len; i++) { 2513 Sizzle(selector, contexts[i], results); 2514 } 2515 return results; 2516 } 2517 2518 function condense(unmatched, map, filter, context, xml) { 2519 var elem, 2520 newUnmatched = [], 2521 i = 0, 2522 len = unmatched.length, 2523 mapped = map != null; 2524 2525 for (; i < len; i++) { 2526 if ((elem = unmatched[i])) { 2527 if (!filter || filter(elem, context, xml)) { 2528 newUnmatched.push(elem); 2529 if (mapped) { 2530 map.push(i); 2531 } 2532 } 2533 } 2534 } 2535 2536 return newUnmatched; 2537 } 2538 2539 function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) { 2540 if (postFilter && !postFilter[expando]) { 2541 postFilter = setMatcher(postFilter); 2542 } 2543 if (postFinder && !postFinder[expando]) { 2544 postFinder = setMatcher(postFinder, postSelector); 2545 } 2546 return markFunction(function (seed, results, context, xml) { 2547 var temp, i, elem, 2548 preMap = [], 2549 postMap = [], 2550 preexisting = results.length, 2551 2552 // Get initial elements from seed or context 2553 elems = seed || multipleContexts( 2554 selector || "*", 2555 context.nodeType ? [context] : context, 2556 [] 2557 ), 2558 2559 // Prefilter to get matcher input, preserving a map for seed-results synchronization 2560 matcherIn = preFilter && (seed || !selector) ? 2561 condense(elems, preMap, preFilter, context, xml) : 2562 elems, 2563 2564 matcherOut = matcher ? 2565 2566 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 2567 postFinder || (seed ? preFilter : preexisting || postFilter) ? 2568 2569 // ...intermediate processing is necessary 2570 [] : 2571 2572 // ...otherwise use results directly 2573 results : 2574 matcherIn; 2575 2576 // Find primary matches 2577 if (matcher) { 2578 matcher(matcherIn, matcherOut, context, xml); 2579 } 2580 2581 // Apply postFilter 2582 if (postFilter) { 2583 temp = condense(matcherOut, postMap); 2584 postFilter(temp, [], context, xml); 2585 2586 // Un-match failing elements by moving them back to matcherIn 2587 i = temp.length; 2588 while (i--) { 2589 if ((elem = temp[i])) { 2590 matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem); 2591 } 2592 } 2593 } 2594 2595 if (seed) { 2596 if (postFinder || preFilter) { 2597 if (postFinder) { 2598 2599 // Get the final matcherOut by condensing this intermediate into postFinder contexts 2600 temp = []; 2601 i = matcherOut.length; 2602 while (i--) { 2603 if ((elem = matcherOut[i])) { 2604 2605 // Restore matcherIn since elem is not yet a final match 2606 temp.push((matcherIn[i] = elem)); 2607 } 2608 } 2609 postFinder(null, (matcherOut = []), temp, xml); 2610 } 2611 2612 // Move matched elements from seed to results to keep them synchronized 2613 i = matcherOut.length; 2614 while (i--) { 2615 if ((elem = matcherOut[i]) && 2616 (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) { 2617 2618 seed[temp] = !(results[temp] = elem); 2619 } 2620 } 2621 } 2622 2623 // Add elements to results, through postFinder if defined 2624 } else { 2625 matcherOut = condense( 2626 matcherOut === results ? 2627 matcherOut.splice(preexisting, matcherOut.length) : 2628 matcherOut 2629 ); 2630 if (postFinder) { 2631 postFinder(null, results, matcherOut, xml); 2632 } else { 2633 push.apply(results, matcherOut); 2634 } 2635 } 2636 }); 2637 } 2638 2639 function matcherFromTokens(tokens) { 2640 var checkContext, matcher, j, 2641 len = tokens.length, 2642 leadingRelative = Expr.relative[tokens[0].type], 2643 implicitRelative = leadingRelative || Expr.relative[" "], 2644 i = leadingRelative ? 1 : 0, 2645 2646 // The foundational matcher ensures that elements are reachable from top-level context(s) 2647 matchContext = addCombinator(function (elem) { 2648 return elem === checkContext; 2649 }, implicitRelative, true), 2650 matchAnyContext = addCombinator(function (elem) { 2651 return indexOf(checkContext, elem) > -1; 2652 }, implicitRelative, true), 2653 matchers = [function (elem, context, xml) { 2654 var ret = (!leadingRelative && (xml || context !== outermostContext)) || ( 2655 (checkContext = context).nodeType ? 2656 matchContext(elem, context, xml) : 2657 matchAnyContext(elem, context, xml)); 2658 2659 // Avoid hanging onto element (issue #299) 2660 checkContext = null; 2661 return ret; 2662 }]; 2663 2664 for (; i < len; i++) { 2665 if ((matcher = Expr.relative[tokens[i].type])) { 2666 matchers = [addCombinator(elementMatcher(matchers), matcher)]; 2667 } else { 2668 matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches); 2669 2670 // Return special upon seeing a positional matcher 2671 if (matcher[expando]) { 2672 2673 // Find the next relative operator (if any) for proper handling 2674 j = ++i; 2675 for (; j < len; j++) { 2676 if (Expr.relative[tokens[j].type]) { 2677 break; 2678 } 2679 } 2680 return setMatcher( 2681 i > 1 && elementMatcher(matchers), 2682 i > 1 && toSelector( 2683 2684 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 2685 tokens 2686 .slice(0, i - 1) 2687 .concat({ value: tokens[i - 2].type === " " ? "*" : "" }) 2688 ).replace(rtrim, "$1"), 2689 matcher, 2690 i < j && matcherFromTokens(tokens.slice(i, j)), 2691 j < len && matcherFromTokens((tokens = tokens.slice(j))), 2692 j < len && toSelector(tokens) 2693 ); 2694 } 2695 matchers.push(matcher); 2696 } 2697 } 2698 2699 return elementMatcher(matchers); 2700 } 2701 2702 function matcherFromGroupMatchers(elementMatchers, setMatchers) { 2703 var bySet = setMatchers.length > 0, 2704 byElement = elementMatchers.length > 0, 2705 superMatcher = function (seed, context, xml, results, outermost) { 2706 var elem, j, matcher, 2707 matchedCount = 0, 2708 i = "0", 2709 unmatched = seed && [], 2710 setMatched = [], 2711 contextBackup = outermostContext, 2712 2713 // We must always have either seed elements or outermost context 2714 elems = seed || byElement && Expr.find["TAG"]("*", outermost), 2715 2716 // Use integer dirruns iff this is the outermost matcher 2717 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), 2718 len = elems.length; 2719 2720 if (outermost) { 2721 2722 // Support: IE 11+, Edge 17 - 18+ 2723 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2724 // two documents; shallow comparisons work. 2725 // eslint-disable-next-line eqeqeq 2726 outermostContext = context == document || context || outermost; 2727 } 2728 2729 // Add elements passing elementMatchers directly to results 2730 // Support: IE<9, Safari 2731 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 2732 for (; i !== len && (elem = elems[i]) != null; i++) { 2733 if (byElement && elem) { 2734 j = 0; 2735 2736 // Support: IE 11+, Edge 17 - 18+ 2737 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2738 // two documents; shallow comparisons work. 2739 // eslint-disable-next-line eqeqeq 2740 if (!context && elem.ownerDocument != document) { 2741 setDocument(elem); 2742 xml = !documentIsHTML; 2743 } 2744 while ((matcher = elementMatchers[j++])) { 2745 if (matcher(elem, context || document, xml)) { 2746 results.push(elem); 2747 break; 2748 } 2749 } 2750 if (outermost) { 2751 dirruns = dirrunsUnique; 2752 } 2753 } 2754 2755 // Track unmatched elements for set filters 2756 if (bySet) { 2757 2758 // They will have gone through all possible matchers 2759 if ((elem = !matcher && elem)) { 2760 matchedCount--; 2761 } 2762 2763 // Lengthen the array for every element, matched or not 2764 if (seed) { 2765 unmatched.push(elem); 2766 } 2767 } 2768 } 2769 2770 // `i` is now the count of elements visited above, and adding it to `matchedCount` 2771 // makes the latter nonnegative. 2772 matchedCount += i; 2773 2774 // Apply set filters to unmatched elements 2775 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 2776 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 2777 // no element matchers and no seed. 2778 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 2779 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 2780 // numerically zero. 2781 if (bySet && i !== matchedCount) { 2782 j = 0; 2783 while ((matcher = setMatchers[j++])) { 2784 matcher(unmatched, setMatched, context, xml); 2785 } 2786 2787 if (seed) { 2788 2789 // Reintegrate element matches to eliminate the need for sorting 2790 if (matchedCount > 0) { 2791 while (i--) { 2792 if (!(unmatched[i] || setMatched[i])) { 2793 setMatched[i] = pop.call(results); 2794 } 2795 } 2796 } 2797 2798 // Discard index placeholder values to get only actual matches 2799 setMatched = condense(setMatched); 2800 } 2801 2802 // Add matches to results 2803 push.apply(results, setMatched); 2804 2805 // Seedless set matches succeeding multiple successful matchers stipulate sorting 2806 if (outermost && !seed && setMatched.length > 0 && 2807 (matchedCount + setMatchers.length) > 1) { 2808 2809 Sizzle.uniqueSort(results); 2810 } 2811 } 2812 2813 // Override manipulation of globals by nested matchers 2814 if (outermost) { 2815 dirruns = dirrunsUnique; 2816 outermostContext = contextBackup; 2817 } 2818 2819 return unmatched; 2820 }; 2821 2822 return bySet ? 2823 markFunction(superMatcher) : 2824 superMatcher; 2825 } 2826 2827 compile = Sizzle.compile = function (selector, match /* Internal Use Only */) { 2828 var i, 2829 setMatchers = [], 2830 elementMatchers = [], 2831 cached = compilerCache[selector + " "]; 2832 2833 if (!cached) { 2834 2835 // Generate a function of recursive functions that can be used to check each element 2836 if (!match) { 2837 match = tokenize(selector); 2838 } 2839 i = match.length; 2840 while (i--) { 2841 cached = matcherFromTokens(match[i]); 2842 if (cached[expando]) { 2843 setMatchers.push(cached); 2844 } else { 2845 elementMatchers.push(cached); 2846 } 2847 } 2848 2849 // Cache the compiled function 2850 cached = compilerCache( 2851 selector, 2852 matcherFromGroupMatchers(elementMatchers, setMatchers) 2853 ); 2854 2855 // Save selector and tokenization 2856 cached.selector = selector; 2857 } 2858 return cached; 2859 }; 2860 2861 /** 2862 * A low-level selection function that works with Sizzle's compiled 2863 * selector functions 2864 * @param {String|Function} selector A selector or a pre-compiled 2865 * selector function built with Sizzle.compile 2866 * @param {Element} context 2867 * @param {Array} [results] 2868 * @param {Array} [seed] A set of elements to match against 2869 */ 2870 select = Sizzle.select = function (selector, context, results, seed) { 2871 var i, tokens, token, type, find, 2872 compiled = typeof selector === "function" && selector, 2873 match = !seed && tokenize((selector = compiled.selector || selector)); 2874 2875 results = results || []; 2876 2877 // Try to minimize operations if there is only one selector in the list and no seed 2878 // (the latter of which guarantees us context) 2879 if (match.length === 1) { 2880 2881 // Reduce context if the leading compound selector is an ID 2882 tokens = match[0] = match[0].slice(0); 2883 if (tokens.length > 2 && (token = tokens[0]).type === "ID" && 2884 context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) { 2885 2886 context = (Expr.find["ID"](token.matches[0] 2887 .replace(runescape, funescape), context) || [])[0]; 2888 if (!context) { 2889 return results; 2890 2891 // Precompiled matchers will still verify ancestry, so step up a level 2892 } else if (compiled) { 2893 context = context.parentNode; 2894 } 2895 2896 selector = selector.slice(tokens.shift().value.length); 2897 } 2898 2899 // Fetch a seed set for right-to-left matching 2900 i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length; 2901 while (i--) { 2902 token = tokens[i]; 2903 2904 // Abort if we hit a combinator 2905 if (Expr.relative[(type = token.type)]) { 2906 break; 2907 } 2908 if ((find = Expr.find[type])) { 2909 2910 // Search, expanding context for leading sibling combinators 2911 if ((seed = find( 2912 token.matches[0].replace(runescape, funescape), 2913 rsibling.test(tokens[0].type) && testContext(context.parentNode) || 2914 context 2915 ))) { 2916 2917 // If seed is empty or no tokens remain, we can return early 2918 tokens.splice(i, 1); 2919 selector = seed.length && toSelector(tokens); 2920 if (!selector) { 2921 push.apply(results, seed); 2922 return results; 2923 } 2924 2925 break; 2926 } 2927 } 2928 } 2929 } 2930 2931 // Compile and execute a filtering function if one is not provided 2932 // Provide `match` to avoid retokenization if we modified the selector above 2933 (compiled || compile(selector, match))( 2934 seed, 2935 context, 2936 !documentIsHTML, 2937 results, 2938 !context || rsibling.test(selector) && testContext(context.parentNode) || context 2939 ); 2940 return results; 2941 }; 2942 2943 // One-time assignments 2944 2945 // Sort stability 2946 support.sortStable = expando.split("").sort(sortOrder).join("") === expando; 2947 2948 // Support: Chrome 14-35+ 2949 // Always assume duplicates if they aren't passed to the comparison function 2950 support.detectDuplicates = !!hasDuplicate; 2951 2952 // Initialize against the default document 2953 setDocument(); 2954 2955 // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 2956 // Detached nodes confoundingly follow *each other* 2957 support.sortDetached = assert(function (el) { 2958 2959 // Should return 1, but returns 4 (following) 2960 return el.compareDocumentPosition(document.createElement("fieldset")) & 1; 2961 }); 2962 2963 // Support: IE<8 2964 // Prevent attribute/property "interpolation" 2965 // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 2966 if (!assert(function (el) { 2967 el.innerHTML = "<a href='#'></a>"; 2968 return el.firstChild.getAttribute("href") === "#"; 2969 })) { 2970 addHandle("type|href|height|width", function (elem, name, isXML) { 2971 if (!isXML) { 2972 return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2); 2973 } 2974 }); 2975 } 2976 2977 // Support: IE<9 2978 // Use defaultValue in place of getAttribute("value") 2979 if (!support.attributes || !assert(function (el) { 2980 el.innerHTML = "<input/>"; 2981 el.firstChild.setAttribute("value", ""); 2982 return el.firstChild.getAttribute("value") === ""; 2983 })) { 2984 addHandle("value", function (elem, _name, isXML) { 2985 if (!isXML && elem.nodeName.toLowerCase() === "input") { 2986 return elem.defaultValue; 2987 } 2988 }); 2989 } 2990 2991 // Support: IE<9 2992 // Use getAttributeNode to fetch booleans when getAttribute lies 2993 if (!assert(function (el) { 2994 return el.getAttribute("disabled") == null; 2995 })) { 2996 addHandle(booleans, function (elem, name, isXML) { 2997 var val; 2998 if (!isXML) { 2999 return elem[name] === true ? name.toLowerCase() : 3000 (val = elem.getAttributeNode(name)) && val.specified ? 3001 val.value : 3002 null; 3003 } 3004 }); 3005 } 3006 3007 return Sizzle; 3008 3009 })(window); 3010 3011 3012 3013 jQuery.find = Sizzle; 3014 jQuery.expr = Sizzle.selectors; 3015 3016 // Deprecated 3017 jQuery.expr[":"] = jQuery.expr.pseudos; 3018 jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 3019 jQuery.text = Sizzle.getText; 3020 jQuery.isXMLDoc = Sizzle.isXML; 3021 jQuery.contains = Sizzle.contains; 3022 jQuery.escapeSelector = Sizzle.escape; 3023 3024 3025 3026 3027 var dir = function (elem, dir, until) { 3028 var matched = [], 3029 truncate = until !== undefined; 3030 3031 while ((elem = elem[dir]) && elem.nodeType !== 9) { 3032 if (elem.nodeType === 1) { 3033 if (truncate && jQuery(elem).is(until)) { 3034 break; 3035 } 3036 matched.push(elem); 3037 } 3038 } 3039 return matched; 3040 }; 3041 3042 3043 var siblings = function (n, elem) { 3044 var matched = []; 3045 3046 for (; n; n = n.nextSibling) { 3047 if (n.nodeType === 1 && n !== elem) { 3048 matched.push(n); 3049 } 3050 } 3051 3052 return matched; 3053 }; 3054 3055 3056 var rneedsContext = jQuery.expr.match.needsContext; 3057 3058 3059 3060 function nodeName(elem, name) { 3061 3062 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 3063 3064 }; 3065 var rsingleTag = (/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i); 3066 3067 3068 3069 // Implement the identical functionality for filter and not 3070 function winnow(elements, qualifier, not) { 3071 if (isFunction(qualifier)) { 3072 return jQuery.grep(elements, function (elem, i) { 3073 return !!qualifier.call(elem, i, elem) !== not; 3074 }); 3075 } 3076 3077 // Single element 3078 if (qualifier.nodeType) { 3079 return jQuery.grep(elements, function (elem) { 3080 return (elem === qualifier) !== not; 3081 }); 3082 } 3083 3084 // Arraylike of elements (jQuery, arguments, Array) 3085 if (typeof qualifier !== "string") { 3086 return jQuery.grep(elements, function (elem) { 3087 return (indexOf.call(qualifier, elem) > -1) !== not; 3088 }); 3089 } 3090 3091 // Filtered directly for both simple and complex selectors 3092 return jQuery.filter(qualifier, elements, not); 3093 } 3094 3095 jQuery.filter = function (expr, elems, not) { 3096 var elem = elems[0]; 3097 3098 if (not) { 3099 expr = ":not(" + expr + ")"; 3100 } 3101 3102 if (elems.length === 1 && elem.nodeType === 1) { 3103 return jQuery.find.matchesSelector(elem, expr) ? [elem] : []; 3104 } 3105 3106 return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) { 3107 return elem.nodeType === 1; 3108 })); 3109 }; 3110 3111 jQuery.fn.extend({ 3112 find: function (selector) { 3113 var i, ret, 3114 len = this.length, 3115 self = this; 3116 3117 if (typeof selector !== "string") { 3118 return this.pushStack(jQuery(selector).filter(function () { 3119 for (i = 0; i < len; i++) { 3120 if (jQuery.contains(self[i], this)) { 3121 return true; 3122 } 3123 } 3124 })); 3125 } 3126 3127 ret = this.pushStack([]); 3128 3129 for (i = 0; i < len; i++) { 3130 jQuery.find(selector, self[i], ret); 3131 } 3132 3133 return len > 1 ? jQuery.uniqueSort(ret) : ret; 3134 }, 3135 filter: function (selector) { 3136 return this.pushStack(winnow(this, selector || [], false)); 3137 }, 3138 not: function (selector) { 3139 return this.pushStack(winnow(this, selector || [], true)); 3140 }, 3141 is: function (selector) { 3142 return !!winnow( 3143 this, 3144 3145 // If this is a positional/relative selector, check membership in the returned set 3146 // so $("p:first").is("p:last") won't return true for a doc with two "p". 3147 typeof selector === "string" && rneedsContext.test(selector) ? 3148 jQuery(selector) : 3149 selector || [], 3150 false 3151 ).length; 3152 } 3153 }); 3154 3155 3156 // Initialize a jQuery object 3157 3158 3159 // A central reference to the root jQuery(document) 3160 var rootjQuery, 3161 3162 // A simple way to check for HTML strings 3163 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 3164 // Strict HTML recognition (#11290: must start with <) 3165 // Shortcut simple #id case for speed 3166 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 3167 3168 init = jQuery.fn.init = function (selector, context, root) { 3169 var match, elem; 3170 3171 // HANDLE: $(""), $(null), $(undefined), $(false) 3172 if (!selector) { 3173 return this; 3174 } 3175 3176 // Method init() accepts an alternate rootjQuery
vendor: 29,870 bytes, lines 3177-4301
3177 // so migrate can support jQuery.sub (gh-2101) 3178 root = root || rootjQuery; 3179 3180 // Handle HTML strings 3181 if (typeof selector === "string") { 3182 if (selector[0] === "<" && 3183 selector[selector.length - 1] === ">" && 3184 selector.length >= 3) { 3185 3186 // Assume that strings that start and end with <> are HTML and skip the regex check 3187 match = [null, selector, null]; 3188 3189 } else { 3190 match = rquickExpr.exec(selector); 3191 } 3192 3193 // Match html or make sure no context is specified for #id 3194 if (match && (match[1] || !context)) { 3195 3196 // HANDLE: $(html) -> $(array) 3197 if (match[1]) { 3198 context = context instanceof jQuery ? context[0] : context; 3199 3200 // Option to run scripts is true for back-compat 3201 // Intentionally let the error be thrown if parseHTML is not present 3202 jQuery.merge(this, jQuery.parseHTML( 3203 match[1], 3204 context && context.nodeType ? context.ownerDocument || context : document, 3205 true 3206 )); 3207 3208 // HANDLE: $(html, props) 3209 if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) { 3210 for (match in context) { 3211 3212 // Properties of context are called as methods if possible 3213 if (isFunction(this[match])) { 3214 this[match](context[match]); 3215 3216 // ...and otherwise set as attributes 3217 } else { 3218 this.attr(match, context[match]); 3219 } 3220 } 3221 } 3222 3223 return this; 3224 3225 // HANDLE: $(#id) 3226 } else { 3227 elem = document.getElementById(match[2]); 3228 3229 if (elem) { 3230 3231 // Inject the element directly into the jQuery object 3232 this[0] = elem; 3233 this.length = 1; 3234 } 3235 return this; 3236 } 3237 3238 // HANDLE: $(expr, $(...)) 3239 } else if (!context || context.jquery) { 3240 return (context || root).find(selector); 3241 3242 // HANDLE: $(expr, context) 3243 // (which is just equivalent to: $(context).find(expr) 3244 } else { 3245 return this.constructor(context).find(selector); 3246 } 3247 3248 // HANDLE: $(DOMElement) 3249 } else if (selector.nodeType) { 3250 this[0] = selector; 3251 this.length = 1; 3252 return this; 3253 3254 // HANDLE: $(function) 3255 // Shortcut for document ready 3256 } else if (isFunction(selector)) { 3257 return root.ready !== undefined ? 3258 root.ready(selector) : 3259 3260 // Execute immediately if ready is not present 3261 selector(jQuery); 3262 } 3263 3264 return jQuery.makeArray(selector, this); 3265 }; 3266 3267 // Give the init function the jQuery prototype for later instantiation 3268 init.prototype = jQuery.fn; 3269 3270 // Initialize central reference 3271 rootjQuery = jQuery(document); 3272 3273 3274 var rparentsprev = /^(?:parents|prev(?:Until|All))/, 3275 3276 // Methods guaranteed to produce a unique set when starting from a unique set 3277 guaranteedUnique = { 3278 children: true, 3279 contents: true, 3280 next: true, 3281 prev: true 3282 }; 3283 3284 jQuery.fn.extend({ 3285 has: function (target) { 3286 var targets = jQuery(target, this), 3287 l = targets.length; 3288 3289 return this.filter(function () { 3290 var i = 0; 3291 for (; i < l; i++) { 3292 if (jQuery.contains(this, targets[i])) { 3293 return true; 3294 } 3295 } 3296 }); 3297 }, 3298 3299 closest: function (selectors, context) { 3300 var cur, 3301 i = 0, 3302 l = this.length, 3303 matched = [], 3304 targets = typeof selectors !== "string" && jQuery(selectors); 3305 3306 // Positional selectors never match, since there's no _selection_ context 3307 if (!rneedsContext.test(selectors)) { 3308 for (; i < l; i++) { 3309 for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) { 3310 3311 // Always skip document fragments 3312 if (cur.nodeType < 11 && (targets ? 3313 targets.index(cur) > -1 : 3314 3315 // Don't pass non-elements to Sizzle 3316 cur.nodeType === 1 && 3317 jQuery.find.matchesSelector(cur, selectors))) { 3318 3319 matched.push(cur); 3320 break; 3321 } 3322 } 3323 } 3324 } 3325 3326 return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched); 3327 }, 3328 3329 // Determine the position of an element within the set 3330 index: function (elem) { 3331 3332 // No argument, return index in parent 3333 if (!elem) { 3334 return (this[0] && this[0].parentNode) ? this.first().prevAll().length : -1; 3335 } 3336 3337 // Index in selector 3338 if (typeof elem === "string") { 3339 return indexOf.call(jQuery(elem), this[0]); 3340 } 3341 3342 // Locate the position of the desired element 3343 return indexOf.call(this, 3344 3345 // If it receives a jQuery object, the first element is used 3346 elem.jquery ? elem[0] : elem 3347 ); 3348 }, 3349 3350 add: function (selector, context) { 3351 return this.pushStack( 3352 jQuery.uniqueSort( 3353 jQuery.merge(this.get(), jQuery(selector, context)) 3354 ) 3355 ); 3356 }, 3357 3358 addBack: function (selector) { 3359 return this.add(selector == null ? 3360 this.prevObject : this.prevObject.filter(selector) 3361 ); 3362 } 3363 }); 3364 3365 function sibling(cur, dir) { 3366 while ((cur = cur[dir]) && cur.nodeType !== 1) { } 3367 return cur; 3368 } 3369 3370 jQuery.each({ 3371 parent: function (elem) { 3372 var parent = elem.parentNode; 3373 return parent && parent.nodeType !== 11 ? parent : null; 3374 }, 3375 parents: function (elem) { 3376 return dir(elem, "parentNode"); 3377 }, 3378 parentsUntil: function (elem, _i, until) { 3379 return dir(elem, "parentNode", until); 3380 }, 3381 next: function (elem) { 3382 return sibling(elem, "nextSibling"); 3383 }, 3384 prev: function (elem) { 3385 return sibling(elem, "previousSibling"); 3386 }, 3387 nextAll: function (elem) { 3388 return dir(elem, "nextSibling"); 3389 }, 3390 prevAll: function (elem) { 3391 return dir(elem, "previousSibling"); 3392 }, 3393 nextUntil: function (elem, _i, until) { 3394 return dir(elem, "nextSibling", until); 3395 }, 3396 prevUntil: function (elem, _i, until) { 3397 return dir(elem, "previousSibling", until); 3398 }, 3399 siblings: function (elem) { 3400 return siblings((elem.parentNode || {}).firstChild, elem); 3401 }, 3402 children: function (elem) { 3403 return siblings(elem.firstChild); 3404 }, 3405 contents: function (elem) { 3406 if (elem.contentDocument != null && 3407 3408 // Support: IE 11+ 3409 // <object> elements with no `data` attribute has an object 3410 // `contentDocument` with a `null` prototype. 3411 getProto(elem.contentDocument)) { 3412 3413 return elem.contentDocument; 3414 } 3415 3416 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 3417 // Treat the template element as a regular one in browsers that 3418 // don't support it. 3419 if (nodeName(elem, "template")) { 3420 elem = elem.content || elem; 3421 } 3422 3423 return jQuery.merge([], elem.childNodes); 3424 } 3425 }, function (name, fn) { 3426 jQuery.fn[name] = function (until, selector) { 3427 var matched = jQuery.map(this, fn, until); 3428 3429 if (name.slice(-5) !== "Until") { 3430 selector = until; 3431 } 3432 3433 if (selector && typeof selector === "string") { 3434 matched = jQuery.filter(selector, matched); 3435 } 3436 3437 if (this.length > 1) { 3438 3439 // Remove duplicates 3440 if (!guaranteedUnique[name]) { 3441 jQuery.uniqueSort(matched); 3442 } 3443 3444 // Reverse order for parents* and prev-derivatives 3445 if (rparentsprev.test(name)) { 3446 matched.reverse(); 3447 } 3448 } 3449 3450 return this.pushStack(matched); 3451 }; 3452 }); 3453 var rnothtmlwhite = (/[^\x20\t\r\n\f]+/g); 3454 3455 3456 3457 // Convert String-formatted options into Object-formatted ones 3458 function createOptions(options) { 3459 var object = {}; 3460 jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) { 3461 object[flag] = true; 3462 }); 3463 return object; 3464 } 3465 3466 /* 3467 * Create a callback list using the following parameters: 3468 * 3469 * options: an optional list of space-separated options that will change how 3470 * the callback list behaves or a more traditional option object 3471 * 3472 * By default a callback list will act like an event callback list and can be 3473 * "fired" multiple times. 3474 * 3475 * Possible options: 3476 * 3477 * once: will ensure the callback list can only be fired once (like a Deferred) 3478 * 3479 * memory: will keep track of previous values and will call any callback added 3480 * after the list has been fired right away with the latest "memorized" 3481 * values (like a Deferred) 3482 * 3483 * unique: will ensure a callback can only be added once (no duplicate in the list) 3484 * 3485 * stopOnFalse: interrupt callings when a callback returns false 3486 * 3487 */ 3488 jQuery.Callbacks = function (options) { 3489 3490 // Convert options from String-formatted to Object-formatted if needed 3491 // (we check in cache first) 3492 options = typeof options === "string" ? 3493 createOptions(options) : 3494 jQuery.extend({}, options); 3495 3496 var // Flag to know if list is currently firing 3497 firing, 3498 3499 // Last fire value for non-forgettable lists 3500 memory, 3501 3502 // Flag to know if list was already fired 3503 fired, 3504 3505 // Flag to prevent firing 3506 locked, 3507 3508 // Actual callback list 3509 list = [], 3510 3511 // Queue of execution data for repeatable lists 3512 queue = [], 3513 3514 // Index of currently firing callback (modified by add/remove as needed) 3515 firingIndex = -1, 3516 3517 // Fire callbacks 3518 fire = function () { 3519 3520 // Enforce single-firing 3521 locked = locked || options.once; 3522 3523 // Execute callbacks for all pending executions, 3524 // respecting firingIndex overrides and runtime changes 3525 fired = firing = true; 3526 for (; queue.length; firingIndex = -1) { 3527 memory = queue.shift(); 3528 while (++firingIndex < list.length) { 3529 3530 // Run callback and check for early termination 3531 if (list[firingIndex].apply(memory[0], memory[1]) === false && 3532 options.stopOnFalse) { 3533 3534 // Jump to end and forget the data so .add doesn't re-fire 3535 firingIndex = list.length; 3536 memory = false; 3537 } 3538 } 3539 } 3540 3541 // Forget the data if we're done with it 3542 if (!options.memory) { 3543 memory = false; 3544 } 3545 3546 firing = false; 3547 3548 // Clean up if we're done firing for good 3549 if (locked) { 3550 3551 // Keep an empty list if we have data for future add calls 3552 if (memory) { 3553 list = []; 3554 3555 // Otherwise, this object is spent 3556 } else { 3557 list = ""; 3558 } 3559 } 3560 }, 3561 3562 // Actual Callbacks object 3563 self = { 3564 3565 // Add a callback or a collection of callbacks to the list 3566 add: function () { 3567 if (list) { 3568 3569 // If we have memory from a past run, we should fire after adding 3570 if (memory && !firing) { 3571 firingIndex = list.length - 1; 3572 queue.push(memory); 3573 } 3574 3575 (function add(args) { 3576 jQuery.each(args, function (_, arg) { 3577 if (isFunction(arg)) { 3578 if (!options.unique || !self.has(arg)) { 3579 list.push(arg); 3580 } 3581 } else if (arg && arg.length && toType(arg) !== "string") { 3582 3583 // Inspect recursively 3584 add(arg); 3585 } 3586 }); 3587 })(arguments); 3588 3589 if (memory && !firing) { 3590 fire(); 3591 } 3592 } 3593 return this; 3594 }, 3595 3596 // Remove a callback from the list 3597 remove: function () { 3598 jQuery.each(arguments, function (_, arg) { 3599 var index; 3600 while ((index = jQuery.inArray(arg, list, index)) > -1) { 3601 list.splice(index, 1); 3602 3603 // Handle firing indexes 3604 if (index <= firingIndex) { 3605 firingIndex--; 3606 } 3607 } 3608 }); 3609 return this; 3610 }, 3611 3612 // Check if a given callback is in the list. 3613 // If no argument is given, return whether or not list has callbacks attached. 3614 has: function (fn) { 3615 return fn ? 3616 jQuery.inArray(fn, list) > -1 : 3617 list.length > 0; 3618 }, 3619 3620 // Remove all callbacks from the list 3621 empty: function () { 3622 if (list) { 3623 list = []; 3624 } 3625 return this; 3626 }, 3627 3628 // Disable .fire and .add 3629 // Abort any current/pending executions 3630 // Clear all callbacks and values 3631 disable: function () { 3632 locked = queue = []; 3633 list = memory = ""; 3634 return this; 3635 }, 3636 disabled: function () { 3637 return !list; 3638 }, 3639 3640 // Disable .fire 3641 // Also disable .add unless we have memory (since it would have no effect) 3642 // Abort any pending executions 3643 lock: function () { 3644 locked = queue = []; 3645 if (!memory && !firing) { 3646 list = memory = ""; 3647 } 3648 return this; 3649 }, 3650 locked: function () { 3651 return !!locked; 3652 }, 3653 3654 // Call all callbacks with the given context and arguments 3655 fireWith: function (context, args) { 3656 if (!locked) { 3657 args = args || []; 3658 args = [context, args.slice ? args.slice() : args]; 3659 queue.push(args); 3660 if (!firing) { 3661 fire(); 3662 } 3663 } 3664 return this; 3665 }, 3666 3667 // Call all the callbacks with the given arguments 3668 fire: function () { 3669 self.fireWith(this, arguments); 3670 return this; 3671 }, 3672 3673 // To know if the callbacks have already been called at least once 3674 fired: function () { 3675 return !!fired; 3676 } 3677 }; 3678 3679 return self; 3680 }; 3681 3682 3683 function Identity(v) { 3684 return v; 3685 } 3686 function Thrower(ex) { 3687 throw ex; 3688 } 3689 3690 function adoptValue(value, resolve, reject, noValue) { 3691 var method; 3692 3693 try { 3694 3695 // Check for promise aspect first to privilege synchronous behavior 3696 if (value && isFunction((method = value.promise))) { 3697 method.call(value).done(resolve).fail(reject); 3698 3699 // Other thenables 3700 } else if (value && isFunction((method = value.then))) { 3701 method.call(value, resolve, reject); 3702 3703 // Other non-thenables 3704 } else { 3705 3706 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 3707 // * false: [ value ].slice( 0 ) => resolve( value ) 3708 // * true: [ value ].slice( 1 ) => resolve() 3709 resolve.apply(undefined, [value].slice(noValue)); 3710 } 3711 3712 // For Promises/A+, convert exceptions into rejections 3713 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 3714 // Deferred#then to conditionally suppress rejection. 3715 } catch (value) { 3716 3717 // Support: Android 4.0 only 3718 // Strict mode functions invoked without .call/.apply get global-object context 3719 reject.apply(undefined, [value]); 3720 } 3721 } 3722 3723 jQuery.extend({ 3724 3725 Deferred: function (func) { 3726 var tuples = [ 3727 3728 // action, add listener, callbacks, 3729 // ... .then handlers, argument index, [final state] 3730 ["notify", "progress", jQuery.Callbacks("memory"), 3731 jQuery.Callbacks("memory"), 2], 3732 ["resolve", "done", jQuery.Callbacks("once memory"), 3733 jQuery.Callbacks("once memory"), 0, "resolved"], 3734 ["reject", "fail", jQuery.Callbacks("once memory"), 3735 jQuery.Callbacks("once memory"), 1, "rejected"] 3736 ], 3737 state = "pending", 3738 promise = { 3739 state: function () { 3740 return state; 3741 }, 3742 always: function () { 3743 deferred.done(arguments).fail(arguments); 3744 return this; 3745 }, 3746 "catch": function (fn) { 3747 return promise.then(null, fn); 3748 }, 3749 3750 // Keep pipe for back-compat 3751 pipe: function ( /* fnDone, fnFail, fnProgress */) { 3752 var fns = arguments; 3753 3754 return jQuery.Deferred(function (newDefer) { 3755 jQuery.each(tuples, function (_i, tuple) { 3756 3757 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 3758 var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]]; 3759 3760 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 3761 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 3762 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 3763 deferred[tuple[1]](function () { 3764 var returned = fn && fn.apply(this, arguments); 3765 if (returned && isFunction(returned.promise)) { 3766 returned.promise() 3767 .progress(newDefer.notify) 3768 .done(newDefer.resolve) 3769 .fail(newDefer.reject); 3770 } else { 3771 newDefer[tuple[0] + "With"]( 3772 this, 3773 fn ? [returned] : arguments 3774 ); 3775 } 3776 }); 3777 }); 3778 fns = null; 3779 }).promise(); 3780 }, 3781 then: function (onFulfilled, onRejected, onProgress) { 3782 var maxDepth = 0; 3783 function resolve(depth, deferred, handler, special) { 3784 return function () { 3785 var that = this, 3786 args = arguments, 3787 mightThrow = function () { 3788 var returned, then; 3789 3790 // Support: Promises/A+ section 2.3.3.3.3 3791 // https://promisesaplus.com/#point-59 3792 // Ignore double-resolution attempts 3793 if (depth < maxDepth) { 3794 return; 3795 } 3796 3797 returned = handler.apply(that, args); 3798 3799 // Support: Promises/A+ section 2.3.1 3800 // https://promisesaplus.com/#point-48 3801 if (returned === deferred.promise()) { 3802 throw new TypeError("Thenable self-resolution"); 3803 } 3804 3805 // Support: Promises/A+ sections 2.3.3.1, 3.5 3806 // https://promisesaplus.com/#point-54 3807 // https://promisesaplus.com/#point-75 3808 // Retrieve `then` only once 3809 then = returned && 3810 3811 // Support: Promises/A+ section 2.3.4 3812 // https://promisesaplus.com/#point-64 3813 // Only check objects and functions for thenability 3814 (typeof returned === "object" || 3815 typeof returned === "function") && 3816 returned.then; 3817 3818 // Handle a returned thenable 3819 if (isFunction(then)) { 3820 3821 // Special processors (notify) just wait for resolution 3822 if (special) { 3823 then.call( 3824 returned, 3825 resolve(maxDepth, deferred, Identity, special), 3826 resolve(maxDepth, deferred, Thrower, special) 3827 ); 3828 3829 // Normal processors (resolve) also hook into progress 3830 } else { 3831 3832 // ...and disregard older resolution values 3833 maxDepth++; 3834 3835 then.call( 3836 returned, 3837 resolve(maxDepth, deferred, Identity, special), 3838 resolve(maxDepth, deferred, Thrower, special), 3839 resolve(maxDepth, deferred, Identity, 3840 deferred.notifyWith) 3841 ); 3842 } 3843 3844 // Handle all other returned values 3845 } else { 3846 3847 // Only substitute handlers pass on context 3848 // and multiple values (non-spec behavior) 3849 if (handler !== Identity) { 3850 that = undefined; 3851 args = [returned]; 3852 } 3853 3854 // Process the value(s) 3855 // Default process is resolve 3856 (special || deferred.resolveWith)(that, args); 3857 } 3858 }, 3859 3860 // Only normal processors (resolve) catch and reject exceptions 3861 process = special ? 3862 mightThrow : 3863 function () { 3864 try { 3865 mightThrow(); 3866 } catch (e) { 3867 3868 if (jQuery.Deferred.exceptionHook) { 3869 jQuery.Deferred.exceptionHook(e, 3870 process.stackTrace); 3871 } 3872 3873 // Support: Promises/A+ section 2.3.3.3.4.1 3874 // https://promisesaplus.com/#point-61 3875 // Ignore post-resolution exceptions 3876 if (depth + 1 >= maxDepth) { 3877 3878 // Only substitute handlers pass on context 3879 // and multiple values (non-spec behavior) 3880 if (handler !== Thrower) { 3881 that = undefined; 3882 args = [e]; 3883 } 3884 3885 deferred.rejectWith(that, args); 3886 } 3887 } 3888 }; 3889 3890 // Support: Promises/A+ section 2.3.3.3.1 3891 // https://promisesaplus.com/#point-57 3892 // Re-resolve promises immediately to dodge false rejection from 3893 // subsequent errors 3894 if (depth) { 3895 process(); 3896 } else { 3897 3898 // Call an optional hook to record the stack, in case of exception 3899 // since it's otherwise lost when execution goes async 3900 if (jQuery.Deferred.getStackHook) { 3901 process.stackTrace = jQuery.Deferred.getStackHook(); 3902 } 3903 window.setTimeout(process); 3904 } 3905 }; 3906 } 3907 3908 return jQuery.Deferred(function (newDefer) { 3909 3910 // progress_handlers.add( ... ) 3911 tuples[0][3].add( 3912 resolve( 3913 0, 3914 newDefer, 3915 isFunction(onProgress) ? 3916 onProgress : 3917 Identity, 3918 newDefer.notifyWith 3919 ) 3920 ); 3921 3922 // fulfilled_handlers.add( ... ) 3923 tuples[1][3].add( 3924 resolve( 3925 0, 3926 newDefer, 3927 isFunction(onFulfilled) ? 3928 onFulfilled : 3929 Identity 3930 ) 3931 ); 3932 3933 // rejected_handlers.add( ... ) 3934 tuples[2][3].add( 3935 resolve( 3936 0, 3937 newDefer, 3938 isFunction(onRejected) ? 3939 onRejected : 3940 Thrower 3941 ) 3942 ); 3943 }).promise(); 3944 }, 3945 3946 // Get a promise for this deferred 3947 // If obj is provided, the promise aspect is added to the object 3948 promise: function (obj) { 3949 return obj != null ? jQuery.extend(obj, promise) : promise; 3950 } 3951 }, 3952 deferred = {}; 3953 3954 // Add list-specific methods 3955 jQuery.each(tuples, function (i, tuple) { 3956 var list = tuple[2], 3957 stateString = tuple[5]; 3958 3959 // promise.progress = list.add 3960 // promise.done = list.add 3961 // promise.fail = list.add 3962 promise[tuple[1]] = list.add; 3963 3964 // Handle state 3965 if (stateString) { 3966 list.add( 3967 function () { 3968 3969 // state = "resolved" (i.e., fulfilled) 3970 // state = "rejected" 3971 state = stateString; 3972 }, 3973 3974 // rejected_callbacks.disable 3975 // fulfilled_callbacks.disable 3976 tuples[3 - i][2].disable, 3977 3978 // rejected_handlers.disable 3979 // fulfilled_handlers.disable 3980 tuples[3 - i][3].disable, 3981 3982 // progress_callbacks.lock 3983 tuples[0][2].lock, 3984 3985 // progress_handlers.lock 3986 tuples[0][3].lock 3987 ); 3988 } 3989 3990 // progress_handlers.fire 3991 // fulfilled_handlers.fire 3992 // rejected_handlers.fire 3993 list.add(tuple[3].fire); 3994 3995 // deferred.notify = function() { deferred.notifyWith(...) } 3996 // deferred.resolve = function() { deferred.resolveWith(...) } 3997 // deferred.reject = function() { deferred.rejectWith(...) } 3998 deferred[tuple[0]] = function () { 3999 deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments); 4000 return this; 4001 }; 4002 4003 // deferred.notifyWith = list.fireWith 4004 // deferred.resolveWith = list.fireWith 4005 // deferred.rejectWith = list.fireWith 4006 deferred[tuple[0] + "With"] = list.fireWith; 4007 }); 4008 4009 // Make the deferred a promise 4010 promise.promise(deferred); 4011 4012 // Call given func if any 4013 if (func) { 4014 func.call(deferred, deferred); 4015 } 4016 4017 // All done! 4018 return deferred; 4019 }, 4020 4021 // Deferred helper 4022 when: function (singleValue) { 4023 var 4024 4025 // count of uncompleted subordinates 4026 remaining = arguments.length, 4027 4028 // count of unprocessed arguments 4029 i = remaining, 4030 4031 // subordinate fulfillment data 4032 resolveContexts = Array(i), 4033 resolveValues = slice.call(arguments), 4034 4035 // the master Deferred 4036 master = jQuery.Deferred(), 4037 4038 // subordinate callback factory 4039 updateFunc = function (i) { 4040 return function (value) { 4041 resolveContexts[i] = this; 4042 resolveValues[i] = arguments.length > 1 ? slice.call(arguments) : value; 4043 if (!(--remaining)) { 4044 master.resolveWith(resolveContexts, resolveValues); 4045 } 4046 }; 4047 }; 4048 4049 // Single- and empty arguments are adopted like Promise.resolve 4050 if (remaining <= 1) { 4051 adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject, 4052 !remaining); 4053 4054 // Use .then() to unwrap secondary thenables (cf. gh-3000) 4055 if (master.state() === "pending" || 4056 isFunction(resolveValues[i] && resolveValues[i].then)) { 4057 4058 return master.then(); 4059 } 4060 } 4061 4062 // Multiple arguments are aggregated like Promise.all array elements 4063 while (i--) { 4064 adoptValue(resolveValues[i], updateFunc(i), master.reject); 4065 } 4066 4067 return master.promise(); 4068 } 4069 }); 4070 4071 4072 // These usually indicate a programmer mistake during development, 4073 // warn about them ASAP rather than swallowing them by default. 4074 var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 4075 4076 jQuery.Deferred.exceptionHook = function (error, stack) { 4077 4078 // Support: IE 8 - 9 only 4079 // Console exists when dev tools are open, which can happen at any time 4080 if (window.console && window.console.warn && error && rerrorNames.test(error.name)) { 4081 window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, stack); 4082 } 4083 }; 4084 4085 4086 4087 4088 jQuery.readyException = function (error) { 4089 window.setTimeout(function () { 4090 throw error; 4091 }); 4092 }; 4093 4094 4095 4096 4097 // The deferred used on DOM ready 4098 var readyList = jQuery.Deferred(); 4099 4100 jQuery.fn.ready = function (fn) { 4101 4102 readyList 4103 .then(fn) 4104 4105 // Wrap jQuery.readyException in a function so that the lookup 4106 // happens at the time of error handling instead of callback 4107 // registration. 4108 .catch(function (error) { 4109 jQuery.readyException(error); 4110 }); 4111 4112 return this; 4113 }; 4114 4115 jQuery.extend({ 4116 4117 // Is the DOM ready to be used? Set to true once it occurs. 4118 isReady: false, 4119 4120 // A counter to track how many items to wait for before 4121 // the ready event fires. See #6781 4122 readyWait: 1, 4123 4124 // Handle when the DOM is ready 4125 ready: function (wait) { 4126 4127 // Abort if there are pending holds or we're already ready 4128 if (wait === true ? --jQuery.readyWait : jQuery.isReady) { 4129 return; 4130 } 4131 4132 // Remember that the DOM is ready 4133 jQuery.isReady = true; 4134 4135 // If a normal DOM Ready event fired, decrement, and wait if need be 4136 if (wait !== true && --jQuery.readyWait > 0) { 4137 return; 4138 } 4139 4140 // If there are functions bound, to execute 4141 readyList.resolveWith(document, [jQuery]); 4142 } 4143 }); 4144 4145 jQuery.ready.then = readyList.then; 4146 4147 // The ready event handler and self cleanup method 4148 function completed() { 4149 document.removeEventListener("DOMContentLoaded", completed); 4150 window.removeEventListener("load", completed); 4151 jQuery.ready(); 4152 } 4153 4154 // Catch cases where $(document).ready() is called 4155 // after the browser event has already occurred. 4156 // Support: IE <=9 - 10 only 4157 // Older IE sometimes signals "interactive" too soon 4158 if (document.readyState === "complete" || 4159 (document.readyState !== "loading" && !document.documentElement.doScroll)) { 4160 4161 // Handle it asynchronously to allow scripts the opportunity to delay ready 4162 window.setTimeout(jQuery.ready); 4163 4164 } else { 4165 4166 // Use the handy event callback 4167 document.addEventListener("DOMContentLoaded", completed); 4168 4169 // A fallback to window.onload, that will always work 4170 window.addEventListener("load", completed); 4171 } 4172 4173 4174 4175 4176 // Multifunctional method to get and set values of a collection 4177 // The value/s can optionally be executed if it's a function 4178 var access = function (elems, fn, key, value, chainable, emptyGet, raw) { 4179 var i = 0, 4180 len = elems.length, 4181 bulk = key == null; 4182 4183 // Sets many values 4184 if (toType(key) === "object") { 4185 chainable = true; 4186 for (i in key) { 4187 access(elems, fn, i, key[i], true, emptyGet, raw); 4188 } 4189 4190 // Sets one value 4191 } else if (value !== undefined) { 4192 chainable = true; 4193 4194 if (!isFunction(value)) { 4195 raw = true; 4196 } 4197 4198 if (bulk) { 4199 4200 // Bulk operations run against the entire set 4201 if (raw) { 4202 fn.call(elems, value); 4203 fn = null; 4204 4205 // ...except when executing function values 4206 } else { 4207 bulk = fn; 4208 fn = function (elem, _key, value) { 4209 return bulk.call(jQuery(elem), value); 4210 }; 4211 } 4212 } 4213 4214 if (fn) { 4215 for (; i < len; i++) { 4216 fn( 4217 elems[i], key, raw ? 4218 value : 4219 value.call(elems[i], i, fn(elems[i], key)) 4220 ); 4221 } 4222 } 4223 } 4224 4225 if (chainable) { 4226 return elems; 4227 } 4228 4229 // Gets 4230 if (bulk) { 4231 return fn.call(elems); 4232 } 4233 4234 return len ? fn(elems[0], key) : emptyGet; 4235 }; 4236 4237 4238 // Matches dashed string for camelizing 4239 var rmsPrefix = /^-ms-/, 4240 rdashAlpha = /-([a-z])/g; 4241 4242 // Used by camelCase as callback to replace() 4243 function fcamelCase(_all, letter) { 4244 return letter.toUpperCase(); 4245 } 4246 4247 // Convert dashed to camelCase; used by the css and data modules 4248 // Support: IE <=9 - 11, Edge 12 - 15 4249 // Microsoft forgot to hump their vendor prefix (#9572) 4250 function camelCase(string) { 4251 return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase); 4252 } 4253 var acceptData = function (owner) { 4254 4255 // Accepts only: 4256 // - Node 4257 // - Node.ELEMENT_NODE 4258 // - Node.DOCUMENT_NODE 4259 // - Object 4260 // - Any 4261 return owner.nodeType === 1 || owner.nodeType === 9 || !(+owner.nodeType); 4262 }; 4263 4264 4265 4266 4267 function Data() { 4268 this.expando = jQuery.expando + Data.uid++; 4269 } 4270 4271 Data.uid = 1; 4272 4273 Data.prototype = { 4274 4275 cache: function (owner) { 4276 4277 // Check if the owner object already has a cache 4278 var value = owner[this.expando]; 4279 4280 // If not, create one 4281 if (!value) { 4282 value = {}; 4283 4284 // We can accept data for non-element nodes in modern browsers, 4285 // but we should not, see #8335. 4286 // Always return an empty object. 4287 if (acceptData(owner)) { 4288 4289 // If it is a node unlikely to be stringify-ed or looped over 4290 // use plain assignment 4291 if (owner.nodeType) { 4292 owner[this.expando] = value; 4293 4294 // Otherwise secure it in a non-enumerable property 4295 // configurable must be true to allow the property to be 4296 // deleted when data is removed 4297 } else { 4298 Object.defineProperty(owner, this.expando, { 4299 value: value, 4300 configurable: true 4301 });
vendor: 5,631 bytes, lines 4302-4522
4302 } 4303 } 4304 } 4305 4306 return value; 4307 }, 4308 set: function (owner, data, value) { 4309 var prop, 4310 cache = this.cache(owner); 4311 4312 // Handle: [ owner, key, value ] args 4313 // Always use camelCase key (gh-2257) 4314 if (typeof data === "string") { 4315 cache[camelCase(data)] = value; 4316 4317 // Handle: [ owner, { properties } ] args 4318 } else { 4319 4320 // Copy the properties one-by-one to the cache object 4321 for (prop in data) { 4322 cache[camelCase(prop)] = data[prop]; 4323 } 4324 } 4325 return cache; 4326 }, 4327 get: function (owner, key) { 4328 return key === undefined ? 4329 this.cache(owner) : 4330 4331 // Always use camelCase key (gh-2257) 4332 owner[this.expando] && owner[this.expando][camelCase(key)]; 4333 }, 4334 access: function (owner, key, value) { 4335 4336 // In cases where either: 4337 // 4338 // 1. No key was specified 4339 // 2. A string key was specified, but no value provided 4340 // 4341 // Take the "read" path and allow the get method to determine 4342 // which value to return, respectively either: 4343 // 4344 // 1. The entire cache object 4345 // 2. The data stored at the key 4346 // 4347 if (key === undefined || 4348 ((key && typeof key === "string") && value === undefined)) { 4349 4350 return this.get(owner, key); 4351 } 4352 4353 // When the key is not a string, or both a key and value 4354 // are specified, set or extend (existing objects) with either: 4355 // 4356 // 1. An object of properties 4357 // 2. A key and value 4358 // 4359 this.set(owner, key, value); 4360 4361 // Since the "set" path can have two possible entry points 4362 // return the expected data based on which path was taken[*] 4363 return value !== undefined ? value : key; 4364 }, 4365 remove: function (owner, key) { 4366 var i, 4367 cache = owner[this.expando]; 4368 4369 if (cache === undefined) { 4370 return; 4371 } 4372 4373 if (key !== undefined) { 4374 4375 // Support array or space separated string of keys 4376 if (Array.isArray(key)) { 4377 4378 // If key is an array of keys... 4379 // We always set camelCase keys, so remove that. 4380 key = key.map(camelCase); 4381 } else { 4382 key = camelCase(key); 4383 4384 // If a key with the spaces exists, use it. 4385 // Otherwise, create an array by matching non-whitespace 4386 key = key in cache ? 4387 [key] : 4388 (key.match(rnothtmlwhite) || []); 4389 } 4390 4391 i = key.length; 4392 4393 while (i--) { 4394 delete cache[key[i]]; 4395 } 4396 } 4397 4398 // Remove the expando if there's no more data 4399 if (key === undefined || jQuery.isEmptyObject(cache)) { 4400 4401 // Support: Chrome <=35 - 45 4402 // Webkit & Blink performance suffers when deleting properties 4403 // from DOM nodes, so set to undefined instead 4404 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 4405 if (owner.nodeType) { 4406 owner[this.expando] = undefined; 4407 } else { 4408 delete owner[this.expando]; 4409 } 4410 } 4411 }, 4412 hasData: function (owner) { 4413 var cache = owner[this.expando]; 4414 return cache !== undefined && !jQuery.isEmptyObject(cache); 4415 } 4416 }; 4417 var dataPriv = new Data(); 4418 4419 var dataUser = new Data(); 4420 4421 4422 4423 // Implementation Summary 4424 // 4425 // 1. Enforce API surface and semantic compatibility with 1.9.x branch 4426 // 2. Improve the module's maintainability by reducing the storage 4427 // paths to a single mechanism. 4428 // 3. Use the same single mechanism to support "private" and "user" data. 4429 // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 4430 // 5. Avoid exposing implementation details on user objects (eg. expando properties) 4431 // 6. Provide a clear path for implementation upgrade to WeakMap in 2014 4432 4433 var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 4434 rmultiDash = /[A-Z]/g; 4435 4436 function getData(data) { 4437 if (data === "true") { 4438 return true; 4439 } 4440 4441 if (data === "false") { 4442 return false; 4443 } 4444 4445 if (data === "null") { 4446 return null; 4447 } 4448 4449 // Only convert to a number if it doesn't change the string 4450 if (data === +data + "") { 4451 return +data; 4452 } 4453 4454 if (rbrace.test(data)) { 4455 return JSON.parse(data); 4456 } 4457 4458 return data; 4459 } 4460 4461 function dataAttr(elem, key, data) { 4462 var name; 4463 4464 // If nothing was found internally, try to fetch any 4465 // data from the HTML5 data-* attribute 4466 if (data === undefined && elem.nodeType === 1) { 4467 name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase(); 4468 data = elem.getAttribute(name); 4469 4470 if (typeof data === "string") { 4471 try { 4472 data = getData(data); 4473 } catch (e) { } 4474 4475 // Make sure we set the data so it isn't changed later 4476 dataUser.set(elem, key, data); 4477 } else { 4478 data = undefined; 4479 } 4480 } 4481 return data; 4482 } 4483 4484 jQuery.extend({ 4485 hasData: function (elem) { 4486 return dataUser.hasData(elem) || dataPriv.hasData(elem); 4487 }, 4488 4489 data: function (elem, name, data) { 4490 return dataUser.access(elem, name, data); 4491 }, 4492 4493 removeData: function (elem, name) { 4494 dataUser.remove(elem, name); 4495 }, 4496 4497 // TODO: Now that all calls to _data and _removeData have been replaced 4498 // with direct calls to dataPriv methods, these can be deprecated. 4499 _data: function (elem, name, data) { 4500 return dataPriv.access(elem, name, data); 4501 }, 4502 4503 _removeData: function (elem, name) { 4504 dataPriv.remove(elem, name); 4505 } 4506 }); 4507 4508 jQuery.fn.extend({ 4509 data: function (key, value) { 4510 var i, name, data, 4511 elem = this[0], 4512 attrs = elem && elem.attributes; 4513 4514 // Gets all values 4515 if (key === undefined) { 4516 if (this.length) { 4517 data = dataUser.get(elem); 4518 4519 if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) { 4520 i = attrs.length; 4521 while (i--) { 4522
vendor: 22,159 bytes, lines 4523-5353
4523 // Support: IE 11 only 4524 // The attrs elements can be null (#14894) 4525 if (attrs[i]) { 4526 name = attrs[i].name; 4527 if (name.indexOf("data-") === 0) { 4528 name = camelCase(name.slice(5)); 4529 dataAttr(elem, name, data[name]); 4530 } 4531 } 4532 } 4533 dataPriv.set(elem, "hasDataAttrs", true); 4534 } 4535 } 4536 4537 return data; 4538 } 4539 4540 // Sets multiple values 4541 if (typeof key === "object") { 4542 return this.each(function () { 4543 dataUser.set(this, key); 4544 }); 4545 } 4546 4547 return access(this, function (value) { 4548 var data; 4549 4550 // The calling jQuery object (element matches) is not empty 4551 // (and therefore has an element appears at this[ 0 ]) and the 4552 // `value` parameter was not undefined. An empty jQuery object 4553 // will result in `undefined` for elem = this[ 0 ] which will 4554 // throw an exception if an attempt to read a data cache is made. 4555 if (elem && value === undefined) { 4556 4557 // Attempt to get data from the cache 4558 // The key will always be camelCased in Data 4559 data = dataUser.get(elem, key); 4560 if (data !== undefined) { 4561 return data; 4562 } 4563 4564 // Attempt to "discover" the data in 4565 // HTML5 custom data-* attrs 4566 data = dataAttr(elem, key); 4567 if (data !== undefined) { 4568 return data; 4569 } 4570 4571 // We tried really hard, but the data doesn't exist. 4572 return; 4573 } 4574 4575 // Set the data... 4576 this.each(function () { 4577 4578 // We always store the camelCased key 4579 dataUser.set(this, key, value); 4580 }); 4581 }, null, value, arguments.length > 1, null, true); 4582 }, 4583 4584 removeData: function (key) { 4585 return this.each(function () { 4586 dataUser.remove(this, key); 4587 }); 4588 } 4589 }); 4590 4591 4592 jQuery.extend({ 4593 queue: function (elem, type, data) { 4594 var queue; 4595 4596 if (elem) { 4597 type = (type || "fx") + "queue"; 4598 queue = dataPriv.get(elem, type); 4599 4600 // Speed up dequeue by getting out quickly if this is just a lookup 4601 if (data) { 4602 if (!queue || Array.isArray(data)) { 4603 queue = dataPriv.access(elem, type, jQuery.makeArray(data)); 4604 } else { 4605 queue.push(data); 4606 } 4607 } 4608 return queue || []; 4609 } 4610 }, 4611 4612 dequeue: function (elem, type) { 4613 type = type || "fx"; 4614 4615 var queue = jQuery.queue(elem, type), 4616 startLength = queue.length, 4617 fn = queue.shift(), 4618 hooks = jQuery._queueHooks(elem, type), 4619 next = function () { 4620 jQuery.dequeue(elem, type); 4621 }; 4622 4623 // If the fx queue is dequeued, always remove the progress sentinel 4624 if (fn === "inprogress") { 4625 fn = queue.shift(); 4626 startLength--; 4627 } 4628 4629 if (fn) { 4630 4631 // Add a progress sentinel to prevent the fx queue from being 4632 // automatically dequeued 4633 if (type === "fx") { 4634 queue.unshift("inprogress"); 4635 } 4636 4637 // Clear up the last queue stop function 4638 delete hooks.stop; 4639 fn.call(elem, next, hooks); 4640 } 4641 4642 if (!startLength && hooks) { 4643 hooks.empty.fire(); 4644 } 4645 }, 4646 4647 // Not public - generate a queueHooks object, or return the current one 4648 _queueHooks: function (elem, type) { 4649 var key = type + "queueHooks"; 4650 return dataPriv.get(elem, key) || dataPriv.access(elem, key, { 4651 empty: jQuery.Callbacks("once memory").add(function () { 4652 dataPriv.remove(elem, [type + "queue", key]); 4653 }) 4654 }); 4655 } 4656 }); 4657 4658 jQuery.fn.extend({ 4659 queue: function (type, data) { 4660 var setter = 2; 4661 4662 if (typeof type !== "string") { 4663 data = type; 4664 type = "fx"; 4665 setter--; 4666 } 4667 4668 if (arguments.length < setter) { 4669 return jQuery.queue(this[0], type); 4670 } 4671 4672 return data === undefined ? 4673 this : 4674 this.each(function () { 4675 var queue = jQuery.queue(this, type, data); 4676 4677 // Ensure a hooks for this queue 4678 jQuery._queueHooks(this, type); 4679 4680 if (type === "fx" && queue[0] !== "inprogress") { 4681 jQuery.dequeue(this, type); 4682 } 4683 }); 4684 }, 4685 dequeue: function (type) { 4686 return this.each(function () { 4687 jQuery.dequeue(this, type); 4688 }); 4689 }, 4690 clearQueue: function (type) { 4691 return this.queue(type || "fx", []); 4692 }, 4693 4694 // Get a promise resolved when queues of a certain type 4695 // are emptied (fx is the type by default) 4696 promise: function (type, obj) { 4697 var tmp, 4698 count = 1, 4699 defer = jQuery.Deferred(), 4700 elements = this, 4701 i = this.length, 4702 resolve = function () { 4703 if (!(--count)) { 4704 defer.resolveWith(elements, [elements]); 4705 } 4706 }; 4707 4708 if (typeof type !== "string") { 4709 obj = type; 4710 type = undefined; 4711 } 4712 type = type || "fx"; 4713 4714 while (i--) { 4715 tmp = dataPriv.get(elements[i], type + "queueHooks"); 4716 if (tmp && tmp.empty) { 4717 count++; 4718 tmp.empty.add(resolve); 4719 } 4720 } 4721 resolve(); 4722 return defer.promise(obj); 4723 } 4724 }); 4725 var pnum = (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source; 4726 4727 var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i"); 4728 4729 4730 var cssExpand = ["Top", "Right", "Bottom", "Left"]; 4731 4732 var documentElement = document.documentElement; 4733 4734 4735 4736 var isAttached = function (elem) { 4737 return jQuery.contains(elem.ownerDocument, elem); 4738 }, 4739 composed = { composed: true }; 4740 4741 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only 4742 // Check attachment across shadow DOM boundaries when possible (gh-3504) 4743 // Support: iOS 10.0-10.2 only 4744 // Early iOS 10 versions support `attachShadow` but not `getRootNode`, 4745 // leading to errors. We need to check for `getRootNode`. 4746 if (documentElement.getRootNode) { 4747 isAttached = function (elem) { 4748 return jQuery.contains(elem.ownerDocument, elem) || 4749 elem.getRootNode(composed) === elem.ownerDocument; 4750 }; 4751 } 4752 var isHiddenWithinTree = function (elem, el) { 4753 4754 // isHiddenWithinTree might be called from jQuery#filter function; 4755 // in that case, element will be second argument 4756 elem = el || elem; 4757 4758 // Inline style trumps all 4759 return elem.style.display === "none" || 4760 elem.style.display === "" && 4761 4762 // Otherwise, check computed style 4763 // Support: Firefox <=43 - 45 4764 // Disconnected elements can have computed display: none, so first confirm that elem is 4765 // in the document. 4766 isAttached(elem) && 4767 4768 jQuery.css(elem, "display") === "none"; 4769 }; 4770 4771 4772 4773 function adjustCSS(elem, prop, valueParts, tween) { 4774 var adjusted, scale, 4775 maxIterations = 20, 4776 currentValue = tween ? 4777 function () { 4778 return tween.cur(); 4779 } : 4780 function () { 4781 return jQuery.css(elem, prop, ""); 4782 }, 4783 initial = currentValue(), 4784 unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"), 4785 4786 // Starting value computation is required for potential unit mismatches 4787 initialInUnit = elem.nodeType && 4788 (jQuery.cssNumber[prop] || unit !== "px" && +initial) && 4789 rcssNum.exec(jQuery.css(elem, prop)); 4790 4791 if (initialInUnit && initialInUnit[3] !== unit) { 4792 4793 // Support: Firefox <=54 4794 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 4795 initial = initial / 2; 4796 4797 // Trust units reported by jQuery.css 4798 unit = unit || initialInUnit[3]; 4799 4800 // Iteratively approximate from a nonzero starting point 4801 initialInUnit = +initial || 1; 4802 4803 while (maxIterations--) { 4804 4805 // Evaluate and update our best guess (doubling guesses that zero out). 4806 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 4807 jQuery.style(elem, prop, initialInUnit + unit); 4808 if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) { 4809 maxIterations = 0; 4810 } 4811 initialInUnit = initialInUnit / scale; 4812 4813 } 4814 4815 initialInUnit = initialInUnit * 2; 4816 jQuery.style(elem, prop, initialInUnit + unit); 4817 4818 // Make sure we update the tween properties later on 4819 valueParts = valueParts || []; 4820 } 4821 4822 if (valueParts) { 4823 initialInUnit = +initialInUnit || +initial || 0; 4824 4825 // Apply relative offset (+=/-=) if specified 4826 adjusted = valueParts[1] ? 4827 initialInUnit + (valueParts[1] + 1) * valueParts[2] : 4828 +valueParts[2]; 4829 if (tween) { 4830 tween.unit = unit; 4831 tween.start = initialInUnit; 4832 tween.end = adjusted; 4833 } 4834 } 4835 return adjusted; 4836 } 4837 4838 4839 var defaultDisplayMap = {}; 4840 4841 function getDefaultDisplay(elem) { 4842 var temp, 4843 doc = elem.ownerDocument, 4844 nodeName = elem.nodeName, 4845 display = defaultDisplayMap[nodeName]; 4846 4847 if (display) { 4848 return display; 4849 } 4850 4851 temp = doc.body.appendChild(doc.createElement(nodeName)); 4852 display = jQuery.css(temp, "display"); 4853 4854 temp.parentNode.removeChild(temp); 4855 4856 if (display === "none") { 4857 display = "block"; 4858 } 4859 defaultDisplayMap[nodeName] = display; 4860 4861 return display; 4862 } 4863 4864 function showHide(elements, show) { 4865 var display, elem, 4866 values = [], 4867 index = 0, 4868 length = elements.length; 4869 4870 // Determine new display value for elements that need to change 4871 for (; index < length; index++) { 4872 elem = elements[index]; 4873 if (!elem.style) { 4874 continue; 4875 } 4876 4877 display = elem.style.display; 4878 if (show) { 4879 4880 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 4881 // check is required in this first loop unless we have a nonempty display value (either 4882 // inline or about-to-be-restored) 4883 if (display === "none") { 4884 values[index] = dataPriv.get(elem, "display") || null; 4885 if (!values[index]) { 4886 elem.style.display = ""; 4887 } 4888 } 4889 if (elem.style.display === "" && isHiddenWithinTree(elem)) { 4890 values[index] = getDefaultDisplay(elem); 4891 } 4892 } else { 4893 if (display !== "none") { 4894 values[index] = "none"; 4895 4896 // Remember what we're overwriting 4897 dataPriv.set(elem, "display", display); 4898 } 4899 } 4900 } 4901 4902 // Set the display of the elements in a second loop to avoid constant reflow 4903 for (index = 0; index < length; index++) { 4904 if (values[index] != null) { 4905 elements[index].style.display = values[index]; 4906 } 4907 } 4908 4909 return elements; 4910 } 4911 4912 jQuery.fn.extend({ 4913 show: function () { 4914 return showHide(this, true); 4915 }, 4916 hide: function () { 4917 return showHide(this); 4918 }, 4919 toggle: function (state) { 4920 if (typeof state === "boolean") { 4921 return state ? this.show() : this.hide(); 4922 } 4923 4924 return this.each(function () { 4925 if (isHiddenWithinTree(this)) { 4926 jQuery(this).show(); 4927 } else { 4928 jQuery(this).hide(); 4929 } 4930 }); 4931 } 4932 }); 4933 var rcheckableType = (/^(?:checkbox|radio)$/i); 4934 4935 var rtagName = (/<([a-z][^\/\0>\x20\t\r\n\f]*)/i); 4936 4937 var rscriptType = (/^$|^module$|\/(?:java|ecma)script/i); 4938 4939 4940 4941 (function () { 4942 var fragment = document.createDocumentFragment(), 4943 div = fragment.appendChild(document.createElement("div")), 4944 input = document.createElement("input"); 4945 4946 // Support: Android 4.0 - 4.3 only 4947 // Check state lost if the name is set (#11217) 4948 // Support: Windows Web Apps (WWA) 4949 // `name` and `type` must use .setAttribute for WWA (#14901) 4950 input.setAttribute("type", "radio"); 4951 input.setAttribute("checked", "checked"); 4952 input.setAttribute("name", "t"); 4953 4954 div.appendChild(input); 4955 4956 // Support: Android <=4.1 only 4957 // Older WebKit doesn't clone checked state correctly in fragments 4958 support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked; 4959 4960 // Support: IE <=11 only 4961 // Make sure textarea (and checkbox) defaultValue is properly cloned 4962 div.innerHTML = "<textarea>x</textarea>"; 4963 support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue; 4964 4965 // Support: IE <=9 only 4966 // IE <=9 replaces <option> tags with their contents when inserted outside of 4967 // the select element. 4968 div.innerHTML = "<option></option>"; 4969 support.option = !!div.lastChild; 4970 })(); 4971 4972 4973 // We have to close these tags to support XHTML (#13200) 4974 var wrapMap = { 4975 4976 // XHTML parsers do not magically insert elements in the 4977 // same way that tag soup parsers do. So we cannot shorten 4978 // this by omitting <tbody> or other required elements. 4979 thead: [1, "<table>", "</table>"], 4980 col: [2, "<table><colgroup>", "</colgroup></table>"], 4981 tr: [2, "<table><tbody>", "</tbody></table>"], 4982 td: [3, "<table><tbody><tr>", "</tr></tbody></table>"], 4983 4984 _default: [0, "", ""] 4985 }; 4986 4987 wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 4988 wrapMap.th = wrapMap.td; 4989 4990 // Support: IE <=9 only 4991 if (!support.option) { 4992 wrapMap.optgroup = wrapMap.option = [1, "<select multiple='multiple'>", "</select>"]; 4993 } 4994 4995 4996 function getAll(context, tag) { 4997 4998 // Support: IE <=9 - 11 only 4999 // Use typeof to avoid zero-argument method invocation on host objects (#15151) 5000 var ret; 5001 5002 if (typeof context.getElementsByTagName !== "undefined") { 5003 ret = context.getElementsByTagName(tag || "*"); 5004 5005 } else if (typeof context.querySelectorAll !== "undefined") { 5006 ret = context.querySelectorAll(tag || "*"); 5007 5008 } else { 5009 ret = []; 5010 } 5011 5012 if (tag === undefined || tag && nodeName(context, tag)) { 5013 return jQuery.merge([context], ret); 5014 } 5015 5016 return ret; 5017 } 5018 5019 5020 // Mark scripts as having already been evaluated 5021 function setGlobalEval(elems, refElements) { 5022 var i = 0, 5023 l = elems.length; 5024 5025 for (; i < l; i++) { 5026 dataPriv.set( 5027 elems[i], 5028 "globalEval", 5029 !refElements || dataPriv.get(refElements[i], "globalEval") 5030 ); 5031 } 5032 } 5033 5034 5035 var rhtml = /<|&#?\w+;/; 5036 5037 function buildFragment(elems, context, scripts, selection, ignored) { 5038 var elem, tmp, tag, wrap, attached, j, 5039 fragment = context.createDocumentFragment(), 5040 nodes = [], 5041 i = 0, 5042 l = elems.length; 5043 5044 for (; i < l; i++) { 5045 elem = elems[i]; 5046 5047 if (elem || elem === 0) { 5048 5049 // Add nodes directly 5050 if (toType(elem) === "object") { 5051 5052 // Support: Android <=4.0 only, PhantomJS 1 only 5053 // push.apply(_, arraylike) throws on ancient WebKit 5054 jQuery.merge(nodes, elem.nodeType ? [elem] : elem); 5055 5056 // Convert non-html into a text node 5057 } else if (!rhtml.test(elem)) { 5058 nodes.push(context.createTextNode(elem)); 5059 5060 // Convert html into DOM nodes 5061 } else { 5062 tmp = tmp || fragment.appendChild(context.createElement("div")); 5063 5064 // Deserialize a standard representation 5065 tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase(); 5066 wrap = wrapMap[tag] || wrapMap._default; 5067 tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2]; 5068 5069 // Descend through wrappers to the right content 5070 j = wrap[0]; 5071 while (j--) { 5072 tmp = tmp.lastChild; 5073 } 5074 5075 // Support: Android <=4.0 only, PhantomJS 1 only 5076 // push.apply(_, arraylike) throws on ancient WebKit 5077 jQuery.merge(nodes, tmp.childNodes); 5078 5079 // Remember the top-level container 5080 tmp = fragment.firstChild; 5081 5082 // Ensure the created nodes are orphaned (#12392) 5083 tmp.textContent = ""; 5084 } 5085 } 5086 } 5087 5088 // Remove wrapper from fragment 5089 fragment.textContent = ""; 5090 5091 i = 0; 5092 while ((elem = nodes[i++])) { 5093 5094 // Skip elements already in the context collection (trac-4087) 5095 if (selection && jQuery.inArray(elem, selection) > -1) { 5096 if (ignored) { 5097 ignored.push(elem); 5098 } 5099 continue; 5100 } 5101 5102 attached = isAttached(elem); 5103 5104 // Append to fragment 5105 tmp = getAll(fragment.appendChild(elem), "script"); 5106 5107 // Preserve script evaluation history 5108 if (attached) { 5109 setGlobalEval(tmp); 5110 } 5111 5112 // Capture executables 5113 if (scripts) { 5114 j = 0; 5115 while ((elem = tmp[j++])) { 5116 if (rscriptType.test(elem.type || "")) { 5117 scripts.push(elem); 5118 } 5119 } 5120 } 5121 } 5122 5123 return fragment; 5124 } 5125 5126 5127 var 5128 rkeyEvent = /^key/, 5129 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, 5130 rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 5131 5132 function returnTrue() { 5133 return true; 5134 } 5135 5136 function returnFalse() { 5137 return false; 5138 } 5139 5140 // Support: IE <=9 - 11+ 5141 // focus() and blur() are asynchronous, except when they are no-op. 5142 // So expect focus to be synchronous when the element is already active, 5143 // and blur to be synchronous when the element is not already active. 5144 // (focus and blur are always synchronous in other supported browsers, 5145 // this just defines when we can count on it). 5146 function expectSync(elem, type) { 5147 return (elem === safeActiveElement()) === (type === "focus"); 5148 } 5149 5150 // Support: IE <=9 only 5151 // Accessing document.activeElement can throw unexpectedly 5152 // https://bugs.jquery.com/ticket/13393 5153 function safeActiveElement() { 5154 try { 5155 return document.activeElement; 5156 } catch (err) { } 5157 } 5158 5159 function on(elem, types, selector, data, fn, one) { 5160 var origFn, type; 5161 5162 // Types can be a map of types/handlers 5163 if (typeof types === "object") { 5164 5165 // ( types-Object, selector, data ) 5166 if (typeof selector !== "string") { 5167 5168 // ( types-Object, data ) 5169 data = data || selector; 5170 selector = undefined; 5171 } 5172 for (type in types) { 5173 on(elem, type, selector, data, types[type], one); 5174 } 5175 return elem; 5176 } 5177 5178 if (data == null && fn == null) { 5179 5180 // ( types, fn ) 5181 fn = selector; 5182 data = selector = undefined; 5183 } else if (fn == null) { 5184 if (typeof selector === "string") { 5185 5186 // ( types, selector, fn ) 5187 fn = data; 5188 data = undefined; 5189 } else { 5190 5191 // ( types, data, fn ) 5192 fn = data; 5193 data = selector; 5194 selector = undefined; 5195 } 5196 } 5197 if (fn === false) { 5198 fn = returnFalse; 5199 } else if (!fn) { 5200 return elem; 5201 } 5202 5203 if (one === 1) { 5204 origFn = fn; 5205 fn = function (event) { 5206 5207 // Can use an empty set, since event contains the info 5208 jQuery().off(event); 5209 return origFn.apply(this, arguments); 5210 }; 5211 5212 // Use same guid so caller can remove using origFn 5213 fn.guid = origFn.guid || (origFn.guid = jQuery.guid++); 5214 } 5215 return elem.each(function () { 5216 jQuery.event.add(this, types, fn, data, selector); 5217 }); 5218 } 5219 5220 /* 5221 * Helper functions for managing events -- not part of the public interface. 5222 * Props to Dean Edwards' addEvent library for many of the ideas. 5223 */ 5224 jQuery.event = { 5225 5226 global: {}, 5227 5228 add: function (elem, types, handler, data, selector) { 5229 5230 var handleObjIn, eventHandle, tmp, 5231 events, t, handleObj, 5232 special, handlers, type, namespaces, origType, 5233 elemData = dataPriv.get(elem); 5234 5235 // Only attach events to objects that accept data 5236 if (!acceptData(elem)) { 5237 return; 5238 } 5239 5240 // Caller can pass in an object of custom data in lieu of the handler 5241 if (handler.handler) { 5242 handleObjIn = handler; 5243 handler = handleObjIn.handler; 5244 selector = handleObjIn.selector; 5245 } 5246 5247 // Ensure that invalid selectors throw exceptions at attach time 5248 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 5249 if (selector) { 5250 jQuery.find.matchesSelector(documentElement, selector); 5251 } 5252 5253 // Make sure that the handler has a unique ID, used to find/remove it later 5254 if (!handler.guid) { 5255 handler.guid = jQuery.guid++; 5256 } 5257 5258 // Init the element's event structure and main handler, if this is the first 5259 if (!(events = elemData.events)) { 5260 events = elemData.events = Object.create(null); 5261 } 5262 if (!(eventHandle = elemData.handle)) { 5263 eventHandle = elemData.handle = function (e) { 5264 5265 // Discard the second event of a jQuery.event.trigger() and 5266 // when an event is called after a page has unloaded 5267 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 5268 jQuery.event.dispatch.apply(elem, arguments) : undefined; 5269 }; 5270 } 5271 5272 // Handle multiple events separated by a space 5273 types = (types || "").match(rnothtmlwhite) || [""]; 5274 t = types.length; 5275 while (t--) { 5276 tmp = rtypenamespace.exec(types[t]) || []; 5277 type = origType = tmp[1]; 5278 namespaces = (tmp[2] || "").split(".").sort(); 5279 5280 // There *must* be a type, no attaching namespace-only handlers 5281 if (!type) { 5282 continue; 5283 } 5284 5285 // If event changes its type, use the special event handlers for the changed type 5286 special = jQuery.event.special[type] || {}; 5287 5288 // If selector defined, determine special event api type, otherwise given type 5289 type = (selector ? special.delegateType : special.bindType) || type; 5290 5291 // Update special based on newly reset type 5292 special = jQuery.event.special[type] || {}; 5293 5294 // handleObj is passed to all event handlers 5295 handleObj = jQuery.extend({ 5296 type: type, 5297 origType: origType, 5298 data: data, 5299 handler: handler, 5300 guid: handler.guid, 5301 selector: selector, 5302 needsContext: selector && jQuery.expr.match.needsContext.test(selector), 5303 namespace: namespaces.join(".") 5304 }, handleObjIn); 5305 5306 // Init the event handler queue if we're the first 5307 if (!(handlers = events[type])) { 5308 handlers = events[type] = []; 5309 handlers.delegateCount = 0; 5310 5311 // Only use addEventListener if the special events handler returns false 5312 if (!special.setup || 5313 special.setup.call(elem, data, namespaces, eventHandle) === false) { 5314 5315 if (elem.addEventListener) { 5316 elem.addEventListener(type, eventHandle); 5317 } 5318 } 5319 } 5320 5321 if (special.add) { 5322 special.add.call(elem, handleObj); 5323 5324 if (!handleObj.handler.guid) { 5325 handleObj.handler.guid = handler.guid; 5326 } 5327 } 5328 5329 // Add to the element's handler list, delegates in front 5330 if (selector) { 5331 handlers.splice(handlers.delegateCount++, 0, handleObj); 5332 } else { 5333 handlers.push(handleObj); 5334 } 5335 5336 // Keep track of which events have ever been used, for event optimization 5337 jQuery.event.global[type] = true; 5338 } 5339 5340 }, 5341 5342 // Detach an event or set of events from an element 5343 remove: function (elem, types, handler, selector, mappedTypes) { 5344 5345 var j, origCount, tmp, 5346 events, t, handleObj, 5347 special, handlers, type, namespaces, origType, 5348 elemData = dataPriv.hasData(elem) && dataPriv.get(elem); 5349 5350 if (!elemData || !(events = elemData.events)) { 5351 return; 5352 } 5353
vendor: 4,303 bytes, lines 5354-5492
5354 // Once for each type.namespace in types; type may be omitted 5355 types = (types || "").match(rnothtmlwhite) || [""]; 5356 t = types.length; 5357 while (t--) { 5358 tmp = rtypenamespace.exec(types[t]) || []; 5359 type = origType = tmp[1]; 5360 namespaces = (tmp[2] || "").split(".").sort(); 5361 5362 // Unbind all events (on this namespace, if provided) for the element 5363 if (!type) { 5364 for (type in events) { 5365 jQuery.event.remove(elem, type + types[t], handler, selector, true); 5366 } 5367 continue; 5368 } 5369 5370 special = jQuery.event.special[type] || {}; 5371 type = (selector ? special.delegateType : special.bindType) || type; 5372 handlers = events[type] || []; 5373 tmp = tmp[2] && 5374 new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)"); 5375 5376 // Remove matching events 5377 origCount = j = handlers.length; 5378 while (j--) { 5379 handleObj = handlers[j]; 5380 5381 if ((mappedTypes || origType === handleObj.origType) && 5382 (!handler || handler.guid === handleObj.guid) && 5383 (!tmp || tmp.test(handleObj.namespace)) && 5384 (!selector || selector === handleObj.selector || 5385 selector === "**" && handleObj.selector)) { 5386 handlers.splice(j, 1); 5387 5388 if (handleObj.selector) { 5389 handlers.delegateCount--; 5390 } 5391 if (special.remove) { 5392 special.remove.call(elem, handleObj); 5393 } 5394 } 5395 } 5396 5397 // Remove generic event handler if we removed something and no more handlers exist 5398 // (avoids potential for endless recursion during removal of special event handlers) 5399 if (origCount && !handlers.length) { 5400 if (!special.teardown || 5401 special.teardown.call(elem, namespaces, elemData.handle) === false) { 5402 5403 jQuery.removeEvent(elem, type, elemData.handle); 5404 } 5405 5406 delete events[type]; 5407 } 5408 } 5409 5410 // Remove data and the expando if it's no longer used 5411 if (jQuery.isEmptyObject(events)) { 5412 dataPriv.remove(elem, "handle events"); 5413 } 5414 }, 5415 5416 dispatch: function (nativeEvent) { 5417 5418 var i, j, ret, matched, handleObj, handlerQueue, 5419 args = new Array(arguments.length), 5420 5421 // Make a writable jQuery.Event from the native event object 5422 event = jQuery.event.fix(nativeEvent), 5423 5424 handlers = ( 5425 dataPriv.get(this, "events") || Object.create(null) 5426 )[event.type] || [], 5427 special = jQuery.event.special[event.type] || {}; 5428 5429 // Use the fix-ed jQuery.Event rather than the (read-only) native event 5430 args[0] = event; 5431 5432 for (i = 1; i < arguments.length; i++) { 5433 args[i] = arguments[i]; 5434 } 5435 5436 event.delegateTarget = this; 5437 5438 // Call the preDispatch hook for the mapped type, and let it bail if desired 5439 if (special.preDispatch && special.preDispatch.call(this, event) === false) { 5440 return; 5441 } 5442 5443 // Determine handlers 5444 handlerQueue = jQuery.event.handlers.call(this, event, handlers); 5445 5446 // Run delegates first; they may want to stop propagation beneath us 5447 i = 0; 5448 while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) { 5449 event.currentTarget = matched.elem; 5450 5451 j = 0; 5452 while ((handleObj = matched.handlers[j++]) && 5453 !event.isImmediatePropagationStopped()) { 5454 5455 // If the event is namespaced, then each handler is only invoked if it is 5456 // specially universal or its namespaces are a superset of the event's. 5457 if (!event.rnamespace || handleObj.namespace === false || 5458 event.rnamespace.test(handleObj.namespace)) { 5459 5460 event.handleObj = handleObj; 5461 event.data = handleObj.data; 5462 5463 ret = ((jQuery.event.special[handleObj.origType] || {}).handle || 5464 handleObj.handler).apply(matched.elem, args); 5465 5466 if (ret !== undefined) { 5467 if ((event.result = ret) === false) { 5468 event.preventDefault(); 5469 event.stopPropagation(); 5470 } 5471 } 5472 } 5473 } 5474 } 5475 5476 // Call the postDispatch hook for the mapped type 5477 if (special.postDispatch) { 5478 special.postDispatch.call(this, event); 5479 } 5480 5481 return event.result; 5482 }, 5483 5484 handlers: function (event, handlers) { 5485 var i, handleObj, sel, matchedHandlers, matchedSelectors, 5486 handlerQueue = [], 5487 delegateCount = handlers.delegateCount, 5488 cur = event.target; 5489 5490 // Find delegate handlers 5491 if (delegateCount && 5492
vendor: 4,182 bytes, lines 5493-5632
5493 // Support: IE <=9 5494 // Black-hole SVG <use> instance trees (trac-13180) 5495 cur.nodeType && 5496 5497 // Support: Firefox <=42 5498 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 5499 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 5500 // Support: IE 11 only 5501 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 5502 !(event.type === "click" && event.button >= 1)) { 5503 5504 for (; cur !== this; cur = cur.parentNode || this) { 5505 5506 // Don't check non-elements (#13208) 5507 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) 5508 if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) { 5509 matchedHandlers = []; 5510 matchedSelectors = {}; 5511 for (i = 0; i < delegateCount; i++) { 5512 handleObj = handlers[i]; 5513 5514 // Don't conflict with Object.prototype properties (#13203) 5515 sel = handleObj.selector + " "; 5516 5517 if (matchedSelectors[sel] === undefined) { 5518 matchedSelectors[sel] = handleObj.needsContext ? 5519 jQuery(sel, this).index(cur) > -1 : 5520 jQuery.find(sel, this, null, [cur]).length; 5521 } 5522 if (matchedSelectors[sel]) { 5523 matchedHandlers.push(handleObj); 5524 } 5525 } 5526 if (matchedHandlers.length) { 5527 handlerQueue.push({ elem: cur, handlers: matchedHandlers }); 5528 } 5529 } 5530 } 5531 } 5532 5533 // Add the remaining (directly-bound) handlers 5534 cur = this; 5535 if (delegateCount < handlers.length) { 5536 handlerQueue.push({ elem: cur, handlers: handlers.slice(delegateCount) }); 5537 } 5538 5539 return handlerQueue; 5540 }, 5541 5542 addProp: function (name, hook) { 5543 Object.defineProperty(jQuery.Event.prototype, name, { 5544 enumerable: true, 5545 configurable: true, 5546 5547 get: isFunction(hook) ? 5548 function () { 5549 if (this.originalEvent) { 5550 return hook(this.originalEvent); 5551 } 5552 } : 5553 function () { 5554 if (this.originalEvent) { 5555 return this.originalEvent[name]; 5556 } 5557 }, 5558 5559 set: function (value) { 5560 Object.defineProperty(this, name, { 5561 enumerable: true, 5562 configurable: true, 5563 writable: true, 5564 value: value 5565 }); 5566 } 5567 }); 5568 }, 5569 5570 fix: function (originalEvent) { 5571 return originalEvent[jQuery.expando] ? 5572 originalEvent : 5573 new jQuery.Event(originalEvent); 5574 }, 5575 5576 special: { 5577 load: { 5578 5579 // Prevent triggered image.load events from bubbling to window.load 5580 noBubble: true 5581 }, 5582 click: { 5583 5584 // Utilize native event to ensure correct state for checkable inputs 5585 setup: function (data) { 5586 5587 // For mutual compressibility with _default, replace `this` access with a local var. 5588 // `|| data` is dead code meant only to preserve the variable through minification. 5589 var el = this || data; 5590 5591 // Claim the first handler 5592 if (rcheckableType.test(el.type) && 5593 el.click && nodeName(el, "input")) { 5594 5595 // dataPriv.set( el, "click", ... ) 5596 leverageNative(el, "click", returnTrue); 5597 } 5598 5599 // Return false to allow normal processing in the caller 5600 return false; 5601 }, 5602 trigger: function (data) { 5603 5604 // For mutual compressibility with _default, replace `this` access with a local var. 5605 // `|| data` is dead code meant only to preserve the variable through minification. 5606 var el = this || data; 5607 5608 // Force setup before triggering a click 5609 if (rcheckableType.test(el.type) && 5610 el.click && nodeName(el, "input")) { 5611 5612 leverageNative(el, "click"); 5613 } 5614 5615 // Return non-false to allow normal event-path propagation 5616 return true; 5617 }, 5618 5619 // For cross-browser consistency, suppress native .click() on links 5620 // Also prevent it if we're currently inside a leveraged native-event stack 5621 _default: function (event) { 5622 var target = event.target; 5623 return rcheckableType.test(target.type) && 5624 target.click && nodeName(target, "input") && 5625 dataPriv.get(target, "click") || 5626 nodeName(target, "a"); 5627 } 5628 }, 5629 5630 beforeunload: { 5631 postDispatch: function (event) { 5632
5633 // Support: Firefox 20+ 5634 // Firefox doesn't alert if the returnValue field is not set. 5635 if (event.result !== undefined && event.originalEvent) { 5636 event.originalEvent.returnValue = event.result; 5637 } 5638 } 5639 } 5640 } 5641 }; 5642 5643 // Ensure the presence of an event listener that handles manually-triggered 5644 // synthetic events by interrupting progress until reinvoked in response to 5645 // *native* events that it fires directly, ensuring that state changes have 5646 // already occurred before other listeners are invoked. 5647 function leverageNative(el, type, expectSync) { 5648 5649 // Missing expectSync indicates a trigger call, which must force setup through jQuery.event.add 5650 if (!expectSync) { 5651 if (dataPriv.get(el, type) === undefined) { 5652 jQuery.event.add(el, type, returnTrue); 5653 } 5654 return; 5655 } 5656 5657 // Register the controller as a special universal handler for all event namespaces 5658 dataPriv.set(el, type, false); 5659 jQuery.event.add(el, type, { 5660 namespace: false, 5661 handler: function (event) { 5662 var notAsync, result, 5663 saved = dataPriv.get(this, type); 5664 5665 if ((event.isTrigger & 1) && this[type]) { 5666 5667 // Interrupt processing of the outer synthetic .trigger()ed event 5668 // Saved data should be false in such cases, but might be a leftover capture object 5669 // from an async native handler (gh-4350) 5670 if (!saved.length) { 5671 5672 // Store arguments for use when handling the inner native event 5673 // There will always be at least one argument (an event object), so this array 5674 // will not be confused with a leftover capture object. 5675 saved = slice.call(arguments); 5676 dataPriv.set(this, type, saved); 5677 5678 // Trigger the native event and capture its result 5679 // Support: IE <=9 - 11+ 5680 // focus() and blur() are asynchronous 5681 notAsync = expectSync(this, type); 5682 this[type](); 5683 result = dataPriv.get(this, type); 5684 if (saved !== result || notAsync) { 5685 dataPriv.set(this, type, false); 5686 } else { 5687 result = {}; 5688 } 5689 if (saved !== result) { 5690 5691 // Cancel the outer synthetic event 5692 event.stopImmediatePropagation(); 5693 event.preventDefault(); 5694 return result.value; 5695 } 5696 5697 // If this is an inner synthetic event for an event with a bubbling surrogate 5698 // (focus or blur), assume that the surrogate already propagated from triggering the 5699 // native event and prevent that from happening again here. 5700 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 5701 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 5702 // less bad than duplication. 5703 } else if ((jQuery.event.special[type] || {}).delegateType) { 5704 event.stopPropagation(); 5705 } 5706 5707 // If this is a native event triggered above, everything is now in order 5708 // Fire an inner synthetic event with the original arguments 5709 } else if (saved.length) { 5710 5711 // ...and capture the result 5712 dataPriv.set(this, type, { 5713 value: jQuery.event.trigger( 5714 5715 // Support: IE <=9 - 11+ 5716 // Extend with the prototype to reset the above stopImmediatePropagation() 5717 jQuery.extend(saved[0], jQuery.Event.prototype), 5718 saved.slice(1), 5719 this 5720 ) 5721 }); 5722 5723 // Abort handling of the native event 5724 event.stopImmediatePropagation(); 5725 } 5726 } 5727 }); 5728 } 5729 5730 jQuery.removeEvent = function (elem, type, handle) { 5731 5732 // This "if" is needed for plain objects 5733 if (elem.removeEventListener) { 5734 elem.removeEventListener(type, handle); 5735 } 5736 }; 5737 5738 jQuery.Event = function (src, props) { 5739 5740 // Allow instantiation without the 'new' keyword 5741 if (!(this instanceof jQuery.Event)) { 5742 return new jQuery.Event(src, props); 5743 } 5744 5745 // Event object 5746 if (src && src.type) { 5747 this.originalEvent = src; 5748 this.type = src.type; 5749 5750 // Events bubbling up the document may have been marked as prevented 5751 // by a handler lower down the tree; reflect the correct value. 5752 this.isDefaultPrevented = src.defaultPrevented || 5753 src.defaultPrevented === undefined && 5754
vendor: 6,117 bytes, lines 5755-6000
5755 // Support: Android <=2.3 only 5756 src.returnValue === false ? 5757 returnTrue : 5758 returnFalse; 5759 5760 // Create target properties 5761 // Support: Safari <=6 - 7 only 5762 // Target should not be a text node (#504, #13143) 5763 this.target = (src.target && src.target.nodeType === 3) ? 5764 src.target.parentNode : 5765 src.target; 5766 5767 this.currentTarget = src.currentTarget; 5768 this.relatedTarget = src.relatedTarget; 5769 5770 // Event type 5771 } else { 5772 this.type = src; 5773 } 5774 5775 // Put explicitly provided properties onto the event object 5776 if (props) { 5777 jQuery.extend(this, props); 5778 } 5779 5780 // Create a timestamp if incoming event doesn't have one 5781 this.timeStamp = src && src.timeStamp || Date.now(); 5782 5783 // Mark it as fixed 5784 this[jQuery.expando] = true; 5785 }; 5786 5787 // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 5788 // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 5789 jQuery.Event.prototype = { 5790 constructor: jQuery.Event, 5791 isDefaultPrevented: returnFalse, 5792 isPropagationStopped: returnFalse, 5793 isImmediatePropagationStopped: returnFalse, 5794 isSimulated: false, 5795 5796 preventDefault: function () { 5797 var e = this.originalEvent; 5798 5799 this.isDefaultPrevented = returnTrue; 5800 5801 if (e && !this.isSimulated) { 5802 e.preventDefault(); 5803 } 5804 }, 5805 stopPropagation: function () { 5806 var e = this.originalEvent; 5807 5808 this.isPropagationStopped = returnTrue; 5809 5810 if (e && !this.isSimulated) { 5811 e.stopPropagation(); 5812 } 5813 }, 5814 stopImmediatePropagation: function () { 5815 var e = this.originalEvent; 5816 5817 this.isImmediatePropagationStopped = returnTrue; 5818 5819 if (e && !this.isSimulated) { 5820 e.stopImmediatePropagation(); 5821 } 5822 5823 this.stopPropagation(); 5824 } 5825 }; 5826 5827 // Includes all common event props including KeyEvent and MouseEvent specific props 5828 jQuery.each({ 5829 altKey: true, 5830 bubbles: true, 5831 cancelable: true, 5832 changedTouches: true, 5833 ctrlKey: true, 5834 detail: true, 5835 eventPhase: true, 5836 metaKey: true, 5837 pageX: true, 5838 pageY: true, 5839 shiftKey: true, 5840 view: true, 5841 "char": true, 5842 code: true, 5843 charCode: true, 5844 key: true, 5845 keyCode: true, 5846 button: true, 5847 buttons: true, 5848 clientX: true, 5849 clientY: true, 5850 offsetX: true, 5851 offsetY: true, 5852 pointerId: true, 5853 pointerType: true, 5854 screenX: true, 5855 screenY: true, 5856 targetTouches: true, 5857 toElement: true, 5858 touches: true, 5859 5860 which: function (event) { 5861 var button = event.button; 5862 5863 // Add which for key events 5864 if (event.which == null && rkeyEvent.test(event.type)) { 5865 return event.charCode != null ? event.charCode : event.keyCode; 5866 } 5867 5868 // Add which for click: 1 === left; 2 === middle; 3 === right 5869 if (!event.which && button !== undefined && rmouseEvent.test(event.type)) { 5870 if (button & 1) { 5871 return 1; 5872 } 5873 5874 if (button & 2) { 5875 return 3; 5876 } 5877 5878 if (button & 4) { 5879 return 2; 5880 } 5881 5882 return 0; 5883 } 5884 5885 return event.which; 5886 } 5887 }, jQuery.event.addProp); 5888 5889 jQuery.each({ focus: "focusin", blur: "focusout" }, function (type, delegateType) { 5890 jQuery.event.special[type] = { 5891 5892 // Utilize native event if possible so blur/focus sequence is correct 5893 setup: function () { 5894 5895 // Claim the first handler 5896 // dataPriv.set( this, "focus", ... ) 5897 // dataPriv.set( this, "blur", ... ) 5898 leverageNative(this, type, expectSync); 5899 5900 // Return false to allow normal processing in the caller 5901 return false; 5902 }, 5903 trigger: function () { 5904 5905 // Force setup before trigger 5906 leverageNative(this, type); 5907 5908 // Return non-false to allow normal event-path propagation 5909 return true; 5910 }, 5911 5912 delegateType: delegateType 5913 }; 5914 }); 5915 5916 // Create mouseenter/leave events using mouseover/out and event-time checks 5917 // so that event delegation works in jQuery. 5918 // Do the same for pointerenter/pointerleave and pointerover/pointerout 5919 // 5920 // Support: Safari 7 only 5921 // Safari sends mouseenter too often; see: 5922 // https://bugs.chromium.org/p/chromium/issues/detail?id=470258 5923 // for the description of the bug (it existed in older Chrome versions as well). 5924 jQuery.each({ 5925 mouseenter: "mouseover", 5926 mouseleave: "mouseout", 5927 pointerenter: "pointerover", 5928 pointerleave: "pointerout" 5929 }, function (orig, fix) { 5930 jQuery.event.special[orig] = { 5931 delegateType: fix, 5932 bindType: fix, 5933 5934 handle: function (event) { 5935 var ret, 5936 target = this, 5937 related = event.relatedTarget, 5938 handleObj = event.handleObj; 5939 5940 // For mouseenter/leave call the handler if related is outside the target. 5941 // NB: No relatedTarget if the mouse left/entered the browser window 5942 if (!related || (related !== target && !jQuery.contains(target, related))) { 5943 event.type = handleObj.origType; 5944 ret = handleObj.handler.apply(this, arguments); 5945 event.type = fix; 5946 } 5947 return ret; 5948 } 5949 }; 5950 }); 5951 5952 jQuery.fn.extend({ 5953 5954 on: function (types, selector, data, fn) { 5955 return on(this, types, selector, data, fn); 5956 }, 5957 one: function (types, selector, data, fn) { 5958 return on(this, types, selector, data, fn, 1); 5959 }, 5960 off: function (types, selector, fn) { 5961 var handleObj, type; 5962 if (types && types.preventDefault && types.handleObj) { 5963 5964 // ( event ) dispatched jQuery.Event 5965 handleObj = types.handleObj; 5966 jQuery(types.delegateTarget).off( 5967 handleObj.namespace ? 5968 handleObj.origType + "." + handleObj.namespace : 5969 handleObj.origType, 5970 handleObj.selector, 5971 handleObj.handler 5972 ); 5973 return this; 5974 } 5975 if (typeof types === "object") { 5976 5977 // ( types-object [, selector] ) 5978 for (type in types) { 5979 this.off(type, selector, types[type]); 5980 } 5981 return this; 5982 } 5983 if (selector === false || typeof selector === "function") { 5984 5985 // ( types [, fn] ) 5986 fn = selector; 5987 selector = undefined; 5988 } 5989 if (fn === false) { 5990 fn = returnFalse; 5991 } 5992 return this.each(function () { 5993 jQuery.event.remove(this, types, fn, selector); 5994 }); 5995 } 5996 }); 5997 5998 5999 var 6000
vendor: 40,466 bytes, lines 6001-7424
6001 // Support: IE <=10 - 11, Edge 12 - 13 only 6002 // In IE/Edge using regex groups here causes severe slowdowns. 6003 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 6004 rnoInnerhtml = /<script|<style|<link/i, 6005 6006 // checked="checked" or checked 6007 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 6008 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g; 6009 6010 // Prefer a tbody over its parent table for containing new rows 6011 function manipulationTarget(elem, content) { 6012 if (nodeName(elem, "table") && 6013 nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) { 6014 6015 return jQuery(elem).children("tbody")[0] || elem; 6016 } 6017 6018 return elem; 6019 } 6020 6021 // Replace/restore the type attribute of script elements for safe DOM manipulation 6022 function disableScript(elem) { 6023 elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type; 6024 return elem; 6025 } 6026 function restoreScript(elem) { 6027 if ((elem.type || "").slice(0, 5) === "true/") { 6028 elem.type = elem.type.slice(5); 6029 } else { 6030 elem.removeAttribute("type"); 6031 } 6032 6033 return elem; 6034 } 6035 6036 function cloneCopyEvent(src, dest) { 6037 var i, l, type, pdataOld, udataOld, udataCur, events; 6038 6039 if (dest.nodeType !== 1) { 6040 return; 6041 } 6042 6043 // 1. Copy private data: events, handlers, etc. 6044 if (dataPriv.hasData(src)) { 6045 pdataOld = dataPriv.get(src); 6046 events = pdataOld.events; 6047 6048 if (events) { 6049 dataPriv.remove(dest, "handle events"); 6050 6051 for (type in events) { 6052 for (i = 0, l = events[type].length; i < l; i++) { 6053 jQuery.event.add(dest, type, events[type][i]); 6054 } 6055 } 6056 } 6057 } 6058 6059 // 2. Copy user data 6060 if (dataUser.hasData(src)) { 6061 udataOld = dataUser.access(src); 6062 udataCur = jQuery.extend({}, udataOld); 6063 6064 dataUser.set(dest, udataCur); 6065 } 6066 } 6067 6068 // Fix IE bugs, see support tests 6069 function fixInput(src, dest) { 6070 var nodeName = dest.nodeName.toLowerCase(); 6071 6072 // Fails to persist the checked state of a cloned checkbox or radio button. 6073 if (nodeName === "input" && rcheckableType.test(src.type)) { 6074 dest.checked = src.checked; 6075 6076 // Fails to return the selected option to the default selected state when cloning options 6077 } else if (nodeName === "input" || nodeName === "textarea") { 6078 dest.defaultValue = src.defaultValue; 6079 } 6080 } 6081 6082 function domManip(collection, args, callback, ignored) { 6083 6084 // Flatten any nested arrays 6085 args = flat(args); 6086 6087 var fragment, first, scripts, hasScripts, node, doc, 6088 i = 0, 6089 l = collection.length, 6090 iNoClone = l - 1, 6091 value = args[0], 6092 valueIsFunction = isFunction(value); 6093 6094 // We can't cloneNode fragments that contain checked, in WebKit 6095 if (valueIsFunction || 6096 (l > 1 && typeof value === "string" && 6097 !support.checkClone && rchecked.test(value))) { 6098 return collection.each(function (index) { 6099 var self = collection.eq(index); 6100 if (valueIsFunction) { 6101 args[0] = value.call(this, index, self.html()); 6102 } 6103 domManip(self, args, callback, ignored); 6104 }); 6105 } 6106 6107 if (l) { 6108 fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored); 6109 first = fragment.firstChild; 6110 6111 if (fragment.childNodes.length === 1) { 6112 fragment = first; 6113 } 6114 6115 // Require either new content or an interest in ignored elements to invoke the callback 6116 if (first || ignored) { 6117 scripts = jQuery.map(getAll(fragment, "script"), disableScript); 6118 hasScripts = scripts.length; 6119 6120 // Use the original fragment for the last item 6121 // instead of the first because it can end up 6122 // being emptied incorrectly in certain situations (#8070). 6123 for (; i < l; i++) { 6124 node = fragment; 6125 6126 if (i !== iNoClone) { 6127 node = jQuery.clone(node, true, true); 6128 6129 // Keep references to cloned scripts for later restoration 6130 if (hasScripts) { 6131 6132 // Support: Android <=4.0 only, PhantomJS 1 only 6133 // push.apply(_, arraylike) throws on ancient WebKit 6134 jQuery.merge(scripts, getAll(node, "script")); 6135 } 6136 } 6137 6138 callback.call(collection[i], node, i); 6139 } 6140 6141 if (hasScripts) { 6142 doc = scripts[scripts.length - 1].ownerDocument; 6143 6144 // Reenable scripts 6145 jQuery.map(scripts, restoreScript); 6146 6147 // Evaluate executable scripts on first document insertion 6148 for (i = 0; i < hasScripts; i++) { 6149 node = scripts[i]; 6150 if (rscriptType.test(node.type || "") && 6151 !dataPriv.access(node, "globalEval") && 6152 jQuery.contains(doc, node)) { 6153 6154 if (node.src && (node.type || "").toLowerCase() !== "module") { 6155 6156 // Optional AJAX dependency, but won't run scripts if not present 6157 if (jQuery._evalUrl && !node.noModule) { 6158 jQuery._evalUrl(node.src, { 6159 nonce: node.nonce || node.getAttribute("nonce") 6160 }, doc); 6161 } 6162 } else { 6163 DOMEval(node.textContent.replace(rcleanScript, ""), node, doc); 6164 } 6165 } 6166 } 6167 } 6168 } 6169 } 6170 6171 return collection; 6172 } 6173 6174 function remove(elem, selector, keepData) { 6175 var node, 6176 nodes = selector ? jQuery.filter(selector, elem) : elem, 6177 i = 0; 6178 6179 for (; (node = nodes[i]) != null; i++) { 6180 if (!keepData && node.nodeType === 1) { 6181 jQuery.cleanData(getAll(node)); 6182 } 6183 6184 if (node.parentNode) { 6185 if (keepData && isAttached(node)) { 6186 setGlobalEval(getAll(node, "script")); 6187 } 6188 node.parentNode.removeChild(node); 6189 } 6190 } 6191 6192 return elem; 6193 } 6194 6195 jQuery.extend({ 6196 htmlPrefilter: function (html) { 6197 return html; 6198 }, 6199 6200 clone: function (elem, dataAndEvents, deepDataAndEvents) { 6201 var i, l, srcElements, destElements, 6202 clone = elem.cloneNode(true), 6203 inPage = isAttached(elem); 6204 6205 // Fix IE cloning issues 6206 if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && 6207 !jQuery.isXMLDoc(elem)) { 6208 6209 // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2 6210 destElements = getAll(clone); 6211 srcElements = getAll(elem); 6212 6213 for (i = 0, l = srcElements.length; i < l; i++) { 6214 fixInput(srcElements[i], destElements[i]); 6215 } 6216 } 6217 6218 // Copy the events from the original to the clone 6219 if (dataAndEvents) { 6220 if (deepDataAndEvents) { 6221 srcElements = srcElements || getAll(elem); 6222 destElements = destElements || getAll(clone); 6223 6224 for (i = 0, l = srcElements.length; i < l; i++) { 6225 cloneCopyEvent(srcElements[i], destElements[i]); 6226 } 6227 } else { 6228 cloneCopyEvent(elem, clone); 6229 } 6230 } 6231 6232 // Preserve script evaluation history 6233 destElements = getAll(clone, "script"); 6234 if (destElements.length > 0) { 6235 setGlobalEval(destElements, !inPage && getAll(elem, "script")); 6236 } 6237 6238 // Return the cloned set 6239 return clone; 6240 }, 6241 6242 cleanData: function (elems) { 6243 var data, elem, type, 6244 special = jQuery.event.special, 6245 i = 0; 6246 6247 for (; (elem = elems[i]) !== undefined; i++) { 6248 if (acceptData(elem)) { 6249 if ((data = elem[dataPriv.expando])) { 6250 if (data.events) { 6251 for (type in data.events) { 6252 if (special[type]) { 6253 jQuery.event.remove(elem, type); 6254 6255 // This is a shortcut to avoid jQuery.event.remove's overhead 6256 } else { 6257 jQuery.removeEvent(elem, type, data.handle); 6258 } 6259 } 6260 } 6261 6262 // Support: Chrome <=35 - 45+ 6263 // Assign undefined instead of using delete, see Data#remove 6264 elem[dataPriv.expando] = undefined; 6265 } 6266 if (elem[dataUser.expando]) { 6267 6268 // Support: Chrome <=35 - 45+ 6269 // Assign undefined instead of using delete, see Data#remove 6270 elem[dataUser.expando] = undefined; 6271 } 6272 } 6273 } 6274 } 6275 }); 6276 6277 jQuery.fn.extend({ 6278 detach: function (selector) { 6279 return remove(this, selector, true); 6280 }, 6281 6282 remove: function (selector) { 6283 return remove(this, selector); 6284 }, 6285 6286 text: function (value) { 6287 return access(this, function (value) { 6288 return value === undefined ? 6289 jQuery.text(this) : 6290 this.empty().each(function () { 6291 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 6292 this.textContent = value; 6293 } 6294 }); 6295 }, null, value, arguments.length); 6296 }, 6297 6298 append: function () { 6299 return domManip(this, arguments, function (elem) { 6300 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 6301 var target = manipulationTarget(this, elem); 6302 target.appendChild(elem); 6303 } 6304 }); 6305 }, 6306 6307 prepend: function () { 6308 return domManip(this, arguments, function (elem) { 6309 if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) { 6310 var target = manipulationTarget(this, elem); 6311 target.insertBefore(elem, target.firstChild); 6312 } 6313 }); 6314 }, 6315 6316 before: function () { 6317 return domManip(this, arguments, function (elem) { 6318 if (this.parentNode) { 6319 this.parentNode.insertBefore(elem, this); 6320 } 6321 }); 6322 }, 6323 6324 after: function () { 6325 return domManip(this, arguments, function (elem) { 6326 if (this.parentNode) { 6327 this.parentNode.insertBefore(elem, this.nextSibling); 6328 } 6329 }); 6330 }, 6331 6332 empty: function () { 6333 var elem, 6334 i = 0; 6335 6336 for (; (elem = this[i]) != null; i++) { 6337 if (elem.nodeType === 1) { 6338 6339 // Prevent memory leaks 6340 jQuery.cleanData(getAll(elem, false)); 6341 6342 // Remove any remaining nodes 6343 elem.textContent = ""; 6344 } 6345 } 6346 6347 return this; 6348 }, 6349 6350 clone: function (dataAndEvents, deepDataAndEvents) { 6351 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 6352 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 6353 6354 return this.map(function () { 6355 return jQuery.clone(this, dataAndEvents, deepDataAndEvents); 6356 }); 6357 }, 6358 6359 html: function (value) { 6360 return access(this, function (value) { 6361 var elem = this[0] || {}, 6362 i = 0, 6363 l = this.length; 6364 6365 if (value === undefined && elem.nodeType === 1) { 6366 return elem.innerHTML; 6367 } 6368 6369 // See if we can take a shortcut and just use innerHTML 6370 if (typeof value === "string" && !rnoInnerhtml.test(value) && 6371 !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) { 6372 6373 value = jQuery.htmlPrefilter(value); 6374 6375 try { 6376 for (; i < l; i++) { 6377 elem = this[i] || {}; 6378 6379 // Remove element nodes and prevent memory leaks 6380 if (elem.nodeType === 1) { 6381 jQuery.cleanData(getAll(elem, false)); 6382 elem.innerHTML = value; 6383 } 6384 } 6385 6386 elem = 0; 6387 6388 // If using innerHTML throws an exception, use the fallback method 6389 } catch (e) { } 6390 } 6391 6392 if (elem) { 6393 this.empty().append(value); 6394 } 6395 }, null, value, arguments.length); 6396 }, 6397 6398 replaceWith: function () { 6399 var ignored = []; 6400 6401 // Make the changes, replacing each non-ignored context element with the new content 6402 return domManip(this, arguments, function (elem) { 6403 var parent = this.parentNode; 6404 6405 if (jQuery.inArray(this, ignored) < 0) { 6406 jQuery.cleanData(getAll(this)); 6407 if (parent) { 6408 parent.replaceChild(elem, this); 6409 } 6410 } 6411 6412 // Force callback invocation 6413 }, ignored); 6414 } 6415 }); 6416 6417 jQuery.each({ 6418 appendTo: "append", 6419 prependTo: "prepend", 6420 insertBefore: "before", 6421 insertAfter: "after", 6422 replaceAll: "replaceWith" 6423 }, function (name, original) { 6424 jQuery.fn[name] = function (selector) { 6425 var elems, 6426 ret = [], 6427 insert = jQuery(selector), 6428 last = insert.length - 1, 6429 i = 0; 6430 6431 for (; i <= last; i++) { 6432 elems = i === last ? this : this.clone(true); 6433 jQuery(insert[i])[original](elems); 6434 6435 // Support: Android <=4.0 only, PhantomJS 1 only 6436 // .get() because push.apply(_, arraylike) throws on ancient WebKit 6437 push.apply(ret, elems.get()); 6438 } 6439 6440 return this.pushStack(ret); 6441 }; 6442 }); 6443 var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i"); 6444 6445 var getStyles = function (elem) { 6446 6447 // Support: IE <=11 only, Firefox <=30 (#15098, #14150) 6448 // IE throws on elements created in popups 6449 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 6450 var view = elem.ownerDocument.defaultView; 6451 6452 if (!view || !view.opener) { 6453 view = window; 6454 } 6455 6456 return view.getComputedStyle(elem); 6457 }; 6458 6459 var swap = function (elem, options, callback) { 6460 var ret, name, 6461 old = {}; 6462 6463 // Remember the old values, and insert the new ones 6464 for (name in options) { 6465 old[name] = elem.style[name]; 6466 elem.style[name] = options[name]; 6467 } 6468 6469 ret = callback.call(elem); 6470 6471 // Revert the old values 6472 for (name in options) { 6473 elem.style[name] = old[name]; 6474 } 6475 6476 return ret; 6477 }; 6478 6479 6480 var rboxStyle = new RegExp(cssExpand.join("|"), "i"); 6481 6482 6483 6484 (function () { 6485 6486 // Executing both pixelPosition & boxSizingReliable tests require only one layout 6487 // so they're executed at the same time to save the second computation. 6488 function computeStyleTests() { 6489 6490 // This is a singleton, we need to execute it only once 6491 if (!div) { 6492 return; 6493 } 6494 6495 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 6496 "margin-top:1px;padding:0;border:0"; 6497 div.style.cssText = 6498 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 6499 "margin:auto;border:1px;padding:1px;" + 6500 "width:60%;top:1%"; 6501 documentElement.appendChild(container).appendChild(div); 6502 6503 var divStyle = window.getComputedStyle(div); 6504 pixelPositionVal = divStyle.top !== "1%"; 6505 6506 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 6507 reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12; 6508 6509 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 6510 // Some styles come back with percentage values, even though they shouldn't 6511 div.style.right = "60%"; 6512 pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36; 6513 6514 // Support: IE 9 - 11 only 6515 // Detect misreporting of content dimensions for box-sizing:border-box elements 6516 boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36; 6517 6518 // Support: IE 9 only 6519 // Detect overflow:scroll screwiness (gh-3699) 6520 // Support: Chrome <=64 6521 // Don't get tricked when zoom affects offsetWidth (gh-4029) 6522 div.style.position = "absolute"; 6523 scrollboxSizeVal = roundPixelMeasures(div.offsetWidth / 3) === 12; 6524 6525 documentElement.removeChild(container); 6526 6527 // Nullify the div so it wouldn't be stored in the memory and 6528 // it will also be a sign that checks already performed 6529 div = null; 6530 } 6531 6532 function roundPixelMeasures(measure) { 6533 return Math.round(parseFloat(measure)); 6534 } 6535 6536 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 6537 reliableTrDimensionsVal, reliableMarginLeftVal, 6538 container = document.createElement("div"), 6539 div = document.createElement("div"); 6540 6541 // Finish early in limited (non-browser) environments 6542 if (!div.style) { 6543 return; 6544 } 6545 6546 // Support: IE <=9 - 11 only 6547 // Style of cloned element affects source element cloned (#8908) 6548 div.style.backgroundClip = "content-box"; 6549 div.cloneNode(true).style.backgroundClip = ""; 6550 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 6551 6552 jQuery.extend(support, { 6553 boxSizingReliable: function () { 6554 computeStyleTests(); 6555 return boxSizingReliableVal; 6556 }, 6557 pixelBoxStyles: function () { 6558 computeStyleTests(); 6559 return pixelBoxStylesVal; 6560 }, 6561 pixelPosition: function () { 6562 computeStyleTests(); 6563 return pixelPositionVal; 6564 }, 6565 reliableMarginLeft: function () { 6566 computeStyleTests(); 6567 return reliableMarginLeftVal; 6568 }, 6569 scrollboxSize: function () { 6570 computeStyleTests(); 6571 return scrollboxSizeVal; 6572 }, 6573 6574 // Support: IE 9 - 11+, Edge 15 - 18+ 6575 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6576 // set in CSS while `offset*` properties report correct values. 6577 // Behavior in IE 9 is more subtle than in newer versions & it passes 6578 // some versions of this test; make sure not to make it pass there! 6579 reliableTrDimensions: function () { 6580 var table, tr, trChild, trStyle; 6581 if (reliableTrDimensionsVal == null) { 6582 table = document.createElement("table"); 6583 tr = document.createElement("tr"); 6584 trChild = document.createElement("div"); 6585 6586 table.style.cssText = "position:absolute;left:-11111px"; 6587 tr.style.height = "1px"; 6588 trChild.style.height = "9px"; 6589 6590 documentElement 6591 .appendChild(table) 6592 .appendChild(tr) 6593 .appendChild(trChild); 6594 6595 trStyle = window.getComputedStyle(tr); 6596 reliableTrDimensionsVal = parseInt(trStyle.height) > 3; 6597 6598 documentElement.removeChild(table); 6599 } 6600 return reliableTrDimensionsVal; 6601 } 6602 }); 6603 })(); 6604 6605 6606 function curCSS(elem, name, computed) { 6607 var width, minWidth, maxWidth, ret, 6608 6609 // Support: Firefox 51+ 6610 // Retrieving style before computed somehow 6611 // fixes an issue with getting wrong values 6612 // on detached elements 6613 style = elem.style; 6614 6615 computed = computed || getStyles(elem); 6616 6617 // getPropertyValue is needed for: 6618 // .css('filter') (IE 9 only, #12537) 6619 // .css('--customProperty) (#3144) 6620 if (computed) { 6621 ret = computed.getPropertyValue(name) || computed[name]; 6622 6623 if (ret === "" && !isAttached(elem)) { 6624 ret = jQuery.style(elem, name); 6625 } 6626 6627 // A tribute to the "awesome hack by Dean Edwards" 6628 // Android Browser returns percentage for some values, 6629 // but width seems to be reliably pixels. 6630 // This is against the CSSOM draft spec: 6631 // https://drafts.csswg.org/cssom/#resolved-values 6632 if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) { 6633 6634 // Remember the original values 6635 width = style.width; 6636 minWidth = style.minWidth; 6637 maxWidth = style.maxWidth; 6638 6639 // Put in the new values to get a computed value out 6640 style.minWidth = style.maxWidth = style.width = ret; 6641 ret = computed.width; 6642 6643 // Revert the changed values 6644 style.width = width; 6645 style.minWidth = minWidth; 6646 style.maxWidth = maxWidth; 6647 } 6648 } 6649 6650 return ret !== undefined ? 6651 6652 // Support: IE <=9 - 11 only 6653 // IE returns zIndex value as an integer. 6654 ret + "" : 6655 ret; 6656 } 6657 6658 6659 function addGetHookIf(conditionFn, hookFn) { 6660 6661 // Define the hook, we'll check on the first run if it's really needed. 6662 return { 6663 get: function () { 6664 if (conditionFn()) { 6665 6666 // Hook not needed (or it's not possible to use it due 6667 // to missing dependency), remove it. 6668 delete this.get; 6669 return; 6670 } 6671 6672 // Hook needed; redefine it so that the support test is not executed again. 6673 return (this.get = hookFn).apply(this, arguments); 6674 } 6675 }; 6676 } 6677 6678 6679 var cssPrefixes = ["Webkit", "Moz", "ms"], 6680 emptyStyle = document.createElement("div").style, 6681 vendorProps = {}; 6682 6683 // Return a vendor-prefixed property or undefined 6684 function vendorPropName(name) { 6685 6686 // Check for vendor prefixed names 6687 var capName = name[0].toUpperCase() + name.slice(1), 6688 i = cssPrefixes.length; 6689 6690 while (i--) { 6691 name = cssPrefixes[i] + capName; 6692 if (name in emptyStyle) { 6693 return name; 6694 } 6695 } 6696 } 6697 6698 // Return a potentially-mapped jQuery.cssProps or vendor prefixed property 6699 function finalPropName(name) { 6700 var final = jQuery.cssProps[name] || vendorProps[name]; 6701 6702 if (final) { 6703 return final; 6704 } 6705 if (name in emptyStyle) { 6706 return name; 6707 } 6708 return vendorProps[name] = vendorPropName(name) || name; 6709 } 6710 6711 6712 var 6713 6714 // Swappable if display is none or starts with table 6715 // except "table", "table-cell", or "table-caption" 6716 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 6717 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 6718 rcustomProp = /^--/, 6719 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 6720 cssNormalTransform = { 6721 letterSpacing: "0", 6722 fontWeight: "400" 6723 }; 6724 6725 function setPositiveNumber(_elem, value, subtract) { 6726 6727 // Any relative (+/-) values have already been 6728 // normalized at this point 6729 var matches = rcssNum.exec(value); 6730 return matches ? 6731 6732 // Guard against undefined "subtract", e.g., when used as in cssHooks 6733 Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : 6734 value; 6735 } 6736 6737 function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) { 6738 var i = dimension === "width" ? 1 : 0, 6739 extra = 0, 6740 delta = 0; 6741 6742 // Adjustment may not be necessary 6743 if (box === (isBorderBox ? "border" : "content")) { 6744 return 0; 6745 } 6746 6747 for (; i < 4; i += 2) { 6748 6749 // Both box models exclude margin 6750 if (box === "margin") { 6751 delta += jQuery.css(elem, box + cssExpand[i], true, styles); 6752 } 6753 6754 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 6755 if (!isBorderBox) { 6756 6757 // Add padding 6758 delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles); 6759 6760 // For "border" or "margin", add border 6761 if (box !== "padding") { 6762 delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles); 6763 6764 // But still keep track of it otherwise 6765 } else { 6766 extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles); 6767 } 6768 6769 // If we get here with a border-box (content + padding + border), we're seeking "content" or 6770 // "padding" or "margin" 6771 } else { 6772 6773 // For "content", subtract padding 6774 if (box === "content") { 6775 delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles); 6776 } 6777 6778 // For "content" or "padding", subtract border 6779 if (box !== "margin") { 6780 delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles); 6781 } 6782 } 6783 } 6784 6785 // Account for positive content-box scroll gutter when requested by providing computedVal 6786 if (!isBorderBox && computedVal >= 0) { 6787 6788 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 6789 // Assuming integer scroll gutter, subtract the rest and round down 6790 delta += Math.max(0, Math.ceil( 6791 elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - 6792 computedVal - 6793 delta - 6794 extra - 6795 0.5 6796 6797 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 6798 // Use an explicit zero to avoid NaN (gh-3964) 6799 )) || 0; 6800 } 6801 6802 return delta; 6803 } 6804 6805 function getWidthOrHeight(elem, dimension, extra) { 6806 6807 // Start with computed style 6808 var styles = getStyles(elem), 6809 6810 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 6811 // Fake content-box until we know it's needed to know the true value. 6812 boxSizingNeeded = !support.boxSizingReliable() || extra, 6813 isBorderBox = boxSizingNeeded && 6814 jQuery.css(elem, "boxSizing", false, styles) === "border-box", 6815 valueIsBorderBox = isBorderBox, 6816 6817 val = curCSS(elem, dimension, styles), 6818 offsetProp = "offset" + dimension[0].toUpperCase() + dimension.slice(1); 6819 6820 // Support: Firefox <=54 6821 // Return a confounding non-pixel value or feign ignorance, as appropriate. 6822 if (rnumnonpx.test(val)) { 6823 if (!extra) { 6824 return val; 6825 } 6826 val = "auto"; 6827 } 6828 6829 6830 // Support: IE 9 - 11 only 6831 // Use offsetWidth/offsetHeight for when box sizing is unreliable. 6832 // In those cases, the computed value can be trusted to be border-box. 6833 if ((!support.boxSizingReliable() && isBorderBox || 6834 6835 // Support: IE 10 - 11+, Edge 15 - 18+ 6836 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6837 // set in CSS while `offset*` properties report correct values. 6838 // Interestingly, in some cases IE 9 doesn't suffer from this issue. 6839 !support.reliableTrDimensions() && nodeName(elem, "tr") || 6840 6841 // Fall back to offsetWidth/offsetHeight when value is "auto" 6842 // This happens for inline elements with no explicit setting (gh-3571) 6843 val === "auto" || 6844 6845 // Support: Android <=4.1 - 4.3 only 6846 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 6847 !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") && 6848 6849 // Make sure the element is visible & connected 6850 elem.getClientRects().length) { 6851 6852 isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box"; 6853 6854 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 6855 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 6856 // retrieved value as a content box dimension. 6857 valueIsBorderBox = offsetProp in elem; 6858 if (valueIsBorderBox) { 6859 val = elem[offsetProp]; 6860 } 6861 } 6862 6863 // Normalize "" and auto 6864 val = parseFloat(val) || 0; 6865 6866 // Adjust for the element's box model 6867 return (val + 6868 boxModelAdjustment( 6869 elem, 6870 dimension, 6871 extra || (isBorderBox ? "border" : "content"), 6872 valueIsBorderBox, 6873 styles, 6874 6875 // Provide the current computed size to request scroll gutter calculation (gh-3589) 6876 val 6877 ) 6878 ) + "px"; 6879 } 6880 6881 jQuery.extend({ 6882 6883 // Add in style property hooks for overriding the default 6884 // behavior of getting and setting a style property 6885 cssHooks: { 6886 opacity: { 6887 get: function (elem, computed) { 6888 if (computed) { 6889 6890 // We should always get a number back from opacity 6891 var ret = curCSS(elem, "opacity"); 6892 return ret === "" ? "1" : ret; 6893 } 6894 } 6895 } 6896 }, 6897 6898 // Don't automatically add "px" to these possibly-unitless properties 6899 cssNumber: { 6900 "animationIterationCount": true, 6901 "columnCount": true, 6902 "fillOpacity": true, 6903 "flexGrow": true, 6904 "flexShrink": true, 6905 "fontWeight": true, 6906 "gridArea": true, 6907 "gridColumn": true, 6908 "gridColumnEnd": true, 6909 "gridColumnStart": true, 6910 "gridRow": true, 6911 "gridRowEnd": true, 6912 "gridRowStart": true, 6913 "lineHeight": true, 6914 "opacity": true, 6915 "order": true, 6916 "orphans": true, 6917 "widows": true, 6918 "zIndex": true, 6919 "zoom": true 6920 }, 6921 6922 // Add in properties whose names you wish to fix before 6923 // setting or getting the value 6924 cssProps: {}, 6925 6926 // Get and set the style property on a DOM Node 6927 style: function (elem, name, value, extra) { 6928 6929 // Don't set styles on text and comment nodes 6930 if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) { 6931 return; 6932 } 6933 6934 // Make sure that we're working with the right name 6935 var ret, type, hooks, 6936 origName = camelCase(name), 6937 isCustomProp = rcustomProp.test(name), 6938 style = elem.style; 6939 6940 // Make sure that we're working with the right name. We don't 6941 // want to query the value if it is a CSS custom property 6942 // since they are user-defined. 6943 if (!isCustomProp) { 6944 name = finalPropName(origName); 6945 } 6946 6947 // Gets hook for the prefixed version, then unprefixed version 6948 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; 6949 6950 // Check if we're setting a value 6951 if (value !== undefined) { 6952 type = typeof value; 6953 6954 // Convert "+=" or "-=" to relative numbers (#7345) 6955 if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) { 6956 value = adjustCSS(elem, name, ret); 6957 6958 // Fixes bug #9237 6959 type = "number"; 6960 } 6961 6962 // Make sure that null and NaN values aren't set (#7116) 6963 if (value == null || value !== value) { 6964 return; 6965 } 6966 6967 // If a number was passed in, add the unit (except for certain CSS properties) 6968 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 6969 // "px" to a few hardcoded values. 6970 if (type === "number" && !isCustomProp) { 6971 value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px"); 6972 } 6973 6974 // background-* props affect original clone's values 6975 if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) { 6976 style[name] = "inherit"; 6977 } 6978 6979 // If a hook was provided, use that value, otherwise just set the specified value 6980 if (!hooks || !("set" in hooks) || 6981 (value = hooks.set(elem, value, extra)) !== undefined) { 6982 6983 if (isCustomProp) { 6984 style.setProperty(name, value); 6985 } else { 6986 style[name] = value; 6987 } 6988 } 6989 6990 } else { 6991 6992 // If a hook was provided get the non-computed value from there 6993 if (hooks && "get" in hooks && 6994 (ret = hooks.get(elem, false, extra)) !== undefined) { 6995 6996 return ret; 6997 } 6998 6999 // Otherwise just get the value from the style object 7000 return style[name]; 7001 } 7002 }, 7003 7004 css: function (elem, name, extra, styles) { 7005 var val, num, hooks, 7006 origName = camelCase(name), 7007 isCustomProp = rcustomProp.test(name); 7008 7009 // Make sure that we're working with the right name. We don't 7010 // want to modify the value if it is a CSS custom property 7011 // since they are user-defined. 7012 if (!isCustomProp) { 7013 name = finalPropName(origName); 7014 } 7015 7016 // Try prefixed name followed by the unprefixed name 7017 hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName]; 7018 7019 // If a hook was provided get the computed value from there 7020 if (hooks && "get" in hooks) { 7021 val = hooks.get(elem, true, extra); 7022 } 7023 7024 // Otherwise, if a way to get the computed value exists, use that 7025 if (val === undefined) { 7026 val = curCSS(elem, name, styles); 7027 } 7028 7029 // Convert "normal" to computed value 7030 if (val === "normal" && name in cssNormalTransform) { 7031 val = cssNormalTransform[name]; 7032 } 7033 7034 // Make numeric if forced or a qualifier was provided and val looks numeric 7035 if (extra === "" || extra) { 7036 num = parseFloat(val); 7037 return extra === true || isFinite(num) ? num || 0 : val; 7038 } 7039 7040 return val; 7041 } 7042 }); 7043 7044 jQuery.each(["height", "width"], function (_i, dimension) { 7045 jQuery.cssHooks[dimension] = { 7046 get: function (elem, computed, extra) { 7047 if (computed) { 7048 7049 // Certain elements can have dimension info if we invisibly show them 7050 // but it must have a current display style that would benefit 7051 return rdisplayswap.test(jQuery.css(elem, "display")) && 7052 7053 // Support: Safari 8+ 7054 // Table columns in Safari have non-zero offsetWidth & zero 7055 // getBoundingClientRect().width unless display is changed. 7056 // Support: IE <=11 only 7057 // Running getBoundingClientRect on a disconnected node 7058 // in IE throws an error. 7059 (!elem.getClientRects().length || !elem.getBoundingClientRect().width) ? 7060 swap(elem, cssShow, function () { 7061 return getWidthOrHeight(elem, dimension, extra); 7062 }) : 7063 getWidthOrHeight(elem, dimension, extra); 7064 } 7065 }, 7066 7067 set: function (elem, value, extra) { 7068 var matches, 7069 styles = getStyles(elem), 7070 7071 // Only read styles.position if the test has a chance to fail 7072 // to avoid forcing a reflow. 7073 scrollboxSizeBuggy = !support.scrollboxSize() && 7074 styles.position === "absolute", 7075 7076 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 7077 boxSizingNeeded = scrollboxSizeBuggy || extra, 7078 isBorderBox = boxSizingNeeded && 7079 jQuery.css(elem, "boxSizing", false, styles) === "border-box", 7080 subtract = extra ? 7081 boxModelAdjustment( 7082 elem, 7083 dimension, 7084 extra, 7085 isBorderBox, 7086 styles 7087 ) : 7088 0; 7089 7090 // Account for unreliable border-box dimensions by comparing offset* to computed and 7091 // faking a content-box to get border and padding (gh-3699) 7092 if (isBorderBox && scrollboxSizeBuggy) { 7093 subtract -= Math.ceil( 7094 elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - 7095 parseFloat(styles[dimension]) - 7096 boxModelAdjustment(elem, dimension, "border", false, styles) - 7097 0.5 7098 ); 7099 } 7100 7101 // Convert to pixels if value adjustment is needed 7102 if (subtract && (matches = rcssNum.exec(value)) && 7103 (matches[3] || "px") !== "px") { 7104 7105 elem.style[dimension] = value; 7106 value = jQuery.css(elem, dimension); 7107 } 7108 7109 return setPositiveNumber(elem, value, subtract); 7110 } 7111 }; 7112 }); 7113 7114 jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, 7115 function (elem, computed) { 7116 if (computed) { 7117 return (parseFloat(curCSS(elem, "marginLeft")) || 7118 elem.getBoundingClientRect().left - 7119 swap(elem, { marginLeft: 0 }, function () { 7120 return elem.getBoundingClientRect().left; 7121 }) 7122 ) + "px"; 7123 } 7124 } 7125 ); 7126 7127 // These hooks are used by animate to expand properties 7128 jQuery.each({ 7129 margin: "", 7130 padding: "", 7131 border: "Width" 7132 }, function (prefix, suffix) { 7133 jQuery.cssHooks[prefix + suffix] = { 7134 expand: function (value) { 7135 var i = 0, 7136 expanded = {}, 7137 7138 // Assumes a single number if not a string 7139 parts = typeof value === "string" ? value.split(" ") : [value]; 7140 7141 for (; i < 4; i++) { 7142 expanded[prefix + cssExpand[i] + suffix] = 7143 parts[i] || parts[i - 2] || parts[0]; 7144 } 7145 7146 return expanded; 7147 } 7148 }; 7149 7150 if (prefix !== "margin") { 7151 jQuery.cssHooks[prefix + suffix].set = setPositiveNumber; 7152 } 7153 }); 7154 7155 jQuery.fn.extend({ 7156 css: function (name, value) { 7157 return access(this, function (elem, name, value) { 7158 var styles, len, 7159 map = {}, 7160 i = 0; 7161 7162 if (Array.isArray(name)) { 7163 styles = getStyles(elem); 7164 len = name.length; 7165 7166 for (; i < len; i++) { 7167 map[name[i]] = jQuery.css(elem, name[i], false, styles); 7168 } 7169 7170 return map; 7171 } 7172 7173 return value !== undefined ? 7174 jQuery.style(elem, name, value) : 7175 jQuery.css(elem, name); 7176 }, name, value, arguments.length > 1); 7177 } 7178 }); 7179 7180 7181 function Tween(elem, options, prop, end, easing) { 7182 return new Tween.prototype.init(elem, options, prop, end, easing); 7183 } 7184 jQuery.Tween = Tween; 7185 7186 Tween.prototype = { 7187 constructor: Tween, 7188 init: function (elem, options, prop, end, easing, unit) { 7189 this.elem = elem; 7190 this.prop = prop; 7191 this.easing = easing || jQuery.easing._default; 7192 this.options = options; 7193 this.start = this.now = this.cur(); 7194 this.end = end; 7195 this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px"); 7196 }, 7197 cur: function () { 7198 var hooks = Tween.propHooks[this.prop]; 7199 7200 return hooks && hooks.get ? 7201 hooks.get(this) : 7202 Tween.propHooks._default.get(this); 7203 }, 7204 run: function (percent) { 7205 var eased, 7206 hooks = Tween.propHooks[this.prop]; 7207 7208 if (this.options.duration) { 7209 this.pos = eased = jQuery.easing[this.easing]( 7210 percent, this.options.duration * percent, 0, 1, this.options.duration 7211 ); 7212 } else { 7213 this.pos = eased = percent; 7214 } 7215 this.now = (this.end - this.start) * eased + this.start; 7216 7217 if (this.options.step) { 7218 this.options.step.call(this.elem, this.now, this); 7219 } 7220 7221 if (hooks && hooks.set) { 7222 hooks.set(this); 7223 } else { 7224 Tween.propHooks._default.set(this); 7225 } 7226 return this; 7227 } 7228 }; 7229 7230 Tween.prototype.init.prototype = Tween.prototype; 7231 7232 Tween.propHooks = { 7233 _default: { 7234 get: function (tween) { 7235 var result; 7236 7237 // Use a property on the element directly when it is not a DOM element, 7238 // or when there is no matching style property that exists. 7239 if (tween.elem.nodeType !== 1 || 7240 tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) { 7241 return tween.elem[tween.prop]; 7242 } 7243 7244 // Passing an empty string as a 3rd parameter to .css will automatically 7245 // attempt a parseFloat and fallback to a string if the parse fails. 7246 // Simple values such as "10px" are parsed to Float; 7247 // complex values such as "rotate(1rad)" are returned as-is. 7248 result = jQuery.css(tween.elem, tween.prop, ""); 7249 7250 // Empty strings, null, undefined and "auto" are converted to 0. 7251 return !result || result === "auto" ? 0 : result; 7252 }, 7253 set: function (tween) { 7254 7255 // Use step hook for back compat. 7256 // Use cssHook if its there. 7257 // Use .style if available and use plain properties where available. 7258 if (jQuery.fx.step[tween.prop]) { 7259 jQuery.fx.step[tween.prop](tween); 7260 } else if (tween.elem.nodeType === 1 && ( 7261 jQuery.cssHooks[tween.prop] || 7262 tween.elem.style[finalPropName(tween.prop)] != null)) { 7263 jQuery.style(tween.elem, tween.prop, tween.now + tween.unit); 7264 } else { 7265 tween.elem[tween.prop] = tween.now; 7266 } 7267 } 7268 } 7269 }; 7270 7271 // Support: IE <=9 only 7272 // Panic based approach to setting things on disconnected nodes 7273 Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 7274 set: function (tween) { 7275 if (tween.elem.nodeType && tween.elem.parentNode) { 7276 tween.elem[tween.prop] = tween.now; 7277 } 7278 } 7279 }; 7280 7281 jQuery.easing = { 7282 linear: function (p) { 7283 return p; 7284 }, 7285 swing: function (p) { 7286 return 0.5 - Math.cos(p * Math.PI) / 2; 7287 }, 7288 _default: "swing" 7289 }; 7290 7291 jQuery.fx = Tween.prototype.init; 7292 7293 // Back compat <1.8 extension point 7294 jQuery.fx.step = {}; 7295 7296 7297 7298 7299 var 7300 fxNow, inProgress, 7301 rfxtypes = /^(?:toggle|show|hide)$/, 7302 rrun = /queueHooks$/; 7303 7304 function schedule() { 7305 if (inProgress) { 7306 if (document.hidden === false && window.requestAnimationFrame) { 7307 window.requestAnimationFrame(schedule); 7308 } else { 7309 window.setTimeout(schedule, jQuery.fx.interval); 7310 } 7311 7312 jQuery.fx.tick(); 7313 } 7314 } 7315 7316 // Animations created synchronously will run synchronously 7317 function createFxNow() { 7318 window.setTimeout(function () { 7319 fxNow = undefined; 7320 }); 7321 return (fxNow = Date.now()); 7322 } 7323 7324 // Generate parameters to create a standard animation 7325 function genFx(type, includeWidth) { 7326 var which, 7327 i = 0, 7328 attrs = { height: type }; 7329 7330 // If we include width, step value is 1 to do all cssExpand values, 7331 // otherwise step value is 2 to skip over Left and Right 7332 includeWidth = includeWidth ? 1 : 0; 7333 for (; i < 4; i += 2 - includeWidth) { 7334 which = cssExpand[i]; 7335 attrs["margin" + which] = attrs["padding" + which] = type; 7336 } 7337 7338 if (includeWidth) { 7339 attrs.opacity = attrs.width = type; 7340 } 7341 7342 return attrs; 7343 } 7344 7345 function createTween(value, prop, animation) { 7346 var tween, 7347 collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]), 7348 index = 0, 7349 length = collection.length; 7350 for (; index < length; index++) { 7351 if ((tween = collection[index].call(animation, prop, value))) { 7352 7353 // We're done with this property 7354 return tween; 7355 } 7356 } 7357 } 7358 7359 function defaultPrefilter(elem, props, opts) { 7360 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 7361 isBox = "width" in props || "height" in props, 7362 anim = this, 7363 orig = {}, 7364 style = elem.style, 7365 hidden = elem.nodeType && isHiddenWithinTree(elem), 7366 dataShow = dataPriv.get(elem, "fxshow"); 7367 7368 // Queue-skipping animations hijack the fx hooks 7369 if (!opts.queue) { 7370 hooks = jQuery._queueHooks(elem, "fx"); 7371 if (hooks.unqueued == null) { 7372 hooks.unqueued = 0; 7373 oldfire = hooks.empty.fire; 7374 hooks.empty.fire = function () { 7375 if (!hooks.unqueued) { 7376 oldfire(); 7377 } 7378 }; 7379 } 7380 hooks.unqueued++; 7381 7382 anim.always(function () { 7383 7384 // Ensure the complete handler is called before this completes 7385 anim.always(function () { 7386 hooks.unqueued--; 7387 if (!jQuery.queue(elem, "fx").length) { 7388 hooks.empty.fire(); 7389 } 7390 }); 7391 }); 7392 } 7393 7394 // Detect show/hide animations 7395 for (prop in props) { 7396 value = props[prop]; 7397 if (rfxtypes.test(value)) { 7398 delete props[prop]; 7399 toggle = toggle || value === "toggle"; 7400 if (value === (hidden ? "hide" : "show")) { 7401 7402 // Pretend to be hidden if this is a "show" and 7403 // there is still data from a stopped show/hide 7404 if (value === "show" && dataShow && dataShow[prop] !== undefined) { 7405 hidden = true; 7406 7407 // Ignore all other no-op show/hide data 7408 } else { 7409 continue; 7410 } 7411 } 7412 orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop); 7413 } 7414 } 7415 7416 // Bail out if this is a no-op like .hide().hide() 7417 propTween = !jQuery.isEmptyObject(props); 7418 if (!propTween && jQuery.isEmptyObject(orig)) { 7419 return; 7420 } 7421 7422 // Restrict "overflow" and "display" styles during box animations 7423 if (isBox && elem.nodeType === 1) { 7424
vendor: 3,179 bytes, lines 7425-7536
7425 // Support: IE <=9 - 11, Edge 12 - 15 7426 // Record all 3 overflow attributes because IE does not infer the shorthand 7427 // from identically-valued overflowX and overflowY and Edge just mirrors 7428 // the overflowX value there. 7429 opts.overflow = [style.overflow, style.overflowX, style.overflowY]; 7430 7431 // Identify a display type, preferring old show/hide data over the CSS cascade 7432 restoreDisplay = dataShow && dataShow.display; 7433 if (restoreDisplay == null) { 7434 restoreDisplay = dataPriv.get(elem, "display"); 7435 } 7436 display = jQuery.css(elem, "display"); 7437 if (display === "none") { 7438 if (restoreDisplay) { 7439 display = restoreDisplay; 7440 } else { 7441 7442 // Get nonempty value(s) by temporarily forcing visibility 7443 showHide([elem], true); 7444 restoreDisplay = elem.style.display || restoreDisplay; 7445 display = jQuery.css(elem, "display"); 7446 showHide([elem]); 7447 } 7448 } 7449 7450 // Animate inline elements as inline-block 7451 if (display === "inline" || display === "inline-block" && restoreDisplay != null) { 7452 if (jQuery.css(elem, "float") === "none") { 7453 7454 // Restore the original display value at the end of pure show/hide animations 7455 if (!propTween) { 7456 anim.done(function () { 7457 style.display = restoreDisplay; 7458 }); 7459 if (restoreDisplay == null) { 7460 display = style.display; 7461 restoreDisplay = display === "none" ? "" : display; 7462 } 7463 } 7464 style.display = "inline-block"; 7465 } 7466 } 7467 } 7468 7469 if (opts.overflow) { 7470 style.overflow = "hidden"; 7471 anim.always(function () { 7472 style.overflow = opts.overflow[0]; 7473 style.overflowX = opts.overflow[1]; 7474 style.overflowY = opts.overflow[2]; 7475 }); 7476 } 7477 7478 // Implement show/hide animations 7479 propTween = false; 7480 for (prop in orig) { 7481 7482 // General show/hide setup for this element animation 7483 if (!propTween) { 7484 if (dataShow) { 7485 if ("hidden" in dataShow) { 7486 hidden = dataShow.hidden; 7487 } 7488 } else { 7489 dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay }); 7490 } 7491 7492 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 7493 if (toggle) { 7494 dataShow.hidden = !hidden; 7495 } 7496 7497 // Show elements before animating them 7498 if (hidden) { 7499 showHide([elem], true); 7500 } 7501 7502 /* eslint-disable no-loop-func */ 7503 7504 anim.done(function () { 7505 7506 /* eslint-enable no-loop-func */ 7507 7508 // The final step of a "hide" animation is actually hiding the element 7509 if (!hidden) { 7510 showHide([elem]); 7511 } 7512 dataPriv.remove(elem, "fxshow"); 7513 for (prop in orig) { 7514 jQuery.style(elem, prop, orig[prop]); 7515 } 7516 }); 7517 } 7518 7519 // Per-property setup 7520 propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim); 7521 if (!(prop in dataShow)) { 7522 dataShow[prop] = propTween.start; 7523 if (hidden) { 7524 propTween.end = propTween.start; 7525 propTween.start = 0; 7526 } 7527 } 7528 } 7529 } 7530 7531 function propFilter(props, specialEasing) { 7532 var index, name, easing, value, hooks; 7533 7534 // camelCase, specialEasing and expand cssHook pass 7535 for (index in props) { 7536 name = camelCase(index);
vendor: 32,831 bytes, lines 7537-8841
7537 easing = specialEasing[name]; 7538 value = props[index]; 7539 if (Array.isArray(value)) { 7540 easing = value[1]; 7541 value = props[index] = value[0]; 7542 } 7543 7544 if (index !== name) { 7545 props[name] = value; 7546 delete props[index]; 7547 } 7548 7549 hooks = jQuery.cssHooks[name]; 7550 if (hooks && "expand" in hooks) { 7551 value = hooks.expand(value); 7552 delete props[name]; 7553 7554 // Not quite $.extend, this won't overwrite existing keys. 7555 // Reusing 'index' because we have the correct "name" 7556 for (index in value) { 7557 if (!(index in props)) { 7558 props[index] = value[index]; 7559 specialEasing[index] = easing; 7560 } 7561 } 7562 } else { 7563 specialEasing[name] = easing; 7564 } 7565 } 7566 } 7567 7568 function Animation(elem, properties, options) { 7569 var result, 7570 stopped, 7571 index = 0, 7572 length = Animation.prefilters.length, 7573 deferred = jQuery.Deferred().always(function () { 7574 7575 // Don't match elem in the :animated selector 7576 delete tick.elem; 7577 }), 7578 tick = function () { 7579 if (stopped) { 7580 return false; 7581 } 7582 var currentTime = fxNow || createFxNow(), 7583 remaining = Math.max(0, animation.startTime + animation.duration - currentTime), 7584 7585 // Support: Android 2.3 only 7586 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) 7587 temp = remaining / animation.duration || 0, 7588 percent = 1 - temp, 7589 index = 0, 7590 length = animation.tweens.length; 7591 7592 for (; index < length; index++) { 7593 animation.tweens[index].run(percent); 7594 } 7595 7596 deferred.notifyWith(elem, [animation, percent, remaining]); 7597 7598 // If there's more to do, yield 7599 if (percent < 1 && length) { 7600 return remaining; 7601 } 7602 7603 // If this was an empty animation, synthesize a final progress notification 7604 if (!length) { 7605 deferred.notifyWith(elem, [animation, 1, 0]); 7606 } 7607 7608 // Resolve the animation and report its conclusion 7609 deferred.resolveWith(elem, [animation]); 7610 return false; 7611 }, 7612 animation = deferred.promise({ 7613 elem: elem, 7614 props: jQuery.extend({}, properties), 7615 opts: jQuery.extend(true, { 7616 specialEasing: {}, 7617 easing: jQuery.easing._default 7618 }, options), 7619 originalProperties: properties, 7620 originalOptions: options, 7621 startTime: fxNow || createFxNow(), 7622 duration: options.duration, 7623 tweens: [], 7624 createTween: function (prop, end) { 7625 var tween = jQuery.Tween(elem, animation.opts, prop, end, 7626 animation.opts.specialEasing[prop] || animation.opts.easing); 7627 animation.tweens.push(tween); 7628 return tween; 7629 }, 7630 stop: function (gotoEnd) { 7631 var index = 0, 7632 7633 // If we are going to the end, we want to run all the tweens 7634 // otherwise we skip this part 7635 length = gotoEnd ? animation.tweens.length : 0; 7636 if (stopped) { 7637 return this; 7638 } 7639 stopped = true; 7640 for (; index < length; index++) { 7641 animation.tweens[index].run(1); 7642 } 7643 7644 // Resolve when we played the last frame; otherwise, reject 7645 if (gotoEnd) { 7646 deferred.notifyWith(elem, [animation, 1, 0]); 7647 deferred.resolveWith(elem, [animation, gotoEnd]); 7648 } else { 7649 deferred.rejectWith(elem, [animation, gotoEnd]); 7650 } 7651 return this; 7652 } 7653 }), 7654 props = animation.props; 7655 7656 propFilter(props, animation.opts.specialEasing); 7657 7658 for (; index < length; index++) { 7659 result = Animation.prefilters[index].call(animation, elem, props, animation.opts); 7660 if (result) { 7661 if (isFunction(result.stop)) { 7662 jQuery._queueHooks(animation.elem, animation.opts.queue).stop = 7663 result.stop.bind(result); 7664 } 7665 return result; 7666 } 7667 } 7668 7669 jQuery.map(props, createTween, animation); 7670 7671 if (isFunction(animation.opts.start)) { 7672 animation.opts.start.call(elem, animation); 7673 } 7674 7675 // Attach callbacks from options 7676 animation 7677 .progress(animation.opts.progress) 7678 .done(animation.opts.done, animation.opts.complete) 7679 .fail(animation.opts.fail) 7680 .always(animation.opts.always); 7681 7682 jQuery.fx.timer( 7683 jQuery.extend(tick, { 7684 elem: elem, 7685 anim: animation, 7686 queue: animation.opts.queue 7687 }) 7688 ); 7689 7690 return animation; 7691 } 7692 7693 jQuery.Animation = jQuery.extend(Animation, { 7694 7695 tweeners: { 7696 "*": [function (prop, value) { 7697 var tween = this.createTween(prop, value); 7698 adjustCSS(tween.elem, prop, rcssNum.exec(value), tween); 7699 return tween; 7700 }] 7701 }, 7702 7703 tweener: function (props, callback) { 7704 if (isFunction(props)) { 7705 callback = props; 7706 props = ["*"]; 7707 } else { 7708 props = props.match(rnothtmlwhite); 7709 } 7710 7711 var prop, 7712 index = 0, 7713 length = props.length; 7714 7715 for (; index < length; index++) { 7716 prop = props[index]; 7717 Animation.tweeners[prop] = Animation.tweeners[prop] || []; 7718 Animation.tweeners[prop].unshift(callback); 7719 } 7720 }, 7721 7722 prefilters: [defaultPrefilter], 7723 7724 prefilter: function (callback, prepend) { 7725 if (prepend) { 7726 Animation.prefilters.unshift(callback); 7727 } else { 7728 Animation.prefilters.push(callback); 7729 } 7730 } 7731 }); 7732 7733 jQuery.speed = function (speed, easing, fn) { 7734 var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : { 7735 complete: fn || !fn && easing || 7736 isFunction(speed) && speed, 7737 duration: speed, 7738 easing: fn && easing || easing && !isFunction(easing) && easing 7739 }; 7740 7741 // Go to the end state if fx are off 7742 if (jQuery.fx.off) { 7743 opt.duration = 0; 7744 7745 } else { 7746 if (typeof opt.duration !== "number") { 7747 if (opt.duration in jQuery.fx.speeds) { 7748 opt.duration = jQuery.fx.speeds[opt.duration]; 7749 7750 } else { 7751 opt.duration = jQuery.fx.speeds._default; 7752 } 7753 } 7754 } 7755 7756 // Normalize opt.queue - true/undefined/null -> "fx" 7757 if (opt.queue == null || opt.queue === true) { 7758 opt.queue = "fx"; 7759 } 7760 7761 // Queueing 7762 opt.old = opt.complete; 7763 7764 opt.complete = function () { 7765 if (isFunction(opt.old)) { 7766 opt.old.call(this); 7767 } 7768 7769 if (opt.queue) { 7770 jQuery.dequeue(this, opt.queue); 7771 } 7772 }; 7773 7774 return opt; 7775 }; 7776 7777 jQuery.fn.extend({ 7778 fadeTo: function (speed, to, easing, callback) { 7779 7780 // Show any hidden elements after setting opacity to 0 7781 return this.filter(isHiddenWithinTree).css("opacity", 0).show() 7782 7783 // Animate to the value specified 7784 .end().animate({ opacity: to }, speed, easing, callback); 7785 }, 7786 animate: function (prop, speed, easing, callback) { 7787 var empty = jQuery.isEmptyObject(prop), 7788 optall = jQuery.speed(speed, easing, callback), 7789 doAnimation = function () { 7790 7791 // Operate on a copy of prop so per-property easing won't be lost 7792 var anim = Animation(this, jQuery.extend({}, prop), optall); 7793 7794 // Empty animations, or finishing resolves immediately 7795 if (empty || dataPriv.get(this, "finish")) { 7796 anim.stop(true); 7797 } 7798 }; 7799 doAnimation.finish = doAnimation; 7800 7801 return empty || optall.queue === false ? 7802 this.each(doAnimation) : 7803 this.queue(optall.queue, doAnimation); 7804 }, 7805 stop: function (type, clearQueue, gotoEnd) { 7806 var stopQueue = function (hooks) { 7807 var stop = hooks.stop; 7808 delete hooks.stop; 7809 stop(gotoEnd); 7810 }; 7811 7812 if (typeof type !== "string") { 7813 gotoEnd = clearQueue; 7814 clearQueue = type; 7815 type = undefined; 7816 } 7817 if (clearQueue) { 7818 this.queue(type || "fx", []); 7819 } 7820 7821 return this.each(function () { 7822 var dequeue = true, 7823 index = type != null && type + "queueHooks", 7824 timers = jQuery.timers, 7825 data = dataPriv.get(this); 7826 7827 if (index) { 7828 if (data[index] && data[index].stop) { 7829 stopQueue(data[index]); 7830 } 7831 } else { 7832 for (index in data) { 7833 if (data[index] && data[index].stop && rrun.test(index)) { 7834 stopQueue(data[index]); 7835 } 7836 } 7837 } 7838 7839 for (index = timers.length; index--;) { 7840 if (timers[index].elem === this && 7841 (type == null || timers[index].queue === type)) { 7842 7843 timers[index].anim.stop(gotoEnd); 7844 dequeue = false; 7845 timers.splice(index, 1); 7846 } 7847 } 7848 7849 // Start the next in the queue if the last step wasn't forced. 7850 // Timers currently will call their complete callbacks, which 7851 // will dequeue but only if they were gotoEnd. 7852 if (dequeue || !gotoEnd) { 7853 jQuery.dequeue(this, type); 7854 } 7855 }); 7856 }, 7857 finish: function (type) { 7858 if (type !== false) { 7859 type = type || "fx"; 7860 } 7861 return this.each(function () { 7862 var index, 7863 data = dataPriv.get(this), 7864 queue = data[type + "queue"], 7865 hooks = data[type + "queueHooks"], 7866 timers = jQuery.timers, 7867 length = queue ? queue.length : 0; 7868 7869 // Enable finishing flag on private data 7870 data.finish = true; 7871 7872 // Empty the queue first 7873 jQuery.queue(this, type, []); 7874 7875 if (hooks && hooks.stop) { 7876 hooks.stop.call(this, true); 7877 } 7878 7879 // Look for any active animations, and finish them 7880 for (index = timers.length; index--;) { 7881 if (timers[index].elem === this && timers[index].queue === type) { 7882 timers[index].anim.stop(true); 7883 timers.splice(index, 1); 7884 } 7885 } 7886 7887 // Look for any animations in the old queue and finish them 7888 for (index = 0; index < length; index++) { 7889 if (queue[index] && queue[index].finish) { 7890 queue[index].finish.call(this); 7891 } 7892 } 7893 7894 // Turn off finishing flag 7895 delete data.finish; 7896 }); 7897 } 7898 }); 7899 7900 jQuery.each(["toggle", "show", "hide"], function (_i, name) { 7901 var cssFn = jQuery.fn[name]; 7902 jQuery.fn[name] = function (speed, easing, callback) { 7903 return speed == null || typeof speed === "boolean" ? 7904 cssFn.apply(this, arguments) : 7905 this.animate(genFx(name, true), speed, easing, callback); 7906 }; 7907 }); 7908 7909 // Generate shortcuts for custom animations 7910 jQuery.each({ 7911 slideDown: genFx("show"), 7912 slideUp: genFx("hide"), 7913 slideToggle: genFx("toggle"), 7914 fadeIn: { opacity: "show" }, 7915 fadeOut: { opacity: "hide" }, 7916 fadeToggle: { opacity: "toggle" } 7917 }, function (name, props) { 7918 jQuery.fn[name] = function (speed, easing, callback) { 7919 return this.animate(props, speed, easing, callback); 7920 }; 7921 }); 7922 7923 jQuery.timers = []; 7924 jQuery.fx.tick = function () { 7925 var timer, 7926 i = 0, 7927 timers = jQuery.timers; 7928 7929 fxNow = Date.now(); 7930 7931 for (; i < timers.length; i++) { 7932 timer = timers[i]; 7933 7934 // Run the timer and safely remove it when done (allowing for external removal) 7935 if (!timer() && timers[i] === timer) { 7936 timers.splice(i--, 1); 7937 } 7938 } 7939 7940 if (!timers.length) { 7941 jQuery.fx.stop(); 7942 } 7943 fxNow = undefined; 7944 }; 7945 7946 jQuery.fx.timer = function (timer) { 7947 jQuery.timers.push(timer); 7948 jQuery.fx.start(); 7949 }; 7950 7951 jQuery.fx.interval = 13; 7952 jQuery.fx.start = function () { 7953 if (inProgress) { 7954 return; 7955 } 7956 7957 inProgress = true; 7958 schedule(); 7959 }; 7960 7961 jQuery.fx.stop = function () { 7962 inProgress = null; 7963 }; 7964 7965 jQuery.fx.speeds = { 7966 slow: 600, 7967 fast: 200, 7968 7969 // Default speed 7970 _default: 400 7971 }; 7972 7973 7974 // Based off of the plugin by Clint Helfers, with permission. 7975 // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/ 7976 jQuery.fn.delay = function (time, type) { 7977 time = jQuery.fx ? jQuery.fx.speeds[time] || time : time; 7978 type = type || "fx"; 7979 7980 return this.queue(type, function (next, hooks) { 7981 var timeout = window.setTimeout(next, time); 7982 hooks.stop = function () { 7983 window.clearTimeout(timeout); 7984 }; 7985 }); 7986 }; 7987 7988 7989 (function () { 7990 var input = document.createElement("input"), 7991 select = document.createElement("select"), 7992 opt = select.appendChild(document.createElement("option")); 7993 7994 input.type = "checkbox"; 7995 7996 // Support: Android <=4.3 only 7997 // Default value for a checkbox should be "on" 7998 support.checkOn = input.value !== ""; 7999 8000 // Support: IE <=11 only 8001 // Must access selectedIndex to make default options select 8002 support.optSelected = opt.selected; 8003 8004 // Support: IE <=11 only 8005 // An input loses its value after becoming a radio 8006 input = document.createElement("input"); 8007 input.value = "t"; 8008 input.type = "radio"; 8009 support.radioValue = input.value === "t"; 8010 })(); 8011 8012 8013 var boolHook, 8014 attrHandle = jQuery.expr.attrHandle; 8015 8016 jQuery.fn.extend({ 8017 attr: function (name, value) { 8018 return access(this, jQuery.attr, name, value, arguments.length > 1); 8019 }, 8020 8021 removeAttr: function (name) { 8022 return this.each(function () { 8023 jQuery.removeAttr(this, name); 8024 }); 8025 } 8026 }); 8027 8028 jQuery.extend({ 8029 attr: function (elem, name, value) { 8030 var ret, hooks, 8031 nType = elem.nodeType; 8032 8033 // Don't get/set attributes on text, comment and attribute nodes 8034 if (nType === 3 || nType === 8 || nType === 2) { 8035 return; 8036 } 8037 8038 // Fallback to prop when attributes are not supported 8039 if (typeof elem.getAttribute === "undefined") { 8040 return jQuery.prop(elem, name, value); 8041 } 8042 8043 // Attribute hooks are determined by the lowercase version 8044 // Grab necessary hook if one is defined 8045 if (nType !== 1 || !jQuery.isXMLDoc(elem)) { 8046 hooks = jQuery.attrHooks[name.toLowerCase()] || 8047 (jQuery.expr.match.bool.test(name) ? boolHook : undefined); 8048 } 8049 8050 if (value !== undefined) { 8051 if (value === null) { 8052 jQuery.removeAttr(elem, name); 8053 return; 8054 } 8055 8056 if (hooks && "set" in hooks && 8057 (ret = hooks.set(elem, value, name)) !== undefined) { 8058 return ret; 8059 } 8060 8061 elem.setAttribute(name, value + ""); 8062 return value; 8063 } 8064 8065 if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) { 8066 return ret; 8067 } 8068 8069 ret = jQuery.find.attr(elem, name); 8070 8071 // Non-existent attributes return null, we normalize to undefined 8072 return ret == null ? undefined : ret; 8073 }, 8074 8075 attrHooks: { 8076 type: { 8077 set: function (elem, value) { 8078 if (!support.radioValue && value === "radio" && 8079 nodeName(elem, "input")) { 8080 var val = elem.value; 8081 elem.setAttribute("type", value); 8082 if (val) { 8083 elem.value = val; 8084 } 8085 return value; 8086 } 8087 } 8088 } 8089 }, 8090 8091 removeAttr: function (elem, value) { 8092 var name, 8093 i = 0, 8094 8095 // Attribute names can contain non-HTML whitespace characters 8096 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 8097 attrNames = value && value.match(rnothtmlwhite); 8098 8099 if (attrNames && elem.nodeType === 1) { 8100 while ((name = attrNames[i++])) { 8101 elem.removeAttribute(name); 8102 } 8103 } 8104 } 8105 }); 8106 8107 // Hooks for boolean attributes 8108 boolHook = { 8109 set: function (elem, value, name) { 8110 if (value === false) { 8111 8112 // Remove boolean attributes when set to false 8113 jQuery.removeAttr(elem, name); 8114 } else { 8115 elem.setAttribute(name, name); 8116 } 8117 return name; 8118 } 8119 }; 8120 8121 jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (_i, name) { 8122 var getter = attrHandle[name] || jQuery.find.attr; 8123 8124 attrHandle[name] = function (elem, name, isXML) { 8125 var ret, handle, 8126 lowercaseName = name.toLowerCase(); 8127 8128 if (!isXML) { 8129 8130 // Avoid an infinite loop by temporarily removing this function from the getter 8131 handle = attrHandle[lowercaseName]; 8132 attrHandle[lowercaseName] = ret; 8133 ret = getter(elem, name, isXML) != null ? 8134 lowercaseName : 8135 null; 8136 attrHandle[lowercaseName] = handle; 8137 } 8138 return ret; 8139 }; 8140 }); 8141 8142 8143 8144 8145 var rfocusable = /^(?:input|select|textarea|button)$/i, 8146 rclickable = /^(?:a|area)$/i; 8147 8148 jQuery.fn.extend({ 8149 prop: function (name, value) { 8150 return access(this, jQuery.prop, name, value, arguments.length > 1); 8151 }, 8152 8153 removeProp: function (name) { 8154 return this.each(function () { 8155 delete this[jQuery.propFix[name] || name]; 8156 }); 8157 } 8158 }); 8159 8160 jQuery.extend({ 8161 prop: function (elem, name, value) { 8162 var ret, hooks, 8163 nType = elem.nodeType; 8164 8165 // Don't get/set properties on text, comment and attribute nodes 8166 if (nType === 3 || nType === 8 || nType === 2) { 8167 return; 8168 } 8169 8170 if (nType !== 1 || !jQuery.isXMLDoc(elem)) { 8171 8172 // Fix name and attach hooks 8173 name = jQuery.propFix[name] || name; 8174 hooks = jQuery.propHooks[name]; 8175 } 8176 8177 if (value !== undefined) { 8178 if (hooks && "set" in hooks && 8179 (ret = hooks.set(elem, value, name)) !== undefined) { 8180 return ret; 8181 } 8182 8183 return (elem[name] = value); 8184 } 8185 8186 if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) { 8187 return ret; 8188 } 8189 8190 return elem[name]; 8191 }, 8192 8193 propHooks: { 8194 tabIndex: { 8195 get: function (elem) { 8196 8197 // Support: IE <=9 - 11 only 8198 // elem.tabIndex doesn't always return the 8199 // correct value when it hasn't been explicitly set 8200 // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 8201 // Use proper attribute retrieval(#12072) 8202 var tabindex = jQuery.find.attr(elem, "tabindex"); 8203 8204 if (tabindex) { 8205 return parseInt(tabindex, 10); 8206 } 8207 8208 if ( 8209 rfocusable.test(elem.nodeName) || 8210 rclickable.test(elem.nodeName) && 8211 elem.href 8212 ) { 8213 return 0; 8214 } 8215 8216 return -1; 8217 } 8218 } 8219 }, 8220 8221 propFix: { 8222 "for": "htmlFor", 8223 "class": "className" 8224 } 8225 }); 8226 8227 // Support: IE <=11 only 8228 // Accessing the selectedIndex property 8229 // forces the browser to respect setting selected 8230 // on the option 8231 // The getter ensures a default option is selected 8232 // when in an optgroup 8233 // eslint rule "no-unused-expressions" is disabled for this code 8234 // since it considers such accessions noop 8235 if (!support.optSelected) { 8236 jQuery.propHooks.selected = { 8237 get: function (elem) { 8238 8239 /* eslint no-unused-expressions: "off" */ 8240 8241 var parent = elem.parentNode; 8242 if (parent && parent.parentNode) { 8243 parent.parentNode.selectedIndex; 8244 } 8245 return null; 8246 }, 8247 set: function (elem) { 8248 8249 /* eslint no-unused-expressions: "off" */ 8250 8251 var parent = elem.parentNode; 8252 if (parent) { 8253 parent.selectedIndex; 8254 8255 if (parent.parentNode) { 8256 parent.parentNode.selectedIndex; 8257 } 8258 } 8259 } 8260 }; 8261 } 8262 8263 jQuery.each([ 8264 "tabIndex", 8265 "readOnly", 8266 "maxLength", 8267 "cellSpacing", 8268 "cellPadding", 8269 "rowSpan", 8270 "colSpan", 8271 "useMap", 8272 "frameBorder", 8273 "contentEditable" 8274 ], function () { 8275 jQuery.propFix[this.toLowerCase()] = this; 8276 }); 8277 8278 8279 8280 8281 // Strip and collapse whitespace according to HTML spec 8282 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 8283 function stripAndCollapse(value) { 8284 var tokens = value.match(rnothtmlwhite) || []; 8285 return tokens.join(" "); 8286 } 8287 8288 8289 function getClass(elem) { 8290 return elem.getAttribute && elem.getAttribute("class") || ""; 8291 } 8292 8293 function classesToArray(value) { 8294 if (Array.isArray(value)) { 8295 return value; 8296 } 8297 if (typeof value === "string") { 8298 return value.match(rnothtmlwhite) || []; 8299 } 8300 return []; 8301 } 8302 8303 jQuery.fn.extend({ 8304 addClass: function (value) { 8305 var classes, elem, cur, curValue, clazz, j, finalValue, 8306 i = 0; 8307 8308 if (isFunction(value)) { 8309 return this.each(function (j) { 8310 jQuery(this).addClass(value.call(this, j, getClass(this))); 8311 }); 8312 } 8313 8314 classes = classesToArray(value); 8315 8316 if (classes.length) { 8317 while ((elem = this[i++])) { 8318 curValue = getClass(elem); 8319 cur = elem.nodeType === 1 && (" " + stripAndCollapse(curValue) + " "); 8320 8321 if (cur) { 8322 j = 0; 8323 while ((clazz = classes[j++])) { 8324 if (cur.indexOf(" " + clazz + " ") < 0) { 8325 cur += clazz + " "; 8326 } 8327 } 8328 8329 // Only assign if different to avoid unneeded rendering. 8330 finalValue = stripAndCollapse(cur); 8331 if (curValue !== finalValue) { 8332 elem.setAttribute("class", finalValue); 8333 } 8334 } 8335 } 8336 } 8337 8338 return this; 8339 }, 8340 8341 removeClass: function (value) { 8342 var classes, elem, cur, curValue, clazz, j, finalValue, 8343 i = 0; 8344 8345 if (isFunction(value)) { 8346 return this.each(function (j) { 8347 jQuery(this).removeClass(value.call(this, j, getClass(this))); 8348 }); 8349 } 8350 8351 if (!arguments.length) { 8352 return this.attr("class", ""); 8353 } 8354 8355 classes = classesToArray(value); 8356 8357 if (classes.length) { 8358 while ((elem = this[i++])) { 8359 curValue = getClass(elem); 8360 8361 // This expression is here for better compressibility (see addClass) 8362 cur = elem.nodeType === 1 && (" " + stripAndCollapse(curValue) + " "); 8363 8364 if (cur) { 8365 j = 0; 8366 while ((clazz = classes[j++])) { 8367 8368 // Remove *all* instances 8369 while (cur.indexOf(" " + clazz + " ") > -1) { 8370 cur = cur.replace(" " + clazz + " ", " "); 8371 } 8372 } 8373 8374 // Only assign if different to avoid unneeded rendering. 8375 finalValue = stripAndCollapse(cur); 8376 if (curValue !== finalValue) { 8377 elem.setAttribute("class", finalValue); 8378 } 8379 } 8380 } 8381 } 8382 8383 return this; 8384 }, 8385 8386 toggleClass: function (value, stateVal) { 8387 var type = typeof value, 8388 isValidValue = type === "string" || Array.isArray(value); 8389 8390 if (typeof stateVal === "boolean" && isValidValue) { 8391 return stateVal ? this.addClass(value) : this.removeClass(value); 8392 } 8393 8394 if (isFunction(value)) { 8395 return this.each(function (i) { 8396 jQuery(this).toggleClass( 8397 value.call(this, i, getClass(this), stateVal), 8398 stateVal 8399 ); 8400 }); 8401 } 8402 8403 return this.each(function () { 8404 var className, i, self, classNames; 8405 8406 if (isValidValue) { 8407 8408 // Toggle individual class names 8409 i = 0; 8410 self = jQuery(this); 8411 classNames = classesToArray(value); 8412 8413 while ((className = classNames[i++])) { 8414 8415 // Check each className given, space separated list 8416 if (self.hasClass(className)) { 8417 self.removeClass(className); 8418 } else { 8419 self.addClass(className); 8420 } 8421 } 8422 8423 // Toggle whole class name 8424 } else if (value === undefined || type === "boolean") { 8425 className = getClass(this); 8426 if (className) { 8427 8428 // Store className if set 8429 dataPriv.set(this, "__className__", className); 8430 } 8431 8432 // If the element has a class name or if we're passed `false`, 8433 // then remove the whole classname (if there was one, the above saved it). 8434 // Otherwise bring back whatever was previously saved (if anything), 8435 // falling back to the empty string if nothing was stored. 8436 if (this.setAttribute) { 8437 this.setAttribute("class", 8438 className || value === false ? 8439 "" : 8440 dataPriv.get(this, "__className__") || "" 8441 ); 8442 } 8443 } 8444 }); 8445 }, 8446 8447 hasClass: function (selector) { 8448 var className, elem, 8449 i = 0; 8450 8451 className = " " + selector + " "; 8452 while ((elem = this[i++])) { 8453 if (elem.nodeType === 1 && 8454 (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) { 8455 return true; 8456 } 8457 } 8458 8459 return false; 8460 } 8461 }); 8462 8463 8464 8465 8466 var rreturn = /\r/g; 8467 8468 jQuery.fn.extend({ 8469 val: function (value) { 8470 var hooks, ret, valueIsFunction, 8471 elem = this[0]; 8472 8473 if (!arguments.length) { 8474 if (elem) { 8475 hooks = jQuery.valHooks[elem.type] || 8476 jQuery.valHooks[elem.nodeName.toLowerCase()]; 8477 8478 if (hooks && 8479 "get" in hooks && 8480 (ret = hooks.get(elem, "value")) !== undefined 8481 ) { 8482 return ret; 8483 } 8484 8485 ret = elem.value; 8486 8487 // Handle most common string cases 8488 if (typeof ret === "string") { 8489 return ret.replace(rreturn, ""); 8490 } 8491 8492 // Handle cases where value is null/undef or number 8493 return ret == null ? "" : ret; 8494 } 8495 8496 return; 8497 } 8498 8499 valueIsFunction = isFunction(value); 8500 8501 return this.each(function (i) { 8502 var val; 8503 8504 if (this.nodeType !== 1) { 8505 return; 8506 } 8507 8508 if (valueIsFunction) { 8509 val = value.call(this, i, jQuery(this).val()); 8510 } else { 8511 val = value; 8512 } 8513 8514 // Treat null/undefined as ""; convert numbers to string 8515 if (val == null) { 8516 val = ""; 8517 8518 } else if (typeof val === "number") { 8519 val += ""; 8520 8521 } else if (Array.isArray(val)) { 8522 val = jQuery.map(val, function (value) { 8523 return value == null ? "" : value + ""; 8524 }); 8525 } 8526 8527 hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()]; 8528 8529 // If set returns undefined, fall back to normal setting 8530 if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) { 8531 this.value = val; 8532 } 8533 }); 8534 } 8535 }); 8536 8537 jQuery.extend({ 8538 valHooks: { 8539 option: { 8540 get: function (elem) { 8541 8542 var val = jQuery.find.attr(elem, "value"); 8543 return val != null ? 8544 val : 8545 8546 // Support: IE <=10 - 11 only 8547 // option.text throws exceptions (#14686, #14858) 8548 // Strip and collapse whitespace 8549 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 8550 stripAndCollapse(jQuery.text(elem)); 8551 } 8552 }, 8553 select: { 8554 get: function (elem) { 8555 var value, option, i, 8556 options = elem.options, 8557 index = elem.selectedIndex, 8558 one = elem.type === "select-one", 8559 values = one ? null : [], 8560 max = one ? index + 1 : options.length; 8561 8562 if (index < 0) { 8563 i = max; 8564 8565 } else { 8566 i = one ? index : 0; 8567 } 8568 8569 // Loop through all the selected options 8570 for (; i < max; i++) { 8571 option = options[i]; 8572 8573 // Support: IE <=9 only 8574 // IE8-9 doesn't update selected after form reset (#2551) 8575 if ((option.selected || i === index) && 8576 8577 // Don't return options that are disabled or in a disabled optgroup 8578 !option.disabled && 8579 (!option.parentNode.disabled || 8580 !nodeName(option.parentNode, "optgroup"))) { 8581 8582 // Get the specific value for the option 8583 value = jQuery(option).val(); 8584 8585 // We don't need an array for one selects 8586 if (one) { 8587 return value; 8588 } 8589 8590 // Multi-Selects return an array 8591 values.push(value); 8592 } 8593 } 8594 8595 return values; 8596 }, 8597 8598 set: function (elem, value) { 8599 var optionSet, option, 8600 options = elem.options, 8601 values = jQuery.makeArray(value), 8602 i = options.length; 8603 8604 while (i--) { 8605 option = options[i]; 8606 8607 /* eslint-disable no-cond-assign */ 8608 8609 if (option.selected = 8610 jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1 8611 ) { 8612 optionSet = true; 8613 } 8614 8615 /* eslint-enable no-cond-assign */ 8616 } 8617 8618 // Force browsers to behave consistently when non-matching value is set 8619 if (!optionSet) { 8620 elem.selectedIndex = -1; 8621 } 8622 return values; 8623 } 8624 } 8625 } 8626 }); 8627 8628 // Radios and checkboxes getter/setter 8629 jQuery.each(["radio", "checkbox"], function () { 8630 jQuery.valHooks[this] = { 8631 set: function (elem, value) { 8632 if (Array.isArray(value)) { 8633 return (elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1); 8634 } 8635 } 8636 }; 8637 if (!support.checkOn) { 8638 jQuery.valHooks[this].get = function (elem) { 8639 return elem.getAttribute("value") === null ? "on" : elem.value; 8640 }; 8641 } 8642 }); 8643 8644 8645 8646 8647 // Return jQuery for attributes-only inclusion 8648 8649 8650 support.focusin = "onfocusin" in window; 8651 8652 8653 var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 8654 stopPropagationCallback = function (e) { 8655 e.stopPropagation(); 8656 }; 8657 8658 jQuery.extend(jQuery.event, { 8659 8660 trigger: function (event, data, elem, onlyHandlers) { 8661 8662 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 8663 eventPath = [elem || document], 8664 type = hasOwn.call(event, "type") ? event.type : event, 8665 namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : []; 8666 8667 cur = lastElement = tmp = elem = elem || document; 8668 8669 // Don't do events on text and comment nodes 8670 if (elem.nodeType === 3 || elem.nodeType === 8) { 8671 return; 8672 } 8673 8674 // focus/blur morphs to focusin/out; ensure we're not firing them right now 8675 if (rfocusMorph.test(type + jQuery.event.triggered)) { 8676 return; 8677 } 8678 8679 if (type.indexOf(".") > -1) { 8680 8681 // Namespaced trigger; create a regexp to match event type in handle() 8682 namespaces = type.split("."); 8683 type = namespaces.shift(); 8684 namespaces.sort(); 8685 } 8686 ontype = type.indexOf(":") < 0 && "on" + type; 8687 8688 // Caller can pass in a jQuery.Event object, Object, or just an event type string 8689 event = event[jQuery.expando] ? 8690 event : 8691 new jQuery.Event(type, typeof event === "object" && event); 8692 8693 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 8694 event.isTrigger = onlyHandlers ? 2 : 3; 8695 event.namespace = namespaces.join("."); 8696 event.rnamespace = event.namespace ? 8697 new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : 8698 null; 8699 8700 // Clean up the event in case it is being reused 8701 event.result = undefined; 8702 if (!event.target) { 8703 event.target = elem; 8704 } 8705 8706 // Clone any incoming data and prepend the event, creating the handler arg list 8707 data = data == null ? 8708 [event] : 8709 jQuery.makeArray(data, [event]); 8710 8711 // Allow special events to draw outside the lines 8712 special = jQuery.event.special[type] || {}; 8713 if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) { 8714 return; 8715 } 8716 8717 // Determine event propagation path in advance, per W3C events spec (#9951) 8718 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 8719 if (!onlyHandlers && !special.noBubble && !isWindow(elem)) { 8720 8721 bubbleType = special.delegateType || type; 8722 if (!rfocusMorph.test(bubbleType + type)) { 8723 cur = cur.parentNode; 8724 } 8725 for (; cur; cur = cur.parentNode) { 8726 eventPath.push(cur); 8727 tmp = cur; 8728 } 8729 8730 // Only add window if we got to document (e.g., not plain obj or detached DOM) 8731 if (tmp === (elem.ownerDocument || document)) { 8732 eventPath.push(tmp.defaultView || tmp.parentWindow || window); 8733 } 8734 } 8735 8736 // Fire handlers on the event path 8737 i = 0; 8738 while ((cur = eventPath[i++]) && !event.isPropagationStopped()) { 8739 lastElement = cur; 8740 event.type = i > 1 ? 8741 bubbleType : 8742 special.bindType || type; 8743 8744 // jQuery handler 8745 handle = ( 8746 dataPriv.get(cur, "events") || Object.create(null) 8747 )[event.type] && 8748 dataPriv.get(cur, "handle"); 8749 if (handle) { 8750 handle.apply(cur, data); 8751 } 8752 8753 // Native handler 8754 handle = ontype && cur[ontype]; 8755 if (handle && handle.apply && acceptData(cur)) { 8756 event.result = handle.apply(cur, data); 8757 if (event.result === false) { 8758 event.preventDefault(); 8759 } 8760 } 8761 } 8762 event.type = type; 8763 8764 // If nobody prevented the default action, do it now 8765 if (!onlyHandlers && !event.isDefaultPrevented()) { 8766 8767 if ((!special._default || 8768 special._default.apply(eventPath.pop(), data) === false) && 8769 acceptData(elem)) { 8770 8771 // Call a native DOM method on the target with the same name as the event. 8772 // Don't do default actions on window, that's where global variables be (#6170) 8773 if (ontype && isFunction(elem[type]) && !isWindow(elem)) { 8774 8775 // Don't re-trigger an onFOO event when we call its FOO() method 8776 tmp = elem[ontype]; 8777 8778 if (tmp) { 8779 elem[ontype] = null; 8780 } 8781 8782 // Prevent re-triggering of the same event, since we already bubbled it above 8783 jQuery.event.triggered = type; 8784 8785 if (event.isPropagationStopped()) { 8786 lastElement.addEventListener(type, stopPropagationCallback); 8787 } 8788 8789 elem[type](); 8790 8791 if (event.isPropagationStopped()) { 8792 lastElement.removeEventListener(type, stopPropagationCallback); 8793 } 8794 8795 jQuery.event.triggered = undefined; 8796 8797 if (tmp) { 8798 elem[ontype] = tmp; 8799 } 8800 } 8801 } 8802 } 8803 8804 return event.result; 8805 }, 8806 8807 // Piggyback on a donor event to simulate a different one 8808 // Used only for `focus(in | out)` events 8809 simulate: function (type, elem, event) { 8810 var e = jQuery.extend( 8811 new jQuery.Event(), 8812 event, 8813 { 8814 type: type, 8815 isSimulated: true 8816 } 8817 ); 8818 8819 jQuery.event.trigger(e, null, elem); 8820 } 8821 8822 }); 8823 8824 jQuery.fn.extend({ 8825 8826 trigger: function (type, data) { 8827 return this.each(function () { 8828 jQuery.event.trigger(type, data, this); 8829 }); 8830 }, 8831 triggerHandler: function (type, data) { 8832 var elem = this[0]; 8833 if (elem) { 8834 return jQuery.event.trigger(type, data, elem, true); 8835 } 8836 } 8837 }); 8838 8839 8840 // Support: Firefox <=44 8841 // Firefox doesn't have focus(in | out) events
vendor: 1,396 bytes, lines 8842-8877
8842 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 8843 // 8844 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 8845 // focus(in | out) events fire after focus & blur events, 8846 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 8847 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 8848 if (!support.focusin) { 8849 jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) { 8850 8851 // Attach a single capturing handler on the document while someone wants focusin/focusout 8852 var handler = function (event) { 8853 jQuery.event.simulate(fix, event.target, jQuery.event.fix(event)); 8854 }; 8855 8856 jQuery.event.special[fix] = { 8857 setup: function () { 8858 8859 // Handle: regular nodes (via `this.ownerDocument`), window 8860 // (via `this.document`) & document (via `this`). 8861 var doc = this.ownerDocument || this.document || this, 8862 attaches = dataPriv.access(doc, fix); 8863 8864 if (!attaches) { 8865 doc.addEventListener(orig, handler, true); 8866 } 8867 dataPriv.access(doc, fix, (attaches || 0) + 1); 8868 }, 8869 teardown: function () { 8870 var doc = this.ownerDocument || this.document || this, 8871 attaches = dataPriv.access(doc, fix) - 1; 8872 8873 if (!attaches) { 8874 doc.removeEventListener(orig, handler, true); 8875 dataPriv.remove(doc, fix); 8876 8877 } else {
vendor: 9,105 bytes, lines 8878-9216
8878 dataPriv.access(doc, fix, attaches); 8879 } 8880 } 8881 }; 8882 }); 8883 } 8884 var location = window.location; 8885 8886 var nonce = { guid: Date.now() }; 8887 8888 var rquery = (/\?/); 8889 8890 8891 8892 // Cross-browser xml parsing 8893 jQuery.parseXML = function (data) { 8894 var xml; 8895 if (!data || typeof data !== "string") { 8896 return null; 8897 } 8898 8899 // Support: IE 9 - 11 only 8900 // IE throws on parseFromString with invalid input. 8901 try { 8902 xml = (new window.DOMParser()).parseFromString(data, "text/xml"); 8903 } catch (e) { 8904 xml = undefined; 8905 } 8906 8907 if (!xml || xml.getElementsByTagName("parsererror").length) { 8908 jQuery.error("Invalid XML: " + data); 8909 } 8910 return xml; 8911 }; 8912 8913 8914 var 8915 rbracket = /\[\]$/, 8916 rCRLF = /\r?\n/g, 8917 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 8918 rsubmittable = /^(?:input|select|textarea|keygen)/i; 8919 8920 function buildParams(prefix, obj, traditional, add) { 8921 var name; 8922 8923 if (Array.isArray(obj)) { 8924 8925 // Serialize array item. 8926 jQuery.each(obj, function (i, v) { 8927 if (traditional || rbracket.test(prefix)) { 8928 8929 // Treat each array item as a scalar. 8930 add(prefix, v); 8931 8932 } else { 8933 8934 // Item is non-scalar (array or object), encode its numeric index. 8935 buildParams( 8936 prefix + "[" + (typeof v === "object" && v != null ? i : "") + "]", 8937 v, 8938 traditional, 8939 add 8940 ); 8941 } 8942 }); 8943 8944 } else if (!traditional && toType(obj) === "object") { 8945 8946 // Serialize object item. 8947 for (name in obj) { 8948 buildParams(prefix + "[" + name + "]", obj[name], traditional, add); 8949 } 8950 8951 } else { 8952 8953 // Serialize scalar item. 8954 add(prefix, obj); 8955 } 8956 } 8957 8958 // Serialize an array of form elements or a set of 8959 // key/values into a query string 8960 jQuery.param = function (a, traditional) { 8961 var prefix, 8962 s = [], 8963 add = function (key, valueOrFunction) { 8964 8965 // If value is a function, invoke it and use its return value 8966 var value = isFunction(valueOrFunction) ? 8967 valueOrFunction() : 8968 valueOrFunction; 8969 8970 s[s.length] = encodeURIComponent(key) + "=" + 8971 encodeURIComponent(value == null ? "" : value); 8972 }; 8973 8974 if (a == null) { 8975 return ""; 8976 } 8977 8978 // If an array was passed in, assume that it is an array of form elements. 8979 if (Array.isArray(a) || (a.jquery && !jQuery.isPlainObject(a))) { 8980 8981 // Serialize the form elements 8982 jQuery.each(a, function () { 8983 add(this.name, this.value); 8984 }); 8985 8986 } else { 8987 8988 // If traditional, encode the "old" way (the way 1.3.2 or older 8989 // did it), otherwise encode params recursively. 8990 for (prefix in a) { 8991 buildParams(prefix, a[prefix], traditional, add); 8992 } 8993 } 8994 8995 // Return the resulting serialization 8996 return s.join("&"); 8997 }; 8998 8999 jQuery.fn.extend({ 9000 serialize: function () { 9001 return jQuery.param(this.serializeArray()); 9002 }, 9003 serializeArray: function () { 9004 return this.map(function () { 9005 9006 // Can add propHook for "elements" to filter or add form elements 9007 var elements = jQuery.prop(this, "elements"); 9008 return elements ? jQuery.makeArray(elements) : this; 9009 }) 9010 .filter(function () { 9011 var type = this.type; 9012 9013 // Use .is( ":disabled" ) so that fieldset[disabled] works 9014 return this.name && !jQuery(this).is(":disabled") && 9015 rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && 9016 (this.checked || !rcheckableType.test(type)); 9017 }) 9018 .map(function (_i, elem) { 9019 var val = jQuery(this).val(); 9020 9021 if (val == null) { 9022 return null; 9023 } 9024 9025 if (Array.isArray(val)) { 9026 return jQuery.map(val, function (val) { 9027 return { name: elem.name, value: val.replace(rCRLF, "\r\n") }; 9028 }); 9029 } 9030 9031 return { name: elem.name, value: val.replace(rCRLF, "\r\n") }; 9032 }).get(); 9033 } 9034 }); 9035 9036 9037 var 9038 r20 = /%20/g, 9039 rhash = /#.*$/, 9040 rantiCache = /([?&])_=[^&]*/, 9041 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 9042 9043 // #7653, #8125, #8152: local protocol detection 9044 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 9045 rnoContent = /^(?:GET|HEAD)$/, 9046 rprotocol = /^\/\//, 9047 9048 /* Prefilters 9049 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 9050 * 2) These are called: 9051 * - BEFORE asking for a transport 9052 * - AFTER param serialization (s.data is a string if s.processData is true) 9053 * 3) key is the dataType 9054 * 4) the catchall symbol "*" can be used 9055 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 9056 */ 9057 prefilters = {}, 9058 9059 /* Transports bindings 9060 * 1) key is the dataType 9061 * 2) the catchall symbol "*" can be used 9062 * 3) selection will start with transport dataType and THEN go to "*" if needed 9063 */ 9064 transports = {}, 9065 9066 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 9067 allTypes = "*/".concat("*"), 9068 9069 // Anchor tag for parsing the document origin 9070 originAnchor = document.createElement("a"); 9071 originAnchor.href = location.href; 9072 9073 // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 9074 function addToPrefiltersOrTransports(structure) { 9075 9076 // dataTypeExpression is optional and defaults to "*" 9077 return function (dataTypeExpression, func) { 9078 9079 if (typeof dataTypeExpression !== "string") { 9080 func = dataTypeExpression; 9081 dataTypeExpression = "*"; 9082 } 9083 9084 var dataType, 9085 i = 0, 9086 dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || []; 9087 9088 if (isFunction(func)) { 9089 9090 // For each dataType in the dataTypeExpression 9091 while ((dataType = dataTypes[i++])) { 9092 9093 // Prepend if requested 9094 if (dataType[0] === "+") { 9095 dataType = dataType.slice(1) || "*"; 9096 (structure[dataType] = structure[dataType] || []).unshift(func); 9097 9098 // Otherwise append 9099 } else { 9100 (structure[dataType] = structure[dataType] || []).push(func); 9101 } 9102 } 9103 } 9104 }; 9105 } 9106 9107 // Base inspection function for prefilters and transports 9108 function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) { 9109 9110 var inspected = {}, 9111 seekingTransport = (structure === transports); 9112 9113 function inspect(dataType) { 9114 var selected; 9115 inspected[dataType] = true; 9116 jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) { 9117 var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR); 9118 if (typeof dataTypeOrTransport === "string" && 9119 !seekingTransport && !inspected[dataTypeOrTransport]) { 9120 9121 options.dataTypes.unshift(dataTypeOrTransport); 9122 inspect(dataTypeOrTransport); 9123 return false; 9124 } else if (seekingTransport) { 9125 return !(selected = dataTypeOrTransport); 9126 } 9127 }); 9128 return selected; 9129 } 9130 9131 return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*"); 9132 } 9133 9134 // A special extend for ajax options 9135 // that takes "flat" options (not to be deep extended) 9136 // Fixes #9887 9137 function ajaxExtend(target, src) { 9138 var key, deep, 9139 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 9140 9141 for (key in src) { 9142 if (src[key] !== undefined) { 9143 (flatOptions[key] ? target : (deep || (deep = {})))[key] = src[key]; 9144 } 9145 } 9146 if (deep) { 9147 jQuery.extend(true, target, deep); 9148 } 9149 9150 return target; 9151 } 9152 9153 /* Handles responses to an ajax request: 9154 * - finds the right dataType (mediates between content-type and expected dataType) 9155 * - returns the corresponding response 9156 */ 9157 function ajaxHandleResponses(s, jqXHR, responses) { 9158 9159 var ct, type, finalDataType, firstDataType, 9160 contents = s.contents, 9161 dataTypes = s.dataTypes; 9162 9163 // Remove auto dataType and get content-type in the process 9164 while (dataTypes[0] === "*") { 9165 dataTypes.shift(); 9166 if (ct === undefined) { 9167 ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); 9168 } 9169 } 9170 9171 // Check if we're dealing with a known content-type 9172 if (ct) { 9173 for (type in contents) { 9174 if (contents[type] && contents[type].test(ct)) { 9175 dataTypes.unshift(type); 9176 break; 9177 } 9178 } 9179 } 9180 9181 // Check to see if we have a response for the expected dataType 9182 if (dataTypes[0] in responses) { 9183 finalDataType = dataTypes[0]; 9184 } else { 9185 9186 // Try convertible dataTypes 9187 for (type in responses) { 9188 if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) { 9189 finalDataType = type; 9190 break; 9191 } 9192 if (!firstDataType) { 9193 firstDataType = type; 9194 } 9195 } 9196 9197 // Or just use first one 9198 finalDataType = finalDataType || firstDataType; 9199 } 9200 9201 // If we found a dataType 9202 // We add the dataType to the list if needed 9203 // and return the corresponding response 9204 if (finalDataType) { 9205 if (finalDataType !== dataTypes[0]) { 9206 dataTypes.unshift(finalDataType); 9207 } 9208 return responses[finalDataType]; 9209 } 9210 } 9211 9212 /* Chain conversions given the request and the original response 9213 * Also sets the responseXXX fields on the jqXHR instance 9214 */ 9215 function ajaxConvert(s, response, jqXHR, isSuccess) { 9216 var conv2, current, conv, tmp, prev,
vendor: 8,924 bytes, lines 9217-9564
9217 converters = {}, 9218 9219 // Work with a copy of dataTypes in case we need to modify it for conversion 9220 dataTypes = s.dataTypes.slice(); 9221 9222 // Create converters map with lowercased keys 9223 if (dataTypes[1]) { 9224 for (conv in s.converters) { 9225 converters[conv.toLowerCase()] = s.converters[conv]; 9226 } 9227 } 9228 9229 current = dataTypes.shift(); 9230 9231 // Convert to each sequential dataType 9232 while (current) { 9233 9234 if (s.responseFields[current]) { 9235 jqXHR[s.responseFields[current]] = response; 9236 } 9237 9238 // Apply the dataFilter if provided 9239 if (!prev && isSuccess && s.dataFilter) { 9240 response = s.dataFilter(response, s.dataType); 9241 } 9242 9243 prev = current; 9244 current = dataTypes.shift(); 9245 9246 if (current) { 9247 9248 // There's only work to do if current dataType is non-auto 9249 if (current === "*") { 9250 9251 current = prev; 9252 9253 // Convert response if prev dataType is non-auto and differs from current 9254 } else if (prev !== "*" && prev !== current) { 9255 9256 // Seek a direct converter 9257 conv = converters[prev + " " + current] || converters["* " + current]; 9258 9259 // If none found, seek a pair 9260 if (!conv) { 9261 for (conv2 in converters) { 9262 9263 // If conv2 outputs current 9264 tmp = conv2.split(" "); 9265 if (tmp[1] === current) { 9266 9267 // If prev can be converted to accepted input 9268 conv = converters[prev + " " + tmp[0]] || 9269 converters["* " + tmp[0]]; 9270 if (conv) { 9271 9272 // Condense equivalence converters 9273 if (conv === true) { 9274 conv = converters[conv2]; 9275 9276 // Otherwise, insert the intermediate dataType 9277 } else if (converters[conv2] !== true) { 9278 current = tmp[0]; 9279 dataTypes.unshift(tmp[1]); 9280 } 9281 break; 9282 } 9283 } 9284 } 9285 } 9286 9287 // Apply converter (if not an equivalence) 9288 if (conv !== true) { 9289 9290 // Unless errors are allowed to bubble, catch and return them 9291 if (conv && s.throws) { 9292 response = conv(response); 9293 } else { 9294 try { 9295 response = conv(response); 9296 } catch (e) { 9297 return { 9298 state: "parsererror", 9299 error: conv ? e : "No conversion from " + prev + " to " + current 9300 }; 9301 } 9302 } 9303 } 9304 } 9305 } 9306 } 9307 9308 return { state: "success", data: response }; 9309 } 9310 9311 jQuery.extend({ 9312 9313 // Counter for holding the number of active queries 9314 active: 0, 9315 9316 // Last-Modified header cache for next request 9317 lastModified: {}, 9318 etag: {}, 9319 9320 ajaxSettings: { 9321 url: location.href, 9322 type: "GET", 9323 isLocal: rlocalProtocol.test(location.protocol), 9324 global: true, 9325 processData: true, 9326 async: true, 9327 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 9328 9329 /* 9330 timeout: 0, 9331 data: null, 9332 dataType: null, 9333 username: null, 9334 password: null, 9335 cache: null, 9336 throws: false, 9337 traditional: false, 9338 headers: {}, 9339 */ 9340 9341 accepts: { 9342 "*": allTypes, 9343 text: "text/plain", 9344 html: "text/html", 9345 xml: "application/xml, text/xml", 9346 json: "application/json, text/javascript" 9347 }, 9348 9349 contents: { 9350 xml: /\bxml\b/, 9351 html: /\bhtml/, 9352 json: /\bjson\b/ 9353 }, 9354 9355 responseFields: { 9356 xml: "responseXML", 9357 text: "responseText", 9358 json: "responseJSON" 9359 }, 9360 9361 // Data converters 9362 // Keys separate source (or catchall "*") and destination types with a single space 9363 converters: { 9364 9365 // Convert anything to text 9366 "* text": String, 9367 9368 // Text to html (true = no transformation) 9369 "text html": true, 9370 9371 // Evaluate text as a json expression 9372 "text json": JSON.parse, 9373 9374 // Parse text as xml 9375 "text xml": jQuery.parseXML 9376 }, 9377 9378 // For options that shouldn't be deep extended: 9379 // you can add your own custom options here if 9380 // and when you create one that shouldn't be 9381 // deep extended (see ajaxExtend) 9382 flatOptions: { 9383 url: true, 9384 context: true 9385 } 9386 }, 9387 9388 // Creates a full fledged settings object into target 9389 // with both ajaxSettings and settings fields. 9390 // If target is omitted, writes into ajaxSettings. 9391 ajaxSetup: function (target, settings) { 9392 return settings ? 9393 9394 // Building a settings object 9395 ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) : 9396 9397 // Extending ajaxSettings 9398 ajaxExtend(jQuery.ajaxSettings, target); 9399 }, 9400 9401 ajaxPrefilter: addToPrefiltersOrTransports(prefilters), 9402 ajaxTransport: addToPrefiltersOrTransports(transports), 9403 9404 // Main method 9405 ajax: function (url, options) { 9406 9407 // If url is an object, simulate pre-1.5 signature 9408 if (typeof url === "object") { 9409 options = url; 9410 url = undefined; 9411 } 9412 9413 // Force options to be an object 9414 options = options || {}; 9415 9416 var transport, 9417 9418 // URL without anti-cache param 9419 cacheURL, 9420 9421 // Response headers 9422 responseHeadersString, 9423 responseHeaders, 9424 9425 // timeout handle 9426 timeoutTimer, 9427 9428 // Url cleanup var 9429 urlAnchor, 9430 9431 // Request state (becomes false upon send and true upon completion) 9432 completed, 9433 9434 // To know if global events are to be dispatched 9435 fireGlobals, 9436 9437 // Loop variable 9438 i, 9439 9440 // uncached part of the url 9441 uncached, 9442 9443 // Create the final options object 9444 s = jQuery.ajaxSetup({}, options), 9445 9446 // Callbacks context 9447 callbackContext = s.context || s, 9448 9449 // Context for global events is callbackContext if it is a DOM node or jQuery collection 9450 globalEventContext = s.context && 9451 (callbackContext.nodeType || callbackContext.jquery) ? 9452 jQuery(callbackContext) : 9453 jQuery.event, 9454 9455 // Deferreds 9456 deferred = jQuery.Deferred(), 9457 completeDeferred = jQuery.Callbacks("once memory"), 9458 9459 // Status-dependent callbacks 9460 statusCode = s.statusCode || {}, 9461 9462 // Headers (they are sent all at once) 9463 requestHeaders = {}, 9464 requestHeadersNames = {}, 9465 9466 // Default abort message 9467 strAbort = "canceled", 9468 9469 // Fake xhr 9470 jqXHR = { 9471 readyState: 0, 9472 9473 // Builds headers hashtable if needed 9474 getResponseHeader: function (key) { 9475 var match; 9476 if (completed) { 9477 if (!responseHeaders) { 9478 responseHeaders = {}; 9479 while ((match = rheaders.exec(responseHeadersString))) { 9480 responseHeaders[match[1].toLowerCase() + " "] = 9481 (responseHeaders[match[1].toLowerCase() + " "] || []) 9482 .concat(match[2]); 9483 } 9484 } 9485 match = responseHeaders[key.toLowerCase() + " "]; 9486 } 9487 return match == null ? null : match.join(", "); 9488 }, 9489 9490 // Raw string 9491 getAllResponseHeaders: function () { 9492 return completed ? responseHeadersString : null; 9493 }, 9494 9495 // Caches the header 9496 setRequestHeader: function (name, value) { 9497 if (completed == null) { 9498 name = requestHeadersNames[name.toLowerCase()] = 9499 requestHeadersNames[name.toLowerCase()] || name; 9500 requestHeaders[name] = value; 9501 } 9502 return this; 9503 }, 9504 9505 // Overrides response content-type header 9506 overrideMimeType: function (type) { 9507 if (completed == null) { 9508 s.mimeType = type; 9509 } 9510 return this; 9511 }, 9512 9513 // Status-dependent callbacks 9514 statusCode: function (map) { 9515 var code; 9516 if (map) { 9517 if (completed) { 9518 9519 // Execute the appropriate callbacks 9520 jqXHR.always(map[jqXHR.status]); 9521 } else { 9522 9523 // Lazy-add the new callbacks in a way that preserves old ones 9524 for (code in map) { 9525 statusCode[code] = [statusCode[code], map[code]]; 9526 } 9527 } 9528 } 9529 return this; 9530 }, 9531 9532 // Cancel the request 9533 abort: function (statusText) { 9534 var finalText = statusText || strAbort; 9535 if (transport) { 9536 transport.abort(finalText); 9537 } 9538 done(0, finalText); 9539 return this; 9540 } 9541 }; 9542 9543 // Attach deferreds 9544 deferred.promise(jqXHR); 9545 9546 // Add protocol if not provided (prefilters might expect it) 9547 // Handle falsy url in the settings object (#10093: consistency with old signature) 9548 // We also use the url parameter if available 9549 s.url = ((url || s.url || location.href) + "") 9550 .replace(rprotocol, location.protocol + "//"); 9551 9552 // Alias method option to type as per ticket #12004 9553 s.type = options.method || options.type || s.method || s.type; 9554 9555 // Extract dataTypes list 9556 s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""]; 9557 9558 // A cross-domain request is in order when the origin doesn't match the current origin. 9559 if (s.crossDomain == null) { 9560 urlAnchor = document.createElement("a"); 9561 9562 // Support: IE <=8 - 11, Edge 12 - 15 9563 // IE throws exception on accessing the href property if url is malformed, 9564 // e.g. http://example.com:80x/
vendor: 37,496 bytes, lines 9565-10911
9565 try { 9566 urlAnchor.href = s.url; 9567 9568 // Support: IE <=8 - 11 only 9569 // Anchor's host property isn't correctly set when s.url is relative 9570 urlAnchor.href = urlAnchor.href; 9571 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 9572 urlAnchor.protocol + "//" + urlAnchor.host; 9573 } catch (e) { 9574 9575 // If there is an error parsing the URL, assume it is crossDomain, 9576 // it can be rejected by the transport if it is invalid 9577 s.crossDomain = true; 9578 } 9579 } 9580 9581 // Convert data if not already a string 9582 if (s.data && s.processData && typeof s.data !== "string") { 9583 s.data = jQuery.param(s.data, s.traditional); 9584 } 9585 9586 // Apply prefilters 9587 inspectPrefiltersOrTransports(prefilters, s, options, jqXHR); 9588 9589 // If request was aborted inside a prefilter, stop there 9590 if (completed) { 9591 return jqXHR; 9592 } 9593 9594 // We can fire global events as of now if asked to 9595 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) 9596 fireGlobals = jQuery.event && s.global; 9597 9598 // Watch for a new set of requests 9599 if (fireGlobals && jQuery.active++ === 0) { 9600 jQuery.event.trigger("ajaxStart"); 9601 } 9602 9603 // Uppercase the type 9604 s.type = s.type.toUpperCase(); 9605 9606 // Determine if request has content 9607 s.hasContent = !rnoContent.test(s.type); 9608 9609 // Save the URL in case we're toying with the If-Modified-Since 9610 // and/or If-None-Match header later on 9611 // Remove hash to simplify url manipulation 9612 cacheURL = s.url.replace(rhash, ""); 9613 9614 // More options handling for requests with no content 9615 if (!s.hasContent) { 9616 9617 // Remember the hash so we can put it back 9618 uncached = s.url.slice(cacheURL.length); 9619 9620 // If data is available and should be processed, append data to url 9621 if (s.data && (s.processData || typeof s.data === "string")) { 9622 cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data; 9623 9624 // #9682: remove data so that it's not used in an eventual retry 9625 delete s.data; 9626 } 9627 9628 // Add or update anti-cache param if needed 9629 if (s.cache === false) { 9630 cacheURL = cacheURL.replace(rantiCache, "$1"); 9631 uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + (nonce.guid++) + 9632 uncached; 9633 } 9634 9635 // Put hash and anti-cache on the URL that will be requested (gh-1732) 9636 s.url = cacheURL + uncached; 9637 9638 // Change '%20' to '+' if this is encoded form body content (gh-2658) 9639 } else if (s.data && s.processData && 9640 (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) { 9641 s.data = s.data.replace(r20, "+"); 9642 } 9643 9644 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9645 if (s.ifModified) { 9646 if (jQuery.lastModified[cacheURL]) { 9647 jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]); 9648 } 9649 if (jQuery.etag[cacheURL]) { 9650 jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]); 9651 } 9652 } 9653 9654 // Set the correct header, if data is being sent 9655 if (s.data && s.hasContent && s.contentType !== false || options.contentType) { 9656 jqXHR.setRequestHeader("Content-Type", s.contentType); 9657 } 9658 9659 // Set the Accepts header for the server, depending on the dataType 9660 jqXHR.setRequestHeader( 9661 "Accept", 9662 s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? 9663 s.accepts[s.dataTypes[0]] + 9664 (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : 9665 s.accepts["*"] 9666 ); 9667 9668 // Check for headers option 9669 for (i in s.headers) { 9670 jqXHR.setRequestHeader(i, s.headers[i]); 9671 } 9672 9673 // Allow custom headers/mimetypes and early abort 9674 if (s.beforeSend && 9675 (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) { 9676 9677 // Abort if not done already and return 9678 return jqXHR.abort(); 9679 } 9680 9681 // Aborting is no longer a cancellation 9682 strAbort = "abort"; 9683 9684 // Install callbacks on deferreds 9685 completeDeferred.add(s.complete); 9686 jqXHR.done(s.success); 9687 jqXHR.fail(s.error); 9688 9689 // Get transport 9690 transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR); 9691 9692 // If no transport, we auto-abort 9693 if (!transport) { 9694 done(-1, "No Transport"); 9695 } else { 9696 jqXHR.readyState = 1; 9697 9698 // Send global event 9699 if (fireGlobals) { 9700 globalEventContext.trigger("ajaxSend", [jqXHR, s]); 9701 } 9702 9703 // If request was aborted inside ajaxSend, stop there 9704 if (completed) { 9705 return jqXHR; 9706 } 9707 9708 // Timeout 9709 if (s.async && s.timeout > 0) { 9710 timeoutTimer = window.setTimeout(function () { 9711 jqXHR.abort("timeout"); 9712 }, s.timeout); 9713 } 9714 9715 try { 9716 completed = false; 9717 transport.send(requestHeaders, done); 9718 } catch (e) { 9719 9720 // Rethrow post-completion exceptions 9721 if (completed) { 9722 throw e; 9723 } 9724 9725 // Propagate others as results 9726 done(-1, e); 9727 } 9728 } 9729 9730 // Callback for when everything is done 9731 function done(status, nativeStatusText, responses, headers) { 9732 var isSuccess, success, error, response, modified, 9733 statusText = nativeStatusText; 9734 9735 // Ignore repeat invocations 9736 if (completed) { 9737 return; 9738 } 9739 9740 completed = true; 9741 9742 // Clear timeout if it exists 9743 if (timeoutTimer) { 9744 window.clearTimeout(timeoutTimer); 9745 } 9746 9747 // Dereference transport for early garbage collection 9748 // (no matter how long the jqXHR object will be used) 9749 transport = undefined; 9750 9751 // Cache response headers 9752 responseHeadersString = headers || ""; 9753 9754 // Set readyState 9755 jqXHR.readyState = status > 0 ? 4 : 0; 9756 9757 // Determine if successful 9758 isSuccess = status >= 200 && status < 300 || status === 304; 9759 9760 // Get response data 9761 if (responses) { 9762 response = ajaxHandleResponses(s, jqXHR, responses); 9763 } 9764 9765 // Use a noop converter for missing script 9766 if (!isSuccess && jQuery.inArray("script", s.dataTypes) > -1) { 9767 s.converters["text script"] = function () { }; 9768 } 9769 9770 // Convert no matter what (that way responseXXX fields are always set) 9771 response = ajaxConvert(s, response, jqXHR, isSuccess); 9772 9773 // If successful, handle type chaining 9774 if (isSuccess) { 9775 9776 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9777 if (s.ifModified) { 9778 modified = jqXHR.getResponseHeader("Last-Modified"); 9779 if (modified) { 9780 jQuery.lastModified[cacheURL] = modified; 9781 } 9782 modified = jqXHR.getResponseHeader("etag"); 9783 if (modified) { 9784 jQuery.etag[cacheURL] = modified; 9785 } 9786 } 9787 9788 // if no content 9789 if (status === 204 || s.type === "HEAD") { 9790 statusText = "nocontent"; 9791 9792 // if not modified 9793 } else if (status === 304) { 9794 statusText = "notmodified"; 9795 9796 // If we have data, let's convert it 9797 } else { 9798 statusText = response.state; 9799 success = response.data; 9800 error = response.error; 9801 isSuccess = !error; 9802 } 9803 } else { 9804 9805 // Extract error from statusText and normalize for non-aborts 9806 error = statusText; 9807 if (status || !statusText) { 9808 statusText = "error"; 9809 if (status < 0) { 9810 status = 0; 9811 } 9812 } 9813 } 9814 9815 // Set data for the fake xhr object 9816 jqXHR.status = status; 9817 jqXHR.statusText = (nativeStatusText || statusText) + ""; 9818 9819 // Success/Error 9820 if (isSuccess) { 9821 deferred.resolveWith(callbackContext, [success, statusText, jqXHR]); 9822 } else { 9823 deferred.rejectWith(callbackContext, [jqXHR, statusText, error]); 9824 } 9825 9826 // Status-dependent callbacks 9827 jqXHR.statusCode(statusCode); 9828 statusCode = undefined; 9829 9830 if (fireGlobals) { 9831 globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", 9832 [jqXHR, s, isSuccess ? success : error]); 9833 } 9834 9835 // Complete 9836 completeDeferred.fireWith(callbackContext, [jqXHR, statusText]); 9837 9838 if (fireGlobals) { 9839 globalEventContext.trigger("ajaxComplete", [jqXHR, s]); 9840 9841 // Handle the global AJAX counter 9842 if (!(--jQuery.active)) { 9843 jQuery.event.trigger("ajaxStop"); 9844 } 9845 } 9846 } 9847 9848 return jqXHR; 9849 }, 9850 9851 getJSON: function (url, data, callback) { 9852 return jQuery.get(url, data, callback, "json"); 9853 }, 9854 9855 getScript: function (url, callback) { 9856 return jQuery.get(url, undefined, callback, "script"); 9857 } 9858 }); 9859 9860 jQuery.each(["get", "post"], function (_i, method) { 9861 jQuery[method] = function (url, data, callback, type) { 9862 9863 // Shift arguments if data argument was omitted 9864 if (isFunction(data)) { 9865 type = type || callback; 9866 callback = data; 9867 data = undefined; 9868 } 9869 9870 // The url can be an options object (which then must have .url) 9871 return jQuery.ajax(jQuery.extend({ 9872 url: url, 9873 type: method, 9874 dataType: type, 9875 data: data, 9876 success: callback 9877 }, jQuery.isPlainObject(url) && url)); 9878 }; 9879 }); 9880 9881 jQuery.ajaxPrefilter(function (s) { 9882 var i; 9883 for (i in s.headers) { 9884 if (i.toLowerCase() === "content-type") { 9885 s.contentType = s.headers[i] || ""; 9886 } 9887 } 9888 }); 9889 9890 9891 jQuery._evalUrl = function (url, options, doc) { 9892 return jQuery.ajax({ 9893 url: url, 9894 9895 // Make this explicit, since user can override this through ajaxSetup (#11264) 9896 type: "GET", 9897 dataType: "script", 9898 cache: true, 9899 async: false, 9900 global: false, 9901 9902 // Only evaluate the response if it is successful (gh-4126) 9903 // dataFilter is not invoked for failure responses, so using it instead 9904 // of the default converter is kludgy but it works. 9905 converters: { 9906 "text script": function () { } 9907 }, 9908 dataFilter: function (response) { 9909 jQuery.globalEval(response, options, doc); 9910 } 9911 }); 9912 }; 9913 9914 9915 jQuery.fn.extend({ 9916 wrapAll: function (html) { 9917 var wrap; 9918 9919 if (this[0]) { 9920 if (isFunction(html)) { 9921 html = html.call(this[0]); 9922 } 9923 9924 // The elements to wrap the target around 9925 wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true); 9926 9927 if (this[0].parentNode) { 9928 wrap.insertBefore(this[0]); 9929 } 9930 9931 wrap.map(function () { 9932 var elem = this; 9933 9934 while (elem.firstElementChild) { 9935 elem = elem.firstElementChild; 9936 } 9937 9938 return elem; 9939 }).append(this); 9940 } 9941 9942 return this; 9943 }, 9944 9945 wrapInner: function (html) { 9946 if (isFunction(html)) { 9947 return this.each(function (i) { 9948 jQuery(this).wrapInner(html.call(this, i)); 9949 }); 9950 } 9951 9952 return this.each(function () { 9953 var self = jQuery(this), 9954 contents = self.contents(); 9955 9956 if (contents.length) { 9957 contents.wrapAll(html); 9958 9959 } else { 9960 self.append(html); 9961 } 9962 }); 9963 }, 9964 9965 wrap: function (html) { 9966 var htmlIsFunction = isFunction(html); 9967 9968 return this.each(function (i) { 9969 jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html); 9970 }); 9971 }, 9972 9973 unwrap: function (selector) { 9974 this.parent(selector).not("body").each(function () { 9975 jQuery(this).replaceWith(this.childNodes); 9976 }); 9977 return this; 9978 } 9979 }); 9980 9981 9982 jQuery.expr.pseudos.hidden = function (elem) { 9983 return !jQuery.expr.pseudos.visible(elem); 9984 }; 9985 jQuery.expr.pseudos.visible = function (elem) { 9986 return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length); 9987 }; 9988 9989 9990 9991 9992 jQuery.ajaxSettings.xhr = function () { 9993 try { 9994 return new window.XMLHttpRequest(); 9995 } catch (e) { } 9996 }; 9997 9998 var xhrSuccessStatus = { 9999 10000 // File protocol always yields status code 0, assume 200 10001 0: 200, 10002 10003 // Support: IE <=9 only 10004 // #1450: sometimes IE returns 1223 when it should be 204 10005 1223: 204 10006 }, 10007 xhrSupported = jQuery.ajaxSettings.xhr(); 10008 10009 support.cors = !!xhrSupported && ("withCredentials" in xhrSupported); 10010 support.ajax = xhrSupported = !!xhrSupported; 10011 10012 jQuery.ajaxTransport(function (options) { 10013 var callback, errorCallback; 10014 10015 // Cross domain only allowed if supported through XMLHttpRequest 10016 if (support.cors || xhrSupported && !options.crossDomain) { 10017 return { 10018 send: function (headers, complete) { 10019 var i, 10020 xhr = options.xhr(); 10021 10022 xhr.open( 10023 options.type, 10024 options.url, 10025 options.async, 10026 options.username, 10027 options.password 10028 ); 10029 10030 // Apply custom fields if provided 10031 if (options.xhrFields) { 10032 for (i in options.xhrFields) { 10033 xhr[i] = options.xhrFields[i]; 10034 } 10035 } 10036 10037 // Override mime type if needed 10038 if (options.mimeType && xhr.overrideMimeType) { 10039 xhr.overrideMimeType(options.mimeType); 10040 } 10041 10042 // X-Requested-With header 10043 // For cross-domain requests, seeing as conditions for a preflight are 10044 // akin to a jigsaw puzzle, we simply never set it to be sure. 10045 // (it can always be set on a per-request basis or even using ajaxSetup) 10046 // For same-domain requests, won't change header if already provided. 10047 if (!options.crossDomain && !headers["X-Requested-With"]) { 10048 headers["X-Requested-With"] = "XMLHttpRequest"; 10049 } 10050 10051 // Set headers 10052 for (i in headers) { 10053 xhr.setRequestHeader(i, headers[i]); 10054 } 10055 10056 // Callback 10057 callback = function (type) { 10058 return function () { 10059 if (callback) { 10060 callback = errorCallback = xhr.onload = 10061 xhr.onerror = xhr.onabort = xhr.ontimeout = 10062 xhr.onreadystatechange = null; 10063 10064 if (type === "abort") { 10065 xhr.abort(); 10066 } else if (type === "error") { 10067 10068 // Support: IE <=9 only 10069 // On a manual native abort, IE9 throws 10070 // errors on any property access that is not readyState 10071 if (typeof xhr.status !== "number") { 10072 complete(0, "error"); 10073 } else { 10074 complete( 10075 10076 // File: protocol always yields status 0; see #8605, #14207 10077 xhr.status, 10078 xhr.statusText 10079 ); 10080 } 10081 } else { 10082 complete( 10083 xhrSuccessStatus[xhr.status] || xhr.status, 10084 xhr.statusText, 10085 10086 // Support: IE <=9 only 10087 // IE9 has no XHR2 but throws on binary (trac-11426) 10088 // For XHR2 non-text, let the caller handle it (gh-2498) 10089 (xhr.responseType || "text") !== "text" || 10090 typeof xhr.responseText !== "string" ? 10091 { binary: xhr.response } : 10092 { text: xhr.responseText }, 10093 xhr.getAllResponseHeaders() 10094 ); 10095 } 10096 } 10097 }; 10098 }; 10099 10100 // Listen to events 10101 xhr.onload = callback(); 10102 errorCallback = xhr.onerror = xhr.ontimeout = callback("error"); 10103 10104 // Support: IE 9 only 10105 // Use onreadystatechange to replace onabort 10106 // to handle uncaught aborts 10107 if (xhr.onabort !== undefined) { 10108 xhr.onabort = errorCallback; 10109 } else { 10110 xhr.onreadystatechange = function () { 10111 10112 // Check readyState before timeout as it changes 10113 if (xhr.readyState === 4) { 10114 10115 // Allow onerror to be called first, 10116 // but that will not handle a native abort 10117 // Also, save errorCallback to a variable 10118 // as xhr.onerror cannot be accessed 10119 window.setTimeout(function () { 10120 if (callback) { 10121 errorCallback(); 10122 } 10123 }); 10124 } 10125 }; 10126 } 10127 10128 // Create the abort callback 10129 callback = callback("abort"); 10130 10131 try { 10132 10133 // Do send the request (this may raise an exception) 10134 xhr.send(options.hasContent && options.data || null); 10135 } catch (e) { 10136 10137 // #14683: Only rethrow if this hasn't been notified as an error yet 10138 if (callback) { 10139 throw e; 10140 } 10141 } 10142 }, 10143 10144 abort: function () { 10145 if (callback) { 10146 callback(); 10147 } 10148 } 10149 }; 10150 } 10151 }); 10152 10153 10154 10155 10156 // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 10157 jQuery.ajaxPrefilter(function (s) { 10158 if (s.crossDomain) { 10159 s.contents.script = false; 10160 } 10161 }); 10162 10163 // Install script dataType 10164 jQuery.ajaxSetup({ 10165 accepts: { 10166 script: "text/javascript, application/javascript, " + 10167 "application/ecmascript, application/x-ecmascript" 10168 }, 10169 contents: { 10170 script: /\b(?:java|ecma)script\b/ 10171 }, 10172 converters: { 10173 "text script": function (text) { 10174 jQuery.globalEval(text); 10175 return text; 10176 } 10177 } 10178 }); 10179 10180 // Handle cache's special case and crossDomain 10181 jQuery.ajaxPrefilter("script", function (s) { 10182 if (s.cache === undefined) { 10183 s.cache = false; 10184 } 10185 if (s.crossDomain) { 10186 s.type = "GET"; 10187 } 10188 }); 10189 10190 // Bind script tag hack transport 10191 jQuery.ajaxTransport("script", function (s) { 10192 10193 // This transport only deals with cross domain or forced-by-attrs requests 10194 if (s.crossDomain || s.scriptAttrs) { 10195 var script, callback; 10196 return { 10197 send: function (_, complete) { 10198 script = jQuery("<script>") 10199 .attr(s.scriptAttrs || {}) 10200 .prop({ charset: s.scriptCharset, src: s.url }) 10201 .on("load error", callback = function (evt) { 10202 script.remove(); 10203 callback = null; 10204 if (evt) { 10205 complete(evt.type === "error" ? 404 : 200, evt.type); 10206 } 10207 }); 10208 10209 // Use native DOM manipulation to avoid our domManip AJAX trickery 10210 document.head.appendChild(script[0]); 10211 }, 10212 abort: function () { 10213 if (callback) { 10214 callback(); 10215 } 10216 } 10217 }; 10218 } 10219 }); 10220 10221 10222 10223 10224 var oldCallbacks = [], 10225 rjsonp = /(=)\?(?=&|$)|\?\?/; 10226 10227 // Default jsonp settings 10228 jQuery.ajaxSetup({ 10229 jsonp: "callback", 10230 jsonpCallback: function () { 10231 var callback = oldCallbacks.pop() || (jQuery.expando + "_" + (nonce.guid++)); 10232 this[callback] = true; 10233 return callback; 10234 } 10235 }); 10236 10237 // Detect, normalize options and install callbacks for jsonp requests 10238 jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) { 10239 10240 var callbackName, overwritten, responseContainer, 10241 jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? 10242 "url" : 10243 typeof s.data === "string" && 10244 (s.contentType || "") 10245 .indexOf("application/x-www-form-urlencoded") === 0 && 10246 rjsonp.test(s.data) && "data" 10247 ); 10248 10249 // Handle iff the expected data type is "jsonp" or we have a parameter to set 10250 if (jsonProp || s.dataTypes[0] === "jsonp") { 10251 10252 // Get callback name, remembering preexisting value associated with it 10253 callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ? 10254 s.jsonpCallback() : 10255 s.jsonpCallback; 10256 10257 // Insert callback into url or form data 10258 if (jsonProp) { 10259 s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName); 10260 } else if (s.jsonp !== false) { 10261 s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName; 10262 } 10263 10264 // Use data converter to retrieve json after script execution 10265 s.converters["script json"] = function () { 10266 if (!responseContainer) { 10267 jQuery.error(callbackName + " was not called"); 10268 } 10269 return responseContainer[0]; 10270 }; 10271 10272 // Force json dataType 10273 s.dataTypes[0] = "json"; 10274 10275 // Install callback 10276 overwritten = window[callbackName]; 10277 window[callbackName] = function () { 10278 responseContainer = arguments; 10279 }; 10280 10281 // Clean-up function (fires after converters) 10282 jqXHR.always(function () { 10283 10284 // If previous value didn't exist - remove it 10285 if (overwritten === undefined) { 10286 jQuery(window).removeProp(callbackName); 10287 10288 // Otherwise restore preexisting value 10289 } else { 10290 window[callbackName] = overwritten; 10291 } 10292 10293 // Save back as free 10294 if (s[callbackName]) { 10295 10296 // Make sure that re-using the options doesn't screw things around 10297 s.jsonpCallback = originalSettings.jsonpCallback; 10298 10299 // Save the callback name for future use 10300 oldCallbacks.push(callbackName); 10301 } 10302 10303 // Call if it was a function and we have a response 10304 if (responseContainer && isFunction(overwritten)) { 10305 overwritten(responseContainer[0]); 10306 } 10307 10308 responseContainer = overwritten = undefined; 10309 }); 10310 10311 // Delegate to script 10312 return "script"; 10313 } 10314 }); 10315 10316 10317 10318 10319 // Support: Safari 8 only 10320 // In Safari 8 documents created via document.implementation.createHTMLDocument 10321 // collapse sibling forms: the second one becomes a child of the first one. 10322 // Because of that, this security measure has to be disabled in Safari 8. 10323 // https://bugs.webkit.org/show_bug.cgi?id=137337 10324 support.createHTMLDocument = (function () { 10325 var body = document.implementation.createHTMLDocument("").body; 10326 body.innerHTML = "<form></form><form></form>"; 10327 return body.childNodes.length === 2; 10328 })(); 10329 10330 10331 // Argument "data" should be string of html 10332 // context (optional): If specified, the fragment will be created in this context, 10333 // defaults to document 10334 // keepScripts (optional): If true, will include scripts passed in the html string 10335 jQuery.parseHTML = function (data, context, keepScripts) { 10336 if (typeof data !== "string") { 10337 return []; 10338 } 10339 if (typeof context === "boolean") { 10340 keepScripts = context; 10341 context = false; 10342 } 10343 10344 var base, parsed, scripts; 10345 10346 if (!context) { 10347 10348 // Stop scripts or inline event handlers from being executed immediately 10349 // by using document.implementation 10350 if (support.createHTMLDocument) { 10351 context = document.implementation.createHTMLDocument(""); 10352 10353 // Set the base href for the created document 10354 // so any parsed elements with URLs 10355 // are based on the document's URL (gh-2965) 10356 base = context.createElement("base"); 10357 base.href = document.location.href; 10358 context.head.appendChild(base); 10359 } else { 10360 context = document; 10361 } 10362 } 10363 10364 parsed = rsingleTag.exec(data); 10365 scripts = !keepScripts && []; 10366 10367 // Single tag 10368 if (parsed) { 10369 return [context.createElement(parsed[1])]; 10370 } 10371 10372 parsed = buildFragment([data], context, scripts); 10373 10374 if (scripts && scripts.length) { 10375 jQuery(scripts).remove(); 10376 } 10377 10378 return jQuery.merge([], parsed.childNodes); 10379 }; 10380 10381 10382 /** 10383 * Load a url into a page 10384 */ 10385 jQuery.fn.load = function (url, params, callback) { 10386 var selector, type, response, 10387 self = this, 10388 off = url.indexOf(" "); 10389 10390 if (off > -1) { 10391 selector = stripAndCollapse(url.slice(off)); 10392 url = url.slice(0, off); 10393 } 10394 10395 // If it's a function 10396 if (isFunction(params)) { 10397 10398 // We assume that it's the callback 10399 callback = params; 10400 params = undefined; 10401 10402 // Otherwise, build a param string 10403 } else if (params && typeof params === "object") { 10404 type = "POST"; 10405 } 10406 10407 // If we have elements to modify, make the request 10408 if (self.length > 0) { 10409 jQuery.ajax({ 10410 url: url, 10411 10412 // If "type" variable is undefined, then "GET" method will be used. 10413 // Make value of this field explicit since 10414 // user can override it through ajaxSetup method 10415 type: type || "GET", 10416 dataType: "html", 10417 data: params 10418 }).done(function (responseText) { 10419 10420 // Save response for use in complete callback 10421 response = arguments; 10422 10423 self.html(selector ? 10424 10425 // If a selector was specified, locate the right elements in a dummy div 10426 // Exclude scripts to avoid IE 'Permission Denied' errors 10427 jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) : 10428 10429 // Otherwise use the full result 10430 responseText); 10431 10432 // If the request succeeds, this function gets "data", "status", "jqXHR" 10433 // but they are ignored because response was set above. 10434 // If it fails, this function gets "jqXHR", "status", "error" 10435 }).always(callback && function (jqXHR, status) { 10436 self.each(function () { 10437 callback.apply(this, response || [jqXHR.responseText, status, jqXHR]); 10438 }); 10439 }); 10440 } 10441 10442 return this; 10443 }; 10444 10445 10446 10447 10448 jQuery.expr.pseudos.animated = function (elem) { 10449 return jQuery.grep(jQuery.timers, function (fn) { 10450 return elem === fn.elem; 10451 }).length; 10452 }; 10453 10454 10455 10456 10457 jQuery.offset = { 10458 setOffset: function (elem, options, i) { 10459 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 10460 position = jQuery.css(elem, "position"), 10461 curElem = jQuery(elem), 10462 props = {}; 10463 10464 // Set position first, in-case top/left are set even on static elem 10465 if (position === "static") { 10466 elem.style.position = "relative"; 10467 } 10468 10469 curOffset = curElem.offset(); 10470 curCSSTop = jQuery.css(elem, "top"); 10471 curCSSLeft = jQuery.css(elem, "left"); 10472 calculatePosition = (position === "absolute" || position === "fixed") && 10473 (curCSSTop + curCSSLeft).indexOf("auto") > -1; 10474 10475 // Need to be able to calculate position if either 10476 // top or left is auto and position is either absolute or fixed 10477 if (calculatePosition) { 10478 curPosition = curElem.position(); 10479 curTop = curPosition.top; 10480 curLeft = curPosition.left; 10481 10482 } else { 10483 curTop = parseFloat(curCSSTop) || 0; 10484 curLeft = parseFloat(curCSSLeft) || 0; 10485 } 10486 10487 if (isFunction(options)) { 10488 10489 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 10490 options = options.call(elem, i, jQuery.extend({}, curOffset)); 10491 } 10492 10493 if (options.top != null) { 10494 props.top = (options.top - curOffset.top) + curTop; 10495 } 10496 if (options.left != null) { 10497 props.left = (options.left - curOffset.left) + curLeft; 10498 } 10499 10500 if ("using" in options) { 10501 options.using.call(elem, props); 10502 10503 } else { 10504 if (typeof props.top === "number") { 10505 props.top += "px"; 10506 } 10507 if (typeof props.left === "number") { 10508 props.left += "px"; 10509 } 10510 curElem.css(props); 10511 } 10512 } 10513 }; 10514 10515 jQuery.fn.extend({ 10516 10517 // offset() relates an element's border box to the document origin 10518 offset: function (options) { 10519 10520 // Preserve chaining for setter 10521 if (arguments.length) { 10522 return options === undefined ? 10523 this : 10524 this.each(function (i) { 10525 jQuery.offset.setOffset(this, options, i); 10526 }); 10527 } 10528 10529 var rect, win, 10530 elem = this[0]; 10531 10532 if (!elem) { 10533 return; 10534 } 10535 10536 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 10537 // Support: IE <=11 only 10538 // Running getBoundingClientRect on a 10539 // disconnected node in IE throws an error 10540 if (!elem.getClientRects().length) { 10541 return { top: 0, left: 0 }; 10542 } 10543 10544 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 10545 rect = elem.getBoundingClientRect(); 10546 win = elem.ownerDocument.defaultView; 10547 return { 10548 top: rect.top + win.pageYOffset, 10549 left: rect.left + win.pageXOffset 10550 }; 10551 }, 10552 10553 // position() relates an element's margin box to its offset parent's padding box 10554 // This corresponds to the behavior of CSS absolute positioning 10555 position: function () { 10556 if (!this[0]) { 10557 return; 10558 } 10559 10560 var offsetParent, offset, doc, 10561 elem = this[0], 10562 parentOffset = { top: 0, left: 0 }; 10563 10564 // position:fixed elements are offset from the viewport, which itself always has zero offset 10565 if (jQuery.css(elem, "position") === "fixed") { 10566 10567 // Assume position:fixed implies availability of getBoundingClientRect 10568 offset = elem.getBoundingClientRect(); 10569 10570 } else { 10571 offset = this.offset(); 10572 10573 // Account for the *real* offset parent, which can be the document or its root element 10574 // when a statically positioned element is identified 10575 doc = elem.ownerDocument; 10576 offsetParent = elem.offsetParent || doc.documentElement; 10577 while (offsetParent && 10578 (offsetParent === doc.body || offsetParent === doc.documentElement) && 10579 jQuery.css(offsetParent, "position") === "static") { 10580 10581 offsetParent = offsetParent.parentNode; 10582 } 10583 if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) { 10584 10585 // Incorporate borders into its offset, since they are outside its content origin 10586 parentOffset = jQuery(offsetParent).offset(); 10587 parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true); 10588 parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true); 10589 } 10590 } 10591 10592 // Subtract parent offsets and element margins 10593 return { 10594 top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true), 10595 left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true) 10596 }; 10597 }, 10598 10599 // This method will return documentElement in the following cases: 10600 // 1) For the element inside the iframe without offsetParent, this method will return 10601 // documentElement of the parent window 10602 // 2) For the hidden or detached element 10603 // 3) For body or html element, i.e. in case of the html node - it will return itself 10604 // 10605 // but those exceptions were never presented as a real life use-cases 10606 // and might be considered as more preferable results. 10607 // 10608 // This logic, however, is not guaranteed and can change at any point in the future 10609 offsetParent: function () { 10610 return this.map(function () { 10611 var offsetParent = this.offsetParent; 10612 10613 while (offsetParent && jQuery.css(offsetParent, "position") === "static") { 10614 offsetParent = offsetParent.offsetParent; 10615 } 10616 10617 return offsetParent || documentElement; 10618 }); 10619 } 10620 }); 10621 10622 // Create scrollLeft and scrollTop methods 10623 jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (method, prop) { 10624 var top = "pageYOffset" === prop; 10625 10626 jQuery.fn[method] = function (val) { 10627 return access(this, function (elem, method, val) { 10628 10629 // Coalesce documents and windows 10630 var win; 10631 if (isWindow(elem)) { 10632 win = elem; 10633 } else if (elem.nodeType === 9) { 10634 win = elem.defaultView; 10635 } 10636 10637 if (val === undefined) { 10638 return win ? win[prop] : elem[method]; 10639 } 10640 10641 if (win) { 10642 win.scrollTo( 10643 !top ? val : win.pageXOffset, 10644 top ? val : win.pageYOffset 10645 ); 10646 10647 } else { 10648 elem[method] = val; 10649 } 10650 }, method, val, arguments.length); 10651 }; 10652 }); 10653 10654 // Support: Safari <=7 - 9.1, Chrome <=37 - 49 10655 // Add the top/left cssHooks using jQuery.fn.position 10656 // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 10657 // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 10658 // getComputedStyle returns percent when specified for top/left/bottom/right; 10659 // rather than make the css module depend on the offset module, just check for it here 10660 jQuery.each(["top", "left"], function (_i, prop) { 10661 jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, 10662 function (elem, computed) { 10663 if (computed) { 10664 computed = curCSS(elem, prop); 10665 10666 // If curCSS returns percentage, fallback to offset 10667 return rnumnonpx.test(computed) ? 10668 jQuery(elem).position()[prop] + "px" : 10669 computed; 10670 } 10671 } 10672 ); 10673 }); 10674 10675 10676 // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 10677 jQuery.each({ Height: "height", Width: "width" }, function (name, type) { 10678 jQuery.each({ padding: "inner" + name, content: type, "": "outer" + name }, 10679 function (defaultExtra, funcName) { 10680 10681 // Margin is only for outerHeight, outerWidth 10682 jQuery.fn[funcName] = function (margin, value) { 10683 var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"), 10684 extra = defaultExtra || (margin === true || value === true ? "margin" : "border"); 10685 10686 return access(this, function (elem, type, value) { 10687 var doc; 10688 10689 if (isWindow(elem)) { 10690 10691 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 10692 return funcName.indexOf("outer") === 0 ? 10693 elem["inner" + name] : 10694 elem.document.documentElement["client" + name]; 10695 } 10696 10697 // Get document width or height 10698 if (elem.nodeType === 9) { 10699 doc = elem.documentElement; 10700 10701 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 10702 // whichever is greatest 10703 return Math.max( 10704 elem.body["scroll" + name], doc["scroll" + name], 10705 elem.body["offset" + name], doc["offset" + name], 10706 doc["client" + name] 10707 ); 10708 } 10709 10710 return value === undefined ? 10711 10712 // Get width or height on the element, requesting but not forcing parseFloat 10713 jQuery.css(elem, type, extra) : 10714 10715 // Set width or height on the element 10716 jQuery.style(elem, type, value, extra); 10717 }, type, chainable ? margin : undefined, chainable); 10718 }; 10719 }); 10720 }); 10721 10722 10723 jQuery.each([ 10724 "ajaxStart", 10725 "ajaxStop", 10726 "ajaxComplete", 10727 "ajaxError", 10728 "ajaxSuccess", 10729 "ajaxSend" 10730 ], function (_i, type) { 10731 jQuery.fn[type] = function (fn) { 10732 return this.on(type, fn); 10733 }; 10734 }); 10735 10736 10737 10738 10739 jQuery.fn.extend({ 10740 10741 bind: function (types, data, fn) { 10742 return this.on(types, null, data, fn); 10743 }, 10744 unbind: function (types, fn) { 10745 return this.off(types, null, fn); 10746 }, 10747 10748 delegate: function (selector, types, data, fn) { 10749 return this.on(types, selector, data, fn); 10750 }, 10751 undelegate: function (selector, types, fn) { 10752 10753 // ( namespace ) or ( selector, types [, fn] ) 10754 return arguments.length === 1 ? 10755 this.off(selector, "**") : 10756 this.off(types, selector || "**", fn); 10757 }, 10758 10759 hover: function (fnOver, fnOut) { 10760 return this.mouseenter(fnOver).mouseleave(fnOut || fnOver); 10761 } 10762 }); 10763 10764 jQuery.each(("blur focus focusin focusout resize scroll click dblclick " + 10765 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 10766 "change select submit keydown keypress keyup contextmenu").split(" "), 10767 function (_i, name) { 10768 10769 // Handle event binding 10770 jQuery.fn[name] = function (data, fn) { 10771 return arguments.length > 0 ? 10772 this.on(name, null, data, fn) : 10773 this.trigger(name); 10774 }; 10775 }); 10776 10777 10778 10779 10780 // Support: Android <=4.0 only 10781 // Make sure we trim BOM and NBSP 10782 var rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g; 10783 10784 // Bind a function to a context, optionally partially applying any 10785 // arguments. 10786 // jQuery.proxy is deprecated to promote standards (specifically Function#bind) 10787 // However, it is not slated for removal any time soon 10788 jQuery.proxy = function (fn, context) { 10789 var tmp, args, proxy; 10790 10791 if (typeof context === "string") { 10792 tmp = fn[context]; 10793 context = fn; 10794 fn = tmp; 10795 } 10796 10797 // Quick check to determine if target is callable, in the spec 10798 // this throws a TypeError, but we will just return undefined. 10799 if (!isFunction(fn)) { 10800 return undefined; 10801 } 10802 10803 // Simulated bind 10804 args = slice.call(arguments, 2); 10805 proxy = function () { 10806 return fn.apply(context || this, args.concat(slice.call(arguments))); 10807 }; 10808 10809 // Set the guid of unique handler to the same of original handler, so it can be removed 10810 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 10811 10812 return proxy; 10813 }; 10814 10815 jQuery.holdReady = function (hold) { 10816 if (hold) { 10817 jQuery.readyWait++; 10818 } else { 10819 jQuery.ready(true); 10820 } 10821 }; 10822 jQuery.isArray = Array.isArray; 10823 jQuery.parseJSON = JSON.parse; 10824 jQuery.nodeName = nodeName; 10825 jQuery.isFunction = isFunction; 10826 jQuery.isWindow = isWindow; 10827 jQuery.camelCase = camelCase; 10828 jQuery.type = toType; 10829 10830 jQuery.now = Date.now; 10831 10832 jQuery.isNumeric = function (obj) { 10833 10834 // As of jQuery 3.0, isNumeric is limited to 10835 // strings and numbers (primitives or objects) 10836 // that can be coerced to finite numbers (gh-2662) 10837 var type = jQuery.type(obj); 10838 return (type === "number" || type === "string") && 10839 10840 // parseFloat NaNs numeric-cast false positives ("") 10841 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 10842 // subtraction forces infinities to NaN 10843 !isNaN(obj - parseFloat(obj)); 10844 }; 10845 10846 jQuery.trim = function (text) { 10847 return text == null ? 10848 "" : 10849 (text + "").replace(rtrim, ""); 10850 }; 10851 10852 10853 10854 // Register as a named AMD module, since jQuery can be concatenated with other 10855 // files that may use define, but not via a proper concatenation script that 10856 // understands anonymous AMD modules. A named AMD is safest and most robust 10857 // way to register. Lowercase jquery is used because AMD module names are 10858 // derived from file names, and jQuery is normally delivered in a lowercase 10859 // file name. Do this after creating the global so that if an AMD module wants 10860 // to call noConflict to hide this version of jQuery, it will work. 10861 10862 // Note that for maximum portability, libraries that are not jQuery should 10863 // declare themselves as anonymous modules, and avoid setting a global if an 10864 // AMD loader is present. jQuery is a special case. For more information, see 10865 // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 10866 10867 if (typeof define === "function" && define.amd) { 10868 define("jquery", [], function () { 10869 return jQuery; 10870 }); 10871 } 10872 10873 10874 10875 10876 var 10877 10878 // Map over jQuery in case of overwrite 10879 _jQuery = window.jQuery, 10880 10881 // Map over the $ in case of overwrite 10882 _$ = window.$; 10883 10884 jQuery.noConflict = function (deep) { 10885 if (window.$ === jQuery) { 10886 window.$ = _$; 10887 } 10888 10889 if (deep && window.jQuery === jQuery) { 10890 window.jQuery = _jQuery; 10891 } 10892 10893 return jQuery; 10894 }; 10895 10896 // Expose jQuery and $ identifiers, even in AMD 10897 // (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 10898 // and CommonJS for browser emulators (#13566) 10899 if (typeof noGlobal === "undefined") { 10900 window.jQuery = window.$ = jQuery; 10901 } 10902 10903 10904 10905 10906 return jQuery; 10907}); 10908 10909; 10910/* NUGET: BEGIN LICENSE TEXT 10911*
10912* Microsoft grants you the right to use these script files for the sole 10913* purpose of either: (i) interacting through your browser with the Microsoft 10914* website or online service, subject to the applicable licensing or use 10915* terms; or (ii) using the files as included with a Microsoft product subject 10916* to that product's license terms. Microsoft reserves all other rights to the 10917* files not expressly granted by Microsoft, whether by implication, estoppel 10918* or otherwise. Insofar as a script file is dual licensed under GPL, 10919* Microsoft neither took the code under GPL nor distributes it thereunder but 10920* under the terms set out in this paragraph. All notices and licenses 10921* below are for informational purposes only. 10922* 10923* NUGET: END LICENSE TEXT */ 10924/*! 10925** Unobtrusive Ajax support library for jQuery 10926** Copyright (C) Microsoft Corporation. All rights reserved. 10927*/ 10928/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */ 10929/*global window: false, jQuery: false */ 10930(function ($) { 10931var data_click = "unobtrusiveAjaxClick", 10932data_validation = "unobtrusiveValidation"; 10933function getFunction(code, argNames) { 10934var fn = window, parts = (code || "").split("."); 10935while (fn && parts.length) { 10936fn = fn[parts.shift()]; 10937} 10938if (typeof (fn) === "function") { 10939return fn; 10940} 10941argNames.push(code); 10942return Function.constructor.apply(null, argNames); 10943} 10944function isMethodProxySafe(method) { 10945return method === "GET" || method === "POST"; 10946} 10947function asyncOnBeforeSend(xhr, method) { 10948if (!isMethodProxySafe(method)) { 10949xhr.setRequestHeader("X-HTTP-Method-Override", method); 10950} 10951} 10952function asyncOnSuccess(element, data, contentType) { 10953var mode; 10954if (contentType.indexOf("application/x-javascript") !== -1) { // jQuery already executes JavaScript for us 10955return; 10956} 10957mode = (element.getAttribute("data-ajax-mode") || "").toUpperCase(); 10958$(element.getAttribute("data-ajax-update")).each(function (i, update) { 10959var top; 10960switch (mode) { 10961case "BEFORE": 10962top = update.firstChild; 10963$("<div />").html(data).contents().each(function () { 10964update.insertBefore(this, top); 10965}); 10966break; 10967case "AFTER": 10968$("<div />").html(data).contents().each(function () { 10969update.appendChild(this); 10970}); 10971break; 10972default: 10973$(update).html(data); 10974break; 10975} 10976}); 10977} 10978function asyncRequest(element, options) { 10979var confirm, loading, method, duration; 10980confirm = element.getAttribute("data-ajax-confirm"); 10981if (confirm && !window.confirm(confirm)) { 10982return; 10983} 10984loading = $(element.getAttribute("data-ajax-loading")); 10985duration = element.getAttribute("data-ajax-loading-duration") || 0; 10986$.extend(options, { 10987type: element.getAttribute("data-ajax-method") || undefined, 10988url: element.getAttribute("data-ajax-url") || undefined, 10989beforeSend: function (xhr) { 10990var result; 10991asyncOnBeforeSend(xhr, method); 10992result = getFunction(element.getAttribute("data-ajax-begin"), ["xhr"]).apply(this, arguments); 10993if (result !== false) { 10994loading.show(duration); 10995} 10996return result; 10997}, 10998complete: function () { 10999loading.hide(duration); 11000getFunction(element.getAttribute("data-ajax-complete"), ["xhr", "status"]).apply(this, arguments); 11001}, 11002success: function (data, status, xhr) { 11003asyncOnSuccess(element, data, xhr.getResponseHeader("Content-Type") || "text/html"); 11004getFunction(element.getAttribute("data-ajax-success"), ["data", "status", "xhr"]).apply(this, arguments); 11005}, 11006error: getFunction(element.getAttribute("data-ajax-failure"), ["xhr", "status", "error"]) 11007}); 11008options.data.push({ name: "X-Requested-With", value: "XMLHttpRequest" }); 11009method = options.type.toUpperCase(); 11010if (!isMethodProxySafe(method)) { 11011options.type = "POST"; 11012options.data.push({ name: "X-HTTP-Method-Override", value: method }); 11013} 11014$.ajax(options); 11015} 11016function validate(form) { 11017var validationInfo = $(form).data(data_validation); 11018return !validationInfo || !validationInfo.validate || validationInfo.validate(); 11019} 11020$(document).on("click", "a[data-ajax=true]", function (evt) { 11021evt.preventDefault(); 11022asyncRequest(this, { 11023url: this.href, 11024type: "GET", 11025data: [] 11026}); 11027}); 11028$(document).on("click", "form[data-ajax=true] input[type=image]", function (evt) { 11029var name = evt.target.name, 11030$target = $(evt.target), 11031form = $target.parents("form")[0], 11032offset = $target.offset(); 11033$(form).data(data_click, [ 11034{ name: name + ".x", value: Math.round(evt.pageX - offset.left) }, 11035{ name: name + ".y", value: Math.round(evt.pageY - offset.top) } 11036]); 11037setTimeout(function () { 11038$(form).removeData(data_click); 11039}, 0); 11040}); 11041$(document).on("click", "form[data-ajax=true] :submit", function (evt) { 11042var name = evt.currentTarget.name, 11043form = $(evt.target).parents("form")[0]; 11044$(form).data(data_click, name ? [{ name: name, value: evt.currentTarget.value }] : []); 11045setTimeout(function () { 11046$(form).removeData(data_click); 11047}, 0); 11048}); 11049$(document).on("submit", "form[data-ajax=true]", function (evt) { 11050var clickInfo = $(this).data(data_click) || []; 11051evt.preventDefault(); 11052if (!validate(this)) { 11053return; 11054} 11055asyncRequest(this, { 11056url: this.action, 11057type: this.method || "GET", 11058data: clickInfo.concat($(this).serializeArray()) 11059}); 11060}); 11061}(jQuery)); 11062; 11063!function (e, n) { "object" == typeof exports && "undefined" != typeof module ? n(require("jquery")) : "function" == typeof define && define.amd ? define(["jquery"], n) : n(e.jQuery) }(this, function (e) { 11064 "use strict"; function n(n) { var t = this; if (1 === arguments.length && "function" == typeof n && (n = [n]), !(n instanceof Array)) throw new SyntaxError("isInViewport: Argument(s) passed to .do/.run should be a function or an array of functions");
11064 return n.forEach(function (n) { "function" != typeof n ? (console.warn("isInViewport: Argument(s) passed to .do/.run should be a function or an array of functions"), console.warn("isInViewport: Ignoring non-function values in array and moving on")) : [].slice.call(t).forEach(function (t) { return n.call(e(t)) }) }), this } function t(n) { var t = e("<div></div>").css({ width: "100%" }); n.append(t); var o = n.width() - t.width(); return t.remove(), o } function o(n, r) { var i = n.getBoundingClientRect(), a = i.top, u = i.bottom, c = i.left, f = i.right, s = e.extend({ tolerance: 0, viewport: window }, r), d = !1, l = s.viewport.jquery ? s.viewport : e(s.viewport); l.length || (console.warn("isInViewport: The viewport selector you have provided matches no element on page."), console.warn("isInViewport: Defaulting to viewport as window"), l = e(window)); var p = l.height(), w = l.width(), h = l[0].toString(); if (l[0] !== window && "[object Window]" !== h && "[object DOMWindow]" !== h) { var v = l[0].getBoundingClientRect(); a -= v.top, u -= v.top, c -= v.left, f -= v.left, o.scrollBarWidth = o.scrollBarWidth || t(l), w -= o.scrollBarWidth } return s.tolerance = ~~Math.round(parseFloat(s.tolerance)), s.tolerance < 0 && (s.tolerance = p + s.tolerance), f <= 0 || c >= w ? d : d = s.tolerance ? a <= s.tolerance && u >= s.tolerance : u > 0 && a <= p } function r(n) { if (n) { var t = n.split(","); return 1 === t.length && isNaN(t[0]) && (t[1] = t[0], t[0] = void 0), { tolerance: t[0] ? t[0].trim() : void 0, viewport: t[1] ? e(t[1].trim()) : void 0 } } return {} } e = e && e.hasOwnProperty("default") ? e.default : e,/** 11065 * @author Mudit Ameta 11066 * @license https://github.com/zeusdeux/isInViewport/blob/master/license.md MIT 11067 */ 11068 e.extend(e.expr.pseudos || e.expr[":"], { "in-viewport": e.expr.createPseudo ? e.expr.createPseudo(function (e) { return function (n) { return o(n, r(e)) } }) : function (e, n, t) { return o(e, r(t[3])) } }), e.fn.isInViewport = function (e) { return this.filter(function (n, t) { return o(t, e) }) }, e.fn.run = n 11069}); 11070//# sourceMappingURL=isInViewport.min.js.map; 11071// Cookie Perm Toggle 11072var applyCookieToggle = function () { 11073 setTimeout(function () { 11074 $(".cookie-toggle:not(.triggered)").each(function () { 11075 $(this).addClass("triggered"); 11076 $(this).on("click", function () { 11077 var wrapper = $(this).closest(".cookie-panel-wrapper"); 11078 var cookieName = $(wrapper).data("cookie"); 11079 if (wrapper && cookieName) { 11080 11081 var applyHide = wrapper.hasClass("collapsed") === false; 11082 if (applyHide === true) { 11083 $(wrapper).addClass("collapsed"); 11084 } else { 11085 $(wrapper).removeClass("collapsed"); 11086 } 11087 11088 Cookies.set(cookieName, applyHide ? "HIDE" : "SHOW", { expires: 365, path: "" }); 11089 } 11090 }); 11091 }); 11092 }, 0); 11093} 11094 11095// Dynamic Panels 11096function loadCookiePanelState() { 11097 setTimeout(function () { 11098 $(".cookie-panel-wrapper.cookie-panel-wrapper-dynamic").each(function () { 11099 var cookieName = $(this).data("cookie"); 11100 if (cookieName) { 11101 var state = Cookies.get(cookieName); 11102 if (state === "HIDE") { 11103 $(this).addClass("collapsed"); 11104 } 11105 $(this).removeClass("cookie-panel-wrapper-dynamic-loading"); 11106 } 11107 }); 11108 applyCookieToggle(); 11109 }, 0); 11110} 11111 11112function MoreToggleOnClick() { 11113 $(".more-toggle").on("click", function () { 11114 $('#sitemap-panel').slideToggle(); 11115 return false; 11116 }); 11117 11118 $("#sitemap-panel").insertBefore("header"); 11119} 11120 11121function ToggleTrackingOnClick() { 11122 $(".track-toggle").on ("click", function () { 11123 if ($('#tracking-panel').is(":visible")) { 11124 $('#tracking-panel').slideUp(); 11125 $('.tracking-input').blur(); 11126 } else { 11127 $('#tracking-panel').slideDown(); 11128 $('.tracking-input').focus(); 11129 } 11130 return false; 11131 });
11132} 11133 11134function ToggleTracking() { 11135 if ($('#tracking-panel').is(":visible")) { 11136 $('#tracking-panel').slideUp(); 11137 $('.tracking-input').blur(); 11138 } else { 11139 $('#tracking-panel').slideDown(); 11140 $('.tracking-input').focus(); 11141 } 11142 return false; 11143} 11144 11145function setDeviceType() { 11146 var deviceName = document.location.href.indexOf('device=app') > -1 ? 'app' : 'web'; 11147 document.getElementsByTagName('html')[0].classList.add('device-' + deviceName); 11148} 11149 11150$(function () { 11151 setDeviceType(); 11152 MoreToggleOnClick(); 11153 11154 // Async Image Load 11155 $("[data-defer-src]").each(function () { 11156 $(this).attr("src", $(this).attr("data-defer-src")).removeAttr("data-defer-src"); 11157 }); 11158 11159 $("[data-404-src]").each(function () { 11160 $(this).on("load", function () { 11161 $($(this).attr("data-404-id")).remove(); 11162 $(this).removeClass("hidden"); 11163 $(this).removeAttr("data-404-id"); 11164 }); 11165 $(this).attr("src", $(this).attr("data-404-src")).removeAttr("data-404-src"); 11166 }); 11167 11168 // MyAccount Integrations Version buttons 11169 $('.integrationversion .btn').on("click", function () { 11170 $('.integrationversion .btn').removeClass('active'); 11171 $(this).addClass('active'); 11172 }); 11173 11174 ToggleTrackingOnClick(); 11175 11176 // More buttons in the CMS 11177 $(".btn-showresexpandable").on("click", function () { 11178 // Toggle button text BEFORE doing transition 11179 $(this).text(($(".hidingrowexpandable").is(":visible")) ? "more" : "less"); 11180 // Toggle visibility 11181 $(".hidingrowexpandable").slideToggle(); 11182 return false; 11183 }); 11184 11185 // Cookie Policy - Legal 11186 $(".cookie-message-close").on("click", function () { 11187 var redirectUrl = $(this).attr("data-href-url"); 11188 $.post($(this).attr("data-url")).done(function () { 11189 if (redirectUrl) { 11190 window.location.href = redirectUrl; 11191 } 11192 $(".cookie-message").fadeOut(300, function () { 11193 $(".cookie-message").remove(); 11194 }); 11195 }); 11196 }); 11197 11198 $(".cookie-message-close-explicit").on("click", function () { 11199 var redirectUrl = $(this).attr("data-href-url"); 11200 $.post($(this).attr("data-url")).done(function () { 11201 11202 var hasCKPSCookieConsent = hasConsentCKPSCookie(); 11203 11204 if (redirectUrl) { 11205 if (hasCKPSCookieConsent) { 11206 var ckpsCookieName = "ckps"; 11207 var ckpsValue = "-ads,-imp,-fun"; 11208 var expirationTime = 0.0034722; 11209 setCookie(ckpsCookieName, ckpsValue, expirationTime); 11210 } 11211 11212 window.location.href = redirectUrl; 11213 } 11214 else { 11215 if (hasCKPSCookieConsent) { 11216 var ckpsCookieName = "ckps"; 11217 var ckpsValue = "+ads,+imp,+fun"; 11218 var expirationTime = 365; 11219 setCookie(ckpsCookieName, ckpsValue, expirationTime); 11220 } 11221 } 11222 $(".explicit-cookie-banner-wrapper").fadeOut(300, function () { 11223 $(".explicit-cookie-banner-wrapper").remove(); 11224 }); 11225 }); 11226 }); 11227 11228 // Cookie Info Hide 11229 $(".cookie-hide").on("click", function () { 11230 var elementToHide = $(this).data("hide"); 11231 var cookieName = $(this).data("cookie"); 11232 if (elementToHide && cookieName) { 11233 $(elementToHide).fadeOut(300, function () { 11234 $(this).remove(); 11235 }); 11236 Cookies.set(cookieName, true, { expires: 365, path: "" }); 11237 } 11238 }); 11239 11240 function toggleInfo(slug) { 11241 // More buttons on couriers page 11242 $(".btn-showmoreinfo[courierslug='" + slug + "']").on("click", function () { 11243 // Toggle button text BEFORE doing transition 11244 $(this).text(($(".hidinginforowexpandable[courierslug='" + slug + "']").is(":visible")) ? "More Info" : "Close Info"); 11245 // Toggle borders 11246 $(".has-option[courierslug='" + slug + "']").each(function () { 11247 $(this).toggleClass("expanded"); 11248 }); 11249 // Toggle visibility 11250 $(".hidinginforowexpandable[courierslug='" + slug + "']").toggle(); 11251 return false; 11252 }); 11253 } 11254 11255 if ($(window).width() > 767) { 11256 $("[sticky-nav]").each(function (i) { 11257 11258 var anchorClass = "sticky-anchor-" + i; 11259 var navClass = "sticky-navigation-" + i; 11260 11261 $(this).before("<div class='" + anchorClass + "' sticky-anchor></div><div sticky-anchor-spacer></div>"); 11262 $(this).addClass(navClass); 11263 11264 $(window).scroll(function () { 11265 if (!$("." + anchorClass).is(":in-viewport")) { 11266 $("." + navClass).addClass("sticky"); 11267 } else { 11268 $("." + navClass).removeClass("sticky"); 11269 } 11270 var f = false; 11271 $("." + navClass + " a").each(function () { 11272 var id = $(this).attr("href"); 11273 if ($(id + " h2").is(":in-viewport") && !f) { 11274 f = true; 11275 $(this).addClass("active"); 11276 } else { 11277 $(this).removeClass("active"); 11278 } 11279 }); 11280 }); 11281 }); 11282 } 11283 11284 $("a.scroll-to").on("click", function (e) { 11285 e.preventDefault(); 11286 var href = $(this).attr("href"); 11287 $('html, body').stop().animate({ 11288 scrollTop: $(href).offset().top 11289 }, 2000); 11290 });
11291 11292 $(".btn-showmoreinfo").each(function () { 11293 toggleInfo($(this).attr("courierslug")); 11294 }); 11295 11296 // OnLoad 11297 applyCookieToggle(); 11298 imageLoader(); 11299 11300 //If the browser does not support SVG images swap them for png if set 11301 //if (!Modernizr.svgasimg) { 11302 // $("[data-svg-replacement]").each(function () { 11303 // $(this).attr("src", $(this).attr("data-svg-replacement")).removeAttr("data-svg-replacement").removeClass("svg-img").addClass("svg-img-replacement"); 11304 // }); 11305 //} 11306}); 11307 11308function toggleFullScreenLoading() { 11309 $(".loading-bg").toggle(); 11310} 11311 11312window.errors_sent = []; 11313window.onerror = function (msg, file, line, col, error) { 11314 if (window.errors_sent.length < 10) { 11315 try { 11316 if (error) { 11317 StackTrace.fromError(error).then(function (stack) { 11318 postError(stack, msg, file, line, col); 11319 }); 11320 } else { 11321 postError("", msg, file, line, col); 11322 } 11323 } catch (e) { 11324 console.log("Error post exception", e); 11325 } 11326 } 11327}; 11328 11329function postError(stack, msg, file, line, col) { 11330 try { 11331 var msgParts = msg.split('\n'); 11332 var message = msgParts[0]; 11333 var key = message + ":" + file + ":" + line + ":" + col; 11334 if (window.errors_sent.indexOf(key) === -1) { 11335 window.errors_sent.push(key); 11336 $.post("/logging/api/exception", { Message: message, FileName: file, LineNumber: line, Column: col, StackTrace: JSON.stringify(stack), Url: window.location.href }); 11337 } 11338 } catch (e) { } 11339} 11340 11341var observer; 11342function imageLoader() { 11343 // If we don't have support for intersection observer, load the images immediately 11344 if (typeof IntersectionObserver == "undefined") { 11345 var images = $(".js-lazy-image"); 11346 for (var i = 0; i < images.length; i++) { 11347 preloadImage(images.get(i)); 11348 } 11349 } else { 11350 var config = { 11351 // If the image gets within 50px in the Y axis, start the download. 11352 rootMargin: '50px 0px', 11353 threshold: 0.01 11354 }; 11355 observer = new IntersectionObserver(onIntersection, config); 11356 var images = document.querySelectorAll('.js-lazy-image'); 11357 for (var i = 0; i < images.length; i++) { 11358 observer.observe(images[i]); 11359 } 11360 } 11361} 11362 11363function onIntersection(entries) { 11364 for (var i = 0; i < entries.length; i++) { 11365 if (entries[i].intersectionRatio > 0) { 11366 11367 // Stop watching and load the image 11368 observer.unobserve(entries[i].target); 11369 preloadImage(entries[i].target); 11370 } 11371 } 11372} 11373 11374function preloadImage(e) { 11375 var imgSrc = e.getAttribute("lazy-img-src") || e.getAttribute("src"); 11376 11377 if (e.tagName.toLowerCase() === "img") { 11378 e.setAttribute("src", imgSrc); 11379 } else { 11380 e.style.backgroundImage = "url('" + imgSrc + "')"; 11381 } 11382 e.removeAttribute("lazy-img-src"); 11383} 11384 11385function addConsentCKPSCookie(ckpsCookieConsent) { 11386 var element = $(".cookie-message-close-explicit"); 11387 11388 if (element) { 11389 $(element).attr("ckps-consent", ckpsCookieConsent); 11390 } 11391} 11392 11393function hasConsentCKPSCookie() { 11394 var element = $(".cookie-message-close-explicit"); 11395 11396 if (element) { 11397 return $(".cookie-message-close-explicit").attr("ckps-consent") == "true"; 11398 } 11399 11400 return false; 11401} 11402 11403function updateLoginReturnUrls() { 11404 let loginSelectors = 'a[href^="/login"]' 11405 const locales = window.location.pathname.match(/^\/([a-z]{2}(?:-[a-z]{2})?)\b/i); 11406 11407 if (locales) { 11408 const localesPrefix = locales[0].toLowerCase(); 11409 loginSelectors = loginSelectors + ', a[href^="' + localesPrefix + '/login"]'; 11410 } 11411 11412 const loginAnchors = document.querySelectorAll(loginSelectors); 11413 11414 if (!loginAnchors || loginAnchors.length === 0) return; 11415 11416 const currentUrl = window.location.pathname + window.location.search; 11417 const placeholders = ['/', '~', '%2F', '%7E', '~/']; 11418
11419 loginAnchors.forEach(anchor => { 11420 const href = anchor.getAttribute('href'); 11421 11422 if (!href) return; 11423 11424 if (href.includes('/login/logout')) return; 11425 11426 const [base, queryString] = href.split('?'); 11427 const params = new URLSearchParams(queryString || ''); 11428 const returnUrl = params.get('returnurl'); 11429 11430 if (!returnUrl || placeholders.includes(returnUrl)) { 11431 params.set('returnurl', currentUrl); 11432 } 11433 11434 anchor.href = `${base}?${params.toString()}`; 11435 }); 11436} 11437 11438document.addEventListener('DOMContentLoaded', function () { 11439 setTimeout(function () { 11440 updateLoginReturnUrls(); 11441 }, 500); 11442});; 11443var inlineValidation = { 11444 events: { 11445 keyup:function(_this) { 11446 // Record if has value 11447 if (_this.val() !== undefined && _this.val().length) { 11448 _this.addClass("input-validation-hasvalue"); 11449 } else { 11450 _this.removeClass("input-validation-hasvalue"); 11451 } 11452 }, 11453 blur: function(_this) { 11454 // Error state 11455 _this.removeClass("input-validation-error"); 11456 _this.removeClass("input-validation-valid"); 11457 11458 // Record is valid 11459 var valid = ((_this.valid == undefined) || (_this.valid() === true)); 11460 11461 // Regex 11462 if (valid && _this.attr("pattern") != undefined && _this.val() !== "") { 11463 var regexp = new RegExp(_this.attr("pattern")); 11464 if (!regexp.test(_this.val())) { 11465 valid = false; 11466 } 11467 } 11468 11469 // Min length 11470 if (valid && _this.attr("min-length") != undefined && _this.val().length < parseInt(_this.attr("min-length"))) { 11471 valid = false; 11472 } 11473 11474 // Max length 11475 if (valid && _this.attr("max-length") != undefined && _this.val().length > parseInt(_this.attr("max-length"))) { 11476 valid = false; 11477 } 11478 11479 // Toggle validation classes 11480 if (valid === true) { 11481 // Only add valid for elements with a value 11482 if (_this.val() === "") { 11483 _this.removeClass("ng-valid"); 11484 } else { 11485 _this.addClass("input-validation-valid"); 11486 } 11487 } else { 11488 _this.addClass("input-validation-error"); 11489 11490 //if (_this.val() !== "") { 11491 // inlineValidation.functions.applyToolTipForInlineValidationElement(_this, _this[0].validationMessage); 11492 // _this.tooltip("show"); 11493 //} 11494 } 11495 11496 // Add focus classed 11497 if (_this.hasClass("is-form-fake") === true) { 11498 _this.closest(".form-control-fake").removeClass("focus"); 11499 } else if (_this.hasClass("is-group-addon") === true) { 11500 _this.parent().removeClass("focus"); 11501 } else { 11502 _this.removeClass("focus"); 11503 } 11504 }, 11505 focus: function(_this) { 11506 ////Remove tooltip after 5 seconds 11507 //_this.tooltip("destroy"); 11508 11509 // Remove focus classed 11510 if (_this.hasClass("is-form-fake") === true) { 11511 _this.closest(".form-control-fake").addClass("focus"); 11512 } else if (_this.hasClass("is-group-addon") === true) { 11513 _this.parent().addClass("focus"); 11514 } else { 11515 _this.addClass("focus"); 11516 } 11517 } 11518 }, 11519 functions: { 11520 applyToolTipForInlineValidationElement: function(element, message) { 11521 11522 var tooltipTemplate = '<div class="tooltip tooltip-inline-validation" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'; 11523 var options = { 11524 placement: "right", 11525 trigger: "manual", 11526 template: tooltipTemplate, 11527 container: "body" 11528 }; 11529 11530 if (element.data('bs.tooltip') !== undefined) { 11531 element.data('bs.tooltip').options.title = message; 11532 element.data('bs.tooltip').options.placement = options.placement; 11533 element.data('bs.tooltip').options.trigger = options.trigger; 11534 element.data('bs.tooltip').options.container = options.container; 11535 element.data('bs.tooltip').options.template = options.template; 11536 } else { 11537 element.tooltip({ 11538 title: message, 11539 trigger: options.trigger, 11540 placement: options.placement, 11541 template: options.template, 11542 container: options.container 11543 }); 11544 } 11545 }, 11546 applyInlineValidationForElement: function(e) { 11547 11548 if (!e) { 11549 return; 11550 } 11551 11552 var element = e[0] ? e[0] : e; 11553 11554 if (element && element.attributes && element.attributes.inlinevalidationadded === undefined) { 11555 var val = (element.attributes.type ? element.attributes.type.value : "").toLowerCase(); 11556 11557 if (element.attributes.readonly) { 11558 return; 11559 } 11560 11561 if (["", "tel", "text", "email", "number", "password"].indexOf(val) > -1) { 11562 11563 setTimeout(function () { 11564 11565 // Get Jquery Element 11566 var el = $(element); 11567 el.attr("inlinevalidationadded", "true"); 11568
11569 // On focus, add a focus class and also add on the parent if its a form group 11570 if (el.parent().hasClass("input-group") === true) { 11571 el.addClass("is-group-addon"); 11572 } else if (el.closest(".form-control-fake").length === 1) { 11573 el.addClass("is-form-fake"); 11574 } 11575 11576 if (el.attr("placeholder") || el.attr("mobile-placeholder")) { 11577 el.addClass("inlinevalidationhasplaceholder"); 11578 } 11579 11580 if (el.attr("mobile-placeholder")) { 11581 el.addClass("inlinevalidationmobileonlyplaceholder"); 11582 11583 if (!el.attr("placeholder")) { 11584 el.addClass("mobile-placeholder-form-control"); 11585 el.attr("placeholder", el.attr("mobile-placeholder")); 11586 } 11587 } 11588 11589 if (el.val()) { 11590 el.removeClass("ng-pristine"); 11591 } 11592 11593 var placeHolder = (el.attr("mobile-placeholder") || el.attr("placeholder") || ''); 11594 if (placeHolder && el.attr("required") === "required") { 11595 placeHolder += " *"; 11596 } 11597 11598 if (val !== "password") { 11599 // Insert the indicator after the input 11600 el.after("<div class='inline-validation-indicator'><i class='fa'></i></div><div class='mobile-placeholder' error='" + (el.attr("mobile-placeholder") || el.attr("data-val-required") || '') + "' placeholder='" + placeHolder + "'></div>"); 11601 } 11602 11603 // Force jquery to validate the input on blur 11604 el.on("blur", function () { 11605 return inlineValidation.events.blur($
11605(this)); 11606 }); 11607 11608 el.on("focus", function () { 11609 return inlineValidation.events.focus($(this)); 11610 }); 11611 11612 el.on("keyup", function () { 11613 return inlineValidation.events.keyup($(this)); 11614 }); 11615 11616 // Set onload 11617 inlineValidation.events.keyup(el); 11618 }); 11619 11620 } 11621 } 11622 }, 11623 } 11624}; 11625 11626$(function() { 11627 $("input").each(function() { 11628 if ($(this).attr("ng-model") === undefined) { 11629 inlineValidation.functions.applyInlineValidationForElement(this); 11630 } 11631 }); 11632}); 11633; 11634// 11635// Some dodgy methods I am adding to simplify some array usage with linq-like query methods 11636// -Dan 17/01/2014 11637// 11638 11639(function (a, undefined) { 11640 11641 // Where 11642 a.prototype.where = function (predicate) { 11643 var out = [], i; 11644 for (i = 0; i < this.length; i++) { 11645 if (predicate(this[i])) { 11646 out.push(this[i]); 11647 } 11648 } 11649 return out; 11650 }; 11651 11652 11653 // Count 11654 a.prototype.count = function (predicate) { 11655 var out = 0; 11656 for (i = 0; i < this.length; i++) { 11657 if (predicate(this[i])) { 11658 out++; 11659 } 11660 } 11661 return out; 11662 }; 11663 11664 // First - not bothering with a first/firstOrUndefined 11665 a.prototype.first = function (predicate) { 11666 for (var i = 0; i < this.length; i++) { 11667 if ((predicate || truthy)(this[i])) { 11668 return this[i]; 11669 } 11670 } 11671 return undefined; 11672 }; 11673 11674 // Distinct 11675 a.prototype.distinct = function () { 11676 var out = [], i; 11677 for (i = 0; i < this.length; i++) { 11678 if (out.indexOf(this[i]) === -1) { 11679 out.push(this[i]); 11680 } 11681 } 11682 return out; 11683 }; 11684 11685 // sum 11686 a.prototype.sum = function (predicate) { 11687 var amount = 0; 11688 for (var i = 0; i < this.length; i++) { 11689 amount += (predicate)(this[i]); 11690 } 11691 return amount; 11692 }; 11693 11694 // select 11695 a.prototype.select = function (predicate) { 11696 var array = []; 11697 for (var i = 0; i < this.length; i++) { 11698 array.push((predicate)(this[i])); 11699 } 11700 return array; 11701 }; 11702 11703 // Last 11704 a.prototype.last = function(predicate) { 11705 var results = this.where((predicate || truthy)); 11706 return results[results.length - 1]; 11707 }; 11708 11709 // Any 11710 a.prototype.any = function(predicate) { 11711 return !!this.first(predicate); 11712 }; 11713 11714 // Method to fallback on if no predicate is passed in, allowing chaining such as .where(fn).first() 11715 function truthy() { return true; } 11716 11717 // For IE7/8 11718 if (!a.prototype.indexOf) { 11719 a.prototype.indexOf = function (elt /*, from*/) { 11720 var len = this.length >>> 0; 11721 11722 var from = Number(arguments[1]) || 0; 11723 from = (from < 0) 11724 ? Math.ceil(from) 11725 : Math.floor(from); 11726 if (from < 0) 11727 from += len; 11728 11729 for (; from < len; from++) { 11730 if (from in this && 11731 this[from] === elt) 11732 return from; 11733 } 11734 return -1; 11735 }; 11736 } 11737 11738 if (!a.prototype.equals) { 11739 a.prototype.equals = function (array, strict) { 11740 if (!array) 11741 return false; 11742 11743 if (arguments.length == 1) 11744 strict = true; 11745 11746 if (this.length != array.length) 11747 return false; 11748 11749 for (var i = 0; i < this.length; i++) { 11750 if (this[i] instanceof Array && array[i] instanceof Array) { 11751 if (!this[i].equals(array[i], strict)) 11752 return false; 11753 } 11754 else if (strict && this[i] != array[i]) { 11755 return false; 11756 } 11757 else if (!strict) { 11758 return this.sort().equals(array.sort(), true); 11759 } 11760 } 11761 return true; 11762 } 11763 } 11764 11765})(Array);
11766 11767; 11768// "{0} {1}".format("Name", "Surname"); 11769if (!String.prototype.format) { 11770 String.prototype.format = function () { 11771 var args = arguments; 11772 return this.replace(/{(\d+)}/g, function (match, number) { 11773 return typeof args[number] != 'undefined' 11774 ? args[number] 11775 : match 11776 ; 11777 }); 11778 }; 11779} 11780 11781//String.format('{0} {1}', 'Name', 'Surname'); 11782if (!String.format) { 11783 String.format = function (format) { 11784 var args = Array.prototype.slice.call(arguments, 1); 11785 return format.replace(/{(\d+)}/g, function (match, number) { 11786 return typeof args[number] != 'undefined' 11787 ? args[number] 11788 : match 11789 ; 11790 }); 11791 }; 11792} 11793 11794//This was taken from StackOverflow (source) 11795String.prototype.formatUnicorn = function () { 11796 var e = this.toString(); 11797 if (!arguments.length) 11798 return e; 11799 var t = typeof arguments[0]; 11800 var n = "string" === t || "number" === t ? Array.prototype.slice.call(arguments) : arguments[0]; 11801 for (var i in n) 11802 e = e.replace(new RegExp("\\{" + i + "\\}", "gi"), n[i] || ""); 11803 return e; 11804}; 11805 11806String.prototype.trimLeft = function (charlist) { 11807 if (charlist === undefined) 11808 charlist = "\s"; 11809 11810 return this.replace(new RegExp("^[" + charlist + "]+"), ""); 11811}; 11812 11813String.prototype.trimRight = function (charlist) { 11814 if (charlist === undefined) 11815 charlist = "\s"; 11816 11817 return this.replace(new RegExp("[" + charlist + "]+$"), ""); 11818};; 11819function countryAddressFormat (address, addressFormat) { 11820 if (!address || !addressFormat) { 11821 return ""; 11822 } 11823 11824 var regexSpaceWithComma = /(?: *,)/gi; 11825 var regexMultipleComma = /((?:, *){2,})/gi; 11826 var regexStartsWithComma = /^(?:[, ]*)|(?:[, ]*)$/gim; 11827 var regexMultipleNewLine = /\n+/gi; 11828 11829 var output = addressFormat.formatUnicorn(address). 11830 replace(regexSpaceWithComma, ","). 11831 replace(regexMultipleComma, ", "). 11832 replace(regexStartsWithComma, ""). 11833 replace(regexMultipleNewLine, "\n"). 11834 trim(). 11835 replace(/\n/gi, "<br/>") 11836 ; 11837 11838 return output.length < 10 ? "" : output; 11839} 11840function singleLineAddress(address, addressFormat) { 11841 if (!address || !addressFormat) { 11842 return ""; 11843 } 11844 var regexSpaceWithComma = /(?: *,)/gi; 11845 var regexMultipleComma = /((?:, *){2,})/gi; 11846 var regexStartsWithComma = /^(?:[, ]*)|(?:[, ]*)$/gim; 11847 var regexMultipleNewLine = /\n+/gi; 11848 11849 var output = addressFormat.formatUnicorn(address) 11850 .replace(regexSpaceWithComma, ", ") 11851 .replace(regexStartsWithComma, "") 11852 .replace(regexMultipleComma, ", ") 11853 .replace(/\n/gi, ' ') 11854 11855 return output; 11856}; 11857function getQueryStringValue(name, url) { 11858 if (!url) url = window.location.href; 11859 name = name.replace(/[\[\]]/g, "\\$&"); 11860 var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)", "i"), 11861 results = regex.exec(url); 11862 if (!results) return null; 11863 if (!results[2]) return ""; 11864 return decodeURIComponent(results[2].replace(/\+/g, " ")); 11865} 11866 11867function replaceOrAddQueryString(input, replacementKey, replacementValue) { 11868 var queryRegex = new RegExp("[?&](" + replacementKey + "=[^&#]*|&|#|$)", "i"); 11869 var replacement = replacementKey + "=" + encodeURI(replacementValue); 11870 var match = input.match(queryRegex); 11871 if (match) { 11872 return input.replace(match[1], replacement); 11873 } 11874 11875 if (input.indexOf("#") === -1) { 11876 return input + "&" + replacement; 11877 } else { 11878 return input.replace("#", "&" + replacement + "#"); 11879 } 11880} 11881 11882function setCookie(cname, cvalue, exdays) { 11883 var d = new Date(); 11884 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 11885 var expires = "expires=" + d.toUTCString(); 11886 document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/"; 11887}; 11888 11889function getCookie(cname) { 11890 var name = cname + "="; 11891 var decodedCookie = decodeURIComponent(document.cookie); 11892 var ca = decodedCookie.split(';'); 11893 for (var i = 0; i < ca.length; i++) { 11894 var c = ca[i];
11895 while (c.charAt(0) == ' ') { 11896 c = c.substring(1); 11897 } 11898 if (c.indexOf(name) == 0) { 11899 return c.substring(name.length, c.length); 11900 } 11901 } 11902 return ""; 11903} 11904 11905function p2gScroll(el) { 11906 $('html, body').animate({ 11907 scrollTop: parseInt($(el).offset().top) 11908 }, 2000); 11909} 11910 11911function getQuoteTypeByDimensions(options, p, collectionCountryId, deliveryCountryId) { 11912 var quoteType; 11913 11914 if (options) { 11915 var _p = [p.Length, p.Width, p.Height, p.Weight].sort(); 11916 options.forEach(function (t) { 11917 t.QuoteTypeOptions 11918 .where(function (o) { 11919 return o.QuoteTypeCountryOptions.length === 0 || o.QuoteTypeCountryOptions.where(function (oc) { return oc.CollectionCountryId === collectionCountryId && oc.DeliveryCountryId === deliveryCountryId; }).length > 0; 11920 }) 11921 .forEach(function (o) { 11922 var _o = [o.Length, o.Width, o.Height, o.Weight].sort(); 11923 var matched = 0; 11924 for (var i = 0; i < _o.length; i++) { 11925 if (_o[i] === _p[i]) { 11926 matched++; 11927 } 11928 } 11929 if (matched === _o.length) { 11930 quoteType = o; 11931 } 11932 }); 11933 }); 11934 } 11935 return quoteType; 11936} 11937 11938document.p2gutils = { 11939 getQuoteTypeByDimensions: getQuoteTypeByDimensions, 11940 getCookie: getCookie, 11941 setCookie: setCookie, 11942 p2gScroll: p2gScroll, 11943 replaceOrAddQueryString: replaceOrAddQueryString, 11944 getQueryStringValue: getQueryStringValue 11945} 11946; 11947/*! 11948 * JavaScript Cookie v2.1.3 11949 * https://github.com/js-cookie/js-cookie 11950 * 11951 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack 11952 * Released under the MIT license 11953 */ 11954; (function (factory) { 11955 var registeredInModuleLoader = false; 11956 if (typeof define === 'function' && define.amd) { 11957 define(factory); 11958 registeredInModuleLoader = true; 11959 } 11960 if (typeof exports === 'object') { 11961 module.exports = factory(); 11962 registeredInModuleLoader = true; 11963 } 11964 if (!registeredInModuleLoader) { 11965 var OldCookies = window.Cookies; 11966 var api = window.Cookies = factory(); 11967 api.noConflict = function () { 11968 window.Cookies = OldCookies; 11969 return api; 11970 }; 11971 } 11972}(function () { 11973 function extend() { 11974 var i = 0; 11975 var result = {}; 11976 for (; i < arguments.length; i++) { 11977 var attributes = arguments[i]; 11978 for (var key in attributes) { 11979 result[key] = attributes[key]; 11980 } 11981 } 11982 return result; 11983 } 11984 11985 function init(converter) { 11986 function api(key, value, attributes) { 11987 var result; 11988 if (typeof document === 'undefined') { 11989 return; 11990 } 11991 11992 // Write 11993 11994 if (arguments.length > 1) { 11995 attributes = extend({ 11996 path: '/' 11997 }, api.defaults, attributes); 11998 11999 if (typeof attributes.expires === 'number') { 12000 var expires = new Date(); 12001 expires.setMilliseconds(expires.getMilliseconds() + attributes.expires * 864e+5); 12002 attributes.expires = expires; 12003 } 12004 12005 try { 12006 result = JSON.stringify(value); 12007 if (/^[\{\[]/.test(result)) { 12008 value = result; 12009 } 12010 } catch (e) { } 12011 12012 if (!converter.write) { 12013 value = encodeURIComponent(String(value)) 12014 .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); 12015 } else { 12016 value = converter.write(value, key); 12017 } 12018 12019 key = encodeURIComponent(String(key)); 12020 key = key.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent); 12021 key = key.replace(/[\(\)]/g, escape); 12022 12023 return (document.cookie = [ 12024 key, '=', value, 12025 attributes.expires ? '; expires=' + attributes.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 12026 attributes.path ? '; path=' + attributes.path : '', 12027 attributes.domain ? '; domain=' + attributes.domain : '', 12028 attributes.secure ? '; secure' : '' 12029 ].join(''));
12030 } 12031 12032 // Read 12033 12034 if (!key) { 12035 result = {}; 12036 } 12037 12038 // To prevent the for loop in the first place assign an empty array 12039 // in case there are no cookies at all. Also prevents odd result when 12040 // calling "get()" 12041 var cookies = document.cookie ? document.cookie.split('; ') : []; 12042 var rdecode = /(%[0-9A-Z]{2})+/g; 12043 var i = 0; 12044 12045 for (; i < cookies.length; i++) { 12046 var parts = cookies[i].split('='); 12047 var cookie = parts.slice(1).join('='); 12048 12049 if (cookie.charAt(0) === '"') { 12050 cookie = cookie.slice(1, -1); 12051 } 12052 12053 try { 12054 var name = parts[0].replace(rdecode, decodeURIComponent); 12055 cookie = converter.read ? 12056 converter.read(cookie, name) : converter(cookie, name) || 12057 cookie.replace(rdecode, decodeURIComponent); 12058 12059 if (this.json) { 12060 try { 12061 cookie = JSON.parse(cookie); 12062 } catch (e) { } 12063 } 12064 12065 if (key === name) { 12066 result = cookie; 12067 break; 12068 } 12069 12070 if (!key) { 12071 result[name] = cookie; 12072 } 12073 } catch (e) { } 12074 } 12075 12076 return result; 12077 } 12078 12079 api.set = api; 12080 api.get = function (key) { 12081 return api.call(api, key); 12082 }; 12083 api.getJSON = function () { 12084 return api.apply({
12085 json: true 12086 }, [].slice.call(arguments)); 12087 }; 12088 api.defaults = {}; 12089 12090 api.remove = function (key, attributes) { 12091 api(key, '', extend(attributes, { 12092 expires: -1 12093 })); 12094 }; 12095 12096 api.withConverter = init; 12097 12098 return api; 12099 } 12100 12101 return init(function () { }); 12102})); 12103; 12104if (navigator.userAgent.match(/IEMobile\/10\.0/)) { 12105 var s = document.createElement("style"); 12106 s.appendChild(document.createTextNode("@@-ms-viewport{width:auto!important}")); 12107 document.getElementsByTagName("head")[0].appendChild(s); 12108}; 12109/*! 12110 * Bootstrap v3.4.1 (https://getbootstrap.com/) 12111 * Copyright 2011-2019 Twitter, Inc. 12112 * Licensed under the MIT license 12113 */ 12114 12115if (typeof jQuery === 'undefined') { 12116 throw new Error('Bootstrap\'s JavaScript requires jQuery') 12117} 12118 12119+function ($) { 12120 'use strict'; 12121 var version = $.fn.jquery.split(' ')[0].split('.') 12122 if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] > 3)) { 12123 throw new Error('Bootstrap\'s JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4') 12124 } 12125}(jQuery); 12126 12127/* ======================================================================== 12128 * Bootstrap: transition.js v3.4.1 12129 * https://getbootstrap.com/docs/3.4/javascript/#transitions 12130 * ======================================================================== 12131 * Copyright 2011-2019 Twitter, Inc. 12132 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 12133 * ======================================================================== */ 12134 12135 12136+function ($) { 12137 'use strict'; 12138 12139 // CSS TRANSITION SUPPORT (Shoutout: https://modernizr.com/) 12140 // ============================================================ 12141 12142 function transitionEnd() { 12143 var el = document.createElement('bootstrap') 12144 12145 var transEndEventNames = { 12146 WebkitTransition : 'webkitTransitionEnd', 12147 MozTransition : 'transitionend', 12148 OTransition : 'oTransitionEnd otransitionend', 12149 transition : 'transitionend' 12150 } 12151 12152 for (var name in transEndEventNames) { 12153 if (el.style[name] !== undefined) { 12154 return { end: transEndEventNames[name] } 12155 } 12156 } 12157 12158 return false // explicit for ie8 ( ._.) 12159 } 12160 12161 // https://blog.alexmaccaw.com/css-transitions 12162 $.fn.emulateTransitionEnd = function (duration) { 12163 var called = false 12164 var $el = this 12165 $(this).one('bsTransitionEnd', function () { called = true }) 12166 var callback = function () { if (!called) $($el).trigger($.support.transition.end) } 12167 setTimeout(callback, duration) 12168 return this 12169 } 12170 12171 $(function () { 12172 $.support.transition = transitionEnd() 12173 12174 if (!$.support.transition) return 12175 12176 $.event.special.bsTransitionEnd = { 12177 bindType: $.support.transition.end, 12178 delegateType: $.support.transition.end, 12179 handle: function (e) { 12180 if ($(e.target).is(this)) return e.handleObj.handler.apply(this, arguments) 12181 } 12182 } 12183 }) 12184 12185}(jQuery); 12186 12187/* ======================================================================== 12188 * Bootstrap: alert.js v3.4.1 12189 * https://getbootstrap.com/docs/3.4/javascript/#alerts 12190 * ======================================================================== 12191 * Copyright 2011-2019 Twitter, Inc. 12192 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 12193 * ======================================================================== */ 12194 12195 12196+function ($) { 12197 'use strict'; 12198 12199 // ALERT CLASS DEFINITION 12200 // ====================== 12201 12202 var dismiss = '[data-dismiss="alert"]' 12203 var Alert = function (el) { 12204 $(el).on('click', dismiss, this.close) 12205 } 12206 12207 Alert.VERSION = '3.4.1' 12208 12209 Alert.TRANSITION_DURATION = 150 12210 12211 Alert.prototype.close = function (e) { 12212 var $this = $(this) 12213 var selector = $this.attr('data-target') 12214 12215 if (!selector) { 12216 selector = $this.attr('href') 12217 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 12218 } 12219 12220 selector = selector === '#' ? [] : selector 12221 var $parent = $(document).find(selector) 12222 12223 if (e) e.preventDefault() 12224 12225 if (!$parent.length) { 12226 $parent = $this.closest('.alert') 12227 } 12228 12229 $parent.trigger(e = $.Event('close.bs.alert')) 12230 12231 if (e.isDefaultPrevented()) return 12232 12233 $parent.removeClass('in') 12234 12235 function removeElement() { 12236 // detach from parent, fire event then clean up data 12237 $parent.detach().trigger('closed.bs.alert').remove() 12238 } 12239 12240 $.support.transition && $parent.hasClass('fade') ? 12241 $parent 12242 .one('bsTransitionEnd', removeElement) 12243 .emulateTransitionEnd(Alert.TRANSITION_DURATION) : 12244 removeElement() 12245 } 12246 12247 12248 // ALERT PLUGIN DEFINITION 12249 // ======================= 12250 12251 function Plugin(option) { 12252 return this.each(function () { 12253 var $this = $(this) 12254 var data = $this.data('bs.alert') 12255
vendor: 73,793 bytes, lines 12256-14694
12256 if (!data) $this.data('bs.alert', (data = new Alert(this))) 12257 if (typeof option == 'string') data[option].call($this) 12258 }) 12259 } 12260 12261 var old = $.fn.alert 12262 12263 $.fn.alert = Plugin 12264 $.fn.alert.Constructor = Alert 12265 12266 12267 // ALERT NO CONFLICT 12268 // ================= 12269 12270 $.fn.alert.noConflict = function () { 12271 $.fn.alert = old 12272 return this 12273 } 12274 12275 12276 // ALERT DATA-API 12277 // ============== 12278 12279 $(document).on('click.bs.alert.data-api', dismiss, Alert.prototype.close) 12280 12281}(jQuery); 12282 12283/* ======================================================================== 12284 * Bootstrap: button.js v3.4.1 12285 * https://getbootstrap.com/docs/3.4/javascript/#buttons 12286 * ======================================================================== 12287 * Copyright 2011-2019 Twitter, Inc. 12288 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 12289 * ======================================================================== */ 12290 12291 12292+function ($) { 12293 'use strict'; 12294 12295 // BUTTON PUBLIC CLASS DEFINITION 12296 // ============================== 12297 12298 var Button = function (element, options) { 12299 this.$element = $(element) 12300 this.options = $.extend({}, Button.DEFAULTS, options) 12301 this.isLoading = false 12302 } 12303 12304 Button.VERSION = '3.4.1' 12305 12306 Button.DEFAULTS = { 12307 loadingText: 'loading...' 12308 } 12309 12310 Button.prototype.setState = function (state) { 12311 var d = 'disabled' 12312 var $el = this.$element 12313 var val = $el.is('input') ? 'val' : 'html' 12314 var data = $el.data() 12315 12316 state += 'Text' 12317 12318 if (data.resetText == null) $el.data('resetText', $el[val]()) 12319 12320 // push to event loop to allow forms to submit 12321 setTimeout($.proxy(function () { 12322 $el[val](data[state] == null ? this.options[state] : data[state]) 12323 12324 if (state == 'loadingText') { 12325 this.isLoading = true 12326 $el.addClass(d).attr(d, d).prop(d, true) 12327 } else if (this.isLoading) { 12328 this.isLoading = false 12329 $el.removeClass(d).removeAttr(d).prop(d, false) 12330 } 12331 }, this), 0) 12332 } 12333 12334 Button.prototype.toggle = function () { 12335 var changed = true 12336 var $parent = this.$element.closest('[data-toggle="buttons"]') 12337 12338 if ($parent.length) { 12339 var $input = this.$element.find('input') 12340 if ($input.prop('type') == 'radio') { 12341 if ($input.prop('checked')) changed = false 12342 $parent.find('.active').removeClass('active') 12343 this.$element.addClass('active') 12344 } else if ($input.prop('type') == 'checkbox') { 12345 if (($input.prop('checked')) !== this.$element.hasClass('active')) changed = false 12346 this.$element.toggleClass('active') 12347 } 12348 $input.prop('checked', this.$element.hasClass('active')) 12349 if (changed) $input.trigger('change') 12350 } else { 12351 this.$element.attr('aria-pressed', !this.$element.hasClass('active')) 12352 this.$element.toggleClass('active') 12353 } 12354 } 12355 12356 12357 // BUTTON PLUGIN DEFINITION 12358 // ======================== 12359 12360 function Plugin(option) { 12361 return this.each(function () { 12362 var $this = $(this) 12363 var data = $this.data('bs.button') 12364 var options = typeof option == 'object' && option 12365 12366 if (!data) $this.data('bs.button', (data = new Button(this, options))) 12367 12368 if (option == 'toggle') data.toggle() 12369 else if (option) data.setState(option) 12370 }) 12371 } 12372 12373 var old = $.fn.button 12374 12375 $.fn.button = Plugin 12376 $.fn.button.Constructor = Button 12377 12378 12379 // BUTTON NO CONFLICT 12380 // ================== 12381 12382 $.fn.button.noConflict = function () { 12383 $.fn.button = old 12384 return this 12385 } 12386 12387 12388 // BUTTON DATA-API 12389 // =============== 12390 12391 $(document) 12392 .on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) { 12393 var $btn = $(e.target).closest('.btn') 12394 Plugin.call($btn, 'toggle') 12395 if (!($(e.target).is('input[type="radio"], input[type="checkbox"]'))) { 12396 // Prevent double click on radios, and the double selections (so cancellation) on checkboxes 12397 e.preventDefault() 12398 // The target component still receive the focus 12399 if ($btn.is('input,button')) $btn.trigger('focus') 12400 else $btn.find('input:visible,button:visible').first().trigger('focus') 12401 } 12402 }) 12403 .on('focus.bs.button.data-api blur.bs.button.data-api', '[data-toggle^="button"]', function (e) { 12404 $(e.target).closest('.btn').toggleClass('focus', /^focus(in)?$/.test(e.type)) 12405 }) 12406 12407}(jQuery); 12408 12409/* ======================================================================== 12410 * Bootstrap: carousel.js v3.4.1 12411 * https://getbootstrap.com/docs/3.4/javascript/#carousel 12412 * ======================================================================== 12413 * Copyright 2011-2019 Twitter, Inc. 12414 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 12415 * ======================================================================== */ 12416 12417 12418+function ($) { 12419 'use strict'; 12420 12421 // CAROUSEL CLASS DEFINITION 12422 // ========================= 12423 12424 var Carousel = function (element, options) { 12425 this.$element = $(element) 12426 this.$indicators = this.$element.find('.carousel-indicators') 12427 this.options = options 12428 this.paused = null 12429 this.sliding = null 12430 this.interval = null 12431 this.$active = null 12432 this.$items = null 12433 12434 this.options.keyboard && this.$element.on('keydown.bs.carousel', $.proxy(this.keydown, this)) 12435 12436 this.options.pause == 'hover' && !('ontouchstart' in document.documentElement) && this.$element 12437 .on('mouseenter.bs.carousel', $.proxy(this.pause, this)) 12438 .on('mouseleave.bs.carousel', $.proxy(this.cycle, this)) 12439 } 12440 12441 Carousel.VERSION = '3.4.1' 12442 12443 Carousel.TRANSITION_DURATION = 600 12444 12445 Carousel.DEFAULTS = { 12446 interval: 5000, 12447 pause: 'hover', 12448 wrap: true, 12449 keyboard: true 12450 } 12451 12452 Carousel.prototype.keydown = function (e) { 12453 if (/input|textarea/i.test(e.target.tagName)) return 12454 switch (e.which) { 12455 case 37: this.prev(); break 12456 case 39: this.next(); break 12457 default: return 12458 } 12459 12460 e.preventDefault() 12461 } 12462 12463 Carousel.prototype.cycle = function (e) { 12464 e || (this.paused = false) 12465 12466 this.interval && clearInterval(this.interval) 12467 12468 this.options.interval 12469 && !this.paused 12470 && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) 12471 12472 return this 12473 } 12474 12475 Carousel.prototype.getItemIndex = function (item) { 12476 this.$items = item.parent().children('.item') 12477 return this.$items.index(item || this.$active) 12478 } 12479 12480 Carousel.prototype.getItemForDirection = function (direction, active) { 12481 var activeIndex = this.getItemIndex(active) 12482 var willWrap = (direction == 'prev' && activeIndex === 0) 12483 || (direction == 'next' && activeIndex == (this.$items.length - 1)) 12484 if (willWrap && !this.options.wrap) return active 12485 var delta = direction == 'prev' ? -1 : 1 12486 var itemIndex = (activeIndex + delta) % this.$items.length 12487 return this.$items.eq(itemIndex) 12488 } 12489 12490 Carousel.prototype.to = function (pos) { 12491 var that = this 12492 var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active')) 12493 12494 if (pos > (this.$items.length - 1) || pos < 0) return 12495 12496 if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid" 12497 if (activeIndex == pos) return this.pause().cycle() 12498 12499 return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos)) 12500 } 12501 12502 Carousel.prototype.pause = function (e) { 12503 e || (this.paused = true) 12504 12505 if (this.$element.find('.next, .prev').length && $.support.transition) { 12506 this.$element.trigger($.support.transition.end) 12507 this.cycle(true) 12508 } 12509 12510 this.interval = clearInterval(this.interval) 12511 12512 return this 12513 } 12514 12515 Carousel.prototype.next = function () { 12516 if (this.sliding) return 12517 return this.slide('next') 12518 } 12519 12520 Carousel.prototype.prev = function () { 12521 if (this.sliding) return 12522 return this.slide('prev') 12523 } 12524 12525 Carousel.prototype.slide = function (type, next) { 12526 var $active = this.$element.find('.item.active') 12527 var $next = next || this.getItemForDirection(type, $active) 12528 var isCycling = this.interval 12529 var direction = type == 'next' ? 'left' : 'right' 12530 var that = this 12531 12532 if ($next.hasClass('active')) return (this.sliding = false) 12533 12534 var relatedTarget = $next[0] 12535 var slideEvent = $.Event('slide.bs.carousel', { 12536 relatedTarget: relatedTarget, 12537 direction: direction 12538 }) 12539 this.$element.trigger(slideEvent) 12540 if (slideEvent.isDefaultPrevented()) return 12541 12542 this.sliding = true 12543 12544 isCycling && this.pause() 12545 12546 if (this.$indicators.length) { 12547 this.$indicators.find('.active').removeClass('active') 12548 var $nextIndicator = $(this.$indicators.children()[this.getItemIndex($next)]) 12549 $nextIndicator && $nextIndicator.addClass('active') 12550 } 12551 12552 var slidEvent = $.Event('slid.bs.carousel', { relatedTarget: relatedTarget, direction: direction }) // yes, "slid" 12553 if ($.support.transition && this.$element.hasClass('slide')) { 12554 $next.addClass(type) 12555 if (typeof $next === 'object' && $next.length) { 12556 $next[0].offsetWidth // force reflow 12557 } 12558 $active.addClass(direction) 12559 $next.addClass(direction) 12560 $active 12561 .one('bsTransitionEnd', function () { 12562 $next.removeClass([type, direction].join(' ')).addClass('active') 12563 $active.removeClass(['active', direction].join(' ')) 12564 that.sliding = false 12565 setTimeout(function () { 12566 that.$element.trigger(slidEvent) 12567 }, 0) 12568 }) 12569 .emulateTransitionEnd(Carousel.TRANSITION_DURATION) 12570 } else { 12571 $active.removeClass('active') 12572 $next.addClass('active') 12573 this.sliding = false 12574 this.$element.trigger(slidEvent) 12575 } 12576 12577 isCycling && this.cycle() 12578 12579 return this 12580 } 12581 12582 12583 // CAROUSEL PLUGIN DEFINITION 12584 // ========================== 12585 12586 function Plugin(option) { 12587 return this.each(function () { 12588 var $this = $(this) 12589 var data = $this.data('bs.carousel') 12590 var options = $.extend({}, Carousel.DEFAULTS, $this.data(), typeof option == 'object' && option) 12591 var action = typeof option == 'string' ? option : options.slide 12592 12593 if (!data) $this.data('bs.carousel', (data = new Carousel(this, options))) 12594 if (typeof option == 'number') data.to(option) 12595 else if (action) data[action]() 12596 else if (options.interval) data.pause().cycle() 12597 }) 12598 } 12599 12600 var old = $.fn.carousel 12601 12602 $.fn.carousel = Plugin 12603 $.fn.carousel.Constructor = Carousel 12604 12605 12606 // CAROUSEL NO CONFLICT 12607 // ==================== 12608 12609 $.fn.carousel.noConflict = function () { 12610 $.fn.carousel = old 12611 return this 12612 } 12613 12614 12615 // CAROUSEL DATA-API 12616 // ================= 12617 12618 var clickHandler = function (e) { 12619 var $this = $(this) 12620 var href = $this.attr('href') 12621 if (href) { 12622 href = href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 12623 } 12624 12625 var target = $this.attr('data-target') || href 12626 var $target = $(document).find(target) 12627 12628 if (!$target.hasClass('carousel')) return 12629 12630 var options = $.extend({}, $target.data(), $this.data()) 12631 var slideIndex = $this.attr('data-slide-to') 12632 if (slideIndex) options.interval = false 12633 12634 Plugin.call($target, options) 12635 12636 if (slideIndex) { 12637 $target.data('bs.carousel').to(slideIndex) 12638 } 12639 12640 e.preventDefault() 12641 } 12642 12643 $(document) 12644 .on('click.bs.carousel.data-api', '[data-slide]', clickHandler) 12645 .on('click.bs.carousel.data-api', '[data-slide-to]', clickHandler) 12646 12647 $(window).on('load', function () { 12648 $('[data-ride="carousel"]').each(function () { 12649 var $carousel = $(this) 12650 Plugin.call($carousel, $carousel.data()) 12651 }) 12652 }) 12653 12654}(jQuery); 12655 12656/* ======================================================================== 12657 * Bootstrap: collapse.js v3.4.1 12658 * https://getbootstrap.com/docs/3.4/javascript/#collapse 12659 * ======================================================================== 12660 * Copyright 2011-2019 Twitter, Inc. 12661 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 12662 * ======================================================================== */ 12663 12664/* jshint latedef: false */ 12665 12666+function ($) { 12667 'use strict'; 12668 12669 // COLLAPSE PUBLIC CLASS DEFINITION 12670 // ================================ 12671 12672 var Collapse = function (element, options) { 12673 this.$element = $(element) 12674 this.options = $.extend({}, Collapse.DEFAULTS, options) 12675 this.$trigger = $('[data-toggle="collapse"][href="#' + element.id + '"],' + 12676 '[data-toggle="collapse"][data-target="#' + element.id + '"]') 12677 this.transitioning = null 12678 12679 if (this.options.parent) { 12680 this.$parent = this.getParent() 12681 } else { 12682 this.addAriaAndCollapsedClass(this.$element, this.$trigger) 12683 } 12684 12685 if (this.options.toggle) this.toggle() 12686 } 12687 12688 Collapse.VERSION = '3.4.1' 12689 12690 Collapse.TRANSITION_DURATION = 350 12691 12692 Collapse.DEFAULTS = { 12693 toggle: true 12694 } 12695 12696 Collapse.prototype.dimension = function () { 12697 var hasWidth = this.$element.hasClass('width') 12698 return hasWidth ? 'width' : 'height' 12699 } 12700 12701 Collapse.prototype.show = function () { 12702 if (this.transitioning || this.$element.hasClass('in')) return 12703 12704 var activesData 12705 var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing') 12706 12707 if (actives && actives.length) { 12708 activesData = actives.data('bs.collapse') 12709 if (activesData && activesData.transitioning) return 12710 } 12711 12712 var startEvent = $.Event('show.bs.collapse') 12713 this.$element.trigger(startEvent) 12714 if (startEvent.isDefaultPrevented()) return 12715 12716 if (actives && actives.length) { 12717 Plugin.call(actives, 'hide') 12718 activesData || actives.data('bs.collapse', null) 12719 } 12720 12721 var dimension = this.dimension() 12722 12723 this.$element 12724 .removeClass('collapse') 12725 .addClass('collapsing')[dimension](0) 12726 .attr('aria-expanded', true) 12727 12728 this.$trigger 12729 .removeClass('collapsed') 12730 .attr('aria-expanded', true) 12731 12732 this.transitioning = 1 12733 12734 var complete = function () { 12735 this.$element 12736 .removeClass('collapsing') 12737 .addClass('collapse in')[dimension]('') 12738 this.transitioning = 0 12739 this.$element 12740 .trigger('shown.bs.collapse') 12741 } 12742 12743 if (!$.support.transition) return complete.call(this) 12744 12745 var scrollSize = $.camelCase(['scroll', dimension].join('-')) 12746 12747 this.$element 12748 .one('bsTransitionEnd', $.proxy(complete, this)) 12749 .emulateTransitionEnd(Collapse.TRANSITION_DURATION)[dimension](this.$element[0][scrollSize]) 12750 } 12751 12752 Collapse.prototype.hide = function () { 12753 if (this.transitioning || !this.$element.hasClass('in')) return 12754 12755 var startEvent = $.Event('hide.bs.collapse') 12756 this.$element.trigger(startEvent) 12757 if (startEvent.isDefaultPrevented()) return 12758 12759 var dimension = this.dimension() 12760 12761 this.$element[dimension](this.$element[dimension]())[0].offsetHeight 12762 12763 this.$element 12764 .addClass('collapsing') 12765 .removeClass('collapse in') 12766 .attr('aria-expanded', false) 12767 12768 this.$trigger 12769 .addClass('collapsed') 12770 .attr('aria-expanded', false) 12771 12772 this.transitioning = 1 12773 12774 var complete = function () { 12775 this.transitioning = 0 12776 this.$element 12777 .removeClass('collapsing') 12778 .addClass('collapse') 12779 .trigger('hidden.bs.collapse') 12780 } 12781 12782 if (!$.support.transition) return complete.call(this) 12783 12784 this.$element 12785 [dimension](0) 12786 .one('bsTransitionEnd', $.proxy(complete, this)) 12787 .emulateTransitionEnd(Collapse.TRANSITION_DURATION) 12788 } 12789 12790 Collapse.prototype.toggle = function () { 12791 this[this.$element.hasClass('in') ? 'hide' : 'show']() 12792 } 12793 12794 Collapse.prototype.getParent = function () { 12795 return $(document).find(this.options.parent) 12796 .find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]') 12797 .each($.proxy(function (i, element) { 12798 var $element = $(element) 12799 this.addAriaAndCollapsedClass(getTargetFromTrigger($element), $element) 12800 }, this)) 12801 .end() 12802 } 12803 12804 Collapse.prototype.addAriaAndCollapsedClass = function ($element, $trigger) { 12805 var isOpen = $element.hasClass('in') 12806 12807 $element.attr('aria-expanded', isOpen) 12808 $trigger 12809 .toggleClass('collapsed', !isOpen) 12810 .attr('aria-expanded', isOpen) 12811 } 12812 12813 function getTargetFromTrigger($trigger) { 12814 var href 12815 var target = $trigger.attr('data-target') 12816 || (href = $trigger.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') // strip for ie7 12817 12818 return $(document).find(target) 12819 } 12820 12821 12822 // COLLAPSE PLUGIN DEFINITION 12823 // ========================== 12824 12825 function Plugin(option) { 12826 return this.each(function () { 12827 var $this = $(this) 12828 var data = $this.data('bs.collapse') 12829 var options = $.extend({}, Collapse.DEFAULTS, $this.data(), typeof option == 'object' && option) 12830 12831 if (!data && options.toggle && /show|hide/.test(option)) options.toggle = false 12832 if (!data) $this.data('bs.collapse', (data = new Collapse(this, options))) 12833 if (typeof option == 'string') data[option]() 12834 }) 12835 } 12836 12837 var old = $.fn.collapse 12838 12839 $.fn.collapse = Plugin 12840 $.fn.collapse.Constructor = Collapse 12841 12842 12843 // COLLAPSE NO CONFLICT 12844 // ==================== 12845 12846 $.fn.collapse.noConflict = function () { 12847 $.fn.collapse = old 12848 return this 12849 } 12850 12851 12852 // COLLAPSE DATA-API 12853 // ================= 12854 12855 $(document).on('click.bs.collapse.data-api', '[data-toggle="collapse"]', function (e) { 12856 var $this = $(this) 12857 12858 if (!$this.attr('data-target')) e.preventDefault() 12859 12860 var $target = getTargetFromTrigger($this) 12861 var data = $target.data('bs.collapse') 12862 var option = data ? 'toggle' : $this.data() 12863 12864 Plugin.call($target, option) 12865 }) 12866 12867}(jQuery); 12868 12869/* ======================================================================== 12870 * Bootstrap: dropdown.js v3.4.1 12871 * https://getbootstrap.com/docs/3.4/javascript/#dropdowns 12872 * ======================================================================== 12873 * Copyright 2011-2019 Twitter, Inc. 12874 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 12875 * ======================================================================== */ 12876 12877 12878+function ($) { 12879 'use strict'; 12880 12881 // DROPDOWN CLASS DEFINITION 12882 // ========================= 12883 12884 var backdrop = '.dropdown-backdrop' 12885 var toggle = '[data-toggle="dropdown"]' 12886 var Dropdown = function (element) { 12887 $(element).on('click.bs.dropdown', this.toggle) 12888 } 12889 12890 Dropdown.VERSION = '3.4.1' 12891 12892 function getParent($this) { 12893 var selector = $this.attr('data-target') 12894 12895 if (!selector) { 12896 selector = $this.attr('href') 12897 selector = selector && /#[A-Za-z]/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 12898 } 12899 12900 var $parent = selector !== '#' ? $(document).find(selector) : null 12901 12902 return $parent && $parent.length ? $parent : $this.parent() 12903 } 12904 12905 function clearMenus(e) { 12906 if (e && e.which === 3) return 12907 $(backdrop).remove() 12908 $(toggle).each(function () { 12909 var $this = $(this) 12910 var $parent = getParent($this) 12911 var relatedTarget = { relatedTarget: this } 12912 12913 if (!$parent.hasClass('open')) return 12914 12915 if (e && e.type == 'click' && /input|textarea/i.test(e.target.tagName) && $.contains($parent[0], e.target)) return 12916 12917 $parent.trigger(e = $.Event('hide.bs.dropdown', relatedTarget)) 12918 12919 if (e.isDefaultPrevented()) return 12920 12921 $this.attr('aria-expanded', 'false') 12922 $parent.removeClass('open').trigger($.Event('hidden.bs.dropdown', relatedTarget)) 12923 }) 12924 } 12925 12926 Dropdown.prototype.toggle = function (e) { 12927 var $this = $(this) 12928 12929 if ($this.is('.disabled, :disabled')) return 12930 12931 var $parent = getParent($this) 12932 var isActive = $parent.hasClass('open') 12933 12934 clearMenus() 12935 12936 if (!isActive) { 12937 if ('ontouchstart' in document.documentElement && !$parent.closest('.navbar-nav').length) { 12938 // if mobile we use a backdrop because click events don't delegate 12939 $(document.createElement('div')) 12940 .addClass('dropdown-backdrop') 12941 .insertAfter($(this)) 12942 .on('click', clearMenus) 12943 } 12944 12945 var relatedTarget = { relatedTarget: this } 12946 $parent.trigger(e = $.Event('show.bs.dropdown', relatedTarget)) 12947 12948 if (e.isDefaultPrevented()) return 12949 12950 $this 12951 .trigger('focus') 12952 .attr('aria-expanded', 'true') 12953 12954 $parent 12955 .toggleClass('open') 12956 .trigger($.Event('shown.bs.dropdown', relatedTarget)) 12957 } 12958 12959 return false 12960 } 12961 12962 Dropdown.prototype.keydown = function (e) { 12963 if (!/(38|40|27|32)/.test(e.which) || /input|textarea/i.test(e.target.tagName)) return 12964 12965 var $this = $(this) 12966 12967 e.preventDefault() 12968 e.stopPropagation() 12969 12970 if ($this.is('.disabled, :disabled')) return 12971 12972 var $parent = getParent($this) 12973 var isActive = $parent.hasClass('open') 12974 12975 if (!isActive && e.which != 27 || isActive && e.which == 27) { 12976 if (e.which == 27) $parent.find(toggle).trigger('focus') 12977 return $this.trigger('click') 12978 } 12979 12980 var desc = ' li:not(.disabled):visible a' 12981 var $items = $parent.find('.dropdown-menu' + desc) 12982 12983 if (!$items.length) return 12984 12985 var index = $items.index(e.target) 12986 12987 if (e.which == 38 && index > 0) index-- // up 12988 if (e.which == 40 && index < $items.length - 1) index++ // down 12989 if (!~index) index = 0 12990 12991 $items.eq(index).trigger('focus') 12992 } 12993 12994 12995 // DROPDOWN PLUGIN DEFINITION 12996 // ========================== 12997 12998 function Plugin(option) { 12999 return this.each(function () { 13000 var $this = $(this) 13001 var data = $this.data('bs.dropdown') 13002 13003 if (!data) $this.data('bs.dropdown', (data = new Dropdown(this))) 13004 if (typeof option == 'string') data[option].call($this) 13005 }) 13006 } 13007 13008 var old = $.fn.dropdown 13009 13010 $.fn.dropdown = Plugin 13011 $.fn.dropdown.Constructor = Dropdown 13012 13013 13014 // DROPDOWN NO CONFLICT 13015 // ==================== 13016 13017 $.fn.dropdown.noConflict = function () { 13018 $.fn.dropdown = old 13019 return this 13020 } 13021 13022 13023 // APPLY TO STANDARD DROPDOWN ELEMENTS 13024 // =================================== 13025 13026 $(document) 13027 .on('click.bs.dropdown.data-api', clearMenus) 13028 .on('click.bs.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) 13029 .on('click.bs.dropdown.data-api', toggle, Dropdown.prototype.toggle) 13030 .on('keydown.bs.dropdown.data-api', toggle, Dropdown.prototype.keydown) 13031 .on('keydown.bs.dropdown.data-api', '.dropdown-menu', Dropdown.prototype.keydown) 13032 13033}(jQuery); 13034 13035/* ======================================================================== 13036 * Bootstrap: modal.js v3.4.1 13037 * https://getbootstrap.com/docs/3.4/javascript/#modals 13038 * ======================================================================== 13039 * Copyright 2011-2019 Twitter, Inc. 13040 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 13041 * ======================================================================== */ 13042 13043 13044+function ($) { 13045 'use strict'; 13046 13047 // MODAL CLASS DEFINITION 13048 // ====================== 13049 13050 var Modal = function (element, options) { 13051 this.options = options 13052 this.$body = $(document.body) 13053 this.$element = $(element) 13054 this.$dialog = this.$element.find('.modal-dialog') 13055 this.$backdrop = null 13056 this.isShown = null 13057 this.originalBodyPad = null 13058 this.scrollbarWidth = 0 13059 this.ignoreBackdropClick = false 13060 this.fixedContent = '.navbar-fixed-top, .navbar-fixed-bottom' 13061 13062 if (this.options.remote) { 13063 this.$element 13064 .find('.modal-content') 13065 .load(this.options.remote, $.proxy(function () { 13066 this.$element.trigger('loaded.bs.modal') 13067 }, this)) 13068 } 13069 } 13070 13071 Modal.VERSION = '3.4.1' 13072 13073 Modal.TRANSITION_DURATION = 300 13074 Modal.BACKDROP_TRANSITION_DURATION = 150 13075 13076 Modal.DEFAULTS = { 13077 backdrop: true, 13078 keyboard: true, 13079 show: true 13080 } 13081 13082 Modal.prototype.toggle = function (_relatedTarget) { 13083 return this.isShown ? this.hide() : this.show(_relatedTarget) 13084 } 13085 13086 Modal.prototype.show = function (_relatedTarget) { 13087 var that = this 13088 var e = $.Event('show.bs.modal', { relatedTarget: _relatedTarget }) 13089 13090 this.$element.trigger(e) 13091 13092 if (this.isShown || e.isDefaultPrevented()) return 13093 13094 this.isShown = true 13095 13096 this.checkScrollbar() 13097 this.setScrollbar() 13098 this.$body.addClass('modal-open') 13099 13100 this.escape() 13101 this.resize() 13102 13103 this.$element.on('click.dismiss.bs.modal', '[data-dismiss="modal"]', $.proxy(this.hide, this)) 13104 13105 this.$dialog.on('mousedown.dismiss.bs.modal', function () { 13106 that.$element.one('mouseup.dismiss.bs.modal', function (e) { 13107 if ($(e.target).is(that.$element)) that.ignoreBackdropClick = true 13108 }) 13109 }) 13110 13111 this.backdrop(function () { 13112 var transition = $.support.transition && that.$element.hasClass('fade') 13113 13114 if (!that.$element.parent().length) { 13115 that.$element.appendTo(that.$body) // don't move modals dom position 13116 } 13117 13118 that.$element 13119 .show() 13120 .scrollTop(0) 13121 13122 that.adjustDialog() 13123 13124 if (transition) { 13125 that.$element[0].offsetWidth // force reflow 13126 } 13127 13128 that.$element.addClass('in') 13129 13130 that.enforceFocus() 13131 13132 var e = $.Event('shown.bs.modal', { relatedTarget: _relatedTarget }) 13133 13134 transition ? 13135 that.$dialog // wait for modal to slide in 13136 .one('bsTransitionEnd', function () { 13137 that.$element.trigger('focus').trigger(e) 13138 }) 13139 .emulateTransitionEnd(Modal.TRANSITION_DURATION) : 13140 that.$element.trigger('focus').trigger(e) 13141 }) 13142 } 13143 13144 Modal.prototype.hide = function (e) { 13145 if (e) e.preventDefault() 13146 13147 e = $.Event('hide.bs.modal') 13148 13149 this.$element.trigger(e) 13150 13151 if (!this.isShown || e.isDefaultPrevented()) return 13152 13153 this.isShown = false 13154 13155 this.escape() 13156 this.resize() 13157 13158 $(document).off('focusin.bs.modal') 13159 13160 this.$element 13161 .removeClass('in') 13162 .off('click.dismiss.bs.modal') 13163 .off('mouseup.dismiss.bs.modal') 13164 13165 this.$dialog.off('mousedown.dismiss.bs.modal') 13166 13167 $.support.transition && this.$element.hasClass('fade') ? 13168 this.$element 13169 .one('bsTransitionEnd', $.proxy(this.hideModal, this)) 13170 .emulateTransitionEnd(Modal.TRANSITION_DURATION) : 13171 this.hideModal() 13172 } 13173 13174 Modal.prototype.enforceFocus = function () { 13175 $(document) 13176 .off('focusin.bs.modal') // guard against infinite focus loop 13177 .on('focusin.bs.modal', $.proxy(function (e) { 13178 if (document !== e.target && 13179 this.$element[0] !== e.target && 13180 !this.$element.has(e.target).length) { 13181 this.$element.trigger('focus') 13182 } 13183 }, this)) 13184 } 13185 13186 Modal.prototype.escape = function () { 13187 if (this.isShown && this.options.keyboard) { 13188 this.$element.on('keydown.dismiss.bs.modal', $.proxy(function (e) { 13189 e.which == 27 && this.hide() 13190 }, this)) 13191 } else if (!this.isShown) { 13192 this.$element.off('keydown.dismiss.bs.modal') 13193 } 13194 } 13195 13196 Modal.prototype.resize = function () { 13197 if (this.isShown) { 13198 $(window).on('resize.bs.modal', $.proxy(this.handleUpdate, this)) 13199 } else { 13200 $(window).off('resize.bs.modal') 13201 } 13202 } 13203 13204 Modal.prototype.hideModal = function () { 13205 var that = this 13206 this.$element.hide() 13207 this.backdrop(function () { 13208 that.$body.removeClass('modal-open') 13209 that.resetAdjustments() 13210 that.resetScrollbar() 13211 that.$element.trigger('hidden.bs.modal') 13212 }) 13213 } 13214 13215 Modal.prototype.removeBackdrop = function () { 13216 this.$backdrop && this.$backdrop.remove() 13217 this.$backdrop = null 13218 } 13219 13220 Modal.prototype.backdrop = function (callback) { 13221 var that = this 13222 var animate = this.$element.hasClass('fade') ? 'fade' : '' 13223 13224 if (this.isShown && this.options.backdrop) { 13225 var doAnimate = $.support.transition && animate 13226 13227 this.$backdrop = $(document.createElement('div')) 13228 .addClass('modal-backdrop ' + animate) 13229 .appendTo(this.$body) 13230 13231 this.$element.on('click.dismiss.bs.modal', $.proxy(function (e) { 13232 if (this.ignoreBackdropClick) { 13233 this.ignoreBackdropClick = false 13234 return 13235 } 13236 if (e.target !== e.currentTarget) return 13237 this.options.backdrop == 'static' 13238 ? this.$element[0].focus() 13239 : this.hide() 13240 }, this)) 13241 13242 if (doAnimate) this.$backdrop[0].offsetWidth // force reflow 13243 13244 this.$backdrop.addClass('in') 13245 13246 if (!callback) return 13247 13248 doAnimate ? 13249 this.$backdrop 13250 .one('bsTransitionEnd', callback) 13251 .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : 13252 callback() 13253 13254 } else if (!this.isShown && this.$backdrop) { 13255 this.$backdrop.removeClass('in') 13256 13257 var callbackRemove = function () { 13258 that.removeBackdrop() 13259 callback && callback() 13260 } 13261 $.support.transition && this.$element.hasClass('fade') ? 13262 this.$backdrop 13263 .one('bsTransitionEnd', callbackRemove) 13264 .emulateTransitionEnd(Modal.BACKDROP_TRANSITION_DURATION) : 13265 callbackRemove() 13266 13267 } else if (callback) { 13268 callback() 13269 } 13270 } 13271 13272 // these following methods are used to handle overflowing modals 13273 13274 Modal.prototype.handleUpdate = function () { 13275 this.adjustDialog() 13276 } 13277 13278 Modal.prototype.adjustDialog = function () { 13279 var modalIsOverflowing = this.$element[0].scrollHeight > document.documentElement.clientHeight 13280 13281 this.$element.css({ 13282 paddingLeft: !this.bodyIsOverflowing && modalIsOverflowing ? this.scrollbarWidth : '', 13283 paddingRight: this.bodyIsOverflowing && !modalIsOverflowing ? this.scrollbarWidth : '' 13284 }) 13285 } 13286 13287 Modal.prototype.resetAdjustments = function () { 13288 this.$element.css({ 13289 paddingLeft: '', 13290 paddingRight: '' 13291 }) 13292 } 13293 13294 Modal.prototype.checkScrollbar = function () { 13295 var fullWindowWidth = window.innerWidth 13296 if (!fullWindowWidth) { // workaround for missing window.innerWidth in IE8 13297 var documentElementRect = document.documentElement.getBoundingClientRect() 13298 fullWindowWidth = documentElementRect.right - Math.abs(documentElementRect.left) 13299 } 13300 this.bodyIsOverflowing = document.body.clientWidth < fullWindowWidth 13301 this.scrollbarWidth = this.measureScrollbar() 13302 } 13303 13304 Modal.prototype.setScrollbar = function () { 13305 var bodyPad = parseInt((this.$body.css('padding-right') || 0), 10) 13306 this.originalBodyPad = document.body.style.paddingRight || '' 13307 var scrollbarWidth = this.scrollbarWidth 13308 if (this.bodyIsOverflowing) { 13309 this.$body.css('padding-right', bodyPad + scrollbarWidth) 13310 $(this.fixedContent).each(function (index, element) { 13311 var actualPadding = element.style.paddingRight 13312 var calculatedPadding = $(element).css('padding-right') 13313 $(element) 13314 .data('padding-right', actualPadding) 13315 .css('padding-right', parseFloat(calculatedPadding) + scrollbarWidth + 'px') 13316 }) 13317 } 13318 } 13319 13320 Modal.prototype.resetScrollbar = function () { 13321 this.$body.css('padding-right', this.originalBodyPad) 13322 $(this.fixedContent).each(function (index, element) { 13323 var padding = $(element).data('padding-right') 13324 $(element).removeData('padding-right') 13325 element.style.paddingRight = padding ? padding : '' 13326 }) 13327 } 13328 13329 Modal.prototype.measureScrollbar = function () { // thx walsh 13330 var scrollDiv = document.createElement('div') 13331 scrollDiv.className = 'modal-scrollbar-measure' 13332 this.$body.append(scrollDiv) 13333 var scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth 13334 this.$body[0].removeChild(scrollDiv) 13335 return scrollbarWidth 13336 } 13337 13338 13339 // MODAL PLUGIN DEFINITION 13340 // ======================= 13341 13342 function Plugin(option, _relatedTarget) { 13343 return this.each(function () { 13344 var $this = $(this) 13345 var data = $this.data('bs.modal') 13346 var options = $.extend({}, Modal.DEFAULTS, $this.data(), typeof option == 'object' && option) 13347 13348 if (!data) $this.data('bs.modal', (data = new Modal(this, options))) 13349 if (typeof option == 'string') data[option](_relatedTarget) 13350 else if (options.show) data.show(_relatedTarget) 13351 }) 13352 } 13353 13354 var old = $.fn.modal 13355 13356 $.fn.modal = Plugin 13357 $.fn.modal.Constructor = Modal 13358 13359 13360 // MODAL NO CONFLICT 13361 // ================= 13362 13363 $.fn.modal.noConflict = function () { 13364 $.fn.modal = old 13365 return this 13366 } 13367 13368 13369 // MODAL DATA-API 13370 // ============== 13371 13372 $(document).on('click.bs.modal.data-api', '[data-toggle="modal"]', function (e) { 13373 var $this = $(this) 13374 var href = $this.attr('href') 13375 var target = $this.attr('data-target') || 13376 (href && href.replace(/.*(?=#[^\s]+$)/, '')) // strip for ie7 13377 13378 var $target = $(document).find(target) 13379 var option = $target.data('bs.modal') ? 'toggle' : $.extend({ remote: !/#/.test(href) && href }, $target.data(), $this.data()) 13380 13381 if ($this.is('a')) e.preventDefault() 13382 13383 $target.one('show.bs.modal', function (showEvent) { 13384 if (showEvent.isDefaultPrevented()) return // only register focus restorer if modal will actually get shown 13385 $target.one('hidden.bs.modal', function () { 13386 $this.is(':visible') && $this.trigger('focus') 13387 }) 13388 }) 13389 Plugin.call($target, option, this) 13390 }) 13391 13392}(jQuery); 13393 13394/* ======================================================================== 13395 * Bootstrap: tooltip.js v3.4.1 13396 * https://getbootstrap.com/docs/3.4/javascript/#tooltip 13397 * Inspired by the original jQuery.tipsy by Jason Frame 13398 * ======================================================================== 13399 * Copyright 2011-2019 Twitter, Inc. 13400 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 13401 * ======================================================================== */ 13402 13403+function ($) { 13404 'use strict'; 13405 13406 var DISALLOWED_ATTRIBUTES = ['sanitize', 'whiteList', 'sanitizeFn'] 13407 13408 var uriAttrs = [ 13409 'background', 13410 'cite', 13411 'href', 13412 'itemtype', 13413 'longdesc', 13414 'poster', 13415 'src', 13416 'xlink:href' 13417 ] 13418 13419 var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i 13420 13421 var DefaultWhitelist = { 13422 // Global attributes allowed on any supplied element below. 13423 '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], 13424 a: ['target', 'href', 'title', 'rel'], 13425 area: [], 13426 b: [], 13427 br: [], 13428 col: [], 13429 code: [], 13430 div: [], 13431 em: [], 13432 hr: [], 13433 h1: [], 13434 h2: [], 13435 h3: [], 13436 h4: [], 13437 h5: [], 13438 h6: [], 13439 i: [], 13440 img: ['src', 'alt', 'title', 'width', 'height'], 13441 li: [], 13442 ol: [], 13443 p: [], 13444 pre: [], 13445 s: [], 13446 small: [], 13447 span: [], 13448 sub: [], 13449 sup: [], 13450 strong: [], 13451 u: [], 13452 ul: [] 13453 } 13454 13455 /** 13456 * A pattern that recognizes a commonly useful subset of URLs that are safe. 13457 * 13458 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 13459 */ 13460 var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi 13461 13462 /** 13463 * A pattern that matches safe data URLs. Only matches image, video and audio types. 13464 * 13465 * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts 13466 */ 13467 var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i 13468 13469 function allowedAttribute(attr, allowedAttributeList) { 13470 var attrName = attr.nodeName.toLowerCase() 13471 13472 if ($.inArray(attrName, allowedAttributeList) !== -1) { 13473 if ($.inArray(attrName, uriAttrs) !== -1) { 13474 return Boolean(attr.nodeValue.match(SAFE_URL_PATTERN) || attr.nodeValue.match(DATA_URL_PATTERN)) 13475 } 13476 13477 return true 13478 } 13479 13480 var regExp = $(allowedAttributeList).filter(function (index, value) { 13481 return value instanceof RegExp 13482 }) 13483 13484 // Check if a regular expression validates the attribute. 13485 for (var i = 0, l = regExp.length; i < l; i++) { 13486 if (attrName.match(regExp[i])) { 13487 return true 13488 } 13489 } 13490 13491 return false 13492 } 13493 13494 function sanitizeHtml(unsafeHtml, whiteList, sanitizeFn) { 13495 if (unsafeHtml.length === 0) { 13496 return unsafeHtml 13497 } 13498 13499 if (sanitizeFn && typeof sanitizeFn === 'function') { 13500 return sanitizeFn(unsafeHtml) 13501 } 13502 13503 // IE 8 and below don't support createHTMLDocument 13504 if (!document.implementation || !document.implementation.createHTMLDocument) { 13505 return unsafeHtml 13506 } 13507 13508 var createdDocument = document.implementation.createHTMLDocument('sanitization') 13509 createdDocument.body.innerHTML = unsafeHtml 13510 13511 var whitelistKeys = $.map(whiteList, function (el, i) { return i }) 13512 var elements = $(createdDocument.body).find('*') 13513 13514 for (var i = 0, len = elements.length; i < len; i++) { 13515 var el = elements[i] 13516 var elName = el.nodeName.toLowerCase() 13517 13518 if ($.inArray(elName, whitelistKeys) === -1) { 13519 el.parentNode.removeChild(el) 13520 13521 continue 13522 } 13523 13524 var attributeList = $.map(el.attributes, function (el) { return el }) 13525 var whitelistedAttributes = [].concat(whiteList['*'] || [], whiteList[elName] || []) 13526 13527 for (var j = 0, len2 = attributeList.length; j < len2; j++) { 13528 if (!allowedAttribute(attributeList[j], whitelistedAttributes)) { 13529 el.removeAttribute(attributeList[j].nodeName) 13530 } 13531 } 13532 } 13533 13534 return createdDocument.body.innerHTML 13535 } 13536 13537 // TOOLTIP PUBLIC CLASS DEFINITION 13538 // =============================== 13539 13540 var Tooltip = function (element, options) { 13541 this.type = null 13542 this.options = null 13543 this.enabled = null 13544 this.timeout = null 13545 this.hoverState = null 13546 this.$element = null 13547 this.inState = null 13548 13549 this.init('tooltip', element, options) 13550 } 13551 13552 Tooltip.VERSION = '3.4.1' 13553 13554 Tooltip.TRANSITION_DURATION = 150 13555 13556 Tooltip.DEFAULTS = { 13557 animation: true, 13558 placement: 'top', 13559 selector: false, 13560 template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', 13561 trigger: 'hover focus', 13562 title: '', 13563 delay: 0, 13564 html: false, 13565 container: false, 13566 viewport: { 13567 selector: 'body', 13568 padding: 0 13569 }, 13570 sanitize : true, 13571 sanitizeFn : null, 13572 whiteList : DefaultWhitelist 13573 } 13574 13575 Tooltip.prototype.init = function (type, element, options) { 13576 this.enabled = true 13577 this.type = type 13578 this.$element = $(element) 13579 this.options = this.getOptions(options) 13580 this.$viewport = this.options.viewport && $(document).find($.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : (this.options.viewport.selector || this.options.viewport)) 13581 this.inState = { click: false, hover: false, focus: false } 13582 13583 if (this.$element[0] instanceof document.constructor && !this.options.selector) { 13584 throw new Error('`selector` option must be specified when initializing ' + this.type + ' on the window.document object!') 13585 } 13586 13587 var triggers = this.options.trigger.split(' ') 13588 13589 for (var i = triggers.length; i--;) { 13590 var trigger = triggers[i] 13591 13592 if (trigger == 'click') { 13593 this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) 13594 } else if (trigger != 'manual') { 13595 var eventIn = trigger == 'hover' ? 'mouseenter' : 'focusin' 13596 var eventOut = trigger == 'hover' ? 'mouseleave' : 'focusout' 13597 13598 this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) 13599 this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) 13600 } 13601 } 13602 13603 this.options.selector ? 13604 (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : 13605 this.fixTitle() 13606 } 13607 13608 Tooltip.prototype.getDefaults = function () { 13609 return Tooltip.DEFAULTS 13610 } 13611 13612 Tooltip.prototype.getOptions = function (options) { 13613 var dataAttributes = this.$element.data() 13614 13615 for (var dataAttr in dataAttributes) { 13616 if (dataAttributes.hasOwnProperty(dataAttr) && $.inArray(dataAttr, DISALLOWED_ATTRIBUTES) !== -1) { 13617 delete dataAttributes[dataAttr] 13618 } 13619 } 13620 13621 options = $.extend({}, this.getDefaults(), dataAttributes, options) 13622 13623 if (options.delay && typeof options.delay == 'number') { 13624 options.delay = { 13625 show: options.delay, 13626 hide: options.delay 13627 } 13628 } 13629 13630 if (options.sanitize) { 13631 options.template = sanitizeHtml(options.template, options.whiteList, options.sanitizeFn) 13632 } 13633 13634 return options 13635 } 13636 13637 Tooltip.prototype.getDelegateOptions = function () { 13638 var options = {} 13639 var defaults = this.getDefaults() 13640 13641 this._options && $.each(this._options, function (key, value) { 13642 if (defaults[key] != value) options[key] = value 13643 }) 13644 13645 return options 13646 } 13647 13648 Tooltip.prototype.enter = function (obj) { 13649 var self = obj instanceof this.constructor ? 13650 obj : $(obj.currentTarget).data('bs.' + this.type) 13651 13652 if (!self) { 13653 self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) 13654 $(obj.currentTarget).data('bs.' + this.type, self) 13655 } 13656 13657 if (obj instanceof $.Event) { 13658 self.inState[obj.type == 'focusin' ? 'focus' : 'hover'] = true 13659 } 13660 13661 if (self.tip().hasClass('in') || self.hoverState == 'in') { 13662 self.hoverState = 'in' 13663 return 13664 } 13665 13666 clearTimeout(self.timeout) 13667 13668 self.hoverState = 'in' 13669 13670 if (!self.options.delay || !self.options.delay.show) return self.show() 13671 13672 self.timeout = setTimeout(function () { 13673 if (self.hoverState == 'in') self.show() 13674 }, self.options.delay.show) 13675 } 13676 13677 Tooltip.prototype.isInStateTrue = function () { 13678 for (var key in this.inState) { 13679 if (this.inState[key]) return true 13680 } 13681 13682 return false 13683 } 13684 13685 Tooltip.prototype.leave = function (obj) { 13686 var self = obj instanceof this.constructor ? 13687 obj : $(obj.currentTarget).data('bs.' + this.type) 13688 13689 if (!self) { 13690 self = new this.constructor(obj.currentTarget, this.getDelegateOptions()) 13691 $(obj.currentTarget).data('bs.' + this.type, self) 13692 } 13693 13694 if (obj instanceof $.Event) { 13695 self.inState[obj.type == 'focusout' ? 'focus' : 'hover'] = false 13696 } 13697 13698 if (self.isInStateTrue()) return 13699 13700 clearTimeout(self.timeout) 13701 13702 self.hoverState = 'out' 13703 13704 if (!self.options.delay || !self.options.delay.hide) return self.hide() 13705 13706 self.timeout = setTimeout(function () { 13707 if (self.hoverState == 'out') self.hide() 13708 }, self.options.delay.hide) 13709 } 13710 13711 Tooltip.prototype.show = function () { 13712 var e = $.Event('show.bs.' + this.type) 13713 13714 if (this.hasContent() && this.enabled) { 13715 this.$element.trigger(e) 13716 13717 var inDom = $.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]) 13718 if (e.isDefaultPrevented() || !inDom) return 13719 var that = this 13720 13721 var $tip = this.tip() 13722 13723 var tipId = this.getUID(this.type) 13724 13725 this.setContent() 13726 $tip.attr('id', tipId) 13727 this.$element.attr('aria-describedby', tipId) 13728 13729 if (this.options.animation) $tip.addClass('fade') 13730 13731 var placement = typeof this.options.placement == 'function' ? 13732 this.options.placement.call(this, $tip[0], this.$element[0]) : 13733 this.options.placement 13734 13735 var autoToken = /\s?auto?\s?/i 13736 var autoPlace = autoToken.test(placement) 13737 if (autoPlace) placement = placement.replace(autoToken, '') || 'top' 13738 13739 $tip 13740 .detach() 13741 .css({ top: 0, left: 0, display: 'block' }) 13742 .addClass(placement) 13743 .data('bs.' + this.type, this) 13744 13745 this.options.container ? $tip.appendTo($(document).find(this.options.container)) : $tip.insertAfter(this.$element) 13746 this.$element.trigger('inserted.bs.' + this.type) 13747 13748 var pos = this.getPosition() 13749 var actualWidth = $tip[0].offsetWidth 13750 var actualHeight = $tip[0].offsetHeight 13751 13752 if (autoPlace) { 13753 var orgPlacement = placement 13754 var viewportDim = this.getPosition(this.$viewport) 13755 13756 placement = placement == 'bottom' && pos.bottom + actualHeight > viewportDim.bottom ? 'top' : 13757 placement == 'top' && pos.top - actualHeight < viewportDim.top ? 'bottom' : 13758 placement == 'right' && pos.right + actualWidth > viewportDim.width ? 'left' : 13759 placement == 'left' && pos.left - actualWidth < viewportDim.left ? 'right' : 13760 placement 13761 13762 $tip 13763 .removeClass(orgPlacement) 13764 .addClass(placement) 13765 } 13766 13767 var calculatedOffset = this.getCalculatedOffset(placement, pos, actualWidth, actualHeight) 13768 13769 this.applyPlacement(calculatedOffset, placement) 13770 13771 var complete = function () { 13772 var prevHoverState = that.hoverState 13773 that.$element.trigger('shown.bs.' + that.type) 13774 that.hoverState = null 13775 13776 if (prevHoverState == 'out') that.leave(that) 13777 } 13778 13779 $.support.transition && this.$tip.hasClass('fade') ? 13780 $tip 13781 .one('bsTransitionEnd', complete) 13782 .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : 13783 complete() 13784 } 13785 } 13786 13787 Tooltip.prototype.applyPlacement = function (offset, placement) { 13788 var $tip = this.tip() 13789 var width = $tip[0].offsetWidth 13790 var height = $tip[0].offsetHeight 13791 13792 // manually read margins because getBoundingClientRect includes difference 13793 var marginTop = parseInt($tip.css('margin-top'), 10) 13794 var marginLeft = parseInt($tip.css('margin-left'), 10) 13795 13796 // we must check for NaN for ie 8/9 13797 if (isNaN(marginTop)) marginTop = 0 13798 if (isNaN(marginLeft)) marginLeft = 0 13799 13800 offset.top += marginTop 13801 offset.left += marginLeft 13802 13803 // $.fn.offset doesn't round pixel values 13804 // so we use setOffset directly with our own function B-0 13805 $.offset.setOffset($tip[0], $.extend({ 13806 using: function (props) { 13807 $tip.css({ 13808 top: Math.round(props.top), 13809 left: Math.round(props.left) 13810 }) 13811 } 13812 }, offset), 0) 13813 13814 $tip.addClass('in') 13815 13816 // check to see if placing tip in new offset caused the tip to resize itself 13817 var actualWidth = $tip[0].offsetWidth 13818 var actualHeight = $tip[0].offsetHeight 13819 13820 if (placement == 'top' && actualHeight != height) { 13821 offset.top = offset.top + height - actualHeight 13822 } 13823 13824 var delta = this.getViewportAdjustedDelta(placement, offset, actualWidth, actualHeight) 13825 13826 if (delta.left) offset.left += delta.left 13827 else offset.top += delta.top 13828 13829 var isVertical = /top|bottom/.test(placement) 13830 var arrowDelta = isVertical ? delta.left * 2 - width + actualWidth : delta.top * 2 - height + actualHeight 13831 var arrowOffsetPosition = isVertical ? 'offsetWidth' : 'offsetHeight' 13832 13833 $tip.offset(offset) 13834 this.replaceArrow(arrowDelta, $tip[0][arrowOffsetPosition], isVertical) 13835 } 13836 13837 Tooltip.prototype.replaceArrow = function (delta, dimension, isVertical) { 13838 this.arrow() 13839 .css(isVertical ? 'left' : 'top', 50 * (1 - delta / dimension) + '%') 13840 .css(isVertical ? 'top' : 'left', '') 13841 } 13842 13843 Tooltip.prototype.setContent = function () { 13844 var $tip = this.tip() 13845 var title = this.getTitle() 13846 13847 if (this.options.html) { 13848 if (this.options.sanitize) { 13849 title = sanitizeHtml(title, this.options.whiteList, this.options.sanitizeFn) 13850 } 13851 13852 $tip.find('.tooltip-inner').html(title) 13853 } else { 13854 $tip.find('.tooltip-inner').text(title) 13855 } 13856 13857 $tip.removeClass('fade in top bottom left right') 13858 } 13859 13860 Tooltip.prototype.hide = function (callback) { 13861 var that = this 13862 var $tip = $(this.$tip) 13863 var e = $.Event('hide.bs.' + this.type) 13864 13865 function complete() { 13866 if (that.hoverState != 'in') $tip.detach() 13867 if (that.$element) { // TODO: Check whether guarding this code with this `if` is really necessary. 13868 that.$element 13869 .removeAttr('aria-describedby') 13870 .trigger('hidden.bs.' + that.type) 13871 } 13872 callback && callback() 13873 } 13874 13875 this.$element.trigger(e) 13876 13877 if (e.isDefaultPrevented()) return 13878 13879 $tip.removeClass('in') 13880 13881 $.support.transition && $tip.hasClass('fade') ? 13882 $tip 13883 .one('bsTransitionEnd', complete) 13884 .emulateTransitionEnd(Tooltip.TRANSITION_DURATION) : 13885 complete() 13886 13887 this.hoverState = null 13888 13889 return this 13890 } 13891 13892 Tooltip.prototype.fixTitle = function () { 13893 var $e = this.$element 13894 if ($e.attr('title') || typeof $e.attr('data-original-title') != 'string') { 13895 $e.attr('data-original-title', $e.attr('title') || '').attr('title', '') 13896 } 13897 } 13898 13899 Tooltip.prototype.hasContent = function () { 13900 return this.getTitle() 13901 } 13902 13903 Tooltip.prototype.getPosition = function ($element) { 13904 $element = $element || this.$element 13905 13906 var el = $element[0] 13907 var isBody = el.tagName == 'BODY' 13908 13909 var elRect = el.getBoundingClientRect() 13910 if (elRect.width == null) { 13911 // width and height are missing in IE8, so compute them manually; see https://github.com/twbs/bootstrap/issues/14093 13912 elRect = $.extend({}, elRect, { width: elRect.right - elRect.left, height: elRect.bottom - elRect.top }) 13913 } 13914 var isSvg = window.SVGElement && el instanceof window.SVGElement 13915 // Avoid using $.offset() on SVGs since it gives incorrect results in jQuery 3. 13916 // See https://github.com/twbs/bootstrap/issues/20280 13917 var elOffset = isBody ? { top: 0, left: 0 } : (isSvg ? null : $element.offset()) 13918 var scroll = { scroll: isBody ? document.documentElement.scrollTop || document.body.scrollTop : $element.scrollTop() } 13919 var outerDims = isBody ? { width: $(window).width(), height: $(window).height() } : null 13920 13921 return $.extend({}, elRect, scroll, outerDims, elOffset) 13922 } 13923 13924 Tooltip.prototype.getCalculatedOffset = function (placement, pos, actualWidth, actualHeight) { 13925 return placement == 'bottom' ? { top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2 } : 13926 placement == 'top' ? { top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2 } : 13927 placement == 'left' ? { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth } : 13928 /* placement == 'right' */ { top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width } 13929 13930 } 13931 13932 Tooltip.prototype.getViewportAdjustedDelta = function (placement, pos, actualWidth, actualHeight) { 13933 var delta = { top: 0, left: 0 } 13934 if (!this.$viewport) return delta 13935 13936 var viewportPadding = this.options.viewport && this.options.viewport.padding || 0 13937 var viewportDimensions = this.getPosition(this.$viewport) 13938 13939 if (/right|left/.test(placement)) { 13940 var topEdgeOffset = pos.top - viewportPadding - viewportDimensions.scroll 13941 var bottomEdgeOffset = pos.top + viewportPadding - viewportDimensions.scroll + actualHeight 13942 if (topEdgeOffset < viewportDimensions.top) { // top overflow 13943 delta.top = viewportDimensions.top - topEdgeOffset 13944 } else if (bottomEdgeOffset > viewportDimensions.top + viewportDimensions.height) { // bottom overflow 13945 delta.top = viewportDimensions.top + viewportDimensions.height - bottomEdgeOffset 13946 } 13947 } else { 13948 var leftEdgeOffset = pos.left - viewportPadding 13949 var rightEdgeOffset = pos.left + viewportPadding + actualWidth 13950 if (leftEdgeOffset < viewportDimensions.left) { // left overflow 13951 delta.left = viewportDimensions.left - leftEdgeOffset 13952 } else if (rightEdgeOffset > viewportDimensions.right) { // right overflow 13953 delta.left = viewportDimensions.left + viewportDimensions.width - rightEdgeOffset 13954 } 13955 } 13956 13957 return delta 13958 } 13959 13960 Tooltip.prototype.getTitle = function () { 13961 var title 13962 var $e = this.$element 13963 var o = this.options 13964 13965 title = $e.attr('data-original-title') 13966 || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) 13967 13968 return title 13969 } 13970 13971 Tooltip.prototype.getUID = function (prefix) { 13972 do prefix += ~~(Math.random() * 1000000) 13973 while (document.getElementById(prefix)) 13974 return prefix 13975 } 13976 13977 Tooltip.prototype.tip = function () { 13978 if (!this.$tip) { 13979 this.$tip = $(this.options.template) 13980 if (this.$tip.length != 1) { 13981 throw new Error(this.type + ' `template` option must consist of exactly 1 top-level element!') 13982 } 13983 } 13984 return this.$tip 13985 } 13986 13987 Tooltip.prototype.arrow = function () { 13988 return (this.$arrow = this.$arrow || this.tip().find('.tooltip-arrow')) 13989 } 13990 13991 Tooltip.prototype.enable = function () { 13992 this.enabled = true 13993 } 13994 13995 Tooltip.prototype.disable = function () { 13996 this.enabled = false 13997 } 13998 13999 Tooltip.prototype.toggleEnabled = function () { 14000 this.enabled = !this.enabled 14001 } 14002 14003 Tooltip.prototype.toggle = function (e) { 14004 var self = this 14005 if (e) { 14006 self = $(e.currentTarget).data('bs.' + this.type) 14007 if (!self) { 14008 self = new this.constructor(e.currentTarget, this.getDelegateOptions()) 14009 $(e.currentTarget).data('bs.' + this.type, self) 14010 } 14011 } 14012 14013 if (e) { 14014 self.inState.click = !self.inState.click 14015 if (self.isInStateTrue()) self.enter(self) 14016 else self.leave(self) 14017 } else { 14018 self.tip().hasClass('in') ? self.leave(self) : self.enter(self) 14019 } 14020 } 14021 14022 Tooltip.prototype.destroy = function () { 14023 var that = this 14024 clearTimeout(this.timeout) 14025 this.hide(function () { 14026 that.$element.off('.' + that.type).removeData('bs.' + that.type) 14027 if (that.$tip) { 14028 that.$tip.detach() 14029 } 14030 that.$tip = null 14031 that.$arrow = null 14032 that.$viewport = null 14033 that.$element = null 14034 }) 14035 } 14036 14037 Tooltip.prototype.sanitizeHtml = function (unsafeHtml) { 14038 return sanitizeHtml(unsafeHtml, this.options.whiteList, this.options.sanitizeFn) 14039 } 14040 14041 // TOOLTIP PLUGIN DEFINITION 14042 // ========================= 14043 14044 function Plugin(option) { 14045 return this.each(function () { 14046 var $this = $(this) 14047 var data = $this.data('bs.tooltip') 14048 var options = typeof option == 'object' && option 14049 14050 if (!data && /destroy|hide/.test(option)) return 14051 if (!data) $this.data('bs.tooltip', (data = new Tooltip(this, options))) 14052 if (typeof option == 'string') data[option]() 14053 }) 14054 } 14055 14056 var old = $.fn.tooltip 14057 14058 $.fn.tooltip = Plugin 14059 $.fn.tooltip.Constructor = Tooltip 14060 14061 14062 // TOOLTIP NO CONFLICT 14063 // =================== 14064 14065 $.fn.tooltip.noConflict = function () { 14066 $.fn.tooltip = old 14067 return this 14068 } 14069 14070}(jQuery); 14071 14072/* ======================================================================== 14073 * Bootstrap: popover.js v3.4.1 14074 * https://getbootstrap.com/docs/3.4/javascript/#popovers 14075 * ======================================================================== 14076 * Copyright 2011-2019 Twitter, Inc. 14077 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 14078 * ======================================================================== */ 14079 14080 14081+function ($) { 14082 'use strict'; 14083 14084 // POPOVER PUBLIC CLASS DEFINITION 14085 // =============================== 14086 14087 var Popover = function (element, options) { 14088 this.init('popover', element, options) 14089 } 14090 14091 if (!$.fn.tooltip) throw new Error('Popover requires tooltip.js') 14092 14093 Popover.VERSION = '3.4.1' 14094 14095 Popover.DEFAULTS = $.extend({}, $.fn.tooltip.Constructor.DEFAULTS, { 14096 placement: 'right', 14097 trigger: 'click', 14098 content: '', 14099 template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' 14100 }) 14101 14102 14103 // NOTE: POPOVER EXTENDS tooltip.js 14104 // ================================ 14105 14106 Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype) 14107 14108 Popover.prototype.constructor = Popover 14109 14110 Popover.prototype.getDefaults = function () { 14111 return Popover.DEFAULTS 14112 } 14113 14114 Popover.prototype.setContent = function () { 14115 var $tip = this.tip() 14116 var title = this.getTitle() 14117 var content = this.getContent() 14118 14119 if (this.options.html) { 14120 var typeContent = typeof content 14121 14122 if (this.options.sanitize) { 14123 title = this.sanitizeHtml(title) 14124 14125 if (typeContent === 'string') { 14126 content = this.sanitizeHtml(content) 14127 } 14128 } 14129 14130 $tip.find('.popover-title').html(title) 14131 $tip.find('.popover-content').children().detach().end()[ 14132 typeContent === 'string' ? 'html' : 'append' 14133 ](content) 14134 } else { 14135 $tip.find('.popover-title').text(title) 14136 $tip.find('.popover-content').children().detach().end().text(content) 14137 } 14138 14139 $tip.removeClass('fade top bottom left right in') 14140 14141 // IE8 doesn't accept hiding via the `:empty` pseudo selector, we have to do 14142 // this manually by checking the contents. 14143 if (!$tip.find('.popover-title').html()) $tip.find('.popover-title').hide() 14144 } 14145 14146 Popover.prototype.hasContent = function () { 14147 return this.getTitle() || this.getContent() 14148 } 14149 14150 Popover.prototype.getContent = function () { 14151 var $e = this.$element 14152 var o = this.options 14153 14154 return $e.attr('data-content') 14155 || (typeof o.content == 'function' ? 14156 o.content.call($e[0]) : 14157 o.content) 14158 } 14159 14160 Popover.prototype.arrow = function () { 14161 return (this.$arrow = this.$arrow || this.tip().find('.arrow')) 14162 } 14163 14164 14165 // POPOVER PLUGIN DEFINITION 14166 // ========================= 14167 14168 function Plugin(option) { 14169 return this.each(function () { 14170 var $this = $(this) 14171 var data = $this.data('bs.popover') 14172 var options = typeof option == 'object' && option 14173 14174 if (!data && /destroy|hide/.test(option)) return 14175 if (!data) $this.data('bs.popover', (data = new Popover(this, options))) 14176 if (typeof option == 'string') data[option]() 14177 }) 14178 } 14179 14180 var old = $.fn.popover 14181 14182 $.fn.popover = Plugin 14183 $.fn.popover.Constructor = Popover 14184 14185 14186 // POPOVER NO CONFLICT 14187 // =================== 14188 14189 $.fn.popover.noConflict = function () { 14190 $.fn.popover = old 14191 return this 14192 } 14193 14194}(jQuery); 14195 14196/* ======================================================================== 14197 * Bootstrap: scrollspy.js v3.4.1 14198 * https://getbootstrap.com/docs/3.4/javascript/#scrollspy 14199 * ======================================================================== 14200 * Copyright 2011-2019 Twitter, Inc. 14201 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 14202 * ======================================================================== */ 14203 14204 14205+function ($) { 14206 'use strict'; 14207 14208 // SCROLLSPY CLASS DEFINITION 14209 // ========================== 14210 14211 function ScrollSpy(element, options) { 14212 this.$body = $(document.body) 14213 this.$scrollElement = $(element).is(document.body) ? $(window) : $(element) 14214 this.options = $.extend({}, ScrollSpy.DEFAULTS, options) 14215 this.selector = (this.options.target || '') + ' .nav li > a' 14216 this.offsets = [] 14217 this.targets = [] 14218 this.activeTarget = null 14219 this.scrollHeight = 0 14220 14221 this.$scrollElement.on('scroll.bs.scrollspy', $.proxy(this.process, this)) 14222 this.refresh() 14223 this.process() 14224 } 14225 14226 ScrollSpy.VERSION = '3.4.1' 14227 14228 ScrollSpy.DEFAULTS = { 14229 offset: 10 14230 } 14231 14232 ScrollSpy.prototype.getScrollHeight = function () { 14233 return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) 14234 } 14235 14236 ScrollSpy.prototype.refresh = function () { 14237 var that = this 14238 var offsetMethod = 'offset' 14239 var offsetBase = 0 14240 14241 this.offsets = [] 14242 this.targets = [] 14243 this.scrollHeight = this.getScrollHeight() 14244 14245 if (!$.isWindow(this.$scrollElement[0])) { 14246 offsetMethod = 'position' 14247 offsetBase = this.$scrollElement.scrollTop() 14248 } 14249 14250 this.$body 14251 .find(this.selector) 14252 .map(function () { 14253 var $el = $(this) 14254 var href = $el.data('target') || $el.attr('href') 14255 var $href = /^#./.test(href) && $(href) 14256 14257 return ($href 14258 && $href.length 14259 && $href.is(':visible') 14260 && [[$href[offsetMethod]().top + offsetBase, href]]) || null 14261 }) 14262 .sort(function (a, b) { return a[0] - b[0] }) 14263 .each(function () { 14264 that.offsets.push(this[0]) 14265 that.targets.push(this[1]) 14266 }) 14267 } 14268 14269 ScrollSpy.prototype.process = function () { 14270 var scrollTop = this.$scrollElement.scrollTop() + this.options.offset 14271 var scrollHeight = this.getScrollHeight() 14272 var maxScroll = this.options.offset + scrollHeight - this.$scrollElement.height() 14273 var offsets = this.offsets 14274 var targets = this.targets 14275 var activeTarget = this.activeTarget 14276 var i 14277 14278 if (this.scrollHeight != scrollHeight) { 14279 this.refresh() 14280 } 14281 14282 if (scrollTop >= maxScroll) { 14283 return activeTarget != (i = targets[targets.length - 1]) && this.activate(i) 14284 } 14285 14286 if (activeTarget && scrollTop < offsets[0]) { 14287 this.activeTarget = null 14288 return this.clear() 14289 } 14290 14291 for (i = offsets.length; i--;) { 14292 activeTarget != targets[i] 14293 && scrollTop >= offsets[i] 14294 && (offsets[i + 1] === undefined || scrollTop < offsets[i + 1]) 14295 && this.activate(targets[i]) 14296 } 14297 } 14298 14299 ScrollSpy.prototype.activate = function (target) { 14300 this.activeTarget = target 14301 14302 this.clear() 14303 14304 var selector = this.selector + 14305 '[data-target="' + target + '"],' + 14306 this.selector + '[href="' + target + '"]' 14307 14308 var active = $(selector) 14309 .parents('li') 14310 .addClass('active') 14311 14312 if (active.parent('.dropdown-menu').length) { 14313 active = active 14314 .closest('li.dropdown') 14315 .addClass('active') 14316 } 14317 14318 active.trigger('activate.bs.scrollspy') 14319 } 14320 14321 ScrollSpy.prototype.clear = function () { 14322 $(this.selector) 14323 .parentsUntil(this.options.target, '.active') 14324 .removeClass('active') 14325 } 14326 14327 14328 // SCROLLSPY PLUGIN DEFINITION 14329 // =========================== 14330 14331 function Plugin(option) { 14332 return this.each(function () { 14333 var $this = $(this) 14334 var data = $this.data('bs.scrollspy') 14335 var options = typeof option == 'object' && option 14336 14337 if (!data) $this.data('bs.scrollspy', (data = new ScrollSpy(this, options))) 14338 if (typeof option == 'string') data[option]() 14339 }) 14340 } 14341 14342 var old = $.fn.scrollspy 14343 14344 $.fn.scrollspy = Plugin 14345 $.fn.scrollspy.Constructor = ScrollSpy 14346 14347 14348 // SCROLLSPY NO CONFLICT 14349 // ===================== 14350 14351 $.fn.scrollspy.noConflict = function () { 14352 $.fn.scrollspy = old 14353 return this 14354 } 14355 14356 14357 // SCROLLSPY DATA-API 14358 // ================== 14359 14360 $(window).on('load.bs.scrollspy.data-api', function () { 14361 $('[data-spy="scroll"]').each(function () { 14362 var $spy = $(this) 14363 Plugin.call($spy, $spy.data()) 14364 }) 14365 }) 14366 14367}(jQuery); 14368 14369/* ======================================================================== 14370 * Bootstrap: tab.js v3.4.1 14371 * https://getbootstrap.com/docs/3.4/javascript/#tabs 14372 * ======================================================================== 14373 * Copyright 2011-2019 Twitter, Inc. 14374 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 14375 * ======================================================================== */ 14376 14377 14378+function ($) { 14379 'use strict'; 14380 14381 // TAB CLASS DEFINITION 14382 // ==================== 14383 14384 var Tab = function (element) { 14385 // jscs:disable requireDollarBeforejQueryAssignment 14386 this.element = $(element) 14387 // jscs:enable requireDollarBeforejQueryAssignment 14388 } 14389 14390 Tab.VERSION = '3.4.1' 14391 14392 Tab.TRANSITION_DURATION = 150 14393 14394 Tab.prototype.show = function () { 14395 var $this = this.element 14396 var $ul = $this.closest('ul:not(.dropdown-menu)') 14397 var selector = $this.data('target') 14398 14399 if (!selector) { 14400 selector = $this.attr('href') 14401 selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') // strip for ie7 14402 } 14403 14404 if ($this.parent('li').hasClass('active')) return 14405 14406 var $previous = $ul.find('.active:last a') 14407 var hideEvent = $.Event('hide.bs.tab', { 14408 relatedTarget: $this[0] 14409 }) 14410 var showEvent = $.Event('show.bs.tab', { 14411 relatedTarget: $previous[0] 14412 }) 14413 14414 $previous.trigger(hideEvent) 14415 $this.trigger(showEvent) 14416 14417 if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) return 14418 14419 var $target = $(document).find(selector) 14420 14421 this.activate($this.closest('li'), $ul) 14422 this.activate($target, $target.parent(), function () { 14423 $previous.trigger({ 14424 type: 'hidden.bs.tab', 14425 relatedTarget: $this[0] 14426 }) 14427 $this.trigger({ 14428 type: 'shown.bs.tab', 14429 relatedTarget: $previous[0] 14430 }) 14431 }) 14432 } 14433 14434 Tab.prototype.activate = function (element, container, callback) { 14435 var $active = container.find('> .active') 14436 var transition = callback 14437 && $.support.transition 14438 && ($active.length && $active.hasClass('fade') || !!container.find('> .fade').length) 14439 14440 function next() { 14441 $active 14442 .removeClass('active') 14443 .find('> .dropdown-menu > .active') 14444 .removeClass('active') 14445 .end() 14446 .find('[data-toggle="tab"]') 14447 .attr('aria-expanded', false) 14448 14449 element 14450 .addClass('active') 14451 .find('[data-toggle="tab"]') 14452 .attr('aria-expanded', true) 14453 14454 if (transition) { 14455 element[0].offsetWidth // reflow for transition 14456 element.addClass('in') 14457 } else { 14458 element.removeClass('fade') 14459 } 14460 14461 if (element.parent('.dropdown-menu').length) { 14462 element 14463 .closest('li.dropdown') 14464 .addClass('active') 14465 .end() 14466 .find('[data-toggle="tab"]') 14467 .attr('aria-expanded', true) 14468 } 14469 14470 callback && callback() 14471 } 14472 14473 $active.length && transition ? 14474 $active 14475 .one('bsTransitionEnd', next) 14476 .emulateTransitionEnd(Tab.TRANSITION_DURATION) : 14477 next() 14478 14479 $active.removeClass('in') 14480 } 14481 14482 14483 // TAB PLUGIN DEFINITION 14484 // ===================== 14485 14486 function Plugin(option) { 14487 return this.each(function () { 14488 var $this = $(this) 14489 var data = $this.data('bs.tab') 14490 14491 if (!data) $this.data('bs.tab', (data = new Tab(this))) 14492 if (typeof option == 'string') data[option]() 14493 }) 14494 } 14495 14496 var old = $.fn.tab 14497 14498 $.fn.tab = Plugin 14499 $.fn.tab.Constructor = Tab 14500 14501 14502 // TAB NO CONFLICT 14503 // =============== 14504 14505 $.fn.tab.noConflict = function () { 14506 $.fn.tab = old 14507 return this 14508 } 14509 14510 14511 // TAB DATA-API 14512 // ============ 14513 14514 var clickHandler = function (e) { 14515 e.preventDefault() 14516 Plugin.call($(this), 'show') 14517 } 14518 14519 $(document) 14520 .on('click.bs.tab.data-api', '[data-toggle="tab"]', clickHandler) 14521 .on('click.bs.tab.data-api', '[data-toggle="pill"]', clickHandler) 14522 14523}(jQuery); 14524 14525/* ======================================================================== 14526 * Bootstrap: affix.js v3.4.1 14527 * https://getbootstrap.com/docs/3.4/javascript/#affix 14528 * ======================================================================== 14529 * Copyright 2011-2019 Twitter, Inc. 14530 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 14531 * ======================================================================== */ 14532 14533 14534+function ($) { 14535 'use strict'; 14536 14537 // AFFIX CLASS DEFINITION 14538 // ====================== 14539 14540 var Affix = function (element, options) { 14541 this.options = $.extend({}, Affix.DEFAULTS, options) 14542 14543 var target = this.options.target === Affix.DEFAULTS.target ? $(this.options.target) : $(document).find(this.options.target) 14544 14545 this.$target = target 14546 .on('scroll.bs.affix.data-api', $.proxy(this.checkPosition, this)) 14547 .on('click.bs.affix.data-api', $.proxy(this.checkPositionWithEventLoop, this)) 14548 14549 this.$element = $(element) 14550 this.affixed = null 14551 this.unpin = null 14552 this.pinnedOffset = null 14553 14554 this.checkPosition() 14555 } 14556 14557 Affix.VERSION = '3.4.1' 14558 14559 Affix.RESET = 'affix affix-top affix-bottom' 14560 14561 Affix.DEFAULTS = { 14562 offset: 0, 14563 target: window 14564 } 14565 14566 Affix.prototype.getState = function (scrollHeight, height, offsetTop, offsetBottom) { 14567 var scrollTop = this.$target.scrollTop() 14568 var position = this.$element.offset() 14569 var targetHeight = this.$target.height() 14570 14571 if (offsetTop != null && this.affixed == 'top') return scrollTop < offsetTop ? 'top' : false 14572 14573 if (this.affixed == 'bottom') { 14574 if (offsetTop != null) return (scrollTop + this.unpin <= position.top) ? false : 'bottom' 14575 return (scrollTop + targetHeight <= scrollHeight - offsetBottom) ? false : 'bottom' 14576 } 14577 14578 var initializing = this.affixed == null 14579 var colliderTop = initializing ? scrollTop : position.top 14580 var colliderHeight = initializing ? targetHeight : height 14581 14582 if (offsetTop != null && scrollTop <= offsetTop) return 'top' 14583 if (offsetBottom != null && (colliderTop + colliderHeight >= scrollHeight - offsetBottom)) return 'bottom' 14584 14585 return false 14586 } 14587 14588 Affix.prototype.getPinnedOffset = function () { 14589 if (this.pinnedOffset) return this.pinnedOffset 14590 this.$element.removeClass(Affix.RESET).addClass('affix') 14591 var scrollTop = this.$target.scrollTop() 14592 var position = this.$element.offset() 14593 return (this.pinnedOffset = position.top - scrollTop) 14594 } 14595 14596 Affix.prototype.checkPositionWithEventLoop = function () { 14597 setTimeout($.proxy(this.checkPosition, this), 1) 14598 } 14599 14600 Affix.prototype.checkPosition = function () { 14601 if (!this.$element.is(':visible')) return 14602 14603 var height = this.$element.height() 14604 var offset = this.options.offset 14605 var offsetTop = offset.top 14606 var offsetBottom = offset.bottom 14607 var scrollHeight = Math.max($(document).height(), $(document.body).height()) 14608 14609 if (typeof offset != 'object') offsetBottom = offsetTop = offset 14610 if (typeof offsetTop == 'function') offsetTop = offset.top(this.$element) 14611 if (typeof offsetBottom == 'function') offsetBottom = offset.bottom(this.$element) 14612 14613 var affix = this.getState(scrollHeight, height, offsetTop, offsetBottom) 14614 14615 if (this.affixed != affix) { 14616 if (this.unpin != null) this.$element.css('top', '') 14617 14618 var affixType = 'affix' + (affix ? '-' + affix : '') 14619 var e = $.Event(affixType + '.bs.affix') 14620 14621 this.$element.trigger(e) 14622 14623 if (e.isDefaultPrevented()) return 14624 14625 this.affixed = affix 14626 this.unpin = affix == 'bottom' ? this.getPinnedOffset() : null 14627 14628 this.$element 14629 .removeClass(Affix.RESET) 14630 .addClass(affixType) 14631 .trigger(affixType.replace('affix', 'affixed') + '.bs.affix') 14632 } 14633 14634 if (affix == 'bottom') { 14635 this.$element.offset({ 14636 top: scrollHeight - height - offsetBottom 14637 }) 14638 } 14639 } 14640 14641 14642 // AFFIX PLUGIN DEFINITION 14643 // ======================= 14644 14645 function Plugin(option) { 14646 return this.each(function () { 14647 var $this = $(this) 14648 var data = $this.data('bs.affix') 14649 var options = typeof option == 'object' && option 14650 14651 if (!data) $this.data('bs.affix', (data = new Affix(this, options))) 14652 if (typeof option == 'string') data[option]() 14653 }) 14654 } 14655 14656 var old = $.fn.affix 14657 14658 $.fn.affix = Plugin 14659 $.fn.affix.Constructor = Affix 14660 14661 14662 // AFFIX NO CONFLICT 14663 // ================= 14664 14665 $.fn.affix.noConflict = function () { 14666 $.fn.affix = old 14667 return this 14668 } 14669 14670 14671 // AFFIX DATA-API 14672 // ============== 14673 14674 $(window).on('load', function () { 14675 $('[data-spy="affix"]').each(function () { 14676 var $spy = $(this) 14677 var data = $spy.data() 14678 14679 data.offset = data.offset || {} 14680 14681 if (data.offsetBottom != null) data.offset.bottom = data.offsetBottom 14682 if (data.offsetTop != null) data.offset.top = data.offsetTop 14683 14684 Plugin.call($spy, data) 14685 }) 14686 }) 14687 14688}(jQuery); 14689; 14690$(function () { 14691 resizeMainFooter(); 14692 $(window).on('resize', function () { 14693 resizeMainFooter(); 14694 });
14695}); 14696function resizeMainFooter() { 14697 var h = $("footer").height() + $(".end-of-body").height(); 14698 if (h === 1) return; 14699 $(".footer").css("margin-top", "-" + h + "px"); 14700 14701 if ($(".app-promo-footer")[0]) { 14702 $(".footer:not(.app-promo-footer)").css("margin-top", 0 + "px"); 14703 } 14704 14705 $("#main").css("padding-bottom", h + "px"); 14706}; 14707/* ========================================================= 14708 * bootstrap-datepicker.js 14709 * Repo: https://github.com/eternicode/bootstrap-datepicker/ 14710 * Demo: http://eternicode.github.io/bootstrap-datepicker/ 14711 * Docs: http://bootstrap-datepicker.readthedocs.org/ 14712 * Forked from http://www.eyecon.ro/bootstrap-datepicker 14713 * ========================================================= 14714 * Started by Stefan Petre; improvements by Andrew Rowls + contributors 14715 * 14716 * Licensed under the Apache License, Version 2.0 (the "License"); 14717 * you may not use this file except in compliance with the License. 14718 * You may obtain a copy of the License at 14719 * 14720 * http://www.apache.org/licenses/LICENSE-2.0 14721 * 14722 * Unless required by applicable law or agreed to in writing, software 14723 * distributed under the License is distributed on an "AS IS" BASIS, 14724 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14725 * See the License for the specific language governing permissions and 14726 * limitations under the License. 14727 * ========================================================= */ 14728 14729(function($, undefined){ 14730 14731 function UTCDate(){ 14732 return new Date(Date.UTC.apply(Date, arguments)); 14733 } 14734 function UTCToday(){ 14735 var today = new Date(); 14736 return UTCDate(today.getFullYear(), today.getMonth(), today.getDate()); 14737 } 14738 function isUTCEquals(date1, date2) { 14739 return ( 14740 date1.getUTCFullYear() === date2.getUTCFullYear() && 14741 date1.getUTCMonth() === date2.getUTCMonth() && 14742 date1.getUTCDate() === date2.getUTCDate() 14743 ); 14744 } 14745 function alias(method){ 14746 return function(){ 14747 return this[method].apply(this, arguments); 14748 }; 14749 } 14750 14751 var DateArray = (function(){ 14752 var extras = { 14753 get: function(i){ 14754 return this.slice(i)[0]; 14755 }, 14756 contains: function(d){ 14757 // Array.indexOf is not cross-browser; 14758 // $.inArray doesn't work with Dates 14759 var val = d && d.valueOf(); 14760 for (var i=0, l=this.length; i < l; i++) 14761 if (this[i].valueOf() === val) 14762 return i; 14763 return -1; 14764 }, 14765 remove: function(i){ 14766 this.splice(i,1); 14767 }, 14768 replace: function(new_array){ 14769 if (!new_array) 14770 return; 14771 if (!$.isArray(new_array)) 14772 new_array = [new_array]; 14773 this.clear(); 14774 this.push.apply(this, new_array); 14775 }, 14776 clear: function(){ 14777 this.length = 0; 14778 }, 14779 copy: function(){ 14780 var a = new DateArray(); 14781 a.replace(this); 14782 return a; 14783 } 14784 }; 14785 14786 return function(){ 14787 var a = []; 14788 a.push.apply(a, arguments); 14789 $.extend(a, extras); 14790 return a; 14791 }; 14792 })(); 14793 14794 14795 // Picker object 14796 14797 var Datepicker = function(element, options){ 14798 this._process_options(options); 14799 14800 this.dates = new DateArray(); 14801 this.viewDate = this.o.defaultViewDate; 14802 this.focusDate = null; 14803 14804 this.element = $(element); 14805 this.isInline = false; 14806 this.isInput = this.element.is('input'); 14807 this.component = this.element.hasClass('date') ? this.element.find('.add-on, .input-group-addon, .btn') : false; 14808 this.hasInput = this.component && this.element.find('input').length; 14809 if (this.component && this.component.length === 0) 14810 this.component = false; 14811 14812 this.picker = $(DPGlobal.template); 14813 this._buildEvents(); 14814 this._attachEvents(); 14815 14816 if (this.isInline){ 14817 this.picker.addClass('datepicker-inline').appendTo(this.element); 14818 } 14819 else { 14820 this.picker.addClass('datepicker-dropdown dropdown-menu'); 14821 } 14822 14823 if (this.o.rtl){ 14824 this.picker.addClass('datepicker-rtl'); 14825 } 14826 14827 this.viewMode = this.o.startView; 14828 14829 if (this.o.calendarWeeks) 14830 this.picker.find('tfoot .today, tfoot .clear') 14831 .attr('colspan', function(i, val){ 14832 return parseInt(val) + 1; 14833 }); 14834 14835 this._allow_update = false; 14836 14837 this.setStartDate(this._o.startDate); 14838 this.setEndDate(this._o.endDate); 14839 this.setDaysOfWeekDisabled(this.o.daysOfWeekDisabled); 14840 this.setDatesDisabled(this.o.datesDisabled); 14841 14842 this.fillDow(); 14843 this.fillMonths(); 14844 14845 this._allow_update = true; 14846 14847 this.update(); 14848 this.showMode(); 14849 14850 if (this.isInline){
14851 this.show(); 14852 } 14853 }; 14854 14855 Datepicker.prototype = { 14856 constructor: Datepicker, 14857 14858 _process_options: function(opts){ 14859 // Store raw options for reference 14860 this._o = $.extend({}, this._o, opts); 14861 // Processed options 14862 var o = this.o = $.extend({}, this._o); 14863 14864 // Check if "de-DE" style date is available, if not language should 14865 // fallback to 2 letter code eg "de" 14866 var lang = o.language; 14867 if (!dates[lang]){ 14868 lang = lang.split('-')[0]; 14869 if (!dates[lang]) 14870 lang = defaults.language; 14871 } 14872 o.language = lang; 14873 14874 switch (o.startView){ 14875 case 2: 14876 case 'decade': 14877 o.startView = 2; 14878 break; 14879 case 1: 14880 case 'year': 14881 o.startView = 1; 14882 break; 14883 default: 14884 o.startView = 0; 14885 } 14886 14887 switch (o.minViewMode){ 14888 case 1: 14889 case 'months': 14890 o.minViewMode = 1; 14891 break; 14892 case 2: 14893 case 'years': 14894 o.minViewMode = 2; 14895 break; 14896 default: 14897 o.minViewMode = 0; 14898 } 14899 14900 o.startView = Math.max(o.startView, o.minViewMode); 14901 14902 // true, false, or Number > 0 14903 if (o.multidate !== true){ 14904 o.multidate = Number(o.multidate) || false; 14905 if (o.multidate !== false) 14906 o.multidate = Math.max(0, o.multidate); 14907 } 14908 o.multidateSeparator = String(o.multidateSeparator); 14909 14910 o.weekStart %= 7; 14911 o.weekEnd = ((o.weekStart + 6) % 7); 14912 14913 var format = DPGlobal.parseFormat(o.format); 14914 if (o.startDate !== -Infinity){ 14915 if (!!o.startDate){ 14916 if (o.startDate instanceof Date) 14917 o.startDate = this._local_to_utc(this._zero_time(o.startDate)); 14918 else 14919 o.startDate = DPGlobal.parseDate(o.startDate, format, o.language); 14920 } 14921 else { 14922 o.startDate = -Infinity; 14923 } 14924 } 14925 if (o.endDate !== Infinity){ 14926 if (!!o.endDate){ 14927 if (o.endDate instanceof Date) 14928 o.endDate = this._local_to_utc(this._zero_time(o.endDate)); 14929 else 14930 o.endDate = DPGlobal.parseDate(o.endDate, format, o.language); 14931 } 14932 else { 14933 o.endDate = Infinity; 14934 } 14935 } 14936 14937 o.daysOfWeekDisabled = o.daysOfWeekDisabled||[]; 14938 if (!$.isArray(o.daysOfWeekDisabled)) 14939 o.daysOfWeekDisabled = o.daysOfWeekDisabled.split(/[,\s]*/); 14940 o.daysOfWeekDisabled = $.map(o.daysOfWeekDisabled, function(d){ 14941 return parseInt(d, 10); 14942 }); 14943 14944 o.datesDisabled = o.datesDisabled||[]; 14945 if (!$.isArray(o.datesDisabled)) { 14946 var datesDisabled = []; 14947 datesDisabled.push(DPGlobal.parseDate(o.datesDisabled, format, o.language)); 14948 o.datesDisabled = datesDisabled; 14949 } 14950 o.datesDisabled = $.map(o.datesDisabled,function(d){ 14951 return DPGlobal.parseDate(d, format, o.language); 14952 }); 14953 14954 var plc = String(o.orientation).toLowerCase().split(/\s+/g), 14955 _plc = o.orientation.toLowerCase(); 14956 plc = $.grep(plc, function(word){ 14957 return /^auto|left|right|top|bottom$/.test(word); 14958 }); 14959 o.orientation = {x: 'auto', y: 'auto'}; 14960 if (!_plc || _plc === 'auto') 14961 ; // no action 14962 else if (plc.length === 1){ 14963 switch (plc[0]){ 14964 case 'top': 14965 case 'bottom': 14966 o.orientation.y = plc[0]; 14967 break; 14968 case 'left': 14969 case 'right': 14970 o.orientation.x = plc[0]; 14971 break; 14972 } 14973 } 14974 else { 14975 _plc = $.grep(plc, function(word){ 14976 return /^left|right$/.test(word); 14977 }); 14978 o.orientation.x = _plc[0] || 'auto'; 14979 14980 _plc = $.grep(plc, function(word){ 14981 return /^top|bottom$/.test(word); 14982 }); 14983 o.orientation.y = _plc[0] || 'auto'; 14984 } 14985 if (o.defaultViewDate) { 14986 var year = o.defaultViewDate.year || new Date().getFullYear(); 14987 var month = o.defaultViewDate.month || 0; 14988 var day = o.defaultViewDate.day || 1; 14989 o.defaultViewDate = UTCDate(year, month, day); 14990 } else { 14991 o.defaultViewDate = UTCToday(); 14992 } 14993 o.showOnFocus = o.showOnFocus !== undefined ? o.showOnFocus : true; 14994 }, 14995 _events: [], 14996 _secondaryEvents: [], 14997 _applyEvents: function(evs){ 14998 for (var i=0, el, ch, ev; i < evs.length; i++){ 14999 el = evs[i][0]; 15000 if (evs[i].length === 2){ 15001 ch = undefined; 15002 ev = evs[i][1]; 15003 } 15004 else if (evs[i].length === 3){ 15005 ch = evs[i][1]; 15006 ev = evs[i][2]; 15007 } 15008 el.on(ev, ch); 15009 } 15010 }, 15011 _unapplyEvents: function(evs){ 15012 for (var i=0, el, ev, ch; i < evs.length; i++){ 15013 el = evs[i][0]; 15014 if (evs[i].length === 2){ 15015 ch = undefined; 15016 ev = evs[i][1]; 15017 } 15018 else if (evs[i].length === 3){ 15019 ch = evs[i][1]; 15020 ev = evs[i][2]; 15021 } 15022 el.off(ev, ch); 15023 } 15024 }, 15025 _buildEvents: function(){ 15026 var events = { 15027 keyup: $.proxy(function(e){
15028 if ($.inArray(e.keyCode, [27, 37, 39, 38, 40, 32, 13, 9]) === -1) 15029 this.update(); 15030 }, this), 15031 keydown: $.proxy(this.keydown, this), 15032 paste: $.proxy(this.paste, this) 15033 }; 15034 15035 if (this.o.showOnFocus === true) { 15036 events.focus = $.proxy(this.show, this); 15037 } 15038 15039 if (this.isInput) { // single input 15040 this._events = [ 15041 [this.element, events] 15042 ]; 15043 } 15044 else if (this.component && this.hasInput) { // component: input + button 15045 this._events = [ 15046 // For components that are not readonly, allow keyboard nav 15047 [this.element.find('input'), events], 15048 [this.component, { 15049 click: $.proxy(this.show, this) 15050 }] 15051 ]; 15052 } 15053 else if (this.element.is('div')){ // inline datepicker 15054 this.isInline = true; 15055 } 15056 else { 15057 this._events = [ 15058 [this.element, { 15059 click: $.proxy(this.show, this) 15060 }] 15061 ]; 15062 } 15063 this._events.push( 15064 // Component: listen for blur on element descendants 15065 [this.element, '*', { 15066 blur: $.proxy(function(e){ 15067 this._focused_from = e.target; 15068 }, this) 15069 }], 15070 // Input: listen for blur on element 15071 [this.element, { 15072 blur: $.proxy(function(e){ 15073 this._focused_from = e.target; 15074 }, this) 15075 }] 15076 ); 15077 15078 this._secondaryEvents = [ 15079 [this.picker, { 15080 click: $.proxy(this.click, this) 15081 }], 15082 [$(window), { 15083 resize: $.proxy(this.place, this) 15084 }], 15085 [$(document), { 15086 mousedown: $.proxy(function(e){ 15087 // Clicked outside the datepicker, hide it 15088 if (!( 15089 this.element.is(e.target) || 15090 this.element.find(e.target).length || 15091 this.picker.is(e.target) || 15092 this.picker.find(e.target).length 15093 )){ 15094 this.hide(); 15095 } 15096 }, this) 15097 }] 15098 ]; 15099 }, 15100 _attachEvents: function(){ 15101 this._detachEvents(); 15102 this._applyEvents(this._events); 15103 }, 15104 _detachEvents: function(){ 15105 this._unapplyEvents(this._events); 15106 }, 15107 _attachSecondaryEvents: function(){ 15108 this._detachSecondaryEvents(); 15109 this._applyEvents(this._secondaryEvents); 15110 }, 15111 _detachSecondaryEvents: function(){ 15112 this._unapplyEvents(this._secondaryEvents); 15113 }, 15114 _trigger: function(event, altdate){ 15115 var date = altdate || this.dates.get(-1), 15116 local_date = this._utc_to_local(date); 15117 15118 this.element.trigger({ 15119 type: event, 15120 date: local_date, 15121 dates: $.map(this.dates, this._utc_to_local), 15122 format: $.proxy(function(ix, format){ 15123 if (arguments.length === 0){ 15124 ix = this.dates.length - 1; 15125 format = this.o.format; 15126 } 15127 else if (typeof ix === 'string'){ 15128 format = ix; 15129 ix = this.dates.length - 1; 15130 } 15131 format = format || this.o.format; 15132 var date = this.dates.get(ix); 15133 return DPGlobal.formatDate(date, format, this.o.language); 15134 }, this) 15135 }); 15136 }, 15137 15138 show: function(){ 15139 if (this.element.attr('readonly') && this.o.enableOnReadonly === false) 15140 return; 15141 if (!this.isInline) 15142 this.picker.appendTo(this.o.container); 15143 this.place(); 15144 this.picker.show(); 15145 this._attachSecondaryEvents(); 15146 this._trigger('show'); 15147 if ((window.navigator.msMaxTouchPoints || 'ontouchstart' in document) && this.o.disableTouchKeyboard) { 15148 $(this.element).blur(); 15149 } 15150 return this; 15151 }, 15152 15153 hide: function(){ 15154 if (this.isInline) 15155 return this; 15156 if (!this.picker.is(':visible')) 15157 return this; 15158 this.focusDate = null; 15159 this.picker.hide().detach(); 15160 this._detachSecondaryEvents(); 15161 this.viewMode = this.o.startView; 15162 this.showMode(); 15163 15164 if ( 15165 this.o.forceParse && 15166 ( 15167 this.isInput && this.element.val() || 15168 this.hasInput && this.element.find('input').val() 15169 ) 15170 ) 15171 this.setValue(); 15172 this._trigger('hide'); 15173 return this; 15174 }, 15175 15176 remove: function(){ 15177 this.hide(); 15178 this._detachEvents(); 15179 this._detachSecondaryEvents(); 15180 this.picker.remove(); 15181 delete this.element.data().datepicker; 15182 if (!this.isInput){ 15183 delete this.element.data().date; 15184 } 15185 return this; 15186 }, 15187 15188 paste: function(evt){ 15189 var dateString; 15190 if (evt.originalEvent.clipboardData && evt.originalEvent.clipboardData.types 15191 && $.inArray('text/plain', evt.originalEvent.clipboardData.types) !== -1) { 15192 dateString = evt.originalEvent.clipboardData.getData('text/plain'); 15193 } 15194 else if (window.clipboardData) { 15195 dateString = window.clipboardData.getData('Text'); 15196 } 15197 else { 15198 return; 15199 } 15200 this.setDate(dateString); 15201 this.update(); 15202 evt.preventDefault(); 15203 }, 15204 15205 _utc_to_local: function(utc){ 15206 return utc && new Date(utc.getTime() + (utc.getTimezoneOffset()*60000)); 15207 }, 15208 _local_to_utc: function(local){ 15209 return local && new Date(local.getTime() - (local.getTimezoneOffset()*60000)); 15210 }, 15211 _zero_time: function(local){ 15212 return local && new Date(local.getFullYear(), local.getMonth(), local.getDate()); 15213 }, 15214 _zero_utc_time: function(utc){ 15215 return utc && new Date(Date.UTC(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate())); 15216 }, 15217 15218 getDates: function(){ 15219 return $.map(this.dates, this._utc_to_local); 15220 }, 15221 15222 getUTCDates: function(){ 15223 return $.map(this.dates, function(d){ 15224 return new Date(d); 15225 }); 15226 }, 15227 15228 getDate: function(){ 15229 return this._utc_to_local(this.getUTCDate()); 15230 }, 15231 15232 getUTCDate: function(){ 15233 var selected_date = this.dates.get(-1); 15234 if (typeof selected_date !== 'undefined') { 15235 return new Date(selected_date); 15236 } else { 15237 return null; 15238 } 15239 }, 15240 15241 clearDates: function(){ 15242 var element; 15243 if (this.isInput) { 15244 element = this.element; 15245 } else if (this.component) { 15246 element = this.element.find('input'); 15247 } 15248 15249 if (element) { 15250 element.val('').change(); 15251 } 15252 15253 this.update(); 15254 this._trigger('changeDate'); 15255 15256 if (this.o.autoclose) { 15257 this.hide(); 15258 } 15259 }, 15260 setDates: function(){ 15261 var args = $.isArray(arguments[0]) ? arguments[0] : arguments; 15262 this.update.apply(this, args); 15263 this._trigger('changeDate'); 15264 this.setValue(); 15265 return this; 15266 }, 15267 15268 setUTCDates: function(){ 15269 var args = $.isArray(arguments[0]) ? arguments[0] : arguments; 15270 this.update.apply(this, $.map(args, this._utc_to_local)); 15271 this._trigger('changeDate'); 15272 this.setValue(); 15273 return this; 15274 }, 15275 15276 setDate: alias('setDates'), 15277 setUTCDate: alias('setUTCDates'), 15278 15279 setValue: function(){ 15280 var formatted = this.getFormattedDate(); 15281 if (!this.isInput){ 15282 if (this.component){ 15283 this.element.find('input').val(formatted).change(); 15284 } 15285 } 15286 else { 15287 this.element.val(formatted).change(); 15288 } 15289 return this; 15290 }, 15291 15292 getFormattedDate: function(format){ 15293 if (format === undefined) 15294 format = this.o.format; 15295 15296 var lang = this.o.language; 15297 return $.map(this.dates, function(d){ 15298 return DPGlobal.formatDate(d, format, lang); 15299 }).join(this.o.multidateSeparator); 15300 }, 15301 15302 setStartDate: function(startDate){ 15303 this._process_options({startDate: startDate}); 15304 this.update(); 15305 this.updateNavArrows(); 15306 return this; 15307 }, 15308
15309 setEndDate: function(endDate){ 15310 this._process_options({endDate: endDate}); 15311 this.update(); 15312 this.updateNavArrows(); 15313 return this; 15314 }, 15315 15316 setDaysOfWeekDisabled: function(daysOfWeekDisabled){ 15317 this._process_options({daysOfWeekDisabled: daysOfWeekDisabled}); 15318 this.update(); 15319 this.updateNavArrows(); 15320 return this; 15321 }, 15322 15323 setDatesDisabled: function(datesDisabled){ 15324 this._process_options({datesDisabled: datesDisabled}); 15325 this.update(); 15326 this.updateNavArrows(); 15327 }, 15328 15329 place: function(){ 15330 if (this.isInline) 15331 return this; 15332 var calendarWidth = this.picker.outerWidth(), 15333 calendarHeight = this.picker.outerHeight(), 15334 visualPadding = 10, 15335 windowWidth = $(this.o.container).width(), 15336 windowHeight = $(this.o.container).height(), 15337 scrollTop = $(this.o.container).scrollTop(), 15338 appendOffset = $(this.o.container).offset(); 15339 15340 var parentsZindex = []; 15341 this.element.parents().each(function(){ 15342 var itemZIndex = $(this).css('z-index'); 15343 if (itemZIndex !== 'auto' && itemZIndex !== 0) parentsZindex.push(parseInt(itemZIndex)); 15344 }); 15345 var zIndex = Math.max.apply(Math, parentsZindex) + 10; 15346 var offset = this.component ? this.component.parent().offset() : this.element.offset(); 15347 var height = this.component ? this.component.outerHeight(true) : this.element.outerHeight(false); 15348 var width = this.component ? this.component.outerWidth(true) : this.element.outerWidth(false); 15349 var left = offset.left - appendOffset.left, 15350 top = offset.top - appendOffset.top; 15351 15352 this.picker.removeClass( 15353 'datepicker-orient-top datepicker-orient-bottom '+ 15354 'datepicker-orient-right datepicker-orient-left' 15355 ); 15356 15357 if (this.o.orientation.x !== 'auto'){ 15358 this.picker.addClass('datepicker-orient-' + this.o.orientation.x); 15359 if (this.o.orientation.x === 'right') 15360 left -= calendarWidth - width; 15361 } 15362 // auto x orientation is best-placement: if it crosses a window 15363 // edge, fudge it sideways 15364 else { 15365 if (offset.left < 0) { 15366 // component is outside the window on the left side. Move it into visible range 15367 this.picker.addClass('datepicker-orient-left'); 15368 left -= offset.left - visualPadding; 15369 } else if (left + calendarWidth > windowWidth) { 15370 // the calendar passes the widow right edge. Align it to component right side 15371 this.picker.addClass('datepicker-orient-right'); 15372 left = offset.left + width - calendarWidth; 15373 } else { 15374 // Default to left 15375 this.picker.addClass('datepicker-orient-left'); 15376 } 15377 } 15378 15379 // auto y orientation is best-situation: top or bottom, no fudging, 15380 // decision based on which shows more of the calendar 15381 var yorient = this.o.orientation.y, 15382 top_overflow, bottom_overflow; 15383 if (yorient === 'auto'){ 15384 top_overflow = -scrollTop + top - calendarHeight; 15385 bottom_overflow = scrollTop + windowHeight - (top + height + calendarHeight); 15386 if (Math.max(top_overflow, bottom_overflow) === bottom_overflow) 15387 yorient = 'top'; 15388 else 15389 yorient = 'bottom'; 15390 } 15391 this.picker.addClass('datepicker-orient-' + yorient); 15392 if (yorient === 'top') 15393 top += height; 15394 else 15395 top -= calendarHeight + parseInt(this.picker.css('padding-top')); 15396 15397 if (this.o.rtl) { 15398 var right = windowWidth - (left + width); 15399 this.picker.css({ 15400 top: top, 15401 right: right, 15402 zIndex: zIndex 15403 }); 15404 } else { 15405 this.picker.css({ 15406 top: top, 15407 left: left, 15408 zIndex: zIndex 15409 }); 15410 } 15411 return this; 15412 }, 15413 15414 _allow_update: true, 15415 update: function(){ 15416 if (!this._allow_update) 15417 return this; 15418 15419 var oldDates = this.dates.copy(), 15420 dates = [], 15421 fromArgs = false; 15422 if (arguments.length){ 15423 $.each(arguments, $.proxy(function(i, date){ 15424 if (date instanceof Date) 15425 date = this._local_to_utc(date); 15426 dates.push(date); 15427 }, this)); 15428 fromArgs = true; 15429 } 15430 else { 15431 dates = this.isInput 15432 ? this.element.val() 15433 : this.element.data('date') || this.element.find('input').val(); 15434 if (dates && this.o.multidate) 15435 dates = dates.split(this.o.multidateSeparator); 15436 else 15437 dates = [dates]; 15438 delete this.element.data().date; 15439 } 15440 15441 dates = $.map(dates, $.proxy(function(date){ 15442 return DPGlobal.parseDate(date, this.o.format, this.o.language); 15443 }, this)); 15444 dates = $.grep(dates, $.proxy(function(date){ 15445 return ( 15446 date < this.o.startDate || 15447 date > this.o.endDate || 15448 !date 15449 ); 15450 }, this), true); 15451 this.dates.replace(dates); 15452 15453 if (this.dates.length) 15454 this.viewDate = new Date(this.dates.get(-1)); 15455 else if (this.viewDate < this.o.startDate) 15456 this.viewDate = new Date(this.o.startDate); 15457 else if (this.viewDate > this.o.endDate) 15458 this.viewDate = new Date(this.o.endDate); 15459 15460 if (fromArgs){ 15461 // setting date by clicking 15462 this.setValue(); 15463 } 15464 else if (dates.length){ 15465 // setting date by typing 15466 if (String(oldDates) !== String(this.dates)) 15467 this._trigger('changeDate'); 15468 } 15469 if (!this.dates.length && oldDates.length) 15470 this._trigger('clearDate'); 15471 15472 this.fill(); 15473 return this; 15474 }, 15475 15476 fillDow: function(){ 15477 var dowCnt = this.o.weekStart, 15478 html = '<tr>'; 15479 if (this.o.calendarWeeks){ 15480 this.picker.find('.datepicker-days thead tr:first-child .datepicker-switch') 15481 .attr('colspan', function(i, val){ 15482 return parseInt(val) + 1; 15483 });
15484 var cell = '<th class="cw"> </th>'; 15485 html += cell; 15486 } 15487 while (dowCnt < this.o.weekStart + 7){ 15488 html += '<th class="dow">'+dates[this.o.language].daysMin[(dowCnt++)%7]+'</th>'; 15489 } 15490 html += '</tr>'; 15491 this.picker.find('.datepicker-days thead').append(html); 15492 }, 15493 15494 fillMonths: function(){ 15495 var html = '', 15496 i = 0; 15497 while (i < 12){ 15498 html += '<span class="month">'+dates[this.o.language].monthsShort[i++]+'</span>'; 15499 } 15500 this.picker.find('.datepicker-months td').html(html); 15501 }, 15502 15503 setRange: function(range){ 15504 if (!range || !range.length) 15505 delete this.range; 15506 else 15507 this.range = $.map(range, function(d){ 15508 return d.valueOf(); 15509 }); 15510 this.fill(); 15511 }, 15512 15513 getClassNames: function(date){ 15514 var cls = [], 15515 year = this.viewDate.getUTCFullYear(), 15516 month = this.viewDate.getUTCMonth(), 15517 today = new Date(); 15518 if (date.getUTCFullYear() < year || (date.getUTCFullYear() === year && date.getUTCMonth() < month)){ 15519 cls.push('old'); 15520 } 15521 else if (date.getUTCFullYear() > year || (date.getUTCFullYear() === year && date.getUTCMonth() > month)){ 15522 cls.push('new'); 15523 } 15524 if (this.focusDate && date.valueOf() === this.focusDate.valueOf()) 15525 cls.push('focused'); 15526 // Compare internal UTC date with local today, not UTC today 15527 if (this.o.todayHighlight && 15528 date.getUTCFullYear() === today.getFullYear() && 15529 date.getUTCMonth() === today.getMonth() && 15530 date.getUTCDate() === today.getDate()){ 15531 cls.push('today'); 15532 } 15533 if (this.dates.contains(date) !== -1) 15534 cls.push('active'); 15535 if (date.valueOf() < this.o.startDate || date.valueOf() > this.o.endDate || 15536 $.inArray(date.getUTCDay(), this.o.daysOfWeekDisabled) !== -1){ 15537 cls.push('disabled'); 15538 } 15539 if (this.o.datesDisabled.length > 0 && 15540 $.grep(this.o.datesDisabled, function(d){ 15541 return isUTCEquals(date, d); }).length > 0) { 15542 cls.push('disabled', 'disabled-date'); 15543 } 15544 15545 if (this.range){ 15546 if (date > this.range[0] && date < this.range[this.range.length-1]){ 15547 cls.push('range'); 15548 } 15549 if ($.inArray(date.valueOf(), this.range) !== -1){ 15550 cls.push('selected'); 15551 } 15552 } 15553 return cls; 15554 }, 15555 15556 fill: function(){ 15557 var d = new Date(this.viewDate), 15558 year = d.getUTCFullYear(), 15559 month = d.getUTCMonth(), 15560 startYear = this.o.startDate !== -Infinity ? this.o.startDate.getUTCFullYear() : -Infinity, 15561 startMonth = this.o.startDate !== -Infinity ? this.o.startDate.getUTCMonth() : -Infinity, 15562 endYear = this.o.endDate !== Infinity ? this.o.endDate.getUTCFullYear() : Infinity, 15563 endMonth = this.o.endDate !== Infinity ? this.o.endDate.getUTCMonth() : Infinity, 15564 todaytxt = dates[this.o.language].today || dates['en'].today || '', 15565 cleartxt = dates[this.o.language].clear || dates['en'].clear || '', 15566 tooltip; 15567 if (isNaN(year) || isNaN(month)) 15568 return; 15569 this.picker.find('.datepicker-days thead .datepicker-switch') 15570 .text(dates[this.o.language].months[month]+' '+year); 15571 this.picker.find('tfoot .today') 15572 .text(todaytxt) 15573 .toggle(this.o.todayBtn !== false); 15574 this.picker.find('tfoot .clear') 15575 .text(cleartxt) 15576 .toggle(this.o.clearBtn !== false); 15577 this.updateNavArrows(); 15578 this.fillMonths(); 15579 var prevMonth = UTCDate(year, month-1, 28), 15580 day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth()); 15581 prevMonth.setUTCDate(day); 15582 prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.o.weekStart + 7)%7); 15583 var nextMonth = new Date(prevMonth); 15584 nextMonth.setUTCDate(nextMonth.getUTCDate() + 42); 15585 nextMonth = nextMonth.valueOf(); 15586 var html = []; 15587 var clsName; 15588 while (prevMonth.valueOf() < nextMonth){ 15589 if (prevMonth.getUTCDay() === this.o.weekStart){ 15590 html.push('<tr>'); 15591 if (this.o.calendarWeeks){ 15592 // ISO 8601: First week contains first thursday. 15593 // ISO also states week starts on Monday, but we can be more abstract here. 15594 var 15595 // Start of current week: based on weekstart/current date 15596 ws = new Date(+prevMonth + (this.o.weekStart - prevMonth.getUTCDay() - 7) % 7 * 864e5), 15597 // Thursday of this week 15598 th = new Date(Number(ws) + (7 + 4 - ws.getUTCDay()) % 7 * 864e5), 15599 // First Thursday of year, year from thursday 15600 yth = new Date(Number(yth = UTCDate(th.getUTCFullYear(), 0, 1)) + (7 + 4 - yth.getUTCDay())%7*864e5), 15601 // Calendar week: ms between thursdays, div ms per day, div 7 days 15602 calWeek = (th - yth) / 864e5 / 7 + 1; 15603 html.push('<td class="cw">'+ calWeek +'</td>'); 15604 15605 } 15606 } 15607 clsName = this.getClassNames(prevMonth); 15608 clsName.push('day'); 15609 15610 if (this.o.beforeShowDay !== $.noop){ 15611 var before = this.o.beforeShowDay(this._utc_to_local(prevMonth)); 15612 if (before === undefined) 15613 before = {}; 15614 else if (typeof(before) === 'boolean') 15615 before = {enabled: before}; 15616 else if (typeof(before) === 'string') 15617 before = {classes: before}; 15618 if (before.enabled === false) 15619 clsName.push('disabled'); 15620 if (before.classes) 15621 clsName = clsName.concat(before.classes.split(/\s+/)); 15622 if (before.tooltip) 15623 tooltip = before.tooltip; 15624 } 15625 15626 clsName = $.unique(clsName); 15627 html.push('<td class="'+clsName.join(' ')+'"' + (tooltip ? ' title="'+tooltip+'"' : '') + '>'+prevMonth.getUTCDate() + '</td>'); 15628 tooltip = null; 15629 if (prevMonth.getUTCDay() === this.o.weekEnd){ 15630 html.push('</tr>'); 15631 } 15632 prevMonth.setUTCDate(prevMonth.getUTCDate()+1); 15633 } 15634 this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
15635 15636 var months = this.picker.find('.datepicker-months') 15637 .find('th:eq(1)') 15638 .text(year) 15639 .end() 15640 .find('span').removeClass('active'); 15641 15642 $.each(this.dates, function(i, d){ 15643 if (d.getUTCFullYear() === year) 15644 months.eq(d.getUTCMonth()).addClass('active'); 15645 }); 15646 15647 if (year < startYear || year > endYear){ 15648 months.addClass('disabled'); 15649 } 15650 if (year === startYear){ 15651 months.slice(0, startMonth).addClass('disabled'); 15652 } 15653 if (year === endYear){ 15654 months.slice(endMonth+1).addClass('disabled'); 15655 } 15656 15657 if (this.o.beforeShowMonth !== $.noop){ 15658 var that = this; 15659 $.each(months, function(i, month){ 15660 if (!$(month).hasClass('disabled')) { 15661 var moDate = new Date(year, i, 1); 15662 var before = that.o.beforeShowMonth(moDate); 15663 if (before === false) 15664 $(month).addClass('disabled'); 15665 } 15666 }); 15667 } 15668 15669 html = ''; 15670 year = parseInt(year/10, 10) * 10; 15671 var yearCont = this.picker.find('.datepicker-years') 15672 .find('th:eq(1)') 15673 .text(year + '-' + (year + 9)) 15674 .end() 15675 .find('td'); 15676 year -= 1; 15677 var years = $.map(this.dates, function(d){ 15678 return d.getUTCFullYear(); 15679 }), 15680 classes; 15681 for (var i = -1; i < 11; i++){ 15682 classes = ['year']; 15683 if (i === -1) 15684 classes.push('old'); 15685 else if (i === 10) 15686 classes.push('new'); 15687 if ($.inArray(year, years) !== -1) 15688 classes.push('active'); 15689 if (year < startYear || year > endYear) 15690 classes.push('disabled'); 15691 html += '<span class="' + classes.join(' ') + '">' + year + '</span>'; 15692 year += 1; 15693 } 15694 yearCont.html(html); 15695 }, 15696 15697 updateNavArrows: function(){ 15698 if (!this._allow_update) 15699 return; 15700 15701 var d = new Date(this.viewDate), 15702 year = d.getUTCFullYear(), 15703 month = d.getUTCMonth(); 15704 switch (this.viewMode){ 15705 case 0: 15706 if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear() && month <= this.o.startDate.getUTCMonth()){ 15707 this.picker.find('.prev').css({visibility: 'hidden'}); 15708 } 15709 else { 15710 this.picker.find('.prev').css({visibility: 'visible'}); 15711 } 15712 if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear() && month >= this.o.endDate.getUTCMonth()){ 15713 this.picker.find('.next').css({visibility: 'hidden'}); 15714 } 15715 else { 15716 this.picker.find('.next').css({visibility: 'visible'}); 15717 } 15718 break; 15719 case 1: 15720 case 2: 15721 if (this.o.startDate !== -Infinity && year <= this.o.startDate.getUTCFullYear()){ 15722 this.picker.find('.prev').css({visibility: 'hidden'}); 15723 } 15724 else { 15725 this.picker.find('.prev').css({visibility: 'visible'}); 15726 } 15727 if (this.o.endDate !== Infinity && year >= this.o.endDate.getUTCFullYear()){ 15728 this.picker.find('.next').css({visibility: 'hidden'}); 15729 } 15730 else { 15731 this.picker.find('.next').css({visibility: 'visible'}); 15732 } 15733 break; 15734 } 15735 }, 15736 15737 click: function(e){ 15738 e.preventDefault(); 15739 var target = $(e.target).closest('span, td, th'), 15740 year, month, day; 15741 if (target.length === 1){ 15742 switch (target[0].nodeName.toLowerCase()){ 15743 case 'th': 15744 switch (target[0].className){ 15745 case 'datepicker-switch': 15746 this.showMode(1); 15747 break; 15748 case 'prev': 15749 case 'next': 15750 var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className === 'prev' ? -1 : 1); 15751 switch (this.viewMode){ 15752 case 0: 15753 this.viewDate = this.moveMonth(this.viewDate, dir); 15754 this._trigger('changeMonth', this.viewDate); 15755 break; 15756 case 1: 15757 case 2: 15758 this.viewDate = this.moveYear(this.viewDate, dir); 15759 if (this.viewMode === 1) 15760 this._trigger('changeYear', this.viewDate); 15761 break; 15762 } 15763 this.fill(); 15764 break; 15765 case 'today': 15766 var date = new Date(); 15767 date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); 15768 15769 this.showMode(-2); 15770 var which = this.o.todayBtn === 'linked' ? null : 'view'; 15771 this._setDate(date, which); 15772 break; 15773 case 'clear': 15774 this.clearDates();
15775 break; 15776 } 15777 break; 15778 case 'span': 15779 if (!target.hasClass('disabled')){ 15780 this.viewDate.setUTCDate(1); 15781 if (target.hasClass('month')){ 15782 day = 1; 15783 month = target.parent().find('span').index(target); 15784 year = this.viewDate.getUTCFullYear(); 15785 this.viewDate.setUTCMonth(month); 15786 this._trigger('changeMonth', this.viewDate); 15787 if (this.o.minViewMode === 1){ 15788 this._setDate(UTCDate(year, month, day)); 15789 } 15790 } 15791 else { 15792 day = 1; 15793 month = 0; 15794 year = parseInt(target.text(), 10)||0; 15795 this.viewDate.setUTCFullYear(year); 15796 this._trigger('changeYear', this.viewDate); 15797 if (this.o.minViewMode === 2){ 15798 this._setDate(UTCDate(year, month, day)); 15799 } 15800 } 15801 this.showMode(-1); 15802 this.fill(); 15803 } 15804 break; 15805 case 'td': 15806 if (target.hasClass('day') && !target.hasClass('disabled')){ 15807 day = parseInt(target.text(), 10)||1; 15808 year = this.viewDate.getUTCFullYear(); 15809 month = this.viewDate.getUTCMonth(); 15810 if (target.hasClass('old')){ 15811 if (month === 0){ 15812 month = 11; 15813 year -= 1; 15814 } 15815 else { 15816 month -= 1; 15817 } 15818 } 15819 else if (target.hasClass('new')){ 15820 if (month === 11){ 15821 month = 0; 15822 year += 1; 15823 } 15824 else { 15825 month += 1; 15826 } 15827 } 15828 this._setDate(UTCDate(year, month, day)); 15829 } 15830 break; 15831 } 15832 } 15833 if (this.picker.is(':visible') && this._focused_from){ 15834 $(this._focused_from).focus(); 15835 } 15836 delete this._focused_from; 15837 }, 15838 15839 _toggle_multidate: function(date){ 15840 var ix = this.dates.contains(date); 15841 if (!date){ 15842 this.dates.clear(); 15843 } 15844 15845 if (ix !== -1){ 15846 if (this.o.multidate === true || this.o.multidate > 1 || this.o.toggleActive){ 15847 this.dates.remove(ix); 15848 } 15849 } else if (this.o.multidate === false) { 15850 this.dates.clear(); 15851 this.dates.push(date); 15852 } 15853 else { 15854 this.dates.push(date); 15855 } 15856 15857 if (typeof this.o.multidate === 'number') 15858 while (this.dates.length > this.o.multidate) 15859 this.dates.remove(0); 15860 }, 15861 15862 _setDate: function(date, which){ 15863 if (!which || which === 'date') 15864 this._toggle_multidate(date && new Date(date)); 15865 if (!which || which === 'view') 15866 this.viewDate = date && new Date(date); 15867 15868 this.fill(); 15869 this.setValue(); 15870 if (!which || which !== 'view') { 15871 this._trigger('changeDate'); 15872 } 15873 var element; 15874 if (this.isInput){ 15875 element = this.element; 15876 } 15877 else if (this.component){ 15878 element = this.element.find('input'); 15879 } 15880 if (element){ 15881 element.change(); 15882 } 15883 if (this.o.autoclose && (!which || which === 'date')){ 15884 this.hide(); 15885 } 15886 }, 15887 15888 moveMonth: function(date, dir){ 15889 if (!date) 15890 return undefined; 15891 if (!dir) 15892 return date; 15893 var new_date = new Date(date.valueOf()), 15894 day = new_date.getUTCDate(), 15895 month = new_date.getUTCMonth(), 15896 mag = Math.abs(dir), 15897 new_month, test; 15898 dir = dir > 0 ? 1 : -1; 15899 if (mag === 1){ 15900 test = dir === -1 15901 // If going back one month, make sure month is not current month 15902 // (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02) 15903 ? function(){ 15904 return new_date.getUTCMonth() === month; 15905 } 15906 // If going forward one month, make sure month is as expected 15907 // (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02) 15908 : function(){ 15909 return new_date.getUTCMonth() !== new_month; 15910 }; 15911 new_month = month + dir; 15912 new_date.setUTCMonth(new_month); 15913 // Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11 15914 if (new_month < 0 || new_month > 11) 15915 new_month = (new_month + 12) % 12; 15916 } 15917 else { 15918 // For magnitudes >1, move one month at a time... 15919 for (var i=0; i < mag; i++) 15920 // ...which might decrease the day (eg, Jan 31 to Feb 28, etc)... 15921 new_date = this.moveMonth(new_date, dir); 15922 // ...then reset the day, keeping it in the new month 15923 new_month = new_date.getUTCMonth(); 15924 new_date.setUTCDate(day); 15925 test = function(){ 15926 return new_month !== new_date.getUTCMonth(); 15927 }; 15928 } 15929 // Common date-resetting loop -- if date is beyond end of month, make it 15930 // end of month 15931 while (test()){ 15932 new_date.setUTCDate(--day); 15933 new_date.setUTCMonth(new_month); 15934 } 15935 return new_date; 15936 }, 15937 15938 moveYear: function(date, dir){ 15939 return this.moveMonth(date, dir*12); 15940 }, 15941 15942 dateWithinRange: function(date){ 15943 return date >= this.o.startDate && date <= this.o.endDate; 15944 }, 15945 15946 keydown: function(e){
15947 if (!this.picker.is(':visible')){ 15948 if (e.keyCode === 40 || e.keyCode === 27) // allow down to re-show picker 15949 this.show(); 15950 return; 15951 } 15952 var dateChanged = false, 15953 dir, newDate, newViewDate, 15954 focusDate = this.focusDate || this.viewDate; 15955 switch (e.keyCode){ 15956 case 27: // escape 15957 if (this.focusDate){ 15958 this.focusDate = null; 15959 this.viewDate = this.dates.get(-1) || this.viewDate; 15960 this.fill(); 15961 } 15962 else 15963 this.hide(); 15964 e.preventDefault(); 15965 break; 15966 case 37: // left 15967 case 39: // right 15968 if (!this.o.keyboardNavigation) 15969 break; 15970 dir = e.keyCode === 37 ? -1 : 1; 15971 if (e.ctrlKey){ 15972 newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir); 15973 newViewDate = this.moveYear(focusDate, dir); 15974 this._trigger('changeYear', this.viewDate); 15975 } 15976 else if (e.shiftKey){ 15977 newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir); 15978 newViewDate = this.moveMonth(focusDate, dir); 15979 this._trigger('changeMonth', this.viewDate); 15980 } 15981 else { 15982 newDate = new Date(this.dates.get(-1) || UTCToday()); 15983 newDate.setUTCDate(newDate.getUTCDate() + dir); 15984 newViewDate = new Date(focusDate); 15985 newViewDate.setUTCDate(focusDate.getUTCDate() + dir); 15986 } 15987 if (this.dateWithinRange(newViewDate)){ 15988 this.focusDate = this.viewDate = newViewDate; 15989 this.setValue(); 15990 this.fill(); 15991 e.preventDefault(); 15992 } 15993 break; 15994 case 38: // up 15995 case 40: // down 15996 if (!this.o.keyboardNavigation) 15997 break; 15998 dir = e.keyCode === 38 ? -1 : 1; 15999 if (e.ctrlKey){ 16000 newDate = this.moveYear(this.dates.get(-1) || UTCToday(), dir); 16001 newViewDate = this.moveYear(focusDate, dir); 16002 this._trigger('changeYear', this.viewDate); 16003 } 16004 else if (e.shiftKey){ 16005 newDate = this.moveMonth(this.dates.get(-1) || UTCToday(), dir); 16006 newViewDate = this.moveMonth(focusDate, dir); 16007 this._trigger('changeMonth', this.viewDate); 16008 } 16009 else { 16010 newDate = new Date(this.dates.get(-1) || UTCToday()); 16011 newDate.setUTCDate(newDate.getUTCDate() + dir * 7); 16012 newViewDate = new Date(focusDate); 16013 newViewDate.setUTCDate(focusDate.getUTCDate() + dir * 7); 16014 } 16015 if (this.dateWithinRange(newViewDate)){ 16016 this.focusDate = this.viewDate = newViewDate; 16017 this.setValue(); 16018 this.fill(); 16019 e.preventDefault(); 16020 } 16021 break; 16022 case 32: // spacebar 16023 // Spacebar is used in manually typing dates in some formats. 16024 // As such, its behavior should not be hijacked. 16025 break; 16026 case 13: // enter 16027 focusDate = this.focusDate || this.dates.get(-1) || this.viewDate; 16028 if (this.o.keyboardNavigation) { 16029 this._toggle_multidate(focusDate); 16030 dateChanged = true; 16031 } 16032 this.focusDate = null; 16033 this.viewDate = this.dates.get(-1) || this.viewDate; 16034 this.setValue(); 16035 this.fill(); 16036 if (this.picker.is(':visible')){ 16037 e.preventDefault(); 16038 if (typeof e.stopPropagation === 'function') { 16039 e.stopPropagation(); // All modern browsers, IE9+ 16040 } else { 16041 e.cancelBubble = true; // IE6,7,8 ignore "stopPropagation" 16042 } 16043 if (this.o.autoclose) 16044 this.hide(); 16045 } 16046 break; 16047 case 9: // tab 16048 this.focusDate = null; 16049 this.viewDate = this.dates.get(-1) || this.viewDate; 16050 this.fill(); 16051 this.hide(); 16052 break; 16053 } 16054 if (dateChanged){ 16055 if (this.dates.length) 16056 this._trigger('changeDate'); 16057 else 16058 this._trigger('clearDate'); 16059 var element; 16060 if (this.isInput){ 16061 element = this.element; 16062 } 16063 else if (this.component){ 16064 element = this.element.find('input'); 16065 } 16066 if (element){ 16067 element.change(); 16068 } 16069 } 16070 }, 16071 16072 showMode: function(dir){ 16073 if (dir){ 16074 this.viewMode = Math.max(this.o.minViewMode, Math.min(2, this.viewMode + dir)); 16075 } 16076 this.picker 16077 .children('div') 16078 .hide() 16079 .filter('.datepicker-' + DPGlobal.modes[this.viewMode].clsName) 16080 .css('display', 'block'); 16081 this.updateNavArrows(); 16082 } 16083 }; 16084 16085 var DateRangePicker = function(element, options){ 16086 this.element = $(element); 16087 this.inputs = $.map(options.inputs, function(i){ 16088 return i.jquery ? i[0] : i; 16089 }); 16090 delete options.inputs; 16091 16092 datepickerPlugin.call($(this.inputs), options) 16093 .on('changeDate', $.proxy(this.dateUpdated, this)); 16094 16095 this.pickers = $.map(this.inputs, function(i){ 16096 return $(i).data('datepicker'); 16097 }); 16098 this.updateDates();
16099 }; 16100 DateRangePicker.prototype = { 16101 updateDates: function(){ 16102 this.dates = $.map(this.pickers, function(i){ 16103 return i.getUTCDate(); 16104 }); 16105 this.updateRanges(); 16106 }, 16107 updateRanges: function(){ 16108 var range = $.map(this.dates, function(d){ 16109 return d.valueOf(); 16110 }); 16111 $.each(this.pickers, function(i, p){ 16112 p.setRange(range); 16113 }); 16114 }, 16115 dateUpdated: function(e){ 16116 // `this.updating` is a workaround for preventing infinite recursion 16117 // between `changeDate` triggering and `setUTCDate` calling. Until 16118 // there is a better mechanism. 16119 if (this.updating) 16120 return; 16121 this.updating = true; 16122 16123 var dp = $(e.target).data('datepicker'), 16124 new_date = dp.getUTCDate(), 16125 i = $.inArray(e.target, this.inputs), 16126 j = i - 1, 16127 k = i + 1, 16128 l = this.inputs.length; 16129 if (i === -1) 16130 return; 16131 16132 $.each(this.pickers, function(i, p){ 16133 if (!p.getUTCDate()) 16134 p.setUTCDate(new_date); 16135 }); 16136 16137 if (new_date < this.dates[j]){ 16138 // Date being moved earlier/left 16139 while (j >= 0 && new_date < this.dates[j]){ 16140 this.pickers[j--].setUTCDate(new_date); 16141 } 16142 } 16143 else if (new_date > this.dates[k]){ 16144 // Date being moved later/right 16145 while (k < l && new_date > this.dates[k]){ 16146 this.pickers[k++].setUTCDate(new_date); 16147 } 16148 } 16149 this.updateDates(); 16150 16151 delete this.updating; 16152 }, 16153 remove: function(){ 16154 $.map(this.pickers, function(p){ p.remove(); }); 16155 delete this.element.data().datepicker; 16156 } 16157 }; 16158 16159 function opts_from_el(el, prefix){ 16160 // Derive options from element data-attrs 16161 var data = $(el).data(), 16162 out = {}, inkey, 16163 replace = new RegExp('^' + prefix.toLowerCase() + '([A-Z])'); 16164 prefix = new RegExp('^' + prefix.toLowerCase()); 16165 function re_lower(_,a){ 16166 return a.toLowerCase(); 16167 } 16168 for (var key in data) 16169 if (prefix.test(key)){ 16170 inkey = key.replace(replace, re_lower); 16171 out[inkey] = data[key]; 16172 } 16173 return out; 16174 } 16175 16176 function opts_from_locale(lang){ 16177 // Derive options from locale plugins 16178 var out = {}; 16179 // Check if "de-DE" style date is available, if not language should 16180 // fallback to 2 letter code eg "de" 16181 if (!dates[lang]){ 16182 lang = lang.split('-')[0]; 16183 if (!dates[lang]) 16184 return; 16185 } 16186 var d = dates[lang]; 16187 $.each(locale_opts, function(i,k){ 16188 if (k in d) 16189 out[k] = d[k]; 16190 }); 16191 return out; 16192 } 16193 16194 var old = $.fn.datepicker; 16195 var datepickerPlugin = function(option){ 16196 var args = Array.apply(null, arguments); 16197 args.shift(); 16198 var internal_return; 16199 this.each(function(){ 16200 var $this = $(this), 16201 data = $this.data('datepicker'), 16202 options = typeof option === 'object' && option; 16203 if (!data){ 16204 var elopts = opts_from_el(this, 'date'), 16205 // Preliminary otions 16206 xopts = $.extend({}, defaults, elopts, options), 16207 locopts = opts_from_locale(xopts.language), 16208 // Options priority: js args, data-attrs, locales, defaults 16209 opts = $.extend({}, defaults, locopts, elopts, options); 16210 if ($this.hasClass('input-daterange') || opts.inputs){ 16211 var ropts = { 16212 inputs: opts.inputs || $this.find('input').toArray() 16213 }; 16214 $this.data('datepicker', (data = new DateRangePicker(this, $.extend(opts, ropts)))); 16215 } 16216 else { 16217 $this.data('datepicker', (data = new Datepicker(this, opts))); 16218 } 16219 } 16220 if (typeof option === 'string' && typeof data[option] === 'function'){ 16221 internal_return = data[option].apply(data, args); 16222 if (internal_return !== undefined) 16223 return false; 16224 } 16225 }); 16226 if (internal_return !== undefined) 16227 return internal_return; 16228 else 16229 return this; 16230 }; 16231 $.fn.datepicker = datepickerPlugin; 16232 16233 var defaults = $.fn.datepicker.defaults = { 16234 autoclose: false, 16235 beforeShowDay: $.noop, 16236 beforeShowMonth: $.noop, 16237 calendarWeeks: false, 16238 clearBtn: false, 16239 toggleActive: false, 16240 daysOfWeekDisabled: [], 16241 datesDisabled: [], 16242 endDate: Infinity, 16243 forceParse: true, 16244 format: 'mm/dd/yyyy', 16245 keyboardNavigation: true, 16246 language: 'en', 16247 minViewMode: 0, 16248 multidate: false, 16249 multidateSeparator: ',', 16250 orientation: "auto", 16251 rtl: false, 16252 startDate: -Infinity, 16253 startView: 0, 16254 todayBtn: false, 16255 todayHighlight: false, 16256 weekStart: 0, 16257 disableTouchKeyboard: false, 16258 enableOnReadonly: true, 16259 container: 'body' 16260 }; 16261 var locale_opts = $.fn.datepicker.locale_opts = [ 16262 'format', 16263 'rtl', 16264 'weekStart' 16265 ]; 16266 $.fn.datepicker.Constructor = Datepicker; 16267 var dates = $.fn.datepicker.dates = { 16268 en: { 16269 days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], 16270 daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 16271 daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"], 16272 months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
16272November", "December"], 16273 monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], 16274 today: "Today", 16275 clear: "Clear" 16276 } 16277 }; 16278 16279 var DPGlobal = { 16280 modes: [ 16281 { 16282 clsName: 'days', 16283 navFnc: 'Month', 16284 navStep: 1 16285 }, 16286 { 16287 clsName: 'months', 16288 navFnc: 'FullYear', 16289 navStep: 1 16290 }, 16291 { 16292 clsName: 'years', 16293 navFnc: 'FullYear', 16294 navStep: 10 16295 }], 16296 isLeapYear: function(year){ 16297 return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0)); 16298 }, 16299 getDaysInMonth: function(year, month){ 16300 return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]; 16301 }, 16302 validParts: /dd?|DD?|mm?|MM?|yy(?:yy)?/g, 16303 nonpunctuation: /[^ -\/:-@\[\u3400-\u9fff-`{-~\t\n\r]+/g, 16304 parseFormat: function(format){ 16305 // IE treats \0 as a string end in inputs (truncating the value), 16306 // so it's a bad format delimiter, anyway 16307 var separators = format.replace(this.validParts, '\0').split('\0'), 16308 parts = format.match(this.validParts); 16309 if (!separators || !separators.length || !parts || parts.length === 0){ 16310 throw new Error("Invalid date format."); 16311 } 16312 return {separators: separators, parts: parts}; 16313 }, 16314 parseDate: function(date, format, language){ 16315 if (!date) 16316 return undefined; 16317 if (date instanceof Date) 16318 return date; 16319 if (typeof format === 'string') 16320 format = DPGlobal.parseFormat(format); 16321 var part_re = /([\-+]\d+)([dmwy])/, 16322 parts = date.match(/([\-+]\d+)([dmwy])/g), 16323 part, dir, i; 16324 if (/^[\-+]\d+[dmwy]([\s,]+[\-+]\d+[dmwy])*$/.test(date)){ 16325 date = new Date(); 16326 for (i=0; i < parts.length; i++){ 16327 part = part_re.exec(parts[i]); 16328 dir = parseInt(part[1]); 16329 switch (part[2]){ 16330 case 'd': 16331 date.setUTCDate(date.getUTCDate() + dir); 16332 break; 16333 case 'm': 16334 date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir); 16335 break; 16336 case 'w': 16337 date.setUTCDate(date.getUTCDate() + dir * 7); 16338 break; 16339 case 'y': 16340 date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir); 16341 break; 16342 } 16343 } 16344 return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0); 16345 } 16346 parts = date && date.match(this.nonpunctuation) || []; 16347 date = new Date(); 16348 var parsed = {}, 16349 setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'], 16350 setters_map = { 16351 yyyy: function(d,v){ 16352 return d.setUTCFullYear(v); 16353 }, 16354 yy: function(d,v){ 16355 return d.setUTCFullYear(2000+v); 16356 }, 16357 m: function(d,v){ 16358 if (isNaN(d)) 16359 return d; 16360 v -= 1; 16361 while (v < 0) v += 12; 16362 v %= 12; 16363 d.setUTCMonth(v); 16364 while (d.getUTCMonth() !== v) 16365 d.setUTCDate(d.getUTCDate()-1); 16366 return d; 16367 }, 16368 d: function(d,v){ 16369 return d.setUTCDate(v); 16370 } 16371 }, 16372 val, filtered; 16373 setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m']; 16374 setters_map['dd'] = setters_map['d']; 16375 date = UTCDate(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0); 16376 var fparts = format.parts.slice(); 16377 // Remove noop parts 16378 if (parts.length !== fparts.length){ 16379 fparts = $(fparts).filter(function(i,p){ 16380 return $.inArray(p, setters_order) !== -1; 16381 }).toArray(); 16382 } 16383 // Process remainder 16384 function match_part(){ 16385 var m = this.slice(0, parts[i].length), 16386 p = parts[i].slice(0, m.length); 16387 return m.toLowerCase() === p.toLowerCase(); 16388 } 16389 if (parts.length === fparts.length){ 16390 var cnt; 16391 for (i=0, cnt = fparts.length; i < cnt; i++){ 16392 val = parseInt(parts[i], 10); 16393 part = fparts[i]; 16394 if (isNaN(val)){ 16395 switch (part){ 16396 case 'MM': 16397 filtered = $(dates[language].months).filter(match_part); 16398 val = $.inArray(filtered[0], dates[language].months) + 1; 16399 break; 16400 case 'M': 16401 filtered = $(dates[language].monthsShort).filter(match_part); 16402 val = $.inArray(filtered[0], dates[language].monthsShort) + 1; 16403 break; 16404 } 16405 } 16406 parsed[part] = val; 16407 } 16408 var _date, s; 16409 for (i=0; i < setters_order.length; i++){ 16410 s = setters_order[i]; 16411 if (s in parsed && !isNaN(parsed[s])){ 16412 _date = new Date(date); 16413 setters_map[s](_date, parsed[s]); 16414 if (!isNaN(_date)) 16415 date = _date; 16416 } 16417 } 16418 } 16419 return date; 16420 }, 16421 formatDate: function(date, format, language){ 16422 if (!date) 16423 return ''; 16424 if (typeof format === 'string') 16425 format = DPGlobal.parseFormat(format); 16426 var val = { 16427 d: date.getUTCDate(), 16428 D: dates[language].daysShort[date.getUTCDay()], 16429 DD: dates[language].days[date.getUTCDay()], 16430 m: date.getUTCMonth() + 1, 16431 M: dates[language].monthsShort[date.getUTCMonth()], 16432 MM: dates[language].months[date.getUTCMonth()], 16433 yy: date.getUTCFullYear().toString().substring(2), 16434 yyyy: date.getUTCFullYear() 16435 }; 16436 val.dd = (val.d < 10 ? '0' : '') + val.d; 16437 val.mm = (val.m < 10 ? '0' : '') + val.m; 16438 date = []; 16439 var seps = $.extend([], format.separators); 16440 for (var i=0, cnt = format.parts.length; i <= cnt; i++){ 16441 if (seps.length) 16442 date.push(seps.shift()); 16443 date.push(val[format.parts[i]]); 16444 } 16445 return date.join(''); 16446 }, 16447 headTemplate: '<thead>'+ 16448 '<tr>'+ 16449 '<th class="prev">«</th>'+ 16450 '<th colspan="5" class="datepicker-switch"></th>'+ 16451 '<th class="next">»</th>'+ 16452 '</tr>'+ 16453 '</thead>', 16454 contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>', 16455 footTemplate: '<tfoot>'+ 16456 '<tr>'+ 16457 '<th colspan="7" class="today"></th>'+ 16458 '</tr>'+ 16459 '<tr>'+ 16460 '<th colspan="7" class="clear"></th>'+ 16461 '</tr>'+ 16462 '</tfoot>' 16463 }; 16464 DPGlobal.template = '<div class="datepicker">'+ 16465 '<div class="datepicker-days">'+ 16466 '<table class=" table-condensed">'+ 16467 DPGlobal.headTemplate+ 16468 '<tbody></tbody>'+ 16469 DPGlobal.footTemplate+ 16470 '</table>'+ 16471 '</div>'+ 16472 '<div class="datepicker-months">'+ 16473 '<table class="table-condensed">'+ 16474 DPGlobal.headTemplate+ 16475 DPGlobal.contTemplate+ 16476 DPGlobal.footTemplate+ 16477 '</table>'+ 16478 '</div>'+ 16479 '<div class="datepicker-years">'+ 16480 '<table class="table-condensed">'+ 16481 DPGlobal.headTemplate+ 16482 DPGlobal.contTemplate+ 16483 DPGlobal.footTemplate+ 16484 '</table>'+ 16485 '</div>'+ 16486 '</div>'; 16487 16488 $.fn.datepicker.DPGlobal = DPGlobal; 16489 16490 16491 /* DATEPICKER NO CONFLICT 16492 * =================== */ 16493 16494 $.fn.datepicker.noConflict = function(){ 16495 $.fn.datepicker = old; 16496 return this; 16497 }; 16498 16499 /* DATEPICKER VERSION 16500 * =================== */ 16501 $.fn.datepicker.version = "1.5.0"; 16502 16503 /* DATEPICKER DATA-API 16504 * ================== */ 16505 16506 $(document).on( 16507 'focus.datepicker.data-api click.datepicker.data-api',
16508 '[data-provide="datepicker"]', 16509 function(e){ 16510 var $this = $(this); 16511 if ($this.data('datepicker')) 16512 return; 16513 e.preventDefault(); 16514 // component click requires us to explicitly show it 16515 datepickerPlugin.call($this, 'show'); 16516 } 16517 ); 16518 $(function(){ 16519 datepickerPlugin.call($('[data-provide="datepicker-inline"]')); 16520 }); 16521 16522}(window.jQuery)); 16523; 16524(function ($) { 16525 //Polyfill for IE11 16526 if (!String.prototype.startsWith) { 16527 String.prototype.startsWith = function (searchString, position) { 16528 position = position || 0; 16529 return this.substr(position, searchString.length) === searchString; 16530 }; 16531 } 16532 if (!String.prototype.endsWith) { 16533 String.prototype.endsWith = function (searchString) { 16534 var length = this.length; 16535 var position = length - searchString.length || 0; 16536 return this.substr(position, length.length) === searchString; 16537 }; 16538 } 16539})(jQuery); 16540; 16541'use strict'; 16542 16543/** 16544 * Copyright Marc J. Schmidt. See the LICENSE file at the top-level 16545 * directory of this distribution and at 16546 * https://github.com/marcj/css-element-queries/blob/master/LICENSE. 16547 */ 16548(function (root, factory) { 16549 if (typeof define === "function" && define.amd) { 16550 define(['./ResizeSensor.js'], factory); 16551 } else if (typeof exports === "object") { 16552 module.exports = factory(require('./ResizeSensor.js')); 16553 } else { 16554 root.ElementQueries = factory(root.ResizeSensor); 16555 root.ElementQueries.listen(); 16556 } 16557}(typeof window !== 'undefined' ? window : this, function (ResizeSensor) { 16558 16559 /** 16560 * 16561 * @type {Function} 16562 * @constructor 16563 */ 16564 var ElementQueries = function () { 16565 //<style> element with our dynamically created styles 16566 var cssStyleElement; 16567 16568 //all rules found for element queries 16569 var allQueries = {}; 16570 16571 //association map to identify which selector belongs to a element from the animationstart event. 16572 var idToSelectorMapping = []; 16573 16574 /** 16575 * 16576 * @param element 16577 * @returns {Number} 16578 */ 16579 function getEmSize(element) { 16580 if (!element) { 16581 element = document.documentElement; 16582 } 16583 var fontSize = window.getComputedStyle(element, null).fontSize; 16584 return parseFloat(fontSize) || 16; 16585 } 16586 16587 /** 16588 * Get element size 16589 * @param {HTMLElement} element 16590 * @returns {Object} {width, height} 16591 */ 16592 function getElementSize(element) { 16593 if (!element.getBoundingClientRect) { 16594 return { 16595 width: element.offsetWidth, 16596 height: element.offsetHeight 16597 } 16598 } 16599 16600 var rect = element.getBoundingClientRect(); 16601 return { 16602 width: Math.round(rect.width), 16603 height: Math.round(rect.height) 16604 } 16605 } 16606 16607 /** 16608 * 16609 * @copyright https://github.com/Mr0grog/element-query/blob/master/LICENSE 16610 * 16611 * @param {HTMLElement} element 16612 * @param {*} value 16613 * @returns {*} 16614 */ 16615 function convertToPx(element, value) { 16616 var numbers = value.split(/\d/); 16617 var units = numbers[numbers.length - 1]; 16618 value = parseFloat(value); 16619 switch (units) { 16620 case "px": 16621 return value; 16622 case "em": 16623 return value * getEmSize(element); 16624 case "rem": 16625 return value * getEmSize(); 16626 // Viewport units! 16627 // According to http://quirksmode.org/mobile/tableViewport.html 16628 // documentElement.clientWidth/Height gets us the most reliable info 16629 case "vw": 16630 return value * document.documentElement.clientWidth / 100; 16631 case "vh": 16632 return value * document.documentElement.clientHeight / 100; 16633 case "vmin": 16634 case "vmax": 16635 var vw = document.documentElement.clientWidth / 100; 16636 var vh = document.documentElement.clientHeight / 100; 16637 var chooser = Math[units === "vmin" ? "min" : "max"]; 16638 return value * chooser(vw, vh); 16639 default: 16640 return value; 16641 // for now, not supporting physical units (since they are just a set number of px) 16642 // or ex/ch (getting accurate measurements is hard) 16643 } 16644 } 16645 16646 /** 16647 * 16648 * @param {HTMLElement} element 16649 * @param {String} id 16650 * @constructor 16651 */ 16652 function SetupInformation(element, id) { 16653 this.element = element; 16654 var key, option, elementSize, value, actualValue, attrValues, attrValue, attrName; 16655 16656 var attributes = ['min-width', 'min-height', 'max-width', 'max-height']; 16657 16658 /** 16659 * Extracts the computed width/height and sets to min/max- attribute. 16660 */ 16661 this.call = function () { 16662 // extract current dimensions 16663 elementSize = getElementSize(this.element); 16664 16665 attrValues = {}; 16666 16667 for (key in allQueries[id]) { 16668 if (!allQueries[id].hasOwnProperty(key)) { 16669 continue; 16670 } 16671 option = allQueries[id][key]; 16672 16673 value = convertToPx(this.element, option.value); 16674 16675 actualValue = option.property === 'width' ? elementSize.width : elementSize.height; 16676 attrName = option.mode + '-' + option.property; 16677 attrValue = ''; 16678 16679 if (option.mode === 'min' && actualValue >= value) { 16680 attrValue += option.value; 16681 } 16682 16683 if (option.mode === 'max' && actualValue <= value) { 16684 attrValue += option.value; 16685 } 16686 16687 if (!attrValues[attrName]) attrValues[attrName] = ''; 16688 if (attrValue && -1 === (' ' + attrValues[attrName] + ' ').indexOf(' ' + attrValue + ' ')) { 16689 attrValues[attrName] += ' ' + attrValue; 16690 } 16691 } 16692 16693 for (var k in attributes) { 16694 if (!attributes.hasOwnProperty(k)) continue; 16695 16696 if (attrValues[attributes[k]]) { 16697 this.element.setAttribute(attributes[k], attrValues[attributes[k]].substr(1)); 16698 } else { 16699 this.element.removeAttribute(attributes[k]); 16700 } 16701 } 16702 }; 16703 } 16704 16705 /** 16706 * @param {HTMLElement} element 16707 * @param {Object} id 16708 */ 16709 function setupElement(element, id) { 16710 if (!element.elementQueriesSetupInformation) { 16711 element.elementQueriesSetupInformation = new SetupInformation(element, id); 16712 } 16713 16714 if (!element.elementQueriesSensor) { 16715 element.elementQueriesSensor = new ResizeSensor(element, function () { 16716 element.elementQueriesSetupInformation.call(); 16717 }); 16718 } 16719 } 16720 16721 /** 16722 * Stores rules to the selector that should be applied once resized. 16723 * 16724 * @param {String} selector 16725 * @param {String} mode min|max 16726 * @param {String} property width|height 16727 * @param {String} value 16728 */ 16729 function queueQuery(selector, mode, property, value) { 16730 if (typeof(allQueries[selector]) === 'undefined') { 16731 allQueries[selector] = []; 16732 // add animation to trigger animationstart event, so we know exactly when a element appears in the DOM 16733 16734 var id = idToSelectorMapping.length; 16735 cssStyleElement.innerHTML += '\n' + selector + ' {animation: 0.1s element-queries;}'; 16736 cssStyleElement.innerHTML += '\n' + selector + ' > .resize-sensor {min-width: '+id+'px;}'; 16737 idToSelectorMapping.push(selector); 16738 } 16739 16740 allQueries[selector].push({ 16741 mode: mode, 16742 property: property, 16743 value: value 16744 }); 16745 } 16746 16747 function getQuery(container) { 16748 var query; 16749 if (document.querySelectorAll) query = (container) ? container.querySelectorAll.bind(container) : document.querySelectorAll.bind(document); 16750 if (!query && 'undefined' !== typeof $$) query = $$; 16751 if (!query && 'undefined' !== typeof jQuery) query = jQuery; 16752 16753 if (!query) { 16754 throw 'No document.querySelectorAll, jQuery or Mootools\'s $$ found.'; 16755 } 16756 16757 return query; 16758 } 16759 16760 /** 16761 * If animationStart didn't catch a new element in the DOM, we can manually search for it 16762 */ 16763 function findElementQueriesElements(container) { 16764 var query = getQuery(container); 16765 16766 for (var selector in allQueries) if (allQueries.hasOwnProperty(selector)) { 16767 // find all elements based on the extract query selector from the element query rule 16768 var elements = query(selector, container); 16769 16770 for (var i = 0, j = elements.length; i < j; i++) { 16771 setupElement(elements[i], selector); 16772 } 16773 } 16774 } 16775 16776 /** 16777 * 16778 * @param {HTMLElement} element 16779 */ 16780 function attachResponsiveImage(element) { 16781 var children = []; 16782 var rules = []; 16783 var sources = []; 16784 var defaultImageId = 0; 16785 var lastActiveImage = -1; 16786 var loadedImages = []; 16787 16788 for (var i in element.children) { 16789 if (!element.children.hasOwnProperty(i)) continue; 16790 16791 if (element.children[i].tagName && element.children[i].tagName.toLowerCase() === 'img') { 16792 children.push(element.children[i]); 16793 16794 var minWidth = element.children[i].getAttribute('min-width') || element.children[i].getAttribute('data-min-width'); 16795 //var minHeight = element.children[i].getAttribute('min-height') || element.children[i].getAttribute('data-min-height'); 16796 var src = element.children[i].getAttribute('data-src') || element.children[i].getAttribute('url'); 16797 16798 sources.push(src); 16799 16800 var rule = { 16801 minWidth: minWidth 16802 }; 16803 16804 rules.push(rule); 16805 16806 if (!minWidth) { 16807 defaultImageId = children.length - 1; 16808 element.children[i].style.display = 'block'; 16809 } else { 16810 element.children[i].style.display = 'none'; 16811 } 16812 } 16813 } 16814 16815 lastActiveImage = defaultImageId; 16816 16817 function check() { 16818 var imageToDisplay = false, i; 16819 16820 for (i in children) { 16821 if (!children.hasOwnProperty(i)) continue; 16822 16823 if (rules[i].minWidth) { 16824 if (element.offsetWidth > rules[i].minWidth) { 16825 imageToDisplay = i; 16826 } 16827 } 16828 } 16829 16830 if (!imageToDisplay) { 16831 //no rule matched, show default 16832 imageToDisplay = defaultImageId; 16833 } 16834 16835 if (lastActiveImage !== imageToDisplay) { 16836 //image change 16837 16838 if (!loadedImages[imageToDisplay]) { 16839 //image has not been loaded yet, we need to load the image first in memory to prevent flash of 16840 //no content 16841 16842 var image = new Image(); 16843 image.onload = function () { 16844 children[imageToDisplay].src = sources[imageToDisplay]; 16845 16846 children[lastActiveImage].style.display = 'none'; 16847 children[imageToDisplay].style.display = 'block'; 16848 16849 loadedImages[imageToDisplay] = true; 16850 16851 lastActiveImage = imageToDisplay; 16852 }; 16853 16854 image.src = sources[imageToDisplay]; 16855 } else { 16856 children[lastActiveImage].style.display = 'none'; 16857 children[imageToDisplay].style.display = 'block'; 16858 lastActiveImage = imageToDisplay; 16859 } 16860 } else { 16861 //make sure for initial check call the .src is set correctly 16862 children[imageToDisplay].src = sources[imageToDisplay]; 16863 } 16864 } 16865 16866 element.resizeSensorInstance = new ResizeSensor(element, check); 16867 check(); 16868 } 16869 16870 function findResponsiveImages() { 16871 var query = getQuery(); 16872 16873 var elements = query('[data-responsive-image],[responsive-image]'); 16874 for (var i = 0, j = elements.length; i < j; i++) { 16875 attachResponsiveImage(elements[i]); 16876 } 16877 } 16878 16879 var regex = /,?[\s\t]*([^,\n]*?)((?:\[[\s\t]*?(?:min|max)-(?:width|height)[\s\t]*?[~$\^]?=[\s\t]*?"[^"]*?"[\s\t]*?])+)([^,\n\s\{]*)/mg
16879i; 16880 var attrRegex = /\[[\s\t]*?(min|max)-(width|height)[\s\t]*?[~$\^]?=[\s\t]*?"([^"]*?)"[\s\t]*?]/mgi; 16881 16882 /** 16883 * @param {String} css 16884 */ 16885 function extractQuery(css) { 16886 var match, smatch, attrs, attrMatch; 16887 16888 css = css.replace(/'/g, '"'); 16889 while (null !== (match = regex.exec(css))) { 16890 smatch = match[1] + match[3]; 16891 attrs = match[2]; 16892 16893 while (null !== (attrMatch = attrRegex.exec(attrs))) { 16894 queueQuery(smatch, attrMatch[1], attrMatch[2], attrMatch[3]); 16895 } 16896 } 16897 } 16898 16899 /** 16900 * @param {CssRule[]|String} rules 16901 */ 16902 function readRules(rules) { 16903 var selector = ''; 16904 16905 if (!rules) { 16906 return; 16907 } 16908 16909 if ('string' === typeof rules) { 16910 rules = rules.toLowerCase(); 16911 if (-1 !== rules.indexOf('min-width') || -1 !== rules.indexOf('max-width')) { 16912 extractQuery(rules); 16913 } 16914 } else { 16915 for (var i = 0, j = rules.length; i < j; i++) { 16916 if (1 === rules[i].type) { 16917 selector = rules[i].selectorText || rules[i].cssText; 16918 if (-1 !== selector.indexOf('min-height') || -1 !== selector.indexOf('max-height')) { 16919 extractQuery(selector); 16920 } else if (-1 !== selector.indexOf('min-width') || -1 !== selector.indexOf('max-width')) { 16921 extractQuery(selector); 16922 } 16923 } else if (4 === rules[i].type) { 16924 readRules(rules[i].cssRules || rules[i].rules); 16925 } else if (3 === rules[i].type) { 16926 if(rules[i].styleSheet.hasOwnProperty("cssRules")) { 16927 readRules(rules[i].styleSheet.cssRules); 16928 } 16929 } 16930 } 16931 } 16932 } 16933 16934 var defaultCssInjected = false; 16935 16936 /** 16937 * Searches all css rules and setups the event listener to all elements with element query rules.. 16938 */ 16939 this.init = function () { 16940 var animationStart = 'animationstart'; 16941 if (typeof document.documentElement.style['webkitAnimationName'] !== 'undefined') { 16942 animationStart = 'webkitAnimationStart'; 16943 } else if (typeof document.documentElement.style['MozAnimationName'] !== 'undefined') { 16944 animationStart = 'mozanimationstart'; 16945 } else if (typeof document.documentElement.style['OAnimationName'] !== 'undefined') { 16946 animationStart = 'oanimationstart'; 16947 } 16948 16949 document.body.addEventListener(animationStart, function (e) { 16950 var element = e.target; 16951 var styles = element && window.getComputedStyle(element, null); 16952 var animationName = styles && styles.getPropertyValue('animation-name'); 16953 var requiresSetup = animationName && (-1 !== animationName.indexOf('element-queries')); 16954 16955 if (requiresSetup) { 16956 element.elementQueriesSensor = new ResizeSensor(element, function () { 16957 if (element.elementQueriesSetupInformation) { 16958 element.elementQueriesSetupInformation.call(); 16959 } 16960 }); 16961 16962 var sensorStyles = window.getComputedStyle(element.resizeSensor, null); 16963 var id = sensorStyles.getPropertyValue('min-width'); 16964 id = parseInt(id.replace('px', '')); 16965 setupElement(e.target, idToSelectorMapping[id]); 16966 } 16967 }); 16968 16969 if (!defaultCssInjected) { 16970 cssStyleElement = document.createElement('style'); 16971 cssStyleElement.type = 'text/css'; 16972 cssStyleElement.innerHTML = '[responsive-image] > img, [data-responsive-image] {overflow: hidden; padding: 0; } [responsive-image] > img, [data-responsive-image] > img {width: 100%;}'; 16973 16974 //safari wants at least one rule in keyframes to start working 16975 cssStyleElement.innerHTML += '\n@keyframes element-queries { 0% { visibility: inherit; } }'; 16976 document.getElementsByTagName('head')[0].appendChild(cssStyleElement); 16977 defaultCssInjected = true; 16978 } 16979 16980 for (var i = 0, j = document.styleSheets.length; i < j; i++) { 16981 try { 16982 if (document.styleSheets[i].href && 0 === document.styleSheets[i].href.indexOf('file://')) { 16983 console.warn("CssElementQueries: unable to parse local css files, " + document.styleSheets[i].href); 16984 } 16985 16986 readRules(document.styleSheets[i].cssRules || document.styleSheets[i].rules || document.styleSheets[i].cssText); 16987 } catch (e) { 16988 } 16989 } 16990 16991 findResponsiveImages(); 16992 }; 16993 16994 /** 16995 * Go through all collected rules (readRules()) and attach the resize-listener. 16996 * Not necessary to call it manually, since we detect automatically when new elements 16997 * are available in the DOM. However, sometimes handy for dirty DOM modifications. 16998 * 16999 * @param {HTMLElement} container only elements of the container are considered (document.body if not set) 17000 */ 17001 this.findElementQueriesElements = function (container) { 17002 findElementQueriesElements(container); 17003 }; 17004 17005 this.update = function () { 17006 this.init(); 17007 }; 17008 }; 17009 17010 ElementQueries.update = function () {
17011 ElementQueries.instance.update(); 17012 }; 17013 17014 /** 17015 * Removes all sensor and elementquery information from the element. 17016 * 17017 * @param {HTMLElement} element 17018 */ 17019 ElementQueries.detach = function (element) { 17020 if (element.elementQueriesSetupInformation) { 17021 //element queries 17022 element.elementQueriesSensor.detach(); 17023 delete element.elementQueriesSetupInformation; 17024 delete element.elementQueriesSensor; 17025 17026 } else if (element.resizeSensorInstance) { 17027 //responsive image 17028 17029 element.resizeSensorInstance.detach(); 17030 delete element.resizeSensorInstance; 17031 } 17032 }; 17033 17034 ElementQueries.init = function () { 17035 if (!ElementQueries.instance) { 17036 ElementQueries.instance = new ElementQueries(); 17037 } 17038 17039 ElementQueries.instance.init(); 17040 }; 17041 17042 var domLoaded = function (callback) { 17043 /* Mozilla, Chrome, Opera */ 17044 if (document.addEventListener) { 17045 document.addEventListener('DOMContentLoaded', callback, false); 17046 } 17047 /* Safari, iCab, Konqueror */ 17048 else if (/KHTML|WebKit|iCab/i.test(navigator.userAgent)) { 17049 var DOMLoadTimer = setInterval(function () { 17050 if (/loaded|complete/i.test(document.readyState)) { 17051 callback(); 17052 clearInterval(DOMLoadTimer); 17053 } 17054 }, 10); 17055 } 17056 /* Other web browsers */ 17057 else window.onload = callback; 17058 }; 17059 17060 ElementQueries.findElementQueriesElements = function (container) { 17061 ElementQueries.instance.findElementQueriesElements(container); 17062 }; 17063 17064 ElementQueries.listen = function () { 17065 domLoaded(ElementQueries.init); 17066 }; 17067 17068 return ElementQueries; 17069 17070})); 17071; 17072'use strict'; 17073 17074/** 17075 * Copyright Marc J. Schmidt. See the LICENSE file at the top-level 17076 * directory of this distribution and at 17077 * https://github.com/marcj/css-element-queries/blob/master/LICENSE. 17078 */ 17079(function (root, factory) { 17080 if (typeof define === "function" && define.amd) { 17081 define(factory); 17082 } else if (typeof exports === "object") { 17083 module.exports = factory(); 17084 } else { 17085 root.ResizeSensor = factory(); 17086 } 17087}(typeof window !== 'undefined' ? window : this, function () { 17088 17089 // Make sure it does not throw in a SSR (Server Side Rendering) situation 17090 if (typeof window === "undefined") { 17091 return null; 17092 } 17093 // https://github.com/Semantic-Org/Semantic-UI/issues/3855 17094 // https://github.com/marcj/css-element-queries/issues/257 17095 var globalWindow = typeof window != 'undefined' && window.Math == Math 17096 ? window 17097 : typeof self != 'undefined' && self.Math == Math 17098 ? self 17099 : Function('return this')(); 17100 // Only used for the dirty checking, so the event callback count is limited to max 1 call per fps per sensor. 17101 // In combination with the event based resize sensor this saves cpu time, because the sensor is too fast and 17102 // would generate too many unnecessary events. 17103 var requestAnimationFrame = globalWindow.requestAnimationFrame || 17104 globalWindow.mozRequestAnimationFrame || 17105 globalWindow.webkitRequestAnimationFrame || 17106 function (fn) { 17107 return globalWindow.setTimeout(fn, 20); 17108 }; 17109 17110 /** 17111 * Iterate over each of the provided element(s). 17112 * 17113 * @param {HTMLElement|HTMLElement[]} elements 17114 * @param {Function} callback 17115 */ 17116 function forEachElement(elements, callback){ 17117 var elementsType = Object.prototype.toString.call(elements); 17118 var isCollectionTyped = ('[object Array]' === elementsType 17119 || ('[object NodeList]' === elementsType) 17120 || ('[object HTMLCollection]' === elementsType) 17121 || ('[object Object]' === elementsType) 17122 || ('undefined' !== typeof jQuery && elements instanceof jQuery) //jquery 17123 || ('undefined' !== typeof Elements && elements instanceof Elements) //mootools 17124 ); 17125 var i = 0, j = elements.length; 17126 if (isCollectionTyped) { 17127 for (; i < j; i++) { 17128 callback(elements[i]); 17129 } 17130 } else { 17131 callback(elements); 17132 } 17133 } 17134 17135 /** 17136 * Get element size 17137 * @param {HTMLElement} element 17138 * @returns {Object} {width, height} 17139 */ 17140 function getElementSize(element) { 17141 if (!element.getBoundingClientRect) { 17142 return { 17143 width: element.offsetWidth, 17144 height: element.offsetHeight 17145 } 17146 } 17147 17148 var rect = element.getBoundingClientRect(); 17149 return { 17150 width: Math.round(rect.width), 17151 height: Math.round(rect.height) 17152 } 17153 } 17154 17155 /** 17156 * Apply CSS styles to element. 17157 * 17158 * @param {HTMLElement} element 17159 * @param {Object} style 17160 */ 17161 function setStyle(element, style) { 17162 Object.keys(style).forEach(function(key) { 17163 element.style[key] = style[key]; 17164 }); 17165 } 17166 17167 /** 17168 * Class for dimension change detection. 17169 * 17170 * @param {Element|Element[]|Elements|jQuery} element 17171 * @param {Function} callback 17172 * 17173 * @constructor 17174 */ 17175 var ResizeSensor = function(element, callback) { 17176 /** 17177 * 17178 * @constructor 17179 */ 17180 function EventQueue() { 17181 var q = []; 17182 this.add = function(ev) { 17183 q.push(ev); 17184 }; 17185 17186 var i, j; 17187 this.call = function(sizeInfo) { 17188 for (i = 0, j = q.length; i < j; i++) { 17189 q[i].call(this, sizeInfo); 17190 } 17191 }; 17192 17193 this.remove = function(ev) { 17194 var newQueue = []; 17195 for(i = 0, j = q.length; i < j; i++) { 17196 if(q[i] !== ev) newQueue.push(q[i]); 17197 } 17198 q = newQueue; 17199 }; 17200 17201 this.length = function() { 17202 return q.length; 17203 } 17204 } 17205 17206 /** 17207 * 17208 * @param {HTMLElement} element 17209 * @param {Function} resized 17210 */ 17211 function attachResizeEvent(element, resized) { 17212 if (!element) return; 17213 if (element.resizedAttached) { 17214 element.resizedAttached.add(resized); 17215 return; 17216 } 17217 17218 element.resizedAttached = new EventQueue(); 17219 element.resizedAttached.add(resized); 17220 17221 element.resizeSensor = document.createElement('div'); 17222 element.resizeSensor.dir = 'ltr'; 17223 element.resizeSensor.className = 'resize-sensor'; 17224 17225 var style = { 17226 pointerEvents: 'none', 17227 position: 'absolute', 17228 left: '0px', 17229 top: '0px', 17230 right: '0px', 17231 bottom: '0px', 17232 overflow: 'hidden', 17233 zIndex: '-1', 17234 visibility: 'hidden', 17235 maxWidth: '100%' 17236 }; 17237 var styleChild = { 17238 position: 'absolute', 17239 left: '0px', 17240 top: '0px', 17241 transition: '0s', 17242 }; 17243 17244 setStyle(element.resizeSensor, style); 17245 17246 var expand = document.createElement('div'); 17247 expand.className = 'resize-sensor-expand'; 17248 setStyle(expand, style); 17249 17250 var expandChild = document.createElement('div'); 17251 setStyle(expandChild, styleChild); 17252 expand.appendChild(expandChild); 17253 17254 var shrink = document.createElement('div'); 17255 shrink.className = 'resize-sensor-shrink'; 17256 setStyle(shrink, style); 17257 17258 var shrinkChild = document.createElement('div'); 17259 setStyle(shrinkChild, styleChild); 17260 setStyle(shrinkChild, { width: '200%', height: '200%' }); 17261 shrink.appendChild(shrinkChild); 17262 17263 element.resizeSensor.appendChild(expand); 17264 element.resizeSensor.appendChild(shrink); 17265 element.appendChild(element.resizeSensor); 17266 17267 var computedStyle = window.getComputedStyle(element); 17268 var position = computedStyle ? computedStyle.getPropertyValue('position') : null; 17269 if ('absolute' !== position && 'relative' !== position && 'fixed' !== position) { 17270 element.style.position = 'relative'; 17271 } 17272 17273 var dirty, rafId; 17274 var size = getElementSize(element); 17275 var lastWidth = 0; 17276 var lastHeight = 0; 17277 var initialHiddenCheck = true; 17278 var lastAnimationFrame = 0; 17279 17280 var resetExpandShrink = function () { 17281 var width = element.offsetWidth; 17282 var height = element.offsetHeight; 17283 17284 expandChild.style.width = (width + 10) + 'px'; 17285 expandChild.style.height = (height + 10) + 'px'; 17286 17287 expand.scrollLeft = width + 10; 17288 expand.scrollTop = height + 10; 17289 17290 shrink.scrollLeft = width + 10; 17291 shrink.scrollTop = height + 10; 17292 }; 17293 17294 var reset = function() { 17295 // Check if element is hidden 17296 if (initialHiddenCheck) { 17297 var invisible = element.offsetWidth === 0 && element.offsetHeight === 0; 17298 if (invisible) { 17299 // Check in next frame 17300 if (!lastAnimationFrame){ 17301 lastAnimationFrame = requestAnimationFrame(function(){ 17302 lastAnimationFrame = 0; 17303 17304 reset(); 17305 }); 17306 } 17307 17308 return; 17309 } else { 17310 // Stop checking 17311 initialHiddenCheck = false; 17312 } 17313 } 17314 17315 resetExpandShrink(); 17316 }; 17317 element.resizeSensor.resetSensor = reset; 17318 17319 var onResized = function() { 17320 rafId = 0; 17321 17322 if (!dirty) return; 17323 17324 lastWidth = size.width; 17325 lastHeight = size.height; 17326 17327 if (element.resizedAttached) { 17328 element.resizedAttached.call(size); 17329 } 17330 }; 17331 17332 var onScroll = function() { 17333 size = getElementSize(element); 17334 dirty = size.width !== lastWidth || size.height !== lastHeight; 17335
17336 if (dirty && !rafId) { 17337 rafId = requestAnimationFrame(onResized); 17338 } 17339 17340 reset(); 17341 }; 17342 17343 var addEvent = function(el, name, cb) { 17344 if (el.attachEvent) { 17345 el.attachEvent('on' + name, cb); 17346 } else { 17347 el.addEventListener(name, cb); 17348 } 17349 }; 17350 17351 addEvent(expand, 'scroll', onScroll); 17352 addEvent(shrink, 'scroll', onScroll); 17353 17354 // Fix for custom Elements 17355 requestAnimationFrame(reset); 17356 } 17357 17358 forEachElement(element, function(elem){ 17359 attachResizeEvent(elem, callback); 17360 }); 17361 17362 this.detach = function(ev) { 17363 ResizeSensor.detach(element, ev); 17364 }; 17365 17366 this.reset = function() { 17367 element.resizeSensor.resetSensor(); 17368 }; 17369 }; 17370 17371 ResizeSensor.reset = function(element) { 17372 forEachElement(element, function(elem){ 17373 elem.resizeSensor.resetSensor(); 17374 }); 17375 }; 17376 17377 ResizeSensor.detach = function(element, ev) { 17378 forEachElement(element, function(elem){ 17379 if (!elem) return; 17380 if(elem.resizedAttached && typeof ev === "function"){ 17381 elem.resizedAttached.remove(ev); 17382 if(elem.resizedAttached.length()) return; 17383 } 17384 if (elem.resizeSensor) { 17385 if (elem.contains(elem.resizeSensor)) { 17386 elem.removeChild(elem.resizeSensor); 17387 } 17388 delete elem.resizeSensor; 17389 delete elem.resizedAttached; 17390 } 17391 }); 17392 }; 17393 17394 if (typeof MutationObserver !== "undefined") { 17395 var observer = new MutationObserver(function (mutations) { 17396 for (var i in mutations) { 17397 if (mutations.hasOwnProperty(i)) { 17398 var items = mutations[i].addedNodes; 17399 for (var j = 0; j < items.length; j++) { 17400 if (items[j].resizeSensor) { 17401 ResizeSensor.reset(items[j]); 17402 } 17403 } 17404 } 17405 } 17406 }); 17407 17408 document.addEventListener("DOMContentLoaded", function (event) { 17409 observer.observe(document.body, { 17410 childList: true, 17411 subtree: true, 17412 }); 17413 }); 17414 } 17415 17416 return ResizeSensor; 17417 17418})); 17419; 17420var boundElements = []; 17421 17422async function setupTalkDeskWidget(styleSettings, emojiEnabled, attachmentsEnabled, customParams, getFlowIdOverride) { 17423 var tdFlowId = getFlowIdOverride ? getFlowIdOverride() : await GetFlowId(); 17424 var webchat; 17425 17426 ((window, document, node, props, configs) => { 17427 if (window.TalkdeskChatSDK) { 17428 console.error("TalkdeskChatSDKalready included"); 17429 return; 17430 } 17431 17432 if (document.location.href.indexOf("/palletquote") > -1 || document.location.href.indexOf("/quotes") > -1) { 17433 delete configs.styles['triggerButtonHeight']; 17434 delete configs.styles['triggerButtonPositionRight']; 17435 delete configs.styles['triggerButtonWidth']; 17436 delete configs.styles['chatHoverThemeColor']; 17437 } 17438 17439 var divContainer = document.createElement("div"); 17440 17441 divContainer.id = node; 17442 17443 document.body.appendChild(divContainer); 17444 17445 var src = 'https://talkdeskchatsdk.talkdeskapp.com/v2/talkdeskchatsdk.js'; 17446 17447 var script = document.createElement("script"); 17448 17449 var firstScriptTag = document.getElementsByTagName("script")[0]; 17450 17451 script.type = "text/javascript"; 17452 script.charset = "UTF-8"; 17453 script.id = "tdwebchatscript"; 17454 script.src = src; 17455 script.async = true; 17456 17457 firstScriptTag.parentNode.insertBefore(script, firstScriptTag); 17458 17459 script.onload = () => { 17460 17461 webchat = TalkdeskChatSDK(node, props); 17462 17463 webchat.init(configs); 17464 17465 customParams = getCustomParams(); 17466 17467 function setContext() { 17468 webchat.setContextParam(customParams); 17469 } 17470 17471 webchat.onConversationStart = function () { 17472 setContext(); 17473 } 17474 17475 webchat.onOpenWebchat = function () { 17476 setContext(); 17477 } 17478 17479 const observer = new MutationObserver(function (mutations) { 17480 mutations.forEach(function (mutation) { 17481 if (mutation.target.id == "talkdesk-chat-widget-trigger") {
17482 boundElements.forEach(function (element) { 17483 element.target.style.display = isVisible(mutation.target) ? element.availableDisplayStyle : element.chattingDisplayStyle; 17484 }); 17485 } 17486 }); 17487 }); 17488 17489 observer.observe(divContainer, { 17490 subtree: true, 17491 childList: true, 17492 attributes: true, 17493 attributeOldValue: true, 17494 }); 17495 }; 17496 17497 })( 17498 window, 17499 document, 17500 "tdWebchat", 17501 { 17502 touchpointId: 17503 tdFlowId, 17504 accountId: 17505 "", 17506 region: 17507 "td-eu-1" 17508 }, 17509 { 17510 enableEmoji: 17511 emojiEnabled, 17512 enableUserInput: 17513 true, 17514 enableAttachments: 17515 attachmentsEnabled, 17516 styles: 17517 styleSettings 17518 } 17519 ); 17520}; 17521 17522function isVisible(el) { 17523 if (!el) { 17524 return false; 17525 } 17526 const style = window.getComputedStyle(el); 17527 return style.display !== 'none' && style.visibility !== 'hidden'; 17528} 17529 17530function check_chat(elementToCheck, availableDisplayStyle, unavailableDisplayStyle, chattingDisplayStyle) { 17531 availableDisplayStyle = availableDisplayStyle || "block"; 17532 unavailableDisplayStyle = unavailableDisplayStyle || "none"; 17533 chattingDisplayStyle = chattingDisplayStyle || "none"; 17534 17535 elementToCheck.style.display = unavailableDisplayStyle; 17536 17537 boundElements.push({ target: elementToCheck, availableDisplayStyle, unavailableDisplayStyle, chattingDisplayStyle }); 17538} 17539function bindButtonToLiveChatFloatingButton(elementToReplace, elementStyleDisplay) { 17540 var elements = document.querySelectorAll(elementToReplace); 17541 for (var i = 0, len = elements.length; i < len; i++) { 17542 if (!!elements[i]) { 17543 elements[i].addEventListener("click", function () { 17544 var chat = document.getElementById("tdWebchat"); 17545 var chatTrigger = chat.querySelector("#talkdesk-chat-widget-trigger"); 17546 if (chatTrigger) { 17547 chatTrigger.click(); 17548 } 17549 }); 17550 } 17551 17552 waitForElement("#talkdesk-chat-widget-trigger", () => { 17553 check_chat(elements[i], elementStyleDisplay); 17554 }); 17555 } 17556} 17557 17558function waitForElement(selector, callback, timeout = 5000) { 17559 const startTime = Date.now(); 17560 const interval = setInterval(() => { 17561 const el = document.querySelector(selector); 17562 if (el) { 17563 clearInterval(interval); 17564 callback(); 17565 } else if (Date.now() - startTime > timeout) { 17566 clearInterval(interval); 17567 console.warn("Element not found:", selector); 17568 } 17569 }, 100); 17570} 17571 17572function bindToElement(selector, available, unavailable, chatting) { 17573 var elements = document.querySelectorAll(selector); 17574 for (var i = 0; i < elements.length; i++) { 17575 if (!!elements[i]) { 17576 check_chat(elements[i], available, unavailable, chatting); 17577 } 17578 } 17579} 17580 17581function getCustomParams() { 17582 var customParams = {}; 17583 customParams.is_vip = $('#boldChatOverride-VIP').length > 0; 17584 customParams.visitor_location = document.location.href; 17585 17586 if (window?.universal_variable?.user !== undefined) { 17587 customParams.name = window.universal_variable.user.name; 17588 customParams.email = window.universal_variable.user.email; 17589 customParams.billingPostcode = window.universal_variable.user.billingPostcode; 17590 } 17591 if (window?.universal_variable?.custom !== undefined) { 17592 customParams.customerSegment = window.universal_variable.custom.customersegment; 17593 customParams.vipStatus = window.universal_variable.custom.VIP_Status; 17594 } 17595 return customParams; 17596} 17597 17598async function GetFlowId() { 17599 var url = "/chat/get-talkdesk-flow-id"; 17600 if (document.location.href.indexOf(document.location.host + "/es/") > -1) { 17601 url = "/es" + url; 17602 } 17603 else if (document.location.href.indexOf(document.location.host + "/ie/") > -1) { 17604 url = "/ie" + url; 17605 } 17606 else if (document.location.href.indexOf(document.location.host + "/en-gb/") > -1) {
17607 url = "/en-gb" + url; 17608 } 17609 else if (document.location.href.indexOf(document.location.host + "/es-es/") > -1) { 17610 url = "/es-es" + url; 17611 } 17612 else if (document.location.href.indexOf(document.location.host + "/it-it/") > -1) { 17613 url = "/it-it" + url; 17614 } 17615 else if (document.location.href.indexOf(document.location.host + "/de-de/") > -1) { 17616 url = "/de-de" + url; 17617 } 17618 else if (document.location.href.indexOf(document.location.host + "/nl-nl/") > -1) { 17619 url = "/nl-nl" + url; 17620 } 17621 17622 const response = await fetch(url); 17623 return await response.json(); 17624}; 17625$(document).ready(async function () { 17626 17627 var enableEmoji = true; 17628 var enableAttachments = false; 17629 17630 var styleSettings = { 17631 'chatThemeColor': '#15537D', 17632 'chatTitle': 'Parcel2Go Help', 17633 'chatSubtitle': 'How can we help you today?', 17634 'chatSubtitleTextColor': '#ffffff', 17635 'chatPlaceholder': 'Please type a message...', 17636 'chatHoverThemeColor': 'transparent', 17637 'chatHeaderBackgroundColor': '#15537D', 17638 'chatTitleTextColor': '#ffffff', 17639 'chatCloseButtonColor': '#ffffff', 17640 'chatLauncherColor': '#15537D', 17641 'userBackgroundColor': '#15537D', 17642 'userTextColor': '#ffffff',
17643 'botBackgroundColor': '#F2F4F5', 17644 'botTextColor': '#4a4a4a', 17645 'botAnchorTextColor': '#15537d', 17646 'botAnchorTextColorVisited': '#15537d', 17647 'triggerButtonHeight': '0px', 17648 'triggerButtonWidth': '0px', 17649 'triggerButtonPositionRight': '-100px', 17650 'userAnchorTextColor': '#ffffff', 17651 'userAnchorTextColorVisited': '#15537d', 17652 'avatarBackgroundColor': '#15537D', 17653 'avatarForegroundColor': '#ffffff', 17654 'avatarBorderColor': '#15537D', 17655 'chatConfirmButtonBackgroundColor': '#15537D', 17656 'chatConfirmButtonFontColor': '#ffffff', 17657 'chatCancelButtonFontColor': '#000000', 17658 'welcomeMessageBackgroundColor': '#F2F4F5', 17659 'welcomeMessageTitleColor': '#000000', 17660 'welcomeMessageContentColor': '#000000' 17661 } 17662 17663 await setupTalkDeskWidget(styleSettings, enableEmoji, enableAttachments); 17664});;
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.