vendor: 4,489 bytes, lines 1-135
1/******/ (function(modules) { // webpackBootstrap 2/******/ // The module cache 3/******/ var installedModules = {}; 4/******/ 5/******/ // The require function 6/******/ function __webpack_require__(moduleId) { 7/******/ 8/******/ // Check if module is in cache 9/******/ if(installedModules[moduleId]) { 10/******/ return installedModules[moduleId].exports; 11/******/ } 12/******/ // Create a new module (and put it into the cache) 13/******/ var module = installedModules[moduleId] = { 14/******/ i: moduleId, 15/******/ l: false, 16/******/ exports: {} 17/******/ }; 18/******/ 19/******/ // Execute the module function 20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21/******/ 22/******/ // Flag the module as loaded 23/******/ module.l = true; 24/******/ 25/******/ // Return the exports of the module 26/******/ return module.exports; 27/******/ } 28/******/ 29/******/ 30/******/ // expose the modules object (__webpack_modules__) 31/******/ __webpack_require__.m = modules; 32/******/ 33/******/ // expose the module cache 34/******/ __webpack_require__.c = installedModules; 35/******/ 36/******/ // define getter function for harmony exports 37/******/ __webpack_require__.d = function(exports, name, getter) { 38/******/ if(!__webpack_require__.o(exports, name)) { 39/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); 40/******/ } 41/******/ }; 42/******/ 43/******/ // define __esModule on exports 44/******/ __webpack_require__.r = function(exports) { 45/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 46/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 47/******/ } 48/******/ Object.defineProperty(exports, '__esModule', { value: true }); 49/******/ }; 50/******/ 51/******/ // create a fake namespace object 52/******/ // mode & 1: value is a module id, require it 53/******/ // mode & 2: merge all properties of value into the ns 54/******/ // mode & 4: return value when already ns object 55/******/ // mode & 8|1: behave like require 56/******/ __webpack_require__.t = function(value, mode) { 57/******/ if(mode & 1) value = __webpack_require__(value); 58/******/ if(mode & 8) return value; 59/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; 60/******/ var ns = Object.create(null); 61/******/ __webpack_require__.r(ns); 62/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); 63/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); 64/******/ return ns; 65/******/ }; 66/******/ 67/******/ // getDefaultExport function for compatibility with non-harmony modules 68/******/ __webpack_require__.n = function(module) { 69/******/ var getter = module && module.__esModule ? 70/******/ function getDefault() { return module['default']; } : 71/******/ function getModuleExports() { return module; }; 72/******/ __webpack_require__.d(getter, 'a', getter); 73/******/ return getter; 74/******/ }; 75/******/ 76/******/ // Object.prototype.hasOwnProperty.call 77/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 78/******/ 79/******/ // __webpack_public_path__ 80/******/ __webpack_require__.p = ""; 81/******/ 82/******/ 83/******/ // Load entry module and return exports 84/******/ return __webpack_require__(__webpack_require__.s = 274); 85/******/ }) 86/************************************************************************/ 87/******/ ({ 88 89/***/ 11: 90/***/ (function(module, exports, __webpack_require__) { 91 92"use strict"; 93 94 95module.exports = function (element) { 96 var position = element && element.length ? element.offset().top : 0; 97 $('html, body').animate({ 98 scrollTop: position 99 }, 500); 100 if (!element) { 101 $('.logo-home').focus(); 102 } 103}; 104 105 106/***/ }), 107 108/***/ 20: 109/***/ (function(module, exports) { 110 111var g; 112 113// This works in non-strict mode 114g = (function() { 115 return this; 116})(); 117 118try { 119 // This works if eval is allowed (see CSP) 120 g = g || new Function("return this")(); 121} catch (e) { 122 // This works if the window reference is available 123 if (typeof window === "object") g = window; 124} 125 126// g can still be undefined, but nothing to do about it... 127// We return undefined, instead of nothing here, so it's 128// easier to handle this case. if(!global) { ...} 129 130module.exports = g; 131 132 133/***/ }), 134 135/***/ 258:
136/***/ (function(module, exports) { 137 138$('.countryDropdown .dropdown-item').click(function () { 139 var redirectUrl = $(this).attr('href'); 140 $('.continueRedirection a.btn-success').click(function () { 141 window.open(redirectUrl, '_blank'); 142 143 $('.continueRedirection a.btn-success').unbind().click(function () { 144 redirectUrl = undefined; 145 }); 146 }); 147}); 148 149 150/***/ }), 151 152/***/ 264: 153/***/ (function(module, exports) { 154 155/* eslint-disable no-undef */ 156$('.nav-item.dropdown').hover(function () { 157 if ($(this).find('.dropdown-menu')) { 158 var TimeInterval = setInterval(() => { 159 $('.nav-item.dropdown.show').children('.menu-bg').addClass('nav-menu-bg'); 160 $('.nav-menu-bg').css('display', 'block'); 161 var widthMenu = $(this).children('.dropdown-menu.show').innerWidth(); 162 var heightMenu = $(this).children('.dropdown-menu.show').outerHeight(); 163 if ($(this).children('.dropdown-menu.level-2').hasClass('show')) { 164 widthMenu += $('.dropdown-menu.level-2.show').innerWidth(); 165 if ($('.dropdown-menu.level-2.show').nextAll().length > 0) { 166 widthMenu += $('.dropdown-menu.level-2.show').next().innerWidth(); 167 } 168 } 169 170 $('.nav-menu-bg').width(widthMenu); 171 $('.nav-menu-bg').height(heightMenu); 172 if ($(this).children('.dropdown-menu').hasClass('show')) { 173 clearInterval(TimeInterval); 174 } 175 }, 100); 176 if (TimeInterval) { 177 setTimeout(function () { 178 clearInterval(TimeInterval); 179 }, 400); 180 } 181 } 182}, function () { 183 $('.menu-bg').removeClass('nav-menu-bg'); 184 $('.menu-bg').css('width', 'unset'); 185 $('.menu-bg').css('height', 'unset'); 186}); 187 188$('.dropdown-item.dropdown').hover(function() { 189 $('.nav-menu-bg').height($('.nav-item.dropdown').children('.dropdown-menu.show').outerHeight()); 190}, function () { 191 $('.nav-menu-bg').height($('.nav-item.dropdown').children('.dropdown-menu.show').outerHeight()); 192}); 193 194/***/ }), 195 196/***/ 270: 197/***/ (function(module, exports) { 198 199document.addEventListener("DOMContentLoaded", function() { 200 var lazyloadThrottleTimeout; 201 window.lazyload = function(lazyImages) { 202 203 if(lazyloadThrottleTimeout) { 204 clearTimeout(lazyloadThrottleTimeout); 205 } 206 207 lazyloadThrottleTimeout = setTimeout(function() { 208 209 Array.from(lazyImages).forEach(function(img) { 210 img.src = img.dataset.src; 211 img.classList.remove('lazy'); 212 }); 213 if(lazyImages.length == 0) { 214 document.removeEventListener("scroll", lazyload); 215 window.removeEventListener("resize", lazyload); 216 window.removeEventListener("orientationChange", lazyload); 217 } 218 }, 20); 219 } 220 221 // $(document).ready(function() { 222 // var lazyloadImages = document.querySelectorAll("img.lazy"); 223 // window.lazyload(lazyloadImages); 224 // }) 225 document.addEventListener("scroll", lazyload); 226 window.addEventListener("resize", lazyload); 227 window.addEventListener("orientationChange", lazyload); 228}); 229 230/***/ }), 231 232/***/ 274: 233/***/ (function(module, exports, __webpack_require__) { 234 235window.jQuery = window.$ = __webpack_require__(275); 236var processInclude = __webpack_require__(3); 237$(document).ready(function () { 238 processInclude(__webpack_require__(276)); 239 processInclude(__webpack_require__(278)); 240 processInclude(__webpack_require__(279));
241 processInclude(__webpack_require__(280)); 242 processInclude(__webpack_require__(281)); 243 processInclude(__webpack_require__(282)); 244 processInclude(__webpack_require__(283)); 245 processInclude(__webpack_require__(284)); 246 processInclude(__webpack_require__(299)); 247 processInclude(__webpack_require__(300)); 248 processInclude(__webpack_require__(308)); 249 processInclude(__webpack_require__(309)); 250 processInclude(__webpack_require__(310)); 251 processInclude(__webpack_require__(258)); 252 processInclude(__webpack_require__(264)); 253 processInclude(__webpack_require__(318)); 254}); 255__webpack_require__(270); 256__webpack_require__(319); 257__webpack_require__(320); 258__webpack_require__(321); 259 260 261/***/ }), 262 263/***/ 275: 264/***/ (function(module, exports, __webpack_require__) { 265 266var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 267 * jQuery JavaScript Library v3.7.1 268 * https://jquery.com/ 269 * 270 * Copyright OpenJS Foundation and other contributors 271 * Released under the MIT license 272 * https://jquery.org/license 273 * 274 * Date: 2023-08-28T13:37Z 275 */ 276( function( global, factory ) { 277 278 "use strict"; 279 280 if ( true
vendor: 87,358 bytes, lines 280-3493
280 && typeof module.exports === "object" ) { 281 282 // For CommonJS and CommonJS-like environments where a proper `window` 283 // is present, execute the factory and get jQuery. 284 // For environments that do not have a `window` with a `document` 285 // (such as Node.js), expose a factory as module.exports. 286 // This accentuates the need for the creation of a real `window`. 287 // e.g. var jQuery = require("jquery")(window); 288 // See ticket trac-14549 for more info. 289 module.exports = global.document ? 290 factory( global, true ) : 291 function( w ) { 292 if ( !w.document ) { 293 throw new Error( "jQuery requires a window with a document" ); 294 } 295 return factory( w ); 296 }; 297 } else { 298 factory( global ); 299 } 300 301// Pass this if window is not defined yet 302} )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 303 304// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1 305// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode 306// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common 307// enough that all such attempts are guarded in a try block. 308"use strict"; 309 310var arr = []; 311 312var getProto = Object.getPrototypeOf; 313 314var slice = arr.slice; 315 316var flat = arr.flat ? function( array ) { 317 return arr.flat.call( array ); 318} : function( array ) { 319 return arr.concat.apply( [], array ); 320}; 321 322 323var push = arr.push; 324 325var indexOf = arr.indexOf; 326 327var class2type = {}; 328 329var toString = class2type.toString; 330 331var hasOwn = class2type.hasOwnProperty; 332 333var fnToString = hasOwn.toString; 334 335var ObjectFunctionString = fnToString.call( Object ); 336 337var support = {}; 338 339var isFunction = function isFunction( obj ) { 340 341 // Support: Chrome <=57, Firefox <=52 342 // In some browsers, typeof returns "function" for HTML <object> elements 343 // (i.e., `typeof document.createElement( "object" ) === "function"`). 344 // We don't want to classify *any* DOM node as a function. 345 // Support: QtWeb <=3.8.5, WebKit <=534.34, wkhtmltopdf tool <=0.12.5 346 // Plus for old WebKit, typeof returns "function" for HTML collections 347 // (e.g., `typeof document.getElementsByTagName("div") === "function"`). (gh-4756) 348 return typeof obj === "function" && typeof obj.nodeType !== "number" && 349 typeof obj.item !== "function"; 350 }; 351 352 353var isWindow = function isWindow( obj ) { 354 return obj != null && obj === obj.window; 355 }; 356 357 358var document = window.document; 359 360 361 362 var preservedScriptAttributes = { 363 type: true, 364 src: true, 365 nonce: true, 366 noModule: true 367 }; 368 369 function DOMEval( code, node, doc ) { 370 doc = doc || document; 371 372 var i, val, 373 script = doc.createElement( "script" ); 374 375 script.text = code; 376 if ( node ) { 377 for ( i in preservedScriptAttributes ) { 378 379 // Support: Firefox 64+, Edge 18+ 380 // Some browsers don't support the "nonce" property on scripts. 381 // On the other hand, just using `getAttribute` is not enough as 382 // the `nonce` attribute is reset to an empty string whenever it 383 // becomes browsing-context connected. 384 // See https://github.com/whatwg/html/issues/2369 385 // See https://html.spec.whatwg.org/#nonce-attributes 386 // The `node.getAttribute` check was added for the sake of 387 // `jQuery.globalEval` so that it can fake a nonce-containing node 388 // via an object. 389 val = node[ i ] || node.getAttribute && node.getAttribute( i ); 390 if ( val ) { 391 script.setAttribute( i, val ); 392 } 393 } 394 } 395 doc.head.appendChild( script ).parentNode.removeChild( script ); 396 } 397 398 399function toType( obj ) { 400 if ( obj == null ) { 401 return obj + ""; 402 } 403 404 // Support: Android <=2.3 only (functionish RegExp) 405 return typeof obj === "object" || typeof obj === "function" ? 406 class2type[ toString.call( obj ) ] || "object" : 407 typeof obj; 408} 409/* global Symbol */ 410// Defining this global in .eslintrc.json would create a danger of using the global 411// unguarded in another place, it seems safer to define global only for this module 412 413 414 415var version = "3.7.1", 416 417 rhtmlSuffix = /HTML$/i, 418 419 // Define a local copy of jQuery 420 jQuery = function( selector, context ) { 421 422 // The jQuery object is actually just the init constructor 'enhanced' 423 // Need init if jQuery is called (just allow error to be thrown if not included) 424 return new jQuery.fn.init( selector, context ); 425 }; 426 427jQuery.fn = jQuery.prototype = { 428 429 // The current version of jQuery being used 430 jquery: version, 431 432 constructor: jQuery, 433 434 // The default length of a jQuery object is 0 435 length: 0, 436 437 toArray: function() { 438 return slice.call( this ); 439 }, 440 441 // Get the Nth element in the matched element set OR 442 // Get the whole matched element set as a clean array 443 get: function( num ) { 444 445 // Return all the elements in a clean array 446 if ( num == null ) { 447 return slice.call( this ); 448 } 449 450 // Return just the one element from the set 451 return num < 0 ? this[ num + this.length ] : this[ num ]; 452 }, 453 454 // Take an array of elements and push it onto the stack 455 // (returning the new matched element set) 456 pushStack: function( elems ) { 457 458 // Build a new jQuery matched element set 459 var ret = jQuery.merge( this.constructor(), elems ); 460 461 // Add the old object onto the stack (as a reference) 462 ret.prevObject = this; 463 464 // Return the newly-formed element set 465 return ret; 466 }, 467 468 // Execute a callback for every element in the matched set. 469 each: function( callback ) { 470 return jQuery.each( this, callback ); 471 }, 472 473 map: function( callback ) { 474 return this.pushStack( jQuery.map( this, function( elem, i ) { 475 return callback.call( elem, i, elem ); 476 } ) ); 477 }, 478 479 slice: function() { 480 return this.pushStack( slice.apply( this, arguments ) ); 481 }, 482 483 first: function() { 484 return this.eq( 0 ); 485 }, 486 487 last: function() { 488 return this.eq( -1 ); 489 }, 490 491 even: function() { 492 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 493 return ( i + 1 ) % 2; 494 } ) ); 495 }, 496 497 odd: function() { 498 return this.pushStack( jQuery.grep( this, function( _elem, i ) { 499 return i % 2; 500 } ) ); 501 }, 502 503 eq: function( i ) { 504 var len = this.length, 505 j = +i + ( i < 0 ? len : 0 ); 506 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 507 }, 508 509 end: function() { 510 return this.prevObject || this.constructor(); 511 }, 512 513 // For internal use only. 514 // Behaves like an Array's method, not like a jQuery method. 515 push: push, 516 sort: arr.sort, 517 splice: arr.splice 518}; 519 520jQuery.extend = jQuery.fn.extend = function() { 521 var options, name, src, copy, copyIsArray, clone, 522 target = arguments[ 0 ] || {}, 523 i = 1, 524 length = arguments.length, 525 deep = false; 526 527 // Handle a deep copy situation 528 if ( typeof target === "boolean" ) { 529 deep = target; 530 531 // Skip the boolean and the target 532 target = arguments[ i ] || {}; 533 i++; 534 } 535 536 // Handle case when target is a string or something (possible in deep copy) 537 if ( typeof target !== "object" && !isFunction( target ) ) { 538 target = {}; 539 } 540 541 // Extend jQuery itself if only one argument is passed 542 if ( i === length ) { 543 target = this; 544 i--; 545 } 546 547 for ( ; i < length; i++ ) { 548 549 // Only deal with non-null/undefined values 550 if ( ( options = arguments[ i ] ) != null ) { 551 552 // Extend the base object 553 for ( name in options ) { 554 copy = options[ name ]; 555 556 // Prevent Object.prototype pollution 557 // Prevent never-ending loop 558 if ( name === "__proto__" || target === copy ) { 559 continue; 560 } 561 562 // Recurse if we're merging plain objects or arrays 563 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 564 ( copyIsArray = Array.isArray( copy ) ) ) ) { 565 src = target[ name ]; 566 567 // Ensure proper type for the source value 568 if ( copyIsArray && !Array.isArray( src ) ) { 569 clone = []; 570 } else if ( !copyIsArray && !jQuery.isPlainObject( src ) ) { 571 clone = {}; 572 } else { 573 clone = src; 574 } 575 copyIsArray = false; 576 577 // Never move original objects, clone them 578 target[ name ] = jQuery.extend( deep, clone, copy ); 579 580 // Don't bring in undefined values 581 } else if ( copy !== undefined ) { 582 target[ name ] = copy; 583 } 584 } 585 } 586 } 587 588 // Return the modified object 589 return target; 590}; 591 592jQuery.extend( { 593 594 // Unique for each copy of jQuery on the page 595 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 596 597 // Assume jQuery is ready without the ready module 598 isReady: true, 599 600 error: function( msg ) { 601 throw new Error( msg ); 602 }, 603 604 noop: function() {}, 605 606 isPlainObject: function( obj ) { 607 var proto, Ctor; 608 609 // Detect obvious negatives 610 // Use toString instead of jQuery.type to catch host objects 611 if ( !obj || toString.call( obj ) !== "[object Object]" ) { 612 return false; 613 } 614 615 proto = getProto( obj ); 616 617 // Objects with no prototype (e.g., `Object.create( null )`) are plain 618 if ( !proto ) { 619 return true; 620 } 621 622 // Objects with prototype are plain iff they were constructed by a global Object function 623 Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor; 624 return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString; 625 }, 626 627 isEmptyObject: function( obj ) { 628 var name; 629 630 for ( name in obj ) { 631 return false; 632 } 633 return true; 634 }, 635 636 // Evaluates a script in a provided context; falls back to the global one 637 // if not specified. 638 globalEval: function( code, options, doc ) { 639 DOMEval( code, { nonce: options && options.nonce }, doc ); 640 }, 641 642 each: function( obj, callback ) { 643 var length, i = 0; 644 645 if ( isArrayLike( obj ) ) { 646 length = obj.length; 647 for ( ; i < length; i++ ) { 648 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 649 break; 650 } 651 } 652 } else { 653 for ( i in obj ) { 654 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 655 break; 656 } 657 } 658 } 659 660 return obj; 661 }, 662 663 664 // Retrieve the text value of an array of DOM nodes 665 text: function( elem ) { 666 var node, 667 ret = "", 668 i = 0, 669 nodeType = elem.nodeType; 670 671 if ( !nodeType ) { 672 673 // If no nodeType, this is expected to be an array 674 while ( ( node = elem[ i++ ] ) ) { 675 676 // Do not traverse comment nodes 677 ret += jQuery.text( node ); 678 } 679 } 680 if ( nodeType === 1 || nodeType === 11 ) { 681 return elem.textContent; 682 } 683 if ( nodeType === 9 ) { 684 return elem.documentElement.textContent; 685 } 686 if ( nodeType === 3 || nodeType === 4 ) { 687 return elem.nodeValue; 688 } 689 690 // Do not include comment or processing instruction nodes 691 692 return ret; 693 }, 694 695 // results is for internal usage only 696 makeArray: function( arr, results ) { 697 var ret = results || []; 698 699 if ( arr != null ) { 700 if ( isArrayLike( Object( arr ) ) ) { 701 jQuery.merge( ret, 702 typeof arr === "string" ? 703 [ arr ] : arr 704 ); 705 } else { 706 push.call( ret, arr ); 707 } 708 } 709 710 return ret; 711 }, 712 713 inArray: function( elem, arr, i ) { 714 return arr == null ? -1 : indexOf.call( arr, elem, i ); 715 }, 716 717 isXMLDoc: function( elem ) { 718 var namespace = elem && elem.namespaceURI, 719 docElem = elem && ( elem.ownerDocument || elem ).documentElement; 720 721 // Assume HTML when documentElement doesn't yet exist, such as inside 722 // document fragments. 723 return !rhtmlSuffix.test( namespace || docElem && docElem.nodeName || "HTML" ); 724 }, 725 726 // Support: Android <=4.0 only, PhantomJS 1 only 727 // push.apply(_, arraylike) throws on ancient WebKit 728 merge: function( first, second ) { 729 var len = +second.length, 730 j = 0, 731 i = first.length; 732 733 for ( ; j < len; j++ ) { 734 first[ i++ ] = second[ j ]; 735 } 736 737 first.length = i; 738 739 return first; 740 }, 741 742 grep: function( elems, callback, invert ) { 743 var callbackInverse, 744 matches = [], 745 i = 0, 746 length = elems.length, 747 callbackExpect = !invert; 748 749 // Go through the array, only saving the items 750 // that pass the validator function 751 for ( ; i < length; i++ ) { 752 callbackInverse = !callback( elems[ i ], i ); 753 if ( callbackInverse !== callbackExpect ) { 754 matches.push( elems[ i ] ); 755 } 756 } 757 758 return matches; 759 }, 760 761 // arg is for internal usage only 762 map: function( elems, callback, arg ) { 763 var length, value, 764 i = 0, 765 ret = []; 766 767 // Go through the array, translating each of the items to their new values 768 if ( isArrayLike( elems ) ) { 769 length = elems.length; 770 for ( ; i < length; i++ ) { 771 value = callback( elems[ i ], i, arg ); 772 773 if ( value != null ) { 774 ret.push( value ); 775 } 776 } 777 778 // Go through every key on the object, 779 } else { 780 for ( i in elems ) { 781 value = callback( elems[ i ], i, arg ); 782 783 if ( value != null ) { 784 ret.push( value ); 785 } 786 } 787 } 788 789 // Flatten any nested arrays 790 return flat( ret ); 791 }, 792 793 // A global GUID counter for objects 794 guid: 1, 795 796 // jQuery.support is not used in Core but other projects attach their 797 // properties to it so it needs to exist. 798 support: support 799} ); 800 801if ( typeof Symbol === "function" ) { 802 jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ]; 803} 804 805// Populate the class2type map 806jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 807 function( _i, name ) { 808 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 809 } ); 810 811function isArrayLike( obj ) { 812 813 // Support: real iOS 8.2 only (not reproducible in simulator) 814 // `in` check used to prevent JIT error (gh-2145) 815 // hasOwn isn't used here due to false negatives 816 // regarding Nodelist length in IE 817 var length = !!obj && "length" in obj && obj.length, 818 type = toType( obj ); 819 820 if ( isFunction( obj ) || isWindow( obj ) ) { 821 return false; 822 } 823 824 return type === "array" || length === 0 || 825 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 826} 827 828 829function nodeName( elem, name ) { 830 831 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 832 833} 834var pop = arr.pop; 835 836 837var sort = arr.sort; 838 839 840var splice = arr.splice; 841 842 843var whitespace = "[\\x20\\t\\r\\n\\f]"; 844 845 846var rtrimCSS = new RegExp( 847 "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", 848 "g" 849); 850 851 852 853 854// Note: an element does not contain itself 855jQuery.contains = function( a, b ) { 856 var bup = b && b.parentNode; 857 858 return a === bup || !!( bup && bup.nodeType === 1 && ( 859 860 // Support: IE 9 - 11+ 861 // IE doesn't have `contains` on SVG. 862 a.contains ? 863 a.contains( bup ) : 864 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 865 ) ); 866}; 867 868 869 870 871// CSS string/identifier serialization 872// https://drafts.csswg.org/cssom/#common-serializing-idioms 873var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g; 874 875function fcssescape( ch, asCodePoint ) { 876 if ( asCodePoint ) { 877 878 // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER 879 if ( ch === "\0" ) { 880 return "\uFFFD"; 881 } 882 883 // Control characters and (dependent upon position) numbers get escaped as code points 884 return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " "; 885 } 886 887 // Other potentially-special ASCII characters get backslash-escaped 888 return "\\" + ch; 889} 890 891jQuery.escapeSelector = function( sel ) { 892 return ( sel + "" ).replace( rcssescape, fcssescape ); 893}; 894 895 896 897 898var preferredDoc = document, 899 pushNative = push; 900 901( function() { 902 903var i, 904 Expr, 905 outermostContext, 906 sortInput, 907 hasDuplicate, 908 push = pushNative, 909 910 // Local document vars 911 document, 912 documentElement, 913 documentIsHTML, 914 rbuggyQSA, 915 matches, 916 917 // Instance-specific data 918 expando = jQuery.expando, 919 dirruns = 0, 920 done = 0, 921 classCache = createCache(), 922 tokenCache = createCache(), 923 compilerCache = createCache(), 924 nonnativeSelectorCache = createCache(), 925 sortOrder = function( a, b ) { 926 if ( a === b ) { 927 hasDuplicate = true; 928 } 929 return 0; 930 }, 931 932 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|" + 933 "loop|multiple|open|readonly|required|scoped", 934 935 // Regular expressions 936 937 // https://www.w3.org/TR/css-syntax-3/#ident-token-diagram 938 identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + 939 "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", 940 941 // Attribute selectors: https://www.w3.org/TR/selectors/#attribute-selectors 942 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 943 944 // Operator (capture 2) 945 "*([*^$|!~]?=)" + whitespace + 946 947 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 948 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + 949 whitespace + "*\\]", 950 951 pseudos = ":(" + identifier + ")(?:\\((" + 952 953 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 954 // 1. quoted (capture 3; capture 4 or capture 5) 955 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 956 957 // 2. simple (capture 6) 958 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 959 960 // 3. anything else (capture 2) 961 ".*" + 962 ")\\)|)", 963 964 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 965 rwhitespace = new RegExp( whitespace + "+", "g" ), 966 967 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 968 rleadingCombinator = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + 969 whitespace + "*" ), 970 rdescend = new RegExp( whitespace + "|>" ), 971 972 rpseudo = new RegExp( pseudos ), 973 ridentifier = new RegExp( "^" + identifier + "$" ), 974 975 matchExpr = { 976 ID: new RegExp( "^#(" + identifier + ")" ), 977 CLASS: new RegExp( "^\\.(" + identifier + ")" ), 978 TAG: new RegExp( "^(" + identifier + "|[*])" ), 979 ATTR: new RegExp( "^" + attributes ), 980 PSEUDO: new RegExp( "^" + pseudos ), 981 CHILD: new RegExp( 982 "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + 983 whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + 984 whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 985 bool: new RegExp( "^(?:" + booleans + ")$", "i" ), 986 987 // For use in libraries implementing .is() 988 // We use this for POS matching in `select` 989 needsContext: new RegExp( "^" + whitespace + 990 "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + 991 "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 992 }, 993 994 rinputs = /^(?:input|select|textarea|button)$/i, 995 rheader = /^h\d$/i, 996 997 // Easily-parseable/retrievable ID or TAG or CLASS selectors 998 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 999 1000 rsibling = /[+~]/, 1001 1002 // CSS escapes 1003 // https://www.w3.org/TR/CSS21/syndata.html#escaped-characters 1004 runescape = new RegExp( "\\\\[\\da-fA-F]{1,6}" + whitespace + 1005 "?|\\\\([^\\r\\n\\f])", "g" ), 1006 funescape = function( escape, nonHex ) { 1007 var high = "0x" + escape.slice( 1 ) - 0x10000; 1008 1009 if ( nonHex ) { 1010 1011 // Strip the backslash prefix from a non-hex escape sequence 1012 return nonHex; 1013 } 1014 1015 // Replace a hexadecimal escape sequence with the encoded Unicode code point 1016 // Support: IE <=11+ 1017 // For values outside the Basic Multilingual Plane (BMP), manually construct a 1018 // surrogate pair 1019 return high < 0 ? 1020 String.fromCharCode( high + 0x10000 ) : 1021 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 1022 }, 1023 1024 // Used for iframes; see `setDocument`. 1025 // Support: IE 9 - 11+, Edge 12 - 18+ 1026 // Removing the function wrapper causes a "Permission Denied" 1027 // error in IE/Edge. 1028 unloadHandler = function() { 1029 setDocument(); 1030 }, 1031 1032 inDisabledFieldset = addCombinator( 1033 function( elem ) { 1034 return elem.disabled === true && nodeName( elem, "fieldset" ); 1035 }, 1036 { dir: "parentNode", next: "legend" } 1037 ); 1038 1039// Support: IE <=9 only 1040// Accessing document.activeElement can throw unexpectedly 1041// https://bugs.jquery.com/ticket/13393 1042function safeActiveElement() { 1043 try { 1044 return document.activeElement; 1045 } catch ( err ) { } 1046} 1047 1048// Optimize for push.apply( _, NodeList ) 1049try { 1050 push.apply( 1051 ( arr = slice.call( preferredDoc.childNodes ) ), 1052 preferredDoc.childNodes 1053 ); 1054 1055 // Support: Android <=4.0 1056 // Detect silently failing push.apply 1057 // eslint-disable-next-line no-unused-expressions 1058 arr[ preferredDoc.childNodes.length ].nodeType; 1059} catch ( e ) { 1060 push = { 1061 apply: function( target, els ) { 1062 pushNative.apply( target, slice.call( els ) ); 1063 }, 1064 call: function( target ) { 1065 pushNative.apply( target, slice.call( arguments, 1 ) ); 1066 } 1067 }; 1068} 1069 1070function find( selector, context, results, seed ) { 1071 var m, i, elem, nid, match, groups, newSelector, 1072 newContext = context && context.ownerDocument, 1073 1074 // nodeType defaults to 9, since context defaults to document 1075 nodeType = context ? context.nodeType : 9; 1076 1077 results = results || []; 1078 1079 // Return early from calls with invalid selector or context 1080 if ( typeof selector !== "string" || !selector || 1081 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 1082 1083 return results; 1084 } 1085 1086 // Try to shortcut find operations (as opposed to filters) in HTML documents 1087 if ( !seed ) { 1088 setDocument( context ); 1089 context = context || document; 1090 1091 if ( documentIsHTML ) { 1092 1093 // If the selector is sufficiently simple, try using a "get*By*" DOM method 1094 // (excepting DocumentFragment context, where the methods don't exist) 1095 if ( nodeType !== 11 && ( match = rquickExpr.exec( selector ) ) ) { 1096 1097 // ID selector 1098 if ( ( m = match[ 1 ] ) ) { 1099 1100 // Document context 1101 if ( nodeType === 9 ) { 1102 if ( ( elem = context.getElementById( m ) ) ) { 1103 1104 // Support: IE 9 only 1105 // getElementById can match elements by name instead of ID 1106 if ( elem.id === m ) { 1107 push.call( results, elem ); 1108 return results; 1109 } 1110 } else { 1111 return results; 1112 } 1113 1114 // Element context 1115 } else { 1116 1117 // Support: IE 9 only 1118 // getElementById can match elements by name instead of ID 1119 if ( newContext && ( elem = newContext.getElementById( m ) ) && 1120 find.contains( context, elem ) && 1121 elem.id === m ) { 1122 1123 push.call( results, elem ); 1124 return results; 1125 } 1126 } 1127 1128 // Type selector 1129 } else if ( match[ 2 ] ) { 1130 push.apply( results, context.getElementsByTagName( selector ) ); 1131 return results; 1132 1133 // Class selector 1134 } else if ( ( m = match[ 3 ] ) && context.getElementsByClassName ) { 1135 push.apply( results, context.getElementsByClassName( m ) ); 1136 return results; 1137 } 1138 } 1139 1140 // Take advantage of querySelectorAll 1141 if ( !nonnativeSelectorCache[ selector + " " ] && 1142 ( !rbuggyQSA || !rbuggyQSA.test( selector ) ) ) { 1143 1144 newSelector = selector; 1145 newContext = context; 1146 1147 // qSA considers elements outside a scoping root when evaluating child or 1148 // descendant combinators, which is not what we want. 1149 // In such cases, we work around the behavior by prefixing every selector in the 1150 // list with an ID selector referencing the scope context. 1151 // The technique has to be used as well when a leading combinator is used 1152 // as such selectors are not recognized by querySelectorAll. 1153 // Thanks to Andrew Dupont for this technique. 1154 if ( nodeType === 1 && 1155 ( rdescend.test( selector ) || rleadingCombinator.test( selector ) ) ) { 1156 1157 // Expand context for sibling selectors 1158 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 1159 context; 1160 1161 // We can use :scope instead of the ID hack if the browser 1162 // supports it & if we're not changing the context. 1163 // Support: IE 11+, Edge 17 - 18+ 1164 // IE/Edge sometimes throw a "Permission denied" error when 1165 // strict-comparing two documents; shallow comparisons work. 1166 // eslint-disable-next-line eqeqeq 1167 if ( newContext != context || !support.scope ) { 1168 1169 // Capture the context ID, setting it first if necessary 1170 if ( ( nid = context.getAttribute( "id" ) ) ) { 1171 nid = jQuery.escapeSelector( nid ); 1172 } else { 1173 context.setAttribute( "id", ( nid = expando ) ); 1174 } 1175 } 1176 1177 // Prefix every selector in the list 1178 groups = tokenize( selector ); 1179 i = groups.length; 1180 while ( i-- ) { 1181 groups[ i ] = ( nid ? "#" + nid : ":scope" ) + " " + 1182 toSelector( groups[ i ] ); 1183 } 1184 newSelector = groups.join( "," ); 1185 } 1186 1187 try { 1188 push.apply( results, 1189 newContext.querySelectorAll( newSelector ) 1190 ); 1191 return results; 1192 } catch ( qsaError ) { 1193 nonnativeSelectorCache( selector, true ); 1194 } finally { 1195 if ( nid === expando ) { 1196 context.removeAttribute( "id" ); 1197 } 1198 } 1199 } 1200 } 1201 } 1202 1203 // All others 1204 return select( selector.replace( rtrimCSS, "$1" ), context, results, seed ); 1205} 1206 1207/** 1208 * Create key-value caches of limited size 1209 * @returns {function(string, object)} Returns the Object data after storing it on itself with 1210 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 1211 * deleting the oldest entry 1212 */ 1213function createCache() { 1214 var keys = []; 1215 1216 function cache( key, value ) { 1217 1218 // Use (key + " ") to avoid collision with native prototype properties 1219 // (see https://github.com/jquery/sizzle/issues/157) 1220 if ( keys.push( key + " " ) > Expr.cacheLength ) { 1221 1222 // Only keep the most recent entries 1223 delete cache[ keys.shift() ]; 1224 } 1225 return ( cache[ key + " " ] = value ); 1226 } 1227 return cache; 1228} 1229 1230/** 1231 * Mark a function for special use by jQuery selector module 1232 * @param {Function} fn The function to mark 1233 */ 1234function markFunction( fn ) { 1235 fn[ expando ] = true; 1236 return fn; 1237} 1238 1239/** 1240 * Support testing using an element 1241 * @param {Function} fn Passed the created element and returns a boolean result 1242 */ 1243function assert( fn ) { 1244 var el = document.createElement( "fieldset" ); 1245 1246 try { 1247 return !!fn( el ); 1248 } catch ( e ) { 1249 return false; 1250 } finally { 1251 1252 // Remove from its parent by default 1253 if ( el.parentNode ) { 1254 el.parentNode.removeChild( el ); 1255 } 1256 1257 // release memory in IE 1258 el = null; 1259 } 1260} 1261 1262/** 1263 * Returns a function to use in pseudos for input types 1264 * @param {String} type 1265 */ 1266function createInputPseudo( type ) { 1267 return function( elem ) { 1268 return nodeName( elem, "input" ) && elem.type === type; 1269 }; 1270} 1271 1272/** 1273 * Returns a function to use in pseudos for buttons 1274 * @param {String} type 1275 */ 1276function createButtonPseudo( type ) { 1277 return function( elem ) { 1278 return ( nodeName( elem, "input" ) || nodeName( elem, "button" ) ) && 1279 elem.type === type; 1280 }; 1281} 1282 1283/** 1284 * Returns a function to use in pseudos for :enabled/:disabled 1285 * @param {Boolean} disabled true for :disabled; false for :enabled 1286 */ 1287function createDisabledPseudo( disabled ) { 1288 1289 // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable 1290 return function( elem ) { 1291 1292 // Only certain elements can match :enabled or :disabled 1293 // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled 1294 // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled 1295 if ( "form" in elem ) { 1296 1297 // Check for inherited disabledness on relevant non-disabled elements: 1298 // * listed form-associated elements in a disabled fieldset 1299 // https://html.spec.whatwg.org/multipage/forms.html#category-listed 1300 // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled 1301 // * option elements in a disabled optgroup 1302 // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled 1303 // All such elements have a "form" property. 1304 if ( elem.parentNode && elem.disabled === false ) { 1305 1306 // Option elements defer to a parent optgroup if present 1307 if ( "label" in elem ) { 1308 if ( "label" in elem.parentNode ) { 1309 return elem.parentNode.disabled === disabled; 1310 } else { 1311 return elem.disabled === disabled; 1312 } 1313 } 1314 1315 // Support: IE 6 - 11+ 1316 // Use the isDisabled shortcut property to check for disabled fieldset ancestors 1317 return elem.isDisabled === disabled || 1318 1319 // Where there is no isDisabled, check manually 1320 elem.isDisabled !== !disabled && 1321 inDisabledFieldset( elem ) === disabled; 1322 } 1323 1324 return elem.disabled === disabled; 1325 1326 // Try to winnow out elements that can't be disabled before trusting the disabled property. 1327 // Some victims get caught in our net (label, legend, menu, track), but it shouldn't 1328 // even exist on them, let alone have a boolean value. 1329 } else if ( "label" in elem ) { 1330 return elem.disabled === disabled; 1331 } 1332 1333 // Remaining elements are neither :enabled nor :disabled 1334 return false; 1335 }; 1336} 1337 1338/** 1339 * Returns a function to use in pseudos for positionals 1340 * @param {Function} fn 1341 */ 1342function createPositionalPseudo( fn ) { 1343 return markFunction( function( argument ) { 1344 argument = +argument; 1345 return markFunction( function( seed, matches ) { 1346 var j, 1347 matchIndexes = fn( [], seed.length, argument ), 1348 i = matchIndexes.length; 1349 1350 // Match elements found at the specified indexes 1351 while ( i-- ) { 1352 if ( seed[ ( j = matchIndexes[ i ] ) ] ) { 1353 seed[ j ] = !( matches[ j ] = seed[ j ] ); 1354 } 1355 } 1356 } ); 1357 } ); 1358} 1359 1360/** 1361 * Checks a node for validity as a jQuery selector context 1362 * @param {Element|Object=} context 1363 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 1364 */ 1365function testContext( context ) { 1366 return context && typeof context.getElementsByTagName !== "undefined" && context; 1367} 1368 1369/** 1370 * Sets document-related variables once based on the current document 1371 * @param {Element|Object} [node] An element or document object to use to set the document 1372 * @returns {Object} Returns the current document 1373 */ 1374function setDocument( node ) { 1375 var subWindow, 1376 doc = node ? node.ownerDocument || node : preferredDoc; 1377 1378 // Return early if doc is invalid or already selected 1379 // Support: IE 11+, Edge 17 - 18+ 1380 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1381 // two documents; shallow comparisons work. 1382 // eslint-disable-next-line eqeqeq 1383 if ( doc == document || doc.nodeType !== 9 || !doc.documentElement ) { 1384 return document; 1385 } 1386 1387 // Update global variables 1388 document = doc; 1389 documentElement = document.documentElement; 1390 documentIsHTML = !jQuery.isXMLDoc( document ); 1391 1392 // Support: iOS 7 only, IE 9 - 11+ 1393 // Older browsers didn't support unprefixed `matches`. 1394 matches = documentElement.matches || 1395 documentElement.webkitMatchesSelector || 1396 documentElement.msMatchesSelector; 1397 1398 // Support: IE 9 - 11+, Edge 12 - 18+ 1399 // Accessing iframe documents after unload throws "permission denied" errors 1400 // (see trac-13936). 1401 // Limit the fix to IE & Edge Legacy; despite Edge 15+ implementing `matches`, 1402 // all IE 9+ and Edge Legacy versions implement `msMatchesSelector` as well. 1403 if ( documentElement.msMatchesSelector && 1404 1405 // Support: IE 11+, Edge 17 - 18+ 1406 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1407 // two documents; shallow comparisons work. 1408 // eslint-disable-next-line eqeqeq 1409 preferredDoc != document && 1410 ( subWindow = document.defaultView ) && subWindow.top !== subWindow ) { 1411 1412 // Support: IE 9 - 11+, Edge 12 - 18+ 1413 subWindow.addEventListener( "unload", unloadHandler ); 1414 } 1415 1416 // Support: IE <10 1417 // Check if getElementById returns elements by name 1418 // The broken getElementById methods don't pick up programmatically-set names, 1419 // so use a roundabout getElementsByName test 1420 support.getById = assert( function( el ) { 1421 documentElement.appendChild( el ).id = jQuery.expando; 1422 return !document.getElementsByName || 1423 !document.getElementsByName( jQuery.expando ).length; 1424 } ); 1425 1426 // Support: IE 9 only 1427 // Check to see if it's possible to do matchesSelector 1428 // on a disconnected node. 1429 support.disconnectedMatch = assert( function( el ) { 1430 return matches.call( el, "*" ); 1431 } ); 1432 1433 // Support: IE 9 - 11+, Edge 12 - 18+ 1434 // IE/Edge don't support the :scope pseudo-class. 1435 support.scope = assert( function() { 1436 return document.querySelectorAll( ":scope" ); 1437 } ); 1438 1439 // Support: Chrome 105 - 111 only, Safari 15.4 - 16.3 only 1440 // Make sure the `:has()` argument is parsed unforgivingly. 1441 // We include `*` in the test to detect buggy implementations that are 1442 // _selectively_ forgiving (specifically when the list includes at least 1443 // one valid selector). 1444 // Note that we treat complete lack of support for `:has()` as if it were 1445 // spec-compliant support, which is fine because use of `:has()` in such 1446 // environments will fail in the qSA path and fall back to jQuery traversal 1447 // anyway. 1448 support.cssHas = assert( function() { 1449 try { 1450 document.querySelector( ":has(*,:jqfake)" ); 1451 return false; 1452 } catch ( e ) { 1453 return true; 1454 } 1455 } ); 1456 1457 // ID filter and find 1458 if ( support.getById ) { 1459 Expr.filter.ID = function( id ) { 1460 var attrId = id.replace( runescape, funescape ); 1461 return function( elem ) { 1462 return elem.getAttribute( "id" ) === attrId; 1463 }; 1464 }; 1465 Expr.find.ID = function( id, context ) { 1466 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1467 var elem = context.getElementById( id ); 1468 return elem ? [ elem ] : []; 1469 } 1470 }; 1471 } else { 1472 Expr.filter.ID = function( id ) { 1473 var attrId = id.replace( runescape, funescape ); 1474 return function( elem ) { 1475 var node = typeof elem.getAttributeNode !== "undefined" && 1476 elem.getAttributeNode( "id" ); 1477 return node && node.value === attrId; 1478 }; 1479 }; 1480 1481 // Support: IE 6 - 7 only 1482 // getElementById is not reliable as a find shortcut 1483 Expr.find.ID = function( id, context ) { 1484 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1485 var node, i, elems, 1486 elem = context.getElementById( id ); 1487 1488 if ( elem ) { 1489 1490 // Verify the id attribute 1491 node = elem.getAttributeNode( "id" ); 1492 if ( node && node.value === id ) { 1493 return [ elem ]; 1494 } 1495 1496 // Fall back on getElementsByName 1497 elems = context.getElementsByName( id ); 1498 i = 0; 1499 while ( ( elem = elems[ i++ ] ) ) { 1500 node = elem.getAttributeNode( "id" ); 1501 if ( node && node.value === id ) { 1502 return [ elem ]; 1503 } 1504 } 1505 } 1506 1507 return []; 1508 } 1509 }; 1510 } 1511 1512 // Tag 1513 Expr.find.TAG = function( tag, context ) { 1514 if ( typeof context.getElementsByTagName !== "undefined" ) { 1515 return context.getElementsByTagName( tag ); 1516 1517 // DocumentFragment nodes don't have gEBTN 1518 } else { 1519 return context.querySelectorAll( tag ); 1520 } 1521 }; 1522 1523 // Class 1524 Expr.find.CLASS = function( className, context ) { 1525 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 1526 return context.getElementsByClassName( className ); 1527 } 1528 }; 1529 1530 /* QSA/matchesSelector 1531 ---------------------------------------------------------------------- */ 1532 1533 // QSA and matchesSelector support 1534 1535 rbuggyQSA = []; 1536 1537 // Build QSA regex 1538 // Regex strategy adopted from Diego Perini 1539 assert( function( el ) { 1540 1541 var input; 1542 1543 documentElement.appendChild( el ).innerHTML = 1544 "<a id='" + expando + "' href='' disabled='disabled'></a>" + 1545 "<select id='" + expando + "-\r\\' disabled='disabled'>" + 1546 "<option selected=''></option></select>"; 1547 1548 // Support: iOS <=7 - 8 only 1549 // Boolean attributes and "value" are not treated correctly in some XML documents 1550 if ( !el.querySelectorAll( "[selected]" ).length ) { 1551 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 1552 } 1553 1554 // Support: iOS <=7 - 8 only 1555 if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 1556 rbuggyQSA.push( "~=" ); 1557 } 1558 1559 // Support: iOS 8 only 1560 // https://bugs.webkit.org/show_bug.cgi?id=136851 1561 // In-page `selector#id sibling-combinator selector` fails 1562 if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) { 1563 rbuggyQSA.push( ".#.+[+~]" ); 1564 } 1565 1566 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ 1567 // In some of the document kinds, these selectors wouldn't work natively. 1568 // This is probably OK but for backwards compatibility we want to maintain 1569 // handling them through jQuery traversal in jQuery 3.x. 1570 if ( !el.querySelectorAll( ":checked" ).length ) { 1571 rbuggyQSA.push( ":checked" ); 1572 } 1573 1574 // Support: Windows 8 Native Apps 1575 // The type and name attributes are restricted during .innerHTML assignment 1576 input = document.createElement( "input" ); 1577 input.setAttribute( "type", "hidden" ); 1578 el.appendChild( input ).setAttribute( "name", "D" ); 1579 1580 // Support: IE 9 - 11+ 1581 // IE's :disabled selector does not pick up the children of disabled fieldsets 1582 // Support: Chrome <=105+, Firefox <=104+, Safari <=15.4+ 1583 // In some of the document kinds, these selectors wouldn't work natively. 1584 // This is probably OK but for backwards compatibility we want to maintain 1585 // handling them through jQuery traversal in jQuery 3.x. 1586 documentElement.appendChild( el ).disabled = true; 1587 if ( el.querySelectorAll( ":disabled" ).length !== 2 ) { 1588 rbuggyQSA.push( ":enabled", ":disabled" ); 1589 } 1590 1591 // Support: IE 11+, Edge 15 - 18+ 1592 // IE 11/Edge don't find elements on a `[name='']` query in some cases. 1593 // Adding a temporary attribute to the document before the selection works 1594 // around the issue. 1595 // Interestingly, IE 10 & older don't seem to have the issue. 1596 input = document.createElement( "input" ); 1597 input.setAttribute( "name", "" ); 1598 el.appendChild( input ); 1599 if ( !el.querySelectorAll( "[name='']" ).length ) { 1600 rbuggyQSA.push( "\\[" + whitespace + "*name" + whitespace + "*=" + 1601 whitespace + "*(?:''|\"\")" ); 1602 } 1603 } ); 1604 1605 if ( !support.cssHas ) { 1606 1607 // Support: Chrome 105 - 110+, Safari 15.4 - 16.3+ 1608 // Our regular `try-catch` mechanism fails to detect natively-unsupported 1609 // pseudo-classes inside `:has()` (such as `:has(:contains("Foo"))`) 1610 // in browsers that parse the `:has()` argument as a forgiving selector list. 1611 // https://drafts.csswg.org/selectors/#relational now requires the argument 1612 // to be parsed unforgivingly, but browsers have not yet fully adjusted. 1613 rbuggyQSA.push( ":has" ); 1614 } 1615 1616 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join( "|" ) ); 1617 1618 /* Sorting 1619 ---------------------------------------------------------------------- */ 1620 1621 // Document order sorting 1622 sortOrder = function( a, b ) { 1623 1624 // Flag for duplicate removal 1625 if ( a === b ) { 1626 hasDuplicate = true; 1627 return 0; 1628 } 1629 1630 // Sort on method existence if only one input has compareDocumentPosition 1631 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 1632 if ( compare ) { 1633 return compare; 1634 } 1635 1636 // Calculate position if both inputs belong to the same document 1637 // Support: IE 11+, Edge 17 - 18+ 1638 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1639 // two documents; shallow comparisons work. 1640 // eslint-disable-next-line eqeqeq 1641 compare = ( a.ownerDocument || a ) == ( b.ownerDocument || b ) ? 1642 a.compareDocumentPosition( b ) : 1643 1644 // Otherwise we know they are disconnected 1645 1; 1646 1647 // Disconnected nodes 1648 if ( compare & 1 || 1649 ( !support.sortDetached && b.compareDocumentPosition( a ) === compare ) ) { 1650 1651 // Choose the first element that is related to our preferred document 1652 // Support: IE 11+, Edge 17 - 18+ 1653 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1654 // two documents; shallow comparisons work. 1655 // eslint-disable-next-line eqeqeq 1656 if ( a === document || a.ownerDocument == preferredDoc && 1657 find.contains( preferredDoc, a ) ) { 1658 return -1; 1659 } 1660 1661 // Support: IE 11+, Edge 17 - 18+ 1662 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1663 // two documents; shallow comparisons work. 1664 // eslint-disable-next-line eqeqeq 1665 if ( b === document || b.ownerDocument == preferredDoc && 1666 find.contains( preferredDoc, b ) ) { 1667 return 1; 1668 } 1669 1670 // Maintain original order 1671 return sortInput ? 1672 ( indexOf.call( sortInput, a ) - indexOf.call( sortInput, b ) ) : 1673 0; 1674 } 1675 1676 return compare & 4 ? -1 : 1; 1677 }; 1678 1679 return document; 1680} 1681 1682find.matches = function( expr, elements ) { 1683 return find( expr, null, null, elements ); 1684}; 1685 1686find.matchesSelector = function( elem, expr ) { 1687 setDocument( elem ); 1688 1689 if ( documentIsHTML && 1690 !nonnativeSelectorCache[ expr + " " ] && 1691 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 1692 1693 try { 1694 var ret = matches.call( elem, expr ); 1695 1696 // IE 9's matchesSelector returns false on disconnected nodes 1697 if ( ret || support.disconnectedMatch || 1698 1699 // As well, disconnected nodes are said to be in a document 1700 // fragment in IE 9 1701 elem.document && elem.document.nodeType !== 11 ) { 1702 return ret; 1703 } 1704 } catch ( e ) { 1705 nonnativeSelectorCache( expr, true ); 1706 } 1707 } 1708 1709 return find( expr, document, null, [ elem ] ).length > 0; 1710}; 1711 1712find.contains = function( context, elem ) { 1713 1714 // Set document vars if needed 1715 // Support: IE 11+, Edge 17 - 18+ 1716 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1717 // two documents; shallow comparisons work. 1718 // eslint-disable-next-line eqeqeq 1719 if ( ( context.ownerDocument || context ) != document ) { 1720 setDocument( context ); 1721 } 1722 return jQuery.contains( context, elem ); 1723}; 1724 1725 1726find.attr = function( elem, name ) { 1727 1728 // Set document vars if needed 1729 // Support: IE 11+, Edge 17 - 18+ 1730 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 1731 // two documents; shallow comparisons work. 1732 // eslint-disable-next-line eqeqeq 1733 if ( ( elem.ownerDocument || elem ) != document ) { 1734 setDocument( elem ); 1735 } 1736 1737 var fn = Expr.attrHandle[ name.toLowerCase() ], 1738 1739 // Don't get fooled by Object.prototype properties (see trac-13807) 1740 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 1741 fn( elem, name, !documentIsHTML ) : 1742 undefined; 1743 1744 if ( val !== undefined ) { 1745 return val; 1746 } 1747 1748 return elem.getAttribute( name ); 1749}; 1750 1751find.error = function( msg ) { 1752 throw new Error( "Syntax error, unrecognized expression: " + msg ); 1753}; 1754 1755/** 1756 * Document sorting and removing duplicates 1757 * @param {ArrayLike} results 1758 */ 1759jQuery.uniqueSort = function( results ) { 1760 var elem, 1761 duplicates = [], 1762 j = 0, 1763 i = 0; 1764 1765 // Unless we *know* we can detect duplicates, assume their presence 1766 // 1767 // Support: Android <=4.0+ 1768 // Testing for detecting duplicates is unpredictable so instead assume we can't 1769 // depend on duplicate detection in all browsers without a stable sort. 1770 hasDuplicate = !support.sortStable; 1771 sortInput = !support.sortStable && slice.call( results, 0 ); 1772 sort.call( results, sortOrder ); 1773 1774 if ( hasDuplicate ) { 1775 while ( ( elem = results[ i++ ] ) ) { 1776 if ( elem === results[ i ] ) { 1777 j = duplicates.push( i ); 1778 } 1779 } 1780 while ( j-- ) { 1781 splice.call( results, duplicates[ j ], 1 ); 1782 } 1783 } 1784 1785 // Clear input after sorting to release objects 1786 // See https://github.com/jquery/sizzle/pull/225 1787 sortInput = null; 1788 1789 return results; 1790}; 1791 1792jQuery.fn.uniqueSort = function() { 1793 return this.pushStack( jQuery.uniqueSort( slice.apply( this ) ) ); 1794}; 1795 1796Expr = jQuery.expr = { 1797 1798 // Can be adjusted by the user 1799 cacheLength: 50, 1800 1801 createPseudo: markFunction, 1802 1803 match: matchExpr, 1804 1805 attrHandle: {}, 1806 1807 find: {}, 1808 1809 relative: { 1810 ">": { dir: "parentNode", first: true }, 1811 " ": { dir: "parentNode" }, 1812 "+": { dir: "previousSibling", first: true }, 1813 "~": { dir: "previousSibling" } 1814 }, 1815 1816 preFilter: { 1817 ATTR: function( match ) { 1818 match[ 1 ] = match[ 1 ].replace( runescape, funescape ); 1819 1820 // Move the given value to match[3] whether quoted or unquoted 1821 match[ 3 ] = ( match[ 3 ] || match[ 4 ] || match[ 5 ] || "" ) 1822 .replace( runescape, funescape ); 1823 1824 if ( match[ 2 ] === "~=" ) { 1825 match[ 3 ] = " " + match[ 3 ] + " "; 1826 } 1827 1828 return match.slice( 0, 4 ); 1829 }, 1830 1831 CHILD: function( match ) { 1832 1833 /* matches from matchExpr["CHILD"] 1834 1 type (only|nth|...) 1835 2 what (child|of-type) 1836 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 1837 4 xn-component of xn+y argument ([+-]?\d*n|) 1838 5 sign of xn-component 1839 6 x of xn-component 1840 7 sign of y-component 1841 8 y of y-component 1842 */ 1843 match[ 1 ] = match[ 1 ].toLowerCase(); 1844 1845 if ( match[ 1 ].slice( 0, 3 ) === "nth" ) { 1846 1847 // nth-* requires argument 1848 if ( !match[ 3 ] ) { 1849 find.error( match[ 0 ] ); 1850 } 1851 1852 // numeric x and y parameters for Expr.filter.CHILD 1853 // remember that false/true cast respectively to 0/1 1854 match[ 4 ] = +( match[ 4 ] ? 1855 match[ 5 ] + ( match[ 6 ] || 1 ) : 1856 2 * ( match[ 3 ] === "even" || match[ 3 ] === "odd" ) 1857 ); 1858 match[ 5 ] = +( ( match[ 7 ] + match[ 8 ] ) || match[ 3 ] === "odd" ); 1859 1860 // other types prohibit arguments 1861 } else if ( match[ 3 ] ) { 1862 find.error( match[ 0 ] ); 1863 } 1864 1865 return match; 1866 }, 1867 1868 PSEUDO: function( match ) { 1869 var excess, 1870 unquoted = !match[ 6 ] && match[ 2 ]; 1871 1872 if ( matchExpr.CHILD.test( match[ 0 ] ) ) { 1873 return null; 1874 } 1875 1876 // Accept quoted arguments as-is 1877 if ( match[ 3 ] ) { 1878 match[ 2 ] = match[ 4 ] || match[ 5 ] || ""; 1879 1880 // Strip excess characters from unquoted arguments 1881 } else if ( unquoted && rpseudo.test( unquoted ) && 1882 1883 // Get excess from tokenize (recursively) 1884 ( excess = tokenize( unquoted, true ) ) && 1885 1886 // advance to the next closing parenthesis 1887 ( excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length ) ) { 1888 1889 // excess is a negative index 1890 match[ 0 ] = match[ 0 ].slice( 0, excess ); 1891 match[ 2 ] = unquoted.slice( 0, excess ); 1892 } 1893 1894 // Return only captures needed by the pseudo filter method (type and argument) 1895 return match.slice( 0, 3 ); 1896 } 1897 }, 1898 1899 filter: { 1900 1901 TAG: function( nodeNameSelector ) { 1902 var expectedNodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 1903 return nodeNameSelector === "*" ? 1904 function() { 1905 return true; 1906 } : 1907 function( elem ) { 1908 return nodeName( elem, expectedNodeName ); 1909 }; 1910 }, 1911 1912 CLASS: function( className ) { 1913 var pattern = classCache[ className + " " ]; 1914 1915 return pattern || 1916 ( pattern = new RegExp( "(^|" + whitespace + ")" + className + 1917 "(" + whitespace + "|$)" ) ) && 1918 classCache( className, function( elem ) { 1919 return pattern.test( 1920 typeof elem.className === "string" && elem.className || 1921 typeof elem.getAttribute !== "undefined" && 1922 elem.getAttribute( "class" ) || 1923 "" 1924 ); 1925 } ); 1926 }, 1927 1928 ATTR: function( name, operator, check ) { 1929 return function( elem ) { 1930 var result = find.attr( elem, name ); 1931 1932 if ( result == null ) { 1933 return operator === "!="; 1934 } 1935 if ( !operator ) { 1936 return true; 1937 } 1938 1939 result += ""; 1940 1941 if ( operator === "=" ) { 1942 return result === check; 1943 } 1944 if ( operator === "!=" ) { 1945 return result !== check; 1946 } 1947 if ( operator === "^=" ) { 1948 return check && result.indexOf( check ) === 0; 1949 } 1950 if ( operator === "*=" ) { 1951 return check && result.indexOf( check ) > -1; 1952 } 1953 if ( operator === "$=" ) { 1954 return check && result.slice( -check.length ) === check; 1955 } 1956 if ( operator === "~=" ) { 1957 return ( " " + result.replace( rwhitespace, " " ) + " " ) 1958 .indexOf( check ) > -1; 1959 } 1960 if ( operator === "|=" ) { 1961 return result === check || result.slice( 0, check.length + 1 ) === check + "-"; 1962 } 1963 1964 return false; 1965 }; 1966 }, 1967 1968 CHILD: function( type, what, _argument, first, last ) { 1969 var simple = type.slice( 0, 3 ) !== "nth", 1970 forward = type.slice( -4 ) !== "last", 1971 ofType = what === "of-type"; 1972 1973 return first === 1 && last === 0 ? 1974 1975 // Shortcut for :nth-*(n) 1976 function( elem ) { 1977 return !!elem.parentNode; 1978 } : 1979 1980 function( elem, _context, xml ) { 1981 var cache, outerCache, node, nodeIndex, start, 1982 dir = simple !== forward ? "nextSibling" : "previousSibling", 1983 parent = elem.parentNode, 1984 name = ofType && elem.nodeName.toLowerCase(), 1985 useCache = !xml && !ofType, 1986 diff = false; 1987 1988 if ( parent ) { 1989 1990 // :(first|last|only)-(child|of-type) 1991 if ( simple ) { 1992 while ( dir ) { 1993 node = elem; 1994 while ( ( node = node[ dir ] ) ) { 1995 if ( ofType ? 1996 nodeName( node, name ) : 1997 node.nodeType === 1 ) { 1998 1999 return false; 2000 } 2001 } 2002 2003 // Reverse direction for :only-* (if we haven't yet done so) 2004 start = dir = type === "only" && !start && "nextSibling"; 2005 } 2006 return true; 2007 } 2008 2009 start = [ forward ? parent.firstChild : parent.lastChild ]; 2010 2011 // non-xml :nth-child(...) stores cache data on `parent` 2012 if ( forward && useCache ) { 2013 2014 // Seek `elem` from a previously-cached index 2015 outerCache = parent[ expando ] || ( parent[ expando ] = {} ); 2016 cache = outerCache[ type ] || []; 2017 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 2018 diff = nodeIndex && cache[ 2 ]; 2019 node = nodeIndex && parent.childNodes[ nodeIndex ]; 2020 2021 while ( ( node = ++nodeIndex && node && node[ dir ] || 2022 2023 // Fallback to seeking `elem` from the start 2024 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 2025 2026 // When found, cache indexes on `parent` and break 2027 if ( node.nodeType === 1 && ++diff && node === elem ) { 2028 outerCache[ type ] = [ dirruns, nodeIndex, diff ]; 2029 break; 2030 } 2031 } 2032 2033 } else { 2034 2035 // Use previously-cached element index if available 2036 if ( useCache ) { 2037 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 2038 cache = outerCache[ type ] || []; 2039 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 2040 diff = nodeIndex; 2041 } 2042 2043 // xml :nth-child(...) 2044 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 2045 if ( diff === false ) { 2046 2047 // Use the same loop as above to seek `elem` from the start 2048 while ( ( node = ++nodeIndex && node && node[ dir ] || 2049 ( diff = nodeIndex = 0 ) || start.pop() ) ) { 2050 2051 if ( ( ofType ? 2052 nodeName( node, name ) : 2053 node.nodeType === 1 ) && 2054 ++diff ) { 2055 2056 // Cache the index of each encountered element 2057 if ( useCache ) { 2058 outerCache = node[ expando ] || 2059 ( node[ expando ] = {} ); 2060 outerCache[ type ] = [ dirruns, diff ]; 2061 } 2062 2063 if ( node === elem ) { 2064 break; 2065 } 2066 } 2067 } 2068 } 2069 } 2070 2071 // Incorporate the offset, then check against cycle size 2072 diff -= last; 2073 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 2074 } 2075 }; 2076 }, 2077 2078 PSEUDO: function( pseudo, argument ) { 2079 2080 // pseudo-class names are case-insensitive 2081 // https://www.w3.org/TR/selectors/#pseudo-classes 2082 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 2083 // Remember that setFilters inherits from pseudos 2084 var args, 2085 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 2086 find.error( "unsupported pseudo: " + pseudo ); 2087 2088 // The user may use createPseudo to indicate that 2089 // arguments are needed to create the filter function 2090 // just as jQuery does 2091 if ( fn[ expando ] ) { 2092 return fn( argument ); 2093 } 2094 2095 // But maintain support for old signatures 2096 if ( fn.length > 1 ) { 2097 args = [ pseudo, pseudo, "", argument ]; 2098 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 2099 markFunction( function( seed, matches ) { 2100 var idx, 2101 matched = fn( seed, argument ), 2102 i = matched.length; 2103 while ( i-- ) { 2104 idx = indexOf.call( seed, matched[ i ] ); 2105 seed[ idx ] = !( matches[ idx ] = matched[ i ] ); 2106 } 2107 } ) : 2108 function( elem ) { 2109 return fn( elem, 0, args ); 2110 }; 2111 } 2112 2113 return fn; 2114 } 2115 }, 2116 2117 pseudos: { 2118 2119 // Potentially complex pseudos 2120 not: markFunction( function( selector ) { 2121 2122 // Trim the selector passed to compile 2123 // to avoid treating leading and trailing 2124 // spaces as combinators 2125 var input = [], 2126 results = [], 2127 matcher = compile( selector.replace( rtrimCSS, "$1" ) ); 2128 2129 return matcher[ expando ] ? 2130 markFunction( function( seed, matches, _context, xml ) { 2131 var elem, 2132 unmatched = matcher( seed, null, xml, [] ), 2133 i = seed.length; 2134 2135 // Match elements unmatched by `matcher` 2136 while ( i-- ) { 2137 if ( ( elem = unmatched[ i ] ) ) { 2138 seed[ i ] = !( matches[ i ] = elem ); 2139 } 2140 } 2141 } ) : 2142 function( elem, _context, xml ) { 2143 input[ 0 ] = elem; 2144 matcher( input, null, xml, results ); 2145 2146 // Don't keep the element 2147 // (see https://github.com/jquery/sizzle/issues/299) 2148 input[ 0 ] = null; 2149 return !results.pop(); 2150 }; 2151 } ), 2152 2153 has: markFunction( function( selector ) { 2154 return function( elem ) { 2155 return find( selector, elem ).length > 0; 2156 }; 2157 } ), 2158 2159 contains: markFunction( function( text ) { 2160 text = text.replace( runescape, funescape ); 2161 return function( elem ) { 2162 return ( elem.textContent || jQuery.text( elem ) ).indexOf( text ) > -1; 2163 }; 2164 } ), 2165 2166 // "Whether an element is represented by a :lang() selector 2167 // is based solely on the element's language value 2168 // being equal to the identifier C, 2169 // or beginning with the identifier C immediately followed by "-". 2170 // The matching of C against the element's language value is performed case-insensitively. 2171 // The identifier C does not have to be a valid language name." 2172 // https://www.w3.org/TR/selectors/#lang-pseudo 2173 lang: markFunction( function( lang ) { 2174 2175 // lang value must be a valid identifier 2176 if ( !ridentifier.test( lang || "" ) ) { 2177 find.error( "unsupported lang: " + lang ); 2178 } 2179 lang = lang.replace( runescape, funescape ).toLowerCase(); 2180 return function( elem ) { 2181 var elemLang; 2182 do { 2183 if ( ( elemLang = documentIsHTML ? 2184 elem.lang : 2185 elem.getAttribute( "xml:lang" ) || elem.getAttribute( "lang" ) ) ) { 2186 2187 elemLang = elemLang.toLowerCase(); 2188 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 2189 } 2190 } while ( ( elem = elem.parentNode ) && elem.nodeType === 1 ); 2191 return false; 2192 }; 2193 } ), 2194 2195 // Miscellaneous 2196 target: function( elem ) { 2197 var hash = window.location && window.location.hash; 2198 return hash && hash.slice( 1 ) === elem.id; 2199 }, 2200 2201 root: function( elem ) { 2202 return elem === documentElement; 2203 }, 2204 2205 focus: function( elem ) { 2206 return elem === safeActiveElement() && 2207 document.hasFocus() && 2208 !!( elem.type || elem.href || ~elem.tabIndex ); 2209 }, 2210 2211 // Boolean properties 2212 enabled: createDisabledPseudo( false ), 2213 disabled: createDisabledPseudo( true ), 2214 2215 checked: function( elem ) { 2216 2217 // In CSS3, :checked should return both checked and selected elements 2218 // https://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 2219 return ( nodeName( elem, "input" ) && !!elem.checked ) || 2220 ( nodeName( elem, "option" ) && !!elem.selected ); 2221 }, 2222 2223 selected: function( elem ) { 2224 2225 // Support: IE <=11+ 2226 // Accessing the selectedIndex property 2227 // forces the browser to treat the default option as 2228 // selected when in an optgroup. 2229 if ( elem.parentNode ) { 2230 // eslint-disable-next-line no-unused-expressions 2231 elem.parentNode.selectedIndex; 2232 } 2233 2234 return elem.selected === true; 2235 }, 2236 2237 // Contents 2238 empty: function( elem ) { 2239 2240 // https://www.w3.org/TR/selectors/#empty-pseudo 2241 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 2242 // but not by others (comment: 8; processing instruction: 7; etc.) 2243 // nodeType < 6 works because attributes (2) do not appear as children 2244 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 2245 if ( elem.nodeType < 6 ) { 2246 return false; 2247 } 2248 } 2249 return true; 2250 }, 2251 2252 parent: function( elem ) { 2253 return !Expr.pseudos.empty( elem ); 2254 }, 2255 2256 // Element/input types 2257 header: function( elem ) { 2258 return rheader.test( elem.nodeName ); 2259 }, 2260 2261 input: function( elem ) { 2262 return rinputs.test( elem.nodeName ); 2263 }, 2264 2265 button: function( elem ) { 2266 return nodeName( elem, "input" ) && elem.type === "button" || 2267 nodeName( elem, "button" ); 2268 }, 2269 2270 text: function( elem ) { 2271 var attr; 2272 return nodeName( elem, "input" ) && elem.type === "text" && 2273 2274 // Support: IE <10 only 2275 // New HTML5 attribute values (e.g., "search") appear 2276 // with elem.type === "text" 2277 ( ( attr = elem.getAttribute( "type" ) ) == null || 2278 attr.toLowerCase() === "text" ); 2279 }, 2280 2281 // Position-in-collection 2282 first: createPositionalPseudo( function() { 2283 return [ 0 ]; 2284 } ), 2285 2286 last: createPositionalPseudo( function( _matchIndexes, length ) { 2287 return [ length - 1 ]; 2288 } ), 2289 2290 eq: createPositionalPseudo( function( _matchIndexes, length, argument ) { 2291 return [ argument < 0 ? argument + length : argument ]; 2292 } ), 2293 2294 even: createPositionalPseudo( function( matchIndexes, length ) { 2295 var i = 0; 2296 for ( ; i < length; i += 2 ) { 2297 matchIndexes.push( i ); 2298 } 2299 return matchIndexes; 2300 } ), 2301 2302 odd: createPositionalPseudo( function( matchIndexes, length ) { 2303 var i = 1; 2304 for ( ; i < length; i += 2 ) { 2305 matchIndexes.push( i ); 2306 } 2307 return matchIndexes; 2308 } ), 2309 2310 lt: createPositionalPseudo( function( matchIndexes, length, argument ) { 2311 var i; 2312 2313 if ( argument < 0 ) { 2314 i = argument + length; 2315 } else if ( argument > length ) { 2316 i = length; 2317 } else { 2318 i = argument; 2319 } 2320 2321 for ( ; --i >= 0; ) { 2322 matchIndexes.push( i ); 2323 } 2324 return matchIndexes; 2325 } ), 2326 2327 gt: createPositionalPseudo( function( matchIndexes, length, argument ) { 2328 var i = argument < 0 ? argument + length : argument; 2329 for ( ; ++i < length; ) { 2330 matchIndexes.push( i ); 2331 } 2332 return matchIndexes; 2333 } ) 2334 } 2335}; 2336 2337Expr.pseudos.nth = Expr.pseudos.eq; 2338 2339// Add button/input type pseudos 2340for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 2341 Expr.pseudos[ i ] = createInputPseudo( i ); 2342} 2343for ( i in { submit: true, reset: true } ) { 2344 Expr.pseudos[ i ] = createButtonPseudo( i ); 2345} 2346 2347// Easy API for creating new setFilters 2348function setFilters() {} 2349setFilters.prototype = Expr.filters = Expr.pseudos; 2350Expr.setFilters = new setFilters(); 2351 2352function tokenize( selector, parseOnly ) { 2353 var matched, match, tokens, type, 2354 soFar, groups, preFilters, 2355 cached = tokenCache[ selector + " " ]; 2356 2357 if ( cached ) { 2358 return parseOnly ? 0 : cached.slice( 0 ); 2359 } 2360 2361 soFar = selector; 2362 groups = []; 2363 preFilters = Expr.preFilter; 2364 2365 while ( soFar ) { 2366 2367 // Comma and first run 2368 if ( !matched || ( match = rcomma.exec( soFar ) ) ) { 2369 if ( match ) { 2370 2371 // Don't consume trailing commas as valid 2372 soFar = soFar.slice( match[ 0 ].length ) || soFar; 2373 } 2374 groups.push( ( tokens = [] ) ); 2375 } 2376 2377 matched = false; 2378 2379 // Combinators 2380 if ( ( match = rleadingCombinator.exec( soFar ) ) ) { 2381 matched = match.shift(); 2382 tokens.push( { 2383 value: matched, 2384 2385 // Cast descendant combinators to space 2386 type: match[ 0 ].replace( rtrimCSS, " " ) 2387 } ); 2388 soFar = soFar.slice( matched.length ); 2389 } 2390 2391 // Filters 2392 for ( type in Expr.filter ) { 2393 if ( ( match = matchExpr[ type ].exec( soFar ) ) && ( !preFilters[ type ] || 2394 ( match = preFilters[ type ]( match ) ) ) ) { 2395 matched = match.shift(); 2396 tokens.push( { 2397 value: matched, 2398 type: type, 2399 matches: match 2400 } ); 2401 soFar = soFar.slice( matched.length ); 2402 } 2403 } 2404 2405 if ( !matched ) { 2406 break; 2407 } 2408 } 2409 2410 // Return the length of the invalid excess 2411 // if we're just parsing 2412 // Otherwise, throw an error or return tokens 2413 if ( parseOnly ) { 2414 return soFar.length; 2415 } 2416 2417 return soFar ? 2418 find.error( selector ) : 2419 2420 // Cache the tokens 2421 tokenCache( selector, groups ).slice( 0 ); 2422} 2423 2424function toSelector( tokens ) { 2425 var i = 0, 2426 len = tokens.length, 2427 selector = ""; 2428 for ( ; i < len; i++ ) { 2429 selector += tokens[ i ].value; 2430 } 2431 return selector; 2432} 2433 2434function addCombinator( matcher, combinator, base ) { 2435 var dir = combinator.dir, 2436 skip = combinator.next, 2437 key = skip || dir, 2438 checkNonElements = base && key === "parentNode", 2439 doneName = done++; 2440 2441 return combinator.first ? 2442 2443 // Check against closest ancestor/preceding element 2444 function( elem, context, xml ) { 2445 while ( ( elem = elem[ dir ] ) ) { 2446 if ( elem.nodeType === 1 || checkNonElements ) { 2447 return matcher( elem, context, xml ); 2448 } 2449 } 2450 return false; 2451 } : 2452 2453 // Check against all ancestor/preceding elements 2454 function( elem, context, xml ) { 2455 var oldCache, outerCache, 2456 newCache = [ dirruns, doneName ]; 2457 2458 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 2459 if ( xml ) { 2460 while ( ( elem = elem[ dir ] ) ) { 2461 if ( elem.nodeType === 1 || checkNonElements ) { 2462 if ( matcher( elem, context, xml ) ) { 2463 return true; 2464 } 2465 } 2466 } 2467 } else { 2468 while ( ( elem = elem[ dir ] ) ) { 2469 if ( elem.nodeType === 1 || checkNonElements ) { 2470 outerCache = elem[ expando ] || ( elem[ expando ] = {} ); 2471 2472 if ( skip && nodeName( elem, skip ) ) { 2473 elem = elem[ dir ] || elem; 2474 } else if ( ( oldCache = outerCache[ key ] ) && 2475 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 2476 2477 // Assign to newCache so results back-propagate to previous elements 2478 return ( newCache[ 2 ] = oldCache[ 2 ] ); 2479 } else { 2480 2481 // Reuse newcache so results back-propagate to previous elements 2482 outerCache[ key ] = newCache; 2483 2484 // A match means we're done; a fail means we have to keep checking 2485 if ( ( newCache[ 2 ] = matcher( elem, context, xml ) ) ) { 2486 return true; 2487 } 2488 } 2489 } 2490 } 2491 } 2492 return false; 2493 }; 2494} 2495 2496function elementMatcher( matchers ) { 2497 return matchers.length > 1 ? 2498 function( elem, context, xml ) { 2499 var i = matchers.length; 2500 while ( i-- ) { 2501 if ( !matchers[ i ]( elem, context, xml ) ) { 2502 return false; 2503 } 2504 } 2505 return true; 2506 } : 2507 matchers[ 0 ]; 2508} 2509 2510function multipleContexts( selector, contexts, results ) { 2511 var i = 0, 2512 len = contexts.length; 2513 for ( ; i < len; i++ ) { 2514 find( selector, contexts[ i ], results ); 2515 } 2516 return results; 2517} 2518 2519function condense( unmatched, map, filter, context, xml ) { 2520 var elem, 2521 newUnmatched = [], 2522 i = 0, 2523 len = unmatched.length, 2524 mapped = map != null; 2525 2526 for ( ; i < len; i++ ) { 2527 if ( ( elem = unmatched[ i ] ) ) { 2528 if ( !filter || filter( elem, context, xml ) ) { 2529 newUnmatched.push( elem ); 2530 if ( mapped ) { 2531 map.push( i ); 2532 } 2533 } 2534 } 2535 } 2536 2537 return newUnmatched; 2538} 2539 2540function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 2541 if ( postFilter && !postFilter[ expando ] ) { 2542 postFilter = setMatcher( postFilter ); 2543 } 2544 if ( postFinder && !postFinder[ expando ] ) { 2545 postFinder = setMatcher( postFinder, postSelector ); 2546 } 2547 return markFunction( function( seed, results, context, xml ) { 2548 var temp, i, elem, matcherOut, 2549 preMap = [], 2550 postMap = [], 2551 preexisting = results.length, 2552 2553 // Get initial elements from seed or context 2554 elems = seed || 2555 multipleContexts( selector || "*", 2556 context.nodeType ? [ context ] : context, [] ), 2557 2558 // Prefilter to get matcher input, preserving a map for seed-results synchronization 2559 matcherIn = preFilter && ( seed || !selector ) ? 2560 condense( elems, preMap, preFilter, context, xml ) : 2561 elems; 2562 2563 if ( matcher ) { 2564 2565 // If we have a postFinder, or filtered seed, or non-seed postFilter 2566 // or preexisting results, 2567 matcherOut = postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 2568 2569 // ...intermediate processing is necessary 2570 [] : 2571 2572 // ...otherwise use results directly 2573 results; 2574 2575 // Find primary matches 2576 matcher( matcherIn, matcherOut, context, xml ); 2577 } else { 2578 matcherOut = matcherIn; 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.call( 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 2639function 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.call( checkContext, elem ) > -1; 2652 }, implicitRelative, true ), 2653 matchers = [ function( elem, context, xml ) { 2654 2655 // Support: IE 11+, Edge 17 - 18+ 2656 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2657 // two documents; shallow comparisons work. 2658 // eslint-disable-next-line eqeqeq 2659 var ret = ( !leadingRelative && ( xml || context != outermostContext ) ) || ( 2660 ( checkContext = context ).nodeType ? 2661 matchContext( elem, context, xml ) : 2662 matchAnyContext( elem, context, xml ) ); 2663 2664 // Avoid hanging onto element 2665 // (see https://github.com/jquery/sizzle/issues/299) 2666 checkContext = null; 2667 return ret; 2668 } ]; 2669 2670 for ( ; i < len; i++ ) { 2671 if ( ( matcher = Expr.relative[ tokens[ i ].type ] ) ) { 2672 matchers = [ addCombinator( elementMatcher( matchers ), matcher ) ]; 2673 } else { 2674 matcher = Expr.filter[ tokens[ i ].type ].apply( null, tokens[ i ].matches ); 2675 2676 // Return special upon seeing a positional matcher 2677 if ( matcher[ expando ] ) { 2678 2679 // Find the next relative operator (if any) for proper handling 2680 j = ++i; 2681 for ( ; j < len; j++ ) { 2682 if ( Expr.relative[ tokens[ j ].type ] ) { 2683 break; 2684 } 2685 } 2686 return setMatcher( 2687 i > 1 && elementMatcher( matchers ), 2688 i > 1 && toSelector( 2689 2690 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 2691 tokens.slice( 0, i - 1 ) 2692 .concat( { value: tokens[ i - 2 ].type === " " ? "*" : "" } ) 2693 ).replace( rtrimCSS, "$1" ), 2694 matcher, 2695 i < j && matcherFromTokens( tokens.slice( i, j ) ), 2696 j < len && matcherFromTokens( ( tokens = tokens.slice( j ) ) ), 2697 j < len && toSelector( tokens ) 2698 ); 2699 } 2700 matchers.push( matcher ); 2701 } 2702 } 2703 2704 return elementMatcher( matchers ); 2705} 2706 2707function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 2708 var bySet = setMatchers.length > 0, 2709 byElement = elementMatchers.length > 0, 2710 superMatcher = function( seed, context, xml, results, outermost ) { 2711 var elem, j, matcher, 2712 matchedCount = 0, 2713 i = "0", 2714 unmatched = seed && [], 2715 setMatched = [], 2716 contextBackup = outermostContext, 2717 2718 // We must always have either seed elements or outermost context 2719 elems = seed || byElement && Expr.find.TAG( "*", outermost ), 2720 2721 // Use integer dirruns iff this is the outermost matcher 2722 dirrunsUnique = ( dirruns += contextBackup == null ? 1 : Math.random() || 0.1 ), 2723 len = elems.length; 2724 2725 if ( outermost ) { 2726 2727 // Support: IE 11+, Edge 17 - 18+ 2728 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2729 // two documents; shallow comparisons work. 2730 // eslint-disable-next-line eqeqeq 2731 outermostContext = context == document || context || outermost; 2732 } 2733 2734 // Add elements passing elementMatchers directly to results 2735 // Support: iOS <=7 - 9 only 2736 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching 2737 // elements by id. (see trac-14142) 2738 for ( ; i !== len && ( elem = elems[ i ] ) != null; i++ ) { 2739 if ( byElement && elem ) { 2740 j = 0; 2741 2742 // Support: IE 11+, Edge 17 - 18+ 2743 // IE/Edge sometimes throw a "Permission denied" error when strict-comparing 2744 // two documents; shallow comparisons work. 2745 // eslint-disable-next-line eqeqeq 2746 if ( !context && elem.ownerDocument != document ) { 2747 setDocument( elem ); 2748 xml = !documentIsHTML; 2749 } 2750 while ( ( matcher = elementMatchers[ j++ ] ) ) { 2751 if ( matcher( elem, context || document, xml ) ) { 2752 push.call( results, elem ); 2753 break; 2754 } 2755 } 2756 if ( outermost ) { 2757 dirruns = dirrunsUnique; 2758 } 2759 } 2760 2761 // Track unmatched elements for set filters 2762 if ( bySet ) { 2763 2764 // They will have gone through all possible matchers 2765 if ( ( elem = !matcher && elem ) ) { 2766 matchedCount--; 2767 } 2768 2769 // Lengthen the array for every element, matched or not 2770 if ( seed ) { 2771 unmatched.push( elem ); 2772 } 2773 } 2774 } 2775 2776 // `i` is now the count of elements visited above, and adding it to `matchedCount` 2777 // makes the latter nonnegative. 2778 matchedCount += i; 2779 2780 // Apply set filters to unmatched elements 2781 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 2782 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 2783 // no element matchers and no seed. 2784 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 2785 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 2786 // numerically zero. 2787 if ( bySet && i !== matchedCount ) { 2788 j = 0; 2789 while ( ( matcher = setMatchers[ j++ ] ) ) { 2790 matcher( unmatched, setMatched, context, xml ); 2791 } 2792 2793 if ( seed ) { 2794 2795 // Reintegrate element matches to eliminate the need for sorting 2796 if ( matchedCount > 0 ) { 2797 while ( i-- ) { 2798 if ( !( unmatched[ i ] || setMatched[ i ] ) ) { 2799 setMatched[ i ] = pop.call( results ); 2800 } 2801 } 2802 } 2803 2804 // Discard index placeholder values to get only actual matches 2805 setMatched = condense( setMatched ); 2806 } 2807 2808 // Add matches to results 2809 push.apply( results, setMatched ); 2810 2811 // Seedless set matches succeeding multiple successful matchers stipulate sorting 2812 if ( outermost && !seed && setMatched.length > 0 && 2813 ( matchedCount + setMatchers.length ) > 1 ) { 2814 2815 jQuery.uniqueSort( results ); 2816 } 2817 } 2818 2819 // Override manipulation of globals by nested matchers 2820 if ( outermost ) { 2821 dirruns = dirrunsUnique; 2822 outermostContext = contextBackup; 2823 } 2824 2825 return unmatched; 2826 }; 2827 2828 return bySet ? 2829 markFunction( superMatcher ) : 2830 superMatcher; 2831} 2832 2833function compile( selector, match /* Internal Use Only */ ) { 2834 var i, 2835 setMatchers = [], 2836 elementMatchers = [], 2837 cached = compilerCache[ selector + " " ]; 2838 2839 if ( !cached ) { 2840 2841 // Generate a function of recursive functions that can be used to check each element 2842 if ( !match ) { 2843 match = tokenize( selector ); 2844 } 2845 i = match.length; 2846 while ( i-- ) { 2847 cached = matcherFromTokens( match[ i ] ); 2848 if ( cached[ expando ] ) { 2849 setMatchers.push( cached ); 2850 } else { 2851 elementMatchers.push( cached ); 2852 } 2853 } 2854 2855 // Cache the compiled function 2856 cached = compilerCache( selector, 2857 matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 2858 2859 // Save selector and tokenization 2860 cached.selector = selector; 2861 } 2862 return cached; 2863} 2864 2865/** 2866 * A low-level selection function that works with jQuery's compiled 2867 * selector functions 2868 * @param {String|Function} selector A selector or a pre-compiled 2869 * selector function built with jQuery selector compile 2870 * @param {Element} context 2871 * @param {Array} [results] 2872 * @param {Array} [seed] A set of elements to match against 2873 */ 2874function select( selector, context, results, seed ) { 2875 var i, tokens, token, type, find, 2876 compiled = typeof selector === "function" && selector, 2877 match = !seed && tokenize( ( selector = compiled.selector || selector ) ); 2878 2879 results = results || []; 2880 2881 // Try to minimize operations if there is only one selector in the list and no seed 2882 // (the latter of which guarantees us context) 2883 if ( match.length === 1 ) { 2884 2885 // Reduce context if the leading compound selector is an ID 2886 tokens = match[ 0 ] = match[ 0 ].slice( 0 ); 2887 if ( tokens.length > 2 && ( token = tokens[ 0 ] ).type === "ID" && 2888 context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[ 1 ].type ] ) { 2889 2890 context = ( Expr.find.ID( 2891 token.matches[ 0 ].replace( runescape, funescape ), 2892 context 2893 ) || [] )[ 0 ]; 2894 if ( !context ) { 2895 return results; 2896 2897 // Precompiled matchers will still verify ancestry, so step up a level 2898 } else if ( compiled ) { 2899 context = context.parentNode; 2900 } 2901 2902 selector = selector.slice( tokens.shift().value.length ); 2903 } 2904 2905 // Fetch a seed set for right-to-left matching 2906 i = matchExpr.needsContext.test( selector ) ? 0 : tokens.length; 2907 while ( i-- ) { 2908 token = tokens[ i ]; 2909 2910 // Abort if we hit a combinator 2911 if ( Expr.relative[ ( type = token.type ) ] ) { 2912 break; 2913 } 2914 if ( ( find = Expr.find[ type ] ) ) { 2915 2916 // Search, expanding context for leading sibling combinators 2917 if ( ( seed = find( 2918 token.matches[ 0 ].replace( runescape, funescape ), 2919 rsibling.test( tokens[ 0 ].type ) && 2920 testContext( context.parentNode ) || context 2921 ) ) ) { 2922 2923 // If seed is empty or no tokens remain, we can return early 2924 tokens.splice( i, 1 ); 2925 selector = seed.length && toSelector( tokens ); 2926 if ( !selector ) { 2927 push.apply( results, seed ); 2928 return results; 2929 } 2930 2931 break; 2932 } 2933 } 2934 } 2935 } 2936 2937 // Compile and execute a filtering function if one is not provided 2938 // Provide `match` to avoid retokenization if we modified the selector above 2939 ( compiled || compile( selector, match ) )( 2940 seed, 2941 context, 2942 !documentIsHTML, 2943 results, 2944 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 2945 ); 2946 return results; 2947} 2948 2949// One-time assignments 2950 2951// Support: Android <=4.0 - 4.1+ 2952// Sort stability 2953support.sortStable = expando.split( "" ).sort( sortOrder ).join( "" ) === expando; 2954 2955// Initialize against the default document 2956setDocument(); 2957 2958// Support: Android <=4.0 - 4.1+ 2959// Detached nodes confoundingly follow *each other* 2960support.sortDetached = assert( function( el ) { 2961 2962 // Should return 1, but returns 4 (following) 2963 return el.compareDocumentPosition( document.createElement( "fieldset" ) ) & 1; 2964} ); 2965 2966jQuery.find = find; 2967 2968// Deprecated 2969jQuery.expr[ ":" ] = jQuery.expr.pseudos; 2970jQuery.unique = jQuery.uniqueSort; 2971 2972// These have always been private, but they used to be documented as part of 2973// Sizzle so let's maintain them for now for backwards compatibility purposes. 2974find.compile = compile; 2975find.select = select; 2976find.setDocument = setDocument; 2977find.tokenize = tokenize; 2978 2979find.escape = jQuery.escapeSelector; 2980find.getText = jQuery.text; 2981find.isXML = jQuery.isXMLDoc; 2982find.selectors = jQuery.expr; 2983find.support = jQuery.support; 2984find.uniqueSort = jQuery.uniqueSort; 2985 2986 /* eslint-enable */ 2987 2988} )(); 2989 2990 2991var dir = function( elem, dir, until ) { 2992 var matched = [], 2993 truncate = until !== undefined; 2994 2995 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 2996 if ( elem.nodeType === 1 ) { 2997 if ( truncate && jQuery( elem ).is( until ) ) { 2998 break; 2999 } 3000 matched.push( elem ); 3001 } 3002 } 3003 return matched; 3004}; 3005 3006 3007var siblings = function( n, elem ) { 3008 var matched = []; 3009 3010 for ( ; n; n = n.nextSibling ) { 3011 if ( n.nodeType === 1 && n !== elem ) { 3012 matched.push( n ); 3013 } 3014 } 3015 3016 return matched; 3017}; 3018 3019 3020var rneedsContext = jQuery.expr.match.needsContext; 3021 3022var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i ); 3023 3024 3025 3026// Implement the identical functionality for filter and not 3027function winnow( elements, qualifier, not ) { 3028 if ( isFunction( qualifier ) ) { 3029 return jQuery.grep( elements, function( elem, i ) { 3030 return !!qualifier.call( elem, i, elem ) !== not; 3031 } ); 3032 } 3033 3034 // Single element 3035 if ( qualifier.nodeType ) { 3036 return jQuery.grep( elements, function( elem ) { 3037 return ( elem === qualifier ) !== not; 3038 } ); 3039 } 3040 3041 // Arraylike of elements (jQuery, arguments, Array) 3042 if ( typeof qualifier !== "string" ) { 3043 return jQuery.grep( elements, function( elem ) { 3044 return ( indexOf.call( qualifier, elem ) > -1 ) !== not; 3045 } ); 3046 } 3047 3048 // Filtered directly for both simple and complex selectors 3049 return jQuery.filter( qualifier, elements, not ); 3050} 3051 3052jQuery.filter = function( expr, elems, not ) { 3053 var elem = elems[ 0 ]; 3054 3055 if ( not ) { 3056 expr = ":not(" + expr + ")"; 3057 } 3058 3059 if ( elems.length === 1 && elem.nodeType === 1 ) { 3060 return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : []; 3061 } 3062 3063 return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 3064 return elem.nodeType === 1; 3065 } ) ); 3066}; 3067 3068jQuery.fn.extend( { 3069 find: function( selector ) { 3070 var i, ret, 3071 len = this.length, 3072 self = this; 3073 3074 if ( typeof selector !== "string" ) { 3075 return this.pushStack( jQuery( selector ).filter( function() { 3076 for ( i = 0; i < len; i++ ) { 3077 if ( jQuery.contains( self[ i ], this ) ) { 3078 return true; 3079 } 3080 } 3081 } ) ); 3082 } 3083 3084 ret = this.pushStack( [] ); 3085 3086 for ( i = 0; i < len; i++ ) { 3087 jQuery.find( selector, self[ i ], ret ); 3088 } 3089 3090 return len > 1 ? jQuery.uniqueSort( ret ) : ret; 3091 }, 3092 filter: function( selector ) { 3093 return this.pushStack( winnow( this, selector || [], false ) ); 3094 }, 3095 not: function( selector ) { 3096 return this.pushStack( winnow( this, selector || [], true ) ); 3097 }, 3098 is: function( selector ) { 3099 return !!winnow( 3100 this, 3101 3102 // If this is a positional/relative selector, check membership in the returned set 3103 // so $("p:first").is("p:last") won't return true for a doc with two "p". 3104 typeof selector === "string" && rneedsContext.test( selector ) ? 3105 jQuery( selector ) : 3106 selector || [], 3107 false 3108 ).length; 3109 } 3110} ); 3111 3112 3113// Initialize a jQuery object 3114 3115 3116// A central reference to the root jQuery(document) 3117var rootjQuery, 3118 3119 // A simple way to check for HTML strings 3120 // Prioritize #id over <tag> to avoid XSS via location.hash (trac-9521) 3121 // Strict HTML recognition (trac-11290: must start with <) 3122 // Shortcut simple #id case for speed 3123 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, 3124 3125 init = jQuery.fn.init = function( selector, context, root ) { 3126 var match, elem; 3127 3128 // HANDLE: $(""), $(null), $(undefined), $(false) 3129 if ( !selector ) { 3130 return this; 3131 } 3132 3133 // Method init() accepts an alternate rootjQuery 3134 // so migrate can support jQuery.sub (gh-2101) 3135 root = root || rootjQuery; 3136 3137 // Handle HTML strings 3138 if ( typeof selector === "string" ) { 3139 if ( selector[ 0 ] === "<" && 3140 selector[ selector.length - 1 ] === ">" && 3141 selector.length >= 3 ) { 3142 3143 // Assume that strings that start and end with <> are HTML and skip the regex check 3144 match = [ null, selector, null ]; 3145 3146 } else { 3147 match = rquickExpr.exec( selector ); 3148 } 3149 3150 // Match html or make sure no context is specified for #id 3151 if ( match && ( match[ 1 ] || !context ) ) { 3152 3153 // HANDLE: $(html) -> $(array) 3154 if ( match[ 1 ] ) { 3155 context = context instanceof jQuery ? context[ 0 ] : context; 3156 3157 // Option to run scripts is true for back-compat 3158 // Intentionally let the error be thrown if parseHTML is not present 3159 jQuery.merge( this, jQuery.parseHTML( 3160 match[ 1 ], 3161 context && context.nodeType ? context.ownerDocument || context : document, 3162 true 3163 ) ); 3164 3165 // HANDLE: $(html, props) 3166 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 3167 for ( match in context ) { 3168 3169 // Properties of context are called as methods if possible 3170 if ( isFunction( this[ match ] ) ) { 3171 this[ match ]( context[ match ] ); 3172 3173 // ...and otherwise set as attributes 3174 } else { 3175 this.attr( match, context[ match ] ); 3176 } 3177 } 3178 } 3179 3180 return this; 3181 3182 // HANDLE: $(#id) 3183 } else { 3184 elem = document.getElementById( match[ 2 ] ); 3185 3186 if ( elem ) { 3187 3188 // Inject the element directly into the jQuery object 3189 this[ 0 ] = elem; 3190 this.length = 1; 3191 } 3192 return this; 3193 } 3194 3195 // HANDLE: $(expr, $(...)) 3196 } else if ( !context || context.jquery ) { 3197 return ( context || root ).find( selector ); 3198 3199 // HANDLE: $(expr, context) 3200 // (which is just equivalent to: $(context).find(expr) 3201 } else { 3202 return this.constructor( context ).find( selector ); 3203 } 3204 3205 // HANDLE: $(DOMElement) 3206 } else if ( selector.nodeType ) { 3207 this[ 0 ] = selector; 3208 this.length = 1; 3209 return this; 3210 3211 // HANDLE: $(function) 3212 // Shortcut for document ready 3213 } else if ( isFunction( selector ) ) { 3214 return root.ready !== undefined ? 3215 root.ready( selector ) : 3216 3217 // Execute immediately if ready is not present 3218 selector( jQuery ); 3219 } 3220 3221 return jQuery.makeArray( selector, this ); 3222 }; 3223 3224// Give the init function the jQuery prototype for later instantiation 3225init.prototype = jQuery.fn; 3226 3227// Initialize central reference 3228rootjQuery = jQuery( document ); 3229 3230 3231var rparentsprev = /^(?:parents|prev(?:Until|All))/, 3232 3233 // Methods guaranteed to produce a unique set when starting from a unique set 3234 guaranteedUnique = { 3235 children: true, 3236 contents: true, 3237 next: true, 3238 prev: true 3239 }; 3240 3241jQuery.fn.extend( { 3242 has: function( target ) { 3243 var targets = jQuery( target, this ), 3244 l = targets.length; 3245 3246 return this.filter( function() { 3247 var i = 0; 3248 for ( ; i < l; i++ ) { 3249 if ( jQuery.contains( this, targets[ i ] ) ) { 3250 return true; 3251 } 3252 } 3253 } ); 3254 }, 3255 3256 closest: function( selectors, context ) { 3257 var cur, 3258 i = 0, 3259 l = this.length, 3260 matched = [], 3261 targets = typeof selectors !== "string" && jQuery( selectors ); 3262 3263 // Positional selectors never match, since there's no _selection_ context 3264 if ( !rneedsContext.test( selectors ) ) { 3265 for ( ; i < l; i++ ) { 3266 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 3267 3268 // Always skip document fragments 3269 if ( cur.nodeType < 11 && ( targets ? 3270 targets.index( cur ) > -1 : 3271 3272 // Don't pass non-elements to jQuery#find 3273 cur.nodeType === 1 && 3274 jQuery.find.matchesSelector( cur, selectors ) ) ) { 3275 3276 matched.push( cur ); 3277 break; 3278 } 3279 } 3280 } 3281 } 3282 3283 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 3284 }, 3285 3286 // Determine the position of an element within the set 3287 index: function( elem ) { 3288 3289 // No argument, return index in parent 3290 if ( !elem ) { 3291 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 3292 } 3293 3294 // Index in selector 3295 if ( typeof elem === "string" ) { 3296 return indexOf.call( jQuery( elem ), this[ 0 ] ); 3297 } 3298 3299 // Locate the position of the desired element 3300 return indexOf.call( this, 3301 3302 // If it receives a jQuery object, the first element is used 3303 elem.jquery ? elem[ 0 ] : elem 3304 ); 3305 }, 3306 3307 add: function( selector, context ) { 3308 return this.pushStack( 3309 jQuery.uniqueSort( 3310 jQuery.merge( this.get(), jQuery( selector, context ) ) 3311 ) 3312 ); 3313 }, 3314 3315 addBack: function( selector ) { 3316 return this.add( selector == null ? 3317 this.prevObject : this.prevObject.filter( selector ) 3318 ); 3319 } 3320} ); 3321 3322function sibling( cur, dir ) { 3323 while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {} 3324 return cur; 3325} 3326 3327jQuery.each( { 3328 parent: function( elem ) { 3329 var parent = elem.parentNode; 3330 return parent && parent.nodeType !== 11 ? parent : null; 3331 }, 3332 parents: function( elem ) { 3333 return dir( elem, "parentNode" ); 3334 }, 3335 parentsUntil: function( elem, _i, until ) { 3336 return dir( elem, "parentNode", until ); 3337 }, 3338 next: function( elem ) { 3339 return sibling( elem, "nextSibling" ); 3340 }, 3341 prev: function( elem ) { 3342 return sibling( elem, "previousSibling" ); 3343 }, 3344 nextAll: function( elem ) { 3345 return dir( elem, "nextSibling" ); 3346 }, 3347 prevAll: function( elem ) { 3348 return dir( elem, "previousSibling" ); 3349 }, 3350 nextUntil: function( elem, _i, until ) { 3351 return dir( elem, "nextSibling", until ); 3352 }, 3353 prevUntil: function( elem, _i, until ) { 3354 return dir( elem, "previousSibling", until ); 3355 }, 3356 siblings: function( elem ) { 3357 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 3358 }, 3359 children: function( elem ) { 3360 return siblings( elem.firstChild ); 3361 }, 3362 contents: function( elem ) { 3363 if ( elem.contentDocument != null && 3364 3365 // Support: IE 11+ 3366 // <object> elements with no `data` attribute has an object 3367 // `contentDocument` with a `null` prototype. 3368 getProto( elem.contentDocument ) ) { 3369 3370 return elem.contentDocument; 3371 } 3372 3373 // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only 3374 // Treat the template element as a regular one in browsers that 3375 // don't support it. 3376 if ( nodeName( elem, "template" ) ) { 3377 elem = elem.content || elem; 3378 } 3379 3380 return jQuery.merge( [], elem.childNodes ); 3381 } 3382}, function( name, fn ) { 3383 jQuery.fn[ name ] = function( until, selector ) { 3384 var matched = jQuery.map( this, fn, until ); 3385 3386 if ( name.slice( -5 ) !== "Until" ) { 3387 selector = until; 3388 } 3389 3390 if ( selector && typeof selector === "string" ) { 3391 matched = jQuery.filter( selector, matched ); 3392 } 3393 3394 if ( this.length > 1 ) { 3395 3396 // Remove duplicates 3397 if ( !guaranteedUnique[ name ] ) { 3398 jQuery.uniqueSort( matched ); 3399 } 3400 3401 // Reverse order for parents* and prev-derivatives 3402 if ( rparentsprev.test( name ) ) { 3403 matched.reverse(); 3404 } 3405 } 3406 3407 return this.pushStack( matched ); 3408 }; 3409} ); 3410var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g ); 3411 3412 3413 3414// Convert String-formatted options into Object-formatted ones 3415function createOptions( options ) { 3416 var object = {}; 3417 jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) { 3418 object[ flag ] = true; 3419 } ); 3420 return object; 3421} 3422 3423/* 3424 * Create a callback list using the following parameters: 3425 * 3426 * options: an optional list of space-separated options that will change how 3427 * the callback list behaves or a more traditional option object 3428 * 3429 * By default a callback list will act like an event callback list and can be 3430 * "fired" multiple times. 3431 * 3432 * Possible options: 3433 * 3434 * once: will ensure the callback list can only be fired once (like a Deferred) 3435 * 3436 * memory: will keep track of previous values and will call any callback added 3437 * after the list has been fired right away with the latest "memorized" 3438 * values (like a Deferred) 3439 * 3440 * unique: will ensure a callback can only be added once (no duplicate in the list) 3441 * 3442 * stopOnFalse: interrupt callings when a callback returns false 3443 * 3444 */ 3445jQuery.Callbacks = function( options ) { 3446 3447 // Convert options from String-formatted to Object-formatted if needed 3448 // (we check in cache first) 3449 options = typeof options === "string" ? 3450 createOptions( options ) : 3451 jQuery.extend( {}, options ); 3452 3453 var // Flag to know if list is currently firing 3454 firing, 3455 3456 // Last fire value for non-forgettable lists 3457 memory, 3458 3459 // Flag to know if list was already fired 3460 fired, 3461 3462 // Flag to prevent firing 3463 locked, 3464 3465 // Actual callback list 3466 list = [], 3467 3468 // Queue of execution data for repeatable lists 3469 queue = [], 3470 3471 // Index of currently firing callback (modified by add/remove as needed) 3472 firingIndex = -1, 3473 3474 // Fire callbacks 3475 fire = function() { 3476 3477 // Enforce single-firing 3478 locked = locked || options.once; 3479 3480 // Execute callbacks for all pending executions, 3481 // respecting firingIndex overrides and runtime changes 3482 fired = firing = true; 3483 for ( ; queue.length; firingIndex = -1 ) { 3484 memory = queue.shift(); 3485 while ( ++firingIndex < list.length ) { 3486 3487 // Run callback and check for early termination 3488 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 3489 options.stopOnFalse ) { 3490 3491 // Jump to end and forget the data so .add doesn't re-fire 3492 firingIndex = list.length; 3493 memory = false;
vendor: 4,918 bytes, lines 3494-3703
3494 } 3495 } 3496 } 3497 3498 // Forget the data if we're done with it 3499 if ( !options.memory ) { 3500 memory = false; 3501 } 3502 3503 firing = false; 3504 3505 // Clean up if we're done firing for good 3506 if ( locked ) { 3507 3508 // Keep an empty list if we have data for future add calls 3509 if ( memory ) { 3510 list = []; 3511 3512 // Otherwise, this object is spent 3513 } else { 3514 list = ""; 3515 } 3516 } 3517 }, 3518 3519 // Actual Callbacks object 3520 self = { 3521 3522 // Add a callback or a collection of callbacks to the list 3523 add: function() { 3524 if ( list ) { 3525 3526 // If we have memory from a past run, we should fire after adding 3527 if ( memory && !firing ) { 3528 firingIndex = list.length - 1; 3529 queue.push( memory ); 3530 } 3531 3532 ( function add( args ) { 3533 jQuery.each( args, function( _, arg ) { 3534 if ( isFunction( arg ) ) { 3535 if ( !options.unique || !self.has( arg ) ) { 3536 list.push( arg ); 3537 } 3538 } else if ( arg && arg.length && toType( arg ) !== "string" ) { 3539 3540 // Inspect recursively 3541 add( arg ); 3542 } 3543 } ); 3544 } )( arguments ); 3545 3546 if ( memory && !firing ) { 3547 fire(); 3548 } 3549 } 3550 return this; 3551 }, 3552 3553 // Remove a callback from the list 3554 remove: function() { 3555 jQuery.each( arguments, function( _, arg ) { 3556 var index; 3557 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 3558 list.splice( index, 1 ); 3559 3560 // Handle firing indexes 3561 if ( index <= firingIndex ) { 3562 firingIndex--; 3563 } 3564 } 3565 } ); 3566 return this; 3567 }, 3568 3569 // Check if a given callback is in the list. 3570 // If no argument is given, return whether or not list has callbacks attached. 3571 has: function( fn ) { 3572 return fn ? 3573 jQuery.inArray( fn, list ) > -1 : 3574 list.length > 0; 3575 }, 3576 3577 // Remove all callbacks from the list 3578 empty: function() { 3579 if ( list ) { 3580 list = []; 3581 } 3582 return this; 3583 }, 3584 3585 // Disable .fire and .add 3586 // Abort any current/pending executions 3587 // Clear all callbacks and values 3588 disable: function() { 3589 locked = queue = []; 3590 list = memory = ""; 3591 return this; 3592 }, 3593 disabled: function() { 3594 return !list; 3595 }, 3596 3597 // Disable .fire 3598 // Also disable .add unless we have memory (since it would have no effect) 3599 // Abort any pending executions 3600 lock: function() { 3601 locked = queue = []; 3602 if ( !memory && !firing ) { 3603 list = memory = ""; 3604 } 3605 return this; 3606 }, 3607 locked: function() { 3608 return !!locked; 3609 }, 3610 3611 // Call all callbacks with the given context and arguments 3612 fireWith: function( context, args ) { 3613 if ( !locked ) { 3614 args = args || []; 3615 args = [ context, args.slice ? args.slice() : args ]; 3616 queue.push( args ); 3617 if ( !firing ) { 3618 fire(); 3619 } 3620 } 3621 return this; 3622 }, 3623 3624 // Call all the callbacks with the given arguments 3625 fire: function() { 3626 self.fireWith( this, arguments ); 3627 return this; 3628 }, 3629 3630 // To know if the callbacks have already been called at least once 3631 fired: function() { 3632 return !!fired; 3633 } 3634 }; 3635 3636 return self; 3637}; 3638 3639 3640function Identity( v ) { 3641 return v; 3642} 3643function Thrower( ex ) { 3644 throw ex; 3645} 3646 3647function adoptValue( value, resolve, reject, noValue ) { 3648 var method; 3649 3650 try { 3651 3652 // Check for promise aspect first to privilege synchronous behavior 3653 if ( value && isFunction( ( method = value.promise ) ) ) { 3654 method.call( value ).done( resolve ).fail( reject ); 3655 3656 // Other thenables 3657 } else if ( value && isFunction( ( method = value.then ) ) ) { 3658 method.call( value, resolve, reject ); 3659 3660 // Other non-thenables 3661 } else { 3662 3663 // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer: 3664 // * false: [ value ].slice( 0 ) => resolve( value ) 3665 // * true: [ value ].slice( 1 ) => resolve() 3666 resolve.apply( undefined, [ value ].slice( noValue ) ); 3667 } 3668 3669 // For Promises/A+, convert exceptions into rejections 3670 // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in 3671 // Deferred#then to conditionally suppress rejection. 3672 } catch ( value ) { 3673 3674 // Support: Android 4.0 only 3675 // Strict mode functions invoked without .call/.apply get global-object context 3676 reject.apply( undefined, [ value ] ); 3677 } 3678} 3679 3680jQuery.extend( { 3681 3682 Deferred: function( func ) { 3683 var tuples = [ 3684 3685 // action, add listener, callbacks, 3686 // ... .then handlers, argument index, [final state] 3687 [ "notify", "progress", jQuery.Callbacks( "memory" ), 3688 jQuery.Callbacks( "memory" ), 2 ], 3689 [ "resolve", "done", jQuery.Callbacks( "once memory" ), 3690 jQuery.Callbacks( "once memory" ), 0, "resolved" ], 3691 [ "reject", "fail", jQuery.Callbacks( "once memory" ), 3692 jQuery.Callbacks( "once memory" ), 1, "rejected" ] 3693 ], 3694 state = "pending", 3695 promise = { 3696 state: function() { 3697 return state; 3698 }, 3699 always: function() { 3700 deferred.done( arguments ).fail( arguments ); 3701 return this; 3702 }, 3703 "catch": function( fn ) {
vendor: 70,494 bytes, lines 3704-6315
3704 return promise.then( null, fn ); 3705 }, 3706 3707 // Keep pipe for back-compat 3708 pipe: function( /* fnDone, fnFail, fnProgress */ ) { 3709 var fns = arguments; 3710 3711 return jQuery.Deferred( function( newDefer ) { 3712 jQuery.each( tuples, function( _i, tuple ) { 3713 3714 // Map tuples (progress, done, fail) to arguments (done, fail, progress) 3715 var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ]; 3716 3717 // deferred.progress(function() { bind to newDefer or newDefer.notify }) 3718 // deferred.done(function() { bind to newDefer or newDefer.resolve }) 3719 // deferred.fail(function() { bind to newDefer or newDefer.reject }) 3720 deferred[ tuple[ 1 ] ]( function() { 3721 var returned = fn && fn.apply( this, arguments ); 3722 if ( returned && isFunction( returned.promise ) ) { 3723 returned.promise() 3724 .progress( newDefer.notify ) 3725 .done( newDefer.resolve ) 3726 .fail( newDefer.reject ); 3727 } else { 3728 newDefer[ tuple[ 0 ] + "With" ]( 3729 this, 3730 fn ? [ returned ] : arguments 3731 ); 3732 } 3733 } ); 3734 } ); 3735 fns = null; 3736 } ).promise(); 3737 }, 3738 then: function( onFulfilled, onRejected, onProgress ) { 3739 var maxDepth = 0; 3740 function resolve( depth, deferred, handler, special ) { 3741 return function() { 3742 var that = this, 3743 args = arguments, 3744 mightThrow = function() { 3745 var returned, then; 3746 3747 // Support: Promises/A+ section 2.3.3.3.3 3748 // https://promisesaplus.com/#point-59 3749 // Ignore double-resolution attempts 3750 if ( depth < maxDepth ) { 3751 return; 3752 } 3753 3754 returned = handler.apply( that, args ); 3755 3756 // Support: Promises/A+ section 2.3.1 3757 // https://promisesaplus.com/#point-48 3758 if ( returned === deferred.promise() ) { 3759 throw new TypeError( "Thenable self-resolution" ); 3760 } 3761 3762 // Support: Promises/A+ sections 2.3.3.1, 3.5 3763 // https://promisesaplus.com/#point-54 3764 // https://promisesaplus.com/#point-75 3765 // Retrieve `then` only once 3766 then = returned && 3767 3768 // Support: Promises/A+ section 2.3.4 3769 // https://promisesaplus.com/#point-64 3770 // Only check objects and functions for thenability 3771 ( typeof returned === "object" || 3772 typeof returned === "function" ) && 3773 returned.then; 3774 3775 // Handle a returned thenable 3776 if ( isFunction( then ) ) { 3777 3778 // Special processors (notify) just wait for resolution 3779 if ( special ) { 3780 then.call( 3781 returned, 3782 resolve( maxDepth, deferred, Identity, special ), 3783 resolve( maxDepth, deferred, Thrower, special ) 3784 ); 3785 3786 // Normal processors (resolve) also hook into progress 3787 } else { 3788 3789 // ...and disregard older resolution values 3790 maxDepth++; 3791 3792 then.call( 3793 returned, 3794 resolve( maxDepth, deferred, Identity, special ), 3795 resolve( maxDepth, deferred, Thrower, special ), 3796 resolve( maxDepth, deferred, Identity, 3797 deferred.notifyWith ) 3798 ); 3799 } 3800 3801 // Handle all other returned values 3802 } else { 3803 3804 // Only substitute handlers pass on context 3805 // and multiple values (non-spec behavior) 3806 if ( handler !== Identity ) { 3807 that = undefined; 3808 args = [ returned ]; 3809 } 3810 3811 // Process the value(s) 3812 // Default process is resolve 3813 ( special || deferred.resolveWith )( that, args ); 3814 } 3815 }, 3816 3817 // Only normal processors (resolve) catch and reject exceptions 3818 process = special ? 3819 mightThrow : 3820 function() { 3821 try { 3822 mightThrow(); 3823 } catch ( e ) { 3824 3825 if ( jQuery.Deferred.exceptionHook ) { 3826 jQuery.Deferred.exceptionHook( e, 3827 process.error ); 3828 } 3829 3830 // Support: Promises/A+ section 2.3.3.3.4.1 3831 // https://promisesaplus.com/#point-61 3832 // Ignore post-resolution exceptions 3833 if ( depth + 1 >= maxDepth ) { 3834 3835 // Only substitute handlers pass on context 3836 // and multiple values (non-spec behavior) 3837 if ( handler !== Thrower ) { 3838 that = undefined; 3839 args = [ e ]; 3840 } 3841 3842 deferred.rejectWith( that, args ); 3843 } 3844 } 3845 }; 3846 3847 // Support: Promises/A+ section 2.3.3.3.1 3848 // https://promisesaplus.com/#point-57 3849 // Re-resolve promises immediately to dodge false rejection from 3850 // subsequent errors 3851 if ( depth ) { 3852 process(); 3853 } else { 3854 3855 // Call an optional hook to record the error, in case of exception 3856 // since it's otherwise lost when execution goes async 3857 if ( jQuery.Deferred.getErrorHook ) { 3858 process.error = jQuery.Deferred.getErrorHook(); 3859 3860 // The deprecated alias of the above. While the name suggests 3861 // returning the stack, not an error instance, jQuery just passes 3862 // it directly to `console.warn` so both will work; an instance 3863 // just better cooperates with source maps. 3864 } else if ( jQuery.Deferred.getStackHook ) { 3865 process.error = jQuery.Deferred.getStackHook(); 3866 } 3867 window.setTimeout( process ); 3868 } 3869 }; 3870 } 3871 3872 return jQuery.Deferred( function( newDefer ) { 3873 3874 // progress_handlers.add( ... ) 3875 tuples[ 0 ][ 3 ].add( 3876 resolve( 3877 0, 3878 newDefer, 3879 isFunction( onProgress ) ? 3880 onProgress : 3881 Identity, 3882 newDefer.notifyWith 3883 ) 3884 ); 3885 3886 // fulfilled_handlers.add( ... ) 3887 tuples[ 1 ][ 3 ].add( 3888 resolve( 3889 0, 3890 newDefer, 3891 isFunction( onFulfilled ) ? 3892 onFulfilled : 3893 Identity 3894 ) 3895 ); 3896 3897 // rejected_handlers.add( ... ) 3898 tuples[ 2 ][ 3 ].add( 3899 resolve( 3900 0, 3901 newDefer, 3902 isFunction( onRejected ) ? 3903 onRejected : 3904 Thrower 3905 ) 3906 ); 3907 } ).promise(); 3908 }, 3909 3910 // Get a promise for this deferred 3911 // If obj is provided, the promise aspect is added to the object 3912 promise: function( obj ) { 3913 return obj != null ? jQuery.extend( obj, promise ) : promise; 3914 } 3915 }, 3916 deferred = {}; 3917 3918 // Add list-specific methods 3919 jQuery.each( tuples, function( i, tuple ) { 3920 var list = tuple[ 2 ], 3921 stateString = tuple[ 5 ]; 3922 3923 // promise.progress = list.add 3924 // promise.done = list.add 3925 // promise.fail = list.add 3926 promise[ tuple[ 1 ] ] = list.add; 3927 3928 // Handle state 3929 if ( stateString ) { 3930 list.add( 3931 function() { 3932 3933 // state = "resolved" (i.e., fulfilled) 3934 // state = "rejected" 3935 state = stateString; 3936 }, 3937 3938 // rejected_callbacks.disable 3939 // fulfilled_callbacks.disable 3940 tuples[ 3 - i ][ 2 ].disable, 3941 3942 // rejected_handlers.disable 3943 // fulfilled_handlers.disable 3944 tuples[ 3 - i ][ 3 ].disable, 3945 3946 // progress_callbacks.lock 3947 tuples[ 0 ][ 2 ].lock, 3948 3949 // progress_handlers.lock 3950 tuples[ 0 ][ 3 ].lock 3951 ); 3952 } 3953 3954 // progress_handlers.fire 3955 // fulfilled_handlers.fire 3956 // rejected_handlers.fire 3957 list.add( tuple[ 3 ].fire ); 3958 3959 // deferred.notify = function() { deferred.notifyWith(...) } 3960 // deferred.resolve = function() { deferred.resolveWith(...) } 3961 // deferred.reject = function() { deferred.rejectWith(...) } 3962 deferred[ tuple[ 0 ] ] = function() { 3963 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments ); 3964 return this; 3965 }; 3966 3967 // deferred.notifyWith = list.fireWith 3968 // deferred.resolveWith = list.fireWith 3969 // deferred.rejectWith = list.fireWith 3970 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 3971 } ); 3972 3973 // Make the deferred a promise 3974 promise.promise( deferred ); 3975 3976 // Call given func if any 3977 if ( func ) { 3978 func.call( deferred, deferred ); 3979 } 3980 3981 // All done! 3982 return deferred; 3983 }, 3984 3985 // Deferred helper 3986 when: function( singleValue ) { 3987 var 3988 3989 // count of uncompleted subordinates 3990 remaining = arguments.length, 3991 3992 // count of unprocessed arguments 3993 i = remaining, 3994 3995 // subordinate fulfillment data 3996 resolveContexts = Array( i ), 3997 resolveValues = slice.call( arguments ), 3998 3999 // the primary Deferred 4000 primary = jQuery.Deferred(), 4001 4002 // subordinate callback factory 4003 updateFunc = function( i ) { 4004 return function( value ) { 4005 resolveContexts[ i ] = this; 4006 resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 4007 if ( !( --remaining ) ) { 4008 primary.resolveWith( resolveContexts, resolveValues ); 4009 } 4010 }; 4011 }; 4012 4013 // Single- and empty arguments are adopted like Promise.resolve 4014 if ( remaining <= 1 ) { 4015 adoptValue( singleValue, primary.done( updateFunc( i ) ).resolve, primary.reject, 4016 !remaining ); 4017 4018 // Use .then() to unwrap secondary thenables (cf. gh-3000) 4019 if ( primary.state() === "pending" || 4020 isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) { 4021 4022 return primary.then(); 4023 } 4024 } 4025 4026 // Multiple arguments are aggregated like Promise.all array elements 4027 while ( i-- ) { 4028 adoptValue( resolveValues[ i ], updateFunc( i ), primary.reject ); 4029 } 4030 4031 return primary.promise(); 4032 } 4033} ); 4034 4035 4036// These usually indicate a programmer mistake during development, 4037// warn about them ASAP rather than swallowing them by default. 4038var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/; 4039 4040// If `jQuery.Deferred.getErrorHook` is defined, `asyncError` is an error 4041// captured before the async barrier to get the original error cause 4042// which may otherwise be hidden. 4043jQuery.Deferred.exceptionHook = function( error, asyncError ) { 4044 4045 // Support: IE 8 - 9 only 4046 // Console exists when dev tools are open, which can happen at any time 4047 if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) { 4048 window.console.warn( "jQuery.Deferred exception: " + error.message, 4049 error.stack, asyncError ); 4050 } 4051}; 4052 4053 4054 4055 4056jQuery.readyException = function( error ) { 4057 window.setTimeout( function() { 4058 throw error; 4059 } ); 4060}; 4061 4062 4063 4064 4065// The deferred used on DOM ready 4066var readyList = jQuery.Deferred(); 4067 4068jQuery.fn.ready = function( fn ) { 4069 4070 readyList 4071 .then( fn ) 4072 4073 // Wrap jQuery.readyException in a function so that the lookup 4074 // happens at the time of error handling instead of callback 4075 // registration. 4076 .catch( function( error ) { 4077 jQuery.readyException( error ); 4078 } ); 4079 4080 return this; 4081}; 4082 4083jQuery.extend( { 4084 4085 // Is the DOM ready to be used? Set to true once it occurs. 4086 isReady: false, 4087 4088 // A counter to track how many items to wait for before 4089 // the ready event fires. See trac-6781 4090 readyWait: 1, 4091 4092 // Handle when the DOM is ready 4093 ready: function( wait ) { 4094 4095 // Abort if there are pending holds or we're already ready 4096 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 4097 return; 4098 } 4099 4100 // Remember that the DOM is ready 4101 jQuery.isReady = true; 4102 4103 // If a normal DOM Ready event fired, decrement, and wait if need be 4104 if ( wait !== true && --jQuery.readyWait > 0 ) { 4105 return; 4106 } 4107 4108 // If there are functions bound, to execute 4109 readyList.resolveWith( document, [ jQuery ] ); 4110 } 4111} ); 4112 4113jQuery.ready.then = readyList.then; 4114 4115// The ready event handler and self cleanup method 4116function completed() { 4117 document.removeEventListener( "DOMContentLoaded", completed ); 4118 window.removeEventListener( "load", completed ); 4119 jQuery.ready(); 4120} 4121 4122// Catch cases where $(document).ready() is called 4123// after the browser event has already occurred. 4124// Support: IE <=9 - 10 only 4125// Older IE sometimes signals "interactive" too soon 4126if ( document.readyState === "complete" || 4127 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 4128 4129 // Handle it asynchronously to allow scripts the opportunity to delay ready 4130 window.setTimeout( jQuery.ready ); 4131 4132} else { 4133 4134 // Use the handy event callback 4135 document.addEventListener( "DOMContentLoaded", completed ); 4136 4137 // A fallback to window.onload, that will always work 4138 window.addEventListener( "load", completed ); 4139} 4140 4141 4142 4143 4144// Multifunctional method to get and set values of a collection 4145// The value/s can optionally be executed if it's a function 4146var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 4147 var i = 0, 4148 len = elems.length, 4149 bulk = key == null; 4150 4151 // Sets many values 4152 if ( toType( key ) === "object" ) { 4153 chainable = true; 4154 for ( i in key ) { 4155 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 4156 } 4157 4158 // Sets one value 4159 } else if ( value !== undefined ) { 4160 chainable = true; 4161 4162 if ( !isFunction( value ) ) { 4163 raw = true; 4164 } 4165 4166 if ( bulk ) { 4167 4168 // Bulk operations run against the entire set 4169 if ( raw ) { 4170 fn.call( elems, value ); 4171 fn = null; 4172 4173 // ...except when executing function values 4174 } else { 4175 bulk = fn; 4176 fn = function( elem, _key, value ) { 4177 return bulk.call( jQuery( elem ), value ); 4178 }; 4179 } 4180 } 4181 4182 if ( fn ) { 4183 for ( ; i < len; i++ ) { 4184 fn( 4185 elems[ i ], key, raw ? 4186 value : 4187 value.call( elems[ i ], i, fn( elems[ i ], key ) ) 4188 ); 4189 } 4190 } 4191 } 4192 4193 if ( chainable ) { 4194 return elems; 4195 } 4196 4197 // Gets 4198 if ( bulk ) { 4199 return fn.call( elems ); 4200 } 4201 4202 return len ? fn( elems[ 0 ], key ) : emptyGet; 4203}; 4204 4205 4206// Matches dashed string for camelizing 4207var rmsPrefix = /^-ms-/, 4208 rdashAlpha = /-([a-z])/g; 4209 4210// Used by camelCase as callback to replace() 4211function fcamelCase( _all, letter ) { 4212 return letter.toUpperCase(); 4213} 4214 4215// Convert dashed to camelCase; used by the css and data modules 4216// Support: IE <=9 - 11, Edge 12 - 15 4217// Microsoft forgot to hump their vendor prefix (trac-9572) 4218function camelCase( string ) { 4219 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 4220} 4221var acceptData = function( owner ) { 4222 4223 // Accepts only: 4224 // - Node 4225 // - Node.ELEMENT_NODE 4226 // - Node.DOCUMENT_NODE 4227 // - Object 4228 // - Any 4229 return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType ); 4230}; 4231 4232 4233 4234 4235function Data() { 4236 this.expando = jQuery.expando + Data.uid++; 4237} 4238 4239Data.uid = 1; 4240 4241Data.prototype = { 4242 4243 cache: function( owner ) { 4244 4245 // Check if the owner object already has a cache 4246 var value = owner[ this.expando ]; 4247 4248 // If not, create one 4249 if ( !value ) { 4250 value = {}; 4251 4252 // We can accept data for non-element nodes in modern browsers, 4253 // but we should not, see trac-8335. 4254 // Always return an empty object. 4255 if ( acceptData( owner ) ) { 4256 4257 // If it is a node unlikely to be stringify-ed or looped over 4258 // use plain assignment 4259 if ( owner.nodeType ) { 4260 owner[ this.expando ] = value; 4261 4262 // Otherwise secure it in a non-enumerable property 4263 // configurable must be true to allow the property to be 4264 // deleted when data is removed 4265 } else { 4266 Object.defineProperty( owner, this.expando, { 4267 value: value, 4268 configurable: true 4269 } ); 4270 } 4271 } 4272 } 4273 4274 return value; 4275 }, 4276 set: function( owner, data, value ) { 4277 var prop, 4278 cache = this.cache( owner ); 4279 4280 // Handle: [ owner, key, value ] args 4281 // Always use camelCase key (gh-2257) 4282 if ( typeof data === "string" ) { 4283 cache[ camelCase( data ) ] = value; 4284 4285 // Handle: [ owner, { properties } ] args 4286 } else { 4287 4288 // Copy the properties one-by-one to the cache object 4289 for ( prop in data ) { 4290 cache[ camelCase( prop ) ] = data[ prop ]; 4291 } 4292 } 4293 return cache; 4294 }, 4295 get: function( owner, key ) { 4296 return key === undefined ? 4297 this.cache( owner ) : 4298 4299 // Always use camelCase key (gh-2257) 4300 owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ]; 4301 }, 4302 access: function( owner, key, value ) { 4303 4304 // In cases where either: 4305 // 4306 // 1. No key was specified 4307 // 2. A string key was specified, but no value provided 4308 // 4309 // Take the "read" path and allow the get method to determine 4310 // which value to return, respectively either: 4311 // 4312 // 1. The entire cache object 4313 // 2. The data stored at the key 4314 // 4315 if ( key === undefined || 4316 ( ( key && typeof key === "string" ) && value === undefined ) ) { 4317 4318 return this.get( owner, key ); 4319 } 4320 4321 // When the key is not a string, or both a key and value 4322 // are specified, set or extend (existing objects) with either: 4323 // 4324 // 1. An object of properties 4325 // 2. A key and value 4326 // 4327 this.set( owner, key, value ); 4328 4329 // Since the "set" path can have two possible entry points 4330 // return the expected data based on which path was taken[*] 4331 return value !== undefined ? value : key; 4332 }, 4333 remove: function( owner, key ) { 4334 var i, 4335 cache = owner[ this.expando ]; 4336 4337 if ( cache === undefined ) { 4338 return; 4339 } 4340 4341 if ( key !== undefined ) { 4342 4343 // Support array or space separated string of keys 4344 if ( Array.isArray( key ) ) { 4345 4346 // If key is an array of keys... 4347 // We always set camelCase keys, so remove that. 4348 key = key.map( camelCase ); 4349 } else { 4350 key = camelCase( key ); 4351 4352 // If a key with the spaces exists, use it. 4353 // Otherwise, create an array by matching non-whitespace 4354 key = key in cache ? 4355 [ key ] : 4356 ( key.match( rnothtmlwhite ) || [] ); 4357 } 4358 4359 i = key.length; 4360 4361 while ( i-- ) { 4362 delete cache[ key[ i ] ]; 4363 } 4364 } 4365 4366 // Remove the expando if there's no more data 4367 if ( key === undefined || jQuery.isEmptyObject( cache ) ) { 4368 4369 // Support: Chrome <=35 - 45 4370 // Webkit & Blink performance suffers when deleting properties 4371 // from DOM nodes, so set to undefined instead 4372 // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted) 4373 if ( owner.nodeType ) { 4374 owner[ this.expando ] = undefined; 4375 } else { 4376 delete owner[ this.expando ]; 4377 } 4378 } 4379 }, 4380 hasData: function( owner ) { 4381 var cache = owner[ this.expando ]; 4382 return cache !== undefined && !jQuery.isEmptyObject( cache ); 4383 } 4384}; 4385var dataPriv = new Data(); 4386 4387var dataUser = new Data(); 4388 4389 4390 4391// Implementation Summary 4392// 4393// 1. Enforce API surface and semantic compatibility with 1.9.x branch 4394// 2. Improve the module's maintainability by reducing the storage 4395// paths to a single mechanism. 4396// 3. Use the same single mechanism to support "private" and "user" data. 4397// 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData) 4398// 5. Avoid exposing implementation details on user objects (eg. expando properties) 4399// 6. Provide a clear path for implementation upgrade to WeakMap in 2014 4400 4401var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 4402 rmultiDash = /[A-Z]/g; 4403 4404function getData( data ) { 4405 if ( data === "true" ) { 4406 return true; 4407 } 4408 4409 if ( data === "false" ) { 4410 return false; 4411 } 4412 4413 if ( data === "null" ) { 4414 return null; 4415 } 4416 4417 // Only convert to a number if it doesn't change the string 4418 if ( data === +data + "" ) { 4419 return +data; 4420 } 4421 4422 if ( rbrace.test( data ) ) { 4423 return JSON.parse( data ); 4424 } 4425 4426 return data; 4427} 4428 4429function dataAttr( elem, key, data ) { 4430 var name; 4431 4432 // If nothing was found internally, try to fetch any 4433 // data from the HTML5 data-* attribute 4434 if ( data === undefined && elem.nodeType === 1 ) { 4435 name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase(); 4436 data = elem.getAttribute( name ); 4437 4438 if ( typeof data === "string" ) { 4439 try { 4440 data = getData( data ); 4441 } catch ( e ) {} 4442 4443 // Make sure we set the data so it isn't changed later 4444 dataUser.set( elem, key, data ); 4445 } else { 4446 data = undefined; 4447 } 4448 } 4449 return data; 4450} 4451 4452jQuery.extend( { 4453 hasData: function( elem ) { 4454 return dataUser.hasData( elem ) || dataPriv.hasData( elem ); 4455 }, 4456 4457 data: function( elem, name, data ) { 4458 return dataUser.access( elem, name, data ); 4459 }, 4460 4461 removeData: function( elem, name ) { 4462 dataUser.remove( elem, name ); 4463 }, 4464 4465 // TODO: Now that all calls to _data and _removeData have been replaced 4466 // with direct calls to dataPriv methods, these can be deprecated. 4467 _data: function( elem, name, data ) { 4468 return dataPriv.access( elem, name, data ); 4469 }, 4470 4471 _removeData: function( elem, name ) { 4472 dataPriv.remove( elem, name ); 4473 } 4474} ); 4475 4476jQuery.fn.extend( { 4477 data: function( key, value ) { 4478 var i, name, data, 4479 elem = this[ 0 ], 4480 attrs = elem && elem.attributes; 4481 4482 // Gets all values 4483 if ( key === undefined ) { 4484 if ( this.length ) { 4485 data = dataUser.get( elem ); 4486 4487 if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) { 4488 i = attrs.length; 4489 while ( i-- ) { 4490 4491 // Support: IE 11 only 4492 // The attrs elements can be null (trac-14894) 4493 if ( attrs[ i ] ) { 4494 name = attrs[ i ].name; 4495 if ( name.indexOf( "data-" ) === 0 ) { 4496 name = camelCase( name.slice( 5 ) ); 4497 dataAttr( elem, name, data[ name ] ); 4498 } 4499 } 4500 } 4501 dataPriv.set( elem, "hasDataAttrs", true ); 4502 } 4503 } 4504 4505 return data; 4506 } 4507 4508 // Sets multiple values 4509 if ( typeof key === "object" ) { 4510 return this.each( function() { 4511 dataUser.set( this, key ); 4512 } ); 4513 } 4514 4515 return access( this, function( value ) { 4516 var data; 4517 4518 // The calling jQuery object (element matches) is not empty 4519 // (and therefore has an element appears at this[ 0 ]) and the 4520 // `value` parameter was not undefined. An empty jQuery object 4521 // will result in `undefined` for elem = this[ 0 ] which will 4522 // throw an exception if an attempt to read a data cache is made. 4523 if ( elem && value === undefined ) { 4524 4525 // Attempt to get data from the cache 4526 // The key will always be camelCased in Data 4527 data = dataUser.get( elem, key ); 4528 if ( data !== undefined ) { 4529 return data; 4530 } 4531 4532 // Attempt to "discover" the data in 4533 // HTML5 custom data-* attrs 4534 data = dataAttr( elem, key ); 4535 if ( data !== undefined ) { 4536 return data; 4537 } 4538 4539 // We tried really hard, but the data doesn't exist. 4540 return; 4541 } 4542 4543 // Set the data... 4544 this.each( function() { 4545 4546 // We always store the camelCased key 4547 dataUser.set( this, key, value ); 4548 } ); 4549 }, null, value, arguments.length > 1, null, true ); 4550 }, 4551 4552 removeData: function( key ) { 4553 return this.each( function() { 4554 dataUser.remove( this, key ); 4555 } ); 4556 } 4557} ); 4558 4559 4560jQuery.extend( { 4561 queue: function( elem, type, data ) { 4562 var queue; 4563 4564 if ( elem ) { 4565 type = ( type || "fx" ) + "queue"; 4566 queue = dataPriv.get( elem, type ); 4567 4568 // Speed up dequeue by getting out quickly if this is just a lookup 4569 if ( data ) { 4570 if ( !queue || Array.isArray( data ) ) { 4571 queue = dataPriv.access( elem, type, jQuery.makeArray( data ) ); 4572 } else { 4573 queue.push( data ); 4574 } 4575 } 4576 return queue || []; 4577 } 4578 }, 4579 4580 dequeue: function( elem, type ) { 4581 type = type || "fx"; 4582 4583 var queue = jQuery.queue( elem, type ), 4584 startLength = queue.length, 4585 fn = queue.shift(), 4586 hooks = jQuery._queueHooks( elem, type ), 4587 next = function() { 4588 jQuery.dequeue( elem, type ); 4589 }; 4590 4591 // If the fx queue is dequeued, always remove the progress sentinel 4592 if ( fn === "inprogress" ) { 4593 fn = queue.shift(); 4594 startLength--; 4595 } 4596 4597 if ( fn ) { 4598 4599 // Add a progress sentinel to prevent the fx queue from being 4600 // automatically dequeued 4601 if ( type === "fx" ) { 4602 queue.unshift( "inprogress" ); 4603 } 4604 4605 // Clear up the last queue stop function 4606 delete hooks.stop; 4607 fn.call( elem, next, hooks ); 4608 } 4609 4610 if ( !startLength && hooks ) { 4611 hooks.empty.fire(); 4612 } 4613 }, 4614 4615 // Not public - generate a queueHooks object, or return the current one 4616 _queueHooks: function( elem, type ) { 4617 var key = type + "queueHooks"; 4618 return dataPriv.get( elem, key ) || dataPriv.access( elem, key, { 4619 empty: jQuery.Callbacks( "once memory" ).add( function() { 4620 dataPriv.remove( elem, [ type + "queue", key ] ); 4621 } ) 4622 } ); 4623 } 4624} ); 4625 4626jQuery.fn.extend( { 4627 queue: function( type, data ) { 4628 var setter = 2; 4629 4630 if ( typeof type !== "string" ) { 4631 data = type; 4632 type = "fx"; 4633 setter--; 4634 } 4635 4636 if ( arguments.length < setter ) { 4637 return jQuery.queue( this[ 0 ], type ); 4638 } 4639 4640 return data === undefined ? 4641 this : 4642 this.each( function() { 4643 var queue = jQuery.queue( this, type, data ); 4644 4645 // Ensure a hooks for this queue 4646 jQuery._queueHooks( this, type ); 4647 4648 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 4649 jQuery.dequeue( this, type ); 4650 } 4651 } ); 4652 }, 4653 dequeue: function( type ) { 4654 return this.each( function() { 4655 jQuery.dequeue( this, type ); 4656 } ); 4657 }, 4658 clearQueue: function( type ) { 4659 return this.queue( type || "fx", [] ); 4660 }, 4661 4662 // Get a promise resolved when queues of a certain type 4663 // are emptied (fx is the type by default) 4664 promise: function( type, obj ) { 4665 var tmp, 4666 count = 1, 4667 defer = jQuery.Deferred(), 4668 elements = this, 4669 i = this.length, 4670 resolve = function() { 4671 if ( !( --count ) ) { 4672 defer.resolveWith( elements, [ elements ] ); 4673 } 4674 }; 4675 4676 if ( typeof type !== "string" ) { 4677 obj = type; 4678 type = undefined; 4679 } 4680 type = type || "fx"; 4681 4682 while ( i-- ) { 4683 tmp = dataPriv.get( elements[ i ], type + "queueHooks" ); 4684 if ( tmp && tmp.empty ) { 4685 count++; 4686 tmp.empty.add( resolve ); 4687 } 4688 } 4689 resolve(); 4690 return defer.promise( obj ); 4691 } 4692} ); 4693var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 4694 4695var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 4696 4697 4698var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 4699 4700var documentElement = document.documentElement; 4701 4702 4703 4704 var isAttached = function( elem ) { 4705 return jQuery.contains( elem.ownerDocument, elem ); 4706 }, 4707 composed = { composed: true }; 4708 4709 // Support: IE 9 - 11+, Edge 12 - 18+, iOS 10.0 - 10.2 only 4710 // Check attachment across shadow DOM boundaries when possible (gh-3504) 4711 // Support: iOS 10.0-10.2 only 4712 // Early iOS 10 versions support `attachShadow` but not `getRootNode`, 4713 // leading to errors. We need to check for `getRootNode`. 4714 if ( documentElement.getRootNode ) { 4715 isAttached = function( elem ) { 4716 return jQuery.contains( elem.ownerDocument, elem ) || 4717 elem.getRootNode( composed ) === elem.ownerDocument; 4718 }; 4719 } 4720var isHiddenWithinTree = function( elem, el ) { 4721 4722 // isHiddenWithinTree might be called from jQuery#filter function; 4723 // in that case, element will be second argument 4724 elem = el || elem; 4725 4726 // Inline style trumps all 4727 return elem.style.display === "none" || 4728 elem.style.display === "" && 4729 4730 // Otherwise, check computed style 4731 // Support: Firefox <=43 - 45 4732 // Disconnected elements can have computed display: none, so first confirm that elem is 4733 // in the document. 4734 isAttached( elem ) && 4735 4736 jQuery.css( elem, "display" ) === "none"; 4737 }; 4738 4739 4740 4741function adjustCSS( elem, prop, valueParts, tween ) { 4742 var adjusted, scale, 4743 maxIterations = 20, 4744 currentValue = tween ? 4745 function() { 4746 return tween.cur(); 4747 } : 4748 function() { 4749 return jQuery.css( elem, prop, "" ); 4750 }, 4751 initial = currentValue(), 4752 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 4753 4754 // Starting value computation is required for potential unit mismatches 4755 initialInUnit = elem.nodeType && 4756 ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 4757 rcssNum.exec( jQuery.css( elem, prop ) ); 4758 4759 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 4760 4761 // Support: Firefox <=54 4762 // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144) 4763 initial = initial / 2; 4764 4765 // Trust units reported by jQuery.css 4766 unit = unit || initialInUnit[ 3 ]; 4767 4768 // Iteratively approximate from a nonzero starting point 4769 initialInUnit = +initial || 1; 4770 4771 while ( maxIterations-- ) { 4772 4773 // Evaluate and update our best guess (doubling guesses that zero out). 4774 // Finish if the scale equals or crosses 1 (making the old*new product non-positive). 4775 jQuery.style( elem, prop, initialInUnit + unit ); 4776 if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) { 4777 maxIterations = 0; 4778 } 4779 initialInUnit = initialInUnit / scale; 4780 4781 } 4782 4783 initialInUnit = initialInUnit * 2; 4784 jQuery.style( elem, prop, initialInUnit + unit ); 4785 4786 // Make sure we update the tween properties later on 4787 valueParts = valueParts || []; 4788 } 4789 4790 if ( valueParts ) { 4791 initialInUnit = +initialInUnit || +initial || 0; 4792 4793 // Apply relative offset (+=/-=) if specified 4794 adjusted = valueParts[ 1 ] ? 4795 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 4796 +valueParts[ 2 ]; 4797 if ( tween ) { 4798 tween.unit = unit; 4799 tween.start = initialInUnit; 4800 tween.end = adjusted; 4801 } 4802 } 4803 return adjusted; 4804} 4805 4806 4807var defaultDisplayMap = {}; 4808 4809function getDefaultDisplay( elem ) { 4810 var temp, 4811 doc = elem.ownerDocument, 4812 nodeName = elem.nodeName, 4813 display = defaultDisplayMap[ nodeName ]; 4814 4815 if ( display ) { 4816 return display; 4817 } 4818 4819 temp = doc.body.appendChild( doc.createElement( nodeName ) ); 4820 display = jQuery.css( temp, "display" ); 4821 4822 temp.parentNode.removeChild( temp ); 4823 4824 if ( display === "none" ) { 4825 display = "block"; 4826 } 4827 defaultDisplayMap[ nodeName ] = display; 4828 4829 return display; 4830} 4831 4832function showHide( elements, show ) { 4833 var display, elem, 4834 values = [], 4835 index = 0, 4836 length = elements.length; 4837 4838 // Determine new display value for elements that need to change 4839 for ( ; index < length; index++ ) { 4840 elem = elements[ index ]; 4841 if ( !elem.style ) { 4842 continue; 4843 } 4844 4845 display = elem.style.display; 4846 if ( show ) { 4847 4848 // Since we force visibility upon cascade-hidden elements, an immediate (and slow) 4849 // check is required in this first loop unless we have a nonempty display value (either 4850 // inline or about-to-be-restored) 4851 if ( display === "none" ) { 4852 values[ index ] = dataPriv.get( elem, "display" ) || null; 4853 if ( !values[ index ] ) { 4854 elem.style.display = ""; 4855 } 4856 } 4857 if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) { 4858 values[ index ] = getDefaultDisplay( elem ); 4859 } 4860 } else { 4861 if ( display !== "none" ) { 4862 values[ index ] = "none"; 4863 4864 // Remember what we're overwriting 4865 dataPriv.set( elem, "display", display ); 4866 } 4867 } 4868 } 4869 4870 // Set the display of the elements in a second loop to avoid constant reflow 4871 for ( index = 0; index < length; index++ ) { 4872 if ( values[ index ] != null ) { 4873 elements[ index ].style.display = values[ index ]; 4874 } 4875 } 4876 4877 return elements; 4878} 4879 4880jQuery.fn.extend( { 4881 show: function() { 4882 return showHide( this, true ); 4883 }, 4884 hide: function() { 4885 return showHide( this ); 4886 }, 4887 toggle: function( state ) { 4888 if ( typeof state === "boolean" ) { 4889 return state ? this.show() : this.hide(); 4890 } 4891 4892 return this.each( function() { 4893 if ( isHiddenWithinTree( this ) ) { 4894 jQuery( this ).show(); 4895 } else { 4896 jQuery( this ).hide(); 4897 } 4898 } ); 4899 } 4900} ); 4901var rcheckableType = ( /^(?:checkbox|radio)$/i ); 4902 4903var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]*)/i ); 4904 4905var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i ); 4906 4907 4908 4909( function() { 4910 var fragment = document.createDocumentFragment(), 4911 div = fragment.appendChild( document.createElement( "div" ) ), 4912 input = document.createElement( "input" ); 4913 4914 // Support: Android 4.0 - 4.3 only 4915 // Check state lost if the name is set (trac-11217) 4916 // Support: Windows Web Apps (WWA) 4917 // `name` and `type` must use .setAttribute for WWA (trac-14901) 4918 input.setAttribute( "type", "radio" ); 4919 input.setAttribute( "checked", "checked" ); 4920 input.setAttribute( "name", "t" ); 4921 4922 div.appendChild( input ); 4923 4924 // Support: Android <=4.1 only 4925 // Older WebKit doesn't clone checked state correctly in fragments 4926 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 4927 4928 // Support: IE <=11 only 4929 // Make sure textarea (and checkbox) defaultValue is properly cloned 4930 div.innerHTML = "<textarea>x</textarea>"; 4931 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 4932 4933 // Support: IE <=9 only 4934 // IE <=9 replaces <option> tags with their contents when inserted outside of 4935 // the select element. 4936 div.innerHTML = "<option></option>"; 4937 support.option = !!div.lastChild; 4938} )(); 4939 4940 4941// We have to close these tags to support XHTML (trac-13200) 4942var wrapMap = { 4943 4944 // XHTML parsers do not magically insert elements in the 4945 // same way that tag soup parsers do. So we cannot shorten 4946 // this by omitting <tbody> or other required elements. 4947 thead: [ 1, "<table>", "</table>" ], 4948 col: [ 2, "<table><colgroup>", "</colgroup></table>" ], 4949 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 4950 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 4951 4952 _default: [ 0, "", "" ] 4953}; 4954 4955wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 4956wrapMap.th = wrapMap.td; 4957 4958// Support: IE <=9 only 4959if ( !support.option ) { 4960 wrapMap.optgroup = wrapMap.option = [ 1, "<select multiple='multiple'>", "</select>" ]; 4961} 4962 4963 4964function getAll( context, tag ) { 4965 4966 // Support: IE <=9 - 11 only 4967 // Use typeof to avoid zero-argument method invocation on host objects (trac-15151) 4968 var ret; 4969 4970 if ( typeof context.getElementsByTagName !== "undefined" ) { 4971 ret = context.getElementsByTagName( tag || "*" ); 4972 4973 } else if ( typeof context.querySelectorAll !== "undefined" ) { 4974 ret = context.querySelectorAll( tag || "*" ); 4975 4976 } else { 4977 ret = []; 4978 } 4979 4980 if ( tag === undefined || tag && nodeName( context, tag ) ) { 4981 return jQuery.merge( [ context ], ret ); 4982 } 4983 4984 return ret; 4985} 4986 4987 4988// Mark scripts as having already been evaluated 4989function setGlobalEval( elems, refElements ) { 4990 var i = 0, 4991 l = elems.length; 4992 4993 for ( ; i < l; i++ ) { 4994 dataPriv.set( 4995 elems[ i ], 4996 "globalEval", 4997 !refElements || dataPriv.get( refElements[ i ], "globalEval" ) 4998 ); 4999 } 5000} 5001 5002 5003var rhtml = /<|&#?\w+;/; 5004 5005function buildFragment( elems, context, scripts, selection, ignored ) { 5006 var elem, tmp, tag, wrap, attached, j, 5007 fragment = context.createDocumentFragment(), 5008 nodes = [], 5009 i = 0, 5010 l = elems.length; 5011 5012 for ( ; i < l; i++ ) { 5013 elem = elems[ i ]; 5014 5015 if ( elem || elem === 0 ) { 5016 5017 // Add nodes directly 5018 if ( toType( elem ) === "object" ) { 5019 5020 // Support: Android <=4.0 only, PhantomJS 1 only 5021 // push.apply(_, arraylike) throws on ancient WebKit 5022 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 5023 5024 // Convert non-html into a text node 5025 } else if ( !rhtml.test( elem ) ) { 5026 nodes.push( context.createTextNode( elem ) ); 5027 5028 // Convert html into DOM nodes 5029 } else { 5030 tmp = tmp || fragment.appendChild( context.createElement( "div" ) ); 5031 5032 // Deserialize a standard representation 5033 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 5034 wrap = wrapMap[ tag ] || wrapMap._default; 5035 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 5036 5037 // Descend through wrappers to the right content 5038 j = wrap[ 0 ]; 5039 while ( j-- ) { 5040 tmp = tmp.lastChild; 5041 } 5042 5043 // Support: Android <=4.0 only, PhantomJS 1 only 5044 // push.apply(_, arraylike) throws on ancient WebKit 5045 jQuery.merge( nodes, tmp.childNodes ); 5046 5047 // Remember the top-level container 5048 tmp = fragment.firstChild; 5049 5050 // Ensure the created nodes are orphaned (trac-12392) 5051 tmp.textContent = ""; 5052 } 5053 } 5054 } 5055 5056 // Remove wrapper from fragment 5057 fragment.textContent = ""; 5058 5059 i = 0; 5060 while ( ( elem = nodes[ i++ ] ) ) { 5061 5062 // Skip elements already in the context collection (trac-4087) 5063 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 5064 if ( ignored ) { 5065 ignored.push( elem ); 5066 } 5067 continue; 5068 } 5069 5070 attached = isAttached( elem ); 5071 5072 // Append to fragment 5073 tmp = getAll( fragment.appendChild( elem ), "script" ); 5074 5075 // Preserve script evaluation history 5076 if ( attached ) { 5077 setGlobalEval( tmp ); 5078 } 5079 5080 // Capture executables 5081 if ( scripts ) { 5082 j = 0; 5083 while ( ( elem = tmp[ j++ ] ) ) { 5084 if ( rscriptType.test( elem.type || "" ) ) { 5085 scripts.push( elem ); 5086 } 5087 } 5088 } 5089 } 5090 5091 return fragment; 5092} 5093 5094 5095var rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 5096 5097function returnTrue() { 5098 return true; 5099} 5100 5101function returnFalse() { 5102 return false; 5103} 5104 5105function on( elem, types, selector, data, fn, one ) { 5106 var origFn, type; 5107 5108 // Types can be a map of types/handlers 5109 if ( typeof types === "object" ) { 5110 5111 // ( types-Object, selector, data ) 5112 if ( typeof selector !== "string" ) { 5113 5114 // ( types-Object, data ) 5115 data = data || selector; 5116 selector = undefined; 5117 } 5118 for ( type in types ) { 5119 on( elem, type, selector, data, types[ type ], one ); 5120 } 5121 return elem; 5122 } 5123 5124 if ( data == null && fn == null ) { 5125 5126 // ( types, fn ) 5127 fn = selector; 5128 data = selector = undefined; 5129 } else if ( fn == null ) { 5130 if ( typeof selector === "string" ) { 5131 5132 // ( types, selector, fn ) 5133 fn = data; 5134 data = undefined; 5135 } else { 5136 5137 // ( types, data, fn ) 5138 fn = data; 5139 data = selector; 5140 selector = undefined; 5141 } 5142 } 5143 if ( fn === false ) { 5144 fn = returnFalse; 5145 } else if ( !fn ) { 5146 return elem; 5147 } 5148 5149 if ( one === 1 ) { 5150 origFn = fn; 5151 fn = function( event ) { 5152 5153 // Can use an empty set, since event contains the info 5154 jQuery().off( event ); 5155 return origFn.apply( this, arguments ); 5156 }; 5157 5158 // Use same guid so caller can remove using origFn 5159 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 5160 } 5161 return elem.each( function() { 5162 jQuery.event.add( this, types, fn, data, selector ); 5163 } ); 5164} 5165 5166/* 5167 * Helper functions for managing events -- not part of the public interface. 5168 * Props to Dean Edwards' addEvent library for many of the ideas. 5169 */ 5170jQuery.event = { 5171 5172 global: {}, 5173 5174 add: function( elem, types, handler, data, selector ) { 5175 5176 var handleObjIn, eventHandle, tmp, 5177 events, t, handleObj, 5178 special, handlers, type, namespaces, origType, 5179 elemData = dataPriv.get( elem ); 5180 5181 // Only attach events to objects that accept data 5182 if ( !acceptData( elem ) ) { 5183 return; 5184 } 5185 5186 // Caller can pass in an object of custom data in lieu of the handler 5187 if ( handler.handler ) { 5188 handleObjIn = handler; 5189 handler = handleObjIn.handler; 5190 selector = handleObjIn.selector; 5191 } 5192 5193 // Ensure that invalid selectors throw exceptions at attach time 5194 // Evaluate against documentElement in case elem is a non-element node (e.g., document) 5195 if ( selector ) { 5196 jQuery.find.matchesSelector( documentElement, selector ); 5197 } 5198 5199 // Make sure that the handler has a unique ID, used to find/remove it later 5200 if ( !handler.guid ) { 5201 handler.guid = jQuery.guid++; 5202 } 5203 5204 // Init the element's event structure and main handler, if this is the first 5205 if ( !( events = elemData.events ) ) { 5206 events = elemData.events = Object.create( null ); 5207 } 5208 if ( !( eventHandle = elemData.handle ) ) { 5209 eventHandle = elemData.handle = function( e ) { 5210 5211 // Discard the second event of a jQuery.event.trigger() and 5212 // when an event is called after a page has unloaded 5213 return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? 5214 jQuery.event.dispatch.apply( elem, arguments ) : undefined; 5215 }; 5216 } 5217 5218 // Handle multiple events separated by a space 5219 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 5220 t = types.length; 5221 while ( t-- ) { 5222 tmp = rtypenamespace.exec( types[ t ] ) || []; 5223 type = origType = tmp[ 1 ]; 5224 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5225 5226 // There *must* be a type, no attaching namespace-only handlers 5227 if ( !type ) { 5228 continue; 5229 } 5230 5231 // If event changes its type, use the special event handlers for the changed type 5232 special = jQuery.event.special[ type ] || {}; 5233 5234 // If selector defined, determine special event api type, otherwise given type 5235 type = ( selector ? special.delegateType : special.bindType ) || type; 5236 5237 // Update special based on newly reset type 5238 special = jQuery.event.special[ type ] || {}; 5239 5240 // handleObj is passed to all event handlers 5241 handleObj = jQuery.extend( { 5242 type: type, 5243 origType: origType, 5244 data: data, 5245 handler: handler, 5246 guid: handler.guid, 5247 selector: selector, 5248 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 5249 namespace: namespaces.join( "." ) 5250 }, handleObjIn ); 5251 5252 // Init the event handler queue if we're the first 5253 if ( !( handlers = events[ type ] ) ) { 5254 handlers = events[ type ] = []; 5255 handlers.delegateCount = 0; 5256 5257 // Only use addEventListener if the special events handler returns false 5258 if ( !special.setup || 5259 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 5260 5261 if ( elem.addEventListener ) { 5262 elem.addEventListener( type, eventHandle ); 5263 } 5264 } 5265 } 5266 5267 if ( special.add ) { 5268 special.add.call( elem, handleObj ); 5269 5270 if ( !handleObj.handler.guid ) { 5271 handleObj.handler.guid = handler.guid; 5272 } 5273 } 5274 5275 // Add to the element's handler list, delegates in front 5276 if ( selector ) { 5277 handlers.splice( handlers.delegateCount++, 0, handleObj ); 5278 } else { 5279 handlers.push( handleObj ); 5280 } 5281 5282 // Keep track of which events have ever been used, for event optimization 5283 jQuery.event.global[ type ] = true; 5284 } 5285 5286 }, 5287 5288 // Detach an event or set of events from an element 5289 remove: function( elem, types, handler, selector, mappedTypes ) { 5290 5291 var j, origCount, tmp, 5292 events, t, handleObj, 5293 special, handlers, type, namespaces, origType, 5294 elemData = dataPriv.hasData( elem ) && dataPriv.get( elem ); 5295 5296 if ( !elemData || !( events = elemData.events ) ) { 5297 return; 5298 } 5299 5300 // Once for each type.namespace in types; type may be omitted 5301 types = ( types || "" ).match( rnothtmlwhite ) || [ "" ]; 5302 t = types.length; 5303 while ( t-- ) { 5304 tmp = rtypenamespace.exec( types[ t ] ) || []; 5305 type = origType = tmp[ 1 ]; 5306 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 5307 5308 // Unbind all events (on this namespace, if provided) for the element 5309 if ( !type ) { 5310 for ( type in events ) { 5311 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 5312 } 5313 continue; 5314 } 5315 5316 special = jQuery.event.special[ type ] || {}; 5317 type = ( selector ? special.delegateType : special.bindType ) || type; 5318 handlers = events[ type ] || []; 5319 tmp = tmp[ 2 ] && 5320 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 5321 5322 // Remove matching events 5323 origCount = j = handlers.length; 5324 while ( j-- ) { 5325 handleObj = handlers[ j ]; 5326 5327 if ( ( mappedTypes || origType === handleObj.origType ) && 5328 ( !handler || handler.guid === handleObj.guid ) && 5329 ( !tmp || tmp.test( handleObj.namespace ) ) && 5330 ( !selector || selector === handleObj.selector || 5331 selector === "**" && handleObj.selector ) ) { 5332 handlers.splice( j, 1 ); 5333 5334 if ( handleObj.selector ) { 5335 handlers.delegateCount--; 5336 } 5337 if ( special.remove ) { 5338 special.remove.call( elem, handleObj ); 5339 } 5340 } 5341 } 5342 5343 // Remove generic event handler if we removed something and no more handlers exist 5344 // (avoids potential for endless recursion during removal of special event handlers) 5345 if ( origCount && !handlers.length ) { 5346 if ( !special.teardown || 5347 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 5348 5349 jQuery.removeEvent( elem, type, elemData.handle ); 5350 } 5351 5352 delete events[ type ]; 5353 } 5354 } 5355 5356 // Remove data and the expando if it's no longer used 5357 if ( jQuery.isEmptyObject( events ) ) { 5358 dataPriv.remove( elem, "handle events" ); 5359 } 5360 }, 5361 5362 dispatch: function( nativeEvent ) { 5363 5364 var i, j, ret, matched, handleObj, handlerQueue, 5365 args = new Array( arguments.length ), 5366 5367 // Make a writable jQuery.Event from the native event object 5368 event = jQuery.event.fix( nativeEvent ), 5369 5370 handlers = ( 5371 dataPriv.get( this, "events" ) || Object.create( null ) 5372 )[ event.type ] || [], 5373 special = jQuery.event.special[ event.type ] || {}; 5374 5375 // Use the fix-ed jQuery.Event rather than the (read-only) native event 5376 args[ 0 ] = event; 5377 5378 for ( i = 1; i < arguments.length; i++ ) { 5379 args[ i ] = arguments[ i ]; 5380 } 5381 5382 event.delegateTarget = this; 5383 5384 // Call the preDispatch hook for the mapped type, and let it bail if desired 5385 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 5386 return; 5387 } 5388 5389 // Determine handlers 5390 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 5391 5392 // Run delegates first; they may want to stop propagation beneath us 5393 i = 0; 5394 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 5395 event.currentTarget = matched.elem; 5396 5397 j = 0; 5398 while ( ( handleObj = matched.handlers[ j++ ] ) && 5399 !event.isImmediatePropagationStopped() ) { 5400 5401 // If the event is namespaced, then each handler is only invoked if it is 5402 // specially universal or its namespaces are a superset of the event's. 5403 if ( !event.rnamespace || handleObj.namespace === false || 5404 event.rnamespace.test( handleObj.namespace ) ) { 5405 5406 event.handleObj = handleObj; 5407 event.data = handleObj.data; 5408 5409 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 5410 handleObj.handler ).apply( matched.elem, args ); 5411 5412 if ( ret !== undefined ) { 5413 if ( ( event.result = ret ) === false ) { 5414 event.preventDefault(); 5415 event.stopPropagation(); 5416 } 5417 } 5418 } 5419 } 5420 } 5421 5422 // Call the postDispatch hook for the mapped type 5423 if ( special.postDispatch ) { 5424 special.postDispatch.call( this, event ); 5425 } 5426 5427 return event.result; 5428 }, 5429 5430 handlers: function( event, handlers ) { 5431 var i, handleObj, sel, matchedHandlers, matchedSelectors, 5432 handlerQueue = [], 5433 delegateCount = handlers.delegateCount, 5434 cur = event.target; 5435 5436 // Find delegate handlers 5437 if ( delegateCount && 5438 5439 // Support: IE <=9 5440 // Black-hole SVG <use> instance trees (trac-13180) 5441 cur.nodeType && 5442 5443 // Support: Firefox <=42 5444 // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861) 5445 // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click 5446 // Support: IE 11 only 5447 // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343) 5448 !( event.type === "click" && event.button >= 1 ) ) { 5449 5450 for ( ; cur !== this; cur = cur.parentNode || this ) { 5451 5452 // Don't check non-elements (trac-13208) 5453 // Don't process clicks on disabled elements (trac-6911, trac-8165, trac-11382, trac-11764) 5454 if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) { 5455 matchedHandlers = []; 5456 matchedSelectors = {}; 5457 for ( i = 0; i < delegateCount; i++ ) { 5458 handleObj = handlers[ i ]; 5459 5460 // Don't conflict with Object.prototype properties (trac-13203) 5461 sel = handleObj.selector + " "; 5462 5463 if ( matchedSelectors[ sel ] === undefined ) { 5464 matchedSelectors[ sel ] = handleObj.needsContext ? 5465 jQuery( sel, this ).index( cur ) > -1 : 5466 jQuery.find( sel, this, null, [ cur ] ).length; 5467 } 5468 if ( matchedSelectors[ sel ] ) { 5469 matchedHandlers.push( handleObj ); 5470 } 5471 } 5472 if ( matchedHandlers.length ) { 5473 handlerQueue.push( { elem: cur, handlers: matchedHandlers } ); 5474 } 5475 } 5476 } 5477 } 5478 5479 // Add the remaining (directly-bound) handlers 5480 cur = this; 5481 if ( delegateCount < handlers.length ) { 5482 handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } ); 5483 } 5484 5485 return handlerQueue; 5486 }, 5487 5488 addProp: function( name, hook ) { 5489 Object.defineProperty( jQuery.Event.prototype, name, { 5490 enumerable: true, 5491 configurable: true, 5492 5493 get: isFunction( hook ) ? 5494 function() { 5495 if ( this.originalEvent ) { 5496 return hook( this.originalEvent ); 5497 } 5498 } : 5499 function() { 5500 if ( this.originalEvent ) { 5501 return this.originalEvent[ name ]; 5502 } 5503 }, 5504 5505 set: function( value ) { 5506 Object.defineProperty( this, name, { 5507 enumerable: true, 5508 configurable: true, 5509 writable: true, 5510 value: value 5511 } ); 5512 } 5513 } ); 5514 }, 5515 5516 fix: function( originalEvent ) { 5517 return originalEvent[ jQuery.expando ] ? 5518 originalEvent : 5519 new jQuery.Event( originalEvent ); 5520 }, 5521 5522 special: { 5523 load: { 5524 5525 // Prevent triggered image.load events from bubbling to window.load 5526 noBubble: true 5527 }, 5528 click: { 5529 5530 // Utilize native event to ensure correct state for checkable inputs 5531 setup: function( data ) { 5532 5533 // For mutual compressibility with _default, replace `this` access with a local var. 5534 // `|| data` is dead code meant only to preserve the variable through minification. 5535 var el = this || data; 5536 5537 // Claim the first handler 5538 if ( rcheckableType.test( el.type ) && 5539 el.click && nodeName( el, "input" ) ) { 5540 5541 // dataPriv.set( el, "click", ... ) 5542 leverageNative( el, "click", true ); 5543 } 5544 5545 // Return false to allow normal processing in the caller 5546 return false; 5547 }, 5548 trigger: function( data ) { 5549 5550 // For mutual compressibility with _default, replace `this` access with a local var. 5551 // `|| data` is dead code meant only to preserve the variable through minification. 5552 var el = this || data; 5553 5554 // Force setup before triggering a click 5555 if ( rcheckableType.test( el.type ) && 5556 el.click && nodeName( el, "input" ) ) { 5557 5558 leverageNative( el, "click" ); 5559 } 5560 5561 // Return non-false to allow normal event-path propagation 5562 return true; 5563 }, 5564 5565 // For cross-browser consistency, suppress native .click() on links 5566 // Also prevent it if we're currently inside a leveraged native-event stack 5567 _default: function( event ) { 5568 var target = event.target; 5569 return rcheckableType.test( target.type ) && 5570 target.click && nodeName( target, "input" ) && 5571 dataPriv.get( target, "click" ) || 5572 nodeName( target, "a" ); 5573 } 5574 }, 5575 5576 beforeunload: { 5577 postDispatch: function( event ) { 5578 5579 // Support: Firefox 20+ 5580 // Firefox doesn't alert if the returnValue field is not set. 5581 if ( event.result !== undefined && event.originalEvent ) { 5582 event.originalEvent.returnValue = event.result; 5583 } 5584 } 5585 } 5586 } 5587}; 5588 5589// Ensure the presence of an event listener that handles manually-triggered 5590// synthetic events by interrupting progress until reinvoked in response to 5591// *native* events that it fires directly, ensuring that state changes have 5592// already occurred before other listeners are invoked. 5593function leverageNative( el, type, isSetup ) { 5594 5595 // Missing `isSetup` indicates a trigger call, which must force setup through jQuery.event.add 5596 if ( !isSetup ) { 5597 if ( dataPriv.get( el, type ) === undefined ) { 5598 jQuery.event.add( el, type, returnTrue ); 5599 } 5600 return; 5601 } 5602 5603 // Register the controller as a special universal handler for all event namespaces 5604 dataPriv.set( el, type, false ); 5605 jQuery.event.add( el, type, { 5606 namespace: false, 5607 handler: function( event ) { 5608 var result, 5609 saved = dataPriv.get( this, type ); 5610 5611 if ( ( event.isTrigger & 1 ) && this[ type ] ) { 5612 5613 // Interrupt processing of the outer synthetic .trigger()ed event 5614 if ( !saved ) { 5615 5616 // Store arguments for use when handling the inner native event 5617 // There will always be at least one argument (an event object), so this array 5618 // will not be confused with a leftover capture object. 5619 saved = slice.call( arguments ); 5620 dataPriv.set( this, type, saved ); 5621 5622 // Trigger the native event and capture its result 5623 this[ type ](); 5624 result = dataPriv.get( this, type ); 5625 dataPriv.set( this, type, false ); 5626 5627 if ( saved !== result ) { 5628 5629 // Cancel the outer synthetic event 5630 event.stopImmediatePropagation(); 5631 event.preventDefault(); 5632 5633 return result; 5634 } 5635 5636 // If this is an inner synthetic event for an event with a bubbling surrogate 5637 // (focus or blur), assume that the surrogate already propagated from triggering 5638 // the native event and prevent that from happening again here. 5639 // This technically gets the ordering wrong w.r.t. to `.trigger()` (in which the 5640 // bubbling surrogate propagates *after* the non-bubbling base), but that seems 5641 // less bad than duplication. 5642 } else if ( ( jQuery.event.special[ type ] || {} ).delegateType ) { 5643 event.stopPropagation(); 5644 } 5645 5646 // If this is a native event triggered above, everything is now in order 5647 // Fire an inner synthetic event with the original arguments 5648 } else if ( saved ) { 5649 5650 // ...and capture the result 5651 dataPriv.set( this, type, jQuery.event.trigger( 5652 saved[ 0 ], 5653 saved.slice( 1 ), 5654 this 5655 ) ); 5656 5657 // Abort handling of the native event by all jQuery handlers while allowing 5658 // native handlers on the same element to run. On target, this is achieved 5659 // by stopping immediate propagation just on the jQuery event. However, 5660 // the native event is re-wrapped by a jQuery one on each level of the 5661 // propagation so the only way to stop it for jQuery is to stop it for 5662 // everyone via native `stopPropagation()`. This is not a problem for 5663 // focus/blur which don't bubble, but it does also stop click on checkboxes 5664 // and radios. We accept this limitation. 5665 event.stopPropagation(); 5666 event.isImmediatePropagationStopped = returnTrue; 5667 } 5668 } 5669 } ); 5670} 5671 5672jQuery.removeEvent = function( elem, type, handle ) { 5673 5674 // This "if" is needed for plain objects 5675 if ( elem.removeEventListener ) { 5676 elem.removeEventListener( type, handle ); 5677 } 5678}; 5679 5680jQuery.Event = function( src, props ) { 5681 5682 // Allow instantiation without the 'new' keyword 5683 if ( !( this instanceof jQuery.Event ) ) { 5684 return new jQuery.Event( src, props ); 5685 } 5686 5687 // Event object 5688 if ( src && src.type ) { 5689 this.originalEvent = src; 5690 this.type = src.type; 5691 5692 // Events bubbling up the document may have been marked as prevented 5693 // by a handler lower down the tree; reflect the correct value. 5694 this.isDefaultPrevented = src.defaultPrevented || 5695 src.defaultPrevented === undefined && 5696 5697 // Support: Android <=2.3 only 5698 src.returnValue === false ? 5699 returnTrue : 5700 returnFalse; 5701 5702 // Create target properties 5703 // Support: Safari <=6 - 7 only 5704 // Target should not be a text node (trac-504, trac-13143) 5705 this.target = ( src.target && src.target.nodeType === 3 ) ? 5706 src.target.parentNode : 5707 src.target; 5708 5709 this.currentTarget = src.currentTarget; 5710 this.relatedTarget = src.relatedTarget; 5711 5712 // Event type 5713 } else { 5714 this.type = src; 5715 } 5716 5717 // Put explicitly provided properties onto the event object 5718 if ( props ) { 5719 jQuery.extend( this, props ); 5720 } 5721 5722 // Create a timestamp if incoming event doesn't have one 5723 this.timeStamp = src && src.timeStamp || Date.now(); 5724 5725 // Mark it as fixed 5726 this[ jQuery.expando ] = true; 5727}; 5728 5729// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 5730// https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 5731jQuery.Event.prototype = { 5732 constructor: jQuery.Event, 5733 isDefaultPrevented: returnFalse, 5734 isPropagationStopped: returnFalse, 5735 isImmediatePropagationStopped: returnFalse, 5736 isSimulated: false, 5737 5738 preventDefault: function() { 5739 var e = this.originalEvent; 5740 5741 this.isDefaultPrevented = returnTrue; 5742 5743 if ( e && !this.isSimulated ) { 5744 e.preventDefault(); 5745 } 5746 }, 5747 stopPropagation: function() { 5748 var e = this.originalEvent; 5749 5750 this.isPropagationStopped = returnTrue; 5751 5752 if ( e && !this.isSimulated ) { 5753 e.stopPropagation(); 5754 } 5755 }, 5756 stopImmediatePropagation: function() { 5757 var e = this.originalEvent; 5758 5759 this.isImmediatePropagationStopped = returnTrue; 5760 5761 if ( e && !this.isSimulated ) { 5762 e.stopImmediatePropagation(); 5763 } 5764 5765 this.stopPropagation(); 5766 } 5767}; 5768 5769// Includes all common event props including KeyEvent and MouseEvent specific props 5770jQuery.each( { 5771 altKey: true, 5772 bubbles: true, 5773 cancelable: true, 5774 changedTouches: true, 5775 ctrlKey: true, 5776 detail: true, 5777 eventPhase: true, 5778 metaKey: true, 5779 pageX: true, 5780 pageY: true, 5781 shiftKey: true, 5782 view: true, 5783 "char": true, 5784 code: true, 5785 charCode: true, 5786 key: true, 5787 keyCode: true, 5788 button: true, 5789 buttons: true, 5790 clientX: true, 5791 clientY: true, 5792 offsetX: true, 5793 offsetY: true, 5794 pointerId: true, 5795 pointerType: true, 5796 screenX: true, 5797 screenY: true, 5798 targetTouches: true, 5799 toElement: true, 5800 touches: true, 5801 which: true 5802}, jQuery.event.addProp ); 5803 5804jQuery.each( { focus: "focusin", blur: "focusout" }, function( type, delegateType ) { 5805 5806 function focusMappedHandler( nativeEvent ) { 5807 if ( document.documentMode ) { 5808 5809 // Support: IE 11+ 5810 // Attach a single focusin/focusout handler on the document while someone wants 5811 // focus/blur. This is because the former are synchronous in IE while the latter 5812 // are async. In other browsers, all those handlers are invoked synchronously. 5813 5814 // `handle` from private data would already wrap the event, but we need 5815 // to change the `type` here. 5816 var handle = dataPriv.get( this, "handle" ), 5817 event = jQuery.event.fix( nativeEvent ); 5818 event.type = nativeEvent.type === "focusin" ? "focus" : "blur"; 5819 event.isSimulated = true; 5820 5821 // First, handle focusin/focusout 5822 handle( nativeEvent ); 5823 5824 // ...then, handle focus/blur 5825 // 5826 // focus/blur don't bubble while focusin/focusout do; simulate the former by only 5827 // invoking the handler at the lower level. 5828 if ( event.target === event.currentTarget ) { 5829 5830 // The setup part calls `leverageNative`, which, in turn, calls 5831 // `jQuery.event.add`, so event handle will already have been set 5832 // by this point. 5833 handle( event ); 5834 } 5835 } else { 5836 5837 // For non-IE browsers, attach a single capturing handler on the document 5838 // while someone wants focusin/focusout. 5839 jQuery.event.simulate( delegateType, nativeEvent.target, 5840 jQuery.event.fix( nativeEvent ) ); 5841 } 5842 } 5843 5844 jQuery.event.special[ type ] = { 5845 5846 // Utilize native event if possible so blur/focus sequence is correct 5847 setup: function() { 5848 5849 var attaches; 5850 5851 // Claim the first handler 5852 // dataPriv.set( this, "focus", ... ) 5853 // dataPriv.set( this, "blur", ... ) 5854 leverageNative( this, type, true ); 5855 5856 if ( document.documentMode ) { 5857 5858 // Support: IE 9 - 11+ 5859 // We use the same native handler for focusin & focus (and focusout & blur) 5860 // so we need to coordinate setup & teardown parts between those events. 5861 // Use `delegateType` as the key as `type` is already used by `leverageNative`. 5862 attaches = dataPriv.get( this, delegateType ); 5863 if ( !attaches ) { 5864 this.addEventListener( delegateType, focusMappedHandler ); 5865 } 5866 dataPriv.set( this, delegateType, ( attaches || 0 ) + 1 ); 5867 } else { 5868 5869 // Return false to allow normal processing in the caller 5870 return false; 5871 } 5872 }, 5873 trigger: function() { 5874 5875 // Force setup before trigger 5876 leverageNative( this, type ); 5877 5878 // Return non-false to allow normal event-path propagation 5879 return true; 5880 }, 5881 5882 teardown: function() { 5883 var attaches; 5884 5885 if ( document.documentMode ) { 5886 attaches = dataPriv.get( this, delegateType ) - 1; 5887 if ( !attaches ) { 5888 this.removeEventListener( delegateType, focusMappedHandler ); 5889 dataPriv.remove( this, delegateType ); 5890 } else { 5891 dataPriv.set( this, delegateType, attaches ); 5892 } 5893 } else { 5894 5895 // Return false to indicate standard teardown should be applied 5896 return false; 5897 } 5898 }, 5899 5900 // Suppress native focus or blur if we're currently inside 5901 // a leveraged native-event stack 5902 _default: function( event ) { 5903 return dataPriv.get( event.target, type ); 5904 }, 5905 5906 delegateType: delegateType 5907 }; 5908 5909 // Support: Firefox <=44 5910 // Firefox doesn't have focus(in | out) events 5911 // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 5912 // 5913 // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1 5914 // focus(in | out) events fire after focus & blur events, 5915 // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 5916 // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857 5917 // 5918 // Support: IE 9 - 11+ 5919 // To preserve relative focusin/focus & focusout/blur event order guaranteed on the 3.x branch, 5920 // attach a single handler for both events in IE. 5921 jQuery.event.special[ delegateType ] = { 5922 setup: function() { 5923 5924 // Handle: regular nodes (via `this.ownerDocument`), window 5925 // (via `this.document`) & document (via `this`). 5926 var doc = this.ownerDocument || this.document || this, 5927 dataHolder = document.documentMode ? this : doc, 5928 attaches = dataPriv.get( dataHolder, delegateType ); 5929 5930 // Support: IE 9 - 11+ 5931 // We use the same native handler for focusin & focus (and focusout & blur) 5932 // so we need to coordinate setup & teardown parts between those events. 5933 // Use `delegateType` as the key as `type` is already used by `leverageNative`. 5934 if ( !attaches ) { 5935 if ( document.documentMode ) { 5936 this.addEventListener( delegateType, focusMappedHandler ); 5937 } else { 5938 doc.addEventListener( type, focusMappedHandler, true ); 5939 } 5940 } 5941 dataPriv.set( dataHolder, delegateType, ( attaches || 0 ) + 1 ); 5942 }, 5943 teardown: function() { 5944 var doc = this.ownerDocument || this.document || this, 5945 dataHolder = document.documentMode ? this : doc, 5946 attaches = dataPriv.get( dataHolder, delegateType ) - 1; 5947 5948 if ( !attaches ) { 5949 if ( document.documentMode ) { 5950 this.removeEventListener( delegateType, focusMappedHandler ); 5951 } else { 5952 doc.removeEventListener( type, focusMappedHandler, true ); 5953 } 5954 dataPriv.remove( dataHolder, delegateType ); 5955 } else { 5956 dataPriv.set( dataHolder, delegateType, attaches ); 5957 } 5958 } 5959 }; 5960} ); 5961 5962// Create mouseenter/leave events using mouseover/out and event-time checks 5963// so that event delegation works in jQuery. 5964// Do the same for pointerenter/pointerleave and pointerover/pointerout 5965// 5966// Support: Safari 7 only 5967// Safari sends mouseenter too often; see: 5968// https://bugs.chromium.org/p/chromium/issues/detail?id=470258 5969// for the description of the bug (it existed in older Chrome versions as well). 5970jQuery.each( { 5971 mouseenter: "mouseover", 5972 mouseleave: "mouseout", 5973 pointerenter: "pointerover", 5974 pointerleave: "pointerout" 5975}, function( orig, fix ) { 5976 jQuery.event.special[ orig ] = { 5977 delegateType: fix, 5978 bindType: fix, 5979 5980 handle: function( event ) { 5981 var ret, 5982 target = this, 5983 related = event.relatedTarget, 5984 handleObj = event.handleObj; 5985 5986 // For mouseenter/leave call the handler if related is outside the target. 5987 // NB: No relatedTarget if the mouse left/entered the browser window 5988 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 5989 event.type = handleObj.origType; 5990 ret = handleObj.handler.apply( this, arguments ); 5991 event.type = fix; 5992 } 5993 return ret; 5994 } 5995 }; 5996} ); 5997 5998jQuery.fn.extend( { 5999 6000 on: function( types, selector, data, fn ) { 6001 return on( this, types, selector, data, fn ); 6002 }, 6003 one: function( types, selector, data, fn ) { 6004 return on( this, types, selector, data, fn, 1 ); 6005 }, 6006 off: function( types, selector, fn ) { 6007 var handleObj, type; 6008 if ( types && types.preventDefault && types.handleObj ) { 6009 6010 // ( event ) dispatched jQuery.Event 6011 handleObj = types.handleObj; 6012 jQuery( types.delegateTarget ).off( 6013 handleObj.namespace ? 6014 handleObj.origType + "." + handleObj.namespace : 6015 handleObj.origType, 6016 handleObj.selector, 6017 handleObj.handler 6018 ); 6019 return this; 6020 } 6021 if ( typeof types === "object" ) { 6022 6023 // ( types-object [, selector] ) 6024 for ( type in types ) { 6025 this.off( type, selector, types[ type ] ); 6026 } 6027 return this; 6028 } 6029 if ( selector === false || typeof selector === "function" ) { 6030 6031 // ( types [, fn] ) 6032 fn = selector; 6033 selector = undefined; 6034 } 6035 if ( fn === false ) { 6036 fn = returnFalse; 6037 } 6038 return this.each( function() { 6039 jQuery.event.remove( this, types, fn, selector ); 6040 } ); 6041 } 6042} ); 6043 6044 6045var 6046 6047 // Support: IE <=10 - 11, Edge 12 - 13 only 6048 // In IE/Edge using regex groups here causes severe slowdowns. 6049 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 6050 rnoInnerhtml = /<script|<style|<link/i, 6051 6052 // checked="checked" or checked 6053 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 6054 6055 rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g; 6056 6057// Prefer a tbody over its parent table for containing new rows 6058function manipulationTarget( elem, content ) { 6059 if ( nodeName( elem, "table" ) && 6060 nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) { 6061 6062 return jQuery( elem ).children( "tbody" )[ 0 ] || elem; 6063 } 6064 6065 return elem; 6066} 6067 6068// Replace/restore the type attribute of script elements for safe DOM manipulation 6069function disableScript( elem ) { 6070 elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type; 6071 return elem; 6072} 6073function restoreScript( elem ) { 6074 if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) { 6075 elem.type = elem.type.slice( 5 ); 6076 } else { 6077 elem.removeAttribute( "type" ); 6078 } 6079 6080 return elem; 6081} 6082 6083function cloneCopyEvent( src, dest ) { 6084 var i, l, type, pdataOld, udataOld, udataCur, events; 6085 6086 if ( dest.nodeType !== 1 ) { 6087 return; 6088 } 6089 6090 // 1. Copy private data: events, handlers, etc. 6091 if ( dataPriv.hasData( src ) ) { 6092 pdataOld = dataPriv.get( src ); 6093 events = pdataOld.events; 6094 6095 if ( events ) { 6096 dataPriv.remove( dest, "handle events" ); 6097 6098 for ( type in events ) { 6099 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 6100 jQuery.event.add( dest, type, events[ type ][ i ] ); 6101 } 6102 } 6103 } 6104 } 6105 6106 // 2. Copy user data 6107 if ( dataUser.hasData( src ) ) { 6108 udataOld = dataUser.access( src ); 6109 udataCur = jQuery.extend( {}, udataOld ); 6110 6111 dataUser.set( dest, udataCur ); 6112 } 6113} 6114 6115// Fix IE bugs, see support tests 6116function fixInput( src, dest ) { 6117 var nodeName = dest.nodeName.toLowerCase(); 6118 6119 // Fails to persist the checked state of a cloned checkbox or radio button. 6120 if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 6121 dest.checked = src.checked; 6122 6123 // Fails to return the selected option to the default selected state when cloning options 6124 } else if ( nodeName === "input" || nodeName === "textarea" ) { 6125 dest.defaultValue = src.defaultValue; 6126 } 6127} 6128 6129function domManip( collection, args, callback, ignored ) { 6130 6131 // Flatten any nested arrays 6132 args = flat( args ); 6133 6134 var fragment, first, scripts, hasScripts, node, doc, 6135 i = 0, 6136 l = collection.length, 6137 iNoClone = l - 1, 6138 value = args[ 0 ], 6139 valueIsFunction = isFunction( value ); 6140 6141 // We can't cloneNode fragments that contain checked, in WebKit 6142 if ( valueIsFunction || 6143 ( l > 1 && typeof value === "string" && 6144 !support.checkClone && rchecked.test( value ) ) ) { 6145 return collection.each( function( index ) { 6146 var self = collection.eq( index ); 6147 if ( valueIsFunction ) { 6148 args[ 0 ] = value.call( this, index, self.html() ); 6149 } 6150 domManip( self, args, callback, ignored ); 6151 } ); 6152 } 6153 6154 if ( l ) { 6155 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 6156 first = fragment.firstChild; 6157 6158 if ( fragment.childNodes.length === 1 ) { 6159 fragment = first; 6160 } 6161 6162 // Require either new content or an interest in ignored elements to invoke the callback 6163 if ( first || ignored ) { 6164 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 6165 hasScripts = scripts.length; 6166 6167 // Use the original fragment for the last item 6168 // instead of the first because it can end up 6169 // being emptied incorrectly in certain situations (trac-8070). 6170 for ( ; i < l; i++ ) { 6171 node = fragment; 6172 6173 if ( i !== iNoClone ) { 6174 node = jQuery.clone( node, true, true ); 6175 6176 // Keep references to cloned scripts for later restoration 6177 if ( hasScripts ) { 6178 6179 // Support: Android <=4.0 only, PhantomJS 1 only 6180 // push.apply(_, arraylike) throws on ancient WebKit 6181 jQuery.merge( scripts, getAll( node, "script" ) ); 6182 } 6183 } 6184 6185 callback.call( collection[ i ], node, i ); 6186 } 6187 6188 if ( hasScripts ) { 6189 doc = scripts[ scripts.length - 1 ].ownerDocument; 6190 6191 // Re-enable scripts 6192 jQuery.map( scripts, restoreScript ); 6193 6194 // Evaluate executable scripts on first document insertion 6195 for ( i = 0; i < hasScripts; i++ ) { 6196 node = scripts[ i ]; 6197 if ( rscriptType.test( node.type || "" ) && 6198 !dataPriv.access( node, "globalEval" ) && 6199 jQuery.contains( doc, node ) ) { 6200 6201 if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) { 6202 6203 // Optional AJAX dependency, but won't run scripts if not present 6204 if ( jQuery._evalUrl && !node.noModule ) { 6205 jQuery._evalUrl( node.src, { 6206 nonce: node.nonce || node.getAttribute( "nonce" ) 6207 }, doc ); 6208 } 6209 } else { 6210 6211 // Unwrap a CDATA section containing script contents. This shouldn't be 6212 // needed as in XML documents they're already not visible when 6213 // inspecting element contents and in HTML documents they have no 6214 // meaning but we're preserving that logic for backwards compatibility. 6215 // This will be removed completely in 4.0. See gh-4904. 6216 DOMEval( node.textContent.replace( rcleanScript, "" ), node, doc ); 6217 } 6218 } 6219 } 6220 } 6221 } 6222 } 6223 6224 return collection; 6225} 6226 6227function remove( elem, selector, keepData ) { 6228 var node, 6229 nodes = selector ? jQuery.filter( selector, elem ) : elem, 6230 i = 0; 6231 6232 for ( ; ( node = nodes[ i ] ) != null; i++ ) { 6233 if ( !keepData && node.nodeType === 1 ) { 6234 jQuery.cleanData( getAll( node ) ); 6235 } 6236 6237 if ( node.parentNode ) { 6238 if ( keepData && isAttached( node ) ) { 6239 setGlobalEval( getAll( node, "script" ) ); 6240 } 6241 node.parentNode.removeChild( node ); 6242 } 6243 } 6244 6245 return elem; 6246} 6247 6248jQuery.extend( { 6249 htmlPrefilter: function( html ) { 6250 return html; 6251 }, 6252 6253 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 6254 var i, l, srcElements, destElements, 6255 clone = elem.cloneNode( true ), 6256 inPage = isAttached( elem ); 6257 6258 // Fix IE cloning issues 6259 if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) && 6260 !jQuery.isXMLDoc( elem ) ) { 6261 6262 // We eschew jQuery#find here for performance reasons: 6263 // https://jsperf.com/getall-vs-sizzle/2 6264 destElements = getAll( clone ); 6265 srcElements = getAll( elem ); 6266 6267 for ( i = 0, l = srcElements.length; i < l; i++ ) { 6268 fixInput( srcElements[ i ], destElements[ i ] ); 6269 } 6270 } 6271 6272 // Copy the events from the original to the clone 6273 if ( dataAndEvents ) { 6274 if ( deepDataAndEvents ) { 6275 srcElements = srcElements || getAll( elem ); 6276 destElements = destElements || getAll( clone ); 6277 6278 for ( i = 0, l = srcElements.length; i < l; i++ ) { 6279 cloneCopyEvent( srcElements[ i ], destElements[ i ] ); 6280 } 6281 } else { 6282 cloneCopyEvent( elem, clone ); 6283 } 6284 } 6285 6286 // Preserve script evaluation history 6287 destElements = getAll( clone, "script" ); 6288 if ( destElements.length > 0 ) { 6289 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 6290 } 6291 6292 // Return the cloned set 6293 return clone; 6294 }, 6295 6296 cleanData: function( elems ) { 6297 var data, elem, type, 6298 special = jQuery.event.special, 6299 i = 0; 6300 6301 for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) { 6302 if ( acceptData( elem ) ) { 6303 if ( ( data = elem[ dataPriv.expando ] ) ) { 6304 if ( data.events ) { 6305 for ( type in data.events ) { 6306 if ( special[ type ] ) { 6307 jQuery.event.remove( elem, type ); 6308 6309 // This is a shortcut to avoid jQuery.event.remove's overhead 6310 } else { 6311 jQuery.removeEvent( elem, type, data.handle ); 6312 } 6313 } 6314 } 6315
vendor: 1,119 bytes, lines 6316-6360
6316 // Support: Chrome <=35 - 45+ 6317 // Assign undefined instead of using delete, see Data#remove 6318 elem[ dataPriv.expando ] = undefined; 6319 } 6320 if ( elem[ dataUser.expando ] ) { 6321 6322 // Support: Chrome <=35 - 45+ 6323 // Assign undefined instead of using delete, see Data#remove 6324 elem[ dataUser.expando ] = undefined; 6325 } 6326 } 6327 } 6328 } 6329} ); 6330 6331jQuery.fn.extend( { 6332 detach: function( selector ) { 6333 return remove( this, selector, true ); 6334 }, 6335 6336 remove: function( selector ) { 6337 return remove( this, selector ); 6338 }, 6339 6340 text: function( value ) { 6341 return access( this, function( value ) { 6342 return value === undefined ? 6343 jQuery.text( this ) : 6344 this.empty().each( function() { 6345 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6346 this.textContent = value; 6347 } 6348 } ); 6349 }, null, value, arguments.length ); 6350 }, 6351 6352 append: function() { 6353 return domManip( this, arguments, function( elem ) { 6354 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6355 var target = manipulationTarget( this, elem ); 6356 target.appendChild( elem ); 6357 } 6358 } ); 6359 }, 6360
vendor: 58,446 bytes, lines 6361-8575
6361 prepend: function() { 6362 return domManip( this, arguments, function( elem ) { 6363 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6364 var target = manipulationTarget( this, elem ); 6365 target.insertBefore( elem, target.firstChild ); 6366 } 6367 } ); 6368 }, 6369 6370 before: function() { 6371 return domManip( this, arguments, function( elem ) { 6372 if ( this.parentNode ) { 6373 this.parentNode.insertBefore( elem, this ); 6374 } 6375 } ); 6376 }, 6377 6378 after: function() { 6379 return domManip( this, arguments, function( elem ) { 6380 if ( this.parentNode ) { 6381 this.parentNode.insertBefore( elem, this.nextSibling ); 6382 } 6383 } ); 6384 }, 6385 6386 empty: function() { 6387 var elem, 6388 i = 0; 6389 6390 for ( ; ( elem = this[ i ] ) != null; i++ ) { 6391 if ( elem.nodeType === 1 ) { 6392 6393 // Prevent memory leaks 6394 jQuery.cleanData( getAll( elem, false ) ); 6395 6396 // Remove any remaining nodes 6397 elem.textContent = ""; 6398 } 6399 } 6400 6401 return this; 6402 }, 6403 6404 clone: function( dataAndEvents, deepDataAndEvents ) { 6405 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 6406 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 6407 6408 return this.map( function() { 6409 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 6410 } ); 6411 }, 6412 6413 html: function( value ) { 6414 return access( this, function( value ) { 6415 var elem = this[ 0 ] || {}, 6416 i = 0, 6417 l = this.length; 6418 6419 if ( value === undefined && elem.nodeType === 1 ) { 6420 return elem.innerHTML; 6421 } 6422 6423 // See if we can take a shortcut and just use innerHTML 6424 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 6425 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 6426 6427 value = jQuery.htmlPrefilter( value ); 6428 6429 try { 6430 for ( ; i < l; i++ ) { 6431 elem = this[ i ] || {}; 6432 6433 // Remove element nodes and prevent memory leaks 6434 if ( elem.nodeType === 1 ) { 6435 jQuery.cleanData( getAll( elem, false ) ); 6436 elem.innerHTML = value; 6437 } 6438 } 6439 6440 elem = 0; 6441 6442 // If using innerHTML throws an exception, use the fallback method 6443 } catch ( e ) {} 6444 } 6445 6446 if ( elem ) { 6447 this.empty().append( value ); 6448 } 6449 }, null, value, arguments.length ); 6450 }, 6451 6452 replaceWith: function() { 6453 var ignored = []; 6454 6455 // Make the changes, replacing each non-ignored context element with the new content 6456 return domManip( this, arguments, function( elem ) { 6457 var parent = this.parentNode; 6458 6459 if ( jQuery.inArray( this, ignored ) < 0 ) { 6460 jQuery.cleanData( getAll( this ) ); 6461 if ( parent ) { 6462 parent.replaceChild( elem, this ); 6463 } 6464 } 6465 6466 // Force callback invocation 6467 }, ignored ); 6468 } 6469} ); 6470 6471jQuery.each( { 6472 appendTo: "append", 6473 prependTo: "prepend", 6474 insertBefore: "before", 6475 insertAfter: "after", 6476 replaceAll: "replaceWith" 6477}, function( name, original ) { 6478 jQuery.fn[ name ] = function( selector ) { 6479 var elems, 6480 ret = [], 6481 insert = jQuery( selector ), 6482 last = insert.length - 1, 6483 i = 0; 6484 6485 for ( ; i <= last; i++ ) { 6486 elems = i === last ? this : this.clone( true ); 6487 jQuery( insert[ i ] )[ original ]( elems ); 6488 6489 // Support: Android <=4.0 only, PhantomJS 1 only 6490 // .get() because push.apply(_, arraylike) throws on ancient WebKit 6491 push.apply( ret, elems.get() ); 6492 } 6493 6494 return this.pushStack( ret ); 6495 }; 6496} ); 6497var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 6498 6499var rcustomProp = /^--/; 6500 6501 6502var getStyles = function( elem ) { 6503 6504 // Support: IE <=11 only, Firefox <=30 (trac-15098, trac-14150) 6505 // IE throws on elements created in popups 6506 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 6507 var view = elem.ownerDocument.defaultView; 6508 6509 if ( !view || !view.opener ) { 6510 view = window; 6511 } 6512 6513 return view.getComputedStyle( elem ); 6514 }; 6515 6516var swap = function( elem, options, callback ) { 6517 var ret, name, 6518 old = {}; 6519 6520 // Remember the old values, and insert the new ones 6521 for ( name in options ) { 6522 old[ name ] = elem.style[ name ]; 6523 elem.style[ name ] = options[ name ]; 6524 } 6525 6526 ret = callback.call( elem ); 6527 6528 // Revert the old values 6529 for ( name in options ) { 6530 elem.style[ name ] = old[ name ]; 6531 } 6532 6533 return ret; 6534}; 6535 6536 6537var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" ); 6538 6539 6540 6541( function() { 6542 6543 // Executing both pixelPosition & boxSizingReliable tests require only one layout 6544 // so they're executed at the same time to save the second computation. 6545 function computeStyleTests() { 6546 6547 // This is a singleton, we need to execute it only once 6548 if ( !div ) { 6549 return; 6550 } 6551 6552 container.style.cssText = "position:absolute;left:-11111px;width:60px;" + 6553 "margin-top:1px;padding:0;border:0"; 6554 div.style.cssText = 6555 "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + 6556 "margin:auto;border:1px;padding:1px;" + 6557 "width:60%;top:1%"; 6558 documentElement.appendChild( container ).appendChild( div ); 6559 6560 var divStyle = window.getComputedStyle( div ); 6561 pixelPositionVal = divStyle.top !== "1%"; 6562 6563 // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44 6564 reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12; 6565 6566 // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3 6567 // Some styles come back with percentage values, even though they shouldn't 6568 div.style.right = "60%"; 6569 pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36; 6570 6571 // Support: IE 9 - 11 only 6572 // Detect misreporting of content dimensions for box-sizing:border-box elements 6573 boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36; 6574 6575 // Support: IE 9 only 6576 // Detect overflow:scroll screwiness (gh-3699) 6577 // Support: Chrome <=64 6578 // Don't get tricked when zoom affects offsetWidth (gh-4029) 6579 div.style.position = "absolute"; 6580 scrollboxSizeVal = roundPixelMeasures( div.offsetWidth / 3 ) === 12; 6581 6582 documentElement.removeChild( container ); 6583 6584 // Nullify the div so it wouldn't be stored in the memory and 6585 // it will also be a sign that checks already performed 6586 div = null; 6587 } 6588 6589 function roundPixelMeasures( measure ) { 6590 return Math.round( parseFloat( measure ) ); 6591 } 6592 6593 var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, 6594 reliableTrDimensionsVal, reliableMarginLeftVal, 6595 container = document.createElement( "div" ), 6596 div = document.createElement( "div" ); 6597 6598 // Finish early in limited (non-browser) environments 6599 if ( !div.style ) { 6600 return; 6601 } 6602 6603 // Support: IE <=9 - 11 only 6604 // Style of cloned element affects source element cloned (trac-8908) 6605 div.style.backgroundClip = "content-box"; 6606 div.cloneNode( true ).style.backgroundClip = ""; 6607 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 6608 6609 jQuery.extend( support, { 6610 boxSizingReliable: function() { 6611 computeStyleTests(); 6612 return boxSizingReliableVal; 6613 }, 6614 pixelBoxStyles: function() { 6615 computeStyleTests(); 6616 return pixelBoxStylesVal; 6617 }, 6618 pixelPosition: function() { 6619 computeStyleTests(); 6620 return pixelPositionVal; 6621 }, 6622 reliableMarginLeft: function() { 6623 computeStyleTests(); 6624 return reliableMarginLeftVal; 6625 }, 6626 scrollboxSize: function() { 6627 computeStyleTests(); 6628 return scrollboxSizeVal; 6629 }, 6630 6631 // Support: IE 9 - 11+, Edge 15 - 18+ 6632 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6633 // set in CSS while `offset*` properties report correct values. 6634 // Behavior in IE 9 is more subtle than in newer versions & it passes 6635 // some versions of this test; make sure not to make it pass there! 6636 // 6637 // Support: Firefox 70+ 6638 // Only Firefox includes border widths 6639 // in computed dimensions. (gh-4529) 6640 reliableTrDimensions: function() { 6641 var table, tr, trChild, trStyle; 6642 if ( reliableTrDimensionsVal == null ) { 6643 table = document.createElement( "table" ); 6644 tr = document.createElement( "tr" ); 6645 trChild = document.createElement( "div" ); 6646 6647 table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate"; 6648 tr.style.cssText = "box-sizing:content-box;border:1px solid"; 6649 6650 // Support: Chrome 86+ 6651 // Height set through cssText does not get applied. 6652 // Computed height then comes back as 0. 6653 tr.style.height = "1px"; 6654 trChild.style.height = "9px"; 6655 6656 // Support: Android 8 Chrome 86+ 6657 // In our bodyBackground.html iframe, 6658 // display for all div elements is set to "inline", 6659 // which causes a problem only in Android 8 Chrome 86. 6660 // Ensuring the div is `display: block` 6661 // gets around this issue. 6662 trChild.style.display = "block"; 6663 6664 documentElement 6665 .appendChild( table ) 6666 .appendChild( tr ) 6667 .appendChild( trChild ); 6668 6669 trStyle = window.getComputedStyle( tr ); 6670 reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) + 6671 parseInt( trStyle.borderTopWidth, 10 ) + 6672 parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight; 6673 6674 documentElement.removeChild( table ); 6675 } 6676 return reliableTrDimensionsVal; 6677 } 6678 } ); 6679} )(); 6680 6681 6682function curCSS( elem, name, computed ) { 6683 var width, minWidth, maxWidth, ret, 6684 isCustomProp = rcustomProp.test( name ), 6685 6686 // Support: Firefox 51+ 6687 // Retrieving style before computed somehow 6688 // fixes an issue with getting wrong values 6689 // on detached elements 6690 style = elem.style; 6691 6692 computed = computed || getStyles( elem ); 6693 6694 // getPropertyValue is needed for: 6695 // .css('filter') (IE 9 only, trac-12537) 6696 // .css('--customProperty) (gh-3144) 6697 if ( computed ) { 6698 6699 // Support: IE <=9 - 11+ 6700 // IE only supports `"float"` in `getPropertyValue`; in computed styles 6701 // it's only available as `"cssFloat"`. We no longer modify properties 6702 // sent to `.css()` apart from camelCasing, so we need to check both. 6703 // Normally, this would create difference in behavior: if 6704 // `getPropertyValue` returns an empty string, the value returned 6705 // by `.css()` would be `undefined`. This is usually the case for 6706 // disconnected elements. However, in IE even disconnected elements 6707 // with no styles return `"none"` for `getPropertyValue( "float" )` 6708 ret = computed.getPropertyValue( name ) || computed[ name ]; 6709 6710 if ( isCustomProp && ret ) { 6711 6712 // Support: Firefox 105+, Chrome <=105+ 6713 // Spec requires trimming whitespace for custom properties (gh-4926). 6714 // Firefox only trims leading whitespace. Chrome just collapses 6715 // both leading & trailing whitespace to a single space. 6716 // 6717 // Fall back to `undefined` if empty string returned. 6718 // This collapses a missing definition with property defined 6719 // and set to an empty string but there's no standard API 6720 // allowing us to differentiate them without a performance penalty 6721 // and returning `undefined` aligns with older jQuery. 6722 // 6723 // rtrimCSS treats U+000D CARRIAGE RETURN and U+000C FORM FEED 6724 // as whitespace while CSS does not, but this is not a problem 6725 // because CSS preprocessing replaces them with U+000A LINE FEED 6726 // (which *is* CSS whitespace) 6727 // https://www.w3.org/TR/css-syntax-3/#input-preprocessing 6728 ret = ret.replace( rtrimCSS, "$1" ) || undefined; 6729 } 6730 6731 if ( ret === "" && !isAttached( elem ) ) { 6732 ret = jQuery.style( elem, name ); 6733 } 6734 6735 // A tribute to the "awesome hack by Dean Edwards" 6736 // Android Browser returns percentage for some values, 6737 // but width seems to be reliably pixels. 6738 // This is against the CSSOM draft spec: 6739 // https://drafts.csswg.org/cssom/#resolved-values 6740 if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) { 6741 6742 // Remember the original values 6743 width = style.width; 6744 minWidth = style.minWidth; 6745 maxWidth = style.maxWidth; 6746 6747 // Put in the new values to get a computed value out 6748 style.minWidth = style.maxWidth = style.width = ret; 6749 ret = computed.width; 6750 6751 // Revert the changed values 6752 style.width = width; 6753 style.minWidth = minWidth; 6754 style.maxWidth = maxWidth; 6755 } 6756 } 6757 6758 return ret !== undefined ? 6759 6760 // Support: IE <=9 - 11 only 6761 // IE returns zIndex value as an integer. 6762 ret + "" : 6763 ret; 6764} 6765 6766 6767function addGetHookIf( conditionFn, hookFn ) { 6768 6769 // Define the hook, we'll check on the first run if it's really needed. 6770 return { 6771 get: function() { 6772 if ( conditionFn() ) { 6773 6774 // Hook not needed (or it's not possible to use it due 6775 // to missing dependency), remove it. 6776 delete this.get; 6777 return; 6778 } 6779 6780 // Hook needed; redefine it so that the support test is not executed again. 6781 return ( this.get = hookFn ).apply( this, arguments ); 6782 } 6783 }; 6784} 6785 6786 6787var cssPrefixes = [ "Webkit", "Moz", "ms" ], 6788 emptyStyle = document.createElement( "div" ).style, 6789 vendorProps = {}; 6790 6791// Return a vendor-prefixed property or undefined 6792function vendorPropName( name ) { 6793 6794 // Check for vendor prefixed names 6795 var capName = name[ 0 ].toUpperCase() + name.slice( 1 ), 6796 i = cssPrefixes.length; 6797 6798 while ( i-- ) { 6799 name = cssPrefixes[ i ] + capName; 6800 if ( name in emptyStyle ) { 6801 return name; 6802 } 6803 } 6804} 6805 6806// Return a potentially-mapped jQuery.cssProps or vendor prefixed property 6807function finalPropName( name ) { 6808 var final = jQuery.cssProps[ name ] || vendorProps[ name ]; 6809 6810 if ( final ) { 6811 return final; 6812 } 6813 if ( name in emptyStyle ) { 6814 return name; 6815 } 6816 return vendorProps[ name ] = vendorPropName( name ) || name; 6817} 6818 6819 6820var 6821 6822 // Swappable if display is none or starts with table 6823 // except "table", "table-cell", or "table-caption" 6824 // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display 6825 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 6826 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 6827 cssNormalTransform = { 6828 letterSpacing: "0", 6829 fontWeight: "400" 6830 }; 6831 6832function setPositiveNumber( _elem, value, subtract ) { 6833 6834 // Any relative (+/-) values have already been 6835 // normalized at this point 6836 var matches = rcssNum.exec( value ); 6837 return matches ? 6838 6839 // Guard against undefined "subtract", e.g., when used as in cssHooks 6840 Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) : 6841 value; 6842} 6843 6844function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) { 6845 var i = dimension === "width" ? 1 : 0, 6846 extra = 0, 6847 delta = 0, 6848 marginDelta = 0; 6849 6850 // Adjustment may not be necessary 6851 if ( box === ( isBorderBox ? "border" : "content" ) ) { 6852 return 0; 6853 } 6854 6855 for ( ; i < 4; i += 2 ) { 6856 6857 // Both box models exclude margin 6858 // Count margin delta separately to only add it after scroll gutter adjustment. 6859 // This is needed to make negative margins work with `outerHeight( true )` (gh-3982). 6860 if ( box === "margin" ) { 6861 marginDelta += jQuery.css( elem, box + cssExpand[ i ], true, styles ); 6862 } 6863 6864 // If we get here with a content-box, we're seeking "padding" or "border" or "margin" 6865 if ( !isBorderBox ) { 6866 6867 // Add padding 6868 delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6869 6870 // For "border" or "margin", add border 6871 if ( box !== "padding" ) { 6872 delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6873 6874 // But still keep track of it otherwise 6875 } else { 6876 extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6877 } 6878 6879 // If we get here with a border-box (content + padding + border), we're seeking "content" or 6880 // "padding" or "margin" 6881 } else { 6882 6883 // For "content", subtract padding 6884 if ( box === "content" ) { 6885 delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6886 } 6887 6888 // For "content" or "padding", subtract border 6889 if ( box !== "margin" ) { 6890 delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6891 } 6892 } 6893 } 6894 6895 // Account for positive content-box scroll gutter when requested by providing computedVal 6896 if ( !isBorderBox && computedVal >= 0 ) { 6897 6898 // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border 6899 // Assuming integer scroll gutter, subtract the rest and round down 6900 delta += Math.max( 0, Math.ceil( 6901 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 6902 computedVal - 6903 delta - 6904 extra - 6905 0.5 6906 6907 // If offsetWidth/offsetHeight is unknown, then we can't determine content-box scroll gutter 6908 // Use an explicit zero to avoid NaN (gh-3964) 6909 ) ) || 0; 6910 } 6911 6912 return delta + marginDelta; 6913} 6914 6915function getWidthOrHeight( elem, dimension, extra ) { 6916 6917 // Start with computed style 6918 var styles = getStyles( elem ), 6919 6920 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-4322). 6921 // Fake content-box until we know it's needed to know the true value. 6922 boxSizingNeeded = !support.boxSizingReliable() || extra, 6923 isBorderBox = boxSizingNeeded && 6924 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 6925 valueIsBorderBox = isBorderBox, 6926 6927 val = curCSS( elem, dimension, styles ), 6928 offsetProp = "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ); 6929 6930 // Support: Firefox <=54 6931 // Return a confounding non-pixel value or feign ignorance, as appropriate. 6932 if ( rnumnonpx.test( val ) ) { 6933 if ( !extra ) { 6934 return val; 6935 } 6936 val = "auto"; 6937 } 6938 6939 6940 // Support: IE 9 - 11 only 6941 // Use offsetWidth/offsetHeight for when box sizing is unreliable. 6942 // In those cases, the computed value can be trusted to be border-box. 6943 if ( ( !support.boxSizingReliable() && isBorderBox || 6944 6945 // Support: IE 10 - 11+, Edge 15 - 18+ 6946 // IE/Edge misreport `getComputedStyle` of table rows with width/height 6947 // set in CSS while `offset*` properties report correct values. 6948 // Interestingly, in some cases IE 9 doesn't suffer from this issue. 6949 !support.reliableTrDimensions() && nodeName( elem, "tr" ) || 6950 6951 // Fall back to offsetWidth/offsetHeight when value is "auto" 6952 // This happens for inline elements with no explicit setting (gh-3571) 6953 val === "auto" || 6954 6955 // Support: Android <=4.1 - 4.3 only 6956 // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602) 6957 !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) && 6958 6959 // Make sure the element is visible & connected 6960 elem.getClientRects().length ) { 6961 6962 isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 6963 6964 // Where available, offsetWidth/offsetHeight approximate border box dimensions. 6965 // Where not available (e.g., SVG), assume unreliable box-sizing and interpret the 6966 // retrieved value as a content box dimension. 6967 valueIsBorderBox = offsetProp in elem; 6968 if ( valueIsBorderBox ) { 6969 val = elem[ offsetProp ]; 6970 } 6971 } 6972 6973 // Normalize "" and auto 6974 val = parseFloat( val ) || 0; 6975 6976 // Adjust for the element's box model 6977 return ( val + 6978 boxModelAdjustment( 6979 elem, 6980 dimension, 6981 extra || ( isBorderBox ? "border" : "content" ), 6982 valueIsBorderBox, 6983 styles, 6984 6985 // Provide the current computed size to request scroll gutter calculation (gh-3589) 6986 val 6987 ) 6988 ) + "px"; 6989} 6990 6991jQuery.extend( { 6992 6993 // Add in style property hooks for overriding the default 6994 // behavior of getting and setting a style property 6995 cssHooks: { 6996 opacity: { 6997 get: function( elem, computed ) { 6998 if ( computed ) { 6999 7000 // We should always get a number back from opacity 7001 var ret = curCSS( elem, "opacity" ); 7002 return ret === "" ? "1" : ret; 7003 } 7004 } 7005 } 7006 }, 7007 7008 // Don't automatically add "px" to these possibly-unitless properties 7009 cssNumber: { 7010 animationIterationCount: true, 7011 aspectRatio: true, 7012 borderImageSlice: true, 7013 columnCount: true, 7014 flexGrow: true, 7015 flexShrink: true, 7016 fontWeight: true, 7017 gridArea: true, 7018 gridColumn: true, 7019 gridColumnEnd: true, 7020 gridColumnStart: true, 7021 gridRow: true, 7022 gridRowEnd: true, 7023 gridRowStart: true, 7024 lineHeight: true, 7025 opacity: true, 7026 order: true, 7027 orphans: true, 7028 scale: true, 7029 widows: true, 7030 zIndex: true, 7031 zoom: true, 7032 7033 // SVG-related 7034 fillOpacity: true, 7035 floodOpacity: true, 7036 stopOpacity: true, 7037 strokeMiterlimit: true, 7038 strokeOpacity: true 7039 }, 7040 7041 // Add in properties whose names you wish to fix before 7042 // setting or getting the value 7043 cssProps: {}, 7044 7045 // Get and set the style property on a DOM Node 7046 style: function( elem, name, value, extra ) { 7047 7048 // Don't set styles on text and comment nodes 7049 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 7050 return; 7051 } 7052 7053 // Make sure that we're working with the right name 7054 var ret, type, hooks, 7055 origName = camelCase( name ), 7056 isCustomProp = rcustomProp.test( name ), 7057 style = elem.style; 7058 7059 // Make sure that we're working with the right name. We don't 7060 // want to query the value if it is a CSS custom property 7061 // since they are user-defined. 7062 if ( !isCustomProp ) { 7063 name = finalPropName( origName ); 7064 } 7065 7066 // Gets hook for the prefixed version, then unprefixed version 7067 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 7068 7069 // Check if we're setting a value 7070 if ( value !== undefined ) { 7071 type = typeof value; 7072 7073 // Convert "+=" or "-=" to relative numbers (trac-7345) 7074 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 7075 value = adjustCSS( elem, name, ret ); 7076 7077 // Fixes bug trac-9237 7078 type = "number"; 7079 } 7080 7081 // Make sure that null and NaN values aren't set (trac-7116) 7082 if ( value == null || value !== value ) { 7083 return; 7084 } 7085 7086 // If a number was passed in, add the unit (except for certain CSS properties) 7087 // The isCustomProp check can be removed in jQuery 4.0 when we only auto-append 7088 // "px" to a few hardcoded values. 7089 if ( type === "number" && !isCustomProp ) { 7090 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 7091 } 7092 7093 // background-* props affect original clone's values 7094 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 7095 style[ name ] = "inherit"; 7096 } 7097 7098 // If a hook was provided, use that value, otherwise just set the specified value 7099 if ( !hooks || !( "set" in hooks ) || 7100 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 7101 7102 if ( isCustomProp ) { 7103 style.setProperty( name, value ); 7104 } else { 7105 style[ name ] = value; 7106 } 7107 } 7108 7109 } else { 7110 7111 // If a hook was provided get the non-computed value from there 7112 if ( hooks && "get" in hooks && 7113 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 7114 7115 return ret; 7116 } 7117 7118 // Otherwise just get the value from the style object 7119 return style[ name ]; 7120 } 7121 }, 7122 7123 css: function( elem, name, extra, styles ) { 7124 var val, num, hooks, 7125 origName = camelCase( name ), 7126 isCustomProp = rcustomProp.test( name ); 7127 7128 // Make sure that we're working with the right name. We don't 7129 // want to modify the value if it is a CSS custom property 7130 // since they are user-defined. 7131 if ( !isCustomProp ) { 7132 name = finalPropName( origName ); 7133 } 7134 7135 // Try prefixed name followed by the unprefixed name 7136 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 7137 7138 // If a hook was provided get the computed value from there 7139 if ( hooks && "get" in hooks ) { 7140 val = hooks.get( elem, true, extra ); 7141 } 7142 7143 // Otherwise, if a way to get the computed value exists, use that 7144 if ( val === undefined ) { 7145 val = curCSS( elem, name, styles ); 7146 } 7147 7148 // Convert "normal" to computed value 7149 if ( val === "normal" && name in cssNormalTransform ) { 7150 val = cssNormalTransform[ name ]; 7151 } 7152 7153 // Make numeric if forced or a qualifier was provided and val looks numeric 7154 if ( extra === "" || extra ) { 7155 num = parseFloat( val ); 7156 return extra === true || isFinite( num ) ? num || 0 : val; 7157 } 7158 7159 return val; 7160 } 7161} ); 7162 7163jQuery.each( [ "height", "width" ], function( _i, dimension ) { 7164 jQuery.cssHooks[ dimension ] = { 7165 get: function( elem, computed, extra ) { 7166 if ( computed ) { 7167 7168 // Certain elements can have dimension info if we invisibly show them 7169 // but it must have a current display style that would benefit 7170 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 7171 7172 // Support: Safari 8+ 7173 // Table columns in Safari have non-zero offsetWidth & zero 7174 // getBoundingClientRect().width unless display is changed. 7175 // Support: IE <=11 only 7176 // Running getBoundingClientRect on a disconnected node 7177 // in IE throws an error. 7178 ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ? 7179 swap( elem, cssShow, function() { 7180 return getWidthOrHeight( elem, dimension, extra ); 7181 } ) : 7182 getWidthOrHeight( elem, dimension, extra ); 7183 } 7184 }, 7185 7186 set: function( elem, value, extra ) { 7187 var matches, 7188 styles = getStyles( elem ), 7189 7190 // Only read styles.position if the test has a chance to fail 7191 // to avoid forcing a reflow. 7192 scrollboxSizeBuggy = !support.scrollboxSize() && 7193 styles.position === "absolute", 7194 7195 // To avoid forcing a reflow, only fetch boxSizing if we need it (gh-3991) 7196 boxSizingNeeded = scrollboxSizeBuggy || extra, 7197 isBorderBox = boxSizingNeeded && 7198 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 7199 subtract = extra ? 7200 boxModelAdjustment( 7201 elem, 7202 dimension, 7203 extra, 7204 isBorderBox, 7205 styles 7206 ) : 7207 0; 7208 7209 // Account for unreliable border-box dimensions by comparing offset* to computed and 7210 // faking a content-box to get border and padding (gh-3699) 7211 if ( isBorderBox && scrollboxSizeBuggy ) { 7212 subtract -= Math.ceil( 7213 elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] - 7214 parseFloat( styles[ dimension ] ) - 7215 boxModelAdjustment( elem, dimension, "border", false, styles ) - 7216 0.5 7217 ); 7218 } 7219 7220 // Convert to pixels if value adjustment is needed 7221 if ( subtract && ( matches = rcssNum.exec( value ) ) && 7222 ( matches[ 3 ] || "px" ) !== "px" ) { 7223 7224 elem.style[ dimension ] = value; 7225 value = jQuery.css( elem, dimension ); 7226 } 7227 7228 return setPositiveNumber( elem, value, subtract ); 7229 } 7230 }; 7231} ); 7232 7233jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 7234 function( elem, computed ) { 7235 if ( computed ) { 7236 return ( parseFloat( curCSS( elem, "marginLeft" ) ) || 7237 elem.getBoundingClientRect().left - 7238 swap( elem, { marginLeft: 0 }, function() { 7239 return elem.getBoundingClientRect().left; 7240 } ) 7241 ) + "px"; 7242 } 7243 } 7244); 7245 7246// These hooks are used by animate to expand properties 7247jQuery.each( { 7248 margin: "", 7249 padding: "", 7250 border: "Width" 7251}, function( prefix, suffix ) { 7252 jQuery.cssHooks[ prefix + suffix ] = { 7253 expand: function( value ) { 7254 var i = 0, 7255 expanded = {}, 7256 7257 // Assumes a single number if not a string 7258 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 7259 7260 for ( ; i < 4; i++ ) { 7261 expanded[ prefix + cssExpand[ i ] + suffix ] = 7262 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 7263 } 7264 7265 return expanded; 7266 } 7267 }; 7268 7269 if ( prefix !== "margin" ) { 7270 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 7271 } 7272} ); 7273 7274jQuery.fn.extend( { 7275 css: function( name, value ) { 7276 return access( this, function( elem, name, value ) { 7277 var styles, len, 7278 map = {}, 7279 i = 0; 7280 7281 if ( Array.isArray( name ) ) { 7282 styles = getStyles( elem ); 7283 len = name.length; 7284 7285 for ( ; i < len; i++ ) { 7286 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 7287 } 7288 7289 return map; 7290 } 7291 7292 return value !== undefined ? 7293 jQuery.style( elem, name, value ) : 7294 jQuery.css( elem, name ); 7295 }, name, value, arguments.length > 1 ); 7296 } 7297} ); 7298 7299 7300function Tween( elem, options, prop, end, easing ) { 7301 return new Tween.prototype.init( elem, options, prop, end, easing ); 7302} 7303jQuery.Tween = Tween; 7304 7305Tween.prototype = { 7306 constructor: Tween, 7307 init: function( elem, options, prop, end, easing, unit ) { 7308 this.elem = elem; 7309 this.prop = prop; 7310 this.easing = easing || jQuery.easing._default; 7311 this.options = options; 7312 this.start = this.now = this.cur(); 7313 this.end = end; 7314 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 7315 }, 7316 cur: function() { 7317 var hooks = Tween.propHooks[ this.prop ]; 7318 7319 return hooks && hooks.get ? 7320 hooks.get( this ) : 7321 Tween.propHooks._default.get( this ); 7322 }, 7323 run: function( percent ) { 7324 var eased, 7325 hooks = Tween.propHooks[ this.prop ]; 7326 7327 if ( this.options.duration ) { 7328 this.pos = eased = jQuery.easing[ this.easing ]( 7329 percent, this.options.duration * percent, 0, 1, this.options.duration 7330 ); 7331 } else { 7332 this.pos = eased = percent; 7333 } 7334 this.now = ( this.end - this.start ) * eased + this.start; 7335 7336 if ( this.options.step ) { 7337 this.options.step.call( this.elem, this.now, this ); 7338 } 7339 7340 if ( hooks && hooks.set ) { 7341 hooks.set( this ); 7342 } else { 7343 Tween.propHooks._default.set( this ); 7344 } 7345 return this; 7346 } 7347}; 7348 7349Tween.prototype.init.prototype = Tween.prototype; 7350 7351Tween.propHooks = { 7352 _default: { 7353 get: function( tween ) { 7354 var result; 7355 7356 // Use a property on the element directly when it is not a DOM element, 7357 // or when there is no matching style property that exists. 7358 if ( tween.elem.nodeType !== 1 || 7359 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 7360 return tween.elem[ tween.prop ]; 7361 } 7362 7363 // Passing an empty string as a 3rd parameter to .css will automatically 7364 // attempt a parseFloat and fallback to a string if the parse fails. 7365 // Simple values such as "10px" are parsed to Float; 7366 // complex values such as "rotate(1rad)" are returned as-is. 7367 result = jQuery.css( tween.elem, tween.prop, "" ); 7368 7369 // Empty strings, null, undefined and "auto" are converted to 0. 7370 return !result || result === "auto" ? 0 : result; 7371 }, 7372 set: function( tween ) { 7373 7374 // Use step hook for back compat. 7375 // Use cssHook if its there. 7376 // Use .style if available and use plain properties where available. 7377 if ( jQuery.fx.step[ tween.prop ] ) { 7378 jQuery.fx.step[ tween.prop ]( tween ); 7379 } else if ( tween.elem.nodeType === 1 && ( 7380 jQuery.cssHooks[ tween.prop ] || 7381 tween.elem.style[ finalPropName( tween.prop ) ] != null ) ) { 7382 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 7383 } else { 7384 tween.elem[ tween.prop ] = tween.now; 7385 } 7386 } 7387 } 7388}; 7389 7390// Support: IE <=9 only 7391// Panic based approach to setting things on disconnected nodes 7392Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 7393 set: function( tween ) { 7394 if ( tween.elem.nodeType && tween.elem.parentNode ) { 7395 tween.elem[ tween.prop ] = tween.now; 7396 } 7397 } 7398}; 7399 7400jQuery.easing = { 7401 linear: function( p ) { 7402 return p; 7403 }, 7404 swing: function( p ) { 7405 return 0.5 - Math.cos( p * Math.PI ) / 2; 7406 }, 7407 _default: "swing" 7408}; 7409 7410jQuery.fx = Tween.prototype.init; 7411 7412// Back compat <1.8 extension point 7413jQuery.fx.step = {}; 7414 7415 7416 7417 7418var 7419 fxNow, inProgress, 7420 rfxtypes = /^(?:toggle|show|hide)$/, 7421 rrun = /queueHooks$/; 7422 7423function schedule() { 7424 if ( inProgress ) { 7425 if ( document.hidden === false && window.requestAnimationFrame ) { 7426 window.requestAnimationFrame( schedule ); 7427 } else { 7428 window.setTimeout( schedule, jQuery.fx.interval ); 7429 } 7430 7431 jQuery.fx.tick(); 7432 } 7433} 7434 7435// Animations created synchronously will run synchronously 7436function createFxNow() { 7437 window.setTimeout( function() { 7438 fxNow = undefined; 7439 } ); 7440 return ( fxNow = Date.now() ); 7441} 7442 7443// Generate parameters to create a standard animation 7444function genFx( type, includeWidth ) { 7445 var which, 7446 i = 0, 7447 attrs = { height: type }; 7448 7449 // If we include width, step value is 1 to do all cssExpand values, 7450 // otherwise step value is 2 to skip over Left and Right 7451 includeWidth = includeWidth ? 1 : 0; 7452 for ( ; i < 4; i += 2 - includeWidth ) { 7453 which = cssExpand[ i ]; 7454 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 7455 } 7456 7457 if ( includeWidth ) { 7458 attrs.opacity = attrs.width = type; 7459 } 7460 7461 return attrs; 7462} 7463 7464function createTween( value, prop, animation ) { 7465 var tween, 7466 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 7467 index = 0, 7468 length = collection.length; 7469 for ( ; index < length; index++ ) { 7470 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 7471 7472 // We're done with this property 7473 return tween; 7474 } 7475 } 7476} 7477 7478function defaultPrefilter( elem, props, opts ) { 7479 var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display, 7480 isBox = "width" in props || "height" in props, 7481 anim = this, 7482 orig = {}, 7483 style = elem.style, 7484 hidden = elem.nodeType && isHiddenWithinTree( elem ), 7485 dataShow = dataPriv.get( elem, "fxshow" ); 7486 7487 // Queue-skipping animations hijack the fx hooks 7488 if ( !opts.queue ) { 7489 hooks = jQuery._queueHooks( elem, "fx" ); 7490 if ( hooks.unqueued == null ) { 7491 hooks.unqueued = 0; 7492 oldfire = hooks.empty.fire; 7493 hooks.empty.fire = function() { 7494 if ( !hooks.unqueued ) { 7495 oldfire(); 7496 } 7497 }; 7498 } 7499 hooks.unqueued++; 7500 7501 anim.always( function() { 7502 7503 // Ensure the complete handler is called before this completes 7504 anim.always( function() { 7505 hooks.unqueued--; 7506 if ( !jQuery.queue( elem, "fx" ).length ) { 7507 hooks.empty.fire(); 7508 } 7509 } ); 7510 } ); 7511 } 7512 7513 // Detect show/hide animations 7514 for ( prop in props ) { 7515 value = props[ prop ]; 7516 if ( rfxtypes.test( value ) ) { 7517 delete props[ prop ]; 7518 toggle = toggle || value === "toggle"; 7519 if ( value === ( hidden ? "hide" : "show" ) ) { 7520 7521 // Pretend to be hidden if this is a "show" and 7522 // there is still data from a stopped show/hide 7523 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 7524 hidden = true; 7525 7526 // Ignore all other no-op show/hide data 7527 } else { 7528 continue; 7529 } 7530 } 7531 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 7532 } 7533 } 7534 7535 // Bail out if this is a no-op like .hide().hide() 7536 propTween = !jQuery.isEmptyObject( props ); 7537 if ( !propTween && jQuery.isEmptyObject( orig ) ) { 7538 return; 7539 } 7540 7541 // Restrict "overflow" and "display" styles during box animations 7542 if ( isBox && elem.nodeType === 1 ) { 7543 7544 // Support: IE <=9 - 11, Edge 12 - 15 7545 // Record all 3 overflow attributes because IE does not infer the shorthand 7546 // from identically-valued overflowX and overflowY and Edge just mirrors 7547 // the overflowX value there. 7548 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 7549 7550 // Identify a display type, preferring old show/hide data over the CSS cascade 7551 restoreDisplay = dataShow && dataShow.display; 7552 if ( restoreDisplay == null ) { 7553 restoreDisplay = dataPriv.get( elem, "display" ); 7554 } 7555 display = jQuery.css( elem, "display" ); 7556 if ( display === "none" ) { 7557 if ( restoreDisplay ) { 7558 display = restoreDisplay; 7559 } else { 7560 7561 // Get nonempty value(s) by temporarily forcing visibility 7562 showHide( [ elem ], true ); 7563 restoreDisplay = elem.style.display || restoreDisplay; 7564 display = jQuery.css( elem, "display" ); 7565 showHide( [ elem ] ); 7566 } 7567 } 7568 7569 // Animate inline elements as inline-block 7570 if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) { 7571 if ( jQuery.css( elem, "float" ) === "none" ) { 7572 7573 // Restore the original display value at the end of pure show/hide animations 7574 if ( !propTween ) { 7575 anim.done( function() { 7576 style.display = restoreDisplay; 7577 } ); 7578 if ( restoreDisplay == null ) { 7579 display = style.display; 7580 restoreDisplay = display === "none" ? "" : display; 7581 } 7582 } 7583 style.display = "inline-block"; 7584 } 7585 } 7586 } 7587 7588 if ( opts.overflow ) { 7589 style.overflow = "hidden"; 7590 anim.always( function() { 7591 style.overflow = opts.overflow[ 0 ]; 7592 style.overflowX = opts.overflow[ 1 ]; 7593 style.overflowY = opts.overflow[ 2 ]; 7594 } ); 7595 } 7596 7597 // Implement show/hide animations 7598 propTween = false; 7599 for ( prop in orig ) { 7600 7601 // General show/hide setup for this element animation 7602 if ( !propTween ) { 7603 if ( dataShow ) { 7604 if ( "hidden" in dataShow ) { 7605 hidden = dataShow.hidden; 7606 } 7607 } else { 7608 dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } ); 7609 } 7610 7611 // Store hidden/visible for toggle so `.stop().toggle()` "reverses" 7612 if ( toggle ) { 7613 dataShow.hidden = !hidden; 7614 } 7615 7616 // Show elements before animating them 7617 if ( hidden ) { 7618 showHide( [ elem ], true ); 7619 } 7620 7621 /* eslint-disable no-loop-func */ 7622 7623 anim.done( function() { 7624 7625 /* eslint-enable no-loop-func */ 7626 7627 // The final step of a "hide" animation is actually hiding the element 7628 if ( !hidden ) { 7629 showHide( [ elem ] ); 7630 } 7631 dataPriv.remove( elem, "fxshow" ); 7632 for ( prop in orig ) { 7633 jQuery.style( elem, prop, orig[ prop ] ); 7634 } 7635 } ); 7636 } 7637 7638 // Per-property setup 7639 propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 7640 if ( !( prop in dataShow ) ) { 7641 dataShow[ prop ] = propTween.start; 7642 if ( hidden ) { 7643 propTween.end = propTween.start; 7644 propTween.start = 0; 7645 } 7646 } 7647 } 7648} 7649 7650function propFilter( props, specialEasing ) { 7651 var index, name, easing, value, hooks; 7652 7653 // camelCase, specialEasing and expand cssHook pass 7654 for ( index in props ) { 7655 name = camelCase( index ); 7656 easing = specialEasing[ name ]; 7657 value = props[ index ]; 7658 if ( Array.isArray( value ) ) { 7659 easing = value[ 1 ]; 7660 value = props[ index ] = value[ 0 ]; 7661 } 7662 7663 if ( index !== name ) { 7664 props[ name ] = value; 7665 delete props[ index ]; 7666 } 7667 7668 hooks = jQuery.cssHooks[ name ]; 7669 if ( hooks && "expand" in hooks ) { 7670 value = hooks.expand( value ); 7671 delete props[ name ]; 7672 7673 // Not quite $.extend, this won't overwrite existing keys. 7674 // Reusing 'index' because we have the correct "name" 7675 for ( index in value ) { 7676 if ( !( index in props ) ) { 7677 props[ index ] = value[ index ]; 7678 specialEasing[ index ] = easing; 7679 } 7680 } 7681 } else { 7682 specialEasing[ name ] = easing; 7683 } 7684 } 7685} 7686 7687function Animation( elem, properties, options ) { 7688 var result, 7689 stopped, 7690 index = 0, 7691 length = Animation.prefilters.length, 7692 deferred = jQuery.Deferred().always( function() { 7693 7694 // Don't match elem in the :animated selector 7695 delete tick.elem; 7696 } ), 7697 tick = function() { 7698 if ( stopped ) { 7699 return false; 7700 } 7701 var currentTime = fxNow || createFxNow(), 7702 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 7703 7704 // Support: Android 2.3 only 7705 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (trac-12497) 7706 temp = remaining / animation.duration || 0, 7707 percent = 1 - temp, 7708 index = 0, 7709 length = animation.tweens.length; 7710 7711 for ( ; index < length; index++ ) { 7712 animation.tweens[ index ].run( percent ); 7713 } 7714 7715 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 7716 7717 // If there's more to do, yield 7718 if ( percent < 1 && length ) { 7719 return remaining; 7720 } 7721 7722 // If this was an empty animation, synthesize a final progress notification 7723 if ( !length ) { 7724 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7725 } 7726 7727 // Resolve the animation and report its conclusion 7728 deferred.resolveWith( elem, [ animation ] ); 7729 return false; 7730 }, 7731 animation = deferred.promise( { 7732 elem: elem, 7733 props: jQuery.extend( {}, properties ), 7734 opts: jQuery.extend( true, { 7735 specialEasing: {}, 7736 easing: jQuery.easing._default 7737 }, options ), 7738 originalProperties: properties, 7739 originalOptions: options, 7740 startTime: fxNow || createFxNow(), 7741 duration: options.duration, 7742 tweens: [], 7743 createTween: function( prop, end ) { 7744 var tween = jQuery.Tween( elem, animation.opts, prop, end, 7745 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 7746 animation.tweens.push( tween ); 7747 return tween; 7748 }, 7749 stop: function( gotoEnd ) { 7750 var index = 0, 7751 7752 // If we are going to the end, we want to run all the tweens 7753 // otherwise we skip this part 7754 length = gotoEnd ? animation.tweens.length : 0; 7755 if ( stopped ) { 7756 return this; 7757 } 7758 stopped = true; 7759 for ( ; index < length; index++ ) { 7760 animation.tweens[ index ].run( 1 ); 7761 } 7762 7763 // Resolve when we played the last frame; otherwise, reject 7764 if ( gotoEnd ) { 7765 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7766 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 7767 } else { 7768 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 7769 } 7770 return this; 7771 } 7772 } ), 7773 props = animation.props; 7774 7775 propFilter( props, animation.opts.specialEasing ); 7776 7777 for ( ; index < length; index++ ) { 7778 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 7779 if ( result ) { 7780 if ( isFunction( result.stop ) ) { 7781 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 7782 result.stop.bind( result ); 7783 } 7784 return result; 7785 } 7786 } 7787 7788 jQuery.map( props, createTween, animation ); 7789 7790 if ( isFunction( animation.opts.start ) ) { 7791 animation.opts.start.call( elem, animation ); 7792 } 7793 7794 // Attach callbacks from options 7795 animation 7796 .progress( animation.opts.progress ) 7797 .done( animation.opts.done, animation.opts.complete ) 7798 .fail( animation.opts.fail ) 7799 .always( animation.opts.always ); 7800 7801 jQuery.fx.timer( 7802 jQuery.extend( tick, { 7803 elem: elem, 7804 anim: animation, 7805 queue: animation.opts.queue 7806 } ) 7807 ); 7808 7809 return animation; 7810} 7811 7812jQuery.Animation = jQuery.extend( Animation, { 7813 7814 tweeners: { 7815 "*": [ function( prop, value ) { 7816 var tween = this.createTween( prop, value ); 7817 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 7818 return tween; 7819 } ] 7820 }, 7821 7822 tweener: function( props, callback ) { 7823 if ( isFunction( props ) ) { 7824 callback = props; 7825 props = [ "*" ]; 7826 } else { 7827 props = props.match( rnothtmlwhite ); 7828 } 7829 7830 var prop, 7831 index = 0, 7832 length = props.length; 7833 7834 for ( ; index < length; index++ ) { 7835 prop = props[ index ]; 7836 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 7837 Animation.tweeners[ prop ].unshift( callback ); 7838 } 7839 }, 7840 7841 prefilters: [ defaultPrefilter ], 7842 7843 prefilter: function( callback, prepend ) { 7844 if ( prepend ) { 7845 Animation.prefilters.unshift( callback ); 7846 } else { 7847 Animation.prefilters.push( callback ); 7848 } 7849 } 7850} ); 7851 7852jQuery.speed = function( speed, easing, fn ) { 7853 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 7854 complete: fn || !fn && easing || 7855 isFunction( speed ) && speed, 7856 duration: speed, 7857 easing: fn && easing || easing && !isFunction( easing ) && easing 7858 }; 7859 7860 // Go to the end state if fx are off 7861 if ( jQuery.fx.off ) { 7862 opt.duration = 0; 7863 7864 } else { 7865 if ( typeof opt.duration !== "number" ) { 7866 if ( opt.duration in jQuery.fx.speeds ) { 7867 opt.duration = jQuery.fx.speeds[ opt.duration ]; 7868 7869 } else { 7870 opt.duration = jQuery.fx.speeds._default; 7871 } 7872 } 7873 } 7874 7875 // Normalize opt.queue - true/undefined/null -> "fx" 7876 if ( opt.queue == null || opt.queue === true ) { 7877 opt.queue = "fx"; 7878 } 7879 7880 // Queueing 7881 opt.old = opt.complete; 7882 7883 opt.complete = function() { 7884 if ( isFunction( opt.old ) ) { 7885 opt.old.call( this ); 7886 } 7887 7888 if ( opt.queue ) { 7889 jQuery.dequeue( this, opt.queue ); 7890 } 7891 }; 7892 7893 return opt; 7894}; 7895 7896jQuery.fn.extend( { 7897 fadeTo: function( speed, to, easing, callback ) { 7898 7899 // Show any hidden elements after setting opacity to 0 7900 return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show() 7901 7902 // Animate to the value specified 7903 .end().animate( { opacity: to }, speed, easing, callback ); 7904 }, 7905 animate: function( prop, speed, easing, callback ) { 7906 var empty = jQuery.isEmptyObject( prop ), 7907 optall = jQuery.speed( speed, easing, callback ), 7908 doAnimation = function() { 7909 7910 // Operate on a copy of prop so per-property easing won't be lost 7911 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 7912 7913 // Empty animations, or finishing resolves immediately 7914 if ( empty || dataPriv.get( this, "finish" ) ) { 7915 anim.stop( true ); 7916 } 7917 }; 7918 7919 doAnimation.finish = doAnimation; 7920 7921 return empty || optall.queue === false ? 7922 this.each( doAnimation ) : 7923 this.queue( optall.queue, doAnimation ); 7924 }, 7925 stop: function( type, clearQueue, gotoEnd ) { 7926 var stopQueue = function( hooks ) { 7927 var stop = hooks.stop; 7928 delete hooks.stop; 7929 stop( gotoEnd ); 7930 }; 7931 7932 if ( typeof type !== "string" ) { 7933 gotoEnd = clearQueue; 7934 clearQueue = type; 7935 type = undefined; 7936 } 7937 if ( clearQueue ) { 7938 this.queue( type || "fx", [] ); 7939 } 7940 7941 return this.each( function() { 7942 var dequeue = true, 7943 index = type != null && type + "queueHooks", 7944 timers = jQuery.timers, 7945 data = dataPriv.get( this ); 7946 7947 if ( index ) { 7948 if ( data[ index ] && data[ index ].stop ) { 7949 stopQueue( data[ index ] ); 7950 } 7951 } else { 7952 for ( index in data ) { 7953 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 7954 stopQueue( data[ index ] ); 7955 } 7956 } 7957 } 7958 7959 for ( index = timers.length; index--; ) { 7960 if ( timers[ index ].elem === this && 7961 ( type == null || timers[ index ].queue === type ) ) { 7962 7963 timers[ index ].anim.stop( gotoEnd ); 7964 dequeue = false; 7965 timers.splice( index, 1 ); 7966 } 7967 } 7968 7969 // Start the next in the queue if the last step wasn't forced. 7970 // Timers currently will call their complete callbacks, which 7971 // will dequeue but only if they were gotoEnd. 7972 if ( dequeue || !gotoEnd ) { 7973 jQuery.dequeue( this, type ); 7974 } 7975 } ); 7976 }, 7977 finish: function( type ) { 7978 if ( type !== false ) { 7979 type = type || "fx"; 7980 } 7981 return this.each( function() { 7982 var index, 7983 data = dataPriv.get( this ), 7984 queue = data[ type + "queue" ], 7985 hooks = data[ type + "queueHooks" ], 7986 timers = jQuery.timers, 7987 length = queue ? queue.length : 0; 7988 7989 // Enable finishing flag on private data 7990 data.finish = true; 7991 7992 // Empty the queue first 7993 jQuery.queue( this, type, [] ); 7994 7995 if ( hooks && hooks.stop ) { 7996 hooks.stop.call( this, true ); 7997 } 7998 7999 // Look for any active animations, and finish them 8000 for ( index = timers.length; index--; ) { 8001 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 8002 timers[ index ].anim.stop( true ); 8003 timers.splice( index, 1 ); 8004 } 8005 } 8006 8007 // Look for any animations in the old queue and finish them 8008 for ( index = 0; index < length; index++ ) { 8009 if ( queue[ index ] && queue[ index ].finish ) { 8010 queue[ index ].finish.call( this ); 8011 } 8012 } 8013 8014 // Turn off finishing flag 8015 delete data.finish; 8016 } ); 8017 } 8018} ); 8019 8020jQuery.each( [ "toggle", "show", "hide" ], function( _i, name ) { 8021 var cssFn = jQuery.fn[ name ]; 8022 jQuery.fn[ name ] = function( speed, easing, callback ) { 8023 return speed == null || typeof speed === "boolean" ? 8024 cssFn.apply( this, arguments ) : 8025 this.animate( genFx( name, true ), speed, easing, callback ); 8026 }; 8027} ); 8028 8029// Generate shortcuts for custom animations 8030jQuery.each( { 8031 slideDown: genFx( "show" ), 8032 slideUp: genFx( "hide" ), 8033 slideToggle: genFx( "toggle" ), 8034 fadeIn: { opacity: "show" }, 8035 fadeOut: { opacity: "hide" }, 8036 fadeToggle: { opacity: "toggle" } 8037}, function( name, props ) { 8038 jQuery.fn[ name ] = function( speed, easing, callback ) { 8039 return this.animate( props, speed, easing, callback ); 8040 }; 8041} ); 8042 8043jQuery.timers = []; 8044jQuery.fx.tick = function() { 8045 var timer, 8046 i = 0, 8047 timers = jQuery.timers; 8048 8049 fxNow = Date.now(); 8050 8051 for ( ; i < timers.length; i++ ) { 8052 timer = timers[ i ]; 8053 8054 // Run the timer and safely remove it when done (allowing for external removal) 8055 if ( !timer() && timers[ i ] === timer ) { 8056 timers.splice( i--, 1 ); 8057 } 8058 } 8059 8060 if ( !timers.length ) { 8061 jQuery.fx.stop(); 8062 } 8063 fxNow = undefined; 8064}; 8065 8066jQuery.fx.timer = function( timer ) { 8067 jQuery.timers.push( timer ); 8068 jQuery.fx.start(); 8069}; 8070 8071jQuery.fx.interval = 13; 8072jQuery.fx.start = function() { 8073 if ( inProgress ) { 8074 return; 8075 } 8076 8077 inProgress = true; 8078 schedule(); 8079}; 8080 8081jQuery.fx.stop = function() { 8082 inProgress = null; 8083}; 8084 8085jQuery.fx.speeds = { 8086 slow: 600, 8087 fast: 200, 8088 8089 // Default speed 8090 _default: 400 8091}; 8092 8093 8094// Based off of the plugin by Clint Helfers, with permission. 8095jQuery.fn.delay = function( time, type ) { 8096 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 8097 type = type || "fx"; 8098 8099 return this.queue( type, function( next, hooks ) { 8100 var timeout = window.setTimeout( next, time ); 8101 hooks.stop = function() { 8102 window.clearTimeout( timeout ); 8103 }; 8104 } ); 8105}; 8106 8107 8108( function() { 8109 var input = document.createElement( "input" ), 8110 select = document.createElement( "select" ), 8111 opt = select.appendChild( document.createElement( "option" ) ); 8112 8113 input.type = "checkbox"; 8114 8115 // Support: Android <=4.3 only 8116 // Default value for a checkbox should be "on" 8117 support.checkOn = input.value !== ""; 8118 8119 // Support: IE <=11 only 8120 // Must access selectedIndex to make default options select 8121 support.optSelected = opt.selected; 8122 8123 // Support: IE <=11 only 8124 // An input loses its value after becoming a radio 8125 input = document.createElement( "input" ); 8126 input.value = "t"; 8127 input.type = "radio"; 8128 support.radioValue = input.value === "t"; 8129} )(); 8130 8131 8132var boolHook, 8133 attrHandle = jQuery.expr.attrHandle; 8134 8135jQuery.fn.extend( { 8136 attr: function( name, value ) { 8137 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 8138 }, 8139 8140 removeAttr: function( name ) { 8141 return this.each( function() { 8142 jQuery.removeAttr( this, name ); 8143 } ); 8144 } 8145} ); 8146 8147jQuery.extend( { 8148 attr: function( elem, name, value ) { 8149 var ret, hooks, 8150 nType = elem.nodeType; 8151 8152 // Don't get/set attributes on text, comment and attribute nodes 8153 if ( nType === 3 || nType === 8 || nType === 2 ) { 8154 return; 8155 } 8156 8157 // Fallback to prop when attributes are not supported 8158 if ( typeof elem.getAttribute === "undefined" ) { 8159 return jQuery.prop( elem, name, value ); 8160 } 8161 8162 // Attribute hooks are determined by the lowercase version 8163 // Grab necessary hook if one is defined 8164 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8165 hooks = jQuery.attrHooks[ name.toLowerCase() ] || 8166 ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined ); 8167 } 8168 8169 if ( value !== undefined ) { 8170 if ( value === null ) { 8171 jQuery.removeAttr( elem, name ); 8172 return; 8173 } 8174 8175 if ( hooks && "set" in hooks && 8176 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8177 return ret; 8178 } 8179 8180 elem.setAttribute( name, value + "" ); 8181 return value; 8182 } 8183 8184 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8185 return ret; 8186 } 8187 8188 ret = jQuery.find.attr( elem, name ); 8189 8190 // Non-existent attributes return null, we normalize to undefined 8191 return ret == null ? undefined : ret; 8192 }, 8193 8194 attrHooks: { 8195 type: { 8196 set: function( elem, value ) { 8197 if ( !support.radioValue && value === "radio" && 8198 nodeName( elem, "input" ) ) { 8199 var val = elem.value; 8200 elem.setAttribute( "type", value ); 8201 if ( val ) { 8202 elem.value = val; 8203 } 8204 return value; 8205 } 8206 } 8207 } 8208 }, 8209 8210 removeAttr: function( elem, value ) { 8211 var name, 8212 i = 0, 8213 8214 // Attribute names can contain non-HTML whitespace characters 8215 // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 8216 attrNames = value && value.match( rnothtmlwhite ); 8217 8218 if ( attrNames && elem.nodeType === 1 ) { 8219 while ( ( name = attrNames[ i++ ] ) ) { 8220 elem.removeAttribute( name ); 8221 } 8222 } 8223 } 8224} ); 8225 8226// Hooks for boolean attributes 8227boolHook = { 8228 set: function( elem, value, name ) { 8229 if ( value === false ) { 8230 8231 // Remove boolean attributes when set to false 8232 jQuery.removeAttr( elem, name ); 8233 } else { 8234 elem.setAttribute( name, name ); 8235 } 8236 return name; 8237 } 8238}; 8239 8240jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( _i, name ) { 8241 var getter = attrHandle[ name ] || jQuery.find.attr; 8242 8243 attrHandle[ name ] = function( elem, name, isXML ) { 8244 var ret, handle, 8245 lowercaseName = name.toLowerCase(); 8246 8247 if ( !isXML ) { 8248 8249 // Avoid an infinite loop by temporarily removing this function from the getter 8250 handle = attrHandle[ lowercaseName ]; 8251 attrHandle[ lowercaseName ] = ret; 8252 ret = getter( elem, name, isXML ) != null ? 8253 lowercaseName : 8254 null; 8255 attrHandle[ lowercaseName ] = handle; 8256 } 8257 return ret; 8258 }; 8259} ); 8260 8261 8262 8263 8264var rfocusable = /^(?:input|select|textarea|button)$/i, 8265 rclickable = /^(?:a|area)$/i; 8266 8267jQuery.fn.extend( { 8268 prop: function( name, value ) { 8269 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 8270 }, 8271 8272 removeProp: function( name ) { 8273 return this.each( function() { 8274 delete this[ jQuery.propFix[ name ] || name ]; 8275 } ); 8276 } 8277} ); 8278 8279jQuery.extend( { 8280 prop: function( elem, name, value ) { 8281 var ret, hooks, 8282 nType = elem.nodeType; 8283 8284 // Don't get/set properties on text, comment and attribute nodes 8285 if ( nType === 3 || nType === 8 || nType === 2 ) { 8286 return; 8287 } 8288 8289 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8290 8291 // Fix name and attach hooks 8292 name = jQuery.propFix[ name ] || name; 8293 hooks = jQuery.propHooks[ name ]; 8294 } 8295 8296 if ( value !== undefined ) { 8297 if ( hooks && "set" in hooks && 8298 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8299 return ret; 8300 } 8301 8302 return ( elem[ name ] = value ); 8303 } 8304 8305 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8306 return ret; 8307 } 8308 8309 return elem[ name ]; 8310 }, 8311 8312 propHooks: { 8313 tabIndex: { 8314 get: function( elem ) { 8315 8316 // Support: IE <=9 - 11 only 8317 // elem.tabIndex doesn't always return the 8318 // correct value when it hasn't been explicitly set 8319 // Use proper attribute retrieval (trac-12072) 8320 var tabindex = jQuery.find.attr( elem, "tabindex" ); 8321 8322 if ( tabindex ) { 8323 return parseInt( tabindex, 10 ); 8324 } 8325 8326 if ( 8327 rfocusable.test( elem.nodeName ) || 8328 rclickable.test( elem.nodeName ) && 8329 elem.href 8330 ) { 8331 return 0; 8332 } 8333 8334 return -1; 8335 } 8336 } 8337 }, 8338 8339 propFix: { 8340 "for": "htmlFor", 8341 "class": "className" 8342 } 8343} ); 8344 8345// Support: IE <=11 only 8346// Accessing the selectedIndex property 8347// forces the browser to respect setting selected 8348// on the option 8349// The getter ensures a default option is selected 8350// when in an optgroup 8351// eslint rule "no-unused-expressions" is disabled for this code 8352// since it considers such accessions noop 8353if ( !support.optSelected ) { 8354 jQuery.propHooks.selected = { 8355 get: function( elem ) { 8356 8357 /* eslint no-unused-expressions: "off" */ 8358 8359 var parent = elem.parentNode; 8360 if ( parent && parent.parentNode ) { 8361 parent.parentNode.selectedIndex; 8362 } 8363 return null; 8364 }, 8365 set: function( elem ) { 8366 8367 /* eslint no-unused-expressions: "off" */ 8368 8369 var parent = elem.parentNode; 8370 if ( parent ) { 8371 parent.selectedIndex; 8372 8373 if ( parent.parentNode ) { 8374 parent.parentNode.selectedIndex; 8375 } 8376 } 8377 } 8378 }; 8379} 8380 8381jQuery.each( [ 8382 "tabIndex", 8383 "readOnly", 8384 "maxLength", 8385 "cellSpacing", 8386 "cellPadding", 8387 "rowSpan", 8388 "colSpan", 8389 "useMap", 8390 "frameBorder", 8391 "contentEditable" 8392], function() { 8393 jQuery.propFix[ this.toLowerCase() ] = this; 8394} ); 8395 8396 8397 8398 8399 // Strip and collapse whitespace according to HTML spec 8400 // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace 8401 function stripAndCollapse( value ) { 8402 var tokens = value.match( rnothtmlwhite ) || []; 8403 return tokens.join( " " ); 8404 } 8405 8406 8407function getClass( elem ) { 8408 return elem.getAttribute && elem.getAttribute( "class" ) || ""; 8409} 8410 8411function classesToArray( value ) { 8412 if ( Array.isArray( value ) ) { 8413 return value; 8414 } 8415 if ( typeof value === "string" ) { 8416 return value.match( rnothtmlwhite ) || []; 8417 } 8418 return []; 8419} 8420 8421jQuery.fn.extend( { 8422 addClass: function( value ) { 8423 var classNames, cur, curValue, className, i, finalValue; 8424 8425 if ( isFunction( value ) ) { 8426 return this.each( function( j ) { 8427 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 8428 } ); 8429 } 8430 8431 classNames = classesToArray( value ); 8432 8433 if ( classNames.length ) { 8434 return this.each( function() { 8435 curValue = getClass( this ); 8436 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8437 8438 if ( cur ) { 8439 for ( i = 0; i < classNames.length; i++ ) { 8440 className = classNames[ i ]; 8441 if ( cur.indexOf( " " + className + " " ) < 0 ) { 8442 cur += className + " "; 8443 } 8444 } 8445 8446 // Only assign if different to avoid unneeded rendering. 8447 finalValue = stripAndCollapse( cur ); 8448 if ( curValue !== finalValue ) { 8449 this.setAttribute( "class", finalValue ); 8450 } 8451 } 8452 } ); 8453 } 8454 8455 return this; 8456 }, 8457 8458 removeClass: function( value ) { 8459 var classNames, cur, curValue, className, i, finalValue; 8460 8461 if ( isFunction( value ) ) { 8462 return this.each( function( j ) { 8463 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 8464 } ); 8465 } 8466 8467 if ( !arguments.length ) { 8468 return this.attr( "class", "" ); 8469 } 8470 8471 classNames = classesToArray( value ); 8472 8473 if ( classNames.length ) { 8474 return this.each( function() { 8475 curValue = getClass( this ); 8476 8477 // This expression is here for better compressibility (see addClass) 8478 cur = this.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " ); 8479 8480 if ( cur ) { 8481 for ( i = 0; i < classNames.length; i++ ) { 8482 className = classNames[ i ]; 8483 8484 // Remove *all* instances 8485 while ( cur.indexOf( " " + className + " " ) > -1 ) { 8486 cur = cur.replace( " " + className + " ", " " ); 8487 } 8488 } 8489 8490 // Only assign if different to avoid unneeded rendering. 8491 finalValue = stripAndCollapse( cur ); 8492 if ( curValue !== finalValue ) { 8493 this.setAttribute( "class", finalValue ); 8494 } 8495 } 8496 } ); 8497 } 8498 8499 return this; 8500 }, 8501 8502 toggleClass: function( value, stateVal ) { 8503 var classNames, className, i, self, 8504 type = typeof value, 8505 isValidValue = type === "string" || Array.isArray( value ); 8506 8507 if ( isFunction( value ) ) { 8508 return this.each( function( i ) { 8509 jQuery( this ).toggleClass( 8510 value.call( this, i, getClass( this ), stateVal ), 8511 stateVal 8512 ); 8513 } ); 8514 } 8515 8516 if ( typeof stateVal === "boolean" && isValidValue ) { 8517 return stateVal ? this.addClass( value ) : this.removeClass( value ); 8518 } 8519 8520 classNames = classesToArray( value ); 8521 8522 return this.each( function() { 8523 if ( isValidValue ) { 8524 8525 // Toggle individual class names 8526 self = jQuery( this ); 8527 8528 for ( i = 0; i < classNames.length; i++ ) { 8529 className = classNames[ i ]; 8530 8531 // Check each className given, space separated list 8532 if ( self.hasClass( className ) ) { 8533 self.removeClass( className ); 8534 } else { 8535 self.addClass( className ); 8536 } 8537 } 8538 8539 // Toggle whole class name 8540 } else if ( value === undefined || type === "boolean" ) { 8541 className = getClass( this ); 8542 if ( className ) { 8543 8544 // Store className if set 8545 dataPriv.set( this, "__className__", className ); 8546 } 8547 8548 // If the element has a class name or if we're passed `false`, 8549 // then remove the whole classname (if there was one, the above saved it). 8550 // Otherwise bring back whatever was previously saved (if anything), 8551 // falling back to the empty string if nothing was stored. 8552 if ( this.setAttribute ) { 8553 this.setAttribute( "class", 8554 className || value === false ? 8555 "" : 8556 dataPriv.get( this, "__className__" ) || "" 8557 ); 8558 } 8559 } 8560 } ); 8561 }, 8562 8563 hasClass: function( selector ) { 8564 var className, elem, 8565 i = 0; 8566 8567 className = " " + selector + " "; 8568 while ( ( elem = this[ i++ ] ) ) { 8569 if ( elem.nodeType === 1 && 8570 ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) { 8571 return true; 8572 } 8573 } 8574 8575 return false;
vendor: 1,385 bytes, lines 8576-8645
8576 } 8577} ); 8578 8579 8580 8581 8582var rreturn = /\r/g; 8583 8584jQuery.fn.extend( { 8585 val: function( value ) { 8586 var hooks, ret, valueIsFunction, 8587 elem = this[ 0 ]; 8588 8589 if ( !arguments.length ) { 8590 if ( elem ) { 8591 hooks = jQuery.valHooks[ elem.type ] || 8592 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 8593 8594 if ( hooks && 8595 "get" in hooks && 8596 ( ret = hooks.get( elem, "value" ) ) !== undefined 8597 ) { 8598 return ret; 8599 } 8600 8601 ret = elem.value; 8602 8603 // Handle most common string cases 8604 if ( typeof ret === "string" ) { 8605 return ret.replace( rreturn, "" ); 8606 } 8607 8608 // Handle cases where value is null/undef or number 8609 return ret == null ? "" : ret; 8610 } 8611 8612 return; 8613 } 8614 8615 valueIsFunction = isFunction( value ); 8616 8617 return this.each( function( i ) { 8618 var val; 8619 8620 if ( this.nodeType !== 1 ) { 8621 return; 8622 } 8623 8624 if ( valueIsFunction ) { 8625 val = value.call( this, i, jQuery( this ).val() ); 8626 } else { 8627 val = value; 8628 } 8629 8630 // Treat null/undefined as ""; convert numbers to string 8631 if ( val == null ) { 8632 val = ""; 8633 8634 } else if ( typeof val === "number" ) { 8635 val += ""; 8636 8637 } else if ( Array.isArray( val ) ) { 8638 val = jQuery.map( val, function( value ) { 8639 return value == null ? "" : value + ""; 8640 } ); 8641 } 8642 8643 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 8644 8645 // If set returns undefined, fall back to normal setting
vendor: 43,419 bytes, lines 8646-10335
8646 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 8647 this.value = val; 8648 } 8649 } ); 8650 } 8651} ); 8652 8653jQuery.extend( { 8654 valHooks: { 8655 option: { 8656 get: function( elem ) { 8657 8658 var val = jQuery.find.attr( elem, "value" ); 8659 return val != null ? 8660 val : 8661 8662 // Support: IE <=10 - 11 only 8663 // option.text throws exceptions (trac-14686, trac-14858) 8664 // Strip and collapse whitespace 8665 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 8666 stripAndCollapse( jQuery.text( elem ) ); 8667 } 8668 }, 8669 select: { 8670 get: function( elem ) { 8671 var value, option, i, 8672 options = elem.options, 8673 index = elem.selectedIndex, 8674 one = elem.type === "select-one", 8675 values = one ? null : [], 8676 max = one ? index + 1 : options.length; 8677 8678 if ( index < 0 ) { 8679 i = max; 8680 8681 } else { 8682 i = one ? index : 0; 8683 } 8684 8685 // Loop through all the selected options 8686 for ( ; i < max; i++ ) { 8687 option = options[ i ]; 8688 8689 // Support: IE <=9 only 8690 // IE8-9 doesn't update selected after form reset (trac-2551) 8691 if ( ( option.selected || i === index ) && 8692 8693 // Don't return options that are disabled or in a disabled optgroup 8694 !option.disabled && 8695 ( !option.parentNode.disabled || 8696 !nodeName( option.parentNode, "optgroup" ) ) ) { 8697 8698 // Get the specific value for the option 8699 value = jQuery( option ).val(); 8700 8701 // We don't need an array for one selects 8702 if ( one ) { 8703 return value; 8704 } 8705 8706 // Multi-Selects return an array 8707 values.push( value ); 8708 } 8709 } 8710 8711 return values; 8712 }, 8713 8714 set: function( elem, value ) { 8715 var optionSet, option, 8716 options = elem.options, 8717 values = jQuery.makeArray( value ), 8718 i = options.length; 8719 8720 while ( i-- ) { 8721 option = options[ i ]; 8722 8723 /* eslint-disable no-cond-assign */ 8724 8725 if ( option.selected = 8726 jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 8727 ) { 8728 optionSet = true; 8729 } 8730 8731 /* eslint-enable no-cond-assign */ 8732 } 8733 8734 // Force browsers to behave consistently when non-matching value is set 8735 if ( !optionSet ) { 8736 elem.selectedIndex = -1; 8737 } 8738 return values; 8739 } 8740 } 8741 } 8742} ); 8743 8744// Radios and checkboxes getter/setter 8745jQuery.each( [ "radio", "checkbox" ], function() { 8746 jQuery.valHooks[ this ] = { 8747 set: function( elem, value ) { 8748 if ( Array.isArray( value ) ) { 8749 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 8750 } 8751 } 8752 }; 8753 if ( !support.checkOn ) { 8754 jQuery.valHooks[ this ].get = function( elem ) { 8755 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 8756 }; 8757 } 8758} ); 8759 8760 8761 8762 8763// Return jQuery for attributes-only inclusion 8764var location = window.location; 8765 8766var nonce = { guid: Date.now() }; 8767 8768var rquery = ( /\?/ ); 8769 8770 8771 8772// Cross-browser xml parsing 8773jQuery.parseXML = function( data ) { 8774 var xml, parserErrorElem; 8775 if ( !data || typeof data !== "string" ) { 8776 return null; 8777 } 8778 8779 // Support: IE 9 - 11 only 8780 // IE throws on parseFromString with invalid input. 8781 try { 8782 xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" ); 8783 } catch ( e ) {} 8784 8785 parserErrorElem = xml && xml.getElementsByTagName( "parsererror" )[ 0 ]; 8786 if ( !xml || parserErrorElem ) { 8787 jQuery.error( "Invalid XML: " + ( 8788 parserErrorElem ? 8789 jQuery.map( parserErrorElem.childNodes, function( el ) { 8790 return el.textContent; 8791 } ).join( "\n" ) : 8792 data 8793 ) ); 8794 } 8795 return xml; 8796}; 8797 8798 8799var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 8800 stopPropagationCallback = function( e ) { 8801 e.stopPropagation(); 8802 }; 8803 8804jQuery.extend( jQuery.event, { 8805 8806 trigger: function( event, data, elem, onlyHandlers ) { 8807 8808 var i, cur, tmp, bubbleType, ontype, handle, special, lastElement, 8809 eventPath = [ elem || document ], 8810 type = hasOwn.call( event, "type" ) ? event.type : event, 8811 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 8812 8813 cur = lastElement = tmp = elem = elem || document; 8814 8815 // Don't do events on text and comment nodes 8816 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 8817 return; 8818 } 8819 8820 // focus/blur morphs to focusin/out; ensure we're not firing them right now 8821 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 8822 return; 8823 } 8824 8825 if ( type.indexOf( "." ) > -1 ) { 8826 8827 // Namespaced trigger; create a regexp to match event type in handle() 8828 namespaces = type.split( "." ); 8829 type = namespaces.shift(); 8830 namespaces.sort(); 8831 } 8832 ontype = type.indexOf( ":" ) < 0 && "on" + type; 8833 8834 // Caller can pass in a jQuery.Event object, Object, or just an event type string 8835 event = event[ jQuery.expando ] ? 8836 event : 8837 new jQuery.Event( type, typeof event === "object" && event ); 8838 8839 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 8840 event.isTrigger = onlyHandlers ? 2 : 3; 8841 event.namespace = namespaces.join( "." ); 8842 event.rnamespace = event.namespace ? 8843 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 8844 null; 8845 8846 // Clean up the event in case it is being reused 8847 event.result = undefined; 8848 if ( !event.target ) { 8849 event.target = elem; 8850 } 8851 8852 // Clone any incoming data and prepend the event, creating the handler arg list 8853 data = data == null ? 8854 [ event ] : 8855 jQuery.makeArray( data, [ event ] ); 8856 8857 // Allow special events to draw outside the lines 8858 special = jQuery.event.special[ type ] || {}; 8859 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 8860 return; 8861 } 8862 8863 // Determine event propagation path in advance, per W3C events spec (trac-9951) 8864 // Bubble up to document, then to window; watch for a global ownerDocument var (trac-9724) 8865 if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) { 8866 8867 bubbleType = special.delegateType || type; 8868 if ( !rfocusMorph.test( bubbleType + type ) ) { 8869 cur = cur.parentNode; 8870 } 8871 for ( ; cur; cur = cur.parentNode ) { 8872 eventPath.push( cur ); 8873 tmp = cur; 8874 } 8875 8876 // Only add window if we got to document (e.g., not plain obj or detached DOM) 8877 if ( tmp === ( elem.ownerDocument || document ) ) { 8878 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 8879 } 8880 } 8881 8882 // Fire handlers on the event path 8883 i = 0; 8884 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 8885 lastElement = cur; 8886 event.type = i > 1 ? 8887 bubbleType : 8888 special.bindType || type; 8889 8890 // jQuery handler 8891 handle = ( dataPriv.get( cur, "events" ) || Object.create( null ) )[ event.type ] && 8892 dataPriv.get( cur, "handle" ); 8893 if ( handle ) { 8894 handle.apply( cur, data ); 8895 } 8896 8897 // Native handler 8898 handle = ontype && cur[ ontype ]; 8899 if ( handle && handle.apply && acceptData( cur ) ) { 8900 event.result = handle.apply( cur, data ); 8901 if ( event.result === false ) { 8902 event.preventDefault(); 8903 } 8904 } 8905 } 8906 event.type = type; 8907 8908 // If nobody prevented the default action, do it now 8909 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 8910 8911 if ( ( !special._default || 8912 special._default.apply( eventPath.pop(), data ) === false ) && 8913 acceptData( elem ) ) { 8914 8915 // Call a native DOM method on the target with the same name as the event. 8916 // Don't do default actions on window, that's where global variables be (trac-6170) 8917 if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) { 8918 8919 // Don't re-trigger an onFOO event when we call its FOO() method 8920 tmp = elem[ ontype ]; 8921 8922 if ( tmp ) { 8923 elem[ ontype ] = null; 8924 } 8925 8926 // Prevent re-triggering of the same event, since we already bubbled it above 8927 jQuery.event.triggered = type; 8928 8929 if ( event.isPropagationStopped() ) { 8930 lastElement.addEventListener( type, stopPropagationCallback ); 8931 } 8932 8933 elem[ type ](); 8934 8935 if ( event.isPropagationStopped() ) { 8936 lastElement.removeEventListener( type, stopPropagationCallback ); 8937 } 8938 8939 jQuery.event.triggered = undefined; 8940 8941 if ( tmp ) { 8942 elem[ ontype ] = tmp; 8943 } 8944 } 8945 } 8946 } 8947 8948 return event.result; 8949 }, 8950 8951 // Piggyback on a donor event to simulate a different one 8952 // Used only for `focus(in | out)` events 8953 simulate: function( type, elem, event ) { 8954 var e = jQuery.extend( 8955 new jQuery.Event(), 8956 event, 8957 { 8958 type: type, 8959 isSimulated: true 8960 } 8961 ); 8962 8963 jQuery.event.trigger( e, null, elem ); 8964 } 8965 8966} ); 8967 8968jQuery.fn.extend( { 8969 8970 trigger: function( type, data ) { 8971 return this.each( function() { 8972 jQuery.event.trigger( type, data, this ); 8973 } ); 8974 }, 8975 triggerHandler: function( type, data ) { 8976 var elem = this[ 0 ]; 8977 if ( elem ) { 8978 return jQuery.event.trigger( type, data, elem, true ); 8979 } 8980 } 8981} ); 8982 8983 8984var 8985 rbracket = /\[\]$/, 8986 rCRLF = /\r?\n/g, 8987 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 8988 rsubmittable = /^(?:input|select|textarea|keygen)/i; 8989 8990function buildParams( prefix, obj, traditional, add ) { 8991 var name; 8992 8993 if ( Array.isArray( obj ) ) { 8994 8995 // Serialize array item. 8996 jQuery.each( obj, function( i, v ) { 8997 if ( traditional || rbracket.test( prefix ) ) { 8998 8999 // Treat each array item as a scalar. 9000 add( prefix, v ); 9001 9002 } else { 9003 9004 // Item is non-scalar (array or object), encode its numeric index. 9005 buildParams( 9006 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 9007 v, 9008 traditional, 9009 add 9010 ); 9011 } 9012 } ); 9013 9014 } else if ( !traditional && toType( obj ) === "object" ) { 9015 9016 // Serialize object item. 9017 for ( name in obj ) { 9018 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 9019 } 9020 9021 } else { 9022 9023 // Serialize scalar item. 9024 add( prefix, obj ); 9025 } 9026} 9027 9028// Serialize an array of form elements or a set of 9029// key/values into a query string 9030jQuery.param = function( a, traditional ) { 9031 var prefix, 9032 s = [], 9033 add = function( key, valueOrFunction ) { 9034 9035 // If value is a function, invoke it and use its return value 9036 var value = isFunction( valueOrFunction ) ? 9037 valueOrFunction() : 9038 valueOrFunction; 9039 9040 s[ s.length ] = encodeURIComponent( key ) + "=" + 9041 encodeURIComponent( value == null ? "" : value ); 9042 }; 9043 9044 if ( a == null ) { 9045 return ""; 9046 } 9047 9048 // If an array was passed in, assume that it is an array of form elements. 9049 if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 9050 9051 // Serialize the form elements 9052 jQuery.each( a, function() { 9053 add( this.name, this.value ); 9054 } ); 9055 9056 } else { 9057 9058 // If traditional, encode the "old" way (the way 1.3.2 or older 9059 // did it), otherwise encode params recursively. 9060 for ( prefix in a ) { 9061 buildParams( prefix, a[ prefix ], traditional, add ); 9062 } 9063 } 9064 9065 // Return the resulting serialization 9066 return s.join( "&" ); 9067}; 9068 9069jQuery.fn.extend( { 9070 serialize: function() { 9071 return jQuery.param( this.serializeArray() ); 9072 }, 9073 serializeArray: function() { 9074 return this.map( function() { 9075 9076 // Can add propHook for "elements" to filter or add form elements 9077 var elements = jQuery.prop( this, "elements" ); 9078 return elements ? jQuery.makeArray( elements ) : this; 9079 } ).filter( function() { 9080 var type = this.type; 9081 9082 // Use .is( ":disabled" ) so that fieldset[disabled] works 9083 return this.name && !jQuery( this ).is( ":disabled" ) && 9084 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 9085 ( this.checked || !rcheckableType.test( type ) ); 9086 } ).map( function( _i, elem ) { 9087 var val = jQuery( this ).val(); 9088 9089 if ( val == null ) { 9090 return null; 9091 } 9092 9093 if ( Array.isArray( val ) ) { 9094 return jQuery.map( val, function( val ) { 9095 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 9096 } ); 9097 } 9098 9099 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 9100 } ).get(); 9101 } 9102} ); 9103 9104 9105var 9106 r20 = /%20/g, 9107 rhash = /#.*$/, 9108 rantiCache = /([?&])_=[^&]*/, 9109 rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, 9110 9111 // trac-7653, trac-8125, trac-8152: local protocol detection 9112 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 9113 rnoContent = /^(?:GET|HEAD)$/, 9114 rprotocol = /^\/\//, 9115 9116 /* Prefilters 9117 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 9118 * 2) These are called: 9119 * - BEFORE asking for a transport 9120 * - AFTER param serialization (s.data is a string if s.processData is true) 9121 * 3) key is the dataType 9122 * 4) the catchall symbol "*" can be used 9123 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 9124 */ 9125 prefilters = {}, 9126 9127 /* Transports bindings 9128 * 1) key is the dataType 9129 * 2) the catchall symbol "*" can be used 9130 * 3) selection will start with transport dataType and THEN go to "*" if needed 9131 */ 9132 transports = {}, 9133 9134 // Avoid comment-prolog char sequence (trac-10098); must appease lint and evade compression 9135 allTypes = "*/".concat( "*" ), 9136 9137 // Anchor tag for parsing the document origin 9138 originAnchor = document.createElement( "a" ); 9139 9140originAnchor.href = location.href; 9141 9142// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 9143function addToPrefiltersOrTransports( structure ) { 9144 9145 // dataTypeExpression is optional and defaults to "*" 9146 return function( dataTypeExpression, func ) { 9147 9148 if ( typeof dataTypeExpression !== "string" ) { 9149 func = dataTypeExpression; 9150 dataTypeExpression = "*"; 9151 } 9152 9153 var dataType, 9154 i = 0, 9155 dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || []; 9156 9157 if ( isFunction( func ) ) { 9158 9159 // For each dataType in the dataTypeExpression 9160 while ( ( dataType = dataTypes[ i++ ] ) ) { 9161 9162 // Prepend if requested 9163 if ( dataType[ 0 ] === "+" ) { 9164 dataType = dataType.slice( 1 ) || "*"; 9165 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 9166 9167 // Otherwise append 9168 } else { 9169 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 9170 } 9171 } 9172 } 9173 }; 9174} 9175 9176// Base inspection function for prefilters and transports 9177function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 9178 9179 var inspected = {}, 9180 seekingTransport = ( structure === transports ); 9181 9182 function inspect( dataType ) { 9183 var selected; 9184 inspected[ dataType ] = true; 9185 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 9186 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 9187 if ( typeof dataTypeOrTransport === "string" && 9188 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 9189 9190 options.dataTypes.unshift( dataTypeOrTransport ); 9191 inspect( dataTypeOrTransport ); 9192 return false; 9193 } else if ( seekingTransport ) { 9194 return !( selected = dataTypeOrTransport ); 9195 } 9196 } ); 9197 return selected; 9198 } 9199 9200 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 9201} 9202 9203// A special extend for ajax options 9204// that takes "flat" options (not to be deep extended) 9205// Fixes trac-9887 9206function ajaxExtend( target, src ) { 9207 var key, deep, 9208 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 9209 9210 for ( key in src ) { 9211 if ( src[ key ] !== undefined ) { 9212 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 9213 } 9214 } 9215 if ( deep ) { 9216 jQuery.extend( true, target, deep ); 9217 } 9218 9219 return target; 9220} 9221 9222/* Handles responses to an ajax request: 9223 * - finds the right dataType (mediates between content-type and expected dataType) 9224 * - returns the corresponding response 9225 */ 9226function ajaxHandleResponses( s, jqXHR, responses ) { 9227 9228 var ct, type, finalDataType, firstDataType, 9229 contents = s.contents, 9230 dataTypes = s.dataTypes; 9231 9232 // Remove auto dataType and get content-type in the process 9233 while ( dataTypes[ 0 ] === "*" ) { 9234 dataTypes.shift(); 9235 if ( ct === undefined ) { 9236 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 9237 } 9238 } 9239 9240 // Check if we're dealing with a known content-type 9241 if ( ct ) { 9242 for ( type in contents ) { 9243 if ( contents[ type ] && contents[ type ].test( ct ) ) { 9244 dataTypes.unshift( type ); 9245 break; 9246 } 9247 } 9248 } 9249 9250 // Check to see if we have a response for the expected dataType 9251 if ( dataTypes[ 0 ] in responses ) { 9252 finalDataType = dataTypes[ 0 ]; 9253 } else { 9254 9255 // Try convertible dataTypes 9256 for ( type in responses ) { 9257 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 9258 finalDataType = type; 9259 break; 9260 } 9261 if ( !firstDataType ) { 9262 firstDataType = type; 9263 } 9264 } 9265 9266 // Or just use first one 9267 finalDataType = finalDataType || firstDataType; 9268 } 9269 9270 // If we found a dataType 9271 // We add the dataType to the list if needed 9272 // and return the corresponding response 9273 if ( finalDataType ) { 9274 if ( finalDataType !== dataTypes[ 0 ] ) { 9275 dataTypes.unshift( finalDataType ); 9276 } 9277 return responses[ finalDataType ]; 9278 } 9279} 9280 9281/* Chain conversions given the request and the original response 9282 * Also sets the responseXXX fields on the jqXHR instance 9283 */ 9284function ajaxConvert( s, response, jqXHR, isSuccess ) { 9285 var conv2, current, conv, tmp, prev, 9286 converters = {}, 9287 9288 // Work with a copy of dataTypes in case we need to modify it for conversion 9289 dataTypes = s.dataTypes.slice(); 9290 9291 // Create converters map with lowercased keys 9292 if ( dataTypes[ 1 ] ) { 9293 for ( conv in s.converters ) { 9294 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 9295 } 9296 } 9297 9298 current = dataTypes.shift(); 9299 9300 // Convert to each sequential dataType 9301 while ( current ) { 9302 9303 if ( s.responseFields[ current ] ) { 9304 jqXHR[ s.responseFields[ current ] ] = response; 9305 } 9306 9307 // Apply the dataFilter if provided 9308 if ( !prev && isSuccess && s.dataFilter ) { 9309 response = s.dataFilter( response, s.dataType ); 9310 } 9311 9312 prev = current; 9313 current = dataTypes.shift(); 9314 9315 if ( current ) { 9316 9317 // There's only work to do if current dataType is non-auto 9318 if ( current === "*" ) { 9319 9320 current = prev; 9321 9322 // Convert response if prev dataType is non-auto and differs from current 9323 } else if ( prev !== "*" && prev !== current ) { 9324 9325 // Seek a direct converter 9326 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 9327 9328 // If none found, seek a pair 9329 if ( !conv ) { 9330 for ( conv2 in converters ) { 9331 9332 // If conv2 outputs current 9333 tmp = conv2.split( " " ); 9334 if ( tmp[ 1 ] === current ) { 9335 9336 // If prev can be converted to accepted input 9337 conv = converters[ prev + " " + tmp[ 0 ] ] || 9338 converters[ "* " + tmp[ 0 ] ]; 9339 if ( conv ) { 9340 9341 // Condense equivalence converters 9342 if ( conv === true ) { 9343 conv = converters[ conv2 ]; 9344 9345 // Otherwise, insert the intermediate dataType 9346 } else if ( converters[ conv2 ] !== true ) { 9347 current = tmp[ 0 ]; 9348 dataTypes.unshift( tmp[ 1 ] ); 9349 } 9350 break; 9351 } 9352 } 9353 } 9354 } 9355 9356 // Apply converter (if not an equivalence) 9357 if ( conv !== true ) { 9358 9359 // Unless errors are allowed to bubble, catch and return them 9360 if ( conv && s.throws ) { 9361 response = conv( response ); 9362 } else { 9363 try { 9364 response = conv( response ); 9365 } catch ( e ) { 9366 return { 9367 state: "parsererror", 9368 error: conv ? e : "No conversion from " + prev + " to " + current 9369 }; 9370 } 9371 } 9372 } 9373 } 9374 } 9375 } 9376 9377 return { state: "success", data: response }; 9378} 9379 9380jQuery.extend( { 9381 9382 // Counter for holding the number of active queries 9383 active: 0, 9384 9385 // Last-Modified header cache for next request 9386 lastModified: {}, 9387 etag: {}, 9388 9389 ajaxSettings: { 9390 url: location.href, 9391 type: "GET", 9392 isLocal: rlocalProtocol.test( location.protocol ), 9393 global: true, 9394 processData: true, 9395 async: true, 9396 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 9397 9398 /* 9399 timeout: 0, 9400 data: null, 9401 dataType: null, 9402 username: null, 9403 password: null, 9404 cache: null, 9405 throws: false, 9406 traditional: false, 9407 headers: {}, 9408 */ 9409 9410 accepts: { 9411 "*": allTypes, 9412 text: "text/plain", 9413 html: "text/html", 9414 xml: "application/xml, text/xml", 9415 json: "application/json, text/javascript" 9416 }, 9417 9418 contents: { 9419 xml: /\bxml\b/, 9420 html: /\bhtml/, 9421 json: /\bjson\b/ 9422 }, 9423 9424 responseFields: { 9425 xml: "responseXML", 9426 text: "responseText", 9427 json: "responseJSON" 9428 }, 9429 9430 // Data converters 9431 // Keys separate source (or catchall "*") and destination types with a single space 9432 converters: { 9433 9434 // Convert anything to text 9435 "* text": String, 9436 9437 // Text to html (true = no transformation) 9438 "text html": true, 9439 9440 // Evaluate text as a json expression 9441 "text json": JSON.parse, 9442 9443 // Parse text as xml 9444 "text xml": jQuery.parseXML 9445 }, 9446 9447 // For options that shouldn't be deep extended: 9448 // you can add your own custom options here if 9449 // and when you create one that shouldn't be 9450 // deep extended (see ajaxExtend) 9451 flatOptions: { 9452 url: true, 9453 context: true 9454 } 9455 }, 9456 9457 // Creates a full fledged settings object into target 9458 // with both ajaxSettings and settings fields. 9459 // If target is omitted, writes into ajaxSettings. 9460 ajaxSetup: function( target, settings ) { 9461 return settings ? 9462 9463 // Building a settings object 9464 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 9465 9466 // Extending ajaxSettings 9467 ajaxExtend( jQuery.ajaxSettings, target ); 9468 }, 9469 9470 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 9471 ajaxTransport: addToPrefiltersOrTransports( transports ), 9472 9473 // Main method 9474 ajax: function( url, options ) { 9475 9476 // If url is an object, simulate pre-1.5 signature 9477 if ( typeof url === "object" ) { 9478 options = url; 9479 url = undefined; 9480 } 9481 9482 // Force options to be an object 9483 options = options || {}; 9484 9485 var transport, 9486 9487 // URL without anti-cache param 9488 cacheURL, 9489 9490 // Response headers 9491 responseHeadersString, 9492 responseHeaders, 9493 9494 // timeout handle 9495 timeoutTimer, 9496 9497 // Url cleanup var 9498 urlAnchor, 9499 9500 // Request state (becomes false upon send and true upon completion) 9501 completed, 9502 9503 // To know if global events are to be dispatched 9504 fireGlobals, 9505 9506 // Loop variable 9507 i, 9508 9509 // uncached part of the url 9510 uncached, 9511 9512 // Create the final options object 9513 s = jQuery.ajaxSetup( {}, options ), 9514 9515 // Callbacks context 9516 callbackContext = s.context || s, 9517 9518 // Context for global events is callbackContext if it is a DOM node or jQuery collection 9519 globalEventContext = s.context && 9520 ( callbackContext.nodeType || callbackContext.jquery ) ? 9521 jQuery( callbackContext ) : 9522 jQuery.event, 9523 9524 // Deferreds 9525 deferred = jQuery.Deferred(), 9526 completeDeferred = jQuery.Callbacks( "once memory" ), 9527 9528 // Status-dependent callbacks 9529 statusCode = s.statusCode || {}, 9530 9531 // Headers (they are sent all at once) 9532 requestHeaders = {}, 9533 requestHeadersNames = {}, 9534 9535 // Default abort message 9536 strAbort = "canceled", 9537 9538 // Fake xhr 9539 jqXHR = { 9540 readyState: 0, 9541 9542 // Builds headers hashtable if needed 9543 getResponseHeader: function( key ) { 9544 var match; 9545 if ( completed ) { 9546 if ( !responseHeaders ) { 9547 responseHeaders = {}; 9548 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 9549 responseHeaders[ match[ 1 ].toLowerCase() + " " ] = 9550 ( responseHeaders[ match[ 1 ].toLowerCase() + " " ] || [] ) 9551 .concat( match[ 2 ] ); 9552 } 9553 } 9554 match = responseHeaders[ key.toLowerCase() + " " ]; 9555 } 9556 return match == null ? null : match.join( ", " ); 9557 }, 9558 9559 // Raw string 9560 getAllResponseHeaders: function() { 9561 return completed ? responseHeadersString : null; 9562 }, 9563 9564 // Caches the header 9565 setRequestHeader: function( name, value ) { 9566 if ( completed == null ) { 9567 name = requestHeadersNames[ name.toLowerCase() ] = 9568 requestHeadersNames[ name.toLowerCase() ] || name; 9569 requestHeaders[ name ] = value; 9570 } 9571 return this; 9572 }, 9573 9574 // Overrides response content-type header 9575 overrideMimeType: function( type ) { 9576 if ( completed == null ) { 9577 s.mimeType = type; 9578 } 9579 return this; 9580 }, 9581 9582 // Status-dependent callbacks 9583 statusCode: function( map ) { 9584 var code; 9585 if ( map ) { 9586 if ( completed ) { 9587 9588 // Execute the appropriate callbacks 9589 jqXHR.always( map[ jqXHR.status ] ); 9590 } else { 9591 9592 // Lazy-add the new callbacks in a way that preserves old ones 9593 for ( code in map ) { 9594 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 9595 } 9596 } 9597 } 9598 return this; 9599 }, 9600 9601 // Cancel the request 9602 abort: function( statusText ) { 9603 var finalText = statusText || strAbort; 9604 if ( transport ) { 9605 transport.abort( finalText ); 9606 } 9607 done( 0, finalText ); 9608 return this; 9609 } 9610 }; 9611 9612 // Attach deferreds 9613 deferred.promise( jqXHR ); 9614 9615 // Add protocol if not provided (prefilters might expect it) 9616 // Handle falsy url in the settings object (trac-10093: consistency with old signature) 9617 // We also use the url parameter if available 9618 s.url = ( ( url || s.url || location.href ) + "" ) 9619 .replace( rprotocol, location.protocol + "//" ); 9620 9621 // Alias method option to type as per ticket trac-12004 9622 s.type = options.method || options.type || s.method || s.type; 9623 9624 // Extract dataTypes list 9625 s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ]; 9626 9627 // A cross-domain request is in order when the origin doesn't match the current origin. 9628 if ( s.crossDomain == null ) { 9629 urlAnchor = document.createElement( "a" ); 9630 9631 // Support: IE <=8 - 11, Edge 12 - 15 9632 // IE throws exception on accessing the href property if url is malformed, 9633 // e.g. http://example.com:80x/ 9634 try { 9635 urlAnchor.href = s.url; 9636 9637 // Support: IE <=8 - 11 only 9638 // Anchor's host property isn't correctly set when s.url is relative 9639 urlAnchor.href = urlAnchor.href; 9640 s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== 9641 urlAnchor.protocol + "//" + urlAnchor.host; 9642 } catch ( e ) { 9643 9644 // If there is an error parsing the URL, assume it is crossDomain, 9645 // it can be rejected by the transport if it is invalid 9646 s.crossDomain = true; 9647 } 9648 } 9649 9650 // Convert data if not already a string 9651 if ( s.data && s.processData && typeof s.data !== "string" ) { 9652 s.data = jQuery.param( s.data, s.traditional ); 9653 } 9654 9655 // Apply prefilters 9656 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 9657 9658 // If request was aborted inside a prefilter, stop there 9659 if ( completed ) { 9660 return jqXHR; 9661 } 9662 9663 // We can fire global events as of now if asked to 9664 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (trac-15118) 9665 fireGlobals = jQuery.event && s.global; 9666 9667 // Watch for a new set of requests 9668 if ( fireGlobals && jQuery.active++ === 0 ) { 9669 jQuery.event.trigger( "ajaxStart" ); 9670 } 9671 9672 // Uppercase the type 9673 s.type = s.type.toUpperCase(); 9674 9675 // Determine if request has content 9676 s.hasContent = !rnoContent.test( s.type ); 9677 9678 // Save the URL in case we're toying with the If-Modified-Since 9679 // and/or If-None-Match header later on 9680 // Remove hash to simplify url manipulation 9681 cacheURL = s.url.replace( rhash, "" ); 9682 9683 // More options handling for requests with no content 9684 if ( !s.hasContent ) { 9685 9686 // Remember the hash so we can put it back 9687 uncached = s.url.slice( cacheURL.length ); 9688 9689 // If data is available and should be processed, append data to url 9690 if ( s.data && ( s.processData || typeof s.data === "string" ) ) { 9691 cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data; 9692 9693 // trac-9682: remove data so that it's not used in an eventual retry 9694 delete s.data; 9695 } 9696 9697 // Add or update anti-cache param if needed 9698 if ( s.cache === false ) { 9699 cacheURL = cacheURL.replace( rantiCache, "$1" ); 9700 uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce.guid++ ) + 9701 uncached; 9702 } 9703 9704 // Put hash and anti-cache on the URL that will be requested (gh-1732) 9705 s.url = cacheURL + uncached; 9706 9707 // Change '%20' to '+' if this is encoded form body content (gh-2658) 9708 } else if ( s.data && s.processData && 9709 ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) { 9710 s.data = s.data.replace( r20, "+" ); 9711 } 9712 9713 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9714 if ( s.ifModified ) { 9715 if ( jQuery.lastModified[ cacheURL ] ) { 9716 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 9717 } 9718 if ( jQuery.etag[ cacheURL ] ) { 9719 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 9720 } 9721 } 9722 9723 // Set the correct header, if data is being sent 9724 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 9725 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 9726 } 9727 9728 // Set the Accepts header for the server, depending on the dataType 9729 jqXHR.setRequestHeader( 9730 "Accept", 9731 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 9732 s.accepts[ s.dataTypes[ 0 ] ] + 9733 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 9734 s.accepts[ "*" ] 9735 ); 9736 9737 // Check for headers option 9738 for ( i in s.headers ) { 9739 jqXHR.setRequestHeader( i, s.headers[ i ] ); 9740 } 9741 9742 // Allow custom headers/mimetypes and early abort 9743 if ( s.beforeSend && 9744 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) { 9745 9746 // Abort if not done already and return 9747 return jqXHR.abort(); 9748 } 9749 9750 // Aborting is no longer a cancellation 9751 strAbort = "abort"; 9752 9753 // Install callbacks on deferreds 9754 completeDeferred.add( s.complete ); 9755 jqXHR.done( s.success ); 9756 jqXHR.fail( s.error ); 9757 9758 // Get transport 9759 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 9760 9761 // If no transport, we auto-abort 9762 if ( !transport ) { 9763 done( -1, "No Transport" ); 9764 } else { 9765 jqXHR.readyState = 1; 9766 9767 // Send global event 9768 if ( fireGlobals ) { 9769 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 9770 } 9771 9772 // If request was aborted inside ajaxSend, stop there 9773 if ( completed ) { 9774 return jqXHR; 9775 } 9776 9777 // Timeout 9778 if ( s.async && s.timeout > 0 ) { 9779 timeoutTimer = window.setTimeout( function() { 9780 jqXHR.abort( "timeout" ); 9781 }, s.timeout ); 9782 } 9783 9784 try { 9785 completed = false; 9786 transport.send( requestHeaders, done ); 9787 } catch ( e ) { 9788 9789 // Rethrow post-completion exceptions 9790 if ( completed ) { 9791 throw e; 9792 } 9793 9794 // Propagate others as results 9795 done( -1, e ); 9796 } 9797 } 9798 9799 // Callback for when everything is done 9800 function done( status, nativeStatusText, responses, headers ) { 9801 var isSuccess, success, error, response, modified, 9802 statusText = nativeStatusText; 9803 9804 // Ignore repeat invocations 9805 if ( completed ) { 9806 return; 9807 } 9808 9809 completed = true; 9810 9811 // Clear timeout if it exists 9812 if ( timeoutTimer ) { 9813 window.clearTimeout( timeoutTimer ); 9814 } 9815 9816 // Dereference transport for early garbage collection 9817 // (no matter how long the jqXHR object will be used) 9818 transport = undefined; 9819 9820 // Cache response headers 9821 responseHeadersString = headers || ""; 9822 9823 // Set readyState 9824 jqXHR.readyState = status > 0 ? 4 : 0; 9825 9826 // Determine if successful 9827 isSuccess = status >= 200 && status < 300 || status === 304; 9828 9829 // Get response data 9830 if ( responses ) { 9831 response = ajaxHandleResponses( s, jqXHR, responses ); 9832 } 9833 9834 // Use a noop converter for missing script but not if jsonp 9835 if ( !isSuccess && 9836 jQuery.inArray( "script", s.dataTypes ) > -1 && 9837 jQuery.inArray( "json", s.dataTypes ) < 0 ) { 9838 s.converters[ "text script" ] = function() {}; 9839 } 9840 9841 // Convert no matter what (that way responseXXX fields are always set) 9842 response = ajaxConvert( s, response, jqXHR, isSuccess ); 9843 9844 // If successful, handle type chaining 9845 if ( isSuccess ) { 9846 9847 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9848 if ( s.ifModified ) { 9849 modified = jqXHR.getResponseHeader( "Last-Modified" ); 9850 if ( modified ) { 9851 jQuery.lastModified[ cacheURL ] = modified; 9852 } 9853 modified = jqXHR.getResponseHeader( "etag" ); 9854 if ( modified ) { 9855 jQuery.etag[ cacheURL ] = modified; 9856 } 9857 } 9858 9859 // if no content 9860 if ( status === 204 || s.type === "HEAD" ) { 9861 statusText = "nocontent"; 9862 9863 // if not modified 9864 } else if ( status === 304 ) { 9865 statusText = "notmodified"; 9866 9867 // If we have data, let's convert it 9868 } else { 9869 statusText = response.state; 9870 success = response.data; 9871 error = response.error; 9872 isSuccess = !error; 9873 } 9874 } else { 9875 9876 // Extract error from statusText and normalize for non-aborts 9877 error = statusText; 9878 if ( status || !statusText ) { 9879 statusText = "error"; 9880 if ( status < 0 ) { 9881 status = 0; 9882 } 9883 } 9884 } 9885 9886 // Set data for the fake xhr object 9887 jqXHR.status = status; 9888 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 9889 9890 // Success/Error 9891 if ( isSuccess ) { 9892 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 9893 } else { 9894 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 9895 } 9896 9897 // Status-dependent callbacks 9898 jqXHR.statusCode( statusCode ); 9899 statusCode = undefined; 9900 9901 if ( fireGlobals ) { 9902 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 9903 [ jqXHR, s, isSuccess ? success : error ] ); 9904 } 9905 9906 // Complete 9907 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 9908 9909 if ( fireGlobals ) { 9910 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 9911 9912 // Handle the global AJAX counter 9913 if ( !( --jQuery.active ) ) { 9914 jQuery.event.trigger( "ajaxStop" ); 9915 } 9916 } 9917 } 9918 9919 return jqXHR; 9920 }, 9921 9922 getJSON: function( url, data, callback ) { 9923 return jQuery.get( url, data, callback, "json" ); 9924 }, 9925 9926 getScript: function( url, callback ) { 9927 return jQuery.get( url, undefined, callback, "script" ); 9928 } 9929} ); 9930 9931jQuery.each( [ "get", "post" ], function( _i, method ) { 9932 jQuery[ method ] = function( url, data, callback, type ) { 9933 9934 // Shift arguments if data argument was omitted 9935 if ( isFunction( data ) ) { 9936 type = type || callback; 9937 callback = data; 9938 data = undefined; 9939 } 9940 9941 // The url can be an options object (which then must have .url) 9942 return jQuery.ajax( jQuery.extend( { 9943 url: url, 9944 type: method, 9945 dataType: type, 9946 data: data, 9947 success: callback 9948 }, jQuery.isPlainObject( url ) && url ) ); 9949 }; 9950} ); 9951 9952jQuery.ajaxPrefilter( function( s ) { 9953 var i; 9954 for ( i in s.headers ) { 9955 if ( i.toLowerCase() === "content-type" ) { 9956 s.contentType = s.headers[ i ] || ""; 9957 } 9958 } 9959} ); 9960 9961 9962jQuery._evalUrl = function( url, options, doc ) { 9963 return jQuery.ajax( { 9964 url: url, 9965 9966 // Make this explicit, since user can override this through ajaxSetup (trac-11264) 9967 type: "GET", 9968 dataType: "script", 9969 cache: true, 9970 async: false, 9971 global: false, 9972 9973 // Only evaluate the response if it is successful (gh-4126) 9974 // dataFilter is not invoked for failure responses, so using it instead 9975 // of the default converter is kludgy but it works. 9976 converters: { 9977 "text script": function() {} 9978 }, 9979 dataFilter: function( response ) { 9980 jQuery.globalEval( response, options, doc ); 9981 } 9982 } ); 9983}; 9984 9985 9986jQuery.fn.extend( { 9987 wrapAll: function( html ) { 9988 var wrap; 9989 9990 if ( this[ 0 ] ) { 9991 if ( isFunction( html ) ) { 9992 html = html.call( this[ 0 ] ); 9993 } 9994 9995 // The elements to wrap the target around 9996 wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 9997 9998 if ( this[ 0 ].parentNode ) { 9999 wrap.insertBefore( this[ 0 ] ); 10000 } 10001 10002 wrap.map( function() { 10003 var elem = this; 10004 10005 while ( elem.firstElementChild ) { 10006 elem = elem.firstElementChild; 10007 } 10008 10009 return elem; 10010 } ).append( this ); 10011 } 10012 10013 return this; 10014 }, 10015 10016 wrapInner: function( html ) { 10017 if ( isFunction( html ) ) { 10018 return this.each( function( i ) { 10019 jQuery( this ).wrapInner( html.call( this, i ) ); 10020 } ); 10021 } 10022 10023 return this.each( function() { 10024 var self = jQuery( this ), 10025 contents = self.contents(); 10026 10027 if ( contents.length ) { 10028 contents.wrapAll( html ); 10029 10030 } else { 10031 self.append( html ); 10032 } 10033 } ); 10034 }, 10035 10036 wrap: function( html ) { 10037 var htmlIsFunction = isFunction( html ); 10038 10039 return this.each( function( i ) { 10040 jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html ); 10041 } ); 10042 }, 10043 10044 unwrap: function( selector ) { 10045 this.parent( selector ).not( "body" ).each( function() { 10046 jQuery( this ).replaceWith( this.childNodes ); 10047 } ); 10048 return this; 10049 } 10050} ); 10051 10052 10053jQuery.expr.pseudos.hidden = function( elem ) { 10054 return !jQuery.expr.pseudos.visible( elem ); 10055}; 10056jQuery.expr.pseudos.visible = function( elem ) { 10057 return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length ); 10058}; 10059 10060 10061 10062 10063jQuery.ajaxSettings.xhr = function() { 10064 try { 10065 return new window.XMLHttpRequest(); 10066 } catch ( e ) {} 10067}; 10068 10069var xhrSuccessStatus = { 10070 10071 // File protocol always yields status code 0, assume 200 10072 0: 200, 10073 10074 // Support: IE <=9 only 10075 // trac-1450: sometimes IE returns 1223 when it should be 204 10076 1223: 204 10077 }, 10078 xhrSupported = jQuery.ajaxSettings.xhr(); 10079 10080support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 10081support.ajax = xhrSupported = !!xhrSupported; 10082 10083jQuery.ajaxTransport( function( options ) { 10084 var callback, errorCallback; 10085 10086 // Cross domain only allowed if supported through XMLHttpRequest 10087 if ( support.cors || xhrSupported && !options.crossDomain ) { 10088 return { 10089 send: function( headers, complete ) { 10090 var i, 10091 xhr = options.xhr(); 10092 10093 xhr.open( 10094 options.type, 10095 options.url, 10096 options.async, 10097 options.username, 10098 options.password 10099 ); 10100 10101 // Apply custom fields if provided 10102 if ( options.xhrFields ) { 10103 for ( i in options.xhrFields ) { 10104 xhr[ i ] = options.xhrFields[ i ]; 10105 } 10106 } 10107 10108 // Override mime type if needed 10109 if ( options.mimeType && xhr.overrideMimeType ) { 10110 xhr.overrideMimeType( options.mimeType ); 10111 } 10112 10113 // X-Requested-With header 10114 // For cross-domain requests, seeing as conditions for a preflight are 10115 // akin to a jigsaw puzzle, we simply never set it to be sure. 10116 // (it can always be set on a per-request basis or even using ajaxSetup) 10117 // For same-domain requests, won't change header if already provided. 10118 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 10119 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 10120 } 10121 10122 // Set headers 10123 for ( i in headers ) { 10124 xhr.setRequestHeader( i, headers[ i ] ); 10125 } 10126 10127 // Callback 10128 callback = function( type ) { 10129 return function() { 10130 if ( callback ) { 10131 callback = errorCallback = xhr.onload = 10132 xhr.onerror = xhr.onabort = xhr.ontimeout = 10133 xhr.onreadystatechange = null; 10134 10135 if ( type === "abort" ) { 10136 xhr.abort(); 10137 } else if ( type === "error" ) { 10138 10139 // Support: IE <=9 only 10140 // On a manual native abort, IE9 throws 10141 // errors on any property access that is not readyState 10142 if ( typeof xhr.status !== "number" ) { 10143 complete( 0, "error" ); 10144 } else { 10145 complete( 10146 10147 // File: protocol always yields status 0; see trac-8605, trac-14207 10148 xhr.status, 10149 xhr.statusText 10150 ); 10151 } 10152 } else { 10153 complete( 10154 xhrSuccessStatus[ xhr.status ] || xhr.status, 10155 xhr.statusText, 10156 10157 // Support: IE <=9 only 10158 // IE9 has no XHR2 but throws on binary (trac-11426) 10159 // For XHR2 non-text, let the caller handle it (gh-2498) 10160 ( xhr.responseType || "text" ) !== "text" || 10161 typeof xhr.responseText !== "string" ? 10162 { binary: xhr.response } : 10163 { text: xhr.responseText }, 10164 xhr.getAllResponseHeaders() 10165 ); 10166 } 10167 } 10168 }; 10169 }; 10170 10171 // Listen to events 10172 xhr.onload = callback(); 10173 errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" ); 10174 10175 // Support: IE 9 only 10176 // Use onreadystatechange to replace onabort 10177 // to handle uncaught aborts 10178 if ( xhr.onabort !== undefined ) { 10179 xhr.onabort = errorCallback; 10180 } else { 10181 xhr.onreadystatechange = function() { 10182 10183 // Check readyState before timeout as it changes 10184 if ( xhr.readyState === 4 ) { 10185 10186 // Allow onerror to be called first, 10187 // but that will not handle a native abort 10188 // Also, save errorCallback to a variable 10189 // as xhr.onerror cannot be accessed 10190 window.setTimeout( function() { 10191 if ( callback ) { 10192 errorCallback(); 10193 } 10194 } ); 10195 } 10196 }; 10197 } 10198 10199 // Create the abort callback 10200 callback = callback( "abort" ); 10201 10202 try { 10203 10204 // Do send the request (this may raise an exception) 10205 xhr.send( options.hasContent && options.data || null ); 10206 } catch ( e ) { 10207 10208 // trac-14683: Only rethrow if this hasn't been notified as an error yet 10209 if ( callback ) { 10210 throw e; 10211 } 10212 } 10213 }, 10214 10215 abort: function() { 10216 if ( callback ) { 10217 callback(); 10218 } 10219 } 10220 }; 10221 } 10222} ); 10223 10224 10225 10226 10227// Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432) 10228jQuery.ajaxPrefilter( function( s ) { 10229 if ( s.crossDomain ) { 10230 s.contents.script = false; 10231 } 10232} ); 10233 10234// Install script dataType 10235jQuery.ajaxSetup( { 10236 accepts: { 10237 script: "text/javascript, application/javascript, " + 10238 "application/ecmascript, application/x-ecmascript" 10239 }, 10240 contents: { 10241 script: /\b(?:java|ecma)script\b/ 10242 }, 10243 converters: { 10244 "text script": function( text ) { 10245 jQuery.globalEval( text ); 10246 return text; 10247 } 10248 } 10249} ); 10250 10251// Handle cache's special case and crossDomain 10252jQuery.ajaxPrefilter( "script", function( s ) { 10253 if ( s.cache === undefined ) { 10254 s.cache = false; 10255 } 10256 if ( s.crossDomain ) { 10257 s.type = "GET"; 10258 } 10259} ); 10260 10261// Bind script tag hack transport 10262jQuery.ajaxTransport( "script", function( s ) { 10263 10264 // This transport only deals with cross domain or forced-by-attrs requests 10265 if ( s.crossDomain || s.scriptAttrs ) { 10266 var script, callback; 10267 return { 10268 send: function( _, complete ) { 10269 script = jQuery( "<script>" ) 10270 .attr( s.scriptAttrs || {} ) 10271 .prop( { charset: s.scriptCharset, src: s.url } ) 10272 .on( "load error", callback = function( evt ) { 10273 script.remove(); 10274 callback = null; 10275 if ( evt ) { 10276 complete( evt.type === "error" ? 404 : 200, evt.type ); 10277 } 10278 } ); 10279 10280 // Use native DOM manipulation to avoid our domManip AJAX trickery 10281 document.head.appendChild( script[ 0 ] ); 10282 }, 10283 abort: function() { 10284 if ( callback ) { 10285 callback(); 10286 } 10287 } 10288 }; 10289 } 10290} ); 10291 10292 10293 10294 10295var oldCallbacks = [], 10296 rjsonp = /(=)\?(?=&|$)|\?\?/; 10297 10298// Default jsonp settings 10299jQuery.ajaxSetup( { 10300 jsonp: "callback", 10301 jsonpCallback: function() { 10302 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce.guid++ ) ); 10303 this[ callback ] = true; 10304 return callback; 10305 } 10306} ); 10307 10308// Detect, normalize options and install callbacks for jsonp requests 10309jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 10310 10311 var callbackName, overwritten, responseContainer, 10312 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 10313 "url" : 10314 typeof s.data === "string" && 10315 ( s.contentType || "" ) 10316 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 10317 rjsonp.test( s.data ) && "data" 10318 ); 10319 10320 // Handle iff the expected data type is "jsonp" or we have a parameter to set 10321 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 10322 10323 // Get callback name, remembering preexisting value associated with it 10324 callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ? 10325 s.jsonpCallback() : 10326 s.jsonpCallback; 10327 10328 // Insert callback into url or form data 10329 if ( jsonProp ) { 10330 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 10331 } else if ( s.jsonp !== false ) { 10332 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 10333 } 10334 10335 // Use data converter to retrieve json after script execution
vendor: 2,987 bytes, lines 10336-10445
10336 s.converters[ "script json" ] = function() { 10337 if ( !responseContainer ) { 10338 jQuery.error( callbackName + " was not called" ); 10339 } 10340 return responseContainer[ 0 ]; 10341 }; 10342 10343 // Force json dataType 10344 s.dataTypes[ 0 ] = "json"; 10345 10346 // Install callback 10347 overwritten = window[ callbackName ]; 10348 window[ callbackName ] = function() { 10349 responseContainer = arguments; 10350 }; 10351 10352 // Clean-up function (fires after converters) 10353 jqXHR.always( function() { 10354 10355 // If previous value didn't exist - remove it 10356 if ( overwritten === undefined ) { 10357 jQuery( window ).removeProp( callbackName ); 10358 10359 // Otherwise restore preexisting value 10360 } else { 10361 window[ callbackName ] = overwritten; 10362 } 10363 10364 // Save back as free 10365 if ( s[ callbackName ] ) { 10366 10367 // Make sure that re-using the options doesn't screw things around 10368 s.jsonpCallback = originalSettings.jsonpCallback; 10369 10370 // Save the callback name for future use 10371 oldCallbacks.push( callbackName ); 10372 } 10373 10374 // Call if it was a function and we have a response 10375 if ( responseContainer && isFunction( overwritten ) ) { 10376 overwritten( responseContainer[ 0 ] ); 10377 } 10378 10379 responseContainer = overwritten = undefined; 10380 } ); 10381 10382 // Delegate to script 10383 return "script"; 10384 } 10385} ); 10386 10387 10388 10389 10390// Support: Safari 8 only 10391// In Safari 8 documents created via document.implementation.createHTMLDocument 10392// collapse sibling forms: the second one becomes a child of the first one. 10393// Because of that, this security measure has to be disabled in Safari 8. 10394// https://bugs.webkit.org/show_bug.cgi?id=137337 10395support.createHTMLDocument = ( function() { 10396 var body = document.implementation.createHTMLDocument( "" ).body; 10397 body.innerHTML = "<form></form><form></form>"; 10398 return body.childNodes.length === 2; 10399} )(); 10400 10401 10402// Argument "data" should be string of html 10403// context (optional): If specified, the fragment will be created in this context, 10404// defaults to document 10405// keepScripts (optional): If true, will include scripts passed in the html string 10406jQuery.parseHTML = function( data, context, keepScripts ) { 10407 if ( typeof data !== "string" ) { 10408 return []; 10409 } 10410 if ( typeof context === "boolean" ) { 10411 keepScripts = context; 10412 context = false; 10413 } 10414 10415 var base, parsed, scripts; 10416 10417 if ( !context ) { 10418 10419 // Stop scripts or inline event handlers from being executed immediately 10420 // by using document.implementation 10421 if ( support.createHTMLDocument ) { 10422 context = document.implementation.createHTMLDocument( "" ); 10423 10424 // Set the base href for the created document 10425 // so any parsed elements with URLs 10426 // are based on the document's URL (gh-2965) 10427 base = context.createElement( "base" ); 10428 base.href = document.location.href; 10429 context.head.appendChild( base ); 10430 } else { 10431 context = document; 10432 } 10433 } 10434 10435 parsed = rsingleTag.exec( data ); 10436 scripts = !keepScripts && []; 10437 10438 // Single tag 10439 if ( parsed ) { 10440 return [ context.createElement( parsed[ 1 ] ) ]; 10441 } 10442 10443 parsed = buildFragment( [ data ], context, scripts ); 10444 10445 if ( scripts && scripts.length ) {
vendor: 14,193 bytes, lines 10446-10941
10446 jQuery( scripts ).remove(); 10447 } 10448 10449 return jQuery.merge( [], parsed.childNodes ); 10450}; 10451 10452 10453/** 10454 * Load a url into a page 10455 */ 10456jQuery.fn.load = function( url, params, callback ) { 10457 var selector, type, response, 10458 self = this, 10459 off = url.indexOf( " " ); 10460 10461 if ( off > -1 ) { 10462 selector = stripAndCollapse( url.slice( off ) ); 10463 url = url.slice( 0, off ); 10464 } 10465 10466 // If it's a function 10467 if ( isFunction( params ) ) { 10468 10469 // We assume that it's the callback 10470 callback = params; 10471 params = undefined; 10472 10473 // Otherwise, build a param string 10474 } else if ( params && typeof params === "object" ) { 10475 type = "POST"; 10476 } 10477 10478 // If we have elements to modify, make the request 10479 if ( self.length > 0 ) { 10480 jQuery.ajax( { 10481 url: url, 10482 10483 // If "type" variable is undefined, then "GET" method will be used. 10484 // Make value of this field explicit since 10485 // user can override it through ajaxSetup method 10486 type: type || "GET", 10487 dataType: "html", 10488 data: params 10489 } ).done( function( responseText ) { 10490 10491 // Save response for use in complete callback 10492 response = arguments; 10493 10494 self.html( selector ? 10495 10496 // If a selector was specified, locate the right elements in a dummy div 10497 // Exclude scripts to avoid IE 'Permission Denied' errors 10498 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 10499 10500 // Otherwise use the full result 10501 responseText ); 10502 10503 // If the request succeeds, this function gets "data", "status", "jqXHR" 10504 // but they are ignored because response was set above. 10505 // If it fails, this function gets "jqXHR", "status", "error" 10506 } ).always( callback && function( jqXHR, status ) { 10507 self.each( function() { 10508 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 10509 } ); 10510 } ); 10511 } 10512 10513 return this; 10514}; 10515 10516 10517 10518 10519jQuery.expr.pseudos.animated = function( elem ) { 10520 return jQuery.grep( jQuery.timers, function( fn ) { 10521 return elem === fn.elem; 10522 } ).length; 10523}; 10524 10525 10526 10527 10528jQuery.offset = { 10529 setOffset: function( elem, options, i ) { 10530 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 10531 position = jQuery.css( elem, "position" ), 10532 curElem = jQuery( elem ), 10533 props = {}; 10534 10535 // Set position first, in-case top/left are set even on static elem 10536 if ( position === "static" ) { 10537 elem.style.position = "relative"; 10538 } 10539 10540 curOffset = curElem.offset(); 10541 curCSSTop = jQuery.css( elem, "top" ); 10542 curCSSLeft = jQuery.css( elem, "left" ); 10543 calculatePosition = ( position === "absolute" || position === "fixed" ) && 10544 ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1; 10545 10546 // Need to be able to calculate position if either 10547 // top or left is auto and position is either absolute or fixed 10548 if ( calculatePosition ) { 10549 curPosition = curElem.position(); 10550 curTop = curPosition.top; 10551 curLeft = curPosition.left; 10552 10553 } else { 10554 curTop = parseFloat( curCSSTop ) || 0; 10555 curLeft = parseFloat( curCSSLeft ) || 0; 10556 } 10557 10558 if ( isFunction( options ) ) { 10559 10560 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 10561 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 10562 } 10563 10564 if ( options.top != null ) { 10565 props.top = ( options.top - curOffset.top ) + curTop; 10566 } 10567 if ( options.left != null ) { 10568 props.left = ( options.left - curOffset.left ) + curLeft; 10569 } 10570 10571 if ( "using" in options ) { 10572 options.using.call( elem, props ); 10573 10574 } else { 10575 curElem.css( props ); 10576 } 10577 } 10578}; 10579 10580jQuery.fn.extend( { 10581 10582 // offset() relates an element's border box to the document origin 10583 offset: function( options ) { 10584 10585 // Preserve chaining for setter 10586 if ( arguments.length ) { 10587 return options === undefined ? 10588 this : 10589 this.each( function( i ) { 10590 jQuery.offset.setOffset( this, options, i ); 10591 } ); 10592 } 10593 10594 var rect, win, 10595 elem = this[ 0 ]; 10596 10597 if ( !elem ) { 10598 return; 10599 } 10600 10601 // Return zeros for disconnected and hidden (display: none) elements (gh-2310) 10602 // Support: IE <=11 only 10603 // Running getBoundingClientRect on a 10604 // disconnected node in IE throws an error 10605 if ( !elem.getClientRects().length ) { 10606 return { top: 0, left: 0 }; 10607 } 10608 10609 // Get document-relative position by adding viewport scroll to viewport-relative gBCR 10610 rect = elem.getBoundingClientRect(); 10611 win = elem.ownerDocument.defaultView; 10612 return { 10613 top: rect.top + win.pageYOffset, 10614 left: rect.left + win.pageXOffset 10615 }; 10616 }, 10617 10618 // position() relates an element's margin box to its offset parent's padding box 10619 // This corresponds to the behavior of CSS absolute positioning 10620 position: function() { 10621 if ( !this[ 0 ] ) { 10622 return; 10623 } 10624 10625 var offsetParent, offset, doc, 10626 elem = this[ 0 ], 10627 parentOffset = { top: 0, left: 0 }; 10628 10629 // position:fixed elements are offset from the viewport, which itself always has zero offset 10630 if ( jQuery.css( elem, "position" ) === "fixed" ) { 10631 10632 // Assume position:fixed implies availability of getBoundingClientRect 10633 offset = elem.getBoundingClientRect(); 10634 10635 } else { 10636 offset = this.offset(); 10637 10638 // Account for the *real* offset parent, which can be the document or its root element 10639 // when a statically positioned element is identified 10640 doc = elem.ownerDocument; 10641 offsetParent = elem.offsetParent || doc.documentElement; 10642 while ( offsetParent && 10643 ( offsetParent === doc.body || offsetParent === doc.documentElement ) && 10644 jQuery.css( offsetParent, "position" ) === "static" ) { 10645 10646 offsetParent = offsetParent.parentNode; 10647 } 10648 if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) { 10649 10650 // Incorporate borders into its offset, since they are outside its content origin 10651 parentOffset = jQuery( offsetParent ).offset(); 10652 parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true ); 10653 parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true ); 10654 } 10655 } 10656 10657 // Subtract parent offsets and element margins 10658 return { 10659 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 10660 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 10661 }; 10662 }, 10663 10664 // This method will return documentElement in the following cases: 10665 // 1) For the element inside the iframe without offsetParent, this method will return 10666 // documentElement of the parent window 10667 // 2) For the hidden or detached element 10668 // 3) For body or html element, i.e. in case of the html node - it will return itself 10669 // 10670 // but those exceptions were never presented as a real life use-cases 10671 // and might be considered as more preferable results. 10672 // 10673 // This logic, however, is not guaranteed and can change at any point in the future 10674 offsetParent: function() { 10675 return this.map( function() { 10676 var offsetParent = this.offsetParent; 10677 10678 while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) { 10679 offsetParent = offsetParent.offsetParent; 10680 } 10681 10682 return offsetParent || documentElement; 10683 } ); 10684 } 10685} ); 10686 10687// Create scrollLeft and scrollTop methods 10688jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 10689 var top = "pageYOffset" === prop; 10690 10691 jQuery.fn[ method ] = function( val ) { 10692 return access( this, function( elem, method, val ) { 10693 10694 // Coalesce documents and windows 10695 var win; 10696 if ( isWindow( elem ) ) { 10697 win = elem; 10698 } else if ( elem.nodeType === 9 ) { 10699 win = elem.defaultView; 10700 } 10701 10702 if ( val === undefined ) { 10703 return win ? win[ prop ] : elem[ method ]; 10704 } 10705 10706 if ( win ) { 10707 win.scrollTo( 10708 !top ? val : win.pageXOffset, 10709 top ? val : win.pageYOffset 10710 ); 10711 10712 } else { 10713 elem[ method ] = val; 10714 } 10715 }, method, val, arguments.length ); 10716 }; 10717} ); 10718 10719// Support: Safari <=7 - 9.1, Chrome <=37 - 49 10720// Add the top/left cssHooks using jQuery.fn.position 10721// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 10722// Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347 10723// getComputedStyle returns percent when specified for top/left/bottom/right; 10724// rather than make the css module depend on the offset module, just check for it here 10725jQuery.each( [ "top", "left" ], function( _i, prop ) { 10726 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 10727 function( elem, computed ) { 10728 if ( computed ) { 10729 computed = curCSS( elem, prop ); 10730 10731 // If curCSS returns percentage, fallback to offset 10732 return rnumnonpx.test( computed ) ? 10733 jQuery( elem ).position()[ prop ] + "px" : 10734 computed; 10735 } 10736 } 10737 ); 10738} ); 10739 10740 10741// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 10742jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 10743 jQuery.each( { 10744 padding: "inner" + name, 10745 content: type, 10746 "": "outer" + name 10747 }, function( defaultExtra, funcName ) { 10748 10749 // Margin is only for outerHeight, outerWidth 10750 jQuery.fn[ funcName ] = function( margin, value ) { 10751 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 10752 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 10753 10754 return access( this, function( elem, type, value ) { 10755 var doc; 10756 10757 if ( isWindow( elem ) ) { 10758 10759 // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729) 10760 return funcName.indexOf( "outer" ) === 0 ? 10761 elem[ "inner" + name ] : 10762 elem.document.documentElement[ "client" + name ]; 10763 } 10764 10765 // Get document width or height 10766 if ( elem.nodeType === 9 ) { 10767 doc = elem.documentElement; 10768 10769 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 10770 // whichever is greatest 10771 return Math.max( 10772 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 10773 elem.body[ "offset" + name ], doc[ "offset" + name ], 10774 doc[ "client" + name ] 10775 ); 10776 } 10777 10778 return value === undefined ? 10779 10780 // Get width or height on the element, requesting but not forcing parseFloat 10781 jQuery.css( elem, type, extra ) : 10782 10783 // Set width or height on the element 10784 jQuery.style( elem, type, value, extra ); 10785 }, type, chainable ? margin : undefined, chainable ); 10786 }; 10787 } ); 10788} ); 10789 10790 10791jQuery.each( [ 10792 "ajaxStart", 10793 "ajaxStop", 10794 "ajaxComplete", 10795 "ajaxError", 10796 "ajaxSuccess", 10797 "ajaxSend" 10798], function( _i, type ) { 10799 jQuery.fn[ type ] = function( fn ) { 10800 return this.on( type, fn ); 10801 }; 10802} ); 10803 10804 10805 10806 10807jQuery.fn.extend( { 10808 10809 bind: function( types, data, fn ) { 10810 return this.on( types, null, data, fn ); 10811 }, 10812 unbind: function( types, fn ) { 10813 return this.off( types, null, fn ); 10814 }, 10815 10816 delegate: function( selector, types, data, fn ) { 10817 return this.on( types, selector, data, fn ); 10818 }, 10819 undelegate: function( selector, types, fn ) { 10820 10821 // ( namespace ) or ( selector, types [, fn] ) 10822 return arguments.length === 1 ? 10823 this.off( selector, "**" ) : 10824 this.off( types, selector || "**", fn ); 10825 }, 10826 10827 hover: function( fnOver, fnOut ) { 10828 return this 10829 .on( "mouseenter", fnOver ) 10830 .on( "mouseleave", fnOut || fnOver ); 10831 } 10832} ); 10833 10834jQuery.each( 10835 ( "blur focus focusin focusout resize scroll click dblclick " + 10836 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 10837 "change select submit keydown keypress keyup contextmenu" ).split( " " ), 10838 function( _i, name ) { 10839 10840 // Handle event binding 10841 jQuery.fn[ name ] = function( data, fn ) { 10842 return arguments.length > 0 ? 10843 this.on( name, null, data, fn ) : 10844 this.trigger( name ); 10845 }; 10846 } 10847); 10848 10849 10850 10851 10852// Support: Android <=4.0 only 10853// Make sure we trim BOM and NBSP 10854// Require that the "whitespace run" starts from a non-whitespace 10855// to avoid O(N^2) behavior when the engine would try matching "\s+$" at each space position. 10856var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g; 10857 10858// Bind a function to a context, optionally partially applying any 10859// arguments. 10860// jQuery.proxy is deprecated to promote standards (specifically Function#bind) 10861// However, it is not slated for removal any time soon 10862jQuery.proxy = function( fn, context ) { 10863 var tmp, args, proxy; 10864 10865 if ( typeof context === "string" ) { 10866 tmp = fn[ context ]; 10867 context = fn; 10868 fn = tmp; 10869 } 10870 10871 // Quick check to determine if target is callable, in the spec 10872 // this throws a TypeError, but we will just return undefined. 10873 if ( !isFunction( fn ) ) { 10874 return undefined; 10875 } 10876 10877 // Simulated bind 10878 args = slice.call( arguments, 2 ); 10879 proxy = function() { 10880 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 10881 }; 10882 10883 // Set the guid of unique handler to the same of original handler, so it can be removed 10884 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 10885 10886 return proxy; 10887}; 10888 10889jQuery.holdReady = function( hold ) { 10890 if ( hold ) { 10891 jQuery.readyWait++; 10892 } else { 10893 jQuery.ready( true ); 10894 } 10895}; 10896jQuery.isArray = Array.isArray; 10897jQuery.parseJSON = JSON.parse; 10898jQuery.nodeName = nodeName; 10899jQuery.isFunction = isFunction; 10900jQuery.isWindow = isWindow; 10901jQuery.camelCase = camelCase; 10902jQuery.type = toType; 10903 10904jQuery.now = Date.now; 10905 10906jQuery.isNumeric = function( obj ) { 10907 10908 // As of jQuery 3.0, isNumeric is limited to 10909 // strings and numbers (primitives or objects) 10910 // that can be coerced to finite numbers (gh-2662) 10911 var type = jQuery.type( obj ); 10912 return ( type === "number" || type === "string" ) && 10913 10914 // parseFloat NaNs numeric-cast false positives ("") 10915 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 10916 // subtraction forces infinities to NaN 10917 !isNaN( obj - parseFloat( obj ) ); 10918}; 10919 10920jQuery.trim = function( text ) { 10921 return text == null ? 10922 "" : 10923 ( text + "" ).replace( rtrim, "$1" ); 10924}; 10925 10926 10927 10928// Register as a named AMD module, since jQuery can be concatenated with other 10929// files that may use define, but not via a proper concatenation script that 10930// understands anonymous AMD modules. A named AMD is safest and most robust 10931// way to register. Lowercase jquery is used because AMD module names are 10932// derived from file names, and jQuery is normally delivered in a lowercase 10933// file name. Do this after creating the global so that if an AMD module wants 10934// to call noConflict to hide this version of jQuery, it will work. 10935 10936// Note that for maximum portability, libraries that are not jQuery should 10937// declare themselves as anonymous modules, and avoid setting a global if an 10938// AMD loader is present. jQuery is a special case. For more information, see 10939// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 10940 10941if ( t
10941rue ) { 10942 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() { 10943 return jQuery; 10944 }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 10945 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 10946} 10947 10948 10949 10950 10951var 10952 10953 // Map over jQuery in case of overwrite 10954 _jQuery = window.jQuery, 10955 10956 // Map over the $ in case of overwrite 10957 _$ = window.$; 10958 10959jQuery.noConflict = function( deep ) { 10960 if ( window.$ === jQuery ) { 10961 window.$ = _$; 10962 } 10963 10964 if ( deep && window.jQuery === jQuery ) { 10965 window.jQuery = _jQuery; 10966 } 10967 10968 return jQuery; 10969}; 10970 10971// Expose jQuery and $ identifiers, even in AMD 10972// (trac-7102#comment:10, https://github.com/jquery/jquery/pull/557) 10973// and CommonJS for browser emulators (trac-13566) 10974if ( typeof noGlobal === "undefined" ) { 10975 window.jQuery = window.$ = jQuery; 10976} 10977 10978 10979 10980 10981return jQuery; 10982} ); 10983 10984 10985/***/ }), 10986 10987/***/ 276: 10988/***/ (function(module, exports, __webpack_require__) { 10989 10990"use strict"; 10991 10992 10993var keyboardAccessibility = __webpack_require__(277); 10994 10995var clearSelection = function (element) { 10996 $(element).closest('.dropdown').children('.dropdown-menu').children('.top-category') 10997 .detach(); 10998 $(element).closest('.dropdown.show').children('.nav-link').attr('aria-expanded', 'false'); 10999 $(element).closest('.dropdown.show').children('.dropdown-menu').attr('aria-hidden', 'true'); 11000 $(element).closest('.dropdown.show').removeClass('show'); 11001 $('div.menu-group > ul.nav.navbar-nav > li.nav-item > a').attr('aria-hidden', 'false'); 11002 $(element).closest('li').detach(); 11003}; 11004 11005module.exports = function () { 11006 var isDesktop = function (element) { 11007 return $(element).parents('.menu-toggleable-left').css('position') !== 'fixed'; 11008 }; 11009 11010 var headerBannerStatus = window.sessionStorage.getItem('hide_header_banner'); 11011 $('.header-banner .close').on('click', function () { 11012 $('.header-banner').addClass('d-none'); 11013 window.sessionStorage.setItem('hide_header_banner', '1'); 11014 }); 11015 11016 if (!headerBannerStatus || headerBannerStatus < 0) { 11017 $('.header-banner').removeClass('d-none'); 11018 } 11019 11020 keyboardAccessibility('.main-menu .nav-link, .main-menu .dropdown-link', 11021 { 11022 40: function (menuItem) { // down 11023 if (menuItem.hasClass('nav-item')) { // top level 11024 $('.navbar-nav .show').removeClass('show') 11025 .children('.dropdown-menu') 11026 .removeClass('show'); 11027 menuItem.addClass('show').children('.dropdown-menu').addClass('show'); 11028 menuItem.find('ul > li > a') 11029 .first() 11030 .focus(); 11031 } else { 11032 menuItem.removeClass('show').children('.dropdown-menu').removeClass('show'); 11033 if (!(menuItem.next().length > 0)) { // if this is the last menuItem 11034 menuItem.parent().parent().find('li > a') // set focus to the first menuitem 11035 .first() 11036 .focus(); 11037 } else { 11038 menuItem.next().children().first().focus(); 11039 } 11040 } 11041 }, 11042 39: function (menuItem) { // right 11043 if (menuItem.hasClass('nav-item')) { // top level 11044 menuItem.removeClass('show').children('.dropdown-menu').removeClass('show'); 11045 $(this).attr('aria-expanded', 'false'); 11046 menuItem.next().children().first().focus(); 11047 } else if (menuItem.hasClass('dropdown')) { 11048 menuItem.addClass('show').children('.dropdown-menu').addClass('show'); 11049 $(this).attr('aria-expanded', 'true'); 11050 menuItem.find('ul > li > a') 11051 .first() 11052 .focus(); 11053 } 11054 }, 11055 38: function (menuItem) { // up 11056 if (menuItem.hasClass('nav-item')) { // top level 11057 menuItem.removeClass('show').children('.dropdown-menu').removeClass('show'); 11058 } else if (menuItem.prev().length === 0) { // first menuItem 11059 menuItem.parent().parent().removeClass('show') 11060 .children('.nav-link') 11061 .attr('aria-expanded', 'false');
11062 menuItem.parent().children().last().children() // set the focus to the last menuItem 11063 .first() 11064 .focus(); 11065 } else { 11066 menuItem.prev().children().first().focus(); 11067 } 11068 }, 11069 37: function (menuItem) { // left 11070 if (menuItem.hasClass('nav-item')) { // top level 11071 menuItem.removeClass('show').children('.dropdown-menu').removeClass('show'); 11072 $(this).attr('aria-expanded', 'false'); 11073 menuItem.prev().children().first().focus(); 11074 } else { 11075 menuItem.closest('.show').removeClass('show') 11076 .closest('li.show').removeClass('show') 11077 .children() 11078 .first() 11079 .focus() 11080 .attr('aria-expanded', 'false'); 11081 } 11082 }, 11083 27: function (menuItem) { // escape 11084 var parentMenu = menuItem.hasClass('show') 11085 ? menuItem 11086 : menuItem.closest('li.show'); 11087 parentMenu.children('.show').removeClass('show'); 11088 parentMenu.removeClass('show').children('.nav-link') 11089 .attr('aria-expanded', 'false'); 11090 parentMenu.children().first().focus(); 11091 } 11092 }, 11093 function () { 11094 return $(this).parent(); 11095 } 11096 ); 11097 11098 $('.dropdown:not(.disabled) [data-toggle="dropdown"]') 11099 .on('click', function (e) { 11100 if (!isDesktop(this)) { 11101 $('.modal-background').show(); 11102 // copy parent element into current UL 11103 var li = $('<li class="dropdown-item top-category" role="button"></li>'); 11104 var link = $(this).clone().removeClass('dropdown-toggle') 11105 .removeAttr('data-toggle') 11106 .removeAttr('aria-expanded') 11107 .attr('aria-haspopup', 'false'); 11108 li.append(link); 11109 var closeMenu = $('<li class="nav-menu"></li>'); 11110 closeMenu.append($('.close-menu').first().clone()); 11111 $(this).parent().children('.dropdown-menu') 11112 .prepend(li) 11113 .prepend(closeMenu) 11114 .attr('aria-hidden', 'false'); 11115 // copy navigation menu into view 11116 $(this).parent().addClass('show'); 11117 $(this).attr('aria-expanded', 'true'); 11118 $(link).focus(); 11119 $('div.menu-group > ul.nav.navbar-nav > li.nav-item > a').attr('aria-hidden', 'true'); 11120 e.preventDefault(); 11121 } 11122 }) 11123 .on('mouseenter', function () { 11124 if (isDesktop(this)) { 11125 var eventElement = this; 11126 $('.navbar-nav > li').each(function () { 11127 if (!$.contains(this, eventElement)) { 11128 $(this).find('.show').each(function () { 11129 clearSelection(this); 11130 }); 11131 if ($(this).hasClass('show')) { 11132 $(this).removeClass('show'); 11133 $(this).children('ul.dropdown-menu').removeClass('show'); 11134 $(this).children('.nav-link').attr('aria-expanded', 'false'); 11135 } 11136 } 11137 }); 11138 // need to close all the dropdowns that are not direct parent of current dropdown 11139 $(this).parent().addClass('show'); 11140 $(this).siblings('.dropdown-menu').addClass('show'); 11141 $(this).attr('aria-expanded', 'true'); 11142 } 11143 }) 11144 .parent() 11145 .on('mouseleave', function () { 11146 if (isDesktop(this)) { 11147 $(this).removeClass('show'); 11148 $(this).children('.dropdown-menu').removeClass('show'); 11149 $(this).children('.nav-link').attr('aria-expanded', 'false'); 11150 } 11151 }); 11152 11153 $('.navbar>.close-menu>.close-button').on('click', function (e) { 11154 e.preventDefault(); 11155 $('.menu-toggleable-left').removeClass('in'); 11156 $('.modal-background').hide(); 11157 11158 $('.navbar-toggler').focus(); 11159 11160 $('.main-menu').attr('aria-hidden', 'true'); 11161 $('.main-menu').siblings().attr('aria-hidden', 'false'); 11162 $('header').siblings().attr('aria-hidden', 'false'); 11163 });
11164 11165 $('.navbar-nav').on('click', '.back', function (e) { 11166 e.preventDefault(); 11167 clearSelection(this); 11168 }); 11169 11170 $('.navbar-nav').on('click', '.close-button', function (e) { 11171 e.preventDefault(); 11172 $('.navbar-nav').find('.top-category').detach(); 11173 $('.navbar-nav').find('.nav-menu').detach(); 11174 $('.navbar-nav').find('.show').removeClass('show'); 11175 $('.menu-toggleable-left').removeClass('in'); 11176 11177 $('.main-menu').siblings().attr('aria-hidden', 'false'); 11178 $('header').siblings().attr('aria-hidden', 'false'); 11179 11180 $('.modal-background').hide(); 11181 }); 11182 11183 $('.navbar-toggler').click(function (e) { 11184 e.preventDefault(); 11185 $('.main-menu').toggleClass('in'); 11186 $('.modal-background').show(); 11187 11188 $('.main-menu').removeClass('d-none'); 11189 $('.main-menu').attr('aria-hidden', 'false'); 11190 $('.main-menu').siblings().attr('aria-hidden', 'true'); 11191 $('header').siblings().attr('aria-hidden', 'true'); 11192 11193 $('.main-menu .nav.navbar-nav .nav-link').first().focus(); 11194 }); 11195 11196 keyboardAccessibility('.navbar-header .user', 11197 { 11198 40: function ($popover) { // down 11199 if ($popover.children('a').first().is(':focus')) { 11200 $popover.next().children().first().focus(); 11201 } else { 11202 $popover.children('a').first().focus(); 11203 } 11204 }, 11205 38: function ($popover) { // up 11206 if ($popover.children('a').first().is(':focus')) { 11207 $(this).focus(); 11208 $popover.removeClass('show'); 11209 } else { 11210 $popover.children('a').first().focus(); 11211 } 11212 }, 11213 27: function () { // escape 11214 $('.navbar-header .user .popover').removeClass('show'); 11215 $('.user').attr('aria-expanded', 'false'); 11216 }, 11217 9: function () { // tab 11218 $('.navbar-header .user .popover').removeClass('show'); 11219 $('.user').attr('aria-expanded', 'false'); 11220 } 11221 }, 11222 function () { 11223 var $popover = $('.user .popover li.nav-item'); 11224 return $popover; 11225 } 11226 ); 11227 11228 $('.navbar-header .user').on('mouseenter focusin', function () { 11229 if ($('.navbar-header .user .popover').length > 0) { 11230 $('.navbar-header .user .popover').addClass('show'); 11231 $('.user').attr('aria-expanded', 'true'); 11232 } 11233 }); 11234 11235 $('.navbar-header .user').on('mouseleave', function () { 11236 $('.navbar-header .user .popover').removeClass('show'); 11237 $('.user').attr('aria-expanded', 'false'); 11238 }); 11239 $('body').on('click', '#myaccount', function () { 11240 event.preventDefault(); 11241 }); 11242}; 11243 11244 11245/***/ }), 11246 11247/***/ 277: 11248/***/ (function(module, exports, __webpack_require__) { 11249 11250"use strict"; 11251 11252 11253module.exports = function (selector, keyFunctions, preFunction) { 11254 $(selector).on('keydown', function (e) { 11255 var key = e.which; 11256 var supportedKeyCodes = [37, 38, 39, 40, 27]; 11257 if (supportedKeyCodes.indexOf(key) >= 0) { 11258 e.preventDefault(); 11259 } 11260 var returnedScope = preFunction.call(this); 11261 if (keyFunctions[key]) { 11262 keyFunctions[key].call(this, returnedScope); 11263 } 11264 }); 11265}; 11266 11267 11268/***/ }), 11269 11270/***/ 278: 11271/***/ (function(module, exports, __webpack_require__) { 11272 11273"use strict"; 11274 11275 11276/** 11277 * Get cookie value by cookie name from browser 11278 * @param {string} cookieName - name of the cookie 11279 * @returns {string} cookie value of the found cookie name 11280 */ 11281function getCookie(cookieName) { 11282 var name = cookieName + '='; 11283 var decodedCookie = decodeURIComponent(document.cookie); 11284 var cookieArray = decodedCookie.split(';'); 11285 for (var i = 0; i < cookieArray.length; i++) { 11286 var cookieItem = cookieArray[i]; 11287 while (cookieItem.charAt(0) === ' ') { 11288 cookieItem = cookieItem.substring(1); 11289 } 11290 if (cookieItem.indexOf(name) === 0) { 11291 return cookieItem.substring(name.length, cookieItem.length); 11292 } 11293 } 11294 return ''; 11295} 11296 11297module.exports = function () { 11298 if ($('.valid-cookie-warning').length > 0) { 11299 var previousSessionID = window.localStorage.getItem('previousSid'); 11300 var currentSessionID = getCookie('sid'); 11301 if (!previousSessionID && currentSessionID) { 11302 // When a user first time visit the home page, 11303 // set the previousSessionID to currentSessionID 11304 // and Show the cookie alert 11305 previousSessionID = currentSessionID; 11306 window.localStorage.setItem('previousSid', previousSessionID); 11307 $('.cookie-warning-messaging').show(); 11308 } else if (previousSessionID && previousSessionID === currentSessionID) { 11309 // Hide the cookie alert if user is in the same session 11310 $('.cookie-warning-messaging').hide(); 11311 } else { 11312 // Clear the previousSessionID from localStorage 11313 // when user session is changed or expired 11314 window.localStorage.removeItem('previousSid'); 11315 } 11316 } 11317}; 11318 11319 11320/***/ }), 11321 11322/***/ 279: 11323/***/ (function(module, exports, __webpack_require__) { 11324 11325"use strict"; 11326 11327 11328/** 11329 * Show a spinner inside a given element 11330 * @param {element} $target - Element to block by the veil and spinner. 11331 * Pass body to block the whole page. 11332 */ 11333function addSpinner($target) {
11334 var $veil = $('<div class="veil"><div class="underlay"></div></div>'); 11335 $veil.append('<div class="spinner"><div class="dot1"></div><div class="dot2"></div><div class="dot3"></div><div class="dot4"></div></div>'); 11336 if ($target.get(0).tagName === 'IMG') { 11337 $target.after($veil); 11338 $veil.css({ width: $target.width(), height: $target.height() }); 11339 if ($target.parent().css('position') === 'static') { 11340 $target.parent().css('position', 'relative'); 11341 } 11342 } else { 11343 $target.append($veil); 11344 if ($target.css('position') === 'static') { 11345 $target.parent().css('position', 'relative'); 11346 $target.parent().addClass('veiled'); 11347 } 11348 if ($target.get(0).tagName === 'BODY') { 11349 $veil.find('.spinner').css('position', 'fixed'); 11350 } 11351 } 11352 $veil.click(function (e) { 11353 e.stopPropagation(); 11354 }); 11355} 11356 11357/** 11358 * Remove existing spinner 11359 * @param {element} $veil - jQuery pointer to the veil element 11360 */ 11361function removeSpinner($veil) { 11362 if ($veil.parent().hasClass('veiled')) { 11363 $veil.parent().css('position', ''); 11364 $veil.parent().removeClass('veiled'); 11365 } 11366 $veil.off('click'); 11367 $veil.remove(); 11368} 11369 11370// element level spinner: 11371$.fn.spinner = function (selector) { 11372 var $element = $(selector); 11373 var Fn = function () { 11374 this.start = function () { 11375 if ($element.length) { 11376 addSpinner($element); 11377 } 11378 }; 11379 this.stop = function () { 11380 if ($element.length) { 11381 var $veil = $('.veil'); 11382 removeSpinner($veil); 11383 } 11384 }; 11385 }; 11386 return new Fn(); 11387}; 11388 11389// page-level spinner: 11390$.spinner = function () { 11391 var Fn = function () { 11392 this.start = function () { 11393 addSpinner($('body')); 11394 }; 11395 this.stop = function () { 11396 removeSpinner($('.veil')); 11397 }; 11398 }; 11399 return new Fn(); 11400}; 11401 11402 11403/***/ }), 11404 11405/***/ 280: 11406/***/ (function(module, exports, __webpack_require__) { 11407 11408"use strict"; 11409 11410 11411var focusHelper = __webpack_require__(6); 11412 11413/** 11414 * Renders a modal window that will track the users consenting to accepting site tracking policy 11415 */ 11416function showConsentModal() { 11417 var trackingConsentData = $('.tracking-consent'); 11418 if (!trackingConsentData.data('caonline')) { 11419 return; 11420 } 11421 11422 var urlContent = trackingConsentData.data('url'); 11423 var urlAccept = trackingConsentData.data('accept'); 11424 var urlReject = trackingConsentData.data('reject'); 11425 var textYes = trackingConsentData.data('accepttext'); 11426 var textNo = trackingConsentData.data('rejecttext'); 11427 var textHeader = trackingConsentData.data('heading'); 11428 var tokenName = trackingConsentData.data('tokenname'); 11429 var token = trackingConsentData.data('token'); 11430 11431 var htmlString = '<!-- Modal -->' 11432 + '<div class="modal show" id="consent-tracking" aria-modal="true" role="dialog" style="display: block;">' 11433 + '<div class="modal-dialog">' 11434 + '<!-- Modal content-->' 11435 + '<div class="modal-content">' 11436 + '<div class="modal-body"></div>' 11437 + '<div class="button-wrapper" id="button-section" style="visibility:hidden;height:0px; float: center;">' 11438 + '<button class=\"btn btn-primary\" data-url="' + urlAccept + '" style="margin-right:20px">\r\n <span>Accept<\/span>\r\n<\/button>
11438' 11439 + '<button class=\"btn btn-outline-primary text-capitalize\" data-url="' + urlReject + '" style="margin-right:20px">\r\n <span>Reject<\/span>\r\n<\/button>' 11440 + '</div>' 11441 + '</div>' 11442 + '</div>' 11443 + '</div>' 11444 + '</div>'; 11445 $('#consent-tracking-section').append(htmlString); 11446 11447 $.ajax({ 11448 url: urlContent, 11449 type: 'get', 11450 dataType: 'html', 11451 success: function (response) { 11452 $('#consent-tracking .modal-body').html('<div class="modal-header" style="padding: 0px;"><button type="button" class="close splash-popup-close" onClick="(function(){$(\'#consent-tracking\').remove();return false;})();return false;">×</button></div>'+response); 11453 $('#button-section').css("visibility", "visible"); 11454 $('#button-section').css('height', 'auto'); 11455 11456 }, 11457 error: function () { 11458 $('#consent-tracking').remove(); 11459 } 11460 }); 11461 11462 $('#consent-tracking .button-wrapper button').click(function (e) { 11463 e.preventDefault(); 11464 var url = $(this).data('url'); 11465 var data = {}; 11466 data[tokenName] = token; 11467 $.ajax({
11468 url: url, 11469 type: 'post', 11470 data: data, 11471 dataType: 'json', 11472 success: function (response) { 11473 // Only hide modal if the operation is successful - don't want to give a false impression 11474 if (response.success) { 11475 $('#consent-tracking').remove(); 11476 // get the cookie expiration time 11477 let date = new Date(); 11478 date.setTime(date.getTime() + (response.consentCookieExpirationDays* 24 * 60 * 60 * 1000)); 11479 let expires = "expires=" + date.toUTCString(); 11480 // Set the cookie 11481 let ck = "cookieConsent=" + response.consent + "; " + expires + "; path=/"; 11482 document.cookie = "cookieConsent=" + response.consent + "; " + expires + "; path=/"; 11483 11484 // update consent mode on GTM 11485 window.gtag = function() { dataLayer.push(arguments); } 11486 window.gtag('consent', 'update', { 11487 ad_storage: response.consent === true ? 'granted' : 'denied', 11488 analytics_storage: response.consent === true ? 'granted' : 'denied', 11489 ad_user_data: response.consent === true ? 'granted' : 'denied', 11490 ad_personalization: response.consent === true ? 'granted' : 'denied' 11491 }); 11492 } 11493 }, 11494 error: function (err) { 11495 // Expected error response is for CSRF failure, which will include a redirect to CSRF-Fail 11496 if (err.responseJSON.redirectUrl) { 11497 window.location.href = err.responseJSON.redirectUrl; 11498 } 11499 } 11500 }); 11501 }); 11502} 11503 11504module.exports = function () { 11505 if ($('.consented').length === 0 && $('.tracking-consent').hasClass('api-true')) { 11506 showConsentModal(); 11507 } 11508 11509 if ($('.tracking-consent').hasClass('api-true')) { 11510 $('.tracking-consent').click(function () { 11511 showConsentModal(); 11512 }); 11513 } 11514 11515 $('body').on('shown.bs.modal', '#consent-tracking', function () { 11516 $('#consent-tracking').siblings().attr('aria-hidden', 'true'); 11517 $('#consent-tracking .affirm').focus(); 11518 }); 11519 11520 $('body').on('hidden.bs.modal', '#consent-tracking', function () { 11521 $('#consent-tracking').siblings().attr('aria-hidden', 'false'); 11522 }); 11523 11524 $('body').on('keydown', '#consent-tracking', function (e) { 11525 var focusParams = { 11526 event: e, 11527 containerSelector: '#consent-tracking', 11528 firstElementSelector: '.affirm', 11529 lastElementSelector: '.decline', 11530 nextToLastElementSelector: '.affirm' 11531 }; 11532 focusHelper.setTabNextFocus(focusParams); 11533 }); 11534}; 11535 11536 11537/***/ }), 11538 11539/***/ 281: 11540/***/ (function(module, exports, __webpack_require__) { 11541 11542"use strict"; 11543 11544 11545var scrollAnimate = __webpack_require__(11); 11546 11547/** 11548 * appends params to a url 11549 * @param {string} data - data returned from the server's ajax call 11550 * @param {Object} button - button that was clicked for email sign-up 11551 */ 11552function displayMessage(data, button) { 11553 $.spinner().stop(); 11554 var status; 11555 if (data.success) { 11556 status = 'alert-success'; 11557 } else { 11558 status = 'alert-danger'; 11559 } 11560 11561 if ($('.email-signup-message').length === 0) { 11562 $('body').append( 11563 '<div class="email-signup-message"></div>' 11564 ); 11565 } 11566 $('.email-signup-message') 11567 .append('<div class="email-signup-alert text-center ' + status + '">' + data.msg + '</div>'); 11568 11569 setTimeout(function () { 11570 $('.email-signup-message').remove(); 11571 button.removeAttr('disabled'); 11572 }, 3000); 11573} 11574 11575module.exports = function () { 11576 $('.back-to-top').click(function () { 11577 scrollAnimate(); 11578 }); 11579 11580 $('.subscribe-email').on('click', function (e) { 11581 e.preventDefault(); 11582 var url = $(this).data('href'); 11583 var button = $(this); 11584 var emailId = $('input[name=hpEmailSignUp]').val(); 11585 var newsletterStickyCookieName = $('input[name=newsletterStickyCookieName]').val(); 11586 var newsletterCookieMaxAge = $('input[name=newsletterCookieMaxAge]').val(); 11587 $('.newsletterError').hide(); 11588 $.spinner().start(); 11589 $('input[name=hpEmailSignUp]').val(""); 11590 $.ajax({
11591 url: url, 11592 type: 'post', 11593 dataType: 'json', 11594 data: { 11595 emailId: emailId, 11596 newsletterType: 'sticky' 11597 }, 11598 11599 success: function (data) { 11600 if (data.success) { 11601 //$('#newsletter-popup').modal('hide'); 11602 $(".newsletterError").removeClass('d-none'); 11603 $(".newsletterError").html(data.msg); 11604 $(".newsletterError").attr('style', 'display: block;'); 11605 //$('#newsletter-popup-success').modal('show'); 11606 var d = new Date(); 11607 var expires = newsletterCookieMaxAge; 11608 d.setTime(d.getTime()+expires*1000); 11609 expires = "expires="+d.toUTCString(); 11610 document.cookie = newsletterStickyCookieName + ' =1;' + expires + '; path=/'; 11611 } else { 11612 $(".newsletterError").html(data.msg); 11613 $(".newsletterError").removeClass('d-none'); 11614 $(".newsletterError").attr('style', 'display: block;'); 11615 } 11616 $.spinner().stop(); 11617 }, 11618 error: function (err) { 11619 displayMessage(err, button); 11620 } 11621 }); 11622 }); 11623 11624 $('.subscribe-email-popup').on('click', function (e) { 11625 e.preventDefault(); 11626 var url = $(this).data('href'); 11627 var button = $(this); 11628 var emailId = $('input[name=subscribePopup]').val(); 11629 var newsletterCookieName = $('input[name=newsletterCookieName]').val(); 11630 var newsletterCookieMaxAge = $('input[name=newsletterCookieMaxAge]').val(); 11631 $('.newsletterPopupError').hide(); 11632 $.spinner().start(); 11633 $.ajax({
11634 url: url, 11635 type: 'post', 11636 dataType: 'json', 11637 data: { 11638 emailId: emailId, 11639 newsletterType: 'popup' 11640 }, 11641 success: function (data) { 11642 if (data.success) { 11643 $('#newsletter-popup').modal('hide'); 11644 $("span.newsletterSuccess").html(data.msg); 11645 $('#newsletter-popup-success').modal('show'); 11646 } else { 11647 $(".newsletterPopupError").html(data.msg); 11648 $(".newsletterPopupError").removeClass('d-none'); 11649 $(".newsletterPopupError").attr('style', 'display: block;'); 11650 } 11651 var d = new Date(); 11652 var expires = newsletterCookieMaxAge; 11653 d.setTime(d.getTime()+expires*1000); 11654 expires = "expires="+d.toUTCString(); 11655 document.cookie = newsletterCookieName + ' =1;' + expires + '; path=/'; 11656 $.spinner().stop(); 11657 }, 11658 error: function (err) { 11659 displayMessage(err, button); 11660 } 11661 }); 11662 }); 11663 11664 $('.subscribeEmail-footer').on('click', function (e) { 11665 e.preventDefault(); 11666 var url = $(this).data('href'); 11667 var button = $(this); 11668 var emailId = $('input[name=subscribe]').val(); 11669 var newsletterCookieName = $('input[name=newsletterCookieName]').val(); 11670 var newsletterCookieMaxAge = $('input[name=newsletterCookieMaxAge]').val(); 11671 $('.newsletterPopupError').hide(); 11672 $.spinner().start(); 11673 $.ajax({
11674 url: url, 11675 type: 'post', 11676 dataType: 'json', 11677 data: { 11678 emailId: emailId, 11679 newsletterType: 'sticky' 11680 }, 11681 success: function (data) { 11682 if (data.success) { 11683 //$('#newsletter-popup').modal('hide'); 11684 $(".newsletterSuccess").removeClass('d-none'); 11685 $(".newsletterSuccess").html(data.msg); 11686 //$('#newsletter-popup-success').modal('show'); 11687 var d = new Date(); 11688 var expires = newsletterCookieMaxAge; 11689 d.setTime(d.getTime()+expires*1000); 11690 expires = "expires="+d.toUTCString(); 11691 document.cookie = newsletterCookieName + ' =1;' + expires + '; path=/'; 11692 } else { 11693 $(".newsletterPopupError").html(data.msg); 11694 $(".newsletterPopupError").removeClass('d-none'); 11695 $(".newsletterPopupError").attr('style', 'display: block;'); 11696 } 11697 $.spinner().stop(); 11698 }, 11699 error: function (err) { 11700 displayMessage(err, button); 11701 } 11702 }); 11703 }); 11704}; 11705 11706 11707/***/ }), 11708 11709/***/ 282: 11710/***/ (function(module, exports, __webpack_require__) { 11711 11712"use strict"; 11713 11714 11715var cart = __webpack_require__(4); 11716 11717var updateMiniCart = true; 11718 11719module.exports = function () { 11720 cart(); 11721 11722 $('.minicart').on('count:update', function (event, count) { 11723 if (count && $.isNumeric(count.quantityTotal)) { 11724 $('.minicart .minicart-quantity').text(count.quantityTotal); 11725 $('.minicart .minicart-link').attr({ 11726 'aria-label': count.minicartCountOfItems, 11727 title: count.minicartCountOfItems 11728 }); 11729 } 11730 }); 11731 11732 $('.minicart').on('mouseenter focusin touchstart', function () { 11733 11734 if ($('.search:visible').length === 0) { 11735 return; 11736 } 11737 var url = $('.minicart').data('action-url'); 11738 var count = parseInt($('.minicart .minicart-quantity').text(), 10); 11739 11740 if (count !== 0 && $('.minicart .popover.show').length === 0) { 11741 if (!updateMiniCart) { 11742 $('.minicart .popover').addClass('show'); 11743 return; 11744 } 11745 11746 $('.minicart .popover').addClass('show'); 11747 $('.minicart .popover').spinner().start(); 11748 $.get(url, function (data) { 11749 $('.minicart .popover').empty(); 11750 $('.minicart .popover').append(data); 11751 updateMiniCart = false; 11752 $.spinner().stop(); 11753 }); 11754 } 11755 }); 11756 $('body').on('touchstart click', function (e) { 11757 if ($('.minicart').has(e.target).length <= 0) { 11758 $('.minicart .popover').removeClass('show'); 11759 } 11760 }); 11761 $('.minicart').on('mouseleave focusout', function (event) { 11762 if ((event.type === 'focusout' && $('.minicart').has(event.target).length > 0) 11763 || (event.type === 'mouseleave' && $(event.target).is('.minicart .quantity')) 11764 || $('body').hasClass('modal-open')) { 11765 event.stopPropagation(); 11766 return; 11767 } 11768 11769 $('.minicart .popover').removeClass('show'); 11770 }); 11771 $('body').on('change', '.minicart .quantity', function () { 11772 if ($(this).parents('.bonus-product-line-item').length && $('.cart-page').length) { 11773 location.reload(); 11774 } 11775 }); 11776 $('body').on('product:afterAddToCart', function () { 11777 updateMiniCart = true; 11778 }); 11779 $('body').on('cart:update', function () { 11780 updateMiniCart = true; 11781 }); 11782 $(document).on('click', '.mini-cart-toggler', function () { 11783 var itemClass = $(this).next().find('.item-image'); 11784 var iconClass = $(this).find('i'); 11785 if (iconClass.hasClass('fa-chevron-down')) { 11786 iconClass.removeClass('fa-chevron-down'); 11787 iconClass.addClass('fa-chevron-right'); 11788 } else { 11789 iconClass.removeClass('fa-chevron-right'); 11790 iconClass.addClass('fa-chevron-down'); 11791 11792 } 11793 11794 if (itemClass.hasClass('active')) { 11795 itemClass.removeClass('active'); 11796 } else { 11797 itemClass.addClass('active'); 11798 } 11799 });
11800}; 11801 11802 11803/***/ }), 11804 11805/***/ 283: 11806/***/ (function(module, exports, __webpack_require__) { 11807 11808"use strict"; 11809 11810module.exports = function () { 11811 var sizes = ['xs', 'sm', 'md', 'lg', 'xl']; 11812 11813 sizes.forEach(function (size) { 11814 var selector = '.collapsible-' + size + ' .title'; 11815 $('body').on('click', selector, function (e) { 11816 e.preventDefault(); 11817 $(this).parents('.collapsible-' + size).toggleClass('active'); 11818 11819 if ($(this).parents('.collapsible-' + size).hasClass('active')) { 11820 $(this).attr('aria-expanded', true); 11821 } else { 11822 $(this).attr('aria-expanded', false); 11823 } 11824 }); 11825 }); 11826}; 11827 11828 11829/***/ }), 11830 11831/***/ 284: 11832/***/ (function(module, exports, __webpack_require__) { 11833 11834"use strict"; 11835 11836 11837var debounce = __webpack_require__(285); 11838var endpoint = $('.suggestions-wrapper').data('url'); 11839var minChars = 3; 11840var UP_KEY = 38; 11841var DOWN_KEY = 40; 11842var DIRECTION_DOWN = 1; 11843var DIRECTION_UP = -1; 11844 11845/** 11846 * Retrieves Suggestions element relative to scope 11847 * 11848 * @param {Object} scope - Search input field DOM element 11849 * @return {JQuery} - .suggestions-wrapper element 11850 */ 11851function getSuggestionsWrapper(scope) { 11852 return $(scope).siblings('.suggestions-wrapper'); 11853} 11854 11855/** 11856 * Determines whether DOM element is inside the .search-mobile class 11857 * 11858 * @param {Object} scope - DOM element, usually the input.search-field element 11859 * @return {boolean} - Whether DOM element is inside div.search-mobile 11860 */ 11861function isMobileSearch(scope) { 11862 return !!$(scope).closest('.search-mobile').length; 11863} 11864 11865/** 11866 * Remove modal classes needed for mobile suggestions 11867 * 11868 */ 11869function clearModals() { 11870 $('body').removeClass('modal-open'); 11871 $('header').siblings().attr('aria-hidden', 'false'); 11872 $('.suggestions').removeClass('modal'); 11873} 11874 11875/** 11876 * Apply modal classes needed for mobile suggestions 11877 * 11878 * @param {Object} scope - Search input field DOM element 11879 */ 11880function applyModals(scope) { 11881 if (isMobileSearch(scope)) { 11882 $('body').addClass('modal-open'); 11883 $('header').siblings().attr('aria-hidden', 'true'); 11884 getSuggestionsWrapper(scope).find('.suggestions').addClass('modal'); 11885 } 11886} 11887 11888/** 11889 * Tear down Suggestions panel 11890 */ 11891function tearDownSuggestions() { 11892 $('input.search-field').val(''); 11893 clearModals(); 11894 $('.search-mobile .suggestions').unbind('scroll'); 11895 $('.suggestions-wrapper').empty(); 11896} 11897 11898/** 11899 * Toggle search field icon from search to close and vice-versa 11900 * 11901 * @param {string} action - Action to toggle to 11902 */ 11903function toggleSuggestionsIcon(action) { 11904 var mobileSearchIcon = '.search-mobile button.'; 11905 var iconSearch = 'fa-search'; 11906 var iconSearchClose = 'fa-close'; 11907 11908 if (action === 'close') { 11909 $(mobileSearchIcon + iconSearch).removeClass(iconSearch).addClass(iconSearchClose).attr('type', 'button'); 11910 } else { 11911 $(mobileSearchIcon + iconSearchClose).removeClass(iconSearchClose).addClass(iconSearch).attr('type', 'submit'); 11912 } 11913} 11914 11915/** 11916 * Determines whether the "More Content Below" icon should be displayed 11917 * 11918 * @param {Object} scope - DOM element, usually the input.search-field element 11919 */ 11920function handleMoreContentBelowIcon(scope) { 11921 if (($(scope).scrollTop() + $(scope).innerHeight()) >= $(scope)[0].scrollHeight) { 11922 $('.more-below').fadeOut(); 11923 } else { 11924 $('.more-below').fadeIn(); 11925 } 11926} 11927 11928/** 11929 * Positions Suggestions panel on page 11930 * 11931 * @param {Object} scope - DOM element, usually the input.search-field element 11932 */ 11933function positionSuggestions(scope) { 11934 var outerHeight; 11935 var $scope; 11936 var $suggestions; 11937 var top; 11938 11939 if (isMobileSearch(scope)) { 11940 $scope = $(scope); 11941 top = $scope.offset().top; 11942 outerHeight = $scope.outerHeight(); 11943 $suggestions = getSuggestionsWrapper(scope).find('.suggestions'); 11944 $suggestions.css('top', top + outerHeight); 11945 11946 handleMoreContentBelowIcon(scope); 11947 11948 // Unfortunately, we have to bind this dynamically, as the live scroll event was not 11949 // properly detecting dynamic suggestions element's scroll event 11950 $suggestions.scroll(function () { 11951 handleMoreContentBelowIcon(this); 11952 }); 11953 } 11954} 11955 11956/** 11957 * Process Ajax response for SearchServices-GetSuggestions 11958 * 11959 * @param {Object|string} response - Empty object literal if null response or string with rendered 11960 * suggestions template contents 11961 */ 11962function processResponse(response) { 11963 var $suggestionsWrapper = getSuggestionsWrapper(this).empty(); 11964 if (typeof (response) !== 'object') { 11965 $suggestionsWrapper.append(response).show(); 11966 $(this).siblings('.reset-button').addClass('d-sm-block'); 11967 positionSuggestions(this); 11968 11969 if (isMobileSearch(this)) { 11970 //toggleSuggestionsIcon('close'); 11971 applyModals(this); 11972 } 11973 11974 // Trigger screen reader by setting aria-describedby with the new suggestion message. 11975 var suggestionsList = $('.suggestions .item'); 11976 if ($(suggestionsList).length) { 11977 $('input.search-field').attr('aria-describedby', 'search-result-count'); 11978 } else { 11979 $('input.search-field').removeAttr('aria-describedby'); 11980 } 11981 } else { 11982 $suggestionsWrapper.hide(); 11983 } 11984} 11985 11986/** 11987 * Retrieve suggestions 11988 * 11989 * @param {Object}
11989 scope - Search field DOM element 11990 */ 11991function getSuggestions(scope) { 11992 if ($(scope).val().length >= minChars) { 11993 $.ajax({ 11994 context: scope, 11995 url: endpoint + encodeURIComponent($(scope).val()), 11996 method: 'GET', 11997 success: processResponse, 11998 error: function () { 11999 $.spinner().stop(); 12000 } 12001 }); 12002 } else { 12003 //toggleSuggestionsIcon('search'); 12004 $(scope).siblings('.reset-button').removeClass('d-sm-block'); 12005 clearModals(); 12006 getSuggestionsWrapper(scope).empty(); 12007 } 12008} 12009 12010/** 12011 * Handle Search Suggestion Keyboard Arrow Keys 12012 * 12013 * @param {Integer} direction takes positive or negative number constant, DIRECTION_UP (-1) or DIRECTION_DOWN (+1) 12014 */ 12015function handleArrow(direction) { 12016 // get all li elements in the suggestions list 12017 var suggestionsList = $('.suggestions .item'); 12018 if (suggestionsList.filter('.selected').length === 0) { 12019 suggestionsList.first().addClass('selected'); 12020 $('input.search-field').each(function () { 12021 $(this).attr('aria-activedescendant', suggestionsList.first()[0].id); 12022 }); 12023 } else { 12024 suggestionsList.each(function (index) { 12025 var idx = index + direction; 12026 if ($(this).hasClass('selected')) { 12027 $(this).removeClass('selected'); 12028 $(this).removeAttr('aria-selected'); 12029 if (suggestionsList.eq(idx).length !== 0) { 12030 suggestionsList.eq(idx).addClass('selected'); 12031 suggestionsList.eq(idx).attr('aria-selected', true); 12032 $(this).removeProp('aria-selected'); 12033 $('input.search-field').each(function () { 12034 $(this).attr('aria-activedescendant', suggestionsList.eq(idx)[0].id); 12035 }); 12036 } else { 12037 suggestionsList.first().addClass('selected'); 12038 suggestionsList.first().attr('aria-selected', true); 12039 $('input.search-field').each(function () { 12040 $(this).attr('aria-activedescendant', suggestionsList.first()[0].id); 12041 }); 12042 } 12043 return false; 12044 } 12045 return true; 12046 }); 12047 } 12048} 12049 12050module.exports = function () { 12051 $('form[name="simpleSearch"]').submit(function (e) { 12052 var suggestionsList = $('.suggestions .item'); 12053 if (suggestionsList.filter('.selected').length !== 0) { 12054 e.preventDefault(); 12055 suggestionsList.filter('.selected').find('a')[0].click(); 12056 } 12057 }); 12058 12059 $('input.search-field').each(function () { 12060 /** 12061 * Use debounce to avoid making an Ajax call on every single key press by waiting a few 12062 * hundred milliseconds before making the request. Without debounce, the user sees the 12063 * browser blink with every key press. 12064 */ 12065 var debounceSuggestions = debounce(getSuggestions, 300); 12066 $(this).on('keyup focus', function (e) { 12067 // Capture Down/Up Arrow Key Events 12068 switch (e.which) { 12069 case DOWN_KEY: 12070 handleArrow(DIRECTION_DOWN); 12071 e.preventDefault(); // prevent moving the cursor 12072 break; 12073 case UP_KEY: 12074 handleArrow(DIRECTION_UP); 12075 e.preventDefault(); // prevent moving the cursor 12076 break; 12077 default: 12078 debounceSuggestions(this, e); 12079 } 12080 }); 12081 }); 12082 12083 $('body').on('click', function (e) { 12084 if (!$('.suggestions').has(e.target).length && !$(e.target).hasClass('search-field')) { 12085 $('.suggestions').hide(); 12086 } 12087 }); 12088 12089 $('body').on('click touchend', '.search-mobile button.fa-close', function (e) { 12090 e.preventDefault(); 12091 $('.suggestions').hide(); 12092 //toggleSuggestionsIcon('search'); 12093 tearDownSuggestions(); 12094 });
vendor: 11,074 bytes, lines 12095-12499
12095 12096 $('.site-search .reset-button').on('click', function () { 12097 $(this).removeClass('d-sm-block'); 12098 }); 12099 $('#search-suggestion-form').on('submit', function () { 12100 // if (!$("#search-suggestion-form").find(".reset-button").hasClass('d-sm-block')) { 12101 // return false; 12102 // } 12103 if ($(".suggestions").hasClass('suggestion-with-product-number')) { 12104 if ($(".suggestions").find('.product-suggestion').length == 1) { 12105 //redirect user to product detail page 12106 window.location.href = $(".suggestions").find('.product-suggestion a').attr('href'); 12107 return false; 12108 } 12109 12110 } 12111 return true; 12112 }); 12113}; 12114 12115 12116/***/ }), 12117 12118/***/ 285: 12119/***/ (function(module, exports, __webpack_require__) { 12120 12121var isObject = __webpack_require__(286), 12122 now = __webpack_require__(287), 12123 toNumber = __webpack_require__(290); 12124 12125/** Error message constants. */ 12126var FUNC_ERROR_TEXT = 'Expected a function'; 12127 12128/* Built-in method references for those with the same name as other `lodash` methods. */ 12129var nativeMax = Math.max, 12130 nativeMin = Math.min; 12131 12132/** 12133 * Creates a debounced function that delays invoking `func` until after `wait` 12134 * milliseconds have elapsed since the last time the debounced function was 12135 * invoked. The debounced function comes with a `cancel` method to cancel 12136 * delayed `func` invocations and a `flush` method to immediately invoke them. 12137 * Provide `options` to indicate whether `func` should be invoked on the 12138 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked 12139 * with the last arguments provided to the debounced function. Subsequent 12140 * calls to the debounced function return the result of the last `func` 12141 * invocation. 12142 * 12143 * **Note:** If `leading` and `trailing` options are `true`, `func` is 12144 * invoked on the trailing edge of the timeout only if the debounced function 12145 * is invoked more than once during the `wait` timeout. 12146 * 12147 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 12148 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 12149 * 12150 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 12151 * for details over the differences between `_.debounce` and `_.throttle`. 12152 * 12153 * @static 12154 * @memberOf _ 12155 * @since 0.1.0 12156 * @category Function 12157 * @param {Function} func The function to debounce. 12158 * @param {number} [wait=0] The number of milliseconds to delay. 12159 * @param {Object} [options={}] The options object. 12160 * @param {boolean} [options.leading=false] 12161 * Specify invoking on the leading edge of the timeout. 12162 * @param {number} [options.maxWait] 12163 * The maximum time `func` is allowed to be delayed before it's invoked. 12164 * @param {boolean} [options.trailing=true] 12165 * Specify invoking on the trailing edge of the timeout. 12166 * @returns {Function} Returns the new debounced function. 12167 * @example 12168 * 12169 * // Avoid costly calculations while the window size is in flux. 12170 * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); 12171 * 12172 * // Invoke `sendMail` when clicked, debouncing subsequent calls. 12173 * jQuery(element).on('click', _.debounce(sendMail, 300, { 12174 * 'leading': true, 12175 * 'trailing': false 12176 * })); 12177 * 12178 * // Ensure `batchLog` is invoked once after 1 second of debounced calls. 12179 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); 12180 * var source = new EventSource('/stream'); 12181 * jQuery(source).on('message', debounced); 12182 * 12183 * // Cancel the trailing debounced invocation. 12184 * jQuery(window).on('popstate', debounced.cancel); 12185 */ 12186function debounce(func, wait, options) { 12187 var lastArgs, 12188 lastThis, 12189 maxWait, 12190 result, 12191 timerId, 12192 lastCallTime, 12193 lastInvokeTime = 0, 12194 leading = false, 12195 maxing = false, 12196 trailing = true; 12197 12198 if (typeof func != 'function') { 12199 throw new TypeError(FUNC_ERROR_TEXT); 12200 } 12201 wait = toNumber(wait) || 0; 12202 if (isObject(options)) { 12203 leading = !!options.leading; 12204 maxing = 'maxWait' in options; 12205 maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; 12206 trailing = 'trailing' in options ? !!options.trailing : trailing; 12207 } 12208 12209 function invokeFunc(time) { 12210 var args = lastArgs, 12211 thisArg = lastThis; 12212 12213 lastArgs = lastThis = undefined; 12214 lastInvokeTime = time; 12215 result = func.apply(thisArg, args); 12216 return result; 12217 } 12218 12219 function leadingEdge(time) { 12220 // Reset any `maxWait` timer. 12221 lastInvokeTime = time; 12222 // Start the timer for the trailing edge. 12223 timerId = setTimeout(timerExpired, wait); 12224 // Invoke the leading edge. 12225 return leading ? invokeFunc(time) : result; 12226 } 12227 12228 function remainingWait(time) { 12229 var timeSinceLastCall = time - lastCallTime, 12230 timeSinceLastInvoke = time - lastInvokeTime, 12231 timeWaiting = wait - timeSinceLastCall; 12232 12233 return maxing 12234 ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) 12235 : timeWaiting; 12236 } 12237 12238 function shouldInvoke(time) { 12239 var timeSinceLastCall = time - lastCallTime, 12240 timeSinceLastInvoke = time - lastInvokeTime; 12241 12242 // Either this is the first call, activity has stopped and we're at the 12243 // trailing edge, the system time has gone backwards and we're treating 12244 // it as the trailing edge, or we've hit the `maxWait` limit. 12245 return (lastCallTime === undefined || (timeSinceLastCall >= wait) || 12246 (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); 12247 } 12248 12249 function timerExpired() { 12250 var time = now(); 12251 if (shouldInvoke(time)) { 12252 return trailingEdge(time); 12253 } 12254 // Restart the timer. 12255 timerId = setTimeout(timerExpired, remainingWait(time)); 12256 } 12257 12258 function trailingEdge(time) { 12259 timerId = undefined; 12260 12261 // Only invoke if we have `lastArgs` which means `func` has been 12262 // debounced at least once. 12263 if (trailing && lastArgs) { 12264 return invokeFunc(time); 12265 } 12266 lastArgs = lastThis = undefined; 12267 return result; 12268 } 12269 12270 function cancel() { 12271 if (timerId !== undefined) { 12272 clearTimeout(timerId); 12273 } 12274 lastInvokeTime = 0; 12275 lastArgs = lastCallTime = lastThis = timerId = undefined; 12276 } 12277 12278 function flush() { 12279 return timerId === undefined ? result : trailingEdge(now()); 12280 } 12281 12282 function debounced() { 12283 var time = now(), 12284 isInvoking = shouldInvoke(time); 12285 12286 lastArgs = arguments; 12287 lastThis = this; 12288 lastCallTime = time; 12289 12290 if (isInvoking) { 12291 if (timerId === undefined) { 12292 return leadingEdge(lastCallTime); 12293 } 12294 if (maxing) { 12295 // Handle invocations in a tight loop. 12296 clearTimeout(timerId); 12297 timerId = setTimeout(timerExpired, wait); 12298 return invokeFunc(lastCallTime); 12299 } 12300 } 12301 if (timerId === undefined) { 12302 timerId = setTimeout(timerExpired, wait); 12303 } 12304 return result; 12305 } 12306 debounced.cancel = cancel; 12307 debounced.flush = flush; 12308 return debounced; 12309} 12310 12311module.exports = debounce; 12312 12313 12314/***/ }), 12315 12316/***/ 286: 12317/***/ (function(module, exports) { 12318 12319/** 12320 * Checks if `value` is the 12321 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) 12322 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) 12323 * 12324 * @static 12325 * @memberOf _ 12326 * @since 0.1.0 12327 * @category Lang 12328 * @param {*} value The value to check. 12329 * @returns {boolean} Returns `true` if `value` is an object, else `false`. 12330 * @example 12331 * 12332 * _.isObject({}); 12333 * // => true 12334 * 12335 * _.isObject([1, 2, 3]); 12336 * // => true 12337 * 12338 * _.isObject(_.noop); 12339 * // => true 12340 * 12341 * _.isObject(null); 12342 * // => false 12343 */ 12344function isObject(value) { 12345 var type = typeof value; 12346 return value != null && (type == 'object' || type == 'function'); 12347} 12348 12349module.exports = isObject; 12350 12351 12352/***/ }), 12353 12354/***/ 287: 12355/***/ (function(module, exports, __webpack_require__) { 12356 12357var root = __webpack_require__(288); 12358 12359/** 12360 * Gets the timestamp of the number of milliseconds that have elapsed since 12361 * the Unix epoch (1 January 1970 00:00:00 UTC). 12362 * 12363 * @static 12364 * @memberOf _ 12365 * @since 2.4.0 12366 * @category Date 12367 * @returns {number} Returns the timestamp. 12368 * @example 12369 * 12370 * _.defer(function(stamp) { 12371 * console.log(_.now() - stamp); 12372 * }, _.now()); 12373 * // => Logs the number of milliseconds it took for the deferred invocation. 12374 */ 12375var now = function() { 12376 return root.Date.now(); 12377}; 12378 12379module.exports = now; 12380 12381 12382/***/ }), 12383 12384/***/ 288: 12385/***/ (function(module, exports, __webpack_require__) { 12386 12387var freeGlobal = __webpack_require__(289); 12388 12389/** Detect free variable `self`. */ 12390var freeSelf = typeof self == 'object' && self && self.Object === Object && self; 12391 12392/** Used as a reference to the global object. */ 12393var root = freeGlobal || freeSelf || Function('return this')(); 12394 12395module.exports = root; 12396 12397 12398/***/ }), 12399 12400/***/ 289: 12401/***/ (function(module, exports, __webpack_require__) { 12402 12403/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */ 12404var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; 12405 12406module.exports = freeGlobal; 12407 12408/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(20))) 12409 12410/***/ }), 12411 12412/***/ 290: 12413/***/ (function(module, exports, __webpack_require__) { 12414 12415var baseTrim = __webpack_require__(291), 12416 isObject = __webpack_require__(286), 12417 isSymbol = __webpack_require__(293); 12418 12419/** Used as references for various `Number` constants. */ 12420var NAN = 0 / 0; 12421 12422/** Used to detect bad signed hexadecimal string values. */ 12423var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; 12424 12425/** Used to detect binary string values. */ 12426var reIsBinary = /^0b[01]+$/i; 12427 12428/** Used to detect octal string values. */ 12429var reIsOctal = /^0o[0-7]+$/i; 12430 12431/** Built-in method references without a dependency on `root`. */ 12432var freeParseInt = parseInt; 12433 12434/** 12435 * Converts `value` to a number. 12436 * 12437 * @static 12438 * @memberOf _ 12439 * @since 4.0.0 12440 * @category Lang 12441 * @param {*} value The value to process. 12442 * @returns {number} Returns the number. 12443 * @example 12444 * 12445 * _.toNumber(3.2); 12446 * // => 3.2 12447 * 12448 * _.toNumber(Number.MIN_VALUE); 12449 * // => 5e-324 12450 * 12451 * _.toNumber(Infinity); 12452 * // => Infinity 12453 * 12454 * _.toNumber('3.2'); 12455 * // => 3.2 12456 */ 12457function toNumber(value) { 12458 if (typeof value == 'number') { 12459 return value; 12460 } 12461 if (isSymbol(value)) { 12462 return NAN; 12463 } 12464 if (isObject(value)) { 12465 var other = typeof value.valueOf == 'function' ? value.valueOf() : value; 12466 value = isObject(other) ? (other + '') : other; 12467 } 12468 if (typeof value != 'string') { 12469 return value === 0 ? value : +value; 12470 } 12471 value = baseTrim(value); 12472 var isBinary = reIsBinary.test(value); 12473 return (isBinary || reIsOctal.test(value)) 12474 ? freeParseInt(value.slice(2), isBinary ? 2 : 8) 12475 : (reIsBadHex.test(value) ? NAN : +value); 12476} 12477 12478module.exports = toNumber; 12479 12480 12481/***/ }), 12482 12483/***/ 291: 12484/***/ (function(module, exports, __webpack_require__) { 12485 12486var trimmedEndIndex = __webpack_require__(292); 12487 12488/** Used to match leading whitespace. */ 12489var reTrimStart = /^\s+/; 12490 12491/** 12492 * The base implementation of `_.trim`. 12493 * 12494 * @private 12495 * @param {string} string The string to trim. 12496 * @returns {string} Returns the trimmed string. 12497 */ 12498function baseTrim(string) { 12499 return string
vendor: 4,409 bytes, lines 12500-12701
12500 ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '') 12501 : string; 12502} 12503 12504module.exports = baseTrim; 12505 12506 12507/***/ }), 12508 12509/***/ 292: 12510/***/ (function(module, exports) { 12511 12512/** Used to match a single whitespace character. */ 12513var reWhitespace = /\s/; 12514 12515/** 12516 * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace 12517 * character of `string`. 12518 * 12519 * @private 12520 * @param {string} string The string to inspect. 12521 * @returns {number} Returns the index of the last non-whitespace character. 12522 */ 12523function trimmedEndIndex(string) { 12524 var index = string.length; 12525 12526 while (index-- && reWhitespace.test(string.charAt(index))) {} 12527 return index; 12528} 12529 12530module.exports = trimmedEndIndex; 12531 12532 12533/***/ }), 12534 12535/***/ 293: 12536/***/ (function(module, exports, __webpack_require__) { 12537 12538var baseGetTag = __webpack_require__(294), 12539 isObjectLike = __webpack_require__(298); 12540 12541/** `Object#toString` result references. */ 12542var symbolTag = '[object Symbol]'; 12543 12544/** 12545 * Checks if `value` is classified as a `Symbol` primitive or object. 12546 * 12547 * @static 12548 * @memberOf _ 12549 * @since 4.0.0 12550 * @category Lang 12551 * @param {*} value The value to check. 12552 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. 12553 * @example 12554 * 12555 * _.isSymbol(Symbol.iterator); 12556 * // => true 12557 * 12558 * _.isSymbol('abc'); 12559 * // => false 12560 */ 12561function isSymbol(value) { 12562 return typeof value == 'symbol' || 12563 (isObjectLike(value) && baseGetTag(value) == symbolTag); 12564} 12565 12566module.exports = isSymbol; 12567 12568 12569/***/ }), 12570 12571/***/ 294: 12572/***/ (function(module, exports, __webpack_require__) { 12573 12574var Symbol = __webpack_require__(295), 12575 getRawTag = __webpack_require__(296), 12576 objectToString = __webpack_require__(297); 12577 12578/** `Object#toString` result references. */ 12579var nullTag = '[object Null]', 12580 undefinedTag = '[object Undefined]'; 12581 12582/** Built-in value references. */ 12583var symToStringTag = Symbol ? Symbol.toStringTag : undefined; 12584 12585/** 12586 * The base implementation of `getTag` without fallbacks for buggy environments. 12587 * 12588 * @private 12589 * @param {*} value The value to query. 12590 * @returns {string} Returns the `toStringTag`. 12591 */ 12592function baseGetTag(value) { 12593 if (value == null) { 12594 return value === undefined ? undefinedTag : nullTag; 12595 } 12596 return (symToStringTag && symToStringTag in Object(value)) 12597 ? getRawTag(value) 12598 : objectToString(value); 12599} 12600 12601module.exports = baseGetTag; 12602 12603 12604/***/ }), 12605 12606/***/ 295: 12607/***/ (function(module, exports, __webpack_require__) { 12608 12609var root = __webpack_require__(288); 12610 12611/** Built-in value references. */ 12612var Symbol = root.Symbol; 12613 12614module.exports = Symbol; 12615 12616 12617/***/ }), 12618 12619/***/ 296: 12620/***/ (function(module, exports, __webpack_require__) { 12621 12622var Symbol = __webpack_require__(295); 12623 12624/** Used for built-in method references. */ 12625var objectProto = Object.prototype; 12626 12627/** Used to check objects for own properties. */ 12628var hasOwnProperty = objectProto.hasOwnProperty; 12629 12630/** 12631 * Used to resolve the 12632 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 12633 * of values. 12634 */ 12635var nativeObjectToString = objectProto.toString; 12636 12637/** Built-in value references. */ 12638var symToStringTag = Symbol ? Symbol.toStringTag : undefined; 12639 12640/** 12641 * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. 12642 * 12643 * @private 12644 * @param {*} value The value to query. 12645 * @returns {string} Returns the raw `toStringTag`. 12646 */ 12647function getRawTag(value) { 12648 var isOwn = hasOwnProperty.call(value, symToStringTag), 12649 tag = value[symToStringTag]; 12650 12651 try { 12652 value[symToStringTag] = undefined; 12653 var unmasked = true; 12654 } catch (e) {} 12655 12656 var result = nativeObjectToString.call(value); 12657 if (unmasked) { 12658 if (isOwn) { 12659 value[symToStringTag] = tag; 12660 } else { 12661 delete value[symToStringTag]; 12662 } 12663 } 12664 return result; 12665} 12666 12667module.exports = getRawTag; 12668 12669 12670/***/ }), 12671 12672/***/ 297: 12673/***/ (function(module, exports) { 12674 12675/** Used for built-in method references. */ 12676var objectProto = Object.prototype; 12677 12678/** 12679 * Used to resolve the 12680 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 12681 * of values. 12682 */ 12683var nativeObjectToString = objectProto.toString; 12684 12685/** 12686 * Converts `value` to a string using `Object.prototype.toString`. 12687 * 12688 * @private 12689 * @param {*} value The value to convert. 12690 * @returns {string} Returns the converted string. 12691 */ 12692function objectToString(value) { 12693 return nativeObjectToString.call(value); 12694} 12695 12696module.exports = objectToString; 12697 12698 12699/***/ }), 12700 12701/***/ 298:
12702/***/ (function(module, exports) { 12703 12704/** 12705 * Checks if `value` is object-like. A value is object-like if it's not `null` 12706 * and has a `typeof` result of "object". 12707 * 12708 * @static 12709 * @memberOf _ 12710 * @since 4.0.0 12711 * @category Lang 12712 * @param {*} value The value to check. 12713 * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 12714 * @example 12715 * 12716 * _.isObjectLike({}); 12717 * // => true 12718 * 12719 * _.isObjectLike([1, 2, 3]); 12720 * // => true 12721 * 12722 * _.isObjectLike(_.noop); 12723 * // => false 12724 * 12725 * _.isObjectLike(null); 12726 * // => false 12727 */ 12728function isObjectLike(value) { 12729 return value != null && typeof value == 'object'; 12730} 12731 12732module.exports = isObjectLike; 12733 12734 12735/***/ }), 12736 12737/***/ 299: 12738/***/ (function(module, exports, __webpack_require__) { 12739 12740"use strict"; 12741 12742 12743/** 12744 * Validate whole form. Requires `this` to be set to form object 12745 * @param {jQuery.event} event - Event to be canceled if form is invalid. 12746 * @returns {boolean} - Flag to indicate if form is valid 12747 */ 12748function validateForm(event) { 12749 var valid = true; 12750 if (this.checkValidity && !this.checkValidity()) { 12751 // safari 12752 valid = false; 12753 if (event) { 12754 event.preventDefault(); 12755 event.stopPropagation(); 12756 event.stopImmediatePropagation(); 12757 } 12758 $(this).find('input, select').each(function () { 12759 if (!this.validity.valid) { 12760 $(this).trigger('invalid', this.validity); 12761 } 12762 }); 12763 } 12764 return valid; 12765} 12766 12767/** 12768 * Remove all validation. Should be called every time before revalidating form 12769 * @param {element} form - Form to be cleared 12770 * @returns {void} 12771 */ 12772function clearForm(form) { 12773 $(form).find('.form-control.is-invalid').removeClass('is-invalid'); 12774} 12775 12776module.exports = { 12777 invalid: function () { 12778 $('form input, form select').on('invalid', function (e) { 12779 e.preventDefault(); 12780 this.setCustomValidity(''); 12781 if (!this.validity.valid) { 12782 var validationMessage = this.validationMessage; 12783 $(this).addClass('is-invalid'); 12784 if (this.validity.patternMismatch && $(this).data('pattern-mismatch')) { 12785 validationMessage = $(this).data('pattern-mismatch'); 12786 } 12787 if ((this.validity.rangeOverflow || this.validity.rangeUnderflow) 12788 && $(this).data('range-error')) { 12789 validationMessage = $(this).data('range-error'); 12790 } 12791 if ((this.validity.tooLong || this.validity.tooShort) 12792 && $(this).data('range-error')) { 12793 validationMessage = $(this).data('range-error'); 12794 } 12795 if (this.validity.valueMissing && $(this).data('missing-error')) { 12796 validationMessage = $(this).data('missing-error'); 12797 } 12798 $(this).parents('.form-group').find('.invalid-feedback') 12799 .text(validationMessage); 12800 } 12801 }); 12802 }, 12803 12804 submit: function () { 12805 $('form').on('submit', function (e) { 12806 return validateForm.call(this, e); 12807 }); 12808 }, 12809 12810 buttonClick: function () { 12811 $('form button[type="submit"], form input[type="submit"]').on('click', function () { 12812 // clear all errors when trying to submit the form 12813 clearForm($(this).parents('form')); 12814 }); 12815 }, 12816 12817 functions: { 12818 validateForm: function (form, event) { 12819 validateForm.call($(form), event || null); 12820 }, 12821 clearForm: clearForm 12822 } 12823}; 12824 12825 12826/***/ }), 12827 12828/***/ 3: 12829/***/ (function(module, exports, __webpack_require__) { 12830 12831"use strict"; 12832 12833 12834module.exports = function (include) { 12835 if (typeof include === 'function') { 12836 include(); 12837 } else if (typeof include === 'object') { 12838 Object.keys(include).forEach(function (key) { 12839 if (typeof include[key] === 'function') { 12840 include[key](); 12841 } 12842 }); 12843 } 12844}; 12845 12846 12847/***/ }), 12848 12849/***/ 300: 12850/***/ (function(module, exports, __webpack_require__) { 12851 12852__webpack_require__(301);
12853__webpack_require__(302); 12854// require('bootstrap/js/src/button.js'); 12855__webpack_require__(303); 12856__webpack_require__(304); 12857// require('bootstrap/js/src/dropdown.js'); 12858__webpack_require__(305); 12859__webpack_require__(306); 12860__webpack_require__(307); 12861// require('bootstrap/js/src/tooltip.js'); 12862// require('bootstrap/js/src/popover.js'); 12863 12864 12865/***/ }), 12866 12867/***/ 301: 12868/***/ (function(module, __webpack_exports__, __webpack_require__) { 12869 12870"use strict"; 12871__webpack_require__.r(__webpack_exports__); 12872/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(275); 12873/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 12874/** 12875 * -------------------------------------------------------------------------- 12876 * Bootstrap (v4.3.1): util.js 12877 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 12878 * -------------------------------------------------------------------------- 12879 */ 12880 12881 12882 12883/** 12884 * ------------------------------------------------------------------------ 12885 * Private TransitionEnd Helpers 12886 * ------------------------------------------------------------------------ 12887 */ 12888 12889const TRANSITION_END = 'transitionend' 12890const MAX_UID = 1000000 12891const MILLISECONDS_MULTIPLIER = 1000 12892 12893// Shoutout AngusCroll (https://goo.gl/pxwQGp) 12894function toType(obj) { 12895 return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase() 12896} 12897 12898function getSpecialTransitionEndEvent() { 12899 return { 12900 bindType: TRANSITION_END, 12901 delegateType: TRANSITION_END, 12902 handle(event) { 12903 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(event.target).is(this)) { 12904 return event.handleObj.handler.apply(this, arguments) // eslint-disable-line prefer-rest-params 12905 } 12906 return undefined // eslint-disable-line no-undefined 12907 } 12908 } 12909} 12910 12911function transitionEndEmulator(duration) { 12912 let called = false 12913 12914 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).one(Util.TRANSITION_END, () => { 12915 called = true 12916 }) 12917 12918 setTimeout(() => { 12919 if (!called) { 12920 Util.triggerTransitionEnd(this) 12921 } 12922 }, duration) 12923 12924 return this 12925} 12926 12927function setTransitionEndSupport() { 12928 jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.emulateTransitionEnd = transitionEndEmulator 12929 jquery__WEBPACK_IMPORTED_MODULE_0___default.a.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent() 12930} 12931 12932/** 12933 * -------------------------------------------------------------------------- 12934 * Public Util Api 12935 * -------------------------------------------------------------------------- 12936 */ 12937 12938const Util = { 12939 12940 TRANSITION_END: 'bsTransitionEnd', 12941 12942 getUID(prefix) { 12943 do { 12944 // eslint-disable-next-line no-bitwise 12945 prefix += ~~(Math.random() * MAX_UID) // "~~" acts like a faster Math.floor() here 12946 } while (document.getElementById(prefix)) 12947 return prefix 12948 }, 12949 12950 getSelectorFromElement(element) { 12951 let selector = element.getAttribute('data-target') 12952 12953 if (!selector || selector === '#') { 12954 const hrefAttr = element.getAttribute('href') 12955 selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : '' 12956 } 12957 12958 try { 12959 return document.querySelector(selector) ? selector : null 12960 } catch (err) { 12961 return null 12962 } 12963 }, 12964 12965 getTransitionDurationFromElement(element) { 12966 if (!element) { 12967 return 0 12968 } 12969 12970 // Get transition-duration of the element 12971 let transitionDuration = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).css('transition-duration') 12972 let transitionDelay = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).css('transition-delay') 12973 12974 const floatTransitionDuration = parseFloat(transitionDuration) 12975 const floatTransitionDelay = parseFloat(transitionDelay) 12976 12977 // Return 0 if element or transition duration is not found 12978 if (!floatTransitionDuration && !floatTransitionDelay) { 12979 return 0 12980 } 12981 12982 // If multiple durations are defined, take the first 12983 transitionDuration = transitionDuration.split(',')[0] 12984 transitionDelay = transitionDelay.split(',')[0] 12985 12986 return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER 12987 }, 12988 12989 reflow(element) { 12990 return element.offsetHeight 12991 }, 12992 12993 triggerTransitionEnd(element) { 12994 jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).trigger(TRANSITION_END) 12995 }, 12996 12997 // TODO: Remove in v5 12998 supportsTransitionEnd() { 12999 return Boolean(TRANSITION_END) 13000 }, 13001 13002 isElement(obj) { 13003 return (obj[0] || obj).nodeType 13004 }, 13005 13006 typeCheckConfig(componentName, config, configTypes) { 13007 for (const property in configTypes) { 13008 if (Object.prototype.hasOwnProperty.call(configTypes, property)) { 13009 const expectedTypes = configTypes[property] 13010 const value = config[property] 13011 const valueType = value && Util.isElement(value) 13012 ? 'element' : toType(value) 13013 13014 if (!new RegExp(expectedTypes).test(valueType)) { 13015 throw new Error( 13016 `${componentName.toUpperCase()}: ` + 13017 `Option "${property}" provided type "${valueType}" ` + 13018 `but expected type "${expectedTypes}".`) 13019 } 13020 } 13021 } 13022 }, 13023 13024 findShadowRoot(element) { 13025 if (!document.documentElement.attachShadow) { 13026 return null 13027 } 13028 13029 // Can find the shadow root otherwise it'll return the document 13030 if (typeof element.getRootNode === 'function') { 13031 const root = element.getRootNode() 13032 return root instanceof ShadowRoot ? root : null 13033 } 13034 13035 if (element instanceof ShadowRoot) { 13036 return element 13037 } 13038 13039 // when we don't find a shadow root 13040 if (!element.parentNode) { 13041 return null 13042 } 13043 13044 return Util.findShadowRoot(element.parentNode) 13045 } 13046} 13047 13048setTransitionEndSupport() 13049 13050/* harmony default export */ __webpack_exports__["default"] = (Util); 13051 13052 13053/***/ }), 13054 13055/***/ 302: 13056/***/ (function(module, __webpack_exports__, __webpack_require__) { 13057 13058"use strict"; 13059__webpack_require__.r(__webpack_exports__); 13060/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(275); 13061/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 13062/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(301); 13063/** 13064 * -------------------------------------------------------------------------- 13065 * Bootstrap (v4.3.1): alert.js 13066 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 13067 * -------------------------------------------------------------------------- 13068 */ 13069 13070 13071 13072 13073/** 13074 * ------------------------------------------------------------------------ 13075 * Constants 13076 * ------------------------------------------------------------------------ 13077 */ 13078 13079const NAME = 'alert' 13080const VERSION = '4.3.1' 13081const DATA_KEY = 'bs.alert' 13082const EVENT_KEY = `.${DATA_KEY}` 13083const DATA_API_KEY = '.data-api' 13084const JQUERY_NO_CONFLICT = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME] 13085 13086const Selector = { 13087 DISMISS : '[data-dismiss="alert"]' 13088} 13089 13090const Event = { 13091 CLOSE : `close${EVENT_KEY}`, 13092 CLOSED : `closed${EVENT_KEY}`, 13093 CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}` 13094} 13095 13096const ClassName = { 13097 ALERT : 'alert', 13098 FADE : 'fade', 13099 SHOW : 'show' 13100} 13101 13102/** 13103 * ------------------------------------------------------------------------ 13104 * Class Definition 13105 * ------------------------------------------------------------------------ 13106 */ 13107 13108class Alert {
13109 constructor(element) { 13110 this._element = element 13111 } 13112 13113 // Getters 13114 13115 static get VERSION() { 13116 return VERSION 13117 } 13118 13119 // Public 13120 13121 close(element) { 13122 let rootElement = this._element 13123 if (element) { 13124 rootElement = this._getRootElement(element) 13125 } 13126 13127 const customEvent = this._triggerCloseEvent(rootElement) 13128 13129 if (customEvent.isDefaultPrevented()) { 13130 return 13131 } 13132 13133 this._removeElement(rootElement) 13134 } 13135 13136 dispose() { 13137 jquery__WEBPACK_IMPORTED_MODULE_0___default.a.removeData(this._element, DATA_KEY) 13138 this._element = null 13139 } 13140 13141 // Private 13142 13143 _getRootElement(element) { 13144 const selector = _util__WEBPACK_IMPORTED_MODULE_1__["default"].getSelectorFromElement(element) 13145 let parent = false 13146 13147 if (selector) { 13148 parent = document.querySelector(selector) 13149 } 13150 13151 if (!parent) { 13152 parent = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).closest(`.${ClassName.ALERT}`)[0] 13153 } 13154 13155 return parent 13156 } 13157 13158 _triggerCloseEvent(element) { 13159 const closeEvent = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Event(Event.CLOSE) 13160 13161 jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).trigger(closeEvent) 13162 return closeEvent 13163 } 13164 13165 _removeElement(element) { 13166 jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).removeClass(ClassName.SHOW) 13167 13168 if (!jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).hasClass(ClassName.FADE)) { 13169 this._destroyElement(element) 13170 return 13171 } 13172 13173 const transitionDuration = _util__WEBPACK_IMPORTED_MODULE_1__["default"].getTransitionDurationFromElement(element) 13174 13175 jquery__WEBPACK_IMPORTED_MODULE_0___default()(element) 13176 .one(_util__WEBPACK_IMPORTED_MODULE_1__["default"].TRANSITION_END, (event) => this._destroyElement(element, event)) 13177 .emulateTransitionEnd(transitionDuration) 13178 } 13179 13180 _destroyElement(element) { 13181 jquery__WEBPACK_IMPORTED_MODULE_0___default()(element) 13182 .detach() 13183 .trigger(Event.CLOSED) 13184 .remove() 13185 } 13186 13187 // Static 13188 13189 static _jQueryInterface(config) { 13190 return this.each(function () { 13191 const $element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this) 13192 let data = $element.data(DATA_KEY) 13193 13194 if (!data) { 13195 data = new Alert(this) 13196 $element.data(DATA_KEY, data) 13197 } 13198 13199 if (config === 'close') { 13200 data[config](this) 13201 } 13202 }) 13203 } 13204 13205 static _handleDismiss(alertInstance) { 13206 return function (event) { 13207 if (event) { 13208 event.preventDefault() 13209 } 13210 13211 alertInstance.close(this) 13212 } 13213 } 13214} 13215 13216/** 13217 * ------------------------------------------------------------------------ 13218 * Data Api implementation 13219 * ------------------------------------------------------------------------ 13220 */ 13221 13222jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).on( 13223 Event.CLICK_DATA_API, 13224 Selector.DISMISS, 13225 Alert._handleDismiss(new Alert()) 13226) 13227 13228/** 13229 * ------------------------------------------------------------------------ 13230 * jQuery 13231 * ------------------------------------------------------------------------ 13232 */ 13233 13234jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME] = Alert._jQueryInterface 13235jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME].Constructor = Alert 13236jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME].noConflict = () => { 13237 jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME] = JQUERY_NO_CONFLICT 13238 return Alert._jQueryInterface 13239} 13240 13241/* harmony default export */ __webpack_exports__["default"] = (Alert); 13242 13243 13244/***/ }), 13245 13246/***/ 303: 13247/***/ (function(module, __webpack_exports__, __webpack_require__) { 13248 13249"use strict"; 13250__webpack_require__.r(__webpack_exports__); 13251/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(275); 13252/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 13253/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(301); 13254/** 13255 * -------------------------------------------------------------------------- 13256 * Bootstrap (v4.3.1): carousel.js 13257 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 13258 * -------------------------------------------------------------------------- 13259 */ 13260 13261 13262 13263 13264/** 13265 * ------------------------------------------------------------------------ 13266 * Constants 13267 * ------------------------------------------------------------------------ 13268 */ 13269 13270const NAME = 'carousel' 13271const VERSION = '4.3.1' 13272const DATA_KEY = 'bs.carousel' 13273const EVENT_KEY = `.${DATA_KEY}` 13274const DATA_API_KEY = '.data-api' 13275const JQUERY_NO_CONFLICT = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME] 13276const ARROW_LEFT_KEYCODE = 37 // KeyboardEvent.which value for left arrow key 13277const ARROW_RIGHT_KEYCODE = 39 // KeyboardEvent.which value for right arrow key 13278const TOUCHEVENT_COMPAT_WAIT = 500 // Time for mouse compat events to fire after touch 13279const SWIPE_THRESHOLD = 40 13280 13281const Default = { 13282 interval : 5000, 13283 keyboard : true, 13284 slide : false, 13285 pause : 'hover', 13286 wrap : true, 13287 touch : true 13288} 13289 13290const DefaultType = { 13291 interval : '(number|boolean)', 13292 keyboard : 'boolean', 13293 slide : '(boolean|string)', 13294 pause : '(string|boolean)', 13295 wrap : 'boolean', 13296 touch : 'boolean' 13297} 13298 13299const Direction = { 13300 NEXT : 'next', 13301 PREV : 'prev', 13302 LEFT : 'left', 13303 RIGHT : 'right' 13304} 13305 13306const Event = { 13307 SLIDE : `slide${EVENT_KEY}`, 13308 SLID : `slid${EVENT_KEY}`, 13309 KEYDOWN : `keydown${EVENT_KEY}`, 13310 MOUSEENTER : `mouseenter${EVENT_KEY}`, 13311 MOUSELEAVE : `mouseleave${EVENT_KEY}`, 13312 TOUCHSTART : `touchstart${EVENT_KEY}`, 13313 TOUCHMOVE : `touchmove${EVENT_KEY}`, 13314 TOUCHEND : `touchend${EVENT_KEY}`, 13315 POINTERDOWN : `pointerdown${EVENT_KEY}`, 13316 POINTERUP : `pointerup${EVENT_KEY}`, 13317 DRAG_START : `dragstart${EVENT_KEY}`, 13318 LOAD_DATA_API : `load${EVENT_KEY}${DATA_API_KEY}`, 13319 CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}` 13320} 13321 13322const ClassName = { 13323 CAROUSEL : 'carousel', 13324 ACTIVE : 'active', 13325 SLIDE : 'slide', 13326 RIGHT : 'carousel-item-right', 13327 LEFT : 'carousel-item-left', 13328 NEXT : 'carousel-item-next', 13329 PREV : 'carousel-item-prev', 13330 ITEM : 'carousel-item', 13331 POINTER_EVENT : 'pointer-event' 13332} 13333 13334const Selector = { 13335 ACTIVE : '.active', 13336 ACTIVE_ITEM : '.active.carousel-item', 13337 ITEM : '.carousel-item', 13338 ITEM_IMG : '.carousel-item img', 13339 NEXT_PREV : '.carousel-item-next, .carousel-item-prev', 13340 INDICATORS : '.carousel-indicators',
13341 DATA_SLIDE : '[data-slide], [data-slide-to]', 13342 DATA_RIDE : '[data-ride="carousel"]' 13343} 13344 13345const PointerType = { 13346 TOUCH : 'touch', 13347 PEN : 'pen' 13348} 13349 13350/** 13351 * ------------------------------------------------------------------------ 13352 * Class Definition 13353 * ------------------------------------------------------------------------ 13354 */ 13355class Carousel { 13356 constructor(element, config) { 13357 this._items = null 13358 this._interval = null 13359 this._activeElement = null 13360 this._isPaused = false 13361 this._isSliding = false 13362 this.touchTimeout = null 13363 this.touchStartX = 0 13364 this.touchDeltaX = 0 13365 13366 this._config = this._getConfig(config) 13367 this._element = element 13368 this._indicatorsElement = this._element.querySelector(Selector.INDICATORS) 13369 this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0 13370 this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent) 13371 13372 this._addEventListeners() 13373 } 13374 13375 // Getters 13376 13377 static get VERSION() { 13378 return VERSION 13379 } 13380 13381 static get Default() { 13382 return Default 13383 } 13384 13385 // Public 13386 13387 next() { 13388 if (!this._isSliding) { 13389 this._slide(Direction.NEXT) 13390 } 13391 } 13392 13393 nextWhenVisible() { 13394 // Don't call next when the page isn't visible 13395 // or the carousel or its parent isn't visible 13396 if (!document.hidden && 13397 (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).is(':visible') && jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).css('visibility') !== 'hidden')) { 13398 this.next() 13399 } 13400 } 13401 13402 prev() { 13403 if (!this._isSliding) { 13404 this._slide(Direction.PREV) 13405 } 13406 } 13407 13408 pause(event) { 13409 if (!event) { 13410 this._isPaused = true 13411 } 13412 13413 if (this._element.querySelector(Selector.NEXT_PREV)) { 13414 _util__WEBPACK_IMPORTED_MODULE_1__["default"].triggerTransitionEnd(this._element) 13415 this.cycle(true) 13416 } 13417 13418 clearInterval(this._interval) 13419 this._interval = null 13420 } 13421 13422 cycle(event) { 13423 if (!event) { 13424 this._isPaused = false 13425 } 13426 13427 if (this._interval) { 13428 clearInterval(this._interval) 13429 this._interval = null 13430 } 13431 13432 if (this._config.interval && !this._isPaused) { 13433 this._interval = setInterval( 13434 (document.visibilityState ? this.nextWhenVisible : this.next).bind(this), 13435 this._config.interval 13436 ) 13437 } 13438 } 13439 13440 to(index) { 13441 this._activeElement = this._element.querySelector(Selector.ACTIVE_ITEM) 13442 13443 const activeIndex = this._getItemIndex(this._activeElement) 13444 13445 if (index > this._items.length - 1 || index < 0) { 13446 return 13447 } 13448 13449 if (this._isSliding) { 13450 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).one(Event.SLID, () => this.to(index)) 13451 return 13452 } 13453 13454 if (activeIndex === index) { 13455 this.pause() 13456 this.cycle() 13457 return 13458 } 13459 13460 const direction = index > activeIndex 13461 ? Direction.NEXT 13462 : Direction.PREV 13463 13464 this._slide(direction, this._items[index]) 13465 } 13466 13467 dispose() { 13468 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).off(EVENT_KEY) 13469 jquery__WEBPACK_IMPORTED_MODULE_0___default.a.removeData(this._element, DATA_KEY) 13470 13471 this._items = null 13472 this._config = null 13473 this._element = null 13474 this._interval = null 13475 this._isPaused = null 13476 this._isSliding = null 13477 this._activeElement = null 13478 this._indicatorsElement = null 13479 } 13480 13481 // Private 13482 13483 _getConfig(config) { 13484 config = { 13485 ...Default, 13486 ...config 13487 } 13488 _util__WEBPACK_IMPORTED_MODULE_1__["default"].typeCheckConfig(NAME, config, DefaultType) 13489 return config 13490 } 13491 13492 _handleSwipe() { 13493 const absDeltax = Math.abs(this.touchDeltaX) 13494 13495 if (absDeltax <= SWIPE_THRESHOLD) { 13496 return 13497 } 13498 13499 const direction = absDeltax / this.touchDeltaX 13500 13501 // swipe left 13502 if (direction > 0) { 13503 this.prev() 13504 } 13505 13506 // swipe right 13507 if (direction < 0) { 13508 this.next() 13509 } 13510 } 13511 13512 _addEventListeners() { 13513 if (this._config.keyboard) { 13514 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element) 13515 .on(Event.KEYDOWN, (event) =>
13515 this._keydown(event)) 13516 } 13517 13518 if (this._config.pause === 'hover') { 13519 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element) 13520 .on(Event.MOUSEENTER, (event) => this.pause(event)) 13521 .on(Event.MOUSELEAVE, (event) => this.cycle(event)) 13522 } 13523 13524 if (this._config.touch) { 13525 this._addTouchEventListeners() 13526 } 13527 } 13528 13529 _addTouchEventListeners() { 13530 if (!this._touchSupported) { 13531 return 13532 } 13533 13534 const start = (event) => { 13535 if (this._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 13536 this.touchStartX = event.originalEvent.clientX 13537 } else if (!this._pointerEvent) { 13538 this.touchStartX = event.originalEvent.touches[0].clientX 13539 } 13540 } 13541 13542 const move = (event) => { 13543 // ensure swiping with one touch and not pinching 13544 if (event.originalEvent.touches && event.originalEvent.touches.length > 1) { 13545 this.touchDeltaX = 0 13546 } else { 13547 this.touchDeltaX = event.originalEvent.touches[0].clientX - this.touchStartX 13548 } 13549 } 13550 13551 const end = (event) => { 13552 if (this._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) { 13553 this.touchDeltaX = event.originalEvent.clientX - this.touchStartX 13554 } 13555 13556 this._handleSwipe() 13557 if (this._config.pause === 'hover') { 13558 // If it's a touch-enabled device, mouseenter/leave are fired as 13559 // part of the mouse compatibility events on first tap - the carousel 13560 // would stop cycling until user tapped out of it; 13561 // here, we listen for touchend, explicitly pause the carousel 13562 // (as if it's the second time we tap on it, mouseenter compat event 13563 // is NOT fired) and after a timeout (to allow for mouse compatibility 13564 // events to fire) we explicitly restart cycling 13565 13566 this.pause() 13567 if (this.touchTimeout) { 13568 clearTimeout(this.touchTimeout) 13569 } 13570 this.touchTimeout = setTimeout((event) => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval) 13571 } 13572 } 13573 13574 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element.querySelectorAll(Selector.ITEM_IMG)).on(Event.DRAG_START, (e) => e.preventDefault()) 13575 if (this._pointerEvent) { 13576 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).on(Event.POINTERDOWN, (event) => start(event)) 13577 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).on(Event.POINTERUP, (event) => end(event)) 13578 13579 this._element.classList.add(ClassName.POINTER_EVENT) 13580 } else { 13581 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).on(Event.TOUCHSTART, (event) => start(event)) 13582 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).on(Event.TOUCHMOVE, (event) => move(event)) 13583 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).on(Event.TOUCHEND, (event) => end(event)) 13584 } 13585 } 13586 13587 _keydown(event) { 13588 if (/input|textarea/i.test(event.target.tagName)) { 13589 return 13590 } 13591 13592 switch (event.which) { 13593 case ARROW_LEFT_KEYCODE: 13594 event.preventDefault() 13595 this.prev() 13596 break 13597 case ARROW_RIGHT_KEYCODE: 13598 event.preventDefault() 13599 this.next() 13600 break 13601 default: 13602 } 13603 } 13604 13605 _getItemIndex(element) { 13606 this._items = element && element.parentNode 13607 ? [].slice.call(element.parentNode.querySelectorAll(Selector.ITEM)) 13608 : [] 13609 return this._items.indexOf(element) 13610 } 13611 13612 _getItemByDirection(direction, activeElement) { 13613 const isNextDirection = direction === Direction.NEXT 13614 const isPrevDirection = direction === Direction.PREV 13615 const activeIndex = this._getItemIndex(activeElement) 13616 const lastItemIndex = this._items.length - 1 13617 const isGoingToWrap = isPrevDirection && activeIndex === 0 || 13618 isNextDirection && activeIndex === lastItemIndex 13619 13620 if (isGoingToWrap && !this._config.wrap) { 13621 return activeElement 13622 } 13623 13624 const delta = direction === Direction.PREV ? -1 : 1 13625 const itemIndex = (activeIndex + delta) % this._items.length 13626 13627 return itemIndex === -1 13628 ? this._items[this._items.length - 1] : this._items[itemIndex] 13629 } 13630 13631 _triggerSlideEvent(relatedTarget, eventDirectionName) { 13632 const targetIndex = this._getItemIndex(relatedTarget) 13633 const fromIndex = this._getItemIndex(this._element.querySelector(Selector.ACTIVE_ITEM)) 13634 const slideEvent = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Event(Event.SLIDE, { 13635 relatedTarget, 13636 direction: eventDirectionName, 13637 from: fromIndex, 13638 to: targetIndex 13639 }) 13640 13641 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).trigger(slideEvent) 13642 13643 return slideEvent 13644 } 13645 13646 _setActiveIndicatorElement(element) { 13647 if (this._indicatorsElement) { 13648 const indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector.ACTIVE)) 13649 jquery__WEBPACK_IMPORTED_MODULE_0___default()(indicators) 13650 .removeClass(ClassName.ACTIVE) 13651 13652 const nextIndicator = this._indicatorsElement.children[ 13653 this._getItemIndex(element) 13654 ] 13655 13656 if (nextIndicator) { 13657 jquery__WEBPACK_IMPORTED_MODULE_0___default()(nextIndicator).addClass(ClassName.ACTIVE) 13658 } 13659 } 13660 } 13661 13662 _slide(direction, element) { 13663 const activeElement = this._element.querySelector(Selector.ACTIVE_ITEM) 13664 const activeElementIndex = this._getItemIndex(activeElement) 13665 const nextElement = element || activeElement && 13666 this._getItemByDirection(direction, activeElement) 13667 const nextElementIndex = this._getItemIndex(nextElement) 13668 const isCycling = Boolean(this._interval) 13669 13670 let directionalClassName 13671 let orderClassName 13672 let eventDirectionName 13673 13674 if (direction === Direction.NEXT) { 13675 directionalClassName = ClassName.LEFT 13676 orderClassName = ClassName.NEXT 13677 eventDirectionName = Direction.LEFT 13678 } else { 13679 directionalClassName = ClassName.RIGHT 13680 orderClassName = ClassName.PREV 13681 eventDirectionName = Direction.RIGHT 13682 } 13683 13684 if (nextElement && jquery__WEBPACK_IMPORTED_MODULE_0___default()(nextElement).hasClass(ClassName.ACTIVE)) { 13685 this._isSliding = false 13686 return 13687 } 13688 13689 const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName) 13690 if (slideEvent.isDefaultPrevented()) { 13691 return 13692 } 13693 13694 if (!activeElement || !nextElement) { 13695 // Some weirdness is happening, so we bail 13696 return 13697 } 13698 13699 this._isSliding = true 13700 13701 if (isCycling) { 13702 this.pause() 13703 } 13704 13705 this._setActiveIndicatorElement(nextElement) 13706 13707 const slidEvent = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Event(Event.SLID, { 13708 relatedTarget: nextElement, 13709 direction: eventDirectionName, 13710 from: activeElementIndex, 13711 to: nextElementIndex 13712 }) 13713 13714 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).hasClass(ClassName.SLIDE)) { 13715 jquery__WEBPACK_IMPORTED_MODULE_0___default()(nextElement).addClass(orderClassName) 13716 13717 _util__WEBPACK_IMPORTED_MODULE_1__["default"].reflow(nextElement) 13718 13719 jquery__WEBPACK_IMPORTED_MODULE_0___default()(activeElement).addClass(directionalClassName) 13720 jquery__WEBPACK_IMPORTED_MODULE_0___default()(nextElement).addClass(directionalClassName) 13721 13722 const nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10) 13723 if (nextElementInterval) { 13724 this._config.defaultInterval = this._config.defaultInterval || this._config.interval 13725 this._config.interval = nextElementInterval 13726 } else { 13727 this._config.interval = this._config.defaultInterval || this._config.interval 13728 } 13729 13730 const transitionDuration = _util__WEBPACK_IMPORTED_MODULE_1__["default"].getTransitionDurationFromElement(activeElement) 13731 13732 jquery__WEBPACK_IMPORTED_MODULE_0___default()(activeElement) 13733 .one(_util__WEBPACK_IMPORTED_MODULE_1__["default"].TRANSITION_END, () => { 13734 jquery__WEBPACK_IMPORTED_MODULE_0___default()(nextElement) 13735 .removeClass(`${directionalClassName} ${orderClassName}`) 13736 .addClass(ClassName.ACTIVE) 13737 13738 jquery__WEBPACK_IMPORTED_MODULE_0___default()(activeElement).removeClass(`${ClassName.ACTIVE} ${orderClassName} ${directionalClassName}`) 13739 13740 this._isSliding = false 13741 13742 setTimeout(() => jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).trigger(slidEvent), 0) 13743 }) 13744 .emulateTransitionEnd(transitionDuration) 13745 } else { 13746 jquery__WEBPACK_IMPORTED_MODULE_0___default()(activeElement).removeClass(ClassName.ACTIVE) 13747 jquery__WEBPACK_IMPORTED_MODULE_0___default()(nextElement).addClass(ClassName.ACTIVE) 13748 13749 this._isSliding = false 13750 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).trigger(slidEvent) 13751 } 13752 13753 if (isCycling) { 13754 this.cycle() 13755 } 13756 } 13757 13758 // Static 13759 13760 static _jQueryInterface(config) { 13761 return this.each(function () { 13762 let data = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data(DATA_KEY) 13763 let _config = { 13764 ...Default, 13765 ...jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data() 13766 } 13767 13768 if (typeof config === 'object') { 13769 _config = { 13770 ..._config, 13771 ...config 13772 } 13773 } 13774 13775 const action = typeof config === 'string' ? config : _config.slide 13776 13777 if (!data) { 13778 data = new Carousel(this, _config) 13779 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data(DATA_KEY, data) 13780 } 13781 13782 if (typeof config === 'number') { 13783 data.to(config) 13784 } else if (typeof action === 'string') { 13785 if (typeof data[action] === 'undefined') {
13786 throw new TypeError(`No method named "${action}"`) 13787 } 13788 data[action]() 13789 } else if (_config.interval && _config.ride) { 13790 data.pause() 13791 data.cycle() 13792 } 13793 }) 13794 } 13795 13796 static _dataApiClickHandler(event) { 13797 const selector = _util__WEBPACK_IMPORTED_MODULE_1__["default"].getSelectorFromElement(this) 13798 13799 if (!selector) { 13800 return 13801 } 13802 13803 const target = jquery__WEBPACK_IMPORTED_MODULE_0___default()(selector)[0] 13804 13805 if (!target || !jquery__WEBPACK_IMPORTED_MODULE_0___default()(target).hasClass(ClassName.CAROUSEL)) { 13806 return 13807 } 13808 13809 const config = { 13810 ...jquery__WEBPACK_IMPORTED_MODULE_0___default()(target).data(), 13811 ...jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data() 13812 } 13813 const slideIndex = this.getAttribute('data-slide-to') 13814 13815 if (slideIndex) { 13816 config.interval = false 13817 } 13818 13819 Carousel._jQueryInterface.call(jquery__WEBPACK_IMPORTED_MODULE_0___default()(target), config) 13820 13821 if (slideIndex) { 13822 jquery__WEBPACK_IMPORTED_MODULE_0___default()(target).data(DATA_KEY).to(slideIndex) 13823 } 13824 13825 event.preventDefault() 13826 } 13827} 13828 13829/** 13830 * ------------------------------------------------------------------------ 13831 * Data Api implementation 13832 * ------------------------------------------------------------------------ 13833 */ 13834 13835jquery__WEBPACK_IMPORTED_MODULE_0___default()(document) 13836 .on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler) 13837 13838jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).on(Event.LOAD_DATA_API, () => { 13839 const carousels = [].slice.call(document.querySelectorAll(Selector.DATA_RIDE)) 13840 for (let i = 0, len = carousels.length; i < len; i++) { 13841 const $carousel = jquery__WEBPACK_IMPORTED_MODULE_0___default()(carousels[i]) 13842 Carousel._jQueryInterface.call($carousel, $carousel.data()) 13843 } 13844}) 13845 13846/** 13847 * ------------------------------------------------------------------------ 13848 * jQuery 13849 * ------------------------------------------------------------------------ 13850 */ 13851 13852jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME] = Carousel._jQueryInterface 13853jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME].Constructor = Carousel 13854jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME].noConflict = () => { 13855 jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME] = JQUERY_NO_CONFLICT 13856 return Carousel._jQueryInterface 13857} 13858 13859/* harmony default export */ __webpack_exports__["default"] = (Carousel); 13860 13861 13862/***/ }), 13863 13864/***/ 304: 13865/***/ (function(module, __webpack_exports__, __webpack_require__) { 13866 13867"use strict"; 13868__webpack_require__.r(__webpack_exports__); 13869/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(275); 13870/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 13871/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(301); 13872/** 13873 * -------------------------------------------------------------------------- 13874 * Bootstrap (v4.3.1): collapse.js 13875 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 13876 * -------------------------------------------------------------------------- 13877 */ 13878 13879 13880 13881 13882/** 13883 * ------------------------------------------------------------------------ 13884 * Constants 13885 * ------------------------------------------------------------------------ 13886 */ 13887 13888const NAME = 'collapse' 13889const VERSION = '4.3.1' 13890const DATA_KEY = 'bs.collapse' 13891const EVENT_KEY = `.${DATA_KEY}` 13892const DATA_API_KEY = '.data-api' 13893const JQUERY_NO_CONFLICT = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME] 13894 13895const Default = { 13896 toggle : true, 13897 parent : '' 13898} 13899 13900const DefaultType = { 13901 toggle : 'boolean', 13902 parent : '(string|element)' 13903} 13904 13905const Event = { 13906 SHOW : `show${EVENT_KEY}`, 13907 SHOWN : `shown${EVENT_KEY}`, 13908 HIDE : `hide${EVENT_KEY}`, 13909 HIDDEN : `hidden${EVENT_KEY}`, 13910 CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}` 13911} 13912 13913const ClassName = { 13914 SHOW : 'show', 13915 COLLAPSE : 'collapse', 13916 COLLAPSING : 'collapsing', 13917 COLLAPSED : 'collapsed' 13918} 13919 13920const Dimension = { 13921 WIDTH : 'width', 13922 HEIGHT : 'height' 13923} 13924 13925const Selector = { 13926 ACTIVES : '.show, .collapsing', 13927 DATA_TOGGLE : '[data-toggle="collapse"]' 13928} 13929 13930/** 13931 * ------------------------------------------------------------------------ 13932 * Class Definition 13933 * ------------------------------------------------------------------------ 13934 */ 13935 13936class Collapse {
13937 constructor(element, config) { 13938 this._isTransitioning = false 13939 this._element = element 13940 this._config = this._getConfig(config) 13941 this._triggerArray = [].slice.call(document.querySelectorAll( 13942 `[data-toggle="collapse"][href="#${element.id}"],` + 13943 `[data-toggle="collapse"][data-target="#${element.id}"]` 13944 )) 13945 13946 const toggleList = [].slice.call(document.querySelectorAll(Selector.DATA_TOGGLE)) 13947 for (let i = 0, len = toggleList.length; i < len; i++) { 13948 const elem = toggleList[i] 13949 const selector = _util__WEBPACK_IMPORTED_MODULE_1__["default"].getSelectorFromElement(elem) 13950 const filterElement = [].slice.call(document.querySelectorAll(selector)) 13951 .filter((foundElem) => foundElem === element) 13952 13953 if (selector !== null && filterElement.length > 0) { 13954 this._selector = selector 13955 this._triggerArray.push(elem) 13956 } 13957 } 13958 13959 this._parent = this._config.parent ? this._getParent() : null 13960 13961 if (!this._config.parent) { 13962 this._addAriaAndCollapsedClass(this._element, this._triggerArray) 13963 } 13964 13965 if (this._config.toggle) { 13966 this.toggle() 13967 } 13968 } 13969 13970 // Getters 13971 13972 static get VERSION() { 13973 return VERSION 13974 } 13975 13976 static get Default() { 13977 return Default 13978 } 13979 13980 // Public 13981 13982 toggle() { 13983 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).hasClass(ClassName.SHOW)) { 13984 this.hide() 13985 } else { 13986 this.show() 13987 } 13988 } 13989 13990 show() { 13991 if (this._isTransitioning || 13992 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).hasClass(ClassName.SHOW)) { 13993 return 13994 } 13995 13996 let actives 13997 let activesData 13998 13999 if (this._parent) { 14000 actives = [].slice.call(this._parent.querySelectorAll(Selector.ACTIVES)) 14001 .filter((elem) => { 14002 if (typeof this._config.parent === 'string') { 14003 return elem.getAttribute('data-parent') === this._config.parent 14004 } 14005 14006 return elem.classList.contains(ClassName.COLLAPSE) 14007 }) 14008 14009 if (actives.length === 0) { 14010 actives = null 14011 } 14012 } 14013 14014 if (actives) { 14015 activesData = jquery__WEBPACK_IMPORTED_MODULE_0___default()(actives).not(this._selector).data(DATA_KEY) 14016 if (activesData && activesData._isTransitioning) { 14017 return 14018 } 14019 } 14020 14021 const startEvent = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Event(Event.SHOW) 14022 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).trigger(startEvent) 14023 if (startEvent.isDefaultPrevented()) { 14024 return 14025 } 14026 14027 if (actives) { 14028 Collapse._jQueryInterface.call(jquery__WEBPACK_IMPORTED_MODULE_0___default()(actives).not(this._selector), 'hide') 14029 if (!activesData) { 14030 jquery__WEBPACK_IMPORTED_MODULE_0___default()(actives).data(DATA_KEY, null) 14031 } 14032 } 14033 14034 const dimension = this._getDimension() 14035 14036 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element) 14037 .removeClass(ClassName.COLLAPSE) 14038 .addClass(ClassName.COLLAPSING) 14039 14040 this._element.style[dimension] = 0 14041 14042 if (this._triggerArray.length) { 14043 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._triggerArray) 14044 .removeClass(ClassName.COLLAPSED) 14045 .attr('aria-expanded', true) 14046 } 14047 14048 this.setTransitioning(true) 14049 14050 const complete = () => { 14051 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element) 14052 .removeClass(ClassName.COLLAPSING) 14053 .addClass(ClassName.COLLAPSE) 14054 .addClass(ClassName.SHOW) 14055 14056 this._element.style[dimension] = '' 14057 14058 this.setTransitioning(false) 14059 14060 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).trigger(Event.SHOWN) 14061 } 14062 14063 const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1) 14064 const scrollSize = `scroll${capitalizedDimension}` 14065 const transitionDuration = _util__WEBPACK_IMPORTED_MODULE_1__["default"].getTransitionDurationFromElement(this._element) 14066 14067 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element) 14068 .one(_util__WEBPACK_IMPORTED_MODULE_1__["default"].TRANSITION_END, complete) 14069 .emulateTransitionEnd(transitionDuration) 14070 14071 this._element.style[dimension] = `${this._element[scrollSize]}px` 14072 } 14073 14074 hide() { 14075 if (this._isTransitioning || 14076 !jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).hasClass(ClassName.SHOW)) { 14077 return 14078 } 14079 14080 const startEvent = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Event(Event.HIDE) 14081 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).trigger(startEvent) 14082 if (startEvent.isDefaultPrevented()) { 14083 return 14084 } 14085 14086 const dimension = this._getDimension() 14087 14088 this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px` 14089 14090 _util__WEBPACK_IMPORTED_MODULE_1__["default"].reflow(this._element) 14091 14092 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element) 14093 .addClass(ClassName.COLLAPSING) 14094 .removeClass(ClassName.COLLAPSE) 14095 .removeClass(ClassName.SHOW) 14096 14097 const triggerArrayLength = this._triggerArray.length 14098 if (triggerArrayLength > 0) { 14099 for (let i = 0; i < triggerArrayLength; i++) { 14100 const trigger = this._triggerArray[i] 14101 const selector = _util__WEBPACK_IMPORTED_MODULE_1__["default"].getSelectorFromElement(trigger) 14102 14103 if (selector !== null) { 14104 const $elem = jquery__WEBPACK_IMPORTED_MODULE_0___default()([].slice.call(document.querySelectorAll(selector))) 14105 if (!$elem.hasClass(ClassName.SHOW)) { 14106 jquery__WEBPACK_IMPORTED_MODULE_0___default()(trigger).addClass(ClassName.COLLAPSED) 14107 .attr('aria-expanded', false) 14108 } 14109 } 14110 } 14111 } 14112 14113 this.setTransitioning(true) 14114 14115 const complete = () => { 14116 this.setTransitioning(false) 14117 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element) 14118 .removeClass(ClassName.COLLAPSING) 14119 .addClass(ClassName.COLLAPSE) 14120 .trigger(Event.HIDDEN) 14121 } 14122 14123 this._element.style[dimension] = '' 14124 const transitionDuration = _util__WEBPACK_IMPORTED_MODULE_1__["default"].getTransitionDurationFromElement(this._element) 14125 14126 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element) 14127 .one(_util__WEBPACK_IMPORTED_MODULE_1__["default"].TRANSITION_END, complete) 14128 .emulateTransitionEnd(transitionDuration) 14129 } 14130 14131 setTransitioning(isTransitioning) { 14132 this._isTransitioning = isTransitioning 14133 } 14134 14135 dispose() { 14136 jquery__WEBPACK_IMPORTED_MODULE_0___default.a.removeData(this._element, DATA_KEY) 14137 14138 this._config = null 14139 this._parent = null 14140 this._element = null 14141 this._triggerArray = null 14142 this._isTransitioning = null 14143 } 14144 14145 // Private 14146 14147 _getConfig(config) { 14148 config = { 14149 ...Default, 14150 ...config 14151 } 14152 config.toggle = Boolean(config.toggle) // Coerce string values 14153 _util__WEBPACK_IMPORTED_MODULE_1__["default"].typeCheckConfig(NAME, config, DefaultType) 14154 return config 14155 } 14156 14157 _getDimension() { 14158 const hasWidth = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).hasClass(Dimension.WIDTH) 14159 return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT 14160 } 14161 14162 _getParent() { 14163 let parent 14164 14165 if (_util__WEBPACK_IMPORTED_MODULE_1__["default"].isElement(this._config.parent)) { 14166 parent = this._config.parent 14167 14168 // It's a jQuery object 14169 if (typeof this._config.parent.jquery !== 'undefined') { 14170 parent = this._config.parent[0] 14171 } 14172 } else { 14173 parent = document.querySelector(this._config.parent) 14174 } 14175 14176 const selector = 14177 `[data-toggle="collapse"][data-parent="${this._config.parent}"]` 14178 14179 const children = [].slice.call(parent.querySelectorAll(selector)) 14180 jquery__WEBPACK_IMPORTED_MODULE_0___default()(children).each((i, element) => { 14181 this._addAriaAndCollapsedClass( 14182 Collapse._getTargetFromElement(element), 14183 [element] 14184 ) 14185 }) 14186 14187 return parent 14188 } 14189 14190 _addAriaAndCollapsedClass(element, triggerArray) { 14191 const isOpen = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).hasClass(ClassName.SHOW) 14192 14193 if (triggerArray.length) { 14194 jquery__WEBPACK_IMPORTED_MODULE_0___default()(triggerArray) 14195 .toggleClass(ClassName.COLLAPSED, !isOpen) 14196 .attr('aria-expanded', isOpen) 14197 } 14198 } 14199 14200 // Static 14201 14202 static _getTargetFromElement(element) { 14203 const selector = _util__WEBPACK_IMPORTED_MODULE_1__["default"].getSelectorFromElement(element) 14204 return selector ? document.querySelector(selector) : null 14205 } 14206 14207 static _jQueryInterface(config) { 14208 return this.each(function () { 14209 const $this = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this) 14210 let data = $this.data(DATA_KEY) 14211 const _config = { 14212 ...Default, 14213 ...$this.data(), 14214 ...typeof config === 'object' && config ? config : {} 14215 } 14216 14217 if (!data && _config.toggle && /show|hide/.test(config)) { 14218 _config.toggle = false 14219 } 14220 14221 if (!data) { 14222 data = new Collapse(this, _config) 14223 $this.data(DATA_KEY, data) 14224 } 14225 14226 if (typeof config === 'string') { 14227 if (typeof data[config] === 'undefined') {
14228 throw new TypeError(`No method named "${config}"`) 14229 } 14230 data[config]() 14231 } 14232 }) 14233 } 14234} 14235 14236/** 14237 * ------------------------------------------------------------------------ 14238 * Data Api implementation 14239 * ------------------------------------------------------------------------ 14240 */ 14241 14242jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { 14243 // preventDefault only for <a> elements (which change the URL) not inside the collapsible element 14244 if (event.currentTarget.tagName === 'A') { 14245 event.preventDefault() 14246 } 14247 14248 const $trigger = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this) 14249 const selector = _util__WEBPACK_IMPORTED_MODULE_1__["default"].getSelectorFromElement(this) 14250 const selectors = [].slice.call(document.querySelectorAll(selector)) 14251 14252 jquery__WEBPACK_IMPORTED_MODULE_0___default()(selectors).each(function () { 14253 const $target = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this) 14254 const data = $target.data(DATA_KEY) 14255 const config = data ? 'toggle' : $trigger.data() 14256 Collapse._jQueryInterface.call($target, config) 14257 }) 14258}) 14259 14260/** 14261 * ------------------------------------------------------------------------ 14262 * jQuery 14263 * ------------------------------------------------------------------------ 14264 */ 14265 14266jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME] = Collapse._jQueryInterface 14267jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME].Constructor = Collapse 14268jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME].noConflict = () => { 14269 jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME] = JQUERY_NO_CONFLICT 14270 return Collapse._jQueryInterface 14271} 14272 14273/* harmony default export */ __webpack_exports__["default"] = (Collapse); 14274 14275 14276/***/ }), 14277 14278/***/ 305: 14279/***/ (function(module, __webpack_exports__, __webpack_require__) { 14280 14281"use strict"; 14282__webpack_require__.r(__webpack_exports__); 14283/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(275); 14284/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 14285/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(301); 14286/** 14287 * -------------------------------------------------------------------------- 14288 * Bootstrap (v4.3.1): modal.js 14289 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 14290 * -------------------------------------------------------------------------- 14291 */ 14292 14293 14294 14295 14296/** 14297 * ------------------------------------------------------------------------ 14298 * Constants 14299 * ------------------------------------------------------------------------ 14300 */ 14301 14302const NAME = 'modal' 14303const VERSION = '4.3.1' 14304const DATA_KEY = 'bs.modal' 14305const EVENT_KEY = `.${DATA_KEY}` 14306const DATA_API_KEY = '.data-api' 14307const JQUERY_NO_CONFLICT = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME] 14308const ESCAPE_KEYCODE = 27 // KeyboardEvent.which value for Escape (Esc) key 14309 14310const Default = { 14311 backdrop : true, 14312 keyboard : true, 14313 focus : true, 14314 show : true 14315} 14316 14317const DefaultType = { 14318 backdrop : '(boolean|string)', 14319 keyboard : 'boolean', 14320 focus : 'boolean', 14321 show : 'boolean' 14322} 14323 14324const Event = { 14325 HIDE : `hide${EVENT_KEY}`, 14326 HIDDEN : `hidden${EVENT_KEY}`, 14327 SHOW : `show${EVENT_KEY}`, 14328 SHOWN : `shown${EVENT_KEY}`, 14329 FOCUSIN : `focusin${EVENT_KEY}`, 14330 RESIZE : `resize${EVENT_KEY}`, 14331 CLICK_DISMISS : `click.dismiss${EVENT_KEY}`, 14332 KEYDOWN_DISMISS : `keydown.dismiss${EVENT_KEY}`, 14333 MOUSEUP_DISMISS : `mouseup.dismiss${EVENT_KEY}`, 14334 MOUSEDOWN_DISMISS : `mousedown.dismiss${EVENT_KEY}`, 14335 CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}` 14336} 14337 14338const ClassName = { 14339 SCROLLABLE : 'modal-dialog-scrollable', 14340 SCROLLBAR_MEASURER : 'modal-scrollbar-measure', 14341 BACKDROP : 'modal-backdrop', 14342 OPEN : 'modal-open', 14343 FADE : 'fade', 14344 SHOW : 'show' 14345} 14346 14347const Selector = { 14348 DIALOG : '.modal-dialog', 14349 MODAL_BODY : '.modal-body', 14350 DATA_TOGGLE : '[data-toggle="modal"]', 14351 DATA_DISMISS : '[data-dismiss="modal"]', 14352 FIXED_CONTENT : '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top', 14353 STICKY_CONTENT : '.sticky-top' 14354} 14355 14356/** 14357 * ------------------------------------------------------------------------ 14358 * Class Definition 14359 * ------------------------------------------------------------------------ 14360 */ 14361 14362class Modal { 14363 constructor(element, config) { 14364 this._config = this._getConfig(config) 14365 this._element = element 14366 this._dialog = element.querySelector(Selector.DIALOG) 14367 this._backdrop = null 14368 this._isShown = false 14369 this._isBodyOverflowing = false 14370 this._ignoreBackdropClick = false 14371 this._isTransitioning = false 14372 this._scrollbarWidth = 0 14373 } 14374 14375 // Getters 14376 14377 static get VERSION() { 14378 return VERSION 14379 } 14380 14381 static get Default() { 14382 return Default 14383 } 14384 14385 // Public 14386 14387 toggle(relatedTarget) { 14388 return this._isShown ? this.hide() : this.show(relatedTarget) 14389 } 14390 14391 show(relatedTarget) { 14392 if (this._isShown || this._isTransitioning) { 14393 return 14394 } 14395 14396 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).hasClass(ClassName.FADE)) { 14397 this._isTransitioning = true 14398 } 14399 14400 const showEvent = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Event(Event.SHOW, { 14401 relatedTarget 14402 }) 14403 14404 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).trigger(showEvent) 14405 14406 if (this._isShown || showEvent.isDefaultPrevented()) { 14407 return 14408 } 14409 14410 this._isShown = true 14411 14412 this._checkScrollbar() 14413 this._setScrollbar() 14414 14415 this._adjustDialog() 14416 14417 this._setEscapeEvent() 14418 this._setResizeEvent() 14419 14420 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).on( 14421 Event.CLICK_DISMISS, 14422 Selector.DATA_DISMISS, 14423 (event) => this.hide(event) 14424 ) 14425 14426 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._dialog).on(Event.MOUSEDOWN_DISMISS, () => { 14427 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).one(Event.MOUSEUP_DISMISS, (event) => { 14428 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(event.target).is(this._element)) { 14429 this._ignoreBackdropClick = true 14430 } 14431 }) 14432 }) 14433 14434 this._showBackdrop(() => this._showElement(relatedTarget)) 14435 } 14436 14437 hide(event) { 14438 if (event) { 14439 event.preventDefault() 14440 } 14441 14442 if (!this._isShown || this._isTransitioning) { 14443 return 14444 } 14445 14446 const hideEvent = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Event(Event.HIDE) 14447 14448 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).trigger(hideEvent) 14449 14450 if (!this._isShown || hideEvent.isDefaultPrevented()) { 14451 return 14452 } 14453 14454 this._isShown = false 14455 const transition = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).hasClass(ClassName.FADE) 14456 14457 if (transition) { 14458 this._isTransitioning = true 14459 } 14460 14461 this._setEscapeEvent() 14462 this._setResizeEvent() 14463 14464 jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).off(Event.FOCUSIN) 14465 14466 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).removeClass(ClassName.SHOW) 14467 14468 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).off(Event.CLICK_DISMISS) 14469 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._dialog).off(Event.MOUSEDOWN_DISMISS) 14470 14471 14472 if (transition) { 14473 const transitionDuration = _util__WEBPACK_IMPORTED_MODULE_1__["default"].getTransitionDurationFromElement(this._element) 14474 14475 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element) 14476 .one(_util__WEBPACK_IMPORTED_MODULE_1__["default"].TRANSITION_END, (event) => this._hideModal(event)) 14477 .emulateTransitionEnd(transitionDuration) 14478 } else { 14479 this._hideModal() 14480 } 14481 } 14482 14483 dispose() { 14484 [window, this._element, this._dialog] 14485 .forEach((htmlElement) => jquery__WEBPACK_IMPORTED_MODULE_0___default()(htmlElement).off(EVENT_KEY)) 14486 14487 /** 14488 * `document` has 2 events `Event.FOCUSIN` and `Event.CLICK_DATA_API` 14489 * Do not move `document` in `htmlElements` array 14490 * It will remove `Event.CLICK_DATA_API` event that should remain 14491 */ 14492 jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).off(Event.FOCUSIN) 14493 14494 jquery__WEBPACK_IMPORTED_MODULE_0___default.a.removeData(this._element, DATA_KEY) 14495 14496 this._config = null 14497 this._element = null 14498 this._dialog = null 14499 this._backdrop = null 14500 this._isShown = null 14501 this._isBodyOverflowing = null 14502 this._ignoreBackdropClick = null 14503 this._isTransitioning = null 14504 this._scrollbarWidth = null 14505 } 14506 14507 handleUpdate() { 14508 this._adjustDialog() 14509 } 14510 14511 // Private 14512 14513 _getConfig(config) { 14514 config = { 14515 ...Default, 14516 ...config 14517 } 14518 _util__WEBPACK_IMPORTED_MODULE_1__["default"].typeCheckConfig(NAME, config, DefaultType) 14519 return config 14520 } 14521 14522 _showElement(relatedTarget) { 14523 const transition = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).hasClass(ClassName.FADE) 14524 14525 if (!this._element.parentNode || 14526 this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { 14527 // Don't move modal's DOM position 14528 document.body.appendChild(this._element) 14529 } 14530 14531 this._element.style.display = 'block' 14532 this._element.removeAttribute('aria-hidden') 14533 this._element.setAttribute('aria-modal', true) 14534 14535 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._dialog).hasClass(ClassName.SCROLLABLE)) { 14536 this._dialog.querySelector(Selector.MODAL_BODY).scrollTop = 0 14537 } else { 14538 this._element.scrollTop = 0 14539 } 14540 14541 if (transition) { 14542 _util__WEBPACK_IMPORTED_MODULE_1__["default"].reflow(this._element) 14543 } 14544 14545 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).addClass(ClassName.SHOW) 14546 14547 if (this._config.focus) { 14548 this._enforceFocus() 14549 } 14550 14551 const shownEvent = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Event(Event.SHOWN, { 14552 relatedTarget 14553 }) 14554 14555 const transitionComplete = () => { 14556 if (this._config.focus) { 14557 this._element.focus() 14558 } 14559 this._isTransitioning = false 14560 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).trigger(shownEvent) 14561 } 14562 14563 if (transition) { 14564 const transitionDuration = _util__WEBPACK_IMPORTED_MODULE_1__["default"].getTransitionDurationFromElement(this._dialog) 14565 14566 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._dialog) 14567 .one(_util__WEBPACK_IMPORTED_MODULE_1__["default"].TRANSITION_END, transitionComplete) 14568 .emulateTransitionEnd(transitionDuration) 14569 } else { 14570 transitionComplete() 14571 } 14572 } 14573 14574 _enforceFocus() { 14575 jquery__WEBPACK_IMPORTED_MODULE_0___default()(document) 14576 .off(Event.FOCUSIN) // Guard against infinite focus loop 14577 .on(Event.FOCUSIN, (event) => { 14578 if (document !== event.target && 14579 this._element !== event.target && 14580 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).has(event.target).length === 0) { 14581 this._element.focus() 14582 } 14583 }) 14584 } 14585 14586 _setEscapeEvent() { 14587 if (this._isShown && this._config.keyboard) { 14588 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).on(Event.KEYDOWN_DISMISS, (event) => { 14589 if (event.which === ESCAPE_KEYCODE) { 14590 event.preventDefault() 14591 this.hide() 14592 } 14593 }) 14594 } else if (!this._isShown) { 14595 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).off(Event.KEYDOWN_DISMISS) 14596 } 14597 } 14598 14599 _setResizeEvent() { 14600 if (this._isShown) { 14601 jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).on(Event.RESIZE, (event) => this.handleUpdate(event)) 14602 } else { 14603 jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off(Event.RESIZE) 14604 } 14605 } 14606 14607 _hideModal() { 14608 this._element.style.display = 'none' 14609 this._element.setAttribute('aria-hidden', true) 14610 this._element.removeAttribute('aria-modal') 14611 this._isTransitioning = false 14612 this._showBackdrop(() => { 14613 jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.body).removeClass(ClassName.OPEN) 14614 this._resetAdjustments() 14615 this._resetScrollbar() 14616 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).trigger(Event.HIDDEN) 14617 }) 14618 } 14619 14620 _removeBackdrop() { 14621 if (this._backdrop) { 14622 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._backdrop).remove() 14623 this._backdrop = null 14624 } 14625 } 14626 14627 _showBackdrop(callback) { 14628 const animate = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).hasClass(ClassName.FADE) 14629 ? ClassName.FADE : '' 14630 14631 if (this._isShown && this._config.backdrop) { 14632 this._backdrop = document.createElement('div') 14633 this._backdrop.className = ClassName.BACKDROP 14634 14635 if (animate) { 14636 this._backdrop.classList.add(animate) 14637 } 14638 14639 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._backdrop).appendTo(document.body) 14640 14641 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).on(Event.CLICK_DISMISS, (event) => { 14642 if (this._ignoreBackdropClick) { 14643 this._ignoreBackdropClick = false 14644 return 14645 } 14646 if (event.target !== event.currentTarget) { 14647 return 14648 } 14649 if (this._config.backdrop === 'static') { 14650 this._element.focus() 14651 } else { 14652 this.hide() 14653 } 14654 }) 14655 14656 if (animate) { 14657 _util__WEBPACK_IMPORTED_MODULE_1__["default"].reflow(this._backdrop) 14658 } 14659 14660 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._backdrop).addClass(ClassName.SHOW) 14661 14662 if (!callback) { 14663 return 14664 } 14665 14666 if (!animate) { 14667 callback() 14668 return 14669 } 14670 14671 const backdropTransitionDuration = _util__WEBPACK_IMPORTED_MODULE_1__["default"].getTransitionDurationFromElement(this._backdrop) 14672 14673 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._backdrop) 14674 .one(_util__WEBPACK_IMPORTED_MODULE_1__["default"].TRANSITION_END, callback) 14675 .emulateTransitionEnd(backdropTransitionDuration) 14676 } else if (!this._isShown && this._backdrop) { 14677 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._backdrop).removeClass(ClassName.SHOW) 14678 14679 const callbackRemove = () => { 14680 this._removeBackdrop() 14681 if (callback) { 14682 callback() 14683 } 14684 } 14685 14686 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).hasClass(ClassName.FADE)) { 14687 const backdropTransitionDuration = _util__WEBPACK_IMPORTED_MODULE_1__["default"].getTransitionDurationFromElement(this._backdrop) 14688 14689 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._backdrop) 14690 .one(_util__WEBPACK_IMPORTED_MODULE_1__["default"].TRANSITION_END, callbackRemove) 14691 .emulateTransitionEnd(backdropTransitionDuration) 14692 } else { 14693 callbackRemove() 14694 } 14695 } else if (callback) { 14696 callback() 14697 } 14698 } 14699 14700 // ---------------------------------------------------------------------- 14701 // the following methods are used to handle overflowing modals 14702 // todo (fat): these should probably be refactored out of modal.js 14703 // ---------------------------------------------------------------------- 14704
14705 _adjustDialog() { 14706 const isModalOverflowing = 14707 this._element.scrollHeight > document.documentElement.clientHeight 14708 14709 if (!this._isBodyOverflowing && isModalOverflowing) { 14710 this._element.style.paddingLeft = `${this._scrollbarWidth}px` 14711 } 14712 14713 if (this._isBodyOverflowing && !isModalOverflowing) { 14714 this._element.style.paddingRight = `${this._scrollbarWidth}px` 14715 } 14716 } 14717 14718 _resetAdjustments() { 14719 this._element.style.paddingLeft = '' 14720 this._element.style.paddingRight = '' 14721 } 14722 14723 _checkScrollbar() { 14724 const rect = document.body.getBoundingClientRect() 14725 this._isBodyOverflowing = rect.left + rect.right < window.innerWidth 14726 this._scrollbarWidth = this._getScrollbarWidth() 14727 } 14728 14729 _setScrollbar() { 14730 if (this._isBodyOverflowing) { 14731 // Note: DOMNode.style.paddingRight returns the actual value or '' if not set 14732 // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set 14733 const fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT)) 14734 const stickyContent = [].slice.call(document.querySelectorAll(Selector.STICKY_CONTENT)) 14735 14736 // Adjust fixed content padding 14737 jquery__WEBPACK_IMPORTED_MODULE_0___default()(fixedContent).each((index, element) => { 14738 const actualPadding = element.style.paddingRight 14739 const calculatedPadding = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).css('padding-right') 14740 jquery__WEBPACK_IMPORTED_MODULE_0___default()(element) 14741 .data('padding-right', actualPadding) 14742 .css('padding-right', `${parseFloat(calculatedPadding) + this._scrollbarWidth}px`) 14743 }) 14744 14745 // Adjust sticky content margin 14746 jquery__WEBPACK_IMPORTED_MODULE_0___default()(stickyContent).each((index, element) => { 14747 const actualMargin = element.style.marginRight 14748 const calculatedMargin = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).css('margin-right') 14749 jquery__WEBPACK_IMPORTED_MODULE_0___default()(element) 14750 .data('margin-right', actualMargin) 14751 .css('margin-right', `${parseFloat(calculatedMargin) - this._scrollbarWidth}px`) 14752 }) 14753 14754 // Adjust body padding 14755 const actualPadding = document.body.style.paddingRight 14756 const calculatedPadding = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.body).css('padding-right') 14757 jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.body) 14758 .data('padding-right', actualPadding) 14759 .css('padding-right', `${parseFloat(calculatedPadding) + this._scrollbarWidth}px`) 14760 } 14761 14762 jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.body).addClass(ClassName.OPEN) 14763 } 14764 14765 _resetScrollbar() { 14766 // Restore fixed content padding 14767 const fixedContent = [].slice.call(document.querySelectorAll(Selector.FIXED_CONTENT)) 14768 jquery__WEBPACK_IMPORTED_MODULE_0___default()(fixedContent).each((index, element) => { 14769 const padding = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).data('padding-right') 14770 jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).removeData('padding-right') 14771 element.style.paddingRight = padding ? padding : '' 14772 }) 14773 14774 // Restore sticky content 14775 const elements = [].slice.call(document.querySelectorAll(`${Selector.STICKY_CONTENT}`)) 14776 jquery__WEBPACK_IMPORTED_MODULE_0___default()(elements).each((index, element) => { 14777 const margin = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).data('margin-right') 14778 if (typeof margin !== 'undefined') { 14779 jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).css('margin-right', margin).removeData('margin-right') 14780 } 14781 }) 14782 14783 // Restore body padding 14784 const padding = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.body).data('padding-right') 14785 jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.body).removeData('padding-right') 14786 document.body.style.paddingRight = padding ? padding : '' 14787 } 14788 14789 _getScrollbarWidth() { // thx d.walsh 14790 const scrollDiv = document.createElement('div') 14791 scrollDiv.className = ClassName.SCROLLBAR_MEASURER 14792 document.body.appendChild(scrollDiv) 14793 const scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth 14794 document.body.removeChild(scrollDiv) 14795 return scrollbarWidth 14796 } 14797 14798 // Static 14799 14800 static _jQueryInterface(config, relatedTarget) { 14801 return this.each(function () { 14802 let data = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data(DATA_KEY) 14803 const _config = { 14804 ...Default, 14805 ...jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data(), 14806 ...typeof config === 'object' && config ? config : {} 14807 } 14808 14809 if (!data) { 14810 data = new Modal(this, _config) 14811 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data(DATA_KEY, data) 14812 } 14813 14814 if (typeof config === 'string') { 14815 if (typeof data[config] === 'undefined') {
14816 throw new TypeError(`No method named "${config}"`) 14817 } 14818 data[config](relatedTarget) 14819 } else if (_config.show) { 14820 data.show(relatedTarget) 14821 } 14822 }) 14823 } 14824} 14825 14826/** 14827 * ------------------------------------------------------------------------ 14828 * Data Api implementation 14829 * ------------------------------------------------------------------------ 14830 */ 14831 14832jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { 14833 let target 14834 const selector = _util__WEBPACK_IMPORTED_MODULE_1__["default"].getSelectorFromElement(this) 14835 14836 if (selector) { 14837 target = document.querySelector(selector) 14838 } 14839 14840 const config = jquery__WEBPACK_IMPORTED_MODULE_0___default()(target).data(DATA_KEY) 14841 ? 'toggle' : { 14842 ...jquery__WEBPACK_IMPORTED_MODULE_0___default()(target).data(), 14843 ...jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data() 14844 } 14845 14846 if (this.tagName === 'A' || this.tagName === 'AREA') { 14847 event.preventDefault() 14848 } 14849 14850 const $target = jquery__WEBPACK_IMPORTED_MODULE_0___default()(target).one(Event.SHOW, (showEvent) => { 14851 if (showEvent.isDefaultPrevented()) { 14852 // Only register focus restorer if modal will actually get shown 14853 return 14854 } 14855 14856 $target.one(Event.HIDDEN, () => { 14857 if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).is(':visible')) { 14858 this.focus() 14859 } 14860 }) 14861 }) 14862 14863 Modal._jQueryInterface.call(jquery__WEBPACK_IMPORTED_MODULE_0___default()(target), config, this) 14864}) 14865 14866/** 14867 * ------------------------------------------------------------------------ 14868 * jQuery 14869 * ------------------------------------------------------------------------ 14870 */ 14871 14872jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME] = Modal._jQueryInterface 14873jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME].Constructor = Modal 14874jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME].noConflict = () => { 14875 jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME] = JQUERY_NO_CONFLICT 14876 return Modal._jQueryInterface 14877} 14878 14879/* harmony default export */ __webpack_exports__["default"] = (Modal); 14880 14881 14882/***/ }), 14883 14884/***/ 306: 14885/***/ (function(module, __webpack_exports__, __webpack_require__) { 14886 14887"use strict"; 14888__webpack_require__.r(__webpack_exports__); 14889/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(275); 14890/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 14891/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(301); 14892/** 14893 * -------------------------------------------------------------------------- 14894 * Bootstrap (v4.3.1): scrollspy.js 14895 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 14896 * -------------------------------------------------------------------------- 14897 */ 14898 14899 14900 14901 14902/** 14903 * ------------------------------------------------------------------------ 14904 * Constants 14905 * ------------------------------------------------------------------------ 14906 */ 14907 14908const NAME = 'scrollspy' 14909const VERSION = '4.3.1' 14910const DATA_KEY = 'bs.scrollspy' 14911const EVENT_KEY = `.${DATA_KEY}` 14912const DATA_API_KEY = '.data-api' 14913const JQUERY_NO_CONFLICT = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME] 14914 14915const Default = { 14916 offset : 10, 14917 method : 'auto', 14918 target : '' 14919} 14920 14921const DefaultType = { 14922 offset : 'number', 14923 method : 'string', 14924 target : '(string|element)' 14925} 14926 14927const Event = { 14928 ACTIVATE : `activate${EVENT_KEY}`, 14929 SCROLL : `scroll${EVENT_KEY}`, 14930 LOAD_DATA_API : `load${EVENT_KEY}${DATA_API_KEY}` 14931} 14932 14933const ClassName = { 14934 DROPDOWN_ITEM : 'dropdown-item', 14935 DROPDOWN_MENU : 'dropdown-menu', 14936 ACTIVE : 'active' 14937} 14938 14939const Selector = { 14940 DATA_SPY : '[data-spy="scroll"]', 14941 ACTIVE : '.active', 14942 NAV_LIST_GROUP : '.nav, .list-group', 14943 NAV_LINKS : '.nav-link', 14944 NAV_ITEMS : '.nav-item', 14945 LIST_ITEMS : '.list-group-item', 14946 DROPDOWN : '.dropdown', 14947 DROPDOWN_ITEMS : '.dropdown-item', 14948 DROPDOWN_TOGGLE : '.dropdown-toggle' 14949} 14950 14951const OffsetMethod = { 14952 OFFSET : 'offset',
14953 POSITION : 'position' 14954} 14955 14956/** 14957 * ------------------------------------------------------------------------ 14958 * Class Definition 14959 * ------------------------------------------------------------------------ 14960 */ 14961 14962class ScrollSpy { 14963 constructor(element, config) { 14964 this._element = element 14965 this._scrollElement = element.tagName === 'BODY' ? window : element 14966 this._config = this._getConfig(config) 14967 this._selector = `${this._config.target} ${Selector.NAV_LINKS},` + 14968 `${this._config.target} ${Selector.LIST_ITEMS},` + 14969 `${this._config.target} ${Selector.DROPDOWN_ITEMS}` 14970 this._offsets = [] 14971 this._targets = [] 14972 this._activeTarget = null 14973 this._scrollHeight = 0 14974 14975 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._scrollElement).on(Event.SCROLL, (event) => this._process(event)) 14976 14977 this.refresh() 14978 this._process() 14979 } 14980 14981 // Getters 14982 14983 static get VERSION() { 14984 return VERSION 14985 } 14986 14987 static get Default() { 14988 return Default 14989 } 14990 14991 // Public 14992 14993 refresh() { 14994 const autoMethod = this._scrollElement === this._scrollElement.window 14995 ? OffsetMethod.OFFSET : OffsetMethod.POSITION 14996 14997 const offsetMethod = this._config.method === 'auto' 14998 ? autoMethod : this._config.method 14999 15000 const offsetBase = offsetMethod === OffsetMethod.POSITION 15001 ? this._getScrollTop() : 0 15002 15003 this._offsets = [] 15004 this._targets = [] 15005 15006 this._scrollHeight = this._getScrollHeight() 15007 15008 const targets = [].slice.call(document.querySelectorAll(this._selector)) 15009 15010 targets 15011 .map((element) => { 15012 let target 15013 const targetSelector = _util__WEBPACK_IMPORTED_MODULE_1__["default"].getSelectorFromElement(element) 15014 15015 if (targetSelector) { 15016 target = document.querySelector(targetSelector) 15017 } 15018 15019 if (target) { 15020 const targetBCR = target.getBoundingClientRect() 15021 if (targetBCR.width || targetBCR.height) { 15022 // TODO (fat): remove sketch reliance on jQuery position/offset 15023 return [ 15024 jquery__WEBPACK_IMPORTED_MODULE_0___default()(target)[offsetMethod]().top + offsetBase, 15025 targetSelector 15026 ] 15027 } 15028 } 15029 return null 15030 }) 15031 .filter((item) => item) 15032 .sort((a, b) => a[0] - b[0]) 15033 .forEach((item) => { 15034 this._offsets.push(item[0]) 15035 this._targets.push(item[1]) 15036 }) 15037 } 15038 15039 dispose() { 15040 jquery__WEBPACK_IMPORTED_MODULE_0___default.a.removeData(this._element, DATA_KEY) 15041 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._scrollElement).off(EVENT_KEY) 15042 15043 this._element = null 15044 this._scrollElement = null 15045 this._config = null 15046 this._selector = null 15047 this._offsets = null 15048 this._targets = null 15049 this._activeTarget = null 15050 this._scrollHeight = null 15051 } 15052 15053 // Private 15054 15055 _getConfig(config) { 15056 config = { 15057 ...Default, 15058 ...typeof config === 'object' && config ? config : {} 15059 } 15060 15061 if (typeof config.target !== 'string') { 15062 let id = jquery__WEBPACK_IMPORTED_MODULE_0___default()(config.target).attr('id') 15063 if (!id) { 15064 id = _util__WEBPACK_IMPORTED_MODULE_1__["default"].getUID(NAME) 15065 jquery__WEBPACK_IMPORTED_MODULE_0___default()(config.target).attr('id', id) 15066 } 15067 config.target = `#${id}` 15068 } 15069 15070 _util__WEBPACK_IMPORTED_MODULE_1__["default"].typeCheckConfig(NAME, config, DefaultType) 15071 15072 return config 15073 } 15074 15075 _getScrollTop() { 15076 return this._scrollElement === window 15077 ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop 15078 } 15079 15080 _getScrollHeight() { 15081 return this._scrollElement.scrollHeight || Math.max( 15082 document.body.scrollHeight, 15083 document.documentElement.scrollHeight 15084 ) 15085 } 15086 15087 _getOffsetHeight() { 15088 return this._scrollElement === window 15089 ? window.innerHeight : this._scrollElement.getBoundingClientRect().height 15090 } 15091 15092 _process() { 15093 const scrollTop = this._getScrollTop() + this._config.offset 15094 const scrollHeight = this._getScrollHeight() 15095 const maxScroll = this._config.offset + 15096 scrollHeight - 15097 this._getOffsetHeight() 15098 15099 if (this._scrollHeight !== scrollHeight) { 15100 this.refresh() 15101 } 15102 15103 if (scrollTop >= maxScroll) { 15104 const target = this._targets[this._targets.length - 1] 15105 15106 if (this._activeTarget !== target) { 15107 this._activate(target) 15108 } 15109 return 15110 } 15111 15112 if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { 15113 this._activeTarget = null 15114 this._clear() 15115 return 15116 } 15117 15118 const offsetLength = this._offsets.length 15119 for (let i = offsetLength; i--;) { 15120 const isActiveTarget = this._activeTarget !== this._targets[i] && 15121 scrollTop >= this._offsets[i] && 15122 (typeof this._offsets[i + 1] === 'undefined' || 15123 scrollTop < this._offsets[i + 1]) 15124 15125 if (isActiveTarget) { 15126 this._activate(this._targets[i]) 15127 } 15128 } 15129 } 15130 15131 _activate(target) { 15132 this._activeTarget = target 15133 15134 this._clear() 15135 15136 const queries = this._selector 15137 .split(',') 15138 .map((selector) => `${selector}[data-target="${target}"],${selector}[href="${target}"]`) 15139 15140 const $link = jquery__WEBPACK_IMPORTED_MODULE_0___default()([].slice.call(document.querySelectorAll(queries.join(',')))) 15141
15142 if ($link.hasClass(ClassName.DROPDOWN_ITEM)) { 15143 $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE) 15144 $link.addClass(ClassName.ACTIVE) 15145 } else { 15146 // Set triggered link as active 15147 $link.addClass(ClassName.ACTIVE) 15148 // Set triggered links parents as active 15149 // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor 15150 $link.parents(Selector.NAV_LIST_GROUP).prev(`${Selector.NAV_LINKS}, ${Selector.LIST_ITEMS}`).addClass(ClassName.ACTIVE) 15151 // Handle special case when .nav-link is inside .nav-item 15152 $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_ITEMS).children(Selector.NAV_LINKS).addClass(ClassName.ACTIVE) 15153 } 15154 15155 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._scrollElement).trigger(Event.ACTIVATE, { 15156 relatedTarget: target 15157 }) 15158 } 15159 15160 _clear() { 15161 [].slice.call(document.querySelectorAll(this._selector)) 15162 .filter((node) => node.classList.contains(ClassName.ACTIVE)) 15163 .forEach((node) => node.classList.remove(ClassName.ACTIVE)) 15164 } 15165 15166 // Static 15167 15168 static _jQueryInterface(config) { 15169 return this.each(function () { 15170 let data = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data(DATA_KEY) 15171 const _config = typeof config === 'object' && config 15172 15173 if (!data) { 15174 data = new ScrollSpy(this, _config) 15175 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data(DATA_KEY, data) 15176 } 15177 15178 if (typeof config === 'string') { 15179 if (typeof data[config] === 'undefined') { 15180 throw new TypeError(`No method named "${config}"`) 15181 } 15182 data[config]() 15183 } 15184 }) 15185 } 15186} 15187 15188/** 15189 * ------------------------------------------------------------------------ 15190 * Data Api implementation 15191 * ------------------------------------------------------------------------ 15192 */ 15193 15194jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).on(Event.LOAD_DATA_API, () => { 15195 const scrollSpys = [].slice.call(document.querySelectorAll(Selector.DATA_SPY)) 15196 const scrollSpysLength = scrollSpys.length 15197 15198 for (let i = scrollSpysLength; i--;) { 15199 const $spy = jquery__WEBPACK_IMPORTED_MODULE_0___default()(scrollSpys[i]) 15200 ScrollSpy._jQueryInterface.call($spy, $spy.data()) 15201 } 15202}) 15203 15204/** 15205 * ------------------------------------------------------------------------ 15206 * jQuery 15207 * ------------------------------------------------------------------------ 15208 */ 15209 15210jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME] = ScrollSpy._jQueryInterface 15211jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME].Constructor = ScrollSpy 15212jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME].noConflict = () => { 15213 jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME] = JQUERY_NO_CONFLICT 15214 return ScrollSpy._jQueryInterface 15215} 15216 15217/* harmony default export */ __webpack_exports__["default"] = (ScrollSpy); 15218 15219 15220/***/ }), 15221 15222/***/ 307: 15223/***/ (function(module, __webpack_exports__, __webpack_require__) { 15224 15225"use strict"; 15226__webpack_require__.r(__webpack_exports__); 15227/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(275); 15228/* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); 15229/* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(301); 15230/** 15231 * -------------------------------------------------------------------------- 15232 * Bootstrap (v4.3.1): tab.js 15233 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 15234 * -------------------------------------------------------------------------- 15235 */ 15236 15237 15238 15239 15240/** 15241 * ------------------------------------------------------------------------ 15242 * Constants 15243 * ------------------------------------------------------------------------ 15244 */ 15245 15246const NAME = 'tab' 15247const VERSION = '4.3.1' 15248const DATA_KEY = 'bs.tab' 15249const EVENT_KEY = `.${DATA_KEY}` 15250const DATA_API_KEY = '.data-api' 15251const JQUERY_NO_CONFLICT = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME] 15252 15253const Event = { 15254 HIDE : `hide${EVENT_KEY}`, 15255 HIDDEN : `hidden${EVENT_KEY}`, 15256 SHOW : `show${EVENT_KEY}`, 15257 SHOWN : `shown${EVENT_KEY}`, 15258 CLICK_DATA_API : `click${EVENT_KEY}${DATA_API_KEY}` 15259} 15260 15261const ClassName = { 15262 DROPDOWN_MENU : 'dropdown-menu', 15263 ACTIVE : 'active', 15264 DISABLED : 'disabled', 15265 FADE : 'fade', 15266 SHOW : 'show' 15267} 15268 15269const Selector = { 15270 DROPDOWN : '.dropdown', 15271 NAV_LIST_GROUP : '.nav, .list-group', 15272 ACTIVE : '.active', 15273 ACTIVE_UL : '> li > .active', 15274 DATA_TOGGLE : '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]', 15275 DROPDOWN_TOGGLE : '.dropdown-toggle', 15276 DROPDOWN_ACTIVE_CHILD : '> .dropdown-menu .active' 15277} 15278 15279/** 15280 * ------------------------------------------------------------------------ 15281 * Class Definition 15282 * ------------------------------------------------------------------------ 15283 */ 15284 15285class Tab { 15286 constructor(element) { 15287 this._element = element 15288 } 15289 15290 // Getters 15291 15292 static get VERSION() { 15293 return VERSION 15294 } 15295 15296 // Public 15297 15298 show() { 15299 if (this._element.parentNode && 15300 this._element.parentNode.nodeType === Node.ELEMENT_NODE && 15301 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).hasClass(ClassName.ACTIVE) || 15302 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).hasClass(ClassName.DISABLED)) { 15303 return 15304 } 15305 15306 let target 15307 let previous 15308 const listElement = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).closest(Selector.NAV_LIST_GROUP)[0] 15309 const selector = _util__WEBPACK_IMPORTED_MODULE_1__["default"].getSelectorFromElement(this._element) 15310 15311 if (listElement) { 15312 const itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? Selector.ACTIVE_UL : Selector.ACTIVE 15313 previous = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.makeArray(jquery__WEBPACK_IMPORTED_MODULE_0___default()(listElement).find(itemSelector)) 15314 previous = previous[previous.length - 1] 15315 } 15316 15317 const hideEvent = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Event(Event.HIDE, { 15318 relatedTarget: this._element 15319 }) 15320 15321 const showEvent = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Event(Event.SHOW, { 15322 relatedTarget: previous 15323 }) 15324 15325 if (previous) { 15326 jquery__WEBPACK_IMPORTED_MODULE_0___default()(previous).trigger(hideEvent) 15327 } 15328 15329 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).trigger(showEvent) 15330 15331 if (showEvent.isDefaultPrevented() || 15332 hideEvent.isDefaultPrevented()) { 15333 return 15334 } 15335 15336 if (selector) { 15337 target = document.querySelector(selector) 15338 } 15339 15340 this._activate( 15341 this._element, 15342 listElement 15343 ) 15344 15345 const complete = () => { 15346 const hiddenEvent = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Event(Event.HIDDEN, { 15347 relatedTarget: this._element 15348 }) 15349 15350 const shownEvent = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.Event(Event.SHOWN, { 15351 relatedTarget: previous 15352 }) 15353 15354 jquery__WEBPACK_IMPORTED_MODULE_0___default()(previous).trigger(hiddenEvent) 15355 jquery__WEBPACK_IMPORTED_MODULE_0___default()(this._element).trigger(shownEvent) 15356 } 15357 15358 if (target) { 15359 this._activate(target, target.parentNode, complete) 15360 } else { 15361 complete() 15362 } 15363 } 15364 15365 dispose() { 15366 jquery__WEBPACK_IMPORTED_MODULE_0___default.a.removeData(this._element, DATA_KEY) 15367 this._element = null 15368 } 15369 15370 // Private 15371 15372 _activate(element, container, callback) { 15373 const activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') 15374 ? jquery__WEBPACK_IMPORTED_MODULE_0___default()(container).find(Selector.ACTIVE_UL) 15375 : jquery__WEBPACK_IMPORTED_MODULE_0___default()(container).children(Selector.ACTIVE) 15376 15377 const active = activeElements[0] 15378 const isTransitioning = callback && (active && jquery__WEBPACK_IMPORTED_MODULE_0___default()(active).hasClass(ClassName.FADE)) 15379 const complete = () => this._transitionComplete( 15380 element, 15381 active, 15382 callback 15383 ) 15384 15385 if (active && isTransitioning) { 15386 const transitionDuration = _util__WEBPACK_IMPORTED_MODULE_1__["default"].getTransitionDurationFromElement(active) 15387 15388 jquery__WEBPACK_IMPORTED_MODULE_0___default()(active) 15389 .removeClass(ClassName.SHOW) 15390 .one(_util__WEBPACK_IMPORTED_MODULE_1__["default"].TRANSITION_END, complete) 15391 .emulateTransitionEnd(transitionDuration) 15392 } else { 15393 complete() 15394 } 15395 } 15396 15397 _transitionComplete(element, active, callback) { 15398 if (active) { 15399 jquery__WEBPACK_IMPORTED_MODULE_0___default()(active).removeClass(ClassName.ACTIVE) 15400
15401 const dropdownChild = jquery__WEBPACK_IMPORTED_MODULE_0___default()(active.parentNode).find( 15402 Selector.DROPDOWN_ACTIVE_CHILD 15403 )[0] 15404 15405 if (dropdownChild) { 15406 jquery__WEBPACK_IMPORTED_MODULE_0___default()(dropdownChild).removeClass(ClassName.ACTIVE) 15407 } 15408 15409 if (active.getAttribute('role') === 'tab') { 15410 active.setAttribute('aria-selected', false) 15411 } 15412 } 15413 15414 jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).addClass(ClassName.ACTIVE) 15415 if (element.getAttribute('role') === 'tab') { 15416 element.setAttribute('aria-selected', true) 15417 } 15418 15419 _util__WEBPACK_IMPORTED_MODULE_1__["default"].reflow(element) 15420 15421 if (element.classList.contains(ClassName.FADE)) { 15422 element.classList.add(ClassName.SHOW) 15423 } 15424 15425 if (element.parentNode && jquery__WEBPACK_IMPORTED_MODULE_0___default()(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) { 15426 const dropdownElement = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).closest(Selector.DROPDOWN)[0] 15427 15428 if (dropdownElement) { 15429 const dropdownToggleList = [].slice.call(dropdownElement.querySelectorAll(Selector.DROPDOWN_TOGGLE)) 15430 15431 jquery__WEBPACK_IMPORTED_MODULE_0___default()(dropdownToggleList).addClass(ClassName.ACTIVE) 15432 } 15433 15434 element.setAttribute('aria-expanded', true) 15435 } 15436 15437 if (callback) { 15438 callback() 15439 } 15440 } 15441 15442 // Static 15443 15444 static _jQueryInterface(config) { 15445 return this.each(function () { 15446 const $this = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this) 15447 let data = $this.data(DATA_KEY) 15448 15449 if (!data) { 15450 data = new Tab(this) 15451 $this.data(DATA_KEY, data) 15452 } 15453 15454 if (typeof config === 'string') { 15455 if (typeof data[config] === 'undefined') { 15456 throw new TypeError(`No method named "${config}"`) 15457 } 15458 data[config]() 15459 } 15460 }) 15461 } 15462} 15463 15464/** 15465 * ------------------------------------------------------------------------ 15466 * Data Api implementation 15467 * ------------------------------------------------------------------------ 15468 */ 15469 15470jquery__WEBPACK_IMPORTED_MODULE_0___default()(document) 15471 .on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { 15472 event.preventDefault() 15473 Tab._jQueryInterface.call(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), 'show') 15474 }) 15475 15476/** 15477 * ------------------------------------------------------------------------ 15478 * jQuery 15479 * ------------------------------------------------------------------------ 15480 */ 15481 15482jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME] = Tab._jQueryInterface 15483jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME].Constructor = Tab 15484jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME].noConflict = () => { 15485 jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn[NAME] = JQUERY_NO_CONFLICT 15486 return Tab._jQueryInterface 15487} 15488 15489/* harmony default export */ __webpack_exports__["default"] = (Tab); 15490 15491 15492/***/ }), 15493 15494/***/ 308: 15495/***/ (function(module, exports, __webpack_require__) { 15496 15497"use strict"; 15498 15499 15500var keyboardAccessibility = __webpack_require__(277); 15501 15502module.exports = function () { 15503 $('.country-selector a').click(function (e) { 15504 e.preventDefault(); 15505 var action = $('.page').data('action'); 15506 var localeCode = $(this).data('locale'); 15507 var localeCurrencyCode = $(this).data('currencycode'); 15508 var queryString = $('.page').data('querystring'); 15509 var url = $('.country-selector').data('url'); 15510 15511 var siteID = document.getElementById('siteID').value; 15512 var siteAction = action.split("-"); 15513 if (siteAction[1] == siteID || action == 'Order-Confirm') { 15514 action = 'Home-Show'; 15515 } 15516 15517 $.ajax({
15518 url: url, 15519 type: 'get', 15520 dataType: 'json', 15521 data: { 15522 code: localeCode, 15523 queryString: queryString, 15524 CurrencyCode: localeCurrencyCode, 15525 action: action 15526 }, 15527 success: function (response) { 15528 $.spinner().stop(); 15529 if (response && response.redirectUrl) { 15530 window.location.href = response.redirectUrl; 15531 } 15532 }, 15533 error: function () { 15534 $.spinner().stop(); 15535 } 15536 }); 15537 }); 15538 15539 keyboardAccessibility('.navbar-header .country-selector', 15540 { 15541 40: function ($countryOptions) { // down 15542 if ($(this).is(':focus')) { 15543 $countryOptions.first().focus(); 15544 } else { 15545 $(':focus').next().focus(); 15546 } 15547 }, 15548 38: function ($countryOptions) { // up 15549 if ($countryOptions.first().is(':focus') || $(this).is(':focus')) { 15550 $(this).focus(); 15551 $(this).removeClass('show'); 15552 } else { 15553 $(':focus').prev().focus(); 15554 } 15555 }, 15556 27: function () { // escape 15557 $(this).focus(); 15558 $(this).removeClass('show').children('.dropdown-menu').removeClass('show'); 15559 }, 15560 9: function () { // tab 15561 $(this).removeClass('show').children('.dropdown-menu').removeClass('show'); 15562 } 15563 }, 15564 function () { 15565 if (!($(this).hasClass('show'))) { 15566 $(this).addClass('show'); 15567 } 15568 return $(this).find('.dropdown-country-selector').children('a'); 15569 } 15570 ); 15571 15572 $('.navbar-header .country-selector').on('focusin', function () { 15573 $(this).addClass('show').children('.dropdown-menu').addClass('show'); 15574 }); 15575}; 15576 15577 15578/***/ }), 15579 15580/***/ 309: 15581/***/ (function(module, exports, __webpack_require__) { 15582 15583"use strict"; 15584 15585 15586module.exports = function () { 15587 $('.info-icon').on('mouseenter focusin', function () { 15588 $(this).find('.tooltip').removeClass('d-none'); 15589 }); 15590 15591 $('.info-icon').on('mouseleave focusout', function () { 15592 $(this).find('.tooltip').addClass('d-none'); 15593 }); 15594}; 15595 15596 15597/***/ }), 15598 15599/***/ 310: 15600/***/ (function(module, exports, __webpack_require__) { 15601 15602const processInclude = __webpack_require__(3); 15603 15604$(document).ready(() => { 15605 processInclude(__webpack_require__(311)); 15606 processInclude(__webpack_require__(312)); 15607 processInclude(__webpack_require__(314)); 15608 processInclude(__webpack_require__(315)); 15609 processInclude(__webpack_require__(316)); 15610 processInclude(__webpack_require__(317)); 15611}); 15612 15613 15614/***/ }), 15615 15616/***/ 311: 15617/***/ (function(module, exports) { 15618 15619/** 15620 * Update DOM elements with Ajax results 15621 * 15622 * @param {number} quantity - quantity 15623 * @param {string} selector - DOM element to look up in the tile's qty element 15624 * @return {undefined} 15625 */ 15626 function updateTile(quantity, selector) { 15627 $(selector).empty().html(quantity); 15628 if (quantity && quantity > 0) { 15629 $(selector).closest('.add-to-cart').find('.tile-add-to-cart').removeClass('show'); 15630 $(selector).closest('.add-to-cart').find('.update-quantity').addClass('show'); 15631 } else { 15632 $(selector).closest('.add-to-cart').find('.tile-add-to-cart').addClass('show'); 15633 $(selector).closest('.add-to-cart').find('.update-quantity').removeClass('show'); 15634 } 15635} 15636 15637/** 15638 * Keep refinement panes expanded/collapsed after Ajax refresh 15639 * 15640 * @param {Object} $results - jQuery DOM element 15641 * @return {undefined} 15642 */ 15643function updateQuantities() { 15644 const items = $('.cart-json').data('cart'); 15645 $('.add-to-cart').find('.tile-add-to-cart').addClass('show'); 15646 $('.add-to-cart').find('.update-quantity').removeClass('show'); 15647 if (items && items.itemsquantities && items.itemsquantities.length > 0) {
15648 items.itemsquantities.forEach((item) => { 15649 updateTile(item.qty, `.itemquantity-${item.id} .quantity`); 15650 }); 15651 } 15652} 15653 15654/** 15655 * Retrieves the relevant pid value 15656 * @param {jquery} $el - DOM container for a given add to cart button 15657 * @return {string} - value to be used when adding product to cart 15658 */ 15659function getPidValue($el) { 15660 return $($el).closest('.add-to-cart').data('pid'); 15661} 15662 15663/** 15664 * Retrieves url to use when adding a product to the cart 15665 * @param {jquery} $el - DOM container for a given add to cart button 15666 * @return {string} - The provided URL to use when adding a product to the cart 15667 */ 15668function getAddToCartUrl($el) { 15669 return $($el).closest('.add-to-cart').data('endpoint-add-to-cart'); 15670} 15671 15672/** 15673 * Retrieves url to use when adding a product to the cart 15674 * @param {jquery} $el - DOM container for a given change qty button 15675 * @return {string} - The provided URL to use when changing quantity 15676 */ 15677function getUpdateQuantityUrl($el) { 15678 return $($el).closest('.add-to-cart').data('endpoint-update-quantity'); 15679} 15680 15681/** 15682 * Parses the html for a modal window 15683 * @param {string} html - representing the body and footer of the modal window 15684 * 15685 * @return {Object} - Object with properties body and footer. 15686 */ 15687function parseHtml(html) { 15688 const $html = $('<div>').append($.parseHTML(html)); 15689 15690 const body = $html.find('.choice-of-bonus-product'); 15691 const footer = $html.find('.modal-footer').children(); 15692 15693 return { body, footer }; 15694} 15695 15696/** 15697 * Retrieves url to use when adding a product to the cart 15698 * 15699 * @param {Object} data - data object used to fill in dynamic portions of the html 15700 */ 15701function chooseBonusProducts(data) { 15702 $('.modal-body').spinner().start(); 15703 15704 if ($('#chooseBonusProductModal').length !== 0) { 15705 $('#chooseBonusProductModal').remove(); 15706 } 15707 let bonusUrl; 15708 if (data.bonusChoiceRuleBased) { 15709 bonusUrl = data.showProductsUrlRuleBased; 15710 } else { 15711 bonusUrl = data.showProductsUrlListBased; 15712 } 15713 15714 const htmlString = `${'<!-- Modal -->' + 15715 '<div class="modal fade" id="chooseBonusProductModal" tabindex="-1" role="dialog">' + 15716 '<span class="enter-message sr-only" ></span>' + 15717 '<div class="modal-dialog choose-bonus-product-dialog" ' + 15718 'data-total-qty="'}${data.maxBonusItems}"` + 15719 `data-UUID="${data.uuid}"` + 15720 `data-pliUUID="${data.pliUUID}"` + 15721 `data-addToCartUrl="${data.addToCartUrl}"` + 15722 'data-pageStart="0"' + 15723 `data-pageSize="${data.pageSize}"` + 15724 `data-moreURL="${data.showProductsUrlRuleBased}"` + 15725 `data-bonusChoiceRuleBased="${data.bonusChoiceRuleBased}">` + 15726 '<!-- Modal content-->' + 15727 '<div class="modal-content">' + 15728 '<div class="modal-header">' + 15729 ` <span class="">${data.labels.selectprods}</span>` + 15730 ' <button type="button" class="close pull-right" data-dismiss="modal">' + 15731 ' <span aria-hidden="true">×</span>' + 15732 ' <span class="sr-only"> </span>' + 15733 ' </button>' + 15734 '</div>' + 15735 '<div class="modal-body"></div>' + 15736 '<div class="modal-footer"></div>' + 15737 '</div>' + 15738 '</div>' + 15739 '</div>'; 15740 $('body').append(htmlString); 15741 $('.modal-body').spinner().start(); 15742 15743 $.ajax({
15744 url: bonusUrl, 15745 method: 'GET', 15746 dataType: 'json', 15747 success(response) { 15748 const parsedHtml = parseHtml(response.renderedTemplate); 15749 $('#chooseBonusProductModal .modal-body').empty(); 15750 $('#chooseBonusProductModal .enter-message').text(response.enterDialogMessage); 15751 $('#chooseBonusProductModal .modal-header .close .sr-only').text(response.closeButtonText); 15752 $('#chooseBonusProductModal .modal-body').html(parsedHtml.body); 15753 $('#chooseBonusProductModal .modal-footer').html(parsedHtml.footer); 15754 $('#chooseBonusProductModal').modal('show'); 15755 $.spinner().stop(); 15756 }, 15757 error() { 15758 $.spinner().stop(); 15759 }, 15760 }); 15761} 15762 15763/** 15764 * Updates the Mini-Cart quantity value after the customer has pressed the "Add to Cart" button 15765 * @param {string} response - ajax response from clicking the add to cart button 15766 * @param {jquery} el - DOM container for a given add to cart button 15767 */ 15768function handlePostCartAdd(response, el) { 15769 $('.minicart').trigger('count:update', response); 15770 if (response && response.cart && response.cart.items) { 15771 const pid = el.closest('.add-to-cart').data('pid'); 15772 const products = response.cart.items.filter((item) => item.id === pid); 15773 if (products && products.length > 0) { 15774 el.closest('.add-to-cart').find('.update-quantity').addClass('show'); 15775 el.closest('.add-to-cart').find('.update-quantity .quantity').html('1'); 15776 el.removeClass('show'); 15777 } 15778 } 15779 15780 const messageType = response.error ? 'alert-danger' : 'alert-success'; 15781 // show add to cart toast 15782 if (response.newBonusDiscountLineItem && 15783 Object.keys(response.newBonusDiscountLineItem).length !== 0) { 15784 chooseBonusProducts(response.newBonusDiscountLineItem); 15785 } else { 15786 if ($('.add-to-cart-messages').length === 0) { 15787 $('body').append('<div class="add-to-cart-messages"></div>'); 15788 } 15789 15790 var isMobile = $(window).width()< 768; 15791 if(response.error || (!response.error && isMobile)){ 15792 $('.add-to-cart-messages').append(`<div class="alert ${messageType} add-to-basket-alert text-center" role="alert">${ 15793 response.message 15794 }</div>`); 15795 } 15796 15797 setTimeout(() => { 15798 $('.add-to-basket-alert').remove(); 15799 }, 5000); 15800 } 15801} 15802 15803/** 15804 * Updates the Mini-Cart quantity value after the customer has pressed the "Add to Cart" button 15805 * @param {string} response - ajax response from clicking the quantity change button 15806 * @param {jquery} el - DOM container for a given quantity change button 15807 */ 15808function updateQuantity(response, el) { 15809 if (response && response.items && response.items) { 15810 let product; 15811 const pid = el.closest('.add-to-cart').data('pid'); 15812 const products = response.items.filter((item) => item.id === pid); 15813 if (products && products.length > 0) { 15814 product = products.pop(); 15815 el.closest('.add-to-cart').find('.update-quantity .quantity').html(product.quantity); 15816 } 15817 } 15818} 15819 15820/** 15821 * Makes a call to the server to report the event of adding an item to the cart 15822 * 15823 * @param {string | boolean} url - a string representing the end point to hit so that the event can be recorded, or false 15824 */ 15825function miniCartReportingUrl(url) { 15826 if (url) { 15827 $.ajax({
15828 url, 15829 method: 'GET', 15830 success() { 15831 // reporting urls hit on the server 15832 }, 15833 error() { 15834 // no reporting urls hit on the server 15835 }, 15836 }); 15837 } 15838} 15839 15840module.exports = { 15841 addToCartPLP() { 15842 $(document).on('click', 'button.tile-add-to-cart', function () { 15843 const el = $(this); 15844 var reloadPage=(el.closest('.cart-page-carosal').length>0)?true:false; 15845 $('body').trigger('product:beforeAddToCart', this); 15846 const pid = getPidValue($(this)); 15847 const selectedQuantity = el.closest('.cart-and-ipay').find('#qtyValue_' + pid).val(); 15848 const ats = (el.closest('.cart-and-ipay').find('#qtyValue_' + pid).attr('data-ats') || '').replace(/,/g, ''); 15849 const perpetual = el.closest('.cart-and-ipay').find('#qtyValue_' + pid).attr('data-perpetual'); 15850 if (parseInt(selectedQuantity)<=0 || isNaN(parseInt(selectedQuantity))) { 15851 if ($('.add-to-cart-messages').length === 0) { 15852 $('body').append('<div class="add-to-cart-messages"></div>'); 15853 } 15854 $('.add-to-cart-messages').html(`<div class="alert alert-danger add-to-basket-alert text-center" role="alert">Atleast Select 1 Quantity</div>`); 15855 $.spinner().stop(); 15856 return 0; 15857 } 15858 if ((parseInt(selectedQuantity) > parseInt(ats)) && perpetual!='true' ) { 15859 if ($('.add-to-cart-messages').length === 0) { 15860 $('body').append('<div class="add-to-cart-messages"></div>'); 15861 } 15862 $('.add-to-cart-messages').html(`<div class="alert alert-danger add-to-basket-alert text-center" role="alert">Selected quantity not available</div>`); 15863 $.spinner().stop(); 15864 return 0; 15865 } 15866 15867 15868 let $productContainer = $(this).closest('.product-detail');
15869 if (!$productContainer.length) { 15870 $productContainer = $(this).closest('.quick-view-dialog').find('.product-detail'); 15871 } 15872 15873 const addToCartUrl = getAddToCartUrl(el); 15874 15875 const form = { 15876 pid, 15877 quantity: selectedQuantity, 15878 }; 15879 15880 $(this).trigger('updateAddToCartFormData', form); 15881 if (addToCartUrl) { 15882 $.ajax({ 15883 url: addToCartUrl, 15884 method: 'POST', 15885 data: form, 15886 success(data) { 15887 handlePostCartAdd(data, el); 15888 $('body').trigger('product:afterAddToCart', data); 15889 $.spinner().stop(); 15890 miniCartReportingUrl(data.reportingURL); 15891 if(!data.error){ 15892 var databonusdiscountlineItem=data.newBonusDiscountLineItem; 15893 $(".minicart-link").removeClass('disable-minicart-link'); 15894 $('html, body').animate({ 15895 scrollTop: 0 15896 }, 500); 15897 var isMobile = $(window).width()< 768; 15898 if (!isMobile && (databonusdiscountlineItem && Object.keys(databonusdiscountlineItem).length === 0 && Object.getPrototypeOf(databonusdiscountlineItem) === Object.prototype)) { 15899 var url = $('.minicart').data('action-url'); 15900 var count = parseInt($('.minicart .minicart-quantity').text(), 10); 15901 if (count !== 0 && $('.minicart .popover.show').length === 0) { 15902 $('.minicart .popover').addClass('show'); 15903 $('.minicart .popover').spinner().start(); 15904 $.get(url, function (data) { 15905 $('.minicart .popover').empty(); 15906 $('.minicart .popover').append(data); 15907 $.spinner().stop(); 15908 }); 15909 } 15910 } 15911 15912 if(reloadPage){ 15913 window.location.reload(); 15914 } 15915 } 15916 }, 15917 error() { 15918 $.spinner().stop(); 15919 }, 15920 }); 15921 } 15922 }); 15923 }, 15924 // updateMinicart() { 15925 // $('body').on('cart:update', () => { 15926 // updateQuantities(); 15927 // }); 15928 // }, 15929 // tileLoad: updateQuantities, 15930 updateQuantityPLP() { 15931 var minVal = 1; 15932 $(document).on('click', '.increaseQty', function (e) { 15933 e.stopImmediatePropagation(); 15934 e.preventDefault(); 15935 var $parentElm = $(this).parents(".qtySelector"); 15936 var value = $parentElm.find(".qtyValue").val(); 15937 var ats = ($parentElm.find(".qtyValue").attr('data-ats') || '').replace(/,/g, ''); 15938 var perpetual = $parentElm.find(".qtyValue").attr('data-perpetual'); 15939 if (parseInt(value) < parseInt(ats) || perpetual=='true') { 15940 value++; 15941 } 15942 $parentElm.find(".qtyValue").val(value); 15943 $('.update-cart-url').data('selected-quantity', value); 15944 }); 15945 $(document).on('click', '.decreaseQty', function (e) { 15946 e.stopImmediatePropagation(); 15947 e.preventDefault(); 15948 var $parentElm = $(this).parents(".qtySelector"); 15949 var value = $parentElm.find(".qtyValue").val(); 15950 if (value > 1) { 15951 value--; 15952 } 15953 $parentElm.find(".qtyValue").val(value); 15954 $('.update-cart-url').data('selected-quantity', value); 15955 }); 15956 $(document).on('change', '.qtySelector-eys-input', function () { 15957 var value =$(this).val(); 15958 if (value<=0) { 15959 if ($('.add-to-cart-messages').length === 0) { 15960 $('body').append('<div class="add-to-cart-messages"></div>'); 15961 } 15962 $('.add-to-cart-messages').append(`<div class="alert alert-danger add-to-basket-alert text-center" role="alert">Atleast Select 1 Quantity</div>`); 15963 $.spinner().stop(); 15964 return 0; 15965 } 15966 $('.update-cart-url').data('selected-quantity', value); 15967 }); 15968 } 15969}; 15970 15971$(document).off('mouseover', '.product-eys-tile .product-image').on('mouseover', '.product-eys-tile .product-image', function () { 15972 $(this).closest('.product-image').addClass('fade-eys'); 15973 15974}); 15975 15976$(document).off('mouseleave', '.product-eys-tile .product-image').on('mouseleave', '.product-eys-tile .product-image', function () { 15977 $(this).closest('.product-eys-tile .product-image').removeClass('fade-eys'); 15978}); 15979 15980$(document).off('click', '.price-toggle').on('click', '.price-toggle',function () { 15981 if ($(this).hasClass("expanded")) { 15982 $(".price-toggle").removeClass("expanded"); 15983 $(this).parents('.ref-card-body').children('.refinement-price').css("display", "none"); 15984 } else { 15985 $(".price-toggle").removeClass("expanded"); 15986 $(this).addClass("expanded"); 15987 $(this).parents('.ref-card-body').children('.refinement-price').css("display", "block"); 15988 } 15989}); 15990$(document).off('click', '.shop-toggle').on('click', '.shop-toggle',function () { 15991 if ($(this).hasClass("expanded")) { 15992 $(".shop-toggle").removeClass("expanded"); 15993 $(this).parents('.ref-card-body').children('.refinement-shop').css("display", "none"); 15994 } else { 15995 $(".shop-toggle").removeClass("expanded"); 15996 $(this).addClass("expanded"); 15997 $(this).parents('.ref-card-body').children('.refinement-shop').css("display", "block"); 15998 } 15999}); 16000 16001$(document).off('click', '.category-toggle').on('click', '.category-toggle',function () { 16002 if ($(this).hasClass("expanded")) { 16003 $(".category-toggle").removeClass("expanded"); 16004 $(this).parents('.ref-card-body').children('.ref-main-ul').css("display", "none"); 16005 } else { 16006 $(".category-toggle").removeClass("expanded"); 16007 $(this).addClass("expanded"); 16008 $(this).parents('.ref-card-body').children('.ref-main-ul').css("display", "block"); 16009 } 16010}); 16011 16012$(document).off('click', '.eys-filter-attributes').on('click', '.eys-filter-attributes',function () { 16013 16014 if ($(this).hasClass("expanded")) { 16015 $(".eys-filter-attributes").removeClass("expanded"); 16016 $('.'+$(this).data('target')).css("display", "none"); 16017 } else { 16018 $(".eys-filter-attributes").removeClass("expanded"); 16019 $(this).addClass("expanded"); 16020 $('.'+$(this).data('target')).css("display", "block"); 16021 } 16022}); 16023 16024 16025/***/ }), 16026 16027/***/ 312: 16028/***/ (function(module, exports, __webpack_require__) { 16029 16030"use strict"; 16031 16032 16033var base = __webpack_require__(5); 16034var detail = __webpack_require__(313); 16035 16036/** 16037 * Makes a call to the server to report the event of adding an item to the cart 16038 * 16039 * @param {string | boolean} url - a string representing the end point to hit so that the event can be recorded, or false 16040 */ 16041function miniCartReportingUrl(url) { 16042 if (url) { 16043 $.ajax({
16044 url: url, 16045 method: 'GET', 16046 success: function () { 16047 // reporting urls hit on the server 16048 }, 16049 error: function () { 16050 // no reporting urls hit on the server 16051 } 16052 }); 16053 } 16054} 16055 16056/** 16057 * Parses the html for a modal window 16058 * @param {string} html - representing the body and footer of the modal window 16059 * 16060 * @return {Object} - Object with properties body and footer. 16061 */ 16062function parseHtml(html) { 16063 const $html = $('<div>').append($.parseHTML(html)); 16064 16065 const body = $html.find('.choice-of-bonus-product'); 16066 const footer = $html.find('.modal-footer').children(); 16067 16068 return { body, footer }; 16069} 16070/** 16071 * Retrieves url to use when adding a product to the cart 16072 * 16073 * @param {Object} data - data object used to fill in dynamic portions of the html 16074 */ 16075 function chooseBonusProducts(data) { 16076 $('.modal-body').spinner().start(); 16077 16078 if ($('#chooseBonusProductModal').length !== 0) { 16079 $('#chooseBonusProductModal').remove(); 16080 } 16081 let bonusUrl; 16082 if (data.bonusChoiceRuleBased) { 16083 bonusUrl = data.showProductsUrlRuleBased; 16084 } else { 16085 bonusUrl = data.showProductsUrlListBased; 16086 } 16087 16088 const htmlString = `${'<!-- Modal -->' + 16089 '<div class="modal fade" id="chooseBonusProductModal" tabindex="-1" role="dialog">' + 16090 '<span class="enter-message sr-only" ></span>' + 16091 '<div class="modal-dialog choose-bonus-product-dialog modal-dialog-centered" ' + 16092 'data-total-qty="'}${data.maxBonusItems}"` + 16093 `data-UUID="${data.uuid}"` + 16094 `data-pliUUID="${data.pliUUID}"` + 16095 `data-addToCartUrl="${data.addToCartUrl}"` + 16096 'data-pageStart="0"' + 16097 `data-pageSize="${data.pageSize}"` + 16098 `data-moreURL="${data.showProductsUrlRuleBased}"` + 16099 `data-bonusChoiceRuleBased="${data.bonusChoiceRuleBased}">` + 16100 '<!-- Modal content-->' + 16101 '<div class="modal-content">' + 16102 '<div class="modal-header">' + 16103 ` <span class="">${data.labels.selectprods}</span>` + 16104 ' <button type="button" class="close pull-right" data-dismiss="modal">' + 16105 ' <span aria-hidden="true">×</span>' + 16106 ' <span class="sr-only"> </span>' + 16107 ' </button>' + 16108 '</div>' + 16109 '<div class="modal-body"></div>' + 16110 '<div class="modal-footer"></div>' + 16111 '</div>' + 16112 '</div>' + 16113 '</div>'; 16114 $('body').append(htmlString); 16115 $('.modal-body').spinner().start(); 16116 16117 $.ajax({
16118 url: bonusUrl, 16119 method: 'GET', 16120 dataType: 'json', 16121 success(response) { 16122 const parsedHtml = parseHtml(response.renderedTemplate); 16123 $('#chooseBonusProductModal .modal-body').empty(); 16124 $('#chooseBonusProductModal .enter-message').text(response.enterDialogMessage); 16125 $('#chooseBonusProductModal .modal-header .close .sr-only').text(response.closeButtonText); 16126 $('#chooseBonusProductModal .modal-body').html(parsedHtml.body); 16127 $('#chooseBonusProductModal .modal-footer').html(parsedHtml.footer); 16128 $('#chooseBonusProductModal').modal('show'); 16129 $.spinner().stop(); 16130 }, 16131 error() { 16132 $.spinner().stop(); 16133 }, 16134 }); 16135} 16136 16137/** 16138 * Updates the Mini-Cart quantity value after the customer has pressed the "Add to Cart" button 16139 * @param {string} response - ajax response from clicking the add to cart button 16140 */ 16141function handlePostCartAdd(response) { 16142 $('.minicart').trigger('count:update', response); 16143 var messageType = response.error ? 'alert-danger' : 'alert-success'; 16144 // show add to cart toast 16145 if (response.newBonusDiscountLineItem && 16146 Object.keys(response.newBonusDiscountLineItem).length !== 0) { 16147 chooseBonusProducts(response.newBonusDiscountLineItem); 16148 } else { 16149 if ($('.add-to-cart-messages').length === 0) { 16150 $('body').append( 16151 '<div class="add-to-cart-messages"></div>' 16152 ); 16153 } 16154 16155 var isMobile = $(window).width()< 768; 16156 if(response.error || (!response.error && isMobile)){ 16157 $('.add-to-cart-messages').append(`<div class="alert ${messageType} add-to-basket-alert text-center" role="alert">${ 16158 response.message 16159 }</div>`); 16160 } 16161 16162 setTimeout(function () { 16163 $('.add-to-basket-alert').remove(); 16164 }, 5000); 16165 } 16166} 16167 16168/** 16169 * Retrieves the relevant pid value 16170 * @param {jquery} $el - DOM container for a given add to cart button 16171 * @return {string} - value to be used when adding product to cart 16172 */ 16173function getPidValue($el) { 16174 var pid; 16175 16176 if ($('#quickViewModal').hasClass('show') && !$('.product-set').length) { 16177 pid = $($el).closest('.modal-content').find('.product-quickview').data('pid'); 16178 } else if ($('.product-set-detail').length || $('.product-set').length) { 16179 pid = $($el).closest('.product-detail').find('.product-id').text(); 16180 } else { 16181 pid = $('.product-detail:not(".bundle-item")').data('pid'); 16182 } 16183 16184 return pid; 16185} 16186 16187/** 16188 * Retrieves url to use when adding a product to the cart 16189 * 16190 * @return {string} - The provided URL to use when adding a product to the cart 16191 */ 16192function getAddToCartUrl() { 16193 return $('.add-to-cart-url').val(); 16194} 16195 16196function addToCart() { 16197 $(document).on('click', 'button.add-to-cart-custom', function (e) { 16198 var elem = $(this); 16199 e.preventDefault(); 16200 e.stopPropagation(); 16201 var addToCartUrl; 16202 var pid; 16203 $('body').trigger('product:beforeAddToCart', this); 16204 16205 pid = getPidValue($(this)); 16206 const selectedQuantity = $(this).closest('.attributes').find('#qtyValue_' + pid).val(); 16207 const ats = ($(this).closest('.attributes').find('#qtyValue_' + pid).attr('data-ats') || '').replace(/,/g, ''); 16208 const perpetual = $(this).closest('.attributes').find('#qtyValue_' + pid).attr('data-perpetual'); 16209 if (parseInt(selectedQuantity) <1 || isNaN(parseInt(selectedQuantity))) { 16210 if ($('.add-to-cart-messages').length === 0) { 16211 $(this).closest('.attributes').find('.eys-quick-qauntity').append('<div class="add-to-cart-messages"></div>'); 16212 } 16213 $('.add-to-cart-messages').html(`<div class="alert alert-danger add-to-basket-alert text-center" role="alert">please Select atleast one quantity</div>`); 16214 $.spinner().stop(); 16215 return 0; 16216 } 16217 if ((parseInt(selectedQuantity) > parseInt(ats)) && perpetual!='true') { 16218 if ($('.add-to-cart-messages').length === 0) { 16219 $(this).closest('.attributes').find('.eys-quick-qauntity').append('<div class="add-to-cart-messages"></div>'); 16220 } 16221 $('.add-to-cart-messages').html(`<div class="alert alert-danger add-to-basket-alert text-center" role="alert">Selected quantity not available</div>`); 16222 $.spinner().stop(); 16223 return 0; 16224 } 16225
16226 var $productContainer = $(this).closest('.product-detail'); 16227 if (!$productContainer.length) { 16228 $productContainer = $(this).closest('.quick-view-dialog').find('.product-detail'); 16229 } 16230 16231 addToCartUrl = getAddToCartUrl(); 16232 16233 var form = { 16234 pid: pid, 16235 quantity: selectedQuantity 16236 }; 16237 16238 $(this).trigger('updateAddToCartFormData', form); 16239 if (addToCartUrl) { 16240 $.ajax({ 16241 url: addToCartUrl, 16242 method: 'POST', 16243 data: form, 16244 success: function (data) { 16245 handlePostCartAdd(data); 16246 $('body').trigger('product:afterAddToCart', data); 16247 $.spinner().stop(); 16248 miniCartReportingUrl(data.reportingURL); 16249 if(!data.error){ 16250 $(".minicart-link").removeClass('disable-minicart-link'); 16251 $('html, body').animate({ 16252 scrollTop: 0 16253 }, 500); 16254 var isMobile = $(window).width()< 768; 16255 var databonusdiscountlineItem=data.newBonusDiscountLineItem; 16256 if (!isMobile && (databonusdiscountlineItem && Object.keys(databonusdiscountlineItem).length === 0 && Object.getPrototypeOf(databonusdiscountlineItem) === Object.prototype)) { 16257 var url = $('.minicart').data('action-url'); 16258 var count = parseInt($('.minicart .minicart-quantity').text(), 10); 16259 if (count !== 0 && $('.minicart .popover.show').length === 0) { 16260 $('.minicart .popover').addClass('show'); 16261 $('.minicart .popover').spinner().start(); 16262 $.get(url, function (data) { 16263 $('.minicart .popover').empty(); 16264 $('.minicart .popover').append(data); 16265 $.spinner().stop(); 16266 }); 16267 } 16268 } 16269 } 16270 }, 16271 error: function () { 16272 $.spinner().stop(); 16273 } 16274 }); 16275 } 16276 }); 16277 $(document).on('click', 'button.add-to-cart-global-custom', function (e) { 16278 e.preventDefault(); 16279 e.stopPropagation(); 16280 var addToCartUrl; 16281 var pid; 16282 $('body').trigger('product:beforeAddToCart', this); 16283 pid = getPidValue($(this)); 16284 const selectedQuantity = $(this).closest('.attributes').find('#qtyValue_' + pid).val(); 16285 const ats = ($(this).closest('.attributes').find('#qtyValue_' + pid).attr('data-ats') || '').replace(/,/g, ''); 16286 const perpetual = $(this).closest('.attributes').find('#qtyValue_' + pid).attr('data-perpetual'); 16287 if (parseInt(selectedQuantity) > parseInt(ats) && perpetual!='true') { 16288 if ($('.add-to-cart-messages').length === 0) { 16289 $('body').append('<div class="add-to-cart-messages"></div>'); 16290 } 16291 $('.add-to-cart-messages').append(`<div class="alert alert-danger add-to-basket-alert text-center" role="alert">Selected quantity not available</div>`); 16292 $.spinner().stop(); 16293 return 0; 16294 } 16295 16296 var $productContainer = $(this).closest('.product-detail');
16297 if (!$productContainer.length) { 16298 $productContainer = $(this).closest('.quick-view-dialog').find('.product-detail'); 16299 } 16300 16301 addToCartUrl = getAddToCartUrl(); 16302 16303 var form = { 16304 pid: pid, 16305 quantity: selectedQuantity 16306 }; 16307 16308 $(this).trigger('updateAddToCartFormData', form); 16309 if (addToCartUrl) { 16310 $.ajax({ 16311 url: addToCartUrl, 16312 method: 'POST', 16313 data: form, 16314 success: function (data) { 16315 handlePostCartAdd(data); 16316 $('body').trigger('product:afterAddToCart', data); 16317 $.spinner().stop(); 16318 miniCartReportingUrl(data.reportingURL); 16319 if(!data.error){ 16320 $(".minicart-link").removeClass('disable-minicart-link'); 16321 $('html, body').animate({ 16322 scrollTop: 0 16323 }, 500); 16324 var isMobile = $(window).width()< 768; 16325 var databonusdiscountlineItem=data.newBonusDiscountLineItem; 16326 if (!isMobile && (databonusdiscountlineItem && Object.keys(databonusdiscountlineItem).length === 0 && Object.getPrototypeOf(databonusdiscountlineItem) === Object.prototype)) { 16327 var url = $('.minicart').data('action-url'); 16328 var count = parseInt($('.minicart .minicart-quantity').text(), 10); 16329 if (count !== 0 && $('.minicart .popover.show').length === 0) { 16330 $('.minicart .popover').addClass('show'); 16331 $('.minicart .popover').spinner().start(); 16332 $.get(url, function (data) { 16333 $('.minicart .popover').empty(); 16334 $('.minicart .popover').append(data); 16335 $.spinner().stop(); 16336 }); 16337 } 16338 } 16339 } 16340 }, 16341 error: function () { 16342 $.spinner().stop(); 16343 } 16344 }); 16345 } 16346 }); 16347} 16348 16349function writeReview() { 16350 $(document).on('click', 'button.bv-write-review-custom', function (e) { 16351 e.preventDefault(); 16352 if ($(document).find('button.bv-write-review').length) { 16353 $(document).find('button.bv-write-review').click(); 16354 } 16355 if ($(document).find('button.bv-first-to-review').length) { 16356 $(document).find('button.bv-first-to-review').click(); 16357 } 16358 if ($(document).find('button.bv-ask-question-custom').length) { 16359 $(document).find('button.bv-ask-question').click(); 16360 } 16361 if ($(document).find('button.bv-ask-question-custom').length) { 16362 $(document).find('button.bv-first-to-ask-question').click(); 16363 } 16364 }); 16365 16366 $(document).ready(function() { 16367 var intervalCount = 0; 16368 var customInterval = setInterval(function() { 16369 intervalCount++; 16370 16371 if (intervalCount >= 100) { 16372 clearInterval(customInterval); 16373 } 16374 if ($(document).find('.bv_averageRating_component_container .bv_text').length) { 16375 $('div[class="bv_averageRating_component_container"]').each(function(index,item){ 16376 var rating = parseFloat($(item).find('.bv_text').text()); 16377 if (rating <= 0) { 16378 $(item).closest("[data-bv-show]").hide() 16379 } 16380 }); 16381 clearInterval(customInterval); 16382 } 16383 }, 200); 16384 }); 16385} 16386 16387 16388var exportDetails = $.extend({}, base, detail, { 16389 addToCart: addToCart, 16390 writeReview: writeReview 16391}); 16392module.exports = exportDetails; 16393 16394/***/ }), 16395 16396/***/ 313: 16397/***/ (function(module, exports, __webpack_require__) { 16398 16399"use strict"; 16400 16401var base = __webpack_require__(5); 16402 16403/** 16404 * Enable/disable UI elements 16405 * @param {boolean} enableOrDisable - true or false 16406 */ 16407function updateAddToCartEnableDisableOtherElements(enableOrDisable) { 16408 $('button.add-to-cart-global').attr('disabled', enableOrDisable); 16409} 16410 16411module.exports = { 16412 methods: { 16413 updateAddToCartEnableDisableOtherElements: updateAddToCartEnableDisableOtherElements 16414 }, 16415 16416 availability: base.availability, 16417 16418 addToCart: base.addToCart, 16419 16420 updateAttributesAndDetails: function () { 16421 $('body').on('product:statusUpdate', function (e, data) {
16422 var $productContainer = $('.product-detail[data-pid="' + data.id + '"]'); 16423 16424 $productContainer.find('.description-and-detail .product-attributes') 16425 .empty() 16426 .html(data.attributesHtml); 16427 16428 if (data.shortDescription) { 16429 $productContainer.find('.description-and-detail .description') 16430 .removeClass('hidden-xl-down'); 16431 $productContainer.find('.description-and-detail .description .content') 16432 .empty() 16433 .html(data.shortDescription); 16434 } else { 16435 $productContainer.find('.description-and-detail .description') 16436 .addClass('hidden-xl-down'); 16437 } 16438 16439 if (data.longDescription) { 16440 $productContainer.find('.description-and-detail .details') 16441 .removeClass('hidden-xl-down'); 16442 $productContainer.find('.description-and-detail .details .content') 16443 .empty() 16444 .html(data.longDescription); 16445 } else { 16446 $productContainer.find('.description-and-detail .details') 16447 .addClass('hidden-xl-down'); 16448 } 16449 }); 16450 }, 16451 16452 showSpinner: function () { 16453 $('body').on('product:beforeAddToCart product:beforeAttributeSelect', function () { 16454 $.spinner().start(); 16455 }); 16456 }, 16457 updateAttribute: function () { 16458 $('body').on('product:afterAttributeSelect', function (e, response) { 16459 if ($('.product-detail>.bundle-items').length) { 16460 response.container.data('pid', response.data.product.id); 16461 response.container.find('.product-id').text(response.data.product.id); 16462 } else if ($('.product-set-detail').eq(0)) { 16463 response.container.data('pid', response.data.product.id); 16464 response.container.find('.product-id').text(response.data.product.id); 16465 } else { 16466 $('.product-id').text(response.data.product.id); 16467 $('.product-detail:not(".bundle-item")').data('pid', response.data.product.id); 16468 } 16469 }); 16470 }, 16471 updateAddToCart: function () { 16472 $('body').on('product:updateAddToCart', function (e, response) { 16473 // update local add to cart (for sets) 16474 $('button.add-to-cart', response.$productContainer).attr('disabled', 16475 (!response.product.readyToOrder || !response.product.available)); 16476 16477 var enable = $('.product-availability').toArray().every(function (item) { 16478 return $(item).data('available') && $(item).data('ready-to-order'); 16479 }); 16480 module.exports.methods.updateAddToCartEnableDisableOtherElements(!enable); 16481 }); 16482 }, 16483 updateAvailability: function () { 16484 $('body').on('product:updateAvailability', function (e, response) { 16485 $('div.availability', response.$productContainer) 16486 .data('ready-to-order', response.product.readyToOrder) 16487 .data('available', response.product.available); 16488 16489 $('.availability-msg', response.$productContainer) 16490 .empty().html(response.message); 16491 16492 if ($('.global-availability').length) { 16493 var allAvailable = $('.product-availability').toArray() 16494 .every(function (item) { return $(item).data('available'); }); 16495 16496 var allReady = $('.product-availability').toArray() 16497 .every(function (item) { return $(item).data('ready-to-order'); }); 16498 16499 $('.global-availability') 16500 .data('ready-to-order', allReady) 16501 .data('available', allAvailable); 16502 16503 $('.global-availability .availability-msg').empty() 16504 .html(allReady ? response.message : response.resources.info_selectforstock); 16505 } 16506 }); 16507 }, 16508 sizeChart: function () { 16509 $('.size-chart a').on('click', function (e) { 16510 e.preventDefault(); 16511 var url = $(this).attr('href'); 16512 var $prodSizeChart = $(this).closest('.size-chart').find('.size-chart-collapsible'); 16513 if ($prodSizeChart.is(':empty')) { 16514 $.ajax({
16515 url: url, 16516 type: 'get', 16517 dataType: 'json', 16518 success: function (data) { 16519 $prodSizeChart.append(data.content); 16520 } 16521 }); 16522 } 16523 $prodSizeChart.toggleClass('active'); 16524 }); 16525 16526 var $sizeChart = $('.size-chart-collapsible'); 16527 $('body').on('click touchstart', function (e) { 16528 if ($('.size-chart').has(e.target).length <= 0) { 16529 $sizeChart.removeClass('active'); 16530 } 16531 }); 16532 }, 16533 copyProductLink: function () { 16534 $('body').on('click', '#fa-link', function () { 16535 event.preventDefault(); 16536 var $temp = $('<input>'); 16537 $('body').append($temp); 16538 $temp.val($('#shareUrl').val()).select(); 16539 document.execCommand('copy'); 16540 $temp.remove(); 16541 $('.copy-link-message').attr('role', 'alert'); 16542 $('.copy-link-message').removeClass('d-none'); 16543 setTimeout(function () { 16544 $('.copy-link-message').addClass('d-none'); 16545 }, 3000); 16546 }); 16547 }, 16548 16549 focusChooseBonusProductModal: base.focusChooseBonusProductModal() 16550}; 16551 16552 16553/***/ }), 16554 16555/***/ 314: 16556/***/ (function(module, exports, __webpack_require__) { 16557 16558"use strict"; 16559 16560 16561 16562/** 16563 * appends params to a url 16564 * @param {string} data - data returned from the server's ajax call 16565 * @param {Object} button - button that was clicked to add a product to the wishlist 16566 */ 16567function displayMessage(data, button) { 16568 $.spinner().stop(); 16569 var status; 16570 if (data.success) { 16571 status = 'alert-success'; 16572 } else { 16573 status = 'alert-danger'; 16574 } 16575 16576 if ($('.add-to-wishlist-messages').length === 0) { 16577 $('body').append( 16578 '<div class="add-to-wishlist-messages "></div>' 16579 ); 16580 } 16581 $('.add-to-wishlist-messages') 16582 .append('<div class="add-to-wishlist-alert text-center ' + status + '">' + data.msg + '</div>'); 16583 16584 setTimeout(function () { 16585 $('.add-to-wishlist-messages').remove(); 16586 button.removeAttr('disabled'); 16587 }, 5000); 16588} 16589 16590 16591/** 16592 * Makes a call to the server to report the event of adding an item to the cart 16593 * 16594 * @param {string | boolean} url - a string representing the end point to hit so that the event can be recorded, or false 16595 */ 16596 function miniCartReportingUrl(url) { 16597 if (url) { 16598 $.ajax({
16599 url: url, 16600 method: 'GET', 16601 success: function () { 16602 // reporting urls hit on the server 16603 }, 16604 error: function () { 16605 // no reporting urls hit on the server 16606 } 16607 }); 16608 } 16609} 16610 16611/** 16612 * Updates the Mini-Cart quantity value after the customer has pressed the "Add to Cart" button 16613 * @param {string} response - ajax response from clicking the add to cart button 16614 */ 16615function handlePostCartAdd(response) { 16616 $('.minicart').trigger('count:update', response); 16617 var messageType = response.error ? 'alert-danger' : 'alert-success'; 16618 // show add to cart toast 16619 if (response.newBonusDiscountLineItem && 16620 Object.keys(response.newBonusDiscountLineItem).length !== 0) { 16621 chooseBonusProducts(response.newBonusDiscountLineItem); 16622 } else { 16623 if ($('.add-to-cart-messages').length === 0) { 16624 $('body').append( 16625 '<div class="add-to-cart-messages"></div>' 16626 ); 16627 } 16628 var isMobile = $(window).width()< 768; 16629 if(response.error || (!response.error && isMobile)){ 16630 $('.add-to-cart-messages').append( 16631 '<div class="alert ' + messageType + ' add-to-basket-alert text-center" role="alert">' + 16632 response.message + 16633 '</div>' 16634 ); 16635 } 16636 16637 setTimeout(function () { 16638 $('.add-to-basket-alert').remove(); 16639 }, 5000); 16640 } 16641} 16642module.exports = { 16643 addToWishlist: function () { 16644 $('body').off('click', '.add-to-wish-list').on('click', '.add-to-wish-list', function (e) { 16645 e.preventDefault(); 16646 var url = $(this).data('href'); 16647 var button = $(this); 16648 if ($(this).closest('.cart-wishlist-block').length > 0) { 16649 var pid = $(this).parent('.cart-wishlist-block').attr('id'); 16650 var optionId = $(this).closest('.cart-wishlist-block').find('.product-option').attr('data-option-id'); 16651 var optionVal = $(this).closest('.cart-wishlist-block').find('.options-select option:selected').attr('data-value-id'); 16652 } else { 16653 var pid = $(this).closest('.product-detail').find('.product-id').html(); 16654 var optionId = $(this).closest('.product-detail').find('.product-option').attr('data-option-id'); 16655 var optionVal = $(this).closest('.product-detail').find('.options-select option:selected').attr('data-value-id'); 16656 } 16657 optionId = optionId || null; 16658 optionVal = optionVal || null; 16659 if (!url || !pid) { 16660 return; 16661 } 16662 16663 $.spinner().start(); 16664 $(this).attr('disabled', true); 16665 $.ajax({
16666 url: url, 16667 type: 'post', 16668 dataType: 'json', 16669 data: { 16670 pid: pid, 16671 optionId: optionId, 16672 optionVal: optionVal 16673 }, 16674 success: function (data) { 16675 if (data.redirect) { 16676 window.location.href = data.url; 16677 } 16678 displayMessage(data, button); 16679 }, 16680 error: function (err) { 16681 displayMessage(err, button); 16682 } 16683 }); 16684 }); 16685 }, 16686 addToCart: function () { 16687 $(document).on('click', 'button.add-to-cart-custom-wishlist', function (e) { 16688 var elem = $(this); 16689 e.preventDefault(); 16690 e.stopPropagation(); 16691 var addToCartUrl; 16692 var pid; 16693 pid = $(this).attr('data-pid'); 16694 const selectedQuantity = $(this).closest('.product-card-price').find('#qtyValue_' + pid).val(); 16695 const ats = $(this).closest('.product-card-price').find('#qtyValue_' + pid).attr('data-ats'); 16696 const perpetual = $(this).closest('.product-card-price').find('#qtyValue_' + pid).attr('data-perpetual'); 16697 if (parseInt(selectedQuantity) < 1 || isNaN(parseInt(selectedQuantity))) { 16698 console.log('here'); 16699 if ($('.add-to-cart-messages').length === 0) { 16700 $(this).closest('.product-card-price').find('.quantity-form-wishlist').append('<div class="add-to-cart-messages"></div>'); 16701 } 16702 $('.add-to-cart-messages').html(`<div class="alert alert-danger add-to-basket-alert text-center" role="alert">please Select atleast one quantity</div>`); 16703 $.spinner().stop(); 16704 return 0; 16705 } 16706 if ((parseInt(selectedQuantity) > parseInt(ats)) && perpetual != 'true') { 16707 if ($('.add-to-cart-messages').length === 0) { 16708 $(this).closest('.product-card-price').find('.quantity-form-wishlist').append('<div class="add-to-cart-messages"></div>'); 16709 } 16710 $('.add-to-cart-messages').html(`<div class="alert alert-danger add-to-basket-alert text-center" role="alert">Selected quantity not available</div>`); 16711 $.spinner().stop(); 16712 return 0; 16713 } 16714 addToCartUrl = $(this).closest('.product-card-price').find('#qtyValue_' + pid).attr('data-action'); 16715 var form = { 16716 pid: pid, 16717 quantity: selectedQuantity 16718 }; 16719 if (addToCartUrl) { 16720 $.ajax({
16721 url: addToCartUrl, 16722 method: 'POST', 16723 data: form, 16724 success: function (data) { 16725 handlePostCartAdd(data); 16726 $('body').trigger('product:afterAddToCart', data); 16727 $.spinner().stop(); 16728 miniCartReportingUrl(data.reportingURL); 16729 if (!data.error) { 16730 $(".minicart-link").removeClass('disable-minicart-link'); 16731 $('html, body').animate({ 16732 scrollTop: 0 16733 }, 500); 16734 var isMobile = $(window).width() < 768; 16735 var databonusdiscountlineItem=data.newBonusDiscountLineItem; 16736 if (!isMobile && (databonusdiscountlineItem && Object.keys(databonusdiscountlineItem).length === 0 && Object.getPrototypeOf(databonusdiscountlineItem) === Object.prototype)) { 16737 var url = $('.minicart').data('action-url'); 16738 var count = parseInt($('.minicart .minicart-quantity').text(), 10); 16739 if (count !== 0 && $('.minicart .popover.show').length === 0) { 16740 $('.minicart .popover').addClass('show'); 16741 $('.minicart .popover').spinner().start(); 16742 $.get(url, function (data) { 16743 $('.minicart .popover').empty(); 16744 $('.minicart .popover').append(data); 16745 $.spinner().stop(); 16746 }); 16747 } 16748 } 16749 16750 } 16751 }, 16752 error: function () { 16753 $.spinner().stop(); 16754 } 16755 }); 16756 } 16757 }); 16758 } 16759}; 16760 16761 16762/***/ }), 16763 16764/***/ 315: 16765/***/ (function(module, exports) { 16766 16767!function(a,b,c,d){function e(b,c){this.settings=null,this.options=a.extend({},e.Defaults,c),this.$element=a(b),this._handlers={},this._plugins={},this._supress={},this._current=null,this._speed=null,this._coordinates=[],this._breakpoint=null,this._width=null,this._items=[],this._clones=[],this._mergers=[],this._widths=[],this._invalidated={},this._pipe=[],this._drag={time:null,target:null,pointer:null,stage:{start:null,current:null},direction:null},this._states={current:{},tags:{initializing:["busy"],animating:["busy"],dragging:["interacting"]}},a.each(["onResize","onThrottledResize"],a.proxy(function(b,c){this._handlers[c]=a.proxy(this[c],this)},this)),a.each(e.Plugins,a.proxy(function(a,b){this._plugins[a.charAt(0).toLowerCase()+a.slice(1)]=new b(this)},this)),a.each(e.Workers,a.proxy(function(b,c){this._pipe.push({filter:c.filter,run:a.proxy(c.run,this)})},this)),this.setup(),this.initialize()}e.Defaults={items:3,loop:!1,center:!1,rewind:!1,mouseDrag:!0,touchDrag:!0,pullDrag:!0,freeDrag:!1,margin:0,stagePadding:0,merge:!1,mergeFit:!0,autoWidth:!1,startPosition:0,rtl:!1,smartSpeed:250,fluidSpeed:!1,dragEndSpeed:!1,responsive:{},responsiveRefreshRate:200,responsiveBaseElement:b,fallbackEasing:"swing",info:!1,nestedItemSelector:!1,itemElement:"div",stageElement:"div",refreshClass:"owl-refresh",loadedClass:"owl-loaded",loadingClass:"owl-loading",rtlClass:"owl-rtl",responsiveClass:"owl-responsive",dragClass:"owl-drag",itemClass:"owl-item",stageClass:"owl-stage",stageOuterClass:"owl-stage-outer",grabClass:"owl-grab"},e.Width={Default:"default",Inner:"inner",Outer:"outer"},e.Type={Event:"event",State:"state"},e.Plugins={},e.Workers=[{filter:["width","settings"],run:function(){this._width=this.$element.width()}},{filter:["width","items","settings"],run:function(a){a.current=this._items&&this._items[this.relative(this._current)]}},{filter:["items","settings"],run:function(){this.$stage.children(".cloned").remove()}},{filter:["width","items","settings"],run:function(a){var b=this.settings.margin||"",c=!this.settings.autoWidth,d=this.settings.rtl,e={width:"auto","margin-left":d?b:"","margin-right":d?"":b};!c&&this.$stage.children().css(e),a.css=e}},{filter:["width","items","settings"],run:function(a){var b=(this.width()/this.settings.items).toFixed(3)-this.settings.margin,c=null,d=this._items.length,e=!this.settings.autoWidth,f=[];for(a.items={merge:!1,width:b};d--;)c=this._mergers[d],c=this.settings.mergeFit&&Math.min(c,this.settings.items)||c,a.items.merge=c>1||a.items.merge,f[d]=e?b*c:this._items[d].width();this._widths=f}},{filter:["items","settings"],run:function(){var b=[],c=this._items,d=this.settings,e=Math.max(2*d.items,4),f=2*Math.ceil(c.length/2),g=d.loop&&c.length?d.rewind?e:Math.max(e,f):0,h="",i="";for(g/=2;g--;)b.push(this.normalize(b.length/2,!0)),h+=c[b[b.length-1]][0].outerHTML,b.push(this.normalize(c.length-1-(b.length-1)/2,!0)),i=c[b[b.length-1]][0].outerHTML+i;this._clones=b,a(h).addClass("cloned").appendTo(this.$stage),a(i).addClass("cloned").prependTo(this.$stage)}},{filter:["width","items","settings"],run:function(){for(var a=this.settings.rtl?1:-1,b=this._clones.length+this._items.length,c=-1,d=0,e=0,f=[];++c<b;)d=f[c-1]||0,e=this._widths[this.relative(c)]+this.settings.margin,f.push(d+e*a);this._coordinates=f}},{filter:["width","items","settings"],run:function(){var a=this.settings.stagePadding,b=this._coordinates,c={width:Math.ceil(Math.abs(b[b.length-1]))+2*a,"padding-left":a||"","padding-right":a||""};this.$stage.css(c)}},{filter:["width","items","settings"],run:function(a){var b=this._coordinates.length,c=!this.settings.autoWidth,d=this.$stage.children();if(c&&a.items.merge)for(;b--;)a.css.width=this._widths[this.relative(b)],d.eq(b).css(a.css);else c&&(a.css.width=a.items.width,d.css(a.css))}},{filter:["items"],run:function(){this._coordinates.length<1&&this.$stage.removeAttr("style")}},{filter:["width","items","settings"],run:function(a){a.current=a.current?this.$stage.children().index(a.current):0,a.current=Math.max(this.minimum(),Math.min(this.maximum(),a.current)),this.reset(a.current)}},{filter:["position"],run:function(){this.animate(this.coordinates(this._current))}},{filter:["width","position","items","settings"],run:function(){var a,b,c,d,e=this.settings.rtl?1:-1,f=2*this.settings.stagePadding,g=this.coordinates(this.current())+f,h=g+this.width()*e,i=[];for(c=0,d=this._coordinates.length;d>c;c++)a=this._coordinates[c-1]||0,b=Math.abs(this._coordinates[c])+f*e,(this.op(a,"<=",g)&&this.op(a,">",h)||this.op(b,"<",g)&&this.op(b,">",h))&&i.push(c);this.$stage.children(".active").removeClass("active"),this.$stage.children(":eq("+i.join("), :eq(")+")").addClass("active"),this.settings.center&&(this.$stage.children(".center").removeClass("center"),this.$stage.children().eq(this.current()).addClass("center"))}}],e.prototype.initialize=function(){if(this.enter("initializing"),this.trigger("initialize"),this.$element.toggleClass(this.settings.rtlClass,this.settings.rtl),this.settings.autoWidth&&!this.is("pre-loading")){var b,c,e;b=this.$element.find("img"),c=this.settings.nestedItemSelector?"."+this.settings.nestedItemSelector:d,e=this.$element.children(c).width(),b.length&&0>=e&&this.preloadAutoWidthImages(b)}this.$element.addClass(this.options.loadingClass),this.$stage=a("<"+this.settings.stageElement+' class="'+this.settings.stageClass+'"/>').wrap('<div class="'+this.settings.stageOuterClass+'"/>'),this.$element.append(this.$stage.parent()),this.replace(this.$element.children().not(this.$stage.parent())),this.$element.is(":visible")?this.refresh():this.invalidate("width"),this.$element.removeClass(this.options.loadingClass).addClass(this.options.loadedClass),this.registerEventHandlers(),this.leave("initializing"),this.trigger("initialized")},e.prototype.setup=function(){var b=this.viewport(),c=this.options.responsive,d=-1,e=null;c?(a.each(c,function(a){b>=a&&a>
vendor: 5,241 bytes, line 16767
16767d&&(d=Number(a))}),e=a.extend({},this.options,c[d]),delete e.responsive,e.responsiveClass&&this.$element.attr("class",this.$element.attr("class").replace(new RegExp("("+this.options.responsiveClass+"-)\\S+\\s","g"),"$1"+d))):e=a.extend({},this.options),(null===this.settings||this._breakpoint!==d)&&(this.trigger("change",{property:{name:"settings",value:e}}),this._breakpoint=d,this.settings=e,this.invalidate("settings"),this.trigger("changed",{property:{name:"settings",value:this.settings}}))},e.prototype.optionsLogic=function(){this.settings.autoWidth&&(this.settings.stagePadding=!1,this.settings.merge=!1)},e.prototype.prepare=function(b){var c=this.trigger("prepare",{content:b});return c.data||(c.data=a("<"+this.settings.itemElement+"/>").addClass(this.options.itemClass).append(b)),this.trigger("prepared",{content:c.data}),c.data},e.prototype.update=function(){for(var b=0,c=this._pipe.length,d=a.proxy(function(a){return this[a]},this._invalidated),e={};c>b;)(this._invalidated.all||a.grep(this._pipe[b].filter,d).length>0)&&this._pipe[b].run(e),b++;this._invalidated={},!this.is("valid")&&this.enter("valid")},e.prototype.width=function(a){switch(a=a||e.Width.Default){case e.Width.Inner:case e.Width.Outer:return this._width;default:return this._width-2*this.settings.stagePadding+this.settings.margin}},e.prototype.refresh=function(){this.enter("refreshing"),this.trigger("refresh"),this.setup(),this.optionsLogic(),this.$element.addClass(this.options.refreshClass),this.update(),this.$element.removeClass(this.options.refreshClass),this.leave("refreshing"),this.trigger("refreshed")},e.prototype.onThrottledResize=function(){b.clearTimeout(this.resizeTimer),this.resizeTimer=b.setTimeout(this._handlers.onResize,this.settings.responsiveRefreshRate)},e.prototype.onResize=function(){return this._items.length?this._width===this.$element.width()?!1:this.$element.is(":visible")?(this.enter("resizing"),this.trigger("resize").isDefaultPrevented()?(this.leave("resizing"),!1):(this.invalidate("width"),this.refresh(),this.leave("resizing"),void this.trigger("resized"))):!1:!1},e.prototype.registerEventHandlers=function(){a.support.transition&&this.$stage.on(a.support.transition.end+".owl.core",a.proxy(this.onTransitionEnd,this)),this.settings.responsive!==!1&&this.on(b,"resize",this._handlers.onThrottledResize),this.settings.mouseDrag&&(this.$element.addClass(this.options.dragClass),this.$stage.on("mousedown.owl.core",a.proxy(this.onDragStart,this)),this.$stage.on("dragstart.owl.core selectstart.owl.core",function(){return!1})),this.settings.touchDrag&&(this.$stage.on("touchstart.owl.core",a.proxy(this.onDragStart,this)),this.$stage.on("touchcancel.owl.core",a.proxy(this.onDragEnd,this)))},e.prototype.onDragStart=function(b){var d=null;3!==b.which&&(a.support.transform?(d=this.$stage.css("transform").replace(/.*\(|\)| /g,"").split(","),d={x:d[16===d.length?12:4],y:d[16===d.length?13:5]}):(d=this.$stage.position(),d={x:this.settings.rtl?d.left+this.$stage.width()-this.width()+this.settings.margin:d.left,y:d.top}),this.is("animating")&&(a.support.transform?this.animate(d.x):this.$stage.stop(),this.invalidate("position")),this.$element.toggleClass(this.options.grabClass,"mousedown"===b.type),this.speed(0),this._drag.time=(new Date).getTime(),this._drag.target=a(b.target),this._drag.stage.start=d,this._drag.stage.current=d,this._drag.pointer=this.pointer(b),a(c).on("mouseup.owl.core touchend.owl.core",a.proxy(this.onDragEnd,this)),a(c).one("mousemove.owl.core touchmove.owl.core",a.proxy(function(b){var d=this.difference(this._drag.pointer,this.pointer(b));a(c).on("mousemove.owl.core touchmove.owl.core",a.proxy(this.onDragMove,this)),Math.abs(d.x)<Math.abs(d.y)&&this.is("valid")||(b.preventDefault(),this.enter("dragging"),this.trigger("drag"))},this)))},e.prototype.onDragMove=function(a){var b=null,c=null,d=null,e=this.difference(this._drag.pointer,this.pointer(a)),f=this.difference(this._drag.stage.start,e);this.is("dragging")&&(a.preventDefault(),this.settings.loop?(b=this.coordinates(this.minimum()),c=this.coordinates(this.maximum()+1)-b,f.x=((f.x-b)%c+c)%c+b):(b=this.coordinates(this.settings.rtl?this.maximum():this.minimum()),c=this.coordinates(this.settings.rtl?this.minimum():this.maximum()),d=this.settings.pullDrag?-1*e.x/5:0,f.x=Math.max(Math.min(f.x,b+d),c+d)),this._drag.stage.current=f,this.animate(f.x))},e.prototype.onDragEnd=function(b){var d=this.difference(this._drag.pointer,this.pointer(b)),e=this._drag.stage.current,f=d.x>0^this.settings.rtl?"left":"right";a(c).off(".owl.core"),this.$element.removeClass(this.options.grabClass),(0!==d.x&&this.is("dragging")||!this.is("valid"))&&(this.speed(this.settings.dragEndSpeed||this.settings.smartSpeed),this.current(this.closest(e.x,0!==d.x?f:this._drag.direction)),this.invalidate("position"),this.update(),this._drag.direction=f,(Math.abs(d.x)>3||(new Date).getTime()-this._drag.time>300)&&this._drag.target.one("click.owl.core",function(){return!1})),this.is("dragging")&&(this.leave("dragging"),this.trigger("dragged"))},e.prototype.closest=function(b,c){var d=-1,e=30,f=this.width(),g=this.coordinates();return this.settings.freeDrag||a.each(g,a.proxy(function(a,h){return b>h-e&&h+e>b?d=a:this.op(b,"<",h)&&this.op(b,">
16767",g[a+1]||h-f)&&(d="left"===c?a+1:a),-1===d},this)),this.settings.loop||(this.op(b,">",g[this.minimum()])?d=b=this.minimum():this.op(b,"<",g[this.maximum()])&&(d=b=this.maximum())),d},e.prototype.animate=function(b){var c=this.speed()>0;this.is("animating")&&this.onTransitionEnd(),c&&(this.enter("animating"),this.trigger("translate")),a.support.transform3d&&a.support.transition?this.$stage.css({transform:"translate3d("+b+"px,0px,0px)",transition:this.speed()/1e3+"s"}):c?this.$stage.animate({left:b+"px"},this.speed(),this.settings.fallbackEasing,a.proxy(this.onTransitionEnd,this)):this.$stage.css({left:b+"px"})},e.prototype.is=function(a){return this._states.current[a]&&this._states.current[a]>0},e.prototype.current=function(a){if(a===d)return this._current;if(0===this._items.length)return d;if(a=this.normalize(a),this._current!==a){var b=this.trigger("change",{property:{name:"position",value:a}});b.data!==d&&(a=this.normalize(b.data)),this._current=a,this.invalidate("position"),this.trigger("changed",{property:{name:"position",value:this._current}})}return this._current},e.prototype.invalidate=function(b){return"string"===a.type(b)&&(this._invalidated[b]=!0,this.is("valid")&&this.leave("valid")),a.map(this._invalidated,function(a,b){return b})},e.prototype.reset=function(a){a=this.normalize(a),a!==d&&(this._speed=0,this._current=a,this.suppress(["translate","translated"]),this.animate(this.coordinates(a)),this.release(["translate","translated"]))},e.prototype.normalize=function(b,c){var e=this._items.length,f=c?0:this._clones.length;return!a.isNumeric(b)||1>e?b=d:(0>b||b>=e+f)&&(b=((b-f/2)%e+e)%e+f/2),b},e.prototype.relative=function(a){return a-=this._clones.length/2,this.normalize(a,!0)},e.prototype.maximum=function(a){var b,c=this.settings,d=this._coordinates.length,e=Math.abs(this._coordinates[d-1])-this._width,f=-1;if(c.loop)d=this._clones.length/2+this._items.length-1;else if(c.autoWidth||c.merge)for(;d-f>1;)Math.abs(this._coordinates[b=d+f>>1])<e?f=b:d=b;else d=c.center?this._items.length-1:this._items.length-c.items;return a&&(d-=this._clones.length/2),Math.max(d,0)},e.prototype.minimum=function(a){return a?0:this._clones.length/2},e.prototype.items=function(a){return a===d?this._items.slice():(a=this.normalize(a,!0),this._items[a])},e.prototype.mergers=function(a){return a===d?this._mergers.slice():(a=this.normalize(a,!0),this._mergers[a])},e.prototype.clones=function(b){var c=this._clones.length/2,e=c+this._items.length,f=function(a){return a%2===0?e+a/2:c-(a+1)/2};return b===d?a.map(this._clones,function(a,b){return f(b)}):a.map(this._clones,function(a,c){return a===b?f(c):null})},e.prototype.speed=function(a){return a!==d&&(this._speed=a),this._speed},e.prototype.coordinates=function(b){var c=null;return b===d?a.map(this._coordinates,a.proxy(function(a,b){return this.coordinates(b)},this)):(this.settings.center?(c=this._coordinates[b],c+=(this.width()-c+(this._coordinates[b-1]||0))/2*(this.settings.rtl?-1:1)):c=this._coordinates[b-1]||0,c)},e.prototype.duration=function(a,b,c){return Math.min(Math.max(Math.abs(b-a),1),6)*Math.abs(c||this.settings.smartSpeed)},e.prototype.to=function(a,b){var c=this.current(),d=null,e=a-this.relative(c),f=(e>0)-(0>e),g=this._items.length,h=this.minimum(),i=this.maximum();this.settings.loop?(!this.settings.rewind&&Math.abs(e)>g/2&&(e+=-1*f*g),a=c+e,d=((a-h)%g+g)%g+h,d!==a&&i>=d-e&&d-e>0&&(c=d-e,a=d,this.reset(c))):this.settings.rewind?(i+=1,a=(a%i+i)%i):a=Math.max(h,Math.min(i,a)),this.speed(this.duration(c,a,b)),this.current(a),this.$element.is(":visible")&&this.update()},e.prototype.next=function(a){a=a||!1,this.to(this.relative(this.current())+1,a)},e.prototype.prev=function(a){a=a||!1,this.to(this.relative(this.current())-1,a)},e.prototype.onTransitionEnd=function(a){return a!==d&&(a.stopPropagation(),(a.target||a.srcElement||a.originalTarget)!==this.$stage.get(0))?!1:(this.leave("animating"),void this.trigger("translated"))},e.prototype.viewport=function(){var d;if(this.options.responsiveBaseElement!==b)d=a(this.options.responsiveBaseElement).width();else if(b.innerWidth)d=b.innerWidth;else{if(!c.documentElement||!c.documentElement.clientWidth)throw"Can not detect viewport width.";d=c.documentElement.clientWidth}return d},e.prototype.replace=function(b){this.$stage.empty(),this._items=[],b&&(b=b instanceof jQuery?b:a(b)),this.settings.nestedItemSelector&&(b=b.find("."+this.settings.nestedItemSelector)),b.filter(function(){return 1===this.nodeType}).each(a.proxy(function(a,b){b=this.prepare(b),this.$stage.append(b),this._items.push(b),this._mergers.push(1*b.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)},this)),this.reset(a.isNumeric(this.settings.startPosition)?this.settings.startPosition:0),this.invalidate("items")},e.prototype.add=function(b,c){var e=this.relative(this._current);c=c===d?this._items.length:this.normalize(c,!0),b=b instanceof jQuery?b:a(b),this.trigger("add",{content:b,position:c}),b=this.prepare(b),0===this._items.length||c===this._items.length?(0===this._items.length&&this.$stage.append(b),0!==this._items.length&&this._items[c-1].after(b),this._items.push(b),this._mergers.push(1*b.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)):(this._items[c].before(b),this._items.splice(c,0,b),this._mergers.splice(c,0,1*b.find("[data-merge]").addBack("[data-merge]").attr("data-merge")||1)),this._items[e]&&this.reset(this._items[e].index()),this.invalidate("items"),this.trigger("added",{content:b,position:c})},e.prototype.remove=function(a){a=this.normalize(a,!0),a!==d&&(this.trigger("remove",{content:this._items[a],position:a}),this._items[a].remove(),this._items.splice(a,1),this._mergers.splice(a,1),this.invalidate("items"),this.trigger("removed",{content:null,position:a}))},e.prototype.preloadAutoWidthImages=function(b){b.each(a.proxy(function(b,c){this.enter("pre-loading"),c=a(c),a(new Image).one("load",a.proxy(function(a){c.attr("src",a.target.src),c.css("opacity",1),this.leave("pre-loading"),!this.is("pre-loading")&&!this.is("initializing")&&this.refresh()}
vendor: 21,719 bytes, lines 16767-16768
16767,this)).attr("src",c.attr("src")||c.attr("data-src")||c.attr("data-src-retina"))},this))},e.prototype.destroy=function(){this.$element.off(".owl.core"),this.$stage.off(".owl.core"),a(c).off(".owl.core"),this.settings.responsive!==!1&&(b.clearTimeout(this.resizeTimer),this.off(b,"resize",this._handlers.onThrottledResize));for(var d in this._plugins)this._plugins[d].destroy();this.$stage.children(".cloned").remove(),this.$stage.unwrap(),this.$stage.children().contents().unwrap(),this.$stage.children().unwrap(),this.$element.removeClass(this.options.refreshClass).removeClass(this.options.loadingClass).removeClass(this.options.loadedClass).removeClass(this.options.rtlClass).removeClass(this.options.dragClass).removeClass(this.options.grabClass).attr("class",this.$element.attr("class").replace(new RegExp(this.options.responsiveClass+"-\\S+\\s","g"),"")).removeData("owl.carousel")},e.prototype.op=function(a,b,c){var d=this.settings.rtl;switch(b){case"<":return d?a>c:c>a;case">":return d?c>a:a>c;case">=":return d?c>=a:a>=c;case"<=":return d?a>=c:c>=a}},e.prototype.on=function(a,b,c,d){a.addEventListener?a.addEventListener(b,c,d):a.attachEvent&&a.attachEvent("on"+b,c)},e.prototype.off=function(a,b,c,d){a.removeEventListener?a.removeEventListener(b,c,d):a.detachEvent&&a.detachEvent("on"+b,c)},e.prototype.trigger=function(b,c,d,f,g){var h={item:{count:this._items.length,index:this.current()}},i=a.camelCase(a.grep(["on",b,d],function(a){return a}).join("-").toLowerCase()),j=a.Event([b,"owl",d||"carousel"].join(".").toLowerCase(),a.extend({relatedTarget:this},h,c));return this._supress[b]||(a.each(this._plugins,function(a,b){b.onTrigger&&b.onTrigger(j)}),this.register({type:e.Type.Event,name:b}),this.$element.trigger(j),this.settings&&"function"==typeof this.settings[i]&&this.settings[i].call(this,j)),j},e.prototype.enter=function(b){a.each([b].concat(this._states.tags[b]||[]),a.proxy(function(a,b){this._states.current[b]===d&&(this._states.current[b]=0),this._states.current[b]++},this))},e.prototype.leave=function(b){a.each([b].concat(this._states.tags[b]||[]),a.proxy(function(a,b){this._states.current[b]--},this))},e.prototype.register=function(b){if(b.type===e.Type.Event){if(a.event.special[b.name]||(a.event.special[b.name]={}),!a.event.special[b.name].owl){var c=a.event.special[b.name]._default;a.event.special[b.name]._default=function(a){return!c||!c.apply||a.namespace&&-1!==a.namespace.indexOf("owl")?a.namespace&&a.namespace.indexOf("owl")>-1:c.apply(this,arguments)},a.event.special[b.name].owl=!0}}else b.type===e.Type.State&&(this._states.tags[b.name]?this._states.tags[b.name]=this._states.tags[b.name].concat(b.tags):this._states.tags[b.name]=b.tags,this._states.tags[b.name]=a.grep(this._states.tags[b.name],a.proxy(function(c,d){return a.inArray(c,this._states.tags[b.name])===d},this)))},e.prototype.suppress=function(b){a.each(b,a.proxy(function(a,b){this._supress[b]=!0},this))},e.prototype.release=function(b){a.each(b,a.proxy(function(a,b){delete this._supress[b]},this))},e.prototype.pointer=function(a){var c={x:null,y:null};return a=a.originalEvent||a||b.event,a=a.touches&&a.touches.length?a.touches[0]:a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:a,a.pageX?(c.x=a.pageX,c.y=a.pageY):(c.x=a.clientX,c.y=a.clientY),c},e.prototype.difference=function(a,b){return{x:a.x-b.x,y:a.y-b.y}},a.fn.owlCarousel=function(b){var c=Array.prototype.slice.call(arguments,1);return this.each(function(){var d=a(this),f=d.data("owl.carousel");f||(f=new e(this,"object"==typeof b&&b),d.data("owl.carousel",f),a.each(["next","prev","to","destroy","refresh","replace","add","remove"],function(b,c){f.register({type:e.Type.Event,name:c}),f.$element.on(c+".owl.carousel.core",a.proxy(function(a){a.namespace&&a.relatedTarget!==this&&(this.suppress([c]),f[c].apply(this,[].slice.call(arguments,1)),this.release([c]))},f))})),"string"==typeof b&&"_"!==b.charAt(0)&&f[b].apply(f,c)})},a.fn.owlCarousel.Constructor=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._interval=null,this._visible=null,this._handlers={"initialized.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoRefresh&&this.watch()},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers)};e.Defaults={autoRefresh:!0,autoRefreshInterval:500},e.prototype.watch=function(){this._interval||(this._visible=this._core.$element.is(":visible"),this._interval=b.setInterval(a.proxy(this.refresh,this),this._core.settings.autoRefreshInterval))},e.prototype.refresh=function(){this._core.$element.is(":visible")!==this._visible&&(this._visible=!this._visible,this._core.$element.toggleClass("owl-hidden",!this._visible),this._visible&&this._core.invalidate("width")&&this._core.refresh())},e.prototype.destroy=function(){var a,c;b.clearInterval(this._interval);for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},a.fn.owlCarousel.Constructor.Plugins.AutoRefresh=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._loaded=[],this._handlers={"initialized.owl.carousel change.owl.carousel":a.proxy(function(b){if(b.namespace&&this._core.settings&&this._core.settings.lazyLoad&&(b.property&&"position"==b.property.name||"initialized"==b.type))for(var c=this._core.settings,d=c.center&&Math.ceil(c.items/2)||c.items,e=c.center&&-1*d||0,f=(b.property&&b.property.value||this._core.current())+e,g=this._core.clones().length,h=a.proxy(function(a,b){this.load(b)},this);e++<d;)this.load(g/2+this._core.relative(f)),g&&a.each(this._core.clones(this._core.relative(f)),h),f++},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers)};e.Defaults={lazyLoad:!1},e.prototype.load=function(c){var d=this._core.$stage.children().eq(c),e=d&&d.find(".owl-lazy");!e||a.inArray(d.get(0),this._loaded)>-1||(e.each(a.proxy(function(c,d){var e,f=a(d),g=b.devicePixelRatio>1&&f.attr("data-src-retina")||f.attr("data-src");this._core.trigger("load",{element:f,url:g},"lazy"),f.is("img")?f.one("load.owl.lazy",a.proxy(function(){f.css("opacity",1),this._core.trigger("loaded",{element:f,url:g},"lazy")},this)).attr("src",g):(e=new Image,e.onload=a.proxy(function(){f.css({"background-image":"url("+g+")",opacity:"1"}),this._core.trigger("loaded",{element:f,url:g},"lazy")},this),e.src=g)},this)),this._loaded.push(d.get(0)))},e.prototype.destroy=function(){var a,b;for(a in this.handlers)this._core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Lazy=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._handlers={"initialized.owl.carousel refreshed.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&this.update()},this),"changed.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&"position"==a.property.name&&this.update()},this),"loaded.owl.lazy":a.proxy(function(a){a.namespace&&this._core.settings.autoHeight&&a.element.closest("."+this._core.settings.itemClass).index()===this._core.current()&&this.update()},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers)};e.Defaults={autoHeight:!1,autoHeightClass:"owl-height"},e.prototype.update=function(){var b=this._core._current,c=b+this._core.settings.items,d=this._core.$stage.children().toArray().slice(b,c);heights=[],maxheight=0,a.each(d,function(b,c){heights.push(a(c).height())}),maxheight=Math.max.apply(null,heights),this._core.$stage.parent().height(maxheight).addClass(this._core.settings.autoHeightClass)},e.prototype.destroy=function(){var a,b;for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.AutoHeight=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._videos={},this._playing=null,this._handlers={"initialized.owl.carousel":a.proxy(function(a){a.namespace&&this._core.register({type:"state",name:"playing",tags:["interacting"]})},this),"resize.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.video&&this.isInFullScreen()&&a.preventDefault()},this),"refreshed.owl.carousel":a.proxy(function(a){a.namespace&&this._core.is("resizing")&&this._core.$stage.find(".cloned .owl-video-frame").remove()},this),"changed.owl.carousel":a.proxy(function(a){a.namespace&&"position"===a.property.name&&this._playing&&this.stop()},this),"prepared.owl.carousel":a.proxy(function(b){if(b.namespace){var c=a(b.content).find(".owl-video");c.length&&(c.css("display","none"),this.fetch(c,a(b.content)))}},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this._core.$element.on(this._handlers),this._core.$element.on("click.owl.video",".owl-video-play-icon",a.proxy(function(a){this.play(a)},this))};e.Defaults={video:!1,videoHeight:!1,videoWidth:!1},e.prototype.fetch=function(a,b){var c=a.attr("data-vimeo-id")?"vimeo":"youtube",d=a.attr("data-vimeo-id")||a.attr("data-youtube-id"),e=a.attr("data-width")||this._core.settings.videoWidth,f=a.attr("data-height")||this._core.settings.videoHeight,g=a.attr("href");if(!g)throw new Error("Missing video URL.");if(d=g.match(/(http:|https:|)\/\/(player.|www.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com))\/(video\/|embed\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/),d[3].indexOf("youtu")>-1)c="youtube";else{if(!(d[3].indexOf("vimeo")>-1))throw new Error("Video URL not supported.");c="vimeo"}d=d[6],this._videos[g]={type:c,id:d,width:e,height:f},b.attr("data-video",g),this.thumbnail(a,this._videos[g])},e.prototype.thumbnail=function(b,c){var d,e,f,g=c.width&&c.height?'style="width:'+c.width+"px;height:"+c.height+'px;"':"",h=b.find("img"),i="src",j="",k=this._core.settings,l=function(a){e='<div class="owl-video-play-icon"></div>',d=k.lazyLoad?'<div class="owl-video-tn '+j+'" '+i+'="'+a+'"></div>':'<div class="owl-video-tn" style="opacity:1;background-image:url('+a+')"></div>',b.after(d),b.after(e)};return b.wrap('<div class="owl-video-wrapper"'+g+"></div>"),this._core.settings.lazyLoad&&(i="data-src",j="owl-lazy"),h.length?(l(h.attr(i)),h.remove(),!1):void("youtube"===c.type?(f="http://img.youtube.com/vi/"+c.id+"/hqdefault.jpg",l(f)):"vimeo"===c.type&&a.ajax({type:"GET",url:"http://vimeo.com/api/v2/video/"+c.id+".json",jsonp:"callback",dataType:"jsonp",success:function(a){f=a[0].thumbnail_large,l(f)}}))},e.prototype.stop=function(){this._core.trigger("stop",null,"video"),this._playing.find(".owl-video-frame").remove(),this._playing.removeClass("owl-video-playing"),this._playing=null,this._core.leave("playing"),this._core.trigger("stopped",null,"video")},e.prototype.play=function(b){var c,d=a(b.target),e=d.closest("."+this._core.settings.itemClass),f=this._videos[e.attr("data-video")],g=f.width||"100%",h=f.height||this._core.$stage.height();this._playing||(this._core.enter("playing"),this._core.trigger("play",null,"video"),e=this._core.items(this._core.relative(e.index())),this._core.reset(e.index()),"youtube"===f.type?c='<iframe width="'+g+'" height="'+h+'" src="http://www.youtube.com/embed/'+f.id+"?autoplay=1&v="+f.id+'" frameborder="0" allowfullscreen></iframe>':"vimeo"===f.type&&(c='<iframe src="http://player.vimeo.com/video/'+f.id+'?autoplay=1" width="'+g+'" height="'+h+'" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'),a('<div class="owl-video-frame">'+c+"</div>").insertAfter(e.find(".owl-video")),this._playing=e.addClass("owl-video-playing"))},e.prototype.isInFullScreen=function(){var b=c.fullscreenElement||c.mozFullScreenElement||c.webkitFullscreenElement;return b&&a(b).parent().hasClass("owl-video-frame")},e.prototype.destroy=function(){var a,b;this._core.$element.off("click.owl.video");for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Video=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this.core=b,this.core.options=a.extend({},e.Defaults,this.core.options),this.swapping=!0,this.previous=d,this.next=d,this.handlers={"change.owl.carousel":a.proxy(function(a){a.namespace&&"position"==a.property.name&&(this.previous=this.core.current(),this.next=a.property.value)},this),"drag.owl.carousel dragged.owl.carousel translated.owl.carousel":a.proxy(function(a){a.namespace&&(this.swapping="translated"==a.type)},this),"translate.owl.carousel":a.proxy(function(a){a.namespace&&this.swapping&&(this.core.options.animateOut||this.core.options.animateIn)&&this.swap()},this)},this.core.$element.on(this.handlers)};e.Defaults={animateOut:!1,animateIn:!1},e.prototype.swap=function(){if(1===this.core.settings.items&&a.support.animation&&a.support.transition){this.core.speed(0);var b,c=a.proxy(this.clear,this),d=this.core.$stage.children().eq(this.previous),e=this.core.$stage.children().eq(this.next),f=this.core.settings.animateIn,g=this.core.settings.animateOut;this.core.current()!==this.previous&&(g&&(b=this.core.coordinates(this.previous)-this.core.coordinates(this.next),d.one(a.support.animation.end,c).css({left:b+"px"}).addClass("animated owl-animated-out").addClass(g)),f&&e.one(a.support.animation.end,c).addClass("animated owl-animated-in").addClass(f))}},e.prototype.clear=function(b){a(b.target).css({left:""}).removeClass("animated owl-animated-out owl-animated-in").removeClass(this.core.settings.animateIn).removeClass(this.core.settings.animateOut),this.core.onTransitionEnd()},e.prototype.destroy=function(){var a,b;for(a in this.handlers)this.core.$element.off(a,this.handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.Animate=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){var e=function(b){this._core=b,this._interval=null,this._paused=!1,this._handlers={"changed.owl.carousel":a.proxy(function(a){a.namespace&&"settings"===a.property.name&&(this._core.settings.autoplay?this.play():this.stop())},this),"initialized.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.autoplay&&this.play()},this),"play.owl.autoplay":a.proxy(function(a,b,c){a.namespace&&this.play(b,c)},this),"stop.owl.autoplay":a.proxy(function(a){a.namespace&&this.stop()},this),"mouseover.owl.autoplay":a.proxy(function(){this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.pause()},this),"mouseleave.owl.autoplay":a.proxy(function(){ 16768this._core.settings.autoplayHoverPause&&this._core.is("rotating")&&this.play()},this)},this._core.$element.on(this._handlers),this._core.options=a.extend({},e.Defaults,this._core.options)};e.Defaults={autoplay:!1,autoplayTimeout:5e3,autoplayHoverPause:!1,autoplaySpeed:!1},e.prototype.play=function(d,e){this._paused=!1,this._core.is("rotating")||(this._core.enter("rotating"),this._interval=b.setInterval(a.proxy(function(){this._paused||this._core.is("busy")||this._core.is("interacting")||c.hidden||this._core.next(e||this._core.settings.autoplaySpeed)},this),d||this._core.settings.autoplayTimeout))},e.prototype.stop=function(){this._core.is("rotating")&&(b.clearInterval(this._interval),this._core.leave("rotating"))},e.prototype.pause=function(){this._core.is("rotating")&&(this._paused=!0)},e.prototype.destroy=function(){var a,b;this.stop();for(a in this._handlers)this._core.$element.off(a,this._handlers[a]);for(b in Object.getOwnPropertyNames(this))"function"!=typeof this[b]&&(this[b]=null)},a.fn.owlCarousel.Constructor.Plugins.autoplay=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){"use strict";var e=function(b){this._core=b,this._initialized=!1,this._pages=[],this._controls={},this._templates=[],this.$element=this._core.$element,this._overrides={next:this._core.next,prev:this._core.prev,to:this._core.to},this._handlers={"prepared.owl.carousel":a.proxy(function(b){b.namespace&&this._core.settings.dotsData&&this._templates.push('<div class="'+this._core.settings.dotClass+'">'+a(b.content).find("[data-dot]").addBack("[data-dot]").attr("data-dot")+"</div>")},this),"added.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.dotsData&&this._templates.splice(a.position,0,this._templates.pop())},this),"remove.owl.carousel":a.proxy(function(a){a.namespace&&this._core.settings.dotsData&&this._templates.splice(a.position,1)},this),"changed.owl.carousel":a.proxy(function(a){a.namespace&&"position"==a.property.name&&this.draw()},this),"initialized.owl.carousel":a.proxy(function(a){a.namespace&&!this._initialized&&(this._core.trigger("initialize",null,"navigation"),this.initialize(),this.update(),this.draw(),this._initialized=!0,this._core.trigger("initialized",null,"navigation"))},this),"refreshed.owl.carousel":a.proxy(function(a){a.namespace&&this._initialized&&(this._core.trigger("refresh",null,"navigation"),this.update(),this.draw(),this._core.trigger("refreshed",null,"navigation"))},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this.$element.on(this._handlers)};e.Defaults={nav:!1,navText:["prev","next"],navSpeed:!1,navElement:"div",navContainer:!1,navContainerClass:"owl-nav",navClass:["owl-prev","owl-next"],slideBy:1,dotClass:"owl-dot",dotsClass:"owl-dots",dots:!0,dotsEach:!1,dotsData:!1,dotsSpeed:!1,dotsContainer:!1},e.prototype.initialize=function(){var b,c=this._core.settings;this._controls.$relative=(c.navContainer?a(c.navContainer):a("<div>").addClass(c.navContainerClass).appendTo(this.$element)).addClass("disabled"),this._controls.$previous=a("<"+c.navElement+">").addClass(c.navClass[0]).html(c.navText[0]).prependTo(this._controls.$relative).on("click",a.proxy(function(a){this.prev(c.navSpeed)},this)),this._controls.$next=a("<"+c.navElement+">").addClass(c.navClass[1]).html(c.navText[1]).appendTo(this._controls.$relative).on("click",a.proxy(function(a){this.next(c.navSpeed)},this)),c.dotsData||(this._templates=[a("<div>").addClass(c.dotClass).append(a("<span>")).prop("outerHTML")]),this._controls.$absolute=(c.dotsContainer?a(c.dotsContainer):a("<div>").addClass(c.dotsClass).appendTo(this.$element)).addClass("disabled"),this._controls.$absolute.on("click","div",a.proxy(function(b){var d=a(b.target).parent().is(this._controls.$absolute)?a(b.target).index():a(b.target).parent().index();b.preventDefault(),this.to(d,c.dotsSpeed)},this));for(b in this._overrides)this._core[b]=a.proxy(this[b],this)},e.prototype.destroy=function(){var a,b,c,d;for(a in this._handlers)this.$element.off(a,this._handlers[a]);for(b in this._controls)this._controls[b].remove();for(d in this.overides)this._core[d]=this._overrides[d];for(c in Object.getOwnPropertyNames(this))"function"!=typeof this[c]&&(this[c]=null)},e.prototype.update=function(){var a,b,c,d=this._core.clones().length/2,e=d+this._core.items().length,f=this._core.maximum(!0),g=this._core.settings,h=g.center||g.autoWidth||g.dotsData?1:g.dotsEach||g.items;if("page"!==g.slideBy&&(g.slideBy=Math.min(g.slideBy,g.items)),g.dots||"page"==g.slideBy)for(this._pages=[],a=d,b=0,c=0;e>a;a++){if(b>=h||0===b){if(this._pages.push({start:Math.min(f,a-d),end:a-d+h-1}),Math.min(f,a-d)===f)break;b=0,++c}b+=this._core.mergers(this._core.relative(a))}},e.prototype.draw=function(){var b,c=this._core.settings,d=this._core.items().length<=c.items,e=this._core.relative(this._core.current()),f=c.loop||c.rewind;this._controls.$relative.toggleClass("disabled",!c.nav||d),c.nav&&(this._controls.$previous.toggleClass("disabled",!f&&e<=this._core.minimum(!0)),this._controls.$next.toggleClass("disabled",!f&&e>=this._core.maximum(!0))),this._controls.$absolute.toggleClass("disabled",!c.dots||d),c.dots&&(b=this._pages.length-this._controls.$absolute.children().length,c.dotsData&&0!==b?this._controls.$absolute.html(this._templates.join("")):b>0?this._controls.$absolute.append(new Array(b+1).join(this._templates[0])):0>b&&this._controls.$absolute.children().slice(b).remove(),this._controls.$absolute.find(".active").removeClass("active"),this._controls.$absolute.children().eq(a.inArray(this.current(),this._pages)).addClass("active"))},e.prototype.onTrigger=function(b){var c=this._core.settings;b.page={index:a.inArray(this.current(),this._pages),count:this._pages.length,size:c&&(c.center||c.autoWidth||c.dotsData?1:c.dotsEach||c.items)}},e.prototype.current=function(){var b=this._core.relative(this._core.current());return a.grep(this._pages,a.proxy(function(a,c){return a.start<=b&&a.end>=b},this)).pop()},e.prototype.getPosition=function(b){var c,d,e=this._core.settings;return"page"==e.slideBy?(c=a.inArray(this.current(),this._pages),d=this._pages.length,b?++c:--c,c=this._pages[(c%d+d)%d].start):(c=this._core.relative(this._core.current()),d=this._core.items().length,b?c+=e.slideBy:c-=e.slideBy),c},e.prototype.next=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!0),b)},e.prototype.prev=function(b){a.proxy(this._overrides.to,this._core)(this.getPosition(!1),b)},e.prototype.to=function(b,c,d){var e;d?a.proxy(this._overrides.to,this._core)(b,c):(e=this._pages.length,a.proxy(this._overrides.to,this._core)(this._pages[(b%e+e)%e].start,c))},a.fn.owlCarousel.Constructor.Plugins.Navigation=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){"use strict";var e=function(c){this._core=c,this._hashes={},this.$element=this._core.$element,this._handlers={"initialized.owl.carousel":
16768a.proxy(function(c){c.namespace&&"URLHash"===this._core.settings.startPosition&&a(b).trigger("hashchange.owl.navigation")},this),"prepared.owl.carousel":a.proxy(function(b){if(b.namespace){var c=a(b.content).find("[data-hash]").addBack("[data-hash]").attr("data-hash");if(!c)return;this._hashes[c]=b.content}},this),"changed.owl.carousel":a.proxy(function(c){if(c.namespace&&"position"===c.property.name){var d=this._core.items(this._core.relative(this._core.current())),e=a.map(this._hashes,function(a,b){return a===d?b:null}).join();if(!e||b.location.hash.slice(1)===e)return;b.location.hash=e}},this)},this._core.options=a.extend({},e.Defaults,this._core.options),this.$element.on(this._handlers),a(b).on("hashchange.owl.navigation",a.proxy(function(a){var c=b.location.hash.substring(1),e=this._core.$stage.children(),f=this._hashes[c]&&e.index(this._hashes[c]);f!==d&&f!==this._core.current()&&this._core.to(this._core.relative(f),!1,!0)},this))};e.Defaults={URLhashListener:!1},e.prototype.destroy=function(){var c,d;a(b).off("hashchange.owl.navigation");for(c in this._handlers)this._core.$element.off(c,this._handlers[c]);for(d in Object.getOwnPropertyNames(this))"function"!=typeof this[d]&&(this[d]=null)},a.fn.owlCarousel.Constructor.Plugins.Hash=e}(window.Zepto||window.jQuery,window,document),function(a,b,c,d){function e(b,c){var e=!1,f=b.charAt(0).toUpperCase()+b.slice(1);return a.each((b+" "+h.join(f+" ")+f).split(" "),function(a,b){return g[b]!==d?(e=c?b:!0,!1):void 0}),e}function f(a){return e(a,!0)}var g=a("<support>").get(0).style,h="Webkit Moz O ms".split(" "),i={transition:{end:{WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd",transition:"transitionend"}},animation:{end:{WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oAnimationEnd",animation:"animationend"}}},j={csstransforms:function(){return!!e("transform")},csstransforms3d:function(){return!!e("perspective")},csstransitions:function(){return!!e("transition")},cssanimations:function(){return!!e("animation")}};j.csstransitions()&&(a.support.transition=new String(f("transition")),a.support.transition.end=i.transition.end[a.support.transition]),j.cssanimations()&&(a.support.animation=new String(f("animation")),a.support.animation.end=i.animation.end[a.support.animation]),j.csstransforms()&&(a.support.transform=new String(f("transform")),a.support.transform3d=j.csstransforms3d())}(window.Zepto||window.jQuery,window,document); 16769 16770/***/ }), 16771 16772/***/ 316: 16773/***/ (function(module, exports) { 16774 16775$(document).ready(function () { 16776 var bigimage = $('.pdp-slider-outer #big'); 16777 var thumbs = $('.pdp-slider-outer #thumbs'); 16778 var syncedSecondary = true; 16779 16780 if ($(window).width() < 514) { 16781 bigimage.owlCarousel({ 16782 slideSpeed: 2000, 16783 nav: true, 16784 navText: ['<button class="btn-preview"></button>', '<button class="btn-next"></button>'], 16785 autoplay: false, 16786 dots: false, 16787 loop: true, 16788 mouseDrag: false, 16789 itemsDesktop : false, 16790 itemsDesktopSmall : false, 16791 itemsTablet: false, 16792 itemsMobile : true, 16793 responsiveClass: true, 16794 responsive: { 16795 0: { 16796 items: 1 16797 }, 16798 600: { 16799 items: 1 16800 }, 16801 1000: { 16802 items: 1 16803 } 16804 } 16805 }); 16806 $(".pdp-slider-outer #thumbs").css('display','none'); 16807 } 16808 16809 bigimage.owlCarousel({ 16810 slideSpeed: 2000, 16811 nav: false, 16812 autoplay: false, 16813 dots: false, 16814 loop: true, 16815 autoWidth: true, 16816 mouseDrag: false, 16817 itemsDesktop : false, 16818 itemsDesktopSmall : false, 16819 itemsTablet: false, 16820 itemsMobile : true, 16821 responsiveClass: true, 16822 margin: 100, 16823 responsive: { 16824 0: { 16825 items: 1 16826 }, 16827 600: { 16828 items: 1 16829 }, 16830 1000: { 16831 items: 1 16832 } 16833 } 16834 }).on('changed.owl.carousel', syncPosition); 16835 16836 thumbs.on('initialized.owl.carousel', function () { 16837 thumbs.find('.owl-item').eq(0).addClass('current'); 16838 }).owlCarousel({ 16839 items: 4, 16840 dots: false, 16841 nav: false, 16842 // navText: [ 16843 // '<i class="fa fa-arrow-left" aria-hidden="true"></i>', 16844 // '<i class="fa fa-arrow-right" aria-hidden="true"></i>' 16845 // ], 16846 smartSpeed: 200, 16847 slideSpeed: 500, 16848 slideBy: 1, 16849 responsiveRefreshRate: 100 16850 }).on('changed.owl.carousel', syncPosition2); 16851 16852 /** 16853 * if loop is set to false, then you have to uncomment the next line 16854 */ 16855 function syncPosition(el) { 16856 // var current = el.item.index; 16857 16858 // to disable loop, comment this block 16859 var count = el.item.count - 1; 16860 var current = Math.round(el.item.index - el.item.count / 2 - 0.5);
16861 16862 if (current < 0) { 16863 current = count; 16864 } 16865 if (current > count) { 16866 current = 0; 16867 } 16868 // to this 16869 thumbs 16870 .find('.owl-item') 16871 .removeClass('current') 16872 .eq(current) 16873 .addClass('current'); 16874 var onscreen = thumbs.find('.owl-item.active').length - 1; 16875 var start = thumbs.find('.owl-item.active').first().index(); 16876 var end = thumbs.find('.owl-item.active').last().index(); 16877 16878 if (current > end) { 16879 thumbs.data('owl.carousel').to(current, 100, true); 16880 } 16881 if (current < start) { 16882 thumbs.data('owl.carousel').to(current - onscreen, 100, true); 16883 } 16884 } 16885 16886 /** 16887 * funcationality for carousel scroll to a number of slide 16888 */ 16889 function syncPosition2(el) { 16890 if (syncedSecondary) { 16891 var number = el.item.index; 16892 bigimage.data('owl.carousel').to(number, 100, true); 16893 } 16894 } 16895 16896 thumbs.on('click', '.owl-item', function (e) { 16897 e.preventDefault(); 16898 var number = $(this).index(); 16899 bigimage.data('owl.carousel').to(number, 300, true); 16900 }); 16901 16902 $('#pdpCarouselModal .owl-carousel').owlCarousel({ 16903 loop: false, 16904 nav: true, 16905 navText: ['<button class="btn-preview"></button>', '<button class="btn-next"></button>'], 16906 dots: false, 16907 margin: 0, 16908 autoplay: false, 16909 mouseDrag: false, 16910 responsiveClass: true, 16911 responsive: { 16912 0: { 16913 items: 1 16914 }, 16915 600: { 16916 items: 1 16917 }, 16918 1000: { 16919 items: 1 16920 } 16921 } 16922 }); 16923}); 16924 16925// for starting coursel from current image 16926$('#big img, .big-carousel .zoom-carousel').on('click', function () { 16927 var start = $('#thumbs .owl-item.active.current').index(); 16928 $('#pdpCarouselModal .owl-carousel').data('owl.carousel').to(start, 100, true); 16929} 16930); 16931 16932/***/ }), 16933 16934/***/ 317: 16935/***/ (function(module, exports, __webpack_require__) { 16936 16937"use strict"; 16938 16939var base = __webpack_require__(5); 16940var focusHelper = __webpack_require__(6); 16941 16942/** 16943 * Generates the modal window on the first call. 16944 * 16945 */ 16946function getModalHtmlElement() { 16947 if ($('#quickViewModal').length !== 0) { 16948 $('#quickViewModal').remove(); 16949 } 16950 var htmlString = '<!-- Modal -->' 16951 + '<div class="modal fade eys-quick-view" id="quickViewModal" data-backdrop="static" data-keyboard="false" role="dialog">' 16952 + '<span class="enter-message sr-only" ></span>' 16953 + '<div class="modal-dialog quick-view-dialog modal-dialog-centered">' 16954 + '<!-- Modal content-->' 16955 + '<div class="modal-content">' 16956 + '<div class="modal-header quick-modal-header">' 16957 + ' <button type="button" class="close pull-right quick-close-btn" data-dismiss="modal">' 16958 + ' </button>' 16959 + '</div>' 16960 + '<div class="modal-body eys-modal-body"></div>' 16961 + '<div class="modal-footer eys-modal-footer"></div>' 16962 + '</div>' 16963 + '</div>' 16964 + '</div>'; 16965 $('body').append(htmlString); 16966} 16967 16968/** 16969 * @typedef {Object} QuickViewHtml 16970 * @property {string} body - Main Quick View body 16971 * @property {string} footer - Quick View footer content 16972 */ 16973 16974/** 16975 * Parse HTML code in Ajax response 16976 * 16977 * @param {string} html - Rendered HTML from quickview template 16978 * @return {QuickViewHtml} - QuickView content components 16979 */ 16980function parseHtml(html) { 16981 var $html = $('<div>').append($.parseHTML(html)); 16982 16983 var body = $html.find('.product-quickview'); 16984 var footer = $html.find('.modal-footer').children(); 16985 16986 return { body: body, footer: footer }; 16987} 16988 16989/** 16990 * replaces the content in the modal window on for the selected product variation. 16991 * @param {string} selectedValueUrl - url to be used to retrieve a new product model 16992 */ 16993function fillModalElement(selectedValueUrl) { 16994 $.ajax({
16995 url: selectedValueUrl, 16996 method: 'GET', 16997 dataType: 'json', 16998 success: function (data) { 16999 var parsedHtml = parseHtml(data.renderedTemplate); 17000 17001 $('.modal-body').empty(); 17002 $('.eys-quick-view .modal-body').empty(); 17003 $('.eys-quick-view .modal-body').html(parsedHtml.body); 17004 $('.modal-footer').html(parsedHtml.footer); 17005 $('.full-pdp-link').text(data.quickViewFullDetailMsg); 17006 $('#quickViewModal .full-pdp-link').attr('href', data.productUrl); 17007 $('#quickViewModal .size-chart').attr('href', data.productUrl); 17008 $('#quickViewModal .modal-header .close .sr-only').text(data.closeButtonText); 17009 $('#quickViewModal .enter-message').text(data.enterDialogMessage); 17010 $('#quickViewModal').modal('show'); 17011 $('body').trigger('quickview:ready'); 17012 } 17013 }); 17014} 17015 17016module.exports = { 17017 showQuickview: function () { 17018 $('body').on('click', '.quickview', function (e) { 17019 e.preventDefault(); 17020 e.stopPropagation(); 17021 var selectedValueUrl = $(this).closest('a.quickview').data('href'); 17022 $(e.target).trigger('quickview:show'); 17023 getModalHtmlElement(); 17024 fillModalElement(selectedValueUrl); 17025 17026 $(document).on('show.bs.modal', '#quickViewModal', function () { 17027 setTimeout(function() { 17028 var bigimage = $('#quickViewModal .pdp-slider-outer #big'); 17029 var thumbs = $('#quickViewModal .pdp-slider-outer #thumbs'); 17030 var syncedSecondary = true; 17031 17032 if ($(window).width() < 514) { 17033 bigimage.owlCarousel({ 17034 slideSpeed: 2000, 17035 nav: true, 17036 navText: ['<button class="btn-preview"></button>', '<button class="btn-next"></button>'], 17037 autoplay: false, 17038 dots: false, 17039 loop: true, 17040 mouseDrag: false, 17041 itemsDesktop: false, 17042 itemsDesktopSmall: false, 17043 itemsTablet: false, 17044 itemsMobile: true, 17045 responsiveClass: true, 17046 responsive: { 17047 0: { 17048 items: 1 17049 }, 17050 600: { 17051 items: 1 17052 }, 17053 1000: { 17054 items: 1 17055 } 17056 } 17057 }); 17058 $(".pdp-slider-outer #thumbs").css('display', 'none'); 17059 } 17060 17061 bigimage.owlCarousel({ 17062 slideSpeed: 2000, 17063 nav: false, 17064 autoplay: false, 17065 dots: false, 17066 loop: true, 17067 mouseDrag: false, 17068 itemsDesktop: false, 17069 itemsDesktopSmall: false, 17070 itemsTablet: false, 17071 itemsMobile: true, 17072 responsiveClass: true, 17073 responsive: { 17074 0: { 17075 items: 1 17076 }, 17077 600: { 17078 items: 1 17079 }, 17080 1000: { 17081 items: 1 17082 } 17083 } 17084 }).on('changed.owl.carousel', syncPosition); 17085 17086 thumbs.on('initialized.owl.carousel', function () { 17087 thumbs.find('.owl-item').eq(0).addClass('current'); 17088 }).owlCarousel({ 17089 items: 4, 17090 dots: false, 17091 nav: false, 17092 // navText: [ 17093 // '<i class="fa fa-arrow-left" aria-hidden="true"></i>', 17094 // '<i class="fa fa-arrow-right" aria-hidden="true"></i>' 17095 // ], 17096 smartSpeed: 200, 17097 slideSpeed: 500, 17098 slideBy: 4, 17099 responsiveRefreshRate: 100 17100 }).on('changed.owl.carousel', syncPosition2); 17101 17102 /** 17103 * if loop is set to false, then you have to uncomment the next line 17104 */ 17105 function syncPosition(el) { 17106 // var current = el.item.index; 17107 17108 // to disable loop, comment this block 17109 var count = el.item.count - 1; 17110 var current = Math.round(el.item.index - el.item.count / 2 - 0.5);
17111 17112 if (current < 0) { 17113 current = count; 17114 } 17115 if (current > count) { 17116 current = 0; 17117 } 17118 // to this 17119 thumbs 17120 .find('.owl-item') 17121 .removeClass('current') 17122 .eq(current) 17123 .addClass('current'); 17124 var onscreen = thumbs.find('.owl-item.active').length - 1; 17125 var start = thumbs.find('.owl-item.active').first().index(); 17126 var end = thumbs.find('.owl-item.active').last().index(); 17127 17128 if (current > end) { 17129 thumbs.data('owl.carousel').to(current, 100, true); 17130 } 17131 if (current < start) { 17132 thumbs.data('owl.carousel').to(current - onscreen, 100, true); 17133 } 17134 } 17135 17136 /** 17137 * funcationality for carousel scroll to a number of slide 17138 */ 17139 function syncPosition2(el) { 17140 if (syncedSecondary) { 17141 var number = el.item.index; 17142 bigimage.data('owl.carousel').to(number, 100, true); 17143 } 17144 } 17145 17146 thumbs.on('click', '.owl-item', function (e) { 17147 e.preventDefault(); 17148 var number = $(this).index(); 17149 bigimage.data('owl.carousel').to(number, 300, true); 17150 }); 17151 17152 $('#quickCarouselModal .owl-carousel').owlCarousel({ 17153 loop: false, 17154 nav: true, 17155 navText: ['<button class="btn-preview"></button>', '<button class="btn-next"></button>'], 17156 dots: false, 17157 margin: 0, 17158 autoplay: false, 17159 mouseDrag: false, 17160 responsiveClass: true, 17161 responsive: { 17162 0: { 17163 items: 1 17164 }, 17165 600: { 17166 items: 1 17167 }, 17168 1000: { 17169 items: 1 17170 } 17171 } 17172 }); 17173 }, 1500); 17174 }); 17175 }); 17176 }, 17177 focusQuickview: function () { 17178 $('body').on('shown.bs.modal', '#quickViewModal', function () { 17179 $('#quickViewModal .close').focus(); 17180 }); 17181 }, 17182 trapQuickviewFocus: function () { 17183 $('body').on('keydown', '#quickViewModal', function (e) { 17184 var focusParams = { 17185 event: e, 17186 containerSelector: '#quickViewModal', 17187 firstElementSelector: '.full-pdp-link', 17188 lastElementSelector: '.add-to-cart-global', 17189 nextToLastElementSelector: '.modal-footer .quantity-select' 17190 }; 17191 focusHelper.setTabNextFocus(focusParams); 17192 }); 17193 }, 17194 availability: base.availability, 17195 addToCart: base.addToCart, 17196 showSpinner: function () { 17197 $('body').on('product:beforeAddToCart', function (e, data) { 17198 $(data).closest('.modal-content').spinner().start(); 17199 }); 17200 }, 17201 hideDialog: function () { 17202 $('body').on('product:afterAddToCart', function () { 17203 $('#quickViewModal').modal('hide'); 17204 }); 17205 }, 17206 beforeUpdateAttribute: function () { 17207 $('body').on('product:beforeAttributeSelect', function () { 17208 $('.modal.show .modal-content').spinner().start(); 17209 }); 17210 }, 17211 updateAttribute: function () { 17212 $('body').on('product:afterAttributeSelect', function (e, response) { 17213 if ($('.modal.show .product-quickview>.bundle-items').length) { 17214 $('.modal.show').find(response.container).data('pid', response.data.product.id); 17215 $('.modal.show').find(response.container) 17216 .find('.product-id').text(response.data.product.id); 17217 } else if ($('.set-items').length) { 17218 response.container.find('.product-id').text(response.data.product.id); 17219 } else { 17220 $('.modal.show .product-quickview').data('pid', response.data.product.id); 17221 $('.modal.show .full-pdp-link') 17222 .attr('href', response.data.product.selectedProductUrl); 17223 } 17224 }); 17225 }, 17226 updateAddToCart: function () { 17227 $('body').on('product:updateAddToCart', function (e, response) { 17228 // update local add to cart (for sets)
17229 $('button.add-to-cart', response.$productContainer).attr('disabled', 17230 (!response.product.readyToOrder || !response.product.available)); 17231 17232 // update global add to cart (single products, bundles) 17233 var dialog = $(response.$productContainer) 17234 .closest('.quick-view-dialog'); 17235 17236 $('.add-to-cart-global', dialog).attr('disabled', 17237 !$('.global-availability', dialog).data('ready-to-order') 17238 || !$('.global-availability', dialog).data('available') 17239 ); 17240 }); 17241 }, 17242 updateAvailability: function () { 17243 $('body').on('product:updateAvailability', function (e, response) { 17244 // bundle individual products 17245 $('.product-availability', response.$productContainer) 17246 .data('ready-to-order', response.product.readyToOrder) 17247 .data('available', response.product.available) 17248 .find('.availability-msg') 17249 .empty() 17250 .html(response.message); 17251 17252 17253 var dialog = $(response.$productContainer) 17254 .closest('.quick-view-dialog'); 17255 17256 if ($('.product-availability', dialog).length) { 17257 // bundle all products 17258 var allAvailable = $('.product-availability', dialog).toArray() 17259 .every(function (item) { return $(item).data('available'); }); 17260 17261 var allReady = $('.product-availability', dialog).toArray() 17262 .every(function (item) { return $(item).data('ready-to-order'); }); 17263 17264 $('.global-availability', dialog) 17265 .data('ready-to-order', allReady) 17266 .data('available', allAvailable); 17267 17268 $('.global-availability .availability-msg', dialog).empty() 17269 .html(allReady ? response.message : response.resources.info_selectforstock); 17270 } else { 17271 // single product 17272 $('.global-availability', dialog) 17273 .data('ready-to-order', response.product.readyToOrder) 17274 .data('available', response.product.available) 17275 .find('.availability-msg') 17276 .empty() 17277 .html(response.message); 17278 } 17279 }); 17280 } 17281}; 17282 17283$(document).on('click', '.tab-head2.ingredients', function (e) { 17284 $(this).addClass('selected'); 17285 $(this).siblings().removeClass('selected'); 17286 $(this).prevAll().removeClass('selected'); 17287 var temp = $(this).closest('.product-detail-bottom').children('#additionalInfo'); 17288 temp.find('.tab-content-ingredients').css('display', 'block'); 17289 temp.find('.tab-content-instructions').css('display', 'none'); 17290 temp.find('.tab-content-description').css('display', 'none'); 17291}); 17292 17293$(document).on('click', '.tab-head2.instructions', function (e) { 17294 $(this).addClass('selected'); 17295 $(this).siblings().removeClass('selected'); 17296 $(this).prevAll().removeClass('selected'); 17297 var temp = $(this).closest('.product-detail-bottom').children('#additionalInfo'); 17298 temp.find('.tab-content-instructions').css('display', 'block'); 17299 temp.find('.tab-content-description').css('display', 'none'); 17300 temp.find('.tab-content-ingredients').css('display', 'none'); 17301}); 17302 17303$(document).on('click', '.tab-head2.shortDescription', function (e) { 17304 $(this).addClass('selected'); 17305 $(this).siblings().removeClass('selected'); 17306 $(this).prevAll().removeClass('selected'); 17307 var temp = $(this).closest('.product-detail-bottom').children('#additionalInfo'); 17308 temp.find('.tab-content-description').css('display', 'block'); 17309 temp.find('.tab-content-instructions').css('display', 'none'); 17310 temp.find('.tab-content-ingredients').css('display', 'none'); 17311}); 17312 17313 17314$(document).on('mouseover', '.eys-modal-footer .tabListing li', function (e) { 17315 if (!$(this).hasClass('selected')) { 17316 $(this).find('.tab-divider span').addClass('eys-tab-divider'); 17317 } 17318}); 17319 17320$(document).on('mouseleave', '.eys-modal-footer .tabListing li', function (e) { 17321 $(this).find('.tab-divider span').removeClass('eys-tab-divider'); 17322}); 17323 17324$(document).on('click', '.magnified-close-btn', function () { 17325 $('#quickCarouselModal').modal('hide'); 17326 17327 $('#quickCarouselModal').on('hidden.bs.modal', function (e) { 17328 $(this).closest('body').addClass('modal-open'); 17329 }) 17330}); 17331 17332$(document).on('click', '.quick-close-btn', function () {
17333 $(this).closest('body.modal-open').children('.modal-backdrop').remove(); 17334}); 17335 17336$(document).on('click', '.image-zoom-close', function () { 17337 $('#quickCarouselModal').modal('hide'); 17338 17339 $('#quickCarouselModal').on('hidden.bs.modal', function (e) { 17340 $(this).closest('body').addClass('modal-open'); 17341 }) 17342}); 17343 17344/***/ }), 17345 17346/***/ 318: 17347/***/ (function(module, exports) { 17348 17349$(document).ready(function () { 17350 var $modal = $('#verifyMobileModal'); 17351 if ($modal.length) { 17352 $modal.modal({ 17353 backdrop: 'static', 17354 keyboard: false 17355 }).modal('show'); 17356 } 17357}); 17358 17359/** Disable inspect element */ 17360 17361// document.addEventListener('contextmenu', function(e) { 17362// e.preventDefault(); 17363// }); 17364 17365$('#mobileVerifyBtn').on('click', function() { 17366 $(this).addClass('otpSectionCheck'); 17367 var mobileNumber = $('#mobileNumberverification').val(); 17368 var otp = $('#verificationCode').val(); 17369 var formdata = { 17370 otp: otp, 17371 mobile: mobileNumber 17372 }; 17373 var url; 17374 if (otp) { 17375 url = $(this).attr('data-verify-otp'); 17376 $.ajax ({ 17377 url: url, 17378 type: 'GET', 17379 data: formdata, 17380 dataType: 'json', 17381 success: function (response) { 17382 if (response.success) { 17383 $('#verifyMobileModal').modal('hide'); 17384 var messageHtml = '<div id="otpSuccessMessage" style="position: fixed; top: 50%; left: 50%; ' + 17385 'transform: translate(-50%, -50%); background-color: #28a745; color: #fff; ' + 17386 'padding: 10px 15px; border-radius: 8px; z-index: 1050; font-size: 16px; text-align: center;">' + 17387 'OTP verification successful!' + 17388 '</div>'; 17389 17390 $('body').append(messageHtml); 17391 17392 // Remove message after 5 seconds 17393 setTimeout(function() { 17394 $('#otpSuccessMessage').fadeOut('slow', function() { 17395 $(this).remove(); 17396 }); 17397 }, 3000); 17398 } else { 17399 if (response.otpExpired) { 17400 $('#otpVerificationErrorMessage').text(response.message).removeClass('d-none'); 17401 $('#mobileVerifyBtn').addClass('d-none'); 17402 $('#otpResendBtn').removeClass('d-none'); 17403 } 17404 $('#otpVerificationErrorMessage').text(response.message).removeClass('d-none'); 17405 } 17406 }, 17407 error: function () { 17408 alert('Failed to verify OTP.'); 17409 } 17410 }); 17411 } else { 17412 url = $(this).attr('data-verify-number'); 17413 $.ajax ({ 17414 url: url + '?mobile=' + mobileNumber, 17415 type: 'GET', 17416 dataType: 'json', 17417 success: function (data) { 17418 if (!data.success && data.verifiedCustomerDetails) { 17419 $('#mergeAccount').removeClass('d-none'); 17420 $('#mobileVerifyBtn').addClass('d-none'); 17421 $('#mainLine').empty().append('This number is already verified with EmailAddress:' + ' ' + data.verifiedCustomerDetails); 17422 } else { 17423 $('#otpSection').removeClass('d-none'); 17424 $('#mobileVerifyBtn').removeClass('d-none'); 17425 $('#mobileUpdateBtn').addClass('d-none'); 17426 } 17427 }, 17428 error: function () { 17429 alert('Failed to load OTP section.'); 17430 } 17431 }); 17432 } 17433}); 17434 17435$('#mobileUpdateBtn').on('click', function() { 17436 var mobileNumber = $('#mobileNumberverification').val(); 17437 var url = $(this).attr('data-update-number'); 17438 $.ajax ({ 17439 url: url + '?mobile=' + mobileNumber, 17440 type: 'GET', 17441 dataType: 'json', 17442 success: function (data) { 17443 var messageContainer = $('#messageContainerUpdate'); 17444 messageContainer.empty(); // Clear previous messages 17445 17446 if (!data.success) { 17447 // Show inline error message 17448 messageContainer.html('<div class="error-message" style="color:red;margin:0;" >' + data.message + '</div>'); 17449 } else { 17450 $('#otpSection').removeClass('d-none'); 17451 $('#mobileVerifyBtn').removeClass('otpSectionCheck'); 17452 $('#mobileVerifyBtn').prop('disabled', false); 17453 $('#mobileVerifyBtn').removeClass('d-none'); 17454 $('#mobileUpdateBtn').addClass('d-none'); 17455 } 17456 }, 17457 error: function (data) { 17458 alert('Something went wrong'); 17459 } 17460 });
17461}); 17462 17463$('#mergeAccount').on('click', function() { 17464 var mobileNumber = $('#mobileNumberverification').val(); 17465 var url = $(this).attr('data-merge-account'); 17466 var confirmation = confirm('Once merged, this account will be deactivated. Your eligible points, orders, and purchase history will be consolidated into your primary account. Proceed?'); 17467 if (confirmation) { 17468 17469 $.ajax ({ 17470 url: url + '?mobile=' + mobileNumber, 17471 type: 'GET', 17472 dataType: 'json', 17473 success: function () { 17474 $('#verifyMobileModal').modal('hide'); 17475 var messageHtml = '<div id="otpSuccessMessage" style="position: fixed; top: 50%; left: 50%; ' + 17476 'transform: translate(-50%, -50%); background-color: #28a745; color: #fff; ' + 17477 'padding: 10px 15px; border-radius: 8px; z-index: 1050; font-size: 16px; text-align: center;">' + 17478 'Accounts Merged!' + 17479 '</div>'; 17480 17481 $('body').append(messageHtml); 17482 location.reload(); 17483 17484 // Remove message after 5 seconds 17485 setTimeout(function() { 17486 $('#otpSuccessMessage').fadeOut('slow', function() { 17487 $(this).remove(); 17488 }); 17489 }, 3000); 17490 }, 17491 error: function () { 17492 alert('Something went wrong'); 17493 } 17494 }); 17495 } 17496}); 17497 17498$('#otpResendBtn').on('click', function() { 17499 var mobileNumber = $('#mobileNumberverification').val(); 17500 var url = $(this).attr('data-resend-otp'); 17501 $.ajax ({ 17502 url: url + '?mobile=' + mobileNumber, 17503 type: 'GET', 17504 dataType: 'json', 17505 success: function (response) { 17506 $('#otpVerificationErrorMessage').empty(); 17507 $('#otpVerificationErrorMessage').text(response.message); 17508 $('#mobileVerifyBtn').removeClass('d-none'); 17509 $('#otpResendBtn').addClass('d-none'); 17510 }, 17511 error: function () { 17512 alert('Something went wrong'); 17513 } 17514 }); 17515}); 17516 17517$(document).ready(function () { 17518 function toggleButtons() { 17519 var $input = $('#mobileNumberverification'); // replace with your input ID/selector 17520 var profileNumber = String($input.data('profile-number')).trim(); 17521 var currentValue = String($input.val()).trim(); 17522 17523 if (profileNumber === currentValue) { 17524 // numbers match 17525 $('#mobileUpdateBtn').prop('disabled', true); 17526 $('#mobileVerifyBtn.otpSectionCheck').prop('disabled', false); 17527 } else { 17528 // numbers differ 17529 $('#mobileUpdateBtn').prop('disabled', false); 17530 $('#mobileVerifyBtn.otpSectionCheck').prop('disabled', true); 17531 } 17532 } 17533 17534 // Run on input change 17535 $('#mobileNumberverification').on('input', toggleButtons); 17536 17537 // Run once on page load 17538 toggleButtons(); 17539}); 17540 17541 17542// document.addEventListener('keydown', function(e) { 17543// if ( 17544// e.keyCode === 123 || 17545// (e.ctrlKey && e.shiftKey && (e.keyCode === 73 || e.keyCode === 74 || e.keyCode === 67)) || 17546// (e.ctrlKey && e.keyCode === 85) 17547// ) { 17548// e.preventDefault(); 17549// } 17550// }); 17551 17552 17553/***/ }), 17554 17555/***/ 319: 17556/***/ (function(module, exports) { 17557 17558/*! jCarousel - v0.3.9 - 2018-07-30 17559* http://sorgalla.com/jcarousel/ 17560* Copyright (c) 2006-2018 Jan Sorgalla; Licensed MIT */ 17561 17562!function(t){"use strict";var i=t.jCarousel={};i.version="0.3.9";var s=/^([+\-]=)?(.+)$/;i.parseTarget=function(t){var i=!1,e="object"!=typeof t?s.exec(t):null;return e?(t=parseInt(e[2],10)||0,e[1]&&(i=!0,"-="===e[1]&&(t*=-1))):"object"!=typeof t&&(t=parseInt(t,10)||0),{target:t,relative:i}},i.detectCarousel=function(t){for(var i;t.length>0;){if((i=t.filter("[data-jcarousel]")).length>0)return i;if((i=t.find("[data-jcarousel]")).length>0)return i;t=t.parent()}return null},i.base=function(s){return{version:i.version,_options:{},_element:null,_carousel:null,_init:t.noop,_create:t.noop,_destroy:t.noop,_reload:t.noop,create:function(){return this._element.attr("data-"+s.toLowerCase(),!0).data(s,this),!1===this._trigger("create")?this:(this._create(),this._trigger("createend"),this)},destroy:function(){return!1===this._trigger("destroy")?this:(this._destroy(),this._trigger("destroyend"),this._element.removeData(s).removeAttr("data-"+s.toLowerCase()),this)},reload:function(t){return!1===this._trigger("reload")?this:(t&&this.options(t),this._reload(),this._trigger("reloadend"),this)},element:function(){return this._element},options:function(i,s){if(0===arguments.length)return t.extend({},this._options);if("string"==typeof i){if(void 0===s)return void 0===this._options[i]?null:this._options[i];this._options[i]=s}else this._options=t.extend({},this._options,i);return this},carousel:function(){return this._carousel||(this._carousel=i.detectCarousel(this.options("carousel")||this._element),this._carousel||t.error('Could not detect carousel for plugin "'+s+'"')),this._carousel},_trigger:function(i,e,r){var n,o=!1;return r=[this].concat(r||[]),(e||this._element).each(function(){n=t.Event((s+":"+i).toLowerCase()),t(this).trigger(n,r),n.isDefaultPrevented()&&(o=!0)}),!o}}},i.plugin=function(s,e){var r=t[s]=function(i,s){this._element=t(i),this.options(s),this._init(),this.create()};return r.fn=r.prototype=t.extend({},i.base(s),e),t.fn[s]=function(i){var e=Array.prototype.slice.call(arguments,1
17562),n=this;return"string"==typeof i?this.each(function(){var r=t(this).data(s);if(!r)return t.error("Cannot call methods on "+s+' prior to initialization; attempted to call method "'+i+'"');if(!t.isFunction(r[i])||"_"===i.charAt(0))return t.error('No such method "'+i+'" for '+s+" instance");var o=r[i].apply(r,e);return o!==r&&void 0!==o?(n=o,!1):void 0}):this.each(function(){var e=t(this).data(s);e instanceof r?e.reload(i):new r(this,i)}),n},r}}(jQuery),function(t,i){"use strict";var s=t(i),e=function(t){return parseFloat(t)||0};t.jCarousel.plugin("jcarousel",{animating:!1,tail:0,inTail:!1,resizeState:null,resizeTimer:null,lt:null,vertical:!1,rtl:!1,circular:!1,underflow:!1,relative:!1,_options:{list:function(){return this.element().children().eq(0)},items:function(){return this.list().children()},animation:400,transitions:!1,wrap:null,vertical:null,rtl:null,center:!1},_list:null,_items:null,_target:t(),_first:t(),_last:t(),_visible:t(),_fullyvisible:t(),_init:function(){var t=this;return t.resizeState=s.width()+"x"+s.height(),this.onWindowResize=function(){t.resizeTimer&&clearTimeout(t.resizeTimer),t.resizeTimer=setTimeout(function(){var i=s.width()+"x"+s.height();i!==t.resizeState&&(t.resizeState=i,t.reload())},100)},this},_create:function(){this._reload(),s.on("resize.jcarousel",this.onWindowResize)},_destroy:function(){s.off("resize.jcarousel",this.onWindowResize)},_reload:function(){this.vertical=this.options("vertical"),null==this.vertical&&(this.vertical=e(this.list().height())>e(this.list().width())),this.rtl=this.options("rtl"),null==this.rtl&&(this.rtl=function(i){if("rtl"===(""+i.attr("dir")).toLowerCase())return!0;var s=!1;return i.parents("[dir]").each(function(){if(/rtl/i.test(t(this).attr("dir")))return s=!0,!1}),s}(this._element)),this.lt=this.vertical?"top":"left",this.relative="relative"===this.list().css("position"),this._list=null,this._items=null;var i=this.index(this._target)>=0?this._target:this.closest();this.circular="circular"===this.options("wrap"),this.underflow=!1;var s={left:0,top:0};return i.length>0&&(this._prepare(i),this.list().find("[data-jcarousel-clone]").remove(),this._items=null,this.underflow=this._fullyvisible.length>=this.items().length,this.circular=this.circular&&!this.underflow,s[this.lt]=this._position(i)+"px"),this.move(s),this},list:function(){if(null===this._list){var i=this.options("list");this._list=t.isFunction(i)?i.call(this):this._element.find(i)}return this._list},items:function(){if(null===this._items){var i=this.options("items");this._items=(t.isFunction(i)?i.call(this):this.list().find(i)).not("[data-jcarousel-clone]")}return this._items},index:function(t){return this.items().index(t)},closest:function(){var i,s=this,r=this.list().position()[this.lt],n=t(),o=!1,l=this.vertical?"bottom":this.rtl&&!this.relative?"left":"right";return this.rtl&&this.relative&&!this.vertical&&(r+=e(this.list().width())-this.clipping()),this.items().each(function(){if(n=t(this),o)return!1;var a=s.dimension(n);if((r+=a)>=0){if(i=a-e(n.css("margin-"+l)),!(Math.abs(r)-a+i/2<=0))return!1;o=!0}}),n},target:function(){return this._target},first:function(){return this._first},last:function(){return this._last},visible:function(){return this._visible},fullyvisible:function(){return this._fullyvisible},hasNext:function(){if(!1===this._trigger("hasnext"))return!0;var t=this.options("wrap"),i=this.items().length-1,s=this.options("center")?this._target:this._last;return!!(i>=0&&!this.underflow&&(t&&"first"!==t||this.index(s)<i||this.tail&&!this.inTail))},hasPrev:function(){if(!1===this._trigger("hasprev"))return!0;var t=this.options("wrap");return!!(this.items().length>0&&!this.underflow&&(t&&"last"!==t||this.index(this._first)>0||this.tail&&this.inTail))},clipping:function(){return e(this._element["inner"+(this.vertical?"Height":"Width")]())},dimension:function(t){return e(t["outer"+(this.vertical?"Height":"Width")](!0))},scroll:function(i,s,e){if(this.animating)return this;if(!1===this._trigger("scroll",null,[i,s]))return this;t.isFunction(s)&&(e=s,s=!0);var r=t.jCarousel.parseTarget(i);if(r.relative){var n,o,l,a,h,u,c,f,d=this.items().length-1,_=Math.abs(r.target),p=this.options("wrap");if(r.target>0){var g=this.index(this._last);if(g>=d&&this.tail)this.inTail?"both"===p||"last"===p?this._scroll(0,s,e):t.isFunction(e)&&e.call(this,!1):this._scrollTail(s,e);else if(n=this.index(this._target),this.underflow&&n===d&&("circular"===p||"both"===p||"last"===p)||!this.underflow&&g===d&&("both"===p||"last"===p))this._scroll(0,s,e);else if(l=n+_,this.circular&&l>d){for(f=d,h=this.items().get(-1);f++<l;)h=this.items().eq(0),(u=this._visible.index(h)>=0)&&h.after(h.clone(!0).attr("data-jcarousel-clone",!0)),this.list().append(h),u||((c={})[this.lt]=this.dimension(h),this.moveBy(c)),this._items=null;this._scroll(h,s,e)}else this._scroll(Math.min(l,d),s,e)}else if(this.inTail)this._scroll(Math.max(this.index(this._first)-_+1,0),s,e);else if(o=this.index(this._first),n=this.index(this._target),l=(a=this.underflow?n:o)-_,a<=0&&(this.underflow&&"circular"===p||"both"===p||"first"===p))this._scroll(d,s,e);else if(this.circular&&l<0){for(f=l,h=this.items().get(0);f++<0;){h=this.items().eq(-1),(u=this._visible.index(h)>=0)&&h.after(h.clone(!0).attr("data-jcarousel-clone",!0)),this.list().prepend(h),this._items=null;var m=this.dimension(h);(c={})[this.lt]=-m,this.moveBy(c)}this._scroll(h,s,e)}else this._scroll(Math.max(l,0),s,e)}else this._scroll(r.target,s,e);return this._trigger("scrollend"),this},moveBy:function(t,i){var s=this.list().position(),r=1,n=0;return this.rtl&&!this.vertical&&(r=-1,this.relative&&(n=e(this.list().width())-this.clipping())),t.left&&(t.left=e(s.left)+n+e(t.left)*r+"px"),t.top&&(t.top=e(s.top)+n+e(t.top)*r+"px"),this.move(t,i)},move:function(i,s){s=s||{};var e=this.options("transitions"),r=!!e,n=!!e.transforms,o=!!e.transforms3d,l=s.duration||0,a=this.list();if(!r&&l>0)a.animate(i,s);else{var h=s.complete||t.noop,u={};if(r){var c={transitionDuration:a.css("transitionDuration"),transitionTimingFunction:a.css("transitionTimingFunction"),transitionProperty:a.css("transitionProperty")},f=h;h=function(){t(this).css(c),f.call(this)},u={transitionDuration:(l>0?l/1e3:0)+"s",transitionTimingFunction:e.easing||s.easing,transitionProperty:l>
175620?n||o?"all":i.left?"left":"top":"none",transform:"none"}}o?u.transform="translate3d("+(i.left||0)+","+(i.top||0)+",0)":n?u.transform="translate("+(i.left||0)+","+(i.top||0)+")":t.extend(u,i),r&&l>0&&a.one("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd",h),a.css(u),l<=0&&a.each(function(){h.call(this)})}},_scroll:function(i,s,r){if(this.animating)return t.isFunction(r)&&r.call(this,!1),this;if("object"!=typeof i?i=this.items().eq(i):void 0===i.jquery&&(i=t(i)),0===i.length)return t.isFunction(r)&&r.call(this,!1),this;this.inTail=!1,this._prepare(i);var n=this._position(i);if(n===e(this.list().position()[this.lt]))return t.isFunction(r)&&r.call(this,!1),this;var o={};return o[this.lt]=n+"px",this._animate(o,s,r),this},_scrollTail:function(i,s){if(this.animating||!this.tail)return t.isFunction(s)&&s.call(this,!1),this;var r=this.list().position()[this.lt];this.rtl&&this.relative&&!this.vertical&&(r+=e(this.list().width())-this.clipping()),this.rtl&&!this.vertical?r+=this.tail:r-=this.tail,this.inTail=!0;var n={};return n[this.lt]=r+"px",this._update({target:this._target.next(),fullyvisible:this._fullyvisible.slice(1).add(this._visible.last())}),this._animate(n,i,s),this},_animate:function(i,s,e){if(e=e||t.noop,!1===this._trigger("animate"))return e.call(this,!1),this;this.animating=!0;var r=this.options("animation"),n=t.proxy(function(){this.animating=!1;var t=this.list().find("[data-jcarousel-clone]");t.length>0&&(t.remove(),this._reload()),this._trigger("animateend"),e.call(this,!0)},this),o="object"==typeof r?t.extend({},r):{duration:r},l=o.complete||t.noop;return!1===s?o.duration=0:void 0!==t.fx.speeds[o.duration]&&(o.duration=t.fx.speeds[o.duration]),o.complete=function(){n(),l.call(this)},this.move(i,o),this},_prepare:function(i){var s,r,n,o=this.index(i),l=o,a=this.dimension(i),h=this.clipping(),u=this.vertical?"bottom":this.rtl?"left":"right",c=this.options("center"),f={target:i,first:i,last:i,visible:i,fullyvisible:a<=h?i:t()};if(c&&(a/=2,h/=2),a<h)for(;;){if(0===(s=this.items().eq(++l)).length){if(!this.circular)break;if(s=this.items().eq(0),i.get(0)===s.get(0))break;if((r=this._visible.index(s)>=0)&&s.after(s.clone(!0).attr("data-jcarousel-clone",!0)),this.list().append(s),!r){var d={};d[this.lt]=this.dimension(s),this.moveBy(d)}this._items=null}if(0===(n=this.dimension(s)))break;if(a+=n,f.last=s,f.visible=f.visible.add(s),a-e(s.css("margin-"+u))<=h&&(f.fullyvisible=f.fullyvisible.add(s)),a>=h)break}if(!this.circular&&!c&&a<h)for(l=o;!(--l<0||0===(s=this.items().eq(l)).length||0===(n=this.dimension(s))||(a+=n,f.first=s,f.visible=f.visible.add(s),a-e(s.css("margin-"+u))<=h&&(f.fullyvisible=f.fullyvisible.add(s)),a>=h)););return this._update(f),this.tail=0,c||"circular"===this.options("wrap")||"custom"===this.options("wrap")||this.index(f.last)!==this.items().length-1||(a-=e(f.last.css("margin-"+u)))>h&&(this.tail=a-h),this},_position:function(t){var i=this._first,s=e(i.position()[this.lt]),r=this.options("center"),n=r?this.clipping()/2-this.dimension(i)/2:0;return this.rtl&&!this.vertical?(this.relative?s-=e(this.list().width())-this.dimension(i):s-=this.clipping()-this.dimension(i),s+=n):s-=n,!r&&(this.index(t)>this.index(i)||this.inTail)&&this.tail?(s=this.rtl&&!this.vertical?s-this.tail:s+this.tail,this.inTail=!0):this.inTail=!1,-s},_update:function(i){var s,e=this,r={target:this._target,first:this._first,last:this._last,visible:this._visible,fullyvisible:this._fullyvisible},n=this.index(i.first||r.first)<this.index(r.first),o=function(s){var o=[],l=[];i[s].each(function(){r[s].index(this)<0&&o.push(this)}),r[s].each(function(){i[s].index(this)<0&&l.push(this)}),n?o=o.reverse():l=l.reverse(),e._trigger(s+"in",t(o)),e._trigger(s+"out",t(l)),e["_"+s]=i[s]};for(s in i)o(s);return this}})}(jQuery,window),function(t){"use strict";t.jcarousel.fn.scrollIntoView=function(i,s,e){var r,n=t.jCarousel.parseTarget(i),o=this.index(this._fullyvisible.first()),l=this.index(this._fullyvisible.last());if((r=n.relative?n.target<0?Math.max(0,o+n.target):l+n.target:"object"!=typeof n.target?n.target:this.index(n.target))<o)return this.scroll(r,s,e);if(r>=o&&r<=l)return t.isFunction(e)&&e.call(this,!1),this;for(var a,h=this.items(),u=this.clipping(),c=this.vertical?"bottom":this.rtl?"left":"right",f=0;0!==(a=h.eq(r)).length;){if((f+=this.dimension(a))>=u){f-(parseFloat(a.css("margin-"+c))||0)!==u&&r++;break}if(r<=0)break;r--}return this.scroll(r,s,e)}}(jQuery),function(t){"use strict";
17562t.jCarousel.plugin("jcarouselControl",{_options:{target:"+=1",event:"click",method:"scroll"},_active:null,_init:function(){this.onDestroy=t.proxy(function(){this._destroy(),this.carousel().one("jcarousel:createend",t.proxy(this._create,this))},this),this.onReload=t.proxy(this._reload,this),this.onEvent=t.proxy(function(i){i.preventDefault();var s=this.options("method");t.isFunction(s)?s.call(this):this.carousel().jcarousel(this.options("method"),this.options("target"))},this)},_create:function(){this.carousel().one("jcarousel:destroy",this.onDestroy).on("jcarousel:reloadend jcarousel:scrollend",this.onReload),this._element.on(this.options("event")+".jcarouselcontrol",this.onEvent),this._reload()},_destroy:function(){this._element.off(".jcarouselcontrol",this.onEvent),this.carousel().off("jcarousel:destroy",this.onDestroy).off("jcarousel:reloadend jcarousel:scrollend",this.onReload)},_reload:function(){var i,s=t.jCarousel.parseTarget(this.options("target")),e=this.carousel();if(s.relative)i=e.jcarousel(s.target>0?"hasNext":"hasPrev");else{var r="object"!=typeof s.target?e.jcarousel("items").eq(s.target):s.target;i=e.jcarousel("target").index(r)>=0}return this._active!==i&&(this._trigger(i?"active":"inactive"),this._active=i),this}})}(jQuery),function(t){"use strict";t.jCarousel.plugin("jcarouselPagination",{_options:{perPage:null,item:function(t){return'<a href="#'+t+'">'+t+"</a>"},event:"click",method:"scroll"},_carouselItems:null,_pages:{},_items:{},_currentPage:null,_init:function(){this.onDestroy=t.proxy(function(){this._destroy(),this.carousel().one("jcarousel:createend",t.proxy(this._create,this))},this),this.onReload=t.proxy(this._reload,this),this.onScroll=t.proxy(this._update,this)},_create:function(){this.carousel().one("jcarousel:destroy",this.onDestroy).on("jcarou
17562sel:reloadend",this.onReload).on("jcarousel:scrollend",this.onScroll),this._reload()},_destroy:function(){this._clear(),this.carousel().off("jcarousel:destroy",this.onDestroy).off("jcarousel:reloadend",this.onReload).off("jcarousel:scrollend",this.onScroll),this._carouselItems=null},_reload:function(){var i=this.options("perPage");if(this._pages={},this._items={},t.isFunction(i)&&(i=i.call(this)),null==i)this._pages=this._calculatePages();else for(var s,e=parseInt(i,10)||0,r=this._getCarouselItems(),n=1,o=0;0!==(s=r.eq(o++)).length;)this._pages[n]?this._pages[n]=this._pages[n].add(s):this._pages[n]=s,o%e==0&&n++;this._clear();var l=this,a=this.carousel().data("jcarousel"),h=this._element,u=this.options("item"),c=this._getCarouselItems().length;t.each(this._pages,function(i,s){var e=l._items[i]=t(u.call(l,i,s));e.on(l.options("event")+".jcarouselpagination",t.proxy(function(){var t=s.eq(0);if(a.circular){var e=a.index(a.target()),r=a.index(t);parseFloat(i)>parseFloat(l._currentPage)?r<e&&(t="+="+(c-e+r)):r>e&&(t="-="+(e+(c-r)))}a[this.options("method")](t)},l)),h.append(e)}),this._update()},_update:function(){var i,s=this.carousel().jcarousel("target");t.each(this._pages,function(t,e){if(e.each(function(){if(s.is(this))return i=t,!1}),i)return!1}),this._currentPage!==i&&(this._trigger("inactive",this._items[this._currentPage]),this._trigger("active",this._items[i])),this._currentPage=i},items:function(){return this._items},reloadCarouselItems:function(){return this._carouselItems=null,this},_clear:function(){this._element.empty(),this._currentPage=null},_calculatePages:function(){for(var t,i,s=this.carousel().data("jcarousel"),e=this._getCarouselItems(),r=s.clipping(),n=0,o=0,l=1,a={};0!==(t=e.eq(o++)).length;)n+(i=s.dimension(t))>r&&(l++,n=0),n+=i,a[l]?a[l]=a[l].add(t):a[l]=t;return a},_getCarouselItems:function(){return this._carouselItems||(this._carouselItems=this.carousel().jcarousel("items")),this._carouselItems}})}(jQuery),function(t,i){"use strict";var s,e;t.each({hidden:"visibilitychange",mozHidden:"mozvisibilitychange",msHidden:"msvisibilitychange",webkitHidden:"webkitvisibilitychange"},function(t,r){if(void 0!==i[t])return s=t,e=r,!1}),t.jCarousel.plugin("jcarouselAutoscroll",{_options:{target:"+=1",interval:3e3,autostart:!0,method:"scroll"},_timer:null,_started:!1,_init:function(){this.onDestroy=t.proxy(function(){this._destroy(),this.carousel().one("jcarousel:createend",t.proxy(this._create,this))},this),this.onAnimateEnd=t.proxy(this._start,this),this.onVisibilityChange=t.proxy(function(){i[s]?this._stop():this._start()},this)},_create:function(){this.carousel().one("jcarousel:destroy",this.onDestroy),t(i).on(e,this.onVisibilityChange),this.options("autostart")&&this.start()},_destroy:function(){this._stop(),this.carousel().off("jcarousel:destroy",this.onDestroy),t(i).off(e,this.onVisibilityChange)},_start:function(){if(this._stop(),this._started)return this.carousel().one("jcarousel:animateend",this.onAnimateEnd),this._timer=setTimeout(t.proxy(function(){this.carousel().jcarousel(this.options("method"),this.options("target"))},this),this.options("interval")),this},_stop:function(){return this._timer&&(this._timer=clearTimeout(this._timer)),this.carousel().off("jcarousel:animateend",this.onAnimateEnd),this},start:function(){return this._started=!0,this._start(),this},stop:function(){return this._started=!1,this._stop(),this}})}(jQuery,document); 17563 17564/***/ }), 17565 17566/***/ 320: 17567/***/ (function(module, exports) { 17568 17569$(window).on('load', function() { 17570 17571 $('.jcarousel').jcarousel(); 17572 17573 $('.jcarousel-control-prev') 17574 .on('jcarouselcontrol:active', function () { 17575 $(this).removeClass('inactive'); 17576 }) 17577 .on('jcarouselcontrol:inactive', function () { 17578 $(this).addClass('inactive'); 17579 }) 17580 .jcarouselControl({ 17581 target: '-=1' 17582 }); 17583 17584 $('.jcarousel-control-next') 17585 .on('jcarouselcontrol:active', function () { 17586 $(this).removeClass('inactive'); 17587 }) 17588 .on('jcarouselcontrol:inactive', function () { 17589 $(this).addClass('inactive'); 17590 }) 17591 .jcarouselControl({ 17592 target: '+=1' 17593 }); 17594}); 17595 17596/***/ }), 17597 17598/***/ 321: 17599/***/ (function(module, exports, __webpack_require__) { 17600 17601var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* 17602 _ _ _ _ 17603 ___| (_) ___| | __ (_)___ 17604/ __| | |/ __| |/ / | / __| 17605\__ \ | | (__| < _ | \__ \ 17606|___/_|_|\___|_|\_(_)/ |___/ 17607 |__/ 17608 17609 Version: 1.8.0 17610 Author: Ken Wheeler 17611 Website: http://kenwheeler.github.io 17612 Docs: http://kenwheeler.github.io/slick 17613 Repo: http://github.com/kenwheeler/slick 17614 Issues: http://github.com/kenwheeler/slick/issues 17615 17616 */ 17617/* global window, document, define, jQuery, setInterval, clearInterval */ 17618;(function(factory) { 17619 'use strict'; 17620 if (true) { 17621 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(275)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 17622 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 17623 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
vendor: 4,177 bytes, lines 17624-17747
17624 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 17625 } else {} 17626 17627}(function($) { 17628 'use strict'; 17629 var Slick = window.Slick || {}; 17630 17631 Slick = (function() { 17632 17633 var instanceUid = 0; 17634 17635 function Slick(element, settings) { 17636 17637 var _ = this, dataSettings; 17638 17639 _.defaults = { 17640 accessibility: true, 17641 adaptiveHeight: false, 17642 appendArrows: $(element), 17643 appendDots: $(element), 17644 arrows: true, 17645 asNavFor: null, 17646 prevArrow: '<button class="slick-prev" aria-label="Previous" type="button">Previous</button>', 17647 nextArrow: '<button class="slick-next" aria-label="Next" type="button">Next</button>', 17648 autoplay: false, 17649 autoplaySpeed: 3000, 17650 centerMode: false, 17651 centerPadding: '50px', 17652 cssEase: 'ease', 17653 customPaging: function(slider, i) { 17654 return $('<button type="button" />').text(i + 1); 17655 }, 17656 dots: false, 17657 dotsClass: 'slick-dots', 17658 draggable: true, 17659 easing: 'linear', 17660 edgeFriction: 0.35, 17661 fade: false, 17662 focusOnSelect: false, 17663 focusOnChange: false, 17664 infinite: true, 17665 initialSlide: 0, 17666 lazyLoad: 'ondemand', 17667 mobileFirst: false, 17668 pauseOnHover: true, 17669 pauseOnFocus: true, 17670 pauseOnDotsHover: false, 17671 respondTo: 'window', 17672 responsive: null, 17673 rows: 1, 17674 rtl: false, 17675 slide: '', 17676 slidesPerRow: 1, 17677 slidesToShow: 1, 17678 slidesToScroll: 1, 17679 speed: 500, 17680 swipe: true, 17681 swipeToSlide: false, 17682 touchMove: true, 17683 touchThreshold: 5, 17684 useCSS: true, 17685 useTransform: true, 17686 variableWidth: false, 17687 vertical: false, 17688 verticalSwiping: false, 17689 waitForAnimate: true, 17690 zIndex: 1000 17691 }; 17692 17693 _.initials = { 17694 animating: false, 17695 dragging: false, 17696 autoPlayTimer: null, 17697 currentDirection: 0, 17698 currentLeft: null, 17699 currentSlide: 0, 17700 direction: 1, 17701 $dots: null, 17702 listWidth: null, 17703 listHeight: null, 17704 loadIndex: 0, 17705 $nextArrow: null, 17706 $prevArrow: null, 17707 scrolling: false, 17708 slideCount: null, 17709 slideWidth: null, 17710 $slideTrack: null, 17711 $slides: null, 17712 sliding: false, 17713 slideOffset: 0, 17714 swipeLeft: null, 17715 swiping: false, 17716 $list: null, 17717 touchObject: {}, 17718 transformsEnabled: false, 17719 unslicked: false 17720 }; 17721 17722 $.extend(_, _.initials); 17723 17724 _.activeBreakpoint = null; 17725 _.animType = null; 17726 _.animProp = null; 17727 _.breakpoints = []; 17728 _.breakpointSettings = []; 17729 _.cssTransitions = false; 17730 _.focussed = false; 17731 _.interrupted = false; 17732 _.hidden = 'hidden'; 17733 _.paused = true; 17734 _.positionProp = null; 17735 _.respondTo = null; 17736 _.rowCount = 1; 17737 _.shouldClick = true; 17738 _.$slider = $(element); 17739 _.$slidesCache = null; 17740 _.transformType = null; 17741 _.transitionType = null; 17742 _.visibilityChange = 'visibilitychange'; 17743 _.windowWidth = 0; 17744 _.windowTimer = null; 17745 17746 dataSettings = $(element).data('slick') || {}; 17747
17748 _.options = $.extend({}, _.defaults, settings, dataSettings); 17749 17750 _.currentSlide = _.options.initialSlide; 17751 17752 _.originalSettings = _.options; 17753 17754 if (typeof document.mozHidden !== 'undefined') { 17755 _.hidden = 'mozHidden'; 17756 _.visibilityChange = 'mozvisibilitychange'; 17757 } else if (typeof document.webkitHidden !== 'undefined') { 17758 _.hidden = 'webkitHidden'; 17759 _.visibilityChange = 'webkitvisibilitychange'; 17760 } 17761 17762 _.autoPlay = $.proxy(_.autoPlay, _); 17763 _.autoPlayClear = $.proxy(_.autoPlayClear, _); 17764 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _); 17765 _.changeSlide = $.proxy(_.changeSlide, _); 17766 _.clickHandler = $.proxy(_.clickHandler, _); 17767 _.selectHandler = $.proxy(_.selectHandler, _); 17768 _.setPosition = $.proxy(_.setPosition, _); 17769 _.swipeHandler = $.proxy(_.swipeHandler, _); 17770 _.dragHandler = $.proxy(_.dragHandler, _); 17771 _.keyHandler = $.proxy(_.keyHandler, _); 17772 17773 _.instanceUid = instanceUid++; 17774 17775 // A simple way to check for HTML strings 17776 // Strict HTML recognition (must start with <) 17777 // Extracted from jQuery v1.11 source 17778 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; 17779 17780 17781 _.registerBreakpoints(); 17782 _.init(true); 17783 17784 } 17785 17786 return Slick; 17787 17788 }()); 17789 17790 Slick.prototype.activateADA = function() { 17791 var _ = this; 17792 17793 _.$slideTrack.find('.slick-active').attr({ 17794 'aria-hidden': 'false' 17795 }).find('a, input, button, select').attr({ 17796 'tabindex': '0' 17797 }); 17798 17799 }; 17800 17801 Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) { 17802 17803 var _ = this; 17804 17805 if (typeof(index) === 'boolean') { 17806 addBefore = index; 17807 index = null; 17808 } else if (index < 0 || (index >= _.slideCount)) { 17809 return false; 17810 } 17811 17812 _.unload(); 17813 17814 if (typeof(index) === 'number') { 17815 if (index === 0 && _.$slides.length === 0) { 17816 $(markup).appendTo(_.$slideTrack); 17817 } else if (addBefore) { 17818 $(markup).insertBefore(_.$slides.eq(index)); 17819 } else { 17820 $(markup).insertAfter(_.$slides.eq(index)); 17821 } 17822 } else { 17823 if (addBefore === true) { 17824 $(markup).prependTo(_.$slideTrack); 17825 } else { 17826 $(markup).appendTo(_.$slideTrack); 17827 } 17828 } 17829 17830 _.$slides = _.$slideTrack.children(this.options.slide); 17831 17832 _.$slideTrack.children(this.options.slide).detach(); 17833 17834 _.$slideTrack.append(_.$slides); 17835 17836 _.$slides.each(function(index, element) { 17837 $(element).attr('data-slick-index', index); 17838 }); 17839 17840 _.$slidesCache = _.$slides; 17841 17842 _.reinit(); 17843 17844 }; 17845 17846 Slick.prototype.animateHeight = function() { 17847 var _ = this; 17848 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 17849 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 17850 _.$list.animate({ 17851 height: targetHeight 17852 }, _.options.speed); 17853 } 17854 }; 17855 17856 Slick.prototype.animateSlide = function(targetLeft, callback) { 17857 17858 var animProps = {}, 17859 _ = this; 17860 17861 _.animateHeight(); 17862 17863 if (_.options.rtl === true && _.options.vertical === false) { 17864 targetLeft = -targetLeft; 17865 } 17866 if (_.transformsEnabled === false) { 17867 if (_.options.vertical === false) { 17868 _.$slideTrack.animate({ 17869 left: targetLeft 17870 }, _.options.speed, _.options.easing, callback); 17871 } else { 17872 _.$slideTrack.animate({ 17873 top: targetLeft 17874 }, _.options.speed, _.options.easing, callback); 17875 } 17876 17877 } else { 17878 17879 if (_.cssTransitions === false) { 17880 if (_.options.rtl === true) { 17881 _.currentLeft = -(_.currentLeft); 17882 } 17883 $({ 17884 animStart: _.currentLeft 17885 }).animate({ 17886 animStart: targetLeft 17887 }, { 17888 duration: _.options.speed, 17889 easing: _.options.easing, 17890 step: function(now) { 17891 now = Math.ceil(now); 17892 if (_.options.vertical === false) { 17893 animProps[_.animType] = 'translate(' + 17894 now + 'px, 0px)'; 17895 _.$slideTrack.css(animProps); 17896 } else { 17897 animProps[_.animType] = 'translate(0px,' + 17898 now + 'px)'; 17899 _.$slideTrack.css(animProps); 17900 } 17901 }, 17902 complete: function() { 17903 if (callback) { 17904 callback.call(); 17905 } 17906 } 17907 }); 17908 17909 } else { 17910 17911 _.applyTransition();
17912 targetLeft = Math.ceil(targetLeft); 17913 17914 if (_.options.vertical === false) { 17915 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)'; 17916 } else { 17917 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)'; 17918 } 17919 _.$slideTrack.css(animProps); 17920 17921 if (callback) { 17922 setTimeout(function() { 17923 17924 _.disableTransition(); 17925 17926 callback.call(); 17927 }, _.options.speed); 17928 } 17929 17930 } 17931 17932 } 17933 17934 }; 17935 17936 Slick.prototype.getNavTarget = function() { 17937 17938 var _ = this, 17939 asNavFor = _.options.asNavFor; 17940 17941 if ( asNavFor && asNavFor !== null ) { 17942 asNavFor = $(asNavFor).not(_.$slider); 17943 } 17944 17945 return asNavFor; 17946 17947 }; 17948 17949 Slick.prototype.asNavFor = function(index) { 17950 17951 var _ = this, 17952 asNavFor = _.getNavTarget(); 17953 17954 if ( asNavFor !== null && typeof asNavFor === 'object' ) { 17955 asNavFor.each(function() { 17956 var target = $(this).slick('getSlick'); 17957 if(!target.unslicked) { 17958 target.slideHandler(index, true); 17959 } 17960 }); 17961 } 17962 17963 }; 17964 17965 Slick.prototype.applyTransition = function(slide) { 17966 17967 var _ = this, 17968 transition = {}; 17969 17970 if (_.options.fade === false) { 17971 transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase; 17972 } else { 17973 transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase; 17974 } 17975 17976 if (_.options.fade === false) { 17977 _.$slideTrack.css(transition); 17978 } else { 17979 _.$slides.eq(slide).css(transition); 17980 } 17981 17982 }; 17983 17984 Slick.prototype.autoPlay = function() { 17985 17986 var _ = this; 17987 17988 _.autoPlayClear(); 17989 17990 if ( _.slideCount > _.options.slidesToShow ) { 17991 _.autoPlayTimer = setInterval( _.autoPlayIterator, _.options.autoplaySpeed ); 17992 } 17993 17994 }; 17995 17996 Slick.prototype.autoPlayClear = function() { 17997 17998 var _ = this; 17999 18000 if (_.autoPlayTimer) { 18001 clearInterval(_.autoPlayTimer); 18002 } 18003 18004 }; 18005 18006 Slick.prototype.autoPlayIterator = function() { 18007 18008 var _ = this, 18009 slideTo = _.currentSlide + _.options.slidesToScroll; 18010 18011 if ( !_.paused && !_.interrupted && !_.focussed ) { 18012 18013 if ( _.options.infinite === false ) { 18014 18015 if ( _.direction === 1 && ( _.currentSlide + 1 ) === ( _.slideCount - 1 )) { 18016 _.direction = 0; 18017 } 18018 18019 else if ( _.direction === 0 ) { 18020 18021 slideTo = _.currentSlide - _.options.slidesToScroll; 18022 18023 if ( _.currentSlide - 1 === 0 ) { 18024 _.direction = 1; 18025 } 18026 18027 } 18028 18029 } 18030 18031 _.slideHandler( slideTo ); 18032 18033 } 18034 18035 }; 18036 18037 Slick.prototype.buildArrows = function() { 18038 18039 var _ = this; 18040 18041 if (_.options.arrows === true ) { 18042 18043 _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow'); 18044 _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow'); 18045 18046 if( _.slideCount > _.options.slidesToShow ) { 18047 18048 _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 18049 _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 18050 18051 if (_.htmlExpr.test(_.options.prevArrow)) { 18052 _.$prevArrow.prependTo(_.options.appendArrows); 18053 } 18054 18055 if (_.htmlExpr.test(_.options.nextArrow)) { 18056 _.$nextArrow.appendTo(_.options.appendArrows); 18057 } 18058 18059 if (_.options.infinite !== true) { 18060 _.$prevArrow 18061 .addClass('slick-disabled') 18062 .attr('aria-disabled', 'true'); 18063 } 18064 18065 } else { 18066 18067 _.$prevArrow.add( _.$nextArrow ) 18068 18069 .addClass('slick-hidden') 18070 .attr({ 18071 'aria-disabled': 'true', 18072 'tabindex': '-1' 18073 }); 18074 18075 } 18076 18077 } 18078 18079 }; 18080 18081 Slick.prototype.buildDots = function() { 18082 18083 var _ = this, 18084 i, dot; 18085 18086 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 18087 18088 _.$slider.addClass('slick-dotted'); 18089 18090 dot = $('<ul />').addClass(_.options.dotsClass); 18091 18092 for (i = 0; i <= _.getDotCount(); i += 1) { 18093 dot.append($('<li />').append(_.options.customPaging.call(this, _, i))); 18094 } 18095 18096 _.$dots = dot.appendTo(_.options.appendDots); 18097 18098 _.$dots.find('li').first().addClass('slick-active'); 18099 18100 } 18101 18102 }; 18103 18104 Slick.prototype.buildOut = function() { 18105 18106 var _ = this; 18107 18108 _.$slides = 18109 _.$slider 18110 .children( _.options.slide + ':not(.slick-cloned)') 18111 .addClass('slick-slide'); 18112 18113 _.slideCount = _.$slides.length; 18114 18115 _.$slides.each(function(index, element) { 18116 $(element) 18117 .attr('data-slick-index', index) 18118 .data('originalStyling', $(element).attr('style') || ''); 18119 }); 18120 18121 _.$slider.addClass('slick-slider'); 18122 18123 _.$slideTrack = (_.slideCount === 0) ? 18124 $('<div class="slick-track"/>').appendTo(_.$slider) : 18125 _.$slides.wrapAll('<div class="slick-track"/>').parent(); 18126 18127 _.$list = _.$slideTrack.wrap( 18128 '<div class="slick-list"/>').parent(); 18129 _.$slideTrack.css('opacity', 0); 18130 18131 if (_.options.centerMode === true || _.options.swipeToSlide === true) {
18132 _.options.slidesToScroll = 1; 18133 } 18134 18135 $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading'); 18136 18137 _.setupInfinite(); 18138 18139 _.buildArrows(); 18140 18141 _.buildDots(); 18142 18143 _.updateDots(); 18144 18145 18146 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 18147 18148 if (_.options.draggable === true) { 18149 _.$list.addClass('draggable'); 18150 } 18151 18152 }; 18153 18154 Slick.prototype.buildRows = function() { 18155 18156 var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection; 18157 18158 newSlides = document.createDocumentFragment(); 18159 originalSlides = _.$slider.children(); 18160 18161 if(_.options.rows > 0) { 18162 18163 slidesPerSection = _.options.slidesPerRow * _.options.rows; 18164 numOfSlides = Math.ceil( 18165 originalSlides.length / slidesPerSection 18166 ); 18167 18168 for(a = 0; a < numOfSlides; a++){ 18169 var slide = document.createElement('div'); 18170 for(b = 0; b < _.options.rows; b++) { 18171 var row = document.createElement('div'); 18172 for(c = 0; c < _.options.slidesPerRow; c++) { 18173 var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c)); 18174 if (originalSlides.get(target)) { 18175 row.appendChild(originalSlides.get(target)); 18176 } 18177 } 18178 slide.appendChild(row); 18179 } 18180 newSlides.appendChild(slide); 18181 } 18182 18183 _.$slider.empty().append(newSlides); 18184 _.$slider.children().children().children() 18185 .css({ 18186 'width':(100 / _.options.slidesPerRow) + '%', 18187 'display': 'inline-block' 18188 }); 18189 18190 } 18191 18192 }; 18193 18194 Slick.prototype.checkResponsive = function(initial, forceUpdate) { 18195 18196 var _ = this, 18197 breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false; 18198 var sliderWidth = _.$slider.width(); 18199 var windowWidth = window.innerWidth || $(window).width(); 18200 18201 if (_.respondTo === 'window') { 18202 respondToWidth = windowWidth; 18203 } else if (_.respondTo === 'slider') { 18204 respondToWidth = sliderWidth; 18205 } else if (_.respondTo === 'min') { 18206 respondToWidth = Math.min(windowWidth, sliderWidth); 18207 } 18208 18209 if ( _.options.responsive && 18210 _.options.responsive.length && 18211 _.options.responsive !== null) { 18212 18213 targetBreakpoint = null; 18214 18215 for (breakpoint in _.breakpoints) { 18216 if (_.breakpoints.hasOwnProperty(breakpoint)) { 18217 if (_.originalSettings.mobileFirst === false) { 18218 if (respondToWidth < _.breakpoints[breakpoint]) { 18219 targetBreakpoint = _.breakpoints[breakpoint]; 18220 } 18221 } else { 18222 if (respondToWidth > _.breakpoints[breakpoint]) { 18223 targetBreakpoint = _.breakpoints[breakpoint]; 18224 } 18225 } 18226 } 18227 } 18228 18229 if (targetBreakpoint !== null) { 18230 if (_.activeBreakpoint !== null) { 18231 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) { 18232 _.activeBreakpoint = 18233 targetBreakpoint; 18234 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 18235 _.unslick(targetBreakpoint); 18236 } else { 18237 _.options = $.extend({}, _.originalSettings, 18238 _.breakpointSettings[ 18239 targetBreakpoint]); 18240 if (initial === true) { 18241 _.currentSlide = _.options.initialSlide; 18242 } 18243 _.refresh(initial); 18244 }
18245 triggerBreakpoint = targetBreakpoint; 18246 } 18247 } else { 18248 _.activeBreakpoint = targetBreakpoint; 18249 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 18250 _.unslick(targetBreakpoint); 18251 } else { 18252 _.options = $.extend({}, _.originalSettings, 18253 _.breakpointSettings[ 18254 targetBreakpoint]); 18255 if (initial === true) { 18256 _.currentSlide = _.options.initialSlide; 18257 } 18258 _.refresh(initial); 18259 } 18260 triggerBreakpoint = targetBreakpoint; 18261 } 18262 } else { 18263 if (_.activeBreakpoint !== null) { 18264 _.activeBreakpoint = null; 18265 _.options = _.originalSettings; 18266 if (initial === true) { 18267 _.currentSlide = _.options.initialSlide; 18268 } 18269 _.refresh(initial); 18270 triggerBreakpoint = targetBreakpoint; 18271 } 18272 } 18273 18274 // only trigger breakpoints during an actual break. not on initialize. 18275 if( !initial && triggerBreakpoint !== false ) { 18276 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]); 18277 } 18278 } 18279 18280 }; 18281 18282 Slick.prototype.changeSlide = function(event, dontAnimate) { 18283 18284 var _ = this, 18285 $target = $(event.currentTarget), 18286 indexOffset, slideOffset, unevenOffset; 18287 18288 // If target is a link, prevent default action. 18289 if($target.is('a')) { 18290 event.preventDefault(); 18291 } 18292 18293 // If target is not the <li> element (ie: a child), find the <li>. 18294 if(!$target.is('li')) { 18295 $target = $target.closest('li'); 18296 } 18297 18298 unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0); 18299 indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll; 18300 18301 switch (event.data.message) { 18302 18303 case 'previous': 18304 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset; 18305 if (_.slideCount > _.options.slidesToShow) { 18306 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate); 18307 } 18308 break; 18309 18310 case 'next': 18311 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset; 18312 if (_.slideCount > _.options.slidesToShow) { 18313 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate); 18314 } 18315 break; 18316 18317 case 'index': 18318 var index = event.data.index === 0 ? 0 : 18319 event.data.index || $target.index() * _.options.slidesToScroll; 18320 18321 _.slideHandler(_.checkNavigable(index), false, dontAnimate); 18322 $target.children().trigger('focus'); 18323 break; 18324 18325 default: 18326 return; 18327 } 18328 18329 }; 18330 18331 Slick.prototype.checkNavigable = function(index) { 18332 18333 var _ = this, 18334 navigables, prevNavigable; 18335 18336 navigables = _.getNavigableIndexes(); 18337 prevNavigable = 0; 18338 if (index > navigables[navigables.length - 1]) { 18339 index = navigables[navigables.length - 1]; 18340 } else { 18341 for (var n in navigables) { 18342 if (index < navigables[n]) { 18343 index = prevNavigable; 18344 break; 18345 } 18346 prevNavigable = navigables[n]; 18347 } 18348 } 18349 18350 return index; 18351 }; 18352 18353 Slick.prototype.cleanUpEvents = function() { 18354 18355 var _ = this; 18356 18357 if (_.options.dots && _.$dots !== null) { 18358 18359 $('li', _.$dots) 18360 .off('click.slick', _.changeSlide) 18361 .off('mouseenter.slick', $.proxy(_.interrupt, _, true))
18362 .off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 18363 18364 if (_.options.accessibility === true) { 18365 _.$dots.off('keydown.slick', _.keyHandler); 18366 } 18367 } 18368 18369 _.$slider.off('focus.slick blur.slick'); 18370 18371 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 18372 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide); 18373 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide); 18374 18375 if (_.options.accessibility === true) { 18376 _.$prevArrow && _.$prevArrow.off('keydown.slick', _.keyHandler); 18377 _.$nextArrow && _.$nextArrow.off('keydown.slick', _.keyHandler); 18378 } 18379 } 18380 18381 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler); 18382 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler); 18383 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler); 18384 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler); 18385 18386 _.$list.off('click.slick', _.clickHandler); 18387 18388 $(document).off(_.visibilityChange, _.visibility); 18389 18390 _.cleanUpSlideEvents(); 18391 18392 if (_.options.accessibility === true) { 18393 _.$list.off('keydown.slick', _.keyHandler); 18394 } 18395 18396 if (_.options.focusOnSelect === true) { 18397 $(_.$slideTrack).children().off('click.slick', _.selectHandler); 18398 } 18399 18400 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange); 18401 18402 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize); 18403 18404 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault); 18405 18406 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition); 18407 18408 }; 18409 18410 Slick.prototype.cleanUpSlideEvents = function() { 18411 18412 var _ = this; 18413 18414 _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true)); 18415 _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 18416 18417 }; 18418 18419 Slick.prototype.cleanUpRows = function() { 18420 18421 var _ = this, originalSlides; 18422 18423 if(_.options.rows > 0) { 18424 originalSlides = _.$slides.children().children(); 18425 originalSlides.removeAttr('style'); 18426 _.$slider.empty().append(originalSlides); 18427 } 18428 18429 }; 18430 18431 Slick.prototype.clickHandler = function(event) { 18432 18433 var _ = this; 18434 18435 if (_.shouldClick === false) { 18436 event.stopImmediatePropagation(); 18437 event.stopPropagation(); 18438 event.preventDefault(); 18439 } 18440 18441 }; 18442 18443 Slick.prototype.destroy = function(refresh) { 18444 18445 var _ = this; 18446 18447 _.autoPlayClear(); 18448 18449 _.touchObject = {}; 18450 18451 _.cleanUpEvents(); 18452 18453 $('.slick-cloned', _.$slider).detach(); 18454 18455 if (_.$dots) { 18456 _.$dots.remove(); 18457 } 18458 18459 if ( _.$prevArrow && _.$prevArrow.length ) { 18460 18461 _.$prevArrow 18462 .removeClass('slick-disabled slick-arrow slick-hidden') 18463 .removeAttr('aria-hidden aria-disabled tabindex') 18464 .css('display',''); 18465 18466 if ( _.htmlExpr.test( _.options.prevArrow )) { 18467 _.$prevArrow.remove(); 18468 } 18469 } 18470 18471 if ( _.$nextArrow && _.$nextArrow.length ) { 18472 18473 _.$nextArrow 18474 .removeClass('slick-disabled slick-arrow slick-hidden') 18475 .removeAttr('aria-hidden aria-disabled tabindex') 18476 .css('display',''); 18477 18478 if ( _.htmlExpr.test( _.options.nextArrow )) { 18479 _.$nextArrow.remove(); 18480 } 18481 } 18482 18483 18484 if (_.$slides) { 18485 18486 _.$slides 18487 .removeClass('slick-slide slick-active slick-center slick-visible slick-current') 18488 .removeAttr('aria-hidden') 18489 .removeAttr('data-slick-index') 18490 .each(function(){ 18491 $(this).attr('style', $(this).data('originalStyling')); 18492 }); 18493 18494 _.$slideTrack.children(this.options.slide).detach(); 18495 18496 _.$slideTrack.detach(); 18497 18498 _.$list.detach(); 18499 18500 _.$slider.append(_.$slides); 18501 } 18502
18503 _.cleanUpRows(); 18504 18505 _.$slider.removeClass('slick-slider'); 18506 _.$slider.removeClass('slick-initialized'); 18507 _.$slider.removeClass('slick-dotted'); 18508 18509 _.unslicked = true; 18510 18511 if(!refresh) { 18512 _.$slider.trigger('destroy', [_]); 18513 } 18514 18515 }; 18516 18517 Slick.prototype.disableTransition = function(slide) { 18518 18519 var _ = this, 18520 transition = {}; 18521 18522 transition[_.transitionType] = ''; 18523 18524 if (_.options.fade === false) { 18525 _.$slideTrack.css(transition); 18526 } else { 18527 _.$slides.eq(slide).css(transition); 18528 } 18529 18530 }; 18531 18532 Slick.prototype.fadeSlide = function(slideIndex, callback) { 18533 18534 var _ = this; 18535 18536 if (_.cssTransitions === false) { 18537 18538 _.$slides.eq(slideIndex).css({ 18539 zIndex: _.options.zIndex 18540 }); 18541 18542 _.$slides.eq(slideIndex).animate({ 18543 opacity: 1 18544 }, _.options.speed, _.options.easing, callback); 18545 18546 } else { 18547 18548 _.applyTransition(slideIndex); 18549 18550 _.$slides.eq(slideIndex).css({ 18551 opacity: 1, 18552 zIndex: _.options.zIndex 18553 }); 18554 18555 if (callback) { 18556 setTimeout(function() { 18557 18558 _.disableTransition(slideIndex); 18559 18560 callback.call(); 18561 }, _.options.speed); 18562 } 18563 18564 } 18565 18566 }; 18567 18568 Slick.prototype.fadeSlideOut = function(slideIndex) { 18569 18570 var _ = this; 18571 18572 if (_.cssTransitions === false) { 18573 18574 _.$slides.eq(slideIndex).animate({ 18575 opacity: 0, 18576 zIndex: _.options.zIndex - 2 18577 }, _.options.speed, _.options.easing); 18578 18579 } else { 18580 18581 _.applyTransition(slideIndex); 18582 18583 _.$slides.eq(slideIndex).css({ 18584 opacity: 0, 18585 zIndex: _.options.zIndex - 2 18586 }); 18587 18588 } 18589 18590 }; 18591 18592 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) { 18593 18594 var _ = this; 18595 18596 if (filter !== null) { 18597 18598 _.$slidesCache = _.$slides; 18599 18600 _.unload(); 18601 18602 _.$slideTrack.children(this.options.slide).detach(); 18603 18604 _.$slidesCache.filter(filter).appendTo(_.$slideTrack); 18605 18606 _.reinit(); 18607 18608 } 18609 18610 }; 18611 18612 Slick.prototype.focusHandler = function() { 18613 18614 var _ = this; 18615 18616 _.$slider 18617 .off('focus.slick blur.slick') 18618 .on('focus.slick blur.slick', '*', function(event) { 18619 18620 event.stopImmediatePropagation(); 18621 var $sf = $(this); 18622 18623 setTimeout(function() { 18624 18625 if( _.options.pauseOnFocus ) { 18626 _.focussed = $sf.is(':focus'); 18627 _.autoPlay(); 18628 } 18629 18630 }, 0); 18631 18632 }); 18633 }; 18634 18635 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() { 18636 18637 var _ = this; 18638 return _.currentSlide; 18639 18640 }; 18641 18642 Slick.prototype.getDotCount = function() { 18643 18644 var _ = this; 18645 18646 var breakPoint = 0; 18647 var counter = 0; 18648 var pagerQty = 0; 18649 18650 if (_.options.infinite === true) { 18651 if (_.slideCount <= _.options.slidesToShow) { 18652 ++pagerQty; 18653 } else { 18654 while (breakPoint < _.slideCount) { 18655 ++pagerQty; 18656 breakPoint = counter + _.options.slidesToScroll; 18657 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 18658 } 18659 } 18660 } else if (_.options.centerMode === true) { 18661 pagerQty = _.slideCount; 18662 } else if(!_.options.asNavFor) { 18663 pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll); 18664 }else { 18665 while (breakPoint < _.slideCount) { 18666 ++pagerQty; 18667 breakPoint = counter + _.options.slidesToScroll; 18668 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 18669 } 18670 } 18671 18672 return pagerQty - 1; 18673 18674 }; 18675 18676 Slick.prototype.getLeft = function(slideIndex) { 18677 18678 var _ = this, 18679 targetLeft, 18680 verticalHeight, 18681 verticalOffset = 0, 18682 targetSlide, 18683 coef; 18684 18685 _.slideOffset = 0; 18686 verticalHeight = _.$slides.first().outerHeight(true); 18687 18688 if (_.options.infinite === true) { 18689 if (_.slideCount > _.options.slidesToShow) { 18690 _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1; 18691 coef = -1 18692 18693 if (_.options.vertical === true && _.options.centerMode === true) { 18694 if (_.options.slidesToShow === 2) { 18695 coef = -1.5; 18696 } else if (_.options.slidesToShow === 1) { 18697 coef = -2 18698 } 18699 } 18700 verticalOffset = (verticalHeight * _.options.slidesToShow) * coef; 18701 } 18702 if (_.slideCount % _.options.slidesToScroll !== 0) { 18703 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { 18704 if (slideIndex > _.slideCount) { 18705 _.slideOffset = ((_.options.slidesToShow - (sl
18705ideIndex - _.slideCount)) * _.slideWidth) * -1; 18706 verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1; 18707 } else { 18708 _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1; 18709 verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1; 18710 } 18711 } 18712 } 18713 } else { 18714 if (slideIndex + _.options.slidesToShow > _.slideCount) { 18715 _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth; 18716 verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight; 18717 } 18718 } 18719 18720 if (_.slideCount <= _.options.slidesToShow) { 18721 _.slideOffset = 0; 18722 verticalOffset = 0; 18723 } 18724 18725 if (_.options.centerMode === true && _.slideCount <= _.options.slidesToShow) { 18726 _.slideOffset = ((_.slideWidth * Math.floor(_.options.slidesToShow)) / 2) - ((_.slideWidth * _.slideCount) / 2); 18727 } else if (_.options.centerMode === true && _.options.infinite === true) { 18728 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 18729 } else if (_.options.centerMode === true) { 18730 _.slideOffset = 0; 18731 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 18732 } 18733 18734 if (_.options.vertical === false) { 18735 targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset; 18736 } else { 18737 targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset; 18738 } 18739 18740 if (_.options.variableWidth === true) { 18741
18742 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 18743 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 18744 } else { 18745 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow); 18746 } 18747 18748 if (_.options.rtl === true) { 18749 if (targetSlide[0]) { 18750 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 18751 } else { 18752 targetLeft = 0; 18753 } 18754 } else { 18755 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 18756 } 18757 18758 if (_.options.centerMode === true) { 18759 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 18760 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 18761 } else { 18762 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1); 18763 } 18764 18765 if (_.options.rtl === true) { 18766 if (targetSlide[0]) { 18767 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 18768 } else { 18769 targetLeft = 0; 18770 } 18771 } else { 18772 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 18773 } 18774 18775 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; 18776 } 18777 } 18778 18779 return targetLeft; 18780 18781 }; 18782 18783 Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) { 18784 18785 var _ = this; 18786 18787 return _.options[option]; 18788 18789 }; 18790 18791 Slick.prototype.getNavigableIndexes = function() { 18792 18793 var _ = this, 18794 breakPoint = 0, 18795 counter = 0, 18796 indexes = [], 18797 max; 18798 18799 if (_.options.infinite === false) { 18800 max = _.slideCount; 18801 } else { 18802 breakPoint = _.options.slidesToScroll * -1; 18803 counter = _.options.slidesToScroll * -1; 18804 max = _.slideCount * 2; 18805 } 18806 18807 while (breakPoint < max) { 18808 indexes.push(breakPoint); 18809 breakPoint = counter + _.options.slidesToScroll; 18810 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 18811 } 18812 18813 return indexes; 18814 18815 }; 18816 18817 Slick.prototype.getSlick = function() { 18818 18819 return this; 18820 18821 }; 18822 18823 Slick.prototype.getSlideCount = function() { 18824 18825 var _ = this, 18826 slidesTraversed, swipedSlide, centerOffset; 18827 18828 centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0; 18829 18830 if (_.options.swipeToSlide === true) { 18831 _.$slideTrack.find('.slick-slide').each(function(index, slide) { 18832 if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) { 18833 swipedSlide = slide; 18834 return false; 18835 } 18836 }); 18837 18838 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1; 18839 18840 return slidesTraversed; 18841 18842 } else { 18843 return _.options.slidesToScroll; 18844 } 18845 18846 }; 18847 18848 Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) { 18849 18850 var _ = this; 18851 18852 _.changeSlide({ 18853 data: { 18854 message: 'index', 18855 index: parseInt(slide) 18856 } 18857 }, dontAnimate); 18858 18859 }; 18860 18861 Slick.prototype.init = function(creation) { 18862 18863 var _ = this; 18864 18865 if (!$(_.$slider).hasClass('slick-initialized')) { 18866 18867 $(_.$slider).addClass('slick-initialized'); 18868 18869 _.buildRows(); 18870 _.buildOut(); 18871 _.setProps(); 18872 _.startLoad(); 18873 _.loadSlider(); 18874 _.initializeEvents(); 18875 _.updateArrows(); 18876 _.updateDots(); 18877 _.checkResponsive(true); 18878 _.focusHandler(); 18879 18880 } 18881 18882 if (creation) { 18883 _.$slider.trigger('init', [_]); 18884 } 18885 18886 if (_.options.accessibility === true) { 18887 _.initADA(); 18888 } 18889 18890 if ( _.options.autoplay ) { 18891 18892 _.paused = false; 18893 _.autoPlay(); 18894 18895 } 18896 18897 }; 18898 18899 Slick.prototype.initADA = function() { 18900 var _ = this, 18901 numDotGroups = Math.ceil(_.slideCount / _.options.slidesToShow),
18902 tabControlIndexes = _.getNavigableIndexes().filter(function(val) { 18903 return (val >= 0) && (val < _.slideCount); 18904 }); 18905 18906 _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({ 18907 'aria-hidden': 'true', 18908 'tabindex': '-1' 18909 }).find('a, input, button, select').attr({ 18910 'tabindex': '-1' 18911 }); 18912 18913 if (_.$dots !== null) { 18914 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) { 18915 var slideControlIndex = tabControlIndexes.indexOf(i); 18916 18917 $(this).attr({ 18918 'role': 'tabpanel', 18919 'id': 'slick-slide' + _.instanceUid + i, 18920 'tabindex': -1 18921 }); 18922 18923 if (slideControlIndex !== -1) { 18924 var ariaButtonControl = 'slick-slide-control' + _.instanceUid + slideControlIndex 18925 if ($('#' + ariaButtonControl).length) { 18926 $(this).attr({ 18927 'aria-describedby': ariaButtonControl 18928 }); 18929 } 18930 } 18931 }); 18932 18933 _.$dots.attr('role', 'tablist').find('li').each(function(i) { 18934 var mappedSlideIndex = tabControlIndexes[i]; 18935 18936 $(this).attr({ 18937 'role': 'presentation' 18938 }); 18939 18940 $(this).find('button').first().attr({ 18941 'role': 'tab', 18942 'id': 'slick-slide-control' + _.instanceUid + i, 18943 'aria-controls': 'slick-slide' + _.instanceUid + mappedSlideIndex, 18944 'aria-label': (i + 1) + ' of ' + numDotGroups, 18945 'aria-selected': null, 18946 'tabindex': '-1' 18947 }); 18948 18949 }).eq(_.currentSlide).find('button').attr({ 18950 'aria-selected': 'true', 18951 'tabindex': '0' 18952 }).end(); 18953 } 18954 18955 for (var i=_.currentSlide, max=i+_.options.slidesToShow; i < max; i++) { 18956 if (_.options.focusOnChange) { 18957 _.$slides.eq(i).attr({'tabindex': '0'}); 18958 } else { 18959 _.$slides.eq(i).removeAttr('tabindex'); 18960 } 18961 } 18962 18963 _.activateADA(); 18964 18965 }; 18966 18967 Slick.prototype.initArrowEvents = function() { 18968 18969 var _ = this; 18970 18971 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 18972 _.$prevArrow 18973 .off('click.slick') 18974 .on('click.slick', { 18975 message: 'previous' 18976 }, _.changeSlide); 18977 _.$nextArrow 18978 .off('click.slick') 18979 .on('click.slick', { 18980 message: 'next' 18981 }, _.changeSlide); 18982 18983 if (_.options.accessibility === true) { 18984 _.$prevArrow.on('keydown.slick', _.keyHandler); 18985 _.$nextArrow.on('keydown.slick', _.keyHandler); 18986 } 18987 } 18988 18989 }; 18990 18991 Slick.prototype.initDotEvents = function() { 18992 18993 var _ = this; 18994 18995 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 18996 $('li', _.$dots).on('click.slick', { 18997 message: 'index' 18998 }, _.changeSlide); 18999 19000 if (_.options.accessibility === true) { 19001 _.$dots.on('keydown.slick', _.keyHandler); 19002 } 19003 } 19004 19005 if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.slideCount > _.options.slidesToShow) { 19006 19007 $('li', _.$dots) 19008 .on('mouseenter.slick', $.proxy(_.interrupt, _, true)) 19009 .on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 19010 19011 } 19012 19013 }; 19014 19015 Slick.prototype.initSlideEvents = function() { 19016 19017 var _ = this; 19018 19019 if ( _.options.pauseOnHover ) { 19020 19021 _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true)); 19022 _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 19023 19024 } 19025 19026 }; 19027 19028 Slick.prototype.initializeEvents = function() { 19029 19030 var _ = this; 19031 19032 _.initArrowEvents(); 19033 19034 _.initDotEvents(); 19035 _.initSlideEvents(); 19036 19037 _.$list.on('touchstart.slick mousedown.slick', { 19038 action: 'start' 19039 }, _.swipeHandler); 19040 _.$list.on('touchmove.slick mousemove.slick', { 19041 action: 'move' 19042 }, _.swipeHandler); 19043 _.$list.on('touchend.slick mouseup.slick', { 19044 action: 'end' 19045 }, _.swipeHandler);
19046 _.$list.on('touchcancel.slick mouseleave.slick', { 19047 action: 'end' 19048 }, _.swipeHandler); 19049 19050 _.$list.on('click.slick', _.clickHandler); 19051 19052 $(document).on(_.visibilityChange, $.proxy(_.visibility, _)); 19053 19054 if (_.options.accessibility === true) { 19055 _.$list.on('keydown.slick', _.keyHandler); 19056 } 19057 19058 if (_.options.focusOnSelect === true) { 19059 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 19060 } 19061 19062 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _)); 19063 19064 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _)); 19065 19066 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault); 19067 19068 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); 19069 $(_.setPosition); 19070 19071 }; 19072 19073 Slick.prototype.initUI = function() { 19074 19075 var _ = this; 19076 19077 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 19078 19079 _.$prevArrow.show(); 19080 _.$nextArrow.show(); 19081 19082 } 19083 19084 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 19085 19086 _.$dots.show(); 19087 19088 } 19089 19090 }; 19091 19092 Slick.prototype.keyHandler = function(event) { 19093 19094 var _ = this; 19095 //Dont slide if the cursor is inside the form fields and arrow keys are pressed 19096 if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 19097 if (event.keyCode === 37 && _.options.accessibility === true) { 19098 _.changeSlide({ 19099 data: { 19100 message: _.options.rtl === true ? 'next' : 'previous' 19101 } 19102 }); 19103 } else if (event.keyCode === 39 && _.options.accessibility === true) { 19104 _.changeSlide({ 19105 data: { 19106 message: _.options.rtl === true ? 'previous' : 'next' 19107 } 19108 }); 19109 } 19110 } 19111 19112 }; 19113 19114 Slick.prototype.lazyLoad = function() { 19115 19116 var _ = this, 19117 loadRange, cloneRange, rangeStart, rangeEnd; 19118 19119 function loadImages(imagesScope) { 19120 19121 $('img[data-lazy]', imagesScope).each(function() { 19122 19123 var image = $(this), 19124 imageSource = $(this).attr('data-lazy'), 19125 imageSrcSet = $(this).attr('data-srcset'), 19126 imageSizes = $(this).attr('data-sizes') || _.$slider.attr('data-sizes'), 19127 imageToLoad = document.createElement('img'); 19128 19129 imageToLoad.onload = function() { 19130 19131 image 19132 .animate({ opacity: 0 }, 100, function() { 19133 19134 if (imageSrcSet) { 19135 image 19136 .attr('srcset', imageSrcSet ); 19137 19138 if (imageSizes) { 19139 image 19140 .attr('sizes', imageSizes ); 19141 } 19142 } 19143 19144 image 19145 .attr('src', imageSource) 19146 .animate({ opacity: 1 }, 200, function() { 19147 image 19148 .removeAttr('data-lazy data-srcset data-sizes') 19149 .removeClass('slick-loading'); 19150 }); 19151 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 19152 }); 19153 19154 }; 19155 19156 imageToLoad.onerror = function() { 19157 19158 image 19159 .removeAttr( 'data-lazy' ) 19160 .removeClass( 'slick-loading' ) 19161 .addClass( 'slick-lazyload-error' ); 19162 19163 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 19164 19165 }; 19166 19167 imageToLoad.src = imageSource; 19168 19169 }); 19170 19171 } 19172 19173 if (_.options.centerMode === true) { 19174 if (_.options.infinite === true) { 19175 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); 19176 rangeEnd = rangeStart + _.options.slidesToShow + 2; 19177 } else { 19178 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1)); 19179 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; 19180 } 19181 } else {
19182 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide; 19183 rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow); 19184 if (_.options.fade === true) { 19185 if (rangeStart > 0) rangeStart--; 19186 if (rangeEnd <= _.slideCount) rangeEnd++; 19187 } 19188 } 19189 19190 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd); 19191 19192 if (_.options.lazyLoad === 'anticipated') { 19193 var prevSlide = rangeStart - 1, 19194 nextSlide = rangeEnd, 19195 $slides = _.$slider.find('.slick-slide'); 19196 19197 for (var i = 0; i < _.options.slidesToScroll; i++) { 19198 if (prevSlide < 0) prevSlide = _.slideCount - 1; 19199 loadRange = loadRange.add($slides.eq(prevSlide)); 19200 loadRange = loadRange.add($slides.eq(nextSlide)); 19201 prevSlide--; 19202 nextSlide++; 19203 } 19204 } 19205 19206 loadImages(loadRange); 19207 19208 if (_.slideCount <= _.options.slidesToShow) { 19209 cloneRange = _.$slider.find('.slick-slide'); 19210 loadImages(cloneRange); 19211 } else 19212 if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { 19213 cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow); 19214 loadImages(cloneRange); 19215 } else if (_.currentSlide === 0) { 19216 cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1); 19217 loadImages(cloneRange); 19218 } 19219 19220 }; 19221 19222 Slick.prototype.loadSlider = function() { 19223 19224 var _ = this; 19225 19226 _.setPosition(); 19227 19228 _.$slideTrack.css({ 19229 opacity: 1 19230 }); 19231 19232 _.$slider.removeClass('slick-loading'); 19233 19234 _.initUI(); 19235 19236 if (_.options.lazyLoad === 'progressive') { 19237 _.progressiveLazyLoad(); 19238 } 19239 19240 }; 19241 19242 Slick.prototype.next = Slick.prototype.slickNext = function() { 19243 19244 var _ = this; 19245 19246 _.changeSlide({ 19247 data: { 19248 message: 'next' 19249 } 19250 }); 19251 19252 }; 19253 19254 Slick.prototype.orientationChange = function() { 19255 19256 var _ = this; 19257 19258 _.checkResponsive(); 19259 _.setPosition(); 19260 19261 }; 19262 19263 Slick.prototype.pause = Slick.prototype.slickPause = function() { 19264 19265 var _ = this; 19266 19267 _.autoPlayClear(); 19268 _.paused = true; 19269 19270 }; 19271 19272 Slick.prototype.play = Slick.prototype.slickPlay = function() { 19273 19274 var _ = this; 19275 19276 _.autoPlay(); 19277 _.options.autoplay = true; 19278 _.paused = false; 19279 _.focussed = false; 19280 _.interrupted = false; 19281 19282 }; 19283 19284 Slick.prototype.postSlide = function(index) { 19285 19286 var _ = this; 19287 19288 if( !_.unslicked ) { 19289 19290 _.$slider.trigger('afterChange', [_, index]); 19291 19292 _.animating = false; 19293 19294 if (_.slideCount > _.options.slidesToShow) { 19295 _.setPosition(); 19296 } 19297 19298 _.swipeLeft = null; 19299 19300 if ( _.options.autoplay ) { 19301 _.autoPlay(); 19302 } 19303 19304 if (_.options.accessibility === true) { 19305 _.initADA(); 19306 19307 if (_.options.focusOnChange) { 19308 var $currentSlide = $(_.$slides.get(_.currentSlide)); 19309 $currentSlide.attr('tabindex', 0).focus(); 19310 } 19311 } 19312 19313 } 19314 19315 }; 19316 19317 Slick.prototype.prev = Slick.prototype.slickPrev = function() { 19318 19319 var _ = this; 19320 19321 _.changeSlide({ 19322 data: { 19323 message: 'previous' 19324 } 19325 }); 19326 19327 }; 19328 19329 Slick.prototype.preventDefault = function(event) { 19330 19331 event.preventDefault(); 19332 19333 }; 19334 19335 Slick.prototype.progressiveLazyLoad = function( tryCount ) { 19336 19337 tryCount = tryCount || 1; 19338 19339 var _ = this, 19340 $imgsToLoad = $( 'img[data-lazy]', _.$slider ), 19341 image, 19342 imageSource, 19343 imageSrcSet, 19344 imageSizes, 19345 imageToLoad; 19346 19347 if ( $imgsToLoad.length ) { 19348 19349 image = $imgsToLoad.first(); 19350 imageSource = image.attr('data-lazy'); 19351 imageSrcSet = image.attr('data-srcset'); 19352 imageSizes = image.attr('data-sizes') || _.$slider.attr('data-sizes'); 19353 imageToLoad = document.createElement('img'); 19354 19355 imageToLoad.onload = function() { 19356 19357 if (imageSrcSet) { 19358 image 19359 .attr('srcset', imageSrcSet ); 19360 19361 if (imageSizes) { 19362 image 19363 .attr('sizes', imageSizes ); 19364 } 19365 } 19366 19367 image 19368 .attr( 'src', imageSource ) 19369 .removeAttr('data-lazy data-srcset data-sizes') 19370 .removeClass('slick-loading'); 19371 19372 if ( _.options.adaptiveHeight === true ) { 19373 _.setPosition(); 19374 } 19375 19376 _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]); 19377 _.progressiveLazyLoad(); 19378 19379 }; 19380 19381 imageToLoad.onerror = function() { 19382 19383 if ( tryCount < 3 ) { 19384 19385 /** 19386 * try to load the image 3 times, 19387 * leave a slight delay so we don't get 19388 * servers blocking the request. 19389 */ 19390 setTimeout( function() { 19391 _.progressiveLazyLoad( tryCount + 1 ); 19392 }, 500 ); 19393 19394 } else { 19395 19396 image 19397 .removeAttr( 'data-lazy' ) 19398 .removeClass( 'slick-loading' ) 19399 .addClass( 'slick-lazyload-error' ); 19400 19401 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 19402 19403 _.progressiveLazyLoad(); 19404 19405 } 19406 19407 }; 19408 19409 imageToLoad.src = imageSource; 19410 19411 } else { 19412 19413 _.$slider.trigger('allImagesLoaded', [ _ ]); 19414 19415 } 19416 19417 }; 19418 19419 Slick.prototype.refresh = function( initializing ) { 19420 19421 var _ = this, currentSlide, lastVisibleIndex; 19422 19423 lastVisibleIndex = _.slideCount - _.options.slidesToShow; 19424 19425 // in non-infinite sliders, we don't want to go past the 19426 // last visible index. 19427 if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) { 19428 _.currentSlide = lastVisibleIndex; 19429 } 19430 19431 // if less slides than to show, go to start. 19432 if ( _.slideCount <= _.options.slidesToShow ) { 19433 _.currentSlide = 0; 19434 19435 } 19436 19437 currentSlide = _.currentSlide; 19438 19439 _.destroy(true); 19440 19441 $.extend(_, _.initials, { currentSlide: currentSlide }); 19442
19443 _.init(); 19444 19445 if( !initializing ) { 19446 19447 _.changeSlide({ 19448 data: { 19449 message: 'index', 19450 index: currentSlide 19451 } 19452 }, false); 19453 19454 } 19455 19456 }; 19457 19458 Slick.prototype.registerBreakpoints = function() { 19459 19460 var _ = this, breakpoint, currentBreakpoint, l, 19461 responsiveSettings = _.options.responsive || null; 19462 19463 if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) { 19464 19465 _.respondTo = _.options.respondTo || 'window'; 19466 19467 for ( breakpoint in responsiveSettings ) { 19468 19469 l = _.breakpoints.length-1; 19470 19471 if (responsiveSettings.hasOwnProperty(breakpoint)) { 19472 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 19473 19474 // loop through the breakpoints and cut out any existing 19475 // ones with the same breakpoint number, we don't want dupes. 19476 while( l >= 0 ) { 19477 if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) { 19478 _.breakpoints.splice(l,1); 19479 } 19480 l--; 19481 } 19482 19483 _.breakpoints.push(currentBreakpoint); 19484 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings; 19485 19486 } 19487 19488 } 19489 19490 _.breakpoints.sort(function(a, b) { 19491 return ( _.options.mobileFirst ) ? a-b : b-a; 19492 }); 19493 19494 } 19495 19496 }; 19497 19498 Slick.prototype.reinit = function() { 19499 19500 var _ = this; 19501 19502 _.$slides = 19503 _.$slideTrack 19504 .children(_.options.slide) 19505 .addClass('slick-slide'); 19506 19507 _.slideCount = _.$slides.length; 19508 19509 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { 19510 _.currentSlide = _.currentSlide - _.options.slidesToScroll; 19511 } 19512 19513 if (_.slideCount <= _.options.slidesToShow) { 19514 _.currentSlide = 0; 19515 } 19516 19517 _.registerBreakpoints(); 19518 19519 _.setProps(); 19520 _.setupInfinite(); 19521 _.buildArrows(); 19522 _.updateArrows(); 19523 _.initArrowEvents(); 19524 _.buildDots(); 19525 _.updateDots(); 19526 _.initDotEvents(); 19527 _.cleanUpSlideEvents(); 19528 _.initSlideEvents(); 19529 19530 _.checkResponsive(false, true); 19531 19532 if (_.options.focusOnSelect === true) { 19533 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 19534 } 19535 19536 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 19537 19538 _.setPosition(); 19539 _.focusHandler(); 19540 19541 _.paused = !_.options.autoplay; 19542 _.autoPlay(); 19543 19544 _.$slider.trigger('reInit', [_]); 19545 19546 }; 19547 19548 Slick.prototype.resize = function() { 19549 19550 var _ = this; 19551 19552 if ($(window).width() !== _.windowWidth) { 19553 clearTimeout(_.windowDelay); 19554 _.windowDelay = window.setTimeout(function() { 19555 _.windowWidth = $(window).width(); 19556 _.checkResponsive(); 19557 if( !_.unslicked ) { _.setPosition(); } 19558 }, 50); 19559 } 19560 }; 19561 19562 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) { 19563 19564 var _ = this; 19565 19566 if (typeof(index) === 'boolean') { 19567 removeBefore = index; 19568 index = removeBefore === true ? 0 : _.slideCount - 1; 19569 } else { 19570 index = removeBefore === true ? --index : index; 19571 } 19572 19573 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { 19574 return false; 19575 } 19576 19577 _.unload(); 19578 19579 if (removeAll === true) { 19580 _.$slideTrack.children().remove(); 19581 } else { 19582 _.$slideTrack.children(this.options.slide).eq(index).remove(); 19583 } 19584 19585 _.$slides = _.$slideTrack.children(this.options.slide); 19586 19587 _.$slideTrack.children(this.options.slide).detach(); 19588 19589 _.$slideTrack.append(_.$slides); 19590 19591 _.$slidesCache = _.$slides; 19592 19593 _.reinit(); 19594 19595 }; 19596 19597 Slick.prototype.setCSS = function(position) { 19598 19599 var _ = this, 19600 positionProps = {}, 19601 x, y; 19602 19603 if (_.options.rtl === true) { 19604 position = -position; 19605 } 19606 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px'; 19607 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px'; 19608 19609 positionProps[_.positionProp] = position; 19610 19611 if (_.transformsEnabled === false) { 19612 _.$slideTrack.css(positionProps); 19613 } else { 19614 positionProps = {}; 19615 if (_.cssTransitions === false) { 19616 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; 19617 _.$slideTrack.css(positionProps); 19618 } else { 19619 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; 19620 _.$slideTrack.css(positionProps); 19621 } 19622 } 19623 19624 }; 19625 19626 Slick.prototype.setDimensions = function() { 19627 19628 var _ = this; 19629 19630 if (_.options.vertical === false) { 19631 if (_.options.centerMode === true) { 19632 _.$list.css({ 19633 padding: ('0px ' + _.options.centerPadding) 19634 }); 19635 } 19636 } else { 19637 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow); 19638 if (_.options.centerMode === true) { 19639 _.$list.css({ 19640 padding: (_.options.centerPadding + ' 0px') 19641 }); 19642 } 19643 } 19644 19645 _.listWidth = _.$list.width(); 19646 _.listHeight = _.$list.height(); 19647 19648 19649 if (_.options.vertical === false && _.options.variableWidth === false) { 19650 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); 19651 _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length))); 19652 19653 } else if (_.options.variableWidth === true) { 19654 _.$slideTrack.width(5000 * _.slideCount); 19655 } else { 19656 _.slideWidth = Math.ceil(_.listWidth);
19657 _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length))); 19658 } 19659 19660 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); 19661 if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset); 19662 19663 }; 19664 19665 Slick.prototype.setFade = function() { 19666 19667 var _ = this, 19668 targetLeft; 19669 19670 _.$slides.each(function(index, element) { 19671 targetLeft = (_.slideWidth * index) * -1; 19672 if (_.options.rtl === true) { 19673 $(element).css({ 19674 position: 'relative', 19675 right: targetLeft, 19676 top: 0, 19677 zIndex: _.options.zIndex - 2, 19678 opacity: 0 19679 }); 19680 } else { 19681 $(element).css({ 19682 position: 'relative', 19683 left: targetLeft, 19684 top: 0, 19685 zIndex: _.options.zIndex - 2, 19686 opacity: 0 19687 }); 19688 } 19689 }); 19690 19691 _.$slides.eq(_.currentSlide).css({ 19692 zIndex: _.options.zIndex - 1, 19693 opacity: 1 19694 }); 19695 19696 }; 19697 19698 Slick.prototype.setHeight = function() { 19699 19700 var _ = this; 19701 19702 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 19703 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 19704 _.$list.css('height', targetHeight); 19705 } 19706 19707 }; 19708 19709 Slick.prototype.setOption = 19710 Slick.prototype.slickSetOption = function() { 19711 19712 /** 19713 * accepts arguments in format of: 19714 * 19715 * - for changing a single option's value: 19716 * .slick("setOption", option, value, refresh ) 19717 * 19718 * - for changing a set of responsive options: 19719 * .slick("setOption", 'responsive', [{}, ...], refresh ) 19720 * 19721 * - for updating multiple values at once (not responsive) 19722 * .slick("setOption", { 'option': value, ... }, refresh ) 19723 */ 19724 19725 var _ = this, l, item, option, value, refresh = false, type; 19726 19727 if( $.type( arguments[0] ) === 'object' ) { 19728 19729 option = arguments[0]; 19730 refresh = arguments[1]; 19731 type = 'multiple'; 19732 19733 } else if ( $.type( arguments[0] ) === 'string' ) { 19734 19735 option = arguments[0]; 19736 value = arguments[1]; 19737 refresh = arguments[2]; 19738 19739 if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) { 19740 19741 type = 'responsive'; 19742 19743 } else if ( typeof arguments[1] !== 'undefined' ) { 19744 19745 type = 'single'; 19746 19747 } 19748 19749 } 19750 19751 if ( type === 'single' ) { 19752 19753 _.options[option] = value; 19754 19755 19756 } else if ( type === 'multiple' ) { 19757 19758 $.each( option , function( opt, val ) { 19759 19760 _.options[opt] = val; 19761 19762 }); 19763 19764 19765 } else if ( type === 'responsive' ) { 19766 19767 for ( item in value ) { 19768 19769 if( $.type( _.options.responsive ) !== 'array' ) { 19770 19771 _.options.responsive = [ value[item] ]; 19772 19773 } else { 19774 19775 l = _.options.responsive.length-1; 19776 19777 // loop through the responsive object and splice out duplicates. 19778 while( l >= 0 ) { 19779 19780 if( _.options.responsive[l].breakpoint === value[item].breakpoint ) { 19781 19782 _.options.responsive.splice(l,1); 19783 19784 } 19785 19786 l--; 19787 19788 } 19789 19790 _.options.responsive.push( value[item] ); 19791 19792 } 19793 19794 } 19795 19796 } 19797 19798 if ( refresh ) { 19799 19800 _.unload(); 19801 _.reinit(); 19802 19803 } 19804 19805 }; 19806 19807 Slick.prototype.setPosition = function() { 19808 19809 var _ = this; 19810 19811 _.setDimensions(); 19812 19813 _.setHeight(); 19814 19815 if (_.options.fade === false) { 19816 _.setCSS(_.getLeft(_.currentSlide)); 19817 } else { 19818 _.setFade(); 19819 } 19820 19821 _.$slider.trigger('setPosition', [_]); 19822 19823 }; 19824 19825 Slick.prototype.setProps = function() { 19826 19827 var _ = this, 19828 bodyStyle = document.body.style; 19829 19830 _.positionProp = _.options.vertical === true ? 'top' : 'left'; 19831 19832 if (_.positionProp === 'top') { 19833 _.$slider.addClass('slick-vertical'); 19834 } else { 19835 _.$slider.removeClass('slick-vertical'); 19836 } 19837 19838 if (bodyStyle.WebkitTransition !== undefined || 19839 bodyStyle.MozTransition !== undefined || 19840 bodyStyle.msTransition !== undefined) { 19841 if (_.options.useCSS === true) { 19842 _.cssTransitions = true; 19843 } 19844 } 19845 19846 if ( _.options.fade ) { 19847 if ( typeof _.options.zIndex === 'number' ) { 19848 if( _.options.zIndex < 3 ) {
19849 _.options.zIndex = 3; 19850 } 19851 } else { 19852 _.options.zIndex = _.defaults.zIndex; 19853 } 19854 } 19855 19856 if (bodyStyle.OTransform !== undefined) { 19857 _.animType = 'OTransform'; 19858 _.transformType = '-o-transform'; 19859 _.transitionType = 'OTransition'; 19860 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 19861 } 19862 if (bodyStyle.MozTransform !== undefined) { 19863 _.animType = 'MozTransform'; 19864 _.transformType = '-moz-transform'; 19865 _.transitionType = 'MozTransition'; 19866 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false; 19867 } 19868 if (bodyStyle.webkitTransform !== undefined) { 19869 _.animType = 'webkitTransform'; 19870 _.transformType = '-webkit-transform'; 19871 _.transitionType = 'webkitTransition'; 19872 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 19873 } 19874 if (bodyStyle.msTransform !== undefined) { 19875 _.animType = 'msTransform'; 19876 _.transformType = '-ms-transform'; 19877 _.transitionType = 'msTransition'; 19878 if (bodyStyle.msTransform === undefined) _.animType = false; 19879 } 19880 if (bodyStyle.transform !== undefined && _.animType !== false) { 19881 _.animType = 'transform'; 19882 _.transformType = 'transform'; 19883 _.transitionType = 'transition'; 19884 } 19885 _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false); 19886 }; 19887 19888 19889 Slick.prototype.setSlideClasses = function(index) { 19890 19891 var _ = this, 19892 centerOffset, allSlides, indexOffset, remainder; 19893 19894 allSlides = _.$slider 19895 .find('.slick-slide') 19896 .removeClass('slick-active slick-center slick-current') 19897 .attr('aria-hidden', 'true'); 19898 19899 _.$slides 19900 .eq(index) 19901 .addClass('slick-current'); 19902 19903 if (_.options.centerMode === true) { 19904 19905 var evenCoef = _.options.slidesToShow % 2 === 0 ? 1 : 0; 19906 19907 centerOffset = Math.floor(_.options.slidesToShow / 2); 19908 19909 if (_.options.infinite === true) { 19910 19911 if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) { 19912 _.$slides 19913 .slice(index - centerOffset + evenCoef, index + centerOffset + 1) 19914 .addClass('slick-active') 19915 .attr('aria-hidden', 'false'); 19916 19917 } else { 19918 19919 indexOffset = _.options.slidesToShow + index; 19920 allSlides 19921 .slice(indexOffset - centerOffset + 1 + evenCoef, indexOffset + centerOffset + 2) 19922 .addClass('slick-active') 19923 .attr('aria-hidden', 'false'); 19924 19925 } 19926 19927 if (index === 0) { 19928 19929 allSlides 19930 .eq(allSlides.length - 1 - _.options.slidesToShow) 19931 .addClass('slick-center'); 19932 19933 } else if (index === _.slideCount - 1) { 19934 19935 allSlides 19936 .eq(_.options.slidesToShow) 19937 .addClass('slick-center'); 19938 19939 } 19940 19941 } 19942 19943 _.$slides 19944 .eq(index) 19945 .addClass('slick-center'); 19946 19947 } else { 19948 19949 if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) { 19950 19951 _.$slides 19952 .slice(index, index + _.options.slidesToShow) 19953 .addClass('slick-active') 19954 .attr('aria-hidden', 'false'); 19955 19956 } else if (allSlides.length <= _.options.slidesToShow) { 19957 19958 allSlides 19959 .addClass('slick-active') 19960 .attr('aria-hidden', 'false'); 19961 19962 } else { 19963 19964 remainder = _.slideCount % _.options.slidesToShow;
19965 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index; 19966 19967 if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) { 19968 19969 allSlides 19970 .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder) 19971 .addClass('slick-active') 19972 .attr('aria-hidden', 'false'); 19973 19974 } else { 19975 19976 allSlides 19977 .slice(indexOffset, indexOffset + _.options.slidesToShow) 19978 .addClass('slick-active') 19979 .attr('aria-hidden', 'false'); 19980 19981 } 19982 19983 } 19984 19985 } 19986 19987 if (_.options.lazyLoad === 'ondemand' || _.options.lazyLoad === 'anticipated') { 19988 _.lazyLoad(); 19989 } 19990 }; 19991 19992 Slick.prototype.setupInfinite = function() { 19993 19994 var _ = this, 19995 i, slideIndex, infiniteCount; 19996 19997 if (_.options.fade === true) { 19998 _.options.centerMode = false; 19999 } 20000 20001 if (_.options.infinite === true && _.options.fade === false) { 20002 20003 slideIndex = null; 20004 20005 if (_.slideCount > _.options.slidesToShow) { 20006 20007 if (_.options.centerMode === true) { 20008 infiniteCount = _.options.slidesToShow + 1; 20009 } else { 20010 infiniteCount = _.options.slidesToShow; 20011 } 20012 20013 for (i = _.slideCount; i > (_.slideCount - 20014 infiniteCount); i -= 1) { 20015 slideIndex = i - 1; 20016 $(_.$slides[slideIndex]).clone(true).attr('id', '') 20017 .attr('data-slick-index', slideIndex - _.slideCount) 20018 .prependTo(_.$slideTrack).addClass('slick-cloned'); 20019 } 20020 for (i = 0; i < infiniteCount + _.slideCount; i += 1) { 20021 slideIndex = i; 20022 $(_.$slides[slideIndex]).clone(true).attr('id', '') 20023 .attr('data-slick-index', slideIndex + _.slideCount) 20024 .appendTo(_.$slideTrack).addClass('slick-cloned'); 20025 } 20026 _.$slideTrack.find('.slick-cloned').find('[id]').each(function() { 20027 $(this).attr('id', ''); 20028 }); 20029 20030 } 20031 20032 } 20033 20034 }; 20035 20036 Slick.prototype.interrupt = function( toggle ) { 20037 20038 var _ = this; 20039 20040 if( !toggle ) { 20041 _.autoPlay(); 20042 } 20043 _.interrupted = toggle; 20044 20045 }; 20046 20047 Slick.prototype.selectHandler = function(event) { 20048 20049 var _ = this; 20050 20051 var targetElement = 20052 $(event.target).is('.slick-slide') ? 20053 $(event.target) : 20054 $(event.target).parents('.slick-slide'); 20055 20056 var index = parseInt(targetElement.attr('data-slick-index')); 20057 20058 if (!index) index = 0; 20059 20060 if (_.slideCount <= _.options.slidesToShow) { 20061 20062 _.slideHandler(index, false, true); 20063 return; 20064 20065 } 20066 20067 _.slideHandler(index); 20068 20069 }; 20070 20071 Slick.prototype.slideHandler = function(index, sync, dontAnimate) { 20072 20073 var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null, 20074 _ = this, navTarget; 20075 20076 sync = sync || false; 20077 20078 if (_.animating === true && _.options.waitForAnimate === true) { 20079 return; 20080 } 20081 20082 if (_.options.fade === true && _.currentSlide === index) { 20083 return; 20084 } 20085 20086 if (sync === false) { 20087 _.asNavFor(index); 20088 } 20089 20090 targetSlide = index; 20091 targetLeft = _.getLeft(targetSlide); 20092 slideLeft = _.getLeft(_.currentSlide); 20093 20094 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; 20095 20096 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) { 20097 if (_.options.fade === false) { 20098 targetSlide = _.currentSlide; 20099 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 20100 _.animateSlide(slideLeft, function() { 20101 _.postSlide(targetSlide); 20102 }); 20103 } else { 20104 _.postSlide(targetSlide); 20105 } 20106 } 20107 return; 20108 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) { 20109 if (_.options.fade === false) { 20110 targetSlide = _.currentSlide; 20111 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 20112 _.animateSlide(slideLeft, function() { 20113 _.postSlide(targetSlide); 20114 }); 20115 } else { 20116 _.postSlide(targetSlide); 20117 } 20118 } 20119 return; 20120 } 20121 20122 if ( _.options.autoplay ) { 20123 clearInterval(_.autoPlayTimer); 20124 } 20125
20126 if (targetSlide < 0) { 20127 if (_.slideCount % _.options.slidesToScroll !== 0) { 20128 animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll); 20129 } else { 20130 animSlide = _.slideCount + targetSlide; 20131 } 20132 } else if (targetSlide >= _.slideCount) { 20133 if (_.slideCount % _.options.slidesToScroll !== 0) { 20134 animSlide = 0; 20135 } else { 20136 animSlide = targetSlide - _.slideCount; 20137 } 20138 } else { 20139 animSlide = targetSlide; 20140 } 20141 20142 _.animating = true; 20143 20144 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]); 20145 20146 oldSlide = _.currentSlide; 20147 _.currentSlide = animSlide; 20148 20149 _.setSlideClasses(_.currentSlide); 20150 20151 if ( _.options.asNavFor ) { 20152 20153 navTarget = _.getNavTarget(); 20154 navTarget = navTarget.slick('getSlick'); 20155 20156 if ( navTarget.slideCount <= navTarget.options.slidesToShow ) { 20157 navTarget.setSlideClasses(_.currentSlide); 20158 } 20159 20160 } 20161 20162 _.updateDots(); 20163 _.updateArrows(); 20164 20165 if (_.options.fade === true) { 20166 if (dontAnimate !== true) { 20167 20168 _.fadeSlideOut(oldSlide); 20169 20170 _.fadeSlide(animSlide, function() { 20171 _.postSlide(animSlide); 20172 }); 20173 20174 } else { 20175 _.postSlide(animSlide); 20176 } 20177 _.animateHeight(); 20178 return; 20179 } 20180 20181 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 20182 _.animateSlide(targetLeft, function() { 20183 _.postSlide(animSlide); 20184 }); 20185 } else { 20186 _.postSlide(animSlide); 20187 } 20188 20189 }; 20190 20191 Slick.prototype.startLoad = function() { 20192 20193 var _ = this; 20194 20195 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 20196 20197 _.$prevArrow.hide(); 20198 _.$nextArrow.hide(); 20199 20200 } 20201 20202 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 20203 20204 _.$dots.hide(); 20205 20206 } 20207 20208 _.$slider.addClass('slick-loading'); 20209 20210 }; 20211 20212 Slick.prototype.swipeDirection = function() { 20213 20214 var xDist, yDist, r, swipeAngle, _ = this; 20215 20216 xDist = _.touchObject.startX - _.touchObject.curX; 20217 yDist = _.touchObject.startY - _.touchObject.curY; 20218 r = Math.atan2(yDist, xDist); 20219 20220 swipeAngle = Math.round(r * 180 / Math.PI); 20221 if (swipeAngle < 0) { 20222 swipeAngle = 360 - Math.abs(swipeAngle); 20223 } 20224 20225 if ((swipeAngle <= 45) && (swipeAngle >= 0)) { 20226 return (_.options.rtl === false ? 'left' : 'right'); 20227 } 20228 if ((swipeAngle <= 360) && (swipeAngle >= 315)) { 20229 return (_.options.rtl === false ? 'left' : 'right'); 20230 } 20231 if ((swipeAngle >= 135) && (swipeAngle <= 225)) { 20232 return (_.options.rtl === false ? 'right' : 'left'); 20233 } 20234 if (_.options.verticalSwiping === true) { 20235 if ((swipeAngle >= 35) && (swipeAngle <= 135)) { 20236 return 'down'; 20237 } else { 20238 return 'up'; 20239 } 20240 } 20241 20242 return 'vertical'; 20243 20244 }; 20245 20246 Slick.prototype.swipeEnd = function(event) { 20247 20248 var _ = this, 20249 slideCount, 20250 direction; 20251 20252 _.dragging = false; 20253 _.swiping = false; 20254 20255 if (_.scrolling) { 20256 _.scrolling = false; 20257 return false; 20258 } 20259 20260 _.interrupted = false; 20261 _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true; 20262 20263 if ( _.touchObject.curX === undefined ) { 20264 return false; 20265 } 20266 20267 if ( _.touchObject.edgeHit === true ) { 20268 _.$slider.trigger('edge', [_, _.swipeDirection() ]); 20269 } 20270 20271 if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) { 20272 20273 direction = _.swipeDirection(); 20274 20275 switch ( direction ) { 20276 20277 case 'left': 20278 case 'down': 20279 20280 slideCount =
20281 _.options.swipeToSlide ? 20282 _.checkNavigable( _.currentSlide + _.getSlideCount() ) : 20283 _.currentSlide + _.getSlideCount(); 20284 20285 _.currentDirection = 0; 20286 20287 break; 20288 20289 case 'right': 20290 case 'up': 20291 20292 slideCount = 20293 _.options.swipeToSlide ? 20294 _.checkNavigable( _.currentSlide - _.getSlideCount() ) : 20295 _.currentSlide - _.getSlideCount(); 20296 20297 _.currentDirection = 1; 20298 20299 break; 20300 20301 default: 20302 20303 20304 } 20305 20306 if( direction != 'vertical' ) { 20307 20308 _.slideHandler( slideCount ); 20309 _.touchObject = {}; 20310 _.$slider.trigger('swipe', [_, direction ]); 20311 20312 } 20313 20314 } else { 20315 20316 if ( _.touchObject.startX !== _.touchObject.curX ) { 20317 20318 _.slideHandler( _.currentSlide ); 20319 _.touchObject = {}; 20320 20321 } 20322 20323 } 20324 20325 }; 20326 20327 Slick.prototype.swipeHandler = function(event) { 20328 20329 var _ = this; 20330 20331 if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) { 20332 return; 20333 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) { 20334 return; 20335 } 20336 20337 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ? 20338 event.originalEvent.touches.length : 1; 20339 20340 _.touchObject.minSwipe = _.listWidth / _.options 20341 .touchThreshold; 20342 20343 if (_.options.verticalSwiping === true) { 20344 _.touchObject.minSwipe = _.listHeight / _.options 20345 .touchThreshold; 20346 } 20347 20348 switch (event.data.action) { 20349 20350 case 'start': 20351 _.swipeStart(event); 20352 break; 20353 20354 case 'move': 20355 _.swipeMove(event); 20356 break; 20357 20358 case 'end': 20359 _.swipeEnd(event); 20360 break; 20361 20362 } 20363 20364 }; 20365 20366 Slick.prototype.swipeMove = function(event) { 20367 20368 var _ = this, 20369 edgeWasHit = false, 20370 curLeft, swipeDirection, swipeLength, positionOffset, touches, verticalSwipeLength; 20371 20372 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null; 20373 20374 if (!_.dragging || _.scrolling || touches && touches.length !== 1) { 20375 return false; 20376 } 20377 20378 curLeft = _.getLeft(_.currentSlide); 20379 20380 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX; 20381 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY; 20382 20383 _.touchObject.swipeLength = Math.round(Math.sqrt( 20384 Math.pow(_.touchObject.curX - _.touchObject.startX, 2))); 20385 20386 verticalSwipeLength = Math.round(Math.sqrt( 20387 Math.pow(_.touchObject.curY - _.touchObject.startY, 2))); 20388 20389 if (!_.options.verticalSwiping && !_.swiping && verticalSwipeLength > 4) { 20390 _.scrolling = true; 20391 return false; 20392 } 20393 20394 if (_.options.verticalSwiping === true) { 20395 _.touchObject.swipeLength = verticalSwipeLength; 20396 } 20397 20398 swipeDirection = _.swipeDirection(); 20399 20400 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { 20401 _.swiping = true; 20402 event.preventDefault(); 20403 } 20404 20405 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1); 20406 if (_.options.verticalSwiping === true) { 20407 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; 20408 } 20409 20410 20411 swipeLength = _.touchObject.swipeLength; 20412 20413 _.touchObject.edgeHit = false; 20414 20415 if (_.options.infinite === false) { 20416 if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) { 20417 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; 20418 _.touchObject.edgeHit = true; 20419 } 20420 } 20421 20422 if (_.options.vertical === false) { 20423 _.swipeLeft = curLeft + swipeLength * positionOffset; 20424 } else { 20425 _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset; 20426 } 20427 if (_.options.verticalSwiping === true) { 20428 _.swipeLeft = curLeft + swipeLength * positionOffset; 20429 } 20430 20431 if (_.options.fade === true || _.options.touchMove === false) { 20432 return false; 20433 } 20434 20435 if (_.animating === true) { 20436 _.swipeLeft = null; 20437 return false; 20438 } 20439 20440 _.setCSS(_.swipeLeft); 20441 20442 }; 20443 20444 Slick.prototype.swipeStart = function(event) { 20445 20446 var _ = this, 20447 touches; 20448 20449 _.interrupted = true; 20450 20451 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) { 20452 _.touchObject = {}; 20453 return false; 20454 } 20455 20456 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) { 20457 touches = event.originalEvent.touches[0]; 20458 } 20459 20460 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX; 20461 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY; 20462 20463 _.dragging = true; 20464 20465 }; 20466 20467 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() { 20468 20469 var _ = this; 20470 20471 if (_.$slidesCache !== null) { 20472 20473 _.unload(); 20474 20475 _.$slideTrack.children(this.options.slide).detach(); 20476 20477 _.$slidesCache.appendTo(_.$slideTrack); 20478 20479 _.reinit(); 20480 20481 } 20482 20483 }; 20484 20485 Slick.prototype.unload = function() { 20486 20487 var _ = this; 20488 20489 $('.slick-cloned', _.$slider).remove(); 20490 20491 if (_.$dots) { 20492 _.$dots.remove(); 20493 } 20494 20495 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { 20496 _.$prevArrow.remove(); 20497 } 20498 20499 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { 20500 _.$nextArrow.remove(); 20501 } 20502 20503 _.$slides 20504 .removeClass('slick-slide slick-active slick-visible slick-current') 20505 .attr('aria-hidden', 'true') 20506 .css('width', ''); 20507 20508 }; 20509
20510 Slick.prototype.unslick = function(fromBreakpoint) { 20511 20512 var _ = this; 20513 _.$slider.trigger('unslick', [_, fromBreakpoint]); 20514 _.destroy(); 20515 20516 }; 20517 20518 Slick.prototype.updateArrows = function() { 20519 20520 var _ = this, 20521 centerOffset; 20522 20523 centerOffset = Math.floor(_.options.slidesToShow / 2); 20524 20525 if ( _.options.arrows === true && 20526 _.slideCount > _.options.slidesToShow && 20527 !_.options.infinite ) { 20528 20529 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 20530 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 20531 20532 if (_.currentSlide === 0) { 20533 20534 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 20535 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 20536 20537 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) { 20538 20539 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 20540 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 20541 20542 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) { 20543 20544 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 20545 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 20546 20547 } 20548 20549 } 20550 20551 }; 20552 20553 Slick.prototype.updateDots = function() { 20554 20555 var _ = this; 20556 20557 if (_.$dots !== null) { 20558 20559 _.$dots 20560 .find('li') 20561 .removeClass('slick-active') 20562 .end(); 20563 20564 _.$dots 20565 .find('li') 20566 .eq(Math.floor(_.currentSlide / _.options.slidesToScroll)) 20567 .addClass('slick-active'); 20568 20569 } 20570 20571 }; 20572 20573 Slick.prototype.visibility = function() { 20574 20575 var _ = this; 20576 20577 if ( _.options.autoplay ) { 20578 20579 if ( document[_.hidden] ) { 20580 20581 _.interrupted = true; 20582 20583 } else { 20584 20585 _.interrupted = false; 20586 20587 } 20588 20589 } 20590 20591 }; 20592 20593 $.fn.slick = function() { 20594 var _ = this, 20595 opt = arguments[0], 20596 args = Array.prototype.slice.call(arguments, 1), 20597 l = _.length, 20598 i, 20599 ret; 20600 for (i = 0; i < l; i++) { 20601 if (typeof opt == 'object' || typeof opt == 'undefined') 20602 _[i].slick = new Slick(_[i], opt); 20603 else 20604 ret = _[i].slick[opt].apply(_[i].slick, args); 20605 if (typeof ret != 'undefined') return ret; 20606 } 20607 return _; 20608 }; 20609 20610})); 20611 20612 20613/***/ }), 20614 20615/***/ 4: 20616/***/ (function(module, exports, __webpack_require__) { 20617 20618"use strict"; 20619 20620 20621var base = __webpack_require__(5); 20622var focusHelper = __webpack_require__(6); 20623/** 20624 * appends params to a url 20625 * @param {string} url - Original url 20626 * @param {Object} params - Parameters to append 20627 * @returns {string} result url with appended parameters 20628 */ 20629function appendToUrl(url, params) { 20630 var newUrl = url; 20631 newUrl += (newUrl.indexOf('?') !== -1 ? '&' : '?') + Object.keys(params).map(function (key) { 20632 return key + '=' + encodeURIComponent(params[key]); 20633 }).join('&'); 20634 20635 return newUrl; 20636} 20637 20638/** 20639 * Checks whether the basket is valid. if invalid displays error message and disables 20640 * checkout button 20641 * @param {Object} data - AJAX response from the server 20642 */ 20643function validateBasket(data) { 20644 if (data.showError) { 20645 $(".cart-error-messaging").find('.alert-danger').remove(); 20646 if (data.valid.error) { 20647 if (data.valid.message) { 20648 var errorHtml = '<div class="alert alert-danger alert-dismissible valid-cart-error ' + 20649 'fade show" role="alert">' + 20650 '<button type="button" class="close" data-dismiss="alert" aria-label="Close">' + 20651 '<span aria-hidden="true">×</span>' + 20652 '</button>' + data.valid.message + '</div>'; 20653 20654 $('.cart-error').append(errorHtml); 20655 } else { 20656 $('.cart').empty().append('<div class="row"> ' + 20657 '<div class="col-12 text-center"> ' + 20658 '<h1>' + data.resources.emptyCartMsg + '</h1> ' + 20659 '</div> ' + 20660 '</div>' 20661 ); 20662 $('.number-of-items').empty().append(data.resources.numberOfItems); 20663 $('.minicart-quantity').empty().append(data.numItems); 20664 $('.minicart-link').attr({ 20665 'aria-label': data.resources.minicartCountOfItems, 20666 title: data.resources.minicartCountOfItems 20667 }); 20668 $('.minicart .popover').empty(); 20669 $('.minicart .popover').removeClass('show'); 20670 } 20671 20672 $('.checkout-btn').addClass('disabled'); 20673 } else { 20674 $('.checkout-btn').removeClass('disabled'); 20675 } 20676 setTimeout(function () { 20677 $(".cart-error-messaging").find('.alert-danger').remove(); 20678 }, 3000); 20679 20680 } 20681} 20682 20683/** 20684 * re-renders the order totals and the number of items in the cart 20685 * @param {Object} data - AJAX response from the server 20686 */ 20687function updateCartTotals(data) { 20688 $('.number-of-items').empty().append(data.resources.numberOfItems); 20689 $('.shipping-cost').empty().append(data.totals.totalShippingCost); 20690 $('.tax-total').empty().append(data.totals.totalTax); 20691 $('.grand-total-sum').empty().append(data.totals.grandTotal); 20692 $('.estimated-total .grand-total').empty().append(data.totals.grandTotal); 20693 $('.sub-total').empty().append(data.totals.subTotal); 20694 $('.minicart-quantity').empty().append(data.numItems); 20695 $('.minicart-link').attr({ 20696 'aria-label': data.resources.minicartCountOfItems, 20697 title: data.resources.minicartCountOfItems 20698 });
20699 if (data.totals.orderLevelDiscountTotal.value > 0) { 20700 $('.order-discount').removeClass('hide-order-discount'); 20701 $('.order-discount-total').empty().append('- ' + data.totals.orderLevelDiscountTotal.formatted); 20702 var grandTotal = (data.totals.subTotal.replace("S$", "").replace(",", "") - data.totals.orderLevelDiscountTotal.value).toFixed(2); 20703 $('.grand-total-calulate').empty().append("S$" + grandTotal); 20704 } else { 20705 $('.order-discount').addClass('hide-order-discount'); 20706 $('.grand-total-calulate').empty().append(data.totals.subTotal); 20707 } 20708 20709 if (data.totals.shippingLevelDiscountTotal.value > 0) { 20710 $('.shipping-discount').removeClass('hide-shipping-discount'); 20711 $('.shipping-discount-total').empty().append('- ' + 20712 data.totals.shippingLevelDiscountTotal.formatted); 20713 } else { 20714 $('.shipping-discount').addClass('hide-shipping-discount'); 20715 } 20716 data.items.forEach(function (item) { 20717 if (data.totals.orderLevelDiscountTotal.value > 0) { 20718 $('.coupons-and-promos').empty().append(data.totals.discountsHtml); 20719 } 20720 if (item.renderedPromotions) { 20721 $('.item-' + item.UUID).empty().append(item.renderedPromotions); 20722 } else { 20723 $('.item-' + item.UUID).empty(); 20724 } 20725 $('.uuid-' + item.UUID + ' .unit-price').empty().append(item.renderedPrice); 20726 $('.line-item-price-' + item.UUID + ' .unit-price').empty().append(item.renderedPrice); 20727 $('.item-total-' + item.UUID).empty().append(item.priceTotal.renderedPrice); 20728 }); 20729} 20730 20731/** 20732 * re-renders the order totals and the number of items in the cart 20733 * @param {Object} message - Error message to display 20734 */ 20735function createErrorNotification(message) { 20736 var errorHtml = '<div class="alert alert-danger alert-dismissible valid-cart-error ' + 20737 'fade show" role="alert">' + 20738 '<button type="button" class="close" data-dismiss="alert" aria-label="Close">' + 20739 '<span aria-hidden="true">×</span>' + 20740 '</button>' + message + '</div>'; 20741 $('.cart-error').html(''); 20742 $('.cart-error').append(errorHtml); 20743} 20744 20745/** 20746 * re-renders the approaching discount messages 20747 * @param {Object} approachingDiscounts - updated approaching discounts for the cart 20748 */ 20749function updateApproachingDiscounts(approachingDiscounts) { 20750 var html = ''; 20751 $('.approaching-discounts').empty(); 20752 if (approachingDiscounts.length > 0) { 20753 approachingDiscounts.forEach(function (item) { 20754 html += '<div class="single-approaching-discount text-center">' + 20755 item.discountMsg + '</div>'; 20756 }); 20757 } 20758 $('.approaching-discounts').append(html); 20759} 20760 20761/** 20762 * Updates the availability of a product line item 20763 * @param {Object} data - AJAX response from the server 20764 * @param {string} uuid - The uuid of the product line item to update 20765 */ 20766function updateAvailability(data, uuid) { 20767 var lineItem; 20768 var messages = ''; 20769 20770 for (var i = 0; i < data.items.length; i++) { 20771 if (data.items[i].UUID === uuid) { 20772 lineItem = data.items[i]; 20773 break; 20774 } 20775 } 20776 20777 if (lineItem != null) { 20778 $('.availability-' + lineItem.UUID).empty(); 20779 20780 if (lineItem.availability) { 20781 if (lineItem.availability.messages) { 20782 lineItem.availability.messages.forEach(function (message) { 20783 var msgClass = "default-available-status"; 20784 if (message in data.availabilityMsgClass) { 20785 msgClass = data.availabilityMsgClass[message]; 20786 } 20787 messages += '<p class="line-item-attributes ' + msgClass + '">' + message + '</p>'; 20788 }); 20789 } 20790 20791 if (lineItem.availability.inStockDate) { 20792 messages += '<p class="line-item-attributes line-item-instock-date">' + 20793 lineItem.availability.inStockDate + 20794 '</p>'; 20795 } 20796 } 20797 20798 $('.availability-' + lineItem.UUID).html(messages); 20799 } 20800} 20801 20802/** 20803 * Finds an element in the array that matches search parameter 20804 * @param {array} array - array of items to search 20805 * @param {function} match - function that takes an element and returns a boolean indicating if the match is made 20806 * @returns {Object|null} - returns an element of the array that matched the query. 20807 */ 20808function findItem(array, match) { // eslint-disable-line no-unused-vars 20809 for (var i = 0, l = array.length; i < l; i++) { 20810 if (match.call(this, array[i])) { 20811 return array[i]; 20812 } 20813 } 20814 return null; 20815} 20816 20817/** 20818 * Updates details of a product line item 20819 * @param {Object} data - AJAX response from the server 20820 * @param {string} uuid - The uuid of the product line item to update 20821 */ 20822function updateProductDetails(data, uuid) { 20823 $('.card.product-info.uuid-' + uuid).replaceWith(data.renderedTemplate); 20824} 20825 20826/** 20827 * Generates the modal window on the first call. 20828 * 20829 */ 20830function getModalHtmlElement() { 20831 if ($('#editProductModal').length !== 0) { 20832 $('#editProductModal').remove(); 20833 } 20834 var htmlString = '<!-- Modal -->' + 20835 '<div class="modal fade" id="editProductModal" tabindex="-1" role="dialog">' + 20836 '<span class="enter-message sr-only" ></span>' + 20837 '<div class="modal-dialog quick-view-dialog">' + 20838 '<!-- Modal content-->' + 20839 '<div class="modal-content">' + 20840 '<div class="modal-header">' + 20841 ' <button type="button" class="close pull-right" data-dismiss="modal">' +
20842 ' <span aria-hidden="true">×</span>' + 20843 ' <span class="sr-only"> </span>' + 20844 ' </button>' + 20845 '</div>' + 20846 '<div class="modal-body"></div>' + 20847 '<div class="modal-footer"></div>' + 20848 '</div>' + 20849 '</div>' + 20850 '</div>'; 20851 $('body').append(htmlString); 20852} 20853 20854/** 20855 * Parses the html for a modal window 20856 * @param {string} html - representing the body and footer of the modal window 20857 * 20858 * @return {Object} - Object with properties body and footer. 20859 */ 20860function parseHtml(html) { 20861 var $html = $('<div>').append($.parseHTML(html)); 20862 20863 var body = $html.find('.product-quickview'); 20864 var footer = $html.find('.modal-footer').children(); 20865 20866 return { 20867 body: body, 20868 footer: footer 20869 }; 20870} 20871 20872/** 20873 * replaces the content in the modal window for product variation to be edited. 20874 * @param {string} editProductUrl - url to be used to retrieve a new product model 20875 */ 20876function fillModalElement(editProductUrl) { 20877 $('.modal-body').spinner().start(); 20878 $.ajax({
20879 url: editProductUrl, 20880 method: 'GET', 20881 dataType: 'json', 20882 success: function (data) { 20883 var parsedHtml = parseHtml(data.renderedTemplate); 20884 20885 $('#editProductModal .modal-body').empty(); 20886 $('#editProductModal .modal-body').html(parsedHtml.body); 20887 $('#editProductModal .modal-footer').html(parsedHtml.footer); 20888 $('#editProductModal .modal-header .close .sr-only').text(data.closeButtonText); 20889 $('#editProductModal .enter-message').text(data.enterDialogMessage); 20890 $('#editProductModal').modal('show'); 20891 $('body').trigger('editproductmodal:ready'); 20892 $.spinner().stop(); 20893 }, 20894 error: function () { 20895 $.spinner().stop(); 20896 } 20897 }); 20898} 20899 20900/** 20901 * replace content of modal 20902 * @param {string} actionUrl - url to be used to remove product 20903 * @param {string} productID - pid 20904 * @param {string} productName - product name 20905 * @param {string} uuid - uuid 20906 */ 20907function confirmDelete(actionUrl, productID, productName, uuid) { 20908 var $deleteConfirmBtn = $('.cart-delete-confirmation-btn'); 20909 var $productToRemoveSpan = $('.product-to-remove'); 20910 20911 $deleteConfirmBtn.data('pid', productID); 20912 $deleteConfirmBtn.data('action', actionUrl); 20913 $deleteConfirmBtn.data('uuid', uuid); 20914 20915 $productToRemoveSpan.empty().append(productName); 20916} 20917 20918function updateBundleProductQuantity(data) { 20919 Object.keys(data.items).forEach(key => { 20920 var item = data.items[key]; 20921 if (item.bundledProductLineItems) { 20922 Object.keys(item.bundledProductLineItems).forEach(key => { 20923 var bundleproductitem = item.bundledProductLineItems[key]; 20924 var uuid = bundleproductitem.UUID; 20925 var quantity = bundleproductitem.quantity; 20926 $(".quantitybox-" + uuid).find('.value').text(quantity); 20927 }); 20928 } 20929 20930 }); 20931} 20932 20933$('body').on('click', '.cartDecreaseQty, .cartIncreaseQty', function (e) { 20934 e.stopImmediatePropagation(); 20935 e.preventDefault(); 20936 var preSelectQty = $(this).data('pre-select-qty'); 20937 var productID = $(this).data('pid'); 20938 var url = $(this).data('action'); 20939 var uuid = $(this).data('uuid'); 20940 var quantity = $('#quantity-' + uuid).val(); 20941 var ats = $(this).data('ats'); 20942 var perpetual = $(this).attr('data-perpetual'); 20943 if ($(this).hasClass('cartIncreaseQty')) { 20944 quantity++; 20945 } else { 20946 if (quantity == 1) { 20947 return 0; 20948 } 20949 quantity--; 20950 } 20951 if (quantity > ats && perpetual != 'true') { 20952 $(".cart-validation-msg").remove(); 20953 $(this).closest('.line-item-quantity').find('.cart-user-actions').append('<div class="alert alert-danger cart-validation-msg" role="alert" style="display: block;width: 250px;padding: 0;">Your selected quantity more than available stock. Please amend quantity.</div>'); 20954 setTimeout(function () { 20955 $(".cart-validation-msg").remove(); 20956 }, 3000); 20957 return 0; 20958 } 20959 var urlParams = { 20960 pid: productID, 20961 quantity: quantity, 20962 uuid: uuid 20963 }; 20964 url = appendToUrl(url, urlParams); 20965 20966 $(this).parents('.card').spinner().start(); 20967 20968 $('body').trigger('cart:beforeUpdate'); 20969 20970 $.ajax({
20971 url: url, 20972 type: 'get', 20973 context: this, 20974 dataType: 'json', 20975 success: function (data) { 20976 location.reload(); 20977 $('#quantity-' + uuid).val(quantity); 20978 $('.coupons-and-promos').empty().append(data.totals.discountsHtml); 20979 updateCartTotals(data); 20980 updateApproachingDiscounts(data.approachingDiscounts); 20981 updateAvailability(data, uuid); 20982 validateBasket(data); 20983 $(this).data('pre-select-qty', quantity); 20984 20985 $('body').trigger('cart:update', data); 20986 20987 $.spinner().stop(); 20988 if ($(this).parents('.product-info').hasClass('bonus-product-line-item') && $('.cart-page').length) { 20989 location.reload(); 20990 } 20991 updateBundleProductQuantity(data); 20992 // console.log(data.items); 20993 }, 20994 error: function (err) { 20995 if (err.responseJSON.redirectUrl) { 20996 window.location.href = err.responseJSON.redirectUrl; 20997 } else { 20998 createErrorNotification(err.responseJSON.errorMessage); 20999 $(this).val(parseInt(preSelectQty, 10)); 21000 $.spinner().stop(); 21001 } 21002 } 21003 }); 21004}); 21005 21006module.exports = function () { 21007 $('body').on('click', '.remove-product', function (e) { 21008 e.preventDefault(); 21009 21010 var actionUrl = $(this).data('action'); 21011 var productID = $(this).data('pid'); 21012 var productName = $(this).data('name'); 21013 var uuid = $(this).data('uuid'); 21014 confirmDelete(actionUrl, productID, productName, uuid); 21015 }); 21016 21017 $('body').on('afterRemoveFromCart', function (e, data) { 21018 e.preventDefault(); 21019 confirmDelete(data.actionUrl, data.productID, data.productName, data.uuid); 21020 }); 21021 21022 $('.optional-promo').click(function (e) { 21023 e.preventDefault(); 21024 $('.promo-code-form').toggle(); 21025 }); 21026 21027 $('body').on('click', '.cart-delete-confirmation-btn', function (e) { 21028 e.preventDefault(); 21029 21030 var productID = $(this).data('pid'); 21031 var url = $(this).data('action'); 21032 var uuid = $(this).data('uuid'); 21033 var urlParams = { 21034 pid: productID, 21035 uuid: uuid 21036 }; 21037 21038 url = appendToUrl(url, urlParams); 21039 21040 $('body > .modal-backdrop').remove(); 21041 21042 $.spinner().start(); 21043 21044 $('body').trigger('cart:beforeUpdate'); 21045 21046 $.ajax({
21047 url: url, 21048 type: 'get', 21049 dataType: 'json', 21050 success: function (data) { 21051 if (data.basket.items.length === 0) { 21052 $('.cart').empty().append('<div class="row"> ' + 21053 '<div class="col-12 text-center"> ' + 21054 '<h1>' + data.basket.resources.emptyCartMsg + '</h1> ' + 21055 '</div> ' + 21056 '</div>' 21057 ); 21058 $('.number-of-items').empty().append(data.basket.resources.numberOfItems); 21059 $('.minicart-quantity').empty().append(data.basket.numItems); 21060 $('.minicart-link').attr({ 21061 'aria-label': data.basket.resources.minicartCountOfItems, 21062 title: data.basket.resources.minicartCountOfItems 21063 }); 21064 $('.minicart .popover').empty(); 21065 $('.minicart .popover').removeClass('show'); 21066 $('body').removeClass('modal-open'); 21067 $('html').removeClass('veiled'); 21068 } else { 21069 if (data.toBeDeletedUUIDs && data.toBeDeletedUUIDs.length > 0) { 21070 for (var i = 0; i < data.toBeDeletedUUIDs.length; i++) { 21071 $('.uuid-' + data.toBeDeletedUUIDs[i]).remove(); 21072 } 21073 } 21074 $('.uuid-' + uuid).remove(); 21075 if (!data.basket.hasBonusProduct) { 21076 $('.bonus-product').remove(); 21077 } 21078 $('.coupons-and-promos').empty().append(data.basket.totals.discountsHtml); 21079 updateCartTotals(data.basket); 21080 updateApproachingDiscounts(data.basket.approachingDiscounts); 21081 $('body').trigger('setShippingMethodSelection', data.basket); 21082 validateBasket(data.basket); 21083 } 21084 21085 $('body').trigger('cart:update', data); 21086 location.reload(); 21087 $.spinner().stop(); 21088 }, 21089 error: function (err) { 21090 if (err.responseJSON.redirectUrl) { 21091 window.location.href = err.responseJSON.redirectUrl; 21092 } else { 21093 createErrorNotification(err.responseJSON.errorMessage); 21094 $.spinner().stop(); 21095 } 21096 } 21097 }); 21098 }); 21099 21100 $('body').on('change', '.quantity-form > .quantity', function () { 21101 var preSelectQty = $(this).data('pre-select-qty'); 21102 var quantity = $(this).val(); 21103 var productID = $(this).data('pid'); 21104 var url = $(this).data('action'); 21105 var uuid = $(this).data('uuid'); 21106 var ats = $(this).data('ats'); 21107 var perpetual = $(this).attr('data-perpetual'); 21108 if (quantity > ats && perpetual != 'true') { 21109 $(".cart-validation-msg").remove(); 21110 $(this).closest('.line-item-quantity').find('.cart-user-actions').append('<div class="alert alert-danger cart-validation-msg" role="alert" style="display: block;width: 250px;padding: 0;">Your selected quantity more than available stock. Please amend quantity.</div>'); 21111 setTimeout(function () { 21112 $(".cart-validation-msg").remove(); 21113 }, 3000); 21114 return 0; 21115 } 21116 var urlParams = { 21117 pid: productID, 21118 quantity: quantity, 21119 uuid: uuid 21120 }; 21121 url = appendToUrl(url, urlParams); 21122 21123 $(this).parents('.card').spinner().start(); 21124 21125 $('body').trigger('cart:beforeUpdate'); 21126 21127 $.ajax({
21128 url: url, 21129 type: 'get', 21130 context: this, 21131 dataType: 'json', 21132 success: function (data) { 21133 location.reload(); 21134 $('.quantity[data-uuid="' + uuid + '"]').val(quantity); 21135 $('.coupons-and-promos').empty().append(data.totals.discountsHtml); 21136 updateCartTotals(data); 21137 updateApproachingDiscounts(data.approachingDiscounts); 21138 updateAvailability(data, uuid); 21139 validateBasket(data); 21140 $(this).data('pre-select-qty', quantity); 21141 21142 $('body').trigger('cart:update', data); 21143 21144 $.spinner().stop(); 21145 if ($(this).parents('.product-info').hasClass('bonus-product-line-item') && $('.cart-page').length) { 21146 location.reload(); 21147 } 21148 }, 21149 error: function (err) { 21150 if (err.responseJSON.redirectUrl) { 21151 window.location.href = err.responseJSON.redirectUrl; 21152 } else { 21153 createErrorNotification(err.responseJSON.errorMessage); 21154 $(this).val(parseInt(preSelectQty, 10)); 21155 $.spinner().stop(); 21156 } 21157 } 21158 }); 21159 }); 21160 21161 $('.shippingMethods').change(function () { 21162 var url = $(this).attr('data-actionUrl'); 21163 var urlParams = { 21164 methodID: $(this).find(':selected').attr('data-shipping-id') 21165 }; 21166 // url = appendToUrl(url, urlParams); 21167 21168 $('.totals').spinner().start(); 21169 $('body').trigger('cart:beforeShippingMethodSelected'); 21170 $.ajax({
21171 url: url, 21172 type: 'post', 21173 dataType: 'json', 21174 data: urlParams, 21175 success: function (data) { 21176 if (data.error) { 21177 window.location.href = data.redirectUrl; 21178 } else { 21179 $('.coupons-and-promos').empty().append(data.totals.discountsHtml); 21180 updateCartTotals(data); 21181 updateApproachingDiscounts(data.approachingDiscounts); 21182 validateBasket(data); 21183 } 21184 21185 $('body').trigger('cart:shippingMethodSelected', data); 21186 $.spinner().stop(); 21187 }, 21188 error: function (err) { 21189 if (err.redirectUrl) { 21190 window.location.href = err.redirectUrl; 21191 } else { 21192 createErrorNotification(err.responseJSON.errorMessage); 21193 $.spinner().stop(); 21194 } 21195 } 21196 }); 21197 }); 21198 21199 $('.promo-code-form').submit(function (e) { 21200 e.preventDefault(); 21201 $.spinner().start(); 21202 $('.coupon-missing-error').hide(); 21203 $('.coupon-error-message').empty(); 21204 if (!$('.coupon-code-field').val()) { 21205 $('.promo-code-form .form-control').addClass('is-invalid'); 21206 $('.promo-code-form .form-control').attr('aria-describedby', 'missingCouponCode'); 21207 $('.coupon-missing-error').show(); 21208 $.spinner().stop(); 21209 return false; 21210 } 21211 var $form = $('.promo-code-form'); 21212 $('.promo-code-form .form-control').removeClass('is-invalid'); 21213 $('.coupon-error-message').empty(); 21214 $('body').trigger('promotion:beforeUpdate'); 21215 21216 $.ajax({
21217 url: $form.attr('action'), 21218 type: 'GET', 21219 dataType: 'json', 21220 data: $form.serialize(), 21221 success: function (data) { 21222 if (data.error) { 21223 $('.promo-code-form .form-control').addClass('is-invalid'); 21224 $('.promo-code-form .form-control').attr('aria-describedby', 'invalidCouponCode'); 21225 $('.coupon-error-message').empty().append(data.errorMessage); 21226 $('body').trigger('promotion:error', data); 21227 } else { 21228 location.reload(); 21229 } 21230 $('.coupon-code-field').val(''); 21231 $.spinner().stop(); 21232 }, 21233 error: function (err) { 21234 $('body').trigger('promotion:error', err); 21235 if (err.responseJSON.redirectUrl) { 21236 window.location.href = err.responseJSON.redirectUrl; 21237 } else { 21238 createErrorNotification(err.errorMessage); 21239 $.spinner().stop(); 21240 } 21241 } 21242 }); 21243 return false; 21244 }); 21245 21246 $('body').on('click', '.remove-coupon', function (e) { 21247 e.preventDefault(); 21248 21249 var couponCode = $(this).data('code'); 21250 var uuid = $(this).data('uuid'); 21251 var $deleteConfirmBtn = $('.delete-coupon-confirmation-btn'); 21252 var $productToRemoveSpan = $('.coupon-to-remove'); 21253 21254 $deleteConfirmBtn.data('uuid', uuid); 21255 $deleteConfirmBtn.data('code', couponCode); 21256 21257 $productToRemoveSpan.empty().append(couponCode); 21258 }); 21259 21260 $('body').on('click', '.delete-coupon-confirmation-btn', function (e) { 21261 e.preventDefault(); 21262 21263 var url = $(this).data('action'); 21264 var uuid = $(this).data('uuid'); 21265 var couponCode = $(this).data('code'); 21266 var urlParams = { 21267 code: couponCode, 21268 uuid: uuid 21269 }; 21270 21271 url = appendToUrl(url, urlParams); 21272 21273 $('body > .modal-backdrop').remove(); 21274 21275 $.spinner().start(); 21276 $('body').trigger('promotion:beforeUpdate'); 21277 $.ajax({
21278 url: url, 21279 type: 'get', 21280 dataType: 'json', 21281 success: function (data) { 21282 location.reload(); 21283 }, 21284 error: function (err) { 21285 $('body').trigger('promotion:error', err); 21286 if (err.responseJSON.redirectUrl) { 21287 window.location.href = err.responseJSON.redirectUrl; 21288 } else { 21289 createErrorNotification(err.responseJSON.errorMessage); 21290 $.spinner().stop(); 21291 } 21292 } 21293 }); 21294 }); 21295 $('body').on('click', '.cart-page .bonus-product-button', function () { 21296 $.spinner().start(); 21297 $(this).addClass('launched-modal'); 21298 $.ajax({ 21299 url: $(this).data('url'), 21300 method: 'GET', 21301 dataType: 'json', 21302 success: function (data) { 21303 base.methods.editBonusProducts(data); 21304 $.spinner().stop(); 21305 }, 21306 error: function () { 21307 $.spinner().stop(); 21308 } 21309 }); 21310 }); 21311 21312 $('body').on('hidden.bs.modal', '#chooseBonusProductModal', function () { 21313 $('#chooseBonusProductModal').remove(); 21314 $('.modal-backdrop').remove(); 21315 $('body').removeClass('modal-open'); 21316 21317 if ($('.cart-page').length) { 21318 $('.launched-modal .btn-outline-primary').trigger('focus'); 21319 $('.launched-modal').removeClass('launched-modal'); 21320 } else { 21321 $('.product-detail .add-to-cart').focus(); 21322 } 21323 }); 21324 21325 $('body').on('click', '.cart-page .product-edit .edit, .cart-page .bundle-edit .edit', function (e) { 21326 e.preventDefault(); 21327 21328 var editProductUrl = $(this).attr('href'); 21329 getModalHtmlElement(); 21330 fillModalElement(editProductUrl); 21331 }); 21332 21333 $('body').on('shown.bs.modal', '#editProductModal', function () { 21334 $('#editProductModal').siblings().attr('aria-hidden', 'true'); 21335 $('#editProductModal .close').focus(); 21336 }); 21337 21338 $('body').on('hidden.bs.modal', '#editProductModal', function () { 21339 $('#editProductModal').siblings().attr('aria-hidden', 'false'); 21340 }); 21341 21342 $('body').on('keydown', '#editProductModal', function (e) { 21343 var focusParams = { 21344 event: e, 21345 containerSelector: '#editProductModal', 21346 firstElementSelector: '.close', 21347 lastElementSelector: '.update-cart-product-global', 21348 nextToLastElementSelector: '.modal-footer .quantity-select' 21349 }; 21350 focusHelper.setTabNextFocus(focusParams); 21351 }); 21352 21353 $('body').on('product:updateAddToCart', function (e, response) { 21354 // update global add to cart (single products, bundles) 21355 var dialog = $(response.$productContainer) 21356 .closest('.quick-view-dialog'); 21357 21358 $('.update-cart-product-global', dialog).attr('disabled', 21359 !$('.global-availability', dialog).data('ready-to-order') || 21360 !$('.global-availability', dialog).data('available') 21361 ); 21362 }); 21363 21364 $('body').on('product:updateAvailability', function (e, response) { 21365 // bundle individual products 21366 $('.product-availability', response.$productContainer) 21367 .data('ready-to-order', response.product.readyToOrder) 21368 .data('available', response.product.available) 21369 .find('.availability-msg') 21370 .empty() 21371 .html(response.message); 21372 21373 21374 var dialog = $(response.$productContainer) 21375 .closest('.quick-view-dialog'); 21376 21377 if ($('.product-availability', dialog).length) { 21378 // bundle all products 21379 var allAvailable = $('.product-availability', dialog).toArray() 21380 .every(function (item) { 21381 return $(item).data('available'); 21382 }); 21383 21384 var allReady = $('.product-availability', dialog).toArray() 21385 .every(function (item) { 21386 return $(item).data('ready-to-order'); 21387 }); 21388 21389 $('.global-availability', dialog) 21390 .data('ready-to-order', allReady) 21391 .data('available', allAvailable); 21392 21393 $('.global-availability .availability-msg', dialog).empty() 21394 .html(allReady ? response.message : response.resources.info_selectforstock); 21395 } else { 21396 // single product 21397 $('.global-availability', dialog) 21398 .data('ready-to-order', response.product.readyToOrder) 21399 .data('available', response.product.available) 21400 .find('.availability-msg') 21401 .empty() 21402 .html(response.message); 21403 } 21404 });
21405 21406 $('body').on('product:afterAttributeSelect', function (e, response) { 21407 if ($('.modal.show .product-quickview .bundle-items').length) { 21408 $('.modal.show').find(response.container).data('pid', response.data.product.id); 21409 $('.modal.show').find(response.container).find('.product-id').text(response.data.product.id); 21410 } else { 21411 $('.modal.show .product-quickview').data('pid', response.data.product.id); 21412 } 21413 }); 21414 21415 $('body').on('change', '.quantity-select', function () { 21416 var selectedQuantity = $(this).val(); 21417 $('.modal.show .update-cart-url').data('selected-quantity', selectedQuantity); 21418 }); 21419 21420 $('body').on('change', '.options-select', function () { 21421 var selectedOptionValueId = $(this).children('option:selected').data('value-id'); 21422 $('.modal.show .update-cart-url').data('selected-option', selectedOptionValueId); 21423 }); 21424 21425 $('body').on('click', '.update-cart-product-global', function (e) { 21426 e.preventDefault(); 21427 21428 var updateProductUrl = $(this).closest('.cart-and-ipay').find('.update-cart-url').val(); 21429 var selectedQuantity = $(this).closest('.cart-and-ipay').find('.update-cart-url').data('selected-quantity'); 21430 var selectedOptionValueId = $(this).closest('.cart-and-ipay').find('.update-cart-url').data('selected-option'); 21431 var uuid = $(this).closest('.cart-and-ipay').find('.update-cart-url').data('uuid'); 21432 21433 var form = { 21434 uuid: uuid, 21435 pid: base.getPidValue($(this)), 21436 quantity: selectedQuantity, 21437 selectedOptionValueId: selectedOptionValueId 21438 }; 21439 21440 $(this).parents('.card').spinner().start(); 21441 21442 $('body').trigger('cart:beforeUpdate'); 21443 21444 if (updateProductUrl) { 21445 $.ajax({
21446 url: updateProductUrl, 21447 type: 'post', 21448 context: this, 21449 data: form, 21450 dataType: 'json', 21451 success: function (data) { 21452 $('#editProductModal').modal('hide'); 21453 21454 $('.coupons-and-promos').empty().append(data.cartModel.totals.discountsHtml); 21455 updateCartTotals(data.cartModel); 21456 updateApproachingDiscounts(data.cartModel.approachingDiscounts); 21457 updateAvailability(data.cartModel, uuid); 21458 updateProductDetails(data, uuid); 21459 21460 if (data.uuidToBeDeleted) { 21461 $('.uuid-' + data.uuidToBeDeleted).remove(); 21462 } 21463 21464 validateBasket(data.cartModel); 21465 21466 $('body').trigger('cart:update', data); 21467 21468 $.spinner().stop(); 21469 }, 21470 error: function (err) { 21471 if (err.responseJSON.redirectUrl) { 21472 window.location.href = err.responseJSON.redirectUrl; 21473 } else { 21474 createErrorNotification(err.responseJSON.errorMessage); 21475 $.spinner().stop(); 21476 } 21477 } 21478 }); 21479 } 21480 }); 21481 $('body').on('focusin', '.quantity', function () { 21482 $(this).data('prev-val', $(this).val()); 21483 }); 21484 $('body').on('change', '.quantity', function (e) { 21485 if ($(this).closest('.quantity-form-wishlist').length > 0) { 21486 e.stopPropagation(); 21487 e.preventDefault(); 21488 return false; 21489 } 21490 var beforeChangeValue = $(this).data('prev-val'); 21491 var preSelectQty = $(this).data('pre-select-qty'); 21492 var productID = $(this).data('pid'); 21493 var url = $(this).data('action'); 21494 var uuid = $(this).data('uuid'); 21495 var quantity = $('#quantity-' + uuid).val(); 21496 var ats = $(this).data('ats'); 21497 var perpetual = $(this).attr('data-perpetual'); 21498 if (quantity == 0) { 21499 $(this).val(1); 21500 quantity++; 21501 } 21502 21503 if ($(this).hasClass('cartIncreaseQty')) { 21504 if (quantity >= ats) { 21505 return 0; 21506 } 21507 quantity++; 21508 } else if ($(this).hasClass('cartDecreaseQty')) { 21509 if (quantity == 1) { 21510 return 0; 21511 } 21512 quantity--; 21513 } 21514 if (quantity > ats && perpetual != 'true') { 21515 $(this).val(beforeChangeValue); 21516 $(this).data('prev-val', $(this).val()); 21517 $(".cart-validation-msg").remove(); 21518 $(this).closest('.line-item-quantity').find('.cart-user-actions').append('<div class="alert cart-validation-msg" role="alert" style="display: block;width: 250px;padding: 0;">Your selected quantity more than available stock. Please amend quantity.</div>'); 21519 setTimeout(function () { 21520 $(".cart-validation-msg").remove(); 21521 }, 3000); 21522 return 0; 21523 } 21524 var urlParams = { 21525 pid: productID, 21526 quantity: quantity, 21527 uuid: uuid 21528 }; 21529 url = appendToUrl(url, urlParams); 21530 21531 $(this).parents('.card').spinner().start(); 21532 21533 $('body').trigger('cart:beforeUpdate'); 21534 21535 $.ajax({
21536 url: url, 21537 type: 'get', 21538 context: this, 21539 dataType: 'json', 21540 success: function (data) { 21541 location.reload(); 21542 $('#quantity-' + uuid).val(quantity); 21543 $('.coupons-and-promos').empty().append(data.totals.discountsHtml); 21544 updateCartTotals(data); 21545 updateApproachingDiscounts(data.approachingDiscounts); 21546 updateAvailability(data, uuid); 21547 validateBasket(data); 21548 $(this).data('pre-select-qty', quantity); 21549 21550 $('body').trigger('cart:update', data); 21551 21552 $.spinner().stop(); 21553 if ($(this).parents('.product-info').hasClass('bonus-product-line-item') && $('.cart-page').length) { 21554 location.reload(); 21555 } 21556 updateBundleProductQuantity(data); 21557 }, 21558 error: function (err) { 21559 if (err.responseJSON.redirectUrl) { 21560 window.location.href = err.responseJSON.redirectUrl; 21561 } else { 21562 createErrorNotification(err.responseJSON.errorMessage); 21563 $(this).val(parseInt(preSelectQty, 10)); 21564 $.spinner().stop(); 21565 } 21566 } 21567 }); 21568 }); 21569 21570 $(document).on("click", "input[name='giftWrapRadio']", function () { 21571 var val = $(this).val(); 21572 if (val == 'YES') { 21573 if ($(".gift-wraper-product-uuid").val()) { 21574 return false; //if gift wrap item already exist than not add this again 21575 } 21576 var addToCartUrl = $('.add-to-cart-url').val(); 21577 var form = { 21578 pid: $(".gift-wraper-product-id").val(), //will make this dynamic, 21579 quantity: 1 21580 }; 21581 $.ajax({
21582 url: addToCartUrl, 21583 method: 'POST', 21584 data: form, 21585 success: function (data) { 21586 window.location.reload(); 21587 }, 21588 error: function () { 21589 $.spinner().stop(); 21590 } 21591 }); 21592 } else { 21593 var deleteFromCartUrl = $('.delete-from-cart-url').val(); 21594 var urlParams = { 21595 pid: $(".gift-wraper-product-id").val(), //will make this dynamic, 21596 uuid: $(".gift-wraper-product-uuid").val() 21597 }; 21598 $.ajax({ 21599 url: deleteFromCartUrl, 21600 method: 'get', 21601 data: urlParams, 21602 dataType: 'json', 21603 success: function (data) { 21604 window.location.reload(); 21605 }, 21606 error: function () { 21607 $.spinner().stop(); 21608 } 21609 }); 21610 } 21611 }); 21612 $(document).on("click", '.cart-delete-confirmation-btn', function () { 21613 setTimeout(function () { 21614 if ($(".uuid-" + $(".gift-wraper-product-uuid").val()).length == 0) { 21615 $("input[name='giftWrapRadio'][value='NO']").prop('checked', true); 21616 $("input[name='giftWrapRadio'][value='NO']").prop('disabled', true); 21617 $("input[name='giftWrapRadio'][value='YES']").prop('disabled', false); 21618 } 21619 }, 1500); 21620 21621 21622 }); 21623 21624 base.selectAttribute(); 21625 base.colorAttribute(); 21626 base.removeBonusProduct(); 21627 base.enableBonusProductSelection(); 21628 base.showMoreBonusProducts(); 21629 base.focusChooseBonusProductModal(); 21630 base.trapChooseBonusProductModalFocus(); 21631 base.onClosingChooseBonusProductModal(); 21632}; 21633 21634$(document).ready(function () { 21635 $('.coupon-missing-error').hide(); 21636 // window.setTimeout(function () { 21637 // $(".alert").fadeTo(1000, 0).slideUp(1000, function () { 21638 // $(this).remove(); 21639 // }); 21640 // }, 5000); 21641 21642 $(document).on('submit', '.points-redeem', function(e){ 21643 e.preventDefault(); 21644 var $form = $(this); 21645 var url = $(this).data('action'); 21646 $.ajax({
21647 type: "Post", 21648 url: url, 21649 data: $form.serialize(), 21650 success: function (response) { 21651 if (!response.error) { 21652 location.reload(); 21653 } else { 21654 $('.points-tnc').empty().append(response.errorMessage); 21655 } 21656 } 21657 }); 21658 }); 21659}); 21660 21661document.addEventListener('DOMContentLoaded', function () { 21662 const pointsInput = document.getElementById('pointsInput'); 21663 21664 if (pointsInput) { 21665 const subtotalEl = document.getElementById('sub-total-purchase'); 21666 const subtotalNumber = subtotalEl ? parseFloat(subtotalEl.innerText.replace(/\D/g, '')) : 0; 21667 const maxPoints = parseInt(pointsInput.getAttribute('data-max-points'), 10) || 0; 21668 const limit = Math.min(maxPoints, subtotalNumber); 21669 21670 pointsInput.addEventListener('keypress', function (e) { 21671 if (!/^[0-9]$/.test(e.key)) { 21672 e.preventDefault(); 21673 } 21674 }); 21675 pointsInput.addEventListener('input', function () { 21676 this.value = this.value.replace(/\D/g, ''); 21677 }); 21678 pointsInput.addEventListener('blur', function () { 21679 let val = parseInt(this.value, 10) || 0; 21680 if (val < 100 && this.value.length > 0) { 21681 val = 100; 21682 } 21683 if (val > limit) { 21684 val = limit; 21685 } 21686 this.value = val; 21687 }); 21688 pointsInput.addEventListener('focusout', function () { 21689 let val = parseInt(this.value, 10) || 0; 21690 if (val < 100 && this.value.length > 0) { 21691 val = 100; 21692 } 21693 if (val > limit) { 21694 val = limit; 21695 } 21696 this.value = val; 21697 }); 21698 pointsInput.addEventListener('keydown', function (e) { 21699 if (['-', '+', '.', 'e', 'E'].includes(e.key)) { 21700 e.preventDefault(); 21701 } 21702 }); 21703 } 21704}); 21705 21706$(document).on('click', '.remove-points', function () { 21707 var url = $(this).data('action'); 21708 $.post(url, {}, 21709 function (response) { 21710 if (!response.error) { 21711 location.reload(); 21712 } 21713 } 21714 ); 21715}); 21716 21717 21718 21719/***/ }), 21720 21721/***/ 5: 21722/***/ (function(module, exports, __webpack_require__) { 21723 21724"use strict"; 21725 21726var focusHelper = __webpack_require__(6); 21727 21728/** 21729 * Retrieves the relevant pid value 21730 * @param {jquery} $el - DOM container for a given add to cart button 21731 * @return {string} - value to be used when adding product to cart 21732 */ 21733function getPidValue($el) { 21734 var pid; 21735 21736 if ($('#quickViewModal').hasClass('show') && !$('.product-set').length) { 21737 pid = $($el).closest('.modal-content').find('.product-quickview').data('pid'); 21738 } else if ($('.product-set-detail').length || $('.product-set').length) { 21739 pid = $($el).closest('.product-detail').find('.product-id').text(); 21740 } else { 21741 pid = $('.product-detail:not(".bundle-item")').data('pid'); 21742 } 21743 21744 return pid; 21745} 21746 21747/** 21748 * Retrieve contextual quantity selector 21749 * @param {jquery} $el - DOM container for the relevant quantity 21750 * @return {jquery} - quantity selector DOM container 21751 */ 21752function getQuantitySelector($el) { 21753 var quantitySelected; 21754 if ($el && $('.set-items').length) { 21755 quantitySelected = $($el).closest('.product-detail').find('.quantity-select'); 21756 } else if ($el && $('.product-bundle').length) { 21757 var quantitySelectedModal = $($el).closest('.modal-footer').find('.quantity-select'); 21758 var quantitySelectedPDP = $($el).closest('.bundle-footer').find('.quantity-select'); 21759 if (quantitySelectedModal.val() === undefined) { 21760 quantitySelected = quantitySelectedPDP; 21761 } else { 21762 quantitySelected = quantitySelectedModal; 21763 } 21764 } else { 21765 quantitySelected = $('.quantity-select'); 21766 } 21767 return quantitySelected; 21768} 21769 21770/** 21771 * Retrieves the value associated with the Quantity pull-down menu 21772 * @param {jquery} $el - DOM container for the relevant quantity 21773 * @return {string} - value found in the quantity input 21774 */ 21775function getQuantitySelected($el) { 21776 return getQuantitySelector($el).val(); 21777} 21778 21779/** 21780 * Process the attribute values for an attribute that has image swatches 21781 * 21782 * @param {Object} attr - Attribute 21783 * @param {string} attr.id - Attribute ID 21784 * @param {Object[]} attr.values - Array of attribute value objects 21785 * @param {string} attr.values.value - Attribute coded value 21786 * @param {string}
21786 attr.values.url - URL to de/select an attribute value of the product 21787 * @param {boolean} attr.values.isSelectable - Flag as to whether an attribute value can be 21788 * selected. If there is no variant that corresponds to a specific combination of attribute 21789 * values, an attribute may be disabled in the Product Detail Page 21790 * @param {jQuery} $productContainer - DOM container for a given product 21791 * @param {Object} msgs - object containing resource messages 21792 */ 21793function processSwatchValues(attr, $productContainer, msgs) { 21794 attr.values.forEach(function (attrValue) { 21795 var $attrValue = $productContainer.find('[data-attr="' + attr.id + '"] [data-attr-value="' + 21796 attrValue.value + '"]'); 21797 var $swatchButton = $attrValue.parent(); 21798 21799 if (attrValue.selected) { 21800 $attrValue.addClass('selected'); 21801 $attrValue.siblings('.selected-assistive-text').text(msgs.assistiveSelectedText); 21802 } else { 21803 $attrValue.removeClass('selected'); 21804 $attrValue.siblings('.selected-assistive-text').empty(); 21805 } 21806 21807 if (attrValue.url) { 21808 $swatchButton.attr('data-url', attrValue.url); 21809 } else { 21810 $swatchButton.removeAttr('data-url'); 21811 } 21812 21813 // Disable if not selectable 21814 $attrValue.removeClass('selectable unselectable'); 21815 21816 $attrValue.addClass(attrValue.selectable ? 'selectable' : 'unselectable'); 21817 }); 21818} 21819 21820/** 21821 * Process attribute values associated with an attribute that does not have image swatches 21822 * 21823 * @param {Object} attr - Attribute 21824 * @param {string} attr.id - Attribute ID 21825 * @param {Object[]} attr.values - Array of attribute value objects 21826 * @param {string} attr.values.value - Attribute coded value 21827 * @param {string} attr.values.url - URL to de/select an attribute value of the product 21828 * @param {boolean} attr.values.isSelectable - Flag as to whether an attribute value can be 21829 * selected. If there is no variant that corresponds to a specific combination of attribute 21830 * values, an attribute may be disabled in the Product Detail Page 21831 * @param {jQuery} $productContainer - DOM container for a given product 21832 */ 21833function processNonSwatchValues(attr, $productContainer) { 21834 var $attr = '[data-attr="' + attr.id + '"]'; 21835 var $defaultOption = $productContainer.find($attr + ' .select-' + attr.id + ' option:first'); 21836 $defaultOption.attr('value', attr.resetUrl); 21837 21838 attr.values.forEach(function (attrValue) { 21839 var $attrValue = $productContainer 21840 .find($attr + ' [data-attr-value="' + attrValue.value + '"]'); 21841 $attrValue.attr('value', attrValue.url) 21842 .removeAttr('disabled'); 21843 21844 if (!attrValue.selectable) { 21845 $attrValue.attr('disabled', true); 21846 } 21847 }); 21848} 21849 21850/** 21851 * Routes the handling of attribute processing depending on whether the attribute has image 21852 * swatches or not 21853 * 21854 * @param {Object} attrs - Attribute 21855 * @param {string} attr.id - Attribute ID 21856 * @param {jQuery} $productContainer - DOM element for a given product 21857 * @param {Object} msgs - object containing resource messages 21858 */ 21859function updateAttrs(attrs, $productContainer, msgs) { 21860 // Currently, the only attribute type that has image swatches is Color. 21861 var attrsWithSwatches = ['color']; 21862 21863 attrs.forEach(function (attr) { 21864 if (attrsWithSwatches.indexOf(attr.id) > -1) { 21865 processSwatchValues(attr, $productContainer, msgs); 21866 } else { 21867 processNonSwatchValues(attr, $productContainer); 21868 } 21869 }); 21870} 21871 21872/** 21873 * Updates the availability status in the Product Detail Page 21874 * 21875 * @param {Object} response - Ajax response object after an 21876 * attribute value has been [de]selected 21877 * @param {jQuery} $productContainer - DOM element for a given product 21878 */ 21879function updateAvailability(response, $productContainer) { 21880 var availabilityValue = ''; 21881 var availabilityMessages = response.product.availability.messages; 21882 if (!response.product.readyToOrder) { 21883 availabilityValue = '<li><div>' + response.resources.info_selectforstock + '</div></li>'; 21884 } else {
21885 availabilityMessages.forEach(function (message) { 21886 availabilityValue += '<li><div>' + message + '</div></li>'; 21887 }); 21888 } 21889 21890 $($productContainer).trigger('product:updateAvailability', { 21891 product: response.product, 21892 $productContainer: $productContainer, 21893 message: availabilityValue, 21894 resources: response.resources 21895 }); 21896} 21897 21898/** 21899 * Generates html for product attributes section 21900 * 21901 * @param {array} attributes - list of attributes 21902 * @return {string} - Compiled HTML 21903 */ 21904function getAttributesHtml(attributes) { 21905 if (!attributes) { 21906 return ''; 21907 } 21908 21909 var html = ''; 21910 21911 attributes.forEach(function (attributeGroup) { 21912 if (attributeGroup.ID === 'mainAttributes') { 21913 attributeGroup.attributes.forEach(function (attribute) { 21914 html += '<div class="attribute-values">' + attribute.label + ': ' 21915 + attribute.value + '</div>'; 21916 }); 21917 } 21918 }); 21919 21920 return html; 21921} 21922 21923/** 21924 * @typedef UpdatedOptionValue 21925 * @type Object 21926 * @property {string} id - Option value ID for look up 21927 * @property {string} url - Updated option value selection URL 21928 */ 21929 21930/** 21931 * @typedef OptionSelectionResponse 21932 * @type Object 21933 * @property {string} priceHtml - Updated price HTML code 21934 * @property {Object} options - Updated Options 21935 * @property {string} options.id - Option ID 21936 * @property {UpdatedOptionValue[]} options.values - Option values 21937 */ 21938 21939/** 21940 * Updates DOM using post-option selection Ajax response 21941 * 21942 * @param {OptionSelectionResponse} optionsHtml - Ajax response optionsHtml from selecting a product option 21943 * @param {jQuery} $productContainer - DOM element for current product 21944 */ 21945function updateOptions(optionsHtml, $productContainer) { 21946 // Update options 21947 $productContainer.find('.product-options').empty().html(optionsHtml); 21948} 21949 21950/** 21951 * Dynamically creates Bootstrap carousel from response containing images 21952 * @param {Object[]} imgs - Array of large product images,along with related information 21953 * @param {jQuery} $productContainer - DOM element for a given product 21954 */ 21955function createCarousel(imgs, $productContainer) { 21956 var carousel = $productContainer.find('.carousel'); 21957 $(carousel).carousel('dispose'); 21958 var carouselId = $(carousel).attr('id'); 21959 $(carousel).empty().append('<ol class="carousel-indicators"></ol><div class="carousel-inner" role="listbox"></div><a class="carousel-control-prev" href="#' + carouselId + '" role="button" data-slide="prev"><span class="fa icon-prev" aria-hidden="true"></span><span class="sr-only">' + $(carousel).data('prev') + '</span></a><a class="carousel-control-next" href="#' + carouselId + '" role="button" data-slide="next"><span class="fa icon-next" aria-hidden="true"></span><span class="sr-only">' + $(carousel).data('next') + '</span></a>'); 21960 for (var i = 0; i < imgs.length; i++) { 21961 $('<div class="carousel-item"><img src="' + imgs[i].url + '" class="d-block img-fluid" alt="' + imgs[i].alt + ' image number ' + parseInt(imgs[i].index, 10) + '" title="' + imgs[i].title + '" itemprop="image" /></div>').appendTo($(carousel).find('.carousel-inner')); 21962 $('<li data-target="#' + carouselId + '" data-slide-to="' + i + '" class=""></li>').appendTo($(carousel).find('.carousel-indicators')); 21963 } 21964 $($(carousel).find('.carousel-item')).first().addClass('active'); 21965 $($(carousel).find('.carousel-indicators > li')).first().addClass('active'); 21966 if (imgs.length === 1) { 21967 $($(carousel).find('.carousel-indicators, a[class^="carousel-control-"]')).detach(); 21968 } 21969 $(carousel).carousel(); 21970 $($(carousel).find('.carousel-indicators')).attr('aria-hidden', true); 21971} 21972 21973/** 21974 * Parses JSON from Ajax call made whenever an attribute value is [de]selected 21975 * @param {Object} response - response from Ajax call 21976 * @param {Object} response.product - Product object 21977 * @param {string} response.product.id - Product ID 21978 * @param {Object[]} response.product.variationAttributes - Product attributes 21979 * @param {Object[]} response.product.images - Product images 21980 * @param {boolean} response.product.hasRequiredAttrsSelected - Flag as to whether all required 21981 * attributes have been selected. Used partially to 21982 * determine whether the Add to Cart button can be enabled 21983 * @param {jQuery}
21983 $productContainer - DOM element for a given product. 21984 */ 21985function handleVariantResponse(response, $productContainer) { 21986 var isChoiceOfBonusProducts = 21987 $productContainer.parents('.choose-bonus-product-dialog').length > 0; 21988 var isVaraint; 21989 if (response.product.variationAttributes) { 21990 updateAttrs(response.product.variationAttributes, $productContainer, response.resources); 21991 isVaraint = response.product.productType === 'variant'; 21992 if (isChoiceOfBonusProducts && isVaraint) { 21993 $productContainer.parent('.bonus-product-item') 21994 .data('pid', response.product.id); 21995 21996 $productContainer.parent('.bonus-product-item') 21997 .data('ready-to-order', response.product.readyToOrder); 21998 } 21999 } 22000 22001 // Update primary images 22002 var primaryImageUrls = response.product.images.large; 22003 createCarousel(primaryImageUrls, $productContainer); 22004 22005 // Update pricing 22006 if (!isChoiceOfBonusProducts) { 22007 var $priceSelector = $('.prices .price', $productContainer).length 22008 ? $('.prices .price', $productContainer) 22009 : $('.prices .price'); 22010 $priceSelector.replaceWith(response.product.price.html); 22011 } 22012 22013 // Update promotions 22014 $productContainer.find('.promotions').empty().html(response.product.promotionsHtml); 22015 22016 updateAvailability(response, $productContainer); 22017 22018 if (isChoiceOfBonusProducts) { 22019 var $selectButton = $productContainer.find('.select-bonus-product'); 22020 $selectButton.trigger('bonusproduct:updateSelectButton', { 22021 product: response.product, $productContainer: $productContainer 22022 }); 22023 } else { 22024 // Enable "Add to Cart" button if all required attributes have been selected 22025 $('button.add-to-cart, button.add-to-cart-global, button.update-cart-product-global').trigger('product:updateAddToCart', { 22026 product: response.product, $productContainer: $productContainer 22027 }).trigger('product:statusUpdate', response.product); 22028 } 22029 22030 // Update attributes 22031 $productContainer.find('.main-attributes').empty() 22032 .html(getAttributesHtml(response.product.attributes)); 22033} 22034 22035/** 22036 * @typespec UpdatedQuantity 22037 * @type Object 22038 * @property {boolean} selected - Whether the quantity has been selected 22039 * @property {string} value - The number of products to purchase 22040 * @property {string} url - Compiled URL that specifies variation attributes, product ID, options, 22041 * etc. 22042 */ 22043 22044/** 22045 * Updates the quantity DOM elements post Ajax call 22046 * @param {UpdatedQuantity[]} quantities - 22047 * @param {jQuery} $productContainer - DOM container for a given product 22048 */ 22049function updateQuantities(quantities, $productContainer) { 22050 if ($productContainer.parent('.bonus-product-item').length <= 0) { 22051 var optionsHtml = quantities.map(function (quantity) { 22052 var selected = quantity.selected ? ' selected ' : ''; 22053 return '<option value="' + quantity.value + '" data-url="' + quantity.url + '"' + 22054 selected + '>' + quantity.value + '</option>'; 22055 }).join(''); 22056 getQuantitySelector($productContainer).empty().html(optionsHtml); 22057 } 22058} 22059 22060/** 22061 * updates the product view when a product attribute is selected or deselected or when 22062 * changing quantity 22063 * @param {string} selectedValueUrl - the Url for the selected variation value 22064 * @param {jQuery} $productContainer - DOM element for current product 22065 */ 22066function attributeSelect(selectedValueUrl, $productContainer) { 22067 if (selectedValueUrl) { 22068 $('body').trigger('product:beforeAttributeSelect', 22069 { url: selectedValueUrl, container: $productContainer }); 22070 22071 $.ajax({
22072 url: selectedValueUrl, 22073 method: 'GET', 22074 success: function (data) { 22075 handleVariantResponse(data, $productContainer); 22076 updateOptions(data.product.optionsHtml, $productContainer); 22077 updateQuantities(data.product.quantities, $productContainer); 22078 $('body').trigger('product:afterAttributeSelect', 22079 { data: data, container: $productContainer }); 22080 $.spinner().stop(); 22081 }, 22082 error: function () { 22083 $.spinner().stop(); 22084 } 22085 }); 22086 } 22087} 22088 22089/** 22090 * Retrieves url to use when adding a product to the cart 22091 * 22092 * @return {string} - The provided URL to use when adding a product to the cart 22093 */ 22094function getAddToCartUrl() { 22095 return $('.add-to-cart-url').val(); 22096} 22097 22098/** 22099 * Parses the html for a modal window 22100 * @param {string} html - representing the body and footer of the modal window 22101 * 22102 * @return {Object} - Object with properties body and footer. 22103 */ 22104function parseHtml(html) { 22105 var $html = $('<div>').append($.parseHTML(html)); 22106 22107 var body = $html.find('.choice-of-bonus-product'); 22108 var footer = $html.find('.modal-footer').children(); 22109 22110 return { body: body, footer: footer }; 22111} 22112 22113/** 22114 * Retrieves url to use when adding a product to the cart 22115 * 22116 * @param {Object} data - data object used to fill in dynamic portions of the html 22117 */ 22118function chooseBonusProducts(data) { 22119 $('.modal-body').spinner().start(); 22120 22121 if ($('#chooseBonusProductModal').length !== 0) { 22122 $('#chooseBonusProductModal').remove(); 22123 } 22124 var bonusUrl; 22125 if (data.bonusChoiceRuleBased) { 22126 bonusUrl = data.showProductsUrlRuleBased; 22127 } else { 22128 bonusUrl = data.showProductsUrlListBased; 22129 } 22130 22131 var htmlString = '<!-- Modal -->' 22132 + '<div class="modal fade" id="chooseBonusProductModal" tabindex="-1" role="dialog">' 22133 + '<span class="enter-message sr-only" ></span>' 22134 + '<div class="modal-dialog choose-bonus-product-dialog" ' 22135 + 'data-total-qty="' + data.maxBonusItems + '"' 22136 + 'data-UUID="' + data.uuid + '"' 22137 + 'data-pliUUID="' + data.pliUUID + '"' 22138 + 'data-addToCartUrl="' + data.addToCartUrl + '"' 22139 + 'data-pageStart="0"' 22140 + 'data-pageSize="' + data.pageSize + '"' 22141 + 'data-moreURL="' + data.showProductsUrlRuleBased + '"' 22142 + 'data-bonusChoiceRuleBased="' + data.bonusChoiceRuleBased + '">' 22143 + '<!-- Modal content-->' 22144 + '<div class="modal-content">' 22145 + '<div class="modal-header">' 22146 + ' <span class="">' + data.labels.selectprods + '</span>' 22147 + ' <button type="button" class="close pull-right" data-dismiss="modal">' 22148 + ' <span aria-hidden="true">×</span>' 22149 + ' <span class="sr-only"> </span>' 22150 + ' </button>' 22151 + '</div>' 22152 + '<div class="modal-body"></div>' 22153 + '<div class="modal-footer"></div>' 22154 + '</div>' 22155 + '</div>' 22156 + '</div>'; 22157 $('body').append(htmlString); 22158 $('.modal-body').spinner().start(); 22159 22160 $.ajax({
22161 url: bonusUrl, 22162 method: 'GET', 22163 dataType: 'json', 22164 success: function (response) { 22165 var parsedHtml = parseHtml(response.renderedTemplate); 22166 $('#chooseBonusProductModal .modal-body').empty(); 22167 $('#chooseBonusProductModal .enter-message').text(response.enterDialogMessage); 22168 $('#chooseBonusProductModal .modal-header .close .sr-only').text(response.closeButtonText); 22169 $('#chooseBonusProductModal .modal-body').html(parsedHtml.body); 22170 $('#chooseBonusProductModal .modal-footer').html(parsedHtml.footer); 22171 $('#chooseBonusProductModal').modal('show'); 22172 $.spinner().stop(); 22173 }, 22174 error: function () { 22175 $.spinner().stop(); 22176 } 22177 }); 22178} 22179 22180/** 22181 * Updates the Mini-Cart quantity value after the customer has pressed the "Add to Cart" button 22182 * @param {string} response - ajax response from clicking the add to cart button 22183 */ 22184function handlePostCartAdd(response) { 22185 $('.minicart').trigger('count:update', response); 22186 var messageType = response.error ? 'alert-danger' : 'alert-success'; 22187 // show add to cart toast 22188 if (response.newBonusDiscountLineItem 22189 && Object.keys(response.newBonusDiscountLineItem).length !== 0) { 22190 chooseBonusProducts(response.newBonusDiscountLineItem); 22191 } else { 22192 if ($('.add-to-cart-messages').length === 0) { 22193 $('body').append( 22194 '<div class="add-to-cart-messages"></div>' 22195 ); 22196 } 22197 22198 $('.add-to-cart-messages').append( 22199 '<div class="alert ' + messageType + ' add-to-basket-alert text-center" role="alert">' 22200 + response.message 22201 + '</div>' 22202 ); 22203 22204 setTimeout(function () { 22205 $('.add-to-basket-alert').remove(); 22206 }, 5000); 22207 } 22208} 22209 22210/** 22211 * Retrieves the bundle product item ID's for the Controller to replace bundle master product 22212 * items with their selected variants 22213 * 22214 * @return {string[]} - List of selected bundle product item ID's 22215 */ 22216function getChildProducts() { 22217 var childProducts = []; 22218 $('.bundle-item').each(function () { 22219 childProducts.push({ 22220 pid: $(this).find('.product-id').text(), 22221 quantity: parseInt($(this).find('label.quantity').data('quantity'), 10) 22222 }); 22223 }); 22224 22225 return childProducts.length ? JSON.stringify(childProducts) : []; 22226} 22227 22228/** 22229 * Retrieve product options 22230 * 22231 * @param {jQuery} $productContainer - DOM element for current product 22232 * @return {string} - Product options and their selected values 22233 */ 22234function getOptions($productContainer) { 22235 var options = $productContainer 22236 .find('.product-option') 22237 .map(function () { 22238 var $elOption = $(this).find('.options-select'); 22239 var urlValue = $elOption.val(); 22240 var selectedValueId = $elOption.find('option[value="' + urlValue + '"]') 22241 .data('value-id'); 22242 return { 22243 optionId: $(this).data('option-id'), 22244 selectedValueId: selectedValueId 22245 }; 22246 }).toArray(); 22247 22248 return JSON.stringify(options); 22249} 22250 22251/** 22252 * Makes a call to the server to report the event of adding an item to the cart 22253 * 22254 * @param {string | boolean} url - a string representing the end point to hit so that the event can be recorded, or false 22255 */ 22256function miniCartReportingUrl(url) { 22257 if (url) { 22258 $.ajax({
22259 url: url, 22260 method: 'GET', 22261 success: function () { 22262 // reporting urls hit on the server 22263 }, 22264 error: function () { 22265 // no reporting urls hit on the server 22266 } 22267 }); 22268 } 22269} 22270 22271module.exports = { 22272 attributeSelect: attributeSelect, 22273 methods: { 22274 editBonusProducts: function (data) { 22275 chooseBonusProducts(data); 22276 } 22277 }, 22278 22279 focusChooseBonusProductModal: function () { 22280 $('body').on('shown.bs.modal', '#chooseBonusProductModal', function () { 22281 $('#chooseBonusProductModal').siblings().attr('aria-hidden', 'true'); 22282 $('#chooseBonusProductModal .close').focus(); 22283 }); 22284 }, 22285 22286 onClosingChooseBonusProductModal: function () { 22287 $('body').on('hidden.bs.modal', '#chooseBonusProductModal', function () { 22288 $('#chooseBonusProductModal').siblings().attr('aria-hidden', 'false'); 22289 }); 22290 }, 22291 22292 trapChooseBonusProductModalFocus: function () { 22293 $('body').on('keydown', '#chooseBonusProductModal', function (e) { 22294 var focusParams = { 22295 event: e, 22296 containerSelector: '#chooseBonusProductModal', 22297 firstElementSelector: '.close', 22298 lastElementSelector: '.add-bonus-products' 22299 }; 22300 focusHelper.setTabNextFocus(focusParams); 22301 }); 22302 }, 22303 22304 colorAttribute: function () { 22305 $(document).on('click', '[data-attr="color"] button', function (e) { 22306 e.preventDefault(); 22307 22308 if ($(this).attr('disabled')) { 22309 return; 22310 } 22311 var $productContainer = $(this).closest('.set-item');
22312 if (!$productContainer.length) { 22313 $productContainer = $(this).closest('.product-detail'); 22314 } 22315 22316 attributeSelect($(this).attr('data-url'), $productContainer); 22317 }); 22318 }, 22319 22320 selectAttribute: function () { 22321 $(document).on('change', 'select[class*="select-"], .options-select', function (e) { 22322 e.preventDefault(); 22323 22324 var $productContainer = $(this).closest('.set-item'); 22325 if (!$productContainer.length) { 22326 $productContainer = $(this).closest('.product-detail'); 22327 } 22328 attributeSelect(e.currentTarget.value, $productContainer); 22329 }); 22330 }, 22331 22332 availability: function () { 22333 $(document).on('change', '.quantity-select', function (e) { 22334 e.preventDefault(); 22335 22336 var $productContainer = $(this).closest('.product-detail'); 22337 if (!$productContainer.length) { 22338 $productContainer = $(this).closest('.modal-content').find('.product-quickview'); 22339 } 22340 22341 if ($('.bundle-items', $productContainer).length === 0) { 22342 attributeSelect($(e.currentTarget).find('option:selected').data('url'), 22343 $productContainer); 22344 } 22345 }); 22346 }, 22347 22348 addToCart: function () { 22349 $(document).on('click', 'button.add-to-cart, button.add-to-cart-global', function () { 22350 var addToCartUrl; 22351 var pid; 22352 var pidsObj; 22353 var setPids; 22354 22355 $('body').trigger('product:beforeAddToCart', this); 22356 22357 if ($('.set-items').length && $(this).hasClass('add-to-cart-global')) { 22358 setPids = []; 22359 22360 $('.product-detail').each(function () { 22361 if (!$(this).hasClass('product-set-detail')) { 22362 setPids.push({ 22363 pid: $(this).find('.product-id').text(), 22364 qty: $(this).find('.quantity-select').val(), 22365 options: getOptions($(this)) 22366 }); 22367 } 22368 }); 22369 pidsObj = JSON.stringify(setPids); 22370 } 22371 22372 pid = getPidValue($(this)); 22373 22374 var $productContainer = $(this).closest('.product-detail');
22375 if (!$productContainer.length) { 22376 $productContainer = $(this).closest('.quick-view-dialog').find('.product-detail'); 22377 } 22378 22379 addToCartUrl = getAddToCartUrl(); 22380 22381 var form = { 22382 pid: pid, 22383 pidsObj: pidsObj, 22384 childProducts: getChildProducts(), 22385 quantity: getQuantitySelected($(this)) 22386 }; 22387 22388 if (!$('.bundle-item').length) { 22389 form.options = getOptions($productContainer); 22390 } 22391 22392 $(this).trigger('updateAddToCartFormData', form); 22393 if (addToCartUrl) { 22394 $.ajax({ 22395 url: addToCartUrl, 22396 method: 'POST', 22397 data: form, 22398 success: function (data) { 22399 handlePostCartAdd(data); 22400 $('body').trigger('product:afterAddToCart', data); 22401 $.spinner().stop(); 22402 miniCartReportingUrl(data.reportingURL); 22403 }, 22404 error: function () { 22405 $.spinner().stop(); 22406 } 22407 }); 22408 } 22409 }); 22410 }, 22411 selectBonusProduct: function () { 22412 $(document).on('click', '.select-bonus-product', function () { 22413 var $choiceOfBonusProduct = $(this).parents('.choice-of-bonus-product'); 22414 var pid = $(this).data('pid'); 22415 var maxPids = $('.choose-bonus-product-dialog').data('total-qty'); 22416 var submittedQty = parseInt($choiceOfBonusProduct.find('.bonus-quantity-select').val(), 10); 22417 var totalQty = 0; 22418 $.each($('#chooseBonusProductModal .selected-bonus-products .selected-pid'), function () { 22419 totalQty += $(this).data('qty'); 22420 }); 22421 totalQty += submittedQty; 22422 var optionID = $choiceOfBonusProduct.find('.product-option').data('option-id'); 22423 var valueId = $choiceOfBonusProduct.find('.options-select option:selected').data('valueId'); 22424 if (totalQty <= maxPids) { 22425 var selectedBonusProductHtml = '' 22426 + '<div class="selected-pid row" ' 22427 + 'data-pid="' + pid + '"' 22428 + 'data-qty="' + submittedQty + '"' 22429 + 'data-optionID="' + (optionID || '') + '"' 22430 + 'data-option-selected-value="' + (valueId || '') + '"' 22431 + '>' 22432 + '<div class="col-sm-11 col-9 bonus-product-name" >' 22433 + $choiceOfBonusProduct.find('.product-name').html() 22434 + '</div>' 22435 + '<div class="col-1"><i class="fa fa-times" aria-hidden="true"></i></div>' 22436 + '</div>' 22437 ; 22438 $('#chooseBonusProductModal .selected-bonus-products').append(selectedBonusProductHtml); 22439 $('.pre-cart-products').html(totalQty); 22440 $('.selected-bonus-products .bonus-summary').removeClass('alert-danger'); 22441 } else { 22442 $('.selected-bonus-products .bonus-summary').addClass('alert-danger'); 22443 } 22444 }); 22445 }, 22446 removeBonusProduct: function () { 22447 $(document).on('click', '.selected-pid', function () { 22448 $(this).remove(); 22449 var $selected = $('#chooseBonusProductModal .selected-bonus-products .selected-pid'); 22450 var count = 0; 22451 if ($selected.length) { 22452 $selected.each(function () { 22453 count += parseInt($(this).data('qty'), 10); 22454 }); 22455 } 22456 22457 $('.pre-cart-products').html(count); 22458 $('.selected-bonus-products .bonus-summary').removeClass('alert-danger'); 22459 }); 22460 }, 22461 enableBonusProductSelection: function () { 22462 $('body').on('bonusproduct:updateSelectButton', function (e, response) { 22463 $('button.select-bonus-product', response.$productContainer).attr('disabled', 22464 (!response.product.readyToOrder || !response.product.available)); 22465 var pid = response.product.id;
22466 $('button.select-bonus-product', response.$productContainer).data('pid', pid); 22467 }); 22468 }, 22469 showMoreBonusProducts: function () { 22470 $(document).on('click', '.show-more-bonus-products', function () { 22471 var url = $(this).data('url'); 22472 $('.modal-content').spinner().start(); 22473 $.ajax({ 22474 url: url, 22475 method: 'GET', 22476 success: function (html) { 22477 var parsedHtml = parseHtml(html); 22478 $('.modal-body').append(parsedHtml.body); 22479 $('.show-more-bonus-products:first').remove(); 22480 $('.modal-content').spinner().stop(); 22481 }, 22482 error: function () { 22483 $('.modal-content').spinner().stop(); 22484 } 22485 }); 22486 }); 22487 }, 22488 addBonusProductsToCart: function () { 22489 $(document).on('click', '.add-bonus-products', function () { 22490 var $readyToOrderBonusProducts = $('.choose-bonus-product-dialog .selected-pid'); 22491 var queryString = '?pids='; 22492 var url = $('.choose-bonus-product-dialog').data('addtocarturl'); 22493 var pidsObject = { 22494 bonusProducts: [] 22495 }; 22496 22497 $.each($readyToOrderBonusProducts, function () { 22498 var qtyOption = 22499 parseInt($(this) 22500 .data('qty'), 10); 22501 22502 var option = null; 22503 if (qtyOption > 0) { 22504 if ($(this).data('optionid') && $(this).data('option-selected-value')) { 22505 option = {}; 22506 option.optionId = $(this).data('optionid'); 22507 option.productId = $(this).data('pid'); 22508 option.selectedValueId = $(this).data('option-selected-value'); 22509 } 22510 pidsObject.bonusProducts.push({ 22511 pid: $(this).data('pid'), 22512 qty: qtyOption, 22513 options: [option] 22514 }); 22515 pidsObject.totalQty = parseInt($('.pre-cart-products').html(), 10); 22516 } 22517 }); 22518 queryString += JSON.stringify(pidsObject); 22519 queryString = queryString + '&uuid=' + $('.choose-bonus-product-dialog').data('uuid'); 22520 queryString = queryString + '&pliuuid=' + $('.choose-bonus-product-dialog').data('pliuuid'); 22521 $.spinner().start(); 22522 $.ajax({
22523 url: url + queryString, 22524 method: 'POST', 22525 success: function (data) { 22526 $.spinner().stop(); 22527 if (data.error) { 22528 $('#chooseBonusProductModal').modal('hide'); 22529 if ($('.add-to-cart-messages').length === 0) { 22530 $('body').append('<div class="add-to-cart-messages"></div>'); 22531 } 22532 $('.add-to-cart-messages').append( 22533 '<div class="alert alert-danger add-to-basket-alert text-center"' 22534 + ' role="alert">' 22535 + data.errorMessage + '</div>' 22536 ); 22537 setTimeout(function () { 22538 $('.add-to-basket-alert').remove(); 22539 }, 3000); 22540 } else { 22541 $('.configure-bonus-product-attributes').html(data); 22542 $('.bonus-products-step2').removeClass('hidden-xl-down'); 22543 $('#chooseBonusProductModal').modal('hide'); 22544 22545 if ($('.add-to-cart-messages').length === 0) { 22546 $('body').append('<div class="add-to-cart-messages"></div>'); 22547 } 22548 $('.minicart-quantity').html(data.totalQty); 22549 $('.add-to-cart-messages').append( 22550 '<div class="alert alert-success add-to-basket-alert text-center"' 22551 + ' role="alert">' 22552 + data.msgSuccess + '</div>' 22553 ); 22554 setTimeout(function () { 22555 $('.add-to-basket-alert').remove(); 22556 if ($('.cart-page').length) { 22557 location.reload(); 22558 } 22559 }, 1500); 22560 } 22561 }, 22562 error: function () { 22563 $.spinner().stop(); 22564 } 22565 }); 22566 }); 22567 }, 22568 22569 getPidValue: getPidValue, 22570 getQuantitySelected: getQuantitySelected, 22571 miniCartReportingUrl: miniCartReportingUrl 22572}; 22573 22574 22575/***/ }), 22576 22577/***/ 6: 22578/***/ (function(module, exports, __webpack_require__) { 22579 22580"use strict"; 22581 22582 22583module.exports = { 22584 setTabNextFocus: function (focusParams) { 22585 var KEYCODE_TAB = 9; 22586 var isTabPressed = (focusParams.event.key === 'Tab' || focusParams.event.keyCode === KEYCODE_TAB); 22587 22588 if (!isTabPressed) { 22589 return; 22590 } 22591 22592 var firstFocusableEl = $(focusParams.containerSelector + ' ' + focusParams.firstElementSelector); 22593 var lastFocusableEl = $(focusParams.containerSelector + ' ' + focusParams.lastElementSelector); 22594 22595 if ($(focusParams.containerSelector + ' ' + focusParams.lastElementSelector).is(':disabled')) { 22596 lastFocusableEl = $(focusParams.containerSelector + ' ' + focusParams.nextToLastElementSelector); 22597 if ($('.product-quickview.product-set').length > 0) { 22598 var linkElements = $(focusParams.containerSelector + ' a#fa-link.share-icons'); 22599 lastFocusableEl = linkElements[linkElements.length - 1]; 22600 } 22601 } 22602 22603 if (focusParams.event.shiftKey) /* shift + tab */ { 22604 if ($(':focus').is(firstFocusableEl)) {
22605 lastFocusableEl.focus(); 22606 focusParams.event.preventDefault(); 22607 } 22608 } else /* tab */ { 22609 if ($(':focus').is(lastFocusableEl)) { // eslint-disable-line 22610 firstFocusableEl.focus(); 22611 focusParams.event.preventDefault(); 22612 } 22613 } 22614 } 22615}; 22616 22617 22618/***/ }) 22619 22620/******/ });
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.